import { computed as d, createElementBlock as o, openBlock as s, createElementVNode as n, withDirectives as m, vModelText as v, createVNode as f, TransitionGroup as p, withCtx as h, Fragment as _, renderList as x, createBlock as r, unref as k, normalizeStyle as y, createCommentVNode as g } from "vue";
import { useProjects as C, currentRoom as w } from "./composables-BAZQlC3e.js";
import { ProjectCard as V } from "./components.js";
import $ from "./ProjectForm-CvKTXg7G.js";
const B = { class: "flex flex-col" }, N = { class: "p-2 flex flex-col gap-2" }, P = { class: "flex flex-wrap gap-4 p-2" }, b = { class: "p-2 flex flex-col gap-2" }, D = {
  __name: "ProjectList",
  emits: ["open"],
  setup(E) {
    const t = d(() => {
      var l;
      return C((l = w) == null ? void 0 : l.pub);
    });
    return (l, a) => (s(), o("div", B, [
      n("div", N, [
        m(n("input", {
          class: "p-2 rounded-xl shadow dark-bg-dark-400",
          "onUpdate:modelValue": a[0] || (a[0] = (e) => t.value.search.value = e),
          placeholder: "Start typing a project title"
        }, null, 512), [
          [v, t.value.search.value]
        ])
      ]),
      n("div", P, [
        f(p, { name: "list" }, {
          default: h(() => [
            (s(!0), o(_, null, x(t.value.candidates.value, (e, u) => {
              var c;
              return s(), r(k(V), {
                key: u,
                project: e == null ? void 0 : e.item,
                path: (c = e == null ? void 0 : e.item) == null ? void 0 : c.path,
                style: y({ opacity: 1 - (e == null ? void 0 : e.score) }),
                onClick: (L) => {
                  var i;
                  return l.$emit("open", (i = e == null ? void 0 : e.item) == null ? void 0 : i.path);
                }
              }, null, 8, ["project", "path", "style", "onClick"]);
            }), 128))
          ]),
          _: 1
        })
      ]),
      n("div", b, [
        t.value.search.value ? (s(), r($, {
          key: 0,
          title: t.value.search.value,
          onAdded: a[1] || (a[1] = (e) => t.value.search.value = "")
        }, null, 8, ["title"])) : g("", !0)
      ])
    ]));
  }
};
export {
  D as default
};
//# sourceMappingURL=ProjectList-CJwpmCTu.js.map
