//#region src/utilities/redirect/LocalRedirectUrlStorage.js
const SessionStorageKey = "local-url";
const invalidPaths = [
	"/null",
	"/sso/entra",
	"/aad_callback",
	"/aad_redirect"
];
const ignoredParams = ["id_token_hint"];
const storeInitialPath = () => {
	if (!window.sessionStorage.getItem(SessionStorageKey) || invalidPaths.includes(window.sessionStorage.getItem(SessionStorageKey))) {
		const params = new URLSearchParams(window.location.search);
		ignoredParams.forEach((param) => params.delete(param));
		const queryString = params.toString();
		const path = window.location.pathname + (queryString ? `?${queryString}` : "");
		window.sessionStorage.setItem(SessionStorageKey, window.location.pathname === "/null" ? "/" : path);
	}
};
const storeCurrentPath = () => {
	window.sessionStorage.setItem(SessionStorageKey, window.location.pathname);
};
const storeRedirectPath = (pathname = window.location.pathname, search = window.location.search) => {
	if (!pathname || invalidPaths.includes(pathname)) return;
	const params = new URLSearchParams(search);
	ignoredParams.forEach((param) => params.delete(param));
	const queryString = params.toString();
	const path = pathname + (queryString ? `?${queryString}` : "");
	window.sessionStorage.setItem(SessionStorageKey, pathname === "/null" ? "/" : path);
};
const storePath = (pathname) => {
	window.sessionStorage.setItem(SessionStorageKey, pathname);
};
const getStoredPath = () => {
	return window.sessionStorage.getItem(SessionStorageKey);
};
const clearStoredPath = () => {
	window.sessionStorage.removeItem(SessionStorageKey);
};
//#endregion
export { clearStoredPath, getStoredPath, storeCurrentPath, storeInitialPath, storePath, storeRedirectPath };

//# sourceMappingURL=LocalRedirectUrlStorage.mjs.map