'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var codemirrorEditorVue3 = require('./codemirror-editor-vue3.js');
var Codemirror = require('codemirror-editor-vue3');

"use strict";
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
  ...{
    name: "LlCodemirrorEditorVue3"
  },
  __name: "codemirror-editor-vue3",
  props: codemirrorEditorVue3.codemirrorEditorVue3Props,
  emits: codemirrorEditorVue3.codemirrorEditorVue3Emits,
  setup(__props, { expose: __expose, emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const codemirrorRef = vue.ref();
    const newValue = vue.computed({
      get() {
        return props.value;
      },
      set(v) {
        emits("update:value", v);
      }
    });
    const onChange = (v) => {
      emits("change", v);
    };
    const onBlur = (codeMirror, e) => {
      emits("blur", codeMirror, e);
    };
    const onFocus = (codeMirror, e) => {
      emits("focus", codeMirror, e);
    };
    const onScroll = (codeMirror) => {
      emits("scroll", codeMirror);
    };
    const onKeyup = (codeMirror, e) => {
      emits("keyup", codeMirror, e);
    };
    const codemirrorExpose = {
      cminstance() {
        return codemirrorRef.value?.cminstance;
      },
      destroy() {
        return codemirrorRef.value?.destroy();
      },
      refresh() {
        return codemirrorRef.value?.refresh();
      },
      resize() {
        return codemirrorRef.value?.resize();
      }
    };
    __expose(codemirrorExpose);
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(vue.unref(Codemirror), vue.mergeProps({
        ref_key: "codemirrorRef",
        ref: codemirrorRef
      }, _ctx.$attrs, {
        value: newValue.value,
        "onUpdate:value": _cache[0] || (_cache[0] = ($event) => newValue.value = $event),
        options: _ctx.options,
        placeholder: _ctx.placeholder,
        border: _ctx.border,
        width: _ctx.width,
        height: _ctx.height,
        "original-style": _ctx.originalStyle,
        "keep-cursor-in-end": _ctx.KeepCursorInEnd,
        merge: _ctx.merge,
        onChange,
        onBlur,
        onFocus,
        onScroll,
        onKeyup
      }), null, 16, ["value", "options", "placeholder", "border", "width", "height", "original-style", "keep-cursor-in-end", "merge"]);
    };
  }
});

exports.default = _sfc_main;
//# sourceMappingURL=codemirror-editor-vue3.vue2.js.map
