import { createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, ref, toRef, unref, useId } from "vue";
import { ScalarCodeBlockCopy } from "@scalar/components";
import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json";
import { useCodeMirror } from "@scalar/use-codemirror";
//#region src/v2/blocks/response-block/components/ResponseBodyRaw.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "scalar-code-block group/code-block body-raw relative grid min-h-0 overflow-hidden p-px outline-none has-focus-visible:outline" };
var _hoisted_2 = {
	class: "body-raw-scroller custom-scroll relative pr-1",
	tabindex: "0"
};
var ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "ResponseBodyRaw",
	props: {
		content: {},
		language: {}
	},
	setup(__props) {
		const props = __props;
		const codeMirrorRef = ref(null);
		/** Base id for the code block */
		const id = useId();
		const { codeMirror } = useCodeMirror({
			codeMirrorRef,
			readOnly: true,
			lineNumbers: true,
			content: toRef(() => prettyPrintJson(props.content)),
			language: toRef(() => props.language),
			forceFoldGutter: true
		});
		const getCurrentContent = () => {
			return codeMirror.value?.state.doc.toString() || "";
		};
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", {
				ref_key: "codeMirrorRef",
				ref: codeMirrorRef
			}, null, 512)]), getCurrentContent() ? (openBlock(), createBlock(unref(ScalarCodeBlockCopy), {
				key: 0,
				class: "absolute top-2 right-2",
				content: getCurrentContent(),
				"aria-controls": unref(id)
			}, null, 8, ["content", "aria-controls"])) : createCommentVNode("", true)]);
		};
	}
});
//#endregion
export { ResponseBodyRaw_vue_vue_type_script_setup_true_lang_default as default };

//# sourceMappingURL=ResponseBodyRaw.vue.script.js.map