import LabelInput_default from "./components/LabelInput.vue.js";
import Tabs_default from "./components/Tabs.vue.js";
import { createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, ref, unref, watch } from "vue";
import { RouterView } from "vue-router";
//#region src/v2/features/collection/WorkspaceCollection.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "custom-scroll h-full" };
var _hoisted_2 = { class: "w-full px-3 md:mx-auto md:max-w-180" };
var _hoisted_3 = ["aria-label"];
var _hoisted_4 = { class: "group relative ml-1.25" };
var _hoisted_5 = { class: "px-1.5 py-8" };
var WorkspaceCollection_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "WorkspaceCollection",
	props: {
		documentSlug: {},
		document: {},
		eventBus: {},
		layout: {},
		path: {},
		method: {},
		exampleName: {},
		environment: {},
		securitySchemes: {},
		workspaceStore: {},
		activeWorkspace: {},
		plugins: {},
		customThemes: {},
		currentTheme: {},
		isDarkMode: { type: Boolean },
		fetchRegistryDocument: { type: Function },
		telemetry: { type: Boolean },
		onUpdateTelemetry: { type: Function }
	},
	setup(__props) {
		const props = __props;
		/**
		* Local copy of the label so we can reset on empty-blur rejection and stay in
		* sync when Vue Router reuses this component across workspace navigations.
		*/
		const workspaceTitle = ref(props.activeWorkspace.label);
		watch(() => props.activeWorkspace.label, (newLabel) => {
			workspaceTitle.value = newLabel;
		});
		/** Emits the rename event on blur, or resets the input if the title is blank. */
		const handleUpdateWorkspaceTitle = (title) => {
			if (title.trim() === "") {
				workspaceTitle.value = props.activeWorkspace.label;
				return;
			}
			props.eventBus.emit("workspace:update:name", title);
		};
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
				createElementVNode("div", {
					"aria-label": `title: ${__props.activeWorkspace.label}`,
					class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-6"
				}, [createElementVNode("div", _hoisted_4, [createVNode(LabelInput_default, {
					modelValue: workspaceTitle.value,
					"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => workspaceTitle.value = $event),
					class: "text-xl font-bold",
					inputId: "workspaceName",
					placeholder: "Untitled Workspace",
					onBlur: handleUpdateWorkspaceTitle
				}, null, 8, ["modelValue"])])], 8, _hoisted_3),
				createVNode(Tabs_default, { type: "workspace" }),
				createElementVNode("div", _hoisted_5, [createVNode(unref(RouterView), mergeProps(props, { collectionType: "workspace" }), null, 16)])
			])]);
		};
	}
});
//#endregion
export { WorkspaceCollection_vue_vue_type_script_setup_true_lang_default as default };

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