codesesh 1.0.8 → 1.0.10

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.
Files changed (53) hide show
  1. package/README.md +19 -0
  2. package/dist/{chunk-YLXHGL4S.js → chunk-2LXZFMSH.js} +28 -2
  3. package/dist/{chunk-YLXHGL4S.js.map → chunk-2LXZFMSH.js.map} +1 -1
  4. package/dist/{chunk-L4G3LE7I.js → chunk-543OWZIC.js} +2 -2
  5. package/dist/{chunk-DHQPM5FF.js → chunk-56FKVL5K.js} +5 -5
  6. package/dist/{chunk-V3HKVTIO.js → chunk-CYZ6OC6J.js} +2 -2
  7. package/dist/{chunk-KVTLNX7V.js → chunk-DWY4HWVI.js} +2 -2
  8. package/dist/{chunk-AGUAXTKC.js → chunk-R6QKSHPH.js} +2 -2
  9. package/dist/{chunk-RBCCNCDO.js → chunk-WRVILHZR.js} +1059 -26
  10. package/dist/chunk-WRVILHZR.js.map +1 -0
  11. package/dist/{discovery-KEZQU6RL.js → discovery-NTMSA6UE.js} +5 -5
  12. package/dist/index.js +36 -9
  13. package/dist/index.js.map +1 -1
  14. package/dist/project-identity-worker.js +4 -4
  15. package/dist/scan-refresh-worker.js +6 -6
  16. package/dist/search-index-worker.js +6 -6
  17. package/dist/session-detail-worker.js +6 -6
  18. package/dist/smart-tag-worker.js +3 -3
  19. package/dist/web/assets/CustomTimeWindowDialog-CGPvUFkc.js +1 -0
  20. package/dist/web/assets/DetailLanding-D1FLK4EW.js +1 -0
  21. package/dist/web/assets/{InteractiveReceipt-Bsj37HtN.js → InteractiveReceipt-C7FJhzdv.js} +1 -1
  22. package/dist/web/assets/OverviewScreen-DX7F_6dH.js +1 -0
  23. package/dist/web/assets/{PrismHighlighter-DWS6Nx_X.js → PrismHighlighter-DZ2CWVc0.js} +1 -1
  24. package/dist/web/assets/Projects-B_7w5TDw.js +1 -0
  25. package/dist/web/assets/{SearchResultsPanel-BAManMmt.js → SearchResultsPanel-BMBhKuPS.js} +1 -1
  26. package/dist/web/assets/SessionDetail-wJYzzF0i.js +53 -0
  27. package/dist/web/assets/index-BXhaumu7.css +1 -0
  28. package/dist/web/assets/index-DUcpWdzX.js +1423 -0
  29. package/dist/web/assets/{panel-DcOuALYX.js → panel-B-5dVddJ.js} +1 -1
  30. package/dist/web/assets/session-indexes-3LjxBYNe.js +4 -0
  31. package/dist/web/assets/utils-BuYa9y6l.js +1 -0
  32. package/dist/web/icon/agent/cherrystudio.svg +7 -0
  33. package/dist/web/icon/agent/deepchat.LICENSE.txt +206 -0
  34. package/dist/web/icon/agent/deepchat.svg +6 -0
  35. package/dist/web/icon/agent/minimax-code.svg +1 -0
  36. package/dist/web/index.html +5 -192
  37. package/package.json +3 -3
  38. package/dist/chunk-RBCCNCDO.js.map +0 -1
  39. package/dist/web/assets/CustomTimeWindowDialog-z5xtqkBF.js +0 -1
  40. package/dist/web/assets/DetailLanding-CpV0jLmT.js +0 -1
  41. package/dist/web/assets/OverviewScreen-B9qZqEQA.js +0 -1
  42. package/dist/web/assets/Projects-oY3KCgS4.js +0 -1
  43. package/dist/web/assets/SessionDetail-KSgkmLV7.js +0 -53
  44. package/dist/web/assets/index-BSLHxV0w.css +0 -1
  45. package/dist/web/assets/index-DNw59Qsn.js +0 -1423
  46. package/dist/web/assets/session-indexes-DKukxoe1.js +0 -4
  47. package/dist/web/assets/utils-Dk_44zMo.js +0 -1
  48. /package/dist/{chunk-L4G3LE7I.js.map → chunk-543OWZIC.js.map} +0 -0
  49. /package/dist/{chunk-DHQPM5FF.js.map → chunk-56FKVL5K.js.map} +0 -0
  50. /package/dist/{chunk-V3HKVTIO.js.map → chunk-CYZ6OC6J.js.map} +0 -0
  51. /package/dist/{chunk-KVTLNX7V.js.map → chunk-DWY4HWVI.js.map} +0 -0
  52. /package/dist/{chunk-AGUAXTKC.js.map → chunk-R6QKSHPH.js.map} +0 -0
  53. /package/dist/{discovery-KEZQU6RL.js.map → discovery-NTMSA6UE.js.map} +0 -0
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{dn as r,i,kt as a,n as o,s,t as c}from"./DialogTitle-B8zPwJB8.js";import{n as l,t as u}from"./translate-CLoII3EO.js";import{o as d}from"./api-CtZGdxlN.js";var f=e(t(),1),p=n(),m=f.createContext(void 0),h=e=>{let t=f.useContext(m);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},g=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,p.jsx)(m.Provider,{value:e,children:t})),_={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},v=new class{#e=_;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function y(e){setTimeout(e,0)}var b=typeof window>`u`||`Deno`in globalThis;function x(){}function ee(e,t){return typeof e==`function`?e(t):e}function S(e){return typeof e==`number`&&e>=0&&e!==1/0}function C(e,t){return Math.max(e+(t||0)-Date.now(),0)}function w(e,t){return typeof e==`function`?e(t):e}function te(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==re(o,t.options))return!1}else if(!E(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ne(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(T(t.options.mutationKey)!==T(a))return!1}else if(!E(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function re(e,t){return(t?.queryKeyHashFn||T)(e)}function T(e){return JSON.stringify(e,(e,t)=>k(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function E(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!E(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!E(e[r],t[r]))return!1;return!0}return!1}var ie=Object.prototype.hasOwnProperty;function D(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ae(e)&&ae(t);if(!r&&!(k(e)&&k(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ie.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=D(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function O(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ae(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function k(e){if(!A(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!A(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function A(e){return Object.prototype.toString.call(e)===`[object Object]`}function oe(e){return new Promise(t=>{v.setTimeout(t,e)})}function j(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:D(e,t)}function se(e){return e}function ce(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function le(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var M=Symbol();function N(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===M?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function P(e,t){return typeof e==`function`?e(...t):!!e}function ue(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var de=()=>b,F=()=>de(),I=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},L=new class extends I{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},fe=y;function pe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=fe,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var R=pe(),z=new class extends I{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function me(e){return Math.min(1e3*2**e,3e4)}function B(e){return(e??`online`)!==`online`||z.isOnline()}var V=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function H(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(x);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new V(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>L.isFocused()&&(e.networkMode===`always`||z.isOnline())&&e.canRun(),p=()=>B(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(F()?0:3),a=e.retryDelay??me,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),oe(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var U=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S(this.gcTime)&&(this.#e=v.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(F()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(v.clearTimeout(this.#e),this.#e=void 0)}};function he(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ue(e,()=>t.signal,()=>n=!0)},u=N(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?le:ce;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ge:W,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:W(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function W(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ge(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var _e=class extends U{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=q(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=q(this.options);e.data!==void 0&&(this.setState(K(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=j(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(x).catch(x):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>w(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===M||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>w(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!C(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=N(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?he(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=H({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof V&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof V){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...G(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...K(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),R.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function G(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:B(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function K(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function q(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ve=class extends I{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),J(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Y(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Y(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof w(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!O(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&be(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||w(this.options.staleTime,this.#t)!==w(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||w(this.options.enabled,this.#t)!==w(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return O(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(x)),t}#h(e){return!F()&&w(this.options.enabled,this.#t)!==!1&&S(e)}#g(){this.#b();let e=w(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=C(this.#r.dataUpdatedAt,e)+1;this.#u=v.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=v.setInterval(()=>{(this.options.refetchIntervalInBackground||L.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(v.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(v.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&J(e,t),o=i&&be(e,n,t,r);(a||o)&&(l={...l,...G(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=j(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=j(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:X(e,t),refetch:this.refetch,isEnabled:w(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),O(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();R.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function ye(e,t){return w(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||w(t.retryOnMount,e)!==!1)}function J(e,t){return ye(e,t)||e.state.data!==void 0&&Y(e,t,t.refetchOnMount)}function Y(e,t,n){if(w(t.enabled,e)!==!1&&w(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&X(e,t)}return!1}function be(e,t,n,r){return(e!==t||w(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&X(e,n)}function X(e,t){return w(t.enabled,e)!==!1&&e.isStaleByTime(w(t.staleTime,e))}var Z=f.createContext(!1),xe=()=>f.useContext(Z);Z.Provider;function Se(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ce=f.createContext(Se()),we=()=>f.useContext(Ce),Te=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?P(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Ee=e=>{f.useEffect(()=>{e.clearReset()},[e])},De=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||P(n,[e.error,r])),Oe=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},ke=(e,t)=>e?.suspense&&t.isPending,Ae=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function je(e,t,n){let r=xe(),i=we(),a=h(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Oe(o),Te(o,i,s),Ee(i);let[l]=f.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(f.useSyncExternalStore(f.useCallback(e=>{let t=d?l.subscribe(R.batchCalls(e)):x;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),f.useEffect(()=>{l.setOptions(o)},[o,l]),ke(o,u))throw Ae(o,l,i);if(De({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Me(e,t){return je(e,ve,t)}function Ne(e){return e}function Q(e){return{days:e.days,from:e.from,to:e.to}}function Pe(e){return{...e.project?{project:e.project}:{},...e.agent?{agent:e.agent}:{},timeZone:e.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone}}var Fe={bookmarks:[`bookmarks`],config:[`config`],dashboards:[`dashboard`],dashboard:(e,t)=>[`dashboard`,Q(e),Pe(t)],agentCatalogs:[`agent-catalog`],agentCatalog:e=>[`agent-catalog`,Q(e)],projects:[`projects`],projectWindow:e=>[`projects`,Q(e)],projectPage:(e,t)=>[`projects`,Q(e),`page`,t??null],projectDetail:(e,t)=>[`projects`,Q(e),`detail`,t],search:(e,t)=>[`search`,e,t],searches:[`search`],sessionDetails:[`session-detail`],sessionDetail:(e,t)=>[`session-detail`,e,t],sessionProjections:[`session-projection`],sessionProjection:e=>[`session-projection`,Q(e)]},Ie=2e3;function Le(e,t){return Ne({queryKey:Fe.dashboard(e,t),staleTime:Ie,queryFn:async({signal:n})=>{try{return await d(e,t,{signal:n})}catch(e){throw n.aborted||console.error(`Failed to load dashboard:`,e),e}}})}var Re=(0,f.createContext)(`light`),ze=`(prefers-color-scheme: dark)`;function Be(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(ze).matches}function Ve(e){let[t,n]=(0,f.useState)(Be);(0,f.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(ze),t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let r=e===`system`?t?`dark`:`light`:e;return(0,f.useEffect)(()=>{document.documentElement.classList.toggle(`dark`,r===`dark`)},[r]),r}function He({title:e,message:t,onRetry:n,className:r=``}){return l(),(0,p.jsxs)(`div`,{role:`alert`,className:`rounded-sm border border-[var(--console-error-border)] bg-[var(--console-error-bg)] p-4 text-[var(--console-error)] ${r}`,children:[(0,p.jsx)(`p`,{className:`text-sm font-medium`,children:e}),(0,p.jsx)(`p`,{className:`console-mono mt-1 break-words text-[11px]`,children:t}),(0,p.jsx)(`button`,{type:`button`,onClick:n,className:`console-mono mt-3 rounded-sm border border-[var(--console-error-border)] bg-[var(--console-surface)] px-2.5 py-1 text-[11px] font-semibold motion-hover hover:bg-[var(--console-error-bg)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:u(`Retry`)})]})}function Ue(e){let t=e.sourceFailureCount;return[t==null?null:u(`{0} source{1} failed`,[t,t===1?``:`s`]),e.sourceFailureSummary].filter(e=>e!=null).join(` · `)}function We(e){return(e.sourceFailureCount??0)>0||e.sourceFailureSummary!=null}function $(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function Ge(e){if(!e)return null;let{from:t,to:n,days:r}=e.window;if(r===0||t==null)return u(`All time`);let i=$(t),a=$(n??Date.now());return r?u(`Last {0}d · {1} → {2}`,[r,i,a]):`${i} → ${a}`}function Ke(e,t,n){return t?e?u(`Searching for "{0}"`,[e]):u(`Loading recent sessions`):e?u(`{0} matches for "{1}"`,[n,e]):u(`{0} recent sessions`,[n])}function qe(e){if(!e)return null;if(e.backfill?.active){let t=e.backfill.currentAgent,n=e.backfill.pendingAgents.length,r=e.backfill.progress,i=(r?.phase==null||r.phase===`scanning`||r.phase===`finalizing`)&&r?.total&&r.processed!=null?` · ${r.processed}/${r.total}`:``,a=r?.phase===`publish-queued`?u(`Full-history publication queued`):r?.phase===`committing`?u(`Committing full-history publication`):r?.phase===`indexing`?u(`Writing full-history search index`):r?.phase===`publishing`?u(`Preparing full-history publication`):r?.phase===`finalizing`?u(`Finalizing full-history metadata`):u(`Scanning full session history`);return t?`${a} · ${t}${i}${n>0?u(` · {0} history scan queued`,[n]):``}`:`${a}${i}`}if(e.backfill?.failedAgents.length)return u(`Full-history refresh failed · {0}`,[e.backfill.failedAgents.join(`, `)]);let t=Object.values(e.agentStatuses??{}).find(e=>e.status===`failed`);if(t)return u(`Session refresh failed · {0}{1}`,[t.agentName,t.error?` · ${t.error}`:``]);if(e.active&&e.phase===`initializing`)return u(`Initializing recent sessions`);let n=Object.entries(e.backfill?.partialAgents??{}).find(([,e])=>e.completeness===`partial`&&We(e));if(n){let[e,t]=n,r=Ue(t);return u(`Full-history refresh completed with partial data · {0}{1}`,[e,r?` · ${r}`:``])}let r=Object.values(e.agentStatuses??{}).find(e=>e.status===`complete`&&e.completeness===`partial`&&We(e));if(r){let e=Ue(r);return u(`Session refresh completed with partial data · {0}{1}`,[r.agentName,e?` · ${e}`:``])}return e.searchIndexMaintenance?.failedAgents.length?u(`Background search index maintenance paused · {0}`,[e.searchIndexMaintenance.failedAgents.join(`, `)]):null}function Je({open:e,onOpenChange:t,window:n,customFrom:r,customTo:i,onSelectCustom:a}){l();let s=r??(n?.from==null?``:$(n.from)),c=i??(n?.to==null?null:$(n.to));return(0,p.jsx)(o,{open:e,onOpenChange:t,children:e?(0,p.jsx)(Ye,{initialFrom:s,initialTo:c,onOpenChange:t,onSelectCustom:a}):null})}function Ye({initialFrom:e,initialTo:t,onOpenChange:n,onSelectCustom:o}){l();let[d,m]=(0,f.useState)(e),[h,g]=(0,f.useState)(()=>t??$(Date.now()));return(0,p.jsxs)(i,{children:[(0,p.jsx)(r,{className:`motion-backdrop fixed inset-0 z-50 bg-[var(--scrim)]`}),(0,p.jsxs)(s,{className:`motion-modal fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-sm -translate-x-1/2 -translate-y-1/2 rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-5 shadow-[var(--shadow-overlay)] outline-none`,children:[(0,p.jsx)(c,{className:`console-mono text-sm font-semibold text-[var(--console-text)]`,children:u(`Custom time range`)}),(0,p.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:u(`Both dates are included.`)}),(0,p.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-3`,children:[(0,p.jsxs)(`label`,{className:`console-mono text-[11px] uppercase tracking-wide text-[var(--console-muted)]`,children:[u(`From`),` `,(0,p.jsx)(`input`,{type:`date`,value:d,max:h||void 0,onChange:e=>m(e.target.value),className:`mt-1.5 w-full rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-2 py-2 text-xs normal-case tracking-normal text-[var(--console-text)] outline-none focus:border-[var(--brand)] focus:ring-2 focus:ring-[var(--brand)]/25`})]}),(0,p.jsxs)(`label`,{className:`console-mono text-[11px] uppercase tracking-wide text-[var(--console-muted)]`,children:[u(`To`),` `,(0,p.jsx)(`input`,{type:`date`,value:h,min:d||void 0,onChange:e=>g(e.target.value),className:`mt-1.5 w-full rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-2 py-2 text-xs normal-case tracking-normal text-[var(--console-text)] outline-none focus:border-[var(--brand)] focus:ring-2 focus:ring-[var(--brand)]/25`})]})]}),(0,p.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,p.jsx)(a,{className:`rounded-sm border border-[var(--console-border)] px-3 py-1.5 text-xs text-[var(--console-text)] hover:bg-[var(--console-surface-muted)]`,children:u(`Cancel`)}),(0,p.jsx)(`button`,{type:`button`,disabled:!d||!h||d>h,onClick:()=>{o(d,h),n(!1)},className:`rounded-sm border border-[var(--console-accent)] bg-[var(--console-accent)] px-3 py-1.5 text-xs text-[var(--console-accent-fg)] hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40`,children:u(`Apply range`)})]})]})]})}export{O as A,se as C,E as D,x as E,M,g as N,D as O,h as P,re as S,te as T,R as _,He as a,ee as b,Ie as c,Ne as d,Me as f,z as g,H as h,Ge as i,P as j,w as k,Le as l,U as m,qe as n,Re as o,_e as p,Ke as r,Ve as s,Je as t,Fe as u,L as v,ne as w,T as x,I as y};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{E as r,i,j as a,n as o,t as s,w as c}from"./translate-CLoII3EO.js";import{t as l}from"./SmartTagChips-BMP9pPRw.js";import{o as u}from"./session-indexes-DKukxoe1.js";import{$ as d,F as f,H as p,W as m,Z as h,nt as g,q as _,st as v}from"./index-DNw59Qsn.js";import{n as y,t as b}from"./panel-DcOuALYX.js";var x=e(t(),1),S=n();function C({active:e,onToggle:t,className:n=``}){return o(),(0,S.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},"aria-label":s(e?`Remove bookmark`:`Add bookmark`),title:s(e?`Remove bookmark`:`Add bookmark`),className:`motion-hover motion-press inline-flex size-6 shrink-0 items-center justify-center rounded-sm border focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--console-bg)] focus-visible:outline-none ${n} ${e?`border-[var(--brand-line)] bg-[var(--brand-soft)] text-[var(--brand)]`:`border-transparent text-[var(--console-muted)] opacity-70 hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] hover:text-[var(--console-text)] hover:opacity-100`}`,children:(0,S.jsx)(f,{className:`size-3`,strokeWidth:1.8,fill:e?`currentColor`:`none`})})}function w(e){return e.total_tokens??e.total_input_tokens+e.total_output_tokens}function T({label:e,value:t,hint:n}){return o(),(0,S.jsxs)(b,{className:`p-4`,children:[(0,S.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,S.jsx)(`p`,{className:`console-mono mt-2 text-xl font-semibold text-[var(--console-text)]`,children:t}),n?(0,S.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:n}):null]})}function E({label:e,value:t}){return o(),(0,S.jsxs)(`div`,{className:`rounded-md border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,S.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,S.jsx)(`p`,{className:`console-mono mt-2 break-all text-sm leading-6 text-[var(--console-text)]`,children:t})]})}function D({code:e,title:t,description:n,aside:r,iconSrc:i,iconColored:a,iconAlt:c}){return o(),(0,S.jsx)(b,{className:`p-5 md:p-6`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-5 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,S.jsx)(`span`,{className:`console-eyebrow inline-flex rounded-full border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2.5 py-1`,children:e}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-start gap-3`,children:[i?(0,S.jsx)(p,{icon:i,iconColored:a,alt:c||``,className:`mt-1 size-8 shrink-0 object-contain`}):null,(0,S.jsx)(`h2`,{className:`console-display text-2xl leading-tight font-semibold text-[var(--console-text)] md:text-[2rem]`,children:t})]}),(0,S.jsx)(`p`,{className:`mt-3 max-w-[42rem] text-sm leading-7 text-[var(--console-muted)]`,children:n})]}),(0,S.jsxs)(`div`,{className:`min-w-0 rounded-md border border-dashed border-[var(--console-border)] bg-[var(--console-surface-muted)] px-4 py-3 md:max-w-xs`,children:[(0,S.jsx)(`p`,{className:`console-eyebrow`,children:s(`STATUS NOTE`)}),(0,S.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-[var(--console-text)]`,children:r})]})]})})}function O({agentItems:e}){return o(),(0,S.jsxs)(b,{className:`p-4`,children:[(0,S.jsx)(y,{title:s(`Agents`),meta:s(`{0} items`,[e.length])}),(0,S.jsx)(`ul`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(u,{to:c(e.key),className:`flex min-h-11 items-center gap-2 rounded-sm border border-transparent px-3 py-2 motion-hover hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--console-bg)]`,children:[e.icon?(0,S.jsx)(p,{icon:e.icon,iconColored:e.iconColored,alt:e.name,className:`size-4 object-contain`}):null,(0,S.jsx)(`span`,{className:`console-mono flex-1 text-xs text-[var(--console-text)]`,children:e.name}),(0,S.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:e.count})]})},e.key))})]})}function k({sessions:e,isBookmarked:t,onToggleBookmark:n}){return o(),e.length===0?(0,S.jsx)(b,{className:`p-4 text-sm text-[var(--console-muted)]`,children:s(`No sessions yet`)}):(0,S.jsxs)(b,{className:`p-4`,children:[(0,S.jsx)(y,{title:s(`Recent Sessions`),meta:s(`{0} items`,[e.length])}),(0,S.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.map(e=>{let i=t(e.reference.agentName,e.reference.sessionId);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm border border-transparent px-2 py-1.5 motion-hover hover:border-[var(--console-border)] hover:bg-[var(--console-surface-muted)]`,children:[(0,S.jsxs)(u,{to:a({agentName:e.reference.agentName,sessionId:e.reference.sessionId}),className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`line-clamp-1 text-sm text-[var(--console-text)]`,children:m(e)}),(0,S.jsxs)(`p`,{className:`console-mono mt-0.5 text-[11px] text-[var(--console-muted)]`,children:[`/`,r(e.reference),` ·`,` `,g(e.time_updated||e.time_created)]}),(0,S.jsx)(l,{tags:e.smart_tags,className:`mt-1.5`})]}),(0,S.jsx)(C,{active:i,onToggle:()=>n(e)})]})},r(e.reference))})})]})}var A=(0,x.memo)(function({type:e,agentCatalog:t,sessions:n,agentItems:r,activeAgentKey:a,attemptedAgentKey:c,attemptedSessionId:l,loadFailureMessage:u,isBookmarked:f,onToggleBookmark:m,onRetry:y}){o();let{recentSessions:C,totalMessages:A,totalTokens:j,totalCost:M,costSource:N,latestUpdatedAt:P}=(0,x.useMemo)(()=>{let e=n.toSorted((e,t)=>(t.time_updated||t.time_created||0)-(e.time_updated||e.time_created||0)),t=0,r=0,i=0,a=!1;for(let e of n)t+=e.stats.message_count,r+=w(e.stats),i+=e.stats.total_cost,a||=e.stats.cost_source===`estimated`;return{recentSessions:e.slice(0,5),totalMessages:t,totalTokens:r,totalCost:i,costSource:i>0?a?`estimated`:`recorded`:void 0,latestUpdatedAt:e[0]?.time_updated||e[0]?.time_created}},[n]);if(e===`missing-agent`){let e=`/${c||`unknown`}${l?`/${l}`:``}`;return(0,S.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,S.jsx)(D,{code:s(`404 / AGENT`),title:s(`This agent isn't on the roster.`),description:s(`The path you requested is valid in shape, but there is no matching agent in the current registry. It may not be connected yet, or its name may not match what the system recognizes.`),aside:s(`Choose one of the available agents to continue.`)}),(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,S.jsx)(E,{label:s(`Requested Agent`),value:c||`unknown`}),(0,S.jsx)(E,{label:s(`Requested Path`),value:e}),l?(0,S.jsx)(E,{label:s(`Requested Session`),value:l}):null]}),(0,S.jsx)(O,{agentItems:r})]})}if(e===`missing-session`){let e=a?v(t,a):void 0,n=e?.displayName??a??s(`Unknown Agent`),r=e?.icon,i=l||`unknown-session`;return(0,S.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,S.jsx)(D,{code:s(`404 / SESSION`),title:s(`This session isn't in the index.`),description:s(`{0} is available, but the session you're looking for does not exist in the current index. The session ID may be incorrect, or the record may never have been part of this dataset.`,[n]),aside:s(`We checked the current path, but nothing matched. The session list on the left is still available.`),iconSrc:r,iconColored:e?.iconColored,iconAlt:n}),(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`rounded-md border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,S.jsx)(`p`,{className:`console-eyebrow`,children:s(`Agent`)}),(0,S.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[r?(0,S.jsx)(p,{icon:r,iconColored:e?.iconColored,alt:n,className:`size-4 shrink-0 object-contain`}):null,(0,S.jsx)(`p`,{className:`console-mono break-all text-sm leading-6 text-[var(--console-text)]`,children:n})]})]}),(0,S.jsx)(E,{label:s(`Session`),value:i})]}),(0,S.jsx)(k,{sessions:C,isBookmarked:f,onToggleBookmark:m})]})}if(e===`load-failed`)return(0,S.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,S.jsx)(D,{code:s(`LOAD / SESSION`),title:s(`We couldn't load this session.`),description:s(`The session request failed before we could determine whether the record exists. It may still be available once the connection or server recovers.`),aside:s(`Retry this request without leaving the current session path.`)}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3 rounded-md border border-[var(--console-border)] bg-[var(--console-surface-muted)] p-3`,children:[(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,S.jsx)(E,{label:s(`Request Error`),value:u??s(`Unable to load this session.`)})}),(0,S.jsx)(`button`,{type:`button`,onClick:y,className:`console-mono shrink-0 rounded-sm border border-[var(--console-border-strong)] bg-[var(--console-surface)] px-3 py-1.5 text-xs text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:s(`Retry`)})]}),(0,S.jsx)(k,{sessions:C,isBookmarked:f,onToggleBookmark:m})]});if(e===`global`)return(0,S.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,S.jsx)(T,{label:s(`Total Sessions`),value:d(n.length)}),(0,S.jsx)(T,{label:s(`Total Messages`),value:d(A)}),(0,S.jsx)(T,{label:s(`Latest Activity`),value:g(P),hint:P?new Date(P).toLocaleString(i()):void 0})]}),(0,S.jsx)(O,{agentItems:r}),(0,S.jsx)(k,{sessions:C,isBookmarked:f,onToggleBookmark:m})]});let F=a?v(t,a):void 0,I=F?.displayName??s(`Unknown Agent`);return(0,S.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-4`,children:[(0,S.jsx)(b,{className:`p-4`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[F?.icon?(0,S.jsx)(p,{icon:F.icon,iconColored:F.iconColored,alt:I,className:`size-6 object-contain`}):null,(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:I}),(0,S.jsx)(`p`,{className:`console-mono text-xs text-[var(--console-muted)]`,children:s(`Select a session from the left to view details`)})]})]})}),(0,S.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,S.jsx)(T,{label:s(`Sessions`),value:d(n.length)}),(0,S.jsx)(T,{label:s(`Messages`),value:d(A)}),(0,S.jsx)(T,{label:s(`Tokens`),value:d(j)}),(0,S.jsx)(T,{label:s(`Total Cost`),value:h(M),hint:_(N)})]}),(0,S.jsx)(k,{sessions:C,isBookmarked:f,onToggleBookmark:m})]})});export{A as DetailLanding};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,f as i,l as a,o,t as s}from"./CustomTimeWindowDialog-z5xtqkBF.js";import{n as c,t as l}from"./translate-CLoII3EO.js";import{H as u,J as d,K as f,Q as p,Y as m,at as h,et as g,it as _,tt as v}from"./index-DNw59Qsn.js";import{t as y}from"./utils-Dk_44zMo.js";import{n as b,t as x}from"./panel-DcOuALYX.js";var S=e(t(),1);function C(e,t){let n=e!==null,r=i({...a(e??{},t),enabled:n}),o=r.refetch,s=(0,S.useCallback)(async()=>{await o()},[o]);return{dashboard:n?r.data??null:null,loading:n&&r.isPending,error:n&&r.isError?r.error instanceof Error?r.error.message:l(`Unable to load dashboard.`):null,retry:s}}var w=n();function T({index:e,count:t,position:n=(e+.5)/t*100,children:r}){return(0,w.jsx)(`div`,{role:`tooltip`,className:`console-mono pointer-events-none absolute top-2 z-10 w-max max-w-full rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-2 text-[10.5px] break-words text-[var(--console-text)] shadow-[var(--shadow-overlay)]`,style:{left:`${n}%`,transform:`translateX(-${n}%)`},children:r})}var E=Math.PI*2;function D(e){return e<0?0:e>1?1:e}function O(e){let t=D(e);return t*t*(3-2*t)}function k(e,t){let n=Math.imul(Math.round(e*16)^2654435769,2246822507);return n=Math.imul(n^n>>>13^Math.round(t*16),3266489909),((n^n>>>16)>>>0)/4294967296}function A(e,t,n){return O((Math.sin(e*.09+n)+Math.sin(t*.075-n*.83)+Math.sin((e+t)*.045+n*1.31)+2)/4)}function j(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}var M=/^var\((--[\w-]+)\)$/;function N(e,t){let n=M.exec(t)?.[1];return n&&e.getPropertyValue(n).trim()||t}function P(e,t){let n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e)?.[1];if(!n)return e;let r=n.length===3?n.replace(/./g,e=>e+e):n,i=parseInt(r,16);return`rgba(${i>>16&255}, ${i>>8&255}, ${i&255}, ${t})`}var F=50;function ee(){let e=!1,t=null,n=0,r=0,i=()=>{n&&cancelAnimationFrame(n),r&&window.clearTimeout(r),n=0,r=0},a=()=>{e&&t!==null&&!n&&(r&&=(window.clearTimeout(r),0),n=requestAnimationFrame(s))},o=()=>{!e||t===null||r||n||(r=window.setTimeout(()=>{r=0,a()},F))};function s(r){if(n=0,!e||t===null)return;let i=t(r);i===`active`?a():i===`idle`&&o()}return{api:{requestFrame:a,setFrameHandler:e=>{t=e,e===null?i():a()}},setEnabled:t=>{e!==t&&(e=t,e?a():i())}}}function I(e,t){let[n]=(0,S.useState)(ee);return(0,S.useEffect)(()=>{let r=e.current;if(!r||t){n.setEnabled(!1);return}let i=!0,a=document.visibilityState===`visible`,o=()=>n.setEnabled(i&&a),s=()=>{a=document.visibilityState===`visible`,o()},c=typeof IntersectionObserver>`u`?null:new IntersectionObserver(([e])=>{i=e?.isIntersecting??!1,o()});return c?.observe(r),document.addEventListener(`visibilitychange`,s),o(),()=>{n.setEnabled(!1),c?.disconnect(),document.removeEventListener(`visibilitychange`,s)}},[n,t,e]),n.api}var te=2,L=5,ne=8,re=7,ie=620,ae=.05,oe=.8,se=.0018,ce=.3,le=.48,ue={barRatio:.62,barMax:76,bandGap:4,minBand:6};function de(e,t,n){let r=Math.max(1,t-1),i=Math.min(ae,oe/r),a=1-(t-1)*i;return 1-(1-D((n-e*i)/a))**3}function fe(e,{values:t,axisMax:n,colors:r,highlight:i,hovered:a,layout:s,reducedMotion:c}){let l=(0,S.useContext)(o),u=I(e,c),d=r.join(`\0`),f=(0,S.useRef)({values:t,axisMax:n,hovered:a,layout:s}),p=(0,S.useRef)(new Map),m=(0,S.useRef)(new Map),h=(0,S.useRef)({startedAt:0,running:!1}),g=(0,S.useRef)({w:0,h:0}),_=(0,S.useRef)(()=>{});return(0,S.useEffect)(()=>{f.current={values:t,axisMax:n,hovered:a,layout:s},c?_.current():u.requestFrame()},[n,u,a,s,c,t]),(0,S.useEffect)(()=>{m.current=new Map(p.current),c?(h.current.running=!1,_.current()):(h.current={startedAt:performance.now(),running:!0},u.requestFrame())},[n,u,c,t]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,r=t?.getContext(`2d`);if(!t||!n||!r)return;let a=getComputedStyle(t),o=(d?d.split(`\0`):[]).map(e=>N(a,e)),s=N(a,i),l=()=>{let e=n.clientWidth,i=n.clientHeight;if(!e||!i)return;let a=Math.min(te,window.devicePixelRatio||1);t.width=Math.round(e*a),t.height=Math.round(i*a),t.style.width=`${e}px`,t.style.height=`${i}px`,r.setTransform(a,0,0,a,0,0),g.current={w:e,h:i}},v=0,y=(e,t,n)=>{if(!h.current.running)return 1;let r=D((n-h.current.startedAt)/ie);return r>=1&&(h.current.running=!1),de(e,t,r)},b=(e,t,n,i,a,o,s,c,l,u,d)=>{let f=[l?ne:L,l?ne:L,u?re:L,u?re:L],p=()=>{r.beginPath(),r.roundRect(e,t,n,i,f)};r.save(),p(),r.clip(),r.globalAlpha=s,r.fillStyle=a;let m=c?.5:.36,h=Math.min(d,i)/2;r.beginPath();for(let a=e+d/2;a<e+n;a+=d)for(let e=t+h;e<t+i;e+=d){let n=O(1-(e-t)/i),o=A(a,e,v),s=d*(m+.34*n+.26*o)*(.8+.4*k(a,e));r.rect(a-s/2,e-s/2,s,s)}r.fill(),r.restore(),c&&(r.save(),p(),r.strokeStyle=o,r.lineWidth=1.75,r.shadowColor=o,r.shadowBlur=10,r.stroke(),r.restore())},x=e=>{v=e*se;let{w:t,h:n}=g.current;if(!t||!n)return;let i=f.current;if(r.clearRect(0,0,t,n),!i.values.length||i.axisMax<=0){h.current.running=!1;return}let{barRatio:a,barMax:c,bandGap:l,minBand:u}=i.layout,d=i.values.length,_=t/d,x=Math.min(_*a,c),S=Math.max(3,Math.round(t/200)),C=n/i.axisMax,w=i.hovered;i.values.forEach((t,r)=>{let i=y(r,d,e),a=r*_+(_-x)/2,c=n;t.forEach((e,n)=>{let d=`${r}:${n}`,f=e>0?Math.max(u,e*C):0,h=m.current.get(d)??0,g=h+(f-h)*i;p.current.set(d,g);let _=w?.column===r&&w.band===n,v=w==null?1:w.column===r?w.band===null||_?1:le:ce;g>0&&b(a,c-g,x,g,o[n]??o[0]??s,s,v,_,n===t.length-1,n===0,S),c-=g+l})})};_.current=()=>{l(),x(performance.now())},u.setFrameHandler(e=>(x(e),h.current.running?`active`:f.current.hovered===null?`stop`:`idle`)),l();let S=new ResizeObserver(()=>{l(),c?x(performance.now()):u.requestFrame()});return S.observe(n),c&&x(performance.now()),()=>{u.setFrameHandler(null),S.disconnect()}},[e,d,u,i,c,l]),{hitTest:(t,n)=>{let r=e.current,{w:i,h:a}=g.current;if(!r||!i)return null;let o=r.getBoundingClientRect(),s=(t-o.left)/o.width*i,c=(n-o.top)/o.height*a,{values:l,layout:u}=f.current,d=l.length,m=i/d,h=Math.floor(s/m);if(h<0||h>=d)return null;let _=Math.min(m*u.barRatio,u.barMax),v=h*m+(m-_)/2;if(s<v||s>v+_)return{column:h,band:null};let y=a;for(let e=0;e<l[h].length;e++){let t=p.current.get(`${h}:${e}`)??0;if(t>0&&c<=y&&c>=y-t)return{column:h,band:e};y-=t+u.bandGap}return{column:h,band:null}}}}var pe=`(prefers-reduced-motion: reduce)`;function R(){let[e,t]=(0,S.useState)(()=>globalThis.matchMedia?.(pe).matches??!1);return(0,S.useEffect)(()=>{let e=globalThis.matchMedia?.(pe);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function me(e,t,n){return e===`ArrowLeft`?Math.max(0,t-1):e===`ArrowRight`?Math.min(n,t+1):e===`Home`?0:e===`End`?n:null}function he({label:e,itemLabels:t,activeIndex:n,onActiveIndexChange:r,layout:i}){let a=(0,S.useRef)([]),[o,s]=(0,S.useState)(0),c=t.length-1,l=Math.min(o,Math.max(0,c)),u=(e,t)=>{if(e.key===`Escape`){e.preventDefault(),r(null);return}let n=me(e.key,t,c);n!==null&&(e.preventDefault(),s(n),a.current[n]?.focus())};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{role:`listbox`,"aria-label":e,"aria-orientation":`horizontal`,className:y(`pointer-events-none absolute inset-0 z-[1]`,i===`columns`?`flex`:null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(null)},children:t.map((e,t)=>(0,w.jsx)(`div`,{ref:e=>{a.current[t]=e},role:`option`,"aria-label":e,"aria-selected":n===t,tabIndex:t===l?0:-1,className:y(`pointer-events-none focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--brand)]`,i===`columns`?`h-full min-w-0 flex-1 rounded-sm`:`absolute inset-0 rounded-full`),onFocus:()=>{s(t),r(t)},onKeyDown:e=>u(e,t)},t))}),(0,w.jsx)(`span`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,children:n===null?``:t[n]})]})}var ge=[1,.75,.5,.25,0];function _e(e,t){return e===t||e!==null&&t!==null&&e.column===t.column&&e.band===t.band}function ve({values:e,axisMax:t,colors:n,highlight:r=`var(--brand)`,hovered:i,onHover:a,layout:o,height:s,formatTick:c,ariaLabel:l,itemLabels:u,className:d}){let f=(0,S.useRef)(null),p=(0,S.useRef)(i),m=R(),{hitTest:h}=fe(f,{values:e,axisMax:t,colors:n,highlight:r,hovered:i,layout:{...ue,...o},reducedMotion:m});(0,S.useEffect)(()=>{p.current=i},[i]);let g=e=>{_e(p.current,e)||(p.current=e,a(e))};return(0,w.jsxs)(`div`,{className:y(`flex`,d),children:[c?(0,w.jsx)(`div`,{className:`relative shrink-0`,style:{height:s,width:38},"aria-hidden":!0,children:ge.map(e=>(0,w.jsx)(`span`,{className:`console-mono absolute right-2 -translate-y-1/2 text-[9.5px] whitespace-nowrap text-[var(--console-muted)]`,style:{top:`${(1-e)*100}%`},children:c(t*e)},e))}):null,(0,w.jsxs)(`div`,{className:`chart-hatch relative min-w-0 flex-1 touch-none`,style:{height:s},onPointerMove:e=>g(h(e.clientX,e.clientY)),onPointerLeave:()=>g(null),children:[ge.map(e=>(0,w.jsx)(`span`,{"aria-hidden":!0,className:y(`pointer-events-none absolute inset-x-0`,e===0?`h-px bg-[var(--console-border-strong)]`:`border-t border-dashed border-[var(--console-border)]`),style:{top:`${(1-e)*100}%`}},e)),(0,w.jsx)(`canvas`,{ref:f,"aria-hidden":!0,className:`absolute inset-0 block`}),(0,w.jsx)(he,{label:l,itemLabels:u,activeIndex:i?.column??null,onActiveIndexChange:e=>g(e===null?null:{column:e,band:null}),layout:`columns`})]})]})}var z=6,ye=118,be={barRatio:.52,barMax:34,bandGap:0,minBand:4},xe=[`var(--brand)`];function Se({perAgent:e}){let t=c(),[n,r]=(0,S.useState)(null),{byCost:i,visible:a,values:o,axisMax:s,itemLabels:d}=(0,S.useMemo)(()=>{let t=e.some(e=>e.cost>0),n=e=>t?e.cost:e.sessions,r=[...e].sort((e,t)=>n(t)-n(e)).slice(0,z),i=r.map(e=>[n(e)]),a=r.map(e=>t?l(`{0}: {1}, {2} sessions`,[e.displayName,_(e.cost),m(e.sessions)]):l(`{0}: {1} sessions`,[e.displayName,m(e.sessions)]));return{byCost:t,visible:r,values:i,axisMax:Math.max(...i.flat(),0),itemLabels:a}},[t,e]),p=n===null?void 0:a[n.column];return(0,w.jsxs)(x,{role:`region`,"aria-label":l(`Agents`),className:`p-4`,children:[(0,w.jsx)(b,{title:l(`Agents`),meta:l(`{0} · {1} total`,[l(i?`by cost`:`by sessions`),e.length])}),a.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-3 text-[11px] text-[var(--console-muted)]`,children:l(`No data`)}):(0,w.jsxs)(`div`,{className:`relative mt-[14px]`,children:[(0,w.jsx)(ve,{values:o,axisMax:s,colors:xe,hovered:n,onHover:r,layout:be,height:ye,ariaLabel:l(`Agent distribution chart`),itemLabels:d}),p&&n?(0,w.jsxs)(T,{index:n.column,count:a.length,children:[(0,w.jsx)(`div`,{children:p.displayName}),(0,w.jsxs)(`div`,{children:[f(p.tokens),` `,l(`tok ·`),` `,(0,w.jsx)(`span`,{className:`text-[var(--brand)]`,children:_(p.cost)})]}),(0,w.jsxs)(`div`,{children:[m(p.sessions),` `,l(`sessions ·`),` `,m(p.messages),` `,l(`messages`)]})]}):null,(0,w.jsx)(`div`,{className:`mt-2 grid`,style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},children:a.map((e,t)=>(0,w.jsxs)(`div`,{"data-testid":`overview-agent-row`,className:`flex min-w-0 flex-col items-center gap-[5px]`,children:[(0,w.jsx)(`span`,{className:`flex size-[18px] items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:(0,w.jsx)(u,{icon:e.icon,iconColored:e.iconColored,alt:e.displayName,className:`size-[10px]`})}),(0,w.jsx)(`span`,{className:y(`console-mono max-w-full truncate text-[9.5px]`,n?.column===t?`text-[var(--console-text)]`:`text-[var(--console-muted)]`),children:e.displayName}),(0,w.jsx)(`span`,{className:`console-mono text-[9.5px] text-[var(--console-text)]`,children:i?_(e.cost):m(e.sessions)}),i?(0,w.jsx)(`span`,{className:`console-mono text-[9.5px] text-[var(--console-muted)]`,children:m(e.sessions)}):null]},e.name))})]}),e.length>z?(0,w.jsxs)(`p`,{className:`console-mono mt-3 text-[10.5px] text-[var(--console-muted)]`,children:[`+ `,e.length-z,` `,l(`more`)]}):null]})}function Ce(e){let t=2166136261;for(let n of e)t=Math.imul(t^n.charCodeAt(0),16777619);return`oklch(0.65 0.16 ${(t>>>0)%360})`}function we(e,t){let n=e.filter(e=>e.tokens>0).toSorted((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>({key:e.model,label:e.model,value:e.tokens,color:Ce(e.model),display:f(e.tokens)})),i=n.slice(5).reduce((e,t)=>e+t.tokens,0);i>0&&r.push({key:`__other`,label:l(`Other`),value:i,color:`var(--console-border-strong)`,display:f(i)});let a=t-n.reduce((e,t)=>e+t.tokens,0);return a>0&&r.push({key:`__unknown`,label:l(`Unknown model`),value:a,color:`var(--console-muted)`,display:f(a)}),r}var B=200,V=100,H=100,U=86,W=55,Te=-Math.PI/2,Ee=.07,De=6,G=4.6,Oe=2,ke=.0018,Ae=500,je=6,Me=.72,Ne=.3,Pe=(()=>{let e=[];for(let t=14;t<=186;t+=G)for(let n=14;n<=186;n+=G){let r=t-V,i=n-H,a=Math.hypot(r,i);a<50.4||a>90.6||e.push({x:t,y:n,angle:Math.atan2(i,r),fullness:.62+.38*O((a-W)/31),jitter:k(t,n)})}return e})();function Fe(e,{a0:t,a1:n}){let r=n-t,i=Math.min(De,31*.45,W*r*.45),a=i/U,o=i/W,s=(e,t)=>[V+Math.cos(t)*e,H+Math.sin(t)*e],[c,l]=s(U,t+a);e.beginPath(),e.moveTo(c,l),e.arc(V,H,U,t+a,n-a),e.arcTo(...s(U,n),...s(W,n),i),e.arcTo(...s(W,n),...s(W,n-o),i),e.arc(V,H,W,n-o,t+o,!0),e.arcTo(...s(W,t),...s(U,t),i),e.arcTo(...s(U,t),c,l,i),e.closePath()}function Ie(e){let t=Te;return e.map(e=>{let n=e*E,r={a0:t+Ee/2,a1:t+n-Ee/2};return t+=n,r})}function Le(e,{shares:t,colors:n,hovered:r,reducedMotion:i}){let a=(0,S.useContext)(o),s=I(e,i),c=n.join(`\0`),l=(0,S.useRef)(r),u=(0,S.useRef)({displayed:t.slice(),from:t.slice(),target:t.slice(),startedAt:0,running:!1}),d=(0,S.useRef)(Ie(t)),f=(0,S.useRef)(()=>{});return(0,S.useEffect)(()=>{let e=u.current;e.from=e.displayed.slice(),e.target=t.slice(),i?(e.displayed=t.slice(),e.running=!1,f.current()):(e.startedAt=performance.now(),e.running=!0,s.requestFrame())},[s,i,t]),(0,S.useEffect)(()=>{l.current=r,i?f.current():s.requestFrame()},[s,r,i]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,r=t?.getContext(`2d`);if(!t||!n||!r)return;let a=getComputedStyle(t),o=(c?c.split(`\0`):[]).map(e=>N(a,e)),p=1,m=()=>{let e=n.clientWidth;if(!e)return;let r=Math.min(Oe,window.devicePixelRatio||1);t.width=Math.ceil(e*r),t.height=Math.ceil(e*r),t.style.width=`${e}px`,t.style.height=`${e}px`,p=e/B*r},h=0,g=e=>{let t=u.current;if(!t.running)return;let n=D((e-t.startedAt)/Ae),r=1-2**(-10*n);t.displayed=t.target.map((e,n)=>{let i=t.from[n]??0;return i+(e-i)*r}),n>=1&&(t.displayed=t.target.slice(),t.running=!1)},_=(e,t,n,i)=>{if(t.a1-t.a0<=.004)return;if(r.save(),n){let n=(t.a0+t.a1)/2;r.translate(Math.cos(n)*je,Math.sin(n)*je),r.shadowColor=P(e,.55),r.shadowBlur=5}Fe(r,t),r.clip(),r.globalAlpha=i?n?1:Ne*Me:Me,r.fillStyle=e;let a=n?.46:.34,o=t.a0-.06,s=t.a1+.06;r.beginPath();for(let e of Pe){let t=e.angle;for(;t<o;)t+=E;for(;t>=o+E;)t-=E;if(t>s)continue;let n=A(e.x,e.y,h),i=G*(a+.36*e.fullness+.26*n)*(.78+.42*e.jitter);r.rect(e.x-i/2,e.y-i/2,i,i)}r.fill(),r.restore()},v=e=>{h=e*ke,r.setTransform(p,0,0,p,0,0),r.clearRect(0,0,B,B);let t=Ie(u.current.displayed);d.current=t;let n=l.current,i=n!==null;t.forEach((e,t)=>{t!==n&&_(o[t]??o[0]??``,e,!1,i)});let a=n===null?void 0:t[n];a&&_(o[n]??``,a,!0,!0)};f.current=()=>{m(),v(performance.now())},s.setFrameHandler(e=>(g(e),v(e),u.current.running?`active`:l.current===null?`stop`:`idle`)),m();let y=new ResizeObserver(()=>{m(),i?v(performance.now()):s.requestFrame()});return y.observe(n),i&&v(performance.now()),()=>{s.setFrameHandler(null),y.disconnect()}},[e,c,s,i,a]),{hitTest:(t,n)=>{let r=e.current;if(!r)return null;let i=r.getBoundingClientRect();if(!i.width)return null;let a=(t-i.left)/i.width*B-V,o=(n-i.top)/i.height*B-H,s=Math.hypot(a,o);if(s<W||s>U)return null;let c=Math.atan2(o,a);for(let e=0;e<d.current.length;e++){let{a0:t,a1:n}=d.current[e],r=c;for(;r<t;)r+=E;for(;r>=t+E;)r-=E;if(r<=n)return e}return null}}}function Re({shares:e,colors:t,hovered:n,onHover:r,size:i,ariaLabel:a,itemLabels:o,children:s}){let c=(0,S.useRef)(null),{hitTest:l}=Le(c,{shares:e,colors:t,hovered:n,reducedMotion:R()});return(0,w.jsxs)(`div`,{className:`relative shrink-0 touch-none`,style:{width:i,height:i},onPointerMove:e=>r(l(e.clientX,e.clientY)),onPointerLeave:()=>r(null),children:[(0,w.jsx)(`canvas`,{ref:c,"aria-hidden":!0,className:`block size-full`}),(0,w.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex flex-col items-center justify-center`,children:s}),(0,w.jsx)(he,{label:a,itemLabels:o,activeIndex:n,onActiveIndexChange:r,layout:`surface`})]})}var ze=5,Be=142,Ve=.01;function He(e){return e!==null&&e.some(e=>e.cost>0)}function Ue(e,t){let n=[...e].sort((e,t)=>t.cost-e.cost).slice(0,ze),r=n.map(e=>({key:e.model,label:e.model,value:e.cost,color:Ce(e.model),display:h(e.cost)})),i=t-n.reduce((e,t)=>e+t.cost,0);return t>0&&i>t*Ve&&r.push({key:`__remainder`,label:l(`Other`),value:i,color:`var(--console-border-strong)`,display:h(i)}),r}function We({modelCost:e,modelDistribution:t,totals:n}){let r=c(),[i,a]=(0,S.useState)(null),{byCost:o,entries:s}=(0,S.useMemo)(()=>{let r=He(e);return{byCost:r,entries:r?Ue(e,n.cost):we(t,n.tokens)}},[r,e,t,n.cost,n.tokens]),u=s.reduce((e,t)=>e+t.value,0),d=(0,S.useMemo)(()=>s.map(e=>u>0?e.value/u:1/s.length),[s,u]),p=l(o?`Cost by Model`:`Models`),m=s.map(e=>`${e.label}: ${g(u>0?e.value/u:0)}, ${e.display}`);return(0,w.jsxs)(x,{role:`region`,"aria-label":p,className:`p-4`,children:[(0,w.jsx)(b,{title:p,meta:l(o?`by cost`:`by tokens`)}),s.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-3 text-[11px] text-[var(--console-muted)]`,children:l(`No model data`)}):(0,w.jsxs)(`div`,{className:`mt-[14px] flex items-center gap-[18px]`,children:[(0,w.jsxs)(Re,{shares:d,colors:s.map(e=>e.color),hovered:i,onHover:a,size:Be,ariaLabel:l(`{0} chart`,[p]),itemLabels:m,children:[(0,w.jsx)(`span`,{className:`console-mono text-[16px] font-semibold text-[var(--console-text)]`,children:o?h(n.cost):f(n.tokens)}),(0,w.jsx)(`span`,{className:`console-mono mt-0.5 text-[9px] text-[var(--console-muted)]`,children:l(o?`total cost`:`total tokens`)})]}),(0,w.jsx)(`ul`,{className:`flex min-w-0 flex-1 flex-col gap-[7px]`,children:s.map((e,t)=>(0,w.jsxs)(`li`,{className:y(`flex min-w-0 items-center gap-2 transition-opacity`,i!==null&&i!==t?`opacity-45`:null),onPointerEnter:()=>a(t),onPointerLeave:()=>a(null),children:[(0,w.jsx)(`span`,{className:`size-2 shrink-0 rounded-[2px]`,style:{background:e.color},"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`console-mono min-w-0 flex-1 truncate text-[10.5px] text-[var(--console-text)]`,children:e.label}),(0,w.jsx)(`span`,{className:`console-mono w-[34px] shrink-0 text-right text-[10.5px] text-[var(--console-muted)]`,children:g(u>0?e.value/u:0)}),(0,w.jsx)(`span`,{className:`console-mono w-[54px] shrink-0 text-right text-[10.5px] text-[var(--console-text)]`,children:e.display})]},e.key))})]}),(0,w.jsx)(`p`,{className:`console-mono mt-3 border-t border-dashed border-[var(--console-border)] pt-3 text-[10.5px] text-[var(--console-muted)]`,children:o?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`mr-1.5 rounded-sm bg-[var(--brand-soft)] px-1.5 py-0.5 text-[var(--brand)]`,children:l(`Estimated`)}),_(n.costEstimated),` `,l(`from model unit price,`),` `,_(n.costRecorded),` `,l(`from agent records`)]}):l(`Per-model cost needs the message cache, which is unavailable here; showing token share instead.`)})]})}var Ge=[{value:`7d`,label:`7d`},{value:`30d`,label:`30d`},{value:`90d`,label:`90d`},{value:`all`,label:`All`},{value:`custom`,label:`Custom`}],K=`__all__`;function Ke({agent:e,onAgentChange:t,agentCatalog:n,scopeCounts:r,window:i,rangePreset:a,onRangeChange:o,onSelectCustom:u}){c();let[d,f]=(0,S.useState)(!1);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[t?(0,w.jsxs)(`select`,{"aria-label":l(`Filter by agent`),value:e??K,onChange:e=>t(e.target.value===K?void 0:e.target.value),className:`console-mono max-w-[220px] rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1.5 text-xs text-[var(--console-text)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,w.jsx)(`option`,{value:K,children:l(`All agents`)}),n.active.map(e=>(0,w.jsx)(`option`,{value:e.name.toLowerCase(),children:e.displayName},e.name))]}):null,r?(0,w.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:l(`{0} projects · {1} agents in scope`,[r.projects,r.agents])}):null,(0,w.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:Ge.map(e=>{let t=e.value===a;return(0,w.jsx)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>{e.value===`custom`?f(!0):o(e.value)},className:y(`console-mono motion-hover rounded-full border px-[13px] py-[5px] text-[11px] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,t?`border-[var(--brand)] bg-[var(--brand)] text-[var(--brand-fg)]`:`border-[var(--console-border)] bg-[var(--console-surface)] text-[var(--console-muted)]`),children:l(e.label)},e.value)})})]}),(0,w.jsx)(s,{open:d,onOpenChange:f,window:i,onSelectCustom:u})]})}function qe(e){return e.toFixed(1)}var Je={neutral:`text-[var(--console-muted)]`,warning:`text-[var(--brand)]`,positive:`text-[var(--positive)]`};function q({label:e,value:t,trend:n,trendTone:r=`neutral`,hint:i,emphasis:a=!1}){return c(),(0,w.jsxs)(x,{className:y(`px-4 py-[14px]`,a?`border-[var(--brand-line)]`:null),children:[(0,w.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,w.jsx)(`p`,{className:y(`console-mono mt-[9px] text-[27px] font-semibold tracking-[-0.02em]`,a?`text-[var(--brand)]`:`text-[var(--console-text)]`),children:t}),(0,w.jsxs)(`div`,{className:`mt-[7px] flex items-center gap-[7px]`,children:[n===void 0?null:(0,w.jsx)(`span`,{"data-testid":`overview-kpi-trend`,className:y(`console-mono text-[10.5px]`,Je[r]),children:n}),i===void 0?null:(0,w.jsx)(`span`,{className:`console-mono truncate text-[10.5px] text-[var(--console-muted)]`,children:i})]})]})}function Ye(e){return e.costEstimated===0?l(`All recorded by agents`):e.costEstimated===e.cost&&e.cost>0?l(`All estimated from unit price`):l(`{0} estimated`,[_(e.costEstimated)])}function Xe(e){let t=[e.latestActivityProject,e.latestActivityAgent].filter(e=>!!e);return t.length>0?t.join(` · `):void 0}function Ze({totals:e,rangeDays:t}){c();let n=e.previous,r=(e,t)=>t===void 0?null:d(e,t),i=r(e.sessions,n?.sessions),a=r(e.messages,n?.messages),o=r(e.tokens,n?.tokens),s=r(e.cost,n?.cost),u=n?.cost!==void 0&&e.cost>n.cost;return(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5`,children:[(0,w.jsx)(q,{label:l(`Sessions`),value:m(e.sessions),trend:i??void 0,hint:t?l(`{0}/day`,[qe(e.sessions/t)]):void 0}),(0,w.jsx)(q,{label:l(`Messages`),value:m(e.messages),trend:a??void 0,hint:e.sessions>0?l(`{0}/session`,[qe(e.messages/e.sessions)]):void 0}),(0,w.jsx)(q,{label:l(`Tokens`),value:f(e.tokens),trend:o??void 0,hint:l(`Cache hit {0}`,[g(e.cacheReadTokens/e.tokens)])}),(0,w.jsx)(q,{label:l(`Cost`),value:_(e.cost),trend:s??void 0,trendTone:u?`warning`:`positive`,hint:Ye(e),emphasis:!0}),(0,w.jsx)(q,{label:l(`Last activity`),value:e.latestActivity===void 0?l(`No activity`):v(e.latestActivity),trend:e.latestActivity===void 0?void 0:`●`,trendTone:`positive`,hint:e.latestActivity===void 0?void 0:Xe(e)})]})}var J=32,Y=4;function Qe({shares:e,colors:t,hovered:n,onHover:r,ariaLabel:i,itemLabels:a}){let s=(0,S.useRef)(null),c=R(),l=(0,S.useContext)(o),u=I(s,c),d=(0,S.useRef)(n),f=(0,S.useRef)(()=>{}),p=e.join(`,`),m=t.join(`\0`);return(0,S.useEffect)(()=>{d.current=n,c?f.current():u.requestFrame()},[u,n,c]),(0,S.useEffect)(()=>{let e=s.current,t=e?.parentElement,n=e?.getContext(`2d`);if(!e||!t||!n)return;let r=getComputedStyle(e),i=m.split(`\0`).map(e=>N(r,e)),a=p.split(`,`).map(Number),o=0,l=()=>{o=t.clientWidth;let r=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(o*r),e.height=J*r,n.setTransform(r,0,0,r,0,0)},h=e=>{n.clearRect(0,0,o,J);let t=0;a.forEach((r,a)=>{let s=r*o,c=Math.min(1,s/6),l=t+c,u=s-c*2;if(t+=s,u<=0)return;let f=d.current===a;n.save(),n.beginPath(),n.roundRect(l,0,u,J,Math.min(4,u/2)),n.clip(),n.fillStyle=i[a]??``,n.globalAlpha=d.current===null?.72:f?1:.3,n.beginPath();for(let t=l+Math.min(Y,u)/2;t<l+u;t+=Y)for(let r=Y/2;r<J;r+=Y){let i=O(1-r/J),a=A(t,r,e*.0018),o=Y*((f?.46:.34)+.36*i+.26*a)*(.78+.42*k(t,r));n.rect(t-o/2,r-o/2,o,o)}n.fill(),n.restore()})};f.current=()=>h(performance.now());let g=()=>{l(),c?f.current():u.requestFrame()};u.setFrameHandler(e=>(h(e),d.current===null?`stop`:`idle`));let _=new ResizeObserver(g);return _.observe(t),g(),()=>{_.disconnect(),u.setFrameHandler(null)}},[m,u,c,p,l]),(0,w.jsxs)(`div`,{className:`chart-hatch relative rounded-sm`,style:{height:J},onPointerMove:t=>{let n=t.currentTarget.getBoundingClientRect(),i=(t.clientX-n.left)/n.width,a=0,o=e.findIndex(e=>(a+=e,i<a));r(o<0?null:o)},onPointerLeave:e=>{e.pointerType!==`touch`&&r(null)},children:[(0,w.jsx)(`canvas`,{ref:s,"aria-hidden":!0,className:`block size-full`}),(0,w.jsx)(he,{label:i,itemLabels:a,activeIndex:n,onActiveIndexChange:r,layout:`surface`})]})}function $e({models:e,totalTokens:t}){let n=c(),[r,i]=(0,S.useState)(null),a=(0,S.useMemo)(()=>we(e,t),[n,e,t]),o=a.map(e=>e.value/t),s=o.map(e=>e>0&&e<.001?`<0.1%`:e.toLocaleString(n,{style:`percent`,maximumFractionDigits:1})),u=a.map((e,t)=>`${e.label}: ${m(e.value)} ${l(`tokens`)}, ${s[t]}`),d=a.findIndex(e=>e.key===r),p=a[d],h=(o.slice(0,d).reduce((e,t)=>e+t,0)+(o[d]??0)/2)*100;return(0,w.jsxs)(x,{role:`region`,"aria-label":l(`Tokens by Model`),className:`p-4`,children:[(0,w.jsx)(b,{title:l(`Tokens by Model`),meta:`${f(t)} ${l(`total tokens`)}`}),(0,w.jsx)(`p`,{className:`console-mono mt-1 text-[10.5px] text-[var(--console-muted)]`,children:l(`Token share in the selected range, including cache tokens.`)}),t<=0?(0,w.jsx)(`p`,{className:`console-mono mt-3 text-[11px] text-[var(--console-muted)]`,children:l(`No usage data`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`relative mt-3`,children:[(0,w.jsx)(Qe,{shares:o,colors:a.map(e=>e.color),hovered:d<0?null:d,onHover:e=>i(e===null?null:a[e]?.key??null),ariaLabel:l(`Model token distribution chart`),itemLabels:u}),p?(0,w.jsxs)(T,{index:d,count:a.length,position:h,children:[(0,w.jsx)(`div`,{className:`font-semibold`,children:p.label}),(0,w.jsxs)(`div`,{children:[m(p.value),` `,l(`tokens`),` · `,s[d]]})]}):null]}),(0,w.jsx)(`ul`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-2`,children:a.map((e,t)=>(0,w.jsx)(`li`,{className:`min-w-0 max-w-full`,children:(0,w.jsxs)(`button`,{type:`button`,"aria-label":u[t],className:y(`console-mono flex max-w-full items-center gap-1.5 rounded-sm text-[10.5px] text-[var(--console-text)] focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[var(--brand)]`,p&&p.key!==e.key?`opacity-45`:null),onPointerEnter:()=>i(e.key),onPointerLeave:()=>i(null),onFocus:()=>i(e.key),onBlur:()=>i(null),onClick:()=>i(e.key),onKeyDown:e=>{e.key===`Escape`&&i(null)},children:[(0,w.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-[2px]`,style:{background:e.color}}),(0,w.jsx)(`span`,{className:`truncate`,children:e.label}),(0,w.jsxs)(`span`,{className:`shrink-0 text-[var(--console-muted)]`,children:[e.display,` · `,s[t]]})]})},e.key))})]})]})}var et=[0,1,2,3,4];function X({className:e}){return c(),(0,w.jsx)(`span`,{className:`skeleton-shimmer block rounded-sm ${e}`})}function Z({bodyClassName:e}){return c(),(0,w.jsxs)(x,{className:`p-4`,children:[(0,w.jsx)(X,{className:`h-[15px] w-28`}),(0,w.jsx)(X,{className:`mt-3 ${e}`})]})}function tt(){return c(),(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-hidden":!0,"data-testid":`overview-skeleton`,children:[(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5`,children:et.map(e=>(0,w.jsxs)(x,{className:`px-4 py-[14px]`,children:[(0,w.jsx)(X,{className:`h-[10px] w-16`}),(0,w.jsx)(X,{className:`mt-[9px] h-[27px] w-24`}),(0,w.jsx)(X,{className:`mt-[7px] h-[11px] w-20`})]},e))}),(0,w.jsx)(Z,{bodyClassName:`h-[68px] w-full`}),(0,w.jsxs)(x,{className:`p-4`,children:[(0,w.jsx)(X,{className:`h-[15px] w-28`}),(0,w.jsx)(X,{className:`mt-[14px] h-[168px] w-full`})]}),(0,w.jsx)(Z,{bodyClassName:`h-[428px] w-full`}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1.45fr_1fr]`,children:[(0,w.jsx)(Z,{bodyClassName:`h-[248px] w-full`}),(0,w.jsxs)(`div`,{className:`grid content-start gap-4`,children:[(0,w.jsx)(Z,{bodyClassName:`h-[116px] w-full`}),(0,w.jsx)(Z,{bodyClassName:`h-[100px] w-full`})]})]})]})}function nt(e){return`${String(e*2).padStart(2,`0`)}:00–${String(e*2+2).padStart(2,`0`)}:00`}function rt({count:e,peak:t}){let n=(0,S.useId)(),r=t>0?Math.sqrt(e/t):0,i=12*r;return(0,w.jsx)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,"aria-hidden":`true`,style:{color:`color-mix(in oklab, var(--activity-high) ${r*100}%, var(--activity-low))`},children:e>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`defs`,{children:(0,w.jsx)(`pattern`,{id:n,width:`3`,height:`3`,patternUnits:`userSpaceOnUse`,children:(0,w.jsx)(`rect`,{width:`2`,height:`2`,fill:`currentColor`})})}),(0,w.jsx)(`circle`,{cx:`14`,cy:`14`,r:i,fill:`currentColor`,opacity:`0.2`}),(0,w.jsx)(`circle`,{cx:`14`,cy:`14`,r:i,fill:`url(#${n})`})]}):null})}function it({activity:e}){let t=c(),n=[l(`Overnight`),l(`Morning`),l(`Afternoon`),l(`Evening`)],[r,i]=(0,S.useState)(null),a=t===`zh-CN`?[1,2,3,4,5,6,0]:[0,1,2,3,4,5,6],o=new Intl.DateTimeFormat(t,{weekday:`short`,timeZone:`UTC`}),s=a.map(e=>o.format(Date.UTC(2026,8,6+e))),u=Math.max(0,...e?.counts??[]),d=e?.counts.reduce((e,t)=>e+t,0)??0;return(0,w.jsxs)(x,{className:`p-4`,"aria-label":l(`Active hours`),children:[(0,w.jsx)(b,{title:l(`Active hours`)}),(0,w.jsx)(`p`,{className:`mt-1 text-xs text-[var(--console-muted)]`,children:l(`User messages by weekday and two-hour period. Counts are cumulative within the selected range.`)}),e?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2 console-mono text-[10.5px] text-[var(--console-muted)]`,children:[(0,w.jsx)(`span`,{children:l(`Time zone: {0}`,[e.timeZone])}),(0,w.jsx)(`span`,{children:l(`{0} user messages`,[m(d)])})]}),(0,w.jsxs)(`table`,{className:`mt-[14px] w-full table-fixed border-collapse console-mono text-[10.5px] text-[var(--console-muted)]`,children:[(0,w.jsx)(`caption`,{className:`sr-only`,children:l(`Active hours`)}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`col`,className:t===`en`?`w-16`:`w-9`,children:(0,w.jsx)(`span`,{className:`sr-only`,children:l(`Day period`)})}),(0,w.jsx)(`th`,{scope:`col`,className:`w-11 pb-2 text-left font-normal`,children:l(`Time`)}),s.map(e=>(0,w.jsx)(`th`,{scope:`col`,className:`pb-2 font-normal`,children:e},e))]})}),n.map((t,n)=>(0,w.jsx)(`tbody`,{className:`chart-hatch`,children:Array.from({length:3},(o,c)=>{let d=n*3+c;return(0,w.jsxs)(`tr`,{className:c===0&&n>0?`border-t border-solid border-[var(--console-border-strong)]`:`border-t border-dashed border-[var(--console-border)]`,children:[c===0?(0,w.jsx)(`th`,{scope:`rowgroup`,rowSpan:3,className:`bg-[var(--console-surface)] pr-2 text-left align-middle font-normal`,children:t}):null,(0,w.jsx)(`th`,{scope:`row`,className:`h-8 bg-[var(--console-surface)] text-left font-normal tabular-nums`,children:`${String(d*2).padStart(2,`0`)}:00`}),a.map((t,n)=>{let a=t*12+d,o=e.counts[a]??0,c=`${s[n]} · ${nt(d)} · ${l(`{0} user messages`,[m(o)])}`;return(0,w.jsxs)(`td`,{className:`relative p-0 text-center`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":c,className:`flex h-8 w-full items-center justify-center rounded-sm outline-none hover:bg-[var(--brand-soft)] focus-visible:ring-2 focus-visible:ring-[var(--brand)]`,onMouseEnter:()=>i(a),onMouseLeave:()=>i(null),onFocus:()=>i(a),onBlur:()=>i(null),onClick:()=>i(a),onKeyDown:e=>{e.key===`Escape`&&i(null)},children:(0,w.jsx)(rt,{count:o,peak:u})}),r===a?(0,w.jsxs)(`span`,{role:`tooltip`,className:`pointer-events-none absolute bottom-full z-10 w-max max-w-[180px] rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-2 text-left text-[var(--console-text)] shadow-[var(--shadow-overlay)] ${n<3?`left-0`:`right-0`}`,children:[`${s[n]} · ${nt(d)} · `,(0,w.jsx)(`span`,{className:`font-semibold text-[var(--brand)]`,children:l(`{0} user messages`,[m(o)])})]}):null]},t)})]},d)})},t))]}),(0,w.jsx)(`div`,{className:`mt-3 flex min-h-7 flex-wrap items-center justify-end gap-4 console-mono text-[10.5px] text-[var(--console-muted)]`,children:u===0?(0,w.jsx)(`span`,{children:l(`No user messages in this range.`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,"aria-label":l(`Size reference (messages)`),children:[l(`Less`),[1,4,9].map(e=>(0,w.jsx)(rt,{count:e,peak:9},e)),l(`More`)]}),(0,w.jsx)(`span`,{children:l(`Peak: {0}`,[m(u)])})]})})]}):(0,w.jsx)(`p`,{className:`py-8 text-center text-sm text-[var(--console-muted)]`,children:l(`Activity data is unavailable.`)})]})}var at=.16;function ot(e){return e*e*(3-2*e)}function st(e,t,n){return e<t?t:e>n?n:e}function Q(e,t=new Float32Array(512)){let n=e.length;if(n===0)return t.fill(0),t;for(let r=0;r<512;r++){let i=st(r/511*n-.5,0,n-1),a=Math.min(n-2,Math.floor(i));if(a<0){t[r]=e[0];continue}let o=ot(i-a);t[r]=e[a]*(1-o)+e[a+1]*o}return t}function ct(e,t){let n=st(t,0,1)*511,r=Math.min(510,Math.floor(n)),i=n-r;return e[r]*(1-i)+e[r+1]*i}function lt(e,t){return 1-(t>0?Math.min(1,e/t):0)*.84}var ut=2,dt=460,ft=180,pt=32,mt=.06,ht=.24,gt=/oklch\(\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)/;function _t(e){let t=Math.imul(e^2654435769,2246822507);return t=Math.imul(t^t>>>13,3266489909),((t^t>>>16)>>>0)/4294967296}function vt(e,t){let n=gt.exec(e),r=gt.exec(t);if(!n||!r)return Array.from({length:33},()=>t);let[i,a,o]=[Number(n[1]),Number(n[2]),Number(n[3])],[s,c,l]=[Number(r[1]),Number(r[2]),Number(r[3])];return Array.from({length:33},(e,t)=>{let n=t/pt,r=i+(s-i)*n,u=a+(c-a)*n,d=o+(l-o)*n;return`oklch(${r.toFixed(3)} ${u.toFixed(3)} ${d.toFixed(1)})`})}function yt(e,{values:t,max:n,reducedMotion:r}){let i=(0,S.useContext)(o),a=I(e,r),s=(0,S.useRef)({from:Q(t),to:Q(t),current:Q(t),fromMax:n,toMax:n,currentMax:n,startedAt:0,duration:0}),c=(0,S.useRef)(null),l=(0,S.useRef)(()=>{}),u=(0,S.useRef)({x:-1e4,y:-1e4,smoothX:-1e4,smoothY:-1e4,speed:0,inside:!1});(0,S.useEffect)(()=>{let e=s.current;e.from.set(e.current),e.fromMax=e.currentMax,Q(t,e.to),e.toMax=n,e.startedAt=performance.now(),e.duration=r?0:dt,r?l.current():a.requestFrame()},[a,n,r,t]),(0,S.useEffect)(()=>{let t=e.current,n=t?.parentElement,i=t?.getContext(`2d`);if(!t||!n||!i)return;let o=u.current,d=getComputedStyle(t),f=d.getPropertyValue(`--tile-rest`).trim(),p=vt(d.getPropertyValue(`--tile-wash`).trim(),d.getPropertyValue(`--tile-ink`).trim()),m=()=>{let e=n.clientWidth,r=n.clientHeight;if(!e||!r)return;let a=n.getBoundingClientRect(),o=Math.min(ut,window.devicePixelRatio||1);t.width=Math.round(e*o),t.height=Math.round(r*o),t.style.width=`${e}px`,t.style.height=`${r}px`,i.setTransform(o,0,0,o,0,0),i.imageSmoothingEnabled=!1;let s=Math.max(3,Math.round(e/ft)),l=Math.ceil(e/s),u=Math.ceil(r/s),d=l*u,f=new Uint8Array(d);for(let e=0;e<d;e++)f[e]=+(_t(e)<mt);c.current={cell:s,cols:l,rows:u,width:e,height:r,left:a.left,top:a.top,step:1/o,glow:new Float32Array(d),spark:f}},h=e=>{let t=s.current,n=t.duration>0?Math.min(1,(e-t.startedAt)/t.duration):1;for(let e=0;e<512;e++)t.current[e]=t.from[e]+(t.to[e]-t.from[e])*n;return t.currentMax=t.fromMax+(t.toMax-t.fromMax)*n,n>=1&&(t.duration=0),n<1},g=e=>{let t=u.current,n=t.smoothX,r=t.smoothY,i=1-.72**e;t.smoothX+=(t.x-n)*i,t.smoothY+=(t.y-r)*i,t.speed=Math.hypot(t.smoothX-n,t.smoothY-r)},_=(e,t=1)=>{let n=c.current;if(!n)return!1;let a=s.current,{cell:o,cols:l,rows:d,width:m,height:h,step:g,glow:_,spark:v}=n,y=e=>Math.round(e/g)*g,b=Math.max(g,y(o*.34)),x=y((o-b)/2);i.clearRect(0,0,m,h),i.fillStyle=f;for(let e=0;e<l;e++){let t=e*o+x;for(let e=0;e<d;e++)i.fillRect(t,e*o+x,b,b)}let S=u.current,C=h*(ht+Math.min(1,S.speed/25)*.26),w=!r&&S.inside,T=1-.78**t,E=1-.95**t,D=e*.0018,O=-1,k=!1;for(let t=0;t<l;t++){let n=l>1?(t+.5)/l:.5,s=lt(ct(a.current,n),a.currentMax),c=Math.max(.001,1-s),u=t*o,m=u+o/2;for(let n=0;n<d;n++){let a=t*d+n,l=n*o,b=(l+o/2)/h,x=0;b>=s&&(x=1-.55*((b-s)/c));let A=_[a];if(w){let e=Math.hypot(m-S.smoothX,l+o/2-S.smoothY),t=e<C?1-e/C:0;A+=(t-A)*(t>A?T:E),_[a]=A}else A>0&&(A*=1-E,_[a]=A<.002?0:A);_[a]>0&&(k=!0);let j=Math.min(1,x+A*.5);if(j<=.02)continue;let M=j;r||(M*=1+.07*Math.sin(b*Math.PI*3-D),v[a]&&A>.02&&(M*=1+.25*A*Math.sin(e*.012+a)),M=Math.min(1,M));let N=Math.max(g,y(o*(.28+.42*j))),P=y((o-N)/2),F=Math.round(M*pt);F!==O&&(O=F,i.fillStyle=p[O]??p[pt]??f),i.fillRect(u+P,l+P,N,N)}}return k},v=()=>{m(),h(performance.now()),_(performance.now())};l.current=v;let y=e=>{let t=c.current;if(!t)return;let r=u.current;if(!r.inside){let e=n.getBoundingClientRect();t.left=e.left,t.top=e.top}r.x=e.clientX-t.left,r.y=e.clientY-t.top,r.inside||(r.smoothX=r.x,r.smoothY=r.y),r.inside=!0,a.requestFrame()},b=()=>{u.current.inside=!1,a.requestFrame()},x=0;a.setFrameHandler(e=>{let t=x===0?1:Math.min(3,(e-x)/(1e3/60));x=e;let n=h(e);g(t);let r=_(e,t);return n?`active`:u.current.inside||r?`idle`:(x=0,`stop`)}),m();let S=new ResizeObserver(()=>{m(),r?(h(performance.now()),_(performance.now())):a.requestFrame()});return S.observe(n),r?v():(n.addEventListener(`pointermove`,y,{passive:!0}),n.addEventListener(`pointerleave`,b)),()=>{a.setFrameHandler(null),S.disconnect(),n.removeEventListener(`pointermove`,y),n.removeEventListener(`pointerleave`,b),o.inside=!1}},[e,a,r,i])}var bt=[1,.66,.33,0],xt=e=>`${(1-e*(1-at))*100}%`,St=(e,t)=>(e+.5)/t*100;function Ct({values:e,max:t,labels:n,formatValue:r}){let[i,a]=(0,S.useState)(null),o=(0,S.useRef)(null),s=R(),c=t=>{let n=o.current?.getBoundingClientRect();if(!n?.width)return;let r=(t-n.left)/n.width,i=Math.round(r*e.length-.5);a(Math.min(e.length-1,Math.max(0,i)))},l=i!==null,u=i??0,d=e[u]??0,f=s?void 0:`left 260ms ease-out, top 260ms ease-out`;return(0,w.jsxs)(`div`,{ref:o,className:`absolute inset-0 cursor-crosshair touch-none`,onPointerMove:e=>c(e.clientX),onPointerLeave:()=>a(null),children:[(0,w.jsx)(`span`,{className:y(`pointer-events-none absolute inset-y-0 w-px -translate-x-1/2 bg-[var(--brand-line)] transition-opacity duration-150`,l?`opacity-100`:`opacity-0`),style:{left:`${St(u,e.length)}%`,transition:f}}),(0,w.jsxs)(`div`,{className:y(`pointer-events-none absolute size-0 transition-opacity duration-150`,l?`opacity-100`:`opacity-0`),style:{left:`${St(u,e.length)}%`,top:`${lt(d,t)*100}%`,transition:f},children:[(0,w.jsx)(`span`,{className:`absolute size-[9px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-[var(--brand)] ring-2 ring-[var(--console-surface)]`}),(0,w.jsxs)(`span`,{className:`console-mono absolute bottom-3 flex -translate-x-1/2 items-baseline gap-1.5 rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 whitespace-nowrap shadow-[var(--shadow-overlay)]`,children:[(0,w.jsx)(`span`,{className:`text-[10px] text-[var(--console-muted)]`,children:n[u]}),(0,w.jsx)(`span`,{className:`text-[12px] font-semibold text-[var(--console-text)]`,children:r(d)})]})]})]})}function wt({values:e,max:t,labels:n,height:r,formatValue:i,formatTick:a,className:o}){let s=(0,S.useRef)(null);return yt(s,{values:e,max:t,reducedMotion:R()}),(0,w.jsxs)(`div`,{className:y(`flex`,o),"aria-hidden":!0,children:[a?(0,w.jsx)(`div`,{className:`relative shrink-0`,style:{height:r,width:38},children:bt.map(e=>(0,w.jsx)(`span`,{className:`console-mono absolute right-2 -translate-y-1/2 text-[9.5px] whitespace-nowrap text-[var(--console-muted)]`,style:{top:xt(e)},children:a(t*e)},e))}):null,(0,w.jsxs)(`div`,{className:`chart-hatch relative min-w-0 flex-1`,style:{height:r},children:[bt.map(e=>(0,w.jsx)(`span`,{className:y(`pointer-events-none absolute inset-x-0`,e===0?`h-px bg-[var(--console-border-strong)]`:`border-t border-dashed border-[var(--console-border)]`),style:{top:xt(e)}},e)),(0,w.jsx)(`canvas`,{ref:s,className:`absolute inset-0 block`}),e.length>0?(0,w.jsx)(Ct,{values:e,max:t,labels:n,formatValue:i}):null]})]})}var Tt=168,Et=132,Dt=6,Ot={barRatio:.86,barMax:46,bandGap:2,minBand:3},kt=[{key:`input`,label:`Input`,color:`var(--token-input)`},{key:`output`,label:`Output`,color:`var(--token-output)`},{key:`cache_read`,label:`Cache read`,color:`var(--token-cache-read)`},{key:`cache_create`,label:`Cache write`,color:`var(--token-cache-write)`}],At=kt.map(e=>e.color);function jt(e){return e>=1e3?`$${f(e)}`:`$${Math.round(e)}`}function $(e){return e.input+e.output+e.cache_read+e.cache_create}function Mt(e){return l(`{0}: {1} tokens, {2}, {3} sessions, {4} messages, input {5}, output {6}, cache read {7}, cache write {8}`,[p(e.date),f($(e)),_(e.cost),m(e.sessions),m(e.messages),f(e.input),f(e.output),f(e.cache_read),f(e.cache_create)])}function Nt({daily:e}){c();let t=(0,S.useMemo)(()=>e.map(e=>e.cost),[e]),n=(0,S.useMemo)(()=>e.map(e=>p(e.date)),[e]),r=t.reduce((e,t)=>e+t,0),i=t.reduce((e,t)=>Math.max(e,t),0);return i<=0?null:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`mt-[14px] flex items-baseline justify-between border-t border-dashed border-[var(--console-border)] pt-[11px]`,children:[(0,w.jsx)(`span`,{className:`console-mono text-[10.5px] text-[var(--console-text)]`,children:l(`Daily cost`)}),(0,w.jsxs)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:[l(`Peak`),` `,_(i),` `,l(`· Avg`),` `,_(r/e.length),` `,l(`· Total`),` `,_(r)]})]}),(0,w.jsx)(wt,{values:t,max:i,labels:n,height:Et,formatValue:_,formatTick:jt,className:`mt-[7px]`})]})}function Pt({bucket:e,index:t,count:n}){return c(),(0,w.jsxs)(T,{index:t,count:n,children:[(0,w.jsx)(`div`,{children:p(e.date)}),(0,w.jsxs)(`div`,{children:[f($(e)),` `,l(`tok ·`),` `,(0,w.jsx)(`span`,{className:`text-[var(--brand)]`,children:_(e.cost)})]}),(0,w.jsxs)(`div`,{children:[m(e.sessions),` `,l(`sessions ·`),` `,m(e.messages),` `,l(`messages`)]}),(0,w.jsxs)(`div`,{className:`text-[var(--console-muted)]`,children:[l(`In`),` `,f(e.input),` `,l(`· Out`),` `,f(e.output),` `,l(`· Read`),` `,f(e.cache_read),` `,l(`· Write`),` `,f(e.cache_create)]})]})}function Ft({daily:e}){let t=c(),[n,r]=(0,S.useState)(null),i=(0,S.useMemo)(()=>e.map(e=>kt.map(t=>e[t.key])),[e]),a=(0,S.useMemo)(()=>e.map(Mt),[t,e]),o=(0,S.useMemo)(()=>j(e.reduce((e,t)=>Math.max(e,$(t)),0)),[e]),s=n===null?void 0:e[n.column];return(0,w.jsxs)(`div`,{className:`relative mt-[14px]`,children:[(0,w.jsx)(ve,{values:i,axisMax:o,colors:At,hovered:n,onHover:r,layout:Ot,height:Tt,formatTick:f,ariaLabel:l(`Daily usage chart`),itemLabels:a}),s&&n?(0,w.jsx)(`div`,{className:`absolute inset-x-0 top-0`,style:{left:38},children:(0,w.jsx)(Pt,{bucket:s,index:n.column,count:e.length})}):null]})}function It({daily:e}){c();let t=e[0],n=e[e.length-1],r=t&&n?` · ${p(t.date)} → ${p(n.date)}`:``,i=Math.max(1,Math.ceil(e.length/Dt));return(0,w.jsxs)(x,{role:`region`,"aria-label":l(`Daily usage`),className:`p-4`,children:[(0,w.jsx)(b,{title:l(`Daily usage`),action:(0,w.jsx)(`div`,{className:`console-mono flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-[var(--console-muted)]`,children:kt.map(e=>(0,w.jsxs)(`span`,{"data-testid":`overview-legend-token`,className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`size-2 rounded-[2px]`,style:{background:e.color},"aria-hidden":!0}),l(e.label)]},e.key))})}),(0,w.jsxs)(`p`,{className:`console-mono mt-1 text-[10.5px] text-[var(--console-muted)]`,children:[l(`Stacked bars = token mix · Area below = daily cost`),r]}),e.length===0?(0,w.jsx)(`p`,{className:`console-mono mt-[14px] text-[11px] text-[var(--console-muted)]`,children:l(`No usage data`)}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ft,{daily:e}),(0,w.jsx)(Nt,{daily:e}),(0,w.jsx)(`div`,{style:{paddingLeft:38},children:(0,w.jsx)(`div`,{className:`console-mono mt-2 flex text-[10px] text-[var(--console-muted)]`,children:e.map((t,n)=>(0,w.jsx)(`span`,{className:`flex-1 text-center`,children:n%i===0||n===e.length-1?p(t.date):``},t.date))})})]}),(0,w.jsxs)(`table`,{className:`sr-only`,"aria-label":l(`Daily usage data`),children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:l(`Date`)}),(0,w.jsx)(`th`,{children:l(`Sessions`)}),(0,w.jsx)(`th`,{children:l(`Messages`)}),(0,w.jsx)(`th`,{children:l(`Tokens`)}),(0,w.jsx)(`th`,{children:l(`Cost`)})]})}),(0,w.jsx)(`tbody`,{children:e.map(e=>(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{children:p(e.date)}),(0,w.jsx)(`td`,{children:m(e.sessions)}),(0,w.jsx)(`td`,{children:m(e.messages)}),(0,w.jsx)(`td`,{children:m($(e))}),(0,w.jsx)(`td`,{children:_(e.cost)})]},e.date))})]})]})}function Lt({project:e,agent:t,onAgentChange:n,window:i,agentCatalog:a,rangePreset:o,onRangeChange:s,onSelectCustom:u}){c();let[d,f]=(0,S.useState)(void 0),p=n?t:d,{dashboard:m,error:h,retry:g}=C(i,{project:e,agent:p});return(0,w.jsxs)(`div`,{"data-testid":`dashboard`,className:`mx-auto max-w-6xl space-y-4`,children:[(0,w.jsx)(Ke,{agent:p,onAgentChange:n?void 0:f,agentCatalog:a,scopeCounts:m?.scopeCounts,window:i,rangePreset:o,onRangeChange:s,onSelectCustom:u}),h?(0,w.jsx)(r,{title:l(`Couldn't load the dashboard.`),message:h,onRetry:()=>void g()}):null,m?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(Ze,{totals:m.totals,rangeDays:m.window.days}),(0,w.jsx)($e,{models:m.modelDistribution,totalTokens:m.totals.tokens}),(0,w.jsx)(It,{daily:m.dailyActivity}),(0,w.jsx)(it,{activity:m.activeHours}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(Se,{perAgent:m.perAgent}),(0,w.jsx)(We,{modelCost:m.modelCost,modelDistribution:m.modelDistribution,totals:m.totals})]})]}):h?null:(0,w.jsx)(tt,{})]})}export{Lt as OverviewScreen};
@@ -1 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r}from"./CustomTimeWindowDialog-z5xtqkBF.js";import{S as i,_ as a,c as o,j as s,n as c,t as l,u,v as d}from"./translate-CLoII3EO.js";import{a as f,o as p,p as m}from"./session-indexes-DKukxoe1.js";import{$ as h,G as g,H as _,K as v,Q as y,U as b,W as x,Y as S,Z as C,it as w,nt as T,ot as E,st as D}from"./index-DNw59Qsn.js";import{t as O}from"./utils-Dk_44zMo.js";import{t as k}from"./panel-DcOuALYX.js";import{OverviewScreen as A}from"./OverviewScreen-B9qZqEQA.js";var j=e(t(),1);function M(e){return e.time_updated??e.time_created}function N(e){return e.reference}function P(e,t){let n=i(t);if(e===n)return l(`Today`);if(e===o(n,-1))return l(`Yesterday`);let r=new Date(e);return y(r.getTime())}function F(e){let{session:t}=e,n=N(t);return{routeKey:a(n.agentName,n.sessionId),reference:n,time:M(t),title:x(t),messageCount:t.stats.message_count,cost:t.stats.total_cost??0}}function I(e,t){if(t.length===1){e.push(t[0]);return}let n=t.toSorted((e,t)=>M(e.session)-M(t.session));for(let t=n.length-1;t>=0;--t)e.push(n[t])}function L(e,t,n){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`page total must be a non-negative safe integer`);if(!Number.isSafeInteger(n)||n<=0)throw RangeError(`page limit must be a positive safe integer`);if(e===0)return{offset:0,end:0};let r=Number.isSafeInteger(t)&&t>0?t:0,i=r-r%n,a=Math.floor((e-1)/n)*n,o=Math.min(i,a);return{offset:o,end:o+Math.min(n,e-o)}}function R(e,t){let{session:n,inclusiveStats:r}=e,i=N(n);return{routeKey:a(i.agentName,i.sessionId),reference:i,time:M(n),title:x(n),agentKey:i.agentName,childCount:e.descendantCount,childRoots:e.children,messageCount:r.messageCount,tokens:r.totalTokens,cost:r.cost,isOrphan:t}}function z(e,t=0,n=40){let{offset:r,end:i}=L(e.childCount,t,n),a=[],o=[];I(o,e.childRoots);let s=0;for(;o.length>0&&s<i;){let e=o.pop();s>=r&&a.push(F(e)),s+=1,I(o,e.children)}return{rows:a,offset:r,pageNumber:Math.floor(r/n)+1,hasPrevious:r>0,hasNext:i<e.childCount}}function B(e,t=0,n=40){let{offset:r,end:i}=L(e.mainCount,t,n),a=i-r,o=[],s=0,c=0;for(let t of e.days){if(c===a)break;let e=Math.max(0,r-s);if(s+=t.nodes.length,e>=t.nodes.length)continue;let n=t.nodes.slice(e,e+a-c);if(n.length===0)continue;let i=n.map(e=>R(e,e.session.parent_reference!=null));o.push({dayKey:t.dayKey,dayStart:t.dayStart,label:t.label,mainCount:t.mainCount,subCount:t.subCount,rows:i}),c+=i.length}return{days:o,offset:r,pageNumber:Math.floor(r/n)+1,shown:c,hasPrevious:r>0,hasNext:i<e.mainCount}}function V(e,t){let n=u(e),r=t?.now??Date.now();return{days:d(n.entries).map(e=>({dayKey:e.dayKey,dayStart:e.dayStart,label:P(e.dayStart,r),mainCount:e.mainCount,subCount:e.subCount,nodes:e.nodes})),orphanCount:n.orphans.length,mainCount:n.entries.length,subCount:n.entries.reduce((e,t)=>e+t.descendantCount,0),totalTokens:n.entries.reduce((e,t)=>e+t.inclusiveStats.totalTokens,0)}}function H(e,t,n){return t===`hidden`||e.childCount===0?!1:t===`expanded`||n.has(e.routeKey)}var U=n(),W={sm:`px-2 py-[3px] text-[10.5px]`,md:`px-3 py-[5px] text-xs`};function G({options:e,value:t,onChange:n,size:r=`md`,ariaLabel:i}){let a=b(),o=(0,j.useRef)([]),s=e.findIndex(e=>e.value===t),c=s<0?0:s,l=(t,r)=>{let i=(t+r+e.length)%e.length;n(e[i].value),o.current[i]?.focus()};return(0,U.jsx)(`div`,{ref:a,"data-fluid-hover":`x`,role:`radiogroup`,"aria-label":i,className:`inline-flex rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] p-[3px]`,children:e.map((e,t)=>{let i=t===s;return(0,U.jsx)(`button`,{"data-fluid-item":!0,ref:e=>{o.current[t]=e},type:`button`,role:`radio`,"aria-checked":i,tabIndex:t===c?0:-1,onClick:()=>n(e.value),onKeyDown:e=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),l(t,1)):(e.key===`ArrowLeft`||e.key===`ArrowUp`)&&(e.preventDefault(),l(t,-1))},className:O(`console-mono motion-hover rounded-sm border border-transparent whitespace-nowrap focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,W[r],i?`bg-[var(--brand)] text-[var(--brand-fg)]`:`text-[var(--console-muted)] hover:text-[var(--console-text)]`),children:e.label},e.value)})})}var K=[{value:`collapsed`,label:`Collapsed`},{value:`expanded`,label:`Expand all`},{value:`hidden`,label:`Hidden`}];function q({mode:e,onChange:t}){return c(),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`console-eyebrow`,children:l(`Sub-sessions`)}),(0,U.jsx)(G,{options:K.map(e=>({...e,label:l(e.label)})),value:e,onChange:t,size:`sm`,ariaLabel:l(`Sub-session display`)})]})}function J({id:e,row:t,onOpen:n}){c();let[r,i]=(0,j.useState)(0),a=(0,j.useMemo)(()=>z(t,r),[r,t]);return(0,U.jsxs)(`div`,{id:e,className:`border-t border-dashed border-[var(--console-border-strong)] bg-[var(--console-surface-muted)] p-[10px_16px_12px_66px]`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{className:`console-eyebrow`,children:l(`Sub-sessions · derived from this session`)}),t.childCount>40?(0,U.jsx)(`span`,{className:`console-mono text-[10px] text-[var(--console-muted)]`,children:l(`Page {0} · {1} shown`,[a.pageNumber,a.rows.length])}):null]}),(0,U.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5 border-l border-dashed border-[var(--console-border-strong)] pl-[14px]`,children:a.rows.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.reference),className:`motion-hover flex items-center gap-[11px] rounded-md border border-[var(--console-border)] bg-[var(--console-surface)] p-[9px_12px] text-left hover:border-[var(--console-border-strong)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,U.jsx)(`span`,{className:`console-mono w-[34px] shrink-0 text-[10px] text-[var(--console-muted)]`,children:g(e.time)}),e.kind==null?null:(0,U.jsx)(`span`,{className:`console-mono shrink-0 rounded-sm border border-[var(--console-border)] px-1.5 text-[9.5px] text-[var(--console-muted)]`,children:e.kind}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] text-[var(--console-text)]`,children:e.title}),(0,U.jsxs)(`span`,{className:`console-mono shrink-0 text-[10px] text-[var(--console-muted)]`,children:[S(e.messageCount),` `,l(`msgs ·`),` `,w(e.cost)]})]},e.routeKey))}),a.hasPrevious||a.hasNext?(0,U.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":l(`Previous sub-session page`),disabled:!a.hasPrevious,onClick:()=>i(a.offset-40),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 text-[10px] text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Previous`)}),(0,U.jsx)(`button`,{type:`button`,"aria-label":l(`Next sub-session page`),disabled:!a.hasNext,onClick:()=>i(a.offset+40),className:`console-mono rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2 py-1 text-[10px] text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Next`)})]}):null]})}function Y({row:e,mode:t,expanded:n,agentCatalog:r,onToggle:i,onOpen:a}){c();let o=(0,j.useId)(),s=D(r,e.agentKey),u=s?.displayName??e.agentKey,d=e.childCount>0;return(0,U.jsxs)(`article`,{className:`overflow-hidden rounded-lg border bg-[var(--console-surface)] shadow-[var(--shadow-raised)] ${n?`border-[var(--brand-line)]`:`border-[var(--console-border)]`}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-[13px] p-[13px_16px]`,children:[(0,U.jsx)(`span`,{className:`console-mono w-[38px] shrink-0 text-[11px] text-[var(--console-muted)]`,children:g(e.time)}),e.isOrphan?(0,U.jsx)(`span`,{className:`console-mono shrink-0 rounded-sm border border-[var(--console-border-strong)] px-1.5 text-[9.5px] text-[var(--console-muted)]`,children:l(`Unmounted`)}):null,(0,U.jsx)(`span`,{className:`inline-flex size-6 shrink-0 items-center justify-center rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)]`,children:s?.icon?(0,U.jsx)(_,{icon:s.icon,iconColored:s.iconColored,alt:u,className:`size-[13px] object-contain`}):null}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>a(e.reference),className:`min-w-0 flex-1 text-left focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[13.5px] font-medium text-[var(--console-text)]`,children:e.title}),(0,U.jsxs)(`span`,{className:`console-mono mt-[3px] block truncate text-[10.5px] text-[var(--console-muted)]`,children:[u,` · `,S(e.messageCount),` `,l(`msgs ·`),` `,v(e.tokens),` `,l(`tok`),` `,d?l(` · {0} sub-sessions`,[e.childCount]):``]})]}),d&&t!==`hidden`?(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":o,onClick:()=>i(e.routeKey),className:`console-mono motion-hover inline-flex shrink-0 items-center gap-1.5 rounded-full border border-[var(--brand-line)] bg-[var(--brand-soft)] px-2.5 py-[3px] text-[10.5px] text-[var(--brand)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,U.jsx)(`span`,{className:`text-[11px]`,children:`⑂`}),e.childCount,` `,l(`sub`),` `,(0,U.jsx)(`span`,{className:`opacity-70`,children:n?`▾`:`▸`})]}):null,(0,U.jsxs)(`span`,{className:`console-mono w-[76px] shrink-0 text-right text-[11px] text-[var(--console-muted)]`,children:[w(e.cost),d?l(` incl. sub`):``]})]}),n?(0,U.jsx)(J,{id:o,row:e,onOpen:a}):null]})}function X({day:e,mode:t,openIds:n,agentCatalog:r,onToggle:i,onOpen:a}){return c(),(0,U.jsxs)(`div`,{className:`flex gap-5`,children:[(0,U.jsxs)(`div`,{className:`w-[84px] shrink-0 pt-[14px] text-right`,children:[(0,U.jsx)(`div`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:e.label}),(0,U.jsxs)(`div`,{className:`console-mono mt-0.5 text-[10px] text-[var(--console-muted)]`,children:[e.mainCount,` `,l(`main ·`),` `,e.subCount,` `,l(`sub`)]})]}),(0,U.jsxs)(`div`,{className:`relative flex min-w-0 flex-1 flex-col gap-2.5 border-l border-[var(--console-border)] py-2.5 pr-0 pl-[22px]`,children:[(0,U.jsx)(`span`,{className:`absolute top-[18px] -left-[4px] size-[7px] rounded-full bg-[var(--brand)]`}),e.rows.map(e=>(0,U.jsx)(Y,{row:e,mode:t,expanded:H(e,t,n),agentCatalog:r,onToggle:i,onOpen:a},e.routeKey))]})]})}function Z({sessions:e,projectName:t,agentCatalog:n,onOpenSession:r}){let i=c(),[a,o]=(0,j.useState)(`collapsed`),[s,u]=(0,j.useState)(()=>new Set),[d,f]=(0,j.useState)(0),p=(0,j.useMemo)(()=>V(e),[i,e]),m=(0,j.useMemo)(()=>B(p,d),[d,p]),h=(0,j.useCallback)(e=>{u(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]);return(0,U.jsxs)(`section`,{"aria-label":l(`{0} timeline`,[t]),className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(`span`,{className:`console-mono text-[11px] text-[var(--console-muted)]`,children:l(`{0} sessions · {1} sub-sessions · {2} tokens`,[p.mainCount,p.subCount,v(p.totalTokens)])}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(q,{mode:a,onChange:o})})]}),p.mainCount>40?(0,U.jsxs)(`div`,{className:`console-mono flex items-center justify-between gap-3 text-[11px] text-[var(--console-muted)]`,children:[(0,U.jsx)(`span`,{children:l(`Page {0} · {1} shown`,[m.pageNumber,m.shown])}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":l(`Previous timeline page`),disabled:!m.hasPrevious,onClick:()=>f(m.offset-40),className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Previous`)}),(0,U.jsx)(`button`,{type:`button`,"aria-label":l(`Next timeline page`),disabled:!m.hasNext,onClick:()=>f(m.offset+40),className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Next`)})]})]}):null,(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,children:m.days.map(e=>(0,U.jsx)(X,{day:e,mode:a,openIds:s,agentCatalog:n,onToggle:h,onOpen:r},e.dayKey))}),p.orphanCount>0?(0,U.jsxs)(`p`,{className:`console-mono text-[10.5px] text-[var(--console-muted)]`,children:[p.orphanCount,` `,l(`unmounted sub-sessions · parent file is gone`)]}):null]})}function Q({label:e,value:t,hint:n}){return c(),(0,U.jsxs)(k,{className:`p-[14px_16px]`,children:[(0,U.jsx)(`p`,{className:`console-eyebrow`,children:e}),(0,U.jsx)(`p`,{className:`console-mono mt-[9px] text-[27px] font-semibold tracking-[-0.02em] text-[var(--console-text)]`,children:t}),n?(0,U.jsx)(`p`,{className:`console-mono mt-[7px] text-[10.5px] text-[var(--console-muted)]`,children:n}):null]})}function $({agents:e,agentCatalog:t}){return c(),e.length===0?null:(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:e.slice(0,4).map(e=>{let n=D(t,e.name);return(0,U.jsxs)(`span`,{className:`console-mono inline-flex items-center gap-1 rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-1.5 py-0.5 text-[10px] text-[var(--console-muted)]`,children:[n?.icon?(0,U.jsx)(_,{icon:n.icon,iconColored:n.iconColored,alt:n.displayName,className:`size-3 object-contain`}):null,n?.displayName??e.name,` · `,e.sessions]},e.name)})})}function ee({project:e,agentCatalog:t}){return c(),(0,U.jsx)(`li`,{children:(0,U.jsxs)(p,{to:f({kind:e.identityKind,key:e.identityKey}),className:`block rounded-lg border border-[var(--console-border)] bg-[var(--console-surface)] p-4 shadow-[var(--shadow-raised)] motion-hover hover:border-[var(--brand-line)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h2`,{className:`line-clamp-1 text-[13px] font-medium text-[var(--console-text)]`,children:e.displayName}),(0,U.jsx)(`p`,{className:`console-mono mt-[5px] break-all text-[10.5px] text-[var(--console-muted)]`,children:e.identityKey})]}),(0,U.jsxs)(`div`,{className:`console-mono flex shrink-0 flex-wrap gap-2 text-[11px] text-[var(--console-text-secondary)]`,children:[(0,U.jsxs)(`span`,{children:[h(e.sessionCount),` `,l(`sessions`)]}),(0,U.jsxs)(`span`,{children:[v(e.tokens),` `,l(`tokens`)]}),(0,U.jsx)(`span`,{className:`text-[var(--brand)]`,children:C(e.cost)}),(0,U.jsx)(`span`,{className:`text-[var(--console-muted)]`,children:T(e.lastActivity)})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 md:flex-row md:items-center md:justify-between`,children:[(0,U.jsx)($,{agents:e.agentStats,agentCatalog:t}),(0,U.jsx)(`span`,{className:`console-eyebrow`,children:e.identityKind})]})]})})}function te({initialPage:e,window:t,agentCatalog:n,loading:i,error:a,onRetry:o}){c();let s=E(t,e),u=s.page??e,d=u.projects.slice(0,250),f=s.error??a,p=s.error?()=>void s.retry():o;return u.summary.projects===0?f?(0,U.jsx)(`div`,{className:`mx-auto max-w-6xl`,children:(0,U.jsx)(r,{title:l(`Couldn't load projects.`),message:f,onRetry:p})}):i||s.loading?(0,U.jsx)(k,{className:`mx-auto max-w-6xl p-6 text-sm text-[var(--console-muted)]`,children:l(`Loading projects...`)}):(0,U.jsx)(k,{className:`mx-auto max-w-6xl p-6 text-sm text-[var(--console-muted)]`,children:l(`No projects found`)}):(0,U.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[f?(0,U.jsx)(r,{title:l(`Couldn't refresh projects.`),message:f,onRetry:p}):null,(0,U.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-4`,children:[(0,U.jsx)(Q,{label:l(`Projects`),value:h(u.summary.projects)}),(0,U.jsx)(Q,{label:l(`Sessions`),value:h(u.summary.sessions)}),(0,U.jsx)(Q,{label:l(`Tokens`),value:v(u.summary.tokens)}),(0,U.jsx)(Q,{label:l(`Total Cost`),value:C(u.summary.cost),hint:u.summary.latestActivity?l(`Latest {0}`,[T(u.summary.latestActivity)]):void 0})]}),(0,U.jsxs)(`div`,{className:`console-mono flex items-center justify-between gap-3 text-[11px] text-[var(--console-muted)]`,children:[(0,U.jsx)(`span`,{children:l(`Page {0} · {1} shown`,[s.pageNumber,h(d.length)])}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:!s.canPrevious,onClick:s.previous,className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Previous`)}),(0,U.jsx)(`button`,{type:`button`,disabled:!s.canNext,onClick:s.next,className:`rounded-sm border border-[var(--console-border)] bg-[var(--console-surface)] px-2.5 py-1.5 text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface-muted)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40`,children:l(`Next`)})]})]}),(0,U.jsx)(`ul`,{className:`grid gap-3`,children:d.map(e=>(0,U.jsx)(ee,{project:e,agentCatalog:n},`${e.identityKind}:${e.identityKey}`))})]})}function ne({agents:e,agentCatalog:t,activeAgent:n,onChange:r}){c();let i=e=>`console-mono inline-flex items-center gap-1 rounded-full border px-[13px] py-[5px] text-[11px] motion-hover focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none ${e?`border-[var(--brand)] bg-[var(--brand)] text-[var(--brand-fg)]`:`border-[var(--console-border)] bg-[var(--console-surface)] text-[var(--console-muted)] hover:border-[var(--brand-line)]`}`;return(0,U.jsx)(k,{className:`p-3`,children:(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`console-eyebrow`,children:l(`Agent`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(void 0),className:i(!n),children:l(`All Agents`)}),e.map(e=>{let a=D(t,e.name),o=n===e.name;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(o?void 0:e.name),className:i(o),children:[a?.icon?(0,U.jsx)(_,{icon:a.icon,iconColored:a.iconColored,alt:a.displayName,className:`size-3 object-contain`}):null,a?.displayName??e.name,` · `,e.sessions]},e.name)})]})})}function re({project:e}){return c(),(0,U.jsxs)(k,{className:`p-4`,children:[(0,U.jsx)(`h2`,{className:`console-display text-[19px] font-semibold text-[var(--console-text)]`,children:e.displayName}),(0,U.jsxs)(`p`,{className:`console-mono mt-1 break-all text-[10.5px] text-[var(--console-muted)]`,children:[e.identityKind,`: `,e.identityKey]})]})}function ie({project:e,loading:t,error:n,onRetry:i,agentCatalog:a,projectKey:o,sessions:u,activeAgent:d,onChangeAgent:f,timeWindow:h,rangePreset:g,onRangeChange:_,onSelectCustom:v}){c();let y=m();if(t)return(0,U.jsx)(k,{className:`mx-auto max-w-4xl p-6 text-sm text-[var(--console-muted)]`,children:l(`Loading project...`)});if(n)return(0,U.jsx)(`div`,{className:`mx-auto max-w-4xl`,children:(0,U.jsx)(r,{title:l(`Couldn't load project.`),message:n,onRetry:i})});if(!e)return(0,U.jsxs)(k,{className:`mx-auto max-w-4xl p-6`,children:[(0,U.jsx)(`h2`,{className:`console-display text-[15px] font-semibold text-[var(--console-text)]`,children:l(`Project Not Found`)}),(0,U.jsx)(`p`,{className:`console-mono mt-2 break-all text-xs text-[var(--console-muted)]`,children:o}),(0,U.jsx)(p,{to:`/projects`,className:`console-mono mt-4 inline-flex rounded-sm border border-[var(--console-border)] bg-[var(--console-surface-muted)] px-2 py-1 text-xs text-[var(--console-text)] motion-hover hover:bg-[var(--console-surface)] focus-visible:ring-2 focus-visible:ring-[var(--brand)] focus-visible:outline-none`,children:l(`Back to Projects`)})]});let b=d?u.filter(e=>e.reference.agentName===d):u;return(0,U.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-4`,children:[(0,U.jsx)(re,{project:e}),(0,U.jsx)(ne,{agents:e.agentStats,agentCatalog:a,activeAgent:d,onChange:f}),(0,U.jsx)(A,{project:{kind:e.identityKind,key:e.identityKey},agent:d,onAgentChange:f,window:h,agentCatalog:a,rangePreset:g,onRangeChange:_,onSelectCustom:v},`${e.identityKind}:${e.identityKey}`),(0,U.jsx)(Z,{sessions:b,projectName:e.displayName,agentCatalog:a,onOpenSession:e=>y(s(e))},`${e.identityKind}:${e.identityKey}:${d??`all`}`)]})}export{ie as ProjectDashboardView,te as ProjectsOverview};