/*! LICENSE: 0~connect-next.js.LICENSE.txt */
import { EventEmitter } from "node:events";
import { createRequire } from "node:module";
import * as __rspack_external_node_http_2dc67212 from "node:http";
/*! LICENSE: index.js.LICENSE.txt */ const __rspack_createRequire_require = createRequire(import.meta.url);
var __webpack_modules__ = {};
var __webpack_module_cache__ = {};
function __nested_rspack_require_364__(moduleId) {
    var cachedModule = __webpack_module_cache__[moduleId];
    if (void 0 !== cachedModule) return cachedModule.exports;
    var module = __webpack_module_cache__[moduleId] = {
        exports: {}
    };
    __webpack_modules__[moduleId](module, module.exports, __nested_rspack_require_364__);
    return module.exports;
}
__nested_rspack_require_364__.m = __webpack_modules__;
(()=>{
    __nested_rspack_require_364__.n = (module)=>{
        var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
        __nested_rspack_require_364__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __nested_rspack_require_364__.d = (exports, definition)=>{
        for(var key in definition)if (__nested_rspack_require_364__.o(definition, key) && !__nested_rspack_require_364__.o(exports, key)) Object.defineProperty(exports, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __nested_rspack_require_364__.add = function(modules) {
        Object.assign(__nested_rspack_require_364__.m, modules);
    };
})();
(()=>{
    __nested_rspack_require_364__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
__nested_rspack_require_364__.add({
    "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports, __nested_rspack_require_1677_1696__) {
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.storage = localstorage();
        exports.destroy = (()=>{
            let warned = false;
            return ()=>{
                if (!warned) {
                    warned = true;
                    console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
                }
            };
        })();
        exports.colors = [
            '#0000CC',
            '#0000FF',
            '#0033CC',
            '#0033FF',
            '#0066CC',
            '#0066FF',
            '#0099CC',
            '#0099FF',
            '#00CC00',
            '#00CC33',
            '#00CC66',
            '#00CC99',
            '#00CCCC',
            '#00CCFF',
            '#3300CC',
            '#3300FF',
            '#3333CC',
            '#3333FF',
            '#3366CC',
            '#3366FF',
            '#3399CC',
            '#3399FF',
            '#33CC00',
            '#33CC33',
            '#33CC66',
            '#33CC99',
            '#33CCCC',
            '#33CCFF',
            '#6600CC',
            '#6600FF',
            '#6633CC',
            '#6633FF',
            '#66CC00',
            '#66CC33',
            '#9900CC',
            '#9900FF',
            '#9933CC',
            '#9933FF',
            '#99CC00',
            '#99CC33',
            '#CC0000',
            '#CC0033',
            '#CC0066',
            '#CC0099',
            '#CC00CC',
            '#CC00FF',
            '#CC3300',
            '#CC3333',
            '#CC3366',
            '#CC3399',
            '#CC33CC',
            '#CC33FF',
            '#CC6600',
            '#CC6633',
            '#CC9900',
            '#CC9933',
            '#CCCC00',
            '#CCCC33',
            '#FF0000',
            '#FF0033',
            '#FF0066',
            '#FF0099',
            '#FF00CC',
            '#FF00FF',
            '#FF3300',
            '#FF3333',
            '#FF3366',
            '#FF3399',
            '#FF33CC',
            '#FF33FF',
            '#FF6600',
            '#FF6633',
            '#FF9900',
            '#FF9933',
            '#FFCC00',
            '#FFCC33'
        ];
        function useColors() {
            if ("u" > typeof window && window.process && ('renderer' === window.process.type || window.process.__nwjs)) return true;
            if ("u" > typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
            let m;
            return "u" > typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "u" > typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "u" > typeof navigator && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || "u" > typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
        }
        function formatArgs(args) {
            args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
            if (!this.useColors) return;
            const c = 'color: ' + this.color;
            args.splice(1, 0, c, 'color: inherit');
            let index = 0;
            let lastC = 0;
            args[0].replace(/%[a-zA-Z%]/g, (match)=>{
                if ('%%' === match) return;
                index++;
                if ('%c' === match) lastC = index;
            });
            args.splice(lastC, 0, c);
        }
        exports.log = console.debug || console.log || (()=>{});
        function save(namespaces) {
            try {
                if (namespaces) exports.storage.setItem('debug', namespaces);
                else exports.storage.removeItem('debug');
            } catch (error) {}
        }
        function load() {
            let r;
            try {
                r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG');
            } catch (error) {}
            if (!r && "u" > typeof process && 'env' in process) r = process.env.DEBUG;
            return r;
        }
        function localstorage() {
            try {
                return localStorage;
            } catch (error) {}
        }
        module.exports = __nested_rspack_require_1677_1696__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
        const { formatters } = module.exports;
        formatters.j = function(v) {
            try {
                return JSON.stringify(v);
            } catch (error) {
                return '[UnexpectedJSONParseError]: ' + error.message;
            }
        };
    },
    "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __nested_rspack_require_6843_6862__) {
        function setup(env) {
            createDebug.debug = createDebug;
            createDebug.default = createDebug;
            createDebug.coerce = coerce;
            createDebug.disable = disable;
            createDebug.enable = enable;
            createDebug.enabled = enabled;
            createDebug.humanize = __nested_rspack_require_6843_6862__("./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js");
            createDebug.destroy = destroy;
            Object.keys(env).forEach((key)=>{
                createDebug[key] = env[key];
            });
            createDebug.names = [];
            createDebug.skips = [];
            createDebug.formatters = {};
            function selectColor(namespace) {
                let hash = 0;
                for(let i = 0; i < namespace.length; i++){
                    hash = (hash << 5) - hash + namespace.charCodeAt(i);
                    hash |= 0;
                }
                return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
            }
            createDebug.selectColor = selectColor;
            function createDebug(namespace) {
                let prevTime;
                let enableOverride = null;
                let namespacesCache;
                let enabledCache;
                function debug(...args) {
                    if (!debug.enabled) return;
                    const self = debug;
                    const curr = Number(new Date());
                    const ms = curr - (prevTime || curr);
                    self.diff = ms;
                    self.prev = prevTime;
                    self.curr = curr;
                    prevTime = curr;
                    args[0] = createDebug.coerce(args[0]);
                    if ('string' != typeof args[0]) args.unshift('%O');
                    let index = 0;
                    args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format)=>{
                        if ('%%' === match) return '%';
                        index++;
                        const formatter = createDebug.formatters[format];
                        if ('function' == typeof formatter) {
                            const val = args[index];
                            match = formatter.call(self, val);
                            args.splice(index, 1);
                            index--;
                        }
                        return match;
                    });
                    createDebug.formatArgs.call(self, args);
                    const logFn = self.log || createDebug.log;
                    logFn.apply(self, args);
                }
                debug.namespace = namespace;
                debug.useColors = createDebug.useColors();
                debug.color = createDebug.selectColor(namespace);
                debug.extend = extend;
                debug.destroy = createDebug.destroy;
                Object.defineProperty(debug, 'enabled', {
                    enumerable: true,
                    configurable: false,
                    get: ()=>{
                        if (null !== enableOverride) return enableOverride;
                        if (namespacesCache !== createDebug.namespaces) {
                            namespacesCache = createDebug.namespaces;
                            enabledCache = createDebug.enabled(namespace);
                        }
                        return enabledCache;
                    },
                    set: (v)=>{
                        enableOverride = v;
                    }
                });
                if ('function' == typeof createDebug.init) createDebug.init(debug);
                return debug;
            }
            function extend(namespace, delimiter) {
                const newDebug = createDebug(this.namespace + (void 0 === delimiter ? ':' : delimiter) + namespace);
                newDebug.log = this.log;
                return newDebug;
            }
            function enable(namespaces) {
                createDebug.save(namespaces);
                createDebug.namespaces = namespaces;
                createDebug.names = [];
                createDebug.skips = [];
                const split = ('string' == typeof namespaces ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean);
                for (const ns of split)if ('-' === ns[0]) createDebug.skips.push(ns.slice(1));
                else createDebug.names.push(ns);
            }
            function matchesTemplate(search, template) {
                let searchIndex = 0;
                let templateIndex = 0;
                let starIndex = -1;
                let matchIndex = 0;
                while(searchIndex < search.length)if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || '*' === template[templateIndex])) if ('*' === template[templateIndex]) {
                    starIndex = templateIndex;
                    matchIndex = searchIndex;
                    templateIndex++;
                } else {
                    searchIndex++;
                    templateIndex++;
                }
                else {
                    if (-1 === starIndex) return false;
                    templateIndex = starIndex + 1;
                    matchIndex++;
                    searchIndex = matchIndex;
                }
                while(templateIndex < template.length && '*' === template[templateIndex])templateIndex++;
                return templateIndex === template.length;
            }
            function disable() {
                const namespaces = [
                    ...createDebug.names,
                    ...createDebug.skips.map((namespace)=>'-' + namespace)
                ].join(',');
                createDebug.enable('');
                return namespaces;
            }
            function enabled(name) {
                for (const skip of createDebug.skips)if (matchesTemplate(name, skip)) return false;
                for (const ns of createDebug.names)if (matchesTemplate(name, ns)) return true;
                return false;
            }
            function coerce(val) {
                if (val instanceof Error) return val.stack || val.message;
                return val;
            }
            function destroy() {
                console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
            }
            createDebug.enable(createDebug.load());
            return createDebug;
        }
        module.exports = setup;
    },
    "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __nested_rspack_require_13591_13610__) {
        if ("u" < typeof process || 'renderer' === process.type || true === process.browser || process.__nwjs) module.exports = __nested_rspack_require_13591_13610__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js");
        else module.exports = __nested_rspack_require_13591_13610__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js");
    },
    "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports, __nested_rspack_require_14109_14128__) {
        const tty = __nested_rspack_require_14109_14128__("tty");
        const util = __nested_rspack_require_14109_14128__("util");
        exports.init = init;
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
        exports.colors = [
            6,
            2,
            3,
            4,
            5,
            1
        ];
        try {
            const supportsColor = __nested_rspack_require_14109_14128__("./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js");
            if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
                20,
                21,
                26,
                27,
                32,
                33,
                38,
                39,
                40,
                41,
                42,
                43,
                44,
                45,
                56,
                57,
                62,
                63,
                68,
                69,
                74,
                75,
                76,
                77,
                78,
                79,
                80,
                81,
                92,
                93,
                98,
                99,
                112,
                113,
                128,
                129,
                134,
                135,
                148,
                149,
                160,
                161,
                162,
                163,
                164,
                165,
                166,
                167,
                168,
                169,
                170,
                171,
                172,
                173,
                178,
                179,
                184,
                185,
                196,
                197,
                198,
                199,
                200,
                201,
                202,
                203,
                204,
                205,
                206,
                207,
                208,
                209,
                214,
                215,
                220,
                221
            ];
        } catch (error) {}
        exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
            const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase());
            let val = process.env[key];
            val = /^(yes|on|true|enabled)$/i.test(val) ? true : /^(no|off|false|disabled)$/i.test(val) ? false : 'null' === val ? null : Number(val);
            obj[prop] = val;
            return obj;
        }, {});
        function useColors() {
            return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
        }
        function formatArgs(args) {
            const { namespace: name, useColors } = this;
            if (useColors) {
                const c = this.color;
                const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
                const prefix = `  ${colorCode};1m${name} \u001B[0m`;
                args[0] = prefix + args[0].split('\n').join('\n' + prefix);
                args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
            } else args[0] = getDate() + name + ' ' + args[0];
        }
        function getDate() {
            if (exports.inspectOpts.hideDate) return '';
            return new Date().toISOString() + ' ';
        }
        function log(...args) {
            return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
        }
        function save(namespaces) {
            if (namespaces) process.env.DEBUG = namespaces;
            else delete process.env.DEBUG;
        }
        function load() {
            return process.env.DEBUG;
        }
        function init(debug) {
            debug.inspectOpts = {};
            const keys = Object.keys(exports.inspectOpts);
            for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
        }
        module.exports = __nested_rspack_require_14109_14128__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
        const { formatters } = module.exports;
        formatters.o = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
        };
        formatters.O = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts);
        };
    },
    "./node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js" (module) {
        /*!
 * ee-first
 * Copyright(c) 2014 Jonathan Ong
 * MIT Licensed
 */ module.exports = first;
        function first(stuff, done) {
            if (!Array.isArray(stuff)) throw new TypeError('arg must be an array of [ee, events...] arrays');
            var cleanups = [];
            for(var i = 0; i < stuff.length; i++){
                var arr = stuff[i];
                if (!Array.isArray(arr) || arr.length < 2) throw new TypeError('each array member must be [ee, events...]');
                var ee = arr[0];
                for(var j = 1; j < arr.length; j++){
                    var event = arr[j];
                    var fn = listener(event, callback);
                    ee.on(event, fn);
                    cleanups.push({
                        ee: ee,
                        event: event,
                        fn: fn
                    });
                }
            }
            function callback() {
                cleanup();
                done.apply(null, arguments);
            }
            function cleanup() {
                var x;
                for(var i = 0; i < cleanups.length; i++){
                    x = cleanups[i];
                    x.ee.removeListener(x.event, x.fn);
                }
            }
            function thunk(fn) {
                done = fn;
            }
            thunk.cancel = cleanup;
            return thunk;
        }
        function listener(event, done) {
            return function(arg1) {
                var args = new Array(arguments.length);
                var ee = this;
                var err = 'error' === event ? arg1 : null;
                for(var i = 0; i < args.length; i++)args[i] = arguments[i];
                done(err, ee, event, args);
            };
        }
    },
    "./node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js" (module) {
        /*!
 * encodeurl
 * Copyright(c) 2016 Douglas Christopher Wilson
 * MIT Licensed
 */ module.exports = encodeUrl;
        var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g;
        var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g;
        var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2';
        function encodeUrl(url) {
            return String(url).replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE).replace(ENCODE_CHARS_REGEXP, encodeURI);
        }
    },
    "./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js" (module) {
        /*!
 * escape-html
 * Copyright(c) 2012-2013 TJ Holowaychuk
 * Copyright(c) 2015 Andreas Lubbe
 * Copyright(c) 2015 Tiancheng "Timothy" Gu
 * MIT Licensed
 */ var matchHtmlRegExp = /["'&<>]/;
        module.exports = escapeHtml;
        function escapeHtml(string) {
            var str = '' + string;
            var match = matchHtmlRegExp.exec(str);
            if (!match) return str;
            var escape;
            var html = '';
            var index = 0;
            var lastIndex = 0;
            for(index = match.index; index < str.length; index++){
                switch(str.charCodeAt(index)){
                    case 34:
                        escape = '&quot;';
                        break;
                    case 38:
                        escape = '&amp;';
                        break;
                    case 39:
                        escape = '&#39;';
                        break;
                    case 60:
                        escape = '&lt;';
                        break;
                    case 62:
                        escape = '&gt;';
                        break;
                    default:
                        continue;
                }
                if (lastIndex !== index) html += str.substring(lastIndex, index);
                lastIndex = index + 1;
                html += escape;
            }
            return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
        }
    },
    "./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js" (module, __unused_rspack_exports, __nested_rspack_require_23374_23393__) {
        /*!
 * finalhandler
 * Copyright(c) 2014-2022 Douglas Christopher Wilson
 * MIT Licensed
 */ var debug = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('finalhandler');
        var encodeUrl = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js");
        var escapeHtml = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js");
        var onFinished = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js");
        var parseUrl = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js");
        var statuses = __nested_rspack_require_23374_23393__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js");
        var isFinished = onFinished.isFinished;
        function createHtmlDocument(message) {
            var body = escapeHtml(message).replaceAll('\n', '<br>').replaceAll('  ', ' &nbsp;');
            return '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>' + body + "</pre>\n</body>\n</html>\n";
        }
        module.exports = finalhandler;
        function finalhandler(req, res, options) {
            var opts = options || {};
            var env = opts.env || process.env.NODE_ENV || 'development';
            var onerror = opts.onerror;
            return function(err) {
                var headers;
                var msg;
                var status;
                if (!err && res.headersSent) return void debug('cannot 404 after headers sent');
                if (err) {
                    status = getErrorStatusCode(err);
                    if (void 0 === status) status = getResponseStatusCode(res);
                    else headers = getErrorHeaders(err);
                    msg = getErrorMessage(err, status, env);
                } else {
                    status = 404;
                    msg = 'Cannot ' + req.method + ' ' + encodeUrl(getResourceName(req));
                }
                debug('default %s', status);
                if (err && onerror) setImmediate(onerror, err, req, res);
                if (res.headersSent) {
                    debug('cannot %d after headers sent', status);
                    if (req.socket) req.socket.destroy();
                    return;
                }
                send(req, res, status, headers, msg);
            };
        }
        function getErrorHeaders(err) {
            if (!err.headers || 'object' != typeof err.headers) return;
            return {
                ...err.headers
            };
        }
        function getErrorMessage(err, status, env) {
            var msg;
            if ('production' !== env) {
                msg = err.stack;
                if (!msg && 'function' == typeof err.toString) msg = err.toString();
            }
            return msg || statuses.message[status];
        }
        function getErrorStatusCode(err) {
            if ('number' == typeof err.status && err.status >= 400 && err.status < 600) return err.status;
            if ('number' == typeof err.statusCode && err.statusCode >= 400 && err.statusCode < 600) return err.statusCode;
        }
        function getResourceName(req) {
            try {
                return parseUrl.original(req).pathname;
            } catch (e) {
                return 'resource';
            }
        }
        function getResponseStatusCode(res) {
            var status = res.statusCode;
            if ('number' != typeof status || status < 400 || status > 599) status = 500;
            return status;
        }
        function send(req, res, status, headers, message) {
            function write() {
                var body = createHtmlDocument(message);
                res.statusCode = status;
                if (req.httpVersionMajor < 2) res.statusMessage = statuses.message[status];
                res.removeHeader('Content-Encoding');
                res.removeHeader('Content-Language');
                res.removeHeader('Content-Range');
                for (const [key, value] of Object.entries(headers ?? {}))res.setHeader(key, value);
                res.setHeader('Content-Security-Policy', "default-src 'none'");
                res.setHeader('X-Content-Type-Options', 'nosniff');
                res.setHeader('Content-Type', 'text/html; charset=utf-8');
                res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'));
                if ('HEAD' === req.method) return void res.end();
                res.end(body, 'utf8');
            }
            if (isFinished(req)) return void write();
            req.unpipe();
            onFinished(req, write);
            req.resume();
        }
    },
    "./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js" (module) {
        module.exports = (flag, argv = process.argv)=>{
            const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
            const position = argv.indexOf(prefix + flag);
            const terminatorPosition = argv.indexOf('--');
            return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
        };
    },
    "./node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js" (module) {
        var s = 1000;
        var m = 60 * s;
        var h = 60 * m;
        var d = 24 * h;
        var w = 7 * d;
        var y = 365.25 * d;
        module.exports = function(val, options) {
            options = options || {};
            var type = typeof val;
            if ('string' === type && val.length > 0) return parse(val);
            if ('number' === type && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
            throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
        };
        function parse(str) {
            str = String(str);
            if (str.length > 100) return;
            var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
            if (!match) return;
            var n = parseFloat(match[1]);
            var type = (match[2] || 'ms').toLowerCase();
            switch(type){
                case 'years':
                case 'year':
                case 'yrs':
                case 'yr':
                case 'y':
                    return n * y;
                case 'weeks':
                case 'week':
                case 'w':
                    return n * w;
                case 'days':
                case 'day':
                case 'd':
                    return n * d;
                case 'hours':
                case 'hour':
                case 'hrs':
                case 'hr':
                case 'h':
                    return n * h;
                case 'minutes':
                case 'minute':
                case 'mins':
                case 'min':
                case 'm':
                    return n * m;
                case 'seconds':
                case 'second':
                case 'secs':
                case 'sec':
                case 's':
                    return n * s;
                case 'milliseconds':
                case 'millisecond':
                case 'msecs':
                case 'msec':
                case 'ms':
                    return n;
                default:
                    return;
            }
        }
        function fmtShort(ms) {
            var msAbs = Math.abs(ms);
            if (msAbs >= d) return Math.round(ms / d) + 'd';
            if (msAbs >= h) return Math.round(ms / h) + 'h';
            if (msAbs >= m) return Math.round(ms / m) + 'm';
            if (msAbs >= s) return Math.round(ms / s) + 's';
            return ms + 'ms';
        }
        function fmtLong(ms) {
            var msAbs = Math.abs(ms);
            if (msAbs >= d) return plural(ms, msAbs, d, 'day');
            if (msAbs >= h) return plural(ms, msAbs, h, 'hour');
            if (msAbs >= m) return plural(ms, msAbs, m, 'minute');
            if (msAbs >= s) return plural(ms, msAbs, s, 'second');
            return ms + ' ms';
        }
        function plural(ms, msAbs, n, name) {
            var isPlural = msAbs >= 1.5 * n;
            return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
        }
    },
    "./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_rspack_exports, __nested_rspack_require_31978_31997__) {
        /*!
 * on-finished
 * Copyright(c) 2013 Jonathan Ong
 * Copyright(c) 2014 Douglas Christopher Wilson
 * MIT Licensed
 */ module.exports = onFinished;
        module.exports.isFinished = isFinished;
        var asyncHooks = tryRequireAsyncHooks();
        var first = __nested_rspack_require_31978_31997__("./node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js");
        var defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
            process.nextTick(fn.bind.apply(fn, arguments));
        };
        function onFinished(msg, listener) {
            if (false !== isFinished(msg)) {
                defer(listener, null, msg);
                return msg;
            }
            attachListener(msg, wrap(listener));
            return msg;
        }
        function isFinished(msg) {
            var socket = msg.socket;
            if ('boolean' == typeof msg.finished) return Boolean(msg.finished || socket && !socket.writable);
            if ('boolean' == typeof msg.complete) return Boolean(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable);
        }
        function attachFinishedListener(msg, callback) {
            var eeMsg;
            var eeSocket;
            var finished = false;
            function onFinish(error) {
                eeMsg.cancel();
                eeSocket.cancel();
                finished = true;
                callback(error);
            }
            eeMsg = eeSocket = first([
                [
                    msg,
                    'end',
                    'finish'
                ]
            ], onFinish);
            function onSocket(socket) {
                msg.removeListener('socket', onSocket);
                if (finished) return;
                if (eeMsg !== eeSocket) return;
                eeSocket = first([
                    [
                        socket,
                        'error',
                        'close'
                    ]
                ], onFinish);
            }
            if (msg.socket) return void onSocket(msg.socket);
            msg.on('socket', onSocket);
            if (void 0 === msg.socket) patchAssignSocket(msg, onSocket);
        }
        function attachListener(msg, listener) {
            var attached = msg.__onFinished;
            if (!attached || !attached.queue) {
                attached = msg.__onFinished = createListener(msg);
                attachFinishedListener(msg, attached);
            }
            attached.queue.push(listener);
        }
        function createListener(msg) {
            function listener(err) {
                if (msg.__onFinished === listener) msg.__onFinished = null;
                if (!listener.queue) return;
                var queue = listener.queue;
                listener.queue = null;
                for(var i = 0; i < queue.length; i++)queue[i](err, msg);
            }
            listener.queue = [];
            return listener;
        }
        function patchAssignSocket(res, callback) {
            var assignSocket = res.assignSocket;
            if ('function' != typeof assignSocket) return;
            res.assignSocket = function(socket) {
                assignSocket.call(this, socket);
                callback(socket);
            };
        }
        function tryRequireAsyncHooks() {
            try {
                return __nested_rspack_require_31978_31997__("async_hooks");
            } catch (e) {
                return {};
            }
        }
        function wrap(fn) {
            var res;
            if (asyncHooks.AsyncResource) res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn');
            if (!res || !res.runInAsyncScope) return fn;
            return res.runInAsyncScope.bind(res, fn, null);
        }
    },
    "./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js" (module, __unused_rspack_exports, __nested_rspack_require_35898_35917__) {
        /*!
 * parseurl
 * Copyright(c) 2014 Jonathan Ong
 * Copyright(c) 2014-2017 Douglas Christopher Wilson
 * MIT Licensed
 */ var url = __nested_rspack_require_35898_35917__("url");
        var parse = url.parse;
        var Url = url.Url;
        module.exports = parseurl;
        module.exports.original = originalurl;
        function parseurl(req) {
            var url = req.url;
            if (void 0 === url) return;
            var parsed = req._parsedUrl;
            if (fresh(url, parsed)) return parsed;
            parsed = fastparse(url);
            parsed._raw = url;
            return req._parsedUrl = parsed;
        }
        function originalurl(req) {
            var url = req.originalUrl;
            if ('string' != typeof url) return parseurl(req);
            var parsed = req._parsedOriginalUrl;
            if (fresh(url, parsed)) return parsed;
            parsed = fastparse(url);
            parsed._raw = url;
            return req._parsedOriginalUrl = parsed;
        }
        function fastparse(str) {
            if ('string' != typeof str || 0x2f !== str.charCodeAt(0)) return parse(str);
            var pathname = str;
            var query = null;
            var search = null;
            for(var i = 1; i < str.length; i++)switch(str.charCodeAt(i)){
                case 0x3f:
                    if (null === search) {
                        pathname = str.substring(0, i);
                        query = str.substring(i + 1);
                        search = str.substring(i);
                    }
                    break;
                case 0x09:
                case 0x0a:
                case 0x0c:
                case 0x0d:
                case 0x20:
                case 0x23:
                case 0xa0:
                case 0xfeff:
                    return parse(str);
            }
            var url = void 0 !== Url ? new Url() : {};
            url.path = str;
            url.href = str;
            url.pathname = pathname;
            if (null !== search) {
                url.query = query;
                url.search = search;
            }
            return url;
        }
        function fresh(url, parsedUrl) {
            return 'object' == typeof parsedUrl && null !== parsedUrl && (void 0 === Url || parsedUrl instanceof Url) && parsedUrl._raw === url;
        }
    },
    "./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports, __nested_rspack_require_38369_38388__) {
        /*!
 * statuses
 * Copyright(c) 2014 Jonathan Ong
 * Copyright(c) 2016 Douglas Christopher Wilson
 * MIT Licensed
 */ var codes = __nested_rspack_require_38369_38388__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json");
        module.exports = status;
        status.message = codes;
        status.code = createMessageToStatusCodeMap(codes);
        status.codes = createStatusCodeList(codes);
        status.redirect = {
            300: true,
            301: true,
            302: true,
            303: true,
            305: true,
            307: true,
            308: true
        };
        status.empty = {
            204: true,
            205: true,
            304: true
        };
        status.retry = {
            502: true,
            503: true,
            504: true
        };
        function createMessageToStatusCodeMap(codes) {
            var map = {};
            Object.keys(codes).forEach(function(code) {
                var message = codes[code];
                var status = Number(code);
                map[message.toLowerCase()] = status;
            });
            return map;
        }
        function createStatusCodeList(codes) {
            return Object.keys(codes).map(function(code) {
                return Number(code);
            });
        }
        function getStatusCode(message) {
            var msg = message.toLowerCase();
            if (!Object.prototype.hasOwnProperty.call(status.code, msg)) throw new Error('invalid status message: "' + message + '"');
            return status.code[msg];
        }
        function getStatusMessage(code) {
            if (!Object.prototype.hasOwnProperty.call(status.message, code)) throw new Error('invalid status code: ' + code);
            return status.message[code];
        }
        function status(code) {
            if ('number' == typeof code) return getStatusMessage(code);
            if ('string' != typeof code) throw new TypeError('code must be a number or string');
            var n = parseInt(code, 10);
            if (!isNaN(n)) return getStatusMessage(n);
            return getStatusCode(code);
        }
    },
    "./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js" (module, __unused_rspack_exports, __nested_rspack_require_40661_40680__) {
        const os = __nested_rspack_require_40661_40680__("os");
        const tty = __nested_rspack_require_40661_40680__("tty");
        const hasFlag = __nested_rspack_require_40661_40680__("./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
        const { env } = process;
        let flagForceColor;
        if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
        else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
        function envForceColor() {
            if ('FORCE_COLOR' in env) {
                if ('true' === env.FORCE_COLOR) return 1;
                if ('false' === env.FORCE_COLOR) return 0;
                return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
            }
        }
        function translateLevel(level) {
            if (0 === level) return false;
            return {
                level,
                hasBasic: true,
                has256: level >= 2,
                has16m: level >= 3
            };
        }
        function supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
            const noFlagForceColor = envForceColor();
            if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
            const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
            if (0 === forceColor) return 0;
            if (sniffFlags) {
                if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
                if (hasFlag('color=256')) return 2;
            }
            if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
            const min = forceColor || 0;
            if ('dumb' === env.TERM) return min;
            if ('win32' === process.platform) {
                const osRelease = os.release().split('.');
                if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
                return 1;
            }
            if ('CI' in env) {
                if ([
                    'TRAVIS',
                    'CIRCLECI',
                    'APPVEYOR',
                    'GITLAB_CI',
                    'GITHUB_ACTIONS',
                    'BUILDKITE',
                    'DRONE'
                ].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
                return min;
            }
            if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
            if ('truecolor' === env.COLORTERM) return 3;
            if ('TERM_PROGRAM' in env) {
                const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
                switch(env.TERM_PROGRAM){
                    case 'iTerm.app':
                        return version >= 3 ? 3 : 2;
                    case 'Apple_Terminal':
                        return 2;
                }
            }
            if (/-256(color)?$/i.test(env.TERM)) return 2;
            if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
            if ('COLORTERM' in env) return 1;
            return min;
        }
        function getSupportLevel(stream, options = {}) {
            const level = supportsColor(stream, {
                streamIsTTY: stream && stream.isTTY,
                ...options
            });
            return translateLevel(level);
        }
        module.exports = {
            supportsColor: getSupportLevel,
            stdout: getSupportLevel({
                isTTY: tty.isatty(1)
            }),
            stderr: getSupportLevel({
                isTTY: tty.isatty(2)
            })
        };
    },
    async_hooks (module) {
        module.exports = __rspack_createRequire_require("async_hooks");
    },
    os (module) {
        module.exports = __rspack_createRequire_require("os");
    },
    tty (module) {
        module.exports = __rspack_createRequire_require("tty");
    },
    url (module) {
        module.exports = __rspack_createRequire_require("url");
    },
    util (module) {
        module.exports = __rspack_createRequire_require("util");
    },
    "./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json" (module) {
        module.exports = JSON.parse('{"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I\'m a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}');
    }
});
const src = __nested_rspack_require_364__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js");
var src_default = /*#__PURE__*/ __nested_rspack_require_364__.n(src);
const dist_finalhandler = __nested_rspack_require_364__("./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js");
var finalhandler_default = /*#__PURE__*/ __nested_rspack_require_364__.n(dist_finalhandler);
const dist_parseurl = __nested_rspack_require_364__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js");
var parseurl_default = /*#__PURE__*/ __nested_rspack_require_364__.n(dist_parseurl);
/*!
 * connect
 * Copyright(c) 2010 Sencha Inc.
 * Copyright(c) 2011 TJ Holowaychuk
 * Copyright(c) 2015 Douglas Christopher Wilson
 * Copyright(c) 2025 Rstackjs
 * MIT Licensed
 */ const dist_debug = src_default()('connect:dispatcher');
const dist_env = process.env.NODE_ENV || 'development';
const dist_defer = setImmediate;
function connect() {
    const app = function(req, res, next) {
        app.handle(req, res, next);
    };
    Object.assign(app, proto);
    Object.assign(app, EventEmitter.prototype);
    app.route = '/';
    app.stack = [];
    return app;
}
const proto = {
    use (route, fn) {
        let handle = fn;
        let path = '/';
        if ('string' == typeof route) path = route;
        else handle = route;
        if (void 0 === handle) throw new TypeError('app.use() requires a middleware function');
        if (isConnectServer(handle)) {
            const server = handle;
            server.route = path;
            handle = function(req, res, next) {
                server.handle(req, res, next);
            };
        }
        if (isHttpServer(handle)) {
            const requestListener = handle.listeners('request')[0];
            if ('function' != typeof requestListener) throw new TypeError('http.Server has no request listener');
            handle = requestListener;
        }
        if (!isConnectHandle(handle)) throw new TypeError('app.use() requires a middleware function');
        if (path.endsWith('/')) path = path.slice(0, -1);
        dist_debug('use %s %s', path || '/', handle.name || 'anonymous');
        this.stack.push({
            route: path,
            handle
        });
        return this;
    },
    handle (req, res, out) {
        let index = 0;
        const protohost = getProtohost(req.url || '') || '';
        let removed = '';
        let slashAdded = false;
        const stack = this.stack;
        const done = out ?? finalhandler_default()(req, res, {
            env: dist_env,
            onerror: logerror
        });
        req.originalUrl = req.originalUrl || req.url;
        function next(err) {
            if (slashAdded) {
                req.url = (req.url || '').slice(1);
                slashAdded = false;
            }
            if (0 !== removed.length) {
                req.url = protohost + removed + (req.url || '').slice(protohost.length);
                removed = '';
            }
            const layer = stack[index++];
            if (!layer) return void dist_defer(done, err);
            const path = parseurl_default()(req)?.pathname || '/';
            const route = layer.route;
            const lowerPath = path.toLowerCase();
            const lowerRoute = route.toLowerCase();
            if (!lowerPath.startsWith(lowerRoute)) return void next(err);
            const c = path.length > route.length ? path.charAt(route.length) : '';
            if ('' !== c && '/' !== c && '.' !== c) return void next(err);
            if (0 !== route.length && '/' !== route) {
                removed = route;
                req.url = protohost + (req.url || '').slice(protohost.length + removed.length);
                if (!protohost && '/' !== (req.url || '').charAt(0)) {
                    req.url = '/' + (req.url || '');
                    slashAdded = true;
                }
            }
            call(layer.handle, route, err, req, res, next);
        }
        next();
    },
    listen (...args) {
        const server = __rspack_external_node_http_2dc67212.createServer(this);
        return server.listen(...args);
    }
};
function call(handle, route, err, req, res, next) {
    const arity = handle.length;
    let error = err;
    const hasError = void 0 !== err;
    dist_debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
    try {
        if (hasError && 4 === arity) return void handle(err, req, res, next);
        if (!hasError && arity < 4) return void handle(req, res, next);
    } catch (caughtError) {
        error = caughtError;
    }
    next(error);
}
function logerror(err) {
    if ('test' !== dist_env) {
        if (err instanceof Error) return void console.error(err.stack || err.toString());
        console.error(String(err));
    }
}
function getProtohost(url) {
    if (0 === url.length || '/' === url[0]) return;
    const fqdnIndex = url.indexOf('://');
    return -1 !== fqdnIndex && -1 === url.lastIndexOf('?', fqdnIndex) ? url.slice(0, url.indexOf('/', 3 + fqdnIndex)) : void 0;
}
function isConnectHandle(value) {
    return 'function' == typeof value;
}
function isConnectServer(value) {
    return 'function' == typeof value && 'handle' in value && 'function' == typeof value.handle;
}
function isHttpServer(value) {
    return value instanceof __rspack_external_node_http_2dc67212.Server;
}
export { connect };
