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,KAAK,CAAC,OAAS,CAAC,CAAC,CAAC;gBAC3D,CAAC,CAAC,CAAC;gBAEH,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;gBACxC,OAAO,CAAC,OAAO,EAAE;oBACf,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC,IAAI,CACL;gBACE,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,CAAC,EACD,UAAC,KAAK;gBACJ,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAC1B,MAAM,KAAK,CAAC;YACd,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/**\n * A loader script for setting up the Dojo loader.\n *\n * Note that loader scripts must be simple scripts, not modules.\n */\nintern.registerLoader((options) => {\n const globalObj: any = typeof window !== 'undefined' ? window : global;\n const { internLoaderPath = 'node_modules/dojo/dojo.js', ...loaderConfig } =\n options;\n\n loaderConfig.baseUrl = loaderConfig.baseUrl || intern.config.basePath;\n if (!('async' in loaderConfig)) {\n loaderConfig.async = true;\n }\n\n loaderConfig.has = {\n 'dojo-timeout-api': true,\n ...loaderConfig.has,\n };\n\n intern.log('Configuring Dojo loader with:', loaderConfig);\n globalObj.dojoConfig = loaderConfig;\n\n return intern.loadScript(internLoaderPath).then(() => {\n const require = globalObj.require;\n intern.log('Using Dojo loader');\n\n return (modules: string[]) => {\n let handle: { remove(): void };\n\n return new Promise<void>((resolve, reject) => {\n handle = require.on('error', (error: Error) => {\n intern.emit('error', error);\n reject(new Error(`Dojo loader error: ${error.message}`));\n });\n\n intern.log('Loading modules:', modules);\n require(modules, () => {\n resolve();\n });\n }).then<void>(\n () => {\n handle.remove();\n },\n (error) => {\n handle && handle.remove();\n throw error;\n }\n );\n };\n });\n});\n"]}
\No newline at end of file