"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserRequireInterceptorContribution = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
const client_1 = tslib_1.__importDefault(require("react-dom/client"));
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
const require_interceptor_1 = require("../common/require-interceptor");
const sumi_browser_1 = require("./sumi-browser");
// `react-dom/18.2.0/umd/react-dom.production.min.js` is do the same thing, it export both `react-dom` and `react-dom/client`.
const umdReactDOM = {
    ...react_dom_1.default,
    ...client_1.default,
};
let BrowserRequireInterceptorContribution = class BrowserRequireInterceptorContribution {
    registerRequireInterceptor(registry) {
        registry.registerRequireInterceptor({
            moduleName: 'React',
            load: () => react_1.default,
        });
        registry.registerRequireInterceptor({
            moduleName: 'ReactDOM',
            load: () => umdReactDOM,
        });
        registry.registerRequireInterceptor({
            moduleName: 'ReactDOMClient',
            load: () => client_1.default,
        });
        registry.registerRequireInterceptor({
            moduleName: 'kaitian-browser',
            load: (request) => (0, sumi_browser_1.createBrowserApi)(request.injector, request.extension, request.rpcProtocol),
        });
        registry.registerRequireInterceptor({
            moduleName: 'sumi-browser',
            load: (request) => (0, sumi_browser_1.createBrowserApi)(request.injector, request.extension, request.rpcProtocol),
        });
    }
};
exports.BrowserRequireInterceptorContribution = BrowserRequireInterceptorContribution;
exports.BrowserRequireInterceptorContribution = BrowserRequireInterceptorContribution = tslib_1.__decorate([
    (0, ide_core_browser_1.Domain)(require_interceptor_1.RequireInterceptorContribution)
], BrowserRequireInterceptorContribution);
//# sourceMappingURL=require-interceptor.contribution.js.map