openclaw-memory-mapper 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -16,8 +16,6 @@ npx openclaw-memory-mapper
|
|
|
16
16
|
|
|
17
17
|
That's it. Your browser opens and guides you through setup.
|
|
18
18
|
|
|
19
|
-
<!--  -->
|
|
20
|
-
|
|
21
19
|
## Onboarding
|
|
22
20
|
|
|
23
21
|
When you first launch Memory Mapper, the onboarding wizard walks you through setup:
|
|
@@ -321,7 +321,7 @@ Error generating stack: `+o.message+`
|
|
|
321
321
|
*
|
|
322
322
|
* This source code is licensed under the ISC license.
|
|
323
323
|
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
-
*/const MN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],jN=Ee("zap",MN);function zN(t,i){let a;try{a=t()}catch{return}return{getItem:s=>{var c;const u=p=>p===null?null:JSON.parse(p,void 0),h=(c=a.getItem(s))!=null?c:null;return h instanceof Promise?h.then(u):u(h)},setItem:(s,c)=>a.setItem(s,JSON.stringify(c,void 0)),removeItem:s=>a.removeItem(s)}}const Ld=t=>i=>{try{const a=t(i);return a instanceof Promise?a:{then(r){return Ld(r)(a)},catch(r){return this}}}catch(a){return{then(r){return this},catch(r){return Ld(r)(a)}}}},RN=(t,i)=>(a,r,s)=>{let c={storage:zN(()=>localStorage),partialize:E=>E,version:0,merge:(E,C)=>({...C,...E}),...i},u=!1,h=0;const p=new Set,m=new Set;let x=c.storage;if(!x)return t((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...E)},r,s);const y=()=>{const E=c.partialize({...r()});return x.setItem(c.name,{state:E,version:c.version})},v=s.setState;s.setState=(E,C)=>(v(E,C),y());const w=t((...E)=>(a(...E),y()),r,s);s.getInitialState=()=>w;let S;const _=()=>{var E,C;if(!x)return;const j=++h;u=!1,p.forEach(A=>{var H;return A((H=r())!=null?H:w)});const N=((C=c.onRehydrateStorage)==null?void 0:C.call(c,(E=r())!=null?E:w))||void 0;return Ld(x.getItem.bind(x))(c.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==c.version){if(c.migrate){const H=c.migrate(A.state,A.version);return H instanceof Promise?H.then(k=>[!0,k]):[!0,H]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var H;if(j!==h)return;const[k,L]=A;if(S=c.merge(L,(H=r())!=null?H:w),a(S,!0),k)return y()}).then(()=>{j===h&&(N==null||N(S,void 0),S=r(),u=!0,m.forEach(A=>A(S)))}).catch(A=>{j===h&&(N==null||N(void 0,A))})};return s.persist={setOptions:E=>{c={...c,...E},E.storage&&(x=E.storage)},clearStorage:()=>{x==null||x.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>_(),hasHydrated:()=>u,onHydrate:E=>(p.add(E),()=>{p.delete(E)}),onFinishHydration:E=>(m.add(E),()=>{m.delete(E)})},c.skipHydration||_(),S||w},hh=RN,mh=xc()(hh(t=>({theme:"dark",setTheme:i=>t({theme:i})}),{name:"memory-mapper-theme"}));function ph(t){const i=document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)").matches,r=t==="dark"||t==="system"&&a;i.classList.remove("light","dark"),i.classList.add(r?"dark":"light"),i.style.colorScheme=r?"dark":"light"}function ON(){const{theme:t,setTheme:i}=mh();return T.useEffect(()=>{ph(t)},[t]),{theme:t,setTheme:i}}const Fg=[{value:"dark",icon:sN,label:"Dark mode"},{value:"light",icon:xN,label:"Light mode"},{value:"system",icon:rN,label:"System theme"}];function DN(){const{theme:t,setTheme:i}=ON(),a=Fg.findIndex(r=>r.value===t);return g.jsxs("div",{className:Ne("relative flex items-center gap-1 p-1 rounded-lg","bg-secondary/50 border border-border"),role:"radiogroup","aria-label":"Theme selection",children:[g.jsx("div",{className:"absolute top-1 h-6 w-8 rounded border-[1.5px] border-foreground/70 pointer-events-none",style:{left:`${4+a*36}px`,transition:"left 250ms cubic-bezier(0.4, 0, 0.2, 1)"}}),Fg.map(r=>{const s=r.icon,c=t===r.value;return g.jsx("button",{onClick:()=>i(r.value),role:"radio","aria-checked":c,"aria-label":r.label,className:Ne("relative z-10 flex items-center justify-center w-8 h-6 rounded cursor-pointer","transition-colors duration-200",c?"text-foreground":"text-muted-foreground hover:text-foreground"),children:g.jsx(s,{className:"w-4 h-4"})},r.value)})]})}function kN(){const{status:t,sources:i,refresh:a}=xS(),{success:r,error:s}=SS(),[c,u]=T.useState("idle"),h=async()=>{if(c==="idle"){u("refreshing");try{await a(),await new Promise(m=>setTimeout(m,600)),u("done"),r("Data refreshed","All sources updated successfully")}catch{u("idle"),s("Refresh failed","Could not connect to server");return}setTimeout(()=>u("idle"),1e3)}},p=i.filter(m=>m.connected);return g.jsxs("header",{className:"h-12 flex items-center justify-between px-4 border-b border-border bg-background/80 backdrop-blur-sm",children:[g.jsxs("div",{className:"flex items-center gap-5",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsxs("div",{className:"relative",children:[g.jsx("div",{className:Ne("w-2 h-2 rounded-full",t==="connected"&&"bg-emerald-500",t==="connecting"&&"bg-amber-500",t==="error"&&"bg-red-500")}),t==="connected"&&g.jsx("div",{className:"absolute inset-0 w-2 h-2 rounded-full bg-emerald-500 animate-ping opacity-75"})]}),g.jsxs("span",{className:Ne("text-xs font-medium",t==="connected"?"text-emerald-400":"text-muted-foreground"),children:[t==="connecting"&&"Connecting...",t==="connected"&&"Connected",t==="error"&&"Disconnected"]})]}),t==="connected"&&p.length>0&&g.jsx("div",{className:"w-px h-4 bg-border/50"}),t==="connected"&&p.length>0&&g.jsx("div",{className:"flex items-center gap-3 text-xs",children:p.map(m=>g.jsx(LN,{label:m.path,connected:m.connected,icon:fh},m.id))})]}),g.jsxs("div",{className:"flex items-center gap-4",children:[g.jsxs("button",{onClick:h,disabled:c!=="idle",className:Ne("group flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer","text-xs font-medium transition-all duration-200 ease-out","border active:scale-[0.98]","disabled:cursor-not-allowed disabled:opacity-70",c==="idle"&&"border-border bg-secondary text-foreground hover:bg-secondary/80",c==="refreshing"&&"border-primary/30 bg-primary/10 text-primary",c==="done"&&"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"),children:[c==="done"?g.jsx(ii,{className:"w-3.5 h-3.5"}):g.jsx(dN,{className:Ne("w-3.5 h-3.5",c==="idle"&&"group-hover:rotate-180",c==="refreshing"&&"animate-spin"),style:{transition:"transform 500ms cubic-bezier(0.4, 0, 0.2, 1)"}}),g.jsxs("span",{children:[c==="idle"&&"Refresh",c==="refreshing"&&"Syncing...",c==="done"&&"Done"]})]}),g.jsx(DN,{})]})]})}function LN({label:t,connected:i,icon:a}){return g.jsxs("span",{className:Ne("flex items-center gap-1.5 px-2 py-1 rounded-md transition-colors duration-200",i?"text-foreground bg-emerald-500/10 border border-emerald-500/20":"text-muted-foreground bg-secondary"),children:[g.jsx(a,{className:Ne("w-3 h-3",i?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground")}),g.jsx("span",{className:"font-mono text-[11px]",children:t})]})}const Ig=[];async function Jg(t){const i=t.filter(a=>a.enabled&&a.detected).map(a=>({id:a.id,path:a.path}));await fetch("/api/config/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:i})})}const Xr=xc()(hh((t,i)=>({completed:!1,sources:Ig,completedAt:null,completeOnboarding:()=>{const{sources:a}=i();Jg(a).catch(console.error),t({completed:!0,completedAt:new Date().toISOString()})},resetOnboarding:()=>t({completed:!1,sources:Ig,completedAt:null}),setSources:a=>t({sources:a}),toggleSource:a=>t(r=>({sources:r.sources.map(s=>s.id===a?{...s,enabled:!s.enabled}:s)})),updateSourcePath:(a,r)=>t(s=>({sources:s.sources.map(c=>c.id===a?{...c,path:r,detected:!1}:c)})),syncSourcesToServer:async()=>{const{sources:a}=i();await Jg(a)},addSource:()=>{const a=`custom-${Date.now()}`;return t(r=>({sources:[...r.sources,{id:a,name:"",path:"",enabled:!0,detected:!1}]})),a},removeSource:a=>t(r=>({sources:r.sources.filter(s=>s.id!==a)}))}),{name:"openclaw-memory-mapper-onboarding"})),HN=[{id:"architecture",label:"Architecture",icon:kd,color:"258 90% 66%"},{id:"files",label:"Files",icon:Ca,color:"38 92% 50%"},{id:"security",label:"Security",icon:$r,color:"160 84% 39%"}];function BN({children:t}){const[i,a]=T.useState("architecture"),{completed:r,syncSourcesToServer:s}=Xr();return T.useEffect(()=>{r&&s().catch(console.error)},[r,s]),g.jsxs("div",{className:"h-screen flex flex-col bg-background text-foreground",children:[g.jsx(kN,{}),g.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[g.jsxs("nav",{className:"w-56 flex flex-col border-r",style:{backgroundColor:"hsl(var(--sidebar-bg))",borderColor:"hsl(var(--sidebar-border))"},children:[g.jsxs("div",{className:"px-4 py-5 flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-xl bg-primary/10 ring-1 ring-primary/20",children:g.jsx(Px,{className:"w-4 h-4 text-primary"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground tracking-tight",children:"Memory Mapper"}),g.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-medium",children:"OpenClaw"})]})]}),g.jsx("div",{className:"mx-4 h-px bg-border/60"}),g.jsx("div",{className:"flex-1 flex flex-col gap-1 p-3 pt-4",children:HN.map(c=>{const u=c.icon,h=i===c.id;return g.jsxs("button",{onClick:()=>a(c.id),className:"group relative flex items-center gap-4 px-4 py-4 rounded-xl text-base cursor-pointer",style:{color:h?`hsl(${c.color})`:"hsl(var(--muted-foreground))",background:h?`linear-gradient(135deg, hsl(${c.color} / 0.15), hsl(${c.color} / 0.05))`:"transparent",boxShadow:h?`inset 0 0 0 1.5px hsl(${c.color} / 0.5), 0 0 20px hsl(${c.color} / 0.15)`:"inset 0 0 0 1.5px transparent, 0 0 20px transparent",transition:"color 300ms ease, background 300ms ease, box-shadow 300ms ease"},onMouseEnter:p=>{h||(p.currentTarget.style.color="hsl(var(--foreground))")},onMouseLeave:p=>{h||(p.currentTarget.style.color="hsl(var(--muted-foreground))")},children:[g.jsx(u,{className:"w-5 h-5",style:{color:"inherit",transition:"color 300ms ease"}}),g.jsx("span",{className:"font-medium",children:c.label})]},c.id)})}),g.jsx("div",{className:"px-4 py-4 border-t",style:{borderColor:"hsl(var(--sidebar-border))"},children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-medium",children:"Version"}),g.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:"1.0.0"})]})})]}),g.jsx("main",{className:"flex-1 overflow-auto bg-background",children:t(i)})]})]})}const gh=xc()(hh((t,i)=>({entries:[],isPaused:!1,maxEntries:500,logActivity:a=>{if(i().isPaused)return;const r={...a,id:Math.random().toString(36).substring(2,9),timestamp:new Date().toISOString()};t(s=>({entries:[r,...s.entries].slice(0,s.maxEntries)}))},clearLog:()=>t({entries:[]}),togglePause:()=>t(a=>({isPaused:!a.isPaused})),setPaused:a=>t({isPaused:a})}),{name:"openclaw-memory-mapper-activity-log",partialize:t=>({entries:t.entries.slice(0,100),isPaused:t.isPaused})}));function UN(t){const i=["Timestamp","Type","Path","Source","Success","Size"],a=t.map(r=>{var s;return[r.timestamp,r.type,r.path,r.source,r.success?"Yes":"No",((s=r.size)==null?void 0:s.toString())||""]});return[i,...a].map(r=>r.join(",")).join(`
|
|
324
|
+
*/const MN=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],jN=Ee("zap",MN);function zN(t,i){let a;try{a=t()}catch{return}return{getItem:s=>{var c;const u=p=>p===null?null:JSON.parse(p,void 0),h=(c=a.getItem(s))!=null?c:null;return h instanceof Promise?h.then(u):u(h)},setItem:(s,c)=>a.setItem(s,JSON.stringify(c,void 0)),removeItem:s=>a.removeItem(s)}}const Ld=t=>i=>{try{const a=t(i);return a instanceof Promise?a:{then(r){return Ld(r)(a)},catch(r){return this}}}catch(a){return{then(r){return this},catch(r){return Ld(r)(a)}}}},RN=(t,i)=>(a,r,s)=>{let c={storage:zN(()=>localStorage),partialize:E=>E,version:0,merge:(E,C)=>({...C,...E}),...i},u=!1,h=0;const p=new Set,m=new Set;let x=c.storage;if(!x)return t((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...E)},r,s);const y=()=>{const E=c.partialize({...r()});return x.setItem(c.name,{state:E,version:c.version})},v=s.setState;s.setState=(E,C)=>(v(E,C),y());const w=t((...E)=>(a(...E),y()),r,s);s.getInitialState=()=>w;let S;const _=()=>{var E,C;if(!x)return;const j=++h;u=!1,p.forEach(A=>{var H;return A((H=r())!=null?H:w)});const N=((C=c.onRehydrateStorage)==null?void 0:C.call(c,(E=r())!=null?E:w))||void 0;return Ld(x.getItem.bind(x))(c.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==c.version){if(c.migrate){const H=c.migrate(A.state,A.version);return H instanceof Promise?H.then(k=>[!0,k]):[!0,H]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var H;if(j!==h)return;const[k,L]=A;if(S=c.merge(L,(H=r())!=null?H:w),a(S,!0),k)return y()}).then(()=>{j===h&&(N==null||N(S,void 0),S=r(),u=!0,m.forEach(A=>A(S)))}).catch(A=>{j===h&&(N==null||N(void 0,A))})};return s.persist={setOptions:E=>{c={...c,...E},E.storage&&(x=E.storage)},clearStorage:()=>{x==null||x.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>_(),hasHydrated:()=>u,onHydrate:E=>(p.add(E),()=>{p.delete(E)}),onFinishHydration:E=>(m.add(E),()=>{m.delete(E)})},c.skipHydration||_(),S||w},hh=RN,mh=xc()(hh(t=>({theme:"dark",setTheme:i=>t({theme:i})}),{name:"memory-mapper-theme"}));function ph(t){const i=document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)").matches,r=t==="dark"||t==="system"&&a;i.classList.remove("light","dark"),i.classList.add(r?"dark":"light"),i.style.colorScheme=r?"dark":"light"}function ON(){const{theme:t,setTheme:i}=mh();return T.useEffect(()=>{ph(t)},[t]),{theme:t,setTheme:i}}const Fg=[{value:"dark",icon:sN,label:"Dark mode"},{value:"light",icon:xN,label:"Light mode"},{value:"system",icon:rN,label:"System theme"}];function DN(){const{theme:t,setTheme:i}=ON(),a=Fg.findIndex(r=>r.value===t);return g.jsxs("div",{className:Ne("relative flex items-center gap-1 p-1 rounded-lg","bg-secondary/50 border border-border"),role:"radiogroup","aria-label":"Theme selection",children:[g.jsx("div",{className:"absolute top-1 h-6 w-8 rounded border-[1.5px] border-foreground/70 pointer-events-none",style:{left:`${4+a*36}px`,transition:"left 250ms cubic-bezier(0.4, 0, 0.2, 1)"}}),Fg.map(r=>{const s=r.icon,c=t===r.value;return g.jsx("button",{onClick:()=>i(r.value),role:"radio","aria-checked":c,"aria-label":r.label,className:Ne("relative z-10 flex items-center justify-center w-8 h-6 rounded cursor-pointer","transition-colors duration-200",c?"text-foreground":"text-muted-foreground hover:text-foreground"),children:g.jsx(s,{className:"w-4 h-4"})},r.value)})]})}function kN(){const{status:t,sources:i,refresh:a}=xS(),{success:r,error:s}=SS(),[c,u]=T.useState("idle"),h=async()=>{if(c==="idle"){u("refreshing");try{await a(),await new Promise(m=>setTimeout(m,600)),u("done"),r("Data refreshed","All sources updated successfully")}catch{u("idle"),s("Refresh failed","Could not connect to server");return}setTimeout(()=>u("idle"),1e3)}},p=i.filter(m=>m.connected);return g.jsxs("header",{className:"h-12 flex items-center justify-between px-4 border-b border-border bg-background/80 backdrop-blur-sm",children:[g.jsxs("div",{className:"flex items-center gap-5",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsxs("div",{className:"relative",children:[g.jsx("div",{className:Ne("w-2 h-2 rounded-full",t==="connected"&&"bg-emerald-500",t==="connecting"&&"bg-amber-500",t==="error"&&"bg-red-500")}),t==="connected"&&g.jsx("div",{className:"absolute inset-0 w-2 h-2 rounded-full bg-emerald-500 animate-ping opacity-75"})]}),g.jsxs("span",{className:Ne("text-xs font-medium",t==="connected"?"text-emerald-400":"text-muted-foreground"),children:[t==="connecting"&&"Connecting...",t==="connected"&&"Connected",t==="error"&&"Disconnected"]})]}),t==="connected"&&p.length>0&&g.jsx("div",{className:"w-px h-4 bg-border/50"}),t==="connected"&&p.length>0&&g.jsx("div",{className:"flex items-center gap-3 text-xs",children:p.map(m=>g.jsx(LN,{label:m.path,connected:m.connected,icon:fh},m.id))})]}),g.jsxs("div",{className:"flex items-center gap-4",children:[g.jsxs("button",{onClick:h,disabled:c!=="idle",className:Ne("group flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer","text-xs font-medium transition-all duration-200 ease-out","border active:scale-[0.98]","disabled:cursor-not-allowed disabled:opacity-70",c==="idle"&&"border-border bg-secondary text-foreground hover:bg-secondary/80",c==="refreshing"&&"border-primary/30 bg-primary/10 text-primary",c==="done"&&"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"),children:[c==="done"?g.jsx(ii,{className:"w-3.5 h-3.5"}):g.jsx(dN,{className:Ne("w-3.5 h-3.5",c==="idle"&&"group-hover:rotate-180",c==="refreshing"&&"animate-spin"),style:{transition:"transform 500ms cubic-bezier(0.4, 0, 0.2, 1)"}}),g.jsxs("span",{children:[c==="idle"&&"Refresh",c==="refreshing"&&"Syncing...",c==="done"&&"Done"]})]}),g.jsx(DN,{})]})]})}function LN({label:t,connected:i,icon:a}){return g.jsxs("span",{className:Ne("flex items-center gap-1.5 px-2 py-1 rounded-md transition-colors duration-200",i?"text-foreground bg-emerald-500/10 border border-emerald-500/20":"text-muted-foreground bg-secondary"),children:[g.jsx(a,{className:Ne("w-3 h-3",i?"text-emerald-600 dark:text-emerald-400":"text-muted-foreground")}),g.jsx("span",{className:"font-mono text-[11px]",children:t})]})}const Ig=[];async function Jg(t){const i=t.filter(a=>a.enabled&&a.detected).map(a=>({id:a.id,path:a.path}));await fetch("/api/config/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:i})})}const Xr=xc()(hh((t,i)=>({completed:!1,sources:Ig,completedAt:null,completeOnboarding:()=>{const{sources:a}=i();Jg(a).catch(console.error),t({completed:!0,completedAt:new Date().toISOString()})},resetOnboarding:()=>t({completed:!1,sources:Ig,completedAt:null}),setSources:a=>t({sources:a}),toggleSource:a=>t(r=>({sources:r.sources.map(s=>s.id===a?{...s,enabled:!s.enabled}:s)})),updateSourcePath:(a,r)=>t(s=>({sources:s.sources.map(c=>c.id===a?{...c,path:r,detected:!1}:c)})),syncSourcesToServer:async()=>{const{sources:a}=i();await Jg(a)},addSource:()=>{const a=`custom-${Date.now()}`;return t(r=>({sources:[...r.sources,{id:a,name:"",path:"",enabled:!0,detected:!1}]})),a},removeSource:a=>t(r=>({sources:r.sources.filter(s=>s.id!==a)}))}),{name:"openclaw-memory-mapper-onboarding"})),HN=[{id:"architecture",label:"Architecture",icon:kd,color:"258 90% 66%"},{id:"files",label:"Files",icon:Ca,color:"38 92% 50%"},{id:"security",label:"Security",icon:$r,color:"160 84% 39%"}];function BN({children:t}){const[i,a]=T.useState("architecture"),{completed:r,syncSourcesToServer:s}=Xr();return T.useEffect(()=>{r&&s().catch(console.error)},[r,s]),g.jsxs("div",{className:"h-screen flex flex-col bg-background text-foreground",children:[g.jsx(kN,{}),g.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[g.jsxs("nav",{className:"w-56 flex flex-col border-r",style:{backgroundColor:"hsl(var(--sidebar-bg))",borderColor:"hsl(var(--sidebar-border))"},children:[g.jsxs("div",{className:"px-4 py-5 flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-xl bg-primary/10 ring-1 ring-primary/20",children:g.jsx(Px,{className:"w-4 h-4 text-primary"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground tracking-tight",children:"Memory Mapper"}),g.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-medium",children:"OpenClaw"})]})]}),g.jsx("div",{className:"mx-4 h-px bg-border/60"}),g.jsx("div",{className:"flex-1 flex flex-col gap-1 p-3 pt-4",children:HN.map(c=>{const u=c.icon,h=i===c.id;return g.jsxs("button",{onClick:()=>a(c.id),className:"group relative flex items-center gap-4 px-4 py-4 rounded-xl text-base cursor-pointer",style:{color:h?`hsl(${c.color})`:"hsl(var(--muted-foreground))",background:h?`linear-gradient(135deg, hsl(${c.color} / 0.15), hsl(${c.color} / 0.05))`:"transparent",boxShadow:h?`inset 0 0 0 1.5px hsl(${c.color} / 0.5), 0 0 20px hsl(${c.color} / 0.15)`:"inset 0 0 0 1.5px transparent, 0 0 20px transparent",transition:"color 300ms ease, background 300ms ease, box-shadow 300ms ease"},onMouseEnter:p=>{h||(p.currentTarget.style.color="hsl(var(--foreground))")},onMouseLeave:p=>{h||(p.currentTarget.style.color="hsl(var(--muted-foreground))")},children:[g.jsx(u,{className:"w-5 h-5",style:{color:"inherit",transition:"color 300ms ease"}}),g.jsx("span",{className:"font-medium",children:c.label})]},c.id)})}),g.jsx("div",{className:"px-4 py-4 border-t",style:{borderColor:"hsl(var(--sidebar-border))"},children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-medium",children:"Version"}),g.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:"1.1.0"})]})})]}),g.jsx("main",{className:"flex-1 overflow-auto bg-background",children:t(i)})]})]})}const gh=xc()(hh((t,i)=>({entries:[],isPaused:!1,maxEntries:500,logActivity:a=>{if(i().isPaused)return;const r={...a,id:Math.random().toString(36).substring(2,9),timestamp:new Date().toISOString()};t(s=>({entries:[r,...s.entries].slice(0,s.maxEntries)}))},clearLog:()=>t({entries:[]}),togglePause:()=>t(a=>({isPaused:!a.isPaused})),setPaused:a=>t({isPaused:a})}),{name:"openclaw-memory-mapper-activity-log",partialize:t=>({entries:t.entries.slice(0,100),isPaused:t.isPaused})}));function UN(t){const i=["Timestamp","Type","Path","Source","Success","Size"],a=t.map(r=>{var s;return[r.timestamp,r.type,r.path,r.source,r.success?"Yes":"No",((s=r.size)==null?void 0:s.toString())||""]});return[i,...a].map(r=>r.join(",")).join(`
|
|
325
325
|
`)}function ov(){const[t,i]=T.useState(null),[a,r]=T.useState(!0),[s,c]=T.useState(null),{logActivity:u,isPaused:h}=gh(),p=T.useCallback(async()=>{if(!h){r(!0);try{const m=await fetch("/api/files");if(!m.ok)throw new Error(`HTTP ${m.status}`);const x=await m.json();i(x),c(null),Object.entries(x).forEach(([y,v])=>{if(v){const w=v.path||`~/${y}`;u({type:"LIST",path:w,source:y,success:!0})}})}catch(m){c(m instanceof Error?m.message:"Failed to load files"),u({type:"LIST",path:"/api/files",source:"api",success:!1})}finally{r(!1)}}},[h,u]);return T.useEffect(()=>{p()},[p]),{data:t,loading:a,error:s,refresh:p}}function VN(){const[t,i]=T.useState(null),[a,r]=T.useState(!1),[s,c]=T.useState(null),{logActivity:u,isPaused:h}=gh(),p=T.useCallback(async(x,y)=>{if(!h){r(!0);try{const v=await fetch(`/api/file?path=${encodeURIComponent(x)}&source=${y}`);if(!v.ok)throw v.status===404?new Error("File not found"):new Error(`HTTP ${v.status}`);const w=await v.json();i(w),c(null),u({type:"READ",path:x,source:y,success:!0,size:w.size})}catch(v){c(v instanceof Error?v.message:"Failed to load file"),i(null),u({type:"READ",path:x,source:y,success:!1})}finally{r(!1)}}},[h,u]),m=T.useCallback(()=>{i(null),c(null)},[]);return{content:t,loading:a,error:s,loadFile:p,clear:m}}function Cl(t){if(t===0)return"0 B";const i=1024,a=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(i));return`${parseFloat((t/Math.pow(i,r)).toFixed(1))} ${a[r]}`}function $N({nodes:t,selectedPath:i,onSelect:a}){return g.jsx("div",{className:"py-2",children:t.map(r=>g.jsx(sv,{node:r,selectedPath:i,onSelect:a,depth:0},r.path))})}function sv({node:t,selectedPath:i,onSelect:a,depth:r}){const[s,c]=T.useState(r<2),u=i===t.path,h=()=>{t.type==="directory"?c(!s):a(t.path)};return g.jsxs("div",{children:[g.jsxs("button",{onClick:h,className:Ne("w-full flex items-center gap-1.5 px-2 py-1.5 text-xs text-left cursor-pointer transition-all duration-150",u?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),style:{paddingLeft:`${r*12+8}px`},children:[t.type==="directory"?s?g.jsx(Ix,{className:"w-3 h-3 text-muted-foreground"}):g.jsx(TE,{className:"w-3 h-3 text-muted-foreground"}):g.jsx("span",{className:"w-3 h-3"}),t.type==="directory"?g.jsx(uh,{className:"w-4 h-4 text-amber-500/70"}):g.jsx(ZE,{className:"w-4 h-4 text-blue-400/70"}),g.jsx("span",{className:"truncate",children:t.name})]}),t.type==="directory"&&s&&t.children&&g.jsx("div",{children:t.children.map(p=>g.jsx(sv,{node:p,selectedPath:i,onSelect:a,depth:r+1},p.path))})]})}const Xi=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("rounded-2xl border border-border bg-card text-card-foreground shadow-lg",t),...i}));Xi.displayName="Card";const YN=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("flex flex-col space-y-1.5 p-6",t),...i}));YN.displayName="CardHeader";const qN=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("font-semibold leading-none tracking-tight",t),...i}));qN.displayName="CardTitle";const XN=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("text-sm text-muted-foreground",t),...i}));XN.displayName="CardDescription";const GN=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("p-6 pt-0",t),...i}));GN.displayName="CardContent";const ZN=T.forwardRef(({className:t,...i},a)=>g.jsx("div",{ref:a,className:Ne("flex items-center p-6 pt-0",t),...i}));ZN.displayName="CardFooter";const cv=new Set([".pkl",".pickle",".pyc",".pyo",".so",".dylib",".dll",".exe",".bin",".dat",".db",".sqlite",".sqlite3",".zip",".tar",".gz",".bz2",".7z",".rar",".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".svg",".mp3",".mp4",".wav",".avi",".mov",".webm",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".woff",".woff2",".ttf",".otf",".eot"]),Hd={".py":"python",".js":"javascript",".ts":"typescript",".tsx":"typescript",".jsx":"javascript",".rs":"rust",".go":"go",".rb":"ruby",".sh":"bash",".bash":"bash",".zsh":"bash",".yml":"yaml",".yaml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".css":"css",".scss":"scss",".html":"html",".xml":"xml",".sql":"sql"};function QN(t){return t.slice(0,1e3).split("").filter(a=>{const r=a.charCodeAt(0);return r<32&&r!==9&&r!==10&&r!==13}).length>10}function KN({extension:t,className:i}){return cv.has(t)?[".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".svg"].includes(t)?g.jsx(nv,{className:i}):g.jsx(Qx,{className:i}):t===".json"?g.jsx(UE,{className:i}):Hd[t]?g.jsx($E,{className:i}):t===".md"||t===".txt"?g.jsx(tv,{className:i}):g.jsx(XE,{className:i})}function PN({content:t,loading:i,error:a}){if(i)return g.jsx("div",{className:"h-full flex items-center justify-center",children:g.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[g.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),g.jsx("span",{className:"text-sm",children:"Loading file..."})]})});if(a)return g.jsx("div",{className:"h-full flex items-center justify-center",children:g.jsxs(Xi,{className:"p-6 max-w-sm text-center",children:[g.jsx(Jx,{className:"w-8 h-8 text-red-400 mx-auto mb-3"}),g.jsx("p",{className:"text-sm text-red-400",children:a})]})});if(!t)return g.jsx("div",{className:"h-full flex items-center justify-center",children:g.jsx("p",{className:"text-sm text-muted-foreground/50",children:"Select a file to preview"})});const r=cv.has(t.extension)||QN(t.content);return g.jsxs("div",{className:"h-full flex flex-col bg-card",children:[g.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/50 bg-secondary/30",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(KN,{extension:t.extension,className:"w-4 h-4 text-muted-foreground"}),g.jsx("span",{className:"font-mono text-sm text-foreground",children:t.name}),g.jsx("span",{className:"text-xs text-muted-foreground/50 uppercase",children:t.extension.slice(1)})]}),g.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground/70",children:[g.jsx("span",{children:Cl(t.size)}),g.jsx("span",{children:new Date(t.modified).toLocaleDateString()})]})]}),g.jsx("div",{className:"flex-1 overflow-auto",children:r?g.jsx(FN,{extension:t.extension,size:t.size}):t.extension===".md"?g.jsx(WN,{content:t.content}):t.extension===".json"?g.jsx(e_,{content:t.content}):Hd[t.extension]?g.jsx(IN,{content:t.content,language:Hd[t.extension]}):g.jsx(uv,{content:t.content})})]})}function FN({extension:t,size:i}){const a=[".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".svg"].includes(t);return g.jsx("div",{className:"h-full flex items-center justify-center p-8",children:g.jsxs(Xi,{className:"p-8 text-center max-w-sm",children:[a?g.jsx(nv,{className:"w-12 h-12 text-muted-foreground/30 mx-auto mb-4"}):g.jsx(Qx,{className:"w-12 h-12 text-muted-foreground/30 mx-auto mb-4"}),g.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:"Binary File"}),g.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:a?"Image file":"This file cannot be displayed as text"}),g.jsxs("div",{className:"flex items-center justify-center gap-3 text-xs text-muted-foreground/50",children:[g.jsx("span",{className:"uppercase",children:t.slice(1)}),g.jsx("span",{children:"•"}),g.jsx("span",{children:Cl(i)})]})]})})}function uv({content:t}){const i=t.split(`
|
|
326
326
|
`);return g.jsx("div",{className:"p-4 font-mono text-xs",children:g.jsx("table",{className:"w-full",children:g.jsx("tbody",{children:i.map((a,r)=>g.jsxs("tr",{className:"hover:bg-white/[0.02]",children:[g.jsx("td",{className:"pr-4 py-0.5 text-right text-muted-foreground/30 select-none w-10",children:r+1}),g.jsx("td",{className:"py-0.5 text-muted-foreground whitespace-pre-wrap break-all",children:a||" "})]},r))})})})}function IN({content:t,language:i}){const a=t.split(`
|
|
327
327
|
`),r=s=>{let c=s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return c=c.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*?\1/g,'<span class="text-emerald-400">$&</span>'),c=c.replace(/(#.*$|\/\/.*$)/gm,'<span class="text-zinc-600">$1</span>'),c=c.replace(/\b(\d+\.?\d*)\b/g,'<span class="text-amber-400">$1</span>'),JN(i).forEach(h=>{const p=new RegExp(`\\b(${h})\\b`,"g");c=c.replace(p,'<span class="text-violet-400">$1</span>')}),c};return g.jsx("div",{className:"p-4 font-mono text-xs",children:g.jsx("table",{className:"w-full",children:g.jsx("tbody",{children:a.map((s,c)=>g.jsxs("tr",{className:"hover:bg-white/[0.02]",children:[g.jsx("td",{className:"pr-4 py-0.5 text-right text-muted-foreground/30 select-none w-10",children:c+1}),g.jsx("td",{className:"py-0.5 text-zinc-300 whitespace-pre",dangerouslySetInnerHTML:{__html:r(s)||" "}})]},c))})})})}function JN(t){return{python:["def","class","import","from","return","if","elif","else","for","while","try","except","finally","with","as","True","False","None","and","or","not","in","is","lambda","yield","async","await","self"],javascript:["const","let","var","function","return","if","else","for","while","class","import","export","default","from","try","catch","finally","throw","new","this","true","false","null","undefined","async","await","typeof","instanceof"],typescript:["const","let","var","function","return","if","else","for","while","class","import","export","default","from","try","catch","finally","throw","new","this","true","false","null","undefined","async","await","type","interface","extends","implements","readonly","private","public","protected"],yaml:["true","false","null","yes","no"],bash:["if","then","else","fi","for","do","done","while","case","esac","function","return","export","source","echo","exit"]}[t]||[]}function WN({content:t}){const i=t.split(`
|
|
@@ -348,4 +348,4 @@ Error generating stack: `+o.message+`
|
|
|
348
348
|
`,`
|
|
349
349
|
+`).split(`
|
|
350
350
|
`)),x=m.reduce((y,v)=>y.concat(...v),[]);return[m,x]}return[[],[]]},[t]);return T.useEffect(()=>{const p=(i==null?void 0:i.target)??$y,m=(i==null?void 0:i.actInsideInputWithModifier)??!0;if(t!==null){const x=w=>{var E,C;if(s.current=w.ctrlKey||w.metaKey||w.shiftKey||w.altKey,(!s.current||s.current&&!m)&&Wv(w))return!1;const _=qy(w.code,h);if(c.current.add(w[_]),Yy(u,c.current,!1)){const j=((C=(E=w.composedPath)==null?void 0:E.call(w))==null?void 0:C[0])||w.target,N=(j==null?void 0:j.nodeName)==="BUTTON"||(j==null?void 0:j.nodeName)==="A";i.preventDefault!==!1&&(s.current||!N)&&w.preventDefault(),r(!0)}},y=w=>{const S=qy(w.code,h);Yy(u,c.current,!0)?(r(!1),c.current.clear()):c.current.delete(w[S]),w.key==="Meta"&&c.current.clear(),s.current=!1},v=()=>{c.current.clear(),r(!1)};return p==null||p.addEventListener("keydown",x),p==null||p.addEventListener("keyup",y),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{p==null||p.removeEventListener("keydown",x),p==null||p.removeEventListener("keyup",y),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[t,r]),a}function Yy(t,i,a){return t.filter(r=>a||r.length===i.size).some(r=>r.every(s=>i.has(s)))}function qy(t,i){return i.includes(t)?"code":"key"}const fT=()=>{const t=Ie();return T.useMemo(()=>({zoomIn:i=>{const{panZoom:a}=t.getState();return a?a.scaleBy(1.2,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},zoomOut:i=>{const{panZoom:a}=t.getState();return a?a.scaleBy(1/1.2,{duration:i==null?void 0:i.duration}):Promise.resolve(!1)},zoomTo:(i,a)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(i,{duration:a==null?void 0:a.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(i,a)=>{const{transform:[r,s,c],panZoom:u}=t.getState();return u?(await u.setViewport({x:i.x??r,y:i.y??s,zoom:i.zoom??c},a),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[i,a,r]=t.getState().transform;return{x:i,y:a,zoom:r}},setCenter:async(i,a,r)=>t.getState().setCenter(i,a,r),fitBounds:async(i,a)=>{const{width:r,height:s,minZoom:c,maxZoom:u,panZoom:h}=t.getState(),p=Ch(i,r,s,c,u,(a==null?void 0:a.padding)??.1);return h?(await h.setViewport(p,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(i,a={})=>{const{transform:r,snapGrid:s,snapToGrid:c,domNode:u}=t.getState();if(!u)return i;const{x:h,y:p}=u.getBoundingClientRect(),m={x:i.x-h,y:i.y-p},x=a.snapGrid??s,y=a.snapToGrid??c;return oo(m,r,y,x)},flowToScreenPosition:i=>{const{transform:a,domNode:r}=t.getState();if(!r)return i;const{x:s,y:c}=r.getBoundingClientRect(),u=fc(i,a);return{x:u.x+s,y:u.y+c}}}),[])};function w1(t,i){const a=[],r=new Map,s=[];for(const c of t)if(c.type==="add"){s.push(c);continue}else if(c.type==="remove"||c.type==="replace")r.set(c.id,[c]);else{const u=r.get(c.id);u?u.push(c):r.set(c.id,[c])}for(const c of i){const u=r.get(c.id);if(!u){a.push(c);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){a.push({...u[0].item});continue}const h={...c};for(const p of u)dT(p,h);a.push(h)}return s.length&&s.forEach(c=>{c.index!==void 0?a.splice(c.index,0,{...c.item}):a.push({...c.item})}),a}function dT(t,i){switch(t.type){case"select":{i.selected=t.selected;break}case"position":{typeof t.position<"u"&&(i.position=t.position),typeof t.dragging<"u"&&(i.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(i.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(i.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(i.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(i.resizing=t.resizing);break}}}function hT(t,i){return w1(t,i)}function mT(t,i){return w1(t,i)}function Sl(t,i){return{id:t,type:"select",selected:i}}function Sa(t,i=new Set,a=!1){const r=[];for(const[s,c]of t){const u=i.has(s);!(c.selected===void 0&&!u)&&c.selected!==u&&(a&&(c.selected=u),r.push(Sl(c.id,u)))}return r}function Xy({items:t=[],lookup:i}){var s;const a=[],r=new Map(t.map(c=>[c.id,c]));for(const[c,u]of t.entries()){const h=i.get(u.id),p=((s=h==null?void 0:h.internals)==null?void 0:s.userNode)??h;p!==void 0&&p!==u&&a.push({id:u.id,item:u,type:"replace"}),p===void 0&&a.push({item:u,type:"add",index:c})}for(const[c]of i)r.get(c)===void 0&&a.push({id:c,type:"remove"});return a}function Gy(t){return{id:t.id,type:"remove"}}const Zy=t=>kC(t),pT=t=>Gv(t);function S1(t){return T.forwardRef(t)}const gT=typeof window<"u"?T.useLayoutEffect:T.useEffect;function Qy(t){const[i,a]=T.useState(BigInt(0)),[r]=T.useState(()=>yT(()=>a(s=>s+BigInt(1))));return gT(()=>{const s=r.get();s.length&&(t(s),r.reset())},[i]),r}function yT(t){let i=[];return{get:()=>i,reset:()=>{i=[]},push:a=>{i.push(a),t()}}}const E1=T.createContext(null);function xT({children:t}){const i=Ie(),a=T.useCallback(h=>{const{nodes:p=[],setNodes:m,hasDefaultNodes:x,onNodesChange:y,nodeLookup:v,fitViewQueued:w,onNodesChangeMiddlewareMap:S}=i.getState();let _=p;for(const C of h)_=typeof C=="function"?C(_):C;let E=Xy({items:_,lookup:v});for(const C of S.values())E=C(E);x&&m(_),E.length>0?y==null||y(E):w&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:j,setNodes:N}=i.getState();C&&N(j)})},[]),r=Qy(a),s=T.useCallback(h=>{const{edges:p=[],setEdges:m,hasDefaultEdges:x,onEdgesChange:y,edgeLookup:v}=i.getState();let w=p;for(const S of h)w=typeof S=="function"?S(w):S;x?m(w):y&&y(Xy({items:w,lookup:v}))},[]),c=Qy(s),u=T.useMemo(()=>({nodeQueue:r,edgeQueue:c}),[]);return g.jsx(E1.Provider,{value:u,children:t})}function vT(){const t=T.useContext(E1);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const bT=t=>!!t.panZoom;function Oh(){const t=fT(),i=Ie(),a=vT(),r=Le(bT),s=T.useMemo(()=>{const c=y=>i.getState().nodeLookup.get(y),u=y=>{a.nodeQueue.push(y)},h=y=>{a.edgeQueue.push(y)},p=y=>{var C,j;const{nodeLookup:v,nodeOrigin:w}=i.getState(),S=Zy(y)?y:v.get(y.id),_=S.parentId?Iv(S.position,S.measured,S.parentId,v,w):S.position,E={...S,position:_,width:((C=S.measured)==null?void 0:C.width)??S.width,height:((j=S.measured)==null?void 0:j.height)??S.height};return za(E)},m=(y,v,w={replace:!1})=>{u(S=>S.map(_=>{if(_.id===y){const E=typeof v=="function"?v(_):v;return w.replace&&Zy(E)?E:{..._,...E}}return _}))},x=(y,v,w={replace:!1})=>{h(S=>S.map(_=>{if(_.id===y){const E=typeof v=="function"?v(_):v;return w.replace&&pT(E)?E:{..._,...E}}return _}))};return{getNodes:()=>i.getState().nodes.map(y=>({...y})),getNode:y=>{var v;return(v=c(y))==null?void 0:v.internals.userNode},getInternalNode:c,getEdges:()=>{const{edges:y=[]}=i.getState();return y.map(v=>({...v}))},getEdge:y=>i.getState().edgeLookup.get(y),setNodes:u,setEdges:h,addNodes:y=>{const v=Array.isArray(y)?y:[y];a.nodeQueue.push(w=>[...w,...v])},addEdges:y=>{const v=Array.isArray(y)?y:[y];a.edgeQueue.push(w=>[...w,...v])},toObject:()=>{const{nodes:y=[],edges:v=[],transform:w}=i.getState(),[S,_,E]=w;return{nodes:y.map(C=>({...C})),edges:v.map(C=>({...C})),viewport:{x:S,y:_,zoom:E}}},deleteElements:async({nodes:y=[],edges:v=[]})=>{const{nodes:w,edges:S,onNodesDelete:_,onEdgesDelete:E,triggerNodeChanges:C,triggerEdgeChanges:j,onDelete:N,onBeforeDelete:A}=i.getState(),{nodes:H,edges:k}=await VC({nodesToRemove:y,edgesToRemove:v,nodes:w,edges:S,onBeforeDelete:A}),L=k.length>0,V=H.length>0;if(L){const Z=k.map(Gy);E==null||E(k),j(Z)}if(V){const Z=H.map(Gy);_==null||_(H),C(Z)}return(V||L)&&(N==null||N({nodes:H,edges:k})),{deletedNodes:H,deletedEdges:k}},getIntersectingNodes:(y,v=!0,w)=>{const S=xy(y),_=S?y:p(y),E=w!==void 0;return _?(w||i.getState().nodes).filter(C=>{const j=i.getState().nodeLookup.get(C.id);if(j&&!S&&(C.id===y.id||!j.internals.positionAbsolute))return!1;const N=za(E?C:j),A=Ir(N,_);return v&&A>0||A>=N.width*N.height||A>=_.width*_.height}):[]},isNodeIntersecting:(y,v,w=!0)=>{const _=xy(y)?y:p(y);if(!_)return!1;const E=Ir(_,v);return w&&E>0||E>=v.width*v.height||E>=_.width*_.height},updateNode:m,updateNodeData:(y,v,w={replace:!1})=>{m(y,S=>{const _=typeof v=="function"?v(S):v;return w.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},w)},updateEdge:x,updateEdgeData:(y,v,w={replace:!1})=>{x(y,S=>{const _=typeof v=="function"?v(S):v;return w.replace?{...S,data:_}:{...S,data:{...S.data,..._}}},w)},getNodesBounds:y=>{const{nodeLookup:v,nodeOrigin:w}=i.getState();return LC(y,{nodeLookup:v,nodeOrigin:w})},getHandleConnections:({type:y,id:v,nodeId:w})=>{var S;return Array.from(((S=i.getState().connectionLookup.get(`${w}-${y}${v?`-${v}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:y,handleId:v,nodeId:w})=>{var S;return Array.from(((S=i.getState().connectionLookup.get(`${w}${y?v?`-${y}-${v}`:`-${y}`:""}`))==null?void 0:S.values())??[])},fitView:async y=>{const v=i.getState().fitViewResolver??XC();return i.setState({fitViewQueued:!0,fitViewOptions:y,fitViewResolver:v}),a.nodeQueue.push(w=>[...w]),v.promise}}},[]);return T.useMemo(()=>({...s,...t,viewportInitialized:r}),[r])}const Ky=t=>t.selected,wT=typeof window<"u"?window:void 0;function ST({deleteKeyCode:t,multiSelectionKeyCode:i}){const a=Ie(),{deleteElements:r}=Oh(),s=Wr(t,{actInsideInputWithModifier:!1}),c=Wr(i,{target:wT});T.useEffect(()=>{if(s){const{edges:u,nodes:h}=a.getState();r({nodes:h.filter(Ky),edges:u.filter(Ky)}),a.setState({nodesSelectionActive:!1})}},[s]),T.useEffect(()=>{a.setState({multiSelectionActive:c})},[c])}function ET(t){const i=Ie();T.useEffect(()=>{const a=()=>{var s,c,u,h;if(!t.current||!(((c=(s=t.current).checkVisibility)==null?void 0:c.call(s))??!0))return!1;const r=Th(t.current);(r.height===0||r.width===0)&&((h=(u=i.getState()).onError)==null||h.call(u,"004",Cn.error004())),i.setState({width:r.width||500,height:r.height||500})};if(t.current){a(),window.addEventListener("resize",a);const r=new ResizeObserver(()=>a());return r.observe(t.current),()=>{window.removeEventListener("resize",a),r&&t.current&&r.unobserve(t.current)}}},[])}const jc={position:"absolute",width:"100%",height:"100%",top:0,left:0},NT=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function _T({onPaneContextMenu:t,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:c=_l.Free,zoomOnDoubleClick:u=!0,panOnDrag:h=!0,defaultViewport:p,translateExtent:m,minZoom:x,maxZoom:y,zoomActivationKeyCode:v,preventScrolling:w=!0,children:S,noWheelClassName:_,noPanClassName:E,onViewportChange:C,isControlledViewport:j,paneClickDistance:N,selectionOnDrag:A}){const H=Ie(),k=T.useRef(null),{userSelectionActive:L,lib:V,connectionInProgress:Z}=Le(NT,Fe),le=Wr(v),Q=T.useRef();ET(k);const X=T.useCallback(te=>{C==null||C({x:te[0],y:te[1],zoom:te[2]}),j||H.setState({transform:te})},[C,j]);return T.useEffect(()=>{if(k.current){Q.current=T3({domNode:k.current,minZoom:x,maxZoom:y,translateExtent:m,viewport:p,onDraggingChange:z=>H.setState({paneDragging:z}),onPanZoomStart:(z,B)=>{const{onViewportChangeStart:O,onMoveStart:$}=H.getState();$==null||$(z,B),O==null||O(B)},onPanZoom:(z,B)=>{const{onViewportChange:O,onMove:$}=H.getState();$==null||$(z,B),O==null||O(B)},onPanZoomEnd:(z,B)=>{const{onViewportChangeEnd:O,onMoveEnd:$}=H.getState();$==null||$(z,B),O==null||O(B)}});const{x:te,y:D,zoom:G}=Q.current.getViewport();return H.setState({panZoom:Q.current,transform:[te,D,G],domNode:k.current.closest(".react-flow")}),()=>{var z;(z=Q.current)==null||z.destroy()}}},[]),T.useEffect(()=>{var te;(te=Q.current)==null||te.update({onPaneContextMenu:t,zoomOnScroll:i,zoomOnPinch:a,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:c,zoomOnDoubleClick:u,panOnDrag:h,zoomActivationKeyPressed:le,preventScrolling:w,noPanClassName:E,userSelectionActive:L,noWheelClassName:_,lib:V,onTransformChange:X,connectionInProgress:Z,selectionOnDrag:A,paneClickDistance:N})},[t,i,a,r,s,c,u,h,le,w,E,L,_,V,X,Z,A,N]),g.jsx("div",{className:"react-flow__renderer",ref:k,style:jc,children:S})}const CT=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function TT(){const{userSelectionActive:t,userSelectionRect:i}=Le(CT,Fe);return t&&i?g.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:i.width,height:i.height,transform:`translate(${i.x}px, ${i.y}px)`}}):null}const Cd=(t,i)=>a=>{a.target===i.current&&(t==null||t(a))},AT=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function MT({isSelecting:t,selectionKeyPressed:i,selectionMode:a=Fr.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:c,onSelectionStart:u,onSelectionEnd:h,onPaneClick:p,onPaneContextMenu:m,onPaneScroll:x,onPaneMouseEnter:y,onPaneMouseMove:v,onPaneMouseLeave:w,children:S}){const _=Ie(),{userSelectionActive:E,elementsSelectable:C,dragging:j,connectionInProgress:N}=Le(AT,Fe),A=C&&(t||E),H=T.useRef(null),k=T.useRef(),L=T.useRef(new Set),V=T.useRef(new Set),Z=T.useRef(!1),le=O=>{if(Z.current||N){Z.current=!1;return}p==null||p(O),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},Q=O=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){O.preventDefault();return}m==null||m(O)},X=x?O=>x(O):void 0,te=O=>{Z.current&&(O.stopPropagation(),Z.current=!1)},D=O=>{var se,ue;const{domNode:$}=_.getState();if(k.current=$==null?void 0:$.getBoundingClientRect(),!k.current)return;const J=O.target===H.current;if(!J&&!!O.target.closest(".nokey")||!t||!(c&&J||i)||O.button!==0||!O.isPrimary)return;(ue=(se=O.target)==null?void 0:se.setPointerCapture)==null||ue.call(se,O.pointerId),Z.current=!1;const{x:P,y:ee}=fn(O.nativeEvent,k.current);_.setState({userSelectionRect:{width:0,height:0,startX:P,startY:ee,x:P,y:ee}}),J||(O.stopPropagation(),O.preventDefault())},G=O=>{const{userSelectionRect:$,transform:J,nodeLookup:R,edgeLookup:Y,connectionLookup:P,triggerNodeChanges:ee,triggerEdgeChanges:se,defaultEdgeOptions:ue,resetSelectedElements:oe}=_.getState();if(!k.current||!$)return;const{x:ce,y:fe}=fn(O.nativeEvent,k.current),{startX:we,startY:ve}=$;if(!Z.current){const je=i?0:s;if(Math.hypot(ce-we,fe-ve)<=je)return;oe(),u==null||u(O)}Z.current=!0;const ge={startX:we,startY:ve,x:ce<we?ce:we,y:fe<ve?fe:ve,width:Math.abs(ce-we),height:Math.abs(fe-ve)},ye=L.current,Ce=V.current;L.current=new Set(_h(R,ge,J,a===Fr.Partial,!0).map(je=>je.id)),V.current=new Set;const Ue=(ue==null?void 0:ue.selectable)??!0;for(const je of L.current){const nt=P.get(je);if(nt)for(const{edgeId:kt}of nt.values()){const ht=Y.get(kt);ht&&(ht.selectable??Ue)&&V.current.add(kt)}}if(!vy(ye,L.current)){const je=Sa(R,L.current,!0);ee(je)}if(!vy(Ce,V.current)){const je=Sa(Y,V.current);se(je)}_.setState({userSelectionRect:ge,userSelectionActive:!0,nodesSelectionActive:!1})},z=O=>{var $,J;O.button===0&&((J=($=O.target)==null?void 0:$.releasePointerCapture)==null||J.call($,O.pointerId),!E&&O.target===H.current&&_.getState().userSelectionRect&&(le==null||le(O)),_.setState({userSelectionActive:!1,userSelectionRect:null}),Z.current&&(h==null||h(O),_.setState({nodesSelectionActive:L.current.size>0})))},B=r===!0||Array.isArray(r)&&r.includes(0);return g.jsxs("div",{className:st(["react-flow__pane",{draggable:B,dragging:j,selection:t}]),onClick:A?void 0:Cd(le,H),onContextMenu:Cd(Q,H),onWheel:Cd(X,H),onPointerEnter:A?void 0:y,onPointerMove:A?G:v,onPointerUp:A?z:void 0,onPointerDownCapture:A?D:void 0,onClickCapture:A?te:void 0,onPointerLeave:w,ref:H,style:jc,children:[S,g.jsx(TT,{})]})}function Jd({id:t,store:i,unselect:a=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:c,multiSelectionActive:u,nodeLookup:h,onError:p}=i.getState(),m=h.get(t);if(!m){p==null||p("012",Cn.error012(t));return}i.setState({nodesSelectionActive:!1}),m.selected?(a||m.selected&&u)&&(c({nodes:[m],edges:[]}),requestAnimationFrame(()=>{var x;return(x=r==null?void 0:r.current)==null?void 0:x.blur()})):s([t])}function N1({nodeRef:t,disabled:i=!1,noDragClassName:a,handleSelector:r,nodeId:s,isSelectable:c,nodeClickDistance:u}){const h=Ie(),[p,m]=T.useState(!1),x=T.useRef();return T.useEffect(()=>{x.current=h3({getStoreItems:()=>h.getState(),onNodeMouseDown:y=>{Jd({id:y,store:h,nodeRef:t})},onDragStart:()=>{m(!0)},onDragStop:()=>{m(!1)}})},[]),T.useEffect(()=>{var y,v;if(i)(y=x.current)==null||y.destroy();else if(t.current)return(v=x.current)==null||v.update({noDragClassName:a,handleSelector:r,domNode:t.current,isSelectable:c,nodeId:s,nodeClickDistance:u}),()=>{var w;(w=x.current)==null||w.destroy()}},[a,r,i,c,t,s]),p}const jT=t=>i=>i.selected&&(i.draggable||t&&typeof i.draggable>"u");function _1(){const t=Ie();return T.useCallback(a=>{const{nodeExtent:r,snapToGrid:s,snapGrid:c,nodesDraggable:u,onError:h,updateNodePositions:p,nodeLookup:m,nodeOrigin:x}=t.getState(),y=new Map,v=jT(u),w=s?c[0]:5,S=s?c[1]:5,_=a.direction.x*w*a.factor,E=a.direction.y*S*a.factor;for(const[,C]of m){if(!v(C))continue;let j={x:C.internals.positionAbsolute.x+_,y:C.internals.positionAbsolute.y+E};s&&(j=ro(j,c));const{position:N,positionAbsolute:A}=Zv({nodeId:C.id,nextPosition:j,nodeLookup:m,nodeExtent:r,nodeOrigin:x,onError:h});C.position=N,C.internals.positionAbsolute=A,y.set(C.id,C)}p(y)},[])}const Dh=T.createContext(null),zT=Dh.Provider;Dh.Consumer;const C1=()=>T.useContext(Dh),RT=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),OT=(t,i,a)=>r=>{const{connectionClickStartHandle:s,connectionMode:c,connection:u}=r,{fromHandle:h,toHandle:p,isValid:m}=u,x=(p==null?void 0:p.nodeId)===t&&(p==null?void 0:p.id)===i&&(p==null?void 0:p.type)===a;return{connectingFrom:(h==null?void 0:h.nodeId)===t&&(h==null?void 0:h.id)===i&&(h==null?void 0:h.type)===a,connectingTo:x,clickConnecting:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.id)===i&&(s==null?void 0:s.type)===a,isPossibleEndHandle:c===Ma.Strict?(h==null?void 0:h.type)!==a:t!==(h==null?void 0:h.nodeId)||i!==(h==null?void 0:h.id),connectionInProcess:!!h,clickConnectionInProcess:!!s,valid:x&&m}};function DT({type:t="source",position:i=xe.Top,isValidConnection:a,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:c=!0,id:u,onConnect:h,children:p,className:m,onMouseDown:x,onTouchStart:y,...v},w){var G,z;const S=u||null,_=t==="target",E=Ie(),C=C1(),{connectOnClick:j,noPanClassName:N,rfId:A}=Le(RT,Fe),{connectingFrom:H,connectingTo:k,clickConnecting:L,isPossibleEndHandle:V,connectionInProcess:Z,clickConnectionInProcess:le,valid:Q}=Le(OT(C,S,t),Fe);C||(z=(G=E.getState()).onError)==null||z.call(G,"010",Cn.error010());const X=B=>{const{defaultEdgeOptions:O,onConnect:$,hasDefaultEdges:J}=E.getState(),R={...O,...B};if(J){const{edges:Y,setEdges:P}=E.getState();P(IC(R,Y))}$==null||$(R),h==null||h(R)},te=B=>{if(!C)return;const O=e1(B.nativeEvent);if(s&&(O&&B.button===0||!O)){const $=E.getState();Id.onPointerDown(B.nativeEvent,{handleDomNode:B.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:_,handleId:S,nodeId:C,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:$.onConnectEnd,updateConnection:$.updateConnection,onConnect:X,isValidConnection:a||$.isValidConnection,getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}O?x==null||x(B):y==null||y(B)},D=B=>{const{onClickConnectStart:O,onClickConnectEnd:$,connectionClickStartHandle:J,connectionMode:R,isValidConnection:Y,lib:P,rfId:ee,nodeLookup:se,connection:ue}=E.getState();if(!C||!J&&!s)return;if(!J){O==null||O(B.nativeEvent,{nodeId:C,handleId:S,handleType:t}),E.setState({connectionClickStartHandle:{nodeId:C,type:t,id:S}});return}const oe=Jv(B.target),ce=a||Y,{connection:fe,isValid:we}=Id.isValid(B.nativeEvent,{handle:{nodeId:C,id:S,type:t},connectionMode:R,fromNodeId:J.nodeId,fromHandleId:J.id||null,fromType:J.type,isValidConnection:ce,flowId:ee,doc:oe,lib:P,nodeLookup:se});we&&fe&&X(fe);const ve=structuredClone(ue);delete ve.inProgress,ve.toPosition=ve.toHandle?ve.toHandle.position:null,$==null||$(B,ve),E.setState({connectionClickStartHandle:null})};return g.jsx("div",{"data-handleid":S,"data-nodeid":C,"data-handlepos":i,"data-id":`${A}-${C}-${S}-${t}`,className:st(["react-flow__handle",`react-flow__handle-${i}`,"nodrag",N,m,{source:!_,target:_,connectable:r,connectablestart:s,connectableend:c,clickconnecting:L,connectingfrom:H,connectingto:k,valid:Q,connectionindicator:r&&(!Z||V)&&(Z||le?c:s)}]),onMouseDown:te,onTouchStart:te,onClick:j?D:void 0,ref:w,...v,children:p})}const Da=T.memo(S1(DT));function kT({data:t,isConnectable:i,sourcePosition:a=xe.Bottom}){return g.jsxs(g.Fragment,{children:[t==null?void 0:t.label,g.jsx(Da,{type:"source",position:a,isConnectable:i})]})}function LT({data:t,isConnectable:i,targetPosition:a=xe.Top,sourcePosition:r=xe.Bottom}){return g.jsxs(g.Fragment,{children:[g.jsx(Da,{type:"target",position:a,isConnectable:i}),t==null?void 0:t.label,g.jsx(Da,{type:"source",position:r,isConnectable:i})]})}function HT(){return null}function BT({data:t,isConnectable:i,targetPosition:a=xe.Top}){return g.jsxs(g.Fragment,{children:[g.jsx(Da,{type:"target",position:a,isConnectable:i}),t==null?void 0:t.label]})}const dc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Py={input:kT,default:LT,output:BT,group:HT};function UT(t){var i,a,r,s;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((i=t.style)==null?void 0:i.width),height:t.height??t.initialHeight??((a=t.style)==null?void 0:a.height)}:{width:t.width??((r=t.style)==null?void 0:r.width),height:t.height??((s=t.style)==null?void 0:s.height)}}const VT=t=>{const{width:i,height:a,x:r,y:s}=ao(t.nodeLookup,{filter:c=>!!c.selected});return{width:un(i)?i:null,height:un(a)?a:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${s}px)`}};function $T({onSelectionContextMenu:t,noPanClassName:i,disableKeyboardA11y:a}){const r=Ie(),{width:s,height:c,transformString:u,userSelectionActive:h}=Le(VT,Fe),p=_1(),m=T.useRef(null);if(T.useEffect(()=>{var v;a||(v=m.current)==null||v.focus({preventScroll:!0})},[a]),N1({nodeRef:m}),h||!s||!c)return null;const x=t?v=>{const w=r.getState().nodes.filter(S=>S.selected);t(v,w)}:void 0,y=v=>{Object.prototype.hasOwnProperty.call(dc,v.key)&&(v.preventDefault(),p({direction:dc[v.key],factor:v.shiftKey?4:1}))};return g.jsx("div",{className:st(["react-flow__nodesselection","react-flow__container",i]),style:{transform:u},children:g.jsx("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:x,tabIndex:a?void 0:-1,onKeyDown:a?void 0:y,style:{width:s,height:c}})})}const Fy=typeof window<"u"?window:void 0,YT=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function T1({children:t,onPaneClick:i,onPaneMouseEnter:a,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:c,onPaneScroll:u,paneClickDistance:h,deleteKeyCode:p,selectionKeyCode:m,selectionOnDrag:x,selectionMode:y,onSelectionStart:v,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:_,zoomActivationKeyCode:E,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:N,panOnScroll:A,panOnScrollSpeed:H,panOnScrollMode:k,zoomOnDoubleClick:L,panOnDrag:V,defaultViewport:Z,translateExtent:le,minZoom:Q,maxZoom:X,preventScrolling:te,onSelectionContextMenu:D,noWheelClassName:G,noPanClassName:z,disableKeyboardA11y:B,onViewportChange:O,isControlledViewport:$}){const{nodesSelectionActive:J,userSelectionActive:R}=Le(YT,Fe),Y=Wr(m,{target:Fy}),P=Wr(_,{target:Fy}),ee=P||V,se=P||A,ue=x&&ee!==!0,oe=Y||R||ue;return ST({deleteKeyCode:p,multiSelectionKeyCode:S}),g.jsx(_T,{onPaneContextMenu:c,elementsSelectable:C,zoomOnScroll:j,zoomOnPinch:N,panOnScroll:se,panOnScrollSpeed:H,panOnScrollMode:k,zoomOnDoubleClick:L,panOnDrag:!Y&&ee,defaultViewport:Z,translateExtent:le,minZoom:Q,maxZoom:X,zoomActivationKeyCode:E,preventScrolling:te,noWheelClassName:G,noPanClassName:z,onViewportChange:O,isControlledViewport:$,paneClickDistance:h,selectionOnDrag:ue,children:g.jsxs(MT,{onSelectionStart:v,onSelectionEnd:w,onPaneClick:i,onPaneMouseEnter:a,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:c,onPaneScroll:u,panOnDrag:ee,isSelecting:!!oe,selectionMode:y,selectionKeyPressed:Y,paneClickDistance:h,selectionOnDrag:ue,children:[t,J&&g.jsx($T,{onSelectionContextMenu:D,noPanClassName:z,disableKeyboardA11y:B})]})})}T1.displayName="FlowRenderer";const qT=T.memo(T1),XT=t=>i=>t?_h(i.nodeLookup,{x:0,y:0,width:i.width,height:i.height},i.transform,!0).map(a=>a.id):Array.from(i.nodeLookup.keys());function GT(t){return Le(T.useCallback(XT(t),[t]),Fe)}const ZT=t=>t.updateNodeInternals;function QT(){const t=Le(ZT),[i]=T.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(a=>{const r=new Map;a.forEach(s=>{const c=s.target.getAttribute("data-id");r.set(c,{id:c,nodeElement:s.target,force:!0})}),t(r)}));return T.useEffect(()=>()=>{i==null||i.disconnect()},[i]),i}function KT({node:t,nodeType:i,hasDimensions:a,resizeObserver:r}){const s=Ie(),c=T.useRef(null),u=T.useRef(null),h=T.useRef(t.sourcePosition),p=T.useRef(t.targetPosition),m=T.useRef(i),x=a&&!!t.internals.handleBounds;return T.useEffect(()=>{c.current&&!t.hidden&&(!x||u.current!==c.current)&&(u.current&&(r==null||r.unobserve(u.current)),r==null||r.observe(c.current),u.current=c.current)},[x,t.hidden]),T.useEffect(()=>()=>{u.current&&(r==null||r.unobserve(u.current),u.current=null)},[]),T.useEffect(()=>{if(c.current){const y=m.current!==i,v=h.current!==t.sourcePosition,w=p.current!==t.targetPosition;(y||v||w)&&(m.current=i,h.current=t.sourcePosition,p.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:c.current,force:!0}]])))}},[t.id,i,t.sourcePosition,t.targetPosition]),c}function PT({id:t,onClick:i,onMouseEnter:a,onMouseMove:r,onMouseLeave:s,onContextMenu:c,onDoubleClick:u,nodesDraggable:h,elementsSelectable:p,nodesConnectable:m,nodesFocusable:x,resizeObserver:y,noDragClassName:v,noPanClassName:w,disableKeyboardA11y:S,rfId:_,nodeTypes:E,nodeClickDistance:C,onError:j}){const{node:N,internals:A,isParent:H}=Le(ce=>{const fe=ce.nodeLookup.get(t),we=ce.parentLookup.has(t);return{node:fe,internals:fe.internals,isParent:we}},Fe);let k=N.type||"default",L=(E==null?void 0:E[k])||Py[k];L===void 0&&(j==null||j("003",Cn.error003(k)),k="default",L=(E==null?void 0:E.default)||Py.default);const V=!!(N.draggable||h&&typeof N.draggable>"u"),Z=!!(N.selectable||p&&typeof N.selectable>"u"),le=!!(N.connectable||m&&typeof N.connectable>"u"),Q=!!(N.focusable||x&&typeof N.focusable>"u"),X=Ie(),te=Fv(N),D=KT({node:N,nodeType:k,hasDimensions:te,resizeObserver:y}),G=N1({nodeRef:D,disabled:N.hidden||!V,noDragClassName:v,handleSelector:N.dragHandle,nodeId:t,isSelectable:Z,nodeClickDistance:C}),z=_1();if(N.hidden)return null;const B=si(N),O=UT(N),$=Z||V||i||a||r||s,J=a?ce=>a(ce,{...A.userNode}):void 0,R=r?ce=>r(ce,{...A.userNode}):void 0,Y=s?ce=>s(ce,{...A.userNode}):void 0,P=c?ce=>c(ce,{...A.userNode}):void 0,ee=u?ce=>u(ce,{...A.userNode}):void 0,se=ce=>{const{selectNodesOnDrag:fe,nodeDragThreshold:we}=X.getState();Z&&(!fe||!V||we>0)&&Jd({id:t,store:X,nodeRef:D}),i&&i(ce,{...A.userNode})},ue=ce=>{if(!(Wv(ce.nativeEvent)||S)){if($v.includes(ce.key)&&Z){const fe=ce.key==="Escape";Jd({id:t,store:X,unselect:fe,nodeRef:D})}else if(V&&N.selected&&Object.prototype.hasOwnProperty.call(dc,ce.key)){ce.preventDefault();const{ariaLabelConfig:fe}=X.getState();X.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:ce.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),z({direction:dc[ce.key],factor:ce.shiftKey?4:1})}}},oe=()=>{var Ce;if(S||!((Ce=D.current)!=null&&Ce.matches(":focus-visible")))return;const{transform:ce,width:fe,height:we,autoPanOnNodeFocus:ve,setCenter:ge}=X.getState();if(!ve)return;_h(new Map([[t,N]]),{x:0,y:0,width:fe,height:we},ce,!0).length>0||ge(N.position.x+B.width/2,N.position.y+B.height/2,{zoom:ce[2]})};return g.jsx("div",{className:st(["react-flow__node",`react-flow__node-${k}`,{[w]:V},N.className,{selected:N.selected,selectable:Z,parent:H,draggable:V,dragging:G}]),ref:D,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:te?"visible":"hidden",...N.style,...O},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:J,onMouseMove:R,onMouseLeave:Y,onContextMenu:P,onClick:se,onDoubleClick:ee,onKeyDown:Q?ue:void 0,tabIndex:Q?0:void 0,onFocus:Q?oe:void 0,role:N.ariaRole??(Q?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${x1}-${_}`,"aria-label":N.ariaLabel,...N.domAttributes,children:g.jsx(zT,{value:t,children:g.jsx(L,{id:t,data:N.data,type:k,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:N.selected??!1,selectable:Z,draggable:V,deletable:N.deletable??!0,isConnectable:le,sourcePosition:N.sourcePosition,targetPosition:N.targetPosition,dragging:G,dragHandle:N.dragHandle,zIndex:A.z,parentId:N.parentId,...B})})})}var FT=T.memo(PT);const IT=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function A1(t){const{nodesDraggable:i,nodesConnectable:a,nodesFocusable:r,elementsSelectable:s,onError:c}=Le(IT,Fe),u=GT(t.onlyRenderVisibleElements),h=QT();return g.jsx("div",{className:"react-flow__nodes",style:jc,children:u.map(p=>g.jsx(FT,{id:p,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:h,nodesDraggable:i,nodesConnectable:a,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:c},p))})}A1.displayName="NodeRenderer";const JT=T.memo(A1);function WT(t){return Le(T.useCallback(a=>{if(!t)return a.edges.map(s=>s.id);const r=[];if(a.width&&a.height)for(const s of a.edges){const c=a.nodeLookup.get(s.source),u=a.nodeLookup.get(s.target);c&&u&&KC({sourceNode:c,targetNode:u,width:a.width,height:a.height,transform:a.transform})&&r.push(s.id)}return r},[t]),Fe)}const eA=({color:t="none",strokeWidth:i=1})=>{const a={strokeWidth:i,...t&&{stroke:t}};return g.jsx("polyline",{className:"arrow",style:a,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},tA=({color:t="none",strokeWidth:i=1})=>{const a={strokeWidth:i,...t&&{stroke:t,fill:t}};return g.jsx("polyline",{className:"arrowclosed",style:a,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Iy={[cc.Arrow]:eA,[cc.ArrowClosed]:tA};function nA(t){const i=Ie();return T.useMemo(()=>{var s,c;return Object.prototype.hasOwnProperty.call(Iy,t)?Iy[t]:((c=(s=i.getState()).onError)==null||c.call(s,"009",Cn.error009(t)),null)},[t])}const iA=({id:t,type:i,color:a,width:r=12.5,height:s=12.5,markerUnits:c="strokeWidth",strokeWidth:u,orient:h="auto-start-reverse"})=>{const p=nA(i);return p?g.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:c,orient:h,refX:"0",refY:"0",children:g.jsx(p,{color:a,strokeWidth:u})}):null},M1=({defaultColor:t,rfId:i})=>{const a=Le(c=>c.edges),r=Le(c=>c.defaultEdgeOptions),s=T.useMemo(()=>n3(a,{id:i,defaultColor:t,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[a,r,i,t]);return s.length?g.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:g.jsx("defs",{children:s.map(c=>g.jsx(iA,{id:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,strokeWidth:c.strokeWidth,orient:c.orient},c.id))})}):null};M1.displayName="MarkerDefinitions";var lA=T.memo(M1);function j1({x:t,y:i,label:a,labelStyle:r,labelShowBg:s=!0,labelBgStyle:c,labelBgPadding:u=[2,4],labelBgBorderRadius:h=2,children:p,className:m,...x}){const[y,v]=T.useState({x:1,y:0,width:0,height:0}),w=st(["react-flow__edge-textwrapper",m]),S=T.useRef(null);return T.useEffect(()=>{if(S.current){const _=S.current.getBBox();v({x:_.x,y:_.y,width:_.width,height:_.height})}},[a]),a?g.jsxs("g",{transform:`translate(${t-y.width/2} ${i-y.height/2})`,className:w,visibility:y.width?"visible":"hidden",...x,children:[s&&g.jsx("rect",{width:y.width+2*u[0],x:-u[0],y:-u[1],height:y.height+2*u[1],className:"react-flow__edge-textbg",style:c,rx:h,ry:h}),g.jsx("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:S,style:r,children:a}),p]}):null}j1.displayName="EdgeText";const aA=T.memo(j1);function zc({path:t,labelX:i,labelY:a,label:r,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p,interactionWidth:m=20,...x}){return g.jsxs(g.Fragment,{children:[g.jsx("path",{...x,d:t,fill:"none",className:st(["react-flow__edge-path",x.className])}),m?g.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}):null,r&&un(i)&&un(a)?g.jsx(aA,{x:i,y:a,label:r,labelStyle:s,labelShowBg:c,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:p}):null]})}function Jy({pos:t,x1:i,y1:a,x2:r,y2:s}){return t===xe.Left||t===xe.Right?[.5*(i+r),a]:[i,.5*(a+s)]}function z1({sourceX:t,sourceY:i,sourcePosition:a=xe.Bottom,targetX:r,targetY:s,targetPosition:c=xe.Top}){const[u,h]=Jy({pos:a,x1:t,y1:i,x2:r,y2:s}),[p,m]=Jy({pos:c,x1:r,y1:s,x2:t,y2:i}),[x,y,v,w]=t1({sourceX:t,sourceY:i,targetX:r,targetY:s,sourceControlX:u,sourceControlY:h,targetControlX:p,targetControlY:m});return[`M${t},${i} C${u},${h} ${p},${m} ${r},${s}`,x,y,v,w]}function R1(t){return T.memo(({id:i,sourceX:a,sourceY:r,targetX:s,targetY:c,sourcePosition:u,targetPosition:h,label:p,labelStyle:m,labelShowBg:x,labelBgStyle:y,labelBgPadding:v,labelBgBorderRadius:w,style:S,markerEnd:_,markerStart:E,interactionWidth:C})=>{const[j,N,A]=z1({sourceX:a,sourceY:r,sourcePosition:u,targetX:s,targetY:c,targetPosition:h}),H=t.isInternal?void 0:i;return g.jsx(zc,{id:H,path:j,labelX:N,labelY:A,label:p,labelStyle:m,labelShowBg:x,labelBgStyle:y,labelBgPadding:v,labelBgBorderRadius:w,style:S,markerEnd:_,markerStart:E,interactionWidth:C})})}const rA=R1({isInternal:!1}),O1=R1({isInternal:!0});rA.displayName="SimpleBezierEdge";O1.displayName="SimpleBezierEdgeInternal";function D1(t){return T.memo(({id:i,sourceX:a,sourceY:r,targetX:s,targetY:c,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,sourcePosition:w=xe.Bottom,targetPosition:S=xe.Top,markerEnd:_,markerStart:E,pathOptions:C,interactionWidth:j})=>{const[N,A,H]=Kd({sourceX:a,sourceY:r,sourcePosition:w,targetX:s,targetY:c,targetPosition:S,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),k=t.isInternal?void 0:i;return g.jsx(zc,{id:k,path:N,labelX:A,labelY:H,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:_,markerStart:E,interactionWidth:j})})}const k1=D1({isInternal:!1}),L1=D1({isInternal:!0});k1.displayName="SmoothStepEdge";L1.displayName="SmoothStepEdgeInternal";function H1(t){return T.memo(({id:i,...a})=>{var s;const r=t.isInternal?void 0:i;return g.jsx(k1,{...a,id:r,pathOptions:T.useMemo(()=>{var c;return{borderRadius:0,offset:(c=a.pathOptions)==null?void 0:c.offset}},[(s=a.pathOptions)==null?void 0:s.offset])})})}const oA=H1({isInternal:!1}),B1=H1({isInternal:!0});oA.displayName="StepEdge";B1.displayName="StepEdgeInternal";function U1(t){return T.memo(({id:i,sourceX:a,sourceY:r,targetX:s,targetY:c,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:S,interactionWidth:_})=>{const[E,C,j]=l1({sourceX:a,sourceY:r,targetX:s,targetY:c}),N=t.isInternal?void 0:i;return g.jsx(zc,{id:N,path:E,labelX:C,labelY:j,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:x,labelBgBorderRadius:y,style:v,markerEnd:w,markerStart:S,interactionWidth:_})})}const sA=U1({isInternal:!1}),V1=U1({isInternal:!0});sA.displayName="StraightEdge";V1.displayName="StraightEdgeInternal";function $1(t){return T.memo(({id:i,sourceX:a,sourceY:r,targetX:s,targetY:c,sourcePosition:u=xe.Bottom,targetPosition:h=xe.Top,label:p,labelStyle:m,labelShowBg:x,labelBgStyle:y,labelBgPadding:v,labelBgBorderRadius:w,style:S,markerEnd:_,markerStart:E,pathOptions:C,interactionWidth:j})=>{const[N,A,H]=n1({sourceX:a,sourceY:r,sourcePosition:u,targetX:s,targetY:c,targetPosition:h,curvature:C==null?void 0:C.curvature}),k=t.isInternal?void 0:i;return g.jsx(zc,{id:k,path:N,labelX:A,labelY:H,label:p,labelStyle:m,labelShowBg:x,labelBgStyle:y,labelBgPadding:v,labelBgBorderRadius:w,style:S,markerEnd:_,markerStart:E,interactionWidth:j})})}const cA=$1({isInternal:!1}),Y1=$1({isInternal:!0});cA.displayName="BezierEdge";Y1.displayName="BezierEdgeInternal";const Wy={default:Y1,straight:V1,step:B1,smoothstep:L1,simplebezier:O1},ex={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},uA=(t,i,a)=>a===xe.Left?t-i:a===xe.Right?t+i:t,fA=(t,i,a)=>a===xe.Top?t-i:a===xe.Bottom?t+i:t,tx="react-flow__edgeupdater";function nx({position:t,centerX:i,centerY:a,radius:r=10,onMouseDown:s,onMouseEnter:c,onMouseOut:u,type:h}){return g.jsx("circle",{onMouseDown:s,onMouseEnter:c,onMouseOut:u,className:st([tx,`${tx}-${h}`]),cx:uA(i,r,t),cy:fA(a,r,t),r,stroke:"transparent",fill:"transparent"})}function dA({isReconnectable:t,reconnectRadius:i,edge:a,sourceX:r,sourceY:s,targetX:c,targetY:u,sourcePosition:h,targetPosition:p,onReconnect:m,onReconnectStart:x,onReconnectEnd:y,setReconnecting:v,setUpdateHover:w}){const S=Ie(),_=(A,H)=>{if(A.button!==0)return;const{autoPanOnConnect:k,domNode:L,isValidConnection:V,connectionMode:Z,connectionRadius:le,lib:Q,onConnectStart:X,onConnectEnd:te,cancelConnection:D,nodeLookup:G,rfId:z,panBy:B,updateConnection:O}=S.getState(),$=H.type==="target",J=(P,ee)=>{v(!1),y==null||y(P,a,H.type,ee)},R=P=>m==null?void 0:m(a,P),Y=(P,ee)=>{v(!0),x==null||x(A,a,H.type),X==null||X(P,ee)};Id.onPointerDown(A.nativeEvent,{autoPanOnConnect:k,connectionMode:Z,connectionRadius:le,domNode:L,handleId:H.id,nodeId:H.nodeId,nodeLookup:G,isTarget:$,edgeUpdaterType:H.type,lib:Q,flowId:z,cancelConnection:D,panBy:B,isValidConnection:V,onConnect:R,onConnectStart:Y,onConnectEnd:te,onReconnectEnd:J,updateConnection:O,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},E=A=>_(A,{nodeId:a.target,id:a.targetHandle??null,type:"target"}),C=A=>_(A,{nodeId:a.source,id:a.sourceHandle??null,type:"source"}),j=()=>w(!0),N=()=>w(!1);return g.jsxs(g.Fragment,{children:[(t===!0||t==="source")&&g.jsx(nx,{position:h,centerX:r,centerY:s,radius:i,onMouseDown:E,onMouseEnter:j,onMouseOut:N,type:"source"}),(t===!0||t==="target")&&g.jsx(nx,{position:p,centerX:c,centerY:u,radius:i,onMouseDown:C,onMouseEnter:j,onMouseOut:N,type:"target"})]})}function hA({id:t,edgesFocusable:i,edgesReconnectable:a,elementsSelectable:r,onClick:s,onDoubleClick:c,onContextMenu:u,onMouseEnter:h,onMouseMove:p,onMouseLeave:m,reconnectRadius:x,onReconnect:y,onReconnectStart:v,onReconnectEnd:w,rfId:S,edgeTypes:_,noPanClassName:E,onError:C,disableKeyboardA11y:j}){let N=Le(ge=>ge.edgeLookup.get(t));const A=Le(ge=>ge.defaultEdgeOptions);N=A?{...A,...N}:N;let H=N.type||"default",k=(_==null?void 0:_[H])||Wy[H];k===void 0&&(C==null||C("011",Cn.error011(H)),H="default",k=(_==null?void 0:_.default)||Wy.default);const L=!!(N.focusable||i&&typeof N.focusable>"u"),V=typeof y<"u"&&(N.reconnectable||a&&typeof N.reconnectable>"u"),Z=!!(N.selectable||r&&typeof N.selectable>"u"),le=T.useRef(null),[Q,X]=T.useState(!1),[te,D]=T.useState(!1),G=Ie(),{zIndex:z,sourceX:B,sourceY:O,targetX:$,targetY:J,sourcePosition:R,targetPosition:Y}=Le(T.useCallback(ge=>{const ye=ge.nodeLookup.get(N.source),Ce=ge.nodeLookup.get(N.target);if(!ye||!Ce)return{zIndex:N.zIndex,...ex};const Ue=t3({id:t,sourceNode:ye,targetNode:Ce,sourceHandle:N.sourceHandle||null,targetHandle:N.targetHandle||null,connectionMode:ge.connectionMode,onError:C});return{zIndex:QC({selected:N.selected,zIndex:N.zIndex,sourceNode:ye,targetNode:Ce,elevateOnSelect:ge.elevateEdgesOnSelect,zIndexMode:ge.zIndexMode}),...Ue||ex}},[N.source,N.target,N.sourceHandle,N.targetHandle,N.selected,N.zIndex]),Fe),P=T.useMemo(()=>N.markerStart?`url('#${Pd(N.markerStart,S)}')`:void 0,[N.markerStart,S]),ee=T.useMemo(()=>N.markerEnd?`url('#${Pd(N.markerEnd,S)}')`:void 0,[N.markerEnd,S]);if(N.hidden||B===null||O===null||$===null||J===null)return null;const se=ge=>{var je;const{addSelectedEdges:ye,unselectNodesAndEdges:Ce,multiSelectionActive:Ue}=G.getState();Z&&(G.setState({nodesSelectionActive:!1}),N.selected&&Ue?(Ce({nodes:[],edges:[N]}),(je=le.current)==null||je.blur()):ye([t])),s&&s(ge,N)},ue=c?ge=>{c(ge,{...N})}:void 0,oe=u?ge=>{u(ge,{...N})}:void 0,ce=h?ge=>{h(ge,{...N})}:void 0,fe=p?ge=>{p(ge,{...N})}:void 0,we=m?ge=>{m(ge,{...N})}:void 0,ve=ge=>{var ye;if(!j&&$v.includes(ge.key)&&Z){const{unselectNodesAndEdges:Ce,addSelectedEdges:Ue}=G.getState();ge.key==="Escape"?((ye=le.current)==null||ye.blur(),Ce({edges:[N]})):Ue([t])}};return g.jsx("svg",{style:{zIndex:z},children:g.jsxs("g",{className:st(["react-flow__edge",`react-flow__edge-${H}`,N.className,E,{selected:N.selected,animated:N.animated,inactive:!Z&&!s,updating:Q,selectable:Z}]),onClick:se,onDoubleClick:ue,onContextMenu:oe,onMouseEnter:ce,onMouseMove:fe,onMouseLeave:we,onKeyDown:L?ve:void 0,tabIndex:L?0:void 0,role:N.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":N.ariaLabel===null?void 0:N.ariaLabel||`Edge from ${N.source} to ${N.target}`,"aria-describedby":L?`${v1}-${S}`:void 0,ref:le,...N.domAttributes,children:[!te&&g.jsx(k,{id:t,source:N.source,target:N.target,type:N.type,selected:N.selected,animated:N.animated,selectable:Z,deletable:N.deletable??!0,label:N.label,labelStyle:N.labelStyle,labelShowBg:N.labelShowBg,labelBgStyle:N.labelBgStyle,labelBgPadding:N.labelBgPadding,labelBgBorderRadius:N.labelBgBorderRadius,sourceX:B,sourceY:O,targetX:$,targetY:J,sourcePosition:R,targetPosition:Y,data:N.data,style:N.style,sourceHandleId:N.sourceHandle,targetHandleId:N.targetHandle,markerStart:P,markerEnd:ee,pathOptions:"pathOptions"in N?N.pathOptions:void 0,interactionWidth:N.interactionWidth}),V&&g.jsx(dA,{edge:N,isReconnectable:V,reconnectRadius:x,onReconnect:y,onReconnectStart:v,onReconnectEnd:w,sourceX:B,sourceY:O,targetX:$,targetY:J,sourcePosition:R,targetPosition:Y,setUpdateHover:X,setReconnecting:D})]})})}var mA=T.memo(hA);const pA=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function q1({defaultMarkerColor:t,onlyRenderVisibleElements:i,rfId:a,edgeTypes:r,noPanClassName:s,onReconnect:c,onEdgeContextMenu:u,onEdgeMouseEnter:h,onEdgeMouseMove:p,onEdgeMouseLeave:m,onEdgeClick:x,reconnectRadius:y,onEdgeDoubleClick:v,onReconnectStart:w,onReconnectEnd:S,disableKeyboardA11y:_}){const{edgesFocusable:E,edgesReconnectable:C,elementsSelectable:j,onError:N}=Le(pA,Fe),A=WT(i);return g.jsxs("div",{className:"react-flow__edges",children:[g.jsx(lA,{defaultColor:t,rfId:a}),A.map(H=>g.jsx(mA,{id:H,edgesFocusable:E,edgesReconnectable:C,elementsSelectable:j,noPanClassName:s,onReconnect:c,onContextMenu:u,onMouseEnter:h,onMouseMove:p,onMouseLeave:m,onClick:x,reconnectRadius:y,onDoubleClick:v,onReconnectStart:w,onReconnectEnd:S,rfId:a,onError:N,edgeTypes:r,disableKeyboardA11y:_},H))]})}q1.displayName="EdgeRenderer";const gA=T.memo(q1),yA=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function xA({children:t}){const i=Le(yA);return g.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:i},children:t})}function vA(t){const i=Oh(),a=T.useRef(!1);T.useEffect(()=>{!a.current&&i.viewportInitialized&&t&&(setTimeout(()=>t(i),1),a.current=!0)},[t,i.viewportInitialized])}const bA=t=>{var i;return(i=t.panZoom)==null?void 0:i.syncViewport};function wA(t){const i=Le(bA),a=Ie();return T.useEffect(()=>{t&&(i==null||i(t),a.setState({transform:[t.x,t.y,t.zoom]}))},[t,i]),null}function SA(t){return t.connection.inProgress?{...t.connection,to:oo(t.connection.to,t.transform)}:{...t.connection}}function EA(t){return SA}function NA(t){const i=EA();return Le(i,Fe)}const _A=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function CA({containerStyle:t,style:i,type:a,component:r}){const{nodesConnectable:s,width:c,height:u,isValid:h,inProgress:p}=Le(_A,Fe);return!(c&&s&&p)?null:g.jsx("svg",{style:t,width:c,height:u,className:"react-flow__connectionline react-flow__container",children:g.jsx("g",{className:st(["react-flow__connection",Xv(h)]),children:g.jsx(X1,{style:i,type:a,CustomComponent:r,isValid:h})})})}const X1=({style:t,type:i=Yi.Bezier,CustomComponent:a,isValid:r})=>{const{inProgress:s,from:c,fromNode:u,fromHandle:h,fromPosition:p,to:m,toNode:x,toHandle:y,toPosition:v,pointer:w}=NA();if(!s)return;if(a)return g.jsx(a,{connectionLineType:i,connectionLineStyle:t,fromNode:u,fromHandle:h,fromX:c.x,fromY:c.y,toX:m.x,toY:m.y,fromPosition:p,toPosition:v,connectionStatus:Xv(r),toNode:x,toHandle:y,pointer:w});let S="";const _={sourceX:c.x,sourceY:c.y,sourcePosition:p,targetX:m.x,targetY:m.y,targetPosition:v};switch(i){case Yi.Bezier:[S]=n1(_);break;case Yi.SimpleBezier:[S]=z1(_);break;case Yi.Step:[S]=Kd({..._,borderRadius:0});break;case Yi.SmoothStep:[S]=Kd(_);break;default:[S]=l1(_)}return g.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:t})};X1.displayName="ConnectionLine";const TA={};function ix(t=TA){T.useRef(t),Ie(),T.useEffect(()=>{},[t])}function AA(){Ie(),T.useRef(!1),T.useEffect(()=>{},[])}function G1({nodeTypes:t,edgeTypes:i,onInit:a,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:c,onEdgeDoubleClick:u,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:m,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:v,onSelectionEnd:w,connectionLineType:S,connectionLineStyle:_,connectionLineComponent:E,connectionLineContainerStyle:C,selectionKeyCode:j,selectionOnDrag:N,selectionMode:A,multiSelectionKeyCode:H,panActivationKeyCode:k,zoomActivationKeyCode:L,deleteKeyCode:V,onlyRenderVisibleElements:Z,elementsSelectable:le,defaultViewport:Q,translateExtent:X,minZoom:te,maxZoom:D,preventScrolling:G,defaultMarkerColor:z,zoomOnScroll:B,zoomOnPinch:O,panOnScroll:$,panOnScrollSpeed:J,panOnScrollMode:R,zoomOnDoubleClick:Y,panOnDrag:P,onPaneClick:ee,onPaneMouseEnter:se,onPaneMouseMove:ue,onPaneMouseLeave:oe,onPaneScroll:ce,onPaneContextMenu:fe,paneClickDistance:we,nodeClickDistance:ve,onEdgeContextMenu:ge,onEdgeMouseEnter:ye,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ue,reconnectRadius:je,onReconnect:nt,onReconnectStart:kt,onReconnectEnd:ht,noDragClassName:nn,noWheelClassName:jn,noPanClassName:Pi,disableKeyboardA11y:Fi,nodeExtent:pt,rfId:Rl,viewport:zn,onViewportChange:ci}){return ix(t),ix(i),AA(),vA(a),wA(zn),g.jsx(qT,{onPaneClick:ee,onPaneMouseEnter:se,onPaneMouseMove:ue,onPaneMouseLeave:oe,onPaneContextMenu:fe,onPaneScroll:ce,paneClickDistance:we,deleteKeyCode:V,selectionKeyCode:j,selectionOnDrag:N,selectionMode:A,onSelectionStart:v,onSelectionEnd:w,multiSelectionKeyCode:H,panActivationKeyCode:k,zoomActivationKeyCode:L,elementsSelectable:le,zoomOnScroll:B,zoomOnPinch:O,zoomOnDoubleClick:Y,panOnScroll:$,panOnScrollSpeed:J,panOnScrollMode:R,panOnDrag:P,defaultViewport:Q,translateExtent:X,minZoom:te,maxZoom:D,onSelectionContextMenu:y,preventScrolling:G,noDragClassName:nn,noWheelClassName:jn,noPanClassName:Pi,disableKeyboardA11y:Fi,onViewportChange:ci,isControlledViewport:!!zn,children:g.jsxs(xA,{children:[g.jsx(gA,{edgeTypes:i,onEdgeClick:s,onEdgeDoubleClick:u,onReconnect:nt,onReconnectStart:kt,onReconnectEnd:ht,onlyRenderVisibleElements:Z,onEdgeContextMenu:ge,onEdgeMouseEnter:ye,onEdgeMouseMove:Ce,onEdgeMouseLeave:Ue,reconnectRadius:je,defaultMarkerColor:z,noPanClassName:Pi,disableKeyboardA11y:Fi,rfId:Rl}),g.jsx(CA,{style:_,type:S,component:E,containerStyle:C}),g.jsx("div",{className:"react-flow__edgelabel-renderer"}),g.jsx(JT,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:c,onNodeMouseEnter:h,onNodeMouseMove:p,onNodeMouseLeave:m,onNodeContextMenu:x,nodeClickDistance:ve,onlyRenderVisibleElements:Z,noPanClassName:Pi,noDragClassName:nn,disableKeyboardA11y:Fi,nodeExtent:pt,rfId:Rl}),g.jsx("div",{className:"react-flow__viewport-portal"})]})})}G1.displayName="GraphView";const MA=T.memo(G1),lx=({nodes:t,edges:i,defaultNodes:a,defaultEdges:r,width:s,height:c,fitView:u,fitViewOptions:h,minZoom:p=.5,maxZoom:m=2,nodeOrigin:x,nodeExtent:y,zIndexMode:v="basic"}={})=>{const w=new Map,S=new Map,_=new Map,E=new Map,C=r??i??[],j=a??t??[],N=x??[0,0],A=y??Pr;o1(_,E,C);const H=Fd(j,w,S,{nodeOrigin:N,nodeExtent:A,zIndexMode:v});let k=[0,0,1];if(u&&s&&c){const L=ao(w,{filter:Q=>!!((Q.width||Q.initialWidth)&&(Q.height||Q.initialHeight))}),{x:V,y:Z,zoom:le}=Ch(L,s,c,p,m,(h==null?void 0:h.padding)??.1);k=[V,Z,le]}return{rfId:"1",width:s??0,height:c??0,transform:k,nodes:j,nodesInitialized:H,nodeLookup:w,parentLookup:S,edges:C,edgeLookup:E,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:a!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:p,maxZoom:m,translateExtent:Pr,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ma.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:h,fitViewResolver:null,connection:{...qv},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:$C,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Yv,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},jA=({nodes:t,edges:i,defaultNodes:a,defaultEdges:r,width:s,height:c,fitView:u,fitViewOptions:h,minZoom:p,maxZoom:m,nodeOrigin:x,nodeExtent:y,zIndexMode:v})=>G3((w,S)=>{async function _(){const{nodeLookup:E,panZoom:C,fitViewOptions:j,fitViewResolver:N,width:A,height:H,minZoom:k,maxZoom:L}=S();C&&(await UC({nodes:E,width:A,height:H,panZoom:C,minZoom:k,maxZoom:L},j),N==null||N.resolve(!0),w({fitViewResolver:null}))}return{...lx({nodes:t,edges:i,width:s,height:c,fitView:u,fitViewOptions:h,minZoom:p,maxZoom:m,nodeOrigin:x,nodeExtent:y,defaultNodes:a,defaultEdges:r,zIndexMode:v}),setNodes:E=>{const{nodeLookup:C,parentLookup:j,nodeOrigin:N,elevateNodesOnSelect:A,fitViewQueued:H,zIndexMode:k}=S(),L=Fd(E,C,j,{nodeOrigin:N,nodeExtent:y,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:k});H&&L?(_(),w({nodes:E,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0})):w({nodes:E,nodesInitialized:L})},setEdges:E=>{const{connectionLookup:C,edgeLookup:j}=S();o1(C,j,E),w({edges:E})},setDefaultNodesAndEdges:(E,C)=>{if(E){const{setNodes:j}=S();j(E),w({hasDefaultNodes:!0})}if(C){const{setEdges:j}=S();j(C),w({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:C,nodeLookup:j,parentLookup:N,domNode:A,nodeOrigin:H,nodeExtent:k,debug:L,fitViewQueued:V,zIndexMode:Z}=S(),{changes:le,updatedInternals:Q}=c3(E,j,N,A,H,k,Z);Q&&(a3(j,N,{nodeOrigin:H,nodeExtent:k,zIndexMode:Z}),V?(_(),w({fitViewQueued:!1,fitViewOptions:void 0})):w({}),(le==null?void 0:le.length)>0&&(L&&console.log("React Flow: trigger node changes",le),C==null||C(le)))},updateNodePositions:(E,C=!1)=>{const j=[];let N=[];const{nodeLookup:A,triggerNodeChanges:H,connection:k,updateConnection:L,onNodesChangeMiddlewareMap:V}=S();for(const[Z,le]of E){const Q=A.get(Z),X=!!(Q!=null&&Q.expandParent&&(Q!=null&&Q.parentId)&&(le!=null&&le.position)),te={id:Z,type:"position",position:X?{x:Math.max(0,le.position.x),y:Math.max(0,le.position.y)}:le.position,dragging:C};if(Q&&k.inProgress&&k.fromNode.id===Q.id){const D=jl(Q,k.fromHandle,xe.Left,!0);L({...k,from:D})}X&&Q.parentId&&j.push({id:Z,parentId:Q.parentId,rect:{...le.internals.positionAbsolute,width:le.measured.width??0,height:le.measured.height??0}}),N.push(te)}if(j.length>0){const{parentLookup:Z,nodeOrigin:le}=S(),Q=Rh(j,A,Z,le);N.push(...Q)}for(const Z of V.values())N=Z(N);H(N)},triggerNodeChanges:E=>{const{onNodesChange:C,setNodes:j,nodes:N,hasDefaultNodes:A,debug:H}=S();if(E!=null&&E.length){if(A){const k=hT(E,N);j(k)}H&&console.log("React Flow: trigger node changes",E),C==null||C(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:C,setEdges:j,edges:N,hasDefaultEdges:A,debug:H}=S();if(E!=null&&E.length){if(A){const k=mT(E,N);j(k)}H&&console.log("React Flow: trigger edge changes",E),C==null||C(E)}},addSelectedNodes:E=>{const{multiSelectionActive:C,edgeLookup:j,nodeLookup:N,triggerNodeChanges:A,triggerEdgeChanges:H}=S();if(C){const k=E.map(L=>Sl(L,!0));A(k);return}A(Sa(N,new Set([...E]),!0)),H(Sa(j))},addSelectedEdges:E=>{const{multiSelectionActive:C,edgeLookup:j,nodeLookup:N,triggerNodeChanges:A,triggerEdgeChanges:H}=S();if(C){const k=E.map(L=>Sl(L,!0));H(k);return}H(Sa(j,new Set([...E]))),A(Sa(N,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:C}={})=>{const{edges:j,nodes:N,nodeLookup:A,triggerNodeChanges:H,triggerEdgeChanges:k}=S(),L=E||N,V=C||j,Z=L.map(Q=>{const X=A.get(Q.id);return X&&(X.selected=!1),Sl(Q.id,!1)}),le=V.map(Q=>Sl(Q.id,!1));H(Z),k(le)},setMinZoom:E=>{const{panZoom:C,maxZoom:j}=S();C==null||C.setScaleExtent([E,j]),w({minZoom:E})},setMaxZoom:E=>{const{panZoom:C,minZoom:j}=S();C==null||C.setScaleExtent([j,E]),w({maxZoom:E})},setTranslateExtent:E=>{var C;(C=S().panZoom)==null||C.setTranslateExtent(E),w({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:C,triggerNodeChanges:j,triggerEdgeChanges:N,elementsSelectable:A}=S();if(!A)return;const H=C.reduce((L,V)=>V.selected?[...L,Sl(V.id,!1)]:L,[]),k=E.reduce((L,V)=>V.selected?[...L,Sl(V.id,!1)]:L,[]);j(H),N(k)},setNodeExtent:E=>{const{nodes:C,nodeLookup:j,parentLookup:N,nodeOrigin:A,elevateNodesOnSelect:H,nodeExtent:k,zIndexMode:L}=S();E[0][0]===k[0][0]&&E[0][1]===k[0][1]&&E[1][0]===k[1][0]&&E[1][1]===k[1][1]||(Fd(C,j,N,{nodeOrigin:A,nodeExtent:E,elevateNodesOnSelect:H,checkEquality:!1,zIndexMode:L}),w({nodeExtent:E}))},panBy:E=>{const{transform:C,width:j,height:N,panZoom:A,translateExtent:H}=S();return u3({delta:E,panZoom:A,transform:C,translateExtent:H,width:j,height:N})},setCenter:async(E,C,j)=>{const{width:N,height:A,maxZoom:H,panZoom:k}=S();if(!k)return Promise.resolve(!1);const L=typeof(j==null?void 0:j.zoom)<"u"?j.zoom:H;return await k.setViewport({x:N/2-E*L,y:A/2-C*L,zoom:L},{duration:j==null?void 0:j.duration,ease:j==null?void 0:j.ease,interpolate:j==null?void 0:j.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{w({connection:{...qv}})},updateConnection:E=>{w({connection:E})},reset:()=>w({...lx()})}},Object.is);function zA({initialNodes:t,initialEdges:i,defaultNodes:a,defaultEdges:r,initialWidth:s,initialHeight:c,initialMinZoom:u,initialMaxZoom:h,initialFitViewOptions:p,fitView:m,nodeOrigin:x,nodeExtent:y,zIndexMode:v,children:w}){const[S]=T.useState(()=>jA({nodes:t,edges:i,defaultNodes:a,defaultEdges:r,width:s,height:c,fitView:m,minZoom:u,maxZoom:h,fitViewOptions:p,nodeOrigin:x,nodeExtent:y,zIndexMode:v}));return g.jsx(Q3,{value:S,children:g.jsx(xT,{children:w})})}function RA({children:t,nodes:i,edges:a,defaultNodes:r,defaultEdges:s,width:c,height:u,fitView:h,fitViewOptions:p,minZoom:m,maxZoom:x,nodeOrigin:y,nodeExtent:v,zIndexMode:w}){return T.useContext(Ac)?g.jsx(g.Fragment,{children:t}):g.jsx(zA,{initialNodes:i,initialEdges:a,defaultNodes:r,defaultEdges:s,initialWidth:c,initialHeight:u,fitView:h,initialFitViewOptions:p,initialMinZoom:m,initialMaxZoom:x,nodeOrigin:y,nodeExtent:v,zIndexMode:w,children:t})}const OA={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function DA({nodes:t,edges:i,defaultNodes:a,defaultEdges:r,className:s,nodeTypes:c,edgeTypes:u,onNodeClick:h,onEdgeClick:p,onInit:m,onMove:x,onMoveStart:y,onMoveEnd:v,onConnect:w,onConnectStart:S,onConnectEnd:_,onClickConnectStart:E,onClickConnectEnd:C,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:A,onNodeContextMenu:H,onNodeDoubleClick:k,onNodeDragStart:L,onNodeDrag:V,onNodeDragStop:Z,onNodesDelete:le,onEdgesDelete:Q,onDelete:X,onSelectionChange:te,onSelectionDragStart:D,onSelectionDrag:G,onSelectionDragStop:z,onSelectionContextMenu:B,onSelectionStart:O,onSelectionEnd:$,onBeforeDelete:J,connectionMode:R,connectionLineType:Y=Yi.Bezier,connectionLineStyle:P,connectionLineComponent:ee,connectionLineContainerStyle:se,deleteKeyCode:ue="Backspace",selectionKeyCode:oe="Shift",selectionOnDrag:ce=!1,selectionMode:fe=Fr.Full,panActivationKeyCode:we="Space",multiSelectionKeyCode:ve=Jr()?"Meta":"Control",zoomActivationKeyCode:ge=Jr()?"Meta":"Control",snapToGrid:ye,snapGrid:Ce,onlyRenderVisibleElements:Ue=!1,selectNodesOnDrag:je,nodesDraggable:nt,autoPanOnNodeFocus:kt,nodesConnectable:ht,nodesFocusable:nn,nodeOrigin:jn=b1,edgesFocusable:Pi,edgesReconnectable:Fi,elementsSelectable:pt=!0,defaultViewport:Rl=rT,minZoom:zn=.5,maxZoom:ci=2,translateExtent:Ii=Pr,preventScrolling:Yc=!0,nodeExtent:Ol,defaultMarkerColor:qc="#b1b1b7",zoomOnScroll:Xc=!0,zoomOnPinch:Ji=!0,panOnScroll:St=!1,panOnScrollSpeed:gn=.5,panOnScrollMode:Et=_l.Free,zoomOnDoubleClick:Gc=!0,panOnDrag:Zc=!0,onPaneClick:Qc,onPaneMouseEnter:Dl,onPaneMouseMove:kl,onPaneMouseLeave:Ll,onPaneScroll:Rn,onPaneContextMenu:Hl,paneClickDistance:Wi=1,nodeClickDistance:Kc=0,children:fo,onReconnect:$a,onReconnectStart:el,onReconnectEnd:Pc,onEdgeContextMenu:ho,onEdgeDoubleClick:mo,onEdgeMouseEnter:po,onEdgeMouseMove:Ya,onEdgeMouseLeave:qa,reconnectRadius:go=10,onNodesChange:yo,onEdgesChange:yn,noDragClassName:ct="nodrag",noWheelClassName:bt="nowheel",noPanClassName:On="nopan",fitView:Bl,fitViewOptions:xo,connectOnClick:Fc,attributionPosition:vo,proOptions:tl,defaultEdgeOptions:Xa,elevateNodesOnSelect:ui=!0,elevateEdgesOnSelect:fi=!1,disableKeyboardA11y:di=!1,autoPanOnConnect:hi,autoPanOnNodeDrag:it,autoPanSpeed:bo,connectionRadius:wo,isValidConnection:Dn,onError:mi,style:Ic,id:Ga,nodeDragThreshold:So,connectionDragThreshold:Jc,viewport:Ul,onViewportChange:Vl,width:ln,height:_t,colorMode:Eo="light",debug:Wc,onScroll:pi,ariaLabelConfig:No,zIndexMode:nl="basic",...eu},Ct){const il=Ga||"1",_o=uT(Eo),Za=T.useCallback(kn=>{kn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pi==null||pi(kn)},[pi]);return g.jsx("div",{"data-testid":"rf__wrapper",...eu,onScroll:Za,style:{...Ic,...OA},ref:Ct,className:st(["react-flow",s,_o]),id:Ga,role:"application",children:g.jsxs(RA,{nodes:t,edges:i,width:ln,height:_t,fitView:Bl,fitViewOptions:xo,minZoom:zn,maxZoom:ci,nodeOrigin:jn,nodeExtent:Ol,zIndexMode:nl,children:[g.jsx(MA,{onInit:m,onNodeClick:h,onEdgeClick:p,onNodeMouseEnter:j,onNodeMouseMove:N,onNodeMouseLeave:A,onNodeContextMenu:H,onNodeDoubleClick:k,nodeTypes:c,edgeTypes:u,connectionLineType:Y,connectionLineStyle:P,connectionLineComponent:ee,connectionLineContainerStyle:se,selectionKeyCode:oe,selectionOnDrag:ce,selectionMode:fe,deleteKeyCode:ue,multiSelectionKeyCode:ve,panActivationKeyCode:we,zoomActivationKeyCode:ge,onlyRenderVisibleElements:Ue,defaultViewport:Rl,translateExtent:Ii,minZoom:zn,maxZoom:ci,preventScrolling:Yc,zoomOnScroll:Xc,zoomOnPinch:Ji,zoomOnDoubleClick:Gc,panOnScroll:St,panOnScrollSpeed:gn,panOnScrollMode:Et,panOnDrag:Zc,onPaneClick:Qc,onPaneMouseEnter:Dl,onPaneMouseMove:kl,onPaneMouseLeave:Ll,onPaneScroll:Rn,onPaneContextMenu:Hl,paneClickDistance:Wi,nodeClickDistance:Kc,onSelectionContextMenu:B,onSelectionStart:O,onSelectionEnd:$,onReconnect:$a,onReconnectStart:el,onReconnectEnd:Pc,onEdgeContextMenu:ho,onEdgeDoubleClick:mo,onEdgeMouseEnter:po,onEdgeMouseMove:Ya,onEdgeMouseLeave:qa,reconnectRadius:go,defaultMarkerColor:qc,noDragClassName:ct,noWheelClassName:bt,noPanClassName:On,rfId:il,disableKeyboardA11y:di,nodeExtent:Ol,viewport:Ul,onViewportChange:Vl}),g.jsx(cT,{nodes:t,edges:i,defaultNodes:a,defaultEdges:r,onConnect:w,onConnectStart:S,onConnectEnd:_,onClickConnectStart:E,onClickConnectEnd:C,nodesDraggable:nt,autoPanOnNodeFocus:kt,nodesConnectable:ht,nodesFocusable:nn,edgesFocusable:Pi,edgesReconnectable:Fi,elementsSelectable:pt,elevateNodesOnSelect:ui,elevateEdgesOnSelect:fi,minZoom:zn,maxZoom:ci,nodeExtent:Ol,onNodesChange:yo,onEdgesChange:yn,snapToGrid:ye,snapGrid:Ce,connectionMode:R,translateExtent:Ii,connectOnClick:Fc,defaultEdgeOptions:Xa,fitView:Bl,fitViewOptions:xo,onNodesDelete:le,onEdgesDelete:Q,onDelete:X,onNodeDragStart:L,onNodeDrag:V,onNodeDragStop:Z,onSelectionDrag:G,onSelectionDragStart:D,onSelectionDragStop:z,onMove:x,onMoveStart:y,onMoveEnd:v,noPanClassName:On,nodeOrigin:jn,rfId:il,autoPanOnConnect:hi,autoPanOnNodeDrag:it,autoPanSpeed:bo,onError:mi,connectionRadius:wo,isValidConnection:Dn,selectNodesOnDrag:je,nodeDragThreshold:So,connectionDragThreshold:Jc,onBeforeDelete:J,debug:Wc,ariaLabelConfig:No,zIndexMode:nl}),g.jsx(aT,{onSelectionChange:te}),fo,g.jsx(eT,{proOptions:tl,position:vo}),g.jsx(W3,{rfId:il,disableKeyboardA11y:di})]})})}var kA=S1(DA);function LA({dimensions:t,lineWidth:i,variant:a,className:r}){return g.jsx("path",{strokeWidth:i,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:st(["react-flow__background-pattern",a,r])})}function HA({radius:t,className:i}){return g.jsx("circle",{cx:t,cy:t,r:t,className:st(["react-flow__background-pattern","dots",i])})}var qi;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(qi||(qi={}));const BA={[qi.Dots]:1,[qi.Lines]:1,[qi.Cross]:6},UA=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Z1({id:t,variant:i=qi.Dots,gap:a=20,size:r,lineWidth:s=1,offset:c=0,color:u,bgColor:h,style:p,className:m,patternClassName:x}){const y=T.useRef(null),{transform:v,patternId:w}=Le(UA,Fe),S=r||BA[i],_=i===qi.Dots,E=i===qi.Cross,C=Array.isArray(a)?a:[a,a],j=[C[0]*v[2]||1,C[1]*v[2]||1],N=S*v[2],A=Array.isArray(c)?c:[c,c],H=E?[N,N]:j,k=[A[0]*v[2]||1+H[0]/2,A[1]*v[2]||1+H[1]/2],L=`${w}${t||""}`;return g.jsxs("svg",{className:st(["react-flow__background",m]),style:{...p,...jc,"--xy-background-color-props":h,"--xy-background-pattern-color-props":u},ref:y,"data-testid":"rf__background",children:[g.jsx("pattern",{id:L,x:v[0]%j[0],y:v[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:_?g.jsx(HA,{radius:N/2,className:x}):g.jsx(LA,{dimensions:H,lineWidth:s,variant:i,className:x})}),g.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}Z1.displayName="Background";const VA=T.memo(Z1);function $A(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:g.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function YA(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:g.jsx("path",{d:"M0 0h32v4.2H0z"})})}function qA(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:g.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function XA(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function GA(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Gs({children:t,className:i,...a}){return g.jsx("button",{type:"button",className:st(["react-flow__controls-button",i]),...a,children:t})}const ZA=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Q1({style:t,showZoom:i=!0,showFitView:a=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:c,onZoomOut:u,onFitView:h,onInteractiveChange:p,className:m,children:x,position:y="bottom-left",orientation:v="vertical","aria-label":w}){const S=Ie(),{isInteractive:_,minZoomReached:E,maxZoomReached:C,ariaLabelConfig:j}=Le(ZA,Fe),{zoomIn:N,zoomOut:A,fitView:H}=Oh(),k=()=>{N(),c==null||c()},L=()=>{A(),u==null||u()},V=()=>{H(s),h==null||h()},Z=()=>{S.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),p==null||p(!_)},le=v==="horizontal"?"horizontal":"vertical";return g.jsxs(Mc,{className:st(["react-flow__controls",le,m]),position:y,style:t,"data-testid":"rf__controls","aria-label":w??j["controls.ariaLabel"],children:[i&&g.jsxs(g.Fragment,{children:[g.jsx(Gs,{onClick:k,className:"react-flow__controls-zoomin",title:j["controls.zoomIn.ariaLabel"],"aria-label":j["controls.zoomIn.ariaLabel"],disabled:C,children:g.jsx($A,{})}),g.jsx(Gs,{onClick:L,className:"react-flow__controls-zoomout",title:j["controls.zoomOut.ariaLabel"],"aria-label":j["controls.zoomOut.ariaLabel"],disabled:E,children:g.jsx(YA,{})})]}),a&&g.jsx(Gs,{className:"react-flow__controls-fitview",onClick:V,title:j["controls.fitView.ariaLabel"],"aria-label":j["controls.fitView.ariaLabel"],children:g.jsx(qA,{})}),r&&g.jsx(Gs,{className:"react-flow__controls-interactive",onClick:Z,title:j["controls.interactive.ariaLabel"],"aria-label":j["controls.interactive.ariaLabel"],children:_?g.jsx(GA,{}):g.jsx(XA,{})}),x]})}Q1.displayName="Controls";T.memo(Q1);function QA({id:t,x:i,y:a,width:r,height:s,style:c,color:u,strokeColor:h,strokeWidth:p,className:m,borderRadius:x,shapeRendering:y,selected:v,onClick:w}){const{background:S,backgroundColor:_}=c||{},E=u||S||_;return g.jsx("rect",{className:st(["react-flow__minimap-node",{selected:v},m]),x:i,y:a,rx:x,ry:x,width:r,height:s,style:{fill:E,stroke:h,strokeWidth:p},shapeRendering:y,onClick:w?C=>w(C,t):void 0})}const KA=T.memo(QA),PA=t=>t.nodes.map(i=>i.id),Td=t=>t instanceof Function?t:()=>t;function FA({nodeStrokeColor:t,nodeColor:i,nodeClassName:a="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:c=KA,onClick:u}){const h=Le(PA,Fe),p=Td(i),m=Td(t),x=Td(a),y=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return g.jsx(g.Fragment,{children:h.map(v=>g.jsx(JA,{id:v,nodeColorFunc:p,nodeStrokeColorFunc:m,nodeClassNameFunc:x,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:c,onClick:u,shapeRendering:y},v))})}function IA({id:t,nodeColorFunc:i,nodeStrokeColorFunc:a,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:c,shapeRendering:u,NodeComponent:h,onClick:p}){const{node:m,x,y,width:v,height:w}=Le(S=>{const{internals:_}=S.nodeLookup.get(t),E=_.userNode,{x:C,y:j}=_.positionAbsolute,{width:N,height:A}=si(E);return{node:E,x:C,y:j,width:N,height:A}},Fe);return!m||m.hidden||!Fv(m)?null:g.jsx(h,{x,y,width:v,height:w,style:m.style,selected:!!m.selected,className:r(m),color:i(m),borderRadius:s,strokeColor:a(m),strokeWidth:c,shapeRendering:u,onClick:p,id:m.id})}const JA=T.memo(IA);var WA=T.memo(FA);const eM=200,tM=150,nM=t=>!t.hidden,iM=t=>{const i={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:i,boundingRect:t.nodeLookup.size>0?Pv(ao(t.nodeLookup,{filter:nM}),i):i,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},lM="react-flow__minimap-desc";function K1({style:t,className:i,nodeStrokeColor:a,nodeColor:r,nodeClassName:s="",nodeBorderRadius:c=5,nodeStrokeWidth:u,nodeComponent:h,bgColor:p,maskColor:m,maskStrokeColor:x,maskStrokeWidth:y,position:v="bottom-right",onClick:w,onNodeClick:S,pannable:_=!1,zoomable:E=!1,ariaLabel:C,inversePan:j,zoomStep:N=1,offsetScale:A=5}){const H=Ie(),k=T.useRef(null),{boundingRect:L,viewBB:V,rfId:Z,panZoom:le,translateExtent:Q,flowWidth:X,flowHeight:te,ariaLabelConfig:D}=Le(iM,Fe),G=(t==null?void 0:t.width)??eM,z=(t==null?void 0:t.height)??tM,B=L.width/G,O=L.height/z,$=Math.max(B,O),J=$*G,R=$*z,Y=A*$,P=L.x-(J-L.width)/2-Y,ee=L.y-(R-L.height)/2-Y,se=J+Y*2,ue=R+Y*2,oe=`${lM}-${Z}`,ce=T.useRef(0),fe=T.useRef();ce.current=$,T.useEffect(()=>{if(k.current&&le)return fe.current=v3({domNode:k.current,panZoom:le,getTransform:()=>H.getState().transform,getViewScale:()=>ce.current}),()=>{var ye;(ye=fe.current)==null||ye.destroy()}},[le]),T.useEffect(()=>{var ye;(ye=fe.current)==null||ye.update({translateExtent:Q,width:X,height:te,inversePan:j,pannable:_,zoomStep:N,zoomable:E})},[_,E,j,N,Q,X,te]);const we=w?ye=>{var je;const[Ce,Ue]=((je=fe.current)==null?void 0:je.pointer(ye))||[0,0];w(ye,{x:Ce,y:Ue})}:void 0,ve=S?T.useCallback((ye,Ce)=>{const Ue=H.getState().nodeLookup.get(Ce).internals.userNode;S(ye,Ue)},[]):void 0,ge=C??D["minimap.ariaLabel"];return g.jsx(Mc,{position:v,style:{...t,"--xy-minimap-background-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-color-props":typeof x=="string"?x:void 0,"--xy-minimap-mask-stroke-width-props":typeof y=="number"?y*$:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof a=="string"?a:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:st(["react-flow__minimap",i]),"data-testid":"rf__minimap",children:g.jsxs("svg",{width:G,height:z,viewBox:`${P} ${ee} ${se} ${ue}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":oe,ref:k,onClick:we,children:[ge&&g.jsx("title",{id:oe,children:ge}),g.jsx(WA,{onClick:ve,nodeColor:r,nodeStrokeColor:a,nodeBorderRadius:c,nodeClassName:s,nodeStrokeWidth:u,nodeComponent:h}),g.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-Y},${ee-Y}h${se+Y*2}v${ue+Y*2}h${-se-Y*2}z
|
|
351
|
-
M${V.x},${V.y}h${V.width}v${V.height}h${-V.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}K1.displayName="MiniMap";T.memo(K1);const aM=t=>i=>t?`${Math.max(1/i.transform[2],1)}`:void 0,rM={[Oa.Line]:"right",[Oa.Handle]:"bottom-right"};function oM({nodeId:t,position:i,variant:a=Oa.Handle,className:r,style:s=void 0,children:c,color:u,minWidth:h=10,minHeight:p=10,maxWidth:m=Number.MAX_VALUE,maxHeight:x=Number.MAX_VALUE,keepAspectRatio:y=!1,resizeDirection:v,autoScale:w=!0,shouldResize:S,onResizeStart:_,onResize:E,onResizeEnd:C}){const j=C1(),N=typeof t=="string"?t:j,A=Ie(),H=T.useRef(null),k=a===Oa.Handle,L=Le(T.useCallback(aM(k&&w),[k,w]),Fe),V=T.useRef(null),Z=i??rM[a];T.useEffect(()=>{if(!(!H.current||!N))return V.current||(V.current=O3({domNode:H.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:Q,transform:X,snapGrid:te,snapToGrid:D,nodeOrigin:G,domNode:z}=A.getState();return{nodeLookup:Q,transform:X,snapGrid:te,snapToGrid:D,nodeOrigin:G,paneDomNode:z}},onChange:(Q,X)=>{const{triggerNodeChanges:te,nodeLookup:D,parentLookup:G,nodeOrigin:z}=A.getState(),B=[],O={x:Q.x,y:Q.y},$=D.get(N);if($&&$.expandParent&&$.parentId){const J=$.origin??z,R=Q.width??$.measured.width??0,Y=Q.height??$.measured.height??0,P={id:$.id,parentId:$.parentId,rect:{width:R,height:Y,...Iv({x:Q.x??$.position.x,y:Q.y??$.position.y},{width:R,height:Y},$.parentId,D,J)}},ee=Rh([P],D,G,z);B.push(...ee),O.x=Q.x?Math.max(J[0]*R,Q.x):void 0,O.y=Q.y?Math.max(J[1]*Y,Q.y):void 0}if(O.x!==void 0&&O.y!==void 0){const J={id:N,type:"position",position:{...O}};B.push(J)}if(Q.width!==void 0&&Q.height!==void 0){const R={id:N,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:Q.width,height:Q.height}};B.push(R)}for(const J of X){const R={...J,type:"position"};B.push(R)}te(B)},onEnd:({width:Q,height:X})=>{const te={id:N,type:"dimensions",resizing:!1,dimensions:{width:Q,height:X}};A.getState().triggerNodeChanges([te])}})),V.current.update({controlPosition:Z,boundaries:{minWidth:h,minHeight:p,maxWidth:m,maxHeight:x},keepAspectRatio:y,resizeDirection:v,onResizeStart:_,onResize:E,onResizeEnd:C,shouldResize:S}),()=>{var Q;(Q=V.current)==null||Q.destroy()}},[Z,h,p,m,x,y,_,E,C,S]);const le=Z.split("-");return g.jsx("div",{className:st(["react-flow__resize-control","nodrag",...le,a,r]),ref:H,style:{...s,scale:L,...u&&{[k?"backgroundColor":"borderColor"]:u}},children:c})}T.memo(oM);const wl={daily:/^\d{4}-\d{2}-\d{2}\.md$/,architecture:/_ARCHITECTURE\.md$|ARCHITECTURE.*\.md$/i,persistent:/^PERSISTENT_MEMORY\.md$/i,context:/^CONTEXT_BUILDER\.md$/i,crypto:/crypto/i,swarmLog:/\.csv$/,archive:/\.(tar\.gz|zip|gz)$/};function ti(t,i,a,r=[]){for(const s of t)s.type==="file"&&i.test(s.name)&&r.push({name:s.name,path:`${a}/${s.path}`,size:s.size}),s.children&&ti(s.children,i,a,r);return r}function P1(t){let i=0,a=0;for(const r of t)if(r.type==="file"&&(i++,a+=r.size||0),r.children){const s=P1(r.children);i+=s.files,a+=s.size}return{files:i,size:a}}function sM(t){const i=[];return Object.entries(t).forEach(([a,r])=>{if(!r)return;const{tree:s,path:c=`~/${a}`}=r,u=[],h=ti(s,wl.daily,c,[]);if(h.length>0){const E=h.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-daily`,type:"storage",label:"Daily Logs",description:`${h.length} temporal memory files`,icon:Fx,color:"var(--accent-green)",files:h.sort((C,j)=>j.name.localeCompare(C.name)).slice(0,5),totalSize:E,path:c,depth:1})}const p=ti(s,wl.architecture,c,[]);if(p.length>0){const E=p.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-architecture`,type:"storage",label:"Architecture Docs",description:`${p.length} system structure files`,icon:Kx,color:"var(--accent-blue)",files:p,totalSize:E,path:c,depth:1})}const m=ti(s,wl.persistent,c,[]),x=ti(s,wl.context,c,[]),y=[...m,...x];if(y.length>0){const E=y.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-persistent`,type:"storage",label:"Long-term Memory",description:"Persistent context & curated knowledge",icon:ev,color:"var(--accent-purple)",files:y,totalSize:E,path:c,depth:1})}const v=ti(s,wl.crypto,c,[]);if(v.length>0){const E=v.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-crypto`,type:"specialized",label:"Crypto Intelligence",description:`${v.length} specialized knowledge files`,icon:Wx,color:"var(--accent-amber)",files:v,totalSize:E,path:c,depth:2})}const w=ti(s,wl.swarmLog,c,[]);if(w.length>0){const E=w.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-telemetry`,type:"telemetry",label:"Telemetry Logs",description:`${w.length} data log files`,icon:Gx,color:"var(--accent-indigo)",files:w.slice(0,6),totalSize:E,path:c,depth:2})}const S=ti(s,wl.archive,c,[]);if(S.length>0){const E=S.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-archive`,type:"archive",label:"Memory Archive",description:`${S.length} compressed history files`,icon:Zx,color:"var(--accent-pink)",files:S,totalSize:E,path:c,depth:3})}const _=ti(s,/\.sh$/,c,[]);if(_.length>0&&u.push({id:`${a}-scripts`,type:"processing",label:"Automation Scripts",description:`${_.length} shell scripts`,icon:bN,color:"var(--accent-amber)",files:_,totalSize:_.reduce((E,C)=>E+(C.size||0),0),path:c,depth:0}),u.length===0&&(s.filter(E=>E.type==="directory").forEach((E,C)=>{const j=E.children?P1(E.children):{files:0,size:0};j.files>0&&u.push({id:`${a}-${E.name}`,type:"storage",label:E.name,description:`${j.files} files`,icon:Ca,color:["var(--accent-blue)","var(--accent-green)","var(--accent-amber)","var(--accent-purple)"][C%4],files:[],totalSize:j.size,path:`${c}/${E.name}`,depth:1})}),u.length===0)){const E=s.filter(C=>C.type==="file");if(E.length>0){const C=E.reduce((j,N)=>j+(N.size||0),0);u.push({id:`${a}-root`,type:"storage",label:"Root Files",description:`${E.length} files`,icon:Ca,color:"var(--accent-blue)",files:E.map(j=>({name:j.name,path:`${c}/${j.path}`,size:j.size})),totalSize:C,path:c,depth:1})}}i.push(...u)}),i.sort((a,r)=>a.depth-r.depth)}function cM({data:t}){const i=t.isExpanded??!1,a=t.fileCount!==void 0&&t.fileCount>0||t.size!==void 0&&t.size>0,r=t.IconComponent;return g.jsxs("div",{className:Ne("group relative min-w-[220px] max-w-[260px] transition-all duration-300",a&&"hover:scale-[1.02]"),children:[!t.isFirst&&g.jsx(Da,{type:"target",position:xe.Top,className:"!w-2 !h-2 !bg-muted-foreground/40 !border-border"}),g.jsx("div",{className:Ne("absolute -inset-0.5 rounded-2xl blur-sm transition-all duration-300 pointer-events-none",i?"opacity-70":"opacity-40 group-hover:opacity-60"),style:{background:`hsl(${t.color} / 0.4)`}}),g.jsxs(Xi,{className:Ne("relative overflow-hidden bg-card backdrop-blur-sm cursor-pointer transition-all duration-200",i&&"ring-1 ring-foreground/10"),style:{borderColor:i?`hsl(${t.color} / 0.6)`:`hsl(${t.color} / 0.35)`},children:[g.jsxs("div",{className:"flex items-start gap-3 p-3.5",children:[g.jsx("div",{className:"shrink-0 p-2 rounded-xl",style:{background:`linear-gradient(135deg, hsl(${t.color} / 0.2), hsl(${t.color} / 0.05))`,border:`1px solid hsl(${t.color} / 0.2)`},children:g.jsx(r,{className:"w-4 h-4",style:{color:`hsl(${t.color})`}})}),g.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[g.jsx("h3",{className:"text-[12px] font-semibold text-card-foreground tracking-tight leading-tight truncate",children:t.label}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:t.description})]})]}),(t.fileCount!==void 0||t.size!==void 0)&&g.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5 border-t bg-secondary/30",style:{borderColor:`hsl(${t.color} / 0.1)`},children:[t.fileCount!==void 0&&g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(fh,{className:"w-3 h-3 text-muted-foreground/60"}),g.jsx("span",{className:"text-xs font-semibold tabular-nums",style:{color:`hsl(${t.color})`},children:t.fileCount}),g.jsx("span",{className:"text-[9px] text-muted-foreground/60",children:t.fileCount===1?"file":"files"})]}),t.size!==void 0&&t.size>0&&g.jsx("span",{className:"text-[10px] text-muted-foreground font-mono tabular-nums",children:Cl(t.size)})]}),a&&g.jsx("div",{className:"absolute top-2.5 right-2.5 w-1.5 h-1.5 rounded-full",style:{backgroundColor:`hsl(${t.color})`,boxShadow:`0 0 6px hsl(${t.color})`,animation:"pulse 2s ease-in-out infinite"}})]}),!t.isLast&&g.jsx(Da,{type:"source",position:xe.Bottom,className:"!w-2 !h-2 !bg-muted-foreground/40 !border-border"})]})}const uM={layer:cM};function fM(){const[t,i]=T.useState(!1);return g.jsx("div",{className:"absolute bottom-4 left-4 z-10",children:g.jsxs("div",{className:Ne("bg-card border border-border rounded-xl backdrop-blur-sm transition-all duration-300 overflow-hidden shadow-xl",t?"w-[260px]":"w-auto"),children:[g.jsxs("button",{onClick:()=>i(!t),className:"flex items-center gap-2.5 px-4 py-3 text-xs text-muted-foreground hover:text-foreground transition-colors w-full cursor-pointer focus:outline-none",children:[g.jsx("div",{className:"p-1.5 rounded-lg bg-secondary",children:g.jsx(iv,{className:"w-3.5 h-3.5"})}),g.jsx("span",{className:"font-medium",children:"Memory Layers"}),g.jsx(Ix,{className:Ne("w-4 h-4 ml-auto text-muted-foreground/60 transition-transform duration-200",t&&"rotate-180")})]}),t&&g.jsxs("div",{className:"px-4 pb-4 space-y-2.5 text-[10px] border-t border-border pt-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Fx,{className:"w-3 h-3 text-emerald-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Daily logs (temporal)"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ev,{className:"w-3 h-3 text-purple-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Persistent memory"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kx,{className:"w-3 h-3 text-blue-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Architecture docs"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Gx,{className:"w-3 h-3 text-indigo-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Swarm telemetry"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Wx,{className:"w-3 h-3 text-amber-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Specialized knowledge"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Zx,{className:"w-3 h-3 text-pink-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Compressed archive"})]})]})]})})}function dM({nodeData:t,onClose:i}){if(!t)return null;const a=t.IconComponent;return g.jsx("div",{className:"absolute top-4 right-4 z-10 animate-in fade-in slide-in-from-right-2 duration-200",children:g.jsxs("div",{className:"w-[300px] bg-zinc-900/95 border rounded-2xl backdrop-blur-md shadow-xl overflow-hidden",style:{borderColor:`hsl(${t.color} / 0.4)`},children:[g.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[g.jsx("div",{className:"p-2 rounded-xl",style:{background:`linear-gradient(135deg, hsl(${t.color} / 0.2), hsl(${t.color} / 0.05))`,border:`1px solid hsl(${t.color} / 0.25)`},children:g.jsx(a,{className:"w-4 h-4",style:{color:`hsl(${t.color})`}})}),g.jsx("h3",{className:"flex-1 text-[14px] font-semibold text-card-foreground",children:t.label}),g.jsx("button",{onClick:i,className:"p-1.5 -mr-1 rounded-lg text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors cursor-pointer",children:g.jsx(dh,{className:"w-4 h-4"})})]}),g.jsxs("div",{className:"px-4 pb-4 space-y-3",children:[g.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed",children:t.description}),t.path&&g.jsxs("div",{className:"p-2.5 rounded-lg bg-secondary/50 border border-border/50",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Path"}),g.jsx("p",{className:"text-[11px] font-mono text-foreground mt-0.5 truncate",children:t.path})]}),t.files&&t.files.length>0&&g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Files"}),g.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:t.files.map((r,s)=>g.jsxs("div",{className:"flex items-center justify-between p-1.5 rounded bg-secondary/30 border border-border/30",children:[g.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:r.name}),r.size&&g.jsx("span",{className:"text-[9px] text-muted-foreground ml-2 shrink-0",children:Cl(r.size)})]},s))})]}),t.fileCount!==void 0&&t.fileCount>0&&g.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-lg bg-secondary/50 border border-border/50",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Files"}),g.jsx("p",{className:"text-sm font-semibold text-foreground",children:t.fileCount})]}),t.size!==void 0&&t.size>0&&g.jsxs("div",{className:"text-right",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Size"}),g.jsx("p",{className:"text-sm font-mono text-foreground",children:Cl(t.size)})]})]})]})]})})}function hM(){return g.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:g.jsxs("div",{className:"text-center max-w-md",children:[g.jsx("div",{className:"mx-auto w-16 h-16 rounded-2xl bg-muted/50 border border-border flex items-center justify-center mb-6",children:g.jsx(Ca,{className:"w-8 h-8 text-muted-foreground/60"})}),g.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"No files found"}),g.jsx("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:"Configure a memory source path in Settings to visualize your memory architecture."}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"The app auto-discovers .md files, logs, archives, and scripts."})]})})}function ax(){const{data:t,loading:i}=ov(),[a,r]=T.useState(null),s=T.useMemo(()=>t?sM(t):[],[t]),c=s.length>0,u=T.useCallback((w,S)=>{r(_=>_===S.id?null:S.id)},[]),h=T.useCallback(()=>{r(null)},[]),{nodes:p,edges:m}=T.useMemo(()=>{const w=[],S=[],_={};s.forEach(H=>{const k=H.depth;_[k]||(_[k]=[]),_[k].push(H)});const E=Object.keys(_).map(Number).sort((H,k)=>H-k),C=250,j=160;let N=0;w.push({id:"input",type:"layer",position:{x:400,y:N},data:{label:"User Input",description:"Query triggers memory retrieval",color:"var(--accent-indigo)",IconComponent:lN,isFirst:!0,isExpanded:a==="input"}}),N+=j;let A=["input"];return E.forEach(H=>{const k=_[H],L=400-(k.length-1)*C/2,V=[];k.forEach((Z,le)=>{const Q=L+le*C,X=Z.id;V.push(X),w.push({id:X,type:"layer",position:{x:Q,y:N},data:{label:Z.label,description:Z.description,color:Z.color,IconComponent:Z.icon,fileCount:Z.files.length,size:Z.totalSize,path:Z.path,files:Z.files.slice(0,6),isExpanded:a===X,layerType:Z.type}}),A.forEach(te=>{S.push({id:`e-${te}-${X}`,source:te,target:X,animated:!0,style:{stroke:"url(#edge-gradient)",strokeWidth:1.5}})})}),A=V,N+=j}),w.push({id:"output",type:"layer",position:{x:400,y:N},data:{label:"Response",description:"Context-enriched output",color:"var(--accent-pink)",IconComponent:jN,isLast:!0,isExpanded:a==="output"}}),A.forEach(H=>{S.push({id:`e-${H}-output`,source:H,target:"output",animated:!0,style:{stroke:"url(#edge-gradient)",strokeWidth:1.5}})}),{nodes:w,edges:S}},[s,a]),x=T.useMemo(()=>{if(!a)return null;const w=p.find(S=>S.id===a);return(w==null?void 0:w.data)??null},[a,p]);if(!i&&!c)return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30",children:g.jsx(kd,{className:"w-5 h-5 text-violet-400"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Memory Architecture"}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Visualize your memory structure"})]})]})}),g.jsx(hM,{})]});const y=s.reduce((w,S)=>w+S.files.length,0),v=s.reduce((w,S)=>w+S.totalSize,0);return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30",children:g.jsx(kd,{className:"w-5 h-5 text-violet-400"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Memory Architecture"}),g.jsxs("p",{className:"text-xs text-muted-foreground/70",children:[s.length," layers · ",y," files · ",Cl(v)]})]})]}),g.jsx("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/60",children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(EN,{className:"w-3 h-3"}),g.jsxs("span",{children:["Depth: ",Math.max(...s.map(w=>w.depth))+1]})]})})]}),g.jsxs("div",{className:"flex-1 relative",children:[g.jsx("svg",{style:{position:"absolute",width:0,height:0},children:g.jsx("defs",{children:g.jsxs("linearGradient",{id:"edge-gradient",gradientUnits:"userSpaceOnUse",x1:"0",y1:"0",x2:"0",y2:"1000",children:[g.jsx("stop",{offset:"0%",stopColor:"#6366f1",stopOpacity:"0.5"}),g.jsx("stop",{offset:"50%",stopColor:"#a855f7",stopOpacity:"0.3"}),g.jsx("stop",{offset:"100%",stopColor:"#ec4899",stopOpacity:"0.5"})]})})}),g.jsx(kA,{nodes:p,edges:m,nodeTypes:uM,onNodeClick:u,onPaneClick:h,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,panOnDrag:!0,zoomOnScroll:!0,preventScrolling:!1,minZoom:.4,maxZoom:1.5,children:g.jsx(VA,{color:"hsl(var(--muted-foreground))",gap:32,size:1,style:{opacity:.08}})}),g.jsx(fM,{}),g.jsx(dM,{nodeData:x,onClose:()=>r(null)})]})]})}function rx(t,i){if(typeof t=="function")return t(i);t!=null&&(t.current=i)}function Rc(...t){return i=>{let a=!1;const r=t.map(s=>{const c=rx(s,i);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let s=0;s<r.length;s++){const c=r[s];typeof c=="function"?c():rx(t[s],null)}}}}function dn(...t){return T.useCallback(Rc(...t),t)}var mM=Symbol.for("react.lazy"),hc=Tx[" use ".trim().toString()];function pM(t){return typeof t=="object"&&t!==null&&"then"in t}function F1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===mM&&"_payload"in t&&pM(t._payload)}function gM(t){const i=xM(t),a=T.forwardRef((r,s)=>{let{children:c,...u}=r;F1(c)&&typeof hc=="function"&&(c=hc(c._payload));const h=T.Children.toArray(c),p=h.find(bM);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}var yM=gM("Slot");function xM(t){const i=T.forwardRef((a,r)=>{let{children:s,...c}=a;if(F1(s)&&typeof hc=="function"&&(s=hc(s._payload)),T.isValidElement(s)){const u=SM(s),h=wM(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var vM=Symbol("radix.slottable");function bM(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===vM}function wM(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function SM(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}const ox=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,sx=zx,I1=(t,i)=>a=>{var r;if((i==null?void 0:i.variants)==null)return sx(t,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:s,defaultVariants:c}=i,u=Object.keys(s).map(m=>{const x=a==null?void 0:a[m],y=c==null?void 0:c[m];if(x===null)return null;const v=ox(x)||ox(y);return s[m][v]}),h=a&&Object.entries(a).reduce((m,x)=>{let[y,v]=x;return v===void 0||(m[y]=v),m},{}),p=i==null||(r=i.compoundVariants)===null||r===void 0?void 0:r.reduce((m,x)=>{let{class:y,className:v,...w}=x;return Object.entries(w).every(S=>{let[_,E]=S;return Array.isArray(E)?E.includes({...c,...h}[_]):{...c,...h}[_]===E})?[...m,y,v]:m},[]);return sx(t,u,p,a==null?void 0:a.class,a==null?void 0:a.className)},EM=I1("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium cursor-pointer transition-all duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-md hover:bg-primary/90 hover:shadow-lg hover:-translate-y-0.5",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-md",outline:"border border-border bg-background shadow-sm hover:bg-secondary hover:text-foreground hover:border-foreground/20",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 hover:shadow-md",ghost:"hover:bg-accent/80 hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",glow:"bg-violet-600 text-white hover:bg-violet-500 transition-colors"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-11 rounded-xl px-8 text-base",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ni=T.forwardRef(({className:t,variant:i,size:a,asChild:r=!1,...s},c)=>{const u=r?yM:"button";return g.jsx(u,{className:Ne(EM({variant:i,size:a,className:t})),ref:c,...s})});ni.displayName="Button";function NM(){const{entries:t,isPaused:i,togglePause:a,clearLog:r}=gh(),{sources:s,toggleSource:c,resetOnboarding:u}=Xr(),[h,p]=T.useState(!1),m=h?t:t.slice(0,20),x=s.filter(v=>v.enabled),y=()=>{const v=UN(t),w=new Blob([v],{type:"text/csv"}),S=URL.createObjectURL(w),_=document.createElement("a");_.href=S,_.download=`openclaw-memory-mapper-audit-${new Date().toISOString().split("T")[0]}.csv`,_.click(),URL.revokeObjectURL(S)};return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx($r,{className:"w-5 h-5 text-emerald-400"}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Security & Privacy"}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Monitor all file access activity"})]})]}),g.jsx(ni,{variant:i?"glow":"outline",size:"sm",onClick:a,className:Ne(i?"bg-red-500/20 border-red-500/30 text-red-400 hover:bg-red-500/30":"hover:bg-primary/10 hover:border-primary/30 hover:text-primary"),children:i?g.jsxs(g.Fragment,{children:[g.jsx(Pg,{className:"w-4 h-4 mr-1"}),"Paused - Resume"]}):g.jsxs(g.Fragment,{children:[g.jsx($r,{className:"w-4 h-4 mr-1"}),"Pause All Access"]})})]}),g.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-6",children:[g.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[g.jsx(Ad,{icon:CN,title:"Network Status",status:"Local Only",description:"localhost:3001",variant:"success"}),g.jsx(Ad,{icon:ch,title:"Access Mode",status:"Read-Only",description:"Files are never modified",variant:"success"}),g.jsx(Ad,{icon:mN,title:"Data Storage",status:"Local Only",description:"Nothing uploaded",variant:"success"})]}),g.jsxs(Xi,{className:"p-5 bg-card",children:[g.jsx("div",{className:"flex items-center justify-between mb-4",children:g.jsxs("h2",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[g.jsx(lv,{className:"w-4 h-4 text-muted-foreground"}),"Active Permissions"]})}),g.jsx("div",{className:"space-y-2",children:s.map(v=>g.jsxs("div",{className:Ne("flex items-center justify-between p-3 rounded-lg border transition-colors",v.enabled?"bg-emerald-500/5 border-emerald-500/20":"bg-secondary/50 border-border"),children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Ca,{className:Ne("w-4 h-4",v.enabled?"text-emerald-500":"text-muted-foreground")}),g.jsxs("div",{children:[g.jsx("span",{className:"text-sm font-mono text-foreground",children:v.path}),g.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"READ-ONLY"})]})]}),g.jsx(ni,{variant:"ghost",size:"sm",onClick:()=>c(v.id),className:Ne("text-xs",v.enabled?"text-red-500 hover:text-red-600 hover:bg-red-500/10":"text-emerald-500 hover:text-emerald-600 hover:bg-emerald-500/10"),children:v.enabled?"Revoke":"Grant"})]},v.id))}),x.length===0&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-red-500/10 border border-red-500/20",children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(Pg,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),g.jsxs("div",{children:[g.jsx("p",{className:"text-sm font-medium text-red-400 mb-1",children:"All Access Disabled"}),g.jsx("p",{className:"text-xs text-red-400/70 mb-3",children:i?"Access is paused and all permissions are revoked. The app cannot function.":"All permissions revoked. The app cannot access any files."}),g.jsx(ni,{variant:"outline",size:"sm",onClick:()=>u(),className:"text-red-400 border-red-500/30 hover:bg-red-500/10",children:"Reconfigure Sources"})]})]})})]}),g.jsxs(Xi,{className:"p-5 bg-card",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("h2",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[g.jsx(tv,{className:"w-4 h-4 text-muted-foreground"}),"Activity Log",g.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",t.length," entries)"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs(ni,{variant:"ghost",size:"sm",onClick:y,disabled:t.length===0,className:"text-xs",children:[g.jsx(DE,{className:"w-3.5 h-3.5 mr-1"}),"Export CSV"]}),g.jsxs(ni,{variant:"ghost",size:"sm",onClick:r,disabled:t.length===0,className:"text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10",children:[g.jsx(av,{className:"w-3.5 h-3.5 mr-1"}),"Clear"]})]})]}),i&&g.jsx("div",{className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:g.jsxs("p",{className:"text-sm text-amber-400 flex items-center gap-2",children:[g.jsx(LE,{className:"w-4 h-4"}),"Logging paused. File access is disabled."]})}),t.length===0?g.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No activity recorded yet. Browse files to see access logs."}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"space-y-1 max-h-[400px] overflow-auto",children:m.map(v=>g.jsx(_M,{entry:v},v.id))}),t.length>20&&g.jsx(ni,{variant:"ghost",size:"sm",onClick:()=>p(!h),className:"w-full mt-3 text-xs",children:h?"Show less":`Show all ${t.length} entries`})]})]}),g.jsxs("div",{className:"p-4 rounded-xl bg-secondary/50 border border-border",children:[g.jsxs("h3",{className:"text-sm font-medium text-foreground mb-2 flex items-center gap-2",children:[g.jsx($r,{className:"w-4 h-4 text-emerald-400"}),"Security Guarantees"]}),g.jsxs("ul",{className:"space-y-1.5 text-xs text-muted-foreground",children:[g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"All data stays on your machine. Nothing is ever uploaded or transmitted."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"Read-only access. Files are never created, modified, or deleted."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"No analytics, telemetry, or tracking of any kind."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"Open source. Audit the code yourself on GitHub."})]})]})]})]})]})}function Ad({icon:t,title:i,status:a,description:r,variant:s}){const c={success:"border-emerald-500/20 bg-emerald-500/5",warning:"border-amber-500/20 bg-amber-500/5",error:"border-red-500/20 bg-red-500/5"},u={success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"};return g.jsx(Xi,{className:Ne("p-4",c[s]),children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-secondary/50",children:g.jsx(t,{className:Ne("w-4 h-4",u[s])})}),g.jsxs("div",{children:[g.jsx("p",{className:"text-xs text-muted-foreground",children:i}),g.jsx("p",{className:Ne("text-sm font-medium",u[s]),children:a}),g.jsx("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:r})]})]})})}function _M({entry:t}){const i=new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),a={READ:"text-blue-500 dark:text-blue-400 bg-blue-500/10",LIST:"text-amber-500 dark:text-amber-400 bg-amber-500/10",STAT:"text-muted-foreground bg-secondary/50"};return g.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-secondary/50 transition-colors text-xs",children:[g.jsx("span",{className:"text-muted-foreground/50 font-mono w-20 shrink-0",children:i}),g.jsx("span",{className:Ne("px-1.5 py-0.5 rounded text-[10px] font-medium uppercase w-12 text-center shrink-0",a[t.type]),children:t.type}),g.jsx("span",{className:"font-mono text-muted-foreground truncate flex-1",children:t.path}),t.success?g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}):g.jsx(dh,{className:"w-3.5 h-3.5 text-red-400 shrink-0"})]})}function CM(){const[t,i]=T.useState(0),{sources:a,setSources:r,toggleSource:s,updateSourcePath:c,completeOnboarding:u,addSource:h,removeSource:p}=Xr(),[m,x]=T.useState(!1),y=T.useCallback(async()=>{x(!0);try{const j=Xr.getState().sources,N=await Promise.all(j.map(async A=>{try{const H=await fetch(`/api/check-path?path=${encodeURIComponent(A.path)}`);if(H.ok){const k=await H.json();return{...A,detected:k.exists,name:k.exists?k.expandedPath:A.name}}}catch{}return{...A,detected:!1}}));r(N)}catch{}x(!1)},[r]),v=j=>{i(j),j===1&&setTimeout(y,0)},w=a.filter(j=>j.enabled&&j.detected),S=[{title:"Welcome",component:g.jsx(TM,{})},{title:"Configure",component:g.jsx(AM,{sources:a,onToggle:s,onUpdatePath:c,detecting:m,onRedetect:y,onAddSource:h,onRemoveSource:p})},{title:"Review",component:g.jsx(jM,{sources:w})}],_=t===0||t===1&&w.length>0||t===2,E=()=>{t<S.length-1?v(t+1):u()},C=()=>{t>0&&v(t-1)};return g.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-8",children:g.jsxs("div",{className:"w-full max-w-lg",children:[g.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:S.map((j,N)=>g.jsxs("div",{className:"flex items-center",children:[g.jsx("div",{className:Ne("w-8 h-8 rounded-full flex items-center justify-center text-xs font-medium transition-all",N<t&&"bg-emerald-500/20 text-emerald-400",N===t&&"bg-violet-500/20 text-violet-400 ring-2 ring-violet-500/50",N>t&&"bg-secondary text-muted-foreground"),children:N<t?g.jsx(ii,{className:"w-4 h-4"}):N+1}),N<S.length-1&&g.jsx("div",{className:Ne("w-12 h-0.5 mx-2 transition-colors",N<t?"bg-emerald-500/50":"bg-secondary")})]},N))}),g.jsxs(Xi,{className:"p-8 bg-card border-border",children:[S[t].component,g.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[g.jsxs(ni,{variant:"ghost",onClick:C,disabled:t===0,className:Ne(t===0&&"invisible"),children:[g.jsx(_E,{className:"w-4 h-4 mr-1"}),"Back"]}),g.jsx(ni,{variant:"glow",onClick:E,disabled:!_,children:t===S.length-1?"Get Started":"Continue"})]})]}),g.jsxs("p",{className:"text-center text-xs text-zinc-600 mt-6",children:["OpenClaw Memory Mapper v","1.0.0"," · Open Source"]})]})})}function TM(){return g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"inline-flex p-4 rounded-2xl bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30 mb-6",children:g.jsx(Px,{className:"w-10 h-10 text-violet-400"})}),g.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-2",children:"Welcome to Memory Mapper"}),g.jsx("p",{className:"text-muted-foreground mb-8",children:"Visualize your Claude agent's memory architecture"}),g.jsxs("div",{className:"grid gap-4 text-left",children:[g.jsx(Md,{icon:$r,title:"100% Local",description:"All data stays on your machine. Nothing is ever uploaded.",color:"emerald"}),g.jsx(Md,{icon:ch,title:"Read-Only",description:"We only read files. Your memory data is never modified.",color:"blue"}),g.jsx(Md,{icon:rv,title:"No Telemetry",description:"Zero tracking, analytics, or external connections.",color:"amber"})]})]})}function Md({icon:t,title:i,description:a,color:r}){const s={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",blue:"bg-blue-500/10 text-blue-400 border-blue-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20"};return g.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-xl bg-secondary/30 border border-border",children:[g.jsx("div",{className:Ne("p-2 rounded-lg border",s[r]),children:g.jsx(t,{className:"w-4 h-4"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-medium text-foreground",children:i}),g.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:a})]})]})}function AM({sources:t,onToggle:i,onUpdatePath:a,detecting:r,onRedetect:s,onAddSource:c,onRemoveSource:u}){const[h,p]=T.useState(null),m=()=>{const x=c();p(x)};return g.jsxs("div",{children:[g.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Configure Sources"}),g.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Select which memory directories to visualize. Click paths to edit."}),g.jsx("div",{className:"space-y-3",children:t.map(x=>g.jsx(MM,{source:x,onToggle:()=>i(x.id),onUpdatePath:y=>{a(x.id,y),setTimeout(s,10)},onRemove:()=>u(x.id),detecting:r,isEditing:h===x.id,onStartEdit:()=>p(x.id),onEndEdit:()=>p(null),canRemove:t.length>1},x.id))}),g.jsxs("button",{onClick:m,className:"mt-3 w-full flex items-center justify-center gap-2 p-3 rounded-xl border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-violet-500/50 transition-colors",children:[g.jsx(uN,{className:"w-4 h-4"}),g.jsx("span",{className:"text-sm",children:"Add custom path"})]}),r&&g.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-2",children:[g.jsx("div",{className:"w-3 h-3 border-2 border-violet-400 border-t-transparent rounded-full animate-spin"}),"Detecting memory directories..."]}),!r&&t.length===0&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-blue-500/10 border border-blue-500/20",children:g.jsx("p",{className:"text-sm text-blue-400",children:'Click "Add custom path" to add your memory folder (e.g., ~/my-memory).'})}),!r&&t.length>0&&t.every(x=>!x.detected)&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-amber-500/10 border border-amber-500/20",children:g.jsx("p",{className:"text-sm text-amber-400",children:"No paths found. Click the path text to edit, or make sure the API server is running."})})]})}function MM({source:t,onToggle:i,onUpdatePath:a,onRemove:r,detecting:s,isEditing:c,onStartEdit:u,onEndEdit:h,canRemove:p}){const[m,x]=T.useState(t.path),y=s?uh:t.detected?KE:JE,v=()=>{a(m),h()},w=S=>{S.key==="Enter"?v():S.key==="Escape"&&(x(t.path),h())};return g.jsxs("div",{className:Ne("w-full flex items-center gap-4 p-4 rounded-xl border transition-all",t.enabled&&t.detected?"bg-violet-500/10 border-violet-500/30":"bg-secondary/30 border-border"),children:[g.jsx("button",{onClick:i,disabled:!t.detected,className:Ne("w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors cursor-pointer",t.enabled&&t.detected?"bg-violet-500 border-violet-500":"border-border",!t.detected&&"opacity-50 cursor-not-allowed"),children:t.enabled&&t.detected&&g.jsx(ii,{className:"w-3 h-3 text-white"})}),g.jsx(y,{className:Ne("w-5 h-5 shrink-0",s&&"animate-pulse text-muted-foreground",!s&&t.detected&&"text-emerald-400",!s&&!t.detected&&"text-zinc-600")}),g.jsx("div",{className:"flex-1 min-w-0",children:c?g.jsx("input",{type:"text",value:m,onChange:S=>x(S.target.value),onBlur:v,onKeyDown:w,autoFocus:!0,placeholder:"Enter path to your memory folder...",className:"w-full bg-secondary border border-border rounded-md px-2 py-1 text-sm font-mono text-foreground focus:outline-none focus:border-violet-500 placeholder:text-muted-foreground/50"}):g.jsx("button",{onClick:u,className:"font-mono text-sm text-foreground hover:text-violet-400 transition-colors cursor-pointer truncate block w-full text-left",title:"Click to edit path",children:t.path||g.jsx("span",{className:"text-muted-foreground/50",children:"Click to enter path..."})})}),!s&&!c&&g.jsx("span",{className:Ne("text-xs shrink-0",t.detected?"text-emerald-400":"text-zinc-600"),children:t.detected?"Found":"Not found"}),p&&!c&&g.jsx("button",{onClick:r,className:"p-1.5 rounded-md text-zinc-500 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove source",children:g.jsx(av,{className:"w-4 h-4"})})]})}function jM({sources:t}){return g.jsxs("div",{children:[g.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Review Permissions"}),g.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Memory Mapper will have"," ",g.jsx("strong",{className:"text-foreground",children:"read-only"})," access to:"]}),g.jsx("div",{className:"space-y-3 mb-6",children:t.map(i=>g.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl bg-secondary/30 border border-border",children:[g.jsx(uh,{className:"w-5 h-5 text-violet-400"}),g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"font-mono text-sm text-foreground",children:i.path}),g.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Memory files, logs, and configuration"})]}),g.jsx(ii,{className:"w-4 h-4 text-emerald-400"})]},i.id))}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jd,{icon:lv,text:"Data never leaves your machine"}),g.jsx(jd,{icon:ch,text:"Files are never modified or deleted"}),g.jsx(jd,{icon:rv,text:"No external network connections"})]})]})}function jd({icon:t,text:i}){return g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[g.jsx(t,{className:"w-3.5 h-3.5 text-emerald-500"}),g.jsx("span",{children:i})]})}function dt(t,i,{checkForDefaultPrevented:a=!0}={}){return function(s){if(t==null||t(s),a===!1||!s.defaultPrevented)return i==null?void 0:i(s)}}function Oc(t,i=[]){let a=[];function r(c,u){const h=T.createContext(u),p=a.length;a=[...a,u];const m=y=>{var C;const{scope:v,children:w,...S}=y,_=((C=v==null?void 0:v[t])==null?void 0:C[p])||h,E=T.useMemo(()=>S,Object.values(S));return g.jsx(_.Provider,{value:E,children:w})};m.displayName=c+"Provider";function x(y,v){var _;const w=((_=v==null?void 0:v[t])==null?void 0:_[p])||h,S=T.useContext(w);if(S)return S;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${c}\``)}return[m,x]}const s=()=>{const c=a.map(u=>T.createContext(u));return function(h){const p=(h==null?void 0:h[t])||c;return T.useMemo(()=>({[`__scope${t}`]:{...h,[t]:p}}),[h,p])}};return s.scopeName=t,[r,zM(s,...i)]}function zM(...t){const i=t[0];if(t.length===1)return i;const a=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const u=r.reduce((h,{useScope:p,scopeName:m})=>{const y=p(c)[`__scope${m}`];return{...h,...y}},{});return T.useMemo(()=>({[`__scope${i.scopeName}`]:u}),[u])}};return a.scopeName=i.scopeName,a}function RM(t){const i=OM(t),a=T.forwardRef((r,s)=>{const{children:c,...u}=r,h=T.Children.toArray(c),p=h.find(kM);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}function OM(t){const i=T.forwardRef((a,r)=>{const{children:s,...c}=a;if(T.isValidElement(s)){const u=HM(s),h=LM(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var DM=Symbol("radix.slottable");function kM(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===DM}function LM(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function HM(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var BM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dt=BM.reduce((t,i)=>{const a=RM(`Primitive.${i}`),r=T.forwardRef((s,c)=>{const{asChild:u,...h}=s,p=u?a:i;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(p,{...h,ref:c})});return r.displayName=`Primitive.${i}`,{...t,[i]:r}},{});function J1(t,i){t&&Tc.flushSync(()=>t.dispatchEvent(i))}function Gi(t){const i=T.useRef(t);return T.useEffect(()=>{i.current=t}),T.useMemo(()=>(...a)=>{var r;return(r=i.current)==null?void 0:r.call(i,...a)},[])}function UM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t);T.useEffect(()=>{const r=s=>{s.key==="Escape"&&a(s)};return i.addEventListener("keydown",r,{capture:!0}),()=>i.removeEventListener("keydown",r,{capture:!0})},[a,i])}var VM="DismissableLayer",Wd="dismissableLayer.update",$M="dismissableLayer.pointerDownOutside",YM="dismissableLayer.focusOutside",cx,W1=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kh=T.forwardRef((t,i)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:h,...p}=t,m=T.useContext(W1),[x,y]=T.useState(null),v=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=T.useState({}),S=dn(i,L=>y(L)),_=Array.from(m.layers),[E]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=_.indexOf(E),j=x?_.indexOf(x):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,A=j>=C,H=XM(L=>{const V=L.target,Z=[...m.branches].some(le=>le.contains(V));!A||Z||(s==null||s(L),u==null||u(L),L.defaultPrevented||h==null||h())},v),k=GM(L=>{const V=L.target;[...m.branches].some(le=>le.contains(V))||(c==null||c(L),u==null||u(L),L.defaultPrevented||h==null||h())},v);return UM(L=>{j===m.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&h&&(L.preventDefault(),h()))},v),T.useEffect(()=>{if(x)return a&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(cx=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),ux(),()=>{a&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=cx)}},[x,v,a,m]),T.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),ux())},[x,m]),T.useEffect(()=>{const L=()=>w({});return document.addEventListener(Wd,L),()=>document.removeEventListener(Wd,L)},[]),g.jsx(Dt.div,{...p,ref:S,style:{pointerEvents:N?A?"auto":"none":void 0,...t.style},onFocusCapture:dt(t.onFocusCapture,k.onFocusCapture),onBlurCapture:dt(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:dt(t.onPointerDownCapture,H.onPointerDownCapture)})});kh.displayName=VM;var qM="DismissableLayerBranch",eb=T.forwardRef((t,i)=>{const a=T.useContext(W1),r=T.useRef(null),s=dn(i,r);return T.useEffect(()=>{const c=r.current;if(c)return a.branches.add(c),()=>{a.branches.delete(c)}},[a.branches]),g.jsx(Dt.div,{...t,ref:s})});eb.displayName=qM;function XM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t),r=T.useRef(!1),s=T.useRef(()=>{});return T.useEffect(()=>{const c=h=>{if(h.target&&!r.current){let p=function(){tb($M,a,m,{discrete:!0})};const m={originalEvent:h};h.pointerType==="touch"?(i.removeEventListener("click",s.current),s.current=p,i.addEventListener("click",s.current,{once:!0})):p()}else i.removeEventListener("click",s.current);r.current=!1},u=window.setTimeout(()=>{i.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),i.removeEventListener("pointerdown",c),i.removeEventListener("click",s.current)}},[i,a]),{onPointerDownCapture:()=>r.current=!0}}function GM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t),r=T.useRef(!1);return T.useEffect(()=>{const s=c=>{c.target&&!r.current&&tb(YM,a,{originalEvent:c},{discrete:!1})};return i.addEventListener("focusin",s),()=>i.removeEventListener("focusin",s)},[i,a]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ux(){const t=new CustomEvent(Wd);document.dispatchEvent(t)}function tb(t,i,a,{discrete:r}){const s=a.originalEvent.target,c=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:a});i&&s.addEventListener(t,i,{once:!0}),r?J1(s,c):s.dispatchEvent(c)}var ZM=kh,QM=eb,Zi=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{};const KM=["top","right","bottom","left"],Qi=Math.min,Xt=Math.max,mc=Math.round,Zs=Math.floor,_n=t=>({x:t,y:t}),PM={left:"right",right:"left",bottom:"top",top:"bottom"},FM={start:"end",end:"start"};function eh(t,i,a){return Xt(t,Qi(i,a))}function ri(t,i){return typeof t=="function"?t(i):t}function oi(t){return t.split("-")[0]}function Ua(t){return t.split("-")[1]}function Lh(t){return t==="x"?"y":"x"}function Hh(t){return t==="y"?"height":"width"}const IM=new Set(["top","bottom"]);function En(t){return IM.has(oi(t))?"y":"x"}function Bh(t){return Lh(En(t))}function JM(t,i,a){a===void 0&&(a=!1);const r=Ua(t),s=Bh(t),c=Hh(s);let u=s==="x"?r===(a?"end":"start")?"right":"left":r==="start"?"bottom":"top";return i.reference[c]>i.floating[c]&&(u=pc(u)),[u,pc(u)]}function WM(t){const i=pc(t);return[th(t),i,th(i)]}function th(t){return t.replace(/start|end/g,i=>FM[i])}const fx=["left","right"],dx=["right","left"],ej=["top","bottom"],tj=["bottom","top"];function nj(t,i,a){switch(t){case"top":case"bottom":return a?i?dx:fx:i?fx:dx;case"left":case"right":return i?ej:tj;default:return[]}}function ij(t,i,a,r){const s=Ua(t);let c=nj(oi(t),a==="start",r);return s&&(c=c.map(u=>u+"-"+s),i&&(c=c.concat(c.map(th)))),c}function pc(t){return t.replace(/left|right|bottom|top/g,i=>PM[i])}function lj(t){return{top:0,right:0,bottom:0,left:0,...t}}function nb(t){return typeof t!="number"?lj(t):{top:t,right:t,bottom:t,left:t}}function gc(t){const{x:i,y:a,width:r,height:s}=t;return{width:r,height:s,top:a,left:i,right:i+r,bottom:a+s,x:i,y:a}}function hx(t,i,a){let{reference:r,floating:s}=t;const c=En(i),u=Bh(i),h=Hh(u),p=oi(i),m=c==="y",x=r.x+r.width/2-s.width/2,y=r.y+r.height/2-s.height/2,v=r[h]/2-s[h]/2;let w;switch(p){case"top":w={x,y:r.y-s.height};break;case"bottom":w={x,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y};break;case"left":w={x:r.x-s.width,y};break;default:w={x:r.x,y:r.y}}switch(Ua(i)){case"start":w[u]-=v*(a&&m?-1:1);break;case"end":w[u]+=v*(a&&m?-1:1);break}return w}async function aj(t,i){var a;i===void 0&&(i={});const{x:r,y:s,platform:c,rects:u,elements:h,strategy:p}=t,{boundary:m="clippingAncestors",rootBoundary:x="viewport",elementContext:y="floating",altBoundary:v=!1,padding:w=0}=ri(i,t),S=nb(w),E=h[v?y==="floating"?"reference":"floating":y],C=gc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(E)))==null||a?E:E.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(h.floating)),boundary:m,rootBoundary:x,strategy:p})),j=y==="floating"?{x:r,y:s,width:u.floating.width,height:u.floating.height}:u.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h.floating)),A=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},H=gc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:N,strategy:p}):j);return{top:(C.top-H.top+S.top)/A.y,bottom:(H.bottom-C.bottom+S.bottom)/A.y,left:(C.left-H.left+S.left)/A.x,right:(H.right-C.right+S.right)/A.x}}const rj=async(t,i,a)=>{const{placement:r="bottom",strategy:s="absolute",middleware:c=[],platform:u}=a,h=c.filter(Boolean),p=await(u.isRTL==null?void 0:u.isRTL(i));let m=await u.getElementRects({reference:t,floating:i,strategy:s}),{x,y}=hx(m,r,p),v=r,w={},S=0;for(let E=0;E<h.length;E++){var _;const{name:C,fn:j}=h[E],{x:N,y:A,data:H,reset:k}=await j({x,y,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:m,platform:{...u,detectOverflow:(_=u.detectOverflow)!=null?_:aj},elements:{reference:t,floating:i}});x=N??x,y=A??y,w={...w,[C]:{...w[C],...H}},k&&S<=50&&(S++,typeof k=="object"&&(k.placement&&(v=k.placement),k.rects&&(m=k.rects===!0?await u.getElementRects({reference:t,floating:i,strategy:s}):k.rects),{x,y}=hx(m,v,p)),E=-1)}return{x,y,placement:v,strategy:s,middlewareData:w}},oj=t=>({name:"arrow",options:t,async fn(i){const{x:a,y:r,placement:s,rects:c,platform:u,elements:h,middlewareData:p}=i,{element:m,padding:x=0}=ri(t,i)||{};if(m==null)return{};const y=nb(x),v={x:a,y:r},w=Bh(s),S=Hh(w),_=await u.getDimensions(m),E=w==="y",C=E?"top":"left",j=E?"bottom":"right",N=E?"clientHeight":"clientWidth",A=c.reference[S]+c.reference[w]-v[w]-c.floating[S],H=v[w]-c.reference[w],k=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let L=k?k[N]:0;(!L||!await(u.isElement==null?void 0:u.isElement(k)))&&(L=h.floating[N]||c.floating[S]);const V=A/2-H/2,Z=L/2-_[S]/2-1,le=Qi(y[C],Z),Q=Qi(y[j],Z),X=le,te=L-_[S]-Q,D=L/2-_[S]/2+V,G=eh(X,D,te),z=!p.arrow&&Ua(s)!=null&&D!==G&&c.reference[S]/2-(D<X?le:Q)-_[S]/2<0,B=z?D<X?D-X:D-te:0;return{[w]:v[w]+B,data:{[w]:G,centerOffset:D-G-B,...z&&{alignmentOffset:B}},reset:z}}}),sj=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(i){var a,r;const{placement:s,middlewareData:c,rects:u,initialPlacement:h,platform:p,elements:m}=i,{mainAxis:x=!0,crossAxis:y=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:_=!0,...E}=ri(t,i);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const C=oi(s),j=En(h),N=oi(h)===h,A=await(p.isRTL==null?void 0:p.isRTL(m.floating)),H=v||(N||!_?[pc(h)]:WM(h)),k=S!=="none";!v&&k&&H.push(...ij(h,_,S,A));const L=[h,...H],V=await p.detectOverflow(i,E),Z=[];let le=((r=c.flip)==null?void 0:r.overflows)||[];if(x&&Z.push(V[C]),y){const D=JM(s,u,A);Z.push(V[D[0]],V[D[1]])}if(le=[...le,{placement:s,overflows:Z}],!Z.every(D=>D<=0)){var Q,X;const D=(((Q=c.flip)==null?void 0:Q.index)||0)+1,G=L[D];if(G&&(!(y==="alignment"?j!==En(G):!1)||le.every(O=>En(O.placement)===j?O.overflows[0]>0:!0)))return{data:{index:D,overflows:le},reset:{placement:G}};let z=(X=le.filter(B=>B.overflows[0]<=0).sort((B,O)=>B.overflows[1]-O.overflows[1])[0])==null?void 0:X.placement;if(!z)switch(w){case"bestFit":{var te;const B=(te=le.filter(O=>{if(k){const $=En(O.placement);return $===j||$==="y"}return!0}).map(O=>[O.placement,O.overflows.filter($=>$>0).reduce(($,J)=>$+J,0)]).sort((O,$)=>O[1]-$[1])[0])==null?void 0:te[0];B&&(z=B);break}case"initialPlacement":z=h;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function mx(t,i){return{top:t.top-i.height,right:t.right-i.width,bottom:t.bottom-i.height,left:t.left-i.width}}function px(t){return KM.some(i=>t[i]>=0)}const cj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(i){const{rects:a,platform:r}=i,{strategy:s="referenceHidden",...c}=ri(t,i);switch(s){case"referenceHidden":{const u=await r.detectOverflow(i,{...c,elementContext:"reference"}),h=mx(u,a.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:px(h)}}}case"escaped":{const u=await r.detectOverflow(i,{...c,altBoundary:!0}),h=mx(u,a.floating);return{data:{escapedOffsets:h,escaped:px(h)}}}default:return{}}}}},ib=new Set(["left","top"]);async function uj(t,i){const{placement:a,platform:r,elements:s}=t,c=await(r.isRTL==null?void 0:r.isRTL(s.floating)),u=oi(a),h=Ua(a),p=En(a)==="y",m=ib.has(u)?-1:1,x=c&&p?-1:1,y=ri(i,t);let{mainAxis:v,crossAxis:w,alignmentAxis:S}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return h&&typeof S=="number"&&(w=h==="end"?S*-1:S),p?{x:w*x,y:v*m}:{x:v*m,y:w*x}}const fj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(i){var a,r;const{x:s,y:c,placement:u,middlewareData:h}=i,p=await uj(i,t);return u===((a=h.offset)==null?void 0:a.placement)&&(r=h.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:c+p.y,data:{...p,placement:u}}}}},dj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(i){const{x:a,y:r,placement:s,platform:c}=i,{mainAxis:u=!0,crossAxis:h=!1,limiter:p={fn:C=>{let{x:j,y:N}=C;return{x:j,y:N}}},...m}=ri(t,i),x={x:a,y:r},y=await c.detectOverflow(i,m),v=En(oi(s)),w=Lh(v);let S=x[w],_=x[v];if(u){const C=w==="y"?"top":"left",j=w==="y"?"bottom":"right",N=S+y[C],A=S-y[j];S=eh(N,S,A)}if(h){const C=v==="y"?"top":"left",j=v==="y"?"bottom":"right",N=_+y[C],A=_-y[j];_=eh(N,_,A)}const E=p.fn({...i,[w]:S,[v]:_});return{...E,data:{x:E.x-a,y:E.y-r,enabled:{[w]:u,[v]:h}}}}}},hj=function(t){return t===void 0&&(t={}),{options:t,fn(i){const{x:a,y:r,placement:s,rects:c,middlewareData:u}=i,{offset:h=0,mainAxis:p=!0,crossAxis:m=!0}=ri(t,i),x={x:a,y:r},y=En(s),v=Lh(y);let w=x[v],S=x[y];const _=ri(h,i),E=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(p){const N=v==="y"?"height":"width",A=c.reference[v]-c.floating[N]+E.mainAxis,H=c.reference[v]+c.reference[N]-E.mainAxis;w<A?w=A:w>H&&(w=H)}if(m){var C,j;const N=v==="y"?"width":"height",A=ib.has(oi(s)),H=c.reference[y]-c.floating[N]+(A&&((C=u.offset)==null?void 0:C[y])||0)+(A?0:E.crossAxis),k=c.reference[y]+c.reference[N]+(A?0:((j=u.offset)==null?void 0:j[y])||0)-(A?E.crossAxis:0);S<H?S=H:S>k&&(S=k)}return{[v]:w,[y]:S}}}},mj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(i){var a,r;const{placement:s,rects:c,platform:u,elements:h}=i,{apply:p=()=>{},...m}=ri(t,i),x=await u.detectOverflow(i,m),y=oi(s),v=Ua(s),w=En(s)==="y",{width:S,height:_}=c.floating;let E,C;y==="top"||y==="bottom"?(E=y,C=v===(await(u.isRTL==null?void 0:u.isRTL(h.floating))?"start":"end")?"left":"right"):(C=y,E=v==="end"?"top":"bottom");const j=_-x.top-x.bottom,N=S-x.left-x.right,A=Qi(_-x[E],j),H=Qi(S-x[C],N),k=!i.middlewareData.shift;let L=A,V=H;if((a=i.middlewareData.shift)!=null&&a.enabled.x&&(V=N),(r=i.middlewareData.shift)!=null&&r.enabled.y&&(L=j),k&&!v){const le=Xt(x.left,0),Q=Xt(x.right,0),X=Xt(x.top,0),te=Xt(x.bottom,0);w?V=S-2*(le!==0||Q!==0?le+Q:Xt(x.left,x.right)):L=_-2*(X!==0||te!==0?X+te:Xt(x.top,x.bottom))}await p({...i,availableWidth:V,availableHeight:L});const Z=await u.getDimensions(h.floating);return S!==Z.width||_!==Z.height?{reset:{rects:!0}}:{}}}};function Dc(){return typeof window<"u"}function Va(t){return lb(t)?(t.nodeName||"").toLowerCase():"#document"}function Zt(t){var i;return(t==null||(i=t.ownerDocument)==null?void 0:i.defaultView)||window}function Mn(t){var i;return(i=(lb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:i.documentElement}function lb(t){return Dc()?t instanceof Node||t instanceof Zt(t).Node:!1}function hn(t){return Dc()?t instanceof Element||t instanceof Zt(t).Element:!1}function Tn(t){return Dc()?t instanceof HTMLElement||t instanceof Zt(t).HTMLElement:!1}function gx(t){return!Dc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Zt(t).ShadowRoot}const pj=new Set(["inline","contents"]);function so(t){const{overflow:i,overflowX:a,overflowY:r,display:s}=mn(t);return/auto|scroll|overlay|hidden|clip/.test(i+r+a)&&!pj.has(s)}const gj=new Set(["table","td","th"]);function yj(t){return gj.has(Va(t))}const xj=[":popover-open",":modal"];function kc(t){return xj.some(i=>{try{return t.matches(i)}catch{return!1}})}const vj=["transform","translate","scale","rotate","perspective"],bj=["transform","translate","scale","rotate","perspective","filter"],wj=["paint","layout","strict","content"];function Uh(t){const i=Vh(),a=hn(t)?mn(t):t;return vj.some(r=>a[r]?a[r]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!i&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!i&&(a.filter?a.filter!=="none":!1)||bj.some(r=>(a.willChange||"").includes(r))||wj.some(r=>(a.contain||"").includes(r))}function Sj(t){let i=Ki(t);for(;Tn(i)&&!ka(i);){if(Uh(i))return i;if(kc(i))return null;i=Ki(i)}return null}function Vh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ej=new Set(["html","body","#document"]);function ka(t){return Ej.has(Va(t))}function mn(t){return Zt(t).getComputedStyle(t)}function Lc(t){return hn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ki(t){if(Va(t)==="html")return t;const i=t.assignedSlot||t.parentNode||gx(t)&&t.host||Mn(t);return gx(i)?i.host:i}function ab(t){const i=Ki(t);return ka(i)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(i)&&so(i)?i:ab(i)}function eo(t,i,a){var r;i===void 0&&(i=[]),a===void 0&&(a=!0);const s=ab(t),c=s===((r=t.ownerDocument)==null?void 0:r.body),u=Zt(s);if(c){const h=nh(u);return i.concat(u,u.visualViewport||[],so(s)?s:[],h&&a?eo(h):[])}return i.concat(s,eo(s,[],a))}function nh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function rb(t){const i=mn(t);let a=parseFloat(i.width)||0,r=parseFloat(i.height)||0;const s=Tn(t),c=s?t.offsetWidth:a,u=s?t.offsetHeight:r,h=mc(a)!==c||mc(r)!==u;return h&&(a=c,r=u),{width:a,height:r,$:h}}function $h(t){return hn(t)?t:t.contextElement}function _a(t){const i=$h(t);if(!Tn(i))return _n(1);const a=i.getBoundingClientRect(),{width:r,height:s,$:c}=rb(i);let u=(c?mc(a.width):a.width)/r,h=(c?mc(a.height):a.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!h||!Number.isFinite(h))&&(h=1),{x:u,y:h}}const Nj=_n(0);function ob(t){const i=Zt(t);return!Vh()||!i.visualViewport?Nj:{x:i.visualViewport.offsetLeft,y:i.visualViewport.offsetTop}}function _j(t,i,a){return i===void 0&&(i=!1),!a||i&&a!==Zt(t)?!1:i}function zl(t,i,a,r){i===void 0&&(i=!1),a===void 0&&(a=!1);const s=t.getBoundingClientRect(),c=$h(t);let u=_n(1);i&&(r?hn(r)&&(u=_a(r)):u=_a(t));const h=_j(c,a,r)?ob(c):_n(0);let p=(s.left+h.x)/u.x,m=(s.top+h.y)/u.y,x=s.width/u.x,y=s.height/u.y;if(c){const v=Zt(c),w=r&&hn(r)?Zt(r):r;let S=v,_=nh(S);for(;_&&r&&w!==S;){const E=_a(_),C=_.getBoundingClientRect(),j=mn(_),N=C.left+(_.clientLeft+parseFloat(j.paddingLeft))*E.x,A=C.top+(_.clientTop+parseFloat(j.paddingTop))*E.y;p*=E.x,m*=E.y,x*=E.x,y*=E.y,p+=N,m+=A,S=Zt(_),_=nh(S)}}return gc({width:x,height:y,x:p,y:m})}function Hc(t,i){const a=Lc(t).scrollLeft;return i?i.left+a:zl(Mn(t)).left+a}function sb(t,i){const a=t.getBoundingClientRect(),r=a.left+i.scrollLeft-Hc(t,a),s=a.top+i.scrollTop;return{x:r,y:s}}function Cj(t){let{elements:i,rect:a,offsetParent:r,strategy:s}=t;const c=s==="fixed",u=Mn(r),h=i?kc(i.floating):!1;if(r===u||h&&c)return a;let p={scrollLeft:0,scrollTop:0},m=_n(1);const x=_n(0),y=Tn(r);if((y||!y&&!c)&&((Va(r)!=="body"||so(u))&&(p=Lc(r)),Tn(r))){const w=zl(r);m=_a(r),x.x=w.x+r.clientLeft,x.y=w.y+r.clientTop}const v=u&&!y&&!c?sb(u,p):_n(0);return{width:a.width*m.x,height:a.height*m.y,x:a.x*m.x-p.scrollLeft*m.x+x.x+v.x,y:a.y*m.y-p.scrollTop*m.y+x.y+v.y}}function Tj(t){return Array.from(t.getClientRects())}function Aj(t){const i=Mn(t),a=Lc(t),r=t.ownerDocument.body,s=Xt(i.scrollWidth,i.clientWidth,r.scrollWidth,r.clientWidth),c=Xt(i.scrollHeight,i.clientHeight,r.scrollHeight,r.clientHeight);let u=-a.scrollLeft+Hc(t);const h=-a.scrollTop;return mn(r).direction==="rtl"&&(u+=Xt(i.clientWidth,r.clientWidth)-s),{width:s,height:c,x:u,y:h}}const yx=25;function Mj(t,i){const a=Zt(t),r=Mn(t),s=a.visualViewport;let c=r.clientWidth,u=r.clientHeight,h=0,p=0;if(s){c=s.width,u=s.height;const x=Vh();(!x||x&&i==="fixed")&&(h=s.offsetLeft,p=s.offsetTop)}const m=Hc(r);if(m<=0){const x=r.ownerDocument,y=x.body,v=getComputedStyle(y),w=x.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,S=Math.abs(r.clientWidth-y.clientWidth-w);S<=yx&&(c-=S)}else m<=yx&&(c+=m);return{width:c,height:u,x:h,y:p}}const jj=new Set(["absolute","fixed"]);function zj(t,i){const a=zl(t,!0,i==="fixed"),r=a.top+t.clientTop,s=a.left+t.clientLeft,c=Tn(t)?_a(t):_n(1),u=t.clientWidth*c.x,h=t.clientHeight*c.y,p=s*c.x,m=r*c.y;return{width:u,height:h,x:p,y:m}}function xx(t,i,a){let r;if(i==="viewport")r=Mj(t,a);else if(i==="document")r=Aj(Mn(t));else if(hn(i))r=zj(i,a);else{const s=ob(t);r={x:i.x-s.x,y:i.y-s.y,width:i.width,height:i.height}}return gc(r)}function cb(t,i){const a=Ki(t);return a===i||!hn(a)||ka(a)?!1:mn(a).position==="fixed"||cb(a,i)}function Rj(t,i){const a=i.get(t);if(a)return a;let r=eo(t,[],!1).filter(h=>hn(h)&&Va(h)!=="body"),s=null;const c=mn(t).position==="fixed";let u=c?Ki(t):t;for(;hn(u)&&!ka(u);){const h=mn(u),p=Uh(u);!p&&h.position==="fixed"&&(s=null),(c?!p&&!s:!p&&h.position==="static"&&!!s&&jj.has(s.position)||so(u)&&!p&&cb(t,u))?r=r.filter(x=>x!==u):s=h,u=Ki(u)}return i.set(t,r),r}function Oj(t){let{element:i,boundary:a,rootBoundary:r,strategy:s}=t;const u=[...a==="clippingAncestors"?kc(i)?[]:Rj(i,this._c):[].concat(a),r],h=u[0],p=u.reduce((m,x)=>{const y=xx(i,x,s);return m.top=Xt(y.top,m.top),m.right=Qi(y.right,m.right),m.bottom=Qi(y.bottom,m.bottom),m.left=Xt(y.left,m.left),m},xx(i,h,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function Dj(t){const{width:i,height:a}=rb(t);return{width:i,height:a}}function kj(t,i,a){const r=Tn(i),s=Mn(i),c=a==="fixed",u=zl(t,!0,c,i);let h={scrollLeft:0,scrollTop:0};const p=_n(0);function m(){p.x=Hc(s)}if(r||!r&&!c)if((Va(i)!=="body"||so(s))&&(h=Lc(i)),r){const w=zl(i,!0,c,i);p.x=w.x+i.clientLeft,p.y=w.y+i.clientTop}else s&&m();c&&!r&&s&&m();const x=s&&!r&&!c?sb(s,h):_n(0),y=u.left+h.scrollLeft-p.x-x.x,v=u.top+h.scrollTop-p.y-x.y;return{x:y,y:v,width:u.width,height:u.height}}function zd(t){return mn(t).position==="static"}function vx(t,i){if(!Tn(t)||mn(t).position==="fixed")return null;if(i)return i(t);let a=t.offsetParent;return Mn(t)===a&&(a=a.ownerDocument.body),a}function ub(t,i){const a=Zt(t);if(kc(t))return a;if(!Tn(t)){let s=Ki(t);for(;s&&!ka(s);){if(hn(s)&&!zd(s))return s;s=Ki(s)}return a}let r=vx(t,i);for(;r&&yj(r)&&zd(r);)r=vx(r,i);return r&&ka(r)&&zd(r)&&!Uh(r)?a:r||Sj(t)||a}const Lj=async function(t){const i=this.getOffsetParent||ub,a=this.getDimensions,r=await a(t.floating);return{reference:kj(t.reference,await i(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hj(t){return mn(t).direction==="rtl"}const Bj={convertOffsetParentRelativeRectToViewportRelativeRect:Cj,getDocumentElement:Mn,getClippingRect:Oj,getOffsetParent:ub,getElementRects:Lj,getClientRects:Tj,getDimensions:Dj,getScale:_a,isElement:hn,isRTL:Hj};function fb(t,i){return t.x===i.x&&t.y===i.y&&t.width===i.width&&t.height===i.height}function Uj(t,i){let a=null,r;const s=Mn(t);function c(){var h;clearTimeout(r),(h=a)==null||h.disconnect(),a=null}function u(h,p){h===void 0&&(h=!1),p===void 0&&(p=1),c();const m=t.getBoundingClientRect(),{left:x,top:y,width:v,height:w}=m;if(h||i(),!v||!w)return;const S=Zs(y),_=Zs(s.clientWidth-(x+v)),E=Zs(s.clientHeight-(y+w)),C=Zs(x),N={rootMargin:-S+"px "+-_+"px "+-E+"px "+-C+"px",threshold:Xt(0,Qi(1,p))||1};let A=!0;function H(k){const L=k[0].intersectionRatio;if(L!==p){if(!A)return u();L?u(!1,L):r=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!fb(m,t.getBoundingClientRect())&&u(),A=!1}try{a=new IntersectionObserver(H,{...N,root:s.ownerDocument})}catch{a=new IntersectionObserver(H,N)}a.observe(t)}return u(!0),c}function Vj(t,i,a,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,m=$h(t),x=s||c?[...m?eo(m):[],...eo(i)]:[];x.forEach(C=>{s&&C.addEventListener("scroll",a,{passive:!0}),c&&C.addEventListener("resize",a)});const y=m&&h?Uj(m,a):null;let v=-1,w=null;u&&(w=new ResizeObserver(C=>{let[j]=C;j&&j.target===m&&w&&(w.unobserve(i),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=w)==null||N.observe(i)})),a()}),m&&!p&&w.observe(m),w.observe(i));let S,_=p?zl(t):null;p&&E();function E(){const C=zl(t);_&&!fb(_,C)&&a(),_=C,S=requestAnimationFrame(E)}return a(),()=>{var C;x.forEach(j=>{s&&j.removeEventListener("scroll",a),c&&j.removeEventListener("resize",a)}),y==null||y(),(C=w)==null||C.disconnect(),w=null,p&&cancelAnimationFrame(S)}}const $j=fj,Yj=dj,qj=sj,Xj=mj,Gj=cj,bx=oj,Zj=hj,Qj=(t,i,a)=>{const r=new Map,s={platform:Bj,...a},c={...s.platform,_c:r};return rj(t,i,{...s,platform:c})};var Kj=typeof document<"u",Pj=function(){},ec=Kj?T.useLayoutEffect:Pj;function yc(t,i){if(t===i)return!0;if(typeof t!=typeof i)return!1;if(typeof t=="function"&&t.toString()===i.toString())return!0;let a,r,s;if(t&&i&&typeof t=="object"){if(Array.isArray(t)){if(a=t.length,a!==i.length)return!1;for(r=a;r--!==0;)if(!yc(t[r],i[r]))return!1;return!0}if(s=Object.keys(t),a=s.length,a!==Object.keys(i).length)return!1;for(r=a;r--!==0;)if(!{}.hasOwnProperty.call(i,s[r]))return!1;for(r=a;r--!==0;){const c=s[r];if(!(c==="_owner"&&t.$$typeof)&&!yc(t[c],i[c]))return!1}return!0}return t!==t&&i!==i}function db(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function wx(t,i){const a=db(t);return Math.round(i*a)/a}function Rd(t){const i=T.useRef(t);return ec(()=>{i.current=t}),i}function Fj(t){t===void 0&&(t={});const{placement:i="bottom",strategy:a="absolute",middleware:r=[],platform:s,elements:{reference:c,floating:u}={},transform:h=!0,whileElementsMounted:p,open:m}=t,[x,y]=T.useState({x:0,y:0,strategy:a,placement:i,middlewareData:{},isPositioned:!1}),[v,w]=T.useState(r);yc(v,r)||w(r);const[S,_]=T.useState(null),[E,C]=T.useState(null),j=T.useCallback(O=>{O!==k.current&&(k.current=O,_(O))},[]),N=T.useCallback(O=>{O!==L.current&&(L.current=O,C(O))},[]),A=c||S,H=u||E,k=T.useRef(null),L=T.useRef(null),V=T.useRef(x),Z=p!=null,le=Rd(p),Q=Rd(s),X=Rd(m),te=T.useCallback(()=>{if(!k.current||!L.current)return;const O={placement:i,strategy:a,middleware:v};Q.current&&(O.platform=Q.current),Qj(k.current,L.current,O).then($=>{const J={...$,isPositioned:X.current!==!1};D.current&&!yc(V.current,J)&&(V.current=J,Tc.flushSync(()=>{y(J)}))})},[v,i,a,Q,X]);ec(()=>{m===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,y(O=>({...O,isPositioned:!1})))},[m]);const D=T.useRef(!1);ec(()=>(D.current=!0,()=>{D.current=!1}),[]),ec(()=>{if(A&&(k.current=A),H&&(L.current=H),A&&H){if(le.current)return le.current(A,H,te);te()}},[A,H,te,le,Z]);const G=T.useMemo(()=>({reference:k,floating:L,setReference:j,setFloating:N}),[j,N]),z=T.useMemo(()=>({reference:A,floating:H}),[A,H]),B=T.useMemo(()=>{const O={position:a,left:0,top:0};if(!z.floating)return O;const $=wx(z.floating,x.x),J=wx(z.floating,x.y);return h?{...O,transform:"translate("+$+"px, "+J+"px)",...db(z.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:$,top:J}},[a,h,z.floating,x.x,x.y]);return T.useMemo(()=>({...x,update:te,refs:G,elements:z,floatingStyles:B}),[x,te,G,z,B])}const Ij=t=>{function i(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:t,fn(a){const{element:r,padding:s}=typeof t=="function"?t(a):t;return r&&i(r)?r.current!=null?bx({element:r.current,padding:s}).fn(a):{}:r?bx({element:r,padding:s}).fn(a):{}}}},Jj=(t,i)=>({...$j(t),options:[t,i]}),Wj=(t,i)=>({...Yj(t),options:[t,i]}),ez=(t,i)=>({...Zj(t),options:[t,i]}),tz=(t,i)=>({...qj(t),options:[t,i]}),nz=(t,i)=>({...Xj(t),options:[t,i]}),iz=(t,i)=>({...Gj(t),options:[t,i]}),lz=(t,i)=>({...Ij(t),options:[t,i]});var az="Arrow",hb=T.forwardRef((t,i)=>{const{children:a,width:r=10,height:s=5,...c}=t;return g.jsx(Dt.svg,{...c,ref:i,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?a:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});hb.displayName=az;var rz=hb;function oz(t){const[i,a]=T.useState(void 0);return Zi(()=>{if(t){a({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const c=s[0];let u,h;if("borderBoxSize"in c){const p=c.borderBoxSize,m=Array.isArray(p)?p[0]:p;u=m.inlineSize,h=m.blockSize}else u=t.offsetWidth,h=t.offsetHeight;a({width:u,height:h})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else a(void 0)},[t]),i}var mb="Popper",[pb,gb]=Oc(mb),[E6,yb]=pb(mb),xb="PopperAnchor",vb=T.forwardRef((t,i)=>{const{__scopePopper:a,virtualRef:r,...s}=t,c=yb(xb,a),u=T.useRef(null),h=dn(i,u),p=T.useRef(null);return T.useEffect(()=>{const m=p.current;p.current=(r==null?void 0:r.current)||u.current,m!==p.current&&c.onAnchorChange(p.current)}),r?null:g.jsx(Dt.div,{...s,ref:h})});vb.displayName=xb;var Yh="PopperContent",[sz,cz]=pb(Yh),bb=T.forwardRef((t,i)=>{var oe,ce,fe,we,ve,ge;const{__scopePopper:a,side:r="bottom",sideOffset:s=0,align:c="center",alignOffset:u=0,arrowPadding:h=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:w="optimized",onPlaced:S,..._}=t,E=yb(Yh,a),[C,j]=T.useState(null),N=dn(i,ye=>j(ye)),[A,H]=T.useState(null),k=oz(A),L=(k==null?void 0:k.width)??0,V=(k==null?void 0:k.height)??0,Z=r+(c!=="center"?"-"+c:""),le=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Q=Array.isArray(m)?m:[m],X=Q.length>0,te={padding:le,boundary:Q.filter(fz),altBoundary:X},{refs:D,floatingStyles:G,placement:z,isPositioned:B,middlewareData:O}=Fj({strategy:"fixed",placement:Z,whileElementsMounted:(...ye)=>Vj(...ye,{animationFrame:w==="always"}),elements:{reference:E.anchor},middleware:[Jj({mainAxis:s+V,alignmentAxis:u}),p&&Wj({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?ez():void 0,...te}),p&&tz({...te}),nz({...te,apply:({elements:ye,rects:Ce,availableWidth:Ue,availableHeight:je})=>{const{width:nt,height:kt}=Ce.reference,ht=ye.floating.style;ht.setProperty("--radix-popper-available-width",`${Ue}px`),ht.setProperty("--radix-popper-available-height",`${je}px`),ht.setProperty("--radix-popper-anchor-width",`${nt}px`),ht.setProperty("--radix-popper-anchor-height",`${kt}px`)}}),A&&lz({element:A,padding:h}),dz({arrowWidth:L,arrowHeight:V}),v&&iz({strategy:"referenceHidden",...te})]}),[$,J]=Eb(z),R=Gi(S);Zi(()=>{B&&(R==null||R())},[B,R]);const Y=(oe=O.arrow)==null?void 0:oe.x,P=(ce=O.arrow)==null?void 0:ce.y,ee=((fe=O.arrow)==null?void 0:fe.centerOffset)!==0,[se,ue]=T.useState();return Zi(()=>{C&&ue(window.getComputedStyle(C).zIndex)},[C]),g.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:B?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(we=O.transformOrigin)==null?void 0:we.x,(ve=O.transformOrigin)==null?void 0:ve.y].join(" "),...((ge=O.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(sz,{scope:a,placedSide:$,onArrowChange:H,arrowX:Y,arrowY:P,shouldHideArrow:ee,children:g.jsx(Dt.div,{"data-side":$,"data-align":J,..._,ref:N,style:{..._.style,animation:B?void 0:"none"}})})})});bb.displayName=Yh;var wb="PopperArrow",uz={top:"bottom",right:"left",bottom:"top",left:"right"},Sb=T.forwardRef(function(i,a){const{__scopePopper:r,...s}=i,c=cz(wb,r),u=uz[c.placedSide];return g.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:g.jsx(rz,{...s,ref:a,style:{...s.style,display:"block"}})})});Sb.displayName=wb;function fz(t){return t!==null}var dz=t=>({name:"transformOrigin",options:t,fn(i){var E,C,j;const{placement:a,rects:r,middlewareData:s}=i,u=((E=s.arrow)==null?void 0:E.centerOffset)!==0,h=u?0:t.arrowWidth,p=u?0:t.arrowHeight,[m,x]=Eb(a),y={start:"0%",center:"50%",end:"100%"}[x],v=(((C=s.arrow)==null?void 0:C.x)??0)+h/2,w=(((j=s.arrow)==null?void 0:j.y)??0)+p/2;let S="",_="";return m==="bottom"?(S=u?y:`${v}px`,_=`${-p}px`):m==="top"?(S=u?y:`${v}px`,_=`${r.floating.height+p}px`):m==="right"?(S=`${-p}px`,_=u?y:`${w}px`):m==="left"&&(S=`${r.floating.width+p}px`,_=u?y:`${w}px`),{data:{x:S,y:_}}}});function Eb(t){const[i,a="center"]=t.split("-");return[i,a]}var hz=vb,mz=bb,pz=Sb,gz="Portal",qh=T.forwardRef((t,i)=>{var h;const{container:a,...r}=t,[s,c]=T.useState(!1);Zi(()=>c(!0),[]);const u=a||s&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return u?Z3.createPortal(g.jsx(Dt.div,{...r,ref:i}),u):null});qh.displayName=gz;function yz(t,i){return T.useReducer((a,r)=>i[a][r]??a,t)}var Bc=t=>{const{present:i,children:a}=t,r=xz(i),s=typeof a=="function"?a({present:r.isPresent}):T.Children.only(a),c=dn(r.ref,vz(s));return typeof a=="function"||r.isPresent?T.cloneElement(s,{ref:c}):null};Bc.displayName="Presence";function xz(t){const[i,a]=T.useState(),r=T.useRef(null),s=T.useRef(t),c=T.useRef("none"),u=t?"mounted":"unmounted",[h,p]=yz(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const m=Qs(r.current);c.current=h==="mounted"?m:"none"},[h]),Zi(()=>{const m=r.current,x=s.current;if(x!==t){const v=c.current,w=Qs(m);t?p("MOUNT"):w==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(x&&v!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,p]),Zi(()=>{if(i){let m;const x=i.ownerDocument.defaultView??window,y=w=>{const _=Qs(r.current).includes(CSS.escape(w.animationName));if(w.target===i&&_&&(p("ANIMATION_END"),!s.current)){const E=i.style.animationFillMode;i.style.animationFillMode="forwards",m=x.setTimeout(()=>{i.style.animationFillMode==="forwards"&&(i.style.animationFillMode=E)})}},v=w=>{w.target===i&&(c.current=Qs(r.current))};return i.addEventListener("animationstart",v),i.addEventListener("animationcancel",y),i.addEventListener("animationend",y),()=>{x.clearTimeout(m),i.removeEventListener("animationstart",v),i.removeEventListener("animationcancel",y),i.removeEventListener("animationend",y)}}else p("ANIMATION_END")},[i,p]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:T.useCallback(m=>{r.current=m?getComputedStyle(m):null,a(m)},[])}}function Qs(t){return(t==null?void 0:t.animationName)||"none"}function vz(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var bz=Symbol("radix.slottable");function wz(t){const i=({children:a})=>g.jsx(g.Fragment,{children:a});return i.displayName=`${t}.Slottable`,i.__radixId=bz,i}var Sz=Tx[" useInsertionEffect ".trim().toString()]||Zi;function Ez({prop:t,defaultProp:i,onChange:a=()=>{},caller:r}){const[s,c,u]=Nz({defaultProp:i,onChange:a}),h=t!==void 0,p=h?t:s;{const x=T.useRef(t!==void 0);T.useEffect(()=>{const y=x.current;y!==h&&console.warn(`${r} is changing from ${y?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=h},[h,r])}const m=T.useCallback(x=>{var y;if(h){const v=_z(x)?x(t):x;v!==t&&((y=u.current)==null||y.call(u,v))}else c(x)},[h,t,c,u]);return[p,m]}function Nz({defaultProp:t,onChange:i}){const[a,r]=T.useState(t),s=T.useRef(a),c=T.useRef(i);return Sz(()=>{c.current=i},[i]),T.useEffect(()=>{var u;s.current!==a&&((u=c.current)==null||u.call(c,a),s.current=a)},[a,s]),[a,r,c]}function _z(t){return typeof t=="function"}var Cz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Tz="VisuallyHidden",Uc=T.forwardRef((t,i)=>g.jsx(Dt.span,{...t,ref:i,style:{...Cz,...t.style}}));Uc.displayName=Tz;var Az=Uc,[Vc]=Oc("Tooltip",[gb]),Xh=gb(),Nb="TooltipProvider",Mz=700,Sx="tooltip.open",[jz,_b]=Vc(Nb),Cb=t=>{const{__scopeTooltip:i,delayDuration:a=Mz,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:c}=t,u=T.useRef(!0),h=T.useRef(!1),p=T.useRef(0);return T.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),g.jsx(jz,{scope:i,isOpenDelayedRef:u,delayDuration:a,onOpen:T.useCallback(()=>{window.clearTimeout(p.current),u.current=!1},[]),onClose:T.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>u.current=!0,r)},[r]),isPointerInTransitRef:h,onPointerInTransitChange:T.useCallback(m=>{h.current=m},[]),disableHoverableContent:s,children:c})};Cb.displayName=Nb;var Tb="Tooltip",[N6,co]=Vc(Tb),ih="TooltipTrigger",zz=T.forwardRef((t,i)=>{const{__scopeTooltip:a,...r}=t,s=co(ih,a),c=_b(ih,a),u=Xh(a),h=T.useRef(null),p=dn(i,h,s.onTriggerChange),m=T.useRef(!1),x=T.useRef(!1),y=T.useCallback(()=>m.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),g.jsx(hz,{asChild:!0,...u,children:g.jsx(Dt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:p,onPointerMove:dt(t.onPointerMove,v=>{v.pointerType!=="touch"&&!x.current&&!c.isPointerInTransitRef.current&&(s.onTriggerEnter(),x.current=!0)}),onPointerLeave:dt(t.onPointerLeave,()=>{s.onTriggerLeave(),x.current=!1}),onPointerDown:dt(t.onPointerDown,()=>{s.open&&s.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:dt(t.onFocus,()=>{m.current||s.onOpen()}),onBlur:dt(t.onBlur,s.onClose),onClick:dt(t.onClick,s.onClose)})})});zz.displayName=ih;var Gh="TooltipPortal",[Rz,Oz]=Vc(Gh,{forceMount:void 0}),Ab=t=>{const{__scopeTooltip:i,forceMount:a,children:r,container:s}=t,c=co(Gh,i);return g.jsx(Rz,{scope:i,forceMount:a,children:g.jsx(Bc,{present:a||c.open,children:g.jsx(qh,{asChild:!0,container:s,children:r})})})};Ab.displayName=Gh;var La="TooltipContent",Mb=T.forwardRef((t,i)=>{const a=Oz(La,t.__scopeTooltip),{forceMount:r=a.forceMount,side:s="top",...c}=t,u=co(La,t.__scopeTooltip);return g.jsx(Bc,{present:r||u.open,children:u.disableHoverableContent?g.jsx(jb,{side:s,...c,ref:i}):g.jsx(Dz,{side:s,...c,ref:i})})}),Dz=T.forwardRef((t,i)=>{const a=co(La,t.__scopeTooltip),r=_b(La,t.__scopeTooltip),s=T.useRef(null),c=dn(i,s),[u,h]=T.useState(null),{trigger:p,onClose:m}=a,x=s.current,{onPointerInTransitChange:y}=r,v=T.useCallback(()=>{h(null),y(!1)},[y]),w=T.useCallback((S,_)=>{const E=S.currentTarget,C={x:S.clientX,y:S.clientY},j=Uz(C,E.getBoundingClientRect()),N=Vz(C,j),A=$z(_.getBoundingClientRect()),H=qz([...N,...A]);h(H),y(!0)},[y]);return T.useEffect(()=>()=>v(),[v]),T.useEffect(()=>{if(p&&x){const S=E=>w(E,x),_=E=>w(E,p);return p.addEventListener("pointerleave",S),x.addEventListener("pointerleave",_),()=>{p.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",_)}}},[p,x,w,v]),T.useEffect(()=>{if(u){const S=_=>{const E=_.target,C={x:_.clientX,y:_.clientY},j=(p==null?void 0:p.contains(E))||(x==null?void 0:x.contains(E)),N=!Yz(C,u);j?v():N&&(v(),m())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,x,u,m,v]),g.jsx(jb,{...t,ref:c})}),[kz,Lz]=Vc(Tb,{isInside:!1}),Hz=wz("TooltipContent"),jb=T.forwardRef((t,i)=>{const{__scopeTooltip:a,children:r,"aria-label":s,onEscapeKeyDown:c,onPointerDownOutside:u,...h}=t,p=co(La,a),m=Xh(a),{onClose:x}=p;return T.useEffect(()=>(document.addEventListener(Sx,x),()=>document.removeEventListener(Sx,x)),[x]),T.useEffect(()=>{if(p.trigger){const y=v=>{const w=v.target;w!=null&&w.contains(p.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[p.trigger,x]),g.jsx(kh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:g.jsxs(mz,{"data-state":p.stateAttribute,...m,...h,ref:i,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(Hz,{children:r}),g.jsx(kz,{scope:a,isInside:!0,children:g.jsx(Az,{id:p.contentId,role:"tooltip",children:s||r})})]})})});Mb.displayName=La;var zb="TooltipArrow",Bz=T.forwardRef((t,i)=>{const{__scopeTooltip:a,...r}=t,s=Xh(a);return Lz(zb,a).isInside?null:g.jsx(pz,{...s,...r,ref:i})});Bz.displayName=zb;function Uz(t,i){const a=Math.abs(i.top-t.y),r=Math.abs(i.bottom-t.y),s=Math.abs(i.right-t.x),c=Math.abs(i.left-t.x);switch(Math.min(a,r,s,c)){case c:return"left";case s:return"right";case a:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Vz(t,i,a=5){const r=[];switch(i){case"top":r.push({x:t.x-a,y:t.y+a},{x:t.x+a,y:t.y+a});break;case"bottom":r.push({x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a});break;case"left":r.push({x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a});break;case"right":r.push({x:t.x-a,y:t.y-a},{x:t.x-a,y:t.y+a});break}return r}function $z(t){const{top:i,right:a,bottom:r,left:s}=t;return[{x:s,y:i},{x:a,y:i},{x:a,y:r},{x:s,y:r}]}function Yz(t,i){const{x:a,y:r}=t;let s=!1;for(let c=0,u=i.length-1;c<i.length;u=c++){const h=i[c],p=i[u],m=h.x,x=h.y,y=p.x,v=p.y;x>r!=v>r&&a<(y-m)*(r-x)/(v-x)+m&&(s=!s)}return s}function qz(t){const i=t.slice();return i.sort((a,r)=>a.x<r.x?-1:a.x>r.x?1:a.y<r.y?-1:a.y>r.y?1:0),Xz(i)}function Xz(t){if(t.length<=1)return t.slice();const i=[];for(let r=0;r<t.length;r++){const s=t[r];for(;i.length>=2;){const c=i[i.length-1],u=i[i.length-2];if((c.x-u.x)*(s.y-u.y)>=(c.y-u.y)*(s.x-u.x))i.pop();else break}i.push(s)}i.pop();const a=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;a.length>=2;){const c=a[a.length-1],u=a[a.length-2];if((c.x-u.x)*(s.y-u.y)>=(c.y-u.y)*(s.x-u.x))a.pop();else break}a.push(s)}return a.pop(),i.length===1&&a.length===1&&i[0].x===a[0].x&&i[0].y===a[0].y?i:i.concat(a)}var Gz=Cb,Zz=Ab,Rb=Mb;const Ex=Gz,Qz=T.forwardRef(({className:t,sideOffset:i=4,...a},r)=>g.jsx(Zz,{children:g.jsx(Rb,{ref:r,sideOffset:i,className:Ne("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));Qz.displayName=Rb.displayName;function Nx(t){const i=Kz(t),a=T.forwardRef((r,s)=>{const{children:c,...u}=r,h=T.Children.toArray(c),p=h.find(Fz);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}function Kz(t){const i=T.forwardRef((a,r)=>{const{children:s,...c}=a;if(T.isValidElement(s)){const u=Jz(s),h=Iz(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var Pz=Symbol("radix.slottable");function Fz(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Pz}function Iz(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function Jz(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}function Wz(t){const i=t+"CollectionProvider",[a,r]=Oc(i),[s,c]=a(i,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:C}=_,j=qt.useRef(null),N=qt.useRef(new Map).current;return g.jsx(s,{scope:E,itemMap:N,collectionRef:j,children:C})};u.displayName=i;const h=t+"CollectionSlot",p=Nx(h),m=qt.forwardRef((_,E)=>{const{scope:C,children:j}=_,N=c(h,C),A=dn(E,N.collectionRef);return g.jsx(p,{ref:A,children:j})});m.displayName=h;const x=t+"CollectionItemSlot",y="data-radix-collection-item",v=Nx(x),w=qt.forwardRef((_,E)=>{const{scope:C,children:j,...N}=_,A=qt.useRef(null),H=dn(E,A),k=c(x,C);return qt.useEffect(()=>(k.itemMap.set(A,{ref:A,...N}),()=>void k.itemMap.delete(A))),g.jsx(v,{[y]:"",ref:H,children:j})});w.displayName=x;function S(_){const E=c(t+"CollectionConsumer",_);return qt.useCallback(()=>{const j=E.collectionRef.current;if(!j)return[];const N=Array.from(j.querySelectorAll(`[${y}]`));return Array.from(E.itemMap.values()).sort((k,L)=>N.indexOf(k.ref.current)-N.indexOf(L.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},S,r]}var Zh="ToastProvider",[Qh,e6,t6]=Wz("Toast"),[Ob]=Oc("Toast",[t6]),[n6,$c]=Ob(Zh),Db=t=>{const{__scopeToast:i,label:a="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:c=50,children:u}=t,[h,p]=T.useState(null),[m,x]=T.useState(0),y=T.useRef(!1),v=T.useRef(!1);return a.trim()||console.error(`Invalid prop \`label\` supplied to \`${Zh}\`. Expected non-empty \`string\`.`),g.jsx(Qh.Provider,{scope:i,children:g.jsx(n6,{scope:i,label:a,duration:r,swipeDirection:s,swipeThreshold:c,toastCount:m,viewport:h,onViewportChange:p,onToastAdd:T.useCallback(()=>x(w=>w+1),[]),onToastRemove:T.useCallback(()=>x(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:v,children:u})})};Db.displayName=Zh;var kb="ToastViewport",i6=["F8"],lh="toast.viewportPause",ah="toast.viewportResume",Lb=T.forwardRef((t,i)=>{const{__scopeToast:a,hotkey:r=i6,label:s="Notifications ({hotkey})",...c}=t,u=$c(kb,a),h=e6(a),p=T.useRef(null),m=T.useRef(null),x=T.useRef(null),y=T.useRef(null),v=dn(i,y,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=u.toastCount>0;T.useEffect(()=>{const E=C=>{var N;r.length!==0&&r.every(A=>C[A]||C.code===A)&&((N=y.current)==null||N.focus())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[r]),T.useEffect(()=>{const E=p.current,C=y.current;if(S&&E&&C){const j=()=>{if(!u.isClosePausedRef.current){const k=new CustomEvent(lh);C.dispatchEvent(k),u.isClosePausedRef.current=!0}},N=()=>{if(u.isClosePausedRef.current){const k=new CustomEvent(ah);C.dispatchEvent(k),u.isClosePausedRef.current=!1}},A=k=>{!E.contains(k.relatedTarget)&&N()},H=()=>{E.contains(document.activeElement)||N()};return E.addEventListener("focusin",j),E.addEventListener("focusout",A),E.addEventListener("pointermove",j),E.addEventListener("pointerleave",H),window.addEventListener("blur",j),window.addEventListener("focus",N),()=>{E.removeEventListener("focusin",j),E.removeEventListener("focusout",A),E.removeEventListener("pointermove",j),E.removeEventListener("pointerleave",H),window.removeEventListener("blur",j),window.removeEventListener("focus",N)}}},[S,u.isClosePausedRef]);const _=T.useCallback(({tabbingDirection:E})=>{const j=h().map(N=>{const A=N.ref.current,H=[A,...g6(A)];return E==="forwards"?H:H.reverse()});return(E==="forwards"?j.reverse():j).flat()},[h]);return T.useEffect(()=>{const E=y.current;if(E){const C=j=>{var H,k,L;const N=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!N){const V=document.activeElement,Z=j.shiftKey;if(j.target===E&&Z){(H=m.current)==null||H.focus();return}const X=_({tabbingDirection:Z?"backwards":"forwards"}),te=X.findIndex(D=>D===V);Od(X.slice(te+1))?j.preventDefault():Z?(k=m.current)==null||k.focus():(L=x.current)==null||L.focus()}};return E.addEventListener("keydown",C),()=>E.removeEventListener("keydown",C)}},[h,_]),g.jsxs(QM,{ref:p,role:"region","aria-label":s.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&g.jsx(rh,{ref:m,onFocusFromOutsideViewport:()=>{const E=_({tabbingDirection:"forwards"});Od(E)}}),g.jsx(Qh.Slot,{scope:a,children:g.jsx(Dt.ol,{tabIndex:-1,...c,ref:v})}),S&&g.jsx(rh,{ref:x,onFocusFromOutsideViewport:()=>{const E=_({tabbingDirection:"backwards"});Od(E)}})]})});Lb.displayName=kb;var Hb="ToastFocusProxy",rh=T.forwardRef((t,i)=>{const{__scopeToast:a,onFocusFromOutsideViewport:r,...s}=t,c=$c(Hb,a);return g.jsx(Uc,{tabIndex:0,...s,ref:i,style:{position:"fixed"},onFocus:u=>{var m;const h=u.relatedTarget;!((m=c.viewport)!=null&&m.contains(h))&&r()}})});rh.displayName=Hb;var uo="Toast",l6="toast.swipeStart",a6="toast.swipeMove",r6="toast.swipeCancel",o6="toast.swipeEnd",Bb=T.forwardRef((t,i)=>{const{forceMount:a,open:r,defaultOpen:s,onOpenChange:c,...u}=t,[h,p]=Ez({prop:r,defaultProp:s??!0,onChange:c,caller:uo});return g.jsx(Bc,{present:a||h,children:g.jsx(u6,{open:h,...u,ref:i,onClose:()=>p(!1),onPause:Gi(t.onPause),onResume:Gi(t.onResume),onSwipeStart:dt(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:dt(t.onSwipeMove,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:dt(t.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:dt(t.onSwipeEnd,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),p(!1)})})})});Bb.displayName=uo;var[s6,c6]=Ob(uo,{onClose(){}}),u6=T.forwardRef((t,i)=>{const{__scopeToast:a,type:r="foreground",duration:s,open:c,onClose:u,onEscapeKeyDown:h,onPause:p,onResume:m,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:v,onSwipeEnd:w,...S}=t,_=$c(uo,a),[E,C]=T.useState(null),j=dn(i,D=>C(D)),N=T.useRef(null),A=T.useRef(null),H=s||_.duration,k=T.useRef(0),L=T.useRef(H),V=T.useRef(0),{onToastAdd:Z,onToastRemove:le}=_,Q=Gi(()=>{var G;(E==null?void 0:E.contains(document.activeElement))&&((G=_.viewport)==null||G.focus()),u()}),X=T.useCallback(D=>{!D||D===1/0||(window.clearTimeout(V.current),k.current=new Date().getTime(),V.current=window.setTimeout(Q,D))},[Q]);T.useEffect(()=>{const D=_.viewport;if(D){const G=()=>{X(L.current),m==null||m()},z=()=>{const B=new Date().getTime()-k.current;L.current=L.current-B,window.clearTimeout(V.current),p==null||p()};return D.addEventListener(lh,z),D.addEventListener(ah,G),()=>{D.removeEventListener(lh,z),D.removeEventListener(ah,G)}}},[_.viewport,H,p,m,X]),T.useEffect(()=>{c&&!_.isClosePausedRef.current&&X(H)},[c,H,_.isClosePausedRef,X]),T.useEffect(()=>(Z(),()=>le()),[Z,le]);const te=T.useMemo(()=>E?Gb(E):null,[E]);return _.viewport?g.jsxs(g.Fragment,{children:[te&&g.jsx(f6,{__scopeToast:a,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:te}),g.jsx(s6,{scope:a,onClose:Q,children:Tc.createPortal(g.jsx(Qh.ItemSlot,{scope:a,children:g.jsx(ZM,{asChild:!0,onEscapeKeyDown:dt(h,()=>{_.isFocusedToastEscapeKeyDownRef.current||Q(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:g.jsx(Dt.li,{tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":_.swipeDirection,...S,ref:j,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:dt(t.onKeyDown,D=>{D.key==="Escape"&&(h==null||h(D.nativeEvent),D.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,Q()))}),onPointerDown:dt(t.onPointerDown,D=>{D.button===0&&(N.current={x:D.clientX,y:D.clientY})}),onPointerMove:dt(t.onPointerMove,D=>{if(!N.current)return;const G=D.clientX-N.current.x,z=D.clientY-N.current.y,B=!!A.current,O=["left","right"].includes(_.swipeDirection),$=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,J=O?$(0,G):0,R=O?0:$(0,z),Y=D.pointerType==="touch"?10:2,P={x:J,y:R},ee={originalEvent:D,delta:P};B?(A.current=P,Ks(a6,y,ee,{discrete:!1})):_x(P,_.swipeDirection,Y)?(A.current=P,Ks(l6,x,ee,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(G)>Y||Math.abs(z)>Y)&&(N.current=null)}),onPointerUp:dt(t.onPointerUp,D=>{const G=A.current,z=D.target;if(z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),A.current=null,N.current=null,G){const B=D.currentTarget,O={originalEvent:D,delta:G};_x(G,_.swipeDirection,_.swipeThreshold)?Ks(o6,w,O,{discrete:!0}):Ks(r6,v,O,{discrete:!0}),B.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),f6=t=>{const{__scopeToast:i,children:a,...r}=t,s=$c(uo,i),[c,u]=T.useState(!1),[h,p]=T.useState(!1);return m6(()=>u(!0)),T.useEffect(()=>{const m=window.setTimeout(()=>p(!0),1e3);return()=>window.clearTimeout(m)},[]),h?null:g.jsx(qh,{asChild:!0,children:g.jsx(Uc,{...r,children:c&&g.jsxs(g.Fragment,{children:[s.label," ",a]})})})},d6="ToastTitle",Ub=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t;return g.jsx(Dt.div,{...r,ref:i})});Ub.displayName=d6;var h6="ToastDescription",Vb=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t;return g.jsx(Dt.div,{...r,ref:i})});Vb.displayName=h6;var $b="ToastAction",Yb=T.forwardRef((t,i)=>{const{altText:a,...r}=t;return a.trim()?g.jsx(Xb,{altText:a,asChild:!0,children:g.jsx(Kh,{...r,ref:i})}):(console.error(`Invalid prop \`altText\` supplied to \`${$b}\`. Expected non-empty \`string\`.`),null)});Yb.displayName=$b;var qb="ToastClose",Kh=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t,s=c6(qb,a);return g.jsx(Xb,{asChild:!0,children:g.jsx(Dt.button,{type:"button",...r,ref:i,onClick:dt(t.onClick,s.onClose)})})});Kh.displayName=qb;var Xb=T.forwardRef((t,i)=>{const{__scopeToast:a,altText:r,...s}=t;return g.jsx(Dt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:i})});function Gb(t){const i=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&i.push(r.textContent),p6(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",c=r.dataset.radixToastAnnounceExclude==="";if(!s)if(c){const u=r.dataset.radixToastAnnounceAlt;u&&i.push(u)}else i.push(...Gb(r))}}),i}function Ks(t,i,a,{discrete:r}){const s=a.originalEvent.currentTarget,c=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:a});i&&s.addEventListener(t,i,{once:!0}),r?J1(s,c):s.dispatchEvent(c)}var _x=(t,i,a=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),c=r>s;return i==="left"||i==="right"?c&&r>a:!c&&s>a};function m6(t=()=>{}){const i=Gi(t);Zi(()=>{let a=0,r=0;return a=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(i)),()=>{window.cancelAnimationFrame(a),window.cancelAnimationFrame(r)}},[i])}function p6(t){return t.nodeType===t.ELEMENT_NODE}function g6(t){const i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)i.push(a.currentNode);return i}function Od(t){const i=document.activeElement;return t.some(a=>a===i?!0:(a.focus(),document.activeElement!==i))}var y6=Db,Zb=Lb,Qb=Bb,Kb=Ub,Pb=Vb,Fb=Yb,Ib=Kh;const x6=y6,Jb=T.forwardRef(({className:t,...i},a)=>g.jsx(Zb,{ref:a,className:Ne("fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:flex-col md:max-w-[420px]",t),...i}));Jb.displayName=Zb.displayName;const v6=I1("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-xl border p-4 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full",{variants:{variant:{default:"border-border/50 bg-zinc-900/95 text-foreground backdrop-blur-sm",success:"border-emerald-500/30 bg-emerald-950/95 text-emerald-50 backdrop-blur-sm",error:"border-red-500/30 bg-red-950/95 text-red-50 backdrop-blur-sm",info:"border-blue-500/30 bg-blue-950/95 text-blue-50 backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),Wb=T.forwardRef(({className:t,variant:i,...a},r)=>g.jsx(Qb,{ref:r,className:Ne(v6({variant:i}),t),...a}));Wb.displayName=Qb.displayName;const b6=T.forwardRef(({className:t,...i},a)=>g.jsx(Fb,{ref:a,className:Ne("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",t),...i}));b6.displayName=Fb.displayName;const e2=T.forwardRef(({className:t,...i},a)=>g.jsx(Ib,{ref:a,className:Ne("absolute right-3 top-3 rounded-md p-1.5 cursor-pointer","text-foreground/40 hover:text-foreground hover:bg-white/10","transition-all duration-150","focus:outline-none focus:ring-2 focus:ring-white/20",t),"toast-close":"",...i,children:g.jsx(dh,{className:"h-4 w-4"})}));e2.displayName=Ib.displayName;const t2=T.forwardRef(({className:t,...i},a)=>g.jsx(Kb,{ref:a,className:Ne("text-sm font-semibold",t),...i}));t2.displayName=Kb.displayName;const n2=T.forwardRef(({className:t,...i},a)=>g.jsx(Pb,{ref:a,className:Ne("text-sm opacity-90",t),...i}));n2.displayName=Pb.displayName;const w6=({variant:t})=>{switch(t){case"success":return g.jsx(jE,{className:"h-5 w-5 text-emerald-400"});case"error":return g.jsx(Jx,{className:"h-5 w-5 text-red-400"});case"info":return g.jsx(iv,{className:"h-5 w-5 text-blue-400"});default:return null}};function Cx(){const{toasts:t,removeToast:i}=Mx();return g.jsxs(x6,{swipeDirection:"right",children:[t.map(a=>g.jsxs(Wb,{variant:a.variant,duration:a.duration??4e3,onOpenChange:r=>{r||i(a.id)},children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(w6,{variant:a.variant}),g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx(t2,{children:a.title}),a.description&&g.jsx(n2,{children:a.description})]})]}),g.jsx(e2,{})]},a.id)),g.jsx(Jb,{})]})}function S6(){const{completed:t}=Xr();return t?g.jsxs(Ex,{children:[g.jsx(BN,{children:i=>{switch(i){case"architecture":return g.jsx(ax,{});case"files":return g.jsx(t_,{});case"security":return g.jsx(NM,{});default:return g.jsx(ax,{})}}}),g.jsx(Cx,{})]}):g.jsxs(Ex,{children:[g.jsx(CM,{}),g.jsx(Cx,{})]})}ph(mh.getState().theme);window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{mh.getState().theme==="system"&&ph("system")});yS.createRoot(document.getElementById("root")).render(g.jsx(T.StrictMode,{children:g.jsx(S6,{})}));
|
|
351
|
+
M${V.x},${V.y}h${V.width}v${V.height}h${-V.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}K1.displayName="MiniMap";T.memo(K1);const aM=t=>i=>t?`${Math.max(1/i.transform[2],1)}`:void 0,rM={[Oa.Line]:"right",[Oa.Handle]:"bottom-right"};function oM({nodeId:t,position:i,variant:a=Oa.Handle,className:r,style:s=void 0,children:c,color:u,minWidth:h=10,minHeight:p=10,maxWidth:m=Number.MAX_VALUE,maxHeight:x=Number.MAX_VALUE,keepAspectRatio:y=!1,resizeDirection:v,autoScale:w=!0,shouldResize:S,onResizeStart:_,onResize:E,onResizeEnd:C}){const j=C1(),N=typeof t=="string"?t:j,A=Ie(),H=T.useRef(null),k=a===Oa.Handle,L=Le(T.useCallback(aM(k&&w),[k,w]),Fe),V=T.useRef(null),Z=i??rM[a];T.useEffect(()=>{if(!(!H.current||!N))return V.current||(V.current=O3({domNode:H.current,nodeId:N,getStoreItems:()=>{const{nodeLookup:Q,transform:X,snapGrid:te,snapToGrid:D,nodeOrigin:G,domNode:z}=A.getState();return{nodeLookup:Q,transform:X,snapGrid:te,snapToGrid:D,nodeOrigin:G,paneDomNode:z}},onChange:(Q,X)=>{const{triggerNodeChanges:te,nodeLookup:D,parentLookup:G,nodeOrigin:z}=A.getState(),B=[],O={x:Q.x,y:Q.y},$=D.get(N);if($&&$.expandParent&&$.parentId){const J=$.origin??z,R=Q.width??$.measured.width??0,Y=Q.height??$.measured.height??0,P={id:$.id,parentId:$.parentId,rect:{width:R,height:Y,...Iv({x:Q.x??$.position.x,y:Q.y??$.position.y},{width:R,height:Y},$.parentId,D,J)}},ee=Rh([P],D,G,z);B.push(...ee),O.x=Q.x?Math.max(J[0]*R,Q.x):void 0,O.y=Q.y?Math.max(J[1]*Y,Q.y):void 0}if(O.x!==void 0&&O.y!==void 0){const J={id:N,type:"position",position:{...O}};B.push(J)}if(Q.width!==void 0&&Q.height!==void 0){const R={id:N,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:Q.width,height:Q.height}};B.push(R)}for(const J of X){const R={...J,type:"position"};B.push(R)}te(B)},onEnd:({width:Q,height:X})=>{const te={id:N,type:"dimensions",resizing:!1,dimensions:{width:Q,height:X}};A.getState().triggerNodeChanges([te])}})),V.current.update({controlPosition:Z,boundaries:{minWidth:h,minHeight:p,maxWidth:m,maxHeight:x},keepAspectRatio:y,resizeDirection:v,onResizeStart:_,onResize:E,onResizeEnd:C,shouldResize:S}),()=>{var Q;(Q=V.current)==null||Q.destroy()}},[Z,h,p,m,x,y,_,E,C,S]);const le=Z.split("-");return g.jsx("div",{className:st(["react-flow__resize-control","nodrag",...le,a,r]),ref:H,style:{...s,scale:L,...u&&{[k?"backgroundColor":"borderColor"]:u}},children:c})}T.memo(oM);const wl={daily:/^\d{4}-\d{2}-\d{2}\.md$/,architecture:/_ARCHITECTURE\.md$|ARCHITECTURE.*\.md$/i,persistent:/^PERSISTENT_MEMORY\.md$/i,context:/^CONTEXT_BUILDER\.md$/i,crypto:/crypto/i,swarmLog:/\.csv$/,archive:/\.(tar\.gz|zip|gz)$/};function ti(t,i,a,r=[]){for(const s of t)s.type==="file"&&i.test(s.name)&&r.push({name:s.name,path:`${a}/${s.path}`,size:s.size}),s.children&&ti(s.children,i,a,r);return r}function P1(t){let i=0,a=0;for(const r of t)if(r.type==="file"&&(i++,a+=r.size||0),r.children){const s=P1(r.children);i+=s.files,a+=s.size}return{files:i,size:a}}function sM(t){const i=[];return Object.entries(t).forEach(([a,r])=>{if(!r)return;const{tree:s,path:c=`~/${a}`}=r,u=[],h=ti(s,wl.daily,c,[]);if(h.length>0){const E=h.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-daily`,type:"storage",label:"Daily Logs",description:`${h.length} temporal memory files`,icon:Fx,color:"var(--accent-green)",files:h.sort((C,j)=>j.name.localeCompare(C.name)).slice(0,5),totalSize:E,path:c,depth:1})}const p=ti(s,wl.architecture,c,[]);if(p.length>0){const E=p.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-architecture`,type:"storage",label:"Architecture Docs",description:`${p.length} system structure files`,icon:Kx,color:"var(--accent-blue)",files:p,totalSize:E,path:c,depth:1})}const m=ti(s,wl.persistent,c,[]),x=ti(s,wl.context,c,[]),y=[...m,...x];if(y.length>0){const E=y.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-persistent`,type:"storage",label:"Long-term Memory",description:"Persistent context & curated knowledge",icon:ev,color:"var(--accent-purple)",files:y,totalSize:E,path:c,depth:1})}const v=ti(s,wl.crypto,c,[]);if(v.length>0){const E=v.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-crypto`,type:"specialized",label:"Crypto Intelligence",description:`${v.length} specialized knowledge files`,icon:Wx,color:"var(--accent-amber)",files:v,totalSize:E,path:c,depth:2})}const w=ti(s,wl.swarmLog,c,[]);if(w.length>0){const E=w.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-telemetry`,type:"telemetry",label:"Telemetry Logs",description:`${w.length} data log files`,icon:Gx,color:"var(--accent-indigo)",files:w.slice(0,6),totalSize:E,path:c,depth:2})}const S=ti(s,wl.archive,c,[]);if(S.length>0){const E=S.reduce((C,j)=>C+(j.size||0),0);u.push({id:`${a}-archive`,type:"archive",label:"Memory Archive",description:`${S.length} compressed history files`,icon:Zx,color:"var(--accent-pink)",files:S,totalSize:E,path:c,depth:3})}const _=ti(s,/\.sh$/,c,[]);if(_.length>0&&u.push({id:`${a}-scripts`,type:"processing",label:"Automation Scripts",description:`${_.length} shell scripts`,icon:bN,color:"var(--accent-amber)",files:_,totalSize:_.reduce((E,C)=>E+(C.size||0),0),path:c,depth:0}),u.length===0&&(s.filter(E=>E.type==="directory").forEach((E,C)=>{const j=E.children?P1(E.children):{files:0,size:0};j.files>0&&u.push({id:`${a}-${E.name}`,type:"storage",label:E.name,description:`${j.files} files`,icon:Ca,color:["var(--accent-blue)","var(--accent-green)","var(--accent-amber)","var(--accent-purple)"][C%4],files:[],totalSize:j.size,path:`${c}/${E.name}`,depth:1})}),u.length===0)){const E=s.filter(C=>C.type==="file");if(E.length>0){const C=E.reduce((j,N)=>j+(N.size||0),0);u.push({id:`${a}-root`,type:"storage",label:"Root Files",description:`${E.length} files`,icon:Ca,color:"var(--accent-blue)",files:E.map(j=>({name:j.name,path:`${c}/${j.path}`,size:j.size})),totalSize:C,path:c,depth:1})}}i.push(...u)}),i.sort((a,r)=>a.depth-r.depth)}function cM({data:t}){const i=t.isExpanded??!1,a=t.fileCount!==void 0&&t.fileCount>0||t.size!==void 0&&t.size>0,r=t.IconComponent;return g.jsxs("div",{className:Ne("group relative min-w-[220px] max-w-[260px] transition-all duration-300",a&&"hover:scale-[1.02]"),children:[!t.isFirst&&g.jsx(Da,{type:"target",position:xe.Top,className:"!w-2 !h-2 !bg-muted-foreground/40 !border-border"}),g.jsx("div",{className:Ne("absolute -inset-0.5 rounded-2xl blur-sm transition-all duration-300 pointer-events-none",i?"opacity-70":"opacity-40 group-hover:opacity-60"),style:{background:`hsl(${t.color} / 0.4)`}}),g.jsxs(Xi,{className:Ne("relative overflow-hidden bg-card backdrop-blur-sm cursor-pointer transition-all duration-200",i&&"ring-1 ring-foreground/10"),style:{borderColor:i?`hsl(${t.color} / 0.6)`:`hsl(${t.color} / 0.35)`},children:[g.jsxs("div",{className:"flex items-start gap-3 p-3.5",children:[g.jsx("div",{className:"shrink-0 p-2 rounded-xl",style:{background:`linear-gradient(135deg, hsl(${t.color} / 0.2), hsl(${t.color} / 0.05))`,border:`1px solid hsl(${t.color} / 0.2)`},children:g.jsx(r,{className:"w-4 h-4",style:{color:`hsl(${t.color})`}})}),g.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[g.jsx("h3",{className:"text-[12px] font-semibold text-card-foreground tracking-tight leading-tight truncate",children:t.label}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:t.description})]})]}),(t.fileCount!==void 0||t.size!==void 0)&&g.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5 border-t bg-secondary/30",style:{borderColor:`hsl(${t.color} / 0.1)`},children:[t.fileCount!==void 0&&g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(fh,{className:"w-3 h-3 text-muted-foreground/60"}),g.jsx("span",{className:"text-xs font-semibold tabular-nums",style:{color:`hsl(${t.color})`},children:t.fileCount}),g.jsx("span",{className:"text-[9px] text-muted-foreground/60",children:t.fileCount===1?"file":"files"})]}),t.size!==void 0&&t.size>0&&g.jsx("span",{className:"text-[10px] text-muted-foreground font-mono tabular-nums",children:Cl(t.size)})]}),a&&g.jsx("div",{className:"absolute top-2.5 right-2.5 w-1.5 h-1.5 rounded-full",style:{backgroundColor:`hsl(${t.color})`,boxShadow:`0 0 6px hsl(${t.color})`,animation:"pulse 2s ease-in-out infinite"}})]}),!t.isLast&&g.jsx(Da,{type:"source",position:xe.Bottom,className:"!w-2 !h-2 !bg-muted-foreground/40 !border-border"})]})}const uM={layer:cM};function fM(){const[t,i]=T.useState(!1);return g.jsx("div",{className:"absolute bottom-4 left-4 z-10",children:g.jsxs("div",{className:Ne("bg-card border border-border rounded-xl backdrop-blur-sm transition-all duration-300 overflow-hidden shadow-xl",t?"w-[260px]":"w-auto"),children:[g.jsxs("button",{onClick:()=>i(!t),className:"flex items-center gap-2.5 px-4 py-3 text-xs text-muted-foreground hover:text-foreground transition-colors w-full cursor-pointer focus:outline-none",children:[g.jsx("div",{className:"p-1.5 rounded-lg bg-secondary",children:g.jsx(iv,{className:"w-3.5 h-3.5"})}),g.jsx("span",{className:"font-medium",children:"Memory Layers"}),g.jsx(Ix,{className:Ne("w-4 h-4 ml-auto text-muted-foreground/60 transition-transform duration-200",t&&"rotate-180")})]}),t&&g.jsxs("div",{className:"px-4 pb-4 space-y-2.5 text-[10px] border-t border-border pt-3",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Fx,{className:"w-3 h-3 text-emerald-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Daily logs (temporal)"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ev,{className:"w-3 h-3 text-purple-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Persistent memory"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Kx,{className:"w-3 h-3 text-blue-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Architecture docs"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Gx,{className:"w-3 h-3 text-indigo-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Swarm telemetry"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Wx,{className:"w-3 h-3 text-amber-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Specialized knowledge"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Zx,{className:"w-3 h-3 text-pink-400"}),g.jsx("span",{className:"text-muted-foreground",children:"Compressed archive"})]})]})]})})}function dM({nodeData:t,onClose:i}){if(!t)return null;const a=t.IconComponent;return g.jsx("div",{className:"absolute top-4 right-4 z-10 animate-in fade-in slide-in-from-right-2 duration-200",children:g.jsxs("div",{className:"w-[300px] bg-zinc-900/95 border rounded-2xl backdrop-blur-md shadow-xl overflow-hidden",style:{borderColor:`hsl(${t.color} / 0.4)`},children:[g.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[g.jsx("div",{className:"p-2 rounded-xl",style:{background:`linear-gradient(135deg, hsl(${t.color} / 0.2), hsl(${t.color} / 0.05))`,border:`1px solid hsl(${t.color} / 0.25)`},children:g.jsx(a,{className:"w-4 h-4",style:{color:`hsl(${t.color})`}})}),g.jsx("h3",{className:"flex-1 text-[14px] font-semibold text-card-foreground",children:t.label}),g.jsx("button",{onClick:i,className:"p-1.5 -mr-1 rounded-lg text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors cursor-pointer",children:g.jsx(dh,{className:"w-4 h-4"})})]}),g.jsxs("div",{className:"px-4 pb-4 space-y-3",children:[g.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed",children:t.description}),t.path&&g.jsxs("div",{className:"p-2.5 rounded-lg bg-secondary/50 border border-border/50",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Path"}),g.jsx("p",{className:"text-[11px] font-mono text-foreground mt-0.5 truncate",children:t.path})]}),t.files&&t.files.length>0&&g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Files"}),g.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:t.files.map((r,s)=>g.jsxs("div",{className:"flex items-center justify-between p-1.5 rounded bg-secondary/30 border border-border/30",children:[g.jsx("span",{className:"text-[10px] font-mono text-foreground truncate flex-1",children:r.name}),r.size&&g.jsx("span",{className:"text-[9px] text-muted-foreground ml-2 shrink-0",children:Cl(r.size)})]},s))})]}),t.fileCount!==void 0&&t.fileCount>0&&g.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-lg bg-secondary/50 border border-border/50",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Files"}),g.jsx("p",{className:"text-sm font-semibold text-foreground",children:t.fileCount})]}),t.size!==void 0&&t.size>0&&g.jsxs("div",{className:"text-right",children:[g.jsx("span",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"Size"}),g.jsx("p",{className:"text-sm font-mono text-foreground",children:Cl(t.size)})]})]})]})]})})}function hM(){return g.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:g.jsxs("div",{className:"text-center max-w-md",children:[g.jsx("div",{className:"mx-auto w-16 h-16 rounded-2xl bg-muted/50 border border-border flex items-center justify-center mb-6",children:g.jsx(Ca,{className:"w-8 h-8 text-muted-foreground/60"})}),g.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"No files found"}),g.jsx("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:"Configure a memory source path in Settings to visualize your memory architecture."}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"The app auto-discovers .md files, logs, archives, and scripts."})]})})}function ax(){const{data:t,loading:i}=ov(),[a,r]=T.useState(null),s=T.useMemo(()=>t?sM(t):[],[t]),c=s.length>0,u=T.useCallback((w,S)=>{r(_=>_===S.id?null:S.id)},[]),h=T.useCallback(()=>{r(null)},[]),{nodes:p,edges:m}=T.useMemo(()=>{const w=[],S=[],_={};s.forEach(H=>{const k=H.depth;_[k]||(_[k]=[]),_[k].push(H)});const E=Object.keys(_).map(Number).sort((H,k)=>H-k),C=250,j=160;let N=0;w.push({id:"input",type:"layer",position:{x:400,y:N},data:{label:"User Input",description:"Query triggers memory retrieval",color:"var(--accent-indigo)",IconComponent:lN,isFirst:!0,isExpanded:a==="input"}}),N+=j;let A=["input"];return E.forEach(H=>{const k=_[H],L=400-(k.length-1)*C/2,V=[];k.forEach((Z,le)=>{const Q=L+le*C,X=Z.id;V.push(X),w.push({id:X,type:"layer",position:{x:Q,y:N},data:{label:Z.label,description:Z.description,color:Z.color,IconComponent:Z.icon,fileCount:Z.files.length,size:Z.totalSize,path:Z.path,files:Z.files.slice(0,6),isExpanded:a===X,layerType:Z.type}}),A.forEach(te=>{S.push({id:`e-${te}-${X}`,source:te,target:X,animated:!0,style:{stroke:"url(#edge-gradient)",strokeWidth:1.5}})})}),A=V,N+=j}),w.push({id:"output",type:"layer",position:{x:400,y:N},data:{label:"Response",description:"Context-enriched output",color:"var(--accent-pink)",IconComponent:jN,isLast:!0,isExpanded:a==="output"}}),A.forEach(H=>{S.push({id:`e-${H}-output`,source:H,target:"output",animated:!0,style:{stroke:"url(#edge-gradient)",strokeWidth:1.5}})}),{nodes:w,edges:S}},[s,a]),x=T.useMemo(()=>{if(!a)return null;const w=p.find(S=>S.id===a);return(w==null?void 0:w.data)??null},[a,p]);if(!i&&!c)return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30",children:g.jsx(kd,{className:"w-5 h-5 text-violet-400"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Memory Architecture"}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Visualize your memory structure"})]})]})}),g.jsx(hM,{})]});const y=s.reduce((w,S)=>w+S.files.length,0),v=s.reduce((w,S)=>w+S.totalSize,0);return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30",children:g.jsx(kd,{className:"w-5 h-5 text-violet-400"})}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Memory Architecture"}),g.jsxs("p",{className:"text-xs text-muted-foreground/70",children:[s.length," layers · ",y," files · ",Cl(v)]})]})]}),g.jsx("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground/60",children:g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(EN,{className:"w-3 h-3"}),g.jsxs("span",{children:["Depth: ",Math.max(...s.map(w=>w.depth))+1]})]})})]}),g.jsxs("div",{className:"flex-1 relative",children:[g.jsx("svg",{style:{position:"absolute",width:0,height:0},children:g.jsx("defs",{children:g.jsxs("linearGradient",{id:"edge-gradient",gradientUnits:"userSpaceOnUse",x1:"0",y1:"0",x2:"0",y2:"1000",children:[g.jsx("stop",{offset:"0%",stopColor:"#6366f1",stopOpacity:"0.5"}),g.jsx("stop",{offset:"50%",stopColor:"#a855f7",stopOpacity:"0.3"}),g.jsx("stop",{offset:"100%",stopColor:"#ec4899",stopOpacity:"0.5"})]})})}),g.jsx(kA,{nodes:p,edges:m,nodeTypes:uM,onNodeClick:u,onPaneClick:h,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!0},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,panOnDrag:!0,zoomOnScroll:!0,preventScrolling:!1,minZoom:.4,maxZoom:1.5,children:g.jsx(VA,{color:"hsl(var(--muted-foreground))",gap:32,size:1,style:{opacity:.08}})}),g.jsx(fM,{}),g.jsx(dM,{nodeData:x,onClose:()=>r(null)})]})]})}function rx(t,i){if(typeof t=="function")return t(i);t!=null&&(t.current=i)}function Rc(...t){return i=>{let a=!1;const r=t.map(s=>{const c=rx(s,i);return!a&&typeof c=="function"&&(a=!0),c});if(a)return()=>{for(let s=0;s<r.length;s++){const c=r[s];typeof c=="function"?c():rx(t[s],null)}}}}function dn(...t){return T.useCallback(Rc(...t),t)}var mM=Symbol.for("react.lazy"),hc=Tx[" use ".trim().toString()];function pM(t){return typeof t=="object"&&t!==null&&"then"in t}function F1(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===mM&&"_payload"in t&&pM(t._payload)}function gM(t){const i=xM(t),a=T.forwardRef((r,s)=>{let{children:c,...u}=r;F1(c)&&typeof hc=="function"&&(c=hc(c._payload));const h=T.Children.toArray(c),p=h.find(bM);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}var yM=gM("Slot");function xM(t){const i=T.forwardRef((a,r)=>{let{children:s,...c}=a;if(F1(s)&&typeof hc=="function"&&(s=hc(s._payload)),T.isValidElement(s)){const u=SM(s),h=wM(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var vM=Symbol("radix.slottable");function bM(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===vM}function wM(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function SM(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}const ox=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,sx=zx,I1=(t,i)=>a=>{var r;if((i==null?void 0:i.variants)==null)return sx(t,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:s,defaultVariants:c}=i,u=Object.keys(s).map(m=>{const x=a==null?void 0:a[m],y=c==null?void 0:c[m];if(x===null)return null;const v=ox(x)||ox(y);return s[m][v]}),h=a&&Object.entries(a).reduce((m,x)=>{let[y,v]=x;return v===void 0||(m[y]=v),m},{}),p=i==null||(r=i.compoundVariants)===null||r===void 0?void 0:r.reduce((m,x)=>{let{class:y,className:v,...w}=x;return Object.entries(w).every(S=>{let[_,E]=S;return Array.isArray(E)?E.includes({...c,...h}[_]):{...c,...h}[_]===E})?[...m,y,v]:m},[]);return sx(t,u,p,a==null?void 0:a.class,a==null?void 0:a.className)},EM=I1("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium cursor-pointer transition-all duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-md hover:bg-primary/90 hover:shadow-lg hover:-translate-y-0.5",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-md",outline:"border border-border bg-background shadow-sm hover:bg-secondary hover:text-foreground hover:border-foreground/20",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 hover:shadow-md",ghost:"hover:bg-accent/80 hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",glow:"bg-violet-600 text-white hover:bg-violet-500 transition-colors"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-11 rounded-xl px-8 text-base",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),ni=T.forwardRef(({className:t,variant:i,size:a,asChild:r=!1,...s},c)=>{const u=r?yM:"button";return g.jsx(u,{className:Ne(EM({variant:i,size:a,className:t})),ref:c,...s})});ni.displayName="Button";function NM(){const{entries:t,isPaused:i,togglePause:a,clearLog:r}=gh(),{sources:s,toggleSource:c,resetOnboarding:u}=Xr(),[h,p]=T.useState(!1),m=h?t:t.slice(0,20),x=s.filter(v=>v.enabled),y=()=>{const v=UN(t),w=new Blob([v],{type:"text/csv"}),S=URL.createObjectURL(w),_=document.createElement("a");_.href=S,_.download=`openclaw-memory-mapper-audit-${new Date().toISOString().split("T")[0]}.csv`,_.click(),URL.revokeObjectURL(S)};return g.jsxs("div",{className:"h-full flex flex-col",children:[g.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border/50",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx($r,{className:"w-5 h-5 text-emerald-400"}),g.jsxs("div",{children:[g.jsx("h1",{className:"text-sm font-semibold text-foreground",children:"Security & Privacy"}),g.jsx("p",{className:"text-xs text-muted-foreground/70",children:"Monitor all file access activity"})]})]}),g.jsx(ni,{variant:i?"glow":"outline",size:"sm",onClick:a,className:Ne(i?"bg-red-500/20 border-red-500/30 text-red-400 hover:bg-red-500/30":"hover:bg-primary/10 hover:border-primary/30 hover:text-primary"),children:i?g.jsxs(g.Fragment,{children:[g.jsx(Pg,{className:"w-4 h-4 mr-1"}),"Paused - Resume"]}):g.jsxs(g.Fragment,{children:[g.jsx($r,{className:"w-4 h-4 mr-1"}),"Pause All Access"]})})]}),g.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-6",children:[g.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[g.jsx(Ad,{icon:CN,title:"Network Status",status:"Local Only",description:"localhost:3001",variant:"success"}),g.jsx(Ad,{icon:ch,title:"Access Mode",status:"Read-Only",description:"Files are never modified",variant:"success"}),g.jsx(Ad,{icon:mN,title:"Data Storage",status:"Local Only",description:"Nothing uploaded",variant:"success"})]}),g.jsxs(Xi,{className:"p-5 bg-card",children:[g.jsx("div",{className:"flex items-center justify-between mb-4",children:g.jsxs("h2",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[g.jsx(lv,{className:"w-4 h-4 text-muted-foreground"}),"Active Permissions"]})}),g.jsx("div",{className:"space-y-2",children:s.map(v=>g.jsxs("div",{className:Ne("flex items-center justify-between p-3 rounded-lg border transition-colors",v.enabled?"bg-emerald-500/5 border-emerald-500/20":"bg-secondary/50 border-border"),children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Ca,{className:Ne("w-4 h-4",v.enabled?"text-emerald-500":"text-muted-foreground")}),g.jsxs("div",{children:[g.jsx("span",{className:"text-sm font-mono text-foreground",children:v.path}),g.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:"READ-ONLY"})]})]}),g.jsx(ni,{variant:"ghost",size:"sm",onClick:()=>c(v.id),className:Ne("text-xs",v.enabled?"text-red-500 hover:text-red-600 hover:bg-red-500/10":"text-emerald-500 hover:text-emerald-600 hover:bg-emerald-500/10"),children:v.enabled?"Revoke":"Grant"})]},v.id))}),x.length===0&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-red-500/10 border border-red-500/20",children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(Pg,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),g.jsxs("div",{children:[g.jsx("p",{className:"text-sm font-medium text-red-400 mb-1",children:"All Access Disabled"}),g.jsx("p",{className:"text-xs text-red-400/70 mb-3",children:i?"Access is paused and all permissions are revoked. The app cannot function.":"All permissions revoked. The app cannot access any files."}),g.jsx(ni,{variant:"outline",size:"sm",onClick:()=>u(),className:"text-red-400 border-red-500/30 hover:bg-red-500/10",children:"Reconfigure Sources"})]})]})})]}),g.jsxs(Xi,{className:"p-5 bg-card",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("h2",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[g.jsx(tv,{className:"w-4 h-4 text-muted-foreground"}),"Activity Log",g.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",t.length," entries)"]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs(ni,{variant:"ghost",size:"sm",onClick:y,disabled:t.length===0,className:"text-xs",children:[g.jsx(DE,{className:"w-3.5 h-3.5 mr-1"}),"Export CSV"]}),g.jsxs(ni,{variant:"ghost",size:"sm",onClick:r,disabled:t.length===0,className:"text-xs text-red-400 hover:text-red-300 hover:bg-red-500/10",children:[g.jsx(av,{className:"w-3.5 h-3.5 mr-1"}),"Clear"]})]})]}),i&&g.jsx("div",{className:"mb-4 p-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:g.jsxs("p",{className:"text-sm text-amber-400 flex items-center gap-2",children:[g.jsx(LE,{className:"w-4 h-4"}),"Logging paused. File access is disabled."]})}),t.length===0?g.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No activity recorded yet. Browse files to see access logs."}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"space-y-1 max-h-[400px] overflow-auto",children:m.map(v=>g.jsx(_M,{entry:v},v.id))}),t.length>20&&g.jsx(ni,{variant:"ghost",size:"sm",onClick:()=>p(!h),className:"w-full mt-3 text-xs",children:h?"Show less":`Show all ${t.length} entries`})]})]}),g.jsxs("div",{className:"p-4 rounded-xl bg-secondary/50 border border-border",children:[g.jsxs("h3",{className:"text-sm font-medium text-foreground mb-2 flex items-center gap-2",children:[g.jsx($r,{className:"w-4 h-4 text-emerald-400"}),"Security Guarantees"]}),g.jsxs("ul",{className:"space-y-1.5 text-xs text-muted-foreground",children:[g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"All data stays on your machine. Nothing is ever uploaded or transmitted."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"Read-only access. Files are never created, modified, or deleted."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"No analytics, telemetry, or tracking of any kind."})]}),g.jsxs("li",{className:"flex items-start gap-2",children:[g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 mt-0.5 shrink-0"}),g.jsx("span",{children:"Open source. Audit the code yourself on GitHub."})]})]})]})]})]})}function Ad({icon:t,title:i,status:a,description:r,variant:s}){const c={success:"border-emerald-500/20 bg-emerald-500/5",warning:"border-amber-500/20 bg-amber-500/5",error:"border-red-500/20 bg-red-500/5"},u={success:"text-emerald-400",warning:"text-amber-400",error:"text-red-400"};return g.jsx(Xi,{className:Ne("p-4",c[s]),children:g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx("div",{className:"p-2 rounded-lg bg-secondary/50",children:g.jsx(t,{className:Ne("w-4 h-4",u[s])})}),g.jsxs("div",{children:[g.jsx("p",{className:"text-xs text-muted-foreground",children:i}),g.jsx("p",{className:Ne("text-sm font-medium",u[s]),children:a}),g.jsx("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:r})]})]})})}function _M({entry:t}){const i=new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),a={READ:"text-blue-500 dark:text-blue-400 bg-blue-500/10",LIST:"text-amber-500 dark:text-amber-400 bg-amber-500/10",STAT:"text-muted-foreground bg-secondary/50"};return g.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-secondary/50 transition-colors text-xs",children:[g.jsx("span",{className:"text-muted-foreground/50 font-mono w-20 shrink-0",children:i}),g.jsx("span",{className:Ne("px-1.5 py-0.5 rounded text-[10px] font-medium uppercase w-12 text-center shrink-0",a[t.type]),children:t.type}),g.jsx("span",{className:"font-mono text-muted-foreground truncate flex-1",children:t.path}),t.success?g.jsx(ii,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}):g.jsx(dh,{className:"w-3.5 h-3.5 text-red-400 shrink-0"})]})}function CM(){const[t,i]=T.useState(0),{sources:a,setSources:r,toggleSource:s,updateSourcePath:c,completeOnboarding:u,addSource:h,removeSource:p}=Xr(),[m,x]=T.useState(!1),y=T.useCallback(async()=>{x(!0);try{const j=Xr.getState().sources,N=await Promise.all(j.map(async A=>{try{const H=await fetch(`/api/check-path?path=${encodeURIComponent(A.path)}`);if(H.ok){const k=await H.json();return{...A,detected:k.exists,name:k.exists?k.expandedPath:A.name}}}catch{}return{...A,detected:!1}}));r(N)}catch{}x(!1)},[r]),v=j=>{i(j),j===1&&setTimeout(y,0)},w=a.filter(j=>j.enabled&&j.detected),S=[{title:"Welcome",component:g.jsx(TM,{})},{title:"Configure",component:g.jsx(AM,{sources:a,onToggle:s,onUpdatePath:c,detecting:m,onRedetect:y,onAddSource:h,onRemoveSource:p})},{title:"Review",component:g.jsx(jM,{sources:w})}],_=t===0||t===1&&w.length>0||t===2,E=()=>{t<S.length-1?v(t+1):u()},C=()=>{t>0&&v(t-1)};return g.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-8",children:g.jsxs("div",{className:"w-full max-w-lg",children:[g.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:S.map((j,N)=>g.jsxs("div",{className:"flex items-center",children:[g.jsx("div",{className:Ne("w-8 h-8 rounded-full flex items-center justify-center text-xs font-medium transition-all",N<t&&"bg-emerald-500/20 text-emerald-400",N===t&&"bg-violet-500/20 text-violet-400 ring-2 ring-violet-500/50",N>t&&"bg-secondary text-muted-foreground"),children:N<t?g.jsx(ii,{className:"w-4 h-4"}):N+1}),N<S.length-1&&g.jsx("div",{className:Ne("w-12 h-0.5 mx-2 transition-colors",N<t?"bg-emerald-500/50":"bg-secondary")})]},N))}),g.jsxs(Xi,{className:"p-8 bg-card border-border",children:[S[t].component,g.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-border",children:[g.jsxs(ni,{variant:"ghost",onClick:C,disabled:t===0,className:Ne(t===0&&"invisible"),children:[g.jsx(_E,{className:"w-4 h-4 mr-1"}),"Back"]}),g.jsx(ni,{variant:"glow",onClick:E,disabled:!_,children:t===S.length-1?"Get Started":"Continue"})]})]}),g.jsxs("p",{className:"text-center text-xs text-zinc-600 mt-6",children:["OpenClaw Memory Mapper v","1.1.0"," · Open Source"]})]})})}function TM(){return g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"inline-flex p-4 rounded-2xl bg-gradient-to-br from-violet-500/20 to-purple-600/20 border border-violet-500/30 mb-6",children:g.jsx(Px,{className:"w-10 h-10 text-violet-400"})}),g.jsx("h1",{className:"text-2xl font-semibold text-foreground mb-2",children:"Welcome to Memory Mapper"}),g.jsx("p",{className:"text-muted-foreground mb-8",children:"Visualize your Claude agent's memory architecture"}),g.jsxs("div",{className:"grid gap-4 text-left",children:[g.jsx(Md,{icon:$r,title:"100% Local",description:"All data stays on your machine. Nothing is ever uploaded.",color:"emerald"}),g.jsx(Md,{icon:ch,title:"Read-Only",description:"We only read files. Your memory data is never modified.",color:"blue"}),g.jsx(Md,{icon:rv,title:"No Telemetry",description:"Zero tracking, analytics, or external connections.",color:"amber"})]})]})}function Md({icon:t,title:i,description:a,color:r}){const s={emerald:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",blue:"bg-blue-500/10 text-blue-400 border-blue-500/20",amber:"bg-amber-500/10 text-amber-400 border-amber-500/20"};return g.jsxs("div",{className:"flex items-start gap-4 p-4 rounded-xl bg-secondary/30 border border-border",children:[g.jsx("div",{className:Ne("p-2 rounded-lg border",s[r]),children:g.jsx(t,{className:"w-4 h-4"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-medium text-foreground",children:i}),g.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:a})]})]})}function AM({sources:t,onToggle:i,onUpdatePath:a,detecting:r,onRedetect:s,onAddSource:c,onRemoveSource:u}){const[h,p]=T.useState(null),m=()=>{const x=c();p(x)};return g.jsxs("div",{children:[g.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Configure Sources"}),g.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Select which memory directories to visualize. Click paths to edit."}),g.jsx("div",{className:"space-y-3",children:t.map(x=>g.jsx(MM,{source:x,onToggle:()=>i(x.id),onUpdatePath:y=>{a(x.id,y),setTimeout(s,10)},onRemove:()=>u(x.id),detecting:r,isEditing:h===x.id,onStartEdit:()=>p(x.id),onEndEdit:()=>p(null),canRemove:t.length>1},x.id))}),g.jsxs("button",{onClick:m,className:"mt-3 w-full flex items-center justify-center gap-2 p-3 rounded-xl border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-violet-500/50 transition-colors",children:[g.jsx(uN,{className:"w-4 h-4"}),g.jsx("span",{className:"text-sm",children:"Add custom path"})]}),r&&g.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-2",children:[g.jsx("div",{className:"w-3 h-3 border-2 border-violet-400 border-t-transparent rounded-full animate-spin"}),"Detecting memory directories..."]}),!r&&t.length===0&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-blue-500/10 border border-blue-500/20",children:g.jsx("p",{className:"text-sm text-blue-400",children:'Click "Add custom path" to add your memory folder (e.g., ~/my-memory).'})}),!r&&t.length>0&&t.every(x=>!x.detected)&&g.jsx("div",{className:"mt-4 p-4 rounded-xl bg-amber-500/10 border border-amber-500/20",children:g.jsx("p",{className:"text-sm text-amber-400",children:"No paths found. Click the path text to edit, or make sure the API server is running."})})]})}function MM({source:t,onToggle:i,onUpdatePath:a,onRemove:r,detecting:s,isEditing:c,onStartEdit:u,onEndEdit:h,canRemove:p}){const[m,x]=T.useState(t.path),y=s?uh:t.detected?KE:JE,v=()=>{a(m),h()},w=S=>{S.key==="Enter"?v():S.key==="Escape"&&(x(t.path),h())};return g.jsxs("div",{className:Ne("w-full flex items-center gap-4 p-4 rounded-xl border transition-all",t.enabled&&t.detected?"bg-violet-500/10 border-violet-500/30":"bg-secondary/30 border-border"),children:[g.jsx("button",{onClick:i,disabled:!t.detected,className:Ne("w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors cursor-pointer",t.enabled&&t.detected?"bg-violet-500 border-violet-500":"border-border",!t.detected&&"opacity-50 cursor-not-allowed"),children:t.enabled&&t.detected&&g.jsx(ii,{className:"w-3 h-3 text-white"})}),g.jsx(y,{className:Ne("w-5 h-5 shrink-0",s&&"animate-pulse text-muted-foreground",!s&&t.detected&&"text-emerald-400",!s&&!t.detected&&"text-zinc-600")}),g.jsx("div",{className:"flex-1 min-w-0",children:c?g.jsx("input",{type:"text",value:m,onChange:S=>x(S.target.value),onBlur:v,onKeyDown:w,autoFocus:!0,placeholder:"Enter path to your memory folder...",className:"w-full bg-secondary border border-border rounded-md px-2 py-1 text-sm font-mono text-foreground focus:outline-none focus:border-violet-500 placeholder:text-muted-foreground/50"}):g.jsx("button",{onClick:u,className:"font-mono text-sm text-foreground hover:text-violet-400 transition-colors cursor-pointer truncate block w-full text-left",title:"Click to edit path",children:t.path||g.jsx("span",{className:"text-muted-foreground/50",children:"Click to enter path..."})})}),!s&&!c&&g.jsx("span",{className:Ne("text-xs shrink-0",t.detected?"text-emerald-400":"text-zinc-600"),children:t.detected?"Found":"Not found"}),p&&!c&&g.jsx("button",{onClick:r,className:"p-1.5 rounded-md text-zinc-500 hover:text-red-400 hover:bg-red-500/10 transition-colors",title:"Remove source",children:g.jsx(av,{className:"w-4 h-4"})})]})}function jM({sources:t}){return g.jsxs("div",{children:[g.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Review Permissions"}),g.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Memory Mapper will have"," ",g.jsx("strong",{className:"text-foreground",children:"read-only"})," access to:"]}),g.jsx("div",{className:"space-y-3 mb-6",children:t.map(i=>g.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl bg-secondary/30 border border-border",children:[g.jsx(uh,{className:"w-5 h-5 text-violet-400"}),g.jsxs("div",{className:"flex-1",children:[g.jsx("span",{className:"font-mono text-sm text-foreground",children:i.path}),g.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Memory files, logs, and configuration"})]}),g.jsx(ii,{className:"w-4 h-4 text-emerald-400"})]},i.id))}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(jd,{icon:lv,text:"Data never leaves your machine"}),g.jsx(jd,{icon:ch,text:"Files are never modified or deleted"}),g.jsx(jd,{icon:rv,text:"No external network connections"})]})]})}function jd({icon:t,text:i}){return g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[g.jsx(t,{className:"w-3.5 h-3.5 text-emerald-500"}),g.jsx("span",{children:i})]})}function dt(t,i,{checkForDefaultPrevented:a=!0}={}){return function(s){if(t==null||t(s),a===!1||!s.defaultPrevented)return i==null?void 0:i(s)}}function Oc(t,i=[]){let a=[];function r(c,u){const h=T.createContext(u),p=a.length;a=[...a,u];const m=y=>{var C;const{scope:v,children:w,...S}=y,_=((C=v==null?void 0:v[t])==null?void 0:C[p])||h,E=T.useMemo(()=>S,Object.values(S));return g.jsx(_.Provider,{value:E,children:w})};m.displayName=c+"Provider";function x(y,v){var _;const w=((_=v==null?void 0:v[t])==null?void 0:_[p])||h,S=T.useContext(w);if(S)return S;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${c}\``)}return[m,x]}const s=()=>{const c=a.map(u=>T.createContext(u));return function(h){const p=(h==null?void 0:h[t])||c;return T.useMemo(()=>({[`__scope${t}`]:{...h,[t]:p}}),[h,p])}};return s.scopeName=t,[r,zM(s,...i)]}function zM(...t){const i=t[0];if(t.length===1)return i;const a=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(c){const u=r.reduce((h,{useScope:p,scopeName:m})=>{const y=p(c)[`__scope${m}`];return{...h,...y}},{});return T.useMemo(()=>({[`__scope${i.scopeName}`]:u}),[u])}};return a.scopeName=i.scopeName,a}function RM(t){const i=OM(t),a=T.forwardRef((r,s)=>{const{children:c,...u}=r,h=T.Children.toArray(c),p=h.find(kM);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}function OM(t){const i=T.forwardRef((a,r)=>{const{children:s,...c}=a;if(T.isValidElement(s)){const u=HM(s),h=LM(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var DM=Symbol("radix.slottable");function kM(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===DM}function LM(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function HM(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var BM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dt=BM.reduce((t,i)=>{const a=RM(`Primitive.${i}`),r=T.forwardRef((s,c)=>{const{asChild:u,...h}=s,p=u?a:i;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(p,{...h,ref:c})});return r.displayName=`Primitive.${i}`,{...t,[i]:r}},{});function J1(t,i){t&&Tc.flushSync(()=>t.dispatchEvent(i))}function Gi(t){const i=T.useRef(t);return T.useEffect(()=>{i.current=t}),T.useMemo(()=>(...a)=>{var r;return(r=i.current)==null?void 0:r.call(i,...a)},[])}function UM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t);T.useEffect(()=>{const r=s=>{s.key==="Escape"&&a(s)};return i.addEventListener("keydown",r,{capture:!0}),()=>i.removeEventListener("keydown",r,{capture:!0})},[a,i])}var VM="DismissableLayer",Wd="dismissableLayer.update",$M="dismissableLayer.pointerDownOutside",YM="dismissableLayer.focusOutside",cx,W1=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kh=T.forwardRef((t,i)=>{const{disableOutsidePointerEvents:a=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:c,onInteractOutside:u,onDismiss:h,...p}=t,m=T.useContext(W1),[x,y]=T.useState(null),v=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=T.useState({}),S=dn(i,L=>y(L)),_=Array.from(m.layers),[E]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),C=_.indexOf(E),j=x?_.indexOf(x):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,A=j>=C,H=XM(L=>{const V=L.target,Z=[...m.branches].some(le=>le.contains(V));!A||Z||(s==null||s(L),u==null||u(L),L.defaultPrevented||h==null||h())},v),k=GM(L=>{const V=L.target;[...m.branches].some(le=>le.contains(V))||(c==null||c(L),u==null||u(L),L.defaultPrevented||h==null||h())},v);return UM(L=>{j===m.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&h&&(L.preventDefault(),h()))},v),T.useEffect(()=>{if(x)return a&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(cx=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),ux(),()=>{a&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=cx)}},[x,v,a,m]),T.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),ux())},[x,m]),T.useEffect(()=>{const L=()=>w({});return document.addEventListener(Wd,L),()=>document.removeEventListener(Wd,L)},[]),g.jsx(Dt.div,{...p,ref:S,style:{pointerEvents:N?A?"auto":"none":void 0,...t.style},onFocusCapture:dt(t.onFocusCapture,k.onFocusCapture),onBlurCapture:dt(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:dt(t.onPointerDownCapture,H.onPointerDownCapture)})});kh.displayName=VM;var qM="DismissableLayerBranch",eb=T.forwardRef((t,i)=>{const a=T.useContext(W1),r=T.useRef(null),s=dn(i,r);return T.useEffect(()=>{const c=r.current;if(c)return a.branches.add(c),()=>{a.branches.delete(c)}},[a.branches]),g.jsx(Dt.div,{...t,ref:s})});eb.displayName=qM;function XM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t),r=T.useRef(!1),s=T.useRef(()=>{});return T.useEffect(()=>{const c=h=>{if(h.target&&!r.current){let p=function(){tb($M,a,m,{discrete:!0})};const m={originalEvent:h};h.pointerType==="touch"?(i.removeEventListener("click",s.current),s.current=p,i.addEventListener("click",s.current,{once:!0})):p()}else i.removeEventListener("click",s.current);r.current=!1},u=window.setTimeout(()=>{i.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),i.removeEventListener("pointerdown",c),i.removeEventListener("click",s.current)}},[i,a]),{onPointerDownCapture:()=>r.current=!0}}function GM(t,i=globalThis==null?void 0:globalThis.document){const a=Gi(t),r=T.useRef(!1);return T.useEffect(()=>{const s=c=>{c.target&&!r.current&&tb(YM,a,{originalEvent:c},{discrete:!1})};return i.addEventListener("focusin",s),()=>i.removeEventListener("focusin",s)},[i,a]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ux(){const t=new CustomEvent(Wd);document.dispatchEvent(t)}function tb(t,i,a,{discrete:r}){const s=a.originalEvent.target,c=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:a});i&&s.addEventListener(t,i,{once:!0}),r?J1(s,c):s.dispatchEvent(c)}var ZM=kh,QM=eb,Zi=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{};const KM=["top","right","bottom","left"],Qi=Math.min,Xt=Math.max,mc=Math.round,Zs=Math.floor,_n=t=>({x:t,y:t}),PM={left:"right",right:"left",bottom:"top",top:"bottom"},FM={start:"end",end:"start"};function eh(t,i,a){return Xt(t,Qi(i,a))}function ri(t,i){return typeof t=="function"?t(i):t}function oi(t){return t.split("-")[0]}function Ua(t){return t.split("-")[1]}function Lh(t){return t==="x"?"y":"x"}function Hh(t){return t==="y"?"height":"width"}const IM=new Set(["top","bottom"]);function En(t){return IM.has(oi(t))?"y":"x"}function Bh(t){return Lh(En(t))}function JM(t,i,a){a===void 0&&(a=!1);const r=Ua(t),s=Bh(t),c=Hh(s);let u=s==="x"?r===(a?"end":"start")?"right":"left":r==="start"?"bottom":"top";return i.reference[c]>i.floating[c]&&(u=pc(u)),[u,pc(u)]}function WM(t){const i=pc(t);return[th(t),i,th(i)]}function th(t){return t.replace(/start|end/g,i=>FM[i])}const fx=["left","right"],dx=["right","left"],ej=["top","bottom"],tj=["bottom","top"];function nj(t,i,a){switch(t){case"top":case"bottom":return a?i?dx:fx:i?fx:dx;case"left":case"right":return i?ej:tj;default:return[]}}function ij(t,i,a,r){const s=Ua(t);let c=nj(oi(t),a==="start",r);return s&&(c=c.map(u=>u+"-"+s),i&&(c=c.concat(c.map(th)))),c}function pc(t){return t.replace(/left|right|bottom|top/g,i=>PM[i])}function lj(t){return{top:0,right:0,bottom:0,left:0,...t}}function nb(t){return typeof t!="number"?lj(t):{top:t,right:t,bottom:t,left:t}}function gc(t){const{x:i,y:a,width:r,height:s}=t;return{width:r,height:s,top:a,left:i,right:i+r,bottom:a+s,x:i,y:a}}function hx(t,i,a){let{reference:r,floating:s}=t;const c=En(i),u=Bh(i),h=Hh(u),p=oi(i),m=c==="y",x=r.x+r.width/2-s.width/2,y=r.y+r.height/2-s.height/2,v=r[h]/2-s[h]/2;let w;switch(p){case"top":w={x,y:r.y-s.height};break;case"bottom":w={x,y:r.y+r.height};break;case"right":w={x:r.x+r.width,y};break;case"left":w={x:r.x-s.width,y};break;default:w={x:r.x,y:r.y}}switch(Ua(i)){case"start":w[u]-=v*(a&&m?-1:1);break;case"end":w[u]+=v*(a&&m?-1:1);break}return w}async function aj(t,i){var a;i===void 0&&(i={});const{x:r,y:s,platform:c,rects:u,elements:h,strategy:p}=t,{boundary:m="clippingAncestors",rootBoundary:x="viewport",elementContext:y="floating",altBoundary:v=!1,padding:w=0}=ri(i,t),S=nb(w),E=h[v?y==="floating"?"reference":"floating":y],C=gc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(E)))==null||a?E:E.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(h.floating)),boundary:m,rootBoundary:x,strategy:p})),j=y==="floating"?{x:r,y:s,width:u.floating.width,height:u.floating.height}:u.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h.floating)),A=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},H=gc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:j,offsetParent:N,strategy:p}):j);return{top:(C.top-H.top+S.top)/A.y,bottom:(H.bottom-C.bottom+S.bottom)/A.y,left:(C.left-H.left+S.left)/A.x,right:(H.right-C.right+S.right)/A.x}}const rj=async(t,i,a)=>{const{placement:r="bottom",strategy:s="absolute",middleware:c=[],platform:u}=a,h=c.filter(Boolean),p=await(u.isRTL==null?void 0:u.isRTL(i));let m=await u.getElementRects({reference:t,floating:i,strategy:s}),{x,y}=hx(m,r,p),v=r,w={},S=0;for(let E=0;E<h.length;E++){var _;const{name:C,fn:j}=h[E],{x:N,y:A,data:H,reset:k}=await j({x,y,initialPlacement:r,placement:v,strategy:s,middlewareData:w,rects:m,platform:{...u,detectOverflow:(_=u.detectOverflow)!=null?_:aj},elements:{reference:t,floating:i}});x=N??x,y=A??y,w={...w,[C]:{...w[C],...H}},k&&S<=50&&(S++,typeof k=="object"&&(k.placement&&(v=k.placement),k.rects&&(m=k.rects===!0?await u.getElementRects({reference:t,floating:i,strategy:s}):k.rects),{x,y}=hx(m,v,p)),E=-1)}return{x,y,placement:v,strategy:s,middlewareData:w}},oj=t=>({name:"arrow",options:t,async fn(i){const{x:a,y:r,placement:s,rects:c,platform:u,elements:h,middlewareData:p}=i,{element:m,padding:x=0}=ri(t,i)||{};if(m==null)return{};const y=nb(x),v={x:a,y:r},w=Bh(s),S=Hh(w),_=await u.getDimensions(m),E=w==="y",C=E?"top":"left",j=E?"bottom":"right",N=E?"clientHeight":"clientWidth",A=c.reference[S]+c.reference[w]-v[w]-c.floating[S],H=v[w]-c.reference[w],k=await(u.getOffsetParent==null?void 0:u.getOffsetParent(m));let L=k?k[N]:0;(!L||!await(u.isElement==null?void 0:u.isElement(k)))&&(L=h.floating[N]||c.floating[S]);const V=A/2-H/2,Z=L/2-_[S]/2-1,le=Qi(y[C],Z),Q=Qi(y[j],Z),X=le,te=L-_[S]-Q,D=L/2-_[S]/2+V,G=eh(X,D,te),z=!p.arrow&&Ua(s)!=null&&D!==G&&c.reference[S]/2-(D<X?le:Q)-_[S]/2<0,B=z?D<X?D-X:D-te:0;return{[w]:v[w]+B,data:{[w]:G,centerOffset:D-G-B,...z&&{alignmentOffset:B}},reset:z}}}),sj=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(i){var a,r;const{placement:s,middlewareData:c,rects:u,initialPlacement:h,platform:p,elements:m}=i,{mainAxis:x=!0,crossAxis:y=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:_=!0,...E}=ri(t,i);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const C=oi(s),j=En(h),N=oi(h)===h,A=await(p.isRTL==null?void 0:p.isRTL(m.floating)),H=v||(N||!_?[pc(h)]:WM(h)),k=S!=="none";!v&&k&&H.push(...ij(h,_,S,A));const L=[h,...H],V=await p.detectOverflow(i,E),Z=[];let le=((r=c.flip)==null?void 0:r.overflows)||[];if(x&&Z.push(V[C]),y){const D=JM(s,u,A);Z.push(V[D[0]],V[D[1]])}if(le=[...le,{placement:s,overflows:Z}],!Z.every(D=>D<=0)){var Q,X;const D=(((Q=c.flip)==null?void 0:Q.index)||0)+1,G=L[D];if(G&&(!(y==="alignment"?j!==En(G):!1)||le.every(O=>En(O.placement)===j?O.overflows[0]>0:!0)))return{data:{index:D,overflows:le},reset:{placement:G}};let z=(X=le.filter(B=>B.overflows[0]<=0).sort((B,O)=>B.overflows[1]-O.overflows[1])[0])==null?void 0:X.placement;if(!z)switch(w){case"bestFit":{var te;const B=(te=le.filter(O=>{if(k){const $=En(O.placement);return $===j||$==="y"}return!0}).map(O=>[O.placement,O.overflows.filter($=>$>0).reduce(($,J)=>$+J,0)]).sort((O,$)=>O[1]-$[1])[0])==null?void 0:te[0];B&&(z=B);break}case"initialPlacement":z=h;break}if(s!==z)return{reset:{placement:z}}}return{}}}};function mx(t,i){return{top:t.top-i.height,right:t.right-i.width,bottom:t.bottom-i.height,left:t.left-i.width}}function px(t){return KM.some(i=>t[i]>=0)}const cj=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(i){const{rects:a,platform:r}=i,{strategy:s="referenceHidden",...c}=ri(t,i);switch(s){case"referenceHidden":{const u=await r.detectOverflow(i,{...c,elementContext:"reference"}),h=mx(u,a.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:px(h)}}}case"escaped":{const u=await r.detectOverflow(i,{...c,altBoundary:!0}),h=mx(u,a.floating);return{data:{escapedOffsets:h,escaped:px(h)}}}default:return{}}}}},ib=new Set(["left","top"]);async function uj(t,i){const{placement:a,platform:r,elements:s}=t,c=await(r.isRTL==null?void 0:r.isRTL(s.floating)),u=oi(a),h=Ua(a),p=En(a)==="y",m=ib.has(u)?-1:1,x=c&&p?-1:1,y=ri(i,t);let{mainAxis:v,crossAxis:w,alignmentAxis:S}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return h&&typeof S=="number"&&(w=h==="end"?S*-1:S),p?{x:w*x,y:v*m}:{x:v*m,y:w*x}}const fj=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(i){var a,r;const{x:s,y:c,placement:u,middlewareData:h}=i,p=await uj(i,t);return u===((a=h.offset)==null?void 0:a.placement)&&(r=h.arrow)!=null&&r.alignmentOffset?{}:{x:s+p.x,y:c+p.y,data:{...p,placement:u}}}}},dj=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(i){const{x:a,y:r,placement:s,platform:c}=i,{mainAxis:u=!0,crossAxis:h=!1,limiter:p={fn:C=>{let{x:j,y:N}=C;return{x:j,y:N}}},...m}=ri(t,i),x={x:a,y:r},y=await c.detectOverflow(i,m),v=En(oi(s)),w=Lh(v);let S=x[w],_=x[v];if(u){const C=w==="y"?"top":"left",j=w==="y"?"bottom":"right",N=S+y[C],A=S-y[j];S=eh(N,S,A)}if(h){const C=v==="y"?"top":"left",j=v==="y"?"bottom":"right",N=_+y[C],A=_-y[j];_=eh(N,_,A)}const E=p.fn({...i,[w]:S,[v]:_});return{...E,data:{x:E.x-a,y:E.y-r,enabled:{[w]:u,[v]:h}}}}}},hj=function(t){return t===void 0&&(t={}),{options:t,fn(i){const{x:a,y:r,placement:s,rects:c,middlewareData:u}=i,{offset:h=0,mainAxis:p=!0,crossAxis:m=!0}=ri(t,i),x={x:a,y:r},y=En(s),v=Lh(y);let w=x[v],S=x[y];const _=ri(h,i),E=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(p){const N=v==="y"?"height":"width",A=c.reference[v]-c.floating[N]+E.mainAxis,H=c.reference[v]+c.reference[N]-E.mainAxis;w<A?w=A:w>H&&(w=H)}if(m){var C,j;const N=v==="y"?"width":"height",A=ib.has(oi(s)),H=c.reference[y]-c.floating[N]+(A&&((C=u.offset)==null?void 0:C[y])||0)+(A?0:E.crossAxis),k=c.reference[y]+c.reference[N]+(A?0:((j=u.offset)==null?void 0:j[y])||0)-(A?E.crossAxis:0);S<H?S=H:S>k&&(S=k)}return{[v]:w,[y]:S}}}},mj=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(i){var a,r;const{placement:s,rects:c,platform:u,elements:h}=i,{apply:p=()=>{},...m}=ri(t,i),x=await u.detectOverflow(i,m),y=oi(s),v=Ua(s),w=En(s)==="y",{width:S,height:_}=c.floating;let E,C;y==="top"||y==="bottom"?(E=y,C=v===(await(u.isRTL==null?void 0:u.isRTL(h.floating))?"start":"end")?"left":"right"):(C=y,E=v==="end"?"top":"bottom");const j=_-x.top-x.bottom,N=S-x.left-x.right,A=Qi(_-x[E],j),H=Qi(S-x[C],N),k=!i.middlewareData.shift;let L=A,V=H;if((a=i.middlewareData.shift)!=null&&a.enabled.x&&(V=N),(r=i.middlewareData.shift)!=null&&r.enabled.y&&(L=j),k&&!v){const le=Xt(x.left,0),Q=Xt(x.right,0),X=Xt(x.top,0),te=Xt(x.bottom,0);w?V=S-2*(le!==0||Q!==0?le+Q:Xt(x.left,x.right)):L=_-2*(X!==0||te!==0?X+te:Xt(x.top,x.bottom))}await p({...i,availableWidth:V,availableHeight:L});const Z=await u.getDimensions(h.floating);return S!==Z.width||_!==Z.height?{reset:{rects:!0}}:{}}}};function Dc(){return typeof window<"u"}function Va(t){return lb(t)?(t.nodeName||"").toLowerCase():"#document"}function Zt(t){var i;return(t==null||(i=t.ownerDocument)==null?void 0:i.defaultView)||window}function Mn(t){var i;return(i=(lb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:i.documentElement}function lb(t){return Dc()?t instanceof Node||t instanceof Zt(t).Node:!1}function hn(t){return Dc()?t instanceof Element||t instanceof Zt(t).Element:!1}function Tn(t){return Dc()?t instanceof HTMLElement||t instanceof Zt(t).HTMLElement:!1}function gx(t){return!Dc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Zt(t).ShadowRoot}const pj=new Set(["inline","contents"]);function so(t){const{overflow:i,overflowX:a,overflowY:r,display:s}=mn(t);return/auto|scroll|overlay|hidden|clip/.test(i+r+a)&&!pj.has(s)}const gj=new Set(["table","td","th"]);function yj(t){return gj.has(Va(t))}const xj=[":popover-open",":modal"];function kc(t){return xj.some(i=>{try{return t.matches(i)}catch{return!1}})}const vj=["transform","translate","scale","rotate","perspective"],bj=["transform","translate","scale","rotate","perspective","filter"],wj=["paint","layout","strict","content"];function Uh(t){const i=Vh(),a=hn(t)?mn(t):t;return vj.some(r=>a[r]?a[r]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!i&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!i&&(a.filter?a.filter!=="none":!1)||bj.some(r=>(a.willChange||"").includes(r))||wj.some(r=>(a.contain||"").includes(r))}function Sj(t){let i=Ki(t);for(;Tn(i)&&!ka(i);){if(Uh(i))return i;if(kc(i))return null;i=Ki(i)}return null}function Vh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Ej=new Set(["html","body","#document"]);function ka(t){return Ej.has(Va(t))}function mn(t){return Zt(t).getComputedStyle(t)}function Lc(t){return hn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ki(t){if(Va(t)==="html")return t;const i=t.assignedSlot||t.parentNode||gx(t)&&t.host||Mn(t);return gx(i)?i.host:i}function ab(t){const i=Ki(t);return ka(i)?t.ownerDocument?t.ownerDocument.body:t.body:Tn(i)&&so(i)?i:ab(i)}function eo(t,i,a){var r;i===void 0&&(i=[]),a===void 0&&(a=!0);const s=ab(t),c=s===((r=t.ownerDocument)==null?void 0:r.body),u=Zt(s);if(c){const h=nh(u);return i.concat(u,u.visualViewport||[],so(s)?s:[],h&&a?eo(h):[])}return i.concat(s,eo(s,[],a))}function nh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function rb(t){const i=mn(t);let a=parseFloat(i.width)||0,r=parseFloat(i.height)||0;const s=Tn(t),c=s?t.offsetWidth:a,u=s?t.offsetHeight:r,h=mc(a)!==c||mc(r)!==u;return h&&(a=c,r=u),{width:a,height:r,$:h}}function $h(t){return hn(t)?t:t.contextElement}function _a(t){const i=$h(t);if(!Tn(i))return _n(1);const a=i.getBoundingClientRect(),{width:r,height:s,$:c}=rb(i);let u=(c?mc(a.width):a.width)/r,h=(c?mc(a.height):a.height)/s;return(!u||!Number.isFinite(u))&&(u=1),(!h||!Number.isFinite(h))&&(h=1),{x:u,y:h}}const Nj=_n(0);function ob(t){const i=Zt(t);return!Vh()||!i.visualViewport?Nj:{x:i.visualViewport.offsetLeft,y:i.visualViewport.offsetTop}}function _j(t,i,a){return i===void 0&&(i=!1),!a||i&&a!==Zt(t)?!1:i}function zl(t,i,a,r){i===void 0&&(i=!1),a===void 0&&(a=!1);const s=t.getBoundingClientRect(),c=$h(t);let u=_n(1);i&&(r?hn(r)&&(u=_a(r)):u=_a(t));const h=_j(c,a,r)?ob(c):_n(0);let p=(s.left+h.x)/u.x,m=(s.top+h.y)/u.y,x=s.width/u.x,y=s.height/u.y;if(c){const v=Zt(c),w=r&&hn(r)?Zt(r):r;let S=v,_=nh(S);for(;_&&r&&w!==S;){const E=_a(_),C=_.getBoundingClientRect(),j=mn(_),N=C.left+(_.clientLeft+parseFloat(j.paddingLeft))*E.x,A=C.top+(_.clientTop+parseFloat(j.paddingTop))*E.y;p*=E.x,m*=E.y,x*=E.x,y*=E.y,p+=N,m+=A,S=Zt(_),_=nh(S)}}return gc({width:x,height:y,x:p,y:m})}function Hc(t,i){const a=Lc(t).scrollLeft;return i?i.left+a:zl(Mn(t)).left+a}function sb(t,i){const a=t.getBoundingClientRect(),r=a.left+i.scrollLeft-Hc(t,a),s=a.top+i.scrollTop;return{x:r,y:s}}function Cj(t){let{elements:i,rect:a,offsetParent:r,strategy:s}=t;const c=s==="fixed",u=Mn(r),h=i?kc(i.floating):!1;if(r===u||h&&c)return a;let p={scrollLeft:0,scrollTop:0},m=_n(1);const x=_n(0),y=Tn(r);if((y||!y&&!c)&&((Va(r)!=="body"||so(u))&&(p=Lc(r)),Tn(r))){const w=zl(r);m=_a(r),x.x=w.x+r.clientLeft,x.y=w.y+r.clientTop}const v=u&&!y&&!c?sb(u,p):_n(0);return{width:a.width*m.x,height:a.height*m.y,x:a.x*m.x-p.scrollLeft*m.x+x.x+v.x,y:a.y*m.y-p.scrollTop*m.y+x.y+v.y}}function Tj(t){return Array.from(t.getClientRects())}function Aj(t){const i=Mn(t),a=Lc(t),r=t.ownerDocument.body,s=Xt(i.scrollWidth,i.clientWidth,r.scrollWidth,r.clientWidth),c=Xt(i.scrollHeight,i.clientHeight,r.scrollHeight,r.clientHeight);let u=-a.scrollLeft+Hc(t);const h=-a.scrollTop;return mn(r).direction==="rtl"&&(u+=Xt(i.clientWidth,r.clientWidth)-s),{width:s,height:c,x:u,y:h}}const yx=25;function Mj(t,i){const a=Zt(t),r=Mn(t),s=a.visualViewport;let c=r.clientWidth,u=r.clientHeight,h=0,p=0;if(s){c=s.width,u=s.height;const x=Vh();(!x||x&&i==="fixed")&&(h=s.offsetLeft,p=s.offsetTop)}const m=Hc(r);if(m<=0){const x=r.ownerDocument,y=x.body,v=getComputedStyle(y),w=x.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,S=Math.abs(r.clientWidth-y.clientWidth-w);S<=yx&&(c-=S)}else m<=yx&&(c+=m);return{width:c,height:u,x:h,y:p}}const jj=new Set(["absolute","fixed"]);function zj(t,i){const a=zl(t,!0,i==="fixed"),r=a.top+t.clientTop,s=a.left+t.clientLeft,c=Tn(t)?_a(t):_n(1),u=t.clientWidth*c.x,h=t.clientHeight*c.y,p=s*c.x,m=r*c.y;return{width:u,height:h,x:p,y:m}}function xx(t,i,a){let r;if(i==="viewport")r=Mj(t,a);else if(i==="document")r=Aj(Mn(t));else if(hn(i))r=zj(i,a);else{const s=ob(t);r={x:i.x-s.x,y:i.y-s.y,width:i.width,height:i.height}}return gc(r)}function cb(t,i){const a=Ki(t);return a===i||!hn(a)||ka(a)?!1:mn(a).position==="fixed"||cb(a,i)}function Rj(t,i){const a=i.get(t);if(a)return a;let r=eo(t,[],!1).filter(h=>hn(h)&&Va(h)!=="body"),s=null;const c=mn(t).position==="fixed";let u=c?Ki(t):t;for(;hn(u)&&!ka(u);){const h=mn(u),p=Uh(u);!p&&h.position==="fixed"&&(s=null),(c?!p&&!s:!p&&h.position==="static"&&!!s&&jj.has(s.position)||so(u)&&!p&&cb(t,u))?r=r.filter(x=>x!==u):s=h,u=Ki(u)}return i.set(t,r),r}function Oj(t){let{element:i,boundary:a,rootBoundary:r,strategy:s}=t;const u=[...a==="clippingAncestors"?kc(i)?[]:Rj(i,this._c):[].concat(a),r],h=u[0],p=u.reduce((m,x)=>{const y=xx(i,x,s);return m.top=Xt(y.top,m.top),m.right=Qi(y.right,m.right),m.bottom=Qi(y.bottom,m.bottom),m.left=Xt(y.left,m.left),m},xx(i,h,s));return{width:p.right-p.left,height:p.bottom-p.top,x:p.left,y:p.top}}function Dj(t){const{width:i,height:a}=rb(t);return{width:i,height:a}}function kj(t,i,a){const r=Tn(i),s=Mn(i),c=a==="fixed",u=zl(t,!0,c,i);let h={scrollLeft:0,scrollTop:0};const p=_n(0);function m(){p.x=Hc(s)}if(r||!r&&!c)if((Va(i)!=="body"||so(s))&&(h=Lc(i)),r){const w=zl(i,!0,c,i);p.x=w.x+i.clientLeft,p.y=w.y+i.clientTop}else s&&m();c&&!r&&s&&m();const x=s&&!r&&!c?sb(s,h):_n(0),y=u.left+h.scrollLeft-p.x-x.x,v=u.top+h.scrollTop-p.y-x.y;return{x:y,y:v,width:u.width,height:u.height}}function zd(t){return mn(t).position==="static"}function vx(t,i){if(!Tn(t)||mn(t).position==="fixed")return null;if(i)return i(t);let a=t.offsetParent;return Mn(t)===a&&(a=a.ownerDocument.body),a}function ub(t,i){const a=Zt(t);if(kc(t))return a;if(!Tn(t)){let s=Ki(t);for(;s&&!ka(s);){if(hn(s)&&!zd(s))return s;s=Ki(s)}return a}let r=vx(t,i);for(;r&&yj(r)&&zd(r);)r=vx(r,i);return r&&ka(r)&&zd(r)&&!Uh(r)?a:r||Sj(t)||a}const Lj=async function(t){const i=this.getOffsetParent||ub,a=this.getDimensions,r=await a(t.floating);return{reference:kj(t.reference,await i(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hj(t){return mn(t).direction==="rtl"}const Bj={convertOffsetParentRelativeRectToViewportRelativeRect:Cj,getDocumentElement:Mn,getClippingRect:Oj,getOffsetParent:ub,getElementRects:Lj,getClientRects:Tj,getDimensions:Dj,getScale:_a,isElement:hn,isRTL:Hj};function fb(t,i){return t.x===i.x&&t.y===i.y&&t.width===i.width&&t.height===i.height}function Uj(t,i){let a=null,r;const s=Mn(t);function c(){var h;clearTimeout(r),(h=a)==null||h.disconnect(),a=null}function u(h,p){h===void 0&&(h=!1),p===void 0&&(p=1),c();const m=t.getBoundingClientRect(),{left:x,top:y,width:v,height:w}=m;if(h||i(),!v||!w)return;const S=Zs(y),_=Zs(s.clientWidth-(x+v)),E=Zs(s.clientHeight-(y+w)),C=Zs(x),N={rootMargin:-S+"px "+-_+"px "+-E+"px "+-C+"px",threshold:Xt(0,Qi(1,p))||1};let A=!0;function H(k){const L=k[0].intersectionRatio;if(L!==p){if(!A)return u();L?u(!1,L):r=setTimeout(()=>{u(!1,1e-7)},1e3)}L===1&&!fb(m,t.getBoundingClientRect())&&u(),A=!1}try{a=new IntersectionObserver(H,{...N,root:s.ownerDocument})}catch{a=new IntersectionObserver(H,N)}a.observe(t)}return u(!0),c}function Vj(t,i,a,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,m=$h(t),x=s||c?[...m?eo(m):[],...eo(i)]:[];x.forEach(C=>{s&&C.addEventListener("scroll",a,{passive:!0}),c&&C.addEventListener("resize",a)});const y=m&&h?Uj(m,a):null;let v=-1,w=null;u&&(w=new ResizeObserver(C=>{let[j]=C;j&&j.target===m&&w&&(w.unobserve(i),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=w)==null||N.observe(i)})),a()}),m&&!p&&w.observe(m),w.observe(i));let S,_=p?zl(t):null;p&&E();function E(){const C=zl(t);_&&!fb(_,C)&&a(),_=C,S=requestAnimationFrame(E)}return a(),()=>{var C;x.forEach(j=>{s&&j.removeEventListener("scroll",a),c&&j.removeEventListener("resize",a)}),y==null||y(),(C=w)==null||C.disconnect(),w=null,p&&cancelAnimationFrame(S)}}const $j=fj,Yj=dj,qj=sj,Xj=mj,Gj=cj,bx=oj,Zj=hj,Qj=(t,i,a)=>{const r=new Map,s={platform:Bj,...a},c={...s.platform,_c:r};return rj(t,i,{...s,platform:c})};var Kj=typeof document<"u",Pj=function(){},ec=Kj?T.useLayoutEffect:Pj;function yc(t,i){if(t===i)return!0;if(typeof t!=typeof i)return!1;if(typeof t=="function"&&t.toString()===i.toString())return!0;let a,r,s;if(t&&i&&typeof t=="object"){if(Array.isArray(t)){if(a=t.length,a!==i.length)return!1;for(r=a;r--!==0;)if(!yc(t[r],i[r]))return!1;return!0}if(s=Object.keys(t),a=s.length,a!==Object.keys(i).length)return!1;for(r=a;r--!==0;)if(!{}.hasOwnProperty.call(i,s[r]))return!1;for(r=a;r--!==0;){const c=s[r];if(!(c==="_owner"&&t.$$typeof)&&!yc(t[c],i[c]))return!1}return!0}return t!==t&&i!==i}function db(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function wx(t,i){const a=db(t);return Math.round(i*a)/a}function Rd(t){const i=T.useRef(t);return ec(()=>{i.current=t}),i}function Fj(t){t===void 0&&(t={});const{placement:i="bottom",strategy:a="absolute",middleware:r=[],platform:s,elements:{reference:c,floating:u}={},transform:h=!0,whileElementsMounted:p,open:m}=t,[x,y]=T.useState({x:0,y:0,strategy:a,placement:i,middlewareData:{},isPositioned:!1}),[v,w]=T.useState(r);yc(v,r)||w(r);const[S,_]=T.useState(null),[E,C]=T.useState(null),j=T.useCallback(O=>{O!==k.current&&(k.current=O,_(O))},[]),N=T.useCallback(O=>{O!==L.current&&(L.current=O,C(O))},[]),A=c||S,H=u||E,k=T.useRef(null),L=T.useRef(null),V=T.useRef(x),Z=p!=null,le=Rd(p),Q=Rd(s),X=Rd(m),te=T.useCallback(()=>{if(!k.current||!L.current)return;const O={placement:i,strategy:a,middleware:v};Q.current&&(O.platform=Q.current),Qj(k.current,L.current,O).then($=>{const J={...$,isPositioned:X.current!==!1};D.current&&!yc(V.current,J)&&(V.current=J,Tc.flushSync(()=>{y(J)}))})},[v,i,a,Q,X]);ec(()=>{m===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,y(O=>({...O,isPositioned:!1})))},[m]);const D=T.useRef(!1);ec(()=>(D.current=!0,()=>{D.current=!1}),[]),ec(()=>{if(A&&(k.current=A),H&&(L.current=H),A&&H){if(le.current)return le.current(A,H,te);te()}},[A,H,te,le,Z]);const G=T.useMemo(()=>({reference:k,floating:L,setReference:j,setFloating:N}),[j,N]),z=T.useMemo(()=>({reference:A,floating:H}),[A,H]),B=T.useMemo(()=>{const O={position:a,left:0,top:0};if(!z.floating)return O;const $=wx(z.floating,x.x),J=wx(z.floating,x.y);return h?{...O,transform:"translate("+$+"px, "+J+"px)",...db(z.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:$,top:J}},[a,h,z.floating,x.x,x.y]);return T.useMemo(()=>({...x,update:te,refs:G,elements:z,floatingStyles:B}),[x,te,G,z,B])}const Ij=t=>{function i(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:t,fn(a){const{element:r,padding:s}=typeof t=="function"?t(a):t;return r&&i(r)?r.current!=null?bx({element:r.current,padding:s}).fn(a):{}:r?bx({element:r,padding:s}).fn(a):{}}}},Jj=(t,i)=>({...$j(t),options:[t,i]}),Wj=(t,i)=>({...Yj(t),options:[t,i]}),ez=(t,i)=>({...Zj(t),options:[t,i]}),tz=(t,i)=>({...qj(t),options:[t,i]}),nz=(t,i)=>({...Xj(t),options:[t,i]}),iz=(t,i)=>({...Gj(t),options:[t,i]}),lz=(t,i)=>({...Ij(t),options:[t,i]});var az="Arrow",hb=T.forwardRef((t,i)=>{const{children:a,width:r=10,height:s=5,...c}=t;return g.jsx(Dt.svg,{...c,ref:i,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?a:g.jsx("polygon",{points:"0,0 30,0 15,10"})})});hb.displayName=az;var rz=hb;function oz(t){const[i,a]=T.useState(void 0);return Zi(()=>{if(t){a({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const c=s[0];let u,h;if("borderBoxSize"in c){const p=c.borderBoxSize,m=Array.isArray(p)?p[0]:p;u=m.inlineSize,h=m.blockSize}else u=t.offsetWidth,h=t.offsetHeight;a({width:u,height:h})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else a(void 0)},[t]),i}var mb="Popper",[pb,gb]=Oc(mb),[E6,yb]=pb(mb),xb="PopperAnchor",vb=T.forwardRef((t,i)=>{const{__scopePopper:a,virtualRef:r,...s}=t,c=yb(xb,a),u=T.useRef(null),h=dn(i,u),p=T.useRef(null);return T.useEffect(()=>{const m=p.current;p.current=(r==null?void 0:r.current)||u.current,m!==p.current&&c.onAnchorChange(p.current)}),r?null:g.jsx(Dt.div,{...s,ref:h})});vb.displayName=xb;var Yh="PopperContent",[sz,cz]=pb(Yh),bb=T.forwardRef((t,i)=>{var oe,ce,fe,we,ve,ge;const{__scopePopper:a,side:r="bottom",sideOffset:s=0,align:c="center",alignOffset:u=0,arrowPadding:h=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:w="optimized",onPlaced:S,..._}=t,E=yb(Yh,a),[C,j]=T.useState(null),N=dn(i,ye=>j(ye)),[A,H]=T.useState(null),k=oz(A),L=(k==null?void 0:k.width)??0,V=(k==null?void 0:k.height)??0,Z=r+(c!=="center"?"-"+c:""),le=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},Q=Array.isArray(m)?m:[m],X=Q.length>0,te={padding:le,boundary:Q.filter(fz),altBoundary:X},{refs:D,floatingStyles:G,placement:z,isPositioned:B,middlewareData:O}=Fj({strategy:"fixed",placement:Z,whileElementsMounted:(...ye)=>Vj(...ye,{animationFrame:w==="always"}),elements:{reference:E.anchor},middleware:[Jj({mainAxis:s+V,alignmentAxis:u}),p&&Wj({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?ez():void 0,...te}),p&&tz({...te}),nz({...te,apply:({elements:ye,rects:Ce,availableWidth:Ue,availableHeight:je})=>{const{width:nt,height:kt}=Ce.reference,ht=ye.floating.style;ht.setProperty("--radix-popper-available-width",`${Ue}px`),ht.setProperty("--radix-popper-available-height",`${je}px`),ht.setProperty("--radix-popper-anchor-width",`${nt}px`),ht.setProperty("--radix-popper-anchor-height",`${kt}px`)}}),A&&lz({element:A,padding:h}),dz({arrowWidth:L,arrowHeight:V}),v&&iz({strategy:"referenceHidden",...te})]}),[$,J]=Eb(z),R=Gi(S);Zi(()=>{B&&(R==null||R())},[B,R]);const Y=(oe=O.arrow)==null?void 0:oe.x,P=(ce=O.arrow)==null?void 0:ce.y,ee=((fe=O.arrow)==null?void 0:fe.centerOffset)!==0,[se,ue]=T.useState();return Zi(()=>{C&&ue(window.getComputedStyle(C).zIndex)},[C]),g.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:B?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(we=O.transformOrigin)==null?void 0:we.x,(ve=O.transformOrigin)==null?void 0:ve.y].join(" "),...((ge=O.hide)==null?void 0:ge.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:g.jsx(sz,{scope:a,placedSide:$,onArrowChange:H,arrowX:Y,arrowY:P,shouldHideArrow:ee,children:g.jsx(Dt.div,{"data-side":$,"data-align":J,..._,ref:N,style:{..._.style,animation:B?void 0:"none"}})})})});bb.displayName=Yh;var wb="PopperArrow",uz={top:"bottom",right:"left",bottom:"top",left:"right"},Sb=T.forwardRef(function(i,a){const{__scopePopper:r,...s}=i,c=cz(wb,r),u=uz[c.placedSide];return g.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:g.jsx(rz,{...s,ref:a,style:{...s.style,display:"block"}})})});Sb.displayName=wb;function fz(t){return t!==null}var dz=t=>({name:"transformOrigin",options:t,fn(i){var E,C,j;const{placement:a,rects:r,middlewareData:s}=i,u=((E=s.arrow)==null?void 0:E.centerOffset)!==0,h=u?0:t.arrowWidth,p=u?0:t.arrowHeight,[m,x]=Eb(a),y={start:"0%",center:"50%",end:"100%"}[x],v=(((C=s.arrow)==null?void 0:C.x)??0)+h/2,w=(((j=s.arrow)==null?void 0:j.y)??0)+p/2;let S="",_="";return m==="bottom"?(S=u?y:`${v}px`,_=`${-p}px`):m==="top"?(S=u?y:`${v}px`,_=`${r.floating.height+p}px`):m==="right"?(S=`${-p}px`,_=u?y:`${w}px`):m==="left"&&(S=`${r.floating.width+p}px`,_=u?y:`${w}px`),{data:{x:S,y:_}}}});function Eb(t){const[i,a="center"]=t.split("-");return[i,a]}var hz=vb,mz=bb,pz=Sb,gz="Portal",qh=T.forwardRef((t,i)=>{var h;const{container:a,...r}=t,[s,c]=T.useState(!1);Zi(()=>c(!0),[]);const u=a||s&&((h=globalThis==null?void 0:globalThis.document)==null?void 0:h.body);return u?Z3.createPortal(g.jsx(Dt.div,{...r,ref:i}),u):null});qh.displayName=gz;function yz(t,i){return T.useReducer((a,r)=>i[a][r]??a,t)}var Bc=t=>{const{present:i,children:a}=t,r=xz(i),s=typeof a=="function"?a({present:r.isPresent}):T.Children.only(a),c=dn(r.ref,vz(s));return typeof a=="function"||r.isPresent?T.cloneElement(s,{ref:c}):null};Bc.displayName="Presence";function xz(t){const[i,a]=T.useState(),r=T.useRef(null),s=T.useRef(t),c=T.useRef("none"),u=t?"mounted":"unmounted",[h,p]=yz(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const m=Qs(r.current);c.current=h==="mounted"?m:"none"},[h]),Zi(()=>{const m=r.current,x=s.current;if(x!==t){const v=c.current,w=Qs(m);t?p("MOUNT"):w==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(x&&v!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,p]),Zi(()=>{if(i){let m;const x=i.ownerDocument.defaultView??window,y=w=>{const _=Qs(r.current).includes(CSS.escape(w.animationName));if(w.target===i&&_&&(p("ANIMATION_END"),!s.current)){const E=i.style.animationFillMode;i.style.animationFillMode="forwards",m=x.setTimeout(()=>{i.style.animationFillMode==="forwards"&&(i.style.animationFillMode=E)})}},v=w=>{w.target===i&&(c.current=Qs(r.current))};return i.addEventListener("animationstart",v),i.addEventListener("animationcancel",y),i.addEventListener("animationend",y),()=>{x.clearTimeout(m),i.removeEventListener("animationstart",v),i.removeEventListener("animationcancel",y),i.removeEventListener("animationend",y)}}else p("ANIMATION_END")},[i,p]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:T.useCallback(m=>{r.current=m?getComputedStyle(m):null,a(m)},[])}}function Qs(t){return(t==null?void 0:t.animationName)||"none"}function vz(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}var bz=Symbol("radix.slottable");function wz(t){const i=({children:a})=>g.jsx(g.Fragment,{children:a});return i.displayName=`${t}.Slottable`,i.__radixId=bz,i}var Sz=Tx[" useInsertionEffect ".trim().toString()]||Zi;function Ez({prop:t,defaultProp:i,onChange:a=()=>{},caller:r}){const[s,c,u]=Nz({defaultProp:i,onChange:a}),h=t!==void 0,p=h?t:s;{const x=T.useRef(t!==void 0);T.useEffect(()=>{const y=x.current;y!==h&&console.warn(`${r} is changing from ${y?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=h},[h,r])}const m=T.useCallback(x=>{var y;if(h){const v=_z(x)?x(t):x;v!==t&&((y=u.current)==null||y.call(u,v))}else c(x)},[h,t,c,u]);return[p,m]}function Nz({defaultProp:t,onChange:i}){const[a,r]=T.useState(t),s=T.useRef(a),c=T.useRef(i);return Sz(()=>{c.current=i},[i]),T.useEffect(()=>{var u;s.current!==a&&((u=c.current)==null||u.call(c,a),s.current=a)},[a,s]),[a,r,c]}function _z(t){return typeof t=="function"}var Cz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Tz="VisuallyHidden",Uc=T.forwardRef((t,i)=>g.jsx(Dt.span,{...t,ref:i,style:{...Cz,...t.style}}));Uc.displayName=Tz;var Az=Uc,[Vc]=Oc("Tooltip",[gb]),Xh=gb(),Nb="TooltipProvider",Mz=700,Sx="tooltip.open",[jz,_b]=Vc(Nb),Cb=t=>{const{__scopeTooltip:i,delayDuration:a=Mz,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:c}=t,u=T.useRef(!0),h=T.useRef(!1),p=T.useRef(0);return T.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),g.jsx(jz,{scope:i,isOpenDelayedRef:u,delayDuration:a,onOpen:T.useCallback(()=>{window.clearTimeout(p.current),u.current=!1},[]),onClose:T.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>u.current=!0,r)},[r]),isPointerInTransitRef:h,onPointerInTransitChange:T.useCallback(m=>{h.current=m},[]),disableHoverableContent:s,children:c})};Cb.displayName=Nb;var Tb="Tooltip",[N6,co]=Vc(Tb),ih="TooltipTrigger",zz=T.forwardRef((t,i)=>{const{__scopeTooltip:a,...r}=t,s=co(ih,a),c=_b(ih,a),u=Xh(a),h=T.useRef(null),p=dn(i,h,s.onTriggerChange),m=T.useRef(!1),x=T.useRef(!1),y=T.useCallback(()=>m.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),g.jsx(hz,{asChild:!0,...u,children:g.jsx(Dt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:p,onPointerMove:dt(t.onPointerMove,v=>{v.pointerType!=="touch"&&!x.current&&!c.isPointerInTransitRef.current&&(s.onTriggerEnter(),x.current=!0)}),onPointerLeave:dt(t.onPointerLeave,()=>{s.onTriggerLeave(),x.current=!1}),onPointerDown:dt(t.onPointerDown,()=>{s.open&&s.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:dt(t.onFocus,()=>{m.current||s.onOpen()}),onBlur:dt(t.onBlur,s.onClose),onClick:dt(t.onClick,s.onClose)})})});zz.displayName=ih;var Gh="TooltipPortal",[Rz,Oz]=Vc(Gh,{forceMount:void 0}),Ab=t=>{const{__scopeTooltip:i,forceMount:a,children:r,container:s}=t,c=co(Gh,i);return g.jsx(Rz,{scope:i,forceMount:a,children:g.jsx(Bc,{present:a||c.open,children:g.jsx(qh,{asChild:!0,container:s,children:r})})})};Ab.displayName=Gh;var La="TooltipContent",Mb=T.forwardRef((t,i)=>{const a=Oz(La,t.__scopeTooltip),{forceMount:r=a.forceMount,side:s="top",...c}=t,u=co(La,t.__scopeTooltip);return g.jsx(Bc,{present:r||u.open,children:u.disableHoverableContent?g.jsx(jb,{side:s,...c,ref:i}):g.jsx(Dz,{side:s,...c,ref:i})})}),Dz=T.forwardRef((t,i)=>{const a=co(La,t.__scopeTooltip),r=_b(La,t.__scopeTooltip),s=T.useRef(null),c=dn(i,s),[u,h]=T.useState(null),{trigger:p,onClose:m}=a,x=s.current,{onPointerInTransitChange:y}=r,v=T.useCallback(()=>{h(null),y(!1)},[y]),w=T.useCallback((S,_)=>{const E=S.currentTarget,C={x:S.clientX,y:S.clientY},j=Uz(C,E.getBoundingClientRect()),N=Vz(C,j),A=$z(_.getBoundingClientRect()),H=qz([...N,...A]);h(H),y(!0)},[y]);return T.useEffect(()=>()=>v(),[v]),T.useEffect(()=>{if(p&&x){const S=E=>w(E,x),_=E=>w(E,p);return p.addEventListener("pointerleave",S),x.addEventListener("pointerleave",_),()=>{p.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",_)}}},[p,x,w,v]),T.useEffect(()=>{if(u){const S=_=>{const E=_.target,C={x:_.clientX,y:_.clientY},j=(p==null?void 0:p.contains(E))||(x==null?void 0:x.contains(E)),N=!Yz(C,u);j?v():N&&(v(),m())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,x,u,m,v]),g.jsx(jb,{...t,ref:c})}),[kz,Lz]=Vc(Tb,{isInside:!1}),Hz=wz("TooltipContent"),jb=T.forwardRef((t,i)=>{const{__scopeTooltip:a,children:r,"aria-label":s,onEscapeKeyDown:c,onPointerDownOutside:u,...h}=t,p=co(La,a),m=Xh(a),{onClose:x}=p;return T.useEffect(()=>(document.addEventListener(Sx,x),()=>document.removeEventListener(Sx,x)),[x]),T.useEffect(()=>{if(p.trigger){const y=v=>{const w=v.target;w!=null&&w.contains(p.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[p.trigger,x]),g.jsx(kh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:g.jsxs(mz,{"data-state":p.stateAttribute,...m,...h,ref:i,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(Hz,{children:r}),g.jsx(kz,{scope:a,isInside:!0,children:g.jsx(Az,{id:p.contentId,role:"tooltip",children:s||r})})]})})});Mb.displayName=La;var zb="TooltipArrow",Bz=T.forwardRef((t,i)=>{const{__scopeTooltip:a,...r}=t,s=Xh(a);return Lz(zb,a).isInside?null:g.jsx(pz,{...s,...r,ref:i})});Bz.displayName=zb;function Uz(t,i){const a=Math.abs(i.top-t.y),r=Math.abs(i.bottom-t.y),s=Math.abs(i.right-t.x),c=Math.abs(i.left-t.x);switch(Math.min(a,r,s,c)){case c:return"left";case s:return"right";case a:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Vz(t,i,a=5){const r=[];switch(i){case"top":r.push({x:t.x-a,y:t.y+a},{x:t.x+a,y:t.y+a});break;case"bottom":r.push({x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a});break;case"left":r.push({x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a});break;case"right":r.push({x:t.x-a,y:t.y-a},{x:t.x-a,y:t.y+a});break}return r}function $z(t){const{top:i,right:a,bottom:r,left:s}=t;return[{x:s,y:i},{x:a,y:i},{x:a,y:r},{x:s,y:r}]}function Yz(t,i){const{x:a,y:r}=t;let s=!1;for(let c=0,u=i.length-1;c<i.length;u=c++){const h=i[c],p=i[u],m=h.x,x=h.y,y=p.x,v=p.y;x>r!=v>r&&a<(y-m)*(r-x)/(v-x)+m&&(s=!s)}return s}function qz(t){const i=t.slice();return i.sort((a,r)=>a.x<r.x?-1:a.x>r.x?1:a.y<r.y?-1:a.y>r.y?1:0),Xz(i)}function Xz(t){if(t.length<=1)return t.slice();const i=[];for(let r=0;r<t.length;r++){const s=t[r];for(;i.length>=2;){const c=i[i.length-1],u=i[i.length-2];if((c.x-u.x)*(s.y-u.y)>=(c.y-u.y)*(s.x-u.x))i.pop();else break}i.push(s)}i.pop();const a=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;a.length>=2;){const c=a[a.length-1],u=a[a.length-2];if((c.x-u.x)*(s.y-u.y)>=(c.y-u.y)*(s.x-u.x))a.pop();else break}a.push(s)}return a.pop(),i.length===1&&a.length===1&&i[0].x===a[0].x&&i[0].y===a[0].y?i:i.concat(a)}var Gz=Cb,Zz=Ab,Rb=Mb;const Ex=Gz,Qz=T.forwardRef(({className:t,sideOffset:i=4,...a},r)=>g.jsx(Zz,{children:g.jsx(Rb,{ref:r,sideOffset:i,className:Ne("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));Qz.displayName=Rb.displayName;function Nx(t){const i=Kz(t),a=T.forwardRef((r,s)=>{const{children:c,...u}=r,h=T.Children.toArray(c),p=h.find(Fz);if(p){const m=p.props.children,x=h.map(y=>y===p?T.Children.count(m)>1?T.Children.only(null):T.isValidElement(m)?m.props.children:null:y);return g.jsx(i,{...u,ref:s,children:T.isValidElement(m)?T.cloneElement(m,void 0,x):null})}return g.jsx(i,{...u,ref:s,children:c})});return a.displayName=`${t}.Slot`,a}function Kz(t){const i=T.forwardRef((a,r)=>{const{children:s,...c}=a;if(T.isValidElement(s)){const u=Jz(s),h=Iz(c,s.props);return s.type!==T.Fragment&&(h.ref=r?Rc(r,u):u),T.cloneElement(s,h)}return T.Children.count(s)>1?T.Children.only(null):null});return i.displayName=`${t}.SlotClone`,i}var Pz=Symbol("radix.slottable");function Fz(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Pz}function Iz(t,i){const a={...i};for(const r in i){const s=t[r],c=i[r];/^on[A-Z]/.test(r)?s&&c?a[r]=(...h)=>{const p=c(...h);return s(...h),p}:s&&(a[r]=s):r==="style"?a[r]={...s,...c}:r==="className"&&(a[r]=[s,c].filter(Boolean).join(" "))}return{...t,...a}}function Jz(t){var r,s;let i=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,a=i&&"isReactWarning"in i&&i.isReactWarning;return a?t.ref:(i=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,a=i&&"isReactWarning"in i&&i.isReactWarning,a?t.props.ref:t.props.ref||t.ref)}function Wz(t){const i=t+"CollectionProvider",[a,r]=Oc(i),[s,c]=a(i,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:C}=_,j=qt.useRef(null),N=qt.useRef(new Map).current;return g.jsx(s,{scope:E,itemMap:N,collectionRef:j,children:C})};u.displayName=i;const h=t+"CollectionSlot",p=Nx(h),m=qt.forwardRef((_,E)=>{const{scope:C,children:j}=_,N=c(h,C),A=dn(E,N.collectionRef);return g.jsx(p,{ref:A,children:j})});m.displayName=h;const x=t+"CollectionItemSlot",y="data-radix-collection-item",v=Nx(x),w=qt.forwardRef((_,E)=>{const{scope:C,children:j,...N}=_,A=qt.useRef(null),H=dn(E,A),k=c(x,C);return qt.useEffect(()=>(k.itemMap.set(A,{ref:A,...N}),()=>void k.itemMap.delete(A))),g.jsx(v,{[y]:"",ref:H,children:j})});w.displayName=x;function S(_){const E=c(t+"CollectionConsumer",_);return qt.useCallback(()=>{const j=E.collectionRef.current;if(!j)return[];const N=Array.from(j.querySelectorAll(`[${y}]`));return Array.from(E.itemMap.values()).sort((k,L)=>N.indexOf(k.ref.current)-N.indexOf(L.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},S,r]}var Zh="ToastProvider",[Qh,e6,t6]=Wz("Toast"),[Ob]=Oc("Toast",[t6]),[n6,$c]=Ob(Zh),Db=t=>{const{__scopeToast:i,label:a="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:c=50,children:u}=t,[h,p]=T.useState(null),[m,x]=T.useState(0),y=T.useRef(!1),v=T.useRef(!1);return a.trim()||console.error(`Invalid prop \`label\` supplied to \`${Zh}\`. Expected non-empty \`string\`.`),g.jsx(Qh.Provider,{scope:i,children:g.jsx(n6,{scope:i,label:a,duration:r,swipeDirection:s,swipeThreshold:c,toastCount:m,viewport:h,onViewportChange:p,onToastAdd:T.useCallback(()=>x(w=>w+1),[]),onToastRemove:T.useCallback(()=>x(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:v,children:u})})};Db.displayName=Zh;var kb="ToastViewport",i6=["F8"],lh="toast.viewportPause",ah="toast.viewportResume",Lb=T.forwardRef((t,i)=>{const{__scopeToast:a,hotkey:r=i6,label:s="Notifications ({hotkey})",...c}=t,u=$c(kb,a),h=e6(a),p=T.useRef(null),m=T.useRef(null),x=T.useRef(null),y=T.useRef(null),v=dn(i,y,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=u.toastCount>0;T.useEffect(()=>{const E=C=>{var N;r.length!==0&&r.every(A=>C[A]||C.code===A)&&((N=y.current)==null||N.focus())};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[r]),T.useEffect(()=>{const E=p.current,C=y.current;if(S&&E&&C){const j=()=>{if(!u.isClosePausedRef.current){const k=new CustomEvent(lh);C.dispatchEvent(k),u.isClosePausedRef.current=!0}},N=()=>{if(u.isClosePausedRef.current){const k=new CustomEvent(ah);C.dispatchEvent(k),u.isClosePausedRef.current=!1}},A=k=>{!E.contains(k.relatedTarget)&&N()},H=()=>{E.contains(document.activeElement)||N()};return E.addEventListener("focusin",j),E.addEventListener("focusout",A),E.addEventListener("pointermove",j),E.addEventListener("pointerleave",H),window.addEventListener("blur",j),window.addEventListener("focus",N),()=>{E.removeEventListener("focusin",j),E.removeEventListener("focusout",A),E.removeEventListener("pointermove",j),E.removeEventListener("pointerleave",H),window.removeEventListener("blur",j),window.removeEventListener("focus",N)}}},[S,u.isClosePausedRef]);const _=T.useCallback(({tabbingDirection:E})=>{const j=h().map(N=>{const A=N.ref.current,H=[A,...g6(A)];return E==="forwards"?H:H.reverse()});return(E==="forwards"?j.reverse():j).flat()},[h]);return T.useEffect(()=>{const E=y.current;if(E){const C=j=>{var H,k,L;const N=j.altKey||j.ctrlKey||j.metaKey;if(j.key==="Tab"&&!N){const V=document.activeElement,Z=j.shiftKey;if(j.target===E&&Z){(H=m.current)==null||H.focus();return}const X=_({tabbingDirection:Z?"backwards":"forwards"}),te=X.findIndex(D=>D===V);Od(X.slice(te+1))?j.preventDefault():Z?(k=m.current)==null||k.focus():(L=x.current)==null||L.focus()}};return E.addEventListener("keydown",C),()=>E.removeEventListener("keydown",C)}},[h,_]),g.jsxs(QM,{ref:p,role:"region","aria-label":s.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&g.jsx(rh,{ref:m,onFocusFromOutsideViewport:()=>{const E=_({tabbingDirection:"forwards"});Od(E)}}),g.jsx(Qh.Slot,{scope:a,children:g.jsx(Dt.ol,{tabIndex:-1,...c,ref:v})}),S&&g.jsx(rh,{ref:x,onFocusFromOutsideViewport:()=>{const E=_({tabbingDirection:"backwards"});Od(E)}})]})});Lb.displayName=kb;var Hb="ToastFocusProxy",rh=T.forwardRef((t,i)=>{const{__scopeToast:a,onFocusFromOutsideViewport:r,...s}=t,c=$c(Hb,a);return g.jsx(Uc,{tabIndex:0,...s,ref:i,style:{position:"fixed"},onFocus:u=>{var m;const h=u.relatedTarget;!((m=c.viewport)!=null&&m.contains(h))&&r()}})});rh.displayName=Hb;var uo="Toast",l6="toast.swipeStart",a6="toast.swipeMove",r6="toast.swipeCancel",o6="toast.swipeEnd",Bb=T.forwardRef((t,i)=>{const{forceMount:a,open:r,defaultOpen:s,onOpenChange:c,...u}=t,[h,p]=Ez({prop:r,defaultProp:s??!0,onChange:c,caller:uo});return g.jsx(Bc,{present:a||h,children:g.jsx(u6,{open:h,...u,ref:i,onClose:()=>p(!1),onPause:Gi(t.onPause),onResume:Gi(t.onResume),onSwipeStart:dt(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:dt(t.onSwipeMove,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:dt(t.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:dt(t.onSwipeEnd,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),p(!1)})})})});Bb.displayName=uo;var[s6,c6]=Ob(uo,{onClose(){}}),u6=T.forwardRef((t,i)=>{const{__scopeToast:a,type:r="foreground",duration:s,open:c,onClose:u,onEscapeKeyDown:h,onPause:p,onResume:m,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:v,onSwipeEnd:w,...S}=t,_=$c(uo,a),[E,C]=T.useState(null),j=dn(i,D=>C(D)),N=T.useRef(null),A=T.useRef(null),H=s||_.duration,k=T.useRef(0),L=T.useRef(H),V=T.useRef(0),{onToastAdd:Z,onToastRemove:le}=_,Q=Gi(()=>{var G;(E==null?void 0:E.contains(document.activeElement))&&((G=_.viewport)==null||G.focus()),u()}),X=T.useCallback(D=>{!D||D===1/0||(window.clearTimeout(V.current),k.current=new Date().getTime(),V.current=window.setTimeout(Q,D))},[Q]);T.useEffect(()=>{const D=_.viewport;if(D){const G=()=>{X(L.current),m==null||m()},z=()=>{const B=new Date().getTime()-k.current;L.current=L.current-B,window.clearTimeout(V.current),p==null||p()};return D.addEventListener(lh,z),D.addEventListener(ah,G),()=>{D.removeEventListener(lh,z),D.removeEventListener(ah,G)}}},[_.viewport,H,p,m,X]),T.useEffect(()=>{c&&!_.isClosePausedRef.current&&X(H)},[c,H,_.isClosePausedRef,X]),T.useEffect(()=>(Z(),()=>le()),[Z,le]);const te=T.useMemo(()=>E?Gb(E):null,[E]);return _.viewport?g.jsxs(g.Fragment,{children:[te&&g.jsx(f6,{__scopeToast:a,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:te}),g.jsx(s6,{scope:a,onClose:Q,children:Tc.createPortal(g.jsx(Qh.ItemSlot,{scope:a,children:g.jsx(ZM,{asChild:!0,onEscapeKeyDown:dt(h,()=>{_.isFocusedToastEscapeKeyDownRef.current||Q(),_.isFocusedToastEscapeKeyDownRef.current=!1}),children:g.jsx(Dt.li,{tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":_.swipeDirection,...S,ref:j,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:dt(t.onKeyDown,D=>{D.key==="Escape"&&(h==null||h(D.nativeEvent),D.nativeEvent.defaultPrevented||(_.isFocusedToastEscapeKeyDownRef.current=!0,Q()))}),onPointerDown:dt(t.onPointerDown,D=>{D.button===0&&(N.current={x:D.clientX,y:D.clientY})}),onPointerMove:dt(t.onPointerMove,D=>{if(!N.current)return;const G=D.clientX-N.current.x,z=D.clientY-N.current.y,B=!!A.current,O=["left","right"].includes(_.swipeDirection),$=["left","up"].includes(_.swipeDirection)?Math.min:Math.max,J=O?$(0,G):0,R=O?0:$(0,z),Y=D.pointerType==="touch"?10:2,P={x:J,y:R},ee={originalEvent:D,delta:P};B?(A.current=P,Ks(a6,y,ee,{discrete:!1})):_x(P,_.swipeDirection,Y)?(A.current=P,Ks(l6,x,ee,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(G)>Y||Math.abs(z)>Y)&&(N.current=null)}),onPointerUp:dt(t.onPointerUp,D=>{const G=A.current,z=D.target;if(z.hasPointerCapture(D.pointerId)&&z.releasePointerCapture(D.pointerId),A.current=null,N.current=null,G){const B=D.currentTarget,O={originalEvent:D,delta:G};_x(G,_.swipeDirection,_.swipeThreshold)?Ks(o6,w,O,{discrete:!0}):Ks(r6,v,O,{discrete:!0}),B.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})})}),_.viewport)})]}):null}),f6=t=>{const{__scopeToast:i,children:a,...r}=t,s=$c(uo,i),[c,u]=T.useState(!1),[h,p]=T.useState(!1);return m6(()=>u(!0)),T.useEffect(()=>{const m=window.setTimeout(()=>p(!0),1e3);return()=>window.clearTimeout(m)},[]),h?null:g.jsx(qh,{asChild:!0,children:g.jsx(Uc,{...r,children:c&&g.jsxs(g.Fragment,{children:[s.label," ",a]})})})},d6="ToastTitle",Ub=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t;return g.jsx(Dt.div,{...r,ref:i})});Ub.displayName=d6;var h6="ToastDescription",Vb=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t;return g.jsx(Dt.div,{...r,ref:i})});Vb.displayName=h6;var $b="ToastAction",Yb=T.forwardRef((t,i)=>{const{altText:a,...r}=t;return a.trim()?g.jsx(Xb,{altText:a,asChild:!0,children:g.jsx(Kh,{...r,ref:i})}):(console.error(`Invalid prop \`altText\` supplied to \`${$b}\`. Expected non-empty \`string\`.`),null)});Yb.displayName=$b;var qb="ToastClose",Kh=T.forwardRef((t,i)=>{const{__scopeToast:a,...r}=t,s=c6(qb,a);return g.jsx(Xb,{asChild:!0,children:g.jsx(Dt.button,{type:"button",...r,ref:i,onClick:dt(t.onClick,s.onClose)})})});Kh.displayName=qb;var Xb=T.forwardRef((t,i)=>{const{__scopeToast:a,altText:r,...s}=t;return g.jsx(Dt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:i})});function Gb(t){const i=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&i.push(r.textContent),p6(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",c=r.dataset.radixToastAnnounceExclude==="";if(!s)if(c){const u=r.dataset.radixToastAnnounceAlt;u&&i.push(u)}else i.push(...Gb(r))}}),i}function Ks(t,i,a,{discrete:r}){const s=a.originalEvent.currentTarget,c=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:a});i&&s.addEventListener(t,i,{once:!0}),r?J1(s,c):s.dispatchEvent(c)}var _x=(t,i,a=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),c=r>s;return i==="left"||i==="right"?c&&r>a:!c&&s>a};function m6(t=()=>{}){const i=Gi(t);Zi(()=>{let a=0,r=0;return a=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(i)),()=>{window.cancelAnimationFrame(a),window.cancelAnimationFrame(r)}},[i])}function p6(t){return t.nodeType===t.ELEMENT_NODE}function g6(t){const i=[],a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)i.push(a.currentNode);return i}function Od(t){const i=document.activeElement;return t.some(a=>a===i?!0:(a.focus(),document.activeElement!==i))}var y6=Db,Zb=Lb,Qb=Bb,Kb=Ub,Pb=Vb,Fb=Yb,Ib=Kh;const x6=y6,Jb=T.forwardRef(({className:t,...i},a)=>g.jsx(Zb,{ref:a,className:Ne("fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse gap-2 p-4 sm:flex-col md:max-w-[420px]",t),...i}));Jb.displayName=Zb.displayName;const v6=I1("group pointer-events-auto relative flex w-full items-center justify-between gap-4 overflow-hidden rounded-xl border p-4 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full",{variants:{variant:{default:"border-border/50 bg-zinc-900/95 text-foreground backdrop-blur-sm",success:"border-emerald-500/30 bg-emerald-950/95 text-emerald-50 backdrop-blur-sm",error:"border-red-500/30 bg-red-950/95 text-red-50 backdrop-blur-sm",info:"border-blue-500/30 bg-blue-950/95 text-blue-50 backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),Wb=T.forwardRef(({className:t,variant:i,...a},r)=>g.jsx(Qb,{ref:r,className:Ne(v6({variant:i}),t),...a}));Wb.displayName=Qb.displayName;const b6=T.forwardRef(({className:t,...i},a)=>g.jsx(Fb,{ref:a,className:Ne("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50",t),...i}));b6.displayName=Fb.displayName;const e2=T.forwardRef(({className:t,...i},a)=>g.jsx(Ib,{ref:a,className:Ne("absolute right-3 top-3 rounded-md p-1.5 cursor-pointer","text-foreground/40 hover:text-foreground hover:bg-white/10","transition-all duration-150","focus:outline-none focus:ring-2 focus:ring-white/20",t),"toast-close":"",...i,children:g.jsx(dh,{className:"h-4 w-4"})}));e2.displayName=Ib.displayName;const t2=T.forwardRef(({className:t,...i},a)=>g.jsx(Kb,{ref:a,className:Ne("text-sm font-semibold",t),...i}));t2.displayName=Kb.displayName;const n2=T.forwardRef(({className:t,...i},a)=>g.jsx(Pb,{ref:a,className:Ne("text-sm opacity-90",t),...i}));n2.displayName=Pb.displayName;const w6=({variant:t})=>{switch(t){case"success":return g.jsx(jE,{className:"h-5 w-5 text-emerald-400"});case"error":return g.jsx(Jx,{className:"h-5 w-5 text-red-400"});case"info":return g.jsx(iv,{className:"h-5 w-5 text-blue-400"});default:return null}};function Cx(){const{toasts:t,removeToast:i}=Mx();return g.jsxs(x6,{swipeDirection:"right",children:[t.map(a=>g.jsxs(Wb,{variant:a.variant,duration:a.duration??4e3,onOpenChange:r=>{r||i(a.id)},children:[g.jsxs("div",{className:"flex items-start gap-3",children:[g.jsx(w6,{variant:a.variant}),g.jsxs("div",{className:"flex flex-col gap-1",children:[g.jsx(t2,{children:a.title}),a.description&&g.jsx(n2,{children:a.description})]})]}),g.jsx(e2,{})]},a.id)),g.jsx(Jb,{})]})}function S6(){const{completed:t}=Xr();return t?g.jsxs(Ex,{children:[g.jsx(BN,{children:i=>{switch(i){case"architecture":return g.jsx(ax,{});case"files":return g.jsx(t_,{});case"security":return g.jsx(NM,{});default:return g.jsx(ax,{})}}}),g.jsx(Cx,{})]}):g.jsxs(Ex,{children:[g.jsx(CM,{}),g.jsx(Cx,{})]})}ph(mh.getState().theme);window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{mh.getState().theme==="system"&&ph("system")});yS.createRoot(document.getElementById("root")).render(g.jsx(T.StrictMode,{children:g.jsx(S6,{})}));
|
package/dist/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="theme-color" content="#18181b" />
|
|
8
8
|
<title>OpenClaw Memory Mapper</title>
|
|
9
9
|
<meta name="description" content="Visualize your Claude agent's memory architecture" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-C-wXdWV8.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-Lq-0Ml6V.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|