import "../../../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { RequestContentTypeEnum } from "../../../../../../../enums/httpEnum.mjs";
import RequestGlobalConfig from "./components/RequestGlobalConfig/index.vue2.mjs";
import RequestTargetConfig from "./components/RequestTargetConfig/index.vue2.mjs";
import { defineComponent, watch, resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementVNode as createBaseVNode, createTextVNode } from "../../../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { toRefs, ref, unref } from "../../../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
import { toDisplayString } from "../../../../../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.mjs";
const _hoisted_1 = { class: "go-pr-3" };
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  props: {
    modelShow: Boolean,
    targetData: Object,
    saveBtnText: String || null
  },
  emits: ["update:modelShow", "sendHandle"],
  setup(__props, { emit }) {
    const props = __props;
    const { chartConfig } = toRefs(props.targetData);
    const { requestContentType } = toRefs(props.targetData.request);
    const modelShowRef = ref(false);
    const requestContentTypeObj = {
      [RequestContentTypeEnum.DEFAULT]: "普通请求",
      [RequestContentTypeEnum.SQL]: "SQL 请求"
    };
    watch(
      () => props.modelShow,
      (newValue) => {
        modelShowRef.value = newValue;
      },
      {
        immediate: true
      }
    );
    const closeAndSendHandle = () => {
      emit("update:modelShow", false);
      emit("sendHandle");
    };
    return (_ctx, _cache) => {
      const _component_n_space = resolveComponent("n-space");
      const _component_n_scrollbar = resolveComponent("n-scrollbar");
      const _component_n_text = resolveComponent("n-text");
      const _component_n_tag = resolveComponent("n-tag");
      const _component_n_button = resolveComponent("n-button");
      const _component_n_card = resolveComponent("n-card");
      const _component_n_modal = resolveComponent("n-modal");
      return openBlock(), createBlock(_component_n_modal, {
        class: "go-chart-data-request",
        show: modelShowRef.value,
        "onUpdate:show": _cache[0] || (_cache[0] = ($event) => modelShowRef.value = $event),
        "mask-closable": false,
        closeOnEsc: false
      }, {
        default: withCtx(() => [
          createVNode(_component_n_card, {
            bordered: false,
            role: "dialog",
            size: "small",
            "aria-modal": "true",
            style: { "width": "1000px", "height": "800px" }
          }, {
            header: withCtx(() => []),
            "header-extra": withCtx(() => []),
            action: withCtx(() => [
              createVNode(_component_n_space, { justify: "space-between" }, {
                default: withCtx(() => [
                  createBaseVNode("div", null, [
                    createVNode(_component_n_text, null, {
                      default: withCtx(() => [
                        createTextVNode("「 " + toDisplayString(unref(chartConfig).categoryName) + " 」", 1)
                      ]),
                      _: 1
                    }),
                    createVNode(_component_n_text, null, {
                      default: withCtx(() => [
                        createTextVNode("—— ")
                      ]),
                      _: 1
                    }),
                    createVNode(_component_n_tag, {
                      type: "primary",
                      bordered: false,
                      style: { "border-radius": "5px" }
                    }, {
                      default: withCtx(() => [
                        createTextVNode(toDisplayString(requestContentTypeObj[unref(requestContentType)]), 1)
                      ]),
                      _: 1
                    })
                  ]),
                  createVNode(_component_n_button, {
                    type: "primary",
                    onClick: closeAndSendHandle
                  }, {
                    default: withCtx(() => [
                      createTextVNode(toDisplayString(__props.saveBtnText || "保存 & 发送请求"), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              })
            ]),
            default: withCtx(() => [
              createVNode(_component_n_scrollbar, { style: { "max-height": "718px" } }, {
                default: withCtx(() => [
                  createBaseVNode("div", _hoisted_1, [
                    createVNode(_component_n_space, { vertical: "" }, {
                      default: withCtx(() => {
                        var _a;
                        return [
                          createVNode(unref(RequestGlobalConfig)),
                          createVNode(unref(RequestTargetConfig), {
                            "target-data-request": (_a = __props.targetData) == null ? void 0 : _a.request
                          }, null, 8, ["target-data-request"])
                        ];
                      }),
                      _: 1
                    })
                  ])
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["show"]);
    };
  }
});
export {
  _sfc_main as default
};
