import { r as redirect } from './exports-D1quPX8S.js';
import './utils-BSRjJDrZ.js';

//#region src/routes/login/+page.server.ts
/**
* Sanitize the post-login destination to an internal path only, defeating
* open-redirect via `?redirectTo=//evil.com` or `/\evil.com`.
*/
function _safeRedirect(target) {
	if (!target) return "/chat";
	if (!target.startsWith("/") || target.startsWith("//") || target.startsWith("/\\")) return "/chat";
	return target;
}
var load = ({ locals, url }) => {
	const redirectTo = _safeRedirect(url.searchParams.get("redirectTo"));
	if (locals.role === "admin") redirect(302, redirectTo);
	return { redirectTo };
};

var _page_server_ts = /*#__PURE__*/Object.freeze({
	__proto__: null,
	_safeRedirect: _safeRedirect,
	load: load
});

const index = 8;
let component_cache;
const component = async () => component_cache ??= (await import('./_page.svelte-DCeKtm_e.js')).default;
const server_id = "src/routes/login/+page.server.ts";
const imports = ["_app/immutable/nodes/8.xcsOM3k5.js","_app/immutable/chunks/BBI__kVO.js","_app/immutable/chunks/D2dFPcAY.js","_app/immutable/chunks/CymRgjIC.js","_app/immutable/chunks/CpzMlkvh.js","_app/immutable/chunks/xihTtKlq.js","_app/immutable/chunks/Oz5B_hgH.js"];
const stylesheets = ["_app/immutable/assets/Spinner.BtzHSsat.css","_app/immutable/assets/8.CY2RMSue.css"];
const fonts = [];

export { component, fonts, imports, index, _page_server_ts as server, server_id, stylesheets };
//# sourceMappingURL=8-CGnXBMny.js.map
