import { defineComponent as f, toRef as g, computed as k, createElementBlock as c, openBlock as v, createElementVNode as o, createVNode as l, renderSlot as x, unref as t, toDisplayString as d, withCtx as m, createTextVNode as C } from "vue";
import { useAccount as S, usePrivateChat as $, selectedUser as u } from "./composables-BAZQlC3e.js";
import { AccountAvatar as A, ChatMessages as y, TorrentUpload as D, ChatInput as U, UiPanel as q } from "./components.js";
import { _sfc_main as w } from "./AccountHome.vue_vue_type_script_setup_true_lang-t8pzs-Qp.js";
const B = { class: "m-0 flex flex-col bg-stone-400 dark-bg-dark-400" }, V = { class: "flex-0 p-2 flex flex-wrap items-center gap-2 sticky top-18 bg-light-800 bg-op-30 backdrop-blur dark-bg-dark-800 dark-bg-op-30 z-100 shadow" }, E = { class: "text-lg font-bold p-2" }, I = { class: "text-lg" }, N = { class: "sticky bottom-0 flex-0 bg-light-900 dark-bg-dark-600 p-4 flex gap-2" }, M = /* @__PURE__ */ f({
  __name: "ChatPrivate",
  props: {
    pub: {
      default: "OKrDaDeD8VeA27d673RqlodSnebnaDq6Ci23Ys_ABWE.q8fI2lkxO46R8TMjeUeAf7I0yBS5mdH_Cb9_285Wkqk",
      type: String
    }
  },
  emits: ["user", "back"],
  setup(a) {
    const i = a, { account: p } = S(g(i, "pub")), r = k(() => $(i.pub));
    return (n, e) => {
      var b;
      return v(), c("div", B, [
        o("div", V, [
          o("button", {
            class: "p-2 bg-light-300 dark-bg-dark-400 rounded-xl",
            onClick: e[0] || (e[0] = (s) => n.$emit("back"))
          }, e[6] || (e[6] = [
            o("div", { class: "i-la-angle-left" }, null, -1)
          ])),
          l(t(A), {
            class: "cursor-pointer",
            pub: a.pub,
            onClick: e[1] || (e[1] = (s) => n.$emit("user", a.pub))
          }, null, 8, ["pub"]),
          o("div", E, d((b = t(p).profile) == null ? void 0 : b.name), 1),
          o("div", I, d(t(p).lastSeen), 1),
          e[7] || (e[7] = o("div", { class: "flex-1" }, null, -1)),
          x(n.$slots, "default")
        ]),
        l(t(y), {
          class: "max-w-65ch mx-auto",
          messages: r.value.sorted
        }, null, 8, ["messages"]),
        o("div", N, [
          l(t(D), {
            onUrl: e[2] || (e[2] = (s) => r.value.send(s))
          }, {
            default: m(() => [
              C(d(), 1)
            ]),
            _: 1
          }),
          l(t(U), {
            class: "flex-1",
            onSubmit: e[3] || (e[3] = (s) => r.value.send(s))
          })
        ]),
        l(t(q), {
          onClose: e[5] || (e[5] = (s) => t(u).pub = ""),
          open: !!t(u).pub
        }, {
          default: m(() => [
            l(w, {
              pub: t(u).pub,
              onChat: e[4] || (e[4] = (s) => n.emit("user", s))
            }, null, 8, ["pub"])
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
});
export {
  M as default
};
//# sourceMappingURL=ChatPrivate-BJ0K-fbK.js.map
