import { ref as x, computed as _, nextTick as i, openBlock as v, createElementBlock as k, createBaseVNode as t, withDirectives as h, vModelText as b, uploadText as g, parseMd as w, pushScopeId as S, popScopeId as T } from "./composables-Ci32s3jE.js";
import { _export_sfc as I } from "./_plugin-vue_export-helper-DueaC3du.js";
const s = (l) => (S("data-v-a0d4e179"), l = l(), T(), l), M = { class: "flex flex-col" }, y = { class: "flex flex-col text-left" }, B = { class: "flex flex-wrap bg-dark-100 p-4" }, C = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "i-la-check" }, null, -1)), F = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "ml-2" }, "Save", -1)), $ = [
  C,
  F
], D = /* @__PURE__ */ s(() => /* @__PURE__ */ t("label", {
  class: "m-1 button cursor-pointer flex items-center",
  for: "import-post"
}, [
  /* @__PURE__ */ t("div", { class: "i-la-markdown" }),
  /* @__PURE__ */ t("div", { class: "ml-2" }, "Load")
], -1)), V = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "flex-1" }, null, -1)), E = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "i-la-trash" }, null, -1)), L = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "ml-2" }, "Reset", -1)), N = [
  E,
  L
], P = {
  __name: "FormText",
  props: {
    text: { type: String, default: "" }
  },
  emits: ["update:text", "frontmatter", "close"],
  setup(l, { emit: r }) {
    const d = r, c = l, p = x(!1), n = _({
      get() {
        return c.text;
      },
      set(a) {
        d("update:text", a);
      }
    });
    i(() => {
    });
    function m(a) {
      var e;
      g((e = a.target) == null ? void 0 : e.files, (o) => {
        let { frontmatter: u, content: f } = w(o);
        d("frontmatter", u), f && (p.value = !0, i(() => {
        }));
      });
    }
    return (a, e) => (v(), k("div", M, [
      t("div", y, [
        h(t("textarea", {
          class: "dark-bg-dark-200 p-2",
          id: "myMD",
          ref: "md",
          "onUpdate:modelValue": e[0] || (e[0] = (o) => n.value = o),
          placeholder: "Main text content (with **markdown** support)"
        }, null, 512), [
          [b, n.value]
        ])
      ]),
      t("div", B, [
        t("button", {
          class: "button m-1",
          onClick: e[1] || (e[1] = (o) => a.$emit("close"))
        }, $),
        D,
        t("input", {
          class: "hidden dark-bg-dark-200",
          id: "import-post",
          ref: "file",
          tabindex: "-1",
          type: "file",
          accept: "text/markdown",
          onChange: e[2] || (e[2] = (o) => m(o))
        }, null, 544),
        V,
        t("button", {
          class: "button m-1",
          onClick: e[3] || (e[3] = (o) => n.value = "")
        }, N)
      ])
    ]));
  }
}, j = /* @__PURE__ */ I(P, [["__scopeId", "data-v-a0d4e179"]]);
export {
  j as default
};
//# sourceMappingURL=FormText-CPVGsvCv.js.map
