From c8b711e2f88bc82e2c6bff36663c9f26b50cc34c Mon Sep 17 00:00:00 2001 From: Toni Nowak Date: Tue, 23 Jun 2026 00:09:48 +0200 Subject: [PATCH] feat: SurrealDB storage status endpoint + rewrite dead Storage tab UI - Add GET /api/dashboard/storage/status returning backend/url/namespace/ database/healthy/counts/health_grade (SurrealDB-only) - Rewrite StoragePage.tsx to use new endpoint via useStorageStatus() - Rewrite StorageStatusCard.tsx accepting SurrealDBStorageStatus (not old SQLite/InfinityDB shape) - Delete MigrationCard.tsx + MigrationProgress.tsx (dead since SurrealDB-only) - Drop dead hooks (useMigrationJob, useStartMigration, useSetBackend) from useStorage.ts; keep useTierStats - Replace StorageStatusResponse/MigrationJobStatus/SetBackendResponse types with SurrealDBStorageStatus in types.ts - Add 3 unit tests: 200+surrealdb backend, healthy=false on stats-fail, url/ns/db passthrough - Rebuild dist --- dashboard/src/api/hooks/useStorage.ts | 57 +---- dashboard/src/api/types.ts | 44 +--- .../src/features/storage/MigrationCard.tsx | 218 ------------------ .../features/storage/MigrationProgress.tsx | 64 ----- .../src/features/storage/StoragePage.tsx | 75 +----- .../features/storage/StorageStatusCard.tsx | 133 ++++++----- .../server/routes/dashboard_api.py | 86 +++++++ ...e-DxR1C_Ua.js => DiagramsPage-DbhaKtcI.js} | 2 +- ...-By828lS5.js => EvolutionPage-CzD9dgSX.js} | 2 +- ...Page-DwQB1_DY.js => GraphPage-CrI1ELz_.js} | 2 +- ...age-DetJg-Qr.js => HealthPage-9CH7uxp0.js} | 2 +- ...age-7FBeVFXa.js => OraclePage--QnA7bus.js} | 2 +- ...e-xe8kFqX3.js => OverviewPage-uovTY60B.js} | 2 +- ...roGate-CwBF4etn.js => ProGate-37WFbaAW.js} | 2 +- ...e-CH2mIMiD.js => SettingsPage-BwQ0sSKJ.js} | 2 +- .../dist/assets/StoragePage-CLDPXEH8.js | 1 - .../dist/assets/StoragePage-Dfp1G5qu.js | 1 + ...cPage-MbtH1dwD.js => SyncPage-CNbeBod6.js} | 2 +- ...e-BIybkdH4.js => TimelinePage-C2MQrnce.js} | 2 +- ...-BA-DvxES.js => ToolStatsPage-zZWqg3RV.js} | 2 +- ...-B_IPrBGU.js => VisualizePage-D-CKRU7v.js} | 2 +- .../{card-B0vNsxr_.js => card-CB2KYkrP.js} | 2 +- .../static/dist/assets/index-BFkJgtCN.css | 1 - .../static/dist/assets/index-CWIfFh7B.css | 1 + .../{index-C26pxqlr.js => index-DzyKsRxc.js} | 4 +- ...leton-DQJ-n00q.js => skeleton-B4zDkVHp.js} | 2 +- .../server/static/dist/index.html | 4 +- tests/unit/test_dashboard_api.py | 49 ++++ 28 files changed, 260 insertions(+), 506 deletions(-) delete mode 100755 dashboard/src/features/storage/MigrationCard.tsx delete mode 100755 dashboard/src/features/storage/MigrationProgress.tsx rename src/surreal_memory/server/static/dist/assets/{DiagramsPage-DxR1C_Ua.js => DiagramsPage-DbhaKtcI.js} (99%) rename src/surreal_memory/server/static/dist/assets/{EvolutionPage-By828lS5.js => EvolutionPage-CzD9dgSX.js} (94%) rename src/surreal_memory/server/static/dist/assets/{GraphPage-DwQB1_DY.js => GraphPage-CrI1ELz_.js} (99%) rename src/surreal_memory/server/static/dist/assets/{HealthPage-DetJg-Qr.js => HealthPage-9CH7uxp0.js} (98%) rename src/surreal_memory/server/static/dist/assets/{OraclePage-7FBeVFXa.js => OraclePage--QnA7bus.js} (99%) rename src/surreal_memory/server/static/dist/assets/{OverviewPage-xe8kFqX3.js => OverviewPage-uovTY60B.js} (98%) rename src/surreal_memory/server/static/dist/assets/{ProGate-CwBF4etn.js => ProGate-37WFbaAW.js} (71%) rename src/surreal_memory/server/static/dist/assets/{SettingsPage-CH2mIMiD.js => SettingsPage-BwQ0sSKJ.js} (97%) delete mode 100644 src/surreal_memory/server/static/dist/assets/StoragePage-CLDPXEH8.js create mode 100644 src/surreal_memory/server/static/dist/assets/StoragePage-Dfp1G5qu.js rename src/surreal_memory/server/static/dist/assets/{SyncPage-MbtH1dwD.js => SyncPage-CNbeBod6.js} (98%) rename src/surreal_memory/server/static/dist/assets/{TimelinePage-BIybkdH4.js => TimelinePage-C2MQrnce.js} (98%) rename src/surreal_memory/server/static/dist/assets/{ToolStatsPage-BA-DvxES.js => ToolStatsPage-zZWqg3RV.js} (97%) rename src/surreal_memory/server/static/dist/assets/{VisualizePage-B_IPrBGU.js => VisualizePage-D-CKRU7v.js} (94%) rename src/surreal_memory/server/static/dist/assets/{card-B0vNsxr_.js => card-CB2KYkrP.js} (86%) delete mode 100644 src/surreal_memory/server/static/dist/assets/index-BFkJgtCN.css create mode 100644 src/surreal_memory/server/static/dist/assets/index-CWIfFh7B.css rename src/surreal_memory/server/static/dist/assets/{index-C26pxqlr.js => index-DzyKsRxc.js} (99%) rename src/surreal_memory/server/static/dist/assets/{skeleton-DQJ-n00q.js => skeleton-B4zDkVHp.js} (69%) diff --git a/dashboard/src/api/hooks/useStorage.ts b/dashboard/src/api/hooks/useStorage.ts index aed16bab..9a89dea0 100755 --- a/dashboard/src/api/hooks/useStorage.ts +++ b/dashboard/src/api/hooks/useStorage.ts @@ -1,49 +1,20 @@ -import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query" +import { useQuery } from "@tanstack/react-query" import { api } from "@/api/client" -import type { - StorageStatusResponse, - MigrationJobStatus, - SetBackendResponse, - TierDistribution, -} from "@/api/types" +import type { SurrealDBStorageStatus, TierDistribution } from "@/api/types" const keys = { status: ["storage", "status"] as const, - job: (id: string) => ["storage", "job", id] as const, tierStats: ["storage", "tier-stats"] as const, } +/** + * Fetch SurrealDB storage status (backend, connection, live counts). + * Replaces the old SQLite/InfinityDB useStorageStatus hook — SurrealDB-only. + */ export function useStorageStatus() { return useQuery({ queryKey: keys.status, - queryFn: () => api.get("/api/dashboard/storage/status"), - }) -} - -export function useMigrationJob(jobId: string | null) { - return useQuery({ - queryKey: keys.job(jobId ?? ""), - queryFn: () => - api.get(`/api/dashboard/storage/migrate/${jobId}`), - enabled: !!jobId, - refetchInterval: (query) => { - const state = query.state.data?.state - return state === "running" ? 1500 : false - }, - }) -} - -export function useStartMigration() { - const queryClient = useQueryClient() - return useMutation({ - mutationFn: (direction: "to_infinitydb" | "to_sqlite") => - api.post<{ job_id: string; brain: string; message: string; disk_warning?: string }>( - "/api/dashboard/storage/migrate", - { direction }, - ), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: keys.status }) - }, + queryFn: () => api.get("/api/dashboard/storage/status"), }) } @@ -53,17 +24,3 @@ export function useTierStats() { queryFn: () => api.get("/api/dashboard/tier-stats"), }) } - -export function useSetBackend() { - const queryClient = useQueryClient() - return useMutation({ - mutationFn: (backend: "sqlite" | "infinitydb") => - api.post("/api/dashboard/storage/backend", { - backend, - }), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: keys.status }) - queryClient.invalidateQueries({ queryKey: ["dashboard", "stats"] }) - }, - }) -} diff --git a/dashboard/src/api/types.ts b/dashboard/src/api/types.ts index 090665cf..2295a9b5 100755 --- a/dashboard/src/api/types.ts +++ b/dashboard/src/api/types.ts @@ -252,38 +252,18 @@ export interface SyncConfigUpdateResponse { conflict_strategy: string } -// GET /api/dashboard/storage/status -export interface StorageStatusResponse { - current_backend: "sqlite" | "infinitydb" - pro_installed: boolean - is_pro_license: boolean - sqlite_exists: boolean - sqlite_size_bytes: number - infinitydb_exists: boolean - migration_job: MigrationJobStatus | null -} - -// POST /api/dashboard/storage/migrate + GET /api/dashboard/storage/migrate/{job_id} -export interface MigrationJobStatus { - job_id: string - state: "running" | "done" | "error" - direction: "to_infinitydb" | "to_sqlite" - brain: string - neurons_total: number - neurons_done: number - synapses_total: number - synapses_done: number - fibers_total: number - fibers_done: number - error: string | null - started_at: string - finished_at: string | null -} - -// POST /api/dashboard/storage/backend -export interface SetBackendResponse { - status: "switched" | "unchanged" - backend: string +// GET /api/dashboard/storage/status (SurrealDB-only) +export interface SurrealDBStorageStatus { + backend: "surrealdb" + url: string + namespace: string + database: string + healthy: boolean + active_brain: string + neuron_count: number + fiber_count: number + synapse_count: number + health_grade: string } // GET /health diff --git a/dashboard/src/features/storage/MigrationCard.tsx b/dashboard/src/features/storage/MigrationCard.tsx deleted file mode 100755 index c766908b..00000000 --- a/dashboard/src/features/storage/MigrationCard.tsx +++ /dev/null @@ -1,218 +0,0 @@ -import { useEffect, useState } from "react" -import type { StorageStatusResponse } from "@/api/types" -import { - useStartMigration, - useMigrationJob, - useSetBackend, -} from "@/api/hooks/useStorage" -import { ProGate } from "@/components/common/ProGate" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Button } from "@/components/ui/button" -import { Badge } from "@/components/ui/badge" -import { MigrationProgress } from "./MigrationProgress" -import { toast } from "sonner" -import { useTranslation } from "react-i18next" -import { - ArrowsLeftRight, - SpinnerGap, - CheckCircle, - Warning, - Lightning, -} from "@phosphor-icons/react" - -interface MigrationCardProps { - status: StorageStatusResponse -} - -export function MigrationCard({ status }: MigrationCardProps) { - const { t } = useTranslation() - const [localJobId, setLocalJobId] = useState(null) - - // Sync from parent status — picks up running/done jobs on page load or refetch - const activeJobId = - localJobId ?? (status.migration_job ? status.migration_job.job_id : null) - - useEffect(() => { - if (status.migration_job?.state === "running" && !localJobId) { - setLocalJobId(status.migration_job.job_id) - } - }, [status.migration_job, localJobId]) - - const startMigration = useStartMigration() - const setBackend = useSetBackend() - const { data: job } = useMigrationJob(activeJobId) - - const isRunning = job?.state === "running" - const isDone = job?.state === "done" - const isError = job?.state === "error" - const isSqlite = status.current_backend === "sqlite" - - const handleMigrate = (direction: "to_infinitydb" | "to_sqlite") => { - startMigration.mutate(direction, { - onSuccess: (data) => { - setLocalJobId(data.job_id) - toast.success(t("storage.migrationStarted")) - if (data.disk_warning) { - toast.warning(data.disk_warning) - } - }, - onError: (err) => { - toast.error( - err instanceof Error ? err.message : t("storage.migrationFailed"), - ) - }, - }) - } - - const handleSwitchBackend = (backend: "sqlite" | "infinitydb") => { - setBackend.mutate(backend, { - onSuccess: (data) => { - if (data.status === "switched") { - toast.success(t("storage.backendSwitched", { backend: data.backend })) - setLocalJobId(null) - } - }, - onError: () => toast.error(t("storage.switchFailed")), - }) - } - - const migrationContent = ( - - - - - - - {/* Why upgrade bullets (when on SQLite) */} - {isSqlite && !activeJobId && ( -
-
-
-
    -
  • {t("storage.whyBullet1")}
  • -
  • {t("storage.whyBullet2")}
  • -
  • {t("storage.whyBullet3")}
  • -
-
- )} - - {/* Migration progress */} - {job && isRunning && } - - {/* Done state — confirm switch */} - {job && isDone && ( -
-
-
- - -
- )} - - {/* Error state */} - {job && isError && ( -
-
-
- {job.error && ( -

{job.error}

- )} - -
- )} - - {/* Action buttons */} - {!activeJobId && ( -
- {isSqlite && ( - - )} - {!isSqlite && ( - - )} -
- )} - - {/* Running indicator */} - {isRunning && ( - - - )} -
-
- ) - - // Rollback is always accessible (no Pro gate) - if (!isSqlite) { - return migrationContent - } - - // Forward migration requires Pro - return {migrationContent} -} diff --git a/dashboard/src/features/storage/MigrationProgress.tsx b/dashboard/src/features/storage/MigrationProgress.tsx deleted file mode 100755 index 1775885d..00000000 --- a/dashboard/src/features/storage/MigrationProgress.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import type { MigrationJobStatus } from "@/api/types" -import { useTranslation } from "react-i18next" -import { cn } from "@/lib/utils" - -interface MigrationProgressProps { - job: MigrationJobStatus -} - -function ProgressBar({ - label, - done, - total, -}: { - label: string - done: number - total: number -}) { - const pct = total > 0 ? Math.min((done / total) * 100, 100) : 0 - const isDone = total > 0 && done >= total - - return ( -
-
- {label} - - {total > 0 ? `${done.toLocaleString()} / ${total.toLocaleString()}` : "—"} - -
-
-
-
-
- ) -} - -export function MigrationProgress({ job }: MigrationProgressProps) { - const { t } = useTranslation() - - return ( -
- - - -
- ) -} diff --git a/dashboard/src/features/storage/StoragePage.tsx b/dashboard/src/features/storage/StoragePage.tsx index 156bbcfe..d46866cf 100755 --- a/dashboard/src/features/storage/StoragePage.tsx +++ b/dashboard/src/features/storage/StoragePage.tsx @@ -1,26 +1,23 @@ -import { useStats } from "@/api/hooks/useDashboard" -import { useTierStats } from "@/api/hooks/useStorage" +import { useStorageStatus, useTierStats } from "@/api/hooks/useStorage" +import { StorageStatusCard } from "./StorageStatusCard" import { TierDistributionCard } from "./TierDistributionCard" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Badge } from "@/components/ui/badge" import { Skeleton } from "@/components/ui/skeleton" import { useTranslation } from "react-i18next" -import { Database } from "@phosphor-icons/react" /** * SurrealDB-only storage view. * - * The legacy SQLite↔InfinityDB backend switch and migration flow were removed - * in the SurrealDB-only release (#28), along with the /storage/status endpoint. - * This page now reports the active SurrealDB store using the live /stats and - * /tier-stats endpoints — no backend migration UI. + * Shows live SurrealDB connection status (backend, URL, health grade, counts) + * from GET /api/dashboard/storage/status, plus the tier distribution card. + * The legacy SQLite/InfinityDB migration flow was removed in the SurrealDB-only + * release — no backend switching is needed or available. */ export default function StoragePage() { - const { data: stats, isLoading } = useStats() + const { data: status, isLoading } = useStorageStatus() const { data: tierStats } = useTierStats() const { t } = useTranslation() - if (isLoading || !stats) { + if (isLoading || !status) { return (

{t("storage.title")}

@@ -32,65 +29,11 @@ export default function StoragePage() { ) } - const brain = stats.active_brain ?? "default" - return (

{t("storage.title")}

- - - - - - -
- - - - - - {t("storage.brain", "Brain")}:{" "} - {brain} - - - {t("storage.grade", "Grade")}: {stats.health_grade} - -
- -
-
-
- {t("storage.neurons", "Neurons")} -
-
- {stats.total_neurons.toLocaleString()} -
-
-
-
- {t("storage.synapses", "Synapses")} -
-
- {stats.total_synapses.toLocaleString()} -
-
-
-
- {t("storage.fibers", "Fibers")} -
-
- {stats.total_fibers.toLocaleString()} -
-
-
-
-
- + {tierStats && tierStats.total > 0 && ( )} diff --git a/dashboard/src/features/storage/StorageStatusCard.tsx b/dashboard/src/features/storage/StorageStatusCard.tsx index 7f2092eb..f4a1615a 100755 --- a/dashboard/src/features/storage/StorageStatusCard.tsx +++ b/dashboard/src/features/storage/StorageStatusCard.tsx @@ -1,84 +1,105 @@ -import type { StorageStatusResponse } from "@/api/types" +import type { SurrealDBStorageStatus } from "@/api/types" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { useTranslation } from "react-i18next" -import { Database, HardDrive, CheckCircle, XCircle } from "@phosphor-icons/react" +import { Database, CheckCircle, XCircle } from "@phosphor-icons/react" interface StorageStatusCardProps { - status: StorageStatusResponse - brain: string + status: SurrealDBStorageStatus } -function FileStatus({ exists, label }: { exists: boolean; label: string }) { - return ( -
- {exists ? ( -
- ) -} - -export function StorageStatusCard({ status, brain }: StorageStatusCardProps) { +export function StorageStatusCard({ status }: StorageStatusCardProps) { const { t } = useTranslation() - const isInfinity = status.current_backend === "infinitydb" return ( -
+ {/* Backend badge + connection status */} +
+ + + + - {isInfinity ? ( - - - ) : ( - - - )} + {status.healthy + ? t("storage.connected", "Connected") + : t("storage.disconnected", "Disconnected")} - - {t("storage.brain")}: {brain} - + {status.health_grade && ( + + {t("storage.grade", "Grade")}: {status.health_grade} + + )}
-
- 0 - ? `${t("storage.sqliteFile")} (${(status.sqlite_size_bytes / (1024 * 1024)).toFixed(1)} MB)` - : t("storage.sqliteFile") - } - /> - + {/* Connection URL */} +
+ {status.healthy ? ( +
- {status.is_pro_license && ( - - {t("license.pro")} - + {/* Namespace / Database */} + {(status.namespace || status.database) && ( +
+
+ + {t("storage.namespace", "Namespace")} + +

{status.namespace || "—"}

+
+
+ + {t("storage.database", "Database")} + +

{status.database || "—"}

+
+
)} + + {/* Live counts */} +
+
+
+ {t("storage.neurons", "Neurons")} +
+
+ {status.neuron_count.toLocaleString()} +
+
+
+
+ {t("storage.synapses", "Synapses")} +
+
+ {status.synapse_count.toLocaleString()} +
+
+
+
+ {t("storage.fibers", "Fibers")} +
+
+ {status.fiber_count.toLocaleString()} +
+
+
) diff --git a/src/surreal_memory/server/routes/dashboard_api.py b/src/surreal_memory/server/routes/dashboard_api.py index 2f92556d..3e0fc015 100755 --- a/src/surreal_memory/server/routes/dashboard_api.py +++ b/src/surreal_memory/server/routes/dashboard_api.py @@ -1516,6 +1516,92 @@ async def visualize_memory( return result +# ── Storage Status API ─────────────────────────────────── + + +class SurrealDBStorageStatus(BaseModel): + """SurrealDB storage status for the Storage tab.""" + + backend: str = "surrealdb" + url: str = "" + namespace: str = "" + database: str = "" + healthy: bool = False + active_brain: str = "" + neuron_count: int = 0 + fiber_count: int = 0 + synapse_count: int = 0 + health_grade: str = "F" + + +@router.get( + "/storage/status", + response_model=SurrealDBStorageStatus, + summary="Get SurrealDB storage status", +) +async def get_storage_status( + storage: Annotated[NeuralStorage, Depends(get_storage)], +) -> SurrealDBStorageStatus: + """Return SurrealDB connection info and live brain counts. + + This endpoint replaces the old SQLite/InfinityDB migration endpoints + (removed in the SurrealDB-only release). No backend switching is available + or needed — surreal-memory is SurrealDB-only. + """ + from surreal_memory.unified_config import get_config + + cfg = get_config() + brain_name = cfg.current_brain + + url = "" + namespace = "" + database = "" + # Introspect the live storage when it is a SurrealDBStorage instance; + # fall back to empty strings for test SQLite stubs. + if hasattr(storage, "_url"): + url = str(storage._url) + if hasattr(storage, "_namespace"): + namespace = str(storage._namespace) + if hasattr(storage, "_database"): + database = str(storage._database) + + neuron_count = 0 + fiber_count = 0 + synapse_count = 0 + health_grade = "F" + healthy = False + + try: + stats = await storage.get_stats(brain_name) + neuron_count = stats.get("neuron_count", 0) + synapse_count = stats.get("synapse_count", 0) + fiber_count = stats.get("fiber_count", 0) + healthy = True + except Exception: + logger.debug("Storage status: get_stats failed", exc_info=True) + + try: + from surreal_memory.engine.diagnostics import DiagnosticsEngine + + report = await DiagnosticsEngine(storage).analyze(brain_name) + health_grade = report.grade + except Exception: + logger.debug("Storage status: diagnostics failed", exc_info=True) + + return SurrealDBStorageStatus( + backend="surrealdb", + url=url, + namespace=namespace, + database=database, + healthy=healthy, + active_brain=brain_name, + neuron_count=neuron_count, + fiber_count=fiber_count, + synapse_count=synapse_count, + health_grade=health_grade, + ) + + @router.get("/license", tags=["dashboard"], summary="Current license tier") async def get_license() -> dict[str, Any]: """Surreal-Memory is fully free: always report a FULL, unlocked license.""" diff --git a/src/surreal_memory/server/static/dist/assets/DiagramsPage-DxR1C_Ua.js b/src/surreal_memory/server/static/dist/assets/DiagramsPage-DbhaKtcI.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/DiagramsPage-DxR1C_Ua.js rename to src/surreal_memory/server/static/dist/assets/DiagramsPage-DbhaKtcI.js index 2e8dc2ff..0a68f119 100644 --- a/src/surreal_memory/server/static/dist/assets/DiagramsPage-DxR1C_Ua.js +++ b/src/surreal_memory/server/static/dist/assets/DiagramsPage-DbhaKtcI.js @@ -1,4 +1,4 @@ -import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{l as ps,m as ms,u as ys,b as xs}from"./index-C26pxqlr.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-B0vNsxr_.js";import{S as jn}from"./skeleton-DQJ-n00q.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r=g&&(g=E+1);!(N=_[g])&&++g=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;it?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;${o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+uQt&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>en?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x{let p="";return g>0&&gn.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` +import{j as R}from"./vendor-query-CqA1cBNl.js";import{d as hs,r as Z,b as gs}from"./vendor-react-BfuodpLv.js";import{l as ps,m as ms,u as ys,b as xs}from"./index-DzyKsRxc.js";import{C as Ht,a as Dn,b as Ln,c as Vt}from"./card-CB2KYkrP.js";import{S as jn}from"./skeleton-B4zDkVHp.js";import{d as cn,T as ws,t as vs,n as bs}from"./timer-DWAvo6M8.js";import{i as Es,h as $n,j as zn,k as _s,l as Ns,m as Ss,n as yt,o as Bt,u as Cs}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function ks(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ut&&t.documentElement.namespaceURI===Ut?t.createElement(e):t.createElementNS(n,e)}}function Ms(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function To(e){var t=Mt(e);return(t.local?Ms:ks)(t)}function Is(){}function ln(e){return e==null?Is:function(){return this.querySelector(e)}}function Os(e){typeof e!="function"&&(e=ln(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r=g&&(g=E+1);!(N=_[g])&&++g=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ta(e){e||(e=na);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;it?1:e>=t?0:NaN}function oa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ra(){return Array.from(this)}function ia(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ma:typeof t=="function"?xa:ya)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function va(e){return function(){delete this[e]}}function ba(e,t){return function(){this[e]=t}}function Ea(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _a(e,t){return arguments.length>1?this.each((t==null?va:typeof t=="function"?Ea:ba)(e,t)):this.node()[e]}function $o(e){return e.trim().split(/^|\s+/)}function un(e){return e.classList||new zo(e)}function zo(e){this._node=e,this._names=$o(e.getAttribute("class")||"")}zo.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ro(e,t){for(var n=un(e),o=-1,r=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ka(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n()=>e;function Kt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:a,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Kt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ac(e){return!e.ctrlKey&&!e.button}function cc(){return this.parentNode}function lc(e,t){return t??{x:e.x,y:e.y}}function uc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wo(){var e=ac,t=cc,n=lc,o=uc,r={},i=cn("start","drag","end"),s=0,c,a,l,u,d=0;function f(p){p.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",b,sc).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(p,N){if(!(u||!e.call(this,p,N))){var S=g(this,t.call(this,p,N),p,N,"mouse");S&&(le(p.view).on("mousemove.drag",m,Je).on("mouseup.drag",w,Je),Fo(p.view),Ft(p),l=!1,c=p.clientX,a=p.clientY,S("start",p))}}function m(p){if(Re(p),!l){var N=p.clientX-c,S=p.clientY-a;l=N*N+S*S>d}r.mouse("drag",p)}function w(p){le(p.view).on("mousemove.drag mouseup.drag",null),Yo(p.view,l),Re(p),r.mouse("end",p)}function _(p,N){if(e.call(this,p,N)){var S=p.changedTouches,T=t.call(this,p,N),L=S.length,$,A;for($=0;${o.stop(),e(r+t)},t,n),o}var dc=cn("start","end","cancel","interrupt"),fc=[],Zo=0,Vn=1,Qt=2,xt=3,Bn=4,Jt=5,wt=6;function It(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hc(e,n,{name:t,index:o,group:r,on:dc,tween:fc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zo})}function dn(e,t){var n=me(e,t);if(n.state>Zo)throw new Error("too late; already scheduled");return n}function we(e,t){var n=me(e,t);if(n.state>xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=vs(i,0,n.time);function i(l){n.state=Vn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Vn)return a();for(u in o)if(h=o[u],h.name===n.name){if(h.state===xt)return Hn(s);h.state===Bn?(h.state=wt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+uQt&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Fc(e,t,n){var o,r,i=Bc(t)?dn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function Yc(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(Fc(n,e,t))}function Wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Zc(){return this.on("end.remove",Wc(this._id))}function Xc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ln(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s()=>e;function xl(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ot=new Ee(1,0,0);Uo.prototype=Ee.prototype;function Uo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ot;return e.__zoom}function Yt(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function wl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fn(){return this.__zoom||Ot}function bl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function El(){return navigator.maxTouchPoints||"ontouchstart"in this}function _l(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Ko(){var e=wl,t=vl,n=_l,o=bl,r=El,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=yt,l=cn("start","zoom","end"),u,d,f,h=500,m=150,w=0,_=10;function b(y){y.property("__zoom",Fn).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",A).filter(r).on("touchstart.zoom",C).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(y,I,v,k){var M=y.selection?y.selection():y;M.property("__zoom",Fn),y!==M?N(y,I,v,k):M.interrupt().each(function(){S(this,arguments).event(k).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},b.scaleBy=function(y,I,v,k){b.scaleTo(y,function(){var M=this.__zoom.k,j=typeof I=="function"?I.apply(this,arguments):I;return M*j},v,k)},b.scaleTo=function(y,I,v,k){b.transform(y,function(){var M=t.apply(this,arguments),j=this.__zoom,B=v==null?p(M):typeof v=="function"?v.apply(this,arguments):v,F=j.invert(B),Y=typeof I=="function"?I.apply(this,arguments):I;return n(g(E(j,Y),B,F),M,s)},v,k)},b.translateBy=function(y,I,v,k){b.transform(y,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof v=="function"?v.apply(this,arguments):v),t.apply(this,arguments),s)},null,k)},b.translateTo=function(y,I,v,k,M){b.transform(y,function(){var j=t.apply(this,arguments),B=this.__zoom,F=k==null?p(j):typeof k=="function"?k.apply(this,arguments):k;return n(Ot.translate(F[0],F[1]).scale(B.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof v=="function"?-v.apply(this,arguments):-v),j,s)},k,M)};function E(y,I){return I=Math.max(i[0],Math.min(i[1],I)),I===y.k?y:new Ee(I,y.x,y.y)}function g(y,I,v){var k=I[0]-v[0]*y.k,M=I[1]-v[1]*y.k;return k===y.x&&M===y.y?y:new Ee(y.k,k,M)}function p(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,I,v,k){y.on("start.zoom",function(){S(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(k).end()}).tween("zoom",function(){var M=this,j=arguments,B=S(M,j).event(k),F=t.apply(M,j),Y=v==null?p(F):typeof v=="function"?v.apply(M,j):v,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=M.__zoom,x=typeof I=="function"?I.apply(M,j):I,z=a(O.invert(Y).concat(X/O.k),x.invert(Y).concat(X/x.k));return function(V){if(V===1)V=x;else{var H=z(V),W=X/H[2];V=new Ee(W,Y[0]-H[0]*W,Y[1]-H[1]*W)}B.zoom(null,V)}})}function S(y,I,v){return!v&&y.__zooming||new T(y,I)}function T(y,I){this.that=y,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,I),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,I){return this.mouse&&y!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var I=le(this.that).datum();l.call(y,this.that,new xl(y,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:l}),I)}};function L(y,...I){if(!e.apply(this,arguments))return;var v=S(this,I).event(y),k=this.__zoom,M=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),j=fe(y);if(v.wheel)(v.mouse[0][0]!==j[0]||v.mouse[0][1]!==j[1])&&(v.mouse[1]=k.invert(v.mouse[0]=j)),clearTimeout(v.wheel);else{if(k.k===M)return;v.mouse=[j,k.invert(j)],vt(this),v.start()}Ke(y),v.wheel=setTimeout(B,m),v.zoom("mouse",n(g(E(k,M),v.mouse[0],v.mouse[1]),v.extent,s));function B(){v.wheel=null,v.end()}}function $(y,...I){if(f||!e.apply(this,arguments))return;var v=y.currentTarget,k=S(this,I,!0).event(y),M=le(y.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",X,!0),j=fe(y,v),B=y.clientX,F=y.clientY;Fo(y.view),Yt(y),k.mouse=[j,this.__zoom.invert(j)],vt(this),k.start();function Y(O){if(Ke(O),!k.moved){var x=O.clientX-B,z=O.clientY-F;k.moved=x*x+z*z>w}k.event(O).zoom("mouse",n(g(k.that.__zoom,k.mouse[0]=fe(O,v),k.mouse[1]),k.extent,s))}function X(O){M.on("mousemove.zoom mouseup.zoom",null),Yo(O.view,k.moved),Ke(O),k.event(O).end()}}function A(y,...I){if(e.apply(this,arguments)){var v=this.__zoom,k=fe(y.changedTouches?y.changedTouches[0]:y,this),M=v.invert(k),j=v.k*(y.shiftKey?.5:2),B=n(g(E(v,j),k,M),t.apply(this,I),s);Ke(y),c>0?le(this).transition().duration(c).call(N,B,k,y):le(this).call(b.transform,B,k,y)}}function C(y,...I){if(e.apply(this,arguments)){var v=y.touches,k=v.length,M=S(this,I,y.changedTouches.length===k).event(y),j,B,F,Y;for(Yt(y),B=0;B"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},et=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qo=["Enter"," ","Escape"],Jo={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var tt;(function(e){e.Partial="partial",e.Full="full"})(tt||(tt={}));const er={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var Et;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Et||(Et={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const Yn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function tr(e){return e===null?null:e?"valid":"invalid"}const nr=e=>"id"in e&&"source"in e&&"target"in e,Nl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),st=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Sl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):hn(r)?r:t.nodeLookup.get(r.id));const c=s?_t(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Tt(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Pt(n)},at=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Tt(n,_t(r)),o=!0)}),o?Pt(n):{x:0,y:0,width:0,height:0}},gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...lt(t,[n,o,r]),width:t.width/r,height:t.height/r},a=[];for(const l of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=l;if(s&&!d||f)continue;const h=u.width??l.width??l.initialWidth??null,m=u.height??l.height??l.initialHeight??null,w=nt(c,Fe(l)),_=(h??0)*(m??0),b=i&&w>0;(!l.internals.handleBounds||b||w>=_||l.dragging)&&a.push(l)}return a},Cl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function kl(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ml({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=kl(e,s),a=at(c),l=pn(a,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function or({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:l}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const h=c.measured.width,m=c.measured.height;h&&m&&(d=[[a,l],[a+h,l+m]])}else c&&Ye(s.extent)&&(d=[[s.extent[0][0]+a,s.extent[0][1]+l],[s.extent[1][0]+a,s.extent[1][1]+l]]);const f=Ye(d)?Ae(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-a+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Il({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),m=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||m)&&s.push(f)}const c=new Set(t.map(f=>f.id)),a=o.filter(f=>f.deletable!==!1),u=Cl(s,a);for(const f of a)c.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ae=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Be(e.y,t[0][1],t[1][1]-(n?.height??0))});function rr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return Ae(e,[[i,s],[i+o,s+r]],t)}const Wn=(e,t,n)=>en?-Be(Math.abs(e-n),1,t)/t:0,ir=(e,t,n=15,o=40)=>{const r=Wn(e.x,o,t.width-o)*n,i=Wn(e.y,o,t.height-o)*n;return[r,i]},Tt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),en=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Pt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Fe=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_t=(e,t=[0,0])=>{const{x:n,y:o}=hn(e)?e.internals.positionAbsolute:st(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sr=(e,t)=>Pt(Tt(en(e),en(t))),nt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zn=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ol=(e,t)=>{},ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?ct(c,s):c},Nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Tl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),i=je(e.left??e.x??0,t),s=je(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pl(e,t,n,o,r,i){const{x:s,y:c}=Nt(e,[t,n,o]),{x:a,y:l}=Nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-a,d=i-l;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const pn=(e,t,n,o,r,i)=>{const s=Tl(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,l=Math.min(c,a),u=Be(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,m=n/2-f*u,w=Pl(e,h,m,u,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-_.left+_.right,y:m-_.top+_.bottom,zoom:u}},ot=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ar(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function cr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Xn(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Al(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Dl(e){return{...Jo,...e||{}}}function Qe(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:a,y:l}=n?ct(c,t):c;return{xSnapped:a,ySnapped:l,...c}}const mn=e=>({width:e.offsetWidth,height:e.offsetHeight}),lr=e=>e?.getRootNode?.()||window?.document,Ll=["INPUT","SELECT","TEXTAREA"];function ur(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ll.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const dr=e=>"clientX"in e,ge=(e,t)=>{const n=dr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Gn=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...mn(s)}})};function fr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+c*.375+o*.125,u=Math.abs(a-e),d=Math.abs(l-t);return[a,l,u,d]}function ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function qn({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case K.Left:return[t-ht(t-o,i),n];case K.Right:return[t+ht(o-t,i),n];case K.Top:return[t,n-ht(n-r,i)];case K.Bottom:return[t,n+ht(r-n,i)]}}function yn({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:o,targetY:r,targetPosition:i=K.Top,curvature:s=.25}){const[c,a]=qn({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=qn({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,m]=fr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${c},${a} ${l},${u} ${o},${r}`,d,f,h,m]}function hr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n0}const zl=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Rl=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Hl=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||zl;let r;return nr(e)?r={...e}:r={...e,id:o(e)},Rl(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=hr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Un={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Vl=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Bl({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:o=K.Top,center:r,offset:i,stepPosition:s}){const c=Un[t],a=Un[o],l={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+a.x*i,y:n.y+a.y*i},d=Vl({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let m=[],w,_;const b={x:0,y:0},E={x:0,y:0},[,,g,p]=hr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*a[f]===-1){f==="x"?(w=r.x??l.x+(u.x-l.x)*s,_=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,_=r.y??l.y+(u.y-l.y)*s);const S=[{x:w,y:l.y},{x:w,y:u.y}],T=[{x:l.x,y:_},{x:u.x,y:_}];c[f]===h?m=f==="x"?S:T:m=f==="x"?T:S}else{const S=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(f==="x"?m=c.x===h?T:S:m=c.y===h?S:T,t===o){const P=Math.abs(e[f]-n[f]);if(P<=i){const D=Math.min(i-1,i-P);c[f]===h?b[f]=(l[f]>e[f]?-1:1)*D:E[f]=(u[f]>n[f]?-1:1)*D}}if(t!==o){const P=f==="x"?"y":"x",D=c[f]===a[P],y=l[P]>u[P],I=l[P]=C?(w=(L.x+$.x)/2,_=m[0].y):(w=m[0].x,_=(L.y+$.y)/2)}return[[e,{x:l.x+b.x,y:l.y+b.y},...m,{x:u.x+E.x,y:u.y+E.y},n],w,_,g,p]}function Fl(e,t,n,o){const r=Math.min(Kn(e,t)/2,Kn(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x{let p="";return g>0&&gn.id===t):e[0])||null}function nn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Wl(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(a=>{if(a&&typeof a=="object"){const l=nn(a,t);i.has(l)||(s.push({id:l,color:a.color||n,...a}),i.add(l))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const pr=1e3,Zl=10,xn={nodeOrigin:[0,0],nodeExtent:et,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Xl={...xn,checkEquality:!0};function wn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Gl(e,t,n){const o=wn(xn,n);for(const r of e.values())if(r.parentId)bn(r,e,t,o);else{const i=st(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,c=Ae(i,s,Se(r));r.internals.positionAbsolute=c}}function ql(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function vn(e){return e==="manual"}function on(e,t,n,o={}){const r=wn(Xl,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!vn(r.zIndexMode)?pr:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let u=s.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const d=st(l,r.nodeOrigin),f=Ye(l.extent)?l.extent:r.nodeExtent,h=Ae(d,f,Se(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:h,handleBounds:ql(l,u),z:mr(l,c,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(a=!1),l.parentId&&bn(u,t,n,o,i)}return a}function Ul(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function bn(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=wn(xn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ul(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&a==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Zl),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!vn(a)?pr:0,{x:f,y:h,z:m}=Kl(e,u,s,c,d,a),{positionAbsolute:w}=e.internals,_=f!==w.x||h!==w.y;(_||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:h}:w,z:m}})}function mr(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return vn(n)?o:o+(e.selected?t:0)}function Kl(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Se(e),l=st(e,n),u=Ye(e.extent)?Ae(l,e.extent,a):l;let d=Ae({x:s+u.x,y:c+u.y},o,a);e.extent==="parent"&&(d=rr(d,a,t));const f=mr(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function En(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const a=i.get(s.parentId)?.expandedRect??Fe(c),l=sr(a,s.rect);i.set(s.parentId,{expandedRect:l,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},a)=>{const l=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x0||h>0||_||b)&&(r.push({id:a,type:"position",position:{x:c.position.x-f+_,y:c.position.y-h+b}}),n.get(a)?.forEach(E=>{e.some(g=>g.id===E.id)||r.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+h}})})),(u.width0){const h=En(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:a}}async function Jl({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function to(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const a=o.get(s)||new Map;if(o.set(s,a.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function yr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,a={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},l=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;to("source",a,u,e,r,s),to("target",a,l,e,i,c),t.set(o.id,o)}}function xr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xr(n,t):!1}function no(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function eu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function Wt({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const a=n.get(s)?.internals.userNode;a&&r.push({...a,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function tu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function nu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,a=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,m=!1,w=null;function _({noDragClassName:E,handleSelector:g,domNode:p,isSelectable:N,nodeId:S,nodeClickDistance:T=0}){f=le(p);function L({x:P,y:D}){const{nodeLookup:y,nodeExtent:I,snapGrid:v,snapToGrid:k,nodeOrigin:M,onNodeDrag:j,onSelectionDrag:B,onError:F,updateNodePositions:Y}=t();i={x:P,y:D};let X=!1;const O=c.size>1,x=O&&I?en(at(c)):null,z=O&&k?tu({dragItems:c,snapGrid:v,x:P,y:D}):null;for(const[V,H]of c){if(!y.has(V))continue;let W={x:P-H.distance.x,y:D-H.distance.y};k&&(W=z?{x:Math.round(W.x+z.x),y:Math.round(W.y+z.y)}:ct(W,v));let G=null;if(O&&I&&!H.extent&&x){const{positionAbsolute:Q}=H.internals,J=Q.x-x.x+I[0][0],ee=Q.x+H.measured.width-x.x2+I[1][0],ne=Q.y-x.y+I[0][1],ce=Q.y+H.measured.height-x.y2+I[1][1];G=[[J,ne],[ee,ce]]}const{position:q,positionAbsolute:U}=or({nodeId:V,nextPosition:W,nodeLookup:y,nodeExtent:G||I,nodeOrigin:M,onError:F});X=X||H.position.x!==q.x||H.position.y!==q.y,H.position=q,H.internals.positionAbsolute=U}if(m=m||X,!!X&&(Y(c,!0),w&&(o||j||!S&&B))){const[V,H]=Wt({nodeId:S,dragItems:c,nodeLookup:y});o?.(w,c,V,H),j?.(w,V,H),S||B?.(w,H)}}async function $(){if(!u)return;const{transform:P,panBy:D,autoPanSpeed:y,autoPanOnNodeDrag:I}=t();if(!I){a=!1,cancelAnimationFrame(s);return}const[v,k]=ir(l,u,y);(v!==0||k!==0)&&(i.x=(i.x??0)-v/P[2],i.y=(i.y??0)-k/P[2],await D({x:v,y:k})&&L(i)),s=requestAnimationFrame($)}function A(P){const{nodeLookup:D,multiSelectionActive:y,nodesDraggable:I,transform:v,snapGrid:k,snapToGrid:M,selectNodesOnDrag:j,onNodeDragStart:B,onSelectionDragStart:F,unselectNodesAndEdges:Y}=t();d=!0,(!j||!N)&&!y&&S&&(D.get(S)?.selected||Y()),N&&j&&S&&e?.(S);const X=Qe(P.sourceEvent,{transform:v,snapGrid:k,snapToGrid:M,containerBounds:u});if(i=X,c=eu(D,I,X,S),c.size>0&&(n||B||!S&&F)){const[O,x]=Wt({nodeId:S,dragItems:c,nodeLookup:D});n?.(P.sourceEvent,c,O,x),B?.(P.sourceEvent,O,x),S||F?.(P.sourceEvent,x)}}const C=Wo().clickDistance(T).on("start",P=>{const{domNode:D,nodeDragThreshold:y,transform:I,snapGrid:v,snapToGrid:k}=t();u=D?.getBoundingClientRect()||null,h=!1,m=!1,w=P.sourceEvent,y===0&&A(P),i=Qe(P.sourceEvent,{transform:I,snapGrid:v,snapToGrid:k,containerBounds:u}),l=ge(P.sourceEvent,u)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:y,snapGrid:I,snapToGrid:v,nodeDragThreshold:k,nodeLookup:M}=t(),j=Qe(P.sourceEvent,{transform:y,snapGrid:I,snapToGrid:v,containerBounds:u});if(w=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||S&&!M.has(S))&&(h=!0),!h){if(!a&&D&&d&&(a=!0,$()),!d){const B=ge(P.sourceEvent,u),F=B.x-l.x,Y=B.y-l.y;Math.sqrt(F*F+Y*Y)>k&&A(P)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&c&&d&&(l=ge(P.sourceEvent,u),L(j))}}).on("end",P=>{if(!(!d||h)&&(a=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:y,onNodeDragStop:I,onSelectionDragStop:v}=t();if(m&&(y(c,!1),m=!1),r||I||!S&&v){const[k,M]=Wt({nodeId:S,dragItems:c,nodeLookup:D,dragging:!1});r?.(P.sourceEvent,c,k,M),I?.(P.sourceEvent,k,M),S||v?.(P.sourceEvent,M)}}}).filter(P=>{const D=P.target;return!P.button&&(!E||!no(D,`.${E}`,p))&&(!g||no(D,g,p))});f.call(C)}function b(){f?.on(".drag",null)}return{update:_,destroy:b}}function ou(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())nt(r,Fe(i))>0&&o.push(i);return o}const ru=250;function iu(e,t,n,o){let r=[],i=1/0;const s=ou(e,n,t+ru);for(const c of s){const a=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const l of a){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=De(c,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f1){const c=o.type==="source"?"target":"source";return r.find(a=>a.type===c)??r[0]}return r[0]}function wr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],a=(n?c?.find(l=>l.id===n):c?.[0])??null;return a&&i?{...a,...De(s,a,a.position,!0)}:a}function vr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function su(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const br=()=>!0;function au(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:m,onConnect:w,onConnectEnd:_,isValidConnection:b=br,onReconnectEnd:E,updateConnection:g,getTransform:p,getFromHandle:N,autoPanSpeed:S,dragThreshold:T=1,handleDomNode:L}){const $=lr(e.target);let A=0,C;const{x:P,y:D}=ge(e),y=vr(i,L),I=c?.getBoundingClientRect();let v=!1;if(!I||!y)return;const k=wr(r,y,o,a,t);if(!k)return;let M=ge(e,I),j=!1,B=null,F=!1,Y=null;function X(){if(!u||!I)return;const[q,U]=ir(M,I,S);f({x:q,y:U}),A=requestAnimationFrame(X)}const O={...k,nodeId:r,type:y,position:k.position},x=a.get(r);let V={inProgress:!0,isValid:null,from:De(x,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:x,to:M,toHandle:null,toPosition:Yn[O.position],toNode:null,pointer:M};function H(){v=!0,g(V),m?.(e,{nodeId:r,handleId:o,handleType:y})}T===0&&H();function W(q){if(!v){const{x:ce,y:de}=ge(q),ve=ce-P,Oe=de-D;if(!(ve*ve+Oe*Oe>T*T))return;H()}if(!N()||!O){G(q);return}const U=p();M=ge(q,I),C=iu(lt(M,U,!1,[1,1]),n,a,O),j||(X(),j=!0);const Q=Er(q,{handle:C,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:b,doc:$,lib:l,flowId:d,nodeLookup:a});Y=Q.handleDomNode,B=Q.connection,F=su(!!C,Q.isValid);const J=a.get(r),ee=J?De(J,O,K.Left,!0):V.from,ne={...V,from:ee,isValid:F,to:Q.toHandle&&F?Nt({x:Q.toHandle.x,y:Q.toHandle.y},U):M,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Yn[O.position],toNode:Q.toHandle?a.get(Q.toHandle.nodeId):null,pointer:M};g(ne),V=ne}function G(q){if(!("touches"in q&&q.touches.length>0)){if(v){(C||Y)&&B&&F&&w?.(B);const{inProgress:U,...Q}=V,J={...Q,toPosition:V.toHandle?V.toPosition:null};_?.(q,J),i&&E?.(q,J)}h(),cancelAnimationFrame(A),j=!1,F=!1,B=null,Y=null,$.removeEventListener("mousemove",W),$.removeEventListener("mouseup",G),$.removeEventListener("touchmove",W),$.removeEventListener("touchend",G)}}$.addEventListener("mousemove",W),$.addEventListener("mouseup",G),$.addEventListener("touchmove",W),$.addEventListener("touchend",G)}function Er(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:l=br,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:m}=ge(e),w=s.elementFromPoint(h,m),_=w?.classList.contains(`${c}-flow__handle`)?w:f,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const E=vr(void 0,_),g=_.getAttribute("data-nodeid"),p=_.getAttribute("data-handleid"),N=_.classList.contains("connectable"),S=_.classList.contains("connectableend");if(!g||!E)return b;const T={source:d?g:o,sourceHandle:d?p:r,target:d?o:g,targetHandle:d?r:p};b.connection=T;const $=N&&S&&(n===Ve.Strict?d&&E==="source"||!d&&E==="target":g!==o||p!==r);b.isValid=$&&l(T),b.toHandle=wr(g,E,p,u,n,!0)}return b}const rn={onPointerDown:au,isValid:Er};function cu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:a,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const m=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const p=n(),N=g.sourceEvent.ctrlKey&&ot()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,T=p[2]*Math.pow(2,S*N);t.scaleTo(T)};let w=[0,0];const _=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},b=g=>{const p=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const T=o()*Math.max(p[2],Math.log(p[2]))*(h?-1:1),L={x:p[0]-S[0]*T,y:p[1]-S[1]*T},$=[[0,0],[a,l]];t.setViewportConstrained({x:L.x,y:L.y,zoom:p[2]},$,c)},E=Ko().on("start",_).on("zoom",d?b:null).on("zoom.wheel",f?m:null);r.call(E,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const At=e=>({x:e.x,y:e.y,zoom:e.k}),Zt=({x:e,y:t,zoom:n})=>Ot.translate(e,t).scale(n),$e=(e,t)=>e.target.closest(`.${t}`),_r=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xt=(e,t=0,n=lu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Nr=e=>{const t=e.ctrlKey&&ot()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}){return u=>{if($e(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const _=fe(u),b=Nr(u),E=d*Math.pow(2,b);o.scaleTo(n,E,_,u);return}const f=u.deltaMode===1?20:1;let h=r===Pe.Vertical?0:u.deltaX*f,m=r===Pe.Horizontal?0:u.deltaY*f;!ot()&&u.shiftKey&&r!==Pe.Vertical&&(h=u.deltaY*f,m=0),o.translateBy(n,-(h/d)*i,-(m/d)*i,{internal:!0});const w=At(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a?.(u,w),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,w))}}function du({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=$e(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function fu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=At(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function hu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&_r(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,At(i.transform))}}function gu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&_r(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=At(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function pu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&($e(d,`${l}-flow__node`)||$e(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!m||$e(d,c)&&m||$e(d,a)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&w}}function mu({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Ko().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);E({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const h=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(Nr);function w(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).transform(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function _({noWheelClassName:C,noPanClassName:P,onPaneContextMenu:D,userSelectionActive:y,panOnScroll:I,panOnDrag:v,panOnScrollMode:k,panOnScrollSpeed:M,preventScrolling:j,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:X,lib:O,onTransformChange:x,connectionInProgress:z,paneClickDistance:V,selectionOnDrag:H}){y&&!l.isZoomingOrPanning&&b();const W=I&&!X&&!y;d.clickDistance(H?1/0:!he(V)||V<0?0:V);const G=W?uu({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:d,panOnScrollMode:k,panOnScrollSpeed:M,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):du({noWheelClassName:C,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",G,{passive:!1}),!y){const U=fu({zoomPanValues:l,onDraggingChange:a,onPanZoomStart:s});d.on("start",U);const Q=hu({zoomPanValues:l,panOnDrag:v,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:x});d.on("zoom",Q);const J=gu({zoomPanValues:l,panOnDrag:v,panOnScroll:I,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});d.on("end",J)}const q=pu({zoomActivationKeyPressed:X,panOnDrag:v,zoomOnScroll:F,panOnScroll:I,zoomOnDoubleClick:Y,zoomOnPinch:B,userSelectionActive:y,noPanClassName:P,noWheelClassName:C,lib:O,connectionInProgress:z});d.filter(q),Y?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function b(){d.on("zoom",null)}async function E(C,P,D){const y=Zt(C),I=d?.constrain()(y,P,D);return I&&await w(I),new Promise(v=>v(I))}async function g(C,P){const D=Zt(C);return await w(D,P),new Promise(y=>y(D))}function p(C){if(f){const P=Zt(C),D=f.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&d?.transform(f,P,null,{sync:!0})}}function N(){const C=f?Uo(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function S(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleTo(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function T(C,P){return f?new Promise(D=>{d?.interpolate(P?.interpolate==="linear"?Bt:yt).scaleBy(Xt(f,P?.duration,P?.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function L(C){d?.scaleExtent(C)}function $(C){d?.translateExtent(C)}function A(C){const P=!he(C)||C<0?0:C;d?.clickDistance(P)}return{update:_,destroy:b,setViewport:g,setViewportConstrained:E,getViewport:N,scaleTo:S,scaleBy:T,setScaleExtent:L,setTranslateExtent:$,syncViewport:p,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function yu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function gt(e,t,n){return Math.max(0,t-e,e-n)}function ro(e,t){return e?!t:t}function xu(e,t,n,o,r,i,s,c){let{affectsX:a,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:m}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:E}=o,{x:g,y:p,width:N,height:S,aspectRatio:T}=e;let L=Math.floor(u?h-e.pointerX:0),$=Math.floor(d?m-e.pointerY:0);const A=N+(a?-L:L),C=S+(l?-$:$),P=-i[0]*N,D=-i[1]*S;let y=gt(A,w,_),I=gt(C,b,E);if(s){let M=0,j=0;a&&L<0?M=Ce(g+L+P,s[0][0]):!a&&L>0&&(M=ke(g+A+P,s[1][0])),l&&$<0?j=Ce(p+$+D,s[0][1]):!l&&$>0&&(j=ke(p+C+D,s[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(c){let M=0,j=0;a&&L>0?M=ke(g+L,c[0][0]):!a&&L<0&&(M=Ce(g+A,c[1][0])),l&&$>0?j=ke(p+$,c[0][1]):!l&&$<0&&(j=Ce(p+C,c[1][1])),y=Math.max(y,M),I=Math.max(I,j)}if(r){if(u){const M=gt(A/T,b,E)*T;if(y=Math.max(y,M),s){let j=0;!a&&!l||a&&!l&&f?j=ke(p+D+A/T,s[1][1])*T:j=Ce(p+D+(a?L:-L)/T,s[0][1])*T,y=Math.max(y,j)}if(c){let j=0;!a&&!l||a&&!l&&f?j=Ce(p+A/T,c[1][1])*T:j=ke(p+(a?L:-L)/T,c[0][1])*T,y=Math.max(y,j)}}if(d){const M=gt(C*T,w,_)/T;if(I=Math.max(I,M),s){let j=0;!a&&!l||l&&!a&&f?j=ke(g+C*T+P,s[1][0])/T:j=Ce(g+(l?$:-$)*T+P,s[0][0])/T,I=Math.max(I,j)}if(c){let j=0;!a&&!l||l&&!a&&f?j=Ce(g+C*T,c[1][0])/T:j=ke(g+(l?$:-$)*T,c[0][0])/T,I=Math.max(I,j)}}}$=$+($<0?I:-I),L=L+(L<0?y:-y),r&&(f?A>C*T?$=(ro(a,l)?-L:L)/T:L=(ro(a,l)?-$:$)*T:u?($=L/T,l=a):(L=$*T,a=l));const v=a?g+L:g,k=l?p+$:p;return{width:N+(a?-L:L),height:S+(l?-$:$),x:i[0]*L*(a?-1:1)+v,y:i[1]*$*(l?-1:1)+k}}const Sr={width:0,height:0,x:0,y:0},wu={...Sr,pointerX:0,pointerY:0,aspectRatio:1};function vu(e){return[[0,0],[e.measured.width,e.measured.height]]}function bu(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[o-c,r-a],[o+i-c,r+s-a]]}function Eu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:m,onResizeEnd:w,shouldResize:_}){let b={...Sr},E={...wu};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:oo(l)};let g,p=null,N=[],S,T,L,$=!1;const A=Wo().on("start",C=>{const{nodeLookup:P,transform:D,snapGrid:y,snapToGrid:I,nodeOrigin:v,paneDomNode:k}=n();if(g=P.get(t),!g)return;p=k?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:j}=Qe(C.sourceEvent,{transform:D,snapGrid:y,snapToGrid:I,containerBounds:p});b={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},E={...b,pointerX:M,pointerY:j,aspectRatio:b.width/b.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=P.get(g.parentId),T=S&&g.extent==="parent"?vu(S):void 0),N=[],L=void 0;for(const[B,F]of P)if(F.parentId===t&&(N.push({id:B,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=bu(F,g,F.origin??v);L?L=[[Math.min(Y[0][0],L[0][0]),Math.min(Y[0][1],L[0][1])],[Math.max(Y[1][0],L[1][0]),Math.max(Y[1][1],L[1][1])]]:L=Y}h?.(C,{...b})}).on("drag",C=>{const{transform:P,snapGrid:D,snapToGrid:y,nodeOrigin:I}=n(),v=Qe(C.sourceEvent,{transform:P,snapGrid:D,snapToGrid:y,containerBounds:p}),k=[];if(!g)return;const{x:M,y:j,width:B,height:F}=b,Y={},X=g.origin??I,{width:O,height:x,x:z,y:V}=xu(E,s.controlDirection,v,s.boundaries,s.keepAspectRatio,X,T,L),H=O!==B,W=x!==F,G=z!==M&&H,q=V!==j&&W;if(!G&&!q&&!H&&!W)return;if((G||q||X[0]===1||X[1]===1)&&(Y.x=G?z:b.x,Y.y=q?V:b.y,b.x=Y.x,b.y=Y.y,N.length>0)){const ee=z-M,ne=V-j;for(const ce of N)ce.position={x:ce.position.x-ee+X[0]*(O-B),y:ce.position.y-ne+X[1]*(x-F)},k.push(ce)}if((H||W)&&(Y.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:b.width,Y.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?x:b.height,b.width=Y.width,b.height=Y.height),S&&g.expandParent){const ee=X[0]*(Y.width??0);Y.x&&Y.x{$&&(w?.(C,{...b}),r?.({...b}),$=!1)});i.call(A)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}const _u={},io=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(_u?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,a);return a},Nu=e=>e?io(e):io,{useDebugValue:Su}=hs,{useSyncExternalStoreWithSelector:Cu}=Cs,ku=e=>e;function Cr(e,t=ku,n){const o=Cu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Su(o),o}const so=(e,t)=>{const n=Nu(e),o=(r,i=t)=>Cr(n,r,i);return Object.assign(o,n),o},Mu=(e,t)=>e?so(e,t):so;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Dt=Z.createContext(null),Iu=Dt.Provider,kr=xe.error001();function te(e,t){const n=Z.useContext(Dt);if(n===null)throw new Error(kr);return Cr(n,e,t)}function ie(){const e=Z.useContext(Dt);if(e===null)throw new Error(kr);return Z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ao={display:"none"},Ou={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Mr="react-flow__node-desc",Ir="react-flow__edge-desc",Tu="react-flow__aria-live",Pu=e=>e.ariaLiveMessage,Au=e=>e.ariaLabelConfig;function Du({rfId:e}){const t=te(Pu);return R.jsx("div",{id:`${Tu}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ou,children:t})}function Lu({rfId:e,disableKeyboardA11y:t}){const n=te(Au);return R.jsxs(R.Fragment,{children:[R.jsx("div",{id:`${Mr}-${e}`,style:ao,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),R.jsx("div",{id:`${Ir}-${e}`,style:ao,children:n["edge.a11yDescription.default"]}),!t&&R.jsx(Du,{rfId:e})]})}const Lt=Z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return R.jsx("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Lt.displayName="Panel";function ju({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:R.jsx(Lt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:R.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const $u=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},pt=e=>e.id;function zu(e,t){return re(e.selectedNodes.map(pt),t.selectedNodes.map(pt))&&re(e.selectedEdges.map(pt),t.selectedEdges.map(pt))}function Ru({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=te($u,zu);return Z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Hu=e=>!!e.onSelectionChangeHandlers;function Vu({onSelectionChange:e}){const t=te(Hu);return e||t?R.jsx(Ru,{onSelectionChange:e}):null}const Or=[0,0],Bu={x:0,y:0,zoom:1},Fu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],co=[...Fu,"rfId"],Yu=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),lo={translateExtent:et,nodeOrigin:Or,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Wu(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=te(Yu,re),l=ie();Z.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{u.current=lo,c()}),[]);const u=Z.useRef(lo);return Z.useEffect(()=>{for(const d of co){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:Dl(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},co.map(d=>e[d])),null}function uo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Zu(e){const[t,n]=Z.useState(e==="system"?null:e);return Z.useEffect(()=>{if(e!=="system"){n(e);return}const o=uo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:uo()?.matches?"dark":"light"}const fo=typeof document<"u"?document:null;function rt(e=null,t={target:fo,actInsideInputWithModifier:!0}){const[n,o]=Z.useState(!1),r=Z.useRef(!1),i=Z.useRef(new Set([])),[s,c]=Z.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",` `).replace(` `,` diff --git a/src/surreal_memory/server/static/dist/assets/EvolutionPage-By828lS5.js b/src/surreal_memory/server/static/dist/assets/EvolutionPage-CzD9dgSX.js similarity index 94% rename from src/surreal_memory/server/static/dist/assets/EvolutionPage-By828lS5.js rename to src/surreal_memory/server/static/dist/assets/EvolutionPage-CzD9dgSX.js index 582aaa75..60c9a25f 100644 --- a/src/surreal_memory/server/static/dist/assets/EvolutionPage-By828lS5.js +++ b/src/surreal_memory/server/static/dist/assets/EvolutionPage-CzD9dgSX.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{k as x,u as h}from"./index-C26pxqlr.js";import{P as g}from"./ProGate-CwBF4etn.js";import{C as l,a as n,b as c,c as d}from"./card-B0vNsxr_.js";import{S as u}from"./skeleton-DQJ-n00q.js";import{R as j,B as p,X as v,Y as f,T as b,f as y,g as N}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-react-BfuodpLv.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";const _={short_term:"var(--color-chart-4)",working:"var(--color-chart-3)",episodic:"var(--color-chart-1)",semantic:"var(--color-chart-2)"};function r({label:t,value:o}){const e=Math.round(o*100);return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:t}),s.jsxs("span",{className:"font-mono font-medium",children:[e,"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${e}%`}})})]})}function E(){const{data:t,isLoading:o}=x(),{t:e}=h(),i=t?.stage_distribution?[{stage:e("evolution.shortTerm"),count:t.stage_distribution.short_term,key:"short_term"},{stage:e("evolution.working"),count:t.stage_distribution.working,key:"working"},{stage:e("evolution.episodic"),count:t.stage_distribution.episodic,key:"episodic"},{stage:e("evolution.semantic"),count:t.stage_distribution.semantic,key:"semantic"}]:[];return s.jsx(g,{label:e("license.pro_feature","Pro Feature"),children:s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("evolution.title")}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.brainMetrics")})}),s.jsx(d,{children:o?s.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,m)=>s.jsx(u,{className:"h-10 w-full"},m))}):t?s.jsxs("div",{className:"space-y-4",children:[s.jsx(r,{label:e("evolution.maturity"),value:t.maturity_level}),s.jsx(r,{label:e("evolution.plasticity"),value:t.plasticity}),s.jsx(r,{label:e("evolution.semanticRatio"),value:t.semantic_ratio}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalFibers")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_fibers.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalNeurons")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_neurons.toLocaleString()})]})]})]}):null})]}),s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.stageDistribution")})}),s.jsx(d,{children:o?s.jsx(u,{className:"h-64 w-full"}):s.jsx(j,{width:"100%",height:260,children:s.jsxs(p,{data:i,children:[s.jsx(v,{dataKey:"stage",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(f,{tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(b,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),s.jsx(y,{dataKey:"count",radius:[4,4,0,0],children:i.map(a=>s.jsx(N,{fill:_[a.key]??"var(--color-chart-1)"},a.stage))})]})})})]})]})]})})}export{E as default}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{k as x,u as h}from"./index-DzyKsRxc.js";import{P as g}from"./ProGate-37WFbaAW.js";import{C as l,a as n,b as c,c as d}from"./card-CB2KYkrP.js";import{S as u}from"./skeleton-B4zDkVHp.js";import{R as j,B as p,X as v,Y as f,T as b,f as y,g as N}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-react-BfuodpLv.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";const _={short_term:"var(--color-chart-4)",working:"var(--color-chart-3)",episodic:"var(--color-chart-1)",semantic:"var(--color-chart-2)"};function r({label:t,value:o}){const e=Math.round(o*100);return s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:t}),s.jsxs("span",{className:"font-mono font-medium",children:[e,"%"]})]}),s.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${e}%`}})})]})}function E(){const{data:t,isLoading:o}=x(),{t:e}=h(),i=t?.stage_distribution?[{stage:e("evolution.shortTerm"),count:t.stage_distribution.short_term,key:"short_term"},{stage:e("evolution.working"),count:t.stage_distribution.working,key:"working"},{stage:e("evolution.episodic"),count:t.stage_distribution.episodic,key:"episodic"},{stage:e("evolution.semantic"),count:t.stage_distribution.semantic,key:"semantic"}]:[];return s.jsx(g,{label:e("license.pro_feature","Pro Feature"),children:s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("evolution.title")}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.brainMetrics")})}),s.jsx(d,{children:o?s.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,m)=>s.jsx(u,{className:"h-10 w-full"},m))}):t?s.jsxs("div",{className:"space-y-4",children:[s.jsx(r,{label:e("evolution.maturity"),value:t.maturity_level}),s.jsx(r,{label:e("evolution.plasticity"),value:t.plasticity}),s.jsx(r,{label:e("evolution.semanticRatio"),value:t.semantic_ratio}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalFibers")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_fibers.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-muted-foreground",children:e("evolution.totalNeurons")}),s.jsx("p",{className:"font-mono text-lg font-bold",children:t.total_neurons.toLocaleString()})]})]})]}):null})]}),s.jsxs(l,{children:[s.jsx(n,{children:s.jsx(c,{children:e("evolution.stageDistribution")})}),s.jsx(d,{children:o?s.jsx(u,{className:"h-64 w-full"}):s.jsx(j,{width:"100%",height:260,children:s.jsxs(p,{data:i,children:[s.jsx(v,{dataKey:"stage",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(f,{tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),s.jsx(b,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),s.jsx(y,{dataKey:"count",radius:[4,4,0,0],children:i.map(a=>s.jsx(N,{fill:_[a.key]??"var(--color-chart-1)"},a.stage))})]})})})]})]})]})})}export{E as default}; diff --git a/src/surreal_memory/server/static/dist/assets/GraphPage-DwQB1_DY.js b/src/surreal_memory/server/static/dist/assets/GraphPage-CrI1ELz_.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/GraphPage-DwQB1_DY.js rename to src/surreal_memory/server/static/dist/assets/GraphPage-CrI1ELz_.js index 36472e72..138de589 100644 --- a/src/surreal_memory/server/static/dist/assets/GraphPage-DwQB1_DY.js +++ b/src/surreal_memory/server/static/dist/assets/GraphPage-CrI1ELz_.js @@ -1,4 +1,4 @@ -import{j as V}from"./vendor-query-CqA1cBNl.js";import{g as mi,r as Te}from"./vendor-react-BfuodpLv.js";import{h as er,u as tr,B as ir,b as rr}from"./index-C26pxqlr.js";import{C as Pt,a as nr,b as ar,c as It}from"./card-B0vNsxr_.js";import{S as or}from"./skeleton-DQJ-n00q.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";var Qe={exports:{}},Ot;function sr(){if(Ot)return Qe.exports;Ot=1;var n=typeof Reflect=="object"?Reflect:null,i=n&&typeof n.apply=="function"?n.apply:function(v,_,S){return Function.prototype.apply.call(v,_,S)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:t=function(v){return Object.getOwnPropertyNames(v)};function e(m){console&&console.warn&&console.warn(m)}var r=Number.isNaN||function(v){return v!==v};function a(){a.init.call(this)}Qe.exports=a,Qe.exports.once=D,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||r(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function u(m){return m._maxListeners===void 0?a.defaultMaxListeners:m._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(v){for(var _=[],S=1;S0&&(P=_[0]),P instanceof Error)throw P;var j=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw j.context=P,j}var z=F[v];if(z===void 0)return!1;if(typeof z=="function")i(z,this,_);else for(var f=z.length,K=b(z,f),S=0;S0&&P.length>G&&!P.warned){P.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=m,j.type=v,j.count=P.length,e(j)}return m}a.prototype.addListener=function(v,_){return h(this,v,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,_){return h(this,v,_,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,_){var S={fired:!1,wrapFn:void 0,target:m,type:v,listener:_},G=d.bind(S);return G.listener=_,S.wrapFn=G,G}a.prototype.once=function(v,_){return s(_),this.on(v,l(this,v,_)),this},a.prototype.prependOnceListener=function(v,_){return s(_),this.prependListener(v,l(this,v,_)),this},a.prototype.removeListener=function(v,_){var S,G,F,P,j;if(s(_),G=this._events,G===void 0)return this;if(S=G[v],S===void 0)return this;if(S===_||S.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete G[v],G.removeListener&&this.emit("removeListener",v,S.listener||_));else if(typeof S!="function"){for(F=-1,P=S.length-1;P>=0;P--)if(S[P]===_||S[P].listener===_){j=S[P].listener,F=P;break}if(F<0)return this;F===0?S.shift():w(S,F),S.length===1&&(G[v]=S[0]),G.removeListener!==void 0&&this.emit("removeListener",v,j||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var _,S,G;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[v]),this;if(arguments.length===0){var F=Object.keys(S),P;for(G=0;G=0;G--)this.removeListener(v,_[G]);return this};function c(m,v,_){var S=m._events;if(S===void 0)return[];var G=S[v];return G===void 0?[]:typeof G=="function"?_?[G.listener||G]:[G]:_?C(G):b(G,G.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var _=v[m];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var _=new Array(v),S=0;Sn++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class kt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class x extends kt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,x.prototype.constructor)}}class k extends kt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class I extends kt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function bi(n,i){this.key=n,this.attributes=i,this.clear()}bi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function wi(n,i){this.key=n,this.attributes=i,this.clear()}wi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Ei(n,i){this.key=n,this.attributes=i,this.clear()}Ei.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const _i=0,Ti=1,dr=2,Si=3;function ve(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===_i){if(s=n._nodes.get(e),!s)throw new k(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===Si){if(r=""+r,u=n._edges.get(r),!u)throw new k(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new k(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ti?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function lr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes[s]}}function cr(n,i,t){n.prototype[i]=function(e,r){const[a]=ve(this,i,t,e,r);return a.attributes}}function fr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);if(typeof h!="function")throw new x(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function br(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(typeof s!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const wr=[{name:n=>`get${n}Attribute`,attacher:lr},{name:n=>`get${n}Attributes`,attacher:cr},{name:n=>`has${n}Attribute`,attacher:fr},{name:n=>`set${n}Attribute`,attacher:gr},{name:n=>`update${n}Attribute`,attacher:pr},{name:n=>`remove${n}Attribute`,attacher:mr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:yr},{name:n=>`update${n}Attributes`,attacher:br}];function Er(n){wr.forEach(function({name:i,attacher:t}){t(n,i("Node"),_i),t(n,i("Source"),Ti),t(n,i("Target"),dr),t(n,i("Opposite"),Si)})}function _r(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function Tr(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new k(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Sr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Cr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new x(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function Dr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Lr=[{name:n=>`get${n}Attribute`,attacher:_r},{name:n=>`get${n}Attributes`,attacher:Tr},{name:n=>`has${n}Attribute`,attacher:Sr},{name:n=>`set${n}Attribute`,attacher:Cr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:kr},{name:n=>`merge${n}Attributes`,attacher:xr},{name:n=>`update${n}Attributes`,attacher:Dr}];function Gr(n){Lr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Fr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Nr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Pr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function ht(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Ir(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Or(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function dt(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ur(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function zr(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function xt(n,i,t,e,r,a){const o=i?Pr:Nr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function $r(n,i,t,e){const r=[];return xt(!1,n,i,t,e,function(a){r.push(a)}),r}function Br(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,ht(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,ht(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,ht(t.undirected))),e}function Dt(n,i,t,e,r,a,o){const s=t?Or:Ir;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Mr(n,i,t,e,r){const a=[];return Dt(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Hr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,dt(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,dt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,dt(t.undirected,e))),r}function Wr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Ur(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return $r(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new k(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new k(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Mr(e,this.multi,r,s,o)}throw new x(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);return xt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new k(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new k(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Dt(!1,e,this.multi,r,c,d,l)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,C,D,T,A,m)=>{l[g++]=d(b,w,C,D,T,A,m)})}else l=[],h.push((c,g,b,w,C,D,T)=>{l.push(d(c,g,b,w,C,D,T))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,C,D,T)=>{d(c,g,b,w,C,D,T)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new x(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,C,D,T,A)=>{c=d(c,g,b,w,C,D,T,A)}),this[a].apply(this,h),c}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${u}" node in the graph.`);return xt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new k(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new k(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Dt(!0,e,this.multi,r,l,h,d)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>h(l,c,g,b,w,C,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>!h(l,c,g,b,w,C,D)),!this[a].apply(this,u)}}function qr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return zr(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Br(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new k(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Hr(e,r,u,s)}throw new x(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Kr(n){Fr.forEach(i=>{Wr(n,i),jr(n,i),Vr(n,i),qr(n,i)})}const Yr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ot(){this.A=null,this.B=null}ot.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ot.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Lt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ot;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Lt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ot;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Jr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,o)}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);Lt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${o}: could not find the "${h}" node in the graph.`);return Lt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function tn(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Xr(e==="mixed"?this.type:e,r,s)}}function rn(n){Yr.forEach(i=>{Jr(n,i),Qr(n,i),en(n,i),tn(n,i)})}function et(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&r(u.key,null,u.attributes,null,null,null,null)}}function nn(n,i){const t={key:n};return yi(i.attributes)||(t.attributes=Z({},i.attributes)),t}function an(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return yi(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function on(n){if(!J(n))throw new x('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new x("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sn(n){if(!J(n))throw new x('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new x("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new x("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new x("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const un=hr(),hn=new Set(["directed","undirected","mixed"]),zt=new Set(["domain","_events","_eventsCount","_maxListeners"]),dn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],ln={allowSelfLoops:!0,multi:!1,type:"mixed"};function cn(n,i,t){if(t&&!J(t))throw new x(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function $t(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Ri(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new k(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new k(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function fn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new x(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const T=[g.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const A=g.attributes;g.attributes=h(A),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else Z(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,C=!1;d||(d=$t(n,a,{}),w=!0,a===o&&(l=d,C=!0)),l||(l=$t(n,o,{}),C=!0),c=new Ge(e,r,d,l,s),n._edges.set(r,c);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=r,n.emit("edgeAdded",b),[r,!0,w,C]}function Ae(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class W extends vi.EventEmitter{constructor(i){if(super(),i=Z({},ln,i),typeof i.multi!="boolean")throw new x(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!hn.has(i.type))throw new x(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new x(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?bi:i.type==="directed"?wi:Ei;ae(this,"NodeDataClass",t);const e="geid_"+un()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),zt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new k(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new k(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new k(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return cn(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new x(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new x(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do Ae(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do Ae(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do Ae(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new k(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new k(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return Ae(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new k(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new k(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new x("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new x("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new x("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new x("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntry: expecting a callback.");et(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");et(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new x("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new x("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new x("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new x("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new x("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new x("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new x("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new x("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=nn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=an(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof W)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new x("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new x("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new x("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,Ri(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!zt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(W.prototype[Symbol.for("nodejs.util.inspect.custom")]=W.prototype.inspect);dn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?Ri:fn;n.generateKey?W.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:W.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});Er(W);Gr(W);Kr(W);rn(W);class Ai extends W{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new x("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new x('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ki extends W{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new x("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new x('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class xi extends W{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Di extends W{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new x('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends W{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new x('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(W);Fe(Ai);Fe(ki);Fe(xi);Fe(Di);Fe(Li);W.Graph=W;W.DirectedGraph=Ai;W.UndirectedGraph=ki;W.MultiGraph=xi;W.MultiDirectedGraph=Di;W.MultiUndirectedGraph=Li;W.InvalidArgumentsGraphError=x;W.NotFoundGraphError=k;W.UsageGraphError=I;function gn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function We(n){var i=gn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Bt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t0&&(P=_[0]),P instanceof Error)throw P;var j=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw j.context=P,j}var z=F[v];if(z===void 0)return!1;if(typeof z=="function")i(z,this,_);else for(var f=z.length,K=b(z,f),S=0;S0&&P.length>G&&!P.warned){P.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=m,j.type=v,j.count=P.length,e(j)}return m}a.prototype.addListener=function(v,_){return h(this,v,_,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(v,_){return h(this,v,_,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(m,v,_){var S={fired:!1,wrapFn:void 0,target:m,type:v,listener:_},G=d.bind(S);return G.listener=_,S.wrapFn=G,G}a.prototype.once=function(v,_){return s(_),this.on(v,l(this,v,_)),this},a.prototype.prependOnceListener=function(v,_){return s(_),this.prependListener(v,l(this,v,_)),this},a.prototype.removeListener=function(v,_){var S,G,F,P,j;if(s(_),G=this._events,G===void 0)return this;if(S=G[v],S===void 0)return this;if(S===_||S.listener===_)--this._eventsCount===0?this._events=Object.create(null):(delete G[v],G.removeListener&&this.emit("removeListener",v,S.listener||_));else if(typeof S!="function"){for(F=-1,P=S.length-1;P>=0;P--)if(S[P]===_||S[P].listener===_){j=S[P].listener,F=P;break}if(F<0)return this;F===0?S.shift():w(S,F),S.length===1&&(G[v]=S[0]),G.removeListener!==void 0&&this.emit("removeListener",v,j||_)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(v){var _,S,G;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[v]),this;if(arguments.length===0){var F=Object.keys(S),P;for(G=0;G=0;G--)this.removeListener(v,_[G]);return this};function c(m,v,_){var S=m._events;if(S===void 0)return[];var G=S[v];return G===void 0?[]:typeof G=="function"?_?[G.listener||G]:[G]:_?C(G):b(G,G.length)}a.prototype.listeners=function(v){return c(this,v,!0)},a.prototype.rawListeners=function(v){return c(this,v,!1)},a.listenerCount=function(m,v){return typeof m.listenerCount=="function"?m.listenerCount(v):g.call(m,v)},a.prototype.listenerCount=g;function g(m){var v=this._events;if(v!==void 0){var _=v[m];if(typeof _=="function")return 1;if(_!==void 0)return _.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function b(m,v){for(var _=new Array(v),S=0;Sn++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class kt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class x extends kt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,x.prototype.constructor)}}class k extends kt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class I extends kt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function bi(n,i){this.key=n,this.attributes=i,this.clear()}bi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function wi(n,i){this.key=n,this.attributes=i,this.clear()}wi.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Ei(n,i){this.key=n,this.attributes=i,this.clear()}Ei.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const _i=0,Ti=1,dr=2,Si=3;function ve(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===_i){if(s=n._nodes.get(e),!s)throw new k(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===Si){if(r=""+r,u=n._edges.get(r),!u)throw new k(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new k(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ti?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function lr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes[s]}}function cr(n,i,t){n.prototype[i]=function(e,r){const[a]=ve(this,i,t,e,r);return a.attributes}}function fr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ve(this,i,t,e,r,a,o);if(typeof h!="function")throw new x(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(!J(s))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function br(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ve(this,i,t,e,r,a);if(typeof s!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const wr=[{name:n=>`get${n}Attribute`,attacher:lr},{name:n=>`get${n}Attributes`,attacher:cr},{name:n=>`has${n}Attribute`,attacher:fr},{name:n=>`set${n}Attribute`,attacher:gr},{name:n=>`update${n}Attribute`,attacher:pr},{name:n=>`remove${n}Attribute`,attacher:mr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:yr},{name:n=>`update${n}Attributes`,attacher:br}];function Er(n){wr.forEach(function({name:i,attacher:t}){t(n,i("Node"),_i),t(n,i("Source"),Ti),t(n,i("Target"),dr),t(n,i("Opposite"),Si)})}function _r(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function Tr(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new k(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Sr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Cr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new k(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new x(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new x(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function Dr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new k(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new x(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Lr=[{name:n=>`get${n}Attribute`,attacher:_r},{name:n=>`get${n}Attributes`,attacher:Tr},{name:n=>`has${n}Attribute`,attacher:Sr},{name:n=>`set${n}Attribute`,attacher:Cr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:kr},{name:n=>`merge${n}Attributes`,attacher:xr},{name:n=>`update${n}Attributes`,attacher:Dr}];function Gr(n){Lr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Fr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Nr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Pr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function ht(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Ir(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Or(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function dt(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Ur(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function zr(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function xt(n,i,t,e,r,a){const o=i?Pr:Nr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function $r(n,i,t,e){const r=[];return xt(!1,n,i,t,e,function(a){r.push(a)}),r}function Br(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,ht(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,ht(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,ht(t.undirected))),e}function Dt(n,i,t,e,r,a,o){const s=t?Or:Ir;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Mr(n,i,t,e,r){const a=[];return Dt(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Hr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,dt(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,dt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,dt(t.undirected,e))),r}function Wr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Ur(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return $r(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new k(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new k(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Mr(e,this.multi,r,s,o)}throw new x(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);return xt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new k(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new k(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Dt(!1,e,this.multi,r,c,d,l)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((b,w,C,D,T,A,m)=>{l[g++]=d(b,w,C,D,T,A,m)})}else l=[],h.push((c,g,b,w,C,D,T)=>{l.push(d(c,g,b,w,C,D,T))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((c,g,b,w,C,D,T)=>{d(c,g,b,w,C,D,T)&&l.push(c)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new x(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let c=l;return h.push((g,b,w,C,D,T,A)=>{c=d(c,g,b,w,C,D,T,A)}),this[a].apply(this,h),c}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${u}" node in the graph.`);return xt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new k(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new k(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Dt(!0,e,this.multi,r,l,h,d)}throw new x(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>h(l,c,g,b,w,C,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,c,g,b,w,C,D)=>!h(l,c,g,b,w,C,D)),!this[a].apply(this,u)}}function qr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return zr(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Br(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new k(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Hr(e,r,u,s)}throw new x(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Kr(n){Fr.forEach(i=>{Wr(n,i),jr(n,i),Vr(n,i),qr(n,i)})}const Yr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ot(){this.A=null,this.B=null}ot.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ot.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Lt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ot;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Lt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Xr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ot;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Jr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,o)}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);Lt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new x(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let c=l;return this[a](h,(g,b)=>{c=d(c,g,b)}),c}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new k(`Graph.${o}: could not find the "${h}" node in the graph.`);return Lt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(c,g)=>!d(c,g))}}function tn(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Xr(e==="mixed"?this.type:e,r,s)}}function rn(n){Yr.forEach(i=>{Jr(n,i),Qr(n,i),en(n,i),tn(n,i)})}function et(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do c=l.target,c.key!==h&&(c=l.source),g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&r(u.key,null,u.attributes,null,null,null,null)}}function nn(n,i){const t={key:n};return yi(i.attributes)||(t.attributes=Z({},i.attributes)),t}function an(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return yi(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function on(n){if(!J(n))throw new x('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new x("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function sn(n){if(!J(n))throw new x('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new x("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new x("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new x("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new x("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const un=hr(),hn=new Set(["directed","undirected","mixed"]),zt=new Set(["domain","_events","_eventsCount","_maxListeners"]),dn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],ln={allowSelfLoops:!0,multi:!1,type:"mixed"};function cn(n,i,t){if(t&&!J(t))throw new x(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function $t(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Ri(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new k(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new k(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function fn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new x(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new x(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),c,g;if(!t&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const T=[g.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const A=g.attributes;g.attributes=h(A),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else Z(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const b={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,C=!1;d||(d=$t(n,a,{}),w=!0,a===o&&(l=d,C=!0)),l||(l=$t(n,o,{}),C=!0),c=new Ge(e,r,d,l,s),n._edges.set(r,c);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,b.key=r,n.emit("edgeAdded",b),[r,!0,w,C]}function Ae(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class W extends vi.EventEmitter{constructor(i){if(super(),i=Z({},ln,i),typeof i.multi!="boolean")throw new x(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!hn.has(i.type))throw new x(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new x(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?bi:i.type==="directed"?wi:Ei;ae(this,"NodeDataClass",t);const e="geid_"+un()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),zt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new x(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new k(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new k(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new k(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new k(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new k(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new k(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return cn(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new x(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new x(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new k(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do Ae(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do Ae(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do Ae(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new k(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new k(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return Ae(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new k(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new k(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ae(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new x("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new x("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new x("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new x("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new x("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Ut(t))throw new x("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntry: expecting a callback.");et(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");et(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new x("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");et(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new x("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new x("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new x("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new x("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new x("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new x("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new x("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new x("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=nn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=an(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof W)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,c,g,b)=>{t?b?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):b?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new x("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new x("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new x("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,Ri(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!zt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(W.prototype[Symbol.for("nodejs.util.inspect.custom")]=W.prototype.inspect);dn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?Ri:fn;n.generateKey?W.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:W.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});Er(W);Gr(W);Kr(W);rn(W);class Ai extends W{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new x("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new x('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ki extends W{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new x("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new x('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class xi extends W{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Di extends W{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new x('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends W{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new x("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new x('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(W);Fe(Ai);Fe(ki);Fe(xi);Fe(Di);Fe(Li);W.Graph=W;W.DirectedGraph=Ai;W.UndirectedGraph=ki;W.MultiGraph=xi;W.MultiDirectedGraph=Di;W.MultiUndirectedGraph=Li;W.InvalidArgumentsGraphError=x;W.NotFoundGraphError=k;W.UsageGraphError=I;function gn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function We(n){var i=gn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Bt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t>>16,t=(n&65280)>>>8,e=n&255,r=255,a=Pi(i,t,e,r);return ft[n]=a,a}function Mt(n,i,t,e){return t+(i<<8)+(n<<16)}function Ht(n,i,t,e,r,a){var o=Math.floor(t/a*r),s=Math.floor(n.drawingBufferHeight/a-e/a*r),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,i),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var h=De(u,4),d=h[0],l=h[1],c=h[2],g=h[3];return[d,l,c,g]}function E(n,i,t){return(i=We(i))in n?Object.defineProperty(n,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[i]=t,n}function Wt(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function L(n){for(var i=1;i0&&e.jsx(W,{penalties:s.top_penalties}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(d,{children:[e.jsx(o,{children:e.jsx(m,{children:a("health.brainMetrics")})}),e.jsx(h,{children:i?e.jsx(f,{className:"h-80 w-full"}):e.jsx(k,{width:"100%",height:320,children:e.jsxs(S,{data:n,children:[e.jsx(A,{stroke:"var(--color-border)"}),e.jsx(G,{dataKey:"metric",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),e.jsx(O,{angle:90,domain:[0,100],tick:{fill:"var(--color-muted-foreground)",fontSize:10}}),e.jsx(I,{name:a("health.radarName"),dataKey:"value",stroke:"var(--color-primary)",fill:"var(--color-primary)",fillOpacity:.2,strokeWidth:2})]})})})]}),e.jsxs(d,{children:[e.jsx(o,{children:e.jsx(m,{children:a("health.warnings")})}),e.jsx(h,{children:i?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((r,l)=>e.jsx(f,{className:"h-10 w-full"},l))}):e.jsxs("div",{className:"space-y-4",children:[s?.warnings&&s.warnings.length>0?e.jsx("div",{className:"space-y-2",children:s.warnings.map((r,l)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border p-3",children:[e.jsx(j,{variant:r.severity==="critical"?"destructive":r.severity==="warning"?"warning":"secondary",className:"mt-0.5 shrink-0",children:r.severity}),e.jsx("span",{className:"text-sm",children:r.message})]},l))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.noWarnings")}),s?.recommendations&&s.recommendations.length>0&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:a("health.recommendations")}),e.jsx("ul",{className:"space-y-1 text-sm",children:s.recommendations.map((r,l)=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-primary",children:"-"}),e.jsx("span",{children:r})]},l))})]})]})})]})]}),e.jsx(K,{})]})}function W({penalties:s}){const{t:i}=x();return e.jsxs(d,{className:"border-amber-500/30 bg-amber-500/5",children:[e.jsx(o,{className:"pb-3",children:e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(w,{className:"size-5 text-amber-500"}),i("health.topPenalties")]})}),e.jsx(h,{children:e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:s.map((a,t)=>e.jsx(B,{penalty:a,rank:t+1},a.component))})})]})}function B({penalty:s,rank:i}){const{t:a}=x(),t=Math.round(s.current_score*100),n=Math.round(s.weight*100),r=s.penalty_points.toFixed(1),l=s.estimated_gain.toFixed(1),p=t>=60?"bg-amber-500":t>=30?"bg-orange-500":"bg-red-500";return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 transition-shadow hover:shadow-md",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-amber-500/15 text-xs font-bold text-amber-600",children:i}),e.jsx("h4",{className:"text-sm font-semibold capitalize",children:s.component})]}),e.jsx(j,{variant:"outline",className:"text-xs text-red-500 border-red-500/30",children:a("health.penaltyPoints",{points:r})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a("health.currentScore",{score:t})}),e.jsx("span",{children:a("health.weight",{weight:n})})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:`h-full rounded-full transition-all ${p}`,style:{width:`${t}%`}})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 rounded-md bg-emerald-500/10 px-2.5 py-1.5",children:[e.jsx(E,{className:"size-3.5 text-emerald-500"}),e.jsx("span",{className:"text-xs font-medium text-emerald-600",children:a("health.estimatedGain",{gain:l})})]}),e.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[e.jsx(R,{className:"mt-0.5 size-3 shrink-0 text-primary"}),e.jsx("span",{children:s.action})]})]})}function K(){const[s,i]=b.useState(!1),{t:a}=x();return e.jsxs(d,{children:[e.jsxs(o,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"size-5 text-primary"}),a("health.enrichTitle")]}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>i(t=>!t),"aria-label":a(s?"health.collapseTips":"health.expandTips"),children:[s?e.jsx(_,{className:"size-4"}):e.jsx(T,{className:"size-4"}),e.jsx("span",{className:"ml-1 text-xs",children:a(s?"health.less":"health.more")})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.enrichDesc")})]}),e.jsx(h,{children:e.jsx("div",{className:`grid grid-cols-1 gap-4 ${s?"md:grid-cols-2":"md:grid-cols-4"}`,children:F.map((t,n)=>{const r=M[n],l=D[n],p=a(`enrichment.${t}Title`),u=a(`enrichment.${t}Tips`,{returnObjects:!0});return e.jsxs("div",{className:"rounded-lg border border-border p-4 transition-shadow hover:shadow-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg",style:{backgroundColor:`${l}15`},children:e.jsx(r,{className:"size-4",style:{color:l}})}),e.jsx("h3",{className:"text-sm font-semibold",children:p})]}),e.jsx("ul",{className:"space-y-2",children:(s?u:u.slice(0,2)).map((c,v)=>e.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:"-"}),e.jsx("span",{className:c.startsWith("BAD:")||c.startsWith("TỆ:")?"text-destructive":c.startsWith("GOOD:")||c.startsWith("TỐT:")?"text-primary":"",children:c})]},v))})]},t)})})})]})}export{Z as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as b}from"./vendor-react-BfuodpLv.js";import{g as y,u as x,b as j,B as C}from"./index-DzyKsRxc.js";import{C as d,a as o,b as m,c as h}from"./card-CB2KYkrP.js";import{S as f}from"./skeleton-B4zDkVHp.js";import{A as w,c as N,I as _,J as T,K as z,G as P,C as $,d as E,L as R}from"./vendor-icons-BYlYobEK.js";import{R as k,a as S,P as A,b as G,c as O,d as I}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const M=[N,z,P,$],D=["#6366f1","#f59e0b","#059669","#06b6d4"],F=["remember","causal","diverse","train"],g={A:{color:"#059669",bg:"#05966915",variant:"success"},B:{color:"#6366f1",bg:"#6366f115",variant:"secondary"},C:{color:"#f59e0b",bg:"#f59e0b15",variant:"warning"},D:{color:"#ef4444",bg:"#ef444415",variant:"destructive"},F:{color:"#ef4444",bg:"#ef444415",variant:"destructive"}};function H(s){const i=s.charAt(0).toUpperCase();return g[i]??g.F}function Z(){const{data:s,isLoading:i}=y(),{t:a}=x(),t=s?H(s.grade):g.F,n=s?[{metric:a("health.purity"),value:s.purity_score*100},{metric:a("health.freshness"),value:s.freshness*100},{metric:a("health.connectivity"),value:s.connectivity*100},{metric:a("health.diversity"),value:s.diversity*100},{metric:a("health.consolidation"),value:s.consolidation_ratio*100},{metric:a("health.activation"),value:s.activation_efficiency*100},{metric:a("health.recall"),value:s.recall_confidence*100},{metric:a("health.orphanRate"),value:(1-s.orphan_rate)*100}]:[];return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:a("health.title")}),s&&e.jsx(j,{variant:t.variant,className:"text-lg px-3 py-1",children:s.grade})]}),s&&s.top_penalties&&s.top_penalties.length>0&&e.jsx(W,{penalties:s.top_penalties}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(d,{children:[e.jsx(o,{children:e.jsx(m,{children:a("health.brainMetrics")})}),e.jsx(h,{children:i?e.jsx(f,{className:"h-80 w-full"}):e.jsx(k,{width:"100%",height:320,children:e.jsxs(S,{data:n,children:[e.jsx(A,{stroke:"var(--color-border)"}),e.jsx(G,{dataKey:"metric",tick:{fill:"var(--color-muted-foreground)",fontSize:12}}),e.jsx(O,{angle:90,domain:[0,100],tick:{fill:"var(--color-muted-foreground)",fontSize:10}}),e.jsx(I,{name:a("health.radarName"),dataKey:"value",stroke:"var(--color-primary)",fill:"var(--color-primary)",fillOpacity:.2,strokeWidth:2})]})})})]}),e.jsxs(d,{children:[e.jsx(o,{children:e.jsx(m,{children:a("health.warnings")})}),e.jsx(h,{children:i?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((r,l)=>e.jsx(f,{className:"h-10 w-full"},l))}):e.jsxs("div",{className:"space-y-4",children:[s?.warnings&&s.warnings.length>0?e.jsx("div",{className:"space-y-2",children:s.warnings.map((r,l)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border p-3",children:[e.jsx(j,{variant:r.severity==="critical"?"destructive":r.severity==="warning"?"warning":"secondary",className:"mt-0.5 shrink-0",children:r.severity}),e.jsx("span",{className:"text-sm",children:r.message})]},l))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.noWarnings")}),s?.recommendations&&s.recommendations.length>0&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:a("health.recommendations")}),e.jsx("ul",{className:"space-y-1 text-sm",children:s.recommendations.map((r,l)=>e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"text-primary",children:"-"}),e.jsx("span",{children:r})]},l))})]})]})})]})]}),e.jsx(K,{})]})}function W({penalties:s}){const{t:i}=x();return e.jsxs(d,{className:"border-amber-500/30 bg-amber-500/5",children:[e.jsx(o,{className:"pb-3",children:e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(w,{className:"size-5 text-amber-500"}),i("health.topPenalties")]})}),e.jsx(h,{children:e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:s.map((a,t)=>e.jsx(B,{penalty:a,rank:t+1},a.component))})})]})}function B({penalty:s,rank:i}){const{t:a}=x(),t=Math.round(s.current_score*100),n=Math.round(s.weight*100),r=s.penalty_points.toFixed(1),l=s.estimated_gain.toFixed(1),p=t>=60?"bg-amber-500":t>=30?"bg-orange-500":"bg-red-500";return e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 transition-shadow hover:shadow-md",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-amber-500/15 text-xs font-bold text-amber-600",children:i}),e.jsx("h4",{className:"text-sm font-semibold capitalize",children:s.component})]}),e.jsx(j,{variant:"outline",className:"text-xs text-red-500 border-red-500/30",children:a("health.penaltyPoints",{points:r})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:a("health.currentScore",{score:t})}),e.jsx("span",{children:a("health.weight",{weight:n})})]}),e.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:`h-full rounded-full transition-all ${p}`,style:{width:`${t}%`}})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 rounded-md bg-emerald-500/10 px-2.5 py-1.5",children:[e.jsx(E,{className:"size-3.5 text-emerald-500"}),e.jsx("span",{className:"text-xs font-medium text-emerald-600",children:a("health.estimatedGain",{gain:l})})]}),e.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[e.jsx(R,{className:"mt-0.5 size-3 shrink-0 text-primary"}),e.jsx("span",{children:s.action})]})]})}function K(){const[s,i]=b.useState(!1),{t:a}=x();return e.jsxs(d,{children:[e.jsxs(o,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"size-5 text-primary"}),a("health.enrichTitle")]}),e.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>i(t=>!t),"aria-label":a(s?"health.collapseTips":"health.expandTips"),children:[s?e.jsx(_,{className:"size-4"}):e.jsx(T,{className:"size-4"}),e.jsx("span",{className:"ml-1 text-xs",children:a(s?"health.less":"health.more")})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a("health.enrichDesc")})]}),e.jsx(h,{children:e.jsx("div",{className:`grid grid-cols-1 gap-4 ${s?"md:grid-cols-2":"md:grid-cols-4"}`,children:F.map((t,n)=>{const r=M[n],l=D[n],p=a(`enrichment.${t}Title`),u=a(`enrichment.${t}Tips`,{returnObjects:!0});return e.jsxs("div",{className:"rounded-lg border border-border p-4 transition-shadow hover:shadow-sm",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-8 items-center justify-center rounded-lg",style:{backgroundColor:`${l}15`},children:e.jsx(r,{className:"size-4",style:{color:l}})}),e.jsx("h3",{className:"text-sm font-semibold",children:p})]}),e.jsx("ul",{className:"space-y-2",children:(s?u:u.slice(0,2)).map((c,v)=>e.jsxs("li",{className:"flex gap-2 text-xs leading-relaxed",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-muted-foreground",children:"-"}),e.jsx("span",{className:c.startsWith("BAD:")||c.startsWith("TỆ:")?"text-destructive":c.startsWith("GOOD:")||c.startsWith("TỐT:")?"text-primary":"",children:c})]},v))})]},t)})})})]})}export{Z as default}; diff --git a/src/surreal_memory/server/static/dist/assets/OraclePage-7FBeVFXa.js b/src/surreal_memory/server/static/dist/assets/OraclePage--QnA7bus.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/OraclePage-7FBeVFXa.js rename to src/surreal_memory/server/static/dist/assets/OraclePage--QnA7bus.js index 7db4e804..fa1dcac7 100644 --- a/src/surreal_memory/server/static/dist/assets/OraclePage-7FBeVFXa.js +++ b/src/surreal_memory/server/static/dist/assets/OraclePage--QnA7bus.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{g as _,U as F,V as Y,W as K,B as H,X as G,Y as V}from"./vendor-icons-BYlYobEK.js";import{u as j,h as q,c as J}from"./index-C26pxqlr.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const X=[{key:"daily",labelKey:"oracle.dailyReading",icon:_},{key:"whatif",labelKey:"oracle.whatif",icon:F},{key:"matchup",labelKey:"oracle.matchup",icon:Y}];function Q({mode:e,onModeChange:n}){const{t}=j();return s.jsx("div",{className:"flex gap-2",children:X.map(({key:r,labelKey:o,icon:a})=>s.jsxs("button",{onClick:()=>n(r),className:`flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${e===r?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[s.jsx(a,{className:"size-4"}),t(o)]},r))})}function Z({card:e,className:n=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] p-5 ${n}`,style:{backfaceVisibility:"hidden"},children:[s.jsx("div",{className:`absolute inset-0 bg-gradient-to-b ${e.suit.bg} opacity-60`}),s.jsx("div",{className:"absolute right-3 top-3 opacity-10",children:s.jsx("span",{className:"text-7xl font-bold",style:{color:e.suit.color},children:e.suit.symbol})}),s.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[s.jsx("div",{className:"mb-1 text-center",children:s.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.2em]",style:{color:e.suit.color},children:["✦ ",e.title," ✦"]})}),s.jsx("div",{className:"my-4 flex justify-center",children:s.jsx("div",{className:"flex size-16 items-center justify-center rounded-full border-2",style:{borderColor:e.suit.color+"40",backgroundColor:e.suit.color+"15"},children:s.jsx("span",{className:"text-3xl",style:{color:e.suit.color},children:e.suit.symbol})})}),s.jsx("div",{className:"mx-auto mb-3 h-px w-3/4",style:{backgroundColor:e.suit.color+"30"}}),s.jsx("div",{className:"mb-auto flex-1",children:s.jsxs("p",{className:"line-clamp-3 text-center text-sm leading-relaxed text-white/80",children:["“",e.content,"”"]})}),s.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-white/50",children:[s.jsxs("span",{"aria-label":`Activation ${e.activation}`,children:[s.jsx("span",{"aria-hidden":"true",children:"⚡"})," ",e.activation]}),s.jsxs("span",{"aria-label":`Connections ${e.connectionCount}`,children:[s.jsx("span",{"aria-hidden":"true",children:"🔗"})," ",e.connectionCount]}),s.jsxs("span",{"aria-label":`Age ${e.age}`,children:[s.jsx("span",{"aria-hidden":"true",children:"📅"})," ",e.age]})]}),s.jsx("div",{className:"mt-2 text-center",children:s.jsxs("span",{className:"inline-block rounded-full px-3 py-0.5 text-xs font-medium",style:{backgroundColor:e.suit.color+"20",color:e.suit.color},children:[e.suit.symbol," ",e.suitKey]})})]})]})}function ee({className:e=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] ${e}`,style:{backfaceVisibility:"hidden"},children:[s.jsxs("div",{className:"absolute inset-0 opacity-30",children:[s.jsx("div",{className:"absolute inset-0",style:{background:"repeating-conic-gradient(from 0deg at 50% 50%, #818cf8 0deg 30deg, transparent 30deg 60deg)",opacity:.15}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, transparent 30%, #818cf820 50%, transparent 70%)"}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, #818cf815 0%, transparent 40%)"}})]}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"text-5xl font-bold opacity-20",style:{color:"#818cf8"},children:"✦"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl font-bold text-white/40",children:"?"})]})}),s.jsx("div",{className:"absolute inset-0 rounded-2xl ring-1 ring-inset ring-white/5"})]})}function M({card:e,autoFlipDelay:n,onFlip:t,className:r=""}){const[o,a]=d.useState(!1),l=d.useRef(t);l.current=t,d.useEffect(()=>{if(n!==void 0&&n>=0){const i=setTimeout(()=>{a(!0),l.current?.()},n);return()=>clearTimeout(i)}},[n]);const c=()=>{const i=!o;a(i),i&&l.current?.()};return s.jsx("div",{className:`cursor-pointer ${r}`,style:{perspective:"1000px"},onClick:c,role:"button",tabIndex:0,"aria-label":o?`Card: ${e.title} — ${e.content}`:"Tap to reveal card",onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),c())},children:s.jsxs("div",{className:"relative h-full w-full",style:{transformStyle:"preserve-3d",transform:o?"rotateY(180deg)":"rotateY(0deg)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"600ms"},children:[s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden"},children:s.jsx(ee,{className:"h-full w-full"})}),s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:s.jsx(Z,{card:e,className:"h-full w-full"})})]})})}const b=800,C=420,m=180,w=260,I=24;function te(e,n,t,r,o,a){e.beginPath(),e.moveTo(n+a,t),e.lineTo(n+r-a,t),e.quadraticCurveTo(n+r,t,n+r,t+a),e.lineTo(n+r,t+o-a),e.quadraticCurveTo(n+r,t+o,n+r-a,t+o),e.lineTo(n+a,t+o),e.quadraticCurveTo(n,t+o,n,t+o-a),e.lineTo(n,t+a),e.quadraticCurveTo(n,t,n+a,t),e.closePath()}function ne(e,n,t,r,o){te(e,t,r,m,w,12),e.fillStyle="#1a1814",e.fill(),e.strokeStyle=n.suit.color+"40",e.lineWidth=1.5,e.stroke(),e.fillStyle="#a0a0a0",e.font="bold 10px system-ui, sans-serif",e.textAlign="center",e.fillText(o.toUpperCase(),t+m/2,r-8),e.fillStyle=n.suit.color,e.font="36px system-ui, sans-serif",e.fillText(n.suit.symbol,t+m/2,r+50),e.fillStyle=n.suit.color,e.font="bold 11px system-ui, sans-serif",e.fillText(n.title,t+m/2,r+72),e.strokeStyle=n.suit.color+"30",e.lineWidth=1,e.beginPath(),e.moveTo(t+30,r+82),e.lineTo(t+m-30,r+82),e.stroke(),e.fillStyle="#e0e0e0",e.font="12px system-ui, sans-serif";const a=m-28,l=n.content.split(" ");let c="",i=r+100;const u=5;let f=0;for(const h of l){const p=c+(c?" ":"")+h;if(e.measureText(p).width>a&&c){if(e.fillText(c,t+m/2,i),c=h,i+=16,f++,f>=u){e.fillText(c+"...",t+m/2,i);break}}else c=p}f{ne(t,u,c+f*(m+I),i,a[f])}),t.fillStyle="#606060",t.font="10px system-ui, sans-serif",t.textAlign="center",t.fillText("Surreal-Memory — surrealmemory.dev",b/2,C-10),new Promise(u=>{n.toBlob(f=>u(f),"image/png")})}async function se(e){try{const n=await W(e);return await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0}catch{return!1}}async function re(e){const n=await W(e),t=URL.createObjectURL(n),r=document.createElement("a");r.href=t,r.download=`oracle-${e.brainName}-${e.date}.png`,r.click(),URL.revokeObjectURL(t)}function oe({reading:e}){const{t:n}=j(),[t,r]=d.useState(!1),o=async()=>{await se(e)&&(r(!0),setTimeout(()=>r(!1),2e3))},a=()=>{re(e)};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:o,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.copyCard"),children:t?s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"size-3.5 text-green-400"}),n("oracle.copied")]}):s.jsxs(s.Fragment,{children:[s.jsx(H,{className:"size-3.5"}),n("oracle.copyCard")]})}),s.jsxs("button",{onClick:a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.downloadCard"),children:[s.jsx(G,{className:"size-3.5"}),n("oracle.downloadCard")]})]})}const ae=["Your past is marked by {past} — {pastContent}. Today, {present} guides your path — {presentContent}. Tomorrow, {future} awaits — {futureContent}.","{past} shaped what came before: {pastContent}. Now {present} holds the key — {presentContent}. The future whispers of {future}: {futureContent}.","From the shadow of {past} ({pastContent}), through the lens of {present} ({presentContent}), your path leads to {future} — {futureContent}.","The memory of {past} echoes: {pastContent}. {present} illuminates the now: {presentContent}. {future} beckons ahead: {futureContent}.","Once, {past} taught you: {pastContent}. Today, {present} reveals: {presentContent}. Soon, {future} will show: {futureContent}.","{past} planted seeds — {pastContent}. {present} tends the garden — {presentContent}. {future} promises the harvest — {futureContent}."],ie=['What if {suitA} and {suitB} collided? Imagine: "{cardA}" meets "{cardB}" — and {wildcardSuit} throws in a twist: "{wildcard}"','In another timeline, {suitA} chose differently: "{cardA}". Meanwhile {suitB} discovered: "{cardB}". The catalyst? {wildcardSuit}: "{wildcard}"',`Picture this: {suitA}'s memory ("{cardA}") suddenly merges with {suitB}'s truth ("{cardB}"). {wildcardSuit} watches from the shadows: "{wildcard}"`,'Two paths diverged — {suitA} whispered "{cardA}" while {suitB} insisted "{cardB}". {wildcardSuit} appeared: "{wildcard}"','What if you had followed {suitA} ("{cardA}") instead of {suitB} ("{cardB}")? {wildcardSuit} holds the answer: "{wildcard}"','Rewind. {suitA} says: "{cardA}". Fast forward. {suitB} replies: "{cardB}". Plot twist by {wildcardSuit}: "{wildcard}"'],le=['Which memory is stronger? {suitA}: "{contentA}" vs {suitB}: "{contentB}"','{suitA} challenges {suitB}! "{contentA}" faces off against "{contentB}" — who wins?','Battle of memories: {suitA} brings "{contentA}", {suitB} counters with "{contentB}"','Your brain asks: is "{contentA}" ({suitA}) more important than "{contentB}" ({suitB})?','Memory arena: {suitA} ("{contentA}") vs {suitB} ("{contentB}") — choose wisely!'];function z(e,n){let t=0;const r=`${e}:${n}`;for(let o=0;o>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function T(e){let n=e|0;return()=>{n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function S(e,n,t){const r=[...e],o=[];for(let a=0;a0;a++){const l=Math.floor(t()*r.length);o.push(r[l]),r.splice(l,1)}return o}function $(e,n){return e.length===0?"":e[Math.floor(n()*e.length)]}function R(e,n){return Object.entries(n).reduce((t,[r,o])=>t.replaceAll(`{${r}}`,o),e)}function de(e,n,t){if(e.length<3)return null;const r=new Date().toISOString().slice(0,10),o=z(r,n),a=T(o),l=[...e].sort((A,k)=>k.activation-A.activation),c=l.slice(0,Math.max(Math.ceil(l.length*.6),3)),i=S(c,3,a);if(i.length<3)return null;const[u,f,h]=i,p=R($(ae,a),{past:u.suit.name,present:f.suit.name,future:h.suit.name,pastContent:u.content,presentContent:f.content,futureContent:h.content});return{past:u,present:f,future:h,interpretation:p,date:r,brainName:n}}function O(e,n){if(e.length<3)return null;const t=T(n??Date.now()),r=S(e,2,t);if(r.length<2)return null;const o=e.filter(i=>!r.includes(i)),a=S(o.length>0?o:e,1,t);if(a.length===0)return null;const l=a[0],c=R($(ie,t),{cardA:r[0].content,cardB:r[1].content,suitA:r[0].suit.name,suitB:r[1].suit.name,wildcard:l.content,wildcardSuit:l.suit.name});return{decisions:r,error:l,scenario:c}}function B(e,n=1,t=5,r=[],o){if(e.length<2)return null;const a=o??Date.now(),l=T(ce(a,n*7919)),c=e.filter(f=>!r.includes(f.id)),i=c.length>=2?c:e,u=S(i,2,l);return u.length<2?null:{cardA:u[0],cardB:u[1],round:n,score:0,totalRounds:t}}function ue(e,n,t){const r=z(e.id,n.id),o=T(r);return R($(le,o),{suitA:e.suit.name,suitB:n.suit.name,contentA:e.content,contentB:n.content})}const L="oracle-daily-reading";function fe(){return new Date().toISOString().slice(0,10)}function me(e){try{const n=localStorage.getItem(L);if(!n)return null;const t=JSON.parse(n);return t.date===fe()&&t.brainName===e?t.reading:null}catch{return null}}function he(e){const n={date:e.date,brainName:e.brainName,reading:e};localStorage.setItem(L,JSON.stringify(n))}function pe(e,n){const[t,r]=d.useState(null);return d.useEffect(()=>{if(e.length<3){r(null);return}const o=me(n);if(o){r(o);return}const a=de(e,n);a&&(he(a),r(a))},[e,n]),t}const P=["past","present","future"];function xe({cards:e,brainName:n}){const{t}=j(),r=pe(e,n),[o,a]=d.useState(0);if(!r)return null;const l=[r.past,r.present,r.future];return s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:t("oracle.dailyHint")}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:l.map((c,i)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:t(`oracle.${P[i]}`)}),s.jsx(M,{card:c,autoFlipDelay:800+i*500,onFlip:()=>a(u=>Math.max(u,i+1)),className:"h-[340px] w-[240px]"})]},P[i]))}),o>=3&&s.jsxs("div",{className:"max-w-xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:[s.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5",children:[s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80",children:r.interpretation}),s.jsx("p",{className:"mt-3 text-center text-xs text-muted-foreground",children:t("oracle.readingDate",{date:r.date,brain:r.brainName})})]}),s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(oe,{reading:r})})]})]})}function ge({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>O(e)),[o,a]=d.useState(!1),l=d.useRef(0),c=d.useCallback(()=>{r(O(e,Date.now())),a(!1),l.current=0},[e]),i=d.useCallback(()=>{l.current+=1,l.current>=3&&a(!0)},[]);if(!t)return null;const u=[...t.decisions,t.error];return s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.whatifHint")}),s.jsxs("button",{onClick:c,className:"flex cursor-pointer items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.reshuffle"),children:[s.jsx(F,{className:"size-3.5"}),n("oracle.reshuffle")]})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:u.map((f,h)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:h<2?n("oracle.memory")+` ${h+1}`:n("oracle.wildcard")}),s.jsx(M,{card:f,onFlip:i,className:"h-[340px] w-[240px]"})]},`slot-${h}`))}),o&&s.jsx("div",{className:"max-w-2xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:s.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-5",children:s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80 italic",children:t.scenario})})})]})}const y=5;function be(e){const n=e.activation,t=Math.min(e.connectionCount,20)/2;return n+t}function ye({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>B(e,1,y)),[o,a]=d.useState(0),[l,c]=d.useState([]),[i,u]=d.useState(null),[f,h]=d.useState(!1),p=d.useRef(null);d.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const A=d.useCallback(x=>{if(!t||i)return;u(x);const g=x==="A"?t.cardA:t.cardB,v=o+be(g),N=[...l,t.cardA.id,t.cardB.id];a(v),c(N),p.current=setTimeout(()=>{if(t.round>=y){h(!0);return}const D=B(e,t.round+1,y,N,Date.now());r(D?{...D,score:v}:null),u(null)},1200)},[t,i,o,l,e]),k=d.useCallback(()=>{p.current&&clearTimeout(p.current),r(B(e,1,y)),a(0),c([]),u(null),h(!1)},[e]);if(!t)return null;const U=ue(t.cardA,t.cardB);return f?s.jsxs("div",{className:"flex flex-col items-center gap-6 animate-in fade-in duration-500",children:[s.jsx(V,{className:"size-12 text-amber-400","aria-hidden":"true"}),s.jsx("h2",{className:"font-display text-2xl font-bold",children:n("oracle.matchupComplete")}),s.jsx("p",{className:"text-4xl font-bold text-primary",children:Math.round(o)}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.matchupScoreDesc")}),s.jsx("button",{onClick:k,className:"cursor-pointer rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:n("oracle.playAgain")})]}):s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex gap-1.5",children:Array.from({length:y},(x,g)=>s.jsx("div",{className:`size-2 rounded-full transition-colors ${g{const g=x==="A"?t.cardA:t.cardB,v=i===x,N=i!==null&&i!==x;return s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:`transition-all duration-500 ${v?"scale-105 ring-2 ring-primary ring-offset-2 ring-offset-background rounded-xl":N?"scale-95 opacity-40":""}`,children:s.jsx(M,{card:g,autoFlipDelay:300+(x==="B"?200:0),className:"h-[340px] w-[240px]"})}),!i&&s.jsx("button",{onClick:()=>A(x),className:"cursor-pointer rounded-lg bg-accent px-5 py-2 text-sm font-medium text-foreground transition-all hover:bg-primary hover:text-primary-foreground",children:n("oracle.choose")}),v&&s.jsx("span",{className:"text-xs font-medium text-primary animate-in fade-in",children:n("oracle.chosen")})]},`${t.round}-${x}`)})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("oracle.score"),": ",s.jsx("span",{className:"font-mono font-bold text-foreground",children:Math.round(o)})]})]})}const E={decision:{name:"The Architect",color:"#fbbf24",symbol:"◆",bg:"from-amber-900/40 to-amber-950/60"},error:{name:"The Shadow",color:"#ef4444",symbol:"♠",bg:"from-red-900/40 to-red-950/60"},insight:{name:"The Oracle",color:"#a78bfa",symbol:"♥",bg:"from-violet-900/40 to-violet-950/60"},fact:{name:"The Scholar",color:"#60a5fa",symbol:"♣",bg:"from-blue-900/40 to-blue-950/60"},workflow:{name:"The Engineer",color:"#34d399",symbol:"★",bg:"from-emerald-900/40 to-emerald-950/60"},concept:{name:"The Dreamer",color:"#22d3ee",symbol:"○",bg:"from-cyan-900/40 to-cyan-950/60"},entity:{name:"The Keeper",color:"#f59e0b",symbol:"△",bg:"from-amber-900/40 to-orange-950/60"},pattern:{name:"The Weaver",color:"#fb7185",symbol:"◇",bg:"from-rose-900/40 to-rose-950/60"},preference:{name:"The Compass",color:"#2dd4bf",symbol:"⊕",bg:"from-teal-900/40 to-teal-950/60"}},je={name:"The Wanderer",color:"#a8a29e",symbol:"?",bg:"from-stone-900/40 to-stone-950/60"};function ve(e){return e in E?{suit:E[e],key:e}:{suit:je,key:"unknown"}}function we(e){const n=new Date(e),r=new Date().getTime()-n.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"today":o===1?"1d":o<30?`${o}d`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Ne(e,n){return n.filter(t=>t.source_id===e||t.target_id===e).length}function Ce(e,n=120){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}function Se(e,n){return e.map(t=>{const{suit:r,key:o}=ve(t.type),a=t.metadata??{},l=typeof a.activation_level=="number"?a.activation_level:.5,c=typeof a.priority=="number"?a.priority:5,i=typeof a.created_at=="string"?a.created_at:new Date().toISOString();return{id:t.id,title:r.name,content:Ce(t.content),suit:r,suitKey:o,activation:Math.round(l*100)/10,connectionCount:Ne(t.id,n),age:we(i),priority:c,createdAt:i}})}function Te(){const{data:e,isLoading:n,error:t}=q(500);return{cards:d.useMemo(()=>e?Se(e.neurons,e.synapses):[],[e]),isLoading:n,error:t}}function De(){const{t:e}=j(),[n,t]=d.useState("daily"),{cards:r,isLoading:o}=Te(),{data:a}=J(),l=a?.active_brain??"default";return o?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx("p",{className:"text-muted-foreground",children:e("oracle.loading")})]}):r.length<3?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 pt-24",children:[s.jsx(_,{className:"size-12 text-muted-foreground/40"}),s.jsx("h2",{className:"font-display text-xl font-semibold text-muted-foreground",children:e("oracle.needMore")}),s.jsx("p",{className:"max-w-md text-center text-sm text-muted-foreground/70",children:e("oracle.needMoreDesc")})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx(Q,{mode:n,onModeChange:t})]}),s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[n==="daily"&&s.jsx(xe,{cards:r,brainName:l}),n==="whatif"&&s.jsx(ge,{cards:r}),n==="matchup"&&s.jsx(ye,{cards:r})]})]})}export{De as default}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{g as _,U as F,V as Y,W as K,B as H,X as G,Y as V}from"./vendor-icons-BYlYobEK.js";import{u as j,h as q,c as J}from"./index-DzyKsRxc.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const X=[{key:"daily",labelKey:"oracle.dailyReading",icon:_},{key:"whatif",labelKey:"oracle.whatif",icon:F},{key:"matchup",labelKey:"oracle.matchup",icon:Y}];function Q({mode:e,onModeChange:n}){const{t}=j();return s.jsx("div",{className:"flex gap-2",children:X.map(({key:r,labelKey:o,icon:a})=>s.jsxs("button",{onClick:()=>n(r),className:`flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-all ${e===r?"bg-primary/15 text-primary ring-1 ring-primary/30":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[s.jsx(a,{className:"size-4"}),t(o)]},r))})}function Z({card:e,className:n=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] p-5 ${n}`,style:{backfaceVisibility:"hidden"},children:[s.jsx("div",{className:`absolute inset-0 bg-gradient-to-b ${e.suit.bg} opacity-60`}),s.jsx("div",{className:"absolute right-3 top-3 opacity-10",children:s.jsx("span",{className:"text-7xl font-bold",style:{color:e.suit.color},children:e.suit.symbol})}),s.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[s.jsx("div",{className:"mb-1 text-center",children:s.jsxs("span",{className:"text-xs font-semibold uppercase tracking-[0.2em]",style:{color:e.suit.color},children:["✦ ",e.title," ✦"]})}),s.jsx("div",{className:"my-4 flex justify-center",children:s.jsx("div",{className:"flex size-16 items-center justify-center rounded-full border-2",style:{borderColor:e.suit.color+"40",backgroundColor:e.suit.color+"15"},children:s.jsx("span",{className:"text-3xl",style:{color:e.suit.color},children:e.suit.symbol})})}),s.jsx("div",{className:"mx-auto mb-3 h-px w-3/4",style:{backgroundColor:e.suit.color+"30"}}),s.jsx("div",{className:"mb-auto flex-1",children:s.jsxs("p",{className:"line-clamp-3 text-center text-sm leading-relaxed text-white/80",children:["“",e.content,"”"]})}),s.jsxs("div",{className:"mt-4 flex items-center justify-between text-xs text-white/50",children:[s.jsxs("span",{"aria-label":`Activation ${e.activation}`,children:[s.jsx("span",{"aria-hidden":"true",children:"⚡"})," ",e.activation]}),s.jsxs("span",{"aria-label":`Connections ${e.connectionCount}`,children:[s.jsx("span",{"aria-hidden":"true",children:"🔗"})," ",e.connectionCount]}),s.jsxs("span",{"aria-label":`Age ${e.age}`,children:[s.jsx("span",{"aria-hidden":"true",children:"📅"})," ",e.age]})]}),s.jsx("div",{className:"mt-2 text-center",children:s.jsxs("span",{className:"inline-block rounded-full px-3 py-0.5 text-xs font-medium",style:{backgroundColor:e.suit.color+"20",color:e.suit.color},children:[e.suit.symbol," ",e.suitKey]})})]})]})}function ee({className:e=""}){return s.jsxs("div",{className:`relative overflow-hidden rounded-2xl border border-white/10 bg-[#16140f] ${e}`,style:{backfaceVisibility:"hidden"},children:[s.jsxs("div",{className:"absolute inset-0 opacity-30",children:[s.jsx("div",{className:"absolute inset-0",style:{background:"repeating-conic-gradient(from 0deg at 50% 50%, #818cf8 0deg 30deg, transparent 30deg 60deg)",opacity:.15}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, transparent 30%, #818cf820 50%, transparent 70%)"}}),s.jsx("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 50% 50%, #818cf815 0%, transparent 40%)"}})]}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"text-5xl font-bold opacity-20",style:{color:"#818cf8"},children:"✦"}),s.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-2xl font-bold text-white/40",children:"?"})]})}),s.jsx("div",{className:"absolute inset-0 rounded-2xl ring-1 ring-inset ring-white/5"})]})}function M({card:e,autoFlipDelay:n,onFlip:t,className:r=""}){const[o,a]=d.useState(!1),l=d.useRef(t);l.current=t,d.useEffect(()=>{if(n!==void 0&&n>=0){const i=setTimeout(()=>{a(!0),l.current?.()},n);return()=>clearTimeout(i)}},[n]);const c=()=>{const i=!o;a(i),i&&l.current?.()};return s.jsx("div",{className:`cursor-pointer ${r}`,style:{perspective:"1000px"},onClick:c,role:"button",tabIndex:0,"aria-label":o?`Card: ${e.title} — ${e.content}`:"Tap to reveal card",onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),c())},children:s.jsxs("div",{className:"relative h-full w-full",style:{transformStyle:"preserve-3d",transform:o?"rotateY(180deg)":"rotateY(0deg)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"600ms"},children:[s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden"},children:s.jsx(ee,{className:"h-full w-full"})}),s.jsx("div",{className:"absolute inset-0",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:s.jsx(Z,{card:e,className:"h-full w-full"})})]})})}const b=800,C=420,m=180,w=260,I=24;function te(e,n,t,r,o,a){e.beginPath(),e.moveTo(n+a,t),e.lineTo(n+r-a,t),e.quadraticCurveTo(n+r,t,n+r,t+a),e.lineTo(n+r,t+o-a),e.quadraticCurveTo(n+r,t+o,n+r-a,t+o),e.lineTo(n+a,t+o),e.quadraticCurveTo(n,t+o,n,t+o-a),e.lineTo(n,t+a),e.quadraticCurveTo(n,t,n+a,t),e.closePath()}function ne(e,n,t,r,o){te(e,t,r,m,w,12),e.fillStyle="#1a1814",e.fill(),e.strokeStyle=n.suit.color+"40",e.lineWidth=1.5,e.stroke(),e.fillStyle="#a0a0a0",e.font="bold 10px system-ui, sans-serif",e.textAlign="center",e.fillText(o.toUpperCase(),t+m/2,r-8),e.fillStyle=n.suit.color,e.font="36px system-ui, sans-serif",e.fillText(n.suit.symbol,t+m/2,r+50),e.fillStyle=n.suit.color,e.font="bold 11px system-ui, sans-serif",e.fillText(n.title,t+m/2,r+72),e.strokeStyle=n.suit.color+"30",e.lineWidth=1,e.beginPath(),e.moveTo(t+30,r+82),e.lineTo(t+m-30,r+82),e.stroke(),e.fillStyle="#e0e0e0",e.font="12px system-ui, sans-serif";const a=m-28,l=n.content.split(" ");let c="",i=r+100;const u=5;let f=0;for(const h of l){const p=c+(c?" ":"")+h;if(e.measureText(p).width>a&&c){if(e.fillText(c,t+m/2,i),c=h,i+=16,f++,f>=u){e.fillText(c+"...",t+m/2,i);break}}else c=p}f{ne(t,u,c+f*(m+I),i,a[f])}),t.fillStyle="#606060",t.font="10px system-ui, sans-serif",t.textAlign="center",t.fillText("Surreal-Memory — surrealmemory.dev",b/2,C-10),new Promise(u=>{n.toBlob(f=>u(f),"image/png")})}async function se(e){try{const n=await W(e);return await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0}catch{return!1}}async function re(e){const n=await W(e),t=URL.createObjectURL(n),r=document.createElement("a");r.href=t,r.download=`oracle-${e.brainName}-${e.date}.png`,r.click(),URL.revokeObjectURL(t)}function oe({reading:e}){const{t:n}=j(),[t,r]=d.useState(!1),o=async()=>{await se(e)&&(r(!0),setTimeout(()=>r(!1),2e3))},a=()=>{re(e)};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:o,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.copyCard"),children:t?s.jsxs(s.Fragment,{children:[s.jsx(K,{className:"size-3.5 text-green-400"}),n("oracle.copied")]}):s.jsxs(s.Fragment,{children:[s.jsx(H,{className:"size-3.5"}),n("oracle.copyCard")]})}),s.jsxs("button",{onClick:a,className:"flex cursor-pointer items-center gap-1.5 rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.downloadCard"),children:[s.jsx(G,{className:"size-3.5"}),n("oracle.downloadCard")]})]})}const ae=["Your past is marked by {past} — {pastContent}. Today, {present} guides your path — {presentContent}. Tomorrow, {future} awaits — {futureContent}.","{past} shaped what came before: {pastContent}. Now {present} holds the key — {presentContent}. The future whispers of {future}: {futureContent}.","From the shadow of {past} ({pastContent}), through the lens of {present} ({presentContent}), your path leads to {future} — {futureContent}.","The memory of {past} echoes: {pastContent}. {present} illuminates the now: {presentContent}. {future} beckons ahead: {futureContent}.","Once, {past} taught you: {pastContent}. Today, {present} reveals: {presentContent}. Soon, {future} will show: {futureContent}.","{past} planted seeds — {pastContent}. {present} tends the garden — {presentContent}. {future} promises the harvest — {futureContent}."],ie=['What if {suitA} and {suitB} collided? Imagine: "{cardA}" meets "{cardB}" — and {wildcardSuit} throws in a twist: "{wildcard}"','In another timeline, {suitA} chose differently: "{cardA}". Meanwhile {suitB} discovered: "{cardB}". The catalyst? {wildcardSuit}: "{wildcard}"',`Picture this: {suitA}'s memory ("{cardA}") suddenly merges with {suitB}'s truth ("{cardB}"). {wildcardSuit} watches from the shadows: "{wildcard}"`,'Two paths diverged — {suitA} whispered "{cardA}" while {suitB} insisted "{cardB}". {wildcardSuit} appeared: "{wildcard}"','What if you had followed {suitA} ("{cardA}") instead of {suitB} ("{cardB}")? {wildcardSuit} holds the answer: "{wildcard}"','Rewind. {suitA} says: "{cardA}". Fast forward. {suitB} replies: "{cardB}". Plot twist by {wildcardSuit}: "{wildcard}"'],le=['Which memory is stronger? {suitA}: "{contentA}" vs {suitB}: "{contentB}"','{suitA} challenges {suitB}! "{contentA}" faces off against "{contentB}" — who wins?','Battle of memories: {suitA} brings "{contentA}", {suitB} counters with "{contentB}"','Your brain asks: is "{contentA}" ({suitA}) more important than "{contentB}" ({suitB})?','Memory arena: {suitA} ("{contentA}") vs {suitB} ("{contentB}") — choose wisely!'];function z(e,n){let t=0;const r=`${e}:${n}`;for(let o=0;o>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function T(e){let n=e|0;return()=>{n=n+1831565813|0;let t=Math.imul(n^n>>>15,1|n);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function S(e,n,t){const r=[...e],o=[];for(let a=0;a0;a++){const l=Math.floor(t()*r.length);o.push(r[l]),r.splice(l,1)}return o}function $(e,n){return e.length===0?"":e[Math.floor(n()*e.length)]}function R(e,n){return Object.entries(n).reduce((t,[r,o])=>t.replaceAll(`{${r}}`,o),e)}function de(e,n,t){if(e.length<3)return null;const r=new Date().toISOString().slice(0,10),o=z(r,n),a=T(o),l=[...e].sort((A,k)=>k.activation-A.activation),c=l.slice(0,Math.max(Math.ceil(l.length*.6),3)),i=S(c,3,a);if(i.length<3)return null;const[u,f,h]=i,p=R($(ae,a),{past:u.suit.name,present:f.suit.name,future:h.suit.name,pastContent:u.content,presentContent:f.content,futureContent:h.content});return{past:u,present:f,future:h,interpretation:p,date:r,brainName:n}}function O(e,n){if(e.length<3)return null;const t=T(n??Date.now()),r=S(e,2,t);if(r.length<2)return null;const o=e.filter(i=>!r.includes(i)),a=S(o.length>0?o:e,1,t);if(a.length===0)return null;const l=a[0],c=R($(ie,t),{cardA:r[0].content,cardB:r[1].content,suitA:r[0].suit.name,suitB:r[1].suit.name,wildcard:l.content,wildcardSuit:l.suit.name});return{decisions:r,error:l,scenario:c}}function B(e,n=1,t=5,r=[],o){if(e.length<2)return null;const a=o??Date.now(),l=T(ce(a,n*7919)),c=e.filter(f=>!r.includes(f.id)),i=c.length>=2?c:e,u=S(i,2,l);return u.length<2?null:{cardA:u[0],cardB:u[1],round:n,score:0,totalRounds:t}}function ue(e,n,t){const r=z(e.id,n.id),o=T(r);return R($(le,o),{suitA:e.suit.name,suitB:n.suit.name,contentA:e.content,contentB:n.content})}const L="oracle-daily-reading";function fe(){return new Date().toISOString().slice(0,10)}function me(e){try{const n=localStorage.getItem(L);if(!n)return null;const t=JSON.parse(n);return t.date===fe()&&t.brainName===e?t.reading:null}catch{return null}}function he(e){const n={date:e.date,brainName:e.brainName,reading:e};localStorage.setItem(L,JSON.stringify(n))}function pe(e,n){const[t,r]=d.useState(null);return d.useEffect(()=>{if(e.length<3){r(null);return}const o=me(n);if(o){r(o);return}const a=de(e,n);a&&(he(a),r(a))},[e,n]),t}const P=["past","present","future"];function xe({cards:e,brainName:n}){const{t}=j(),r=pe(e,n),[o,a]=d.useState(0);if(!r)return null;const l=[r.past,r.present,r.future];return s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:t("oracle.dailyHint")}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:l.map((c,i)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:t(`oracle.${P[i]}`)}),s.jsx(M,{card:c,autoFlipDelay:800+i*500,onFlip:()=>a(u=>Math.max(u,i+1)),className:"h-[340px] w-[240px]"})]},P[i]))}),o>=3&&s.jsxs("div",{className:"max-w-xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:[s.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-5",children:[s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80",children:r.interpretation}),s.jsx("p",{className:"mt-3 text-center text-xs text-muted-foreground",children:t("oracle.readingDate",{date:r.date,brain:r.brainName})})]}),s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(oe,{reading:r})})]})]})}function ge({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>O(e)),[o,a]=d.useState(!1),l=d.useRef(0),c=d.useCallback(()=>{r(O(e,Date.now())),a(!1),l.current=0},[e]),i=d.useCallback(()=>{l.current+=1,l.current>=3&&a(!0)},[]);if(!t)return null;const u=[...t.decisions,t.error];return s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.whatifHint")}),s.jsxs("button",{onClick:c,className:"flex cursor-pointer items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground","aria-label":n("oracle.reshuffle"),children:[s.jsx(F,{className:"size-3.5"}),n("oracle.reshuffle")]})]}),s.jsx("div",{className:"flex flex-wrap justify-center gap-6",children:u.map((f,h)=>s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:h<2?n("oracle.memory")+` ${h+1}`:n("oracle.wildcard")}),s.jsx(M,{card:f,onFlip:i,className:"h-[340px] w-[240px]"})]},`slot-${h}`))}),o&&s.jsx("div",{className:"max-w-2xl animate-in fade-in slide-in-from-bottom-4 duration-700",children:s.jsx("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 p-5",children:s.jsx("p",{className:"text-center text-sm leading-relaxed text-foreground/80 italic",children:t.scenario})})})]})}const y=5;function be(e){const n=e.activation,t=Math.min(e.connectionCount,20)/2;return n+t}function ye({cards:e}){const{t:n}=j(),[t,r]=d.useState(()=>B(e,1,y)),[o,a]=d.useState(0),[l,c]=d.useState([]),[i,u]=d.useState(null),[f,h]=d.useState(!1),p=d.useRef(null);d.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);const A=d.useCallback(x=>{if(!t||i)return;u(x);const g=x==="A"?t.cardA:t.cardB,v=o+be(g),N=[...l,t.cardA.id,t.cardB.id];a(v),c(N),p.current=setTimeout(()=>{if(t.round>=y){h(!0);return}const D=B(e,t.round+1,y,N,Date.now());r(D?{...D,score:v}:null),u(null)},1200)},[t,i,o,l,e]),k=d.useCallback(()=>{p.current&&clearTimeout(p.current),r(B(e,1,y)),a(0),c([]),u(null),h(!1)},[e]);if(!t)return null;const U=ue(t.cardA,t.cardB);return f?s.jsxs("div",{className:"flex flex-col items-center gap-6 animate-in fade-in duration-500",children:[s.jsx(V,{className:"size-12 text-amber-400","aria-hidden":"true"}),s.jsx("h2",{className:"font-display text-2xl font-bold",children:n("oracle.matchupComplete")}),s.jsx("p",{className:"text-4xl font-bold text-primary",children:Math.round(o)}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n("oracle.matchupScoreDesc")}),s.jsx("button",{onClick:k,className:"cursor-pointer rounded-lg bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:n("oracle.playAgain")})]}):s.jsxs("div",{className:"flex flex-col items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex gap-1.5",children:Array.from({length:y},(x,g)=>s.jsx("div",{className:`size-2 rounded-full transition-colors ${g{const g=x==="A"?t.cardA:t.cardB,v=i===x,N=i!==null&&i!==x;return s.jsxs("div",{className:"flex flex-col items-center gap-3",children:[s.jsx("div",{className:`transition-all duration-500 ${v?"scale-105 ring-2 ring-primary ring-offset-2 ring-offset-background rounded-xl":N?"scale-95 opacity-40":""}`,children:s.jsx(M,{card:g,autoFlipDelay:300+(x==="B"?200:0),className:"h-[340px] w-[240px]"})}),!i&&s.jsx("button",{onClick:()=>A(x),className:"cursor-pointer rounded-lg bg-accent px-5 py-2 text-sm font-medium text-foreground transition-all hover:bg-primary hover:text-primary-foreground",children:n("oracle.choose")}),v&&s.jsx("span",{className:"text-xs font-medium text-primary animate-in fade-in",children:n("oracle.chosen")})]},`${t.round}-${x}`)})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[n("oracle.score"),": ",s.jsx("span",{className:"font-mono font-bold text-foreground",children:Math.round(o)})]})]})}const E={decision:{name:"The Architect",color:"#fbbf24",symbol:"◆",bg:"from-amber-900/40 to-amber-950/60"},error:{name:"The Shadow",color:"#ef4444",symbol:"♠",bg:"from-red-900/40 to-red-950/60"},insight:{name:"The Oracle",color:"#a78bfa",symbol:"♥",bg:"from-violet-900/40 to-violet-950/60"},fact:{name:"The Scholar",color:"#60a5fa",symbol:"♣",bg:"from-blue-900/40 to-blue-950/60"},workflow:{name:"The Engineer",color:"#34d399",symbol:"★",bg:"from-emerald-900/40 to-emerald-950/60"},concept:{name:"The Dreamer",color:"#22d3ee",symbol:"○",bg:"from-cyan-900/40 to-cyan-950/60"},entity:{name:"The Keeper",color:"#f59e0b",symbol:"△",bg:"from-amber-900/40 to-orange-950/60"},pattern:{name:"The Weaver",color:"#fb7185",symbol:"◇",bg:"from-rose-900/40 to-rose-950/60"},preference:{name:"The Compass",color:"#2dd4bf",symbol:"⊕",bg:"from-teal-900/40 to-teal-950/60"}},je={name:"The Wanderer",color:"#a8a29e",symbol:"?",bg:"from-stone-900/40 to-stone-950/60"};function ve(e){return e in E?{suit:E[e],key:e}:{suit:je,key:"unknown"}}function we(e){const n=new Date(e),r=new Date().getTime()-n.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"today":o===1?"1d":o<30?`${o}d`:o<365?`${Math.floor(o/30)}mo`:`${Math.floor(o/365)}y`}function Ne(e,n){return n.filter(t=>t.source_id===e||t.target_id===e).length}function Ce(e,n=120){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}function Se(e,n){return e.map(t=>{const{suit:r,key:o}=ve(t.type),a=t.metadata??{},l=typeof a.activation_level=="number"?a.activation_level:.5,c=typeof a.priority=="number"?a.priority:5,i=typeof a.created_at=="string"?a.created_at:new Date().toISOString();return{id:t.id,title:r.name,content:Ce(t.content),suit:r,suitKey:o,activation:Math.round(l*100)/10,connectionCount:Ne(t.id,n),age:we(i),priority:c,createdAt:i}})}function Te(){const{data:e,isLoading:n,error:t}=q(500);return{cards:d.useMemo(()=>e?Se(e.neurons,e.synapses):[],[e]),isLoading:n,error:t}}function De(){const{t:e}=j(),[n,t]=d.useState("daily"),{cards:r,isLoading:o}=Te(),{data:a}=J(),l=a?.active_brain??"default";return o?s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx("p",{className:"text-muted-foreground",children:e("oracle.loading")})]}):r.length<3?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 pt-24",children:[s.jsx(_,{className:"size-12 text-muted-foreground/40"}),s.jsx("h2",{className:"font-display text-xl font-semibold text-muted-foreground",children:e("oracle.needMore")}),s.jsx("p",{className:"max-w-md text-center text-sm text-muted-foreground/70",children:e("oracle.needMoreDesc")})]}):s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:e("oracle.title")}),s.jsx(Q,{mode:n,onModeChange:t})]}),s.jsxs("div",{className:"flex flex-col items-center gap-8",children:[n==="daily"&&s.jsx(xe,{cards:r,brainName:l}),n==="whatif"&&s.jsx(ge,{cards:r}),n==="matchup"&&s.jsx(ye,{cards:r})]})]})}export{De as default}; diff --git a/src/surreal_memory/server/static/dist/assets/OverviewPage-xe8kFqX3.js b/src/surreal_memory/server/static/dist/assets/OverviewPage-uovTY60B.js similarity index 98% rename from src/surreal_memory/server/static/dist/assets/OverviewPage-xe8kFqX3.js rename to src/surreal_memory/server/static/dist/assets/OverviewPage-uovTY60B.js index 33a6fc78..e17af5ad 100644 --- a/src/surreal_memory/server/static/dist/assets/OverviewPage-xe8kFqX3.js +++ b/src/surreal_memory/server/static/dist/assets/OverviewPage-uovTY60B.js @@ -1 +1 @@ -import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as j}from"./vendor-react-BfuodpLv.js";import{u as y,B as h,a as z,b,t as x,c as C,d as B,e as L,f as $}from"./index-C26pxqlr.js";import{C as v,a as k,b as S,c as p}from"./card-B0vNsxr_.js";import{S as u}from"./skeleton-DQJ-n00q.js";import{x as _,y as E,z as T,A,B as D,C as R,D as G,E as I,c as V,F,o as H,G as O,H as U}from"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({open:a,title:r,description:i,confirmLabel:o,cancelLabel:n,variant:m="default",onConfirm:l,onCancel:d}){const s=j.useRef(null),{t:f}=y();return j.useEffect(()=>{const c=s.current;c&&(a&&!c.open&&c.showModal(),!a&&c.open&&c.close())},[a]),a?e.jsx("dialog",{ref:s,className:"fixed inset-0 z-50 m-auto max-w-md rounded-xl border border-border bg-card p-0 shadow-lg backdrop:bg-black/50",onClose:d,onClick:c=>{c.target===s.current&&d()},children:e.jsxs("div",{className:"p-6",children:[e.jsx("h2",{className:"font-display text-lg font-bold text-card-foreground",children:r}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:i}),e.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[e.jsx(h,{variant:"outline",size:"sm",onClick:d,children:n??f("common.cancel")}),e.jsx(h,{variant:m==="destructive"?"destructive":"default",size:"sm",onClick:l,children:o??f("common.confirm")})]})]})}):null}const Q={configured:{icon:_,badgeVariant:"success",label:"Configured"},warning:{icon:A,badgeVariant:"warning",label:"Warning"},not_configured:{icon:T,badgeVariant:"destructive",label:"Not configured"},info:{icon:E,badgeVariant:"secondary",label:"Info"}};function K({item:a}){const{icon:r,badgeVariant:i,label:o}=Q[a.status],n=async()=>{try{await navigator.clipboard.writeText(a.command),x.success("Copied to clipboard")}catch{x.error("Failed to copy")}};return e.jsxs("div",{className:"space-y-1.5 py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(r,{className:`size-4 shrink-0 ${a.status==="configured"?"text-health-good":a.status==="warning"?"text-health-warn":a.status==="not_configured"?"text-destructive":"text-muted-foreground"}`,"aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),e.jsx(b,{variant:i,className:"shrink-0 text-xs",children:o})]}),a.description&&e.jsx("p",{className:"pl-6 text-xs text-muted-foreground",children:a.description}),a.command&&e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-muted px-2.5 py-1.5 font-mono text-xs",children:a.command}),e.jsx(h,{variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:n,"aria-label":`Copy command: ${a.command}`,children:e.jsx(D,{className:"size-3.5","aria-hidden":"true"})})]})]})}function M(){return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"size-4 rounded-full"}),e.jsx(u,{className:"h-4 w-32"})]}),e.jsx(u,{className:"h-5 w-20 rounded-md"})]}),e.jsx(u,{className:"ml-6 h-3 w-48"}),e.jsx(u,{className:"ml-6 h-7 w-full"})]},r))})}function W(){const{data:a,isLoading:r}=z(),i=a?.items??[];if(!r&&i.length===0)return null;const o=i.length>0&&i.every(n=>n.status==="configured");return e.jsxs(v,{children:[e.jsx(k,{className:"pb-2",children:e.jsx(S,{className:"text-base",children:"Quick Actions"})}),e.jsx(p,{children:r?e.jsx(M,{}):o?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-health-good",children:[e.jsx(_,{className:"size-4","aria-hidden":"true"}),e.jsx("span",{children:"All features configured"})]}):e.jsx("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:i.map((n,m)=>{const l=m%2===1;return e.jsx("div",{className:`${l?"sm:pl-4":"sm:pr-4"}`,children:e.jsx(K,{item:n})},n.key)})})})]})}const q="https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",w="smem-guide-card-dismissed",Y=50;function J(){const{data:a,isLoading:r}=C(),[i,o]=j.useState(()=>{try{return localStorage.getItem(w)==="1"}catch{return!1}});if(r)return null;const n=a?.total_neurons??0;if(i||n>=Y)return null;const m=()=>{localStorage.setItem(w,"1"),o(!0)};return e.jsx(v,{className:"relative overflow-hidden border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10",children:e.jsxs(p,{className:"flex items-center gap-4 p-4 sm:p-5",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary/15",children:e.jsx(R,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Quickstart Guide"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Learn setup, recall, cognitive tools & more"})]}),e.jsx(h,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5",asChild:!0,children:e.jsxs("a",{href:q,target:"_blank",rel:"noopener noreferrer",children:["Open Guide",e.jsx(G,{className:"size-3.5","aria-hidden":"true"})]})}),e.jsx(h,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-7 text-muted-foreground hover:text-foreground",onClick:m,"aria-label":"Dismiss guide card",children:e.jsx(I,{className:"size-3.5","aria-hidden":"true"})})]})})}function g({label:a,value:r,icon:i,loading:o}){return e.jsx(v,{children:e.jsxs(p,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"flex size-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(i,{className:"size-6 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),o?e.jsx(u,{className:"mt-1 h-7 w-20"}):e.jsx("p",{className:"font-mono text-2xl font-bold tracking-tight",children:typeof r=="number"?r.toLocaleString():r})]})]})})}function ne(){const{data:a,isLoading:r}=C(),{data:i,isLoading:o}=B(),n=L(),m=$(),[l,d]=j.useState(null),{t:s}=y(),f=t=>{n.mutate(t,{onSuccess:()=>x.success(s("overview.switchedTo",{name:t})),onError:()=>x.error(s("overview.switchFailed"))})},c=()=>{l&&m.mutate(l.id,{onSuccess:()=>{x.success(s("overview.deleted",{name:l.name})),d(null)},onError:()=>{x.error(s("overview.deleteFailed")),d(null)}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("overview.title")}),e.jsx(J,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(g,{label:s("overview.neurons"),value:a?.total_neurons??0,icon:V,loading:r}),e.jsx(g,{label:s("overview.synapses"),value:a?.total_synapses??0,icon:F,loading:r}),e.jsx(g,{label:s("overview.fibers"),value:a?.total_fibers??0,icon:H,loading:r}),e.jsx(g,{label:s("overview.brains"),value:a?.total_brains??0,icon:O,loading:r})]}),e.jsx(W,{}),e.jsxs(v,{children:[e.jsx(k,{children:e.jsx(S,{children:s("overview.brainList")})}),e.jsx(p,{children:o?e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((t,N)=>e.jsx(u,{className:"h-12 w-full"},N))}):i&&i.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:s("overview.name")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.neurons")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.synapses")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.fibers")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.grade")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.status")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.actions")})]})}),e.jsx("tbody",{children:i.map(t=>e.jsxs("tr",{className:`border-b border-border/50 last:border-0 transition-colors ${t.is_active?"":"cursor-pointer hover:bg-accent/50"}`,onClick:()=>{t.is_active||f(t.name)},title:t.is_active?s("overview.currentBrain"):s("overview.switchTo",{name:t.name}),children:[e.jsx("td",{className:"py-3 font-mono font-medium",children:t.name}),e.jsx("td",{className:"py-3 font-mono",children:t.neuron_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:t.synapse_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:t.fiber_count.toLocaleString()}),e.jsx("td",{className:"py-3",children:e.jsx(b,{variant:t.grade==="A"||t.grade==="A+"?"success":t.grade==="B"||t.grade==="B+"?"secondary":"warning",children:t.grade})}),e.jsx("td",{className:"py-3",children:t.is_active?e.jsx(b,{variant:"default",children:s("common.active")}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx("td",{className:"py-3",children:!t.is_active&&e.jsx(h,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:N=>{N.stopPropagation(),d({id:t.id,name:t.name})},"aria-label":s("overview.deleteBrain",{name:t.name}),children:e.jsx(U,{className:"size-4"})})})]},t.id))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:s("overview.noBrains")})})]}),e.jsx(P,{open:!!l,title:s("overview.deleteBrainTitle"),description:s("overview.deleteBrainDesc",{name:l?.name}),confirmLabel:s("common.delete"),variant:"destructive",onConfirm:c,onCancel:()=>d(null)})]})}export{ne as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as j}from"./vendor-react-BfuodpLv.js";import{u as y,B as h,a as z,b,t as x,c as C,d as B,e as L,f as $}from"./index-DzyKsRxc.js";import{C as v,a as k,b as S,c as p}from"./card-CB2KYkrP.js";import{S as u}from"./skeleton-B4zDkVHp.js";import{x as _,y as E,z as T,A,B as D,C as R,D as G,E as I,c as V,F,o as H,G as O,H as U}from"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({open:a,title:r,description:i,confirmLabel:o,cancelLabel:n,variant:m="default",onConfirm:l,onCancel:d}){const s=j.useRef(null),{t:f}=y();return j.useEffect(()=>{const c=s.current;c&&(a&&!c.open&&c.showModal(),!a&&c.open&&c.close())},[a]),a?e.jsx("dialog",{ref:s,className:"fixed inset-0 z-50 m-auto max-w-md rounded-xl border border-border bg-card p-0 shadow-lg backdrop:bg-black/50",onClose:d,onClick:c=>{c.target===s.current&&d()},children:e.jsxs("div",{className:"p-6",children:[e.jsx("h2",{className:"font-display text-lg font-bold text-card-foreground",children:r}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:i}),e.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[e.jsx(h,{variant:"outline",size:"sm",onClick:d,children:n??f("common.cancel")}),e.jsx(h,{variant:m==="destructive"?"destructive":"default",size:"sm",onClick:l,children:o??f("common.confirm")})]})]})}):null}const Q={configured:{icon:_,badgeVariant:"success",label:"Configured"},warning:{icon:A,badgeVariant:"warning",label:"Warning"},not_configured:{icon:T,badgeVariant:"destructive",label:"Not configured"},info:{icon:E,badgeVariant:"secondary",label:"Info"}};function K({item:a}){const{icon:r,badgeVariant:i,label:o}=Q[a.status],n=async()=>{try{await navigator.clipboard.writeText(a.command),x.success("Copied to clipboard")}catch{x.error("Failed to copy")}};return e.jsxs("div",{className:"space-y-1.5 py-3 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(r,{className:`size-4 shrink-0 ${a.status==="configured"?"text-health-good":a.status==="warning"?"text-health-warn":a.status==="not_configured"?"text-destructive":"text-muted-foreground"}`,"aria-hidden":"true"}),e.jsx("span",{className:"text-sm font-medium",children:a.label})]}),e.jsx(b,{variant:i,className:"shrink-0 text-xs",children:o})]}),a.description&&e.jsx("p",{className:"pl-6 text-xs text-muted-foreground",children:a.description}),a.command&&e.jsxs("div",{className:"flex items-center gap-2 pl-6",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-muted px-2.5 py-1.5 font-mono text-xs",children:a.command}),e.jsx(h,{variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:n,"aria-label":`Copy command: ${a.command}`,children:e.jsx(D,{className:"size-3.5","aria-hidden":"true"})})]})]})}function M(){return e.jsx("div",{className:"space-y-4",children:Array.from({length:3}).map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"size-4 rounded-full"}),e.jsx(u,{className:"h-4 w-32"})]}),e.jsx(u,{className:"h-5 w-20 rounded-md"})]}),e.jsx(u,{className:"ml-6 h-3 w-48"}),e.jsx(u,{className:"ml-6 h-7 w-full"})]},r))})}function W(){const{data:a,isLoading:r}=z(),i=a?.items??[];if(!r&&i.length===0)return null;const o=i.length>0&&i.every(n=>n.status==="configured");return e.jsxs(v,{children:[e.jsx(k,{className:"pb-2",children:e.jsx(S,{className:"text-base",children:"Quick Actions"})}),e.jsx(p,{children:r?e.jsx(M,{}):o?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-sm text-health-good",children:[e.jsx(_,{className:"size-4","aria-hidden":"true"}),e.jsx("span",{children:"All features configured"})]}):e.jsx("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-2 sm:divide-x sm:divide-y-0",children:i.map((n,m)=>{const l=m%2===1;return e.jsx("div",{className:`${l?"sm:pl-4":"sm:pr-4"}`,children:e.jsx(K,{item:n})},n.key)})})})]})}const q="https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",w="smem-guide-card-dismissed",Y=50;function J(){const{data:a,isLoading:r}=C(),[i,o]=j.useState(()=>{try{return localStorage.getItem(w)==="1"}catch{return!1}});if(r)return null;const n=a?.total_neurons??0;if(i||n>=Y)return null;const m=()=>{localStorage.setItem(w,"1"),o(!0)};return e.jsx(v,{className:"relative overflow-hidden border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10",children:e.jsxs(p,{className:"flex items-center gap-4 p-4 sm:p-5",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary/15",children:e.jsx(R,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Quickstart Guide"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Learn setup, recall, cognitive tools & more"})]}),e.jsx(h,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5",asChild:!0,children:e.jsxs("a",{href:q,target:"_blank",rel:"noopener noreferrer",children:["Open Guide",e.jsx(G,{className:"size-3.5","aria-hidden":"true"})]})}),e.jsx(h,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 size-7 text-muted-foreground hover:text-foreground",onClick:m,"aria-label":"Dismiss guide card",children:e.jsx(I,{className:"size-3.5","aria-hidden":"true"})})]})})}function g({label:a,value:r,icon:i,loading:o}){return e.jsx(v,{children:e.jsxs(p,{className:"flex items-center gap-4 p-6",children:[e.jsx("div",{className:"flex size-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(i,{className:"size-6 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),o?e.jsx(u,{className:"mt-1 h-7 w-20"}):e.jsx("p",{className:"font-mono text-2xl font-bold tracking-tight",children:typeof r=="number"?r.toLocaleString():r})]})]})})}function ne(){const{data:a,isLoading:r}=C(),{data:i,isLoading:o}=B(),n=L(),m=$(),[l,d]=j.useState(null),{t:s}=y(),f=t=>{n.mutate(t,{onSuccess:()=>x.success(s("overview.switchedTo",{name:t})),onError:()=>x.error(s("overview.switchFailed"))})},c=()=>{l&&m.mutate(l.id,{onSuccess:()=>{x.success(s("overview.deleted",{name:l.name})),d(null)},onError:()=>{x.error(s("overview.deleteFailed")),d(null)}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("overview.title")}),e.jsx(J,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(g,{label:s("overview.neurons"),value:a?.total_neurons??0,icon:V,loading:r}),e.jsx(g,{label:s("overview.synapses"),value:a?.total_synapses??0,icon:F,loading:r}),e.jsx(g,{label:s("overview.fibers"),value:a?.total_fibers??0,icon:H,loading:r}),e.jsx(g,{label:s("overview.brains"),value:a?.total_brains??0,icon:O,loading:r})]}),e.jsx(W,{}),e.jsxs(v,{children:[e.jsx(k,{children:e.jsx(S,{children:s("overview.brainList")})}),e.jsx(p,{children:o?e.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((t,N)=>e.jsx(u,{className:"h-12 w-full"},N))}):i&&i.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-2 font-medium",children:s("overview.name")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.neurons")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.synapses")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.fibers")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.grade")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.status")}),e.jsx("th",{className:"pb-2 font-medium",children:s("overview.actions")})]})}),e.jsx("tbody",{children:i.map(t=>e.jsxs("tr",{className:`border-b border-border/50 last:border-0 transition-colors ${t.is_active?"":"cursor-pointer hover:bg-accent/50"}`,onClick:()=>{t.is_active||f(t.name)},title:t.is_active?s("overview.currentBrain"):s("overview.switchTo",{name:t.name}),children:[e.jsx("td",{className:"py-3 font-mono font-medium",children:t.name}),e.jsx("td",{className:"py-3 font-mono",children:t.neuron_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:t.synapse_count.toLocaleString()}),e.jsx("td",{className:"py-3 font-mono",children:t.fiber_count.toLocaleString()}),e.jsx("td",{className:"py-3",children:e.jsx(b,{variant:t.grade==="A"||t.grade==="A+"?"success":t.grade==="B"||t.grade==="B+"?"secondary":"warning",children:t.grade})}),e.jsx("td",{className:"py-3",children:t.is_active?e.jsx(b,{variant:"default",children:s("common.active")}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx("td",{className:"py-3",children:!t.is_active&&e.jsx(h,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:N=>{N.stopPropagation(),d({id:t.id,name:t.name})},"aria-label":s("overview.deleteBrain",{name:t.name}),children:e.jsx(U,{className:"size-4"})})})]},t.id))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:s("overview.noBrains")})})]}),e.jsx(P,{open:!!l,title:s("overview.deleteBrainTitle"),description:s("overview.deleteBrainDesc",{name:l?.name}),confirmLabel:s("common.delete"),variant:"destructive",onConfirm:c,onCancel:()=>d(null)})]})}export{ne as default}; diff --git a/src/surreal_memory/server/static/dist/assets/ProGate-CwBF4etn.js b/src/surreal_memory/server/static/dist/assets/ProGate-37WFbaAW.js similarity index 71% rename from src/surreal_memory/server/static/dist/assets/ProGate-CwBF4etn.js rename to src/surreal_memory/server/static/dist/assets/ProGate-37WFbaAW.js index 77ce31cf..baa7a7e3 100644 --- a/src/surreal_memory/server/static/dist/assets/ProGate-CwBF4etn.js +++ b/src/surreal_memory/server/static/dist/assets/ProGate-37WFbaAW.js @@ -1 +1 @@ -import{j as t}from"./vendor-query-CqA1cBNl.js";import"./vendor-react-BfuodpLv.js";import{u as o}from"./index-C26pxqlr.js";function i({children:r,label:s}){const{t:a}=o();return t.jsx(t.Fragment,{children:r})}export{i as P}; +import{j as t}from"./vendor-query-CqA1cBNl.js";import"./vendor-react-BfuodpLv.js";import{u as o}from"./index-DzyKsRxc.js";function i({children:r,label:s}){const{t:a}=o();return t.jsx(t.Fragment,{children:r})}export{i as P}; diff --git a/src/surreal_memory/server/static/dist/assets/SettingsPage-CH2mIMiD.js b/src/surreal_memory/server/static/dist/assets/SettingsPage-BwQ0sSKJ.js similarity index 97% rename from src/surreal_memory/server/static/dist/assets/SettingsPage-CH2mIMiD.js rename to src/surreal_memory/server/static/dist/assets/SettingsPage-BwQ0sSKJ.js index ac4f7e1c..c0ab1a0f 100644 --- a/src/surreal_memory/server/static/dist/assets/SettingsPage-CH2mIMiD.js +++ b/src/surreal_memory/server/static/dist/assets/SettingsPage-BwQ0sSKJ.js @@ -1 +1 @@ -import{u as B,b as T,j as e}from"./vendor-query-CqA1cBNl.js";import{n as S,a as P,u as w,b as p,o as L,p as D,q as M,B as _,t as d,r as z,c as A,s as O,v as R,w as U,x as I}from"./index-C26pxqlr.js";import{C as u,a as x,b as g,c as h}from"./card-B0vNsxr_.js";import{N as K,O as $,P as q,D as G}from"./vendor-icons-BYlYobEK.js";import{S as y}from"./skeleton-DQJ-n00q.js";import{r as C}from"./vendor-react-BfuodpLv.js";import{P as H}from"./ProGate-CwBF4etn.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const V={status:["telegram","status"]};function W(){return B({queryKey:V.status,queryFn:()=>S.get("/api/dashboard/telegram/status"),retry:!1})}function Q(){return T({mutationFn:()=>S.post("/api/dashboard/telegram/test",{})})}function Y(){return T({mutationFn:t=>S.post("/api/dashboard/telegram/backup",{brain:t})})}const J={configured:"success",warning:"warning",not_configured:"secondary",info:"default"};function X(){const{data:t,isLoading:l}=P(),{t:o}=w();return e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:o("settings.configStatus")})}),e.jsx(h,{children:l?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((a,n)=>e.jsx(y,{className:"h-14 w-full"},n))}):e.jsx("div",{className:"space-y-2",children:t?.items.map(a=>e.jsxs("div",{className:"rounded-lg border border-border/50 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:a.label}),e.jsx(p,{variant:J[a.status],children:a.status})]}),a.value&&e.jsx("p",{className:"font-mono text-xs text-foreground/80",children:a.value}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.description}),a.command&&e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:a.command})]},a.key))})})]})}const Z=[{value:"sentence_transformer",label:"Sentence Transformer (Local)"},{value:"ollama",label:"Ollama (Local)"},{value:"gemini",label:"Gemini (Google)"},{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"}],F={sentence_transformer:"all-MiniLM-L6-v2",ollama:"nomic-embed-text",gemini:"text-embedding-004",openai:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"};function ee(){const{t}=w(),{data:l}=L(),o=D(),a=M(),[n,f]=C.useState({enabled:!1,provider:"sentence_transformer",model:F.sentence_transformer,similarity_threshold:.7}),[b,m]=C.useState(!1);C.useEffect(()=>{if(!l)return;const r={enabled:l.enabled,provider:l.provider??"sentence_transformer",model:l.model,similarity_threshold:l.similarity_threshold};f(r),m(!1)},[l]);function s(r,i){f(c=>{const j={...c,[r]:i};return r==="provider"&&(j.model=F[i]),j}),m(!0)}const v=()=>{a.mutate(void 0,{onSuccess:r=>{r.status==="ok"?d.success(t("settings.embeddingTestOk",{provider:r.provider,dimension:r.dimension})):d.error(t("settings.embeddingTestFail",{error:r.error??"Unknown error"}))},onError:()=>d.error(t("settings.embeddingTestFail",{error:"Network error"}))})},k=()=>{o.mutate({embedding:{enabled:n.enabled,provider:n.provider,model:n.model,similarity_threshold:n.similarity_threshold}},{onSuccess:()=>{d.success(t("settings.embeddingSaved")),m(!1)},onError:()=>d.error(t("settings.embeddingSaveFailed"))})};return e.jsx(H,{label:t("settings.proFeature"),children:e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:t("settings.embeddingConfig")})}),e.jsxs(h,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.enabled,onChange:r=>s("enabled",r.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:t("settings.embeddingEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-provider",children:t("settings.embeddingProvider")}),e.jsx("select",{id:"embedding-provider",value:n.provider,onChange:r=>s("provider",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring",children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-model",children:t("settings.embeddingModel")}),e.jsx("input",{id:"embedding-model",type:"text",value:n.model,onChange:r=>s("model",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-threshold",children:t("settings.embeddingThreshold")}),e.jsx("span",{className:"font-mono text-xs",children:n.similarity_threshold.toFixed(2)})]}),e.jsx("input",{id:"embedding-threshold",type:"range",min:"0",max:"1",step:"0.05",value:n.similarity_threshold,onChange:r=>s("similarity_threshold",parseFloat(r.target.value)),className:"w-full cursor-pointer accent-primary"})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:v,disabled:a.isPending,className:"cursor-pointer",children:a.isPending?t("settings.embeddingTesting"):t("settings.embeddingTest")}),e.jsx(_,{size:"sm",onClick:k,disabled:!b||o.isPending,className:"cursor-pointer",children:o.isPending?t("settings.embeddingSaving"):t("settings.embeddingSave")})]})]})]})})}function se(){const{data:t,isLoading:l}=z(),{t:o}=w(),a=()=>t?t.running?e.jsx(p,{variant:"success",children:o("settings.watcherRunning")}):t.enabled?e.jsx(p,{variant:"warning",children:o("settings.watcherStopped")}):e.jsx(p,{variant:"secondary",children:o("settings.watcherDisabled")}):null;return e.jsxs(u,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{children:o("settings.watcher")}),l?e.jsx(y,{className:"h-5 w-16"}):a()]})}),e.jsx(h,{className:"space-y-4 text-sm",children:l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-4 w-full"}),e.jsx(y,{className:"h-4 w-3/4"})]}):t?e.jsxs(e.Fragment,{children:[t.paths.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherPaths")}),e.jsx("div",{className:"space-y-1",children:t.paths.map(n=>e.jsx("p",{className:"font-mono text-xs truncate text-foreground",title:n,children:n},n))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherRecent")}),t.recent.length>0?e.jsx("div",{className:"space-y-1",children:t.recent.slice(0,5).map((n,f)=>e.jsxs("div",{className:"flex items-center justify-between rounded border border-border/50 px-2 py-1.5",children:[e.jsx("span",{className:"font-mono text-xs truncate max-w-[200px] text-foreground",title:n.path,children:n.path.split(/[/\\]/).pop()}),e.jsxs("span",{className:"shrink-0 ml-2 font-mono text-xs text-muted-foreground",children:["+",n.neurons_created]})]},f))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:o("settings.watcherNoActivity")})]})]}):null})]})}const te=[K,$,q],ne=["#ef4444","#6366f1","#a8a29e"],re=["reportBug","featureRequest","discussions"],ae=["https://github.com/acidkill/surreal-memory/issues/new?template=bug_report.md","https://github.com/acidkill/surreal-memory/issues/new?template=feature_request.md","https://github.com/acidkill/surreal-memory/discussions"];function he(){const{data:t}=A(),{data:l}=O(),{data:o}=R(),{data:a}=U(),{data:n,isLoading:f}=W(),b=Q(),m=Y(),{t:s}=w(),v=i=>{if(i===0)return"0 B";const c=1024,j=["B","KB","MB","GB"],N=Math.floor(Math.log(i)/Math.log(c));return`${(i/Math.pow(c,N)).toFixed(1)} ${j[N]}`},k=()=>{b.mutate(void 0,{onSuccess:i=>{i.status==="success"?d.success(s("settings.testSuccess")):d.error(s("settings.testPartial"))},onError:()=>{d.error(s("settings.testFailed"))}})},r=()=>{m.mutate(void 0,{onSuccess:i=>{i.sent_to>0?d.success(s("settings.backupSuccess",{brain:i.brain,size:i.size_mb,count:i.sent_to})):d.error(s("settings.backupSendFailed"))},onError:()=>{d.error(s("settings.backupFailed"))}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("settings.title")}),e.jsx(X,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.general")})}),e.jsxs(h,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.version")}),e.jsx("span",{className:"font-mono",children:l?.version??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.activeBrain")}),e.jsx("span",{className:"font-mono",children:t?.active_brain??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalBrains")}),e.jsx("span",{className:"font-mono",children:t?.total_brains??"-"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:s("license.tier","License")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:a?.is_pro?"success":"secondary",children:(a?.tier??"free").toUpperCase()}),!a?.is_pro&&e.jsx("button",{onClick:I,className:"text-xs font-medium text-primary hover:text-primary/80 transition-colors cursor-pointer",children:s("upgrade.title","Upgrade")})]})]})]})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.brainFiles")})}),e.jsx(h,{className:"space-y-3 text-sm",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.brainsDirectory")}),e.jsx("span",{className:"font-mono text-xs max-w-[200px] truncate",title:o.brains_dir,children:o.brains_dir})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalDiskUsage")}),e.jsx("span",{className:"font-mono",children:v(o.total_size_bytes)})]}),o.brains.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.brains.map(i=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsx("span",{className:"font-mono font-medium",children:i.name}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v(i.size_bytes)})]},i.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.telegramBackup")})}),e.jsx(h,{className:"space-y-4 text-sm",children:f?e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")}):n?.configured?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"success",children:s("settings.connected")}),n.bot_name&&e.jsxs("span",{className:"text-muted-foreground",children:[n.bot_name,n.bot_username&&e.jsxs("span",{className:"font-mono text-xs",children:[" @",n.bot_username]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.chatIds")}),e.jsx("span",{className:"font-mono text-xs",children:n.chat_ids.length>0?n.chat_ids.join(", "):s("common.none")})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.autoBackup")}),e.jsx("span",{className:"font-mono",children:n.backup_on_consolidation?s("common.yes"):s("common.no")})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:k,disabled:b.isPending,className:"cursor-pointer",children:b.isPending?s("settings.sending"):s("settings.sendTest")}),e.jsx(_,{size:"sm",onClick:r,disabled:m.isPending,className:"cursor-pointer",children:m.isPending?s("settings.backingUp"):s("settings.backupNow")})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{variant:"warning",children:s("settings.notConfigured")})}),n?.error&&e.jsx("p",{className:"text-xs text-destructive",children:n.error}),e.jsx("p",{className:"text-xs text-muted-foreground",dangerouslySetInnerHTML:{__html:s("settings.telegramSetup")}})]})})]}),e.jsx(se,{}),e.jsx(ee,{}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.feedbackTitle")})}),e.jsx(h,{className:"space-y-3",children:re.map((i,c)=>{const j=te[c],N=ne[c],E=ae[c];return e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent cursor-pointer",children:[e.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${N}15`},children:e.jsx(j,{className:"size-4",style:{color:N}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:s(`settings.${i}`)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s(`settings.${i}Desc`)})]}),e.jsx(G,{className:"size-3.5 shrink-0 text-muted-foreground mt-0.5"})]},i)})})]})]})]})}export{he as default}; +import{u as B,b as T,j as e}from"./vendor-query-CqA1cBNl.js";import{n as S,a as P,u as w,b as p,o as L,p as D,q as M,B as _,t as d,r as z,c as A,s as O,v as R,w as U,x as I}from"./index-DzyKsRxc.js";import{C as u,a as x,b as g,c as h}from"./card-CB2KYkrP.js";import{N as K,O as $,P as q,D as G}from"./vendor-icons-BYlYobEK.js";import{S as y}from"./skeleton-B4zDkVHp.js";import{r as C}from"./vendor-react-BfuodpLv.js";import{P as H}from"./ProGate-37WFbaAW.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const V={status:["telegram","status"]};function W(){return B({queryKey:V.status,queryFn:()=>S.get("/api/dashboard/telegram/status"),retry:!1})}function Q(){return T({mutationFn:()=>S.post("/api/dashboard/telegram/test",{})})}function Y(){return T({mutationFn:t=>S.post("/api/dashboard/telegram/backup",{brain:t})})}const J={configured:"success",warning:"warning",not_configured:"secondary",info:"default"};function X(){const{data:t,isLoading:l}=P(),{t:o}=w();return e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:o("settings.configStatus")})}),e.jsx(h,{children:l?e.jsx("div",{className:"space-y-3",children:Array.from({length:4}).map((a,n)=>e.jsx(y,{className:"h-14 w-full"},n))}):e.jsx("div",{className:"space-y-2",children:t?.items.map(a=>e.jsxs("div",{className:"rounded-lg border border-border/50 px-3 py-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:a.label}),e.jsx(p,{variant:J[a.status],children:a.status})]}),a.value&&e.jsx("p",{className:"font-mono text-xs text-foreground/80",children:a.value}),a.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.description}),a.command&&e.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:a.command})]},a.key))})})]})}const Z=[{value:"sentence_transformer",label:"Sentence Transformer (Local)"},{value:"ollama",label:"Ollama (Local)"},{value:"gemini",label:"Gemini (Google)"},{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"}],F={sentence_transformer:"all-MiniLM-L6-v2",ollama:"nomic-embed-text",gemini:"text-embedding-004",openai:"text-embedding-3-small",openrouter:"openai/text-embedding-3-small"};function ee(){const{t}=w(),{data:l}=L(),o=D(),a=M(),[n,f]=C.useState({enabled:!1,provider:"sentence_transformer",model:F.sentence_transformer,similarity_threshold:.7}),[b,m]=C.useState(!1);C.useEffect(()=>{if(!l)return;const r={enabled:l.enabled,provider:l.provider??"sentence_transformer",model:l.model,similarity_threshold:l.similarity_threshold};f(r),m(!1)},[l]);function s(r,i){f(c=>{const j={...c,[r]:i};return r==="provider"&&(j.model=F[i]),j}),m(!0)}const v=()=>{a.mutate(void 0,{onSuccess:r=>{r.status==="ok"?d.success(t("settings.embeddingTestOk",{provider:r.provider,dimension:r.dimension})):d.error(t("settings.embeddingTestFail",{error:r.error??"Unknown error"}))},onError:()=>d.error(t("settings.embeddingTestFail",{error:"Network error"}))})},k=()=>{o.mutate({embedding:{enabled:n.enabled,provider:n.provider,model:n.model,similarity_threshold:n.similarity_threshold}},{onSuccess:()=>{d.success(t("settings.embeddingSaved")),m(!1)},onError:()=>d.error(t("settings.embeddingSaveFailed"))})};return e.jsx(H,{label:t("settings.proFeature"),children:e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:t("settings.embeddingConfig")})}),e.jsxs(h,{className:"space-y-4 text-sm",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.enabled,onChange:r=>s("enabled",r.target.checked),className:"size-4 cursor-pointer"}),e.jsx("span",{children:t("settings.embeddingEnabled")})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-provider",children:t("settings.embeddingProvider")}),e.jsx("select",{id:"embedding-provider",value:n.provider,onChange:r=>s("provider",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm cursor-pointer focus:outline-none focus:ring-2 focus:ring-ring",children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-model",children:t("settings.embeddingModel")}),e.jsx("input",{id:"embedding-model",type:"text",value:n.model,onChange:r=>s("model",r.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",htmlFor:"embedding-threshold",children:t("settings.embeddingThreshold")}),e.jsx("span",{className:"font-mono text-xs",children:n.similarity_threshold.toFixed(2)})]}),e.jsx("input",{id:"embedding-threshold",type:"range",min:"0",max:"1",step:"0.05",value:n.similarity_threshold,onChange:r=>s("similarity_threshold",parseFloat(r.target.value)),className:"w-full cursor-pointer accent-primary"})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:v,disabled:a.isPending,className:"cursor-pointer",children:a.isPending?t("settings.embeddingTesting"):t("settings.embeddingTest")}),e.jsx(_,{size:"sm",onClick:k,disabled:!b||o.isPending,className:"cursor-pointer",children:o.isPending?t("settings.embeddingSaving"):t("settings.embeddingSave")})]})]})]})})}function se(){const{data:t,isLoading:l}=z(),{t:o}=w(),a=()=>t?t.running?e.jsx(p,{variant:"success",children:o("settings.watcherRunning")}):t.enabled?e.jsx(p,{variant:"warning",children:o("settings.watcherStopped")}):e.jsx(p,{variant:"secondary",children:o("settings.watcherDisabled")}):null;return e.jsxs(u,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{children:o("settings.watcher")}),l?e.jsx(y,{className:"h-5 w-16"}):a()]})}),e.jsx(h,{className:"space-y-4 text-sm",children:l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{className:"h-4 w-full"}),e.jsx(y,{className:"h-4 w-3/4"})]}):t?e.jsxs(e.Fragment,{children:[t.paths.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherPaths")}),e.jsx("div",{className:"space-y-1",children:t.paths.map(n=>e.jsx("p",{className:"font-mono text-xs truncate text-foreground",title:n,children:n},n))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wide",children:o("settings.watcherRecent")}),t.recent.length>0?e.jsx("div",{className:"space-y-1",children:t.recent.slice(0,5).map((n,f)=>e.jsxs("div",{className:"flex items-center justify-between rounded border border-border/50 px-2 py-1.5",children:[e.jsx("span",{className:"font-mono text-xs truncate max-w-[200px] text-foreground",title:n.path,children:n.path.split(/[/\\]/).pop()}),e.jsxs("span",{className:"shrink-0 ml-2 font-mono text-xs text-muted-foreground",children:["+",n.neurons_created]})]},f))}):e.jsx("p",{className:"text-xs text-muted-foreground",children:o("settings.watcherNoActivity")})]})]}):null})]})}const te=[K,$,q],ne=["#ef4444","#6366f1","#a8a29e"],re=["reportBug","featureRequest","discussions"],ae=["https://github.com/acidkill/surreal-memory/issues/new?template=bug_report.md","https://github.com/acidkill/surreal-memory/issues/new?template=feature_request.md","https://github.com/acidkill/surreal-memory/discussions"];function he(){const{data:t}=A(),{data:l}=O(),{data:o}=R(),{data:a}=U(),{data:n,isLoading:f}=W(),b=Q(),m=Y(),{t:s}=w(),v=i=>{if(i===0)return"0 B";const c=1024,j=["B","KB","MB","GB"],N=Math.floor(Math.log(i)/Math.log(c));return`${(i/Math.pow(c,N)).toFixed(1)} ${j[N]}`},k=()=>{b.mutate(void 0,{onSuccess:i=>{i.status==="success"?d.success(s("settings.testSuccess")):d.error(s("settings.testPartial"))},onError:()=>{d.error(s("settings.testFailed"))}})},r=()=>{m.mutate(void 0,{onSuccess:i=>{i.sent_to>0?d.success(s("settings.backupSuccess",{brain:i.brain,size:i.size_mb,count:i.sent_to})):d.error(s("settings.backupSendFailed"))},onError:()=>{d.error(s("settings.backupFailed"))}})};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("settings.title")}),e.jsx(X,{}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.general")})}),e.jsxs(h,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.version")}),e.jsx("span",{className:"font-mono",children:l?.version??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.activeBrain")}),e.jsx("span",{className:"font-mono",children:t?.active_brain??"-"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalBrains")}),e.jsx("span",{className:"font-mono",children:t?.total_brains??"-"})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-muted-foreground",children:s("license.tier","License")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:a?.is_pro?"success":"secondary",children:(a?.tier??"free").toUpperCase()}),!a?.is_pro&&e.jsx("button",{onClick:I,className:"text-xs font-medium text-primary hover:text-primary/80 transition-colors cursor-pointer",children:s("upgrade.title","Upgrade")})]})]})]})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.brainFiles")})}),e.jsx(h,{className:"space-y-3 text-sm",children:o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.brainsDirectory")}),e.jsx("span",{className:"font-mono text-xs max-w-[200px] truncate",title:o.brains_dir,children:o.brains_dir})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.totalDiskUsage")}),e.jsx("span",{className:"font-mono",children:v(o.total_size_bytes)})]}),o.brains.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:o.brains.map(i=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsx("span",{className:"font-mono font-medium",children:i.name}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v(i.size_bytes)})]},i.name))})]}):e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})})]}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.telegramBackup")})}),e.jsx(h,{className:"space-y-4 text-sm",children:f?e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")}):n?.configured?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{variant:"success",children:s("settings.connected")}),n.bot_name&&e.jsxs("span",{className:"text-muted-foreground",children:[n.bot_name,n.bot_username&&e.jsxs("span",{className:"font-mono text-xs",children:[" @",n.bot_username]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.chatIds")}),e.jsx("span",{className:"font-mono text-xs",children:n.chat_ids.length>0?n.chat_ids.join(", "):s("common.none")})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("settings.autoBackup")}),e.jsx("span",{className:"font-mono",children:n.backup_on_consolidation?s("common.yes"):s("common.no")})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(_,{variant:"outline",size:"sm",onClick:k,disabled:b.isPending,className:"cursor-pointer",children:b.isPending?s("settings.sending"):s("settings.sendTest")}),e.jsx(_,{size:"sm",onClick:r,disabled:m.isPending,className:"cursor-pointer",children:m.isPending?s("settings.backingUp"):s("settings.backupNow")})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(p,{variant:"warning",children:s("settings.notConfigured")})}),n?.error&&e.jsx("p",{className:"text-xs text-destructive",children:n.error}),e.jsx("p",{className:"text-xs text-muted-foreground",dangerouslySetInnerHTML:{__html:s("settings.telegramSetup")}})]})})]}),e.jsx(se,{}),e.jsx(ee,{}),e.jsxs(u,{children:[e.jsx(x,{children:e.jsx(g,{children:s("settings.feedbackTitle")})}),e.jsx(h,{className:"space-y-3",children:re.map((i,c)=>{const j=te[c],N=ne[c],E=ae[c];return e.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent cursor-pointer",children:[e.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${N}15`},children:e.jsx(j,{className:"size-4",style:{color:N}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:s(`settings.${i}`)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s(`settings.${i}Desc`)})]}),e.jsx(G,{className:"size-3.5 shrink-0 text-muted-foreground mt-0.5"})]},i)})})]})]})]})}export{he as default}; diff --git a/src/surreal_memory/server/static/dist/assets/StoragePage-CLDPXEH8.js b/src/surreal_memory/server/static/dist/assets/StoragePage-CLDPXEH8.js deleted file mode 100644 index 1ef1dfc6..00000000 --- a/src/surreal_memory/server/static/dist/assets/StoragePage-CLDPXEH8.js +++ /dev/null @@ -1 +0,0 @@ -import{u as g,j as s}from"./vendor-query-CqA1cBNl.js";import{n as j,u as c,c as f,b as n}from"./index-C26pxqlr.js";import{C as x,a as m,b as u,c as h}from"./card-B0vNsxr_.js";import{o as p,Z as o}from"./vendor-icons-BYlYobEK.js";import{S as d}from"./skeleton-DQJ-n00q.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const N={tierStats:["storage","tier-stats"]};function b(){return g({queryKey:N.tierStats,queryFn:()=>j.get("/api/dashboard/tier-stats")})}function i({label:e,count:a,total:r,color:t}){const l=r>0?a/r*100:0;return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"inline-block size-2.5 rounded-full",style:{backgroundColor:t},"aria-hidden":"true"}),e]}),s.jsx("span",{className:"font-mono font-semibold tabular-nums",children:a})]}),s.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l}%`,backgroundColor:t}})})]})}function v({data:e}){const{t:a}=c();return s.jsxs(x,{children:[s.jsx(m,{className:"pb-3",children:s.jsxs(u,{className:"flex items-center gap-2 text-base",children:[s.jsx(p,{className:"size-5","aria-hidden":"true"}),a("storage.tierDistribution")]})}),s.jsxs(h,{className:"space-y-4",children:[s.jsx(i,{label:a("storage.tierHot"),count:e.hot,total:e.total,color:"#ef4444"}),s.jsx(i,{label:a("storage.tierWarm"),count:e.warm,total:e.total,color:"#f59e0b"}),s.jsx(i,{label:a("storage.tierCold"),count:e.cold,total:e.total,color:"#3b82f6"}),s.jsxs("div",{className:"pt-2 border-t text-sm text-muted-foreground",children:[a("storage.totalMemories"),": ",s.jsx("span",{className:"font-mono font-semibold text-foreground",children:e.total})]})]})]})}function z(){const{data:e,isLoading:a}=f(),{data:r}=b(),{t}=c();if(a||!e)return s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:t("storage.title")}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsx(d,{className:"h-48"}),s.jsx(d,{className:"h-48"})]})]});const l=e.active_brain??"default";return s.jsxs("div",{className:"space-y-6 p-6",children:[s.jsx("h1",{className:"text-2xl font-bold",children:t("storage.title")}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(x,{children:[s.jsx(m,{className:"pb-3",children:s.jsxs(u,{className:"flex items-center gap-2 text-base",children:[s.jsx(o,{className:"size-5","aria-hidden":"true"}),t("storage.currentBackend","Storage Backend")]})}),s.jsxs(h,{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(n,{variant:"default",className:"text-sm px-3 py-1",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(o,{className:"size-3.5","aria-hidden":"true"}),"SurrealDB"]})}),s.jsxs("span",{className:"text-sm text-muted-foreground",children:[t("storage.brain","Brain"),":"," ",s.jsx("span",{className:"font-medium text-foreground",children:l})]}),s.jsxs(n,{variant:"outline",className:"text-xs",children:[t("storage.grade","Grade"),": ",e.health_grade]})]}),s.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-center",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:t("storage.neurons","Neurons")}),s.jsx("dd",{className:"text-lg font-semibold",children:e.total_neurons.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:t("storage.synapses","Synapses")}),s.jsx("dd",{className:"text-lg font-semibold",children:e.total_synapses.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:t("storage.fibers","Fibers")}),s.jsx("dd",{className:"text-lg font-semibold",children:e.total_fibers.toLocaleString()})]})]})]})]}),r&&r.total>0&&s.jsx(v,{data:r})]})]})}export{z as default}; diff --git a/src/surreal_memory/server/static/dist/assets/StoragePage-Dfp1G5qu.js b/src/surreal_memory/server/static/dist/assets/StoragePage-Dfp1G5qu.js new file mode 100644 index 00000000..a6e016f5 --- /dev/null +++ b/src/surreal_memory/server/static/dist/assets/StoragePage-Dfp1G5qu.js @@ -0,0 +1 @@ +import{u as c,j as e}from"./vendor-query-CqA1cBNl.js";import{n as x,u as i,b as n}from"./index-DzyKsRxc.js";import{C as m,a as u,b as h,c as g}from"./card-CB2KYkrP.js";import{Z as d,x as f,z as N,o as b}from"./vendor-icons-BYlYobEK.js";import{S as o}from"./skeleton-B4zDkVHp.js";import"./vendor-react-BfuodpLv.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const j={status:["storage","status"],tierStats:["storage","tier-stats"]};function y(){return c({queryKey:j.status,queryFn:()=>x.get("/api/dashboard/storage/status")})}function v(){return c({queryKey:j.tierStats,queryFn:()=>x.get("/api/dashboard/tier-stats")})}function S({status:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(d,{className:"size-5","aria-hidden":"true"}),a("storage.currentBackend","Storage Backend")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(n,{variant:"default",className:"text-sm px-3 py-1",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(d,{className:"size-3.5","aria-hidden":"true"}),"SurrealDB"]})}),e.jsx(n,{variant:s.healthy?"outline":"destructive",className:"text-xs",children:s.healthy?a("storage.connected","Connected"):a("storage.disconnected","Disconnected")}),s.health_grade&&e.jsxs(n,{variant:"secondary",className:"text-xs",children:[a("storage.grade","Grade"),": ",s.health_grade]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.healthy?e.jsx(f,{className:"size-4 shrink-0 text-green-500","aria-hidden":"true"}):e.jsx(N,{className:"size-4 shrink-0 text-destructive","aria-hidden":"true"}),e.jsx("span",{className:"text-muted-foreground break-all",children:s.url||a("storage.urlUnknown","URL unknown")})]}),(s.namespace||s.database)&&e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm text-muted-foreground",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.namespace","Namespace")}),e.jsx("p",{className:"truncate",children:s.namespace||"—"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a("storage.database","Database")}),e.jsx("p",{className:"truncate",children:s.database||"—"})]})]}),e.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.neurons","Neurons")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.neuron_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.synapses","Synapses")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.synapse_count.toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a("storage.fibers","Fibers")}),e.jsx("dd",{className:"text-lg font-semibold",children:s.fiber_count.toLocaleString()})]})]})]})]})}function l({label:s,count:a,total:t,color:r}){const p=t>0?a/t*100:0;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block size-2.5 rounded-full",style:{backgroundColor:r},"aria-hidden":"true"}),s]}),e.jsx("span",{className:"font-mono font-semibold tabular-nums",children:a})]}),e.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${p}%`,backgroundColor:r}})})]})}function k({data:s}){const{t:a}=i();return e.jsxs(m,{children:[e.jsx(u,{className:"pb-3",children:e.jsxs(h,{className:"flex items-center gap-2 text-base",children:[e.jsx(b,{className:"size-5","aria-hidden":"true"}),a("storage.tierDistribution")]})}),e.jsxs(g,{className:"space-y-4",children:[e.jsx(l,{label:a("storage.tierHot"),count:s.hot,total:s.total,color:"#ef4444"}),e.jsx(l,{label:a("storage.tierWarm"),count:s.warm,total:s.total,color:"#f59e0b"}),e.jsx(l,{label:a("storage.tierCold"),count:s.cold,total:s.total,color:"#3b82f6"}),e.jsxs("div",{className:"pt-2 border-t text-sm text-muted-foreground",children:[a("storage.totalMemories"),": ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:s.total})]})]})]})}function q(){const{data:s,isLoading:a}=y(),{data:t}=v(),{t:r}=i();return a||!s?e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(o,{className:"h-48"}),e.jsx(o,{className:"h-48"})]})]}):e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r("storage.title")}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsx(S,{status:s}),t&&t.total>0&&e.jsx(k,{data:t})]})]})}export{q as default}; diff --git a/src/surreal_memory/server/static/dist/assets/SyncPage-MbtH1dwD.js b/src/surreal_memory/server/static/dist/assets/SyncPage-CNbeBod6.js similarity index 98% rename from src/surreal_memory/server/static/dist/assets/SyncPage-MbtH1dwD.js rename to src/surreal_memory/server/static/dist/assets/SyncPage-CNbeBod6.js index 3936d163..92ae4ff9 100644 --- a/src/surreal_memory/server/static/dist/assets/SyncPage-MbtH1dwD.js +++ b/src/surreal_memory/server/static/dist/assets/SyncPage-CNbeBod6.js @@ -1 +1 @@ -import{u as L,a as U,b as E,j as e}from"./vendor-query-CqA1cBNl.js";import{r as y}from"./vendor-react-BfuodpLv.js";import{n as N,u as P,B as i,b as p,t as a}from"./index-C26pxqlr.js";import{C as o,a as d,b as u,c as m}from"./card-B0vNsxr_.js";import{Q as q,f as D,R as F,u as R,S as T,T as B}from"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const b={status:["sync","status"]};function H(){return L({queryKey:b.status,queryFn:()=>N.get("/api/dashboard/sync-status"),refetchInterval:3e4})}function K(){const t=U();return E({mutationFn:x=>N.post("/api/dashboard/sync-config",x),onSuccess:()=>{t.invalidateQueries({queryKey:b.status})}})}const A="",Q="https://your-worker.your-subdomain.workers.dev",I={prefer_recent:"Prefer Recent",prefer_local:"Prefer Local",prefer_remote:"Prefer Remote",prefer_stronger:"Prefer Stronger"};function V(){const{data:t,isLoading:x,refetch:v}=H(),r=K(),{t:s}=P(),[f,_]=y.useState(""),[j,g]=y.useState(""),[C,h]=y.useState(!1),S=()=>{const n=f.trim()||A,l=j.trim();if(!l){a.error(s("sync.keyRequired"));return}if(!l.startsWith("nmk_")){a.error(s("sync.keyInvalid"));return}r.mutate({hub_url:n,api_key:l,enabled:!0},{onSuccess:()=>{a.success(s("sync.connected")),h(!1),g("")},onError:()=>a.error(s("sync.connectFailed"))})},k=()=>{r.mutate({enabled:!1,api_key:"",hub_url:""},{onSuccess:()=>a.success(s("sync.disconnected")),onError:()=>a.error(s("sync.disconnectFailed"))})},w=n=>{r.mutate({conflict_strategy:n},{onSuccess:()=>a.success(s("sync.strategyUpdated")),onError:()=>a.error(s("sync.updateFailed"))})},z=n=>n?new Date(n).toLocaleString():s("sync.never");if(x)return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})]});const c=t?.enabled&&t.api_key!=="(not set)";return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>v(),className:"cursor-pointer",children:[e.jsx(q,{className:"mr-2 size-4"}),s("sync.refresh")]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[c?e.jsx(D,{className:"size-5 text-emerald-500"}):e.jsx(F,{className:"size-5 text-muted-foreground"}),s("sync.connectionStatus")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.status")}),e.jsx(p,{variant:c?"success":"warning",children:s(c?"sync.cloudConnected":"sync.notConnected")})]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs",title:t.hub_url,children:t.hub_url})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.apiKey")}),e.jsx("span",{className:"font-mono text-xs",children:t.api_key})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.deviceId")}),e.jsxs("span",{className:"font-mono text-xs",children:[t.device_id?.slice(0,12),"..."]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.syncMode")}),e.jsx(p,{variant:"success",children:s("sync.merkleDelta")})]})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:c?e.jsx(i,{variant:"destructive",size:"sm",onClick:k,disabled:r.isPending,className:"cursor-pointer",children:s("sync.disconnect")}):e.jsx(i,{size:"sm",onClick:()=>h(!0),className:"cursor-pointer",children:s("sync.setupCloud")})})]})]}),C&&!c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsx(u,{children:s("sync.setupTitle")})}),e.jsxs(m,{className:"space-y-4 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.setupDesc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"hub-url",className:"text-xs font-medium text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("input",{id:"hub-url",type:"url",value:f,onChange:n=>_(n.target.value),placeholder:Q,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"api-key",className:"text-xs font-medium text-muted-foreground",children:s("sync.apiKey")}),e.jsx("input",{id:"api-key",type:"password",value:j,onChange:n=>g(n.target.value),placeholder:"nmk_...",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("sync.keyHint")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{size:"sm",onClick:S,disabled:r.isPending,className:"cursor-pointer",children:r.isPending?s("sync.connecting"):s("sync.connect")}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>h(!1),className:"cursor-pointer",children:s("common.cancel")})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-5"}),s("sync.devices")," (",t.device_count,")"]})}),e.jsx(m,{className:"space-y-3 text-sm",children:t.devices.length>0?t.devices.map(n=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-xs font-medium",children:n.device_name||n.device_id.slice(0,12)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sync.lastSync"),": ",z(n.last_sync_at)]})]}),e.jsxs(p,{variant:"outline",className:"shrink-0",children:["seq ",n.last_sync_sequence]})]},n.device_id)):e.jsx("p",{className:"text-muted-foreground",children:s("sync.noDevices")})})]}),c&&t.change_log&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(T,{className:"size-5"}),s("sync.changeLog")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.totalChanges")}),e.jsx("span",{className:"font-mono",children:t.change_log.total_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.synced")}),e.jsx("span",{className:"font-mono text-emerald-500",children:t.change_log.synced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.pending")}),e.jsx("span",{className:"font-mono text-amber-500",children:t.change_log.unsynced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.latestSequence")}),e.jsx("span",{className:"font-mono",children:t.change_log.latest_sequence})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"size-5"}),s("sync.conflictStrategy")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.conflictDesc")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(I).map(([n,l])=>e.jsx("button",{onClick:()=>w(n),disabled:r.isPending,className:`cursor-pointer rounded-lg border px-3 py-2 text-xs font-medium transition-colors ${t.conflict_strategy===n?"border-primary bg-primary/10 text-primary":"border-border hover:bg-accent"}`,children:l},n))})]})]})]})]})}export{V as default}; +import{u as L,a as U,b as E,j as e}from"./vendor-query-CqA1cBNl.js";import{r as y}from"./vendor-react-BfuodpLv.js";import{n as N,u as P,B as i,b as p,t as a}from"./index-DzyKsRxc.js";import{C as o,a as d,b as u,c as m}from"./card-CB2KYkrP.js";import{Q as q,f as D,R as F,u as R,S as T,T as B}from"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";const b={status:["sync","status"]};function H(){return L({queryKey:b.status,queryFn:()=>N.get("/api/dashboard/sync-status"),refetchInterval:3e4})}function K(){const t=U();return E({mutationFn:x=>N.post("/api/dashboard/sync-config",x),onSuccess:()=>{t.invalidateQueries({queryKey:b.status})}})}const A="",Q="https://your-worker.your-subdomain.workers.dev",I={prefer_recent:"Prefer Recent",prefer_local:"Prefer Local",prefer_remote:"Prefer Remote",prefer_stronger:"Prefer Stronger"};function V(){const{data:t,isLoading:x,refetch:v}=H(),r=K(),{t:s}=P(),[f,_]=y.useState(""),[j,g]=y.useState(""),[C,h]=y.useState(!1),S=()=>{const n=f.trim()||A,l=j.trim();if(!l){a.error(s("sync.keyRequired"));return}if(!l.startsWith("nmk_")){a.error(s("sync.keyInvalid"));return}r.mutate({hub_url:n,api_key:l,enabled:!0},{onSuccess:()=>{a.success(s("sync.connected")),h(!1),g("")},onError:()=>a.error(s("sync.connectFailed"))})},k=()=>{r.mutate({enabled:!1,api_key:"",hub_url:""},{onSuccess:()=>a.success(s("sync.disconnected")),onError:()=>a.error(s("sync.disconnectFailed"))})},w=n=>{r.mutate({conflict_strategy:n},{onSuccess:()=>a.success(s("sync.strategyUpdated")),onError:()=>a.error(s("sync.updateFailed"))})},z=n=>n?new Date(n).toLocaleString():s("sync.never");if(x)return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("common.loading")})]});const c=t?.enabled&&t.api_key!=="(not set)";return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:s("sync.title")}),e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>v(),className:"cursor-pointer",children:[e.jsx(q,{className:"mr-2 size-4"}),s("sync.refresh")]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[c?e.jsx(D,{className:"size-5 text-emerald-500"}):e.jsx(F,{className:"size-5 text-muted-foreground"}),s("sync.connectionStatus")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.status")}),e.jsx(p,{variant:c?"success":"warning",children:s(c?"sync.cloudConnected":"sync.notConnected")})]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs",title:t.hub_url,children:t.hub_url})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.apiKey")}),e.jsx("span",{className:"font-mono text-xs",children:t.api_key})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.deviceId")}),e.jsxs("span",{className:"font-mono text-xs",children:[t.device_id?.slice(0,12),"..."]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.syncMode")}),e.jsx(p,{variant:"success",children:s("sync.merkleDelta")})]})]}),e.jsx("div",{className:"flex gap-2 pt-2",children:c?e.jsx(i,{variant:"destructive",size:"sm",onClick:k,disabled:r.isPending,className:"cursor-pointer",children:s("sync.disconnect")}):e.jsx(i,{size:"sm",onClick:()=>h(!0),className:"cursor-pointer",children:s("sync.setupCloud")})})]})]}),C&&!c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsx(u,{children:s("sync.setupTitle")})}),e.jsxs(m,{className:"space-y-4 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.setupDesc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"hub-url",className:"text-xs font-medium text-muted-foreground",children:s("sync.hubUrl")}),e.jsx("input",{id:"hub-url",type:"url",value:f,onChange:n=>_(n.target.value),placeholder:Q,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"api-key",className:"text-xs font-medium text-muted-foreground",children:s("sync.apiKey")}),e.jsx("input",{id:"api-key",type:"password",value:j,onChange:n=>g(n.target.value),placeholder:"nmk_...",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-ring"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("sync.keyHint")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{size:"sm",onClick:S,disabled:r.isPending,className:"cursor-pointer",children:r.isPending?s("sync.connecting"):s("sync.connect")}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>h(!1),className:"cursor-pointer",children:s("common.cancel")})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"size-5"}),s("sync.devices")," (",t.device_count,")"]})}),e.jsx(m,{className:"space-y-3 text-sm",children:t.devices.length>0?t.devices.map(n=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border/50 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-mono text-xs font-medium",children:n.device_name||n.device_id.slice(0,12)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sync.lastSync"),": ",z(n.last_sync_at)]})]}),e.jsxs(p,{variant:"outline",className:"shrink-0",children:["seq ",n.last_sync_sequence]})]},n.device_id)):e.jsx("p",{className:"text-muted-foreground",children:s("sync.noDevices")})})]}),c&&t.change_log&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(T,{className:"size-5"}),s("sync.changeLog")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.totalChanges")}),e.jsx("span",{className:"font-mono",children:t.change_log.total_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.synced")}),e.jsx("span",{className:"font-mono text-emerald-500",children:t.change_log.synced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.pending")}),e.jsx("span",{className:"font-mono text-amber-500",children:t.change_log.unsynced_changes})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:s("sync.latestSequence")}),e.jsx("span",{className:"font-mono",children:t.change_log.latest_sequence})]})]})]}),c&&e.jsxs(o,{children:[e.jsx(d,{children:e.jsxs(u,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"size-5"}),s("sync.conflictStrategy")]})}),e.jsxs(m,{className:"space-y-3 text-sm",children:[e.jsx("p",{className:"text-muted-foreground",children:s("sync.conflictDesc")}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(I).map(([n,l])=>e.jsx("button",{onClick:()=>w(n),disabled:r.isPending,className:`cursor-pointer rounded-lg border px-3 py-2 text-xs font-medium transition-colors ${t.conflict_strategy===n?"border-primary bg-primary/10 text-primary":"border-border hover:bg-accent"}`,children:l},n))})]})]})]})]})}export{V as default}; diff --git a/src/surreal_memory/server/static/dist/assets/TimelinePage-BIybkdH4.js b/src/surreal_memory/server/static/dist/assets/TimelinePage-C2MQrnce.js similarity index 98% rename from src/surreal_memory/server/static/dist/assets/TimelinePage-BIybkdH4.js rename to src/surreal_memory/server/static/dist/assets/TimelinePage-C2MQrnce.js index b58e7a2b..8129842b 100644 --- a/src/surreal_memory/server/static/dist/assets/TimelinePage-BIybkdH4.js +++ b/src/surreal_memory/server/static/dist/assets/TimelinePage-C2MQrnce.js @@ -1 +1 @@ -import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as p}from"./vendor-react-BfuodpLv.js";import{i as E,j as T,u as z,b as L}from"./index-C26pxqlr.js";import{C as f,a as v,b,c as u}from"./card-B0vNsxr_.js";import{S as y}from"./skeleton-DQJ-n00q.js";import{c as P,o as R,G as K,M as G}from"./vendor-icons-BYlYobEK.js";import{R as k,A as M,C as B,X as S,Y as C,T as D,e as N,B as $,f as W,g as Y}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const F=[{days:7,key:"range7d"},{days:30,key:"range30d"},{days:90,key:"range90d"},{days:365,key:"rangeAll"}],I={entity:"var(--color-chart-1)",concept:"var(--color-chart-2)",action:"var(--color-chart-3)",intent:"var(--color-chart-4)",time:"var(--color-chart-5, #8b5cf6)",spatial:"#f59e0b",state:"#06b6d4",sensory:"#ec4899"};function h({label:d,value:n,icon:s,loading:o}){return e.jsx(f,{children:e.jsxs(u,{className:"flex items-center gap-4 p-5",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(s,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:d}),o?e.jsx(y,{className:"mt-1 h-6 w-16"}):e.jsx("p",{className:"font-mono text-xl font-bold tracking-tight",children:typeof n=="number"?n.toLocaleString():n})]})]})})}function ee(){const[d,n]=p.useState(30),{data:s,isLoading:o}=E(d),{data:l,isLoading:O}=T(20,0),{t:r}=z(),x=p.useMemo(()=>{if(!s||s.length===0)return{today:0,total:0,avgPerDay:0,activeDays:0};const t=new Date().toISOString().slice(0,10),a=s.find(c=>c.date===t),i=a?a.fibers_created:0,m=s.reduce((c,A)=>c+A.fibers_created,0),g=s.filter(c=>c.fibers_created>0).length,w=g>0?Math.round(m/g):0;return{today:i,total:m,avgPerDay:w,activeDays:g}},[s]),j=p.useMemo(()=>{if(!s)return[];const t={};for(const a of s)for(const[i,m]of Object.entries(a.neuron_types))t[i]=(t[i]??0)+m;return Object.entries(t).map(([a,i])=>({type:a,count:i})).sort((a,i)=>i.count-a.count)},[s]),_=p.useMemo(()=>s?s.map(t=>({date:t.date.slice(5),neurons:t.neurons_created,fibers:t.fibers_created,synapses:t.synapses_created})):[],[s]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:r("timeline.title")}),e.jsx("div",{className:"flex gap-1 rounded-lg border border-border p-1",children:F.map(t=>e.jsx("button",{onClick:()=>n(t.days),className:`cursor-pointer rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${d===t.days?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent/50"}`,children:r(`timeline.${t.key}`)},t.days))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[e.jsx(h,{label:r("timeline.todayMemories"),value:x.today,icon:P,loading:o}),e.jsx(h,{label:r("timeline.totalPeriod"),value:x.total,icon:R,loading:o}),e.jsx(h,{label:r("timeline.avgPerDay"),value:x.avgPerDay,icon:K,loading:o}),e.jsx(h,{label:r("timeline.activeDays"),value:x.activeDays,icon:G,loading:o})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.activityTrend")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-72 w-full"}):e.jsx(k,{width:"100%",height:280,children:e.jsxs(M,{data:_,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorNeurons",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-1)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-1)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorFibers",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-2)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-2)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorSynapses",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-4)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-4)",stopOpacity:0})]})]}),e.jsx(B,{strokeDasharray:"3 3",stroke:"var(--color-border)",opacity:.3}),e.jsx(S,{dataKey:"date",tick:{fill:"var(--color-muted-foreground)",fontSize:11},interval:"preserveStartEnd"}),e.jsx(C,{tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:40}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(N,{type:"monotone",dataKey:"neurons",name:r("timeline.neurons"),stroke:"var(--color-chart-1)",fill:"url(#colorNeurons)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"fibers",name:r("timeline.fibers"),stroke:"var(--color-chart-2)",fill:"url(#colorFibers)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"synapses",name:r("timeline.synapses"),stroke:"var(--color-chart-4)",fill:"url(#colorSynapses)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.neuronDistribution")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-64 w-full"}):j.length>0?e.jsx(k,{width:"100%",height:260,children:e.jsxs($,{data:j,layout:"vertical",children:[e.jsx(S,{type:"number",tick:{fill:"var(--color-muted-foreground)",fontSize:11}}),e.jsx(C,{dataKey:"type",type:"category",tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:70}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(W,{dataKey:"count",radius:[0,4,4,0],children:j.map(t=>e.jsx(Y,{fill:I[t.type]??"var(--color-chart-1)"},t.type))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsxs(b,{children:[r("timeline.recentActivity"),l&&e.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:r("timeline.entries",{total:l.total.toLocaleString()})})]})}),e.jsx(u,{children:O?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,a)=>e.jsx(y,{className:"h-14 w-full"},a))}):l?.entries&&l.entries.length>0?e.jsx("div",{className:"max-h-96 space-y-2 overflow-y-auto",children:l.entries.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent/30",children:[e.jsx(L,{variant:"outline",className:"mt-0.5 shrink-0",children:t.neuron_type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm leading-relaxed line-clamp-2",children:t.content}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t.created_at?new Date(t.created_at).toLocaleString():"-"})]})]},t.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]})]})]})}export{ee as default}; +import{j as e}from"./vendor-query-CqA1cBNl.js";import{r as p}from"./vendor-react-BfuodpLv.js";import{i as E,j as T,u as z,b as L}from"./index-DzyKsRxc.js";import{C as f,a as v,b,c as u}from"./card-CB2KYkrP.js";import{S as y}from"./skeleton-B4zDkVHp.js";import{c as P,o as R,G as K,M as G}from"./vendor-icons-BYlYobEK.js";import{R as k,A as M,C as B,X as S,Y as C,T as D,e as N,B as $,f as W,g as Y}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-ui-Qm4_4bAc.js";const F=[{days:7,key:"range7d"},{days:30,key:"range30d"},{days:90,key:"range90d"},{days:365,key:"rangeAll"}],I={entity:"var(--color-chart-1)",concept:"var(--color-chart-2)",action:"var(--color-chart-3)",intent:"var(--color-chart-4)",time:"var(--color-chart-5, #8b5cf6)",spatial:"#f59e0b",state:"#06b6d4",sensory:"#ec4899"};function h({label:d,value:n,icon:s,loading:o}){return e.jsx(f,{children:e.jsxs(u,{className:"flex items-center gap-4 p-5",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(s,{className:"size-5 text-primary","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:d}),o?e.jsx(y,{className:"mt-1 h-6 w-16"}):e.jsx("p",{className:"font-mono text-xl font-bold tracking-tight",children:typeof n=="number"?n.toLocaleString():n})]})]})})}function ee(){const[d,n]=p.useState(30),{data:s,isLoading:o}=E(d),{data:l,isLoading:O}=T(20,0),{t:r}=z(),x=p.useMemo(()=>{if(!s||s.length===0)return{today:0,total:0,avgPerDay:0,activeDays:0};const t=new Date().toISOString().slice(0,10),a=s.find(c=>c.date===t),i=a?a.fibers_created:0,m=s.reduce((c,A)=>c+A.fibers_created,0),g=s.filter(c=>c.fibers_created>0).length,w=g>0?Math.round(m/g):0;return{today:i,total:m,avgPerDay:w,activeDays:g}},[s]),j=p.useMemo(()=>{if(!s)return[];const t={};for(const a of s)for(const[i,m]of Object.entries(a.neuron_types))t[i]=(t[i]??0)+m;return Object.entries(t).map(([a,i])=>({type:a,count:i})).sort((a,i)=>i.count-a.count)},[s]),_=p.useMemo(()=>s?s.map(t=>({date:t.date.slice(5),neurons:t.neurons_created,fibers:t.fibers_created,synapses:t.synapses_created})):[],[s]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:r("timeline.title")}),e.jsx("div",{className:"flex gap-1 rounded-lg border border-border p-1",children:F.map(t=>e.jsx("button",{onClick:()=>n(t.days),className:`cursor-pointer rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${d===t.days?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent/50"}`,children:r(`timeline.${t.key}`)},t.days))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[e.jsx(h,{label:r("timeline.todayMemories"),value:x.today,icon:P,loading:o}),e.jsx(h,{label:r("timeline.totalPeriod"),value:x.total,icon:R,loading:o}),e.jsx(h,{label:r("timeline.avgPerDay"),value:x.avgPerDay,icon:K,loading:o}),e.jsx(h,{label:r("timeline.activeDays"),value:x.activeDays,icon:G,loading:o})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.activityTrend")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-72 w-full"}):e.jsx(k,{width:"100%",height:280,children:e.jsxs(M,{data:_,children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"colorNeurons",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-1)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-1)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorFibers",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-2)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-2)",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"colorSynapses",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"var(--color-chart-4)",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"var(--color-chart-4)",stopOpacity:0})]})]}),e.jsx(B,{strokeDasharray:"3 3",stroke:"var(--color-border)",opacity:.3}),e.jsx(S,{dataKey:"date",tick:{fill:"var(--color-muted-foreground)",fontSize:11},interval:"preserveStartEnd"}),e.jsx(C,{tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:40}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(N,{type:"monotone",dataKey:"neurons",name:r("timeline.neurons"),stroke:"var(--color-chart-1)",fill:"url(#colorNeurons)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"fibers",name:r("timeline.fibers"),stroke:"var(--color-chart-2)",fill:"url(#colorFibers)",strokeWidth:2}),e.jsx(N,{type:"monotone",dataKey:"synapses",name:r("timeline.synapses"),stroke:"var(--color-chart-4)",fill:"url(#colorSynapses)",strokeWidth:2})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(f,{children:[e.jsx(v,{children:e.jsx(b,{children:r("timeline.neuronDistribution")})}),e.jsx(u,{children:o?e.jsx(y,{className:"h-64 w-full"}):j.length>0?e.jsx(k,{width:"100%",height:260,children:e.jsxs($,{data:j,layout:"vertical",children:[e.jsx(S,{type:"number",tick:{fill:"var(--color-muted-foreground)",fontSize:11}}),e.jsx(C,{dataKey:"type",type:"category",tick:{fill:"var(--color-muted-foreground)",fontSize:11},width:70}),e.jsx(D,{contentStyle:{backgroundColor:"var(--color-card)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"}}),e.jsx(W,{dataKey:"count",radius:[0,4,4,0],children:j.map(t=>e.jsx(Y,{fill:I[t.type]??"var(--color-chart-1)"},t.type))})]})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]}),e.jsxs(f,{children:[e.jsx(v,{children:e.jsxs(b,{children:[r("timeline.recentActivity"),l&&e.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:r("timeline.entries",{total:l.total.toLocaleString()})})]})}),e.jsx(u,{children:O?e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,a)=>e.jsx(y,{className:"h-14 w-full"},a))}):l?.entries&&l.entries.length>0?e.jsx("div",{className:"max-h-96 space-y-2 overflow-y-auto",children:l.entries.map(t=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border/50 p-3 transition-colors hover:bg-accent/30",children:[e.jsx(L,{variant:"outline",className:"mt-0.5 shrink-0",children:t.neuron_type}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm leading-relaxed line-clamp-2",children:t.content}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t.created_at?new Date(t.created_at).toLocaleString():"-"})]})]},t.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:r("timeline.noEntries")})})]})]})]})}export{ee as default}; diff --git a/src/surreal_memory/server/static/dist/assets/ToolStatsPage-BA-DvxES.js b/src/surreal_memory/server/static/dist/assets/ToolStatsPage-zZWqg3RV.js similarity index 97% rename from src/surreal_memory/server/static/dist/assets/ToolStatsPage-BA-DvxES.js rename to src/surreal_memory/server/static/dist/assets/ToolStatsPage-zZWqg3RV.js index b51ef1b0..427ea8a1 100644 --- a/src/surreal_memory/server/static/dist/assets/ToolStatsPage-BA-DvxES.js +++ b/src/surreal_memory/server/static/dist/assets/ToolStatsPage-zZWqg3RV.js @@ -1 +1 @@ -import{j as t}from"./vendor-query-CqA1cBNl.js";import{r as u}from"./vendor-react-BfuodpLv.js";import{y as w,u as T,B as R,b as k}from"./index-C26pxqlr.js";import{C as l,a as c,b as d,c as i}from"./card-B0vNsxr_.js";import{S as x}from"./skeleton-DQJ-n00q.js";import{R as g,B as D,C as N,X as b,Y as y,T as S,f as M,g as B,L,p as A}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";const O=[7,14,30,90],v=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4","#8b5cf6","#ec4899","#14b8a6","#f97316","#64748b"];function z(o){return o<1e3?`${Math.round(o)}ms`:`${(o/1e3).toFixed(1)}s`}function _(o){return`${Math.round(o*100)}%`}function E(o){return o>=.95?"success":o>=.8?"warning":"destructive"}function H(){const[o,C]=u.useState(30),{data:j,isLoading:n}=w(o),{t:a}=T(),r=j?.summary,f=j?.daily??[],p=u.useMemo(()=>{const s=new Map;for(const e of f){const m=s.get(e.date);m?(m.count+=e.count,m.successes+=Math.round(e.count*e.success_rate)):s.set(e.date,{date:e.date,count:e.count,successes:Math.round(e.count*e.success_rate)})}return Array.from(s.values()).sort((e,m)=>e.date.localeCompare(m.date)).map(e=>({date:e.date.slice(5),count:e.count,successRate:e.count>0?Math.round(e.successes/e.count*100):0}))},[f]),h=u.useMemo(()=>r?.top_tools?r.top_tools.slice(0,10).map(s=>({...s,shortName:s.tool_name.replace(/^smem_/,"")})):[],[r]);return t.jsxs("div",{className:"space-y-6 p-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"font-display text-2xl font-bold",children:a("toolStats.title")}),t.jsx("div",{className:"flex gap-1",children:O.map(s=>t.jsxs(R,{variant:o===s?"default":"outline",size:"sm",onClick:()=>C(s),className:"cursor-pointer",children:[s,"d"]},s))})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.totalEvents")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-24"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:(r?.total_events??0).toLocaleString()})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.successRate")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-20"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:_(r?.success_rate??0)})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.uniqueTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-16"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:r?.top_tools?.length??0})})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.topTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):h.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:Math.max(h.length*36,200),children:t.jsxs(D,{data:h,layout:"vertical",margin:{left:80,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{type:"number"}),t.jsx(y,{type:"category",dataKey:"shortName",tick:{fontSize:12},width:80}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(M,{dataKey:"count",radius:[0,4,4,0],children:h.map((s,e)=>t.jsx(B,{fill:v[e%v.length]},e))})]})})})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.usageOverTime")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):p.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:300,children:t.jsxs(L,{data:p,margin:{left:10,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{dataKey:"date",tick:{fontSize:11}}),t.jsx(y,{tick:{fontSize:11}}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(A,{type:"monotone",dataKey:"count",stroke:"#6366f1",strokeWidth:2,dot:!1,name:a("toolStats.calls")})]})})})]})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.detailTable")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-48 w-full"}):r?.top_tools?.length?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.tool")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.calls")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.successRate")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.avgDuration")}),t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.server")})]})}),t.jsx("tbody",{children:r.top_tools.map(s=>t.jsxs("tr",{className:"border-b border-border/50",children:[t.jsx("td",{className:"py-2.5 font-mono text-xs",children:s.tool_name}),t.jsx("td",{className:"py-2.5 text-right font-mono",children:s.count}),t.jsx("td",{className:"py-2.5 text-right",children:t.jsx(k,{variant:E(s.success_rate),children:_(s.success_rate)})}),t.jsx("td",{className:"py-2.5 text-right font-mono text-xs text-muted-foreground",children:z(s.avg_duration_ms)}),t.jsx("td",{className:"py-2.5 text-xs text-muted-foreground",children:s.server_name||"—"})]},s.tool_name))})]})}):t.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("toolStats.noData")})})]})]})}export{H as default}; +import{j as t}from"./vendor-query-CqA1cBNl.js";import{r as u}from"./vendor-react-BfuodpLv.js";import{y as w,u as T,B as R,b as k}from"./index-DzyKsRxc.js";import{C as l,a as c,b as d,c as i}from"./card-CB2KYkrP.js";import{S as x}from"./skeleton-B4zDkVHp.js";import{R as g,B as D,C as N,X as b,Y as y,T as S,f as M,g as B,L,p as A}from"./vendor-recharts-BkwZfCWA.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";const O=[7,14,30,90],v=["#6366f1","#10b981","#f59e0b","#ef4444","#06b6d4","#8b5cf6","#ec4899","#14b8a6","#f97316","#64748b"];function z(o){return o<1e3?`${Math.round(o)}ms`:`${(o/1e3).toFixed(1)}s`}function _(o){return`${Math.round(o*100)}%`}function E(o){return o>=.95?"success":o>=.8?"warning":"destructive"}function H(){const[o,C]=u.useState(30),{data:j,isLoading:n}=w(o),{t:a}=T(),r=j?.summary,f=j?.daily??[],p=u.useMemo(()=>{const s=new Map;for(const e of f){const m=s.get(e.date);m?(m.count+=e.count,m.successes+=Math.round(e.count*e.success_rate)):s.set(e.date,{date:e.date,count:e.count,successes:Math.round(e.count*e.success_rate)})}return Array.from(s.values()).sort((e,m)=>e.date.localeCompare(m.date)).map(e=>({date:e.date.slice(5),count:e.count,successRate:e.count>0?Math.round(e.successes/e.count*100):0}))},[f]),h=u.useMemo(()=>r?.top_tools?r.top_tools.slice(0,10).map(s=>({...s,shortName:s.tool_name.replace(/^smem_/,"")})):[],[r]);return t.jsxs("div",{className:"space-y-6 p-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"font-display text-2xl font-bold",children:a("toolStats.title")}),t.jsx("div",{className:"flex gap-1",children:O.map(s=>t.jsxs(R,{variant:o===s?"default":"outline",size:"sm",onClick:()=>C(s),className:"cursor-pointer",children:[s,"d"]},s))})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.totalEvents")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-24"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:(r?.total_events??0).toLocaleString()})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.successRate")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-20"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:_(r?.success_rate??0)})})]}),t.jsxs(l,{children:[t.jsx(c,{className:"pb-2",children:t.jsx(d,{className:"text-sm font-medium text-muted-foreground",children:a("toolStats.uniqueTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-8 w-16"}):t.jsx("p",{className:"font-mono text-2xl font-bold",children:r?.top_tools?.length??0})})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.topTools")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):h.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:Math.max(h.length*36,200),children:t.jsxs(D,{data:h,layout:"vertical",margin:{left:80,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{type:"number"}),t.jsx(y,{type:"category",dataKey:"shortName",tick:{fontSize:12},width:80}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(M,{dataKey:"count",radius:[0,4,4,0],children:h.map((s,e)=>t.jsx(B,{fill:v[e%v.length]},e))})]})})})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.usageOverTime")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-72 w-full"}):p.length===0?t.jsx("p",{className:"py-12 text-center text-sm text-muted-foreground",children:a("toolStats.noData")}):t.jsx(g,{width:"100%",height:300,children:t.jsxs(L,{data:p,margin:{left:10,right:20},children:[t.jsx(N,{strokeDasharray:"3 3",opacity:.1}),t.jsx(b,{dataKey:"date",tick:{fontSize:11}}),t.jsx(y,{tick:{fontSize:11}}),t.jsx(S,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),t.jsx(A,{type:"monotone",dataKey:"count",stroke:"#6366f1",strokeWidth:2,dot:!1,name:a("toolStats.calls")})]})})})]})]}),t.jsxs(l,{children:[t.jsx(c,{children:t.jsx(d,{className:"text-base",children:a("toolStats.detailTable")})}),t.jsx(i,{children:n?t.jsx(x,{className:"h-48 w-full"}):r?.top_tools?.length?t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.tool")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.calls")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.successRate")}),t.jsx("th",{className:"pb-3 font-medium text-right",children:a("toolStats.avgDuration")}),t.jsx("th",{className:"pb-3 font-medium",children:a("toolStats.server")})]})}),t.jsx("tbody",{children:r.top_tools.map(s=>t.jsxs("tr",{className:"border-b border-border/50",children:[t.jsx("td",{className:"py-2.5 font-mono text-xs",children:s.tool_name}),t.jsx("td",{className:"py-2.5 text-right font-mono",children:s.count}),t.jsx("td",{className:"py-2.5 text-right",children:t.jsx(k,{variant:E(s.success_rate),children:_(s.success_rate)})}),t.jsx("td",{className:"py-2.5 text-right font-mono text-xs text-muted-foreground",children:z(s.avg_duration_ms)}),t.jsx("td",{className:"py-2.5 text-xs text-muted-foreground",children:s.server_name||"—"})]},s.tool_name))})]})}):t.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:a("toolStats.noData")})})]})]})}export{H as default}; diff --git a/src/surreal_memory/server/static/dist/assets/VisualizePage-B_IPrBGU.js b/src/surreal_memory/server/static/dist/assets/VisualizePage-D-CKRU7v.js similarity index 94% rename from src/surreal_memory/server/static/dist/assets/VisualizePage-B_IPrBGU.js rename to src/surreal_memory/server/static/dist/assets/VisualizePage-D-CKRU7v.js index e7b4d7c2..395e1aed 100644 --- a/src/surreal_memory/server/static/dist/assets/VisualizePage-B_IPrBGU.js +++ b/src/surreal_memory/server/static/dist/assets/VisualizePage-D-CKRU7v.js @@ -1,2 +1,2 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/embed-gLOWnRXV.js","assets/vendor-recharts-BkwZfCWA.js","assets/vendor-react-BfuodpLv.js","assets/vendor-ui-Qm4_4bAc.js","assets/timer-DWAvo6M8.js"])))=>i.map(i=>d[i]); -import{j as r}from"./vendor-query-CqA1cBNl.js";import{P as _}from"./ProGate-CwBF4etn.js";import{u,z as b,_ as y,B as N}from"./index-C26pxqlr.js";import{r as n}from"./vendor-react-BfuodpLv.js";import{C as z,a as w,b as C,c as k}from"./card-B0vNsxr_.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({query:s="",chartType:m,format:p="vega_lite",limit:x=20,compact:f=!1}){const{t:l}=u(),a=n.useRef(null),i=b(),[o,h]=n.useState(s),[e,g]=n.useState(null),d=()=>{o.trim()&&i.mutate({query:o.trim(),chart_type:m,format:p,limit:x},{onSuccess:t=>g(t)})};n.useEffect(()=>{if(!e?.vega_lite||!a.current)return;let t=!1;return y(()=>import("./embed-gLOWnRXV.js"),__vite__mapDeps([0,1,2,3,4])).then(v=>{t||!a.current||v.default(a.current,e.vega_lite,{actions:{export:!0,source:!1,compiled:!1,editor:!1},theme:document.documentElement.classList.contains("dark")?"dark":void 0,renderer:"svg"}).catch(j=>console.error("Vega render error:",j))}),()=>{t=!0}},[e?.vega_lite]);const c=r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:o,onChange:t=>h(t.target.value),onKeyDown:t=>t.key==="Enter"&&d(),placeholder:l("commandPalette.placeholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring","aria-label":"Chart query"}),r.jsx(N,{size:"sm",onClick:d,disabled:i.isPending||!o.trim(),className:"cursor-pointer",children:i.isPending?l("common.loading"):"Visualize"})]}),e&&r.jsxs("div",{className:"space-y-2",children:[e.vega_lite&&r.jsx("div",{ref:a,className:"w-full min-h-[200px] rounded-md border border-border bg-background p-2"}),e.markdown&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.markdown}),e.ascii&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.ascii}),e.message&&!e.vega_lite&&!e.markdown&&!e.ascii&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.message}),e.memories&&e.memories.length>0&&r.jsx("div",{className:"space-y-1",children:e.memories.map(t=>r.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[r.jsxs("span",{className:"font-mono text-[10px] opacity-50",children:["[",t.type,"]"]})," ",t.content]},t.id))}),e.data_points_count!=null&&e.data_points_count>0&&r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.data_points_count," data points · ",e.chart_type]})]})]});return f?c:r.jsxs(z,{children:[r.jsx(w,{children:r.jsx(C,{className:"text-sm",children:"Memory Visualizer"})}),r.jsx(k,{children:c})]})}function D(){const{t:s}=u();return r.jsx(_,{label:s("license.pro_feature","Pro Feature"),children:r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-display text-2xl font-bold",children:s("visualize.title","Memory Visualizer")}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("visualize.description","Query your memories and generate charts from stored data.")})]}),r.jsx(P,{})]})})}export{D as default}; +import{j as r}from"./vendor-query-CqA1cBNl.js";import{P as _}from"./ProGate-37WFbaAW.js";import{u,z as b,_ as y,B as N}from"./index-DzyKsRxc.js";import{r as n}from"./vendor-react-BfuodpLv.js";import{C as z,a as w,b as C,c as k}from"./card-CB2KYkrP.js";import"./vendor-icons-BYlYobEK.js";import"./vendor-ui-Qm4_4bAc.js";import"./vendor-recharts-BkwZfCWA.js";function P({query:s="",chartType:m,format:p="vega_lite",limit:x=20,compact:f=!1}){const{t:l}=u(),a=n.useRef(null),i=b(),[o,h]=n.useState(s),[e,g]=n.useState(null),d=()=>{o.trim()&&i.mutate({query:o.trim(),chart_type:m,format:p,limit:x},{onSuccess:t=>g(t)})};n.useEffect(()=>{if(!e?.vega_lite||!a.current)return;let t=!1;return y(()=>import("./embed-gLOWnRXV.js"),__vite__mapDeps([0,1,2,3,4])).then(v=>{t||!a.current||v.default(a.current,e.vega_lite,{actions:{export:!0,source:!1,compiled:!1,editor:!1},theme:document.documentElement.classList.contains("dark")?"dark":void 0,renderer:"svg"}).catch(j=>console.error("Vega render error:",j))}),()=>{t=!0}},[e?.vega_lite]);const c=r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:o,onChange:t=>h(t.target.value),onKeyDown:t=>t.key==="Enter"&&d(),placeholder:l("commandPalette.placeholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring","aria-label":"Chart query"}),r.jsx(N,{size:"sm",onClick:d,disabled:i.isPending||!o.trim(),className:"cursor-pointer",children:i.isPending?l("common.loading"):"Visualize"})]}),e&&r.jsxs("div",{className:"space-y-2",children:[e.vega_lite&&r.jsx("div",{ref:a,className:"w-full min-h-[200px] rounded-md border border-border bg-background p-2"}),e.markdown&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre-wrap rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.markdown}),e.ascii&&!e.vega_lite&&r.jsx("pre",{className:"whitespace-pre rounded-md border border-border bg-muted p-3 text-xs font-mono overflow-x-auto",children:e.ascii}),e.message&&!e.vega_lite&&!e.markdown&&!e.ascii&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.message}),e.memories&&e.memories.length>0&&r.jsx("div",{className:"space-y-1",children:e.memories.map(t=>r.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[r.jsxs("span",{className:"font-mono text-[10px] opacity-50",children:["[",t.type,"]"]})," ",t.content]},t.id))}),e.data_points_count!=null&&e.data_points_count>0&&r.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[e.data_points_count," data points · ",e.chart_type]})]})]});return f?c:r.jsxs(z,{children:[r.jsx(w,{children:r.jsx(C,{className:"text-sm",children:"Memory Visualizer"})}),r.jsx(k,{children:c})]})}function D(){const{t:s}=u();return r.jsx(_,{label:s("license.pro_feature","Pro Feature"),children:r.jsxs("div",{className:"space-y-6 p-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-display text-2xl font-bold",children:s("visualize.title","Memory Visualizer")}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("visualize.description","Query your memories and generate charts from stored data.")})]}),r.jsx(P,{})]})})}export{D as default}; diff --git a/src/surreal_memory/server/static/dist/assets/card-B0vNsxr_.js b/src/surreal_memory/server/static/dist/assets/card-CB2KYkrP.js similarity index 86% rename from src/surreal_memory/server/static/dist/assets/card-B0vNsxr_.js rename to src/surreal_memory/server/static/dist/assets/card-CB2KYkrP.js index 07d7715a..35ac539f 100644 --- a/src/surreal_memory/server/static/dist/assets/card-B0vNsxr_.js +++ b/src/surreal_memory/server/static/dist/assets/card-CB2KYkrP.js @@ -1 +1 @@ -import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{A as o}from"./index-C26pxqlr.js";const t=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("rounded-xl border border-border bg-card text-card-foreground shadow-sm",a),...r}));t.displayName="Card";const i=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));i.displayName="CardHeader";const n=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("font-display text-lg font-semibold leading-none tracking-tight",a),...r}));n.displayName="CardTitle";const m=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("text-sm text-muted-foreground",a),...r}));m.displayName="CardDescription";const c=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));c.displayName="CardContent";export{t as C,i as a,n as b,c}; +import{j as s}from"./vendor-query-CqA1cBNl.js";import{r as d}from"./vendor-react-BfuodpLv.js";import{A as o}from"./index-DzyKsRxc.js";const t=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("rounded-xl border border-border bg-card text-card-foreground shadow-sm",a),...r}));t.displayName="Card";const i=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("flex flex-col space-y-1.5 p-6",a),...r}));i.displayName="CardHeader";const n=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("font-display text-lg font-semibold leading-none tracking-tight",a),...r}));n.displayName="CardTitle";const m=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("text-sm text-muted-foreground",a),...r}));m.displayName="CardDescription";const c=d.forwardRef(({className:a,...r},e)=>s.jsx("div",{ref:e,className:o("p-6 pt-0",a),...r}));c.displayName="CardContent";export{t as C,i as a,n as b,c}; diff --git a/src/surreal_memory/server/static/dist/assets/index-BFkJgtCN.css b/src/surreal_memory/server/static/dist/assets/index-BFkJgtCN.css deleted file mode 100644 index ff06cd16..00000000 --- a/src/surreal_memory/server/static/dist/assets/index-BFkJgtCN.css +++ /dev/null @@ -1 +0,0 @@ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-divide-x-reverse:0}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-900:oklch(38.6% .063 188.416);--color-teal-950:oklch(27.7% .046 192.524);--color-cyan-900:oklch(39.8% .07 227.392);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-stone-900:oklch(21.6% .006 56.043);--color-stone-950:oklch(14.7% .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:#faf8f3;--color-foreground:#1a1714;--color-card:#f5f0ea;--color-card-foreground:#1a1714;--color-primary:#6366f1;--color-primary-foreground:#fff;--color-secondary:#ede5d8;--color-secondary-foreground:#1a1714;--color-muted:#ede5d8;--color-muted-foreground:#78716c;--color-accent:#e8e0d4;--color-accent-foreground:#1a1714;--color-destructive:#dc2626;--color-destructive-foreground:#fff;--color-border:#d4ccc2;--color-input:#d4ccc2;--color-ring:#6366f1;--color-health-good:#059669;--color-health-warn:#f59e0b;--color-chart-1:#6366f1;--color-chart-2:#8b5cf6;--color-chart-3:#06b6d4;--color-chart-4:#f59e0b;--color-chart-5:#059669;--font-display:"Space Grotesk", ui-sans-serif, system-ui, sans-serif;--transition-normal:.25s ease;--color-sidebar:#f0ebe4;--color-sidebar-foreground:#1a1714;--color-sidebar-border:#d4ccc2;--color-sidebar-accent:#e8e0d4;--color-sidebar-primary:#6366f1}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-12{bottom:calc(var(--spacing) * 12)}.left-0{left:calc(var(--spacing) * 0)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-16{margin-left:calc(var(--spacing) * 16)}.ml-56{margin-left:calc(var(--spacing) * 56)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-28{height:calc(var(--spacing) * 28)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-\[340px\]{height:340px}.h-\[calc\(100vh-3\.5rem\)\]{height:calc(100vh - 3.5rem)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[200px\]{min-height:200px}.min-h-\[500px\]{min-height:500px}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[240px\]{width:240px}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.\!border-border{border-color:var(--color-border)!important}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-border{border-color:var(--color-border)}.border-border\/50{border-color:#d4ccc280}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--color-border) 50%,transparent)}}.border-destructive\/30{border-color:#dc26264d}@supports (color:color-mix(in lab,red,red)){.border-destructive\/30{border-color:color-mix(in oklab,var(--color-destructive) 30%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500) 30%,transparent)}}.border-input{border-color:var(--color-input)}.border-muted-foreground{border-color:var(--color-muted-foreground)}.border-primary{border-color:var(--color-primary)}.border-primary\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.border-primary\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,var(--color-primary) 30%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-sidebar-border{border-color:var(--color-sidebar-border)}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-card{background-color:var(--color-card)!important}.\!bg-transparent{background-color:#0000!important}.bg-\[\#16140f\]{background-color:#16140f}.bg-accent{background-color:var(--color-accent)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-background\/80{background-color:#faf8f3cc}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,var(--color-background) 80%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-card{background-color:var(--color-card)}.bg-card\/90{background-color:#f5f0eae6}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,var(--color-card) 90%,transparent)}}.bg-destructive{background-color:var(--color-destructive)}.bg-destructive\/5{background-color:#dc26260d}@supports (color:color-mix(in lab,red,red)){.bg-destructive\/5{background-color:color-mix(in oklab,var(--color-destructive) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/5{background-color:#00c7580d}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/5{background-color:color-mix(in oklab,var(--color-green-500) 5%,transparent)}}.bg-health-good\/10{background-color:#0596691a}@supports (color:color-mix(in lab,red,red)){.bg-health-good\/10{background-color:color-mix(in oklab,var(--color-health-good) 10%,transparent)}}.bg-health-warn\/10{background-color:#f59e0b1a}@supports (color:color-mix(in lab,red,red)){.bg-health-warn\/10{background-color:color-mix(in oklab,var(--color-health-warn) 10%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted\/20{background-color:#ede5d833}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,var(--color-muted) 20%,transparent)}}.bg-muted\/30{background-color:#ede5d84d}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,var(--color-muted) 30%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-primary{background-color:var(--color-primary)}.bg-primary\/5{background-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,var(--color-primary) 5%,transparent)}}.bg-primary\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,var(--color-primary) 15%,transparent)}}.bg-primary\/90{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.bg-primary\/90{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:var(--color-secondary)}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar-accent{background-color:var(--color-sidebar-accent)}.bg-transparent{background-color:#0000}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-900\/40{--tw-gradient-from:#7b330666}@supports (color:color-mix(in lab,red,red)){.from-amber-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-amber-900) 40%, transparent)}}.from-amber-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-900\/40{--tw-gradient-from:#1c398e66}@supports (color:color-mix(in lab,red,red)){.from-blue-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-blue-900) 40%, transparent)}}.from-blue-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-900\/40{--tw-gradient-from:#104e6466}@supports (color:color-mix(in lab,red,red)){.from-cyan-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-900) 40%, transparent)}}.from-cyan-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-900\/40{--tw-gradient-from:#004e3b66}@supports (color:color-mix(in lab,red,red)){.from-emerald-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-900) 40%, transparent)}}.from-emerald-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/5{--tw-gradient-from:#6366f10d}@supports (color:color-mix(in lab,red,red)){.from-primary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.from-primary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-900\/40{--tw-gradient-from:#82181a66}@supports (color:color-mix(in lab,red,red)){.from-red-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-red-900) 40%, transparent)}}.from-red-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-900\/40{--tw-gradient-from:#8b083666}@supports (color:color-mix(in lab,red,red)){.from-rose-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-rose-900) 40%, transparent)}}.from-rose-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-900\/40{--tw-gradient-from:#1c191766}@supports (color:color-mix(in lab,red,red)){.from-stone-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-stone-900) 40%, transparent)}}.from-stone-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-900\/40{--tw-gradient-from:#0b4f4a66}@supports (color:color-mix(in lab,red,red)){.from-teal-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-teal-900) 40%, transparent)}}.from-teal-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-900\/40{--tw-gradient-from:#4d179a66}@supports (color:color-mix(in lab,red,red)){.from-violet-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-900) 40%, transparent)}}.from-violet-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-950\/60{--tw-gradient-to:#46190199}@supports (color:color-mix(in lab,red,red)){.to-amber-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-amber-950) 60%, transparent)}}.to-amber-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-950\/60{--tw-gradient-to:#16245699}@supports (color:color-mix(in lab,red,red)){.to-blue-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-blue-950) 60%, transparent)}}.to-blue-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-950\/60{--tw-gradient-to:#05334599}@supports (color:color-mix(in lab,red,red)){.to-cyan-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-950) 60%, transparent)}}.to-cyan-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-950\/60{--tw-gradient-to:#002c2299}@supports (color:color-mix(in lab,red,red)){.to-emerald-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-950) 60%, transparent)}}.to-emerald-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-950\/60{--tw-gradient-to:#44130699}@supports (color:color-mix(in lab,red,red)){.to-orange-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-orange-950) 60%, transparent)}}.to-orange-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/10{--tw-gradient-to:#6366f11a}@supports (color:color-mix(in lab,red,red)){.to-primary\/10{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.to-primary\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-950\/60{--tw-gradient-to:#46080999}@supports (color:color-mix(in lab,red,red)){.to-red-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-red-950) 60%, transparent)}}.to-red-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-950\/60{--tw-gradient-to:#4d021899}@supports (color:color-mix(in lab,red,red)){.to-rose-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-rose-950) 60%, transparent)}}.to-rose-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-950\/60{--tw-gradient-to:#0c0a0999}@supports (color:color-mix(in lab,red,red)){.to-stone-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-stone-950) 60%, transparent)}}.to-stone-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-950\/60{--tw-gradient-to:#022f2e99}@supports (color:color-mix(in lab,red,red)){.to-teal-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-teal-950) 60%, transparent)}}.to-teal-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-950\/60{--tw-gradient-to:#2f0d6899}@supports (color:color-mix(in lab,red,red)){.to-violet-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-violet-950) 60%, transparent)}}.to-violet-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[15vh\]{padding-top:15vh}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-display{font-family:var(--font-display)}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-card-foreground{color:var(--color-card-foreground)}.text-destructive{color:var(--color-destructive)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--color-foreground)}.text-foreground\/80{color:#1a1714cc}@supports (color:color-mix(in lab,red,red)){.text-foreground\/80{color:color-mix(in oklab,var(--color-foreground) 80%,transparent)}}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-health-good{color:var(--color-health-good)}.text-health-warn{color:var(--color-health-warn)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-muted-foreground\/40{color:#78716c66}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,var(--color-muted-foreground) 40%,transparent)}}.text-muted-foreground\/70{color:#78716cb3}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,var(--color-muted-foreground) 70%,transparent)}}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-sidebar-foreground{color:var(--color-sidebar-foreground)}.text-sidebar-foreground\/50{color:#1a171480}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/50{color:color-mix(in oklab,var(--color-sidebar-foreground) 50%,transparent)}}.text-sidebar-foreground\/70{color:#1a1714b3}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--color-sidebar-foreground) 70%,transparent)}}.text-sidebar-primary{color:var(--color-sidebar-primary)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.text-yellow-500{color:var(--color-yellow-500)}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--color-primary)}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.\!shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-primary{--tw-ring-color:var(--color-primary)}.ring-primary\/30{--tw-ring-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.ring-primary\/30{--tw-ring-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.ring-white\/5{--tw-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.ring-white\/5{--tw-ring-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-\[var\(--transition-normal\)\]{--tw-duration:var(--transition-normal);transition-duration:var(--transition-normal)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:bg-primary:is(:where(.group):hover *){background-color:var(--color-primary)}.group-hover\:text-foreground:is(:where(.group):hover *){color:var(--color-foreground)}}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}.backdrop\:bg-black\/50::backdrop{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/50::backdrop{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.first\:pt-0:first-child{padding-top:calc(var(--spacing) * 0)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:border-primary\/40:hover{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,var(--color-primary) 40%,transparent)}}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-accent\/30:hover{background-color:#e8e0d44d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/30:hover{background-color:color-mix(in oklab,var(--color-accent) 30%,transparent)}}.hover\:bg-accent\/50:hover{background-color:#e8e0d480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:#dc2626e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-primary:hover{background-color:var(--color-primary)}.hover\:bg-primary\/90:hover{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ede5d8cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--color-sidebar-accent)}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:text-destructive:hover{color:var(--color-destructive)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-primary-foreground:hover{color:var(--color-primary-foreground)}.hover\:text-primary\/80:hover{color:#6366f1cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,var(--color-primary) 80%,transparent)}}.hover\:text-sidebar-foreground:hover{color:var(--color-sidebar-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-ring:focus{outline-color:var(--color-ring)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--color-ring)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--color-accent)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:pr-4{padding-right:calc(var(--spacing) * 4)}.sm\:pl-4{padding-left:calc(var(--spacing) * 4)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>button\]\:\!border-border>button{border-color:var(--color-border)!important}.\[\&\>button\]\:\!bg-card>button{background-color:var(--color-card)!important}.\[\&\>button\]\:\!fill-foreground>button{fill:var(--color-foreground)!important}}:root.dark{--color-background:#0c0b09;--color-foreground:#f5f0ea;--color-card:#16140f;--color-card-foreground:#f0ebe4;--color-popover:#1a1814;--color-popover-foreground:#f5f0ea;--color-primary:#818cf8;--color-primary-foreground:#0c0b09;--color-secondary:#1e1b16;--color-secondary-foreground:#f5f0ea;--color-muted:#1e1b16;--color-muted-foreground:#a8a29e;--color-accent:#292520;--color-accent-foreground:#f5f0ea;--color-destructive:#ef4444;--color-destructive-foreground:#fff;--color-border:#2e2a24;--color-input:#342f28;--color-ring:#818cf8;--color-health-good:#34d399;--color-health-warn:#fbbf24;--color-health-bad:#f87171;--shadow-sm:0 1px 3px #0006, 0 1px 2px #0000004d;--shadow-md:0 4px 12px #00000080, 0 2px 4px #00000059;--shadow-lg:0 12px 28px #0000008c, 0 4px 8px #0006;--color-sidebar:#0e0d0a;--color-sidebar-foreground:#f5f0ea;--color-sidebar-border:#2e2a24;--color-sidebar-accent:#1e1b16;--color-sidebar-accent-foreground:#f5f0ea;--color-sidebar-primary:#818cf8;--color-sidebar-primary-foreground:#0c0b09;--color-sidebar-ring:#818cf8}body{font-family:var(--font-sans);background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.font-display{font-family:var(--font-display)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:9999px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted-foreground)}.dark .border{border-color:#ffffff0f}.dark .rounded-xl{background-image:linear-gradient(#ffffff06,#0000 50%);box-shadow:0 0 0 1px #ffffff0a,0 2px 8px #0006}.dark aside{box-shadow:1px 0 12px #00000080}.dark header{box-shadow:0 1px 8px #0006}:focus-visible{outline:2px solid var(--color-ring);outline-offset:2px}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/surreal_memory/server/static/dist/assets/index-CWIfFh7B.css b/src/surreal_memory/server/static/dist/assets/index-CWIfFh7B.css new file mode 100644 index 00000000..6eb81718 --- /dev/null +++ b/src/surreal_memory/server/static/dist/assets/index-CWIfFh7B.css @@ -0,0 +1 @@ +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-divide-x-reverse:0}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-950:oklch(26.6% .079 36.259);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-amber-950:oklch(27.9% .077 45.635);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-900:oklch(37.8% .077 168.94);--color-emerald-950:oklch(26.2% .051 172.552);--color-teal-900:oklch(38.6% .063 188.416);--color-teal-950:oklch(27.7% .046 192.524);--color-cyan-900:oklch(39.8% .07 227.392);--color-cyan-950:oklch(30.2% .056 229.695);--color-blue-900:oklch(37.9% .146 265.522);--color-blue-950:oklch(28.2% .091 267.935);--color-violet-900:oklch(38% .189 293.745);--color-violet-950:oklch(28.3% .141 291.089);--color-rose-900:oklch(41% .159 10.272);--color-rose-950:oklch(27.1% .105 12.094);--color-stone-900:oklch(21.6% .006 56.043);--color-stone-950:oklch(14.7% .004 49.25);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-7xl:4.5rem;--text-7xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:#faf8f3;--color-foreground:#1a1714;--color-card:#f5f0ea;--color-card-foreground:#1a1714;--color-primary:#6366f1;--color-primary-foreground:#fff;--color-secondary:#ede5d8;--color-secondary-foreground:#1a1714;--color-muted:#ede5d8;--color-muted-foreground:#78716c;--color-accent:#e8e0d4;--color-accent-foreground:#1a1714;--color-destructive:#dc2626;--color-destructive-foreground:#fff;--color-border:#d4ccc2;--color-input:#d4ccc2;--color-ring:#6366f1;--color-health-good:#059669;--color-health-warn:#f59e0b;--color-chart-1:#6366f1;--color-chart-2:#8b5cf6;--color-chart-3:#06b6d4;--color-chart-4:#f59e0b;--color-chart-5:#059669;--font-display:"Space Grotesk", ui-sans-serif, system-ui, sans-serif;--transition-normal:.25s ease;--color-sidebar:#f0ebe4;--color-sidebar-foreground:#1a1714;--color-sidebar-border:#d4ccc2;--color-sidebar-accent:#e8e0d4;--color-sidebar-primary:#6366f1}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-3{top:calc(var(--spacing) * 3)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.bottom-12{bottom:calc(var(--spacing) * 12)}.left-0{left:calc(var(--spacing) * 0)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.m-auto{margin:auto}.mx-auto{margin-inline:auto}.my-4{margin-block:calc(var(--spacing) * 4)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-auto{margin-bottom:auto}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-6{margin-left:calc(var(--spacing) * 6)}.ml-16{margin-left:calc(var(--spacing) * 16)}.ml-56{margin-left:calc(var(--spacing) * 56)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.size-16{width:calc(var(--spacing) * 16);height:calc(var(--spacing) * 16)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-28{height:calc(var(--spacing) * 28)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-80{height:calc(var(--spacing) * 80)}.h-\[340px\]{height:340px}.h-\[calc\(100vh-3\.5rem\)\]{height:calc(100vh - 3.5rem)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-96{max-height:calc(var(--spacing) * 96)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-\[200px\]{min-height:200px}.min-h-\[500px\]{min-height:500px}.w-3\/4{width:75%}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-32{width:calc(var(--spacing) * 32)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-\[240px\]{width:240px}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[200px\]{max-width:200px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-105{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.\!border-0{border-style:var(--tw-border-style)!important;border-width:0!important}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.\!border-border{border-color:var(--color-border)!important}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-border{border-color:var(--color-border)}.border-border\/50{border-color:#d4ccc280}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,var(--color-border) 50%,transparent)}}.border-input{border-color:var(--color-input)}.border-muted-foreground{border-color:var(--color-muted-foreground)}.border-primary{border-color:var(--color-primary)}.border-primary\/20{border-color:#6366f133}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,var(--color-primary) 20%,transparent)}}.border-primary\/30{border-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,var(--color-primary) 30%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-sidebar-border{border-color:var(--color-sidebar-border)}.border-transparent{border-color:#0000}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white) 10%,transparent)}}.border-t-transparent{border-top-color:#0000}.\!bg-card{background-color:var(--color-card)!important}.\!bg-transparent{background-color:#0000!important}.bg-\[\#16140f\]{background-color:#16140f}.bg-accent{background-color:var(--color-accent)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-background\/80{background-color:#faf8f3cc}@supports (color:color-mix(in lab,red,red)){.bg-background\/80{background-color:color-mix(in oklab,var(--color-background) 80%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-card{background-color:var(--color-card)}.bg-card\/90{background-color:#f5f0eae6}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,var(--color-card) 90%,transparent)}}.bg-destructive{background-color:var(--color-destructive)}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-health-good\/10{background-color:#0596691a}@supports (color:color-mix(in lab,red,red)){.bg-health-good\/10{background-color:color-mix(in oklab,var(--color-health-good) 10%,transparent)}}.bg-health-warn\/10{background-color:#f59e0b1a}@supports (color:color-mix(in lab,red,red)){.bg-health-warn\/10{background-color:color-mix(in oklab,var(--color-health-warn) 10%,transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted\/20{background-color:#ede5d833}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,var(--color-muted) 20%,transparent)}}.bg-muted\/30{background-color:#ede5d84d}@supports (color:color-mix(in lab,red,red)){.bg-muted\/30{background-color:color-mix(in oklab,var(--color-muted) 30%,transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-primary{background-color:var(--color-primary)}.bg-primary\/5{background-color:#6366f10d}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,var(--color-primary) 5%,transparent)}}.bg-primary\/10{background-color:#6366f11a}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,var(--color-primary) 10%,transparent)}}.bg-primary\/15{background-color:#6366f126}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,var(--color-primary) 15%,transparent)}}.bg-primary\/90{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.bg-primary\/90{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-secondary{background-color:var(--color-secondary)}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar-accent{background-color:var(--color-sidebar-accent)}.bg-transparent{background-color:#0000}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-900\/40{--tw-gradient-from:#7b330666}@supports (color:color-mix(in lab,red,red)){.from-amber-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-amber-900) 40%, transparent)}}.from-amber-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-blue-900\/40{--tw-gradient-from:#1c398e66}@supports (color:color-mix(in lab,red,red)){.from-blue-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-blue-900) 40%, transparent)}}.from-blue-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-900\/40{--tw-gradient-from:#104e6466}@supports (color:color-mix(in lab,red,red)){.from-cyan-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-900) 40%, transparent)}}.from-cyan-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-900\/40{--tw-gradient-from:#004e3b66}@supports (color:color-mix(in lab,red,red)){.from-emerald-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-900) 40%, transparent)}}.from-emerald-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-primary\/5{--tw-gradient-from:#6366f10d}@supports (color:color-mix(in lab,red,red)){.from-primary\/5{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 5%, transparent)}}.from-primary\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-red-900\/40{--tw-gradient-from:#82181a66}@supports (color:color-mix(in lab,red,red)){.from-red-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-red-900) 40%, transparent)}}.from-red-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-900\/40{--tw-gradient-from:#8b083666}@supports (color:color-mix(in lab,red,red)){.from-rose-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-rose-900) 40%, transparent)}}.from-rose-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-stone-900\/40{--tw-gradient-from:#1c191766}@supports (color:color-mix(in lab,red,red)){.from-stone-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-stone-900) 40%, transparent)}}.from-stone-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-900\/40{--tw-gradient-from:#0b4f4a66}@supports (color:color-mix(in lab,red,red)){.from-teal-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-teal-900) 40%, transparent)}}.from-teal-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-900\/40{--tw-gradient-from:#4d179a66}@supports (color:color-mix(in lab,red,red)){.from-violet-900\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-900) 40%, transparent)}}.from-violet-900\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-amber-950\/60{--tw-gradient-to:#46190199}@supports (color:color-mix(in lab,red,red)){.to-amber-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-amber-950) 60%, transparent)}}.to-amber-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-blue-950\/60{--tw-gradient-to:#16245699}@supports (color:color-mix(in lab,red,red)){.to-blue-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-blue-950) 60%, transparent)}}.to-blue-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-cyan-950\/60{--tw-gradient-to:#05334599}@supports (color:color-mix(in lab,red,red)){.to-cyan-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-cyan-950) 60%, transparent)}}.to-cyan-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-950\/60{--tw-gradient-to:#002c2299}@supports (color:color-mix(in lab,red,red)){.to-emerald-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-950) 60%, transparent)}}.to-emerald-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-orange-950\/60{--tw-gradient-to:#44130699}@supports (color:color-mix(in lab,red,red)){.to-orange-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-orange-950) 60%, transparent)}}.to-orange-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary\/10{--tw-gradient-to:#6366f11a}@supports (color:color-mix(in lab,red,red)){.to-primary\/10{--tw-gradient-to:color-mix(in oklab, var(--color-primary) 10%, transparent)}}.to-primary\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-red-950\/60{--tw-gradient-to:#46080999}@supports (color:color-mix(in lab,red,red)){.to-red-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-red-950) 60%, transparent)}}.to-red-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-rose-950\/60{--tw-gradient-to:#4d021899}@supports (color:color-mix(in lab,red,red)){.to-rose-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-rose-950) 60%, transparent)}}.to-rose-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-stone-950\/60{--tw-gradient-to:#0c0a0999}@supports (color:color-mix(in lab,red,red)){.to-stone-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-stone-950) 60%, transparent)}}.to-stone-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-teal-950\/60{--tw-gradient-to:#022f2e99}@supports (color:color-mix(in lab,red,red)){.to-teal-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-teal-950) 60%, transparent)}}.to-teal-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-violet-950\/60{--tw-gradient-to:#2f0d6899}@supports (color:color-mix(in lab,red,red)){.to-violet-950\/60{--tw-gradient-to:color-mix(in oklab, var(--color-violet-950) 60%, transparent)}}.to-violet-950\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[15vh\]{padding-top:15vh}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-6{padding-left:calc(var(--spacing) * 6)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-display{font-family:var(--font-display)}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-7xl{font-size:var(--text-7xl);line-height:var(--tw-leading,var(--text-7xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-card-foreground{color:var(--color-card-foreground)}.text-destructive{color:var(--color-destructive)}.text-destructive-foreground{color:var(--color-destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--color-foreground)}.text-foreground\/80{color:#1a1714cc}@supports (color:color-mix(in lab,red,red)){.text-foreground\/80{color:color-mix(in oklab,var(--color-foreground) 80%,transparent)}}.text-green-400{color:var(--color-green-400)}.text-green-500{color:var(--color-green-500)}.text-health-good{color:var(--color-health-good)}.text-health-warn{color:var(--color-health-warn)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-muted-foreground\/40{color:#78716c66}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,var(--color-muted-foreground) 40%,transparent)}}.text-muted-foreground\/70{color:#78716cb3}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,var(--color-muted-foreground) 70%,transparent)}}.text-primary{color:var(--color-primary)}.text-primary-foreground{color:var(--color-primary-foreground)}.text-red-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--color-secondary-foreground)}.text-sidebar-foreground{color:var(--color-sidebar-foreground)}.text-sidebar-foreground\/50{color:#1a171480}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/50{color:color-mix(in oklab,var(--color-sidebar-foreground) 50%,transparent)}}.text-sidebar-foreground\/70{color:#1a1714b3}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/70{color:color-mix(in oklab,var(--color-sidebar-foreground) 70%,transparent)}}.text-sidebar-primary{color:var(--color-sidebar-primary)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white) 40%,transparent)}}.text-white\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\/50{color:color-mix(in oklab,var(--color-white) 50%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white) 80%,transparent)}}.capitalize{text-transform:capitalize}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--color-primary)}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.\!shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-primary{--tw-ring-color:var(--color-primary)}.ring-primary\/30{--tw-ring-color:#6366f14d}@supports (color:color-mix(in lab,red,red)){.ring-primary\/30{--tw-ring-color:color-mix(in oklab, var(--color-primary) 30%, transparent)}}.ring-white\/5{--tw-ring-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.ring-white\/5{--tw-ring-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.ring-offset-2{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-background{--tw-ring-offset-color:var(--color-background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-700{--tw-duration:.7s;transition-duration:.7s}.duration-\[var\(--transition-normal\)\]{--tw-duration:var(--transition-normal);transition-duration:var(--transition-normal)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:bg-primary:is(:where(.group):hover *){background-color:var(--color-primary)}.group-hover\:text-foreground:is(:where(.group):hover *){color:var(--color-foreground)}}.placeholder\:text-muted-foreground::placeholder{color:var(--color-muted-foreground)}.backdrop\:bg-black\/50::backdrop{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.backdrop\:bg-black\/50::backdrop{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.first\:pt-0:first-child{padding-top:calc(var(--spacing) * 0)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}.last\:pb-0:last-child{padding-bottom:calc(var(--spacing) * 0)}@media(hover:hover){.hover\:border-primary\/40:hover{border-color:#6366f166}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,var(--color-primary) 40%,transparent)}}.hover\:bg-accent:hover{background-color:var(--color-accent)}.hover\:bg-accent\/30:hover{background-color:#e8e0d44d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/30:hover{background-color:color-mix(in oklab,var(--color-accent) 30%,transparent)}}.hover\:bg-accent\/50:hover{background-color:#e8e0d480}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--color-accent) 50%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:#dc2626e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--color-destructive) 90%,transparent)}}.hover\:bg-primary:hover{background-color:var(--color-primary)}.hover\:bg-primary\/90:hover{background-color:#6366f1e6}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--color-primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:#ede5d8cc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--color-secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--color-sidebar-accent)}.hover\:text-accent-foreground:hover{color:var(--color-accent-foreground)}.hover\:text-destructive:hover{color:var(--color-destructive)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-primary-foreground:hover{color:var(--color-primary-foreground)}.hover\:text-primary\/80:hover{color:#6366f1cc}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,var(--color-primary) 80%,transparent)}}.hover\:text-sidebar-foreground:hover{color:var(--color-sidebar-foreground)}.hover\:underline:hover{text-decoration-line:underline}.hover\:shadow-md:hover{--tw-shadow:0 4px 6px var(--tw-shadow-color,#00000012);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:shadow-sm:hover{--tw-shadow:0 1px 2px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-ring:focus{--tw-ring-color:var(--color-ring)}.focus\:outline-2:focus{outline-style:var(--tw-outline-style);outline-width:2px}.focus\:outline-offset-2:focus{outline-offset:2px}.focus\:outline-ring:focus{outline-color:var(--color-ring)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-ring:focus-visible{outline-color:var(--color-ring)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:var(--color-accent)}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:inline-flex{display:inline-flex}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}.sm\:p-5{padding:calc(var(--spacing) * 5)}.sm\:pr-4{padding-right:calc(var(--spacing) * 4)}.sm\:pl-4{padding-left:calc(var(--spacing) * 4)}}@media(min-width:48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(min-width:64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\>button\]\:\!border-border>button{border-color:var(--color-border)!important}.\[\&\>button\]\:\!bg-card>button{background-color:var(--color-card)!important}.\[\&\>button\]\:\!fill-foreground>button{fill:var(--color-foreground)!important}}:root.dark{--color-background:#0c0b09;--color-foreground:#f5f0ea;--color-card:#16140f;--color-card-foreground:#f0ebe4;--color-popover:#1a1814;--color-popover-foreground:#f5f0ea;--color-primary:#818cf8;--color-primary-foreground:#0c0b09;--color-secondary:#1e1b16;--color-secondary-foreground:#f5f0ea;--color-muted:#1e1b16;--color-muted-foreground:#a8a29e;--color-accent:#292520;--color-accent-foreground:#f5f0ea;--color-destructive:#ef4444;--color-destructive-foreground:#fff;--color-border:#2e2a24;--color-input:#342f28;--color-ring:#818cf8;--color-health-good:#34d399;--color-health-warn:#fbbf24;--color-health-bad:#f87171;--shadow-sm:0 1px 3px #0006, 0 1px 2px #0000004d;--shadow-md:0 4px 12px #00000080, 0 2px 4px #00000059;--shadow-lg:0 12px 28px #0000008c, 0 4px 8px #0006;--color-sidebar:#0e0d0a;--color-sidebar-foreground:#f5f0ea;--color-sidebar-border:#2e2a24;--color-sidebar-accent:#1e1b16;--color-sidebar-accent-foreground:#f5f0ea;--color-sidebar-primary:#818cf8;--color-sidebar-primary-foreground:#0c0b09;--color-sidebar-ring:#818cf8}body{font-family:var(--font-sans);background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.font-display{font-family:var(--font-display)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:9999px}::-webkit-scrollbar-thumb:hover{background:var(--color-muted-foreground)}.dark .border{border-color:#ffffff0f}.dark .rounded-xl{background-image:linear-gradient(#ffffff06,#0000 50%);box-shadow:0 0 0 1px #ffffff0a,0 2px 8px #0006}.dark aside{box-shadow:1px 0 12px #00000080}.dark header{box-shadow:0 1px 8px #0006}:focus-visible{outline:2px solid var(--color-ring);outline-offset:2px}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/surreal_memory/server/static/dist/assets/index-C26pxqlr.js b/src/surreal_memory/server/static/dist/assets/index-DzyKsRxc.js similarity index 99% rename from src/surreal_memory/server/static/dist/assets/index-C26pxqlr.js rename to src/surreal_memory/server/static/dist/assets/index-DzyKsRxc.js index 5d7ac361..bb76e3f8 100644 --- a/src/surreal_memory/server/static/dist/assets/index-C26pxqlr.js +++ b/src/surreal_memory/server/static/dist/assets/index-DzyKsRxc.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewPage-xe8kFqX3.js","assets/vendor-query-CqA1cBNl.js","assets/vendor-react-BfuodpLv.js","assets/card-B0vNsxr_.js","assets/skeleton-DQJ-n00q.js","assets/vendor-icons-BYlYobEK.js","assets/vendor-ui-Qm4_4bAc.js","assets/vendor-recharts-BkwZfCWA.js","assets/HealthPage-DetJg-Qr.js","assets/GraphPage-DwQB1_DY.js","assets/TimelinePage-BIybkdH4.js","assets/EvolutionPage-By828lS5.js","assets/ProGate-CwBF4etn.js","assets/DiagramsPage-DxR1C_Ua.js","assets/timer-DWAvo6M8.js","assets/DiagramsPage-BZV40eAE.css","assets/SettingsPage-CH2mIMiD.js","assets/SyncPage-MbtH1dwD.js","assets/OraclePage-7FBeVFXa.js","assets/ToolStatsPage-BA-DvxES.js","assets/VisualizePage-B_IPrBGU.js","assets/StoragePage-CLDPXEH8.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OverviewPage-uovTY60B.js","assets/vendor-query-CqA1cBNl.js","assets/vendor-react-BfuodpLv.js","assets/card-CB2KYkrP.js","assets/skeleton-B4zDkVHp.js","assets/vendor-icons-BYlYobEK.js","assets/vendor-ui-Qm4_4bAc.js","assets/vendor-recharts-BkwZfCWA.js","assets/HealthPage-9CH7uxp0.js","assets/GraphPage-CrI1ELz_.js","assets/TimelinePage-C2MQrnce.js","assets/EvolutionPage-CzD9dgSX.js","assets/ProGate-37WFbaAW.js","assets/DiagramsPage-DbhaKtcI.js","assets/timer-DWAvo6M8.js","assets/DiagramsPage-BZV40eAE.css","assets/SettingsPage-BwQ0sSKJ.js","assets/SyncPage-CNbeBod6.js","assets/OraclePage--QnA7bus.js","assets/ToolStatsPage-zZWqg3RV.js","assets/VisualizePage-D-CKRU7v.js","assets/StoragePage-Dfp1G5qu.js"])))=>i.map(i=>d[i]); import{j as T,u as rt,a as fc,b as ki,Q as Nv,c as Dv}from"./vendor-query-CqA1cBNl.js";import{a as Av,c as wv,d as V,e as ig,r as v,N as Rv,R as dc,b as sg,u as zv,O as Mv,f as _v,h as Tt,i as jv,B as Lv}from"./vendor-react-BfuodpLv.js";import{c as rg,n as og,a as ug,s as cg,b as fg,d as dg,e as hg,f as mg,g as gg,h as pg,i as Bv,j as Uv,k as yg,l as um,m as Hv,o as kv,p as cm,q as fm,r as qv,t as Vv,u as Kv,v as Yv,w as Gv}from"./vendor-icons-BYlYobEK.js";import{t as Qv,c as Xv,a as vg}from"./vendor-ui-Qm4_4bAc.js";import{r as Zv}from"./vendor-recharts-BkwZfCWA.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&o(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=r(c);fetch(c.href,f)}})();var ku={exports:{}},wi={},qu={exports:{}},Vu={};var dm;function Fv(){return dm||(dm=1,(function(i){function l(D,q){var J=D.length;D.push(q);e:for(;0>>1,oe=D[de];if(0>>1;dec(k,J))Gc(K,k)?(D[de]=K,D[G]=J,de=G):(D[de]=k,D[_]=J,de=_);else if(Gc(K,J))D[de]=K,D[G]=J,de=G;else break e}}return q}function c(D,q){var J=D.sortIndex-q.sortIndex;return J!==0?J:D.id-q.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;i.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();i.unstable_now=function(){return m.now()-h}}var b=[],y=[],x=1,g=null,A=3,z=!1,j=!1,U=!1,Y=!1,B=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function I(D){for(var q=r(y);q!==null;){if(q.callback===null)o(y);else if(q.startTime<=D)o(y),q.sortIndex=q.expirationTime,l(b,q);else break;q=r(y)}}function ee(D){if(U=!1,I(D),!j)if(r(b)!==null)j=!0,$||($=!0,re());else{var q=r(y);q!==null&&je(ee,q.startTime-D)}}var $=!1,X=-1,ye=5,ae=-1;function te(){return Y?!0:!(i.unstable_now()-aeD&&te());){var de=g.callback;if(typeof de=="function"){g.callback=null,A=g.priorityLevel;var oe=de(g.expirationTime<=D);if(D=i.unstable_now(),typeof oe=="function"){g.callback=oe,I(D),q=!0;break t}g===r(b)&&o(b),I(D)}else o(b);g=r(b)}if(g!==null)q=!0;else{var me=r(y);me!==null&&je(ee,me.startTime-D),q=!1}}break e}finally{g=null,A=J,z=!1}q=void 0}}finally{q?re():$=!1}}}var re;if(typeof Z=="function")re=function(){Z(fe)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,Te=Ee.port2;Ee.port1.onmessage=fe,re=function(){Te.postMessage(null)}}else re=function(){B(fe,0)};function je(D,q){X=B(function(){D(i.unstable_now())},q)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125de?(D.sortIndex=J,l(y,D),r(b)===null&&D===r(y)&&(U?(Q(X),X=-1):U=!0,je(ee,J-de))):(D.sortIndex=oe,l(b,D),j||z||(j=!0,$||($=!0,re()))),D},i.unstable_shouldYield=te,i.unstable_wrapCallback=function(D){var q=A;return function(){var J=A;A=q;try{return D.apply(this,arguments)}finally{A=J}}}})(Vu)),Vu}var hm;function $v(){return hm||(hm=1,qu.exports=Fv()),qu.exports}var mm;function Jv(){if(mm)return wi;mm=1;var i=$v(),l=Av(),r=wv();function o(e){var t="https://react.dev/errors/"+e;if(1oe||(e.current=de[oe],de[oe]=null,oe--)}function k(e,t){oe++,de[oe]=e.current,e.current=t}var G=me(null),K=me(null),le=me(null),Se=me(null);function ue(e,t){switch(k(le,t),k(K,e),k(G,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Mh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Mh(t),e=_h(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}_(G),k(G,e)}function De(){_(G),_(K),_(le)}function Ct(e){e.memoizedState!==null&&k(Se,e);var t=G.current,n=_h(t,e.type);t!==n&&(k(K,e),k(G,n))}function dn(e){K.current===e&&(_(G),_(K)),Se.current===e&&(_(Se),Ci._currentValue=J)}var tn,Ki;function Zt(e){if(tn===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);tn=t&&t[1]||"",Ki=-1)":-1{i&&(document.getElementById(i)||console.error(r))},[r,i]),null},Z1="DialogDescriptionWarning",F1=({contentRef:i,descriptionId:l})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lp(Z1).contentName}}.`;return v.useEffect(()=>{const c=i.current?.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(o))},[o,i,l]),null},$1=Fg,J1=Wg,W1=Ig,I1=Pg,P1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ua=P1.reduce((i,l)=>{const r=Ag(`Primitive.${l}`),o=v.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),zi='[cmdk-group=""]',ec='[cmdk-group-items=""]',ex='[cmdk-group-heading=""]',ip='[cmdk-item=""]',Wm=`${ip}:not([aria-disabled="true"])`,uc="cmdk-item-select",zl="data-value",tx=(i,l,r)=>G0(i,l,r),sp=v.createContext(void 0),Vi=()=>v.useContext(sp),rp=v.createContext(void 0),pc=()=>v.useContext(rp),op=v.createContext(void 0),up=v.forwardRef((i,l)=>{let r=Ml(()=>{var _,k;return{search:"",value:(k=(_=i.value)!=null?_:i.defaultValue)!=null?k:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ml(()=>new Set),c=Ml(()=>new Map),f=Ml(()=>new Map),m=Ml(()=>new Set),h=cp(i),{label:b,children:y,value:x,onValueChange:g,filter:A,shouldFilter:z,loop:j,disablePointerSelection:U=!1,vimBindings:Y=!0,...B}=i,Q=Mn(),Z=Mn(),I=Mn(),ee=v.useRef(null),$=dx();Ba(()=>{if(x!==void 0){let _=x.trim();r.current.value=_,X.emit()}},[x]),Ba(()=>{$(6,Ee)},[]);let X=v.useMemo(()=>({subscribe:_=>(m.current.add(_),()=>m.current.delete(_)),snapshot:()=>r.current,setState:(_,k,G)=>{var K,le,Se,ue;if(!Object.is(r.current[_],k)){if(r.current[_]=k,_==="search")re(),te(),$(1,fe);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let De=document.getElementById(I);De?De.focus():(K=document.getElementById(Q))==null||K.focus()}if($(7,()=>{var De;r.current.selectedItemId=(De=Te())==null?void 0:De.id,X.emit()}),G||$(5,Ee),((le=h.current)==null?void 0:le.value)!==void 0){let De=k??"";(ue=(Se=h.current).onValueChange)==null||ue.call(Se,De);return}}X.emit()}},emit:()=>{m.current.forEach(_=>_())}}),[]),ye=v.useMemo(()=>({value:(_,k,G)=>{var K;k!==((K=f.current.get(_))==null?void 0:K.value)&&(f.current.set(_,{value:k,keywords:G}),r.current.filtered.items.set(_,ae(k,G)),$(2,()=>{te(),X.emit()}))},item:(_,k)=>(o.current.add(_),k&&(c.current.has(k)?c.current.get(k).add(_):c.current.set(k,new Set([_]))),$(3,()=>{re(),te(),r.current.value||fe(),X.emit()}),()=>{f.current.delete(_),o.current.delete(_),r.current.filtered.items.delete(_);let G=Te();$(4,()=>{re(),G?.getAttribute("id")===_&&fe(),X.emit()})}),group:_=>(c.current.has(_)||c.current.set(_,new Set),()=>{f.current.delete(_),c.current.delete(_)}),filter:()=>h.current.shouldFilter,label:b||i["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:Q,inputId:I,labelId:Z,listInnerRef:ee}),[]);function ae(_,k){var G,K;let le=(K=(G=h.current)==null?void 0:G.filter)!=null?K:tx;return _?le(_,r.current.search,k):0}function te(){if(!r.current.search||h.current.shouldFilter===!1)return;let _=r.current.filtered.items,k=[];r.current.filtered.groups.forEach(K=>{let le=c.current.get(K),Se=0;le.forEach(ue=>{let De=_.get(ue);Se=Math.max(De,Se)}),k.push([K,Se])});let G=ee.current;je().sort((K,le)=>{var Se,ue;let De=K.getAttribute("id"),Ct=le.getAttribute("id");return((Se=_.get(Ct))!=null?Se:0)-((ue=_.get(De))!=null?ue:0)}).forEach(K=>{let le=K.closest(ec);le?le.appendChild(K.parentElement===le?K:K.closest(`${ec} > *`)):G.appendChild(K.parentElement===G?K:K.closest(`${ec} > *`))}),k.sort((K,le)=>le[1]-K[1]).forEach(K=>{var le;let Se=(le=ee.current)==null?void 0:le.querySelector(`${zi}[${zl}="${encodeURIComponent(K[0])}"]`);Se?.parentElement.appendChild(Se)})}function fe(){let _=je().find(G=>G.getAttribute("aria-disabled")!=="true"),k=_?.getAttribute(zl);X.setState("value",k||void 0)}function re(){var _,k,G,K;if(!r.current.search||h.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let Se of o.current){let ue=(k=(_=f.current.get(Se))==null?void 0:_.value)!=null?k:"",De=(K=(G=f.current.get(Se))==null?void 0:G.keywords)!=null?K:[],Ct=ae(ue,De);r.current.filtered.items.set(Se,Ct),Ct>0&&le++}for(let[Se,ue]of c.current)for(let De of ue)if(r.current.filtered.items.get(De)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=le}function Ee(){var _,k,G;let K=Te();K&&(((_=K.parentElement)==null?void 0:_.firstChild)===K&&((G=(k=K.closest(zi))==null?void 0:k.querySelector(ex))==null||G.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function Te(){var _;return(_=ee.current)==null?void 0:_.querySelector(`${ip}[aria-selected="true"]`)}function je(){var _;return Array.from(((_=ee.current)==null?void 0:_.querySelectorAll(Wm))||[])}function D(_){let k=je()[_];k&&X.setState("value",k.getAttribute(zl))}function q(_){var k;let G=Te(),K=je(),le=K.findIndex(ue=>ue===G),Se=K[le+_];(k=h.current)!=null&&k.loop&&(Se=le+_<0?K[K.length-1]:le+_===K.length?K[0]:K[le+_]),Se&&X.setState("value",Se.getAttribute(zl))}function J(_){let k=Te(),G=k?.closest(zi),K;for(;G&&!K;)G=_>0?cx(G,zi):fx(G,zi),K=G?.querySelector(Wm);K?X.setState("value",K.getAttribute(zl)):q(_)}let de=()=>D(je().length-1),oe=_=>{_.preventDefault(),_.metaKey?de():_.altKey?J(1):q(1)},me=_=>{_.preventDefault(),_.metaKey?D(0):_.altKey?J(-1):q(-1)};return v.createElement(ua.div,{ref:l,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:_=>{var k;(k=B.onKeyDown)==null||k.call(B,_);let G=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||G))switch(_.key){case"n":case"j":{Y&&_.ctrlKey&&oe(_);break}case"ArrowDown":{oe(_);break}case"p":case"k":{Y&&_.ctrlKey&&me(_);break}case"ArrowUp":{me(_);break}case"Home":{_.preventDefault(),D(0);break}case"End":{_.preventDefault(),de();break}case"Enter":{_.preventDefault();let K=Te();if(K){let le=new Event(uc);K.dispatchEvent(le)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:ye.inputId,id:ye.labelId,style:mx},b),Cr(i,_=>v.createElement(rp.Provider,{value:X},v.createElement(sp.Provider,{value:ye},_))))}),nx=v.forwardRef((i,l)=>{var r,o;let c=Mn(),f=v.useRef(null),m=v.useContext(op),h=Vi(),b=cp(i),y=(o=(r=b.current)==null?void 0:r.forceMount)!=null?o:m?.forceMount;Ba(()=>{if(!y)return h.item(c,m?.id)},[y]);let x=fp(c,f,[i.value,i.children,f],i.keywords),g=pc(),A=oa($=>$.value&&$.value===x.current),z=oa($=>y||h.filter()===!1?!0:$.search?$.filtered.items.get(c)>0:!0);v.useEffect(()=>{let $=f.current;if(!(!$||i.disabled))return $.addEventListener(uc,j),()=>$.removeEventListener(uc,j)},[z,i.onSelect,i.disabled]);function j(){var $,X;U(),(X=($=b.current).onSelect)==null||X.call($,x.current)}function U(){g.setState("value",x.current,!0)}if(!z)return null;let{disabled:Y,value:B,onSelect:Q,forceMount:Z,keywords:I,...ee}=i;return v.createElement(ua.div,{ref:Pt(f,l),...ee,id:c,"cmdk-item":"",role:"option","aria-disabled":!!Y,"aria-selected":!!A,"data-disabled":!!Y,"data-selected":!!A,onPointerMove:Y||h.getDisablePointerSelection()?void 0:U,onClick:Y?void 0:j},i.children)}),ax=v.forwardRef((i,l)=>{let{heading:r,children:o,forceMount:c,...f}=i,m=Mn(),h=v.useRef(null),b=v.useRef(null),y=Mn(),x=Vi(),g=oa(z=>c||x.filter()===!1?!0:z.search?z.filtered.groups.has(m):!0);Ba(()=>x.group(m),[]),fp(m,h,[i.value,i.heading,b]);let A=v.useMemo(()=>({id:m,forceMount:c}),[c]);return v.createElement(ua.div,{ref:Pt(h,l),...f,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:y},r),Cr(i,z=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?y:void 0},v.createElement(op.Provider,{value:A},z))))}),lx=v.forwardRef((i,l)=>{let{alwaysRender:r,...o}=i,c=v.useRef(null),f=oa(m=>!m.search);return!r&&!f?null:v.createElement(ua.div,{ref:Pt(c,l),...o,"cmdk-separator":"",role:"separator"})}),ix=v.forwardRef((i,l)=>{let{onValueChange:r,...o}=i,c=i.value!=null,f=pc(),m=oa(y=>y.search),h=oa(y=>y.selectedItemId),b=Vi();return v.useEffect(()=>{i.value!=null&&f.setState("search",i.value)},[i.value]),v.createElement(ua.input,{ref:l,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":h,id:b.inputId,type:"text",value:c?i.value:m,onChange:y=>{c||f.setState("search",y.target.value),r?.(y.target.value)}})}),sx=v.forwardRef((i,l)=>{let{children:r,label:o="Suggestions",...c}=i,f=v.useRef(null),m=v.useRef(null),h=oa(y=>y.selectedItemId),b=Vi();return v.useEffect(()=>{if(m.current&&f.current){let y=m.current,x=f.current,g,A=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let z=y.offsetHeight;x.style.setProperty("--cmdk-list-height",z.toFixed(1)+"px")})});return A.observe(y),()=>{cancelAnimationFrame(g),A.unobserve(y)}}},[]),v.createElement(ua.div,{ref:Pt(f,l),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":o,id:b.listId},Cr(i,y=>v.createElement("div",{ref:Pt(m,b.listInnerRef),"cmdk-list-sizer":""},y)))}),rx=v.forwardRef((i,l)=>{let{open:r,onOpenChange:o,overlayClassName:c,contentClassName:f,container:m,...h}=i;return v.createElement($1,{open:r,onOpenChange:o},v.createElement(J1,{container:m},v.createElement(W1,{"cmdk-overlay":"",className:c}),v.createElement(I1,{"aria-label":i.label,"cmdk-dialog":"",className:f},v.createElement(up,{ref:l,...h}))))}),ox=v.forwardRef((i,l)=>oa(r=>r.filtered.count===0)?v.createElement(ua.div,{ref:l,...i,"cmdk-empty":"",role:"presentation"}):null),ux=v.forwardRef((i,l)=>{let{progress:r,children:o,label:c="Loading...",...f}=i;return v.createElement(ua.div,{ref:l,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},Cr(i,m=>v.createElement("div",{"aria-hidden":!0},m)))}),jt=Object.assign(up,{List:sx,Item:nx,Input:ix,Group:ax,Separator:lx,Dialog:rx,Empty:ox,Loading:ux});function cx(i,l){let r=i.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function fx(i,l){let r=i.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function cp(i){let l=v.useRef(i);return Ba(()=>{l.current=i}),l}var Ba=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Ml(i){let l=v.useRef();return l.current===void 0&&(l.current=i()),l}function oa(i){let l=pc(),r=()=>i(l.snapshot());return v.useSyncExternalStore(l.subscribe,r,r)}function fp(i,l,r,o=[]){let c=v.useRef(),f=Vi();return Ba(()=>{var m;let h=(()=>{var y;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(y=x.current.textContent)==null?void 0:y.trim():c.current}})(),b=o.map(y=>y.trim());f.value(i,h,b),(m=l.current)==null||m.setAttribute(zl,h),c.current=h}),c}var dx=()=>{let[i,l]=v.useState(),r=Ml(()=>new Map);return Ba(()=>{r.current.forEach(o=>o()),r.current=new Map},[i]),(o,c)=>{r.current.set(o,c),l({})}};function hx(i){let l=i.type;return typeof l=="function"?l(i.props):"render"in l?l.render(i.props):i}function Cr({asChild:i,children:l},r){return i&&v.isValidElement(l)?v.cloneElement(hx(l),{ref:l.ref},r(l.props.children)):r(l)}var mx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const gx="https://pay.theio.vn",px={vn:{product:"NM-PRO-YEARLY",original:"1.190.000 VND",price:"595.000 VND",method:"Bank Transfer (VietQR)",flag:"🇻🇳"},intl:{product:"NM-PRO-YEARLY",original:"$89 USD",price:"$49 USD",method:"Card / PayPal (Polar)",flag:"🌐"}};let cc=null;function Im(){cc?.()}function yx(){const[i,l]=v.useState(!1),[r,o]=v.useState("choose"),[c,f]=v.useState(""),[m,h]=v.useState(!1),[b,y]=v.useState(!1),[x,g]=v.useState(""),{t:A}=xr();return v.useEffect(()=>(cc=()=>l(!0),()=>{cc=null}),[]),v.useEffect(()=>{i||(o("choose"),f(""),g(""),y(!1))},[i]),v.useEffect(()=>{if(!i)return;const z=j=>{j.key==="Escape"&&l(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),v.useCallback(async z=>{const j=px[z],U=prompt(A("upgrade.enterEmail","Enter your email for the license:"));if(U){try{const Q=await(await fetch(`${gx}${z==="intl"?"/checkout/polar":"/order/sepay"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:j.product,email:U})})).json();Q.url?window.open(Q.url,"_blank"):Q.qr_url&&window.open(Q.qr_url,"_blank")}catch{z==="intl"&&window.open("https://polar.sh/nhadaututtheky","_blank")}l(!1)}},[A]),v.useCallback(async()=>{const z=c.trim();if(z){h(!0),g("");try{const j=await qe.post("/api/dashboard/license/activate",{license_key:z});j.success?(y(!0),setTimeout(()=>{l(!1),window.location.reload()},1500)):g(j.error||A("upgrade.activationFailed","Activation failed"))}catch{g(A("upgrade.activationFailed","Activation failed. Check key format."))}finally{h(!1)}}},[c,A]),null}const vx=[{path:"/",icon:og,labelKey:"nav.overview"},{path:"/health",icon:ug,labelKey:"nav.health"},{path:"/graph",icon:cg,labelKey:"nav.graph"},{path:"/timeline",icon:fg,labelKey:"nav.timeline"},{path:"/evolution",icon:dg,labelKey:"nav.evolution"},{path:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{path:"/sync",icon:mg,labelKey:"nav.sync"},{path:"/oracle",icon:gg,labelKey:"nav.oracle"},{path:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{path:"/settings",icon:yg,labelKey:"nav.settings"}],Pm={fact:"#06b6d4",decision:"#f59e0b",error:"#ef4444",insight:"#8b5cf6",preference:"#ec4899",workflow:"#059669",instruction:"#6366f1",pattern:"#14b8a6",concept:"#6366f1",entity:"#06b6d4"};function bx(){const[i,l]=v.useState(!1),[r,o]=v.useState(""),[c,f]=v.useState([]),[m,h]=v.useState(!1),b=v.useRef(null),y=zv(),{data:x}=_0(),{t:g}=xr();v.useEffect(()=>{const B=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),l(Z=>!Z))};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[]),v.useEffect(()=>{i||(o(""),f([]))},[i]);const A=v.useCallback(B=>{if(b.current&&clearTimeout(b.current),B.length<2){f([]),h(!1);return}h(!0),b.current=setTimeout(async()=>{try{const Q=await qe.get(`/neurons?content_contains=${encodeURIComponent(B)}&limit=8`);f(Q.neurons??[])}catch{f([])}finally{h(!1)}},300)},[]),z=B=>{o(B),A(B)},j=B=>{y(B),l(!1)},U=x?.fibers??[],Y=r.length>0?U.filter(B=>B.summary.toLowerCase().includes(r.toLowerCase())):U.slice(0,5);return T.jsxs(T.Fragment,{children:[T.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground cursor-pointer","aria-label":g("commandPalette.placeholder"),children:[T.jsx(um,{className:"size-3.5","aria-hidden":"true"}),T.jsx("span",{className:"hidden sm:inline",children:g("commandPalette.search")}),T.jsxs("kbd",{className:"pointer-events-none hidden select-none rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium sm:inline-flex",children:[T.jsx(Hv,{className:"mr-0.5 inline size-2.5","aria-hidden":"true"}),"K"]})]}),i&&sg.createPortal(T.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/50 backdrop-blur-sm",onClick:B=>{B.target===B.currentTarget&&l(!1)},children:T.jsxs(jt,{className:"w-full max-w-lg rounded-xl border border-border bg-card shadow-lg overflow-hidden",shouldFilter:!1,children:[T.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[T.jsx(um,{className:"mr-2 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),T.jsx(jt.Input,{value:r,onValueChange:z,placeholder:g("commandPalette.placeholder"),className:"flex h-11 w-full bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"}),m&&T.jsx("div",{className:"size-4 shrink-0 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})]}),T.jsxs(jt.List,{className:"max-h-80 overflow-y-auto px-2 py-2",children:[T.jsx(jt.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:g("commandPalette.noResults")}),T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.pages")}),children:vx.map(({path:B,icon:Q,labelKey:Z})=>T.jsxs(jt.Item,{value:`page-${g(Z)}`,onSelect:()=>j(B),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(Q,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{children:g(Z)})]},B))}),Y.length>0&&T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.fibers")}),children:Y.slice(0,6).map(B=>T.jsxs(jt.Item,{value:`fiber-${B.summary}`,onSelect:()=>{y("/diagrams"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(kv,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1 truncate",children:B.summary}),T.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:B.neuron_count})]},B.id))}),c.length>0&&T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.neurons")}),children:c.map(B=>T.jsxs(jt.Item,{value:`neuron-${B.id}`,onSelect:()=>{y("/graph"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(rg,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1 truncate text-xs",children:B.content}),T.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{backgroundColor:`${Pm[B.type]??"#94a3b8"}20`,color:Pm[B.type]??"#94a3b8"},children:B.type})]},B.id))}),T.jsxs(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pro"}),children:[T.jsxs(jt.Item,{value:"pro-semantic-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[T.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1",children:g("commandPalette.semanticSearch")}),T.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]}),T.jsxs(jt.Item,{value:"pro-cross-brain-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[T.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1",children:g("commandPalette.crossBrainSearch")}),T.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]})]})]}),T.jsx("div",{className:"flex items-center justify-between border-t border-border px-4 py-2",children:T.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↑↓"})," ",g("commandPalette.navigate")]}),T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↵"})," ",g("commandPalette.select")]}),T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"esc"})," ",g("commandPalette.close")]})]})})]})}),document.body)]})}const Sx={light:Gv,dark:Yv,system:Kv},eg={light:"common.lightMode",dark:"common.darkMode",system:"common.systemTheme"};function xx(){const{sidebarOpen:i,toggleSidebar:l,theme:r,cycleTheme:o}=br(),{data:c}=z0(),{data:f}=M0(),{t:m,i18n:h}=xr(),b=Sx[r],y=h.language?.startsWith("vi")?"vi":"en",x=()=>{const g=y==="vi"?"en":"vi";h.changeLanguage(g)};return T.jsxs("header",{className:"sticky top-0 z-20 flex h-14 items-center gap-4 border-b border-border bg-background/80 px-4 backdrop-blur-sm",children:[T.jsx(Mi,{variant:"ghost",size:"icon",onClick:l,"aria-label":m(i?"common.collapseSidebar":"common.expandSidebar"),children:i?T.jsx(fm,{className:"size-5",weight:"bold"}):T.jsx(fm,{className:"size-5"})}),c?.active_brain&&T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("span",{className:"text-sm text-muted-foreground",children:[m("common.brain"),":"]}),T.jsx(L0,{variant:"secondary",className:"font-mono text-xs",children:c.active_brain})]}),T.jsx(bx,{}),T.jsx("div",{className:"flex-1"}),T.jsx(Mi,{variant:"ghost",size:"icon",asChild:!0,"aria-label":"Quickstart Guide",title:"Quickstart Guide",children:T.jsx("a",{href:"https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",target:"_blank",rel:"noopener noreferrer",children:T.jsx(qv,{className:"size-4"})})}),T.jsxs(Mi,{variant:"ghost",size:"sm",onClick:x,className:"gap-1.5 px-2 text-xs font-medium","aria-label":"Switch language",children:[T.jsx(Vv,{className:"size-3.5"}),y==="vi"?"VI":"EN"]}),T.jsx(Mi,{variant:"ghost",size:"icon",onClick:o,"aria-label":m(eg[r]),title:m(eg[r]),"data-testid":"theme-toggle",children:T.jsx(b,{className:"size-4"})}),f?.version&&T.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",f.version]})]})}function Ex(){const i=br(l=>l.sidebarOpen);return T.jsxs("div",{className:"h-screen bg-background overflow-hidden",children:[T.jsx(b0,{}),T.jsxs("div",{className:Li("flex flex-col h-full transition-all duration-[var(--transition-normal)]",i?"ml-56":"ml-16"),children:[T.jsx(xx,{}),T.jsx("main",{className:"flex-1 overflow-auto",children:T.jsx(Mv,{})})]}),T.jsx(yx,{})]})}function Qt(){return T.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[T.jsx("div",{className:"h-8 w-48 rounded-lg bg-muted"}),T.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((i,l)=>T.jsx("div",{className:"h-28 rounded-xl bg-muted"},l))}),T.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[T.jsx("div",{className:"h-64 rounded-xl bg-muted"}),T.jsx("div",{className:"h-64 rounded-xl bg-muted"})]})]})}const Tx=v.lazy(()=>Xt(()=>import("./OverviewPage-xe8kFqX3.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Ox=v.lazy(()=>Xt(()=>import("./HealthPage-DetJg-Qr.js"),__vite__mapDeps([8,1,2,3,4,5,7,6]))),Cx=v.lazy(()=>Xt(()=>import("./GraphPage-DwQB1_DY.js"),__vite__mapDeps([9,1,2,3,4,5,6,7]))),Nx=v.lazy(()=>Xt(()=>import("./TimelinePage-BIybkdH4.js"),__vite__mapDeps([10,1,2,3,4,5,7,6]))),Dx=v.lazy(()=>Xt(()=>import("./EvolutionPage-By828lS5.js"),__vite__mapDeps([11,1,2,12,3,4,7,6,5]))),Ax=v.lazy(()=>Xt(()=>import("./DiagramsPage-DxR1C_Ua.js"),__vite__mapDeps([13,1,2,3,4,14,7,6,5,15]))),wx=v.lazy(()=>Xt(()=>import("./SettingsPage-CH2mIMiD.js"),__vite__mapDeps([16,1,2,3,5,4,12,6,7]))),Rx=v.lazy(()=>Xt(()=>import("./SyncPage-MbtH1dwD.js"),__vite__mapDeps([17,1,2,3,5,6,7]))),zx=v.lazy(()=>Xt(()=>import("./OraclePage-7FBeVFXa.js"),__vite__mapDeps([18,1,2,5,6,7]))),Mx=v.lazy(()=>Xt(()=>import("./ToolStatsPage-BA-DvxES.js"),__vite__mapDeps([19,1,2,3,4,7,6,5]))),_x=v.lazy(()=>Xt(()=>import("./VisualizePage-B_IPrBGU.js"),__vite__mapDeps([20,1,2,12,3,5,6,7]))),jx=v.lazy(()=>Xt(()=>import("./StoragePage-CLDPXEH8.js"),__vite__mapDeps([21,1,2,3,5,4,6,7])));function Lx(){return T.jsx(_v,{children:T.jsxs(Tt,{element:T.jsx(Ex,{}),children:[T.jsx(Tt,{index:!0,element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Tx,{})})}),T.jsx(Tt,{path:"health",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Ox,{})})}),T.jsx(Tt,{path:"graph",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Cx,{})})}),T.jsx(Tt,{path:"timeline",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Nx,{})})}),T.jsx(Tt,{path:"evolution",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Dx,{})})}),T.jsx(Tt,{path:"diagrams",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Ax,{})})}),T.jsx(Tt,{path:"settings",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(wx,{})})}),T.jsx(Tt,{path:"sync",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Rx,{})})}),T.jsx(Tt,{path:"oracle",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(zx,{})})}),T.jsx(Tt,{path:"tool-stats",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Mx,{})})}),T.jsx(Tt,{path:"visualize",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(_x,{})})}),T.jsx(Tt,{path:"storage",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(jx,{})})}),T.jsx(Tt,{path:"*",element:T.jsx(jv,{to:"/",replace:!0})})]})})}const{slice:Bx,forEach:Ux}=[];function Hx(i){return Ux.call(Bx.call(arguments,1),l=>{if(l)for(const r in l)i[r]===void 0&&(i[r]=l[r])}),i}function kx(i){return typeof i!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(i))}const tg=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,qx=function(i,l){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(l);let f=`${i}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");f+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!tg.test(o.domain))throw new TypeError("option domain is invalid");f+=`; Domain=${o.domain}`}if(o.path){if(!tg.test(o.path))throw new TypeError("option path is invalid");f+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");f+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(f+="; HttpOnly"),o.secure&&(f+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:f+="; SameSite=Strict";break;case"lax":f+="; SameSite=Lax";break;case"strict":f+="; SameSite=Strict";break;case"none":f+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(f+="; Partitioned"),f},ng={create(i,l,r,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+r*60*1e3)),o&&(c.domain=o),document.cookie=qx(i,l,c)},read(i){const l=`${i}=`,r=document.cookie.split(";");for(let o=0;o-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const f=o.substring(1).split("&");for(let m=0;m0&&f[m].substring(0,h)===l&&(r=f[m].substring(h+1))}}return r}},Yx={name:"hash",lookup(i){let{lookupHash:l,lookupFromHashIndex:r}=i,o;if(typeof window<"u"){const{hash:c}=window.location;if(c&&c.length>2){const f=c.substring(1);if(l){const m=f.split("&");for(let h=0;h0&&m[h].substring(0,b)===l&&(o=m[h].substring(b+1))}}if(o)return o;if(!o&&r>-1){const m=c.match(/\/([a-zA-Z-]*)/g);return Array.isArray(m)?m[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return o}};let wl=null;const ag=()=>{if(wl!==null)return wl;try{if(wl=typeof window<"u"&&window.localStorage!==null,!wl)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{wl=!1}return wl};var Gx={name:"localStorage",lookup(i){let{lookupLocalStorage:l}=i;if(l&&ag())return window.localStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupLocalStorage:r}=l;r&&ag()&&window.localStorage.setItem(r,i)}};let Rl=null;const lg=()=>{if(Rl!==null)return Rl;try{if(Rl=typeof window<"u"&&window.sessionStorage!==null,!Rl)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{Rl=!1}return Rl};var Qx={name:"sessionStorage",lookup(i){let{lookupSessionStorage:l}=i;if(l&&lg())return window.sessionStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupSessionStorage:r}=l;r&&lg()&&window.sessionStorage.setItem(r,i)}},Xx={name:"navigator",lookup(i){const l=[];if(typeof navigator<"u"){const{languages:r,userLanguage:o,language:c}=navigator;if(r)for(let f=0;f0?l:void 0}},Zx={name:"htmlTag",lookup(i){let{htmlTag:l}=i,r;const o=l||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(r=o.getAttribute("lang")),r}},Fx={name:"path",lookup(i){let{lookupFromPathIndex:l}=i;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof l=="number"?l:0]?.replace("/",""):void 0}},$x={name:"subdomain",lookup(i){let{lookupFromSubdomainIndex:l}=i;const r=typeof l=="number"?l+1:1,o=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[r]}};let dp=!1;try{document.cookie,dp=!0}catch{}const hp=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];dp||hp.splice(1,1);const Jx=()=>({order:hp,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class mp{constructor(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(l,r)}init(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=l,this.options=Hx(r,this.options||{},Jx()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(Vx),this.addDetector(Kx),this.addDetector(Gx),this.addDetector(Qx),this.addDetector(Xx),this.addDetector(Zx),this.addDetector(Fx),this.addDetector($x),this.addDetector(Yx)}addDetector(l){return this.detectors[l.name]=l,this}detect(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return l.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(r=r.concat(c))}}),r=r.filter(o=>o!=null&&!kx(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(l)>-1||r.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(l,this.options)}))}}mp.type="languageDetector";const Wx={overview:"Tổng quan",health:"Sức khỏe",graph:"Đồ thị",timeline:"Dòng thời gian",evolution:"Tiến hóa",mindmap:"Sơ đồ tư duy",oracle:"Tiên tri",toolStats:"Thống kê công cụ",visualize:"Trực quan",sync:"Đồng bộ",storage:"Lưu trữ",settings:"Cài đặt"},Ix={confirm:"Xác nhận",cancel:"Hủy",delete:"Xóa",loading:"Đang tải...",active:"Đang dùng",yes:"Có",no:"Không",none:"(trống)",neurons:"neuron",brain:"Bộ não",collapseSidebar:"Thu gọn thanh bên",expandSidebar:"Mở rộng thanh bên",mainNavigation:"Điều hướng chính",lightMode:"Chế độ sáng",darkMode:"Chế độ tối",systemTheme:"Theo hệ thống"},Px={title:"Tổng quan",neurons:"Neuron",synapses:"Synapse",fibers:"Fiber",brains:"Bộ não",brainList:"Danh sách bộ não",name:"Tên",grade:"Hạng",status:"Trạng thái",actions:"Thao tác",currentBrain:"Bộ não đang dùng",switchTo:"Nhấn để chuyển sang {{name}}",deleteBrain:"Xóa bộ não {{name}}",noBrains:"Không tìm thấy bộ não nào.",deleteBrainTitle:"Xóa bộ não",deleteBrainDesc:'Xóa bộ não "{{name}}"? Tất cả neuron, synapse và fiber sẽ bị xóa vĩnh viễn. Không thể hoàn tác.',switchedTo:"Đã chuyển sang: {{name}}",switchFailed:"Chuyển bộ não thất bại",deleted:"Đã xóa bộ não: {{name}}",deleteFailed:"Xóa bộ não thất bại"},eE={title:"Sức khỏe",brainMetrics:"Chỉ số bộ não",purity:"Độ tinh khiết",freshness:"Độ mới",connectivity:"Kết nối",diversity:"Đa dạng",consolidation:"Tổng hợp",activation:"Kích hoạt",recall:"Nhớ lại",orphanRate:"Tỷ lệ mồ côi",radarName:"Sức khỏe",warnings:"Cảnh báo & Khuyến nghị",noWarnings:"Không có cảnh báo. Bộ não khỏe mạnh!",recommendations:"Khuyến nghị",enrichTitle:"Cách làm giàu bộ não",enrichDesc:"Bộ não càng phong phú thì khả năng nhớ lại càng tốt. Đây là cách xây dựng neuron chi tiết và synapse mạnh mẽ.",collapseTips:"Thu gọn mẹo",expandTips:"Mở rộng mẹo",less:"Ít hơn",more:"Thêm",topPenalties:"Vấn đề chính ảnh hưởng điểm số",noPenalties:"Không có vấn đề đáng kể. Tiếp tục phát huy!",penaltyPoints:"Mất {{points}} điểm",estimatedGain:"+{{gain}} điểm nếu sửa",currentScore:"Hiện tại: {{score}}%",weight:"Trọng số: {{weight}}%",fixAction:"Cách sửa"},tE={rememberTitle:"Yêu cầu agent ghi nhớ thường xuyên",rememberTips:['Sau mỗi quyết định: "Nhớ rằng chúng ta chọn PostgreSQL thay vì MongoDB cho user service"','Sau khi debug: "Nhớ nguyên nhân gốc là race condition trong WebSocket handler"','Sau cuộc họp: "Nhớ Alice đề xuất rate limiting ở tầng API gateway"','Sau khi học: "Nhớ Vite HMR yêu cầu export default cho React component"'],causalTitle:"Dùng ngôn ngữ nhân quả, phong phú",causalTips:['TỆ: "PostgreSQL" → chỉ tạo một neuron phẳng','TỐT: "Chúng ta chọn PostgreSQL thay MongoDB vì cần ACID transaction cho xử lý thanh toán" → tạo neuron concept + entity + decision với synapse CAUSED_BY',"Nói TẠI SAO, không chỉ CÁI GÌ — chuỗi nhân quả tạo kết nối neural phong phú hơn","Đề cập người, ngày, bối cảnh — chúng trở thành neuron riêng liên kết qua synapse"],diverseTitle:"Đa dạng loại bộ nhớ = nhớ lại tốt hơn",diverseTips:['Sự kiện: "API rate limit là 1000 req/phút mỗi user"','Quyết định: "Chúng ta chọn JWT thay session vì kiến trúc microservice"',`Lỗi: "Import thất bại vì cột 'email' đổi thành 'user_email' trong v3"`,'Insight: "Pattern: luôn xác thực webhook signature trước khi xử lý payload"','Workflow: "Quy trình deploy: lint → test → build → push → kiểm tra health check"'],trainTitle:"Huấn luyện từ tài liệu để có kiến thức vĩnh viễn",trainTips:["Dùng smem_train để import tài liệu (PDF, DOCX, MD) — bộ nhớ được huấn luyện không bao giờ suy giảm","Dùng smem_index để index codebase — cho phép recall nhận biết code","Ghim bộ nhớ quan trọng bằng smem_pin — bỏ qua suy giảm và tổng hợp","Dùng smem_eternal cho context dự án cần lưu trữ xuyên suốt các phiên"]},nE={title:"Đồ thị Neural",nodes:"Nút:",networkVisualization:"Trực quan hóa mạng",nodesCount:"{{nodes}} nút, {{edges}} cạnh",noNeurons:"Không tìm thấy neuron nào trong bộ não này.",concept:"khái niệm",entity:"thực thể",time:"thời gian",action:"hành động",state:"trạng thái",other:"khác"},aE={title:"Dòng thời gian",memoryTimeline:"Dòng thời gian bộ nhớ",entries:"{{total}} mục",noEntries:"Không có mục nào.",range7d:"7 ngày",range30d:"30 ngày",range90d:"90 ngày",rangeAll:"Tất cả",todayMemories:"Hôm nay",totalPeriod:"Tổng",avgPerDay:"TB/Ngày",activeDays:"Ngày hoạt động",activityTrend:"Xu hướng hoạt động",neuronDistribution:"Phân bố Neuron",recentActivity:"Hoạt động gần đây",neurons:"Neuron",fibers:"Fiber",synapses:"Synapse"},lE={title:"Tiến hóa",brainMetrics:"Chỉ số bộ não",maturity:"Trưởng thành",plasticity:"Linh hoạt",semanticRatio:"Tỷ lệ ngữ nghĩa",totalFibers:"Tổng Fiber",totalNeurons:"Tổng Neuron",stageDistribution:"Phân bố giai đoạn",shortTerm:"Ngắn hạn",working:"Làm việc",episodic:"Tình huống",semantic:"Ngữ nghĩa"},iE={title:"Sơ đồ tư duy",fibers:"Fiber",noFibers:"Không tìm thấy fiber nào.",selectFiber:"Chọn một Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neuron:",connectionsCount:"Kết nối:",selectFiberPrompt:"Chọn một fiber để xem sơ đồ tư duy"},sE={title:"Cài đặt",general:"Tổng quát",version:"Phiên bản",activeBrain:"Bộ não đang dùng",totalBrains:"Tổng bộ não",brainFiles:"Tệp bộ não",brainsDirectory:"Thư mục bộ não",totalDiskUsage:"Dung lượng sử dụng",telegramBackup:"Sao lưu Telegram",connected:"Đã kết nối",chatIds:"Chat ID",autoBackup:"Tự động sao lưu khi tổng hợp",sendTest:"Gửi thử",sending:"Đang gửi...",backupNow:"Sao lưu ngay",backingUp:"Đang sao lưu...",notConfigured:"Chưa cấu hình",telegramSetup:"Đặt biến môi trường NMEM_TELEGRAM_BOT_TOKEN và thêm [telegram] chat_ids vào config.toml.",feedbackTitle:"Góp ý & Báo lỗi",reportBug:"Báo lỗi",reportBugDesc:"Phát hiện lỗi? Tạo issue với các bước tái hiện.",featureRequest:"Yêu cầu tính năng",featureRequestDesc:"Có ý tưởng cải thiện Surreal-Memory? Chúng tôi rất muốn nghe.",discussions:"GitHub Discussions",discussionsDesc:"Câu hỏi, mẹo hay, và hỗ trợ cộng đồng.",testSuccess:"Đã gửi tin nhắn thử thành công",testPartial:"Một số tin nhắn gửi thất bại",testFailed:"Gửi tin nhắn thử thất bại",backupSuccess:"Đã sao lưu! {{brain}} ({{size}}MB) đến {{count}} chat",backupSendFailed:"Sao lưu gửi thất bại",backupFailed:"Sao lưu thất bại",configStatus:"Trạng thái cấu hình",embeddingConfig:"Nhà cung cấp Embedding",embeddingProvider:"Nhà cung cấp",embeddingModel:"Model",embeddingEnabled:"Bật",embeddingThreshold:"Ngưỡng tương đồng",embeddingTest:"Kiểm tra kết nối",embeddingTesting:"Đang kiểm tra...",embeddingTestOk:"Kết nối OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Kiểm tra thất bại: {{error}}",embeddingSave:"Lưu",embeddingSaving:"Đang lưu...",embeddingSaved:"Đã lưu cấu hình embedding",embeddingSaveFailed:"Lưu cấu hình embedding thất bại",proFeature:"Pro",watcher:"Theo dõi tệp",watcherPaths:"Đường dẫn theo dõi",watcherRecent:"Hoạt động gần đây",watcherRunning:"Đang chạy",watcherStopped:"Đã dừng",watcherDisabled:"Tắt",watcherNoActivity:"Không có hoạt động gần đây"},rE={title:"Tiên Tri",loading:"Đang kết nối ký ức...",needMore:"Não bạn cần thêm ký ức",needMoreDesc:"Tiên Tri cần ít nhất 3 ký ức để mở khóa. Hãy nhờ AI ghi nhớ các quyết định, hiểu biết, và bài học — rồi quay lại đây.",dailyHint:"Chạm vào từng lá bài để xem kết quả",past:"Quá khứ",present:"Hiện tại",future:"Tương lai",readingDate:"Bói cho {{brain}} ngày {{date}}",whatifHint:"Nếu những ký ức này va chạm thì sao?",reshuffle:"Xáo lại",memory:"Ký ức",wildcard:"Lá bất ngờ",matchupComplete:"Hoàn thành đấu trí!",matchupScoreDesc:"Dựa trên mức kích hoạt và kết nối của ký ức bạn chọn",playAgain:"Chơi lại",round:"Vòng {{current}} / {{total}}",choose:"Chọn",chosen:"Đã chọn!",score:"Điểm",dailyReading:"Bói hàng ngày",whatif:"Nếu Như",matchup:"Đấu Trí",copyCard:"Chép ảnh",copied:"Đã chép!",downloadCard:"Tải xuống"},oE={search:"Tìm kiếm...",placeholder:"Tìm trang, fiber, ký ức...",noResults:"Không tìm thấy kết quả.",pages:"Trang",fibers:"Fiber",neurons:"Ký ức",semanticSearch:"Tìm kiếm ngữ nghĩa — tìm theo ý nghĩa",crossBrainSearch:"Tìm xuyên Brain — tìm trên mọi brain",navigate:"di chuyển",select:"mở",close:"đóng"},uE={title:"Đồng bộ đám mây",refresh:"Làm mới",connectionStatus:"Kết nối",status:"Trạng thái",cloudConnected:"Đã kết nối",notConnected:"Chưa kết nối",hubUrl:"URL Hub",apiKey:"API Key",deviceId:"ID Thiết bị",disconnect:"Ngắt kết nối",setupCloud:"Kết nối đám mây",setupTitle:"Kết nối Cloud Hub",setupDesc:"Nhập URL hub và API key để đồng bộ ký ức giữa các thiết bị. Đăng ký tại hub để nhận key.",keyRequired:"API key là bắt buộc",keyInvalid:"API key phải bắt đầu bằng nmk_",keyHint:"Nhận key bằng cách đăng ký tại hub. Key bắt đầu bằng nmk_.",connect:"Kết nối",connecting:"Đang kết nối...",connected:"Đã kết nối đồng bộ đám mây!",connectFailed:"Kết nối thất bại",disconnected:"Đã ngắt đồng bộ đám mây",disconnectFailed:"Ngắt kết nối thất bại",devices:"Thiết bị",lastSync:"Đồng bộ lần cuối",never:"Chưa bao giờ",noDevices:"Chưa có thiết bị nào. Đồng bộ từ một thiết bị để đăng ký.",changeLog:"Nhật ký thay đổi",totalChanges:"Tổng thay đổi",synced:"Đã đồng bộ",pending:"Đang chờ",latestSequence:"Sequence mới nhất",conflictStrategy:"Giải quyết xung đột",conflictDesc:"Cách xử lý khi cùng một ký ức bị thay đổi trên nhiều thiết bị.",strategyUpdated:"Đã cập nhật chiến lược xung đột",updateFailed:"Cập nhật cấu hình thất bại",syncMode:"Chế độ đồng bộ",merkleDelta:"Merkle Delta",fullSync:"Đồng bộ toàn phần"},cE={title:"Thống kê công cụ",totalEvents:"Tổng sự kiện",successRate:"Tỷ lệ thành công",uniqueTools:"Công cụ đã dùng",topTools:"Công cụ hàng đầu",usageOverTime:"Sử dụng theo thời gian",detailTable:"Chi tiết công cụ",tool:"Công cụ",calls:"Lượt gọi",avgDuration:"Thời gian TB",server:"Server",noData:"Chưa có dữ liệu. Sử dụng các công cụ Surreal-Memory để bắt đầu theo dõi."},fE={title:"Trực quan hóa",description:"Truy vấn bộ nhớ và tạo biểu đồ từ dữ liệu đã lưu."},dE={title:"Lưu trữ",currentBackend:"Backend hiện tại",brain:"Bộ não",neurons:"Neuron",synapses:"Synapse",fibers:"Fiber",tierDistribution:"Phân tầng bộ nhớ",tierHot:"HOT — Luôn trong ngữ cảnh",tierWarm:"WARM — Khớp ngữ nghĩa",tierCold:"COLD — Chỉ gọi lại thủ công",totalMemories:"Tổng bộ nhớ có kiểu"},hE={tier:"Giấy phép",pro_badge:"PRO",pro_feature:"Tính năng Pro",free:"Miễn phí",pro:"Pro",team:"Nhóm"},mE={title:"Nâng cấp Surreal-Memory Pro",subtitle:"Chọn phương thức thanh toán",enterKey:"Nhập license key của bạn",enterEmail:"Nhập email để nhận license:",orActivate:"hoặc kích hoạt key",haveKey:"Tôi đã có license key",licenseKey:"License Key",activate:"Kích hoạt",activated:"Đã kích hoạt Pro!",activationFailed:"Kích hoạt thất bại. Kiểm tra lại key.",back:"Quay lại"},gE={nav:Wx,common:Ix,overview:Px,health:eE,enrichment:tE,graph:nE,timeline:aE,evolution:lE,diagrams:iE,settings:sE,oracle:rE,commandPalette:oE,sync:uE,toolStats:cE,visualize:fE,storage:dE,license:hE,upgrade:mE},pE={overview:"Overview",health:"Health",graph:"Graph",timeline:"Timeline",evolution:"Evolution",mindmap:"Mindmap",sync:"Cloud Sync",oracle:"Oracle",toolStats:"Tool Stats",visualize:"Visualize",storage:"Storage",settings:"Settings"},yE={confirm:"Confirm",cancel:"Cancel",delete:"Delete",loading:"Loading...",active:"Active",yes:"Yes",no:"No",none:"(none)",neurons:"neurons",brain:"Brain",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",mainNavigation:"Main navigation",lightMode:"Light mode",darkMode:"Dark mode",systemTheme:"System theme"},vE={title:"Overview",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",brains:"Brains",brainList:"Brains",name:"Name",grade:"Grade",status:"Status",actions:"Actions",currentBrain:"Current active brain",switchTo:"Click to switch to {{name}}",deleteBrain:"Delete brain {{name}}",noBrains:"No brains found.",deleteBrainTitle:"Delete Brain",deleteBrainDesc:'Delete brain "{{name}}"? This will remove all neurons, synapses, and fibers permanently. This cannot be undone.',switchedTo:"Switched to brain: {{name}}",switchFailed:"Failed to switch brain",deleted:"Deleted brain: {{name}}",deleteFailed:"Failed to delete brain"},bE={title:"Health",brainMetrics:"Brain Metrics",purity:"Purity",freshness:"Freshness",connectivity:"Connectivity",diversity:"Diversity",consolidation:"Consolidation",activation:"Activation",recall:"Recall",orphanRate:"Orphan Rate",radarName:"Health",warnings:"Warnings & Recommendations",noWarnings:"No warnings. Brain is healthy!",recommendations:"Recommendations",enrichTitle:"How to Enrich Your Brain",enrichDesc:"A richer brain means better recall. Here's how to build detailed neurons and strong synapses.",collapseTips:"Collapse tips",expandTips:"Expand tips",less:"Less",more:"More",topPenalties:"Top Issues Hurting Your Score",noPenalties:"No significant penalties. Keep it up!",penaltyPoints:"{{points}} pts lost",estimatedGain:"+{{gain}} pts if fixed",currentScore:"Current: {{score}}%",weight:"Weight: {{weight}}%",fixAction:"Fix"},SE={rememberTitle:"Ask your agent to remember frequently",rememberTips:['After every decision: "Remember that we chose PostgreSQL over MongoDB for the user service"','After debugging: "Remember the root cause was a race condition in the WebSocket handler"','After meetings: "Remember Alice suggested rate limiting at the API gateway level"','After learning: "Remember that Vite HMR requires export default for React components"'],causalTitle:"Use rich, causal language",causalTips:['BAD: "PostgreSQL" → creates a single flat neuron','GOOD: "We chose PostgreSQL over MongoDB because we need ACID transactions for payment processing" → creates concept + entity + decision neurons with CAUSED_BY synapses',"Include WHY, not just WHAT — causal chains create richer neural connections","Mention people, dates, and context — they become separate neurons linked by synapses"],diverseTitle:"Diverse memory types = stronger recall",diverseTips:['Facts: "The API rate limit is 1000 req/min per user"','Decisions: "We decided to use JWT over sessions because of microservice architecture"',`Errors: "Import failed because the column 'email' was renamed to 'user_email' in v3"`,'Insights: "Pattern: always validate webhook signatures before processing payloads"','Workflows: "Deploy process: lint → test → build → push → verify health check"'],trainTitle:"Train from documents for permanent knowledge",trainTips:["Use smem_train to import docs (PDF, DOCX, MD) — trained memories never decay","Use smem_index to index your codebase — enables code-aware recall","Pin critical memories with smem_pin — they skip decay and consolidation","Use smem_eternal for project-level context that should persist across all sessions"]},xE={title:"Neural Graph",nodes:"Nodes:",networkVisualization:"Network Visualization",nodesCount:"{{nodes}} nodes, {{edges}} edges",noNeurons:"No neurons found in this brain.",concept:"concept",entity:"entity",time:"time",action:"action",state:"state",other:"other"},EE={title:"Timeline",memoryTimeline:"Memory Timeline",entries:"{{total}} entries",noEntries:"No timeline entries.",range7d:"7 Days",range30d:"30 Days",range90d:"90 Days",rangeAll:"All",todayMemories:"Today",totalPeriod:"Total",avgPerDay:"Avg/Day",activeDays:"Active Days",activityTrend:"Activity Trend",neuronDistribution:"Neuron Distribution",recentActivity:"Recent Activity",neurons:"Neurons",fibers:"Fibers",synapses:"Synapses"},TE={title:"Evolution",brainMetrics:"Brain Metrics",maturity:"Maturity",plasticity:"Plasticity",semanticRatio:"Semantic Ratio",totalFibers:"Total Fibers",totalNeurons:"Total Neurons",stageDistribution:"Stage Distribution",shortTerm:"Short Term",working:"Working",episodic:"Episodic",semantic:"Semantic"},OE={title:"Mindmap",fibers:"Fibers",noFibers:"No fibers found.",selectFiber:"Select a Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neurons:",connectionsCount:"Connections:",selectFiberPrompt:"Select a fiber to view its mindmap"},CE={title:"Settings",general:"General",version:"Version",activeBrain:"Active Brain",totalBrains:"Total Brains",brainFiles:"Brain Files",brainsDirectory:"Brains Directory",totalDiskUsage:"Total Disk Usage",telegramBackup:"Telegram Backup",connected:"Connected",chatIds:"Chat IDs",autoBackup:"Auto-backup on consolidation",sendTest:"Send Test",sending:"Sending...",backupNow:"Backup Now",backingUp:"Backing up...",notConfigured:"Not Configured",telegramSetup:"Set NMEM_TELEGRAM_BOT_TOKEN env var and add [telegram] chat_ids to config.toml.",feedbackTitle:"Feedback & Bug Report",reportBug:"Report a Bug",reportBugDesc:"Found something broken? Open an issue with steps to reproduce.",featureRequest:"Feature Request",featureRequestDesc:"Have an idea to improve Surreal-Memory? We'd love to hear it.",discussions:"GitHub Discussions",discussionsDesc:"Questions, tips, and community support.",testSuccess:"Test message sent successfully",testPartial:"Some messages failed to send",testFailed:"Failed to send test message",backupSuccess:"Backup sent! {{brain}} ({{size}}MB) to {{count}} chat(s)",backupSendFailed:"Backup failed to send",backupFailed:"Backup failed",configStatus:"Configuration Status",embeddingConfig:"Embedding Provider",embeddingProvider:"Provider",embeddingModel:"Model",embeddingEnabled:"Enabled",embeddingThreshold:"Similarity Threshold",embeddingTest:"Test Connection",embeddingTesting:"Testing...",embeddingTestOk:"Connection OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Test failed: {{error}}",embeddingSave:"Save",embeddingSaving:"Saving...",embeddingSaved:"Embedding settings saved",embeddingSaveFailed:"Failed to save embedding settings",proFeature:"Pro",watcher:"File Watcher",watcherPaths:"Watched Paths",watcherRecent:"Recent Activity",watcherRunning:"Running",watcherStopped:"Stopped",watcherDisabled:"Disabled",watcherNoActivity:"No recent activity"},NE={title:"Cloud Sync",refresh:"Refresh",connectionStatus:"Connection",status:"Status",cloudConnected:"Connected",notConnected:"Not Connected",hubUrl:"Hub URL",apiKey:"API Key",deviceId:"Device ID",disconnect:"Disconnect",setupCloud:"Connect to Cloud",setupTitle:"Connect to Cloud Hub",setupDesc:"Enter your hub URL and API key to sync memories across devices. Register at the hub to get your key.",keyRequired:"API key is required",keyInvalid:"API key must start with nmk_",keyHint:"Get your key by registering at the hub. It starts with nmk_.",connect:"Connect",connecting:"Connecting...",connected:"Cloud sync connected!",connectFailed:"Failed to connect",disconnected:"Cloud sync disconnected",disconnectFailed:"Failed to disconnect",devices:"Devices",lastSync:"Last sync",never:"Never",noDevices:"No devices registered yet. Sync from a device to register it.",changeLog:"Change Log",totalChanges:"Total Changes",synced:"Synced",pending:"Pending",latestSequence:"Latest Sequence",conflictStrategy:"Conflict Resolution",conflictDesc:"How to resolve when the same memory is changed on multiple devices.",strategyUpdated:"Conflict strategy updated",updateFailed:"Failed to update config",syncMode:"Sync Mode",merkleDelta:"Merkle Delta",fullSync:"Full Sync"},DE={title:"Brain Oracle",loading:"Channeling your memories...",needMore:"Your brain needs more memories",needMoreDesc:"The Oracle requires at least 3 memories to unlock. Ask your AI agent to remember decisions, insights, and learnings — then return for your reading.",dailyHint:"Tap each card to reveal your reading",past:"Past",present:"Present",future:"Future",readingDate:"Reading for {{brain}} on {{date}}",whatifHint:"What if these memories collided?",reshuffle:"Reshuffle",memory:"Memory",wildcard:"Wildcard",matchupComplete:"Matchup Complete!",matchupScoreDesc:"Based on activation strength and connections of your chosen memories",playAgain:"Play Again",round:"Round {{current}} / {{total}}",choose:"Choose",chosen:"Chosen!",score:"Score",dailyReading:"Daily Reading",whatif:"What If",matchup:"Matchup",copyCard:"Copy Card",copied:"Copied!",downloadCard:"Download"},AE={search:"Search...",placeholder:"Search pages, fibers, memories...",noResults:"No results found.",pages:"Pages",fibers:"Fibers",neurons:"Memories",semanticSearch:"Semantic Search — find by meaning",crossBrainSearch:"Cross-Brain Search — search all brains",navigate:"navigate",select:"open",close:"close"},wE={title:"Tool Stats",totalEvents:"Total Events",successRate:"Success Rate",uniqueTools:"Unique Tools",topTools:"Top Tools",usageOverTime:"Usage Over Time",detailTable:"Tool Details",tool:"Tool",calls:"Calls",avgDuration:"Avg Duration",server:"Server",noData:"No tool events recorded yet. Use Surreal-Memory tools to start tracking."},RE={title:"Memory Visualizer",description:"Query your memories and generate charts from stored data."},zE={title:"Storage",currentBackend:"Current Backend",brain:"Brain",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",tierDistribution:"Memory Tiers",tierHot:"HOT — Always in context",tierWarm:"WARM — Semantic match",tierCold:"COLD — Explicit recall only",totalMemories:"Total typed memories"},ME={tier:"License",pro_badge:"PRO",pro_feature:"Pro Feature",free:"Free",pro:"Pro",team:"Team"},_E={title:"Get Surreal-Memory Pro",subtitle:"Choose your payment method",enterKey:"Enter your license key",enterEmail:"Enter your email for the license:",orActivate:"or activate a key",haveKey:"I already have a license key",licenseKey:"License Key",activate:"Activate",activated:"Pro activated!",activationFailed:"Activation failed. Check your key.",back:"Back"},jE={nav:pE,common:yE,overview:vE,health:bE,enrichment:SE,graph:xE,timeline:EE,evolution:TE,diagrams:OE,settings:CE,sync:NE,oracle:DE,commandPalette:AE,toolStats:wE,visualize:RE,storage:zE,license:ME,upgrade:_E};dt.use(mp).use(f0).init({resources:{vi:{translation:gE},en:{translation:jE}},fallbackLng:"en",detection:{order:["localStorage","navigator"],lookupLocalStorage:"smem-lang",caches:["localStorage"]},interpolation:{escapeValue:!1}});const LE=new Nv({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});Iv.createRoot(document.getElementById("root")).render(T.jsx(v.StrictMode,{children:T.jsx(Dv,{client:LE,children:T.jsxs(Lv,{basename:window.location.pathname.startsWith("/dashboard")?"/dashboard":"/ui",children:[T.jsx(Lx,{}),T.jsx(Cb,{position:"bottom-right",toastOptions:{className:"bg-card text-card-foreground border-border"}})]})})}));export{Li as A,Mi as B,Xt as _,PE as a,L0 as b,z0 as c,KE as d,YE as e,JE as f,GE as g,$E as h,XE as i,QE as j,ZE as k,_0 as l,FE as m,qe as n,e2 as o,t2 as p,a2 as q,n2 as r,M0 as s,VE as t,xr as u,IE as v,i2 as w,Im as x,WE as y,l2 as z}; +For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return v.useEffect(()=>{i&&(document.getElementById(i)||console.error(r))},[r,i]),null},Z1="DialogDescriptionWarning",F1=({contentRef:i,descriptionId:l})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lp(Z1).contentName}}.`;return v.useEffect(()=>{const c=i.current?.getAttribute("aria-describedby");l&&c&&(document.getElementById(l)||console.warn(o))},[o,i,l]),null},$1=Fg,J1=Wg,W1=Ig,I1=Pg,P1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ua=P1.reduce((i,l)=>{const r=Ag(`Primitive.${l}`),o=v.forwardRef((c,f)=>{const{asChild:m,...h}=c,b=m?r:l;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(b,{...h,ref:f})});return o.displayName=`Primitive.${l}`,{...i,[l]:o}},{}),zi='[cmdk-group=""]',ec='[cmdk-group-items=""]',ex='[cmdk-group-heading=""]',ip='[cmdk-item=""]',Wm=`${ip}:not([aria-disabled="true"])`,uc="cmdk-item-select",zl="data-value",tx=(i,l,r)=>G0(i,l,r),sp=v.createContext(void 0),Vi=()=>v.useContext(sp),rp=v.createContext(void 0),pc=()=>v.useContext(rp),op=v.createContext(void 0),up=v.forwardRef((i,l)=>{let r=Ml(()=>{var _,k;return{search:"",value:(k=(_=i.value)!=null?_:i.defaultValue)!=null?k:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ml(()=>new Set),c=Ml(()=>new Map),f=Ml(()=>new Map),m=Ml(()=>new Set),h=cp(i),{label:b,children:y,value:x,onValueChange:g,filter:A,shouldFilter:z,loop:j,disablePointerSelection:U=!1,vimBindings:Y=!0,...B}=i,Q=Mn(),Z=Mn(),I=Mn(),ee=v.useRef(null),$=dx();Ba(()=>{if(x!==void 0){let _=x.trim();r.current.value=_,X.emit()}},[x]),Ba(()=>{$(6,Ee)},[]);let X=v.useMemo(()=>({subscribe:_=>(m.current.add(_),()=>m.current.delete(_)),snapshot:()=>r.current,setState:(_,k,G)=>{var K,le,Se,ue;if(!Object.is(r.current[_],k)){if(r.current[_]=k,_==="search")re(),te(),$(1,fe);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let De=document.getElementById(I);De?De.focus():(K=document.getElementById(Q))==null||K.focus()}if($(7,()=>{var De;r.current.selectedItemId=(De=Te())==null?void 0:De.id,X.emit()}),G||$(5,Ee),((le=h.current)==null?void 0:le.value)!==void 0){let De=k??"";(ue=(Se=h.current).onValueChange)==null||ue.call(Se,De);return}}X.emit()}},emit:()=>{m.current.forEach(_=>_())}}),[]),ye=v.useMemo(()=>({value:(_,k,G)=>{var K;k!==((K=f.current.get(_))==null?void 0:K.value)&&(f.current.set(_,{value:k,keywords:G}),r.current.filtered.items.set(_,ae(k,G)),$(2,()=>{te(),X.emit()}))},item:(_,k)=>(o.current.add(_),k&&(c.current.has(k)?c.current.get(k).add(_):c.current.set(k,new Set([_]))),$(3,()=>{re(),te(),r.current.value||fe(),X.emit()}),()=>{f.current.delete(_),o.current.delete(_),r.current.filtered.items.delete(_);let G=Te();$(4,()=>{re(),G?.getAttribute("id")===_&&fe(),X.emit()})}),group:_=>(c.current.has(_)||c.current.set(_,new Set),()=>{f.current.delete(_),c.current.delete(_)}),filter:()=>h.current.shouldFilter,label:b||i["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:Q,inputId:I,labelId:Z,listInnerRef:ee}),[]);function ae(_,k){var G,K;let le=(K=(G=h.current)==null?void 0:G.filter)!=null?K:tx;return _?le(_,r.current.search,k):0}function te(){if(!r.current.search||h.current.shouldFilter===!1)return;let _=r.current.filtered.items,k=[];r.current.filtered.groups.forEach(K=>{let le=c.current.get(K),Se=0;le.forEach(ue=>{let De=_.get(ue);Se=Math.max(De,Se)}),k.push([K,Se])});let G=ee.current;je().sort((K,le)=>{var Se,ue;let De=K.getAttribute("id"),Ct=le.getAttribute("id");return((Se=_.get(Ct))!=null?Se:0)-((ue=_.get(De))!=null?ue:0)}).forEach(K=>{let le=K.closest(ec);le?le.appendChild(K.parentElement===le?K:K.closest(`${ec} > *`)):G.appendChild(K.parentElement===G?K:K.closest(`${ec} > *`))}),k.sort((K,le)=>le[1]-K[1]).forEach(K=>{var le;let Se=(le=ee.current)==null?void 0:le.querySelector(`${zi}[${zl}="${encodeURIComponent(K[0])}"]`);Se?.parentElement.appendChild(Se)})}function fe(){let _=je().find(G=>G.getAttribute("aria-disabled")!=="true"),k=_?.getAttribute(zl);X.setState("value",k||void 0)}function re(){var _,k,G,K;if(!r.current.search||h.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let le=0;for(let Se of o.current){let ue=(k=(_=f.current.get(Se))==null?void 0:_.value)!=null?k:"",De=(K=(G=f.current.get(Se))==null?void 0:G.keywords)!=null?K:[],Ct=ae(ue,De);r.current.filtered.items.set(Se,Ct),Ct>0&&le++}for(let[Se,ue]of c.current)for(let De of ue)if(r.current.filtered.items.get(De)>0){r.current.filtered.groups.add(Se);break}r.current.filtered.count=le}function Ee(){var _,k,G;let K=Te();K&&(((_=K.parentElement)==null?void 0:_.firstChild)===K&&((G=(k=K.closest(zi))==null?void 0:k.querySelector(ex))==null||G.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function Te(){var _;return(_=ee.current)==null?void 0:_.querySelector(`${ip}[aria-selected="true"]`)}function je(){var _;return Array.from(((_=ee.current)==null?void 0:_.querySelectorAll(Wm))||[])}function D(_){let k=je()[_];k&&X.setState("value",k.getAttribute(zl))}function q(_){var k;let G=Te(),K=je(),le=K.findIndex(ue=>ue===G),Se=K[le+_];(k=h.current)!=null&&k.loop&&(Se=le+_<0?K[K.length-1]:le+_===K.length?K[0]:K[le+_]),Se&&X.setState("value",Se.getAttribute(zl))}function J(_){let k=Te(),G=k?.closest(zi),K;for(;G&&!K;)G=_>0?cx(G,zi):fx(G,zi),K=G?.querySelector(Wm);K?X.setState("value",K.getAttribute(zl)):q(_)}let de=()=>D(je().length-1),oe=_=>{_.preventDefault(),_.metaKey?de():_.altKey?J(1):q(1)},me=_=>{_.preventDefault(),_.metaKey?D(0):_.altKey?J(-1):q(-1)};return v.createElement(ua.div,{ref:l,tabIndex:-1,...B,"cmdk-root":"",onKeyDown:_=>{var k;(k=B.onKeyDown)==null||k.call(B,_);let G=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||G))switch(_.key){case"n":case"j":{Y&&_.ctrlKey&&oe(_);break}case"ArrowDown":{oe(_);break}case"p":case"k":{Y&&_.ctrlKey&&me(_);break}case"ArrowUp":{me(_);break}case"Home":{_.preventDefault(),D(0);break}case"End":{_.preventDefault(),de();break}case"Enter":{_.preventDefault();let K=Te();if(K){let le=new Event(uc);K.dispatchEvent(le)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:ye.inputId,id:ye.labelId,style:mx},b),Cr(i,_=>v.createElement(rp.Provider,{value:X},v.createElement(sp.Provider,{value:ye},_))))}),nx=v.forwardRef((i,l)=>{var r,o;let c=Mn(),f=v.useRef(null),m=v.useContext(op),h=Vi(),b=cp(i),y=(o=(r=b.current)==null?void 0:r.forceMount)!=null?o:m?.forceMount;Ba(()=>{if(!y)return h.item(c,m?.id)},[y]);let x=fp(c,f,[i.value,i.children,f],i.keywords),g=pc(),A=oa($=>$.value&&$.value===x.current),z=oa($=>y||h.filter()===!1?!0:$.search?$.filtered.items.get(c)>0:!0);v.useEffect(()=>{let $=f.current;if(!(!$||i.disabled))return $.addEventListener(uc,j),()=>$.removeEventListener(uc,j)},[z,i.onSelect,i.disabled]);function j(){var $,X;U(),(X=($=b.current).onSelect)==null||X.call($,x.current)}function U(){g.setState("value",x.current,!0)}if(!z)return null;let{disabled:Y,value:B,onSelect:Q,forceMount:Z,keywords:I,...ee}=i;return v.createElement(ua.div,{ref:Pt(f,l),...ee,id:c,"cmdk-item":"",role:"option","aria-disabled":!!Y,"aria-selected":!!A,"data-disabled":!!Y,"data-selected":!!A,onPointerMove:Y||h.getDisablePointerSelection()?void 0:U,onClick:Y?void 0:j},i.children)}),ax=v.forwardRef((i,l)=>{let{heading:r,children:o,forceMount:c,...f}=i,m=Mn(),h=v.useRef(null),b=v.useRef(null),y=Mn(),x=Vi(),g=oa(z=>c||x.filter()===!1?!0:z.search?z.filtered.groups.has(m):!0);Ba(()=>x.group(m),[]),fp(m,h,[i.value,i.heading,b]);let A=v.useMemo(()=>({id:m,forceMount:c}),[c]);return v.createElement(ua.div,{ref:Pt(h,l),...f,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":!0,id:y},r),Cr(i,z=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?y:void 0},v.createElement(op.Provider,{value:A},z))))}),lx=v.forwardRef((i,l)=>{let{alwaysRender:r,...o}=i,c=v.useRef(null),f=oa(m=>!m.search);return!r&&!f?null:v.createElement(ua.div,{ref:Pt(c,l),...o,"cmdk-separator":"",role:"separator"})}),ix=v.forwardRef((i,l)=>{let{onValueChange:r,...o}=i,c=i.value!=null,f=pc(),m=oa(y=>y.search),h=oa(y=>y.selectedItemId),b=Vi();return v.useEffect(()=>{i.value!=null&&f.setState("search",i.value)},[i.value]),v.createElement(ua.input,{ref:l,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":h,id:b.inputId,type:"text",value:c?i.value:m,onChange:y=>{c||f.setState("search",y.target.value),r?.(y.target.value)}})}),sx=v.forwardRef((i,l)=>{let{children:r,label:o="Suggestions",...c}=i,f=v.useRef(null),m=v.useRef(null),h=oa(y=>y.selectedItemId),b=Vi();return v.useEffect(()=>{if(m.current&&f.current){let y=m.current,x=f.current,g,A=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let z=y.offsetHeight;x.style.setProperty("--cmdk-list-height",z.toFixed(1)+"px")})});return A.observe(y),()=>{cancelAnimationFrame(g),A.unobserve(y)}}},[]),v.createElement(ua.div,{ref:Pt(f,l),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":o,id:b.listId},Cr(i,y=>v.createElement("div",{ref:Pt(m,b.listInnerRef),"cmdk-list-sizer":""},y)))}),rx=v.forwardRef((i,l)=>{let{open:r,onOpenChange:o,overlayClassName:c,contentClassName:f,container:m,...h}=i;return v.createElement($1,{open:r,onOpenChange:o},v.createElement(J1,{container:m},v.createElement(W1,{"cmdk-overlay":"",className:c}),v.createElement(I1,{"aria-label":i.label,"cmdk-dialog":"",className:f},v.createElement(up,{ref:l,...h}))))}),ox=v.forwardRef((i,l)=>oa(r=>r.filtered.count===0)?v.createElement(ua.div,{ref:l,...i,"cmdk-empty":"",role:"presentation"}):null),ux=v.forwardRef((i,l)=>{let{progress:r,children:o,label:c="Loading...",...f}=i;return v.createElement(ua.div,{ref:l,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},Cr(i,m=>v.createElement("div",{"aria-hidden":!0},m)))}),jt=Object.assign(up,{List:sx,Item:nx,Input:ix,Group:ax,Separator:lx,Dialog:rx,Empty:ox,Loading:ux});function cx(i,l){let r=i.nextElementSibling;for(;r;){if(r.matches(l))return r;r=r.nextElementSibling}}function fx(i,l){let r=i.previousElementSibling;for(;r;){if(r.matches(l))return r;r=r.previousElementSibling}}function cp(i){let l=v.useRef(i);return Ba(()=>{l.current=i}),l}var Ba=typeof window>"u"?v.useEffect:v.useLayoutEffect;function Ml(i){let l=v.useRef();return l.current===void 0&&(l.current=i()),l}function oa(i){let l=pc(),r=()=>i(l.snapshot());return v.useSyncExternalStore(l.subscribe,r,r)}function fp(i,l,r,o=[]){let c=v.useRef(),f=Vi();return Ba(()=>{var m;let h=(()=>{var y;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(y=x.current.textContent)==null?void 0:y.trim():c.current}})(),b=o.map(y=>y.trim());f.value(i,h,b),(m=l.current)==null||m.setAttribute(zl,h),c.current=h}),c}var dx=()=>{let[i,l]=v.useState(),r=Ml(()=>new Map);return Ba(()=>{r.current.forEach(o=>o()),r.current=new Map},[i]),(o,c)=>{r.current.set(o,c),l({})}};function hx(i){let l=i.type;return typeof l=="function"?l(i.props):"render"in l?l.render(i.props):i}function Cr({asChild:i,children:l},r){return i&&v.isValidElement(l)?v.cloneElement(hx(l),{ref:l.ref},r(l.props.children)):r(l)}var mx={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const gx="https://pay.theio.vn",px={vn:{product:"NM-PRO-YEARLY",original:"1.190.000 VND",price:"595.000 VND",method:"Bank Transfer (VietQR)",flag:"🇻🇳"},intl:{product:"NM-PRO-YEARLY",original:"$89 USD",price:"$49 USD",method:"Card / PayPal (Polar)",flag:"🌐"}};let cc=null;function Im(){cc?.()}function yx(){const[i,l]=v.useState(!1),[r,o]=v.useState("choose"),[c,f]=v.useState(""),[m,h]=v.useState(!1),[b,y]=v.useState(!1),[x,g]=v.useState(""),{t:A}=xr();return v.useEffect(()=>(cc=()=>l(!0),()=>{cc=null}),[]),v.useEffect(()=>{i||(o("choose"),f(""),g(""),y(!1))},[i]),v.useEffect(()=>{if(!i)return;const z=j=>{j.key==="Escape"&&l(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),v.useCallback(async z=>{const j=px[z],U=prompt(A("upgrade.enterEmail","Enter your email for the license:"));if(U){try{const Q=await(await fetch(`${gx}${z==="intl"?"/checkout/polar":"/order/sepay"}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product:j.product,email:U})})).json();Q.url?window.open(Q.url,"_blank"):Q.qr_url&&window.open(Q.qr_url,"_blank")}catch{z==="intl"&&window.open("https://polar.sh/nhadaututtheky","_blank")}l(!1)}},[A]),v.useCallback(async()=>{const z=c.trim();if(z){h(!0),g("");try{const j=await qe.post("/api/dashboard/license/activate",{license_key:z});j.success?(y(!0),setTimeout(()=>{l(!1),window.location.reload()},1500)):g(j.error||A("upgrade.activationFailed","Activation failed"))}catch{g(A("upgrade.activationFailed","Activation failed. Check key format."))}finally{h(!1)}}},[c,A]),null}const vx=[{path:"/",icon:og,labelKey:"nav.overview"},{path:"/health",icon:ug,labelKey:"nav.health"},{path:"/graph",icon:cg,labelKey:"nav.graph"},{path:"/timeline",icon:fg,labelKey:"nav.timeline"},{path:"/evolution",icon:dg,labelKey:"nav.evolution"},{path:"/diagrams",icon:hg,labelKey:"nav.mindmap"},{path:"/sync",icon:mg,labelKey:"nav.sync"},{path:"/oracle",icon:gg,labelKey:"nav.oracle"},{path:"/tool-stats",icon:pg,labelKey:"nav.toolStats"},{path:"/settings",icon:yg,labelKey:"nav.settings"}],Pm={fact:"#06b6d4",decision:"#f59e0b",error:"#ef4444",insight:"#8b5cf6",preference:"#ec4899",workflow:"#059669",instruction:"#6366f1",pattern:"#14b8a6",concept:"#6366f1",entity:"#06b6d4"};function bx(){const[i,l]=v.useState(!1),[r,o]=v.useState(""),[c,f]=v.useState([]),[m,h]=v.useState(!1),b=v.useRef(null),y=zv(),{data:x}=_0(),{t:g}=xr();v.useEffect(()=>{const B=Q=>{(Q.metaKey||Q.ctrlKey)&&Q.key==="k"&&(Q.preventDefault(),l(Z=>!Z))};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[]),v.useEffect(()=>{i||(o(""),f([]))},[i]);const A=v.useCallback(B=>{if(b.current&&clearTimeout(b.current),B.length<2){f([]),h(!1);return}h(!0),b.current=setTimeout(async()=>{try{const Q=await qe.get(`/neurons?content_contains=${encodeURIComponent(B)}&limit=8`);f(Q.neurons??[])}catch{f([])}finally{h(!1)}},300)},[]),z=B=>{o(B),A(B)},j=B=>{y(B),l(!1)},U=x?.fibers??[],Y=r.length>0?U.filter(B=>B.summary.toLowerCase().includes(r.toLowerCase())):U.slice(0,5);return T.jsxs(T.Fragment,{children:[T.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground cursor-pointer","aria-label":g("commandPalette.placeholder"),children:[T.jsx(um,{className:"size-3.5","aria-hidden":"true"}),T.jsx("span",{className:"hidden sm:inline",children:g("commandPalette.search")}),T.jsxs("kbd",{className:"pointer-events-none hidden select-none rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium sm:inline-flex",children:[T.jsx(Hv,{className:"mr-0.5 inline size-2.5","aria-hidden":"true"}),"K"]})]}),i&&sg.createPortal(T.jsx("div",{className:"fixed inset-0 z-[100] flex items-start justify-center pt-[15vh] bg-black/50 backdrop-blur-sm",onClick:B=>{B.target===B.currentTarget&&l(!1)},children:T.jsxs(jt,{className:"w-full max-w-lg rounded-xl border border-border bg-card shadow-lg overflow-hidden",shouldFilter:!1,children:[T.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[T.jsx(um,{className:"mr-2 size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),T.jsx(jt.Input,{value:r,onValueChange:z,placeholder:g("commandPalette.placeholder"),className:"flex h-11 w-full bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"}),m&&T.jsx("div",{className:"size-4 shrink-0 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})]}),T.jsxs(jt.List,{className:"max-h-80 overflow-y-auto px-2 py-2",children:[T.jsx(jt.Empty,{className:"py-6 text-center text-sm text-muted-foreground",children:g("commandPalette.noResults")}),T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.pages")}),children:vx.map(({path:B,icon:Q,labelKey:Z})=>T.jsxs(jt.Item,{value:`page-${g(Z)}`,onSelect:()=>j(B),className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(Q,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{children:g(Z)})]},B))}),Y.length>0&&T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.fibers")}),children:Y.slice(0,6).map(B=>T.jsxs(jt.Item,{value:`fiber-${B.summary}`,onSelect:()=>{y("/diagrams"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(kv,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1 truncate",children:B.summary}),T.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:B.neuron_count})]},B.id))}),c.length>0&&T.jsx(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("commandPalette.neurons")}),children:c.map(B=>T.jsxs(jt.Item,{value:`neuron-${B.id}`,onSelect:()=>{y("/graph"),l(!1)},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm cursor-pointer aria-selected:bg-accent",children:[T.jsx(rg,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1 truncate text-xs",children:B.content}),T.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{backgroundColor:`${Pm[B.type]??"#94a3b8"}20`,color:Pm[B.type]??"#94a3b8"},children:B.type})]},B.id))}),T.jsxs(jt.Group,{heading:T.jsx("span",{className:"px-2 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Pro"}),children:[T.jsxs(jt.Item,{value:"pro-semantic-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[T.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1",children:g("commandPalette.semanticSearch")}),T.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]}),T.jsxs(jt.Item,{value:"pro-cross-brain-search",onSelect:()=>{l(!1),Im()},className:"flex items-center gap-3 rounded-lg px-3 py-2 text-sm opacity-60 cursor-pointer aria-selected:bg-accent aria-selected:opacity-100",children:[T.jsx(cm,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),T.jsx("span",{className:"flex-1",children:g("commandPalette.crossBrainSearch")}),T.jsx("span",{className:"rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"PRO"})]})]})]}),T.jsx("div",{className:"flex items-center justify-between border-t border-border px-4 py-2",children:T.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↑↓"})," ",g("commandPalette.navigate")]}),T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"↵"})," ",g("commandPalette.select")]}),T.jsxs("span",{children:[T.jsx("kbd",{className:"rounded border border-border bg-muted px-1 py-0.5 font-mono",children:"esc"})," ",g("commandPalette.close")]})]})})]})}),document.body)]})}const Sx={light:Gv,dark:Yv,system:Kv},eg={light:"common.lightMode",dark:"common.darkMode",system:"common.systemTheme"};function xx(){const{sidebarOpen:i,toggleSidebar:l,theme:r,cycleTheme:o}=br(),{data:c}=z0(),{data:f}=M0(),{t:m,i18n:h}=xr(),b=Sx[r],y=h.language?.startsWith("vi")?"vi":"en",x=()=>{const g=y==="vi"?"en":"vi";h.changeLanguage(g)};return T.jsxs("header",{className:"sticky top-0 z-20 flex h-14 items-center gap-4 border-b border-border bg-background/80 px-4 backdrop-blur-sm",children:[T.jsx(Mi,{variant:"ghost",size:"icon",onClick:l,"aria-label":m(i?"common.collapseSidebar":"common.expandSidebar"),children:i?T.jsx(fm,{className:"size-5",weight:"bold"}):T.jsx(fm,{className:"size-5"})}),c?.active_brain&&T.jsxs("div",{className:"flex items-center gap-2",children:[T.jsxs("span",{className:"text-sm text-muted-foreground",children:[m("common.brain"),":"]}),T.jsx(L0,{variant:"secondary",className:"font-mono text-xs",children:c.active_brain})]}),T.jsx(bx,{}),T.jsx("div",{className:"flex-1"}),T.jsx(Mi,{variant:"ghost",size:"icon",asChild:!0,"aria-label":"Quickstart Guide",title:"Quickstart Guide",children:T.jsx("a",{href:"https://github.com/acidkill/surreal-memory/blob/main/docs/guides/quickstart-guide.md",target:"_blank",rel:"noopener noreferrer",children:T.jsx(qv,{className:"size-4"})})}),T.jsxs(Mi,{variant:"ghost",size:"sm",onClick:x,className:"gap-1.5 px-2 text-xs font-medium","aria-label":"Switch language",children:[T.jsx(Vv,{className:"size-3.5"}),y==="vi"?"VI":"EN"]}),T.jsx(Mi,{variant:"ghost",size:"icon",onClick:o,"aria-label":m(eg[r]),title:m(eg[r]),"data-testid":"theme-toggle",children:T.jsx(b,{className:"size-4"})}),f?.version&&T.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",f.version]})]})}function Ex(){const i=br(l=>l.sidebarOpen);return T.jsxs("div",{className:"h-screen bg-background overflow-hidden",children:[T.jsx(b0,{}),T.jsxs("div",{className:Li("flex flex-col h-full transition-all duration-[var(--transition-normal)]",i?"ml-56":"ml-16"),children:[T.jsx(xx,{}),T.jsx("main",{className:"flex-1 overflow-auto",children:T.jsx(Mv,{})})]}),T.jsx(yx,{})]})}function Qt(){return T.jsxs("div",{className:"space-y-6 p-6 animate-pulse",children:[T.jsx("div",{className:"h-8 w-48 rounded-lg bg-muted"}),T.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((i,l)=>T.jsx("div",{className:"h-28 rounded-xl bg-muted"},l))}),T.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[T.jsx("div",{className:"h-64 rounded-xl bg-muted"}),T.jsx("div",{className:"h-64 rounded-xl bg-muted"})]})]})}const Tx=v.lazy(()=>Xt(()=>import("./OverviewPage-uovTY60B.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Ox=v.lazy(()=>Xt(()=>import("./HealthPage-9CH7uxp0.js"),__vite__mapDeps([8,1,2,3,4,5,7,6]))),Cx=v.lazy(()=>Xt(()=>import("./GraphPage-CrI1ELz_.js"),__vite__mapDeps([9,1,2,3,4,5,6,7]))),Nx=v.lazy(()=>Xt(()=>import("./TimelinePage-C2MQrnce.js"),__vite__mapDeps([10,1,2,3,4,5,7,6]))),Dx=v.lazy(()=>Xt(()=>import("./EvolutionPage-CzD9dgSX.js"),__vite__mapDeps([11,1,2,12,3,4,7,6,5]))),Ax=v.lazy(()=>Xt(()=>import("./DiagramsPage-DbhaKtcI.js"),__vite__mapDeps([13,1,2,3,4,14,7,6,5,15]))),wx=v.lazy(()=>Xt(()=>import("./SettingsPage-BwQ0sSKJ.js"),__vite__mapDeps([16,1,2,3,5,4,12,6,7]))),Rx=v.lazy(()=>Xt(()=>import("./SyncPage-CNbeBod6.js"),__vite__mapDeps([17,1,2,3,5,6,7]))),zx=v.lazy(()=>Xt(()=>import("./OraclePage--QnA7bus.js"),__vite__mapDeps([18,1,2,5,6,7]))),Mx=v.lazy(()=>Xt(()=>import("./ToolStatsPage-zZWqg3RV.js"),__vite__mapDeps([19,1,2,3,4,7,6,5]))),_x=v.lazy(()=>Xt(()=>import("./VisualizePage-D-CKRU7v.js"),__vite__mapDeps([20,1,2,12,3,5,6,7]))),jx=v.lazy(()=>Xt(()=>import("./StoragePage-Dfp1G5qu.js"),__vite__mapDeps([21,1,2,3,5,4,6,7])));function Lx(){return T.jsx(_v,{children:T.jsxs(Tt,{element:T.jsx(Ex,{}),children:[T.jsx(Tt,{index:!0,element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Tx,{})})}),T.jsx(Tt,{path:"health",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Ox,{})})}),T.jsx(Tt,{path:"graph",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Cx,{})})}),T.jsx(Tt,{path:"timeline",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Nx,{})})}),T.jsx(Tt,{path:"evolution",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Dx,{})})}),T.jsx(Tt,{path:"diagrams",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Ax,{})})}),T.jsx(Tt,{path:"settings",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(wx,{})})}),T.jsx(Tt,{path:"sync",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Rx,{})})}),T.jsx(Tt,{path:"oracle",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(zx,{})})}),T.jsx(Tt,{path:"tool-stats",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(Mx,{})})}),T.jsx(Tt,{path:"visualize",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(_x,{})})}),T.jsx(Tt,{path:"storage",element:T.jsx(v.Suspense,{fallback:T.jsx(Qt,{}),children:T.jsx(jx,{})})}),T.jsx(Tt,{path:"*",element:T.jsx(jv,{to:"/",replace:!0})})]})})}const{slice:Bx,forEach:Ux}=[];function Hx(i){return Ux.call(Bx.call(arguments,1),l=>{if(l)for(const r in l)i[r]===void 0&&(i[r]=l[r])}),i}function kx(i){return typeof i!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(r=>r.test(i))}const tg=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,qx=function(i,l){const o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},c=encodeURIComponent(l);let f=`${i}=${c}`;if(o.maxAge>0){const m=o.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");f+=`; Max-Age=${Math.floor(m)}`}if(o.domain){if(!tg.test(o.domain))throw new TypeError("option domain is invalid");f+=`; Domain=${o.domain}`}if(o.path){if(!tg.test(o.path))throw new TypeError("option path is invalid");f+=`; Path=${o.path}`}if(o.expires){if(typeof o.expires.toUTCString!="function")throw new TypeError("option expires is invalid");f+=`; Expires=${o.expires.toUTCString()}`}if(o.httpOnly&&(f+="; HttpOnly"),o.secure&&(f+="; Secure"),o.sameSite)switch(typeof o.sameSite=="string"?o.sameSite.toLowerCase():o.sameSite){case!0:f+="; SameSite=Strict";break;case"lax":f+="; SameSite=Lax";break;case"strict":f+="; SameSite=Strict";break;case"none":f+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return o.partitioned&&(f+="; Partitioned"),f},ng={create(i,l,r,o){let c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(c.expires=new Date,c.expires.setTime(c.expires.getTime()+r*60*1e3)),o&&(c.domain=o),document.cookie=qx(i,l,c)},read(i){const l=`${i}=`,r=document.cookie.split(";");for(let o=0;o-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const f=o.substring(1).split("&");for(let m=0;m0&&f[m].substring(0,h)===l&&(r=f[m].substring(h+1))}}return r}},Yx={name:"hash",lookup(i){let{lookupHash:l,lookupFromHashIndex:r}=i,o;if(typeof window<"u"){const{hash:c}=window.location;if(c&&c.length>2){const f=c.substring(1);if(l){const m=f.split("&");for(let h=0;h0&&m[h].substring(0,b)===l&&(o=m[h].substring(b+1))}}if(o)return o;if(!o&&r>-1){const m=c.match(/\/([a-zA-Z-]*)/g);return Array.isArray(m)?m[typeof r=="number"?r:0]?.replace("/",""):void 0}}}return o}};let wl=null;const ag=()=>{if(wl!==null)return wl;try{if(wl=typeof window<"u"&&window.localStorage!==null,!wl)return!1;const i="i18next.translate.boo";window.localStorage.setItem(i,"foo"),window.localStorage.removeItem(i)}catch{wl=!1}return wl};var Gx={name:"localStorage",lookup(i){let{lookupLocalStorage:l}=i;if(l&&ag())return window.localStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupLocalStorage:r}=l;r&&ag()&&window.localStorage.setItem(r,i)}};let Rl=null;const lg=()=>{if(Rl!==null)return Rl;try{if(Rl=typeof window<"u"&&window.sessionStorage!==null,!Rl)return!1;const i="i18next.translate.boo";window.sessionStorage.setItem(i,"foo"),window.sessionStorage.removeItem(i)}catch{Rl=!1}return Rl};var Qx={name:"sessionStorage",lookup(i){let{lookupSessionStorage:l}=i;if(l&&lg())return window.sessionStorage.getItem(l)||void 0},cacheUserLanguage(i,l){let{lookupSessionStorage:r}=l;r&&lg()&&window.sessionStorage.setItem(r,i)}},Xx={name:"navigator",lookup(i){const l=[];if(typeof navigator<"u"){const{languages:r,userLanguage:o,language:c}=navigator;if(r)for(let f=0;f0?l:void 0}},Zx={name:"htmlTag",lookup(i){let{htmlTag:l}=i,r;const o=l||(typeof document<"u"?document.documentElement:null);return o&&typeof o.getAttribute=="function"&&(r=o.getAttribute("lang")),r}},Fx={name:"path",lookup(i){let{lookupFromPathIndex:l}=i;if(typeof window>"u")return;const r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(r)?r[typeof l=="number"?l:0]?.replace("/",""):void 0}},$x={name:"subdomain",lookup(i){let{lookupFromSubdomainIndex:l}=i;const r=typeof l=="number"?l+1:1,o=typeof window<"u"&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(o)return o[r]}};let dp=!1;try{document.cookie,dp=!0}catch{}const hp=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];dp||hp.splice(1,1);const Jx=()=>({order:hp,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:i=>i});class mp{constructor(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(l,r)}init(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=l,this.options=Hx(r,this.options||{},Jx()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=c=>c.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=o,this.addDetector(Vx),this.addDetector(Kx),this.addDetector(Gx),this.addDetector(Qx),this.addDetector(Xx),this.addDetector(Zx),this.addDetector(Fx),this.addDetector($x),this.addDetector(Yx)}addDetector(l){return this.detectors[l.name]=l,this}detect(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,r=[];return l.forEach(o=>{if(this.detectors[o]){let c=this.detectors[o].lookup(this.options);c&&typeof c=="string"&&(c=[c]),c&&(r=r.concat(c))}}),r=r.filter(o=>o!=null&&!kx(o)).map(o=>this.options.convertDetectedLanguage(o)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?r:r.length>0?r[0]:null}cacheUserLanguage(l){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(l)>-1||r.forEach(o=>{this.detectors[o]&&this.detectors[o].cacheUserLanguage(l,this.options)}))}}mp.type="languageDetector";const Wx={overview:"Tổng quan",health:"Sức khỏe",graph:"Đồ thị",timeline:"Dòng thời gian",evolution:"Tiến hóa",mindmap:"Sơ đồ tư duy",oracle:"Tiên tri",toolStats:"Thống kê công cụ",visualize:"Trực quan",sync:"Đồng bộ",storage:"Lưu trữ",settings:"Cài đặt"},Ix={confirm:"Xác nhận",cancel:"Hủy",delete:"Xóa",loading:"Đang tải...",active:"Đang dùng",yes:"Có",no:"Không",none:"(trống)",neurons:"neuron",brain:"Bộ não",collapseSidebar:"Thu gọn thanh bên",expandSidebar:"Mở rộng thanh bên",mainNavigation:"Điều hướng chính",lightMode:"Chế độ sáng",darkMode:"Chế độ tối",systemTheme:"Theo hệ thống"},Px={title:"Tổng quan",neurons:"Neuron",synapses:"Synapse",fibers:"Fiber",brains:"Bộ não",brainList:"Danh sách bộ não",name:"Tên",grade:"Hạng",status:"Trạng thái",actions:"Thao tác",currentBrain:"Bộ não đang dùng",switchTo:"Nhấn để chuyển sang {{name}}",deleteBrain:"Xóa bộ não {{name}}",noBrains:"Không tìm thấy bộ não nào.",deleteBrainTitle:"Xóa bộ não",deleteBrainDesc:'Xóa bộ não "{{name}}"? Tất cả neuron, synapse và fiber sẽ bị xóa vĩnh viễn. Không thể hoàn tác.',switchedTo:"Đã chuyển sang: {{name}}",switchFailed:"Chuyển bộ não thất bại",deleted:"Đã xóa bộ não: {{name}}",deleteFailed:"Xóa bộ não thất bại"},eE={title:"Sức khỏe",brainMetrics:"Chỉ số bộ não",purity:"Độ tinh khiết",freshness:"Độ mới",connectivity:"Kết nối",diversity:"Đa dạng",consolidation:"Tổng hợp",activation:"Kích hoạt",recall:"Nhớ lại",orphanRate:"Tỷ lệ mồ côi",radarName:"Sức khỏe",warnings:"Cảnh báo & Khuyến nghị",noWarnings:"Không có cảnh báo. Bộ não khỏe mạnh!",recommendations:"Khuyến nghị",enrichTitle:"Cách làm giàu bộ não",enrichDesc:"Bộ não càng phong phú thì khả năng nhớ lại càng tốt. Đây là cách xây dựng neuron chi tiết và synapse mạnh mẽ.",collapseTips:"Thu gọn mẹo",expandTips:"Mở rộng mẹo",less:"Ít hơn",more:"Thêm",topPenalties:"Vấn đề chính ảnh hưởng điểm số",noPenalties:"Không có vấn đề đáng kể. Tiếp tục phát huy!",penaltyPoints:"Mất {{points}} điểm",estimatedGain:"+{{gain}} điểm nếu sửa",currentScore:"Hiện tại: {{score}}%",weight:"Trọng số: {{weight}}%",fixAction:"Cách sửa"},tE={rememberTitle:"Yêu cầu agent ghi nhớ thường xuyên",rememberTips:['Sau mỗi quyết định: "Nhớ rằng chúng ta chọn PostgreSQL thay vì MongoDB cho user service"','Sau khi debug: "Nhớ nguyên nhân gốc là race condition trong WebSocket handler"','Sau cuộc họp: "Nhớ Alice đề xuất rate limiting ở tầng API gateway"','Sau khi học: "Nhớ Vite HMR yêu cầu export default cho React component"'],causalTitle:"Dùng ngôn ngữ nhân quả, phong phú",causalTips:['TỆ: "PostgreSQL" → chỉ tạo một neuron phẳng','TỐT: "Chúng ta chọn PostgreSQL thay MongoDB vì cần ACID transaction cho xử lý thanh toán" → tạo neuron concept + entity + decision với synapse CAUSED_BY',"Nói TẠI SAO, không chỉ CÁI GÌ — chuỗi nhân quả tạo kết nối neural phong phú hơn","Đề cập người, ngày, bối cảnh — chúng trở thành neuron riêng liên kết qua synapse"],diverseTitle:"Đa dạng loại bộ nhớ = nhớ lại tốt hơn",diverseTips:['Sự kiện: "API rate limit là 1000 req/phút mỗi user"','Quyết định: "Chúng ta chọn JWT thay session vì kiến trúc microservice"',`Lỗi: "Import thất bại vì cột 'email' đổi thành 'user_email' trong v3"`,'Insight: "Pattern: luôn xác thực webhook signature trước khi xử lý payload"','Workflow: "Quy trình deploy: lint → test → build → push → kiểm tra health check"'],trainTitle:"Huấn luyện từ tài liệu để có kiến thức vĩnh viễn",trainTips:["Dùng smem_train để import tài liệu (PDF, DOCX, MD) — bộ nhớ được huấn luyện không bao giờ suy giảm","Dùng smem_index để index codebase — cho phép recall nhận biết code","Ghim bộ nhớ quan trọng bằng smem_pin — bỏ qua suy giảm và tổng hợp","Dùng smem_eternal cho context dự án cần lưu trữ xuyên suốt các phiên"]},nE={title:"Đồ thị Neural",nodes:"Nút:",networkVisualization:"Trực quan hóa mạng",nodesCount:"{{nodes}} nút, {{edges}} cạnh",noNeurons:"Không tìm thấy neuron nào trong bộ não này.",concept:"khái niệm",entity:"thực thể",time:"thời gian",action:"hành động",state:"trạng thái",other:"khác"},aE={title:"Dòng thời gian",memoryTimeline:"Dòng thời gian bộ nhớ",entries:"{{total}} mục",noEntries:"Không có mục nào.",range7d:"7 ngày",range30d:"30 ngày",range90d:"90 ngày",rangeAll:"Tất cả",todayMemories:"Hôm nay",totalPeriod:"Tổng",avgPerDay:"TB/Ngày",activeDays:"Ngày hoạt động",activityTrend:"Xu hướng hoạt động",neuronDistribution:"Phân bố Neuron",recentActivity:"Hoạt động gần đây",neurons:"Neuron",fibers:"Fiber",synapses:"Synapse"},lE={title:"Tiến hóa",brainMetrics:"Chỉ số bộ não",maturity:"Trưởng thành",plasticity:"Linh hoạt",semanticRatio:"Tỷ lệ ngữ nghĩa",totalFibers:"Tổng Fiber",totalNeurons:"Tổng Neuron",stageDistribution:"Phân bố giai đoạn",shortTerm:"Ngắn hạn",working:"Làm việc",episodic:"Tình huống",semantic:"Ngữ nghĩa"},iE={title:"Sơ đồ tư duy",fibers:"Fiber",noFibers:"Không tìm thấy fiber nào.",selectFiber:"Chọn một Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neuron:",connectionsCount:"Kết nối:",selectFiberPrompt:"Chọn một fiber để xem sơ đồ tư duy"},sE={title:"Cài đặt",general:"Tổng quát",version:"Phiên bản",activeBrain:"Bộ não đang dùng",totalBrains:"Tổng bộ não",brainFiles:"Tệp bộ não",brainsDirectory:"Thư mục bộ não",totalDiskUsage:"Dung lượng sử dụng",telegramBackup:"Sao lưu Telegram",connected:"Đã kết nối",chatIds:"Chat ID",autoBackup:"Tự động sao lưu khi tổng hợp",sendTest:"Gửi thử",sending:"Đang gửi...",backupNow:"Sao lưu ngay",backingUp:"Đang sao lưu...",notConfigured:"Chưa cấu hình",telegramSetup:"Đặt biến môi trường NMEM_TELEGRAM_BOT_TOKEN và thêm [telegram] chat_ids vào config.toml.",feedbackTitle:"Góp ý & Báo lỗi",reportBug:"Báo lỗi",reportBugDesc:"Phát hiện lỗi? Tạo issue với các bước tái hiện.",featureRequest:"Yêu cầu tính năng",featureRequestDesc:"Có ý tưởng cải thiện Surreal-Memory? Chúng tôi rất muốn nghe.",discussions:"GitHub Discussions",discussionsDesc:"Câu hỏi, mẹo hay, và hỗ trợ cộng đồng.",testSuccess:"Đã gửi tin nhắn thử thành công",testPartial:"Một số tin nhắn gửi thất bại",testFailed:"Gửi tin nhắn thử thất bại",backupSuccess:"Đã sao lưu! {{brain}} ({{size}}MB) đến {{count}} chat",backupSendFailed:"Sao lưu gửi thất bại",backupFailed:"Sao lưu thất bại",configStatus:"Trạng thái cấu hình",embeddingConfig:"Nhà cung cấp Embedding",embeddingProvider:"Nhà cung cấp",embeddingModel:"Model",embeddingEnabled:"Bật",embeddingThreshold:"Ngưỡng tương đồng",embeddingTest:"Kiểm tra kết nối",embeddingTesting:"Đang kiểm tra...",embeddingTestOk:"Kết nối OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Kiểm tra thất bại: {{error}}",embeddingSave:"Lưu",embeddingSaving:"Đang lưu...",embeddingSaved:"Đã lưu cấu hình embedding",embeddingSaveFailed:"Lưu cấu hình embedding thất bại",proFeature:"Pro",watcher:"Theo dõi tệp",watcherPaths:"Đường dẫn theo dõi",watcherRecent:"Hoạt động gần đây",watcherRunning:"Đang chạy",watcherStopped:"Đã dừng",watcherDisabled:"Tắt",watcherNoActivity:"Không có hoạt động gần đây"},rE={title:"Tiên Tri",loading:"Đang kết nối ký ức...",needMore:"Não bạn cần thêm ký ức",needMoreDesc:"Tiên Tri cần ít nhất 3 ký ức để mở khóa. Hãy nhờ AI ghi nhớ các quyết định, hiểu biết, và bài học — rồi quay lại đây.",dailyHint:"Chạm vào từng lá bài để xem kết quả",past:"Quá khứ",present:"Hiện tại",future:"Tương lai",readingDate:"Bói cho {{brain}} ngày {{date}}",whatifHint:"Nếu những ký ức này va chạm thì sao?",reshuffle:"Xáo lại",memory:"Ký ức",wildcard:"Lá bất ngờ",matchupComplete:"Hoàn thành đấu trí!",matchupScoreDesc:"Dựa trên mức kích hoạt và kết nối của ký ức bạn chọn",playAgain:"Chơi lại",round:"Vòng {{current}} / {{total}}",choose:"Chọn",chosen:"Đã chọn!",score:"Điểm",dailyReading:"Bói hàng ngày",whatif:"Nếu Như",matchup:"Đấu Trí",copyCard:"Chép ảnh",copied:"Đã chép!",downloadCard:"Tải xuống"},oE={search:"Tìm kiếm...",placeholder:"Tìm trang, fiber, ký ức...",noResults:"Không tìm thấy kết quả.",pages:"Trang",fibers:"Fiber",neurons:"Ký ức",semanticSearch:"Tìm kiếm ngữ nghĩa — tìm theo ý nghĩa",crossBrainSearch:"Tìm xuyên Brain — tìm trên mọi brain",navigate:"di chuyển",select:"mở",close:"đóng"},uE={title:"Đồng bộ đám mây",refresh:"Làm mới",connectionStatus:"Kết nối",status:"Trạng thái",cloudConnected:"Đã kết nối",notConnected:"Chưa kết nối",hubUrl:"URL Hub",apiKey:"API Key",deviceId:"ID Thiết bị",disconnect:"Ngắt kết nối",setupCloud:"Kết nối đám mây",setupTitle:"Kết nối Cloud Hub",setupDesc:"Nhập URL hub và API key để đồng bộ ký ức giữa các thiết bị. Đăng ký tại hub để nhận key.",keyRequired:"API key là bắt buộc",keyInvalid:"API key phải bắt đầu bằng nmk_",keyHint:"Nhận key bằng cách đăng ký tại hub. Key bắt đầu bằng nmk_.",connect:"Kết nối",connecting:"Đang kết nối...",connected:"Đã kết nối đồng bộ đám mây!",connectFailed:"Kết nối thất bại",disconnected:"Đã ngắt đồng bộ đám mây",disconnectFailed:"Ngắt kết nối thất bại",devices:"Thiết bị",lastSync:"Đồng bộ lần cuối",never:"Chưa bao giờ",noDevices:"Chưa có thiết bị nào. Đồng bộ từ một thiết bị để đăng ký.",changeLog:"Nhật ký thay đổi",totalChanges:"Tổng thay đổi",synced:"Đã đồng bộ",pending:"Đang chờ",latestSequence:"Sequence mới nhất",conflictStrategy:"Giải quyết xung đột",conflictDesc:"Cách xử lý khi cùng một ký ức bị thay đổi trên nhiều thiết bị.",strategyUpdated:"Đã cập nhật chiến lược xung đột",updateFailed:"Cập nhật cấu hình thất bại",syncMode:"Chế độ đồng bộ",merkleDelta:"Merkle Delta",fullSync:"Đồng bộ toàn phần"},cE={title:"Thống kê công cụ",totalEvents:"Tổng sự kiện",successRate:"Tỷ lệ thành công",uniqueTools:"Công cụ đã dùng",topTools:"Công cụ hàng đầu",usageOverTime:"Sử dụng theo thời gian",detailTable:"Chi tiết công cụ",tool:"Công cụ",calls:"Lượt gọi",avgDuration:"Thời gian TB",server:"Server",noData:"Chưa có dữ liệu. Sử dụng các công cụ Surreal-Memory để bắt đầu theo dõi."},fE={title:"Trực quan hóa",description:"Truy vấn bộ nhớ và tạo biểu đồ từ dữ liệu đã lưu."},dE={title:"Lưu trữ",currentBackend:"Backend hiện tại",brain:"Bộ não",neurons:"Neuron",synapses:"Synapse",fibers:"Fiber",tierDistribution:"Phân tầng bộ nhớ",tierHot:"HOT — Luôn trong ngữ cảnh",tierWarm:"WARM — Khớp ngữ nghĩa",tierCold:"COLD — Chỉ gọi lại thủ công",totalMemories:"Tổng bộ nhớ có kiểu"},hE={tier:"Giấy phép",pro_badge:"PRO",pro_feature:"Tính năng Pro",free:"Miễn phí",pro:"Pro",team:"Nhóm"},mE={title:"Nâng cấp Surreal-Memory Pro",subtitle:"Chọn phương thức thanh toán",enterKey:"Nhập license key của bạn",enterEmail:"Nhập email để nhận license:",orActivate:"hoặc kích hoạt key",haveKey:"Tôi đã có license key",licenseKey:"License Key",activate:"Kích hoạt",activated:"Đã kích hoạt Pro!",activationFailed:"Kích hoạt thất bại. Kiểm tra lại key.",back:"Quay lại"},gE={nav:Wx,common:Ix,overview:Px,health:eE,enrichment:tE,graph:nE,timeline:aE,evolution:lE,diagrams:iE,settings:sE,oracle:rE,commandPalette:oE,sync:uE,toolStats:cE,visualize:fE,storage:dE,license:hE,upgrade:mE},pE={overview:"Overview",health:"Health",graph:"Graph",timeline:"Timeline",evolution:"Evolution",mindmap:"Mindmap",sync:"Cloud Sync",oracle:"Oracle",toolStats:"Tool Stats",visualize:"Visualize",storage:"Storage",settings:"Settings"},yE={confirm:"Confirm",cancel:"Cancel",delete:"Delete",loading:"Loading...",active:"Active",yes:"Yes",no:"No",none:"(none)",neurons:"neurons",brain:"Brain",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",mainNavigation:"Main navigation",lightMode:"Light mode",darkMode:"Dark mode",systemTheme:"System theme"},vE={title:"Overview",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",brains:"Brains",brainList:"Brains",name:"Name",grade:"Grade",status:"Status",actions:"Actions",currentBrain:"Current active brain",switchTo:"Click to switch to {{name}}",deleteBrain:"Delete brain {{name}}",noBrains:"No brains found.",deleteBrainTitle:"Delete Brain",deleteBrainDesc:'Delete brain "{{name}}"? This will remove all neurons, synapses, and fibers permanently. This cannot be undone.',switchedTo:"Switched to brain: {{name}}",switchFailed:"Failed to switch brain",deleted:"Deleted brain: {{name}}",deleteFailed:"Failed to delete brain"},bE={title:"Health",brainMetrics:"Brain Metrics",purity:"Purity",freshness:"Freshness",connectivity:"Connectivity",diversity:"Diversity",consolidation:"Consolidation",activation:"Activation",recall:"Recall",orphanRate:"Orphan Rate",radarName:"Health",warnings:"Warnings & Recommendations",noWarnings:"No warnings. Brain is healthy!",recommendations:"Recommendations",enrichTitle:"How to Enrich Your Brain",enrichDesc:"A richer brain means better recall. Here's how to build detailed neurons and strong synapses.",collapseTips:"Collapse tips",expandTips:"Expand tips",less:"Less",more:"More",topPenalties:"Top Issues Hurting Your Score",noPenalties:"No significant penalties. Keep it up!",penaltyPoints:"{{points}} pts lost",estimatedGain:"+{{gain}} pts if fixed",currentScore:"Current: {{score}}%",weight:"Weight: {{weight}}%",fixAction:"Fix"},SE={rememberTitle:"Ask your agent to remember frequently",rememberTips:['After every decision: "Remember that we chose PostgreSQL over MongoDB for the user service"','After debugging: "Remember the root cause was a race condition in the WebSocket handler"','After meetings: "Remember Alice suggested rate limiting at the API gateway level"','After learning: "Remember that Vite HMR requires export default for React components"'],causalTitle:"Use rich, causal language",causalTips:['BAD: "PostgreSQL" → creates a single flat neuron','GOOD: "We chose PostgreSQL over MongoDB because we need ACID transactions for payment processing" → creates concept + entity + decision neurons with CAUSED_BY synapses',"Include WHY, not just WHAT — causal chains create richer neural connections","Mention people, dates, and context — they become separate neurons linked by synapses"],diverseTitle:"Diverse memory types = stronger recall",diverseTips:['Facts: "The API rate limit is 1000 req/min per user"','Decisions: "We decided to use JWT over sessions because of microservice architecture"',`Errors: "Import failed because the column 'email' was renamed to 'user_email' in v3"`,'Insights: "Pattern: always validate webhook signatures before processing payloads"','Workflows: "Deploy process: lint → test → build → push → verify health check"'],trainTitle:"Train from documents for permanent knowledge",trainTips:["Use smem_train to import docs (PDF, DOCX, MD) — trained memories never decay","Use smem_index to index your codebase — enables code-aware recall","Pin critical memories with smem_pin — they skip decay and consolidation","Use smem_eternal for project-level context that should persist across all sessions"]},xE={title:"Neural Graph",nodes:"Nodes:",networkVisualization:"Network Visualization",nodesCount:"{{nodes}} nodes, {{edges}} edges",noNeurons:"No neurons found in this brain.",concept:"concept",entity:"entity",time:"time",action:"action",state:"state",other:"other"},EE={title:"Timeline",memoryTimeline:"Memory Timeline",entries:"{{total}} entries",noEntries:"No timeline entries.",range7d:"7 Days",range30d:"30 Days",range90d:"90 Days",rangeAll:"All",todayMemories:"Today",totalPeriod:"Total",avgPerDay:"Avg/Day",activeDays:"Active Days",activityTrend:"Activity Trend",neuronDistribution:"Neuron Distribution",recentActivity:"Recent Activity",neurons:"Neurons",fibers:"Fibers",synapses:"Synapses"},TE={title:"Evolution",brainMetrics:"Brain Metrics",maturity:"Maturity",plasticity:"Plasticity",semanticRatio:"Semantic Ratio",totalFibers:"Total Fibers",totalNeurons:"Total Neurons",stageDistribution:"Stage Distribution",shortTerm:"Short Term",working:"Working",episodic:"Episodic",semantic:"Semantic"},OE={title:"Mindmap",fibers:"Fibers",noFibers:"No fibers found.",selectFiber:"Select a Fiber",fiberLabel:"Fiber: {{id}}...",neuronsCount:"Neurons:",connectionsCount:"Connections:",selectFiberPrompt:"Select a fiber to view its mindmap"},CE={title:"Settings",general:"General",version:"Version",activeBrain:"Active Brain",totalBrains:"Total Brains",brainFiles:"Brain Files",brainsDirectory:"Brains Directory",totalDiskUsage:"Total Disk Usage",telegramBackup:"Telegram Backup",connected:"Connected",chatIds:"Chat IDs",autoBackup:"Auto-backup on consolidation",sendTest:"Send Test",sending:"Sending...",backupNow:"Backup Now",backingUp:"Backing up...",notConfigured:"Not Configured",telegramSetup:"Set NMEM_TELEGRAM_BOT_TOKEN env var and add [telegram] chat_ids to config.toml.",feedbackTitle:"Feedback & Bug Report",reportBug:"Report a Bug",reportBugDesc:"Found something broken? Open an issue with steps to reproduce.",featureRequest:"Feature Request",featureRequestDesc:"Have an idea to improve Surreal-Memory? We'd love to hear it.",discussions:"GitHub Discussions",discussionsDesc:"Questions, tips, and community support.",testSuccess:"Test message sent successfully",testPartial:"Some messages failed to send",testFailed:"Failed to send test message",backupSuccess:"Backup sent! {{brain}} ({{size}}MB) to {{count}} chat(s)",backupSendFailed:"Backup failed to send",backupFailed:"Backup failed",configStatus:"Configuration Status",embeddingConfig:"Embedding Provider",embeddingProvider:"Provider",embeddingModel:"Model",embeddingEnabled:"Enabled",embeddingThreshold:"Similarity Threshold",embeddingTest:"Test Connection",embeddingTesting:"Testing...",embeddingTestOk:"Connection OK — {{provider}} ({{dimension}}D)",embeddingTestFail:"Test failed: {{error}}",embeddingSave:"Save",embeddingSaving:"Saving...",embeddingSaved:"Embedding settings saved",embeddingSaveFailed:"Failed to save embedding settings",proFeature:"Pro",watcher:"File Watcher",watcherPaths:"Watched Paths",watcherRecent:"Recent Activity",watcherRunning:"Running",watcherStopped:"Stopped",watcherDisabled:"Disabled",watcherNoActivity:"No recent activity"},NE={title:"Cloud Sync",refresh:"Refresh",connectionStatus:"Connection",status:"Status",cloudConnected:"Connected",notConnected:"Not Connected",hubUrl:"Hub URL",apiKey:"API Key",deviceId:"Device ID",disconnect:"Disconnect",setupCloud:"Connect to Cloud",setupTitle:"Connect to Cloud Hub",setupDesc:"Enter your hub URL and API key to sync memories across devices. Register at the hub to get your key.",keyRequired:"API key is required",keyInvalid:"API key must start with nmk_",keyHint:"Get your key by registering at the hub. It starts with nmk_.",connect:"Connect",connecting:"Connecting...",connected:"Cloud sync connected!",connectFailed:"Failed to connect",disconnected:"Cloud sync disconnected",disconnectFailed:"Failed to disconnect",devices:"Devices",lastSync:"Last sync",never:"Never",noDevices:"No devices registered yet. Sync from a device to register it.",changeLog:"Change Log",totalChanges:"Total Changes",synced:"Synced",pending:"Pending",latestSequence:"Latest Sequence",conflictStrategy:"Conflict Resolution",conflictDesc:"How to resolve when the same memory is changed on multiple devices.",strategyUpdated:"Conflict strategy updated",updateFailed:"Failed to update config",syncMode:"Sync Mode",merkleDelta:"Merkle Delta",fullSync:"Full Sync"},DE={title:"Brain Oracle",loading:"Channeling your memories...",needMore:"Your brain needs more memories",needMoreDesc:"The Oracle requires at least 3 memories to unlock. Ask your AI agent to remember decisions, insights, and learnings — then return for your reading.",dailyHint:"Tap each card to reveal your reading",past:"Past",present:"Present",future:"Future",readingDate:"Reading for {{brain}} on {{date}}",whatifHint:"What if these memories collided?",reshuffle:"Reshuffle",memory:"Memory",wildcard:"Wildcard",matchupComplete:"Matchup Complete!",matchupScoreDesc:"Based on activation strength and connections of your chosen memories",playAgain:"Play Again",round:"Round {{current}} / {{total}}",choose:"Choose",chosen:"Chosen!",score:"Score",dailyReading:"Daily Reading",whatif:"What If",matchup:"Matchup",copyCard:"Copy Card",copied:"Copied!",downloadCard:"Download"},AE={search:"Search...",placeholder:"Search pages, fibers, memories...",noResults:"No results found.",pages:"Pages",fibers:"Fibers",neurons:"Memories",semanticSearch:"Semantic Search — find by meaning",crossBrainSearch:"Cross-Brain Search — search all brains",navigate:"navigate",select:"open",close:"close"},wE={title:"Tool Stats",totalEvents:"Total Events",successRate:"Success Rate",uniqueTools:"Unique Tools",topTools:"Top Tools",usageOverTime:"Usage Over Time",detailTable:"Tool Details",tool:"Tool",calls:"Calls",avgDuration:"Avg Duration",server:"Server",noData:"No tool events recorded yet. Use Surreal-Memory tools to start tracking."},RE={title:"Memory Visualizer",description:"Query your memories and generate charts from stored data."},zE={title:"Storage",currentBackend:"Current Backend",brain:"Brain",neurons:"Neurons",synapses:"Synapses",fibers:"Fibers",tierDistribution:"Memory Tiers",tierHot:"HOT — Always in context",tierWarm:"WARM — Semantic match",tierCold:"COLD — Explicit recall only",totalMemories:"Total typed memories"},ME={tier:"License",pro_badge:"PRO",pro_feature:"Pro Feature",free:"Free",pro:"Pro",team:"Team"},_E={title:"Get Surreal-Memory Pro",subtitle:"Choose your payment method",enterKey:"Enter your license key",enterEmail:"Enter your email for the license:",orActivate:"or activate a key",haveKey:"I already have a license key",licenseKey:"License Key",activate:"Activate",activated:"Pro activated!",activationFailed:"Activation failed. Check your key.",back:"Back"},jE={nav:pE,common:yE,overview:vE,health:bE,enrichment:SE,graph:xE,timeline:EE,evolution:TE,diagrams:OE,settings:CE,sync:NE,oracle:DE,commandPalette:AE,toolStats:wE,visualize:RE,storage:zE,license:ME,upgrade:_E};dt.use(mp).use(f0).init({resources:{vi:{translation:gE},en:{translation:jE}},fallbackLng:"en",detection:{order:["localStorage","navigator"],lookupLocalStorage:"smem-lang",caches:["localStorage"]},interpolation:{escapeValue:!1}});const LE=new Nv({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}}});Iv.createRoot(document.getElementById("root")).render(T.jsx(v.StrictMode,{children:T.jsx(Dv,{client:LE,children:T.jsxs(Lv,{basename:window.location.pathname.startsWith("/dashboard")?"/dashboard":"/ui",children:[T.jsx(Lx,{}),T.jsx(Cb,{position:"bottom-right",toastOptions:{className:"bg-card text-card-foreground border-border"}})]})})}));export{Li as A,Mi as B,Xt as _,PE as a,L0 as b,z0 as c,KE as d,YE as e,JE as f,GE as g,$E as h,XE as i,QE as j,ZE as k,_0 as l,FE as m,qe as n,e2 as o,t2 as p,a2 as q,n2 as r,M0 as s,VE as t,xr as u,IE as v,i2 as w,Im as x,WE as y,l2 as z}; diff --git a/src/surreal_memory/server/static/dist/assets/skeleton-DQJ-n00q.js b/src/surreal_memory/server/static/dist/assets/skeleton-B4zDkVHp.js similarity index 69% rename from src/surreal_memory/server/static/dist/assets/skeleton-DQJ-n00q.js rename to src/surreal_memory/server/static/dist/assets/skeleton-B4zDkVHp.js index 76ef1eb8..e0af9370 100644 --- a/src/surreal_memory/server/static/dist/assets/skeleton-DQJ-n00q.js +++ b/src/surreal_memory/server/static/dist/assets/skeleton-B4zDkVHp.js @@ -1 +1 @@ -import{j as m}from"./vendor-query-CqA1cBNl.js";import{A as o}from"./index-C26pxqlr.js";function n({className:e,...t}){return m.jsx("div",{className:o("animate-pulse rounded-md bg-muted",e),...t})}export{n as S}; +import{j as m}from"./vendor-query-CqA1cBNl.js";import{A as o}from"./index-DzyKsRxc.js";function n({className:e,...t}){return m.jsx("div",{className:o("animate-pulse rounded-md bg-muted",e),...t})}export{n as S}; diff --git a/src/surreal_memory/server/static/dist/index.html b/src/surreal_memory/server/static/dist/index.html index 8ea83ae8..32e4fb6d 100644 --- a/src/surreal_memory/server/static/dist/index.html +++ b/src/surreal_memory/server/static/dist/index.html @@ -5,13 +5,13 @@ dashboard - + - +
diff --git a/tests/unit/test_dashboard_api.py b/tests/unit/test_dashboard_api.py index ab40cfd8..6adc2ec6 100755 --- a/tests/unit/test_dashboard_api.py +++ b/tests/unit/test_dashboard_api.py @@ -258,3 +258,52 @@ def test_fiber_diagram_filters_external_synapses( assert resp.status_code == 200 data = resp.json() assert len(data["synapses"]) == 0 # External synapse filtered + + +class TestStorageStatusEndpoint: + """Tests for GET /api/dashboard/storage/status (SurrealDB-only).""" + + def test_returns_200_with_surrealdb_backend( + self, client: TestClient, mock_storage: AsyncMock + ) -> None: + mock_storage.get_stats = AsyncMock( + return_value={"neuron_count": 10, "synapse_count": 3, "fiber_count": 2} + ) + mock_storage._url = "http://localhost:8000" + mock_storage._namespace = "surreal_memory" + mock_storage._database = "default" + resp = client.get("/api/dashboard/storage/status") + assert resp.status_code == 200 + data = resp.json() + assert data["backend"] == "surrealdb" + assert data["healthy"] is True + assert data["neuron_count"] == 10 + assert data["synapse_count"] == 3 + assert data["fiber_count"] == 2 + + def test_healthy_false_when_get_stats_fails( + self, client: TestClient, mock_storage: AsyncMock + ) -> None: + mock_storage.get_stats = AsyncMock(side_effect=Exception("db down")) + resp = client.get("/api/dashboard/storage/status") + assert resp.status_code == 200 + data = resp.json() + assert data["backend"] == "surrealdb" + assert data["healthy"] is False + assert data["neuron_count"] == 0 + + def test_url_namespace_database_exposed( + self, client: TestClient, mock_storage: AsyncMock + ) -> None: + mock_storage.get_stats = AsyncMock( + return_value={"neuron_count": 0, "synapse_count": 0, "fiber_count": 0} + ) + mock_storage._url = "http://surrealdb:8000" + mock_storage._namespace = "myns" + mock_storage._database = "mydb" + resp = client.get("/api/dashboard/storage/status") + assert resp.status_code == 200 + data = resp.json() + assert data["url"] == "http://surrealdb:8000" + assert data["namespace"] == "myns" + assert data["database"] == "mydb"