import { computed as k, reactive as M, resolveComponent as i, openBlock as r, createElementBlock as c, createElementVNode as o, normalizeStyle as N, unref as e, createVNode as p, toDisplayString as P, Fragment as h, renderList as y, renderSlot as U, createBlock as w, createCommentVNode as V } from "vue";
import { features as E, useUser as T, currentRoom as m, useRoom as j, useMd as D, useColor as F, useBackground as O } from "./composables-5f691338.js";
const q = { class: "flex flex-col items-stretch" }, A = { class: "max-w-full flex flex-col items-stretche bg-light-100 bg-opacity-20 dark-bg-dark-800 dark-bg-opacity-40 p-4 md-p-12 shadow-xl backdrop-blur-md backdrop-filter rounded-t-xl" }, G = { class: "flex flex-wrap items-center gap-8" }, I = {
  class: "flex flex-col flex-auto",
  style: { flex: "100" }
}, J = { class: "text-md" }, K = { class: "flex items-center flex-wrap" }, Q = /* @__PURE__ */ o("div", { class: "font-bold mr-2" }, "Hosts: ", -1), W = { class: "flex flex-col items-center bg-light-300 dark-bg-dark-400" }, X = { class: "flex flex-wrap items-center gap-2 p-4" }, Y = { class: "relative" }, Z = {
  key: 0,
  class: "flex items-center"
}, ee = ["innerHTML"], te = /* @__PURE__ */ o("div", { class: "i-la-pen" }, null, -1), oe = [
  te
], ie = {
  __name: "RoomPage",
  props: {
    pub: { type: String, default: "" },
    titles: {
      type: Object,
      default: () => E
    }
  },
  emits: ["rooms", "browse"],
  setup(d) {
    const f = d, { user: x } = T(), u = k(() => f.pub ? f.pub : m.pub), { room: s, leaveRoom: se, updateRoomProfile: b, enterRoom: le } = j(u.value), C = D(), a = M({
      name: !1,
      description: !1,
      text: !1
    });
    F("deep");
    const R = k(() => O({ pub: u.value, size: 1200, attachment: "local" }));
    return (_, l) => {
      var v, g;
      const $ = i("room-logo"), B = i("form-title"), S = i("account-badge"), z = i("room-actions"), H = i("room-feature"), L = i("form-text");
      return r(), c("div", q, [
        o("div", {
          class: "pt-32 px-2 md-px-8 bg-cover relative flex flex-col items-center",
          style: N({ ...e(R) })
        }, [
          o("div", A, [
            o("div", G, [
              p($, {
                class: "flex-1 rounded-2xl overflow-hidden min-w-20",
                pub: d.pub
              }, null, 8, ["pub"]),
              o("div", I, [
                p(B, {
                  class: "font-bold text-2xl",
                  text: e(s).profile.name || e(u).substring(0, 12),
                  editable: e(s).hosts[e(x).pub] && e(u) == e(m).pub && !a.name,
                  onUpdate: l[0] || (l[0] = (n) => e(b)("name", n))
                }, null, 8, ["text", "editable"]),
                o("div", J, P(e(s).profile.description), 1),
                o("div", K, [
                  Q,
                  (r(!0), c(h, null, y(e(s).hosts, (n, t) => (r(), c("div", {
                    class: "p-2 flex flex-col items-start gap-2",
                    key: t
                  }, [
                    p(S, {
                      pub: t,
                      selectable: !0
                    }, null, 8, ["pub"])
                  ]))), 128))
                ]),
                p(z, { pub: e(u) }, null, 8, ["pub"])
              ])
            ])
          ])
        ], 4),
        U(_.$slots, "default"),
        o("div", W, [
          o("div", X, [
            (r(!0), c(h, null, y(d.titles, (n, t) => (r(), w(H, {
              key: t,
              cert: e(s).features[t],
              type: t,
              title: n,
              pub: d.pub || e(m).pub,
              open: e(s).features[t] || t == "users" && e(s).features.space || t == "chat" && e(s).features.chat,
              onClick: (ne) => _.$emit("browse", t)
            }, null, 8, ["cert", "type", "title", "pub", "open", "onClick"]))), 128))
          ]),
          o("div", Y, [
            a.text === !1 ? (r(), c("div", Z, [
              o("div", {
                class: "p-8 markdown-body prose",
                innerHTML: e(C).render(((v = e(s).profile) == null ? void 0 : v.text) || "")
              }, null, 8, ee),
              (g = e(s).hosts) != null && g[e(x).pub] ? (r(), c("button", {
                key: 0,
                class: "button absolute top-4 right-4 z-200",
                onClick: l[1] || (l[1] = (n) => {
                  var t;
                  return a.text = ((t = e(s).profile) == null ? void 0 : t.text) || "";
                })
              }, oe)) : V("", !0)
            ])) : (r(), w(L, {
              key: 1,
              text: a.text,
              "onUpdate:text": l[2] || (l[2] = (n) => a.text = n),
              onClose: l[3] || (l[3] = (n) => {
                e(b)("text", a.text), a.text = !1;
              })
            }, null, 8, ["text"]))
          ])
        ])
      ]);
    };
  }
};
export {
  ie as default
};
//# sourceMappingURL=RoomPage-2c653c5b.js.map
