pi-mega-compact 0.20.82 → 0.20.84
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/dist/extensions/dashboard-server/routes-rag-settings-helpers.js +0 -1
- package/dist/extensions/mega-config.js +3 -2
- package/dist/extensions/mega-events/agent-handlers/turnEndHandler/recordTurnRow.js +0 -17
- package/dist/extensions/mega-events/context-handler/triggerGuard.js +86 -0
- package/dist/extensions/mega-events/context-handler.js +12 -0
- package/dist/extensions/mega-events/register.js +0 -3
- package/dist/src/failback/types.js +11 -0
- package/extensions/dashboard-client/dist/assets/{AdminTab-BTCZLMCc.js → AdminTab-BsA8-_bX.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AdminTab-BTCZLMCc.js.map → AdminTab-BsA8-_bX.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{AreaChart-BTMI0QnR.js → AreaChart-BRHEfWhc.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{AreaChart-BTMI0QnR.js.map → AreaChart-BRHEfWhc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{BarChart-C1F8wLM3.js → BarChart-C-M0LaFc.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{BarChart-C1F8wLM3.js.map → BarChart-C-M0LaFc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{CacheTab-ORjrhSbZ.js → CacheTab-Cj3n59U3.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-ORjrhSbZ.js.map → CacheTab-Cj3n59U3.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{ConfigTab-CtXVSxD_.js → ConfigTab-C016XTNC.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ConfigTab-CtXVSxD_.js.map → ConfigTab-C016XTNC.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-DQdwa9IB.js → EventsTab-DE29fuqe.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-DQdwa9IB.js.map → EventsTab-DE29fuqe.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-BpVO7BeO.js → HealthTab-D4eVI8ar.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-BpVO7BeO.js.map → HealthTab-D4eVI8ar.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Cl9mWaR8.js → MaintenanceTab-4fJ7M4S4.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-Cl9mWaR8.js.map → MaintenanceTab-4fJ7M4S4.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-D3kIPeCy.js → MemoryMapTab-CDbcK9e4.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-D3kIPeCy.js.map → MemoryMapTab-CDbcK9e4.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MetricsCards-Cu1zDkfm.js → MetricsCards-VUEcgGzo.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MetricsCards-Cu1zDkfm.js.map → MetricsCards-VUEcgGzo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-CKqJ0Zl-.js +2 -0
- package/extensions/dashboard-client/dist/assets/{MetricsTab-BAvMzWuF.js.map → MetricsTab-CKqJ0Zl-.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/OverviewTab-9Kxo79mi.js +16 -0
- package/extensions/dashboard-client/dist/assets/OverviewTab-9Kxo79mi.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{ReposTab-BUESjauJ.js → ReposTab-C4iveqrP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-BUESjauJ.js.map → ReposTab-C4iveqrP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DyJmQ_78.js → SessionsTab-DSEwkMQm.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SessionsTab-DyJmQ_78.js.map → SessionsTab-DSEwkMQm.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-q8wYL5A-.js → SetupTab-CCyWgy4O.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-q8wYL5A-.js.map → SetupTab-CCyWgy4O.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DIRH1Pq7.js → TimeSavedCard-CyD8e_e_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-DIRH1Pq7.js.map → TimeSavedCard-CyD8e_e_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-CrYSOcZX.js → TurnMemoryView-5tLbWkRv.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TurnMemoryView-CrYSOcZX.js.map → TurnMemoryView-5tLbWkRv.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-C7pm92Hg.js +2 -0
- package/extensions/dashboard-client/dist/assets/{TurnsTab-C0jARSvU.js.map → TurnsTab-C7pm92Hg.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-D83Fz939.js → VcStatusBadge-ObhcIyfN.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VcStatusBadge-D83Fz939.js.map → VcStatusBadge-ObhcIyfN.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-BFXh5Nu7.js → VectorCortexTab-BtHZb7o7.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{VectorCortexTab-BFXh5Nu7.js.map → VectorCortexTab-BtHZb7o7.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{WikiTab-CEdJXkou.js → WikiTab-lQ4l3QIK.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{WikiTab-CEdJXkou.js.map → WikiTab-lQ4l3QIK.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-BlRKWQsj.js → button-DhQQAJGm.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-BlRKWQsj.js.map → button-DhQQAJGm.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-Cx6WA_2T.js → card-Cfhz9X31.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-Cx6WA_2T.js.map → card-Cfhz9X31.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{client-extra-BRFScIiK.js → client-extra-CKNOGEz_.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{client-extra-BRFScIiK.js.map → client-extra-CKNOGEz_.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-DrkPNaOf.js → generateCategoricalChart-JKjK9_cB.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-DrkPNaOf.js.map → generateCategoricalChart-JKjK9_cB.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{index-DUnKr3wN.js → index-iuxgtzEW.js} +6 -6
- package/extensions/dashboard-client/dist/assets/index-iuxgtzEW.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-Wr0u4HKw.js → switch-7EHEQMSP.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-Wr0u4HKw.js.map → switch-7EHEQMSP.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-C_eSNeMT.js → toggle-z1lWY4UM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-C_eSNeMT.js.map → toggle-z1lWY4UM.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-C_oFqrwF.js → useSSE-sctOZuRM.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-C_oFqrwF.js.map → useSSE-sctOZuRM.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +1 -1
- package/extensions/dashboard-client/src/App.tsx +1 -11
- package/extensions/dashboard-client/src/components/RepoContextStack.tsx +21 -28
- package/extensions/dashboard-client/src/tabs/dashHashRouter.ts +1 -31
- package/extensions/dashboard-server/routes-rag-settings-helpers.ts +0 -6
- package/extensions/mega-config-types.ts +4 -3
- package/extensions/mega-config.ts +3 -2
- package/extensions/mega-events/agent-handlers/turnEndHandler/recordTurnRow.ts +0 -17
- package/extensions/mega-events/context-handler/triggerGuard.ts +137 -0
- package/extensions/mega-events/context-handler.ts +11 -0
- package/extensions/mega-events/register.ts +0 -3
- package/package.json +1 -1
- package/src/failback/types.ts +46 -0
- package/dist/extensions/mega-events/analytics-handler.js +0 -169
- package/dist/src/store/analytics/connection.js +0 -114
- package/dist/src/store/analytics/contract-compliance.test/_helpers.js +0 -39
- package/dist/src/store/analytics/index.js +0 -25
- package/dist/src/store/analytics/memory-store.js +0 -111
- package/dist/src/store/analytics/schema.js +0 -108
- package/dist/src/store/analytics/sqlite-store/admin.js +0 -84
- package/dist/src/store/analytics/sqlite-store/ctx.js +0 -1
- package/dist/src/store/analytics/sqlite-store/read.js +0 -25
- package/dist/src/store/analytics/sqlite-store/rows.js +0 -44
- package/dist/src/store/analytics/sqlite-store/write.js +0 -90
- package/dist/src/store/analytics/sqlite-store.js +0 -79
- package/dist/src/store/analytics/types.js +0 -17
- package/extensions/dashboard-client/dist/assets/MetricsTab-BAvMzWuF.js +0 -2
- package/extensions/dashboard-client/dist/assets/OverviewTab-CouEq0qi.js +0 -16
- package/extensions/dashboard-client/dist/assets/OverviewTab-CouEq0qi.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/TurnsTab-C0jARSvU.js +0 -2
- package/extensions/dashboard-client/dist/assets/index-DUnKr3wN.js.map +0 -1
- package/extensions/mega-events/analytics-handler.ts +0 -236
- package/src/store/analytics/connection.ts +0 -128
- package/src/store/analytics/contract-compliance.test/_helpers.ts +0 -47
- package/src/store/analytics/index.ts +0 -61
- package/src/store/analytics/memory-store.ts +0 -161
- package/src/store/analytics/schema.ts +0 -132
- package/src/store/analytics/sqlite-store/admin.ts +0 -96
- package/src/store/analytics/sqlite-store/ctx.ts +0 -9
- package/src/store/analytics/sqlite-store/read.ts +0 -46
- package/src/store/analytics/sqlite-store/rows.ts +0 -58
- package/src/store/analytics/sqlite-store/write.ts +0 -111
- package/src/store/analytics/sqlite-store.ts +0 -119
- package/src/store/analytics/types.ts +0 -202
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as dn,r as l,j as s,u as un,f as Yn,R as K,a as _e,b as Vn,d as qn,B as Jn,N as Qn}from"./index-iuxgtzEW.js";import{u as Zn}from"./useSSE-sctOZuRM.js";import{C as ye,a as Ae,b as Le,c as we}from"./card-Cfhz9X31.js";import{f as Re,a as Gt}from"./format-COjDIVGj.js";import{T as er,C as tr}from"./TimeSavedCard-CyD8e_e_.js";import{R as fn,C as hn,X as gn,Y as pn,T as mn,L as nr,B as rr}from"./generateCategoricalChart-JKjK9_cB.js";import{L as sr,B as or}from"./BarChart-C-M0LaFc.js";/**
|
|
2
|
+
* @license lucide-react v0.400.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ir=dn("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
7
|
+
* @license lucide-react v0.400.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ar=dn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xt=["#58a6ff","#3fb950","#d29922","#f85149","#bc8cff","#ff7b72","#79c0ff","#56d4dd","#e3b341","#a5d6ff","#7ee787","#ffa657"];function lr(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t}function cr(e){return e?xt[lr(e)%xt.length]:xt[0]}function dr(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function ur(e){const t=new Map;for(const i of e){const a=i.repoRoot??"__null__",c=i.tokens??0,d=t.get(a);if(d)d.tokens+=c;else{const u=dr(i.repoRoot);t.set(a,{repoRoot:i.repoRoot,basename:u,tokens:c,color:cr(u)})}}const n=[...t.values()],r=n.reduce((i,a)=>i+a.tokens,0),o=e.reduce((i,a)=>Math.max(i,a.ctxWindow),0);return{repos:n,totalTokens:r,maxWindow:o,sessionCount:e.length}}function bt(e){return e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function rt({children:e}){return s.jsxs(ye,{className:"electric-hover",children:[s.jsx(Ae,{children:s.jsx(Le,{children:"Context per Repo (live)"})}),s.jsx(we,{children:e})]})}function fr({sessions:e,loading:t,error:n}){const r=l.useRef(null);if(n)return s.jsx(rt,{children:s.jsxs("span",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]})});if(t&&!e)return s.jsx(rt,{children:s.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading sessions…"})});const o=e?.sessions??[],{repos:i,totalTokens:a,maxWindow:c,sessionCount:d}=ur(o);i.length>0&&(r.current={repos:i,totalTokens:a,maxWindow:c,sessionCount:d});const u=i.length>0?{repos:i,totalTokens:a,maxWindow:c,sessionCount:d}:r.current;if(!u)return s.jsx(rt,{children:s.jsx("span",{className:"text-sm text-muted-foreground",children:"No active sessions."})});const h=u.maxWindow>0?Math.round(u.totalTokens/u.maxWindow*100):0;return s.jsxs(rt,{children:[s.jsx("div",{className:"repo-stack-bar",role:"group","aria-label":"Per-repo context usage",children:u.repos.map(f=>{const v=u.totalTokens>0?f.tokens/u.totalTokens*100:0,g=u.totalTokens>0?v:0,p=`${f.basename}: ${bt(f.tokens)} tokens (${v.toFixed(1)}% of total)`;return s.jsx("div",{className:"repo-stack-segment",style:{width:`${Math.max(g,.5)}%`,backgroundColor:f.color},title:p,"aria-label":p},f.repoRoot??"__null__")})}),s.jsxs("p",{className:"repo-stack-total",children:[bt(u.totalTokens)," tokens across ",u.repos.length," ",u.repos.length===1?"repo":"repos"," /"," ",u.sessionCount," ",u.sessionCount===1?"session":"sessions"," ",s.jsxs("span",{className:"pct",children:["— ",h,"% of combined max window"]})]}),s.jsx("div",{className:"repo-stack-legend",children:u.repos.map(f=>{const v=u.totalTokens>0?f.tokens/u.totalTokens*100:0;return s.jsxs("div",{className:"repo-stack-legend-item",children:[s.jsx("span",{className:"repo-stack-legend-swatch",style:{backgroundColor:f.color}}),s.jsx("span",{className:"repo-stack-legend-name",children:f.basename}),s.jsxs("span",{children:[bt(f.tokens)," (",v.toFixed(0),"%)"]})]},f.repoRoot??"__null__")})})]})}function hr(e){return e>=90?"gauge-red":e>=70?"gauge-yellow":"gauge-green"}function gr(e){return e==null?"?":e>=1e5?`${(e/1e3).toFixed(0)}k`:e.toLocaleString()}function Yt(e){if(!e)return"(unknown)";const t=e.replace(/[\\/]+$/,"");if(!t)return"(unknown)";const n=t.split(/[\\/]/);return n[n.length-1]||t}function pr(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s ago`;const n=Math.floor(t/60);return n<60?`${n}m ago`:`${Math.floor(n/60)}h ${n%60}m ago`}function mr({data:e}){const t=Math.round((e.percent??0)*10)/10,n=Math.max(t,1),r=hr(t),o=gr(e.tokens),i=e.contextWindow.toLocaleString(),a=`${o} / ${i} tokens`;return s.jsxs("div",{className:`session-gauge ${e.isSelf?"session-gauge-self":""}`,children:[s.jsxs("div",{className:"session-gauge-head",children:[s.jsx("span",{className:"session-gauge-label",title:e.label,children:e.label}),s.jsxs("span",{className:"session-gauge-pct",children:[t,"%"]})]}),s.jsx("div",{className:`gauge-bar ${r}`,role:"meter","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${e.label}: ${t}%`,children:s.jsx("div",{className:"gauge-fill",style:{width:`${n}%`}})}),s.jsx("p",{className:"gauge-label session-gauge-sub",children:a}),e.sublabel&&s.jsx("p",{className:"session-gauge-meta truncate",title:e.sublabel,children:e.sublabel})]})}function vr({sessions:e,loading:t,error:n,launcherSessionId:r,launcher:o}){const i=Date.now(),a=(e?.sessions??[]).find(p=>p.sessionId===r),d=[{key:"self",label:a?Yt(a.repoRoot):"this session",sublabel:r??"",tokens:o.tokens,percent:o.percent,contextWindow:o.contextWindow,isSelf:!0}],u=(e?.sessions??[]).filter(p=>p.sessionId!==r);u.sort((p,m)=>m.lastSeen-p.lastSeen);const h=new Set,f=u.filter(p=>{if(p.tokens==null&&p.percent==null||p.percent!=null&&p.percent===0&&p.tokens!=null&&p.tokens>0)return!1;const m=p.repoRoot??`(pid:${p.pid})`;return h.has(m)?!1:(h.add(m),!0)});for(const p of f)d.push({key:p.sessionId,label:Yt(p.repoRoot),sublabel:`pid ${p.pid} · ${pr(i-p.lastSeen)}${p.model?` · ${p.model}`:""}`,tokens:p.tokens,percent:p.percent,contextWindow:p.ctxWindow||0,isSelf:!1});const v=n&&!e,g=t&&!e;return s.jsxs(ye,{className:"electric-hover session-gauges-card w-full",children:[s.jsx(Ae,{children:s.jsx(Le,{children:"Context per Session (live)"})}),s.jsx(we,{children:v?s.jsxs("div",{className:"text-sm text-muted-foreground",children:["Error loading sessions: ",n.message]}):g?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading sessions…"}):s.jsx("div",{className:"session-gauges-scroll",children:s.jsx("div",{className:"session-gauges-grid",children:d.map(p=>s.jsx(mr,{data:p},p.key))})})})]})}function Vt({state:e,label:t}){const n=e==="on"?"bullet-on":e==="na"?"bullet-na":"bullet-off";return s.jsxs("div",{className:`bullet ${n}`,children:[s.jsx("span",{className:"bullet-dot","aria-hidden":"true"}),s.jsx("span",{className:"bullet-label",children:t})]})}function xr({armed:e,ready:t}){const n=e?"on":"off",r=t?"on":e?"off":"na",o=t?"THRESHOLD EXCEEDED — compacting next event":e?"past fast gate — monitoring token count":"idle — below fast gate";return s.jsxs("div",{className:"card trigger-status",children:[s.jsx("h3",{children:"Trigger Status"}),s.jsxs("div",{className:"bullet-row",children:[s.jsx(Vt,{state:n,label:"Armed"}),s.jsx(Vt,{state:r,label:"Ready"})]}),s.jsx("p",{className:"trigger-state-text",children:o})]})}function br(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function ue({label:e,value:t,title:n}){return s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",title:n,children:e}),s.jsx("span",{className:"ov-stat-value",children:t})]})}function yr(e){const t=e.compressionPct,n=br(t),r=Math.max(t*100,.5),o=`${Re(t)} tokens saved · dedup: ${Re(e.dedupPct)}`;return s.jsxs("div",{className:"card vector-store-card",children:[s.jsx("h3",{children:"Vector Store (session)"}),s.jsx(ue,{label:"Checkpoints",value:e.checkpointCount.toLocaleString(),title:"A saved summary of a chunk of your conversation that was compacted to free up space."}),s.jsx(ue,{label:"Original (dropped)",value:e.tokensIn.toLocaleString(),title:"Total size of the original conversation text dropped into compaction this session, including redundant regions skipped by dedup. This is the 'in'."}),s.jsx(ue,{label:"Kept (summaries)",value:e.tokensOut.toLocaleString(),title:"Compact summaries we are currently holding as 'memory' for this session (the 'out'). Smaller is better."}),s.jsx(ue,{label:"Freed",value:e.tokensFreed.toLocaleString(),title:"Conversation space freed = dropped − kept (the 'saved')."}),s.jsx(ue,{label:"Injected",value:e.injectedCount,title:"How many times old context was automatically brought back into the conversation because it was relevant to what you were doing."}),s.jsx(ue,{label:"Recall Relevance",value:Re(e.dedupHitRate),title:"Of the times we recalled old context, how often it was actually on-topic."}),s.jsx(ue,{label:"Storage Dedup",value:Re(e.storageDedupRate),title:"How often new content matched something we already had, so we skipped storing a duplicate copy. Higher = less wasted space."}),s.jsx(ue,{label:"Collapsed",value:e.dedupCollapsed,title:"How many duplicate chunks we collapsed into one instead of storing separately."}),s.jsx(ue,{label:"Last ID",value:e.lastCheckpointId??"—",title:"The ID of the most recent saved checkpoint."}),s.jsxs("div",{className:"ov-compression-meter",children:[s.jsx("div",{className:"meter-track",children:s.jsx("div",{className:`meter-fill ${n}`,style:{width:`${r}%`}})}),s.jsx("span",{className:"meter-sub",children:o})]})]})}function wr(e){return e>=.9?"meter-green":e>=.6?"meter-yellow":"meter-red"}function Se({label:e,value:t}){return s.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e}),s.jsx("span",{className:"font-semibold",children:t})]})}function jr(e){const t=e.compressionPct,n=wr(t),r=Math.max(t*100,.5),o=`${Re(t)} tokens saved · dedup: ${Re(e.dedupPct)}`;return s.jsxs(ye,{className:"electric-hover",children:[s.jsx(Ae,{children:s.jsx(Le,{children:"Repo (all sessions)"})}),s.jsxs(we,{children:[s.jsx(Se,{label:"Checkpoints",value:e.checkpointCount.toLocaleString()}),s.jsx(Se,{label:"Original",value:e.tokensIn.toLocaleString()}),s.jsx(Se,{label:"Kept",value:e.tokensOut.toLocaleString()}),s.jsx(Se,{label:"Freed",value:e.tokensFreed.toLocaleString()}),s.jsx(Se,{label:"Sessions",value:e.sessionCount.toLocaleString()}),s.jsx(Se,{label:"Collapsed",value:e.dedupCollapsed}),s.jsx(Se,{label:"Storage Dedup",value:Re(e.storageDedupRate)}),s.jsxs("div",{children:[s.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-bg-elevated",children:s.jsx("div",{className:`meter-fill h-full ${n}`,style:{width:`${r}%`}})}),s.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:o})]})]})]})}function Sr(e){return s.jsxs("div",{className:"card data-safety-card",children:[s.jsx("h3",{children:"🛡 Data Safety"}),s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",children:"Regions Retained"}),s.jsx("span",{className:"ov-stat-value",children:e.regionsRetained.toLocaleString()})]}),s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",children:"Compressed-Original"}),s.jsx("span",{className:"ov-stat-value",children:Gt(e.compressedOriginalBytes)})]}),s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",children:"Dedup Duplicates"}),s.jsx("span",{className:"ov-stat-value",children:e.duplicatesCollapsed.toLocaleString()})]}),s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",children:"Permanently Deleted"}),s.jsx("span",{className:"ov-stat-value ov-value-ok",children:Gt(e.bytesPermanentlyDeleted)})]}),s.jsx("p",{className:"safe-note",children:'Every compacted region is kept verbatim (compressed). "Drop" = removed from the live window only. We never delete your data.'})]})}function Ce({label:e,value:t,title:n}){return s.jsxs("div",{className:"ov-stat-row",children:[s.jsx("span",{className:"ov-stat-label",title:n,children:e}),s.jsx("span",{className:"ov-stat-value",children:t})]})}function Cr(e){const t=`${Math.round((e.pressure??0)*100)}%`;let n=e.thresholdTokens.toLocaleString();return e.tierPct!=null&&e.contextWindow>0&&(n+=` (${Math.round(e.tierPct*100)}% of ${e.contextWindow.toLocaleString()})`),s.jsxs("div",{className:"card config-summary-card",children:[s.jsx("h3",{children:"Configuration"}),s.jsx(Ce,{label:"Tier",value:`${e.tier} (live)`,title:"Live pressure band — climbs low→mega as context fills the window."}),s.jsx(Ce,{label:"Preset",value:e.presetTier,title:"The env-resolved base compaction preset (low/medium/high/ultra/mega) that set the token threshold."}),s.jsx(Ce,{label:"Pressure",value:t,title:"Live pressure = currentTokens / threshold — % of the model context window (threshold fires at the tier's % of window)."}),s.jsx(Ce,{label:"Threshold",value:n,title:"Compaction threshold = tierPct × model context window — mega-compact trims BELOW pi's native ~80% auto-compact for any model size."}),s.jsx(Ce,{label:"Fast Gate",value:`${e.fastGatePct}%`,title:"Fast-gate arming floor — the live trim arms once context passes this % of the window."}),s.jsx(Ce,{label:"Auto",value:e.auto?"enabled":"disabled"}),s.jsx(Ce,{label:"Anchor",value:String(e.anchorUserMessages)})]})}function st({label:e,value:t,title:n}){return s.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",title:n,children:e}),s.jsx("span",{className:"font-semibold",children:t})]})}function Rr(e){const t=e.repoTokensFreed||0;let n=0,r="0";if(e.inputRate&&t>0){n=t*e.inputRate;const a=e.contextWindow||0;r=a>0?(t/a).toFixed(1):"0"}const o=`≈ $${n.toFixed(4)} saved`,i=`${r} context-windows extended`;return s.jsxs(ye,{className:"electric-hover",children:[s.jsx(Ae,{children:s.jsx(Le,{children:"💰 Model & Cost Savings"})}),s.jsxs(we,{children:[s.jsx("div",{className:"text-neon text-xl font-semibold",children:o}),s.jsx("div",{className:"mb-2 text-xs text-muted-foreground",children:i}),s.jsx(st,{label:"Model",value:e.name,title:"The model pi is currently using — its pricing drives the cost figure."}),s.jsx(st,{label:"Provider",value:e.provider,title:"The provider serving the model."}),s.jsx(st,{label:"Input Rate",value:`$${e.inputRate.toFixed(6)}`,title:"USD per input token, from the model's pricing."}),s.jsx(st,{label:"Output Rate",value:`$${e.outputRate.toFixed(6)}`,title:"USD per output token, from the model's pricing."})]})]})}function Dr(e){const{activeAgents:t,currentTurn:n}=e,r=t>0?`▶ ${t} running`:"idle";return s.jsxs(ye,{className:"electric-hover",children:[s.jsx(Ae,{children:s.jsx(Le,{children:"Crew / Agents"})}),s.jsxs(we,{children:[s.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Active Agents"}),s.jsx("span",{className:"font-semibold",children:t})]}),s.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Current Turn"}),s.jsx("span",{className:"font-semibold",children:n})]}),s.jsxs("div",{className:"flex items-baseline justify-between py-1 text-sm",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Status"}),s.jsx("span",{className:"font-semibold",children:r})]})]})]})}const kr=[s.jsxs("li",{children:[s.jsx("b",{children:"Original (dropped)"}),' — everything compacted away (including duplicates caught by dedup). The "in."']},"1"),s.jsxs("li",{children:[s.jsx("b",{children:"Kept (summaries)"}),' — compact summaries still held as "memory" (the "out").']},"2"),s.jsxs("li",{children:[s.jsx("b",{children:"Freed"})," = dropped − kept — tokens saved so far (higher = better)."]},"3"),s.jsxs("li",{children:[s.jsx("b",{children:"Compression %"})," — Freed ÷ Dropped — the headline efficiency number. Higher = more space reclaimed."]},"4"),s.jsxs("li",{children:[s.jsx("b",{children:"Storage dedup %"})," — how often new content matched something already saved, so no duplicate copy was written."]},"5"),s.jsxs("li",{children:[s.jsx("b",{children:"Data safety"})," — every compacted region is kept verbatim (compressed). Nothing is permanently deleted; you can restore any of it."]},"6")];function Nr(){return s.jsx(ye,{children:s.jsx(we,{children:s.jsxs("details",{children:[s.jsx("summary",{className:"cursor-pointer text-sm font-semibold",children:"What these numbers mean"}),s.jsx("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm",children:kr}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Hover any label above for a quick explanation."})]})})})}const Er=()=>{const{data:e}=un(l.useMemo(()=>()=>Yn(),[]),{pollInterval:3e4});if(!e)return s.jsx(ye,{children:s.jsx(we,{className:"text-sm text-muted-foreground",children:"Loading RAG health…"})});const{totals:t,flags:n}=e,r=n.hydeEnabled||n.recallMetricsEnabled;return s.jsxs(ye,{children:[s.jsx(Ae,{children:s.jsxs(Le,{className:"flex items-center gap-2",children:[s.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${r?"bg-success":"bg-muted-foreground"}`,"aria-hidden":"true"}),"RAG Health"]})}),s.jsx(we,{children:r?s.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:"Pass rate"}),s.jsxs("dd",{className:"font-semibold text-foreground",children:[Math.round(t.recentPassRate*100),"%"]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:"Avg lift"}),s.jsxs("dd",{className:"font-semibold text-foreground",children:[t.avgLift.toFixed(2),"×"]})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:"Telemetry turns"}),s.jsx("dd",{className:"font-semibold text-foreground",children:t.telemetryTurns})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs text-muted-foreground",children:"HyDE ran"}),s.jsx("dd",{className:"font-semibold text-foreground",children:t.hydeRanTurns})]})]}):s.jsx("div",{className:"text-sm text-muted-foreground",children:"All RAG recall feature flags are off."})})]})};function ot({title:e,open:t,onClose:n,children:r}){return l.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&n()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,n]),t?s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",onClick:n,role:"dialog","aria-modal":"true","aria-label":e,children:s.jsxs("div",{className:"max-h-[80vh] w-full max-w-3xl overflow-y-auto rounded-lg border border-border bg-bg-card p-5",onClick:o=>o.stopPropagation(),children:[s.jsxs("header",{className:"mb-4 flex items-center justify-between gap-4",children:[s.jsx("h2",{className:"font-heading text-lg font-semibold",children:e}),s.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground",onClick:n,"aria-label":"Close",children:s.jsx(ar,{size:22,strokeWidth:2})})]}),r]})}):s.jsx(s.Fragment,{})}const yt="#8b949e",Tr="#30363d",Mr={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function qt(e){return new Date(e).toLocaleTimeString()}function Jt(e){return Number.isFinite(e),String(e)}function wt({data:e,label:t="value",color:n="#58a6ff",height:r=280}){if(!e||e.length===0)return s.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"});const o=`perf-line-${n.replace(/[^a-zA-Z0-9]/g,"")}`;return s.jsx(fn,{width:"100%",height:r,children:s.jsxs(sr,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:n,stopOpacity:.7}),s.jsx("stop",{offset:"95%",stopColor:n,stopOpacity:.15})]})}),s.jsx(hn,{strokeDasharray:"3 3",stroke:Tr}),s.jsx(gn,{dataKey:"ts",type:"number",domain:["dataMin","dataMax"],scale:"time",tickFormatter:i=>qt(i),stroke:yt,tick:{fontSize:11}}),s.jsx(pn,{dataKey:"value",stroke:yt,tick:{fontSize:11},width:56,tickFormatter:i=>Jt(i)}),s.jsx(mn,{labelFormatter:i=>qt(i),formatter:i=>[Jt(i),t],contentStyle:Mr,labelStyle:{color:yt,fontSize:12}}),s.jsx(nr,{type:"monotone",dataKey:"value",name:t,stroke:n,strokeWidth:2,dot:!1,fill:`url(#${o})`,isAnimationActive:!1})]})})}const jt="#8b949e",Or="#30363d",Ar={background:"#161b22",border:"1px solid #30363d",borderRadius:"6px",color:"#e6edf3"};function Lr({data:e,color:t="#3fb950",height:n=280,valueFormatter:r}){const o=r??(i=>String(i));return!e||e.length===0?s.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No data available"}):s.jsx(fn,{width:"100%",height:n,children:s.jsxs(or,{data:e,margin:{top:8,right:16,left:0,bottom:0},children:[s.jsx(hn,{strokeDasharray:"3 3",stroke:Or}),s.jsx(gn,{dataKey:"label",stroke:jt,tick:{fontSize:11},interval:0,angle:-20,textAnchor:"end",height:56}),s.jsx(pn,{dataKey:"value",stroke:jt,tick:{fontSize:11},width:56,tickFormatter:i=>o(i)}),s.jsx(mn,{formatter:i=>[o(i),"value"],contentStyle:Ar,labelStyle:{color:jt,fontSize:12}}),s.jsx(rr,{dataKey:"value",fill:t,radius:[4,4,0,0],isAnimationActive:!1})]})})}function Ir(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const ft=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ie(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ot(e){return"nodeType"in e}function U(e){var t,n;return e?Ie(e)?e:Ot(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function At(e){const{Document:t}=U(e);return e instanceof t}function Je(e){return Ie(e)?!1:e instanceof U(e).HTMLElement}function vn(e){return e instanceof U(e).SVGElement}function Pe(e){return e?Ie(e)?e.document:Ot(e)?At(e)?e:Je(e)||vn(e)?e.ownerDocument:document:document:document}const ie=ft?l.useLayoutEffect:l.useEffect;function Lt(e){const t=l.useRef(e);return ie(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Pr(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ye(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return ie(()=>{n.current!==e&&(n.current=e)},t),n}function Qe(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function lt(e){const t=Lt(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function kt(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let St={};function Ze(e,t){return l.useMemo(()=>{if(t)return t;const n=St[e]==null?0:St[e]+1;return St[e]=n,e+"-"+n},[e,t])}function xn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const c=Object.entries(a);for(const[d,u]of c){const h=i[d];h!=null&&(i[d]=h+e*u)}return i},{...t})}}const Oe=xn(1),ct=xn(-1);function $r(e){return"clientX"in e&&"clientY"in e}function It(e){if(!e)return!1;const{KeyboardEvent:t}=U(e.target);return t&&e instanceof t}function Fr(e){if(!e)return!1;const{TouchEvent:t}=U(e.target);return t&&e instanceof t}function Nt(e){if(Fr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return $r(e)?{x:e.clientX,y:e.clientY}:null}const Ve=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ve.Translate.toString(e),Ve.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function zr(e){return e.matches(Qt)?e:e.querySelector(Qt)}const Br={display:"none"};function Wr(e){let{id:t,value:n}=e;return K.createElement("div",{id:t,style:Br},n)}function Hr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return K.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function _r(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const bn=l.createContext(null);function Xr(e){const t=l.useContext(bn);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Kr(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,i)})},[e]),t]}const Ur={draggable:`
|
|
12
|
+
To pick up a draggable item, press the space bar.
|
|
13
|
+
While dragging, use the arrow keys to move the item.
|
|
14
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
15
|
+
`},Gr={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Yr(e){let{announcements:t=Gr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Ur}=e;const{announce:i,announcement:a}=_r(),c=Ze("DndLiveRegion"),[d,u]=l.useState(!1);if(l.useEffect(()=>{u(!0)},[]),Xr(l.useMemo(()=>({onDragStart(f){let{active:v}=f;i(t.onDragStart({active:v}))},onDragMove(f){let{active:v,over:g}=f;t.onDragMove&&i(t.onDragMove({active:v,over:g}))},onDragOver(f){let{active:v,over:g}=f;i(t.onDragOver({active:v,over:g}))},onDragEnd(f){let{active:v,over:g}=f;i(t.onDragEnd({active:v,over:g}))},onDragCancel(f){let{active:v,over:g}=f;i(t.onDragCancel({active:v,over:g}))}}),[i,t])),!d)return null;const h=K.createElement(K.Fragment,null,K.createElement(Wr,{id:r,value:o.draggable}),K.createElement(Hr,{id:c,announcement:a}));return n?_e.createPortal(h,n):h}var I;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(I||(I={}));function dt(){}const te=Object.freeze({x:0,y:0});function Vr(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function qr(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Jr(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,c=i-n;if(r<o&&n<i){const d=t.width*t.height,u=e.width*e.height,h=a*c,f=h/(d+u-h);return Number(f.toFixed(4))}return 0}const Qr=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,c=n.get(a);if(c){const d=Jr(c,t);d>0&&o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(Vr)};function Zr(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function yn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function es(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...n})}}const ts=es(1);function ns(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function rs(e,t,n){const r=ns(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:c}=r,d=e.left-a-(1-o)*parseFloat(n),u=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=o?e.width/o:e.width,f=i?e.height/i:e.height;return{width:h,height:f,top:u,right:d+h,bottom:u+f,left:d}}const ss={ignoreTransform:!1};function $e(e,t){t===void 0&&(t=ss);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:h}=U(e).getComputedStyle(e);u&&(n=rs(n,u,h))}const{top:r,left:o,width:i,height:a,bottom:c,right:d}=n;return{top:r,left:o,width:i,height:a,bottom:c,right:d}}function Zt(e){return $e(e,{ignoreTransform:!0})}function os(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function is(e,t){return t===void 0&&(t=U(e).getComputedStyle(e)),t.position==="fixed"}function as(e,t){t===void 0&&(t=U(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Pt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(At(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Je(o)||vn(o)||n.includes(o))return n;const i=U(e).getComputedStyle(o);return o!==e&&as(o,i)&&n.push(o),is(o,i)?n:r(o.parentNode)}return e?r(e):n}function wn(e){const[t]=Pt(e,1);return t??null}function Ct(e){return!ft||!e?null:Ie(e)?e:Ot(e)?At(e)||e===Pe(e).scrollingElement?window:Je(e)?e:null:null}function jn(e){return Ie(e)?e.scrollX:e.scrollLeft}function Sn(e){return Ie(e)?e.scrollY:e.scrollTop}function Et(e){return{x:jn(e),y:Sn(e)}}var $;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($||($={}));function Cn(e){return!ft||!e?!1:e===document.scrollingElement}function Rn(e){const t={x:0,y:0},n=Cn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:c,maxScroll:r,minScroll:t}}const ls={x:.2,y:.2};function cs(e,t,n,r,o){let{top:i,left:a,right:c,bottom:d}=n;r===void 0&&(r=10),o===void 0&&(o=ls);const{isTop:u,isBottom:h,isLeft:f,isRight:v}=Rn(e),g={x:0,y:0},p={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+m.height?(g.y=$.Backward,p.y=r*Math.abs((t.top+m.height-i)/m.height)):!h&&d>=t.bottom-m.height&&(g.y=$.Forward,p.y=r*Math.abs((t.bottom-m.height-d)/m.height)),!v&&c>=t.right-m.width?(g.x=$.Forward,p.x=r*Math.abs((t.right-m.width-c)/m.width)):!f&&a<=t.left+m.width&&(g.x=$.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:g,speed:p}}function ds(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Dn(e){return e.reduce((t,n)=>Oe(t,Et(n)),te)}function us(e){return e.reduce((t,n)=>t+jn(n),0)}function fs(e){return e.reduce((t,n)=>t+Sn(n),0)}function hs(e,t){if(t===void 0&&(t=$e),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);wn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gs=[["x",["left","right"],us],["y",["top","bottom"],fs]];class $t{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Pt(n),o=Dn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,c]of gs)for(const d of a)Object.defineProperty(this,d,{get:()=>{const u=c(r),h=o[i]-u;return this.rect[d]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xe{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ps(e){const{EventTarget:t}=U(e);return e instanceof t?e:Pe(e)}function Rt(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Q;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Q||(Q={}));function en(e){e.preventDefault()}function ms(e){e.stopPropagation()}var N;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(N||(N={}));const kn={start:[N.Space,N.Enter],cancel:[N.Esc],end:[N.Space,N.Enter,N.Tab]},vs=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case N.Right:return{...n,x:n.x+25};case N.Left:return{...n,x:n.x-25};case N.Down:return{...n,y:n.y+25};case N.Up:return{...n,y:n.y-25}}};class Nn{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xe(Pe(n)),this.windowListeners=new Xe(U(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Q.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&hs(r),n(te)}handleKeyDown(t){if(It(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=kn,coordinateGetter:a=vs,scrollBehavior:c="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=r.current,h=u?{x:u.left,y:u.top}:te;this.referenceCoordinates||(this.referenceCoordinates=h);const f=a(t,{active:n,context:r.current,currentCoordinates:h});if(f){const v=ct(f,h),g={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const x=t.code,{isTop:C,isRight:R,isLeft:S,isBottom:D,maxScroll:k,minScroll:y}=Rn(m),j=ds(m),b={x:Math.min(x===N.Right?j.right-j.width/2:j.right,Math.max(x===N.Right?j.left:j.left+j.width/2,f.x)),y:Math.min(x===N.Down?j.bottom-j.height/2:j.bottom,Math.max(x===N.Down?j.top:j.top+j.height/2,f.y))},M=x===N.Right&&!R||x===N.Left&&!S,O=x===N.Down&&!D||x===N.Up&&!C;if(M&&b.x!==f.x){const E=m.scrollLeft+v.x,_=x===N.Right&&E<=k.x||x===N.Left&&E>=y.x;if(_&&!v.y){m.scrollTo({left:E,behavior:c});return}_?g.x=m.scrollLeft-E:g.x=x===N.Right?m.scrollLeft-k.x:m.scrollLeft-y.x,g.x&&m.scrollBy({left:-g.x,behavior:c});break}else if(O&&b.y!==f.y){const E=m.scrollTop+v.y,_=x===N.Down&&E<=k.y||x===N.Up&&E>=y.y;if(_&&!v.x){m.scrollTo({top:E,behavior:c});return}_?g.y=m.scrollTop-E:g.y=x===N.Down?m.scrollTop-k.y:m.scrollTop-y.y,g.y&&m.scrollBy({top:-g.y,behavior:c});break}}this.handleMove(t,Oe(ct(f,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Nn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=kn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=i.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function tn(e){return!!(e&&"distance"in e)}function nn(e){return!!(e&&"delay"in e)}class Ft{constructor(t,n,r){var o;r===void 0&&(r=ps(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=Pe(a),this.documentListeners=new Xe(this.document),this.listeners=new Xe(r),this.windowListeners=new Xe(U(a)),this.initialCoordinates=(o=Nt(i))!=null?o:te,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.DragStart,en),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),this.windowListeners.add(Q.ContextMenu,en),this.documentListeners.add(Q.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(tn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Q.Click,ms,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Q.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:c}}=i;if(!o)return;const d=(n=Nt(t))!=null?n:te,u=ct(o,d);if(!r&&c){if(tn(c)){if(c.tolerance!=null&&Rt(u,c.tolerance))return this.handleCancel();if(Rt(u,c.distance))return this.handleStart()}if(nn(c)&&Rt(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===N.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const xs={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class En extends Ft{constructor(t){const{event:n}=t,r=Pe(n.target);super(t,xs,r)}}En.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const bs={move:{name:"mousemove"},end:{name:"mouseup"}};var Tt;(function(e){e[e.RightClick=2]="RightClick"})(Tt||(Tt={}));class ys extends Ft{constructor(t){super(t,bs,Pe(t.event.target))}}ys.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Tt.RightClick?!1:(r?.({event:n}),!0)}}];const Dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ws extends Ft{constructor(t){super(t,Dt)}static setup(){return window.addEventListener(Dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Dt.move.name,t)};function t(){}}}ws.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ke;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ke||(Ke={}));var ut;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ut||(ut={}));function js(e){let{acceleration:t,activator:n=Ke.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:c=ut.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:h,delta:f,threshold:v}=e;const g=Cs({delta:f,disabled:!i}),[p,m]=Pr(),x=l.useRef({x:0,y:0}),C=l.useRef({x:0,y:0}),R=l.useMemo(()=>{switch(n){case Ke.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Ke.DraggableRect:return o}},[n,o,d]),S=l.useRef(null),D=l.useCallback(()=>{const y=S.current;if(!y)return;const j=x.current.x*C.current.x,b=x.current.y*C.current.y;y.scrollBy(j,b)},[]),k=l.useMemo(()=>c===ut.TreeOrder?[...u].reverse():u,[c,u]);l.useEffect(()=>{if(!i||!u.length||!R){m();return}for(const y of k){if(r?.(y)===!1)continue;const j=u.indexOf(y),b=h[j];if(!b)continue;const{direction:M,speed:O}=cs(y,b,R,t,v);for(const E of["x","y"])g[E][M[E]]||(O[E]=0,M[E]=0);if(O.x>0||O.y>0){m(),S.current=y,p(D,a),x.current=O,C.current=M;return}}x.current={x:0,y:0},C.current={x:0,y:0},m()},[t,D,r,m,i,a,JSON.stringify(R),JSON.stringify(g),p,u,k,h,JSON.stringify(v)])}const Ss={x:{[$.Backward]:!1,[$.Forward]:!1},y:{[$.Backward]:!1,[$.Forward]:!1}};function Cs(e){let{delta:t,disabled:n}=e;const r=kt(t);return Qe(o=>{if(n||!r||!o)return Ss;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[$.Backward]:o.x[$.Backward]||i.x===-1,[$.Forward]:o.x[$.Forward]||i.x===1},y:{[$.Backward]:o.y[$.Backward]||i.y===-1,[$.Forward]:o.y[$.Forward]||i.y===1}}},[n,t,r])}function Rs(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Qe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function Ds(e,t){return l.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Mt;(function(e){e.Optimized="optimized"})(Mt||(Mt={}));const rn=new Map;function ks(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=l.useState(null),{frequency:c,measure:d,strategy:u}=o,h=l.useRef(e),f=x(),v=Ye(f),g=l.useCallback(function(C){C===void 0&&(C=[]),!v.current&&a(R=>R===null?C:R.concat(C.filter(S=>!R.includes(S))))},[v]),p=l.useRef(null),m=Qe(C=>{if(f&&!n)return rn;if(!C||C===rn||h.current!==e||i!=null){const R=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){R.set(S.id,S.rect.current);continue}const D=S.node.current,k=D?new $t(d(D),D):null;S.rect.current=k,k&&R.set(S.id,k)}return R}return C},[e,i,n,f,d]);return l.useEffect(()=>{h.current=e},[e]),l.useEffect(()=>{f||g()},[n,f]),l.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),l.useEffect(()=>{f||typeof c!="number"||p.current!==null||(p.current=setTimeout(()=>{g(),p.current=null},c))},[c,f,g,...r]),{droppableRects:m,measureDroppableContainers:g,measuringScheduled:i!=null};function x(){switch(u){case qe.Always:return!1;case qe.BeforeDragging:return n;default:return!n}}}function Tn(e,t){return Qe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Ns(e,t){return Tn(e,t)}function Es(e){let{callback:t,disabled:n}=e;const r=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function ht(e){let{callback:t,disabled:n}=e;const r=Lt(t),o=l.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function Ts(e){return new $t($e(e),e)}function sn(e,t,n){t===void 0&&(t=Ts);const[r,o]=l.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??n)!=null?u:null}const h=t(e);return JSON.stringify(d)===JSON.stringify(h)?d:h})}const a=Es({callback(d){if(e)for(const u of d){const{type:h,target:f}=u;if(h==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),c=ht({callback:i});return ie(()=>{i(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function Ms(e){const t=Tn(e);return yn(e,t)}const on=[];function Os(e){const t=l.useRef(e),n=Qe(r=>e?r&&r!==on&&e&&t.current&&e.parentNode===t.current.parentNode?r:Pt(e):on,[e]);return l.useEffect(()=>{t.current=e},[e]),n}function As(e){const[t,n]=l.useState(null),r=l.useRef(e),o=l.useCallback(i=>{const a=Ct(i.target);a&&n(c=>c?(c.set(a,Et(a)),new Map(c)):null)},[]);return l.useEffect(()=>{const i=r.current;if(e!==i){a(i);const c=e.map(d=>{const u=Ct(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Et(u)]):null}).filter(d=>d!=null);n(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(i)};function a(c){c.forEach(d=>{const u=Ct(d);u?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Oe(i,a),te):Dn(e):te,[e,t])}function an(e,t){t===void 0&&(t=[]);const n=l.useRef(null);return l.useEffect(()=>{n.current=null},t),l.useEffect(()=>{const r=e!==te;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ct(e,n.current):te}function Ls(e){l.useEffect(()=>{if(!ft)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Is(e,t){return l.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function Mn(e){return l.useMemo(()=>e?os(e):null,[e])}const ln=[];function Ps(e,t){t===void 0&&(t=$e);const[n]=e,r=Mn(n?U(n):null),[o,i]=l.useState(ln);function a(){i(()=>e.length?e.map(d=>Cn(d)?r:new $t(t(d),d)):ln)}const c=ht({callback:a});return ie(()=>{c?.disconnect(),a(),e.forEach(d=>c?.observe(d))},[e]),o}function $s(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Je(t)?t:e}function Fs(e){let{measure:t}=e;const[n,r]=l.useState(null),o=l.useCallback(u=>{for(const{target:h}of u)if(Je(h)){r(f=>{const v=t(h);return f?{...f,width:v.width,height:v.height}:v});break}},[t]),i=ht({callback:o}),a=l.useCallback(u=>{const h=$s(u);i?.disconnect(),h&&i?.observe(h),r(h?t(h):null)},[t,i]),[c,d]=lt(a);return l.useMemo(()=>({nodeRef:c,rect:n,setRef:d}),[n,c,d])}const zs=[{sensor:En,options:{}},{sensor:Nn,options:{}}],Bs={current:{}},at={draggable:{measure:Zt},droppable:{measure:Zt,strategy:qe.WhileDragging,frequency:Mt.Optimized},dragOverlay:{measure:$e}};class Ue extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Ws={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:at,measureDroppableContainers:dt,windowRect:null,measuringScheduled:!1},Hs={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dt,draggableNodes:new Map,over:null,measureDroppableContainers:dt},gt=l.createContext(Hs),On=l.createContext(Ws);function _s(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function Xs(e,t){switch(t.type){case I.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case I.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case I.DragEnd:case I.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case I.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ue(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case I.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Ue(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case I.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ue(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Ks(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l.useContext(gt),i=kt(r),a=kt(n?.id);return l.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!It(i)||document.activeElement===i.target)return;const c=o.get(a);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const h of[d.current,u.current]){if(!h)continue;const f=zr(h);if(f){f.focus();break}}})}},[r,t,o,a,i]),null}function Us(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Gs(e){return l.useMemo(()=>({draggable:{...at.draggable,...e?.draggable},droppable:{...at.droppable,...e?.droppable},dragOverlay:{...at.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ys(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;ie(()=>{if(!a&&!c||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const h=n(u),f=yn(h,r);if(a||(f.x=0),c||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const v=wn(u);v&&v.scrollBy({top:f.y,left:f.x})}},[t,a,c,r,n])}const An=l.createContext({...te,scaleX:1,scaleY:1});var be;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(be||(be={}));const Vs=l.memo(function(t){var n,r,o,i;let{id:a,accessibility:c,autoScroll:d=!0,children:u,sensors:h=zs,collisionDetection:f=Qr,measuring:v,modifiers:g,...p}=t;const m=l.useReducer(Xs,void 0,_s),[x,C]=m,[R,S]=Kr(),[D,k]=l.useState(be.Uninitialized),y=D===be.Initialized,{draggable:{active:j,nodes:b,translate:M},droppable:{containers:O}}=x,E=j!=null?b.get(j):null,_=l.useRef({initial:null,translated:null}),G=l.useMemo(()=>{var W;return j!=null?{id:j,data:(W=E?.data)!=null?W:Bs,rect:_}:null},[j,E]),z=l.useRef(null),[fe,ae]=l.useState(null),[P,je]=l.useState(null),X=Ye(p,Object.values(p)),ne=Ze("DndDescribedBy",a),Z=l.useMemo(()=>O.getEnabled(),[O]),B=Gs(v),{droppableRects:w,measureDroppableContainers:L,measuringScheduled:A}=ks(Z,{dragging:y,dependencies:[M.x,M.y],config:B.droppable}),H=Rs(b,j),et=l.useMemo(()=>P?Nt(P):null,[P]),he=Gn(),le=Ns(H,B.draggable.measure);Ys({activeNode:j!=null?b.get(j):null,config:he.layoutShiftCompensation,initialRect:le,measure:B.draggable.measure});const T=sn(H,B.draggable.measure,le),Fe=sn(H?H.parentElement:null),re=l.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:w,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),De=O.getNodeFor((n=re.current.over)==null?void 0:n.id),ce=Fs({measure:B.dragOverlay.measure}),ke=(r=ce.nodeRef.current)!=null?r:H,Ne=y?(o=ce.rect)!=null?o:T:null,zt=!!(ce.nodeRef.current&&ce.rect),Bt=Ms(zt?null:T),pt=Mn(ke?U(ke):null),ge=Os(y?De??H:null),tt=Ps(ge),nt=Us(g,{transform:{x:M.x-Bt.x,y:M.y-Bt.y,scaleX:1,scaleY:1},activatorEvent:P,active:G,activeNodeRect:T,containerNodeRect:Fe,draggingNodeRect:Ne,over:re.current.over,overlayNodeRect:ce.rect,scrollableAncestors:ge,scrollableAncestorRects:tt,windowRect:pt}),Wt=et?Oe(et,M):null,Ht=As(ge),Bn=an(Ht),Wn=an(Ht,[T]),Ee=Oe(nt,Bn),Te=Ne?ts(Ne,nt):null,ze=G&&Te?f({active:G,collisionRect:Te,droppableRects:w,droppableContainers:Z,pointerCoordinates:Wt}):null,_t=qr(ze,"id"),[pe,Xt]=l.useState(null),Hn=zt?nt:Oe(nt,Wn),_n=Zr(Hn,(i=pe?.rect)!=null?i:null,T),mt=l.useRef(null),Kt=l.useCallback((W,Y)=>{let{sensor:V,options:me}=Y;if(z.current==null)return;const J=b.get(z.current);if(!J)return;const q=W.nativeEvent,se=new V({active:z.current,activeNode:J,event:q,options:me,context:re,onAbort(F){if(!b.get(F))return;const{onDragAbort:oe}=X.current,de={id:F};oe?.(de),R({type:"onDragAbort",event:de})},onPending(F,ve,oe,de){if(!b.get(F))return;const{onDragPending:We}=X.current,xe={id:F,constraint:ve,initialCoordinates:oe,offset:de};We?.(xe),R({type:"onDragPending",event:xe})},onStart(F){const ve=z.current;if(ve==null)return;const oe=b.get(ve);if(!oe)return;const{onDragStart:de}=X.current,Be={activatorEvent:q,active:{id:ve,data:oe.data,rect:_}};_e.unstable_batchedUpdates(()=>{de?.(Be),k(be.Initializing),C({type:I.DragStart,initialCoordinates:F,active:ve}),R({type:"onDragStart",event:Be}),ae(mt.current),je(q)})},onMove(F){C({type:I.DragMove,coordinates:F})},onEnd:Me(I.DragEnd),onCancel:Me(I.DragCancel)});mt.current=se;function Me(F){return async function(){const{active:oe,collisions:de,over:Be,scrollAdjustedTranslate:We}=re.current;let xe=null;if(oe&&We){const{cancelDrop:He}=X.current;xe={activatorEvent:q,active:oe,collisions:de,delta:We,over:Be},F===I.DragEnd&&typeof He=="function"&&await Promise.resolve(He(xe))&&(F=I.DragCancel)}z.current=null,_e.unstable_batchedUpdates(()=>{C({type:F}),k(be.Uninitialized),Xt(null),ae(null),je(null),mt.current=null;const He=F===I.DragEnd?"onDragEnd":"onDragCancel";if(xe){const vt=X.current[He];vt?.(xe),R({type:He,event:xe})}})}}},[b]),Xn=l.useCallback((W,Y)=>(V,me)=>{const J=V.nativeEvent,q=b.get(me);if(z.current!==null||!q||J.dndKit||J.defaultPrevented)return;const se={active:q};W(V,Y.options,se)===!0&&(J.dndKit={capturedBy:Y.sensor},z.current=me,Kt(V,Y))},[b,Kt]),Ut=Ds(h,Xn);Ls(h),ie(()=>{T&&D===be.Initializing&&k(be.Initialized)},[T,D]),l.useEffect(()=>{const{onDragMove:W}=X.current,{active:Y,activatorEvent:V,collisions:me,over:J}=re.current;if(!Y||!V)return;const q={active:Y,activatorEvent:V,collisions:me,delta:{x:Ee.x,y:Ee.y},over:J};_e.unstable_batchedUpdates(()=>{W?.(q),R({type:"onDragMove",event:q})})},[Ee.x,Ee.y]),l.useEffect(()=>{const{active:W,activatorEvent:Y,collisions:V,droppableContainers:me,scrollAdjustedTranslate:J}=re.current;if(!W||z.current==null||!Y||!J)return;const{onDragOver:q}=X.current,se=me.get(_t),Me=se&&se.rect.current?{id:se.id,rect:se.rect.current,data:se.data,disabled:se.disabled}:null,F={active:W,activatorEvent:Y,collisions:V,delta:{x:J.x,y:J.y},over:Me};_e.unstable_batchedUpdates(()=>{Xt(Me),q?.(F),R({type:"onDragOver",event:F})})},[_t]),ie(()=>{re.current={activatorEvent:P,active:G,activeNode:H,collisionRect:Te,collisions:ze,droppableRects:w,draggableNodes:b,draggingNode:ke,draggingNodeRect:Ne,droppableContainers:O,over:pe,scrollableAncestors:ge,scrollAdjustedTranslate:Ee},_.current={initial:Ne,translated:Te}},[G,H,ze,Te,b,ke,Ne,w,O,pe,ge,Ee]),js({...he,delta:M,draggingRect:Te,pointerCoordinates:Wt,scrollableAncestors:ge,scrollableAncestorRects:tt});const Kn=l.useMemo(()=>({active:G,activeNode:H,activeNodeRect:T,activatorEvent:P,collisions:ze,containerNodeRect:Fe,dragOverlay:ce,draggableNodes:b,droppableContainers:O,droppableRects:w,over:pe,measureDroppableContainers:L,scrollableAncestors:ge,scrollableAncestorRects:tt,measuringConfiguration:B,measuringScheduled:A,windowRect:pt}),[G,H,T,P,ze,Fe,ce,b,O,w,pe,L,ge,tt,B,A,pt]),Un=l.useMemo(()=>({activatorEvent:P,activators:Ut,active:G,activeNodeRect:T,ariaDescribedById:{draggable:ne},dispatch:C,draggableNodes:b,over:pe,measureDroppableContainers:L}),[P,Ut,G,T,C,ne,b,pe,L]);return K.createElement(bn.Provider,{value:S},K.createElement(gt.Provider,{value:Un},K.createElement(On.Provider,{value:Kn},K.createElement(An.Provider,{value:_n},u)),K.createElement(Ks,{disabled:c?.restoreFocus===!1})),K.createElement(Yr,{...c,hiddenTextDescribedById:ne}));function Gn(){const W=fe?.autoScrollEnabled===!1,Y=typeof d=="object"?d.enabled===!1:d===!1,V=y&&!W&&!Y;return typeof d=="object"?{...d,enabled:V}:{enabled:V}}}),qs=l.createContext(null),cn="button",Js="Draggable";function Qs(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ze(Js),{activators:a,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:h,draggableNodes:f,over:v}=l.useContext(gt),{role:g=cn,roleDescription:p="draggable",tabIndex:m=0}=o??{},x=d?.id===t,C=l.useContext(x?An:qs),[R,S]=lt(),[D,k]=lt(),y=Is(a,t),j=Ye(n);ie(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:D,data:j}),()=>{const M=f.get(t);M&&M.key===i&&f.delete(t)}),[f,t]);const b=l.useMemo(()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&g===cn?!0:void 0,"aria-roledescription":p,"aria-describedby":h.draggable}),[r,g,m,x,p,h.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:b,isDragging:x,listeners:r?void 0:y,node:R,over:v,setNodeRef:S,setActivatorNodeRef:k,transform:C}}function Zs(){return l.useContext(On)}const eo="Droppable",to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ze(eo),{active:a,dispatch:c,over:d,measureDroppableContainers:u}=l.useContext(gt),h=l.useRef({disabled:n}),f=l.useRef(!1),v=l.useRef(null),g=l.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:x}={...to,...o},C=Ye(m??r),R=l.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(C.current)?C.current:[C.current]),g.current=null},x)},[x]),S=ht({callback:R,disabled:p||!a}),D=l.useCallback((b,M)=>{S&&(M&&(S.unobserve(M),f.current=!1),b&&S.observe(b))},[S]),[k,y]=lt(D),j=Ye(t);return l.useEffect(()=>{!S||!k.current||(S.disconnect(),f.current=!1,S.observe(k.current))},[k,S]),l.useEffect(()=>(c({type:I.RegisterDroppable,element:{id:r,key:i,disabled:n,node:k,rect:v,data:j}}),()=>c({type:I.UnregisterDroppable,key:i,id:r})),[r]),l.useEffect(()=>{n!==h.current.disabled&&(c({type:I.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,c]),{active:a,rect:v,isOver:d?.id===r,node:k,over:d,setNodeRef:y}}function Ln(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ro(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function it(e){return e!==null&&e>=0}function so(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function oo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const In=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Ln(t,r,n),a=t[o],c=i[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},Pn="Sortable",$n=K.createContext({activeIndex:-1,containerId:Pn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:In,disabled:{draggable:!1,droppable:!1}});function io(e){let{children:t,id:n,items:r,strategy:o=In,disabled:i=!1}=e;const{active:a,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:h}=Zs(),f=Ze(Pn,n),v=c.rect!==null,g=l.useMemo(()=>r.map(y=>typeof y=="object"&&"id"in y?y.id:y),[r]),p=a!=null,m=a?g.indexOf(a.id):-1,x=u?g.indexOf(u.id):-1,C=l.useRef(g),R=!so(g,C.current),S=x!==-1&&m===-1||R,D=oo(i);ie(()=>{R&&p&&h(g)},[R,g,p,h]),l.useEffect(()=>{C.current=g},[g]);const k=l.useMemo(()=>({activeIndex:m,containerId:f,disabled:D,disableTransforms:S,items:g,overIndex:x,useDragOverlay:v,sortedRects:ro(g,d),strategy:o}),[m,f,D.draggable,D.droppable,S,g,x,d,v,o]);return K.createElement($n.Provider,{value:k},t)}const ao=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Ln(n,r,o).indexOf(t)},lo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!r||c!==i&&o===a?!1:n?!0:a!==o&&t===d},co={duration:200,easing:"ease"},Fn="transform",uo=Ve.Transition.toString({property:Fn,duration:0,easing:"linear"}),fo={roleDescription:"sortable"};function ho(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=l.useState(null),c=l.useRef(n);return ie(()=>{if(!t&&n!==c.current&&r.current){const d=o.current;if(d){const u=$e(r.current,{ignoreTransform:!0}),h={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(h.x||h.y)&&a(h)}}n!==c.current&&(c.current=n)},[t,n,r,o]),l.useEffect(()=>{i&&a(null)},[i]),i}function go(e){let{animateLayoutChanges:t=lo,attributes:n,disabled:r,data:o,getNewIndex:i=ao,id:a,strategy:c,resizeObserverConfig:d,transition:u=co}=e;const{items:h,containerId:f,activeIndex:v,disabled:g,disableTransforms:p,sortedRects:m,overIndex:x,useDragOverlay:C,strategy:R}=l.useContext($n),S=po(r,g),D=h.indexOf(a),k=l.useMemo(()=>({sortable:{containerId:f,index:D,items:h},...o}),[f,o,D,h]),y=l.useMemo(()=>h.slice(h.indexOf(a)),[h,a]),{rect:j,node:b,isOver:M,setNodeRef:O}=no({id:a,data:k,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:y,...d}}),{active:E,activatorEvent:_,activeNodeRect:G,attributes:z,setNodeRef:fe,listeners:ae,isDragging:P,over:je,setActivatorNodeRef:X,transform:ne}=Qs({id:a,data:k,attributes:{...fo,...n},disabled:S.draggable}),Z=Ir(O,fe),B=!!E,w=B&&!p&&it(v)&&it(x),L=!C&&P,A=L&&w?ne:null,et=w?A??(c??R)({rects:m,activeNodeRect:G,activeIndex:v,overIndex:x,index:D}):null,he=it(v)&&it(x)?i({id:a,items:h,activeIndex:v,overIndex:x}):D,le=E?.id,T=l.useRef({activeId:le,items:h,newIndex:he,containerId:f}),Fe=h!==T.current.items,re=t({active:E,containerId:f,isDragging:P,isSorting:B,id:a,index:D,items:h,newIndex:T.current.newIndex,previousItems:T.current.items,previousContainerId:T.current.containerId,transition:u,wasDragging:T.current.activeId!=null}),De=ho({disabled:!re,index:D,node:b,rect:j});return l.useEffect(()=>{B&&T.current.newIndex!==he&&(T.current.newIndex=he),f!==T.current.containerId&&(T.current.containerId=f),h!==T.current.items&&(T.current.items=h)},[B,he,f,h]),l.useEffect(()=>{if(le===T.current.activeId)return;if(le!=null&&T.current.activeId==null){T.current.activeId=le;return}const ke=setTimeout(()=>{T.current.activeId=le},50);return()=>clearTimeout(ke)},[le]),{active:E,activeIndex:v,attributes:z,data:k,rect:j,index:D,newIndex:he,items:h,isOver:M,isSorting:B,isDragging:P,listeners:ae,node:b,overIndex:x,over:je,setNodeRef:Z,setActivatorNodeRef:X,setDroppableNodeRef:O,setDraggableNodeRef:fe,transform:De??et,transition:ce()};function ce(){if(De||Fe&&T.current.newIndex===D)return uo;if(!(L&&!It(_)||!u)&&(B||re))return Ve.Transition.toString({...u,property:Fn})}}function po(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}N.Down,N.Right,N.Up,N.Left;const Ge=["trigger","vector","repo-all","data-safety","config","model","crew","cache-hits","time-saved","rag-health","legend"],zn="mega-compact-card-order";function mo(e){if(!Array.isArray(e)||e.length!==Ge.length)return!1;const t=new Set(Ge),n=new Set;for(const r of e){if(typeof r!="string"||!t.has(r)||n.has(r))return!1;n.add(r)}return!0}function vo(){try{const e=window.localStorage.getItem(zn);if(e==null)return Ge;const t=JSON.parse(e);return mo(t)?t:Ge}catch{return Ge}}function xo(){const[e,t]=l.useState(vo),n=l.useCallback((r,o)=>{t(i=>{const a=i.indexOf(r),c=i.indexOf(o);if(a===-1||c===-1||a===c)return i;const d=[...i];d.splice(a,1),d.splice(c,0,r);try{window.localStorage.setItem(zn,JSON.stringify(d))}catch{}return d})},[]);return{order:e,moveCard:n}}function ee({id:e,children:t,onClick:n}){const{attributes:r,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:d}=go({id:e}),u={transform:Ve.Transform.toString(a),transition:c,opacity:d?.5:1,zIndex:d?10:void 0},h=f=>{n&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),n())};return s.jsxs("div",{ref:i,style:u,className:"relative",children:[s.jsx("button",{type:"button","aria-label":`Reorder ${e} card`,className:"absolute right-2 top-2 z-10 cursor-grab rounded p-1 text-muted-foreground/50 hover:bg-foreground/5 hover:text-muted-foreground active:cursor-grabbing",...r,...o,children:s.jsx(ir,{size:16})}),n?s.jsx("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:h,className:"cursor-pointer rounded-lg outline-none transition-all duration-200 hover:ring-1 hover:ring-primary/60 focus-visible:ring-1 focus-visible:ring-primary/60",children:t}):s.jsx("div",{children:t})]})}function bo(e){return e.type==="session_sample"}function yo(e){switch(e){case"cache":return"cache_hit_pct";case"vector":return"turn_latency_ms";case"time":return"disk_write_ms";default:return null}}function wo(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function Eo({snapshot:e,loading:t,error:n}){const{data:r,error:o,loading:i,refetch:a}=un(l.useCallback(()=>Vn(),[]),{pollInterval:2e3}),{events:c}=Zn(),d=l.useMemo(()=>c.filter(bo),[c]),u=l.useMemo(()=>d.length===0?null:d[d.length-1].ts,[d]);l.useEffect(()=>{u!=null&&a()},[u,a]);const[h,f]=l.useState(null),[v,g]=l.useState([]),[p,m]=l.useState(!1),[x,C]=l.useState(null);l.useEffect(()=>{g([]),C(null);const w=h?yo(h):null;if(w===null){m(!1);return}let L=!1;return m(!0),qn(w,60).then(A=>{L||g(A.samples.map(H=>({ts:H.ts,value:H.value})))}).catch(A=>{L||C(A instanceof Error?A:new Error(String(A)))}).finally(()=>{L||m(!1)}),()=>{L=!0}},[h]);const{order:R,moveCard:S}=xo(),D=l.useCallback(w=>{const{active:L,over:A}=w;A&&L.id!==A.id&&S(L.id,A.id)},[S]),k=l.useMemo(()=>{const w=e,L=w?.compression,A=w?.model;return[{label:"Tokens freed",value:L?.repo.tokensFreed??0},{label:"Input rate",value:A?A.inputRate:0},{label:"Output rate",value:A?A.outputRate:0}]},[e]);if(t&&!e)return s.jsx("div",{className:"tab-stub",children:"Loading snapshot…"});if(n&&!e)return s.jsxs("div",{className:"tab-stub",children:[s.jsxs("p",{children:["Error loading snapshot: ",n.message]}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Auto-retried with backoff and will re-poll every 5s — no action needed."})]});if(!e)return s.jsx("div",{className:"tab-stub",children:"No snapshot data."});const y=e,{context:j,compression:b,trigger:M,session:O,store:E,tier:_,updatedAt:G}=y,z=y.config,fe=y.crew,ae=y.integrity,P=y.cacheHits,je=y.compacts,X=y.timeSaved,ne=y.repo,Z=y.model,B=w=>{switch(w){case"trigger":return s.jsx(ee,{id:w,onClick:()=>f("cache"),children:s.jsx(xr,{armed:M.armed,ready:M.ready,currentTokens:M.currentTokens,thresholdTokens:M.thresholdTokens,fastGatePct:M.fastGatePct})});case"vector":return s.jsx(ee,{id:w,onClick:()=>f("vector"),children:s.jsx(yr,{checkpointCount:E.checkpointCount,tokensIn:b.session.tokensIn,tokensOut:b.session.tokensOut,tokensFreed:b.session.tokensFreed,injectedCount:E.injectedCount,dedupHitRate:E.dedupHitRate,storageDedupRate:E.storageDedupRate,dedupCollapsed:E.dedupCollapsed,lastCheckpointId:O.lastCheckpointId,compressionPct:b.session.compressionPct,dedupPct:b.session.dedupPct})});case"repo-all":return s.jsx(ee,{id:w,children:s.jsx(jr,{checkpointCount:ne.checkpointCount,tokensIn:b.repo.tokensIn,tokensOut:b.repo.tokensOut,tokensFreed:b.repo.tokensFreed,sessionCount:ne.sessionCount,dedupCollapsed:ne.dedupCollapsed,storageDedupRate:ne.storageDedupRate,compressionPct:b.repo.compressionPct,dedupPct:b.repo.dedupPct})});case"data-safety":return s.jsx(ee,{id:w,children:s.jsx(Sr,{regionsRetained:ae.regionsRetained,compressedOriginalBytes:ae.compressedOriginalBytes,duplicatesCollapsed:ae.duplicatesCollapsed,bytesPermanentlyDeleted:ae.bytesPermanentlyDeleted})});case"config":return s.jsx(ee,{id:w,children:s.jsx(Cr,{tier:_,presetTier:y.presetTier,pressure:y.pressure,thresholdTokens:z.thresholdTokens,tierPct:z.tierPct,contextWindow:j.contextWindow,fastGatePct:z.fastGatePct,auto:z.auto,anchorUserMessages:z.anchorUserMessages})});case"model":return Z?s.jsx(ee,{id:w,onClick:()=>f("model"),children:s.jsx(Rr,{name:Z.name,provider:Z.providerName||Z.provider,inputRate:Z.inputRate,outputRate:Z.outputRate,repoTokensFreed:b.repo.tokensFreed,contextWindow:j.contextWindow})}):null;case"crew":return s.jsx(ee,{id:w,children:s.jsx(Dr,{activeAgents:fe.activeAgents,currentTurn:fe.currentTurn})});case"cache-hits":return s.jsx(ee,{id:w,onClick:()=>f("cache"),children:s.jsx(tr,{cacheHitsSession:P.session,cacheHitsTotal:P.total,tokensSavedSession:P.sessionTokensSaved,tokensSavedTotal:P.totalTokensSaved,compactionsSession:je.session,compactionsTotal:je.total})});case"time-saved":return s.jsx(ee,{id:w,onClick:()=>f("time"),children:s.jsx(er,{compactSessionSec:X.compact.sessionSec,compactTotalSec:X.compact.totalSec,cacheHitSessionSec:X.cacheHit.sessionSec,cacheHitTotalSec:X.cacheHit.totalSec})});case"rag-health":return Qn()?s.jsx(ee,{id:w,children:s.jsx(Er,{})}):null;case"legend":return s.jsx(ee,{id:w,children:s.jsx(Nr,{})})}};return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Jn,{variant:"accent",children:_}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["updated ",wo(G)]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[s.jsx(vr,{sessions:r,loading:i,error:o,launcherSessionId:O.id,launcher:{tokens:j.tokens,percent:j.percent,contextWindow:j.contextWindow}}),s.jsx(fr,{sessions:r,loading:i,error:o})]}),s.jsx(Vs,{onDragEnd:D,children:s.jsx(io,{items:R,children:s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:R.map(w=>({cardId:w,node:B(w)})).filter(({node:w})=>w!=null).map(({cardId:w,node:L})=>s.jsx("div",{children:L},w))})})}),s.jsx(ot,{title:"Cache Hits Trend",open:h==="cache",onClose:()=>f(null),children:p?s.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):x?s.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:x.message}):s.jsx(wt,{data:v,label:"Cache hit %",color:"#58a6ff"})}),s.jsx(ot,{title:"Turn Latency",open:h==="vector",onClose:()=>f(null),children:p?s.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):x?s.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:x.message}):s.jsx(wt,{data:v,label:"Turn latency (ms)",color:"#58a6ff"})}),s.jsx(ot,{title:"Disk Write Time",open:h==="time",onClose:()=>f(null),children:p?s.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Loading…"}):x?s.jsx("p",{className:"py-8 text-center text-sm text-red-400",children:x.message}):s.jsx(wt,{data:v,label:"Disk write (ms)",color:"#58a6ff"})}),s.jsx(ot,{title:"Model & Cost",open:h==="model",onClose:()=>f(null),children:s.jsx(Lr,{data:k,color:"#3fb950",valueFormatter:w=>w.toLocaleString()})})]})}export{Eo as default};
|
|
16
|
+
//# sourceMappingURL=OverviewTab-9Kxo79mi.js.map
|