import { ref as v, useNewProject as _, watchEffect as x, computed as y, openBlock as r, createElementBlock as n, createBaseVNode as s, unref as o, genUUID as g, toDisplayString as c, withDirectives as k, vModelText as C, createCommentVNode as a } from "./composables-9e873712.js";
const D = { class: "p-2" }, h = {
  key: 0,
  class: "flex flex-col gap-2 max-w-16em"
}, w = {
  class: "grid gap-2 items-center",
  style: { "grid-template-columns": "auto 1fr" }
}, b = /* @__PURE__ */ s("h3", null, "ID: ", -1), $ = /* @__PURE__ */ s("div", { class: "flex-1" }, null, -1), j = /* @__PURE__ */ s("div", { class: "i-la-sync" }, null, -1), A = /* @__PURE__ */ s("h3", null, "Title:", -1), B = { class: "text-xs overflow-scroll" }, P = {
  __name: "ProjectForm",
  props: {
    title: { type: String, default: "" },
    source: { type: String, default: "" },
    required: { type: Array, default: ["id", "title"] }
  },
  emits: ["added"],
  setup(m, { emit: E }) {
    const i = m, d = v(!1), { newProject: e, addProject: f } = _();
    x(() => {
      e.title = i.title, e.source = i.source;
    });
    const p = y(() => i.required.reduce((u, t) => u && !!(e != null && e[t]), !0));
    return (u, t) => (r(), n("div", D, [
      d.value ? (r(), n("div", h, [
        s("div", w, [
          b,
          s("div", {
            class: "p-2 flex items-center cursor-pointer gap-1",
            onClick: t[0] || (t[0] = (l) => o(e).id = o(g)(6))
          }, [
            s("pre", null, c(o(e).id), 1),
            $,
            j
          ]),
          A,
          k(s("input", {
            type: "text",
            "onUpdate:modelValue": t[1] || (t[1] = (l) => o(e).title = l)
          }, null, 512), [
            [C, o(e).title]
          ])
        ]),
        s("pre", B, c(o(e)), 1),
        o(p) ? (r(), n("button", {
          key: 0,
          class: "button",
          onClick: t[2] || (t[2] = (l) => o(f)(() => u.$emit("added")))
        }, "ADD PROJECT " + c(o(p)), 1)) : a("", !0)
      ])) : a("", !0),
      d.value ? a("", !0) : (r(), n("button", {
        key: 1,
        class: "button text-lg",
        onClick: t[3] || (t[3] = (l) => d.value = !0)
      }, "Add a new project"))
    ]));
  }
};
export {
  P as default
};
//# sourceMappingURL=ProjectForm-4bedc868.js.map
