import { useCssVars as V, useColor as P, computed as x, ref as c, onMounted as j, reactive as z, openBlock as b, createElementBlock as k, withDirectives as C, vModelText as y, createCommentVNode as B, createBaseVNode as l, withKeys as D, withModifiers as M, normalizeClass as _, createVNode as n, withCtx as g, unref as i, addPost as N, pushScopeId as T, popScopeId as K } from "./composables-Ci32s3jE.js";
import { FormPicture as w, FormLink as L, FormYoutube as h, UiLayer as U, FormText as A } from "./components.js";
import { _export_sfc as E } from "./_plugin-vue_export-helper-DueaC3du.js";
const u = (d) => (T("data-v-c53fdb98"), d = d(), K(), d), H = {
  class: "w-full flex flex-col p-2 shadow-xl m-1 rounded-2xl",
  action: "javascript:void(0);"
}, R = { class: "flex flex-wrap z-100" }, Y = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "i-la-info-circle" }, null, -1)), q = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "i-mdi-text-long" }, null, -1)), G = [
  q
], J = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "flex-1" }, null, -1)), O = { class: "flex justify-center flex-1" }, Q = ["disabled"], W = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "i-la-check" }, null, -1)), X = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "font-bold ml-2" }, "Submit", -1)), Z = [
  W,
  X
], tt = /* @__PURE__ */ u(() => /* @__PURE__ */ l("div", { class: "i-la-trash-alt" }, null, -1)), et = [
  tt
], ot = {
  __name: "PostForm",
  props: {
    tag: {
      type: String,
      default: " "
    }
  },
  emits: ["close"],
  setup(d, { emit: $ }) {
    V((a) => ({
      "569a1dcc": I.value
    }));
    const r = d, S = $, F = P("deep"), I = x(() => F.hex(r.tag)), v = c();
    j(() => {
      var a;
      (a = v.value) == null || a.focus();
    });
    const o = c({}), s = z({
      form: !1,
      youtube: !1,
      text: !1
    }), f = x(() => o.value.title || o.value.statement || o.value.text || o.value.cover);
    function p() {
      if (!f.value) return;
      const a = {
        ...o.value
      };
      N(r.tag, a), m();
    }
    function m() {
      s.form = !1, o.value = {}, S("close");
    }
    return (a, t) => (b(), k("form", H, [
      s.title ? C((b(), k("input", {
        key: 0,
        class: "font-bold text-xl dark-bg-dark-200",
        ref_key: "titleInput",
        ref: v,
        "onUpdate:modelValue": t[0] || (t[0] = (e) => o.value.title = e),
        placeholder: "Title",
        autofocus: ""
      }, null, 512)), [
        [y, o.value.title]
      ]) : B("", !0),
      C(l("textarea", {
        class: "text-1rem leading-relaxed dark-bg-dark-200",
        "onUpdate:modelValue": t[1] || (t[1] = (e) => o.value.statement = e),
        placeholder: "Short text statement",
        onKeyup: t[2] || (t[2] = D(M((e) => p(), ["ctrl"]), ["enter"]))
      }, null, 544), [
        [y, o.value.statement]
      ]),
      l("div", R, [
        l("button", {
          class: _(["button m-1", { active: o.value.title }]),
          title: "Add a heading",
          onClick: t[3] || (t[3] = (e) => s.title = !s.title)
        }, "H1", 2),
        n(i(w), {
          field: "icon",
          options: { picSize: 400, preserveRatio: !1 },
          onUpdate: t[4] || (t[4] = (e) => o.value.icon = e)
        }, {
          default: g(() => [
            Y
          ]),
          _: 1
        }),
        n(i(w), {
          onUpdate: t[5] || (t[5] = (e) => o.value.cover = e)
        }),
        n(i(L), {
          onUpdate: t[6] || (t[6] = (e) => o.value.link = e)
        }),
        n(i(h), {
          onUpdate: t[7] || (t[7] = (e) => o.value.youtube = e)
        }),
        l("button", {
          class: _(["m-1 button", { active: o.value.text }]),
          onClick: t[8] || (t[8] = (e) => s.text = !0)
        }, G, 2),
        J,
        l("div", O, [
          l("button", {
            class: "plus button flex-1 justify-center m-1",
            disabled: !f.value,
            type: "submit",
            onClick: t[9] || (t[9] = (e) => p())
          }, Z, 8, Q),
          l("button", {
            class: "m-1 button text-xl",
            onClick: t[10] || (t[10] = (e) => m())
          }, et)
        ])
      ]),
      n(i(U), {
        open: s.youtube,
        offset: "22vh",
        onClose: t[11] || (t[11] = (e) => s.youtube = !1)
      }, null, 8, ["open"]),
      n(i(U), {
        open: s.text,
        offset: "22vh",
        onClose: t[14] || (t[14] = (e) => s.text = !1)
      }, {
        default: g(() => [
          n(i(A), {
            text: o.value.text,
            "onUpdate:text": t[12] || (t[12] = (e) => o.value.text = e),
            onClose: t[13] || (t[13] = (e) => s.text = !1)
          }, null, 8, ["text"])
        ]),
        _: 1
      }, 8, ["open"])
    ]));
  }
}, it = /* @__PURE__ */ E(ot, [["__scopeId", "data-v-c53fdb98"]]);
export {
  it as default
};
//# sourceMappingURL=PostForm-DS357NwM.js.map
