New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

liferay-amd-loader

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liferay-amd-loader - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

src/demo/modules/.eslintrc.js

18

.eslintrc.js

@@ -0,5 +1,21 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/* eslint-env node */
const path = require('path');
module.exports = {
extends: 'liferay',
plugins: [],
rules: {},
rules: {
'notice/notice': [
'error',
{
templateFile: path.join(__dirname, 'copyright.js'),
},
],
},
};

@@ -0,6 +1,11 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
module.exports = {
extends: '../.eslintrc.js',
env: {
node: true,
},
extends: '../.eslintrc.js',
};

6

bin/build-demo.js
/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -10,6 +9,7 @@ */

const path = require('path');
const {copy, run} = require('./util');
if (!fs.existsSync('build/loader/loader-debug.js')) {
run('npm', 'run', 'build');
run('yarn', 'build');
}

@@ -16,0 +16,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -8,2 +7,3 @@ */

const globby = require('globby');
const {run} = require('./util');

@@ -10,0 +10,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -9,6 +8,7 @@ */

const fs = require('fs-extra');
const {run} = require('./util');
if (!fs.existsSync('build/demo/index.html')) {
run('npm', 'run', 'build-demo');
run('yarn', 'build-demo');
}

@@ -15,0 +15,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -8,8 +7,8 @@ */

__CONFIG__ = {
url: 'http://localhost:8080',
basePath: '',
combine: false,
explainResolutions: true,
namespace: 'Liferay',
explainResolutions: true,
combine: false,
url: 'http://localhost:8080',
waitTimeout: 2000,
};

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach(function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})}),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(6)),a=c(n(7)),l=c(n(0)),u=c(n(8)),s=c(n(9));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new o.default(t||window.__CONFIG__),this._log=new u.default(this._config),this._dependencyResolver=new i.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return s.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map(function(e){return" "+e}).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then(function(t){return e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnResolutionErrors(t),i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach(function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)}),b=e._setRejectTimeout(l,t,function(){w=!0,s.apply(void 0,arguments)}),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)}).then(function(){if(!w)return e._waitForModuleDefinitions(y)}).then(function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}}).catch(function(e){w||(b&&clearTimeout(b),s(e))})}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_throwOnResolutionErrors",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map(function(e){return" · "+e}).join("\n")),{resolutionErrors:t})}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter(function(e){return!t.getModule(e)})}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var o=t.resolvedModules.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),i=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingModules:o});n(i)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.implement}))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach(function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map(function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation}),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach(function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o}),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map(function(t){return e.getModule(t)})}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(5),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_fetch:a.default.new(),_define:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={method:"POST",body:a}),fetch(l,u).then(function(e){return e.text()}).then(function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)}).catch(o)}})}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach(function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)}))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:r});n.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map(function(e){return e.fetch}))}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e){e.exports={name:"liferay-amd-loader",version:"4.2.0",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"npm run format:check && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest --runInBand",format:"prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","format:check":"prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",lint:"eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","lint:fix":"eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test",proxyPortal:"webpack-dev-server --config webpack.proxyPortal.js"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testPathIgnorePatterns:[".eslintrc.js"],testURL:"http://localhost/"},author:{name:"Iliyan Peychev"},license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^5.15.1","eslint-config-liferay":"^3.0.0","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1",prettier:"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach((function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})})),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach((function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))})),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map((function(e){return e+"="+t[e]})).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(4)),a=c(n(7)),l=c(n(8)),u=c(n(9)),s=c(n(0));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new i.default(t||window.__CONFIG__),this._log=new l.default(this._config),this._dependencyResolver=new a.default(this._config),this._urlBuilder=new s.default(this._config),this._scriptLoader=new u.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return o.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map((function(e){return" "+e})).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then((function(t){if(e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnLegacyProtocolResolutionErrors(t),e._logServerMessages(l,t),t.errors&&t.errors.length>1)throw Object.assign(new Error("The server generated some errors while resolving modules"),{resolutionErrors:t.errors});return i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach((function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)})),b=e._setRejectTimeout(l,t,(function(){w=!0,s.apply(void 0,arguments)})),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)})).then((function(){if(!w)return e._waitForModuleDefinitions(y)})).then((function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}})).catch((function(e){w||(b&&clearTimeout(b),s(e))}))}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter((function(e){return!t.getModule(e)}))}},{key:"_logServerMessages",value:function(e,t){t.errors&&t.errors.length>0&&this._log.error("Errors returned from server for require(",e,"):",t.errors),t.warnings&&t.warnings.length>0&&this._log.warn("Warnings returned from server for require(",e,"):",t.warnings)}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout((function(){var o=t.resolvedModules.filter((function(e){var t=r.getModule(e);return!t||!t.implemented})),i=Object.assign(new Error("Load timeout for modules: "+e),{missingModules:o,modules:e,resolution:t});n(i)}),r.waitTimeout)}},{key:"_throwOnLegacyProtocolResolutionErrors",value:function(e){var t=e.resolvedModules.filter((function(e){return 0===e.indexOf(":ERROR:")})).map((function(e){return e.substr(7)}));if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map((function(e){return" · "+e})).join("\n")),{resolutionErrors:t})}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.define})))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.implement})))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach((function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map((function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation})),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}}))}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map((function(e){return e.implementation}))}}]),e}();t.default=d,d.prototype.define.amd={}},function(e){e.exports=JSON.parse('{"name":"liferay-amd-loader","version":"4.3.0","description":"AMD Loader with support for combo URL and conditional loading","scripts":{"clean":"rm -rf build","build":"node bin/build-loader.js","ci":"yarn format:check && yarn lint && yarn build && yarn build-demo && yarn test","build-demo":"node bin/build-demo.js","demo":"node bin/run-demo.js","test":"jest --runInBand","format":"prettier --write \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","format:check":"prettier --list-different \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint":"eslint \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint:fix":"eslint --fix \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","prepublish":"publish-please guard","publish-please":"publish-please","prepublishOnly":"yarn build && yarn build-demo && yarn test","proxyPortal":"webpack-dev-server --config webpack.proxyPortal.js"},"repository":{"type":"git","url":"git+https://github.com/liferay/liferay-amd-loader.git"},"jest":{"collectCoverage":true,"coverageDirectory":"build/coverage","modulePathIgnorePatterns":["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],"testPathIgnorePatterns":[".eslintrc.js"],"testURL":"http://localhost/"},"author":{"name":"Iliyan Peychev"},"license":"LGPL-3.0","keywords":["Liferay","AMD","ES6","Loader"],"bugs":{"url":"https://github.com/liferay/liferay-amd-loader/issues"},"homepage":"https://github.com/liferay/liferay-amd-loader","files":[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],"devDependencies":{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1","combohandler":"^0.4.0","eslint":"^6.5.1","eslint-config-liferay":"^13.0.0","fs-extra":"^5.0.0","globby":"^7.1.1","http-server":"^0.11.1","jest":"^22.2.1","prettier":"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach((function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o})),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map((function(t){return e.getModule(t)}))}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(6),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_define:a.default.new(),_fetch:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise((function(t,n){e._resolve=t,e._reject=n}));return Object.assign(t,e,{fulfilled:!1,rejected:!1,rejection:void 0,resolution:void 0,resolved:!1}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch((function(){})),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise((function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={body:a,method:"POST"}),fetch(l,u).then((function(e){return e.text()})).then((function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)})).catch(o)}}))}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map((function(e){return t._loadScript(e)}));return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach((function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)})))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{modules:e.modules,script:r,url:e.url});n.forEach((function(e){return e.fetch.reject(t)}))},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map((function(e){return e.fetch})))}}]),e}();t.default=l}]);
//# sourceMappingURL=loader-debug.js.map
/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach(function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})}),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(6)),a=c(n(7)),l=c(n(0)),u=c(n(8)),s=c(n(9));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new o.default(t||window.__CONFIG__),this._log=new u.default(this._config),this._dependencyResolver=new i.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return s.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map(function(e){return" "+e}).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then(function(t){return e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnResolutionErrors(t),i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach(function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)}),b=e._setRejectTimeout(l,t,function(){w=!0,s.apply(void 0,arguments)}),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)}).then(function(){if(!w)return e._waitForModuleDefinitions(y)}).then(function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}}).catch(function(e){w||(b&&clearTimeout(b),s(e))})}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_throwOnResolutionErrors",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map(function(e){return" · "+e}).join("\n")),{resolutionErrors:t})}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter(function(e){return!t.getModule(e)})}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var o=t.resolvedModules.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),i=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingModules:o});n(i)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.implement}))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach(function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map(function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation}),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach(function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o}),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map(function(t){return e.getModule(t)})}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(5),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_fetch:a.default.new(),_define:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={method:"POST",body:a}),fetch(l,u).then(function(e){return e.text()}).then(function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)}).catch(o)}})}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach(function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)}))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:r});n.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map(function(e){return e.fetch}))}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e){e.exports={name:"liferay-amd-loader",version:"4.2.0",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"npm run format:check && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest --runInBand",format:"prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","format:check":"prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",lint:"eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","lint:fix":"eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test",proxyPortal:"webpack-dev-server --config webpack.proxyPortal.js"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testPathIgnorePatterns:[".eslintrc.js"],testURL:"http://localhost/"},author:{name:"Iliyan Peychev"},license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^5.15.1","eslint-config-liferay":"^3.0.0","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1",prettier:"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach((function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})})),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach((function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))})),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map((function(e){return e+"="+t[e]})).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(4)),a=c(n(7)),l=c(n(8)),u=c(n(9)),s=c(n(0));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new i.default(t||window.__CONFIG__),this._log=new l.default(this._config),this._dependencyResolver=new a.default(this._config),this._urlBuilder=new s.default(this._config),this._scriptLoader=new u.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return o.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map((function(e){return" "+e})).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then((function(t){if(e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnLegacyProtocolResolutionErrors(t),e._logServerMessages(l,t),t.errors&&t.errors.length>1)throw Object.assign(new Error("The server generated some errors while resolving modules"),{resolutionErrors:t.errors});return i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach((function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)})),b=e._setRejectTimeout(l,t,(function(){w=!0,s.apply(void 0,arguments)})),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)})).then((function(){if(!w)return e._waitForModuleDefinitions(y)})).then((function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}})).catch((function(e){w||(b&&clearTimeout(b),s(e))}))}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter((function(e){return!t.getModule(e)}))}},{key:"_logServerMessages",value:function(e,t){t.errors&&t.errors.length>0&&this._log.error("Errors returned from server for require(",e,"):",t.errors),t.warnings&&t.warnings.length>0&&this._log.warn("Warnings returned from server for require(",e,"):",t.warnings)}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout((function(){var o=t.resolvedModules.filter((function(e){var t=r.getModule(e);return!t||!t.implemented})),i=Object.assign(new Error("Load timeout for modules: "+e),{missingModules:o,modules:e,resolution:t});n(i)}),r.waitTimeout)}},{key:"_throwOnLegacyProtocolResolutionErrors",value:function(e){var t=e.resolvedModules.filter((function(e){return 0===e.indexOf(":ERROR:")})).map((function(e){return e.substr(7)}));if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map((function(e){return" · "+e})).join("\n")),{resolutionErrors:t})}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.define})))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.implement})))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach((function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map((function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation})),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}}))}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map((function(e){return e.implementation}))}}]),e}();t.default=d,d.prototype.define.amd={}},function(e){e.exports=JSON.parse('{"name":"liferay-amd-loader","version":"4.3.0","description":"AMD Loader with support for combo URL and conditional loading","scripts":{"clean":"rm -rf build","build":"node bin/build-loader.js","ci":"yarn format:check && yarn lint && yarn build && yarn build-demo && yarn test","build-demo":"node bin/build-demo.js","demo":"node bin/run-demo.js","test":"jest --runInBand","format":"prettier --write \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","format:check":"prettier --list-different \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint":"eslint \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint:fix":"eslint --fix \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","prepublish":"publish-please guard","publish-please":"publish-please","prepublishOnly":"yarn build && yarn build-demo && yarn test","proxyPortal":"webpack-dev-server --config webpack.proxyPortal.js"},"repository":{"type":"git","url":"git+https://github.com/liferay/liferay-amd-loader.git"},"jest":{"collectCoverage":true,"coverageDirectory":"build/coverage","modulePathIgnorePatterns":["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],"testPathIgnorePatterns":[".eslintrc.js"],"testURL":"http://localhost/"},"author":{"name":"Iliyan Peychev"},"license":"LGPL-3.0","keywords":["Liferay","AMD","ES6","Loader"],"bugs":{"url":"https://github.com/liferay/liferay-amd-loader/issues"},"homepage":"https://github.com/liferay/liferay-amd-loader","files":[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],"devDependencies":{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1","combohandler":"^0.4.0","eslint":"^6.5.1","eslint-config-liferay":"^13.0.0","fs-extra":"^5.0.0","globby":"^7.1.1","http-server":"^0.11.1","jest":"^22.2.1","prettier":"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach((function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o})),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map((function(t){return e.getModule(t)}))}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(6),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_define:a.default.new(),_fetch:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise((function(t,n){e._resolve=t,e._reject=n}));return Object.assign(t,e,{fulfilled:!1,rejected:!1,rejection:void 0,resolution:void 0,resolved:!1}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch((function(){})),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise((function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={body:a,method:"POST"}),fetch(l,u).then((function(e){return e.text()})).then((function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)})).catch(o)}}))}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map((function(e){return t._loadScript(e)}));return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach((function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)})))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{modules:e.modules,script:r,url:e.url});n.forEach((function(e){return e.fetch.reject(t)}))},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map((function(e){return e.fetch})))}}]),e}();t.default=l}]);
//# sourceMappingURL=loader-debug.js.map

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach(function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})}),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=window.__CONFIG__||{},i="string"==typeof o.namespace?o.namespace:void 0,a=void 0===o.exposeGlobal||o.exposeGlobal,l=new r.default(o);if(i){var u=window[i]?window[i]:{};u.Loader=l,window[i]=u}else window.Loader=l;a&&(window.Loader=l,window.require=r.default.prototype.require.bind(l),window.define=r.default.prototype.define.bind(l),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(6)),a=c(n(7)),l=c(n(0)),u=c(n(8)),s=c(n(9));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new o.default(t||window.__CONFIG__),this._log=new u.default(this._config),this._dependencyResolver=new i.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return s.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map(function(e){return" "+e}).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then(function(t){return e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnResolutionErrors(t),i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach(function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)}),b=e._setRejectTimeout(l,t,function(){w=!0,s.apply(void 0,arguments)}),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)}).then(function(){if(!w)return e._waitForModuleDefinitions(y)}).then(function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}}).catch(function(e){w||(b&&clearTimeout(b),s(e))})}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_throwOnResolutionErrors",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map(function(e){return" · "+e}).join("\n")),{resolutionErrors:t})}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter(function(e){return!t.getModule(e)})}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var o=t.resolvedModules.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),i=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingModules:o});n(i)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.implement}))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach(function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map(function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation}),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){return e&&e.__esModule?e:{default:e}}(n(4)),l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return i(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new a.default(e);return Object.entries(t).forEach(function(e){var t=o(e,2),r=t[0],i=t[1];n[r]=i}),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map(function(t){return e.getModule(t)})}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":r(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(5)),i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_fetch:o.default.new(),_define:o.default.new(),_implement:o.default.new()}}return r(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={method:"POST",body:a}),fetch(l,u).then(function(e){return e.text()}).then(function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)}).catch(o)}})}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(0)),i=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new o.default(n),this._injectedScripts={}}return r(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach(function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)}))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:r});n.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map(function(e){return e.fetch}))}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e){e.exports={name:"liferay-amd-loader",version:"4.2.0",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"npm run format:check && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest --runInBand",format:"prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","format:check":"prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",lint:"eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","lint:fix":"eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test",proxyPortal:"webpack-dev-server --config webpack.proxyPortal.js"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testPathIgnorePatterns:[".eslintrc.js"],testURL:"http://localhost/"},author:{name:"Iliyan Peychev"},license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^5.15.1","eslint-config-liferay":"^3.0.0","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1",prettier:"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach((function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})})),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach((function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))})),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map((function(e){return e+"="+t[e]})).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=window.__CONFIG__||{},i="string"==typeof o.namespace?o.namespace:void 0,a=void 0===o.exposeGlobal||o.exposeGlobal,l=new r.default(o);if(i){var u=window[i]?window[i]:{};u.Loader=l,window[i]=u}else window.Loader=l;a&&(window.Loader=l,window.require=r.default.prototype.require.bind(l),window.define=r.default.prototype.define.bind(l),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(4)),a=c(n(7)),l=c(n(8)),u=c(n(9)),s=c(n(0));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new i.default(t||window.__CONFIG__),this._log=new l.default(this._config),this._dependencyResolver=new a.default(this._config),this._urlBuilder=new s.default(this._config),this._scriptLoader=new u.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return o.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map((function(e){return" "+e})).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then((function(t){if(e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnLegacyProtocolResolutionErrors(t),e._logServerMessages(l,t),t.errors&&t.errors.length>1)throw Object.assign(new Error("The server generated some errors while resolving modules"),{resolutionErrors:t.errors});return i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach((function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)})),b=e._setRejectTimeout(l,t,(function(){w=!0,s.apply(void 0,arguments)})),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)})).then((function(){if(!w)return e._waitForModuleDefinitions(y)})).then((function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}})).catch((function(e){w||(b&&clearTimeout(b),s(e))}))}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter((function(e){return!t.getModule(e)}))}},{key:"_logServerMessages",value:function(e,t){t.errors&&t.errors.length>0&&this._log.error("Errors returned from server for require(",e,"):",t.errors),t.warnings&&t.warnings.length>0&&this._log.warn("Warnings returned from server for require(",e,"):",t.warnings)}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout((function(){var o=t.resolvedModules.filter((function(e){var t=r.getModule(e);return!t||!t.implemented})),i=Object.assign(new Error("Load timeout for modules: "+e),{missingModules:o,modules:e,resolution:t});n(i)}),r.waitTimeout)}},{key:"_throwOnLegacyProtocolResolutionErrors",value:function(e){var t=e.resolvedModules.filter((function(e){return 0===e.indexOf(":ERROR:")})).map((function(e){return e.substr(7)}));if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map((function(e){return" · "+e})).join("\n")),{resolutionErrors:t})}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.define})))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.implement})))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach((function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map((function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation})),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}}))}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map((function(e){return e.implementation}))}}]),e}();t.default=d,d.prototype.define.amd={}},function(e){e.exports=JSON.parse('{"name":"liferay-amd-loader","version":"4.3.0","description":"AMD Loader with support for combo URL and conditional loading","scripts":{"clean":"rm -rf build","build":"node bin/build-loader.js","ci":"yarn format:check && yarn lint && yarn build && yarn build-demo && yarn test","build-demo":"node bin/build-demo.js","demo":"node bin/run-demo.js","test":"jest --runInBand","format":"prettier --write \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","format:check":"prettier --list-different \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint":"eslint \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint:fix":"eslint --fix \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","prepublish":"publish-please guard","publish-please":"publish-please","prepublishOnly":"yarn build && yarn build-demo && yarn test","proxyPortal":"webpack-dev-server --config webpack.proxyPortal.js"},"repository":{"type":"git","url":"git+https://github.com/liferay/liferay-amd-loader.git"},"jest":{"collectCoverage":true,"coverageDirectory":"build/coverage","modulePathIgnorePatterns":["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],"testPathIgnorePatterns":[".eslintrc.js"],"testURL":"http://localhost/"},"author":{"name":"Iliyan Peychev"},"license":"LGPL-3.0","keywords":["Liferay","AMD","ES6","Loader"],"bugs":{"url":"https://github.com/liferay/liferay-amd-loader/issues"},"homepage":"https://github.com/liferay/liferay-amd-loader","files":[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],"devDependencies":{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1","combohandler":"^0.4.0","eslint":"^6.5.1","eslint-config-liferay":"^13.0.0","fs-extra":"^5.0.0","globby":"^7.1.1","http-server":"^0.11.1","jest":"^22.2.1","prettier":"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){return e&&e.__esModule?e:{default:e}}(n(5)),l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return i(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new a.default(e);return Object.entries(t).forEach((function(e){var t=o(e,2),r=t[0],i=t[1];n[r]=i})),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map((function(t){return e.getModule(t)}))}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":r(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(6)),i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_define:o.default.new(),_fetch:o.default.new(),_implement:o.default.new()}}return r(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise((function(t,n){e._resolve=t,e._reject=n}));return Object.assign(t,e,{fulfilled:!1,rejected:!1,rejection:void 0,resolution:void 0,resolved:!1}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch((function(){})),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise((function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={body:a,method:"POST"}),fetch(l,u).then((function(e){return e.text()})).then((function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)})).catch(o)}}))}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(e){return e&&e.__esModule?e:{default:e}}(n(0)),i=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new o.default(n),this._injectedScripts={}}return r(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map((function(e){return t._loadScript(e)}));return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach((function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)})))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{modules:e.modules,script:r,url:e.url});n.forEach((function(e){return e.fetch.reject(t)}))},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map((function(e){return e.fetch})))}}]),e}();t.default=i}]);
//# sourceMappingURL=loader-min.js.map

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach(function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})}),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach(function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))}),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map(function(e){return e+"="+t[e]}).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(6)),a=c(n(7)),l=c(n(0)),u=c(n(8)),s=c(n(9));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new o.default(t||window.__CONFIG__),this._log=new u.default(this._config),this._dependencyResolver=new i.default(this._config),this._urlBuilder=new l.default(this._config),this._scriptLoader=new a.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return s.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map(function(e){return" "+e}).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then(function(t){return e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnResolutionErrors(t),i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach(function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)}),b=e._setRejectTimeout(l,t,function(){w=!0,s.apply(void 0,arguments)}),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)}).then(function(){if(!w)return e._waitForModuleDefinitions(y)}).then(function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}}).catch(function(e){w||(b&&clearTimeout(b),s(e))})}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_throwOnResolutionErrors",value:function(e){var t=e.resolvedModules.filter(function(e){return 0===e.indexOf(":ERROR:")}).map(function(e){return e.substr(7)});if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map(function(e){return" · "+e}).join("\n")),{resolutionErrors:t})}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter(function(e){return!t.getModule(e)})}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout(function(){var o=t.resolvedModules.filter(function(e){var t=r.getModule(e);return!t||!t.implemented}),i=Object.assign(new Error("Load timeout for modules: "+e),{modules:e,resolution:t,missingModules:o});n(i)},r.waitTimeout)}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.define}))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map(function(e){return e.implement}))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach(function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map(function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation}),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}})}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map(function(e){return e.implementation})}}]),e}();t.default=d,d.prototype.define.amd={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach(function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o}),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map(function(t){return e.getModule(t)})}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=e.hasOwnProperty(t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(5),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_fetch:a.default.new(),_define:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise(function(t,n){e._resolve=t,e._reject=n});return Object.assign(t,e,{fulfilled:!1,resolved:!1,rejected:!1,resolution:void 0,rejection:void 0}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch(function(){}),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise(function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={method:"POST",body:a}),fetch(l,u).then(function(e){return e.text()}).then(function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)}).catch(o)}})}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map(function(e){return t._loadScript(e)});return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach(function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)}))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{url:e.url,modules:e.modules,script:r});n.forEach(function(e){return e.fetch.reject(t)})},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map(function(e){return e.fetch}))}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e){e.exports={name:"liferay-amd-loader",version:"4.2.0",description:"AMD Loader with support for combo URL and conditional loading",scripts:{clean:"rm -rf build",build:"node bin/build-loader.js",ci:"npm run format:check && npm run lint && npm run build && npm run build-demo && npm test","build-demo":"node bin/build-demo.js",demo:"node bin/run-demo.js",test:"jest --runInBand",format:"prettier --write '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","format:check":"prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",lint:"eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'","lint:fix":"eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",prepublish:"publish-please guard","publish-please":"publish-please",prepublishOnly:"npm run build && npm run build-demo && npm test",proxyPortal:"webpack-dev-server --config webpack.proxyPortal.js"},repository:{type:"git",url:"git+https://github.com/liferay/liferay-amd-loader.git"},jest:{collectCoverage:!0,coverageDirectory:"build/coverage",modulePathIgnorePatterns:["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],testPathIgnorePatterns:[".eslintrc.js"],testURL:"http://localhost/"},author:{name:"Iliyan Peychev"},license:"LGPL-3.0",keywords:["Liferay","AMD","ES6","Loader"],bugs:{url:"https://github.com/liferay/liferay-amd-loader/issues"},homepage:"https://github.com/liferay/liferay-amd-loader",files:[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],devDependencies:{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1",combohandler:"^0.4.0",eslint:"^5.15.1","eslint-config-liferay":"^3.0.0","fs-extra":"^5.0.0",globby:"^7.1.1","http-server":"^0.11.1",jest:"^22.2.1",prettier:"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0",webpack:"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"build",value:function(e){var t=this,n=this._config,r=[],o=[],i=[],a=n.basePath;return a.length&&"/"!==a.charAt(a.length-1)&&(a+="/"),e.forEach((function(e){var l=n.getModule(e),u=t._getModulePath(l);n.combine?(r.push(u),o.push(l.name)):i.push({modules:[l.name],url:t._getURLWithParams(n.url+a+u)})})),r.length&&(i=i.concat(this._generateBufferURLs(o,r,{basePath:a,url:n.url,urlMaxLength:n.urlMaxLength})),r.length=0),i}},{key:"_generateBufferURLs",value:function(e,t,n){for(var r=n.basePath,o=[],i=n.urlMaxLength,a={modules:[e[0]],url:n.url+r+t[0]},l=1;l<t.length;l++){var u=e[l],s=t[l];a.url.length+r.length+s.length+1<i?(a.modules.push(u),a.url+="&"+r+s):(o.push(a),a={modules:[u],url:n.url+r+s})}return a.url=this._getURLWithParams(a.url),o.push(a),o}},{key:"_getModulePath",value:function(e){var t=this._config.paths,n=e.name;return Object.keys(t).forEach((function(e){n!==e&&0!==n.indexOf(e+"/")||(n=t[e]+n.substring(e.length))})),n.lastIndexOf(".js")!==n.length-3&&(n+=".js"),n}},{key:"_getURLWithParams",value:function(e){var t=this._config.defaultURLParams||{},n=Object.keys(t);if(!n.length)return e;var r=n.map((function(e){return e+"="+t[e]})).join("&");return e+(e.indexOf("?")>-1?"&":"?")+r}}]),e}();t.default=o},function(e,t,n){"use strict";var r,o=n(2),i=(r=o)&&r.__esModule?r:{default:r};var a=window.__CONFIG__||{},l="string"==typeof a.namespace?a.namespace:void 0,u=void 0===a.exposeGlobal||a.exposeGlobal,s=new i.default(a);if(l){var c=window[l]?window[l]:{};c.Loader=s,window[l]=c}else window.Loader=s;u&&(window.Loader=s,window.require=i.default.prototype.require.bind(s),window.define=i.default.prototype.define.bind(s),window.define.amd={})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(3)),i=c(n(4)),a=c(n(7)),l=c(n(8)),u=c(n(9)),s=c(n(0));function c(e){return e&&e.__esModule?e:{default:e}}function f(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=new i.default(t||window.__CONFIG__),this._log=new l.default(this._config),this._dependencyResolver=new a.default(this._config),this._urlBuilder=new s.default(this._config),this._scriptLoader=new u.default(n||window.document,this._config,this._log),this._requireCallId=0}return r(e,[{key:"version",value:function(){return o.default.version}},{key:"define",value:function(){for(var e=this._config,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=n[0],i=e.getModule(o);if(i&&i.defined)this._log.warn("Module '"+o+"' is being redefined. Only the first","definition will be used");else{var a=n[1],l=n[2];if(2==n.length&&(l=a,a=["require","exports","module"]),"function"!=typeof l){var u=l;l=function(){return u}}if(!(i=e.getModule(o)))throw new Error("Trying to define a module that was not registered: "+o+"\nThis usually means that someone is calling define() for a module that has not been previously required.");if(i.defined)throw new Error("Trying to define a module more than once: "+o+"\nThis usually means that someone is calling define() more than once for the same module, which can lead to unexpected results.");this._log.resolution("Defining",i.name),i.factory=l,i.dependencies=a,i.define.resolve(n)}}},{key:"require",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=this._scriptLoader,i=this._config,a=this._requireCallId++,l=void 0,u=void 0,s=void 0;if(1==n.length)l=n[0],u=void 0,s=void 0;else if(2==n.length){var c=n[n.length-1];"function"==typeof c?(l=n[0],u=c,s=void 0):null==c?(l=n[0],u=void 0,s=void 0):(l=n,u=void 0,s=void 0)}else{var d=n[n.length-1],h=!1;if("function"!=typeof d&&null!=d||(h=!0),h){var p=n[n.length-2],m=!1;"function"!=typeof p&&null!=p||(m=!0),m?(l=n.slice(0,n.length-2),u=p,s=d):(l=n.slice(0,n.length-1),u=d,s=void 0)}else l=n,u=void 0,s=void 0}if("string"==typeof l)l=[l];else if(1==l.length&&Array.isArray(l[0])){var v;l=(v=[]).concat.apply(v,f(l))}if(void 0===u&&(u=function(){}),void 0===s){var g=new Error("");s=function(t){var n="(n/a)";g.stack&&(n="\n"+(n=g.stack.split("\n").map((function(e){return" "+e})).join("\n"))),e._log.error("\n","A require() call has failed but no failure handler was","provided.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","caused by the require() call.\n","The reason why the Loader is in the stack trace is","because it is printing the error so that it doesn't get","lost.\n","However, we recommend providing a failure handler in all","require() calls to be able to recover from errors better","and to avoid the appearance of this message.\n","\n","Some information about the require() call follows:\n"," · Require call id:",a,"\n"," · Required modules:",l,"\n"," · Missing modules:",t.missingModules?t.missingModules:"(n/a)","\n"," · Stack trace of the require() call:",""+n,"\n",t)}}u=this._interceptHandler(u,"success",a),s=this._interceptHandler(s,"failure",a);var y=void 0,_=void 0,b=void 0,w=!1;this._dependencyResolver.resolve(l).then((function(t){if(e._log.resolution("Require call",a,"resolved modules",l,"to",t),e._throwOnLegacyProtocolResolutionErrors(t),e._logServerMessages(l,t),t.errors&&t.errors.length>1)throw Object.assign(new Error("The server generated some errors while resolving modules"),{resolutionErrors:t.errors});return i.addMappings(t.configMap),i.addPaths(t.pathMap),y=t.resolvedModules,(_=e._getUnregisteredModuleNames(y)).forEach((function(e){var n={map:t.moduleMap[e]},r=t.moduleFlags?t.moduleFlags[e]:{};(r=r||{}).esModule&&(n.esModule=!0),i.addModule(e,n)})),b=e._setRejectTimeout(l,t,(function(){w=!0,s.apply(void 0,arguments)})),e._log.resolution("Fetching",_,"from require call",a),o.loadModules(_)})).then((function(){if(!w)return e._waitForModuleDefinitions(y)})).then((function(){if(!w){clearTimeout(b),e._setModuleImplementations(a,y);var t=e._getModuleImplementations(l);u.apply(void 0,f(t))}})).catch((function(e){w||(b&&clearTimeout(b),s(e))}))}},{key:"_interceptHandler",value:function(e,t,n){var r=this;return function(){r._log.resolution("Invoking",t,"handler for","require call",n);try{e.apply(void 0,arguments)}catch(e){r._log.error("\n","A require() call",t,"handler has thrown an error.\n","Note that even if the call stack of this error trace","looks like coming from the Liferay AMD Loader, it is not","an error in the Loader what has caused it, but an error","in the handler's code.\n","The reason why the Loader is in the stack trace is","because it is printing the error on behalf of the handler","so that it doesn't get lost.\n","However, we recommend wrapping all handler code inside a","try/catch to be able to recover from errors better and to","avoid the appearance of this message.\n","\n",e)}}}},{key:"_getUnregisteredModuleNames",value:function(e){var t=this._config;return e.filter((function(e){return!t.getModule(e)}))}},{key:"_logServerMessages",value:function(e,t){t.errors&&t.errors.length>0&&this._log.error("Errors returned from server for require(",e,"):",t.errors),t.warnings&&t.warnings.length>0&&this._log.warn("Warnings returned from server for require(",e,"):",t.warnings)}},{key:"_setRejectTimeout",value:function(e,t,n){var r=this._config;if(0!==r.waitTimeout)return setTimeout((function(){var o=t.resolvedModules.filter((function(e){var t=r.getModule(e);return!t||!t.implemented})),i=Object.assign(new Error("Load timeout for modules: "+e),{missingModules:o,modules:e,resolution:t});n(i)}),r.waitTimeout)}},{key:"_throwOnLegacyProtocolResolutionErrors",value:function(e){var t=e.resolvedModules.filter((function(e){return 0===e.indexOf(":ERROR:")})).map((function(e){return e.substr(7)}));if(t.length>0)throw Object.assign(new Error("The following problems where detected while resolving modules:\n"+t.map((function(e){return" · "+e})).join("\n")),{resolutionErrors:t})}},{key:"_waitForModuleDefinitions",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.define})))}},{key:"_waitForModuleImplementations",value:function(e){var t=this._config;return Promise.all(t.getModules(e).map((function(e){return e.implement})))}},{key:"_setModuleImplementations",value:function(e,t){var n=this,r=this._config;r.getModules(t).forEach((function(t){if(!t.implemented){if(t.implement.rejected)throw t.implement.rejection;n._log.resolution("Implementing",t.name,"from require call",e);try{var o={get exports(){return t.implementation},set exports(e){t.implementation=e}},i=t.dependencies.map((function(e){if("exports"===e)return o.exports;if("module"===e)return o;if("require"===e)return n._createLocalRequire(t);var i=r.getDependency(t.name,e);if(!i)throw new Error("Unsatisfied dependency: "+e+" found in module "+t.name);if(!i.implementation&&!i.implemented)throw new Error('Module "'+i.name+'" has not been loaded yet for context: '+t.name);return i.implementation})),a=t.factory.apply(t,f(i));void 0!==a&&(t.implementation=a),t.implement.resolve(t.implementation)}catch(e){throw t.implement.fulfilled||t.implement.reject(e),e}}}))}},{key:"_createLocalRequire",value:function(e){var t=this,n=this._config,r=function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];if(i.length>0)return t.require.apply(t,[r].concat(i));var l=n.getDependency(e.name,r);if(!(l&&"implementation"in l))throw new Error('Module "'+r+'" has not been loaded yet for context: '+e.name);return l.implementation};return r.toUrl=function(e){return t._urlBuilder.build([e])[0].url},r}},{key:"_getModuleImplementations",value:function(e){return this._config.getModules(e).map((function(e){return e.implementation}))}}]),e}();t.default=d,d.prototype.define.amd={}},function(e){e.exports=JSON.parse('{"name":"liferay-amd-loader","version":"4.3.0","description":"AMD Loader with support for combo URL and conditional loading","scripts":{"clean":"rm -rf build","build":"node bin/build-loader.js","ci":"yarn format:check && yarn lint && yarn build && yarn build-demo && yarn test","build-demo":"node bin/build-demo.js","demo":"node bin/run-demo.js","test":"jest --runInBand","format":"prettier --write \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","format:check":"prettier --list-different \'{*,.*}.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint":"eslint \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","lint:fix":"eslint --fix \'.*.js\' \'*.js\' \'bin/**/{*,.*}.js\' \'src/**/{*,.*}.js\'","prepublish":"publish-please guard","publish-please":"publish-please","prepublishOnly":"yarn build && yarn build-demo && yarn test","proxyPortal":"webpack-dev-server --config webpack.proxyPortal.js"},"repository":{"type":"git","url":"git+https://github.com/liferay/liferay-amd-loader.git"},"jest":{"collectCoverage":true,"coverageDirectory":"build/coverage","modulePathIgnorePatterns":["liferay-amd-loader/build/.*",".*/__tests__/__fixtures__/.*"],"testPathIgnorePatterns":[".eslintrc.js"],"testURL":"http://localhost/"},"author":{"name":"Iliyan Peychev"},"license":"LGPL-3.0","keywords":["Liferay","AMD","ES6","Loader"],"bugs":{"url":"https://github.com/liferay/liferay-amd-loader/issues"},"homepage":"https://github.com/liferay/liferay-amd-loader","files":[".babelrc",".eslintrc.js",".publishrc","LICENSE.md","package.json","README.md","webpack.config.js","src","bin","build","src"],"devDependencies":{"babel-loader":"^7.1.2","babel-preset-es2015":"^6.24.1","combohandler":"^0.4.0","eslint":"^6.5.1","eslint-config-liferay":"^13.0.0","fs-extra":"^5.0.0","globby":"^7.1.1","http-server":"^0.11.1","jest":"^22.2.1","prettier":"^1.16.4","publish-please":"^2.3.1","uglifyjs-webpack-plugin":"^1.2.0","webpack":"^4.29.6","webpack-cli":"^3.3.0","webpack-dev-server":"^3.2.1"}}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),u=(r=l)&&r.__esModule?r:{default:r};var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._modules={},this._maps={},this._paths={},this._config={maps:{},paths:{}},this._parse(t,"defaultURLParams",{}),this._parse(t,"explainResolutions",!1),this._parse(t,"showWarnings",!1),this._parse(t,"waitTimeout",7e3),this._parse(t,"basePath","/"),this._parse(t,"resolvePath","/o/js_resolve_modules"),this._parse(t,"combine",!1),this._parse(t,"url",""),this._parse(t,"urlMaxLength",2e3),this._parse(t,"logLevel","error")}return a(e,[{key:"addModule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._modules[e])throw new Error("Module is already registered: "+e);var n=new u.default(e);return Object.entries(t).forEach((function(e){var t=i(e,2),r=t[0],o=t[1];n[r]=o})),this._modules[e]=n,n}},{key:"addMappings",value:function(e){Object.assign(this._maps,e)}},{key:"addPaths",value:function(e){Object.assign(this._paths,e)}},{key:"getModules",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return void 0===t?Object.values(this._modules):t.map((function(t){return e.getModule(t)}))}},{key:"getModule",value:function(e){var t=this._modules[e];if(!t){var n=this._mapModule(e);t=this._modules[n]}return t}},{key:"getDependency",value:function(e,t){var n=this.getModule(e),r=this._modules[t];if(!r){var o=this._mapModule(t,n.map);r=this._modules[o]}return r}},{key:"_parse",value:function(e,t,n){this._config[t]=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n}},{key:"_mapModule",value:function(e,t){return t&&(e=this._mapMatches(e,t)),Object.keys(this._maps).length>0&&(e=this._mapMatches(e,this._maps)),e}},{key:"_mapMatches",value:function(e,t){var n=t[e];return n?"object"===(void 0===n?"undefined":o(n))?n.value:n:((n=this._mapExactMatch(e,t))||(n=this._mapPartialMatch(e,t)),n||(n=this._mapWildcardMatch(e,t)),n||e)}},{key:"_mapExactMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(r.value&&r.exactMatch&&e===n)return r.value}}},{key:"_mapPartialMatch",value:function(e,t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(!r.exactMatch&&(r.value&&(r=r.value),e===n||0===e.indexOf(n+"/")))return r+e.substring(n.length)}}},{key:"_mapWildcardMatch",value:function(e,t){if("function"==typeof t["*"])return t["*"](e)}},{key:"explainResolutions",get:function(){return this._config.explainResolutions}},{key:"showWarnings",get:function(){return this._config.showWarnings}},{key:"waitTimeout",get:function(){return this._config.waitTimeout}},{key:"basePath",get:function(){return this._config.basePath}},{key:"resolvePath",get:function(){return this._config.resolvePath}},{key:"combine",get:function(){return this._config.combine}},{key:"url",get:function(){return this._config.url}},{key:"urlMaxLength",get:function(){return this._config.urlMaxLength}},{key:"logLevel",get:function(){return this._config.logLevel}},{key:"defaultURLParams",get:function(){return this._config.defaultURLParams}},{key:"paths",get:function(){return this._paths}}]),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(6),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._dependencies=void 0,this._factory=void 0,this._implementation={},this._map=void 0,this._state={_define:a.default.new(),_fetch:a.default.new(),_implement:a.default.new()}}return o(e,[{key:"name",get:function(){return this._name},set:function(e){throw new Error("Name of module "+this.name+" is read-only")}},{key:"dependencies",get:function(){return this._dependencies},set:function(e){if(this._dependencies)throw new Error("Dependencies of module "+this.name+" already set");this._dependencies=e}},{key:"factory",get:function(){return this._factory},set:function(e){if(this._factory)throw new Error("Factory of module "+this.name+" already set");this._factory=e}},{key:"implementation",get:function(){return this._implementation},set:function(e){this._implementation=e}},{key:"map",get:function(){return this._map},set:function(e){if(this._map)throw new Error("Local module map of module "+this.name+" already set");this._map=e}},{key:"esModule",get:function(){return this._implementation.__esModule},set:function(e){Object.defineProperty(this._implementation,"__esModule",{configurable:!0,value:e,writable:!0})}},{key:"fetch",get:function(){return this._state._fetch}},{key:"fetched",get:function(){return this.fetch.resolved}},{key:"define",get:function(){return this._state._define}},{key:"defined",get:function(){return this.define.resolved}},{key:"implement",get:function(){return this._state._implement}},{key:"implemented",get:function(){return this.implement.resolved}}]),e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(){throw function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new Error("Don't construct ResolvablePromise objects directly: rely on ResolvablePromise.new() instead")};function o(e){if(e.fulfilled)throw new Error("Promise already fulfilled")}t.default=r,r.new=function(){var e={},t=new Promise((function(t,n){e._resolve=t,e._reject=n}));return Object.assign(t,e,{fulfilled:!1,rejected:!1,rejection:void 0,resolution:void 0,resolved:!1}),t.resolve=function(e){return function(e,t){o(e),e.fulfilled=!0,e.resolved=!0,e.resolution=t,e._resolve(t)}(t,e)},t.reject=function(e){return function(e,t){o(e),e.fulfilled=!0,e.rejected=!0,e.rejection=t,e._reject(t)}(t,e)},"undefined"!=typeof jest&&t.catch((function(){})),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t,this._cachedResolutions={}}return r(e,[{key:"resolve",value:function(e){var t=this;if(void 0===e||0==e.length)throw new Error("Argument 'modules' cannot be undefined or empty");var n=this._config;return new Promise((function(r,o){var i=t._cachedResolutions[e];if(i)r(i);else{var a="modules="+encodeURIComponent(e),l=n.resolvePath+"?"+a,u={};l.length>n.urlMaxLength&&(l=n.resolvePath,u={body:a,method:"POST"}),fetch(l,u).then((function(e){return e.text()})).then((function(n){var o=JSON.parse(n);t._cachedResolutions[e]=o,r(o)})).catch(o)}}))}}]),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o={off:0,error:1,warn:2,info:3,debug:4},i="liferay-amd-loader |",a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._config=t}return r(e,[{key:"error",value:function(){var e;if(this._applies("error")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,[i].concat(n))}}},{key:"warn",value:function(){var e;if(this._applies("warn")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).warn.apply(e,[i].concat(n))}}},{key:"info",value:function(){var e;if(this._applies("info")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).info.apply(e,[i].concat(n))}}},{key:"debug",value:function(){var e;if(this._applies("debug")){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,[i].concat(n))}}},{key:"resolution",value:function(){var e;if(this._config.explainResolutions){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,[i].concat(n))}}},{key:"_applies",value:function(e){var t=o[this._config.logLevel];return o[e]<=t}}]),e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(0),a=(r=i)&&r.__esModule?r:{default:r};var l=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._document=t,this._config=n,this._log=r,this._urlBuilder=new a.default(n),this._injectedScripts={}}return o(e,[{key:"loadModules",value:function(e){var t=this,n=this._urlBuilder;if(0==e.length)return Promise.resolve();var r=n.build(e).map((function(e){return t._loadScript(e)}));return Promise.all(r)}},{key:"_loadScript",value:function(e){var t=this,n=this._config.getModules(e.modules),r=this._injectedScripts[e.url];return r||((r=this._document.createElement("script")).src=e.url,r.async=!1,r.onload=r.onreadystatechange=function(){t.readyState&&"complete"!==t.readyState&&"load"!==t.readyState||(r.onload=r.onreadystatechange=null,r.onerror=null,n.forEach((function(e){e.fetch.fulfilled?t._log.warn("Module '"+e.name+"' is being fetched from\n",r.src,"but was already fetched from\n",e.fetch.resolved?e.fetch.resolution.src:e.fetch.rejection.script.src):e.fetch.resolve(r)})))},r.onerror=function(){r.onload=r.onreadystatechange=null,r.onerror=null;var t=Object.assign(new Error("Unable to load script from URL "+e.url),{modules:e.modules,script:r,url:e.url});n.forEach((function(e){return e.fetch.reject(t)}))},this._injectedScripts[e.url]=r,this._document.head.appendChild(r)),Promise.all(n.map((function(e){return e.fetch})))}}]),e}();t.default=l}]);
//# sourceMappingURL=loader.js.map

@@ -1,2 +0,2 @@

GNU LESSER GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

@@ -23,6 +23,6 @@ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>

1. Exception to Section 3 of the GNU GPL.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

@@ -34,3 +34,3 @@

3. Object Code Incorporating Material from Library Header Files.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

@@ -42,3 +42,3 @@

4. Combined Works.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

@@ -60,3 +60,3 @@

5. Combined Libraries.
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

@@ -68,3 +68,3 @@

6. Revised Versions of the GNU Lesser General Public License.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

@@ -74,3 +74,3 @@

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
{
"name": "liferay-amd-loader",
"version": "4.2.0",
"version": "4.3.0",
"description": "AMD Loader with support for combo URL and conditional loading",

@@ -8,3 +8,3 @@ "scripts": {

"build": "node bin/build-loader.js",
"ci": "npm run format:check && npm run lint && npm run build && npm run build-demo && npm test",
"ci": "yarn format:check && yarn lint && yarn build && yarn build-demo && yarn test",
"build-demo": "node bin/build-demo.js",

@@ -15,7 +15,7 @@ "demo": "node bin/run-demo.js",

"format:check": "prettier --list-different '{*,.*}.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint": "eslint '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint:fix": "eslint --fix '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint": "eslint '.*.js' '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"lint:fix": "eslint --fix '.*.js' '*.js' 'bin/**/{*,.*}.js' 'src/**/{*,.*}.js'",
"prepublish": "publish-please guard",
"publish-please": "publish-please",
"prepublishOnly": "npm run build && npm run build-demo && npm test",
"prepublishOnly": "yarn build && yarn build-demo && yarn test",
"proxyPortal": "webpack-dev-server --config webpack.proxyPortal.js"

@@ -70,4 +70,4 @@ },

"combohandler": "^0.4.0",
"eslint": "^5.15.1",
"eslint-config-liferay": "^3.0.0",
"eslint": "^6.5.1",
"eslint-config-liferay": "^13.0.0",
"fs-extra": "^5.0.0",

@@ -74,0 +74,0 @@ "globby": "^7.1.1",

@@ -15,5 +15,5 @@ # AMD Module Loader

2. Install NodeJS >= [v6.11.0](http://nodejs.org/dist/v6.11.0/), if you don't have it yet
3. Run `npm install` to install dependencies
4. Run `npm run build` to build it
5. Run `npm test` to run tests
3. Run `yarn` to install dependencies
4. Run `yarn build` to build it
5. Run `yarn test` to run tests

@@ -30,4 +30,4 @@ This will build the loader in 'build/loader' directory. There will be three versions:

1. Run demo script with `npm run demo`
1. Run demo script with `yarn demo`
2. Open a browser and load [http://localhost:8080](http://localhost:8080)
3. Open the browser console and look for the messages

@@ -0,3 +1,9 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/* eslint-env node */
module.exports = {
extends: '../../.eslintrc.js',
env: {

@@ -7,2 +13,3 @@ amd: true,

},
extends: '../../.eslintrc.js',
globals: {

@@ -9,0 +16,0 @@ __CONFIG__: true,

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -8,8 +7,8 @@ */

__CONFIG__ = {
url: 'http://localhost:8080',
basePath: '',
combine: false,
explainResolutions: true,
namespace: 'Liferay',
explainResolutions: true,
combine: false,
url: 'http://localhost:8080',
waitTimeout: 2000,
};
/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

@@ -0,3 +1,7 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
module.exports = {
extends: '../.eslintrc.js',
env: {

@@ -7,2 +11,3 @@ amd: true,

},
extends: '../.eslintrc.js',
globals: {

@@ -9,0 +14,0 @@ Loader: true,

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

@@ -0,7 +1,14 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/* eslint-env node */
module.exports = {
extends: '../.eslintrc.js',
env: {
jest: true,
node: true,
jest: true,
},
extends: '../.eslintrc.js',
rules: {

@@ -8,0 +15,0 @@ 'require-jsdoc': 'off',

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -75,4 +74,4 @@ */

'liferay@1.0.0': {
exactMatch: true,
value: 'liferay@1.0.0/index',
exactMatch: true,
},

@@ -122,4 +121,4 @@ });

config.addMappings({
'*': name => name + 'test',
liferay: 'liferay@1.0.0',
'*': name => name + 'test',
});

@@ -141,4 +140,4 @@

'liferay/index': {
exactMatch: true,
value: 'liferay@1.0.0/index',
exactMatch: true,
},

@@ -169,3 +168,6 @@ });

liferay: 'this-should-not-be-applied',
'liferay/index': {value: 'liferay/index', exactMatch: true},
'liferay/index': {
exactMatch: true,
value: 'liferay/index',
},
});

@@ -172,0 +174,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -38,7 +37,7 @@ */

it('should throw an exception if no modules are specified', () => {
it('throws an exception if no modules are specified', () => {
expect(() => dependencyResolver.resolve()).toThrow();
});
it('should resolve module', () => {
it('resolves a module', () => {
return dependencyResolver.resolve(['aui-core']).then(dependencies => {

@@ -49,3 +48,3 @@ expect(dependencies).toEqual(['aui-core']);

it('should resolve multiple modules', () => {
it('resolves multiple modules', () => {
return dependencyResolver

@@ -63,3 +62,3 @@ .resolve(['aui-base', 'aui-core', 'aui-node', 'aui-dom-node'])

it('should resolve with cached resolution', async () => {
it('resolves with cached resolution', async () => {
expect(window.fetch.mock.calls.length).toBe(0);

@@ -66,0 +65,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -10,6 +9,6 @@ */

import Config from '../config.js';
import Loader from '../loader';
import Config from '../config.js';
describe('Loader', function() {
describe('Loader', () => {
let config;

@@ -19,3 +18,3 @@ let loader;

beforeEach(function() {
beforeEach(() => {
jest.setTimeout(200);

@@ -36,6 +35,6 @@

fetchResponse = {
resolvedModules: moduleNames,
configMap: {},
moduleMap: {},
configMap: {},
pathMap: {},
resolvedModules: moduleNames,
};

@@ -135,6 +134,6 @@ }

fetchResponse = {
resolvedModules: ['local-require/a', 'local-require/sync'],
configMap: {},
moduleMap: {},
configMap: {},
pathMap: {},
resolvedModules: ['local-require/a', 'local-require/sync'],
};

@@ -157,3 +156,3 @@

fetchResponse = {
resolvedModules: ['local-require/a', 'local-require/rel-path'],
configMap: {},
moduleMap: {

@@ -164,4 +163,4 @@ 'local-require/rel-path': {

},
configMap: {},
pathMap: {},
resolvedModules: ['local-require/a', 'local-require/rel-path'],
};

@@ -205,3 +204,3 @@

fetchResponse = {
resolvedModules: ['issue-140/a', 'issue-140/m1', 'issue-140/m2/m2'],
configMap: {},
moduleMap: {

@@ -213,4 +212,4 @@ 'issue-140/m1': {

},
configMap: {},
pathMap: {},
resolvedModules: ['issue-140/a', 'issue-140/m1', 'issue-140/m2/m2'],
};

@@ -217,0 +216,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -17,3 +16,3 @@ */

describe('Logger', function() {
describe('Logger', () => {
beforeEach(() => {

@@ -20,0 +19,0 @@ console.error = jest.fn();

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -16,3 +15,3 @@ */

it('should return correct module name', () => {
it('returns the correct module name', () => {
expect(module.name).toBe('a-module');

@@ -19,0 +18,0 @@ });

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -17,3 +16,3 @@ */

it('should be allowed to fulfill with resolve just once', () => {
it('is allowed to fulfill with resolve just once', () => {
resolvablePromise.resolve();

@@ -25,3 +24,3 @@

it('should be allowed to fulfill with reject just once', () => {
it('is allowed to fulfill with reject just once', () => {
resolvablePromise.reject();

@@ -28,0 +27,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -15,4 +14,2 @@ */

document = {
eventHandler: 'onload',
scripts: [],
createElement: () => {

@@ -29,9 +26,11 @@ const script = {};

},
eventHandler: 'onload',
head: {
appendChild: () => {},
},
scripts: [],
};
});
it('should insert synchronous DOM script nodes', function(done) {
it('inserts synchronous DOM script nodes', done => {
const config = new Config({combine: false, url: 'http://localhost'});

@@ -53,3 +52,3 @@ const scriptLoader = new ScriptLoader(document, config);

it('should work without combine flag', done => {
it('works without combine flag', done => {
const config = new Config({combine: false, url: 'http://localhost'});

@@ -66,8 +65,8 @@ const scriptLoader = new ScriptLoader(document, config);

expect(document.scripts[0]).toMatchObject({
async: false,
src: 'http://localhost/a@1.0.0.js',
async: false,
});
expect(document.scripts[1]).toMatchObject({
async: false,
src: 'http://localhost/b@1.2.0.js',
async: false,
});

@@ -79,3 +78,3 @@

it('should work with combine flag', done => {
it('works with combine flag', done => {
const config = new Config({combine: true, url: 'http://localhost'});

@@ -92,4 +91,4 @@ const scriptLoader = new ScriptLoader(document, config);

expect(document.scripts[0]).toMatchObject({
async: false,
src: 'http://localhost/a@1.0.0.js&/b@1.2.0.js',
async: false,
});

@@ -101,3 +100,3 @@

it('should reject on error', done => {
it('rejects on error', done => {
const config = new Config({combine: true, url: 'http://localhost'});

@@ -104,0 +103,0 @@ const scriptLoader = new ScriptLoader(document, config);

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -16,5 +15,5 @@ */

config = new Config({
url: 'http://localhost:3000/combo?',
basePath: '/modules',
combine: true,
url: 'http://localhost:3000/combo?',
});

@@ -25,3 +24,3 @@

it('should create URL for module with path', () => {
it('creates URL for module with path', () => {
config.addModule('aui-core');

@@ -34,8 +33,8 @@

expect(modulesURL[0]).toMatchObject({
modules: ['aui-core'],
url: 'http://localhost:3000/combo?/modules/aui-core.js',
modules: ['aui-core'],
});
});
it('should append a trailing .js extension if missing', () => {
it('appends a trailing .js extension if missing', () => {
config.addModule('module');

@@ -47,8 +46,8 @@

expect(modulesURL[0]).toMatchObject({
modules: ['module'],
url: 'http://localhost:3000/combo?/modules/module.js',
modules: ['module'],
});
});
it('should not append the trailing .js extension if present', () => {
it('does not append the trailing .js extension if present', () => {
config.addModule('module.js');

@@ -60,8 +59,8 @@

expect(modulesURL[0]).toMatchObject({
modules: ['module.js'],
url: 'http://localhost:3000/combo?/modules/module.js',
modules: ['module.js'],
});
});
it('should create one url per module when combine set to false', () => {
it('creates one url per module when combine set to false', () => {
config._config.url = 'http://localhost:3000';

@@ -78,12 +77,12 @@ config._config.combine = false;

expect(modulesURL[0]).toMatchObject({
modules: ['aui-base'],
url: 'http://localhost:3000/modules/aui-base.js',
modules: ['aui-base'],
});
expect(modulesURL[1]).toMatchObject({
modules: ['aui-core.js'],
url: 'http://localhost:3000/modules/aui-core.js',
modules: ['aui-core.js'],
});
});
it('should not replace parts of path', () => {
it('does not replace parts of path', () => {
config._config.url = 'http://localhost:3000';

@@ -110,23 +109,23 @@ config._config.combine = false;

expect(modulesURL[0]).toMatchObject({
modules: ['jquery'],
url: 'http://localhost:3000/modules/jquery.js',
modules: ['jquery'],
});
expect(modulesURL[1]).toMatchObject({
modules: ['aui'],
url: 'http://localhost:3000/modules/html/js.js',
modules: ['aui'],
});
expect(modulesURL[2]).toMatchObject({
modules: ['aui/js/loader.js'],
url: 'http://localhost:3000/modules/html/js/js/loader.js',
modules: ['aui/js/loader.js'],
});
expect(modulesURL[3]).toMatchObject({
modules: ['test/aui/js/aui/loader.js'],
url: 'http://localhost:3000/modules/test/aui/js/aui/loader.js',
modules: ['test/aui/js/aui/loader.js'],
});
});
it('should not add trailing slash if base is an empty string', () => {
it('does not add trailing slash if base is an empty string', () => {
config._config.url = 'http://localhost:3000?';

@@ -144,8 +143,8 @@ config._config.basePath = '';

expect(modulesURL[0]).toMatchObject({
modules: ['aui-base'],
url: 'http://localhost:3000?aui-base.js',
modules: ['aui-base'],
});
expect(modulesURL[1]).toMatchObject({
modules: ['aui-core.js'],
url: 'http://localhost:3000?aui-core.js',
modules: ['aui-core.js'],
});

@@ -170,4 +169,4 @@ });

expect(modulesURL[0]).toMatchObject({
modules: ['aui-base', 'aui-core.js'],
url: 'http://localhost:3000?aui-base.js&aui-core.js',
modules: ['aui-base', 'aui-core.js'],
});

@@ -177,3 +176,3 @@ }

it('should combine modules with and without absolute url', () => {
it('combines modules with and without absolute url', () => {
config.addModule('jquery');

@@ -193,9 +192,9 @@ config.addModule('underscore');

expect(modulesURL[0]).toMatchObject({
modules: ['jquery', 'underscore', 'yui', 'lodash'],
url:
'http://localhost:3000/combo?/modules/jquery.js&/modules/underscore.js&/modules/yui.js&/modules/lodash.js',
modules: ['jquery', 'underscore', 'yui', 'lodash'],
});
});
it('should create combo URLs up to config.urlMaxLength characters', () => {
it('creates combo URLs up to config.urlMaxLength characters', () => {
config._config.urlMaxLength = 90;

@@ -222,3 +221,3 @@

it('should add parameters to urls', () => {
it('adds parameters to urls', () => {
config._config.url = 'http://localhost:3000';

@@ -240,3 +239,3 @@ config._config.combine = false;

it('should add parameters to combined urls', () => {
it('adds parameters to combined urls', () => {
config._config.defaultURLParams = {

@@ -243,0 +242,0 @@ languageId: 'en_US',

@@ -0,6 +1,13 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
/* eslint-env node */
module.exports = {
extends: '../../.eslintrc.js',
env: {
browser: true,
},
extends: '../../.eslintrc.js',
};
/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -5,0 +4,0 @@ */

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -209,3 +208,6 @@ */

_parse(cfg, property, defaultValue) {
this._config[property] = cfg.hasOwnProperty(property)
this._config[property] = Object.prototype.hasOwnProperty.call(
cfg,
property
)
? cfg[property]

@@ -212,0 +214,0 @@ : defaultValue;

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -51,4 +50,4 @@ */

options = {
body: modulesParam,
method: 'POST',
body: modulesParam,
};

@@ -55,0 +54,0 @@ }

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
import packageJson from '../../package.json';
import Config from './config';
import DependencyResolver from './dependency-resolver';
import Logger from './logger';
import ScriptLoader from './script-loader';
import URLBuilder from './url-builder';
import Logger from './logger';
import packageJson from '../../package.json';

@@ -283,5 +282,19 @@ /**

// Fail if resolution errors present
this._throwOnResolutionErrors(resolution);
// In case we are calling an older server, act upon errors
this._throwOnLegacyProtocolResolutionErrors(resolution);
// Show server warnings/errors
this._logServerMessages(moduleNames, resolution);
// Fail resolution on server errors
if (resolution.errors && resolution.errors.length > 1) {
throw Object.assign(
new Error(
'The server generated some errors while ' +
'resolving modules'
),
{resolutionErrors: resolution.errors}
);
}
// Merge global maps from resolution into config

@@ -429,25 +442,2 @@ config.addMappings(resolution.configMap);

/**
* Traverse a resolved dependencies array looking for server sent errors and
* throw an Error if any is found.
* @param {object} resolution the resolution object
* @throws {Error} if a resolution error is found
*/
_throwOnResolutionErrors(resolution) {
const resolutionErrors = resolution.resolvedModules
.filter(dep => dep.indexOf(':ERROR:') === 0)
.map(dep => dep.substr(7));
if (resolutionErrors.length > 0) {
throw Object.assign(
new Error(
'The following problems where detected while ' +
'resolving modules:\n' +
resolutionErrors.map(line => ` · ${line}`).join('\n')
),
{resolutionErrors}
);
}
}
/**
* Filters a list of modules and returns only those which are not yet

@@ -465,2 +455,28 @@ * registered.

/**
* Traverse a resolved dependencies array looking for server sent errors and
* throw an Error if any is found.
* @param {array} moduleNames list of module names to be tested
* @param {object} resolution the resolution object
*/
_logServerMessages(moduleNames, resolution) {
if (resolution.errors && resolution.errors.length > 0) {
this._log.error(
'Errors returned from server for require(',
moduleNames,
'):',
resolution.errors
);
}
if (resolution.warnings && resolution.warnings.length > 0) {
this._log.warn(
'Warnings returned from server for require(',
moduleNames,
'):',
resolution.warnings
);
}
}
/**
* Set a timeout (only if allowed by configuration) to reject a Promise if

@@ -492,5 +508,5 @@ * a certain set of modules has not been successfully loaded.

{
missingModules,
modules,
resolution,
missingModules,
}

@@ -504,2 +520,31 @@ );

/**
* Traverse a resolved dependencies array looking for server sent errors and
* throw an Error if any is found.
*
* @deprecated
* This method exists to account for old servers' responses in new loaders.
* Old servers used to send resolution errors in the `resolvedModules` field
* marking them with the ':ERROR:' prefix (because of historical reasons).
*
* @param {object} resolution the resolution object
* @throws {Error} if a resolution error is found
*/
_throwOnLegacyProtocolResolutionErrors(resolution) {
const resolutionErrors = resolution.resolvedModules
.filter(dep => dep.indexOf(':ERROR:') === 0)
.map(dep => dep.substr(7));
if (resolutionErrors.length > 0) {
throw Object.assign(
new Error(
'The following problems where detected while ' +
'resolving modules:\n' +
resolutionErrors.map(line => ` · ${line}`).join('\n')
),
{resolutionErrors}
);
}
}
/**
* Resolves a Promise as soon as all provided modules are defined.

@@ -506,0 +551,0 @@ * @param {array} moduleNames list of module names for which to wait

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -8,2 +7,4 @@ */

const levelPriority = {
/* eslint-disable sort-keys */
off: 0, // shows nothing

@@ -14,2 +15,4 @@ error: 1, // shows user errors

debug: 4, // shows debug messages about loader's internal state
/* eslint-enable sort-keys */
};

@@ -16,0 +19,0 @@ const prefix = 'liferay-amd-loader |';

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -25,4 +24,4 @@ */

this._state = {
_define: ResolvablePromise.new(),
_fetch: ResolvablePromise.new(),
_define: ResolvablePromise.new(),
_implement: ResolvablePromise.new(),

@@ -29,0 +28,0 @@ };

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -37,6 +36,6 @@ */

fulfilled: false,
resolved: false,
rejected: false,
rejection: undefined,
resolution: undefined,
rejection: undefined,
resolved: false,
});

@@ -43,0 +42,0 @@

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -110,5 +109,5 @@ */

{
url: modulesURL.url,
modules: modulesURL.modules,
script,
url: modulesURL.url,
}

@@ -115,0 +114,0 @@ );

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -127,3 +126,3 @@ */

Object.keys(paths).forEach(function(item) {
Object.keys(paths).forEach(item => {
if (path === item || path.indexOf(item + '/') === 0) {

@@ -160,3 +159,3 @@ path = paths[item] + path.substring(item.length);

const queryString = keys
.map(function(key) {
.map(key => {
return key + '=' + defaultURLParams[key];

@@ -163,0 +162,0 @@ })

/**
* © 2014 Liferay, Inc. <https://liferay.com>
*
* SPDX-FileCopyrightText: © 2014 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: LGPL-3.0-or-later

@@ -14,12 +13,9 @@ */

const baseConfig = {
devtool: 'source-map',
entry: path.resolve(__dirname, 'src/loader/bootstrap.js'),
output: {
path: path.resolve(__dirname, 'build/loader'),
},
devtool: 'source-map',
module: {
rules: [
{
exclude: /node_modules/,
test: /\.js$/,
exclude: /node_modules/,
use: [

@@ -34,2 +30,5 @@ {

},
output: {
path: path.resolve(__dirname, 'build/loader'),
},
};

@@ -39,15 +38,6 @@

debug: {
output: Object.assign({}, baseConfig.output, {
filename: 'loader-debug.js',
}),
output: {...baseConfig.output, filename: 'loader-debug.js'},
},
prod: {
output: Object.assign({}, baseConfig.output, {
filename: 'loader.js',
}),
},
min: {
output: Object.assign({}, baseConfig.output, {
filename: 'loader-min.js',
}),
output: {...baseConfig.output, filename: 'loader-min.js'},
plugins: [

@@ -59,5 +49,8 @@ new UglifyJsPlugin({

},
prod: {
output: {...baseConfig.output, filename: 'loader.js'},
},
};
return Object.assign({}, baseConfig, flavorConfig[flavor]);
return {...baseConfig, ...flavorConfig[flavor]};
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc