import { r as useWorkspace, w as useActiveEntities } from "./store-DpSUVhjp.js";
import { a as useLayout, r as useSidebar } from "./useSidebar-DLTwHDI-.js";
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BmmBcIzD.js";
import { t as importCurlCommand } from "./curl-nbw1OxbV.js";
import "./HttpMethod-rnWEgC3T.js";
import "./CodeInput-C-igR77V.js";
import "./Server-DnA_BzPS.js";
import { t as AddressBar_default } from "./AddressBar-B4xnl66I.js";
import { t as OpenApiClientButton_default } from "./components-ChixwQhN.js";
import "./Sidebar-C6AdX6-N.js";
import "./DataTableInput-yaU5g-kP.js";
import { t as ViewLayout_default } from "./ViewLayout-BOXN0IYo.js";
import { t as ViewLayoutContent_default } from "./ViewLayoutContent-CvMoJYPF.js";
import "./SectionFilter-hrtoRLwj.js";
import "./ScalarAsciiArt-BjuSnj8e.js";
import { t as RequestSection_default } from "./RequestSection-HhdJj9hW.js";
import "./RequestAuth-BzBfIysT.js";
import { t as ResponseSection_default } from "./ResponseSection-DMJ0tw8E.js";
import { t as EmptyState_default } from "./EmptyState-Cnm7hGW5.js";
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, isRef, normalizeClass, openBlock, unref, withCtx } from "vue";
import { ScalarIcon } from "@scalar/components";
import { useRouter } from "vue-router";
//#region src/views/Request/RequestSubpageHeader.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1$1 = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center border-b p-2 pt-2 lg:p-1 lg:pt-1" };
var _hoisted_2$1 = { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" };
var _hoisted_3 = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-1 lg:mb-0 lg:flex-1 lg:px-2.5" };
//#endregion
//#region src/views/Request/RequestSubpageHeader.vue
var RequestSubpageHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
	__name: "RequestSubpageHeader",
	props: {
		collection: {},
		operation: {},
		server: {},
		environment: {},
		envVariables: {},
		workspace: {}
	},
	emits: ["hideModal", "importCurl"],
	setup(__props) {
		const { hideClientButton, showSidebar, integration } = useWorkspace();
		const { isSidebarOpen } = useSidebar();
		const { layout } = useLayout();
		const { currentRoute } = useRouter();
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1$1, [
				createElementVNode("div", _hoisted_2$1, [unref(showSidebar) ? (openBlock(), createElementBlock("div", {
					key: 0,
					class: normalizeClass(["size-8", { hidden: unref(layout) === "modal" && !unref(isSidebarOpen) }])
				}, null, 2)) : createCommentVNode("", true)]),
				createVNode(AddressBar_default, {
					collection: __props.collection,
					envVariables: __props.envVariables,
					environment: __props.environment,
					operation: __props.operation,
					server: __props.server,
					workspace: __props.workspace,
					onImportCurl: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("importCurl", $event))
				}, null, 8, [
					"collection",
					"envVariables",
					"environment",
					"operation",
					"server",
					"workspace"
				]),
				createElementVNode("div", _hoisted_3, [
					unref(layout) === "modal" && __props.collection.documentUrl && !unref(hideClientButton) ? (openBlock(), createBlock(unref(OpenApiClientButton_default), {
						key: 0,
						buttonSource: "modal",
						class: "!w-fit lg:-mr-1",
						integration: unref(integration) ?? __props.collection.integration ?? null,
						source: unref(currentRoute).query.source === "gitbook" ? "gitbook" : "api-reference",
						url: __props.collection.documentUrl
					}, null, 8, [
						"integration",
						"source",
						"url"
					])) : createCommentVNode("", true),
					unref(layout) === "modal" ? (openBlock(), createElementBlock("button", {
						key: 1,
						class: "app-exit-button gitbook-hidden zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2",
						type: "button",
						onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("hideModal"))
					}, [createVNode(unref(ScalarIcon), {
						icon: "Close",
						size: "lg",
						thickness: "2"
					}), _cache[3] || (_cache[3] = createElementVNode("span", { class: "sr-only" }, "Close Client", -1))])) : createCommentVNode("", true),
					unref(layout) === "modal" ? (openBlock(), createElementBlock("button", {
						key: 2,
						class: "text-c-1 hover:bg-b-2 active:text-c-1 gitbook-show -mr-1.5 rounded p-2",
						type: "button",
						onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("hideModal"))
					}, [createVNode(unref(ScalarIcon), {
						icon: "Close",
						size: "md",
						thickness: "1.75"
					}), _cache[4] || (_cache[4] = createElementVNode("span", { class: "sr-only" }, "Close Client", -1))])) : createCommentVNode("", true)
				])
			]);
		};
	}
}), [["__scopeId", "data-v-c8df97c6"]]);
//#endregion
//#region src/views/Request/Request.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex h-full" };
var _hoisted_2 = {
	key: 0,
	class: "flex h-full flex-1 flex-col"
};
//#endregion
//#region src/views/Request/Request.vue
var Request_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
	__name: "Request",
	props: {
		invalidParams: {},
		selectedSecuritySchemeUids: {},
		requestResult: {}
	},
	emits: ["newTab"],
	setup(__props) {
		const { events } = useWorkspace();
		const { isSidebarOpen } = useSidebar();
		const workspaceContext = useWorkspace();
		const { layout } = useLayout();
		const { activeCollection, activeExample, activeRequest, activeWorkspace, activeServer, activeEnvVariables, activeEnvironment, activeWorkspaceRequests } = useActiveEntities();
		const { modalState, requestHistory } = workspaceContext;
		const activeHistoryEntry = computed(() => [...requestHistory].reverse().find((r) => r.request.uid === activeExample.value?.uid));
		function handleCurlImport(curl) {
			events.commandPalette.emit({
				commandName: "Import from cURL",
				metaData: {
					parsedCurl: importCurlCommand(curl),
					collectionUid: activeCollection.value?.uid
				}
			});
		}
		return (_ctx, _cache) => {
			return unref(activeCollection) && unref(activeWorkspace) ? (openBlock(), createElementBlock("div", {
				key: 0,
				class: normalizeClass(["bg-b-1 relative z-0 flex h-full flex-1 flex-col overflow-hidden pt-0", { "!mr-0 !mb-0 !border-0": unref(layout) === "modal" }])
			}, [createElementVNode("div", _hoisted_1, [unref(activeRequest) ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(RequestSubpageHeader_default, {
				modelValue: unref(isSidebarOpen),
				"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(isSidebarOpen) ? isSidebarOpen.value = $event : null),
				collection: unref(activeCollection),
				envVariables: unref(activeEnvVariables),
				environment: unref(activeEnvironment),
				operation: unref(activeRequest),
				server: unref(activeServer),
				workspace: unref(activeWorkspace),
				onHideModal: _cache[1] || (_cache[1] = () => unref(modalState).hide()),
				onImportCurl: handleCurlImport
			}, null, 8, [
				"modelValue",
				"collection",
				"envVariables",
				"environment",
				"operation",
				"server",
				"workspace"
			]), createVNode(ViewLayout_default, null, {
				default: withCtx(() => [unref(activeExample) ? (openBlock(), createBlock(ViewLayoutContent_default, {
					key: 0,
					class: normalizeClass(["flex-1", [unref(isSidebarOpen) ? "sidebar-active-hide-layout" : ""]])
				}, {
					default: withCtx(() => [createVNode(RequestSection_default, {
						collection: unref(activeCollection),
						envVariables: unref(activeEnvVariables),
						environment: unref(activeEnvironment),
						example: unref(activeExample),
						invalidParams: __props.invalidParams,
						operation: unref(activeRequest),
						selectedSecuritySchemeUids: __props.selectedSecuritySchemeUids,
						server: unref(activeServer),
						workspace: unref(activeWorkspace)
					}, null, 8, [
						"collection",
						"envVariables",
						"environment",
						"example",
						"invalidParams",
						"operation",
						"selectedSecuritySchemeUids",
						"server",
						"workspace"
					]), createVNode(ResponseSection_default, {
						collection: unref(activeCollection),
						numWorkspaceRequests: unref(activeWorkspaceRequests).length,
						operation: unref(activeRequest),
						requestResult: __props.requestResult,
						response: activeHistoryEntry.value?.response,
						workspace: unref(activeWorkspace)
					}, null, 8, [
						"collection",
						"numWorkspaceRequests",
						"operation",
						"requestResult",
						"response",
						"workspace"
					])]),
					_: 1
				}, 8, ["class"])) : createCommentVNode("", true)]),
				_: 1
			})])) : (openBlock(), createBlock(EmptyState_default, { key: 1 }))])], 2)) : (openBlock(), createBlock(EmptyState_default, { key: 1 }));
		};
	}
}), [["__scopeId", "data-v-57ae0d10"]]);
//#endregion
export { Request_default as default };

//# sourceMappingURL=Request-gscRsGQ8.js.map