import { ref as r, openBlock as s, createElementBlock as d, createBaseVNode as m, toDisplayString as c, withKeys as v, withModifiers as b, createCommentVNode as u } from "./composables-9e873712.js";
const p = {
  key: 0,
  class: "flex mb-2 items-center gap-4"
}, x = ["contenteditable"], k = {
  __name: "FormTitle",
  props: {
    text: { type: String, default: "" },
    editable: Boolean
  },
  emits: ["update"],
  setup(t, { emit: f }) {
    const l = r(""), o = r(!1);
    function a(i) {
      f("update", i.target.innerText), i.target.blur(), o.value = !1;
    }
    return (i, e) => t.text || t.editable ? (s(), d("div", p, [
      m("div", {
        class: "p-0",
        ref_key: "content",
        ref: l,
        contenteditable: t.editable,
        onFocus: e[0] || (e[0] = (n) => o.value = !0),
        onBlur: e[1] || (e[1] = (n) => a(n)),
        onKeydown: e[2] || (e[2] = v(b((n) => a(n), ["prevent", "stop"]), ["enter"]))
      }, c(t.text || ""), 41, x),
      t.editable && !o.value ? (s(), d("div", {
        key: 0,
        class: "i-la-pen",
        onClick: e[3] || (e[3] = (n) => l.value.focus())
      })) : u("", !0)
    ])) : u("", !0);
  }
};
export {
  k as default
};
//# sourceMappingURL=FormTitle-de645c8e.js.map
