import { defineComponent as c, useUser as p, openBlock as n, createElementBlock as m, createVNode as i, withCtx as a, unref as e, createBlock as f, createBaseVNode as r, createCommentVNode as v, renderSlot as b, createTextVNode as k, normalizeStyle as y } from "./composables-61bf5e40.js";
import { AuthCredentials as $, UiLayer as C, AuthLogin as w, UserPanel as x, UserProfile as B, UserRooms as U } from "./components.js";
const _ = { class: "flex flex-col items-center w-full" }, g = /* @__PURE__ */ r("div", { class: "i-la-check" }, null, -1), N = /* @__PURE__ */ r("div", { class: "ml-2" }, "I've stored my key securely", -1), V = [
  g,
  N
], h = {
  key: 1,
  class: "flex flex-col"
}, S = { class: "p-4 flex flex-col items-start" }, E = /* @__PURE__ */ c({
  __name: "UserHome",
  emits: ["user", "room", "close", "chat", "browse"],
  setup(A, { emit: L }) {
    const { user: s } = p();
    function d() {
      s.db.get("safe").get("saved").put(!0);
    }
    return (l, o) => {
      var u;
      return n(), m("div", _, [
        i(e(C), {
          open: e(s).is && !((u = e(s).safe) != null && u.saved),
          "close-button": "",
          onClose: o[1] || (o[1] = (t) => d())
        }, {
          default: a(() => {
            var t;
            return [
              (t = e(s).safe) != null && t.saved ? v("", !0) : (n(), f(e($), { key: 0 }, {
                default: a(() => [
                  r("button", {
                    class: "button mx-8 justify-center",
                    onClick: o[0] || (o[0] = (P) => d())
                  }, V)
                ]),
                _: 1
              }))
            ];
          }),
          _: 1
        }, 8, ["open"]),
        e(s).is ? (n(), m("div", h, [
          i(e(x), {
            onBrowse: o[2] || (o[2] = (t) => {
              l.$emit("browse", t), l.$emit("close");
            })
          }),
          r("div", S, [
            i(e(B)),
            i(e(U), {
              onBrowse: o[3] || (o[3] = (t) => l.$emit("room", t))
            })
          ]),
          r("button", {
            class: "p-4 m-4 rounded-xl font-bold text-lg shadow-md",
            style: y({ backgroundColor: e(s).color }),
            onClick: o[4] || (o[4] = (t) => {
              l.$emit("user", e(s).pub), l.$emit("close");
            })
          }, [
            b(l.$slots, "default", {}, () => [
              k(" My public profile")
            ])
          ], 4)
        ])) : (n(), f(e(w), { key: 0 }))
      ]);
    };
  }
});
export {
  E as default
};
//# sourceMappingURL=UserHome-5f8d411f.js.map
