import { ref as m, computed as f, nextTick as i, openBlock as x, createElementBlock as v, createBaseVNode as t, withDirectives as k, vModelText as h, unref as b, isRef as g, uploadText as w, parseMd as T, pushScopeId as y, popScopeId as S } from "./composables-078fa750.js";
import { _export_sfc as F } from "./_plugin-vue_export-helper-6a641814.js";
const s = (l) => (y("data-v-a0d4e179"), l = l(), S(), l), I = { class: "flex flex-col" }, M = { 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)), $ = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "ml-2" }, "Save", -1)), D = [
  C,
  $
], R = /* @__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: d }) {
    const r = l, c = m(!1), a = f({
      get() {
        return r.text;
      },
      set(n) {
        d("update:text", n);
      }
    });
    i(() => {
    });
    function p(n) {
      var e;
      w((e = n.target) == null ? void 0 : e.files, (o) => {
        let { frontmatter: u, content: _ } = T(o);
        d("frontmatter", u), _ && (c.value = !0, i(() => {
        }));
      });
    }
    return (n, e) => (x(), v("div", I, [
      t("div", M, [
        k(t("textarea", {
          class: "dark-bg-dark-200 p-2",
          id: "myMD",
          ref: "md",
          "onUpdate:modelValue": e[0] || (e[0] = (o) => g(a) ? a.value = o : null),
          placeholder: "Main text content (with **markdown** support)"
        }, null, 512), [
          [h, b(a)]
        ])
      ]),
      t("div", B, [
        t("button", {
          class: "button m-1",
          onClick: e[1] || (e[1] = (o) => n.$emit("close"))
        }, D),
        R,
        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) => p(o))
        }, null, 544),
        V,
        t("button", {
          class: "button m-1",
          onClick: e[3] || (e[3] = (o) => a.value = "")
        }, N)
      ])
    ]));
  }
}, q = /* @__PURE__ */ F(P, [["__scopeId", "data-v-a0d4e179"]]);
export {
  q as default
};
//# sourceMappingURL=FormText-18dbc669.js.map
