import { $ as e, F as t, H as n, I as r, N as i, R as a, S as o, _ as s, at as c, b as l, ct as u, d, g as f, h as p, l as m, lt as h, m as g, n as ee, p as _, st as v } from "./draggable-Bcb86AsV.js";
import { $t as y, Mt as te } from "./features-BnG-dhzy.js";
import { h as b, i as x, m as S, p as C, u as ne } from "./styleConstants-DP1VOca8.js";
//#region ../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/math.js
var w = (e, t = 0, n = 1) => e > n ? n : e < t ? t : e, T = (e, t = 0, n = 10 ** t) => Math.round(n * e) / n;
360 / (Math.PI * 2);
var re = (e) => oe(E(e)), E = (e) => (e[0] === "#" && (e = e.substring(1)), e.length < 6 ? {
	r: parseInt(e[0] + e[0], 16),
	g: parseInt(e[1] + e[1], 16),
	b: parseInt(e[2] + e[2], 16),
	a: e.length === 4 ? T(parseInt(e[3] + e[3], 16) / 255, 2) : 1
} : {
	r: parseInt(e.substring(0, 2), 16),
	g: parseInt(e.substring(2, 4), 16),
	b: parseInt(e.substring(4, 6), 16),
	a: e.length === 8 ? T(parseInt(e.substring(6, 8), 16) / 255, 2) : 1
}), D = (e) => ae(k(e)), ie = ({ h: e, s: t, v: n, a: r }) => {
	let i = (200 - t) * n / 100;
	return {
		h: T(e),
		s: T(i > 0 && i < 200 ? t * n / 100 / (i <= 100 ? i : 200 - i) * 100 : 0),
		l: T(i / 2),
		a: T(r, 2)
	};
}, O = (e) => {
	let { h: t, s: n, l: r } = ie(e);
	return `hsl(${t}, ${n}%, ${r}%)`;
}, k = ({ h: e, s: t, v: n, a: r }) => {
	e = e / 360 * 6, t /= 100, n /= 100;
	let i = Math.floor(e), a = n * (1 - t), o = n * (1 - (e - i) * t), s = n * (1 - (1 - e + i) * t), c = i % 6;
	return {
		r: T([
			n,
			o,
			a,
			a,
			s,
			n
		][c] * 255),
		g: T([
			s,
			n,
			n,
			o,
			a,
			a
		][c] * 255),
		b: T([
			a,
			a,
			s,
			n,
			n,
			o
		][c] * 255),
		a: T(r, 2)
	};
}, A = (e) => {
	let t = e.toString(16);
	return t.length < 2 ? "0" + t : t;
}, ae = ({ r: e, g: t, b: n, a: r }) => {
	let i = r < 1 ? A(T(r * 255)) : "";
	return "#" + A(e) + A(t) + A(n) + i;
}, oe = ({ r: e, g: t, b: n, a: r }) => {
	let i = Math.max(e, t, n), a = i - Math.min(e, t, n), o = a ? i === e ? (t - n) / a : i === t ? 2 + (n - e) / a : 4 + (e - t) / a : 0;
	return {
		h: T(60 * (o < 0 ? o + 6 : o)),
		s: T(i ? a / i * 100 : 0),
		v: T(i / 255 * 100),
		a: r
	};
}, j = (e, t) => {
	if (e === t) return !0;
	for (let n in e) if (e[n] !== t[n]) return !1;
	return !0;
}, M = (e, t) => e.toLowerCase() === t.toLowerCase() ? !0 : j(E(e), E(t)), N = {}, P = (e) => {
	let t = N[e];
	return t || (t = document.createElement("template"), t.innerHTML = e, N[e] = t), t;
}, F = (e, t, n) => {
	e.dispatchEvent(new CustomEvent(t, {
		bubbles: !0,
		detail: n
	}));
}, I = !1, L = (e) => "touches" in e, R = (e) => I && !L(e) ? !1 : (I ||= L(e), !0), z = (e, t) => {
	let n = L(t) ? t.touches[0] : t, r = e.el.getBoundingClientRect();
	F(e.el, "move", e.getMove({
		x: w((n.pageX - (r.left + window.pageXOffset)) / r.width),
		y: w((n.pageY - (r.top + window.pageYOffset)) / r.height)
	}));
}, B = (e, t) => {
	let n = t.keyCode;
	n > 40 || e.xy && n < 37 || n < 33 || (t.preventDefault(), F(e.el, "move", e.getMove({
		x: n === 39 ? .01 : n === 37 ? -.01 : n === 34 ? .05 : n === 33 ? -.05 : n === 35 ? 1 : n === 36 ? -1 : 0,
		y: n === 40 ? .01 : n === 38 ? -.01 : 0
	}, !0)));
}, V = class {
	constructor(e, t, n, r) {
		let i = P(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);
		e.appendChild(i.content.cloneNode(!0));
		let a = e.querySelector(`[part=${t}]`);
		a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = r, this.nodes = [a.firstChild, a];
	}
	set dragging(e) {
		let t = e ? document.addEventListener : document.removeEventListener;
		t(I ? "touchmove" : "mousemove", this), t(I ? "touchend" : "mouseup", this);
	}
	handleEvent(e) {
		switch (e.type) {
			case "mousedown":
			case "touchstart":
				if (e.preventDefault(), !R(e) || !I && e.button != 0) return;
				this.el.focus(), z(this, e), this.dragging = !0;
				break;
			case "mousemove":
			case "touchmove":
				e.preventDefault(), z(this, e);
				break;
			case "mouseup":
			case "touchend":
				this.dragging = !1;
				break;
			case "keydown":
				B(this, e);
				break;
		}
	}
	style(e) {
		e.forEach((e, t) => {
			for (let n in e) this.nodes[t].style.setProperty(n, e[n]);
		});
	}
}, H = class extends V {
	constructor(e) {
		super(e, "hue", "aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"", !1);
	}
	update({ h: e }) {
		this.h = e, this.style([{
			left: `${e / 360 * 100}%`,
			color: O({
				h: e,
				s: 100,
				v: 100,
				a: 1
			})
		}]), this.el.setAttribute("aria-valuenow", `${T(e)}`);
	}
	getMove(e, t) {
		return { h: t ? w(this.h + e.x * 360, 0, 360) : 360 * e.x };
	}
}, U = class extends V {
	constructor(e) {
		super(e, "saturation", "aria-label=\"Color\"", !0);
	}
	update(e) {
		this.hsva = e, this.style([{
			top: `${100 - e.v}%`,
			left: `${e.s}%`,
			color: O(e)
		}, { "background-color": O({
			h: e.h,
			s: 100,
			v: 100,
			a: 1
		}) }]), this.el.setAttribute("aria-valuetext", `Saturation ${T(e.s)}%, Brightness ${T(e.v)}%`);
	}
	getMove(e, t) {
		return {
			s: t ? w(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
			v: t ? w(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
		};
	}
}, W = ":host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}", G = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", K = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", q = Symbol("same"), J = Symbol("color"), Y = Symbol("hsva"), X = Symbol("update"), Z = Symbol("parts"), Q = Symbol("css"), $ = Symbol("sliders"), se = class extends HTMLElement {
	static get observedAttributes() {
		return ["color"];
	}
	get [Q]() {
		return [
			W,
			G,
			K
		];
	}
	get [$]() {
		return [U, H];
	}
	get color() {
		return this[J];
	}
	set color(e) {
		if (!this[q](e)) {
			let t = this.colorModel.toHsva(e);
			this[X](t), this[J] = e;
		}
	}
	constructor() {
		super();
		let e = P(`<style>${this[Q].join("")}</style>`), t = this.attachShadow({ mode: "open" });
		t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[Z] = this[$].map((e) => new e(t));
	}
	connectedCallback() {
		if (this.hasOwnProperty("color")) {
			let e = this.color;
			delete this.color, this.color = e;
		} else this.color ||= this.colorModel.defaultColor;
	}
	attributeChangedCallback(e, t, n) {
		let r = this.colorModel.fromAttr(n);
		this[q](r) || (this.color = r);
	}
	handleEvent(e) {
		let t = this[Y], n = {
			...t,
			...e.detail
		};
		this[X](n);
		let r;
		!j(n, t) && !this[q](r = this.colorModel.fromHsva(n)) && (this[J] = r, F(this, "color-changed", { value: r }));
	}
	[q](e) {
		return this.color && this.colorModel.equal(e, this.color);
	}
	[X](e) {
		this[Y] = e, this[Z].forEach((t) => t.update(e));
	}
}, ce = {
	defaultColor: "#000",
	toHsva: re,
	fromHsva: ({ h: e, s: t, v: n }) => D({
		h: e,
		s: t,
		v: n,
		a: 1
	}),
	equal: M,
	fromAttr: (e) => e
}, le = class extends se {
	get colorModel() {
		return ce;
	}
};
customElements.define("hex-color-picker", class extends le {});
//#endregion
//#region src/components/ColorPicker.vue?vue&type=script&setup=true&lang.ts
var ue = [
	"disabled",
	"aria-label",
	"aria-expanded"
], de = [
	"value",
	"placeholder",
	"disabled",
	"aria-label"
], fe = ["color", "aria-label"], pe = /* @__PURE__ */ o({
	__name: "ColorPicker",
	props: {
		modelValue: {},
		placeholder: { default: x },
		size: { default: "default" },
		swatchOnly: {
			type: Boolean,
			default: !1
		},
		disabled: {
			type: Boolean,
			default: !1
		}
	},
	emits: ["update:modelValue"],
	setup(t, { emit: r }) {
		let a = t, o = r, { t: d } = te(), p = e(!1), h = e(), b = e();
		y(h, () => {
			p.value = !1;
		}, { ignore: [b] });
		let x = _({
			get: () => a.modelValue || "#000000",
			set: (e) => o("update:modelValue", e)
		});
		function S(e) {
			x.value = e.detail.value;
		}
		function C(e) {
			x.value = e.target.value;
		}
		return (e, r) => (i(), s("div", { class: v(["tpl:flex tpl:gap-2 tpl:relative", t.disabled && "tpl:opacity-60 tpl:cursor-not-allowed"]) }, [
			g("button", {
				ref_key: "swatchRef",
				ref: b,
				type: "button",
				disabled: t.disabled,
				"aria-label": c(d).colorPicker.pickColor,
				"aria-expanded": p.value,
				class: v([
					"tpl:shrink-0 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-0.5 tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
					t.disabled ? "tpl:cursor-not-allowed" : "tpl:cursor-pointer",
					p.value ? "tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]" : !t.disabled && "hover:tpl:border-[var(--tpl-text-dim)]",
					t.size === "large" ? "tpl:size-12" : "tpl:size-10"
				]),
				onClick: r[0] ||= (e) => !t.disabled && (p.value = !p.value)
			}, [g("span", {
				class: "tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]",
				style: u({ backgroundColor: x.value })
			}, null, 4)], 10, ue),
			t.swatchOnly ? f("", !0) : (i(), s("input", {
				key: 0,
				type: "text",
				class: v(c(ne)),
				value: t.modelValue,
				placeholder: t.placeholder,
				disabled: t.disabled,
				"aria-label": c(d).colorPicker.hexValue,
				onInput: C
			}, null, 42, de)),
			l(ee, {
				"enter-active-class": "tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
				"enter-from-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1",
				"enter-to-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
				"leave-active-class": "tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]",
				"leave-from-class": "tpl:opacity-100 tpl:scale-100 tpl:translate-y-0",
				"leave-to-class": "tpl:opacity-0 tpl:scale-95 tpl:translate-y-1"
			}, {
				default: n(() => [p.value ? (i(), s("div", {
					key: 0,
					ref_key: "popoverRef",
					ref: h,
					class: "tpl:absolute tpl:left-0 tpl:top-full tpl:z-50 tpl:mt-2 tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg"
				}, [g("hex-color-picker", {
					color: x.value,
					"aria-label": c(d).colorPicker.pickColor,
					onColorChanged: S,
					onKeydown: r[1] ||= m((e) => p.value = !1, ["escape"])
				}, null, 40, fe)], 512)) : f("", !0)]),
				_: 1
			})
		], 2));
	}
}), me = [
	"aria-checked",
	"aria-label",
	"title",
	"onClick"
], he = { key: 1 }, ge = /* @__PURE__ */ o({
	__name: "SlidingPillSelect",
	props: {
		options: {},
		modelValue: {}
	},
	emits: ["update:modelValue"],
	setup(e, { emit: n }) {
		let r = e, o = n, c = _(() => r.options.findIndex((e) => e.value === r.modelValue)), l = _(() => `translateX(${Math.max(c.value, 0) * 100}%)`);
		return (n, r) => (i(), s("div", {
			role: "radiogroup",
			class: "tpl:relative tpl:grid tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1",
			style: u({
				gridTemplateColumns: `repeat(${e.options.length}, 1fr)`,
				backgroundColor: "var(--tpl-bg-hover)"
			})
		}, [c.value >= 0 ? (i(), s("div", {
			key: 0,
			class: "tpl:absolute tpl:inset-y-1 tpl:rounded-[var(--tpl-radius-sm)]",
			style: u({
				left: "4px",
				width: `calc((100% - 8px) / ${e.options.length})`,
				transform: l.value,
				backgroundColor: "var(--tpl-bg)",
				boxShadow: "var(--tpl-shadow)",
				transition: "transform 120ms cubic-bezier(0.16, 1, 0.3, 1)"
			})
		}, null, 4)) : f("", !0), (i(!0), s(d, null, t(e.options, (t) => (i(), s("button", {
			key: t.value,
			role: "radio",
			"aria-checked": e.modelValue === t.value,
			"aria-label": t.label,
			class: "tpl:relative tpl:z-10 tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-1 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:bg-transparent tpl:px-2.5 tpl:py-[5px] tpl:text-xs tpl:font-medium",
			style: u({
				color: e.modelValue === t.value ? "var(--tpl-primary)" : "var(--tpl-text-muted)",
				transition: "color 120ms cubic-bezier(0.16, 1, 0.3, 1)"
			}),
			title: t.label,
			onClick: (e) => o("update:modelValue", t.value)
		}, [t.icon ? (i(), p(a(t.icon), {
			key: 0,
			size: 14,
			"stroke-width": 2
		})) : (i(), s("span", he, h(t.label), 1))], 12, me))), 128))], 4));
	}
}), _e = { class: "tpl:mb-3.5" }, ve = /* @__PURE__ */ o({
	__name: "FieldRow",
	props: { label: {} },
	setup(e) {
		return (t, n) => (i(), s("div", _e, [e.label ? (i(), s("label", {
			key: 0,
			class: v(c(b))
		}, h(e.label), 3)) : f("", !0), r(t.$slots, "default")]));
	}
}), ye = { class: "tpl:flex tpl:items-stretch" }, be = [
	"value",
	"min",
	"max"
], xe = /* @__PURE__ */ o({
	__name: "NumberWithSuffix",
	props: {
		modelValue: {},
		min: {},
		max: {},
		suffix: {}
	},
	emits: ["update:modelValue"],
	setup(e, { emit: t }) {
		let n = t;
		return (t, r) => (i(), s("div", ye, [g("input", {
			type: "number",
			class: v(c(C)),
			value: e.modelValue,
			min: e.min,
			max: e.max,
			onInput: r[0] ||= (e) => n("update:modelValue", Number(e.target.value))
		}, null, 42, be), g("span", { class: v(c(S)) }, h(e.suffix), 3)]));
	}
});
//#endregion
export { pe as i, ve as n, ge as r, xe as t };

//# sourceMappingURL=NumberWithSuffix-DnqYqSKs.js.map