import { ref as v, useNewProject as _, watchEffect as x, computed as y, openBlock as r, createElementBlock as n, createBaseVNode as l, unref as o, genUUID as g, toDisplayString as a, withDirectives as k, vModelText as C, createCommentVNode as c } from "./composables-Ci32s3jE.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__ */ l("h3", null, "ID: ", -1), $ = /* @__PURE__ */ l("div", { class: "flex-1" }, null, -1), j = /* @__PURE__ */ l("div", { class: "i-la-sync" }, null, -1), A = /* @__PURE__ */ l("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, u = v(!1), { newProject: e, addProject: f } = _();
    x(() => {
      e.title = i.title, e.source = i.source;
    });
    const p = y(() => i.required.reduce((d, t) => d && !!(e != null && e[t]), !0));
    return (d, t) => (r(), n("div", D, [
      u.value ? (r(), n("div", h, [
        l("div", w, [
          b,
          l("div", {
            class: "p-2 flex items-center cursor-pointer gap-1",
            onClick: t[0] || (t[0] = (s) => o(e).id = o(g)(6))
          }, [
            l("pre", null, a(o(e).id), 1),
            $,
            j
          ]),
          A,
          k(l("input", {
            type: "text",
            "onUpdate:modelValue": t[1] || (t[1] = (s) => o(e).title = s)
          }, null, 512), [
            [C, o(e).title]
          ])
        ]),
        l("pre", B, a(o(e)), 1),
        p.value ? (r(), n("button", {
          key: 0,
          class: "button",
          onClick: t[2] || (t[2] = (s) => o(f)(() => d.$emit("added")))
        }, "ADD PROJECT " + a(p.value), 1)) : c("", !0)
      ])) : c("", !0),
      u.value ? c("", !0) : (r(), n("button", {
        key: 1,
        class: "button text-lg",
        onClick: t[3] || (t[3] = (s) => u.value = !0)
      }, "Add a new project"))
    ]));
  }
};
export {
  P as default
};
//# sourceMappingURL=ProjectForm-DNHrkWrQ.js.map
