<script lang="ts">
	/**
	 * Legacy bookmarks: /admin/org/:slug[/...] → /admin[/...]
	 * Tenancy lives on the silo host, not the path.
	 */
	import { onMount } from 'svelte';
	import { goto } from '$app/navigation';
	import { page } from '$app/state';

	onMount(() => {
		const raw = page.params.path ?? '';
		const segments = raw.split('/').filter(Boolean);
		// Drop the old org slug (first segment) when present.
		const rest = segments.length > 0 ? segments.slice(1).join('/') : '';
		const target = rest === '' ? '/admin' : `/admin/${rest}`;
		const q = page.url.search;
		void goto(`${target}${q}`, { replaceState: true });
	});
</script>

<div class="saas-status-panel">
	<p class="text-sm text-surface-600">正在重定向到新地址…</p>
</div>
