import { defineComponent as _, useAccount as v, toRef as g, computed as k, usePrivateChat as x, resolveComponent as i, openBlock as C, createElementBlock as h, createBaseVNode as o, createVNode as s, unref as e, toDisplayString as m, renderSlot as A, withCtx as S, selectedUser as a } from "./composables-Ci32s3jE.js";
import { AccountAvatar as B, ChatInput as D, UiPanel as q } from "./components.js";
const $ = { class: "m-0 flex flex-col" }, y = { class: "flex-0 p-4 flex flex-wrap items-center" }, H = { class: "text-lg font-bold p-2" }, I = { class: "text-lg" }, P = /* @__PURE__ */ o("div", { class: "flex-1" }, null, -1), R = { class: "flex-0 bg-light-900 dark-bg-dark-600 p-4" }, w = /* @__PURE__ */ _({
  __name: "ChatPrivate",
  props: {
    pub: {
      default: "OKrDaDeD8VeA27d673RqlodSnebnaDq6Ci23Ys_ABWE.q8fI2lkxO46R8TMjeUeAf7I0yBS5mdH_Cb9_285Wkqk",
      type: String
    }
  },
  emits: ["user"],
  setup(n) {
    const u = n, { account: r } = v(g(u, "pub")), c = k(() => x(u.pub));
    return (d, t) => {
      var p;
      const f = i("chat-messages"), b = i("AccountHome");
      return C(), h("div", $, [
        o("div", y, [
          s(e(B), {
            class: "cursor-pointer",
            pub: n.pub,
            onClick: t[0] || (t[0] = (l) => d.$emit("user", n.pub))
          }, null, 8, ["pub"]),
          o("div", H, m((p = e(r).profile) == null ? void 0 : p.name), 1),
          o("div", I, m(e(r).lastSeen), 1),
          P,
          A(d.$slots, "default")
        ]),
        s(f, {
          class: "bg-dark-50 dark-bg-dark-400",
          messages: c.value.sorted
        }, null, 8, ["messages"]),
        o("div", R, [
          s(e(D), {
            onSubmit: t[1] || (t[1] = (l) => c.value.send(l))
          })
        ]),
        s(e(q), {
          onClose: t[2] || (t[2] = (l) => e(a).pub = ""),
          open: !!e(a).pub
        }, {
          default: S(() => [
            s(b, {
              pub: e(a).pub
            }, null, 8, ["pub"])
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
});
export {
  w as default
};
//# sourceMappingURL=ChatPrivate-B2R3D04V.js.map
