let _computedKey, _computedKey1, _computedKey2, createMd4, createXxhash64, service_pool, loadLoader_url, ArrayQueue_computedKey;
import node_util, { inspect, promisify } from "node:util";
import { createRequire, createRequire as __rspack_createRequire } from "node:module";
import node_path, { isAbsolute, join, relative, resolve as external_node_path_resolve, sep } from "node:path";
import node_querystring from "node:querystring";
import node_fs, { readFileSync } from "node:fs";
import { __webpack_require__ } from "./612.js";
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
import * as __rspack_external_node_util_1b29d436 from "node:util";
__webpack_require__.add({
    "../../node_modules/.pnpm/enhanced-resolve@5.22.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
        let { nextTick } = __webpack_require__("process"), dirname = (path)=>{
            let idx = path.length - 1;
            for(; idx >= 0;){
                let char = path.charCodeAt(idx);
                if (47 === char || 92 === char) break;
                idx--;
            }
            return idx < 0 ? "" : path.slice(0, idx);
        }, runCallbacks = (callbacks, err, result)=>{
            let error;
            if (1 === callbacks.length) {
                callbacks[0](err, result), callbacks.length = 0;
                return;
            }
            for (let callback of callbacks)try {
                callback(err, result);
            } catch (err) {
                error || (error = err);
            }
            if (callbacks.length = 0, error) throw error;
        };
        class OperationMergerBackend {
            constructor(provider, syncProvider, providerContext){
                this._provider = provider, this._syncProvider = syncProvider, this._providerContext = providerContext, this._activeAsyncOperations = new Map(), this.provide = this._provider ? (path, options, callback)=>{
                    if ("function" == typeof options && (callback = options, options = void 0), "string" != typeof path && !Buffer.isBuffer(path) && !(path instanceof URL) && "number" != typeof path) return void callback(TypeError("path must be a string, Buffer, URL or number"));
                    if (options) return this._provider.call(this._providerContext, path, options, callback);
                    let callbacks = this._activeAsyncOperations.get(path);
                    callbacks ? callbacks.push(callback) : (this._activeAsyncOperations.set(path, callbacks = [
                        callback
                    ]), provider(path, (err, result)=>{
                        this._activeAsyncOperations.delete(path), runCallbacks(callbacks, err, result);
                    }));
                } : null, this.provideSync = this._syncProvider ? (path, options)=>this._syncProvider.call(this._providerContext, path, options) : null;
            }
            purge() {}
            purgeParent() {}
        }
        class CacheBackend {
            constructor(duration, provider, syncProvider, providerContext){
                this._duration = duration, this._provider = provider, this._syncProvider = syncProvider, this._providerContext = providerContext, this._activeAsyncOperations = new Map(), this._data = new Map(), this._levels = [];
                for(let i = 0; i < 10; i++)this._levels.push(new Set());
                if (duration !== 1 / 0) for(let i = 5000; i < duration; i += 500)this._levels.push(new Set());
                this._currentLevel = 0, this._tickInterval = Math.floor(duration / this._levels.length), this._mode = 0, this._timeout = void 0, this._nextDecay = void 0, this.provide = provider ? this.provide.bind(this) : null, this.provideSync = syncProvider ? this.provideSync.bind(this) : null;
            }
            provide(path, options, callback) {
                if ("function" == typeof options && (callback = options, options = void 0), "string" != typeof path && !Buffer.isBuffer(path) && !(path instanceof URL) && "number" != typeof path) return void callback(TypeError("path must be a string, Buffer, URL or number"));
                let strPath = "string" != typeof path ? path.toString() : path;
                if (options) return this._provider.call(this._providerContext, path, options, callback);
                1 === this._mode && this._enterAsyncMode();
                let cacheEntry = this._data.get(strPath);
                if (void 0 !== cacheEntry) return cacheEntry.err ? nextTick(callback, cacheEntry.err) : nextTick(callback, null, cacheEntry.result);
                let callbacks = this._activeAsyncOperations.get(strPath);
                void 0 !== callbacks ? callbacks.push(callback) : (this._activeAsyncOperations.set(strPath, callbacks = [
                    callback
                ]), this._provider.call(this._providerContext, path, (err, result)=>{
                    this._activeAsyncOperations.delete(strPath), this._storeResult(strPath, err, result), this._enterAsyncMode(), runCallbacks(callbacks, err, result);
                }));
            }
            provideSync(path, options) {
                let result;
                if ("string" != typeof path && !Buffer.isBuffer(path) && !(path instanceof URL) && "number" != typeof path) throw TypeError("path must be a string");
                let strPath = "string" != typeof path ? path.toString() : path;
                if (options) return this._syncProvider.call(this._providerContext, path, options);
                1 === this._mode && this._runDecays();
                let cacheEntry = this._data.get(strPath);
                if (void 0 !== cacheEntry) {
                    if (cacheEntry.err) throw cacheEntry.err;
                    return cacheEntry.result;
                }
                let callbacks = this._activeAsyncOperations.get(strPath);
                this._activeAsyncOperations.delete(strPath);
                try {
                    result = this._syncProvider.call(this._providerContext, path);
                } catch (err) {
                    throw this._storeResult(strPath, err, void 0), this._enterSyncModeWhenIdle(), callbacks && runCallbacks(callbacks, err, void 0), err;
                }
                return this._storeResult(strPath, null, result), this._enterSyncModeWhenIdle(), callbacks && runCallbacks(callbacks, null, result), result;
            }
            purge(what, options) {
                if (null == what) {
                    if (0 !== this._mode) {
                        for (let level of (this._data.clear(), this._levels))level.clear();
                        this._enterIdleMode();
                    }
                    return;
                }
                if (null != options && !0 === options.exact) {
                    if ("string" == typeof what || Buffer.isBuffer(what) || what instanceof URL || "number" == typeof what) {
                        let strWhat = "string" != typeof what ? what.toString() : what, data = this._data.get(strWhat);
                        void 0 !== data && (this._data.delete(strWhat), data.level.delete(strWhat));
                    } else for (let item of what){
                        let strItem = "string" != typeof item ? item.toString() : item, data = this._data.get(strItem);
                        void 0 !== data && (this._data.delete(strItem), data.level.delete(strItem));
                    }
                    0 === this._data.size && this._enterIdleMode();
                    return;
                }
                if ("string" == typeof what || Buffer.isBuffer(what) || what instanceof URL || "number" == typeof what) {
                    let strWhat = "string" != typeof what ? what.toString() : what;
                    if ("" === strWhat) {
                        if (0 !== this._mode) {
                            for (let level of (this._data.clear(), this._levels))level.clear();
                            this._enterIdleMode();
                        }
                        return;
                    }
                    for (let [key, data] of this._data)key.startsWith(strWhat) && (this._data.delete(key), data.level.delete(key));
                    0 === this._data.size && this._enterIdleMode();
                } else {
                    for (let [key, data] of this._data)for (let item of what){
                        let strItem = "string" != typeof item ? item.toString() : item;
                        if (key.startsWith(strItem)) {
                            this._data.delete(key), data.level.delete(key);
                            break;
                        }
                    }
                    0 === this._data.size && this._enterIdleMode();
                }
            }
            purgeParent(what) {
                if (null == what) this.purge();
                else if ("string" == typeof what || Buffer.isBuffer(what) || what instanceof URL || "number" == typeof what) {
                    let strWhat = "string" != typeof what ? what.toString() : what;
                    this.purge(dirname(strWhat));
                } else {
                    let set = new Set();
                    for (let item of what){
                        let strItem = "string" != typeof item ? item.toString() : item;
                        set.add(dirname(strItem));
                    }
                    this.purge(set);
                }
            }
            _storeResult(path, err, result) {
                if (this._data.has(path)) return;
                let level = this._levels[this._currentLevel];
                this._data.set(path, {
                    err,
                    result,
                    level
                }), level.add(path);
            }
            _decayLevel() {
                let nextLevel = (this._currentLevel + 1) % this._levels.length, decay = this._levels[nextLevel];
                for (let item of (this._currentLevel = nextLevel, decay))this._data.delete(item);
                decay.clear(), 0 === this._data.size ? this._enterIdleMode() : this._nextDecay += this._tickInterval;
            }
            _runDecays() {
                for(; this._nextDecay <= Date.now() && 0 !== this._mode;)this._decayLevel();
            }
            _enterAsyncMode() {
                let timeout = 0;
                switch(this._mode){
                    case 2:
                        return;
                    case 0:
                        this._nextDecay = Date.now() + this._tickInterval, timeout = this._tickInterval;
                        break;
                    case 1:
                        if (this._runDecays(), 0 === this._mode) return;
                        timeout = Math.max(0, this._nextDecay - Date.now());
                }
                if (this._mode = 2, this._duration === 1 / 0) return;
                let ref = setTimeout(()=>{
                    this._mode = 1, this._runDecays();
                }, timeout);
                ref.unref && ref.unref(), this._timeout = ref;
            }
            _enterSyncModeWhenIdle() {
                0 === this._mode && (this._mode = 1, this._nextDecay = Date.now() + this._tickInterval);
            }
            _enterIdleMode() {
                this._mode = 0, this._nextDecay = void 0, this._timeout && clearTimeout(this._timeout);
            }
        }
        let createBackend = (duration, provider, syncProvider, providerContext)=>duration > 0 ? new CacheBackend(duration, provider, syncProvider, providerContext) : new OperationMergerBackend(provider, syncProvider, providerContext);
        module.exports = class {
            constructor(fileSystem, duration){
                this.fileSystem = fileSystem, this._lstatBackend = createBackend(duration, this.fileSystem.lstat, this.fileSystem.lstatSync, this.fileSystem);
                let lstat = this._lstatBackend.provide;
                this.lstat = lstat;
                let lstatSync = this._lstatBackend.provideSync;
                this.lstatSync = lstatSync, this._statBackend = createBackend(duration, this.fileSystem.stat, this.fileSystem.statSync, this.fileSystem);
                let stat = this._statBackend.provide;
                this.stat = stat;
                let statSync = this._statBackend.provideSync;
                this.statSync = statSync, this._readdirBackend = createBackend(duration, this.fileSystem.readdir, this.fileSystem.readdirSync, this.fileSystem);
                let readdir = this._readdirBackend.provide;
                this.readdir = readdir;
                let readdirSync = this._readdirBackend.provideSync;
                this.readdirSync = readdirSync, this._readFileBackend = createBackend(duration, this.fileSystem.readFile, this.fileSystem.readFileSync, this.fileSystem);
                let readFile = this._readFileBackend.provide;
                this.readFile = readFile;
                let readFileSync = this._readFileBackend.provideSync;
                this.readFileSync = readFileSync, this._readJsonBackend = createBackend(duration, this.fileSystem.readJson || this.readFile && ((path, callback)=>{
                    this.readFile(path, (err, buffer)=>{
                        let data;
                        if (err) return callback(err);
                        if (!buffer || 0 === buffer.length) return callback(Error("No file content"));
                        try {
                            data = JSON.parse(buffer.toString("utf8"));
                        } catch (err_) {
                            return callback(err_);
                        }
                        callback(null, data);
                    });
                }), this.fileSystem.readJsonSync || this.readFileSync && ((path)=>JSON.parse(this.readFileSync(path).toString("utf8"))), this.fileSystem);
                let readJson = this._readJsonBackend.provide;
                this.readJson = readJson;
                let readJsonSync = this._readJsonBackend.provideSync;
                this.readJsonSync = readJsonSync, this._readlinkBackend = createBackend(duration, this.fileSystem.readlink, this.fileSystem.readlinkSync, this.fileSystem);
                let readlink = this._readlinkBackend.provide;
                this.readlink = readlink;
                let readlinkSync = this._readlinkBackend.provideSync;
                this.readlinkSync = readlinkSync, this._realpathBackend = createBackend(duration, this.fileSystem.realpath, this.fileSystem.realpathSync, this.fileSystem);
                let realpath = this._realpathBackend.provide;
                this.realpath = realpath;
                let realpathSync = this._realpathBackend.provideSync;
                this.realpathSync = realpathSync;
            }
            purge(what, options) {
                this._statBackend.purge(what, options), this._lstatBackend.purge(what, options), null != options && !0 === options.exact ? this._readdirBackend.purge(what, options) : this._readdirBackend.purgeParent(what), this._readFileBackend.purge(what, options), this._readlinkBackend.purge(what, options), this._readJsonBackend.purge(what, options), this._realpathBackend.purge(what, options);
            }
        };
    },
    process (module) {
        module.exports = __rspack_createRequire_require("process");
    }
});
var RuntimeGlobals, key, StatsErrorCode, browserslistTargetHandler_namespaceObject = {};
__webpack_require__.r(browserslistTargetHandler_namespaceObject), __webpack_require__.d(browserslistTargetHandler_namespaceObject, {
    resolve: ()=>browserslistTargetHandler_resolve
});
var exports_namespaceObject = {};
__webpack_require__.r(exports_namespaceObject), __webpack_require__.d(exports_namespaceObject, {
    AsyncDependenciesBlock: ()=>binding_namespaceObject.AsyncDependenciesBlock,
    BannerPlugin: ()=>BannerPlugin,
    CaseSensitivePlugin: ()=>CaseSensitivePlugin,
    CircularCheckRspackPlugin: ()=>CircularCheckRspackPlugin,
    CircularDependencyRspackPlugin: ()=>CircularDependencyRspackPlugin,
    Compilation: ()=>Compilation,
    Compiler: ()=>Compiler,
    ConcatenatedModule: ()=>binding_namespaceObject.ConcatenatedModule,
    ContextModule: ()=>binding_namespaceObject.ContextModule,
    ContextReplacementPlugin: ()=>ContextReplacementPlugin,
    CopyRspackPlugin: ()=>CopyRspackPlugin,
    CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
    DefinePlugin: ()=>DefinePlugin,
    Dependency: ()=>binding_namespaceObject.Dependency,
    DllPlugin: ()=>DllPlugin,
    DllReferencePlugin: ()=>DllReferencePlugin,
    DynamicEntryPlugin: ()=>DynamicEntryPlugin,
    EntryDependency: ()=>binding_namespaceObject.EntryDependency,
    EntryOptionPlugin: ()=>lib_EntryOptionPlugin,
    EntryPlugin: ()=>EntryPlugin,
    EnvironmentPlugin: ()=>EnvironmentPlugin,
    EvalDevToolModulePlugin: ()=>EvalDevToolModulePlugin,
    EvalSourceMapDevToolPlugin: ()=>EvalSourceMapDevToolPlugin,
    ExternalModule: ()=>binding_namespaceObject.ExternalModule,
    ExternalsPlugin: ()=>ExternalsPlugin,
    HotModuleReplacementPlugin: ()=>HotModuleReplacementPlugin,
    HtmlRspackPlugin: ()=>HtmlRspackPlugin,
    IgnorePlugin: ()=>IgnorePlugin,
    LightningCssMinimizerRspackPlugin: ()=>LightningCssMinimizerRspackPlugin,
    LoaderOptionsPlugin: ()=>LoaderOptionsPlugin,
    LoaderTargetPlugin: ()=>LoaderTargetPlugin,
    Module: ()=>binding_namespaceObject.Module,
    ModuleFilenameHelpers: ()=>ModuleFilenameHelpers_namespaceObject,
    ModuleGraphConnection: ()=>ModuleGraphConnection,
    MultiCompiler: ()=>MultiCompiler,
    MultiStats: ()=>MultiStats,
    NoEmitOnErrorsPlugin: ()=>NoEmitOnErrorsPlugin,
    NormalModule: ()=>binding_namespaceObject.NormalModule,
    NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
    ProgressPlugin: ()=>ProgressPlugin,
    ProvidePlugin: ()=>ProvidePlugin,
    RspackOptionsApply: ()=>RspackOptionsApply,
    RuntimeGlobals: ()=>DefaultRuntimeGlobals,
    RuntimeModule: ()=>RuntimeModule,
    RuntimePlugin: ()=>RuntimePlugin,
    SourceMapDevToolPlugin: ()=>SourceMapDevToolPlugin,
    Stats: ()=>Stats,
    StatsErrorCode: ()=>statsFactoryUtils_StatsErrorCode,
    SubresourceIntegrityPlugin: ()=>SubresourceIntegrityPlugin,
    SwcJsMinimizerRspackPlugin: ()=>SwcJsMinimizerRspackPlugin,
    Template: ()=>Template,
    ValidationError: ()=>ValidationError,
    WebpackError: ()=>exports_WebpackError,
    WebpackOptionsApply: ()=>RspackOptionsApply,
    config: ()=>exports_config,
    container: ()=>container,
    electron: ()=>electron,
    experiments: ()=>exports_experiments,
    ids: ()=>exports_ids,
    javascript: ()=>javascript,
    lazyCompilationMiddleware: ()=>lazyCompilationMiddleware,
    library: ()=>exports_library,
    node: ()=>exports_node,
    optimize: ()=>optimize,
    rspackVersion: ()=>exports_rspackVersion,
    sharing: ()=>sharing,
    sources: ()=>index_js_namespaceObject,
    util: ()=>util,
    version: ()=>exports_version,
    wasm: ()=>exports_wasm,
    web: ()=>web,
    webworker: ()=>webworker
});
var ModuleFilenameHelpers_namespaceObject = {};
__webpack_require__.r(ModuleFilenameHelpers_namespaceObject), __webpack_require__.d(ModuleFilenameHelpers_namespaceObject, {
    asRegExp: ()=>asRegExp,
    matchObject: ()=>matchObject,
    matchPart: ()=>matchPart
}), !function() {
    let { node, bun, deno } = process.versions;
    if (!node || bun || deno) return;
    let [majorStr, minorStr] = node.split('.'), major = parseInt(majorStr, 10), minor = parseInt(minorStr || '0', 10);
    20 === major && minor >= 19 || 22 === major && minor >= 12 || major > 22 || console.error(`Unsupported Node.js version "${node}". Rspack requires Node.js 20.19+ or 22.12+. Please upgrade your Node.js version.\n`);
}();
let binding_namespaceObject = __rspack_createRequire_require(process.env.RSPACK_BINDING ? process.env.RSPACK_BINDING : "@rspack/binding");
var binding_default = __webpack_require__.n(binding_namespaceObject);
function _define_property(obj, key, value) {
    return key in obj ? Object.defineProperty(obj, key, {
        value: value,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : obj[key] = value, obj;
}
class HookBase {
    intercept(interceptor) {
        if (this.interceptors.push(Object.assign({}, interceptor)), interceptor.register) for(let i = 0; i < this.taps.length; i++)this.taps[i] = interceptor.register(this.taps[i]);
    }
    _runRegisterInterceptors(options) {
        return this.interceptors.reduce((options, interceptor)=>interceptor.register?.(options) ?? options, options);
    }
    _runCallInterceptors(...args) {
        for (let interceptor of this.interceptors)interceptor.call && interceptor.call(...args);
    }
    _runErrorInterceptors(e) {
        for (let interceptor of this.interceptors)interceptor.error && interceptor.error(e);
    }
    _runTapInterceptors(tap) {
        for (let interceptor of this.interceptors)interceptor.tap && interceptor.tap(tap);
    }
    _runDoneInterceptors() {
        for (let interceptor of this.interceptors)interceptor.done && interceptor.done();
    }
    _runResultInterceptors(r) {
        for (let interceptor of this.interceptors)interceptor.result && interceptor.result(r);
    }
    withOptions(options) {
        let mergeOptions = (opt)=>Object.assign({}, options, 'string' == typeof opt ? {
                name: opt
            } : opt);
        return {
            name: this.name,
            tap: (opt, fn)=>this.tap(mergeOptions(opt), fn),
            tapAsync: (opt, fn)=>this.tapAsync(mergeOptions(opt), fn),
            tapPromise: (opt, fn)=>this.tapPromise(mergeOptions(opt), fn),
            intercept: (interceptor)=>this.intercept(interceptor),
            isUsed: ()=>this.isUsed(),
            withOptions: (opt)=>this.withOptions(mergeOptions(opt)),
            queryStageRange: (stageRange)=>this.queryStageRange(stageRange)
        };
    }
    isUsed() {
        return this.taps.length > 0 || this.interceptors.length > 0;
    }
    queryStageRange(stageRange) {
        return new QueriedHook(stageRange, this);
    }
    callAsyncStageRange(_queried) {
        throw Error('Hook should implement there own _callAsyncStageRange');
    }
    callAsync(...args) {
        return this.callAsyncStageRange(this.queryStageRange(allStageRange), ...args);
    }
    promiseStageRange(queried, ...args) {
        return new Promise((resolve, reject)=>{
            this.callAsyncStageRange(queried, ...args, (e, r)=>e ? reject(e) : resolve(r));
        });
    }
    promise(...args) {
        return this.promiseStageRange(this.queryStageRange(allStageRange), ...args);
    }
    tap(options, fn) {
        this._tap('sync', options, fn);
    }
    tapAsync(options, fn) {
        this._tap('async', options, fn);
    }
    tapPromise(options, fn) {
        this._tap('promise', options, fn);
    }
    _tap(type, options, fn) {
        let normalizedOptions = options;
        if ('string' == typeof options) normalizedOptions = {
            name: options.trim()
        };
        else if ('object' != typeof options || null === options) throw Error('Invalid tap options');
        if ('string' != typeof normalizedOptions.name || '' === normalizedOptions.name) throw Error('Missing name for tap');
        this._insert(this._runRegisterInterceptors(Object.assign({
            type,
            fn
        }, normalizedOptions)));
    }
    _insert(item) {
        let before;
        'string' == typeof item.before ? before = new Set([
            item.before
        ]) : Array.isArray(item.before) && (before = new Set(item.before));
        let stage = 0;
        'number' == typeof item.stage && (stage = item.stage);
        let i = this.taps.length;
        for(; i > 0;){
            i--;
            let x = this.taps[i];
            this.taps[i + 1] = x;
            let xStage = x.stage || 0;
            if (before) {
                if (before.has(x.name)) {
                    before.delete(x.name);
                    continue;
                }
                if (before.size > 0) continue;
            }
            if (!(xStage > stage)) {
                i++;
                break;
            }
        }
        this.taps[i] = item;
    }
    _prepareArgs(args) {
        let len = this.args.length;
        return args.length < len ? (args.length = len, args.fill(void 0, args.length, len)) : (args.length > len && (args.length = len), args);
    }
    constructor(args = [], name){
        _define_property(this, "args", void 0), _define_property(this, "name", void 0), _define_property(this, "taps", void 0), _define_property(this, "interceptors", void 0), this.args = args, this.name = name, this.taps = [], this.interceptors = [];
    }
}
let minStage = -1 / 0, maxStage = 1 / 0, allStageRange = [
    minStage,
    1 / 0
], i32MAX = 2147483648 - 1, safeStage = (stage)=>stage < -2147483648 ? -2147483648 : stage > i32MAX ? i32MAX : stage;
class QueriedHook {
    isUsed() {
        return !!(this.tapsInRange.length > 0 || this.stageRange[0] === minStage && this.hook.interceptors.some((i)=>i.call) || this.stageRange[1] === maxStage && this.hook.interceptors.some((i)=>i.done));
    }
    call(...args) {
        if ('function' != typeof this.hook.callStageRange) throw Error('hook is not a SyncHook, call methods only exists on SyncHook');
        return this.hook.callStageRange(this, ...args);
    }
    callAsync(...args) {
        return this.hook.callAsyncStageRange(this, ...args);
    }
    promise(...args) {
        return this.hook.promiseStageRange(this, ...args);
    }
    constructor(stageRange, hook){
        _define_property(this, "stageRange", void 0), _define_property(this, "hook", void 0), _define_property(this, "tapsInRange", void 0);
        let tapsInRange = [], [from, to] = stageRange;
        for (let tap of hook.taps){
            let stage = tap.stage ?? 0;
            from <= stage && stage < to ? tapsInRange.push(tap) : to === maxStage && stage === maxStage && tapsInRange.push(tap);
        }
        this.stageRange = stageRange, this.hook = hook, this.tapsInRange = tapsInRange;
    }
}
class SyncHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
            this._runTapInterceptors(tap);
            try {
                tap.fn(...args2);
            } catch (e) {
                return this._runErrorInterceptors(e), cb(e);
            }
        }
        to === maxStage && (this._runDoneInterceptors(), cb(null));
    }
    call(...args) {
        return this.callStageRange(this.queryStageRange(allStageRange), ...args);
    }
    callStageRange(queried, ...args) {
        let result, error;
        if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
            error = e, result = r;
        }), error) throw error;
        return result;
    }
    tapAsync() {
        throw Error('tapAsync is not supported on a SyncHook');
    }
    tapPromise() {
        throw Error('tapPromise is not supported on a SyncHook');
    }
}
class SyncBailHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
            let r;
            this._runTapInterceptors(tap);
            try {
                r = tap.fn(...args2);
            } catch (e) {
                return this._runErrorInterceptors(e), cb(e);
            }
            if (void 0 !== r) return this._runResultInterceptors(r), cb(null, r);
        }
        to === maxStage && (this._runDoneInterceptors(), cb(null));
    }
    call(...args) {
        return this.callStageRange(this.queryStageRange(allStageRange), ...args);
    }
    callStageRange(queried, ...args) {
        let result, error;
        if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
            error = e, result = r;
        }), error) throw error;
        return result;
    }
    tapAsync() {
        throw Error('tapAsync is not supported on a SyncBailHook');
    }
    tapPromise() {
        throw Error('tapPromise is not supported on a SyncBailHook');
    }
}
class SyncWaterfallHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
            this._runTapInterceptors(tap);
            try {
                let r = tap.fn(...args2);
                void 0 !== r && (args2[0] = r);
            } catch (e) {
                return this._runErrorInterceptors(e), cb(e);
            }
        }
        to === maxStage && (this._runDoneInterceptors(), cb(null, args2[0]));
    }
    call(...args) {
        return this.callStageRange(this.queryStageRange(allStageRange), ...args);
    }
    callStageRange(queried, ...args) {
        let result, error;
        if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
            error = e, result = r;
        }), error) throw error;
        return result;
    }
    tapAsync() {
        throw Error('tapAsync is not supported on a SyncWaterfallHook');
    }
    tapPromise() {
        throw Error('tapPromise is not supported on a SyncWaterfallHook');
    }
    constructor(args = [], name){
        if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
        super(args, name);
    }
}
class AsyncParallelHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        from === minStage && this._runCallInterceptors(...args2);
        let done = ()=>{
            this._runDoneInterceptors(), cb(null);
        }, error = (e)=>{
            this._runErrorInterceptors(e), cb(e);
        };
        if (0 === tapsInRange.length) return done();
        let counter = tapsInRange.length;
        for (let tap of tapsInRange){
            if (this._runTapInterceptors(tap), 'promise' === tap.type) {
                let promise = tap.fn(...args2);
                if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
                promise.then(()=>{
                    0 == (counter -= 1) && done();
                }, (e)=>{
                    counter = 0, error(e);
                });
            } else if ('async' === tap.type) tap.fn(...args2, (e)=>{
                e ? (counter = 0, error(e)) : 0 == (counter -= 1) && done();
            });
            else {
                let hasError = !1;
                try {
                    tap.fn(...args2);
                } catch (e) {
                    hasError = !0, counter = 0, error(e);
                }
                hasError || 0 != --counter || done();
            }
            if (counter <= 0) return;
        }
    }
}
class AsyncSeriesHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        from === minStage && this._runCallInterceptors(...args2);
        let done = ()=>{
            this._runDoneInterceptors(), cb(null);
        }, error = (e)=>{
            this._runErrorInterceptors(e), cb(e);
        };
        if (0 === tapsInRange.length) return done();
        let index = 0, next = ()=>{
            let tap = tapsInRange[index];
            if (this._runTapInterceptors(tap), 'promise' === tap.type) {
                let promise = tap.fn(...args2);
                if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
                promise.then(()=>{
                    (index += 1) === tapsInRange.length ? done() : next();
                }, (e)=>{
                    index = tapsInRange.length, error(e);
                });
            } else if ('async' === tap.type) tap.fn(...args2, (e)=>{
                e ? (index = tapsInRange.length, error(e)) : (index += 1) === tapsInRange.length ? done() : next();
            });
            else {
                let hasError = !1;
                try {
                    tap.fn(...args2);
                } catch (e) {
                    hasError = !0, index = tapsInRange.length, error(e);
                }
                hasError || ((index += 1) === tapsInRange.length ? done() : next());
            }
            if (index === tapsInRange.length) return;
        };
        next();
    }
}
class AsyncSeriesBailHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        from === minStage && this._runCallInterceptors(...args2);
        let done = ()=>{
            this._runDoneInterceptors(), cb(null);
        }, error = (e)=>{
            this._runErrorInterceptors(e), cb(e);
        }, result = (r)=>{
            this._runResultInterceptors(r), cb(null, r);
        };
        if (0 === tapsInRange.length) return done();
        let index = 0, next = ()=>{
            let tap = tapsInRange[index];
            if (this._runTapInterceptors(tap), 'promise' === tap.type) {
                let promise = tap.fn(...args2);
                if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
                promise.then((r)=>{
                    index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next();
                }, (e)=>{
                    index = tapsInRange.length, error(e);
                });
            } else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
                e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
            });
            else {
                let r, hasError = !1;
                try {
                    r = tap.fn(...args2);
                } catch (e) {
                    hasError = !0, index = tapsInRange.length, error(e);
                }
                hasError || (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
            }
            if (index === tapsInRange.length) return;
        };
        next();
    }
}
class AsyncSeriesWaterfallHook extends HookBase {
    callAsyncStageRange(queried, ...args) {
        let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
        from === minStage && this._runCallInterceptors(...args2);
        let result = (r)=>{
            this._runResultInterceptors(r), cb(null, r);
        }, error = (e)=>{
            this._runErrorInterceptors(e), cb(e);
        };
        if (0 === tapsInRange.length) return result(args2[0]);
        let index = 0, next = ()=>{
            let tap = tapsInRange[index];
            if (this._runTapInterceptors(tap), 'promise' === tap.type) {
                let promise = tap.fn(...args2);
                if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
                promise.then((r)=>{
                    index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next();
                }, (e)=>{
                    index = tapsInRange.length, error(e);
                });
            } else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
                e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next());
            });
            else {
                let hasError = !1;
                try {
                    let r = tap.fn(...args2);
                    void 0 !== r && (args2[0] = r);
                } catch (e) {
                    hasError = !0, index = tapsInRange.length, error(e);
                }
                hasError || ((index += 1) === tapsInRange.length ? result(args2[0]) : next());
            }
            if (index === tapsInRange.length) return;
        };
        next();
    }
    constructor(args = [], name){
        if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
        super(args, name);
    }
}
let defaultFactory = (key, hook)=>hook;
class HookMap {
    get(key) {
        return this._map.get(key);
    }
    for(key) {
        let hook = this.get(key);
        if (void 0 !== hook) return hook;
        let newHook = this._factory(key), interceptors = this._interceptors;
        for(let i = 0; i < interceptors.length; i++){
            let factory = interceptors[i].factory;
            factory && (newHook = factory(key, newHook));
        }
        return this._map.set(key, newHook), newHook;
    }
    intercept(interceptor) {
        this._interceptors.push(Object.assign({
            factory: defaultFactory
        }, interceptor));
    }
    isUsed() {
        for (let key of this._map.keys()){
            let hook = this.get(key);
            if (hook?.isUsed()) return !0;
        }
        return !1;
    }
    queryStageRange(stageRange) {
        return new QueriedHookMap(stageRange, this);
    }
    constructor(factory, name){
        _define_property(this, "_map", new Map()), _define_property(this, "_factory", void 0), _define_property(this, "name", void 0), _define_property(this, "_interceptors", void 0), this.name = name, this._factory = factory, this._interceptors = [];
    }
}
class QueriedHookMap {
    get(key) {
        return this.hookMap.get(key)?.queryStageRange(this.stageRange);
    }
    for(key) {
        return this.hookMap.for(key).queryStageRange(this.stageRange);
    }
    isUsed() {
        for (let key of this.hookMap._map.keys())if (this.get(key)?.isUsed()) return !0;
        return !1;
    }
    constructor(stageRange, hookMap){
        _define_property(this, "stageRange", void 0), _define_property(this, "hookMap", void 0), this.stageRange = stageRange, this.hookMap = hookMap;
    }
}
class MultiHook {
    tap(options, fn) {
        for (let hook of this.hooks)hook.tap(options, fn);
    }
    tapAsync(options, fn) {
        for (let hook of this.hooks)hook.tapAsync(options, fn);
    }
    tapPromise(options, fn) {
        for (let hook of this.hooks)hook.tapPromise(options, fn);
    }
    isUsed() {
        for (let hook of this.hooks)if (hook.isUsed()) return !0;
        return !1;
    }
    intercept(interceptor) {
        for (let hook of this.hooks)hook.intercept(interceptor);
    }
    withOptions(options) {
        return new MultiHook(this.hooks.map((h)=>h.withOptions(options)), this.name);
    }
    constructor(hooks, name){
        _define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
    }
}
let cutOffLoaderExecution = (stack)=>((stack, flag)=>{
        let stacks = stack.split('\n');
        for(let i = 0; i < stacks.length; i++)stacks[i].includes(flag) && (stacks.length = i);
        return stacks.join('\n');
    })(stack, 'LOADER_EXECUTION');
class WebpackError_WebpackError extends Error {
    loc;
    file;
    chunk;
    module;
    details;
    hideStack;
}
Object.defineProperty(WebpackError_WebpackError.prototype, inspect.custom, {
    value: function() {
        return this.stack + (this.details ? `\n${this.details}` : '');
    },
    enumerable: !1,
    configurable: !0
});
let lib_WebpackError = WebpackError_WebpackError, LogType = Object.freeze({
    error: 'error',
    warn: 'warn',
    info: 'info',
    log: 'log',
    debug: 'debug',
    trace: 'trace',
    group: 'group',
    groupCollapsed: 'groupCollapsed',
    groupEnd: 'groupEnd',
    profile: 'profile',
    profileEnd: 'profileEnd',
    time: 'time',
    clear: 'clear',
    status: 'status',
    cache: 'cache'
});
function getLogTypeBitFlag(type) {
    return 1 << Object.values(LogType).indexOf(type);
}
function getLogTypesBitFlag(types) {
    return types.reduce((acc, cur)=>acc | getLogTypeBitFlag(cur), 0);
}
let LOG_SYMBOL = Symbol('webpack logger raw log method'), TIMERS_SYMBOL = Symbol('webpack logger times'), TIMERS_AGGREGATES_SYMBOL = Symbol('webpack logger aggregated times');
class Logger {
    getChildLogger;
    [LOG_SYMBOL];
    [TIMERS_SYMBOL];
    [TIMERS_AGGREGATES_SYMBOL];
    constructor(log, getChildLogger){
        this[LOG_SYMBOL] = log, this.getChildLogger = getChildLogger;
    }
    error(...args) {
        this[LOG_SYMBOL](LogType.error, args);
    }
    warn(...args) {
        this[LOG_SYMBOL](LogType.warn, args);
    }
    info(...args) {
        this[LOG_SYMBOL](LogType.info, args);
    }
    log(...args) {
        this[LOG_SYMBOL](LogType.log, args);
    }
    debug(...args) {
        this[LOG_SYMBOL](LogType.debug, args);
    }
    assert(assertion, ...args) {
        assertion || this[LOG_SYMBOL](LogType.error, args);
    }
    trace() {
        this[LOG_SYMBOL](LogType.trace, [
            'Trace'
        ]);
    }
    clear() {
        this[LOG_SYMBOL](LogType.clear);
    }
    status(...args) {
        this[LOG_SYMBOL](LogType.status, args);
    }
    group(...args) {
        this[LOG_SYMBOL](LogType.group, args);
    }
    groupCollapsed(...args) {
        this[LOG_SYMBOL](LogType.groupCollapsed, args);
    }
    groupEnd(...args) {
        this[LOG_SYMBOL](LogType.groupEnd, args);
    }
    profile(label) {
        this[LOG_SYMBOL](LogType.profile, [
            label
        ]);
    }
    profileEnd(label) {
        this[LOG_SYMBOL](LogType.profileEnd, [
            label
        ]);
    }
    time(label) {
        this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(), this[TIMERS_SYMBOL].set(label, process.hrtime());
    }
    timeLog(label) {
        let prev = this[TIMERS_SYMBOL]?.get(label);
        if (!prev) throw Error(`No such label '${label}' for WebpackLogger.timeLog()`);
        let time = process.hrtime(prev);
        this[LOG_SYMBOL](LogType.time, [
            label,
            ...time
        ]);
    }
    timeEnd(label) {
        let prev = this[TIMERS_SYMBOL]?.get(label);
        if (!prev) throw Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
        let time = process.hrtime(prev);
        this[TIMERS_SYMBOL].delete(label), this[LOG_SYMBOL](LogType.time, [
            label,
            ...time
        ]);
    }
    timeAggregate(label) {
        let prev = this[TIMERS_SYMBOL]?.get(label);
        if (!prev) throw Error(`No such label '${label}' for WebpackLogger.timeAggregate()`);
        let time = process.hrtime(prev);
        this[TIMERS_SYMBOL].delete(label), this[TIMERS_AGGREGATES_SYMBOL] = this[TIMERS_AGGREGATES_SYMBOL] || new Map();
        let current = this[TIMERS_AGGREGATES_SYMBOL].get(label);
        void 0 !== current && (time[1] + current[1] > 1e9 ? (time[0] += current[0] + 1, time[1] = time[1] - 1e9 + current[1]) : (time[0] += current[0], time[1] += current[1])), this[TIMERS_AGGREGATES_SYMBOL].set(label, time);
    }
    timeAggregateEnd(label) {
        if (void 0 === this[TIMERS_AGGREGATES_SYMBOL]) return;
        let time = this[TIMERS_AGGREGATES_SYMBOL].get(label);
        void 0 !== time && (this[TIMERS_AGGREGATES_SYMBOL].delete(label), this[LOG_SYMBOL](LogType.time, [
            label,
            ...time
        ]));
    }
}
function toJsRuntimeSpec(runtime) {
    return runtime instanceof Set ? Array.from(runtime) : runtime;
}
class ExportsInfo {
    #inner;
    static __from_binding(binding) {
        return new ExportsInfo(binding);
    }
    constructor(binding){
        this.#inner = binding;
    }
    isUsed(runtime) {
        return this.#inner.isUsed(toJsRuntimeSpec(runtime));
    }
    isModuleUsed(runtime) {
        return this.#inner.isModuleUsed(toJsRuntimeSpec(runtime));
    }
    setUsedInUnknownWay(runtime) {
        return this.#inner.setUsedInUnknownWay(toJsRuntimeSpec(runtime));
    }
    getUsed(name, runtime) {
        return this.#inner.getUsed(name, toJsRuntimeSpec(runtime));
    }
}
class ModuleGraph {
    static __from_binding(binding) {
        return new ModuleGraph(binding);
    }
    #inner;
    constructor(binding){
        this.#inner = binding;
    }
    getModule(dependency) {
        return this.#inner.getModule(dependency);
    }
    getResolvedModule(dependency) {
        return this.#inner.getResolvedModule(dependency);
    }
    getUsedExports(module, runtime) {
        return this.#inner.getUsedExports(module, runtime);
    }
    getParentModule(dependency) {
        return this.#inner.getParentModule(dependency);
    }
    getIssuer(module) {
        return this.#inner.getIssuer(module);
    }
    getExportsInfo(module) {
        return ExportsInfo.__from_binding(this.#inner.getExportsInfo(module));
    }
    getConnection(dependency) {
        return this.#inner.getConnection(dependency);
    }
    getOutgoingConnections(module) {
        return this.#inner.getOutgoingConnections(module);
    }
    getIncomingConnections(module) {
        return this.#inner.getIncomingConnections(module);
    }
    getParentBlockIndex(dependency) {
        return this.#inner.getParentBlockIndex(dependency);
    }
    isAsync(module) {
        return this.#inner.isAsync(module);
    }
    getOutgoingConnectionsInOrder(module) {
        return this.#inner.getOutgoingConnectionsInOrder(module);
    }
}
class RuntimeModule {
    static STAGE_NORMAL = 0;
    static STAGE_BASIC = 5;
    static STAGE_ATTACH = 10;
    static STAGE_TRIGGER = 20;
    static __to_binding(module) {
        return {
            name: module.name,
            stage: module.stage,
            generator: module.generate.bind(module),
            fullHash: module.fullHash,
            dependentHash: module.dependentHash,
            isolate: module.shouldIsolate()
        };
    }
    _name;
    _stage;
    fullHash = !1;
    dependentHash = !1;
    chunk = null;
    compilation = null;
    chunkGraph = null;
    constructor(name, stage = 0){
        this._name = name, this._stage = stage;
    }
    attach(compilation, chunk, chunkGraph) {
        this.compilation = compilation, this.chunk = chunk, this.chunkGraph = chunkGraph;
    }
    get source() {}
    get name() {
        return this._name;
    }
    get stage() {
        return this._stage;
    }
    identifier() {
        return `webpack/runtime/${this._name}`;
    }
    readableIdentifier() {
        return `webpack/runtime/${this._name}`;
    }
    shouldIsolate() {
        return !0;
    }
    generate() {
        throw Error(`Should implement "generate" method of runtime module "${this.name}"`);
    }
}
class Stats {
    #inner;
    #compilation;
    #innerMap;
    constructor(compilation){
        this.#inner = compilation.__internal_getInner().getStats(), this.#compilation = compilation, this.#innerMap = new WeakMap([
            [
                this.compilation,
                this.#inner
            ]
        ]);
    }
    #getInnerByCompilation(compilation) {
        if (this.#innerMap.has(compilation)) return this.#innerMap.get(compilation);
        let inner = compilation.__internal_getInner().getStats();
        return this.#innerMap.set(compilation, inner), inner;
    }
    get compilation() {
        if (this.#compilation.__internal__shutdown) throw Error('Unable to access `Stats` after the compiler was shutdown');
        return this.#compilation;
    }
    get hash() {
        return this.compilation.hash;
    }
    get startTime() {
        return this.compilation.startTime;
    }
    get endTime() {
        return this.compilation.endTime;
    }
    hasErrors() {
        return this.#compilation.errors.length > 0 || this.#compilation.children.some((child)=>child.getStats().hasErrors());
    }
    hasWarnings() {
        return this.#compilation.hooks.processWarnings.call(this.#compilation.warnings).length > 0 || this.#compilation.children.some((child)=>child.getStats().hasWarnings());
    }
    toJson(opts, forToString) {
        let options = this.compilation.createStatsOptions(opts, {
            forToString
        }), statsFactory = this.compilation.createStatsFactory(options), statsCompilationMap = new Map();
        return statsFactory.create('compilation', this.compilation, {
            compilation: this.compilation,
            getStatsCompilation: (compilation)=>{
                if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
                if (this.compilation !== this.compilation.compiler._lastCompilation) return {
                    assets: [],
                    assetsByChunkName: [],
                    chunks: [],
                    entrypoints: [],
                    errors: [],
                    hash: 'XXXX',
                    modules: [],
                    namedChunkGroups: [],
                    warnings: []
                };
                let innerStats = this.#getInnerByCompilation(compilation);
                options.warnings = !1;
                let innerStatsCompilation = innerStats.toJson(options);
                return statsCompilationMap.set(compilation, innerStatsCompilation), innerStatsCompilation;
            },
            getInner: this.#getInnerByCompilation.bind(this)
        });
    }
    toString(opts) {
        let options = this.compilation.createStatsOptions(opts, {
            forToString: !0
        }), statsFactory = this.compilation.createStatsFactory(options), statsPrinter = this.compilation.createStatsPrinter(options), statsCompilationMap = new Map(), stats = statsFactory.create('compilation', this.compilation, {
            compilation: this.compilation,
            getStatsCompilation: (compilation)=>{
                if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
                if (this.compilation !== this.compilation.compiler._lastCompilation) return {
                    assets: [],
                    assetsByChunkName: [],
                    chunks: [],
                    entrypoints: [],
                    errors: [],
                    hash: 'XXXX',
                    modules: [],
                    namedChunkGroups: [],
                    warnings: []
                };
                let innerStatsCompilation = this.#getInnerByCompilation(compilation).toJson(options);
                return statsCompilationMap.set(compilation, innerStatsCompilation), innerStatsCompilation;
            },
            getInner: this.#getInnerByCompilation.bind(this)
        }), result = statsPrinter.print('compilation', stats);
        return void 0 === result ? '' : result;
    }
}
function presetToOptions(name) {
    switch('string' == typeof name && name.toLowerCase() || name){
        case 'none':
            return {
                all: !1
            };
        case 'verbose':
            return {
                all: !0,
                modulesSpace: 1 / 0
            };
        case 'errors-only':
            return {
                all: !1,
                errors: !0,
                errorsCount: !0,
                logging: 'error',
                moduleTrace: !0
            };
        case 'errors-warnings':
            return {
                all: !1,
                errors: !0,
                errorsCount: !0,
                warnings: !0,
                warningsCount: !0,
                logging: 'warn'
            };
        default:
            return {};
    }
}
class TwoKeyWeakMap {
    _map;
    constructor(){
        this._map = new WeakMap();
    }
    get(key1, key2) {
        let childMap = this._map.get(key1);
        if (void 0 !== childMap) return childMap.get(key2);
    }
    set(key1, key2, value) {
        let childMap = this._map.get(key1);
        void 0 === childMap && (childMap = new WeakMap(), this._map.set(key1, childMap)), childMap.set(key2, value);
    }
}
let concatComparatorsCache = new TwoKeyWeakMap(), concatComparators = (...comps)=>{
    let [c1, c2, ...cRest] = comps;
    if (void 0 === c2) return c1;
    if (cRest.length > 0) {
        let [c3, ...cRest2] = cRest;
        return concatComparators(c1, concatComparators(c2, c3, ...cRest2));
    }
    let cacheEntry = concatComparatorsCache.get(c1, c2);
    if (void 0 !== cacheEntry) return cacheEntry;
    let result = (a, b)=>{
        let res = c1(a, b);
        return 0 !== res ? res : c2(a, b);
    };
    return concatComparatorsCache.set(c1, c2, result), result;
}, compareIds = (a, b)=>typeof a != typeof b ? typeof a < typeof b ? -1 : 1 : a < b ? -1 : +(a > b), compareSelectCache = new TwoKeyWeakMap(), compareSelect = (getter, comparator)=>{
    let cacheEntry = compareSelectCache.get(getter, comparator);
    if (void 0 !== cacheEntry) return cacheEntry;
    let result = (a, b)=>{
        let aValue = getter(a), bValue = getter(b);
        return null != aValue ? null != bValue ? comparator(aValue, bValue) : -1 : +(null != bValue);
    };
    return compareSelectCache.set(getter, comparator, result), result;
}, compareNumbers = (a, b)=>typeof a != typeof b ? typeof a < typeof b ? -1 : 1 : a < b ? -1 : +(a > b);
class StatsFactory {
    hooks;
    _caches;
    _inCreate;
    constructor(){
        this.hooks = Object.freeze({
            extract: new HookMap(()=>new SyncBailHook([
                    'object',
                    'data',
                    'context'
                ])),
            filter: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context',
                    'index',
                    'unfilteredIndex'
                ])),
            sort: new HookMap(()=>new SyncBailHook([
                    'comparators',
                    'context'
                ])),
            filterSorted: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context',
                    'index',
                    'unfilteredIndex'
                ])),
            groupResults: new HookMap(()=>new SyncBailHook([
                    'groupConfigs',
                    'context'
                ])),
            sortResults: new HookMap(()=>new SyncBailHook([
                    'comparators',
                    'context'
                ])),
            filterResults: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context',
                    'index',
                    'unfilteredIndex'
                ])),
            merge: new HookMap(()=>new SyncBailHook([
                    'items',
                    'context'
                ])),
            result: new HookMap(()=>new SyncWaterfallHook([
                    'result',
                    'context'
                ])),
            getItemName: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context'
                ])),
            getItemFactory: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context'
                ]))
        });
        let hooks = this.hooks, caches = {};
        for (let key of Object.keys(hooks))caches[key] = new Map();
        this._caches = caches, this._inCreate = !1;
    }
    _getAllLevelHooks(hookMap, cache, type) {
        let cacheEntry = cache.get(type);
        if (void 0 !== cacheEntry) return cacheEntry;
        let hooks = [], typeParts = type.split('.');
        for(let i = 0; i < typeParts.length; i++){
            let hook = hookMap.get(typeParts.slice(i).join('.'));
            hook && hooks.push(hook);
        }
        return cache.set(type, hooks), hooks;
    }
    _forEachLevel(hookMap, cache, type, fn) {
        for (let hook of this._getAllLevelHooks(hookMap, cache, type)){
            let result = fn(hook);
            if (void 0 !== result) return result;
        }
    }
    _forEachLevelWaterfall(hookMap, cache, type, data, fn) {
        return this._getAllLevelHooks(hookMap, cache, type).reduce((data, hook)=>fn(hook, data), data);
    }
    _forEachLevelFilter(hookMap, cache, type, items, fn, forceClone) {
        let hooks = this._getAllLevelHooks(hookMap, cache, type);
        if (0 === hooks.length) return forceClone ? items.slice() : items;
        let i = 0;
        return items.filter((item, idx)=>{
            for (let hook of hooks){
                let r = fn(hook, item, idx, i);
                if (void 0 !== r) return r && i++, r;
            }
            return i++, !0;
        });
    }
    create(type, data, baseContext) {
        if (this._inCreate) return this._create(type, data, baseContext);
        try {
            return this._inCreate = !0, this._create(type, data, baseContext);
        } finally{
            for (let key of Object.keys(this._caches))this._caches[key].clear();
            this._inCreate = !1;
        }
    }
    _create(type, data, baseContext) {
        let context = {
            ...baseContext,
            type,
            [type]: data
        };
        if (Array.isArray(data)) {
            let items = this._forEachLevelFilter(this.hooks.filter, this._caches.filter, type, data, (h, r, idx, i)=>h.call(r, context, idx, i), !0), comparators = [];
            this._forEachLevel(this.hooks.sort, this._caches.sort, type, (h)=>h.call(comparators, context)), comparators.length > 0 && items.sort(concatComparators(...comparators));
            let resultItems = this._forEachLevelFilter(this.hooks.filterSorted, this._caches.filterSorted, type, items, (h, r, idx, i)=>h.call(r, context, idx, i), !1).map((item, i)=>{
                let itemContext = {
                    ...context,
                    _index: i
                }, itemName = this._forEachLevel(this.hooks.getItemName, this._caches.getItemName, `${type}[]`, (h)=>h.call(item, itemContext));
                itemName && (itemContext[itemName] = item);
                let innerType = itemName ? `${type}[].${itemName}` : `${type}[]`;
                return (this._forEachLevel(this.hooks.getItemFactory, this._caches.getItemFactory, innerType, (h)=>h.call(item, itemContext)) || this).create(innerType, item, itemContext);
            }), comparators2 = [];
            this._forEachLevel(this.hooks.sortResults, this._caches.sortResults, type, (h)=>h.call(comparators2, context)), comparators2.length > 0 && resultItems.sort(concatComparators(...comparators2));
            let groupConfigs = [];
            this._forEachLevel(this.hooks.groupResults, this._caches.groupResults, type, (h)=>h.call(groupConfigs, context)), groupConfigs.length > 0 && (resultItems = ((items, groupConfigs)=>{
                let itemsWithGroups = new Set(), allGroups = new Map();
                for (let item of items){
                    let groups = new Set();
                    for(let i = 0; i < groupConfigs.length; i++){
                        let groupConfig = groupConfigs[i], keys = groupConfig.getKeys(item);
                        if (keys) for (let name of keys){
                            let key = `${i}:${name}`, group = allGroups.get(key);
                            void 0 === group && allGroups.set(key, group = {
                                config: groupConfig,
                                name,
                                alreadyGrouped: !1,
                                items: void 0
                            }), groups.add(group);
                        }
                    }
                    itemsWithGroups.add({
                        item,
                        groups
                    });
                }
                let runGrouping = (itemsWithGroups)=>{
                    let totalSize = itemsWithGroups.size;
                    for (let entry of itemsWithGroups)for (let group of entry.groups){
                        if (group.alreadyGrouped) continue;
                        let items = group.items;
                        void 0 === items ? group.items = new Set([
                            entry
                        ]) : items.add(entry);
                    }
                    let groupMap = new Map();
                    for (let group of allGroups.values())if (group.items) {
                        let items = group.items;
                        group.items = void 0, groupMap.set(group, {
                            items,
                            options: void 0,
                            used: !1
                        });
                    }
                    let results = [];
                    for(;;){
                        let bestGroup, bestGroupItems, bestGroupOptions, bestGroupSize = -1;
                        for (let [group, state] of groupMap){
                            let { items, used } = state, options = state.options;
                            if (void 0 === options) {
                                let groupConfig = group.config;
                                state.options = options = groupConfig.getOptions?.(group.name, Array.from(items, ({ item })=>item)) || !1;
                            }
                            let force = !1 !== options && options.force;
                            if (!force && (!1 !== bestGroupOptions && bestGroupOptions?.force || used || items.size <= 1 || totalSize - items.size <= 1)) continue;
                            let targetGroupCount = !1 !== options && options.targetGroupCount || 4, sizeValue = force ? items.size : Math.min(items.size, 2 * totalSize / targetGroupCount + itemsWithGroups.size - items.size);
                            (sizeValue > bestGroupSize || force && (!bestGroupOptions || !bestGroupOptions.force)) && (bestGroup = group, bestGroupSize = sizeValue, bestGroupItems = items, bestGroupOptions = options);
                        }
                        if (void 0 === bestGroup) break;
                        let items = new Set(bestGroupItems), options = bestGroupOptions, groupChildren = !options || !1 !== options.groupChildren;
                        for (let item of items)for (let group of (itemsWithGroups.delete(item), item.groups)){
                            let state = groupMap.get(group);
                            void 0 !== state && (state.items.delete(item), 0 === state.items.size ? groupMap.delete(group) : (state.options = void 0, groupChildren && (state.used = !0)));
                        }
                        groupMap.delete(bestGroup);
                        let key = bestGroup.name, groupConfig = bestGroup.config, allItems = Array.from(items, ({ item })=>item);
                        bestGroup.alreadyGrouped = !0;
                        let children = groupChildren ? runGrouping(items) : allItems;
                        bestGroup.alreadyGrouped = !1, results.push(groupConfig.createGroup(key, children, allItems));
                    }
                    for (let { item } of itemsWithGroups)results.push(item);
                    return results;
                };
                return runGrouping(itemsWithGroups);
            })(resultItems, groupConfigs));
            let finalResultItems = this._forEachLevelFilter(this.hooks.filterResults, this._caches.filterResults, type, resultItems, (h, r, idx, i)=>h.call(r, context, idx, i), !1), result = this._forEachLevel(this.hooks.merge, this._caches.merge, type, (h)=>h.call(finalResultItems, context));
            return void 0 === result && (result = finalResultItems), this._forEachLevelWaterfall(this.hooks.result, this._caches.result, type, result, (h, r)=>h.call(r, context));
        }
        let object = {};
        return this._forEachLevel(this.hooks.extract, this._caches.extract, type, (h)=>h.call(object, data, context)), this._forEachLevelWaterfall(this.hooks.result, this._caches.result, type, object, (h, r)=>h.call(r, context));
    }
}
class StatsPrinter {
    _levelHookCache;
    _inPrint;
    hooks;
    constructor(){
        this.hooks = Object.freeze({
            sortElements: new HookMap(()=>new SyncBailHook([
                    'elements',
                    'context'
                ])),
            printElements: new HookMap(()=>new SyncBailHook([
                    'printedElements',
                    'context'
                ])),
            sortItems: new HookMap(()=>new SyncBailHook([
                    'items',
                    'context'
                ])),
            getItemName: new HookMap(()=>new SyncBailHook([
                    'item',
                    'context'
                ])),
            printItems: new HookMap(()=>new SyncBailHook([
                    'printedItems',
                    'context'
                ])),
            print: new HookMap(()=>new SyncBailHook([
                    'object',
                    'context'
                ])),
            result: new HookMap(()=>new SyncWaterfallHook([
                    'result',
                    'context'
                ]))
        }), this._levelHookCache = new Map(), this._inPrint = !1;
    }
    _getAllLevelHooks(hookMap, type) {
        let cache = this._levelHookCache.get(hookMap);
        void 0 === cache && (cache = new Map(), this._levelHookCache.set(hookMap, cache));
        let cacheEntry = cache.get(type);
        if (void 0 !== cacheEntry) return cacheEntry;
        let hooks = [], typeParts = type.split('.');
        for(let i = 0; i < typeParts.length; i++){
            let hook = hookMap.get(typeParts.slice(i).join('.'));
            hook && hooks.push(hook);
        }
        return cache.set(type, hooks), hooks;
    }
    _forEachLevel(hookMap, type, fn) {
        for (let hook of this._getAllLevelHooks(hookMap, type)){
            let result = fn(hook);
            if (void 0 !== result) return result;
        }
    }
    _forEachLevelWaterfall(hookMap, type, data, fn) {
        return this._getAllLevelHooks(hookMap, type).reduce((data, hook)=>fn(hook, data), data);
    }
    print(type, object, baseContext) {
        if (this._inPrint) return this._print(type, object, baseContext);
        try {
            return this._inPrint = !0, this._print(type, object, baseContext);
        } finally{
            this._levelHookCache.clear(), this._inPrint = !1;
        }
    }
    _print(type, object, baseContext) {
        let context = {
            ...baseContext,
            type,
            [type]: object
        }, printResult = this._forEachLevel(this.hooks.print, type, (hook)=>hook.call(object, context));
        if (void 0 === printResult) {
            if (Array.isArray(object)) {
                let sortedItems = object.slice();
                this._forEachLevel(this.hooks.sortItems, type, (h)=>h.call(sortedItems, context));
                let printedItems = sortedItems.map((item, i)=>{
                    let itemContext = {
                        ...context,
                        _index: i
                    }, itemName = this._forEachLevel(this.hooks.getItemName, `${type}[]`, (h)=>h.call(item, itemContext));
                    return itemName && (itemContext[itemName] = item), this.print(itemName ? `${type}[].${itemName}` : `${type}[]`, item, itemContext);
                });
                if (void 0 === (printResult = this._forEachLevel(this.hooks.printItems, type, (h)=>h.call(printedItems, context)))) {
                    let result = printedItems.filter(Boolean);
                    result.length > 0 && (printResult = result.join('\n'));
                }
            } else if (null !== object && 'object' == typeof object) {
                let elements = Object.keys(object).filter((key)=>void 0 !== object[key]);
                this._forEachLevel(this.hooks.sortElements, type, (h)=>h.call(elements, context));
                let printedElements = elements.map((element)=>{
                    let content = this.print(`${type}.${element}`, object[element], {
                        ...context,
                        _parent: object,
                        _element: element,
                        [element]: object[element]
                    });
                    return {
                        element,
                        content
                    };
                });
                if (void 0 === (printResult = this._forEachLevel(this.hooks.printElements, type, (h)=>h.call(printedElements, context)))) {
                    let result = printedElements.map((e)=>e.content).filter(Boolean);
                    result.length > 0 && (printResult = result.join('\n'));
                }
            }
        }
        return this._forEachLevelWaterfall(this.hooks.result, type, printResult, (h, r)=>h.call(r, context));
    }
}
class AsyncTask {
    #isRunning = !1;
    #params = [];
    #callbacks = [];
    #task;
    constructor(task){
        this.#task = task;
    }
    #exec_internal() {
        let params = this.#params, callbacks = this.#callbacks;
        this.#params = [], this.#callbacks = [], this.#task(params, (results)=>{
            this.#isRunning = !1, this.#params.length && (this.#isRunning = !0, queueMicrotask(()=>this.#exec_internal()));
            for(let i = 0; i < results.length; i++){
                let [err, result] = results[i];
                (0, callbacks[i])(err, result);
            }
        });
    }
    exec(param, callback) {
        this.#isRunning || (queueMicrotask(()=>this.#exec_internal()), this.#isRunning = !0), this.#params.push(param), this.#callbacks.push(callback);
    }
}
function createReadonlyMap(obj) {
    return {
        ...obj,
        *values () {
            for (let key of this.keys())yield this.get(key);
        },
        *entries () {
            for (let key of this.keys())yield [
                key,
                this.get(key)
            ];
        },
        forEach (callback, thisArg) {
            for (let [key, value] of this)callback.call(thisArg, value, key, this);
        },
        [Symbol.iterator] () {
            return this.entries();
        }
    };
}
class MergeCaller {
    callArgs = [];
    callFn;
    constructor(fn){
        this.callFn = fn;
    }
    finalCall = ()=>{
        let args = this.callArgs;
        this.callArgs = [], this.callFn(args);
    };
    pendingData() {
        return this.callArgs;
    }
    push(...data) {
        0 === this.callArgs.length && queueMicrotask(this.finalCall);
        for(let i = 0; i < data.length; i++)this.callArgs.push(data[i]);
    }
}
function createFakeCompilationDependencies(getDeps, addDeps) {
    let addDepsCaller = new MergeCaller(addDeps), deletedDeps = new Set(), hasDep = (dep)=>!deletedDeps.has(dep) && (addDepsCaller.pendingData().includes(dep) || getDeps().includes(dep)), getAllDeps = ()=>{
        let deps = new Set();
        for (let dep of getDeps())deps.add(dep);
        for (let dep of addDepsCaller.pendingData())deps.add(dep);
        for (let deleted of deletedDeps)deps.delete(deleted);
        return deps;
    };
    return {
        *[Symbol.iterator] () {
            for (let dep of getAllDeps())yield dep;
        },
        has: hasDep,
        add: (dep)=>{
            deletedDeps.delete(dep), addDepsCaller.push(dep);
        },
        addAll: (deps)=>{
            for (let dep of deps)deletedDeps.delete(dep), addDepsCaller.push(dep);
        },
        delete: (dep)=>{
            let hadDep = hasDep(dep);
            return hadDep && deletedDeps.add(dep), hadDep;
        },
        keys: ()=>getAllDeps().keys(),
        values: ()=>getAllDeps().values(),
        entries: ()=>getAllDeps().entries(),
        get size () {
            return getAllDeps().size;
        }
    };
}
let index_js_namespaceObject = __rspack_createRequire_require("../compiled/webpack-sources/index.js");
class SourceAdapter {
    static fromBinding(source) {
        return source.map ? new index_js_namespaceObject.SourceMapSource(source.source, 'inmemory://from rust', source.map) : new index_js_namespaceObject.RawSource(source.source);
    }
    static toBinding(source) {
        let content = source.source();
        if (Buffer.isBuffer(content)) return {
            source: content,
            map: void 0
        };
        let map = source.map?.({
            columns: !0
        });
        return {
            source: content,
            map: map ? JSON.stringify(map) : void 0
        };
    }
}
Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'files', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this._files);
    }
}), Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'runtime', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this._runtime);
    }
}), Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'auxiliaryFiles', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this._auxiliaryFiles);
    }
}), Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'groupsIterable', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this._groupsIterable);
    }
}), Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'getChunkMaps', {
    enumerable: !0,
    configurable: !0,
    value (realHash) {
        let chunkHashMap = {}, chunkContentHashMap = {}, chunkNameMap = {};
        for (let chunk of this.getAllAsyncChunks()){
            let id = chunk.id;
            if (void 0 === id) continue;
            let chunkHash = realHash ? chunk.hash : chunk.renderedHash;
            for (let key of (chunkHash && (chunkHashMap[id] = chunkHash), Object.keys(chunk.contentHash)))chunkContentHashMap[key] || (chunkContentHashMap[key] = {}), chunkContentHashMap[key][id] = chunk.contentHash[key];
            chunk.name && (chunkNameMap[id] = chunk.name);
        }
        return {
            hash: chunkHashMap,
            contentHash: chunkContentHashMap,
            name: chunkNameMap
        };
    }
}), Object.defineProperty(binding_namespaceObject.Chunk.prototype, node_util.inspect.custom, {
    enumerable: !0,
    configurable: !0,
    value () {
        return {
            ...this
        };
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, 'entries', {
    enumerable: !0,
    configurable: !0,
    value () {
        let chunks = this._values(), index = 0;
        return {
            [Symbol.iterator] () {
                return this;
            },
            next () {
                if (index < chunks.length) {
                    let chunk = chunks[index++];
                    return {
                        value: [
                            chunk,
                            chunk
                        ],
                        done: !1
                    };
                }
                return {
                    value: void 0,
                    done: !0
                };
            }
        };
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, 'values', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this._values().values();
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, Symbol.iterator, {
    enumerable: !0,
    configurable: !0,
    value () {
        return this.values();
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, 'keys', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this.values();
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, 'forEach', {
    enumerable: !0,
    configurable: !0,
    value (callbackfn, thisArg) {
        for (let chunk of this._values())callbackfn.call(thisArg, chunk, chunk, this);
    }
}), Object.defineProperty(binding_namespaceObject.Chunks.prototype, 'has', {
    enumerable: !0,
    configurable: !0,
    value (value) {
        return this._has(value);
    }
}), Object.defineProperty(binding_namespaceObject.ChunkGraph.prototype, 'getOrderedChunkModulesIterable', {
    enumerable: !0,
    configurable: !0,
    value (chunk, compareFn) {
        let modules = this.getChunkModules(chunk);
        return modules.sort(compareFn), modules;
    }
}), Object.defineProperty(binding_namespaceObject.ChunkGraph.prototype, 'getModuleChunksIterable', {
    enumerable: !0,
    configurable: !0,
    value (module) {
        return this.getModuleChunks(module);
    }
}), Object.defineProperty(binding_namespaceObject.ChunkGraph.prototype, 'getOrderedChunkModulesIterable', {
    enumerable: !0,
    configurable: !0,
    value (chunk, compareFn) {
        let modules = this.getChunkModules(chunk);
        return modules.sort(compareFn), modules;
    }
}), Object.defineProperty(binding_namespaceObject.ChunkGraph.prototype, 'getModuleHash', {
    enumerable: !0,
    configurable: !0,
    value (module, runtime) {
        return this._getModuleHash(module, toJsRuntimeSpec(runtime));
    }
}), Object.defineProperty(binding_default().Sources.prototype, 'get', {
    enumerable: !0,
    configurable: !0,
    value (sourceType) {
        let originalSource = this._get(sourceType);
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
});
let $proxy = Symbol.for('proxy');
function createDiagnosticArray(adm) {
    if ($proxy in adm) return adm[$proxy];
    let array = [];
    array[node_util.inspect.custom] = ()=>adm.values();
    let splice = function(index, deleteCount, ...newItems) {
        switch(arguments.length){
            case 0:
                return [];
            case 1:
                return adm.spliceWithArray(index, adm.length);
            case 2:
                return adm.spliceWithArray(index, deleteCount);
        }
        return adm.spliceWithArray(index, deleteCount, newItems);
    }, arrayExtensions = {
        [Symbol.iterator]: ()=>adm.values().values(),
        splice,
        push: (...newItems)=>(adm.spliceWithArray(adm.length, 0, newItems), adm.length),
        pop: ()=>splice(Math.max(adm.length - 1, 0), 1)[0],
        shift: ()=>splice(0, 1)[0],
        unshift: (...newItems)=>(adm.spliceWithArray(0, 0, newItems), adm.length),
        reverse: ()=>adm.values().reverse(),
        sort (compareFn) {
            let copy = adm.values();
            return copy.sort(compareFn), adm.spliceWithArray(0, adm.length, copy), this;
        },
        at: (index)=>adm.get(index),
        concat: (...items)=>adm.values().concat(...items),
        flat: ()=>adm.values(),
        every: (predicate, thisArg)=>adm.values().every(predicate, thisArg),
        filter: (predicate, thisArg)=>adm.values().filter(predicate, thisArg),
        find: (predicate, thisArg)=>adm.values().find(predicate, thisArg),
        findIndex: (predicate, thisArg)=>adm.values().findIndex(predicate, thisArg),
        flatMap: (callbackfn, thisArg)=>adm.values().flatMap(callbackfn, thisArg),
        forEach (callbackfn, thisArg) {
            adm.values().forEach(callbackfn, thisArg);
        },
        map: (callbackfn, thisArg)=>adm.values().map(callbackfn, thisArg),
        slice: (start, end)=>adm.values().slice(start, end),
        reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
        reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
    }, proxy = new Proxy(array, {
        get: (target, name)=>'length' === name ? adm.length : 'string' != typeof name || Number.isNaN(Number.parseInt(name, 10)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name, 10)),
        set (target, name, value) {
            if ('length' === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
            return 'symbol' == typeof name || Number.isNaN(Number.parseInt(name, 10)) ? target[name] = value : adm.set(Number.parseInt(name, 10), value), !0;
        }
    });
    return adm[$proxy] = proxy, proxy;
}
function _to_property_key(arg) {
    var key = function(input, hint) {
        if ("object" !== _type_of(input) || null === input) return input;
        var prim = input[Symbol.toPrimitive];
        if (void 0 !== prim) {
            var res = prim.call(input, hint || "default");
            if ("object" !== _type_of(res)) return res;
            throw TypeError("@@toPrimitive must return a primitive value.");
        }
        return ("string" === hint ? String : Number)(input);
    }(arg, "string");
    return "symbol" === _type_of(key) ? key : String(key);
}
function _type_of(obj) {
    return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
}
function normalizePathData(data = {}) {
    let pathData = {
        filename: data.filename,
        hash: data.hash,
        contentHash: data.contentHash,
        runtime: data.runtime,
        url: data.url
    };
    return void 0 !== data.id && (pathData.id = String(data.id)), data.chunk && (pathData.chunk = {
        id: void 0 !== data.chunk.id ? String(data.chunk.id) : void 0,
        name: data.chunk.name,
        hash: data.chunk.hash
    }), pathData;
}
let checkCompilation = (compilation)=>{
    if (!(compilation instanceof Compilation)) throw TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
};
_computedKey = _to_property_key(binding_default().COMPILATION_HOOKS_MAP_SYMBOL);
class Compilation {
    #inner;
    #shutdown;
    #errors;
    #warnings;
    #chunks;
    hooks;
    name;
    startTime;
    endTime;
    compiler;
    resolverFactory;
    inputFileSystem;
    options;
    outputOptions;
    logging;
    childrenCounters;
    children;
    chunkGraph;
    moduleGraph;
    fileSystemInfo = {
        createSnapshot: ()=>null
    };
    needAdditionalPass;
    #addIncludeDispatcher;
    #addEntryDispatcher;
    [_computedKey];
    constructor(compiler, inner){
        var name, stage, getArgs;
        let errorMessage, getOptions;
        this.#inner = inner, this.#shutdown = !1;
        let processAssetsHook = new AsyncSeriesHook([
            'assets'
        ]);
        this.hooks = {
            processAssets: processAssetsHook,
            afterProcessAssets: new SyncHook([
                'assets'
            ]),
            additionalAssets: (name = 'additionalAssets', stage = Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, getArgs = ()=>[], errorMessage = (reason)=>`Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`, getOptions = (options)=>{
                let isString = 'string' == typeof options;
                if (!isString && options.stage) throw Error(errorMessage("it's using the 'stage' option"));
                return {
                    ...isString ? {
                        name: options
                    } : options,
                    stage: stage
                };
            }, Object.freeze({
                name,
                intercept () {
                    throw Error(errorMessage("it's using 'intercept'"));
                },
                tap: (options, fn)=>{
                    processAssetsHook.tap(getOptions(options), ()=>fn(...getArgs()));
                },
                tapAsync: (options, fn)=>{
                    processAssetsHook.tapAsync(getOptions(options), (_assets, callback)=>fn(...getArgs(), callback));
                },
                tapPromise: (options, fn)=>{
                    processAssetsHook.tapPromise(getOptions(options), ()=>fn(...getArgs()));
                },
                _fakeHook: !0
            })),
            childCompiler: new SyncHook([
                'childCompiler',
                'compilerName',
                'compilerIndex'
            ]),
            log: new SyncBailHook([
                'origin',
                'logEntry'
            ]),
            optimizeModules: new SyncBailHook([
                'modules'
            ]),
            afterOptimizeModules: new SyncBailHook([
                'modules'
            ]),
            optimizeTree: new AsyncSeriesHook([
                'chunks',
                'modules'
            ]),
            optimizeChunkModules: new AsyncSeriesBailHook([
                'chunks',
                'modules'
            ]),
            beforeModuleIds: new SyncHook([
                'modules'
            ]),
            finishModules: new AsyncSeriesHook([
                'modules'
            ]),
            chunkHash: new SyncHook([
                'chunk',
                'hash'
            ]),
            chunkAsset: new SyncHook([
                'chunk',
                'filename'
            ]),
            processWarnings: new SyncWaterfallHook([
                'warnings'
            ]),
            succeedModule: new SyncHook([
                'module'
            ]),
            stillValidModule: new SyncHook([
                'module'
            ]),
            statsPreset: new HookMap(()=>new SyncHook([
                    'options',
                    'context'
                ])),
            statsNormalize: new SyncHook([
                'options',
                'context'
            ]),
            statsFactory: new SyncHook([
                'statsFactory',
                'options'
            ]),
            statsPrinter: new SyncHook([
                'statsPrinter',
                'options'
            ]),
            buildModule: new SyncHook([
                'module'
            ]),
            executeModule: new SyncHook([
                'options',
                'context'
            ]),
            additionalTreeRuntimeRequirements: new SyncHook([
                'chunk',
                'runtimeRequirements'
            ]),
            runtimeRequirementInTree: new HookMap(()=>new SyncBailHook([
                    'chunk',
                    'runtimeRequirements'
                ])),
            runtimeModule: new SyncHook([
                'module',
                'chunk'
            ]),
            seal: new SyncHook([]),
            afterSeal: new AsyncSeriesHook([]),
            needAdditionalPass: new SyncBailHook([])
        };
        let availableHooks = Object.keys(this.hooks);
        this.hooks = new Proxy(this.hooks, {
            get (target, prop, receiver) {
                let value = Reflect.get(target, prop, receiver);
                if (void 0 === value && 'string' == typeof prop) {
                    let hooksList = availableHooks.join(', ');
                    throw Error(`Compilation.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compilation hooks: ${hooksList}`);
                }
                return value;
            }
        }), this.compiler = compiler, this.resolverFactory = compiler.resolverFactory, this.inputFileSystem = compiler.inputFileSystem, this.options = compiler.options, this.outputOptions = compiler.options.output, this.logging = new Map(), this.childrenCounters = {}, this.children = [], this.needAdditionalPass = !1, this.chunkGraph = inner.chunkGraph, this.moduleGraph = ModuleGraph.__from_binding(inner.moduleGraph), this.#addIncludeDispatcher = new AddEntryItemDispatcher(inner.addInclude.bind(inner)), this.#addEntryDispatcher = new AddEntryItemDispatcher(inner.addEntry.bind(inner)), this[binding_default().COMPILATION_HOOKS_MAP_SYMBOL] = new WeakMap();
    }
    get hash() {
        return this.#inner.hash;
    }
    get fullHash() {
        return this.#inner.hash;
    }
    get assets() {
        return this.#createCachedAssets();
    }
    get entrypoints() {
        return new Map(this.#inner.entrypoints.map((entrypoint)=>[
                entrypoint.name,
                entrypoint
            ]));
    }
    get chunkGroups() {
        return this.#inner.chunkGroups;
    }
    get namedChunkGroups() {
        return createReadonlyMap({
            keys: ()=>this.#inner.getNamedChunkGroupKeys()[Symbol.iterator](),
            get: (property)=>{
                if ('string' == typeof property) return this.#inner.getNamedChunkGroup(property);
            }
        });
    }
    get modules() {
        return new Set(this.#inner.modules);
    }
    get builtModules() {
        return new Set(this.#inner.builtModules);
    }
    get chunks() {
        return this.#chunks || (this.#chunks = this.#inner.chunks), this.#chunks;
    }
    get namedChunks() {
        return createReadonlyMap({
            keys: ()=>this.#inner.getNamedChunkKeys()[Symbol.iterator](),
            get: (property)=>{
                if ('string' == typeof property) return this.#inner.getNamedChunk(property);
            }
        });
    }
    get entries() {
        return new Entries(this.#inner.entries);
    }
    get codeGenerationResults() {
        return this.#inner.codeGenerationResults;
    }
    #createCachedAssets() {
        return new Proxy({}, {
            get: (_, property)=>{
                if ('string' == typeof property) return this.__internal__getAssetSource(property);
            },
            set: (_, p, newValue)=>'string' == typeof p && (this.__internal__setAssetSource(p, newValue), !0),
            deleteProperty: (_, p)=>'string' == typeof p && (this.__internal__deleteAssetSource(p), !0),
            has: (_, property)=>'string' == typeof property && this.__internal__hasAsset(property),
            ownKeys: (_)=>this.__internal__getAssetFilenames(),
            getOwnPropertyDescriptor: ()=>({
                    enumerable: !0,
                    configurable: !0
                })
        });
    }
    getCache(name) {
        return this.compiler.getCache(name);
    }
    createStatsOptions(statsValue, context = {}) {
        let optionsOrPreset = statsValue;
        if (('boolean' == typeof optionsOrPreset || 'string' == typeof optionsOrPreset) && (optionsOrPreset = {
            preset: optionsOrPreset
        }), 'object' == typeof optionsOrPreset && null !== optionsOrPreset) {
            let options = {};
            for(let key in optionsOrPreset)options[key] = optionsOrPreset[key];
            return void 0 !== options.preset && this.hooks.statsPreset.for(options.preset).call(options, context), this.hooks.statsNormalize.call(options, context), options;
        }
        let options = {};
        return this.hooks.statsNormalize.call(options, context), options;
    }
    createStatsFactory(options) {
        let statsFactory = new StatsFactory();
        return this.hooks.statsFactory.call(statsFactory, options), statsFactory;
    }
    createStatsPrinter(options) {
        let statsPrinter = new StatsPrinter();
        return this.hooks.statsPrinter.call(statsPrinter, options), statsPrinter;
    }
    updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
        let compatNewSourceOrFunction;
        compatNewSourceOrFunction = 'function' == typeof newSourceOrFunction ? function(source) {
            return SourceAdapter.toBinding(newSourceOrFunction(SourceAdapter.fromBinding(source)));
        } : SourceAdapter.toBinding(newSourceOrFunction), this.#inner.updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction);
    }
    emitAsset(filename, source, assetInfo) {
        this.#inner.emitAsset(filename, SourceAdapter.toBinding(source), assetInfo);
    }
    deleteAsset(filename) {
        this.#inner.deleteAsset(filename);
    }
    renameAsset(filename, newFilename) {
        this.#inner.renameAsset(filename, newFilename);
    }
    getAssets() {
        return this.#inner.getAssets().map((asset)=>Object.defineProperties(asset, {
                info: {
                    value: asset.info
                },
                source: {
                    get: ()=>this.__internal__getAssetSource(asset.name)
                }
            }));
    }
    getAsset(name) {
        let asset = this.#inner.getAsset(name);
        if (asset) return Object.defineProperties(asset, {
            info: {
                value: asset.info
            },
            source: {
                get: ()=>this.__internal__getAssetSource(asset.name)
            }
        });
    }
    __internal__pushRspackDiagnostic(diagnostic) {
        this.#inner.pushDiagnostic(diagnostic);
    }
    __internal__pushDiagnostic(diagnostic) {
        this.#inner.pushNativeDiagnostic(diagnostic);
    }
    __internal__pushDiagnostics(diagnostics) {
        this.#inner.pushNativeDiagnostics(diagnostics);
    }
    get errors() {
        return this.#errors || (this.#errors = createDiagnosticArray(this.#inner.errors)), this.#errors;
    }
    set errors(errors) {
        this.#errors || (this.#errors = createDiagnosticArray(this.#inner.errors)), this.#errors.splice(0, this.#errors.length, ...errors);
    }
    get warnings() {
        return this.#warnings || (this.#warnings = createDiagnosticArray(this.#inner.warnings)), this.#warnings;
    }
    set warnings(warnings) {
        this.#warnings || (this.#warnings = createDiagnosticArray(this.#inner.warnings)), this.#warnings.splice(0, this.#warnings.length, ...warnings);
    }
    getPath(filename, data = {}) {
        let pathData = normalizePathData(data);
        return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getPath(filename, pathData);
    }
    getPathWithInfo(filename, data = {}) {
        let pathData = normalizePathData(data);
        return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getPathWithInfo(filename, pathData);
    }
    getAssetPath(filename, data = {}) {
        let pathData = normalizePathData(data);
        return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getAssetPath(filename, pathData);
    }
    getAssetPathWithInfo(filename, data = {}) {
        let pathData = normalizePathData(data);
        return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getAssetPathWithInfo(filename, pathData);
    }
    getLogger(name) {
        let logEntries;
        if (!name) throw TypeError('Compilation.getLogger(name) called without a name');
        let logName = name;
        return new Logger((type, args)=>{
            if ('function' == typeof logName && !(logName = logName())) throw TypeError('Compilation.getLogger(name) called with a function not returning a name');
            let logEntry = {
                time: Date.now(),
                type,
                args,
                get trace () {
                    switch(type){
                        case LogType.warn:
                        case LogType.error:
                        case LogType.trace:
                            return cutOffLoaderExecution(Error('Trace').stack).split('\n').slice(3);
                        default:
                            return;
                    }
                }
            };
            void 0 === this.hooks.log.call(logName, logEntry) && (logEntry.type === LogType.profileEnd && 'function' == typeof console.profileEnd && console.profileEnd(`[${logName}] ${logEntry.args[0]}`), void 0 === logEntries && void 0 === (logEntries = this.logging.get(logName)) && (logEntries = [], this.logging.set(logName, logEntries)), logEntries.push(logEntry), logEntry.type === LogType.profile && 'function' == typeof console.profile && console.profile(`[${logName}] ${logEntry.args[0]}`));
        }, (childName)=>{
            let normalizedChildName = childName;
            return 'function' == typeof logName ? 'function' == typeof normalizedChildName ? this.getLogger(()=>{
                if ('function' == typeof logName && !(logName = logName())) throw TypeError('Compilation.getLogger(name) called with a function not returning a name');
                if ('function' == typeof normalizedChildName && !(normalizedChildName = normalizedChildName())) throw TypeError('Logger.getChildLogger(name) called with a function not returning a name');
                return `${logName}/${normalizedChildName}`;
            }) : this.getLogger(()=>{
                if ('function' == typeof logName && !(logName = logName())) throw TypeError('Compilation.getLogger(name) called with a function not returning a name');
                return `${logName}/${normalizedChildName}`;
            }) : 'function' == typeof normalizedChildName ? this.getLogger(()=>{
                if ('function' == typeof normalizedChildName && !(normalizedChildName = normalizedChildName())) throw TypeError('Logger.getChildLogger(name) called with a function not returning a name');
                return `${logName}/${normalizedChildName}`;
            }) : this.getLogger(`${logName}/${normalizedChildName}`);
        });
    }
    fileDependencies = createFakeCompilationDependencies(()=>this.#inner.dependencies().fileDependencies, (d)=>this.#inner.addFileDependencies(d));
    get __internal__addedFileDependencies() {
        return this.#inner.dependencies().addedFileDependencies;
    }
    get __internal__removedFileDependencies() {
        return this.#inner.dependencies().removedFileDependencies;
    }
    get __internal__addedContextDependencies() {
        return this.#inner.dependencies().addedContextDependencies;
    }
    get __internal__removedContextDependencies() {
        return this.#inner.dependencies().removedContextDependencies;
    }
    get __internal__addedMissingDependencies() {
        return this.#inner.dependencies().addedMissingDependencies;
    }
    get __internal__removedMissingDependencies() {
        return this.#inner.dependencies().removedMissingDependencies;
    }
    contextDependencies = createFakeCompilationDependencies(()=>this.#inner.dependencies().contextDependencies, (d)=>this.#inner.addContextDependencies(d));
    missingDependencies = createFakeCompilationDependencies(()=>this.#inner.dependencies().missingDependencies, (d)=>this.#inner.addMissingDependencies(d));
    buildDependencies = createFakeCompilationDependencies(()=>this.#inner.dependencies().buildDependencies, (d)=>this.#inner.addBuildDependencies(d));
    getStats() {
        return new Stats(this);
    }
    createChildCompiler(name, outputOptions, plugins) {
        let idx = this.childrenCounters[name] || 0;
        return this.childrenCounters[name] = idx + 1, this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
    }
    #rebuildModuleTask = new AsyncTask((moduleIdentifiers, doneWork)=>{
        this.#inner.rebuildModule(moduleIdentifiers, (err, modules)=>{
            err ? doneWork(Array(moduleIdentifiers.length).fill([
                err,
                null
            ])) : doneWork(modules.map((module)=>[
                    null,
                    module
                ]));
        });
    });
    rebuildModule(module, f) {
        this.#rebuildModuleTask.exec(module.identifier(), f);
    }
    addRuntimeModule(chunk, runtimeModule) {
        runtimeModule.attach(this, chunk, this.chunkGraph), this.#inner.addRuntimeModule(chunk, RuntimeModule.__to_binding(runtimeModule));
    }
    addInclude(context, dependency, options, callback) {
        this.#addIncludeDispatcher.call(context, dependency, options, callback);
    }
    addEntry(context, dependency, optionsOrName, callback) {
        this.#addEntryDispatcher.call(context, dependency, 'object' == typeof optionsOrName ? optionsOrName : {
            name: optionsOrName
        }, callback);
    }
    getWarnings() {
        return this.hooks.processWarnings.call(this.#inner.getWarnings());
    }
    getErrors() {
        return this.#inner.getErrors();
    }
    __internal__getAssetSource(filename) {
        let rawSource = this.#inner.getAssetSource(filename);
        if (rawSource) return SourceAdapter.fromBinding(rawSource);
    }
    __internal__setAssetSource(filename, source) {
        this.#inner.setAssetSource(filename, SourceAdapter.toBinding(source));
    }
    __internal__deleteAssetSource(filename) {
        this.#inner.deleteAssetSource(filename);
    }
    __internal__getAssetFilenames() {
        return this.#inner.getAssetFilenames();
    }
    __internal__hasAsset(name) {
        return this.#inner.hasAsset(name);
    }
    __internal_getInner() {
        return this.#inner;
    }
    get __internal__shutdown() {
        return this.#shutdown;
    }
    set __internal__shutdown(shutdown) {
        this.#shutdown = shutdown;
    }
    seal() {}
    unseal() {}
    static PROCESS_ASSETS_STAGE_ADDITIONAL = -2000;
    static PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000;
    static PROCESS_ASSETS_STAGE_DERIVED = -200;
    static PROCESS_ASSETS_STAGE_ADDITIONS = -100;
    static PROCESS_ASSETS_STAGE_NONE = 0;
    static PROCESS_ASSETS_STAGE_OPTIMIZE = 100;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400;
    static PROCESS_ASSETS_STAGE_DEV_TOOLING = 500;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700;
    static PROCESS_ASSETS_STAGE_SUMMARIZE = 1000;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500;
    static PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000;
    static PROCESS_ASSETS_STAGE_ANALYSE = 4000;
    static PROCESS_ASSETS_STAGE_REPORT = 5000;
}
class AddEntryItemDispatcher {
    #inner;
    #running;
    #args = [];
    #cbs = [];
    #execute = ()=>{
        if (this.#running) return;
        let args = this.#args;
        this.#args = [];
        let cbs = this.#cbs;
        this.#cbs = [], this.#inner(args, (wholeErr, results)=>{
            if (0 !== this.#args.length && queueMicrotask(this.#execute.bind(this)), wholeErr) {
                let webpackError = new lib_WebpackError(wholeErr.message);
                for (let cb of cbs)cb(webpackError);
                return;
            }
            for(let i = 0; i < results.length; i++){
                let [errMsg, module] = results[i];
                (0, cbs[i])(errMsg ? new lib_WebpackError(errMsg) : null, module);
            }
        });
    };
    constructor(binding){
        this.#inner = binding, this.#running = !1;
    }
    call(context, dependency, options, callback) {
        0 === this.#args.length && queueMicrotask(this.#execute.bind(this)), this.#args.push([
            context,
            dependency,
            options
        ]), this.#cbs.push(callback);
    }
}
class EntryData {
    dependencies;
    includeDependencies;
    options;
    static __from_binding(binding) {
        return new EntryData(binding);
    }
    constructor(binding){
        this.dependencies = binding.dependencies, this.includeDependencies = binding.includeDependencies, this.options = binding.options;
    }
}
_computedKey1 = _to_property_key(Symbol.iterator), _computedKey2 = _to_property_key(Symbol.toStringTag);
class Entries {
    #data;
    constructor(data){
        this.#data = data;
    }
    clear() {
        this.#data.clear();
    }
    forEach(callback, thisArg) {
        for (let [key, binding] of this){
            let value = EntryData.__from_binding(binding);
            callback.call(thisArg, value, key, this);
        }
    }
    get size() {
        return this.#data.size;
    }
    *entries() {
        for (let key of this.keys())yield [
            key,
            this.get(key)
        ];
    }
    values() {
        return this.#data.values().map(EntryData.__from_binding)[Symbol.iterator]();
    }
    [_computedKey1]() {
        return this.entries();
    }
    [_computedKey2] = 'Map';
    has(key) {
        return this.#data.has(key);
    }
    set(key, value) {
        return this.#data.set(key, value), this;
    }
    delete(key) {
        return this.#data.delete(key);
    }
    getOrInsert(key, defaultValue) {
        return this.has(key) || this.set(key, defaultValue), this.get(key);
    }
    getOrInsertComputed(key, callback) {
        return this.has(key) || this.set(key, callback(key)), this.get(key);
    }
    get(key) {
        let binding = this.#data.get(key);
        return binding ? EntryData.__from_binding(binding) : void 0;
    }
    keys() {
        return this.#data.keys()[Symbol.iterator]();
    }
}
let HOOKS_CAN_NOT_INHERENT_FROM_PARENT = [
    'make',
    'compile',
    'emit',
    'afterEmit',
    'invalid',
    'done',
    'thisCompilation'
];
function canInherentFromParent(affectedHooks) {
    return void 0 !== affectedHooks && !HOOKS_CAN_NOT_INHERENT_FROM_PARENT.includes(affectedHooks);
}
class RspackBuiltinPlugin {
    affectedHooks;
    apply(compiler) {
        let raw = this.raw(compiler);
        raw && (raw.canInherentFromParent = canInherentFromParent(this.affectedHooks), compiler.__internal__registerBuiltinPlugin(raw));
    }
}
function createBuiltinPlugin(name, options) {
    return {
        name: name,
        options: options ?? !1
    };
}
function base_create(name, resolve, affectedHooks) {
    class Plugin extends RspackBuiltinPlugin {
        name = name;
        _args;
        affectedHooks = affectedHooks;
        constructor(...args){
            super(), this._args = args;
        }
        raw(compiler) {
            return createBuiltinPlugin(name, resolve.apply(compiler, this._args));
        }
    }
    return Object.defineProperty(Plugin, 'name', {
        value: name
    }), Plugin;
}
let INTERNAL_PLUGIN_NAMES = Object.keys(binding_default().BuiltinPluginName), APIPlugin = base_create(binding_namespaceObject.BuiltinPluginName.APIPlugin, ()=>{}), ArrayPushCallbackChunkFormatPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ArrayPushCallbackChunkFormatPlugin, ()=>{}), AssetModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.AssetModulesPlugin, ()=>{}, 'compilation'), AsyncWebAssemblyModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.AsyncWebAssemblyModulesPlugin, ()=>{}, 'compilation'), BannerPlugin = base_create(binding_namespaceObject.BuiltinPluginName.BannerPlugin, (args)=>'string' == typeof args || 'function' == typeof args ? {
        banner: args
    } : {
        banner: args.banner,
        entryOnly: args.entryOnly,
        footer: args.footer,
        raw: args.raw,
        test: args.test,
        stage: args.stage,
        include: args.include,
        exclude: args.exclude
    }), BundlerInfoRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.BundlerInfoRspackPlugin, (options)=>({
        version: options.version || 'unknown',
        bundler: options.bundler || 'rspack',
        force: options.force ?? !1
    })), CaseSensitivePlugin = base_create(binding_namespaceObject.BuiltinPluginName.CaseSensitivePlugin, ()=>{}, 'compilation'), ChunkPrefetchPreloadPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ChunkPrefetchPreloadPlugin, ()=>{});
class CircularModulesInfoPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.CircularModulesInfoPlugin;
    raw(_compiler) {
        return createBuiltinPlugin(this.name, void 0);
    }
}
class CircularCheckRspackPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.CircularCheckRspackPlugin;
    _options;
    constructor(options = {}){
        super(), this._options = options;
    }
    raw(compiler) {
        let { failOnError, exclude, include, onDetected } = this._options;
        return createBuiltinPlugin(this.name, {
            failOnError,
            exclude,
            include,
            onDetected: onDetected ? (module, paths)=>{
                onDetected({
                    module,
                    paths,
                    compilation: compiler.__internal__get_compilation()
                });
            } : void 0
        });
    }
}
class CircularDependencyRspackPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.CircularDependencyRspackPlugin;
    _options;
    constructor(options){
        super(), this._options = options;
    }
    raw(compiler) {
        let { failOnError, exclude, ignoredConnections } = this._options, rawOptions = {
            failOnError,
            exclude,
            ignoredConnections,
            onDetected: this._options.onDetected ? (entripoint, modules)=>{
                let compilation = compiler.__internal__get_compilation();
                this._options.onDetected(entripoint, modules, compilation);
            } : void 0,
            onIgnored: this._options.onIgnored ? (entripoint, modules)=>{
                let compilation = compiler.__internal__get_compilation();
                this._options.onIgnored(entripoint, modules, compilation);
            } : void 0,
            onStart: this._options.onStart ? ()=>{
                let compilation = compiler.__internal__get_compilation();
                this._options.onStart(compilation);
            } : void 0,
            onEnd: this._options.onEnd ? ()=>{
                let compilation = compiler.__internal__get_compilation();
                this._options.onEnd(compilation);
            } : void 0
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
let CommonJsChunkFormatPlugin = base_create(binding_namespaceObject.BuiltinPluginName.CommonJsChunkFormatPlugin, ()=>{}), ContextReplacementPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ContextReplacementPlugin, (resourceRegExp, newContentResource, newContentRecursive, newContentRegExp)=>{
    let rawOptions = {
        resourceRegExp
    };
    return 'function' == typeof newContentResource || ('string' == typeof newContentResource && 'object' == typeof newContentRecursive ? (rawOptions.newContentResource = newContentResource, rawOptions.newContentCreateContextMap = newContentRecursive) : 'string' == typeof newContentResource && 'function' == typeof newContentRecursive ? rawOptions.newContentResource = newContentResource : ('string' != typeof newContentResource && (newContentRegExp = newContentRecursive, newContentRecursive = newContentResource, newContentResource = void 0), 'boolean' != typeof newContentRecursive && (newContentRegExp = newContentRecursive, newContentRecursive = void 0), rawOptions.newContentResource = newContentResource, rawOptions.newContentRecursive = newContentRecursive, rawOptions.newContentRegExp = newContentRegExp)), rawOptions;
}), CopyRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.CopyRspackPlugin, (copy)=>{
    let ret = {
        patterns: []
    };
    return ret.patterns = (copy.patterns || []).map((pattern)=>{
        'string' == typeof pattern && (pattern = {
            from: pattern
        }), pattern.force ??= !1, pattern.noErrorOnMissing ??= !1, pattern.priority ??= 0, pattern.globOptions ??= {}, pattern.copyPermissions ??= !1;
        let originalTransform = pattern.transform;
        return originalTransform && ('object' == typeof originalTransform ? pattern.transform = (input, absoluteFilename)=>Promise.resolve(originalTransform.transformer(input, absoluteFilename)) : pattern.transform = (input, absoluteFilename)=>Promise.resolve(originalTransform(input, absoluteFilename))), pattern;
    }), ret;
}), CssChunkingPlugin = base_create(binding_default().BuiltinPluginName.CssChunkingPlugin, function(options = {}) {
    if (options.nextjs) return {
        strict: options.strict,
        minSize: options.minSize,
        maxSize: options.maxSize,
        exclude: /^pages\//
    };
    let { splitChunks } = this.options.optimization;
    if (splitChunks) {
        let cssMiniExtractIndex = splitChunks.defaultSizeTypes.indexOf('css/mini-extract');
        cssMiniExtractIndex && splitChunks.defaultSizeTypes.splice(cssMiniExtractIndex, 1);
        let cssIndex = splitChunks.defaultSizeTypes.indexOf('css');
        cssIndex && splitChunks.defaultSizeTypes.splice(cssIndex, 1);
    }
    return options;
}), CssHttpExternalsRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.CssHttpExternalsRspackPlugin, ()=>void 0), CssModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.CssModulesPlugin, ()=>{}, 'compilation'), DEFAULT_FILENAME = '[name].css', LOADER_PATH = join(import.meta.dirname, 'cssExtractLoader.js');
class CssExtractRspackPlugin {
    static pluginName = 'css-extract-rspack-plugin';
    static loader = LOADER_PATH;
    options;
    constructor(options){
        this.options = options || {};
    }
    apply(compiler) {
        let { splitChunks } = compiler.options.optimization;
        splitChunks && splitChunks.defaultSizeTypes.includes('...') && splitChunks.defaultSizeTypes.push('css/mini-extract'), compiler.options.output.pathinfo && void 0 === this.options.pathinfo && (this.options.pathinfo = !0), compiler.__internal__registerBuiltinPlugin({
            name: binding_namespaceObject.BuiltinPluginName.CssExtractRspackPlugin,
            options: this.normalizeOptions(this.options)
        });
    }
    normalizeOptions(options) {
        let chunkFilename = options.chunkFilename;
        if (!chunkFilename) {
            let filename = options.filename || DEFAULT_FILENAME;
            if ('function' != typeof filename) {
                let hasName = filename.includes('[name]'), hasId = filename.includes('[id]'), hasChunkHash = filename.includes('[chunkhash]'), hasContentHash = filename.includes('[contenthash]');
                chunkFilename = hasChunkHash || hasContentHash || hasName || hasId ? filename : filename.replace(/(^|\/)([^/]*(?:\?|$))/, '$1[id].$2');
            } else chunkFilename = '[id].css';
        }
        return {
            filename: options.filename || DEFAULT_FILENAME,
            chunkFilename: chunkFilename,
            ignoreOrder: options.ignoreOrder ?? !1,
            runtime: options.runtime ?? !0,
            insert: 'function' == typeof options.insert ? options.insert.toString() : JSON.stringify(options.insert),
            linkType: void 0 === options.linkType ? JSON.stringify('text/css') : !1 === options.linkType ? void 0 : JSON.stringify(options.linkType),
            attributes: options.attributes ? Reflect.ownKeys(options.attributes).map((k)=>[
                    JSON.stringify(k),
                    JSON.stringify(options.attributes[k])
                ]).reduce((obj, [k, v])=>(obj[k] = v, obj), {}) : {},
            pathinfo: options.pathinfo ?? !1,
            enforceRelative: options.enforceRelative ?? !1
        };
    }
}
let DataUriPlugin = base_create(binding_namespaceObject.BuiltinPluginName.DataUriPlugin, ()=>{}, 'compilation'), DefinePlugin = base_create(binding_namespaceObject.BuiltinPluginName.DefinePlugin, function(define) {
    return normalizeValue(define, this.options.output.environment?.bigIntLiteral ?? !1);
}, 'compilation'), normalizeValue = (define, supportsBigIntLiteral)=>{
    let normalizePrimitive = (p)=>void 0 === p ? 'undefined' : Object.is(p, -0) ? '-0' : p instanceof RegExp ? p.toString() : 'function' == typeof p ? `(${p.toString()})` : 'bigint' == typeof p ? supportsBigIntLiteral ? `${p}n` : `BigInt("${p}")` : p, normalizeObject = (define)=>Array.isArray(define) ? define.map(normalizeObject) : define instanceof RegExp ? normalizePrimitive(define) : define && 'object' == typeof define ? Object.fromEntries(Object.keys(define).map((k)=>[
                k,
                normalizeObject(define[k])
            ])) : normalizePrimitive(define);
    return normalizeObject(define);
};
class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.DeterministicChunkIdsPlugin;
    affectedHooks = 'compilation';
    raw() {
        return createBuiltinPlugin(this.name, void 0);
    }
}
class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
    options;
    name = binding_namespaceObject.BuiltinPluginName.DeterministicModuleIdsPlugin;
    affectedHooks = 'compilation';
    constructor(options = {}){
        super(), this.options = options;
    }
    raw() {
        return createBuiltinPlugin(this.name, {
            ...this.options
        });
    }
}
let DllEntryPlugin = base_create(binding_namespaceObject.BuiltinPluginName.DllEntryPlugin, (context, entries, options)=>({
        context,
        entries,
        name: options.name
    })), DllReferenceAgencyPlugin = base_create(binding_namespaceObject.BuiltinPluginName.DllReferenceAgencyPlugin, (options)=>options), lib_EntryOptionPlugin = class EntryOptionPlugin {
    apply(compiler) {
        compiler.hooks.entryOption.tap('EntryOptionPlugin', (context, entry)=>(EntryOptionPlugin.applyEntryOption(compiler, context, entry), !0));
    }
    static applyEntryOption(compiler, context, entry) {
        if ('function' == typeof entry) new DynamicEntryPlugin(context, entry).apply(compiler);
        else for (let name of Object.keys(entry)){
            let desc = entry[name], options = EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
            if (void 0 === desc.import) throw Error('desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called');
            for (let entry of desc.import)new EntryPlugin(context, entry, options).apply(compiler);
        }
    }
    static entryDescriptionToOptions(_compiler, name, desc) {
        return {
            name,
            filename: desc.filename,
            runtime: desc.runtime,
            layer: desc.layer,
            dependOn: desc.dependOn,
            baseUri: desc.baseUri,
            publicPath: desc.publicPath,
            chunkLoading: desc.chunkLoading,
            asyncChunks: desc.asyncChunks,
            library: desc.library
        };
    }
}, EntryPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EntryPlugin, (context, entry, options = '')=>({
        context,
        entry,
        options: getRawEntryOptions('string' == typeof options ? {
            name: options
        } : options)
    }), 'make');
function getRawEntryOptions(entry) {
    return {
        name: entry.name,
        publicPath: entry.publicPath,
        baseUri: entry.baseUri,
        runtime: entry.runtime,
        chunkLoading: entry.chunkLoading,
        wasmLoading: entry.wasmLoading,
        asyncChunks: entry.asyncChunks,
        filename: entry.filename,
        library: entry.library,
        layer: entry.layer ?? void 0,
        dependOn: entry.dependOn
    };
}
EntryPlugin.createDependency = (request)=>new binding_namespaceObject.EntryDependency(request);
class DynamicEntryPlugin extends RspackBuiltinPlugin {
    context;
    entry;
    name = binding_namespaceObject.BuiltinPluginName.DynamicEntryPlugin;
    affectedHooks = 'make';
    constructor(context, entry){
        super(), this.context = context, this.entry = entry;
    }
    raw(compiler) {
        let raw = {
            context: this.context,
            entry: async ()=>Object.entries(await this.entry()).map(([name, desc])=>{
                    let options = lib_EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
                    return {
                        import: desc.import,
                        options: getRawEntryOptions(options)
                    };
                })
        };
        return createBuiltinPlugin(this.name, raw);
    }
}
let ElectronTargetPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ElectronTargetPlugin, (context)=>context ?? 'none'), EnableChunkLoadingPluginInner = base_create(binding_namespaceObject.BuiltinPluginName.EnableChunkLoadingPlugin, (type)=>type), enabledTypes = new WeakMap(), getEnabledTypes = (compiler)=>{
    let set = enabledTypes.get(compiler);
    return void 0 === set && (set = new Set(), enabledTypes.set(compiler, set)), set;
};
class EnableChunkLoadingPlugin extends EnableChunkLoadingPluginInner {
    static setEnabled(compiler, type) {
        getEnabledTypes(compiler).add(type);
    }
    static checkEnabled(compiler, type) {
        if (!getEnabledTypes(compiler).has(type)) throw Error(`Chunk loading type "${type}" is not enabled. EnableChunkLoadingPlugin need to be used to enable this type of chunk loading. This usually happens through the "output.enabledChunkLoadingTypes" option. If you are using a function as entry which sets "chunkLoading", you need to add all potential chunk loading types to "output.enabledChunkLoadingTypes". These types are enabled: ${Array.from(getEnabledTypes(compiler)).join(', ')}`);
    }
    apply(compiler) {
        let [type] = this._args, enabled = getEnabledTypes(compiler);
        if (!enabled.has(type)) switch(enabled.add(type), type){
            case 'jsonp':
            case "import-scripts":
            case 'require':
            case 'async-node':
            case 'import':
                return void super.apply(compiler);
            default:
                throw Error(`Unsupported chunk loading type ${type}.
Plugins which provide custom chunk loading types must call EnableChunkLoadingPlugin.setEnabled(compiler, type) to disable this error.`);
        }
    }
}
class JsSplitChunkSizes {
    static __to_binding(sizes) {
        return 'number' == typeof sizes ? sizes : sizes && 'object' == typeof sizes ? {
            sizes: sizes
        } : sizes;
    }
}
class SplitChunksPlugin extends RspackBuiltinPlugin {
    options;
    name = binding_namespaceObject.BuiltinPluginName.SplitChunksPlugin;
    affectedHooks = 'thisCompilation';
    constructor(options){
        super(), this.options = options;
    }
    raw(compiler) {
        let rawOptions = SplitChunksPlugin_toRawSplitChunksOptions(this.options, compiler);
        if (void 0 === rawOptions) throw Error('rawOptions should not be undefined');
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
    if (!sc) return;
    function getName(name) {
        return 'function' == typeof name ? (ctx)=>void 0 === ctx.module ? name(void 0) : name(ctx.module, getChunks(ctx.chunks), ctx.cacheGroupKey) : name;
    }
    function getChunks(chunks) {
        return 'function' == typeof chunks ? (chunk)=>chunks(chunk) : chunks;
    }
    let { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
    return {
        name: getName(name),
        chunks: getChunks(chunks),
        defaultSizeTypes: defaultSizeTypes || [
            "javascript",
            'unknown'
        ],
        cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>!1 !== group).map(([key, group])=>{
            let { test, name, chunks, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
            return {
                key,
                test: 'function' == typeof test ? (ctx)=>{
                    let info = {
                        moduleGraph: compiler._lastCompilation.moduleGraph,
                        chunkGraph: compiler._lastCompilation.chunkGraph
                    };
                    return test(ctx.module, info);
                } : test,
                name: getName(name),
                chunks: getChunks(chunks),
                minSize: JsSplitChunkSizes.__to_binding(minSize),
                minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
                enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
                maxSize: JsSplitChunkSizes.__to_binding(maxSize),
                maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
                maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
                ...passThrough
            };
        }),
        fallbackCacheGroup: {
            chunks: getChunks(chunks),
            ...fallbackCacheGroup
        },
        minSize: JsSplitChunkSizes.__to_binding(minSize),
        minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
        enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
        maxSize: JsSplitChunkSizes.__to_binding(maxSize),
        maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
        maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
        ...passThrough
    };
}
let EnableLibraryPlugin_enabledTypes = new WeakMap(), EnableLibraryPlugin_getEnabledTypes = (compiler)=>{
    let set = EnableLibraryPlugin_enabledTypes.get(compiler);
    return void 0 === set && (set = new Set(), EnableLibraryPlugin_enabledTypes.set(compiler, set)), set;
};
class EnableLibraryPlugin extends RspackBuiltinPlugin {
    type;
    name = binding_namespaceObject.BuiltinPluginName.EnableLibraryPlugin;
    constructor(type){
        super(), this.type = type;
    }
    static setEnabled(compiler, type) {
        EnableLibraryPlugin_getEnabledTypes(compiler).add(type);
    }
    static checkEnabled(compiler, type) {
        if (!EnableLibraryPlugin_getEnabledTypes(compiler).has(type)) throw Error(`Library type "${type}" is not enabled. EnableLibraryPlugin need to be used to enable this type of library. This usually happens through the "output.enabledLibraryTypes" option. If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". These types are enabled: ${Array.from(EnableLibraryPlugin_getEnabledTypes(compiler)).join(', ')}`);
    }
    raw(compiler) {
        let type = this.type, enabled = EnableLibraryPlugin_getEnabledTypes(compiler);
        if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, {
            libraryType: type,
            preserveModules: compiler.options.output.library?.preserveModules,
            splitChunks: SplitChunksPlugin_toRawSplitChunksOptions(compiler.options.optimization.splitChunks ?? !1, compiler)
        });
    }
}
let EnableWasmLoadingPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveDuplicateModulesPlugin, ()=>({}));
base_create(binding_namespaceObject.BuiltinPluginName.EsmNodeTargetPlugin, ()=>void 0);
let EvalDevToolModulePlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, 'compilation'), EvalSourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>options, 'compilation');
function isNil(value) {
    return null == value;
}
let toBuffer = (bufLike)=>{
    if (Buffer.isBuffer(bufLike)) return bufLike;
    if ('string' == typeof bufLike) return Buffer.from(bufLike);
    if (bufLike instanceof Uint8Array) return Buffer.from(bufLike.buffer);
    throw Error('Buffer, Uint8Array or string expected');
};
function serializeObject(map) {
    if (!isNil(map)) return 'string' == typeof map ? map ? toBuffer(map) : void 0 : toBuffer(JSON.stringify(map));
}
function stringifyLoaderObject(o) {
    return o.path + o.query + o.fragment;
}
let unsupported = (name, issue)=>{
    let s = `${name} is not supported by Rspack.`;
    throw issue && (s += ` Refer to issue ${issue} for more information.`), Error(s);
}, warnedMessages = new Set(), WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>'' === relativePath ? './.' : '..' === relativePath ? '../.' : relativePath.startsWith('../') ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
    if ('/' === maybeAbsolutePath[0]) {
        if (maybeAbsolutePath.length > 1 && '/' === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
        let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
        return resource = relativePathToRequest(node_path.posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
    }
    if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
        let querySplitPos = maybeAbsolutePath.indexOf('?'), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
        return resource = node_path.win32.relative(context, resource), WINDOWS_ABS_PATH_REGEXP.test(resource) || (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, '/'))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
    }
    return maybeAbsolutePath;
}, makeCacheable = (realFn)=>{
    let cache = new WeakMap(), getCache = (associatedObjectForCache)=>{
        let entry = cache.get(associatedObjectForCache);
        if (void 0 !== entry) return entry;
        let map = new Map();
        return cache.set(associatedObjectForCache, map), map;
    }, fn = (str, associatedObjectForCache)=>{
        if (!associatedObjectForCache) return realFn(str);
        let cache = getCache(associatedObjectForCache), entry = cache.get(str);
        if (void 0 !== entry) return entry;
        let result = realFn(str);
        return cache.set(str, result), result;
    };
    return fn.bindCache = (associatedObjectForCache)=>{
        let cache = getCache(associatedObjectForCache);
        return (str)=>{
            let entry = cache.get(str);
            if (void 0 !== entry) return entry;
            let result = realFn(str);
            return cache.set(str, result), result;
        };
    }, fn;
}, makeCacheableWithContext = (fn)=>{
    let cache = new WeakMap(), cachedFn = (context, identifier, associatedObjectForCache)=>{
        let cachedResult;
        if (!associatedObjectForCache) return fn(context, identifier);
        let innerCache = cache.get(associatedObjectForCache);
        void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache));
        let innerSubCache = innerCache.get(context);
        if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
        let result = fn(context, identifier);
        return innerSubCache.set(identifier, result), result;
    };
    return cachedFn.bindCache = (associatedObjectForCache)=>{
        let innerCache;
        return associatedObjectForCache ? void 0 === (innerCache = cache.get(associatedObjectForCache)) && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)) : innerCache = new Map(), (context, identifier)=>{
            let cachedResult, innerSubCache = innerCache?.get(context);
            if (void 0 === innerSubCache ? (innerSubCache = new Map(), innerCache?.set(context, innerSubCache)) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
            let result = fn(context, identifier);
            return innerSubCache.set(identifier, result), result;
        };
    }, cachedFn.bindContextCache = (context, associatedObjectForCache)=>{
        let innerSubCache;
        if (associatedObjectForCache) {
            let innerCache = cache.get(associatedObjectForCache);
            void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)), void 0 === (innerSubCache = innerCache.get(context)) && innerCache.set(context, innerSubCache = new Map());
        } else innerSubCache = new Map();
        return (identifier)=>{
            let cachedResult = innerSubCache?.get(identifier);
            if (void 0 !== cachedResult) return cachedResult;
            let result = fn(context, identifier);
            return innerSubCache?.set(identifier, result), result;
        };
    }, cachedFn;
}, makePathsRelative = makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join('')), contextify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>absoluteToRequest(context, r)).join('!')), absolutify = makeCacheableWithContext((context, request)=>request.split('!').map((r)=>r.startsWith('./') || r.startsWith('../') ? node_path.join(context, r) : r).join('!')), PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\u200b.|[^?\u200b])*)(\?.*)?$/, parseResource = makeCacheable((str)=>{
    let match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
    return {
        resource: str,
        path: match[1].replace(/\u200b(.)/g, '$1'),
        query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
        fragment: match[3] || ''
    };
}), parseResourceWithoutFragment = makeCacheable((str)=>{
    let match = PATH_QUERY_REGEXP.exec(str);
    return {
        resource: str,
        path: match[1].replace(/\u200b(.)/g, '$1'),
        query: match[2] ? match[2].replace(/\u200b(.)/g, '$1') : ''
    };
});
function isStatsColorSupported() {
    if ("u" < typeof process) return !1;
    let env = process.env ?? {}, argv = process.argv ?? [];
    return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === process.platform || process.stdout?.isTTY && 'dumb' !== env.TERM || 'CI' in env);
}
function encodeVersion(version) {
    let [major, minor = 0, patch = 0] = version.split('-')[0].split('.').map((v)=>parseInt(v, 10));
    return Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch) ? null : major << 16 | minor << 8 | patch;
}
function decodeVersion(n) {
    return `${n >> 16 & 0xff}.${n >> 8 & 0xff}.${0xff & n}`;
}
function encodeTargets(targets) {
    return Object.fromEntries(Object.entries(targets).map(([k, v])=>[
            k,
            encodeVersion(v)
        ]));
}
function defaultTargetsFromRspackTargets(targets) {
    let REMAP = {
        and_chr: 'chrome',
        and_ff: 'firefox',
        ie_mob: 'ie',
        op_mob: 'opera',
        and_qq: null,
        and_uc: null,
        baidu: null,
        bb: null,
        kaios: null,
        op_mini: null
    }, result = {};
    for (let [k, v] of Object.entries(targets)){
        let remap = REMAP[k];
        if (null === remap) continue;
        let name = remap || k, version = encodeVersion(v);
        null !== version && (result[name] = version);
    }
    return result;
}
function toFeatures(featureOptions) {
    let feature = 0;
    for (let key of Reflect.ownKeys(featureOptions))if (!0 === featureOptions[key]) switch(key){
        case 'nesting':
            feature |= 1;
            break;
        case 'notSelectorList':
            feature |= 2;
            break;
        case 'dirSelector':
            feature |= 4;
            break;
        case 'langSelectorList':
            feature |= 8;
            break;
        case 'isSelector':
            feature |= 16;
            break;
        case 'textDecorationThicknessPercent':
            feature |= 32;
            break;
        case 'mediaIntervalSyntax':
            feature |= 64;
            break;
        case 'mediaRangeSyntax':
            feature |= 128;
            break;
        case 'customMediaQueries':
            feature |= 256;
            break;
        case 'clampFunction':
            feature |= 512;
            break;
        case 'colorFunction':
            feature |= 1024;
            break;
        case 'oklabColors':
            feature |= 2048;
            break;
        case 'labColors':
            feature |= 4096;
            break;
        case 'p3Colors':
            feature |= 8192;
            break;
        case 'hexAlphaColors':
            feature |= 16384;
            break;
        case 'spaceSeparatedColorNotation':
            feature |= 32768;
            break;
        case 'fontFamilySystemUi':
            feature |= 65536;
            break;
        case 'doublePositionGradients':
            feature |= 131072;
            break;
        case 'vendorPrefixes':
            feature |= 262144;
            break;
        case 'logicalProperties':
            feature |= 524288;
            break;
        case 'selectors':
            feature |= 31;
            break;
        case 'mediaQueries':
            feature |= 448;
            break;
        case 'color':
            feature |= 64512;
    }
    return feature;
}
function resolvePluginImport(pluginImport) {
    if (pluginImport) return pluginImport.map((config)=>{
        let rawConfig = {
            ...config,
            style: {}
        };
        if ('boolean' == typeof config.style) rawConfig.style.bool = config.style;
        else if ('string' == typeof config.style) {
            let isTpl = config.style.includes('{{');
            rawConfig.style[isTpl ? 'custom' : 'css'] = config.style;
        } else {
            var val;
            val = config.style, '[object Object]' === Object.prototype.toString.call(val) && (rawConfig.style = config.style);
        }
        return config.styleLibraryDirectory && (rawConfig.style = {
            styleLibraryDirectory: config.styleLibraryDirectory
        }), rawConfig;
    });
}
let $assets = Symbol('assets');
Object.defineProperty(binding_default().KnownBuildInfo.prototype, node_util.inspect.custom, {
    enumerable: !0,
    configurable: !0,
    value () {
        return {
            ...this,
            assets: this.assets,
            fileDependencies: this.fileDependencies,
            contextDependencies: this.contextDependencies,
            missingDependencies: this.missingDependencies,
            buildDependencies: this.buildDependencies
        };
    }
}), Object.defineProperty(binding_default().KnownBuildInfo.prototype, 'assets', {
    enumerable: !0,
    configurable: !0,
    get () {
        if (this[binding_default().BUILD_INFO_ASSETS_SYMBOL][$assets]) return this[binding_default().BUILD_INFO_ASSETS_SYMBOL][$assets];
        let assets = new Proxy(Object.create(null), {
            ownKeys: ()=>this[binding_default().BUILD_INFO_ASSETS_SYMBOL].keys(),
            getOwnPropertyDescriptor: ()=>({
                    enumerable: !0,
                    configurable: !0
                })
        });
        return Object.defineProperty(this[binding_default().BUILD_INFO_ASSETS_SYMBOL], $assets, {
            enumerable: !1,
            configurable: !0,
            value: assets
        }), assets;
    }
}), Object.defineProperty(binding_default().KnownBuildInfo.prototype, 'fileDependencies', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this[binding_default().BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]);
    }
}), Object.defineProperty(binding_default().KnownBuildInfo.prototype, 'contextDependencies', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this[binding_default().BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]);
    }
}), Object.defineProperty(binding_default().KnownBuildInfo.prototype, 'missingDependencies', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this[binding_default().BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]);
    }
}), Object.defineProperty(binding_default().KnownBuildInfo.prototype, 'buildDependencies', {
    enumerable: !0,
    configurable: !0,
    get () {
        return new Set(this[binding_default().BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]);
    }
});
let knownBuildInfoFields = new Set([
    'assets',
    'fileDependencies',
    'contextDependencies',
    'missingDependencies',
    'buildDependencies'
]);
Object.defineProperty(binding_default().NormalModule.prototype, 'identifier', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this[binding_default().MODULE_IDENTIFIER_SYMBOL];
    }
}), Object.defineProperty(binding_default().NormalModule.prototype, 'originalSource', {
    enumerable: !0,
    configurable: !0,
    value () {
        let originalSource = this._originalSource();
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
}), Object.defineProperty(binding_default().NormalModule.prototype, 'emitFile', {
    enumerable: !0,
    configurable: !0,
    value (filename, source, assetInfo) {
        return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
    }
}), Object.defineProperty(binding_default().NormalModule, 'getCompilationHooks', {
    enumerable: !0,
    configurable: !0,
    value (compilation) {
        if (!(binding_default().COMPILATION_HOOKS_MAP_SYMBOL in compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
        let compilationHooksMap = compilation[binding_default().COMPILATION_HOOKS_MAP_SYMBOL], hooks = compilationHooksMap.get(compilation);
        return void 0 === hooks && (hooks = {
            loader: new SyncHook([
                'loaderContext',
                'module'
            ]),
            readResource: new HookMap(()=>new AsyncSeriesBailHook([
                    'loaderContext'
                ]))
        }, compilationHooksMap.set(compilation, hooks)), hooks;
    }
});
class NonErrorEmittedError extends Error {
    constructor(error){
        super(), this.name = 'NonErrorEmittedError', this.message = `(Emitted value instead of an instance of Error) ${error}`;
    }
}
class DeadlockRiskError extends Error {
    constructor(message){
        super(message), this.name = 'DeadlockRiskError', this.stack = '';
    }
}
class ValidationError extends Error {
    constructor(message){
        super(message), this.name = 'ValidationError';
    }
}
class JavaScriptTracer {
    static state = 'uninitialized';
    static startTime;
    static events;
    static layer;
    static output;
    static session;
    static counter = 10000;
    static async initJavaScriptTrace(layer, output) {
        let { Session } = await import("node:inspector");
        this.session = new Session(), this.layer = layer, this.output = output, this.events = [], this.state = 'on', this.startTime = process.hrtime.bigint();
    }
    static uuid() {
        return this.counter++;
    }
    static initCpuProfiler() {
        this.layer && (this.session.connect(), this.session.post('Profiler.enable'), this.session.post('Profiler.start'));
    }
    static async cleanupJavaScriptTrace() {
        if ('uninitialized' === this.state) throw Error('JavaScriptTracer is not initialized, please call initJavaScriptTrace first');
        if (!this.layer || 'off' === this.state) return;
        let profileHandler = (err, param)=>{
            let cpu_profile;
            if (err ? console.error('Error stopping profiler:', err) : cpu_profile = param.profile, cpu_profile) {
                let uuid = this.uuid();
                this.pushEvent({
                    name: 'Profile',
                    ph: 'P',
                    trackName: 'JavaScript CPU Profiler',
                    processName: 'JavaScript CPU',
                    uuid,
                    ...this.getCommonEv(),
                    categories: [
                        'disabled-by-default-v8.cpu_profiler'
                    ],
                    args: {
                        data: {
                            startTime: 0
                        }
                    }
                }), this.pushEvent({
                    name: 'ProfileChunk',
                    ph: 'P',
                    trackName: 'JavaScript CPU Profiler',
                    processName: 'JavaScript CPU',
                    ...this.getCommonEv(),
                    categories: [
                        'disabled-by-default-v8.cpu_profiler'
                    ],
                    uuid,
                    args: {
                        data: {
                            cpuProfile: cpu_profile,
                            timeDeltas: cpu_profile.timeDeltas
                        }
                    }
                });
            }
        };
        await new Promise((resolve, reject)=>{
            this.session.post('Profiler.stop', (err, params)=>{
                if (err) reject(err);
                else try {
                    profileHandler(err, params), resolve();
                } catch (err) {
                    reject(err);
                }
            });
        }), this.state = 'off';
    }
    static getTs() {
        return process.hrtime.bigint() - this.startTime;
    }
    static getCommonEv() {
        return {
            ts: this.getTs(),
            cat: 'rspack'
        };
    }
    static pushEvent(event) {
        let stringifiedArgs = Object.keys(event.args || {}).reduce((acc, key)=>(acc[key] = JSON.stringify(event.args[key]), acc), {});
        this.events.push({
            ...event,
            args: stringifiedArgs
        });
    }
    static startAsync(events) {
        this.layer && this.pushEvent({
            ...this.getCommonEv(),
            ...events,
            ph: 'b'
        });
    }
    static endAsync(events) {
        this.layer && this.pushEvent({
            ...this.getCommonEv(),
            ...events,
            ph: 'e'
        });
    }
}
let CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
function createMessage(method) {
    return `Abstract method${method ? ` ${method}` : ''}. Must be overridden.`;
}
class Message extends Error {
    constructor(){
        super(), this.stack = void 0, Error.captureStackTrace(this);
        let match = this.stack.split('\n')[3].match(CURRENT_METHOD_REGEXP);
        this.message = match?.[1] ? createMessage(match[1]) : createMessage();
    }
}
class AbstractMethodError extends lib_WebpackError {
    constructor(){
        super(new Message().message), this.name = 'AbstractMethodError';
    }
}
class Hash {
    update() {
        throw new AbstractMethodError();
    }
    digest() {
        throw new AbstractMethodError();
    }
}
let MAX_SHORT_STRING = -4 & Math.floor(16368);
class WasmHash {
    exports;
    instancesPool;
    buffered;
    mem;
    chunkSize;
    digestSize;
    constructor(instance, instancesPool, chunkSize, digestSize){
        let exports = instance.exports;
        exports.init(), this.exports = exports, this.mem = Buffer.from(exports.memory.buffer, 0, 65536), this.buffered = 0, this.instancesPool = instancesPool, this.chunkSize = chunkSize, this.digestSize = digestSize;
    }
    reset() {
        this.buffered = 0, this.exports.init();
    }
    update(data, encoding) {
        if ('string' == typeof data) {
            let normalizedData = data;
            for(; normalizedData.length > MAX_SHORT_STRING;)this._updateWithShortString(normalizedData.slice(0, MAX_SHORT_STRING), encoding), normalizedData = normalizedData.slice(MAX_SHORT_STRING);
            return this._updateWithShortString(normalizedData, encoding), this;
        }
        return this._updateWithBuffer(data), this;
    }
    _updateWithShortString(data, encoding) {
        let endPos, { exports, buffered, mem, chunkSize } = this;
        if (data.length < 70) if (encoding && 'utf-8' !== encoding && 'utf8' !== encoding) if ('latin1' === encoding) {
            endPos = buffered;
            for(let i = 0; i < data.length; i++){
                let cc = data.charCodeAt(i);
                mem[endPos++] = cc;
            }
        } else endPos = buffered + mem.write(data, buffered, encoding);
        else {
            endPos = buffered;
            for(let i = 0; i < data.length; i++){
                let cc = data.charCodeAt(i);
                if (cc < 0x80) mem[endPos++] = cc;
                else if (cc < 0x800) mem[endPos] = cc >> 6 | 0xc0, mem[endPos + 1] = 0x3f & cc | 0x80, endPos += 2;
                else {
                    endPos += mem.write(data.slice(i), endPos, encoding);
                    break;
                }
            }
        }
        else endPos = buffered + mem.write(data, buffered, encoding);
        if (endPos < chunkSize) this.buffered = endPos;
        else {
            let l = endPos & ~(this.chunkSize - 1);
            exports.update(l);
            let newBuffered = endPos - l;
            this.buffered = newBuffered, newBuffered > 0 && mem.copyWithin(0, l, endPos);
        }
    }
    _updateWithBuffer(data) {
        let { exports, buffered, mem } = this, length = data.length;
        if (buffered + length < this.chunkSize) data.copy(mem, buffered, 0, length), this.buffered += length;
        else {
            let l = buffered + length & ~(this.chunkSize - 1);
            if (l > 65536) {
                let i = 65536 - buffered;
                data.copy(mem, buffered, 0, i), exports.update(65536);
                let stop = l - buffered - 65536;
                for(; i < stop;)data.copy(mem, 0, i, i + 65536), exports.update(65536), i += 65536;
                data.copy(mem, 0, i, l - buffered), exports.update(l - buffered - i);
            } else data.copy(mem, buffered, 0, l - buffered), exports.update(l);
            let newBuffered = length + buffered - l;
            this.buffered = newBuffered, newBuffered > 0 && data.copy(mem, 0, length - newBuffered, length);
        }
    }
    digest(type) {
        let { exports, buffered, mem, digestSize } = this;
        exports.final(buffered), this.instancesPool.push(this);
        let hex = mem.toString('latin1', 0, digestSize);
        return 'hex' === type ? hex : 'binary' !== type && type ? Buffer.from(hex, 'hex').toString(type) : Buffer.from(hex, 'hex');
    }
}
let wasm_hash = (wasmModule, instancesPool, chunkSize, digestSize)=>{
    if (instancesPool.length > 0) {
        let old = instancesPool.pop();
        return old.reset(), old;
    }
    return new WasmHash(new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize);
}, createHash_require = createRequire(import.meta.url), digestCaches = {};
class BulkUpdateDecorator extends Hash {
    hash;
    hashFactory;
    hashKey;
    buffer;
    constructor(hashOrFactory, hashKey){
        super(), this.hashKey = hashKey, 'function' == typeof hashOrFactory ? (this.hashFactory = hashOrFactory, this.hash = void 0) : (this.hashFactory = void 0, this.hash = hashOrFactory), this.buffer = '';
    }
    update(data, inputEncoding) {
        return void 0 !== inputEncoding || 'string' != typeof data || data.length > 2000 ? (void 0 === this.hash && (this.hash = this.hashFactory()), this.buffer.length > 0 && (this.hash.update(Buffer.from(this.buffer)), this.buffer = ''), Buffer.isBuffer(data) ? this.hash.update(data) : this.hash.update(data, inputEncoding)) : (this.buffer += data, this.buffer.length > 2000 && (void 0 === this.hash && (this.hash = this.hashFactory()), this.hash.update(Buffer.from(this.buffer)), this.buffer = '')), this;
    }
    digest(encoding) {
        let digestCache, buffer = this.buffer;
        if (void 0 === this.hash) {
            let cacheKey = `${this.hashKey}-${encoding}`;
            void 0 === (digestCache = digestCaches[cacheKey]) && (digestCache = digestCaches[cacheKey] = new Map());
            let cacheEntry = digestCache.get(buffer);
            if (void 0 !== cacheEntry) return encoding ? cacheEntry : Buffer.from(cacheEntry, 'hex');
            this.hash = this.hashFactory();
        }
        buffer.length > 0 && this.hash.update(Buffer.from(buffer));
        let result = encoding ? this.hash.digest(encoding) : this.hash.digest();
        return void 0 !== digestCache && 'string' == typeof result && digestCache.set(buffer, result), result;
    }
}
class WasmHashAdapter extends Hash {
    wasmHash;
    constructor(wasmHash){
        super(), this.wasmHash = wasmHash;
    }
    update(data, inputEncoding) {
        return Buffer.isBuffer(data) ? this.wasmHash.update(data) : this.wasmHash.update(data, inputEncoding), this;
    }
    digest(encoding) {
        return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
    }
}
let createHash_createHash = (algorithm)=>{
    if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
    switch(algorithm){
        case 'xxhash64':
            return new WasmHashAdapter((()=>{
                if (!createXxhash64) {
                    let xxhash64 = new WebAssembly.Module(Buffer.from('AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL', 'base64'));
                    createXxhash64 = wasm_hash.bind(null, xxhash64, [], 32, 16);
                }
                return createXxhash64();
            })());
        case 'md4':
            return new WasmHashAdapter((()=>{
                if (!createMd4) {
                    let md4 = new WebAssembly.Module(Buffer.from('AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqLEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvSCgEZfyMBIQUjAiECIwMhAyMEIQQDQCAAIAFLBEAgASgCJCISIAEoAiAiEyABKAIcIgkgASgCGCIIIAEoAhQiByABKAIQIg4gASgCDCIGIAEoAggiDyABKAIEIhAgASgCACIRIAMgBHMgAnEgBHMgBWpqQQN3IgogAiADc3EgA3MgBGpqQQd3IgsgAiAKc3EgAnMgA2pqQQt3IgwgCiALc3EgCnMgAmpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IgogDCANc3EgDHMgC2pqQQd3IgsgCiANc3EgDXMgDGpqQQt3IgwgCiALc3EgCnMgDWpqQRN3Ig0gCyAMc3EgC3MgCmpqQQN3IhQgDCANc3EgDHMgC2pqQQd3IRUgASgCLCILIAEoAigiCiAMIA0gDSAUcyAVcXNqakELdyIWIBQgFXNxIBRzIA1qakETdyEXIAEoAjQiGCABKAIwIhkgFSAWcyAXcSAVcyAUampBA3ciFCAWIBdzcSAWcyAVampBB3chFSABKAI8Ig0gASgCOCIMIBQgF3MgFXEgF3MgFmpqQQt3IhYgFCAVc3EgFHMgF2pqQRN3IRcgEyAOIBEgFCAVIBZyIBdxIBUgFnFyampBmfOJ1AVqQQN3IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEFdyIVIBQgF3JxIBQgF3FyIBZqakGZ84nUBWpBCXchFiAPIBggEiAWIAcgFSAQIBQgGSAUIBVyIBZxIBQgFXFyIBdqakGZ84nUBWpBDXciFCAVIBZycSAVIBZxcmpqQZnzidQFakEDdyIVIBQgFnJxIBQgFnFyampBmfOJ1AVqQQV3IhcgFCAVcnEgFCAVcXJqakGZ84nUBWpBCXciFiAVIBdycSAVIBdxciAUampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXIgFWpqQZnzidQFakEDdyEVIBEgBiAVIAwgFCAKIBYgCCAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFyAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIWIBUgF3JxIBUgF3FyampBmfOJ1AVqQQ13IhQgFiAXcnEgFiAXcXJqakGZ84nUBWpBA3ciFSALIBYgCSAUIBZyIBVxIBQgFnFyIBdqakGZ84nUBWpBBXciFiAUIBVycSAUIBVxcmpqQZnzidQFakEJdyIXIA0gFSAWciAXcSAVIBZxciAUampBmfOJ1AVqQQ13IhRzIBZzampBodfn9gZqQQN3IREgByAIIA4gFCARIBcgESAUc3MgFmogE2pBodfn9gZqQQl3IhNzcyAXampBodfn9gZqQQt3Ig4gDyARIBMgDiARIA4gE3NzIBRqIBlqQaHX5/YGakEPdyIRc3NqakGh1+f2BmpBA3ciDyAOIA8gEXNzIBNqIApqQaHX5/YGakEJdyIKcyARc2pqQaHX5/YGakELdyIIIBAgDyAKIAggDCAPIAggCnNzIBFqakGh1+f2BmpBD3ciDHNzampBodfn9gZqQQN3Ig4gEiAIIAwgDnNzIApqakGh1+f2BmpBCXciCHMgDHNqakGh1+f2BmpBC3chByAFIAYgCCAHIBggDiAHIAhzcyAMampBodfn9gZqQQ93IgpzcyAOampBodfn9gZqQQN3IgZqIQUgDSAGIAkgByAGIAsgByAGIApzcyAIampBodfn9gZqQQl3IgdzIApzampBodfn9gZqQQt3IgYgB3NzIApqakGh1+f2BmpBD3cgAmohAiADIAZqIQMgBCAHaiEEIAFBQGshAQwBCwsgBSQBIAIkAiADJAMgBCQECw0AIAAQASAAIwBqJAAL/wQCA38BfiAAIwBqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=', 'base64'));
                    createMd4 = wasm_hash.bind(null, md4, [], 64, 32);
                }
                return createMd4();
            })());
        case 'native-md4':
            return new BulkUpdateDecorator(()=>{
                let { createHash } = createHash_require('node:crypto');
                return createHash('md4');
            }, 'md4');
        default:
            return new BulkUpdateDecorator(()=>{
                let { createHash } = createHash_require('node:crypto');
                return createHash(algorithm);
            }, algorithm);
    }
}, memoize = (fn)=>{
    let result, cache = !1, callback = fn;
    return ()=>(cache || (result = callback(), cache = !0, callback = void 0), result);
}, memoizeFn = (fn)=>{
    let cache = null;
    return (...args)=>(cache || (cache = fn()), cache(...args));
}, ModuleError_createMessage = (err, type, from)=>{
    let message = `Module ${type}${from ? ` (from ${from}):\n` : ': '}`;
    return err && 'object' == typeof err && err.message ? message += err.message : err && (message += err), message;
}, getErrorDetails = (err)=>{
    var stack, name, message, stack1, name1, message1;
    let details, nextLine;
    return err && 'object' == typeof err && err.stack ? (stack = err.stack, name = err.name, message = err.message, cutOffLoaderExecution(stack), stack1 = stack, name1 = name, message1 = message, details = -1 === (nextLine = stack1.indexOf('\n')) ? stack1 === message1 ? '' : stack1 : stack1.slice(0, nextLine) === `${name1}: ${message1}` ? stack1.slice(nextLine + 1) : stack1) : void 0;
};
class ModuleError extends lib_WebpackError {
    error;
    constructor(err, { from } = {}){
        super(ModuleError_createMessage(err, 'Error', from)), this.name = 'ModuleError', this.error = err, this.details = getErrorDetails(err);
    }
}
class ModuleWarning extends lib_WebpackError {
    error;
    constructor(err, { from } = {}){
        super(ModuleError_createMessage(err, 'Warning', from)), this.name = 'ModuleWarning', this.error = err, this.details = getErrorDetails(err);
    }
}
let service_require = createRequire(import.meta.url), ensureLoaderWorkerPool = async (workerOptions)=>service_pool || (service_pool = import("../compiled/tinypool/dist/index.js").then(({ Tinypool })=>{
        let availableThreads = Math.max(service_require('node:os').cpus().length - 1, 1), maxWorkers = workerOptions?.maxWorkers ? Math.max(workerOptions.maxWorkers, 1) : void 0, maxWorkersFromEnv = parseInt(process.env.RSPACK_LOADER_WORKER_THREADS || '', 10);
        return new Tinypool({
            filename: node_path.resolve(import.meta.dirname, 'worker.js'),
            useAtomics: !1,
            maxThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
            minThreads: maxWorkers || maxWorkersFromEnv || availableThreads,
            concurrentTasksPerWorker: 1
        });
    }));
function serializeError(error) {
    if (error instanceof Error || error && 'object' == typeof error && 'message' in error) return {
        ...error,
        name: error.name,
        stack: error.stack,
        message: error.message
    };
    if ('string' == typeof error) return {
        name: 'Error',
        message: error
    };
    throw Error('Failed to serialize error, only string, Error instances and objects with a message property are supported');
}
let service_run = async (loaderName, task, options, workerOptions)=>ensureLoaderWorkerPool(workerOptions).then(async (pool)=>{
        let { MessageChannel } = await import("node:worker_threads"), { port1: mainPort, port2: workerPort } = new MessageChannel(), { port1: mainSyncPort, port2: workerSyncPort } = new MessageChannel();
        return new Promise((resolve, reject)=>{
            let handleError = (error)=>{
                mainPort.close(), mainSyncPort.close(), reject(error);
            }, pendingRequests = new Map();
            mainPort.on('message', (message)=>{
                'done' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
                    mainPort.close(), mainSyncPort.close(), resolve(message.data);
                }) : 'done-error' === message.type ? Promise.allSettled(pendingRequests.values()).then(()=>{
                    mainPort.close(), mainSyncPort.close(), reject(message.error);
                }) : 'request' === message.type && pendingRequests.set(message.id, Promise.resolve().then(()=>options.handleIncomingRequest(message.requestType, ...message.data)).then((result)=>(mainPort.postMessage({
                        type: 'response',
                        id: message.id,
                        data: result
                    }), result)).catch((error)=>{
                    mainPort.postMessage({
                        type: 'response-error',
                        id: message.id,
                        error: serializeError(error)
                    });
                }));
            }), mainPort.on('messageerror', handleError), mainSyncPort.on('message', async (message)=>{
                let result, { sharedBuffer } = message, sharedBufferView = new Int32Array(sharedBuffer);
                try {
                    if ("WaitForPendingRequest" === message.requestType) {
                        let pendingRequestId = message.data[0], isArray = Array.isArray(pendingRequestId), ids = isArray ? pendingRequestId : [
                            pendingRequestId
                        ];
                        result = await Promise.all(ids.map((id)=>pendingRequests.get(id))), isArray || (result = result[0]);
                    } else throw Error(`Unknown request type: ${message.requestType}`);
                    mainSyncPort.postMessage({
                        type: 'response',
                        id: message.id,
                        data: result
                    });
                } catch (e) {
                    mainSyncPort.postMessage({
                        type: 'response-error',
                        id: message.id,
                        error: serializeError(e)
                    });
                }
                Atomics.add(sharedBufferView, 0, 1), Atomics.notify(sharedBufferView, 0, 1 / 0);
            }), mainSyncPort.on('messageerror', handleError);
            let errors = [];
            for (let key of Object.keys(task))try {
                structuredClone(task[key]);
            } catch (e) {
                errors.push({
                    key,
                    type: typeof task[key],
                    reason: e.message
                });
            }
            if (errors.length > 0) {
                let errorMsg = errors.map((err)=>`option "${err.key}" (type: ${err.type}) is not cloneable: ${err.reason}`).join('\n');
                throw Error(`The options for ${loaderName} are not cloneable, which is not supported by parallelLoader. Consider disabling parallel for this loader or removing the non-cloneable properties from the options:\n${errorMsg}`);
            }
            pool.run({
                ...task,
                workerData: {
                    workerPort,
                    workerSyncPort
                }
            }, {
                ...options,
                transferList: [
                    ...options?.transferList || [],
                    workerPort,
                    workerSyncPort
                ]
            }).catch(handleError);
        });
    }), LoaderLoadingError = class extends Error {
    constructor(message){
        super(message), this.name = 'LoaderRunnerError', Error.captureStackTrace(this, this.constructor);
    }
}, loadLoader_require = createRequire(import.meta.url);
function loadLoader(loader, compiler, callback) {
    if ('module' === loader.type) try {
        void 0 === loadLoader_url && (loadLoader_url = loadLoader_require('node:url')), import(loadLoader_url.pathToFileURL(loader.path).toString()).then((module)=>{
            handleResult(loader, module, callback);
        }, callback);
        return;
    } catch (e) {
        callback(e);
    }
    else {
        let module;
        try {
            module = loadLoader_require(loader.path);
        } catch (e) {
            if (e instanceof Error && 'EMFILE' === e.code) return void setImmediate(loadLoader.bind(null, loader, compiler, callback));
            return callback(e);
        }
        return handleResult(loader, module, callback);
    }
}
function handleResult(loader, module, callback) {
    return 'function' != typeof module && 'object' != typeof module ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (export function or es6 module)`)) : (loader.normal = 'function' == typeof module ? module : module.default, loader.pitch = module.pitch, loader.raw = module.raw, loader.pitch || (loader.noPitch = !0), 'function' != typeof loader.normal && 'function' != typeof loader.pitch) ? callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (must have normal or pitch function)`)) : void callback();
}
let decoder = new TextDecoder(), utils_loadLoader = promisify(loadLoader), utils_runSyncOrAsync = promisify(function(fn, context, args, callback) {
    let isSync = !0, isDone = !1, isError = !1, reportedError = !1;
    context.async = function() {
        if (isDone) {
            if (reportedError) return;
            throw Error('async(): The callback was already called.');
        }
        return isSync = !1, innerCallback;
    };
    let innerCallback = (err, ...args)=>{
        if (isDone) {
            if (reportedError) return;
            throw Error('callback(): The callback was already called.');
        }
        isDone = !0, isSync = !1;
        try {
            callback(err, args);
        } catch (e) {
            throw isError = !0, e;
        }
    };
    context.callback = innerCallback;
    try {
        let result = fn.apply(context, args);
        if (isSync) {
            if (isDone = !0, void 0 === result) return void callback(null, []);
            if (result && 'object' == typeof result && 'function' == typeof result.then) return void result.then((r)=>{
                callback(null, [
                    r
                ]);
            }, callback);
            callback(null, [
                result
            ]);
            return;
        }
    } catch (e) {
        if ('hideStack' in e && e.hideStack && (e.hideStack = 'true'), isError) throw e;
        if (isDone) return void (e instanceof Error ? console.error(e.stack) : console.error(e));
        isDone = !0, reportedError = !0, callback(e, []);
    }
}), LOADER_PROCESS_NAME = 'Loader Analysis';
class LoaderObject {
    request;
    path;
    query;
    fragment;
    options;
    ident;
    normal;
    pitch;
    raw;
    type;
    parallel;
    loaderItem;
    constructor(loaderItem, compiler){
        let obj, { request, path, query, fragment, options, ident, normal, pitch, raw, type } = (Object.defineProperty(obj = {
            path: null,
            query: null,
            fragment: null,
            options: null,
            ident: null,
            normal: null,
            pitch: null,
            raw: null,
            data: null,
            pitchExecuted: !1,
            normalExecuted: !1
        }, 'request', {
            enumerable: !0,
            get: ()=>obj.path.replace(/#/g, '\u200b#') + obj.query.replace(/#/g, '\u200b#') + obj.fragment,
            set: (value)=>{
                let splittedRequest = parseResourceWithoutFragment(value.loader);
                if (obj.path = splittedRequest.path, obj.query = splittedRequest.query, obj.fragment = '', obj.options = null === obj.options ? splittedRequest.query ? splittedRequest.query.slice(1) : void 0 : obj.options, 'string' == typeof obj.options && '?' === obj.options[0]) {
                    let ident = obj.options.slice(1);
                    if ('[[missing ident]]' === ident) throw Error("No ident is provided by referenced loader. When using a function for Rule.use in config you need to provide an 'ident' property for referenced loader options.");
                    if (obj.options = compiler.__internal__ruleSet.references.get(ident), void 0 === obj.options) throw Error('Invalid ident is provided by referenced loader');
                    obj.ident = ident;
                }
                obj.type = '' === value.type ? void 0 : value.type, null === obj.options || void 0 === obj.options ? obj.query = '' : 'string' == typeof obj.options ? obj.query = `?${obj.options}` : obj.ident ? obj.query = `??${obj.ident}` : 'object' == typeof obj.options && obj.options.ident ? obj.query = `??${obj.options.ident}` : obj.query = `?${JSON.stringify(obj.options)}`;
            }
        }), obj.request = loaderItem, Object.preventExtensions && Object.preventExtensions(obj), obj);
        this.request = request, this.path = path, this.query = query, this.fragment = fragment, this.options = options, this.ident = ident, this.normal = normal, this.pitch = pitch, this.raw = raw, this.type = type, this.parallel = !!ident && compiler.__internal__ruleSet.references.get(`${ident}$$parallelism`), this.loaderItem = loaderItem, this.loaderItem.data = this.loaderItem.data ?? {};
    }
    get pitchExecuted() {
        return this.loaderItem.pitchExecuted;
    }
    set pitchExecuted(value) {
        if (!value) throw Error('pitchExecuted should be true');
        this.loaderItem.pitchExecuted = !0;
    }
    get normalExecuted() {
        return this.loaderItem.normalExecuted;
    }
    set normalExecuted(value) {
        if (!value) throw Error('normalExecuted should be true');
        this.loaderItem.normalExecuted = !0;
    }
    set noPitch(value) {
        if (!value) throw Error('noPitch should be true');
        this.loaderItem.noPitch = !0;
    }
    shouldYield() {
        return this.request.startsWith(BUILTIN_LOADER_PREFIX);
    }
    static __from_binding(loaderItem, compiler) {
        return new this(loaderItem, compiler);
    }
    static __to_binding(loader) {
        return loader.loaderItem;
    }
}
class JsSourceMap {
    static __from_binding(map) {
        return isNil(map) ? void 0 : ((input)=>{
            let s;
            if (Buffer.isBuffer(input)) s = input.toString('utf8');
            else if (input && 'object' == typeof input) return input;
            else if ('string' == typeof input) s = input;
            else throw Error('Buffer or string or object expected');
            return JSON.parse(s);
        })(map);
    }
    static __to_binding(map) {
        return serializeObject(map);
    }
}
function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
    return loaderContext.loaders?.length && index < loaderContext.loaders.length && index >= 0 && loaderContext.loaders[index] ? loaderContext.loaders[index] : null;
}
async function runLoaders(compiler, context) {
    var buildInfo;
    let loaderState = context.loaderState, pitch = loaderState === binding_namespaceObject.JsLoaderState.Pitching, { resource } = context, uuid = JavaScriptTracer.uuid();
    JavaScriptTracer.startAsync({
        name: 'run_js_loaders',
        processName: LOADER_PROCESS_NAME,
        uuid,
        ph: 'b',
        args: {
            is_pitch: pitch,
            resource: resource
        }
    });
    let splittedResource = resource && parsePathQueryFragment(resource), resourcePath = splittedResource ? splittedResource.path : void 0, resourceQuery = splittedResource ? splittedResource.query : void 0, resourceFragment = splittedResource ? splittedResource.fragment : void 0, contextDirectory = resourcePath ? function(path) {
        if ('/' === path) return '/';
        let i = path.lastIndexOf('/'), j = path.lastIndexOf('\\'), i2 = path.indexOf('/'), j2 = path.indexOf('\\'), idx = i > j ? i : j, idx2 = i > j ? i2 : j2;
        return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
    }(resourcePath) : null, fileDependencies = context.fileDependencies, contextDependencies = context.contextDependencies, missingDependencies = context.missingDependencies, buildDependencies = context.buildDependencies, loaderContext = {};
    loaderContext.loaders = context.loaderItems.map((item)=>LoaderObject.__from_binding(item, compiler)), loaderContext.hot = context.hot, loaderContext.context = contextDirectory, loaderContext.resourcePath = resourcePath, loaderContext.resourceQuery = resourceQuery, loaderContext.resourceFragment = resourceFragment, loaderContext.dependency = loaderContext.addDependency = function(file) {
        fileDependencies.push(file);
    }, loaderContext.addContextDependency = function(context) {
        contextDependencies.push(context);
    }, loaderContext.addMissingDependency = function(context) {
        missingDependencies.push(context);
    }, loaderContext.addBuildDependency = function(file) {
        buildDependencies.push(file);
    }, loaderContext.getDependencies = function() {
        return fileDependencies.slice();
    }, loaderContext.getContextDependencies = function() {
        return contextDependencies.slice();
    }, loaderContext.getMissingDependencies = function() {
        return missingDependencies.slice();
    }, loaderContext.clearDependencies = function() {
        fileDependencies.length = 0, contextDependencies.length = 0, missingDependencies.length = 0, context.cacheable = !0;
    }, loaderContext.importModule = function(request, userOptions, callback) {
        JavaScriptTracer.startAsync({
            name: 'importModule',
            processName: LOADER_PROCESS_NAME,
            uuid,
            args: {
                is_pitch: pitch,
                resource: resource
            }
        });
        let options = userOptions || {};
        function finalCallback(onError, onDone) {
            return function(err, res) {
                if (err) JavaScriptTracer.endAsync({
                    name: 'importModule',
                    processName: LOADER_PROCESS_NAME,
                    uuid,
                    args: {
                        is_pitch: pitch,
                        resource: resource
                    }
                }), onError(err);
                else {
                    for (let dep of res.buildDependencies)loaderContext.addBuildDependency(dep);
                    for (let dep of res.contextDependencies)loaderContext.addContextDependency(dep);
                    for (let dep of res.missingDependencies)loaderContext.addMissingDependency(dep);
                    for (let dep of res.fileDependencies)loaderContext.addDependency(dep);
                    !1 === res.cacheable && loaderContext.cacheable(!1), JavaScriptTracer.endAsync({
                        name: 'importModule',
                        processName: LOADER_PROCESS_NAME,
                        uuid,
                        args: {
                            is_pitch: pitch,
                            resource: resource
                        }
                    }), res.error ? onError(compiler.__internal__takeModuleExecutionResult(res.id) ?? Error(res.error)) : onDone(compiler.__internal__takeModuleExecutionResult(res.id));
                }
            };
        }
        return callback ? compiler._lastCompilation.__internal_getInner().importModule(request, options.layer, options.publicPath, options.baseUri, loaderContext._module.identifier(), loaderContext.context, finalCallback((err)=>callback(err), (res)=>callback(void 0, res))) : new Promise((resolve, reject)=>{
            compiler._lastCompilation.__internal_getInner().importModule(request, options.layer, options.publicPath, options.baseUri, loaderContext._module.identifier(), loaderContext.context, finalCallback(reject, resolve));
        });
    }, Object.defineProperty(loaderContext, 'resource', {
        enumerable: !0,
        get: ()=>{
            if (void 0 !== loaderContext.resourcePath) return loaderContext.resourcePath.replace(/#/g, '\u200b#') + loaderContext.resourceQuery.replace(/#/g, '\u200b#') + loaderContext.resourceFragment;
        },
        set: (value)=>{
            let splittedResource = value && parsePathQueryFragment(value);
            loaderContext.resourcePath = splittedResource ? splittedResource.path : void 0, loaderContext.resourceQuery = splittedResource ? splittedResource.query : void 0, loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : void 0;
        }
    }), Object.defineProperty(loaderContext, 'request', {
        enumerable: !0,
        get: ()=>loaderContext.loaders.map((o)=>o.request).concat(loaderContext.resource || '').join('!')
    }), Object.defineProperty(loaderContext, 'remainingRequest', {
        enumerable: !0,
        get: ()=>loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource ? '' : loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
    }), Object.defineProperty(loaderContext, 'currentRequest', {
        enumerable: !0,
        get: ()=>loaderContext.loaders.slice(loaderContext.loaderIndex).map((o)=>o.request).concat(loaderContext.resource || '').join('!')
    }), Object.defineProperty(loaderContext, 'previousRequest', {
        enumerable: !0,
        get: ()=>loaderContext.loaders.slice(0, loaderContext.loaderIndex).map((o)=>o.request).join('!')
    }), Object.defineProperty(loaderContext, 'query', {
        enumerable: !0,
        get: ()=>{
            let entry = loaderContext.loaders[loaderContext.loaderIndex];
            return entry.options && 'object' == typeof entry.options ? entry.options : entry.query;
        }
    }), loaderContext.version = 2, loaderContext.sourceMap = compiler.options.devtool ? isUseSourceMap(compiler.options.devtool) : context._module.useSourceMap ?? !1, loaderContext.mode = compiler.options.mode, Object.assign(loaderContext, compiler.options.loader);
    let getResolveContext = ()=>({
            fileDependencies: {
                add: (d)=>{
                    loaderContext.addDependency(d);
                }
            },
            contextDependencies: {
                add: (d)=>{
                    loaderContext.addContextDependency(d);
                }
            },
            missingDependencies: {
                add: (d)=>{
                    loaderContext.addMissingDependency(d);
                }
            }
        }), getResolver = memoize(()=>compiler._lastCompilation.resolverFactory.get('normal'));
    loaderContext.resolve = function(context, request, callback) {
        getResolver().resolve({}, context, request, getResolveContext(), callback);
    }, loaderContext.getResolve = function(options) {
        let resolver = getResolver(), child = options ? resolver.withOptions(options) : resolver;
        return (context, request, callback)=>callback ? void child.resolve({}, context, request, getResolveContext(), callback) : new Promise((resolve, reject)=>{
                child.resolve({}, context, request, getResolveContext(), (err, result)=>{
                    err ? reject(err) : resolve(result);
                });
            });
    }, loaderContext.getLogger = function(name) {
        return compiler._lastCompilation.getLogger([
            name,
            resource
        ].filter(Boolean).join('|'));
    }, loaderContext.rootContext = compiler.context, loaderContext.emitError = function(e) {
        e instanceof Error || (e = new NonErrorEmittedError(e));
        let error = new ModuleError(e, {
            from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
        });
        error.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
            error,
            severity: binding_namespaceObject.JsRspackSeverity.Error
        });
    }, loaderContext.emitWarning = function(e) {
        e instanceof Error || (e = new NonErrorEmittedError(e));
        let warning = new ModuleWarning(e, {
            from: stringifyLoaderObject(loaderContext.loaders[loaderContext.loaderIndex])
        });
        warning.module = loaderContext._module, compiler._lastCompilation.__internal__pushRspackDiagnostic({
            error: warning,
            severity: binding_namespaceObject.JsRspackSeverity.Warn
        });
    }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
        var devtool;
        let source;
        sourceMap ? ('string' == typeof sourceMap && (loaderContext.sourceMap || compiler.options.devtool && (devtool = compiler.options.devtool) && devtool.includes('source-map') && !isUseSourceMap(devtool)) && (source = new index_js_namespaceObject.OriginalSource(content, makePathsRelative(contextDirectory, sourceMap, compiler))), loaderContext.sourceMap && (source = new index_js_namespaceObject.SourceMapSource(content, name, makePathsRelative(contextDirectory, sourceMap, compiler)))) : source = new index_js_namespaceObject.RawSource(content), loaderContext._module.emitFile(name, source, assetInfo);
    }, loaderContext.fs = compiler.inputFileSystem, loaderContext.experiments = {
        emitDiagnostic: (diagnostic)=>{
            let d = Object.assign({}, diagnostic, {
                message: 'warning' === diagnostic.severity ? `ModuleWarning: ${diagnostic.message}` : `ModuleError: ${diagnostic.message}`,
                moduleIdentifier: context._module.identifier()
            });
            compiler._lastCompilation.__internal__pushDiagnostic((0, binding_namespaceObject.formatDiagnostic)(d));
        }
    };
    let getAbsolutify = memoize(()=>absolutify.bindCache(compiler.root)), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, compiler.root)), getContextify = memoize(()=>contextify.bindCache(compiler.root)), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, compiler.root));
    loaderContext.utils = {
        absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
        contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
        createHash: (type)=>createHash_createHash(type || compiler._lastCompilation.outputOptions.hashFunction)
    }, loaderContext._compiler = compiler, loaderContext._compilation = compiler._lastCompilation, loaderContext._module = context._module, loaderContext.getOptions = ()=>{
        let loader = getCurrentLoader(loaderContext), options = loader?.options;
        if ('string' == typeof options) if (options.startsWith('{') && options.endsWith('}')) try {
            options = JSON.parse(options);
        } catch (e) {
            throw Error(`JSON parsing failed for loader's string options: ${e.message}`);
        }
        else options = node_querystring.parse(options);
        return null == options && (options = {}), options;
    };
    let compilation = compiler._lastCompilation, step = 0;
    for(; compilation;)if (binding_namespaceObject.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext, loaderContext._module), compilation = compilation.compiler.parentCompilation, ++step > 1000) throw Error('Too many nested child compiler, exceeded max limitation 1000');
    Object.defineProperty(loaderContext, 'loaderIndex', {
        enumerable: !0,
        get: ()=>context.loaderIndex,
        set: (loaderIndex)=>context.loaderIndex = loaderIndex
    }), Object.defineProperty(loaderContext, 'cacheable', {
        enumerable: !0,
        get: ()=>(cacheable)=>{
                !1 === cacheable && (context.cacheable = cacheable);
            }
    }), Object.defineProperty(loaderContext, 'data', {
        enumerable: !0,
        get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
        set: (data)=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data = data
    }), loaderContext.__internal__setParseMeta = (key, value)=>{
        context.__internal__parseMeta[key] = value;
    };
    let enableParallelism = (currentLoaderObject)=>currentLoaderObject?.parallel, isomorphoicRun = async (fn, args)=>{
        let result, currentLoaderObject = getCurrentLoader(loaderContext), parallelism = enableParallelism(currentLoaderObject), pitch = loaderState === binding_namespaceObject.JsLoaderState.Pitching, loaderName = function(loaderPath, cwd = '') {
            let res = loaderPath.replace(cwd, '');
            if (!node_path.isAbsolute(res)) return res;
            let nms = '/node_modules/', idx = res.lastIndexOf(nms);
            if (-1 !== idx) {
                res = res.slice(idx + nms.length);
                let ln = 'loader', lnIdx = res.lastIndexOf(ln);
                lnIdx > -1 && (res = res.slice(0, lnIdx + ln.length));
            }
            return res;
        }(currentLoaderObject.request);
        if (JavaScriptTracer.startAsync({
            name: loaderName,
            trackName: loaderName,
            processName: LOADER_PROCESS_NAME,
            uuid,
            args: {
                is_pitch: pitch,
                resource: resource
            }
        }), parallelism) {
            let normalModule, workerLoaderContext;
            result = await service_run(loaderName, {
                loaderContext: (normalModule = loaderContext._module instanceof binding_namespaceObject.NormalModule ? loaderContext._module : void 0, Object.assign(workerLoaderContext = {
                    hot: loaderContext.hot,
                    context: loaderContext.context,
                    resourcePath: loaderContext.resourcePath,
                    resourceQuery: loaderContext.resourceQuery,
                    resourceFragment: loaderContext.resourceFragment,
                    resource: loaderContext.resource,
                    mode: loaderContext.mode,
                    sourceMap: loaderContext.sourceMap,
                    rootContext: loaderContext.rootContext,
                    loaderIndex: loaderContext.loaderIndex,
                    loaders: loaderContext.loaders.map((item)=>{
                        let options = item.options;
                        return (!item.parallel || item.request.startsWith(BUILTIN_LOADER_PREFIX)) && (options = void 0), {
                            ...item,
                            options,
                            pitch: void 0,
                            normal: void 0,
                            normalExecuted: item.normalExecuted,
                            pitchExecuted: item.pitchExecuted
                        };
                    }),
                    __internal__workerInfo: {
                        hashFunction: compiler._lastCompilation.outputOptions.hashFunction
                    },
                    _compiler: {
                        options: {
                            experiments: {
                                css: !0
                            }
                        }
                    },
                    _compilation: {
                        options: {
                            output: {
                                environment: compiler._lastCompilation.outputOptions.environment
                            }
                        },
                        outputOptions: {
                            hashSalt: compiler._lastCompilation.outputOptions.hashSalt,
                            hashFunction: compiler._lastCompilation.outputOptions.hashFunction,
                            hashDigest: compiler._lastCompilation.outputOptions.hashDigest,
                            hashDigestLength: compiler._lastCompilation.outputOptions.hashDigestLength
                        }
                    },
                    _module: {
                        type: loaderContext._module.type,
                        identifier: loaderContext._module.identifier(),
                        matchResource: normalModule?.matchResource,
                        request: normalModule?.request,
                        userRequest: normalModule?.userRequest,
                        rawRequest: normalModule?.rawRequest
                    }
                }, compiler.options.loader), workerLoaderContext),
                loaderState,
                args
            }, {
                handleIncomingRequest (requestType, ...args) {
                    switch(requestType){
                        case "AddDependency":
                            loaderContext.addDependency(args[0]);
                            break;
                        case "AddContextDependency":
                            loaderContext.addContextDependency(args[0]);
                            break;
                        case "AddMissingDependency":
                            loaderContext.addMissingDependency(args[0]);
                            break;
                        case "AddBuildDependency":
                            loaderContext.addBuildDependency(args[0]);
                            break;
                        case "GetDependencies":
                            return loaderContext.getDependencies();
                        case "GetContextDependencies":
                            return loaderContext.getContextDependencies();
                        case "GetMissingDependencies":
                            return loaderContext.getMissingDependencies();
                        case "ClearDependencies":
                            loaderContext.clearDependencies();
                            break;
                        case "Resolve":
                            return new Promise((resolve, reject)=>{
                                loaderContext.resolve(args[0], args[1], (err, result)=>{
                                    err ? reject(err) : resolve(result);
                                });
                            });
                        case "GetResolve":
                            return new Promise((resolve, reject)=>{
                                loaderContext.getResolve(args[0])(args[1], args[2], (err, result)=>{
                                    err ? reject(err) : resolve(result);
                                });
                            });
                        case "GetLogger":
                            {
                                let [type, name, arg] = args;
                                loaderContext.getLogger(name)[type](...arg);
                                break;
                            }
                        case "EmitError":
                            {
                                let workerError = args[0], error = Error(workerError.message);
                                error.stack = workerError.stack, error.name = workerError.name, loaderContext.emitError(error);
                                break;
                            }
                        case "EmitWarning":
                            {
                                let workerError = args[0], error = Error(workerError.message);
                                error.stack = workerError.stack, error.name = workerError.name, loaderContext.emitWarning(error);
                                break;
                            }
                        case "EmitFile":
                            {
                                let [name, content, sourceMap, assetInfo] = args;
                                loaderContext.emitFile(name, content, sourceMap, assetInfo);
                                break;
                            }
                        case "EmitDiagnostic":
                            {
                                let diagnostic = args[0];
                                loaderContext.experiments.emitDiagnostic(diagnostic);
                                break;
                            }
                        case "SetCacheable":
                            {
                                let cacheable = args[0];
                                loaderContext.cacheable(cacheable);
                                break;
                            }
                        case "ImportModule":
                            return loaderContext.importModule(args[0], args[1]);
                        case "UpdateLoaderObjects":
                            {
                                let updates = args[0];
                                loaderContext.loaders = loaderContext.loaders.map((item, index)=>{
                                    let update = updates[index];
                                    return item.loaderItem.data = update.data, update.pitchExecuted && (item.pitchExecuted = !0), update.normalExecuted && (item.normalExecuted = !0), item;
                                });
                                break;
                            }
                        case "CompilationGetPath":
                            {
                                let filename = args[0], data = args[1];
                                return compiler._lastCompilation.getPath(filename, data);
                            }
                        case "CompilationGetPathWithInfo":
                            {
                                let filename = args[0], data = args[1];
                                return compiler._lastCompilation.getPathWithInfo(filename, data);
                            }
                        case "CompilationGetAssetPath":
                            {
                                let filename = args[0], data = args[1];
                                return compiler._lastCompilation.getAssetPath(filename, data);
                            }
                        case "CompilationGetAssetPathWithInfo":
                            {
                                let filename = args[0], data = args[1];
                                return compiler._lastCompilation.getAssetPathWithInfo(filename, data);
                            }
                        default:
                            throw Error(`Unknown request type: ${requestType}`);
                    }
                }
            }, 'object' == typeof currentLoaderObject?.parallel ? currentLoaderObject.parallel : void 0) || [];
        } else loaderState === binding_namespaceObject.JsLoaderState.Normal && function(args, raw) {
            if (!raw && args[0] instanceof Uint8Array) {
                var buf;
                let isShared, str;
                args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === 'SharedArrayBuffer', 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
            } else raw && 'string' == typeof args[0] && (args[0] = Buffer.from(args[0], 'utf-8'));
            raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
        }(args, !!currentLoaderObject?.raw), result = await utils_runSyncOrAsync(fn, loaderContext, args) || [];
        return JavaScriptTracer.endAsync({
            name: loaderName,
            trackName: loaderName,
            processName: LOADER_PROCESS_NAME,
            uuid,
            args: {
                is_pitch: pitch,
                resource: resource
            }
        }), result;
    };
    try {
        switch(loaderState){
            case binding_namespaceObject.JsLoaderState.Pitching:
                for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
                    let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex], parallelism = enableParallelism(currentLoaderObject);
                    if (currentLoaderObject.shouldYield()) break;
                    if (currentLoaderObject.pitchExecuted) {
                        loaderContext.loaderIndex += 1;
                        continue;
                    }
                    await utils_loadLoader(currentLoaderObject, compiler);
                    let fn = currentLoaderObject.pitch;
                    if (parallelism && fn || (currentLoaderObject.pitchExecuted = !0), !fn) continue;
                    let args = await isomorphoicRun(fn, [
                        loaderContext.remainingRequest,
                        loaderContext.previousRequest,
                        currentLoaderObject.loaderItem.data
                    ]);
                    if (args.some((value)=>void 0 !== value)) {
                        let [content, sourceMap, additionalData] = args;
                        context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = serializeObject(sourceMap), context.additionalData = additionalData || void 0;
                        break;
                    }
                }
                break;
            case binding_namespaceObject.JsLoaderState.Normal:
                {
                    let content = context.content, sourceMap = JsSourceMap.__from_binding(context.sourceMap), additionalData = context.additionalData;
                    for(; loaderContext.loaderIndex >= 0;){
                        let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex], parallelism = enableParallelism(currentLoaderObject);
                        if (currentLoaderObject.shouldYield()) break;
                        if (currentLoaderObject.normalExecuted) {
                            loaderContext.loaderIndex--;
                            continue;
                        }
                        await utils_loadLoader(currentLoaderObject, compiler);
                        let fn = currentLoaderObject.normal;
                        parallelism && fn || (currentLoaderObject.normalExecuted = !0), fn && ([content, sourceMap, additionalData] = await isomorphoicRun(fn, [
                            content,
                            sourceMap,
                            additionalData
                        ]));
                    }
                    context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = JsSourceMap.__to_binding(sourceMap), context.additionalData = additionalData || void 0, context.__internal__utf8Hint = 'string' == typeof content;
                    break;
                }
            default:
                throw Error(`Unexpected loader runner state: ${loaderState}`);
        }
        context.loaderItems = loaderContext.loaders.map((item)=>LoaderObject.__to_binding(item));
    } catch (e) {
        if ('object' != typeof e || null === e) {
            let error = Error(`(Emitted value instead of an instance of Error) ${e}`);
            error.name = 'NonErrorEmittedError', context.__internal__error = error;
        } else context.__internal__error = e;
    }
    return JavaScriptTracer.endAsync({
        name: 'run_js_loaders',
        uuid,
        args: {
            is_pitch: pitch,
            resource: resource
        }
    }), compiler.options?.cache && Object.keys(buildInfo = context._module.buildInfo).some((key)=>!knownBuildInfoFields.has(key)) && buildInfo[binding_default().COMMIT_CUSTOM_FIELDS_SYMBOL](), context;
}
let loader_runner_PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
function parsePathQueryFragment(str) {
    let match = loader_runner_PATH_QUERY_FRAGMENT_REGEXP.exec(str);
    return {
        path: match?.[1].replace(/\u200b(.)/g, '$1') || '',
        query: match?.[2] ? match[2].replace(/\u200b(.)/g, '$1') : '',
        fragment: match?.[3] || ''
    };
}
let BUILTIN_LOADER_PREFIX = 'builtin:';
function createRawModuleRuleUses(uses, path, options) {
    var uses1, path1, options1;
    let normalizeRuleSetUseItem = (item)=>'string' == typeof item ? {
            loader: item
        } : item;
    return uses1 = Array.isArray(uses) ? [
        ...uses
    ].map(normalizeRuleSetUseItem) : [
        normalizeRuleSetUseItem(uses)
    ], path1 = path, options1 = options, uses1.length ? uses1.filter(Boolean).map((use, index)=>{
        let o, isBuiltin = !1;
        if (use.loader.startsWith(BUILTIN_LOADER_PREFIX)) {
            let temp = function(identifier, o, options) {
                if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}swc-loader`)) return ((o, composeOptions)=>{
                    let options = o ?? {};
                    if ('object' == typeof options) {
                        var options1;
                        if (options.jsc ??= {}, options.jsc.experimental ??= {}, options.jsc.experimental.disableAllLints ??= !0, options.env?.targets === void 0 && options.jsc?.target === void 0) {
                            if (composeOptions.compiler.target?.targets) options.env ??= {}, options.env.targets ??= function(targets) {
                                let REMAP = {
                                    and_chr: 'chrome',
                                    and_ff: 'firefox',
                                    ie_mob: 'ie',
                                    ios_saf: 'ios',
                                    op_mob: 'opera',
                                    and_qq: null,
                                    and_uc: null,
                                    baidu: null,
                                    bb: null,
                                    kaios: null,
                                    op_mini: null
                                }, result = {};
                                for (let [k, version] of Object.entries(targets)){
                                    let remap = REMAP[k];
                                    null !== remap && (result[remap || k] = version);
                                }
                                return result;
                            }(composeOptions.compiler.target.targets);
                            else if (composeOptions.compiler.target?.esVersion) {
                                let { esVersion } = composeOptions.compiler.target;
                                options.jsc.target ??= esVersion >= 2015 ? `es${esVersion}` : 'es5';
                            }
                        }
                        options.collectTypeScriptInfo && (options.collectTypeScriptInfo = {
                            typeExports: (options1 = options.collectTypeScriptInfo).typeExports,
                            exportedEnum: !0 === options1.exportedEnum ? 'all' : !1 === options1.exportedEnum || void 0 === options1.exportedEnum ? 'none' : 'const-only'
                        }), options.transformImport && (options.transformImport = resolvePluginImport(options.transformImport));
                        let { rspackExperiments } = options;
                        rspackExperiments && (rspackExperiments.import || rspackExperiments.pluginImport) && (rspackExperiments.import = resolvePluginImport(rspackExperiments.import || rspackExperiments.pluginImport));
                    }
                    return options;
                })(o, options);
                if (identifier.startsWith(`${BUILTIN_LOADER_PREFIX}lightningcss-loader`)) {
                    let options1;
                    return 'object' == typeof (options1 = o ?? {}) && ('string' == typeof options1.targets ? options1.targets = [
                        options1.targets
                    ] : 'object' != typeof options1.targets || Array.isArray(options1.targets) ? void 0 === options1.targets && options.compiler.target?.targets && (options1.targets = defaultTargetsFromRspackTargets(options.compiler.target.targets)) : options1.targets = encodeTargets(options1.targets), options1.include && 'object' == typeof options1.include && (options1.include = toFeatures(options1.include)), options1.exclude && 'object' == typeof options1.exclude && (options1.exclude = toFeatures(options1.exclude))), options1;
                }
                return o;
            }(use.loader, use.options, options1);
            o = isNil(temp) ? void 0 : 'string' == typeof temp ? temp : JSON.stringify(temp, null, 2), isBuiltin = !0;
        }
        return {
            loader: function(use, path, compiler, isBuiltin) {
                let obj = parsePathQueryFragment(use.loader), ident = use.ident;
                null === use.options || void 0 === use.options || ('string' == typeof use.options ? obj.query = `?${use.options}` : use.ident ? obj.query = `??${ident = use.ident}` : 'object' == typeof use.options && use.options.ident ? obj.query = `??${ident = use.options.ident}` : 'object' == typeof use.options ? obj.query = `??${ident = path}` : obj.query = `?${JSON.stringify(use.options)}`);
                let parallelism = use.parallel;
                if (parallelism && (!use.options || 'object' != typeof use.options)) throw Error(`\`Rule.use.parallel\` requires \`Rule.use.options\` to be an object.\nHowever the received value is \`${use.options}\` under option path \`${path}\`\nInternally, parallelism is provided by passing \`Rule.use.ident\` to the loader as an identifier to ident the parallelism option\nYou can either replace the \`Rule.use.loader\` with \`Rule.use.options = {}\` or remove \`Rule.use.parallel\`.`);
                return use.options && 'object' == typeof use.options && (ident || (ident = '[[missing ident]]'), compiler.__internal__ruleSet.references.set(ident, use.options), compiler.__internal__ruleSet.references.set(`${ident}$$parallelism`, parallelism), isBuiltin && compiler.__internal__ruleSet.builtinReferences.set(ident, use.options)), obj.path + obj.query + obj.fragment;
            }(use, `${path1}[${index}]`, options1.compiler, isBuiltin),
            options: o
        };
    }) : [];
}
function isUseSourceMap(devtool) {
    return !!devtool && devtool.includes('source-map') && (devtool.includes('module') || !devtool.includes('cheap'));
}
function getRawAlias(alias = {}) {
    return !('object' != typeof alias || null === alias || Array.isArray(alias)) && Object.entries(alias).map(([key, value])=>({
            path: key,
            redirect: Array.isArray(value) ? value : [
                value
            ]
        }));
}
function getRawResolve(resolve) {
    var byDependency;
    return {
        ...resolve,
        alias: getRawAlias(resolve.alias),
        fallback: getRawAlias(resolve.fallback),
        extensionAlias: function(alias = {}) {
            if ('object' == typeof alias && null !== alias) return Object.fromEntries(Object.entries(alias).map(([key, value])=>Array.isArray(value) ? [
                    key,
                    value
                ] : [
                    key,
                    [
                        value
                    ]
                ]));
        }(resolve.extensionAlias),
        tsconfig: function(tsConfig) {
            if ('string' == typeof tsConfig) throw Error('should resolve string tsConfig in normalization');
            if (void 0 === tsConfig) return tsConfig;
            let { configFile, references } = tsConfig;
            return {
                configFile,
                referencesType: 'auto' === references ? 'auto' : references ? 'manual' : 'disabled',
                references: 'auto' === references ? void 0 : references
            };
        }(resolve.tsConfig),
        byDependency: void 0 === (byDependency = resolve.byDependency) ? byDependency : Object.fromEntries(Object.entries(byDependency).map(([k, v])=>[
                k,
                getRawResolve(v)
            ]))
    };
}
function tryMatch(payload, condition) {
    if ('string' == typeof condition) return payload.startsWith(condition);
    if (condition instanceof RegExp) return condition.test(payload);
    if ('function' == typeof condition) return condition(payload);
    if (Array.isArray(condition)) return condition.some((c)=>tryMatch(payload, c));
    if (condition && 'object' == typeof condition) {
        if (condition.and) return condition.and.every((c)=>tryMatch(payload, c));
        if (condition.or) return condition.or.some((c)=>tryMatch(payload, c));
        if (condition.not) return !tryMatch(payload, condition.not);
    }
    return !1;
}
let getRawModuleRule = (rule, path, options, upperType)=>{
    let funcUse, normalizedUse = rule.loader ? [
        {
            loader: rule.loader,
            options: rule.options
        }
    ] : rule.use;
    'function' == typeof normalizedUse && (funcUse = (rawContext)=>createRawModuleRuleUses(normalizedUse({
            ...rawContext,
            compiler: options.compiler
        }) ?? [], `${path}.use`, options));
    let rawModuleRule = {
        test: rule.test ? getRawRuleSetCondition(rule.test) : void 0,
        include: rule.include ? getRawRuleSetCondition(rule.include) : void 0,
        exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : void 0,
        issuer: rule.issuer ? getRawRuleSetCondition(rule.issuer) : void 0,
        issuerLayer: rule.issuerLayer ? getRawRuleSetCondition(rule.issuerLayer) : void 0,
        dependency: rule.dependency ? getRawRuleSetCondition(rule.dependency) : void 0,
        phase: rule.phase ? getRawRuleSetCondition(rule.phase) : void 0,
        descriptionData: rule.descriptionData ? Object.fromEntries(Object.entries(rule.descriptionData).map(([k, v])=>[
                k,
                getRawRuleSetCondition(v)
            ])) : void 0,
        with: rule.with ? Object.fromEntries(Object.entries(rule.with).map(([k, v])=>[
                k,
                getRawRuleSetCondition(v)
            ])) : void 0,
        resource: rule.resource ? getRawRuleSetCondition(rule.resource) : void 0,
        resourceQuery: rule.resourceQuery ? getRawRuleSetCondition(rule.resourceQuery) : void 0,
        resourceFragment: rule.resourceFragment ? getRawRuleSetCondition(rule.resourceFragment) : void 0,
        scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
        mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
        sideEffects: rule.sideEffects,
        use: 'function' == typeof normalizedUse ? funcUse : createRawModuleRuleUses(normalizedUse ?? [], `${path}.use`, options),
        type: rule.type,
        layer: rule.layer,
        parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
        generator: rule.generator ? getRawGeneratorOptions(rule.generator, rule.type ?? upperType) : void 0,
        resolve: rule.resolve ? getRawResolve(rule.resolve) : void 0,
        oneOf: rule.oneOf ? rule.oneOf.filter(Boolean).map((rule, index)=>getRawModuleRule(rule, `${path}.oneOf[${index}]`, options, rule.type ?? upperType)) : void 0,
        rules: rule.rules ? rule.rules.filter(Boolean).map((rule, index)=>getRawModuleRule(rule, `${path}.rules[${index}]`, options, rule.type ?? upperType)) : void 0,
        enforce: rule.enforce,
        extractSourceMap: rule.extractSourceMap
    };
    return ('function' == typeof rule.test || 'function' == typeof rule.resource || 'function' == typeof rule.resourceQuery || 'function' == typeof rule.resourceFragment) && (delete rawModuleRule.test, delete rawModuleRule.resource, delete rawModuleRule.resourceQuery, delete rawModuleRule.resourceFragment, rawModuleRule.rspackResource = getRawRuleSetCondition((resourceQueryFragment)=>{
        let { path, query, fragment } = parseResource(resourceQueryFragment);
        return (!rule.test || !!tryMatch(path, rule.test)) && (!rule.resource || !!tryMatch(path, rule.resource)) && (!rule.resourceQuery || !!tryMatch(query, rule.resourceQuery)) && (!rule.resourceFragment || !!tryMatch(fragment, rule.resourceFragment));
    })), rawModuleRule;
};
function getRawRuleSetCondition(condition) {
    if ('string' == typeof condition) return {
        type: binding_namespaceObject.RawRuleSetConditionType.string,
        string: condition
    };
    if (condition instanceof RegExp) return {
        type: binding_namespaceObject.RawRuleSetConditionType.regexp,
        regexp: condition
    };
    if ('function' == typeof condition) return {
        type: binding_namespaceObject.RawRuleSetConditionType.func,
        func: condition
    };
    if (Array.isArray(condition)) return {
        type: binding_namespaceObject.RawRuleSetConditionType.array,
        array: condition.map((i)=>getRawRuleSetCondition(i))
    };
    if ('object' == typeof condition && null !== condition) {
        var logical;
        return {
            type: binding_namespaceObject.RawRuleSetConditionType.logical,
            logical: [
                {
                    and: (logical = condition).and ? logical.and.map((i)=>getRawRuleSetCondition(i)) : void 0,
                    or: logical.or ? logical.or.map((i)=>getRawRuleSetCondition(i)) : void 0,
                    not: logical.not ? getRawRuleSetCondition(logical.not) : void 0
                }
            ]
        };
    }
    throw Error('unreachable: condition should be one of string, RegExp, Array, Object');
}
function getRawParserOptions(parser, type) {
    var parser1, parser2, parser3;
    if ('asset' === type) {
        return {
            type: 'asset',
            asset: {
                dataUrlCondition: (parser1 = parser).dataUrlCondition ? function(dataUrlCondition) {
                    if ('object' == typeof dataUrlCondition && null !== dataUrlCondition) return {
                        type: 'options',
                        options: {
                            maxSize: dataUrlCondition.maxSize
                        }
                    };
                    throw Error(`unreachable: AssetParserDataUrl type should be one of "options", but got ${dataUrlCondition}`);
                }(parser1.dataUrlCondition) : void 0
            }
        };
    }
    if ("javascript" === type) return {
        type: "javascript",
        javascript: getRawJavascriptParserOptions(parser)
    };
    if ("javascript/auto" === type) return {
        type: "javascript/auto",
        javascript: getRawJavascriptParserOptions(parser)
    };
    if ("javascript/dynamic" === type) return {
        type: "javascript/dynamic",
        javascript: getRawJavascriptParserOptions(parser)
    };
    if ("javascript/esm" === type) return {
        type: "javascript/esm",
        javascript: getRawJavascriptParserOptions(parser)
    };
    if ('css' === type) {
        return {
            type: 'css',
            css: {
                namedExports: (parser2 = parser).namedExports,
                url: parser2.url,
                import: parser2.import,
                resolveImport: parser2.resolveImport
            }
        };
    }
    if ('css/auto' === type) return {
        type: 'css/auto',
        cssAuto: getRawCssAutoOrModuleParserOptions(parser)
    };
    if ('css/global' === type) return {
        type: 'css/global',
        cssGlobal: getRawCssModuleParserOptions(parser)
    };
    if ('css/module' === type) return {
        type: 'css/module',
        cssModule: getRawCssAutoOrModuleParserOptions(parser)
    };
    if ('json' === type) {
        return {
            type: 'json',
            json: {
                exportsDepth: (parser3 = parser).exportsDepth,
                parse: 'function' == typeof parser3.parse ? (str)=>JSON.stringify(parser3.parse(str)) : void 0
            }
        };
    }
    throw Error(`unreachable: unknown module type: ${type}`);
}
function getRawJavascriptParserOptions(parser) {
    return {
        dynamicImportMode: parser.dynamicImportMode,
        dynamicImportPreload: parser.dynamicImportPreload?.toString(),
        dynamicImportPrefetch: parser.dynamicImportPrefetch?.toString(),
        dynamicImportFetchPriority: parser.dynamicImportFetchPriority,
        importMeta: 'boolean' == typeof parser.importMeta ? String(parser.importMeta) : parser.importMeta,
        url: parser.url?.toString(),
        exprContextCritical: parser.exprContextCritical,
        unknownContextCritical: parser.unknownContextCritical,
        wrappedContextCritical: parser.wrappedContextCritical,
        strictThisContextOnImports: parser.strictThisContextOnImports,
        wrappedContextRegExp: parser.wrappedContextRegExp,
        exportsPresence: !1 === parser.exportsPresence ? 'false' : parser.exportsPresence,
        importExportsPresence: !1 === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
        reexportExportsPresence: !1 === parser.reexportExportsPresence ? 'false' : parser.reexportExportsPresence,
        worker: 'boolean' == typeof parser.worker ? parser.worker ? [
            '...'
        ] : [] : parser.worker,
        overrideStrict: parser.overrideStrict,
        requireAsExpression: parser.requireAsExpression,
        requireAlias: parser.requireAlias,
        requireDynamic: parser.requireDynamic,
        requireResolve: parser.requireResolve,
        commonjs: parser.commonjs,
        importDynamic: parser.importDynamic,
        commonjsMagicComments: parser.commonjsMagicComments,
        typeReexportsPresence: parser.typeReexportsPresence,
        jsx: parser.jsx,
        deferImport: parser.deferImport,
        sourceImport: parser.sourceImport,
        importMetaResolve: parser.importMetaResolve,
        pureFunctions: parser.pureFunctions
    };
}
function getRawCssModuleParserOptions(parser) {
    return {
        namedExports: parser.namedExports,
        url: parser.url,
        import: parser.import,
        resolveImport: parser.resolveImport,
        animation: parser.animation,
        container: parser.container,
        customIdents: parser.customIdents,
        dashedIdents: parser.dashedIdents,
        function: parser.function,
        grid: parser.grid
    };
}
function getRawCssAutoOrModuleParserOptions(parser) {
    return {
        ...getRawCssModuleParserOptions(parser),
        pure: parser.pure
    };
}
function getRawGeneratorOptions(generator, type) {
    var options, options1;
    if ('asset' === type) {
        return {
            type: 'asset',
            asset: generator ? {
                ...getRawAssetInlineGeneratorOptions(options = generator),
                ...getRawAssetResourceGeneratorOptions(options)
            } : void 0
        };
    }
    if ('asset/inline' === type) return {
        type: 'asset/inline',
        assetInline: generator ? getRawAssetInlineGeneratorOptions(generator) : void 0
    };
    if ('asset/resource' === type) return {
        type: 'asset/resource',
        assetResource: generator ? getRawAssetResourceGeneratorOptions(generator) : void 0
    };
    if ('css' === type) {
        return {
            type: 'css',
            css: {
                exportsOnly: (options1 = generator).exportsOnly,
                esModule: options1.esModule
            }
        };
    }
    if ('css/auto' === type) return {
        type: 'css/auto',
        cssAuto: getRawCssAutoOrModuleGeneratorOptions(generator)
    };
    if ('css/global' === type) return {
        type: 'css/global',
        cssGlobal: getRawCssAutoOrModuleGeneratorOptions(generator)
    };
    if ('css/module' === type) return {
        type: 'css/module',
        cssModule: getRawCssAutoOrModuleGeneratorOptions(generator)
    };
    if ('json' === type) return {
        type: 'json',
        json: {
            JSONParse: generator.JSONParse
        }
    };
    if (![
        'asset/source',
        'asset/bytes',
        "javascript",
        "javascript/auto",
        "javascript/dynamic",
        "javascript/esm"
    ].includes(type)) throw Error(`unreachable: unknown module type: ${type}`);
}
function getRawAssetInlineGeneratorOptions(options) {
    return {
        dataUrl: options.dataUrl ? function(dataUrl) {
            if ('object' == typeof dataUrl && null !== dataUrl) return {
                encoding: !1 === dataUrl.encoding ? 'false' : dataUrl.encoding,
                mimetype: dataUrl.mimetype
            };
            if ('function' == typeof dataUrl && null !== dataUrl) return (source, context)=>dataUrl(source, context);
            throw Error(`unreachable: AssetGeneratorDataUrl type should be one of "options", "function", but got ${dataUrl}`);
        }(options.dataUrl) : void 0,
        binary: options.binary
    };
}
function getRawAssetResourceGeneratorOptions(options) {
    return {
        emit: options.emit,
        filename: options.filename,
        outputPath: options.outputPath,
        publicPath: options.publicPath,
        importMode: options.importMode,
        binary: options.binary
    };
}
function getRawCssAutoOrModuleGeneratorOptions(options) {
    return {
        localIdentName: options.localIdentName,
        localIdentHashDigest: options.localIdentHashDigest,
        localIdentHashDigestLength: options.localIdentHashDigestLength,
        localIdentHashFunction: options.localIdentHashFunction,
        localIdentHashSalt: options.localIdentHashSalt,
        exportsConvention: options.exportsConvention,
        exportsOnly: options.exportsOnly,
        esModule: options.esModule
    };
}
class ExternalsPlugin extends RspackBuiltinPlugin {
    type;
    externals;
    placeInInitial;
    fallbackType;
    name = binding_namespaceObject.BuiltinPluginName.ExternalsPlugin;
    #resolveRequestCache = new Map();
    constructor(type, externals, placeInInitial, fallbackType){
        super(), this.type = type, this.externals = externals, this.placeInInitial = placeInInitial, this.fallbackType = fallbackType;
    }
    raw() {
        let type = this.type, externals = this.externals, raw = {
            type,
            fallbackType: this.fallbackType,
            externals: (Array.isArray(externals) ? externals : [
                externals
            ]).filter(Boolean).map((item)=>this.#getRawExternalItem(item)),
            placeInInitial: this.placeInInitial ?? !1
        };
        return createBuiltinPlugin(this.name, raw);
    }
    #processResolveResult = (text)=>{
        if (!text) return;
        let resolveRequest = this.#resolveRequestCache.get(text);
        return resolveRequest || (resolveRequest = JSON.parse(text), this.#resolveRequestCache.set(text, resolveRequest)), Object.assign({}, resolveRequest);
    };
    #processRequest(req) {
        return `${req.path.replace(/#/g, '\u200b#')}${req.query.replace(/#/g, '\u200b#')}${req.fragment}`;
    }
    #getRawExternalItem = (item)=>{
        if ('string' == typeof item || item instanceof RegExp) return item;
        if ('function' == typeof item) {
            let processResolveResult = this.#processResolveResult;
            return async (ctx)=>new Promise((resolve, reject)=>{
                    let data = ctx.data(), promise = item({
                        request: data.request,
                        dependencyType: data.dependencyType,
                        context: data.context,
                        contextInfo: {
                            issuer: data.contextInfo.issuer,
                            issuerLayer: data.contextInfo.issuerLayer ?? null
                        },
                        getResolve: (options)=>{
                            let rawResolve = options ? getRawResolve(options) : void 0, resolve = ctx.getResolve(rawResolve);
                            return (context, request, callback)=>{
                                if (!callback) return new Promise((promiseResolve, promiseReject)=>{
                                    resolve(context, request, (error, text)=>{
                                        if (error) promiseReject(error);
                                        else {
                                            let req = processResolveResult(text);
                                            promiseResolve(req ? this.#processRequest(req) : void 0);
                                        }
                                    });
                                });
                                resolve(context, request, (error, text)=>{
                                    if (error) callback(error);
                                    else {
                                        let req = processResolveResult(text);
                                        callback(null, !!req && this.#processRequest(req), req);
                                    }
                                });
                            };
                        }
                    }, (err, result, type)=>{
                        err && reject(err), resolve({
                            result: getRawExternalItemValueFormFnResult(result),
                            externalType: type
                        });
                    });
                    promise?.then ? promise.then((result)=>resolve({
                            result: getRawExternalItemValueFormFnResult(result),
                            externalType: void 0
                        }), (e)=>reject(e)) : 1 === item.length && resolve({
                        result: getRawExternalItemValueFormFnResult(promise),
                        externalType: void 0
                    });
                });
        }
        if ('object' == typeof item) return Object.fromEntries(Object.entries(item).map(([k, v])=>[
                k,
                getRawExternalItemValue(v)
            ]));
        throw TypeError(`Unexpected type of external item: ${typeof item}`);
    };
}
function getRawExternalItemValueFormFnResult(result) {
    return void 0 === result ? result : getRawExternalItemValue(result);
}
function getRawExternalItemValue(value) {
    return value && 'object' == typeof value && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).map(([k, v])=>[
            k,
            Array.isArray(v) ? v : [
                v
            ]
        ])) : value;
}
let FetchCompileAsyncWasmPlugin = base_create(binding_namespaceObject.BuiltinPluginName.FetchCompileAsyncWasmPlugin, ()=>{}, 'thisCompilation'), FileUriPlugin = base_create(binding_namespaceObject.BuiltinPluginName.FileUriPlugin, ()=>{}, 'compilation'), FlagDependencyExportsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.FlagDependencyExportsPlugin, ()=>{}, 'compilation');
class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
    global;
    name = binding_namespaceObject.BuiltinPluginName.FlagDependencyUsagePlugin;
    affectedHooks = 'compilation';
    constructor(global){
        super(), this.global = global;
    }
    raw() {
        return createBuiltinPlugin(this.name, this.global);
    }
}
let HashedModuleIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.HashedModuleIdsPlugin, (options)=>({
        ...options
    }), 'compilation');
class HotModuleReplacementPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.HotModuleReplacementPlugin;
    raw(compiler) {
        return void 0 === compiler.options.output.strictModuleErrorHandling && (compiler.options.output.strictModuleErrorHandling = !0), createBuiltinPlugin(this.name, void 0);
    }
}
let HttpExternalsRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.HttpExternalsRspackPlugin, (webAsync)=>({
        webAsync
    })), HttpUriPlugin_require = createRequire(import.meta.url), getHttp = memoize(()=>HttpUriPlugin_require('node:http')), getHttps = memoize(()=>HttpUriPlugin_require('node:https')), defaultHttpClientForNode = async (url, headers)=>{
    let { res, body } = await function(url, options) {
        let send = 'https:' === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } = HttpUriPlugin_require('node:zlib');
        return new Promise((resolve, reject)=>{
            send.get(url, options, (res)=>{
                let contentEncoding = res.headers['content-encoding'], stream = res;
                'gzip' === contentEncoding ? stream = stream.pipe(createGunzip()) : 'br' === contentEncoding ? stream = stream.pipe(createBrotliDecompress()) : 'deflate' === contentEncoding && (stream = stream.pipe(createInflate()));
                let chunks = [];
                stream.on('data', (chunk)=>{
                    chunks.push(chunk);
                }), stream.on('end', ()=>{
                    let bodyBuffer = Buffer.concat(chunks);
                    res.complete ? resolve({
                        res,
                        body: bodyBuffer
                    }) : reject(Error(`${url} request was terminated early`));
                });
            }).on('error', reject);
        });
    }(url, {
        headers
    }), responseHeaders = {};
    for (let [key, value] of Object.entries(res.headers))Array.isArray(value) ? responseHeaders[key] = value.join(', ') : responseHeaders[key] = value;
    return {
        status: res.statusCode,
        headers: responseHeaders,
        body: Buffer.from(body)
    };
};
class HttpUriPlugin extends RspackBuiltinPlugin {
    options;
    name = binding_namespaceObject.BuiltinPluginName.HttpUriPlugin;
    affectedHooks = 'compilation';
    constructor(options){
        super(), this.options = options;
    }
    raw(compiler) {
        let options = this.options, lockfileLocation = options.lockfileLocation ?? node_path.join(compiler.context, compiler.name ? `${compiler.name}.rspack.lock` : 'rspack.lock'), cacheLocation = !1 === options.cacheLocation ? void 0 : options.cacheLocation ?? `${lockfileLocation}.data`, raw = {
            allowedUris: options.allowedUris,
            lockfileLocation,
            cacheLocation,
            upgrade: options.upgrade ?? !1,
            httpClient: options.httpClient ?? defaultHttpClientForNode
        };
        return createBuiltinPlugin(this.name, raw);
    }
}
let compilationOptionsMap = new WeakMap(), hooks_compilationHooksMap = new WeakMap(), plugin_require = createRequire(import.meta.url), HTML_PLUGIN_UID = 0, HtmlRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.HtmlRspackPlugin, function(c = {}) {
    let templateFn, templateParameters, filenames, uid = HTML_PLUGIN_UID++, meta = {};
    for(let key in c.meta){
        let value = c.meta[key];
        'string' == typeof value ? meta[key] = {
            name: key,
            content: value
        } : meta[key] = {
            name: key,
            ...value
        };
    }
    let scriptLoading = c.scriptLoading ?? 'defer', configInject = c.inject ?? !0, base = 'string' == typeof c.base ? {
        href: c.base
    } : c.base, chunksSortMode = c.chunksSortMode ?? 'auto', compilation = null;
    function generateRenderData(data) {
        let json = JSON.parse(data);
        'function' != typeof c.templateParameters && (json.compilation = compilation);
        let renderTag = function() {
            var tag;
            let attributes;
            return tag = this, attributes = Object.keys(tag.attributes || {}).filter((attributeName)=>'' === tag.attributes[attributeName] || tag.attributes[attributeName]).map((attributeName)=>'true' === tag.attributes[attributeName] ? attributeName : `${attributeName}="${tag.attributes[attributeName]}"`), `<${[
                tag.tagName
            ].concat(attributes).join(' ')}${tag.voidTag && !tag.innerHTML ? '/' : ''}>${tag.innerHTML || ''}${tag.voidTag && !tag.innerHTML ? '' : `</${tag.tagName}>`}`;
        }, renderTagList = function() {
            return this.join('');
        };
        if (Array.isArray(json.htmlRspackPlugin?.tags?.headTags)) {
            for (let tag of json.htmlRspackPlugin.tags.headTags)tag.toString = renderTag;
            json.htmlRspackPlugin.tags.headTags.toString = renderTagList;
        }
        if (Array.isArray(json.htmlRspackPlugin?.tags?.bodyTags)) {
            for (let tag of json.htmlRspackPlugin.tags.bodyTags)tag.toString = renderTag;
            json.htmlRspackPlugin.tags.bodyTags.toString = renderTagList;
        }
        return json;
    }
    this.hooks.compilation.tap('HtmlRspackPlugin', (compilationInstance)=>{
        var compilation1;
        let optionsMap;
        compilation1 = compilation = compilationInstance, (optionsMap = compilationOptionsMap.get(compilation1) || {})[uid] = c, compilationOptionsMap.set(compilation1, optionsMap);
    }), this.hooks.done.tap('HtmlRspackPlugin', (stats)=>{
        var compilation, compilation1;
        let optionsMap;
        compilation = stats.compilation, hooks_compilationHooksMap.delete(compilation), compilation1 = stats.compilation, optionsMap = compilationOptionsMap.get(compilation1) || {}, delete optionsMap[uid], 0 === Object.keys(optionsMap).length ? compilationOptionsMap.delete(compilation1) : compilationOptionsMap.set(compilation1, optionsMap);
    });
    let templateContent = c.templateContent;
    if ('function' == typeof templateContent) templateFn = async (data)=>{
        try {
            let renderer = c.templateContent;
            if (!1 === c.templateParameters) return await renderer({});
            return await renderer(generateRenderData(data));
        } catch (e) {
            let error = Error(`HtmlRspackPlugin: render template function failed, ${e.message}`);
            throw error.stack = e.stack, error;
        }
    }, templateContent = '';
    else if (c.template) {
        let filename = c.template.split('?')[0];
        [
            '.js',
            '.cjs'
        ].includes(node_path.extname(filename)) && (templateFn = async (data)=>{
            let context = this.options.context || process.cwd(), templateFilePath = node_path.resolve(context, filename);
            if (!node_fs.existsSync(templateFilePath)) throw Error(`HtmlRspackPlugin: could not load file \`${filename}\` from \`${context}\``);
            try {
                let renderer = plugin_require(templateFilePath);
                if (!1 === c.templateParameters) return await renderer({});
                return await renderer(generateRenderData(data));
            } catch (e) {
                let error = Error(`HtmlRspackPlugin: render template function failed, ${e.message}`);
                throw error.stack = e.stack, error;
            }
        });
    }
    let rawTemplateParameters = c.templateParameters;
    if (templateParameters = 'function' == typeof rawTemplateParameters ? async (data)=>JSON.stringify(await rawTemplateParameters(JSON.parse(data))) : rawTemplateParameters, 'string' == typeof c.filename) if (filenames = new Set(), c.filename.includes('[name]')) if ('object' == typeof this.options.entry) for (let entryName of Object.keys(this.options.entry))filenames.add(c.filename.replace(/\[name\]/g, entryName));
    else throw Error('HtmlRspackPlugin: filename with `[name]` does not support function entry');
    else filenames.add(c.filename);
    else if ('function' == typeof c.filename) if (filenames = new Set(), 'object' == typeof this.options.entry) for (let entryName of Object.keys(this.options.entry))filenames.add(c.filename(entryName));
    else throw Error('HtmlRspackPlugin: function filename does not support function entry');
    return {
        filename: filenames ? Array.from(filenames) : void 0,
        template: c.template,
        hash: c.hash,
        title: c.title,
        favicon: c.favicon,
        publicPath: c.publicPath,
        chunks: c.chunks,
        excludeChunks: c.excludeChunks,
        chunksSortMode,
        minify: c.minify,
        meta,
        scriptLoading,
        inject: !0 === configInject ? 'blocking' === scriptLoading ? 'body' : 'head' : !1 === configInject ? 'false' : configInject,
        base,
        templateFn,
        templateContent,
        templateParameters,
        uid
    };
}), voidTags = [
    'area',
    'base',
    'br',
    'col',
    'embed',
    'hr',
    'img',
    'input',
    'keygen',
    'link',
    'meta',
    'param',
    'source',
    'track',
    'wbr'
];
HtmlRspackPlugin.createHtmlTagObject = (tagName, attributes, innerHTML)=>({
        tagName,
        voidTag: voidTags.includes(tagName),
        attributes: attributes || {},
        innerHTML
    }), HtmlRspackPlugin.getCompilationHooks = (compilation)=>{
    checkCompilation(compilation);
    let hooks = hooks_compilationHooksMap.get(compilation);
    return void 0 === hooks && (hooks = {
        beforeAssetTagGeneration: new AsyncSeriesWaterfallHook([
            'data'
        ]),
        alterAssetTags: new AsyncSeriesWaterfallHook([
            'data'
        ]),
        alterAssetTagGroups: new AsyncSeriesWaterfallHook([
            'data'
        ]),
        afterTemplateExecution: new AsyncSeriesWaterfallHook([
            'data'
        ]),
        beforeEmit: new AsyncSeriesWaterfallHook([
            'data'
        ]),
        afterEmit: new AsyncSeriesWaterfallHook([
            'data'
        ])
    }, hooks_compilationHooksMap.set(compilation, hooks)), hooks;
}, HtmlRspackPlugin.version = 5;
let IgnorePlugin = base_create(binding_namespaceObject.BuiltinPluginName.IgnorePlugin, (options)=>options), InferAsyncModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.InferAsyncModulesPlugin, ()=>{}, 'compilation'), InlineExportsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.InlineExportsPlugin, ()=>{}, 'compilation'), JavascriptModulesPlugin_compilationHooksMap = new WeakMap();
class JavascriptModulesPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.JavascriptModulesPlugin;
    affectedHooks = 'compilation';
    raw() {
        return createBuiltinPlugin(this.name, void 0);
    }
    static getCompilationHooks(compilation) {
        checkCompilation(compilation);
        let hooks = JavascriptModulesPlugin_compilationHooksMap.get(compilation);
        return void 0 === hooks && (hooks = {
            chunkHash: new SyncHook([
                'chunk',
                'hash'
            ])
        }, JavascriptModulesPlugin_compilationHooksMap.set(compilation, hooks)), hooks;
    }
}
let JsLoaderRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.JsLoaderRspackPlugin, (compiler)=>runLoaders.bind(null, compiler), 'thisCompilation'), JsonModulesPlugin = base_create(binding_namespaceObject.BuiltinPluginName.JsonModulesPlugin, ()=>{}, 'compilation'), LibManifestPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LibManifestPlugin, (options)=>{
    let { context, entryOnly, format, name, path, type } = options;
    return {
        context,
        entryOnly,
        format,
        name,
        path,
        type
    };
}), LightningCssMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LightningCssMinimizerRspackPlugin, function(options) {
    let { include, exclude, nonStandard, pseudoClasses, drafts } = options?.minimizerOptions ?? {}, targets = [
        'fully supports es6'
    ];
    return options?.minimizerOptions?.targets ? 'string' == typeof options.minimizerOptions.targets ? targets = [
        options.minimizerOptions.targets
    ] : Array.isArray(options.minimizerOptions.targets) ? targets = options.minimizerOptions.targets : 'object' == typeof options.minimizerOptions.targets && (targets = encodeTargets(options.minimizerOptions.targets)) : this.target.targets && (targets = defaultTargetsFromRspackTargets(this.target.targets)), {
        test: options?.test,
        include: options?.include,
        exclude: options?.exclude,
        removeUnusedLocalIdents: options?.removeUnusedLocalIdents ?? !0,
        minimizerOptions: {
            errorRecovery: options?.minimizerOptions?.errorRecovery ?? !0,
            unusedSymbols: options?.minimizerOptions?.unusedSymbols ?? [],
            include: include ? toFeatures(include) : void 0,
            exclude: exclude ? toFeatures(exclude) : void 0,
            targets,
            drafts: drafts ? {
                customMedia: drafts.customMedia ?? !1
            } : void 0,
            nonStandard: nonStandard ? {
                deepSelectorCombinator: nonStandard.deepSelectorCombinator ?? !1
            } : void 0,
            pseudoClasses
        }
    };
}), LimitChunkCountPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LimitChunkCountPlugin, (options)=>options), BuiltinLazyCompilationPlugin = base_create(binding_namespaceObject.BuiltinPluginName.LazyCompilationPlugin, (currentActiveModules, entries, imports, client, reservedExternals, test)=>({
        imports,
        entries,
        test,
        client,
        currentActiveModules,
        reservedExternals
    }), 'thisCompilation'), middleware_require = createRequire(import.meta.url), LAZY_COMPILATION_PREFIX = '/_rspack/lazy/trigger', noop = (_req, _res, next)=>{
    'function' == typeof next && next();
}, lazyCompilationMiddleware = (compiler)=>{
    if (compiler instanceof MultiCompiler) {
        let middlewareByCompiler = new Map(), i = 0;
        for (let c of compiler.compilers){
            if (!c.options.lazyCompilation) continue;
            let options = {
                ...c.options.lazyCompilation
            }, prefix = options.prefix || LAZY_COMPILATION_PREFIX;
            options.prefix = `${prefix}__${i++}`;
            let activeModules = new Set();
            middlewareByCompiler.set(options.prefix, lazyCompilationMiddlewareInternal(compiler, activeModules, options.prefix)), applyPlugin(c, options, activeModules);
        }
        let keys = [
            ...middlewareByCompiler.keys()
        ];
        return (req, res, next)=>{
            let key = keys.find((key)=>req.url?.startsWith(key));
            if (!key) return next?.();
            let middleware = middlewareByCompiler.get(key);
            return middleware?.(req, res, next);
        };
    }
    if (!compiler.options.lazyCompilation) return noop;
    let activeModules = new Set(), options = {
        ...compiler.options.lazyCompilation
    };
    return applyPlugin(compiler, options, activeModules), lazyCompilationMiddlewareInternal(compiler, activeModules, options.prefix || LAZY_COMPILATION_PREFIX);
};
function applyPlugin(compiler, options, activeModules) {
    new BuiltinLazyCompilationPlugin(()=>{
        let res = new Set(activeModules);
        return activeModules.clear(), res;
    }, options.entries ?? !0, options.imports ?? !0, `${options.client || middleware_require.resolve(`../hot/lazy-compilation-${compiler.options.externalsPresets.node ? 'node' : 'web'}.js`)}?${encodeURIComponent((({ serverUrl, prefix })=>{
        let lazyCompilationPrefix = prefix || LAZY_COMPILATION_PREFIX;
        return serverUrl ? serverUrl + (serverUrl.endsWith('/') ? lazyCompilationPrefix.slice(1) : lazyCompilationPrefix) : lazyCompilationPrefix;
    })(options))}`, function(externals) {
        let requests = new Set(), visit = (item)=>{
            if ('string' == typeof item) return void requests.add(item);
            if (item && 'object' == typeof item && !(item instanceof RegExp)) for (let [request, value] of Object.entries(item))!1 !== value && requests.add(request);
        };
        if (Array.isArray(externals)) for (let item of externals)visit(item);
        else void 0 !== externals && visit(externals);
        return [
            ...requests
        ];
    }(compiler.options.externals), options.test).apply(compiler);
}
let lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilationPrefix)=>{
    let logger = compiler.getInfrastructureLogger('LazyCompilation');
    return async (req, res, next)=>{
        if (!req.url?.startsWith(lazyCompilationPrefix) || 'POST' !== req.method) return next?.();
        let modules = [];
        try {
            modules = await function(req) {
                if (void 0 !== req.body) {
                    if (Array.isArray(req.body)) return Promise.resolve(req.body);
                    if ('string' == typeof req.body) return Promise.resolve(req.body.split('\n').filter(Boolean));
                    throw Error('Invalid body type');
                }
                return new Promise((resolve, reject)=>{
                    if (req.aborted || req.destroyed) return void reject(Error('Request was aborted before body could be read'));
                    let cleanup = ()=>{
                        req.removeListener('data', onData), req.removeListener('end', onEnd), req.removeListener('error', onError), req.removeListener('close', onClose), req.removeListener('aborted', onAborted);
                    }, chunks = [], onData = (chunk)=>{
                        chunks.push(chunk);
                    }, onEnd = ()=>{
                        cleanup(), resolve(Buffer.concat(chunks).toString('utf8').split('\n').filter(Boolean));
                    }, onError = (err)=>{
                        cleanup(), reject(err);
                    }, onClose = ()=>{
                        cleanup(), reject(Error('Request was closed before body could be read'));
                    }, onAborted = ()=>{
                        cleanup(), reject(Error('Request was aborted before body could be read'));
                    };
                    req.on('data', onData), req.on('end', onEnd), req.on('error', onError), req.on('close', onClose), req.on('aborted', onAborted);
                });
            }(req);
        } catch (err) {
            logger.error(`Failed to parse request body: ${err}`), res.writeHead(400), res.end('Bad Request');
            return;
        }
        let moduleActivated = [];
        for (let key of modules){
            let activated = activeModules.has(key);
            activeModules.add(key), activated || (logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
        }
        moduleActivated.length && compiler.watching && compiler.watching.invalidate(), res.writeHead(200), res.write('\n'), res.end();
    };
};
class MangleExportsPlugin extends RspackBuiltinPlugin {
    deterministic;
    name = binding_namespaceObject.BuiltinPluginName.MangleExportsPlugin;
    affectedHooks = 'compilation';
    constructor(deterministic){
        super(), this.deterministic = deterministic;
    }
    raw() {
        return createBuiltinPlugin(this.name, this.deterministic);
    }
}
let MergeDuplicateChunksPlugin = base_create(binding_namespaceObject.BuiltinPluginName.MergeDuplicateChunksPlugin, ()=>{}), ModuleChunkFormatPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ModuleChunkFormatPlugin, ()=>{});
class ModuleConcatenationPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ModuleConcatenationPlugin;
    affectedHooks = 'compilation';
    raw() {
        return createBuiltinPlugin(this.name, void 0);
    }
}
let ModuleInfoHeaderPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ModuleInfoHeaderPlugin, (verbose)=>verbose, 'compilation'), NamedChunkIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.NamedChunkIdsPlugin, ()=>{}, 'compilation'), NamedModuleIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.NamedModuleIdsPlugin, ()=>{}, 'compilation');
class NaturalChunkIdsPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.NaturalChunkIdsPlugin;
    affectedHooks = 'compilation';
    raw() {
        return createBuiltinPlugin(this.name, void 0);
    }
}
class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.NaturalModuleIdsPlugin;
    affectedHooks = 'compilation';
    raw() {
        return createBuiltinPlugin(this.name, void 0);
    }
}
let NodeTargetPlugin = base_create(binding_namespaceObject.BuiltinPluginName.NodeTargetPlugin, ()=>void 0), NoEmitOnErrorsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.NoEmitOnErrorsPlugin, ()=>void 0), NormalModuleReplacementPlugin = base_create(binding_namespaceObject.BuiltinPluginName.NormalModuleReplacementPlugin, (resourceRegExp, newResource)=>({
        resourceRegExp,
        newResource: 'function' == typeof newResource ? (data)=>(newResource(data), data) : newResource
    })), OccurrenceChunkIdsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.OccurrenceChunkIdsPlugin, (options)=>({
        ...options
    }), 'compilation'), ProgressPlugin = base_create(binding_namespaceObject.BuiltinPluginName.ProgressPlugin, (progress = {})=>'function' == typeof progress ? {
        handler: (percentage, msg, info)=>{
            progress(percentage, msg, info);
        }
    } : progress), ProvidePlugin = base_create(binding_namespaceObject.BuiltinPluginName.ProvidePlugin, (provide)=>Object.fromEntries(Object.entries(provide).map(([key, value])=>('string' == typeof value && (value = [
            value
        ]), [
            key,
            value
        ]))), 'compilation'), RealContentHashPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RealContentHashPlugin, ()=>{}, 'compilation'), RemoveEmptyChunksPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RemoveEmptyChunksPlugin, ()=>{}, 'compilation'), RsdoctorPluginImpl = base_create(binding_namespaceObject.BuiltinPluginName.RsdoctorPlugin, function(c = {
    moduleGraphFeatures: !0,
    chunkGraphFeatures: !0
}) {
    return {
        moduleGraphFeatures: c.moduleGraphFeatures ?? !0,
        chunkGraphFeatures: c.chunkGraphFeatures ?? !0,
        sourceMapFeatures: c.sourceMapFeatures
    };
}), RsdoctorPlugin_compilationHooksMap = new WeakMap();
RsdoctorPluginImpl.getCompilationHooks = (compilation)=>{
    checkCompilation(compilation);
    let hooks = RsdoctorPlugin_compilationHooksMap.get(compilation);
    return void 0 === hooks && (hooks = {
        moduleGraph: new AsyncSeriesBailHook([
            'moduleGraph'
        ]),
        chunkGraph: new AsyncSeriesBailHook([
            'chunkGraph'
        ]),
        moduleIds: new AsyncSeriesBailHook([
            'moduleIdsPatch'
        ]),
        moduleSources: new AsyncSeriesBailHook([
            'moduleSourcesPatch'
        ]),
        assets: new AsyncSeriesBailHook([
            'assetPatch'
        ])
    }, RsdoctorPlugin_compilationHooksMap.set(compilation, hooks)), hooks;
};
let RslibPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RslibPlugin, (rslib)=>rslib), RstestPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RstestPlugin, (rstest)=>rstest), RuntimeChunkPlugin = base_create(binding_namespaceObject.BuiltinPluginName.RuntimeChunkPlugin, (options)=>options, 'thisCompilation'), RuntimePlugin = base_create(binding_default().BuiltinPluginName.RuntimePlugin, ()=>{}, 'compilation'), RuntimePlugin_compilationHooksMap = new WeakMap();
RuntimePlugin.getCompilationHooks = (compilation)=>{
    checkCompilation(compilation);
    let hooks = RuntimePlugin_compilationHooksMap.get(compilation);
    return void 0 === hooks && (hooks = {
        createScript: new SyncWaterfallHook([
            'code',
            'chunk'
        ]),
        createLink: new SyncWaterfallHook([
            'code',
            'chunk'
        ]),
        linkPreload: new SyncWaterfallHook([
            'code',
            'chunk'
        ]),
        linkPrefetch: new SyncWaterfallHook([
            'code',
            'chunk'
        ])
    }, RuntimePlugin_compilationHooksMap.set(compilation, hooks)), hooks;
};
let Coordinator_PLUGIN_NAME = 'RscPlugin', GET_OR_INIT_BINDING = Symbol('GET_OR_INIT_BINDING');
class Coordinator {
    #serverCompiler;
    #clientCompiler;
    #clientLastCompilation;
    #isProxyingClientWatching = !1;
    #binding;
    constructor(){
        Object.defineProperty(this, GET_OR_INIT_BINDING, {
            enumerable: !1,
            configurable: !1,
            writable: !1,
            value: ()=>(this.#binding || (this.#binding = new binding_namespaceObject.JsCoordinator(()=>{
                    if (!this.#serverCompiler) throw Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
                    return this.#serverCompiler[GET_COMPILER_ID]();
                })), this.#binding)
        });
    }
    applyServerCompiler(serverCompiler) {
        this.#serverCompiler = serverCompiler, serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
            this.#isProxyingClientWatching = !0, this.#clientLastCompilation && (stats.compilation.fileDependencies.addAll(this.#clientLastCompilation.fileDependencies), stats.compilation.contextDependencies.addAll(this.#clientLastCompilation.contextDependencies), stats.compilation.missingDependencies.addAll(this.#clientLastCompilation.missingDependencies));
        }), serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
            this.#isProxyingClientWatching && this.#clientCompiler.watching.invalidateWithChangesAndRemovals(new Set(this.#serverCompiler.modifiedFiles), new Set(this.#serverCompiler.removedFiles));
        });
    }
    applyClientCompiler(clientCompiler) {
        this.#clientCompiler = clientCompiler;
        let originalWatch = clientCompiler.watch;
        clientCompiler.watch = function(watchOptions, handler) {
            return watchOptions.ignored = ()=>!0, originalWatch.call(this, watchOptions, handler);
        }, clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
            this.#clientLastCompilation = stats.compilation;
        });
    }
}
class RscClientPlugin extends RspackBuiltinPlugin {
    name = 'RscClientPlugin';
    #options;
    constructor(options){
        super(), this.#options = options;
    }
    raw(compiler) {
        return this.#options.coordinator.applyClientCompiler(compiler), createBuiltinPlugin(this.name, {
            coordinator: this.#options.coordinator[GET_OR_INIT_BINDING]()
        });
    }
}
class RscServerPlugin extends RspackBuiltinPlugin {
    name = 'RscServerPlugin';
    #options;
    constructor(options){
        super(), this.#options = options;
    }
    raw(compiler) {
        let onManifest;
        this.#options.coordinator.applyServerCompiler(compiler);
        let { coordinator, onServerComponentChanges } = this.#options;
        return this.#options.onManifest && (onManifest = (json)=>Promise.resolve(this.#options.onManifest(JSON.parse(json)))), createBuiltinPlugin(this.name, {
            coordinator: coordinator[GET_OR_INIT_BINDING](),
            cssLink: this.#options.cssLink,
            onServerComponentChanges,
            onManifest
        });
    }
}
class SideEffectsFlagPlugin extends RspackBuiltinPlugin {
    analyzeSideEffectsFree;
    name = binding_namespaceObject.BuiltinPluginName.SideEffectsFlagPlugin;
    affectedHooks = 'compilation';
    constructor(analyzeSideEffectsFree = !1){
        super(), this.analyzeSideEffectsFree = analyzeSideEffectsFree;
    }
    raw() {
        return createBuiltinPlugin(this.name, this.analyzeSideEffectsFree);
    }
}
let SizeLimitsPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
    let hints = !1 === options.hints ? void 0 : options.hints;
    return {
        ...options,
        hints
    };
}), SourceMapDevToolPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation'), SubresourceIntegrityPlugin_require = createRequire(import.meta.url), SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin', NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin', HTTP_PROTOCOL_REGEX = /^https?:/, NativeSubresourceIntegrityPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SubresourceIntegrityPlugin, function(options) {
    let htmlPlugin = 'Disabled';
    return options.htmlPlugin === NATIVE_HTML_PLUGIN ? htmlPlugin = 'Native' : 'string' == typeof options.htmlPlugin && (htmlPlugin = 'JavaScript'), {
        hashFuncNames: options.hashFuncNames,
        htmlPlugin,
        integrityCallback: options.integrityCallback
    };
});
class SubresourceIntegrityPlugin extends NativeSubresourceIntegrityPlugin {
    integrities = new Map();
    options;
    constructor(options = {}){
        if ('object' != typeof options) throw Error('SubResourceIntegrity: argument must be an object');
        let finalOptions = {
            hashFuncNames: options.hashFuncNames ?? [
                'sha384'
            ],
            htmlPlugin: options.htmlPlugin ?? NATIVE_HTML_PLUGIN,
            enabled: options.enabled ?? 'auto'
        };
        super({
            ...finalOptions,
            integrityCallback: (data)=>{
                this.integrities = new Map(data.integerities.map((item)=>[
                        item.asset,
                        item.integrity
                    ]));
            }
        }), this.options = finalOptions;
    }
    isEnabled(compiler) {
        return 'auto' === this.options.enabled ? 'development' !== compiler.options.mode : this.options.enabled;
    }
    getIntegrityChecksumForAsset(src) {
        if (this.integrities.has(src)) return this.integrities.get(src);
        let normalizedSrc = normalizePath(src), normalizedKey = Array.from(this.integrities.keys()).find((assetKey)=>normalizePath(assetKey) === normalizedSrc);
        return normalizedKey ? this.integrities.get(normalizedKey) : void 0;
    }
    handleHwpPluginArgs({ assets }) {
        let publicPath = assets.publicPath, jsIntegrity = [];
        for (let asset of assets.js)jsIntegrity.push(this.getIntegrityChecksumForAsset(relative(publicPath, decodeURIComponent(asset))));
        let cssIntegrity = [];
        for (let asset of assets.css)cssIntegrity.push(this.getIntegrityChecksumForAsset(relative(publicPath, decodeURIComponent(asset))));
        assets.jsIntegrity = jsIntegrity, assets.cssIntegrity = cssIntegrity;
    }
    handleHwpBodyTags({ headTags, bodyTags, publicPath }, outputPath, crossOriginLoading) {
        for (let tag of headTags.concat(bodyTags))this.processTag(tag, publicPath, outputPath, crossOriginLoading);
    }
    processTag(tag, publicPath, outputPath, crossOriginLoading) {
        if (tag.attributes && 'integrity' in tag.attributes) return;
        let tagSrc = function(tag) {
            if (tag.attributes) {
                if ("script" === tag.tagName && 'string' == typeof tag.attributes.src) return tag.attributes.src;
                if ('link' === tag.tagName && 'string' == typeof tag.attributes.href) {
                    let rel = tag.attributes.rel;
                    if ('string' != typeof rel) return;
                    return 'stylesheet' === rel || 'modulepreload' === rel || 'preload' === rel && ("script" === tag.attributes.as || 'style' === tag.attributes.as) ? tag.attributes.href : void 0;
                }
            }
        }(tag);
        if (!tagSrc) return;
        let isUrlSrc = !1;
        try {
            let url = new URL(tagSrc);
            isUrlSrc = 'http:' === url.protocol || 'https:' === url.protocol;
        } catch (_) {
            isUrlSrc = tagSrc.startsWith('//');
        }
        let src = '';
        if (isUrlSrc) {
            if (!publicPath || '/' === publicPath || './' === publicPath) return;
            let protocolRelativePublicPath = publicPath.replace(HTTP_PROTOCOL_REGEX, ''), protocolRelativeTagSrc = tagSrc.replace(HTTP_PROTOCOL_REGEX, '');
            if (!protocolRelativeTagSrc.startsWith(protocolRelativePublicPath)) return;
            let tagSrcWithScheme = `http:${protocolRelativeTagSrc}`;
            src = relative(protocolRelativePublicPath.startsWith('//') ? `http:${protocolRelativePublicPath}` : protocolRelativePublicPath, decodeURIComponent(tagSrcWithScheme));
        } else src = relative(publicPath, decodeURIComponent(tagSrc));
        tag.attributes.integrity = this.getIntegrityChecksumForAsset(src) || function(hashFuncNames, source) {
            let { createHash } = SubresourceIntegrityPlugin_require('node:crypto');
            return hashFuncNames.map((hashFuncName)=>`${hashFuncName}-${createHash(hashFuncName).update('string' == typeof source ? Buffer.from(source, 'utf-8') : source).digest('base64')}`).join(' ');
        }(this.options.hashFuncNames, readFileSync(join(outputPath, src))), tag.attributes.crossorigin = crossOriginLoading || 'anonymous';
    }
    apply(compiler) {
        if (this.isEnabled(compiler) && (super.apply(compiler), compiler.hooks.compilation.tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (compilation)=>{
            compilation.hooks.statsFactory.tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (statsFactory)=>{
                statsFactory.hooks.extract.for('asset').tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (object, asset)=>{
                    let contenthash = asset.info?.contenthash;
                    if (contenthash) {
                        let shaHashes = (Array.isArray(contenthash) ? contenthash : [
                            contenthash
                        ]).filter((hash)=>String(hash).match(/^sha[0-9]+-/));
                        shaHashes.length > 0 && (object.integrity = shaHashes.join(' '));
                    }
                });
            });
        }), 'string' == typeof this.options.htmlPlugin && this.options.htmlPlugin !== NATIVE_HTML_PLUGIN)) {
            var htmlPlugin, obj;
            let self = this;
            try {
                let getHooks;
                getHooks = (htmlPlugin = SubresourceIntegrityPlugin_require(this.options.htmlPlugin)).getCompilationHooks || htmlPlugin.getHooks, 'function' == typeof getHooks && compiler.hooks.thisCompilation.tap(SubresourceIntegrityPlugin_PLUGIN_NAME, (compilation)=>{
                    if ('string' == typeof compiler.options.output.chunkLoading && [
                        'require',
                        'async-node'
                    ].includes(compiler.options.output.chunkLoading)) return;
                    let hwpHooks = getHooks(compilation);
                    hwpHooks.beforeAssetTagGeneration.tapPromise(SubresourceIntegrityPlugin_PLUGIN_NAME, (data)=>(self.handleHwpPluginArgs(data), Promise.resolve(data))), hwpHooks.alterAssetTagGroups.tapPromise({
                        name: SubresourceIntegrityPlugin_PLUGIN_NAME,
                        stage: 10000
                    }, (data)=>(self.handleHwpBodyTags(data, compiler.outputPath, compiler.options.output.crossOriginLoading), Promise.resolve(data)));
                });
            } catch (e) {
                if (!((obj = e) instanceof Error && 'code' in obj && [
                    'string',
                    'undefined'
                ].includes(typeof obj.code)) || 'MODULE_NOT_FOUND' !== e.code) throw e;
            }
        }
    }
}
function normalizePath(path) {
    return path.replace(/\?.*$/, '').split(sep).join('/');
}
let SwcJsMinimizerRspackPlugin = base_create(binding_namespaceObject.BuiltinPluginName.SwcJsMinimizerRspackPlugin, function(options) {
    let compress = options?.minimizerOptions?.compress ?? !0, mangle = options?.minimizerOptions?.mangle ?? !0, ecma = options?.minimizerOptions?.ecma ?? (this.target?.esVersion && this.target.esVersion > 2022 ? 2022 : this.target.esVersion) ?? 5, format = {
        comments: !1,
        ...options?.minimizerOptions?.format
    };
    return compress && 'object' == typeof compress ? compress = {
        passes: 2,
        ...compress
    } : compress && (compress = {
        passes: 2
    }), {
        test: options?.test,
        include: options?.include,
        exclude: options?.exclude,
        extractComments: function(extractComments) {
            let type, conditionStr = (condition)=>{
                if (void 0 === condition || !0 === condition) return {
                    source: '@preserve|@lic|@cc_on|^\\**!',
                    flags: ''
                };
                if (!1 === condition) throw Error('unreachable');
                return {
                    source: condition.source,
                    flags: condition.flags
                };
            };
            if ('boolean' == typeof extractComments) {
                if (!extractComments) return;
                let { source, flags } = conditionStr(extractComments);
                return {
                    condition: source,
                    conditionFlags: flags
                };
            }
            if (extractComments instanceof RegExp) {
                let { source, flags } = conditionStr(extractComments);
                return {
                    condition: source,
                    conditionFlags: flags
                };
            }
            if (type = typeof extractComments, null != extractComments && ('object' === type || 'function' === type)) {
                if (!1 === extractComments.condition) return;
                let { source, flags } = conditionStr(extractComments.condition);
                return {
                    condition: source,
                    conditionFlags: flags,
                    banner: extractComments.banner
                };
            }
        }(options?.extractComments),
        minimizerOptions: {
            compress,
            mangle,
            ecma,
            format,
            minify: options?.minimizerOptions?.minify,
            module: options?.minimizerOptions?.module
        }
    };
}, 'compilation');
class SyncModuleIdsPlugin extends RspackBuiltinPlugin {
    options;
    name = binding_namespaceObject.BuiltinPluginName.SyncModuleIdsPlugin;
    affectedHooks = 'compilation';
    constructor(options){
        super(), this.options = options;
    }
    raw() {
        let options = {
            ...this.options
        };
        return createBuiltinPlugin(this.name, options);
    }
}
let URLPlugin = base_create(binding_namespaceObject.BuiltinPluginName.URLPlugin, ()=>{}, 'compilation');
class WorkerPlugin extends RspackBuiltinPlugin {
    chunkLoading;
    wasmLoading;
    module;
    workerPublicPath;
    name = binding_namespaceObject.BuiltinPluginName.WorkerPlugin;
    affectedHooks = 'compilation';
    constructor(chunkLoading, wasmLoading, module, workerPublicPath){
        super(), this.chunkLoading = chunkLoading, this.wasmLoading = wasmLoading, this.module = module, this.workerPublicPath = workerPublicPath;
    }
    raw(compiler) {
        return this.chunkLoading && new EnableChunkLoadingPlugin(this.chunkLoading).apply(compiler), this.wasmLoading && new EnableWasmLoadingPlugin(this.wasmLoading).apply(compiler), createBuiltinPlugin(this.name, void 0);
    }
}
class ContextModuleFactory {
    hooks;
    constructor(){
        this.hooks = {
            beforeResolve: new AsyncSeriesWaterfallHook([
                'resolveData'
            ]),
            afterResolve: new AsyncSeriesWaterfallHook([
                'resolveData'
            ])
        };
    }
}
let FUNCTION_CONTENT_REGEX = /^function(?:\s+[\w$]+)?\s?\(\)\s?\{\r?\n?|\r?\n?\}$/g, INDENT_MULTILINE_REGEX = /^\t/gm, LINE_SEPARATOR_REGEX = /\r?\n/g, IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/, IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g, COMMENT_END_REGEX = /\*\//g, PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\-^°]+/g, MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g;
class Template {
    static getFunctionContent(fn) {
        return fn.toString().replace(FUNCTION_CONTENT_REGEX, '').replace(INDENT_MULTILINE_REGEX, '').replace(LINE_SEPARATOR_REGEX, '\n');
    }
    static toIdentifier(str) {
        return 'string' != typeof str ? '' : str.replace(IDENTIFIER_NAME_REPLACE_REGEX, '_$1').replace(IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX, '_');
    }
    static toComment(str) {
        return str ? `/*! ${str.replace(COMMENT_END_REGEX, '* /')} */` : '';
    }
    static toNormalComment(str) {
        return str ? `/* ${str.replace(COMMENT_END_REGEX, '* /')} */` : '';
    }
    static toPath(str) {
        return 'string' != typeof str ? '' : str.replace(PATH_NAME_NORMALIZE_REPLACE_REGEX, '-').replace(MATCH_PADDED_HYPHENS_REPLACE_REGEX, '');
    }
    static numberToIdentifier(num) {
        let n = num;
        return n >= 54 ? Template.numberToIdentifier(n % 54) + Template.numberToIdentifierContinuation(Math.floor(n / 54)) : n < 26 ? String.fromCharCode(97 + n) : (n -= 26) < 26 ? String.fromCharCode(65 + n) : 26 === n ? '_' : '$';
    }
    static numberToIdentifierContinuation(num) {
        let n = num;
        return n >= 64 ? Template.numberToIdentifierContinuation(n % 64) + Template.numberToIdentifierContinuation(Math.floor(n / 64)) : n < 26 ? String.fromCharCode(97 + n) : (n -= 26) < 26 ? String.fromCharCode(65 + n) : (n -= 26) < 10 ? `${n}` : 10 === n ? '_' : '$';
    }
    static indent(s) {
        if (Array.isArray(s)) return s.map(Template.indent).join('\n');
        let str = s.trimEnd();
        return str ? ('\n' === str[0] ? '' : '\t') + str.replace(/\n([^\n])/g, '\n\t$1') : '';
    }
    static prefix(s, prefix) {
        let str = Template.asString(s).trim();
        return str ? ('\n' === str[0] ? '' : prefix) + str.replace(/\n([^\n])/g, `\n${prefix}$1`) : '';
    }
    static asString(str) {
        return Array.isArray(str) ? str.join('\n') : str;
    }
    static getModulesArrayBounds(modules) {
        let maxId = -1 / 0, minId = 1 / 0;
        for (let module of modules){
            let moduleId = module.id;
            if ('number' != typeof moduleId) return !1;
            maxId < moduleId && (maxId = moduleId), minId > moduleId && (minId = moduleId);
        }
        minId < 16 + `${minId}`.length && (minId = 0);
        let objectOverhead = -1;
        for (let module of modules)objectOverhead += `${module.id}`.length + 2;
        return (0 === minId ? maxId : 16 + `${minId}`.length + maxId) < objectOverhead && [
            minId,
            maxId
        ];
    }
}
function assertNotNill(value) {
    if (null == value) throw Error(`${value} should not be undefined or null`);
}
let DYNAMIC_INFO = Symbol('cleverMerge dynamic info'), mergeCache = new WeakMap(), DELETE = Symbol('DELETE'), cachedCleverMerge = (first, second)=>{
    if (void 0 === second) return first;
    if (void 0 === first || 'object' != typeof second || null === second) return second;
    if ('object' != typeof first || null === first) return first;
    let innerCache = mergeCache.get(first);
    void 0 === innerCache && (innerCache = new WeakMap(), mergeCache.set(first, innerCache));
    let prevMerge = innerCache.get(second);
    if (void 0 !== prevMerge) return prevMerge;
    let newMerge = _cleverMerge(first, second, !0);
    return innerCache.set(second, newMerge), newMerge;
}, parseCache = new WeakMap(), cachedParseObject = (obj)=>{
    let entry = parseCache.get(obj);
    if (void 0 !== entry) return entry;
    let result = parseObject(obj);
    return parseCache.set(obj, result), result;
}, parseObject = (obj)=>{
    let dynamicInfo, info = new Map(), getInfo = (p)=>{
        let entry = info.get(p);
        if (void 0 !== entry) return entry;
        let newEntry = {
            base: void 0,
            byProperty: void 0,
            byValues: new Map()
        };
        return info.set(p, newEntry), newEntry;
    };
    for (let key of Object.keys(obj))if (key.startsWith('by')) {
        let byObj = obj[key];
        if ('object' == typeof byObj) for (let byValue of Object.keys(byObj)){
            let obj = byObj[byValue];
            for (let key1 of Object.keys(obj)){
                let entry = getInfo(key1);
                if (void 0 === entry.byProperty) entry.byProperty = key;
                else if (entry.byProperty !== key) throw Error(`${key} and ${entry.byProperty} for a single property is not supported`);
                if (entry.byValues.set(byValue, obj[key1]), 'default' === byValue) for (let otherByValue of Object.keys(byObj))entry.byValues.has(otherByValue) || entry.byValues.set(otherByValue, void 0);
            }
        }
        else if ('function' == typeof byObj) if (void 0 === dynamicInfo) dynamicInfo = {
            byProperty: key,
            fn: byObj
        };
        else throw Error(`${key} and ${dynamicInfo.byProperty} when both are functions is not supported`);
        else getInfo(key).base = obj[key];
    } else getInfo(key).base = obj[key];
    return {
        static: info,
        dynamic: dynamicInfo
    };
}, cleverMerge_serializeObject = (info, dynamicInfo)=>{
    let obj = {};
    for (let entry of info.values())if (void 0 !== entry.byProperty) {
        let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
        for (let byValue of entry.byValues.keys())byObj[byValue] = byObj[byValue] || {};
    }
    for (let [key, entry] of info)if (void 0 !== entry.base && (obj[key] = entry.base), void 0 !== entry.byProperty) {
        let byObj = obj[entry.byProperty] = obj[entry.byProperty] || {};
        for (let byValue of Object.keys(byObj)){
            let value = getFromByValues(entry.byValues, byValue);
            void 0 !== value && (byObj[byValue][key] = value);
        }
    }
    return void 0 !== dynamicInfo && (obj[dynamicInfo.byProperty] = dynamicInfo.fn), obj;
}, getValueType = (value)=>void 0 === value ? 0 : value === DELETE ? 4 : Array.isArray(value) ? -1 !== value.lastIndexOf('...') ? 2 : 1 : 'object' != typeof value || null === value || value.constructor && value.constructor !== Object ? 1 : 3, cleverMerge = (first, second)=>void 0 === second ? first : void 0 === first || 'object' != typeof second || null === second ? second : 'object' != typeof first || null === first ? first : _cleverMerge(first, second, !1), _cleverMerge = (first, second, internalCaching = !1)=>{
    let firstObject = internalCaching ? cachedParseObject(first) : parseObject(first), { static: firstInfo, dynamic: firstDynamicInfo } = firstObject, secondObj = second;
    if (void 0 !== firstDynamicInfo) {
        let { fn } = firstDynamicInfo, { byProperty } = firstDynamicInfo, fnInfo = fn[DYNAMIC_INFO];
        fnInfo && (secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second), fn = fnInfo[0]);
        let newFn = (...args)=>{
            let fnResult = fn(...args);
            return internalCaching ? cachedCleverMerge(fnResult, secondObj) : cleverMerge(fnResult, secondObj);
        };
        return newFn[DYNAMIC_INFO] = [
            fn,
            secondObj
        ], cleverMerge_serializeObject(firstObject.static, {
            byProperty,
            fn: newFn
        });
    }
    let { static: secondInfo, dynamic: secondDynamicInfo } = internalCaching ? cachedParseObject(second) : parseObject(second), resultInfo = new Map();
    for (let [key, firstEntry] of firstInfo){
        let secondEntry = secondInfo.get(key), entry = void 0 !== secondEntry ? mergeEntries(firstEntry, secondEntry, internalCaching) : firstEntry;
        resultInfo.set(key, entry);
    }
    for (let [key, secondEntry] of secondInfo)firstInfo.has(key) || resultInfo.set(key, secondEntry);
    return cleverMerge_serializeObject(resultInfo, secondDynamicInfo);
}, mergeEntries = (firstEntry, secondEntry, internalCaching)=>{
    switch(getValueType(secondEntry.base)){
        case 1:
        case 4:
            return secondEntry;
        case 0:
            {
                if (!firstEntry.byProperty) return {
                    base: firstEntry.base,
                    byProperty: secondEntry.byProperty,
                    byValues: secondEntry.byValues
                };
                if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
                let newByValues = new Map(firstEntry.byValues);
                for (let [key, value] of secondEntry.byValues){
                    let firstValue = getFromByValues(firstEntry.byValues, key);
                    newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
                }
                return {
                    base: firstEntry.base,
                    byProperty: firstEntry.byProperty,
                    byValues: newByValues
                };
            }
        default:
            {
                let newBase;
                if (!firstEntry.byProperty) return {
                    base: mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching),
                    byProperty: secondEntry.byProperty,
                    byValues: secondEntry.byValues
                };
                let intermediateByValues = new Map(firstEntry.byValues);
                for (let [key, value] of intermediateByValues)intermediateByValues.set(key, mergeSingleValue(value, secondEntry.base, internalCaching));
                if (Array.from(firstEntry.byValues.values()).every((value)=>{
                    let type = getValueType(value);
                    return 1 === type || 4 === type;
                }) ? newBase = mergeSingleValue(firstEntry.base, secondEntry.base, internalCaching) : (newBase = firstEntry.base, intermediateByValues.has('default') || intermediateByValues.set('default', secondEntry.base)), !secondEntry.byProperty) return {
                    base: newBase,
                    byProperty: firstEntry.byProperty,
                    byValues: intermediateByValues
                };
                if (firstEntry.byProperty !== secondEntry.byProperty) throw Error(`${firstEntry.byProperty} and ${secondEntry.byProperty} for a single property is not supported`);
                let newByValues = new Map(intermediateByValues);
                for (let [key, value] of secondEntry.byValues){
                    let firstValue = getFromByValues(intermediateByValues, key);
                    newByValues.set(key, mergeSingleValue(firstValue, value, internalCaching));
                }
                return {
                    base: newBase,
                    byProperty: firstEntry.byProperty,
                    byValues: newByValues
                };
            }
    }
}, getFromByValues = (byValues, key)=>'default' !== key && byValues.has(key) ? byValues.get(key) : byValues.get('default'), mergeSingleValue = (a, b, internalCaching)=>{
    let bType = getValueType(b), aType = getValueType(a);
    switch(bType){
        case 4:
        case 1:
            return b;
        case 3:
            return 3 !== aType ? b : internalCaching ? cachedCleverMerge(a, b) : cleverMerge(a, b);
        case 0:
            return a;
        case 2:
            switch(1 !== aType ? aType : Array.isArray(a) ? 2 : 3){
                case 0:
                    return b;
                case 4:
                    return b.filter((item)=>'...' !== item);
                case 2:
                    {
                        let newArray = [];
                        for (let item of b)if ('...' === item) for (let item of a)newArray.push(item);
                        else newArray.push(item);
                        return newArray;
                    }
                case 3:
                    return b.map((item)=>'...' === item ? a : item);
                default:
                    throw Error('Not implemented');
            }
        default:
            throw Error('Not implemented');
    }
};
class BrowserslistError extends Error {
    constructor(message){
        var key, value;
        super(message), value = void 0, (key = "browserslist") in this ? Object.defineProperty(this, key, {
            value: value,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : this[key] = value, this.name = 'BrowserslistError', this.browserslist = !0, Error.captureStackTrace && Error.captureStackTrace(this, BrowserslistError);
    }
}
let isFileCache = {};
function isFile(file) {
    if (file in isFileCache) return isFileCache[file];
    let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
    return isFileCache[file] = result, result;
}
function parsePackage(file) {
    let config = JSON.parse(node_fs.readFileSync(file).toString().replace(/^\uFEFF/m, ''));
    if (config.browserlist && !config.browserslist) throw new BrowserslistError(`\`browserlist\` key instead of \`browserslist\` in ${file}`);
    let list = config.browserslist;
    for(let i in Array.isArray(list) && (list = {
        defaults: list
    }), 'string' == typeof list && (list = parseConfig(list)), list)!function(section) {
        let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
        if (Array.isArray(section)) {
            for(let i = 0; i < section.length; i++)if ('string' != typeof section[i]) throw new BrowserslistError(FORMAT);
        } else if ('string' != typeof section) throw new BrowserslistError(FORMAT);
    }(list[i]);
    return list;
}
let IS_SECTION = /^\s*\[(.+)]\s*$/;
function parseConfig(string) {
    let result = {
        defaults: []
    }, sections = [
        'defaults'
    ];
    return string.toString().replace(/#[^\n]*/g, '').split(/\n|,/).map((line)=>line.trim()).filter((line)=>'' !== line).forEach((line)=>{
        let matched = line.match(IS_SECTION);
        matched ? (sections = matched[1].trim().split(' ')).forEach((section)=>{
            if (result[section]) throw new BrowserslistError(`Duplicate section ${section} in Browserslist config`);
            result[section] = [];
        }) : sections.forEach((section)=>{
            result[section].push(line);
        });
    }), result;
}
function eachParent(file, callback) {
    let dir = isFile(file) ? node_path.dirname(file) : file, loc = node_path.resolve(dir);
    do {
        let result = callback(loc);
        if (void 0 !== result) return result;
    }while (loc !== (loc = node_path.dirname(loc)));
}
let configCache = {}, ES_VERSIONS_MAP = {
    chrome: [
        51,
        52,
        57,
        64,
        73,
        80,
        85,
        94,
        110,
        119
    ],
    edge: [
        15,
        15,
        15,
        79,
        79,
        80,
        85,
        94,
        110,
        119
    ],
    safari: [
        10,
        10.3,
        11,
        16.4,
        17,
        17,
        17,
        17,
        17,
        17.4
    ],
    firefox: [
        54,
        54,
        54,
        78,
        78,
        80,
        80,
        93,
        115,
        145
    ],
    opera: [
        38,
        39,
        44,
        51,
        60,
        67,
        71,
        80,
        96,
        105
    ],
    samsung: [
        5,
        6.2,
        6.2,
        8.2,
        11.1,
        13,
        14,
        17,
        21,
        25
    ]
}, aliases = {
    ios_saf: 'safari',
    and_chr: 'chrome',
    and_ff: 'firefox'
}, renameBrowser = (name)=>aliases[name] || name, resolveESVersion = (version, thresholds)=>{
    let index = thresholds.findIndex((threshold)=>version < threshold);
    return -1 === index ? 2024 : [
        2015,
        2016,
        2017,
        2018,
        2019,
        2020,
        2021,
        2022,
        2023,
        2024
    ][index - 1] ?? 5;
}, browserslistTargetHandler_resolve = (browsers)=>{
    let rawChecker = (versions)=>browsers.every((v)=>{
            let [name, parsedVersion] = v.split(' ');
            if (!name) return !1;
            let requiredVersion = versions[name];
            if (!requiredVersion) return !1;
            let [parsedMajor, parserMinor] = 'TP' === parsedVersion ? [
                1 / 0,
                1 / 0
            ] : parsedVersion.includes('-') ? parsedVersion.split('-')[0].split('.') : parsedVersion.split('.');
            return 'number' == typeof requiredVersion ? +parsedMajor >= requiredVersion : requiredVersion[0] === +parsedMajor ? +parserMinor >= requiredVersion[1] : +parsedMajor > requiredVersion[0];
        }), anyNode = browsers.some((b)=>b.startsWith('node ')), anyBrowser = browsers.some((b)=>/^(?!node)/.test(b)), browserProperty = !!anyBrowser && (!anyNode || null), nodeProperty = !!anyNode && (!anyBrowser || null), es6DynamicImport = rawChecker({
        chrome: 63,
        and_chr: 63,
        edge: 79,
        firefox: 67,
        and_ff: 67,
        opera: 50,
        op_mob: 46,
        safari: [
            11,
            1
        ],
        ios_saf: [
            11,
            3
        ],
        samsung: [
            8,
            2
        ],
        android: 63,
        and_qq: [
            10,
            4
        ],
        baidu: [
            13,
            18
        ],
        and_uc: [
            15,
            5
        ],
        kaios: [
            3,
            0
        ],
        node: [
            12,
            17
        ]
    });
    return {
        const: rawChecker({
            chrome: 49,
            and_chr: 49,
            edge: 12,
            firefox: 36,
            and_ff: 36,
            opera: 36,
            op_mob: 36,
            safari: [
                10,
                0
            ],
            ios_saf: [
                10,
                0
            ],
            samsung: [
                5,
                0
            ],
            android: 37,
            and_qq: [
                10,
                4
            ],
            baidu: [
                13,
                18
            ],
            and_uc: [
                12,
                12
            ],
            kaios: [
                2,
                5
            ],
            node: [
                6,
                0
            ]
        }),
        methodShorthand: rawChecker({
            chrome: 47,
            and_chr: 47,
            edge: 12,
            firefox: 34,
            and_ff: 34,
            opera: 34,
            op_mob: 34,
            safari: 9,
            ios_saf: 9,
            samsung: 5,
            android: 47,
            and_qq: [
                14,
                9
            ],
            and_uc: [
                15,
                5
            ],
            kaios: [
                2,
                5
            ],
            node: [
                4,
                9
            ]
        }),
        computedProperty: rawChecker({
            chrome: 47,
            and_chr: 47,
            edge: 12,
            firefox: 34,
            and_ff: 34,
            opera: 34,
            op_mob: 34,
            safari: 8,
            ios_saf: 8,
            samsung: 5,
            android: 47,
            and_qq: [
                14,
                9
            ],
            and_uc: [
                15,
                5
            ],
            kaios: [
                2,
                5
            ],
            node: [
                4,
                0
            ]
        }),
        arrowFunction: rawChecker({
            chrome: 45,
            and_chr: 45,
            edge: 12,
            firefox: 39,
            and_ff: 39,
            opera: 32,
            op_mob: 32,
            safari: 10,
            ios_saf: 10,
            samsung: [
                5,
                0
            ],
            android: 45,
            and_qq: [
                10,
                4
            ],
            baidu: [
                7,
                12
            ],
            and_uc: [
                12,
                12
            ],
            kaios: [
                2,
                5
            ],
            node: [
                6,
                0
            ]
        }),
        forOf: rawChecker({
            chrome: 38,
            and_chr: 38,
            edge: 12,
            firefox: 51,
            and_ff: 51,
            opera: 25,
            op_mob: 25,
            safari: 7,
            ios_saf: 7,
            samsung: [
                3,
                0
            ],
            android: 38,
            kaios: [
                3,
                0
            ],
            node: [
                0,
                12
            ]
        }),
        destructuring: rawChecker({
            chrome: 49,
            and_chr: 49,
            edge: 14,
            firefox: 41,
            and_ff: 41,
            opera: 36,
            op_mob: 36,
            safari: 8,
            ios_saf: 8,
            samsung: [
                5,
                0
            ],
            android: 49,
            kaios: [
                2,
                5
            ],
            node: [
                6,
                0
            ]
        }),
        bigIntLiteral: rawChecker({
            chrome: 67,
            and_chr: 67,
            edge: 79,
            firefox: 68,
            and_ff: 68,
            opera: 54,
            op_mob: 48,
            safari: 14,
            ios_saf: 14,
            samsung: [
                9,
                2
            ],
            android: 67,
            and_qq: [
                13,
                1
            ],
            baidu: [
                13,
                18
            ],
            and_uc: [
                15,
                5
            ],
            kaios: [
                3,
                0
            ],
            node: [
                10,
                4
            ]
        }),
        module: rawChecker({
            chrome: 61,
            and_chr: 61,
            edge: 16,
            firefox: 60,
            and_ff: 60,
            opera: 48,
            op_mob: 45,
            safari: [
                10,
                1
            ],
            ios_saf: [
                10,
                3
            ],
            samsung: [
                8,
                0
            ],
            android: 61,
            and_qq: [
                10,
                4
            ],
            baidu: [
                13,
                18
            ],
            and_uc: [
                15,
                5
            ],
            kaios: [
                3,
                0
            ],
            node: [
                12,
                17
            ]
        }),
        dynamicImport: es6DynamicImport,
        dynamicImportInWorker: es6DynamicImport && !anyNode,
        globalThis: rawChecker({
            chrome: 71,
            and_chr: 71,
            edge: 79,
            firefox: 65,
            and_ff: 65,
            opera: 58,
            op_mob: 50,
            safari: [
                12,
                1
            ],
            ios_saf: [
                12,
                2
            ],
            samsung: [
                10,
                1
            ],
            android: 71,
            kaios: [
                3,
                0
            ],
            node: 12
        }),
        optionalChaining: rawChecker({
            chrome: 80,
            and_chr: 80,
            edge: 80,
            firefox: 74,
            and_ff: 79,
            opera: 67,
            op_mob: 64,
            safari: [
                13,
                1
            ],
            ios_saf: [
                13,
                4
            ],
            samsung: 13,
            android: 80,
            kaios: [
                3,
                0
            ],
            node: 14
        }),
        templateLiteral: rawChecker({
            chrome: 41,
            and_chr: 41,
            edge: 13,
            firefox: 34,
            and_ff: 34,
            opera: 29,
            op_mob: 64,
            safari: [
                9,
                1
            ],
            ios_saf: 9,
            samsung: 4,
            android: 41,
            and_qq: [
                10,
                4
            ],
            baidu: [
                7,
                12
            ],
            and_uc: [
                12,
                12
            ],
            kaios: [
                2,
                5
            ],
            node: 4
        }),
        asyncFunction: rawChecker({
            chrome: 55,
            and_chr: 55,
            edge: 15,
            firefox: 52,
            and_ff: 52,
            opera: 42,
            op_mob: 42,
            safari: 11,
            ios_saf: 11,
            samsung: [
                6,
                2
            ],
            android: 55,
            and_qq: [
                13,
                1
            ],
            baidu: [
                13,
                18
            ],
            and_uc: [
                15,
                5
            ],
            kaios: 3,
            node: [
                7,
                6
            ]
        }),
        browser: browserProperty,
        electron: !1,
        node: nodeProperty,
        nwjs: !1,
        web: browserProperty,
        webworker: !1,
        document: browserProperty,
        fetchWasm: browserProperty,
        global: nodeProperty,
        importScripts: !1,
        importScriptsInWorker: !0,
        nodeBuiltins: nodeProperty,
        nodePrefixForCoreModules: nodeProperty && !browsers.some((b)=>b.startsWith('node 15')) && rawChecker({
            node: [
                14,
                18
            ]
        }),
        importMetaDirnameAndFilename: nodeProperty && rawChecker({
            node: [
                22,
                16
            ]
        }),
        require: nodeProperty
    };
}, getBrowserslistTargetHandler = memoize(()=>browserslistTargetHandler_namespaceObject), hasBrowserslistConfig = (context)=>!!function(from) {
        let resolved, fromDir = isFile(from = node_path.resolve(from)) ? node_path.dirname(from) : from;
        if (fromDir in configCache) return configCache[fromDir];
        let configFile = eachParent(from, (dir)=>{
            let pkgBrowserslist, config = node_path.join(dir, 'browserslist'), pkg = node_path.join(dir, 'package.json'), rc = node_path.join(dir, '.browserslistrc');
            if (isFile(pkg)) try {
                pkgBrowserslist = parsePackage(pkg);
            } catch (e) {
                if (e instanceof BrowserslistError) throw e;
                console.warn(`[Browserslist] Could not parse ${pkg}. Ignoring it.`);
            }
            if (isFile(config) && pkgBrowserslist) throw new BrowserslistError(`${dir} contains both browserslist and package.json with browsers`);
            if (isFile(rc) && pkgBrowserslist) throw new BrowserslistError(`${dir} contains both .browserslistrc and package.json with browsers`);
            if (isFile(config) && isFile(rc)) throw new BrowserslistError(`${dir} contains both .browserslistrc and browserslist`);
            return isFile(config) ? config : isFile(rc) ? rc : pkgBrowserslist ? pkg : void 0;
        });
        configFile && (resolved = function(file) {
            if ('package.json' === node_path.basename(file)) return parsePackage(file);
            if (!isFile(file)) throw new BrowserslistError(`Can't read ${file} config`);
            return parseConfig(node_fs.readFileSync(file, 'utf-8'));
        }(configFile));
        let configDir = configFile && node_path.dirname(configFile);
        return eachParent(from, (dir)=>{
            if (resolved && (configCache[dir] = resolved), dir === configDir) return null;
        }), resolved;
    }(context), versionDependent = (major, minor)=>{
    if (!major) return ()=>void 0;
    let nMajor = +major, nMinor = minor ? +minor : 0;
    return (vMajor, vMinor = 0)=>nMajor > vMajor || nMajor === vMajor && nMinor >= vMinor;
}, TARGETS = [
    [
        'browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env',
        "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config",
        /^browserslist(?::(.+))?$/,
        (rest, context)=>{
            let inlineQuery = rest ? rest.trim() : null, browsers = binding_default().loadBrowserslist(inlineQuery, context);
            if (!browsers || !inlineQuery && !hasBrowserslistConfig(context) && !process.env.BROWSERSLIST) throw Error(`No browserslist config found to handle the 'browserslist' target.
See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
            if (Array.isArray(browsers) && 0 === browsers.length) throw Error('Rspack cannot parse the browserslist query. This may happen when the query contains version requirements that exceed the supported range in the browserslist-rs database. Check your browserslist configuration for invalid version numbers.');
            let browserslistTargetHandler = getBrowserslistTargetHandler(), encodedTargets = {};
            for (let p of browsers){
                let [name, v] = p.split(' '), version = encodeVersion(v);
                null !== version && (!encodedTargets[name] || version < encodedTargets[name]) && (encodedTargets[name] = version);
            }
            let targets = Object.fromEntries(Object.entries(encodedTargets).map(([k, v])=>[
                    k,
                    decodeVersion(v)
                ]));
            return {
                ...browserslistTargetHandler.resolve(browsers),
                targets,
                esVersion: function(browsers) {
                    let esVersion = 2024;
                    for (let item of browsers){
                        let pairs = item.split(' ');
                        if (pairs.length < 2) continue;
                        let browser = renameBrowser(pairs[0]), version = Number(pairs[1].split('-')[0]);
                        if (Number.isNaN(version)) continue;
                        if ('ie' === browser || 'android' === browser && version < 6) {
                            esVersion = 5;
                            break;
                        }
                        let versions = ES_VERSIONS_MAP[browser];
                        versions && (esVersion = Math.min(resolveESVersion(version, versions), esVersion));
                    }
                    return esVersion;
                }(browsers)
            };
        }
    ],
    [
        'web',
        'Web browser.',
        /^web$/,
        ()=>({
                web: !0,
                browser: !0,
                webworker: null,
                node: !1,
                electron: !1,
                nwjs: !1,
                document: !0,
                importScriptsInWorker: !0,
                fetchWasm: !0,
                nodeBuiltins: !1,
                importScripts: !1,
                require: !1,
                global: !1
            })
    ],
    [
        'webworker',
        'Web Worker, SharedWorker or Service Worker.',
        /^webworker$/,
        ()=>({
                web: !0,
                browser: !0,
                webworker: !0,
                node: !1,
                electron: !1,
                nwjs: !1,
                importScripts: !0,
                importScriptsInWorker: !0,
                fetchWasm: !0,
                nodeBuiltins: !1,
                require: !1,
                document: !1,
                global: !1
            })
    ],
    [
        '[async-]node[X[.Y]]',
        "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.",
        /^(async-)?node((\d+)(?:\.(\d+))?)?$/,
        (asyncFlag, _, major, minor)=>{
            let v = versionDependent(major, minor);
            return {
                node: !0,
                electron: !1,
                nwjs: !1,
                web: !1,
                webworker: !1,
                browser: !1,
                targets: major ? {
                    node: `${major}${minor ? `.${minor}` : ''}`
                } : {},
                esVersion: v(18) ? 2022 : v(16) ? 2021 : v(14) ? 2020 : v(12) ? 2019 : v(10) ? 2018 : v(8) ? 2017 : v(7) ? 2016 : v(6, 5) ? 2015 : 5,
                require: !asyncFlag,
                nodeBuiltins: !0,
                nodePrefixForCoreModules: 15 > +major ? v(14, 18) : v(16),
                importMetaDirnameAndFilename: v(22, 16),
                global: !0,
                document: !1,
                fetchWasm: !1,
                importScripts: !1,
                importScriptsInWorker: !1,
                globalThis: v(12),
                const: v(6),
                computedProperty: v(4),
                templateLiteral: v(4),
                optionalChaining: v(14),
                methodShorthand: v(4),
                arrowFunction: v(6),
                asyncFunction: v(7, 6),
                forOf: v(5),
                destructuring: v(6),
                bigIntLiteral: v(10, 4),
                dynamicImport: v(12, 17),
                dynamicImportInWorker: !major && void 0,
                module: v(12, 17)
            };
        }
    ],
    [
        'electron[X[.Y]]-main/preload/renderer',
        'Electron in version X.Y. Script is running in main, preload resp. renderer context.',
        /^electron((\d+)(?:\.(\d+))?)?-(main|preload|renderer)$/,
        (_, major, minor, context)=>{
            let v = versionDependent(major, minor);
            return {
                node: !0,
                electron: !0,
                web: 'main' !== context,
                webworker: !1,
                browser: !1,
                nwjs: !1,
                electronMain: 'main' === context,
                electronPreload: 'preload' === context,
                electronRenderer: 'renderer' === context,
                targets: major ? {
                    electron: `${major}${minor ? `.${minor}` : ''}`
                } : {},
                esVersion: v(23) ? 2022 : v(15) ? 2021 : v(12) ? 2020 : v(5) ? 2019 : v(3) ? 2018 : v(1, 8) ? 2017 : v(1, 5) ? 2016 : v(1, 4) ? 2015 : 5,
                global: !0,
                nodeBuiltins: !0,
                nodePrefixForCoreModules: v(15),
                importMetaDirnameAndFilename: v(37),
                require: !0,
                document: 'renderer' === context,
                fetchWasm: 'renderer' === context,
                importScripts: !1,
                importScriptsInWorker: !0,
                globalThis: v(5),
                const: v(1, 1),
                computedProperty: v(1, 1),
                templateLiteral: v(1, 1),
                optionalChaining: v(8),
                methodShorthand: v(1, 1),
                arrowFunction: v(1, 1),
                asyncFunction: v(1, 7),
                forOf: v(0, 36),
                destructuring: v(1, 1),
                bigIntLiteral: v(4),
                dynamicImport: v(11),
                dynamicImportInWorker: !major && void 0,
                module: v(11)
            };
        }
    ],
    [
        'nwjs[X[.Y]] / node-webkit[X[.Y]]',
        'NW.js in version X.Y.',
        /^(?:nwjs|node-webkit)((\d+)(?:\.(\d+))?)?$/,
        (_, major, minor)=>{
            let v = versionDependent(major, minor);
            return {
                node: !0,
                web: !0,
                nwjs: !0,
                webworker: null,
                browser: !1,
                electron: !1,
                targets: major ? {
                    nwjs: `${major}${minor ? `.${minor}` : ''}`
                } : {},
                esVersion: v(0, 65) ? 2022 : v(0, 54) ? 2021 : v(0, 46) ? 2020 : v(0, 39) ? 2019 : v(0, 31) ? 2018 : v(0, 23) ? 2017 : v(0, 20) ? 2016 : v(0, 17) ? 2015 : 5,
                global: !0,
                nodeBuiltins: !0,
                document: !1,
                importScriptsInWorker: !1,
                fetchWasm: !1,
                importScripts: !1,
                require: !1,
                globalThis: v(0, 43),
                const: v(0, 15),
                computedProperty: v(0, 15),
                templateLiteral: v(0, 13),
                optionalChaining: v(0, 44),
                methodShorthand: v(0, 15),
                arrowFunction: v(0, 15),
                asyncFunction: v(0, 21),
                forOf: v(0, 13),
                destructuring: v(0, 15),
                bigIntLiteral: v(0, 32),
                dynamicImport: v(0, 43),
                dynamicImportInWorker: !major && void 0,
                module: v(0, 43)
            };
        }
    ],
    [
        'esX',
        'ECMAScript in this version. Examples: es2020, es5.',
        /^es(\d+)$/,
        (version)=>{
            let v = +version;
            return 5 < v && v < 1000 && (v += 2009), {
                esVersion: v > 2022 ? 2022 : v,
                const: v >= 2015,
                computedProperty: v >= 2015,
                templateLiteral: v >= 2015,
                optionalChaining: v >= 2020,
                methodShorthand: v >= 2015,
                arrowFunction: v >= 2015,
                forOf: v >= 2015,
                destructuring: v >= 2015,
                module: v >= 2015,
                asyncFunction: v >= 2017,
                globalThis: v >= 2020,
                bigIntLiteral: v >= 2020,
                dynamicImport: v >= 2020,
                dynamicImportInWorker: v >= 2020
            };
        }
    ]
], getTargetProperties = (target, context)=>{
    for (let [, , regExp, handler] of TARGETS){
        let match = regExp.exec(target);
        if (match) {
            let [, ...args] = match, result = handler(...args, context);
            if (result) return result;
        }
    }
    throw Error(`Unknown target '${target}'. The following targets are supported:\n${TARGETS.map(([name, description])=>`* ${name}: ${description}`).join('\n')}`);
}, getTargetsProperties = (targets, context)=>((targetProperties)=>{
        let keys = new Set();
        for (let tp of targetProperties)for (let key of Object.keys(tp))keys.add(key);
        let result = {};
        for (let key of keys){
            if ('esVersion' === key) {
                let minVersion;
                for (let tp of targetProperties)'number' == typeof tp.esVersion && (minVersion = void 0 === minVersion ? tp.esVersion : Math.min(minVersion, tp.esVersion));
                void 0 !== minVersion && (result[key] = minVersion);
                continue;
            }
            if ('targets' === key) {
                let merged = {};
                for (let tp of targetProperties)if (tp.targets) for (let [name, version] of Object.entries(tp.targets)){
                    let v = encodeVersion(version);
                    null !== v && (!merged[name] || v < merged[name]) && (merged[name] = v);
                }
                Object.keys(merged).length > 0 && (result[key] = Object.fromEntries(Object.entries(merged).map(([k, v])=>[
                        k,
                        decodeVersion(v)
                    ])));
                continue;
            }
            let hasTrue = !1, hasFalse = !1;
            for (let tp of targetProperties)switch(tp[key]){
                case !0:
                    hasTrue = !0;
                    break;
                case !1:
                    hasFalse = !0;
            }
            (hasTrue || hasFalse) && (result[key] = hasFalse && hasTrue ? null : hasTrue);
        }
        return result;
    })(targets.map((t)=>getTargetProperties(t, context))), applyRspackOptionsDefaults = (options)=>{
    F(options, 'context', ()=>process.cwd()), F(options, 'target', ()=>hasBrowserslistConfig(options.context) ? 'browserslist' : 'web');
    let { mode, target } = options;
    if (isNil(target)) throw Error('target should not be nil after defaults');
    let targetProperties = !1 !== target && ('string' == typeof target ? getTargetProperties(target, options.context) : getTargetsProperties(target, options.context)), development = 'development' === mode, production = 'production' === mode || !mode;
    if ('function' != typeof options.entry) for (let key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
            './src'
        ]);
    return F(options, 'devtool', ()=>!!development && 'cheap-module-source-map'), D(options, 'watch', !1), D(options, 'lazyCompilation', !1), D(options, 'bail', !1), F(options, 'cache', ()=>development), applyIncrementalDefaults(options), applyExperimentsDefaults(options.experiments), applyOptimizationDefaults(options.optimization, {
        production,
        development
    }), applySnapshotDefaults(options.snapshot, {
        production
    }), applyOutputDefaults(options, {
        context: options.context,
        targetProperties,
        isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
        entry: options.entry
    }), applyModuleDefaults(options.module, {
        asyncWebAssembly: options.experiments.asyncWebAssembly,
        targetProperties,
        mode: options.mode,
        uniqueName: options.output.uniqueName,
        deferImport: options.experiments.deferImport,
        sourceImport: options.experiments.sourceImport,
        outputModule: options.output.module,
        hashFunction: options.output.hashFunction,
        hashSalt: options.output.hashSalt
    }), applyExternalsPresetsDefaults(options.externalsPresets, {
        targetProperties,
        buildHttp: !!options.experiments.buildHttp,
        outputModule: options.output.module
    }), F(options, 'externalsType', ()=>options.output.library?.type && 'modern-module' !== options.output.library.type ? options.output.library.type : options.output.module ? 'module-import' : 'var'), applyNodeDefaults(options.node, {
        targetProperties,
        outputModule: options.output.module
    }), applyLoaderDefaults(options.loader, {
        targetProperties,
        environment: options.output.environment
    }), F(options, 'performance', ()=>!!production && !!targetProperties && (!!targetProperties.browser || null === targetProperties.browser) && {}), applyPerformanceDefaults(options.performance, {
        production
    }), options.resolve = cleverMerge(getResolveDefaults({
        targetProperties,
        mode: options.mode
    }), options.resolve), options.resolveLoader = cleverMerge(getResolveLoaderDefaults(), options.resolveLoader), !1 === targetProperties ? targetProperties : {
        platform: {
            web: targetProperties.web,
            browser: targetProperties.browser,
            webworker: targetProperties.webworker,
            node: targetProperties.node,
            nwjs: targetProperties.nwjs,
            electron: targetProperties.electron
        },
        esVersion: targetProperties.esVersion,
        targets: targetProperties.targets
    };
}, applyExperimentsDefaults = (experiments)=>{
    D(experiments, 'futureDefaults', !1), D(experiments, 'asyncWebAssembly', !0), D(experiments, 'deferImport', !1), D(experiments, 'sourceImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'useInputFileSystem', !1), D(experiments, 'pureFunctions', !1);
}, applyIncrementalDefaults = (options)=>{
    D(options, 'incremental', {}), 'object' == typeof options.incremental && (D(options.incremental, 'silent', !0), D(options.incremental, 'buildModuleGraph', !0), D(options.incremental, 'finishModules', !0), D(options.incremental, 'optimizeDependencies', !0), D(options.incremental, 'buildChunkGraph', !0), D(options.incremental, 'optimizeChunkModules', !0), D(options.incremental, 'moduleIds', !0), D(options.incremental, 'chunkIds', !0), D(options.incremental, 'modulesHashes', !0), D(options.incremental, 'modulesCodegen', !0), D(options.incremental, 'modulesRuntimeRequirements', !0), D(options.incremental, 'chunksRuntimeRequirements', !0), D(options.incremental, 'chunksHashes', !0), D(options.incremental, 'chunkAsset', !0), D(options.incremental, 'emitAssets', !0));
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssParserOptionsDefaults = (parserOptions)=>{
    D(parserOptions, 'namedExports', !0), D(parserOptions, 'url', !0), D(parserOptions, 'import', !0);
}, applyCssModuleGeneratorOptionsDefaults = (generatorOptions, { hashFunction, hashSalt, localIdentName, targetProperties })=>{
    D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0), D(generatorOptions, 'exportsConvention', 'as-is'), D(generatorOptions, 'localIdentName', localIdentName), D(generatorOptions, 'localIdentHashSalt', hashSalt), D(generatorOptions, 'localIdentHashFunction', hashFunction), D(generatorOptions, 'localIdentHashDigest', 'base64url'), D(generatorOptions, 'localIdentHashDigestLength', 6);
}, applyCssModuleParserOptionsDefaults = (parserOptions)=>{
    applyCssParserOptionsDefaults(parserOptions), D(parserOptions, 'animation', !0), D(parserOptions, 'container', !0), D(parserOptions, 'customIdents', !0), D(parserOptions, 'dashedIdents', !0), D(parserOptions, 'function', !0), D(parserOptions, 'grid', !0);
}, applyCssAutoOrModuleParserOptionsDefaults = (parserOptions)=>{
    applyCssModuleParserOptionsDefaults(parserOptions), D(parserOptions, 'pure', !1);
}, applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport, sourceImport, outputModule, hashFunction, hashSalt })=>{
    assertNotNill(module.parser), assertNotNill(module.generator), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { deferImport, sourceImport, outputModule })=>{
        D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'strictThisContextOnImports', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'exportsPresence', 'error'), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !1), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
            '...'
        ]), D(parserOptions, 'importMeta', !outputModule || 'preserve-unknown'), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport), D(parserOptions, 'sourceImport', sourceImport), D(parserOptions, 'importMetaResolve', !1);
    })(module.parser.javascript, {
        deferImport,
        sourceImport,
        outputModule
    }), F(module.parser, "json", ()=>({})), assertNotNill(module.parser.json), D(module.parser.json, 'exportsDepth', 'development' === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, 'json', ()=>({})), assertNotNill(module.generator.json), D(module.generator.json, 'JSONParse', !0), F(module.parser, 'css', ()=>({})), assertNotNill(module.parser.css), applyCssParserOptionsDefaults(module.parser.css), F(module.parser, 'css/auto', ()=>({})), assertNotNill(module.parser['css/auto']), applyCssAutoOrModuleParserOptionsDefaults(module.parser['css/auto']), F(module.parser, 'css/global', ()=>({})), assertNotNill(module.parser['css/global']), applyCssModuleParserOptionsDefaults(module.parser['css/global']), F(module.parser, 'css/module', ()=>({})), assertNotNill(module.parser['css/module']), applyCssAutoOrModuleParserOptionsDefaults(module.parser['css/module']), F(module.generator, 'css', ()=>({})), assertNotNill(module.generator.css), ((generatorOptions, { targetProperties })=>{
        D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
    })(module.generator.css, {
        targetProperties
    }), F(module.generator, 'css/auto', ()=>({})), assertNotNill(module.generator['css/auto']);
    let localIdentName = 'development' === mode ? uniqueName && uniqueName.length > 0 ? '[uniqueName]-[id]-[local]' : '[id]-[local]' : '[fullhash]';
    applyCssModuleGeneratorOptionsDefaults(module.generator['css/auto'], {
        hashFunction,
        hashSalt,
        localIdentName,
        targetProperties
    }), F(module.generator, 'css/module', ()=>({})), assertNotNill(module.generator['css/module']), applyCssModuleGeneratorOptionsDefaults(module.generator['css/module'], {
        hashFunction,
        hashSalt,
        localIdentName,
        targetProperties
    }), F(module.generator, 'css/global', ()=>({})), assertNotNill(module.generator['css/global']), applyCssModuleGeneratorOptionsDefaults(module.generator['css/global'], {
        hashFunction,
        hashSalt,
        localIdentName,
        targetProperties
    }), A(module, 'defaultRules', ()=>{
        let esm = {
            type: "javascript/esm",
            resolve: {
                byDependency: {
                    esm: {
                        fullySpecified: !0
                    }
                }
            }
        }, commonjs = {
            type: "javascript/dynamic"
        }, rules = [
            {
                mimetype: 'application/node',
                type: "javascript/auto"
            },
            {
                test: /\.json$/,
                type: 'json'
            },
            {
                mimetype: 'application/json',
                type: 'json'
            },
            {
                test: /\.mjs$/,
                ...esm
            },
            {
                test: /\.js$/,
                descriptionData: {
                    type: 'module'
                },
                ...esm
            },
            {
                test: /\.cjs$/,
                ...commonjs
            },
            {
                test: /\.js$/,
                descriptionData: {
                    type: 'commonjs'
                },
                ...commonjs
            },
            {
                mimetype: {
                    or: [
                        "text/javascript",
                        "application/javascript"
                    ]
                },
                ...esm
            }
        ];
        if (asyncWebAssembly) {
            let wasm = {
                type: 'webassembly/async',
                rules: [
                    {
                        descriptionData: {
                            type: 'module'
                        },
                        resolve: {
                            fullySpecified: !0
                        }
                    }
                ]
            };
            rules.push({
                test: /\.wasm$/,
                ...wasm
            }), rules.push({
                mimetype: 'application/wasm',
                ...wasm
            });
        }
        return rules.push({
            dependency: 'url',
            oneOf: [
                {
                    scheme: /^data$/,
                    type: 'asset/inline'
                },
                {
                    type: 'asset/resource'
                }
            ]
        }, {
            with: {
                type: 'json'
            },
            type: 'json'
        }, {
            with: {
                type: 'text'
            },
            type: 'asset/source'
        }, {
            with: {
                type: 'bytes'
            },
            type: 'asset/bytes'
        }), rules;
    });
}, applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
    let { output } = options, getLibraryName = (library)=>{
        let libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
        return Array.isArray(libraryName) ? libraryName.join('.') : 'object' == typeof libraryName ? getLibraryName(libraryName.root) : 'string' == typeof libraryName ? libraryName : '';
    };
    F(output, 'uniqueName', ()=>{
        let libraryName = getLibraryName(output.library).replace(/^\[(\\*[\w:]+\\*)\](\.)|(\.)\[(\\*[\w:]+\\*)\](?=\.|$)|\[(\\*[\w:]+\\*)\]/g, (_, a, d1, d2, b, c)=>{
            let content = a || b || c;
            return content.startsWith('\\') && content.endsWith('\\') ? `${d2 || ''}[${content.slice(1, -1)}]${d1 || ''}` : '';
        });
        if (libraryName) return libraryName;
        let pkgPath = node_path.resolve(context, 'package.json');
        try {
            return JSON.parse(node_fs.readFileSync(pkgPath, 'utf-8')).name || '';
        } catch (err) {
            if ('ENOENT' !== err.code) throw err.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`, err;
            return '';
        }
    }), F(output, 'devtoolNamespace', ()=>output.uniqueName), output.library && F(output.library, 'type', ()=>output.module ? 'modern-module' : 'var');
    let forEachEntry = (fn)=>{
        if ('function' != typeof entry) for (let name of Object.keys(entry))fn(entry[name]);
    };
    A(output, 'enabledLibraryTypes', ()=>{
        let enabledLibraryTypes = [];
        return output.library && enabledLibraryTypes.push(output.library.type), forEachEntry((desc)=>{
            desc.library && enabledLibraryTypes.push(desc.library.type);
        }), enabledLibraryTypes.includes('modern-module') && function(options) {
            options.optimization.concatenateModules = !1, options.optimization.removeEmptyChunks = !1, options.output.chunkFormat = !1, options.output.module = !0, options.output.chunkLoading && 'import' !== options.output.chunkLoading && (options.output.chunkLoading = 'import'), void 0 === options.output.chunkLoading && (options.output.chunkLoading = 'import');
            let { splitChunks } = options.optimization;
            void 0 === splitChunks && (splitChunks = options.optimization.splitChunks = {}), !1 !== splitChunks && (splitChunks.chunks = 'all', splitChunks.minSize = 0, splitChunks.maxAsyncRequests = 1 / 0, splitChunks.maxInitialRequests = 1 / 0, splitChunks.cacheGroups ??= {}, splitChunks.cacheGroups.default = !1, splitChunks.cacheGroups.defaultVendors = !1);
        }(options), enabledLibraryTypes;
    }), D(output, 'module', [
        'modern-module',
        'module'
    ].some((ty)=>output.enabledLibraryTypes.includes(ty)));
    let environment = output.environment, conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
    F(environment, 'globalThis', ()=>tp && tp.globalThis), F(environment, 'bigIntLiteral', ()=>{
        let v;
        return tp && ((v = tp.bigIntLiteral) || void 0 === v);
    }), F(environment, 'const', ()=>{
        let v;
        return tp && ((v = tp.const) || void 0 === v);
    }), F(environment, 'computedProperty', ()=>{
        let v;
        return tp && ((v = tp.computedProperty) || void 0 === v);
    }), F(environment, 'methodShorthand', ()=>{
        let v;
        return tp && ((v = tp.methodShorthand) || void 0 === v);
    }), F(environment, 'arrowFunction', ()=>{
        let v;
        return tp && ((v = tp.arrowFunction) || void 0 === v);
    }), F(environment, 'asyncFunction', ()=>{
        let v;
        return tp && ((v = tp.asyncFunction) || void 0 === v);
    }), F(environment, 'forOf', ()=>{
        let v;
        return tp && ((v = tp.forOf) || void 0 === v);
    }), F(environment, 'destructuring', ()=>{
        let v;
        return tp && ((v = tp.destructuring) || void 0 === v);
    }), F(environment, 'optionalChaining', ()=>{
        let v;
        return tp && ((v = tp.optionalChaining) || void 0 === v);
    }), F(environment, 'nodePrefixForCoreModules', ()=>{
        let v;
        return tp && ((v = tp.nodePrefixForCoreModules) || void 0 === v);
    }), F(environment, 'importMetaDirnameAndFilename', ()=>tp && tp.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
        let v;
        return tp && ((v = tp.templateLiteral) || void 0 === v);
    }), F(environment, 'dynamicImport', ()=>tp && conditionallyOptimistic(tp.dynamicImport, output.module)), F(environment, 'dynamicImportInWorker', ()=>tp && conditionallyOptimistic(tp.dynamicImportInWorker, output.module)), F(environment, 'module', ()=>tp && conditionallyOptimistic(tp.module, output.module)), F(environment, 'document', ()=>{
        let v;
        return tp && ((v = tp.document) || void 0 === v);
    }), D(output, 'filename', output.module ? '[name].mjs' : '[name].js'), F(output, 'iife', ()=>!output.module), F(output, 'chunkFilename', ()=>{
        let filename = output.filename;
        if ('function' != typeof filename) {
            let hasName = filename.includes('[name]'), hasId = filename.includes('[id]'), hasChunkHash = filename.includes('[chunkhash]'), hasContentHash = filename.includes('[contenthash]');
            return hasChunkHash || hasContentHash || hasName || hasId ? filename : filename.replace(/(^|\/)([^/]*(?:\?|$))/, '$1[id].$2');
        }
        return '[id].js';
    }), F(output, 'cssFilename', ()=>{
        let filename = output.filename;
        return 'function' != typeof filename ? filename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
    }), F(output, 'cssChunkFilename', ()=>{
        let chunkFilename = output.chunkFilename;
        return 'function' != typeof chunkFilename ? chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1') : '[id].css';
    }), D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`), F(output, 'hotUpdateMainFilename', ()=>`[runtime].[fullhash].hot-update.${output.module ? 'json.mjs' : 'json'}`);
    let uniqueNameId = Template.toIdentifier(output.uniqueName);
    if (F(output, 'hotUpdateGlobal', ()=>`rspackHotUpdate${uniqueNameId}`), F(output, 'chunkLoadingGlobal', ()=>`rspackChunk${uniqueNameId}`), D(output, 'assetModuleFilename', '[hash][ext][query]'), D(output, 'webassemblyModuleFilename', '[hash].module.wasm'), D(output, 'compareBeforeEmit', !0), output.path && !node_path.isAbsolute(output.path)) {
        if (!context) throw Error(`Invalid Rspack configuration: "context" must be a non-empty absolute path when "output.path" is relative, get "${context ?? ''}".`);
        output.path = node_path.resolve(context, output.path);
    }
    F(output, 'path', ()=>node_path.join(process.cwd(), 'dist')), F(output, 'pathinfo', ()=>!1), D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''), D(output, 'hashFunction', 'xxhash64'), D(output, 'hashDigest', 'hex'), D(output, 'hashDigestLength', 16), D(output, 'strictModuleErrorHandling', !1), F(output, 'chunkFormat', ()=>{
        if (tp) {
            let helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
            if (output.module) {
                if (environment.dynamicImport) return 'module';
                if (tp.document) return 'array-push';
                throw Error(`For the selected environment is no default ESM chunk format available:\nESM exports can be chosen when 'import()' is available.\nJSONP Array push can be chosen when 'document' is available.\n${helpMessage}`);
            }
            if (tp.document) return 'array-push';
            if (tp.require || tp.nodeBuiltins) return 'commonjs';
            if (tp.importScripts) return 'array-push';
            throw Error(`For the selected environment is no default script chunk format available:\nJSONP Array push can be chosen when 'document' or 'importScripts' is available.\nCommonJs exports can be chosen when 'require' or node builtins are available.\n${helpMessage}`);
        }
        throw Error("Chunk format can't be selected by default when no target is specified");
    }), D(output, 'asyncChunks', !0), F(output, 'chunkLoading', ()=>{
        if (tp) {
            switch(output.chunkFormat){
                case 'array-push':
                    if (tp.document) return 'jsonp';
                    if (tp.importScripts) return "import-scripts";
                    break;
                case 'commonjs':
                    if (tp.require) return 'require';
                    if (tp.nodeBuiltins) return 'async-node';
                    break;
                case 'module':
                    if (environment.dynamicImport) return 'import';
            }
            if ((null === tp.require || null === tp.nodeBuiltins || null === tp.document || null === tp.importScripts) && output.module && environment.dynamicImport) return 'universal';
        }
        return !1;
    }), F(output, 'workerChunkLoading', ()=>{
        if (tp) {
            switch(output.chunkFormat){
                case 'array-push':
                    if (tp.importScriptsInWorker) return "import-scripts";
                    break;
                case 'commonjs':
                    if (tp.require) return 'require';
                    if (tp.nodeBuiltins) return 'async-node';
                    break;
                case 'module':
                    if (environment.dynamicImportInWorker) return 'import';
            }
            if ((null === tp.require || null === tp.nodeBuiltins || null === tp.importScriptsInWorker) && output.module && environment.dynamicImport) return 'universal';
        }
        return !1;
    }), F(output, 'wasmLoading', ()=>{
        if (tp) {
            if (tp.fetchWasm) return 'fetch';
            if (tp.nodeBuiltins) return 'async-node';
            if ((null === tp.nodeBuiltins || null === tp.fetchWasm) && output.module && environment.dynamicImport) return 'universal';
        }
        return !1;
    }), F(output, 'workerWasmLoading', ()=>output.wasmLoading), F(output, 'globalObject', ()=>{
        if (tp) {
            if (tp.global) return 'global';
            if (tp.globalThis) return 'globalThis';
        }
        return 'self';
    }), D(output, 'importFunctionName', 'import'), D(output, 'importMetaName', 'import.meta'), F(output, 'clean', ()=>!!output.clean), D(output, 'crossOriginLoading', !1), D(output, 'workerPublicPath', ''), D(output, 'sourceMapFilename', '[file].map[query]'), F(output, "scriptType", ()=>!!output.module && 'module'), D(output, 'chunkLoadTimeout', 120000);
    let { trustedTypes } = output;
    trustedTypes && (F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack'), D(trustedTypes, 'onPolicyCreationFailure', 'stop')), A(output, 'enabledChunkLoadingTypes', ()=>{
        let enabledChunkLoadingTypes = new Set();
        return output.chunkLoading && enabledChunkLoadingTypes.add(output.chunkLoading), output.workerChunkLoading && enabledChunkLoadingTypes.add(output.workerChunkLoading), forEachEntry((desc)=>{
            desc.chunkLoading && enabledChunkLoadingTypes.add(desc.chunkLoading);
        }), Array.from(enabledChunkLoadingTypes);
    }), A(output, 'enabledWasmLoadingTypes', ()=>{
        let enabledWasmLoadingTypes = new Set();
        return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
            desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
        }), Array.from(enabledWasmLoadingTypes);
    }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.8"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
}, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
    let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
    D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
}, applyLoaderDefaults = (loader, { targetProperties, environment })=>{
    F(loader, 'target', ()=>{
        if (targetProperties) {
            if (targetProperties.electron) return targetProperties.electronMain ? 'electron-main' : targetProperties.electronPreload ? 'electron-preload' : targetProperties.electronRenderer ? 'electron-renderer' : 'electron';
            if (targetProperties.nwjs) return 'nwjs';
            if (targetProperties.node) return 'node';
            if (targetProperties.web) return 'web';
        }
    }), D(loader, 'environment', environment);
}, applyNodeDefaults = (node, { outputModule, targetProperties })=>{
    !1 !== node && (F(node, 'global', ()=>(!targetProperties || !targetProperties.global) && 'warn'), F(node, '__dirname', ()=>targetProperties && targetProperties.node ? outputModule ? 'node-module' : 'eval-only' : 'warn-mock'), F(node, '__filename', ()=>targetProperties && targetProperties.node ? outputModule ? 'node-module' : 'eval-only' : 'warn-mock'));
}, applyPerformanceDefaults = (performance, { production })=>{
    !1 !== performance && (D(performance, 'maxAssetSize', 307200), D(performance, 'maxEntrypointSize', 512000), F(performance, 'hints', ()=>!!production && 'warning'));
}, applyOptimizationDefaults = (optimization, { production, development })=>{
    D(optimization, 'removeEmptyChunks', !0), D(optimization, 'mergeDuplicateChunks', !0), F(optimization, 'moduleIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'chunkIds', ()=>production ? 'deterministic' : development ? 'named' : 'natural'), F(optimization, 'sideEffects', ()=>!!production || 'flag'), D(optimization, 'mangleExports', production), D(optimization, 'inlineExports', production), D(optimization, 'providedExports', !0), D(optimization, 'usedExports', production), D(optimization, 'innerGraph', production), D(optimization, 'emitOnErrors', !production), D(optimization, 'runtimeChunk', !1), D(optimization, 'realContentHash', production), D(optimization, 'avoidEntryIife', !1), D(optimization, 'minimize', production), D(optimization, 'concatenateModules', production), A(optimization, 'minimizer', ()=>[
            new SwcJsMinimizerRspackPlugin(),
            new LightningCssMinimizerRspackPlugin()
        ]), F(optimization, 'nodeEnv', ()=>production ? 'production' : !!development && 'development');
    let { splitChunks } = optimization;
    if (splitChunks) {
        A(splitChunks, 'defaultSizeTypes', ()=>[
                "javascript",
                'css',
                'unknown'
            ]), D(splitChunks, 'hidePathInfo', production), D(splitChunks, 'chunks', 'async'), D(splitChunks, 'usedExports', !0 === optimization.usedExports), D(splitChunks, 'minChunks', 1), F(splitChunks, 'minSize', ()=>production ? 20000 : 10000), F(splitChunks, 'enforceSizeThreshold', ()=>production ? 50000 : 30000), F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0), F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0), D(splitChunks, 'automaticNameDelimiter', '-');
        let { cacheGroups } = splitChunks;
        cacheGroups && (F(cacheGroups, 'default', ()=>({
                idHint: '',
                reuseExistingChunk: !0,
                minChunks: 2,
                priority: -20
            })), F(cacheGroups, 'defaultVendors', ()=>({
                idHint: 'vendors',
                reuseExistingChunk: !0,
                test: /[\\/]node_modules[\\/]/,
                priority: -10
            })));
    }
}, getResolveLoaderDefaults = ()=>({
        conditionNames: [
            'loader',
            'require',
            'node'
        ],
        exportsFields: [
            'exports'
        ],
        mainFields: [
            'loader',
            'main'
        ],
        extensions: [
            '.js'
        ],
        mainFiles: [
            'index'
        ]
    }), getResolveDefaults = ({ targetProperties, mode })=>{
    let conditions = [
        'webpack'
    ];
    conditions.push('development' === mode ? 'development' : 'production'), targetProperties && (targetProperties.webworker && conditions.push('worker'), targetProperties.node && conditions.push('node'), targetProperties.web && conditions.push('browser'), targetProperties.electron && conditions.push('electron'), targetProperties.nwjs && conditions.push('nwjs'));
    let jsExtensions = [
        '.js',
        '.json'
    ], browserField = targetProperties && targetProperties.web && (!targetProperties.node || targetProperties.electron && targetProperties.electronRenderer), aliasFields = browserField ? [
        'browser'
    ] : [], mainFields = browserField ? [
        'browser',
        'module',
        '...'
    ] : [
        'module',
        '...'
    ], cjsDeps = ()=>({
            aliasFields,
            mainFields,
            conditionNames: [
                'require',
                'module',
                '...'
            ],
            extensions: [
                ...jsExtensions
            ]
        }), esmDeps = ()=>({
            aliasFields,
            mainFields,
            conditionNames: [
                'import',
                'module',
                '...'
            ],
            extensions: [
                ...jsExtensions
            ]
        }), resolveOptions = {
        pnp: getPnpDefault(),
        modules: [
            'node_modules'
        ],
        conditionNames: conditions,
        mainFiles: [
            'index'
        ],
        extensions: [],
        aliasFields: [],
        exportsFields: [
            'exports'
        ],
        roots: [],
        mainFields: [
            'main'
        ],
        importsFields: [
            'imports'
        ],
        byDependency: {
            wasm: esmDeps(),
            esm: esmDeps(),
            loaderImport: esmDeps(),
            url: {
                preferRelative: !0
            },
            worker: {
                ...esmDeps(),
                preferRelative: !0
            },
            commonjs: cjsDeps(),
            amd: cjsDeps(),
            loader: cjsDeps(),
            unknown: cjsDeps()
        }
    }, styleConditions = [];
    styleConditions.push('development' === mode ? 'development' : 'production'), styleConditions.push('style');
    let cssResolveOptions = {
        mainFiles: [],
        mainFields: [
            'style',
            '...'
        ],
        conditionNames: styleConditions,
        extensions: [
            '.css'
        ],
        preferRelative: !0
    };
    return resolveOptions.byDependency['css-import'] = cssResolveOptions, resolveOptions.byDependency['css-import-local-module'] = cssResolveOptions, resolveOptions.byDependency['css-import-global-module'] = cssResolveOptions, resolveOptions;
}, D = (obj, prop, value)=>{
    void 0 === obj[prop] && (obj[prop] = value);
}, F = (obj, prop, factory)=>{
    void 0 === obj[prop] && (obj[prop] = factory());
}, A = (obj, prop, factory)=>{
    let value = obj[prop];
    if (void 0 === value) obj[prop] = factory();
    else if (Array.isArray(value)) {
        let newArray;
        for(let i = 0; i < value.length; i++){
            let item = value[i];
            if ('...' === item) {
                void 0 === newArray && (newArray = value.slice(0, i), obj[prop] = newArray);
                let items = factory();
                if (void 0 !== items) for (let item of items)newArray.push(item);
            } else void 0 !== newArray && newArray.push(item);
        }
    }
}, getPnpDefault = ()=>!!process.versions.pnp, getNormalizedRspackOptions = (config)=>{
    let fn;
    return {
        ignoreWarnings: ((ignoreWarnings)=>{
            if (ignoreWarnings) return ignoreWarnings.map((ignore)=>{
                if ('function' == typeof ignore) return ignore;
                let rule = ignore instanceof RegExp ? {
                    message: ignore
                } : ignore;
                return (warning)=>(!!rule.message || !!rule.module || !!rule.file) && (!rule.message || !!rule.message.test(warning.message)) && (!rule.module || !!warning.module && !!rule.module.test(warning.module.readableIdentifier())) && (!rule.file || !!warning.file && !!rule.file.test(warning.file));
            });
        })(config.ignoreWarnings),
        name: config.name,
        dependencies: config.dependencies,
        context: config.context,
        mode: config.mode,
        entry: void 0 === config.entry ? {
            main: {}
        } : 'function' == typeof config.entry ? (fn = config.entry, ()=>Promise.resolve().then(fn).then(getNormalizedEntryStatic)) : getNormalizedEntryStatic(config.entry),
        output: nestedConfig(config.output, (output)=>{
            let { library } = output, libraryBase = 'object' == typeof library && library && !Array.isArray(library) ? library : library ? {
                name: library
            } : void 0;
            return {
                path: output.path,
                pathinfo: output.pathinfo,
                publicPath: output.publicPath,
                filename: output.filename,
                clean: output.clean,
                chunkFormat: output.chunkFormat,
                chunkLoading: output.chunkLoading,
                chunkFilename: output.chunkFilename,
                crossOriginLoading: output.crossOriginLoading,
                cssFilename: output.cssFilename,
                cssChunkFilename: output.cssChunkFilename,
                hotUpdateMainFilename: output.hotUpdateMainFilename,
                hotUpdateChunkFilename: output.hotUpdateChunkFilename,
                hotUpdateGlobal: output.hotUpdateGlobal,
                assetModuleFilename: output.assetModuleFilename,
                wasmLoading: output.wasmLoading,
                enabledChunkLoadingTypes: output.enabledChunkLoadingTypes ? [
                    ...output.enabledChunkLoadingTypes
                ] : [
                    '...'
                ],
                enabledWasmLoadingTypes: output.enabledWasmLoadingTypes ? [
                    ...output.enabledWasmLoadingTypes
                ] : [
                    '...'
                ],
                webassemblyModuleFilename: output.webassemblyModuleFilename,
                uniqueName: output.uniqueName,
                chunkLoadingGlobal: output.chunkLoadingGlobal,
                enabledLibraryTypes: output.enabledLibraryTypes ? [
                    ...output.enabledLibraryTypes
                ] : [
                    '...'
                ],
                globalObject: output.globalObject,
                importFunctionName: output.importFunctionName,
                importMetaName: output.importMetaName,
                iife: output.iife,
                module: output.module,
                sourceMapFilename: output.sourceMapFilename,
                library: libraryBase,
                strictModuleErrorHandling: output.strictModuleErrorHandling ?? output.strictModuleExceptionHandling,
                trustedTypes: optionalNestedConfig(output.trustedTypes, (trustedTypes)=>!0 === trustedTypes ? {} : 'string' == typeof trustedTypes ? {
                        policyName: trustedTypes
                    } : {
                        ...trustedTypes
                    }),
                hashDigest: output.hashDigest,
                hashDigestLength: output.hashDigestLength,
                hashFunction: output.hashFunction,
                hashSalt: output.hashSalt,
                asyncChunks: output.asyncChunks,
                workerChunkLoading: output.workerChunkLoading,
                workerWasmLoading: output.workerWasmLoading,
                workerPublicPath: output.workerPublicPath,
                scriptType: output.scriptType,
                devtoolNamespace: output.devtoolNamespace,
                devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate,
                devtoolFallbackModuleFilenameTemplate: output.devtoolFallbackModuleFilenameTemplate,
                chunkLoadTimeout: output.chunkLoadTimeout,
                environment: cloneObject(output.environment),
                compareBeforeEmit: output.compareBeforeEmit,
                bundlerInfo: output.bundlerInfo
            };
        }),
        resolve: nestedConfig(config.resolve, (resolve)=>({
                ...resolve,
                tsConfig: optionalNestedConfig(resolve.tsConfig, (tsConfig)=>'string' == typeof tsConfig ? {
                        configFile: tsConfig
                    } : tsConfig)
            })),
        resolveLoader: nestedConfig(config.resolveLoader, (resolve)=>({
                ...resolve,
                tsConfig: optionalNestedConfig(resolve.tsConfig, (tsConfig)=>'string' == typeof tsConfig ? {
                        configFile: tsConfig
                    } : tsConfig)
            })),
        module: nestedConfig(config.module, (module)=>({
                noParse: module.noParse,
                parser: keyedNestedConfig(module.parser, cloneObject, {}),
                generator: keyedNestedConfig(module.generator, cloneObject, {}),
                defaultRules: optionalNestedArray(module.defaultRules, (r)=>[
                        ...r
                    ]),
                rules: nestedArray(module.rules, (r)=>[
                        ...r
                    ])
            })),
        target: config.target,
        externals: config.externals,
        externalsType: config.externalsType,
        externalsPresets: cloneObject(config.externalsPresets),
        infrastructureLogging: cloneObject(config.infrastructureLogging),
        devtool: config.devtool,
        node: nestedConfig(config.node, (node)=>node && {
                ...node
            }),
        loader: cloneObject(config.loader),
        snapshot: nestedConfig(config.snapshot, (_snapshot)=>({})),
        cache: optionalNestedConfig(config.cache, (cache)=>{
            if ('boolean' == typeof cache || 'memory' === cache.type) return cache;
            let snapshot = cache.snapshot || {};
            return {
                type: 'persistent',
                buildDependencies: nestedArray(cache.buildDependencies, (deps)=>deps.map((d)=>node_path.resolve(config.context || process.cwd(), d))),
                version: cache.version || '',
                snapshot: {
                    immutablePaths: nestedArray(snapshot.immutablePaths, (p)=>[
                            ...p
                        ]),
                    unmanagedPaths: nestedArray(snapshot.unmanagedPaths, (p)=>[
                            ...p
                        ]),
                    managedPaths: optionalNestedArray(snapshot.managedPaths, (p)=>[
                            ...p
                        ]) || [
                        /[\\/]node_modules[\\/][^.]/
                    ]
                },
                storage: {
                    type: 'filesystem',
                    directory: node_path.resolve(config.context || process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
                },
                portable: cache.portable,
                readonly: cache.readonly
            };
        }),
        stats: nestedConfig(config.stats, (stats)=>!1 === stats ? {
                preset: 'none'
            } : !0 === stats ? {
                preset: 'normal'
            } : 'string' == typeof stats ? {
                preset: stats
            } : {
                ...stats
            }),
        optimization: nestedConfig(config.optimization, (optimization)=>({
                ...optimization,
                runtimeChunk: getNormalizedOptimizationRuntimeChunk(optimization.runtimeChunk),
                splitChunks: nestedConfig(optimization.splitChunks, (splitChunks)=>splitChunks && {
                        ...splitChunks,
                        defaultSizeTypes: splitChunks.defaultSizeTypes ? [
                            ...splitChunks.defaultSizeTypes
                        ] : [
                            '...'
                        ],
                        cacheGroups: cloneObject(splitChunks.cacheGroups)
                    })
            })),
        performance: config.performance,
        plugins: nestedArray(config.plugins, (p)=>[
                ...p
            ]),
        experiments: nestedConfig(config.experiments, (experiments)=>({
                ...experiments,
                buildHttp: experiments.buildHttp,
                useInputFileSystem: experiments.useInputFileSystem
            })),
        watch: config.watch,
        watchOptions: cloneObject(config.watchOptions),
        devServer: config.devServer,
        amd: config.amd,
        bail: config.bail,
        lazyCompilation: optionalNestedConfig(config.lazyCompilation, (options)=>!0 === options ? {} : options),
        incremental: optionalNestedConfig(config.incremental, (options)=>getNormalizedIncrementalOptions(options))
    };
}, getNormalizedEntryStatic = (entry)=>{
    if ('string' == typeof entry) return {
        main: {
            import: [
                entry
            ]
        }
    };
    if (Array.isArray(entry)) return {
        main: {
            import: entry
        }
    };
    let result = {};
    for (let key of Object.keys(entry)){
        let value = entry[key];
        'string' == typeof value ? result[key] = {
            import: [
                value
            ]
        } : Array.isArray(value) ? result[key] = {
            import: value
        } : result[key] = {
            import: Array.isArray(value.import) ? value.import : [
                value.import
            ],
            runtime: value.runtime,
            publicPath: value.publicPath,
            baseUri: value.baseUri,
            chunkLoading: value.chunkLoading,
            asyncChunks: value.asyncChunks,
            filename: value.filename,
            library: value.library,
            layer: value.layer,
            dependOn: Array.isArray(value.dependOn) ? value.dependOn : value.dependOn ? [
                value.dependOn
            ] : void 0
        };
    }
    return result;
}, getNormalizedOptimizationRuntimeChunk = (runtimeChunk)=>{
    if (void 0 !== runtimeChunk) {
        if (!1 === runtimeChunk) return !1;
        if ('single' === runtimeChunk) return {
            name: 'single'
        };
        if (!0 === runtimeChunk || 'multiple' === runtimeChunk) return {
            name: 'multiple'
        };
        if (runtimeChunk.name) return {
            name: runtimeChunk.name
        };
    }
}, getNormalizedIncrementalOptions = (incremental)=>!1 !== incremental && 'none' !== incremental && ('safe' === incremental ? {
        silent: !0,
        buildModuleGraph: !0,
        finishModules: !1,
        optimizeDependencies: !1,
        buildChunkGraph: !0,
        optimizeChunkModules: !1,
        moduleIds: !1,
        chunkIds: !1,
        modulesHashes: !1,
        modulesCodegen: !1,
        modulesRuntimeRequirements: !1,
        chunksRuntimeRequirements: !1,
        chunksHashes: !1,
        chunkAsset: !1,
        emitAssets: !0
    } : !0 === incremental || 'advance-silent' === incremental ? {} : 'advance' === incremental ? {
        silent: !1
    } : incremental), nestedConfig = (value, fn)=>fn(void 0 === value ? {} : value), optionalNestedConfig = (value, fn)=>void 0 === value ? void 0 : fn(value), nestedArray = (value, fn)=>fn(Array.isArray(value) ? value : []), optionalNestedArray = (value, fn)=>Array.isArray(value) ? fn(value) : void 0, cloneObject = (value)=>({
        ...value
    }), keyedNestedConfig = (value, fn, customKeys)=>{
    let result = void 0 === value ? {} : Object.keys(value).reduce((obj, key)=>(obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]), obj), {});
    if (customKeys) for (let key of Object.keys(customKeys))key in result || (result[key] = customKeys[key]({}));
    return result;
};
function __from_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlobals) {
    let res = new Set();
    for (let flag of runtimeRequirements.value)flag in compilerRuntimeGlobals ? res.add(compilerRuntimeGlobals[flag]) : res.add(flag);
    return res;
}
function __to_binding_runtime_globals(runtimeRequirements, compilerRuntimeGlobals) {
    let res = {
        value: []
    }, reversedCompilerRuntimeGlobals = Object.fromEntries(Object.entries(compilerRuntimeGlobals).map(([key, value])=>[
            value,
            key
        ]));
    for (let flag of Array.from(runtimeRequirements)){
        let item = reversedCompilerRuntimeGlobals[flag];
        'string' == typeof item ? res.value.push(item) : res.value.push(flag);
    }
    return res;
}
var RuntimeGlobals_RuntimeGlobals = ((RuntimeGlobals = RuntimeGlobals_RuntimeGlobals || {})[RuntimeGlobals.require = 0] = "require", RuntimeGlobals[RuntimeGlobals.requireScope = 1] = "requireScope", RuntimeGlobals[RuntimeGlobals.exports = 2] = "exports", RuntimeGlobals[RuntimeGlobals.thisAsExports = 3] = "thisAsExports", RuntimeGlobals[RuntimeGlobals.returnExportsFromRuntime = 4] = "returnExportsFromRuntime", RuntimeGlobals[RuntimeGlobals.module = 5] = "module", RuntimeGlobals[RuntimeGlobals.moduleId = 6] = "moduleId", RuntimeGlobals[RuntimeGlobals.moduleLoaded = 7] = "moduleLoaded", RuntimeGlobals[RuntimeGlobals.publicPath = 8] = "publicPath", RuntimeGlobals[RuntimeGlobals.entryModuleId = 9] = "entryModuleId", RuntimeGlobals[RuntimeGlobals.moduleCache = 10] = "moduleCache", RuntimeGlobals[RuntimeGlobals.moduleFactories = 11] = "moduleFactories", RuntimeGlobals[RuntimeGlobals.moduleFactoriesAddOnly = 12] = "moduleFactoriesAddOnly", RuntimeGlobals[RuntimeGlobals.ensureChunk = 13] = "ensureChunk", RuntimeGlobals[RuntimeGlobals.ensureChunkHandlers = 14] = "ensureChunkHandlers", RuntimeGlobals[RuntimeGlobals.ensureChunkIncludeEntries = 15] = "ensureChunkIncludeEntries", RuntimeGlobals[RuntimeGlobals.prefetchChunk = 16] = "prefetchChunk", RuntimeGlobals[RuntimeGlobals.prefetchChunkHandlers = 17] = "prefetchChunkHandlers", RuntimeGlobals[RuntimeGlobals.preloadChunk = 18] = "preloadChunk", RuntimeGlobals[RuntimeGlobals.preloadChunkHandlers = 19] = "preloadChunkHandlers", RuntimeGlobals[RuntimeGlobals.definePropertyGetters = 20] = "definePropertyGetters", RuntimeGlobals[RuntimeGlobals.makeNamespaceObject = 21] = "makeNamespaceObject", RuntimeGlobals[RuntimeGlobals.createFakeNamespaceObject = 22] = "createFakeNamespaceObject", RuntimeGlobals[RuntimeGlobals.compatGetDefaultExport = 23] = "compatGetDefaultExport", RuntimeGlobals[RuntimeGlobals.harmonyModuleDecorator = 24] = "harmonyModuleDecorator", RuntimeGlobals[RuntimeGlobals.nodeModuleDecorator = 25] = "nodeModuleDecorator", RuntimeGlobals[RuntimeGlobals.getFullHash = 26] = "getFullHash", RuntimeGlobals[RuntimeGlobals.wasmInstances = 27] = "wasmInstances", RuntimeGlobals[RuntimeGlobals.instantiateWasm = 28] = "instantiateWasm", RuntimeGlobals[RuntimeGlobals.compileWasm = 29] = "compileWasm", RuntimeGlobals[RuntimeGlobals.uncaughtErrorHandler = 30] = "uncaughtErrorHandler", RuntimeGlobals[RuntimeGlobals.scriptNonce = 31] = "scriptNonce", RuntimeGlobals[RuntimeGlobals.loadScript = 32] = "loadScript", RuntimeGlobals[RuntimeGlobals.createScript = 33] = "createScript", RuntimeGlobals[RuntimeGlobals.createScriptUrl = 34] = "createScriptUrl", RuntimeGlobals[RuntimeGlobals.getTrustedTypesPolicy = 35] = "getTrustedTypesPolicy", RuntimeGlobals[RuntimeGlobals.hasFetchPriority = 36] = "hasFetchPriority", RuntimeGlobals[RuntimeGlobals.chunkName = 37] = "chunkName", RuntimeGlobals[RuntimeGlobals.runtimeId = 38] = "runtimeId", RuntimeGlobals[RuntimeGlobals.getChunkScriptFilename = 39] = "getChunkScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkCssFilename = 40] = "getChunkCssFilename", RuntimeGlobals[RuntimeGlobals.rspackVersion = 41] = "rspackVersion", RuntimeGlobals[RuntimeGlobals.hasCssModules = 42] = "hasCssModules", RuntimeGlobals[RuntimeGlobals.rspackUniqueId = 43] = "rspackUniqueId", RuntimeGlobals[RuntimeGlobals.getChunkUpdateScriptFilename = 44] = "getChunkUpdateScriptFilename", RuntimeGlobals[RuntimeGlobals.getChunkUpdateCssFilename = 45] = "getChunkUpdateCssFilename", RuntimeGlobals[RuntimeGlobals.startup = 46] = "startup", RuntimeGlobals[RuntimeGlobals.startupNoDefault = 47] = "startupNoDefault", RuntimeGlobals[RuntimeGlobals.startupOnlyAfter = 48] = "startupOnlyAfter", RuntimeGlobals[RuntimeGlobals.startupOnlyBefore = 49] = "startupOnlyBefore", RuntimeGlobals[RuntimeGlobals.chunkCallback = 50] = "chunkCallback", RuntimeGlobals[RuntimeGlobals.startupEntrypoint = 51] = "startupEntrypoint", RuntimeGlobals[RuntimeGlobals.startupChunkDependencies = 52] = "startupChunkDependencies", RuntimeGlobals[RuntimeGlobals.onChunksLoaded = 53] = "onChunksLoaded", RuntimeGlobals[RuntimeGlobals.externalInstallChunk = 54] = "externalInstallChunk", RuntimeGlobals[RuntimeGlobals.interceptModuleExecution = 55] = "interceptModuleExecution", RuntimeGlobals[RuntimeGlobals.global = 56] = "global", RuntimeGlobals[RuntimeGlobals.shareScopeMap = 57] = "shareScopeMap", RuntimeGlobals[RuntimeGlobals.initializeSharing = 58] = "initializeSharing", RuntimeGlobals[RuntimeGlobals.currentRemoteGetScope = 59] = "currentRemoteGetScope", RuntimeGlobals[RuntimeGlobals.getUpdateManifestFilename = 60] = "getUpdateManifestFilename", RuntimeGlobals[RuntimeGlobals.hmrDownloadManifest = 61] = "hmrDownloadManifest", RuntimeGlobals[RuntimeGlobals.hmrDownloadUpdateHandlers = 62] = "hmrDownloadUpdateHandlers", RuntimeGlobals[RuntimeGlobals.hmrModuleData = 63] = "hmrModuleData", RuntimeGlobals[RuntimeGlobals.hmrInvalidateModuleHandlers = 64] = "hmrInvalidateModuleHandlers", RuntimeGlobals[RuntimeGlobals.hmrRuntimeStatePrefix = 65] = "hmrRuntimeStatePrefix", RuntimeGlobals[RuntimeGlobals.amdDefine = 66] = "amdDefine", RuntimeGlobals[RuntimeGlobals.amdOptions = 67] = "amdOptions", RuntimeGlobals[RuntimeGlobals.system = 68] = "system", RuntimeGlobals[RuntimeGlobals.hasOwnProperty = 69] = "hasOwnProperty", RuntimeGlobals[RuntimeGlobals.systemContext = 70] = "systemContext", RuntimeGlobals[RuntimeGlobals.baseURI = 71] = "baseURI", RuntimeGlobals[RuntimeGlobals.relativeUrl = 72] = "relativeUrl", RuntimeGlobals[RuntimeGlobals.asyncModule = 73] = "asyncModule", RuntimeGlobals[RuntimeGlobals.asyncModuleExportSymbol = 74] = "asyncModuleExportSymbol", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObject = 75] = "makeDeferredNamespaceObject", RuntimeGlobals[RuntimeGlobals.makeDeferredNamespaceObjectSymbol = 76] = "makeDeferredNamespaceObjectSymbol", RuntimeGlobals);
function renderRuntimeVariables(variable, _compilerOptions) {
    switch(variable){
        case 0:
            return '__webpack_require__';
        case 1:
            return '__webpack_modules__';
        case 2:
            return '__webpack_module_cache__';
        case 3:
            return '__webpack_module__';
        case 4:
            return '__webpack_exports__';
        case 5:
            return '__webpack_exec__';
    }
}
function createCompilerRuntimeGlobals(compilerOptions) {
    let res = {};
    for (let key of Object.keys(RuntimeGlobals_RuntimeGlobals))res[key] = function(runtimeGlobals, _compilerOptions) {
        let scope_name = renderRuntimeVariables(0, _compilerOptions), exports_name = renderRuntimeVariables(4, _compilerOptions);
        switch(runtimeGlobals){
            case 0:
                return scope_name;
            case 1:
                return `${scope_name}.*`;
            case 2:
                return exports_name;
            case 3:
                return "top-level-this-exports";
            case 4:
                return "return-exports-from-runtime";
            case 5:
                return "module";
            case 6:
                return "module.id";
            case 7:
                return "module.loaded";
            case 8:
                return `${scope_name}.p`;
            case 9:
                return `${scope_name}.s`;
            case 10:
                return `${scope_name}.c`;
            case 11:
                return `${scope_name}.m`;
            case 12:
                return `${scope_name}.m (add only)`;
            case 13:
                return `${scope_name}.e`;
            case 14:
                return `${scope_name}.f`;
            case 15:
                return `${scope_name}.f (include entries)`;
            case 16:
                return `${scope_name}.E`;
            case 17:
                return `${scope_name}.F`;
            case 18:
                return `${scope_name}.G`;
            case 19:
                return `${scope_name}.H`;
            case 20:
                return `${scope_name}.d`;
            case 21:
                return `${scope_name}.r`;
            case 22:
                return `${scope_name}.t`;
            case 23:
                return `${scope_name}.n`;
            case 24:
                return `${scope_name}.hmd`;
            case 25:
                return `${scope_name}.nmd`;
            case 26:
                return `${scope_name}.h`;
            case 27:
                return `${scope_name}.w`;
            case 28:
                return `${scope_name}.v`;
            case 29:
                return `${scope_name}.vs`;
            case 30:
                return `${scope_name}.oe`;
            case 31:
                return `${scope_name}.nc`;
            case 32:
                return `${scope_name}.l`;
            case 33:
                return `${scope_name}.ts`;
            case 34:
                return `${scope_name}.tu`;
            case 35:
                return `${scope_name}.tt`;
            case 36:
                return "has fetch priority";
            case 37:
                return `${scope_name}.cn`;
            case 38:
                return `${scope_name}.j`;
            case 39:
                return `${scope_name}.u`;
            case 40:
                return `${scope_name}.k`;
            case 41:
                return `${scope_name}.rv`;
            case 42:
                return "has css modules";
            case 43:
                return `${scope_name}.ruid`;
            case 44:
                return `${scope_name}.hu`;
            case 45:
                return `${scope_name}.hk`;
            case 46:
                return `${scope_name}.x`;
            case 47:
                return `${scope_name}.x (no default handler)`;
            case 48:
                return `${scope_name}.x (only after)`;
            case 49:
                return `${scope_name}.x (only before)`;
            case 50:
                return "global chunk callback";
            case 51:
                return `${scope_name}.X`;
            case 52:
                return `${scope_name}.x (chunk dependencies)`;
            case 53:
                return `${scope_name}.O`;
            case 54:
                return `${scope_name}.C`;
            case 55:
                return `${scope_name}.i`;
            case 56:
                return `${scope_name}.g`;
            case 57:
                return `${scope_name}.S`;
            case 58:
                return `${scope_name}.I`;
            case 59:
                return `${scope_name}.R`;
            case 60:
                return `${scope_name}.hmrF`;
            case 61:
                return `${scope_name}.hmrM`;
            case 62:
                return `${scope_name}.hmrC`;
            case 63:
                return `${scope_name}.hmrD`;
            case 64:
                return `${scope_name}.hmrI`;
            case 65:
                return `${scope_name}.hmrS`;
            case 66:
                return `${scope_name}.amdD`;
            case 67:
                return `${scope_name}.amdO`;
            case 68:
                return `${scope_name}.System`;
            case 69:
                return `${scope_name}.o`;
            case 70:
                return `${scope_name}.y`;
            case 71:
                return `${scope_name}.b`;
            case 72:
                return `${scope_name}.U`;
            case 73:
                return `${scope_name}.a`;
            case 74:
                return `${scope_name}.aE`;
            case 75:
                return `${scope_name}.z`;
            case 76:
                return `${scope_name}.zS`;
            default:
                return '';
        }
    }(RuntimeGlobals_RuntimeGlobals[key], compilerOptions);
    return res;
}
let DefaultRuntimeGlobals = createCompilerRuntimeGlobals(), ExecuteModulePlugin_require = createRequire(import.meta.url);
class ExecuteModulePlugin {
    apply(compiler) {
        compiler.hooks.thisCompilation.tap('executeModule', (compilation)=>{
            compiler.__internal__get_module_execution_results_map().clear(), compilation.hooks.executeModule.tap('executeModule', (options, context)=>{
                let vm = ExecuteModulePlugin_require('node:vm'), moduleObject = options.moduleObject, source = options.codeGenerationResult.get("javascript");
                if (void 0 !== source) try {
                    vm.runInThisContext(`(function(module, ${renderRuntimeVariables(3, compiler.options)}, ${renderRuntimeVariables(4, compiler.options)}, exports, ${renderRuntimeVariables(0, compiler.options)}) {\n${source}\n})`, {
                        filename: moduleObject.id
                    }).call(moduleObject.exports, moduleObject, moduleObject, moduleObject.exports, moduleObject.exports, context[renderRuntimeVariables(0, compiler.options)]);
                } catch (e) {
                    let err = e instanceof Error ? e : Error(e);
                    throw err.stack += printGeneratedCodeForStack(moduleObject.id, source), err;
                }
            });
        });
    }
}
let printGeneratedCodeForStack = (moduleId, code)=>{
    let lines = code.split('\n'), n = `${lines.length}`.length;
    return `\n\nGenerated code for ${moduleId}\n${lines.map((line, i)=>{
        let iStr = `${i + 1}`;
        return `${' '.repeat(n - iStr.length)}${iStr} | ${line}`;
    }).join('\n')}`;
};
class ConcurrentCompilationError extends Error {
    name;
    message;
    constructor(){
        super(), this.name = 'ConcurrentCompilationError', this.message = 'You ran rspack twice. Each instance only supports a single concurrent compilation at a time.';
    }
}
let fs_join = (fs, rootPath, filename)=>{
    if (fs?.join) return fs.join(rootPath, filename);
    if (node_path.posix.isAbsolute(rootPath)) return node_path.posix.join(rootPath, filename);
    if (node_path.win32.isAbsolute(rootPath)) return node_path.win32.join(rootPath, filename);
    throw Error(`${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system`);
}, mkdirp = (fs, p, callback)=>{
    fs.mkdir(p, (err)=>{
        if (err) {
            if ('ENOENT' === err.code) {
                let dir = ((fs, absPath)=>{
                    if (fs?.dirname) return fs.dirname(absPath);
                    if (node_path.posix.isAbsolute(absPath)) return node_path.posix.dirname(absPath);
                    if (node_path.win32.isAbsolute(absPath)) return node_path.win32.dirname(absPath);
                    throw Error(`${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system`);
                })(fs, p);
                return dir === p ? void callback(err) : void mkdirp(fs, dir, (err)=>{
                    err ? callback(err) : fs.mkdir(p, (err)=>{
                        err ? 'EEXIST' === err.code ? callback() : callback(err) : callback();
                    });
                });
            }
            return 'EEXIST' === err.code ? void callback() : void callback(err);
        }
        callback();
    });
}, ASYNC_NOOP = async ()=>{}, NOOP_FILESYSTEM = {
    writeFile: ASYNC_NOOP,
    removeFile: ASYNC_NOOP,
    mkdir: ASYNC_NOOP,
    mkdirp: ASYNC_NOOP,
    removeDirAll: ASYNC_NOOP,
    readDir: ASYNC_NOOP,
    readFile: ASYNC_NOOP,
    stat: ASYNC_NOOP,
    lstat: ASYNC_NOOP,
    chmod: ASYNC_NOOP,
    realpath: ASYNC_NOOP,
    open: ASYNC_NOOP,
    rename: ASYNC_NOOP,
    close: ASYNC_NOOP,
    write: ASYNC_NOOP,
    writeAll: ASYNC_NOOP,
    read: ASYNC_NOOP,
    readUntil: ASYNC_NOOP,
    readToEnd: ASYNC_NOOP
};
function __to_binding_stat(stat) {
    return {
        isFile: stat.isFile(),
        isDirectory: stat.isDirectory(),
        isSymlink: stat.isSymbolicLink(),
        atimeMs: stat.atimeMs ?? toMs(stat.atime),
        mtimeMs: stat.mtimeMs ?? toMs(stat.mtime),
        ctimeMs: stat.ctimeMs ?? toMs(stat.ctime),
        birthtimeMs: stat.birthtimeMs ?? toMs(stat.birthtime),
        size: stat.size,
        mode: stat.mode
    };
}
function toMs(i) {
    return i.getTime ? i.getTime() : i;
}
class ThreadsafeInputNodeFS {
    writeFile;
    removeFile;
    mkdir;
    mkdirp;
    removeDirAll;
    readDir;
    readFile;
    stat;
    lstat;
    chmod;
    realpath;
    open;
    rename;
    close;
    write;
    writeAll;
    read;
    readUntil;
    readToEnd;
    constructor(fs){
        if (Object.assign(this, NOOP_FILESYSTEM), !fs) return;
        this.readDir = memoizeFn(()=>{
            let readDirFn = node_util.promisify(fs.readdir.bind(fs));
            return async (filePath)=>await readDirFn(filePath);
        }), this.readFile = memoizeFn(()=>node_util.promisify(fs.readFile.bind(fs))), this.stat = memoizeFn(()=>(name)=>new Promise((resolve, reject)=>{
                    fs.stat(name, (err, stats)=>{
                        if (err) return reject(err);
                        resolve(stats && __to_binding_stat(stats));
                    });
                })), this.lstat = memoizeFn(()=>(name)=>new Promise((resolve, reject)=>{
                    (fs.lstat || fs.stat)(name, (err, stats)=>{
                        if (err) return reject(err);
                        resolve(stats && __to_binding_stat(stats));
                    });
                })), this.realpath = memoizeFn(()=>(name)=>new Promise((resolve, reject)=>{
                    fs.realpath ? fs.realpath(name, (err, path)=>{
                        if (err) return reject(err);
                        resolve(path);
                    }) : reject(Error('fs.realpath is not a function'));
                }));
    }
    static __to_binding(fs) {
        return new this(fs);
    }
    static needsBinding(ifs) {
        return Array.isArray(ifs) && ifs.length > 0;
    }
}
class ThreadsafeOutputNodeFS {
    writeFile;
    removeFile;
    mkdir;
    mkdirp;
    removeDirAll;
    readDir;
    readFile;
    stat;
    lstat;
    chmod;
    realpath;
    open;
    rename;
    close;
    write;
    writeAll;
    read;
    readUntil;
    readToEnd;
    constructor(fs){
        if (Object.assign(this, NOOP_FILESYSTEM), !fs) return;
        this.writeFile = memoizeFn(()=>node_util.promisify(fs.writeFile.bind(fs))), this.removeFile = memoizeFn(()=>node_util.promisify(fs.unlink.bind(fs))), this.mkdir = memoizeFn(()=>node_util.promisify(fs.mkdir.bind(fs))), this.mkdirp = memoizeFn(()=>node_util.promisify(mkdirp.bind(null, fs))), this.removeDirAll = memoizeFn(()=>node_util.promisify((function rmrf(fs, p, callback) {
                (fs.lstat || fs.stat)(p, (err, stats)=>{
                    if (err) return 'ENOENT' === err.code ? callback() : callback(err);
                    stats.isDirectory() ? fs.readdir(p, (err, files)=>{
                        if (err) return callback(err);
                        let count = files.length;
                        if (0 === count) fs.rmdir(p, callback);
                        else for (let file of files){
                            if ('string' != typeof file) throw Error('file should be a string');
                            let fullPath = fs_join(fs, p, file);
                            rmrf(fs, fullPath, (err)=>{
                                if (err) return callback(err);
                                0 == --count && fs.rmdir(p, callback);
                            });
                        }
                    }) : fs.unlink(p, callback);
                });
            }).bind(null, fs))), this.readDir = memoizeFn(()=>{
            let readDirFn = node_util.promisify(fs.readdir.bind(fs));
            return async (filePath)=>await readDirFn(filePath);
        }), this.readFile = memoizeFn(()=>node_util.promisify(fs.readFile.bind(fs))), this.stat = memoizeFn(()=>{
            let statFn = node_util.promisify(fs.stat.bind(fs));
            return async (filePath)=>{
                let res = await statFn(filePath);
                return res && __to_binding_stat(res);
            };
        }), this.lstat = memoizeFn(()=>{
            let statFn = node_util.promisify((fs.lstat || fs.stat).bind(fs));
            return async (filePath)=>{
                let res = await statFn(filePath);
                return res && __to_binding_stat(res);
            };
        }), this.chmod = memoizeFn(()=>node_util.promisify(fs.chmod.bind(fs)));
    }
    static __to_binding(fs) {
        return new this(fs);
    }
}
class ThreadsafeIntermediateNodeFS extends ThreadsafeOutputNodeFS {
    constructor(fs){
        if (super(fs), !fs) return;
        this.open = memoizeFn(()=>node_util.promisify(fs.open.bind(fs))), this.rename = memoizeFn(()=>node_util.promisify(fs.rename.bind(fs))), this.close = memoizeFn(()=>node_util.promisify(fs.close.bind(fs))), this.write = memoizeFn(()=>{
            let writeFn = node_util.promisify(fs.write.bind(fs));
            return async (fd, content, position)=>writeFn(fd, content, {
                    position
                });
        }), this.writeAll = memoizeFn(()=>{
            let writeFn = node_util.promisify(fs.writeFile.bind(fs));
            return async (fd, content)=>writeFn(fd, content);
        }), this.read = memoizeFn(()=>{
            let readFn = fs.read.bind(fs);
            return (fd, length, position)=>new Promise((resolve, reject)=>{
                    readFn(fd, {
                        position,
                        length
                    }, (err, _bytesRead, buffer)=>{
                        err ? reject(err) : resolve(buffer);
                    });
                });
        }), this.readUntil = memoizeFn(()=>async (fd, delim, position)=>{
                let res = [], current_position = position;
                for(;;){
                    let buffer = await this.read(fd, 1000, current_position);
                    if (!buffer || 0 === buffer.length) break;
                    let pos = buffer.indexOf(delim);
                    if (pos >= 0) {
                        res.push(buffer.slice(0, pos));
                        break;
                    }
                    res.push(buffer), current_position += buffer.length;
                }
                return Buffer.concat(res);
            }), this.readToEnd = memoizeFn(()=>async (fd, position)=>{
                let res = [], current_position = position;
                for(;;){
                    let buffer = await this.read(fd, 1000, current_position);
                    if (!buffer || 0 === buffer.length) break;
                    res.push(buffer), current_position += buffer.length;
                }
                return Buffer.concat(res);
            });
    }
    static __to_binding(fs) {
        return new this(fs);
    }
}
class HookWebpackError extends lib_WebpackError {
    hook;
    error;
    constructor(error, hook){
        super(error.message), this.name = 'HookWebpackError', this.hook = hook, this.error = error, this.hideStack = !0, this.details = `caused by plugins in ${hook}\n${error.stack}`, this.stack += `\n-- inner error --\n${error.stack}`;
    }
}
let makeWebpackErrorCallback = (callback, hook)=>(err, result)=>{
        err ? err instanceof lib_WebpackError ? callback(err) : callback(new HookWebpackError(err, hook)) : callback(null, result);
    };
class Cache {
    static STAGE_DISK = 10;
    static STAGE_MEMORY = -10;
    static STAGE_DEFAULT = 0;
    static STAGE_NETWORK = 20;
    hooks;
    constructor(){
        this.hooks = {
            get: new AsyncSeriesBailHook([
                'identifier',
                'etag',
                'gotHandlers'
            ]),
            store: new AsyncParallelHook([
                'identifier',
                'etag',
                'data'
            ]),
            storeBuildDependencies: new AsyncParallelHook([
                'dependencies'
            ]),
            beginIdle: new SyncHook([]),
            endIdle: new AsyncParallelHook([]),
            shutdown: new AsyncParallelHook([])
        };
    }
    get(identifier, etag, callback) {
        let gotHandlers = [];
        this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, res)=>{
            var times, callback1;
            if (err) return void callback(err instanceof lib_WebpackError ? err : new HookWebpackError(err, 'Cache.hooks.get'));
            let result = res;
            if (null === result && (result = void 0), gotHandlers.length > 1) {
                let leftTimes, innerCallback = (times = gotHandlers.length, callback1 = ()=>callback(null, result), leftTimes = times, (err)=>0 == --leftTimes ? callback1() : err && leftTimes > 0 ? (leftTimes = 0, callback1()) : void 0);
                for (let gotHandler of gotHandlers)gotHandler(result, innerCallback);
            } else 1 === gotHandlers.length ? gotHandlers[0](result, ()=>callback(null, result)) : callback(null, result);
        });
    }
    store(identifier, etag, data, callback) {
        this.hooks.store.callAsync(identifier, etag, data, makeWebpackErrorCallback(callback, 'Cache.hooks.store'));
    }
    storeBuildDependencies(dependencies, callback) {
        this.hooks.storeBuildDependencies.callAsync(dependencies, makeWebpackErrorCallback(callback, 'Cache.hooks.storeBuildDependencies'));
    }
    beginIdle() {
        this.hooks.beginIdle.call();
    }
    endIdle(callback) {
        this.hooks.endIdle.callAsync(makeWebpackErrorCallback(callback, 'Cache.hooks.endIdle'));
    }
    shutdown(callback) {
        this.hooks.shutdown.callAsync(makeWebpackErrorCallback(callback, 'Cache.hooks.shutdown'));
    }
}
class LazyHashedEtag {
    _obj;
    _hash;
    _hashFunction;
    constructor(obj, hashFunction = 'xxhash64'){
        this._obj = obj, this._hash = void 0, this._hashFunction = hashFunction;
    }
    toString() {
        if (void 0 === this._hash) {
            let hash = createHash_createHash(this._hashFunction);
            this._obj.updateHash(hash), this._hash = hash.digest('base64');
        }
        return this._hash;
    }
}
let mapStrings = new Map(), mapObjects = new WeakMap();
class MergedEtag {
    a;
    b;
    constructor(a, b){
        this.a = a, this.b = b;
    }
    toString() {
        return `${this.a.toString()}|${this.b.toString()}`;
    }
}
let dualObjectMap = new WeakMap(), objectStringMap = new WeakMap();
class ItemCacheFacade {
    _cache;
    _name;
    _etag;
    constructor(cache, name, etag){
        this._cache = cache, this._name = name, this._etag = etag;
    }
    get(callback) {
        this._cache.get(this._name, this._etag, callback);
    }
    getPromise() {
        return new Promise((resolve, reject)=>{
            this._cache.get(this._name, this._etag, (err, data)=>{
                err ? reject(err) : resolve(data);
            });
        });
    }
    store(data, callback) {
        this._cache.store(this._name, this._etag, data, callback);
    }
    storePromise(data) {
        return new Promise((resolve, reject)=>{
            this._cache.store(this._name, this._etag, data, (err)=>{
                err ? reject(err) : resolve();
            });
        });
    }
    provide(computer, callback) {
        this.get((err, cacheEntry)=>err ? callback(err) : void 0 !== cacheEntry ? cacheEntry : void computer((err, result)=>{
                if (err) return callback(err);
                this.store(result, (err)=>{
                    if (err) return callback(err);
                    callback(null, result);
                });
            }));
    }
    async providePromise(computer) {
        let cacheEntry = await this.getPromise();
        if (void 0 !== cacheEntry) return cacheEntry;
        let result = await computer();
        return await this.storePromise(result), result;
    }
}
let lib_CacheFacade = class CacheFacade {
    _name;
    _cache;
    _hashFunction;
    constructor(cache, name, hashFunction){
        this._cache = cache, this._name = name, this._hashFunction = hashFunction;
    }
    getChildCache(name) {
        return new CacheFacade(this._cache, `${this._name}|${name}`, this._hashFunction);
    }
    getItemCache(identifier, etag) {
        return new ItemCacheFacade(this._cache, `${this._name}|${identifier}`, etag);
    }
    getLazyHashedEtag(obj) {
        return ((obj, hashFunction = 'xxhash64')=>{
            let innerMap;
            if ('string' == typeof hashFunction) {
                if (void 0 === (innerMap = mapStrings.get(hashFunction))) {
                    let newHash = new LazyHashedEtag(obj, hashFunction);
                    return (innerMap = new WeakMap()).set(obj, newHash), mapStrings.set(hashFunction, innerMap), newHash;
                }
            } else if (void 0 === (innerMap = mapObjects.get(hashFunction))) {
                let newHash = new LazyHashedEtag(obj, hashFunction);
                return (innerMap = new WeakMap()).set(obj, newHash), mapObjects.set(hashFunction, innerMap), newHash;
            }
            let hash = innerMap.get(obj);
            if (void 0 !== hash) return hash;
            let newHash = new LazyHashedEtag(obj, hashFunction);
            return innerMap.set(obj, newHash), newHash;
        })(obj, this._hashFunction);
    }
    mergeEtags(a, b) {
        return ((first, second)=>{
            let a = first, b = second;
            if ('string' == typeof a) {
                if ('string' == typeof b) return `${a}|${b}`;
                let temp = b;
                b = a, a = temp;
            } else if ('string' != typeof b) {
                let map = dualObjectMap.get(a);
                void 0 === map && dualObjectMap.set(a, map = new WeakMap());
                let mergedEtag = map.get(b);
                if (void 0 === mergedEtag) {
                    let newMergedEtag = new MergedEtag(a, b);
                    return map.set(b, newMergedEtag), newMergedEtag;
                }
                return mergedEtag;
            }
            let map = objectStringMap.get(a);
            void 0 === map && objectStringMap.set(a, map = new Map());
            let mergedEtag = map.get(b);
            if (void 0 === mergedEtag) {
                let newMergedEtag = new MergedEtag(a, b);
                return map.set(b, newMergedEtag), newMergedEtag;
            }
            return mergedEtag;
        })(a, b);
    }
    get(identifier, etag, callback) {
        this._cache.get(`${this._name}|${identifier}`, etag, callback);
    }
    getPromise(identifier, etag) {
        return new Promise((resolve, reject)=>{
            this._cache.get(`${this._name}|${identifier}`, etag, (err, data)=>{
                err ? reject(err) : resolve(data);
            });
        });
    }
    store(identifier, etag, data, callback) {
        this._cache.store(`${this._name}|${identifier}`, etag, data, callback);
    }
    storePromise(identifier, etag, data) {
        return new Promise((resolve, reject)=>{
            this._cache.store(`${this._name}|${identifier}`, etag, data, (err)=>{
                err ? reject(err) : resolve();
            });
        });
    }
    provide(identifier, etag, computer, callback) {
        this.get(identifier, etag, (err, cacheEntry)=>err ? callback(err) : void 0 !== cacheEntry ? cacheEntry : void computer((err, result)=>{
                if (err) return callback(err);
                this.store(identifier, etag, result, (err)=>{
                    if (err) return callback(err);
                    callback(null, result);
                });
            }));
    }
    async providePromise(identifier, etag, computer) {
        let cacheEntry = await this.getPromise(identifier, etag);
        if (void 0 !== cacheEntry) return cacheEntry;
        let result = await computer();
        return await this.storePromise(identifier, etag, result), result;
    }
};
class NormalModuleFactory {
    hooks;
    resolverFactory;
    constructor(resolverFactory){
        this.hooks = {
            resolveForScheme: new HookMap(()=>new AsyncSeriesBailHook([
                    'resourceData'
                ])),
            beforeResolve: new AsyncSeriesBailHook([
                'resolveData'
            ]),
            factorize: new AsyncSeriesBailHook([
                'resolveData'
            ]),
            resolve: new AsyncSeriesBailHook([
                'resolveData'
            ]),
            afterResolve: new AsyncSeriesBailHook([
                'resolveData'
            ]),
            createModule: new AsyncSeriesBailHook([
                'createData',
                'resolveData'
            ])
        }, this.resolverFactory = resolverFactory;
    }
    getResolver(type, resolveOptions) {
        return this.resolverFactory.get(type, resolveOptions);
    }
}
class Resolver {
    #binding;
    constructor(binding){
        this.#binding = binding;
    }
    resolveSync(_context, path, request) {
        return this.#binding.resolveSync(path, request) ?? !1;
    }
    resolve(_context, path, request, resolveContext, callback) {
        this.#binding.resolve(path, request, (error, text)=>{
            if (error) return void callback(error);
            let req = text ? JSON.parse(text) : void 0;
            req?.fileDependencies && req.fileDependencies.forEach((file)=>{
                resolveContext.fileDependencies?.add(file);
            }), req?.missingDependencies && req.missingDependencies.forEach((missing)=>{
                resolveContext.missingDependencies?.add(missing);
            }), callback(error, !!req && `${req.path.replace(/#/g, '\u200b#')}${req.query.replace(/#/g, '\u200b#')}${req.fragment}`, req);
        });
    }
}
let EMPTY_RESOLVE_OPTIONS = {};
class ResolverFactory {
    #binding;
    #cache = new Map();
    static __to_binding(resolver_factory) {
        return resolver_factory.#binding;
    }
    constructor(pnp, resolveOptions, loaderResolveOptions){
        this.#binding = new (binding_default()).JsResolverFactory(pnp, getRawResolve(resolveOptions), getRawResolve(loaderResolveOptions));
    }
    #create(type, resolveOptionsWithDepType) {
        let { dependencyType, resolveToContext, ...resolve } = resolveOptionsWithDepType, resolver = new Resolver(this.#binding.get(type, {
            ...getRawResolve(resolve),
            dependencyType,
            resolveToContext
        })), childCache = new WeakMap();
        return resolver.withOptions = (options)=>{
            let cacheEntry = childCache.get(options);
            if (void 0 !== cacheEntry) return cacheEntry;
            let mergedOptions = cachedCleverMerge(resolveOptionsWithDepType, options), newResolver = this.get(type, mergedOptions);
            return childCache.set(options, newResolver), newResolver;
        }, resolver;
    }
    get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) {
        let typedCaches = this.#cache.get(type);
        typedCaches || (typedCaches = {
            direct: new WeakMap(),
            stringified: new Map()
        }, this.#cache.set(type, typedCaches));
        let cachedResolver = typedCaches.direct.get(resolveOptions);
        if (cachedResolver) return cachedResolver;
        let ident = JSON.stringify(resolveOptions), resolver = typedCaches.stringified.get(ident);
        if (resolver) return typedCaches.direct.set(resolveOptions, resolver), resolver;
        let newResolver = this.#create(type, resolveOptions);
        return typedCaches.direct.set(resolveOptions, newResolver), typedCaches.stringified.set(ident, newResolver), newResolver;
    }
}
class RuleSetCompiler {
    references;
    builtinReferences;
    constructor(){
        this.references = new Map(), this.builtinReferences = new Map();
    }
}
class MultiStats {
    stats;
    constructor(stats){
        this.stats = stats;
    }
    get hash() {
        return this.stats.map((stat)=>stat.hash).join('');
    }
    hasErrors() {
        return this.stats.some((stat)=>stat.hasErrors());
    }
    hasWarnings() {
        return this.stats.some((stat)=>stat.hasWarnings());
    }
    #createChildOptions(options, context) {
        let { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
            preset: options
        } : options ?? {}, children = this.stats.map((stat, idx)=>{
            let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
            return stat.compilation.createStatsOptions({
                ...baseOptions,
                ...'string' == typeof childOptions ? {
                    preset: childOptions
                } : childOptions && 'object' == typeof childOptions ? childOptions : void 0
            }, context);
        });
        return {
            hash: children.every((o)=>o.hash),
            errorsCount: children.every((o)=>o.errorsCount),
            warningsCount: children.every((o)=>o.warningsCount),
            errors: children.every((o)=>o.errors),
            warnings: children.every((o)=>o.warnings),
            children,
            context: '',
            version: ''
        };
    }
    toJson(options) {
        let childOptions = this.#createChildOptions(options, {
            forToString: !1
        }), obj = {};
        obj.children = this.stats.map((stat, idx)=>{
            let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
            return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
        }), childOptions.version && (obj.rspackVersion = "2.0.8", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
        let mapError = (j, obj)=>({
                ...obj,
                compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
            });
        if (childOptions.errors) for (let j of (obj.errors = [], obj.children))for (let i of j.errors || [])obj.errors.push(mapError(j, i));
        if (childOptions.warnings) for (let j of (obj.warnings = [], obj.children))for (let i of j.warnings || [])obj.warnings.push(mapError(j, i));
        if (childOptions.errorsCount) for (let j of (obj.errorsCount = 0, obj.children))obj.errorsCount += j.errorsCount || 0;
        if (childOptions.warningsCount) for (let j of (obj.warningsCount = 0, obj.children))obj.warningsCount += j.warningsCount || 0;
        return obj;
    }
    toString(options) {
        let childOptions = this.#createChildOptions(options, {
            forToString: !0
        });
        return this.stats.map((stat, idx)=>{
            let str = stat.toString(childOptions.children[idx]), compilationName = stat.compilation.name, name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root).replace(/\|/g, ' ');
            return str ? name ? `${name}:\n${'  ' + str.replace(/\n([^\n])/g, `\n  $1`)}` : str : str;
        }).filter(Boolean).join('\n\n');
    }
}
function throwError() {
    throw Error('Callback was already called.');
}
function asyncLib_noop() {}
function once(func) {
    return (err)=>{
        let fn = func;
        func = asyncLib_noop, fn(err);
    };
}
let asyncLib_each = function(collection, iterator, originalCallback) {
    let callback = once(originalCallback), size = 0, completed = 0;
    if (Array.isArray(collection)) {
        size = collection.length;
        var callback1 = (err)=>{
            err ? (callback = once(callback))(err) : ++completed === size && callback(null);
        };
        let index = -1;
        for(; ++index < collection.length;)iterator(collection[index], function(func) {
            return (err)=>{
                let fn = func;
                func = throwError, fn(err);
            };
        }(callback1));
    }
    size || callback(null);
}, src_MultiWatching = class {
    watchings;
    compiler;
    constructor(watchings, compiler){
        this.watchings = watchings, this.compiler = compiler;
    }
    invalidate(callback) {
        if (callback) asyncLib_each(this.watchings, (watching, callback)=>watching.invalidate(callback), callback);
        else for (let watching of this.watchings)watching.invalidate();
    }
    invalidateWithChangesAndRemovals(changedFiles, removedFiles, callback) {
        if (callback) asyncLib_each(this.watchings, (watching, callback)=>watching.invalidateWithChangesAndRemovals(changedFiles, removedFiles, callback), callback);
        else for (let watching of this.watchings)watching.invalidateWithChangesAndRemovals(changedFiles, removedFiles);
    }
    close(callback) {
        asyncLib_each(this.watchings, (watching, finishedCallback)=>{
            watching.close(finishedCallback);
        }, (err)=>{
            this.compiler.hooks.watchClose.call(), 'function' == typeof callback && (this.compiler.running = !1, callback(err));
        });
    }
    suspend() {
        for (let watching of this.watchings)watching.suspend();
    }
    resume() {
        for (let watching of this.watchings)watching.resume();
    }
};
function ArrayQueue_type_of(obj) {
    return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
}
key = function(input, hint) {
    if ("object" !== ArrayQueue_type_of(input) || null === input) return input;
    var prim = input[Symbol.toPrimitive];
    if (void 0 !== prim) {
        var res = prim.call(input, hint || "default");
        if ("object" !== ArrayQueue_type_of(res)) return res;
        throw TypeError("@@toPrimitive must return a primitive value.");
    }
    return ("string" === hint ? String : Number)(input);
}(Symbol.iterator, "string"), ArrayQueue_computedKey = "symbol" === ArrayQueue_type_of(key) ? key : String(key);
let util_ArrayQueue = class {
    _list;
    _listReversed;
    constructor(items){
        this._list = items ? Array.from(items) : [], this._listReversed = [];
    }
    get length() {
        return this._list.length + this._listReversed.length;
    }
    clear() {
        this._list.length = 0, this._listReversed.length = 0;
    }
    enqueue(item) {
        this._list.push(item);
    }
    dequeue() {
        if (0 === this._listReversed.length) {
            if (0 === this._list.length) return;
            if (1 === this._list.length) return this._list.pop();
            if (this._list.length < 16) return this._list.shift();
            let temp = this._listReversed;
            this._listReversed = this._list, this._listReversed.reverse(), this._list = temp;
        }
        return this._listReversed.pop();
    }
    delete(item) {
        let i = this._list.indexOf(item);
        if (i >= 0) this._list.splice(i, 1);
        else {
            let i = this._listReversed.indexOf(item);
            i >= 0 && this._listReversed.splice(i, 1);
        }
    }
    *[ArrayQueue_computedKey]() {
        yield* this._list;
        for(let i = this._listReversed.length - 1; i >= 0; i--)yield this._listReversed[i];
    }
};
class MultiCompiler {
    compilers;
    dependencies;
    hooks;
    _options;
    running;
    watching;
    constructor(compilers, options){
        let normalizedCompilers;
        normalizedCompilers = Array.isArray(compilers) ? compilers : Object.entries(compilers).map(([name, compiler])=>(compiler.name = name, compiler)), this.hooks = {
            done: new SyncHook([
                'stats'
            ]),
            invalid: new MultiHook(normalizedCompilers.map((c)=>c.hooks.invalid)),
            run: new MultiHook(normalizedCompilers.map((c)=>c.hooks.run)),
            watchClose: new SyncHook([]),
            watchRun: new MultiHook(normalizedCompilers.map((c)=>c.hooks.watchRun)),
            beforeCompile: new MultiHook(normalizedCompilers.map((c)=>c.hooks.beforeCompile)),
            shutdown: new MultiHook(normalizedCompilers.map((c)=>c.hooks.shutdown)),
            infrastructureLog: new MultiHook(normalizedCompilers.map((c)=>c.hooks.infrastructureLog))
        }, this.compilers = normalizedCompilers, this._options = {
            parallelism: options?.parallelism || 1 / 0
        }, this.dependencies = new WeakMap(), this.running = !1;
        let compilerStats = this.compilers.map(()=>null), doneCompilers = 0;
        for(let index = 0; index < this.compilers.length; index++){
            let compiler = this.compilers[index], compilerIndex = index, compilerDone = !1;
            compiler.hooks.done.tap('MultiCompiler', (stats)=>{
                !compilerDone && (compilerDone = !0, doneCompilers++), compilerStats[compilerIndex] = stats, doneCompilers === this.compilers.length && this.hooks.done.call(new MultiStats(compilerStats));
            }), compiler.hooks.invalid.tap('MultiCompiler', ()=>{
                compilerDone && (compilerDone = !1, doneCompilers--);
            });
        }
    }
    set unsafeFastDrop(value) {
        for (let compiler of this.compilers)compiler.unsafeFastDrop = value;
    }
    get options() {
        return Object.assign(this.compilers.map((c)=>c.options), this._options);
    }
    get outputPath() {
        let commonPath = this.compilers[0].outputPath;
        for (let compiler of this.compilers)for(; 0 !== compiler.outputPath.indexOf(commonPath) && /[/\\]/.test(commonPath);)commonPath = commonPath.replace(/[/\\][^/\\]*$/, '');
        return commonPath || '/' !== this.compilers[0].outputPath[0] ? commonPath : '/';
    }
    get inputFileSystem() {
        throw Error('Cannot read inputFileSystem of a MultiCompiler');
    }
    get outputFileSystem() {
        throw Error('Cannot read outputFileSystem of a MultiCompiler');
    }
    get watchFileSystem() {
        throw Error('Cannot read watchFileSystem of a MultiCompiler');
    }
    get intermediateFileSystem() {
        throw Error('Cannot read outputFileSystem of a MultiCompiler');
    }
    set inputFileSystem(value) {
        for (let compiler of this.compilers)compiler.inputFileSystem = value;
    }
    set outputFileSystem(value) {
        for (let compiler of this.compilers)compiler.outputFileSystem = value;
    }
    set watchFileSystem(value) {
        for (let compiler of this.compilers)compiler.watchFileSystem = value;
    }
    set intermediateFileSystem(value) {
        for (let compiler of this.compilers)compiler.intermediateFileSystem = value;
    }
    getInfrastructureLogger(name) {
        return this.compilers[0].getInfrastructureLogger(name);
    }
    setDependencies(compiler, dependencies) {
        this.dependencies.set(compiler, dependencies);
    }
    validateDependencies(callback) {
        let edges = new Set(), missing = [], targetFound = (compiler)=>{
            for (let edge of edges)if (edge.target === compiler) return !0;
            return !1;
        };
        for (let source of this.compilers){
            let dependencies = this.dependencies.get(source);
            if (dependencies) for (let dep of dependencies){
                let target = this.compilers.find((c)=>c.name === dep);
                target ? edges.add({
                    source,
                    target
                }) : missing.push(dep);
            }
        }
        let errors = missing.map((m)=>`Compiler dependency \`${m}\` not found.`), stack = this.compilers.filter((c)=>!targetFound(c));
        for(; stack.length > 0;){
            let current = stack.pop();
            for (let edge of edges)if (edge.source === current) {
                edges.delete(edge);
                let target = edge.target;
                targetFound(target) || stack.push(target);
            }
        }
        if (edges.size > 0) {
            let lines = Array.from(edges).sort((e1, e2)=>e1.source.name.localeCompare(e2.source.name) || e1.target.name.localeCompare(e2.target.name)).map((edge)=>`${edge.source.name} -> ${edge.target.name}`);
            lines.unshift('Circular dependency found in compiler dependencies.'), errors.unshift(lines.join('\n'));
        }
        return !(errors.length > 0) || (callback(Error(errors.join('\n'))), !1);
    }
    #runGraph(setup, run, callback) {
        let nodes = this.compilers.map((compiler)=>({
                compiler,
                setupResult: void 0,
                result: void 0,
                state: 'blocked',
                children: [],
                parents: []
            })), compilerToNode = new Map();
        for (let node of nodes)compilerToNode.set(node.compiler.name, node);
        for (let node of nodes){
            let dependencies = this.dependencies.get(node.compiler);
            if (dependencies) for (let dep of dependencies){
                let parent = compilerToNode.get(dep);
                node.parents.push(parent), parent.children.push(node);
            }
        }
        let queue = new util_ArrayQueue();
        for (let node of nodes)0 === node.parents.length && (node.state = 'queued', queue.enqueue(node));
        let errored = !1, running = 0, parallelism = this._options.parallelism, nodeDone = (node, err, stats)=>{
            if (!errored) {
                if (err) return errored = !0, asyncLib_each(nodes, (node, callback)=>{
                    node.compiler.watching ? node.compiler.watching.close(callback) : callback();
                }, ()=>callback(err));
                if (node.result = stats, running--, 'running' === node.state) for (let child of (node.state = 'done', node.children))'blocked' === child.state && queue.enqueue(child);
                else 'running-outdated' === node.state && (node.state = 'blocked', queue.enqueue(node));
                processQueue();
            }
        }, nodeInvalidFromParent = (node)=>{
            for (let child of ('done' === node.state ? node.state = 'blocked' : 'running' === node.state && (node.state = 'running-outdated'), node.children))nodeInvalidFromParent(child);
        }, nodeInvalid = (node)=>{
            for (let child of ('done' === node.state ? node.state = 'pending' : 'running' === node.state && (node.state = 'running-outdated'), node.children))nodeInvalidFromParent(child);
        }, setupResults = [];
        nodes.forEach((node, i)=>{
            setupResults.push(node.setupResult = setup(node.compiler, i, nodeDone.bind(null, node), ()=>'starting' !== node.state && 'running' !== node.state, ()=>{
                nodeInvalid(node), 'pending' === node.state && (node.state = 'blocked'), 'blocked' === node.state && (queue.enqueue(node), processQueue());
            }, ()=>nodeInvalid(node)));
        });
        let processing = !0, processQueue = ()=>{
            processing || (processing = !0, process.nextTick(processQueueWorker));
        }, processQueueWorker = ()=>{
            for(; running < parallelism && queue.length > 0 && !errored;){
                let node = queue.dequeue();
                ('queued' === node.state || 'blocked' === node.state && node.parents.every((p)=>'done' === p.state)) && (running++, node.state = 'starting', run(node.compiler, node.setupResult, nodeDone.bind(null, node)), node.state = 'running');
            }
            if (processing = !1, !errored && 0 === running && nodes.every((node)=>'done' === node.state)) {
                let stats = [];
                for (let node of nodes){
                    let result = node.result;
                    result && (node.result = void 0, stats.push(result));
                }
                stats.length > 0 && callback(null, new MultiStats(stats));
            }
        };
        return processQueueWorker(), setupResults;
    }
    watch(watchOptions, handler) {
        if (this.running) return handler(new ConcurrentCompilationError());
        if (this.running = !0, this.validateDependencies(handler)) {
            let watchings = this.#runGraph((compiler, idx, done, isBlocked, setChanged, setInvalid)=>{
                let watching = compiler.watch(Array.isArray(watchOptions) ? watchOptions[idx] : watchOptions, done);
                return watching && (watching.onInvalid = setInvalid, watching.onChange = setChanged, watching.isBlocked = isBlocked), watching;
            }, (compiler, watching, _done)=>{
                compiler.watching === watching && (watching.running || watching.invalidate());
            }, handler);
            return this.watching = new src_MultiWatching(watchings, this), this.watching;
        }
        return this.watching = new src_MultiWatching([], this), this.watching;
    }
    run(callback, options) {
        if (this.running) return callback(new ConcurrentCompilationError());
        this.running = !0, this.validateDependencies(callback) && this.#runGraph(()=>{}, (compiler, _, callback)=>compiler.run(callback, options), (err, stats)=>{
            if (this.running = !1, void 0 !== callback) return callback(err, stats);
        });
    }
    purgeInputFileSystem() {
        for (let compiler of this.compilers)compiler.inputFileSystem?.purge?.();
    }
    close(callback) {
        asyncLib_each(this.compilers, (compiler, cb)=>{
            compiler.close(cb);
        }, callback);
    }
}
let filterToFunction = (item)=>{
    if ('string' == typeof item) {
        let regExp = RegExp(`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, '\\$&')}([\\\\/]|$|!|\\?)`);
        return (ident)=>regExp.test(ident);
    }
    return item && 'object' == typeof item && 'function' == typeof item.test ? (ident)=>item.test(ident) : 'function' == typeof item ? item : 'boolean' == typeof item ? ()=>item : void 0;
}, LogLevel = {
    none: 6,
    false: 6,
    error: 5,
    warn: 4,
    info: 3,
    log: 2,
    true: 2,
    verbose: 1
};
class NativeWatchFileSystem {
    #inner;
    #isFirstWatch = !0;
    #inputFileSystem;
    constructor(inputFileSystem){
        this.#inputFileSystem = inputFileSystem;
    }
    watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
        if ((!files.added || 'function' != typeof files.added[Symbol.iterator]) && (!files.removed || 'function' != typeof files.removed[Symbol.iterator])) throw Error("Invalid arguments: 'files'");
        if ((!directories.added || 'function' != typeof directories.added[Symbol.iterator]) && (!directories.removed || 'function' != typeof directories.removed[Symbol.iterator])) throw Error("Invalid arguments: 'directories'");
        if ('function' != typeof callback) throw Error("Invalid arguments: 'callback'");
        if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
        if ('function' != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
        let nativeWatcher = this.getNativeWatcher(options);
        return nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
            if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
            nativeWatcher.pause();
            let changedFiles = result.changedFiles, removedFiles = result.removedFiles;
            if (this.#inputFileSystem?.purge) {
                let fs = this.#inputFileSystem;
                for (let item of changedFiles)fs.purge?.(item);
                for (let item of removedFiles)fs.purge?.(item);
            }
            callback(err, new Map(), new Map(), new Set(changedFiles), new Set(removedFiles));
        }, (fileName)=>{
            callbackUndelayed(fileName, Date.now());
        }), this.#isFirstWatch = !1, {
            close: ()=>{
                nativeWatcher.close().then(()=>{
                    this.#inner = void 0;
                }, (err)=>{
                    console.error('Error closing native watcher:', err);
                });
            },
            pause: ()=>{
                nativeWatcher.pause();
            },
            getInfo: ()=>({
                    changes: new Set(),
                    removals: new Set(),
                    fileTimeInfoEntries: new Map(),
                    contextTimeInfoEntries: new Map()
                })
        };
    }
    getNativeWatcher(options) {
        if (this.#inner) return this.#inner;
        let nativeWatcherOptions = {
            followSymlinks: options.followSymlinks,
            aggregateTimeout: options.aggregateTimeout,
            pollInterval: 'boolean' == typeof options.poll ? 0 : options.poll,
            ignored: ((ignored)=>{
                if (Array.isArray(ignored) || 'string' == typeof ignored || ignored instanceof RegExp) return ignored;
                if ('function' == typeof ignored) throw Error("NativeWatcher does not support using a function for the 'ignored' option");
            })(options.ignored)
        }, nativeWatcher = new (binding_default()).NativeWatcher(nativeWatcherOptions);
        return this.#inner = nativeWatcher, nativeWatcher;
    }
    triggerEvent(kind, path) {
        this.#inner?.triggerEvent(kind, path);
    }
    formatWatchDependencies(dependencies) {
        return this.#isFirstWatch ? [
            Array.from(dependencies),
            []
        ] : [
            Array.from(dependencies.added ?? []),
            Array.from(dependencies.removed ?? [])
        ];
    }
}
let NodeWatchFileSystem_require = createRequire(import.meta.url);
class NodeWatchFileSystem {
    inputFileSystem;
    watcherOptions;
    watcher;
    constructor(inputFileSystem){
        this.inputFileSystem = inputFileSystem, this.watcherOptions = {
            aggregateTimeout: 0
        };
    }
    watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
        if (!files || 'function' != typeof files[Symbol.iterator]) throw Error("Invalid arguments: 'files'");
        if (!directories || 'function' != typeof directories[Symbol.iterator]) throw Error("Invalid arguments: 'directories'");
        if (!missing || 'function' != typeof missing[Symbol.iterator]) throw Error("Invalid arguments: 'missing'");
        if ('function' != typeof callback) throw Error("Invalid arguments: 'callback'");
        if ('number' != typeof startTime && startTime) throw Error("Invalid arguments: 'startTime'");
        if ('object' != typeof options) throw Error("Invalid arguments: 'options'");
        if ('function' != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
        let oldWatcher = this.watcher, Watchpack = NodeWatchFileSystem_require('../compiled/watchpack/index.js');
        this.watcher = new Watchpack(options), callbackUndelayed && this.watcher?.once('change', callbackUndelayed);
        let fetchTimeInfo = ()=>{
            let fileTimeInfoEntries = new Map(), contextTimeInfoEntries = new Map();
            return this.watcher?.collectTimeInfoEntries(fileTimeInfoEntries, contextTimeInfoEntries), {
                fileTimeInfoEntries,
                contextTimeInfoEntries
            };
        };
        return this.watcher?.once('aggregated', (changes, removals)=>{
            if (this.watcher?.pause(), this.inputFileSystem?.purge) {
                let fs = this.inputFileSystem;
                for (let item of changes)fs.purge?.(item);
                for (let item of removals)fs.purge?.(item);
            }
            let { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
            callback(null, fileTimeInfoEntries, contextTimeInfoEntries, changes, removals);
        }), this.watcher?.watch({
            files,
            directories,
            missing,
            startTime
        }), oldWatcher && oldWatcher.close(), {
            close: ()=>{
                this.watcher && (this.watcher.close(), this.watcher = null);
            },
            pause: ()=>{
                this.watcher && this.watcher.pause();
            },
            getAggregatedRemovals: node_util.deprecate(()=>{
                let items = this.watcher?.aggregatedRemovals;
                if (items && this.inputFileSystem?.purge) {
                    let fs = this.inputFileSystem;
                    for (let item of items)fs.purge?.(item);
                }
                return items ?? new Set();
            }, "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.", 'DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS'),
            getAggregatedChanges: node_util.deprecate(()=>{
                let items = this.watcher?.aggregatedChanges;
                if (items && this.inputFileSystem?.purge) {
                    let fs = this.inputFileSystem;
                    for (let item of items)fs.purge?.(item);
                }
                return items ?? new Set();
            }, "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.", 'DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES'),
            getFileTimeInfoEntries: node_util.deprecate(()=>fetchTimeInfo().fileTimeInfoEntries, "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", 'DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES'),
            getContextTimeInfoEntries: node_util.deprecate(()=>fetchTimeInfo().contextTimeInfoEntries, "Watcher.getContextTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.", 'DEP_WEBPACK_WATCHER_CONTEXT_TIME_INFO_ENTRIES'),
            getInfo: ()=>{
                let removals = this.watcher?.aggregatedRemovals ?? new Set(), changes = this.watcher?.aggregatedChanges ?? new Set();
                if (this.inputFileSystem?.purge) {
                    let fs = this.inputFileSystem;
                    if (removals) for (let item of removals)fs.purge?.(item);
                    if (changes) for (let item of changes)fs.purge?.(item);
                }
                let { fileTimeInfoEntries, contextTimeInfoEntries } = fetchTimeInfo();
                return {
                    changes,
                    removals,
                    fileTimeInfoEntries,
                    contextTimeInfoEntries
                };
            }
        };
    }
}
let arraySum = (array)=>{
    let sum = 0;
    for (let item of array)sum += item;
    return sum;
}, truncateArgs = (args, maxLength)=>{
    let lengths = args.map((a)=>`${a}`.length), availableLength = maxLength - lengths.length + 1;
    if (availableLength > 0 && 1 === args.length) return availableLength >= args[0].length ? args : availableLength > 3 ? [
        `...${args[0].slice(-availableLength + 3)}`
    ] : [
        args[0].slice(-availableLength)
    ];
    if (availableLength < arraySum(lengths.map((i)=>Math.min(i, 6)))) return args.length > 1 ? truncateArgs(args.slice(0, args.length - 1), maxLength) : [];
    let currentLength = arraySum(lengths);
    if (currentLength <= availableLength) return args;
    for(; currentLength > availableLength;){
        let maxLength = Math.max(...lengths), shorterItems = lengths.filter((l)=>l !== maxLength), maxReduce = maxLength - (shorterItems.length > 0 ? Math.max(...shorterItems) : 0), maxItems = lengths.length - shorterItems.length, overrun = currentLength - availableLength;
        for(let i = 0; i < lengths.length; i++)if (lengths[i] === maxLength) {
            let reduce = Math.min(Math.floor(overrun / maxItems), maxReduce);
            lengths[i] -= reduce, currentLength -= reduce, overrun -= reduce, maxItems--;
        }
    }
    return args.map((a, i)=>{
        let str = `${a}`, length = lengths[i];
        return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
    });
}, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.22.1/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
var CachedInputFileSystem_default = __webpack_require__.n(CachedInputFileSystem);
class NodeEnvironmentPlugin {
    options;
    constructor(options){
        this.options = options;
    }
    apply(compiler) {
        let { infrastructureLogging } = this.options;
        compiler.infrastructureLogger = (({ level = 'info', debug = !1, console: console1 })=>{
            let debugFilters = 'boolean' == typeof debug ? [
                ()=>debug
            ] : [].concat(debug).map(filterToFunction), loglevel = LogLevel[`${level}`] || 0;
            return (name, type, args)=>{
                let labeledArgs = ()=>Array.isArray(args) ? args.length > 0 && 'string' == typeof args[0] ? [
                        `[${name}] ${args[0]}`,
                        ...args.slice(1)
                    ] : [
                        `[${name}]`,
                        ...args
                    ] : [], debug = debugFilters.some((f)=>f(name));
                switch(type){
                    case LogType.debug:
                        if (!debug) return;
                        'function' == typeof console1.debug ? console1.debug(...labeledArgs()) : console1.log(...labeledArgs());
                        break;
                    case LogType.log:
                        if (!debug && loglevel > LogLevel.log) return;
                        console1.log(...labeledArgs());
                        break;
                    case LogType.info:
                        if (!debug && loglevel > LogLevel.info) return;
                        console1.info(...labeledArgs());
                        break;
                    case LogType.warn:
                        if (!debug && loglevel > LogLevel.warn) return;
                        console1.warn(...labeledArgs());
                        break;
                    case LogType.error:
                        if (!debug && loglevel > LogLevel.error) return;
                        console1.error(...labeledArgs());
                        break;
                    case LogType.trace:
                        if (!debug) return;
                        console1.trace();
                        break;
                    case LogType.groupCollapsed:
                        if (!debug && loglevel > LogLevel.log) return;
                        if (!debug && loglevel > LogLevel.verbose) {
                            'function' == typeof console1.groupCollapsed ? console1.groupCollapsed(...labeledArgs()) : console1.log(...labeledArgs());
                            break;
                        }
                    case LogType.group:
                        if (!debug && loglevel > LogLevel.log) return;
                        'function' == typeof console1.group ? console1.group(...labeledArgs()) : console1.log(...labeledArgs());
                        break;
                    case LogType.groupEnd:
                        if (!debug && loglevel > LogLevel.log) return;
                        'function' == typeof console1.groupEnd && console1.groupEnd();
                        break;
                    case LogType.time:
                        {
                            if (!debug && loglevel > LogLevel.log) return;
                            let ms = 1000 * args[1] + args[2] / 1000000, msg = `[${name}] ${args[0]}: ${ms} ms`;
                            'function' == typeof console1.logTime ? console1.logTime(msg) : console1.log(msg);
                            break;
                        }
                    case LogType.profile:
                        'function' == typeof console1.profile && console1.profile(...labeledArgs());
                        break;
                    case LogType.profileEnd:
                        'function' == typeof console1.profileEnd && console1.profileEnd(...labeledArgs());
                        break;
                    case LogType.clear:
                        if (!debug && loglevel > LogLevel.log) return;
                        'function' == typeof console1.clear && console1.clear();
                        break;
                    case LogType.status:
                        if (!debug && loglevel > LogLevel.info) return;
                        'function' == typeof console1.status ? 0 === args.length ? console1.status() : console1.status(...labeledArgs()) : 0 !== args.length && console1.info(...labeledArgs());
                        break;
                    default:
                        throw Error(`Unexpected LogType ${type}`);
                }
            };
        })({
            level: infrastructureLogging.level || 'info',
            debug: infrastructureLogging.debug || !1,
            console: infrastructureLogging.console || function({ colors, appendOnly, stream }) {
                let currentStatusMessage, hasStatusMessage = !1, currentIndent = '', currentCollapsed = 0, clearStatusMessage = ()=>{
                    hasStatusMessage && (stream.write('\x1b[2K\r'), hasStatusMessage = !1);
                }, writeStatusMessage = ()=>{
                    if (!currentStatusMessage) return;
                    let l = stream.columns, str = (l ? truncateArgs(currentStatusMessage, l - 1) : currentStatusMessage).join(' '), coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
                    stream.write(`\x1b[2K\r${coloredStr}`), hasStatusMessage = !0;
                }, writeColored = (prefix, colorPrefix, colorSuffix)=>(...args)=>{
                        if (currentCollapsed > 0) return;
                        clearStatusMessage();
                        let str = ((str, prefix, colorPrefix, colorSuffix)=>{
                            if ('' === str) return str;
                            let prefixWithIndent = currentIndent + prefix;
                            return colors ? prefixWithIndent + colorPrefix + str.replace(/\n/g, `${colorSuffix}\n${prefix}${colorPrefix}`) + colorSuffix : prefixWithIndent + str.replace(/\n/g, `\n${prefix}`);
                        })(__rspack_external_node_util_1b29d436.format(...args), prefix, colorPrefix, colorSuffix);
                        stream.write(`${str}\n`), writeStatusMessage();
                    }, writeGroupMessage = writeColored('<-> ', '\u001b[1m\u001b[36m', '\u001b[39m\u001b[22m'), writeGroupCollapsedMessage = writeColored('<+> ', '\u001b[1m\u001b[36m', '\u001b[39m\u001b[22m');
                return {
                    log: writeColored('    ', '\u001b[1m', '\u001b[22m'),
                    debug: writeColored('    ', '', ''),
                    trace: writeColored('    ', '', ''),
                    info: writeColored('<i> ', '\u001b[1m\u001b[32m', '\u001b[39m\u001b[22m'),
                    warn: writeColored('<w> ', '\u001b[1m\u001b[33m', '\u001b[39m\u001b[22m'),
                    error: writeColored('<e> ', '\u001b[1m\u001b[31m', '\u001b[39m\u001b[22m'),
                    logTime: writeColored('<t> ', '\u001b[1m\u001b[35m', '\u001b[39m\u001b[22m'),
                    group: (...args)=>{
                        writeGroupMessage(...args), currentCollapsed > 0 ? currentCollapsed++ : currentIndent += '  ';
                    },
                    groupCollapsed: (...args)=>{
                        writeGroupCollapsedMessage(...args), currentCollapsed++;
                    },
                    groupEnd: ()=>{
                        currentCollapsed > 0 ? currentCollapsed-- : currentIndent.length >= 2 && (currentIndent = currentIndent.slice(0, currentIndent.length - 2));
                    },
                    profile: console.profile && ((name)=>console.profile(name)),
                    profileEnd: console.profileEnd && ((name)=>console.profileEnd(name)),
                    clear: !appendOnly && console.clear && (()=>{
                        clearStatusMessage(), console.clear(), writeStatusMessage();
                    }),
                    status: appendOnly ? writeColored('<s> ', '', '') : (name, ...argsWithEmpty)=>{
                        let args = argsWithEmpty.filter(Boolean);
                        void 0 === name && 0 === args.length ? (clearStatusMessage(), currentStatusMessage = void 0) : (currentStatusMessage = 'string' == typeof name && name.startsWith('[webpack.Progress] ') ? [
                            name.slice(19),
                            ...args
                        ] : '[webpack.Progress]' === name ? [
                            ...args
                        ] : [
                            name,
                            ...args
                        ], writeStatusMessage());
                    }
                };
            }({
                colors: infrastructureLogging.colors,
                appendOnly: infrastructureLogging.appendOnly,
                stream: infrastructureLogging.stream
            })
        });
        let inputFileSystem = new (CachedInputFileSystem_default())(node_fs, 60000);
        compiler.inputFileSystem = inputFileSystem, compiler.outputFileSystem = node_fs, compiler.intermediateFileSystem = null, compiler.options.experiments.nativeWatcher ? compiler.watchFileSystem = new NativeWatchFileSystem(inputFileSystem) : compiler.watchFileSystem = new NodeWatchFileSystem(inputFileSystem), compiler.hooks.beforeRun.tap('NodeEnvironmentPlugin', (compiler)=>{
            compiler.inputFileSystem === inputFileSystem && (compiler.fsStartTime = Date.now(), inputFileSystem.purge?.());
        });
    }
}
class MemoryCachePlugin {
    static PLUGIN_NAME = 'MemoryCachePlugin';
    apply(compiler) {
        let cache = new Map();
        compiler.cache.hooks.store.tap({
            name: MemoryCachePlugin.PLUGIN_NAME,
            stage: Cache.STAGE_MEMORY
        }, (identifier, etag, data)=>{
            let dataEtag = 'function' == typeof etag?.toString ? etag.toString() : etag;
            cache.set(identifier, {
                etag: dataEtag,
                data
            });
        }), compiler.cache.hooks.get.tap({
            name: MemoryCachePlugin.PLUGIN_NAME,
            stage: Cache.STAGE_MEMORY
        }, (identifier, etag, gotHandlers)=>{
            let cacheEntry = cache.get(identifier), dataEtag = 'function' == typeof etag?.toString ? etag.toString() : etag;
            return null === cacheEntry ? null : void 0 !== cacheEntry ? cacheEntry.etag === dataEtag ? cacheEntry.data : null : void gotHandlers.push((result, callback)=>(void 0 === result ? cache.set(identifier, null) : cache.set(identifier, {
                    etag: dataEtag,
                    data: result
                }), callback(null)));
        }), compiler.cache.hooks.shutdown.tap({
            name: MemoryCachePlugin.PLUGIN_NAME,
            stage: Cache.STAGE_MEMORY
        }, ()=>{
            cache.clear();
        });
    }
}
let lib_IgnoreWarningsPlugin = class {
    _ignorePattern;
    name = 'IgnoreWarningsPlugin';
    constructor(ignorePattern){
        this._ignorePattern = ignorePattern;
    }
    apply(compiler) {
        compiler.hooks.compilation.tap(this.name, (compilation)=>{
            compilation.hooks.processWarnings.tap(this.name, (warnings)=>warnings.filter((warning)=>{
                    let plainWarning = warning.message ? {
                        ...warning,
                        message: node_util.stripVTControlCharacters(warning.message)
                    } : warning;
                    return !this._ignorePattern.some((ignore)=>ignore(plainWarning, compilation));
                }));
        });
    }
};
var statsFactoryUtils_StatsErrorCode = ((StatsErrorCode = {}).ChunkMinificationError = "ChunkMinificationError", StatsErrorCode.ChunkMinificationWarning = "ChunkMinificationWarning", StatsErrorCode.ModuleParseError = "ModuleParseError", StatsErrorCode.ModuleParseWarning = "ModuleParseWarning", StatsErrorCode.ModuleBuildError = "ModuleBuildError", StatsErrorCode);
let iterateConfig = (config, options, fn)=>{
    for (let hookFor of Object.keys(config)){
        let subConfig = config[hookFor];
        for (let option of Object.keys(subConfig)){
            if ('_' !== option) if (option.startsWith('!')) {
                if (options[option.slice(1)]) continue;
            } else {
                let value = options[option];
                if (!1 === value || void 0 === value || Array.isArray(value) && 0 === value.length) continue;
            }
            fn(hookFor, subConfig[option]);
        }
    }
}, getTotalItems = (children)=>{
    let count = 0;
    for (let child of children)child.children || child.filteredChildren ? (child.children && (count += getTotalItems(child.children)), child.filteredChildren && (count += child.filteredChildren)) : count++;
    return count;
}, getTotalSize = (children)=>{
    let size = 0;
    for (let child of children)size += getItemSize(child);
    return size;
}, getItemSize = (item)=>item.children ? item.filteredChildren ? 2 + getTotalSize(item.children) : 1 + getTotalSize(item.children) : 1, spaceLimited = (itemsAndGroups, max, filteredChildrenLineReserved = !1)=>{
    let children, filteredChildren;
    if (max < 1) return {
        children: void 0,
        filteredChildren: getTotalItems(itemsAndGroups)
    };
    let groups = [], groupSizes = [], items = [], groupsSize = 0;
    for (let itemOrGroup of itemsAndGroups)if (itemOrGroup.children || itemOrGroup.filteredChildren) {
        groups.push(itemOrGroup);
        let size = getItemSize(itemOrGroup);
        groupSizes.push(size), groupsSize += size;
    } else items.push(itemOrGroup);
    if (groupsSize + items.length <= max) children = groups.length > 0 ? groups.concat(items) : items;
    else if (0 === groups.length) {
        let limit = max - !filteredChildrenLineReserved;
        filteredChildren = items.length - limit, items.length = limit, children = items;
    } else {
        let limit = groups.length + (filteredChildrenLineReserved || 0 === items.length ? 0 : 1);
        if (limit < max) {
            let oversize;
            for(; (oversize = groupsSize + items.length + (filteredChildren && !filteredChildrenLineReserved ? 1 : 0) - max) > 0;){
                let maxGroupSize = Math.max(...groupSizes);
                if (maxGroupSize < items.length) {
                    filteredChildren = items.length, items.length = 0;
                    continue;
                }
                for(let i = 0; i < groups.length; i++)if (groupSizes[i] === maxGroupSize) {
                    let group = groups[i], headerSize = group.filteredChildren ? 2 : 1, limited = spaceLimited(group.children, maxGroupSize - Math.ceil(oversize / groups.length) - headerSize, 2 === headerSize);
                    groups[i] = {
                        ...group,
                        children: limited.children,
                        filteredChildren: limited.filteredChildren ? (group.filteredChildren || 0) + limited.filteredChildren : group.filteredChildren
                    };
                    let newSize = getItemSize(groups[i]);
                    groupsSize -= maxGroupSize - newSize, groupSizes[i] = newSize;
                    break;
                }
            }
            children = groups.concat(items);
        } else limit === max ? (children = ((children)=>{
            let newChildren = [];
            for (let child of children)if (child.children) {
                let filteredChildren = child.filteredChildren || 0;
                filteredChildren += getTotalItems(child.children), newChildren.push({
                    ...child,
                    children: void 0,
                    filteredChildren
                });
            } else newChildren.push(child);
            return newChildren;
        })(groups), filteredChildren = items.length) : filteredChildren = getTotalItems(itemsAndGroups);
    }
    return {
        children,
        filteredChildren
    };
}, countWithChildren = (compilation, getItems)=>{
    let count = getItems(compilation, '').length;
    for (let child of compilation.children)count += countWithChildren(child, (c, type)=>getItems(c, `.children[].compilation${type}`));
    return count;
}, sortByField = (field)=>{
    if (!field) return (_a, _b)=>0;
    let fieldKey = '!' === field[0] ? field.slice(1) : field, sortFn = compareSelect((m)=>m[fieldKey], compareIds);
    if ('!' === field[0]) {
        let oldSortFn = sortFn;
        sortFn = (a, b)=>oldSortFn(b, a);
    }
    return sortFn;
}, assetGroup = (children)=>{
    let size = 0;
    for (let asset of children)size += asset.size;
    return {
        size
    };
}, moduleGroup = (children)=>{
    let size = 0, sizes = {};
    for (let module of children)for (let key of (size += module.size, Object.keys(module.sizes)))sizes[key] = (sizes[key] || 0) + module.sizes[key];
    return {
        size,
        sizes
    };
}, mergeToObject = (items)=>{
    let obj = Object.create(null);
    for (let item of items)obj[item.name] = item;
    return obj;
}, errorsSpaceLimit = (errors, max)=>{
    let filtered = 0;
    if (errors.length + 1 >= max) return {
        errors: errors.map((error)=>'string' != typeof error && error.details ? (filtered++, {
                ...error,
                details: ''
            }) : error),
        filtered
    };
    let fullLength = errors.length, result = errors, i = 0;
    for(; i < errors.length; i++){
        let error = errors[i];
        if ('string' != typeof error && error.details) {
            if ((fullLength += error.details.split('\n').length) > max) {
                result = i > 0 ? errors.slice(0, i) : [];
                let overLimit = fullLength - max + 1, error = errors[i++];
                for(result.push({
                    ...error,
                    details: error.details.split('\n').slice(0, -overLimit).join('\n'),
                    filteredDetails: overLimit
                }), filtered = errors.length - i; i < errors.length; i++){
                    let error = errors[i];
                    'string' != typeof error && error.details || result.push(error), result.push({
                        ...error,
                        details: ''
                    });
                }
                break;
            }
            if (fullLength === max) {
                for(result = errors.slice(0, ++i), filtered = errors.length - i; i < errors.length; i++){
                    let error = errors[i];
                    'string' != typeof error && error.details || result.push(error), result.push({
                        ...error,
                        details: ''
                    });
                }
                break;
            }
        }
    }
    return {
        errors: result,
        filtered
    };
}, GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/, GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/, SHARED_ITEM_NAMES = {
    'compilation.children[]': 'compilation',
    'compilation.modules[]': 'module',
    'compilation.entrypoints[]': 'chunkGroup',
    'compilation.namedChunkGroups[]': 'chunkGroup',
    'compilation.errors[]': 'error',
    'chunk.modules[]': 'module',
    'chunk.origins[]': 'chunkOrigin',
    'compilation.chunks[]': 'chunk',
    'compilation.assets[]': 'asset',
    'asset.related[]': 'asset',
    'module.issuerPath[]': 'moduleIssuer',
    'module.reasons[]': 'moduleReason',
    'module.modules[]': 'module',
    'module.children[]': 'module'
}, ITEM_NAMES = {
    ...SHARED_ITEM_NAMES,
    'compilation.warnings[]': 'warning',
    'chunk.rootModules[]': 'module',
    'moduleTrace[]': 'moduleTraceItem'
}, MERGER = {
    'compilation.entrypoints': mergeToObject,
    'compilation.namedChunkGroups': mergeToObject
}, ASSETS_GROUPERS = {
    _: (groupConfigs, _context, options)=>{
        let groupByFlag = (name, exclude)=>{
            groupConfigs.push({
                getKeys: (asset)=>asset[name] ? [
                        '1'
                    ] : void 0,
                getOptions: ()=>({
                        groupChildren: !exclude,
                        force: exclude
                    }),
                createGroup: (key, children, assets)=>exclude ? {
                        type: 'assets by status',
                        [name]: !!key,
                        filteredChildren: assets.length,
                        ...assetGroup(children)
                    } : {
                        type: 'assets by status',
                        [name]: !!key,
                        children,
                        ...assetGroup(children)
                    }
            });
        }, { groupAssetsByEmitStatus, groupAssetsByPath, groupAssetsByExtension } = options;
        groupAssetsByEmitStatus && groupByFlag('emitted'), (groupAssetsByEmitStatus || !options.cachedAssets) && groupByFlag('cached', !options.cachedAssets), (groupAssetsByPath || groupAssetsByExtension) && groupConfigs.push({
            getKeys: (asset)=>{
                let extensionMatch = groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name), extension = extensionMatch ? extensionMatch[1] : '', pathMatch = groupAssetsByPath && GROUP_PATH_REGEXP.exec(asset.name), path = pathMatch ? pathMatch[1].split(/[/\\]/) : [], keys = [];
                if (groupAssetsByPath) for(keys.push('.'), extension && keys.push(path.length ? `${path.join('/')}/*${extension}` : `*${extension}`); path.length > 0;)keys.push(`${path.join('/')}/`), path.pop();
                else extension && keys.push(`*${extension}`);
                return keys;
            },
            createGroup: (key, children)=>({
                    type: groupAssetsByPath ? 'assets by path' : 'assets by extension',
                    name: key,
                    children,
                    ...assetGroup(children)
                })
        });
    },
    groupAssetsByInfo: (groupConfigs)=>{
        let groupByAssetInfoFlag = (name)=>{
            groupConfigs.push({
                getKeys: (asset)=>asset.info?.[name] ? [
                        '1'
                    ] : void 0,
                createGroup: (key, children)=>({
                        type: 'assets by info',
                        info: {
                            [name]: !!key
                        },
                        children,
                        ...assetGroup(children)
                    })
            });
        };
        groupByAssetInfoFlag('immutable'), groupByAssetInfoFlag('development'), groupByAssetInfoFlag('hotModuleReplacement');
    },
    groupAssetsByChunk: (groupConfigs)=>{
        let groupByNames = (name)=>{
            groupConfigs.push({
                getKeys: (asset)=>asset[name],
                createGroup: (key, children)=>({
                        type: 'assets by chunk',
                        [name]: [
                            key
                        ],
                        children,
                        ...assetGroup(children)
                    })
            });
        };
        groupByNames('chunkNames'), groupByNames('auxiliaryChunkNames'), groupByNames('chunkIdHints'), groupByNames('auxiliaryChunkIdHints');
    },
    excludeAssets: (groupConfigs, _context, { excludeAssets })=>{
        groupConfigs.push({
            getKeys: (asset)=>{
                let ident = asset.name;
                if (excludeAssets.some((fn)=>fn(ident, asset))) return [
                    'excluded'
                ];
            },
            getOptions: ()=>({
                    groupChildren: !1,
                    force: !0
                }),
            createGroup: (_key, children, assets)=>({
                    type: 'hidden assets',
                    filteredChildren: assets.length,
                    ...assetGroup(children)
                })
        });
    }
}, MODULES_GROUPERS = (type)=>({
        _: (groupConfigs, _context, options)=>{
            let groupByFlag = (name, type, exclude)=>{
                groupConfigs.push({
                    getKeys: (module)=>module[name] ? [
                            '1'
                        ] : void 0,
                    getOptions: ()=>({
                            groupChildren: !exclude,
                            force: exclude
                        }),
                    createGroup: (key, children, modules)=>({
                            type,
                            [name]: !!key,
                            ...exclude ? {
                                filteredChildren: modules.length
                            } : {
                                children
                            },
                            ...moduleGroup(children)
                        })
                });
            }, { groupModulesByCacheStatus, groupModulesByAttributes, groupModulesByType, groupModulesByPath, groupModulesByLayer, groupModulesByExtension } = options;
            groupModulesByAttributes && (groupByFlag('errors', 'modules with errors'), groupByFlag('warnings', 'modules with warnings'), groupByFlag('assets', 'modules with assets'), groupByFlag('optional', 'optional modules')), groupModulesByCacheStatus && (groupByFlag('cacheable', 'cacheable modules'), groupByFlag('built', 'built modules'), groupByFlag('codeGenerated', 'code generated modules')), (groupModulesByCacheStatus || !options.cachedModules) && groupByFlag('cached', 'cached modules', !options.cachedModules), (groupModulesByAttributes || !options.orphanModules) && groupByFlag('orphan', 'orphan modules', !options.orphanModules), (groupModulesByAttributes || !options.dependentModules) && groupByFlag('dependent', 'dependent modules', !options.dependentModules), (groupModulesByType || !options.runtimeModules) && groupConfigs.push({
                getKeys: (module)=>{
                    let moduleType = module.moduleType;
                    if (moduleType) {
                        if (groupModulesByType) return [
                            moduleType.split('/', 1)[0]
                        ];
                        if ('runtime' === moduleType) return [
                            'runtime'
                        ];
                    }
                },
                getOptions: (key)=>{
                    let exclude = 'runtime' === key && !options.runtimeModules;
                    return {
                        groupChildren: !exclude,
                        force: exclude
                    };
                },
                createGroup: (key, children, modules)=>{
                    let exclude = 'runtime' === key && !options.runtimeModules;
                    return {
                        type: `${key} modules`,
                        moduleType: key,
                        ...exclude ? {
                            filteredChildren: modules.length
                        } : {
                            children
                        },
                        ...moduleGroup(children)
                    };
                }
            }), groupModulesByLayer && groupConfigs.push({
                getKeys: (module)=>[
                        module.layer
                    ],
                createGroup: (key, children, _modules)=>({
                        type: 'modules by layer',
                        layer: key,
                        children,
                        ...moduleGroup(children)
                    })
            }), (groupModulesByPath || groupModulesByExtension) && groupConfigs.push({
                getKeys: (module)=>{
                    if (!module.name) return;
                    let resource = parseResource(module.name.split('!').pop()).path, dataUrl = /^data:[^,;]+/.exec(resource);
                    if (dataUrl) return [
                        dataUrl[0]
                    ];
                    let extensionMatch = groupModulesByExtension && GROUP_EXTENSION_REGEXP.exec(resource), extension = extensionMatch ? extensionMatch[1] : '', pathMatch = groupModulesByPath && GROUP_PATH_REGEXP.exec(resource), path = pathMatch ? pathMatch[1].split(/[/\\]/) : [], keys = [];
                    if (groupModulesByPath) for(extension && keys.push(path.length ? `${path.join('/')}/*${extension}` : `*${extension}`); path.length > 0;)keys.push(`${path.join('/')}/`), path.pop();
                    else extension && keys.push(`*${extension}`);
                    return keys;
                },
                createGroup: (key, children, _modules)=>{
                    let isDataUrl = key.startsWith('data:');
                    return {
                        type: isDataUrl ? 'modules by mime type' : groupModulesByPath ? 'modules by path' : 'modules by extension',
                        name: isDataUrl ? key.slice(5) : key,
                        children,
                        ...moduleGroup(children)
                    };
                }
            });
        },
        excludeModules: (groupConfigs, _context, { excludeModules })=>{
            groupConfigs.push({
                getKeys: (module)=>{
                    let name = module.name;
                    if (name && excludeModules.some((fn)=>fn(name, module, type))) return [
                        '1'
                    ];
                },
                getOptions: ()=>({
                        groupChildren: !1,
                        force: !0
                    }),
                createGroup: (_key, children, _modules)=>({
                        type: 'hidden modules',
                        filteredChildren: children.length,
                        ...moduleGroup(children)
                    })
            });
        }
    }), RESULT_GROUPERS = {
    'compilation.assets': ASSETS_GROUPERS,
    'asset.related': ASSETS_GROUPERS,
    'compilation.modules': MODULES_GROUPERS('module'),
    'chunk.modules': MODULES_GROUPERS('chunk'),
    'chunk.rootModules': MODULES_GROUPERS('root-of-chunk'),
    'module.modules': MODULES_GROUPERS('nested')
}, ASSET_SORTERS = {
    assetsSort: (comparators, _context, { assetsSort })=>{
        comparators.push(sortByField(assetsSort));
    },
    _: (comparators)=>{
        comparators.push(compareSelect((a)=>a.name, compareIds));
    }
}, RESULT_SORTERS = {
    'compilation.chunks': {
        chunksSort: (comparators, _context, { chunksSort })=>{
            comparators.push(sortByField(chunksSort));
        }
    },
    'compilation.modules': {
        modulesSort: (comparators, _context, { modulesSort })=>{
            comparators.push(sortByField(modulesSort));
        }
    },
    'chunk.modules': {
        chunkModulesSort: (comparators, _context, { chunkModulesSort })=>{
            comparators.push(sortByField(chunkModulesSort));
        }
    },
    'module.modules': {
        nestedModulesSort: (comparators, _context, { nestedModulesSort })=>{
            comparators.push(sortByField(nestedModulesSort));
        }
    },
    'compilation.assets': ASSET_SORTERS,
    'asset.related': ASSET_SORTERS
}, MODULES_SORTER = {
    _: (comparators)=>{
        comparators.push(compareSelect((m)=>m.commonAttributes.depth, compareNumbers), compareSelect((m)=>m.commonAttributes.preOrderIndex, compareNumbers), compareSelect((m)=>m.commonAttributes.moduleDescriptor?.identifier, compareIds));
    }
}, SORTERS = {
    'compilation.chunks': {
        _: (comparators)=>{
            comparators.push(compareSelect((c)=>void 0 === c.id ? void 0 : String(c.id), compareIds));
        }
    },
    'compilation.modules': MODULES_SORTER,
    'chunk.rootModules': MODULES_SORTER,
    'chunk.modules': MODULES_SORTER,
    'module.modules': MODULES_SORTER,
    'module.reasons': {
        _: (comparators)=>{
            comparators.push(compareSelect((x)=>x.moduleIdentifier, compareIds)), comparators.push(compareSelect((x)=>x.resolvedModuleIdentifier, compareIds)), comparators.push(compareSelect((x)=>x.dependency, compareSelect((x)=>x.type, compareIds)));
        }
    },
    'chunk.origins': {
        _: (comparators)=>{
            comparators.push(compareSelect((origin)=>origin.moduleId, compareIds), compareSelect((origin)=>origin.loc, compareIds), compareSelect((origin)=>origin.request, compareIds));
        }
    }
}, EXTRACT_ERROR = {
    _: (object, error)=>{
        object.message = error.message, error.code && (object.code = error.code), error.chunkName && (object.chunkName = error.chunkName), error.chunkEntry && (object.chunkEntry = error.chunkEntry), error.chunkInitial && (object.chunkInitial = error.chunkInitial), error.file && (object.file = error.file), error.moduleDescriptor && (object.moduleIdentifier = error.moduleDescriptor.identifier, object.moduleName = error.moduleDescriptor.name), error.loc && (object.loc = error.loc);
    },
    ids: (object, error)=>{
        error.chunkId && (object.chunkId = error.chunkId), error.moduleDescriptor && (object.moduleId = error.moduleDescriptor.id);
    },
    moduleTrace: (object, error, context, _, factory)=>{
        let { type } = context;
        object.moduleTrace = factory.create(`${type}.moduleTrace`, error.moduleTrace, context);
    },
    errorDetails: (object, error)=>{
        object.details = error.details;
    },
    errorStack: (object, error)=>{
        object.stack = error.stack;
    }
}, SIMPLE_EXTRACTORS = {
    compilation: {
        _: (object, compilation, context, options)=>{
            let statsCompilation = context.getStatsCompilation(compilation);
            if (context.makePathsRelative || (context.makePathsRelative = makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root)), !context.cachedGetErrors) {
                let map = new WeakMap();
                context.cachedGetErrors = (compilation)=>{
                    if (compilation.compiler._lastCompilation !== compilation) return [];
                    let cache = map.get(compilation);
                    if (cache) return cache;
                    let errors = statsCompilation.errors;
                    return map.set(compilation, errors), errors;
                };
            }
            if (!context.cachedGetWarnings) {
                let map = new WeakMap();
                context.cachedGetWarnings = (compilation)=>{
                    if (compilation.compiler._lastCompilation !== compilation) return [];
                    let cache = map.get(compilation);
                    if (cache) return cache;
                    let warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors);
                    return map.set(compilation, warnings), warnings;
                };
            }
            compilation.name && (object.name = compilation.name);
            let logging = options.logging, loggingDebug = options.loggingDebug, loggingTrace = options.loggingTrace;
            if (logging || loggingDebug && loggingDebug.length > 0) {
                let acceptedTypes, collapsedGroups = !1;
                'verbose' === logging || loggingDebug && loggingDebug.length > 0 ? (acceptedTypes = getLogTypesBitFlag([
                    LogType.error,
                    LogType.warn,
                    LogType.info,
                    LogType.log,
                    LogType.debug,
                    LogType.group,
                    LogType.groupEnd,
                    LogType.groupCollapsed,
                    LogType.profile,
                    LogType.profileEnd,
                    LogType.time,
                    LogType.status,
                    LogType.clear,
                    LogType.cache
                ]), collapsedGroups = !0) : acceptedTypes = 'log' === logging || !0 === logging ? getLogTypesBitFlag([
                    LogType.error,
                    LogType.warn,
                    LogType.info,
                    LogType.log,
                    LogType.group,
                    LogType.groupEnd,
                    LogType.groupCollapsed,
                    LogType.clear
                ]) : 'info' === logging ? getLogTypesBitFlag([
                    LogType.error,
                    LogType.warn,
                    LogType.info
                ]) : 'warn' === logging ? getLogTypesBitFlag([
                    LogType.error,
                    LogType.warn
                ]) : 'error' === logging ? getLogTypesBitFlag([
                    LogType.error
                ]) : getLogTypesBitFlag([]), object.logging = {};
                let compilationLogging = new Map();
                for (let [origin, logEntries] of compilation.logging)compilationLogging.set(origin, [
                    ...logEntries
                ]);
                for (let { name, ...rest } of context.getInner(compilation).getLogging(acceptedTypes)){
                    let value = compilationLogging.get(name), entry = {
                        type: rest.type,
                        trace: rest.trace,
                        args: rest.args ?? []
                    };
                    value ? value.push(entry) : compilationLogging.set(name, [
                        entry
                    ]);
                }
                let depthInCollapsedGroup = 0;
                for (let [origin, logEntries] of compilationLogging){
                    let debugMode = loggingDebug.some((fn)=>fn(origin));
                    if (!1 === logging && !debugMode) continue;
                    let groupStack = [], rootList = [], currentList = rootList, processedLogEntries = 0;
                    for (let entry of logEntries){
                        let message, type = entry.type, typeBitFlag = getLogTypeBitFlag(type);
                        if (!debugMode && (acceptedTypes & typeBitFlag) !== typeBitFlag) continue;
                        if (type === LogType.groupCollapsed && (debugMode || collapsedGroups) && (type = LogType.group), 0 === depthInCollapsedGroup && processedLogEntries++, type === LogType.groupEnd) {
                            groupStack.pop(), currentList = groupStack.length > 0 ? groupStack[groupStack.length - 1].children : rootList, depthInCollapsedGroup > 0 && depthInCollapsedGroup--;
                            continue;
                        }
                        if (entry.type === LogType.time) {
                            let [label, first, second] = entry.args;
                            'number' == typeof first && 'number' == typeof second && (message = `${label}: ${1000 * first + second / 1000000} ms`);
                        }
                        message || (message = entry.args?.length ? __rspack_external_node_util_1b29d436.format(entry.args[0], ...entry.args.slice(1)) : '');
                        let newEntry = {
                            type,
                            message: message || '',
                            trace: loggingTrace ? entry.trace : void 0,
                            children: type === LogType.group || type === LogType.groupCollapsed ? [] : void 0
                        };
                        currentList.push(newEntry), newEntry.children && (groupStack.push(newEntry), currentList = newEntry.children, depthInCollapsedGroup > 0 ? depthInCollapsedGroup++ : type === LogType.groupCollapsed && (depthInCollapsedGroup = 1));
                    }
                    object.logging[origin] = {
                        entries: rootList,
                        filteredEntries: logEntries.length - processedLogEntries,
                        debug: debugMode
                    };
                }
            }
        },
        hash: (object, compilation, context)=>{
            object.hash = context.getStatsCompilation(compilation).hash;
        },
        version: (object)=>{
            object.version = "5.75.0", object.rspackVersion = "2.0.8";
        },
        env: (object, _compilation, _context, { _env })=>{
            object.env = _env;
        },
        timings: (object, compilation)=>{
            object.time = compilation.endTime - compilation.startTime;
        },
        builtAt: (object, compilation)=>{
            object.builtAt = compilation.endTime;
        },
        publicPath: (object, compilation)=>{
            if ('function' == typeof compilation.outputOptions.publicPath) throw new DeadlockRiskError("publicPath as function can't be used with stats.publicPath=true, which may cause deadlock risk, consider setting stats.publicPath=false in rspack config");
            object.publicPath = compilation.getPath(compilation.outputOptions.publicPath || '');
        },
        outputPath: (object, compilation)=>{
            object.outputPath = compilation.outputOptions.path;
        },
        assets: (object, compilation, context, options, factory)=>{
            let { type, getStatsCompilation } = context, statsCompilation = getStatsCompilation(compilation), compilationAssets = statsCompilation.assets, assetsByChunkName = statsCompilation.assetsByChunkName, assetMap = new Map(), assets = new Set();
            for (let asset of compilationAssets){
                let item = {
                    ...asset,
                    type: 'asset',
                    related: []
                };
                assets.add(item), assetMap.set(asset.name, item);
            }
            for (let item of assetMap.values()){
                let related = item.info.related;
                if (related) for (let { name: type, value: relatedEntry } of related)for (let dep of Array.isArray(relatedEntry) ? relatedEntry : [
                    relatedEntry
                ]){
                    let depItem = assetMap.get(dep);
                    depItem && (assets.delete(depItem), depItem.type = type, item.related = item.related || [], item.related.push(depItem));
                }
            }
            object.assetsByChunkName = Object.fromEntries(assetsByChunkName.map(({ name, files })=>[
                    name,
                    files
                ]));
            let limited = spaceLimited(factory.create(`${type}.assets`, [
                ...assets
            ], {
                ...context
            }), options.assetsSpace ?? 1 / 0);
            object.assets = limited.children, object.filteredAssets = limited.filteredChildren;
        },
        chunks: (object, compilation, context, _options, factory)=>{
            let { type, getStatsCompilation } = context, chunks = getStatsCompilation(compilation).chunks;
            object.chunks = factory.create(`${type}.chunks`, chunks, context);
        },
        modules: (object, compilation, context, options, factory)=>{
            let { type, getStatsCompilation } = context, array = getStatsCompilation(compilation).modules, limited = spaceLimited(factory.create(`${type}.modules`, array, context), options.modulesSpace);
            object.modules = limited.children, object.filteredModules = limited.filteredChildren;
        },
        entrypoints: (object, compilation, context, { entrypoints, chunkGroups, chunkGroupAuxiliary, chunkGroupChildren }, factory)=>{
            let { type, getStatsCompilation } = context, array = getStatsCompilation(compilation).entrypoints.map((entrypoint)=>({
                    name: entrypoint.name,
                    chunkGroup: entrypoint
                })), chunks = Array.from(compilation.chunks).reduce((res, chunk)=>(res[chunk.id] = chunk, res), {});
            'auto' === entrypoints && !chunkGroups && (array.length > 5 || !chunkGroupChildren && array.every(({ chunkGroup })=>{
                if (1 !== chunkGroup.chunks.length) return !1;
                let chunk = chunks[chunkGroup.chunks[0]];
                return chunk && 1 === chunk.files.size && (!chunkGroupAuxiliary || 0 === chunk.auxiliaryFiles.size);
            })) || (object.entrypoints = factory.create(`${type}.entrypoints`, array, context));
        },
        chunkGroups: (object, compilation, context, _, factory)=>{
            let { type, getStatsCompilation } = context, namedChunkGroups = getStatsCompilation(compilation).namedChunkGroups.map((cg)=>({
                    name: cg.name,
                    chunkGroup: cg
                }));
            object.namedChunkGroups = factory.create(`${type}.namedChunkGroups`, namedChunkGroups, context);
        },
        errors: (object, compilation, context, options, factory)=>{
            let { type, cachedGetErrors } = context, rawErrors = cachedGetErrors(compilation), factorizedErrors = factory.create(`${type}.errors`, cachedGetErrors(compilation), context), filtered = 0;
            if ('auto' === options.errorDetails && rawErrors.length >= 3 && (filtered = rawErrors.map((e)=>'string' != typeof e && e.details).filter(Boolean).length), !0 === options.errorDetails || !Number.isFinite(options.errorsSpace)) {
                object.errors = factorizedErrors, filtered && (object.filteredErrorDetailsCount = filtered);
                return;
            }
            let { errors, filtered: filteredBySpace } = errorsSpaceLimit(factorizedErrors, options.errorsSpace);
            object.filteredErrorDetailsCount = filtered + filteredBySpace, object.errors = errors;
        },
        errorsCount: (object, compilation, { cachedGetErrors })=>{
            object.errorsCount = countWithChildren(compilation, (c)=>cachedGetErrors(c));
        },
        warnings: (object, compilation, context, options, factory)=>{
            let { type, cachedGetWarnings } = context, rawWarnings = factory.create(`${type}.warnings`, cachedGetWarnings(compilation), context), filtered = 0;
            if ('auto' === options.errorDetails && (filtered = cachedGetWarnings(compilation).map((e)=>'string' != typeof e && e.details).filter(Boolean).length), !0 === options.errorDetails || !Number.isFinite(options.warningsSpace)) {
                object.warnings = rawWarnings, filtered && (object.filteredWarningDetailsCount = filtered);
                return;
            }
            let { errors: warnings, filtered: filteredBySpace } = errorsSpaceLimit(rawWarnings, options.warningsSpace);
            object.filteredWarningDetailsCount = filtered + filteredBySpace, object.warnings = warnings;
        },
        warningsCount: (object, compilation, context)=>{
            let { cachedGetWarnings } = context;
            object.warningsCount = countWithChildren(compilation, (c)=>cachedGetWarnings(c));
        },
        children: (object, compilation, context, _options, factory)=>{
            let { type } = context;
            object.children = factory.create(`${type}.children`, compilation.children, context);
        }
    },
    asset: {
        _: (object, asset, context, options, factory)=>{
            object.type = asset.type, object.name = asset.name, object.size = asset.size, object.emitted = asset.emitted, object.info = {
                ...asset.info,
                related: Object.fromEntries(asset.info.related.map((i)=>[
                        i.name,
                        i.value
                    ]))
            };
            let cached = !object.emitted;
            object.cached = cached, (!cached || options.cachedAssets) && Object.assign(object, factory.create(`${context.type}$visible`, asset, context));
        }
    },
    asset$visible: {
        _: (object, asset)=>{
            object.chunkNames = asset.chunkNames, object.chunkIdHints = asset.chunkIdHints.filter(Boolean), object.auxiliaryChunkNames = asset.auxiliaryChunkNames, object.auxiliaryChunkIdHints = asset.auxiliaryChunkIdHints.filter(Boolean);
        },
        relatedAssets: (object, asset, context, _options, factory)=>{
            let { type } = context;
            object.related = factory.create(`${type.slice(0, -8)}.related`, asset.related, context), object.filteredRelated = asset.related ? asset.related.length - object.related.length : void 0;
        },
        ids: (object, asset)=>{
            object.chunks = asset.chunks, object.auxiliaryChunks = asset.auxiliaryChunks;
        },
        performance: (object, asset)=>{
            object.isOverSizeLimit = asset.info.isOverSizeLimit;
        }
    },
    chunkGroup: {
        _: (object, { name, chunkGroup }, _context, { chunkGroupMaxAssets })=>{
            object.name = name, object.chunks = chunkGroup.chunks, object.assets = chunkGroup.assets, object.filteredAssets = chunkGroup.assets.length <= chunkGroupMaxAssets ? 0 : chunkGroup.assets.length, object.assetsSize = chunkGroup.assetsSize, object.auxiliaryAssets = chunkGroup.auxiliaryAssets, object.auxiliaryAssetsSize = chunkGroup.auxiliaryAssetsSize, object.children = chunkGroup.children, object.childAssets = chunkGroup.childAssets;
        },
        performance: (object, { chunkGroup })=>{
            object.isOverSizeLimit = chunkGroup.isOverSizeLimit;
        }
    },
    module: {
        _: (object, module, context, options, factory)=>{
            let { type } = context, { commonAttributes } = module;
            object.type = commonAttributes.type, object.moduleType = commonAttributes.moduleType, object.layer = commonAttributes.layer, object.size = commonAttributes.size;
            let sizes = commonAttributes.sizes.map(({ sourceType, size })=>[
                    sourceType,
                    size
                ]);
            sizes.sort((a, b)=>-compareIds(a, b)), object.sizes = Object.fromEntries(sizes), object.built = commonAttributes.built, object.codeGenerated = commonAttributes.codeGenerated, object.buildTimeExecuted = commonAttributes.buildTimeExecuted, object.cached = commonAttributes.cached, (commonAttributes.built || commonAttributes.codeGenerated || options.cachedModules) && Object.assign(object, factory.create(`${type}$visible`, module, context));
        }
    },
    module$visible: {
        _: (object, module, context, _options, factory)=>{
            let { type } = context, { commonAttributes } = module;
            commonAttributes.moduleDescriptor && (object.identifier = commonAttributes.moduleDescriptor.identifier, object.name = commonAttributes.moduleDescriptor.name), object.nameForCondition = commonAttributes.nameForCondition, object.index = commonAttributes.preOrderIndex, object.preOrderIndex = commonAttributes.preOrderIndex, object.index2 = commonAttributes.postOrderIndex, object.postOrderIndex = commonAttributes.postOrderIndex, object.cacheable = commonAttributes.cacheable, object.optional = commonAttributes.optional, object.orphan = commonAttributes.orphan, object.dependent = module.dependent, object.issuer = module.issuerDescriptor?.identifier, object.issuerName = module.issuerDescriptor?.name, object.issuerPath = module.issuerDescriptor && factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context), object.failed = commonAttributes.failed, object.errors = commonAttributes.errors, object.warnings = commonAttributes.warnings;
        },
        ids: (object, module)=>{
            let { commonAttributes } = module;
            commonAttributes.moduleDescriptor && (object.id = commonAttributes.moduleDescriptor.id), object.issuerId = module.issuerDescriptor?.id, object.chunks = commonAttributes.chunks;
        },
        moduleAssets: (object, module)=>{
            object.assets = module.commonAttributes.assets;
        },
        reasons: (object, module, context, options, factory)=>{
            let { type } = context, limited = spaceLimited(factory.create(`${type.slice(0, -8)}.reasons`, module.commonAttributes.reasons, context), options.reasonsSpace);
            object.reasons = limited.children, object.filteredReasons = limited.filteredChildren;
        },
        source: (object, module)=>{
            let { commonAttributes } = module;
            object.source = commonAttributes.source;
        },
        usedExports: (object, { usedExports })=>{
            'string' == typeof usedExports ? 'null' === usedExports ? object.usedExports = null : object.usedExports = 'true' === usedExports : Array.isArray(usedExports) ? object.usedExports = usedExports : object.usedExports = null;
        },
        providedExports: (object, { commonAttributes })=>{
            object.providedExports = Array.isArray(commonAttributes.providedExports) ? commonAttributes.providedExports : null;
        },
        optimizationBailout: (object, module)=>{
            object.optimizationBailout = module.commonAttributes.optimizationBailout || null;
        },
        depth: (object, module)=>{
            object.depth = module.commonAttributes.depth;
        },
        nestedModules: (object, module, context, options, factory)=>{
            let { type } = context, innerModules = module.modules;
            if (Array.isArray(innerModules) && innerModules.length > 0) {
                let limited = spaceLimited(factory.create(`${type.slice(0, -8)}.modules`, innerModules, context), options.nestedModulesSpace);
                object.modules = limited.children, object.filteredModules = limited.filteredChildren;
            }
        }
    },
    moduleIssuer: {
        _: (object, module, _context, _options, _factory)=>{
            module.moduleDescriptor && (object.identifier = module.moduleDescriptor.identifier, object.name = module.moduleDescriptor.name);
        },
        ids: (object, module)=>{
            object.id = module.moduleDescriptor.id;
        }
    },
    moduleReason: {
        _: (object, reason)=>{
            reason.moduleDescriptor && (object.moduleIdentifier = reason.moduleDescriptor.identifier, object.moduleName = reason.moduleDescriptor.name), object.type = reason.type, object.userRequest = reason.userRequest, reason.resolvedModuleDescriptor && (object.resolvedModuleIdentifier = reason.resolvedModuleDescriptor.identifier, object.resolvedModule = reason.resolvedModuleDescriptor.name), object.explanation = reason.explanation, object.active = reason.active, object.loc = reason.loc;
        },
        ids: (object, reason)=>{
            object.moduleId = reason.moduleDescriptor ? reason.moduleDescriptor.id : null, object.resolvedModuleId = reason.resolvedModuleDescriptor ? reason.resolvedModuleDescriptor.id : null;
        }
    },
    chunk: {
        _: (object, chunk)=>{
            object.type = chunk.type, object.rendered = chunk.rendered, object.initial = chunk.initial, object.entry = chunk.entry, object.reason = chunk.reason, object.size = chunk.size, object.sizes = Object.fromEntries(chunk.sizes.map(({ sourceType, size })=>[
                    sourceType,
                    size
                ])), object.names = chunk.names, object.idHints = chunk.idHints, object.runtime = chunk.runtime, object.files = chunk.files, object.auxiliaryFiles = chunk.auxiliaryFiles, object.hash = chunk.hash, object.childrenByOrder = chunk.childrenByOrder;
        },
        ids: (object, chunk)=>{
            object.id = chunk.id;
        },
        chunkRelations: (object, chunk)=>{
            object.siblings = chunk.siblings, object.parents = chunk.parents, object.children = chunk.children;
        },
        chunkModules: (object, chunk, context, options, factory)=>{
            let { type } = context, limited = spaceLimited(factory.create(`${type}.modules`, chunk.modules, context), options.chunkModulesSpace);
            object.modules = limited.children, object.filteredModules = limited.filteredChildren;
        },
        chunkOrigins: (object, chunk, context, _options, factory)=>{
            let { type } = context;
            object.origins = factory.create(`${type}.origins`, chunk.origins, context);
        }
    },
    chunkOrigin: {
        _: (object, origin, _context)=>{
            let { moduleDescriptor, loc, request } = origin;
            Object.assign(object, {
                module: moduleDescriptor ? moduleDescriptor.identifier : '',
                moduleIdentifier: moduleDescriptor ? moduleDescriptor.identifier : '',
                moduleName: moduleDescriptor ? moduleDescriptor.name : '',
                loc,
                request
            });
        },
        ids: (object, origin)=>{
            object.moduleId = origin.moduleDescriptor?.id;
        }
    },
    error: EXTRACT_ERROR,
    warning: EXTRACT_ERROR,
    moduleTraceItem: {
        _: (object, { origin, module, dependencies }, context, _, factory)=>{
            let { type } = context;
            origin.moduleDescriptor && (object.originIdentifier = origin.moduleDescriptor.identifier, object.originName = origin.moduleDescriptor.name), module.moduleDescriptor && (object.moduleIdentifier = module.moduleDescriptor.identifier, object.moduleName = module.moduleDescriptor.name), object.dependencies = factory.create(`${type}.dependencies`, dependencies, context);
        },
        ids: (object, { origin, module })=>{
            object.originId = origin.moduleDescriptor.id, object.moduleId = module.moduleDescriptor.id;
        }
    },
    moduleTraceDependency: {
        _: (object, dependency)=>{
            object.loc = dependency.loc;
        }
    }
}, FILTER = {
    'module.reasons': {
        '!orphanModules': (reason)=>{
            if (0 === reason.moduleChunks) return !1;
        }
    }
};
class DefaultStatsFactoryPlugin {
    apply(compiler) {
        compiler.hooks.compilation.tap('DefaultStatsFactoryPlugin', (compilation)=>{
            compilation.hooks.statsFactory.tap('DefaultStatsFactoryPlugin', (stats, options)=>{
                for (let key of (iterateConfig(SIMPLE_EXTRACTORS, options, (hookFor, fn)=>{
                    stats.hooks.extract.for(hookFor).tap('DefaultStatsFactoryPlugin', (obj, data, ctx)=>fn(obj, data, ctx, options, stats));
                }), iterateConfig(FILTER, options, (hookFor, fn)=>{
                    stats.hooks.filter.for(hookFor).tap('DefaultStatsFactoryPlugin', (item, ctx, idx, i)=>fn(item, ctx, options, idx, i));
                }), iterateConfig(SORTERS, options, (hookFor, fn)=>{
                    stats.hooks.sort.for(hookFor).tap('DefaultStatsFactoryPlugin', (comparators, ctx)=>fn(comparators, ctx, options));
                }), iterateConfig(RESULT_SORTERS, options, (hookFor, fn)=>{
                    stats.hooks.sortResults.for(hookFor).tap('DefaultStatsFactoryPlugin', (comparators, ctx)=>fn(comparators, ctx, options));
                }), iterateConfig(RESULT_GROUPERS, options, (hookFor, fn)=>{
                    stats.hooks.groupResults.for(hookFor).tap('DefaultStatsFactoryPlugin', (groupConfigs, ctx)=>fn(groupConfigs, ctx, options));
                }), Object.keys(ITEM_NAMES))){
                    let itemName = ITEM_NAMES[key];
                    stats.hooks.getItemName.for(key).tap('DefaultStatsFactoryPlugin', ()=>itemName);
                }
                for (let key of Object.keys(MERGER)){
                    let merger = MERGER[key];
                    stats.hooks.merge.for(key).tap('DefaultStatsFactoryPlugin', merger);
                }
            });
        });
    }
}
let applyDefaults = (options, defaults)=>{
    for (let key of Object.keys(defaults))void 0 === options[key] && (options[key] = defaults[key]);
}, NAMED_PRESETS = {
    verbose: {
        hash: !0,
        builtAt: !0,
        relatedAssets: !0,
        entrypoints: !0,
        chunkGroups: !0,
        ids: !0,
        assets: !0,
        modules: !1,
        chunks: !0,
        chunkRelations: !0,
        chunkModules: !0,
        dependentModules: !0,
        chunkOrigins: !0,
        depth: !0,
        env: !0,
        reasons: !0,
        usedExports: !0,
        providedExports: !0,
        optimizationBailout: !0,
        errorDetails: !0,
        errorStack: !0,
        publicPath: !0,
        logging: 'verbose',
        orphanModules: !0,
        runtimeModules: !0,
        excludeModules: !1,
        errorsSpace: 1 / 0,
        warningsSpace: 1 / 0,
        modulesSpace: 1 / 0,
        chunkModulesSpace: 1 / 0,
        assetsSpace: 1 / 0,
        reasonsSpace: 1 / 0,
        children: !0
    },
    detailed: {
        hash: !0,
        builtAt: !0,
        assets: !0,
        relatedAssets: !0,
        entrypoints: !0,
        chunkGroups: !0,
        ids: !0,
        chunks: !0,
        modules: !0,
        chunkRelations: !0,
        chunkModules: !1,
        chunkOrigins: !0,
        depth: !0,
        usedExports: !0,
        providedExports: !0,
        optimizationBailout: !0,
        errorDetails: !0,
        publicPath: !0,
        logging: !0,
        runtimeModules: !0,
        excludeModules: !1,
        errorsSpace: 1000,
        warningsSpace: 1000,
        modulesSpace: 1000,
        assetsSpace: 1000,
        reasonsSpace: 1000
    },
    minimal: {
        all: !1,
        version: !0,
        timings: !0,
        modules: !0,
        errorsSpace: 0,
        warningsSpace: 0,
        modulesSpace: 0,
        assets: !0,
        assetsSpace: 0,
        errors: !0,
        errorsCount: !0,
        warnings: !0,
        warningsCount: !0,
        logging: 'warn'
    },
    'errors-only': {
        all: !1,
        errors: !0,
        errorsCount: !0,
        errorsSpace: 1 / 0,
        moduleTrace: !0,
        logging: 'error'
    },
    'errors-warnings': {
        all: !1,
        errors: !0,
        errorsCount: !0,
        errorsSpace: 1 / 0,
        warnings: !0,
        warningsCount: !0,
        warningsSpace: 1 / 0,
        logging: 'warn'
    },
    summary: {
        all: !1,
        version: !0,
        errorsCount: !0,
        warningsCount: !0
    },
    none: {
        all: !1
    }
}, NORMAL_ON = ({ all })=>!1 !== all, NORMAL_OFF = ({ all })=>!0 === all, ON_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !1 !== all : !0 === all, OFF_FOR_TO_STRING = ({ all }, { forToString })=>forToString ? !0 === all : !1 !== all, DEFAULTS = {
    performance: NORMAL_ON,
    hash: OFF_FOR_TO_STRING,
    env: NORMAL_OFF,
    version: NORMAL_ON,
    timings: NORMAL_ON,
    builtAt: OFF_FOR_TO_STRING,
    assets: NORMAL_OFF,
    entrypoints: NORMAL_OFF,
    chunkGroups: NORMAL_OFF,
    chunkGroupAuxiliary: OFF_FOR_TO_STRING,
    chunkGroupChildren: OFF_FOR_TO_STRING,
    chunkGroupMaxAssets: (_, { forToString })=>forToString ? 5 : 1 / 0,
    chunks: NORMAL_OFF,
    chunkRelations: OFF_FOR_TO_STRING,
    chunkModules: ({ all, modules })=>!1 !== all && (!0 === all || !modules),
    dependentModules: OFF_FOR_TO_STRING,
    chunkOrigins: OFF_FOR_TO_STRING,
    ids: OFF_FOR_TO_STRING,
    modules: NORMAL_OFF,
    nestedModules: OFF_FOR_TO_STRING,
    groupModulesByType: ON_FOR_TO_STRING,
    groupModulesByCacheStatus: ON_FOR_TO_STRING,
    groupModulesByLayer: ON_FOR_TO_STRING,
    groupModulesByAttributes: ON_FOR_TO_STRING,
    groupModulesByPath: ON_FOR_TO_STRING,
    groupModulesByExtension: ON_FOR_TO_STRING,
    modulesSpace: (_, { forToString })=>forToString ? 15 : 1 / 0,
    chunkModulesSpace: (_, { forToString })=>forToString ? 10 : 1 / 0,
    nestedModulesSpace: (_, { forToString })=>forToString ? 10 : 1 / 0,
    relatedAssets: OFF_FOR_TO_STRING,
    groupAssetsByEmitStatus: ON_FOR_TO_STRING,
    groupAssetsByInfo: ON_FOR_TO_STRING,
    groupAssetsByPath: ON_FOR_TO_STRING,
    groupAssetsByExtension: ON_FOR_TO_STRING,
    groupAssetsByChunk: ON_FOR_TO_STRING,
    assetsSpace: (_, { forToString })=>forToString ? 15 : 1 / 0,
    orphanModules: OFF_FOR_TO_STRING,
    runtimeModules: ({ all, runtime }, { forToString })=>void 0 !== runtime ? runtime : forToString ? !0 === all : !1 !== all,
    cachedModules: ({ all, cached }, { forToString })=>void 0 !== cached ? cached : forToString ? !0 === all : !1 !== all,
    moduleAssets: OFF_FOR_TO_STRING,
    depth: OFF_FOR_TO_STRING,
    cachedAssets: OFF_FOR_TO_STRING,
    reasons: OFF_FOR_TO_STRING,
    reasonsSpace: (_, { forToString })=>forToString ? 15 : 1 / 0,
    groupReasonsByOrigin: ON_FOR_TO_STRING,
    usedExports: OFF_FOR_TO_STRING,
    providedExports: OFF_FOR_TO_STRING,
    optimizationBailout: OFF_FOR_TO_STRING,
    children: OFF_FOR_TO_STRING,
    source: NORMAL_OFF,
    moduleTrace: NORMAL_ON,
    errors: NORMAL_ON,
    errorsCount: NORMAL_ON,
    errorDetails: ({ all }, { forToString })=>!1 !== all && (!0 === all || !forToString || 'auto'),
    errorStack: OFF_FOR_TO_STRING,
    warnings: NORMAL_ON,
    warningsCount: NORMAL_ON,
    publicPath: OFF_FOR_TO_STRING,
    logging: ({ all }, { forToString })=>!!forToString && !1 !== all && 'info',
    loggingDebug: ()=>[],
    loggingTrace: OFF_FOR_TO_STRING,
    excludeModules: ()=>[],
    excludeAssets: ()=>[],
    modulesSort: ()=>'depth',
    chunkModulesSort: ()=>'name',
    nestedModulesSort: ()=>!1,
    chunksSort: ()=>!1,
    assetsSort: ()=>'!size',
    outputPath: OFF_FOR_TO_STRING,
    colors: ()=>isStatsColorSupported()
}, normalizeFilter = (item)=>{
    if ('string' == typeof item) {
        let regExp = RegExp(`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, '\\$&')}([\\\\/]|$|!|\\?)`);
        return (ident)=>regExp.test(ident);
    }
    if (item && 'object' == typeof item && 'test' in item && 'function' == typeof item.test) {
        let test = item.test.bind(item);
        return (ident)=>test(ident);
    }
    return 'function' == typeof item ? item : 'boolean' == typeof item ? ()=>item : void 0;
}, NORMALIZER = {
    excludeModules: (value)=>(Array.isArray(value) ? value : value ? [
            value
        ] : []).map(normalizeFilter),
    excludeAssets: (value)=>(Array.isArray(value) ? value : value ? [
            value
        ] : []).map(normalizeFilter),
    warningsFilter: (value)=>(Array.isArray(value) ? value : value ? [
            value
        ] : []).map((filter)=>{
            if ('string' == typeof filter) return (_warning, warningString)=>warningString.includes(filter);
            if (filter instanceof RegExp) return (_warning, warningString)=>filter.test(warningString);
            if ('function' == typeof filter) return filter;
            throw Error(`Can only filter warnings with Strings or RegExps. (Given: ${filter})`);
        }),
    logging: (value)=>!0 === value ? 'log' : value,
    loggingDebug: (value)=>(Array.isArray(value) ? value : value ? [
            value
        ] : []).map(normalizeFilter)
};
class DefaultStatsPresetPlugin {
    apply(compiler) {
        compiler.hooks.compilation.tap('DefaultStatsPresetPlugin', (compilation)=>{
            for (let key of Object.keys(NAMED_PRESETS)){
                let defaults = NAMED_PRESETS[key];
                compilation.hooks.statsPreset.for(key).tap('DefaultStatsPresetPlugin', (options)=>{
                    applyDefaults(options, defaults);
                });
            }
            compilation.hooks.statsNormalize.tap('DefaultStatsPresetPlugin', (options, context)=>{
                for (let key of Object.keys(DEFAULTS))void 0 === options[key] && (options[key] = DEFAULTS[key](options, context, compilation));
                for (let key of Object.keys(NORMALIZER))options[key] = NORMALIZER[key](options[key]);
            });
        });
    }
}
let DefaultStatsPrinterPlugin_plural = (n, singular, plural)=>1 === n ? singular : plural, printSizes = (sizes, { formatSize = (n)=>`${n}` })=>{
    let keys = Object.keys(sizes);
    return keys.length > 1 ? keys.map((key)=>`${formatSize(sizes[key])} (${key})`).join(' ') : 1 === keys.length ? formatSize(sizes[keys[0]]) : void 0;
}, getResourceName = (resource)=>{
    let dataUrl = /^data:[^,]+,/.exec(resource);
    if (!dataUrl) return resource;
    let len = dataUrl[0].length + 16;
    return resource.length < len ? resource : `${resource.slice(0, Math.min(resource.length - 2, len))}..`;
}, mapLines = (str, fn)=>str.split('\n').map(fn).join('\n'), twoDigit = (n)=>n >= 10 ? `${n}` : `0${n}`, moreCount = (list, count)=>list && list.length > 0 ? `+ ${count}` : `${count}`, SIMPLE_PRINTERS = {
    'compilation.summary!': (_, { type, bold, green, red, yellow, formatDateTime, formatTime, compilation: { name, hash, rspackVersion, time, builtAt, errorsCount, warningsCount } })=>{
        let statusMessage, root = 'compilation.summary!' === type, warningsMessage = warningsCount && warningsCount > 0 ? yellow(`${warningsCount} ${DefaultStatsPrinterPlugin_plural(warningsCount, 'warning', 'warnings')}`) : '', errorsMessage = errorsCount && errorsCount > 0 ? red(`${errorsCount} ${DefaultStatsPrinterPlugin_plural(errorsCount, 'error', 'errors')}`) : '', timeMessage = root && time ? ` in ${formatTime(time)}` : '', hashMessage = hash ? ` (${hash})` : '', builtAtMessage = root && builtAt ? `${formatDateTime(builtAt)}: ` : '', versionMessage = root && rspackVersion ? `Rspack ${rspackVersion}` : '', nameMessage = root && name ? bold(name) : name ? `Child ${bold(name)}` : root ? '' : 'Child', subjectMessage = nameMessage && versionMessage ? `${nameMessage} (${versionMessage})` : versionMessage || nameMessage || 'Rspack';
        if (statusMessage = errorsMessage && warningsMessage ? `compiled with ${errorsMessage} and ${warningsMessage}` : errorsMessage ? `compiled with ${errorsMessage}` : warningsMessage ? `compiled with ${warningsMessage}` : 0 === errorsCount && 0 === warningsCount ? `compiled ${green('successfully')}` : 'compiled', builtAtMessage || versionMessage || errorsMessage || warningsMessage || 0 === errorsCount && 0 === warningsCount || timeMessage || hashMessage) return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`;
    },
    'compilation.filteredWarningDetailsCount': (count)=>count ? `${count} ${DefaultStatsPrinterPlugin_plural(count, 'warning has', 'warnings have')} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.` : void 0,
    'compilation.filteredErrorDetailsCount': (count, { yellow })=>count ? yellow(`${count} ${DefaultStatsPrinterPlugin_plural(count, 'error has', 'errors have')} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`) : void 0,
    'compilation.env': (env, { bold })=>env ? `Environment (--env): ${bold(JSON.stringify(env, null, 2))}` : void 0,
    'compilation.publicPath': (publicPath, { bold })=>`PublicPath: ${bold(publicPath || '(none)')}`,
    'compilation.entrypoints': (entrypoints, context, printer)=>Array.isArray(entrypoints) ? void 0 : printer.print(context.type, Object.values(entrypoints), {
            ...context,
            chunkGroupKind: 'Entrypoint'
        }),
    'compilation.namedChunkGroups': (namedChunkGroups, context, printer)=>{
        if (!Array.isArray(namedChunkGroups)) {
            let { compilation: { entrypoints } } = context, chunkGroups = Object.values(namedChunkGroups);
            return entrypoints && (chunkGroups = chunkGroups.filter((group)=>!Object.prototype.hasOwnProperty.call(entrypoints, group.name))), printer.print(context.type, chunkGroups, {
                ...context,
                chunkGroupKind: 'Chunk Group'
            });
        }
    },
    'compilation.assetsByChunkName': ()=>'',
    'compilation.filteredModules': (filteredModules, { compilation: { modules } })=>filteredModules > 0 ? `${moreCount(modules, filteredModules)} ${DefaultStatsPrinterPlugin_plural(filteredModules, 'module', 'modules')}` : void 0,
    'compilation.filteredAssets': (filteredAssets, { compilation: { assets } })=>filteredAssets > 0 ? `${moreCount(assets, filteredAssets)} ${DefaultStatsPrinterPlugin_plural(filteredAssets, 'asset', 'assets')}` : void 0,
    'compilation.logging': (logging, context, printer)=>Array.isArray(logging) ? void 0 : printer.print(context.type, Object.entries(logging).map(([name, value])=>({
                ...value,
                name
            })), context),
    'compilation.warningsInChildren!': (_, { yellow, compilation })=>{
        if (!compilation.children && compilation.warningsCount && compilation.warningsCount > 0 && compilation.warnings) {
            let childWarnings = compilation.warningsCount - compilation.warnings.length;
            if (childWarnings > 0) return yellow(`${childWarnings} ${DefaultStatsPrinterPlugin_plural(childWarnings, 'WARNING', 'WARNINGS')} in child compilations${compilation.children ? '' : " (Use 'stats.children: true' resp. '--stats-children' for more details)"}`);
        }
    },
    'compilation.errorsInChildren!': (_, { red, compilation })=>{
        if (!compilation.children && compilation.errorsCount && compilation.errorsCount > 0 && compilation.errors) {
            let childErrors = compilation.errorsCount - compilation.errors.length;
            if (childErrors > 0) return red(`${childErrors} ${DefaultStatsPrinterPlugin_plural(childErrors, 'ERROR', 'ERRORS')} in child compilations${compilation.children ? '' : " (Use 'stats.children: true' resp. '--stats-children' for more details)"}`);
        }
    },
    'asset.type': (type)=>type,
    'asset.name': (name, { formatFilename, asset: { isOverSizeLimit } })=>formatFilename(name, isOverSizeLimit),
    'asset.size': (size, { asset: { isOverSizeLimit }, yellow, formatSize })=>isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size),
    'asset.emitted': (emitted, { green, formatFlag })=>emitted ? green(formatFlag('emitted')) : void 0,
    'asset.comparedForEmit': (comparedForEmit, { yellow, formatFlag })=>comparedForEmit ? yellow(formatFlag('compared for emit')) : void 0,
    'asset.cached': (cached, { green, formatFlag })=>cached ? green(formatFlag('cached')) : void 0,
    'asset.isOverSizeLimit': (isOverSizeLimit, { yellow, formatFlag })=>isOverSizeLimit ? yellow?.(formatFlag('big')) : void 0,
    'asset.info.immutable': (immutable, { green, formatFlag })=>immutable ? green(formatFlag('immutable')) : void 0,
    "asset.info.javascriptModule": (javascriptModule, { formatFlag })=>javascriptModule ? formatFlag("javascript module") : void 0,
    'asset.info.sourceFilename': (sourceFilename, { formatFlag })=>sourceFilename ? formatFlag(!0 === sourceFilename ? 'from source file' : `from: ${sourceFilename}`) : void 0,
    'asset.info.copied': (copied, { green, formatFlag })=>copied ? green(formatFlag('copied')) : void 0,
    'asset.info.development': (development, { green, formatFlag })=>development ? green(formatFlag('dev')) : void 0,
    'asset.info.hotModuleReplacement': (hotModuleReplacement, { green, formatFlag })=>hotModuleReplacement ? green(formatFlag('hmr')) : void 0,
    'asset.separator!': ()=>'\n',
    'asset.filteredRelated': (filteredRelated, { asset: { related } })=>filteredRelated > 0 ? `${moreCount(related, filteredRelated)} related ${DefaultStatsPrinterPlugin_plural(filteredRelated, 'asset', 'assets')}` : void 0,
    'asset.filteredChildren': (filteredChildren, { asset: { children } })=>filteredChildren > 0 ? `${moreCount(children, filteredChildren)} ${DefaultStatsPrinterPlugin_plural(filteredChildren, 'asset', 'assets')}` : void 0,
    assetChunk: (id, { formatChunkId })=>formatChunkId(id),
    assetChunkName: (name)=>name,
    assetChunkIdHint: (name)=>name,
    'module.type': (type)=>'module' !== type ? type : void 0,
    'module.id': (id, { formatModuleId })=>'number' == typeof id || id ? formatModuleId(id) : void 0,
    'module.name': (name, { bold })=>{
        let [prefix, resource] = ((name)=>{
            let matchResourceMatch = /^([^!]+)!=!/.exec(name), n = matchResourceMatch ? matchResourceMatch[0] + getResourceName(name.slice(matchResourceMatch[0].length)) : name, [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(n) || [];
            return [
                prefix,
                getResourceName(resource)
            ];
        })(name);
        return `${prefix || ''}${bold(resource || '')}`;
    },
    'module.identifier': (_identifier)=>void 0,
    'module.layer': (layer, { formatLayer })=>layer ? formatLayer(layer) : void 0,
    'module.sizes': printSizes,
    'module.chunks[]': (id, { formatChunkId })=>formatChunkId(id),
    'module.depth': (depth, { formatFlag })=>null !== depth ? formatFlag(`depth ${depth}`) : void 0,
    'module.cacheable': (cacheable, { formatFlag, red })=>!1 === cacheable ? red(formatFlag('not cacheable')) : void 0,
    'module.orphan': (orphan, { formatFlag, yellow })=>orphan ? yellow(formatFlag('orphan')) : void 0,
    'module.runtime': (runtime, { formatFlag, yellow })=>runtime ? yellow(formatFlag('runtime')) : void 0,
    'module.optional': (optional, { formatFlag, yellow })=>optional ? yellow(formatFlag('optional')) : void 0,
    'module.dependent': (dependent, { formatFlag, cyan })=>dependent ? cyan(formatFlag('dependent')) : void 0,
    'module.built': (built, { formatFlag, yellow })=>built ? yellow(formatFlag('built')) : void 0,
    'module.codeGenerated': (codeGenerated, { formatFlag, yellow })=>codeGenerated ? yellow(formatFlag('code generated')) : void 0,
    'module.buildTimeExecuted': (buildTimeExecuted, { formatFlag, green })=>buildTimeExecuted ? green(formatFlag('build time executed')) : void 0,
    'module.cached': (cached, { formatFlag, green })=>cached ? green(formatFlag('cached')) : void 0,
    'module.assets': (assets, { formatFlag, magenta })=>assets?.length ? magenta(formatFlag(`${assets.length} ${DefaultStatsPrinterPlugin_plural(assets.length, 'asset', 'assets')}`)) : void 0,
    'module.warnings': (warnings, { formatFlag, yellow })=>!0 === warnings ? yellow(formatFlag('warnings')) : warnings ? yellow(formatFlag(`${warnings} ${DefaultStatsPrinterPlugin_plural(warnings, 'warning', 'warnings')}`)) : void 0,
    'module.errors': (errors, { formatFlag, red })=>!0 === errors ? red(formatFlag('errors')) : errors ? red(formatFlag(`${errors} ${DefaultStatsPrinterPlugin_plural(errors, 'error', 'errors')}`)) : void 0,
    'module.providedExports': (providedExports, { formatFlag, cyan })=>{
        if (Array.isArray(providedExports)) return cyan(0 === providedExports.length ? formatFlag('no exports') : formatFlag(`exports: ${providedExports.join(', ')}`));
    },
    'module.usedExports': (usedExports, { formatFlag, cyan, module })=>{
        if (!0 !== usedExports) {
            if (null === usedExports) return cyan(formatFlag('used exports unknown'));
            if (!1 === usedExports) return cyan(formatFlag('module unused'));
            if (Array.isArray(usedExports)) {
                if (0 === usedExports.length) return cyan(formatFlag('no exports used'));
                let providedExportsCount = Array.isArray(module.providedExports) ? module.providedExports.length : null;
                return cyan(null !== providedExportsCount && providedExportsCount === usedExports.length ? formatFlag('all exports used') : formatFlag(`only some exports used: ${usedExports.join(', ')}`));
            }
        }
    },
    'module.optimizationBailout[]': (optimizationBailout, { yellow })=>yellow(optimizationBailout),
    'module.issuerPath': (_issuerPath)=>'',
    'module.filteredModules': (filteredModules, { module: { modules } })=>filteredModules > 0 ? `${moreCount(modules, filteredModules)} nested ${DefaultStatsPrinterPlugin_plural(filteredModules, 'module', 'modules')}` : void 0,
    'module.filteredReasons': (filteredReasons, { module: { reasons } })=>filteredReasons > 0 ? `${moreCount(reasons, filteredReasons)} ${DefaultStatsPrinterPlugin_plural(filteredReasons, 'reason', 'reasons')}` : void 0,
    'module.filteredChildren': (filteredChildren, { module: { children } })=>filteredChildren > 0 ? `${moreCount(children, filteredChildren)} ${DefaultStatsPrinterPlugin_plural(filteredChildren, 'module', 'modules')}` : void 0,
    'module.separator!': ()=>'\n',
    'moduleIssuer.id': (id, { formatModuleId })=>formatModuleId(id),
    'moduleReason.type': (type)=>type,
    'moduleReason.userRequest': (userRequest, { cyan })=>cyan(getResourceName(userRequest)),
    'moduleReason.moduleId': (moduleId, { formatModuleId })=>'number' == typeof moduleId || moduleId ? formatModuleId(moduleId) : void 0,
    'moduleReason.module': (module, { magenta })=>magenta(module),
    'moduleReason.loc': (loc)=>loc,
    'moduleReason.explanation': (explanation, { cyan })=>cyan(explanation),
    'moduleReason.active': (active, { formatFlag })=>active ? void 0 : formatFlag('inactive'),
    'moduleReason.resolvedModule': (module, { magenta })=>magenta(module),
    'moduleReason.filteredChildren': (filteredChildren, { moduleReason: { children } })=>filteredChildren > 0 ? `${moreCount(children, filteredChildren)} ${DefaultStatsPrinterPlugin_plural(filteredChildren, 'reason', 'reasons')}` : void 0,
    'chunkGroup.kind!': (_, { chunkGroupKind })=>chunkGroupKind,
    'chunkGroup.separator!': ()=>'\n',
    'chunkGroup.name': (name, { bold })=>bold(name),
    'chunkGroup.isOverSizeLimit': (isOverSizeLimit, { formatFlag, yellow })=>isOverSizeLimit ? yellow(formatFlag('big')) : void 0,
    'chunkGroup.assetsSize': (size, { formatSize })=>size ? formatSize(size) : void 0,
    'chunkGroup.auxiliaryAssetsSize': (size, { formatSize })=>size ? `(${formatSize(size)})` : void 0,
    'chunkGroup.filteredAssets': (n, { chunkGroup: { assets } })=>n > 0 ? `${moreCount(assets, n)} ${DefaultStatsPrinterPlugin_plural(n, 'asset', 'assets')}` : void 0,
    'chunkGroup.filteredAuxiliaryAssets': (n, { chunkGroup: { auxiliaryAssets } })=>n > 0 ? `${moreCount(auxiliaryAssets, n)} auxiliary ${DefaultStatsPrinterPlugin_plural(n, 'asset', 'assets')}` : void 0,
    'chunkGroup.is!': ()=>'=',
    'chunkGroupAsset.name': (asset, { green })=>green(asset),
    'chunkGroupAsset.size': (size, { formatSize, chunkGroup })=>chunkGroup.assets && chunkGroup.assets.length > 1 || chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0 ? formatSize(size) : void 0,
    'chunkGroup.children': (children, context, printer)=>Array.isArray(children) ? void 0 : printer.print(context.type, Object.keys(children).map((key)=>({
                type: key,
                children: children[key]
            })), context),
    'chunkGroupChildGroup.type': (type)=>`${type}:`,
    'chunkGroupChild.assets[]': (file, { formatFilename })=>formatFilename(file),
    'chunkGroupChild.chunks[]': (id, { formatChunkId })=>formatChunkId(id),
    'chunkGroupChild.name': (name)=>name ? `(name: ${name})` : void 0,
    'chunk.id': (id, { formatChunkId })=>formatChunkId(id),
    'chunk.files[]': (file, { formatFilename })=>formatFilename(file),
    'chunk.names[]': (name)=>name,
    'chunk.idHints[]': (name)=>name,
    'chunk.runtime[]': (name)=>name,
    'chunk.sizes': (sizes, context)=>printSizes(sizes, context),
    'chunk.parents[]': (parents, context)=>context.formatChunkId(parents, 'parent'),
    'chunk.siblings[]': (siblings, context)=>context.formatChunkId(siblings, 'sibling'),
    'chunk.children[]': (children, context)=>context.formatChunkId(children, 'child'),
    'chunk.childrenByOrder': (childrenByOrder, context, printer)=>{
        if (Array.isArray(childrenByOrder)) return;
        let items = Object.keys(childrenByOrder).map((key)=>({
                type: key,
                children: childrenByOrder[key]
            }));
        return items.sort((a, b)=>compareIds(a.type, b.type)), Array.isArray(childrenByOrder) ? void 0 : printer.print(context.type, items, context);
    },
    'chunk.childrenByOrder[].type': (type)=>`${type}:`,
    'chunk.childrenByOrder[].children[]': (id, { formatChunkId })=>'number' == typeof id || id ? formatChunkId(id) : void 0,
    'chunk.entry': (entry, { formatFlag, yellow })=>entry ? yellow(formatFlag('entry')) : void 0,
    'chunk.initial': (initial, { formatFlag, yellow })=>initial ? yellow(formatFlag('initial')) : void 0,
    'chunk.rendered': (rendered, { formatFlag, green })=>rendered ? green(formatFlag('rendered')) : void 0,
    'chunk.recorded': (recorded, { formatFlag, green })=>recorded ? green(formatFlag('recorded')) : void 0,
    'chunk.reason': (reason, { yellow })=>reason ? yellow(reason) : void 0,
    'chunk.filteredModules': (filteredModules, { chunk: { modules } })=>filteredModules > 0 ? `${moreCount(modules, filteredModules)} chunk ${DefaultStatsPrinterPlugin_plural(filteredModules, 'module', 'modules')}` : void 0,
    'chunk.separator!': ()=>'\n',
    'chunkOrigin.request': (request)=>request,
    'chunkOrigin.moduleId': (moduleId, { formatModuleId })=>'number' == typeof moduleId || moduleId ? formatModuleId(moduleId) : void 0,
    'chunkOrigin.moduleName': (moduleName, { bold })=>bold(moduleName),
    'chunkOrigin.loc': (loc)=>loc,
    'error.file': (file, { bold })=>bold(file),
    'error.moduleName': (moduleName, { bold })=>moduleName.includes('!') ? `${bold(moduleName.replace(/^(\s|\S)*!/, ''))} (${moduleName})` : bold(moduleName),
    'error.loc': (loc, { green })=>green(loc),
    'error.message': (message, { bold, formatError })=>message.includes('\u001b[') ? message : bold(formatError(message)),
    'error.details': (details, { formatError })=>formatError(details),
    'error.stack': (stack)=>stack,
    'error.moduleTrace': (_moduleTrace)=>void 0,
    'error.separator!': ()=>'\n',
    'loggingEntry(error).loggingEntry.message': (message, { red })=>mapLines(message, (x)=>`<e> ${red(x)}`),
    'loggingEntry(warn).loggingEntry.message': (message, { yellow })=>mapLines(message, (x)=>`<w> ${yellow(x)}`),
    'loggingEntry(info).loggingEntry.message': (message, { green })=>mapLines(message, (x)=>`<i> ${green(x)}`),
    'loggingEntry(log).loggingEntry.message': (message, { bold })=>mapLines(message, (x)=>`    ${bold(x)}`),
    'loggingEntry(debug).loggingEntry.message': (message)=>mapLines(message, (x)=>`    ${x}`),
    'loggingEntry(trace).loggingEntry.message': (message)=>mapLines(message, (x)=>`    ${x}`),
    'loggingEntry(status).loggingEntry.message': (message, { magenta })=>mapLines(message, (x)=>`<s> ${magenta(x)}`),
    'loggingEntry(profile).loggingEntry.message': (message, { magenta })=>mapLines(message, (x)=>`<p> ${magenta(x)}`),
    'loggingEntry(profileEnd).loggingEntry.message': (message, { magenta })=>mapLines(message, (x)=>`</p> ${magenta(x)}`),
    'loggingEntry(time).loggingEntry.message': (message, { magenta })=>mapLines(message, (x)=>`<t> ${magenta(x)}`),
    'loggingEntry(cache).loggingEntry.message': (message, { magenta })=>mapLines(message, (x)=>`<c> ${magenta(x)}`),
    'loggingEntry(group).loggingEntry.message': (message, { cyan })=>mapLines(message, (x)=>`<-> ${cyan(x)}`),
    'loggingEntry(groupCollapsed).loggingEntry.message': (message, { cyan })=>mapLines(message, (x)=>`<+> ${cyan(x)}`),
    'loggingEntry(clear).loggingEntry': ()=>'    -------',
    'loggingEntry(groupCollapsed).loggingEntry.children': ()=>'',
    'loggingEntry.trace[]': (trace)=>trace ? mapLines(trace, (x)=>`| ${x}`) : void 0,
    'moduleTraceItem.originName': (originName)=>originName,
    loggingGroup: (loggingGroup)=>0 === loggingGroup.entries.length ? '' : void 0,
    'loggingGroup.debug': (flag, { red })=>flag ? red('DEBUG') : void 0,
    'loggingGroup.name': (name, { bold })=>bold(`LOG from ${name}`),
    'loggingGroup.separator!': ()=>'\n',
    'loggingGroup.filteredEntries': (filteredEntries)=>filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : void 0,
    'moduleTraceDependency.loc': (loc)=>loc
}, DefaultStatsPrinterPlugin_ITEM_NAMES = {
    ...SHARED_ITEM_NAMES,
    'compilation.warnings[]': 'error',
    'compilation.logging[]': 'loggingGroup',
    'asset.children[]': 'asset',
    'asset.chunks[]': 'assetChunk',
    'asset.auxiliaryChunks[]': 'assetChunk',
    'asset.chunkNames[]': 'assetChunkName',
    'asset.chunkIdHints[]': 'assetChunkIdHint',
    'asset.auxiliaryChunkNames[]': 'assetChunkName',
    'asset.auxiliaryChunkIdHints[]': 'assetChunkIdHint',
    'chunkGroup.assets[]': 'chunkGroupAsset',
    'chunkGroup.auxiliaryAssets[]': 'chunkGroupAsset',
    'chunkGroupChild.assets[]': 'chunkGroupAsset',
    'chunkGroupChild.auxiliaryAssets[]': 'chunkGroupAsset',
    'chunkGroup.children[]': 'chunkGroupChildGroup',
    'chunkGroupChildGroup.children[]': 'chunkGroupChild',
    'moduleReason.children[]': 'moduleReason',
    'loggingGroup.entries[]': (logEntry)=>`loggingEntry(${logEntry.type}).loggingEntry`,
    'loggingEntry.children[]': (logEntry)=>`loggingEntry(${logEntry.type}).loggingEntry`,
    'error.moduleTrace[]': 'moduleTraceItem',
    'moduleTraceItem.dependencies[]': 'moduleTraceDependency'
}, ERROR_PREFERRED_ORDER = [
    'compilerPath',
    'chunkId',
    'chunkEntry',
    'chunkInitial',
    'file',
    'separator!',
    'moduleName',
    'loc',
    'separator!',
    'message',
    'separator!',
    'details',
    'separator!',
    'stack',
    'separator!',
    'missing',
    'separator!',
    'moduleTrace'
], PREFERRED_ORDERS = {
    compilation: [
        'name',
        'hash',
        'rspackVersion',
        'time',
        'builtAt',
        'env',
        'publicPath',
        'assets',
        'filteredAssets',
        'entrypoints',
        'namedChunkGroups',
        'chunks',
        'modules',
        'filteredModules',
        'children',
        'logging',
        'warnings',
        'warningsInChildren!',
        'filteredWarningDetailsCount',
        'errors',
        'errorsInChildren!',
        'filteredErrorDetailsCount',
        'summary!',
        'needAdditionalPass'
    ],
    asset: [
        'type',
        'name',
        'size',
        'chunks',
        'auxiliaryChunks',
        'emitted',
        'comparedForEmit',
        'cached',
        'info',
        'isOverSizeLimit',
        'chunkNames',
        'auxiliaryChunkNames',
        'chunkIdHints',
        'auxiliaryChunkIdHints',
        'related',
        'filteredRelated',
        'children',
        'filteredChildren'
    ],
    'asset.info': [
        'immutable',
        'sourceFilename',
        'copied',
        "javascriptModule",
        'development',
        'hotModuleReplacement'
    ],
    chunkGroup: [
        'kind!',
        'name',
        'isOverSizeLimit',
        'assetsSize',
        'auxiliaryAssetsSize',
        'is!',
        'assets',
        'filteredAssets',
        'auxiliaryAssets',
        'filteredAuxiliaryAssets',
        'separator!',
        'children'
    ],
    chunkGroupAsset: [
        'name',
        'size'
    ],
    chunkGroupChildGroup: [
        'type',
        'children'
    ],
    chunkGroupChild: [
        'assets',
        'chunks',
        'name'
    ],
    module: [
        'type',
        'name',
        'identifier',
        'id',
        'layer',
        'sizes',
        'chunks',
        'depth',
        'cacheable',
        'orphan',
        'runtime',
        'optional',
        'dependent',
        'built',
        'codeGenerated',
        'cached',
        'assets',
        'failed',
        'warnings',
        'errors',
        'children',
        'filteredChildren',
        'providedExports',
        'usedExports',
        'optimizationBailout',
        'reasons',
        'filteredReasons',
        'issuerPath',
        'modules',
        'filteredModules'
    ],
    moduleReason: [
        'active',
        'type',
        'userRequest',
        'moduleId',
        'module',
        'resolvedModule',
        'loc',
        'explanation',
        'children',
        'filteredChildren'
    ],
    chunk: [
        'id',
        'runtime',
        'files',
        'names',
        'idHints',
        'sizes',
        'parents',
        'siblings',
        'children',
        'childrenByOrder',
        'entry',
        'initial',
        'rendered',
        'recorded',
        'reason',
        'separator!',
        'origins',
        'separator!',
        'modules',
        'separator!',
        'filteredModules'
    ],
    chunkOrigin: [
        'request',
        'moduleId',
        'moduleName',
        'loc'
    ],
    error: ERROR_PREFERRED_ORDER,
    warning: ERROR_PREFERRED_ORDER,
    'chunk.childrenByOrder[]': [
        'type',
        'children'
    ],
    loggingGroup: [
        'debug',
        'name',
        'separator!',
        'entries',
        'separator!',
        'filteredEntries'
    ],
    loggingEntry: [
        'message',
        'trace',
        'children'
    ]
}, itemsJoinOneLine = (items)=>items.filter(Boolean).join(' '), itemsJoinOneLineBrackets = (items)=>items.length > 0 ? `(${items.filter(Boolean).join(' ')})` : void 0, itemsJoinMoreSpacing = (items)=>items.filter(Boolean).join('\n\n'), itemsJoinComma = (items)=>items.filter(Boolean).join(', '), itemsJoinCommaBrackets = (items)=>items.length > 0 ? `(${items.filter(Boolean).join(', ')})` : void 0, itemsJoinCommaBracketsWithName = (name)=>(items)=>items.length > 0 ? `(${name}: ${items.filter(Boolean).join(', ')})` : void 0, SIMPLE_ITEMS_JOINER = {
    'chunk.parents': itemsJoinOneLine,
    'chunk.siblings': itemsJoinOneLine,
    'chunk.children': itemsJoinOneLine,
    'chunk.names': itemsJoinCommaBrackets,
    'chunk.idHints': itemsJoinCommaBracketsWithName('id hint'),
    'chunk.runtime': itemsJoinCommaBracketsWithName('runtime'),
    'chunk.files': itemsJoinComma,
    'chunk.childrenByOrder': itemsJoinOneLine,
    'chunk.childrenByOrder[].children': itemsJoinOneLine,
    'chunkGroup.assets': itemsJoinOneLine,
    'chunkGroup.auxiliaryAssets': itemsJoinOneLineBrackets,
    'chunkGroupChildGroup.children': itemsJoinComma,
    'chunkGroupChild.assets': itemsJoinOneLine,
    'chunkGroupChild.auxiliaryAssets': itemsJoinOneLineBrackets,
    'asset.chunks': itemsJoinComma,
    'asset.auxiliaryChunks': itemsJoinCommaBrackets,
    'asset.chunkNames': itemsJoinCommaBracketsWithName('name'),
    'asset.auxiliaryChunkNames': itemsJoinCommaBracketsWithName('auxiliary name'),
    'asset.chunkIdHints': itemsJoinCommaBracketsWithName('id hint'),
    'asset.auxiliaryChunkIdHints': itemsJoinCommaBracketsWithName('auxiliary id hint'),
    'module.chunks': itemsJoinOneLine,
    'module.issuerPath': (items)=>items.filter(Boolean).map((item)=>`${item} ->`).join(' '),
    'compilation.errors': itemsJoinMoreSpacing,
    'compilation.warnings': itemsJoinMoreSpacing,
    'compilation.logging': itemsJoinMoreSpacing,
    'compilation.children': (items)=>DefaultStatsPrinterPlugin_indent(itemsJoinMoreSpacing(items), '  '),
    'moduleTraceItem.dependencies': itemsJoinOneLine,
    'loggingEntry.children': (items)=>DefaultStatsPrinterPlugin_indent(items.filter(Boolean).join('\n'), '  ', !1)
}, joinOneLine = (items)=>items.map((item)=>item.content).filter(Boolean).join(' '), DefaultStatsPrinterPlugin_indent = (str, prefix, noPrefixInFirstLine)=>{
    let rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
    return noPrefixInFirstLine ? rem : ('\n' === str[0] ? '' : prefix) + rem;
}, joinExplicitNewLine = (items, indenter)=>{
    let firstInLine = !0, first = !0;
    return items.map((item)=>{
        if (!item || !item.content) return;
        let content = DefaultStatsPrinterPlugin_indent(item.content, first ? '' : indenter, !firstInLine);
        if (firstInLine && (content = content.replace(/^\n+/, '')), !content) return;
        first = !1;
        let noJoiner = firstInLine || content.startsWith('\n');
        return firstInLine = content.endsWith('\n'), noJoiner ? content : ` ${content}`;
    }).filter(Boolean).join('').trim();
}, joinError = (error)=>(items, { red, yellow })=>`${error ? red('ERROR') : yellow('WARNING')} in ${joinExplicitNewLine(items, '')}`, SIMPLE_ELEMENT_JOINERS = {
    compilation: (items)=>{
        let result = [], lastNeedMore = !1;
        for (let item of items){
            if (!item.content) continue;
            let needMoreSpace = [
                'warnings',
                'filteredWarningDetailsCount',
                'errors',
                'filteredErrorDetailsCount',
                'logging'
            ].includes(item.element);
            0 !== result.length && result.push(needMoreSpace || lastNeedMore ? '\n\n' : '\n'), result.push(item.content), lastNeedMore = needMoreSpace;
        }
        return lastNeedMore && result.push('\n'), result.join('');
    },
    asset: (items)=>joinExplicitNewLine(items.map((item)=>('related' === item.element || 'children' === item.element) && item.content ? {
                ...item,
                content: `\n${item.content}\n`
            } : item), '  '),
    'asset.info': joinOneLine,
    module: (items, { module })=>{
        let hasName = !1;
        return joinExplicitNewLine(items.map((item)=>{
            switch(item.element){
                case 'id':
                    if (module && module.id === module.name) {
                        if (hasName) return !1;
                        item.content && (hasName = !0);
                    }
                    break;
                case 'name':
                    if (hasName) return !1;
                    item.content && (hasName = !0);
                    break;
                case 'providedExports':
                case 'usedExports':
                case 'optimizationBailout':
                case 'reasons':
                case 'issuerPath':
                case 'children':
                case 'modules':
                    if (item.content) return {
                        ...item,
                        content: `\n${item.content}\n`
                    };
            }
            return item;
        }), '  ');
    },
    chunk: (items)=>{
        let hasEntry = !1;
        return `chunk ${joinExplicitNewLine(items.filter((item)=>{
            switch(item.element){
                case 'entry':
                    item.content && (hasEntry = !0);
                    break;
                case 'initial':
                    if (hasEntry) return !1;
            }
            return !0;
        }), '  ')}`;
    },
    'chunk.childrenByOrder[]': (items)=>`(${joinOneLine(items)})`,
    chunkGroup: (items)=>joinExplicitNewLine(items, '  '),
    chunkGroupAsset: joinOneLine,
    chunkGroupChildGroup: joinOneLine,
    chunkGroupChild: joinOneLine,
    moduleReason: (items, { moduleReason })=>{
        let hasName = !1;
        return joinExplicitNewLine(items.map((item)=>{
            switch(item.element){
                case 'moduleId':
                    moduleReason && moduleReason.moduleId === moduleReason.module && item.content && (hasName = !0);
                    break;
                case 'module':
                    if (hasName) return !1;
                    break;
                case 'resolvedModule':
                    if (moduleReason && moduleReason.module === moduleReason.resolvedModule) return !1;
                    break;
                case 'children':
                    if (item.content) return {
                        ...item,
                        content: `\n${item.content}\n`
                    };
            }
            return item;
        }), '  ');
    },
    moduleIssuer: joinOneLine,
    chunkOrigin: (items)=>`> ${joinOneLine(items)}`,
    'errors[].error': joinError(!0),
    'warnings[].error': joinError(!1),
    loggingGroup: (items)=>joinExplicitNewLine(items, '').trimEnd(),
    moduleTraceItem: (items)=>` @ ${joinOneLine(items)}`,
    moduleTraceDependency: joinOneLine
}, AVAILABLE_COLORS = {
    bold: '\u001b[1m',
    yellow: '\u001b[1m\u001b[33m',
    red: '\u001b[1m\u001b[31m',
    green: '\u001b[1m\u001b[32m',
    cyan: '\u001b[1m\u001b[36m',
    magenta: '\u001b[1m\u001b[35m'
}, AVAILABLE_FORMATS = {
    formatChunkId: (id, { yellow }, direction)=>{
        switch(direction){
            case 'parent':
                return `<{${yellow(id)}}>`;
            case 'sibling':
                return `={${yellow(id)}}=`;
            case 'child':
                return `>{${yellow(id)}}<`;
            default:
                return `{${yellow(id)}}`;
        }
    },
    formatModuleId: (id)=>`[${id}]`,
    formatFilename: (filename, { green, yellow }, oversize)=>(oversize ? yellow : green)(filename),
    formatFlag: (flag)=>`[${flag}]`,
    formatLayer: (layer)=>`(in ${layer})`,
    formatSize: (size)=>{
        if ('number' != typeof size || Number.isNaN(size)) return 'unknown size';
        if (size <= 0) return '0 bytes';
        let index = Math.floor(Math.log(size) / Math.log(1024));
        return `${+(size / 1024 ** index).toPrecision(3)} ${[
            'bytes',
            'KiB',
            'MiB',
            'GiB'
        ][index]}`;
    },
    formatDateTime: (dateTime, { bold })=>{
        let d = new Date(dateTime), date = `${d.getFullYear()}-${twoDigit(d.getMonth() + 1)}-${twoDigit(d.getDate())}`, time = `${twoDigit(d.getHours())}:${twoDigit(d.getMinutes())}:${twoDigit(d.getSeconds())}`;
        return `${date} ${bold(time)}`;
    },
    formatTime: (time, { timeReference, bold, green, yellow, red }, boldQuantity)=>{
        let unit = ' ms';
        if (timeReference && time !== timeReference) {
            let times = [
                timeReference / 2,
                timeReference / 4,
                timeReference / 8,
                timeReference / 16
            ];
            return time < times[3] ? `${time}${unit}` : time < times[2] ? bold(`${time}${unit}`) : time < times[1] ? green(`${time}${unit}`) : time < times[0] ? yellow(`${time}${unit}`) : red(`${time}${unit}`);
        }
        let timeStr = time.toString();
        return time > 1000 && (timeStr = (time / 1000).toFixed(2), unit = ' s'), `${boldQuantity ? bold(timeStr) : timeStr}${unit}`;
    },
    formatError: (msg, { green, yellow, red })=>{
        let message = msg;
        if (message.includes('\u001b[')) return message;
        for (let { regExp, format } of [
            {
                regExp: /(Did you mean .+)/g,
                format: green
            },
            {
                regExp: /(\(module has no exports\))/g,
                format: red
            },
            {
                regExp: /\(possible exports: (.+)\)/g,
                format: green
            },
            {
                regExp: /(?:^|\n)(.* doesn't exist)/g,
                format: red
            },
            {
                regExp: /(Emitted value instead of an instance of Error)/g,
                format: yellow
            },
            {
                regExp: /(Used? .+ instead)/gi,
                format: yellow
            },
            {
                regExp: /\b(deprecated|must|required)\b/g,
                format: yellow
            },
            {
                regExp: /\b(BREAKING CHANGE)\b/gi,
                format: red
            },
            {
                regExp: /\b(error|failed|unexpected|invalid|not found|not supported|not available|not possible|not implemented|doesn't support|conflict|conflicting|not existing|duplicate)\b/gi,
                format: red
            }
        ])message = message.replace(regExp, (match, content)=>match.replace(content, format(content)));
        return message;
    }
}, RESULT_MODIFIER = {
    'module.modules': (result)=>DefaultStatsPrinterPlugin_indent(result, '| ')
}, createOrder = (array, preferredOrder)=>{
    let originalArray = array.slice(), set = new Set(array), usedSet = new Set();
    for (let element of (array.length = 0, preferredOrder))(element.endsWith('!') || set.has(element)) && (array.push(element), usedSet.add(element));
    for (let element of originalArray)usedSet.has(element) || array.push(element);
    return array;
};
class DefaultStatsPrinterPlugin {
    apply(compiler) {
        compiler.hooks.compilation.tap('DefaultStatsPrinterPlugin', (compilation)=>{
            compilation.hooks.statsPrinter.tap('DefaultStatsPrinterPlugin', (stats, options)=>{
                for (let key of (stats.hooks.print.for('compilation').tap('DefaultStatsPrinterPlugin', (compilation, context)=>{
                    for (let color of Object.keys(AVAILABLE_COLORS)){
                        let start;
                        options.colors && (start = 'object' == typeof options.colors && 'string' == typeof options.colors[color] ? options.colors[color] : AVAILABLE_COLORS[color]), start ? context[color] = (str)=>`${start}${'string' == typeof str ? str.replace(/((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g, `$1${start}`) : str}\u001b[39m\u001b[22m` : context[color] = (str)=>str;
                    }
                    for (let format of Object.keys(AVAILABLE_FORMATS))context[format] = (content, ...args)=>AVAILABLE_FORMATS[format](content, context, ...args);
                    context.timeReference = compilation.time;
                }), Object.keys(SIMPLE_PRINTERS)))stats.hooks.print.for(key).tap('DefaultStatsPrinterPlugin', (obj, ctx)=>SIMPLE_PRINTERS[key](obj, ctx, stats));
                for (let key of Object.keys(PREFERRED_ORDERS)){
                    let preferredOrder = PREFERRED_ORDERS[key];
                    stats.hooks.sortElements.for(key).tap('DefaultStatsPrinterPlugin', (elements)=>{
                        createOrder(elements, preferredOrder);
                    });
                }
                for (let key of Object.keys(DefaultStatsPrinterPlugin_ITEM_NAMES)){
                    let itemName = DefaultStatsPrinterPlugin_ITEM_NAMES[key];
                    stats.hooks.getItemName.for(key).tap('DefaultStatsPrinterPlugin', 'string' == typeof itemName ? ()=>itemName : itemName);
                }
                for (let key of Object.keys(SIMPLE_ITEMS_JOINER)){
                    let joiner = SIMPLE_ITEMS_JOINER[key];
                    stats.hooks.printItems.for(key).tap('DefaultStatsPrinterPlugin', joiner);
                }
                for (let key of Object.keys(SIMPLE_ELEMENT_JOINERS)){
                    let joiner = SIMPLE_ELEMENT_JOINERS[key];
                    stats.hooks.printElements.for(key).tap('DefaultStatsPrinterPlugin', joiner);
                }
                for (let key of Object.keys(RESULT_MODIFIER)){
                    let modifier = RESULT_MODIFIER[key];
                    stats.hooks.result.for(key).tap('DefaultStatsPrinterPlugin', modifier);
                }
            });
        });
    }
}
class RspackOptionsApply {
    process(options, compiler) {
        if (!options.output.path) throw Error('options.output.path should have a value after `applyRspackOptionsDefaults`');
        if (compiler.outputPath = options.output.path, compiler.name = options.name, compiler.outputFileSystem = node_fs, options.externals) {
            if (!options.externalsType) throw Error('options.externalsType should have a value after `applyRspackOptionsDefaults`');
            new ExternalsPlugin(options.externalsType, options.externals, !1, function(options) {
                let { context, target } = options;
                return (assertNotNill(context), null == target || !1 === target) ? 'commonjs' : ('string' == typeof target ? getTargetProperties(target, context) : getTargetsProperties(target, context)).nodeBuiltins ? 'node-commonjs' : 'commonjs';
            }(options)).apply(compiler);
        }
        if (options.externalsPresets.node && (new NodeTargetPlugin().apply(compiler), new CssHttpExternalsRspackPlugin().apply(compiler)), options.externalsPresets.electronMain && new ElectronTargetPlugin('main').apply(compiler), options.externalsPresets.electronPreload && new ElectronTargetPlugin('preload').apply(compiler), options.externalsPresets.electronRenderer && new ElectronTargetPlugin('renderer').apply(compiler), !options.externalsPresets.electron || options.externalsPresets.electronMain || options.externalsPresets.electronPreload || options.externalsPresets.electronRenderer || new ElectronTargetPlugin().apply(compiler), options.externalsPresets.nwjs && new ExternalsPlugin('node-commonjs', 'nw.gui', !1).apply(compiler), (options.externalsPresets.web || options.externalsPresets.webAsync) && new HttpExternalsRspackPlugin(!!options.externalsPresets.webAsync).apply(compiler), new ChunkPrefetchPreloadPlugin().apply(compiler), options.output.pathinfo && new ModuleInfoHeaderPlugin('verbose' === options.output.pathinfo).apply(compiler), 'string' == typeof options.output.chunkFormat) switch(options.output.chunkFormat){
            case 'array-push':
                new ArrayPushCallbackChunkFormatPlugin().apply(compiler);
                break;
            case 'commonjs':
                new CommonJsChunkFormatPlugin().apply(compiler);
                break;
            case 'module':
                new ModuleChunkFormatPlugin().apply(compiler);
                break;
            default:
                throw Error(`Unsupported chunk format '${options.output.chunkFormat}'.`);
        }
        if (options.output.enabledChunkLoadingTypes && options.output.enabledChunkLoadingTypes.length > 0) for (let type of options.output.enabledChunkLoadingTypes)new EnableChunkLoadingPlugin(type).apply(compiler);
        if (options.output.enabledWasmLoadingTypes && options.output.enabledWasmLoadingTypes.length > 0) for (let type of options.output.enabledWasmLoadingTypes)new EnableWasmLoadingPlugin(type).apply(compiler);
        let runtimeChunk = options.optimization.runtimeChunk;
        if (runtimeChunk && new RuntimeChunkPlugin(runtimeChunk).apply(compiler), options.optimization.emitOnErrors || new NoEmitOnErrorsPlugin().apply(compiler), options.devtool) if (options.devtool.includes('source-map')) {
            let hidden = options.devtool.includes('hidden'), inline = options.devtool.includes('inline'), evalWrapped = options.devtool.includes('eval'), cheap = options.devtool.includes('cheap'), moduleMaps = options.devtool.includes('module'), noSources = options.devtool.includes('nosources'), debugIds = options.devtool.includes('debugids');
            new (evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin)({
                filename: inline ? null : options.output.sourceMapFilename,
                moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
                fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,
                append: !hidden && void 0,
                module: !!moduleMaps || !cheap,
                columns: !cheap,
                noSources: noSources,
                namespace: options.output.devtoolNamespace,
                debugIds: debugIds
            }).apply(compiler);
        } else options.devtool.includes('eval') && new EvalDevToolModulePlugin({
            moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
            namespace: options.output.devtoolNamespace
        }).apply(compiler);
        new JavascriptModulesPlugin().apply(compiler), new URLPlugin().apply(compiler), new JsonModulesPlugin().apply(compiler), new AssetModulesPlugin().apply(compiler), options.experiments.asyncWebAssembly && new AsyncWebAssemblyModulesPlugin().apply(compiler), new CssModulesPlugin().apply(compiler), new lib_EntryOptionPlugin().apply(compiler), assertNotNill(options.context), compiler.hooks.entryOption.call(options.context, options.entry), new RuntimePlugin().apply(compiler), options.output.bundlerInfo && new BundlerInfoRspackPlugin(options.output.bundlerInfo).apply(compiler), new InferAsyncModulesPlugin().apply(compiler), new APIPlugin().apply(compiler), new DataUriPlugin().apply(compiler), new FileUriPlugin().apply(compiler), options.experiments.buildHttp && new HttpUriPlugin(options.experiments.buildHttp).apply(compiler), new EnsureChunkConditionsPlugin().apply(compiler), options.optimization.mergeDuplicateChunks && new MergeDuplicateChunksPlugin().apply(compiler), options.optimization.sideEffects && new SideEffectsFlagPlugin(options.experiments.pureFunctions).apply(compiler), options.optimization.providedExports && new FlagDependencyExportsPlugin().apply(compiler), 'production' === options.mode && new CircularModulesInfoPlugin().apply(compiler), options.optimization.usedExports && new FlagDependencyUsagePlugin('global' === options.optimization.usedExports).apply(compiler), options.optimization.concatenateModules && new ModuleConcatenationPlugin().apply(compiler), options.optimization.inlineExports && new InlineExportsPlugin().apply(compiler), options.optimization.mangleExports && new MangleExportsPlugin('size' !== options.optimization.mangleExports).apply(compiler);
        let enableLibSplitChunks = !1;
        if (options.output.enabledLibraryTypes && options.output.enabledLibraryTypes.length > 0) {
            let hasModernModule = options.output.enabledLibraryTypes.includes('modern-module'), hasNonModernModule = options.output.enabledLibraryTypes.some((t)=>'modern-module' !== t);
            for (let type of (options.output.library?.preserveModules && !hasModernModule && compiler.getInfrastructureLogger('rspack.RspackOptionsApply').warn('`preserveModules` only works for `modern-module` library type and will be ignored for other library types.'), hasModernModule && hasNonModernModule && compiler.getInfrastructureLogger('rspack.RspackOptionsApply').warn('`modern-module` is used together with other library types. ESM format has impact on chunkLoading and chunkFormat, which may not be compatible with other library types.'), options.output.enabledLibraryTypes))'modern-module' === type && (enableLibSplitChunks = !0), new EnableLibraryPlugin(type).apply(compiler);
        }
        !enableLibSplitChunks && options.optimization.splitChunks && new SplitChunksPlugin(options.optimization.splitChunks).apply(compiler), options.optimization.removeEmptyChunks && new RemoveEmptyChunksPlugin().apply(compiler), options.optimization.realContentHash && new RealContentHashPlugin().apply(compiler);
        let moduleIds = options.optimization.moduleIds;
        if (moduleIds) switch(moduleIds){
            case 'named':
                new NamedModuleIdsPlugin().apply(compiler);
                break;
            case 'natural':
                new NaturalModuleIdsPlugin().apply(compiler);
                break;
            case 'deterministic':
                new DeterministicModuleIdsPlugin().apply(compiler);
                break;
            case 'hashed':
                new HashedModuleIdsPlugin().apply(compiler);
                break;
            default:
                throw Error(`moduleIds: ${moduleIds} is not implemented`);
        }
        let chunkIds = options.optimization.chunkIds;
        if (chunkIds) switch(chunkIds){
            case 'natural':
                new NaturalChunkIdsPlugin().apply(compiler);
                break;
            case 'named':
                new NamedChunkIdsPlugin().apply(compiler);
                break;
            case 'deterministic':
                new DeterministicChunkIdsPlugin().apply(compiler);
                break;
            case 'size':
                new OccurrenceChunkIdsPlugin({
                    prioritiseInitial: !0
                }).apply(compiler);
                break;
            case 'total-size':
                new OccurrenceChunkIdsPlugin({
                    prioritiseInitial: !1
                }).apply(compiler);
                break;
            default:
                throw Error(`chunkIds: ${chunkIds} is not implemented`);
        }
        options.optimization.nodeEnv && new DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(options.optimization.nodeEnv)
        }).apply(compiler);
        let { minimize, minimizer } = options.optimization;
        if (minimize && minimizer) for (let item of minimizer)'function' == typeof item ? item.call(compiler, compiler) : '...' !== item && item && item.apply(compiler);
        if (options.performance && new SizeLimitsPlugin(options.performance).apply(compiler), options.cache && new MemoryCachePlugin().apply(compiler), new WorkerPlugin(options.output.workerChunkLoading, options.output.workerWasmLoading, options.output.module, options.output.workerPublicPath).apply(compiler), new DefaultStatsFactoryPlugin().apply(compiler), new DefaultStatsPresetPlugin().apply(compiler), new DefaultStatsPrinterPlugin().apply(compiler), options.ignoreWarnings && options.ignoreWarnings.length > 0 && new lib_IgnoreWarningsPlugin(options.ignoreWarnings).apply(compiler), compiler.hooks.afterPlugins.call(compiler), !compiler.inputFileSystem) throw Error('No input filesystem provided');
        compiler.hooks.afterResolvers.call(compiler);
    }
}
let validateConfig_ERROR_PREFIX = 'Invalid Rspack configuration:';
function validateRspackConfig(config) {
    (({ context })=>{
        if (context && !isAbsolute(context)) throw Error(`${validateConfig_ERROR_PREFIX} "context" must be an absolute path, get "${context}".`);
    })(config), (({ optimization })=>{
        if (optimization?.splitChunks) {
            let { minChunks } = optimization.splitChunks;
            if (void 0 !== minChunks && minChunks < 1) throw Error(`${validateConfig_ERROR_PREFIX} "optimization.splitChunks.minChunks" must be greater than or equal to 1, get \`${minChunks}\`.`);
        }
    })(config), (({ output, externals, externalsType })=>{
        let library = output?.library;
        if (!('object' == typeof library && 'type' in library && 'umd' === library.type) || void 0 !== externalsType && 'umd' !== externalsType) return;
        let checkExternalItem = (externalItem)=>{
            if ('object' == typeof externalItem && null !== externalItem) for (let value of Object.values(externalItem))checkExternalItemValue(value);
        }, checkExternalItemValue = (value)=>{
            if (value && 'object' == typeof value && [
                'root',
                'commonjs',
                'commonjs2',
                'amd'
            ].some((key)=>void 0 === value[key])) throw Error(`${validateConfig_ERROR_PREFIX} External object must have "root", "commonjs", "commonjs2", "amd" properties when "libraryType" or "externalsType" is "umd", get: ${JSON.stringify(value, null, 2)}.`);
        };
        Array.isArray(externals) ? externals.forEach((external)=>checkExternalItem(external)) : checkExternalItem(externals);
    })(config);
}
function createCompiler(userOptions) {
    var infrastructureLogging;
    let tty, options = getNormalizedRspackOptions(userOptions);
    if (F(options, 'context', ()=>process.cwd()), F(infrastructureLogging = options.infrastructureLogging, 'stream', ()=>process.stderr), tty = infrastructureLogging.stream?.isTTY && 'dumb' !== process.env.TERM, D(infrastructureLogging, 'level', 'info'), D(infrastructureLogging, 'debug', !1), D(infrastructureLogging, 'colors', tty), D(infrastructureLogging, 'appendOnly', !tty), isNil(options.context)) throw Error('options.context is required');
    let compiler = new Compiler(options.context, options);
    if (new NodeEnvironmentPlugin({
        infrastructureLogging: options.infrastructureLogging
    }).apply(compiler), Array.isArray(options.plugins)) for (let plugin of options.plugins)'function' == typeof plugin ? plugin.call(compiler, compiler) : plugin && plugin.apply(compiler);
    let tp = applyRspackOptionsDefaults(compiler.options);
    return tp && (compiler.platform = tp.platform, compiler.target = {
        esVersion: tp.esVersion,
        targets: tp.targets
    }), compiler.hooks.environment.call(), compiler.hooks.afterEnvironment.call(), new RspackOptionsApply().process(compiler.options, compiler), compiler.hooks.initialize.call(), compiler;
}
function isMultiRspackOptions(o) {
    return Array.isArray(o);
}
function rspack_rspack(options, callback) {
    try {
        if (isMultiRspackOptions(options)) for (let option of options)validateRspackConfig(option);
        else validateRspackConfig(options);
    } catch (err) {
        if (err instanceof Error && callback) return callback(err), null;
        throw err;
    }
    let create = ()=>{
        if (isMultiRspackOptions(options)) {
            let compiler = function(options) {
                let compilers = options.map(createCompiler), compiler = new MultiCompiler(compilers, options);
                for (let childCompiler of compilers)childCompiler.options.dependencies && compiler.setDependencies(childCompiler, childCompiler.options.dependencies);
                return compiler;
            }(options);
            return {
                compiler,
                watch: options.some((options)=>options.watch),
                watchOptions: options.map((options)=>options.watchOptions || {})
            };
        }
        let compiler = createCompiler(options);
        return {
            compiler,
            watch: options.watch,
            watchOptions: options.watchOptions || {}
        };
    };
    if (callback) try {
        let { compiler, watch, watchOptions } = create();
        return watch ? compiler.watch(watchOptions, callback) : compiler.run((err, stats)=>{
            compiler.close(()=>{
                callback(err, stats);
            });
        }), compiler;
    } catch (err) {
        return process.nextTick(()=>callback(err)), null;
    }
    {
        var message;
        let { compiler, watch } = create();
        return watch && (message = "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.", warnedMessages.has(message) || (warnedMessages.add(message), console.warn(`[Rspack Deprecation] ${message}`))), compiler;
    }
}
class CodeGenerationResult {
    #inner;
    constructor(result){
        this.#inner = result;
    }
    get(sourceType) {
        return this.#inner.sources[sourceType];
    }
}
class ContextModuleFactoryBeforeResolveData {
    #inner;
    static __from_binding(binding) {
        return new ContextModuleFactoryBeforeResolveData(binding);
    }
    static __to_binding(data) {
        return data.#inner;
    }
    constructor(binding){
        this.#inner = binding, Object.defineProperties(this, {
            context: {
                enumerable: !0,
                get: ()=>binding.context,
                set (val) {
                    binding.context = val;
                }
            },
            request: {
                enumerable: !0,
                get: ()=>binding.request,
                set (val) {
                    binding.request = val;
                }
            },
            regExp: {
                enumerable: !0,
                get: ()=>binding.regExp,
                set (val) {
                    binding.regExp = val;
                }
            },
            recursive: {
                enumerable: !0,
                get: ()=>binding.recursive,
                set (val) {
                    binding.recursive = val;
                }
            }
        });
    }
}
class ContextModuleFactoryAfterResolveData {
    #inner;
    static __from_binding(binding) {
        return new ContextModuleFactoryAfterResolveData(binding);
    }
    static __to_binding(data) {
        return data.#inner;
    }
    constructor(binding){
        this.#inner = binding, Object.defineProperties(this, {
            resource: {
                enumerable: !0,
                get: ()=>binding.resource,
                set (val) {
                    binding.resource = val;
                }
            },
            context: {
                enumerable: !0,
                get: ()=>binding.context,
                set (val) {
                    binding.context = val;
                }
            },
            request: {
                enumerable: !0,
                get: ()=>binding.request,
                set (val) {
                    binding.request = val;
                }
            },
            regExp: {
                enumerable: !0,
                get: ()=>binding.regExp,
                set (val) {
                    binding.regExp = val;
                }
            },
            recursive: {
                enumerable: !0,
                get: ()=>binding.recursive,
                set (val) {
                    binding.recursive = val;
                }
            },
            dependencies: {
                enumerable: !0,
                get: ()=>binding.dependencies
            }
        });
    }
}
Object.defineProperty(binding_default().Module.prototype, 'identifier', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this[binding_default().MODULE_IDENTIFIER_SYMBOL];
    }
}), Object.defineProperty(binding_default().Module.prototype, 'originalSource', {
    enumerable: !0,
    configurable: !0,
    value () {
        let originalSource = this._originalSource();
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
}), Object.defineProperty(binding_default().Module.prototype, 'emitFile', {
    enumerable: !0,
    configurable: !0,
    value (filename, source, assetInfo) {
        return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
    }
});
let traceHookPlugin_PLUGIN_NAME = 'TraceHookPlugin', PLUGIN_PROCESS_NAME = 'Plugin Analysis', makeInterceptorFor = (compilerName, tracer)=>(hookName)=>({
            register: (tapInfo)=>{
                let { name, type, fn: internalFn } = tapInfo, newFn = name === traceHookPlugin_PLUGIN_NAME ? internalFn : makeNewTraceTapFn(compilerName, hookName, tracer, {
                    name,
                    type,
                    fn: internalFn
                });
                return {
                    ...tapInfo,
                    fn: newFn
                };
            }
        }), interceptAllHooksFor = (instance, tracer, logLabel)=>{
    if (Reflect.has(instance, 'hooks')) for (let hookName of Object.keys(instance.hooks)){
        let hook = instance.hooks[hookName];
        hook && !hook._fakeHook && hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName));
    }
}, makeNewTraceTapFn = (compilerName, hookName, tracer, { name: pluginName, type, fn })=>{
    switch(type){
        case 'promise':
            return (...args)=>{
                let uuid = tracer.uuid();
                return tracer.startAsync({
                    name: hookName,
                    trackName: pluginName,
                    processName: PLUGIN_PROCESS_NAME,
                    uuid,
                    args: {
                        compilerName,
                        hookName,
                        pluginName
                    }
                }), fn(...args).then((r)=>(tracer.endAsync({
                        name: hookName,
                        trackName: pluginName,
                        processName: PLUGIN_PROCESS_NAME,
                        uuid,
                        args: {
                            compilerName,
                            hookName,
                            pluginName
                        }
                    }), r));
            };
        case 'async':
            return (...args)=>{
                let uuid = tracer.uuid();
                tracer.startAsync({
                    name: hookName,
                    trackName: pluginName,
                    processName: PLUGIN_PROCESS_NAME,
                    uuid,
                    args: {
                        compilerName,
                        hookName,
                        pluginName
                    }
                });
                let callback = args.pop();
                fn(...args, (...r)=>{
                    tracer.endAsync({
                        name: hookName,
                        trackName: pluginName,
                        processName: PLUGIN_PROCESS_NAME,
                        uuid,
                        args: {
                            compilerName,
                            hookName,
                            pluginName
                        }
                    }), callback(...r);
                });
            };
        case 'sync':
            return (...args)=>{
                let r, uuid = tracer.uuid();
                if (pluginName === traceHookPlugin_PLUGIN_NAME) return fn(...args);
                tracer.startAsync({
                    name: hookName,
                    trackName: pluginName,
                    processName: PLUGIN_PROCESS_NAME,
                    uuid,
                    args: {
                        compilerName,
                        hookName,
                        pluginName
                    }
                });
                try {
                    r = fn(...args);
                } catch (err) {
                    throw tracer.endAsync({
                        name: hookName,
                        trackName: pluginName,
                        processName: PLUGIN_PROCESS_NAME,
                        uuid,
                        args: {
                            hookName,
                            pluginName
                        }
                    }), err;
                }
                return tracer.endAsync({
                    name: hookName,
                    trackName: pluginName,
                    processName: PLUGIN_PROCESS_NAME,
                    uuid,
                    args: {
                        compilerName,
                        hookName,
                        pluginName
                    }
                }), r;
            };
        default:
            return fn;
    }
}, compilerId = 0;
class TraceHookPlugin {
    name = traceHookPlugin_PLUGIN_NAME;
    apply(compiler) {
        let compilerName = compiler.name || (compilerId++).toString();
        for (let hookName of Object.keys(compiler.hooks)){
            let hook = compiler.hooks[hookName];
            hook && hook.intercept(makeInterceptorFor(compilerName, JavaScriptTracer)(hookName));
        }
        compiler.hooks.compilation.tap(traceHookPlugin_PLUGIN_NAME, (compilation, { normalModuleFactory, contextModuleFactory })=>{
            interceptAllHooksFor(compilation, JavaScriptTracer, 'Compilation'), interceptAllHooksFor(normalModuleFactory, JavaScriptTracer, 'Normal Module Factory'), interceptAllHooksFor(contextModuleFactory, JavaScriptTracer, 'Context Module Factory');
        });
    }
}
let CORE_VERSION = "2.0.8", VFILES_BY_COMPILER = new WeakMap();
class VirtualModulesPlugin {
    #staticModules;
    #compiler;
    #store;
    constructor(modules){
        this.#staticModules = modules || null;
    }
    apply(compiler) {
        this.#compiler = compiler, compiler.hooks.afterEnvironment.tap('VirtualModulesPlugin', ()=>{
            let record = VFILES_BY_COMPILER.get(compiler) || {};
            if (this.#staticModules) for (let [filePath, content] of Object.entries(this.#staticModules))record[node_path.resolve(compiler.context, filePath)] = content;
            VFILES_BY_COMPILER.set(compiler, record);
        });
    }
    writeModule(filePath, contents) {
        var compiler, fullPath, time;
        if (!this.#compiler) throw Error('Plugin has not been initialized');
        let store = this.getVirtualFileStore(), fullPath1 = node_path.resolve(this.#compiler.context, filePath);
        store.writeVirtualFileSync(fullPath1, contents), compiler = this.#compiler, fullPath = fullPath1, time = Date.now(), compiler.watchFileSystem instanceof NativeWatchFileSystem ? compiler.watchFileSystem.triggerEvent('change', fullPath) : function(compiler, fullPath, time) {
            if (compiler.watchFileSystem && 'watch' in compiler.watchFileSystem) {
                let watcher = compiler.watchFileSystem.watcher;
                if (!watcher) return;
                let fileWatcher = watcher.fileWatchers.get(fullPath);
                fileWatcher && fileWatcher.watcher.emit('change', time, null);
            }
        }(compiler, fullPath, time);
    }
    getVirtualFileStore() {
        if (this.#store) return this.#store;
        let store = this.#compiler?.__internal__get_virtual_file_store();
        if (!store) throw Error('Virtual file store has not been initialized');
        return this.#store = store, store;
    }
    static __internal__take_virtual_files(compiler) {
        let record = VFILES_BY_COMPILER.get(compiler);
        if (record) return VFILES_BY_COMPILER.delete(compiler), Object.entries(record).map(([path, content])=>({
                path,
                content
            }));
    }
}
function foldWatchDelta(pending, added, removed) {
    for (let path of added)pending.removed.delete(path) || pending.added.add(path);
    for (let path of removed)pending.added.delete(path) || pending.removed.add(path);
}
class Watching {
    watcher;
    pausedWatcher;
    compiler;
    handler;
    callbacks;
    watchOptions;
    lastWatcherStartTime;
    running;
    blocked;
    isBlocked;
    onChange;
    onInvalid;
    invalid;
    startTime;
    #invalidReported;
    #closeCallbacks;
    #initial;
    #closed;
    #collectedChangedFiles;
    #collectedRemovedFiles;
    #pendingWatchDeps;
    suspended;
    constructor(compiler, watchOptions, handler){
        this.callbacks = [], this.invalid = !1, this.#invalidReported = !0, this.blocked = !1, this.isBlocked = ()=>!1, this.onChange = ()=>{}, this.onInvalid = ()=>{}, this.compiler = compiler, this.running = !1, this.#initial = !0, this.#closed = !1, this.watchOptions = watchOptions, this.handler = handler, this.suspended = !1, 'number' != typeof this.watchOptions.aggregateTimeout && (this.watchOptions.aggregateTimeout = 5), void 0 === this.watchOptions.ignored && (this.watchOptions.ignored = /[\\/](?:\.git|node_modules)[\\/]/), process.nextTick(()=>{
            this.#initial && this.#invalidate();
        });
    }
    watch(files, dirs, missing) {
        this.pausedWatcher = void 0, this.watcher = this.compiler.watchFileSystem.watch(files, dirs, missing, this.lastWatcherStartTime, this.watchOptions, (err, fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles)=>{
            if (err) return this.compiler.fileTimestamps = void 0, this.compiler.contextTimestamps = void 0, this.compiler.modifiedFiles = void 0, this.compiler.removedFiles = void 0, this.handler(err);
            this.#invalidate(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles), this.onChange();
        }, (fileName, changeTime)=>{
            this.#invalidReported || (this.#invalidReported = !0, this.compiler.hooks.invalid.call(fileName, changeTime)), this.onInvalid();
        });
    }
    close(callback) {
        if (this.#closeCallbacks) {
            callback && this.#closeCallbacks.push(callback);
            return;
        }
        let finalCallback = (err)=>{
            this.running = !1, this.compiler.running = !1, this.compiler.watching = void 0, this.compiler.watchMode = !1, this.compiler.modifiedFiles = void 0, this.compiler.removedFiles = void 0, this.compiler.fileTimestamps = void 0, this.compiler.contextTimestamps = void 0, ((err)=>{
                this.compiler.hooks.watchClose.call();
                let closeCallbacks = this.#closeCallbacks;
                for (let cb of (this.#closeCallbacks = void 0, closeCallbacks))cb(err);
            })(err);
        };
        this.#closed = !0, this.watcher && (this.watcher.close(), this.watcher = void 0), this.pausedWatcher && (this.pausedWatcher.close(), this.pausedWatcher = void 0), this.compiler.watching = void 0, this.compiler.watchMode = !1, this.#closeCallbacks = [], callback && this.#closeCallbacks.push(callback), this.running ? (this.invalid = !0, this._done = finalCallback) : finalCallback(null);
    }
    invalidate(callback) {
        callback && this.callbacks.push(callback), this.#invalidReported || (this.#invalidReported = !0, this.compiler.hooks.invalid.call(null, Date.now())), this.onChange(), this.#invalidate();
    }
    invalidateWithChangesAndRemovals(changedFiles, removedFiles, callback) {
        callback && this.callbacks.push(callback), this.#invalidReported || (this.#invalidReported = !0, this.compiler.hooks.invalid.call(null, Date.now())), this.onChange(), this.#invalidate(void 0, void 0, changedFiles, removedFiles);
    }
    #invalidate(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
        if (this.#mergeWithCollected(changedFiles, removedFiles), !(this.suspended || this.isBlocked() && (this.blocked = !0))) {
            if (this.running) {
                this.invalid = !0;
                return;
            }
            this.#go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles);
        }
    }
    #go(fileTimeInfoEntries, contextTimeInfoEntries, changedFiles, removedFiles) {
        if (this.#initial = !1, void 0 === this.startTime && (this.startTime = Date.now()), this.running = !0, this.watcher ? (this.pausedWatcher = this.watcher, this.lastWatcherStartTime = Date.now(), this.watcher.pause(), this.watcher = void 0) : this.lastWatcherStartTime || (this.lastWatcherStartTime = Date.now()), fileTimeInfoEntries && contextTimeInfoEntries && changedFiles && removedFiles) this.#mergeWithCollected(changedFiles, removedFiles), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
        else if (this.pausedWatcher) {
            let { changes, removals, fileTimeInfoEntries, contextTimeInfoEntries } = this.pausedWatcher.getInfo();
            this.#mergeWithCollected(changes, removals), this.compiler.fileTimestamps = fileTimeInfoEntries, this.compiler.contextTimestamps = contextTimeInfoEntries;
        }
        this.compiler.modifiedFiles = this.#collectedChangedFiles, this.compiler.removedFiles = this.#collectedRemovedFiles, this.#collectedChangedFiles = void 0, this.#collectedRemovedFiles = void 0, this.invalid = !1, this.#invalidReported = !1, this.compiler.hooks.watchRun.callAsync(this.compiler, (err)=>{
            if (err) return this._done(err);
            let onCompiled = (err, _compilation)=>{
                if (err) return this._done(err);
                if (_compilation.hooks.needAdditionalPass.call()) {
                    _compilation.needAdditionalPass = !0, _compilation.startTime = this.startTime, _compilation.endTime = Date.now();
                    let stats = new Stats(_compilation);
                    this.compiler.hooks.done.callAsync(stats, (err)=>{
                        if (err) return this._done(err, _compilation);
                        this.compiler.hooks.additionalPass.callAsync((err)=>{
                            if (err) return this._done(err, _compilation);
                            this.compiler.compile(onCompiled);
                        });
                    });
                    return;
                }
                this._done(null, this.compiler._lastCompilation);
            };
            this.compiler.compile(onCompiled);
        });
    }
    #accumulateWatchDeps(compilation) {
        let pending = this.#pendingWatchDeps ??= {
            file: {
                added: new Set(),
                removed: new Set()
            },
            context: {
                added: new Set(),
                removed: new Set()
            },
            missing: {
                added: new Set(),
                removed: new Set()
            }
        };
        foldWatchDelta(pending.file, compilation.__internal__addedFileDependencies, compilation.__internal__removedFileDependencies), foldWatchDelta(pending.context, compilation.__internal__addedContextDependencies, compilation.__internal__removedContextDependencies), foldWatchDelta(pending.missing, compilation.__internal__addedMissingDependencies, compilation.__internal__removedMissingDependencies);
    }
    _done(error, compilation) {
        let stats;
        this.running = !1;
        let handleError = (err, cbs)=>{
            for (let cb of (this.compiler.hooks.failed.call(err), this.handler(err, stats), cbs || this.callbacks.splice(0)))cb(err);
        };
        if (error) return handleError(error);
        if (!compilation) throw Error('compilation is required if no error');
        if (stats = new Stats(compilation), this.invalid && !this.suspended && !this.blocked && !(this.isBlocked() && (this.blocked = !0))) {
            compilation && this.#accumulateWatchDeps(compilation), this.#go();
            return;
        }
        let startTime = this.startTime;
        this.startTime = void 0, compilation.startTime = startTime, compilation.endTime = Date.now();
        let cbs = this.callbacks;
        this.callbacks = [], this.compiler.hooks.done.callAsync(stats, (err)=>{
            if (err) return handleError(err, cbs);
            for (let cb of (this.handler(null, stats), process.nextTick(()=>{
                if (!this.#closed) {
                    this.#accumulateWatchDeps(compilation);
                    let pending = this.#pendingWatchDeps;
                    this.#pendingWatchDeps = void 0;
                    let fileDependencies = new Set([
                        ...compilation.fileDependencies
                    ]);
                    fileDependencies.added = pending.file.added, fileDependencies.removed = pending.file.removed;
                    let contextDependencies = new Set([
                        ...compilation.contextDependencies
                    ]);
                    contextDependencies.added = pending.context.added, contextDependencies.removed = pending.context.removed;
                    let missingDependencies = new Set([
                        ...compilation.missingDependencies
                    ]);
                    missingDependencies.added = pending.missing.added, missingDependencies.removed = pending.missing.removed, this.watch(fileDependencies, contextDependencies, missingDependencies);
                }
            }), cbs))cb(null);
            this.compiler.hooks.afterDone.call(stats);
        });
    }
    #mergeWithCollected(changedFiles, removedFiles) {
        if (!this.#collectedChangedFiles || !this.#collectedRemovedFiles) {
            this.#collectedChangedFiles = new Set(changedFiles), this.#collectedRemovedFiles = new Set(removedFiles);
            return;
        }
        if (changedFiles) for (let file of changedFiles)this.#collectedChangedFiles.add(file), this.#collectedRemovedFiles.delete(file);
        if (removedFiles) for (let file of removedFiles)this.#collectedChangedFiles.delete(file), this.#collectedRemovedFiles.add(file);
    }
    suspend() {
        this.suspended = !0;
    }
    resume() {
        this.suspended && (this.suspended = !1, this.#invalidate());
    }
}
let Compiler_require = createRequire(import.meta.url), GET_COMPILER_ID = Symbol('getCompilerId');
class Compiler {
    #instance;
    #initial;
    #compilation;
    #bindingCompilationMap = new WeakMap();
    #compilationParams;
    #builtinPlugins;
    #moduleExecutionResultsMap;
    #nonSkippableRegisters;
    #registers;
    #ruleSet;
    hooks;
    webpack;
    rspack;
    name;
    parentCompilation;
    root;
    outputPath;
    running;
    idle;
    resolverFactory;
    infrastructureLogger;
    watching;
    inputFileSystem;
    intermediateFileSystem;
    outputFileSystem;
    watchFileSystem;
    records;
    modifiedFiles;
    removedFiles;
    fileTimestamps;
    contextTimestamps;
    fsStartTime;
    watchMode;
    context;
    cache;
    compilerPath;
    #platform;
    #target;
    options;
    #rawOptions;
    unsafeFastDrop = !1;
    __internal_browser_require;
    constructor(context, options){
        this.#initial = !0, this.#builtinPlugins = [], this.#nonSkippableRegisters = [], this.#moduleExecutionResultsMap = new Map(), this.#ruleSet = new RuleSetCompiler(), this.hooks = {
            initialize: new SyncHook([]),
            shouldEmit: new SyncBailHook([
                'compilation'
            ]),
            done: new AsyncSeriesHook([
                'stats'
            ]),
            afterDone: new SyncHook([
                'stats'
            ]),
            beforeRun: new AsyncSeriesHook([
                'compiler'
            ]),
            run: new AsyncSeriesHook([
                'compiler'
            ]),
            emit: new AsyncSeriesHook([
                'compilation'
            ]),
            assetEmitted: new AsyncSeriesHook([
                'file',
                'info'
            ]),
            afterEmit: new AsyncSeriesHook([
                'compilation'
            ]),
            thisCompilation: new SyncHook([
                'compilation',
                'params'
            ]),
            compilation: new SyncHook([
                'compilation',
                'params'
            ]),
            invalid: new SyncHook([
                'filename',
                'changeTime'
            ]),
            compile: new SyncHook([
                'params'
            ]),
            infrastructureLog: new SyncBailHook([
                'origin',
                'type',
                'args'
            ]),
            failed: new SyncHook([
                'error'
            ]),
            shutdown: new AsyncSeriesHook([]),
            normalModuleFactory: new SyncHook([
                'normalModuleFactory'
            ]),
            contextModuleFactory: new SyncHook([
                'contextModuleFactory'
            ]),
            watchRun: new AsyncSeriesHook([
                'compiler'
            ]),
            watchClose: new SyncHook([]),
            environment: new SyncHook([]),
            afterEnvironment: new SyncHook([]),
            afterPlugins: new SyncHook([
                'compiler'
            ]),
            afterResolvers: new SyncHook([
                'compiler'
            ]),
            make: new AsyncParallelHook([
                'compilation'
            ]),
            beforeCompile: new AsyncSeriesHook([
                'params'
            ]),
            afterCompile: new AsyncSeriesHook([
                'compilation'
            ]),
            finishMake: new AsyncSeriesHook([
                'compilation'
            ]),
            entryOption: new SyncBailHook([
                'context',
                'entry'
            ]),
            additionalPass: new AsyncSeriesHook([])
        };
        let availableCompilerHooks = Object.keys(this.hooks);
        this.hooks = new Proxy(this.hooks, {
            get (target, prop, receiver) {
                let value = Reflect.get(target, prop, receiver);
                if (void 0 === value && 'string' == typeof prop) {
                    let hooksList = availableCompilerHooks.join(', ');
                    throw Error(`Compiler.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compiler hooks: ${hooksList}`);
                }
                return value;
            }
        });
        let compilerRspack = Object.assign(function(...params) {
            return rspack_rspack(...params);
        }, exports_namespaceObject, {
            RuntimeGlobals: createCompilerRuntimeGlobals(options)
        });
        compilerRspack.rspack = compilerRspack, compilerRspack.webpack = compilerRspack, this.webpack = compilerRspack, this.rspack = compilerRspack, this.root = this, this.outputPath = '', this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache(), this.compilerPath = '', this.running = !1, this.idle = !1, this.watchMode = !1, this.#platform = {
            web: null,
            browser: null,
            webworker: null,
            node: null,
            nwjs: null,
            electron: null
        }, this.#target = {}, this.__internal_browser_require = ()=>{
            throw Error('Cannot execute user defined code in browser without `BrowserRequirePlugin`');
        }, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), 'on' === JavaScriptTracer.state && new TraceHookPlugin().apply(this), Object.defineProperty(this, GET_COMPILER_ID, {
            writable: !1,
            configurable: !1,
            enumerable: !1,
            value: ()=>this.#instance.getCompilerId()
        });
    }
    get recordsInputPath() {
        return unsupported('Compiler.recordsInputPath');
    }
    get recordsOutputPath() {
        return unsupported('Compiler.recordsOutputPath');
    }
    get managedPaths() {
        return unsupported('Compiler.managedPaths');
    }
    get immutablePaths() {
        return unsupported('Compiler.immutablePaths');
    }
    get _lastCompilation() {
        return this.#compilation;
    }
    get platform() {
        return this.#platform;
    }
    set platform(platform) {
        this.#platform = platform;
    }
    get target() {
        return this.#target;
    }
    set target(target) {
        this.#target = target;
    }
    get __internal__builtinPlugins() {
        return this.#builtinPlugins;
    }
    get __internal__ruleSet() {
        return this.#ruleSet;
    }
    getCache(name) {
        return new lib_CacheFacade(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
    }
    getInfrastructureLogger(name) {
        if (!name) throw TypeError('Compiler.getInfrastructureLogger(name) called without a name');
        let normalizedName = name;
        return new Logger((type, args)=>{
            if ('function' == typeof normalizedName) {
                if (!(normalizedName = normalizedName())) throw TypeError('Compiler.getInfrastructureLogger(name) called with a function not returning a name');
            } else void 0 === this.hooks.infrastructureLog.call(normalizedName, type, args) && void 0 !== this.infrastructureLogger && this.infrastructureLogger(normalizedName, type, args);
        }, (childName)=>{
            let normalizedChildName = childName;
            return 'function' == typeof normalizedName ? 'function' == typeof normalizedChildName ? this.getInfrastructureLogger(()=>{
                if ('function' == typeof normalizedName && !(normalizedName = normalizedName())) throw TypeError('Compiler.getInfrastructureLogger(name) called with a function not returning a name');
                if ('function' == typeof normalizedChildName && !(normalizedChildName = normalizedChildName())) throw TypeError('Logger.getChildLogger(name) called with a function not returning a name');
                return `${normalizedName}/${normalizedChildName}`;
            }) : this.getInfrastructureLogger(()=>{
                if ('function' == typeof normalizedName && !(normalizedName = normalizedName())) throw TypeError('Compiler.getInfrastructureLogger(name) called with a function not returning a name');
                return `${normalizedName}/${normalizedChildName}`;
            }) : 'function' == typeof normalizedChildName ? this.getInfrastructureLogger(()=>{
                if ('function' == typeof normalizedChildName && !(normalizedChildName = normalizedChildName())) throw TypeError('Logger.getChildLogger(name) called with a function not returning a name');
                return `${normalizedName}/${normalizedChildName}`;
            }) : this.getInfrastructureLogger(`${normalizedName}/${normalizedChildName}`);
        });
    }
    watch(watchOptions, handler) {
        return this.running ? handler(new ConcurrentCompilationError()) : (this.running = !0, this.watchMode = !0, this.watching = new Watching(this, watchOptions, handler), this.watching);
    }
    run(callback, options = {}) {
        if (this.running) return callback(new ConcurrentCompilationError());
        this.modifiedFiles = options.modifiedFiles, this.removedFiles = options.removedFiles;
        let startTime = Date.now();
        this.running = !0;
        let finalCallback = (err, stats)=>{
            this.idle = !0, this.cache.beginIdle(), this.idle = !0, this.running = !1, err && this.hooks.failed.call(err), callback && callback(err, stats), this.hooks.afterDone.call(stats);
        }, onCompiled = (err, _compilation)=>{
            if (err) return finalCallback(err);
            if (_compilation.hooks.needAdditionalPass.call()) {
                _compilation.needAdditionalPass = !0, _compilation.startTime = startTime, _compilation.endTime = Date.now();
                let stats = new Stats(_compilation);
                this.hooks.done.callAsync(stats, (err)=>{
                    if (err) return finalCallback(err);
                    this.hooks.additionalPass.callAsync((err)=>{
                        if (err) return finalCallback(err);
                        this.compile(onCompiled);
                    });
                });
                return;
            }
            _compilation.startTime = startTime, _compilation.endTime = Date.now();
            let stats = new Stats(_compilation);
            this.hooks.done.callAsync(stats, (err)=>err ? finalCallback(err) : finalCallback(null, stats));
        }, run = ()=>{
            this.hooks.beforeRun.callAsync(this, (err)=>{
                if (err) return finalCallback(err);
                this.hooks.run.callAsync(this, (err)=>{
                    if (err) return finalCallback(err);
                    this.compile(onCompiled);
                });
            });
        };
        this.idle ? this.cache.endIdle((err)=>{
            if (err) return callback(err);
            this.idle = !1, run();
        }) : run();
    }
    runAsChild(callback) {
        let finalCallback = (err, entries, compilation)=>{
            try {
                callback(err, entries, compilation);
            } catch (e) {
                let err = Error(`compiler.runAsChild callback error: ${e}`);
                this.parentCompilation.errors.push(err);
            }
        };
        this.compile((err, compilation)=>{
            if (err) return finalCallback(err);
            for (let { name, source, info } of (assertNotNill(compilation), this.parentCompilation.children.push(compilation), compilation.getAssets()))source && this.parentCompilation.emitAsset(name, source, info);
            let entries = [];
            for (let ep of compilation.entrypoints.values())entries.push(...ep.chunks);
            return finalCallback(null, entries, compilation);
        });
    }
    purgeInputFileSystem() {
        this.inputFileSystem?.purge?.();
    }
    createChildCompiler(compilation, compilerName, compilerIndex, outputOptions, plugins) {
        let options = {
            ...this.options,
            output: {
                ...this.options.output,
                ...outputOptions
            }
        };
        applyRspackOptionsDefaults(options);
        let childCompiler = new Compiler(this.context, options);
        childCompiler.name = compilerName, childCompiler.outputPath = this.outputPath, childCompiler.inputFileSystem = this.inputFileSystem, childCompiler.outputFileSystem = null, childCompiler.modifiedFiles = this.modifiedFiles, childCompiler.removedFiles = this.removedFiles, childCompiler.fileTimestamps = this.fileTimestamps, childCompiler.contextTimestamps = this.contextTimestamps, childCompiler.fsStartTime = this.fsStartTime, childCompiler.cache = this.cache, childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
        let relativeCompilerName = makePathsRelative(this.context, compilerName, this.root);
        if (this.records[relativeCompilerName] || (this.records[relativeCompilerName] = []), this.records[relativeCompilerName][compilerIndex] ? childCompiler.records = this.records[relativeCompilerName][compilerIndex] : this.records[relativeCompilerName].push(childCompiler.records = {}), childCompiler.parentCompilation = compilation, childCompiler.root = this.root, Array.isArray(plugins)) for (let plugin of plugins)plugin && plugin.apply(childCompiler);
        for(let hookName in childCompiler.#builtinPlugins = [
            ...childCompiler.#builtinPlugins,
            ...this.#builtinPlugins.filter((plugin)=>!0 === plugin.canInherentFromParent)
        ], this.hooks)canInherentFromParent(hookName) && childCompiler.hooks[hookName] && (childCompiler.hooks[hookName].taps = this.hooks[hookName].taps.slice());
        return compilation.hooks.childCompiler.call(childCompiler, compilerName, compilerIndex), childCompiler;
    }
    isChild() {
        return this.root !== this;
    }
    compile(callback) {
        let startTime = Date.now(), params = this.#newCompilationParams();
        this.hooks.beforeCompile.callAsync(params, (err)=>{
            if (err) return callback(err);
            this.hooks.compile.call(params), this.#resetThisCompilation(), this.#build((err)=>{
                if (err) return callback(err);
                this.#compilation.startTime = startTime, this.#compilation.endTime = Date.now(), this.hooks.afterCompile.callAsync(this.#compilation, (err)=>err ? callback(err) : callback(null, this.#compilation));
            });
        });
    }
    close(callback) {
        this.watching ? this.watching.close(()=>{
            this.close(callback);
        }) : this.hooks.shutdown.callAsync((err)=>{
            if (err) return callback(err);
            this.cache.shutdown(()=>{
                let closePromise = this.#instance?.close();
                closePromise ? closePromise.then(()=>callback(), callback) : callback();
            });
        });
    }
    #build(callback) {
        this.#getInstance((error, instance)=>error ? callback(error) : this.#initial ? void (this.#initial = !1, instance.build(callback)) : void instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), callback));
    }
    __internal__rebuild(modifiedFiles, removedFiles, callback) {
        this.#getInstance((error, instance)=>{
            if (error) return callback?.(error);
            instance.rebuild(Array.from(modifiedFiles || []), Array.from(removedFiles || []), (error)=>{
                if (error) return callback?.(error);
                callback?.(null);
            });
        });
    }
    __internal__create_compilation(native) {
        let compilation = this.#bindingCompilationMap.get(native);
        return compilation || ((compilation = new Compilation(this, native)).name = this.name, this.#bindingCompilationMap.set(native, compilation)), this.#compilation = compilation, compilation;
    }
    __internal__get_virtual_file_store() {
        return this.#instance?.getVirtualFileStore();
    }
    #resetThisCompilation() {
        this.#compilation = void 0, this.hooks.thisCompilation.intercept({
            call: ()=>{}
        });
    }
    #newCompilationParams() {
        let normalModuleFactory = new NormalModuleFactory(this.resolverFactory);
        this.hooks.normalModuleFactory.call(normalModuleFactory);
        let contextModuleFactory = new ContextModuleFactory();
        this.hooks.contextModuleFactory.call(contextModuleFactory);
        let params = {
            normalModuleFactory,
            contextModuleFactory
        };
        return this.#compilationParams = params, params;
    }
    #getInstance(callback) {
        var output;
        let coreVersion, expectedCoreVersion, statsOptions, mode, experiments, error = CORE_VERSION === binding_default().EXPECTED_RSPACK_CORE_VERSION || CORE_VERSION.includes('canary') ? null : Error((coreVersion = CORE_VERSION, expectedCoreVersion = binding_default().EXPECTED_RSPACK_CORE_VERSION, process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.

Help:
	Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
	The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
` : `Unmatched version @rspack/core@${coreVersion} and @rspack/binding@${expectedCoreVersion}.

Help:
	Please ensure the version of @rspack/binding and @rspack/core is the same.
	The expected version of @rspack/core to the current binding is ${expectedCoreVersion}.
`));
        if (error) return callback(error);
        if (this.#instance) return callback(null, this.#instance);
        let { options } = this;
        this.#rawOptions = (mode = options.mode, experiments = options.experiments, {
            name: options.name,
            mode,
            context: options.context,
            output: {
                ...output = options.output,
                environment: function(environment = {}) {
                    return {
                        const: !!environment.const,
                        computedProperty: !!environment.computedProperty,
                        methodShorthand: !!environment.methodShorthand,
                        arrowFunction: !!environment.arrowFunction,
                        nodePrefixForCoreModules: !!environment.nodePrefixForCoreModules,
                        asyncFunction: !!environment.asyncFunction,
                        bigIntLiteral: !!environment.bigIntLiteral,
                        destructuring: !!environment.destructuring,
                        document: !!environment.document,
                        dynamicImport: !!environment.dynamicImport,
                        dynamicImportInWorker: !!environment.dynamicImportInWorker,
                        forOf: !!environment.forOf,
                        globalThis: !!environment.globalThis,
                        module: !!environment.module,
                        optionalChaining: !!environment.optionalChaining,
                        templateLiteral: !!environment.templateLiteral,
                        importMetaDirnameAndFilename: !!environment.importMetaDirnameAndFilename
                    };
                }(output.environment)
            },
            resolve: getRawResolve(options.resolve),
            resolveLoader: getRawResolve(options.resolveLoader),
            module: function(module, options) {
                if (isNil(module.defaultRules)) throw Error('module.defaultRules should not be nil after defaults');
                return {
                    rules: [
                        {
                            rules: module.defaultRules
                        },
                        {
                            rules: module.rules
                        }
                    ].map((rule, index)=>getRawModuleRule(rule, `ruleSet[${index}]`, options, "javascript/auto")),
                    parser: Object.fromEntries(Object.entries(module.parser).map(([k, v])=>[
                            k,
                            getRawParserOptions(v, k)
                        ]).filter(([_, v])=>void 0 !== v)),
                    generator: Object.fromEntries(Object.entries(module.generator).map(([k, v])=>[
                            k,
                            getRawGeneratorOptions(v, k)
                        ]).filter(([_, v])=>void 0 !== v)),
                    noParse: module.noParse
                };
            }(options.module, {
                compiler: this,
                mode,
                context: options.context,
                experiments
            }),
            optimization: options.optimization,
            stats: {
                colors: void 0 === (statsOptions = function(options) {
                    if ('boolean' == typeof options || 'string' == typeof options) return presetToOptions(options);
                    if (!options) return {};
                    let obj = {
                        ...presetToOptions(options.preset),
                        ...options
                    };
                    return delete obj.preset, obj;
                }(options.stats)).colors ? isStatsColorSupported() : !!statsOptions.colors
            },
            cache: options.cache || !1,
            experiments,
            incremental: options.incremental,
            node: function(node) {
                if (!1 !== node) {
                    if (isNil(node.__dirname) || isNil(node.global) || isNil(node.__filename)) throw Error('node.__dirname, node.global, node.__filename should not be nil');
                    return {
                        dirname: String(node.__dirname),
                        filename: String(node.__filename),
                        global: String(node.global)
                    };
                }
            }(options.node),
            amd: options.amd ? JSON.stringify(options.amd || {}) : void 0,
            bail: options.bail,
            __references: {}
        }), this.#rawOptions.__references = Object.fromEntries(this.#ruleSet.builtinReferences.entries()), this.#rawOptions.__virtual_files = VirtualModulesPlugin.__internal__take_virtual_files(this);
        let instanceBinding = Compiler_require(process.env.RSPACK_BINDING ? process.env.RSPACK_BINDING : '@rspack/binding');
        this.#registers = this.#createHooksRegisters();
        let inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
        try {
            this.#instance = new instanceBinding.JsCompiler(this.compilerPath, this.#rawOptions, this.#builtinPlugins, this.#registers, ThreadsafeOutputNodeFS.__to_binding(this.outputFileSystem), this.intermediateFileSystem ? ThreadsafeIntermediateNodeFS.__to_binding(this.intermediateFileSystem) : void 0, inputFileSystem, ResolverFactory.__to_binding(this.resolverFactory), this.unsafeFastDrop, this.#platform), callback(null, this.#instance);
        } catch (err) {
            err instanceof Error && delete err.stack, callback(Error('Failed to create Rspack compiler instance, check the Rspack configuration.', {
                cause: err
            }));
        }
    }
    #createHooksRegisters() {
        let getOptions, ref = new WeakRef(this), getCompiler = ()=>ref.deref(), createTap = this.#createHookRegisterTaps.bind(this), createMapTap = this.#createHookMapRegisterTaps.bind(this);
        return {
            ...{
                registerCompilerThisCompilationTaps: createTap(binding_default().RegisterJsTapKind.CompilerThisCompilation, function() {
                    return getCompiler().hooks.thisCompilation;
                }, function(queried) {
                    return function(native) {
                        return getCompiler().__internal__create_compilation(native), queried.call(getCompiler().__internal__get_compilation(), getCompiler().__internal__get_compilation_params());
                    };
                }),
                registerCompilerCompilationTaps: createTap(binding_default().RegisterJsTapKind.CompilerCompilation, function() {
                    return getCompiler().hooks.compilation;
                }, function(queried) {
                    return function() {
                        return queried.call(getCompiler().__internal__get_compilation(), getCompiler().__internal__get_compilation_params());
                    };
                }),
                registerCompilerMakeTaps: createTap(binding_default().RegisterJsTapKind.CompilerMake, function() {
                    return getCompiler().hooks.make;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation());
                    };
                }),
                registerCompilerFinishMakeTaps: createTap(binding_default().RegisterJsTapKind.CompilerFinishMake, function() {
                    return getCompiler().hooks.finishMake;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation());
                    };
                }),
                registerCompilerShouldEmitTaps: createTap(binding_default().RegisterJsTapKind.CompilerShouldEmit, function() {
                    return getCompiler().hooks.shouldEmit;
                }, function(queried) {
                    return function() {
                        return queried.call(getCompiler().__internal__get_compilation());
                    };
                }),
                registerCompilerEmitTaps: createTap(binding_default().RegisterJsTapKind.CompilerEmit, function() {
                    return getCompiler().hooks.emit;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation());
                    };
                }),
                registerCompilerAfterEmitTaps: createTap(binding_default().RegisterJsTapKind.CompilerAfterEmit, function() {
                    return getCompiler().hooks.afterEmit;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation());
                    };
                }),
                registerCompilerAssetEmittedTaps: createTap(binding_default().RegisterJsTapKind.CompilerAssetEmitted, function() {
                    return getCompiler().hooks.assetEmitted;
                }, function(queried) {
                    return async function({ filename, targetPath, outputPath }) {
                        return queried.promise(filename, {
                            compilation: getCompiler().__internal__get_compilation(),
                            targetPath,
                            outputPath,
                            get source () {
                                let source = getCompiler().__internal__get_compilation().getAsset(filename)?.source;
                                if (!source) throw Error(`Asset ${filename} not found`);
                                return source;
                            },
                            get content () {
                                return this.source?.buffer();
                            }
                        });
                    };
                })
            },
            ...{
                registerCompilationAdditionalTreeRuntimeRequirementsTaps: createTap(binding_default().RegisterJsTapKind.CompilationAdditionalTreeRuntimeRequirements, function() {
                    return getCompiler().__internal__get_compilation().hooks.additionalTreeRuntimeRequirements;
                }, function(queried) {
                    return function({ chunk, runtimeRequirements }) {
                        let set = __from_binding_runtime_globals(runtimeRequirements, getCompiler().rspack.RuntimeGlobals);
                        return queried.call(chunk, set), {
                            runtimeRequirements: __to_binding_runtime_globals(set, getCompiler().rspack.RuntimeGlobals)
                        };
                    };
                }),
                registerCompilationRuntimeRequirementInTreeTaps: createMapTap(binding_default().RegisterJsTapKind.CompilationRuntimeRequirementInTree, function() {
                    return getCompiler().__internal__get_compilation().hooks.runtimeRequirementInTree;
                }, function(queried) {
                    return function({ chunk, allRuntimeRequirements, runtimeRequirements }) {
                        let set = __from_binding_runtime_globals(runtimeRequirements, getCompiler().rspack.RuntimeGlobals), all = __from_binding_runtime_globals(allRuntimeRequirements, getCompiler().rspack.RuntimeGlobals), customRuntimeGlobals = new Set(), originalAdd = all.add.bind(all), add = function(r) {
                            return all.has(r) ? all : (Object.values(getCompiler().rspack.RuntimeGlobals).includes(r) || customRuntimeGlobals.add(r), originalAdd(r));
                        };
                        for (let r of (all.add = add.bind(add), set))queried.for(r).call(chunk, all);
                        for (let r of customRuntimeGlobals)queried.for(r).call(chunk, all);
                        return {
                            allRuntimeRequirements: __to_binding_runtime_globals(all, getCompiler().rspack.RuntimeGlobals)
                        };
                    };
                }),
                registerCompilationRuntimeModuleTaps: createTap(binding_default().RegisterJsTapKind.CompilationRuntimeModule, function() {
                    return getCompiler().__internal__get_compilation().hooks.runtimeModule;
                }, function(queried) {
                    return function({ module, chunk }) {
                        let runtimeModule = new ({
                            [module.constructorName]: class extends RuntimeModule {
                                _source;
                                constructor(){
                                    super(module.name, module.stage), this._source = module.source;
                                }
                                get source() {
                                    return this._source;
                                }
                                identifier() {
                                    return module.moduleIdentifier;
                                }
                                readableIdentifier() {
                                    return module.moduleIdentifier;
                                }
                                shouldIsolate() {
                                    return module.isolate;
                                }
                                generate() {
                                    return this._source?.source.toString('utf-8') || '';
                                }
                            }
                        })[module.constructorName](), compilation = getCompiler().__internal__get_compilation();
                        runtimeModule.attach(compilation, chunk, compilation.chunkGraph);
                        let originSource = module.source?.source;
                        queried.call(runtimeModule, chunk);
                        let newSource = module.source?.source;
                        if (newSource && newSource !== originSource) return module;
                    };
                }),
                registerCompilationBuildModuleTaps: createTap(binding_default().RegisterJsTapKind.CompilationBuildModule, function() {
                    return getCompiler().__internal__get_compilation().hooks.buildModule;
                }, function(queried) {
                    return function(module) {
                        return queried.call(module);
                    };
                }),
                registerCompilationStillValidModuleTaps: createTap(binding_default().RegisterJsTapKind.CompilationStillValidModule, function() {
                    return getCompiler().__internal__get_compilation().hooks.stillValidModule;
                }, function(queried) {
                    return function(module) {
                        return queried.call(module);
                    };
                }),
                registerCompilationSucceedModuleTaps: createTap(binding_default().RegisterJsTapKind.CompilationSucceedModule, function() {
                    return getCompiler().__internal__get_compilation().hooks.succeedModule;
                }, function(queried) {
                    return function(module) {
                        return queried.call(module);
                    };
                }),
                registerCompilationExecuteModuleTaps: createTap(binding_default().RegisterJsTapKind.CompilationExecuteModule, function() {
                    return getCompiler().__internal__get_compilation().hooks.executeModule;
                }, function(queried) {
                    return function({ entry, id, codegenResults, runtimeModules }) {
                        try {
                            let RuntimeGlobals = getCompiler().rspack.RuntimeGlobals, moduleRequireFn = (id)=>{
                                let cached = moduleCache[id];
                                if (void 0 !== cached) {
                                    if (cached.error) throw cached.error;
                                    return cached.exports;
                                }
                                let execOptions = {
                                    id,
                                    module: {
                                        id,
                                        exports: {},
                                        loaded: !1,
                                        error: void 0
                                    },
                                    require: moduleRequireFn
                                };
                                for (let handler of interceptModuleExecution)handler(execOptions);
                                let result = codegenResults.map[id]['build time'], moduleObject = execOptions.module;
                                return id && (moduleCache[id] = moduleObject), ((fn, hook)=>{
                                    try {
                                        fn();
                                    } catch (err) {
                                        if (err instanceof lib_WebpackError) throw err;
                                        throw new HookWebpackError(err, hook);
                                    }
                                })(()=>queried.call({
                                        codeGenerationResult: new CodeGenerationResult(result),
                                        moduleObject
                                    }, {
                                        [RuntimeGlobals.require]: moduleRequireFn
                                    }), 'Compilation.hooks.executeModule'), moduleObject.loaded = !0, moduleObject.exports;
                            }, moduleCache = moduleRequireFn[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, '')] = {}, interceptModuleExecution = moduleRequireFn[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, '')] = [];
                            for (let runtimeModule of runtimeModules)moduleRequireFn(runtimeModule);
                            let executeResult = moduleRequireFn(entry);
                            getCompiler().__internal__get_module_execution_results_map().set(id, executeResult);
                        } catch (e) {
                            throw getCompiler().__internal__get_module_execution_results_map().set(id, e), e;
                        }
                    };
                }),
                registerCompilationFinishModulesTaps: createTap(binding_default().RegisterJsTapKind.CompilationFinishModules, function() {
                    return getCompiler().__internal__get_compilation().hooks.finishModules;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation().modules);
                    };
                }),
                registerCompilationOptimizeModulesTaps: createTap(binding_default().RegisterJsTapKind.CompilationOptimizeModules, function() {
                    return getCompiler().__internal__get_compilation().hooks.optimizeModules;
                }, function(queried) {
                    return function() {
                        return queried.call(getCompiler().__internal__get_compilation().modules.values());
                    };
                }),
                registerCompilationAfterOptimizeModulesTaps: createTap(binding_default().RegisterJsTapKind.CompilationAfterOptimizeModules, function() {
                    return getCompiler().__internal__get_compilation().hooks.afterOptimizeModules;
                }, function(queried) {
                    return function() {
                        queried.call(getCompiler().__internal__get_compilation().modules.values());
                    };
                }),
                registerCompilationOptimizeTreeTaps: createTap(binding_default().RegisterJsTapKind.CompilationOptimizeTree, function() {
                    return getCompiler().__internal__get_compilation().hooks.optimizeTree;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
                    };
                }),
                registerCompilationOptimizeChunkModulesTaps: createTap(binding_default().RegisterJsTapKind.CompilationOptimizeChunkModules, function() {
                    return getCompiler().__internal__get_compilation().hooks.optimizeChunkModules;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
                    };
                }),
                registerCompilationBeforeModuleIdsTaps: createTap(binding_default().RegisterJsTapKind.CompilationBeforeModuleIds, function() {
                    return getCompiler().__internal__get_compilation().hooks.beforeModuleIds;
                }, function(queried) {
                    return function(arg) {
                        let compilation = getCompiler().__internal__get_compilation(), assignments = new Map(), modulesByIdentifier = new Map();
                        for (let module of compilation.modules)modulesByIdentifier.set(module.identifier(), module);
                        let proxiedModules = arg.modules.map((m)=>new Proxy(modulesByIdentifier.get(m.identifier), {
                                get (target, prop) {
                                    if ('id' === prop) return assignments.get(m.identifier) ?? null;
                                    if ('identifier' === prop) return m.identifier;
                                    let value = Reflect.get(target, prop);
                                    return 'function' == typeof value ? value.bind(target) : value;
                                },
                                set: (_target, prop, value)=>'id' === prop && ('string' == typeof value || 'number' == typeof value) && (assignments.set(m.identifier, value), !0)
                            }));
                        return queried.call(proxiedModules), {
                            assignments: Object.fromEntries(assignments.entries())
                        };
                    };
                }),
                registerCompilationChunkHashTaps: createTap(binding_default().RegisterJsTapKind.CompilationChunkHash, function() {
                    return getCompiler().__internal__get_compilation().hooks.chunkHash;
                }, function(queried) {
                    return function(chunk) {
                        let digestResult;
                        if (!getCompiler().options.output.hashFunction) throw Error("'output.hashFunction' cannot be undefined");
                        let hash = createHash_createHash(getCompiler().options.output.hashFunction);
                        return queried.call(chunk, hash), 'string' == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
                    };
                }),
                registerCompilationChunkAssetTaps: createTap(binding_default().RegisterJsTapKind.CompilationChunkAsset, function() {
                    return getCompiler().__internal__get_compilation().hooks.chunkAsset;
                }, function(queried) {
                    return function({ chunk, filename }) {
                        return queried.call(chunk, filename);
                    };
                }),
                registerCompilationProcessAssetsTaps: createTap(binding_default().RegisterJsTapKind.CompilationProcessAssets, function() {
                    return getCompiler().__internal__get_compilation().hooks.processAssets;
                }, function(queried) {
                    return async function() {
                        return queried.promise(getCompiler().__internal__get_compilation().assets);
                    };
                }),
                registerCompilationAfterProcessAssetsTaps: createTap(binding_default().RegisterJsTapKind.CompilationAfterProcessAssets, function() {
                    return getCompiler().__internal__get_compilation().hooks.afterProcessAssets;
                }, function(queried) {
                    return function() {
                        return queried.call(getCompiler().__internal__get_compilation().assets);
                    };
                }),
                registerCompilationSealTaps: createTap(binding_default().RegisterJsTapKind.CompilationSeal, function() {
                    return getCompiler().__internal__get_compilation().hooks.seal;
                }, function(queried) {
                    return function() {
                        return queried.call();
                    };
                }),
                registerCompilationAfterSealTaps: createTap(binding_default().RegisterJsTapKind.CompilationAfterSeal, function() {
                    return getCompiler().__internal__get_compilation().hooks.afterSeal;
                }, function(queried) {
                    return async function() {
                        return queried.promise();
                    };
                })
            },
            ...{
                registerNormalModuleFactoryBeforeResolveTaps: createTap(binding_default().RegisterJsTapKind.NormalModuleFactoryBeforeResolve, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.beforeResolve;
                }, function(queried) {
                    return async function(resolveData) {
                        return [
                            await queried.promise(resolveData),
                            resolveData
                        ];
                    };
                }),
                registerNormalModuleFactoryFactorizeTaps: createTap(binding_default().RegisterJsTapKind.NormalModuleFactoryFactorize, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.factorize;
                }, function(queried) {
                    return async function(resolveData) {
                        return await queried.promise(resolveData), resolveData;
                    };
                }),
                registerNormalModuleFactoryResolveTaps: createTap(binding_default().RegisterJsTapKind.NormalModuleFactoryResolve, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.resolve;
                }, function(queried) {
                    return async function(resolveData) {
                        return await queried.promise(resolveData), resolveData;
                    };
                }),
                registerNormalModuleFactoryResolveForSchemeTaps: createMapTap(binding_default().RegisterJsTapKind.NormalModuleFactoryResolveForScheme, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.resolveForScheme;
                }, function(queried) {
                    return async function(args) {
                        return [
                            await queried.for(args.scheme).promise(args.resourceData),
                            args.resourceData
                        ];
                    };
                }),
                registerNormalModuleFactoryAfterResolveTaps: createTap(binding_default().RegisterJsTapKind.NormalModuleFactoryAfterResolve, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.afterResolve;
                }, function(queried) {
                    return async function(resolveData) {
                        return [
                            await queried.promise(resolveData),
                            resolveData
                        ];
                    };
                }),
                registerNormalModuleFactoryCreateModuleTaps: createTap(binding_default().RegisterJsTapKind.NormalModuleFactoryCreateModule, function() {
                    return getCompiler().__internal__get_compilation_params().normalModuleFactory.hooks.createModule;
                }, function(queried) {
                    return async function(args) {
                        let data = {
                            ...args,
                            settings: {}
                        };
                        await queried.promise(data, {});
                    };
                })
            },
            ...{
                registerContextModuleFactoryBeforeResolveTaps: createTap(binding_default().RegisterJsTapKind.ContextModuleFactoryBeforeResolve, function() {
                    return getCompiler().__internal__get_compilation_params().contextModuleFactory.hooks.beforeResolve;
                }, function(queried) {
                    return async function(bindingData) {
                        let data = !!bindingData && ContextModuleFactoryBeforeResolveData.__from_binding(bindingData), result = await queried.promise(data);
                        return !!result && ContextModuleFactoryBeforeResolveData.__to_binding(result);
                    };
                }),
                registerContextModuleFactoryAfterResolveTaps: createTap(binding_default().RegisterJsTapKind.ContextModuleFactoryAfterResolve, function() {
                    return getCompiler().__internal__get_compilation_params().contextModuleFactory.hooks.afterResolve;
                }, function(queried) {
                    return async function(bindingData) {
                        let data = !!bindingData && ContextModuleFactoryAfterResolveData.__from_binding(bindingData), result = await queried.promise(data);
                        return !!result && ContextModuleFactoryAfterResolveData.__to_binding(result);
                    };
                })
            },
            ...{
                registerJavascriptModulesChunkHashTaps: createTap(binding_default().RegisterJsTapKind.JavascriptModulesChunkHash, function() {
                    return JavascriptModulesPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).chunkHash;
                }, function(queried) {
                    return function(chunk) {
                        let digestResult;
                        if (!getCompiler().options.output.hashFunction) throw Error("'output.hashFunction' cannot be undefined");
                        let hash = createHash_createHash(getCompiler().options.output.hashFunction);
                        return queried.call(chunk, hash), 'string' == typeof (digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest()) ? Buffer.from(digestResult) : digestResult;
                    };
                })
            },
            ...(getOptions = (uid)=>((compilation, uid)=>{
                    if (!(compilation instanceof Compilation)) throw TypeError("The 'compilation' argument must be an instance of Compilation");
                    return compilationOptionsMap.get(compilation)?.[uid];
                })(getCompiler().__internal__get_compilation(), uid), {
                registerHtmlPluginBeforeAssetTagGenerationTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginBeforeAssetTagGeneration, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).beforeAssetTagGeneration;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res.uid = uid, res;
                    };
                }),
                registerHtmlPluginAlterAssetTagsTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginAlterAssetTags, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).alterAssetTags;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res.uid = uid, res;
                    };
                }),
                registerHtmlPluginAlterAssetTagGroupsTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginAlterAssetTagGroups, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).alterAssetTagGroups;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res.uid = uid, res;
                    };
                }),
                registerHtmlPluginAfterTemplateExecutionTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginAfterTemplateExecution, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).afterTemplateExecution;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res;
                    };
                }),
                registerHtmlPluginBeforeEmitTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginBeforeEmit, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).beforeEmit;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res.uid = uid, res;
                    };
                }),
                registerHtmlPluginAfterEmitTaps: createTap(binding_default().RegisterJsTapKind.HtmlPluginAfterEmit, function() {
                    return HtmlRspackPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).afterEmit;
                }, function(queried) {
                    return async function(data) {
                        let { compilationId, uid } = data, res = await queried.promise({
                            ...data,
                            plugin: {
                                options: getOptions(uid)
                            }
                        });
                        return res.compilationId = compilationId, res.uid = uid, res;
                    };
                })
            }),
            ...{
                registerRuntimePluginCreateScriptTaps: createTap(binding_default().RegisterJsTapKind.RuntimePluginCreateScript, function() {
                    return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).createScript;
                }, function(queried) {
                    return function(data) {
                        return queried.call(data.code, data.chunk);
                    };
                }),
                registerRuntimePluginCreateLinkTaps: createTap(binding_default().RegisterJsTapKind.RuntimePluginCreateLink, function() {
                    return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).createLink;
                }, function(queried) {
                    return function(data) {
                        return queried.call(data.code, data.chunk);
                    };
                }),
                registerRuntimePluginLinkPreloadTaps: createTap(binding_default().RegisterJsTapKind.RuntimePluginLinkPreload, function() {
                    return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).linkPreload;
                }, function(queried) {
                    return function(data) {
                        return queried.call(data.code, data.chunk);
                    };
                }),
                registerRuntimePluginLinkPrefetchTaps: createTap(binding_default().RegisterJsTapKind.RuntimePluginLinkPrefetch, function() {
                    return RuntimePlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).linkPrefetch;
                }, function(queried) {
                    return function(data) {
                        return queried.call(data.code, data.chunk);
                    };
                })
            },
            ...{
                registerRsdoctorPluginModuleGraphTaps: createTap(binding_namespaceObject.RegisterJsTapKind.RsdoctorPluginModuleGraph, function() {
                    return RsdoctorPluginImpl.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleGraph;
                }, function(queried) {
                    return async function(data) {
                        return queried.promise(data);
                    };
                }),
                registerRsdoctorPluginChunkGraphTaps: createTap(binding_namespaceObject.RegisterJsTapKind.RsdoctorPluginChunkGraph, function() {
                    return RsdoctorPluginImpl.getCompilationHooks(getCompiler().__internal__get_compilation()).chunkGraph;
                }, function(queried) {
                    return async function(data) {
                        return queried.promise(data);
                    };
                }),
                registerRsdoctorPluginModuleIdsTaps: createTap(binding_namespaceObject.RegisterJsTapKind.RsdoctorPluginModuleIds, function() {
                    return RsdoctorPluginImpl.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleIds;
                }, function(queried) {
                    return async function(data) {
                        return queried.promise(data);
                    };
                }),
                registerRsdoctorPluginModuleSourcesTaps: createTap(binding_namespaceObject.RegisterJsTapKind.RsdoctorPluginModuleSources, function() {
                    return RsdoctorPluginImpl.getCompilationHooks(getCompiler().__internal__get_compilation()).moduleSources;
                }, function(queried) {
                    return async function(data) {
                        return queried.promise(data);
                    };
                }),
                registerRsdoctorPluginAssetsTaps: createTap(binding_namespaceObject.RegisterJsTapKind.RsdoctorPluginAssets, function() {
                    return RsdoctorPluginImpl.getCompilationHooks(getCompiler().__internal__get_compilation()).assets;
                }, function(queried) {
                    return async function(data) {
                        return queried.promise(data);
                    };
                })
            }
        };
    }
    #updateNonSkippableRegisters() {
        let kinds = [];
        for (let { getHook, getHookMap, registerKind } of Object.values(this.#registers))(getHook ?? getHookMap)().isUsed() && kinds.push(registerKind);
        this.#nonSkippableRegisters.join() !== kinds.join() && this.#getInstance((_error, instance)=>{
            instance.setNonSkippableRegisters(kinds), this.#nonSkippableRegisters = kinds;
        });
    }
    #decorateJsTaps(jsTaps) {
        if (jsTaps.length > 0) {
            let last = jsTaps[jsTaps.length - 1], old = last.function;
            last.function = (...args)=>{
                let result = old(...args);
                return result && 'function' == typeof result.then ? result.then((r)=>(this.#updateNonSkippableRegisters(), r)) : (this.#updateNonSkippableRegisters(), result);
            };
        }
    }
    #createHookRegisterTaps(registerKind, getHook, createTap) {
        let that = new WeakRef(this), getTaps = (stages)=>{
            let compiler = that.deref(), hook = getHook();
            if (!hook.isUsed()) return [];
            let breakpoints = [
                minStage,
                ...stages,
                maxStage
            ], jsTaps = [];
            for(let i = 0; i < breakpoints.length - 1; i++){
                let from = breakpoints[i], stageRange = [
                    from,
                    breakpoints[i + 1]
                ], queried = hook.queryStageRange(stageRange);
                queried.isUsed() && jsTaps.push({
                    function: createTap(queried),
                    stage: safeStage(from + 1)
                });
            }
            return compiler.#decorateJsTaps(jsTaps), jsTaps;
        };
        return getTaps.registerKind = registerKind, getTaps.getHook = getHook, getTaps;
    }
    #createHookMapRegisterTaps(registerKind, getHookMap, createTap) {
        let that = new WeakRef(this), getTaps = (stages)=>{
            let compiler = that.deref(), map = getHookMap();
            if (!map.isUsed()) return [];
            let breakpoints = [
                minStage,
                ...stages,
                maxStage
            ], jsTaps = [];
            for(let i = 0; i < breakpoints.length - 1; i++){
                let from = breakpoints[i], stageRange = [
                    from,
                    breakpoints[i + 1]
                ], queried = map.queryStageRange(stageRange);
                queried.isUsed() && jsTaps.push({
                    function: createTap(queried),
                    stage: safeStage(from + 1)
                });
            }
            return compiler.#decorateJsTaps(jsTaps), jsTaps;
        };
        return getTaps.registerKind = registerKind, getTaps.getHookMap = getHookMap, getTaps;
    }
    __internal__registerBuiltinPlugin(plugin) {
        this.#builtinPlugins.push(plugin);
    }
    __internal__takeModuleExecutionResult(id) {
        let result = this.#moduleExecutionResultsMap.get(id);
        return this.#moduleExecutionResultsMap.delete(id), result;
    }
    __internal__get_compilation() {
        return this.#compilation;
    }
    __internal__get_compilation_params() {
        return this.#compilationParams;
    }
    __internal__get_module_execution_results_map() {
        return this.#moduleExecutionResultsMap;
    }
}
Object.defineProperty(binding_default().ConcatenatedModule.prototype, 'identifier', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this[binding_default().MODULE_IDENTIFIER_SYMBOL];
    }
}), Object.defineProperty(binding_default().ConcatenatedModule.prototype, 'originalSource', {
    enumerable: !0,
    configurable: !0,
    value () {
        let originalSource = this._originalSource();
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
}), Object.defineProperty(binding_default().ConcatenatedModule.prototype, 'emitFile', {
    enumerable: !0,
    configurable: !0,
    value (filename, source, assetInfo) {
        return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
    }
}), Object.defineProperty(binding_default().ContextModule.prototype, 'identifier', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this[binding_default().MODULE_IDENTIFIER_SYMBOL];
    }
}), Object.defineProperty(binding_default().ContextModule.prototype, 'originalSource', {
    enumerable: !0,
    configurable: !0,
    value () {
        let originalSource = this._originalSource();
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
}), Object.defineProperty(binding_default().ContextModule.prototype, 'emitFile', {
    enumerable: !0,
    configurable: !0,
    value (filename, source, assetInfo) {
        return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
    }
}), Object.defineProperty(binding_default().ExternalModule.prototype, 'identifier', {
    enumerable: !0,
    configurable: !0,
    value () {
        return this[binding_default().MODULE_IDENTIFIER_SYMBOL];
    }
}), Object.defineProperty(binding_default().ExternalModule.prototype, 'originalSource', {
    enumerable: !0,
    configurable: !0,
    value () {
        let originalSource = this._originalSource();
        return originalSource ? SourceAdapter.fromBinding(originalSource) : null;
    }
}), Object.defineProperty(binding_default().ExternalModule.prototype, 'emitFile', {
    enumerable: !0,
    configurable: !0,
    value (filename, source, assetInfo) {
        return this._emitFile(filename, SourceAdapter.toBinding(source), assetInfo);
    }
});
let ModuleGraphConnection = binding_namespaceObject.ModuleGraphConnection;
Object.defineProperties(ModuleGraphConnection, {
    TRANSITIVE_ONLY: {
        value: binding_default().TRANSITIVE_ONLY_SYMBOL,
        enumerable: !0
    },
    CIRCULAR_CONNECTION: {
        value: binding_default().CIRCULAR_CONNECTION_SYMBOL,
        enumerable: !0
    }
});
let asRegExp = (test)=>'string' == typeof test ? RegExp(`^${test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`) : test, matchPart = (str, test)=>!test || (Array.isArray(test) ? test.map(asRegExp).some((regExp)=>regExp.test(str)) : asRegExp(test).test(str)), matchObject = (obj, str)=>!(obj.test && !matchPart(str, obj.test) || obj.include && !matchPart(str, obj.include) || obj.exclude && matchPart(str, obj.exclude)), FlagAllModulesAsUsedPlugin = base_create(binding_namespaceObject.BuiltinPluginName.FlagAllModulesAsUsedPlugin, (explanation)=>({
        explanation
    }));
class DllPlugin {
    options;
    constructor(options){
        this.options = {
            ...options,
            entryOnly: !1 !== options.entryOnly
        };
    }
    apply(compiler) {
        compiler.hooks.entryOption.tap(DllPlugin.name, (context, entry)=>{
            if ('function' == typeof entry) throw Error("DllPlugin doesn't support dynamic entry (function) yet");
            for (let name of Object.keys(entry)){
                let options = {
                    name
                };
                new DllEntryPlugin(context, entry[name].import || [], options).apply(compiler);
            }
            return !0;
        }), new LibManifestPlugin(this.options).apply(compiler), this.options.entryOnly || new FlagAllModulesAsUsedPlugin('DllPlugin').apply(compiler);
    }
}
class DllReferencePlugin {
    options;
    errors;
    constructor(options){
        this.options = options, this.errors = new WeakMap();
    }
    apply(compiler) {
        compiler.hooks.beforeCompile.tapPromise(DllReferencePlugin.name, async (params)=>{
            let manifest = await new Promise((resolve, reject)=>{
                if ('manifest' in this.options) {
                    let manifest = this.options.manifest;
                    'string' == typeof manifest ? compiler.inputFileSystem?.readFile(manifest, 'utf8', (err, result)=>{
                        if (err) return reject(err);
                        if (!result) return reject(new DllManifestError(manifest, `Can't read anything from ${manifest}`));
                        try {
                            let manifest = JSON.parse(result);
                            resolve(manifest);
                        } catch (parseError) {
                            let manifestPath = makePathsRelative(compiler.context, manifest, compiler.root);
                            this.errors.set(params, new DllManifestError(manifestPath, parseError.message));
                        }
                    }) : resolve(manifest);
                } else resolve(void 0);
            });
            this.errors.has(params) || new DllReferenceAgencyPlugin({
                ...this.options,
                type: this.options.type || 'require',
                extensions: this.options.extensions || [
                    '',
                    '.js',
                    '.json',
                    '.wasm'
                ],
                manifest
            }).apply(compiler);
        }), compiler.hooks.compilation.tap(DllReferencePlugin.name, (compilation, params)=>{
            if ('manifest' in this.options && 'string' == typeof this.options.manifest) {
                let error = this.errors.get(params);
                error && compilation.errors.push(error), compilation.fileDependencies.add(this.options.manifest);
            }
        });
    }
}
class DllManifestError extends lib_WebpackError {
    constructor(filename, message){
        super(), this.name = 'DllManifestError', this.message = `Dll manifest ${filename}\n${message}`;
    }
}
class EnvironmentPlugin {
    keys;
    defaultValues;
    constructor(...keys){
        1 === keys.length && Array.isArray(keys[0]) ? (this.keys = keys[0], this.defaultValues = {}) : 1 === keys.length && keys[0] && 'object' == typeof keys[0] ? (this.keys = Object.keys(keys[0]), this.defaultValues = keys[0]) : (this.keys = keys, this.defaultValues = {});
    }
    apply(compiler) {
        let definitions = {};
        for (let key of this.keys){
            let value = void 0 !== process.env[key] ? process.env[key] : this.defaultValues[key];
            void 0 === value && compiler.hooks.thisCompilation.tap('EnvironmentPlugin', (compilation)=>{
                let error = new lib_WebpackError(`EnvironmentPlugin - ${key} environment variable is undefined.\n\nYou can pass an object with default values to suppress this warning.\nSee https://rspack.rs/plugins/webpack/environment-plugin for example.`);
                error.name = 'EnvVariableNotDefinedError', compilation.errors.push(error);
            }), definitions[`process.env.${key}`] = void 0 === value ? 'undefined' : JSON.stringify(value);
        }
        new DefinePlugin(definitions).apply(compiler);
    }
}
class LoaderOptionsPlugin {
    options;
    constructor(options = {}){
        options.test || (options.test = {
            test: ()=>!0
        }), this.options = options;
    }
    apply(compiler) {
        let options = this.options;
        compiler.hooks.compilation.tap('LoaderOptionsPlugin', (compilation)=>{
            binding_namespaceObject.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderOptionsPlugin', (context)=>{
                let resource = context.resourcePath;
                if (resource && matchObject(options, resource)) for (let key of Object.keys(options))'include' !== key && 'exclude' !== key && 'test' !== key && (context[key] = options[key]);
            });
        });
    }
}
class LoaderTargetPlugin {
    target;
    constructor(target){
        this.target = target;
    }
    apply(compiler) {
        compiler.hooks.compilation.tap('LoaderTargetPlugin', (compilation)=>{
            binding_namespaceObject.NormalModule.getCompilationHooks(compilation).loader.tap('LoaderTargetPlugin', (loaderContext)=>{
                loaderContext.target = this.target;
            });
        });
    }
}
let parseOptions = (options, normalizeSimple, normalizeOptions)=>{
    let items = [];
    var fn = (key, value)=>{
        items.push([
            key,
            value
        ]);
    };
    let object = (obj)=>{
        for (let [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
    };
    if (options) if (Array.isArray(options)) for (let item of options)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
    else if (item && 'object' == typeof item) object(item);
    else throw Error('Unexpected options format');
    else if ('object' == typeof options) object(options);
    else throw Error('Unexpected options format');
    return items;
}, compilerSet = new WeakSet();
class ShareRuntimePlugin extends RspackBuiltinPlugin {
    enhanced;
    name = binding_namespaceObject.BuiltinPluginName.ShareRuntimePlugin;
    constructor(enhanced = !1){
        super(), this.enhanced = enhanced;
    }
    raw(compiler) {
        if (!compilerSet.has(compiler)) return compilerSet.add(compiler), createBuiltinPlugin(this.name, this.enhanced);
    }
}
let VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
function isRequiredVersion(str) {
    return VERSION_PATTERN_REGEXP.test(str);
}
let encodeName = function(name, prefix = '', withExt = !1) {
    return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${withExt ? '.js' : ''}`;
};
function normalizeConsumeShareOptions(consumes, shareScope) {
    return parseOptions(consumes, (item, key)=>{
        if (Array.isArray(item)) throw Error('Unexpected array in options');
        return item !== key && isRequiredVersion(item) ? {
            import: key,
            shareScope: shareScope || 'default',
            shareKey: key,
            requiredVersion: item,
            strictVersion: !0,
            packageName: void 0,
            singleton: !1,
            eager: !1,
            treeShakingMode: void 0
        } : {
            import: key,
            shareScope: shareScope || 'default',
            shareKey: key,
            requiredVersion: void 0,
            packageName: void 0,
            strictVersion: !1,
            singleton: !1,
            eager: !1,
            treeShakingMode: void 0
        };
    }, (item, key)=>({
            import: !1 === item.import ? void 0 : item.import || key,
            shareScope: item.shareScope || shareScope || 'default',
            shareKey: item.shareKey || key,
            requiredVersion: item.requiredVersion,
            strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : !1 !== item.import && !item.singleton,
            packageName: item.packageName,
            singleton: !!item.singleton,
            eager: !!item.eager,
            treeShakingMode: item.treeShakingMode
        }));
}
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ConsumeSharedPlugin;
    _options;
    constructor(options){
        super(), this._options = {
            consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
            enhanced: options.enhanced ?? !1
        };
    }
    raw(compiler) {
        new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
        let rawOptions = {
            consumes: this._options.consumes.map(([key, v])=>({
                    key,
                    ...v
                })),
            enhanced: this._options.enhanced
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
class ProvideSharedPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ProvideSharedPlugin;
    _provides;
    _enhanced;
    constructor(options){
        var options1, shareScope, enhanced;
        super(), this._provides = (options1 = options.provides, shareScope = options.shareScope, enhanced = options.enhanced, parseOptions(options1, (item)=>{
            if (Array.isArray(item)) throw Error('Unexpected array of provides');
            return {
                shareKey: item,
                version: void 0,
                shareScope: shareScope || 'default',
                eager: !1
            };
        }, (item)=>{
            let raw = {
                shareKey: item.shareKey,
                version: item.version,
                shareScope: item.shareScope || shareScope || 'default',
                eager: !!item.eager
            };
            return enhanced ? {
                ...raw,
                singleton: item.singleton,
                requiredVersion: item.requiredVersion,
                strictVersion: item.strictVersion,
                treeShakingMode: item.treeShakingMode
            } : raw;
        })), this._enhanced = options.enhanced;
    }
    raw(compiler) {
        new ShareRuntimePlugin(this._enhanced ?? !1).apply(compiler);
        let rawOptions = this._provides.map(([key, v])=>({
                key,
                ...v
            }));
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
function validateShareScope(shareScope, enhanced, pluginName) {
    if (Array.isArray(shareScope) && shareScope.length > 1 && !enhanced) throw Error(`[${pluginName}] shareScope as an array with multiple entries requires enhanced=true, got: ${JSON.stringify(shareScope)}`);
}
function normalizeSharedOptions(shared) {
    return parseOptions(shared, (item, key)=>{
        if ('string' != typeof item) throw Error('Unexpected array in shared');
        return item !== key && isRequiredVersion(item) ? {
            import: key,
            requiredVersion: item
        } : {
            import: item
        };
    }, (item)=>item);
}
function createConsumeShareOptions(normalizedSharedOptions) {
    return normalizedSharedOptions.map(([key, options])=>({
            [key]: {
                import: options.import,
                shareKey: options.shareKey || key,
                shareScope: options.shareScope,
                requiredVersion: options.requiredVersion,
                strictVersion: options.strictVersion,
                singleton: options.singleton,
                packageName: options.packageName,
                eager: options.eager,
                treeShakingMode: options.treeShaking?.mode
            }
        }));
}
class SharePlugin {
    _shareScope;
    _consumes;
    _provides;
    _enhanced;
    _sharedOptions;
    constructor(options){
        let sharedOptions = normalizeSharedOptions(options.shared), consumes = createConsumeShareOptions(sharedOptions), provides = sharedOptions.filter(([, options])=>!1 !== options.import).map(([key, options])=>({
                [options.import || key]: {
                    shareKey: options.shareKey || key,
                    shareScope: options.shareScope,
                    version: options.version,
                    eager: options.eager,
                    singleton: options.singleton,
                    requiredVersion: options.requiredVersion,
                    strictVersion: options.strictVersion,
                    treeShakingMode: options.treeShaking?.mode
                }
            }));
        this._shareScope = options.shareScope, this._consumes = consumes, this._provides = provides, this._enhanced = options.enhanced ?? !1, this._sharedOptions = sharedOptions;
    }
    apply(compiler) {
        new ConsumeSharedPlugin({
            shareScope: this._shareScope,
            consumes: this._consumes,
            enhanced: this._enhanced
        }).apply(compiler), new ProvideSharedPlugin({
            shareScope: this._shareScope,
            provides: this._provides,
            enhanced: this._enhanced
        }).apply(compiler);
    }
}
let MANIFEST_FILE_NAME = 'mf-manifest.json', STATS_FILE_NAME = 'mf-stats.json', JSON_EXT = '.json';
function isPlainObject(value) {
    return !!value && 'object' == typeof value && !Array.isArray(value);
}
function getFileName(manifestOptions) {
    if (!manifestOptions) return {
        statsFileName: '',
        manifestFileName: ''
    };
    if ('boolean' == typeof manifestOptions) return {
        statsFileName: STATS_FILE_NAME,
        manifestFileName: MANIFEST_FILE_NAME
    };
    let filePath = 'boolean' == typeof manifestOptions ? '' : manifestOptions.filePath || '', fileName = 'boolean' == typeof manifestOptions ? '' : manifestOptions.fileName || '', manifestFileName = fileName ? fileName.endsWith(JSON_EXT) ? fileName : `${fileName}${JSON_EXT}` : MANIFEST_FILE_NAME;
    return {
        statsFileName: join(filePath, fileName ? manifestFileName.replace(JSON_EXT, `-stats${JSON_EXT}`) : STATS_FILE_NAME),
        manifestFileName: join(filePath, manifestFileName)
    };
}
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ModuleFederationManifestPlugin;
    rawOpts;
    constructor(opts){
        super(), this.rawOpts = opts;
    }
    raw(compiler) {
        var mfConfig, isDev, mfConfig1;
        let manifestOptions, containerName, globalName, remoteAliasMap, manifestExposes, manifestShared, pkg, buildVersion, statsBuildInfo, opts = (manifestOptions = !0 === (mfConfig = this.rawOpts).manifest ? {} : {
            ...mfConfig.manifest
        }, containerName = mfConfig.name, globalName = function(library) {
            if (!library) return;
            let libName = library.name;
            if (libName) {
                if ('string' == typeof libName) return libName;
                if (Array.isArray(libName)) return libName[0];
                if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
            }
        }(mfConfig.library) ?? containerName, remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
            if (cur[1].length > 1) return sum;
            let { entry, alias, name } = cur[1][0];
            return entry && name && (sum[alias] = {
                name,
                entry
            }), sum;
        }, {}), manifestExposes = function(exposes) {
            if (!exposes) return;
            let result = parseOptions(exposes, (value)=>({
                    import: Array.isArray(value) ? value : [
                        value
                    ],
                    name: void 0
                }), (value)=>({
                    import: Array.isArray(value.import) ? value.import : [
                        value.import
                    ],
                    name: value.name ?? void 0
                })).map(([exposeKey, info])=>{
                let exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
                return {
                    path: exposeKey,
                    name: exposeName
                };
            });
            return result.length > 0 ? result : void 0;
        }(mfConfig.exposes), void 0 === manifestOptions.exposes && manifestExposes && (manifestOptions.exposes = manifestExposes), manifestShared = function(shared) {
            if (!shared) return;
            let result = parseOptions(shared, (item, key)=>{
                if ('string' != typeof item) throw Error('Unexpected array in shared');
                return item !== key && isRequiredVersion(item) ? {
                    import: key,
                    requiredVersion: item
                } : {
                    import: item
                };
            }, (item)=>item).map(([key, config])=>{
                let name = config.shareKey || key;
                return {
                    name,
                    version: 'string' == typeof config.version ? config.version : void 0,
                    requiredVersion: 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0,
                    singleton: config.singleton
                };
            });
            return result.length > 0 ? result : void 0;
        }(mfConfig.shared), void 0 === manifestOptions.shared && manifestShared && (manifestOptions.shared = manifestShared), {
            ...manifestOptions,
            remoteAliasMap,
            globalName,
            name: containerName
        }), { fileName, filePath, disableAssetsAnalyze, remoteAliasMap: remoteAliasMap1, exposes, shared } = opts, { statsFileName, manifestFileName } = getFileName(opts), rawOptions = {
            name: opts.name,
            globalName: opts.globalName,
            fileName,
            filePath,
            manifestFileName,
            statsFileName,
            disableAssetsAnalyze,
            remoteAliasMap: remoteAliasMap1,
            exposes,
            shared,
            buildInfo: (isDev = 'development' === compiler.options.mode, mfConfig1 = this.rawOpts, pkg = function(root) {
                let pkgPath = join(root ? external_node_path_resolve(root) : process.cwd(), 'package.json');
                try {
                    let content = readFileSync(pkgPath, 'utf-8'), parsed = function(input, guard) {
                        try {
                            let parsed = JSON.parse(input);
                            if (guard(parsed)) return parsed;
                        } catch  {}
                    }(content, isPlainObject);
                    if (parsed) {
                        let filtered = {};
                        for (let [key, value] of Object.entries(parsed))'string' == typeof value && (filtered[key] = value);
                        if (Object.keys(filtered).length > 0) return filtered;
                    }
                } catch  {}
                return {};
            }(compiler.options.context || process.cwd()), buildVersion = isDev ? 'local' : pkg?.version, statsBuildInfo = {
                buildVersion: process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
                buildName: process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
            }, Object.values(normalizeSharedOptions(mfConfig1.shared || {})).some((config)=>config[1].treeShaking) && (statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [], statsBuildInfo.plugins = mfConfig1.treeShakingSharedPlugins || [], statsBuildInfo.excludePlugins = mfConfig1.treeShakingSharedExcludePlugins || []), statsBuildInfo)
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
let SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.CollectSharedEntryPlugin;
    sharedOptions;
    _collectedEntries;
    constructor(options){
        super();
        let { sharedOptions } = options;
        this.sharedOptions = sharedOptions, this._collectedEntries = {};
    }
    getData() {
        return this._collectedEntries;
    }
    getFilename() {
        return SHARE_ENTRY_ASSET;
    }
    apply(compiler) {
        super.apply(compiler);
        let readCollectedEntries = (compilation)=>{
            let asset = compilation.getAsset(SHARE_ENTRY_ASSET);
            asset && (this._collectedEntries = JSON.parse(asset.source.source().toString()), compilation.deleteAsset(asset.name));
        };
        compiler.hooks.finishMake.tap({
            name: 'CollectSharedEntry',
            stage: 101
        }, readCollectedEntries);
    }
    raw() {
        let rawOptions = {
            consumes: normalizeConsumeShareOptions(createConsumeShareOptions(this.sharedOptions)).map(([key, v])=>({
                    key,
                    ...v
                })),
            filename: this.getFilename()
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
function assert(condition, msg) {
    if (!condition) throw Error(msg);
}
class SharedContainerPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.SharedContainerPlugin;
    filename = '';
    _options;
    _shareName;
    _globalName;
    constructor(options){
        super();
        let { shareName, library, request, independentShareFileName, mfName } = options, version = options.version || '0.0.0';
        this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
        let fileName = independentShareFileName || `${version}/share-entry.js`;
        this._shareName = shareName, this._options = {
            name: shareName,
            request: request,
            library: (library ? {
                ...library,
                name: this._globalName
            } : void 0) || {
                type: 'global',
                name: this._globalName
            },
            version,
            fileName
        };
    }
    getData() {
        return [
            this._options.fileName,
            this._globalName,
            this._options.version
        ];
    }
    raw(compiler) {
        let { library } = this._options;
        return compiler.options.output.enabledLibraryTypes.includes(library.type) || compiler.options.output.enabledLibraryTypes.push(library.type), createBuiltinPlugin(this.name, this._options);
    }
    apply(compiler) {
        super.apply(compiler);
        let shareName = this._shareName;
        compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
            compilation.hooks.processAssets.tap({
                name: 'getShareContainerFile'
            }, ()=>{
                assert(compilation.entrypoints.get(shareName), `Can not get shared ${shareName} entryPoint!`);
                let remoteEntryNameChunk = compilation.namedChunks.get(shareName);
                assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
                let files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes('.hot-update') && !f.endsWith('.css'));
                assert(files.length > 0, `no files found for shared ${shareName} chunk`), assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`), this.filename = files[0];
            });
        });
    }
}
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
    sharedOptions;
    injectTreeShakingUsedExports;
    manifestOptions;
    constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
        super(), this.sharedOptions = sharedOptions, this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? !0, this.manifestOptions = manifestOptions ?? {};
    }
    buildOptions() {
        let shared = this.sharedOptions.map(([shareKey, config])=>({
                shareKey,
                treeShaking: !!config.treeShaking,
                usedExports: config.treeShaking?.usedExports
            })), { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
        return {
            shared,
            injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
            manifestFileName,
            statsFileName
        };
    }
    raw() {
        if (this.sharedOptions.length) return createBuiltinPlugin(this.name, this.buildOptions());
    }
}
let VIRTUAL_ENTRY = './virtual-entry.js', VIRTUAL_ENTRY_NAME = 'virtual-entry';
class VirtualEntryPlugin {
    sharedOptions;
    collectShared = !1;
    constructor(sharedOptions, collectShared){
        this.sharedOptions = sharedOptions, this.collectShared = collectShared;
    }
    createEntry() {
        let { sharedOptions, collectShared } = this;
        return sharedOptions.reduce((acc, cur, index)=>acc + `import shared_${index} from '${cur[0]}';\n` + (collectShared ? `console.log(shared_${index});\n` : ''), '');
    }
    static entry() {
        return {
            [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
        };
    }
    apply(compiler) {
        new compiler.rspack.experiments.VirtualModulesPlugin({
            [VIRTUAL_ENTRY]: this.createEntry()
        }).apply(compiler), compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
            compilation.hooks.processAssets.tap({
                name: 'RemoveVirtualEntryAsset',
                stage: compiler.rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
            }, ()=>{
                try {
                    let chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
                    chunk?.files.forEach((f)=>{
                        compilation.deleteAsset(f);
                    });
                } catch (_e) {
                    console.error('Failed to remove virtual entry file!');
                }
            });
        });
    }
}
let resolveOutputDir = (outputDir, shareName)=>shareName ? join(outputDir, encodeName(shareName)) : outputDir, getShareRequests = (shareRequestsMap, shareName)=>Array.from(new Map((shareRequestsMap[shareName]?.requests || []).map(([request, version])=>[
            version,
            [
                request,
                version
            ]
        ])).values());
class IndependentSharedPlugin {
    mfName;
    shared;
    library;
    sharedOptions;
    outputDir;
    plugins;
    treeShaking;
    manifest;
    buildAssets = {};
    injectTreeShakingUsedExports;
    treeShakingSharedExcludePlugins;
    onBuildAssets;
    name = 'IndependentSharedPlugin';
    constructor(options){
        let { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins, onBuildAssets } = options;
        this.shared = shared, this.mfName = name, this.outputDir = outputDir || 'independent-packages', this.plugins = plugins || [], this.treeShaking = treeShaking, this.manifest = manifest, this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? !0, this.library = library, this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [], this.onBuildAssets = onBuildAssets, this.sharedOptions = parseOptions(shared, (item, key)=>{
            if ('string' != typeof item) throw Error(`Unexpected array in shared configuration for key "${key}"`);
            return item !== key && isRequiredVersion(item) ? {
                import: key,
                requiredVersion: item
            } : {
                import: item
            };
        }, (item)=>item);
    }
    apply(compiler) {
        let { manifest } = this, collectSharedEntryPlugin = new CollectSharedEntryPlugin({
            sharedOptions: this.sharedOptions,
            shareScope: 'default'
        });
        collectSharedEntryPlugin.apply(compiler), compiler.hooks.finishMake.tapPromise({
            name: 'IndependentSharedPlugin',
            stage: 102
        }, async ()=>{
            let shareRequestsMap = collectSharedEntryPlugin.getData();
            this.prepareBuildAssets(shareRequestsMap), await this.createIndependentCompilers(compiler, shareRequestsMap), this.onBuildAssets?.(this.buildAssets);
        }), manifest && compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
            compilation.hooks.processAssets.tap({
                name: 'injectBuildAssets',
                stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
            }, ()=>{
                let { statsFileName, manifestFileName } = getFileName(manifest), injectBuildAssetsIntoStatsOrManifest = (filename)=>{
                    let stats = compilation.getAsset(filename);
                    if (!stats) return;
                    let statsContent = JSON.parse(stats.source.source().toString()), { shared } = statsContent;
                    Object.entries(this.buildAssets).forEach(([key, item])=>{
                        let targetShared = shared.find((s)=>s.name === key);
                        targetShared && item.forEach(([entry, version, globalName])=>{
                            version === targetShared.version && (targetShared.fallback = entry, targetShared.fallbackName = globalName);
                        });
                    }), compilation.updateAsset(filename, new compiler.rspack.sources.RawSource(JSON.stringify(statsContent)));
                };
                injectBuildAssetsIntoStatsOrManifest(statsFileName), injectBuildAssetsIntoStatsOrManifest(manifestFileName);
            });
        });
    }
    prepareBuildAssets(shareRequestsMap) {
        let { sharedOptions, outputDir, mfName, treeShaking, library } = this, buildAssets = {};
        sharedOptions.forEach(([shareName, shareConfig])=>{
            if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
            let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
            getShareRequests(shareRequestsMap, shareName).forEach(([request, version])=>{
                let [shareFileName, globalName, sharedVersion] = new SharedContainerPlugin({
                    mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
                    library,
                    shareName,
                    version,
                    request,
                    independentShareFileName: sharedConfig?.treeShaking?.filename
                }).getData();
                'string' == typeof shareFileName && (buildAssets[shareName] ||= [], buildAssets[shareName].push([
                    join(resolveOutputDir(outputDir, shareName), shareFileName),
                    sharedVersion,
                    globalName
                ]));
            });
        }), this.buildAssets = buildAssets;
    }
    async createIndependentCompilers(parentCompiler, shareRequestsMap) {
        let { sharedOptions } = this;
        console.log('Start building shared fallback resources ...'), await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
            if (!shareConfig.treeShaking || !1 === shareConfig.import) return;
            let shareRequests = getShareRequests(shareRequestsMap, shareName);
            await Promise.all(shareRequests.map(async ([request, version])=>{
                let sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
                await this.createIndependentCompiler(parentCompiler, {
                    shareRequestsMap,
                    currentShare: {
                        shareName,
                        version,
                        request,
                        independentShareFileName: sharedConfig?.treeShaking?.filename
                    }
                });
            }));
        })), console.log('All shared fallback have been compiled successfully!');
    }
    async createIndependentCompiler(parentCompiler, extraOptions) {
        let { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this, outputDirWithShareName = resolveOutputDir(outputDir, extraOptions.currentShare.shareName), parentConfig = parentCompiler.options, finalPlugins = [], rspack = parentCompiler.rspack, extraPlugin = new SharedContainerPlugin({
            mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
            library,
            ...extraOptions.currentShare
        });
        (parentConfig.plugins || []).forEach((plugin)=>{
            void 0 !== plugin && 'string' != typeof plugin && ((plugin, excludedPlugins = [])=>{
                if (!plugin) return !0;
                let pluginName = plugin.name || plugin.constructor?.name;
                return !pluginName || ![
                    'TreeShakingSharedPlugin',
                    'IndependentSharedPlugin',
                    'ModuleFederationPlugin',
                    'SharedUsedExportsOptimizerPlugin',
                    'HtmlWebpackPlugin',
                    'HtmlRspackPlugin',
                    'RsbuildHtmlPlugin',
                    ...excludedPlugins
                ].includes(pluginName);
            })(plugin, treeShakingSharedExcludePlugins) && finalPlugins.push(plugin);
        }), plugins.forEach((plugin)=>{
            finalPlugins.push(plugin);
        }), finalPlugins.push(extraPlugin), finalPlugins.push(new ConsumeSharedPlugin({
            consumes: sharedOptions.filter(([key, options])=>extraOptions.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
                    [key]: {
                        import: !1,
                        shareKey: options.shareKey || key,
                        shareScope: options.shareScope,
                        requiredVersion: options.requiredVersion,
                        strictVersion: options.strictVersion,
                        singleton: options.singleton,
                        packageName: options.packageName,
                        eager: options.eager
                    }
                })),
            enhanced: !0
        })), treeShaking && finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports)), finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !1));
        let fullOutputDir = external_node_path_resolve(parentCompiler.outputPath, outputDirWithShareName), compilerConfig = {
            ...parentConfig,
            name: parentConfig.name || 'mf-shared-compiler',
            module: {
                ...parentConfig.module,
                rules: [
                    {
                        test: /virtual-entry\.js$/,
                        type: "javascript/auto",
                        resolve: {
                            fullySpecified: !1
                        },
                        use: {
                            loader: 'builtin:swc-loader'
                        }
                    },
                    ...parentConfig.module?.rules || []
                ]
            },
            mode: parentConfig.mode || 'development',
            entry: VirtualEntryPlugin.entry,
            output: {
                path: fullOutputDir,
                clean: !1,
                publicPath: parentConfig.output?.publicPath || 'auto'
            },
            plugins: finalPlugins,
            optimization: {
                ...parentConfig.optimization,
                splitChunks: !1
            }
        }, compiler = rspack.rspack(compilerConfig);
        compiler.inputFileSystem = parentCompiler.inputFileSystem, compiler.outputFileSystem = parentCompiler.outputFileSystem, compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
        let { currentShare } = extraOptions;
        return new Promise((resolve, reject)=>{
            compiler.run((err, stats)=>{
                if (err || stats?.hasErrors()) {
                    console.error(`${currentShare.shareName} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n')), reject(err || Error(`${currentShare.shareName} Compile failed`));
                    return;
                }
                console.log(`${currentShare.shareName} Compile success`), resolve(extraPlugin.getData());
            });
        });
    }
}
let TreeShakingSharedPlugin_require = createRequire(import.meta.url);
class TreeShakingSharedPlugin {
    mfConfig;
    outputDir;
    secondary;
    onBuildAssets;
    _independentSharePlugin;
    name = 'TreeShakingSharedPlugin';
    constructor(options){
        let { mfConfig, secondary, onBuildAssets } = options;
        this.mfConfig = mfConfig, this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages', this.secondary = !!secondary, this.onBuildAssets = onBuildAssets;
    }
    apply(compiler) {
        let { mfConfig, outputDir, secondary } = this, { name, shared, library, treeShakingSharedPlugins } = mfConfig;
        if (!shared) return;
        let sharedOptions = normalizeSharedOptions(shared);
        sharedOptions.length && sharedOptions.some(([_, config])=>config.treeShaking && !1 !== config.import) && (secondary || new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler), this._independentSharePlugin = new IndependentSharedPlugin({
            name: name,
            shared: shared,
            outputDir,
            plugins: treeShakingSharedPlugins?.map((p)=>new (TreeShakingSharedPlugin_require(p))()) || [],
            treeShaking: secondary,
            library,
            manifest: mfConfig.manifest,
            treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins,
            onBuildAssets: this.onBuildAssets
        }), this._independentSharePlugin.apply(compiler));
    }
    get buildAssets() {
        return this._independentSharePlugin?.buildAssets || {};
    }
}
let ModuleFederationRuntimePlugin = base_create(binding_namespaceObject.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options), ModuleFederationPlugin_require = createRequire(import.meta.url), MF_RUNTIME_LOADER = '@module-federation/runtime/rspack.js';
function getRemoteInfos(options) {
    if (!options.remotes) return {};
    let remoteType = options.remoteType || (options.library ? options.library.type : "script"), remotes = parseOptions(options.remotes, (item)=>({
            external: Array.isArray(item) ? item : [
                item
            ],
            shareScope: options.shareScope ?? 'default'
        }), (item)=>({
            external: Array.isArray(item.external) ? item.external : [
                item.external
            ],
            shareScope: item.shareScope || options.shareScope || 'default'
        })), remoteInfos = {};
    for (let [key, config] of remotes)for (let external of config.external){
        let [externalType, externalRequest] = function(external) {
            let result = function(external) {
                if (/^[a-z0-9-]+ /.test(external)) {
                    let idx = external.indexOf(' ');
                    return [
                        external.slice(0, idx),
                        external.slice(idx + 1)
                    ];
                }
                return null;
            }(external);
            return null === result ? [
                remoteType,
                external
            ] : result;
        }(external);
        if (remoteInfos[key] ??= [], "script" === externalType) {
            let [url, global] = function(urlAndGlobal) {
                let index = urlAndGlobal.indexOf('@');
                return index <= 0 || index === urlAndGlobal.length - 1 ? null : [
                    urlAndGlobal.substring(index + 1),
                    urlAndGlobal.substring(0, index)
                ];
            }(externalRequest);
            remoteInfos[key].push({
                alias: key,
                name: global,
                entry: url,
                externalType,
                shareScope: config.shareScope
            });
        } else remoteInfos[key].push({
            alias: key,
            name: void 0,
            entry: void 0,
            externalType,
            shareScope: config.shareScope
        });
    }
    return remoteInfos;
}
function getSharedOptions(options) {
    return options.shared ? parseOptions(options.shared, (item, key)=>{
        if ('string' != typeof item) throw Error('Unexpected array in shared');
        return item !== key && isRequiredVersion(item) ? {
            import: key,
            requiredVersion: item
        } : {
            import: item
        };
    }, (item)=>item) : [];
}
function getDefaultEntryRuntimeRequest(resource) {
    return `${MF_RUNTIME_LOADER}!=!${resource}`;
}
function getDefaultEntryRuntimeSource(paths, options, compiler, treeShakingShareFallbacks) {
    let runtimePlugins = options.runtimePlugins ?? [], remoteInfos = getRemoteInfos(options), runtimePluginImports = [], runtimePluginVars = [], libraryType = options.library?.type || 'var', shouldInitializePublicPath = getSharedOptions(options).some(([, config])=>config.treeShaking);
    for(let i = 0; i < runtimePlugins.length; i++){
        let runtimePluginVar = `__module_federation_runtime_plugin_${i}__`, pluginSpec = runtimePlugins[i], pluginPath = Array.isArray(pluginSpec) ? pluginSpec[0] : pluginSpec, pluginParams = Array.isArray(pluginSpec) ? pluginSpec[1] : void 0;
        runtimePluginImports.push(`import ${runtimePluginVar} from ${JSON.stringify(pluginPath)}`);
        let paramsCode = void 0 === pluginParams ? 'undefined' : JSON.stringify(pluginParams);
        runtimePluginVars.push(`{ plugin: ${runtimePluginVar}, params: ${paramsCode} }`);
    }
    return [
        `import __module_federation_bundler_runtime__ from ${JSON.stringify(paths.bundlerRuntime)}`,
        ...runtimePluginImports,
        shouldInitializePublicPath ? function(compiler) {
            let publicPath = compiler.options.output.publicPath;
            if ('string' == typeof publicPath && 'auto' !== publicPath) return `if (typeof __webpack_require__.p === "undefined") __webpack_require__.p = ${JSON.stringify(publicPath)}`;
        }(compiler) : void 0,
        `const __module_federation_runtime_plugins__ = [${runtimePluginVars.join(', ')}].filter(({ plugin }) => plugin).map(({ plugin, params }) => plugin(params))`,
        `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
        `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
        `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
        `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
        `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
        compiler.rspack.Template.getFunctionContent(ModuleFederationPlugin_require('./moduleFederationDefaultRuntime.js').default)
    ].join(';');
}
function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
    return `${MF_RUNTIME_LOADER}!=!data:text/javascript,${encodeURIComponent(getDefaultEntryRuntimeSource(paths, options, compiler, treeShakingShareFallbacks))}`;
}
class ContainerPlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ContainerPlugin;
    _options;
    constructor(options){
        super();
        let shareScope = options.shareScope || 'default', enhanced = options.enhanced ?? !1;
        validateShareScope(shareScope, enhanced, 'ContainerPlugin'), this._options = {
            name: options.name,
            shareScope,
            library: options.library || {
                type: 'global',
                name: options.name
            },
            runtime: options.runtime,
            filename: options.filename,
            exposes: parseOptions(options.exposes, (item)=>({
                    import: Array.isArray(item) ? item : [
                        item
                    ],
                    name: void 0
                }), (item)=>({
                    import: Array.isArray(item.import) ? item.import : [
                        item.import
                    ],
                    name: item.name || void 0
                })),
            enhanced
        };
    }
    raw(compiler) {
        let { name, shareScope, library, runtime, filename, exposes, enhanced } = this._options;
        compiler.options.output.enabledLibraryTypes.includes(library.type) || compiler.options.output.enabledLibraryTypes.push(library.type), new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
        let rawOptions = {
            name,
            shareScope,
            library,
            runtime,
            filename,
            exposes: exposes.map(([key, r])=>({
                    key,
                    ...r
                })),
            enhanced
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
class ContainerReferencePlugin extends RspackBuiltinPlugin {
    name = binding_namespaceObject.BuiltinPluginName.ContainerReferencePlugin;
    _options;
    constructor(options){
        super();
        let enhanced = options.enhanced ?? !1;
        options.shareScope && validateShareScope(options.shareScope, enhanced, 'ContainerReferencePlugin');
        let remotes = parseOptions(options.remotes, (item)=>({
                external: Array.isArray(item) ? item : [
                    item
                ],
                shareScope: options.shareScope || 'default'
            }), (item)=>({
                external: Array.isArray(item.external) ? item.external : [
                    item.external
                ],
                shareScope: item.shareScope || options.shareScope || 'default'
            }));
        for (let [, config] of remotes)validateShareScope(config.shareScope, enhanced, 'ContainerReferencePlugin');
        this._options = {
            remoteType: options.remoteType,
            remotes,
            enhanced
        };
    }
    raw(compiler) {
        let { remoteType, remotes } = this._options, remoteExternals = {}, importExternals = {};
        for (let [key, config] of remotes){
            let i = 0;
            for (let external of config.external){
                if (external.startsWith('internal ')) continue;
                let request = `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`;
                ('module' === remoteType || 'module-import' === remoteType || 'modern-module' === remoteType) && external.startsWith('.') ? importExternals[request] = external : remoteExternals[request] = external, i++;
            }
        }
        new ExternalsPlugin(remoteType, remoteExternals, !0).apply(compiler), Object.keys(importExternals).length > 0 && new ExternalsPlugin('import', importExternals, !0).apply(compiler), new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
        let rawOptions = {
            remoteType: this._options.remoteType,
            remotes: this._options.remotes.map(([key, r])=>({
                    key,
                    ...r
                })),
            enhanced: this._options.enhanced
        };
        return createBuiltinPlugin(this.name, rawOptions);
    }
}
async function minify(source, options) {
    let _options = JSON.stringify(options || {});
    return binding_default().minify(source, _options);
}
async function transform(source, options) {
    let _options = JSON.stringify(options || {});
    return binding_default().transform(source, _options);
}
let exports_rspackVersion = "2.0.8", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
    getNormalizedRspackOptions: getNormalizedRspackOptions,
    applyRspackOptionsDefaults: applyRspackOptionsDefaults,
    getNormalizedWebpackOptions: getNormalizedRspackOptions,
    applyWebpackOptionsDefaults: applyRspackOptionsDefaults
}, util = {
    createHash: createHash_createHash,
    cleverMerge: cachedCleverMerge
}, web = {
    FetchCompileAsyncWasmPlugin: FetchCompileAsyncWasmPlugin,
    JsonpTemplatePlugin: class {
        apply(compiler) {
            compiler.options.output.chunkLoading = 'jsonp', new ArrayPushCallbackChunkFormatPlugin().apply(compiler), new EnableChunkLoadingPlugin('jsonp').apply(compiler);
        }
    }
}, exports_node = {
    NodeTargetPlugin: NodeTargetPlugin,
    NodeTemplatePlugin: class {
        _options;
        constructor(_options = {}){
            this._options = _options;
        }
        apply(compiler) {
            let chunkLoading = this._options.asyncChunkLoading ? 'async-node' : 'require';
            compiler.options.output.chunkLoading = chunkLoading, new CommonJsChunkFormatPlugin().apply(compiler), new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
        }
    },
    NodeEnvironmentPlugin: NodeEnvironmentPlugin
}, electron = {
    ElectronTargetPlugin: ElectronTargetPlugin
}, exports_ids = {
    DeterministicModuleIdsPlugin: DeterministicModuleIdsPlugin,
    HashedModuleIdsPlugin: HashedModuleIdsPlugin
}, exports_library = {
    EnableLibraryPlugin: EnableLibraryPlugin
}, exports_wasm = {
    EnableWasmLoadingPlugin: EnableWasmLoadingPlugin
}, javascript = {
    EnableChunkLoadingPlugin: EnableChunkLoadingPlugin,
    JavascriptModulesPlugin: JavascriptModulesPlugin
}, webworker = {
    WebWorkerTemplatePlugin: class {
        apply(compiler) {
            compiler.options.output.chunkLoading = "import-scripts", new ArrayPushCallbackChunkFormatPlugin().apply(compiler), new EnableChunkLoadingPlugin("import-scripts").apply(compiler);
        }
    }
}, optimize = {
    LimitChunkCountPlugin: LimitChunkCountPlugin,
    RuntimeChunkPlugin: RuntimeChunkPlugin,
    SplitChunksPlugin: SplitChunksPlugin
}, container = {
    ContainerPlugin: ContainerPlugin,
    ContainerReferencePlugin: ContainerReferencePlugin,
    ModuleFederationPlugin: class {
        _options;
        _treeShakingSharedPlugin;
        constructor(_options){
            this._options = _options;
        }
        apply(compiler) {
            var options, compiler1;
            let name, { rspack } = compiler, paths = function(options, compiler) {
                let runtimeToolsPath;
                if (options.implementation) runtimeToolsPath = options.implementation;
                else try {
                    runtimeToolsPath = ModuleFederationPlugin_require.resolve('@module-federation/runtime-tools', {
                        paths: [
                            compiler.context
                        ]
                    });
                } catch (e) {
                    if ('MODULE_NOT_FOUND' === e.code) throw Error('Module Federation runtime is not installed. Please install it by running:\n\n  npm install @module-federation/runtime-tools\n');
                    throw e;
                }
                let bundlerRuntimePath = ModuleFederationPlugin_require.resolve('@module-federation/webpack-bundler-runtime', {
                    paths: [
                        runtimeToolsPath
                    ]
                }), runtimePath = ModuleFederationPlugin_require.resolve('@module-federation/runtime', {
                    paths: [
                        runtimeToolsPath
                    ]
                });
                return {
                    runtimeTools: runtimeToolsPath,
                    bundlerRuntime: bundlerRuntimePath,
                    runtime: runtimePath
                };
            }(this._options, compiler);
            compiler.options.resolve.alias = {
                '@module-federation/runtime-tools': paths.runtimeTools,
                '@module-federation/runtime': paths.runtime,
                ...compiler.options.resolve.alias
            };
            let treeShakingEntries = getSharedOptions(this._options).filter(([, config])=>config.treeShaking), runtimeVirtualPath = treeShakingEntries.length > 0 ? (options = this._options, compiler1 = compiler, name = String(options.name ?? compiler1.options.output.uniqueName ?? 'default').replace(/[^\w.-]/g, '_'), external_node_path_resolve(compiler1.context, `node_modules/.rspack-mf-runtime/${name}.js`)) : void 0, runtimeVirtualPlugin = runtimeVirtualPath ? new rspack.experiments.VirtualModulesPlugin({
                [runtimeVirtualPath]: getDefaultEntryRuntimeSource(paths, this._options, compiler)
            }) : void 0;
            runtimeVirtualPlugin?.apply(compiler);
            let updateRuntimeShareFallbacks = (buildAssets)=>{
                runtimeVirtualPath && runtimeVirtualPlugin && runtimeVirtualPlugin.writeModule(runtimeVirtualPath, getDefaultEntryRuntimeSource(paths, this._options, compiler, buildAssets));
            };
            treeShakingEntries.length > 0 && (this._treeShakingSharedPlugin = new TreeShakingSharedPlugin({
                mfConfig: this._options,
                secondary: !1,
                onBuildAssets: updateRuntimeShareFallbacks
            }), this._treeShakingSharedPlugin.apply(compiler));
            let runtimeExperiments = {
                asyncStartup: this._options.experiments?.asyncStartup ?? !1
            }, runtimePluginApplied = !1;
            compiler.hooks.beforeRun.tap({
                name: 'ModuleFederationPlugin',
                stage: 100
            }, ()=>{
                runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
                    entryRuntime: runtimeVirtualPath ? getDefaultEntryRuntimeRequest(runtimeVirtualPath) : getDefaultEntryRuntime(paths, this._options, compiler),
                    experiments: runtimeExperiments
                }).apply(compiler));
            }), compiler.hooks.watchRun.tap({
                name: 'ModuleFederationPlugin',
                stage: 100
            }, ()=>{
                runtimePluginApplied || (runtimePluginApplied = !0, new ModuleFederationRuntimePlugin({
                    entryRuntime: runtimeVirtualPath ? getDefaultEntryRuntimeRequest(runtimeVirtualPath) : getDefaultEntryRuntime(paths, this._options, compiler),
                    experiments: runtimeExperiments
                }).apply(compiler));
            });
            let v1Options = {
                name: this._options.name,
                exposes: this._options.exposes,
                filename: this._options.filename,
                library: this._options.library,
                remoteType: this._options.remoteType,
                remotes: this._options.remotes,
                runtime: this._options.runtime,
                shareScope: this._options.shareScope,
                shared: this._options.shared,
                enhanced: !0
            };
            new rspack.container.ModuleFederationPluginV1(v1Options).apply(compiler), this._options.manifest && new ModuleFederationManifestPlugin(this._options).apply(compiler);
        }
    },
    ModuleFederationPluginV1: class {
        _options;
        constructor(_options){
            this._options = _options;
        }
        apply(compiler) {
            let { _options: options } = this, enhanced = options.enhanced ?? !1, library = options.library || {
                type: 'var',
                name: options.name
            }, remoteType = options.remoteType || (options.library ? options.library.type : "script");
            library && !compiler.options.output.enabledLibraryTypes.includes(library.type) && compiler.options.output.enabledLibraryTypes.push(library.type), compiler.hooks.afterPlugins.tap('ModuleFederationPlugin', ()=>{
                new ShareRuntimePlugin(this._options.enhanced).apply(compiler), options.exposes && (Array.isArray(options.exposes) ? options.exposes.length > 0 : Object.keys(options.exposes).length > 0) && new ContainerPlugin({
                    name: options.name,
                    library,
                    filename: options.filename,
                    runtime: options.runtime,
                    shareScope: options.shareScope,
                    exposes: options.exposes,
                    enhanced
                }).apply(compiler), options.remotes && (Array.isArray(options.remotes) ? options.remotes.length > 0 : Object.keys(options.remotes).length > 0) && new ContainerReferencePlugin({
                    remoteType,
                    shareScope: options.shareScope,
                    remotes: options.remotes,
                    enhanced
                }).apply(compiler), options.shared && new SharePlugin({
                    shared: options.shared,
                    shareScope: options.shareScope,
                    enhanced
                }).apply(compiler);
            });
        }
    }
}, sharing = {
    ProvideSharedPlugin: ProvideSharedPlugin,
    TreeShakingSharedPlugin: TreeShakingSharedPlugin,
    ConsumeSharedPlugin: ConsumeSharedPlugin,
    SharePlugin: SharePlugin
}, exports_experiments = {
    globalTrace: {
        async register (filter, layer, output) {
            await JavaScriptTracer.initJavaScriptTrace(layer, output), (0, binding_namespaceObject.registerGlobalTrace)(filter, layer, output), JavaScriptTracer.initCpuProfiler();
        },
        async cleanup () {
            await JavaScriptTracer.cleanupJavaScriptTrace(), (0, binding_namespaceObject.syncTraceEvent)(JavaScriptTracer.events), (0, binding_namespaceObject.cleanupGlobalTrace)();
        }
    },
    RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin_RemoveDuplicateModulesPlugin,
    RsdoctorPlugin: RsdoctorPluginImpl,
    RstestPlugin: RstestPlugin,
    RslibPlugin: RslibPlugin,
    swc: {
        minify: minify,
        transform: transform,
        minifySync: function(source, options) {
            let _options = JSON.stringify(options || {});
            return binding_default().minifySync(source, _options);
        },
        transformSync: function(source, options) {
            let _options = JSON.stringify(options || {});
            return binding_default().transformSync(source, _options);
        }
    },
    resolver: {
        ResolverFactory: binding_namespaceObject.ResolverFactory,
        EnforceExtension: binding_namespaceObject.EnforceExtension,
        async: binding_namespaceObject.async,
        sync: binding_namespaceObject.sync
    },
    CssChunkingPlugin: CssChunkingPlugin,
    createNativePlugin: function(name, resolve, affectedHooks) {
        if (INTERNAL_PLUGIN_NAMES.includes(name)) throw Error(`Cannot register native plugin with name '${name}', it conflicts with internal plugin names.`);
        return base_create(name, resolve, affectedHooks);
    },
    VirtualModulesPlugin: VirtualModulesPlugin,
    ids: {
        SyncModuleIdsPlugin: SyncModuleIdsPlugin
    },
    rsc: {
        createPlugins: ()=>{
            let coordinator = new Coordinator();
            return {
                ServerPlugin: class extends RscServerPlugin {
                    constructor(options = {}){
                        super({
                            coordinator,
                            ...options
                        });
                    }
                },
                ClientPlugin: class extends RscClientPlugin {
                    constructor(){
                        super({
                            coordinator
                        });
                    }
                }
            };
        },
        Layers: {
            rsc: 'react-server-components',
            ssr: 'server-side-rendering'
        }
    }
}, src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
src_fn.rspack = src_fn, src_fn.webpack = src_fn;
let src_rspack_0 = src_fn;
var AsyncDependenciesBlock = binding_namespaceObject.AsyncDependenciesBlock, ConcatenatedModule = binding_namespaceObject.ConcatenatedModule, ContextModule = binding_namespaceObject.ContextModule, Dependency = binding_namespaceObject.Dependency, EntryDependency = binding_namespaceObject.EntryDependency, ExternalModule = binding_namespaceObject.ExternalModule, Module = binding_namespaceObject.Module, NormalModule = binding_namespaceObject.NormalModule;
export default src_rspack_0;
export { AsyncDependenciesBlock, BannerPlugin, CaseSensitivePlugin, CircularCheckRspackPlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, ModuleGraphConnection, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_ids as ids, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, index_js_namespaceObject as sources, javascript, lazyCompilationMiddleware, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
