import { defineComponent as s, openBlock as c, createElementBlock as d, normalizeClass as f, renderSlot as u } from "vue";
const p = ["disabled"], k = /* @__PURE__ */ s({
  __name: "LimelightButton",
  props: {
    variant: {},
    disabled: { type: Boolean }
  },
  setup(e) {
    return (t, n) => (c(), d("button", {
      type: "button",
      class: f(["btn", [e.variant && `btn--${e.variant}`, { "btn--disabled": e.disabled }]]),
      disabled: e.disabled
    }, [
      u(t.$slots, "default", {}, void 0, !0)
    ], 10, p));
  }
}), m = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, a] of t)
    n[i] = a;
  return n;
}, g = /* @__PURE__ */ m(k, [["__scopeId", "data-v-e0bc8f43"]]);
function y(e, t) {
  return typeof FileMaker > "u" ? !1 : (FileMaker.PerformScript(e, t), !0);
}
function _(e, t, n) {
  return typeof FileMaker > "u" ? !1 : (FileMaker.PerformScriptWithOption(e, t, n), !0);
}
const r = /* @__PURE__ */ new Map();
let b = 1;
function S(e, t = "", n) {
  return new Promise((i, a) => {
    if (typeof FileMaker > "u") {
      a({ callbackId: -1, message: "FileMaker runtime not available" });
      return;
    }
    const l = b++;
    r.set(l, { resolve: i, reject: a });
    const o = { callbackId: l, parameter: t };
    FileMaker.PerformScript(e, JSON.stringify(o)), n !== void 0 && setTimeout(() => {
      r.has(l) && (r.delete(l), a({ callbackId: l, message: `Timed out after ${n}ms` }));
    }, n);
  });
}
function h(e, t = "", n) {
  const i = parseInt(e), a = r.get(i);
  a && (r.delete(i), n ? a.reject({ callbackId: i, message: t }) : a.resolve(t));
}
function F(e, t, n = 10, i = 0) {
  M() ? e() : i >= n ? t == null || t() : setTimeout(() => F(e, t, n, i + 1), 100);
}
function M() {
  return typeof FileMaker < "u";
}
export {
  g as LimelightButton,
  S as callFileMakerScript,
  M as isFileMakerEnvironment,
  y as performScript,
  _ as performScriptWithOption,
  h as resolveFileMakerCallback,
  F as waitForFileMaker
};
