import { defineComponent as d, openBlock as c, createElementBlock as f, normalizeClass as m, renderSlot as p, createElementVNode as r, toDisplayString as a, createVNode as b, withCtx as k, createTextVNode as v, createCommentVNode as g } from "vue"; const h = ["disabled"], w = /* @__PURE__ */ d({ __name: "LimelightButton", props: { variant: {}, disabled: { type: Boolean } }, setup(e) { return (i, n) => (c(), f("button", { type: "button", class: m(["btn", [e.variant && `btn--${e.variant}`, { "btn--disabled": e.disabled }]]), disabled: e.disabled }, [ p(i.$slots, "default", {}, void 0, !0) ], 10, h)); } }), x = (e, i) => { const n = e.__vccOpts || e; for (const [t, s] of i) n[t] = s; return n; }, y = /* @__PURE__ */ x(w, [["__scopeId", "data-v-e0bc8f43"]]), M = { key: 0, class: "fixed inset-0 z-50 flex items-center justify-center" }, F = { class: "relative bg-secondary border border-red-500/40 rounded-2xl p-5 max-w-sm w-[90%] shadow-xl" }, _ = { class: "flex items-center gap-3 mb-3" }, C = { class: "text-white font-semibold" }, S = { class: "text-white/80 text-sm whitespace-pre-line" }, P = /* @__PURE__ */ d({ __name: "ErrorPopup", props: { message: {}, show: { type: Boolean }, title: {} }, emits: ["close"], setup(e, { emit: i }) { return (n, t) => e.show && e.message ? (c(), f("div", M, [ r("div", { class: "absolute inset-0 bg-black/60", onClick: t[0] || (t[0] = (s) => n.$emit("close")) }), r("div", F, [ r("div", _, [ t[2] || (t[2] = r("div", { class: "w-10 h-10 rounded-full bg-red/15 flex items-center justify-center" }, [ r("svg", { class: "w-5 h-5 text-red", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" }, [ r("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M12 9v2m0 4h.01M10.29 3.86l-8.2 14A1.5 1.5 0 003.3 20h16.4a1.5 1.5 0 001.21-2.14l-8.2-14a1.5 1.5 0 00-2.42 0z" }) ]) ], -1)), r("p", C, a(e.title ?? "Verbindungsfehler"), 1) ]), r("p", S, a(e.message), 1), b(y, { variant: "danger", class: "mt-4 w-full", onClick: t[1] || (t[1] = (s) => n.$emit("close")) }, { default: k(() => [...t[3] || (t[3] = [ v(" OK ", -1) ])]), _: 1 }) ]) ])) : g("", !0); } }); function O(e, i) { return typeof FileMaker > "u" ? !1 : (FileMaker.PerformScript(e, i), !0); } function V(e, i, n) { return typeof FileMaker > "u" ? !1 : (FileMaker.PerformScriptWithOption(e, i, n), !0); } const o = /* @__PURE__ */ new Map(); let $ = 1; function T(e, i = "", n) { return new Promise((t, s) => { if (typeof FileMaker > "u") { s({ callbackId: -1, message: "FileMaker runtime not available" }); return; } const l = $++; o.set(l, { resolve: t, reject: s }); const u = { callbackId: l, parameter: i }; FileMaker.PerformScript(e, JSON.stringify(u)), n !== void 0 && setTimeout(() => { o.has(l) && (o.delete(l), s({ callbackId: l, message: `Timed out after ${n}ms` })); }, n); }); } function z(e, i = "", n) { const t = parseInt(e), s = o.get(t); s && (o.delete(t), n ? s.reject({ callbackId: t, message: i }) : s.resolve(i)); } function B(e, i, n = 10, t = 0) { I() ? e() : t >= n ? i == null || i() : setTimeout(() => B(e, i, n, t + 1), 100); } function I() { return typeof FileMaker < "u"; } export { P as ErrorPopup, y as LimelightButton, T as callFileMakerScript, I as isFileMakerEnvironment, O as performScript, V as performScriptWithOption, z as resolveFileMakerCallback, B as waitForFileMaker };