import { routes, saveActiveWorkspace } from "../../routes.js";
import { createApiClient } from "../../libs/create-client.js";
import ApiClientWeb_default from "./ApiClientWeb.vue.js";
import { createRouter, createWebHistory } from "vue-router";
//#region src/layouts/Web/create-api-client-web.ts
/**
* Mount the API Client to a given element.
*/
var createApiClientWeb = async (el, configuration = {}, mountOnInitialize = true) => {
	const router = createRouter({
		history: createWebHistory(),
		routes
	});
	const client = createApiClient({
		el,
		appComponent: ApiClientWeb_default,
		configuration,
		mountOnInitialize,
		router,
		layout: "web"
	});
	const { importSpecFile, importSpecFromUrl } = client.store;
	router.afterEach((to) => {
		saveActiveWorkspace(to);
	});
	if (configuration.url) await importSpecFromUrl(configuration.url, "default", { proxyUrl: configuration.proxyUrl });
	else if (configuration.content) await importSpecFile(configuration.content, "default");
	return client;
};
//#endregion
export { createApiClientWeb };

//# sourceMappingURL=create-api-client-web.js.map