import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref } from "vue";
import { ScalarIconCaretDown, ScalarIconCaretRight, ScalarIconWarning, ScalarIconXCircle } from "@scalar/icons";
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
//#region src/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "pointer-events-none absolute right-2 bottom-2 left-2 z-10" };
var _hoisted_2 = { class: "bg-b-1 shadow-border pointer-events-auto flex flex-col overflow-hidden rounded-lg text-[11px]" };
var _hoisted_3 = { class: "flex items-center gap-3" };
var _hoisted_4 = {
	class: "text-c-danger flex items-center gap-1",
	title: "Errors"
};
var _hoisted_5 = {
	class: "text-c-alert flex items-center gap-1",
	title: "Warnings"
};
var _hoisted_6 = { class: "text-c-3" };
var _hoisted_7 = {
	key: 0,
	class: "max-h-28 overflow-auto border-t"
};
var _hoisted_8 = ["onClick"];
var _hoisted_9 = { class: "min-w-0 flex-1" };
var _hoisted_10 = { class: "text-c-1 block truncate" };
var _hoisted_11 = { class: "text-c-3 block whitespace-nowrap" };
var _hoisted_12 = {
	key: 1,
	class: "text-c-3 border-t px-2.5 py-2"
};
var EditorDiagnosticsPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "EditorDiagnosticsPanel",
	props: {
		expanded: { type: Boolean },
		diagnosticCounts: {},
		visibleDiagnostics: {}
	},
	emits: ["toggle", "focusDiagnostic"],
	setup(__props, { emit: __emit }) {
		const emit = __emit;
		const getMarkerDotClass = (severity) => severity === monaco.MarkerSeverity.Error ? "bg-c-danger" : "bg-c-alert";
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("button", {
				class: "bg-b-2/30 hover:bg-b-2/50 flex items-center justify-between px-2.5 py-2 text-left",
				type: "button",
				onClick: _cache[0] || (_cache[0] = ($event) => emit("toggle"))
			}, [createElementVNode("span", _hoisted_3, [
				_cache[1] || (_cache[1] = createElementVNode("span", { class: "text-c-2 font-medium" }, "Problems", -1)),
				createElementVNode("span", _hoisted_4, [createVNode(unref(ScalarIconXCircle), { class: "size-3" }), createElementVNode("span", null, toDisplayString(__props.diagnosticCounts.errors), 1)]),
				createElementVNode("span", _hoisted_5, [createVNode(unref(ScalarIconWarning), { class: "size-3" }), createElementVNode("span", null, toDisplayString(__props.diagnosticCounts.warnings), 1)])
			]), createElementVNode("span", _hoisted_6, [__props.expanded ? (openBlock(), createBlock(unref(ScalarIconCaretDown), {
				key: 0,
				class: "size-3"
			})) : (openBlock(), createBlock(unref(ScalarIconCaretRight), {
				key: 1,
				class: "size-3"
			}))])]), __props.expanded ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.visibleDiagnostics.length ? (openBlock(), createElementBlock("div", _hoisted_7, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.visibleDiagnostics, (marker, index) => {
				return openBlock(), createElementBlock("button", {
					key: `${marker.owner}-${marker.startLineNumber}-${marker.startColumn}-${index}`,
					class: "hover:bg-b-2/40 flex w-full items-start gap-2 px-2.5 py-2 text-left",
					type: "button",
					onClick: ($event) => emit("focusDiagnostic", marker)
				}, [createElementVNode("span", { class: normalizeClass(["mt-0.5 size-1.5 shrink-0 rounded-full", getMarkerDotClass(marker.severity)]) }, null, 2), createElementVNode("span", _hoisted_9, [createElementVNode("span", _hoisted_10, toDisplayString(marker.message), 1), createElementVNode("span", _hoisted_11, " Ln " + toDisplayString(marker.startLineNumber) + ", Col " + toDisplayString(marker.startColumn), 1)])], 8, _hoisted_8);
			}), 128))])) : (openBlock(), createElementBlock("div", _hoisted_12, " Errors and warnings from the JSON/YAML language workers will show up here. "))], 64)) : createCommentVNode("", true)])]);
		};
	}
});
//#endregion
export { EditorDiagnosticsPanel_vue_vue_type_script_setup_true_lang_default as default };

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