var a = Object.defineProperty;
var n = (r, e, o) => e in r ? a(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
var t = (r, e, o) => n(r, typeof e != "symbol" ? e + "" : e, o);
import { ref as l, reactive as c, readonly as u } from "vue";
class d {
  constructor() {
    t(this, "promise");
    t(this, "reject");
    t(this, "resolve");
    this.promise = new Promise((e, o) => {
      this.reject = o, this.resolve = e;
    });
  }
}
const i = l();
function p() {
  function r(o) {
    var s;
    if (i.value)
      throw new Error("A Dialog is already being displayed");
    return i.value = {
      ...o,
      deferred: new d()
    }, (s = i.value.deferred) == null ? void 0 : s.promise;
  }
  function e() {
    i.value = void 0;
  }
  return c({
    /**
     * The currently open dialog information.
     */
    active: u(i),
    /**
     * Opens the dialog.
     */
    open: r,
    /**
     * Closes the dialog.
     */
    close: e
  });
}
export {
  p as default
};
//# sourceMappingURL=useDialog.js.map
