import { Dt as e, H as t, M as n, Mt as r, P as i, Q as a, S as o, V as s, _ as c, b as l, d as u, g as d, h as f, it as p, m, o as h, y as g, z as _ } from "./vue.runtime.esm-bundler-DpvJL-nX.js";
import "./useEditorCore-D0uZbPKG.js";
import { t as v } from "./loader-circle-IS16T05j.js";
import { n as y } from "./useCloudI18n-D0Fi0hBU.js";
import { t as b } from "./TplModal-BiUCSfou.js";
//#region src/cloud/components/TestEmailModal.vue?vue&type=script&setup=true&lang.ts
var x = ["aria-busy"], S = {
	id: "tpl-test-email-title",
	class: "tpl:mb-4 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
}, C = { class: "tpl:mb-3" }, w = { class: "tpl:mb-1.5 tpl:block tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]" }, T = ["value"], E = ["disabled"], D = ["value"], O = {
	key: 0,
	role: "alert",
	class: "tpl:mb-3 tpl:text-xs tpl:text-[var(--tpl-danger)]"
}, k = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, A = ["disabled"], j = ["disabled"], M = {
	key: 0,
	class: "tpl:flex tpl:items-center tpl:gap-1.5"
}, N = { key: 1 }, P = /* @__PURE__ */ o({
	__name: "TestEmailModal",
	props: {
		visible: { type: Boolean },
		allowedEmails: {},
		isSending: { type: Boolean },
		error: {}
	},
	emits: ["send", "close"],
	setup(o, { emit: P }) {
		let F = o, I = P, { t: L } = y(), R = a("");
		_(() => F.visible, (e) => {
			e && (R.value = F.allowedEmails[0] ?? "");
		});
		function z() {
			!R.value || F.isSending || I("send", R.value);
		}
		function B() {
			F.isSending || I("close");
		}
		function V(e) {
			e.key === "Enter" && !e.shiftKey && (e.preventDefault(), z()), e.key === "Escape" && B();
		}
		return (a, _) => (n(), f(b, {
			visible: o.visible,
			onClose: B,
			onKeydown: V
		}, {
			default: s(() => [m("div", {
				role: "dialog",
				"aria-modal": "true",
				"aria-busy": o.isSending,
				"aria-labelledby": "tpl-test-email-title",
				class: "tpl-scale-in tpl:mx-4 tpl:w-full tpl:max-w-sm tpl:rounded-[var(--tpl-radius-lg)] tpl:p-5",
				style: {
					"background-color": "var(--tpl-bg-elevated)",
					"box-shadow": "var(--tpl-shadow-xl)"
				}
			}, [
				m("h3", S, r(p(L).testEmail.title), 1),
				m("div", C, [m("label", w, r(p(L).testEmail.recipientLabel), 1), o.allowedEmails.length === 1 ? (n(), c("input", {
					key: 0,
					type: "text",
					value: R.value,
					disabled: "",
					class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:opacity-70 tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]"
				}, null, 8, T)) : t((n(), c("select", {
					key: 1,
					"onUpdate:modelValue": _[0] ||= (e) => R.value = e,
					class: "tpl:h-9 tpl:w-full tpl:rounded-md tpl:border tpl:px-3 tpl:py-1 tpl:text-sm tpl:shadow-xs tpl:outline-none tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text)]",
					disabled: o.isSending
				}, [(n(!0), c(u, null, i(o.allowedEmails, (e) => (n(), c("option", {
					key: e,
					value: e
				}, r(e), 9, D))), 128))], 8, E)), [[h, R.value]])]),
				o.error ? (n(), c("p", O, r(o.error), 1)) : d("", !0),
				m("div", k, [m("button", {
					type: "button",
					class: e(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)]", { "tpl:cursor-not-allowed tpl:opacity-50": o.isSending }]),
					disabled: o.isSending,
					onClick: B
				}, r(p(L).testEmail.cancel), 11, A), m("button", {
					type: "button",
					class: "tpl:cursor-pointer tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]",
					disabled: !R.value || o.isSending,
					onClick: z
				}, [o.isSending ? (n(), c("span", M, [l(p(v), {
					class: "tpl:animate-spin",
					size: 12,
					"stroke-width": 2
				}), g(" " + r(p(L).testEmail.sending), 1)])) : (n(), c("span", N, r(p(L).testEmail.send), 1))], 8, j)])
			], 8, x)]),
			_: 1
		}, 8, ["visible"]));
	}
});
//#endregion
export { P as default };
