diff --git a/CHANGELOG.md b/CHANGELOG.md index b65d95e..35846db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,28 @@ polish (plan-limit windows, orchestrator-lifecycle fixes, Homebrew formula, firs Phase 3 (Delight) has no plan by design. +## [0.47.0] - 2026-09-02 + +### Added + +- **Pick up a session Caprock did not start.** It never types into a process it + did not launch — two writers on one terminal interleave characters and ruin + both — so a session you started yourself was readable here and nothing else. + + There is now a button on it. `claude --resume` starts a *second* process on + the same conversation, with the history read from disk: nothing is taken away + from the terminal that already has it, and the new process is one Caprock + started, so it can be typed into like any other. The stats, the timeline and + the terminal all work on it. + + While the original is still running the copy branches instead — + `--fork-session`, a new id — because two live processes sharing one id would + write a single transcript between them and each end up holding half the + other's turns. Once it has ended, it simply continues. + + The command is offered for copying too, for people who would rather stay in + their own terminal. + ## [0.46.0] - 2026-09-02 ### Added diff --git a/internal/agents/agents.go b/internal/agents/agents.go index cddabf8..5a0e164 100644 --- a/internal/agents/agents.go +++ b/internal/agents/agents.go @@ -32,10 +32,28 @@ type SpawnRequest struct { PermissionMode string `json:"permission_mode,omitempty"` // --permission-mode Command string `json:"command,omitempty"` // default "claude" // Agent picks which coding agent to launch: "claude" (default) or - // "gemini". They take different flags — gemini has no --session-id and - // spells the model -m — so the argv is built per agent rather than + // "gemini". They take different flags — gemini spells the model -m and + // needs --skip-trust — so the argv is built per agent rather than // pretending one shape fits both. Agent string `json:"agent,omitempty"` + // Resume continues an existing conversation instead of starting a new one. + // + // This is how a session that lives in somebody's terminal can be picked up + // inside Caprock. It cannot type into a process it did not start — two + // writers on one PTY interleave characters and ruin both — so it starts a + // second process on the same conversation, which is what `--resume` is for. + // The history is on disk, so nothing is lost and nothing is fought over. + Resume string `json:"resume,omitempty"` + // Fork branches the resumed conversation into a new session id rather than + // reusing the original. + // + // Set when the session being picked up is still running somewhere: two live + // processes claiming one id would write the same transcript and each end up + // with half the other's turns. A fork keeps the history and leaves the + // original alone. Claude Code refuses --session-id alongside --resume + // unless --fork-session is present, which is the same distinction from the + // other side. + Fork bool `json:"fork,omitempty"` // GeminiKey is the key the daemon holds, passed into the child's // environment. Never accepted from the browser — the API fills it in from // settings, so a page cannot hand a spawned process someone else's @@ -337,7 +355,19 @@ func (m *Manager) Spawn(ctx context.Context, req SpawnRequest) (*Agent, error) { args = append(args, req.Args...) default: command = m.claude - args = []string{"--session-id", sessionID} + switch { + case req.Resume != "" && req.Fork: + // A branch: the original keeps running under its own id, and this + // process gets a fresh one. Both flags are required together — + // Claude Code refuses --session-id with --resume otherwise. + args = []string{"--resume", req.Resume, "--fork-session", "--session-id", sessionID} + case req.Resume != "": + // Continuing the same conversation, which already has an id. + args = []string{"--resume", req.Resume} + sessionID = req.Resume + default: + args = []string{"--session-id", sessionID} + } if req.Model != "" { args = append(args, "--model", req.Model) } diff --git a/internal/agents/agents_test.go b/internal/agents/agents_test.go index a2c709c..7f21acc 100644 --- a/internal/agents/agents_test.go +++ b/internal/agents/agents_test.go @@ -612,3 +612,69 @@ func TestUnmappableModeIsLeftOffRatherThanGuessed(t *testing.T) { t.Errorf("an unmappable mode was guessed at: %v", f.lastSpec.Args) } } + +// Caprock cannot type into a session it did not start: two writers on one PTY +// interleave characters and ruin both, which is why rule 7 exists. What it can +// do is start a second process on the same conversation — the history is on +// disk, so nothing is lost and nothing is fought over. +func TestResumingContinuesAnExistingConversation(t *testing.T) { + m, _, f := newMgr(t) + defer m.Shutdown() + + const existing = "61d26e6d-8788-4ba6-aac2-547c957a9cd2" + if _, err := m.Spawn(context.Background(), SpawnRequest{ + Cwd: t.TempDir(), Resume: existing, + }); err != nil { + t.Fatal(err) + } + joined := strings.Join(f.lastSpec.Args, " ") + if !strings.Contains(joined, "--resume "+existing) { + t.Errorf("the conversation was not resumed: %v", f.lastSpec.Args) + } + // Claude Code refuses both: --session-id names a new session, --resume an + // existing one. Sending both is an error at the binary, after the terminal + // has already opened. + if strings.Contains(joined, "--session-id") { + t.Errorf("--session-id was sent alongside --resume: %v", f.lastSpec.Args) + } +} + +func TestForkingBranchesRatherThanSharingAnId(t *testing.T) { + // Set when the original is still running somewhere. Two live processes + // claiming one id would write the same transcript and each end up with half + // the other's turns. + m, _, f := newMgr(t) + defer m.Shutdown() + + const existing = "61d26e6d-8788-4ba6-aac2-547c957a9cd2" + ag, err := m.Spawn(context.Background(), SpawnRequest{ + Cwd: t.TempDir(), Resume: existing, Fork: true, + }) + if err != nil { + t.Fatal(err) + } + joined := strings.Join(f.lastSpec.Args, " ") + for _, must := range []string{"--resume " + existing, "--fork-session", "--session-id"} { + if !strings.Contains(joined, must) { + t.Errorf("a fork is missing %q: %v", must, f.lastSpec.Args) + } + } + if ag.SessionID == existing { + t.Error("a fork reused the original's id; both would write one transcript") + } +} + +func TestANormalSpawnStillGetsItsOwnId(t *testing.T) { + m, _, f := newMgr(t) + defer m.Shutdown() + if _, err := m.Spawn(context.Background(), SpawnRequest{Cwd: t.TempDir()}); err != nil { + t.Fatal(err) + } + joined := strings.Join(f.lastSpec.Args, " ") + if !strings.Contains(joined, "--session-id fixed-session-id") { + t.Errorf("a plain spawn lost its session id: %v", f.lastSpec.Args) + } + if strings.Contains(joined, "--resume") { + t.Errorf("a plain spawn resumed something: %v", f.lastSpec.Args) + } +} diff --git a/internal/api/dist/assets/index-BI85SuQu.js b/internal/api/dist/assets/index-C_Ali4sj.js similarity index 97% rename from internal/api/dist/assets/index-BI85SuQu.js rename to internal/api/dist/assets/index-C_Ali4sj.js index a40649e..5cd5398 100644 --- a/internal/api/dist/assets/index-BI85SuQu.js +++ b/internal/api/dist/assets/index-C_Ali4sj.js @@ -93,9 +93,9 @@ void main() { outColor = v_color; }`,Nm=8,Pm=Nm*Float32Array.BYTES_PER_ELEMENT,Fm=20*Nm,Im=class{constructor(){this.attributes=new Float32Array(Fm),this.count=0}},Lm=0,Rm=0,zm=0,Bm=0,Vm=0,Hm=0,Um=0,Wm=class extends hf{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Im,this._verticesCursor=new Im;let i=this._gl;this._program=Lf(lm(i,jm,Mm)),this._register(ff(()=>i.deleteProgram(this._program))),this._projectionLocation=Lf(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(ff(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(ff(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Lf(i.createBuffer()),this._register(ff(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Pm,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Pm,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Pm,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,cm),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i>24&255)/255,Vm=(Lm>>16&255)/255,Hm=(Lm>>8&255)/255,Um=1,this._addRectangle(e.attributes,t,Rm,zm,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Bm,Vm,Hm,Um)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Gm=class extends hf{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(ff(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Lf(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=tm(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=rp,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Km=class extends Gm{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&$p(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t=0;!(Zm.indexOf(`Chrome`)>=0)&&Zm.indexOf(`Safari`),Zm.indexOf(`Electron/`),Zm.indexOf(`Android`);var $m=!1;if(typeof qm.matchMedia==`function`){let e=qm.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=qm.matchMedia(`(display-mode: fullscreen)`);$m=e.matches,Xm(qm,e,({matches:e})=>{$m&&t.matches||($m=e)})}function eh(){return $m}var th=`en`,nh=!1,rh=!1,ih=!1,ah=th,oh,sh=globalThis,ch;typeof sh.vscode<`u`&&typeof sh.vscode.process<`u`?ch=sh.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(ch=process);var lh=typeof ch?.versions?.electron==`string`&&ch?.type===`renderer`;if(typeof ch==`object`){ch.platform,ch.platform,nh=ch.platform===`linux`,nh&&ch.env.SNAP&&ch.env.SNAP_REVISION,ch.env.CI||ch.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ah=th;let e=ch.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,ah=t.resolvedLanguage||th,t.languagePack?.translationsConfigFile}catch{}rh=!0}else typeof navigator==`object`&&!lh?(oh=navigator.userAgent,oh.indexOf(`Windows`),oh.indexOf(`Macintosh`),(oh.indexOf(`Macintosh`)>=0||oh.indexOf(`iPad`)>=0||oh.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,nh=oh.indexOf(`Linux`)>=0,oh?.indexOf(`Mobi`),ih=!0,ah=globalThis._VSCODE_NLS_LANGUAGE||th,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var uh=rh;ih&&typeof sh.importScripts==`function`&&sh.origin;var dh=oh,fh=ah,ph;(e=>{function t(){return fh}e.value=t;function n(){return fh.length===2?fh===`en`:fh.length>=3&&fh[0]===`e`&&fh[1]===`n`&&fh[2]===`-`}e.isDefaultVariant=n;function r(){return fh===`en`}e.isDefault=r})(ph||={});var mh=typeof sh.postMessage==`function`&&!sh.importScripts;(()=>{if(mh){let e=[];sh.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),sh.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var hh=!!(dh&&dh.indexOf(`Chrome`)>=0);dh&&dh.indexOf(`Firefox`),!hh&&dh&&dh.indexOf(`Safari`),dh&&dh.indexOf(`Edg/`),dh&&dh.indexOf(`Android`);var gh=typeof navigator==`object`?navigator:{};uh||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||gh&&gh.clipboard&&gh.clipboard.writeText,uh||gh&&gh.clipboard&&gh.clipboard.readText,uh||eh()||gh.keyboard,`ontouchstart`in qm||gh.maxTouchPoints,qm.PointerEvent&&(`ontouchstart`in qm||navigator.maxTouchPoints);var _h=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},vh=new _h,yh=new _h,bh=new _h;Array(230);var xh;(e=>{function t(e){return vh.keyCodeToStr(e)}e.toString=t;function n(e){return vh.strToKeyCode(e)}e.fromString=n;function r(e){return yh.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return bh.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return yh.strToKeyCode(e)||bh.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return vh.keyCodeToStr(e)}e.toElectronAccelerator=o})(xh||={});var Sh=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Ch;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof wh?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Op.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Sh})})(Ch||={});var wh=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Sh:(this._emitter||=new Vp,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Th;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Th||={});var Eh=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Vp,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Eh.EMPTY=Eh.fromArray([]);function Dh(e){return Oh(e,0)}function Oh(e,t){switch(typeof e){case`object`:return e===null?kh(349,t):Array.isArray(e)?Mh(e,t):Nh(e,t);case`string`:return jh(e,t);case`boolean`:return Ah(e,t);case`number`:return kh(e,t);case`undefined`:return kh(937,t);default:return kh(617,t)}}function kh(e,t){return(t<<5)-t+e|0}function Ah(e,t){return kh(e?433:863,t)}function jh(e,t){t=kh(149417,t);for(let n=0,r=e.length;nOh(t,e),t)}function Nh(e,t){return t=kh(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=jh(n,t),Oh(e[n],t)),t)}var{registerWindow:Ph,getWindow:Fh,getDocument:Ih,getWindows:Lh,getWindowsCount:Rh,getWindowId:zh,getWindowById:Bh,hasWindow:Vh,onDidRegisterWindow:Hh,onWillUnregisterWindow:Uh,onDidUnregisterWindow:Wh}=function(){let e=new Map,t={window:qm,disposables:new mf};e.set(qm.vscodeWindowId,t);let n=new Vp,r=new Vp,i=new Vp;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return hf.None;let a=new mf,o={window:t,disposables:a.add(new mf)};return e.set(t.vscodeWindowId,o),a.add(ff(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Kh(t,Jh.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:qm},getDocument(e){return Fh(e).document}}}(),Gh=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Kh(e,t,n,r){return new Gh(e,t,n,r)}var qh=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};qh.None=new qh(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Dh(n),a=r.get(i);if(a)a.users+=1;else{let o=new Vp,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(ff(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Jh={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Qm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Qm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Qm?`webkitAnimationIteration`:`animationiteration`},Yh=class extends hf{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new gf,this._charAtlasDisposable=this._register(new gf),this._observerDisposable=this._register(new gf),this._model=new Am,this._workCell=new sm,this._workCell2=new sm,this._rectangleRenderer=this._register(new gf),this._glyphRenderer=this._register(new gf),this._onChangeTextureAtlas=this._register(new Vp),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Vp),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Vp),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Vp),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Vp),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new tp(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Km(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Gf(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Kh(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(Kh(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,nm(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=am(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=am(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ff(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),nm(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Wm(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Sm(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=tm(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=df(Op.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Op.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new im(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=Zh(e,n.rows-1,0),t=Zh(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v=p[1],d?(l=!0,r=new Xh(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*Tm,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ee&&o===S&&(y===w&&(this._model.cursor={x:w,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+r.getWidth()-1),y>=w&&y<=T&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+Em]!==this._cellColorResolver.result.bg||this._model.cells[v+Dm]!==this._cellColorResolver.result.fg||this._model.cells[v+Om]!==this._cellColorResolver.result.ext)&&(E=!0,h.length>1&&(g|=km),this._model.cells[v]=g,this._model.cells[v+Em]=this._cellColorResolver.result.bg,this._model.cells[v+Dm]=this._cellColorResolver.result.fg,this._model.cells[v+Om]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*Tm,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,wf,0,0),this._model.cells[b]=0,this._model.cells[b+Em]=this._cellColorResolver.result.bg,this._model.cells[b+Dm]=this._cellColorResolver.result.fg,this._model.cells[b+Om]=this._cellColorResolver.result.ext;y--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Xh=class extends Cp{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Zh(e,t,n=0){return Math.max(Math.min(e,t),n)}var Qh=`di$target`,$h=`di$dependencies`,eg=new Map;function tg(e){if(eg.has(e))return eg.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ng(t,e,r)};return t._id=e,eg.set(e,t),t}function ng(e,t,n){t[Qh]===t?t[$h].push({id:e,index:n}):(t[$h]=[{id:e,index:n}],t[Qh]=t)}tg(`BufferService`),tg(`CoreMouseService`),tg(`CoreService`),tg(`CharsetService`),tg(`InstantiationService`),tg(`LogService`);var rg=tg(`OptionsService`);tg(`OscLinkService`),tg(`UnicodeService`),tg(`DecorationService`);var ig={trace:0,debug:1,info:2,warn:3,error:4,off:5},ag=`xterm.js: `,og=class extends hf{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),sg=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=ig[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new Yh(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Op.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Op.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Op.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Op.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(ff(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function lg({sessionId:e,owned:t,cwd:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!a.current||!t)return;let n=getComputedStyle(document.documentElement),r=(e,t)=>n.getPropertyValue(e).trim()||t,i=new Vd({convertEol:!1,cursorBlink:!0,fontFamily:r(`--font-mono`,`monospace`),fontSize:12,theme:{background:r(`--color-bg`,`#0b0e14`),foreground:r(`--color-fg`,`#d3dae3`),cursor:r(`--color-accent`,`#5ea1ff`),selectionBackground:r(`--color-border-strong`,`#2b3646`)},scrollback:1e4}),o=new Wd;i.loadAddon(o),i.open(a.current);try{let e=new cg;e.onContextLoss(()=>{e.dispose()}),i.loadAddon(e)}catch{}try{o.fit()}catch{}for(let e of[`A`,`ā`,`Ы`,`Ѣ`,`Ω`,`ế`])document.fonts?.load(`12px "JetBrains Mono Variable"`,e).catch(()=>{});document.fonts?.ready.then(()=>{try{o.fit()}catch{}});let s=location.protocol===`https:`?`wss`:`ws`,c=new WebSocket(`${s}://${location.host}/v1/agents/${encodeURIComponent(e)}/term`);c.binaryType=`arraybuffer`,c.onmessage=e=>{i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data))},c.onclose=()=>i.write(`\r \x1B[2m[session ended]\x1B[0m\r -`);let l=new TextEncoder,u=e=>{c.readyState===WebSocket.OPEN&&c.send(l.encode(e))},d=i.onData(u),f=(e,t)=>{c.readyState!==WebSocket.OPEN||e<=0||t<=0||c.send(JSON.stringify({resize:{cols:e,rows:t}}))},p=i.onResize(({cols:e,rows:t})=>f(e,t));c.onopen=()=>{try{o.fit()}catch{}f(i.cols,i.rows)};let m=e=>{e.preventDefault(),e.stopPropagation(),u(`\x1B\r`)};i.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;if(h&&e.metaKey&&!e.ctrlKey&&!e.altKey){if(e.key===`c`)return!g();if(e.key===`v`)return _(),!1}if(!h&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey){if(e.key===`C`||e.key===`c`)return g(),!1;if(e.key===`V`||e.key===`v`)return _(),!1}return!h&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.key===`c`||e.key===`C`)?!g()||(i.clearSelection(),!1):e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.key===`j`||e.key===`J`)?(m(e),!1):e.key!==`Enter`||[e.shiftKey,e.altKey,e.ctrlKey,e.metaKey].filter(Boolean).length!==1||e.metaKey?!0:(m(e),!1)});let h=/Mac|iP(hone|ad)/.test(navigator.platform||navigator.userAgent),g=()=>{let e=i.getSelection();return e?(navigator.clipboard?.writeText(e),!0):!1},_=()=>{navigator.clipboard?.readText().then(e=>{e&&i.paste(e)}).catch(()=>{})},v=async e=>{let t=e.type||`application/octet-stream`,n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e{let t=[...e.clipboardData?.items??[]].find(e=>e.kind===`file`)?.getAsFile();t&&(e.preventDefault(),v(t))},b=e=>{let t=e.dataTransfer?.files?.[0];t&&(e.preventDefault(),v(t))},x=e=>{e.preventDefault()},S=a.current;S.addEventListener(`paste`,y),S.addEventListener(`drop`,b),S.addEventListener(`dragover`,x);let C=0,w=``,T=()=>{C=0;let e=a.current;if(!e)return;let t=`${e.clientWidth}x${e.clientHeight}`;if(t!==w){w=t;try{o.fit()}catch{}}},ee=new ResizeObserver(()=>{C||=requestAnimationFrame(T)});return ee.observe(a.current),()=>{S.removeEventListener(`paste`,y),S.removeEventListener(`drop`,b),S.removeEventListener(`dragover`,x),C&&cancelAnimationFrame(C),ee.disconnect(),d.dispose(),p.dispose(),c.close(),i.dispose()}},[e,t]),t?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{ref:a,className:`h-[70vh] bg-bg`}),(0,I.jsxs)(`div`,{className:`border-t border-border px-3 py-1.5 text-[11px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Shift`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` for a new line —`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Option`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` and`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Ctrl`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`J`}),` do the same.`]})]}):(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,I.jsx)(`p`,{className:`text-[14px] text-fg`,children:`You started this session yourself, so it has no terminal here.`}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-bg hover:brightness-110`,children:`Launch a new Claude Code session here →`}),(0,I.jsxs)(`p`,{className:`max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:[`Runs a second `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` in`,` `,n?(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:n}):`this repository`,` and gives it a terminal you can type in. This session keeps running, untouched.`]}),r&&(0,I.jsx)(Ur,{available:!0,onClose:()=>i(!1),initialCwd:n??``}),(0,I.jsx)(`p`,{className:`mt-1 max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:`Caprock never types into a process it did not start — including this one, which stays visible here and keeps being measured.`})]})}function ug(e){return e.agent===`gemini`?`telemetry`:[e.has_hooks?`hooks`:`no hooks`,e.has_transcript?`transcript`:`no transcript`].join(` · `)}function dg({id:e,tab:t,at:n}){let r=F(()=>P.session(e),[e],{intervalMs:5e3}),i=t===`changes`||t===`diff`||t===`files`?`changes`:t===`terminal`||t===`notes`?t:`timeline`,a=re(1e3),[o]=De(),s=r.data;if(r.error&&!s)return(0,I.jsx)(Et,{title:r.error instanceof M&&r.error.status===404?`Session not found`:`Cannot load session`,children:r.error.message});if(!s)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let c=t=>v({name:`session`,id:e,tab:t}),l=s.stats.tokens_in+s.stats.tokens_out+s.stats.cache_read+s.stats.cache_write,u=!s.has_hooks&&!s.has_transcript&&l===0&&s.stats.turns===0,d=u&&s.agent===`gemini`;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`a`,{href:g({name:`now`}),className:`link text-fg-muted text-[12px]`,children:`← Now`}),(0,I.jsx)(`h1`,{className:`text-[15px] font-medium`,children:s.project||`unknown project`}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:s.session_id}),s.git_branch&&(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-muted`,children:s.git_branch}),(0,I.jsx)(wt,{health:s.activity.health}),s.owned&&s.status!==`ended`&&(0,I.jsx)(bg,{id:e}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted ml-auto num`,children:s.cwd})]}),(0,I.jsxs)(`div`,{className:`text-[13px]`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:s.activity.phrase}),(0,I.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(s.activity.at||s.last_event_at,a)}),s.loop&&(0,I.jsxs)(`span`,{className:`ml-3 text-danger text-[12px]`,children:[`loop: `,s.loop.sample,` ×`,s.loop.count,` in `,s.loop.window_min,`m`]})]}),u?(0,I.jsx)(L,{children:(0,I.jsx)(`div`,{className:`px-3 py-2.5 text-[13px] text-fg-muted`,children:d?(0,I.jsxs)(I.Fragment,{children:[`Nothing measured yet — Gemini reports its own figures, and the first ones arrive with its first answer.`,` `,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`The terminal below is live.`})]}):(0,I.jsxs)(I.Fragment,{children:[`Caprock started this `,Ut(s.agent),` session but does not measure it — there are no hooks and no transcript to read, so cost, tokens and turns are not counted here.`,` `,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`The terminal below is live.`})]})})}):(0,I.jsx)(L,{children:(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:S(s.stats.cost_usd),sub:(0,I.jsx)(`span`,{title:_n(o),children:s.model||`unknown model`})}),(0,I.jsx)(R,{label:`Tokens`,value:C(l),sub:`in ${C(s.stats.tokens_in)} · out ${C(s.stats.tokens_out)} · cache ${C(s.stats.cache_read+s.stats.cache_write)}`}),(0,I.jsx)(R,{label:`Cache`,value:w(s.savings.hit_rate*100),sub:`read ${C(s.stats.cache_read)} · write ${C(s.stats.cache_write)}`,tone:s.savings.hit_rate>.5?`ok`:void 0}),(0,I.jsx)(R,{label:`Context`,value:s.context?w(s.context.pct):`—`,sub:s.context?`${C(s.context.tokens)} / ${C(s.context.window)}`:`unknown model`,tone:s.context&&s.context.pct>=85?`danger`:s.context&&s.context.pct>=60?`warn`:void 0}),(0,I.jsx)(R,{label:`Turns`,value:s.stats.turns,sub:`${s.stats.tool_calls} tool calls`}),(0,I.jsx)(R,{label:`Files`,value:s.stats.files_touched,sub:ug(s)})]})}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border`,children:[[`timeline`,`notes`,`changes`,`terminal`].map(e=>(0,I.jsx)(`button`,{onClick:()=>c(e),className:`px-3 py-1.5 text-[12px] border-b-2 -mb-px ${i===e?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,children:e===`timeline`?`Timeline`:e===`notes`?`Answers`:e===`changes`?`Changes`:`Terminal`},e)),!s.owned&&(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint pr-1`,children:`observe-only — terminal is read/write for spawned sessions only`})]}),i===`timeline`&&(0,I.jsx)(pg,{id:e,initial:s.events,now:a,at:n}),i===`notes`&&(0,I.jsx)(Qr,{id:e,now:a}),i===`changes`&&(0,I.jsx)(_g,{id:e,s}),i===`terminal`&&(0,I.jsx)(L,{className:`overflow-hidden`,children:(0,I.jsx)(lg,{sessionId:e,owned:s.owned&&s.status!==`ended`,cwd:s.cwd})})]})}var fg=200;function pg({id:e,initial:t,now:n,at:r}){let[i,a]=(0,l.useState)(t),[o,s]=(0,l.useState)(`all`),c=(0,l.useRef)(t.length?t[t.length-1].id:0),u=(0,l.useRef)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),g=async()=>{let t=i[0]?.id;if(!(t===void 0||f)){p(!0);try{let n=await P.eventsBefore(e,t,fg);n.length===0?h(!0):a(e=>[...n,...e])}catch{h(!0)}finally{p(!1)}}};(0,l.useEffect)(()=>{a(t),h(!1),c.current=t.length?t[t.length-1].id:0},[t]),(0,l.useEffect)(()=>d.onFrame(t=>{t.type!==`event`||t.data.session_id!==e||t.data.id<=c.current||(c.current=t.data.id,a(e=>[...e,t.data].slice(-5e3)))}),[e]);let _=(0,l.useMemo)(()=>{let e=0;return i.filter(e=>e.kind===`turn.assistant`).map(t=>e+=t.cost_usd??0)},[i]),v=(0,l.useMemo)(()=>{let e=new Map;for(let t of i)if(t.kind===`tool.pre`&&t.tool){let n=t.payload;n?.tool_use_id&&e.set(n.tool_use_id,t.tool)}return e},[i]),y=i.filter(e=>o===`all`||(o===`tools`?e.kind.startsWith(`tool.`):e.kind.startsWith(`turn.`)||e.kind===`agent.stop`)).slice().reverse();return(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,I.jsx)(L,{title:`Events · ${i.length} shown`,className:`min-w-0 overflow-hidden`,right:(0,I.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:[`all`,`tools`,`turns`].map(e=>(0,I.jsx)(`button`,{onClick:()=>s(e),className:`px-1.5 rounded-sm ${o===e?`bg-panel-2 text-fg`:`hover:text-fg`}`,children:e},e))}),children:(0,I.jsxs)(`ol`,{ref:u,className:`max-h-[70vh] overflow-auto`,children:[y.length===0&&(0,I.jsx)(Et,{title:`No events yet`}),y.map(e=>(0,I.jsx)(hg,{e,now:n,toolByUse:v,inMinute:r!==void 0&&mg(e.ts,r)},e.id)),!m&&i.length>0&&(0,I.jsx)(`li`,{className:`px-3 py-1.5 border-t border-border/60`,children:(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-0.5 rounded-sm`,onClick:()=>void g(),disabled:f,children:f?`loading…`:`load earlier events`})}),m&&(0,I.jsx)(`li`,{className:`px-3 py-1 text-[11px] text-fg-faint`,children:`start of session`})]})}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Cost, cumulative`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(Tt,{values:_.length?_:[0,0],width:230,height:40,tone:`accent`})}),(0,I.jsxs)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted num`,children:[_.length,` priced turns · `,S(_[_.length-1]??0)]})]}),(0,I.jsxs)(L,{title:`Tokens per turn`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(Tt,{values:i.filter(e=>e.tokens).map(e=>e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),width:230,height:40})}),(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted`,children:`prompt size (input + cache) per assistant turn`})]})]})]})}function mg(e,t){let n=Date.parse(e);return Number.isFinite(n)&&Math.floor(n/6e4)===Math.floor(t/6e4)}function hg({e,now:t,toolByUse:n,inMinute:r}){let[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`center`})},[r]);let s=e.payload??{},c=e.tool||(e.kind===`tool.post`?n.get(String(s.tool_use_id??``)):void 0),u=gg({...e,tool:c},s),d=e.kind===`turn.assistant`?String(s.text??``):e.kind===`turn.user`?String(s.prompt??``):e.kind===`tool.post`&&typeof s.tool_response==`string`?s.tool_response:``,f=e.kind===`turn.user`?`text-info`:e.kind===`turn.assistant`?`text-fg`:e.kind===`agent.stop`||e.kind===`context.compact`?`text-warn`:`text-fg-muted`;return(0,I.jsxs)(`li`,{ref:o,className:`border-b border-border/60 last:border-0 hover:bg-panel-2 animate-flash ${r?`bg-accent/10 border-l-2 border-l-accent`:``}`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left flex items-baseline gap-2 px-3 py-[3px]`,onClick:()=>a(!i),children:[(0,I.jsx)(`span`,{className:`num text-[10px] text-fg-faint w-14 shrink-0`,children:T(e.ts,t)}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-24 shrink-0 ${f}`,children:e.kind}),(0,I.jsx)(`span`,{className:`truncate text-[12px] min-w-0`,title:u,children:u}),e.tokens&&(0,I.jsxs)(`span`,{className:`ml-auto num text-[10px] text-fg-faint shrink-0`,children:[C(e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),`→`,C(e.tokens.out),e.cost_usd===void 0?``:` · ${S(e.cost_usd)}`]})]}),i&&(0,I.jsxs)(`div`,{className:`px-3 pb-2`,children:[d?(0,I.jsx)(`div`,{className:`text-[12px] leading-[1.55] whitespace-pre-wrap break-words max-h-96 overflow-auto border-l-2 border-border-strong pl-3 mb-2`,children:d}):null,(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{className:`text-[10px] text-fg-faint cursor-pointer select-none`,children:`raw event`}),(0,I.jsx)(`pre`,{className:`mono text-[10px] leading-[1.4] text-fg-muted pt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all`,children:JSON.stringify({id:e.id,ts:e.ts,source:e.source,key:e.key,agent_id:e.agent_id,model:e.model,tokens:e.tokens,cost_usd:e.cost_usd,payload:e.payload},null,2)})]})]})]})}function gg(e,t){let n=t.tool_input??{};switch(e.kind){case`tool.pre`:{let r=e.tool??String(t.tool_name??`tool`),i=n.command??n.file_path??n.pattern??n.query??n.url??n.prompt??``;return i?`${r} ${String(i).split(` -`)[0]}`:r}case`tool.post`:{let n=e.tool??String(t.tool_name??`tool`),r=t.tool_response,i=t.is_error===!0,a=typeof r==`string`?r:r?JSON.stringify(r):``;return`${n} ${i?`failed`:`done`}${a?` ${a.slice(0,160)}`:``}`}case`turn.user`:return`you: ${String(t.prompt??``).slice(0,200)}`;case`turn.assistant`:{let n=String(t.text??``),r=Array.isArray(t.tools)?t.tools:[];return n?n.slice(0,200):r.length?`→ ${r.join(`, `)}`:`${e.model??`assistant`} turn`}case`agent.stop`:return e.agent_id?`subagent ${e.agent_id} stopped`:`turn ended (${String(t.stop_reason??`stop`)})`;case`agent.spawn`:return`session started (${String(t.source??`startup`)})`;case`context.compact`:return`context compaction (${String(t.trigger??`auto`)})`;default:return e.kind}}function _g({id:e,s:t}){let n=F(()=>P.diff(e),[e,t.last_event_at],{live:!1,intervalMs:8e3}),[r,i]=(0,l.useState)(new Set),a=e=>i(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let n=e.body;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(Et,{title:`No git repository`,children:[n?.cwd?(0,I.jsx)(`span`,{className:`mono`,children:n.cwd}):null,` `,n?.error]}),(0,I.jsx)(yg,{s:t})]})}return(0,I.jsx)(Et,{title:`Cannot load diff`,children:e.message})}let o=n.data;if(!o)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let s=new Set(o.files.map(e=>e.path)),c=t.files.filter(e=>!s.has(e)&&!s.has(e.replace(/^.*?\//,``))),u=o.files.length>0&&o.files.every(e=>r.has(e.path));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(L,{title:`Changes · ${o.branch||`detached`}`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o.base&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:o.base}),o.files.length>0&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>i(u?new Set:new Set(o.files.map(e=>e.path))),children:u?`collapse all`:`expand all`}),(0,I.jsxs)(`span`,{className:`num`,children:[o.files.length,` files`]})]}),children:[o.files.length===0&&(0,I.jsx)(Et,{title:`Clean working tree`}),(0,I.jsx)(`ul`,{children:o.files.map(e=>{let t=r.has(e.path);return(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>a(e.path),"aria-expanded":t,children:[(0,I.jsx)(`span`,{className:`text-fg-faint text-[10px] shrink-0 transition-transform ${t?`rotate-90`:``}`,children:`▶`}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),t&&e.patch&&(0,I.jsx)(vg,{patch:e.patch}),t&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path)})})]}),c.length>0&&(0,I.jsx)(yg,{s:t,only:c})]})}function vg({patch:e}){return(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[50vh]`,children:e.split(` -`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})})}function yg({s:e,only:t}){let n=t??e.files,r=e.files.length(0,I.jsxs)(`li`,{className:`px-3 py-1 border-b border-border/60 last:border-0 flex gap-2 items-baseline`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px]`,children:te(e)}),(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint truncate`,children:e})]},e))})]})}function bg({id:e}){let[t,n]=(0,l.useState)(``),r=async t=>{n(t);try{await P.signal(e,t)}catch{}finally{n(``)}};return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-ok border border-ok/40 rounded-sm px-1`,children:`owned`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`pause`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`pause`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`resume`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`resume`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`kill`),className:`text-[11px] border border-danger/40 text-danger px-1.5 rounded-sm hover:bg-danger/10`,children:`kill`})]})}function xg(e){if(!Number.isFinite(e)||e<=0)return[];let t=e/3,n=10**Math.floor(Math.log10(t)),r=[1,2,5,10].map(e=>e*n).find(e=>e>=t)??n*10,i=[];for(let t=r;t<=e*1.0001;t+=r)i.push(t);return i}function Sg({bars:e,active:t,onActive:n,height:r=112,showDayLabels:i=!0}){let a=e=>typeof e==`number`&&Number.isFinite(e)?e:0,o=Math.max(...e.map(e=>a(e.cost)),1e-9),s=r-16,c=xg(o);return(0,I.jsxs)(`div`,{className:`relative px-3 py-3 flex items-end gap-[3px]`,style:{height:r},onMouseLeave:()=>n(null),children:[c.map(e=>(0,I.jsx)(`div`,{className:`pointer-events-none absolute left-3 right-3 border-t border-border/60`,style:{bottom:16+Math.round(s*e/o)},"aria-hidden":!0,children:(0,I.jsx)(`span`,{className:`num absolute -top-[7px] right-0 bg-panel pl-1 text-[9px] text-fg-faint`,children:S(e)})},e)),e.map(e=>{let r=t===e.day;return(0,I.jsxs)(`button`,{type:`button`,className:`flex-1 flex flex-col items-center justify-end gap-1 min-w-0 h-full cursor-default focus:outline-none`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(a(e.cost))}`,children:[(0,I.jsx)(`div`,{className:`w-full rounded-t-sm transition-colors ${r?`bg-accent`:`bg-accent/70`}`,style:{height:Math.max(2,Math.round(s*a(e.cost)/o))}}),i&&(0,I.jsx)(`div`,{className:`num text-[9px] ${r?`text-fg`:`text-fg-faint`}`,children:e.day.slice(8)})]},e.day)})]})}function Cg({bars:e,active:t,total:n}){let r=t?e.find(e=>e.day===t):void 0;return r?(0,I.jsxs)(`span`,{className:`num flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:r.day}),(0,I.jsx)(`span`,{className:`text-fg`,children:S(r.cost)}),(0,I.jsx)(`span`,{className:`text-fg-faint`,children:C(r.tokens)}),r.sessions!==void 0&&r.sessions>0&&(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[r.sessions,` `,r.sessions===1?`session`:`sessions`]})]}):(0,I.jsx)(`span`,{className:`num`,children:S(n)})}var wg=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Tg(e){return(new Date(`${e}T00:00:00Z`).getUTCDay()+6)%7}function Eg(e,t){if(!(e>0))return`bg-border/60`;let n=Math.sqrt(e/Math.max(t,1e-9));return n>.75?`bg-accent`:n>.5?`bg-accent/75`:n>.25?`bg-accent/50`:`bg-accent/25`}function Dg({bars:e,active:t,onActive:n,maxCell:r=44}){let i=e=>typeof e==`number`&&Number.isFinite(e)?e:0,a=Math.max(...e.map(e=>i(e.cost)),1e-9),o=e[0],s=o?Tg(o.day):0;return(0,I.jsxs)(`div`,{className:`px-3 py-3`,onMouseLeave:()=>n(null),children:[(0,I.jsxs)(`div`,{className:`grid gap-1`,style:{gridTemplateColumns:`repeat(7, minmax(0, 1fr))`,maxWidth:r*7+24},children:[wg.map((e,t)=>(0,I.jsx)(`div`,{className:`text-center text-[9px] text-fg-faint`,"aria-hidden":!0,children:e},t)),Array.from({length:s},(e,t)=>(0,I.jsx)(`div`,{"aria-hidden":!0},`lead-${t}`)),e.map(e=>{let r=i(e.cost),o=t===e.day;return(0,I.jsx)(`button`,{type:`button`,className:`flex aspect-square items-center justify-center focus:outline-none cursor-default`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(r)}`,children:(0,I.jsx)(`span`,{className:`h-full w-full rounded-[3px] transition-colors ${Eg(r,a)} ${o?`ring-1 ring-accent ring-offset-1 ring-offset-panel`:``}`})},e.day)})]}),(0,I.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 text-[9px] text-fg-faint`,children:[(0,I.jsx)(`span`,{children:`$0`}),[`bg-border/60`,`bg-accent/25`,`bg-accent/50`,`bg-accent/75`,`bg-accent`].map(e=>(0,I.jsx)(`span`,{className:`h-2 w-2 rounded-[2px] ${e}`,"aria-hidden":!0},e)),(0,I.jsx)(`span`,{className:`num`,children:S(a)})]})]})}var Og=e=>e===1?`day`:`days`;function kg({summary:e,plan:t,days:n}){if(!e)return null;let r=e.cost_usd;if(!t?.plan_kind)return(0,I.jsx)(L,{title:`Plan value`,children:(0,I.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted`,children:`Set your plan in the header and Caprock will show what this usage is worth against what you actually pay. It can't detect your plan, so it won't guess.`})});if(t.plan_kind===`metered`)return(0,I.jsx)(L,{title:`Spend`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label||`API`,` · billed per token`]}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-3xl text-fg`,children:S(r)}),(0,I.jsxs)(`span`,{className:`text-[12px] text-fg-muted`,children:[`over the last `,n,` `,Og(n)]})]}),(0,I.jsxs)(`p`,{className:`text-[11px] text-fg-faint mt-2 max-w-[60ch]`,children:[`You are billed per token, so this is approximately your actual cost — at Anthropic list prices (`,e.pricing_version,`). Not a saving.`]})]})});let i=t.plan_usd_per_month*n/30,a=i>0?r/i:0;return(0,I.jsxs)(L,{title:`Plan value`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label,` · `,S(t.plan_usd_per_month),`/mo`]}),children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 divide-y sm:divide-y-0 sm:divide-x divide-border`,children:[(0,I.jsx)(R,{label:`you pay · ${n}d`,value:S(i),sub:t.plan_label}),(0,I.jsx)(R,{label:`same usage at API list`,value:S(r),sub:`at list prices ${e.pricing_version}`,tone:`ok`}),(0,I.jsx)(R,{label:`which is`,value:a>0?`${a.toFixed(1)}×`:`—`,sub:a>0?`what ${n} ${Og(n)} would cost through the API`:`not enough measured usage yet`,tone:a>0?`ok`:void 0,size:`hero`})]}),(0,I.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] text-fg-faint leading-relaxed`,children:`Not a discount you received, and not money back — without the plan you would not have run this much.`})]})}function Ag({feature:e,title:t,children:n}){let[r,i]=(0,l.useState)(!1);return F(()=>P.premium(),[]).data?.license?.active?(0,I.jsx)(I.Fragment,{children:n}):(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-panel)] border border-border`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none select-none opacity-70`,children:n}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-3 gap-y-2 border-t border-border bg-panel-2/60 px-4 py-2.5 text-center`,children:[(0,I.jsx)(`span`,{className:`text-[13px] font-medium text-fg`,children:t}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-premium px-3.5 py-1.5 text-[13px] font-medium text-white hover:brightness-110`,children:`Unlock with Premium`})]}),r&&(0,I.jsx)(nt,{feature:e,onClose:()=>i(!1)})]})}function jg({suggestion:e}){let t=F(()=>P.settings(),[],{live:!1}),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),p=t.data?.cap_usd_per_day;(0,l.useEffect)(()=>{d||p===void 0||(r(p?String(p):``),f(!0))},[p,d]);let m=t.data?.cap_usd_per_day??0,h=m>0,g=async e=>{a(!0),s(``),u(!1);try{await P.saveSettings({cap_usd_per_day:e}),r(e?String(e):``),u(!0),t.refresh()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},_=()=>{let e=n.trim().replace(/^\$/,``).replace(/,/g,``),t=Number(e);if(e===``||!Number.isFinite(t)||t<0){s(`A daily cap has to be a positive number of dollars.`);return}g(t)};return(0,I.jsx)(L,{title:`Daily spend cap`,right:(0,I.jsx)(`span`,{className:h?`text-premium-strong`:`text-fg-faint`,children:h?`on`:`off`}),children:(0,I.jsxs)(`div`,{className:`grid gap-2.5 px-3 py-3 text-[13px]`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Stop the day at`}),(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`$`}),(0,I.jsx)(`input`,{className:`input w-28`,inputMode:`decimal`,placeholder:`0`,value:n,onChange:e=>{r(e.target.value),u(!1)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Daily spend cap in dollars`}),(0,I.jsx)(`button`,{onClick:_,disabled:i,className:`rounded-sm bg-premium px-3 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50`,children:i?`Saving…`:`Save`}),h&&(0,I.jsx)(`button`,{onClick:()=>void g(0),disabled:i,className:`text-[12px] text-fg-faint hover:text-fg`,children:`turn off`}),c&&!o&&(0,I.jsx)(`span`,{className:`text-[12px] text-fg-faint`,children:`saved`})]}),!h&&e?(0,I.jsxs)(`p`,{className:`text-[12px] text-fg-faint`,children:[`Your days run about `,S(e/2),`.`,` `,(0,I.jsxs)(`button`,{onClick:()=>void g(e),className:`text-premium-strong hover:underline`,children:[`Use `,S(e)]}),` `,`— twice that, so an ordinary day never trips it.`]}):null,o&&(0,I.jsx)(`p`,{className:`text-[12px] text-danger`,children:o}),(0,I.jsx)(`p`,{className:`border-t border-border pt-2 text-[12px] leading-relaxed text-fg-faint`,children:h?(0,I.jsxs)(I.Fragment,{children:[`When today crosses `,S(m),`, Caprock pauses the sessions it started — paused, not killed, so resuming keeps the conversation. Sessions you started yourself are never touched.`]}):(0,I.jsx)(I.Fragment,{children:`Off. Nothing is paused, whatever the day costs. Sessions you started yourself are never touched either way.`})})]})})}function Mg(e){return e>=.01?`$${e.toFixed(2)}`:`${(e*100).toFixed(1)}\u00A2`}function Ng(){let e=F(()=>P.gemini(),[],{live:!1}),[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),v=e.data,y=!!v?.available,b=v!==void 0&&!v.available,x=async()=>{let t=r.trim();if(!(!t||a)){o(!0),c(``);try{await P.saveSettings({gemini_api_key:t}),i(``),e.refresh?.()}catch(e){c(ae(e))}finally{o(!1)}}},S=async()=>{let e=t.trim();if(!(!e||m)){h(!0),_(``);try{p(await P.askGemini(e,u||void 0)),n(``)}catch(e){_(ae(e))}finally{h(!1)}}};return(0,I.jsx)(L,{title:`Ask Gemini`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:y?v?.model:`your key, your bill`}),children:b?(0,I.jsxs)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted grid gap-2.5`,children:[(0,I.jsxs)(`p`,{className:`m-0`,children:[`Ask Google's Gemini about your own sessions, on your own key. Get one from`,` `,(0,I.jsx)(`a`,{className:`link`,href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,children:`Google AI Studio`}),` `,`and paste it here — you pay Google directly, and Caprock counts what it spends beside your Claude figures.`]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`API key`}),(0,I.jsx)(`input`,{className:`input`,type:`password`,placeholder:`AIza…`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()}})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`button`,{onClick:()=>void x(),disabled:a||!r.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:a?`saving…`:`Save key`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Stored on this machine only, and never sent back to this page.`})]}),s&&(0,I.jsx)(`div`,{className:`text-danger text-[11px]`,children:s})]}):(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-2`,children:[(0,I.jsx)(`textarea`,{className:`input min-h-[70px] resize-y`,placeholder:`Ask about your sessions, your spend, anything…`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&S()}}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`button`,{onClick:()=>void S(),disabled:m||!t.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25 disabled:opacity-50`,children:m?`asking…`:`Ask`}),(v?.models?.length??0)>0&&(0,I.jsx)(`select`,{className:`input w-auto text-[12px] py-1`,value:u||v?.model||``,onChange:e=>d(e.target.value),"aria-label":`Model`,children:v.models.map(e=>(0,I.jsxs)(`option`,{value:e.id,children:[e.display,` · ~`,Mg(e.typical_usd),` a question`]},e.id))}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`⌘↵ to send`})]}),g&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:g}),(0,I.jsx)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:v?.from_env?(0,I.jsxs)(I.Fragment,{children:[`Using the key in `,(0,I.jsx)(`span`,{className:`mono`,children:v?.env_var}),`, which takes precedence over the stored one.`]}):(0,I.jsx)(I.Fragment,{children:`Using the key you saved here. Google bills you directly.`})}),f&&(0,I.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`div`,{className:`text-[13px] whitespace-pre-wrap`,children:f.text}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint num flex gap-3 flex-wrap`,children:[(0,I.jsx)(`span`,{children:f.model}),(0,I.jsxs)(`span`,{children:[`in `,C(f.usage.prompt_tokens)]}),(0,I.jsxs)(`span`,{children:[`out `,C(f.usage.output_tokens)]}),f.usage.thoughts_tokens>0&&(0,I.jsxs)(`span`,{title:`Google bills thinking tokens as output`,children:[`thinking `,C(f.usage.thoughts_tokens)]}),f.usage.cached_tokens>0&&(0,I.jsxs)(`span`,{children:[`cached `,C(f.usage.cached_tokens)]})]})]})]})})}function Pg(){let[e,t]=(0,l.useState)(`30d`),n=Date.now(),r=F(()=>P.summary(e),[e],{intervalMs:5e3}),i=F(()=>P.daily(30),[],{intervalMs:3e4}),[a]=De(),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`calendar`),d=r.data,f=!!d&&d.turns>0,p=Fg(i.data??[]),m=Lg(p.map(e=>e.cost));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[_n(a),d?` (table ${d.pricing_version})`:``]})]}),r.error&&!d&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:r.error.message}),e!==`today`&&d&&(0,I.jsx)(Nn,{costUSD:p.reduce((e,t)=>e+t.cost,0),days:p.filter(e=>e.cost>0).length,now:n}),(0,I.jsx)(kg,{summary:d,plan:a,days:Ig(e,d?.from_ms)}),(0,I.jsxs)(L,{title:`Totals · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:f?S(d.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:_n(a),children:f?gn(a):`nothing measured in this range`}),tone:`info`,size:`hero`}),(0,I.jsx)(R,{label:`Burn now`,value:f?`${S(d.burn.usd_per_hour)}/h`:`—`,sub:f?`${C(Math.round(d.burn.tokens_per_min))} tok/min · ${d.sessions} sessions`:void 0}),(0,I.jsx)(R,{label:`Input`,value:f?C(d.tokens_in):`—`,sub:`fresh, full price`}),(0,I.jsx)(R,{label:`Output`,value:f?C(d.tokens_out):`—`,sub:f?`${d.turns} turns`:void 0}),(0,I.jsx)(R,{label:`Cache read`,value:f?C(d.cache_read):`—`,sub:f?(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,I.jsxs)(`span`,{children:[w(d.savings.hit_rate*100),` hit rate`]}),(()=>{let e=xn(d.savings.hit_rate*100);return e?(0,I.jsx)(`span`,{className:e.color||`text-fg-faint`,children:e.label}):null})()]}):void 0}),(0,I.jsx)(R,{label:`Cache write`,value:f?C(d.cache_write):`—`,sub:f?`${w(d.savings.cut_pct)} input cost cut by cache`:void 0})]}),(0,I.jsx)(kr,{u:d?.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.models.length===0&&(0,I.jsx)(Et,{title:`No priced turns in range`}):(0,I.jsx)(Dt,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,title:e.model||void 0,children:e.model?ne(e.model):`unknown`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:(d?.unpriced?.models??[]).includes(e.model)?(0,I.jsx)(`span`,{className:`text-warn`,title:`this model is not in the pricing table, so its cost is unknown`,children:`unpriced`}):S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0&&!(d.unpriced?.models??[]).includes(e.model)?w(100*e.cost_usd/d.cost_usd):`—`})]},e.model))})})]}),(0,I.jsx)(jt,{summary:d}),(0,I.jsxs)(L,{title:`Per project`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.projects.length===0&&(0,I.jsx)(Et,{title:`No priced turns in range`}):(0,I.jsx)(Dt,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.projects??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0?w(100*e.cost_usd/d.cost_usd):`—`})]},e.project))})})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:[(0,I.jsxs)(L,{className:`lg:col-span-2`,title:`Last 30 days`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(Cg,{bars:p,active:o,total:p.reduce((e,t)=>e+t.cost,0)}),(0,I.jsx)(`span`,{className:`flex items-center gap-1`,children:[`calendar`,`bars`].map(e=>(0,I.jsx)(`button`,{onClick:()=>u(e),className:`px-1.5 py-0.5 rounded-sm text-[11px] ${c===e?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg`}`,children:e},e))})]}),children:[i.data?p.length===0&&(0,I.jsx)(Et,{title:`No history yet`}):(0,I.jsx)(Dt,{rows:2}),p.length>0&&(c===`calendar`?(0,I.jsx)(Dg,{bars:p,active:o,onActive:s}):(0,I.jsx)(Sg,{bars:p,active:o,onActive:s}))]}),(0,I.jsx)(Ag,{feature:`cap`,title:`Stop the day at a number you choose`,children:(0,I.jsx)(jg,{suggestion:m})}),(0,I.jsx)(Ag,{feature:`gemini`,title:`Ask a second model, on your own key`,children:(0,I.jsx)(Ng,{})}),d&&(0,I.jsxs)(L,{title:`Plan limits`,children:[d.rate_limits?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1`,children:[d.rate_limits.five_hour&&(0,I.jsx)(wn,{label:`5-hour window`,w:d.rate_limits.five_hour,now:n}),d.rate_limits.seven_day&&(0,I.jsx)(wn,{label:`7-day window`,w:d.rate_limits.seven_day,now:n})]}):(0,I.jsxs)(`div`,{className:`px-3 pt-1 text-sm text-fg-muted`,children:[`No window state yet. Caprock reads this from Claude Code's status line, so it appears once a Pro or Max session has run with `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:`caprock statusline`}),` registered —`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock up`}),` offers to do that. API-billed usage has no windows to report.`]}),(0,I.jsx)(`div`,{className:`mt-2 px-3 pb-3 text-[11px] text-fg-faint leading-relaxed`,children:`Live from Claude Code's status line (Pro/Max). The percentage is your usage of the window; a forecast is shown only when your measured pace would reach the limit before the window resets.`})]})]}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[d&&d.throttles>0?`${d.throttles} rate-limit / overloaded event${d.throttles===1?``:`s`} observed in this range (from Claude Code's StopFailure hook).`:`No rate-limit events observed in this range.`,` `,`Everything here is measured — no invented numbers.`]})]})}function Fg(e){let t=new Map;for(let n of e){let e=t.get(n.day)??{day:n.day,cost:0,tokens:0,sessions:0};e.cost+=n.cost_usd,e.tokens+=n.tokens_total,e.sessions+=n.sessions,t.set(n.day,e)}return[...t.values()].sort((e,t)=>e.day.localeCompare(t.day))}function Ig(e,t){switch(e){case`today`:return 1;case`7d`:return 7;case`30d`:return 30;default:return t?Math.max(1,Math.ceil((Date.now()-t)/864e5)):30}}function Lg(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length<3)return 0;let n=t[Math.floor(t.length/2)]*2,r=n<10?1:n<100?5:10;return Math.round(n/r)*r}function Rg({plan:e,save:t}){let[n,r]=(0,l.useState)(e.license_key??``),i=F(()=>P.premium(),[e.license_key]).data?.license;(0,l.useEffect)(()=>{r(e.license_key??``)},[e.license_key]);let a=n.trim()!==(e.license_key??``).trim();return(0,I.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`w-28 shrink-0 text-fg-muted`,children:`Licence`}),(0,I.jsx)(`input`,{className:`input flex-1 min-w-0`,placeholder:`CR-…`,spellCheck:!1,value:n,onChange:e=>r(e.target.value),onKeyDown:r=>{r.key===`Enter`&&a&&t({...e,license_key:n.trim()})}}),(0,I.jsx)(`button`,{disabled:!a,onClick:()=>t({...e,license_key:n.trim()}),className:`rounded-sm border border-border px-2 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg disabled:opacity-40`,children:`save`})]}),(0,I.jsxs)(`p`,{className:`mt-1.5 pl-[7.5rem] text-[11px] leading-relaxed`,children:[i?.active&&!i.in_grace&&(0,I.jsxs)(`span`,{className:`text-ok`,children:[`Premium is on`,i.expires_at?` — renews ${i.expires_at.slice(0,10)}`:``,`.`]}),i?.active&&i.in_grace&&(0,I.jsxs)(`span`,{className:`text-warn`,children:[i.reason,`. Update your key or payment method.`]}),i&&!i.active&&(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[e.license_key?i.reason:`No key — the free product is unaffected.`,` `,(0,I.jsx)(`a`,{href:`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`link`,children:`what Premium does`})]}),(0,I.jsx)(`span`,{className:`block text-fg-faint`,children:`Checked on this machine against the date inside the key. Caprock makes no call to us to verify it.`})]})]})}function zg(){let e=F(()=>P.status(),[],{live:!1,intervalMs:5e3}),t=e.data;if(e.error&&!t)return(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:e.error.message});if(!t)return(0,I.jsx)(`div`,{className:`text-fg-muted`,children:`loading…`});let n=[[`version`,t.version],[`url`,t.url],[`pid`,String(t.pid)],[`uptime`,ee(t.uptime_s*1e3)],[`data dir`,t.data_dir],[`pricing`,`${t.pricing.version} · ${t.pricing.models} models · fetched ${t.pricing.fetched_at}${t.pricing.user_override?` · user override`:``}`],[`pricing source`,t.pricing.source],[`loop rule`,`≥ ${t.loop_k} same-tool calls in ${t.loop_t_minutes} min · ${t.active_loops} active`],[`events stored`,`${t.events.toLocaleString()}${t.retention_days>0?` · pruned after ${t.retention_days}d`:` · kept forever (set retention_days to cap DB growth)`}`],[`orchestration`,t.orchestration?`on (--hive)`:`off`],[`claude`,t.claude_available?`found on PATH — Caprock can start sessions for you`:`not found on PATH — Caprock cannot start sessions, but still observes every session you start yourself`],[`dashboard`,t.ui_built?`embedded build`:`dev server / placeholder`]];if(t.hooks&&n.push([`hooks`,`${(t.hooks.installed??[]).length}/${(t.hooks.installed??[]).length+(t.hooks.missing??[]).length} events registered in ${t.hooks.settings_path}${t.hooks.shim_exists?``:` (shim missing)`}`]),t.desktop){let e=t.desktop;n.push([`claude desktop`,`${e.five_hour_pct}% of the 5-hour window · ${e.seven_day_pct}% of the 7-day${e.stale?` · last seen `+new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})+`, app closed since`:` · now`}`])}return t.ingest_error&&n.push([`ingest error`,`STOPPED: ${t.ingest_error} — nothing is being captured`]),t.ingest&&n.push([`ingest`,`${t.ingest.files_known} transcripts · ${t.ingest.events_stored} events stored · ${t.ingest.events_deduped} deduped · ${t.ingest.lines_malformed} malformed lines · backfill ${t.ingest.backfill_done?`done`:`running`}`]),(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-3xl`,children:[(0,I.jsx)(Bg,{}),(0,I.jsx)(L,{title:`Daemon`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:n.map(([e,t])=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:e}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:t})]},e))})})}),t.ingest_error&&(0,I.jsx)(L,{title:`Ingest stopped`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`No new sessions are being captured: `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:t.ingest_error}),`. Check that`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})}),!t.claude_available&&(0,I.jsx)(L,{title:`claude not found`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`The `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself. Install Claude Code, or make sure`,(0,I.jsx)(`span`,{className:`mono`,children:` claude`}),` is on the PATH the daemon was started with.`]})}),t.hooks&&(t.hooks.missing??[]).length>0&&(0,I.jsx)(L,{title:`Hooks not fully installed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`Missing: `,(0,I.jsx)(`span`,{className:`mono`,children:(t.hooks.missing??[]).join(`, `)}),`. Run `,(0,I.jsx)(`span`,{className:`mono`,children:`caprock hooks install`}),` for real-time activity; transcript tailing keeps working with a few seconds of delay.`]})})]})}function Bg(){let[e,t]=De();return e?(0,I.jsx)(L,{title:`Settings`,children:(0,I.jsxs)(`div`,{className:`grid gap-2 px-3 py-2.5 text-[12px]`,children:[(0,I.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)] mt-0.5`,checked:e.update_checks,onChange:n=>t({...e,update_checks:n.target.checked})}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Check GitHub for new releases`}),(0,I.jsx)(`span`,{className:`block text-[11px] text-fg-muted`,children:`The only outbound call Caprock makes. No usage data is sent, and it is checked at most once a day.`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted w-28 shrink-0`,children:`Your plan`}),(0,I.jsx)(`span`,{className:`mono text-fg`,children:e.plan_kind===`metered`?`${e.plan_label||`API`} · billed per token`:e.plan_kind===`flat`?`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`not set`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint ml-auto`,children:`change it in the header`})]}),(0,I.jsx)(Rg,{plan:e,save:t})]})}):null}function Vg(){let e=F(()=>P.settings(),[],{live:!1}),t=re(3e4),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(``),h=e.data;(0,l.useEffect)(()=>{o||h===void 0||(a(h.report_chat_id??``),s(!0))},[h,o]);let g=async()=>{u(!0),m(``);try{await P.saveSettings({report_chat_id:i.trim(),...n.trim()?{report_bot_token:n.trim()}:{}}),r(``),f(!0),e.refresh?.()}catch(e){m(ae(e))}finally{u(!1)}},_=!!h?.report_bot_set&&!!h?.report_chat_id,[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1);async function S(){y(!0),x(!1),m(``);try{await P.testReport(),x(!0),window.setTimeout(()=>x(!1),6e3)}catch(e){m(e instanceof Error?e.message:String(e))}finally{y(!1)}}return(0,I.jsx)(L,{title:`Weekly report`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:_?`Mondays, or the next day you open the lid`:`not set up`}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-3 text-[12px]`,children:[(0,I.jsx)(`p`,{className:`m-0 text-fg-muted`,children:`What moved this week, against your usual — sent to a Telegram bot you own. Nothing passes our server, and the message carries figures only: no prompts, no replies, no file names.`}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`Bot token`,h?.report_bot_set&&(0,I.jsx)(`span`,{className:`text-ok`,children:` · one is stored`})]}),(0,I.jsx)(`input`,{className:`input`,type:`password`,placeholder:h?.report_bot_set?`leave blank to keep the current one`:`123456:ABC-DEF…`,value:n,onChange:e=>r(e.target.value)}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Message `,(0,I.jsx)(`span`,{className:`mono`,children:`@BotFather`}),` on Telegram, send`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`/newbot`}),`, and paste what it gives you. Caprock stores it on this machine and never sends it back to this page.`]}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`It is your own bot, not one of ours, and that is deliberate: the message goes straight from this machine to Telegram, so your figures never pass through anybody's server. A shared bot would mean shipping its token inside a public binary, and routing what you spend through us to deliver it.`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Chat id`}),(0,I.jsx)(`input`,{className:`input`,placeholder:`123456789`,value:i,onChange:e=>a(e.target.value)}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[(0,I.jsx)(`strong`,{children:`Write to your bot first`}),` — find it by its username, press Start, send anything. Telegram does not let a bot message you until you have. Then open`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`api.telegram.org/bot/getUpdates`}),` and copy`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`chat.id`}),`. For a channel instead, add the bot as an administrator; its id starts with a minus.`]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`button`,{onClick:()=>void g(),disabled:c||!i.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`saving…`:`Save`}),(0,I.jsx)(`button`,{onClick:()=>void S(),disabled:v||!_,title:_?`Send this week's report now`:`Save a bot token and chat id first`,className:`border border-border px-3 py-1 rounded-sm hover:border-fg-faint disabled:opacity-50`,children:v?`sending…`:`Send one now`}),b&&(0,I.jsx)(`span`,{className:`text-[11px] text-ok`,children:`sent — check Telegram`}),d&&!p&&(0,I.jsx)(`span`,{className:`text-[11px] text-ok`,children:`saved`}),p&&(0,I.jsx)(`span`,{className:`text-[11px] text-danger`,children:p})]}),h?.report_last_error?(0,I.jsxs)(`p`,{className:`m-0 text-[11px] text-danger`,children:[`Last send failed: `,h.report_last_error]}):h?.report_last_sent_ms?(0,I.jsxs)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:[`Last sent `,T(h.report_last_sent_ms,t),` ago.`]}):_?(0,I.jsx)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:`Nothing sent yet — the first one goes out at the start of next week.`}):null]})})}function Hg(){let[e,t]=(0,l.useState)(`all`),[n,r]=(0,l.useState)(null),i=F(()=>P.history(e),[e],{intervalMs:15e3}),[a]=De(),o=i.data,s=!!o&&o.totals.turns>0,c=Fg(o?.daily??[]),u=Math.max(...(o?.tools??[]).map(e=>e.count),1);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Everything you ever ran through Caprock. Measured, not estimated.`})]}),s&&o&&(0,I.jsx)(Nn,{costUSD:o.totals.cost_usd,days:o.totals.days,now:Date.now()}),i.error&&!o&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:i.error.message}),(0,I.jsxs)(L,{title:`Lifetime · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 divide-x divide-border`,children:[(0,I.jsx)(R,{size:`compact`,label:`Sessions`,value:s?o.totals.sessions:`—`,sub:s?`${o.totals.owned_sessions} spawned by caprock`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Active days`,value:s?o.totals.days:`—`}),(0,I.jsx)(R,{size:`compact`,label:`Turns`,value:s?C(o.totals.turns):`—`,sub:s?`${C(o.totals.tool_calls)} tool calls`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Files touched`,value:s?C(o.totals.files_touched):`—`,sub:`summed per session`}),(0,I.jsx)(R,{size:`compact`,label:`Avg session span`,value:s?ee(Math.round(o.totals.avg_session_sec*1e3)):`—`,sub:`first to last event`}),(0,I.jsx)(Sn,{hitRate:o?.savings.hit_rate,cutPct:o?.savings.cut_pct,measured:s}),(0,I.jsx)(R,{label:`Cost`,value:s?S(o.totals.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:_n(a),children:s?gn(a):`nothing measured yet`}),tone:`info`,size:`hero`})]}),(0,I.jsx)(kr,{u:o?.totals.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,I.jsxs)(L,{title:`Tool usage`,right:(0,I.jsx)(`span`,{children:`by calls`}),children:[o?o.tools.length===0&&(0,I.jsx)(Et,{title:`No tool calls yet`}):(0,I.jsx)(Dt,{rows:5}),(0,I.jsx)(`ul`,{className:`py-1`,children:(o?.tools??[]).slice(0,18).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-[3px]`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px] w-44 shrink-0 truncate`,title:e.tool,children:D(e.tool)}),(0,I.jsx)(`div`,{className:`flex-1 h-2 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${100*e.count/u}%`}})}),(0,I.jsx)(`span`,{className:`num text-[11px] text-fg-muted w-12 text-right`,children:C(e.count)})]},e.tool))})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[o?o.summary.models.length===0&&(0,I.jsx)(Et,{title:`No priced turns`}):(0,I.jsx)(Dt,{rows:3}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,children:e.model||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.model))})})]}),(0,I.jsx)(Ag,{feature:`report`,title:`Get this every Monday, without opening the dashboard`,children:(0,I.jsx)(Vg,{})}),(0,I.jsx)(L,{title:`Top projects`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.projects??[]).slice(0,8).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.project))})})})]})]}),(0,I.jsxs)(L,{title:`Daily cost`,right:(0,I.jsx)(Cg,{bars:c,active:n,total:c.reduce((e,t)=>e+t.cost,0)}),children:[i.data?c.length===0&&(0,I.jsx)(Et,{title:`No history yet`}):(0,I.jsx)(Dt,{rows:2}),c.length>0&&(0,I.jsx)(Sg,{bars:c,active:n,onActive:r,height:96,showDayLabels:!1})]})]})}var Ug=[{key:`inbox`,label:`Inbox`},{key:`assigned`,label:`Assigned`},{key:`in_progress`,label:`In progress`},{key:`verifying`,label:`Verifying`},{key:`needs_you`,label:`Needs you`},{key:`done`,label:`Done`}];function Wg(){let e=F(()=>P.status(),[],{live:!1,intervalMs:3e4}),t=F(()=>P.tasks(),[],{intervalMs:4e3}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);if(e.data&&e.data.orchestration===!1)return(0,I.jsx)(Gg,{status:e.data,onEnabled:()=>{e.refresh(),t.refresh()}});let o=e=>(t.data??[]).filter(t=>t.status===e||e===`done`&&t.status===`failed`);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm text-[12px] hover:bg-accent/20`,children:`+ New task`}),(0,I.jsx)(Jg,{available:e.data?.claude_available??!1}),(t.data??[]).some(e=>e.assignee!==``&&e.status!==`done`&&e.status!==`failed`)&&(0,I.jsx)(`a`,{href:`#/graph`,className:`link text-[12px] border border-border px-2 py-1 rounded-sm hover:border-border-strong`,children:`view graph`}),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[`Tasks are files on disk (`,(0,I.jsx)(`span`,{className:`mono`,children:`tasks/.md`}),`); the orchestrator moves them. Nothing reaches Done until its `,(0,I.jsx)(`span`,{className:`mono`,children:`done_criteria`}),` pass.`]})]}),t.error&&!t.data&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:t.error.message}),t.data&&t.data.length===0&&(0,I.jsxs)(`div`,{className:`border border-border bg-panel-2/60 rounded-sm px-3 py-2 text-[12px] text-fg-muted`,children:[`Start here: `,(0,I.jsx)(`span`,{className:`text-fg`,children:`+ New task`}),` — a title and the commands that have to pass. Then `,(0,I.jsx)(`span`,{className:`text-fg`,children:`▶ Start orchestrator`}),`, which assigns it to a worker and keeps going until the checks are green.`]}),(0,I.jsx)(`div`,{className:`grid gap-2 grid-cols-2 md:grid-cols-3 xl:grid-cols-6`,children:Ug.map(e=>(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.08em] text-fg-faint mb-1.5 px-0.5 flex justify-between`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`span`,{className:`num`,children:o(e.key).length})]}),(0,I.jsx)(`div`,{className:`grid gap-1.5 content-start min-h-[60px]`,children:o(e.key).map(e=>(0,I.jsx)(Yg,{t:e,onApprove:()=>t.refresh(),onOpen:()=>a(e.id)},e.id))})]},e.key))}),n&&(0,I.jsx)(e_,{onClose:()=>{r(!1),t.refresh()}}),i&&(0,I.jsx)(Xg,{id:i,onClose:()=>{a(null),t.refresh()}})]})}function Gg({status:e,onEnabled:t}){let[n,r]=(0,l.useState)(!1),i=e.suggested_hive??`~/caprock-tasks`,a=e.suggested_repo??``;return(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-[52rem] mx-auto`,children:[(0,I.jsxs)(L,{title:`Task runner`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`off`}),children:[(0,I.jsxs)(`div`,{className:`grid gap-3 px-3 py-3`,children:[(0,I.jsxs)(`ol`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,I.jsx)(Kg,{n:1,title:`You write a task`,children:`A title, a budget, and the commands that have to pass.`}),(0,I.jsxs)(Kg,{n:2,title:`Caprock runs it`,children:[`One Claude session per task, in its `,(0,I.jsx)(`span`,{className:`text-fg`,children:`own git worktree`}),` — your working tree is untouched.`]}),(0,I.jsxs)(Kg,{n:3,title:`Caprock checks it`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Caprock`}),` runs your commands, not the agent. Only green is done.`]})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Best for independent tasks — nothing here merges branches. The queue directory is created for you; your repository is not modified.`})]}),(0,I.jsxs)(`footer`,{className:`px-3 py-2 border-t border-border flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25`,children:`Turn on the task runner`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`No restart. Nothing runs until you start it.`})]})]}),n&&(0,I.jsx)(qg,{hive:i,repo:a,onClose:()=>r(!1),onDone:t})]})}function Kg({n:e,title:t,children:n}){return(0,I.jsxs)(`li`,{className:`border border-border bg-panel-2/60 rounded-sm px-2.5 py-2 grid gap-1 content-start`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:`num text-[11px] text-accent`,children:e}),(0,I.jsx)(`span`,{className:`text-[12px] font-medium`,children:t})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-muted leading-[1.45]`,children:n})]})}function qg({hive:e,repo:t,onClose:n,onDone:r}){let[i,a]=(0,l.useState)(e),[o,s]=(0,l.useState)(t),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:n,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Turn on the task runner`}),(0,I.jsx)(`button`,{onClick:n,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`ul`,{className:`grid gap-1 text-[12px] text-fg-muted`,children:[(0,I.jsx)(`li`,{children:`· Creates the queue directory below, with a README and an example task.`}),(0,I.jsxs)(`li`,{children:[`· Lets Caprock spawn Claude sessions `,(0,I.jsx)(`span`,{className:`text-fg`,children:`with permission prompts skipped`}),`, one git worktree each under the repo below.`]}),(0,I.jsx)(`li`,{children:`· Starts nothing yet — you start the orchestrator, and only then does work begin.`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Queue directory`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · created if missing`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:i,onChange:e=>a(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Repository`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · workers branch from here`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:o,onChange:e=>s(e.target.value)})]}),d&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:d})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:n,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{u(!0),f(``);try{await P.enableHive(i.trim(),o.trim()),n(),r()}catch(e){f(ae(e))}finally{u(!1)}},disabled:c,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`turning on…`:`Turn it on`})]})]})})}function Jg({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(`button`,{disabled:t||!e,onClick:async()=>{n(!0),i(``);try{let e=await P.startOrchestrator();i(`orchestrator: `+e.session_id.slice(0,8))}catch(e){i(ae(e))}finally{n(!1)}},title:e?`spawn the orchestrator session`:`claude not found — cannot spawn`,className:`border border-border text-fg-muted px-2 py-1 rounded-sm text-[12px] hover:text-fg disabled:opacity-50`,children:t?`starting…`:`▶ Start orchestrator`}),!e&&(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` was not found on this machine, so Caprock cannot spawn the orchestrator. It still observes every session you start yourself.`]}),r&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint mono`,children:r})]})}function Yg({t:e,onApprove:t,onOpen:n}){let r=e.budget_usd>0&&e.cost_usd>e.budget_usd,i=e.assignee!==``;return(0,I.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] px-2 py-1.5`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left disabled:cursor-default`,disabled:!i,onClick:n,title:i?`show the diff, the checks that ran, and where the branch is`:`nothing to show yet — no worker has picked this up`,children:[(0,I.jsx)(`div`,{className:`text-[12px] font-medium truncate ${i?`hover:text-accent`:``}`,title:e.title,children:e.title||e.id}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[10px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono`,children:E(e.id)}),e.assignee&&(0,I.jsxs)(`span`,{className:`mono text-fg-muted`,children:[`→ `,e.assignee]}),(0,I.jsxs)(`span`,{className:`num ml-auto ${r?`text-danger`:`text-fg-muted`}`,children:[S(e.cost_usd),e.budget_usd>0?` / ${S(e.budget_usd)}`:``]})]})]}),i&&(0,I.jsxs)(`div`,{className:`mt-1 text-[10px] text-fg-faint mono truncate`,children:[`caprock/`,e.assignee]}),e.status===`needs_you`&&(0,I.jsxs)(`div`,{className:`flex gap-1 mt-1.5`,children:[(0,I.jsx)(`button`,{onClick:()=>P.approve(e.id,!0).then(t),className:`flex-1 text-[11px] border border-ok/40 text-ok rounded-sm hover:bg-ok/10`,children:`approve`}),(0,I.jsx)(`button`,{onClick:()=>P.approve(e.id,!1).then(t),className:`flex-1 text-[11px] border border-danger/40 text-danger rounded-sm hover:bg-danger/10`,children:`reject`})]})]})}function Xg({id:e,onClose:t}){let n=F(()=>P.task(e),[e],{intervalMs:6e3}),r=n.data,i=r?.work,a=i?.sessions?.[0];return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-16`,onClick:t,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[820px] max-w-[94vw] max-h-[82vh] overflow-auto`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center gap-2 sticky top-0 bg-panel z-10`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Task`}),r&&(0,I.jsx)(`span`,{className:`text-[12px] truncate`,children:r.task.title||r.task.id}),r&&(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint`,children:r.task.status}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),!r&&!n.error&&(0,I.jsx)(Dt,{rows:5}),n.error&&!r&&(0,I.jsx)(Et,{title:`Cannot load the task`,children:n.error.message}),r&&(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-3`,children:[(0,I.jsx)(Zg,{work:i,assignee:r.task.assignee}),(0,I.jsx)(Qg,{criteria:r.done_criteria,runs:i?.verifications,status:r.task.status}),(0,I.jsx)($g,{sessionID:a?.session_id,assignee:r.task.assignee}),r.body&&(0,I.jsx)(L,{title:`Brief`,children:(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.45] px-3 py-2 whitespace-pre-wrap`,children:r.body})})]})]})})}function Zg({work:e,assignee:t}){return e?.branch?(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsxs)(`tbody`,{children:[(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`branch`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.branch})]}),e.worktree&&(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`worktree`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.worktree})]}),(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32 align-top`,children:`take it`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 grid gap-1 justify-items-start`,children:[(0,I.jsx)(Ot,{command:`git merge --no-ff ${e.branch}`}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Run it from `,e.repo?(0,I.jsx)(`span`,{className:`mono`,children:e.repo}):`your repo`,`, on the branch you want the work on. Prefer `,(0,I.jsx)(`span`,{className:`mono`,children:`git cherry-pick`}),` if you only want some of it. Worker`,` `,(0,I.jsx)(`span`,{className:`mono`,children:t}),` may still be running — check the diff below first.`]})]})]})]})})}):(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:`No worker has been assigned yet, so there is no branch. One is created the moment the orchestrator assigns this task.`})})}function Qg({criteria:e,runs:t,status:n}){let r=t?.[0],i=r?t.filter(e=>e.round===r.round):[],a=r?`round ${r.round}`:void 0;return(0,I.jsxs)(L,{title:`What has to pass`,right:a,children:[i.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 grid gap-1`,children:[(0,I.jsx)(`div`,{className:`text-[12px] text-fg-faint`,children:n===`done`?`This task was marked done without a recorded check.`:`Not run yet. Caprock runs these itself, in the worker’s worktree, when the worker reports it has finished.`}),(0,I.jsx)(`ul`,{className:`grid gap-0.5`,children:(e??[]).map(e=>(0,I.jsxs)(`li`,{className:`mono text-[11px] text-fg-muted`,children:[`$ `,e]},e))}),(e??[]).length===0&&(0,I.jsx)(`div`,{className:`mono text-[11px] text-danger`,children:`no done_criteria — Caprock cannot verify this task`})]}),i.length>0&&(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0 px-3 py-1.5 flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`text-[10px] w-14 shrink-0 mono ${e.exit_code===0?`text-ok`:`text-danger`}`,children:e.exit_code===0?`passed`:`exit ${e.exit_code}`}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,title:e.command,children:e.command})]},e.command))})]})}function $g({sessionID:e,assignee:t}){let n=F(()=>e?P.diff(e):Promise.resolve(void 0),[e],{intervalMs:8e3}),[r,i]=(0,l.useState)(null);if(!e)return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`No session has been attributed to this task yet`,t?` (worker ${t})`:``,`, so there is nothing to diff.`]})});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let t=e.body;return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[t?.error,t?.cwd?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(`span`,{className:`mono`,children:t.cwd})]}):null]})})}return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:e.message})})}let a=n.data;return a?(0,I.jsxs)(L,{title:`What changed`,right:(0,I.jsxs)(`span`,{className:`num`,children:[a.files.length,` files`]}),children:[a.files.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`Nothing uncommitted in `,(0,I.jsx)(`span`,{className:`mono`,children:a.branch||`the worktree`}),`. If the worker committed its work, the branch above holds it.`]}),(0,I.jsx)(`ul`,{children:a.files.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>i(r===e.path?null:e.path),children:[(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),r===e.path&&e.patch&&(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[40vh]`,children:e.patch.split(` -`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})}),r===e.path&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path))})]}):(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(Dt,{rows:3})})}function e_({onClose:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`3`),[a,o]=(0,l.useState)(`go test ./... +`);let l=new TextEncoder,u=e=>{c.readyState===WebSocket.OPEN&&c.send(l.encode(e))},d=i.onData(u),f=(e,t)=>{c.readyState!==WebSocket.OPEN||e<=0||t<=0||c.send(JSON.stringify({resize:{cols:e,rows:t}}))},p=i.onResize(({cols:e,rows:t})=>f(e,t));c.onopen=()=>{try{o.fit()}catch{}f(i.cols,i.rows)};let m=e=>{e.preventDefault(),e.stopPropagation(),u(`\x1B\r`)};i.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;if(h&&e.metaKey&&!e.ctrlKey&&!e.altKey){if(e.key===`c`)return!g();if(e.key===`v`)return _(),!1}if(!h&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey){if(e.key===`C`||e.key===`c`)return g(),!1;if(e.key===`V`||e.key===`v`)return _(),!1}return!h&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.key===`c`||e.key===`C`)?!g()||(i.clearSelection(),!1):e.ctrlKey&&!e.altKey&&!e.metaKey&&(e.key===`j`||e.key===`J`)?(m(e),!1):e.key!==`Enter`||[e.shiftKey,e.altKey,e.ctrlKey,e.metaKey].filter(Boolean).length!==1||e.metaKey?!0:(m(e),!1)});let h=/Mac|iP(hone|ad)/.test(navigator.platform||navigator.userAgent),g=()=>{let e=i.getSelection();return e?(navigator.clipboard?.writeText(e),!0):!1},_=()=>{navigator.clipboard?.readText().then(e=>{e&&i.paste(e)}).catch(()=>{})},v=async e=>{let t=e.type||`application/octet-stream`,n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e{let t=[...e.clipboardData?.items??[]].find(e=>e.kind===`file`)?.getAsFile();t&&(e.preventDefault(),v(t))},b=e=>{let t=e.dataTransfer?.files?.[0];t&&(e.preventDefault(),v(t))},x=e=>{e.preventDefault()},S=a.current;S.addEventListener(`paste`,y),S.addEventListener(`drop`,b),S.addEventListener(`dragover`,x);let C=0,w=``,T=()=>{C=0;let e=a.current;if(!e)return;let t=`${e.clientWidth}x${e.clientHeight}`;if(t!==w){w=t;try{o.fit()}catch{}}},ee=new ResizeObserver(()=>{C||=requestAnimationFrame(T)});return ee.observe(a.current),()=>{S.removeEventListener(`paste`,y),S.removeEventListener(`drop`,b),S.removeEventListener(`dragover`,x),C&&cancelAnimationFrame(C),ee.disconnect(),d.dispose(),p.dispose(),c.close(),i.dispose()}},[e,t]),t?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{ref:a,className:`h-[70vh] bg-bg`}),(0,I.jsxs)(`div`,{className:`border-t border-border px-3 py-1.5 text-[11px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Shift`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` for a new line —`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Option`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Enter`}),` and`,` `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`Ctrl`}),`+`,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`J`}),` do the same.`]})]}):(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,I.jsx)(`p`,{className:`text-[14px] text-fg`,children:`You started this session yourself, so it has no terminal here.`}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-bg hover:brightness-110`,children:`Launch a new Claude Code session here →`}),(0,I.jsxs)(`p`,{className:`max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:[`Runs a second `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` in`,` `,n?(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:n}):`this repository`,` and gives it a terminal you can type in. This session keeps running, untouched.`]}),r&&(0,I.jsx)(Ur,{available:!0,onClose:()=>i(!1),initialCwd:n??``}),(0,I.jsx)(`p`,{className:`mt-1 max-w-[52ch] text-[12px] leading-relaxed text-fg-faint`,children:`Caprock never types into a process it did not start — including this one, which stays visible here and keeps being measured.`})]})}function ug({sessionID:e,cwd:t,live:n}){let[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``),u=`claude --resume ${e}`;async function d(){i(!0),c(``);try{v({name:`session`,id:(await P.spawn({cwd:t,resume:e,fork:n})).session_id,tab:`terminal`})}catch(e){c(e instanceof M?e.message:String(e))}finally{i(!1)}}async function f(){try{await navigator.clipboard.writeText(u),o(!0),window.setTimeout(()=>o(!1),2e3)}catch{c(`Could not reach the clipboard. Select the command and copy it.`)}}return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:d,disabled:r,title:n?`Open a branch of this conversation here — the original keeps running`:`Carry this conversation on, here`,className:`text-[11px] border border-accent text-accent px-1.5 rounded-sm hover:bg-accent/10 disabled:opacity-50`,children:r?`opening…`:n?`branch here`:`continue here`}),(0,I.jsx)(`button`,{onClick:f,title:u,className:`text-[11px] text-fg-faint hover:text-fg`,children:a?`copied`:`copy command`}),s&&(0,I.jsx)(`span`,{className:`text-[11px] text-danger`,children:s})]})}function dg(e){return e.agent===`gemini`?`telemetry`:[e.has_hooks?`hooks`:`no hooks`,e.has_transcript?`transcript`:`no transcript`].join(` · `)}function fg({id:e,tab:t,at:n}){let r=F(()=>P.session(e),[e],{intervalMs:5e3}),i=t===`changes`||t===`diff`||t===`files`?`changes`:t===`terminal`||t===`notes`?t:`timeline`,a=re(1e3),[o]=De(),s=r.data;if(r.error&&!s)return(0,I.jsx)(Et,{title:r.error instanceof M&&r.error.status===404?`Session not found`:`Cannot load session`,children:r.error.message});if(!s)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let c=t=>v({name:`session`,id:e,tab:t}),l=s.stats.tokens_in+s.stats.tokens_out+s.stats.cache_read+s.stats.cache_write,u=!s.has_hooks&&!s.has_transcript&&l===0&&s.stats.turns===0,d=u&&s.agent===`gemini`;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`a`,{href:g({name:`now`}),className:`link text-fg-muted text-[12px]`,children:`← Now`}),(0,I.jsx)(`h1`,{className:`text-[15px] font-medium`,children:s.project||`unknown project`}),(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-faint`,children:s.session_id}),s.git_branch&&(0,I.jsx)(`span`,{className:`mono text-[11px] text-fg-muted`,children:s.git_branch}),(0,I.jsx)(wt,{health:s.activity.health}),s.owned&&s.status!==`ended`&&(0,I.jsx)(xg,{id:e}),!s.owned&&(s.agent??`claude`)===`claude`&&(0,I.jsx)(ug,{sessionID:s.session_id,cwd:s.cwd,live:s.status!==`ended`}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted ml-auto num`,children:s.cwd})]}),(0,I.jsxs)(`div`,{className:`text-[13px]`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:s.activity.phrase}),(0,I.jsx)(`span`,{className:`text-fg-faint num text-[11px] ml-2`,children:T(s.activity.at||s.last_event_at,a)}),s.loop&&(0,I.jsxs)(`span`,{className:`ml-3 text-danger text-[12px]`,children:[`loop: `,s.loop.sample,` ×`,s.loop.count,` in `,s.loop.window_min,`m`]})]}),u?(0,I.jsx)(L,{children:(0,I.jsx)(`div`,{className:`px-3 py-2.5 text-[13px] text-fg-muted`,children:d?(0,I.jsxs)(I.Fragment,{children:[`Nothing measured yet — Gemini reports its own figures, and the first ones arrive with its first answer.`,` `,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`The terminal below is live.`})]}):(0,I.jsxs)(I.Fragment,{children:[`Caprock started this `,Ut(s.agent),` session but does not measure it — there are no hooks and no transcript to read, so cost, tokens and turns are not counted here.`,` `,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:`The terminal below is live.`})]})})}):(0,I.jsx)(L,{children:(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:S(s.stats.cost_usd),sub:(0,I.jsx)(`span`,{title:_n(o),children:s.model||`unknown model`})}),(0,I.jsx)(R,{label:`Tokens`,value:C(l),sub:`in ${C(s.stats.tokens_in)} · out ${C(s.stats.tokens_out)} · cache ${C(s.stats.cache_read+s.stats.cache_write)}`}),(0,I.jsx)(R,{label:`Cache`,value:w(s.savings.hit_rate*100),sub:`read ${C(s.stats.cache_read)} · write ${C(s.stats.cache_write)}`,tone:s.savings.hit_rate>.5?`ok`:void 0}),(0,I.jsx)(R,{label:`Context`,value:s.context?w(s.context.pct):`—`,sub:s.context?`${C(s.context.tokens)} / ${C(s.context.window)}`:`unknown model`,tone:s.context&&s.context.pct>=85?`danger`:s.context&&s.context.pct>=60?`warn`:void 0}),(0,I.jsx)(R,{label:`Turns`,value:s.stats.turns,sub:`${s.stats.tool_calls} tool calls`}),(0,I.jsx)(R,{label:`Files`,value:s.stats.files_touched,sub:dg(s)})]})}),(0,I.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-border`,children:[[`timeline`,`notes`,`changes`,`terminal`].map(e=>(0,I.jsx)(`button`,{onClick:()=>c(e),className:`px-3 py-1.5 text-[12px] border-b-2 -mb-px ${i===e?`border-accent text-fg`:`border-transparent text-fg-muted hover:text-fg`}`,children:e===`timeline`?`Timeline`:e===`notes`?`Answers`:e===`changes`?`Changes`:`Terminal`},e)),!s.owned&&(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint pr-1`,children:`observe-only — terminal is read/write for spawned sessions only`})]}),i===`timeline`&&(0,I.jsx)(mg,{id:e,initial:s.events,now:a,at:n}),i===`notes`&&(0,I.jsx)(Qr,{id:e,now:a}),i===`changes`&&(0,I.jsx)(vg,{id:e,s}),i===`terminal`&&(0,I.jsx)(L,{className:`overflow-hidden`,children:(0,I.jsx)(lg,{sessionId:e,owned:s.owned&&s.status!==`ended`,cwd:s.cwd})})]})}var pg=200;function mg({id:e,initial:t,now:n,at:r}){let[i,a]=(0,l.useState)(t),[o,s]=(0,l.useState)(`all`),c=(0,l.useRef)(t.length?t[t.length-1].id:0),u=(0,l.useRef)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),g=async()=>{let t=i[0]?.id;if(!(t===void 0||f)){p(!0);try{let n=await P.eventsBefore(e,t,pg);n.length===0?h(!0):a(e=>[...n,...e])}catch{h(!0)}finally{p(!1)}}};(0,l.useEffect)(()=>{a(t),h(!1),c.current=t.length?t[t.length-1].id:0},[t]),(0,l.useEffect)(()=>d.onFrame(t=>{t.type!==`event`||t.data.session_id!==e||t.data.id<=c.current||(c.current=t.data.id,a(e=>[...e,t.data].slice(-5e3)))}),[e]);let _=(0,l.useMemo)(()=>{let e=0;return i.filter(e=>e.kind===`turn.assistant`).map(t=>e+=t.cost_usd??0)},[i]),v=(0,l.useMemo)(()=>{let e=new Map;for(let t of i)if(t.kind===`tool.pre`&&t.tool){let n=t.payload;n?.tool_use_id&&e.set(n.tool_use_id,t.tool)}return e},[i]),y=i.filter(e=>o===`all`||(o===`tools`?e.kind.startsWith(`tool.`):e.kind.startsWith(`turn.`)||e.kind===`agent.stop`)).slice().reverse();return(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(0,1fr)_260px]`,children:[(0,I.jsx)(L,{title:`Events · ${i.length} shown`,className:`min-w-0 overflow-hidden`,right:(0,I.jsx)(`span`,{className:`inline-flex items-center gap-2`,children:[`all`,`tools`,`turns`].map(e=>(0,I.jsx)(`button`,{onClick:()=>s(e),className:`px-1.5 rounded-sm ${o===e?`bg-panel-2 text-fg`:`hover:text-fg`}`,children:e},e))}),children:(0,I.jsxs)(`ol`,{ref:u,className:`max-h-[70vh] overflow-auto`,children:[y.length===0&&(0,I.jsx)(Et,{title:`No events yet`}),y.map(e=>(0,I.jsx)(gg,{e,now:n,toolByUse:v,inMinute:r!==void 0&&hg(e.ts,r)},e.id)),!m&&i.length>0&&(0,I.jsx)(`li`,{className:`px-3 py-1.5 border-t border-border/60`,children:(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-0.5 rounded-sm`,onClick:()=>void g(),disabled:f,children:f?`loading…`:`load earlier events`})}),m&&(0,I.jsx)(`li`,{className:`px-3 py-1 text-[11px] text-fg-faint`,children:`start of session`})]})}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Cost, cumulative`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(Tt,{values:_.length?_:[0,0],width:230,height:40,tone:`accent`})}),(0,I.jsxs)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted num`,children:[_.length,` priced turns · `,S(_[_.length-1]??0)]})]}),(0,I.jsxs)(L,{title:`Tokens per turn`,children:[(0,I.jsx)(`div`,{className:`px-3 py-2`,children:(0,I.jsx)(Tt,{values:i.filter(e=>e.tokens).map(e=>e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),width:230,height:40})}),(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-muted`,children:`prompt size (input + cache) per assistant turn`})]})]})]})}function hg(e,t){let n=Date.parse(e);return Number.isFinite(n)&&Math.floor(n/6e4)===Math.floor(t/6e4)}function gg({e,now:t,toolByUse:n,inMinute:r}){let[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(null);(0,l.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`center`})},[r]);let s=e.payload??{},c=e.tool||(e.kind===`tool.post`?n.get(String(s.tool_use_id??``)):void 0),u=_g({...e,tool:c},s),d=e.kind===`turn.assistant`?String(s.text??``):e.kind===`turn.user`?String(s.prompt??``):e.kind===`tool.post`&&typeof s.tool_response==`string`?s.tool_response:``,f=e.kind===`turn.user`?`text-info`:e.kind===`turn.assistant`?`text-fg`:e.kind===`agent.stop`||e.kind===`context.compact`?`text-warn`:`text-fg-muted`;return(0,I.jsxs)(`li`,{ref:o,className:`border-b border-border/60 last:border-0 hover:bg-panel-2 animate-flash ${r?`bg-accent/10 border-l-2 border-l-accent`:``}`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left flex items-baseline gap-2 px-3 py-[3px]`,onClick:()=>a(!i),children:[(0,I.jsx)(`span`,{className:`num text-[10px] text-fg-faint w-14 shrink-0`,children:T(e.ts,t)}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-24 shrink-0 ${f}`,children:e.kind}),(0,I.jsx)(`span`,{className:`truncate text-[12px] min-w-0`,title:u,children:u}),e.tokens&&(0,I.jsxs)(`span`,{className:`ml-auto num text-[10px] text-fg-faint shrink-0`,children:[C(e.tokens.in+e.tokens.cache_read+e.tokens.cache_write),`→`,C(e.tokens.out),e.cost_usd===void 0?``:` · ${S(e.cost_usd)}`]})]}),i&&(0,I.jsxs)(`div`,{className:`px-3 pb-2`,children:[d?(0,I.jsx)(`div`,{className:`text-[12px] leading-[1.55] whitespace-pre-wrap break-words max-h-96 overflow-auto border-l-2 border-border-strong pl-3 mb-2`,children:d}):null,(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{className:`text-[10px] text-fg-faint cursor-pointer select-none`,children:`raw event`}),(0,I.jsx)(`pre`,{className:`mono text-[10px] leading-[1.4] text-fg-muted pt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all`,children:JSON.stringify({id:e.id,ts:e.ts,source:e.source,key:e.key,agent_id:e.agent_id,model:e.model,tokens:e.tokens,cost_usd:e.cost_usd,payload:e.payload},null,2)})]})]})]})}function _g(e,t){let n=t.tool_input??{};switch(e.kind){case`tool.pre`:{let r=e.tool??String(t.tool_name??`tool`),i=n.command??n.file_path??n.pattern??n.query??n.url??n.prompt??``;return i?`${r} ${String(i).split(` +`)[0]}`:r}case`tool.post`:{let n=e.tool??String(t.tool_name??`tool`),r=t.tool_response,i=t.is_error===!0,a=typeof r==`string`?r:r?JSON.stringify(r):``;return`${n} ${i?`failed`:`done`}${a?` ${a.slice(0,160)}`:``}`}case`turn.user`:return`you: ${String(t.prompt??``).slice(0,200)}`;case`turn.assistant`:{let n=String(t.text??``),r=Array.isArray(t.tools)?t.tools:[];return n?n.slice(0,200):r.length?`→ ${r.join(`, `)}`:`${e.model??`assistant`} turn`}case`agent.stop`:return e.agent_id?`subagent ${e.agent_id} stopped`:`turn ended (${String(t.stop_reason??`stop`)})`;case`agent.spawn`:return`session started (${String(t.source??`startup`)})`;case`context.compact`:return`context compaction (${String(t.trigger??`auto`)})`;default:return e.kind}}function vg({id:e,s:t}){let n=F(()=>P.diff(e),[e,t.last_event_at],{live:!1,intervalMs:8e3}),[r,i]=(0,l.useState)(new Set),a=e=>i(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let n=e.body;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(Et,{title:`No git repository`,children:[n?.cwd?(0,I.jsx)(`span`,{className:`mono`,children:n.cwd}):null,` `,n?.error]}),(0,I.jsx)(bg,{s:t})]})}return(0,I.jsx)(Et,{title:`Cannot load diff`,children:e.message})}let o=n.data;if(!o)return(0,I.jsx)(`div`,{className:`text-fg-muted px-1`,children:`loading…`});let s=new Set(o.files.map(e=>e.path)),c=t.files.filter(e=>!s.has(e)&&!s.has(e.replace(/^.*?\//,``))),u=o.files.length>0&&o.files.every(e=>r.has(e.path));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(L,{title:`Changes · ${o.branch||`detached`}`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o.base&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:o.base}),o.files.length>0&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-0.5 rounded-sm`,onClick:()=>i(u?new Set:new Set(o.files.map(e=>e.path))),children:u?`collapse all`:`expand all`}),(0,I.jsxs)(`span`,{className:`num`,children:[o.files.length,` files`]})]}),children:[o.files.length===0&&(0,I.jsx)(Et,{title:`Clean working tree`}),(0,I.jsx)(`ul`,{children:o.files.map(e=>{let t=r.has(e.path);return(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>a(e.path),"aria-expanded":t,children:[(0,I.jsx)(`span`,{className:`text-fg-faint text-[10px] shrink-0 transition-transform ${t?`rotate-90`:``}`,children:`▶`}),(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),t&&e.patch&&(0,I.jsx)(yg,{patch:e.patch}),t&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path)})})]}),c.length>0&&(0,I.jsx)(bg,{s:t,only:c})]})}function yg({patch:e}){return(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[50vh]`,children:e.split(` +`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})})}function bg({s:e,only:t}){let n=t??e.files,r=e.files.length(0,I.jsxs)(`li`,{className:`px-3 py-1 border-b border-border/60 last:border-0 flex gap-2 items-baseline`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px]`,children:te(e)}),(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint truncate`,children:e})]},e))})]})}function xg({id:e}){let[t,n]=(0,l.useState)(``),r=async t=>{n(t);try{await P.signal(e,t)}catch{}finally{n(``)}};return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-ok border border-ok/40 rounded-sm px-1`,children:`owned`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`pause`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`pause`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`resume`),className:`text-[11px] border border-border px-1.5 rounded-sm text-fg-muted hover:text-fg`,children:`resume`}),(0,I.jsx)(`button`,{disabled:!!t,onClick:()=>r(`kill`),className:`text-[11px] border border-danger/40 text-danger px-1.5 rounded-sm hover:bg-danger/10`,children:`kill`})]})}function Sg(e){if(!Number.isFinite(e)||e<=0)return[];let t=e/3,n=10**Math.floor(Math.log10(t)),r=[1,2,5,10].map(e=>e*n).find(e=>e>=t)??n*10,i=[];for(let t=r;t<=e*1.0001;t+=r)i.push(t);return i}function Cg({bars:e,active:t,onActive:n,height:r=112,showDayLabels:i=!0}){let a=e=>typeof e==`number`&&Number.isFinite(e)?e:0,o=Math.max(...e.map(e=>a(e.cost)),1e-9),s=r-16,c=Sg(o);return(0,I.jsxs)(`div`,{className:`relative px-3 py-3 flex items-end gap-[3px]`,style:{height:r},onMouseLeave:()=>n(null),children:[c.map(e=>(0,I.jsx)(`div`,{className:`pointer-events-none absolute left-3 right-3 border-t border-border/60`,style:{bottom:16+Math.round(s*e/o)},"aria-hidden":!0,children:(0,I.jsx)(`span`,{className:`num absolute -top-[7px] right-0 bg-panel pl-1 text-[9px] text-fg-faint`,children:S(e)})},e)),e.map(e=>{let r=t===e.day;return(0,I.jsxs)(`button`,{type:`button`,className:`flex-1 flex flex-col items-center justify-end gap-1 min-w-0 h-full cursor-default focus:outline-none`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(a(e.cost))}`,children:[(0,I.jsx)(`div`,{className:`w-full rounded-t-sm transition-colors ${r?`bg-accent`:`bg-accent/70`}`,style:{height:Math.max(2,Math.round(s*a(e.cost)/o))}}),i&&(0,I.jsx)(`div`,{className:`num text-[9px] ${r?`text-fg`:`text-fg-faint`}`,children:e.day.slice(8)})]},e.day)})]})}function wg({bars:e,active:t,total:n}){let r=t?e.find(e=>e.day===t):void 0;return r?(0,I.jsxs)(`span`,{className:`num flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:r.day}),(0,I.jsx)(`span`,{className:`text-fg`,children:S(r.cost)}),(0,I.jsx)(`span`,{className:`text-fg-faint`,children:C(r.tokens)}),r.sessions!==void 0&&r.sessions>0&&(0,I.jsxs)(`span`,{className:`text-fg-faint`,children:[r.sessions,` `,r.sessions===1?`session`:`sessions`]})]}):(0,I.jsx)(`span`,{className:`num`,children:S(n)})}var Tg=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Eg(e){return(new Date(`${e}T00:00:00Z`).getUTCDay()+6)%7}function Dg(e,t){if(!(e>0))return`bg-border/60`;let n=Math.sqrt(e/Math.max(t,1e-9));return n>.75?`bg-accent`:n>.5?`bg-accent/75`:n>.25?`bg-accent/50`:`bg-accent/25`}function Og({bars:e,active:t,onActive:n,maxCell:r=44}){let i=e=>typeof e==`number`&&Number.isFinite(e)?e:0,a=Math.max(...e.map(e=>i(e.cost)),1e-9),o=e[0],s=o?Eg(o.day):0;return(0,I.jsxs)(`div`,{className:`px-3 py-3`,onMouseLeave:()=>n(null),children:[(0,I.jsxs)(`div`,{className:`grid gap-1`,style:{gridTemplateColumns:`repeat(7, minmax(0, 1fr))`,maxWidth:r*7+24},children:[Tg.map((e,t)=>(0,I.jsx)(`div`,{className:`text-center text-[9px] text-fg-faint`,"aria-hidden":!0,children:e},t)),Array.from({length:s},(e,t)=>(0,I.jsx)(`div`,{"aria-hidden":!0},`lead-${t}`)),e.map(e=>{let r=i(e.cost),o=t===e.day;return(0,I.jsx)(`button`,{type:`button`,className:`flex aspect-square items-center justify-center focus:outline-none cursor-default`,onMouseEnter:()=>n(e.day),onFocus:()=>n(e.day),onBlur:()=>n(null),"aria-label":`${e.day}: ${S(r)}`,children:(0,I.jsx)(`span`,{className:`h-full w-full rounded-[3px] transition-colors ${Dg(r,a)} ${o?`ring-1 ring-accent ring-offset-1 ring-offset-panel`:``}`})},e.day)})]}),(0,I.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 text-[9px] text-fg-faint`,children:[(0,I.jsx)(`span`,{children:`$0`}),[`bg-border/60`,`bg-accent/25`,`bg-accent/50`,`bg-accent/75`,`bg-accent`].map(e=>(0,I.jsx)(`span`,{className:`h-2 w-2 rounded-[2px] ${e}`,"aria-hidden":!0},e)),(0,I.jsx)(`span`,{className:`num`,children:S(a)})]})]})}var kg=e=>e===1?`day`:`days`;function Ag({summary:e,plan:t,days:n}){if(!e)return null;let r=e.cost_usd;if(!t?.plan_kind)return(0,I.jsx)(L,{title:`Plan value`,children:(0,I.jsx)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted`,children:`Set your plan in the header and Caprock will show what this usage is worth against what you actually pay. It can't detect your plan, so it won't guess.`})});if(t.plan_kind===`metered`)return(0,I.jsx)(L,{title:`Spend`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label||`API`,` · billed per token`]}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-3xl text-fg`,children:S(r)}),(0,I.jsxs)(`span`,{className:`text-[12px] text-fg-muted`,children:[`over the last `,n,` `,kg(n)]})]}),(0,I.jsxs)(`p`,{className:`text-[11px] text-fg-faint mt-2 max-w-[60ch]`,children:[`You are billed per token, so this is approximately your actual cost — at Anthropic list prices (`,e.pricing_version,`). Not a saving.`]})]})});let i=t.plan_usd_per_month*n/30,a=i>0?r/i:0;return(0,I.jsxs)(L,{title:`Plan value`,right:(0,I.jsxs)(`span`,{className:`num text-[12px] text-fg-muted`,children:[t.plan_label,` · `,S(t.plan_usd_per_month),`/mo`]}),children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 divide-y sm:divide-y-0 sm:divide-x divide-border`,children:[(0,I.jsx)(R,{label:`you pay · ${n}d`,value:S(i),sub:t.plan_label}),(0,I.jsx)(R,{label:`same usage at API list`,value:S(r),sub:`at list prices ${e.pricing_version}`,tone:`ok`}),(0,I.jsx)(R,{label:`which is`,value:a>0?`${a.toFixed(1)}×`:`—`,sub:a>0?`what ${n} ${kg(n)} would cost through the API`:`not enough measured usage yet`,tone:a>0?`ok`:void 0,size:`hero`})]}),(0,I.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] text-fg-faint leading-relaxed`,children:`Not a discount you received, and not money back — without the plan you would not have run this much.`})]})}function jg({feature:e,title:t,children:n}){let[r,i]=(0,l.useState)(!1);return F(()=>P.premium(),[]).data?.license?.active?(0,I.jsx)(I.Fragment,{children:n}):(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-panel)] border border-border`,children:[(0,I.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none select-none opacity-70`,children:n}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-3 gap-y-2 border-t border-border bg-panel-2/60 px-4 py-2.5 text-center`,children:[(0,I.jsx)(`span`,{className:`text-[13px] font-medium text-fg`,children:t}),(0,I.jsx)(`button`,{onClick:()=>i(!0),className:`rounded-sm bg-premium px-3.5 py-1.5 text-[13px] font-medium text-white hover:brightness-110`,children:`Unlock with Premium`})]}),r&&(0,I.jsx)(nt,{feature:e,onClose:()=>i(!1)})]})}function Mg({suggestion:e}){let t=F(()=>P.settings(),[],{live:!1}),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),p=t.data?.cap_usd_per_day;(0,l.useEffect)(()=>{d||p===void 0||(r(p?String(p):``),f(!0))},[p,d]);let m=t.data?.cap_usd_per_day??0,h=m>0,g=async e=>{a(!0),s(``),u(!1);try{await P.saveSettings({cap_usd_per_day:e}),r(e?String(e):``),u(!0),t.refresh()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},_=()=>{let e=n.trim().replace(/^\$/,``).replace(/,/g,``),t=Number(e);if(e===``||!Number.isFinite(t)||t<0){s(`A daily cap has to be a positive number of dollars.`);return}g(t)};return(0,I.jsx)(L,{title:`Daily spend cap`,right:(0,I.jsx)(`span`,{className:h?`text-premium-strong`:`text-fg-faint`,children:h?`on`:`off`}),children:(0,I.jsxs)(`div`,{className:`grid gap-2.5 px-3 py-3 text-[13px]`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Stop the day at`}),(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`$`}),(0,I.jsx)(`input`,{className:`input w-28`,inputMode:`decimal`,placeholder:`0`,value:n,onChange:e=>{r(e.target.value),u(!1)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Daily spend cap in dollars`}),(0,I.jsx)(`button`,{onClick:_,disabled:i,className:`rounded-sm bg-premium px-3 py-1 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50`,children:i?`Saving…`:`Save`}),h&&(0,I.jsx)(`button`,{onClick:()=>void g(0),disabled:i,className:`text-[12px] text-fg-faint hover:text-fg`,children:`turn off`}),c&&!o&&(0,I.jsx)(`span`,{className:`text-[12px] text-fg-faint`,children:`saved`})]}),!h&&e?(0,I.jsxs)(`p`,{className:`text-[12px] text-fg-faint`,children:[`Your days run about `,S(e/2),`.`,` `,(0,I.jsxs)(`button`,{onClick:()=>void g(e),className:`text-premium-strong hover:underline`,children:[`Use `,S(e)]}),` `,`— twice that, so an ordinary day never trips it.`]}):null,o&&(0,I.jsx)(`p`,{className:`text-[12px] text-danger`,children:o}),(0,I.jsx)(`p`,{className:`border-t border-border pt-2 text-[12px] leading-relaxed text-fg-faint`,children:h?(0,I.jsxs)(I.Fragment,{children:[`When today crosses `,S(m),`, Caprock pauses the sessions it started — paused, not killed, so resuming keeps the conversation. Sessions you started yourself are never touched.`]}):(0,I.jsx)(I.Fragment,{children:`Off. Nothing is paused, whatever the day costs. Sessions you started yourself are never touched either way.`})})]})})}function Ng(e){return e>=.01?`$${e.toFixed(2)}`:`${(e*100).toFixed(1)}\u00A2`}function Pg(){let e=F(()=>P.gemini(),[],{live:!1}),[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),v=e.data,y=!!v?.available,b=v!==void 0&&!v.available,x=async()=>{let t=r.trim();if(!(!t||a)){o(!0),c(``);try{await P.saveSettings({gemini_api_key:t}),i(``),e.refresh?.()}catch(e){c(ae(e))}finally{o(!1)}}},S=async()=>{let e=t.trim();if(!(!e||m)){h(!0),_(``);try{p(await P.askGemini(e,u||void 0)),n(``)}catch(e){_(ae(e))}finally{h(!1)}}};return(0,I.jsx)(L,{title:`Ask Gemini`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:y?v?.model:`your key, your bill`}),children:b?(0,I.jsxs)(`div`,{className:`px-3 py-3 text-[12px] text-fg-muted grid gap-2.5`,children:[(0,I.jsxs)(`p`,{className:`m-0`,children:[`Ask Google's Gemini about your own sessions, on your own key. Get one from`,` `,(0,I.jsx)(`a`,{className:`link`,href:`https://aistudio.google.com/apikey`,target:`_blank`,rel:`noreferrer`,children:`Google AI Studio`}),` `,`and paste it here — you pay Google directly, and Caprock counts what it spends beside your Claude figures.`]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`API key`}),(0,I.jsx)(`input`,{className:`input`,type:`password`,placeholder:`AIza…`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&x()}})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`button`,{onClick:()=>void x(),disabled:a||!r.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:a?`saving…`:`Save key`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Stored on this machine only, and never sent back to this page.`})]}),s&&(0,I.jsx)(`div`,{className:`text-danger text-[11px]`,children:s})]}):(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-2`,children:[(0,I.jsx)(`textarea`,{className:`input min-h-[70px] resize-y`,placeholder:`Ask about your sessions, your spend, anything…`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&S()}}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`button`,{onClick:()=>void S(),disabled:m||!t.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25 disabled:opacity-50`,children:m?`asking…`:`Ask`}),(v?.models?.length??0)>0&&(0,I.jsx)(`select`,{className:`input w-auto text-[12px] py-1`,value:u||v?.model||``,onChange:e=>d(e.target.value),"aria-label":`Model`,children:v.models.map(e=>(0,I.jsxs)(`option`,{value:e.id,children:[e.display,` · ~`,Ng(e.typical_usd),` a question`]},e.id))}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`⌘↵ to send`})]}),g&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:g}),(0,I.jsx)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:v?.from_env?(0,I.jsxs)(I.Fragment,{children:[`Using the key in `,(0,I.jsx)(`span`,{className:`mono`,children:v?.env_var}),`, which takes precedence over the stored one.`]}):(0,I.jsx)(I.Fragment,{children:`Using the key you saved here. Google bills you directly.`})}),f&&(0,I.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`div`,{className:`text-[13px] whitespace-pre-wrap`,children:f.text}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint num flex gap-3 flex-wrap`,children:[(0,I.jsx)(`span`,{children:f.model}),(0,I.jsxs)(`span`,{children:[`in `,C(f.usage.prompt_tokens)]}),(0,I.jsxs)(`span`,{children:[`out `,C(f.usage.output_tokens)]}),f.usage.thoughts_tokens>0&&(0,I.jsxs)(`span`,{title:`Google bills thinking tokens as output`,children:[`thinking `,C(f.usage.thoughts_tokens)]}),f.usage.cached_tokens>0&&(0,I.jsxs)(`span`,{children:[`cached `,C(f.usage.cached_tokens)]})]})]})]})})}function Fg(){let[e,t]=(0,l.useState)(`30d`),n=Date.now(),r=F(()=>P.summary(e),[e],{intervalMs:5e3}),i=F(()=>P.daily(30),[],{intervalMs:3e4}),[a]=De(),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`calendar`),d=r.data,f=!!d&&d.turns>0,p=Ig(i.data??[]),m=Rg(p.map(e=>e.cost));return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[_n(a),d?` (table ${d.pricing_version})`:``]})]}),r.error&&!d&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:r.error.message}),e!==`today`&&d&&(0,I.jsx)(Nn,{costUSD:p.reduce((e,t)=>e+t.cost,0),days:p.filter(e=>e.cost>0).length,now:n}),(0,I.jsx)(Ag,{summary:d,plan:a,days:Lg(e,d?.from_ms)}),(0,I.jsxs)(L,{title:`Totals · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 divide-x divide-border`,children:[(0,I.jsx)(R,{label:`Cost`,value:f?S(d.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:_n(a),children:f?gn(a):`nothing measured in this range`}),tone:`info`,size:`hero`}),(0,I.jsx)(R,{label:`Burn now`,value:f?`${S(d.burn.usd_per_hour)}/h`:`—`,sub:f?`${C(Math.round(d.burn.tokens_per_min))} tok/min · ${d.sessions} sessions`:void 0}),(0,I.jsx)(R,{label:`Input`,value:f?C(d.tokens_in):`—`,sub:`fresh, full price`}),(0,I.jsx)(R,{label:`Output`,value:f?C(d.tokens_out):`—`,sub:f?`${d.turns} turns`:void 0}),(0,I.jsx)(R,{label:`Cache read`,value:f?C(d.cache_read):`—`,sub:f?(0,I.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,I.jsxs)(`span`,{children:[w(d.savings.hit_rate*100),` hit rate`]}),(()=>{let e=xn(d.savings.hit_rate*100);return e?(0,I.jsx)(`span`,{className:e.color||`text-fg-faint`,children:e.label}):null})()]}):void 0}),(0,I.jsx)(R,{label:`Cache write`,value:f?C(d.cache_write):`—`,sub:f?`${w(d.savings.cut_pct)} input cost cut by cache`:void 0})]}),(0,I.jsx)(kr,{u:d?.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.models.length===0&&(0,I.jsx)(Et,{title:`No priced turns in range`}):(0,I.jsx)(Dt,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,title:e.model||void 0,children:e.model?ne(e.model):`unknown`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:[e.turns,` turns`]}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:(d?.unpriced?.models??[]).includes(e.model)?(0,I.jsx)(`span`,{className:`text-warn`,title:`this model is not in the pricing table, so its cost is unknown`,children:`unpriced`}):S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0&&!(d.unpriced?.models??[]).includes(e.model)?w(100*e.cost_usd/d.cost_usd):`—`})]},e.model))})})]}),(0,I.jsx)(jt,{summary:d}),(0,I.jsxs)(L,{title:`Per project`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[d?d.projects.length===0&&(0,I.jsx)(Et,{title:`No priced turns in range`}):(0,I.jsx)(Dt,{rows:4}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(d?.projects??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-faint w-14`,children:d&&d.cost_usd>0?w(100*e.cost_usd/d.cost_usd):`—`})]},e.project))})})]})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-3`,children:[(0,I.jsxs)(L,{className:`lg:col-span-2`,title:`Last 30 days`,right:(0,I.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(wg,{bars:p,active:o,total:p.reduce((e,t)=>e+t.cost,0)}),(0,I.jsx)(`span`,{className:`flex items-center gap-1`,children:[`calendar`,`bars`].map(e=>(0,I.jsx)(`button`,{onClick:()=>u(e),className:`px-1.5 py-0.5 rounded-sm text-[11px] ${c===e?`bg-panel-2 text-fg`:`text-fg-faint hover:text-fg`}`,children:e},e))})]}),children:[i.data?p.length===0&&(0,I.jsx)(Et,{title:`No history yet`}):(0,I.jsx)(Dt,{rows:2}),p.length>0&&(c===`calendar`?(0,I.jsx)(Og,{bars:p,active:o,onActive:s}):(0,I.jsx)(Cg,{bars:p,active:o,onActive:s}))]}),(0,I.jsx)(jg,{feature:`cap`,title:`Stop the day at a number you choose`,children:(0,I.jsx)(Mg,{suggestion:m})}),(0,I.jsx)(jg,{feature:`gemini`,title:`Ask a second model, on your own key`,children:(0,I.jsx)(Pg,{})}),d&&(0,I.jsxs)(L,{title:`Plan limits`,children:[d.rate_limits?(0,I.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 pt-1`,children:[d.rate_limits.five_hour&&(0,I.jsx)(wn,{label:`5-hour window`,w:d.rate_limits.five_hour,now:n}),d.rate_limits.seven_day&&(0,I.jsx)(wn,{label:`7-day window`,w:d.rate_limits.seven_day,now:n})]}):(0,I.jsxs)(`div`,{className:`px-3 pt-1 text-sm text-fg-muted`,children:[`No window state yet. Caprock reads this from Claude Code's status line, so it appears once a Pro or Max session has run with `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:`caprock statusline`}),` registered —`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock up`}),` offers to do that. API-billed usage has no windows to report.`]}),(0,I.jsx)(`div`,{className:`mt-2 px-3 pb-3 text-[11px] text-fg-faint leading-relaxed`,children:`Live from Claude Code's status line (Pro/Max). The percentage is your usage of the window; a forecast is shown only when your measured pace would reach the limit before the window resets.`})]})]}),(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[d&&d.throttles>0?`${d.throttles} rate-limit / overloaded event${d.throttles===1?``:`s`} observed in this range (from Claude Code's StopFailure hook).`:`No rate-limit events observed in this range.`,` `,`Everything here is measured — no invented numbers.`]})]})}function Ig(e){let t=new Map;for(let n of e){let e=t.get(n.day)??{day:n.day,cost:0,tokens:0,sessions:0};e.cost+=n.cost_usd,e.tokens+=n.tokens_total,e.sessions+=n.sessions,t.set(n.day,e)}return[...t.values()].sort((e,t)=>e.day.localeCompare(t.day))}function Lg(e,t){switch(e){case`today`:return 1;case`7d`:return 7;case`30d`:return 30;default:return t?Math.max(1,Math.ceil((Date.now()-t)/864e5)):30}}function Rg(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length<3)return 0;let n=t[Math.floor(t.length/2)]*2,r=n<10?1:n<100?5:10;return Math.round(n/r)*r}function zg({plan:e,save:t}){let[n,r]=(0,l.useState)(e.license_key??``),i=F(()=>P.premium(),[e.license_key]).data?.license;(0,l.useEffect)(()=>{r(e.license_key??``)},[e.license_key]);let a=n.trim()!==(e.license_key??``).trim();return(0,I.jsxs)(`div`,{className:`border-t border-border pt-2`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`w-28 shrink-0 text-fg-muted`,children:`Licence`}),(0,I.jsx)(`input`,{className:`input flex-1 min-w-0`,placeholder:`CR-…`,spellCheck:!1,value:n,onChange:e=>r(e.target.value),onKeyDown:r=>{r.key===`Enter`&&a&&t({...e,license_key:n.trim()})}}),(0,I.jsx)(`button`,{disabled:!a,onClick:()=>t({...e,license_key:n.trim()}),className:`rounded-sm border border-border px-2 py-0.5 text-fg-muted hover:border-border-strong hover:text-fg disabled:opacity-40`,children:`save`})]}),(0,I.jsxs)(`p`,{className:`mt-1.5 pl-[7.5rem] text-[11px] leading-relaxed`,children:[i?.active&&!i.in_grace&&(0,I.jsxs)(`span`,{className:`text-ok`,children:[`Premium is on`,i.expires_at?` — renews ${i.expires_at.slice(0,10)}`:``,`.`]}),i?.active&&i.in_grace&&(0,I.jsxs)(`span`,{className:`text-warn`,children:[i.reason,`. Update your key or payment method.`]}),i&&!i.active&&(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[e.license_key?i.reason:`No key — the free product is unaffected.`,` `,(0,I.jsx)(`a`,{href:`https://caprock.dev/premium/`,target:`_blank`,rel:`noreferrer`,className:`link`,children:`what Premium does`})]}),(0,I.jsx)(`span`,{className:`block text-fg-faint`,children:`Checked on this machine against the date inside the key. Caprock makes no call to us to verify it.`})]})]})}function Bg(){let e=F(()=>P.status(),[],{live:!1,intervalMs:5e3}),t=e.data;if(e.error&&!t)return(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:e.error.message});if(!t)return(0,I.jsx)(`div`,{className:`text-fg-muted`,children:`loading…`});let n=[[`version`,t.version],[`url`,t.url],[`pid`,String(t.pid)],[`uptime`,ee(t.uptime_s*1e3)],[`data dir`,t.data_dir],[`pricing`,`${t.pricing.version} · ${t.pricing.models} models · fetched ${t.pricing.fetched_at}${t.pricing.user_override?` · user override`:``}`],[`pricing source`,t.pricing.source],[`loop rule`,`≥ ${t.loop_k} same-tool calls in ${t.loop_t_minutes} min · ${t.active_loops} active`],[`events stored`,`${t.events.toLocaleString()}${t.retention_days>0?` · pruned after ${t.retention_days}d`:` · kept forever (set retention_days to cap DB growth)`}`],[`orchestration`,t.orchestration?`on (--hive)`:`off`],[`claude`,t.claude_available?`found on PATH — Caprock can start sessions for you`:`not found on PATH — Caprock cannot start sessions, but still observes every session you start yourself`],[`dashboard`,t.ui_built?`embedded build`:`dev server / placeholder`]];if(t.hooks&&n.push([`hooks`,`${(t.hooks.installed??[]).length}/${(t.hooks.installed??[]).length+(t.hooks.missing??[]).length} events registered in ${t.hooks.settings_path}${t.hooks.shim_exists?``:` (shim missing)`}`]),t.desktop){let e=t.desktop;n.push([`claude desktop`,`${e.five_hour_pct}% of the 5-hour window · ${e.seven_day_pct}% of the 7-day${e.stale?` · last seen `+new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})+`, app closed since`:` · now`}`])}return t.ingest_error&&n.push([`ingest error`,`STOPPED: ${t.ingest_error} — nothing is being captured`]),t.ingest&&n.push([`ingest`,`${t.ingest.files_known} transcripts · ${t.ingest.events_stored} events stored · ${t.ingest.events_deduped} deduped · ${t.ingest.lines_malformed} malformed lines · backfill ${t.ingest.backfill_done?`done`:`running`}`]),(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-3xl`,children:[(0,I.jsx)(Vg,{}),(0,I.jsx)(L,{title:`Daemon`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:n.map(([e,t])=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:e}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:t})]},e))})})}),t.ingest_error&&(0,I.jsx)(L,{title:`Ingest stopped`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`No new sessions are being captured: `,(0,I.jsx)(`span`,{className:`mono text-fg`,children:t.ingest_error}),`. Check that`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` ~/.claude`}),` is readable, then restart with`,(0,I.jsx)(`span`,{className:`mono text-fg`,children:` caprock down && caprock up`}),`.`]})}),!t.claude_available&&(0,I.jsx)(L,{title:`claude not found`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`The `,(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` binary was not found on this machine, so Caprock cannot spawn sessions. It still observes every session you start yourself. Install Claude Code, or make sure`,(0,I.jsx)(`span`,{className:`mono`,children:` claude`}),` is on the PATH the daemon was started with.`]})}),t.hooks&&(t.hooks.missing??[]).length>0&&(0,I.jsx)(L,{title:`Hooks not fully installed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-muted`,children:[`Missing: `,(0,I.jsx)(`span`,{className:`mono`,children:(t.hooks.missing??[]).join(`, `)}),`. Run `,(0,I.jsx)(`span`,{className:`mono`,children:`caprock hooks install`}),` for real-time activity; transcript tailing keeps working with a few seconds of delay.`]})})]})}function Vg(){let[e,t]=De();return e?(0,I.jsx)(L,{title:`Settings`,children:(0,I.jsxs)(`div`,{className:`grid gap-2 px-3 py-2.5 text-[12px]`,children:[(0,I.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,I.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--color-accent)] mt-0.5`,checked:e.update_checks,onChange:n=>t({...e,update_checks:n.target.checked})}),(0,I.jsxs)(`span`,{children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Check GitHub for new releases`}),(0,I.jsx)(`span`,{className:`block text-[11px] text-fg-muted`,children:`The only outbound call Caprock makes. No usage data is sent, and it is checked at most once a day.`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-baseline gap-2 border-t border-border pt-2`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted w-28 shrink-0`,children:`Your plan`}),(0,I.jsx)(`span`,{className:`mono text-fg`,children:e.plan_kind===`metered`?`${e.plan_label||`API`} · billed per token`:e.plan_kind===`flat`?`${e.plan_label||`plan`} · ${S(e.plan_usd_per_month)}/mo`:`not set`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint ml-auto`,children:`change it in the header`})]}),(0,I.jsx)(zg,{plan:e,save:t})]})}):null}function Hg(){let e=F(()=>P.settings(),[],{live:!1}),t=re(3e4),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(``),h=e.data;(0,l.useEffect)(()=>{o||h===void 0||(a(h.report_chat_id??``),s(!0))},[h,o]);let g=async()=>{u(!0),m(``);try{await P.saveSettings({report_chat_id:i.trim(),...n.trim()?{report_bot_token:n.trim()}:{}}),r(``),f(!0),e.refresh?.()}catch(e){m(ae(e))}finally{u(!1)}},_=!!h?.report_bot_set&&!!h?.report_chat_id,[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1);async function S(){y(!0),x(!1),m(``);try{await P.testReport(),x(!0),window.setTimeout(()=>x(!1),6e3)}catch(e){m(e instanceof Error?e.message:String(e))}finally{y(!1)}}return(0,I.jsx)(L,{title:`Weekly report`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:_?`Mondays, or the next day you open the lid`:`not set up`}),children:(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-3 text-[12px]`,children:[(0,I.jsx)(`p`,{className:`m-0 text-fg-muted`,children:`What moved this week, against your usual — sent to a Telegram bot you own. Nothing passes our server, and the message carries figures only: no prompts, no replies, no file names.`}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-fg-muted`,children:[`Bot token`,h?.report_bot_set&&(0,I.jsx)(`span`,{className:`text-ok`,children:` · one is stored`})]}),(0,I.jsx)(`input`,{className:`input`,type:`password`,placeholder:h?.report_bot_set?`leave blank to keep the current one`:`123456:ABC-DEF…`,value:n,onChange:e=>r(e.target.value)}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Message `,(0,I.jsx)(`span`,{className:`mono`,children:`@BotFather`}),` on Telegram, send`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`/newbot`}),`, and paste what it gives you. Caprock stores it on this machine and never sends it back to this page.`]}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`It is your own bot, not one of ours, and that is deliberate: the message goes straight from this machine to Telegram, so your figures never pass through anybody's server. A shared bot would mean shipping its token inside a public binary, and routing what you spend through us to deliver it.`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-fg-muted`,children:`Chat id`}),(0,I.jsx)(`input`,{className:`input`,placeholder:`123456789`,value:i,onChange:e=>a(e.target.value)}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[(0,I.jsx)(`strong`,{children:`Write to your bot first`}),` — find it by its username, press Start, send anything. Telegram does not let a bot message you until you have. Then open`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`api.telegram.org/bot/getUpdates`}),` and copy`,` `,(0,I.jsx)(`span`,{className:`mono`,children:`chat.id`}),`. For a channel instead, add the bot as an administrator; its id starts with a minus.`]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,I.jsx)(`button`,{onClick:()=>void g(),disabled:c||!i.trim(),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`saving…`:`Save`}),(0,I.jsx)(`button`,{onClick:()=>void S(),disabled:v||!_,title:_?`Send this week's report now`:`Save a bot token and chat id first`,className:`border border-border px-3 py-1 rounded-sm hover:border-fg-faint disabled:opacity-50`,children:v?`sending…`:`Send one now`}),b&&(0,I.jsx)(`span`,{className:`text-[11px] text-ok`,children:`sent — check Telegram`}),d&&!p&&(0,I.jsx)(`span`,{className:`text-[11px] text-ok`,children:`saved`}),p&&(0,I.jsx)(`span`,{className:`text-[11px] text-danger`,children:p})]}),h?.report_last_error?(0,I.jsxs)(`p`,{className:`m-0 text-[11px] text-danger`,children:[`Last send failed: `,h.report_last_error]}):h?.report_last_sent_ms?(0,I.jsxs)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:[`Last sent `,T(h.report_last_sent_ms,t),` ago.`]}):_?(0,I.jsx)(`p`,{className:`m-0 text-[11px] text-fg-faint`,children:`Nothing sent yet — the first one goes out at the start of next week.`}):null]})})}function Ug(){let[e,t]=(0,l.useState)(`all`),[n,r]=(0,l.useState)(null),i=F(()=>P.history(e),[e],{intervalMs:15e3}),[a]=De(),o=i.data,s=!!o&&o.totals.turns>0,c=Ig(o?.daily??[]),u=Math.max(...(o?.tools??[]).map(e=>e.count),1);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[[`today`,`7d`,`30d`,`all`].map(n=>(0,I.jsx)(`button`,{onClick:()=>t(n),className:`px-2 py-1 text-[12px] rounded-sm ${e===n?`bg-panel-2 text-fg`:`text-fg-muted hover:text-fg`}`,children:n},n)),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Everything you ever ran through Caprock. Measured, not estimated.`})]}),s&&o&&(0,I.jsx)(Nn,{costUSD:o.totals.cost_usd,days:o.totals.days,now:Date.now()}),i.error&&!o&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:i.error.message}),(0,I.jsxs)(L,{title:`Lifetime · ${e}`,children:[(0,I.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-7 divide-x divide-border`,children:[(0,I.jsx)(R,{size:`compact`,label:`Sessions`,value:s?o.totals.sessions:`—`,sub:s?`${o.totals.owned_sessions} spawned by caprock`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Active days`,value:s?o.totals.days:`—`}),(0,I.jsx)(R,{size:`compact`,label:`Turns`,value:s?C(o.totals.turns):`—`,sub:s?`${C(o.totals.tool_calls)} tool calls`:void 0}),(0,I.jsx)(R,{size:`compact`,label:`Files touched`,value:s?C(o.totals.files_touched):`—`,sub:`summed per session`}),(0,I.jsx)(R,{size:`compact`,label:`Avg session span`,value:s?ee(Math.round(o.totals.avg_session_sec*1e3)):`—`,sub:`first to last event`}),(0,I.jsx)(Sn,{hitRate:o?.savings.hit_rate,cutPct:o?.savings.cut_pct,measured:s}),(0,I.jsx)(R,{label:`Cost`,value:s?S(o.totals.cost_usd):`—`,sub:(0,I.jsx)(`span`,{title:_n(a),children:s?gn(a):`nothing measured yet`}),tone:`info`,size:`hero`})]}),(0,I.jsx)(kr,{u:o?.totals.unpriced,className:`mx-3 mb-2.5`})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,I.jsxs)(L,{title:`Tool usage`,right:(0,I.jsx)(`span`,{children:`by calls`}),children:[o?o.tools.length===0&&(0,I.jsx)(Et,{title:`No tool calls yet`}):(0,I.jsx)(Dt,{rows:5}),(0,I.jsx)(`ul`,{className:`py-1`,children:(o?.tools??[]).slice(0,18).map(e=>(0,I.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-[3px]`,children:[(0,I.jsx)(`span`,{className:`mono text-[12px] w-44 shrink-0 truncate`,title:e.tool,children:D(e.tool)}),(0,I.jsx)(`div`,{className:`flex-1 h-2 bg-panel-2 rounded-sm overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-accent/70`,style:{width:`${100*e.count/u}%`}})}),(0,I.jsx)(`span`,{className:`num text-[11px] text-fg-muted w-12 text-right`,children:C(e.count)})]},e.tool))})]}),(0,I.jsxs)(`div`,{className:`grid gap-3 content-start`,children:[(0,I.jsxs)(L,{title:`Model mix`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:[o?o.summary.models.length===0&&(0,I.jsx)(Et,{title:`No priced turns`}):(0,I.jsx)(Dt,{rows:3}),(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.models??[]).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 mono`,children:e.model||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.model))})})]}),(0,I.jsx)(jg,{feature:`report`,title:`Get this every Monday, without opening the dashboard`,children:(0,I.jsx)(Hg,{})}),(0,I.jsx)(L,{title:`Top projects`,right:(0,I.jsx)(`span`,{children:`by cost`}),children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsx)(`tbody`,{children:(o?.summary.projects??[]).slice(0,8).map(e=>(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1`,children:e.project||`unknown`}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right text-fg-muted`,children:C(e.tokens)}),(0,I.jsx)(`td`,{className:`px-3 py-1 num text-right`,children:S(e.cost_usd)})]},e.project))})})})]})]}),(0,I.jsxs)(L,{title:`Daily cost`,right:(0,I.jsx)(wg,{bars:c,active:n,total:c.reduce((e,t)=>e+t.cost,0)}),children:[i.data?c.length===0&&(0,I.jsx)(Et,{title:`No history yet`}):(0,I.jsx)(Dt,{rows:2}),c.length>0&&(0,I.jsx)(Cg,{bars:c,active:n,onActive:r,height:96,showDayLabels:!1})]})]})}var Wg=[{key:`inbox`,label:`Inbox`},{key:`assigned`,label:`Assigned`},{key:`in_progress`,label:`In progress`},{key:`verifying`,label:`Verifying`},{key:`needs_you`,label:`Needs you`},{key:`done`,label:`Done`}];function Gg(){let e=F(()=>P.status(),[],{live:!1,intervalMs:3e4}),t=F(()=>P.tasks(),[],{intervalMs:4e3}),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);if(e.data&&e.data.orchestration===!1)return(0,I.jsx)(Kg,{status:e.data,onEnabled:()=>{e.refresh(),t.refresh()}});let o=e=>(t.data??[]).filter(t=>t.status===e||e===`done`&&t.status===`failed`);return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm text-[12px] hover:bg-accent/20`,children:`+ New task`}),(0,I.jsx)(Yg,{available:e.data?.claude_available??!1}),(t.data??[]).some(e=>e.assignee!==``&&e.status!==`done`&&e.status!==`failed`)&&(0,I.jsx)(`a`,{href:`#/graph`,className:`link text-[12px] border border-border px-2 py-1 rounded-sm hover:border-border-strong`,children:`view graph`}),(0,I.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:[`Tasks are files on disk (`,(0,I.jsx)(`span`,{className:`mono`,children:`tasks/.md`}),`); the orchestrator moves them. Nothing reaches Done until its `,(0,I.jsx)(`span`,{className:`mono`,children:`done_criteria`}),` pass.`]})]}),t.error&&!t.data&&(0,I.jsx)(Et,{title:`Cannot reach the daemon`,children:t.error.message}),t.data&&t.data.length===0&&(0,I.jsxs)(`div`,{className:`border border-border bg-panel-2/60 rounded-sm px-3 py-2 text-[12px] text-fg-muted`,children:[`Start here: `,(0,I.jsx)(`span`,{className:`text-fg`,children:`+ New task`}),` — a title and the commands that have to pass. Then `,(0,I.jsx)(`span`,{className:`text-fg`,children:`▶ Start orchestrator`}),`, which assigns it to a worker and keeps going until the checks are green.`]}),(0,I.jsx)(`div`,{className:`grid gap-2 grid-cols-2 md:grid-cols-3 xl:grid-cols-6`,children:Wg.map(e=>(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsxs)(`div`,{className:`text-[11px] uppercase tracking-[0.08em] text-fg-faint mb-1.5 px-0.5 flex justify-between`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`span`,{className:`num`,children:o(e.key).length})]}),(0,I.jsx)(`div`,{className:`grid gap-1.5 content-start min-h-[60px]`,children:o(e.key).map(e=>(0,I.jsx)(Xg,{t:e,onApprove:()=>t.refresh(),onOpen:()=>a(e.id)},e.id))})]},e.key))}),n&&(0,I.jsx)(t_,{onClose:()=>{r(!1),t.refresh()}}),i&&(0,I.jsx)(Zg,{id:i,onClose:()=>{a(null),t.refresh()}})]})}function Kg({status:e,onEnabled:t}){let[n,r]=(0,l.useState)(!1),i=e.suggested_hive??`~/caprock-tasks`,a=e.suggested_repo??``;return(0,I.jsxs)(`div`,{className:`grid gap-3 max-w-[52rem] mx-auto`,children:[(0,I.jsxs)(L,{title:`Task runner`,right:(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`off`}),children:[(0,I.jsxs)(`div`,{className:`grid gap-3 px-3 py-3`,children:[(0,I.jsxs)(`ol`,{className:`grid gap-2 md:grid-cols-3`,children:[(0,I.jsx)(qg,{n:1,title:`You write a task`,children:`A title, a budget, and the commands that have to pass.`}),(0,I.jsxs)(qg,{n:2,title:`Caprock runs it`,children:[`One Claude session per task, in its `,(0,I.jsx)(`span`,{className:`text-fg`,children:`own git worktree`}),` — your working tree is untouched.`]}),(0,I.jsxs)(qg,{n:3,title:`Caprock checks it`,children:[(0,I.jsx)(`span`,{className:`text-fg`,children:`Caprock`}),` runs your commands, not the agent. Only green is done.`]})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Best for independent tasks — nothing here merges branches. The queue directory is created for you; your repository is not modified.`})]}),(0,I.jsxs)(`footer`,{className:`px-3 py-2 border-t border-border flex items-center gap-2`,children:[(0,I.jsx)(`button`,{onClick:()=>r(!0),className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm text-[12px] hover:bg-accent/25`,children:`Turn on the task runner`}),(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`No restart. Nothing runs until you start it.`})]})]}),n&&(0,I.jsx)(Jg,{hive:i,repo:a,onClose:()=>r(!1),onDone:t})]})}function qg({n:e,title:t,children:n}){return(0,I.jsxs)(`li`,{className:`border border-border bg-panel-2/60 rounded-sm px-2.5 py-2 grid gap-1 content-start`,children:[(0,I.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,I.jsx)(`span`,{className:`num text-[11px] text-accent`,children:e}),(0,I.jsx)(`span`,{className:`text-[12px] font-medium`,children:t})]}),(0,I.jsx)(`div`,{className:`text-[11px] text-fg-muted leading-[1.45]`,children:n})]})}function Jg({hive:e,repo:t,onClose:n,onDone:r}){let[i,a]=(0,l.useState)(e),[o,s]=(0,l.useState)(t),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:n,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Turn on the task runner`}),(0,I.jsx)(`button`,{onClick:n,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`ul`,{className:`grid gap-1 text-[12px] text-fg-muted`,children:[(0,I.jsx)(`li`,{children:`· Creates the queue directory below, with a README and an example task.`}),(0,I.jsxs)(`li`,{children:[`· Lets Caprock spawn Claude sessions `,(0,I.jsx)(`span`,{className:`text-fg`,children:`with permission prompts skipped`}),`, one git worktree each under the repo below.`]}),(0,I.jsx)(`li`,{children:`· Starts nothing yet — you start the orchestrator, and only then does work begin.`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Queue directory`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · created if missing`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:i,onChange:e=>a(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`Repository`,(0,I.jsx)(`span`,{className:`text-fg-faint`,children:` · workers branch from here`})]}),(0,I.jsx)(`input`,{className:`input mono`,value:o,onChange:e=>s(e.target.value)})]}),d&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:d})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:n,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{u(!0),f(``);try{await P.enableHive(i.trim(),o.trim()),n(),r()}catch(e){f(ae(e))}finally{u(!1)}},disabled:c,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:c?`turning on…`:`Turn it on`})]})]})})}function Yg({available:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(``);return(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(`button`,{disabled:t||!e,onClick:async()=>{n(!0),i(``);try{let e=await P.startOrchestrator();i(`orchestrator: `+e.session_id.slice(0,8))}catch(e){i(ae(e))}finally{n(!1)}},title:e?`spawn the orchestrator session`:`claude not found — cannot spawn`,className:`border border-border text-fg-muted px-2 py-1 rounded-sm text-[12px] hover:text-fg disabled:opacity-50`,children:t?`starting…`:`▶ Start orchestrator`}),!e&&(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[(0,I.jsx)(`span`,{className:`mono`,children:`claude`}),` was not found on this machine, so Caprock cannot spawn the orchestrator. It still observes every session you start yourself.`]}),r&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint mono`,children:r})]})}function Xg({t:e,onApprove:t,onOpen:n}){let r=e.budget_usd>0&&e.cost_usd>e.budget_usd,i=e.assignee!==``;return(0,I.jsxs)(`div`,{className:`border border-border bg-panel rounded-[var(--radius-panel)] px-2 py-1.5`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left disabled:cursor-default`,disabled:!i,onClick:n,title:i?`show the diff, the checks that ran, and where the branch is`:`nothing to show yet — no worker has picked this up`,children:[(0,I.jsx)(`div`,{className:`text-[12px] font-medium truncate ${i?`hover:text-accent`:``}`,title:e.title,children:e.title||e.id}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[10px] text-fg-faint`,children:[(0,I.jsx)(`span`,{className:`mono`,children:E(e.id)}),e.assignee&&(0,I.jsxs)(`span`,{className:`mono text-fg-muted`,children:[`→ `,e.assignee]}),(0,I.jsxs)(`span`,{className:`num ml-auto ${r?`text-danger`:`text-fg-muted`}`,children:[S(e.cost_usd),e.budget_usd>0?` / ${S(e.budget_usd)}`:``]})]})]}),i&&(0,I.jsxs)(`div`,{className:`mt-1 text-[10px] text-fg-faint mono truncate`,children:[`caprock/`,e.assignee]}),e.status===`needs_you`&&(0,I.jsxs)(`div`,{className:`flex gap-1 mt-1.5`,children:[(0,I.jsx)(`button`,{onClick:()=>P.approve(e.id,!0).then(t),className:`flex-1 text-[11px] border border-ok/40 text-ok rounded-sm hover:bg-ok/10`,children:`approve`}),(0,I.jsx)(`button`,{onClick:()=>P.approve(e.id,!1).then(t),className:`flex-1 text-[11px] border border-danger/40 text-danger rounded-sm hover:bg-danger/10`,children:`reject`})]})]})}function Zg({id:e,onClose:t}){let n=F(()=>P.task(e),[e],{intervalMs:6e3}),r=n.data,i=r?.work,a=i?.sessions?.[0];return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-16`,onClick:t,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[820px] max-w-[94vw] max-h-[82vh] overflow-auto`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center gap-2 sticky top-0 bg-panel z-10`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`Task`}),r&&(0,I.jsx)(`span`,{className:`text-[12px] truncate`,children:r.task.title||r.task.id}),r&&(0,I.jsx)(`span`,{className:`mono text-[10px] text-fg-faint`,children:r.task.status}),(0,I.jsx)(`button`,{onClick:t,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),!r&&!n.error&&(0,I.jsx)(Dt,{rows:5}),n.error&&!r&&(0,I.jsx)(Et,{title:`Cannot load the task`,children:n.error.message}),r&&(0,I.jsxs)(`div`,{className:`px-3 py-3 grid gap-3`,children:[(0,I.jsx)(Qg,{work:i,assignee:r.task.assignee}),(0,I.jsx)($g,{criteria:r.done_criteria,runs:i?.verifications,status:r.task.status}),(0,I.jsx)(e_,{sessionID:a?.session_id,assignee:r.task.assignee}),r.body&&(0,I.jsx)(L,{title:`Brief`,children:(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.45] px-3 py-2 whitespace-pre-wrap`,children:r.body})})]})]})})}function Qg({work:e,assignee:t}){return e?.branch?(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`table`,{className:`w-full text-[12px]`,children:(0,I.jsxs)(`tbody`,{children:[(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`branch`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.branch})]}),e.worktree&&(0,I.jsxs)(`tr`,{className:`border-b border-border/60`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32`,children:`worktree`}),(0,I.jsx)(`td`,{className:`px-3 py-1 mono break-all`,children:e.worktree})]}),(0,I.jsxs)(`tr`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsx)(`td`,{className:`px-3 py-1 text-fg-muted w-32 align-top`,children:`take it`}),(0,I.jsxs)(`td`,{className:`px-3 py-1 grid gap-1 justify-items-start`,children:[(0,I.jsx)(Ot,{command:`git merge --no-ff ${e.branch}`}),(0,I.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[`Run it from `,e.repo?(0,I.jsx)(`span`,{className:`mono`,children:e.repo}):`your repo`,`, on the branch you want the work on. Prefer `,(0,I.jsx)(`span`,{className:`mono`,children:`git cherry-pick`}),` if you only want some of it. Worker`,` `,(0,I.jsx)(`span`,{className:`mono`,children:t}),` may still be running — check the diff below first.`]})]})]})]})})}):(0,I.jsx)(L,{title:`Where the work is`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:`No worker has been assigned yet, so there is no branch. One is created the moment the orchestrator assigns this task.`})})}function $g({criteria:e,runs:t,status:n}){let r=t?.[0],i=r?t.filter(e=>e.round===r.round):[],a=r?`round ${r.round}`:void 0;return(0,I.jsxs)(L,{title:`What has to pass`,right:a,children:[i.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 grid gap-1`,children:[(0,I.jsx)(`div`,{className:`text-[12px] text-fg-faint`,children:n===`done`?`This task was marked done without a recorded check.`:`Not run yet. Caprock runs these itself, in the worker’s worktree, when the worker reports it has finished.`}),(0,I.jsx)(`ul`,{className:`grid gap-0.5`,children:(e??[]).map(e=>(0,I.jsxs)(`li`,{className:`mono text-[11px] text-fg-muted`,children:[`$ `,e]},e))}),(e??[]).length===0&&(0,I.jsx)(`div`,{className:`mono text-[11px] text-danger`,children:`no done_criteria — Caprock cannot verify this task`})]}),i.length>0&&(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0 px-3 py-1.5 flex items-center gap-3`,children:[(0,I.jsx)(`span`,{className:`text-[10px] w-14 shrink-0 mono ${e.exit_code===0?`text-ok`:`text-danger`}`,children:e.exit_code===0?`passed`:`exit ${e.exit_code}`}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,title:e.command,children:e.command})]},e.command))})]})}function e_({sessionID:e,assignee:t}){let n=F(()=>e?P.diff(e):Promise.resolve(void 0),[e],{intervalMs:8e3}),[r,i]=(0,l.useState)(null);if(!e)return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`No session has been attributed to this task yet`,t?` (worker ${t})`:``,`, so there is nothing to diff.`]})});if(n.error&&!n.data){let e=n.error;if(e instanceof M&&e.status===409){let t=e.body;return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[t?.error,t?.cwd?(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(`span`,{className:`mono`,children:t.cwd})]}):null]})})}return(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:e.message})})}let a=n.data;return a?(0,I.jsxs)(L,{title:`What changed`,right:(0,I.jsxs)(`span`,{className:`num`,children:[a.files.length,` files`]}),children:[a.files.length===0&&(0,I.jsxs)(`div`,{className:`px-3 py-2 text-[12px] text-fg-faint`,children:[`Nothing uncommitted in `,(0,I.jsx)(`span`,{className:`mono`,children:a.branch||`the worktree`}),`. If the worker committed its work, the branch above holds it.`]}),(0,I.jsx)(`ul`,{children:a.files.map(e=>(0,I.jsxs)(`li`,{className:`border-b border-border/60 last:border-0`,children:[(0,I.jsxs)(`button`,{className:`w-full text-left px-3 py-1.5 flex items-center gap-3 hover:bg-panel-2`,onClick:()=>i(r===e.path?null:e.path),children:[(0,I.jsx)(`span`,{className:`mono text-[10px] w-16 shrink-0 ${e.status===`added`||e.status===`untracked`?`text-ok`:e.status===`deleted`?`text-danger`:`text-fg-muted`}`,children:e.status}),(0,I.jsx)(`span`,{className:`mono text-[12px] truncate`,children:e.path}),(0,I.jsxs)(`span`,{className:`ml-auto num text-[11px] shrink-0`,children:[(0,I.jsxs)(`span`,{className:`text-ok`,children:[`+`,e.additions]}),` `,(0,I.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),r===e.path&&e.patch&&(0,I.jsx)(`pre`,{className:`mono text-[11px] leading-[1.35] px-3 pb-2 overflow-auto max-h-[40vh]`,children:e.patch.split(` +`).map((e,t)=>{let n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`text-ok`:e.startsWith(`-`)&&!e.startsWith(`---`)?`text-danger`:e.startsWith(`@@`)?`text-info`:`text-fg-muted`;return(0,I.jsx)(`div`,{className:n,children:e||` `},t)})}),r===e.path&&!e.patch&&(0,I.jsx)(`div`,{className:`px-3 pb-2 text-[11px] text-fg-faint`,children:e.binary?`binary file`:`no patch`})]},e.path))})]}):(0,I.jsx)(L,{title:`What changed`,children:(0,I.jsx)(Dt,{rows:3})})}function t_({onClose:e}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`3`),[a,o]=(0,l.useState)(`go test ./... go vet ./...`),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),m=a.split(` -`).map(e=>e.trim()).filter(Boolean);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:e,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New task`}),(0,I.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Title`}),(0,I.jsx)(`input`,{autoFocus:!0,className:`input`,value:t,onChange:e=>n(e.target.value),placeholder:`Add /healthz endpoint`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Budget (USD)`}),(0,I.jsx)(`input`,{className:`input`,value:r,onChange:e=>i(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Done criteria · one command per line`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:a,onChange:e=>o(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Description`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:s,onChange:e=>c(e.target.value)})]}),f&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:f})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:e,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{if(!t.trim()){p(`Title is required.`);return}if(m.length===0){p(`At least one done criterion is required — it is what decides when the task is done.`);return}d(!0),p(``);try{await P.createTask({title:t.trim(),budget_usd:parseFloat(r)||0,done_criteria:m,body:s}),e()}catch(e){p(ae(e))}finally{d(!1)}},disabled:u,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:u?`creating…`:`Create task`})]})]})})}var t_=72,n_=38,r_=.62;function i_(e){return{cx:e.width/2,cy:e.height/2,r:Math.max(80,Math.min(e.width,e.height)/2-t_-n_),nodeR:n_,gateT:r_}}function a_(e){return Math.max(e,6)}function o_(e,t){return-Math.PI/2+2*Math.PI*e/t}function s_(e,t,n){let r=a_(e.length),i=[];return e.forEach((e,a)=>{if(!t.has(e))return;let o=o_(a,r);i.push({id:e,angle:o,x:n.cx+n.r*Math.cos(o),y:n.cy+n.r*Math.sin(o)})}),i}function c_(e,t,n){return{x:t.cx+(e.x-t.cx)*n,y:t.cy+(e.y-t.cy)*n}}var l_={assigned:.18,in_progress:.45,verifying:r_,done:.85,needs_you:.5,failed:.5,inbox:.08};function u_(e){return l_[e]??.3}function d_(e){return e!==``&&e!==`orchestrator`&&e!==`verifier`}function f_(e,t){let n=e.registry.slice(),r=new Set(e.workers);d_(t.assignee)&&!n.includes(t.assignee)&&(n.push(t.assignee),n.sort()),d_(t.assignee)&&r.add(t.assignee);let i=new Map(e.tasks);return i.set(t.id,t),{registry:n,workers:r,tasks:i}}function p_(){return{registry:[],workers:new Set,tasks:new Map}}function m_(e,t=[]){let n={registry:t.slice(),workers:new Set,tasks:new Map};for(let t of e)n=f_(n,{id:t.id,title:t.title,assignee:t.assignee,status:t.status});return n}function h_(e){return{id:e.id,title:e.title,assignee:e.assignee,status:e.status}}function g_(){let e=F(()=>P.tasks(),[],{intervalMs:8e3}),t=(0,l.useRef)([]),[n,r]=(0,l.useState)(p_);return(0,l.useEffect)(()=>{if(!e.data)return;let n=m_(e.data,t.current);t.current=n.registry,r(n)},[e.data]),(0,l.useEffect)(()=>d.onFrame(e=>{e.type===`task`&&r(n=>{let r=f_(n,h_(e.data));return t.current=r.registry,r})}),[]),n}function __(e){return e.workers.size>0||e.tasks.size>0}function v_(e){let t=new Map;for(let n of e.tasks.values()){if(!d_(n.assignee))continue;let e=t.get(n.assignee)??[];e.push(n),t.set(n.assignee,e)}return t}var y_=260;function b_(e,t,n,r=y_){let i=e+(t-e)*(1-Math.exp(-n/r));return Math.abs(t-i)<.001?t:i}function x_(e){let t=0,n=performance.now(),r=i=>{let a=Math.min(i-n,64);n=i,e(a),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),{stop:()=>cancelAnimationFrame(t)}}var S_=class{cur=new Map;setTarget(e,t){this.cur.has(e)||this.cur.set(e,t),this.targets.set(e,t)}targets=new Map;step(e,t){let n=!1;for(let r of Array.from(this.cur.keys())){if(!t.has(r)){this.cur.delete(r),this.targets.delete(r);continue}let i=this.targets.get(r)??this.cur.get(r),a=b_(this.cur.get(r),i,e);a!==this.cur.get(r)&&(n=!0),this.cur.set(r,a)}return n}get(e){return this.cur.get(e)}};function C_(e){let t=(0,l.useRef)(new S_),[,n]=(0,l.useState)(0),r=new Set(e.tasks.keys());for(let n of e.tasks.values())t.current.setTarget(n.id,u_(n.status));return(0,l.useEffect)(()=>{let e=x_(e=>{t.current.step(e,r)&&n(e=>e+1)});return()=>e.stop()},[]),(e,n)=>t.current.get(e)??u_(n)}function w_(e){switch(e){case`done`:return`var(--color-ok)`;case`needs_you`:return`var(--color-warn)`;case`failed`:return`var(--color-danger)`;case`verifying`:case`in_progress`:case`assigned`:return`var(--color-accent)`;default:return`var(--color-fg-muted)`}}function T_(e){return e.some(e=>e.status!==`done`&&e.status!==`failed`)}function E_({model:e,viewport:t,centerLabel:n=`orchestrator`}){let r=i_(t),i=s_(e.registry,e.workers,r),a=v_(e),o=C_(e);return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`orchestration graph`,children:[i.map(e=>(0,I.jsx)(k_,{node:e,g:r,gateStatus:O_(a.get(e.id)??[])},`spoke-${e.id}`)),i.map(e=>(a.get(e.id)??[]).map((t,n)=>{let i=c_(e,r,o(t.id,t.status)),s=(n-(a.get(e.id).length-1)/2)*12,c=-(e.y-r.cy),l=e.x-r.cx,u=Math.hypot(c,l)||1;return(0,I.jsx)(D_,{task:t,cx:i.x+c/u*s,cy:i.y+l/u*s},`task-${t.id}`)})),i.map(e=>{let t=a.get(e.id)??[],n=T_(t),i=e.x>=r.cx?1:-1,o=i===1?`start`:`end`,s=i*(r.nodeR+10),c=t.find(e=>e.status!==`done`&&e.status!==`failed`)??t[0];return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:n?`graph-breathe`:void 0,r:r.nodeR,fill:`var(--color-panel)`,stroke:n?`var(--color-accent)`:`var(--color-border-strong)`,strokeWidth:n?2.5:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`13`,fill:`var(--color-fg)`,className:`mono`,children:M_(e.id)}),c&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`text`,{x:s,y:-4,textAnchor:o,fontSize:`12`,fill:`var(--color-fg)`,children:j_(c.title,26)}),(0,I.jsx)(`text`,{x:s,y:12,textAnchor:o,fontSize:`11`,fill:w_(c.status),className:`mono`,children:A_(c.status)})]})]},`node-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${r.cx},${r.cy})`,children:[(0,I.jsx)(`circle`,{r:r.nodeR+6,fill:`var(--color-panel-2)`,stroke:`var(--color-accent)`,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`12`,fill:`var(--color-fg)`,className:`mono`,children:n===`orchestrator`?`orch`:n})]})]})}function D_({task:e,cx:t,cy:n}){let r=(0,l.useRef)(e.status),[i,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(r.current!==`done`&&e.status===`done`){a(!0);let t=setTimeout(()=>a(!1),600);return r.current=e.status,()=>clearTimeout(t)}r.current=e.status},[e.status]),(0,I.jsx)(`circle`,{className:`graph-dot${i?` graph-verified`:``}`,cx:t,cy:n,r:8,fill:w_(e.status),children:(0,I.jsx)(`title`,{children:`${e.title} · ${e.status}`})})}function O_(e){return e.some(e=>e.status===`done`)?`done`:e.some(e=>e.status===`verifying`)?`verifying`:`idle`}function k_({node:e,g:t,gateStatus:n}){let r=c_(e,t,t.gateT),i=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-bg)`,a=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-border-strong)`;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`line`,{x1:t.cx,y1:t.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5}),(0,I.jsx)(`rect`,{className:`graph-gate`,x:r.x-7,y:r.y-7,width:14,height:14,transform:`rotate(45 ${r.x} ${r.y})`,fill:i,stroke:a,strokeWidth:1.5,children:(0,I.jsx)(`title`,{children:`verify gate — a task turns green only after its tests pass`})})]})}function A_(e){switch(e){case`assigned`:return`assigned`;case`in_progress`:return`working…`;case`verifying`:return`running tests…`;case`done`:return`✓ verified`;case`needs_you`:return`needs you`;case`failed`:return`failed`;default:return e}}function j_(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}function M_(e){let t=/^worker-(\d+)$/.exec(e);return t?`w${t[1]}`:e===`verifier`?`vfy`:e.slice(0,4)}function N_(e){switch(e){case`working`:return`var(--color-ok)`;case`waiting-on-you`:return`var(--color-warn)`;case`looping`:case`error`:return`var(--color-danger)`;case`ended`:return`var(--color-fg-faint)`;default:return`var(--color-fg-muted)`}}function P_({sessions:e,viewport:t}){let n=i_(t),r=e.map(e=>e.id).sort(),i=s_(r,new Set(r),n),a=new Map(e.map(e=>[e.id,e]));return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`session graph`,children:[i.map(e=>(0,I.jsx)(`line`,{x1:n.cx,y1:n.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5},`edge-${e.id}`)),i.map(e=>{let t=a.get(e.id),r=N_(t.health);return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:t.health===`working`?`graph-breathe`:void 0,r:n.nodeR,fill:`var(--color-panel)`,stroke:r,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`9`,fill:`var(--color-fg-muted)`,className:`mono`,children:t.label}),(0,I.jsx)(`title`,{children:`${t.label} · ${t.health}`})]},`sess-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${n.cx},${n.cy})`,children:[(0,I.jsx)(`circle`,{r:n.nodeR+4,fill:`var(--color-panel-2)`,stroke:`var(--color-border-strong)`,strokeWidth:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`10`,fill:`var(--color-fg-muted)`,className:`mono`,children:`caprock`})]})]})}function F_(){let e=g_(),t=F(()=>P.sessions(!0),[],{intervalMs:4e3}),n=(0,l.useRef)(null),[r,i]=(0,l.useState)({width:900,height:560});(0,l.useEffect)(()=>{if(!n.current)return;let e=n.current,t=new ResizeObserver(()=>{i({width:e.clientWidth,height:Math.max(420,e.clientHeight)})});return t.observe(e),i({width:e.clientWidth,height:Math.max(420,e.clientHeight)}),()=>t.disconnect()},[]);let a=__(e),o=(t.data??[]).filter(e=>e.status!==`ended`).map(e=>({id:e.session_id,label:E(e.session_id),health:e.activity.health})),s=Array.from(e.tasks.values()),c=s.filter(e=>e.status===`done`).length,u=s.filter(e=>[`assigned`,`in_progress`,`verifying`].includes(e.status)).length;return(0,I.jsxs)(`div`,{className:`grid gap-2`,children:[a&&(0,I.jsxs)(`div`,{className:`flex items-baseline gap-6 border border-border bg-panel rounded-[var(--radius-panel)] px-4 py-3`,children:[(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-ok`,children:c}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`verified — tests passed, not just claimed`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-accent`,children:u}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`in flight`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-fg`,children:e.workers.size}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`workers`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-faint px-0.5`,children:[(0,I.jsx)(I_,{orchestration:a}),(0,I.jsx)(`span`,{className:`ml-auto`,children:a?`live · the orchestrator assigns work; a task turns green only after its tests pass`:(0,I.jsxs)(I.Fragment,{children:[`your live sessions — start an orchestrator with `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`caprock up --hive `}),` to see the verified team`]})})]}),(0,I.jsx)(`div`,{ref:n,className:`relative w-full h-[70vh] rounded-[var(--radius-panel)] border border-border bg-panel/40 overflow-hidden`,children:a?(0,I.jsx)(E_,{model:e,viewport:r}):(0,I.jsx)(P_,{sessions:o,viewport:r})})]})}function I_({orchestration:e}){let t=(e,t)=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),t]});return(0,I.jsx)(`span`,{className:`inline-flex items-center gap-3`,children:e?(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-accent)`,`in flight`),t(`var(--color-ok)`,`verified`),t(`var(--color-warn)`,`needs you`),t(`var(--color-danger)`,`failed`)]}):(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-ok)`,`working`),t(`var(--color-warn)`,`waiting on you`),t(`var(--color-danger)`,`loop / error`),t(`var(--color-fg-muted)`,`idle`)]})})}var L_=200;function R_(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),i=re(3e4),[a,o]=(0,l.useState)(!1),s=F(()=>P.searchNotes(n,L_),[n],{live:!1,intervalMs:0}),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u([]),m(!1)},[n]);let h=[...s.data??[],...c];async function g(){let e=h[h.length-1];if(!(!e||d)){f(!0);try{let t=await P.searchNotes(n,L_,e.event_id);t.length===0?m(!0):u(e=>[...e,...t])}catch{m(!0)}finally{f(!1)}}}let _=a||n?h:h.filter(e=>!e.fragment),v=h.length-_.length;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e.trim())},children:[(0,I.jsx)(`input`,{className:`input max-w-[520px]`,value:e,onChange:e=>t(e.target.value),placeholder:`Search what Claude told you — a name, an error, a decision…`,"aria-label":`Search Claude's answers`}),(0,I.jsx)(`button`,{type:`submit`,className:`text-[12px] border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm hover:bg-accent/20`,children:`search`}),n&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>{t(``),r(``)},children:`clear`}),v>0&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>o(e=>!e),children:a?`hide short remarks`:`+${v} short remarks`}),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Claude's written answers, across every session. Local only.`})]}),s.error&&!s.data&&(0,I.jsx)(Et,{title:`Cannot search`,children:s.error.message}),!s.data&&!s.error&&(0,I.jsx)(Dt,{rows:5,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),s.data&&_.length===0&&(0,I.jsx)(Et,{title:n?`Nothing found for "${n}"`:`No answers captured yet`,children:n?`Try a shorter phrase — this matches the words Claude wrote, not what you asked.`:`Run a session and Claude’s written answers will be searchable here.`}),_.length>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint px-0.5`,children:[_.length,` `,_.length===1?`answer`:`answers`,n?` matching "${n}"`:` · most recent`,` · subagent chatter excluded`]}),(0,I.jsx)(`div`,{className:`grid gap-2`,children:_.map(e=>(0,I.jsx)(ei,{note:e,now:i,showSession:!0},e.event_id))}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-0.5`,children:[!p&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-1 rounded-sm`,onClick:()=>void g(),disabled:d,children:d?`loading…`:`load older answers`}),p&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`that is everything`})]})]})]})}function z_(){let e=_();return(0,I.jsx)(ht,{route:e,children:(0,I.jsxs)(xt,{label:e.name,children:[e.name===`now`&&(0,I.jsx)(qr,{}),e.name===`session`&&(0,I.jsx)(dg,{id:e.id,tab:e.tab,at:e.at},e.id),e.name===`cost`&&(0,I.jsx)(Pg,{}),e.name===`settings`&&(0,I.jsx)(zg,{}),e.name===`history`&&(0,I.jsx)(Hg,{}),e.name===`tasks`&&(0,I.jsx)(Wg,{}),e.name===`graph`&&(0,I.jsx)(F_,{}),e.name===`notes`&&(0,I.jsx)(R_,{})]})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,I.jsx)(l.StrictMode,{children:(0,I.jsx)(z_,{})})); \ No newline at end of file +`).map(e=>e.trim()).filter(Boolean);return(0,I.jsx)(`div`,{className:`fixed inset-0 z-20 bg-black/50 flex items-start justify-center pt-24`,onClick:e,children:(0,I.jsxs)(`div`,{className:`border border-border-strong bg-panel rounded-[var(--radius-panel)] w-[560px] max-w-[92vw]`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`header`,{className:`px-3 py-2 border-b border-border flex items-center`,children:[(0,I.jsx)(`h2`,{className:`text-[12px] uppercase tracking-[0.08em] text-fg-muted`,children:`New task`}),(0,I.jsx)(`button`,{onClick:e,className:`ml-auto text-fg-muted hover:text-fg`,children:`✕`})]}),(0,I.jsxs)(`div`,{className:`px-4 py-3 grid gap-3 text-[13px]`,children:[(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Title`}),(0,I.jsx)(`input`,{autoFocus:!0,className:`input`,value:t,onChange:e=>n(e.target.value),placeholder:`Add /healthz endpoint`})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Budget (USD)`}),(0,I.jsx)(`input`,{className:`input`,value:r,onChange:e=>i(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Done criteria · one command per line`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:a,onChange:e=>o(e.target.value)})]}),(0,I.jsxs)(`label`,{className:`grid gap-1`,children:[(0,I.jsx)(`span`,{className:`text-[11px] text-fg-muted`,children:`Description`}),(0,I.jsx)(`textarea`,{className:`input`,rows:3,value:s,onChange:e=>c(e.target.value)})]}),f&&(0,I.jsx)(`div`,{className:`text-danger text-[12px]`,children:f})]}),(0,I.jsxs)(`footer`,{className:`px-4 py-2 border-t border-border flex gap-2 justify-end`,children:[(0,I.jsx)(`button`,{onClick:e,className:`border border-border px-3 py-1 rounded-sm text-fg-muted hover:text-fg`,children:`Cancel`}),(0,I.jsx)(`button`,{onClick:async()=>{if(!t.trim()){p(`Title is required.`);return}if(m.length===0){p(`At least one done criterion is required — it is what decides when the task is done.`);return}d(!0),p(``);try{await P.createTask({title:t.trim(),budget_usd:parseFloat(r)||0,done_criteria:m,body:s}),e()}catch(e){p(ae(e))}finally{d(!1)}},disabled:u,className:`border border-accent bg-accent/15 text-accent px-3 py-1 rounded-sm hover:bg-accent/25 disabled:opacity-50`,children:u?`creating…`:`Create task`})]})]})})}var n_=72,r_=38,i_=.62;function a_(e){return{cx:e.width/2,cy:e.height/2,r:Math.max(80,Math.min(e.width,e.height)/2-n_-r_),nodeR:r_,gateT:i_}}function o_(e){return Math.max(e,6)}function s_(e,t){return-Math.PI/2+2*Math.PI*e/t}function c_(e,t,n){let r=o_(e.length),i=[];return e.forEach((e,a)=>{if(!t.has(e))return;let o=s_(a,r);i.push({id:e,angle:o,x:n.cx+n.r*Math.cos(o),y:n.cy+n.r*Math.sin(o)})}),i}function l_(e,t,n){return{x:t.cx+(e.x-t.cx)*n,y:t.cy+(e.y-t.cy)*n}}var u_={assigned:.18,in_progress:.45,verifying:i_,done:.85,needs_you:.5,failed:.5,inbox:.08};function d_(e){return u_[e]??.3}function f_(e){return e!==``&&e!==`orchestrator`&&e!==`verifier`}function p_(e,t){let n=e.registry.slice(),r=new Set(e.workers);f_(t.assignee)&&!n.includes(t.assignee)&&(n.push(t.assignee),n.sort()),f_(t.assignee)&&r.add(t.assignee);let i=new Map(e.tasks);return i.set(t.id,t),{registry:n,workers:r,tasks:i}}function m_(){return{registry:[],workers:new Set,tasks:new Map}}function h_(e,t=[]){let n={registry:t.slice(),workers:new Set,tasks:new Map};for(let t of e)n=p_(n,{id:t.id,title:t.title,assignee:t.assignee,status:t.status});return n}function g_(e){return{id:e.id,title:e.title,assignee:e.assignee,status:e.status}}function __(){let e=F(()=>P.tasks(),[],{intervalMs:8e3}),t=(0,l.useRef)([]),[n,r]=(0,l.useState)(m_);return(0,l.useEffect)(()=>{if(!e.data)return;let n=h_(e.data,t.current);t.current=n.registry,r(n)},[e.data]),(0,l.useEffect)(()=>d.onFrame(e=>{e.type===`task`&&r(n=>{let r=p_(n,g_(e.data));return t.current=r.registry,r})}),[]),n}function v_(e){return e.workers.size>0||e.tasks.size>0}function y_(e){let t=new Map;for(let n of e.tasks.values()){if(!f_(n.assignee))continue;let e=t.get(n.assignee)??[];e.push(n),t.set(n.assignee,e)}return t}var b_=260;function x_(e,t,n,r=b_){let i=e+(t-e)*(1-Math.exp(-n/r));return Math.abs(t-i)<.001?t:i}function S_(e){let t=0,n=performance.now(),r=i=>{let a=Math.min(i-n,64);n=i,e(a),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),{stop:()=>cancelAnimationFrame(t)}}var C_=class{cur=new Map;setTarget(e,t){this.cur.has(e)||this.cur.set(e,t),this.targets.set(e,t)}targets=new Map;step(e,t){let n=!1;for(let r of Array.from(this.cur.keys())){if(!t.has(r)){this.cur.delete(r),this.targets.delete(r);continue}let i=this.targets.get(r)??this.cur.get(r),a=x_(this.cur.get(r),i,e);a!==this.cur.get(r)&&(n=!0),this.cur.set(r,a)}return n}get(e){return this.cur.get(e)}};function w_(e){let t=(0,l.useRef)(new C_),[,n]=(0,l.useState)(0),r=new Set(e.tasks.keys());for(let n of e.tasks.values())t.current.setTarget(n.id,d_(n.status));return(0,l.useEffect)(()=>{let e=S_(e=>{t.current.step(e,r)&&n(e=>e+1)});return()=>e.stop()},[]),(e,n)=>t.current.get(e)??d_(n)}function T_(e){switch(e){case`done`:return`var(--color-ok)`;case`needs_you`:return`var(--color-warn)`;case`failed`:return`var(--color-danger)`;case`verifying`:case`in_progress`:case`assigned`:return`var(--color-accent)`;default:return`var(--color-fg-muted)`}}function E_(e){return e.some(e=>e.status!==`done`&&e.status!==`failed`)}function D_({model:e,viewport:t,centerLabel:n=`orchestrator`}){let r=a_(t),i=c_(e.registry,e.workers,r),a=y_(e),o=w_(e);return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`orchestration graph`,children:[i.map(e=>(0,I.jsx)(A_,{node:e,g:r,gateStatus:k_(a.get(e.id)??[])},`spoke-${e.id}`)),i.map(e=>(a.get(e.id)??[]).map((t,n)=>{let i=l_(e,r,o(t.id,t.status)),s=(n-(a.get(e.id).length-1)/2)*12,c=-(e.y-r.cy),l=e.x-r.cx,u=Math.hypot(c,l)||1;return(0,I.jsx)(O_,{task:t,cx:i.x+c/u*s,cy:i.y+l/u*s},`task-${t.id}`)})),i.map(e=>{let t=a.get(e.id)??[],n=E_(t),i=e.x>=r.cx?1:-1,o=i===1?`start`:`end`,s=i*(r.nodeR+10),c=t.find(e=>e.status!==`done`&&e.status!==`failed`)??t[0];return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:n?`graph-breathe`:void 0,r:r.nodeR,fill:`var(--color-panel)`,stroke:n?`var(--color-accent)`:`var(--color-border-strong)`,strokeWidth:n?2.5:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`13`,fill:`var(--color-fg)`,className:`mono`,children:N_(e.id)}),c&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`text`,{x:s,y:-4,textAnchor:o,fontSize:`12`,fill:`var(--color-fg)`,children:M_(c.title,26)}),(0,I.jsx)(`text`,{x:s,y:12,textAnchor:o,fontSize:`11`,fill:T_(c.status),className:`mono`,children:j_(c.status)})]})]},`node-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${r.cx},${r.cy})`,children:[(0,I.jsx)(`circle`,{r:r.nodeR+6,fill:`var(--color-panel-2)`,stroke:`var(--color-accent)`,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`12`,fill:`var(--color-fg)`,className:`mono`,children:n===`orchestrator`?`orch`:n})]})]})}function O_({task:e,cx:t,cy:n}){let r=(0,l.useRef)(e.status),[i,a]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(r.current!==`done`&&e.status===`done`){a(!0);let t=setTimeout(()=>a(!1),600);return r.current=e.status,()=>clearTimeout(t)}r.current=e.status},[e.status]),(0,I.jsx)(`circle`,{className:`graph-dot${i?` graph-verified`:``}`,cx:t,cy:n,r:8,fill:T_(e.status),children:(0,I.jsx)(`title`,{children:`${e.title} · ${e.status}`})})}function k_(e){return e.some(e=>e.status===`done`)?`done`:e.some(e=>e.status===`verifying`)?`verifying`:`idle`}function A_({node:e,g:t,gateStatus:n}){let r=l_(e,t,t.gateT),i=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-bg)`,a=n===`done`?`var(--color-ok)`:n===`verifying`?`var(--color-accent)`:`var(--color-border-strong)`;return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`line`,{x1:t.cx,y1:t.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5}),(0,I.jsx)(`rect`,{className:`graph-gate`,x:r.x-7,y:r.y-7,width:14,height:14,transform:`rotate(45 ${r.x} ${r.y})`,fill:i,stroke:a,strokeWidth:1.5,children:(0,I.jsx)(`title`,{children:`verify gate — a task turns green only after its tests pass`})})]})}function j_(e){switch(e){case`assigned`:return`assigned`;case`in_progress`:return`working…`;case`verifying`:return`running tests…`;case`done`:return`✓ verified`;case`needs_you`:return`needs you`;case`failed`:return`failed`;default:return e}}function M_(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}function N_(e){let t=/^worker-(\d+)$/.exec(e);return t?`w${t[1]}`:e===`verifier`?`vfy`:e.slice(0,4)}function P_(e){switch(e){case`working`:return`var(--color-ok)`;case`waiting-on-you`:return`var(--color-warn)`;case`looping`:case`error`:return`var(--color-danger)`;case`ended`:return`var(--color-fg-faint)`;default:return`var(--color-fg-muted)`}}function F_({sessions:e,viewport:t}){let n=a_(t),r=e.map(e=>e.id).sort(),i=c_(r,new Set(r),n),a=new Map(e.map(e=>[e.id,e]));return(0,I.jsxs)(`svg`,{width:t.width,height:t.height,className:`block`,role:`img`,"aria-label":`session graph`,children:[i.map(e=>(0,I.jsx)(`line`,{x1:n.cx,y1:n.cy,x2:e.x,y2:e.y,stroke:`var(--color-border)`,strokeWidth:1.5},`edge-${e.id}`)),i.map(e=>{let t=a.get(e.id),r=P_(t.health);return(0,I.jsxs)(`g`,{transform:`translate(${e.x},${e.y})`,children:[(0,I.jsx)(`circle`,{className:t.health===`working`?`graph-breathe`:void 0,r:n.nodeR,fill:`var(--color-panel)`,stroke:r,strokeWidth:2}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`9`,fill:`var(--color-fg-muted)`,className:`mono`,children:t.label}),(0,I.jsx)(`title`,{children:`${t.label} · ${t.health}`})]},`sess-${e.id}`)}),(0,I.jsxs)(`g`,{transform:`translate(${n.cx},${n.cy})`,children:[(0,I.jsx)(`circle`,{r:n.nodeR+4,fill:`var(--color-panel-2)`,stroke:`var(--color-border-strong)`,strokeWidth:1.5}),(0,I.jsx)(`text`,{textAnchor:`middle`,dy:`0.32em`,fontSize:`10`,fill:`var(--color-fg-muted)`,className:`mono`,children:`caprock`})]})]})}function I_(){let e=__(),t=F(()=>P.sessions(!0),[],{intervalMs:4e3}),n=(0,l.useRef)(null),[r,i]=(0,l.useState)({width:900,height:560});(0,l.useEffect)(()=>{if(!n.current)return;let e=n.current,t=new ResizeObserver(()=>{i({width:e.clientWidth,height:Math.max(420,e.clientHeight)})});return t.observe(e),i({width:e.clientWidth,height:Math.max(420,e.clientHeight)}),()=>t.disconnect()},[]);let a=v_(e),o=(t.data??[]).filter(e=>e.status!==`ended`).map(e=>({id:e.session_id,label:E(e.session_id),health:e.activity.health})),s=Array.from(e.tasks.values()),c=s.filter(e=>e.status===`done`).length,u=s.filter(e=>[`assigned`,`in_progress`,`verifying`].includes(e.status)).length;return(0,I.jsxs)(`div`,{className:`grid gap-2`,children:[a&&(0,I.jsxs)(`div`,{className:`flex items-baseline gap-6 border border-border bg-panel rounded-[var(--radius-panel)] px-4 py-3`,children:[(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-ok`,children:c}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`verified — tests passed, not just claimed`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-accent`,children:u}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`in flight`})]}),(0,I.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,I.jsx)(`span`,{className:`num text-2xl text-fg`,children:e.workers.size}),(0,I.jsx)(`span`,{className:`text-[12px] text-fg-muted`,children:`workers`})]})]}),(0,I.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-fg-faint px-0.5`,children:[(0,I.jsx)(L_,{orchestration:a}),(0,I.jsx)(`span`,{className:`ml-auto`,children:a?`live · the orchestrator assigns work; a task turns green only after its tests pass`:(0,I.jsxs)(I.Fragment,{children:[`your live sessions — start an orchestrator with `,(0,I.jsx)(`span`,{className:`mono text-fg-muted`,children:`caprock up --hive `}),` to see the verified team`]})})]}),(0,I.jsx)(`div`,{ref:n,className:`relative w-full h-[70vh] rounded-[var(--radius-panel)] border border-border bg-panel/40 overflow-hidden`,children:a?(0,I.jsx)(D_,{model:e,viewport:r}):(0,I.jsx)(F_,{sessions:o,viewport:r})})]})}function L_({orchestration:e}){let t=(e,t)=>(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,I.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:e}}),t]});return(0,I.jsx)(`span`,{className:`inline-flex items-center gap-3`,children:e?(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-accent)`,`in flight`),t(`var(--color-ok)`,`verified`),t(`var(--color-warn)`,`needs you`),t(`var(--color-danger)`,`failed`)]}):(0,I.jsxs)(I.Fragment,{children:[t(`var(--color-ok)`,`working`),t(`var(--color-warn)`,`waiting on you`),t(`var(--color-danger)`,`loop / error`),t(`var(--color-fg-muted)`,`idle`)]})})}var R_=200;function z_(){let[e,t]=(0,l.useState)(``),[n,r]=(0,l.useState)(``),i=re(3e4),[a,o]=(0,l.useState)(!1),s=F(()=>P.searchNotes(n,R_),[n],{live:!1,intervalMs:0}),[c,u]=(0,l.useState)([]),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1);(0,l.useEffect)(()=>{u([]),m(!1)},[n]);let h=[...s.data??[],...c];async function g(){let e=h[h.length-1];if(!(!e||d)){f(!0);try{let t=await P.searchNotes(n,R_,e.event_id);t.length===0?m(!0):u(e=>[...e,...t])}catch{m(!0)}finally{f(!1)}}}let _=a||n?h:h.filter(e=>!e.fragment),v=h.length-_.length;return(0,I.jsxs)(`div`,{className:`grid gap-3`,children:[(0,I.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),r(e.trim())},children:[(0,I.jsx)(`input`,{className:`input max-w-[520px]`,value:e,onChange:e=>t(e.target.value),placeholder:`Search what Claude told you — a name, an error, a decision…`,"aria-label":`Search Claude's answers`}),(0,I.jsx)(`button`,{type:`submit`,className:`text-[12px] border border-accent/50 text-accent bg-accent/10 px-2 py-1 rounded-sm hover:bg-accent/20`,children:`search`}),n&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>{t(``),r(``)},children:`clear`}),v>0&&(0,I.jsx)(`button`,{type:`button`,className:`text-[11px] text-fg-muted hover:text-fg border border-border px-1.5 py-1 rounded-sm`,onClick:()=>o(e=>!e),children:a?`hide short remarks`:`+${v} short remarks`}),(0,I.jsx)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,children:`Claude's written answers, across every session. Local only.`})]}),s.error&&!s.data&&(0,I.jsx)(Et,{title:`Cannot search`,children:s.error.message}),!s.data&&!s.error&&(0,I.jsx)(Dt,{rows:5,className:`border border-border rounded-[var(--radius-panel)] bg-panel`}),s.data&&_.length===0&&(0,I.jsx)(Et,{title:n?`Nothing found for "${n}"`:`No answers captured yet`,children:n?`Try a shorter phrase — this matches the words Claude wrote, not what you asked.`:`Run a session and Claude’s written answers will be searchable here.`}),_.length>0&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`text-[11px] text-fg-faint px-0.5`,children:[_.length,` `,_.length===1?`answer`:`answers`,n?` matching "${n}"`:` · most recent`,` · subagent chatter excluded`]}),(0,I.jsx)(`div`,{className:`grid gap-2`,children:_.map(e=>(0,I.jsx)(ei,{note:e,now:i,showSession:!0},e.event_id))}),(0,I.jsxs)(`div`,{className:`flex items-center gap-3 px-0.5`,children:[!p&&(0,I.jsx)(`button`,{className:`text-[11px] text-fg-muted hover:text-fg border border-border px-2 py-1 rounded-sm`,onClick:()=>void g(),disabled:d,children:d?`loading…`:`load older answers`}),p&&(0,I.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`that is everything`})]})]})]})}function B_(){let e=_();return(0,I.jsx)(ht,{route:e,children:(0,I.jsxs)(xt,{label:e.name,children:[e.name===`now`&&(0,I.jsx)(qr,{}),e.name===`session`&&(0,I.jsx)(fg,{id:e.id,tab:e.tab,at:e.at},e.id),e.name===`cost`&&(0,I.jsx)(Fg,{}),e.name===`settings`&&(0,I.jsx)(Bg,{}),e.name===`history`&&(0,I.jsx)(Ug,{}),e.name===`tasks`&&(0,I.jsx)(Gg,{}),e.name===`graph`&&(0,I.jsx)(I_,{}),e.name===`notes`&&(0,I.jsx)(z_,{})]})})}(0,u.createRoot)(document.getElementById(`root`)).render((0,I.jsx)(l.StrictMode,{children:(0,I.jsx)(B_,{})})); \ No newline at end of file diff --git a/internal/api/dist/assets/index-BaqgCMsw.css b/internal/api/dist/assets/index-JiLc92x0.css similarity index 73% rename from internal/api/dist/assets/index-BaqgCMsw.css rename to internal/api/dist/assets/index-JiLc92x0.css index ab1aa7c..d9514b1 100644 --- a/internal/api/dist/assets/index-BaqgCMsw.css +++ b/internal/api/dist/assets/index-JiLc92x0.css @@ -1 +1 @@ -@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[560px\]{width:560px}.w-\[620px\]{width:620px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:mt-0:first-child{margin-top:0}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:border-fg-faint:hover{border-color:var(--color-fg-faint)}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} +@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(data:font/woff2;base64,d09GMgABAAAAAAaEABMAAAAADFgAAAYdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbbhwoP0hWQVJpBmA/U1RBVIE4AFwvbBEICoJ8gkMLFAAwhCoBNgIkAyIEIAWGUAdiDAcbvgpRVHJOI/viwCYyfSFrJjFIG8raYpYj9+IeSF0s6zD+Lk/4OGrZHhHV+wvt2ffuWPwlA51lIICIosSVmyOKEs5Uzlx3NKeXIgn1ssCydUybDV0IHga+SszIyfrQe9bLTFNxjayzgs76hNsDoSYtRe32fiJ4gxBjrP8L+w//zzHjv7Yqyr9o2vOBDXhCo2jMtr4uwAK/gV1U0PxAq/EAD+yW9EoKOL1KLw8rHrFgCSgRTQRzBzpeXVhweEDlyfY8gIoOa2CQJzrTAHIIoitTMVV2dyFwpJ2iAEQTpSkhPitxD3YwuZHEagTcAhyKAcBmUyPdhTovJThOw6HYiaF2M/J7erdi2OUutor6ES6Ac88AvfZvKpb6fJoArohb524042j6Jij36NI7P8Pb7s721naN9gcTtcjXQP4l+8BKEzFVGMxxoHqlq8Ul4LGneFJBDFaOdKpLPcg8P14YSDwIcn75hdlyJLTBlZ4voL6tT46yC/njunXqpJ0/bSvmrH1o3kRlwZ+j0DBogkF3KbDRVBlbOc+fY5HVXwPoT9hfekPnyZMaEmenYLMSg5npqegFOsgXsBv1IoF9aIVfSCNHkk6+gIzILsiYuhWQCfUtZEpbkRntQxBZgw7MwFbMcRvwJrAnBlDqs7isLtL7pO84Xru1i7ah7tckH1Wreqq6K9u0amxU1bcff/s2Y1ni3rh2I8zHzqkm3PGvv3mzC6NDBz/UcOBIg+nm88rxN8MbdtypvHUL5o1c2zG0urYpRmW+VHZdiba6GXN/3v0B3i3nt4RBsbfAu8ftLqRcTIlZ4VYheFTAS5nXLS65VZrbuW3daF2Ze1ChyGXWZN6u9nUuH1LfyTERifZXEpIueMe28vF8FOoTnsONzw+1djo9P71lZGx1vM8mH/BhvSa2HDsRZ1+Ul+RmpnPOIaEuwWnZZdkgQWAAyCDDZ1wk+0sh7wseAAwA6UlHxbftCgYAAwKAgwIAEA7ACfHIRbV7J6dwF/ZzcRRmAjXUYKAGWAlDCCFmKnH+LJEQfHKEmVrfmKwSEab36AcubXQBoDYJV/aRV+funFD8wAXLSLYbwr9+DR+h/qZIKCfeqRG5ghHpdY0zcV2nuz5iJMhAFjaTDwOcoyKGG9JHrCfdp4cC+kCvUrxc7+bliIMiHj95sPIbUeWZEP/HLnN2tlr9EBeRiktHuWvErx98fRz1MuEvHO3FDRgtsSzL/P0hsDLK2n5/uHMOjvTst0HD6t+80ZN798j7j//kjqHxIOZDFPR/FxurFD6/HxGbB799RPHLx5F89MoBOub9jVuOWtmPH3o9H3r26DIuff+LqPLwff/xryDRmiAYmjxiK0GwS9XU+k8QpUrHsCTs4qH89Fv44ubWbQmOE51M7J8Pt8+h+NKt3zZpa2L9zZqcRlyEc4MaNGdfjQCxgIygn78ne4yAzcLWA3zAJ6RRGbijvHr1W+XN8ywrG0EoZSySb0/A9KsllI7Q/Pq8hLu76tfTy5cF4X8bQxTtYp2vr6/+1oI4AhgAlNYFryt62VaX9ktO6VsAeDLeWx6fff4vdV1ts7N6+gw9GCsQnqPB0QUttB9nEc7Aaf4XM0NQ90VJ+HV1rG04znGCmXcpPCA9+nxdMPgPlT7Dz83NMfZuMJaNeRqbc+tjd2QER/b0B44d7nv5Rif7VC8svYkx9SKWwb3YzN2M3cY8jSNLl+PYZqfjxNTxOLXVCmfmduDc0ty1kLbjeiGfIrDFJXWPTTMD5TKupR8cpZgJeXTofId8NoUj6E8XfAc2k4WPdbCberDYAp8Q7L5dUo8wE8cs9QINZYvwXKzvBS4v/n+fQZkGrrFysKEIuFBgjQpxiHH1XA+ZBI+C+oAoxhYKECc42rGOc8L4mYhsiThGfFjOcKmFubPpDgwnY1918Fwo8ouenDJxvGP96HFWJ28hiOy251oKjkcbGz2POMme8CTMThx6wqOPsFtPI6j6HhDyDTxFQYnL88FcXGAGHl3ZuueRbEuxbK6Hc84ZDvRrREtLzyjj8Xkd/uShR1b0sYd8Nh8/c8znxCnadxQcf2nFVWIyw1g+4StXav9j75s+CQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-vietnamese-wght-normal-CHiFlh_0.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-ext-wght-normal-Dg-wlmqe.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Hanken Grotesk Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/hanken-grotesk-latin-wght-normal-CaVRRdDk.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,d09GMgABAAAAAAfsABQAAAAAEAwAAAeCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhwbHhwoP0hWQVJbBmA/U1RBVIFiJyYAdC9qEQgKhGSEAAsgADCGCAE2AiQDOgQgBYlMB4EUDAcbLQ4onoexrSC/2ZyLAa8p8VHB8/x3Vue+V0hVJalMJg2nx/TCrQXxBeqLjQG7FyM1WEa/X1tEXN7cFz9EJEMmMUz3RihWSSKeQCbcIou0izz/C8v+fq3VfajEa9gDD11CImXS7qL/RJFVzC1qiB6KmKeD6TZdQ6IRGv78dL6uSVVCfgni5mzu7kcgQBgAEAQTQRCoL++STTYybkJxNfQxAAIAGu8OdEB9teW2jh4BpgDqFjAeSEByW3zFP0CBBgNMsMCGEDjgggdhiEAUAeIIED7ABTDUEnkIE9Q9ahFgKttcVhApo4ACB4qobHaccgDfEjFO6aaWUhjMLt2SyIvHKoDqoA4CSUwEIYQCEjhAO9R1G6keDeDZGjNo+AhxOjCEGTr1WeIF3kYBiLAOKvkJSMiKX0VdAyQt3SDJClCkxJCHkCzfqyVTriJZLcolS32JZHUekq2TYNkYtCtjYHMQXSxGjXDz2t/yLWXzDzxz+o3zFwDEaN23F+13pyMdQAEaSKAR9vcGq4A4MTSKCElGW+M7UcY7xqkggITb28ZJhlqc9q2twYKTt0NjixBgYvO9BIihEBLYuOFXQzfIQ7dXGUEEEgFDooBfAzqiQbpJrhiWSuKJCRFKYbHCyJKI2G5GiZbNAvgAu5pc3vwx4G+g3aDkhklABiSz0BICXrYghtYhx/cdJ+44rY2oZ0aMNRFz3VZjb6W33F3gzltqtOCV8tTHSpOeXuItfvr5lCdfzFpqtEitvqdcdGGFd28ZqqC0tPbeChGXgrIlnhSWu/eUso4uKWFLugyDzQJhflY4659+WjQ++6x72WUMv9G8mw6QJl7BVxX5fe/kpUsOvnZwee9uQ0cGXYd0o89XB2748sDSnt8d2VphdOTTgceDVvOds0v9P/s7HPq15aGun/6Vllb56f1dl0t1LejqrNkpdRZsG8TOnM5vkBG5oiVyVGnS8LHps5cfNWJs6qKPfaNSxiQNBUm3cKNWROr0GSur7Za31k1vieq7LH11VF+jXdRIasRKflc7jkobm1Z9te1IyZA0pDkhLR98+H37Zf1c/8at+dB7x+7GfVyTfJMPiYztsnl59Y5l4j+0n1RXlpHnF3Tq7HecmNF/CJodEMAikruxiyJaGLvHOdAfoA+oDvpjBm2b91cHGRZMU9n25xEU0A8fgEEAdKI3Q1iDtc034sug5YVMkE2jsE+BIkwSoQ3gxXMqz9tELp48bd0cFKOKS7xYjEuXBnZP5ia7DyiO/X/YI+PQSbt2uSdqAkWL9nQbV1XB94/+uPfdZz8dnXYFBYrcTl2SIR/ybxJNJPz/Gupb0JaZeens2ekC7EKr8t+Ls/P5VJPYJdHKyqfg2nqU6bhlidzcddQV/7MmecTzJ5VPcKXkNKSEogHjYFx6QZ7rQ+FSe8njaiNuOnXS8H2ScQ619c2mC3VTtauL0rRbXd/CkSOP37FY9Zkjz8+GibYUMOEWF+RdrFS8Ecv1SHOpPUPZGEIpjPvFyU5cXKjd6OXqorTqy9GwRd++HVufPGnVsW+aO3vggKZ18jR9sXaTC1PWTEsVUaK0FkNySbTQDqlm2PfDjZcu4aalnSLKjnOoYQ0nUlqqXcGpPu/4VgV/xU2pAqW4BW3qzhQ8/hFKhV2qE3+BKAtDqBXjfgnVdH4y0wg5tbVNRenNdTWOrenWLcupQdmsbq5b+18piTe/xRdp1xbILxNPJGInm2z6hoB21Lal0i+ePTtd7B45+3XhFJ329evskXm7qurUVREotqSluSo/L29d3qDhI4YOQqWhI4YNvBNfsMHeXKemXrxQfKeuPOGRVayA3JtkJKEgbPp+dXUDluddutRYLFoXGXWX6N3WFaGLbQtRSitVYNacTNSdy7AaG/HSaUEANcBoGXNdcZvZsOqQ1icBDv21/gzAoYPHH/WDW0qNR3QTYKEAEHig6o13NXbND06CQPlRtYjGNnSktRc09k1mAMDvAlDKfQjgy6fssInlfzmNAjKkDxoxHOBLdVRAIVt9j4qo+hA1w9T1aNBNTUOTTNUHLbqokE+UAfJXCIGw/IxCSL5GRUJeR40rL/UxTm4Q08H6MbCs70ObuNyIIXrINHQYInF06UUlevTjbQzTh5upiDMzMMogUtEnjPs/Y7jAHCJeB0GBHh04tC6FiB6ZFB1oArUSIoFoqhzCeAN6lHwm0T4C3VVPWvjpSMXReuWesMEcoqrmgtNBGd2noWeV0hNAz9rFeShNJxHGsPa3HXeKTk8b55hahySYHaYKKFFLpCfN8rsoaJn01CR04Gkc+5k7KVTCmClX8Q10HCrUEkVlSX+XO33oQR9609tJ516H497WSobWs5Up6TLaS10/dessIskgJSLiDlWvHVUywpkQ7hdPZqGyiEF0uVQerVcPamT1A3eKXdyI1vG9OoflrSXihZ1qqGE3nhmAgiIbRCQgPLEPtOM3UQwTLYaYYomNlpA44opnjV6jkD6id80OOrzf6BzmMD6eEa1zKyeYG1fzfEf16V6jw9XYOaar1/b2kP/IYX8oR2mcFvv2GtBV3JXgd437AQAA)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:"Hanken Grotesk Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#1b1b1a;--color-panel:#211f1d;--color-panel-2:#262422;--color-border:#2b2927;--color-border-strong:#3a3835;--color-fg:#e8e6e2;--color-fg-muted:#a9a59e;--color-fg-faint:#837f78;--color-ok:#4fbf6b;--color-warn:#e0a33c;--color-danger:#ff8080;--color-info:#feb157;--color-accent:#feb157;--color-accent-strong:#ffcb85;--color-premium:#4d5cf0;--color-premium-strong:#6f7bff;--shadow-panel:0 12px 32px -18px #000000a6;--radius-panel:6px;--animate-flash:flash .15s ease-out}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{inset-inline:0}.-top-1{top:calc(var(--spacing) * -1)}.-top-4{top:calc(var(--spacing) * -4)}.-top-\[7px\]{top:-7px}.top-0{top:0}.top-7{top:calc(var(--spacing) * 7)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.bottom-0{bottom:0}.left-0{left:0}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\/2{left:50%}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-3{margin-left:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-\[2px\]{height:2px}.h-\[14px\]{height:14px}.h-\[44px\]{height:44px}.h-\[70vh\]{height:70vh}.h-\[92px\]{height:92px}.h-\[168px\]{height:168px}.h-full{height:100%}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[40vh\]{max-height:40vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[76vh\]{max-height:76vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[82vh\]{max-height:82vh}.max-h-\[420px\]{max-height:420px}.min-h-\[60px\]{min-height:60px}.min-h-\[70px\]{min-height:70px}.min-h-screen{min-height:100vh}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-44{width:calc(var(--spacing) * 44)}.w-\[268px\]{width:268px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[560px\]{width:560px}.w-\[620px\]{width:620px}.w-\[820px\]{width:820px}.w-auto{width:auto}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[12ch\]{max-width:12ch}.max-w-\[50\%\]{max-width:50%}.max-w-\[52ch\]{max-width:52ch}.max-w-\[52rem\]{max-width:52rem}.max-w-\[60ch\]{max-width:60ch}.max-w-\[92vw\]{max-width:92vw}.max-w-\[94vw\]{max-width:94vw}.max-w-\[220px\]{max-width:220px}.max-w-\[520px\]{max-width:520px}.max-w-\[560px\]{max-width:560px}.max-w-\[620px\]{max-width:620px}.max-w-\[660px\]{max-width:660px}.max-w-\[720px\]{max-width:720px}.max-w-\[1600px\]{max-width:1600px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[1px\]{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-flash{animation:var(--animate-flash)}.animate-pulse{animation:var(--animate-pulse)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-y{resize:vertical}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[1fr_128px_auto\]{grid-template-columns:1fr 128px auto}.grid-cols-\[1fr_auto\]{grid-template-columns:1fr auto}.grid-cols-\[132px_1fr_92px_104px\]{grid-template-columns:132px 1fr 92px 104px}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_auto_1fr_auto\]{grid-template-columns:auto auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-start{align-content:flex-start}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-items-start{justify-items:start}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-\[3px\]{gap:3px}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-1{row-gap:var(--spacing)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}.gap-y-6{row-gap:calc(var(--spacing) * 6)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--color-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[3px\]{border-radius:3px}.rounded-\[5px\]{border-radius:5px}.rounded-\[var\(--radius-panel\)\]{border-radius:var(--radius-panel)}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\[var\(--radius-panel\)\]{border-top-left-radius:var(--radius-panel);border-top-right-radius:var(--radius-panel)}.rounded-t-sm{border-top-left-radius:var(--radius-sm);border-top-right-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-accent{border-color:var(--color-accent)}.border-accent\/35{border-color:#feb15759}@supports (color:color-mix(in lab, red, red)){.border-accent\/35{border-color:color-mix(in oklab, var(--color-accent) 35%, transparent)}}.border-accent\/40{border-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.border-accent\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-accent\/45{border-color:#feb15773}@supports (color:color-mix(in lab, red, red)){.border-accent\/45{border-color:color-mix(in oklab, var(--color-accent) 45%, transparent)}}.border-accent\/50{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.border-accent\/50{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.border-accent\/60{border-color:#feb15799}@supports (color:color-mix(in lab, red, red)){.border-accent\/60{border-color:color-mix(in oklab, var(--color-accent) 60%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-strong{border-color:var(--color-border-strong)}.border-border\/60{border-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.border-danger\/40{border-color:#ff808066}@supports (color:color-mix(in lab, red, red)){.border-danger\/40{border-color:color-mix(in oklab, var(--color-danger) 40%, transparent)}}.border-danger\/50{border-color:#ff808080}@supports (color:color-mix(in lab, red, red)){.border-danger\/50{border-color:color-mix(in oklab, var(--color-danger) 50%, transparent)}}.border-ok\/40{border-color:#4fbf6b66}@supports (color:color-mix(in lab, red, red)){.border-ok\/40{border-color:color-mix(in oklab, var(--color-ok) 40%, transparent)}}.border-premium\/60{border-color:#4d5cf099}@supports (color:color-mix(in lab, red, red)){.border-premium\/60{border-color:color-mix(in oklab, var(--color-premium) 60%, transparent)}}.border-transparent{border-color:#0000}.border-warn\/40{border-color:#e0a33c66}@supports (color:color-mix(in lab, red, red)){.border-warn\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-warn\/50{border-color:#e0a33c80}@supports (color:color-mix(in lab, red, red)){.border-warn\/50{border-color:color-mix(in oklab, var(--color-warn) 50%, transparent)}}.border-l-accent{border-left-color:var(--color-accent)}.bg-accent{background-color:var(--color-accent)}.bg-accent\/5{background-color:#feb1570d}@supports (color:color-mix(in lab, red, red)){.bg-accent\/5{background-color:color-mix(in oklab, var(--color-accent) 5%, transparent)}}.bg-accent\/10{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-accent\/15{background-color:#feb15726}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab, var(--color-accent) 15%, transparent)}}.bg-accent\/25{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.bg-accent\/25{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.bg-accent\/40{background-color:#feb15766}@supports (color:color-mix(in lab, red, red)){.bg-accent\/40{background-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.bg-accent\/50{background-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.bg-accent\/50{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.bg-accent\/70{background-color:#feb157b3}@supports (color:color-mix(in lab, red, red)){.bg-accent\/70{background-color:color-mix(in oklab, var(--color-accent) 70%, transparent)}}.bg-accent\/75{background-color:#feb157bf}@supports (color:color-mix(in lab, red, red)){.bg-accent\/75{background-color:color-mix(in oklab, var(--color-accent) 75%, transparent)}}.bg-accent\/\[0\.07\]{background-color:#feb15712}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.07\]{background-color:color-mix(in oklab, var(--color-accent) 7.0%, transparent)}}.bg-accent\/\[0\.08\]{background-color:#feb15714}@supports (color:color-mix(in lab, red, red)){.bg-accent\/\[0\.08\]{background-color:color-mix(in oklab, var(--color-accent) 8%, transparent)}}.bg-bg{background-color:var(--color-bg)}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-border\/60{background-color:#2b292799}@supports (color:color-mix(in lab, red, red)){.bg-border\/60{background-color:color-mix(in oklab, var(--color-border) 60%, transparent)}}.bg-danger{background-color:var(--color-danger)}.bg-danger\/10{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.bg-danger\/10{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.bg-fg-faint{background-color:var(--color-fg-faint)}.bg-fg-faint\/30{background-color:#837f784d}@supports (color:color-mix(in lab, red, red)){.bg-fg-faint\/30{background-color:color-mix(in oklab, var(--color-fg-faint) 30%, transparent)}}.bg-ok{background-color:var(--color-ok)}.bg-ok\/10{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.bg-ok\/10{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.bg-panel{background-color:var(--color-panel)}.bg-panel-2{background-color:var(--color-panel-2)}.bg-panel-2\/30{background-color:#2624224d}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/30{background-color:color-mix(in oklab, var(--color-panel-2) 30%, transparent)}}.bg-panel-2\/50{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/50{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.bg-panel-2\/60{background-color:#26242299}@supports (color:color-mix(in lab, red, red)){.bg-panel-2\/60{background-color:color-mix(in oklab, var(--color-panel-2) 60%, transparent)}}.bg-panel\/40{background-color:#211f1d66}@supports (color:color-mix(in lab, red, red)){.bg-panel\/40{background-color:color-mix(in oklab, var(--color-panel) 40%, transparent)}}.bg-panel\/70{background-color:#211f1db3}@supports (color:color-mix(in lab, red, red)){.bg-panel\/70{background-color:color-mix(in oklab, var(--color-panel) 70%, transparent)}}.bg-premium{background-color:var(--color-premium)}.bg-premium-strong{background-color:var(--color-premium-strong)}.bg-premium\/75{background-color:#4d5cf0bf}@supports (color:color-mix(in lab, red, red)){.bg-premium\/75{background-color:color-mix(in oklab, var(--color-premium) 75%, transparent)}}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.bg-warn\/10{background-color:#e0a33c1a}@supports (color:color-mix(in lab, red, red)){.bg-warn\/10{background-color:color-mix(in oklab, var(--color-warn) 10%, transparent)}}.bg-gradient-to-t{--tw-gradient-position:to top in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-panel{--tw-gradient-from:var(--color-panel);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-\[1px\]{padding-block:1px}.py-\[3px\]{padding-block:3px}.py-px{padding-block:1px}.pt-1{padding-top:var(--spacing)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-16{padding-top:calc(var(--spacing) * 16)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[10vh\]{padding-top:10vh}.pt-\[12vh\]{padding-top:12vh}.pt-\[14vh\]{padding-top:14vh}.pr-1{padding-right:var(--spacing)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pb-0\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-1\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-1{padding-left:var(--spacing)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-3\.5{padding-left:calc(var(--spacing) * 3.5)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-7{padding-left:calc(var(--spacing) * 7)}.pl-\[7\.5rem\]{padding-left:7.5rem}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-\[22px\]{font-size:22px}.text-\[24px\]{font-size:24px}.text-\[34px\]{font-size:34px}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[1\.1\]{--tw-leading:1.1;line-height:1.1}.leading-\[1\.4\]{--tw-leading:1.4;line-height:1.4}.leading-\[1\.05\]{--tw-leading:1.05;line-height:1.05}.leading-\[1\.35\]{--tw-leading:1.35;line-height:1.35}.leading-\[1\.45\]{--tw-leading:1.45;line-height:1.45}.leading-\[1\.55\]{--tw-leading:1.55;line-height:1.55}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[-0\.01em\]{--tw-tracking:-.01em;letter-spacing:-.01em}.tracking-\[0\.08em\]{--tw-tracking:.08em;letter-spacing:.08em}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-accent{color:var(--color-accent)}.text-bg{color:var(--color-bg)}.text-danger{color:var(--color-danger)}.text-fg{color:var(--color-fg)}.text-fg-faint{color:var(--color-fg-faint)}.text-fg-muted{color:var(--color-fg-muted)}.text-info{color:var(--color-info)}.text-ok{color:var(--color-ok)}.text-panel{color:var(--color-panel)}.text-premium-strong{color:var(--color-premium-strong)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.accent-\[var\(--color-accent\)\]{accent-color:var(--color-accent)}.opacity-35{opacity:.35}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-\[var\(--shadow-panel\)\]{--tw-shadow:var(--shadow-panel);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-accent{--tw-ring-color:var(--color-accent)}.ring-offset-1{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.ring-offset-panel{--tw-ring-offset-color:var(--color-panel)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.group-open\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\:text-accent-strong:is(:where(.group):hover *){color:var(--color-accent-strong)}.group-hover\:text-fg:is(:where(.group):hover *){color:var(--color-fg)}}.marker\:content-none ::marker{--tw-content:none;content:none}.marker\:content-none::marker{--tw-content:none;content:none}.marker\:content-none ::-webkit-details-marker{--tw-content:none;content:none}.marker\:content-none::-webkit-details-marker{--tw-content:none;content:none}.first\:mt-0:first-child{margin-top:0}.first\:border-t-0:first-child{border-top-style:var(--tw-border-style);border-top-width:0}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:border-accent\/50:hover{border-color:#feb15780}@supports (color:color-mix(in lab, red, red)){.hover\:border-accent\/50:hover{border-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:border-fg-faint:hover{border-color:var(--color-fg-faint)}.hover\:bg-accent\/10:hover{background-color:#feb1571a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/10:hover{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.hover\:bg-accent\/20:hover{background-color:#feb15733}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/20:hover{background-color:color-mix(in oklab, var(--color-accent) 20%, transparent)}}.hover\:bg-accent\/25:hover{background-color:#feb15740}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/25:hover{background-color:color-mix(in oklab, var(--color-accent) 25%, transparent)}}.hover\:bg-accent\/90:hover{background-color:#feb157e6}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/90:hover{background-color:color-mix(in oklab, var(--color-accent) 90%, transparent)}}.hover\:bg-accent\/\[0\.16\]:hover{background-color:#feb15729}@supports (color:color-mix(in lab, red, red)){.hover\:bg-accent\/\[0\.16\]:hover{background-color:color-mix(in oklab, var(--color-accent) 16%, transparent)}}.hover\:bg-danger\/10:hover{background-color:#ff80801a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-danger\/10:hover{background-color:color-mix(in oklab, var(--color-danger) 10%, transparent)}}.hover\:bg-ok\/10:hover{background-color:#4fbf6b1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-ok\/10:hover{background-color:color-mix(in oklab, var(--color-ok) 10%, transparent)}}.hover\:bg-panel:hover{background-color:var(--color-panel)}.hover\:bg-panel-2:hover{background-color:var(--color-panel-2)}.hover\:bg-panel-2\/50:hover{background-color:#26242280}@supports (color:color-mix(in lab, red, red)){.hover\:bg-panel-2\/50:hover{background-color:color-mix(in oklab, var(--color-panel-2) 50%, transparent)}}.hover\:bg-premium:hover{background-color:var(--color-premium)}.hover\:bg-warn\/20:hover{background-color:#e0a33c33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-warn\/20:hover{background-color:color-mix(in oklab, var(--color-warn) 20%, transparent)}}.hover\:text-accent:hover{color:var(--color-accent)}.hover\:text-accent-strong:hover{color:var(--color-accent-strong)}.hover\:text-fg:hover{color:var(--color-fg)}.hover\:text-fg-muted:hover{color:var(--color-fg-muted)}.hover\:no-underline:hover{text-decoration-line:none}.hover\:underline:hover{text-decoration-line:underline}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=40rem){.sm\:inline{display:inline}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}:where(.sm\:divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.sm\:divide-y-0>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(0px * var(--tw-divide-y-reverse));border-bottom-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)))}}@media (width>=48rem){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[1\.4fr_1fr_1fr_1fr_1fr_1fr\]{grid-template-columns:1.4fr 1fr 1fr 1fr 1fr 1fr}.lg\:grid-cols-\[minmax\(0\,1fr\)_260px\]{grid-template-columns:minmax(0,1fr) 260px}}@media (width>=80rem){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}}[data-theme=light]{--color-bg:#faf9f7;--color-panel:#fff;--color-panel-2:#f2f0ec;--color-border:#e6e2db;--color-border-strong:#c9c3b8;--color-fg:#24211c;--color-fg-muted:#5f5a51;--color-fg-faint:#8a8479;--color-ok:#2e9e4f;--color-warn:#9a6700;--color-danger:#d64545;--color-info:#b8730d;--color-accent:#b8730d;--color-accent-strong:#8f5808;--color-premium:#3341d8;--color-premium-strong:#232fb0;--shadow-panel:0 8px 20px -14px #3c321e38}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:var(--color-bg);color:var(--color-fg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.45}[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.num,.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum" 1, "zero" 1}*{border-color:var(--color-border)}a:where(:not([class*=text-])){color:var(--color-info)}a{text-decoration:none}a.link:hover{text-decoration:underline}::selection{background:#feb15759}@supports (color:color-mix(in lab, red, red)){::selection{background:color-mix(in srgb, var(--color-accent) 35%, transparent)}}.graph-dot{transition:fill .45s}.graph-gate{transition:fill .45s,stroke .45s}.graph-verified{transform-box:fill-box;transform-origin:50%;animation:.55s cubic-bezier(.2,.7,.2,1) verifyPop}@keyframes verifyPop{0%{transform:scale(1)}40%{transform:scale(1.55)}to{transform:scale(1)}}.graph-breathe{transform-box:fill-box;transform-origin:50%;animation:2.8s ease-in-out infinite graphBreathe}@keyframes graphBreathe{0%,to{opacity:.9}50%{opacity:1;filter:drop-shadow(0 0 3px color-mix(in srgb, var(--color-ok) 55%, transparent))}}@media (prefers-reduced-motion:reduce){.graph-dot,.graph-gate{transition:none}.graph-verified,.graph-breathe{animation:none}}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}.stale-dot{background:var(--color-warn);border-radius:9999px;width:6px;height:6px;display:inline-block}.input{background:var(--color-panel-2);border:1px solid var(--color-border-strong);color:var(--color-fg);font-family:var(--font-mono);border-radius:3px;width:100%;padding:4px 8px;font-size:12px}.input:focus{outline:1px solid var(--color-accent);border-color:var(--color-accent)}.skeleton-pulse{animation:1.4s ease-in-out infinite skeletonPulse}@keyframes skeletonPulse{0%,to{opacity:.5}50%{opacity:.9}}@media (prefers-reduced-motion:reduce){.skeleton-pulse{opacity:.6;animation:none}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@keyframes pulse{50%{opacity:.5}}@keyframes flash{0%{background-color:color-mix(in srgb, var(--color-accent) 22%, transparent)}to{background-color:#0000}}.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset} diff --git a/internal/api/dist/index.html b/internal/api/dist/index.html index ef3732e..ff5aeee 100644 --- a/internal/api/dist/index.html +++ b/internal/api/dist/index.html @@ -20,8 +20,8 @@ } catch (e) {} })(); - - + +
diff --git a/ui/src/components/ContinueSession.tsx b/ui/src/components/ContinueSession.tsx new file mode 100644 index 0000000..e97e459 --- /dev/null +++ b/ui/src/components/ContinueSession.tsx @@ -0,0 +1,92 @@ +import { useState } from 'react' +import { api, ApiError } from '@/lib/api' +import { navigate } from '@/lib/router' + +/** + * Pick up a conversation that is not Caprock's to type into. + * + * Caprock never writes to a process it did not start — two writers on one PTY + * interleave characters and ruin both, which is what rule 7 protects. So a + * session someone started in their terminal is readable here and not usable, + * and until now the only thing to do with it was look. + * + * `claude --resume ` is the way through: it starts a *second* process on + * the same conversation, with the history read from disk. Nothing is taken + * from the terminal that already has it, and the new process is one Caprock + * started, so it can be typed into like any other. + * + * Two shapes, because the situation has two shapes: + * + * - **Continue** when the session has ended. One conversation, carried on. + * - **Branch** when it is still running somewhere. Two live processes sharing + * an id would write one transcript between them and each end up holding + * half the other's turns, so the copy gets a new id (`--fork-session`) and + * the original is left alone. + * + * The command is also offered for a terminal of one's own, because somebody + * who lives in tmux does not want a second place to type. + */ +export function ContinueSession({ + sessionID, + cwd, + live, +}: { + sessionID: string + cwd: string + /** Whether the session is still running: decides continue vs branch. */ + live: boolean +}) { + const [busy, setBusy] = useState(false) + const [copied, setCopied] = useState(false) + const [error, setError] = useState('') + + const command = `claude --resume ${sessionID}` + + async function open() { + setBusy(true) + setError('') + try { + const res = await api.spawn({ cwd, resume: sessionID, fork: live }) + navigate({ name: 'session', id: res.session_id, tab: 'terminal' }) + } catch (e) { + setError(e instanceof ApiError ? e.message : String(e)) + } finally { + setBusy(false) + } + } + + async function copy() { + try { + await navigator.clipboard.writeText(command) + setCopied(true) + window.setTimeout(() => setCopied(false), 2000) + } catch { + setError('Could not reach the clipboard. Select the command and copy it.') + } + } + + return ( + + + + {error && {error}} + + ) +} diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index 485bfcd..560d024 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -407,6 +407,14 @@ export interface SpawnRequest { agent?: 'claude' | 'gemini' cwd?: string; chat?: boolean; create?: boolean; worktree?: string model?: string; permission_mode?: string; args?: string[] + /** Continue an existing conversation instead of starting a new one. Caprock + * cannot type into a process it did not start, so picking a session up + * means starting a second one on the same history. */ + resume?: string + /** Branch rather than continue: a new session id for the copy, leaving the + * original alone. Needed when the session being picked up is still + * running, or both would write one transcript between them. */ + fork?: boolean } async function post(path: string, body: unknown, method = 'POST'): Promise { diff --git a/ui/src/screens/Session.tsx b/ui/src/screens/Session.tsx index a33a42c..729b4ed 100644 --- a/ui/src/screens/Session.tsx +++ b/ui/src/screens/Session.tsx @@ -11,6 +11,7 @@ import { TerminalView } from '@/components/Terminal' import { costBasisLong } from '@/components/CostBasis' import { agentName } from '@/components/Projects' import { usePlan } from '@/components/PlanPicker' +import { ContinueSession } from '@/components/ContinueSession' type Tab = 'timeline' | 'notes' | 'changes' | 'terminal' @@ -66,6 +67,16 @@ export function SessionScreen({ id, tab, at }: { id: string; tab?: string; at?: {s.git_branch && {s.git_branch}} {s.owned && s.status !== 'ended' && } + {/* A session Caprock did not start is readable and not typeable — + * rule 7, and for a good reason: two writers on one PTY interleave. + * What it can do is start a second process on the same conversation, + * which is what this offers. Only for Claude Code: Gemini has its own + * --resume with different semantics, and offering a button that means + * something slightly different per agent is worse than not offering + * it yet. */} + {!s.owned && (s.agent ?? 'claude') === 'claude' && ( + + )} {s.cwd}