//#region src/utils/validation.ts
function e(e) {
	return e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : !0;
}
function t(e) {
	return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
}
function n(e) {
	try {
		return new URL(e), !0;
	} catch {
		return !1;
	}
}
function r(e, t) {
	return e.length >= t;
}
function i(e, t) {
	return e.length <= t;
}
function a(e, t) {
	return t.test(e);
}
function o(e) {
	return (t) => {
		for (let n of e) if (!n.validate(t)) return {
			valid: !1,
			message: n.message
		};
		return { valid: !0 };
	};
}
//#endregion
//#region src/utils/errors.ts
var s = class extends Error {
	constructor(e) {
		super(e), this.name = "ComponentError";
	}
}, c = class extends s {
	constructor(e, t) {
		super(`[${e}] ${t}`), this.name = "ConfigError";
	}
}, l = class extends s {
	field;
	constructor(e, t) {
		super(`Validation failed for "${e}": ${t}`), this.name = "ValidationError", this.field = e;
	}
}, u = class extends s {
	status;
	statusText;
	constructor(e, t, n) {
		super(n ?? `HTTP ${String(e)}: ${t}`), this.name = "NetworkError", this.status = e, this.statusText = t;
	}
};
//#endregion
//#region src/utils/touch.ts
function d(e, t = {}) {
	let { threshold: n = 50, timeout: r = 300, onSwipe: i, onSwipeStart: a, onSwipeEnd: o, preventDefault: s = !1 } = t, c = !0, l = 0, u = 0, d = 0, f = (e) => {
		if (!c) return;
		let t = e.touches[0];
		t !== void 0 && (l = t.clientX, u = t.clientY, d = Date.now(), a?.(e));
	}, p = (e) => {
		if (!c || d === 0) return;
		let t = e.changedTouches[0];
		if (t === void 0) return;
		let a = t.clientX, f = t.clientY, p = Date.now(), m = a - l, h = f - u, g = p - d;
		if (d = 0, g > r) {
			o?.(e);
			return;
		}
		let _ = Math.abs(m), v = Math.abs(h);
		if (_ >= n || v >= n) {
			s && e.preventDefault();
			let t;
			t = _ > v ? m > 0 ? "right" : "left" : h > 0 ? "down" : "up", i?.(t, e);
		} else o?.(e);
	}, m = (e) => {
		if (!c || !s) return;
		let t = e.touches[0];
		if (t === void 0) return;
		let n = Math.abs(t.clientX - l), r = Math.abs(t.clientY - u);
		(n > 10 || r > 10) && e.preventDefault();
	};
	return e.addEventListener("touchstart", f, { passive: !0 }), e.addEventListener("touchend", p, { passive: !s }), s && e.addEventListener("touchmove", m, { passive: !1 }), {
		enable: () => {
			c = !0;
		},
		disable: () => {
			c = !1;
		},
		isEnabled: () => c,
		destroy: () => {
			e.removeEventListener("touchstart", f), e.removeEventListener("touchend", p), e.removeEventListener("touchmove", m);
		}
	};
}
function f(e, t) {
	let n = !1, r = (e) => {
		n = !0, t(e);
	}, i = (e) => {
		if (n) {
			n = !1;
			return;
		}
		t(e);
	};
	return e.addEventListener("touchstart", r, { passive: !0 }), e.addEventListener("click", i), () => {
		e.removeEventListener("touchstart", r), e.removeEventListener("click", i);
	};
}
function p(e, t) {
	if ("PointerEvent" in window) {
		let n = (e) => {
			t(e);
		};
		return e.addEventListener("pointerdown", n), () => {
			e.removeEventListener("pointerdown", n);
		};
	}
	let n = !1, r = (e) => {
		n = !0, t(e);
	}, i = (e) => {
		if (n) {
			n = !1;
			return;
		}
		t(e);
	};
	return e.addEventListener("touchstart", r, { passive: !0 }), e.addEventListener("mousedown", i), () => {
		e.removeEventListener("touchstart", r), e.removeEventListener("mousedown", i);
	};
}
function m(e) {
	if (e.length < 2) return 0;
	let t = e[0], n = e[1];
	if (t === void 0 || n === void 0) return 0;
	let r = t.clientX - n.clientX, i = t.clientY - n.clientY;
	return Math.sqrt(r * r + i * i);
}
function h(e, t = {}) {
	let { threshold: n = .1, onPinch: r, onPinchStart: i, onPinchEnd: a } = t, o = !0, s = !1, c = 0, l = 1, u = (e) => {
		!o || e.touches.length < 2 || (s = !0, c = m(e.touches), l = 1, i?.(e));
	}, d = (e) => {
		if (!o || !s || e.touches.length < 2) return;
		let t = m(e.touches);
		if (c === 0) return;
		let i = t / c;
		Math.abs(i - l) >= n && (l = i, r?.(l, e));
	}, f = (e) => {
		!o || !s || e.touches.length < 2 && (s = !1, a?.(e));
	};
	return e.addEventListener("touchstart", u, { passive: !0 }), e.addEventListener("touchmove", d, { passive: !0 }), e.addEventListener("touchend", f, { passive: !0 }), e.addEventListener("touchcancel", f, { passive: !0 }), {
		enable: () => {
			o = !0;
		},
		disable: () => {
			o = !1, s = !1;
		},
		getScale: () => l,
		resetScale: () => {
			l = 1;
		},
		destroy: () => {
			e.removeEventListener("touchstart", u), e.removeEventListener("touchmove", d), e.removeEventListener("touchend", f), e.removeEventListener("touchcancel", f);
		}
	};
}
function g(e, t = {}) {
	let { onPan: n, onPanStart: r, onPanEnd: i, preventDefault: a = !1 } = t, o = !0, s = !1, c = 0, l = 0, u = (e) => {
		if (!o || e.touches.length !== 1) return;
		let t = e.touches[0];
		t !== void 0 && (s = !0, c = t.clientX, l = t.clientY, r?.(e));
	}, d = (e) => {
		if (!o || !s || e.touches.length !== 1) return;
		let t = e.touches[0];
		if (t === void 0) return;
		a && e.preventDefault();
		let r = t.clientX - c, i = t.clientY - l;
		c = t.clientX, l = t.clientY, n?.(r, i, e);
	}, f = (e) => {
		!o || !s || (s = !1, i?.(e));
	};
	return e.addEventListener("touchstart", u, { passive: !0 }), e.addEventListener("touchmove", d, { passive: !a }), e.addEventListener("touchend", f, { passive: !0 }), e.addEventListener("touchcancel", f, { passive: !0 }), {
		enable: () => {
			o = !0;
		},
		disable: () => {
			o = !1, s = !1;
		},
		destroy: () => {
			e.removeEventListener("touchstart", u), e.removeEventListener("touchmove", d), e.removeEventListener("touchend", f), e.removeEventListener("touchcancel", f);
		}
	};
}
function _(e, t = {}) {
	let { duration: n = 500, onLongPress: r, moveThreshold: i = 10 } = t, a = !0, o = null, s = 0, c = 0, l = (e) => {
		if (!a) return;
		let t = e.touches[0];
		t !== void 0 && (s = t.clientX, c = t.clientY, o = setTimeout(() => {
			r?.(e);
		}, n));
	}, u = (e) => {
		if (o === null) return;
		let t = e.touches[0];
		if (t === void 0) return;
		let n = Math.abs(t.clientX - s), r = Math.abs(t.clientY - c);
		(n > i || r > i) && (clearTimeout(o), o = null);
	}, d = () => {
		o !== null && (clearTimeout(o), o = null);
	};
	return e.addEventListener("touchstart", l, { passive: !0 }), e.addEventListener("touchmove", u, { passive: !0 }), e.addEventListener("touchend", d, { passive: !0 }), e.addEventListener("touchcancel", d, { passive: !0 }), {
		enable: () => {
			a = !0;
		},
		disable: () => {
			a = !1, o !== null && (clearTimeout(o), o = null);
		},
		destroy: () => {
			o !== null && clearTimeout(o), e.removeEventListener("touchstart", l), e.removeEventListener("touchmove", u), e.removeEventListener("touchend", d), e.removeEventListener("touchcancel", d);
		}
	};
}
function v() {
	return "ontouchstart" in window || navigator.maxTouchPoints > 0;
}
function y() {
	return window.innerWidth < 768;
}
function b() {
	return window.innerHeight > window.innerWidth;
}
function x() {
	let e = getComputedStyle(document.documentElement), t = (t) => {
		let n = e.getPropertyValue(t), r = parseInt(n, 10);
		return isNaN(r) ? 0 : r;
	}, n = (e, n) => {
		let r = t(e);
		return r === 0 ? t(n) : r;
	};
	return {
		top: n("--safe-area-inset-top", "env(safe-area-inset-top)"),
		right: n("--safe-area-inset-right", "env(safe-area-inset-right)"),
		bottom: n("--safe-area-inset-bottom", "env(safe-area-inset-bottom)"),
		left: n("--safe-area-inset-left", "env(safe-area-inset-left)")
	};
}
//#endregion
export { i as _, x as a, e as b, b as c, s as d, c as f, t as g, o as h, d as i, v as l, l as m, g as n, f as o, u as p, h as r, y as s, _ as t, p as u, r as v, n as x, a as y };

//# sourceMappingURL=utils-CHEq9Vpx.js.map