import { _ as changePassword, d as needsBootstrap, t as bootstrap } from "../chunks/account-db-Ou9GhEjB.js";
import { t as promptPassword } from "../chunks/prompt-BzK0flle.js";
//#region src/scripts/reset-password.js
if (needsBootstrap()) {
	console.log("It looks like you don't have a password set yet. Let's set one up now!");
	try {
		const { error } = await bootstrap({ password: await promptPassword() });
		if (error) {
			console.log("Error setting password:", error);
			console.log("Please report this as an issue: https://github.com/actualbudget/actual-server/issues");
			process.exit(1);
		}
		console.log("Password set!");
	} catch (err) {
		console.log("Unexpected error:", err);
		console.log("Please report this as an issue: https://github.com/actualbudget/actual-server/issues");
		process.exit(1);
	}
} else {
	console.log("It looks like you already have a password set. Let's reset it!");
	try {
		const { error } = changePassword(await promptPassword());
		if (error) {
			console.log("Error changing password:", error);
			console.log("Please report this as an issue: https://github.com/actualbudget/actual-server/issues");
			process.exit(1);
		}
		console.log("Password changed!");
		console.log("Note: you will need to log in with the new password on any browsers or devices that are currently logged in.");
	} catch (err) {
		console.log("Unexpected error:", err);
		console.log("Please report this as an issue: https://github.com/actualbudget/actual-server/issues");
		process.exit(1);
	}
}
//#endregion
export {};

//# sourceMappingURL=reset-password.js.map