import { defineComponent, ref, inject, watch, resolveComponent, createBlock, openBlock, withCtx, createCommentVNode, unref } from 'vue';
import '../config/index.mjs';
import './batch-editing.vue.mjs';
import _sfc_main$1 from './batch-editing.vue2.mjs';
import { apiModalEmits, apiModalProps } from '../config/api-modal.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlApiModal" },
  __name: "api-modal",
  props: apiModalProps,
  emits: apiModalEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const innerValue = ref(props.value);
    const disabled = inject("disabled");
    const handleCancel = () => {
      emits("update:open", false);
    };
    const handleOk = () => {
      emits("update:open", false);
      emits("ok", innerValue.value);
    };
    watch(innerValue, (n) => {
      emits("update:value", n);
    });
    return (_ctx, _cache) => {
      const _component_ll_codemirror_editor_vue3 = resolveComponent("ll-codemirror-editor-vue3");
      const _component_ll_textarea = resolveComponent("ll-textarea");
      const _component_ll_new_modal = resolveComponent("ll-new-modal");
      return openBlock(), createBlock(_component_ll_new_modal, {
        open: props.open,
        title: "\u7F16\u8F91",
        width: "700px",
        onOk: handleOk,
        onCancel: handleCancel
      }, {
        default: withCtx(() => [
          props.type === "code" ? (openBlock(), createBlock(_component_ll_codemirror_editor_vue3, {
            key: 0,
            value: innerValue.value,
            "onUpdate:value": _cache[0] || (_cache[0] = ($event) => innerValue.value = $event),
            language: "json",
            disabled: unref(disabled),
            height: "500px",
            options: { minimap: { enabled: false } }
          }, null, 8, ["value", "disabled"])) : createCommentVNode("v-if", true),
          props.type === "textarea" ? (openBlock(), createBlock(_component_ll_textarea, {
            key: 1,
            value: innerValue.value,
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => innerValue.value = $event),
            disabled: unref(disabled),
            autosize: { minRows: 15 }
          }, null, 8, ["value", "disabled"])) : createCommentVNode("v-if", true),
          props.type === "batch" ? (openBlock(), createBlock(_sfc_main$1, {
            key: 2,
            value: innerValue.value,
            "onUpdate:value": _cache[2] || (_cache[2] = ($event) => innerValue.value = $event)
          }, null, 8, ["value"])) : createCommentVNode("v-if", true)
        ]),
        _: 1
        /* STABLE */
      }, 8, ["open"]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=api-modal.vue2.mjs.map
