import { s as setActiveId } from './endpoints-UdQGgKsR.js';
import { w as withAdminBody, e as errorResponse, k as jsonResponse } from './helpers-kzwksNq1.js';
import './state-fxN45gBp.js';
import './src-CidJbygh.js';
import './chunk-CLZ62Ad-.js';
import 'node:module';
import './provider-constants-DPrj3yBX.js';
import './dist-DOFcG0Zp.js';
import 'node:fs';
import 'node:path';
import 'buffer';
import 'fs';
import 'path';
import 'node:child_process';
import 'node:url';
import 'node:crypto';
import 'events';
import 'node:events';
import 'node:stream';
import 'node:string_decoder';
import 'assert';
import 'zlib';
import 'node:assert';
import 'node:fs/promises';
import 'node:os';

//#region src/routes/admin/endpoints/active/+server.ts
var POST = async (event) => withAdminBody(event, async ({ requestId, body }) => {
	const id = typeof body.id === "string" ? body.id : "";
	if (!id) return errorResponse(400, "invalid_request", "id is required", {}, requestId);
	try {
		const active = setActiveId(id);
		return jsonResponse(200, {
			activeId: active.id,
			endpoint: {
				id: active.id,
				label: active.label,
				url: active.url,
				isDefault: active.isDefault,
				hasPassword: Boolean(active.password)
			}
		}, requestId);
	} catch (e) {
		return errorResponse(404, "not_found", e instanceof Error ? e.message : "failed to set active endpoint", {}, requestId);
	}
});

export { POST };
//# sourceMappingURL=_server.ts-c_lwcz9M.js.map
