//#region node_modules/svelte/src/internal/disclose-version.js
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
//#endregion
//#region node_modules/svelte/src/constants.js
var e = {}, t = Symbol("uninitialized"), n = "http://www.w3.org/1999/xhtml", r = "http://www.w3.org/2000/svg", i = "http://www.w3.org/1998/Math/MathML", a = Array.isArray, o = Array.prototype.indexOf, s = Array.prototype.includes, c = Array.from, l = Object.keys, u = Object.defineProperty, d = Object.getOwnPropertyDescriptor, f = Object.getOwnPropertyDescriptors, p = Object.prototype, m = Array.prototype, h = Object.getPrototypeOf, g = Object.isExtensible, _ = () => {};
function v(e) {
	for (var t = 0; t < e.length; t++) e[t]();
}
function y() {
	var e, t;
	return {
		promise: new Promise((n, r) => {
			e = n, t = r;
		}),
		resolve: e,
		reject: t
	};
}
var b = 1024, x = 2048, S = 4096, C = 8192, ee = 16384, w = 32768, te = 1 << 25, ne = 65536, T = 1 << 19, re = 1 << 20, ie = 1 << 25, E = 65536, ae = 1 << 21, oe = 1 << 22, se = 1 << 23, ce = Symbol("$state"), le = Symbol("legacy props"), D = Symbol(""), ue = Symbol("attributes"), de = Symbol("class"), fe = Symbol("style"), pe = Symbol("text"), me = Symbol("form reset"), he = new class extends Error {
	name = "StaleReactionError";
	message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}(), ge = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
function _e(e) {
	throw Error("https://svelte.dev/e/lifecycle_outside_component");
}
//#endregion
//#region node_modules/svelte/src/internal/client/errors.js
function ve() {
	throw Error("https://svelte.dev/e/async_derived_orphan");
}
function O(e, t, n) {
	throw Error("https://svelte.dev/e/each_key_duplicate");
}
function ye(e) {
	throw Error("https://svelte.dev/e/effect_in_teardown");
}
function k() {
	throw Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function be(e) {
	throw Error("https://svelte.dev/e/effect_orphan");
}
function xe() {
	throw Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Se() {
	throw Error("https://svelte.dev/e/hydration_failed");
}
function Ce(e) {
	throw Error("https://svelte.dev/e/props_invalid_value");
}
function we() {
	throw Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Te() {
	throw Error("https://svelte.dev/e/state_prototype_fixed");
}
function Ee() {
	throw Error("https://svelte.dev/e/state_unsafe_mutation");
}
function De() {
	throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
function Oe() {
	console.warn("https://svelte.dev/e/derived_inert");
}
function ke(e) {
	console.warn("https://svelte.dev/e/hydration_mismatch");
}
function Ae() {
	console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/hydration.js
var A = !1;
function je(e) {
	A = e;
}
var j;
function Me(t) {
	if (t === null) throw ke(), e;
	return j = t;
}
function Ne() {
	return Me(/* @__PURE__ */ sn(j));
}
function M(t) {
	if (A) {
		if (/* @__PURE__ */ sn(j) !== null) throw ke(), e;
		j = t;
	}
}
function Pe(e = 1) {
	if (A) {
		for (var t = e, n = j; t--;) n = /* @__PURE__ */ sn(n);
		j = n;
	}
}
function Fe(e = !0) {
	for (var t = 0, n = j;;) {
		if (n.nodeType === 8) {
			var r = n.data;
			if (r === "]") {
				if (t === 0) return n;
				--t;
			} else (r === "[" || r === "[!" || r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
		}
		var i = /* @__PURE__ */ sn(n);
		e && n.remove(), n = i;
	}
}
function Ie(t) {
	if (!t || t.nodeType !== 8) throw ke(), e;
	return t.data;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/equality.js
function Le(e) {
	return e === this.v;
}
function Re(e, t) {
	return e == e ? e !== t || typeof e == "object" && !!e || typeof e == "function" : t == t;
}
function ze(e) {
	return !Re(e, this.v);
}
//#endregion
//#region node_modules/svelte/src/internal/client/context.js
var Be = null;
function Ve(e) {
	Be = e;
}
function He(e, t = !1, n) {
	Be = {
		p: Be,
		i: !1,
		c: null,
		e: null,
		s: e,
		x: null,
		r: H,
		l: null
	};
}
function Ue(e) {
	var t = Be, n = t.e;
	if (n !== null) {
		t.e = null;
		for (var r of n) yn(r);
	}
	return e !== void 0 && (t.x = e), t.i = !0, Be = t.p, e ?? {};
}
function We() {
	return !0;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/task.js
var Ge = [];
function Ke() {
	var e = Ge;
	Ge = [], v(e);
}
function qe(e) {
	if (Ge.length === 0 && !At) {
		var t = Ge;
		queueMicrotask(() => {
			t === Ge && Ke();
		});
	}
	Ge.push(e);
}
function Je() {
	for (; Ge.length > 0;) Ke();
}
function Ye(e) {
	var t = H;
	if (t === null) return V.f |= se, e;
	if (!(t.f & 32768) && !(t.f & 4)) throw e;
	Xe(e, t);
}
function Xe(e, t) {
	if (!(t !== null && t.f & 16384)) {
		for (; t !== null;) {
			if (t.f & 128) {
				if (!(t.f & 32768)) throw e;
				try {
					t.b.error(e);
					return;
				} catch (t) {
					e = t;
				}
			}
			t = t.parent;
		}
		throw e;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/status.js
var Ze = ~(x | S | b);
function Qe(e, t) {
	e.f = e.f & Ze | t;
}
function $e(e) {
	e.f & 512 || e.deps === null ? Qe(e, b) : Qe(e, S);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/utils.js
function et(e) {
	if (e !== null) for (let t of e) !(t.f & 2) || !(t.f & 65536) || (t.f ^= E, et(t.deps));
}
function tt(e, t, n) {
	e.f & 2048 ? t.add(e) : e.f & 4096 && n.add(e), et(e.deps), Qe(e, b);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/store.js
var nt = !1;
function rt(e) {
	var t = nt;
	try {
		return nt = !1, [e(), nt];
	} finally {
		nt = t;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/misc.js
function it(e) {
	A && /* @__PURE__ */ on(e) !== null && ln(e);
}
var at = !1;
function ot() {
	at || (at = !0, document.addEventListener("reset", (e) => {
		Promise.resolve().then(() => {
			if (!e.defaultPrevented) for (let t of e.target.elements) t[me]?.();
		});
	}, { capture: !0 }));
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
function st(e) {
	var t = V, n = H;
	Un(null), Wn(null);
	try {
		return e();
	} finally {
		Un(t), Wn(n);
	}
}
function ct(e, t, n, r = n) {
	e.addEventListener(t, () => st(n));
	let i = e[me];
	e[me] = i ? () => {
		i(), r(!0);
	} : () => r(!0), ot();
}
//#endregion
//#region node_modules/svelte/src/reactivity/create-subscriber.js
function lt(e) {
	let t = 0, n = Kt(0), r;
	return () => {
		gn() && (U(n), wn(() => (t === 0 && (r = dr(() => e(() => Xt(n)))), t += 1, () => {
			qe(() => {
				--t, t === 0 && (r?.(), r = void 0, Xt(n));
			});
		})));
	};
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/boundary.js
var ut = ne | T;
function dt(e, t, n, r) {
	new ft(e, t, n, r);
}
var ft = class {
	parent;
	is_pending = !1;
	transform_error;
	#e;
	#t = A ? j : null;
	#n;
	#r;
	#i;
	#a = null;
	#o = null;
	#s = null;
	#c = null;
	#l = 0;
	#u = 0;
	#d = !1;
	#f = /* @__PURE__ */ new Set();
	#p = /* @__PURE__ */ new Set();
	#m = null;
	#h = lt(() => (this.#m = Kt(this.#l), () => {
		this.#m = null;
	}));
	constructor(e, t, n, r) {
		this.#e = e, this.#n = t, this.#r = (e) => {
			var t = H;
			t.b = this, t.f |= 128, n(e);
		}, this.parent = H.b, this.transform_error = r ?? this.parent?.transform_error ?? ((e) => e), this.#i = Tn(() => {
			if (A) {
				let e = this.#t;
				Ne();
				let t = e.data === "[!";
				if (e.data.startsWith("[?")) {
					let t = JSON.parse(e.data.slice(2));
					this.#_(t);
				} else t ? this.#y() : this.#g();
			} else this.#b();
		}, ut), A && (this.#e = j);
	}
	#g() {
		try {
			this.#a = En(() => this.#r(this.#e));
		} catch (e) {
			this.error(e);
		}
	}
	#_(e) {
		let t = this.#n.failed, { reset: n, invoke_onerror: r } = this.#v(e);
		qe(r), t && (this.#s = En(() => {
			t(this.#e, () => e, () => n);
		}));
	}
	#v(e) {
		var t = !1, n = !1;
		let r = () => {
			if (t) {
				Ae();
				return;
			}
			t = !0, n && De(), this.#s !== null && Nn(this.#s, () => {
				this.#s = null;
			}), this.#S(() => {
				this.#b();
			});
		};
		return {
			reset: r,
			invoke_onerror: () => {
				try {
					n = !0, this.#n.onerror?.(e, r), n = !1;
				} catch (e) {
					Xe(e, this.#i && this.#i.parent);
				}
			}
		};
	}
	#y() {
		let e = this.#n.pending;
		e && (this.is_pending = !0, this.#o = En(() => e(this.#e)), qe(() => {
			var e = this.#c = document.createDocumentFragment(), t = an();
			e.append(t), this.#a = this.#S(() => En(() => this.#r(t))), this.#u === 0 && (this.#e.before(e), this.#c = null, Nn(this.#o, () => {
				this.#o = null;
			}), this.#x(P));
		}));
	}
	#b() {
		try {
			if (this.is_pending = this.has_pending_snippet(), this.#u = 0, this.#l = 0, this.#a = En(() => {
				this.#r(this.#e);
			}), this.#u > 0) {
				var e = this.#c = document.createDocumentFragment();
				Ln(this.#a, e);
				let t = this.#n.pending;
				this.#o = En(() => t(this.#e));
			} else this.#x(P);
		} catch (e) {
			this.error(e);
		}
	}
	#x(e) {
		this.is_pending = !1, e.transfer_effects(this.#f, this.#p);
	}
	defer_effect(e) {
		tt(e, this.#f, this.#p);
	}
	is_rendered() {
		return !this.is_pending && (!this.parent || this.parent.is_rendered());
	}
	has_pending_snippet() {
		return !!this.#n.pending;
	}
	#S(e) {
		var t = H, n = V, r = Be;
		Wn(this.#i), Un(this.#i), Ve(this.#i.ctx);
		try {
			return It.ensure(), e();
		} catch (e) {
			return Ye(e), null;
		} finally {
			Wn(t), Un(n), Ve(r);
		}
	}
	#C(e, t) {
		if (!this.has_pending_snippet()) {
			this.parent && this.parent.#C(e, t);
			return;
		}
		this.#u += e, this.#u === 0 && (this.#x(t), this.#o && Nn(this.#o, () => {
			this.#o = null;
		}), this.#c &&= (this.#e.before(this.#c), null));
	}
	update_pending_count(e, t) {
		this.#C(e, t), this.#l += e, !(!this.#m || this.#d) && (this.#d = !0, qe(() => {
			this.#d = !1, this.#m && Jt(this.#m, this.#l);
		}));
	}
	get_effect_pending() {
		return this.#h(), U(this.#m);
	}
	error(e) {
		if (!this.#n.onerror && !this.#n.failed) throw e;
		P?.is_fork ? (this.#a && P.skip_effect(this.#a), this.#o && P.skip_effect(this.#o), this.#s && P.skip_effect(this.#s), P.oncommit(() => {
			this.#w(e);
		})) : this.#w(e);
	}
	#w(e) {
		this.#a &&= (An(this.#a), null), this.#o &&= (An(this.#o), null), this.#s &&= (An(this.#s), null), A && (Me(this.#t), Pe(), Me(Fe()));
		let t = this.#n.failed, n = (e) => {
			let { reset: n, invoke_onerror: r } = this.#v(e);
			r(), t && (this.#s = this.#S(() => {
				try {
					return En(() => {
						var r = H;
						r.b = this, r.f |= 128, t(this.#e, () => e, () => n);
					});
				} catch (e) {
					return Xe(e, this.#i.parent), null;
				}
			}));
		};
		qe(() => {
			var t;
			try {
				t = this.transform_error(e);
			} catch (e) {
				Xe(e, this.#i && this.#i.parent);
				return;
			}
			typeof t == "object" && t && typeof t.then == "function" ? t.then(n, (e) => Xe(e, this.#i && this.#i.parent)) : n(t);
		});
	}
};
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/async.js
function pt(e, t, n, r) {
	let i = We() ? _t : bt;
	var a = e.filter((e) => !e.settled), o = t.map(i);
	if (n.length === 0 && a.length === 0) {
		r(o);
		return;
	}
	var s = H, c = mt(), l = a.length === 1 ? a[0].promise : a.length > 1 ? Promise.all(a.map((e) => e.promise)) : null;
	function u(e) {
		if (!(s.f & 16384)) {
			c();
			try {
				r([...o, ...e]);
			} catch (e) {
				Xe(e, s);
			}
			ht();
		}
	}
	var d = gt();
	if (n.length === 0) {
		l.then(() => u([])).finally(d);
		return;
	}
	function f() {
		Promise.all(n.map((e) => /* @__PURE__ */ yt(e))).then(u).catch((e) => Xe(e, s)).finally(d);
	}
	l ? l.then(() => {
		c(), f(), ht();
	}) : f();
}
function mt() {
	var e = H, t = V, n = Be, r = P;
	return function(i = !0) {
		Wn(e), Un(t), Ve(n), i && !(e.f & 16384) && (r?.activate(), r?.apply());
	};
}
function ht(e = !0) {
	Wn(null), Un(null), Ve(null), e && P?.deactivate();
}
function gt() {
	var e = H, t = e.b, n = P, r = !!t?.is_rendered();
	return t?.update_pending_count(1, n), n.increment(r, e), () => {
		t?.update_pending_count(-1, n), n.decrement(r, e);
	};
}
/*#__NO_SIDE_EFFECTS__*/
function _t(e) {
	var n = 2 | x;
	return H !== null && (H.f |= T), {
		ctx: Be,
		deps: null,
		effects: null,
		equals: Le,
		f: n,
		fn: e,
		reactions: null,
		rv: 0,
		v: t,
		wv: 0,
		parent: H,
		ac: null
	};
}
var vt = Symbol("obsolete");
/*#__NO_SIDE_EFFECTS__*/
function yt(e, n, r) {
	let i = H;
	i === null && ve();
	var a = void 0, o = Kt(t), s = !V, c = /* @__PURE__ */ new Set();
	return Cn(() => {
		var t = H, n = y();
		a = n.promise;
		try {
			Promise.resolve(e()).then(n.resolve, (e) => {
				e !== he && n.reject(e);
			}).finally(ht);
		} catch (e) {
			n.reject(e), ht();
		}
		var r = P;
		if (s) {
			if (t.f & 32768) var l = gt();
			if (i.b?.is_rendered()) r.async_deriveds.get(t)?.reject(vt);
			else for (let e of c.values()) e.reject(vt);
			c.add(n), r.async_deriveds.set(t, n);
		}
		let u = (e, t = void 0) => {
			l?.(), c.delete(n), t !== vt && (r.activate(), t ? (o.f |= se, Jt(o, t)) : (o.f & 8388608 && (o.f ^= se), Jt(o, e)), r.deactivate());
		};
		n.promise.then(u, (e) => u(null, e || "unknown"));
	}), _n(() => {
		for (let e of c) e.reject(vt);
	}), new Promise((e) => {
		function t(n) {
			function r() {
				n === a ? e(o) : t(a);
			}
			n.then(r, r);
		}
		t(a);
	});
}
/*#__NO_SIDE_EFFECTS__*/
function N(e) {
	let t = /* @__PURE__ */ _t(e);
	return Kn(t), t;
}
/*#__NO_SIDE_EFFECTS__*/
function bt(e) {
	let t = /* @__PURE__ */ _t(e);
	return t.equals = ze, t;
}
function xt(e) {
	var t = e.effects;
	if (t !== null) {
		e.effects = null;
		for (var n = 0; n < t.length; n += 1) An(t[n]);
	}
}
function St(e) {
	var n, r = H, i = e.parent;
	if (!Bn && i !== null && e.v !== t && i.f & 24576) return Oe(), e.v;
	Wn(i);
	try {
		e.f &= ~E, xt(e), n = ir(e);
	} finally {
		Wn(r);
	}
	return n;
}
function Ct(e) {
	var t = St(e);
	if (!e.equals(t) && (e.wv = tr(), (!P?.is_fork || e.deps === null) && (P === null ? e.v = t : (P.capture(e, t, !0), Dt?.capture(e, t, !0)), e.deps === null))) {
		Qe(e, b);
		return;
	}
	Bn || (Ot === null ? $e(e) : (gn() || P?.is_fork) && Ot.set(e, t));
}
function wt(e) {
	if (e.effects !== null) for (let t of e.effects) (t.teardown || t.ac) && (t.teardown?.(), t.ac !== null && st(() => {
		t.ac.abort(he), t.ac = null;
	}), t.fn !== null && (t.teardown = _), or(t, 0), On(t));
}
function Tt(e) {
	if (e.effects !== null) for (let t of e.effects) t.teardown && t.fn !== null && sr(t);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/batch.js
var Et = null, P = null, Dt = null, Ot = null, kt = null, At = !1, jt = !1, Mt = null, Nt = null, Pt = 0, Ft = 1, It = class e {
	id = Ft++;
	#e = !1;
	linked = !0;
	#t = null;
	#n = null;
	async_deriveds = /* @__PURE__ */ new Map();
	current = /* @__PURE__ */ new Map();
	previous = /* @__PURE__ */ new Map();
	#r = /* @__PURE__ */ new Set();
	#i = /* @__PURE__ */ new Set();
	#a = 0;
	#o = /* @__PURE__ */ new Map();
	#s = null;
	#c = [];
	#l = [];
	#u = /* @__PURE__ */ new Set();
	#d = /* @__PURE__ */ new Set();
	#f = /* @__PURE__ */ new Map();
	#p = /* @__PURE__ */ new Set();
	is_fork = !1;
	#m = !1;
	constructor() {
		Et === null ? Et = this : (Et.#n = this, this.#t = Et), Et = this;
	}
	#h() {
		if (this.is_fork) return !0;
		for (let n of this.#o.keys()) {
			for (var e = n, t = !1; e.parent !== null;) {
				if (this.#f.has(e)) {
					t = !0;
					break;
				}
				e = e.parent;
			}
			if (!t) return !0;
		}
		return !1;
	}
	skip_effect(e) {
		this.#f.has(e) || this.#f.set(e, {
			d: [],
			m: []
		}), this.#p.delete(e);
	}
	unskip_effect(e, t = (e) => this.schedule(e)) {
		var n = this.#f.get(e);
		if (n) {
			this.#f.delete(e);
			for (var r of n.d) Qe(r, x), t(r);
			for (r of n.m) Qe(r, S), t(r);
		}
		this.#p.add(e);
	}
	#g() {
		this.#e = !0, Pt++ > 1e3 && (this.#x(), Lt());
		for (let e of this.#u) this.#d.delete(e), Qe(e, x), this.schedule(e);
		for (let e of this.#d) Qe(e, S), this.schedule(e);
		let t = this.#c;
		this.#c = [], this.apply();
		var n = Mt = [], r = [], i = Nt = [];
		for (let e of t) try {
			this.#_(e, n, r);
		} catch (t) {
			throw Ht(e), this.#h() || this.discard(), t;
		}
		if (P = null, i.length > 0) {
			var a = e.ensure();
			for (let e of i) a.schedule(e);
		}
		if (Mt = null, Nt = null, this.#h()) {
			this.#b(r), this.#b(n);
			for (let [e, t] of this.#f) Vt(e, t);
			i.length > 0 && P.#g();
			return;
		}
		let o = this.#v();
		if (o) {
			this.#b(r), this.#b(n), o.#y(this);
			return;
		}
		this.#u.clear(), this.#d.clear();
		for (let e of this.#r) e(this);
		this.#r.clear(), Dt = this, zt(r), zt(n), Dt = null, this.#s?.resolve();
		var s = P;
		if (this.#a === 0 && (this.#c.length === 0 || s !== null) && this.#x(), this.#c.length > 0) {
			if (s !== null) {
				let e = s;
				e.#c.push(...this.#c.filter((t) => !e.#c.includes(t)));
			} else s = this;
		}
		s !== null && s.#g();
	}
	#_(e, t, n) {
		e.f ^= b;
		for (var r = e.first; r !== null;) {
			var i = r.f, a = !!(i & 96);
			if (!(a && i & 1024 || i & 8192 || this.#f.has(r)) && r.fn !== null) {
				a ? r.f ^= b : i & 4 ? t.push(r) : nr(r) && (i & 16 && this.#d.add(r), sr(r));
				var o = r.first;
				if (o !== null) {
					r = o;
					continue;
				}
			}
			for (; r !== null;) {
				var s = r.next;
				if (s !== null) {
					r = s;
					break;
				}
				r = r.parent;
			}
		}
	}
	#v() {
		for (var e = this.#t; e !== null;) {
			if (!e.is_fork) {
				for (let [t, [, n]] of this.current) if (e.current.has(t) && !n) return e;
			}
			e = e.#t;
		}
		return null;
	}
	#y(e) {
		for (let [t, n] of e.current) !this.previous.has(t) && e.previous.has(t) && this.previous.set(t, e.previous.get(t)), this.current.set(t, n);
		for (let [t, n] of e.async_deriveds) {
			let e = this.async_deriveds.get(t);
			e && n.promise.then(e.resolve).catch(e.reject);
		}
		e.async_deriveds.clear(), this.transfer_effects(e.#u, e.#d);
		let t = (e) => {
			var n = e.reactions;
			if (n !== null && !(e.f & 2 && !(e.f & 6144))) for (let e of n) {
				var r = e.f;
				if (r & 2) t(e);
				else {
					var i = e;
					r & 4194320 && !this.async_deriveds.has(i) && (this.#d.delete(i), Qe(i, x), this.schedule(i));
				}
			}
		};
		for (let e of this.current.keys()) t(e);
		this.oncommit(() => e.discard()), e.#x(), P = this, this.#g();
	}
	#b(e) {
		for (var t = 0; t < e.length; t += 1) tt(e[t], this.#u, this.#d);
	}
	capture(e, n, r = !1) {
		e.v !== t && !this.previous.has(e) && this.previous.set(e, e.v), e.f & 8388608 || (this.current.set(e, [n, r]), Ot?.set(e, n)), this.is_fork || (e.v = n);
	}
	activate() {
		P = this;
	}
	deactivate() {
		P = null, Ot = null;
	}
	flush() {
		try {
			jt = !0, P = this, this.#g();
		} finally {
			Pt = 0, kt = null, Mt = null, Nt = null, jt = !1, P = null, Ot = null, Wt.clear();
		}
	}
	discard() {
		for (let e of this.#i) e(this);
		this.#i.clear();
		for (let e of this.async_deriveds.values()) e.reject(vt);
		this.#x(), this.#s?.resolve();
	}
	register_created_effect(e) {
		this.#l.push(e);
	}
	increment(e, t) {
		if (this.#a += 1, e) {
			let e = this.#o.get(t) ?? 0;
			this.#o.set(t, e + 1);
		}
	}
	decrement(e, t) {
		if (--this.#a, e) {
			let e = this.#o.get(t) ?? 0;
			e === 1 ? this.#o.delete(t) : this.#o.set(t, e - 1);
		}
		this.#m || (this.#m = !0, qe(() => {
			this.#m = !1, this.linked && this.flush();
		}));
	}
	transfer_effects(e, t) {
		for (let t of e) this.#u.add(t);
		for (let e of t) this.#d.add(e);
		e.clear(), t.clear();
	}
	oncommit(e) {
		this.#r.add(e);
	}
	ondiscard(e) {
		this.#i.add(e);
	}
	settled() {
		return (this.#s ??= y()).promise;
	}
	static ensure() {
		if (P === null) {
			let t = P = new e();
			!jt && !At && qe(() => {
				t.#e || t.flush();
			});
		}
		return P;
	}
	apply() {
		Ot = null;
	}
	schedule(e) {
		if (kt = e, e.b?.is_pending && e.f & 16777228 && !(e.f & 32768)) {
			e.b.defer_effect(e);
			return;
		}
		for (var t = e; t.parent !== null;) {
			t = t.parent;
			var n = t.f;
			if (Mt !== null && t === H && (V === null || !(V.f & 2))) return;
			if (n & 96) {
				if (!(n & 1024)) return;
				t.f ^= b;
			}
		}
		this.#c.push(t);
	}
	#x() {
		if (this.linked) {
			var e = this.#t, t = this.#n;
			e === null || (e.#n = t), t === null ? Et = e : t.#t = e, this.linked = !1;
		}
	}
};
function F(e) {
	var t = At;
	At = !0;
	try {
		var n;
		for (e && (P !== null && !P.is_fork && P.flush(), n = e());;) {
			if (Je(), P === null) return n;
			P.flush();
		}
	} finally {
		At = t;
	}
}
function Lt() {
	try {
		xe();
	} catch (e) {
		Xe(e, kt);
	}
}
var Rt = null;
function zt(e) {
	var t = e.length;
	if (t !== 0) {
		for (var n = 0; n < t;) {
			var r = e[n++];
			if (!(r.f & 24576) && nr(r) && (Rt = /* @__PURE__ */ new Set(), sr(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Mn(r), Rt?.size > 0)) {
				Wt.clear();
				for (let e of Rt) {
					if (e.f & 24576) continue;
					let t = [e], n = e.parent;
					for (; n !== null;) Rt.has(n) && (Rt.delete(n), t.push(n)), n = n.parent;
					for (let e = t.length - 1; e >= 0; e--) {
						let n = t[e];
						n.f & 24576 || sr(n);
					}
				}
				Rt.clear();
			}
		}
		Rt = null;
	}
}
function Bt(e) {
	P.schedule(e);
}
function Vt(e, t) {
	if (!(e.f & 32 && e.f & 1024)) {
		e.f & 2048 ? t.d.push(e) : e.f & 4096 && t.m.push(e), Qe(e, b);
		for (var n = e.first; n !== null;) Vt(n, t), n = n.next;
	}
}
function Ht(e) {
	Qe(e, b);
	for (var t = e.first; t !== null;) Ht(t), t = t.next;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/sources.js
var Ut = /* @__PURE__ */ new Set(), Wt = /* @__PURE__ */ new Map(), Gt = !1;
function Kt(e, t) {
	return {
		f: 0,
		v: e,
		reactions: null,
		equals: Le,
		rv: 0,
		wv: 0
	};
}
/*#__NO_SIDE_EFFECTS__*/
function I(e, t) {
	let n = Kt(e, t);
	return Kn(n), n;
}
/*#__NO_SIDE_EFFECTS__*/
function qt(e, t = !1, n = !0) {
	let r = Kt(e);
	return t || (r.equals = ze), r;
}
function L(e, t, n = !1) {
	return V !== null && (!Hn || V.f & 131072) && We() && V.f & 4325394 && (Gn === null || !Gn.has(e)) && Ee(), Jt(e, n ? Qt(t) : t, Nt);
}
function Jt(e, t, n = null) {
	if (!e.equals(t)) {
		Wt.set(e, Bn ? t : e.v);
		var r = It.ensure();
		if (r.capture(e, t), e.f & 2) {
			let t = e;
			e.f & 2048 && St(t), Ot === null && $e(t);
		}
		e.wv = tr(), Zt(e, x, n), We() && H !== null && H.f & 1024 && !(H.f & 96) && (Yn === null ? Xn([e]) : Yn.push(e)), !r.is_fork && Ut.size > 0 && !Gt && Yt();
	}
	return t;
}
function Yt() {
	Gt = !1;
	for (let e of Ut) {
		e.f & 1024 && Qe(e, S);
		let t;
		try {
			t = nr(e);
		} catch {
			t = !0;
		}
		t && sr(e);
	}
	Ut.clear();
}
function Xt(e) {
	L(e, e.v + 1);
}
function Zt(e, t, n) {
	var r = e.reactions;
	if (r !== null) for (var i = We(), a = r.length, o = 0; o < a; o++) {
		var s = r[o], c = s.f;
		if (!(!i && s === H)) {
			var l = (c & x) === 0;
			if (l && Qe(s, t), c & 131072) Ut.add(s);
			else if (c & 2) {
				var u = s;
				Ot?.delete(u), c & 65536 || (c & 512 && (H === null || !(H.f & 2097152)) && (s.f |= E), Zt(u, S, n));
			} else if (l) {
				var d = s;
				c & 16 && Rt !== null && Rt.add(d), n === null ? Bt(d) : n.push(d);
			}
		}
	}
}
function Qt(e) {
	if (typeof e != "object" || !e || ce in e) return e;
	let n = h(e);
	if (n !== p && n !== m) return e;
	var r = /* @__PURE__ */ new Map(), i = a(e), o = /* @__PURE__ */ I(0), s = null, c = $n, l = (e) => {
		if ($n === c) return e();
		var t = V, n = $n;
		Un(null), er(c);
		var r = e();
		return Un(t), er(n), r;
	};
	return i && r.set("length", /* @__PURE__ */ I(e.length, s)), new Proxy(e, {
		defineProperty(e, t, n) {
			(!("value" in n) || n.configurable === !1 || n.enumerable === !1 || n.writable === !1) && we();
			var i = r.get(t);
			return i === void 0 ? l(() => {
				var e = /* @__PURE__ */ I(n.value, s);
				return r.set(t, e), e;
			}) : L(i, n.value, !0), !0;
		},
		deleteProperty(e, n) {
			var i = r.get(n);
			if (i === void 0) {
				if (n in e) {
					let e = l(() => /* @__PURE__ */ I(t, s));
					r.set(n, e), Xt(o);
				}
			} else L(i, t), Xt(o);
			return !0;
		},
		get(n, i, a) {
			if (i === ce) return e;
			var o = r.get(i), c = i in n;
			if (o === void 0 && (!c || d(n, i)?.writable) && (o = l(() => /* @__PURE__ */ I(Qt(c ? n[i] : t), s)), r.set(i, o)), o !== void 0) {
				var u = U(o);
				return u === t ? void 0 : u;
			}
			return Reflect.get(n, i, a);
		},
		getOwnPropertyDescriptor(e, n) {
			var i = Reflect.getOwnPropertyDescriptor(e, n);
			if (i && "value" in i) {
				var a = r.get(n);
				a && (i.value = U(a));
			} else if (i === void 0) {
				var o = r.get(n), s = o?.v;
				if (o !== void 0 && s !== t) return {
					enumerable: !0,
					configurable: !0,
					value: s,
					writable: !0
				};
			}
			return i;
		},
		has(e, n) {
			if (n === ce) return !0;
			var i = r.get(n), a = i !== void 0 && i.v !== t || Reflect.has(e, n);
			return (i !== void 0 || H !== null && (!a || d(e, n)?.writable)) && (i === void 0 && (i = l(() => /* @__PURE__ */ I(a ? Qt(e[n]) : t, s)), r.set(n, i)), U(i) === t) ? !1 : a;
		},
		set(e, n, a, c) {
			var u = r.get(n), f = n in e;
			if (i && n === "length") for (var p = a; p < u.v; p += 1) {
				var m = r.get(p + "");
				m === void 0 ? p in e && (m = l(() => /* @__PURE__ */ I(t, s)), r.set(p + "", m)) : L(m, t);
			}
			if (u === void 0) (!f || d(e, n)?.writable) && (u = l(() => /* @__PURE__ */ I(void 0, s)), L(u, Qt(a)), r.set(n, u));
			else {
				f = u.v !== t;
				var h = l(() => Qt(a));
				L(u, h);
			}
			var g = Reflect.getOwnPropertyDescriptor(e, n);
			if (g?.set && g.set.call(c, a), !f) {
				if (i && typeof n == "string") {
					var _ = r.get("length"), v = Number(n);
					Number.isInteger(v) && v >= _.v && L(_, v + 1);
				}
				Xt(o);
			}
			return !0;
		},
		ownKeys(e) {
			U(o);
			var n = Reflect.ownKeys(e).filter((e) => {
				var n = r.get(e);
				return n === void 0 || n.v !== t;
			});
			for (var [i, a] of r) a.v !== t && !(i in e) && n.push(i);
			return n;
		},
		setPrototypeOf() {
			Te();
		}
	});
}
var $t, en, tn, nn;
function rn() {
	if ($t === void 0) {
		$t = window, en = /Firefox/.test(navigator.userAgent);
		var e = Element.prototype, t = Node.prototype, n = Text.prototype;
		tn = d(t, "firstChild").get, nn = d(t, "nextSibling").get, g(e) && (e[de] = void 0, e[ue] = null, e[fe] = void 0, e.__e = void 0), g(n) && (n[pe] = void 0);
	}
}
function an(e = "") {
	return document.createTextNode(e);
}
/*@__NO_SIDE_EFFECTS__*/
function on(e) {
	return tn.call(e);
}
/*@__NO_SIDE_EFFECTS__*/
function sn(e) {
	return nn.call(e);
}
function R(e, t) {
	if (!A) return /* @__PURE__ */ on(e);
	var n = /* @__PURE__ */ on(j);
	if (n === null) n = j.appendChild(an());
	else if (t && n.nodeType !== 3) {
		var r = an();
		return n?.before(r), Me(r), r;
	}
	return t && fn(n), Me(n), n;
}
function cn(e, t = !1) {
	if (!A) {
		var n = /* @__PURE__ */ on(e);
		return n instanceof Comment && n.data === "" ? /* @__PURE__ */ sn(n) : n;
	}
	if (t) {
		if (j?.nodeType !== 3) {
			var r = an();
			return j?.before(r), Me(r), r;
		}
		fn(j);
	}
	return j;
}
function z(e, t = 1, n = !1) {
	let r = A ? j : e;
	for (var i; t--;) i = r, r = /* @__PURE__ */ sn(r);
	if (!A) return r;
	if (n) {
		if (r?.nodeType !== 3) {
			var a = an();
			return r === null ? i?.after(a) : r.before(a), Me(a), a;
		}
		fn(r);
	}
	return Me(r), r;
}
function ln(e) {
	e.textContent = "";
}
function un() {
	return !1;
}
function dn(e, t, n) {
	return t == null || t === "http://www.w3.org/1999/xhtml" ? n ? document.createElement(e, { is: n }) : document.createElement(e) : n ? document.createElementNS(t, e, { is: n }) : document.createElementNS(t, e);
}
function fn(e) {
	if (e.nodeValue.length < 65536) return;
	let t = e.nextSibling;
	for (; t !== null && t.nodeType === 3;) t.remove(), e.nodeValue += t.nodeValue, t = e.nextSibling;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/effects.js
function pn(e) {
	H === null && (V === null && be(e), k()), Bn && ye(e);
}
function mn(e, t) {
	var n = t.last;
	n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
}
function hn(e, t) {
	var n = H;
	n !== null && n.f & 8192 && (e |= C);
	var r = {
		ctx: Be,
		deps: null,
		nodes: null,
		f: e | x | 512,
		first: null,
		fn: t,
		last: null,
		next: null,
		parent: n,
		b: n && n.b,
		prev: null,
		teardown: null,
		wv: 0,
		ac: null
	};
	P?.register_created_effect(r);
	var i = r;
	if (e & 4) Mt === null ? It.ensure().schedule(r) : Mt.push(r);
	else if (t !== null) {
		try {
			sr(r);
		} catch (e) {
			throw An(r), e;
		}
		i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && !(i.f & 524288) && (i = i.first, e & 16 && e & 65536 && i !== null && (i.f |= ne));
	}
	if (i !== null && (i.parent = n, n !== null && mn(i, n), V !== null && V.f & 2 && !(e & 64))) {
		var a = V;
		(a.effects ??= []).push(i);
	}
	return r;
}
function gn() {
	return V !== null && !Hn;
}
function _n(e) {
	let t = hn(8, null);
	return Qe(t, b), t.teardown = e, t;
}
function vn(e) {
	pn("$effect");
	var t = H.f;
	if (!V && t & 32 && Be !== null && !Be.i) {
		var n = Be;
		(n.e ??= []).push(e);
	} else return yn(e);
}
function yn(e) {
	return hn(4 | re, e);
}
function bn(e) {
	It.ensure();
	let t = hn(64 | T, e);
	return () => {
		An(t);
	};
}
function xn(e) {
	It.ensure();
	let t = hn(64 | T, e);
	return (e = {}) => new Promise((n) => {
		e.outro ? Nn(t, () => {
			An(t), n(void 0);
		}) : (An(t), n(void 0));
	});
}
function Sn(e) {
	return hn(4, e);
}
function Cn(e) {
	return hn(oe | T, e);
}
function wn(e, t = 0) {
	return hn(8 | t, e);
}
function B(e, t = [], n = [], r = []) {
	pt(r, t, n, (t) => {
		hn(8, () => {
			e(...t.map(U));
		});
	});
}
function Tn(e, t = 0) {
	return hn(16 | t, e);
}
function En(e) {
	return hn(32 | T, e);
}
function Dn(e) {
	var t = e.teardown;
	if (t !== null) {
		let e = Bn, n = V;
		Vn(!0), Un(null);
		try {
			t.call(null);
		} finally {
			Vn(e), Un(n);
		}
	}
}
function On(e, t = !1) {
	var n = e.first;
	for (e.first = e.last = null; n !== null;) {
		let e = n.ac;
		e !== null && st(() => {
			e.abort(he);
		});
		var r = n.next;
		n.f & 64 ? n.parent = null : An(n, t), n = r;
	}
}
function kn(e) {
	for (var t = e.first; t !== null;) {
		var n = t.next;
		t.f & 32 || An(t), t = n;
	}
}
function An(e, t = !0) {
	var n = !1;
	(t || e.f & 262144) && e.nodes !== null && e.nodes.end !== null && (jn(e.nodes.start, e.nodes.end), n = !0), e.f |= te, On(e, t && !n), or(e, 0);
	var r = e.nodes && e.nodes.t;
	if (r !== null) for (let e of r) e.stop();
	Dn(e), e.f ^= te, e.f |= ee;
	var i = e.parent;
	i !== null && i.first !== null && Mn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
}
function jn(e, t) {
	for (; e !== null;) {
		var n = e === t ? null : /* @__PURE__ */ sn(e);
		e.remove(), e = n;
	}
}
function Mn(e) {
	var t = e.parent, n = e.prev, r = e.next;
	n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
}
function Nn(e, t, n = !0) {
	var r = [];
	Pn(e, r, !0);
	var i = () => {
		n && An(e), t && t();
	}, a = r.length;
	if (a > 0) {
		var o = () => --a || i();
		for (var s of r) s.out(o);
	} else i();
}
function Pn(e, t, n) {
	if (!(e.f & 8192)) {
		e.f ^= C;
		var r = e.nodes && e.nodes.t;
		if (r !== null) for (let e of r) (e.is_global || n) && t.push(e);
		for (var i = e.first; i !== null;) {
			var a = i.next;
			if (!(i.f & 64)) {
				var o = !!(i.f & 65536) || !!(i.f & 32) && !!(e.f & 16);
				Pn(i, t, o ? n : !1);
			}
			i = a;
		}
	}
}
function Fn(e) {
	In(e, !0);
}
function In(e, t) {
	if (e.f & 8192) {
		e.f ^= C, e.f & 1024 || (Qe(e, x), It.ensure().schedule(e));
		for (var n = e.first; n !== null;) {
			var r = n.next, i = !!(n.f & 65536) || !!(n.f & 32);
			In(n, i ? t : !1), n = r;
		}
		var a = e.nodes && e.nodes.t;
		if (a !== null) for (let e of a) (e.is_global || t) && e.in();
	}
}
function Ln(e, t) {
	if (e.nodes) for (var n = e.nodes.start, r = e.nodes.end; n !== null;) {
		var i = n === r ? null : /* @__PURE__ */ sn(n);
		t.append(n), n = i;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/legacy.js
var Rn = null, zn = !1, Bn = !1;
function Vn(e) {
	Bn = e;
}
var V = null, Hn = !1;
function Un(e) {
	V = e;
}
var H = null;
function Wn(e) {
	H = e;
}
var Gn = null;
function Kn(e) {
	V !== null && (Gn ??= /* @__PURE__ */ new Set()).add(e);
}
var qn = null, Jn = 0, Yn = null;
function Xn(e) {
	Yn = e;
}
var Zn = 1, Qn = 0, $n = Qn;
function er(e) {
	$n = e;
}
function tr() {
	return ++Zn;
}
function nr(e) {
	var t = e.f;
	if (t & 2048) return !0;
	if (t & 2 && (e.f &= ~E), t & 4096) {
		for (var n = e.deps, r = n.length, i = 0; i < r; i++) {
			var a = n[i];
			if (nr(a) && Ct(a), a.wv > e.wv) return !0;
		}
		t & 512 && Ot === null && Qe(e, b);
	}
	return !1;
}
function rr(e, t, n = !0) {
	var r = e.reactions;
	if (r !== null && !(Gn !== null && Gn.has(e))) for (var i = 0; i < r.length; i++) {
		var a = r[i];
		a.f & 2 ? rr(a, t, !1) : t === a && (n ? Qe(a, x) : a.f & 1024 && Qe(a, S), Bt(a));
	}
}
function ir(e) {
	var t = qn, n = Jn, r = Yn, i = V, a = Gn, o = Be, s = Hn, c = $n, l = e.f;
	qn = null, Jn = 0, Yn = null, V = l & 96 ? null : e, Gn = null, Ve(e.ctx), Hn = !1, $n = ++Qn, e.ac !== null && (st(() => {
		e.ac.abort(he);
	}), e.ac = null);
	try {
		e.f |= ae;
		var u = e.fn, d = u();
		e.f |= w;
		var f = e.deps, p = P?.is_fork;
		if (qn !== null) {
			var m;
			if (p || or(e, Jn), f !== null && Jn > 0) for (f.length = Jn + qn.length, m = 0; m < qn.length; m++) f[Jn + m] = qn[m];
			else e.deps = f = qn;
			if (gn() && e.f & 512) for (m = Jn; m < f.length; m++) (f[m].reactions ??= []).push(e);
		} else !p && f !== null && Jn < f.length && (or(e, Jn), f.length = Jn);
		if (We() && Yn !== null && !Hn && f !== null && !(e.f & 6146)) for (m = 0; m < Yn.length; m++) rr(Yn[m], e);
		if (i !== null && i !== e) {
			if (Qn++, i.deps !== null) for (let e = 0; e < n; e += 1) i.deps[e].rv = Qn;
			if (t !== null) for (let e of t) e.rv = Qn;
			Yn !== null && (r === null ? r = Yn : r.push(...Yn));
		}
		return e.f & 8388608 && (e.f ^= se), d;
	} catch (e) {
		return Ye(e);
	} finally {
		e.f ^= ae, qn = t, Jn = n, Yn = r, V = i, Gn = a, Ve(o), Hn = s, $n = c;
	}
}
function ar(e, n) {
	let r = n.reactions;
	if (r !== null) {
		var i = o.call(r, e);
		if (i !== -1) {
			var a = r.length - 1;
			a === 0 ? r = n.reactions = null : (r[i] = r[a], r.pop());
		}
	}
	if (r === null && n.f & 2 && (qn === null || !s.call(qn, n))) {
		var c = n;
		c.f & 512 && (c.f ^= 512, c.f &= ~E), c.v !== t && $e(c), c.ac !== null && st(() => {
			c.ac.abort(he), c.ac = null, Qe(c, x);
		}), wt(c), or(c, 0);
	}
}
function or(e, t) {
	var n = e.deps;
	if (n !== null) for (var r = t; r < n.length; r++) ar(e, n[r]);
}
function sr(e) {
	var t = e.f;
	if (!(t & 16384)) {
		Qe(e, b);
		var n = H, r = zn;
		H = e, zn = !(t & 96);
		try {
			t & 16777232 ? kn(e) : On(e), Dn(e);
			var i = ir(e);
			e.teardown = typeof i == "function" ? i : null, e.wv = Zn;
		} finally {
			zn = r, H = n;
		}
	}
}
async function cr() {
	await Promise.resolve(), F();
}
function U(e) {
	var t = !!(e.f & 2);
	if (Rn?.add(e), V !== null && !Hn && !(H !== null && H.f & 16384) && (Gn === null || !Gn.has(e))) {
		var n = V.deps;
		if (V.f & 2097152) e.rv < Qn && (e.rv = Qn, qn === null && n !== null && n[Jn] === e ? Jn++ : qn === null ? qn = [e] : qn.push(e));
		else {
			V.deps ??= [], s.call(V.deps, e) || V.deps.push(e);
			var r = e.reactions;
			r === null ? e.reactions = [V] : s.call(r, V) || r.push(V);
		}
	}
	if (Bn && Wt.has(e)) return Wt.get(e);
	if (t) {
		var i = e;
		if (Bn) {
			var a = i.v;
			return (!(i.f & 1024) && i.reactions !== null || ur(i)) && (a = St(i)), Wt.set(i, a), a;
		}
		var o = !(i.f & 512) && !Hn && V !== null && (zn || !!(V.f & 512)), c = (i.f & w) === 0;
		nr(i) && (o && (i.f |= 512), Ct(i)), o && !c && (Tt(i), lr(i));
	}
	if (Ot?.has(e)) return Ot.get(e);
	if (e.f & 8388608) throw e.v;
	return e.v;
}
function lr(e) {
	if (e.f |= 512, e.deps !== null) for (let t of e.deps) (t.reactions ??= []).push(e), t.f & 2 && !(t.f & 512) && (Tt(t), lr(t));
}
function ur(e) {
	if (e.v === t) return !0;
	if (e.deps === null) return !1;
	for (let t of e.deps) if (Wt.has(t) || t.f & 2 && ur(t)) return !0;
	return !1;
}
function dr(e) {
	var t = Hn;
	try {
		return Hn = !0, e();
	} finally {
		Hn = t;
	}
}
function fr(e) {
	if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
		if (ce in e) pr(e);
		else if (!Array.isArray(e)) for (let t in e) {
			let n = e[t];
			typeof n == "object" && n && ce in n && pr(n);
		}
	}
}
function pr(e, t = /* @__PURE__ */ new Set()) {
	if (typeof e == "object" && e && !(e instanceof EventTarget) && !t.has(e)) {
		t.add(e), e instanceof Date && e.getTime();
		for (let n in e) try {
			pr(e[n], t);
		} catch {}
		let n = h(e);
		if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
			let t = f(n);
			for (let n in t) {
				let r = t[n].get;
				if (r) try {
					r.call(e);
				} catch {}
			}
		}
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/events.js
var mr = Symbol("events"), hr = /* @__PURE__ */ new Set(), gr = /* @__PURE__ */ new Set();
function _r(e, t, n, r = {}) {
	function i(e) {
		if (r.capture || xr.call(t, e), !e.cancelBubble) return st(() => n?.call(this, e));
	}
	return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? qe(() => {
		t.addEventListener(e, i, r);
	}) : t.addEventListener(e, i, r), i;
}
function vr(e, t, n, r, i) {
	var a = {
		capture: r,
		passive: i
	}, o = _r(e, t, n, a);
	(t === document.body || t === window || t === document || t instanceof HTMLMediaElement) && _n(() => {
		t.removeEventListener(e, o, a);
	});
}
function W(e, t, n) {
	(t[mr] ??= {})[e] = n;
}
function yr(e) {
	for (var t = 0; t < e.length; t++) hr.add(e[t]);
	for (var n of gr) n(e);
}
var br = null;
function xr(e) {
	var t = this, n = t.ownerDocument, r = e.type, i = e.composedPath?.() || [], a = i[0] || e.target;
	br = e;
	var o = 0, s = br === e && e[mr];
	if (s) {
		var c = i.indexOf(s);
		if (c !== -1 && (t === document || t === window)) {
			e[mr] = t;
			return;
		}
		var l = i.indexOf(t);
		if (l === -1) return;
		c <= l && (o = c);
	}
	if (a = i[o] || e.target, a !== t) {
		u(e, "currentTarget", {
			configurable: !0,
			get() {
				return a || n;
			}
		});
		var d = V, f = H;
		Un(null), Wn(null);
		try {
			for (var p, m = []; a !== null && a !== t;) {
				try {
					var h = a[mr]?.[r];
					h != null && (!a.disabled || e.target === a) && h.call(a, e);
				} catch (e) {
					p ? m.push(e) : p = e;
				}
				if (e.cancelBubble) break;
				o++, a = o < i.length ? i[o] : null;
			}
			if (p) {
				for (let e of m) queueMicrotask(() => {
					throw e;
				});
				throw p;
			}
		} finally {
			e[mr] = t, delete e.currentTarget, Un(d), Wn(f);
		}
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/reconciler.js
var Sr = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (e) => e });
function Cr(e) {
	return Sr?.createHTML(e) ?? e;
}
function wr(e) {
	var t = dn("template");
	return t.innerHTML = Cr(e.replaceAll("<!>", "<!---->")), t.content;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/template.js
function Tr(e, t) {
	var n = H;
	n.nodes === null && (n.nodes = {
		start: e,
		end: t,
		a: null,
		t: null
	});
}
/*#__NO_SIDE_EFFECTS__*/
function G(e, t) {
	var n = !!(t & 1), r = !!(t & 2), i, a = !e.startsWith("<!>");
	return () => {
		if (A) return Tr(j, null), j;
		i === void 0 && (i = wr(a ? e : "<!>" + e), n || (i = /* @__PURE__ */ on(i)));
		var t = r || en ? document.importNode(i, !0) : i.cloneNode(!0);
		if (n) {
			var o = /* @__PURE__ */ on(t), s = t.lastChild;
			Tr(o, s);
		} else Tr(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Er(e, t, n = "svg") {
	var r = !e.startsWith("<!>"), i = !!(t & 1), a = `<${n}>${r ? e : "<!>" + e}</${n}>`, o;
	return () => {
		if (A) return Tr(j, null), j;
		if (!o) {
			var e = /* @__PURE__ */ on(wr(a));
			if (i) for (o = document.createDocumentFragment(); /* @__PURE__ */ on(e);) o.appendChild(/* @__PURE__ */ on(e));
			else o = /* @__PURE__ */ on(e);
		}
		var t = o.cloneNode(!0);
		if (i) {
			var n = /* @__PURE__ */ on(t), r = t.lastChild;
			Tr(n, r);
		} else Tr(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Dr(e, t) {
	return /* @__PURE__ */ Er(e, t, "svg");
}
function Or(e = "") {
	if (!A) {
		var t = an(e + "");
		return Tr(t, t), t;
	}
	var n = j;
	return n.nodeType === 3 ? fn(n) : (n.before(n = an()), Me(n)), Tr(n, n), n;
}
function kr() {
	if (A) return Tr(j, null), j;
	var e = document.createDocumentFragment(), t = document.createComment(""), n = an();
	return e.append(t, n), Tr(t, n), e;
}
function K(e, t) {
	if (A) {
		var n = H;
		(!(n.f & 32768) || n.nodes.end === null) && (n.nodes.end = j), Ne();
		return;
	}
	e !== null && e.before(t);
}
[.../* @__PURE__ */ "allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback".split(".")];
var Ar = ["touchstart", "touchmove"];
function jr(e) {
	return Ar.includes(e);
}
function q(e, t) {
	var n = t == null ? "" : typeof t == "object" ? `${t}` : t;
	n !== (e[pe] ??= e.nodeValue) && (e[pe] = n, e.nodeValue = `${n}`);
}
function Mr(e, t) {
	return Fr(e, t);
}
function Nr(t, n) {
	rn(), n.intro = n.intro ?? !1;
	let r = n.target, i = A, a = j;
	try {
		for (var o = /* @__PURE__ */ on(r); o && (o.nodeType !== 8 || o.data !== "[");) o = /* @__PURE__ */ sn(o);
		if (!o) throw e;
		je(!0), Me(o);
		let i = Fr(t, {
			...n,
			anchor: o
		});
		return je(!1), i;
	} catch (i) {
		if (i instanceof Error && i.message.split("\n").some((e) => e.startsWith("https://svelte.dev/e/"))) throw i;
		return i !== e && console.warn("Failed to hydrate: ", i), n.recover === !1 && Se(), rn(), ln(r), je(!1), Mr(t, n);
	} finally {
		je(i), Me(a);
	}
}
var Pr = /* @__PURE__ */ new Map();
function Fr(t, { target: n, anchor: r, props: i = {}, events: a, context: o, intro: s = !0, transformError: l }) {
	rn();
	var u = void 0, d = xn(() => {
		var s = r ?? n.appendChild(an());
		dt(s, { pending: () => {} }, (n) => {
			He({});
			var r = Be;
			if (o && (r.c = o), a && (i.$$events = a), A && Tr(n, null), u = t(n, i) || {}, A && (H.nodes.end = j, j === null || j.nodeType !== 8 || j.data !== "]")) throw ke(), e;
			Ue();
		}, l);
		var d = /* @__PURE__ */ new Set(), f = (e) => {
			for (var t = 0; t < e.length; t++) {
				var r = e[t];
				if (!d.has(r)) {
					d.add(r);
					var i = jr(r);
					for (let e of [n, document]) {
						var a = Pr.get(e);
						a === void 0 && (a = /* @__PURE__ */ new Map(), Pr.set(e, a));
						var o = a.get(r);
						o === void 0 ? (e.addEventListener(r, xr, { passive: i }), a.set(r, 1)) : a.set(r, o + 1);
					}
				}
			}
		};
		return f(c(hr)), gr.add(f), () => {
			for (var e of d) for (let r of [n, document]) {
				var t = Pr.get(r), i = t.get(e);
				--i == 0 ? (r.removeEventListener(e, xr), t.delete(e), t.size === 0 && Pr.delete(r)) : t.set(e, i);
			}
			gr.delete(f), s !== r && s.parentNode?.removeChild(s);
		};
	});
	return Ir.set(u, d), u;
}
var Ir = /* @__PURE__ */ new WeakMap();
function Lr(e, t) {
	let n = Ir.get(e);
	return n ? (Ir.delete(e), n(t)) : Promise.resolve();
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/branches.js
var Rr = class {
	anchor;
	#e = /* @__PURE__ */ new Map();
	#t = /* @__PURE__ */ new Map();
	#n = /* @__PURE__ */ new Map();
	#r = /* @__PURE__ */ new Set();
	#i = !0;
	constructor(e, t = !0) {
		this.anchor = e, this.#i = t;
	}
	#a = (e) => {
		if (this.#e.has(e)) {
			var t = this.#e.get(e), n = this.#t.get(t);
			if (n) Fn(n), this.#r.delete(t);
			else {
				var r = this.#n.get(t);
				r && (Fn(r.effect), this.#t.set(t, r.effect), this.#n.delete(t), r.fragment.lastChild.remove(), this.anchor.before(r.fragment), n = r.effect);
			}
			for (let [t, n] of this.#e) {
				if (this.#e.delete(t), t === e) break;
				let r = this.#n.get(n);
				r && (An(r.effect), this.#n.delete(n));
			}
			for (let [e, r] of this.#t) {
				if (e === t || this.#r.has(e)) continue;
				let i = () => {
					if (Array.from(this.#e.values()).includes(e)) {
						var t = document.createDocumentFragment();
						Ln(r, t), t.append(an()), this.#n.set(e, {
							effect: r,
							fragment: t
						});
					} else An(r);
					this.#r.delete(e), this.#t.delete(e);
				};
				this.#i || !n ? (this.#r.add(e), Nn(r, i, !1)) : i();
			}
		}
	};
	#o = (e) => {
		this.#e.delete(e);
		let t = Array.from(this.#e.values());
		for (let [e, n] of this.#n) t.includes(e) || (An(n.effect), this.#n.delete(e));
	};
	ensure(e, t) {
		var n = P, r = un();
		if (t && !this.#t.has(e) && !this.#n.has(e)) {
			if (r) {
				var i = document.createDocumentFragment(), a = an();
				i.append(a), this.#n.set(e, {
					effect: En(() => t(a)),
					fragment: i
				});
			} else this.#t.set(e, En(() => t(this.anchor)));
		}
		if (this.#e.set(n, e), r) {
			for (let [t, r] of this.#t) t === e ? n.unskip_effect(r) : n.skip_effect(r);
			for (let [t, r] of this.#n) t === e ? n.unskip_effect(r.effect) : n.skip_effect(r.effect);
			n.oncommit(this.#a), n.ondiscard(this.#o);
		} else A && (this.anchor = j), this.#a(n);
	}
};
function zr(e) {
	Be === null && _e("onMount"), vn(() => {
		let t = dr(e);
		if (typeof t == "function") return t;
	});
}
function Br(e) {
	Be === null && _e("onDestroy"), zr(() => () => dr(e));
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/if.js
function J(e, t, n = !1) {
	var r;
	A && (r = j, Ne());
	var i = new Rr(e), a = n ? ne : 0;
	function o(e, t) {
		if (A) {
			var n = Ie(r);
			if (e !== parseInt(n.substring(1))) {
				var a = Fe();
				Me(a), i.anchor = a, je(!1), i.ensure(e, t), je(!0);
				return;
			}
		}
		i.ensure(e, t);
	}
	Tn(() => {
		var e = !1;
		t((t, n = 0) => {
			e = !0, o(n, t);
		}), e || o(-1, null);
	}, a);
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/each.js
function Vr(e, t, n) {
	for (var r = [], i = t.length, a, o = t.length, s = 0; s < i; s++) {
		let n = t[s];
		Nn(n, () => {
			if (a) {
				if (a.pending.delete(n), a.done.add(n), a.pending.size === 0) {
					var t = e.outrogroups;
					Hr(e, c(a.done)), t.delete(a), t.size === 0 && (e.outrogroups = null);
				}
			} else --o;
		}, !1);
	}
	if (o === 0) {
		var l = r.length === 0 && n !== null && e.pending.size === 0;
		if (l) {
			var u = n, d = u.parentNode;
			ln(d), d.append(u), e.items.clear();
		}
		Hr(e, t, !l);
	} else a = {
		pending: new Set(t),
		done: /* @__PURE__ */ new Set()
	}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
}
function Hr(e, t, n = !0) {
	var r;
	if (e.pending.size > 0) {
		r = /* @__PURE__ */ new Set();
		for (let t of e.pending.values()) for (let n of t) r.add(e.items.get(n).e);
	}
	for (var i = 0; i < t.length; i++) {
		var a = t[i];
		r?.has(a) ? (a.f |= ie, Ln(a, document.createDocumentFragment())) : An(t[i], n);
	}
}
var Ur;
function Wr(e, t, n, r, i, o = null) {
	var s = e, l = /* @__PURE__ */ new Map();
	if (t & 4) {
		var u = e;
		s = A ? Me(/* @__PURE__ */ on(u)) : u.appendChild(an());
	}
	A && Ne();
	var d = null, f = /* @__PURE__ */ bt(() => {
		var e = n();
		return a(e) ? e : e == null ? [] : c(e);
	}), p, m = /* @__PURE__ */ new Map(), h = !0;
	function g(e) {
		v.effect.f & 16384 || (v.pending.delete(e), v.fallback = d, Kr(v, p, s, t, r), d !== null && (p.length === 0 ? d.f & 33554432 ? (d.f ^= ie, Jr(d, null, s)) : Fn(d) : Nn(d, () => {
			d = null;
		})));
	}
	function _(e) {
		v.pending.delete(e);
	}
	var v = {
		effect: Tn(() => {
			p = U(f);
			var e = p.length;
			let a = !1;
			A && Ie(s) === "[!" != (e === 0) && (s = Fe(), Me(s), je(!1), a = !0);
			for (var c = /* @__PURE__ */ new Set(), u = P, v = un(), y = 0; y < e; y += 1) {
				A && j.nodeType === 8 && j.data === "]" && (s = j, a = !0, je(!1));
				var b = p[y], x = r(b, y), S = h ? null : l.get(x);
				S ? (S.v && Jt(S.v, b), S.i && Jt(S.i, y), v && u.unskip_effect(S.e)) : (S = qr(l, h ? s : Ur ??= an(), b, x, y, i, t, n), h || (S.e.f |= ie), l.set(x, S)), c.add(x);
			}
			if (e === 0 && o && !d && (h ? d = En(() => o(s)) : (d = En(() => o(Ur ??= an())), d.f |= ie)), e > c.size && O("", "", ""), A && e > 0 && Me(Fe()), !h) {
				if (m.set(u, c), v) {
					for (let [e, t] of l) c.has(e) || u.skip_effect(t.e);
					u.oncommit(g), u.ondiscard(_);
				} else g(u);
			}
			a && je(!0), U(f);
		}),
		flags: t,
		items: l,
		pending: m,
		outrogroups: null,
		fallback: d
	};
	h = !1, A && (s = j);
}
function Gr(e) {
	for (; e !== null && !(e.f & 32);) e = e.next;
	return e;
}
function Kr(e, t, n, r, i) {
	var a = !!(r & 8), o = t.length, s = e.items, l = Gr(e.effect.first), u, d = null, f, p = [], m = [], h, g, _, v;
	if (a) for (v = 0; v < o; v += 1) h = t[v], g = i(h, v), _ = s.get(g).e, _.f & 33554432 || (_.nodes?.a?.measure(), (f ??= /* @__PURE__ */ new Set()).add(_));
	for (v = 0; v < o; v += 1) {
		if (h = t[v], g = i(h, v), _ = s.get(g).e, e.outrogroups !== null) for (let t of e.outrogroups) t.pending.delete(_), t.done.delete(_);
		if (_.f & 8192 && (Fn(_), a && (_.nodes?.a?.unfix(), (f ??= /* @__PURE__ */ new Set()).delete(_))), _.f & 33554432) {
			if (_.f ^= ie, _ === l) Jr(_, null, n);
			else {
				var y = d ? d.next : l;
				_ === e.effect.last && (e.effect.last = _.prev), _.prev && (_.prev.next = _.next), _.next && (_.next.prev = _.prev), Yr(e, d, _), Yr(e, _, y), Jr(_, y, n), d = _, p = [], m = [], l = Gr(d.next);
				continue;
			}
		}
		if (_ !== l) {
			if (u !== void 0 && u.has(_)) {
				if (p.length < m.length) {
					var b = m[0], x;
					d = b.prev;
					var S = p[0], C = p[p.length - 1];
					for (x = 0; x < p.length; x += 1) Jr(p[x], b, n);
					for (x = 0; x < m.length; x += 1) u.delete(m[x]);
					Yr(e, S.prev, C.next), Yr(e, d, S), Yr(e, C, b), l = b, d = C, --v, p = [], m = [];
				} else u.delete(_), Jr(_, l, n), Yr(e, _.prev, _.next), Yr(e, _, d === null ? e.effect.first : d.next), Yr(e, d, _), d = _;
				continue;
			}
			for (p = [], m = []; l !== null && l !== _;) (u ??= /* @__PURE__ */ new Set()).add(l), m.push(l), l = Gr(l.next);
			if (l === null) continue;
		}
		_.f & 33554432 || p.push(_), d = _, l = Gr(_.next);
	}
	if (e.outrogroups !== null) {
		for (let t of e.outrogroups) t.pending.size === 0 && (Hr(e, c(t.done)), e.outrogroups?.delete(t));
		e.outrogroups.size === 0 && (e.outrogroups = null);
	}
	if (l !== null || u !== void 0) {
		var ee = [];
		if (u !== void 0) for (_ of u) _.f & 8192 || ee.push(_);
		for (; l !== null;) !(l.f & 8192) && l !== e.fallback && ee.push(l), l = Gr(l.next);
		var w = ee.length;
		if (w > 0) {
			var te = r & 4 && o === 0 ? n : null;
			if (a) {
				for (v = 0; v < w; v += 1) ee[v].nodes?.a?.measure();
				for (v = 0; v < w; v += 1) ee[v].nodes?.a?.fix();
			}
			Vr(e, ee, te);
		}
	}
	a && qe(() => {
		if (f !== void 0) for (_ of f) _.nodes?.a?.apply();
	});
}
function qr(e, t, n, r, i, a, o, s) {
	var c = o & 1 ? o & 16 ? Kt(n) : /* @__PURE__ */ qt(n, !1, !1) : null, l = o & 2 ? Kt(i) : null;
	return {
		v: c,
		i: l,
		e: En(() => (a(t, c ?? n, l ?? i, s), () => {
			e.delete(r);
		}))
	};
}
function Jr(e, t, n) {
	if (e.nodes) for (var r = e.nodes.start, i = e.nodes.end, a = t && !(t.f & 33554432) ? t.nodes.start : n; r !== null;) {
		var o = /* @__PURE__ */ sn(r);
		if (a.before(r), r === i) return;
		r = o;
	}
}
function Yr(e, t, n) {
	t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
}
function Xr(t, n, a = !1, o = !1, s = !1, c = !1) {
	var l = t, u = "";
	if (a) {
		var d = t;
		A && (l = Me(/* @__PURE__ */ on(d)));
	}
	B(() => {
		var t = H;
		if (u === (u = n() ?? "")) {
			A && Ne();
			return;
		}
		if (a && !A) {
			t.nodes = null, d.innerHTML = u, u !== "" && Tr(/* @__PURE__ */ on(d), d.lastChild);
			return;
		}
		if (t.nodes !== null && (jn(t.nodes.start, t.nodes.end), t.nodes = null), u !== "") {
			if (A) {
				for (var c = j.data, f = Ne(), p = f; f !== null && (f.nodeType !== 8 || f.data !== "");) p = f, f = /* @__PURE__ */ sn(f);
				if (f === null) throw ke(), e;
				Tr(j, p), l = Me(f);
				return;
			}
			var m = dn(o ? "svg" : s ? "math" : "template", o ? r : s ? i : void 0);
			m.innerHTML = u;
			var h = o || s ? m : m.content;
			if (Tr(/* @__PURE__ */ on(h), h.lastChild), o || s) for (; /* @__PURE__ */ on(h);) l.before(/* @__PURE__ */ on(h));
			else l.before(h);
		}
	});
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/css.js
function Zr(e, t) {
	Sn(() => {
		var n = e.getRootNode(), r = n.host ? n : n.head ?? n.ownerDocument.head;
		if (!r.querySelector("#" + t.hash)) {
			let e = dn("style");
			e.id = t.hash, e.textContent = t.code, r.appendChild(e);
		}
	});
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/actions.js
function Qr(e, t, n) {
	Sn(() => {
		var r = dr(() => t(e, n?.()) || {});
		if (n && r?.update) {
			var i = !1, a = {};
			wn(() => {
				var e = n();
				fr(e), i && Re(a, e) && (a = e, r.update(e));
			}), i = !0;
		}
		if (r?.destroy) return () => r.destroy();
	});
}
//#endregion
//#region node_modules/clsx/dist/clsx.mjs
function $r(e) {
	var t, n, r = "";
	if (typeof e == "string" || typeof e == "number") r += e;
	else if (typeof e == "object") {
		if (Array.isArray(e)) {
			var i = e.length;
			for (t = 0; t < i; t++) e[t] && (n = $r(e[t])) && (r && (r += " "), r += n);
		} else for (n in e) e[n] && (r && (r += " "), r += n);
	}
	return r;
}
function ei() {
	for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = $r(e)) && (r && (r += " "), r += t);
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/shared/attributes.js
function ti(e) {
	return typeof e == "object" ? ei(e) : e ?? "";
}
var ni = [..." 	\n\r\f\xA0\v﻿"];
function ri(e, t, n) {
	var r = e == null ? "" : "" + e;
	if (t && (r = r ? r + " " + t : t), n) {
		for (var i of Object.keys(n)) if (n[i]) r = r ? r + " " + i : i;
		else if (r.length) for (var a = i.length, o = 0; (o = r.indexOf(i, o)) >= 0;) {
			var s = o + a;
			(o === 0 || ni.includes(r[o - 1])) && (s === r.length || ni.includes(r[s])) ? r = (o === 0 ? "" : r.substring(0, o)) + r.substring(s + 1) : o = s;
		}
	}
	return r === "" ? null : r;
}
function ii(e, t = !1) {
	var n = t ? " !important;" : ";", r = "";
	for (var i of Object.keys(e)) {
		var a = e[i];
		a != null && a !== "" && (r += " " + i + ": " + a + n);
	}
	return r;
}
function ai(e) {
	return e[0] !== "-" || e[1] !== "-" ? e.toLowerCase() : e;
}
function oi(e, t) {
	if (t) {
		var n = "", r, i;
		if (Array.isArray(t) ? (r = t[0], i = t[1]) : r = t, e) {
			e = String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
			var a = !1, o = 0, s = !1, c = [];
			r && c.push(...Object.keys(r).map(ai)), i && c.push(...Object.keys(i).map(ai));
			var l = 0, u = -1;
			let t = e.length;
			for (var d = 0; d < t; d++) {
				var f = e[d];
				if (s ? f === "/" && e[d - 1] === "*" && (s = !1) : a ? a === f && (a = !1) : f === "/" && e[d + 1] === "*" ? s = !0 : f === "\"" || f === "'" ? a = f : f === "(" ? o++ : f === ")" && o--, !s && a === !1 && o === 0) {
					if (f === ":" && u === -1) u = d;
					else if (f === ";" || d === t - 1) {
						if (u !== -1) {
							var p = ai(e.substring(l, u).trim());
							if (!c.includes(p)) {
								f !== ";" && d++;
								var m = e.substring(l, d).trim();
								n += " " + m + ";";
							}
						}
						l = d + 1, u = -1;
					}
				}
			}
		}
		return r && (n += ii(r)), i && (n += ii(i, !0)), n = n.trim(), n === "" ? null : n;
	}
	return e == null ? null : String(e);
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/class.js
function si(e, t, n, r, i, a) {
	var o = e[de];
	if (A || o !== n || o === void 0) {
		var s = ri(n, r, a);
		(!A || s !== e.getAttribute("class")) && (s == null ? e.removeAttribute("class") : t ? e.className = s : e.setAttribute("class", s)), e[de] = n;
	} else if (a && i !== a) for (var c in a) {
		var l = !!a[c];
		(i == null || l !== !!i[c]) && e.classList.toggle(c, l);
	}
	return a;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/style.js
function ci(e, t = {}, n, r) {
	for (var i in n) {
		var a = n[i];
		t[i] !== a && (n[i] == null ? e.style.removeProperty(i) : e.style.setProperty(i, a, r));
	}
}
function li(e, t, n, r) {
	var i = e[fe];
	if (A || i !== t) {
		var a = oi(t, r);
		(!A || a !== e.getAttribute("style")) && (a == null ? e.removeAttribute("style") : e.style.cssText = a), e[fe] = t;
	} else r && (Array.isArray(r) ? (ci(e, n?.[0], r[0]), ci(e, n?.[1], r[1], "important")) : ci(e, n, r));
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/attributes.js
var ui = Symbol("is custom element"), di = Symbol("is html"), fi = ge ? "link" : "LINK", pi = ge ? "progress" : "PROGRESS";
function mi(e) {
	if (A) {
		var t = !1, n = () => {
			if (!t) {
				if (t = !0, e.hasAttribute("value")) {
					var n = e.value;
					Y(e, "value", null), e.value = n;
				}
				if (e.hasAttribute("checked")) {
					var r = e.checked;
					Y(e, "checked", null), e.checked = r;
				}
			}
		};
		e[me] = n, qe(n), ot();
	}
}
function hi(e, t) {
	var n = _i(e);
	n.value !== (n.value = t ?? void 0) && (e.value !== t || t === 0 && e.nodeName === pi) && (e.value = t ?? "");
}
function gi(e, t) {
	var n = _i(e);
	n.checked !== (n.checked = t ?? void 0) && (e.checked = t);
}
function Y(e, t, n, r) {
	var i = _i(e);
	A && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === fi) || i[t] !== (i[t] = n) && (t === "loading" && (e[D] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && yi(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
}
function _i(e) {
	return e[ue] ??= {
		[ui]: e.nodeName.includes("-"),
		[di]: e.namespaceURI === n
	};
}
var vi = /* @__PURE__ */ new Map();
function yi(e) {
	var t = e.getAttribute("is") || e.nodeName, n = vi.get(t);
	if (n) return n;
	vi.set(t, n = []);
	for (var r, i = e, a = Element.prototype; a !== i;) {
		for (var o in r = f(i), r) r[o].set && o !== "innerHTML" && o !== "textContent" && o !== "innerText" && n.push(o);
		i = h(i);
	}
	return n;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
function bi(e, t, n = t) {
	var r = /* @__PURE__ */ new WeakSet();
	ct(e, "input", async (i) => {
		var a = i ? e.defaultValue : e.value;
		if (a = xi(e) ? Si(a) : a, n(a), P !== null && r.add(P), await cr(), a !== (a = t())) {
			var o = e.selectionStart, s = e.selectionEnd, c = e.value.length;
			if (e.value = a ?? "", s !== null) {
				var l = e.value.length;
				o === s && s === c && l > c ? (e.selectionStart = l, e.selectionEnd = l) : (e.selectionStart = o, e.selectionEnd = Math.min(s, l));
			}
		}
	}), (A && e.defaultValue !== e.value || dr(t) == null && e.value) && (n(xi(e) ? Si(e.value) : e.value), P !== null && r.add(P)), wn(() => {
		var n = t();
		if (e === document.activeElement) {
			var i = P;
			if (r.has(i)) return;
		}
		xi(e) && n === Si(e.value) || e.type === "date" && !n && !e.value || n !== e.value && (e.value = n ?? "");
	});
}
function xi(e) {
	var t = e.type;
	return t === "number" || t === "range";
}
function Si(e) {
	return e === "" ? null : +e;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
function Ci(e, t) {
	return e === t || e?.[ce] === t;
}
function wi(e = {}, t, n, r) {
	var i = Be.r, a = H;
	return Sn(() => {
		var o, s;
		return wn(() => {
			o = s, s = r?.() || [], dr(() => {
				Ci(n(...s), e) || (t(e, ...s), o && Ci(n(...o), e) && t(null, ...o));
			});
		}), () => {
			let r = a;
			for (; r !== i && r.parent !== null && r.parent.f & 33554432;) r = r.parent;
			let o = () => {
				s && Ci(n(...s), e) && t(null, ...s);
			}, c = r.teardown;
			r.teardown = () => {
				o(), c?.();
			};
		};
	}), e;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/props.js
function X(e, t, n, r) {
	var i = !0, a = !!(n & 8), o = !!(n & 16), s = r, c = !0, l = void 0, u = () => o && i ? (l ??= /* @__PURE__ */ _t(r), U(l)) : (c && (c = !1, s = o ? dr(r) : r), s);
	let f;
	if (a) {
		var p = ce in e || le in e;
		f = d(e, t)?.set ?? (p && t in e ? (n) => e[t] = n : void 0);
	}
	var m, h = !1;
	a ? [m, h] = rt(() => e[t]) : m = e[t], m === void 0 && r !== void 0 && (m = u(), f && (i && Ce(t), f(m)));
	var g = i ? () => {
		var n = e[t];
		return n === void 0 ? u() : (c = !0, n);
	} : () => {
		var n = e[t];
		return n !== void 0 && (s = void 0), n === void 0 ? s : n;
	};
	if (i && !(n & 4)) return g;
	if (f) {
		var _ = e.$$legacy;
		return (function(e, t) {
			return arguments.length > 0 ? ((!i || !t || _ || h) && f(t ? g() : e), e) : g();
		});
	}
	var v = !1, y = (n & 1 ? _t : bt)(() => (v = !1, g()));
	a && U(y);
	var b = H;
	return (function(e, t) {
		if (arguments.length > 0) {
			let n = t ? U(y) : i && a ? Qt(e) : e;
			return L(y, n), v = !0, s !== void 0 && (s = n), e;
		}
		return Bn && v || b.f & 16384 ? y.v : U(y);
	});
}
//#endregion
//#region node_modules/svelte/src/legacy/legacy-client.js
function Ti(e) {
	return new Ei(e);
}
var Ei = class {
	#e;
	#t;
	constructor(e) {
		var t = /* @__PURE__ */ new Map(), n = (e, n) => {
			var r = /* @__PURE__ */ qt(n, !1, !1);
			return t.set(e, r), r;
		};
		let r = new Proxy({
			...e.props || {},
			$$events: {}
		}, {
			get(e, r) {
				return U(t.get(r) ?? n(r, Reflect.get(e, r)));
			},
			has(e, r) {
				return r === le || (U(t.get(r) ?? n(r, Reflect.get(e, r))), Reflect.has(e, r));
			},
			set(e, r, i) {
				return L(t.get(r) ?? n(r, i), i), Reflect.set(e, r, i);
			}
		});
		this.#t = (e.hydrate ? Nr : Mr)(e.component, {
			target: e.target,
			anchor: e.anchor,
			props: r,
			context: e.context,
			intro: e.intro ?? !1,
			recover: e.recover,
			transformError: e.transformError
		}), (!e?.props?.$$host || e.sync === !1) && F(), this.#e = r.$$events;
		for (let e of Object.keys(this.#t)) e !== "$set" && e !== "$destroy" && e !== "$on" && u(this, e, {
			get() {
				return this.#t[e];
			},
			set(t) {
				this.#t[e] = t;
			},
			enumerable: !0
		});
		this.#t.$set = (e) => {
			Object.assign(r, e);
		}, this.#t.$destroy = () => {
			Lr(this.#t);
		};
	}
	$set(e) {
		this.#t.$set(e);
	}
	$on(e, t) {
		this.#e[e] = this.#e[e] || [];
		let n = (...e) => t.call(this, ...e);
		return this.#e[e].push(n), () => {
			this.#e[e] = this.#e[e].filter((e) => e !== n);
		};
	}
	$destroy() {
		this.#t.$destroy();
	}
}, Di;
typeof HTMLElement == "function" && (Di = class extends HTMLElement {
	$$ctor;
	$$s;
	$$c;
	$$cn = !1;
	$$d = {};
	$$r = !1;
	$$p_d = {};
	$$l = {};
	$$l_u = /* @__PURE__ */ new Map();
	$$me;
	$$shadowRoot = null;
	constructor(e, t, n) {
		super(), this.$$ctor = e, this.$$s = t, n && (this.$$shadowRoot = this.attachShadow(n));
	}
	addEventListener(e, t, n) {
		if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
			let n = this.$$c.$on(e, t);
			this.$$l_u.set(t, n);
		}
		super.addEventListener(e, t, n);
	}
	removeEventListener(e, t, n) {
		if (super.removeEventListener(e, t, n), this.$$c) {
			let e = this.$$l_u.get(t);
			e && (e(), this.$$l_u.delete(t));
		}
	}
	async connectedCallback() {
		if (this.$$cn = !0, !this.$$c) {
			if (await Promise.resolve(), !this.$$cn || this.$$c) return;
			function e(e) {
				return (t) => {
					let n = dn("slot");
					e !== "default" && (n.name = e), K(t, n);
				};
			}
			let t = {}, n = ki(this);
			for (let r of this.$$s) r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = e(r), t.default = !0) : t[r] = e(r));
			for (let e of this.attributes) {
				let t = this.$$g_p(e.name);
				t in this.$$d || (this.$$d[t] = Oi(t, e.value, this.$$p_d, "toProp"));
			}
			for (let e in this.$$p_d) !(e in this.$$d) && this[e] !== void 0 && (this.$$d[e] = this[e], delete this[e]);
			this.$$c = Ti({
				component: this.$$ctor,
				target: this.$$shadowRoot || this,
				props: {
					...this.$$d,
					$$slots: t,
					$$host: this
				}
			}), this.$$me = bn(() => {
				wn(() => {
					this.$$r = !0;
					for (let e of l(this.$$c)) {
						if (!this.$$p_d[e]?.reflect) continue;
						this.$$d[e] = this.$$c[e];
						let t = Oi(e, this.$$d[e], this.$$p_d, "toAttribute");
						t == null ? this.removeAttribute(this.$$p_d[e].attribute || e) : this.setAttribute(this.$$p_d[e].attribute || e, t);
					}
					this.$$r = !1;
				});
			});
			for (let e in this.$$l) for (let t of this.$$l[e]) {
				let n = this.$$c.$on(e, t);
				this.$$l_u.set(t, n);
			}
			this.$$l = {};
		}
	}
	attributeChangedCallback(e, t, n) {
		this.$$r || (e = this.$$g_p(e), this.$$d[e] = Oi(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
	}
	disconnectedCallback() {
		this.$$cn = !1, Promise.resolve().then(() => {
			!this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
		});
	}
	$$g_p(e) {
		return l(this.$$p_d).find((t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e) || e;
	}
});
function Oi(e, t, n, r) {
	let i = n[e]?.type;
	if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e]) return t;
	if (r === "toAttribute") switch (i) {
		case "Object":
		case "Array": return t == null ? null : JSON.stringify(t);
		case "Boolean": return t ? "" : null;
		case "Number": return t ?? null;
		default: return t;
	}
	else switch (i) {
		case "Object":
		case "Array": return t && JSON.parse(t);
		case "Boolean": return t;
		case "Number": return t == null ? t : +t;
		default: return t;
	}
}
function ki(e) {
	let t = {};
	return e.childNodes.forEach((e) => {
		t[e.slot || "default"] = !0;
	}), t;
}
function Ai(e, t, n, r, i, a) {
	let o = class extends Di {
		constructor() {
			super(e, n, i), this.$$p_d = t;
		}
		static get observedAttributes() {
			return l(t).map((e) => (t[e].attribute || e).toLowerCase());
		}
	};
	return l(t).forEach((e) => {
		u(o.prototype, e, {
			get() {
				return this.$$c && e in this.$$c ? this.$$c[e] : this.$$d[e];
			},
			set(n) {
				n = Oi(e, n, t), this.$$d[e] = n;
				var r = this.$$c;
				r && (d(r, e)?.get ? r[e] = n : r.$set({ [e]: n }));
			}
		});
	}), r.forEach((e) => {
		u(o.prototype, e, { get() {
			return this.$$c?.[e];
		} });
	}), a && (o = a(o)), e.element = o, o;
}
//#endregion
//#region src/lib/api/client.ts
var ji = class extends Error {
	status;
	code;
	constructor(e, t, n) {
		super(n), this.status = e, this.code = t;
	}
};
async function Mi(e, t, n = fetch) {
	let r = typeof FormData < "u" && t?.body instanceof FormData, i = await n(e, {
		...t,
		headers: r ? t?.headers ?? {} : {
			"Content-Type": "application/json",
			...t?.headers ?? {}
		}
	});
	if (!i.ok) {
		let e = await i.json().catch(() => null);
		throw new ji(i.status, e?.error?.code ?? "unknown_error", e?.error?.message ?? i.statusText);
	}
	return i;
}
//#endregion
//#region src/lib/api/records.ts
var Ni = { and: [] };
function Pi(e) {
	return "col" in e;
}
function Fi(e) {
	return "and" in e;
}
function Ii(e) {
	return "or" in e;
}
function Li(e) {
	return Fi(e) ? e.and.length === 0 : Ii(e) ? e.or.length === 0 : !Pi(e);
}
function Ri(e, t) {
	return Li(e) ? t : Li(t) ? e : { and: [e, t] };
}
function zi(e) {
	return e.map((e) => e.desc ? `-${e.column}` : e.column).join(",");
}
function Bi(e) {
	return JSON.stringify(e);
}
function Vi(e) {
	return JSON.stringify(e);
}
function Hi(e) {
	return e.join(",");
}
async function Ui(e, t = {}, n = fetch) {
	let r = new URLSearchParams();
	t.view && r.set("view", t.view), t.limit && r.set("limit", String(t.limit)), t.offset && r.set("offset", String(t.offset)), t.sort !== void 0 && r.set("sort", zi(t.sort)), t.where !== void 0 && r.set("where", Bi(t.where)), t.groupBy !== void 0 && r.set("group_by", Hi(t.groupBy)), t.summary !== void 0 && r.set("summary", Vi(t.summary));
	let i = r.toString();
	return (await Mi(`/api/v1/tables/${e}/records${i ? `?${i}` : ""}`, void 0, n)).json();
}
async function Wi(e, t, n, r = fetch) {
	return (await Mi(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}`, {
		method: "PATCH",
		body: JSON.stringify(n)
	}, r)).json();
}
async function Gi(e, t, n, r, i = fetch) {
	await Mi(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}/links/${n}`, {
		method: "POST",
		body: JSON.stringify({ target_id: r })
	}, i);
}
async function Ki(e, t, n, r, i = fetch) {
	await Mi(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}/links/${n}/${encodeURIComponent(String(r))}`, { method: "DELETE" }, i);
}
//#endregion
//#region src/lib/i18n/locale.svelte.ts
var qi = ["de", "en"], Ji = "illusiondb-locale", Yi = "de", Xi = "illusiondb:locale-change";
function Zi(e) {
	return qi.includes(e ?? "");
}
function Qi() {
	if (typeof localStorage > "u") return Yi;
	let e = localStorage.getItem(Ji);
	return Zi(e) ? e : Yi;
}
function $i(e) {
	typeof document < "u" && document.documentElement.setAttribute("lang", e);
}
var ea = Qt({ current: Yi });
typeof window < "u" && (ea.current = Qi(), $i(ea.current), window.addEventListener(Xi, (e) => {
	let t = e.detail;
	Zi(t) && (ea.current = t);
}));
//#endregion
//#region src/lib/i18n/translations/de.ts
var ta = {
	common: {
		username: "Benutzername",
		password: "Passwort",
		email: "E-Mail",
		name: "Name",
		role: "Rolle",
		createdAt: "Erstellt am",
		close: "Schließen",
		cancel: "Abbrechen",
		save: "Speichern",
		saving: "Speichert…",
		edit: "Bearbeiten",
		delete: "Löschen",
		deleting: "Löscht…",
		create: "Anlegen",
		creating: "Anlegen…",
		back: "Zurück",
		next: "Weiter",
		remove: "Entfernen",
		errorLoading: "Fehler beim Laden",
		noResults: "Keine Treffer",
		search: "Suchen…",
		refineSearch: "Weitere Treffer – Suche eingrenzen",
		creatingAlt: "Legt an…",
		allDataSources: "Alle Data Sources",
		rangeOfTotal: "{{from}}–{{to}} von {{total}}",
		rangeEmpty: "0 von 0",
		yes: "Ja",
		no: "Nein"
	},
	auth: {
		login: {
			subtitle: "Bitte melde dich an.",
			submit: "Anmelden",
			submitting: "Anmelden…"
		},
		setup: {
			subtitle: "Willkommen! Lege den ersten Administrator-Account an.",
			passwordRepeat: "Passwort wiederholen",
			passwordMismatch: "Die Passwörter stimmen nicht überein.",
			submit: "Administrator anlegen",
			submitting: "Einrichten…"
		}
	},
	nav: {
		connections: "Verbindungen",
		newSqliteDatabase: "Neue SQLite-Datenbank anlegen",
		loading: "Lädt…",
		noTables: "Keine Tabellen",
		noViews: "Keine Ansichten",
		settings: "Einstellungen",
		logout: "Abmelden",
		openMenu: "Menü öffnen",
		collapseSidebar: "Menüleiste einklappen",
		expandSidebar: "Menüleiste ausklappen",
		expand: "{{name}} aufklappen",
		collapse: "{{name}} zuklappen",
		viewOptionsFor: "Optionen für Ansicht {{name}}",
		viewSettings: "Einstellungen",
		viewSettingsTitle: "View-Einstellungen: {{name}}",
		junctionTableChip: "Admin",
		junctionTableHint: "Nur für Admins sichtbar — Junction-Tabelle eines Links-Felds"
	},
	theme: {
		light: "Hell",
		dark: "Dunkel",
		system: "Systemstandard"
	},
	language: {
		label: "Sprache",
		de: "Deutsch",
		en: "Englisch"
	},
	settings: {
		title: "Einstellungen",
		tabs: {
			dataSources: "Data Sources",
			apiDocs: "API-Dokumentation",
			auditLog: "Audit Log",
			files: "Dateien",
			users: "Benutzer",
			groups: "Gruppen",
			scripts: "Skripte",
			myAccount: "Mein Konto"
		},
		users: {
			subtitle: "Alle Benutzerkonten dieser Instanz",
			newUser: "Neuer Benutzer",
			confirmDelete: "Benutzer \"{{email}}\" wirklich löschen?",
			editUser: "Benutzer bearbeiten",
			resetPassword: "Passwort zurücksetzen",
			newPasswordPlaceholder: "Neues Passwort",
			setting: "Setzt…",
			set: "Setzen",
			loadingGroupMembership: "Lädt Gruppenzugehörigkeit…",
			memberOf: "Mitglied von: {{groups}}",
			managedUnderGroups: "— verwaltet unter Einstellungen → Gruppen"
		},
		account: {
			accountSection: "Konto",
			changeEmail: "E-Mail ändern",
			changePasswordSection: "Passwort ändern",
			passwordChanged: "Passwort erfolgreich geändert.",
			currentPassword: "Aktuelles Passwort",
			newPassword: "Neues Passwort",
			changing: "Ändert…",
			changePassword: "Passwort ändern",
			apiTokens: "API-Tokens",
			tokenCreatedNotice: "Token \"{{name}}\" angelegt — wird nur jetzt angezeigt, danach nicht mehr abrufbar:",
			hide: "Ausblenden",
			tokenNamePlaceholder: "z.B. n8n-Workflow",
			createToken: "Token anlegen",
			noTokens: "Noch keine API-Tokens angelegt.",
			lastUsed: "Zuletzt verwendet",
			confirmDeleteToken: "API-Token \"{{name}}\" wirklich löschen?"
		},
		datasources: {
			subtitle: "Verbundene Datenbanken und ihr Sync-Stand",
			newSqliteDatabase: "Neue SQLite-Datenbank",
			newDataSource: "Neue Data Source",
			noneYet: "Noch keine Data Source angelegt.",
			createFirst: "Erste Verbindung anlegen",
			type: "Typ",
			connection: "Verbindung",
			status: "Status",
			lastSync: "Letzter Sync",
			syncing: "Syncing…",
			sync: "Sync",
			confirmDelete: "Data Source \"{{name}}\" wirklich entfernen? Alle zugehörigen Tabellen, Ansichten, Berechtigungen, Webhooks und Anhänge in IllusionDB werden unwiderruflich mitgelöscht. Die externe Datenbank selbst bleibt unverändert.",
			namePlaceholder: "Produktions-CRM",
			filePath: "Datei-Pfad",
			database: "Datenbank",
			user: "Benutzer",
			sslMode: "SSL-Modus"
		},
		files: {
			subtitle: "Alle hochgeladenen Dateien über alle Data Sources hinweg",
			galleryView: "Galerie",
			listView: "Liste",
			allTables: "Alle Tabellen",
			allColumns: "Alle Spalten",
			allFileTypes: "Alle Dateitypen",
			filenamePlaceholder: "Dateiname…",
			filename: "Dateiname",
			tableColumn: "Tabelle.Spalte",
			size: "Größe",
			uploaded: "Hochgeladen",
			noFiles: "Keine Dateien gefunden.",
			confirmDelete: "Datei \"{{name}}\" wirklich löschen?"
		},
		auditLog: {
			subtitle: "Schema-Änderungen (Tabelle/Spalte anlegen/löschen) über alle Data Sources hinweg",
			allActions: "Alle Aktionen",
			timestamp: "Zeitpunkt",
			action: "Aktion",
			target: "Ziel",
			actor: "Akteur",
			details: "Details",
			noEntries: "Keine Einträge gefunden.",
			actionCreateTable: "Tabelle angelegt",
			actionAddColumn: "Spalte hinzugefügt",
			actionDropColumn: "Spalte gelöscht"
		},
		groups: {
			subtitle: "Tabellen-Berechtigungen als Bündel für mehrere Nutzer auf einmal",
			newGroup: "Neue Gruppe",
			noneYet: "Noch keine Gruppe angelegt.",
			createFirst: "Erste Gruppe anlegen",
			members: "Mitglieder",
			confirmDelete: "Gruppe \"{{name}}\" wirklich löschen?",
			namePlaceholder: "Vertrieb",
			editGroup: "Gruppe bearbeiten",
			noViewers: "Keine Viewer-Konten vorhanden.",
			saveMembers: "Mitglieder speichern"
		},
		scripts: {
			subtitle: "JavaScript-Skripte (goja) für eigene HTTP-Endpunkte und Event-Hooks",
			newScript: "Neues Skript",
			noneYet: "Noch kein Skript angelegt.",
			createFirst: "Erstes Skript anlegen",
			editScript: "Skript bearbeiten",
			confirmDelete: "Skript \"{{name}}\" wirklich löschen? Zugehörige Endpoints/Hooks werden mitgelöscht.",
			namePlaceholder: "z. B. hello-endpoint",
			codePlaceholder: "// Custom Endpoint: request/response verfügbar\n// Hook: event verfügbar\n// Beide: illusiondb.* und log(...)\n// Code läuft in einer Funktion -- return <wert> liefert das Ergebnis,\n// ohne return ist das Ergebnis undefined.\nreturn { ok: true };",
			enabled: "Aktiviert",
			code: "Code",
			endpointsTitle: "Custom Endpoints",
			endpointsSubtitle: "Erreichbar unter /api/v1/scripts/<pfad>, sofort und ohne Neustart",
			newEndpoint: "Neuer Endpoint",
			editEndpoint: "Endpoint bearbeiten",
			noneEndpointsYet: "Noch kein Endpoint registriert.",
			method: "Methode",
			path: "Pfad",
			pathPlaceholder: "/hello oder /users/:id",
			pathHint: ":name fängt ein Segment ein, ein abschließendes * den ganzen Rest. Bei Überlappung gewinnt der spezifischere Pfad (wörtlich > :name > *), bei Gleichstand der zuerst angelegte.",
			authMode: "Auth-Modus",
			authPublic: "Öffentlich",
			authAuthenticated: "Angemeldet",
			confirmDeleteEndpoint: "Endpoint \"{{method}} {{path}}\" wirklich löschen?",
			hooksTitle: "Event-Hooks",
			hooksSubtitle: "Läuft im Hintergrund nach einem Record-Write, blockiert den Request nicht",
			newHook: "Neuer Hook",
			editHook: "Hook bearbeiten",
			noneHooksYet: "Noch kein Hook gebunden.",
			event: "Ereignis",
			table: "Tabelle",
			allTables: "Alle Tabellen",
			position: "Position",
			confirmDeleteHook: "Hook wirklich löschen?",
			script: "Skript",
			selectScript: "Skript wählen…",
			noScriptsForBinding: "Erst ein Skript anlegen, um einen Endpoint/Hook zu binden.",
			testRun: "Testlauf",
			running: "Führt aus…",
			testRunHint: "Führt den aktuellen Code (auch ungespeichert) wirklich aus -- illusiondb.* hat vollen Zugriff, kein Sandbox-Dry-Run.",
			testRunLogs: "Konsole",
			testRunNoLogs: "Keine log(...)-Ausgabe.",
			testRunReturnValue: "Rückgabewert",
			testRunResponse: "Antwort",
			testRunError: "Fehler",
			testRunResultPanel: "Ergebnis",
			showOutput: "Ausgabe einblenden",
			hideOutput: "Ausgabe ausblenden",
			testRunPlaceholder: "Noch kein Testlauf.",
			testRunNoResult: "Kein Rückgabewert, keine Antwort.",
			apiSnippets: "illusiondb.*-API",
			download: "Download",
			import: "Importieren",
			importInvalidFile: "Die Datei konnte nicht gelesen werden.",
			importDropTitle: "Skript importieren",
			importDropHint: "Datei hierher ziehen oder klicken zum Auswählen",
			importDropHintSub: "Nur .js-Dateien"
		},
		datasourceDetail: {
			downloadSqlite: "Datenbank herunterladen",
			exportSchema: "Verbindungseinstellungen exportieren",
			importSchema: "Verbindungseinstellungen importieren",
			importSchemaHint: "JSON-Datei wählen, die zuvor über „Verbindungseinstellungen exportieren\" erzeugt wurde. Tabellen/Spalten müssen bereits existieren (per Sync) -- der Import legt keine neuen Datenbank-Spalten an, nur Formeln/Lookups/Rollups/Links/Dateifelder, Anzeige-Einstellungen und gespeicherte Ansichten.",
			importSchemaInvalidJson: "Die Datei enthält kein gültiges JSON.",
			importSchemaJsonOnly: "Nur .json-Dateien",
			importSchemaSummary: "{{matched}} Tabelle(n) zugeordnet, {{skipped}} übersprungen. {{created}} Spalte(n) neu angelegt, {{updated}} aktualisiert. {{viewsCreated}} Ansicht(en) neu angelegt, {{viewsUpdated}} aktualisiert.",
			sqlEditor: "SQL-Terminal",
			importCsv: "CSV importieren",
			importSql: "SQL importieren",
			newTable: "Neue Tabelle",
			noTablesYet: "Noch keine Tabellen bekannt.",
			hintBefore: "Auf der",
			hintLinkText: "Übersicht",
			hintAfter: "einmal „Sync\" ausführen.",
			schema: "Schema",
			table: "Tabelle",
			columns: "Spalten",
			lastSynced: "Zuletzt synchronisiert",
			webhooks: "Webhooks",
			manageWebhooks: "Webhooks verwalten",
			noWebhooks: "Noch kein Webhook für diese Verbindung eingerichtet.",
			webhooksCount: "{{count}} Webhook(s) eingerichtet.",
			createTableTitle: "Neue Tabelle anlegen",
			tableName: "Tabellenname",
			tableNamePlaceholder: "kunden",
			pkHintBefore: "Jede neue Tabelle bekommt automatisch eine UUID-Primärschlüsselspalte",
			pkHintAfter: "— nicht hier angeben.",
			columnNamePlaceholder: "Spaltenname",
			remove: "Entfernen",
			addColumn: "+ Spalte",
			createTable: "Tabelle anlegen"
		}
	},
	formats: {
		fieldType: {
			longText: "Langtext",
			number: "Zahl",
			decimal: "Dezimalzahl",
			boolean: "Wahrheitswert",
			date: "Datum",
			datetime: "Datum & Zeit",
			uuid: "UUID",
			json: "JSON",
			text: "Text",
			links: "Verknüpfung",
			attachment: "Anhang"
		},
		dateFormatName: {
			iso: "ISO",
			de: "Deutsch",
			us: "US",
			gb: "GB",
			long: "Ausgeschrieben"
		},
		timeFormatName: {
			"24h": "24-Stunden",
			"12h": "12-Stunden"
		},
		numberStyleName: {
			plain: "Standard",
			currency: "Währung",
			percent: "Prozent",
			temperature: "Temperatur"
		}
	},
	dataGrid: {
		columnOptionsFor: "Optionen für {{name}}",
		columnOptions: "Spaltenoptionen",
		resizeColumnFor: "Breite von {{name}} ändern",
		addField: "Neues Feld hinzufügen",
		displayColumn: "Anzeigespalte",
		openRecord: "Datensatz öffnen",
		loadingMoreRows: "Lädt weitere Zeilen…",
		endOfList: "– Ende der Liste –",
		defaultValue: "Default: {{value}}",
		automatic: "automatisch",
		newRow: "Neue Zeile",
		editSummaryFor: "Zusammenfassung für {{name}} bearbeiten",
		editSummary: "Zusammenfassung bearbeiten",
		noRows: "Keine Zeilen.",
		summary: "Zusammenfassung",
		column: "Spalte",
		unpinDisplay: "Anzeigefeld entfernen",
		pinDisplay: "Als Anzeigefeld setzen",
		hideInView: "In dieser Ansicht ausblenden",
		editField: "Feld bearbeiten",
		fieldName: "Feldname",
		physicalNameBefore: "Physischer Spaltenname:",
		physicalNameAfter: "-- leer lassen, um den Override zu entfernen.",
		formula: "Formel",
		fieldType: "Feldtyp",
		uiTypeOverrideHint: "Überschreibt die automatisch erkannte Darstellung -- z.B. um bei SQLite (kein natives Datum) trotzdem einen Datums-/Zeit-Picker zu erzwingen, oder um einer Formelspalte eine Zahlenformatierung zu ermöglichen.",
		originalUnformatted: "Original (unformatiert)",
		dateFormat: "Datumsformat",
		timeFormat: "Uhrzeitformat",
		style: "Stil",
		decimals: "Nachkommastellen",
		thousandsSeparator: "Tausendertrennzeichen",
		currency: "Währung",
		unit: "Einheit",
		chooseOtherFormat: "Anderes Format wählen",
		loadingValues: "Werte werden geladen…",
		value: "Wert",
		customColor: "Eigene Farbe",
		chooseCustomColor: "Eigene Farbe wählen",
		removeRow: "Zeile entfernen",
		reorderValue: "Wert verschieben",
		truncatedValues: "Nur die ersten {{count}} Werte übernommen — es gibt weitere.",
		addValue: "+ Wert",
		label: "Beschriftung",
		buttonLabelPlaceholder: "z.B. Rechnung öffnen",
		buttonFormulaHint: "Die Formel liefert das Klickziel (eine URL) -- der Button zeigt immer diesen festen Text, nicht das Formelergebnis.",
		target: "Ziel",
		newTab: "Neuer Tab",
		sameTab: "Gleicher Tab",
		plainText: "Normaler Text",
		labelFormat: "Label (Werte + Farben)",
		tagsFormat: "Tags (kommagetrennt)",
		emailFormat: "E-Mail-Adresse (Link)",
		phoneFormat: "Telefonnummer (Link)",
		urlFormat: "URL (Link)",
		colorFormat: "Farbe (Hexwert)",
		buttonFormat: "Button (feste Beschriftung, Formel als Klickziel)",
		numberFormat: "Zahl",
		dataSizeFormat: "Datengröße",
		durationFormat: "Zeit",
		emptyGroupLabel: "(leer)",
		summaryNone: "Keine",
		summarySum: "Summe",
		summaryCount: "Anzahl",
		summaryAvg: "Durchschnitt",
		summaryMin: "Minimum",
		summaryMax: "Maximum",
		rowCount: {
			one: "Zeile",
			other: "Zeilen"
		},
		linksEntryCount: {
			one: "Eintrag",
			other: "Einträge"
		}
	},
	recordForm: {
		record: "Datensatz",
		noPrimaryKey: "Diese Tabelle hat keinen eindeutigen Primärschlüssel und kann nicht als Formular geöffnet werden.",
		notFound: "Datensatz wurde nicht gefunden -- möglicherweise inzwischen gelöscht.",
		removeLink: "Verknüpfung zu {{label}} entfernen",
		open: "Öffnen",
		editMarkdown: "Markdown bearbeiten…"
	},
	tablePage: {
		tables: "Tabellen",
		columns: "Spalten",
		exportCsv: "CSV exportieren",
		confirmDeleteView: "Ansicht \"{{name}}\" wirklich löschen?",
		confirmDeleteRow: "Diese Zeile wirklich löschen?",
		confirmDropColumn: "Spalte \"{{name}}\" wirklich löschen? Das ändert das Schema der externen Datenbank dauerhaft.",
		readOnlyNoPk: "Diese Tabelle hat keinen oder einen zusammengesetzten Primärschlüssel — Zeilen anlegen, bearbeiten und löschen ist in dieser Version nicht möglich.",
		readOnlyViewer: "Du hast nur Lesezugriff auf diese Tabelle — Zeilen anlegen, bearbeiten und löschen ist nicht möglich.",
		deleteView: "Ansicht löschen",
		deleteViewFor: "Ansicht {{name}} löschen",
		saveViewShort: "+ Ansicht speichern",
		filter: "Filter",
		reset: "Zurücksetzen",
		group: "Gruppieren",
		searchPlaceholder: "Suchen…",
		loadedOfTotal: "{{loaded}} von {{total}} geladen",
		openApiDocs: "API-Dokumentation öffnen",
		openWebhooksForTable: "Webhooks für diese Tabelle öffnen",
		openSqlEditor: "SQL-Terminal öffnen",
		openTableSchema: "SQL-Schema anzeigen",
		createRow: "Zeile anlegen",
		apply: "Anwenden",
		noGroupLevels: "Noch keine Gruppierungsebene gewählt -- Zeilen werden ungruppiert angezeigt.",
		level: "Ebene {{n}}",
		moveLevelUp: "Ebene {{n}} nach oben verschieben",
		moveLevelDown: "Ebene {{n}} nach unten verschieben",
		addLevel: "+ Ebene hinzufügen",
		sort: "Sortieren",
		sortNone: "(keine Sortierung)",
		sortAscending: "Aufsteigend",
		sortDescending: "Absteigend",
		saveViewTitle: "Ansicht speichern",
		saveViewHint: "Speichert den aktuellen Filter, die Sortierung, die Seitengröße und die Zusammenfassungszeile als neue Ansicht.",
		saveViewNamePlaceholder: "z.B. Offene Bestellungen",
		manageColumnsTitle: "Spalten verwalten",
		viewScopeHint: "Sichtbarkeit und Reihenfolge unten gelten nur für die aktive Ansicht",
		moveColumn: "{{name}} verschieben",
		showInView: "{{name}} in dieser Ansicht anzeigen",
		tabPhysical: "Spalte",
		tabFormula: "Formel",
		tabLookup: "Lookup",
		tabRollup: "Rollup",
		tabLinks: "Links",
		tabForeignKey: "Verweis",
		tabAttachment: "Datei",
		tabAutoNumber: "Auto-Nummer",
		columnName: "Spaltenname",
		type: "Typ",
		addColumnHint: "Ändert das Schema der externen Datenbank (neue Spalte ist nullable).",
		autoNumberHint: "Vergibt automatisch fortlaufende Nummern (1, 2, 3, …). Bestehende Zeilen werden beim Anlegen einmalig befüllt.",
		foreignKeyHint: "Legt eine 1:n-Beziehung an (Verweis auf den Primärschlüssel der Zieltabelle) — nicht durch einen echten Datenbank-Constraint erzwungen. Darauf lassen sich anschließend Lookup- und Rollup-Felder aufbauen.",
		adding: "Fügt hinzu…",
		add: "Hinzufügen",
		expression: "Ausdruck",
		formulaPlaceholderExample: "IF(status == \"shipped\", \"Versandt\", \"Offen\")",
		fkColumn: "FK-Spalte",
		choose: "— wählen —",
		noMatchingColumn: "Keine passende Spalte vorhanden.",
		targetColumn: "Zielspalte",
		childTable: "Kind-Tabelle",
		fkBackToTable: "FK zurück auf diese Tabelle",
		columnToAggregate: "Zu aggregierende Spalte",
		function: "Funktion",
		columnNameHere: "Spaltenname (hier)",
		targetTable: "Zieltabelle",
		columnNameOnTarget: "Spaltenname (auf der Zieltabelle)",
		junctionTableLegend: "Junction-Tabelle",
		junctionModeGenerate: "Neu erzeugen",
		junctionModeExisting: "Bestehende verwenden",
		junctionExistingTable: "Junction-Tabelle",
		junctionColumnLocal: "Feld links (lokal)",
		junctionColumnRemote: "Feld rechts (remote)",
		maxFileSize: "Max. Dateigröße (MB, optional)",
		allowedMimeTypes: "Erlaubte Mime-Types (optional, komma-separiert)",
		viewType: "Ansichtstyp",
		viewTypeGrid: "Tabelle",
		viewTypeUnavailable: "Ansichtstyp \"{{type}}\" ist nicht verfügbar.",
		viewTypeUnavailableHint: "Das zugehörige Modul ist nicht geladen. Filter/Sortierung der Ansicht sind trotzdem gespeichert.",
		cmsNoImage: "Kein Bild",
		cmsPageSize: "Einträge pro Seite",
		cmsShowingRange: "{{from}}–{{to}} von {{total}}",
		cmsPrevPage: "Zurück",
		cmsNextPage: "Weiter",
		kanbanNoStatus: "Kein Status",
		kanbanShowMore: "{{n}} weitere anzeigen",
		kanbanDescriptionShowMore: "Mehr anzeigen",
		kanbanDescriptionShowLess: "Weniger anzeigen"
	},
	formulaDocs: {
		button: "Docs",
		title: "Formel-Referenz",
		intro: "Formeln beziehen sich auf Spalten der Tabelle über ihren Namen (kein Präfix, keine Anführungszeichen). Text steht in doppelten Anführungszeichen.",
		operatorsTitle: "Operatoren",
		opArithmetic: "Rechenoperatoren",
		opArithmeticDesc: "+  -  *  /  %  (Modulo)",
		opComparison: "Vergleich",
		opComparisonDesc: "==  !=  <  <=  >  >=",
		opLogical: "Logisch",
		opLogicalDesc: "&&  ||  !   (auch als and / or / not schreibbar)",
		opTernary: "Bedingter Ausdruck",
		opTernaryDesc: "bedingung ? dannWert : sonstWert",
		functionsTitle: "Funktionen",
		fnIfSignature: "IF(bedingung, dann, sonst)",
		fnIfDesc: "Liefert dann, wenn bedingung wahr ist, sonst sonst.",
		fnLenSignature: "LEN(text)",
		fnLenDesc: "Länge eines Textwerts in Zeichen.",
		fnUpperSignature: "UPPER(text)",
		fnUpperDesc: "Wandelt Text in Großbuchstaben um.",
		fnLowerSignature: "LOWER(text)",
		fnLowerDesc: "Wandelt Text in Kleinbuchstaben um."
	},
	tableSchema: {
		title: "SQL-Schema",
		loading: "Lädt…"
	},
	sqlEditor: {
		titlePrefix: "SQL-Terminal",
		warningBefore: "Führt SQL direkt gegen",
		warningAfter: "aus — SELECT, INSERT/UPDATE/DELETE und DDL (CREATE/ALTER/DROP) sind alle möglich. Es gibt kein Undo.",
		running: "Führt aus…",
		run: "Ausführen",
		confirmDestructive: "Dieses Statement verändert Daten oder Schema — wirklich ausführen?",
		confirmRun: "Ja, ausführen",
		executed: "Ausgeführt.",
		rowsAffected: "{{count}} Zeile(n) betroffen.",
		noRows: "0 Zeilen.",
		truncated: "Auf die ersten 1000 Zeilen gekürzt."
	},
	sqlImport: {
		title: "SQL importieren",
		file: "SQL-Datei",
		dropHint: "Datei hierher ziehen oder klicken zum Auswählen",
		dropHintSub: "Nur .sql-Dateien",
		analyzing: "Analysiere Datei…",
		noStatements: "Die Datei enthält keine ausführbaren SQL-Statements.",
		statementsDetected: "{{count}} Statement(s) erkannt.",
		warning: "Jedes Statement wird unabhängig ausgeführt (SELECT, INSERT/UPDATE/DELETE und DDL sind alle möglich, es gibt kein Undo). Schlägt eines fehl, laufen die übrigen trotzdem weiter -- am Ende siehst du eine vollständige Erfolg/Fehler-Liste.",
		unknownKind: "Statement",
		importing: "Importiert…",
		import: "Importieren",
		resultSummary: "{{succeeded}} von {{total}} Statement(s) erfolgreich.",
		statusOk: "OK",
		statusError: "Fehler"
	},
	webhooks: {
		title: "Webhooks",
		filterHintBefore: "Zeigt nur Webhooks, die für",
		filterHintAfter: "feuern (tabellenübergreifende eingeschlossen). Vollständige Verwaltung auf der Data-Source-Seite.",
		noneCount: "Kein Webhook",
		webhookCount: "{{count}} Webhook(s)",
		newWebhook: "Neuer Webhook",
		noneSetUp: "Noch kein passender Webhook eingerichtet.",
		targetUrl: "Ziel-URL",
		tables: "Tabellen",
		events: "Ereignisse",
		status: "Status",
		active: "Aktiv",
		disabledState: "Deaktiviert",
		notTriggeredYet: "noch nicht ausgelöst",
		error: "Fehler",
		allTables: "Alle Tabellen",
		eventCreated: "Datensatz angelegt",
		eventUpdated: "Datensatz geändert",
		eventDeleted: "Datensatz gelöscht",
		noTableSelectionHint: "Keine Auswahl = feuert für alle Tabellen der Verbindung.",
		secret: "Secret (optional)",
		secretPlaceholder: "Signiert den Payload per HMAC-SHA256",
		createWebhook: "Webhook anlegen"
	},
	createSqlite: {
		title: "Neue SQLite-Datenbank",
		namePlaceholder: "Meine neue Datenbank",
		filename: "Dateiname",
		filenamePlaceholder: "meine-datenbank",
		hint: "Wird als leere Datenbank angelegt -- die erste Tabelle legst du danach wie gewohnt über das SQL-Terminal oder CSV-Import an."
	},
	csvImport: {
		title: "CSV importieren",
		csvFile: "CSV-Datei",
		dropHint: "Datei hierher ziehen oder klicken zum Auswählen",
		dropHintSub: "Nur .csv-Dateien",
		analyzing: "Analysiere Datei…",
		rowsDetected: "{{count}} Zeile(n) erkannt, Trennzeichen",
		truncatedPreview: "Vorschau auf die ersten Zeilen gekürzt.",
		raggedRows: "{{count}} Zeile(n) mit abweichender Spaltenzahl (Zeile(n) {{rows}}) — diese schlagen beim Import fehl, sofern sie eine zugeordnete Spalte betreffen.",
		detectedColumns: "Erkannte Spalten",
		mapColumns: "Spalten zuordnen",
		skip: "Überspringen",
		rowsImported: "{{count}} Zeile(n) importiert.",
		rowsImportedInto: "{{count}} Zeile(n) importiert in \"{{schema}}.{{table}}\".",
		newTableFailureHint: "Schlägt eine Zeile fehl, wird der gesamte Import zurückgerollt -- die Tabelle selbst bleibt aber bestehen (leer), da das Anlegen der Tabelle nicht rückgängig gemacht werden kann.",
		existingTableFailureHint: "Schlägt eine Zeile fehl (z.B. Typkonflikt oder abweichende Spaltenzahl), wird der gesamte Import zurückgerollt -- es gibt kein DDL hier, der Import ist also vollständig atomar.",
		importing: "Importiert…",
		import: "Importieren"
	},
	tablePermissions: {
		title: "Tabellen-Berechtigungen",
		noneKnown: "Noch keine Tabellen bekannt.",
		inherit: "wie bisher",
		none: "kein Zugriff",
		read: "lesen",
		write: "schreiben",
		save: "Berechtigungen speichern"
	},
	filterBuilder: {
		and: "UND",
		or: "ODER",
		removeGroup: "Gruppe entfernen",
		removeCondition: "Bedingung entfernen",
		noConditions: "Keine Bedingungen -- diese Gruppe filtert nichts heraus.",
		addCondition: "+ Bedingung",
		addGroup: "+ Gruppe"
	},
	linksSelect: {
		addLink: "Verknüpfung hinzufügen",
		noPrimaryKey: "Zieltabelle hat keine Primärschlüsselspalte – Verknüpfung nicht möglich."
	},
	attachmentCell: {
		deleteFile: "{{name}} löschen",
		uploading: "Datei wird hochgeladen…",
		upload: "Datei hochladen"
	},
	fileDropzone: { changeFile: "Andere Datei wählen" },
	markdownEdit: {
		titlePrefix: "Markdown bearbeiten",
		placeholder: "# Überschrift\n\n**fett**, _kursiv_, - Liste …",
		previewPlaceholder: "Vorschau erscheint hier.",
		showPreview: "Vorschau einblenden",
		hidePreview: "Vorschau ausblenden",
		toolbar: {
			h1: "Überschrift 1",
			h2: "Überschrift 2",
			h3: "Überschrift 3",
			h4: "Überschrift 4",
			h5: "Überschrift 5",
			h6: "Überschrift 6",
			bold: "Fett",
			italic: "Kursiv",
			underline: "Unterstrichen",
			strikethrough: "Durchgestrichen",
			ul: "Aufzählungsliste",
			ol: "Nummerierte Liste",
			checklist: "Checkliste",
			table: "Tabelle einfügen"
		}
	},
	errors: {
		not_found: "Nicht gefunden.",
		invalid_credentials: "Ungültige Zugangsdaten.",
		forbidden: "Diese Aktion ist nicht erlaubt.",
		rate_limited: "Zu viele Versuche -- bitte später erneut versuchen.",
		last_admin: "Der letzte Administrator kann nicht entfernt oder herabgestuft werden.",
		duplicate_name: "Dieser Name ist bereits vergeben.",
		already_exists: "Existiert bereits.",
		cannot_delete_self: "Du kannst dein eigenes Konto nicht löschen.",
		cannot_drop_pk: "Die Primärschlüsselspalte kann nicht gelöscht werden.",
		invalid_body: "Ungültige Anfrage.",
		invalid_field: "Ungültiges Feld.",
		invalid_name: "Ungültiger Name.",
		invalid_expression: "Ungültiger Formel-Ausdruck.",
		circular_reference: "Zirkulärer Verweis erkannt.",
		file_too_large: "Datei ist zu groß.",
		unsupported_mime_type: "Dateityp wird nicht unterstützt.",
		empty_file: "Datei ist leer.",
		invalid_csv: "Ungültige CSV-Datei.",
		missing_field: "Pflichtfeld fehlt.",
		not_authenticated: "Bitte melde dich an.",
		invalid_token: "Sitzung ungültig oder abgelaufen.",
		no_columns: "Mindestens eine Spalte ist erforderlich.",
		not_editable: "Nicht bearbeitbar.",
		view_not_found: "Ansicht nicht gefunden.",
		unsupported_db_type: "Nicht unterstützter Datenbanktyp.",
		multiple_statements: "Nur eine SQL-Anweisung gleichzeitig erlaubt.",
		empty_mapping: "Keine Spalte zugeordnet.",
		column_count_mismatch: "Anzahl der Spalten stimmt nicht überein."
	},
	apiDocs: {
		title: "API-Dokumentation",
		description: "Allgemeine, nicht tabellenspezifische Endpunkte. Für Endpunkte einer konkreten Tabelle (Datensätze lesen/schreiben, Verknüpfungen, Anhänge) öffne die API-Dokumentation direkt in der jeweiligen Tabellenansicht. Alle Beispiele setzen einen gültigen API-Token voraus, siehe",
		myAccountLink: "Mein Konto",
		currentAccessBefore: "Dein aktueller Zugriff auf diese Tabelle:",
		readWrite: "Lesen & Schreiben",
		readOnly: "Nur Lesen",
		tableExamplesHint: "Alle Beispiele setzen einen gültigen API-Token voraus (siehe",
		noSinglePkWarning: "Diese Tabelle hat keinen oder einen zusammengesetzten Primärschlüssel — einzelne Zeilen können über die REST-API nicht gezielt angesprochen werden. Schreiben, Verknüpfungen und Anhänge sind deshalb hier nicht aufgeführt."
	}
}, na = {
	common: {
		username: "Username",
		password: "Password",
		email: "Email",
		name: "Name",
		role: "Role",
		createdAt: "Created at",
		close: "Close",
		cancel: "Cancel",
		save: "Save",
		saving: "Saving…",
		edit: "Edit",
		delete: "Delete",
		deleting: "Deleting…",
		create: "Create",
		creating: "Creating…",
		back: "Back",
		next: "Next",
		remove: "Remove",
		errorLoading: "Error loading",
		noResults: "No results",
		search: "Search…",
		refineSearch: "More results – refine your search",
		creatingAlt: "Creating…",
		allDataSources: "All data sources",
		rangeOfTotal: "{{from}}–{{to}} of {{total}}",
		rangeEmpty: "0 of 0",
		yes: "Yes",
		no: "No"
	},
	auth: {
		login: {
			subtitle: "Please sign in.",
			submit: "Sign in",
			submitting: "Signing in…"
		},
		setup: {
			subtitle: "Welcome! Create the first administrator account.",
			passwordRepeat: "Repeat password",
			passwordMismatch: "The passwords do not match.",
			submit: "Create administrator",
			submitting: "Setting up…"
		}
	},
	nav: {
		connections: "Connections",
		newSqliteDatabase: "Create new SQLite database",
		loading: "Loading…",
		noTables: "No tables",
		noViews: "No views",
		settings: "Settings",
		logout: "Log out",
		openMenu: "Open menu",
		collapseSidebar: "Collapse sidebar",
		expandSidebar: "Expand sidebar",
		expand: "Expand {{name}}",
		collapse: "Collapse {{name}}",
		viewOptionsFor: "Options for view {{name}}",
		viewSettings: "Settings",
		viewSettingsTitle: "View settings: {{name}}",
		junctionTableChip: "Admin",
		junctionTableHint: "Only visible to admins — junction table for a links field"
	},
	theme: {
		light: "Light",
		dark: "Dark",
		system: "System default"
	},
	language: {
		label: "Language",
		de: "German",
		en: "English"
	},
	settings: {
		title: "Settings",
		tabs: {
			dataSources: "Data Sources",
			apiDocs: "API Documentation",
			auditLog: "Audit Log",
			files: "Files",
			users: "Users",
			groups: "Groups",
			scripts: "Scripts",
			myAccount: "My Account"
		},
		users: {
			subtitle: "All user accounts on this instance",
			newUser: "New user",
			confirmDelete: "Really delete user \"{{email}}\"?",
			editUser: "Edit user",
			resetPassword: "Reset password",
			newPasswordPlaceholder: "New password",
			setting: "Setting…",
			set: "Set",
			loadingGroupMembership: "Loading group membership…",
			memberOf: "Member of: {{groups}}",
			managedUnderGroups: "— managed under Settings → Groups"
		},
		account: {
			accountSection: "Account",
			changeEmail: "Change email",
			changePasswordSection: "Change password",
			passwordChanged: "Password changed successfully.",
			currentPassword: "Current password",
			newPassword: "New password",
			changing: "Changing…",
			changePassword: "Change password",
			apiTokens: "API tokens",
			tokenCreatedNotice: "Token \"{{name}}\" created — shown only now, not retrievable afterwards:",
			hide: "Hide",
			tokenNamePlaceholder: "e.g. n8n workflow",
			createToken: "Create token",
			noTokens: "No API tokens created yet.",
			lastUsed: "Last used",
			confirmDeleteToken: "Really delete API token \"{{name}}\"?"
		},
		datasources: {
			subtitle: "Connected databases and their sync status",
			newSqliteDatabase: "New SQLite database",
			newDataSource: "New data source",
			noneYet: "No data source created yet.",
			createFirst: "Create first connection",
			type: "Type",
			connection: "Connection",
			status: "Status",
			lastSync: "Last sync",
			syncing: "Syncing…",
			sync: "Sync",
			confirmDelete: "Really remove data source \"{{name}}\"? All associated tables, views, permissions, webhooks and attachments in IllusionDB will be permanently deleted along with it. The external database itself remains unchanged.",
			namePlaceholder: "Production CRM",
			filePath: "File path",
			database: "Database",
			user: "User",
			sslMode: "SSL mode"
		},
		files: {
			subtitle: "All uploaded files across all data sources",
			galleryView: "Gallery",
			listView: "List",
			allTables: "All tables",
			allColumns: "All columns",
			allFileTypes: "All file types",
			filenamePlaceholder: "Filename…",
			filename: "Filename",
			tableColumn: "Table.Column",
			size: "Size",
			uploaded: "Uploaded",
			noFiles: "No files found.",
			confirmDelete: "Really delete file \"{{name}}\"?"
		},
		auditLog: {
			subtitle: "Schema changes (create/delete table/column) across all data sources",
			allActions: "All actions",
			timestamp: "Timestamp",
			action: "Action",
			target: "Target",
			actor: "Actor",
			details: "Details",
			noEntries: "No entries found.",
			actionCreateTable: "Table created",
			actionAddColumn: "Column added",
			actionDropColumn: "Column dropped"
		},
		groups: {
			subtitle: "Table permissions bundled for multiple users at once",
			newGroup: "New group",
			noneYet: "No group created yet.",
			createFirst: "Create first group",
			members: "Members",
			confirmDelete: "Really delete group \"{{name}}\"?",
			namePlaceholder: "Sales",
			editGroup: "Edit group",
			noViewers: "No viewer accounts exist.",
			saveMembers: "Save members"
		},
		scripts: {
			subtitle: "JavaScript scripts (goja) for custom HTTP endpoints and event hooks",
			newScript: "New script",
			noneYet: "No script created yet.",
			createFirst: "Create first script",
			editScript: "Edit script",
			confirmDelete: "Really delete script \"{{name}}\"? Associated endpoints/hooks are deleted with it.",
			namePlaceholder: "e.g. hello-endpoint",
			codePlaceholder: "// Custom endpoint: request/response available\n// Hook: event available\n// Both: illusiondb.* and log(...)\n// Code runs inside a function -- return <value> gives the result,\n// no return means the result is undefined.\nreturn { ok: true };",
			enabled: "Enabled",
			code: "Code",
			endpointsTitle: "Custom Endpoints",
			endpointsSubtitle: "Reachable at /api/v1/scripts/<path>, live, no restart",
			newEndpoint: "New endpoint",
			editEndpoint: "Edit endpoint",
			noneEndpointsYet: "No endpoint registered yet.",
			method: "Method",
			path: "Path",
			pathPlaceholder: "/hello or /users/:id",
			pathHint: ":name captures one segment, a trailing * captures everything remaining. On overlap the more specific path wins (literal > :name > *); ties go to whichever was created first.",
			authMode: "Auth mode",
			authPublic: "Public",
			authAuthenticated: "Authenticated",
			confirmDeleteEndpoint: "Really delete endpoint \"{{method}} {{path}}\"?",
			hooksTitle: "Event Hooks",
			hooksSubtitle: "Runs in the background after a record write, never blocks the request",
			newHook: "New hook",
			editHook: "Edit hook",
			noneHooksYet: "No hook bound yet.",
			event: "Event",
			table: "Table",
			allTables: "All tables",
			position: "Position",
			confirmDeleteHook: "Really delete this hook?",
			script: "Script",
			selectScript: "Select a script…",
			noScriptsForBinding: "Create a script first to bind an endpoint/hook to it.",
			testRun: "Test run",
			running: "Running…",
			testRunHint: "Really runs the current code (even unsaved) -- illusiondb.* has full access, this is not a sandboxed dry run.",
			testRunLogs: "Console",
			testRunNoLogs: "No log(...) output.",
			testRunReturnValue: "Return value",
			testRunResponse: "Response",
			testRunError: "Error",
			testRunResultPanel: "Result",
			showOutput: "Show output",
			hideOutput: "Hide output",
			testRunPlaceholder: "No test run yet.",
			testRunNoResult: "No return value, no response.",
			apiSnippets: "illusiondb.* API",
			download: "Download",
			import: "Import",
			importInvalidFile: "The file could not be read.",
			importDropTitle: "Import script",
			importDropHint: "Drop a file here or click to browse",
			importDropHintSub: "JS files only"
		},
		datasourceDetail: {
			downloadSqlite: "Download database",
			exportSchema: "Export connection settings",
			importSchema: "Import connection settings",
			importSchemaHint: "Choose a JSON file previously created via \"Export connection settings\". Tables/columns must already exist (via Sync) -- import never creates new database columns, only formulas/lookups/rollups/links/file fields, display settings, and saved views.",
			importSchemaInvalidJson: "That file is not valid JSON.",
			importSchemaJsonOnly: "JSON files only",
			importSchemaSummary: "{{matched}} table(s) matched, {{skipped}} skipped. {{created}} column(s) created, {{updated}} updated. {{viewsCreated}} view(s) created, {{viewsUpdated}} updated.",
			sqlEditor: "SQL terminal",
			importCsv: "Import CSV",
			importSql: "Import SQL",
			newTable: "New table",
			noTablesYet: "No tables known yet.",
			hintBefore: "Run \"Sync\" once on the",
			hintLinkText: "overview",
			hintAfter: "page.",
			schema: "Schema",
			table: "Table",
			columns: "Columns",
			lastSynced: "Last synced",
			webhooks: "Webhooks",
			manageWebhooks: "Manage webhooks",
			noWebhooks: "No webhook set up for this connection yet.",
			webhooksCount: "{{count}} webhook(s) set up.",
			createTableTitle: "Create new table",
			tableName: "Table name",
			tableNamePlaceholder: "customers",
			pkHintBefore: "Every new table automatically gets a UUID primary key column",
			pkHintAfter: "— do not add it here.",
			columnNamePlaceholder: "Column name",
			remove: "Remove",
			addColumn: "+ Column",
			createTable: "Create table"
		}
	},
	formats: {
		fieldType: {
			longText: "Long text",
			number: "Number",
			decimal: "Decimal",
			boolean: "Boolean",
			date: "Date",
			datetime: "Date & time",
			uuid: "UUID",
			json: "JSON",
			text: "Text",
			links: "Link",
			attachment: "Attachment"
		},
		dateFormatName: {
			iso: "ISO",
			de: "German",
			us: "US",
			gb: "GB",
			long: "Long form"
		},
		timeFormatName: {
			"24h": "24-hour",
			"12h": "12-hour"
		},
		numberStyleName: {
			plain: "Plain",
			currency: "Currency",
			percent: "Percent",
			temperature: "Temperature"
		}
	},
	dataGrid: {
		columnOptionsFor: "Options for {{name}}",
		columnOptions: "Column options",
		resizeColumnFor: "Resize {{name}}",
		addField: "Add new field",
		displayColumn: "Display column",
		openRecord: "Open record",
		loadingMoreRows: "Loading more rows…",
		endOfList: "– End of list –",
		defaultValue: "Default: {{value}}",
		automatic: "automatic",
		newRow: "New row",
		editSummaryFor: "Edit summary for {{name}}",
		editSummary: "Edit summary",
		noRows: "No rows.",
		summary: "Summary",
		column: "Column",
		unpinDisplay: "Remove display field",
		pinDisplay: "Set as display field",
		hideInView: "Hide in this view",
		editField: "Edit field",
		fieldName: "Field name",
		physicalNameBefore: "Physical column name:",
		physicalNameAfter: "-- leave blank to remove the override.",
		formula: "Formula",
		fieldType: "Field type",
		uiTypeOverrideHint: "Overrides the auto-detected rendering -- e.g. to force a date/time picker on SQLite (which has no native date type), or to enable number formatting on a formula column.",
		originalUnformatted: "Original (unformatted)",
		dateFormat: "Date format",
		timeFormat: "Time format",
		style: "Style",
		decimals: "Decimal places",
		thousandsSeparator: "Thousands separator",
		currency: "Currency",
		unit: "Unit",
		chooseOtherFormat: "Choose a different format",
		loadingValues: "Loading values…",
		value: "Value",
		customColor: "Custom color",
		chooseCustomColor: "Choose custom color",
		removeRow: "Remove row",
		reorderValue: "Reorder value",
		truncatedValues: "Only the first {{count}} values were taken over — there are more.",
		addValue: "+ Value",
		label: "Label",
		buttonLabelPlaceholder: "e.g. Open invoice",
		buttonFormulaHint: "The formula supplies the click target (a URL) -- the button always shows this fixed text, not the formula result.",
		target: "Target",
		newTab: "New tab",
		sameTab: "Same tab",
		plainText: "Plain text",
		labelFormat: "Label (values + colors)",
		tagsFormat: "Tags (comma-separated)",
		emailFormat: "Email address (link)",
		phoneFormat: "Phone number (link)",
		urlFormat: "URL (link)",
		colorFormat: "Color (hex value)",
		buttonFormat: "Button (fixed label, formula as click target)",
		numberFormat: "Number",
		dataSizeFormat: "Data size",
		durationFormat: "Duration",
		emptyGroupLabel: "(empty)",
		summaryNone: "None",
		summarySum: "Sum",
		summaryCount: "Count",
		summaryAvg: "Average",
		summaryMin: "Minimum",
		summaryMax: "Maximum",
		rowCount: {
			one: "row",
			other: "rows"
		},
		linksEntryCount: {
			one: "entry",
			other: "entries"
		}
	},
	recordForm: {
		record: "Record",
		noPrimaryKey: "This table has no unique primary key and cannot be opened as a form.",
		notFound: "Record not found -- it may have been deleted since.",
		removeLink: "Remove link to {{label}}",
		open: "Open",
		editMarkdown: "Edit markdown…"
	},
	tablePage: {
		tables: "Tables",
		columns: "Columns",
		exportCsv: "Export CSV",
		confirmDeleteView: "Really delete view \"{{name}}\"?",
		confirmDeleteRow: "Really delete this row?",
		confirmDropColumn: "Really delete column \"{{name}}\"? This permanently changes the external database's schema.",
		readOnlyNoPk: "This table has no primary key or a composite one — creating, editing, and deleting rows is not possible in this version.",
		readOnlyViewer: "You only have read access to this table — creating, editing, and deleting rows is not possible.",
		deleteView: "Delete view",
		deleteViewFor: "Delete view {{name}}",
		saveViewShort: "+ Save view",
		filter: "Filter",
		reset: "Reset",
		group: "Group",
		searchPlaceholder: "Search…",
		loadedOfTotal: "{{loaded}} of {{total}} loaded",
		openApiDocs: "Open API documentation",
		openWebhooksForTable: "Open webhooks for this table",
		openSqlEditor: "Open SQL terminal",
		openTableSchema: "View SQL schema",
		createRow: "Create row",
		apply: "Apply",
		noGroupLevels: "No grouping level chosen yet -- rows are shown ungrouped.",
		level: "Level {{n}}",
		moveLevelUp: "Move level {{n}} up",
		moveLevelDown: "Move level {{n}} down",
		addLevel: "+ Add level",
		sort: "Sort",
		sortNone: "(no sorting)",
		sortAscending: "Ascending",
		sortDescending: "Descending",
		saveViewTitle: "Save view",
		saveViewHint: "Saves the current filter, sort order, page size, and summary row as a new view.",
		saveViewNamePlaceholder: "e.g. Open orders",
		manageColumnsTitle: "Manage columns",
		viewScopeHint: "Visibility and order below apply only to the active view",
		moveColumn: "Move {{name}}",
		showInView: "Show {{name}} in this view",
		tabPhysical: "Column",
		tabFormula: "Formula",
		tabLookup: "Lookup",
		tabRollup: "Rollup",
		tabLinks: "Links",
		tabForeignKey: "Reference",
		tabAttachment: "File",
		tabAutoNumber: "Auto number",
		columnName: "Column name",
		type: "Type",
		addColumnHint: "Changes the external database's schema (the new column is nullable).",
		autoNumberHint: "Automatically assigns sequential numbers (1, 2, 3, …). Existing rows are backfilled once when the column is created.",
		foreignKeyHint: "Creates a 1:n relationship (a reference to the target table's primary key) -- not enforced by a real database constraint. Lookup and rollup fields can be built on top of it afterward.",
		adding: "Adding…",
		add: "Add",
		expression: "Expression",
		formulaPlaceholderExample: "IF(status == \"shipped\", \"Shipped\", \"Open\")",
		fkColumn: "FK column",
		choose: "— choose —",
		noMatchingColumn: "No matching column available.",
		targetColumn: "Target column",
		childTable: "Child table",
		fkBackToTable: "FK back to this table",
		columnToAggregate: "Column to aggregate",
		function: "Function",
		columnNameHere: "Column name (here)",
		targetTable: "Target table",
		columnNameOnTarget: "Column name (on the target table)",
		junctionTableLegend: "Junction table",
		junctionModeGenerate: "Generate new",
		junctionModeExisting: "Use existing",
		junctionExistingTable: "Junction table",
		junctionColumnLocal: "Left field (local)",
		junctionColumnRemote: "Right field (remote)",
		maxFileSize: "Max. file size (MB, optional)",
		allowedMimeTypes: "Allowed MIME types (optional, comma-separated)",
		viewType: "View type",
		viewTypeGrid: "Grid",
		viewTypeUnavailable: "View type \"{{type}}\" is unavailable.",
		viewTypeUnavailableHint: "Its module isn't loaded. The view's filters/sort are still saved.",
		cmsNoImage: "No image",
		cmsPageSize: "Rows per page",
		cmsShowingRange: "{{from}}–{{to}} of {{total}}",
		cmsPrevPage: "Previous",
		cmsNextPage: "Next",
		kanbanNoStatus: "No status",
		kanbanShowMore: "Show {{n}} more",
		kanbanDescriptionShowMore: "Show more",
		kanbanDescriptionShowLess: "Show less"
	},
	formulaDocs: {
		button: "Docs",
		title: "Formula reference",
		intro: "Formulas refer to table columns by their plain name (no prefix, no quotes). Text values are written in double quotes.",
		operatorsTitle: "Operators",
		opArithmetic: "Arithmetic",
		opArithmeticDesc: "+  -  *  /  %  (modulo)",
		opComparison: "Comparison",
		opComparisonDesc: "==  !=  <  <=  >  >=",
		opLogical: "Logical",
		opLogicalDesc: "&&  ||  !   (also spelled and / or / not)",
		opTernary: "Conditional expression",
		opTernaryDesc: "condition ? thenValue : elseValue",
		functionsTitle: "Functions",
		fnIfSignature: "IF(condition, then, else)",
		fnIfDesc: "Returns then when condition is true, otherwise else.",
		fnLenSignature: "LEN(text)",
		fnLenDesc: "Length of a text value in characters.",
		fnUpperSignature: "UPPER(text)",
		fnUpperDesc: "Converts text to uppercase.",
		fnLowerSignature: "LOWER(text)",
		fnLowerDesc: "Converts text to lowercase."
	},
	tableSchema: {
		title: "SQL schema",
		loading: "Loading…"
	},
	sqlEditor: {
		titlePrefix: "SQL terminal",
		warningBefore: "Runs SQL directly against",
		warningAfter: "— SELECT, INSERT/UPDATE/DELETE and DDL (CREATE/ALTER/DROP) are all possible. There is no undo.",
		running: "Running…",
		run: "Run",
		confirmDestructive: "This statement changes data or schema — really run it?",
		confirmRun: "Yes, run it",
		executed: "Executed.",
		rowsAffected: "{{count}} row(s) affected.",
		noRows: "0 rows.",
		truncated: "Truncated to the first 1000 rows."
	},
	sqlImport: {
		title: "Import SQL",
		file: "SQL file",
		dropHint: "Drop a file here or click to browse",
		dropHintSub: "SQL files only",
		analyzing: "Analyzing file…",
		noStatements: "The file contains no executable SQL statements.",
		statementsDetected: "{{count}} statement(s) detected.",
		warning: "Each statement runs independently (SELECT, INSERT/UPDATE/DELETE and DDL are all possible, there is no undo). If one fails, the rest still run -- you get a full success/failure list at the end.",
		unknownKind: "Statement",
		importing: "Importing…",
		import: "Import",
		resultSummary: "{{succeeded}} of {{total}} statement(s) succeeded.",
		statusOk: "OK",
		statusError: "Error"
	},
	webhooks: {
		title: "Webhooks",
		filterHintBefore: "Shows only webhooks that fire for",
		filterHintAfter: "(including cross-table ones). Full management is on the data source page.",
		noneCount: "No webhooks",
		webhookCount: "{{count}} webhook(s)",
		newWebhook: "New webhook",
		noneSetUp: "No matching webhook set up yet.",
		targetUrl: "Target URL",
		tables: "Tables",
		events: "Events",
		status: "Status",
		active: "Active",
		disabledState: "Disabled",
		notTriggeredYet: "not triggered yet",
		error: "Error",
		allTables: "All tables",
		eventCreated: "Record created",
		eventUpdated: "Record updated",
		eventDeleted: "Record deleted",
		noTableSelectionHint: "No selection = fires for every table in the connection.",
		secret: "Secret (optional)",
		secretPlaceholder: "Signs the payload via HMAC-SHA256",
		createWebhook: "Create webhook"
	},
	createSqlite: {
		title: "New SQLite database",
		namePlaceholder: "My new database",
		filename: "Filename",
		filenamePlaceholder: "my-database",
		hint: "Created as an empty database -- create the first table afterwards as usual via the SQL terminal or CSV import."
	},
	csvImport: {
		title: "Import CSV",
		csvFile: "CSV file",
		dropHint: "Drop a file here or click to browse",
		dropHintSub: "CSV files only",
		analyzing: "Analyzing file…",
		rowsDetected: "{{count}} row(s) detected, delimiter",
		truncatedPreview: "Preview truncated to the first few rows.",
		raggedRows: "{{count}} row(s) with a differing column count (row(s) {{rows}}) — these will fail on import if they affect a mapped column.",
		detectedColumns: "Detected columns",
		mapColumns: "Map columns",
		skip: "Skip",
		rowsImported: "{{count}} row(s) imported.",
		rowsImportedInto: "{{count}} row(s) imported into \"{{schema}}.{{table}}\".",
		newTableFailureHint: "If a row fails, the whole import is rolled back -- the table itself remains (empty), since creating the table cannot be undone.",
		existingTableFailureHint: "If a row fails (e.g. a type conflict or differing column count), the whole import is rolled back -- there is no DDL here, so the import is fully atomic.",
		importing: "Importing…",
		import: "Import"
	},
	tablePermissions: {
		title: "Table permissions",
		noneKnown: "No tables known yet.",
		inherit: "as before",
		none: "no access",
		read: "read",
		write: "write",
		save: "Save permissions"
	},
	filterBuilder: {
		and: "AND",
		or: "OR",
		removeGroup: "Remove group",
		removeCondition: "Remove condition",
		noConditions: "No conditions -- this group filters nothing out.",
		addCondition: "+ Condition",
		addGroup: "+ Group"
	},
	linksSelect: {
		addLink: "Add link",
		noPrimaryKey: "Target table has no primary key column – linking is not possible."
	},
	attachmentCell: {
		deleteFile: "Delete {{name}}",
		uploading: "Uploading file…",
		upload: "Upload file"
	},
	fileDropzone: { changeFile: "Choose a different file" },
	markdownEdit: {
		titlePrefix: "Edit markdown",
		placeholder: "# Heading\n\n**bold**, _italic_, - list …",
		previewPlaceholder: "Preview appears here.",
		showPreview: "Show preview",
		hidePreview: "Hide preview",
		toolbar: {
			h1: "Heading 1",
			h2: "Heading 2",
			h3: "Heading 3",
			h4: "Heading 4",
			h5: "Heading 5",
			h6: "Heading 6",
			bold: "Bold",
			italic: "Italic",
			underline: "Underline",
			strikethrough: "Strikethrough",
			ul: "Bullet list",
			ol: "Numbered list",
			checklist: "Checklist",
			table: "Insert table"
		}
	},
	errors: {
		not_found: "Not found.",
		invalid_credentials: "Invalid credentials.",
		forbidden: "This action is not allowed.",
		rate_limited: "Too many attempts -- please try again later.",
		last_admin: "The last administrator cannot be removed or demoted.",
		duplicate_name: "This name is already taken.",
		already_exists: "Already exists.",
		cannot_delete_self: "You cannot delete your own account.",
		cannot_drop_pk: "The primary key column cannot be deleted.",
		invalid_body: "Invalid request.",
		invalid_field: "Invalid field.",
		invalid_name: "Invalid name.",
		invalid_expression: "Invalid formula expression.",
		circular_reference: "Circular reference detected.",
		file_too_large: "File is too large.",
		unsupported_mime_type: "File type not supported.",
		empty_file: "File is empty.",
		invalid_csv: "Invalid CSV file.",
		missing_field: "Required field is missing.",
		not_authenticated: "Please sign in.",
		invalid_token: "Session is invalid or has expired.",
		no_columns: "At least one column is required.",
		not_editable: "Not editable.",
		view_not_found: "View not found.",
		unsupported_db_type: "Unsupported database type.",
		multiple_statements: "Only one SQL statement is allowed at a time.",
		empty_mapping: "No column mapped.",
		column_count_mismatch: "Column count does not match."
	},
	apiDocs: {
		title: "API documentation",
		description: "General, non-table-specific endpoints. For endpoints of a specific table (reading/writing records, links, attachments), open the API documentation directly from that table view. All examples assume a valid API token, see",
		myAccountLink: "My account",
		currentAccessBefore: "Your current access to this table:",
		readWrite: "Read & write",
		readOnly: "Read only",
		tableExamplesHint: "All examples assume a valid API token (see",
		noSinglePkWarning: "This table has no primary key or a composite one — individual rows cannot be targeted via the REST API. Writes, links, and attachments are therefore not listed here."
	}
}, ra = {
	de: ta,
	en: na
};
function ia(e, t) {
	return t.reduce((e, t) => {
		if (!(typeof e != "object" || !e)) return e[t];
	}, e);
}
function aa(e, t) {
	return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : `{{${n}}}`) : e;
}
function oa(e) {
	return typeof e == "object" && !!e && "one" in e && "other" in e;
}
function sa(e) {
	let t = e.split(".");
	return ia(ra[ea.current], t) ?? ia(ra.de, t);
}
function Z(e, t) {
	let n = sa(e);
	return typeof n == "string" ? aa(n, t) : oa(n) ? aa(n.other, t) : e;
}
//#endregion
//#region src/lib/formatters.ts
function ca() {
	return ea.current === "en" ? "en-US" : "de-DE";
}
function la(e) {
	return e == null ? "" : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "object" ? JSON.stringify(e) : String(e);
}
function ua(e, t) {
	return e._fk_display?.[t.effective_name];
}
function da(e, t) {
	return e._fk_display_format?.[t.effective_name];
}
function fa(e, t) {
	let n = ua(e, t);
	if (n === void 0) return;
	let r = da(e, t);
	return r ? Da(n, r) : la(n);
}
var pa = /* @__PURE__ */ new Set(["http:", "https:"]);
function ma(e) {
	if (!e) return e;
	try {
		let t = typeof location < "u" ? location.href : "http://localhost/";
		return pa.has(new URL(e, t).protocol) ? e : "#";
	} catch {
		return "#";
	}
}
function ha(e, t) {
	let n = la(t);
	return e.display_format === "email" ? `mailto:${n}` : e.display_format === "phone" ? `tel:${n}` : ma(n);
}
function ga(e) {
	if (e === !0 || e === 1) return !0;
	if (typeof e == "string") {
		let t = e.trim().toLowerCase();
		return t === "1" || t === "true";
	}
	return !1;
}
function _a(e) {
	return la(e).split(",").map((e) => e.trim()).filter((e) => e.length > 0);
}
var va = {
	de: [
		"Januar",
		"Februar",
		"März",
		"April",
		"Mai",
		"Juni",
		"Juli",
		"August",
		"September",
		"Oktober",
		"November",
		"Dezember"
	],
	en: [
		"January",
		"February",
		"March",
		"April",
		"May",
		"June",
		"July",
		"August",
		"September",
		"October",
		"November",
		"December"
	]
};
function ya(e, t, n, r) {
	switch (r) {
		case "de": return `${n}.${t}.${e}`;
		case "us": return `${t}/${n}/${e}`;
		case "gb": return `${n}/${t}/${e}`;
		case "long": return `${parseInt(n, 10)}. ${va[ea.current][parseInt(t, 10) - 1] ?? t} ${e}`;
		default: return `${e}-${t}-${n}`;
	}
}
function ba(e, t, n) {
	if (n !== "12h") return `${e}:${t}`;
	let r = parseInt(e, 10), i = r < 12 ? "AM" : "PM";
	return `${r % 12 || 12}:${t} ${i}`;
}
function xa(e, t) {
	let n = la(e);
	if (!n) return n;
	let r = ya(n.slice(0, 4), n.slice(5, 7), n.slice(8, 10), t.format_config.date_format ?? "iso");
	return t.ui_type !== "datetime" || !t.format_config.time_format ? r : `${r} ${ba(n.slice(11, 13), n.slice(14, 16), t.format_config.time_format)}`;
}
function Sa(e, t) {
	if (e == null || e === "") return la(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return la(e);
	let r = t.format_config, i = r.decimals ?? (t.ui_type === "decimal" ? 2 : 0), a = {
		minimumFractionDigits: i,
		maximumFractionDigits: i,
		useGrouping: r.thousands_separator ?? !0
	};
	switch (r.style) {
		case "currency": return new Intl.NumberFormat(ca(), {
			...a,
			style: "currency",
			currency: r.currency ?? "EUR"
		}).format(n);
		case "percent": return `${new Intl.NumberFormat(ca(), a).format(n)} %`;
		case "temperature": return `${new Intl.NumberFormat(ca(), a).format(n)} ${r.temperature_unit === "fahrenheit" ? "°F" : "°C"}`;
		default: return new Intl.NumberFormat(ca(), a).format(n);
	}
}
var Ca = {
	KB: 1024,
	MB: 1024 ** 2,
	GB: 1024 ** 3,
	TB: 1024 ** 4
};
function wa(e, t) {
	if (e == null || e === "") return la(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return la(e);
	let r = t.format_config.unit ?? "MB", i = n / (Ca[r] ?? Ca.MB);
	return `${new Intl.NumberFormat(ca(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
var Ta = {
	s: 1e3,
	min: 6e4,
	h: 36e5,
	d: 864e5
};
function Ea(e, t) {
	if (e == null || e === "") return la(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return la(e);
	let r = t.format_config.unit ?? "s", i = n / (Ta[r] ?? Ta.s);
	return `${new Intl.NumberFormat(ca(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
function Da(e, t) {
	return t.display_format === "date_format" ? xa(e, t) : t.display_format === "number_format" ? Sa(e, t) : t.display_format === "data_size" ? wa(e, t) : t.display_format === "duration" ? Ea(e, t) : la(e);
}
function Oa(e) {
	switch (e.field_kind) {
		case "formula": return "ƒ";
		case "lookup": return "→";
		case "rollup": return "Σ";
		case "links": return "⇄";
		default: return null;
	}
}
function ka(e) {
	return Array.isArray(e) ? e : [];
}
function Aa(e, t) {
	if (t.is_foreign_key) {
		let n = fa(e, t);
		return n === void 0 ? la(e[t.effective_name]) : n;
	}
	return t.field_kind === "links" ? ka(e[t.effective_name]).map((e) => la(e.label)).join(", ") : t.ui_type === "boolean" ? ga(e[t.effective_name]) ? Z("common.yes") : Z("common.no") : t.display_format === "tags" ? _a(e[t.effective_name]).join(", ") : Da(e[t.effective_name], t);
}
function ja(e, t) {
	let n = la(e);
	return t.ui_type === "date" ? n.slice(0, 10) : t.ui_type === "datetime" ? n.slice(0, 19).replace(" ", "T") : n;
}
//#endregion
//#region src/lib/labelColors.ts
var Ma = {
	gray: "bg-ink-200 text-ink-700",
	red: "bg-red-100 text-red-700",
	orange: "bg-orange-100 text-orange-700",
	amber: "bg-amber-100 text-amber-700",
	yellow: "bg-yellow-100 text-yellow-700",
	green: "bg-green-100 text-green-700",
	teal: "bg-teal-100 text-teal-700",
	blue: "bg-blue-100 text-blue-700",
	indigo: "bg-indigo-100 text-indigo-700",
	purple: "bg-purple-100 text-purple-700",
	pink: "bg-pink-100 text-pink-700"
};
function Na(e) {
	return /^#[0-9a-fA-F]{6}$/.test(e);
}
function Pa(e, t) {
	return t && t.length === Object.keys(e).length ? [...t] : Object.keys(e);
}
function Fa(e) {
	let t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), r = parseInt(e.slice(5, 7), 16);
	return (.299 * t + .587 * n + .114 * r) / 255 > .6 ? "#1f2937" : "#ffffff";
}
//#endregion
//#region src/lib/overlayScroll.ts
function Ia(e) {
	let t;
	function n() {
		e.classList.add("is-scrolling"), clearTimeout(t), t = setTimeout(() => e.classList.remove("is-scrolling"), 800);
	}
	return e.addEventListener("scroll", n), { destroy() {
		e.removeEventListener("scroll", n), clearTimeout(t);
	} };
}
//#endregion
//#region node_modules/marked/lib/marked.esm.js
function La() {
	return {
		async: !1,
		breaks: !1,
		extensions: null,
		gfm: !0,
		hooks: null,
		pedantic: !1,
		renderer: null,
		silent: !1,
		tokenizer: null,
		walkTokens: null
	};
}
var Ra = La();
function za(e) {
	Ra = e;
}
var Ba = { exec: () => null };
function Va(e) {
	let t = [];
	return (n) => {
		let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
		return i || (i = e(r), t[r] = i), i;
	};
}
function Q(e, t = "") {
	let n = typeof e == "string" ? e : e.source, r = {
		replace: (e, t) => {
			let i = typeof t == "string" ? t : t.source;
			return i = i.replace(Ua.caret, "$1"), n = n.replace(e, i), r;
		},
		getRegex: () => new RegExp(n, t)
	};
	return r;
}
var Ha = ((e = "") => {
	try {
		return !!RegExp("(?<=1)(?<!1)" + e);
	} catch {
		return !1;
	}
})(), Ua = {
	codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
	outputLinkReplace: /\\([\[\]])/g,
	indentCodeCompensation: /^(\s+)(?:```)/,
	beginningSpace: /^\s+/,
	endingHash: /#$/,
	startingSpaceChar: /^ /,
	endingSpaceChar: / $/,
	nonSpaceChar: /[^ ]/,
	newLineCharGlobal: /\n/g,
	tabCharGlobal: /\t/g,
	multipleSpaceGlobal: /\s+/g,
	blankLine: /^[ \t]*$/,
	doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
	blockquoteStart: /^ {0,3}>/,
	blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
	blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
	listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
	listIsTask: /^\[[ xX]\] +\S/,
	listReplaceTask: /^\[[ xX]\] +/,
	listTaskCheckbox: /\[[ xX]\]/,
	anyLine: /\n.*\n/,
	hrefBrackets: /^<(.*)>$/,
	tableDelimiter: /[:|]/,
	tableAlignChars: /^\||\| *$/g,
	tableRowBlankLine: /\n[ \t]*$/,
	tableAlignRight: /^ *-+: *$/,
	tableAlignCenter: /^ *:-+: *$/,
	tableAlignLeft: /^ *:-+ *$/,
	startATag: /^<a /i,
	endATag: /^<\/a>/i,
	startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
	endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
	startAngleBracket: /^</,
	endAngleBracket: />$/,
	pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
	unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
	escapeTest: /[&<>"']/,
	escapeReplace: /[&<>"']/g,
	escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
	escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
	caret: /(^|[^\[])\^/g,
	percentDecode: /%25/g,
	findPipe: /\|/g,
	splitPipe: / \|/,
	slashPipe: /\\\|/g,
	carriageReturn: /\r\n|\r/g,
	spaceLine: /^ +$/gm,
	notSpaceStart: /^\S*/,
	endingNewline: /\n$/,
	listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`),
	nextBulletRegex: Va((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`)),
	hrRegex: Va((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
	fencesBeginRegex: Va((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
	headingBeginRegex: Va((e) => RegExp(`^ {0,${e}}#`)),
	htmlBeginRegex: Va((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
	blockquoteBeginRegex: Va((e) => RegExp(`^ {0,${e}}>`))
}, Wa = /^(?:[ \t]*(?:\n|$))+/, Ga = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ka = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, qa = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ja = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Ya = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Xa = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Za = Q(Xa).replace(/bull/g, Ya).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Qa = Q(Xa).replace(/bull/g, Ya).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), $a = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, eo = /^[^\n]+/, to = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, no = Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", to).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ro = Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Ya).getRegex(), io = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ao = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, oo = Q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))", "i").replace("comment", ao).replace("tag", io).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), so = (e) => Q($a).replace("hr", qa).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", io).getRegex(), co = so(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), lo = so(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), uo = {
	blockquote: Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", lo).getRegex(),
	code: Ga,
	def: no,
	fences: Ka,
	heading: Ja,
	hr: qa,
	html: oo,
	lheading: Za,
	list: ro,
	newline: Wa,
	paragraph: co,
	table: Ba,
	text: eo
}, fo = Q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", qa).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}	)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", io).getRegex(), po = {
	...uo,
	lheading: Qa,
	table: fo,
	paragraph: Q($a).replace("hr", qa).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", fo).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", io).getRegex()
}, mo = {
	...uo,
	html: Q("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", ao).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
	def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
	heading: /^(#{1,6})(.*)(?:\n+|$)/,
	fences: Ba,
	lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
	paragraph: Q($a).replace("hr", qa).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Za).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, ho = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, go = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _o = /^( {2,}|\\)\n(?!\s*$)/, vo = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, yo = /[\p{P}\p{S}]/u, bo = /[\s\p{P}\p{S}]/u, xo = /[^\s\p{P}\p{S}]/u, So = Q(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, bo).getRegex(), Co = /[\p{Pi}\p{Ps}"']/u, wo = /(?!~)[\p{P}\p{S}]/u, To = /(?!~)[\s\p{P}\p{S}]/u, Eo = /(?:[^\s\p{P}\p{S}]|~)/u, Do = Q(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ha ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Oo = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ko = Q(Oo, "u").replace(/punct/g, yo).getRegex(), Ao = Q(Oo, "u").replace(/punct/g, wo).getRegex(), jo = Q(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, Co).replace(/punct/g, yo).getRegex(), Mo = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", No = Q(Mo, "gu").replace(/notPunctSpace/g, xo).replace(/punctSpace/g, bo).replace(/punct/g, yo).getRegex(), Po = Q(Mo, "gu").replace(/notPunctSpace/g, Eo).replace(/punctSpace/g, To).replace(/punct/g, wo).getRegex(), Fo = Q("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, xo).replace(/punctSpace/g, bo).replace(/punct/g, yo).getRegex(), Io = Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, xo).replace(/punctSpace/g, bo).replace(/punct/g, yo).getRegex(), Lo = Q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, xo).replace(/punctSpace/g, bo).replace(/punct/g, yo).getRegex(), Ro = Q(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, yo).getRegex(), zo = Q("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, xo).replace(/punctSpace/g, bo).replace(/punct/g, yo).getRegex(), Bo = Q(/\\(punct)/, "gu").replace(/punct/g, yo).getRegex(), Vo = Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ho = Q(ao).replace("(?:-->|$)", "-->").getRegex(), Uo = Q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Ho).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Wo = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Go = Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Wo).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ko = Q(/^!?\[(label)\]\[(ref)\]/).replace("label", Wo).replace("ref", to).getRegex(), qo = Q(/^!?\[(ref)\](?:\[\])?/).replace("ref", to).getRegex(), Jo = Q("reflink|nolink(?!\\()", "g").replace("reflink", Ko).replace("nolink", qo).getRegex(), Yo = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Xo = {
	_backpedal: Ba,
	anyPunctuation: Bo,
	autolink: Vo,
	blockSkip: Do,
	br: _o,
	code: go,
	del: Ba,
	delLDelim: Ba,
	delRDelim: Ba,
	emStrongLDelim: ko,
	emStrongRDelimAst: No,
	emStrongRDelimUnd: Io,
	escape: ho,
	link: Go,
	nolink: qo,
	punctuation: So,
	reflink: Ko,
	reflinkSearch: Jo,
	tag: Uo,
	text: vo,
	url: Ba
}, Zo = {
	...Xo,
	emStrongLDelim: jo,
	emStrongRDelimAst: Fo,
	emStrongRDelimUnd: Lo,
	link: Q(/^!?\[(label)\]\((.*?)\)/).replace("label", Wo).getRegex(),
	reflink: Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Wo).getRegex()
}, Qo = {
	...Xo,
	emStrongRDelimAst: Po,
	emStrongLDelim: Ao,
	delLDelim: Ro,
	delRDelim: zo,
	url: Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Yo).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
	_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
	del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
	text: Q(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Yo).getRegex()
}, $o = {
	...Qo,
	br: Q(_o).replace("{2,}", "*").getRegex(),
	text: Q(Qo.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, es = {
	normal: uo,
	gfm: po,
	pedantic: mo
}, ts = {
	normal: Xo,
	gfm: Qo,
	breaks: $o,
	pedantic: Zo
}, ns = {
	"&": "&amp;",
	"<": "&lt;",
	">": "&gt;",
	"\"": "&quot;",
	"'": "&#39;"
}, rs = (e) => ns[e];
function is(e, t) {
	if (t) {
		if (Ua.escapeTest.test(e)) return e.replace(Ua.escapeReplace, rs);
	} else if (Ua.escapeTestNoEncode.test(e)) return e.replace(Ua.escapeReplaceNoEncode, rs);
	return e;
}
function as(e) {
	try {
		e = encodeURI(e).replace(Ua.percentDecode, "%");
	} catch {
		return null;
	}
	return e;
}
function os(e, t) {
	let n = e.replace(Ua.findPipe, (e, t, n) => {
		let r = !1, i = t;
		for (; --i >= 0 && n[i] === "\\";) r = !r;
		return r ? "|" : " |";
	}).split(Ua.splitPipe), r = 0;
	if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
		if (n.length > t) n.splice(t);
		else for (; n.length < t;) n.push("");
	}
	for (; r < n.length; r++) n[r] = n[r].trim().replace(Ua.slashPipe, "|");
	return n;
}
function ss(e, t, n) {
	let r = e.length;
	if (r === 0) return "";
	let i = 0;
	for (; i < r;) {
		let a = e.charAt(r - i - 1);
		if (a === t && !n) i++;
		else if (a !== t && n) i++;
		else break;
	}
	return e.slice(0, r - i);
}
function cs(e) {
	let t = e.split("\n"), n = t.length - 1;
	for (; n >= 0 && Ua.blankLine.test(t[n]);) n--;
	return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
}
function ls(e, t) {
	if (e.indexOf(t[1]) === -1) return -1;
	let n = 0;
	for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
	else if (e[r] === t[0]) n++;
	else if (e[r] === t[1] && (n--, n < 0)) return r;
	return n > 0 ? -2 : -1;
}
function us(e, t = 0) {
	let n = t, r = "";
	for (let t of e) if (t === "	") {
		let e = 4 - n % 4;
		r += " ".repeat(e), n += e;
	} else r += t, n++;
	return r;
}
function ds(e, t, n, r, i) {
	let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
	r.state.inLink = !0;
	let c = {
		type: e[0].charAt(0) === "!" ? "image" : "link",
		raw: n,
		href: a,
		title: o,
		text: s,
		tokens: r.inlineTokens(s)
	};
	return r.state.inLink = !1, c;
}
function fs(e, t, n) {
	let r = e.match(n.other.indentCodeCompensation);
	if (r === null) return t;
	let i = r[1];
	return t.split("\n").map((e) => {
		let t = e.match(n.other.beginningSpace);
		if (t === null) return e;
		let [r] = t;
		return r.length >= i.length ? e.slice(i.length) : e;
	}).join("\n");
}
var ps = class {
	options;
	rules;
	lexer;
	constructor(e) {
		this.options = e || Ra;
	}
	space(e) {
		let t = this.rules.block.newline.exec(e);
		if (t && t[0].length > 0) return {
			type: "space",
			raw: t[0]
		};
	}
	code(e) {
		let t = this.rules.block.code.exec(e);
		if (t) {
			let e = this.options.pedantic ? t[0] : cs(t[0]);
			return {
				type: "code",
				raw: e,
				codeBlockStyle: "indented",
				text: e.replace(this.rules.other.codeRemoveIndent, "")
			};
		}
	}
	fences(e) {
		let t = this.rules.block.fences.exec(e);
		if (t) {
			let e = t[0], n = fs(e, t[3] || "", this.rules);
			return {
				type: "code",
				raw: e,
				lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
				text: n
			};
		}
	}
	heading(e) {
		let t = this.rules.block.heading.exec(e);
		if (t) {
			let e = t[2].trim();
			if (this.rules.other.endingHash.test(e)) {
				let t = ss(e, "#");
				(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
			}
			return {
				type: "heading",
				raw: ss(t[0], "\n"),
				depth: t[1].length,
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	hr(e) {
		let t = this.rules.block.hr.exec(e);
		if (t) return {
			type: "hr",
			raw: ss(t[0], "\n")
		};
	}
	blockquote(e) {
		let t = this.rules.block.blockquote.exec(e);
		if (t) {
			let e = ss(t[0], "\n").split("\n"), n = "", r = "", i = [];
			for (; e.length > 0;) {
				let t = !1, a = [], o;
				for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
				else if (!t) a.push(e[o]);
				else break;
				e = e.slice(o);
				let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n    $1").replace(this.rules.other.blockquoteSetextReplace2, "");
				n = n ? `${n}
${s}` : s, r = r ? `${r}
${c}` : c;
				let l = this.lexer.state.top;
				if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
				let u = i.at(-1);
				if (u?.type === "code") break;
				if (u?.type === "blockquote") {
					let t = u, a = e.join("\n"), o = t.raw + "\n" + a.replace(this.rules.other.blockquoteSetextReplace2, ""), s = this.blockquote(o);
					i[i.length - 1] = s, n = `${n}
${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
					break;
				}
				if (u?.type === "list") {
					let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
					i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
					continue;
				}
			}
			return {
				type: "blockquote",
				raw: n,
				tokens: i,
				text: r
			};
		}
	}
	list(e) {
		let t = this.rules.block.list.exec(e);
		if (t) {
			let n = t[1].trim(), r = n.length > 1, i = {
				type: "list",
				raw: "",
				ordered: r,
				start: r ? +n.slice(0, -1) : "",
				loose: !1,
				items: []
			};
			n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
			let a = this.rules.other.listItemRegex(n), o = !1;
			for (; e;) {
				let n = !1, r = "", s = "";
				if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
				r = t[0], e = e.substring(r.length);
				let c = us(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
				if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
					let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
					for (; e;) {
						let p = e.split("\n", 1)[0], m;
						if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, "  "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, "    "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
						if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
						else {
							if (u || c.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
							s += "\n" + l;
						}
						u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
					}
				}
				i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
					type: "list_item",
					raw: r,
					task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
					loose: !1,
					text: s,
					tokens: []
				}), i.raw += r;
			}
			let s = i.items.at(-1);
			if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
			else return;
			i.raw = i.raw.trimEnd();
			for (let e of i.items) {
				this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
				let t = e.tokens[0];
				if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
					e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
					for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
						this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
						break;
					}
					let n = this.rules.other.listTaskCheckbox.exec(e.raw);
					if (n) {
						let t = {
							type: "checkbox",
							raw: n[0] + " ",
							checked: n[0] !== "[ ]"
						};
						e.checked = t.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
							type: "paragraph",
							raw: t.raw,
							text: t.raw,
							tokens: [t]
						}) : e.tokens.unshift(t);
					}
				} else e.task &&= !1;
				if (!i.loose) {
					let t = e.tokens.filter((e) => e.type === "space");
					i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
				}
			}
			if (i.loose) for (let e of i.items) {
				e.loose = !0;
				for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
			}
			return i;
		}
	}
	html(e) {
		let t = this.rules.block.html.exec(e);
		if (t) {
			let e = cs(t[0]);
			return {
				type: "html",
				block: !0,
				raw: e,
				pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
				text: e
			};
		}
	}
	def(e) {
		let t = this.rules.block.def.exec(e);
		if (t) {
			let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
			return {
				type: "def",
				tag: e,
				raw: ss(t[0], "\n"),
				href: n,
				title: r
			};
		}
	}
	table(e) {
		let t = this.rules.block.table.exec(e);
		if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
		let n = os(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
			type: "table",
			raw: ss(t[0], "\n"),
			header: [],
			align: [],
			rows: []
		};
		if (n.length === r.length) {
			for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
			for (let e = 0; e < n.length; e++) a.header.push({
				text: n[e],
				tokens: this.lexer.inline(n[e]),
				header: !0,
				align: a.align[e]
			});
			for (let e of i) a.rows.push(os(e, a.header.length).map((e, t) => ({
				text: e,
				tokens: this.lexer.inline(e),
				header: !1,
				align: a.align[t]
			})));
			return a;
		}
	}
	lheading(e) {
		let t = this.rules.block.lheading.exec(e);
		if (t) {
			let e = t[1].trim();
			return {
				type: "heading",
				raw: ss(t[0], "\n"),
				depth: t[2].charAt(0) === "=" ? 1 : 2,
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	paragraph(e) {
		let t = this.rules.block.paragraph.exec(e);
		if (t) {
			let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
			return {
				type: "paragraph",
				raw: t[0],
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	text(e) {
		let t = this.rules.block.text.exec(e);
		if (t) return {
			type: "text",
			raw: t[0],
			text: t[0],
			tokens: this.lexer.inline(t[0])
		};
	}
	escape(e) {
		let t = this.rules.inline.escape.exec(e);
		if (t) return {
			type: "escape",
			raw: t[0],
			text: t[1]
		};
	}
	tag(e) {
		let t = this.rules.inline.tag.exec(e);
		if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
			type: "html",
			raw: t[0],
			inLink: this.lexer.state.inLink,
			inRawBlock: this.lexer.state.inRawBlock,
			block: !1,
			text: t[0]
		};
	}
	link(e) {
		let t = this.rules.inline.link.exec(e);
		if (t) {
			let e = t[2].trim();
			if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
				if (!this.rules.other.endAngleBracket.test(e)) return;
				let t = ss(e.slice(0, -1), "\\");
				if ((e.length - t.length) % 2 == 0) return;
			} else {
				let e = ls(t[2], "()");
				if (e === -2) return;
				if (e > -1) {
					let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
					t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
				}
			}
			let n = t[2], r = "";
			if (this.options.pedantic) {
				let e = this.rules.other.pedanticHrefTitle.exec(n);
				e && (n = e[1], r = e[3]);
			} else r = t[3] ? t[3].slice(1, -1) : "";
			return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), ds(t, {
				href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
				title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
			}, t[0], this.lexer, this.rules);
		}
	}
	reflink(e, t) {
		let n;
		if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
			let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
			if (!e) {
				let e = n[0].charAt(0);
				return {
					type: "text",
					raw: e,
					text: e
				};
			}
			return ds(n, e, n[0], this.lexer, this.rules);
		}
	}
	emStrong(e, t, n = "") {
		let r = this.rules.inline.emStrongLDelim.exec(e);
		if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
			let i = [...r[0]].length - 1, a, o, s = i, c = 0, l = r[0][0], u = n === l, d = l === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
			for (d.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = d.exec(t)) !== null;) {
				if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
				if (o = [...a].length, r[3] || r[4]) {
					s += o;
					continue;
				}
				if (r[5] || r[6]) {
					if (i % 3 && !((i + o) % 3)) {
						c += o;
						continue;
					}
					if (u) break;
				}
				if (s -= o, s > 0) continue;
				o = Math.min(o, o + s + c);
				let t = [...r[0]][0].length, n = e.slice(0, i + r.index + t + o);
				if (Math.min(i, o) % 2) {
					let e = n.slice(1, -1);
					return {
						type: "em",
						raw: n,
						text: e,
						tokens: this.lexer.inlineTokens(e)
					};
				}
				let l = n.slice(2, -2);
				return {
					type: "strong",
					raw: n,
					text: l,
					tokens: this.lexer.inlineTokens(l)
				};
			}
		}
	}
	codespan(e) {
		let t = this.rules.inline.code.exec(e);
		if (t) {
			let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
			return n && r && (e = e.substring(1, e.length - 1)), {
				type: "codespan",
				raw: t[0],
				text: e
			};
		}
	}
	br(e) {
		let t = this.rules.inline.br.exec(e);
		if (t) return {
			type: "br",
			raw: t[0]
		};
	}
	del(e, t, n = "") {
		let r = this.rules.inline.delLDelim.exec(e);
		if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
			let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
			for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
				if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
				if (r[3] || r[4]) {
					o += a;
					continue;
				}
				if (o -= a, o > 0) continue;
				a = Math.min(a, a + o);
				let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
				return {
					type: "del",
					raw: s,
					text: c,
					tokens: this.lexer.inlineTokens(c)
				};
			}
		}
	}
	autolink(e) {
		let t = this.rules.inline.autolink.exec(e);
		if (t) {
			let e, n;
			return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
				type: "link",
				raw: t[0],
				text: e,
				href: n,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	url(e) {
		let t;
		if (t = this.rules.inline.url.exec(e)) {
			let e, n;
			if (t[2] === "@") e = t[0], n = "mailto:" + e;
			else {
				let r;
				do
					r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
				while (r !== t[0]);
				e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
			}
			return {
				type: "link",
				raw: t[0],
				text: e,
				href: n,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	inlineText(e) {
		let t = this.rules.inline.text.exec(e);
		if (t) {
			let e = this.lexer.state.inRawBlock;
			return {
				type: "text",
				raw: t[0],
				text: t[0],
				escaped: e
			};
		}
	}
}, ms = class e {
	tokens;
	options;
	state;
	inlineQueue;
	tokenizer;
	constructor(e) {
		this.tokens = [], this.tokens.links = Object.create(null), this.options = e || Ra, this.options.tokenizer = this.options.tokenizer || new ps(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
			inLink: !1,
			inRawBlock: !1,
			top: !0
		};
		let t = {
			other: Ua,
			block: es.normal,
			inline: ts.normal
		};
		this.options.pedantic ? (t.block = es.pedantic, t.inline = ts.pedantic) : this.options.gfm && (t.block = es.gfm, t.inline = this.options.breaks ? ts.breaks : ts.gfm), this.tokenizer.rules = t;
	}
	static get rules() {
		return {
			block: es,
			inline: ts
		};
	}
	static lex(t, n) {
		return new e(n).lex(t);
	}
	static lexInline(t, n) {
		return new e(n).inlineTokens(t);
	}
	lex(e) {
		e = e.replace(Ua.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
		for (let e = 0; e < this.inlineQueue.length; e++) {
			let t = this.inlineQueue[e];
			this.inlineTokens(t.src, t.tokens);
		}
		return this.inlineQueue = [], this.tokens;
	}
	blockTokens(e, t = [], n = !1) {
		this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(Ua.tabCharGlobal, "    ").replace(Ua.spaceLine, ""));
		let r = 1 / 0;
		for (; e;) {
			if (e.length < r) r = e.length;
			else {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
			let i;
			if (this.options.extensions?.block?.some((n) => (i = n.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
			if (i = this.tokenizer.space(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
				continue;
			}
			if (i = this.tokenizer.code(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
				continue;
			}
			if (i = this.tokenizer.fences(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.heading(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.hr(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.blockquote(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.list(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.html(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.def(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
					href: i.href,
					title: i.title
				}, t.push(i));
				continue;
			}
			if (i = this.tokenizer.table(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.lheading(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			let a = e;
			if (this.options.extensions?.startBlock) {
				let t = 1 / 0, n = e.slice(1), r;
				this.options.extensions.startBlock.forEach((e) => {
					r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
				}), t < 1 / 0 && t >= 0 && (a = e.substring(0, t + 1));
			}
			if (this.state.top && (i = this.tokenizer.paragraph(a))) {
				let r = t.at(-1);
				n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
				continue;
			}
			if (i = this.tokenizer.text(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
				continue;
			}
			if (e) {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
		}
		return this.state.top = !0, t;
	}
	inline(e, t = []) {
		return this.inlineQueue.push({
			src: e,
			tokens: t
		}), t;
	}
	inlineTokens(e, t = []) {
		this.tokenizer.lexer = this;
		let n = e;
		if (this.tokens.links) {
			let e = Object.keys(this.tokens.links);
			e.length > 0 && (n = n.replace(this.tokenizer.rules.inline.reflinkSearch, (t) => e.includes(t.slice(t.lastIndexOf("[") + 1, -1)) ? "[" + "a".repeat(t.length - 2) + "]" : t));
		}
		n = n.replace(this.tokenizer.rules.inline.anyPunctuation, "++"), n = n.replace(this.tokenizer.rules.inline.blockSkip, (e, t, n) => {
			let r = n ? n.length : 0;
			return e.slice(0, r) + "[" + "a".repeat(e.length - r - 2) + "]";
		}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
		let r = !1, i = "", a = 1 / 0;
		for (; e;) {
			if (e.length < a) a = e.length;
			else {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
			r || (i = ""), r = !1;
			let o;
			if (this.options.extensions?.inline?.some((n) => (o = n.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
			if (o = this.tokenizer.escape(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.tag(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.link(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.reflink(e, this.tokens.links)) {
				e = e.substring(o.raw.length);
				let n = t.at(-1);
				o.type === "text" && n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
				continue;
			}
			if (o = this.tokenizer.emStrong(e, n, i)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.codespan(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.br(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.del(e, n, i)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.autolink(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (!this.state.inLink && (o = this.tokenizer.url(e))) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			let s = e;
			if (this.options.extensions?.startInline) {
				let t = 1 / 0, n = e.slice(1), r;
				this.options.extensions.startInline.forEach((e) => {
					r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
				}), t < 1 / 0 && t >= 0 && (s = e.substring(0, t + 1));
			}
			if (o = this.tokenizer.inlineText(s)) {
				e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (i = o.raw.slice(-1)), r = !0;
				let n = t.at(-1);
				n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
				continue;
			}
			if (e) {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
		}
		return t;
	}
	infiniteLoopError(e) {
		let t = "Infinite loop on byte: " + e;
		if (this.options.silent) console.error(t);
		else throw Error(t);
	}
}, hs = class {
	options;
	parser;
	constructor(e) {
		this.options = e || Ra;
	}
	space(e) {
		return "";
	}
	code({ text: e, lang: t, escaped: n }) {
		let r = (t || "").match(Ua.notSpaceStart)?.[0], i = e.replace(Ua.endingNewline, "") + "\n";
		return r ? "<pre><code class=\"language-" + is(r) + "\">" + (n ? i : is(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : is(i, !0)) + "</code></pre>\n";
	}
	blockquote({ tokens: e }) {
		return `<blockquote>
${this.parser.parse(e)}</blockquote>
`;
	}
	html({ text: e }) {
		return e;
	}
	def(e) {
		return "";
	}
	heading({ tokens: e, depth: t }) {
		return `<h${t}>${this.parser.parseInline(e)}</h${t}>
`;
	}
	hr(e) {
		return "<hr>\n";
	}
	list(e) {
		let t = e.ordered, n = e.start, r = "";
		for (let t = 0; t < e.items.length; t++) {
			let n = e.items[t];
			r += this.listitem(n);
		}
		let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
		return "<" + i + a + ">\n" + r + "</" + i + ">\n";
	}
	listitem(e) {
		return `<li>${this.parser.parse(e.tokens)}</li>
`;
	}
	checkbox({ checked: e }) {
		return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
	}
	paragraph({ tokens: e }) {
		return `<p>${this.parser.parseInline(e)}</p>
`;
	}
	table(e) {
		let t = "", n = "";
		for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
		t += this.tablerow({ text: n });
		let r = "";
		for (let t = 0; t < e.rows.length; t++) {
			let i = e.rows[t];
			n = "";
			for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
			r += this.tablerow({ text: n });
		}
		return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
	}
	tablerow({ text: e }) {
		return `<tr>
${e}</tr>
`;
	}
	tablecell(e) {
		let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
		return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
`;
	}
	strong({ tokens: e }) {
		return `<strong>${this.parser.parseInline(e)}</strong>`;
	}
	em({ tokens: e }) {
		return `<em>${this.parser.parseInline(e)}</em>`;
	}
	codespan({ text: e }) {
		return `<code>${is(e, !0)}</code>`;
	}
	br(e) {
		return "<br>";
	}
	del({ tokens: e }) {
		return `<del>${this.parser.parseInline(e)}</del>`;
	}
	link({ href: e, title: t, tokens: n }) {
		let r = this.parser.parseInline(n), i = as(e);
		if (i === null) return r;
		e = i;
		let a = "<a href=\"" + e + "\"";
		return t && (a += " title=\"" + is(t) + "\""), a += ">" + r + "</a>", a;
	}
	image({ href: e, title: t, text: n, tokens: r }) {
		r && (n = this.parser.parseInline(r, this.parser.textRenderer));
		let i = as(e);
		if (i === null) return is(n);
		e = i;
		let a = `<img src="${e}" alt="${is(n)}"`;
		return t && (a += ` title="${is(t)}"`), a += ">", a;
	}
	text(e) {
		return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : is(e.text);
	}
}, gs = class {
	strong({ text: e }) {
		return e;
	}
	em({ text: e }) {
		return e;
	}
	codespan({ text: e }) {
		return e;
	}
	del({ text: e }) {
		return e;
	}
	html({ text: e }) {
		return e;
	}
	text({ text: e }) {
		return e;
	}
	link({ text: e }) {
		return "" + e;
	}
	image({ text: e }) {
		return "" + e;
	}
	br() {
		return "";
	}
	checkbox({ raw: e }) {
		return e;
	}
}, _s = class e {
	options;
	renderer;
	textRenderer;
	constructor(e) {
		this.options = e || Ra, this.options.renderer = this.options.renderer || new hs(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new gs();
	}
	static parse(t, n) {
		return new e(n).parse(t);
	}
	static parseInline(t, n) {
		return new e(n).parseInline(t);
	}
	parse(e) {
		this.renderer.parser = this;
		let t = "";
		for (let n = 0; n < e.length; n++) {
			let r = e[n];
			if (this.options.extensions?.renderers?.[r.type]) {
				let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
				if (n !== !1 || ![
					"space",
					"hr",
					"heading",
					"code",
					"table",
					"blockquote",
					"list",
					"checkbox",
					"html",
					"def",
					"paragraph",
					"text"
				].includes(e.type)) {
					t += n || "";
					continue;
				}
			}
			let i = r;
			switch (i.type) {
				case "space":
					t += this.renderer.space(i);
					break;
				case "hr":
					t += this.renderer.hr(i);
					break;
				case "heading":
					t += this.renderer.heading(i);
					break;
				case "code":
					t += this.renderer.code(i);
					break;
				case "table":
					t += this.renderer.table(i);
					break;
				case "blockquote":
					t += this.renderer.blockquote(i);
					break;
				case "list":
					t += this.renderer.list(i);
					break;
				case "checkbox":
					t += this.renderer.checkbox(i);
					break;
				case "html":
					t += this.renderer.html(i);
					break;
				case "def":
					t += this.renderer.def(i);
					break;
				case "paragraph":
					t += this.renderer.paragraph(i);
					break;
				case "text":
					t += this.renderer.text(i);
					break;
				default: {
					let e = "Token with \"" + i.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return t;
	}
	parseInline(e, t = this.renderer) {
		this.renderer.parser = this;
		let n = "";
		for (let r = 0; r < e.length; r++) {
			let i = e[r];
			if (this.options.extensions?.renderers?.[i.type]) {
				let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
				if (e !== !1 || ![
					"escape",
					"html",
					"link",
					"image",
					"checkbox",
					"strong",
					"em",
					"codespan",
					"br",
					"del",
					"text"
				].includes(i.type)) {
					n += e || "";
					continue;
				}
			}
			let a = i;
			switch (a.type) {
				case "escape":
					n += t.text(a);
					break;
				case "html":
					n += t.html(a);
					break;
				case "link":
					n += t.link(a);
					break;
				case "image":
					n += t.image(a);
					break;
				case "checkbox":
					n += t.checkbox(a);
					break;
				case "strong":
					n += t.strong(a);
					break;
				case "em":
					n += t.em(a);
					break;
				case "codespan":
					n += t.codespan(a);
					break;
				case "br":
					n += t.br(a);
					break;
				case "del":
					n += t.del(a);
					break;
				case "text":
					n += t.text(a);
					break;
				default: {
					let e = "Token with \"" + a.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return n;
	}
}, vs = class {
	options;
	block;
	constructor(e) {
		this.options = e || Ra;
	}
	static passThroughHooks = /* @__PURE__ */ new Set([
		"preprocess",
		"postprocess",
		"processAllTokens",
		"emStrongMask"
	]);
	static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
		"preprocess",
		"postprocess",
		"processAllTokens"
	]);
	preprocess(e) {
		return e;
	}
	postprocess(e) {
		return e;
	}
	processAllTokens(e) {
		return e;
	}
	emStrongMask(e) {
		return e;
	}
	provideLexer(e = this.block) {
		return e ? ms.lex : ms.lexInline;
	}
	provideParser(e = this.block) {
		return e ? _s.parse : _s.parseInline;
	}
}, ys = new class {
	defaults = La();
	options = this.setOptions;
	parse = this.parseMarkdown(!0);
	parseInline = this.parseMarkdown(!1);
	Parser = _s;
	Renderer = hs;
	TextRenderer = gs;
	Lexer = ms;
	Tokenizer = ps;
	Hooks = vs;
	constructor(...e) {
		this.use(...e);
	}
	walkTokens(e, t) {
		let n = [];
		for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
			case "table": {
				let e = r;
				for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
				for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
				break;
			}
			case "list": {
				let e = r;
				n = n.concat(this.walkTokens(e.items, t));
				break;
			}
			default: {
				let e = r;
				this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
					let i = e[r].flat(1 / 0);
					n = n.concat(this.walkTokens(i, t));
				}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
			}
		}
		return n;
	}
	use(...e) {
		let t = this.defaults.extensions || {
			renderers: {},
			childTokens: {}
		};
		return e.forEach((e) => {
			let n = { ...e };
			if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
				if (!e.name) throw Error("extension name required");
				if ("renderer" in e) {
					let n = t.renderers[e.name];
					n ? t.renderers[e.name] = function(...t) {
						let r = e.renderer.apply(this, t);
						return r === !1 && (r = n.apply(this, t)), r;
					} : t.renderers[e.name] = e.renderer;
				}
				if ("tokenizer" in e) {
					if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
					let n = t[e.level];
					n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
				}
				"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
			}), n.extensions = t), e.renderer) {
				let t = this.defaults.renderer || new hs(this.defaults);
				for (let n in e.renderer) {
					if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
					if (["options", "parser"].includes(n)) continue;
					let r = n, i = e.renderer[r], a = t[r];
					t[r] = (...e) => {
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n || "";
					};
				}
				n.renderer = t;
			}
			if (e.tokenizer) {
				let t = this.defaults.tokenizer || new ps(this.defaults);
				for (let n in e.tokenizer) {
					if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
					if ([
						"options",
						"rules",
						"lexer"
					].includes(n)) continue;
					let r = n, i = e.tokenizer[r], a = t[r];
					t[r] = (...e) => {
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n;
					};
				}
				n.tokenizer = t;
			}
			if (e.hooks) {
				let t = this.defaults.hooks || new vs();
				for (let n in e.hooks) {
					if (!(n in t)) throw Error(`hook '${n}' does not exist`);
					if (["options", "block"].includes(n)) continue;
					let r = n, i = e.hooks[r], a = t[r];
					t[r] = vs.passThroughHooks.has(n) ? (e) => {
						if (this.defaults.async && vs.passThroughHooksRespectAsync.has(n)) return (async () => {
							let n = await i.call(t, e);
							return a.call(t, n);
						})();
						let r = i.call(t, e);
						return a.call(t, r);
					} : (...e) => {
						if (this.defaults.async) return (async () => {
							let n = await i.apply(t, e);
							return n === !1 && (n = await a.apply(t, e)), n;
						})();
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n;
					};
				}
				n.hooks = t;
			}
			if (e.walkTokens) {
				let t = this.defaults.walkTokens, r = e.walkTokens;
				n.walkTokens = function(e) {
					let n = [];
					return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
				};
			}
			this.defaults = {
				...this.defaults,
				...n
			};
		}), this;
	}
	setOptions(e) {
		return this.defaults = {
			...this.defaults,
			...e
		}, this;
	}
	lexer(e, t) {
		return ms.lex(e, t ?? this.defaults);
	}
	parser(e, t) {
		return _s.parse(e, t ?? this.defaults);
	}
	parseMarkdown(e) {
		return (t, n) => {
			let r = { ...n }, i = {
				...this.defaults,
				...r
			}, a = this.onError(!!i.silent, !!i.async);
			if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
			if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
			if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
			if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
				let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? ms.lex : ms.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
				i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
				let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? _s.parse : _s.parseInline)(a, i);
				return i.hooks ? await i.hooks.postprocess(o) : o;
			})().catch(a);
			try {
				i.hooks && (t = i.hooks.preprocess(t));
				let n = (i.hooks ? i.hooks.provideLexer(e) : e ? ms.lex : ms.lexInline)(t, i);
				i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
				let r = (i.hooks ? i.hooks.provideParser(e) : e ? _s.parse : _s.parseInline)(n, i);
				return i.hooks && (r = i.hooks.postprocess(r)), r;
			} catch (e) {
				return a(e);
			}
		};
	}
	onError(e, t) {
		return (n) => {
			if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
				let e = "<p>An error occurred:</p><pre>" + is(n.message + "", !0) + "</pre>";
				return t ? Promise.resolve(e) : e;
			}
			if (t) return Promise.reject(n);
			throw n;
		};
	}
}();
function bs(e, t) {
	return ys.parse(e, t);
}
bs.options = bs.setOptions = function(e) {
	return ys.setOptions(e), bs.defaults = ys.defaults, za(bs.defaults), bs;
}, bs.getDefaults = La, bs.defaults = Ra;
function xs(...e) {
	return ys.use(...e), bs.defaults = ys.defaults, za(bs.defaults), bs;
}
bs.use = xs, bs.walkTokens = function(e, t) {
	return ys.walkTokens(e, t);
}, bs.parseInline = ys.parseInline, bs.Parser = _s, bs.parser = _s.parse, bs.Renderer = hs, bs.TextRenderer = gs, bs.Lexer = ms, bs.lexer = ms.lex, bs.Tokenizer = ps, bs.Hooks = vs, bs.parse = bs, bs.options, bs.setOptions, bs.walkTokens, bs.parseInline, _s.parse, ms.lex;
//#endregion
//#region node_modules/dompurify/dist/purify.es.mjs
function Ss(e, t) {
	(t == null || t > e.length) && (t = e.length);
	for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
	return r;
}
function Cs(e) {
	if (Array.isArray(e)) return e;
}
function ws(e, t) {
	var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
	if (n != null) {
		var r, i, a, o, s = [], c = !0, l = !1;
		try {
			if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
		} catch (e) {
			l = !0, i = e;
		} finally {
			try {
				if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
			} finally {
				if (l) throw i;
			}
		}
		return s;
	}
}
function Ts() {
	throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function Es(e, t) {
	return Cs(e) || ws(e, t) || Ds(e, t) || Ts();
}
function Ds(e, t) {
	if (e) {
		if (typeof e == "string") return Ss(e, t);
		var n = {}.toString.call(e).slice(8, -1);
		return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ss(e, t) : void 0;
	}
}
var Os = Object.entries, ks = Object.setPrototypeOf, As = Object.isFrozen, js = Object.getPrototypeOf, Ms = Object.getOwnPropertyDescriptor, Ns = Object.freeze, Ps = Object.seal, Fs = Object.create, Is = typeof Reflect < "u" && Reflect, Ls = Is.apply, Rs = Is.construct;
Ns ||= function(e) {
	return e;
}, Ps ||= function(e) {
	return e;
}, Ls ||= function(e, t) {
	var n = [...arguments].slice(2);
	return e.apply(t, n);
}, Rs ||= function(e) {
	return new e(...[...arguments].slice(1));
};
var zs = ac(Array.prototype.forEach), Bs = ac(Array.prototype.lastIndexOf), Vs = ac(Array.prototype.pop), Hs = ac(Array.prototype.push), Us = ac(Array.prototype.splice), Ws = Array.isArray, Gs = ac(String.prototype.toLowerCase), Ks = ac(String.prototype.toString), qs = ac(String.prototype.match), Js = ac(String.prototype.replace), Ys = ac(String.prototype.indexOf), Xs = ac(String.prototype.trim), Zs = ac(Number.prototype.toString), Qs = ac(Boolean.prototype.toString), $s = typeof BigInt > "u" ? null : ac(BigInt.prototype.toString), ec = typeof Symbol > "u" ? null : ac(Symbol.prototype.toString), tc = ac(Object.prototype.hasOwnProperty), nc = ac(Object.prototype.toString), rc = ac(RegExp.prototype.test), ic = oc(TypeError);
function ac(e) {
	return function(t) {
		t instanceof RegExp && (t.lastIndex = 0);
		var n = [...arguments].slice(1);
		return Ls(e, t, n);
	};
}
function oc(e) {
	return function() {
		return Rs(e, [...arguments]);
	};
}
function $(e, t) {
	let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Gs;
	if (ks && ks(e, null), !Ws(t)) return e;
	let r = t.length;
	for (; r--;) {
		let i = t[r];
		if (typeof i == "string") {
			let e = n(i);
			e !== i && (As(t) || (t[r] = e), i = e);
		}
		e[i] = !0;
	}
	return e;
}
function sc(e) {
	for (let t = 0; t < e.length; t++) tc(e, t) || (e[t] = null);
	return e;
}
function cc(e) {
	let t = Fs(null);
	for (let r of Os(e)) {
		var n = Es(r, 2);
		let i = n[0], a = n[1];
		tc(e, i) && (t[i] = Ws(a) ? sc(a) : a && typeof a == "object" && a.constructor === Object ? cc(a) : a);
	}
	return t;
}
function lc(e) {
	switch (typeof e) {
		case "string": return e;
		case "number": return Zs(e);
		case "boolean": return Qs(e);
		case "bigint": return $s ? $s(e) : "0";
		case "symbol": return ec ? ec(e) : "Symbol()";
		case "undefined": return nc(e);
		case "function":
		case "object": {
			if (e === null) return nc(e);
			let t = e, n = uc(t, "toString");
			if (typeof n == "function") {
				let e = n(t);
				return typeof e == "string" ? e : nc(e);
			}
			return nc(e);
		}
		default: return nc(e);
	}
}
function uc(e, t) {
	for (; e !== null;) {
		let n = Ms(e, t);
		if (n) {
			if (n.get) return ac(n.get);
			if (typeof n.value == "function") return ac(n.value);
		}
		e = js(e);
	}
	function n() {
		return null;
	}
	return n;
}
function dc(e) {
	try {
		return rc(e, ""), !0;
	} catch {
		return !1;
	}
}
var fc = Ns(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), pc = Ns(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), mc = Ns([
	"feBlend",
	"feColorMatrix",
	"feComponentTransfer",
	"feComposite",
	"feConvolveMatrix",
	"feDiffuseLighting",
	"feDisplacementMap",
	"feDistantLight",
	"feDropShadow",
	"feFlood",
	"feFuncA",
	"feFuncB",
	"feFuncG",
	"feFuncR",
	"feGaussianBlur",
	"feImage",
	"feMerge",
	"feMergeNode",
	"feMorphology",
	"feOffset",
	"fePointLight",
	"feSpecularLighting",
	"feSpotLight",
	"feTile",
	"feTurbulence"
]), hc = Ns([
	"animate",
	"color-profile",
	"cursor",
	"discard",
	"font-face",
	"font-face-format",
	"font-face-name",
	"font-face-src",
	"font-face-uri",
	"foreignobject",
	"hatch",
	"hatchpath",
	"mesh",
	"meshgradient",
	"meshpatch",
	"meshrow",
	"missing-glyph",
	"script",
	"set",
	"solidcolor",
	"unknown",
	"use"
]), gc = Ns(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), _c = Ns([
	"maction",
	"maligngroup",
	"malignmark",
	"mlongdiv",
	"mscarries",
	"mscarry",
	"msgroup",
	"mstack",
	"msline",
	"msrow",
	"semantics",
	"annotation",
	"annotation-xml",
	"mprescripts",
	"none"
]), vc = Ns(["#text"]), yc = Ns(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), bc = Ns(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), xc = Ns(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), Sc = Ns([
	"xlink:href",
	"xml:id",
	"xlink:title",
	"xml:space",
	"xmlns:xlink"
]), Cc = Ps(/{{[\w\W]*|^[\w\W]*}}/g), wc = Ps(/<%[\w\W]*|^[\w\W]*%>/g), Tc = Ps(/\${[\w\W]*/g), Ec = Ps(/^data-[\-\w.\u00B7-\uFFFF]+$/), Dc = Ps(/^aria-[\-\w]+$/), Oc = Ps(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), kc = Ps(/^(?:\w+script|data):/i), Ac = Ps(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), jc = Ps(/^html$/i), Mc = Ps(/^[a-z][.\w]*(-[.\w]+)+$/i), Nc = Ps(/<[/\w!]/g), Pc = Ps(/<[/\w]/g), Fc = Ps(/<\/no(script|embed|frames)/i), Ic = Ps(/\/>/i), Lc = {
	element: 1,
	attribute: 2,
	text: 3,
	cdataSection: 4,
	entityReference: 5,
	entityNode: 6,
	processingInstruction: 7,
	comment: 8,
	document: 9,
	documentType: 10,
	documentFragment: 11,
	notation: 12
}, Rc = function() {
	return typeof window > "u" ? null : window;
}, zc = function(e, t) {
	if (typeof e != "object" || typeof e.createPolicy != "function") return null;
	let n = null, r = "data-tt-policy-suffix";
	t && t.hasAttribute(r) && (n = t.getAttribute(r));
	let i = "dompurify" + (n ? "#" + n : "");
	try {
		return e.createPolicy(i, {
			createHTML(e) {
				return e;
			},
			createScriptURL(e) {
				return e;
			}
		});
	} catch {
		return console.warn("TrustedTypes policy " + i + " could not be created."), null;
	}
}, Bc = function() {
	return {
		afterSanitizeAttributes: [],
		afterSanitizeElements: [],
		afterSanitizeShadowDOM: [],
		beforeSanitizeAttributes: [],
		beforeSanitizeElements: [],
		beforeSanitizeShadowDOM: [],
		uponSanitizeAttribute: [],
		uponSanitizeElement: [],
		uponSanitizeShadowNode: []
	};
}, Vc = function(e, t, n, r) {
	return tc(e, t) && Ws(e[t]) ? $(r.base ? cc(r.base) : {}, e[t], r.transform) : n;
};
function Hc() {
	let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Rc(), t = (e) => Hc(e);
	if (t.version = "3.4.13", t.removed = [], !e || !e.document || e.document.nodeType !== Lc.document || !e.Element) return t.isSupported = !1, t;
	let n = e.document, r = n, i = r.currentScript;
	e.DocumentFragment;
	let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
	e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
	let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = uc(d, "cloneNode"), p = uc(d, "remove"), m = uc(d, "nextSibling"), h = uc(d, "childNodes"), g = uc(d, "parentNode"), _ = uc(d, "shadowRoot"), v = uc(d, "attributes"), y = o && o.prototype ? uc(o.prototype, "nodeType") : null, b = o && o.prototype ? uc(o.prototype, "nodeName") : null, x = o && o.prototype ? uc(o.prototype, "ownerDocument") : null;
	if (typeof a == "function") {
		let e = n.createElement("template");
		e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
	}
	let S, C = "", ee, w = !1, te = 0, ne = function() {
		if (te > 0) throw ic("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
	}, T = function(e) {
		ne(), te++;
		try {
			return S.createHTML(e);
		} finally {
			te--;
		}
	}, re = function(e) {
		ne(), te++;
		try {
			return S.createScriptURL(e);
		} finally {
			te--;
		}
	}, ie = function() {
		return w ||= (ee = zc(u, i), !0), ee;
	}, E = n, ae = E.implementation, oe = E.createNodeIterator, se = E.createDocumentFragment, ce = E.getElementsByTagName, le = r.importNode, D = Bc();
	t.isSupported = typeof Os == "function" && typeof g == "function" && ae && ae.createHTMLDocument !== void 0;
	let ue = Cc, de = wc, fe = Tc, pe = Ec, me = Dc, he = kc, ge = Ac, _e = Mc, ve = Oc, O = null, ye = $({}, [
		...fc,
		...pc,
		...mc,
		...gc,
		...vc
	]), k = null, be = $({}, [
		...yc,
		...bc,
		...xc,
		...Sc
	]), xe = Object.seal(Fs(null, {
		tagNameCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		attributeNameCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		allowCustomizedBuiltInElements: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: !1
		}
	})), Se = null, Ce = null, we = Object.seal(Fs(null, {
		tagCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		attributeCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		}
	})), Te = !0, Ee = !0, De = !1, Oe = !0, ke = !1, Ae = !0, A = !1, je = !1, j = null, Me = null, Ne = !1, M = !1, Pe = !1, Fe = !1, Ie = !0, Le = !1, Re = "user-content-", ze = !0, Be = !1, Ve = {}, He = null, Ue = $({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), We = null, Ge = $({}, [
		"audio",
		"video",
		"img",
		"source",
		"image",
		"track"
	]), Ke = null, qe = $({}, [
		"alt",
		"class",
		"for",
		"id",
		"label",
		"name",
		"pattern",
		"placeholder",
		"role",
		"summary",
		"title",
		"value",
		"style",
		"xmlns"
	]), Je = "http://www.w3.org/1998/Math/MathML", Ye = "http://www.w3.org/2000/svg", Xe = "http://www.w3.org/1999/xhtml", Ze = Xe, Qe = !1, $e = null, et = $({}, [
		Je,
		Ye,
		Xe
	], Ks), tt = Ns([
		"mi",
		"mo",
		"mn",
		"ms",
		"mtext"
	]), nt = $({}, tt), rt = Ns(["annotation-xml"]), it = $({}, rt), at = $({}, [
		"title",
		"style",
		"font",
		"a",
		"script"
	]), ot = null, st = ["application/xhtml+xml", "text/html"], ct = null, lt = null, ut = n.createElement("form"), dt = function(e) {
		return e instanceof RegExp || e instanceof Function;
	}, ft = function() {
		let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
		if (lt && lt === e) return;
		(!e || typeof e != "object") && (e = {}), e = cc(e), ot = st.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, ct = ot === "application/xhtml+xml" ? Ks : Gs, O = Vc(e, "ALLOWED_TAGS", ye, { transform: ct }), k = Vc(e, "ALLOWED_ATTR", be, { transform: ct }), $e = Vc(e, "ALLOWED_NAMESPACES", et, { transform: Ks }), Ke = Vc(e, "ADD_URI_SAFE_ATTR", qe, {
			transform: ct,
			base: qe
		}), We = Vc(e, "ADD_DATA_URI_TAGS", Ge, {
			transform: ct,
			base: Ge
		}), He = Vc(e, "FORBID_CONTENTS", Ue, { transform: ct }), Se = Vc(e, "FORBID_TAGS", cc({}), { transform: ct }), Ce = Vc(e, "FORBID_ATTR", cc({}), { transform: ct }), Ve = tc(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? cc(e.USE_PROFILES) : e.USE_PROFILES : !1, Te = e.ALLOW_ARIA_ATTR !== !1, Ee = e.ALLOW_DATA_ATTR !== !1, De = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Oe = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, ke = e.SAFE_FOR_TEMPLATES || !1, Ae = e.SAFE_FOR_XML !== !1, A = e.WHOLE_DOCUMENT || !1, M = e.RETURN_DOM || !1, Pe = e.RETURN_DOM_FRAGMENT || !1, Fe = e.RETURN_TRUSTED_TYPE || !1, Ne = e.FORCE_BODY || !1, Ie = e.SANITIZE_DOM !== !1, Le = e.SANITIZE_NAMED_PROPS || !1, ze = e.KEEP_CONTENT !== !1, Be = e.IN_PLACE || !1, ve = dc(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Oc, Ze = typeof e.NAMESPACE == "string" ? e.NAMESPACE : Xe, nt = tc(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? cc(e.MATHML_TEXT_INTEGRATION_POINTS) : $({}, tt), it = tc(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? cc(e.HTML_INTEGRATION_POINTS) : $({}, rt);
		let t = tc(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? cc(e.CUSTOM_ELEMENT_HANDLING) : Fs(null);
		if (xe = Fs(null), tc(t, "tagNameCheck") && dt(t.tagNameCheck) && (xe.tagNameCheck = t.tagNameCheck), tc(t, "attributeNameCheck") && dt(t.attributeNameCheck) && (xe.attributeNameCheck = t.attributeNameCheck), tc(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (xe.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), Ps(xe), ke && (Ee = !1), Pe && (M = !0), Ve && (O = $({}, vc), k = Fs(null), Ve.html === !0 && ($(O, fc), $(k, yc)), Ve.svg === !0 && ($(O, pc), $(k, bc), $(k, Sc)), Ve.svgFilters === !0 && ($(O, mc), $(k, bc), $(k, Sc)), Ve.mathMl === !0 && ($(O, gc), $(k, xc), $(k, Sc))), we.tagCheck = null, we.attributeCheck = null, tc(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? we.tagCheck = e.ADD_TAGS : Ws(e.ADD_TAGS) && (O === ye && (O = cc(O)), $(O, e.ADD_TAGS, ct))), tc(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? we.attributeCheck = e.ADD_ATTR : Ws(e.ADD_ATTR) && (k === be && (k = cc(k)), $(k, e.ADD_ATTR, ct))), tc(e, "ADD_URI_SAFE_ATTR") && Ws(e.ADD_URI_SAFE_ATTR) && $(Ke, e.ADD_URI_SAFE_ATTR, ct), tc(e, "FORBID_CONTENTS") && Ws(e.FORBID_CONTENTS) && (He === Ue && (He = cc(He)), $(He, e.FORBID_CONTENTS, ct)), tc(e, "ADD_FORBID_CONTENTS") && Ws(e.ADD_FORBID_CONTENTS) && (He === Ue && (He = cc(He)), $(He, e.ADD_FORBID_CONTENTS, ct)), ze && (O["#text"] = !0), A && $(O, [
			"html",
			"head",
			"body"
		]), O.table && ($(O, ["tbody"]), delete Se.tbody), e.TRUSTED_TYPES_POLICY) {
			if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw ic("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
			if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ic("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
			let t = S;
			S = e.TRUSTED_TYPES_POLICY;
			try {
				C = T("");
			} catch (e) {
				throw S = t, e;
			}
		} else e.TRUSTED_TYPES_POLICY === null ? (S = void 0, C = "") : (S === void 0 && (S = ie()), S && typeof C == "string" && (C = T("")));
		Ns && Ns(e), lt = e;
	}, pt = $({}, [
		...pc,
		...mc,
		...hc
	]), mt = $({}, [...gc, ..._c]), ht = function(e, t, n) {
		return t.namespaceURI === Xe ? e === "svg" : t.namespaceURI === Je ? e === "svg" && (n === "annotation-xml" || nt[n]) : !!pt[e];
	}, gt = function(e, t, n) {
		return t.namespaceURI === Xe ? e === "math" : t.namespaceURI === Ye ? e === "math" && it[n] : !!mt[e];
	}, _t = function(e, t, n) {
		return t.namespaceURI === Ye && !it[n] || t.namespaceURI === Je && !nt[n] ? !1 : !mt[e] && (at[e] || !pt[e]);
	}, vt = function(e) {
		let t = g(e);
		(!t || !t.tagName) && (t = {
			namespaceURI: Ze,
			tagName: "template"
		});
		let n = Gs(e.tagName), r = Gs(t.tagName);
		return $e[e.namespaceURI] ? e.namespaceURI === Ye ? ht(n, t, r) : e.namespaceURI === Je ? gt(n, t, r) : e.namespaceURI === Xe ? _t(n, t, r) : !!(ot === "application/xhtml+xml" && $e[e.namespaceURI]) : !1;
	}, yt = function(e) {
		Hs(t.removed, { element: e });
		try {
			g(e).removeChild(e);
		} catch {
			if (p(e), !g(e)) throw ic("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
		}
	}, N = function(e) {
		St(e);
		let t = h(e);
		if (t) {
			let e = [];
			zs(t, (t) => {
				Hs(e, t);
			}), zs(e, (e) => {
				try {
					p(e);
				} catch {}
			});
		}
		let n = v(e);
		if (n) for (let t = n.length - 1; t >= 0; --t) {
			let r = n[t], i = r && r.name;
			if (typeof i == "string") try {
				e.removeAttribute(i);
			} catch {}
		}
	}, bt = function(e, n) {
		try {
			Hs(t.removed, {
				attribute: n.getAttributeNode(e),
				from: n
			});
		} catch {
			Hs(t.removed, {
				attribute: null,
				from: n
			});
		}
		if (n.removeAttribute(e), e === "is") {
			if (M || Pe) try {
				yt(n);
			} catch {}
			else try {
				n.setAttribute(e, "");
			} catch {}
		}
	}, xt = function(e) {
		let t = v(e);
		if (t) for (let n = t.length - 1; n >= 0; --n) {
			let r = t[n], i = r && r.name;
			if (!(typeof i != "string" || k[ct(i)])) try {
				e.removeAttribute(i);
			} catch {}
		}
	}, St = function(e) {
		let t = [e];
		for (; t.length > 0;) {
			let e = t.pop();
			(y ? y(e) : e.nodeType) === Lc.element && xt(e);
			let n = h(e);
			if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
		}
	}, Ct = function(e) {
		if (!Ae) return;
		let t = [e];
		for (; t.length > 0;) {
			let e = t.pop(), n = y ? y(e) : e.nodeType;
			if (n === Lc.processingInstruction || n === Lc.comment && rc(Pc, e.data)) {
				try {
					p(e);
				} catch {}
				continue;
			}
			if (n === Lc.element) {
				let t = e, n = ct(b ? b(e) : e.nodeName);
				try {
					t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
				} catch {}
			}
			let r = h(e);
			if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
		}
	}, wt = function(e) {
		let t = null, r = null;
		if (Ne) e = "<remove></remove>" + e;
		else {
			let t = qs(e, /^[\r\n\t ]+/);
			r = t && t[0];
		}
		ot === "application/xhtml+xml" && Ze === Xe && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
		let i = S ? T(e) : e;
		if (Ze === Xe) try {
			t = new l().parseFromString(i, ot);
		} catch {}
		if (!t || !t.documentElement) {
			t = ae.createDocument(Ze, "template", null);
			try {
				t.documentElement.innerHTML = Qe ? C : i;
			} catch {}
		}
		let a = t.body || t.documentElement;
		return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Ze === Xe ? ce.call(t, A ? "html" : "body")[0] : A ? t.documentElement : a;
	}, Tt = function(e) {
		let t = x ? x(e) : e.ownerDocument;
		return oe.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
	}, Et = function(e) {
		return e = Js(e, ue, " "), e = Js(e, de, " "), e = Js(e, fe, " "), e;
	}, P = function(e) {
		e.normalize();
		let t = x ? x(e) : e.ownerDocument, n = oe.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
		for (; r;) r.data = Et(r.data), r = n.nextNode();
		let i = e.querySelectorAll?.call(e, "template");
		i && zs(i, (e) => {
			Ot(e.content) && P(e.content);
		});
	}, Dt = function(e) {
		let t = b ? b(e) : null;
		return typeof t != "string" || ct(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== v(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== y(e) || e.childNodes !== h(e);
	}, Ot = function(e) {
		if (!y || typeof e != "object" || !e) return !1;
		try {
			return y(e) === Lc.documentFragment;
		} catch {
			return !1;
		}
	}, kt = function(e) {
		if (!y || typeof e != "object" || !e) return !1;
		try {
			return typeof y(e) == "number";
		} catch {
			return !1;
		}
	};
	function At(e, n, r) {
		e.length !== 0 && zs(e, (e) => {
			e.call(t, n, r, lt);
		});
	}
	let jt = function(e, t) {
		return !!(Ae && e.hasChildNodes() && !kt(e.firstElementChild) && rc(Nc, e.textContent) && rc(Nc, e.innerHTML) || Ae && e.namespaceURI === Xe && t === "style" && kt(e.firstElementChild) || e.nodeType === Lc.processingInstruction || Ae && e.nodeType === Lc.comment && rc(Pc, e.data));
	}, Mt = function(e, t, n) {
		if (!Se[t] && F(t) && (xe.tagNameCheck instanceof RegExp && rc(xe.tagNameCheck, t) || xe.tagNameCheck instanceof Function && xe.tagNameCheck(t))) return !1;
		if (ze && !He[t]) {
			let t = g(e), r = h(e);
			if (r && t) {
				let i = r.length;
				for (let a = i - 1; a >= 0; --a) {
					let i = e === n ? f(r[a], !0) : r[a];
					t.insertBefore(i, m(e));
				}
			}
		}
		return yt(e), !0;
	}, Nt = function(e, t, n, r) {
		return e.length === 0 ? t : t === n || t === r ? cc(t) : t;
	}, Pt = function(e, n) {
		if (At(D.beforeSanitizeElements, e, null), e !== n && g(e) === null) return Be && St(e), !0;
		if (Dt(e)) return yt(e), !0;
		let r = ct(b ? b(e) : e.nodeName);
		if (O = Nt(D.uponSanitizeElement, O, ye, j), At(D.uponSanitizeElement, e, {
			tagName: r,
			allowedTags: O
		}), e !== n && g(e) === null) return Be && St(e), !0;
		if (jt(e, r)) return yt(e), !0;
		if (Se[r] || !(we.tagCheck instanceof Function && we.tagCheck(r)) && !O[r]) {
			let t = Mt(e, r, n);
			return t === !1 && At(D.afterSanitizeElements, e, null), t;
		}
		if ((y ? y(e) : e.nodeType) === Lc.element && !vt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && rc(Fc, e.innerHTML)) return yt(e), !0;
		if (ke && e.nodeType === Lc.text) {
			let n = Et(e.textContent);
			e.textContent !== n && (Hs(t.removed, { element: e.cloneNode() }), e.textContent = n);
		}
		return At(D.afterSanitizeElements, e, null), !1;
	}, Ft = function(e, t, r) {
		if (Ce[t] || Ae && t === "patchsrc" || Ae && t === "for" && e !== "label" && e !== "output" || Ie && (t === "id" || t === "name") && (r in n || r in ut)) return !1;
		let i = k[t] || we.attributeCheck instanceof Function && we.attributeCheck(t, e);
		if (!(Ee && rc(pe, t)) && !(Te && rc(me, t))) {
			if (!i) {
				if (!(F(e) && (xe.tagNameCheck instanceof RegExp && rc(xe.tagNameCheck, e) || xe.tagNameCheck instanceof Function && xe.tagNameCheck(e)) && (xe.attributeNameCheck instanceof RegExp && rc(xe.attributeNameCheck, t) || xe.attributeNameCheck instanceof Function && xe.attributeNameCheck(t, e)) || t === "is" && xe.allowCustomizedBuiltInElements && (xe.tagNameCheck instanceof RegExp && rc(xe.tagNameCheck, r) || xe.tagNameCheck instanceof Function && xe.tagNameCheck(r)))) return !1;
			} else if (!Ke[t] && !rc(ve, Js(r, ge, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Ys(r, "data:") === 0 && We[e]) && !(De && !rc(he, Js(r, ge, ""))) && r) return !1;
		}
		return !0;
	}, It = $({}, [
		"annotation-xml",
		"color-profile",
		"font-face",
		"font-face-format",
		"font-face-name",
		"font-face-src",
		"font-face-uri",
		"missing-glyph"
	]), F = function(e) {
		return !It[Gs(e)] && rc(_e, e);
	}, Lt = function(e, t, n, r) {
		if (S && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
			case "TrustedHTML": return T(r);
			case "TrustedScriptURL": return re(r);
		}
		return r;
	}, Rt = function(e, n, r, i) {
		try {
			r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), Dt(e) ? yt(e) : Vs(t.removed);
		} catch {
			bt(n, e);
		}
	}, zt = function(e) {
		At(D.beforeSanitizeAttributes, e, null);
		let t = e.attributes;
		if (!t || Dt(e)) return;
		k = Nt(D.uponSanitizeAttribute, k, be, Me);
		let n = {
			attrName: "",
			attrValue: "",
			keepAttr: !0,
			allowedAttributes: k,
			forceKeepAttr: void 0
		}, r = t.length, i = ct(e.nodeName);
		for (; r--;) {
			let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = ct(o), u = c, d = o === "value" ? u : Xs(u);
			if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, At(D.uponSanitizeAttribute, e, n), d = n.attrValue, Le && (l === "id" || l === "name") && Ys(d, Re) !== 0 && (bt(o, e), d = Re + d), Ae && rc(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
				bt(o, e);
				continue;
			}
			if (l === "attributename" && qs(d, "href")) {
				bt(o, e);
				continue;
			}
			if (!n.forceKeepAttr) {
				if (!n.keepAttr) {
					bt(o, e);
					continue;
				}
				if (!Oe && rc(Ic, d)) {
					bt(o, e);
					continue;
				}
				if (ke && (d = Et(d)), !Ft(i, l, d)) {
					bt(o, e);
					continue;
				}
				d = Lt(i, l, s, d), d !== u && Rt(e, o, s, d);
			}
		}
		At(D.afterSanitizeAttributes, e, null);
	}, Bt = function(e) {
		let t = null, n = Tt(e);
		for (At(D.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (At(D.uponSanitizeShadowNode, t, null), Pt(t, e), zt(t), Ot(t.content) && Bt(t.content), (y ? y(t) : t.nodeType) === Lc.element) {
			let e = _(t);
			Ot(e) && (Vt(e), Bt(e));
		}
		At(D.afterSanitizeShadowDOM, e, null);
	}, Vt = function(e) {
		let t = [{
			node: e,
			shadow: null
		}];
		for (; t.length > 0;) {
			let e = t.pop();
			if (e.shadow) {
				Bt(e.shadow);
				continue;
			}
			let n = e.node, r = (y ? y(n) : n.nodeType) === Lc.element, i = h(n);
			if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
				node: i[e],
				shadow: null
			});
			if (r) {
				let e = b ? b(n) : null;
				if (typeof e == "string" && ct(e) === "template") {
					let e = n.content;
					Ot(e) && t.push({
						node: e,
						shadow: null
					});
				}
			}
			if (r) {
				let e = _(n);
				Ot(e) && t.push({
					node: null,
					shadow: e
				}, {
					node: e,
					shadow: null
				});
			}
		}
	};
	return t.sanitize = function(e) {
		let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
		if (Qe = !e, Qe && (e = "<!-->"), typeof e != "string" && !kt(e) && (e = lc(e), typeof e != "string")) throw ic("dirty is not a string, aborting");
		if (!t.isSupported) return e;
		je ? (O = j, k = Me) : ft(n), (D.uponSanitizeElement.length > 0 || D.uponSanitizeAttribute.length > 0) && (O = cc(O)), D.uponSanitizeAttribute.length > 0 && (k = cc(k)), t.removed = [];
		let c = Be && typeof e != "string" && kt(e);
		if (c) {
			Ct(e);
			let t = b ? b(e) : e.nodeName;
			if (typeof t == "string") {
				let n = ct(t);
				if (!O[n] || Se[n]) throw N(e), ic("root node is forbidden and cannot be sanitized in-place");
			}
			if (Dt(e)) throw N(e), ic("root node is clobbered and cannot be sanitized in-place");
			try {
				Vt(e);
			} catch (t) {
				throw N(e), t;
			}
		} else if (kt(e)) i = wt("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === Lc.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Vt(a);
		else {
			if (!M && !ke && !A && e.indexOf("<") === -1) return S && Fe ? T(e) : e;
			if (i = wt(e), !i) return M ? null : Fe ? C : "";
		}
		i && Ne && yt(i.firstChild);
		let l = c ? e : i;
		try {
			let e = Tt(l);
			for (; o = e.nextNode();) Pt(o, l), zt(o), Ot(o.content) && Bt(o.content);
		} catch (n) {
			throw c && (N(e), zs(t.removed, (e) => {
				e.element && St(e.element);
			})), n;
		}
		if (c) return zs(t.removed, (e) => {
			e.element && St(e.element);
		}), ke && P(e), e;
		if (M) {
			if (ke && P(i), Pe) for (s = se.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
			else s = i;
			return (k.shadowroot || k.shadowrootmode) && (s = le.call(r, s, !0)), s;
		}
		let u = A ? i.outerHTML : i.innerHTML;
		return A && O["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && rc(jc, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), ke && (u = Et(u)), S && Fe ? T(u) : u;
	}, t.setConfig = function() {
		let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
		ft(e), je = !0, j = O, Me = k;
	}, t.clearConfig = function() {
		lt = null, je = !1, j = null, Me = null, S = ee, C = "";
	}, t.isValidAttribute = function(e, t, n) {
		lt || ft({});
		let r = ct(e), i = ct(t);
		return Ft(r, i, n);
	}, t.addHook = function(e, t) {
		typeof t == "function" && tc(D, e) && Hs(D[e], t);
	}, t.removeHook = function(e, t) {
		if (tc(D, e)) {
			if (t !== void 0) {
				let n = Bs(D[e], t);
				return n === -1 ? void 0 : Us(D[e], n, 1)[0];
			}
			return Vs(D[e]);
		}
	}, t.removeHooks = function(e) {
		tc(D, e) && (D[e] = []);
	}, t.removeAllHooks = function() {
		D = Bc();
	}, t;
}
var Uc = Hc();
//#endregion
//#region src/lib/markdown.ts
bs.setOptions({
	breaks: !0,
	gfm: !0
});
function Wc(e) {
	let t = bs.parse(e, { async: !1 });
	return Uc.sanitize(t);
}
//#endregion
//#region src/lib/components/LabelChip.svelte
var Gc = /* @__PURE__ */ G("<span class=\"badge\"> </span>"), Kc = /* @__PURE__ */ G("<span> </span>");
function qc(e, t) {
	He(t, !0);
	let n = X(t, "text", 7), r = X(t, "color", 7);
	var i = {
		get text() {
			return n();
		},
		set text(e) {
			n(e), F();
		},
		get color() {
			return r();
		},
		set color(e) {
			r(e), F();
		}
	}, a = kr(), o = cn(a), s = (e) => {
		var t = Gc(), i = R(t, !0);
		M(t), B((e) => {
			li(t, `background-color: ${r() ?? ""}; color: ${e ?? ""}`), q(i, n());
		}, [() => Fa(r())]), K(e, t);
	}, c = /* @__PURE__ */ N(() => r() && Na(r())), l = (e) => {
		var t = Kc(), i = R(t, !0);
		M(t), B(() => {
			si(t, 1, `badge ${Ma[r()] ?? Ma.gray ?? ""}`), q(i, n());
		}), K(e, t);
	};
	return J(o, (e) => {
		U(c) ? e(s) : e(l, -1);
	}), K(e, a), Ue(i);
}
Ai(qc, {
	text: {},
	color: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/api/tables.ts
function Jc(e) {
	return e === "date" ? { type: "date" } : e === "datetime" ? {
		type: "datetime-local",
		step: "1"
	} : { type: "text" };
}
async function Yc(e, t = fetch) {
	return (await Mi(`/api/v1/tables/${e}`, void 0, t)).json();
}
//#endregion
//#region src/lib/api/attachments.ts
function Xc(e, t, n, r) {
	return `/api/v1/tables/${e}/records/${t}/attachments/${n}/${r}`;
}
function Zc(e, t, n, r) {
	return Xc(e, t, n, r);
}
function Qc(e, t, n, r) {
	return `${Xc(e, t, n, r)}/thumbnail`;
}
async function $c(e, t, n, r) {
	let i = new FormData();
	return i.append("file", r), (await Mi(`/api/v1/tables/${e}/records/${t}/attachments/${n}`, {
		method: "POST",
		body: i
	})).json();
}
async function el(e, t, n, r) {
	await Mi(Xc(e, t, n, r), { method: "DELETE" });
}
//#endregion
//#region src/lib/components/Lightbox.svelte
var tl = /* @__PURE__ */ G("<div class=\"fixed inset-0 z-[9999] grid place-items-center bg-ink-950/80 p-4\"><div class=\"relative max-h-[90vh] max-w-[90vw]\"><img class=\"max-h-[90vh] max-w-[90vw] rounded shadow-2xl\"/> <button type=\"button\" class=\"absolute -top-3 -right-3 flex size-8 items-center justify-center rounded-full bg-surface text-ink-700 shadow hover:bg-ink-100\">×</button></div></div>");
function nl(e, t) {
	He(t, !0);
	let n = X(t, "src", 7), r = X(t, "alt", 7), i = X(t, "onClose", 7);
	vn(() => {
		function e(e) {
			e.key === "Escape" && i()();
		}
		return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
	});
	var a = {
		get src() {
			return n();
		},
		set src(e) {
			n(e), F();
		},
		get alt() {
			return r();
		},
		set alt(e) {
			r(e), F();
		},
		get onClose() {
			return i();
		},
		set onClose(e) {
			i(e), F();
		}
	}, o = tl(), s = R(o), c = R(s), l = z(c, 2);
	return M(s), M(o), B((e) => {
		Y(c, "src", n()), Y(c, "alt", r()), Y(l, "aria-label", e);
	}, [() => Z("common.close")]), W("click", l, function(...e) {
		i()?.apply(this, e);
	}), K(e, o), Ue(a);
}
yr(["click"]), Ai(nl, {
	src: {},
	alt: {},
	onClose: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/AttachmentCell.svelte
var rl = /* @__PURE__ */ G("<span class=\"group/file relative inline-flex shrink-0\"><button type=\"button\" class=\"block rounded\"><img loading=\"lazy\" class=\"size-8 rounded border border-ink-200 object-cover\"/></button> <button type=\"button\" class=\"absolute -top-1.5 -right-1.5 hidden size-4 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white group-hover/file:flex disabled:opacity-50\">×</button></span>"), il = /* @__PURE__ */ G("<span class=\"badge inline-flex shrink-0 items-center gap-1 bg-ink-100 text-ink-700\"><a target=\"_blank\" rel=\"noopener\" class=\"max-w-[8rem] truncate hover:underline\"> </a> <button type=\"button\" class=\"rounded-full text-ink-400 hover:text-red-600 disabled:opacity-50\">×</button></span>"), al = /* @__PURE__ */ Dr("<svg class=\"size-3 animate-spin\" viewBox=\"0 0 24 24\" fill=\"none\"><circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"3\"></circle><path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\"></path></svg>"), ol = /* @__PURE__ */ G("<span class=\"flex flex-wrap items-center gap-1.5 overflow-hidden\"><!> <input type=\"file\" class=\"hidden\"/> <button type=\"button\" class=\"badge shrink-0 bg-ink-100 text-ink-500 hover:bg-ink-200 hover:text-ink-700 disabled:opacity-50\"><!></button></span> <!>", 1);
function sl(e, t) {
	He(t, !0);
	let n = X(t, "files", 7), r = X(t, "tableId", 7), i = X(t, "pk", 7), a = X(t, "columnId", 7), o = X(t, "onUpload", 7), s = X(t, "onDelete", 7), c = /* @__PURE__ */ I(void 0), l = /* @__PURE__ */ I(!1), u = /* @__PURE__ */ I(null), d = /* @__PURE__ */ I(null);
	async function f(e) {
		let t = e.currentTarget, n = t.files?.[0];
		if (t.value = "", n) {
			L(l, !0);
			try {
				await o()(n);
			} finally {
				L(l, !1);
			}
		}
	}
	async function p(e) {
		L(u, e, !0);
		try {
			await s()(e);
		} finally {
			L(u, null);
		}
	}
	function m(e) {
		return e.mime_type.startsWith("image/") && e.has_thumbnail;
	}
	var h = {
		get files() {
			return n();
		},
		set files(e) {
			n(e), F();
		},
		get tableId() {
			return r();
		},
		set tableId(e) {
			r(e), F();
		},
		get pk() {
			return i();
		},
		set pk(e) {
			i(e), F();
		},
		get columnId() {
			return a();
		},
		set columnId(e) {
			a(e), F();
		},
		get onUpload() {
			return o();
		},
		set onUpload(e) {
			o(e), F();
		},
		get onDelete() {
			return s();
		},
		set onDelete(e) {
			s(e), F();
		}
	}, g = ol(), _ = cn(g), v = R(_);
	Wr(v, 17, n, (e) => e.id, (e, t) => {
		var n = kr(), o = cn(n), s = (e) => {
			var n = rl(), o = R(n), s = R(o);
			M(o);
			var c = z(o, 2);
			M(n), B((e, n) => {
				Y(o, "title", U(t).original_filename), Y(s, "src", e), Y(s, "alt", U(t).original_filename), Y(c, "aria-label", n), c.disabled = U(u) === U(t).id;
			}, [() => Qc(r(), i(), a(), U(t).id), () => Z("attachmentCell.deleteFile", { name: U(t).original_filename })]), W("click", o, () => L(d, U(t), !0)), W("click", c, () => p(U(t).id)), K(e, n);
		}, c = /* @__PURE__ */ N(() => m(U(t))), l = (e) => {
			var n = il(), o = R(n), s = R(o, !0);
			M(o);
			var c = z(o, 2);
			M(n), B((e, n) => {
				Y(o, "href", e), Y(o, "title", U(t).original_filename), q(s, U(t).original_filename), Y(c, "aria-label", n), c.disabled = U(u) === U(t).id;
			}, [() => Zc(r(), i(), a(), U(t).id), () => Z("attachmentCell.deleteFile", { name: U(t).original_filename })]), W("click", c, () => p(U(t).id)), K(e, n);
		};
		J(o, (e) => {
			U(c) ? e(s) : e(l, -1);
		}), K(e, n);
	});
	var y = z(v, 2);
	wi(y, (e) => L(c, e), () => U(c));
	var b = z(y, 2), x = R(b), S = (e) => {
		K(e, al());
	}, C = (e) => {
		K(e, Or("+"));
	};
	J(x, (e) => {
		U(l) ? e(S) : e(C, -1);
	}), M(b), M(_);
	var ee = z(_, 2), w = (e) => {
		{
			let t = /* @__PURE__ */ N(() => Zc(r(), i(), a(), U(d).id));
			nl(e, {
				get src() {
					return U(t);
				},
				get alt() {
					return U(d).original_filename;
				},
				onClose: () => L(d, null)
			});
		}
	};
	return J(ee, (e) => {
		U(d) && e(w);
	}), B((e, t) => {
		y.disabled = U(l), Y(b, "aria-label", e), Y(b, "title", t), b.disabled = U(l);
	}, [() => U(l) ? Z("attachmentCell.uploading") : Z("attachmentCell.upload"), () => U(l) ? Z("attachmentCell.uploading") : Z("attachmentCell.upload")]), W("change", y, f), W("click", b, () => U(c)?.click()), K(e, g), Ue(h);
}
yr(["click", "change"]), Ai(sl, {
	files: {},
	tableId: {},
	pk: {},
	columnId: {},
	onUpload: {},
	onDelete: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/FKSelect.svelte
var cl = /* @__PURE__ */ G("<input/>"), ll = /* @__PURE__ */ G("<span class=\"badge shrink-0 truncate bg-ink-100 text-ink-700\"> </span>"), ul = /* @__PURE__ */ G("<span class=\"truncate text-ink-400\"> </span>"), dl = /* @__PURE__ */ G("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), fl = /* @__PURE__ */ G("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), pl = /* @__PURE__ */ G("<span class=\"truncate\"> </span>"), ml = /* @__PURE__ */ G("<button type=\"button\"><!></button>"), hl = /* @__PURE__ */ G("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), gl = /* @__PURE__ */ G("<!> <!>", 1), _l = /* @__PURE__ */ G("<div class=\"card fixed z-30 flex max-h-72 flex-col overflow-hidden py-1 shadow-lg\"><input type=\"text\" class=\"mx-2 mb-1 border-b border-ink-200 px-1 py-1 text-sm outline-none\"/> <div class=\"overlay-scroll overflow-y-auto\"><!></div></div>"), vl = /* @__PURE__ */ G("<button type=\"button\"><!> <svg class=\"size-3 shrink-0 text-ink-400\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg></button> <!>", 1);
function yl(e, t) {
	He(t, !0);
	let n = X(t, "value", 15, ""), r = X(t, "fkTargetTableId", 7), i = X(t, "fkTargetColumn", 7), a = X(t, "uiType", 7), o = X(t, "nullable", 7, !1), s = X(t, "currentLabel", 7), c = X(t, "autoOpen", 7, !1), l = X(t, "onClose", 7), u = X(t, "onCancel", 7), d = X(t, "onKeydown", 7), f = X(t, "emptyLabel", 7, "–"), p = X(t, "class", 7), m = /* @__PURE__ */ I(!1), h = /* @__PURE__ */ I(null), g = /* @__PURE__ */ I(null), _;
	function v() {
		return _ ||= Yc(r()).then((e) => {
			let t = e.columns.find((e) => e.is_display_column);
			L(h, t && (t.field_kind === "physical" || t.field_kind === "auto_number" || t.field_kind === "formula") ? t.effective_name : null, !0), L(g, e.columns.find((e) => e.name === i())?.effective_name ?? i(), !0);
		}).catch(() => {
			L(h, null);
		}).finally(() => {
			L(m, !0);
		}), _;
	}
	vn(() => {
		v();
	});
	let y = /* @__PURE__ */ I(!1), b = /* @__PURE__ */ I(""), x = /* @__PURE__ */ I(Qt([])), S = /* @__PURE__ */ I(!1), C = /* @__PURE__ */ I(!1), ee = /* @__PURE__ */ I(!1), w = /* @__PURE__ */ I(0), te = /* @__PURE__ */ I(void 0), ne = 0, T, re = /* @__PURE__ */ I(void 0), ie = /* @__PURE__ */ I(void 0), E = /* @__PURE__ */ I(void 0), ae = /* @__PURE__ */ I(void 0), oe = /* @__PURE__ */ I(null), se = /* @__PURE__ */ N(() => o() ? [{
		rawValue: "",
		label: f()
	}, ...U(x)] : U(x));
	async function ce(e) {
		if (!U(h)) return;
		let t = ++ne;
		L(C, !0), L(ee, !1);
		try {
			let n = await Ui(r(), {
				where: e ? {
					col: U(h),
					op: "like",
					val: e
				} : Ni,
				sort: [{
					column: U(h),
					desc: !1
				}],
				limit: 20
			});
			if (t !== ne) return;
			L(x, n.records.map((e) => ({
				rawValue: String(e[U(g) ?? i()] ?? ""),
				label: String(e[U(h)] ?? "")
			})), !0), L(S, n.pageInfo.hasMore, !0);
		} catch {
			if (t !== ne) return;
			L(ee, !0), L(x, [], !0), L(S, !1);
		} finally {
			t === ne && L(C, !1);
		}
	}
	function le(e) {
		T && clearTimeout(T), T = setTimeout(() => ce(e), 250);
	}
	function D() {
		if (!U(re) || !U(h)) return;
		let e = U(re).getBoundingClientRect();
		L(oe, {
			top: e.bottom + 2,
			left: e.left,
			width: Math.max(e.width, 240)
		}, !0), L(y, !0), L(b, ""), L(w, 0), ce(""), queueMicrotask(() => U(E)?.focus());
	}
	function ue() {
		L(y, !1), L(oe, null), T && clearTimeout(T);
	}
	function de() {
		ue(), l()?.();
	}
	function fe(e) {
		n(e.rawValue), L(te, e.rawValue === "" ? void 0 : e.label, !0), ue(), l()?.();
	}
	async function pe() {
		await v(), U(h) && (U(y) ? de() : D());
	}
	function me(e) {
		if (!U(y)) {
			if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
				e.preventDefault(), pe();
				return;
			}
			d()?.(e);
			return;
		}
	}
	function he(e) {
		let t = U(se).length;
		if (e.key === "ArrowDown") e.preventDefault(), t > 0 && L(w, (U(w) + 1) % t);
		else if (e.key === "ArrowUp") e.preventDefault(), t > 0 && L(w, (U(w) - 1 + t) % t);
		else if (e.key === "Enter") {
			e.preventDefault();
			let t = U(se)[U(w)];
			t && fe(t);
		} else e.key === "Escape" && (e.preventDefault(), ue(), u()?.());
	}
	vn(() => {
		c() && v().then(() => {
			U(h) ? (U(re)?.focus(), D()) : U(ie)?.focus();
		});
	}), vn(() => {
		if (!U(y)) return;
		function e(e) {
			let t = e.target;
			U(ae)?.contains(t) || U(re)?.contains(t) || de();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var ge = {
		get value() {
			return n();
		},
		set value(e = "") {
			n(e), F();
		},
		get fkTargetTableId() {
			return r();
		},
		set fkTargetTableId(e) {
			r(e), F();
		},
		get fkTargetColumn() {
			return i();
		},
		set fkTargetColumn(e) {
			i(e), F();
		},
		get uiType() {
			return a();
		},
		set uiType(e) {
			a(e), F();
		},
		get nullable() {
			return o();
		},
		set nullable(e = !1) {
			o(e), F();
		},
		get currentLabel() {
			return s();
		},
		set currentLabel(e) {
			s(e), F();
		},
		get autoOpen() {
			return c();
		},
		set autoOpen(e = !1) {
			c(e), F();
		},
		get onClose() {
			return l();
		},
		set onClose(e) {
			l(e), F();
		},
		get onCancel() {
			return u();
		},
		set onCancel(e) {
			u(e), F();
		},
		get onKeydown() {
			return d();
		},
		set onKeydown(e) {
			d(e), F();
		},
		get emptyLabel() {
			return f();
		},
		set emptyLabel(e = "–") {
			f(e), F();
		},
		get class() {
			return p();
		},
		set class(e) {
			p(e), F();
		}
	}, _e = kr(), ve = cn(_e), O = (e) => {
		var t = cl();
		mi(t), wi(t, (e) => L(ie, e), () => U(ie)), B((e, n) => {
			Y(t, "type", e), Y(t, "step", n), si(t, 1, ti(p()));
		}, [() => Jc(a()).type, () => Jc(a()).step]), W("keydown", t, function(...e) {
			d()?.apply(this, e);
		}), vr("blur", t, () => l()?.()), bi(t, n), K(e, t);
	}, ye = (e) => {
		var t = vl(), r = cn(t), i = R(r), a = (e) => {
			var t = ll(), r = R(t, !0);
			M(t), B(() => q(r, s() ?? U(te) ?? n())), K(e, t);
		}, o = (e) => {
			var t = ul(), n = R(t, !0);
			M(t), B(() => q(n, f())), K(e, t);
		};
		J(i, (e) => {
			n() ? e(a) : e(o, -1);
		}), Pe(2), M(r), wi(r, (e) => L(re, e), () => U(re));
		var c = z(r, 2), l = (e) => {
			var t = _l(), n = R(t);
			mi(n), wi(n, (e) => L(E, e), () => U(E));
			var r = z(n, 2), i = R(r), a = (e) => {
				var t = dl(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("nav.loading")]), K(e, t);
			}, o = (e) => {
				var t = fl(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("common.errorLoading")]), K(e, t);
			}, s = (e) => {
				var t = dl(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("common.noResults")]), K(e, t);
			}, c = (e) => {
				var t = gl(), n = cn(t);
				Wr(n, 19, () => U(se), (e, t) => e.rawValue + "::" + t, (e, t, n) => {
					var r = ml(), i = R(r), a = (e) => {
						var t = ul(), n = R(t, !0);
						M(t), B(() => q(n, f())), K(e, t);
					}, o = (e) => {
						var n = pl(), r = R(n, !0);
						M(n), B(() => q(r, U(t).label)), K(e, n);
					};
					J(i, (e) => {
						U(t).rawValue === "" ? e(a) : e(o, -1);
					}), M(r), B(() => si(r, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
								${U(n) === U(w) ? "bg-brand-50" : "hover:bg-ink-100"}`)), W("mousedown", r, (e) => e.preventDefault()), W("click", r, () => fe(U(t))), K(e, r);
				});
				var r = z(n, 2), i = (e) => {
					var t = hl(), n = R(t, !0);
					M(t), B((e) => q(n, e), [() => Z("common.refineSearch")]), K(e, t);
				};
				J(r, (e) => {
					U(S) && e(i);
				}), K(e, t);
			};
			J(i, (e) => {
				U(C) ? e(a) : U(ee) ? e(o, 1) : U(se).length === 0 ? e(s, 2) : e(c, -1);
			}), M(r), Qr(r, (e) => Ia?.(e)), M(t), wi(t, (e) => L(ae, e), () => U(ae)), B((e) => {
				li(t, `min-width: ${U(oe).width ?? ""}px; top: ${U(oe).top ?? ""}px; left: ${U(oe).left ?? ""}px`), Y(n, "placeholder", e);
			}, [() => Z("common.search")]), W("input", n, () => le(U(b))), W("keydown", n, he), bi(n, () => U(b), (e) => L(b, e)), K(e, t);
		};
		J(c, (e) => {
			U(y) && U(oe) && e(l);
		}), B(() => si(r, 1, `flex items-center justify-between gap-1 text-left ${p() ?? "" ?? ""}`)), W("click", r, pe), W("keydown", r, me), K(e, t);
	};
	return J(ve, (e) => {
		U(m) && !U(h) ? e(O) : e(ye, -1);
	}), K(e, _e), Ue(ge);
}
yr([
	"keydown",
	"click",
	"input",
	"mousedown"
]), Ai(yl, {
	value: {},
	fkTargetTableId: {},
	fkTargetColumn: {},
	uiType: {},
	nullable: {},
	currentLabel: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LabelSelect.svelte
var bl = /* @__PURE__ */ G("<span class=\"truncate text-ink-400\"> </span>"), xl = /* @__PURE__ */ G("<button type=\"button\"><!></button>"), Sl = /* @__PURE__ */ G("<div class=\"overlay-scroll card fixed z-30 max-h-64 overflow-y-auto py-1 shadow-lg\"></div>"), Cl = /* @__PURE__ */ G("<button type=\"button\"><!> <svg class=\"size-3 shrink-0 text-ink-400\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg></button> <!>", 1);
function wl(e, t) {
	He(t, !0);
	let n = X(t, "value", 15, ""), r = X(t, "colors", 7), i = X(t, "order", 7), a = X(t, "autoOpen", 7, !1), o = X(t, "onClose", 7), s = X(t, "onCancel", 7), c = X(t, "onKeydown", 7), l = X(t, "emptyLabel", 7, "–"), u = X(t, "class", 7), d = /* @__PURE__ */ I(!1), f = /* @__PURE__ */ I(void 0), p = /* @__PURE__ */ I(void 0), m = /* @__PURE__ */ I(null), h = /* @__PURE__ */ I(0), g = /* @__PURE__ */ N(() => ["", ...Pa(r(), i())]);
	function _() {
		if (!U(f)) return;
		let e = U(f).getBoundingClientRect();
		L(m, {
			top: e.bottom + 2,
			left: e.left,
			width: Math.max(e.width, 180)
		}, !0), L(h, Math.max(0, U(g).indexOf(n())), !0), L(d, !0);
	}
	function v() {
		L(d, !1), L(m, null);
	}
	function y() {
		v(), o()?.();
	}
	function b(e) {
		n(e), v(), o()?.();
	}
	function x() {
		U(d) ? y() : _();
	}
	function S(e) {
		if (!U(d)) {
			if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
				e.preventDefault(), _();
				return;
			}
			c()?.(e);
			return;
		}
		e.key === "ArrowDown" ? (e.preventDefault(), L(h, (U(h) + 1) % U(g).length)) : e.key === "ArrowUp" ? (e.preventDefault(), L(h, (U(h) - 1 + U(g).length) % U(g).length)) : e.key === "Enter" ? (e.preventDefault(), b(U(g)[U(h)])) : e.key === "Escape" && (e.preventDefault(), v(), s()?.());
	}
	vn(() => {
		a() && (U(f)?.focus(), _());
	}), vn(() => {
		if (!U(d)) return;
		function e(e) {
			let t = e.target;
			U(p)?.contains(t) || U(f)?.contains(t) || y();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var C = {
		get value() {
			return n();
		},
		set value(e = "") {
			n(e), F();
		},
		get colors() {
			return r();
		},
		set colors(e) {
			r(e), F();
		},
		get order() {
			return i();
		},
		set order(e) {
			i(e), F();
		},
		get autoOpen() {
			return a();
		},
		set autoOpen(e = !1) {
			a(e), F();
		},
		get onClose() {
			return o();
		},
		set onClose(e) {
			o(e), F();
		},
		get onCancel() {
			return s();
		},
		set onCancel(e) {
			s(e), F();
		},
		get onKeydown() {
			return c();
		},
		set onKeydown(e) {
			c(e), F();
		},
		get emptyLabel() {
			return l();
		},
		set emptyLabel(e = "–") {
			l(e), F();
		},
		get class() {
			return u();
		},
		set class(e) {
			u(e), F();
		}
	}, ee = Cl(), w = cn(ee), te = R(w), ne = (e) => {
		qc(e, {
			get text() {
				return n();
			},
			get color() {
				return r()[n()];
			}
		});
	}, T = (e) => {
		var t = bl(), n = R(t, !0);
		M(t), B(() => q(n, l())), K(e, t);
	};
	J(te, (e) => {
		n() ? e(ne) : e(T, -1);
	}), Pe(2), M(w), wi(w, (e) => L(f, e), () => U(f));
	var re = z(w, 2), ie = (e) => {
		var t = Sl();
		Wr(t, 22, () => U(g), (e) => e, (e, t, n) => {
			var i = xl(), a = R(i), o = (e) => {
				qc(e, {
					get text() {
						return t;
					},
					get color() {
						return r()[t];
					}
				});
			}, s = (e) => {
				var t = bl(), n = R(t, !0);
				M(t), B(() => q(n, l())), K(e, t);
			};
			J(a, (e) => {
				t ? e(o) : e(s, -1);
			}), M(i), B(() => si(i, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
					${U(n) === U(h) ? "bg-brand-50" : "hover:bg-ink-100"}`)), W("mousedown", i, (e) => e.preventDefault()), W("click", i, () => b(t)), K(e, i);
		}), M(t), wi(t, (e) => L(p, e), () => U(p)), Qr(t, (e) => Ia?.(e)), B(() => li(t, `min-width: ${U(m).width ?? ""}px; top: ${U(m).top ?? ""}px; left: ${U(m).left ?? ""}px`)), K(e, t);
	};
	return J(re, (e) => {
		U(d) && U(m) && e(ie);
	}), B(() => si(w, 1, `flex items-center justify-between gap-1 text-left ${u() ?? "" ?? ""}`)), W("click", w, x), W("keydown", w, S), K(e, ee), Ue(C);
}
yr([
	"click",
	"keydown",
	"mousedown"
]), Ai(wl, {
	value: {},
	colors: {},
	order: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LinksSelect.svelte
var Tl = /* @__PURE__ */ G("<div class=\"px-3 py-2 text-sm text-ink-500\"> </div>"), El = /* @__PURE__ */ G("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), Dl = /* @__PURE__ */ G("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), Ol = /* @__PURE__ */ G("<button type=\"button\"><span class=\"truncate\"> </span></button>"), kl = /* @__PURE__ */ G("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), Al = /* @__PURE__ */ G("<!> <!>", 1), jl = /* @__PURE__ */ G("<input type=\"text\" class=\"mx-2 mb-1 border-b border-ink-200 px-1 py-1 text-sm outline-none\"/> <div class=\"overlay-scroll overflow-y-auto\"><!></div>", 1), Ml = /* @__PURE__ */ G("<div class=\"card fixed z-30 flex max-h-72 flex-col overflow-hidden py-1 shadow-lg\"><!></div>"), Nl = /* @__PURE__ */ G("<button type=\"button\">+</button> <!>", 1);
function Pl(e, t) {
	He(t, !0);
	let n = X(t, "targetTableId", 7), r = X(t, "excludeIds", 23, () => []), i = X(t, "onSelect", 7), a = X(t, "class", 7), o = /* @__PURE__ */ I(null), s = /* @__PURE__ */ I(null), c;
	function l() {
		return c ||= Yc(n()).then((e) => {
			let t = e.columns.find((e) => e.is_display_column);
			L(o, t && (t.field_kind === "physical" || t.field_kind === "auto_number" || t.field_kind === "formula") ? t.effective_name : null, !0), L(s, e.columns.find((e) => e.is_primary_key)?.effective_name ?? null, !0);
		}).catch(() => {
			L(o, null), L(s, null);
		}), c;
	}
	let u = /* @__PURE__ */ N(() => U(o) ?? U(s)), d = /* @__PURE__ */ I(!1), f = /* @__PURE__ */ I(""), p = /* @__PURE__ */ I(Qt([])), m = /* @__PURE__ */ I(!1), h = /* @__PURE__ */ I(!1), g = /* @__PURE__ */ I(!1), _ = /* @__PURE__ */ I(0), v = 0, y, b = /* @__PURE__ */ I(void 0), x = /* @__PURE__ */ I(void 0), S = /* @__PURE__ */ I(void 0), C = /* @__PURE__ */ I(null), ee = /* @__PURE__ */ N(() => new Set(r().map((e) => String(e)))), w = /* @__PURE__ */ N(() => U(p).filter((e) => !U(ee).has(String(e.id))));
	async function te(e) {
		if (!U(u) || !U(s)) return;
		let t = ++v;
		L(h, !0), L(g, !1);
		try {
			let r = await Ui(n(), {
				where: e ? {
					col: U(u),
					op: "like",
					val: e
				} : Ni,
				sort: [{
					column: U(u),
					desc: !1
				}],
				limit: 20
			});
			if (t !== v) return;
			L(p, r.records.map((e) => ({
				id: e[U(s)],
				label: String(e[U(u)] ?? "")
			})), !0), L(m, r.pageInfo.hasMore, !0);
		} catch {
			if (t !== v) return;
			L(g, !0), L(p, [], !0), L(m, !1);
		} finally {
			t === v && L(h, !1);
		}
	}
	function ne(e) {
		y && clearTimeout(y), y = setTimeout(() => te(e), 250);
	}
	function T() {
		if (!U(b)) return;
		let e = U(b).getBoundingClientRect();
		L(C, {
			top: e.bottom + 2,
			left: e.left,
			width: 220
		}, !0), L(d, !0), L(f, ""), L(_, 0), U(u) && U(s) && te(""), queueMicrotask(() => U(x)?.focus());
	}
	function re() {
		L(d, !1), L(C, null), y && clearTimeout(y);
	}
	async function ie() {
		await l(), U(d) ? re() : T();
	}
	function E(e) {
		i()(e.id);
	}
	function ae(e) {
		let t = U(w).length;
		if (e.key === "ArrowDown") e.preventDefault(), t > 0 && L(_, (U(_) + 1) % t);
		else if (e.key === "ArrowUp") e.preventDefault(), t > 0 && L(_, (U(_) - 1 + t) % t);
		else if (e.key === "Enter") {
			e.preventDefault();
			let t = U(w)[U(_)];
			t && E(t);
		} else e.key === "Escape" && (e.preventDefault(), re());
	}
	vn(() => {
		if (!U(d)) return;
		function e(e) {
			let t = e.target;
			U(S)?.contains(t) || U(b)?.contains(t) || re();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var oe = {
		get targetTableId() {
			return n();
		},
		set targetTableId(e) {
			n(e), F();
		},
		get excludeIds() {
			return r();
		},
		set excludeIds(e = []) {
			r(e), F();
		},
		get onSelect() {
			return i();
		},
		set onSelect(e) {
			i(e), F();
		},
		get class() {
			return a();
		},
		set class(e) {
			a(e), F();
		}
	}, se = Nl(), ce = cn(se);
	wi(ce, (e) => L(b, e), () => U(b));
	var le = z(ce, 2), D = (e) => {
		var t = Ml(), n = R(t), r = (e) => {
			var t = Tl(), n = R(t, !0);
			M(t), B((e) => q(n, e), [() => Z("linksSelect.noPrimaryKey")]), K(e, t);
		}, i = (e) => {
			var t = jl(), n = cn(t);
			mi(n), wi(n, (e) => L(x, e), () => U(x));
			var r = z(n, 2), i = R(r), a = (e) => {
				var t = El(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("nav.loading")]), K(e, t);
			}, o = (e) => {
				var t = Dl(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("common.errorLoading")]), K(e, t);
			}, s = (e) => {
				var t = El(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => Z("common.noResults")]), K(e, t);
			}, c = (e) => {
				var t = Al(), n = cn(t);
				Wr(n, 19, () => U(w), (e) => String(e.id), (e, t, n) => {
					var r = Ol(), i = R(r), a = R(i, !0);
					M(i), M(r), B(() => {
						si(r, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
								${U(n) === U(_) ? "bg-brand-50" : "hover:bg-ink-100"}`), q(a, U(t).label);
					}), W("mousedown", r, (e) => e.preventDefault()), W("click", r, () => E(U(t))), K(e, r);
				});
				var r = z(n, 2), i = (e) => {
					var t = kl(), n = R(t, !0);
					M(t), B((e) => q(n, e), [() => Z("common.refineSearch")]), K(e, t);
				};
				J(r, (e) => {
					U(m) && e(i);
				}), K(e, t);
			};
			J(i, (e) => {
				U(h) ? e(a) : U(g) ? e(o, 1) : U(w).length === 0 ? e(s, 2) : e(c, -1);
			}), M(r), Qr(r, (e) => Ia?.(e)), B((e) => Y(n, "placeholder", e), [() => Z("common.search")]), W("input", n, () => ne(U(f))), W("keydown", n, ae), bi(n, () => U(f), (e) => L(f, e)), K(e, t);
		};
		J(n, (e) => {
			U(s) ? e(i, -1) : e(r);
		}), M(t), wi(t, (e) => L(S, e), () => U(S)), B(() => li(t, `min-width: ${U(C).width ?? ""}px; top: ${U(C).top ?? ""}px; left: ${U(C).left ?? ""}px`)), K(e, t);
	};
	return J(le, (e) => {
		U(d) && U(C) && e(D);
	}), B((e, t) => {
		si(ce, 1, `badge shrink-0 bg-ink-100 text-ink-500 hover:bg-ink-200 hover:text-ink-700 ${a() ?? "" ?? ""}`), Y(ce, "aria-label", e), Y(ce, "title", t);
	}, [() => Z("linksSelect.addLink"), () => Z("linksSelect.addLink")]), W("click", ce, ie), K(e, se), Ue(oe);
}
yr([
	"click",
	"input",
	"keydown",
	"mousedown"
]), Ai(Pl, {
	targetTableId: {},
	excludeIds: {},
	onSelect: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/MarkdownEditModal.svelte
var Fl = /* @__PURE__ */ G("<p class=\"text-sm text-ink-400 italic\"> </p>"), Il = /* @__PURE__ */ G("<div class=\"markdown-body\"></div>"), Ll = /* @__PURE__ */ G("<div class=\"overlay-scroll min-h-0 overflow-y-auto px-4 py-3\"><!></div>"), Rl = /* @__PURE__ */ G("<div class=\"fixed inset-0 z-40 grid place-items-center bg-ink-950/40 p-4\"><div class=\"card flex h-[85vh] w-full max-w-6xl flex-col\"><div class=\"flex items-center justify-between border-b border-ink-200 px-5 py-3\"><h2 class=\"text-sm font-semibold text-ink-900\"> </h2> <div class=\"flex items-center gap-2\"><button type=\"button\" class=\"btn btn-ghost btn-xs inline-flex items-center gap-1.5\"><svg class=\"size-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z\"></path><circle cx=\"12\" cy=\"12\" r=\"3\"></circle></svg> </button> <button class=\"btn btn-ghost btn-xs\"> </button></div></div> <div class=\"flex flex-wrap items-center gap-1 border-b border-ink-200 px-3 py-1.5\"><button type=\"button\" class=\"btn btn-ghost btn-xs\">H1</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H2</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H3</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H4</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H5</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H6</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs font-bold\">B</button> <button type=\"button\" class=\"btn btn-ghost btn-xs italic\">I</button> <button type=\"button\" class=\"btn btn-ghost btn-xs underline\">U</button> <button type=\"button\" class=\"btn btn-ghost btn-xs line-through\">S</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs\">•</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">1.</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">☐</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs\">⊞</button></div> <div><textarea class=\"terminal-input caret-[#39ff14] min-h-0 resize-none bg-black px-4 py-3 text-sm text-[#39ff14] outline-none placeholder:text-[#1f8f0c] svelte-1uva96y\"></textarea> <!></div> <div class=\"flex justify-end gap-2 border-t border-ink-200 px-5 py-3\"><button type=\"button\" class=\"btn btn-secondary\"> </button> <button type=\"button\" class=\"btn btn-primary\"> </button></div></div></div>"), zl = {
	hash: "svelte-1uva96y",
	code: "\n	/* Same terminal look as SqlEditorModal/the script editor's code field,\n	   duplicated here since Svelte styles are scoped per-component -- applies\n	   only to the editing textarea, never the preview pane next to it. */.terminal-input.svelte-1uva96y {caret-shape:underscore;font-family:var(--font-terminal);}"
};
function Bl(e, t) {
	He(t, !0), Zr(e, zl);
	let n = X(t, "title", 7), r = X(t, "value", 7), i = X(t, "onSave", 7), a = X(t, "onCancel", 7), o = /* @__PURE__ */ I(Qt(dr(() => r()))), s = /* @__PURE__ */ I(!1), c = /* @__PURE__ */ I(!1), l = /* @__PURE__ */ N(() => Wc(U(o))), u = /* @__PURE__ */ I(void 0);
	async function d() {
		if (!U(s)) {
			L(s, !0);
			try {
				await i()(U(o));
			} finally {
				L(s, !1);
			}
		}
	}
	function f(e, t, n) {
		let r = U(u);
		if (!r) return;
		let i = r.selectionStart, a = r.selectionEnd, s = U(o).slice(i, a) || n;
		L(o, U(o).slice(0, i) + e + s + t + U(o).slice(a));
		let c = i + e.length, l = c + s.length;
		requestAnimationFrame(() => {
			r.focus(), r.setSelectionRange(c, l);
		});
	}
	function p(e) {
		let t = U(u);
		if (!t) return;
		let n = t.selectionStart, r = t.selectionEnd, i = U(o).lastIndexOf("\n", n - 1) + 1, a = U(o).indexOf("\n", r);
		a === -1 && (a = U(o).length);
		let s = U(o).slice(i, a), c = s.split("\n").map((t) => t.startsWith(e) ? t.slice(e.length) : e + t).join("\n");
		L(o, U(o).slice(0, i) + c + U(o).slice(a));
		let l = c.length - s.length;
		requestAnimationFrame(() => {
			t.focus(), t.setSelectionRange(i, a + l);
		});
	}
	function m() {
		let e = U(u);
		if (!e) return;
		let t = e.selectionStart, n = e.selectionEnd, r = U(o).lastIndexOf("\n", t - 1) + 1, i = U(o).indexOf("\n", n);
		i === -1 && (i = U(o).length);
		let a = U(o).slice(r, i), s = a.split("\n").map((e) => e.startsWith("- [ ] ") ? "- [x] " + e.slice(6) : e.startsWith("- [x] ") ? e.slice(6) : "- [ ] " + e).join("\n");
		L(o, U(o).slice(0, r) + s + U(o).slice(i));
		let c = s.length - a.length;
		requestAnimationFrame(() => {
			e.focus(), e.setSelectionRange(r, i + c);
		});
	}
	function h() {
		let e = U(u);
		if (!e) return;
		let t = e.selectionStart;
		L(o, U(o).slice(0, t) + "\n| Spalte 1 | Spalte 2 |\n| --- | --- |\n| Wert | Wert |\n" + U(o).slice(t));
		let n = t + 55;
		requestAnimationFrame(() => {
			e.focus(), e.setSelectionRange(n, n);
		});
	}
	var g = {
		get title() {
			return n();
		},
		set title(e) {
			n(e), F();
		},
		get value() {
			return r();
		},
		set value(e) {
			r(e), F();
		},
		get onSave() {
			return i();
		},
		set onSave(e) {
			i(e), F();
		},
		get onCancel() {
			return a();
		},
		set onCancel(e) {
			a(e), F();
		}
	}, _ = Rl(), v = R(_), y = R(v), b = R(y), x = R(b);
	M(b);
	var S = z(b, 2), C = R(S), ee = z(R(C));
	M(C);
	var w = z(C, 2), te = R(w, !0);
	M(w), M(S), M(y);
	var ne = z(y, 2), T = R(ne), re = z(T, 2), ie = z(re, 2), E = z(ie, 2), ae = z(E, 2), oe = z(ae, 2), se = z(oe, 4), ce = z(se, 2), le = z(ce, 2), D = z(le, 2), ue = z(D, 4), de = z(ue, 2), fe = z(de, 2), pe = z(fe, 4);
	M(ne);
	var me = z(ne, 2), he = R(me);
	it(he), wi(he, (e) => L(u, e), () => U(u));
	var ge = z(he, 2), _e = (e) => {
		var t = Ll(), n = R(t), r = (e) => {
			var t = Fl(), n = R(t, !0);
			M(t), B((e) => q(n, e), [() => Z("markdownEdit.previewPlaceholder")]), K(e, t);
		}, i = /* @__PURE__ */ N(() => U(o).trim() === ""), a = (e) => {
			var t = Il();
			Xr(t, () => U(l), !0), M(t), K(e, t);
		};
		J(n, (e) => {
			U(i) ? e(r) : e(a, -1);
		}), M(t), Qr(t, (e) => Ia?.(e)), K(e, t);
	};
	J(ge, (e) => {
		U(c) && e(_e);
	}), M(me);
	var ve = z(me, 2), O = R(ve), ye = R(O, !0);
	M(O);
	var k = z(O, 2), be = R(k, !0);
	return M(k), M(ve), M(v), M(_), B((e, t, r, i, a, o, l, u, d, f, p, m, h, g, _, v, y, b, S, C) => {
		q(x, `${e ?? ""} · ${n() ?? ""}`), q(ee, ` ${t ?? ""}`), q(te, r), Y(T, "title", i), Y(re, "title", a), Y(ie, "title", o), Y(E, "title", l), Y(ae, "title", u), Y(oe, "title", d), Y(se, "title", f), Y(ce, "title", p), Y(le, "title", m), Y(D, "title", h), Y(ue, "title", g), Y(de, "title", _), Y(fe, "title", v), Y(pe, "title", y), si(me, 1, `grid min-h-0 flex-1 ${U(c) ? "grid-cols-2 divide-x divide-ink-200" : "grid-cols-1"}`), Y(he, "placeholder", b), q(ye, S), k.disabled = U(s), q(be, C);
	}, [
		() => Z("markdownEdit.titlePrefix"),
		() => U(c) ? Z("markdownEdit.hidePreview") : Z("markdownEdit.showPreview"),
		() => Z("common.close"),
		() => Z("markdownEdit.toolbar.h1"),
		() => Z("markdownEdit.toolbar.h2"),
		() => Z("markdownEdit.toolbar.h3"),
		() => Z("markdownEdit.toolbar.h4"),
		() => Z("markdownEdit.toolbar.h5"),
		() => Z("markdownEdit.toolbar.h6"),
		() => Z("markdownEdit.toolbar.bold"),
		() => Z("markdownEdit.toolbar.italic"),
		() => Z("markdownEdit.toolbar.underline"),
		() => Z("markdownEdit.toolbar.strikethrough"),
		() => Z("markdownEdit.toolbar.ul"),
		() => Z("markdownEdit.toolbar.ol"),
		() => Z("markdownEdit.toolbar.checklist"),
		() => Z("markdownEdit.toolbar.table"),
		() => Z("markdownEdit.placeholder"),
		() => Z("common.cancel"),
		() => U(s) ? Z("common.saving") : Z("common.save")
	]), W("click", C, () => L(c, !U(c))), W("click", w, function(...e) {
		a()?.apply(this, e);
	}), W("click", T, () => p("# ")), W("click", re, () => p("## ")), W("click", ie, () => p("### ")), W("click", E, () => p("#### ")), W("click", ae, () => p("##### ")), W("click", oe, () => p("###### ")), W("click", se, () => f("**", "**", Z("markdownEdit.toolbar.bold"))), W("click", ce, () => f("_", "_", Z("markdownEdit.toolbar.italic"))), W("click", le, () => f("<u>", "</u>", Z("markdownEdit.toolbar.underline"))), W("click", D, () => f("~~", "~~", Z("markdownEdit.toolbar.strikethrough"))), W("click", ue, () => p("- ")), W("click", de, () => p("1. ")), W("click", fe, m), W("click", pe, h), bi(he, () => U(o), (e) => L(o, e)), W("click", O, function(...e) {
		a()?.apply(this, e);
	}), W("click", k, d), K(e, _), Ue(g);
}
yr(["click"]), Ai(Bl, {
	title: {},
	value: {},
	onSave: {},
	onCancel: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/i18n/errors.ts
var Vl = {
	de: ta.errors,
	en: na.errors
};
function Hl(e) {
	return e instanceof ji ? ((Vl[ea.current] ?? Vl.de)[e.code] ?? Vl.de[e.code]) || e.message : e instanceof Error ? e.message : String(e);
}
//#endregion
//#region src/lib/components/RecordFormModal.svelte
var Ul = /* @__PURE__ */ G("<p class=\"text-xs text-ink-400\"> </p>"), Wl = /* @__PURE__ */ G("<p class=\"py-8 text-center text-sm text-ink-400\"> </p>"), Gl = /* @__PURE__ */ G("<p class=\"alert alert-danger\" role=\"alert\"> </p>"), Kl = /* @__PURE__ */ G("<span class=\"badge bg-ink-100 text-[10px] text-ink-500\"> </span>"), ql = /* @__PURE__ */ G("<span class=\"badge inline-flex shrink-0 items-center gap-1 bg-ink-100 text-ink-700\"><button type=\"button\" class=\"hover:underline\"> </button> <button type=\"button\" class=\"rounded-full text-ink-400 hover:text-red-600\">×</button></span>"), Jl = /* @__PURE__ */ G("<div class=\"flex flex-wrap items-center gap-1 rounded-md border border-ink-300 bg-surface px-2 py-1.5\"><!> <!></div>"), Yl = /* @__PURE__ */ G("<div class=\"rounded-md border border-ink-300 bg-surface px-2 py-1.5\"><!></div>"), Xl = /* @__PURE__ */ G("<a class=\"btn btn-primary btn-xs\"> </a>"), Zl = /* @__PURE__ */ G("<p class=\"input bg-ink-50 text-ink-500\">–</p>"), Ql = /* @__PURE__ */ G("<p class=\"input bg-ink-50 text-ink-500\"> </p>"), $l = /* @__PURE__ */ G("<input type=\"checkbox\" class=\"size-4 accent-brand-600\"/>"), eu = /* @__PURE__ */ G("<button type=\"button\" class=\"input flex items-center justify-between gap-2 text-left\"><span class=\"truncate\"> </span> <span class=\"shrink-0 text-xs text-brand-600\">✎</span></button>"), tu = /* @__PURE__ */ G("<a class=\"btn btn-secondary btn-xs shrink-0\"> </a>"), nu = /* @__PURE__ */ G("<div class=\"flex items-center gap-2\"><input class=\"input flex-1\"/> <!></div>"), ru = /* @__PURE__ */ G("<button type=\"button\" class=\"btn btn-secondary btn-xs shrink-0\"> </button>"), iu = /* @__PURE__ */ G("<div class=\"flex items-center gap-2\"><!> <!></div>"), au = /* @__PURE__ */ G("<div class=\"flex items-center gap-2\"><input type=\"color\" class=\"size-8 shrink-0 cursor-pointer rounded border border-ink-200 bg-transparent p-0\"/> <input class=\"input flex-1\" placeholder=\"#rrggbb\"/></div>"), ou = /* @__PURE__ */ G("<input class=\"input\"/>"), su = /* @__PURE__ */ G("<label class=\"field\"><span class=\"flex items-center gap-2\"> <span class=\"font-normal text-ink-400\"> </span> <!></span> <!></label>"), cu = /* @__PURE__ */ G("<div class=\"space-y-3\"></div>"), lu = /* @__PURE__ */ G("<div class=\"flex justify-end gap-2 border-t border-ink-200 px-5 py-3\"><button type=\"button\" class=\"btn btn-secondary\"> </button> <button type=\"button\" class=\"btn btn-primary\"> </button></div>"), uu = /* @__PURE__ */ G("<div class=\"fixed inset-0 grid place-items-center bg-ink-950/40 p-4\"><div class=\"card flex max-h-[85vh] w-full max-w-xl flex-col\"><div class=\"flex items-center justify-between border-b border-ink-200 px-5 py-3\"><div><h2 class=\"text-sm font-semibold text-ink-900\"> </h2> <!></div> <button class=\"btn btn-ghost btn-xs\"> </button></div> <div class=\"overlay-scroll min-h-0 flex-1 overflow-y-auto px-5 py-4\"><!></div> <!></div></div> <!> <!>", 1);
function du(e, t) {
	He(t, !0);
	let n = X(t, "tableId", 7), r = X(t, "pk", 7), i = X(t, "depth", 7, 0), a = X(t, "onClose", 7), o = X(t, "onSaved", 7), s = /* @__PURE__ */ I(null), c = /* @__PURE__ */ I(null), l = /* @__PURE__ */ I(!0), u = /* @__PURE__ */ I(null), d = /* @__PURE__ */ I(!1), f = /* @__PURE__ */ I(Qt({})), p = /* @__PURE__ */ I(Qt({})), m = /* @__PURE__ */ N(() => U(s)?.columns.find((e) => e.is_primary_key) ?? null), h = /* @__PURE__ */ N(() => U(s)?.columns.filter((e) => e.id !== U(m)?.id) ?? []);
	async function g() {
		L(l, !0), L(u, null);
		try {
			let e = await Yc(n());
			L(s, e, !0);
			let t = e.columns.find((e) => e.is_primary_key);
			if (!t) {
				L(u, Z("recordForm.noPrimaryKey"), !0);
				return;
			}
			let i = (await Ui(n(), { where: {
				col: t.effective_name,
				op: "eq",
				val: r()
			} })).records[0];
			if (!i) {
				L(u, Z("recordForm.notFound"), !0);
				return;
			}
			L(c, i, !0), _(e.columns, i);
		} catch (e) {
			L(u, Hl(e), !0);
		} finally {
			L(l, !1);
		}
	}
	function _(e, t) {
		let n = {}, r = {};
		for (let i of e) i.is_primary_key || i.field_kind !== "physical" || (i.ui_type === "boolean" ? r[i.effective_name] = ga(t[i.effective_name]) : n[i.effective_name] = ja(t[i.effective_name], i));
		L(f, n, !0), L(p, r, !0);
	}
	vn(() => {
		g();
	});
	function v() {
		if (!U(c)) return {};
		let e = {};
		for (let t of U(h)) if (t.field_kind === "physical") {
			if (t.ui_type === "boolean") U(p)[t.effective_name] !== ga(U(c)[t.effective_name]) && (e[t.effective_name] = U(p)[t.effective_name]);
			else {
				let n = ja(U(c)[t.effective_name], t);
				U(f)[t.effective_name] !== n && (e[t.effective_name] = U(f)[t.effective_name]);
			}
		}
		return e;
	}
	async function y() {
		if (U(d)) return;
		let e = v();
		if (Object.keys(e).length === 0) {
			a()();
			return;
		}
		L(d, !0), L(u, null);
		try {
			await Wi(n(), r(), e), o()?.(), a()();
		} catch (e) {
			L(u, Hl(e), !0);
		} finally {
			L(d, !1);
		}
	}
	async function b(e, t) {
		try {
			await Gi(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			L(u, Hl(e), !0);
		}
	}
	async function x(e, t) {
		try {
			await Ki(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			L(u, Hl(e), !0);
		}
	}
	async function S(e, t) {
		try {
			await $c(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			L(u, Hl(e), !0);
		}
	}
	async function C(e, t) {
		try {
			await el(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			L(u, Hl(e), !0);
		}
	}
	let ee = /* @__PURE__ */ I(null);
	function w(e, t) {
		!e || t == null || L(ee, {
			tableId: e,
			pk: t
		}, !0);
	}
	let te = /* @__PURE__ */ I(null);
	var ne = {
		get tableId() {
			return n();
		},
		set tableId(e) {
			n(e), F();
		},
		get pk() {
			return r();
		},
		set pk(e) {
			r(e), F();
		},
		get depth() {
			return i();
		},
		set depth(e = 0) {
			i(e), F();
		},
		get onClose() {
			return a();
		},
		set onClose(e) {
			a(e), F();
		},
		get onSaved() {
			return o();
		},
		set onSaved(e) {
			o(e), F();
		}
	}, T = uu(), re = cn(T), ie = R(re), E = R(ie), ae = R(E), oe = R(ae), se = R(oe, !0);
	M(oe);
	var ce = z(oe, 2), le = (e) => {
		var t = Ul(), n = R(t);
		M(t), B((e) => q(n, `${U(m).effective_name ?? ""}: ${e ?? ""}`), [() => la(r())]), K(e, t);
	};
	J(ce, (e) => {
		U(m) && e(le);
	}), M(ae);
	var D = z(ae, 2), ue = R(D, !0);
	M(D), M(E);
	var de = z(E, 2), fe = R(de), pe = (e) => {
		var t = Wl(), n = R(t, !0);
		M(t), B((e) => q(n, e), [() => Z("nav.loading")]), K(e, t);
	}, me = (e) => {
		var t = Gl(), n = R(t, !0);
		M(t), B(() => q(n, U(u))), K(e, t);
	}, he = (e) => {
		var t = cu();
		Wr(t, 21, () => U(h), (e) => e.id, (e, t) => {
			var i = su(), a = R(i), o = R(a), s = z(o), l = R(s, !0);
			M(s);
			var u = z(s, 2), d = (e) => {
				var n = Kl(), r = R(n, !0);
				M(n), B((e) => q(r, e), [() => Oa(U(t))]), K(e, n);
			}, m = /* @__PURE__ */ N(() => Oa(U(t)));
			J(u, (e) => {
				U(m) && e(d);
			}), M(a);
			var h = z(a, 2), g = (e) => {
				var n = Jl(), r = R(n);
				Wr(r, 17, () => ka(U(c)[U(t).effective_name]), (e) => e.id, (e, n) => {
					var r = ql(), i = R(r), a = R(i, !0);
					M(i);
					var o = z(i, 2);
					M(r), B((e, t) => {
						q(a, e), Y(o, "aria-label", t);
					}, [() => la(U(n).label), () => Z("recordForm.removeLink", { label: la(U(n).label) })]), W("click", i, () => w(U(t).links_target_table_id, U(n).id)), W("click", o, () => x(U(t), U(n).id)), K(e, r);
				});
				var i = z(r, 2), a = (e) => {
					{
						let n = /* @__PURE__ */ N(() => ka(U(c)[U(t).effective_name]).map((e) => e.id));
						Pl(e, {
							get targetTableId() {
								return U(t).links_target_table_id;
							},
							get excludeIds() {
								return U(n);
							},
							onSelect: (e) => b(U(t), e)
						});
					}
				};
				J(i, (e) => {
					U(t).links_target_table_id && e(a);
				}), M(n), K(e, n);
			}, _ = (e) => {
				var i = Yl(), a = R(i);
				{
					let e = /* @__PURE__ */ N(() => U(c)[U(t).effective_name] ?? []);
					sl(a, {
						get files() {
							return U(e);
						},
						get tableId() {
							return n();
						},
						get pk() {
							return r();
						},
						get columnId() {
							return U(t).id;
						},
						onUpload: (e) => S(U(t), e),
						onDelete: (e) => C(U(t), e)
					});
				}
				M(i), K(e, i);
			}, v = (e) => {
				var n = kr(), r = cn(n), i = (e) => {
					var n = Xl(), r = R(n, !0);
					M(n), B((e, i) => {
						Y(n, "href", e), Y(n, "target", U(t).format_config.target ?? "_blank"), Y(n, "rel", (U(t).format_config.target ?? "_blank") === "_blank" ? "noopener noreferrer" : void 0), q(r, i);
					}, [() => ha(U(t), U(c)[U(t).effective_name]), () => U(t).format_config.label ?? Z("recordForm.open")]), K(e, n);
				}, a = (e) => {
					K(e, Zl());
				};
				J(r, (e) => {
					U(c)[U(t).effective_name] !== null && U(c)[U(t).effective_name] !== void 0 ? e(i) : e(a, -1);
				}), K(e, n);
			}, y = (e) => {
				var n = Ql(), r = R(n, !0);
				M(n), B((e) => q(r, e), [() => fa(U(c), U(t)) ?? Da(U(c)[U(t).effective_name], U(t))]), K(e, n);
			}, ee = (e) => {
				var n = $l();
				mi(n), B(() => gi(n, U(p)[U(t).effective_name])), W("change", n, (e) => U(p)[U(t).effective_name] = e.currentTarget.checked), K(e, n);
			}, ne = (e) => {
				{
					let n = /* @__PURE__ */ N(() => U(t).format_config.colors ?? {});
					wl(e, {
						get colors() {
							return U(n);
						},
						get order() {
							return U(t).format_config.order;
						},
						class: "input",
						get value() {
							return U(f)[U(t).effective_name];
						},
						set value(e) {
							U(f)[U(t).effective_name] = e;
						}
					});
				}
			}, T = (e) => {
				var n = eu(), r = R(n), i = R(r, !0);
				M(r), Pe(2), M(n), B((e) => q(i, e), [() => U(f)[U(t).effective_name]?.trim() || Z("recordForm.editMarkdown")]), W("click", n, () => L(te, U(t), !0)), K(e, n);
			}, re = (e) => {
				var n = nu(), r = R(n);
				mi(r);
				var i = z(r, 2), a = (e) => {
					var n = tu(), r = R(n, !0);
					M(n), B((e, i) => {
						Y(n, "href", e), Y(n, "target", U(t).format_config.target ?? "_blank"), Y(n, "rel", (U(t).format_config.target ?? "_blank") === "_blank" ? "noopener noreferrer" : void 0), q(r, i);
					}, [() => ha(U(t), U(c)[U(t).effective_name]), () => Z("recordForm.open")]), K(e, n);
				};
				J(i, (e) => {
					U(c)[U(t).effective_name] !== null && U(c)[U(t).effective_name] !== void 0 && e(a);
				}), M(n), bi(r, () => U(f)[U(t).effective_name], (e) => U(f)[U(t).effective_name] = e), K(e, n);
			}, ie = (e) => {
				var n = iu(), r = R(n);
				{
					let e = /* @__PURE__ */ N(() => fa(U(c), U(t)) ?? la(U(c)[U(t).effective_name]));
					yl(r, {
						get fkTargetTableId() {
							return U(t).fk_target_table_id;
						},
						get fkTargetColumn() {
							return U(t).fk_target_column;
						},
						get uiType() {
							return U(t).ui_type;
						},
						get nullable() {
							return U(t).is_nullable;
						},
						get currentLabel() {
							return U(e);
						},
						class: "input flex-1",
						get value() {
							return U(f)[U(t).effective_name];
						},
						set value(e) {
							U(f)[U(t).effective_name] = e;
						}
					});
				}
				var i = z(r, 2), a = (e) => {
					var n = ru(), r = R(n, !0);
					M(n), B((e) => q(r, e), [() => Z("recordForm.open")]), W("click", n, () => w(U(t).fk_target_table_id, U(c)?.[U(t).effective_name])), K(e, n);
				};
				J(i, (e) => {
					U(c)[U(t).effective_name] !== null && U(c)[U(t).effective_name] !== void 0 && e(a);
				}), M(n), K(e, n);
			}, E = (e) => {
				var n = au(), r = R(n);
				mi(r);
				var i = z(r, 2);
				mi(i), M(n), B((e) => hi(r, e), [() => Na(U(f)[U(t).effective_name]) ? U(f)[U(t).effective_name] : "#000000"]), W("change", r, (e) => U(f)[U(t).effective_name] = e.currentTarget.value), bi(i, () => U(f)[U(t).effective_name], (e) => U(f)[U(t).effective_name] = e), K(e, n);
			}, ae = (e) => {
				var n = ou();
				mi(n), B((e, t) => {
					Y(n, "type", e), Y(n, "step", t);
				}, [() => Jc(U(t).ui_type).type, () => Jc(U(t).ui_type).step]), bi(n, () => U(f)[U(t).effective_name], (e) => U(f)[U(t).effective_name] = e), K(e, n);
			};
			J(h, (e) => {
				U(t).field_kind === "links" ? e(g) : U(t).field_kind === "attachment" ? e(_, 1) : U(t).display_format === "button" ? e(v, 2) : U(t).field_kind === "physical" ? U(t).ui_type === "boolean" ? e(ee, 4) : U(t).display_format === "label" ? e(ne, 5) : U(t).display_format === "markdown" ? e(T, 6) : U(t).display_format === "email" || U(t).display_format === "phone" || U(t).display_format === "url" ? e(re, 7) : U(t).is_foreign_key && U(t).fk_target_table_id && U(t).fk_target_column ? e(ie, 8) : U(t).display_format === "color" ? e(E, 9) : e(ae, -1) : e(y, 3);
			}), M(i), B(() => {
				q(o, `${U(t).effective_name ?? ""} `), q(l, U(t).ui_type);
			}), K(e, i);
		}), M(t), K(e, t);
	};
	J(fe, (e) => {
		U(l) ? e(pe) : U(u) ? e(me, 1) : U(c) && e(he, 2);
	}), M(de), Qr(de, (e) => Ia?.(e));
	var ge = z(de, 2), _e = (e) => {
		var t = lu(), n = R(t), r = R(n, !0);
		M(n);
		var i = z(n, 2), o = R(i, !0);
		M(i), M(t), B((e, t) => {
			q(r, e), i.disabled = U(d), q(o, t);
		}, [() => Z("common.cancel"), () => U(d) ? Z("common.saving") : Z("common.save")]), W("click", n, function(...e) {
			a()?.apply(this, e);
		}), W("click", i, y), K(e, t);
	};
	J(ge, (e) => {
		!U(l) && !U(u) && e(_e);
	}), M(ie), M(re);
	var ve = z(re, 2), O = (e) => {
		{
			let t = /* @__PURE__ */ N(() => U(f)[U(te).effective_name] ?? "");
			Bl(e, {
				get title() {
					return U(te).effective_name;
				},
				get value() {
					return U(t);
				},
				onSave: (e) => {
					U(te) && (U(f)[U(te).effective_name] = e), L(te, null);
				},
				onCancel: () => L(te, null)
			});
		}
	};
	J(ve, (e) => {
		U(te) && e(O);
	});
	var ye = z(ve, 2), k = (e) => {
		{
			let t = /* @__PURE__ */ N(() => i() + 1);
			du(e, {
				get tableId() {
					return U(ee).tableId;
				},
				get pk() {
					return U(ee).pk;
				},
				get depth() {
					return U(t);
				},
				onClose: () => L(ee, null),
				onSaved: () => {
					g(), o()?.();
				}
			});
		}
	};
	return J(ye, (e) => {
		U(ee) && e(k);
	}), B((e, t) => {
		li(re, `z-index: ${40 + i() * 10}`), q(se, e), q(ue, t);
	}, [() => U(s) ? `${U(s).schema_name}.${U(s).table_name}` : Z("recordForm.record"), () => Z("common.close")]), W("click", D, function(...e) {
		a()?.apply(this, e);
	}), K(e, T), Ue(ne);
}
yr(["click", "change"]), Ai(du, {
	tableId: {},
	pk: {},
	depth: {},
	onClose: {},
	onSaved: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/viewmodules/kanban/KanbanView.svelte
var fu = /* @__PURE__ */ G("<div class=\"mt-1\"><!></div>"), pu = /* @__PURE__ */ G("<button type=\"button\" class=\"mt-0.5 text-xs text-brand-600 hover:underline\"> </button>"), mu = /* @__PURE__ */ G("<div class=\"markdown-body mt-1 text-xs text-ink-600\"></div> <!>", 1), hu = /* @__PURE__ */ G("<div class=\"mt-0.5 truncate text-xs text-ink-500\"> </div>"), gu = /* @__PURE__ */ G("<button type=\"button\" class=\"btn btn-danger btn-xs absolute top-1.5 right-1.5 opacity-0 transition-opacity group-hover:opacity-100\"> </button>"), _u = /* @__PURE__ */ G("<div><div role=\"button\" tabindex=\"0\" class=\"w-full cursor-pointer rounded-md border border-ink-200 bg-surface p-2.5 text-left shadow-sm transition-colors hover:border-ink-300\"><div class=\"text-base font-semibold text-ink-900\"> </div> <!> <!> <!></div> <!></div>"), vu = /* @__PURE__ */ G("<p class=\"px-4 py-10 text-center text-sm text-ink-500\"> </p>"), yu = /* @__PURE__ */ G("<button type=\"button\" class=\"btn btn-ghost btn-xs w-full\"> </button>"), bu = /* @__PURE__ */ G("<div><div class=\"flex items-center justify-between px-3 py-2\"><span class=\"min-w-0 truncate text-sm font-semibold text-ink-900\"><!></span> <span class=\"shrink-0 text-xs text-ink-400\"> </span></div> <div class=\"overlay-scroll flex flex-col gap-2 overflow-y-auto px-2 pb-2\"><!> <!></div></div>"), xu = /* @__PURE__ */ G("<div class=\"overlay-scroll flex h-full flex-1 gap-3 overflow-x-auto p-4\"></div>"), Su = /* @__PURE__ */ G("<div class=\"flex h-full flex-col bg-ink-50\"><!></div> <!>", 1);
function Cu(e, t) {
	He(t, !0);
	let n = (e, t = _) => {
		let n = /* @__PURE__ */ N(() => U(m) ? t()[U(m).effective_name] : void 0), r = /* @__PURE__ */ N(() => String(U(n))), i = /* @__PURE__ */ N(() => U(le) && U(v) && U(oe) === String(U(n)));
		var a = _u(), o = R(a), c = R(o), l = R(c, !0);
		M(c);
		var u = z(c, 2), f = (e) => {
			let n = /* @__PURE__ */ N(() => la(t()[U(x).effective_name]));
			var r = kr(), i = cn(r), a = (e) => {
				var t = fu(), r = R(t);
				{
					let e = /* @__PURE__ */ N(() => U(x).format_config.colors?.[U(n)]);
					qc(r, {
						get text() {
							return U(n);
						},
						get color() {
							return U(e);
						}
					});
				}
				M(t), K(e, t);
			};
			J(i, (e) => {
				U(n) && e(a);
			}), K(e, r);
		};
		J(u, (e) => {
			U(x) && e(f);
		});
		var p = z(u, 2), h = (e) => {
			let n = /* @__PURE__ */ N(() => Aa(t(), U(b)) ?? ""), i = /* @__PURE__ */ N(() => U(n).split("\n")), a = /* @__PURE__ */ N(() => U(i).length > he), o = /* @__PURE__ */ N(() => !!U(ge)[U(r)]), s = /* @__PURE__ */ N(() => U(a) && !U(o) ? U(i).slice(0, he).join("\n") : U(n));
			var c = mu(), l = cn(c);
			Xr(l, () => Wc(U(s)), !0), M(l);
			var u = z(l, 2), d = (e) => {
				var t = pu(), n = R(t, !0);
				M(t), B((e) => q(n, e), [() => U(o) ? Z("tablePage.kanbanDescriptionShowLess") : Z("tablePage.kanbanDescriptionShowMore")]), W("click", t, (e) => _e(e, U(r))), K(e, t);
			};
			J(u, (e) => {
				U(a) && e(d);
			}), K(e, c);
		};
		J(p, (e) => {
			U(b) && e(h);
		}), Wr(z(p, 2), 17, () => U(S), (e) => e.id, (e, n) => {
			var r = hu(), i = R(r);
			M(r), B((e) => q(i, `${U(n).display_name ?? U(n).effective_name ?? ""}: ${e ?? ""}`), [() => Aa(t(), U(n))]), K(e, r);
		}), M(o);
		var C = z(o, 2), ee = (e) => {
			var n = gu(), r = R(n, !0);
			M(n), B((e) => q(r, e), [() => Z("common.delete")]), W("click", n, (e) => {
				e.stopPropagation(), d()?.(t());
			}), K(e, n);
		};
		J(C, (e) => {
			s() && e(ee);
		}), M(a), B((e) => {
			si(a, 1, `group relative ${U(le) && U(E) === U(n) ? "opacity-40" : ""}
			${U(i) && !U(se) ? "border-t-2 border-brand-500" : ""}
			${U(i) && U(se) ? "border-b-2 border-brand-500" : ""}`), Y(a, "data-card-key", U(n)), q(l, e);
		}, [() => U(y) ? Aa(t(), U(y)) : U(g) ? Aa(t(), U(g)) : U(m) ? la(t()[U(m).effective_name]) : ""]), W("pointerdown", o, (e) => D(e, t())), W("click", o, () => {
			U(le) || me(t());
		}), W("keydown", o, (e) => {
			(e.key === "Enter" || e.key === " ") && (e.preventDefault(), me(t()));
		}), K(e, a);
	}, r = X(t, "rows", 7), i = X(t, "groupCounts", 7), a = X(t, "table", 7), o = X(t, "moduleConfig", 7), s = X(t, "editable", 7), c = X(t, "viewId", 7), l = X(t, "where", 7), u = X(t, "onMoveCard", 7), d = X(t, "onDeleteRow", 7), f = X(t, "onRecordSaved", 7), p = "\0__kanban_no_status__", m = /* @__PURE__ */ N(() => {
		let e = a().columns.filter((e) => e.is_primary_key);
		return e.length === 1 ? e[0] : null;
	}), h = /* @__PURE__ */ N(() => a().columns.find((e) => e.id === o().swimlane_column_id) ?? null), g = /* @__PURE__ */ N(() => a().columns.find((e) => e.is_display_column) ?? null), v = /* @__PURE__ */ N(() => a().columns.find((e) => e.id === o().order_column_id) ?? null), y = /* @__PURE__ */ N(() => a().columns.find((e) => e.id === o().title_column_id) ?? null), b = /* @__PURE__ */ N(() => a().columns.find((e) => e.id === o().description_column_id) ?? null), x = /* @__PURE__ */ N(() => a().columns.find((e) => e.id === o().label_column_id) ?? null), S = /* @__PURE__ */ N(() => a().columns.filter((e) => e.field_kind === "physical" && e.id !== U(h)?.id && e.id !== U(g)?.id && e.id !== U(v)?.id && e.id !== U(y)?.id && e.id !== U(b)?.id && e.id !== U(x)?.id).slice(0, 3));
	function C(e) {
		if (!e || !U(v)) return null;
		let t = e[U(v).effective_name];
		if (t == null || t === "") return null;
		let n = Number(t);
		return Number.isNaN(n) ? null : n;
	}
	function ee(e, t) {
		let n = C(e), r = C(t);
		return n !== null && r !== null ? (n + r) / 2 : n === null ? r === null ? 0 : r - 1 : n + 1;
	}
	function w(e) {
		return e == null || e === "" ? p : la(e);
	}
	function te(e) {
		return U(h) ? w(e[U(h).effective_name]) : p;
	}
	let ne = /* @__PURE__ */ I(Qt(/* @__PURE__ */ new Map())), T = /* @__PURE__ */ I(Qt(/* @__PURE__ */ new Set())), re = /* @__PURE__ */ N(() => {
		let e = /* @__PURE__ */ new Map();
		for (let t of i()) {
			let n = w(t.values[0]);
			e.set(n, (e.get(n) ?? 0) + t.count);
		}
		let t = /* @__PURE__ */ new Map();
		for (let e of r()) {
			let n = te(e), r = t.get(n);
			r ? r.push(e) : t.set(n, [e]);
		}
		let n = Pa(U(h)?.format_config.colors ?? {}, U(h)?.format_config.order);
		for (let t of e.keys()) t !== p && !n.includes(t) && n.push(t);
		for (let e of t.keys()) e !== p && !n.includes(e) && n.push(e);
		return (e.has(p) || t.has(p)) && n.push(p), n.map((n) => {
			let r = [...t.get(n) ?? [], ...U(ne).get(n) ?? []];
			return U(v) && r.sort((e, t) => {
				let n = C(e), r = C(t);
				return n === null && r === null ? 0 : n === null ? 1 : r === null ? -1 : n - r;
			}), {
				key: n,
				label: n === p ? null : n,
				rows: r,
				exactCount: e.get(n) ?? t.get(n)?.length ?? 0
			};
		});
	});
	async function ie(e) {
		if (!(!U(h) || U(T).has(e.key))) {
			L(T, new Set(U(T)).add(e.key), !0);
			try {
				let t = e.key === p ? {
					col: U(h).effective_name,
					op: "is_null"
				} : {
					col: U(h).effective_name,
					op: "eq",
					val: e.key
				}, n = await Ui(a().id, {
					view: c(),
					where: Ri(l(), t),
					offset: e.rows.length,
					limit: 100
				}), r = new Map(U(ne));
				r.set(e.key, [...r.get(e.key) ?? [], ...n.records]), L(ne, r, !0);
			} finally {
				let t = new Set(U(T));
				t.delete(e.key), L(T, t, !0);
			}
		}
	}
	let E = /* @__PURE__ */ I(null), ae = /* @__PURE__ */ I(null), oe = /* @__PURE__ */ I(null), se = /* @__PURE__ */ I(!1), ce = [0, 0], le = /* @__PURE__ */ I(!1);
	function D(e, t) {
		!s() || !U(m) || (L(E, t[U(m).effective_name], !0), ce = [e.clientX, e.clientY], L(le, !1), window.addEventListener("pointermove", ue), window.addEventListener("pointerup", de));
	}
	function ue(e) {
		if (U(E) === null) return;
		if (!U(le)) {
			let [t, n] = ce;
			if (Math.hypot(e.clientX - t, e.clientY - n) < 4) return;
			L(le, !0), document.body.style.cursor = "grabbing", document.body.style.userSelect = "none";
		}
		let t = document.elementFromPoint(e.clientX, e.clientY), n = t instanceof Element ? t.closest("[data-lane-key]") : null;
		if (L(ae, n?.getAttribute("data-lane-key") ?? null, !0), !U(v)) {
			L(oe, null);
			return;
		}
		let r = t instanceof Element ? t.closest("[data-card-key]") : null;
		if (!r) {
			L(oe, null);
			return;
		}
		L(oe, r.getAttribute("data-card-key"), !0);
		let i = r.getBoundingClientRect();
		L(se, e.clientY > i.top + i.height / 2);
	}
	function de() {
		if (window.removeEventListener("pointermove", ue), window.removeEventListener("pointerup", de), document.body.style.cursor = "", document.body.style.userSelect = "", U(le) && U(E) !== null && U(ae) !== null && U(m)) {
			let e = r().concat(...U(ne).values()).find((e) => e[U(m).effective_name] === U(E)), t = U(re).find((e) => e.key === U(ae)), n = U(ae) !== fe(U(E));
			if (e && t && (n || U(v))) {
				let n = U(ae) === p ? "" : U(ae), r = null;
				if (U(v)) {
					let e = t.rows.filter((e) => e[U(m).effective_name] !== U(E)), n = e.length;
					if (U(oe) !== null) {
						let t = e.findIndex((e) => String(e[U(m).effective_name]) === U(oe));
						t !== -1 && (n = U(se) ? t + 1 : t);
					}
					r = ee(e[n - 1], e[n]);
				}
				u()?.(e, n, r);
			}
		}
		L(E, null), L(ae, null), L(oe, null);
	}
	function fe(e) {
		if (!U(m)) return null;
		for (let t of U(re)) if (t.rows.some((t) => t[U(m).effective_name] === e)) return t.key;
		return null;
	}
	Br(de);
	let pe = /* @__PURE__ */ I(null);
	function me(e) {
		U(m) && L(pe, {
			tableId: a().id,
			pk: e[U(m).effective_name]
		}, !0);
	}
	let he = 5, ge = /* @__PURE__ */ I(Qt({}));
	function _e(e, t) {
		e.stopPropagation(), U(ge)[t] = !U(ge)[t];
	}
	var ve = {
		get rows() {
			return r();
		},
		set rows(e) {
			r(e), F();
		},
		get groupCounts() {
			return i();
		},
		set groupCounts(e) {
			i(e), F();
		},
		get table() {
			return a();
		},
		set table(e) {
			a(e), F();
		},
		get moduleConfig() {
			return o();
		},
		set moduleConfig(e) {
			o(e), F();
		},
		get editable() {
			return s();
		},
		set editable(e) {
			s(e), F();
		},
		get viewId() {
			return c();
		},
		set viewId(e) {
			c(e), F();
		},
		get where() {
			return l();
		},
		set where(e) {
			l(e), F();
		},
		get onMoveCard() {
			return u();
		},
		set onMoveCard(e) {
			u(e), F();
		},
		get onDeleteRow() {
			return d();
		},
		set onDeleteRow(e) {
			d(e), F();
		},
		get onRecordSaved() {
			return f();
		},
		set onRecordSaved(e) {
			f(e), F();
		}
	}, O = Su(), ye = cn(O), k = R(ye), be = (e) => {
		var t = vu(), n = R(t, !0);
		M(t), B((e) => q(n, e), [() => Z("dataGrid.noRows")]), K(e, t);
	}, xe = (e) => {
		var t = xu();
		Wr(t, 21, () => U(re), (e) => e.key, (e, t) => {
			var r = bu(), i = R(r), a = R(i), o = R(a), s = (e) => {
				var t = Or();
				B((e) => q(t, e), [() => Z("tablePage.kanbanNoStatus")]), K(e, t);
			}, c = (e) => {
				{
					let n = /* @__PURE__ */ N(() => U(h).format_config.colors?.[U(t).label]);
					qc(e, {
						get text() {
							return U(t).label;
						},
						get color() {
							return U(n);
						}
					});
				}
			};
			J(o, (e) => {
				U(t).label === null ? e(s) : e(c, -1);
			}), M(a);
			var l = z(a, 2), u = R(l, !0);
			M(l), M(i);
			var d = z(i, 2), f = R(d);
			Wr(f, 17, () => U(t).rows, (e) => U(m) ? e[U(m).effective_name] : void 0, (e, t) => {
				n(e, () => U(t));
			});
			var p = z(f, 2), g = (e) => {
				var n = yu(), r = R(n, !0);
				M(n), B((e, t) => {
					n.disabled = e, q(r, t);
				}, [() => U(T).has(U(t).key), () => Z("tablePage.kanbanShowMore", { n: U(t).exactCount - U(t).rows.length })]), W("click", n, () => ie(U(t))), K(e, n);
			};
			J(p, (e) => {
				U(t).rows.length < U(t).exactCount && e(g);
			}), M(d), Qr(d, (e) => Ia?.(e)), M(r), B(() => {
				si(r, 1, `flex w-72 shrink-0 flex-col rounded-lg bg-ink-100 transition-colors
						${U(le) && U(ae) === U(t).key ? "ring-2 ring-brand-400 ring-offset-1" : ""}`), Y(r, "data-lane-key", U(t).key), q(u, U(t).exactCount);
			}), K(e, r);
		}), M(t), Qr(t, (e) => Ia?.(e)), K(e, t);
	};
	J(k, (e) => {
		U(h) ? e(xe, -1) : e(be);
	}), M(ye);
	var Se = z(ye, 2), Ce = (e) => {
		du(e, {
			get tableId() {
				return U(pe).tableId;
			},
			get pk() {
				return U(pe).pk;
			},
			onClose: () => L(pe, null),
			onSaved: () => {
				L(pe, null), f()?.();
			}
		});
	};
	return J(Se, (e) => {
		U(pe) && e(Ce);
	}), K(e, O), Ue(ve);
}
yr([
	"pointerdown",
	"click",
	"keydown"
]), customElements.define("kanban-view", Ai(Cu, {
	rows: {},
	groupCounts: {},
	table: {},
	moduleConfig: {},
	editable: {},
	viewId: {},
	where: {},
	onMoveCard: {},
	onDeleteRow: {},
	onRecordSaved: {}
}, [], []));
//#endregion
export { Cu as default };
