import { ref as _, computed as f, nextTick as i, openBlock as x, createElementBlock as v, createElementVNode as t, withDirectives as k, isRef as h, vModelText as b, unref as g, pushScopeId as w, popScopeId as T } from "vue";
import { uploadText as y, parseMd as S } from "./composables-5f691338.js";
import { _export_sfc as F } from "./_plugin-vue_export-helper-6a641814.js";
const s = (l) => (w("data-v-a0d4e179"), l = l(), T(), l), I = { class: "flex flex-col" }, M = { class: "flex flex-col text-left" }, C = { class: "flex flex-wrap bg-dark-100 p-4" }, $ = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "i-la-check" }, null, -1)), B = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "ml-2" }, "Save", -1)), D = [
  $,
  B
], E = /* @__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)), R = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "flex-1" }, null, -1)), V = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "i-la-trash" }, null, -1)), L = /* @__PURE__ */ s(() => /* @__PURE__ */ t("div", { class: "ml-2" }, "Reset", -1)), N = [
  V,
  L
], P = {
  __name: "FormText",
  props: {
    text: { type: String, default: "" }
  },
  emits: ["update:text", "frontmatter", "close"],
  setup(l, { emit: d }) {
    const r = l, c = _(!1), a = f({
      get() {
        return r.text;
      },
      set(n) {
        d("update:text", n);
      }
    });
    i(() => {
    });
    function p(n) {
      var e;
      y((e = n.target) == null ? void 0 : e.files, (o) => {
        let { frontmatter: m, content: u } = S(o);
        d("frontmatter", m), 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) => h(a) ? a.value = o : null),
          placeholder: "Main text content (with **markdown** support)"
        }, null, 512), [
          [b, g(a)]
        ])
      ]),
      t("div", C, [
        t("button", {
          class: "button m-1",
          onClick: e[1] || (e[1] = (o) => n.$emit("close"))
        }, D),
        E,
        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),
        R,
        t("button", {
          class: "button m-1",
          onClick: e[3] || (e[3] = (o) => a.value = "")
        }, N)
      ])
    ]));
  }
}, z = /* @__PURE__ */ F(P, [["__scopeId", "data-v-a0d4e179"]]);
export {
  z as default
};
//# sourceMappingURL=FormText-5914d780.js.map
