import "../../../../base64-CmWvODNW.mjs";
import "../../../../types-CuW0zWDA.mjs";
import { t as OptionsRepository } from "../../../../options-DTTML-Tx.mjs";
import { n as apiSuccess, r as handleError, t as apiError } from "../../../../error-CkAseSqZ.mjs";

//#region src/astro/routes/api/setup/dev-reset.ts
const prerender = false;
const POST = async ({ locals }) => {
	if (!import.meta.env.DEV) return apiError("FORBIDDEN", "Dev reset is only available in development mode", 403);
	const { emdash } = locals;
	if (!emdash?.db) return apiError("NOT_CONFIGURED", "EmDash is not initialized", 500);
	try {
		const options = new OptionsRepository(emdash.db);
		await options.delete("emdash:setup_complete");
		await options.delete("emdash:setup_state");
		await emdash.db.deleteFrom("users").execute();
		return apiSuccess({ success: true });
	} catch (error) {
		return handleError(error, "Dev reset failed", "DEV_RESET_ERROR");
	}
};

//#endregion
export { POST, prerender };
//# sourceMappingURL=dev-reset.mjs.map