import { defineComponent as f, ref as p, createElementBlock as l, createCommentVNode as m, unref as s, openBlock as o, createElementVNode as e, createVNode as k, toDisplayString as b, Transition as x, withCtx as c, Fragment as _, renderList as g, createBlock as y } from "vue";
import { useUser as C, enterRoom as w, recreateRoom as R } from "./composables-BAZQlC3e.js";
import { RoomCard as $ } from "./components.js";
const h = { class: "text-md font-bold mr-2" }, V = {
  key: 0,
  class: "i-la-angle-down"
}, B = {
  key: 1,
  class: "i-la-angle-up"
}, E = {
  key: 0,
  class: "flex flex-wrap gap-2"
}, N = { class: "p-4 flex flex-wrap gap-1" }, j = ["onClick"], O = ["onClick"], U = ["onClick"], T = /* @__PURE__ */ f({
  __name: "UserRooms",
  emits: ["browse"],
  setup(D, { emit: F }) {
    const { user: n } = C(), i = p(!1);
    return (v, t) => {
      var a;
      return Object.keys(s(n).rooms).length > 0 ? (o(), l("div", {
        class: "flex flex-col",
        key: (a = s(n)) == null ? void 0 : a.pub
      }, [
        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: t[0] || (t[0] = (d) => i.value = !i.value)
        }, [
          t[1] || (t[1] = e("div", { class: "text-lg font-bold" }, "My rooms", -1)),
          t[2] || (t[2] = e("div", { class: "flex-1" }, null, -1)),
          e("div", h, b(Object.keys(s(n).rooms).length), 1),
          i.value ? (o(), l("div", B)) : (o(), l("div", V))
        ]),
        k(x, {
          name: "fade",
          mode: "out-in"
        }, {
          default: c(() => [
            i.value ? (o(), l("div", E, [
              (o(!0), l(_, null, g(s(n).rooms, (d, r) => (o(), y(s($), {
                key: r,
                style: { flex: "1 1 200px" },
                pub: r
              }, {
                default: c(() => [
                  e("div", N, [
                    e("button", {
                      class: "button",
                      onClick: (u) => v.$emit("browse", r)
                    }, t[3] || (t[3] = [
                      e("div", { class: "i-la-eye" }, null, -1),
                      e("div", { class: "ml-2" }, "View", -1)
                    ]), 8, j),
                    e("button", {
                      class: "button",
                      onClick: (u) => s(w)(r)
                    }, t[4] || (t[4] = [
                      e("div", { class: "i-ion-enter-outline" }, null, -1),
                      e("div", { class: "ml-2" }, "Enter", -1)
                    ]), 8, O),
                    e("button", {
                      class: "button",
                      onClick: (u) => s(R)(d)
                    }, t[5] || (t[5] = [
                      e("div", { class: "i-la-tools" }, null, -1),
                      e("div", { class: "ml-2" }, "Renew", -1)
                    ]), 8, U)
                  ])
                ]),
                _: 2
              }, 1032, ["pub"]))), 128))
            ])) : m("", !0)
          ]),
          _: 1
        })
      ])) : m("", !0);
    };
  }
});
export {
  T as default
};
//# sourceMappingURL=UserRooms-DpsEUXf6.js.map
