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