import { defineComponent as h, useUser as f, computed as v, ref as p, unref as t, openBlock as s, createElementBlock as l, createBaseVNode as e, toDisplayString as k, createVNode as b, withCtx as _, Fragment as x, renderList as g, createBlock as y, enterRoom as C, recreateRoom as w, createCommentVNode as u, Transition as R } from "./composables-108ad332.js";
import { RoomCard as $ } from "./components.js";
const B = {
  key: 0,
  class: "flex flex-col"
}, V = /* @__PURE__ */ e("div", { class: "text-lg font-bold" }, "My rooms", -1), N = /* @__PURE__ */ e("div", { class: "flex-1" }, null, -1), j = { class: "text-md font-bold mr-2" }, E = {
  key: 0,
  class: "i-la-angle-down"
}, O = {
  key: 1,
  class: "i-la-angle-up"
}, U = {
  key: 0,
  class: "flex flex-wrap gap-2 mb-8"
}, D = { class: "p-4 flex flex-wrap gap-1" }, F = ["onClick"], L = /* @__PURE__ */ e("div", { class: "i-la-eye" }, null, -1), M = /* @__PURE__ */ e("div", { class: "ml-2" }, "View", -1), S = [
  L,
  M
], T = ["onClick"], q = /* @__PURE__ */ e("div", { class: "i-ion-enter-outline" }, null, -1), z = /* @__PURE__ */ e("div", { class: "ml-2" }, "Enter", -1), A = [
  q,
  z
], G = ["onClick"], H = /* @__PURE__ */ e("div", { class: "i-la-tools" }, null, -1), I = /* @__PURE__ */ e("div", { class: "ml-2" }, "Renew", -1), J = [
  H,
  I
], X = /* @__PURE__ */ h({
  __name: "UserRooms",
  emits: ["browse"],
  setup(K, { emit: P }) {
    const { user: m } = f(), d = v(() => {
      var n;
      let o = (n = m.safe) == null ? void 0 : n.rooms;
      return o ? (delete o._, o) : {};
    }), i = p(!1);
    return (o, n) => Object.keys(t(d)).length > 0 ? (s(), l("div", B, [
      e("div", {
        class: "flex p-4 bg-light-900 dark-bg-dark-700 rounded-xl mb-2 items-center cursor-pointer shadow-sm hover-shadow-md transition",
        onClick: n[0] || (n[0] = (a) => i.value = !i.value)
      }, [
        V,
        N,
        e("div", j, k(Object.keys(t(d)).length), 1),
        i.value ? (s(), l("div", O)) : (s(), l("div", E))
      ]),
      b(R, {
        name: "fade",
        mode: "out-in"
      }, {
        default: _(() => [
          i.value ? (s(), l("div", U, [
            (s(!0), l(x, null, g(t(d), (a, c) => (s(), y(t($), {
              key: c,
              style: { flex: "1 1 200px" },
              pub: c
            }, {
              default: _(() => [
                e("div", D, [
                  e("button", {
                    class: "button",
                    onClick: (r) => o.$emit("browse", c)
                  }, S, 8, F),
                  e("button", {
                    class: "button",
                    onClick: (r) => t(C)(c)
                  }, A, 8, T),
                  e("button", {
                    class: "button",
                    onClick: (r) => t(w)(a)
                  }, J, 8, G)
                ])
              ]),
              _: 2
            }, 1032, ["pub"]))), 128))
          ])) : u("", !0)
        ]),
        _: 1
      })
    ])) : u("", !0);
  }
});
export {
  X as default
};
//# sourceMappingURL=UserRooms-4b11aabc.js.map
