import{Task}from"../Task.js";import*as Activities from"../activities/main.js";const global=new Function("return this")();function getRequireString(){return"require"}async function load(e,o,i){"function"!=typeof o&&(o=global[getRequireString()]);var t=new Task(function(t){o([e],function(e){t(e),"function"==typeof i&&i(e)})});return Task.race([t,new Task((e,t)=>setTimeout(t,9e4))])}"function"!=typeof global.Promise&&(global.Promise=Promise);let nextId=0;const moduleNames={};function registerModuleName(e){let t=moduleNames[e];if(void 0!==t)return t;t=`@geocortex/workflow/externals/ext-${nextId++}`;var o="/"===e[e.length-1]?e.substring(0,e.length-1):e;return global[getRequireString()]({paths:{[t]:o}}),moduleNames[e]=t}async function importModule(e,t,o){let i;return i="@geocortex/workflow/runtime/activities/main"===e?Activities:await load(e),void 0!==i&&null!==i&&"function"==typeof i.main?i.main.call(global,load,t,o):i}export{global,load,registerModuleName,importModule};