import { ref as B, computed as v, useRoom as $, currentRoom as n, useColor as R, useBackground as y, useRoomLogo as C, openBlock as r, createElementBlock as m, createBaseVNode as u, unref as s, createCommentVNode as c, toDisplayString as w, normalizeStyle as x, createVNode as N, withCtx as k, createBlock as V } from "./composables-Ci32s3jE.js";
import { RoomPage as z, UiPanel as P } from "./components.js";
const S = { class: "mx-2" }, _ = ["src"], D = /* @__PURE__ */ u("div", { class: "text-2xl font-normal" }, "@", -1), E = {
  key: 1,
  class: "ml-1 text-sm"
}, q = {
  __name: "RoomButton",
  emits: ["room", "rooms", "browse"],
  setup(L) {
    const t = B(!1), a = v(() => $(n.pub));
    R("deep");
    const g = v(() => y({
      pub: n.pub,
      size: 200,
      attachment: "local"
    })), { logo: i } = C(n.pub);
    return (l, o) => {
      var p, d, f, b;
      return r(), m("div", S, [
        u("button", {
          class: "button",
          style: x({ ...g.value }),
          onClick: o[0] || (o[0] = (e) => t.value = !0)
        }, [
          s(i) ? (r(), m("img", {
            key: 0,
            class: "h-12 rounded-xl mr-2",
            src: s(i)
          }, null, 8, _)) : c("", !0),
          D,
          (f = (d = (p = a.value) == null ? void 0 : p.room) == null ? void 0 : d.profile) != null && f.name ? (r(), m("div", E, w((b = a.value) == null ? void 0 : b.room.profile.name.substring(0, 15)), 1)) : c("", !0)
        ], 4),
        N(s(P), {
          class: "break-all",
          open: t.value,
          "close-button": !1,
          onClose: o[5] || (o[5] = (e) => t.value = !1)
        }, {
          default: k(() => [
            (r(), V(s(z), {
              key: s(n).pub,
              onRoom: o[2] || (o[2] = (e) => l.$emit("room", e)),
              onRooms: o[3] || (o[3] = (e) => l.$emit("rooms")),
              onBrowse: o[4] || (o[4] = (e) => {
                l.$emit("browse", e), t.value = !1;
              })
            }, {
              default: k(() => [
                u("button", {
                  class: "button m-4",
                  onClick: o[1] || (o[1] = (e) => {
                    l.$emit("rooms"), t.value = !1;
                  })
                }, "Browse rooms")
              ]),
              _: 1
            }))
          ]),
          _: 1
        }, 8, ["open"])
      ]);
    };
  }
};
export {
  q as default
};
//# sourceMappingURL=RoomButton-C2GkNR_g.js.map
