import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __export, t as __commonJSMin } from "../rolldown-runtime.mjs";
import React from "react";

//#region node_modules/tunnel-rat/node_modules/zustand/esm/vanilla.mjs
var createStoreImpl, createStore;
var init_vanilla = __esmMin((() => {
	createStoreImpl = (createState) => {
		let state;
		const listeners = /* @__PURE__ */ new Set();
		const setState = (partial, replace) => {
			const nextState = typeof partial === "function" ? partial(state) : partial;
			if (!Object.is(nextState, state)) {
				const previousState = state;
				state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
				listeners.forEach((listener) => listener(state, previousState));
			}
		};
		const getState = () => state;
		const subscribe = (listener) => {
			listeners.add(listener);
			return () => listeners.delete(listener);
		};
		const destroy = () => {
			if ((import.meta.env ? import.meta.env.MODE : void 0) !== "production") console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");
			listeners.clear();
		};
		const api = {
			setState,
			getState,
			subscribe,
			destroy
		};
		state = createState(setState, getState, api);
		return api;
	};
	createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js
/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_use_sync_external_store_shim_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
	var e = __require("react");
	function h(a, b) {
		return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
	}
	var k = "function" === typeof Object.is ? Object.is : h, l = e.useState, m = e.useEffect, n = e.useLayoutEffect, p = e.useDebugValue;
	function q(a, b) {
		var d = b(), f = l({ inst: {
			value: d,
			getSnapshot: b
		} }), c = f[0].inst, g = f[1];
		n(function() {
			c.value = d;
			c.getSnapshot = b;
			r(c) && g({ inst: c });
		}, [
			a,
			d,
			b
		]);
		m(function() {
			r(c) && g({ inst: c });
			return a(function() {
				r(c) && g({ inst: c });
			});
		}, [a]);
		p(d);
		return d;
	}
	function r(a) {
		var b = a.getSnapshot;
		a = a.value;
		try {
			var d = b();
			return !k(a, d);
		} catch (f) {
			return !0;
		}
	}
	function t(a, b) {
		return b();
	}
	var u = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t : q;
	exports.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
/**
* @license React
* use-sync-external-store-shim.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJSMin(((exports) => {
	if (process.env.NODE_ENV !== "production") (function() {
		"use strict";
		if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
		var React$2 = __require("react");
		var ReactSharedInternals = React$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
		function error(format) {
			for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
			printWarning("error", format, args);
		}
		function printWarning(level, format, args) {
			var stack = ReactSharedInternals.ReactDebugCurrentFrame.getStackAddendum();
			if (stack !== "") {
				format += "%s";
				args = args.concat([stack]);
			}
			var argsWithFormat = args.map(function(item) {
				return String(item);
			});
			argsWithFormat.unshift("Warning: " + format);
			Function.prototype.apply.call(console[level], console, argsWithFormat);
		}
		/**
		* inlined Object.is polyfill to avoid requiring consumers ship their own
		* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
		*/
		function is(x, y) {
			return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
		}
		var objectIs = typeof Object.is === "function" ? Object.is : is;
		var useState$1 = React$2.useState, useEffect$1 = React$2.useEffect, useLayoutEffect$1 = React$2.useLayoutEffect, useDebugValue$1 = React$2.useDebugValue;
		var didWarnOld18Alpha = false;
		var didWarnUncachedGetSnapshot = false;
		function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
			if (!didWarnOld18Alpha) {
				if (React$2.startTransition !== void 0) {
					didWarnOld18Alpha = true;
					error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
				}
			}
			var value = getSnapshot();
			if (!didWarnUncachedGetSnapshot) {
				if (!objectIs(value, getSnapshot())) {
					error("The result of getSnapshot should be cached to avoid an infinite loop");
					didWarnUncachedGetSnapshot = true;
				}
			}
			var _useState = useState$1({ inst: {
				value,
				getSnapshot
			} }), inst = _useState[0].inst, forceUpdate = _useState[1];
			useLayoutEffect$1(function() {
				inst.value = value;
				inst.getSnapshot = getSnapshot;
				if (checkIfSnapshotChanged(inst)) forceUpdate({ inst });
			}, [
				subscribe,
				value,
				getSnapshot
			]);
			useEffect$1(function() {
				if (checkIfSnapshotChanged(inst)) forceUpdate({ inst });
				var handleStoreChange = function() {
					if (checkIfSnapshotChanged(inst)) forceUpdate({ inst });
				};
				return subscribe(handleStoreChange);
			}, [subscribe]);
			useDebugValue$1(value);
			return value;
		}
		function checkIfSnapshotChanged(inst) {
			var latestGetSnapshot = inst.getSnapshot;
			var prevValue = inst.value;
			try {
				return !objectIs(prevValue, latestGetSnapshot());
			} catch (error$1) {
				return true;
			}
		}
		function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
			return getSnapshot();
		}
		var shim = !!!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined") ? useSyncExternalStore$1 : useSyncExternalStore;
		var useSyncExternalStore$2 = React$2.useSyncExternalStore !== void 0 ? React$2.useSyncExternalStore : shim;
		exports.useSyncExternalStore = useSyncExternalStore$2;
		if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(/* @__PURE__ */ new Error());
	})();
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/shim/index.js
var require_shim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
	if (process.env.NODE_ENV === "production") module.exports = require_use_sync_external_store_shim_production_min();
	else module.exports = require_use_sync_external_store_shim_development();
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js
/**
* @license React
* use-sync-external-store-shim/with-selector.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_with_selector_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
	var h = __require("react"), n = require_shim();
	function p(a, b) {
		return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
	}
	var q = "function" === typeof Object.is ? Object.is : p, r = n.useSyncExternalStore, t = h.useRef, u = h.useEffect, v = h.useMemo, w = h.useDebugValue;
	exports.useSyncExternalStoreWithSelector = function(a, b, e$1, l, g) {
		var c = t(null);
		if (null === c.current) {
			var f = {
				hasValue: !1,
				value: null
			};
			c.current = f;
		} else f = c.current;
		c = v(function() {
			function a$1(a$2) {
				if (!c$1) {
					c$1 = !0;
					d$1 = a$2;
					a$2 = l(a$2);
					if (void 0 !== g && f.hasValue) {
						var b$1 = f.value;
						if (g(b$1, a$2)) return k = b$1;
					}
					return k = a$2;
				}
				b$1 = k;
				if (q(d$1, a$2)) return b$1;
				var e$2 = l(a$2);
				if (void 0 !== g && g(b$1, e$2)) return b$1;
				d$1 = a$2;
				return k = e$2;
			}
			var c$1 = !1, d$1, k, m = void 0 === e$1 ? null : e$1;
			return [function() {
				return a$1(b());
			}, null === m ? void 0 : function() {
				return a$1(m());
			}];
		}, [
			b,
			e$1,
			l,
			g
		]);
		var d = r(a, c[0], c[1]);
		u(function() {
			f.hasValue = !0;
			f.value = d;
		}, [d]);
		w(d);
		return d;
	};
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
/**
* @license React
* use-sync-external-store-shim/with-selector.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var require_with_selector_development = /* @__PURE__ */ __commonJSMin(((exports) => {
	if (process.env.NODE_ENV !== "production") (function() {
		"use strict";
		if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(/* @__PURE__ */ new Error());
		var React$2 = __require("react");
		var shim = require_shim();
		/**
		* inlined Object.is polyfill to avoid requiring consumers ship their own
		* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
		*/
		function is(x, y) {
			return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
		}
		var objectIs = typeof Object.is === "function" ? Object.is : is;
		var useSyncExternalStore = shim.useSyncExternalStore;
		var useRef$1 = React$2.useRef, useEffect$1 = React$2.useEffect, useMemo$1 = React$2.useMemo, useDebugValue$1 = React$2.useDebugValue;
		function useSyncExternalStoreWithSelector$1(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
			var instRef = useRef$1(null);
			var inst;
			if (instRef.current === null) {
				inst = {
					hasValue: false,
					value: null
				};
				instRef.current = inst;
			} else inst = instRef.current;
			var _useMemo = useMemo$1(function() {
				var hasMemo = false;
				var memoizedSnapshot;
				var memoizedSelection;
				var memoizedSelector = function(nextSnapshot) {
					if (!hasMemo) {
						hasMemo = true;
						memoizedSnapshot = nextSnapshot;
						var _nextSelection = selector(nextSnapshot);
						if (isEqual !== void 0) {
							if (inst.hasValue) {
								var currentSelection = inst.value;
								if (isEqual(currentSelection, _nextSelection)) {
									memoizedSelection = currentSelection;
									return currentSelection;
								}
							}
						}
						memoizedSelection = _nextSelection;
						return _nextSelection;
					}
					var prevSnapshot = memoizedSnapshot;
					var prevSelection = memoizedSelection;
					if (objectIs(prevSnapshot, nextSnapshot)) return prevSelection;
					var nextSelection = selector(nextSnapshot);
					if (isEqual !== void 0 && isEqual(prevSelection, nextSelection)) return prevSelection;
					memoizedSnapshot = nextSnapshot;
					memoizedSelection = nextSelection;
					return nextSelection;
				};
				var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
				var getSnapshotWithSelector = function() {
					return memoizedSelector(getSnapshot());
				};
				return [getSnapshotWithSelector, maybeGetServerSnapshot === null ? void 0 : function() {
					return memoizedSelector(maybeGetServerSnapshot());
				}];
			}, [
				getSnapshot,
				getServerSnapshot,
				selector,
				isEqual
			]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
			var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
			useEffect$1(function() {
				inst.hasValue = true;
				inst.value = value;
			}, [value]);
			useDebugValue$1(value);
			return value;
		}
		exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector$1;
		if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(/* @__PURE__ */ new Error());
	})();
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/use-sync-external-store/shim/with-selector.js
var require_with_selector = /* @__PURE__ */ __commonJSMin(((exports, module) => {
	if (process.env.NODE_ENV === "production") module.exports = require_with_selector_production_min();
	else module.exports = require_with_selector_development();
}));

//#endregion
//#region node_modules/tunnel-rat/node_modules/zustand/esm/index.js
var esm_exports = /* @__PURE__ */ __export({
	create: () => create,
	createStore: () => createStore,
	default: () => react,
	useStore: () => useStore
});
function useStore(api, selector = api.getState, equalityFn) {
	if (process.env.NODE_ENV !== "production" && equalityFn && !didWarnAboutEqualityFn) {
		console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937");
		didWarnAboutEqualityFn = true;
	}
	const slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getState, selector, equalityFn);
	useDebugValue(slice);
	return slice;
}
var import_with_selector, useDebugValue, useSyncExternalStoreWithSelector, didWarnAboutEqualityFn, createImpl, create, react;
var init_esm = __esmMin((() => {
	init_vanilla();
	init_vanilla();
	import_with_selector = /* @__PURE__ */ __toESM(require_with_selector());
	({useDebugValue} = React);
	({useSyncExternalStoreWithSelector} = import_with_selector.default);
	didWarnAboutEqualityFn = false;
	createImpl = (createState) => {
		if (process.env.NODE_ENV !== "production" && typeof createState !== "function") console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");
		const api = typeof createState === "function" ? createStore(createState) : createState;
		const useBoundStore = (selector, equalityFn) => useStore(api, selector, equalityFn);
		Object.assign(useBoundStore, api);
		return useBoundStore;
	};
	create = (createState) => createState ? createImpl(createState) : createImpl;
	react = (createState) => {
		if (process.env.NODE_ENV !== "production") console.warn("[DEPRECATED] Default export is deprecated. Instead use `import { create } from 'zustand'`.");
		return create(createState);
	};
}));

//#endregion
//#region node_modules/tunnel-rat/dist/index.cjs.js
var require_index_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
	var React$1 = __require("react");
	var zustand = (init_esm(), __toCommonJS(esm_exports));
	function _interopDefaultLegacy(e$1) {
		return e$1 && typeof e$1 === "object" && "default" in e$1 ? e$1 : { "default": e$1 };
	}
	var React__default = /* @__PURE__ */ _interopDefaultLegacy(React$1);
	var _window$document, _window$navigator;
	/**
	* An SSR-friendly useLayoutEffect.
	*
	* React currently throws a warning when using useLayoutEffect on the server.
	* To get around it, we can conditionally useEffect on the server (no-op) and
	* useLayoutEffect elsewhere.
	*
	* @see https://github.com/facebook/react/issues/14927
	*/
	const useIsomorphicLayoutEffect = typeof window !== "undefined" && ((_window$document = window.document) != null && _window$document.createElement || ((_window$navigator = window.navigator) == null ? void 0 : _window$navigator.product) === "ReactNative") ? React__default["default"].useLayoutEffect : React__default["default"].useEffect;
	function tunnel() {
		const useStore$1 = zustand.create((set) => ({
			current: new Array(),
			version: 0,
			set
		}));
		return {
			In: ({ children }) => {
				const set = useStore$1((state) => state.set);
				const version = useStore$1((state) => state.version);
				useIsomorphicLayoutEffect(() => {
					set((state) => ({ version: state.version + 1 }));
				}, []);
				useIsomorphicLayoutEffect(() => {
					set(({ current }) => ({ current: [...current, children] }));
					return () => set(({ current }) => ({ current: current.filter((c) => c !== children) }));
				}, [children, version]);
				return null;
			},
			Out: () => {
				const current = useStore$1((state) => state.current);
				return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, current);
			}
		};
	}
	module.exports = tunnel;
}));

//#endregion
export { require_index_cjs as t };