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K,iBAAiB,IACzD,GAAI,EACA,MAAO,CAAC,GAEZ,MAAM,YACV,CACA,MAAO,GACH,MAAM,gBAAgB,EAC1B,CACJ,CACA,KAAA,CAAM,EAAS,GACX,OAAI,EAAI,UAAU,UAAU,GACjB,CACH,OAAQ,EACR,SAAU,GAGiB,iBAAnB,EACL,CACH,SAAU,EACV,OAAQ,GAGmB,iBAAnB,GAAuD,aAAxB,EAAe,KACnD,CACH,SAAU,EACV,SAAU,QAHb,CAMT,CACA,iBAAA,CAAkB,EAAK,EAAY,GAC/B,MAAM,EAAQ,EAAa,EAAI,GAAc,EAC7C,IAAK,EACD,MAAM,IAAI,MAAM,2CAA6C,GAEjE,OAAO,CACX,CAEA,kBAAM,CAAa,GACf,MAAM,WAAE,EAAU,WAAE,GAAe,YAAY,GACzC,QAAiB,QAAQ,QAAQ,GAAG,KAAc,KAAK,GAAK,QAAQ,aAAa,QAAQ,KAC/F,OAAO,KAAK,kBAAkB,EAAU,EAAY,GAAc,UACtE,CACA,gBAAA,CAAiB,GACb,MAAM,WAAE,EAAU,WAAE,GAAe,YAAY,GAEzC,EAAW,QAAQ,GACzB,OAAO,KAAK,kBAAkB,EAAU,EAAY,EACxD,EAEJ,QAAQ,aAAe","file":"/npm/@graphql-tools/module-loader@8.0.33/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/@graphql-tools/module-loader@8.0.33/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ModuleLoader = void 0;\nconst tslib_1 = require(\"tslib\");\nconst fs_1 = require(\"fs\");\nconst graphql_1 = require(\"graphql\");\nconst { access } = fs_1.promises;\nconst InvalidError = new Error(`Imported object was not a string, DocumentNode or GraphQLSchema`);\nconst createLoadError = (error) => new Error('Unable to load schema from module: ' + `${error.message || /* istanbul ignore next */ error}`);\n// module:node/module#export\nfunction extractData(pointer) {\n    const parts = pointer.replace(/^module\\:/i, '').split('#');\n    if (!parts || parts.length > 2) {\n        throw new Error('Schema pointer should match \"module:path/to/module#export\"');\n    }\n    return {\n        modulePath: parts[0],\n        exportName: parts[1],\n    };\n}\n/**\n * * This loader loads documents and type definitions from a Node module\n *\n * ```js\n * const schema = await loadSchema('module:someModuleName#someNamedExport', {\n *   loaders: [new ModuleLoader()],\n * })\n * ```\n */\nclass ModuleLoader {\n    isExpressionValid(pointer) {\n        return typeof pointer === 'string' && pointer.toLowerCase().startsWith('module:');\n    }\n    async canLoad(pointer) {\n        if (this.isExpressionValid(pointer)) {\n            const { modulePath } = extractData(pointer);\n            try {\n                const moduleAbsolutePath = require.resolve(modulePath);\n                await access(moduleAbsolutePath);\n                return true;\n            }\n            catch (e) {\n                return false;\n            }\n        }\n        return false;\n    }\n    canLoadSync(pointer) {\n        if (this.isExpressionValid(pointer)) {\n            const { modulePath } = extractData(pointer);\n            try {\n                const moduleAbsolutePath = require.resolve(modulePath);\n                return (0, fs_1.existsSync)(moduleAbsolutePath);\n            }\n            catch (e) {\n                return false;\n            }\n        }\n        return false;\n    }\n    async load(pointer) {\n        try {\n            const result = this.parse(pointer, await this.importModule(pointer));\n            if (result) {\n                return [result];\n            }\n            throw InvalidError;\n        }\n        catch (error) {\n            throw createLoadError(error);\n        }\n    }\n    loadSync(pointer) {\n        try {\n            const result = this.parse(pointer, this.importModuleSync(pointer));\n            if (result) {\n                return [result];\n            }\n            throw InvalidError;\n        }\n        catch (error) {\n            throw createLoadError(error);\n        }\n    }\n    parse(pointer, importedModule) {\n        if ((0, graphql_1.isSchema)(importedModule)) {\n            return {\n                schema: importedModule,\n                location: pointer,\n            };\n        }\n        else if (typeof importedModule === 'string') {\n            return {\n                location: pointer,\n                rawSDL: importedModule,\n            };\n        }\n        else if (typeof importedModule === 'object' && importedModule.kind === 'Document') {\n            return {\n                location: pointer,\n                document: importedModule,\n            };\n        }\n    }\n    extractFromModule(mod, modulePath, identifier) {\n        const thing = identifier ? mod[identifier] : mod;\n        if (!thing) {\n            throw new Error('Unable to import an object from module: ' + modulePath);\n        }\n        return thing;\n    }\n    // Sync and Async\n    async importModule(pointer) {\n        const { modulePath, exportName } = extractData(pointer);\n        const imported = await Promise.resolve(`${modulePath}`).then(s => tslib_1.__importStar(require(s)));\n        return this.extractFromModule(imported, modulePath, exportName || 'default');\n    }\n    importModuleSync(pointer) {\n        const { modulePath, exportName } = extractData(pointer);\n        // eslint-disable-next-line @typescript-eslint/no-require-imports\n        const imported = require(modulePath);\n        return this.extractFromModule(imported, modulePath, exportName);\n    }\n}\nexports.ModuleLoader = ModuleLoader;\n"]}