@openchamber/web 1.17.0 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/assets/{DiagramView-CRjw8BGO.js → DiagramView-CI2JhNxs.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-BjjFniUt.js → MarkdownRendererImpl-Bq-wtyiF.js} +3 -3
- package/dist/assets/{OnboardingScreen-JuiKjRTI.js → OnboardingScreen-B6BqjJ0l.js} +1 -1
- package/dist/assets/{SessionSwitcherDropdown-S2EvRz-E.js → SessionSwitcherDropdown-DepVWyeA.js} +1 -1
- package/dist/assets/{SettingsWindow-PzqMjCEx.js → SettingsWindow-Xj4Uy_Fr.js} +1 -1
- package/dist/assets/{document-attachments-DZf4VoiD.js → document-attachments-C5tUWELq.js} +1 -1
- package/dist/assets/{es-CErIcckI.js → es-DSTFcl6A.js} +1 -1
- package/dist/assets/{fr-z5ORYrou.js → fr-CEeK5ifb.js} +1 -1
- package/dist/assets/index-DUBtXIPQ.css +1 -0
- package/dist/assets/{index-DMCrPMIW.js → index-Dld5wFqI.js} +3 -3
- package/dist/assets/{ja-ecPbYMn0.js → ja-pu3u7ZOY.js} +1 -1
- package/dist/assets/{ko-CASkpaQH.js → ko-CStr_CJ-.js} +1 -1
- package/dist/assets/{main-BTLr2DyB.js → main-DBG0rE6P.js} +36 -36
- package/dist/assets/{main-DQ-uX_zf.js → main-Xc2GeALp.js} +2 -2
- package/dist/assets/{markdownCore-C4XTgyYU.js → markdownCore-Bn8Ywh-t.js} +2 -2
- package/dist/assets/miniChat-D5FFElbH.js +2 -0
- package/dist/assets/mobile-B4K4IpE7.js +2 -0
- package/dist/assets/{pl-BYtGQyDI.js → pl-nD08d1Bo.js} +1 -1
- package/dist/assets/{pt-BR-D8dONk68.js → pt-BR-DqcoQ-nE.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-Cbdusroc.js → renderElectronMiniChatApp-B-rksap7.js} +2 -2
- package/dist/assets/renderMobileApp-U-jxDI_G.js +16 -0
- package/dist/assets/runtimeEndpointReset-fpfBYOyW.js +174 -0
- package/dist/assets/{uk-C8z1P8tg.js → uk-DkX7DsWk.js} +1 -1
- package/dist/assets/{useAppFontEffects-DrLhDSC3.js → useAppFontEffects-CZdEKvZ8.js} +129 -127
- package/dist/assets/{vendor-.bun-DvcSrJLa.js → vendor-.bun-BzW0Lgld.js} +1 -1
- package/dist/assets/{zh-CN-BwJPtjKq.js → zh-CN-DlqHNM1o.js} +1 -1
- package/dist/assets/{zh-TW-C7FpgD-Y.js → zh-TW-DeKAHBhV.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +2 -2
- package/server/index.js +31 -2
- package/server/lib/openchamber-sessions/routes.js +30 -30
- package/server/lib/openchamber-sessions/routes.test.js +38 -0
- package/server/lib/opencode/DOCUMENTATION.md +7 -2
- package/server/lib/opencode/env-runtime.js +18 -0
- package/server/lib/opencode/env-runtime.test.js +12 -0
- package/server/lib/opencode/feature-routes-runtime.js +2 -0
- package/server/lib/opencode/lifecycle.js +18 -6
- package/server/lib/opencode/lifecycle.test.js +67 -1
- package/server/lib/opencode/proxy.js +32 -2
- package/server/lib/opencode/routes-upgrade.test.js +113 -0
- package/server/lib/opencode/routes.js +69 -36
- package/server/lib/opencode/server-utils-runtime.js +2 -0
- package/server/lib/opencode/settings-helpers.js +3 -0
- package/server/lib/opencode/settings-helpers.test.js +8 -0
- package/server/lib/opencode/upgrade-capability.js +36 -0
- package/server/lib/opencode/upgrade-capability.test.js +57 -0
- package/server/lib/quota/providers/codex.js +18 -0
- package/server/lib/quota/providers/codex.test.js +28 -0
- package/server/lib/scheduled-tasks/runtime.js +44 -18
- package/server/lib/scheduled-tasks/runtime.test.js +12 -1
- package/server/lib/session-goal/DOCUMENTATION.md +12 -3
- package/server/lib/system-prompt/DOCUMENTATION.md +36 -0
- package/server/lib/system-prompt/runtime.js +68 -0
- package/server/lib/system-prompt/runtime.test.js +76 -0
- package/server/opencode-proxy.test.js +49 -0
- package/dist/assets/index-Csh1A7Eh.css +0 -1
- package/dist/assets/miniChat-ComIlrTa.js +0 -2
- package/dist/assets/mobile-DUYXEkKA.js +0 -2
- package/dist/assets/renderMobileApp-m9MPmIZT.js +0 -16
- package/dist/assets/runtimeEndpointReset-B0yQKPe0.js +0 -174
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{_ as _s,c as Ns,a as _t,d as Nt,p as Dr,b as ta,R as ao}from"./vendor-.bun-DvcSrJLa.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function o(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(n){if(n.ep)return;n.ep=!0;const a=o(n);fetch(n.href,a)}})();const Et=1,Us="openchamber-relay-v1",oa=1,ra=12,Ct=1+ra,St=64*1024,Mt=5,Tt=128,na=0,aa=1,dt=4,Ls=1+dt,Xo=St-Mt-Ls,S={HttpRequest:1,HttpBody:2,HttpResponse:3,StreamEnd:4,StreamAbort:5,WsOpen:6,WsOpened:7,WsText:8,WsBinary:9,WsClose:10,Ping:11,Pong:12},Hs=new Set(Object.values(S)),js=e=>Hs.has(e),qe={DuplicateClient:4002,AuthFailed:4010,LimitExceeded:4029,ChannelFailure:1011},ve=globalThis.crypto.subtle,sa={name:"ECDH",namedCurve:"P-256"},ia=16,Ro=32,zs=16,Zo=4,ca=8;class xe extends Error{constructor(t){super(t),this.name="RelayCryptoError"}}const $s=()=>ve.generateKey(sa,!0,["deriveBits"]),Gs=async e=>{const t=await ve.exportKey("jwk",e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y}},qs=async e=>{if(e.kty!=="EC"||e.crv!=="P-256"||typeof e.x!="string"||typeof e.y!="string")throw new xe("invalid ECDH public key JWK");try{return await ve.importKey("jwk",{kty:e.kty,crv:e.crv,x:e.x,y:e.y,ext:!0},sa,!0,[])}catch{throw new xe("invalid ECDH public key JWK")}},Ws=()=>{const e=new Uint8Array(ia);return globalThis.crypto.getRandomValues(e),e},Vs=async(e,t,o)=>{if(o.length!==ia)throw new xe("invalid handshake nonce length");const r=await ve.deriveBits({name:"ECDH",public:t},e,256),n=await ve.importKey("raw",r,"HKDF",!1,["deriveBits"]),a=new Uint8Array(await ve.deriveBits({name:"HKDF",hash:"SHA-256",salt:o,info:new TextEncoder().encode(Us)},n,Ro*2*8)),s=(i,c)=>ve.importKey("raw",i,{name:"AES-GCM"},!1,c);return{clientToHost:await s(a.slice(0,Ro),["encrypt","decrypt"]),hostToClient:await s(a.slice(Ro),["encrypt","decrypt"])}},Ks=(e,t,o)=>{for(let r=ca-1;r>=0;r-=1)e[t+r]=Number(o&0xffn),o>>=8n},Js=(e,t)=>{let o=0n;for(let r=0;r<ca;r+=1)o=o<<8n|BigInt(e[t+r]);return o},Ys=e=>{const t=new Uint8Array(Zo);globalThis.crypto.getRandomValues(t);let o=0n;return{async encrypt(r){if(r.length>St)throw new xe("plaintext frame exceeds maximum size");o+=1n;const n=new Uint8Array(ra);n.set(t,0),Ks(n,Zo,o);const a=new Uint8Array(await ve.encrypt({name:"AES-GCM",iv:n},e,r)),s=new Uint8Array(Ct+a.length);return s[0]=oa,s.set(n,1),s.set(a,Ct),s}}},Qs=e=>{let t=0n;return{async decrypt(o){if(o.length<Ct+zs)throw new xe("encrypted frame too short");if(o[0]!==oa)throw new xe("unsupported encrypted frame version");const r=o.slice(1,Ct),n=Js(r,Zo);if(n<=t)throw new xe("frame counter regression");let a;try{a=await ve.decrypt({name:"AES-GCM",iv:r},e,o.slice(Ct))}catch{throw new xe("frame decryption failed")}return t=n,new Uint8Array(a)}}},$t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Xs=e=>{let t="";for(let o=0;o<e.length;o+=3){const r=e[o],n=o+1<e.length?e[o+1]:void 0,a=o+2<e.length?e[o+2]:void 0;t+=$t[r>>2],t+=$t[(r&3)<<4|(n??0)>>4],n!==void 0&&(t+=$t[(n&15)<<2|(a??0)>>6]),a!==void 0&&(t+=$t[a&63])}return t},rn=e=>{let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null)return null;const o=t;if(o.v!==Et)return null;const r=o.batch===!0;return o.t==="ready"?{t:"ready",v:Et,batch:r}:o.t==="hello"&&typeof o.nonce=="string"&&typeof o.clientPubJwk=="object"&&o.clientPubJwk!==null?{t:"hello",v:Et,clientPubJwk:o.clientPubJwk,nonce:o.nonce,batch:r}:null},Zs=e=>({type:"fail",closeCode:qe.ChannelFailure,reason:e}),ei=async(e,t={})=>{const o=t.batch!==!1,r=await qs(e),n=await $s(),a=Ws(),s={t:"hello",v:Et,clientPubJwk:await Gs(n.publicKey),nonce:Xs(a),...o?{batch:!0}:{}};let i=!1;return{helloText:JSON.stringify(s),get established(){return i},async handleText(c){if(i)return rn(c)?.t==="ready"?{type:"ignore"}:Zs("plaintext frame on established channel");const d=rn(c);if(d?.t!=="ready")return{type:"ignore"};const l=await Vs(n.privateKey,r,a);return i=!0,{type:"established",batch:o&&d.batch===!0,channel:{encryptor:Ys(l.clientToHost),decryptor:Qs(l.hostToClient)}}}}},da=4294967295;class Y extends Error{constructor(t){super(t),this.name="TunnelCodecError"}}const Ee=(e,t,o,r=!1)=>{if(!Number.isInteger(t)||t<0||t>da)throw new Y("invalid stream id");if(o.length>Xo)throw new Y("tunnel payload exceeds maximum size");const n=new Uint8Array(Mt+o.length);return n[0]=r?e|Tt:e,n[1]=t>>>24&255,n[2]=t>>>16&255,n[3]=t>>>8&255,n[4]=t&255,n.set(o,Mt),n},ti=e=>{if(e.length<Mt)throw new Y("tunnel frame too short");const t=e[0],o=(t&Tt)!==0,r=t&~Tt;if(!js(r))throw new Y(`unknown tunnel frame type ${r}`);const n=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;return{frameType:r,streamId:n,payload:e.slice(Mt),hasMoreFragments:o}},oi=new TextEncoder,ri=new TextDecoder,Gt=e=>oi.encode(JSON.stringify(e)),qt=(e,t)=>{let o;try{o=JSON.parse(ri.decode(e))}catch{throw new Y("malformed JSON tunnel payload")}if(!t(o))throw new Y("unexpected JSON tunnel payload shape");return o},la=(e,t=Xo)=>{if(t<=0||t>Xo)throw new Y("invalid chunk size");if(e.length===0)return[new Uint8Array(0)];const o=[];for(let r=0;r<e.length;r+=t)o.push(e.slice(r,r+t));return o},nn=(e,t,o)=>{const r=la(o);return r.map((n,a)=>Ee(e,t,n,a<r.length-1))},ni=(e=16*1024*1024)=>{const t=new Map;return{push(o){const r=`${o.streamId}:${o.frameType}`,n=t.get(r);if(!o.hasMoreFragments&&!n)return o.payload;const a=n?.chunks??[],s=(n?.totalBytes??0)+o.payload.length;if(s>e)throw t.delete(r),new Y("fragmented message exceeds maximum size");if(a.push(o.payload),o.hasMoreFragments)return t.set(r,{chunks:a,totalBytes:s}),null;t.delete(r);const i=new Uint8Array(s);let c=0;for(const d of a)i.set(d,c),c+=d.length;return i},dropStream(o){for(const r of t.keys())r.startsWith(`${o}:`)&&t.delete(r)}}},ai=e=>{if(e.length===0)throw new Y("cannot encode an empty frame batch");if(e.length===1){const n=e[0],a=new Uint8Array(1+n.length);if(a[0]=na,a.set(n,1),a.length>St)throw new Y("frame batch exceeds maximum plaintext size");return a}let t=1;for(const n of e)t+=dt+n.length;if(t>St)throw new Y("frame batch exceeds maximum plaintext size");const o=new Uint8Array(t);o[0]=aa;let r=1;for(const n of e)o[r]=n.length>>>24&255,o[r+1]=n.length>>>16&255,o[r+2]=n.length>>>8&255,o[r+3]=n.length&255,r+=dt,o.set(n,r),r+=n.length;return o},si=e=>{if(e.length<1)throw new Y("empty batch plaintext");const t=e[0];if(t===na)return[e.slice(1)];if(t!==aa)throw new Y(`unknown batch container tag ${t}`);const o=[];let r=1;for(;r<e.length;){if(r+dt>e.length)throw new Y("truncated batch frame length");const n=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0;if(r+=dt,r+n>e.length)throw new Y("truncated batch frame body");o.push(e.slice(r,r+n)),r+=n}if(o.length===0)throw new Y("empty frame batch");return o},ii=new Set([S.HttpBody,S.WsText,S.WsBinary]),ua=150,ci=24*1024,di=32,li=e=>{const t=e.windowMs??ua,o=e.maxBatchBytes??ci,r=e.maxBatchFrames??di,n=e.now??(()=>Date.now()),a=e.setTimer??((b,h)=>setTimeout(b,h)),s=e.clearTimer??(b=>clearTimeout(b));let i=[],c=0,d=null,l=0,u=!1;const m=()=>{d!==null&&(s(d),d=null)},g=()=>{if(m(),i.length===0)return;const b=i;i=[],c=0,l=n(),e.sendBatch(ai(b))};return{enqueue:b=>{if(u)return;const h=b[0]&~Tt;if(!ii.has(h)){i.push(b),g();return}const w=n();if(i.length===0&&w-l>=t){i.push(b),g();return}const D=dt+b.length;if(i.length>0&&1+c+D>St&&g(),i.push(b),c+=D,c>=o||i.length>=r){g();return}d===null&&(d=a(g,t))},flush:g,dispose(){u=!0,m(),i=[],c=0}}},ui=()=>{let e=1;return{next(){if(e>da)throw new Y("stream id space exhausted");const t=e;return e+=2,t}}},yo=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),fi=e=>yo(e)&&Object.values(e).every(t=>typeof t=="string"),mi=e=>yo(e)&&typeof e.status=="number"&&fi(e.headers),an=e=>yo(e)&&typeof e.reason=="string",gi=e=>yo(e)&&typeof e.code=="number"&&typeof e.reason=="string",fa=/^[a-z][a-z\d+.-]*:\/\//i,kr="http://tunnel.invalid",pi=e=>{try{const t=fa.test(e)?new URL(e):new URL(e,kr);return`${t.pathname}${t.search}`}catch{return e}},Wt=e=>({async*[Symbol.asyncIterator](){yield e}}),hi=e=>({async*[Symbol.asyncIterator](){const t=e.getReader();try{for(;;){const{done:o,value:r}=await t.read();if(o)return;r&&(yield r)}}finally{t.releaseLock()}}}),Fi=e=>{const t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),t},yi=async e=>{if(e==null)return{body:null};if(e instanceof ReadableStream)return{body:hi(e)};if(typeof e=="string")return{body:Wt(new TextEncoder().encode(e))};if(e instanceof ArrayBuffer)return{body:Wt(new Uint8Array(e.slice(0)))};if(ArrayBuffer.isView(e))return{body:Wt(Fi(e))};const t=new Response(e),o=t.headers.get("content-type")??void 0,r=new Uint8Array(await t.arrayBuffer());return{body:Wt(r),contentType:o}},bi=async(e,t)=>{let o;const r=new Headers;let n="GET",a=null,s;e instanceof Request?(o=e.url,n=e.method,e.headers.forEach((u,m)=>r.set(m,u)),s=e.signal,a=e.body):o=e.toString(),t&&(t.method&&(n=t.method),t.headers&&new Headers(t.headers).forEach((u,m)=>r.set(m,u)),t.body!==void 0&&(a=t.body),t.signal&&(s=t.signal));const i=fa.test(o)?new URL(o):new URL(o,kr),{body:c,contentType:d}=await yi(a);d&&!r.has("content-type")&&r.set("content-type",d);const l={};return r.forEach((u,m)=>{l[m]=u}),{method:n.toUpperCase(),path:i.pathname,query:i.search.startsWith("?")?i.search.slice(1):i.search,headers:l,body:c,signal:s}},Io=new Uint8Array(0),Ai=new TextEncoder,wi=new TextDecoder,le=e=>e instanceof Error?e:new Error(String(e)),Vt=()=>new DOMException("The operation was aborted.","AbortError"),Ei=e=>{e.binaryType="arraybuffer";const t={get readyState(){return e.readyState},send(o){e.send(o)},close(o,r){e.close(o,r)},onopen:null,onmessage:null,onclose:null,onerror:null};return e.onopen=()=>t.onopen?.(),e.onmessage=o=>t.onmessage?.({data:o.data}),e.onclose=o=>t.onclose?.({code:o.code,reason:o.reason}),e.onerror=()=>t.onerror?.(),t},Ci=e=>{const t={get readyState(){return e.readyState},get binaryType(){return e.binaryType},set binaryType(o){o&&(e.binaryType=o)},onopen:null,onmessage:null,onerror:null,onclose:null,send(o){e.send(o)},close(o,r){e.close(o,r)}};return e.onopen=()=>t.onopen?.(),e.onmessage=o=>{const r=o.data;(typeof r=="string"||r instanceof ArrayBuffer)&&t.onmessage?.({data:r})},e.onerror=()=>t.onerror?.(),e.onclose=o=>t.onclose?.({code:o.code,reason:o.reason}),t},sn=0,xo=1,cn=2,dn=3,Bi=new Set([qe.AuthFailed,qe.DuplicateClient,qe.LimitExceeded]),Di={[qe.AuthFailed]:"relay authentication failed",[qe.DuplicateClient]:"relay connection replaced by another client",[qe.LimitExceeded]:"relay connection limit reached"},ln=()=>{const e=typeof navigator<"u"&&navigator.onLine===!1,t=typeof document<"u"&&document.visibilityState==="hidden";return e||t},vr=e=>{const t=e.helloRetryMs??1e3,o=e.helloTimeoutMs??3e4,r=e.pingIntervalMs??3e4,n=e.pingTimeoutMs??15e3,a=e.batchWindowMs??ua,s=e.batch!==!1,i=e.reconnectBaseDelayMs??1e3,c=e.reconnectMaxDelayMs??3e4,d=e.hiddenOrOfflineMaxDelayMs??6e4,l=e.createWireSocket??(A=>Ei(new WebSocket(A)));let u=!1,m={state:"idle"};const g=new Set;let p=null,b=null,h=null,w=0,D=0,B=null,_=[],re=!1;const de=A=>{if(!(m.state===A.state&&m.lastError===A.lastError)){m=A;for(const M of g)try{M(m)}catch{}}},pt=A=>{const M=_;_=[];for(const E of M)E.reject(A)},vo=A=>{const M=_;_=[];for(const E of M)E.resolve(A)},Zr=(A,M)=>{A.dead=!0;const E=Array.from(A.streams.values());A.streams.clear();for(const C of E)try{C.fail(M)}catch{}},So=()=>{B!==null&&(clearTimeout(B),B=null)},Mo=()=>{u||B===null||ln()||(So(),To(),Po())},en=()=>{typeof document<"u"&&document.visibilityState==="visible"&&Mo()},Ts=()=>{re||typeof window>"u"||(re=!0,window.addEventListener("online",Mo),typeof document<"u"&&document.addEventListener("visibilitychange",en))},To=()=>{!re||typeof window>"u"||(re=!1,window.removeEventListener("online",Mo),typeof document<"u"&&document.removeEventListener("visibilitychange",en))},tn=()=>{if(u||B!==null)return;const A=Math.max(0,D-1),M=i*2**Math.min(A,10),E=ln()?d:c,C=Math.min(E,M);Ts(),B=setTimeout(()=>{B=null,To(),Po()},C)},Ps=()=>{const A=new URL(e.relayUrl);return A.searchParams.set("v",String(Et)),A.searchParams.set("role","client"),A.searchParams.set("serverId",e.serverId),e.grant&&A.searchParams.set("grant",e.grant),A.toString()},Po=async()=>{if(u)return;So(),w+=1;const A=w;de({state:D>0?"reconnecting":"connecting",lastError:m.lastError});let M;try{M=await ei(e.hostEncPubJwk,{batch:s})}catch(R){if(A!==w||u)return;ht(A,le(R),!0);return}if(A!==w||u)return;let E;try{E=l(Ps())}catch(R){ht(A,le(R));return}b=E;let C=!1,k=null,T=null,ne=null,q=null,v=Promise.resolve(),P=null,N=null,Ae=!1,H=null,W=Date.now();const Q=()=>{k!==null&&(clearInterval(k),k=null),T!==null&&(clearTimeout(T),T=null),ne!==null&&(clearInterval(ne),ne=null),q!==null&&(clearTimeout(q),q=null),H!==null&&(H.dispose(),H=null)};h=Q;function V(R,x=!1,U=!1){if(!(C||A!==w)){C=!0,Q(),P&&(p=null,Zr(P,new Error(`relay tunnel reset: ${R.message}`))),pt(R);try{E.close()}catch{}if(b===E&&(b=null),!u){if(D+=1,U){de({state:"error",lastError:R.message});return}de({state:x?"error":"reconnecting",lastError:R.message}),tn()}}}const O=()=>{try{E.send(M.helloText)}catch{}},Ne=(R,x)=>{N=R,Ae=x,k!==null&&(clearInterval(k),k=null),T!==null&&(clearTimeout(T),T=null);const U=new Map,j=ui(),Ue=ni();let se=Promise.resolve();const we=et=>{se=se.then(async()=>{if(Ze.dead)return;const zt=await R.encryptor.encrypt(et);E.send(zt)}).catch(()=>{})},Le=x?li({windowMs:a,sendBatch:we}):null;H=Le;const Ze={streams:U,assembler:Ue,nextStreamId:()=>j.next(),dead:!1,send(et){if(Ze.dead)return;const zt=et[0]&~Tt;zt!==S.Ping&&zt!==S.Pong&&(W=Date.now()),Le?Le.enqueue(et):we(et)}};P=Ze,p=Ze,D=0,W=Date.now(),de({state:"connected"}),vo(Ze),ne=setInterval(()=>{Date.now()-W<r||(Ze.send(Ee(S.Ping,0,Io)),q===null&&(q=setTimeout(()=>{q=null,V(new Error("relay keepalive timeout"))},n)))},r)},ae=(R,x)=>{let U;try{U=ti(x)}catch(se){V(le(se));return}if(q!==null&&(clearTimeout(q),q=null),U.frameType===S.Ping){R.send(Ee(S.Pong,U.streamId,Io));return}if(U.frameType===S.Pong)return;W=Date.now();let j=U.payload;if(U.frameType===S.WsText||U.frameType===S.WsBinary){let se;try{se=R.assembler.push(U)}catch(we){V(le(we));return}if(se===null)return;j=se}else if(U.hasMoreFragments){V(new Error("unexpected fragmented tunnel frame"));return}const Ue=R.streams.get(U.streamId);Ue&&Ue.handleFrame(U.frameType,j)};E.onopen=()=>{C||A!==w||(O(),k=setInterval(O,t))},E.onmessage=R=>{if(C||A!==w)return;const x=R.data;if(typeof x=="string"){v=v.then(async()=>{if(C||A!==w)return;const j=await M.handleText(x);if(j.type==="established"){if(N)return;Ne(j.channel,j.batch)}else j.type==="fail"&&V(new Error(`relay handshake failed: ${j.reason}`))}).catch(j=>{V(le(j))});return}const U=x instanceof ArrayBuffer?new Uint8Array(x):x instanceof Uint8Array?x:null;U&&(v=v.then(async()=>{if(C||A!==w)return;const j=P,Ue=N;if(!j||!Ue){V(new Error("encrypted frame before handshake completed"));return}let se;try{se=await Ue.decryptor.decrypt(U)}catch(we){V(le(we));return}if(Ae){let we;try{we=si(se)}catch(Le){V(le(Le));return}for(const Le of we){if(C||A!==w||j.dead)return;ae(j,Le)}return}ae(j,se)}).catch(j=>{V(le(j))}))},E.onclose=R=>{const x=Bi.has(R.code);V(new Error(Di[R.code]??`relay socket closed (code ${R.code})`),x,x)},E.onerror=()=>{},T=setTimeout(()=>{T=null,V(new Error("relay handshake timeout"),!0)},o);function ht(R,x,U=!1){R!==w||u||(pt(x),D+=1,de({state:U?"error":"reconnecting",lastError:x.message}),tn())}},on=A=>u?Promise.reject(new Error("relay tunnel closed")):A?.aborted?Promise.reject(Vt()):p&&!p.dead?Promise.resolve(p):new Promise((M,E)=>{let C=null;const k={resolve(T){C&&A&&A.removeEventListener("abort",C),M(T)},reject(T){C&&A&&A.removeEventListener("abort",C),E(T)}};A&&(C=()=>{_=_.filter(T=>T!==k),E(Vt())},A.addEventListener("abort",C,{once:!0})),_.push(k)}),Rs=async(A,M)=>{const E=await bi(A,M),C=E.signal;if(C?.aborted)throw Vt();const k=await on(C),T=k.nextStreamId();return await new Promise((ne,q)=>{let v=!1,P=!1,N=null,Ae=null;const H=()=>{k.streams.delete(T),k.assembler.dropStream(T),Ae&&C&&C.removeEventListener("abort",Ae)},W=O=>{if(!P){if(P=!0,H(),!v){q(O);return}try{N?.error(O)}catch{}}},Q=O=>{k.dead||k.send(Ee(S.StreamAbort,T,Gt({reason:O})))};Ae=()=>{Q("aborted"),W(Vt())},k.streams.set(T,{handleFrame(O,Ne){if(O===S.HttpResponse){if(v||P)return;let ae;try{ae=qt(Ne,mi)}catch(x){Q("malformed response head"),W(le(x));return}const ht=ae.status===204||ae.status===205||ae.status===304;let R=null;ht||(R=new ReadableStream({start(x){N=x},cancel(){P||(P=!0,H(),Q("response body cancelled"))}})),v=!0,ne(new Response(R,{status:ae.status,headers:ae.headers})),ht&&(P=!0,H());return}if(O===S.HttpBody){if(!v||P)return;try{N?.enqueue(Ne)}catch{}return}if(O===S.StreamEnd){if(P)return;if(!v){W(new Error("tunnel stream ended before response head"));return}P=!0,H();try{N?.close()}catch{}return}if(O===S.StreamAbort){let ae="stream aborted by host";try{ae=qt(Ne,an).reason}catch{}W(new Error(ae))}},fail(O){W(O)}}),C&&C.addEventListener("abort",Ae,{once:!0});const V={method:E.method,path:E.path,query:E.query,headers:E.headers};k.send(Ee(S.HttpRequest,T,Gt(V))),(async()=>{try{if(E.body)for await(const O of E.body){if(P||k.dead)return;for(const Ne of la(O))k.send(Ee(S.HttpBody,T,Ne))}!P&&!k.dead&&k.send(Ee(S.StreamEnd,T,Io))}catch(O){Q("request body failed"),W(le(O))}})()})},Is=A=>{const M=A.indexOf("?");return M===-1?{path:A,query:""}:{path:A.slice(0,M),query:A.slice(M+1)}},xs=(A,M)=>{let E=sn,C=null,k=0,T=!1;const ne={get readyState(){return E},onopen:null,onmessage:null,onerror:null,onclose:null,send(v){if(E!==xo||!C||C.dead)throw new Error("relay tunnel socket is not open");if(typeof v=="string"){for(const N of nn(S.WsText,k,Ai.encode(v)))C.send(N);return}const P=v instanceof ArrayBuffer?new Uint8Array(v.slice(0)):(()=>{const N=new Uint8Array(v.byteLength);return N.set(new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),N})();for(const N of nn(S.WsBinary,k,P))C.send(N)},close(v=1e3,P=""){E===dn||E===cn||(E===xo&&C&&!C.dead&&(E=cn,C.send(Ee(S.WsClose,k,Gt({code:v,reason:P})))),q(v,P))}},q=(v,P,N=!1)=>{if(!T){if(T=!0,C&&(C.streams.delete(k),C.assembler.dropStream(k)),E=dn,N)try{ne.onerror?.()}catch{}try{ne.onclose?.({code:v,reason:P})}catch{}}};return(async()=>{let v;try{v=await on()}catch(H){q(1006,le(H).message,!0);return}if(T)return;C=v,k=v.nextStreamId(),v.streams.set(k,{handleFrame(H,W){if(H===S.WsOpened){if(E===sn){E=xo;try{ne.onopen?.()}catch{}}return}if(H===S.WsText){try{ne.onmessage?.({data:wi.decode(W)})}catch{}return}if(H===S.WsBinary){const Q=new ArrayBuffer(W.byteLength);new Uint8Array(Q).set(W);try{ne.onmessage?.({data:Q})}catch{}return}if(H===S.WsClose){let Q=1e3,V="";try{const O=qt(W,gi);Q=O.code,V=O.reason}catch{}q(Q,V);return}if(H===S.StreamAbort){let Q="stream aborted";try{Q=qt(W,an).reason}catch{}q(1006,Q,!0)}},fail(H){q(1012,H.message,!0)}});const{path:P,query:N}=Is(A),Ae=M&&M.length>0?{path:P,query:N,protocols:M}:{path:P,query:N};v.send(Ee(S.WsOpen,k,Gt(Ae)))})(),ne},Os=()=>{if(u)return;u=!0,w+=1,So(),To(),h?.(),h=null;const A=p;p=null;const M=new Error("relay tunnel closed");A&&Zr(A,M),pt(M);try{b?.close()}catch{}b=null,de({state:"idle"})};return Po(),{fetch:Rs,openWebSocket:xs,getStatus:()=>m,subscribeStatus(A){return g.add(A),()=>{g.delete(A)}},close:Os}};let ce=null,Bt=null;const ki=(e,t)=>e.relayUrl===t.relayUrl&&e.serverId===t.serverId&&e.grant===t.grant&&JSON.stringify(e.hostEncPubJwk)===JSON.stringify(t.hostEncPubJwk),bo=()=>ce,Tp=()=>ce!==null,vi=e=>(ce&&Bt&&ki(Bt,e)||(ce?.close(),Bt=e,ce=vr(e)),ce),Pp=(e,t)=>{ce!==t&&(ce?.close(),Bt=e,ce=t)},Si=()=>{ce?.close(),ce=null,Bt=null};let ma=()=>null,ga="",so={},Ve="",Pt=0,ze=null,ct="",Rt=0,Ke="",$e=null,Pe="",to=0,oo=0;const Sr=1e4,Mi=e=>e.toLowerCase()==="authorization",pa=e=>{const t={};for(const[o,r]of Object.entries(e||{})){const n=o.trim(),a=r.trim();n&&a&&!Mi(n)&&(t[n]=a)}return t},Ti=(e,t)=>{const o=Object.entries(e);return o.length!==Object.keys(t).length?!1:o.every(([r,n])=>t[r]===n)},Ao=e=>typeof e!="string"?"":e.trim(),Pi=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_CLIENT_TOKEN__;return Ao(e)},Ri=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return typeof e=="string"?e.trim():""},ha=(e,t)=>{const o=typeof e=="string"&&e.trim()?e.trim():Ri();if(!o)return t;try{return new URL(t,`${o.replace(/\/+$/,"")}/`).toString()}catch{return t}},Mr=e=>{try{return new URL(e).origin}catch{return""}},Fa=()=>{ct="",Rt=0,Ke="",$e=null,Pe="",to+=1},wo=()=>{Ve="",Pt=0,Fa()},ya=()=>{oo+=1,ze=null,wo(),Tr()},ba=e=>{const t=Ao(e);ga=t,ya(),ma=()=>t?{type:"bearer",token:t}:null},Aa=e=>{const t=pa(e);Ti(so,t)||(so=t,ya())},Eo=()=>{if(Object.keys(so).length>0)return so;if(typeof window>"u")return{};const e=window.__OPENCHAMBER_RUNTIME_HEADERS__;return e&&typeof e=="object"?pa(e):{}},wa=()=>ga||Pi(),Ii=(e,t)=>{const o=Ao(e);if(!o||typeof t!="number"||!Number.isFinite(t)){wo();return}const r=Ve;Ve=o,Pt=t,r&&r!==o&&Ui()},Ea=()=>!Ve||Pt<=Date.now()+Sr?(wo(),""):Ve,Ca=e=>{const t=Mr(e);return!t||Ke!==t?"":!ct||Rt<=Date.now()+Sr?(ct="",Rt=0,Ke="",""):ct},xi=()=>{const e=Ea();return!e&&(wa()||typeof window<"u")&&Co().catch(()=>{}),e},Oi=e=>{const t=e?Ca(e):"";return!t&&e&&typeof window<"u"&&ka(e).catch(()=>{}),t},Ba=async()=>{const e=await ma(),t=e?.type==="bearer"?Ao(e.token):wa();return t?{type:"bearer",token:t}:null},Da=e=>{if(ze)return ze;const t=oo,r=(async()=>{const n=await Ba(),a=new Headers;for(const[u,m]of Object.entries(Eo()))a.set(u,m);n?.type==="bearer"&&a.set("Authorization",`Bearer ${n.token}`);const s=bo(),i=s?await s.fetch("/auth/url-token",{method:"POST",headers:a}):await fetch(ha(e,"/auth/url-token"),{method:"POST",headers:a,credentials:"include"});if(!i.ok)throw t===oo&&wo(),new Error(`Failed to mint runtime URL auth token (${i.status})`);const c=await i.json().catch(()=>null),d=typeof c?.token=="string"?c.token.trim():"",l=typeof c?.expiresAt=="number"?c.expiresAt:0;if(t!==oo)throw new Error("Runtime URL auth token response is stale");if(Ii(d,l),!Ve)throw new Error("Runtime URL auth token response was invalid");return Ve})().finally(()=>{ze===r&&(ze=null)});return ze=r,ze},_i=e=>{const t=Mr(e);if(!t)return Promise.reject(new Error("Local runtime URL auth origin was invalid"));if($e&&Pe===t)return $e;const o=to,n=(async()=>{const a=await fetch(ha(t,"/auth/url-token"),{method:"POST",credentials:"include"});if(!a.ok)throw o===to&&t===Pe&&(ct="",Rt=0,Ke=""),new Error(`Failed to mint local runtime URL auth token (${a.status})`);const s=await a.json().catch(()=>null),i=typeof s?.token=="string"?s.token.trim():"",c=typeof s?.expiresAt=="number"?s.expiresAt:0;if(!i||!Number.isFinite(c))throw new Error("Local runtime URL auth token response was invalid");if(o!==to||t!==Pe)throw new Error("Local runtime URL auth token response is stale");return ct=i,Rt=c,Ke=t,i})().finally(()=>{$e===n&&($e=null,Pe="")});return $e=n,Pe=t,$e},Co=async e=>{const t=Ea();return t||Da(e)},ka=async e=>{const t=Mr(e);if(!t)throw new Error("Local runtime URL auth origin was invalid");const o=Ca(t);return o||((Ke&&Ke!==t||Pe&&Pe!==t)&&Fa(),_i(t))};let st=0,Dt=null,va=null;const er=new Set,Ni=5e3,Ui=()=>{for(const e of er)try{e()}catch{}},Sa=()=>{Dt!==null&&(clearTimeout(Dt),Dt=null)},Tr=()=>{if(Sa(),st<=0||typeof window>"u")return;const e=Pt-Sr-Ni,t=Pt>0?Math.max(0,e-Date.now()):0;Dt=setTimeout(()=>{Dt=null,!(st<=0)&&Da(va).catch(()=>{}).finally(()=>{Tr()})},t)},Rp=e=>{typeof e=="string"&&e.trim()&&(va=e.trim()),st+=1,Tr();let t=!1;return()=>{t||(t=!0,st=Math.max(0,st-1),st===0&&Sa())}},Ip=e=>(er.add(e),()=>{er.delete(e)}),Li=async e=>{const t=new Headers(e);for(const[r,n]of Object.entries(Eo()))t.has(r)||t.set(r,n);if(t.has("Authorization"))return t;const o=await Ba();return o?.type==="bearer"&&t.set("Authorization",`Bearer ${o.token}`),t},io=/^[a-z][a-z\d+.-]*:\/\//i,Hi=e=>{const t=e.trim();return t?t.startsWith("/")?t:`/${t}`:"/"},co=e=>typeof e!="string"?"":e.trim().replace(/\/+$/,""),ji=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return co(e)},zi=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_LOCAL_ORIGIN__;return co(e)},$i=()=>Object.keys(Eo()).length>0,Gi=e=>{const t=e.currentHref?.();return t||(typeof window<"u"?window.location.href||window.location.origin:"")},tr=(e,t)=>{if(!t)return;const o=t instanceof URLSearchParams?Array.from(t.entries()):Object.entries(t);for(const[r,n]of o)n!=null&&e.searchParams.set(r,String(n))},qi=(e,t)=>{if(!t)return e;const o=new URLSearchParams;tr({searchParams:o},t);const r=o.toString();return r?e.includes("?")?`${e}&${r}`:`${e}?${r}`:e},un=(e,t,o)=>{if(io.test(t)){const a=new URL(t);return tr(a,o),a.toString()}const r=Hi(t);if(!e)return qi(r,o);const n=new URL(r,`${e}/`);return tr(n,o),n.toString()},Oo=e=>{const t=xi();if(!t)return e;const o=io.test(e)?new URL(e):new URL(e,"http://openchamber.local");return o.searchParams.set("oc_url_token",t),io.test(e)?o.toString():`${o.pathname}${o.search}${o.hash}`},Ma=(e,t)=>{const o=io.test(e)?new URL(e):new URL(e,Gi(t));return o.protocol==="ws:"||o.protocol==="wss:"||(o.protocol=o.protocol==="https:"?"wss:":"ws:"),o.toString()},fn=(e,t,o)=>{if(!$i())return null;const r=zi();if(!r)return null;try{const n=new URL(`/api/openchamber/realtime-proxy/${e==="sse"?"sse":"ws"}`,`${r}/`);n.searchParams.set("url",t);const a=Oi(r);return a&&n.searchParams.set("oc_url_token",a),e==="ws"?(n.protocol=n.protocol==="https:"?"wss:":"ws:",Ma(n.toString(),o)):n.toString()}catch{return null}},Pr=(e={})=>{const t=co(e.apiBaseUrl),o=co(e.realtimeBaseUrl),r=()=>t||ji(),n=()=>o||r(),a=(i,c)=>un(r(),i,c),s=(i,c)=>un(n(),i,c);return{api:a,authenticatedAsset:(i,c)=>Oo(a(i,c)),auth:a,health:i=>a("/health",i),rawFile:(i,c)=>a("/api/fs/raw",{path:i,download:c?.download===!0?!0:void 0,allowOutsideWorkspace:c?.allowOutsideWorkspace===!0?!0:void 0,outsideFileGrant:c?.outsideFileGrant}),sse:(i,c)=>{const d=Oo(s(i,c));return fn("sse",d,e)||d},websocket:(i,c)=>{const d=Ma(Oo(s(i,c)),e);return fn("ws",d,e)||d}}};let lo=Pr();const oe=()=>lo,Wi=e=>{lo=e},Ta=e=>(lo=Pr(e),lo),Je=e=>e.startsWith("/api/")||e==="/api"||e.startsWith("/auth/")||e==="/auth"||e==="/health",Vi=()=>typeof window>"u"?"":window.location.origin||"",Rr=e=>{if(typeof window>"u")return!1;const t=Vi();if(t&&e.origin===t)return!0;try{const o=new URL(window.location.href||t);return e.protocol===o.protocol&&e.host===o.host}catch{return!1}},Ir=e=>/^[a-z][a-z\d+.-]*:\/\//i.test(e),xr=(e,t)=>{if(!t)return;const o=t instanceof URLSearchParams?Array.from(t.entries()):Object.entries(t);for(const[r,n]of o)n!=null&&e.searchParams.set(r,String(n))},ro=e=>{try{const t=oe().api("/api");if(!/^[a-z][a-z\d+.-]*:\/\//i.test(t))return!1;const o=new URL(t);return e.origin!==o.origin?!1:Je(e.pathname)}catch{return!1}},_o=e=>{if(Je(e))return!0;if(!/^[a-z][a-z\d+.-]*:\/\//i.test(e))return!1;try{const t=new URL(e);return Rr(t)&&Je(t.pathname)}catch{return!1}},Ki=(e,t)=>{try{const o=new URL(e);if(!Rr(o))return e;const r=We(`${o.pathname}${o.search}`,t);return!Ir(r)&&(o.protocol==="http:"||o.protocol==="https:")?(xr(o,t),o.toString()):o.hash?`${r}${o.hash}`:r}catch{return e}},We=(e,t)=>e==="/health"?oe().health(t):e.startsWith("/auth/")||e==="/auth"?oe().auth(e,t):Je(e)?oe().api(e,t):/^[a-z][a-z\d+.-]*:\/\//i.test(e)?Ki(e,t):e,Ji=e=>{const t=e instanceof Request?e.url:e.toString();if(!Ir(t))return Je(t);try{return ro(new URL(t))}catch{return!1}},Yi=e=>{for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>255)return!1;return!0},Qi=(e,t)=>!Yi(t),mn=e=>{if(!e)return;const t=e instanceof Headers?Array.from(e.entries()):Array.isArray(e)?e:Object.entries(e);if(t.length===0)return;const o=[];let r=!1,n=!1;for(const[a,s]of t)Qi(a,s)?(o.push([a,encodeURIComponent(s)]),r=!0,a.toLowerCase()==="x-opencode-directory"&&(n=!0)):o.push([a,s]);return n&&o.push(["x-opencode-directory-encoding","uri"]),r?o:void 0},Ce=async(e,t,o=!0)=>{const r=new Headers(mn(e)??e);return t&&new Headers(mn(t)??t).forEach((n,a)=>r.set(a,n)),o?Li(r):r},Xi=(e,t)=>{if(!t)return e;const o=new URL(e,kr);return xr(o,t),`${o.pathname}${o.search}`},Pa=(e,t)=>{const o=e instanceof Request?e.url:e.toString();if(!Ir(o))return Je(o)?Xi(o,t):null;try{const r=new URL(o);return!Rr(r)||!Je(r.pathname)?null:(xr(r,t),`${r.pathname}${r.search}`)}catch{return null}},Zi=async(e,t,o)=>{const r=bo();if(!r)return null;const n=Pa(e,o);if(n===null)return null;const a=e instanceof Request?e.headers:void 0,s=await Ce(a,t.headers,!0);return e instanceof Request?r.fetch(e,{...t,headers:s}):r.fetch(n,{...t,headers:s})},ec=(e,t)=>{if(typeof e=="string")return We(e,t);if(e instanceof URL)return We(e.toString(),t);const o=We(e.url,t);return o===e.url?e:new Request(o,e)},tc=/\/api\/(config|path|app\/agents|agent|project|command)(\b|\/|\?|$)/,Kt=new Map,oc=(e,t,o)=>o||e!=="GET"||t.includes("/event")||!tc.test(t)?null:`GET ${t}`,f=async(e,t={})=>{const{query:o,...r}=t,n=bo(),a=n?Pa(e,o):null;let s,i,c;if(n&&a!==null){const g=e instanceof Request?e.headers:void 0,p=await Ce(g,r.headers,!0);s=e instanceof Request?()=>n.fetch(e,{...r,headers:p}):()=>n.fetch(a,{...r,headers:p}),i=a,c=String(r.method??(e instanceof Request?e.method:"GET")).toUpperCase()}else{const g=ec(e,o),p=g instanceof Request?g.headers:void 0,b=await Ce(p,r.headers,Ji(g));s=g instanceof Request?()=>fetch(new Request(g,{...r,headers:b})):()=>fetch(g,{...r,headers:b}),i=g instanceof Request?g.url:g instanceof URL?g.toString():String(g),c=String(r.method??(g instanceof Request?g.method:"GET")).toUpperCase()}const d=r.signal!=null||e instanceof Request,l=oc(c,i,d);if(!l)return s();const u=Kt.get(l);if(u)return u.then(g=>g.clone());const m=s();return Kt.set(l,m),m.then(()=>Kt.delete(l),()=>Kt.delete(l)),m.then(g=>g.clone())};let gn=!1;const rc=()=>{if(gn||typeof window>"u")return;gn=!0;const e=window.fetch.bind(window);window.fetch=async(t,o)=>{const r=await Zi(t,o??{});if(r)return r;if(typeof t=="string"){if(!_o(t)){try{const a=new URL(t);if(ro(a)){const s=await Ce(void 0,o?.headers);return e(t,{...o,headers:s})}}catch{}return e(t,o)}const n=await Ce(void 0,o?.headers);return e(We(t),{...o,headers:n})}if(t instanceof URL){const n=t.toString();if(!_o(n)){if(ro(t)){const s=await Ce(void 0,o?.headers);return e(t,{...o,headers:s})}return e(t,o)}const a=await Ce(void 0,o?.headers);return e(We(n),{...o,headers:a})}if(t instanceof Request){if(!_o(t.url)){try{const i=new URL(t.url);if(ro(i)){const c=await Ce(t.headers,o?.headers);return e(new Request(t,{...o,headers:c}))}}catch{}return e(t,o)}const n=await Ce(t.headers,o?.headers),a=We(t.url),s=a===t.url?t:new Request(a,t);return e(new Request(s,{...o,headers:n}))}return e(t,o)}},or="openchamber:runtime-endpoint-changed",rr="openchamber:runtime-endpoint-will-change";let uo="",It="";const No=(e,t,o)=>{try{e[t]=o}catch{}},Or=e=>{try{const t=new URL(e);return t.hash="",t.search="",t.pathname=t.pathname.replace(/\/+$/,"")||"/",`url:${t.toString().replace(/\/+$/,"")}`}catch{return`url:${e.trim().replace(/\/+$/,"")||"default"}`}},Ra=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return typeof e=="string"?e.trim():""},Ia=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_LOCAL_ORIGIN__;return typeof e=="string"?e.trim():""},xa=(e,t)=>{if(!e||!t)return!1;try{return new URL(e).origin===new URL(t).origin}catch{return!1}},_r=()=>uo||Ra(),L=()=>{if(It)return It;const e=_r();return xa(e,Ia())?"local":Or(e)},nc=(e={})=>{if(uo||It)return;const t=e.apiBaseUrl?.trim()||Ra();t&&(uo=t,It=e.runtimeKey?.trim()||(xa(t,Ia())?"local":Or(t)))},nr=e=>{const t=e.apiBaseUrl.trim(),o=_r(),r=L(),n=e.runtimeKey?.trim()||Or(t),a={apiBaseUrl:t,previousApiBaseUrl:o,runtimeKey:n,previousRuntimeKey:r};if(typeof window<"u"&&window.dispatchEvent(new CustomEvent(rr,{detail:a})),uo=t,It=n,typeof window<"u"){const s=window;No(s,"__OPENCHAMBER_API_BASE_URL__",t),No(s,"__OPENCHAMBER_CLIENT_TOKEN__",e.clientToken||void 0),No(s,"__OPENCHAMBER_RUNTIME_HEADERS__",e.requestHeaders||void 0)}Ta({apiBaseUrl:t,realtimeBaseUrl:t}),Aa(e.requestHeaders||null),ba(e.clientToken||null),e.relay?vi(e.relay):Si(),Co(t).catch(()=>{}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(or,{detail:a}))},ac=e=>{if(typeof window>"u")return()=>{};const t=o=>{e(o.detail)};return window.addEventListener(rr,t),()=>window.removeEventListener(rr,t)},Oa=e=>{if(typeof window>"u")return()=>{};const t=o=>{e(o.detail)};return window.addEventListener(or,t),()=>window.removeEventListener(or,t)},sc=["local","remote",null],ic=["ok","not-configured","unreachable","incompatible","wrong-service","missing"];function _a(e){if(!e||typeof e!="object")return{valid:!1};const t=e,o=t.localAvailable===!1?{localAvailable:!1}:{},r=t.target,n=t.status;if(r!==null&&(typeof r!="string"||!sc.includes(r)))return{valid:!1};if(typeof n!="string"||!ic.includes(n))return{valid:!1};if(r==="remote"||r==="local"){if(n==="ok"&&r==="local")return{valid:!0,outcome:{target:"local",status:"ok",...o}};if(n==="ok"&&r==="remote")return typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"ok",hostId:t.hostId,url:t.url,...o}};if(n==="unreachable")return r==="local"?{valid:!0,outcome:{target:"local",status:"unreachable",...o}}:typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"unreachable",hostId:t.hostId,url:t.url,...o}};if(n==="incompatible"||n==="wrong-service")return r!=="remote"?{valid:!1}:typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:n,hostId:t.hostId,url:t.url,...o}};if(n==="missing")return r!=="remote"?{valid:!1}:typeof t.hostId!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"missing",hostId:t.hostId,...o}}}if(r===null){if(n==="not-configured")return{valid:!0,outcome:{target:null,status:"not-configured",...o}};if(n==="missing")return{valid:!1}}return{valid:!1}}function xp(e){if(!e.isDesktopShell)return null;const t=e.bootOutcome;if(!t)return null;const o=t.localAvailable===!1?{localAvailable:!1}:{};if(t.status==="ok"){if(t.target==="local")return{screen:"main",...o};if(t.target==="remote")return{screen:"main",hostId:t.hostId,url:t.url,...o}}if(t.target===null&&t.status==="not-configured")return{screen:"chooser",...o};if(t.target==="local"&&t.status==="unreachable")return{screen:"chooser",...o};if(t.target==="remote"){if(t.status==="unreachable")return{screen:"recovery",variant:"remote-unreachable",hostId:t.hostId,url:t.url,...o};if(t.status==="incompatible")return{screen:"recovery",variant:"remote-incompatible",hostId:t.hostId,url:t.url,...o};if(t.status==="wrong-service")return{screen:"recovery",variant:"remote-wrong-service",hostId:t.hostId,url:t.url,...o};if(t.status==="missing")return{screen:"recovery",variant:"remote-missing",hostId:t.hostId,...o}}return null}function Op(e){return e.isDesktopShell?e.bootOutcomeKnown?e.bootViewIsMain===!1?!0:e.isInitialized:!1:e.isInitialized}function _p(e){return e.isDesktopShell&&!e.isDesktopLocalOriginActive}function cc(){if(dc()!=="valid")return null;const t=window.__OPENCHAMBER_DESKTOP_BOOT_OUTCOME__,o=_a(t);return o.valid?o.outcome:null}function dc(){if(typeof window>"u")return"not-injected";const e=window.__OPENCHAMBER_DESKTOP_BOOT_OUTCOME__;return e==null?"not-injected":_a(e).valid?"valid":"malformed"}let ar=null;const Np=e=>{ar=e},Bo=()=>ar||(typeof window>"u"?null:window.__OPENCHAMBER_RUNTIME_APIS__??null),lc=()=>typeof window>"u"?null:window.__OPENCHAMBER_ELECTRON__??null,mt=()=>typeof window>"u"?null:window.__OPENCHAMBER_DESKTOP__??null,Ut=()=>lc()?.runtime==="electron",Na=()=>{if(typeof window>"u")return null;const e=window.__OPENCHAMBER_PLATFORM__;return typeof e=="string"?e:null},uc="right",Up=()=>{if(!Ut())return!1;const e=Na();return e==="win32"||e==="linux"},Lp=e=>e==="left"?"left":uc,Hp=e=>e==="left"?["close","minimize","maximize"]:["minimize","maximize","close"],Z=()=>typeof mt()?.invoke=="function",gt=()=>Ut()&&Z(),G=async(e,t)=>{const o=mt();return typeof o?.invoke!="function"?null:o.invoke(e,t??{})},jp=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_launch_at_login");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"?null:e}catch(e){return console.warn("Failed to get launch at login status",e),null}},zp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_launch_at_login",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"?null:t}catch(t){return console.warn("Failed to set launch at login status",t),null}},$p=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_minimize_to_tray");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"?null:e}catch(e){return console.warn("Failed to get minimize to tray status",e),null}},Gp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_minimize_to_tray",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"?null:t}catch(t){return console.warn("Failed to set minimize to tray status",t),null}},qp=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_keep_awake");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"||typeof e.active!="boolean"?null:e}catch(e){return console.warn("Failed to get keep awake status",e),null}},Wp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_keep_awake",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"||typeof t.active!="boolean"?null:t}catch(t){return console.warn("Failed to set keep awake status",t),null}},pn=e=>{const t=e.trim();if(!t)return null;try{return new URL(t).origin}catch{try{return new URL(t.endsWith("/")?t:`${t}/`).origin}catch{return null}}},Uo=e=>{const t=e.trim();if(!t)return null;try{return new URL(t)}catch{try{return new URL(t.endsWith("/")?t:`${t}/`)}catch{return null}}},fc=e=>e.replace(/^\[|\]$/g,"").toLowerCase(),Ft=e=>{const t=fc(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"},ee=()=>{if(typeof window>"u"||!Ua())return!1;if(L()==="local")return!0;const e=typeof window.__OPENCHAMBER_LOCAL_ORIGIN__=="string"?window.__OPENCHAMBER_LOCAL_ORIGIN__:"",t=Uo(e),o=Uo(_r());if(!o&&t&&cc()?.target==="local")return!0;if(t&&o){if(t.origin===o.origin)return!0;const s=t.port||(t.protocol==="https:"?"443":"80"),i=o.port||(o.protocol==="https:"?"443":"80");return t.protocol===o.protocol&&s===i&&Ft(t.hostname)&&Ft(o.hostname)}const r=Uo(window.location.origin);if(t&&r){if(t.origin===r.origin)return!0;const s=t.port||(t.protocol==="https:"?"443":"80"),i=r.port||(r.protocol==="https:"?"443":"80");return t.protocol===r.protocol&&s===i&&Ft(t.hostname)&&Ft(r.hostname)}const n=pn(e),a=pn(window.location.origin)||window.location.origin;return n&&a&&n===a?!0:!!(r&&Ft(r.hostname))},Ua=()=>typeof window>"u"?!1:Ut(),Vp=async()=>{if(!Ua())return!1;try{return await G("desktop_start_window_drag"),!0}catch{return!1}},Do=()=>Bo()?.runtime?.isVSCode===!0,Kp=()=>{const t=Bo()?.runtime?.platform;return t==="web"?!0:t==="desktop"||t==="vscode"?!1:!Do()},La=async()=>{if(typeof window<"u"){const e=window.__OPENCHAMBER_HOME__;if(e&&e.length>0)return e}return null},Jp=async e=>{if(Z()&&ee())try{const t=await mt()?.openDialog?.({directory:!0,multiple:!1,title:"Select Working Directory"});return!t||typeof t!="string"?{success:!1,error:"Directory selection cancelled"}:{success:!0,path:t}}catch(t){return console.warn("Failed to request directory access",t),{success:!1,error:t instanceof Error?t.message:String(t)}}return{success:!0,path:e}},Ha=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Yp=async e=>{if(Z()&&ee())try{const t=await mt()?.openDialog?.({directory:!1,multiple:!1,title:"Select File",returnGrant:!0,...e?.filters?{filters:e.filters}:{},...e?.defaultPath?{defaultPath:e.defaultPath}:{}});if(!t)return{success:!1,error:"File selection cancelled"};if(typeof t=="string")return{success:!0,path:t};if(!Ha(t))return{success:!1,error:"File selection cancelled"};const o=typeof t.path=="string"?t.path:"";return o?{success:!0,path:o,outsideFileGrant:typeof t.outsideFileGrant=="string"?t.outsideFileGrant:void 0}:{success:!1,error:"File selection cancelled"}}catch(t){return console.warn("Failed to request file access",t),{success:!1,error:t instanceof Error?t.message:String(t)}}return{success:!1,error:"Native file picker not available"}},Qp=async e=>{const t=typeof e=="string"?e.trim():"";if(!t)return{success:!1,error:"Path is required"};if(!Z()||!ee())return{success:!1,error:"Native file access not available"};try{const o=await mt()?.grantFileAccess?.(t);if(!Ha(o))return{success:!1,error:"File access was not granted"};const r=typeof o.path=="string"?o.path:"",n=typeof o.outsideFileGrant=="string"?o.outsideFileGrant:"";return!r||!n?{success:!1,error:"File access was not granted"}:{success:!0,path:r,outsideFileGrant:n}}catch(o){return console.warn("Failed to request existing file access",o),{success:!1,error:o instanceof Error?o.message:String(o)}}},Xp=async e=>({success:!0}),Zp=async e=>({success:!0}),eh=async()=>Z()?await G("desktop_check_for_updates"):null,th=async e=>{if(!Z())return!1;const t=mt();let o=null,r=0,n;try{return typeof e=="function"&&t?.listen&&(o=await t.listen("openchamber:update-progress",a=>{const s=a?.payload;if(!s||typeof s!="object")return;const i=s,c=typeof i.event=="string"?i.event:null,d=i.data&&typeof i.data=="object"?i.data:null;if(c==="Started"){r=0,n=typeof d?.contentLength=="number"?d.contentLength:void 0,e({downloaded:r,total:n});return}if(c==="Progress"){const l=d?.downloaded,u=d?.total;typeof l=="number"&&(r=l),typeof u=="number"&&(n=u),e({downloaded:r,total:n});return}c==="Finished"&&e({downloaded:r,total:n})})),await G("desktop_download_and_install_update"),!0}catch(a){throw a instanceof Error?a:new Error(String(a))}finally{if(o)try{const a=o();a instanceof Promise&&await a}catch{}}},oh=async()=>Z()?mc():!1,mc=async()=>{if(!Z())return!1;try{return await G("desktop_restart"),!0}catch(e){return console.warn("Failed to restart desktop app",e),!1}},rh=async()=>{if(!Z()||!ee())return null;try{const e=await G("desktop_get_lan_address");return typeof e=="string"&&e.trim().length>0?e.trim():null}catch(e){return console.warn("Failed to get desktop LAN address",e),null}},gc=async(e,t)=>{if(!Z()||!ee())return!1;const o=e?.trim();if(!o)return!1;try{return await G("desktop_open_path",{path:o,app:typeof t=="string"&&t.trim().length>0?t.trim():void 0}),!0}catch(r){return console.warn("Failed to open path",r),!1}},nh=async e=>{if(!Z()||!ee())return!1;const t=e?.trim();if(!t)return!1;try{return await G("desktop_reveal_path",{path:t}),!0}catch{return gc(t)}},ah=async(e,t)=>{if(!Z()||!ee())return null;const o=e?.trim();if(!o)return null;try{const r=await G("desktop_save_markdown_file",{defaultFileName:o,content:t});return typeof r=="string"&&r.trim().length>0?r:null}catch(r){return console.warn("Failed to save markdown file",r),null}},sh=async(e,t,o)=>{if(!Z()||!ee())return!1;const r=e?.trim(),n=t?.trim(),a=o?.trim();if(!r||!n||!a)return!1;try{return await G("desktop_open_in_app",{projectPath:r,appId:n,appName:a}),!0}catch(s){return console.warn("Failed to open project in app",s),!1}},ih=async(e,t,o)=>{if(!Z()||!ee())return!1;const r=e?.trim(),n=t?.trim(),a=o?.trim();if(!r||!n||!a)return!1;try{return await G("desktop_open_file_in_app",{filePath:r,appId:n,appName:a}),!0}catch(s){return console.warn("Failed to open file in app",s),!1}},ch=async(e,t)=>{if(!Z()||!ee())return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};if(Na()==="linux")return{apps:[],success:!0,hasCache:!1,isCacheStale:!1};const o=Array.isArray(e)?e.filter(r=>typeof r=="string"):[];if(o.length===0)return{apps:[],success:!0,hasCache:!1,isCacheStale:!1};try{const r=await G("desktop_get_installed_apps",{apps:o,force:t===!0?!0:void 0});if(!r||typeof r!="object")return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};const n=r;return n.supported===!1?{apps:[],success:!0,hasCache:!1,isCacheStale:!1}:Array.isArray(n.apps)?{apps:n.apps.filter(s=>s&&typeof s=="object").map(s=>{const i=s;return{name:typeof i.name=="string"?i.name:"",iconDataUrl:typeof i.iconDataUrl=="string"?i.iconDataUrl:null}}).filter(s=>s.name.length>0),success:!0,hasCache:n.hasCache===!0,isCacheStale:n.isCacheStale===!0}:{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}catch(r){return console.warn("Failed to fetch installed apps",r),{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}},Lo=16384,fo=globalThis,pc=e=>{if(fo.Buffer)return fo.Buffer.from(e,"utf8").toString("base64url");const t=new TextEncoder().encode(e);let o="";for(let r=0;r<t.length;r+=32768)o+=String.fromCharCode(...t.slice(r,r+32768));return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},hc=e=>{try{if(fo.Buffer)return fo.Buffer.from(e,"base64url").toString("utf8");const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"="),o=atob(t),r=new Uint8Array(o.length);for(let n=0;n<o.length;n+=1)r[n]=o.charCodeAt(n);return new TextDecoder().decode(r)}catch{return null}},Fc=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="http:"&&o.protocol!=="https:"?null:(o.hash="",o.toString().replace(/\/+$/g,""))}catch{return null}},yc=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="ws:"&&o.protocol!=="wss:"?null:(o.hash="",o.toString())}catch{return null}},hn=e=>typeof e=="string"&&e.length>0,bc=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return t.kty!=="EC"||t.crv!=="P-256"||!hn(t.x)||!hn(t.y)?null:{kty:"EC",crv:"P-256",x:t.x,y:t.y}},Ac=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,wc=e=>{if(!e||typeof e!="object")return null;const t=e,o=Ac(t.priority);if(t.type==="lan"||t.type==="tunnel"){const r=Fc(t.url);return r?o===void 0?{type:t.type,url:r}:{type:t.type,url:r,priority:o}:null}if(t.type==="relay"){const r=yc(t.relayUrl);if(!r)return null;const n=typeof t.serverId=="string"?t.serverId.trim():"";if(!n)return null;const a=bc(t.hostEncPubJwk);if(!a)return null;const s=typeof t.grant=="string"&&t.grant.trim()?t.grant.trim():void 0;return{type:"relay",relayUrl:r,serverId:n,hostEncPubJwk:a,...s?{grant:s}:{},...o===void 0?{}:{priority:o}}}return null},ja=e=>{if(!e||typeof e!="object")return null;const t=e;if(t.v!==2)return null;const o=typeof t.pairingId=="string"?t.pairingId.trim():"",r=typeof t.secret=="string"?t.secret.trim():"";if(!o||!r)return null;const n=Array.isArray(t.candidates)?t.candidates.map(wc).filter(c=>!!c):[];if(n.length===0)return null;const a=typeof t.expiresAt=="string"&&t.expiresAt.trim()?t.expiresAt.trim():void 0;if(a){const c=Date.parse(a);if(!Number.isFinite(c)||c<=Date.now())return null}const s=typeof t.label=="string"&&t.label.trim()?t.label.trim():void 0,i=typeof t.fingerprint=="string"&&t.fingerprint.trim()?t.fingerprint.trim():void 0;return{v:2,pairingId:o,secret:r,...s?{label:s}:{},...i?{fingerprint:i}:{},...a?{expiresAt:a}:{},candidates:n}},dh=e=>({v:2,pairingId:e.pairingId.trim(),secret:e.secret.trim(),...e.label?.trim()?{label:e.label.trim()}:{},...e.fingerprint?.trim()?{fingerprint:e.fingerprint.trim()}:{},...e.expiresAt?.trim()?{expiresAt:e.expiresAt.trim()}:{},candidates:e.candidates}),lh=e=>{const t=ja(e);if(!t)throw new Error("Invalid pairing connection payload");const o=new URLSearchParams;return o.set("v","2"),o.set("p",pc(JSON.stringify(t))),`openchamber://connect?${o.toString()}`},Ec=e=>{const t=e.trim();if(!t||t.length>Lo)return null;try{const o=new URL(t);if(o.protocol!=="openchamber:"||o.hostname!=="connect"||o.searchParams.get("v")!=="2")return null;const r=o.searchParams.get("p")||"";if(!r||r.length>Lo)return null;const n=hc(r);return!n||n.length>Lo?null:ja(JSON.parse(n))}catch{return null}},lt=e=>typeof e=="object"&&e!==null,Cc=e=>e.trim().toLowerCase()==="authorization",Bc=e=>{if(!lt(e))return;const t={};for(const[o,r]of Object.entries(e)){const n=o.trim(),a=typeof r=="string"?r.trim():"";!n||!a||/[\r\n:]/.test(n)||/[\r\n]/.test(a)||Cc(n)||(t[n]=a)}return Object.keys(t).length>0?t:void 0},Dc=e=>`relay://${e}`,kc=e=>{if(!lt(e))return null;const t=X(e,"relayUrl")||X(e,"relay_url"),o=X(e,"serverId")||X(e,"server_id"),r=e.hostEncPubJwk??e.host_enc_pub_jwk;return!t||!o||!lt(r)?null:{relayUrl:t,serverId:o,hostEncPubJwk:r}},vc=()=>{if(typeof navigator>"u")return;const e=navigator.userAgent;if(/Macintosh|Mac OS X/i.test(e))return"macos";if(/Windows/i.test(e))return"windows";if(/Linux/i.test(e))return"linux"},uh=async(e,t)=>{const o=Ec(e);if(!o)throw new Error("invalid-connect-link");const r=await Ic().catch(()=>""),n={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({pairingId:o.pairingId,secret:o.secret,clientLabel:o.label||"OpenChamber Desktop",clientKind:"desktop",deviceName:"OpenChamber Desktop",devicePlatform:vc(),...r?{dedupeKey:`desktop:${r}`}:{}})},a=async h=>{if(!h.ok)return null;const w=await h.json().catch(()=>null);return(typeof w?.clientToken=="string"?w.clientToken.trim():"")||null};let s=null;const i=[...o.candidates].sort((h,w)=>(h.type==="relay"?1:0)-(w.type==="relay"?1:0));for(const h of i){if(h.type==="relay"){const D=vr({relayUrl:h.relayUrl,serverId:h.serverId,hostEncPubJwk:h.hostEncPubJwk,...h.grant?{grant:h.grant}:{}});try{const B=await a(await D.fetch("/api/client-auth/pairing/redeem",n));if(B){s={relay:{relayUrl:h.relayUrl,serverId:h.serverId,hostEncPubJwk:h.hostEncPubJwk},token:B};break}}catch{}finally{D.close()}continue}const w=pe(h.url);if(w)try{const D=await a(await fetch(`${w}/api/client-auth/pairing/redeem`,n));if(D){s={directUrl:w,token:D};break}}catch{}}if(!s)throw new Error("pairing-redeem-failed");const c=o.candidates.find(h=>h.type==="relay"),d=s.relay||(c?{relayUrl:c.relayUrl,serverId:c.serverId,hostEncPubJwk:c.hostEncPubJwk}:void 0),l=o.candidates.filter(h=>h.type!=="relay").map(h=>pe(h.url)).find(h=>!!h),u=s.directUrl||l,m=u||(d?Dc(d.serverId):null);if(!m)throw new Error("pairing-missing-transport");const g=t.find(h=>d?h.relay?.serverId===d.serverId:!h.relay&&pe(h.apiUrl||h.url)===m),p=g?.id||(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`host-${Date.now()}-${Math.random().toString(16).slice(2)}`),b={...g||{},id:p,label:o.label||g?.label||Mc(m),url:m,apiUrl:u,clientToken:s.token,...d?{relay:d}:{}};return{hostId:p,hosts:g?t.map(h=>h.id===p?b:h):[b,...t]}},Sc=/^(t|.*(?:token|auth|secret|api).*)$/i,pe=e=>{const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="http:"&&o.protocol!=="https:"?null:t.split("#")[0]||null}catch{return null}},fh=e=>{const t=pe(e);if(!t)return null;try{const o=new URL(t);if((o.pathname.replace(/\/+$/,"")||"/")==="/connect"&&o.searchParams.has("t"))return{persistedUrl:o.origin,redeemUrl:o.toString(),kind:"tunnel-connect-link"}}catch{return null}return{persistedUrl:t,redeemUrl:null,kind:"normal-host"}},Mc=e=>{const t=pe(e);if(!t)return e;try{const o=new URL(t);(o.username||o.password)&&(o.username="",o.password="");const r=Array.from(new Set(Array.from(o.searchParams.keys())));for(const n of r)Sc.test(n)&&o.searchParams.set(n,"[REDACTED]");return o.toString()}catch{return t}},mh=(e,t)=>{const o=pe(e),r=pe(t);if(!o||!r)return!1;try{const n=new URL(o),a=new URL(r);if(n.origin!==a.origin||a.search&&n.search!==a.search)return!1;const s=a.pathname.length>1?a.pathname.replace(/\/+$/,""):a.pathname,i=n.pathname.length>1?n.pathname.replace(/\/+$/,""):n.pathname;return s==="/"?!0:i===s||i.startsWith(`${s}/`)}catch{return!1}},X=(e,t)=>{const o=e[t];return typeof o=="string"?o:null},Fn=(e,t)=>{const o=e[t];return typeof o=="number"&&Number.isFinite(o)?o:null},Tc=e=>{if(!lt(e))return null;const t=X(e,"id"),o=X(e,"label"),r=X(e,"url"),n=X(e,"apiUrl")||X(e,"api_url"),a=X(e,"clientToken")||X(e,"client_token"),s=Bc(e.requestHeaders),i=kc(e.relay);return!t||!o||!r?null:{id:t,label:o,url:r,...n?{apiUrl:n}:{},...a?{clientToken:a}:{},...s?{requestHeaders:s}:{},...i?{relay:i}:{}}},Pc=e=>pe(e.apiUrl||e.url)||e.apiUrl||e.url,Qe=()=>Z()?(e,t)=>G(e,t):null,za=async()=>{const e=Qe();if(!e)return{hosts:[],defaultHostId:"local",initialHostChoiceCompleted:!1};const t=await e("desktop_hosts_get");if(!lt(t))return{hosts:[],defaultHostId:null,initialHostChoiceCompleted:!1};const o=t.hosts,r=Array.isArray(o)?o.map(Tc).filter(i=>!!i):[],n=X(t,"defaultHostId")||X(t,"default_host_id")||X(t,"defaultHostID"),a=t.initialHostChoiceCompleted===!0||t.initial_host_choice_completed===!0,s=X(t,"localOrigin")||X(t,"local_origin");return{hosts:r,defaultHostId:n,initialHostChoiceCompleted:a,localOrigin:s}},Rc=async e=>{const t=Qe();if(!t)return;const o={hosts:e.hosts,defaultHostId:e.defaultHostId,initialHostChoiceCompleted:e.initialHostChoiceCompleted};e.localClientToken!==void 0&&(o.localClientToken=e.localClientToken),await t("desktop_hosts_set",{input:o})},gh=async()=>{const e=Qe();if(!e)return"";const t=await e("desktop_local_client_token_get").catch(()=>null);return typeof t=="string"?t.trim():""},Ic=async()=>{const e=Qe();if(!e)return"";const t=await e("desktop_install_id_get").catch(()=>null);return typeof t=="string"?t.trim():""},xc=8e3,ph=async(e,t)=>{const o=vr({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk}),r=Date.now();let n=!1;try{return(await Promise.race([o.fetch("/health"),new Promise(s=>{const i=window.setTimeout(()=>s(null),xc);typeof i!="number"&&typeof i.unref=="function"&&i.unref()})]))?.ok?(n=t?.keepTunnel===!0,{status:"ok",latencyMs:Math.max(0,Date.now()-r),...n?{tunnel:o}:{}}):{status:"unreachable",latencyMs:0}}catch{return{status:"unreachable",latencyMs:0}}finally{n||o.close()}},$a=async(e,t)=>{const o=Qe();if(!o)return{status:"unreachable",latencyMs:0};const r=await o("desktop_host_probe",{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0,expectedServerId:t?.expectedServerId||void 0});if(!lt(r))return{status:"unreachable",latencyMs:0};const n=r.status,a=n==="ok"||n==="auth"||n==="update-recommended"||n==="incompatible"||n==="wrong-service"||n==="unreachable"?n:"unreachable",s=Fn(r,"latencyMs")??Fn(r,"latency_ms")??0;return{status:a,latencyMs:s}},hh=async(e,t)=>{const o=Qe();o&&await o("desktop_new_window_at_url",{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0})},Fh=async e=>{const t=Qe();t&&await t("desktop_new_window_for_host",{hostId:e})},Oc=5e3,_c=1500;let Ho=!1;const Nc=async e=>{if(!Ut()||Ho)return;const t=`host:${e}`;if(L()===t){Ho=!0;try{const o=await za().catch(()=>null),r=o?.hosts.find(u=>u.id===e);if(!o||!r?.relay)return;const n=r.apiUrl?pe(r.apiUrl):null;if(n&&n.startsWith("https://"))return;const a=await f("/api/client-auth/connection/candidates").catch(()=>null);if(!a?.ok)return;const s=await a.json().catch(()=>null);if(!s||s.serverId!==r.relay.serverId)return;const i=Array.isArray(s.candidates)?s.candidates:[],c=[];for(const u of i){if(!u||typeof u!="object")continue;const m=u;if(m.type!=="lan"||typeof m.url!="string")continue;const g=pe(m.url);g&&!c.includes(g)&&c.push(g)}if(c.length===0)return;const d=n&&c.includes(n)?n:c[0];d!==n&&await Rc({hosts:o.hosts.map(u=>u.id===e?{...u,apiUrl:d}:u),defaultHostId:o.defaultHostId,initialHostChoiceCompleted:o.initialHostChoiceCompleted}).catch(()=>{});const l=await $a(d,{clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,expectedServerId:r.relay.serverId}).catch(()=>({status:"unreachable",latencyMs:0}));if(l.status==="unreachable"||l.status==="wrong-service"||l.status==="incompatible"||L()!==t)return;nr({apiBaseUrl:d,clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,runtimeKey:t})}finally{Ho=!1}}},Uc=e=>{typeof window>"u"||window.setTimeout(()=>{Nc(e).catch(()=>{})},Oc)},Lc=async e=>{if(!Ut())return;const t=await za().catch(()=>null);if(!t)return;const o=e||(t.defaultHostId!=="local"?t.defaultHostId:null);if(!o)return;const r=t.hosts.find(u=>u.id===o);if(!r?.relay)return;const n=`host:${r.id}`;if(L()===n)return;const a=u=>{nr({apiBaseUrl:u,clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,runtimeKey:n})},s=()=>{nr({apiBaseUrl:typeof window<"u"?window.location.origin:"",clientToken:r.clientToken||null,runtimeKey:n,relay:r.relay??void 0}),Uc(r.id)},i=r.apiUrl?pe(Pc(r)):null;if(!i){s();return}const c=u=>u.status!=="unreachable"&&u.status!=="wrong-service"&&u.status!=="incompatible",d=$a(i,{clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,expectedServerId:r.relay.serverId}).catch(()=>({status:"unreachable",latencyMs:0})),l=await Promise.race([d,new Promise(u=>setTimeout(()=>u(null),_c))]);if(l){if(c(l)){a(i);return}s();return}s(),d.then(u=>{c(u)&&L()===n&&a(i)})},yn=500,Ga=()=>{if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("startupTrace")==="1"||window.localStorage?.getItem("OPENCHAMBER_STARTUP_TRACE")==="1"}catch{return!1}},yh=()=>Ga(),fe=(e,t)=>{if(!Ga())return;const o=typeof performance<"u"?performance.now():Date.now();window.__OPENCHAMBER_STARTUP_TRACE_START__??=o,window.__OPENCHAMBER_STARTUP_TRACE__??=[],window.__OPENCHAMBER_STARTUP_TRACE__.push({t:Math.round(o-window.__OPENCHAMBER_STARTUP_TRACE_START__),name:e,...t?{data:t}:{}}),window.__OPENCHAMBER_STARTUP_TRACE__.length>yn&&window.__OPENCHAMBER_STARTUP_TRACE__.splice(0,window.__OPENCHAMBER_STARTUP_TRACE__.length-yn)},Hc=()=>{const e=typeof window<"u"?window.__OPENCHAMBER_STARTUP_TRACE__??[]:[],t=e.findIndex(r=>r.name==="ModelControls:ready"),o=t>=0?Math.min(e.length,t+8):e.length;return e.slice(0,o).filter(r=>r.name.includes("checkConnection")||r.name.includes("checkHealth")||r.name.includes("initializeApp")||r.name.includes("initApp")||r.name.includes("loadProviders")||r.name.includes("loadAgents")||r.name.includes("config.defaults")||r.name.includes("modelsMetadata")||r.name.includes("ModelControls")||r.name.includes("activateDirectory")||r.name.includes("opencodeClient:setDirectory"))};typeof window<"u"&&(window.__OPENCHAMBER_STARTUP_TRACE_SUMMARY__=Hc);const bh=async(e,t,o)=>{const r=typeof performance<"u"?performance.now():Date.now();fe(`${e}:start`,o);try{const n=await t(),a=typeof performance<"u"?performance.now():Date.now();return fe(`${e}:end`,{durationMs:Math.round(a-r)}),n}catch(n){const a=typeof performance<"u"?performance.now():Date.now();throw fe(`${e}:error`,{durationMs:Math.round(a-r),error:n instanceof Error?n.message:String(n)}),n}},jc=3,zc=3e4,$c=32e3,Gc=3600*1e3,qc=600*1e3,Wc=200,Vc=new Set([429,502,503,504]),ke=new Map,Nr=e=>JSON.stringify([L(),e]);function Kc(){const e=Date.now();for(const[t,o]of ke){const r=Math.max(o.lastErrorAt,o.circuitOpenAt);e-r>Gc&&ke.delete(t)}}typeof setInterval<"u"&&setInterval(Kc,qc).unref?.();function Jc(e){const t=Nr(e);let o=ke.get(t);if(!o)for(o={consecutiveErrors:0,lastErrorAt:0,circuitOpen:!1,circuitOpenAt:0,circuitCooldownMs:zc},ke.set(t,o);ke.size>Wc;){const r=ke.keys().next().value;if(!r)break;ke.delete(r)}return o}function Yc(e){e&&ke.delete(Nr(e))}function bn(e,t){if(!e)return;const o=Jc(e);o.consecutiveErrors+=1,o.lastErrorAt=Date.now(),Qc(t)&&o.consecutiveErrors>=jc&&(o.circuitOpen=!0,o.circuitOpenAt=Date.now(),console.warn(`[provider-tracker] Circuit opened for ${e} after ${o.consecutiveErrors} consecutive errors`))}function Qc(e){return e!==void 0&&Vc.has(e)}function Xc(e){const t=ke.get(Nr(e));return t?.circuitOpen?Date.now()-t.circuitOpenAt>=t.circuitCooldownMs?(t.circuitOpen=!1,t.consecutiveErrors=0,t.circuitCooldownMs=Math.min(t.circuitCooldownMs*2,$c*4),!1):!0:!1}function Zc(e){if(!(!e||!Xc(e)))throw new Error(`Provider ${e} is temporarily unavailable after repeated errors. Please retry shortly.`)}const An="/api",ed=1e4,td=4e3;function it(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}function te(e,t){if(e.error){const o=e.response?.status,r=new Error(`${t} failed${o?` (${o})`:""}: ${it(e.error)}`);throw o!==void 0&&(r.status=o),r}if(e.data===void 0||e.data===null)throw new Error(`${t} failed: empty response`);return e.data}function tt(e,t){if(e.error){const o=e.response?.status,r=new Error(`${t} failed${o?` (${o})`:""}: ${it(e.error)}`);throw o!==void 0&&(r.status=o),r}return e.data}const od=/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//,wn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",rd=14;let En=0,jo=0;const nd=e=>{const t=new Uint8Array(e);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let r=0;r<e;r+=1)t[r]=Math.floor(Math.random()*256);let o="";for(let r=0;r<e;r+=1)o+=wn[t[r]%wn.length];return o},Cn=e=>{const t=Date.now();t!==En&&(En=t,jo=0),jo+=1;const o=BigInt(t)*BigInt(4096)+BigInt(jo),r=new Uint8Array(6);for(let a=0;a<6;a+=1)r[a]=Number(o>>BigInt(40-8*a)&BigInt(255));const n=Array.from(r,a=>a.toString(16).padStart(2,"0")).join("");return`${e}_${n}${nd(rd)}`},Bn=e=>{const t=typeof e=="string"&&e.trim().length>0?e.trim():"/api";if(od.test(t)||typeof window>"u")return t;const o=window.location?.href||window.location?.origin;if(!o)return t;try{return new URL(t,o).toString()}catch(r){return console.warn("Failed to normalize OpenCode base URL:",r),t}},Dn=()=>{try{return oe().api("/api")}catch{return null}},ad=e=>{const t=typeof AbortSignal<"u"?AbortSignal:void 0;if(typeof t?.timeout=="function")return{signal:t.timeout(e),cleanup:()=>{}};const o=new AbortController,r=setTimeout(()=>o.abort(),e);return{signal:o.signal,cleanup:()=>clearTimeout(r)}},zo=e=>Ns({...e,fetch:f}),ot=e=>e.replace(/\\/g,"/"),kn=400,vn=()=>{const e=Bo();return e&&e.runtime?.isDesktop&&e.files?e.files:null};class sd{client;baseUrl;scopedClients=new Map;currentDirectory=void 0;directoryContextQueue=Promise.resolve();listDirectoryInFlight=new Map;configProvidersInFlight=new Map;listAgentsInFlight=new Map;configInFlight=new Map;configCache=new Map;configCacheGeneration=0;listDirectoryCache=new Map;constructor(t=An){const r=Dn()||t;this.baseUrl=Bn(r),this.client=zo({baseUrl:this.baseUrl})}getBaseUrl(){return this.baseUrl}reconnectToRuntimeBaseUrl(){const t=Dn(),o=Bn(t||An);o!==this.baseUrl&&(this.baseUrl=o,this.client=zo({baseUrl:this.baseUrl}),this.scopedClients.clear(),this.listDirectoryInFlight.clear(),this.configProvidersInFlight.clear(),this.listAgentsInFlight.clear(),this.clearConfigCache(),this.listDirectoryCache.clear())}getSdkClient(){return this.client}getScopedSdkClient(t){return this.getScopedApiClient(t)}getScopedApiClient(t){const o=this.normalizeCandidatePath(t)??t,r=o||"",n=this.scopedClients.get(r);if(n)return n;const a=zo({baseUrl:this.baseUrl,directory:o});return this.scopedClients.set(r,a),a}normalizeCandidatePath(t){if(typeof t!="string")return null;const o=t.trim();if(!o)return null;const r=o.replace(/\\/g,"/").replace(/^([a-z]):/,(a,s)=>s.toUpperCase()+":");return(r.length>1?r.replace(/\/+$/,""):r)||null}deriveHomeDirectory(t){const o=t.match(/^([A-Za-z]:)(?:\/|$)/);if(o){const a=o[1],i=t.slice(a.length+(t.charAt(a.length)==="/"?1:0)).split("/").filter(Boolean);return i.length>=2?{homeDirectory:`${a}/${i[0]}/${i[1]}`,username:i[1]}:i.length===1?{homeDirectory:`${a}/${i[0]}`,username:i[0]}:{homeDirectory:a,username:void 0}}const r=t.startsWith("/"),n=t.split("/").filter(Boolean);return n.length>=2&&(n[0]==="Users"||n[0]==="home")?{homeDirectory:`${r?"/":""}${n[0]}/${n[1]}`,username:n[1]}:r?n.length===0?{homeDirectory:"/",username:void 0}:{homeDirectory:`/${n.join("/")}`,username:n[n.length-1]}:n.length>0?{homeDirectory:`/${n.join("/")}`,username:n[n.length-1]}:{homeDirectory:"/",username:void 0}}setDirectory(t){const o=this.normalizeCandidatePath(t)??t;this.currentDirectory!==o&&fe("opencodeClient:setDirectory",{previous:this.currentDirectory??null,next:o??null}),this.currentDirectory=o}getDirectory(){return this.currentDirectory}async withDirectory(t,o){const r=async()=>{if(t==null)return o();const a=this.currentDirectory,s=this.normalizeCandidatePath(t)??t;this.currentDirectory=s;try{return await o()}finally{this.currentDirectory===s&&(this.currentDirectory=a)}},n=this.directoryContextQueue.then(r,r);return this.directoryContextQueue=n.then(()=>{},()=>{}),n}getApiClient(){return this.client}async getSystemInfo(){const t=new Set,o=n=>{const a=this.normalizeCandidatePath(n);a&&t.add(a)};try{const a=(await this.client.path.get(this.currentDirectory?{directory:this.currentDirectory}:void 0)).data;a&&(o(a.directory),o(a.worktree),o(a.state))}catch(n){console.debug("Failed to load path info:",n)}if(!t.size)try{const n=await this.client.project.current(this.currentDirectory?{directory:this.currentDirectory}:void 0);o(n.data?.worktree)}catch(n){console.debug("Failed to load project info:",n)}if(!t.size)try{(await this.listSessions()).forEach(a=>o(a.directory))}catch(n){console.debug("Failed to inspect sessions for system info:",n)}if(o(this.currentDirectory),typeof window<"u")try{o(window.localStorage.getItem("lastDirectory")),o(window.localStorage.getItem("homeDirectory"))}catch{}if(!t.size&&typeof process<"u"&&typeof process.cwd=="function"&&o(process.cwd()),!t.size)return{homeDirectory:"/",username:void 0};const[r]=Array.from(t);return this.deriveHomeDirectory(r)}async probeDirectory(t){const o=this.normalizeCandidatePath(t);if(!o)return!1;try{const n=(await this.client.path.get({directory:o})).data,a=typeof n?.directory=="string"?n.directory:null;return!!(a&&a.trim().length>0)}catch{return!1}}async listSessions(){const t=await this.client.session.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);return Array.isArray(t.data)?t.data:[]}async createSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.create({...r?{directory:r}:{},parentID:t?.parentID,title:t?.title,metadata:t?.metadata});return te(n,"session.create")}async getSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.get({sessionID:t,...r?{directory:r}:{}});return te(n,"session.get")}async deleteSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.delete({sessionID:t,...r?{directory:r}:{}});return tt(n,"session.delete")===!0}async updateSession(t,o,r){const n=this.normalizeCandidatePath(r)??this.currentDirectory,a={...o.title!==void 0?{title:o.title}:{},...o.metadata!==void 0?{metadata:o.metadata}:{},...o.time?.archived!==void 0&&o.time.archived!==null?{time:{archived:o.time.archived}}:{}},s=await this.client.session.update({sessionID:t,...n?{directory:n}:{},...a});return te(s,"session.update")}async getSessionMessages(t,o){const r=await this.client.session.messages({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{},...typeof o=="number"?{limit:o}:{}});return te(r,"session.messages")}async getSessionTodos(t){try{const o=await this.client.session.todo({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});if(o.error)return[];const r=o.data;return!r||!Array.isArray(r)?[]:r}catch{return[]}}shouldNormalizeToTextPlain(t){if(!t)return!1;const o=t.toLowerCase();return o.startsWith("text/")&&o!=="text/plain"?!0:["application/json","application/xml","application/javascript","application/typescript","application/x-yaml","application/yaml","application/toml","application/x-sh","application/x-shellscript","application/octet-stream","image/svg+xml"].includes(o)}isHeicMime(t){if(!t)return!1;const o=t.toLowerCase();return o==="image/heic"||o==="image/heif"}async convertHeicToJpeg(t){try{const o=(await _s(async()=>{const{default:u}=await import("./vendor-.bun-DvcSrJLa.js").then(m=>m.h);return{default:u}},[])).default,r=t.url.indexOf(",");if(r===-1)return t;const n=t.url.substring(r+1),a=atob(n),s=new Uint8Array(a.length);for(let u=0;u<a.length;u++)s[u]=a.charCodeAt(u);const i=new Blob([s],{type:t.mime}),c=await o({blob:i,toType:"image/jpeg",quality:.9}),d=await new Promise((u,m)=>{const g=new FileReader;g.onload=()=>u(g.result),g.onerror=m,g.readAsDataURL(c)});let l=t.filename;return l&&(l=l.replace(/\.heic$/i,".jpg").replace(/\.heif$/i,".jpg")),{mime:"image/jpeg",filename:l,url:d}}catch(o){return console.warn("Failed to convert HEIC to JPEG:",o),t}}async normalizeFilePart(t){if(this.isHeicMime(t.mime))return this.convertHeicToJpeg(t);if(!this.shouldNormalizeToTextPlain(t.mime))return t;let o=t.url;if(t.url.startsWith("data:")){const r=t.url.indexOf(",");if(r!==-1){const n=t.url.substring(5,r),a=t.url.substring(r);o=`data:${n.replace(/^[^;,]+/,"text/plain")}${a}`}}return{mime:"text/plain",filename:t.filename,url:o}}async toNormalizedFilePartInput(t){const o=await this.normalizeFilePart(t);return{...t.id?{id:t.id}:{},type:"file",mime:o.mime,filename:o.filename,url:o.url}}async sendMessage(t){const o=t.messageId??Cn("msg"),r=[];if(t.prefaceText&&t.prefaceText.trim()&&r.push({type:"text",text:t.prefaceText,synthetic:t.prefaceTextSynthetic!==!1}),t.text&&t.text.trim()){const d={type:"text",text:t.text};r.push(d)}if(t.files&&t.files.length>0)for(const d of t.files){const l=await this.toNormalizedFilePartInput(d);r.push(l)}if(t.additionalParts&&t.additionalParts.length>0){for(const d of t.additionalParts)if(d.text&&d.text.trim()&&r.push({type:"text",text:d.text,...d.synthetic?{synthetic:!0}:{}}),d.files&&d.files.length>0)for(const l of d.files){const u=await this.toNormalizedFilePartInput(l);r.push(u)}}if(t.agentMentions&&t.agentMentions.length>0)for(const d of t.agentMentions)d?.name&&r.push({type:"agent",name:d.name,...d.source?{source:d.source}:{}});if(r.length===0)throw new Error("Message must have at least one part (text or file)");const n=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory;t.format&&console.info("[git-generation][browser] send structured message",{sessionId:t.id,providerID:t.providerID,modelID:t.modelID,agent:t.agent,variant:t.variant,directory:n,baseUrl:this.baseUrl,formatType:t.format.type}),Zc(t.providerID);let a;try{const d=await this.client.session.promptAsync({sessionID:t.id,...n?{directory:n}:{},model:{providerID:t.providerID,modelID:t.modelID},agent:t.agent,variant:t.variant,messageID:o,...t.delivery?{delivery:t.delivery}:{},...t.format?{format:t.format}:{},parts:r});if(d.response instanceof Response)a=d.response;else if(d.error){const l=d.response?.status;if(!l)throw new Error(`Message send transport failure: ${it(d.error)}`);a=new Response(JSON.stringify(d.error),{status:l})}else a=new Response(JSON.stringify(d.data??!0),{status:200})}catch(d){throw bn(t.providerID),d}if(a.ok)return Yc(t.providerID),o;let s="";try{s=await a.text()}catch{}const i=s&&s.trim().length>0?`: ${s.trim()}`:"",c=new Error(`Failed to send message (${a.status})${i}`);throw c.status=a.status,bn(t.providerID,a.status),c}async sendCommand(t){const o=t.messageId??Cn("msg"),r=[];if(t.files&&t.files.length>0)for(const s of t.files)r.push(await this.toNormalizedFilePartInput(s));const n=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory,a=await this.client.session.command({sessionID:t.id,...n?{directory:n}:{},command:t.command,arguments:t.arguments??"",model:`${t.providerID}/${t.modelID}`,agent:t.agent,variant:t.variant,...r.length>0?{parts:r}:{},messageID:o});return tt(a,"session.command"),o}async abortSession(t){return!!(await this.client.session.abort({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}},{throwOnError:!0})).data}async shellSession(t){const o=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory,r=await this.client.session.shell({sessionID:t.sessionId,...o?{directory:o}:{},messageID:t.messageId,agent:t.agent,model:t.model,command:t.command});return te(r,"session.shell")}async revertSession(t,o,r,n){const a=this.normalizeCandidatePath(n)??this.currentDirectory,s=await this.client.session.revert({sessionID:t,...a?{directory:a}:{},messageID:o,partID:r});return te(s,"session.revert")}async summarizeSession(t,o,r,n){const a=this.normalizeCandidatePath(n)??this.currentDirectory,s=await this.client.session.summarize({sessionID:t,...a?{directory:a}:{},providerID:o,modelID:r});return tt(s,"session.summarize")===!0}async unrevertSession(t){const o=await this.client.session.unrevert({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return te(o,"session.unrevert")}async forkSession(t,o,r){const n=this.normalizeCandidatePath(r)??this.currentDirectory,a=await this.client.session.fork({sessionID:t,...n?{directory:n}:{},messageID:o});return te(a,"session.fork")}async getSessionStatus(){return await this.getSessionStatusForDirectory(this.currentDirectory??null)??{}}async getSessionStatusForDirectory(t){try{const o=typeof t=="string"?t.trim():"",r=await this.client.session.status(o?{directory:o}:void 0);return r.error||!r.data||typeof r.data!="object"?null:r.data}catch{return null}}async getGlobalSessionStatus(){return await this.getSessionStatusForDirectory(null)??{}}async getWebServerSessionActivity(){try{const t=await f("/api/session-activity",{method:"GET",headers:{Accept:"application/json"}});if(!t.ok)return null;const o=await t.json().catch(()=>null);return!o||typeof o!="object"?null:o}catch{return null}}async listToolIds(t){try{const o=typeof t?.directory=="string"?t.directory.trim():this.currentDirectory?this.currentDirectory.trim():"";return((await this.client.tool.ids(o?{directory:o}:void 0)).data||[]).filter(a=>typeof a=="string"&&a!=="invalid")}catch{return[]}}async replyToPermission(t,o,r){const n=this.normalizeCandidatePath(r?.directory??null)??this.currentDirectory,a=await this.client.permission.reply({requestID:t,...n?{directory:n}:{},reply:o,...r?.message?{message:r.message}:{}});return tt(a,"permission.reply")===!0}async createPermission(t,o,r,n){try{const a=await this.client.v2.session.permission.create({sessionID:t,action:o,resources:r,...n?.id?{id:n.id}:{},...n?.save?{save:n.save}:{},...n?.metadata?{metadata:n.metadata}:{},...n?.source?{source:n.source}:{},...n?.agent?{agent:n.agent}:{}});if(a.error!==void 0)return null;const s=a.data?.data;return s===void 0?null:{id:s.id,effect:s.effect}}catch{return null}}async fetchPermission(t,o){try{const r=await this.client.v2.session.permission.get({sessionID:t,requestID:o});if(r.error===void 0){const n=r.data?.data;if(n!==void 0)return{state:"ok",permission:n}}return r.response?.status===404?{state:"resolved"}:{state:"unknown"}}catch{return{state:"unknown"}}}async listPendingPermissions(t){const o=[],r=async c=>{const d=typeof c=="string"?c.trim():"",l=await this.client.permission.list(d?{directory:d}:void 0);if(l.error)throw new Error(`permission.list failed: ${it(l.error)}`);return l.data||[]};o.push(r(null));const n=new Set;for(const c of t?.directories??[]){const d=this.normalizeCandidatePath(c??null);d&&n.add(d)}for(const c of n)o.push(r(c));const a=await Promise.all(o),s=[],i=new Set;for(const c of a)for(const d of c){if(!d||typeof d!="object")continue;const l=d.id;typeof l!="string"||l.length===0||i.has(l)||(i.add(l),s.push(d))}return s}async replyToQuestion(t,o,r){const n=!Array.isArray(o)||o.length===0?[]:Array.isArray(o[0])?o:[o],a=this.normalizeCandidatePath(r)??this.currentDirectory,s=await this.client.question.reply({requestID:t,...a?{directory:a}:{},answers:n});return tt(s,"question.reply")===!0}async rejectQuestion(t){const o=await this.client.question.reject({requestID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return tt(o,"question.reject")===!0}async listPendingQuestions(t){const o=[],r=async c=>{const d=typeof c=="string"?c.trim():"",l=await this.client.question.list(d?{directory:d}:void 0);if(l.error)throw new Error(`question.list failed: ${it(l.error)}`);return l.data||[]};o.push(r(null));const n=new Set;for(const c of t?.directories??[]){const d=this.normalizeCandidatePath(c??null);d&&n.add(d)}for(const c of n)o.push(r(c));const a=await Promise.all(o),s=[],i=new Set;for(const c of a)for(const d of c){if(!d||typeof d!="object")continue;const l=d.id;typeof l!="string"||l.length===0||i.has(l)||(i.add(l),s.push(d))}return s}clearConfigCache(){this.configCacheGeneration+=1,this.configInFlight.clear(),this.configCache.clear()}async getConfig(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.configCache.get(r);if(n&&n.expiresAt>Date.now())return fe("opencodeClient.getConfig:cacheHit",{directory:o??null}),n.config;const a=this.configInFlight.get(r);if(a)return fe("opencodeClient.getConfig:deduped",{directory:o??null}),a;const s=this.configCacheGeneration,i=(async()=>{fe("opencodeClient.getConfig:start",{directory:o??null});const c=typeof performance<"u"?performance.now():Date.now(),l=await(o?this.getScopedApiClient(o):this.client).config.get();if(!l.data)throw new Error("Failed to get config");const u=typeof performance<"u"?performance.now():Date.now();return fe("opencodeClient.getConfig:end",{directory:o??null,durationMs:Math.round(u-c)}),s===this.configCacheGeneration&&this.configCache.set(r,{config:l.data,expiresAt:Date.now()+ed}),l.data})();this.configInFlight.set(r,i);try{return await i}finally{this.configInFlight.get(r)===i&&this.configInFlight.delete(r)}}async updateConfig(t){const o=await this.client.config.update({config:t}),r=te(o,"global.config.update");return this.clearConfigCache(),r}async updateConfigPartial(t){const o=await this.getConfig(),r=t(o);return await this.updateConfig(r)}async getProviders(){return this.getProvidersForConfig(this.currentDirectory)}async getProvidersForConfig(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.configProvidersInFlight.get(r);if(n)return n;const a=(async()=>{const s=await this.client.config.providers(o?{directory:o}:void 0);return te(s,"config.providers")})();this.configProvidersInFlight.set(r,a);try{return await a}finally{this.configProvidersInFlight.delete(r)}}async getApp(){return{version:"0.0.3",config:await this.getConfig()}}async initApp(){try{return await this.checkHealth()}catch{return!1}}async listAgents(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.listAgentsInFlight.get(r);if(n)return n;const a=(async()=>{const s=o?{directory:o}:void 0,i=await this.client.app.agents(s);if(!i.error&&Array.isArray(i.data)&&i.data.length>0)return i.data;const c=await f("/api/agent",{...o?{query:{directory:o}}:{}});if(!c.ok)throw i.error?new Error(`app.agents failed${i.response?.status?` (${i.response.status})`:""}: ${it(i.error)}`):new Error(`agent.list failed (${c.status})`);const d=await c.json().catch(()=>null);if(!Array.isArray(d))throw new Error("agent.list failed: invalid response");return d})();this.listAgentsInFlight.set(r,a);try{return await a}finally{this.listAgentsInFlight.delete(r)}}async readFile(t){try{const o=await this.client.file.read({path:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return String(te(o,"file.read"))}catch{return`// Content of ${t}
|
|
2
|
-
// This would be loaded from the server`}}async listFiles(t){try{const o=t||this.currentDirectory||"/",r=await this.client.file.list({path:o,...this.currentDirectory?{directory:this.currentDirectory}:{}}),n=te(r,"file.list");return Array.isArray(n)?n:[]}catch{return[]}}async listCommands(){const t=await this.client.command.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);return(te(t,"command.list")||[]).map(r=>({name:r.name,description:r.description,agent:r.agent,model:r.model,source:r.source}))}async listCommandsWithDetails(){const t=await this.client.command.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);return(te(t,"command.list")||[]).map(r=>({name:r.name,description:r.description,agent:r.agent,model:r.model,source:r.source,template:r.template}))}async listSkillsWithDetails(){try{const o=(await this.client.app.skills(this.currentDirectory?{directory:this.currentDirectory}:void 0)).data;if(!Array.isArray(o))return[];const r=[];for(const n of o){const a=typeof n.name=="string"?n.name.trim():"",s=typeof n.location=="string"?n.location:"";if(!a||!s)continue;const i={name:a,location:s};typeof n.description=="string"&&(i.description=n.description),typeof n.content=="string"&&(i.content=n.content),r.push(i)}return r}catch{return[]}}async getCommandDetails(t){try{const o=await this.client.command.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);if(o.data){const r=o.data.find(n=>n.name===t);if(r)return{name:r.name,template:r.template,description:r.description,agent:r.agent,model:r.model}}return null}catch{return null}}async checkHealth(){try{const t=this.baseUrl.endsWith("/")?this.baseUrl.replace(/\/+$/,""):this.baseUrl,o=t==="/api"||t.endsWith("/api")?"/api/opencode/health":`${t}/opencode/health`;fe("opencodeClient.checkHealth:url",{baseUrl:this.baseUrl,healthUrl:o});const r=ad(td),n=await f(o,{signal:r.signal}).finally(r.cleanup);if(fe("opencodeClient.checkHealth:response",{status:n.status}),!n.ok)return!1;const a=await n.json();return fe("opencodeClient.checkHealth:result",{healthy:a?.healthy}),a?.healthy===!0}catch{return!1}}async createDirectory(t,o){const r=vn();if(r?.createDirectory)try{return await r.createDirectory(t)}catch(i){const c=i instanceof Error?i.message:String(i);throw new Error(c||"Failed to create directory")}const n={path:t,...o?.allowOutsideWorkspace?{allowOutsideWorkspace:!0}:{}},a=await f(`${this.baseUrl}/fs/mkdir`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok){const i=await a.json().catch(()=>({error:"Failed to create directory"}));throw new Error(i.error||"Failed to create directory")}return await a.json()}async cloneRepository(t){const o=await f(`${this.baseUrl}/fs/clone`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:"Failed to clone repository"}));throw new Error(r.error||"Failed to clone repository")}return await o.json()}async listLocalDirectory(t,o){const n=`${typeof t=="string"?ot(t.trim()):""}|${o?.respectGitignore?"1":"0"}`,a=Date.now(),s=this.listDirectoryCache.get(n);if(s&&s.expiresAt>a)return s.entries;const i=this.listDirectoryInFlight.get(n);if(i)return i;const d=(async()=>{const l=vn();if(l)try{const u=await l.listDirectory(t||"",o);if(!u||!Array.isArray(u.entries))return[];const m=u.entries.map(g=>({name:g.name,path:ot(g.path),isDirectory:!!g.isDirectory,isFile:!g.isDirectory,isSymbolicLink:!1}));return this.listDirectoryCache.set(n,{entries:m,expiresAt:Date.now()+kn}),m}catch(u){throw console.error("Failed to list directory contents:",u),u}try{const u=new URLSearchParams;t&&t.trim().length>0&&u.set("path",t),o?.respectGitignore&&u.set("respectGitignore","true");const m=u.toString(),g=await f(`${this.baseUrl}/fs/list${m?`?${m}`:""}`);if(!g.ok){const h=await g.json().catch(()=>({})),w=typeof h.error=="string"?h.error:"Failed to list directory";throw new Error(w)}const p=await g.json();if(!p||!Array.isArray(p.entries))return[];const b=p.entries;return this.listDirectoryCache.set(n,{entries:b,expiresAt:Date.now()+kn}),b}catch(u){throw console.error("Failed to list directory contents:",u),u}})().finally(()=>{this.listDirectoryInFlight.get(n)===d&&this.listDirectoryInFlight.delete(n)});return this.listDirectoryInFlight.set(n,d),d}async searchFiles(t,o){const r=typeof o?.directory=="string"&&o.directory.trim().length>0?o.directory.trim():this.currentDirectory,n=r?ot(r):null,a=r?this.getScopedApiClient(r):this.client;try{const s=await a.find.files({query:t,limit:typeof o?.limit=="number"&&Number.isFinite(o.limit)?o.limit:void 0,dirs:o?.dirs===!1||o?.type==="file"?"false":"true",type:o?.type});return(Array.isArray(s?.data)?s.data:[]).map(c=>{const d=ot(c),l=d.split("/").filter(Boolean).pop()||d,u=ot(n?`${n}/${d}`:d);return{name:l,path:u,relativePath:d,extension:l.includes(".")?l.split(".").pop()?.toLowerCase():void 0}})}catch(s){throw console.error("Failed to search files:",s),s}}async getFilesystemHome(){const t=L();if(!t||t==="local"){const o=await La();if(o)return o}try{const o=await f(`${this.baseUrl}/fs/home`,{method:"GET",headers:{Accept:"application/json"}});if(!o.ok){const n=await o.json().catch(()=>({})),a=typeof n.error=="string"&&n.error.length>0?n.error:"Failed to resolve home directory";throw new Error(a)}const r=await o.json();return r&&typeof r.home=="string"&&r.home.length>0?r.home:null}catch(o){return console.warn("Failed to resolve filesystem home directory:",o),null}}async setOpenCodeWorkingDirectory(t){if(!t||typeof t!="string"||!t.trim())return console.warn("[OpencodeClient] setOpenCodeWorkingDirectory: invalid path",t),null;const o=`${this.baseUrl}/opencode/directory`;console.log("[OpencodeClient] POST",o,"with path:",t);try{const r=await f(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}),n=await r.json().catch(()=>null);if(!r.ok){const a=n??{},s=typeof a.error=="string"&&a.error.length>0?a.error:"Failed to update OpenCode working directory";throw new Error(s)}return n&&typeof n=="object"?n:{success:!0,restarted:!1,path:t}}catch(r){throw console.warn("Failed to update OpenCode working directory:",r),r}}}const Oe=new sd,id=e=>{const t=e.replace(/\\/g,"/").replace(/\/+$/g,"").trim();if(!t)return"";const o=new TextEncoder().encode(t);let r="";for(const a of o)r+=String.fromCharCode(a);return`path_${typeof btoa=="function"?btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):t.replace(/[^A-Za-z0-9._-]+/g,"_")}`};let $o=null,Go=null,qo=null;const Sn=new Set;let Mn=!1;const qa=e=>{if(Sn.add(e),Mn||typeof window>"u")return;Mn=!0;const t=()=>{for(const o of Sn)o()};try{window.addEventListener("pagehide",t,{capture:!0}),window.addEventListener("beforeunload",t,{capture:!0}),typeof document<"u"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),document.addEventListener("freeze",t))}catch{}},cd=(e,t)=>{let o;try{o=e()}catch{return}const r=new Map,n=new Set;let a;const s=()=>{if(a=void 0,r.size===0&&n.size===0)return;const c=Array.from(r.entries()),d=Array.from(n);r.clear(),n.clear();for(const[l,u]of c)try{o.setItem(l,JSON.stringify(u,t?.replacer))}catch(m){console.error("Failed to persist deferred storage value",m),!r.has(l)&&!n.has(l)&&r.set(l,u)}for(const l of d)try{o.removeItem(l)}catch(u){console.error("Failed to remove deferred storage value",u),r.has(l)||n.add(l)}},i=()=>{a===void 0&&(a=setTimeout(s,0))};return qa(s),{getItem:c=>{if(r.has(c))return r.get(c)??null;if(n.has(c))return null;const d=u=>{if(u===null)return null;try{return JSON.parse(u,t?.reviver)}catch{try{o.removeItem(c)}catch{}return null}},l=o.getItem(c);return l instanceof Promise?l.then(d):d(l)},setItem:(c,d)=>{r.set(c,d),n.delete(c),i()},removeItem:c=>{r.delete(c),n.add(c),i()}}},Ur=e=>cd(()=>Ka(),e),dd=e=>{const t=new Map,o=new Set;let r;const n=()=>{if(r=void 0,t.size===0&&o.size===0)return;const s=Array.from(t.entries()),i=Array.from(o);t.clear(),o.clear();for(const[c,d]of s)try{e.setItem(c,d)}catch(l){console.error("Failed to persist deferred storage value",l),!t.has(c)&&!o.has(c)&&t.set(c,d)}for(const c of i)try{e.removeItem(c)}catch(d){console.error("Failed to remove deferred storage value",d),t.has(c)||o.add(c)}},a=()=>{r===void 0&&(r=setTimeout(n,0))};return qa(n),{getItem:s=>t.has(s)?t.get(s)??null:o.has(s)?null:e.getItem(s),setItem:(s,i)=>{t.set(s,i),o.delete(s),a()},removeItem:s=>{t.delete(s),o.add(s),a()},clear:()=>{t.clear(),o.clear(),r!==void 0&&(clearTimeout(r),r=void 0),e.clear()},key:s=>e.key(s),get length(){return e.length}}},Wa=e=>{if(typeof window>"u")return null;try{return window[e]??null}catch{return null}},Lr=()=>{const e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,o)=>{e.set(t,o)},removeItem:t=>{e.delete(t)},clear:()=>{e.clear()},key:t=>Array.from(e.keys())[t]??null,get length(){return e.size}}},Va=e=>{const t=Lr(),o=new Set,r=new Set,n=d=>{if(r.has(d))return null;if(o.has(d))return t.getItem(d);try{return e.getItem(d)}catch{return null}},a=(d,l)=>{try{e.setItem(d,l),t.removeItem(d),o.delete(d),r.delete(d);return}catch{try{e.removeItem(d)}catch{}}t.setItem(d,l),o.add(d),r.delete(d)},s=d=>{try{e.removeItem(d),r.delete(d)}catch{r.add(d)}t.removeItem(d),o.delete(d)},i=()=>{const d=[];try{for(let l=0;l<e.length;l+=1){const u=e.key(l);u&&d.push(u)}}catch{}try{e.clear(),r.clear()}catch{for(const l of d)r.add(l)}t.clear(),o.clear()},c=()=>{const d=new Set;try{for(let l=0;l<e.length;l+=1){const u=e.key(l);u&&!r.has(u)&&!o.has(u)&&d.add(u)}}catch{}for(const l of o)d.add(l);return[...d]};return{getItem:n,setItem:a,removeItem:s,clear:i,key:d=>c()[d]??null,get length(){return c().length}}},ld=()=>{const e=Wa("localStorage");return e?Va(e):Lr()},Ka=()=>($o||($o=ld()),$o),Lt=()=>(qo||(qo=dd(Ka())),qo),ud=()=>{const e=Wa("sessionStorage");return e?Va(e):Lr()},Ah=()=>(Go||(Go=ud()),Go),fd={markdown:"0.9375rem",code:"0.8125rem",uiHeader:"0.9375rem",uiLabel:"0.8750rem",meta:"0.875rem",micro:"0.875rem",settingsPageTitle:"1.125rem"},wh={markdown:"0.9063rem",code:"0.8750rem",uiHeader:"0.9063rem",uiLabel:"0.8438rem",meta:"0.8438rem",micro:"0.7813rem",settingsPageTitle:"1.0625rem"};function Tn(e){return`--text-${e.replace(/([A-Z])/g,"-$1").toLowerCase()}`}const Jt={semanticMarkdown:{fontSize:"var(--text-markdown)"},semanticCode:{fontSize:"var(--text-code)"},uiHeader:{fontSize:"var(--text-ui-header)"},uiLabel:{fontSize:"var(--text-ui-label)"},meta:{fontSize:"var(--text-meta)"},micro:{fontSize:"var(--text-micro)"},ui:{button:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-button-line-height)",letterSpacing:"var(--ui-button-letter-spacing)",fontWeight:"var(--ui-button-font-weight)"},buttonSmall:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-button-small-line-height)",letterSpacing:"var(--ui-button-small-letter-spacing)",fontWeight:"var(--ui-button-small-font-weight)"},buttonLarge:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-button-large-line-height)",letterSpacing:"var(--ui-button-large-letter-spacing)",fontWeight:"var(--ui-button-large-font-weight)"},label:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-label-line-height)",letterSpacing:"var(--ui-label-letter-spacing)",fontWeight:"var(--ui-label-font-weight)"},caption:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-caption-line-height)",letterSpacing:"var(--ui-caption-letter-spacing)",fontWeight:"var(--ui-caption-font-weight)"},badge:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-badge-line-height)",letterSpacing:"var(--ui-badge-letter-spacing)",fontWeight:"var(--ui-badge-font-weight)"},tooltip:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-tooltip-line-height)",letterSpacing:"var(--ui-tooltip-letter-spacing)",fontWeight:"var(--ui-tooltip-font-weight)"},input:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-input-line-height)",letterSpacing:"var(--ui-input-letter-spacing)",fontWeight:"var(--ui-input-font-weight)"},helperText:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-helper-text-line-height)",letterSpacing:"var(--ui-helper-text-letter-spacing)",fontWeight:"var(--ui-helper-text-font-weight)"}},code:{inline:{fontSize:"var(--text-code)",lineHeight:"var(--code-inline-line-height)",letterSpacing:"var(--code-inline-letter-spacing)",fontWeight:"var(--code-inline-font-weight)"},block:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},lineNumbers:{fontSize:"var(--text-micro)",lineHeight:"var(--code-line-numbers-line-height)",letterSpacing:"var(--code-line-numbers-letter-spacing)",fontWeight:"var(--code-line-numbers-font-weight)"}},markdown:{body:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-body-line-height)",letterSpacing:"var(--markdown-body-letter-spacing)",fontWeight:"var(--markdown-body-font-weight)"},bodySmall:{fontSize:"var(--text-meta)",lineHeight:"var(--markdown-body-small-line-height)",letterSpacing:"var(--markdown-body-small-letter-spacing)",fontWeight:"var(--markdown-body-small-font-weight)"},bodyLarge:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-body-large-line-height)",letterSpacing:"var(--markdown-body-large-letter-spacing)",fontWeight:"var(--markdown-body-large-font-weight)"},blockquote:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-blockquote-line-height)",letterSpacing:"var(--markdown-blockquote-letter-spacing)",fontWeight:"var(--markdown-blockquote-font-weight)"},list:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-list-line-height)",letterSpacing:"var(--markdown-list-letter-spacing)",fontWeight:"var(--markdown-list-font-weight)"},link:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-link-line-height)",letterSpacing:"var(--markdown-link-letter-spacing)",fontWeight:"var(--markdown-link-font-weight)"},code:{fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-line-height)",letterSpacing:"var(--markdown-code-letter-spacing)",fontWeight:"var(--markdown-code-font-weight)"},codeBlock:{fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-block-line-height)",letterSpacing:"var(--markdown-code-block-letter-spacing)",fontWeight:"var(--markdown-code-block-font-weight)"}},tool:{collapsed:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},popup:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},inline:{fontSize:"var(--text-code)",lineHeight:"var(--code-inline-line-height)",letterSpacing:"var(--code-inline-letter-spacing)",fontWeight:"var(--code-inline-font-weight)"}}},Wo={padding:{collapsed:"0.375rem",popup:"0.75rem",popupContainer:"1rem"},backgroundOpacity:{muted:"30",mutedAlt:"50"},getCollapsedStyles:()=>({...Jt.tool.collapsed,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.collapsed,borderRadius:0}),getPopupStyles:()=>({...Jt.tool.popup,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.popup,borderRadius:"0.75rem"}),getPopupContainerStyles:()=>({...Jt.tool.popup,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.popupContainer,borderRadius:"0.5rem",overflowX:"auto"}),getInlineStyles:()=>({...Jt.tool.inline})},md=[{id:"inter",label:"Inter",description:"Modern UI sans with excellent readability at small sizes.",stack:'"Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Inter",packageName:"@fontsource/inter",filePrefix:"inter",weights:[400,500,600]}},{id:"geist-sans",label:"Geist Sans",description:"Crisp sans-serif with a technical interface feel.",stack:'"Geist Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Geist Sans",packageName:"@fontsource/geist-sans",filePrefix:"geist-sans",weights:[400,500,600]}},{id:"atkinson-hyperlegible",label:"Atkinson Hyperlegible",description:"Accessibility-focused sans-serif optimized for character distinction.",stack:'"Atkinson Hyperlegible", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Atkinson Hyperlegible",packageName:"@fontsource/atkinson-hyperlegible",filePrefix:"atkinson-hyperlegible",weights:[400,700]}},{id:"source-sans-3",label:"Source Sans 3",description:"Adobe sans-serif tuned for clean, readable interfaces.",stack:'"Source Sans 3", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Source Sans 3",packageName:"@fontsource/source-sans-3",filePrefix:"source-sans-3",weights:[400,500,600]}},{id:"roboto",label:"Roboto",description:"Familiar Material-style sans-serif with broad UI usage.",stack:'"Roboto", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Roboto",packageName:"@fontsource/roboto",filePrefix:"roboto",weights:[400,500,600]}},{id:"noto-sans",label:"Noto Sans",description:"Readable sans-serif with strong international coverage.",stack:'"Noto Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Noto Sans",packageName:"@fontsource/noto-sans",filePrefix:"noto-sans",weights:[400,500,600]}},{id:"dm-sans",label:"DM Sans",description:"Modern product UI sans-serif with friendly proportions.",stack:'"DM Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"DM Sans",packageName:"@fontsource/dm-sans",filePrefix:"dm-sans",weights:[400,500,600]}},{id:"manrope",label:"Manrope",description:"Polished geometric sans-serif for modern app interfaces.",stack:'"Manrope", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Manrope",packageName:"@fontsource/manrope",filePrefix:"manrope",weights:[400,500,600]}},{id:"system",label:"System",description:"Native operating system interface font.",stack:'"SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif'}],gd=[{id:"jetbrains-mono",label:"JetBrains Mono",description:"Developer-focused monospace with strong punctuation clarity.",stack:'"JetBrains Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"JetBrains Mono",packageName:"@fontsource/jetbrains-mono",filePrefix:"jetbrains-mono",weights:[400,500,600]}},{id:"fira-code",label:"Fira Code",description:"Readable coding font with ligature support.",stack:'"Fira Code", "SFMono-Regular", "Menlo", monospace',source:{family:"Fira Code",packageName:"@fontsource/fira-code",filePrefix:"fira-code",weights:[400,500,600]}},{id:"geist-mono",label:"Geist Mono",description:"Sharp monospace pair for Geist Sans.",stack:'"Geist Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Geist Mono",packageName:"@fontsource/geist-mono",filePrefix:"geist-mono",weights:[400,500,600]}},{id:"commit-mono",label:"Commit Mono",description:"Code-oriented monospace with polished editor ergonomics.",stack:'"Commit Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Commit Mono",packageName:"@fontsource/commit-mono",filePrefix:"commit-mono",weights:[400,500,600]}},{id:"source-code-pro",label:"Source Code Pro",description:"Adobe monospace designed for source code readability.",stack:'"Source Code Pro", "SFMono-Regular", "Menlo", monospace',source:{family:"Source Code Pro",packageName:"@fontsource/source-code-pro",filePrefix:"source-code-pro",weights:[400,500,600]}},{id:"cascadia-code",label:"Cascadia Code",description:"Microsoft coding font popular in terminals and editors.",stack:'"Cascadia Code", "SFMono-Regular", "Menlo", monospace',source:{family:"Cascadia Code",packageName:"@fontsource/cascadia-code",filePrefix:"cascadia-code",weights:[400,500,600]}},{id:"roboto-mono",label:"Roboto Mono",description:"Neutral monospace companion to Roboto.",stack:'"Roboto Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Roboto Mono",packageName:"@fontsource/roboto-mono",filePrefix:"roboto-mono",weights:[400,500,600]}},{id:"iosevka",label:"Iosevka",description:"Compact monospace for dense code and terminal layouts.",stack:'"Iosevka", "SFMono-Regular", "Menlo", monospace',source:{family:"Iosevka",packageName:"@fontsource/iosevka",filePrefix:"iosevka",weights:[400,500,600]}},{id:"system-mono",label:"System Mono",description:"Native operating system monospace font.",stack:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'}],Ja=e=>Object.fromEntries(e.map(t=>[t.id,t])),pd=Ja(md),hd=Ja(gd),Fd="system",yd="system-mono",Ya=e=>typeof e=="string"&&e in pd,Qa=e=>typeof e=="string"&&e in hd,sr="openchamber.mobileKeyboardMode",bd='meta[name="viewport"]',Pn="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover",Eh=()=>!0;function ko(e,t="resize-content"){return e==="native"||e==="resize-content"?e:t}const Ad=e=>ko(e)==="resize-content"?`${Pn}, interactive-widget=resizes-content`:Pn,wd=()=>{if(typeof window>"u")return"resize-content";try{return ko(localStorage.getItem(sr))}catch{return"resize-content"}},Xa=e=>{const t=ko(e);if(typeof window<"u")try{t==="resize-content"?localStorage.removeItem(sr):localStorage.setItem(sr,t)}catch{}return t},Ch=e=>{const t=Xa(e);if(typeof document>"u")return t;document.documentElement.setAttribute("data-oc-mobile-keyboard-mode",t);const o=document.querySelector(bd);if(o instanceof HTMLMetaElement){const r=Ad(t);o.getAttribute("content")!==r&&o.setAttribute("content",r)}return t},Fe=20,Ed=8,Rn=4096,Cd=2160*60*6e4,I=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),o=t.startsWith("//");let r=t.replace(/\/+/g,"/");o&&!r.startsWith("//")&&(r=`/${r}`);const n=r==="/",a=/^[A-Za-z]:\/$/.test(r);return!n&&!a&&(r=r.replace(/\/+$/,"")),r},Te=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,Re=(e,t)=>{const o=I(t),r=I(e);if(!o||!r)return!1;const n=Te(o),a=Te(r);return a===n||a.startsWith(`${n}/`)},yt=e=>{if(!e||typeof e!="object")return{};const t=e,o={};for(const[r,n]of Object.entries(t)){const a=I(r);if(!a||!n||typeof n!="object")continue;const s=n,i=Array.isArray(s.openPaths)?Array.from(new Set(s.openPaths.filter(g=>typeof g=="string").map(g=>I(g)).filter(g=>g.length<=Rn&&Re(g,a)))).slice(-50):[],c=Array.isArray(s.expandedPaths)?Array.from(new Set(s.expandedPaths.filter(g=>typeof g=="string").map(g=>I(g)).filter(g=>g.length<=Rn&&Re(g,a)))).slice(-500):[],d=typeof s.selectedPath=="string"?I(s.selectedPath):null,l=d&&Re(d,a)?d:i[0]??null,u=typeof s.touchedAt=="number"&&Number.isFinite(s.touchedAt)?s.touchedAt:Date.now();if(Date.now()-u>Cd)continue;const m=o[a];if(m){const g=Array.from(new Set([...m.openPaths,...i])),p=Array.from(new Set([...m.expandedPaths,...c])),b=m.selectedPath??l??g[0]??null;o[a]={openPaths:g,selectedPath:b,expandedPaths:p,touchedAt:Math.max(m.touchedAt,u)};continue}o[a]={openPaths:i,selectedPath:l,expandedPaths:c,touchedAt:u}}return ye(o,Fe)},ye=(e,t)=>{const o=Object.entries(e);if(o.length<=t)return e;o.sort((n,a)=>(a[1]?.touchedAt??0)-(n[1]?.touchedAt??0));const r={};for(const[n,a]of o.slice(0,t))r[n]=a;return r},rt=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Bd=_t()(Nt(Dr((e,t)=>({byRoot:{},activeRuntimeKey:L(),runtimeSnapshots:{},resetForRuntimeSwitch:o=>{e(r=>{const n={...r.runtimeSnapshots,[r.activeRuntimeKey]:{byRoot:yt(r.byRoot),updatedAt:Date.now()}};return{activeRuntimeKey:o,runtimeSnapshots:n,byRoot:yt(n[o]?.byRoot)}})},addOpenPath:(o,r,n)=>{const a=I((o||"").trim()),s=I((r||"").trim());!a||!s||!n?.allowOutsideRoot&&!Re(s,a)||e(i=>{const c=i.byRoot[a],d=rt(c),l=d.openPaths.includes(s),u=l?d.openPaths:[...d.openPaths,s],m=d.selectedPath??s;if(c&&l&&c.selectedPath===m)return i;const g={...i.byRoot,[a]:{...d,openPaths:u,selectedPath:m}};return{byRoot:ye(g,Fe)}})},removeOpenPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=p=>Te(p)===c,l=i.selectedPath?d(i.selectedPath):!1;if(!i.openPaths.some(d)&&!l)return s;const u=i.openPaths.filter(p=>!d(p)),m=l?u[0]??null:i.selectedPath,g={...s.byRoot,[n]:{...i,openPaths:u,selectedPath:m,touchedAt:Date.now()}};return{byRoot:ye(g,Fe)}})},removeOpenPathsByPrefix:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=c.endsWith("/")?c:`${c}/`,l=p=>{const b=Te(p);return b===c||b.startsWith(d)},u=i.openPaths.filter(p=>!l(p));if(u.length===i.openPaths.length)return s;const m=i.selectedPath&&l(i.selectedPath)?u[0]??null:i.selectedPath,g={...s.byRoot,[n]:{...i,openPaths:u,selectedPath:m,touchedAt:Date.now()}};return{byRoot:ye(g,Fe)}})},removeExpandedPathsByPrefix:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=c.endsWith("/")?c:`${c}/`,l=i.expandedPaths.filter(m=>{const g=Te(m);return g!==c&&!g.startsWith(d)});if(l.length===i.expandedPaths.length)return s;const u={...s.byRoot,[n]:{...i,expandedPaths:l,touchedAt:Date.now()}};return{byRoot:ye(u,Fe)}})},setSelectedPath:(o,r,n)=>{const a=I((o||"").trim()),s=r?I(r.trim()):null;!a||s&&!n?.allowOutsideRoot&&!Re(s,a)||e(i=>{const c=i.byRoot[a],d=rt(c),l=s&&!d.openPaths.includes(s)?[...d.openPaths,s]:d.openPaths;if(c&&c.selectedPath===s&&l===c.openPaths)return i;const u={...i.byRoot,[a]:{...d,openPaths:l,selectedPath:s}};return{byRoot:ye(u,Fe)}})},ensureSelectedPath:o=>{const r=I((o||"").trim());if(!r)return;const n=t().byRoot[r];if(!n||n.selectedPath)return;const a=n.openPaths[0]??null;a&&t().setSelectedPath(r,a)},toggleExpandedPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||!Re(a,n)||e(s=>{const i=s.byRoot[n],c=rt(i),l=c.expandedPaths.includes(a)?c.expandedPaths.filter(m=>m!==a):[...c.expandedPaths,a];if(i&&i.expandedPaths===l&&i.selectedPath===c.selectedPath&&i.openPaths===c.openPaths)return s;const u={...s.byRoot,[n]:{...c,expandedPaths:l}};return{byRoot:ye(u,Fe)}})},collapseAllExpandedPaths:o=>{const r=I((o||"").trim());r&&e(n=>{const a=n.byRoot[r];if(!a||a.expandedPaths.length===0)return n;const s={...n.byRoot,[r]:{...rt(a),expandedPaths:[]}};return{byRoot:ye(s,Fe)}})},expandPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||!Re(a,n)||e(s=>{const i=s.byRoot[n],c=rt(i);if(c.expandedPaths.includes(a)&&i)return s;const l={...s.byRoot,[n]:{...c,expandedPaths:[...c.expandedPaths,a]}};return{byRoot:ye(l,Fe)}})},expandPaths:(o,r)=>{const n=I((o||"").trim());if(!n||!r||r.length===0)return;const a=r.map(s=>I((s||"").trim())).filter(s=>s&&Re(s,n));a.length!==0&&e(s=>{const i=s.byRoot[n],c=rt(i),d=new Set(c.expandedPaths),l=a.filter(m=>!d.has(m));if(l.length===0)return s;const u={...s.byRoot,[n]:{...c,expandedPaths:[...c.expandedPaths,...l]}};return{byRoot:ye(u,Fe)}})}}),{name:"files-view-tabs-store",version:3,storage:Ur(),migrate:(e,t)=>t<3||!e||typeof e!="object"?{byRoot:{},activeRuntimeKey:L(),runtimeSnapshots:{}}:e,partialize:e=>{const t={...e.runtimeSnapshots,[e.activeRuntimeKey]:{byRoot:yt(e.byRoot),updatedAt:Date.now()}},o=Object.fromEntries(Object.entries(t).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,Ed).map(([r,n])=>[r,{byRoot:yt(n.byRoot),updatedAt:n.updatedAt}]));return{activeRuntimeKey:e.activeRuntimeKey,runtimeSnapshots:o}},merge:(e,t)=>{const o=e&&typeof e=="object"?e:{},r=o.runtimeSnapshots&&typeof o.runtimeSnapshots=="object"?o.runtimeSnapshots:{},n=L();return{...t,activeRuntimeKey:n,runtimeSnapshots:r,byRoot:yt(r[n]?.byRoot)}}}),{name:"files-view-tabs-store"}));function In(e){return e==="vim"?"vim":"default"}const Yt={completion:{title:"{agent_name} is ready",message:"{last_message}"},error:{title:"Tool error",message:"{last_message}"},question:{title:"{agent_name} needs input",message:"{last_message}"},subtask:{title:"Subtask complete",message:"{last_message}"}},Se={completion:{title:"",message:""},error:{title:"",message:""},question:{title:"",message:""},subtask:{title:"",message:""}},Qt=(e,t)=>e?e.title===t.title&&e.message===t.message:!1,Dd=e=>{if(!e||typeof e!="object")return!1;const t=e;return Qt(t.completion,Yt.completion)&&Qt(t.error,Yt.error)&&Qt(t.question,Yt.question)&&Qt(t.subtask,Yt.subtask)},kd=380,vd=380,Sd=1400,Za=12,xn=120,bt=280,Vo=new Map,Ko=e=>(e??L()).trim()||"default",Bh=e=>$(e),$=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),o=t.startsWith("//");let r=t.replace(/\/+$/g,"");return r=r.replace(/\/+/g,"/"),o&&!r.startsWith("//")&&(r=`/${r}`),r===""?t.startsWith("/")?"/":"":r},es=e=>Number.isFinite(e)?Math.min(Sd,Math.max(vd,Math.round(e))):kd,mo=e=>{if(typeof e!="string")return null;const t=e.trim();return t?t.replace(/\\/g,"/"):null},go=e=>{if(typeof e!="string")return null;const t=e.trim();return t?t.length>xn?t.slice(0,xn):t:null},Hr=e=>e==="working"||e==="staged"||e==="turn"?e:null,Md=(e,t)=>(e==="file"||e==="preview")&&t||e,ts=(e,t,o)=>{if(e==="diff")return e;if(typeof o=="string"){const r=o.trim();if(r)return r}return Md(e,t)},os=(e,t)=>t===e?e:`${e}:${t}`,rs=e=>{const t=mo(e.targetPath),o=ts(e.mode,t,e.dedupeKey);return{id:os(e.mode,o),mode:e.mode,targetPath:t,dedupeKey:o,label:go(e.label),sessionTitleFallback:go(e.sessionTitleFallback),readOnly:e.readOnly===!0,stagedDiff:e.stagedDiff===!0,diffScope:Hr(e.diffScope)??(e.stagedDiff===!0?"staged":"working"),touchedAt:Date.now()}},ns=(e,t,o)=>{if(e.length<=t)return e;const n=[...e].sort((i,c)=>i.touchedAt-c.touchedAt).filter(i=>i.id!==o),a=e.length-t;if(a<=0||n.length===0)return e.slice(-t);const s=new Set(n.slice(0,a).map(i=>i.id));return e.filter(i=>!s.has(i.id))},as=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r;if(n.mode!=="diff"&&n.mode!=="file"&&n.mode!=="context"&&n.mode!=="plan"&&n.mode!=="chat"&&n.mode!=="preview"&&n.mode!=="browser"&&n.mode!=="git"&&n.mode!=="pr"&&n.mode!=="notes"&&n.mode!=="terminal")continue;const a=mo(typeof n.targetPath=="string"?n.targetPath:null),s=ts(n.mode,a,typeof n.dedupeKey=="string"?n.dedupeKey:null),i=os(n.mode,s);!i||o.has(i)||(o.add(i),t.push({id:i,mode:n.mode,targetPath:a,dedupeKey:s,label:go(typeof n.label=="string"?n.label:null),sessionTitleFallback:go(typeof n.sessionTitleFallback=="string"?n.sessionTitleFallback:null),readOnly:n.readOnly===!0,stagedDiff:n.stagedDiff===!0,diffScope:Hr(n.diffScope)??(n.stagedDiff===!0?"staged":"working"),touchedAt:typeof n.touchedAt=="number"&&Number.isFinite(n.touchedAt)?n.touchedAt:Date.now()}))}return t},ut=(e,t)=>t&&e.some(o=>o.id===t)?t:e.length===0?null:e[e.length-1].id,He=e=>{if(e){const t=as(e.tabs),o=ut(t,e.activeTabId);return{...e,tabs:t,activeTabId:o,touchedAt:Date.now()}}return{isOpen:!1,expanded:!1,tabs:[],activeTabId:null,widthByMode:{},touchedAt:Date.now()}},Td=(e,t)=>{const o=rs(t),r=o.mode==="file"&&o.targetPath?e.tabs.filter(c=>!(c.mode==="file"&&!c.targetPath)):e.tabs,n=r.findIndex(c=>c.id===o.id),a=n===-1?[...r,o]:r.map((c,d)=>d===n?{...c,mode:o.mode,targetPath:o.targetPath||c.targetPath,dedupeKey:o.dedupeKey,label:o.label,sessionTitleFallback:o.sessionTitleFallback||c.sessionTitleFallback,stagedDiff:o.stagedDiff,diffScope:o.diffScope,readOnly:o.readOnly,touchedAt:Date.now()}:c),s=o.id,i=ns(a,Za,s);return{...e,isOpen:!0,tabs:i,activeTabId:ut(i,s),touchedAt:Date.now()}},Pd=(e,t)=>{const o=e.tabs.find(s=>s.id===t)??null,r=e.tabs.filter(s=>s.id!==t);if(e.activeTabId!==t)return{...e,tabs:r,activeTabId:ut(r,e.activeTabId),isOpen:r.length>0?e.isOpen:!1,touchedAt:Date.now()};const n=o?r.filter(s=>s.mode===o.mode):[],a=n.length>0?n.reduce((s,i)=>i.touchedAt>=s.touchedAt?i:s):null;return{...e,tabs:r,activeTabId:a?.id??ut(r,null),isOpen:a?e.isOpen:!1,touchedAt:Date.now()}},Rd=(e,t,o)=>{if(t===o)return e;const r=e.tabs.findIndex(i=>i.id===t),n=e.tabs.findIndex(i=>i.id===o);if(r===-1||n===-1)return e;const a=[...e.tabs],[s]=a.splice(r,1);return s?(a.splice(n,0,s),{...e,tabs:a,touchedAt:Date.now()}):e},Id=(e,t,o)=>({...e,tabs:e.tabs.map(r=>r.id===t?{...r,targetPath:o}:r)}),Jo=e=>{if(!e||typeof e!="object")return{};const t=e,o={};for(const[r,n]of Object.entries(t)){const a=$(r);if(!a||!n||typeof n!="object")continue;const s=n;let i=as(s.tabs),c=typeof s.activeTabId=="string"?s.activeTabId:null;i.length===0&&(s.mode==="diff"||s.mode==="file"||s.mode==="context"||s.mode==="plan"||s.mode==="chat")&&(i=[rs({mode:s.mode,targetPath:typeof s.targetPath=="string"?s.targetPath:null,dedupeKey:typeof s.dedupeKey=="string"?s.dedupeKey:null,label:typeof s.label=="string"?s.label:null})],c=i[0]?.id??null);const d=ut(i,c),l=ns(i,Za,d),u={};if(s.widthByMode&&typeof s.widthByMode=="object")for(const[m,g]of Object.entries(s.widthByMode))(m==="diff"||m==="file"||m==="context"||m==="plan"||m==="chat"||m==="preview"||m==="browser"||m==="git"||m==="pr"||m==="notes"||m==="terminal")&&typeof g=="number"&&Number.isFinite(g)&&(u[m]=es(g));o[a]={isOpen:s.isOpen===!0,expanded:s.expanded===!0,tabs:l,activeTabId:ut(l,d),widthByMode:u,touchedAt:typeof s.touchedAt=="number"&&Number.isFinite(s.touchedAt)?s.touchedAt:Date.now()}}return o},je=(e,t)=>{const o=Object.entries(e);if(o.length<=t)return e;o.sort((n,a)=>(a[1]?.touchedAt??0)-(n[1]?.touchedAt??0));const r={};for(const[n,a]of o.slice(0,t))r[n]=a;return r},ie=_t()(Nt(Dr((e,t)=>({theme:"system",isMultiRunLauncherOpen:!1,multiRunLauncherPrefillPrompt:"",isSidebarOpen:!0,sidebarWidth:bt,hasManuallyResizedLeftSidebar:!1,contextPanelByDirectory:{},contextRailOrder:[],contextEditorTreeVisible:!0,contextEditorTreeWidth:240,notesPanelHeight:112,todoPanelHeight:259,isSessionSwitcherOpen:!1,isSessionDropdownOpen:!1,activeMainTab:"chat",mainTabGuard:null,sidebarOpenBeforeFullscreenTab:null,pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null,pendingDiagramFile:null,pendingFileNavigation:null,pendingFileFocusPath:null,isMobile:!1,isCommandPaletteOpen:!1,isHelpDialogOpen:!1,isAboutDialogOpen:!1,isOpenCodeStatusDialogOpen:!1,openCodeStatusText:"",isSessionCreateDialogOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null,isSettingsDialogOpen:!1,isNewWorktreeDialogOpen:!1,isModelSelectorOpen:!1,sidebarSection:"sessions",settingsPage:"home",settingsHasOpenedOnce:!1,settingsProjectsSelectedId:null,settingsRemoteInstancesSelectedId:null,eventStreamStatus:"idle",eventStreamHint:null,showReasoningTraces:!0,sessionRecapEnabled:!0,sessionSuggestionEnabled:!0,sessionGoalEnabled:!0,sessionGoalDefaultBudgetEnabled:!1,sessionGoalDefaultBudget:2e5,collapsibleThinkingBlocks:!0,chatRenderMode:"live",activityRenderMode:"summary",showDeletionDialog:!0,autoDeleteEnabled:!1,autoDeleteAfterDays:30,sessionRetentionAction:"archive",autoDeleteLastRunAt:null,messageLimit:200,fontSize:100,globalDraftStarters:null,terminalFontSize:14,terminalShell:"auto",terminalLoginShells:[],editorFontSize:13,uiFont:Fd,monoFont:yd,padding:100,cornerRadius:18,inputBarOffset:0,mobileKeyboardMode:wd(),favoriteModels:[],hiddenModels:[],providerOrder:[],collapsedModelProviders:[],recentModels:[],recentAgents:[],recentEfforts:{},diffLayoutPreference:"inline",diffFileLayout:{},diffWrapLines:!1,gitChangesViewMode:"flat",isTimelineDialogOpen:!1,isPromptNavigatorPanelOpen:!1,isImagePreviewOpen:!1,nativeNotificationsEnabled:!1,notificationMode:"hidden-only",notifyOnSubtasks:!0,dockBadgeEnabled:!0,notifyOnCompletion:!0,notifyOnError:!0,notifyOnQuestion:!0,notificationTemplates:{completion:{...Se.completion},error:{...Se.error},question:{...Se.question},subtask:{...Se.subtask}},summarizeLastMessage:!1,summaryThreshold:200,summaryLength:100,maxLastMessageLength:250,showTerminalQuickKeysOnDesktop:!1,persistChatDraft:!0,showOpenCodeUpdateNotifications:!0,agentControlToolEnabled:!0,inputSpellcheckEnabled:!1,wideChatLayoutEnabled:!1,codeBlockLineWrap:!0,showToolFileIcons:!0,showTurnChangedFiles:!1,showExpandedBashTools:!1,showExpandedEditTools:!1,timeFormatPreference:"auto",weekStartPreference:"auto",desktopWindowControlsPosition:"right",mermaidRenderingMode:"svg",userMessageRenderingMode:"markdown",collapsibleUserMessages:!0,stickyUserHeader:!1,promptNavigatorEnabled:!0,expandedEditorToolbar:!1,showSplitAssistantMessageActions:!1,allowPromptingSubagentSessions:!1,draftStartersVisible:!0,isMobileSessionStatusBarCollapsed:!1,mobileSessionPanelOpen:!1,mobileSessionFilterProjectId:null,isExpandedInput:!1,reportUsage:!0,shortcutOverrides:{},fileEditorKeymap:"default",setTheme:o=>{e({theme:o}),t().applyTheme()},toggleSidebar:()=>{e(o=>{const r=!o.isSidebarOpen;return r&&!o.hasManuallyResizedLeftSidebar?{isSidebarOpen:r,sidebarWidth:bt}:{isSidebarOpen:r}})},setSidebarOpen:o=>{e(r=>r.isSidebarOpen===o?o&&!r.hasManuallyResizedLeftSidebar&&r.sidebarWidth!==bt?{isSidebarOpen:o,sidebarWidth:bt}:r:o&&!r.hasManuallyResizedLeftSidebar?{isSidebarOpen:o,sidebarWidth:bt}:{isSidebarOpen:o})},setSidebarWidth:o=>{e({sidebarWidth:o,hasManuallyResizedLeftSidebar:!0})},setContextRailOrder:o=>{const r=Array.isArray(o)?o.filter((n,a)=>typeof n=="string"&&n.trim()!==""&&o.indexOf(n)===a):[];e({contextRailOrder:r})},toggleContextEditorTree:()=>{e(o=>({contextEditorTreeVisible:!o.contextEditorTreeVisible}))},setContextEditorTreeWidth:o=>{Number.isFinite(o)&&e({contextEditorTreeWidth:Math.min(480,Math.max(200,Math.round(o)))})},openContextSurface:(o,r)=>{const n=$((o||"").trim());if(!n)return;const a=t(),s=a.contextPanelByDirectory[n],i=s?.tabs??[],c=i.find(l=>l.id===s?.activeTabId)??null;if(s?.isOpen&&c?.mode===r){a.closeContextPanel(n);return}const d=i.filter(l=>l.mode===r);if(d.length>0){const l=d.reduce((u,m)=>m.touchedAt>=u.touchedAt?m:u);a.setActiveContextPanelTab(n,l.id);return}r==="preview"||r==="chat"||a.openContextPanelTab(n,{mode:r})},openContextPanelTab:(o,r)=>{const n=$((o||"").trim());n&&e(a=>{const s=a.contextPanelByDirectory[n],i=He(s),c={...a.contextPanelByDirectory,[n]:Td(i,r)};return{contextPanelByDirectory:je(c,20)}})},openContextDiff:(o,r,n=!1,a=null)=>{const s=$((o||"").trim()),i=(r||"").trim();if(!s||!i)return;const c=Hr(a)??(n?"staged":"working");t().openContextPanelTab(s,{mode:"diff",targetPath:i,stagedDiff:c==="staged",diffScope:c})},openContextFile:(o,r)=>{const n=$((o||"").trim()),a=mo(r);!n||!a||(t().openContextPanelTab(n,{mode:"file",targetPath:a}),t().setPendingFileFocusPath(a),t().setPendingFileNavigation(null))},openContextFileAtLine:(o,r,n,a)=>{const s=$((o||"").trim()),i=mo(r),c=Number.isFinite(n)?Math.max(1,Math.trunc(n)):1,d=Number.isFinite(a)?Math.max(1,Math.trunc(a)):1;!s||!i||(t().openContextPanelTab(s,{mode:"file",targetPath:i}),t().setPendingFileFocusPath(null),t().setPendingFileNavigation({path:i,line:c,column:d}))},openContextOverview:o=>{const r=$((o||"").trim());r&&t().openContextPanelTab(r,{mode:"context"})},openContextPlan:o=>{const r=$((o||"").trim());r&&t().openContextPanelTab(r,{mode:"plan"})},openContextPreview:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();if(!n||!a)return;let s=null;try{const i=new URL(a);(i.protocol==="http:"||i.protocol==="https:")&&(s=i.host||i.hostname||"Preview")}catch{}t().openContextPanelTab(n,{mode:"preview",targetPath:a,dedupeKey:a,label:s})},openContextBrowser:(o,r="")=>{const n=$((o||"").trim());if(!n)return;const a=typeof r=="string"&&r.trim().length>0?r.trim():"";t().openContextPanelTab(n,{mode:"browser",targetPath:a,dedupeKey:"desktop-browser",label:"Browser"})},setContextPanelTabTargetPath:(o,r,n)=>{const a=$((o||"").trim()),s=(r||"").trim();!a||!s||e(i=>{const c=i.contextPanelByDirectory[a];return c?{contextPanelByDirectory:{...i.contextPanelByDirectory,[a]:Id(c,s,n)}}:i})},setActiveContextPanelTab:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();!n||!a||e(s=>{const i=s.contextPanelByDirectory[n],c=He(i);if(!c.tabs.some(l=>l.id===a)||c.activeTabId===a&&c.isOpen)return s;const d={...s.contextPanelByDirectory,[n]:{...c,isOpen:!0,activeTabId:a,touchedAt:Date.now(),tabs:c.tabs.map(l=>l.id===a?{...l,touchedAt:Date.now()}:l)}};return{contextPanelByDirectory:je(d,20)}})},reorderContextPanelTabs:(o,r,n)=>{const a=$((o||"").trim()),s=(r||"").trim(),i=(n||"").trim();!a||!s||!i||e(c=>{const d=c.contextPanelByDirectory[a],l=He(d);if(!l.tabs.some(g=>g.id===s)||!l.tabs.some(g=>g.id===i))return c;const u=Rd(l,s,i);if(u.tabs===l.tabs)return c;const m={...c.contextPanelByDirectory,[a]:u};return{contextPanelByDirectory:je(m,20)}})},closeContextPanelTab:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();if(!n||!a)return;const s=t().contextPanelByDirectory[n]?.tabs.find(i=>i.id===a);e(i=>{const c=i.contextPanelByDirectory[n],d=He(c);if(!d.tabs.some(u=>u.id===a))return i;const l={...i.contextPanelByDirectory,[n]:Pd(d,a)};return{contextPanelByDirectory:je(l,20)}}),s?.mode==="file"&&s.targetPath&&Bd.getState().removeOpenPath(n,s.targetPath)},closeContextPanel:o=>{const r=$((o||"").trim());r&&e(n=>{const a=n.contextPanelByDirectory[r];if(!a||!a.isOpen)return n;const s={...n.contextPanelByDirectory,[r]:{...He(a),isOpen:!1}};return{contextPanelByDirectory:je(s,20)}})},toggleContextPanelExpanded:o=>{const r=$((o||"").trim());r&&e(n=>{const a=n.contextPanelByDirectory[r],s=He(a),i={...n.contextPanelByDirectory,[r]:{...s,expanded:!s.expanded}};return{contextPanelByDirectory:je(i,20)}})},setContextPanelWidth:(o,r,n)=>{const a=$((o||"").trim());a&&e(s=>{const i=s.contextPanelByDirectory[a],c=He(i),d={...s.contextPanelByDirectory,[a]:{...c,widthByMode:{...c.widthByMode,[r]:es(n)}}};return{contextPanelByDirectory:je(d,20)}})},setNotesPanelHeight:o=>{e({notesPanelHeight:o})},setTodoPanelHeight:o=>{e({todoPanelHeight:o})},setSessionSwitcherOpen:o=>{t().isSessionSwitcherOpen!==o&&e({isSessionSwitcherOpen:o})},setSessionDropdownOpen:o=>{t().isSessionDropdownOpen!==o&&e({isSessionDropdownOpen:o})},setMainTabGuard:o=>{t().mainTabGuard!==o&&e({mainTabGuard:o})},setActiveMainTab:o=>{const r=t().mainTabGuard;r&&!r(o)||(Vo.set(Ko(),o),e({activeMainTab:o}))},prepareForRuntimeSwitch:o=>{Vo.set(Ko(o),t().activeMainTab)},restoreForRuntimeSwitch:o=>{const r=Vo.get(Ko(o))??"chat";e({activeMainTab:r})},setPendingDiffFile:(o,r=!1,n=null)=>{e({pendingDiffFile:o,pendingDiffStaged:o?r:!1,pendingDiffScope:o?n:null})},setPendingDiagramFile:o=>{e({pendingDiagramFile:o})},setPendingFileNavigation:o=>{e({pendingFileNavigation:o})},setPendingFileFocusPath:o=>{e({pendingFileFocusPath:o})},navigateToDiff:(o,r=!1,n=null)=>{const a=t().mainTabGuard;a&&!a("diff")||e({pendingDiffFile:o,pendingDiffStaged:r,pendingDiffScope:n,activeMainTab:"diff"})},consumePendingDiffFile:()=>{const{pendingDiffFile:o}=t();return o&&e({pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null}),o},navigateToDiagram:o=>{const r=t().mainTabGuard;r&&!r("diagram")||e({pendingDiagramFile:o,activeMainTab:"diagram"})},consumePendingDiagramFile:()=>{const{pendingDiagramFile:o}=t();return o&&e({pendingDiagramFile:null}),o},setIsMobile:o=>{e({isMobile:o})},toggleCommandPalette:()=>{e(o=>({isCommandPaletteOpen:!o.isCommandPaletteOpen}))},setCommandPaletteOpen:o=>{e({isCommandPaletteOpen:o})},toggleHelpDialog:()=>{e(o=>({isHelpDialogOpen:!o.isHelpDialogOpen}))},setHelpDialogOpen:o=>{e({isHelpDialogOpen:o})},setAboutDialogOpen:o=>{e({isAboutDialogOpen:o})},setOpenCodeStatusDialogOpen:o=>{e({isOpenCodeStatusDialogOpen:o})},setOpenCodeStatusText:o=>{e({openCodeStatusText:o})},setSessionCreateDialogOpen:o=>{e({isSessionCreateDialogOpen:o})},setScheduledTasksDialogOpen:o=>{e(o?{isScheduledTasksDialogOpen:!0,isArchivePageOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1}:{isScheduledTasksDialogOpen:!1})},setArchivePageOpen:o=>{e(o?{isArchivePageOpen:!0,isScheduledTasksDialogOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1}:{isArchivePageOpen:!1})},setWorktreesPageProjectId:o=>{e(o?{worktreesPageProjectId:o,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,isMultiRunLauncherOpen:!1}:{worktreesPageProjectId:null})},closeMainSurfaces:()=>{const o=t();!o.isScheduledTasksDialogOpen&&!o.isArchivePageOpen&&!o.worktreesPageProjectId&&!o.isMultiRunLauncherOpen||e({isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1,multiRunLauncherPrefillPrompt:""})},setSettingsDialogOpen:o=>{e(r=>o?r.settingsHasOpenedOnce?{isSettingsDialogOpen:!0}:{isSettingsDialogOpen:!0,settingsHasOpenedOnce:!0}:{isSettingsDialogOpen:!1})},setNewWorktreeDialogOpen:o=>{e({isNewWorktreeDialogOpen:o})},setModelSelectorOpen:o=>{e({isModelSelectorOpen:o})},setSidebarSection:o=>{e({sidebarSection:o})},setSettingsPage:o=>{e({settingsPage:o})},setSettingsProjectsSelectedId:o=>{e({settingsProjectsSelectedId:o})},setSettingsRemoteInstancesSelectedId:o=>{e({settingsRemoteInstancesSelectedId:o})},setEventStreamStatus:(o,r)=>{e({eventStreamStatus:o,eventStreamHint:r??null})},setShowReasoningTraces:o=>{e({showReasoningTraces:o})},setSessionRecapEnabled:o=>{e({sessionRecapEnabled:o})},setSessionSuggestionEnabled:o=>{e({sessionSuggestionEnabled:o})},setSessionGoalEnabled:o=>{e({sessionGoalEnabled:o})},setSessionGoalDefaultBudgetEnabled:o=>{e({sessionGoalDefaultBudgetEnabled:o})},setSessionGoalDefaultBudget:o=>{e({sessionGoalDefaultBudget:o})},setCollapsibleThinkingBlocks:o=>{e({collapsibleThinkingBlocks:o})},setChatRenderMode:o=>{e({chatRenderMode:o})},setActivityRenderMode:o=>{e({activityRenderMode:o})},setShowDeletionDialog:o=>{e({showDeletionDialog:o})},setAutoDeleteEnabled:o=>{e({autoDeleteEnabled:o})},setAutoDeleteAfterDays:o=>{const r=Math.max(1,Math.min(365,o));e({autoDeleteAfterDays:r})},setSessionRetentionAction:o=>{e({sessionRetentionAction:o})},setAutoDeleteLastRunAt:o=>{e({autoDeleteLastRunAt:o})},setMessageLimit:o=>{const r=Math.max(10,Math.min(500,Math.round(o)));e({messageLimit:r})},setFontSize:o=>{const r=Math.max(50,Math.min(200,o));e({fontSize:r}),t().applyTypography()},setGlobalDraftStarters:o=>{e({globalDraftStarters:o})},setDraftStartersVisible:o=>{e({draftStartersVisible:o})},setTerminalFontSize:o=>{const r=Math.round(o),n=Math.max(9,Math.min(52,r));e({terminalFontSize:n})},setTerminalShell:o=>{e({terminalShell:o})},setTerminalLoginShells:o=>{e({terminalLoginShells:[...new Set(o)]})},setEditorFontSize:o=>{const r=Math.round(o),n=Math.max(9,Math.min(32,r));e({editorFontSize:n})},setUiFont:o=>{e({uiFont:o})},setMonoFont:o=>{e({monoFont:o})},setPadding:o=>{const r=Math.max(50,Math.min(200,o));e({padding:r}),t().applyPadding()},setCornerRadius:o=>{e({cornerRadius:o})},applyTypography:()=>{const{fontSize:o}=t(),r=document.documentElement,n=o/100,a=Object.entries(fd);if(n===1){for(const[s]of a)r.style.removeProperty(Tn(s));return}for(const[s,i]of a){const c=parseFloat(i);Number.isFinite(c)&&r.style.setProperty(Tn(s),`${c*n}rem`)}},applyPadding:()=>{const{padding:o}=t(),r=document.documentElement,n=o/100;if(n===1){r.style.removeProperty("--padding-scale"),r.style.removeProperty("--line-height-tight"),r.style.removeProperty("--line-height-normal"),r.style.removeProperty("--line-height-relaxed"),r.style.removeProperty("--line-height-loose");return}const a=Math.sqrt(n);r.style.setProperty("--padding-scale",a.toString());const s=1+(n-1)*.15;r.style.setProperty("--line-height-tight",(1.25*s).toFixed(3)),r.style.setProperty("--line-height-normal",(1.5*s).toFixed(3)),r.style.setProperty("--line-height-relaxed",(1.625*s).toFixed(3)),r.style.setProperty("--line-height-loose",(2*s).toFixed(3))},setDiffLayoutPreference:o=>{e({diffLayoutPreference:o})},setDiffFileLayout:(o,r)=>{e(n=>({diffFileLayout:{...n.diffFileLayout,[o]:r}}))},setDiffWrapLines:o=>{e({diffWrapLines:o})},setGitChangesViewMode:o=>{e({gitChangesViewMode:o})},setInputBarOffset:o=>{e({inputBarOffset:o})},setMobileKeyboardMode:o=>{e(r=>r.mobileKeyboardMode===o?r:{mobileKeyboardMode:o})},toggleFavoriteModel:(o,r)=>{e(n=>n.favoriteModels.some(s=>s.providerID===o&&s.modelID===r)?{favoriteModels:n.favoriteModels.filter(s=>!(s.providerID===o&&s.modelID===r))}:{favoriteModels:[{providerID:o,modelID:r},...n.favoriteModels]})},reorderFavoriteModel:(o,r,n,a)=>{e(s=>{const i=s.favoriteModels.findIndex(u=>u.providerID===o&&u.modelID===r),c=s.favoriteModels.findIndex(u=>u.providerID===n&&u.modelID===a);if(i===-1||c===-1||i===c)return s;const d=s.favoriteModels.slice(),[l]=d.splice(i,1);return l?(d.splice(c,0,l),{favoriteModels:d}):s})},setProviderOrder:o=>{e(r=>{const n=o.filter(s=>typeof s=="string"&&s.length>0),a=r.providerOrder;return a.length===n.length&&a.every((s,i)=>s===n[i])?r:{providerOrder:n}})},toggleHiddenModel:(o,r)=>{e(n=>n.hiddenModels.some(s=>s.providerID===o&&s.modelID===r)?{hiddenModels:n.hiddenModels.filter(s=>!(s.providerID===o&&s.modelID===r))}:{hiddenModels:[{providerID:o,modelID:r},...n.hiddenModels]})},isHiddenModel:(o,r)=>{const{hiddenModels:n}=t();return n.some(a=>a.providerID===o&&a.modelID===r)},hideAllModels:(o,r)=>{e(n=>{const a=n.hiddenModels.filter(i=>i.providerID!==o);return{hiddenModels:[...r.filter(i=>typeof i=="string"&&i.length>0).map(i=>({providerID:o,modelID:i})),...a]}})},showAllModels:o=>{e(r=>({hiddenModels:r.hiddenModels.filter(n=>n.providerID!==o)}))},toggleModelProviderCollapsed:o=>{const r=typeof o=="string"?o.trim():"";r&&e(n=>n.collapsedModelProviders.includes(r)?{collapsedModelProviders:n.collapsedModelProviders.filter(s=>s!==r)}:{collapsedModelProviders:[...n.collapsedModelProviders,r]})},setModelProvidersCollapsed:(o,r)=>{const n=Array.from(new Set(o.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean)));n.length!==0&&e(a=>{const s=new Set(n),i=a.collapsedModelProviders.filter(c=>!s.has(c));return{collapsedModelProviders:r?[...i,...n]:i}})},isFavoriteModel:(o,r)=>{const{favoriteModels:n}=t();return n.some(a=>a.providerID===o&&a.modelID===r)},addRecentModel:(o,r)=>{e(n=>{const a=n.recentModels.filter(s=>!(s.providerID===o&&s.modelID===r));return{recentModels:[{providerID:o,modelID:r},...a].slice(0,5)}})},addRecentAgent:o=>{const r=typeof o=="string"?o.trim():"";r&&e(n=>{if(n.recentAgents.includes(r))return n;const a=n.recentAgents;return{recentAgents:[r,...a].slice(0,5)}})},addRecentEffort:(o,r,n)=>{const a=typeof o=="string"?o.trim():"",s=typeof r=="string"?r.trim():"";if(!a||!s)return;const i=`${a}/${s}`,c=typeof n=="string"&&n.trim().length>0?n.trim():"default";e(d=>{const l=d.recentEfforts[i]??[];if(l.includes(c))return d;const u=l;return{recentEfforts:{...d.recentEfforts,[i]:[c,...u].slice(0,5)}}})},applyTheme:()=>{const{theme:o}=t(),r=document.documentElement;if(r.classList.remove("light","dark"),o==="system"){const n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.add(n)}else r.classList.add(o)},setMultiRunLauncherOpen:o=>{e(r=>({isMultiRunLauncherOpen:o,multiRunLauncherPrefillPrompt:o?r.multiRunLauncherPrefillPrompt:"",...o?{isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null}:{}}))},openMultiRunLauncher:()=>{e({isMultiRunLauncherOpen:!0,multiRunLauncherPrefillPrompt:"",isSessionSwitcherOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null})},openMultiRunLauncherWithPrompt:o=>{e({isMultiRunLauncherOpen:!0,multiRunLauncherPrefillPrompt:o,isSessionSwitcherOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null})},setTimelineDialogOpen:o=>{e({isTimelineDialogOpen:o})},setPromptNavigatorPanelOpen:o=>{e({isPromptNavigatorPanelOpen:o})},togglePromptNavigatorPanel:()=>{e(o=>({isPromptNavigatorPanelOpen:!o.isPromptNavigatorPanelOpen}))},setImagePreviewOpen:o=>{e({isImagePreviewOpen:o})},setNativeNotificationsEnabled:o=>{e({nativeNotificationsEnabled:o})},setNotificationMode:o=>{e({notificationMode:o})},setShowTerminalQuickKeysOnDesktop:o=>{e({showTerminalQuickKeysOnDesktop:o})},setNotifyOnSubtasks:o=>{e({notifyOnSubtasks:o})},setDockBadgeEnabled:o=>{e({dockBadgeEnabled:o})},setNotifyOnCompletion:o=>{e({notifyOnCompletion:o})},setNotifyOnError:o=>{e({notifyOnError:o})},setNotifyOnQuestion:o=>{e({notifyOnQuestion:o})},setNotificationTemplates:o=>{e({notificationTemplates:o})},setSummarizeLastMessage:o=>{e({summarizeLastMessage:o})},setSummaryThreshold:o=>{e({summaryThreshold:o})},setSummaryLength:o=>{e({summaryLength:o})},setMaxLastMessageLength:o=>{e({maxLastMessageLength:o})},setPersistChatDraft:o=>{e({persistChatDraft:o})},setShowOpenCodeUpdateNotifications:o=>{e({showOpenCodeUpdateNotifications:o})},setAgentControlToolEnabled:o=>{e({agentControlToolEnabled:o})},setInputSpellcheckEnabled:o=>{e({inputSpellcheckEnabled:o})},setWideChatLayoutEnabled:o=>{e({wideChatLayoutEnabled:o})},setCodeBlockLineWrap:o=>{e({codeBlockLineWrap:o})},setShowToolFileIcons:o=>{e({showToolFileIcons:o})},setShowTurnChangedFiles:o=>{e({showTurnChangedFiles:o})},setShowExpandedBashTools:o=>{e({showExpandedBashTools:o})},setShowExpandedEditTools:o=>{e({showExpandedEditTools:o})},setTimeFormatPreference:o=>{e({timeFormatPreference:o})},setWeekStartPreference:o=>{e({weekStartPreference:o})},setDesktopWindowControlsPosition:o=>{e({desktopWindowControlsPosition:o==="left"?"left":"right"})},setMermaidRenderingMode:o=>{e({mermaidRenderingMode:o})},setUserMessageRenderingMode:o=>{e({userMessageRenderingMode:o})},setCollapsibleUserMessages:o=>{e({collapsibleUserMessages:o})},setStickyUserHeader:o=>{e({stickyUserHeader:o})},setPromptNavigatorEnabled:o=>{e({promptNavigatorEnabled:o})},setExpandedEditorToolbar:o=>{e({expandedEditorToolbar:o})},setShowSplitAssistantMessageActions:o=>{e({showSplitAssistantMessageActions:o})},setAllowPromptingSubagentSessions:o=>{e({allowPromptingSubagentSessions:o})},setIsMobileSessionStatusBarCollapsed:o=>{e({isMobileSessionStatusBarCollapsed:o})},setMobileSessionPanelOpen:o=>{e({mobileSessionPanelOpen:o})},setMobileSessionFilterProjectId:o=>{e({mobileSessionFilterProjectId:o})},setReportUsage:o=>{e({reportUsage:o})},viewPagerPage:"center",setViewPagerPage:o=>{e({viewPagerPage:o}),e({isSessionSwitcherOpen:o==="left"})},setShortcutOverride:(o,r)=>{e(n=>({shortcutOverrides:{...n.shortcutOverrides,[o]:r}}))},clearShortcutOverride:o=>{e(r=>{const n={...r.shortcutOverrides};return delete n[o],{shortcutOverrides:n}})},resetAllShortcutOverrides:()=>{e({shortcutOverrides:{}})},setFileEditorKeymap:o=>{e({fileEditorKeymap:In(o)})},toggleExpandedInput:()=>{e(o=>({isExpandedInput:!o.isExpandedInput}))},setExpandedInput:o=>{e({isExpandedInput:o})}}),{name:"ui-store",storage:Ur(),version:12,migrate:(e,t)=>{if(!e||typeof e!="object")return e;const o=e;if(t<12&&(o.desktopWindowControlsPosition==="auto"||o.desktopWindowControlsPosition==null)&&(o.desktopWindowControlsPosition="right"),t<11&&o.terminalFontSize===13&&(o.terminalFontSize=14),t<10&&delete o.diffViewMode,t<9&&((typeof o.notesPanelHeight!="number"||!Number.isFinite(o.notesPanelHeight))&&(o.notesPanelHeight=112),(typeof o.todoPanelHeight!="number"||!Number.isFinite(o.todoPanelHeight))&&(o.todoPanelHeight=259)),t<1&&Dd(o.notificationTemplates)&&(o.notificationTemplates={completion:{...Se.completion},error:{...Se.error},question:{...Se.question},subtask:{...Se.subtask}}),t<3){const r=new Set([90,120,180,220]),n=o.memoryLimitHistorical,a=o.memoryLimitActiveSession;typeof n=="number"&&!r.has(n)?o.messageLimit=n:typeof a=="number"&&!r.has(a)&&(o.messageLimit=a),delete o.memoryLimitHistorical,delete o.memoryLimitViewport,delete o.memoryLimitActiveSession}if(delete o.isRightSidebarOpen,delete o.rightSidebarWidth,delete o.rightSidebarTab,o.contextPanelByDirectory=Jo(o.contextPanelByDirectory),t<5)if(!o.shortcutOverrides||typeof o.shortcutOverrides!="object")o.shortcutOverrides={};else{const r=o.shortcutOverrides,n={};for(const[a,s]of Object.entries(r))typeof a=="string"&&typeof s=="string"&&(n[a]=s);o.shortcutOverrides=n}return t<6&&(o.contextPanelByDirectory=Jo(o.contextPanelByDirectory)),t<7&&(o.contextPanelByDirectory=Jo(o.contextPanelByDirectory)),t<8&&o.gitChangesViewMode!=="flat"&&o.gitChangesViewMode!=="tree"&&(o.gitChangesViewMode="flat"),o.fileEditorKeymap=In(o.fileEditorKeymap),o.contextRailOrder=Array.isArray(o.contextRailOrder)?o.contextRailOrder.filter(r=>typeof r=="string"&&r.trim()!==""):[],o},partialize:e=>({theme:e.theme,isSidebarOpen:e.isSidebarOpen,sidebarWidth:e.sidebarWidth,contextPanelByDirectory:e.contextPanelByDirectory,contextRailOrder:e.contextRailOrder,contextEditorTreeVisible:e.contextEditorTreeVisible,contextEditorTreeWidth:e.contextEditorTreeWidth,notesPanelHeight:e.notesPanelHeight,todoPanelHeight:e.todoPanelHeight,isSessionSwitcherOpen:e.isSessionSwitcherOpen,activeMainTab:e.activeMainTab,sidebarSection:e.sidebarSection,settingsPage:e.settingsPage,settingsHasOpenedOnce:e.settingsHasOpenedOnce,settingsProjectsSelectedId:e.settingsProjectsSelectedId,settingsRemoteInstancesSelectedId:e.settingsRemoteInstancesSelectedId,isSessionCreateDialogOpen:e.isSessionCreateDialogOpen,showReasoningTraces:e.showReasoningTraces,sessionRecapEnabled:e.sessionRecapEnabled,sessionSuggestionEnabled:e.sessionSuggestionEnabled,sessionGoalEnabled:e.sessionGoalEnabled,sessionGoalDefaultBudgetEnabled:e.sessionGoalDefaultBudgetEnabled,sessionGoalDefaultBudget:e.sessionGoalDefaultBudget,collapsibleThinkingBlocks:e.collapsibleThinkingBlocks,chatRenderMode:e.chatRenderMode,activityRenderMode:e.activityRenderMode,showDeletionDialog:e.showDeletionDialog,autoDeleteEnabled:e.autoDeleteEnabled,autoDeleteAfterDays:e.autoDeleteAfterDays,sessionRetentionAction:e.sessionRetentionAction,autoDeleteLastRunAt:e.autoDeleteLastRunAt,messageLimit:e.messageLimit,fontSize:e.fontSize,globalDraftStarters:e.globalDraftStarters,terminalFontSize:e.terminalFontSize,terminalShell:e.terminalShell,terminalLoginShells:e.terminalLoginShells,editorFontSize:e.editorFontSize,uiFont:e.uiFont,monoFont:e.monoFont,padding:e.padding,cornerRadius:e.cornerRadius,favoriteModels:e.favoriteModels,hiddenModels:e.hiddenModels,providerOrder:e.providerOrder,collapsedModelProviders:e.collapsedModelProviders,recentModels:e.recentModels,recentAgents:e.recentAgents,recentEfforts:e.recentEfforts,diffLayoutPreference:e.diffLayoutPreference,diffWrapLines:e.diffWrapLines,gitChangesViewMode:e.gitChangesViewMode,nativeNotificationsEnabled:e.nativeNotificationsEnabled,notificationMode:e.notificationMode,showTerminalQuickKeysOnDesktop:e.showTerminalQuickKeysOnDesktop,notifyOnSubtasks:e.notifyOnSubtasks,dockBadgeEnabled:e.dockBadgeEnabled,notifyOnCompletion:e.notifyOnCompletion,notifyOnError:e.notifyOnError,notifyOnQuestion:e.notifyOnQuestion,notificationTemplates:e.notificationTemplates,summarizeLastMessage:e.summarizeLastMessage,summaryThreshold:e.summaryThreshold,summaryLength:e.summaryLength,maxLastMessageLength:e.maxLastMessageLength,persistChatDraft:e.persistChatDraft,showOpenCodeUpdateNotifications:e.showOpenCodeUpdateNotifications,agentControlToolEnabled:e.agentControlToolEnabled,inputSpellcheckEnabled:e.inputSpellcheckEnabled,wideChatLayoutEnabled:e.wideChatLayoutEnabled,codeBlockLineWrap:e.codeBlockLineWrap,showToolFileIcons:e.showToolFileIcons,showTurnChangedFiles:e.showTurnChangedFiles,showExpandedBashTools:e.showExpandedBashTools,showExpandedEditTools:e.showExpandedEditTools,timeFormatPreference:e.timeFormatPreference,weekStartPreference:e.weekStartPreference,desktopWindowControlsPosition:e.desktopWindowControlsPosition,mermaidRenderingMode:e.mermaidRenderingMode,userMessageRenderingMode:e.userMessageRenderingMode,collapsibleUserMessages:e.collapsibleUserMessages,stickyUserHeader:e.stickyUserHeader,promptNavigatorEnabled:e.promptNavigatorEnabled,expandedEditorToolbar:e.expandedEditorToolbar,showSplitAssistantMessageActions:e.showSplitAssistantMessageActions,allowPromptingSubagentSessions:e.allowPromptingSubagentSessions,draftStartersVisible:e.draftStartersVisible,isMobileSessionStatusBarCollapsed:e.isMobileSessionStatusBarCollapsed,mobileSessionFilterProjectId:e.mobileSessionFilterProjectId,shortcutOverrides:e.shortcutOverrides,fileEditorKeymap:e.fileEditorKeymap})}),{name:"ui-store"})),xd=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const o=t.replace(/\\/g,"/").replace(/^([a-z]):/,(n,a)=>a.toUpperCase()+":");return o==="/"?"/":(o.length>1?o.replace(/\/+$/,""):o)||null},jr="queue",zr=e=>e==="steer"||e==="queue",$r=(e,t)=>e==="immediate"?"steer":zr(e)?e:t===!1?"steer":t===!0?"queue":jr,On=50,Od=(e,t,o=L())=>{const r=xd(t);return!o||!r||!e?null:{runtimeKey:o,directory:r,sessionId:e}},nt=e=>`${e.runtimeKey}
|
|
1
|
+
import{_ as Os,c as _s,a as _t,d as Nt,p as Dr,b as ta,R as ao}from"./vendor-.bun-BzW0Lgld.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function o(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(n){if(n.ep)return;n.ep=!0;const a=o(n);fetch(n.href,a)}})();const Et=1,Ns="openchamber-relay-v1",oa=1,ra=12,Ct=1+ra,St=64*1024,Mt=5,Tt=128,na=0,aa=1,dt=4,Us=1+dt,Xo=St-Mt-Us,S={HttpRequest:1,HttpBody:2,HttpResponse:3,StreamEnd:4,StreamAbort:5,WsOpen:6,WsOpened:7,WsText:8,WsBinary:9,WsClose:10,Ping:11,Pong:12},Ls=new Set(Object.values(S)),Hs=e=>Ls.has(e),qe={DuplicateClient:4002,AuthFailed:4010,LimitExceeded:4029,ChannelFailure:1011},ve=globalThis.crypto.subtle,sa={name:"ECDH",namedCurve:"P-256"},ia=16,Ro=32,js=16,Zo=4,ca=8;class xe extends Error{constructor(t){super(t),this.name="RelayCryptoError"}}const zs=()=>ve.generateKey(sa,!0,["deriveBits"]),$s=async e=>{const t=await ve.exportKey("jwk",e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y}},Gs=async e=>{if(e.kty!=="EC"||e.crv!=="P-256"||typeof e.x!="string"||typeof e.y!="string")throw new xe("invalid ECDH public key JWK");try{return await ve.importKey("jwk",{kty:e.kty,crv:e.crv,x:e.x,y:e.y,ext:!0},sa,!0,[])}catch{throw new xe("invalid ECDH public key JWK")}},qs=()=>{const e=new Uint8Array(ia);return globalThis.crypto.getRandomValues(e),e},Ws=async(e,t,o)=>{if(o.length!==ia)throw new xe("invalid handshake nonce length");const r=await ve.deriveBits({name:"ECDH",public:t},e,256),n=await ve.importKey("raw",r,"HKDF",!1,["deriveBits"]),a=new Uint8Array(await ve.deriveBits({name:"HKDF",hash:"SHA-256",salt:o,info:new TextEncoder().encode(Ns)},n,Ro*2*8)),s=(i,c)=>ve.importKey("raw",i,{name:"AES-GCM"},!1,c);return{clientToHost:await s(a.slice(0,Ro),["encrypt","decrypt"]),hostToClient:await s(a.slice(Ro),["encrypt","decrypt"])}},Vs=(e,t,o)=>{for(let r=ca-1;r>=0;r-=1)e[t+r]=Number(o&0xffn),o>>=8n},Ks=(e,t)=>{let o=0n;for(let r=0;r<ca;r+=1)o=o<<8n|BigInt(e[t+r]);return o},Js=e=>{const t=new Uint8Array(Zo);globalThis.crypto.getRandomValues(t);let o=0n;return{async encrypt(r){if(r.length>St)throw new xe("plaintext frame exceeds maximum size");o+=1n;const n=new Uint8Array(ra);n.set(t,0),Vs(n,Zo,o);const a=new Uint8Array(await ve.encrypt({name:"AES-GCM",iv:n},e,r)),s=new Uint8Array(Ct+a.length);return s[0]=oa,s.set(n,1),s.set(a,Ct),s}}},Ys=e=>{let t=0n;return{async decrypt(o){if(o.length<Ct+js)throw new xe("encrypted frame too short");if(o[0]!==oa)throw new xe("unsupported encrypted frame version");const r=o.slice(1,Ct),n=Ks(r,Zo);if(n<=t)throw new xe("frame counter regression");let a;try{a=await ve.decrypt({name:"AES-GCM",iv:r},e,o.slice(Ct))}catch{throw new xe("frame decryption failed")}return t=n,new Uint8Array(a)}}},$t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Qs=e=>{let t="";for(let o=0;o<e.length;o+=3){const r=e[o],n=o+1<e.length?e[o+1]:void 0,a=o+2<e.length?e[o+2]:void 0;t+=$t[r>>2],t+=$t[(r&3)<<4|(n??0)>>4],n!==void 0&&(t+=$t[(n&15)<<2|(a??0)>>6]),a!==void 0&&(t+=$t[a&63])}return t},rn=e=>{let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!="object"||t===null)return null;const o=t;if(o.v!==Et)return null;const r=o.batch===!0;return o.t==="ready"?{t:"ready",v:Et,batch:r}:o.t==="hello"&&typeof o.nonce=="string"&&typeof o.clientPubJwk=="object"&&o.clientPubJwk!==null?{t:"hello",v:Et,clientPubJwk:o.clientPubJwk,nonce:o.nonce,batch:r}:null},Xs=e=>({type:"fail",closeCode:qe.ChannelFailure,reason:e}),Zs=async(e,t={})=>{const o=t.batch!==!1,r=await Gs(e),n=await zs(),a=qs(),s={t:"hello",v:Et,clientPubJwk:await $s(n.publicKey),nonce:Qs(a),...o?{batch:!0}:{}};let i=!1;return{helloText:JSON.stringify(s),get established(){return i},async handleText(c){if(i)return rn(c)?.t==="ready"?{type:"ignore"}:Xs("plaintext frame on established channel");const d=rn(c);if(d?.t!=="ready")return{type:"ignore"};const l=await Ws(n.privateKey,r,a);return i=!0,{type:"established",batch:o&&d.batch===!0,channel:{encryptor:Js(l.clientToHost),decryptor:Ys(l.hostToClient)}}}}},da=4294967295;class Y extends Error{constructor(t){super(t),this.name="TunnelCodecError"}}const Ee=(e,t,o,r=!1)=>{if(!Number.isInteger(t)||t<0||t>da)throw new Y("invalid stream id");if(o.length>Xo)throw new Y("tunnel payload exceeds maximum size");const n=new Uint8Array(Mt+o.length);return n[0]=r?e|Tt:e,n[1]=t>>>24&255,n[2]=t>>>16&255,n[3]=t>>>8&255,n[4]=t&255,n.set(o,Mt),n},ei=e=>{if(e.length<Mt)throw new Y("tunnel frame too short");const t=e[0],o=(t&Tt)!==0,r=t&~Tt;if(!Hs(r))throw new Y(`unknown tunnel frame type ${r}`);const n=(e[1]<<24|e[2]<<16|e[3]<<8|e[4])>>>0;return{frameType:r,streamId:n,payload:e.slice(Mt),hasMoreFragments:o}},ti=new TextEncoder,oi=new TextDecoder,Gt=e=>ti.encode(JSON.stringify(e)),qt=(e,t)=>{let o;try{o=JSON.parse(oi.decode(e))}catch{throw new Y("malformed JSON tunnel payload")}if(!t(o))throw new Y("unexpected JSON tunnel payload shape");return o},la=(e,t=Xo)=>{if(t<=0||t>Xo)throw new Y("invalid chunk size");if(e.length===0)return[new Uint8Array(0)];const o=[];for(let r=0;r<e.length;r+=t)o.push(e.slice(r,r+t));return o},nn=(e,t,o)=>{const r=la(o);return r.map((n,a)=>Ee(e,t,n,a<r.length-1))},ri=(e=16*1024*1024)=>{const t=new Map;return{push(o){const r=`${o.streamId}:${o.frameType}`,n=t.get(r);if(!o.hasMoreFragments&&!n)return o.payload;const a=n?.chunks??[],s=(n?.totalBytes??0)+o.payload.length;if(s>e)throw t.delete(r),new Y("fragmented message exceeds maximum size");if(a.push(o.payload),o.hasMoreFragments)return t.set(r,{chunks:a,totalBytes:s}),null;t.delete(r);const i=new Uint8Array(s);let c=0;for(const d of a)i.set(d,c),c+=d.length;return i},dropStream(o){for(const r of t.keys())r.startsWith(`${o}:`)&&t.delete(r)}}},ni=e=>{if(e.length===0)throw new Y("cannot encode an empty frame batch");if(e.length===1){const n=e[0],a=new Uint8Array(1+n.length);if(a[0]=na,a.set(n,1),a.length>St)throw new Y("frame batch exceeds maximum plaintext size");return a}let t=1;for(const n of e)t+=dt+n.length;if(t>St)throw new Y("frame batch exceeds maximum plaintext size");const o=new Uint8Array(t);o[0]=aa;let r=1;for(const n of e)o[r]=n.length>>>24&255,o[r+1]=n.length>>>16&255,o[r+2]=n.length>>>8&255,o[r+3]=n.length&255,r+=dt,o.set(n,r),r+=n.length;return o},ai=e=>{if(e.length<1)throw new Y("empty batch plaintext");const t=e[0];if(t===na)return[e.slice(1)];if(t!==aa)throw new Y(`unknown batch container tag ${t}`);const o=[];let r=1;for(;r<e.length;){if(r+dt>e.length)throw new Y("truncated batch frame length");const n=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0;if(r+=dt,r+n>e.length)throw new Y("truncated batch frame body");o.push(e.slice(r,r+n)),r+=n}if(o.length===0)throw new Y("empty frame batch");return o},si=new Set([S.HttpBody,S.WsText,S.WsBinary]),ua=150,ii=24*1024,ci=32,di=e=>{const t=e.windowMs??ua,o=e.maxBatchBytes??ii,r=e.maxBatchFrames??ci,n=e.now??(()=>Date.now()),a=e.setTimer??((b,h)=>setTimeout(b,h)),s=e.clearTimer??(b=>clearTimeout(b));let i=[],c=0,d=null,l=0,u=!1;const m=()=>{d!==null&&(s(d),d=null)},g=()=>{if(m(),i.length===0)return;const b=i;i=[],c=0,l=n(),e.sendBatch(ni(b))};return{enqueue:b=>{if(u)return;const h=b[0]&~Tt;if(!si.has(h)){i.push(b),g();return}const w=n();if(i.length===0&&w-l>=t){i.push(b),g();return}const D=dt+b.length;if(i.length>0&&1+c+D>St&&g(),i.push(b),c+=D,c>=o||i.length>=r){g();return}d===null&&(d=a(g,t))},flush:g,dispose(){u=!0,m(),i=[],c=0}}},li=()=>{let e=1;return{next(){if(e>da)throw new Y("stream id space exhausted");const t=e;return e+=2,t}}},yo=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ui=e=>yo(e)&&Object.values(e).every(t=>typeof t=="string"),fi=e=>yo(e)&&typeof e.status=="number"&&ui(e.headers),an=e=>yo(e)&&typeof e.reason=="string",mi=e=>yo(e)&&typeof e.code=="number"&&typeof e.reason=="string",fa=/^[a-z][a-z\d+.-]*:\/\//i,kr="http://tunnel.invalid",gi=e=>{try{const t=fa.test(e)?new URL(e):new URL(e,kr);return`${t.pathname}${t.search}`}catch{return e}},Wt=e=>({async*[Symbol.asyncIterator](){yield e}}),pi=e=>({async*[Symbol.asyncIterator](){const t=e.getReader();try{for(;;){const{done:o,value:r}=await t.read();if(o)return;r&&(yield r)}}finally{t.releaseLock()}}}),hi=e=>{const t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),t},Fi=async e=>{if(e==null)return{body:null};if(e instanceof ReadableStream)return{body:pi(e)};if(typeof e=="string")return{body:Wt(new TextEncoder().encode(e))};if(e instanceof ArrayBuffer)return{body:Wt(new Uint8Array(e.slice(0)))};if(ArrayBuffer.isView(e))return{body:Wt(hi(e))};const t=new Response(e),o=t.headers.get("content-type")??void 0,r=new Uint8Array(await t.arrayBuffer());return{body:Wt(r),contentType:o}},yi=async(e,t)=>{let o;const r=new Headers;let n="GET",a=null,s;e instanceof Request?(o=e.url,n=e.method,e.headers.forEach((u,m)=>r.set(m,u)),s=e.signal,a=e.body):o=e.toString(),t&&(t.method&&(n=t.method),t.headers&&new Headers(t.headers).forEach((u,m)=>r.set(m,u)),t.body!==void 0&&(a=t.body),t.signal&&(s=t.signal));const i=fa.test(o)?new URL(o):new URL(o,kr),{body:c,contentType:d}=await Fi(a);d&&!r.has("content-type")&&r.set("content-type",d);const l={};return r.forEach((u,m)=>{l[m]=u}),{method:n.toUpperCase(),path:i.pathname,query:i.search.startsWith("?")?i.search.slice(1):i.search,headers:l,body:c,signal:s}},Io=new Uint8Array(0),bi=new TextEncoder,Ai=new TextDecoder,le=e=>e instanceof Error?e:new Error(String(e)),Vt=()=>new DOMException("The operation was aborted.","AbortError"),wi=e=>{e.binaryType="arraybuffer";const t={get readyState(){return e.readyState},send(o){e.send(o)},close(o,r){e.close(o,r)},onopen:null,onmessage:null,onclose:null,onerror:null};return e.onopen=()=>t.onopen?.(),e.onmessage=o=>t.onmessage?.({data:o.data}),e.onclose=o=>t.onclose?.({code:o.code,reason:o.reason}),e.onerror=()=>t.onerror?.(),t},Ei=e=>{const t={get readyState(){return e.readyState},get binaryType(){return e.binaryType},set binaryType(o){o&&(e.binaryType=o)},onopen:null,onmessage:null,onerror:null,onclose:null,send(o){e.send(o)},close(o,r){e.close(o,r)}};return e.onopen=()=>t.onopen?.(),e.onmessage=o=>{const r=o.data;(typeof r=="string"||r instanceof ArrayBuffer)&&t.onmessage?.({data:r})},e.onerror=()=>t.onerror?.(),e.onclose=o=>t.onclose?.({code:o.code,reason:o.reason}),t},sn=0,xo=1,cn=2,dn=3,Ci=new Set([qe.AuthFailed,qe.DuplicateClient,qe.LimitExceeded]),Bi={[qe.AuthFailed]:"relay authentication failed",[qe.DuplicateClient]:"relay connection replaced by another client",[qe.LimitExceeded]:"relay connection limit reached"},ln=()=>{const e=typeof navigator<"u"&&navigator.onLine===!1,t=typeof document<"u"&&document.visibilityState==="hidden";return e||t},vr=e=>{const t=e.helloRetryMs??1e3,o=e.helloTimeoutMs??3e4,r=e.pingIntervalMs??3e4,n=e.pingTimeoutMs??15e3,a=e.batchWindowMs??ua,s=e.batch!==!1,i=e.reconnectBaseDelayMs??1e3,c=e.reconnectMaxDelayMs??3e4,d=e.hiddenOrOfflineMaxDelayMs??6e4,l=e.createWireSocket??(A=>wi(new WebSocket(A)));let u=!1,m={state:"idle"};const g=new Set;let p=null,b=null,h=null,w=0,D=0,B=null,_=[],re=!1;const de=A=>{if(!(m.state===A.state&&m.lastError===A.lastError)){m=A;for(const M of g)try{M(m)}catch{}}},pt=A=>{const M=_;_=[];for(const E of M)E.reject(A)},vo=A=>{const M=_;_=[];for(const E of M)E.resolve(A)},Zr=(A,M)=>{A.dead=!0;const E=Array.from(A.streams.values());A.streams.clear();for(const C of E)try{C.fail(M)}catch{}},So=()=>{B!==null&&(clearTimeout(B),B=null)},Mo=()=>{u||B===null||ln()||(So(),To(),Po())},en=()=>{typeof document<"u"&&document.visibilityState==="visible"&&Mo()},Ms=()=>{re||typeof window>"u"||(re=!0,window.addEventListener("online",Mo),typeof document<"u"&&document.addEventListener("visibilitychange",en))},To=()=>{!re||typeof window>"u"||(re=!1,window.removeEventListener("online",Mo),typeof document<"u"&&document.removeEventListener("visibilitychange",en))},tn=()=>{if(u||B!==null)return;const A=Math.max(0,D-1),M=i*2**Math.min(A,10),E=ln()?d:c,C=Math.min(E,M);Ms(),B=setTimeout(()=>{B=null,To(),Po()},C)},Ts=()=>{const A=new URL(e.relayUrl);return A.searchParams.set("v",String(Et)),A.searchParams.set("role","client"),A.searchParams.set("serverId",e.serverId),e.grant&&A.searchParams.set("grant",e.grant),A.toString()},Po=async()=>{if(u)return;So(),w+=1;const A=w;de({state:D>0?"reconnecting":"connecting",lastError:m.lastError});let M;try{M=await Zs(e.hostEncPubJwk,{batch:s})}catch(R){if(A!==w||u)return;ht(A,le(R),!0);return}if(A!==w||u)return;let E;try{E=l(Ts())}catch(R){ht(A,le(R));return}b=E;let C=!1,k=null,T=null,ne=null,q=null,v=Promise.resolve(),P=null,N=null,Ae=!1,H=null,W=Date.now();const Q=()=>{k!==null&&(clearInterval(k),k=null),T!==null&&(clearTimeout(T),T=null),ne!==null&&(clearInterval(ne),ne=null),q!==null&&(clearTimeout(q),q=null),H!==null&&(H.dispose(),H=null)};h=Q;function V(R,x=!1,U=!1){if(!(C||A!==w)){C=!0,Q(),P&&(p=null,Zr(P,new Error(`relay tunnel reset: ${R.message}`))),pt(R);try{E.close()}catch{}if(b===E&&(b=null),!u){if(D+=1,U){de({state:"error",lastError:R.message});return}de({state:x?"error":"reconnecting",lastError:R.message}),tn()}}}const O=()=>{try{E.send(M.helloText)}catch{}},Ne=(R,x)=>{N=R,Ae=x,k!==null&&(clearInterval(k),k=null),T!==null&&(clearTimeout(T),T=null);const U=new Map,j=li(),Ue=ri();let se=Promise.resolve();const we=et=>{se=se.then(async()=>{if(Ze.dead)return;const zt=await R.encryptor.encrypt(et);E.send(zt)}).catch(()=>{})},Le=x?di({windowMs:a,sendBatch:we}):null;H=Le;const Ze={streams:U,assembler:Ue,nextStreamId:()=>j.next(),dead:!1,send(et){if(Ze.dead)return;const zt=et[0]&~Tt;zt!==S.Ping&&zt!==S.Pong&&(W=Date.now()),Le?Le.enqueue(et):we(et)}};P=Ze,p=Ze,D=0,W=Date.now(),de({state:"connected"}),vo(Ze),ne=setInterval(()=>{Date.now()-W<r||(Ze.send(Ee(S.Ping,0,Io)),q===null&&(q=setTimeout(()=>{q=null,V(new Error("relay keepalive timeout"))},n)))},r)},ae=(R,x)=>{let U;try{U=ei(x)}catch(se){V(le(se));return}if(q!==null&&(clearTimeout(q),q=null),U.frameType===S.Ping){R.send(Ee(S.Pong,U.streamId,Io));return}if(U.frameType===S.Pong)return;W=Date.now();let j=U.payload;if(U.frameType===S.WsText||U.frameType===S.WsBinary){let se;try{se=R.assembler.push(U)}catch(we){V(le(we));return}if(se===null)return;j=se}else if(U.hasMoreFragments){V(new Error("unexpected fragmented tunnel frame"));return}const Ue=R.streams.get(U.streamId);Ue&&Ue.handleFrame(U.frameType,j)};E.onopen=()=>{C||A!==w||(O(),k=setInterval(O,t))},E.onmessage=R=>{if(C||A!==w)return;const x=R.data;if(typeof x=="string"){v=v.then(async()=>{if(C||A!==w)return;const j=await M.handleText(x);if(j.type==="established"){if(N)return;Ne(j.channel,j.batch)}else j.type==="fail"&&V(new Error(`relay handshake failed: ${j.reason}`))}).catch(j=>{V(le(j))});return}const U=x instanceof ArrayBuffer?new Uint8Array(x):x instanceof Uint8Array?x:null;U&&(v=v.then(async()=>{if(C||A!==w)return;const j=P,Ue=N;if(!j||!Ue){V(new Error("encrypted frame before handshake completed"));return}let se;try{se=await Ue.decryptor.decrypt(U)}catch(we){V(le(we));return}if(Ae){let we;try{we=ai(se)}catch(Le){V(le(Le));return}for(const Le of we){if(C||A!==w||j.dead)return;ae(j,Le)}return}ae(j,se)}).catch(j=>{V(le(j))}))},E.onclose=R=>{const x=Ci.has(R.code);V(new Error(Bi[R.code]??`relay socket closed (code ${R.code})`),x,x)},E.onerror=()=>{},T=setTimeout(()=>{T=null,V(new Error("relay handshake timeout"),!0)},o);function ht(R,x,U=!1){R!==w||u||(pt(x),D+=1,de({state:U?"error":"reconnecting",lastError:x.message}),tn())}},on=A=>u?Promise.reject(new Error("relay tunnel closed")):A?.aborted?Promise.reject(Vt()):p&&!p.dead?Promise.resolve(p):new Promise((M,E)=>{let C=null;const k={resolve(T){C&&A&&A.removeEventListener("abort",C),M(T)},reject(T){C&&A&&A.removeEventListener("abort",C),E(T)}};A&&(C=()=>{_=_.filter(T=>T!==k),E(Vt())},A.addEventListener("abort",C,{once:!0})),_.push(k)}),Ps=async(A,M)=>{const E=await yi(A,M),C=E.signal;if(C?.aborted)throw Vt();const k=await on(C),T=k.nextStreamId();return await new Promise((ne,q)=>{let v=!1,P=!1,N=null,Ae=null;const H=()=>{k.streams.delete(T),k.assembler.dropStream(T),Ae&&C&&C.removeEventListener("abort",Ae)},W=O=>{if(!P){if(P=!0,H(),!v){q(O);return}try{N?.error(O)}catch{}}},Q=O=>{k.dead||k.send(Ee(S.StreamAbort,T,Gt({reason:O})))};Ae=()=>{Q("aborted"),W(Vt())},k.streams.set(T,{handleFrame(O,Ne){if(O===S.HttpResponse){if(v||P)return;let ae;try{ae=qt(Ne,fi)}catch(x){Q("malformed response head"),W(le(x));return}const ht=ae.status===204||ae.status===205||ae.status===304;let R=null;ht||(R=new ReadableStream({start(x){N=x},cancel(){P||(P=!0,H(),Q("response body cancelled"))}})),v=!0,ne(new Response(R,{status:ae.status,headers:ae.headers})),ht&&(P=!0,H());return}if(O===S.HttpBody){if(!v||P)return;try{N?.enqueue(Ne)}catch{}return}if(O===S.StreamEnd){if(P)return;if(!v){W(new Error("tunnel stream ended before response head"));return}P=!0,H();try{N?.close()}catch{}return}if(O===S.StreamAbort){let ae="stream aborted by host";try{ae=qt(Ne,an).reason}catch{}W(new Error(ae))}},fail(O){W(O)}}),C&&C.addEventListener("abort",Ae,{once:!0});const V={method:E.method,path:E.path,query:E.query,headers:E.headers};k.send(Ee(S.HttpRequest,T,Gt(V))),(async()=>{try{if(E.body)for await(const O of E.body){if(P||k.dead)return;for(const Ne of la(O))k.send(Ee(S.HttpBody,T,Ne))}!P&&!k.dead&&k.send(Ee(S.StreamEnd,T,Io))}catch(O){Q("request body failed"),W(le(O))}})()})},Rs=A=>{const M=A.indexOf("?");return M===-1?{path:A,query:""}:{path:A.slice(0,M),query:A.slice(M+1)}},Is=(A,M)=>{let E=sn,C=null,k=0,T=!1;const ne={get readyState(){return E},onopen:null,onmessage:null,onerror:null,onclose:null,send(v){if(E!==xo||!C||C.dead)throw new Error("relay tunnel socket is not open");if(typeof v=="string"){for(const N of nn(S.WsText,k,bi.encode(v)))C.send(N);return}const P=v instanceof ArrayBuffer?new Uint8Array(v.slice(0)):(()=>{const N=new Uint8Array(v.byteLength);return N.set(new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),N})();for(const N of nn(S.WsBinary,k,P))C.send(N)},close(v=1e3,P=""){E===dn||E===cn||(E===xo&&C&&!C.dead&&(E=cn,C.send(Ee(S.WsClose,k,Gt({code:v,reason:P})))),q(v,P))}},q=(v,P,N=!1)=>{if(!T){if(T=!0,C&&(C.streams.delete(k),C.assembler.dropStream(k)),E=dn,N)try{ne.onerror?.()}catch{}try{ne.onclose?.({code:v,reason:P})}catch{}}};return(async()=>{let v;try{v=await on()}catch(H){q(1006,le(H).message,!0);return}if(T)return;C=v,k=v.nextStreamId(),v.streams.set(k,{handleFrame(H,W){if(H===S.WsOpened){if(E===sn){E=xo;try{ne.onopen?.()}catch{}}return}if(H===S.WsText){try{ne.onmessage?.({data:Ai.decode(W)})}catch{}return}if(H===S.WsBinary){const Q=new ArrayBuffer(W.byteLength);new Uint8Array(Q).set(W);try{ne.onmessage?.({data:Q})}catch{}return}if(H===S.WsClose){let Q=1e3,V="";try{const O=qt(W,mi);Q=O.code,V=O.reason}catch{}q(Q,V);return}if(H===S.StreamAbort){let Q="stream aborted";try{Q=qt(W,an).reason}catch{}q(1006,Q,!0)}},fail(H){q(1012,H.message,!0)}});const{path:P,query:N}=Rs(A),Ae=M&&M.length>0?{path:P,query:N,protocols:M}:{path:P,query:N};v.send(Ee(S.WsOpen,k,Gt(Ae)))})(),ne},xs=()=>{if(u)return;u=!0,w+=1,So(),To(),h?.(),h=null;const A=p;p=null;const M=new Error("relay tunnel closed");A&&Zr(A,M),pt(M);try{b?.close()}catch{}b=null,de({state:"idle"})};return Po(),{fetch:Ps,openWebSocket:Is,getStatus:()=>m,subscribeStatus(A){return g.add(A),()=>{g.delete(A)}},close:xs}};let ce=null,Bt=null;const Di=(e,t)=>e.relayUrl===t.relayUrl&&e.serverId===t.serverId&&e.grant===t.grant&&JSON.stringify(e.hostEncPubJwk)===JSON.stringify(t.hostEncPubJwk),bo=()=>ce,Tp=()=>ce!==null,ki=e=>(ce&&Bt&&Di(Bt,e)||(ce?.close(),Bt=e,ce=vr(e)),ce),Pp=(e,t)=>{ce!==t&&(ce?.close(),Bt=e,ce=t)},vi=()=>{ce?.close(),ce=null,Bt=null};let ma=()=>null,ga="",so={},Ve="",Pt=0,ze=null,ct="",Rt=0,Ke="",$e=null,Pe="",to=0,oo=0;const Sr=1e4,Si=e=>e.toLowerCase()==="authorization",pa=e=>{const t={};for(const[o,r]of Object.entries(e||{})){const n=o.trim(),a=r.trim();n&&a&&!Si(n)&&(t[n]=a)}return t},Mi=(e,t)=>{const o=Object.entries(e);return o.length!==Object.keys(t).length?!1:o.every(([r,n])=>t[r]===n)},Ao=e=>typeof e!="string"?"":e.trim(),Ti=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_CLIENT_TOKEN__;return Ao(e)},Pi=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return typeof e=="string"?e.trim():""},ha=(e,t)=>{const o=typeof e=="string"&&e.trim()?e.trim():Pi();if(!o)return t;try{return new URL(t,`${o.replace(/\/+$/,"")}/`).toString()}catch{return t}},Mr=e=>{try{return new URL(e).origin}catch{return""}},Fa=()=>{ct="",Rt=0,Ke="",$e=null,Pe="",to+=1},wo=()=>{Ve="",Pt=0,Fa()},ya=()=>{oo+=1,ze=null,wo(),Tr()},ba=e=>{const t=Ao(e);ga=t,ya(),ma=()=>t?{type:"bearer",token:t}:null},Aa=e=>{const t=pa(e);Mi(so,t)||(so=t,ya())},Eo=()=>{if(Object.keys(so).length>0)return so;if(typeof window>"u")return{};const e=window.__OPENCHAMBER_RUNTIME_HEADERS__;return e&&typeof e=="object"?pa(e):{}},wa=()=>ga||Ti(),Ri=(e,t)=>{const o=Ao(e);if(!o||typeof t!="number"||!Number.isFinite(t)){wo();return}const r=Ve;Ve=o,Pt=t,r&&r!==o&&Ni()},Ea=()=>!Ve||Pt<=Date.now()+Sr?(wo(),""):Ve,Ca=e=>{const t=Mr(e);return!t||Ke!==t?"":!ct||Rt<=Date.now()+Sr?(ct="",Rt=0,Ke="",""):ct},Ii=()=>{const e=Ea();return!e&&(wa()||typeof window<"u")&&Co().catch(()=>{}),e},xi=e=>{const t=e?Ca(e):"";return!t&&e&&typeof window<"u"&&ka(e).catch(()=>{}),t},Ba=async()=>{const e=await ma(),t=e?.type==="bearer"?Ao(e.token):wa();return t?{type:"bearer",token:t}:null},Da=e=>{if(ze)return ze;const t=oo,r=(async()=>{const n=await Ba(),a=new Headers;for(const[u,m]of Object.entries(Eo()))a.set(u,m);n?.type==="bearer"&&a.set("Authorization",`Bearer ${n.token}`);const s=bo(),i=s?await s.fetch("/auth/url-token",{method:"POST",headers:a}):await fetch(ha(e,"/auth/url-token"),{method:"POST",headers:a,credentials:"include"});if(!i.ok)throw t===oo&&wo(),new Error(`Failed to mint runtime URL auth token (${i.status})`);const c=await i.json().catch(()=>null),d=typeof c?.token=="string"?c.token.trim():"",l=typeof c?.expiresAt=="number"?c.expiresAt:0;if(t!==oo)throw new Error("Runtime URL auth token response is stale");if(Ri(d,l),!Ve)throw new Error("Runtime URL auth token response was invalid");return Ve})().finally(()=>{ze===r&&(ze=null)});return ze=r,ze},Oi=e=>{const t=Mr(e);if(!t)return Promise.reject(new Error("Local runtime URL auth origin was invalid"));if($e&&Pe===t)return $e;const o=to,n=(async()=>{const a=await fetch(ha(t,"/auth/url-token"),{method:"POST",credentials:"include"});if(!a.ok)throw o===to&&t===Pe&&(ct="",Rt=0,Ke=""),new Error(`Failed to mint local runtime URL auth token (${a.status})`);const s=await a.json().catch(()=>null),i=typeof s?.token=="string"?s.token.trim():"",c=typeof s?.expiresAt=="number"?s.expiresAt:0;if(!i||!Number.isFinite(c))throw new Error("Local runtime URL auth token response was invalid");if(o!==to||t!==Pe)throw new Error("Local runtime URL auth token response is stale");return ct=i,Rt=c,Ke=t,i})().finally(()=>{$e===n&&($e=null,Pe="")});return $e=n,Pe=t,$e},Co=async e=>{const t=Ea();return t||Da(e)},ka=async e=>{const t=Mr(e);if(!t)throw new Error("Local runtime URL auth origin was invalid");const o=Ca(t);return o||((Ke&&Ke!==t||Pe&&Pe!==t)&&Fa(),Oi(t))};let st=0,Dt=null,va=null;const er=new Set,_i=5e3,Ni=()=>{for(const e of er)try{e()}catch{}},Sa=()=>{Dt!==null&&(clearTimeout(Dt),Dt=null)},Tr=()=>{if(Sa(),st<=0||typeof window>"u")return;const e=Pt-Sr-_i,t=Pt>0?Math.max(0,e-Date.now()):0;Dt=setTimeout(()=>{Dt=null,!(st<=0)&&Da(va).catch(()=>{}).finally(()=>{Tr()})},t)},Rp=e=>{typeof e=="string"&&e.trim()&&(va=e.trim()),st+=1,Tr();let t=!1;return()=>{t||(t=!0,st=Math.max(0,st-1),st===0&&Sa())}},Ip=e=>(er.add(e),()=>{er.delete(e)}),Ui=async e=>{const t=new Headers(e);for(const[r,n]of Object.entries(Eo()))t.has(r)||t.set(r,n);if(t.has("Authorization"))return t;const o=await Ba();return o?.type==="bearer"&&t.set("Authorization",`Bearer ${o.token}`),t},io=/^[a-z][a-z\d+.-]*:\/\//i,Li=e=>{const t=e.trim();return t?t.startsWith("/")?t:`/${t}`:"/"},co=e=>typeof e!="string"?"":e.trim().replace(/\/+$/,""),Hi=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return co(e)},ji=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_LOCAL_ORIGIN__;return co(e)},zi=()=>Object.keys(Eo()).length>0,$i=e=>{const t=e.currentHref?.();return t||(typeof window<"u"?window.location.href||window.location.origin:"")},tr=(e,t)=>{if(!t)return;const o=t instanceof URLSearchParams?Array.from(t.entries()):Object.entries(t);for(const[r,n]of o)n!=null&&e.searchParams.set(r,String(n))},Gi=(e,t)=>{if(!t)return e;const o=new URLSearchParams;tr({searchParams:o},t);const r=o.toString();return r?e.includes("?")?`${e}&${r}`:`${e}?${r}`:e},un=(e,t,o)=>{if(io.test(t)){const a=new URL(t);return tr(a,o),a.toString()}const r=Li(t);if(!e)return Gi(r,o);const n=new URL(r,`${e}/`);return tr(n,o),n.toString()},Oo=e=>{const t=Ii();if(!t)return e;const o=io.test(e)?new URL(e):new URL(e,"http://openchamber.local");return o.searchParams.set("oc_url_token",t),io.test(e)?o.toString():`${o.pathname}${o.search}${o.hash}`},Ma=(e,t)=>{const o=io.test(e)?new URL(e):new URL(e,$i(t));return o.protocol==="ws:"||o.protocol==="wss:"||(o.protocol=o.protocol==="https:"?"wss:":"ws:"),o.toString()},fn=(e,t,o)=>{if(!zi())return null;const r=ji();if(!r)return null;try{const n=new URL(`/api/openchamber/realtime-proxy/${e==="sse"?"sse":"ws"}`,`${r}/`);n.searchParams.set("url",t);const a=xi(r);return a&&n.searchParams.set("oc_url_token",a),e==="ws"?(n.protocol=n.protocol==="https:"?"wss:":"ws:",Ma(n.toString(),o)):n.toString()}catch{return null}},Pr=(e={})=>{const t=co(e.apiBaseUrl),o=co(e.realtimeBaseUrl),r=()=>t||Hi(),n=()=>o||r(),a=(i,c)=>un(r(),i,c),s=(i,c)=>un(n(),i,c);return{api:a,authenticatedAsset:(i,c)=>Oo(a(i,c)),auth:a,health:i=>a("/health",i),rawFile:(i,c)=>a("/api/fs/raw",{path:i,download:c?.download===!0?!0:void 0,allowOutsideWorkspace:c?.allowOutsideWorkspace===!0?!0:void 0,outsideFileGrant:c?.outsideFileGrant}),sse:(i,c)=>{const d=Oo(s(i,c));return fn("sse",d,e)||d},websocket:(i,c)=>{const d=Ma(Oo(s(i,c)),e);return fn("ws",d,e)||d}}};let lo=Pr();const oe=()=>lo,qi=e=>{lo=e},Ta=e=>(lo=Pr(e),lo),Je=e=>e.startsWith("/api/")||e==="/api"||e.startsWith("/auth/")||e==="/auth"||e==="/health",Wi=()=>typeof window>"u"?"":window.location.origin||"",Rr=e=>{if(typeof window>"u")return!1;const t=Wi();if(t&&e.origin===t)return!0;try{const o=new URL(window.location.href||t);return e.protocol===o.protocol&&e.host===o.host}catch{return!1}},Ir=e=>/^[a-z][a-z\d+.-]*:\/\//i.test(e),xr=(e,t)=>{if(!t)return;const o=t instanceof URLSearchParams?Array.from(t.entries()):Object.entries(t);for(const[r,n]of o)n!=null&&e.searchParams.set(r,String(n))},ro=e=>{try{const t=oe().api("/api");if(!/^[a-z][a-z\d+.-]*:\/\//i.test(t))return!1;const o=new URL(t);return e.origin!==o.origin?!1:Je(e.pathname)}catch{return!1}},_o=e=>{if(Je(e))return!0;if(!/^[a-z][a-z\d+.-]*:\/\//i.test(e))return!1;try{const t=new URL(e);return Rr(t)&&Je(t.pathname)}catch{return!1}},Vi=(e,t)=>{try{const o=new URL(e);if(!Rr(o))return e;const r=We(`${o.pathname}${o.search}`,t);return!Ir(r)&&(o.protocol==="http:"||o.protocol==="https:")?(xr(o,t),o.toString()):o.hash?`${r}${o.hash}`:r}catch{return e}},We=(e,t)=>e==="/health"?oe().health(t):e.startsWith("/auth/")||e==="/auth"?oe().auth(e,t):Je(e)?oe().api(e,t):/^[a-z][a-z\d+.-]*:\/\//i.test(e)?Vi(e,t):e,Ki=e=>{const t=e instanceof Request?e.url:e.toString();if(!Ir(t))return Je(t);try{return ro(new URL(t))}catch{return!1}},Ji=e=>{for(let t=0;t<e.length;t+=1)if(e.charCodeAt(t)>255)return!1;return!0},Yi=(e,t)=>!Ji(t),mn=e=>{if(!e)return;const t=e instanceof Headers?Array.from(e.entries()):Array.isArray(e)?e:Object.entries(e);if(t.length===0)return;const o=[];let r=!1,n=!1;for(const[a,s]of t)Yi(a,s)?(o.push([a,encodeURIComponent(s)]),r=!0,a.toLowerCase()==="x-opencode-directory"&&(n=!0)):o.push([a,s]);return n&&o.push(["x-opencode-directory-encoding","uri"]),r?o:void 0},Ce=async(e,t,o=!0)=>{const r=new Headers(mn(e)??e);return t&&new Headers(mn(t)??t).forEach((n,a)=>r.set(a,n)),o?Ui(r):r},Qi=(e,t)=>{if(!t)return e;const o=new URL(e,kr);return xr(o,t),`${o.pathname}${o.search}`},Pa=(e,t)=>{const o=e instanceof Request?e.url:e.toString();if(!Ir(o))return Je(o)?Qi(o,t):null;try{const r=new URL(o);return!Rr(r)||!Je(r.pathname)?null:(xr(r,t),`${r.pathname}${r.search}`)}catch{return null}},Xi=async(e,t,o)=>{const r=bo();if(!r)return null;const n=Pa(e,o);if(n===null)return null;const a=e instanceof Request?e.headers:void 0,s=await Ce(a,t.headers,!0);return e instanceof Request?r.fetch(e,{...t,headers:s}):r.fetch(n,{...t,headers:s})},Zi=(e,t)=>{if(typeof e=="string")return We(e,t);if(e instanceof URL)return We(e.toString(),t);const o=We(e.url,t);return o===e.url?e:new Request(o,e)},ec=/\/api\/(config|path|app\/agents|agent|project|command)(\b|\/|\?|$)/,Kt=new Map,tc=(e,t,o)=>o||e!=="GET"||t.includes("/event")||!ec.test(t)?null:`GET ${t}`,f=async(e,t={})=>{const{query:o,...r}=t,n=bo(),a=n?Pa(e,o):null;let s,i,c;if(n&&a!==null){const g=e instanceof Request?e.headers:void 0,p=await Ce(g,r.headers,!0);s=e instanceof Request?()=>n.fetch(e,{...r,headers:p}):()=>n.fetch(a,{...r,headers:p}),i=a,c=String(r.method??(e instanceof Request?e.method:"GET")).toUpperCase()}else{const g=Zi(e,o),p=g instanceof Request?g.headers:void 0,b=await Ce(p,r.headers,Ki(g));s=g instanceof Request?()=>fetch(new Request(g,{...r,headers:b})):()=>fetch(g,{...r,headers:b}),i=g instanceof Request?g.url:g instanceof URL?g.toString():String(g),c=String(r.method??(g instanceof Request?g.method:"GET")).toUpperCase()}const d=r.signal!=null||e instanceof Request,l=tc(c,i,d);if(!l)return s();const u=Kt.get(l);if(u)return u.then(g=>g.clone());const m=s();return Kt.set(l,m),m.then(()=>Kt.delete(l),()=>Kt.delete(l)),m.then(g=>g.clone())};let gn=!1;const oc=()=>{if(gn||typeof window>"u")return;gn=!0;const e=window.fetch.bind(window);window.fetch=async(t,o)=>{const r=await Xi(t,o??{});if(r)return r;if(typeof t=="string"){if(!_o(t)){try{const a=new URL(t);if(ro(a)){const s=await Ce(void 0,o?.headers);return e(t,{...o,headers:s})}}catch{}return e(t,o)}const n=await Ce(void 0,o?.headers);return e(We(t),{...o,headers:n})}if(t instanceof URL){const n=t.toString();if(!_o(n)){if(ro(t)){const s=await Ce(void 0,o?.headers);return e(t,{...o,headers:s})}return e(t,o)}const a=await Ce(void 0,o?.headers);return e(We(n),{...o,headers:a})}if(t instanceof Request){if(!_o(t.url)){try{const i=new URL(t.url);if(ro(i)){const c=await Ce(t.headers,o?.headers);return e(new Request(t,{...o,headers:c}))}}catch{}return e(t,o)}const n=await Ce(t.headers,o?.headers),a=We(t.url),s=a===t.url?t:new Request(a,t);return e(new Request(s,{...o,headers:n}))}return e(t,o)}},or="openchamber:runtime-endpoint-changed",rr="openchamber:runtime-endpoint-will-change";let uo="",It="";const No=(e,t,o)=>{try{e[t]=o}catch{}},Or=e=>{try{const t=new URL(e);return t.hash="",t.search="",t.pathname=t.pathname.replace(/\/+$/,"")||"/",`url:${t.toString().replace(/\/+$/,"")}`}catch{return`url:${e.trim().replace(/\/+$/,"")||"default"}`}},Ra=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_API_BASE_URL__;return typeof e=="string"?e.trim():""},Ia=()=>{if(typeof window>"u")return"";const e=window.__OPENCHAMBER_LOCAL_ORIGIN__;return typeof e=="string"?e.trim():""},xa=(e,t)=>{if(!e||!t)return!1;try{return new URL(e).origin===new URL(t).origin}catch{return!1}},_r=()=>uo||Ra(),L=()=>{if(It)return It;const e=_r();return xa(e,Ia())?"local":Or(e)},rc=(e={})=>{if(uo||It)return;const t=e.apiBaseUrl?.trim()||Ra();t&&(uo=t,It=e.runtimeKey?.trim()||(xa(t,Ia())?"local":Or(t)))},nr=e=>{const t=e.apiBaseUrl.trim(),o=_r(),r=L(),n=e.runtimeKey?.trim()||Or(t),a={apiBaseUrl:t,previousApiBaseUrl:o,runtimeKey:n,previousRuntimeKey:r};if(typeof window<"u"&&window.dispatchEvent(new CustomEvent(rr,{detail:a})),uo=t,It=n,typeof window<"u"){const s=window;No(s,"__OPENCHAMBER_API_BASE_URL__",t),No(s,"__OPENCHAMBER_CLIENT_TOKEN__",e.clientToken||void 0),No(s,"__OPENCHAMBER_RUNTIME_HEADERS__",e.requestHeaders||void 0)}Ta({apiBaseUrl:t,realtimeBaseUrl:t}),Aa(e.requestHeaders||null),ba(e.clientToken||null),e.relay?ki(e.relay):vi(),Co(t).catch(()=>{}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(or,{detail:a}))},nc=e=>{if(typeof window>"u")return()=>{};const t=o=>{e(o.detail)};return window.addEventListener(rr,t),()=>window.removeEventListener(rr,t)},Oa=e=>{if(typeof window>"u")return()=>{};const t=o=>{e(o.detail)};return window.addEventListener(or,t),()=>window.removeEventListener(or,t)},ac=["local","remote",null],sc=["ok","not-configured","unreachable","incompatible","wrong-service","missing"];function _a(e){if(!e||typeof e!="object")return{valid:!1};const t=e,o=t.localAvailable===!1?{localAvailable:!1}:{},r=t.target,n=t.status;if(r!==null&&(typeof r!="string"||!ac.includes(r)))return{valid:!1};if(typeof n!="string"||!sc.includes(n))return{valid:!1};if(r==="remote"||r==="local"){if(n==="ok"&&r==="local")return{valid:!0,outcome:{target:"local",status:"ok",...o}};if(n==="ok"&&r==="remote")return typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"ok",hostId:t.hostId,url:t.url,...o}};if(n==="unreachable")return r==="local"?{valid:!0,outcome:{target:"local",status:"unreachable",...o}}:typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"unreachable",hostId:t.hostId,url:t.url,...o}};if(n==="incompatible"||n==="wrong-service")return r!=="remote"?{valid:!1}:typeof t.hostId!="string"||typeof t.url!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:n,hostId:t.hostId,url:t.url,...o}};if(n==="missing")return r!=="remote"?{valid:!1}:typeof t.hostId!="string"?{valid:!1}:{valid:!0,outcome:{target:"remote",status:"missing",hostId:t.hostId,...o}}}if(r===null){if(n==="not-configured")return{valid:!0,outcome:{target:null,status:"not-configured",...o}};if(n==="missing")return{valid:!1}}return{valid:!1}}function xp(e){if(!e.isDesktopShell)return null;const t=e.bootOutcome;if(!t)return null;const o=t.localAvailable===!1?{localAvailable:!1}:{};if(t.status==="ok"){if(t.target==="local")return{screen:"main",...o};if(t.target==="remote")return{screen:"main",hostId:t.hostId,url:t.url,...o}}if(t.target===null&&t.status==="not-configured")return{screen:"chooser",...o};if(t.target==="local"&&t.status==="unreachable")return{screen:"chooser",...o};if(t.target==="remote"){if(t.status==="unreachable")return{screen:"recovery",variant:"remote-unreachable",hostId:t.hostId,url:t.url,...o};if(t.status==="incompatible")return{screen:"recovery",variant:"remote-incompatible",hostId:t.hostId,url:t.url,...o};if(t.status==="wrong-service")return{screen:"recovery",variant:"remote-wrong-service",hostId:t.hostId,url:t.url,...o};if(t.status==="missing")return{screen:"recovery",variant:"remote-missing",hostId:t.hostId,...o}}return null}function Op(e){return e.isDesktopShell?e.bootOutcomeKnown?e.bootViewIsMain===!1?!0:e.isInitialized:!1:e.isInitialized}function _p(e){return e.isDesktopShell&&!e.isDesktopLocalOriginActive}function ic(){if(cc()!=="valid")return null;const t=window.__OPENCHAMBER_DESKTOP_BOOT_OUTCOME__,o=_a(t);return o.valid?o.outcome:null}function cc(){if(typeof window>"u")return"not-injected";const e=window.__OPENCHAMBER_DESKTOP_BOOT_OUTCOME__;return e==null?"not-injected":_a(e).valid?"valid":"malformed"}let ar=null;const Np=e=>{ar=e},Bo=()=>ar||(typeof window>"u"?null:window.__OPENCHAMBER_RUNTIME_APIS__??null),dc=()=>typeof window>"u"?null:window.__OPENCHAMBER_ELECTRON__??null,mt=()=>typeof window>"u"?null:window.__OPENCHAMBER_DESKTOP__??null,Ut=()=>dc()?.runtime==="electron",lc=()=>{if(typeof window>"u")return null;const e=window.__OPENCHAMBER_PLATFORM__;return typeof e=="string"?e:null},uc="right",Up=()=>{if(!Ut())return!1;const e=lc();return e==="win32"||e==="linux"},Lp=e=>e==="left"?"left":uc,Hp=e=>e==="left"?["close","minimize","maximize"]:["minimize","maximize","close"],Z=()=>typeof mt()?.invoke=="function",gt=()=>Ut()&&Z(),G=async(e,t)=>{const o=mt();return typeof o?.invoke!="function"?null:o.invoke(e,t??{})},jp=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_launch_at_login");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"?null:e}catch(e){return console.warn("Failed to get launch at login status",e),null}},zp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_launch_at_login",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"?null:t}catch(t){return console.warn("Failed to set launch at login status",t),null}},$p=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_minimize_to_tray");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"?null:e}catch(e){return console.warn("Failed to get minimize to tray status",e),null}},Gp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_minimize_to_tray",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"?null:t}catch(t){return console.warn("Failed to set minimize to tray status",t),null}},qp=async()=>{if(!gt()||!ee())return null;try{const e=await G("desktop_get_keep_awake");return!e||typeof e.supported!="boolean"||typeof e.enabled!="boolean"||typeof e.active!="boolean"?null:e}catch(e){return console.warn("Failed to get keep awake status",e),null}},Wp=async e=>{if(!gt()||!ee())return null;try{const t=await G("desktop_set_keep_awake",{enabled:e});return!t||typeof t.supported!="boolean"||typeof t.enabled!="boolean"||typeof t.active!="boolean"?null:t}catch(t){return console.warn("Failed to set keep awake status",t),null}},pn=e=>{const t=e.trim();if(!t)return null;try{return new URL(t).origin}catch{try{return new URL(t.endsWith("/")?t:`${t}/`).origin}catch{return null}}},Uo=e=>{const t=e.trim();if(!t)return null;try{return new URL(t)}catch{try{return new URL(t.endsWith("/")?t:`${t}/`)}catch{return null}}},fc=e=>e.replace(/^\[|\]$/g,"").toLowerCase(),Ft=e=>{const t=fc(e);return t==="localhost"||t==="127.0.0.1"||t==="::1"},ee=()=>{if(typeof window>"u"||!Na())return!1;if(L()==="local")return!0;const e=typeof window.__OPENCHAMBER_LOCAL_ORIGIN__=="string"?window.__OPENCHAMBER_LOCAL_ORIGIN__:"",t=Uo(e),o=Uo(_r());if(!o&&t&&ic()?.target==="local")return!0;if(t&&o){if(t.origin===o.origin)return!0;const s=t.port||(t.protocol==="https:"?"443":"80"),i=o.port||(o.protocol==="https:"?"443":"80");return t.protocol===o.protocol&&s===i&&Ft(t.hostname)&&Ft(o.hostname)}const r=Uo(window.location.origin);if(t&&r){if(t.origin===r.origin)return!0;const s=t.port||(t.protocol==="https:"?"443":"80"),i=r.port||(r.protocol==="https:"?"443":"80");return t.protocol===r.protocol&&s===i&&Ft(t.hostname)&&Ft(r.hostname)}const n=pn(e),a=pn(window.location.origin)||window.location.origin;return n&&a&&n===a?!0:!!(r&&Ft(r.hostname))},Na=()=>typeof window>"u"?!1:Ut(),Vp=async()=>{if(!Na())return!1;try{return await G("desktop_start_window_drag"),!0}catch{return!1}},Do=()=>Bo()?.runtime?.isVSCode===!0,Kp=()=>{const t=Bo()?.runtime?.platform;return t==="web"?!0:t==="desktop"||t==="vscode"?!1:!Do()},Ua=async()=>{if(typeof window<"u"){const e=window.__OPENCHAMBER_HOME__;if(e&&e.length>0)return e}return null},Jp=async e=>{if(Z()&&ee())try{const t=await mt()?.openDialog?.({directory:!0,multiple:!1,title:"Select Working Directory"});return!t||typeof t!="string"?{success:!1,error:"Directory selection cancelled"}:{success:!0,path:t}}catch(t){return console.warn("Failed to request directory access",t),{success:!1,error:t instanceof Error?t.message:String(t)}}return{success:!0,path:e}},La=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Yp=async e=>{if(Z()&&ee())try{const t=await mt()?.openDialog?.({directory:!1,multiple:!1,title:"Select File",returnGrant:!0,...e?.filters?{filters:e.filters}:{},...e?.defaultPath?{defaultPath:e.defaultPath}:{}});if(!t)return{success:!1,error:"File selection cancelled"};if(typeof t=="string")return{success:!0,path:t};if(!La(t))return{success:!1,error:"File selection cancelled"};const o=typeof t.path=="string"?t.path:"";return o?{success:!0,path:o,outsideFileGrant:typeof t.outsideFileGrant=="string"?t.outsideFileGrant:void 0}:{success:!1,error:"File selection cancelled"}}catch(t){return console.warn("Failed to request file access",t),{success:!1,error:t instanceof Error?t.message:String(t)}}return{success:!1,error:"Native file picker not available"}},Qp=async e=>{const t=typeof e=="string"?e.trim():"";if(!t)return{success:!1,error:"Path is required"};if(!Z()||!ee())return{success:!1,error:"Native file access not available"};try{const o=await mt()?.grantFileAccess?.(t);if(!La(o))return{success:!1,error:"File access was not granted"};const r=typeof o.path=="string"?o.path:"",n=typeof o.outsideFileGrant=="string"?o.outsideFileGrant:"";return!r||!n?{success:!1,error:"File access was not granted"}:{success:!0,path:r,outsideFileGrant:n}}catch(o){return console.warn("Failed to request existing file access",o),{success:!1,error:o instanceof Error?o.message:String(o)}}},Xp=async e=>({success:!0}),Zp=async e=>({success:!0}),eh=async()=>Z()?await G("desktop_check_for_updates"):null,th=async e=>{if(!Z())return!1;const t=mt();let o=null,r=0,n;try{return typeof e=="function"&&t?.listen&&(o=await t.listen("openchamber:update-progress",a=>{const s=a?.payload;if(!s||typeof s!="object")return;const i=s,c=typeof i.event=="string"?i.event:null,d=i.data&&typeof i.data=="object"?i.data:null;if(c==="Started"){r=0,n=typeof d?.contentLength=="number"?d.contentLength:void 0,e({downloaded:r,total:n});return}if(c==="Progress"){const l=d?.downloaded,u=d?.total;typeof l=="number"&&(r=l),typeof u=="number"&&(n=u),e({downloaded:r,total:n});return}c==="Finished"&&e({downloaded:r,total:n})})),await G("desktop_download_and_install_update"),!0}catch(a){throw a instanceof Error?a:new Error(String(a))}finally{if(o)try{const a=o();a instanceof Promise&&await a}catch{}}},oh=async()=>Z()?mc():!1,mc=async()=>{if(!Z())return!1;try{return await G("desktop_restart"),!0}catch(e){return console.warn("Failed to restart desktop app",e),!1}},rh=async()=>{if(!Z()||!ee())return null;try{const e=await G("desktop_get_lan_address");return typeof e=="string"&&e.trim().length>0?e.trim():null}catch(e){return console.warn("Failed to get desktop LAN address",e),null}},gc=async(e,t)=>{if(!Z()||!ee())return!1;const o=e?.trim();if(!o)return!1;try{return await G("desktop_open_path",{path:o,app:typeof t=="string"&&t.trim().length>0?t.trim():void 0}),!0}catch(r){return console.warn("Failed to open path",r),!1}},nh=async e=>{if(!Z()||!ee())return!1;const t=e?.trim();if(!t)return!1;try{return await G("desktop_reveal_path",{path:t}),!0}catch{return gc(t)}},ah=async(e,t)=>{if(!Z()||!ee())return null;const o=e?.trim();if(!o)return null;try{const r=await G("desktop_save_markdown_file",{defaultFileName:o,content:t});return typeof r=="string"&&r.trim().length>0?r:null}catch(r){return console.warn("Failed to save markdown file",r),null}},sh=async(e,t,o)=>{if(!Z()||!ee())return!1;const r=e?.trim(),n=t?.trim(),a=o?.trim();if(!r||!n||!a)return!1;try{return await G("desktop_open_in_app",{projectPath:r,appId:n,appName:a}),!0}catch(s){return console.warn("Failed to open project in app",s),!1}},ih=async(e,t,o)=>{if(!Z()||!ee())return!1;const r=e?.trim(),n=t?.trim(),a=o?.trim();if(!r||!n||!a)return!1;try{return await G("desktop_open_file_in_app",{filePath:r,appId:n,appName:a}),!0}catch(s){return console.warn("Failed to open file in app",s),!1}},ch=async(e,t)=>{if(!Z()||!ee())return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};const o=Array.isArray(e)?e.filter(r=>typeof r=="string"):[];if(o.length===0)return{apps:[],success:!0,hasCache:!1,isCacheStale:!1};try{const r=await G("desktop_get_installed_apps",{apps:o,force:t===!0?!0:void 0});if(!r||typeof r!="object")return{apps:[],success:!1,hasCache:!1,isCacheStale:!1};const n=r;return n.supported===!1?{apps:[],success:!0,hasCache:!1,isCacheStale:!1}:Array.isArray(n.apps)?{apps:n.apps.filter(s=>s&&typeof s=="object").map(s=>{const i=s;return{name:typeof i.name=="string"?i.name:"",iconDataUrl:typeof i.iconDataUrl=="string"?i.iconDataUrl:null}}).filter(s=>s.name.length>0),success:!0,hasCache:n.hasCache===!0,isCacheStale:n.isCacheStale===!0}:{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}catch(r){return console.warn("Failed to fetch installed apps",r),{apps:[],success:!1,hasCache:!1,isCacheStale:!1}}},Lo=16384,fo=globalThis,pc=e=>{if(fo.Buffer)return fo.Buffer.from(e,"utf8").toString("base64url");const t=new TextEncoder().encode(e);let o="";for(let r=0;r<t.length;r+=32768)o+=String.fromCharCode(...t.slice(r,r+32768));return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},hc=e=>{try{if(fo.Buffer)return fo.Buffer.from(e,"base64url").toString("utf8");const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"="),o=atob(t),r=new Uint8Array(o.length);for(let n=0;n<o.length;n+=1)r[n]=o.charCodeAt(n);return new TextDecoder().decode(r)}catch{return null}},Fc=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="http:"&&o.protocol!=="https:"?null:(o.hash="",o.toString().replace(/\/+$/g,""))}catch{return null}},yc=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="ws:"&&o.protocol!=="wss:"?null:(o.hash="",o.toString())}catch{return null}},hn=e=>typeof e=="string"&&e.length>0,bc=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return t.kty!=="EC"||t.crv!=="P-256"||!hn(t.x)||!hn(t.y)?null:{kty:"EC",crv:"P-256",x:t.x,y:t.y}},Ac=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,wc=e=>{if(!e||typeof e!="object")return null;const t=e,o=Ac(t.priority);if(t.type==="lan"||t.type==="tunnel"){const r=Fc(t.url);return r?o===void 0?{type:t.type,url:r}:{type:t.type,url:r,priority:o}:null}if(t.type==="relay"){const r=yc(t.relayUrl);if(!r)return null;const n=typeof t.serverId=="string"?t.serverId.trim():"";if(!n)return null;const a=bc(t.hostEncPubJwk);if(!a)return null;const s=typeof t.grant=="string"&&t.grant.trim()?t.grant.trim():void 0;return{type:"relay",relayUrl:r,serverId:n,hostEncPubJwk:a,...s?{grant:s}:{},...o===void 0?{}:{priority:o}}}return null},Ha=e=>{if(!e||typeof e!="object")return null;const t=e;if(t.v!==2)return null;const o=typeof t.pairingId=="string"?t.pairingId.trim():"",r=typeof t.secret=="string"?t.secret.trim():"";if(!o||!r)return null;const n=Array.isArray(t.candidates)?t.candidates.map(wc).filter(c=>!!c):[];if(n.length===0)return null;const a=typeof t.expiresAt=="string"&&t.expiresAt.trim()?t.expiresAt.trim():void 0;if(a){const c=Date.parse(a);if(!Number.isFinite(c)||c<=Date.now())return null}const s=typeof t.label=="string"&&t.label.trim()?t.label.trim():void 0,i=typeof t.fingerprint=="string"&&t.fingerprint.trim()?t.fingerprint.trim():void 0;return{v:2,pairingId:o,secret:r,...s?{label:s}:{},...i?{fingerprint:i}:{},...a?{expiresAt:a}:{},candidates:n}},dh=e=>({v:2,pairingId:e.pairingId.trim(),secret:e.secret.trim(),...e.label?.trim()?{label:e.label.trim()}:{},...e.fingerprint?.trim()?{fingerprint:e.fingerprint.trim()}:{},...e.expiresAt?.trim()?{expiresAt:e.expiresAt.trim()}:{},candidates:e.candidates}),lh=e=>{const t=Ha(e);if(!t)throw new Error("Invalid pairing connection payload");const o=new URLSearchParams;return o.set("v","2"),o.set("p",pc(JSON.stringify(t))),`openchamber://connect?${o.toString()}`},Ec=e=>{const t=e.trim();if(!t||t.length>Lo)return null;try{const o=new URL(t);if(o.protocol!=="openchamber:"||o.hostname!=="connect"||o.searchParams.get("v")!=="2")return null;const r=o.searchParams.get("p")||"";if(!r||r.length>Lo)return null;const n=hc(r);return!n||n.length>Lo?null:Ha(JSON.parse(n))}catch{return null}},lt=e=>typeof e=="object"&&e!==null,Cc=e=>e.trim().toLowerCase()==="authorization",Bc=e=>{if(!lt(e))return;const t={};for(const[o,r]of Object.entries(e)){const n=o.trim(),a=typeof r=="string"?r.trim():"";!n||!a||/[\r\n:]/.test(n)||/[\r\n]/.test(a)||Cc(n)||(t[n]=a)}return Object.keys(t).length>0?t:void 0},Dc=e=>`relay://${e}`,kc=e=>{if(!lt(e))return null;const t=X(e,"relayUrl")||X(e,"relay_url"),o=X(e,"serverId")||X(e,"server_id"),r=e.hostEncPubJwk??e.host_enc_pub_jwk;return!t||!o||!lt(r)?null:{relayUrl:t,serverId:o,hostEncPubJwk:r}},vc=()=>{if(typeof navigator>"u")return;const e=navigator.userAgent;if(/Macintosh|Mac OS X/i.test(e))return"macos";if(/Windows/i.test(e))return"windows";if(/Linux/i.test(e))return"linux"},uh=async(e,t)=>{const o=Ec(e);if(!o)throw new Error("invalid-connect-link");const r=await Ic().catch(()=>""),n={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({pairingId:o.pairingId,secret:o.secret,clientLabel:o.label||"OpenChamber Desktop",clientKind:"desktop",deviceName:"OpenChamber Desktop",devicePlatform:vc(),...r?{dedupeKey:`desktop:${r}`}:{}})},a=async h=>{if(!h.ok)return null;const w=await h.json().catch(()=>null);return(typeof w?.clientToken=="string"?w.clientToken.trim():"")||null};let s=null;const i=[...o.candidates].sort((h,w)=>(h.type==="relay"?1:0)-(w.type==="relay"?1:0));for(const h of i){if(h.type==="relay"){const D=vr({relayUrl:h.relayUrl,serverId:h.serverId,hostEncPubJwk:h.hostEncPubJwk,...h.grant?{grant:h.grant}:{}});try{const B=await a(await D.fetch("/api/client-auth/pairing/redeem",n));if(B){s={relay:{relayUrl:h.relayUrl,serverId:h.serverId,hostEncPubJwk:h.hostEncPubJwk},token:B};break}}catch{}finally{D.close()}continue}const w=pe(h.url);if(w)try{const D=await a(await fetch(`${w}/api/client-auth/pairing/redeem`,n));if(D){s={directUrl:w,token:D};break}}catch{}}if(!s)throw new Error("pairing-redeem-failed");const c=o.candidates.find(h=>h.type==="relay"),d=s.relay||(c?{relayUrl:c.relayUrl,serverId:c.serverId,hostEncPubJwk:c.hostEncPubJwk}:void 0),l=o.candidates.filter(h=>h.type!=="relay").map(h=>pe(h.url)).find(h=>!!h),u=s.directUrl||l,m=u||(d?Dc(d.serverId):null);if(!m)throw new Error("pairing-missing-transport");const g=t.find(h=>d?h.relay?.serverId===d.serverId:!h.relay&&pe(h.apiUrl||h.url)===m),p=g?.id||(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`host-${Date.now()}-${Math.random().toString(16).slice(2)}`),b={...g||{},id:p,label:o.label||g?.label||Mc(m),url:m,apiUrl:u,clientToken:s.token,...d?{relay:d}:{}};return{hostId:p,hosts:g?t.map(h=>h.id===p?b:h):[b,...t]}},Sc=/^(t|.*(?:token|auth|secret|api).*)$/i,pe=e=>{const t=e.trim();if(!t)return null;try{const o=new URL(t);return o.protocol!=="http:"&&o.protocol!=="https:"?null:t.split("#")[0]||null}catch{return null}},fh=e=>{const t=pe(e);if(!t)return null;try{const o=new URL(t);if((o.pathname.replace(/\/+$/,"")||"/")==="/connect"&&o.searchParams.has("t"))return{persistedUrl:o.origin,redeemUrl:o.toString(),kind:"tunnel-connect-link"}}catch{return null}return{persistedUrl:t,redeemUrl:null,kind:"normal-host"}},Mc=e=>{const t=pe(e);if(!t)return e;try{const o=new URL(t);(o.username||o.password)&&(o.username="",o.password="");const r=Array.from(new Set(Array.from(o.searchParams.keys())));for(const n of r)Sc.test(n)&&o.searchParams.set(n,"[REDACTED]");return o.toString()}catch{return t}},mh=(e,t)=>{const o=pe(e),r=pe(t);if(!o||!r)return!1;try{const n=new URL(o),a=new URL(r);if(n.origin!==a.origin||a.search&&n.search!==a.search)return!1;const s=a.pathname.length>1?a.pathname.replace(/\/+$/,""):a.pathname,i=n.pathname.length>1?n.pathname.replace(/\/+$/,""):n.pathname;return s==="/"?!0:i===s||i.startsWith(`${s}/`)}catch{return!1}},X=(e,t)=>{const o=e[t];return typeof o=="string"?o:null},Fn=(e,t)=>{const o=e[t];return typeof o=="number"&&Number.isFinite(o)?o:null},Tc=e=>{if(!lt(e))return null;const t=X(e,"id"),o=X(e,"label"),r=X(e,"url"),n=X(e,"apiUrl")||X(e,"api_url"),a=X(e,"clientToken")||X(e,"client_token"),s=Bc(e.requestHeaders),i=kc(e.relay);return!t||!o||!r?null:{id:t,label:o,url:r,...n?{apiUrl:n}:{},...a?{clientToken:a}:{},...s?{requestHeaders:s}:{},...i?{relay:i}:{}}},Pc=e=>pe(e.apiUrl||e.url)||e.apiUrl||e.url,Qe=()=>Z()?(e,t)=>G(e,t):null,ja=async()=>{const e=Qe();if(!e)return{hosts:[],defaultHostId:"local",initialHostChoiceCompleted:!1};const t=await e("desktop_hosts_get");if(!lt(t))return{hosts:[],defaultHostId:null,initialHostChoiceCompleted:!1};const o=t.hosts,r=Array.isArray(o)?o.map(Tc).filter(i=>!!i):[],n=X(t,"defaultHostId")||X(t,"default_host_id")||X(t,"defaultHostID"),a=t.initialHostChoiceCompleted===!0||t.initial_host_choice_completed===!0,s=X(t,"localOrigin")||X(t,"local_origin");return{hosts:r,defaultHostId:n,initialHostChoiceCompleted:a,localOrigin:s}},Rc=async e=>{const t=Qe();if(!t)return;const o={hosts:e.hosts,defaultHostId:e.defaultHostId,initialHostChoiceCompleted:e.initialHostChoiceCompleted};e.localClientToken!==void 0&&(o.localClientToken=e.localClientToken),await t("desktop_hosts_set",{input:o})},gh=async()=>{const e=Qe();if(!e)return"";const t=await e("desktop_local_client_token_get").catch(()=>null);return typeof t=="string"?t.trim():""},Ic=async()=>{const e=Qe();if(!e)return"";const t=await e("desktop_install_id_get").catch(()=>null);return typeof t=="string"?t.trim():""},xc=8e3,ph=async(e,t)=>{const o=vr({relayUrl:e.relayUrl,serverId:e.serverId,hostEncPubJwk:e.hostEncPubJwk}),r=Date.now();let n=!1;try{return(await Promise.race([o.fetch("/health"),new Promise(s=>{const i=window.setTimeout(()=>s(null),xc);typeof i!="number"&&typeof i.unref=="function"&&i.unref()})]))?.ok?(n=t?.keepTunnel===!0,{status:"ok",latencyMs:Math.max(0,Date.now()-r),...n?{tunnel:o}:{}}):{status:"unreachable",latencyMs:0}}catch{return{status:"unreachable",latencyMs:0}}finally{n||o.close()}},za=async(e,t)=>{const o=Qe();if(!o)return{status:"unreachable",latencyMs:0};const r=await o("desktop_host_probe",{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0,expectedServerId:t?.expectedServerId||void 0});if(!lt(r))return{status:"unreachable",latencyMs:0};const n=r.status,a=n==="ok"||n==="auth"||n==="update-recommended"||n==="incompatible"||n==="wrong-service"||n==="unreachable"?n:"unreachable",s=Fn(r,"latencyMs")??Fn(r,"latency_ms")??0;return{status:a,latencyMs:s}},hh=async(e,t)=>{const o=Qe();o&&await o("desktop_new_window_at_url",{url:e,clientToken:t?.clientToken||void 0,requestHeaders:t?.requestHeaders||void 0})},Fh=async e=>{const t=Qe();t&&await t("desktop_new_window_for_host",{hostId:e})},Oc=5e3,_c=1500;let Ho=!1;const Nc=async e=>{if(!Ut()||Ho)return;const t=`host:${e}`;if(L()===t){Ho=!0;try{const o=await ja().catch(()=>null),r=o?.hosts.find(u=>u.id===e);if(!o||!r?.relay)return;const n=r.apiUrl?pe(r.apiUrl):null;if(n&&n.startsWith("https://"))return;const a=await f("/api/client-auth/connection/candidates").catch(()=>null);if(!a?.ok)return;const s=await a.json().catch(()=>null);if(!s||s.serverId!==r.relay.serverId)return;const i=Array.isArray(s.candidates)?s.candidates:[],c=[];for(const u of i){if(!u||typeof u!="object")continue;const m=u;if(m.type!=="lan"||typeof m.url!="string")continue;const g=pe(m.url);g&&!c.includes(g)&&c.push(g)}if(c.length===0)return;const d=n&&c.includes(n)?n:c[0];d!==n&&await Rc({hosts:o.hosts.map(u=>u.id===e?{...u,apiUrl:d}:u),defaultHostId:o.defaultHostId,initialHostChoiceCompleted:o.initialHostChoiceCompleted}).catch(()=>{});const l=await za(d,{clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,expectedServerId:r.relay.serverId}).catch(()=>({status:"unreachable",latencyMs:0}));if(l.status==="unreachable"||l.status==="wrong-service"||l.status==="incompatible"||L()!==t)return;nr({apiBaseUrl:d,clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,runtimeKey:t})}finally{Ho=!1}}},Uc=e=>{typeof window>"u"||window.setTimeout(()=>{Nc(e).catch(()=>{})},Oc)},Lc=async e=>{if(!Ut())return;const t=await ja().catch(()=>null);if(!t)return;const o=e||(t.defaultHostId!=="local"?t.defaultHostId:null);if(!o)return;const r=t.hosts.find(u=>u.id===o);if(!r?.relay)return;const n=`host:${r.id}`;if(L()===n)return;const a=u=>{nr({apiBaseUrl:u,clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,runtimeKey:n})},s=()=>{nr({apiBaseUrl:typeof window<"u"?window.location.origin:"",clientToken:r.clientToken||null,runtimeKey:n,relay:r.relay??void 0}),Uc(r.id)},i=r.apiUrl?pe(Pc(r)):null;if(!i){s();return}const c=u=>u.status!=="unreachable"&&u.status!=="wrong-service"&&u.status!=="incompatible",d=za(i,{clientToken:r.clientToken||null,requestHeaders:r.requestHeaders||null,expectedServerId:r.relay.serverId}).catch(()=>({status:"unreachable",latencyMs:0})),l=await Promise.race([d,new Promise(u=>setTimeout(()=>u(null),_c))]);if(l){if(c(l)){a(i);return}s();return}s(),d.then(u=>{c(u)&&L()===n&&a(i)})},yn=500,$a=()=>{if(typeof window>"u")return!1;try{return new URLSearchParams(window.location.search).get("startupTrace")==="1"||window.localStorage?.getItem("OPENCHAMBER_STARTUP_TRACE")==="1"}catch{return!1}},yh=()=>$a(),fe=(e,t)=>{if(!$a())return;const o=typeof performance<"u"?performance.now():Date.now();window.__OPENCHAMBER_STARTUP_TRACE_START__??=o,window.__OPENCHAMBER_STARTUP_TRACE__??=[],window.__OPENCHAMBER_STARTUP_TRACE__.push({t:Math.round(o-window.__OPENCHAMBER_STARTUP_TRACE_START__),name:e,...t?{data:t}:{}}),window.__OPENCHAMBER_STARTUP_TRACE__.length>yn&&window.__OPENCHAMBER_STARTUP_TRACE__.splice(0,window.__OPENCHAMBER_STARTUP_TRACE__.length-yn)},Hc=()=>{const e=typeof window<"u"?window.__OPENCHAMBER_STARTUP_TRACE__??[]:[],t=e.findIndex(r=>r.name==="ModelControls:ready"),o=t>=0?Math.min(e.length,t+8):e.length;return e.slice(0,o).filter(r=>r.name.includes("checkConnection")||r.name.includes("checkHealth")||r.name.includes("initializeApp")||r.name.includes("initApp")||r.name.includes("loadProviders")||r.name.includes("loadAgents")||r.name.includes("config.defaults")||r.name.includes("modelsMetadata")||r.name.includes("ModelControls")||r.name.includes("activateDirectory")||r.name.includes("opencodeClient:setDirectory"))};typeof window<"u"&&(window.__OPENCHAMBER_STARTUP_TRACE_SUMMARY__=Hc);const bh=async(e,t,o)=>{const r=typeof performance<"u"?performance.now():Date.now();fe(`${e}:start`,o);try{const n=await t(),a=typeof performance<"u"?performance.now():Date.now();return fe(`${e}:end`,{durationMs:Math.round(a-r)}),n}catch(n){const a=typeof performance<"u"?performance.now():Date.now();throw fe(`${e}:error`,{durationMs:Math.round(a-r),error:n instanceof Error?n.message:String(n)}),n}},jc=3,zc=3e4,$c=32e3,Gc=3600*1e3,qc=600*1e3,Wc=200,Vc=new Set([429,502,503,504]),ke=new Map,Nr=e=>JSON.stringify([L(),e]);function Kc(){const e=Date.now();for(const[t,o]of ke){const r=Math.max(o.lastErrorAt,o.circuitOpenAt);e-r>Gc&&ke.delete(t)}}typeof setInterval<"u"&&setInterval(Kc,qc).unref?.();function Jc(e){const t=Nr(e);let o=ke.get(t);if(!o)for(o={consecutiveErrors:0,lastErrorAt:0,circuitOpen:!1,circuitOpenAt:0,circuitCooldownMs:zc},ke.set(t,o);ke.size>Wc;){const r=ke.keys().next().value;if(!r)break;ke.delete(r)}return o}function Yc(e){e&&ke.delete(Nr(e))}function bn(e,t){if(!e)return;const o=Jc(e);o.consecutiveErrors+=1,o.lastErrorAt=Date.now(),Qc(t)&&o.consecutiveErrors>=jc&&(o.circuitOpen=!0,o.circuitOpenAt=Date.now(),console.warn(`[provider-tracker] Circuit opened for ${e} after ${o.consecutiveErrors} consecutive errors`))}function Qc(e){return e!==void 0&&Vc.has(e)}function Xc(e){const t=ke.get(Nr(e));return t?.circuitOpen?Date.now()-t.circuitOpenAt>=t.circuitCooldownMs?(t.circuitOpen=!1,t.consecutiveErrors=0,t.circuitCooldownMs=Math.min(t.circuitCooldownMs*2,$c*4),!1):!0:!1}function Zc(e){if(!(!e||!Xc(e)))throw new Error(`Provider ${e} is temporarily unavailable after repeated errors. Please retry shortly.`)}const An="/api",ed=1e4,td=4e3;function it(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;if(e&&typeof e=="object"&&"message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}function te(e,t){if(e.error){const o=e.response?.status,r=new Error(`${t} failed${o?` (${o})`:""}: ${it(e.error)}`);throw o!==void 0&&(r.status=o),r}if(e.data===void 0||e.data===null)throw new Error(`${t} failed: empty response`);return e.data}function tt(e,t){if(e.error){const o=e.response?.status,r=new Error(`${t} failed${o?` (${o})`:""}: ${it(e.error)}`);throw o!==void 0&&(r.status=o),r}return e.data}const od=/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//,wn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",rd=14;let En=0,jo=0;const nd=e=>{const t=new Uint8Array(e);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let r=0;r<e;r+=1)t[r]=Math.floor(Math.random()*256);let o="";for(let r=0;r<e;r+=1)o+=wn[t[r]%wn.length];return o},Cn=e=>{const t=Date.now();t!==En&&(En=t,jo=0),jo+=1;const o=BigInt(t)*BigInt(4096)+BigInt(jo),r=new Uint8Array(6);for(let a=0;a<6;a+=1)r[a]=Number(o>>BigInt(40-8*a)&BigInt(255));const n=Array.from(r,a=>a.toString(16).padStart(2,"0")).join("");return`${e}_${n}${nd(rd)}`},Bn=e=>{const t=typeof e=="string"&&e.trim().length>0?e.trim():"/api";if(od.test(t)||typeof window>"u")return t;const o=window.location?.href||window.location?.origin;if(!o)return t;try{return new URL(t,o).toString()}catch(r){return console.warn("Failed to normalize OpenCode base URL:",r),t}},Dn=()=>{try{return oe().api("/api")}catch{return null}},ad=e=>{const t=typeof AbortSignal<"u"?AbortSignal:void 0;if(typeof t?.timeout=="function")return{signal:t.timeout(e),cleanup:()=>{}};const o=new AbortController,r=setTimeout(()=>o.abort(),e);return{signal:o.signal,cleanup:()=>clearTimeout(r)}},zo=e=>_s({...e,fetch:f}),ot=e=>e.replace(/\\/g,"/"),kn=400,vn=()=>{const e=Bo();return e&&e.runtime?.isDesktop&&e.files?e.files:null};class sd{client;baseUrl;scopedClients=new Map;currentDirectory=void 0;directoryContextQueue=Promise.resolve();listDirectoryInFlight=new Map;configProvidersInFlight=new Map;listAgentsInFlight=new Map;configInFlight=new Map;configCache=new Map;configCacheGeneration=0;listDirectoryCache=new Map;constructor(t=An){const r=Dn()||t;this.baseUrl=Bn(r),this.client=zo({baseUrl:this.baseUrl})}getBaseUrl(){return this.baseUrl}reconnectToRuntimeBaseUrl(){const t=Dn(),o=Bn(t||An);o!==this.baseUrl&&(this.baseUrl=o,this.client=zo({baseUrl:this.baseUrl}),this.scopedClients.clear(),this.listDirectoryInFlight.clear(),this.configProvidersInFlight.clear(),this.listAgentsInFlight.clear(),this.clearConfigCache(),this.listDirectoryCache.clear())}getSdkClient(){return this.client}getScopedSdkClient(t){return this.getScopedApiClient(t)}getScopedApiClient(t){const o=this.normalizeCandidatePath(t)??t,r=o||"",n=this.scopedClients.get(r);if(n)return n;const a=zo({baseUrl:this.baseUrl,directory:o});return this.scopedClients.set(r,a),a}normalizeCandidatePath(t){if(typeof t!="string")return null;const o=t.trim();if(!o)return null;const r=o.replace(/\\/g,"/").replace(/^([a-z]):/,(a,s)=>s.toUpperCase()+":");return(r.length>1?r.replace(/\/+$/,""):r)||null}deriveHomeDirectory(t){const o=t.match(/^([A-Za-z]:)(?:\/|$)/);if(o){const a=o[1],i=t.slice(a.length+(t.charAt(a.length)==="/"?1:0)).split("/").filter(Boolean);return i.length>=2?{homeDirectory:`${a}/${i[0]}/${i[1]}`,username:i[1]}:i.length===1?{homeDirectory:`${a}/${i[0]}`,username:i[0]}:{homeDirectory:a,username:void 0}}const r=t.startsWith("/"),n=t.split("/").filter(Boolean);return n.length>=2&&(n[0]==="Users"||n[0]==="home")?{homeDirectory:`${r?"/":""}${n[0]}/${n[1]}`,username:n[1]}:r?n.length===0?{homeDirectory:"/",username:void 0}:{homeDirectory:`/${n.join("/")}`,username:n[n.length-1]}:n.length>0?{homeDirectory:`/${n.join("/")}`,username:n[n.length-1]}:{homeDirectory:"/",username:void 0}}setDirectory(t){const o=this.normalizeCandidatePath(t)??t;this.currentDirectory!==o&&fe("opencodeClient:setDirectory",{previous:this.currentDirectory??null,next:o??null}),this.currentDirectory=o}getDirectory(){return this.currentDirectory}async withDirectory(t,o){const r=async()=>{if(t==null)return o();const a=this.currentDirectory,s=this.normalizeCandidatePath(t)??t;this.currentDirectory=s;try{return await o()}finally{this.currentDirectory===s&&(this.currentDirectory=a)}},n=this.directoryContextQueue.then(r,r);return this.directoryContextQueue=n.then(()=>{},()=>{}),n}getApiClient(){return this.client}async getSystemInfo(){const t=new Set,o=n=>{const a=this.normalizeCandidatePath(n);a&&t.add(a)};try{const a=(await this.client.path.get(this.currentDirectory?{directory:this.currentDirectory}:void 0)).data;a&&(o(a.directory),o(a.worktree),o(a.state))}catch(n){console.debug("Failed to load path info:",n)}if(!t.size)try{const n=await this.client.project.current(this.currentDirectory?{directory:this.currentDirectory}:void 0);o(n.data?.worktree)}catch(n){console.debug("Failed to load project info:",n)}if(!t.size)try{(await this.listSessions()).forEach(a=>o(a.directory))}catch(n){console.debug("Failed to inspect sessions for system info:",n)}if(o(this.currentDirectory),typeof window<"u")try{o(window.localStorage.getItem("lastDirectory")),o(window.localStorage.getItem("homeDirectory"))}catch{}if(!t.size&&typeof process<"u"&&typeof process.cwd=="function"&&o(process.cwd()),!t.size)return{homeDirectory:"/",username:void 0};const[r]=Array.from(t);return this.deriveHomeDirectory(r)}async probeDirectory(t){const o=this.normalizeCandidatePath(t);if(!o)return!1;try{const n=(await this.client.path.get({directory:o})).data,a=typeof n?.directory=="string"?n.directory:null;return!!(a&&a.trim().length>0)}catch{return!1}}async listSessions(){const t=await this.client.session.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);return Array.isArray(t.data)?t.data:[]}async createSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.create({...r?{directory:r}:{},parentID:t?.parentID,title:t?.title,metadata:t?.metadata});return te(n,"session.create")}async getSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.get({sessionID:t,...r?{directory:r}:{}});return te(n,"session.get")}async deleteSession(t,o){const r=this.normalizeCandidatePath(o)??this.currentDirectory,n=await this.client.session.delete({sessionID:t,...r?{directory:r}:{}});return tt(n,"session.delete")===!0}async updateSession(t,o,r){const n=this.normalizeCandidatePath(r)??this.currentDirectory,a={...o.title!==void 0?{title:o.title}:{},...o.metadata!==void 0?{metadata:o.metadata}:{},...o.time?.archived!==void 0&&o.time.archived!==null?{time:{archived:o.time.archived}}:{}},s=await this.client.session.update({sessionID:t,...n?{directory:n}:{},...a});return te(s,"session.update")}async getSessionMessages(t,o){const r=await this.client.session.messages({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{},...typeof o=="number"?{limit:o}:{}});return te(r,"session.messages")}async getSessionTodos(t){try{const o=await this.client.session.todo({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});if(o.error)return[];const r=o.data;return!r||!Array.isArray(r)?[]:r}catch{return[]}}shouldNormalizeToTextPlain(t){if(!t)return!1;const o=t.toLowerCase();return o.startsWith("text/")&&o!=="text/plain"?!0:["application/json","application/xml","application/javascript","application/typescript","application/x-yaml","application/yaml","application/toml","application/x-sh","application/x-shellscript","application/octet-stream","image/svg+xml"].includes(o)}isHeicMime(t){if(!t)return!1;const o=t.toLowerCase();return o==="image/heic"||o==="image/heif"}async convertHeicToJpeg(t){try{const o=(await Os(async()=>{const{default:u}=await import("./vendor-.bun-BzW0Lgld.js").then(m=>m.h);return{default:u}},[])).default,r=t.url.indexOf(",");if(r===-1)return t;const n=t.url.substring(r+1),a=atob(n),s=new Uint8Array(a.length);for(let u=0;u<a.length;u++)s[u]=a.charCodeAt(u);const i=new Blob([s],{type:t.mime}),c=await o({blob:i,toType:"image/jpeg",quality:.9}),d=await new Promise((u,m)=>{const g=new FileReader;g.onload=()=>u(g.result),g.onerror=m,g.readAsDataURL(c)});let l=t.filename;return l&&(l=l.replace(/\.heic$/i,".jpg").replace(/\.heif$/i,".jpg")),{mime:"image/jpeg",filename:l,url:d}}catch(o){return console.warn("Failed to convert HEIC to JPEG:",o),t}}async normalizeFilePart(t){if(this.isHeicMime(t.mime))return this.convertHeicToJpeg(t);if(!this.shouldNormalizeToTextPlain(t.mime))return t;let o=t.url;if(t.url.startsWith("data:")){const r=t.url.indexOf(",");if(r!==-1){const n=t.url.substring(5,r),a=t.url.substring(r);o=`data:${n.replace(/^[^;,]+/,"text/plain")}${a}`}}return{mime:"text/plain",filename:t.filename,url:o}}async toNormalizedFilePartInput(t){const o=await this.normalizeFilePart(t);return{...t.id?{id:t.id}:{},type:"file",mime:o.mime,filename:o.filename,url:o.url}}async sendMessage(t){const o=t.messageId??Cn("msg"),r=[];if(t.prefaceText&&t.prefaceText.trim()&&r.push({type:"text",text:t.prefaceText,synthetic:t.prefaceTextSynthetic!==!1}),t.text&&t.text.trim()){const d={type:"text",text:t.text};r.push(d)}if(t.files&&t.files.length>0)for(const d of t.files){const l=await this.toNormalizedFilePartInput(d);r.push(l)}if(t.additionalParts&&t.additionalParts.length>0){for(const d of t.additionalParts)if(d.text&&d.text.trim()&&r.push({type:"text",text:d.text,...d.synthetic?{synthetic:!0}:{}}),d.files&&d.files.length>0)for(const l of d.files){const u=await this.toNormalizedFilePartInput(l);r.push(u)}}if(t.agentMentions&&t.agentMentions.length>0)for(const d of t.agentMentions)d?.name&&r.push({type:"agent",name:d.name,...d.source?{source:d.source}:{}});if(r.length===0)throw new Error("Message must have at least one part (text or file)");const n=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory;t.format&&console.info("[git-generation][browser] send structured message",{sessionId:t.id,providerID:t.providerID,modelID:t.modelID,agent:t.agent,variant:t.variant,directory:n,baseUrl:this.baseUrl,formatType:t.format.type}),Zc(t.providerID);let a;try{const d=await this.client.session.promptAsync({sessionID:t.id,...n?{directory:n}:{},model:{providerID:t.providerID,modelID:t.modelID},agent:t.agent,variant:t.variant,messageID:o,...t.delivery?{delivery:t.delivery}:{},...t.format?{format:t.format}:{},parts:r});if(d.response instanceof Response)a=d.response;else if(d.error){const l=d.response?.status;if(!l)throw new Error(`Message send transport failure: ${it(d.error)}`);a=new Response(JSON.stringify(d.error),{status:l})}else a=new Response(JSON.stringify(d.data??!0),{status:200})}catch(d){throw bn(t.providerID),d}if(a.ok)return Yc(t.providerID),o;let s="";try{s=await a.text()}catch{}const i=s&&s.trim().length>0?`: ${s.trim()}`:"",c=new Error(`Failed to send message (${a.status})${i}`);throw c.status=a.status,bn(t.providerID,a.status),c}async sendCommand(t){const o=t.messageId??Cn("msg"),r=[];if(t.files&&t.files.length>0)for(const s of t.files)r.push(await this.toNormalizedFilePartInput(s));const n=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory,a=await this.client.session.command({sessionID:t.id,...n?{directory:n}:{},command:t.command,arguments:t.arguments??"",model:`${t.providerID}/${t.modelID}`,agent:t.agent,variant:t.variant,...r.length>0?{parts:r}:{},messageID:o});return tt(a,"session.command"),o}async abortSession(t){return!!(await this.client.session.abort({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}},{throwOnError:!0})).data}async shellSession(t){const o=this.normalizeCandidatePath(t.directory??null)??this.currentDirectory,r=await this.client.session.shell({sessionID:t.sessionId,...o?{directory:o}:{},messageID:t.messageId,agent:t.agent,model:t.model,command:t.command});return te(r,"session.shell")}async revertSession(t,o,r,n){const a=this.normalizeCandidatePath(n)??this.currentDirectory,s=await this.client.session.revert({sessionID:t,...a?{directory:a}:{},messageID:o,partID:r});return te(s,"session.revert")}async summarizeSession(t,o,r,n){const a=this.normalizeCandidatePath(n)??this.currentDirectory,s=await this.client.session.summarize({sessionID:t,...a?{directory:a}:{},providerID:o,modelID:r});return tt(s,"session.summarize")===!0}async unrevertSession(t){const o=await this.client.session.unrevert({sessionID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return te(o,"session.unrevert")}async forkSession(t,o,r){const n=this.normalizeCandidatePath(r)??this.currentDirectory,a=await this.client.session.fork({sessionID:t,...n?{directory:n}:{},messageID:o});return te(a,"session.fork")}async getSessionStatus(){return await this.getSessionStatusForDirectory(this.currentDirectory??null)??{}}async getSessionStatusForDirectory(t){try{const o=typeof t=="string"?t.trim():"",r=await this.client.session.status(o?{directory:o}:void 0);return r.error||!r.data||typeof r.data!="object"?null:r.data}catch{return null}}async getGlobalSessionStatus(){return await this.getSessionStatusForDirectory(null)??{}}async getWebServerSessionActivity(){try{const t=await f("/api/session-activity",{method:"GET",headers:{Accept:"application/json"}});if(!t.ok)return null;const o=await t.json().catch(()=>null);return!o||typeof o!="object"?null:o}catch{return null}}async listToolIds(t){try{const o=typeof t?.directory=="string"?t.directory.trim():this.currentDirectory?this.currentDirectory.trim():"";return((await this.client.tool.ids(o?{directory:o}:void 0)).data||[]).filter(a=>typeof a=="string"&&a!=="invalid")}catch{return[]}}async replyToPermission(t,o,r){const n=this.normalizeCandidatePath(r?.directory??null)??this.currentDirectory,a=await this.client.permission.reply({requestID:t,...n?{directory:n}:{},reply:o,...r?.message?{message:r.message}:{}});return tt(a,"permission.reply")===!0}async createPermission(t,o,r,n){try{const a=await this.client.v2.session.permission.create({sessionID:t,action:o,resources:r,...n?.id?{id:n.id}:{},...n?.save?{save:n.save}:{},...n?.metadata?{metadata:n.metadata}:{},...n?.source?{source:n.source}:{},...n?.agent?{agent:n.agent}:{}});if(a.error!==void 0)return null;const s=a.data?.data;return s===void 0?null:{id:s.id,effect:s.effect}}catch{return null}}async fetchPermission(t,o){try{const r=await this.client.v2.session.permission.get({sessionID:t,requestID:o});if(r.error===void 0){const n=r.data?.data;if(n!==void 0)return{state:"ok",permission:n}}return r.response?.status===404?{state:"resolved"}:{state:"unknown"}}catch{return{state:"unknown"}}}async listPendingPermissions(t){const o=[],r=async c=>{const d=typeof c=="string"?c.trim():"",l=await this.client.permission.list(d?{directory:d}:void 0);if(l.error)throw new Error(`permission.list failed: ${it(l.error)}`);return l.data||[]};o.push(r(null));const n=new Set;for(const c of t?.directories??[]){const d=this.normalizeCandidatePath(c??null);d&&n.add(d)}for(const c of n)o.push(r(c));const a=await Promise.all(o),s=[],i=new Set;for(const c of a)for(const d of c){if(!d||typeof d!="object")continue;const l=d.id;typeof l!="string"||l.length===0||i.has(l)||(i.add(l),s.push(d))}return s}async replyToQuestion(t,o,r){const n=!Array.isArray(o)||o.length===0?[]:Array.isArray(o[0])?o:[o],a=this.normalizeCandidatePath(r)??this.currentDirectory,s=await this.client.question.reply({requestID:t,...a?{directory:a}:{},answers:n});return tt(s,"question.reply")===!0}async rejectQuestion(t){const o=await this.client.question.reject({requestID:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return tt(o,"question.reject")===!0}async listPendingQuestions(t){const o=[],r=async c=>{const d=typeof c=="string"?c.trim():"",l=await this.client.question.list(d?{directory:d}:void 0);if(l.error)throw new Error(`question.list failed: ${it(l.error)}`);return l.data||[]};o.push(r(null));const n=new Set;for(const c of t?.directories??[]){const d=this.normalizeCandidatePath(c??null);d&&n.add(d)}for(const c of n)o.push(r(c));const a=await Promise.all(o),s=[],i=new Set;for(const c of a)for(const d of c){if(!d||typeof d!="object")continue;const l=d.id;typeof l!="string"||l.length===0||i.has(l)||(i.add(l),s.push(d))}return s}clearConfigCache(){this.configCacheGeneration+=1,this.configInFlight.clear(),this.configCache.clear()}async getConfig(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.configCache.get(r);if(n&&n.expiresAt>Date.now())return fe("opencodeClient.getConfig:cacheHit",{directory:o??null}),n.config;const a=this.configInFlight.get(r);if(a)return fe("opencodeClient.getConfig:deduped",{directory:o??null}),a;const s=this.configCacheGeneration,i=(async()=>{fe("opencodeClient.getConfig:start",{directory:o??null});const c=typeof performance<"u"?performance.now():Date.now(),l=await(o?this.getScopedApiClient(o):this.client).config.get();if(!l.data)throw new Error("Failed to get config");const u=typeof performance<"u"?performance.now():Date.now();return fe("opencodeClient.getConfig:end",{directory:o??null,durationMs:Math.round(u-c)}),s===this.configCacheGeneration&&this.configCache.set(r,{config:l.data,expiresAt:Date.now()+ed}),l.data})();this.configInFlight.set(r,i);try{return await i}finally{this.configInFlight.get(r)===i&&this.configInFlight.delete(r)}}async updateConfig(t){const o=await this.client.config.update({config:t}),r=te(o,"global.config.update");return this.clearConfigCache(),r}async updateConfigPartial(t){const o=await this.getConfig(),r=t(o);return await this.updateConfig(r)}async getProviders(){return this.getProvidersForConfig(this.currentDirectory)}async getProvidersForConfig(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.configProvidersInFlight.get(r);if(n)return n;const a=(async()=>{const s=await this.client.config.providers(o?{directory:o}:void 0);return te(s,"config.providers")})();this.configProvidersInFlight.set(r,a);try{return await a}finally{this.configProvidersInFlight.delete(r)}}async getApp(){return{version:"0.0.3",config:await this.getConfig()}}async initApp(){try{return await this.checkHealth()}catch{return!1}}async listAgents(t){const o=this.normalizeCandidatePath(t)??t??this.currentDirectory??void 0,r=o??"",n=this.listAgentsInFlight.get(r);if(n)return n;const a=(async()=>{const s=o?{directory:o}:void 0,i=await this.client.app.agents(s);if(!i.error&&Array.isArray(i.data)&&i.data.length>0)return i.data;const c=await f("/api/agent",{...o?{query:{directory:o}}:{}});if(!c.ok)throw i.error?new Error(`app.agents failed${i.response?.status?` (${i.response.status})`:""}: ${it(i.error)}`):new Error(`agent.list failed (${c.status})`);const d=await c.json().catch(()=>null);if(!Array.isArray(d))throw new Error("agent.list failed: invalid response");return d})();this.listAgentsInFlight.set(r,a);try{return await a}finally{this.listAgentsInFlight.delete(r)}}async readFile(t){try{const o=await this.client.file.read({path:t,...this.currentDirectory?{directory:this.currentDirectory}:{}});return String(te(o,"file.read"))}catch{return`// Content of ${t}
|
|
2
|
+
// This would be loaded from the server`}}async listFiles(t){try{const o=t||this.currentDirectory||"/",r=await this.client.file.list({path:o,...this.currentDirectory?{directory:this.currentDirectory}:{}}),n=te(r,"file.list");return Array.isArray(n)?n:[]}catch{return[]}}async listCommands(){const t=await this.client.command.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);return(te(t,"command.list")||[]).map(r=>({name:r.name,description:r.description,agent:r.agent,model:r.model,source:r.source}))}async listCommandsWithDetails(t){const o=this.normalizeCandidatePath(t??null)??this.currentDirectory,r=await this.client.command.list(o?{directory:o}:void 0);return(te(r,"command.list")||[]).map(a=>({name:a.name,description:a.description,agent:a.agent,model:a.model,source:a.source,template:a.template}))}async listSkillsWithDetails(){try{const o=(await this.client.app.skills(this.currentDirectory?{directory:this.currentDirectory}:void 0)).data;if(!Array.isArray(o))return[];const r=[];for(const n of o){const a=typeof n.name=="string"?n.name.trim():"",s=typeof n.location=="string"?n.location:"";if(!a||!s)continue;const i={name:a,location:s};typeof n.description=="string"&&(i.description=n.description),typeof n.content=="string"&&(i.content=n.content),r.push(i)}return r}catch{return[]}}async getCommandDetails(t){try{const o=await this.client.command.list(this.currentDirectory?{directory:this.currentDirectory}:void 0);if(o.data){const r=o.data.find(n=>n.name===t);if(r)return{name:r.name,template:r.template,description:r.description,agent:r.agent,model:r.model}}return null}catch{return null}}async checkHealth(){try{const t=this.baseUrl.endsWith("/")?this.baseUrl.replace(/\/+$/,""):this.baseUrl,o=t==="/api"||t.endsWith("/api")?"/api/opencode/health":`${t}/opencode/health`;fe("opencodeClient.checkHealth:url",{baseUrl:this.baseUrl,healthUrl:o});const r=ad(td),n=await f(o,{signal:r.signal}).finally(r.cleanup);if(fe("opencodeClient.checkHealth:response",{status:n.status}),!n.ok)return!1;const a=await n.json();return fe("opencodeClient.checkHealth:result",{healthy:a?.healthy}),a?.healthy===!0}catch{return!1}}async createDirectory(t,o){const r=vn();if(r?.createDirectory)try{return await r.createDirectory(t)}catch(i){const c=i instanceof Error?i.message:String(i);throw new Error(c||"Failed to create directory")}const n={path:t,...o?.allowOutsideWorkspace?{allowOutsideWorkspace:!0}:{}},a=await f(`${this.baseUrl}/fs/mkdir`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!a.ok){const i=await a.json().catch(()=>({error:"Failed to create directory"}));throw new Error(i.error||"Failed to create directory")}return await a.json()}async cloneRepository(t){const o=await f(`${this.baseUrl}/fs/clone`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:"Failed to clone repository"}));throw new Error(r.error||"Failed to clone repository")}return await o.json()}async listLocalDirectory(t,o){const n=`${typeof t=="string"?ot(t.trim()):""}|${o?.respectGitignore?"1":"0"}`,a=Date.now(),s=this.listDirectoryCache.get(n);if(s&&s.expiresAt>a)return s.entries;const i=this.listDirectoryInFlight.get(n);if(i)return i;const d=(async()=>{const l=vn();if(l)try{const u=await l.listDirectory(t||"",o);if(!u||!Array.isArray(u.entries))return[];const m=u.entries.map(g=>({name:g.name,path:ot(g.path),isDirectory:!!g.isDirectory,isFile:!g.isDirectory,isSymbolicLink:!1}));return this.listDirectoryCache.set(n,{entries:m,expiresAt:Date.now()+kn}),m}catch(u){throw console.error("Failed to list directory contents:",u),u}try{const u=new URLSearchParams;t&&t.trim().length>0&&u.set("path",t),o?.respectGitignore&&u.set("respectGitignore","true");const m=u.toString(),g=await f(`${this.baseUrl}/fs/list${m?`?${m}`:""}`);if(!g.ok){const h=await g.json().catch(()=>({})),w=typeof h.error=="string"?h.error:"Failed to list directory";throw new Error(w)}const p=await g.json();if(!p||!Array.isArray(p.entries))return[];const b=p.entries;return this.listDirectoryCache.set(n,{entries:b,expiresAt:Date.now()+kn}),b}catch(u){throw console.error("Failed to list directory contents:",u),u}})().finally(()=>{this.listDirectoryInFlight.get(n)===d&&this.listDirectoryInFlight.delete(n)});return this.listDirectoryInFlight.set(n,d),d}async searchFiles(t,o){const r=typeof o?.directory=="string"&&o.directory.trim().length>0?o.directory.trim():this.currentDirectory,n=r?ot(r):null,a=r?this.getScopedApiClient(r):this.client;try{const s=await a.find.files({query:t,limit:typeof o?.limit=="number"&&Number.isFinite(o.limit)?o.limit:void 0,dirs:o?.dirs===!1||o?.type==="file"?"false":"true",type:o?.type});return(Array.isArray(s?.data)?s.data:[]).map(c=>{const d=ot(c),l=d.split("/").filter(Boolean).pop()||d,u=ot(n?`${n}/${d}`:d);return{name:l,path:u,relativePath:d,extension:l.includes(".")?l.split(".").pop()?.toLowerCase():void 0}})}catch(s){throw console.error("Failed to search files:",s),s}}async getFilesystemHome(){const t=L();if(!t||t==="local"){const o=await Ua();if(o)return o}try{const o=await f(`${this.baseUrl}/fs/home`,{method:"GET",headers:{Accept:"application/json"}});if(!o.ok){const n=await o.json().catch(()=>({})),a=typeof n.error=="string"&&n.error.length>0?n.error:"Failed to resolve home directory";throw new Error(a)}const r=await o.json();return r&&typeof r.home=="string"&&r.home.length>0?r.home:null}catch(o){return console.warn("Failed to resolve filesystem home directory:",o),null}}async setOpenCodeWorkingDirectory(t){if(!t||typeof t!="string"||!t.trim())return console.warn("[OpencodeClient] setOpenCodeWorkingDirectory: invalid path",t),null;const o=`${this.baseUrl}/opencode/directory`;console.log("[OpencodeClient] POST",o,"with path:",t);try{const r=await f(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t})}),n=await r.json().catch(()=>null);if(!r.ok){const a=n??{},s=typeof a.error=="string"&&a.error.length>0?a.error:"Failed to update OpenCode working directory";throw new Error(s)}return n&&typeof n=="object"?n:{success:!0,restarted:!1,path:t}}catch(r){throw console.warn("Failed to update OpenCode working directory:",r),r}}}const Oe=new sd,id=e=>{const t=e.replace(/\\/g,"/").replace(/\/+$/g,"").trim();if(!t)return"";const o=new TextEncoder().encode(t);let r="";for(const a of o)r+=String.fromCharCode(a);return`path_${typeof btoa=="function"?btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,""):t.replace(/[^A-Za-z0-9._-]+/g,"_")}`};let $o=null,Go=null,qo=null;const Sn=new Set;let Mn=!1;const Ga=e=>{if(Sn.add(e),Mn||typeof window>"u")return;Mn=!0;const t=()=>{for(const o of Sn)o()};try{window.addEventListener("pagehide",t,{capture:!0}),window.addEventListener("beforeunload",t,{capture:!0}),typeof document<"u"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t()}),document.addEventListener("freeze",t))}catch{}},cd=(e,t)=>{let o;try{o=e()}catch{return}const r=new Map,n=new Set;let a;const s=()=>{if(a=void 0,r.size===0&&n.size===0)return;const c=Array.from(r.entries()),d=Array.from(n);r.clear(),n.clear();for(const[l,u]of c)try{o.setItem(l,JSON.stringify(u,t?.replacer))}catch(m){console.error("Failed to persist deferred storage value",m),!r.has(l)&&!n.has(l)&&r.set(l,u)}for(const l of d)try{o.removeItem(l)}catch(u){console.error("Failed to remove deferred storage value",u),r.has(l)||n.add(l)}},i=()=>{a===void 0&&(a=setTimeout(s,0))};return Ga(s),{getItem:c=>{if(r.has(c))return r.get(c)??null;if(n.has(c))return null;const d=u=>{if(u===null)return null;try{return JSON.parse(u,t?.reviver)}catch{try{o.removeItem(c)}catch{}return null}},l=o.getItem(c);return l instanceof Promise?l.then(d):d(l)},setItem:(c,d)=>{r.set(c,d),n.delete(c),i()},removeItem:c=>{r.delete(c),n.add(c),i()}}},Ur=e=>cd(()=>Va(),e),dd=e=>{const t=new Map,o=new Set;let r;const n=()=>{if(r=void 0,t.size===0&&o.size===0)return;const s=Array.from(t.entries()),i=Array.from(o);t.clear(),o.clear();for(const[c,d]of s)try{e.setItem(c,d)}catch(l){console.error("Failed to persist deferred storage value",l),!t.has(c)&&!o.has(c)&&t.set(c,d)}for(const c of i)try{e.removeItem(c)}catch(d){console.error("Failed to remove deferred storage value",d),t.has(c)||o.add(c)}},a=()=>{r===void 0&&(r=setTimeout(n,0))};return Ga(n),{getItem:s=>t.has(s)?t.get(s)??null:o.has(s)?null:e.getItem(s),setItem:(s,i)=>{t.set(s,i),o.delete(s),a()},removeItem:s=>{t.delete(s),o.add(s),a()},clear:()=>{t.clear(),o.clear(),r!==void 0&&(clearTimeout(r),r=void 0),e.clear()},key:s=>e.key(s),get length(){return e.length}}},qa=e=>{if(typeof window>"u")return null;try{return window[e]??null}catch{return null}},Lr=()=>{const e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,o)=>{e.set(t,o)},removeItem:t=>{e.delete(t)},clear:()=>{e.clear()},key:t=>Array.from(e.keys())[t]??null,get length(){return e.size}}},Wa=e=>{const t=Lr(),o=new Set,r=new Set,n=d=>{if(r.has(d))return null;if(o.has(d))return t.getItem(d);try{return e.getItem(d)}catch{return null}},a=(d,l)=>{try{e.setItem(d,l),t.removeItem(d),o.delete(d),r.delete(d);return}catch{try{e.removeItem(d)}catch{}}t.setItem(d,l),o.add(d),r.delete(d)},s=d=>{try{e.removeItem(d),r.delete(d)}catch{r.add(d)}t.removeItem(d),o.delete(d)},i=()=>{const d=[];try{for(let l=0;l<e.length;l+=1){const u=e.key(l);u&&d.push(u)}}catch{}try{e.clear(),r.clear()}catch{for(const l of d)r.add(l)}t.clear(),o.clear()},c=()=>{const d=new Set;try{for(let l=0;l<e.length;l+=1){const u=e.key(l);u&&!r.has(u)&&!o.has(u)&&d.add(u)}}catch{}for(const l of o)d.add(l);return[...d]};return{getItem:n,setItem:a,removeItem:s,clear:i,key:d=>c()[d]??null,get length(){return c().length}}},ld=()=>{const e=qa("localStorage");return e?Wa(e):Lr()},Va=()=>($o||($o=ld()),$o),Lt=()=>(qo||(qo=dd(Va())),qo),ud=()=>{const e=qa("sessionStorage");return e?Wa(e):Lr()},Ah=()=>(Go||(Go=ud()),Go),fd={markdown:"0.9375rem",code:"0.8125rem",uiHeader:"0.9375rem",uiLabel:"0.8750rem",meta:"0.875rem",micro:"0.875rem",settingsPageTitle:"1.125rem"},wh={markdown:"0.9063rem",code:"0.8750rem",uiHeader:"0.9063rem",uiLabel:"0.8438rem",meta:"0.8438rem",micro:"0.7813rem",settingsPageTitle:"1.0625rem"};function Tn(e){return`--text-${e.replace(/([A-Z])/g,"-$1").toLowerCase()}`}const Jt={semanticMarkdown:{fontSize:"var(--text-markdown)"},semanticCode:{fontSize:"var(--text-code)"},uiHeader:{fontSize:"var(--text-ui-header)"},uiLabel:{fontSize:"var(--text-ui-label)"},meta:{fontSize:"var(--text-meta)"},micro:{fontSize:"var(--text-micro)"},ui:{button:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-button-line-height)",letterSpacing:"var(--ui-button-letter-spacing)",fontWeight:"var(--ui-button-font-weight)"},buttonSmall:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-button-small-line-height)",letterSpacing:"var(--ui-button-small-letter-spacing)",fontWeight:"var(--ui-button-small-font-weight)"},buttonLarge:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-button-large-line-height)",letterSpacing:"var(--ui-button-large-letter-spacing)",fontWeight:"var(--ui-button-large-font-weight)"},label:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-label-line-height)",letterSpacing:"var(--ui-label-letter-spacing)",fontWeight:"var(--ui-label-font-weight)"},caption:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-caption-line-height)",letterSpacing:"var(--ui-caption-letter-spacing)",fontWeight:"var(--ui-caption-font-weight)"},badge:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-badge-line-height)",letterSpacing:"var(--ui-badge-letter-spacing)",fontWeight:"var(--ui-badge-font-weight)"},tooltip:{fontSize:"var(--text-micro)",lineHeight:"var(--ui-tooltip-line-height)",letterSpacing:"var(--ui-tooltip-letter-spacing)",fontWeight:"var(--ui-tooltip-font-weight)"},input:{fontSize:"var(--text-ui-label)",lineHeight:"var(--ui-input-line-height)",letterSpacing:"var(--ui-input-letter-spacing)",fontWeight:"var(--ui-input-font-weight)"},helperText:{fontSize:"var(--text-meta)",lineHeight:"var(--ui-helper-text-line-height)",letterSpacing:"var(--ui-helper-text-letter-spacing)",fontWeight:"var(--ui-helper-text-font-weight)"}},code:{inline:{fontSize:"var(--text-code)",lineHeight:"var(--code-inline-line-height)",letterSpacing:"var(--code-inline-letter-spacing)",fontWeight:"var(--code-inline-font-weight)"},block:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},lineNumbers:{fontSize:"var(--text-micro)",lineHeight:"var(--code-line-numbers-line-height)",letterSpacing:"var(--code-line-numbers-letter-spacing)",fontWeight:"var(--code-line-numbers-font-weight)"}},markdown:{body:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-body-line-height)",letterSpacing:"var(--markdown-body-letter-spacing)",fontWeight:"var(--markdown-body-font-weight)"},bodySmall:{fontSize:"var(--text-meta)",lineHeight:"var(--markdown-body-small-line-height)",letterSpacing:"var(--markdown-body-small-letter-spacing)",fontWeight:"var(--markdown-body-small-font-weight)"},bodyLarge:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-body-large-line-height)",letterSpacing:"var(--markdown-body-large-letter-spacing)",fontWeight:"var(--markdown-body-large-font-weight)"},blockquote:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-blockquote-line-height)",letterSpacing:"var(--markdown-blockquote-letter-spacing)",fontWeight:"var(--markdown-blockquote-font-weight)"},list:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-list-line-height)",letterSpacing:"var(--markdown-list-letter-spacing)",fontWeight:"var(--markdown-list-font-weight)"},link:{fontSize:"var(--text-markdown)",lineHeight:"var(--markdown-link-line-height)",letterSpacing:"var(--markdown-link-letter-spacing)",fontWeight:"var(--markdown-link-font-weight)"},code:{fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-line-height)",letterSpacing:"var(--markdown-code-letter-spacing)",fontWeight:"var(--markdown-code-font-weight)"},codeBlock:{fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-block-line-height)",letterSpacing:"var(--markdown-code-block-letter-spacing)",fontWeight:"var(--markdown-code-block-font-weight)"}},tool:{collapsed:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},popup:{fontSize:"var(--text-code)",lineHeight:"var(--code-block-line-height)",letterSpacing:"var(--code-block-letter-spacing)",fontWeight:"var(--code-block-font-weight)"},inline:{fontSize:"var(--text-code)",lineHeight:"var(--code-inline-line-height)",letterSpacing:"var(--code-inline-letter-spacing)",fontWeight:"var(--code-inline-font-weight)"}}},Wo={padding:{collapsed:"0.375rem",popup:"0.75rem",popupContainer:"1rem"},backgroundOpacity:{muted:"30",mutedAlt:"50"},getCollapsedStyles:()=>({...Jt.tool.collapsed,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.collapsed,borderRadius:0}),getPopupStyles:()=>({...Jt.tool.popup,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.popup,borderRadius:"0.75rem"}),getPopupContainerStyles:()=>({...Jt.tool.popup,background:"transparent",backgroundColor:"transparent",margin:0,padding:Wo.padding.popupContainer,borderRadius:"0.5rem",overflowX:"auto"}),getInlineStyles:()=>({...Jt.tool.inline})},md=[{id:"inter",label:"Inter",description:"Modern UI sans with excellent readability at small sizes.",stack:'"Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Inter",packageName:"@fontsource/inter",filePrefix:"inter",weights:[400,500,600]}},{id:"geist-sans",label:"Geist Sans",description:"Crisp sans-serif with a technical interface feel.",stack:'"Geist Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Geist Sans",packageName:"@fontsource/geist-sans",filePrefix:"geist-sans",weights:[400,500,600]}},{id:"atkinson-hyperlegible",label:"Atkinson Hyperlegible",description:"Accessibility-focused sans-serif optimized for character distinction.",stack:'"Atkinson Hyperlegible", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Atkinson Hyperlegible",packageName:"@fontsource/atkinson-hyperlegible",filePrefix:"atkinson-hyperlegible",weights:[400,700]}},{id:"source-sans-3",label:"Source Sans 3",description:"Adobe sans-serif tuned for clean, readable interfaces.",stack:'"Source Sans 3", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Source Sans 3",packageName:"@fontsource/source-sans-3",filePrefix:"source-sans-3",weights:[400,500,600]}},{id:"roboto",label:"Roboto",description:"Familiar Material-style sans-serif with broad UI usage.",stack:'"Roboto", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Roboto",packageName:"@fontsource/roboto",filePrefix:"roboto",weights:[400,500,600]}},{id:"noto-sans",label:"Noto Sans",description:"Readable sans-serif with strong international coverage.",stack:'"Noto Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Noto Sans",packageName:"@fontsource/noto-sans",filePrefix:"noto-sans",weights:[400,500,600]}},{id:"dm-sans",label:"DM Sans",description:"Modern product UI sans-serif with friendly proportions.",stack:'"DM Sans", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"DM Sans",packageName:"@fontsource/dm-sans",filePrefix:"dm-sans",weights:[400,500,600]}},{id:"manrope",label:"Manrope",description:"Polished geometric sans-serif for modern app interfaces.",stack:'"Manrope", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',source:{family:"Manrope",packageName:"@fontsource/manrope",filePrefix:"manrope",weights:[400,500,600]}},{id:"system",label:"System",description:"Native operating system interface font.",stack:'"SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif'}],gd=[{id:"jetbrains-mono",label:"JetBrains Mono",description:"Developer-focused monospace with strong punctuation clarity.",stack:'"JetBrains Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"JetBrains Mono",packageName:"@fontsource/jetbrains-mono",filePrefix:"jetbrains-mono",weights:[400,500,600]}},{id:"fira-code",label:"Fira Code",description:"Readable coding font with ligature support.",stack:'"Fira Code", "SFMono-Regular", "Menlo", monospace',source:{family:"Fira Code",packageName:"@fontsource/fira-code",filePrefix:"fira-code",weights:[400,500,600]}},{id:"geist-mono",label:"Geist Mono",description:"Sharp monospace pair for Geist Sans.",stack:'"Geist Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Geist Mono",packageName:"@fontsource/geist-mono",filePrefix:"geist-mono",weights:[400,500,600]}},{id:"commit-mono",label:"Commit Mono",description:"Code-oriented monospace with polished editor ergonomics.",stack:'"Commit Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Commit Mono",packageName:"@fontsource/commit-mono",filePrefix:"commit-mono",weights:[400,500,600]}},{id:"source-code-pro",label:"Source Code Pro",description:"Adobe monospace designed for source code readability.",stack:'"Source Code Pro", "SFMono-Regular", "Menlo", monospace',source:{family:"Source Code Pro",packageName:"@fontsource/source-code-pro",filePrefix:"source-code-pro",weights:[400,500,600]}},{id:"cascadia-code",label:"Cascadia Code",description:"Microsoft coding font popular in terminals and editors.",stack:'"Cascadia Code", "SFMono-Regular", "Menlo", monospace',source:{family:"Cascadia Code",packageName:"@fontsource/cascadia-code",filePrefix:"cascadia-code",weights:[400,500,600]}},{id:"roboto-mono",label:"Roboto Mono",description:"Neutral monospace companion to Roboto.",stack:'"Roboto Mono", "SFMono-Regular", "Menlo", monospace',source:{family:"Roboto Mono",packageName:"@fontsource/roboto-mono",filePrefix:"roboto-mono",weights:[400,500,600]}},{id:"iosevka",label:"Iosevka",description:"Compact monospace for dense code and terminal layouts.",stack:'"Iosevka", "SFMono-Regular", "Menlo", monospace',source:{family:"Iosevka",packageName:"@fontsource/iosevka",filePrefix:"iosevka",weights:[400,500,600]}},{id:"system-mono",label:"System Mono",description:"Native operating system monospace font.",stack:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'}],Ka=e=>Object.fromEntries(e.map(t=>[t.id,t])),pd=Ka(md),hd=Ka(gd),Fd="system",yd="system-mono",Ja=e=>typeof e=="string"&&e in pd,Ya=e=>typeof e=="string"&&e in hd,sr="openchamber.mobileKeyboardMode",bd='meta[name="viewport"]',Pn="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover",Eh=()=>!0;function ko(e,t="resize-content"){return e==="native"||e==="resize-content"?e:t}const Ad=e=>ko(e)==="resize-content"?`${Pn}, interactive-widget=resizes-content`:Pn,wd=()=>{if(typeof window>"u")return"resize-content";try{return ko(localStorage.getItem(sr))}catch{return"resize-content"}},Qa=e=>{const t=ko(e);if(typeof window<"u")try{t==="resize-content"?localStorage.removeItem(sr):localStorage.setItem(sr,t)}catch{}return t},Ch=e=>{const t=Qa(e);if(typeof document>"u")return t;document.documentElement.setAttribute("data-oc-mobile-keyboard-mode",t);const o=document.querySelector(bd);if(o instanceof HTMLMetaElement){const r=Ad(t);o.getAttribute("content")!==r&&o.setAttribute("content",r)}return t},Fe=20,Ed=8,Rn=4096,Cd=2160*60*6e4,I=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),o=t.startsWith("//");let r=t.replace(/\/+/g,"/");o&&!r.startsWith("//")&&(r=`/${r}`);const n=r==="/",a=/^[A-Za-z]:\/$/.test(r);return!n&&!a&&(r=r.replace(/\/+$/,"")),r},Te=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,Re=(e,t)=>{const o=I(t),r=I(e);if(!o||!r)return!1;const n=Te(o),a=Te(r);return a===n||a.startsWith(`${n}/`)},yt=e=>{if(!e||typeof e!="object")return{};const t=e,o={};for(const[r,n]of Object.entries(t)){const a=I(r);if(!a||!n||typeof n!="object")continue;const s=n,i=Array.isArray(s.openPaths)?Array.from(new Set(s.openPaths.filter(g=>typeof g=="string").map(g=>I(g)).filter(g=>g.length<=Rn&&Re(g,a)))).slice(-50):[],c=Array.isArray(s.expandedPaths)?Array.from(new Set(s.expandedPaths.filter(g=>typeof g=="string").map(g=>I(g)).filter(g=>g.length<=Rn&&Re(g,a)))).slice(-500):[],d=typeof s.selectedPath=="string"?I(s.selectedPath):null,l=d&&Re(d,a)?d:i[0]??null,u=typeof s.touchedAt=="number"&&Number.isFinite(s.touchedAt)?s.touchedAt:Date.now();if(Date.now()-u>Cd)continue;const m=o[a];if(m){const g=Array.from(new Set([...m.openPaths,...i])),p=Array.from(new Set([...m.expandedPaths,...c])),b=m.selectedPath??l??g[0]??null;o[a]={openPaths:g,selectedPath:b,expandedPaths:p,touchedAt:Math.max(m.touchedAt,u)};continue}o[a]={openPaths:i,selectedPath:l,expandedPaths:c,touchedAt:u}}return ye(o,Fe)},ye=(e,t)=>{const o=Object.entries(e);if(o.length<=t)return e;o.sort((n,a)=>(a[1]?.touchedAt??0)-(n[1]?.touchedAt??0));const r={};for(const[n,a]of o.slice(0,t))r[n]=a;return r},rt=e=>e?{...e,touchedAt:Date.now()}:{openPaths:[],selectedPath:null,expandedPaths:[],touchedAt:Date.now()},Bd=_t()(Nt(Dr((e,t)=>({byRoot:{},activeRuntimeKey:L(),runtimeSnapshots:{},resetForRuntimeSwitch:o=>{e(r=>{const n={...r.runtimeSnapshots,[r.activeRuntimeKey]:{byRoot:yt(r.byRoot),updatedAt:Date.now()}};return{activeRuntimeKey:o,runtimeSnapshots:n,byRoot:yt(n[o]?.byRoot)}})},addOpenPath:(o,r,n)=>{const a=I((o||"").trim()),s=I((r||"").trim());!a||!s||!n?.allowOutsideRoot&&!Re(s,a)||e(i=>{const c=i.byRoot[a],d=rt(c),l=d.openPaths.includes(s),u=l?d.openPaths:[...d.openPaths,s],m=d.selectedPath??s;if(c&&l&&c.selectedPath===m)return i;const g={...i.byRoot,[a]:{...d,openPaths:u,selectedPath:m}};return{byRoot:ye(g,Fe)}})},removeOpenPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=p=>Te(p)===c,l=i.selectedPath?d(i.selectedPath):!1;if(!i.openPaths.some(d)&&!l)return s;const u=i.openPaths.filter(p=>!d(p)),m=l?u[0]??null:i.selectedPath,g={...s.byRoot,[n]:{...i,openPaths:u,selectedPath:m,touchedAt:Date.now()}};return{byRoot:ye(g,Fe)}})},removeOpenPathsByPrefix:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=c.endsWith("/")?c:`${c}/`,l=p=>{const b=Te(p);return b===c||b.startsWith(d)},u=i.openPaths.filter(p=>!l(p));if(u.length===i.openPaths.length)return s;const m=i.selectedPath&&l(i.selectedPath)?u[0]??null:i.selectedPath,g={...s.byRoot,[n]:{...i,openPaths:u,selectedPath:m,touchedAt:Date.now()}};return{byRoot:ye(g,Fe)}})},removeExpandedPathsByPrefix:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||e(s=>{const i=s.byRoot[n];if(!i)return s;const c=Te(a),d=c.endsWith("/")?c:`${c}/`,l=i.expandedPaths.filter(m=>{const g=Te(m);return g!==c&&!g.startsWith(d)});if(l.length===i.expandedPaths.length)return s;const u={...s.byRoot,[n]:{...i,expandedPaths:l,touchedAt:Date.now()}};return{byRoot:ye(u,Fe)}})},setSelectedPath:(o,r,n)=>{const a=I((o||"").trim()),s=r?I(r.trim()):null;!a||s&&!n?.allowOutsideRoot&&!Re(s,a)||e(i=>{const c=i.byRoot[a],d=rt(c),l=s&&!d.openPaths.includes(s)?[...d.openPaths,s]:d.openPaths;if(c&&c.selectedPath===s&&l===c.openPaths)return i;const u={...i.byRoot,[a]:{...d,openPaths:l,selectedPath:s}};return{byRoot:ye(u,Fe)}})},ensureSelectedPath:o=>{const r=I((o||"").trim());if(!r)return;const n=t().byRoot[r];if(!n||n.selectedPath)return;const a=n.openPaths[0]??null;a&&t().setSelectedPath(r,a)},toggleExpandedPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||!Re(a,n)||e(s=>{const i=s.byRoot[n],c=rt(i),l=c.expandedPaths.includes(a)?c.expandedPaths.filter(m=>m!==a):[...c.expandedPaths,a];if(i&&i.expandedPaths===l&&i.selectedPath===c.selectedPath&&i.openPaths===c.openPaths)return s;const u={...s.byRoot,[n]:{...c,expandedPaths:l}};return{byRoot:ye(u,Fe)}})},collapseAllExpandedPaths:o=>{const r=I((o||"").trim());r&&e(n=>{const a=n.byRoot[r];if(!a||a.expandedPaths.length===0)return n;const s={...n.byRoot,[r]:{...rt(a),expandedPaths:[]}};return{byRoot:ye(s,Fe)}})},expandPath:(o,r)=>{const n=I((o||"").trim()),a=I((r||"").trim());!n||!a||!Re(a,n)||e(s=>{const i=s.byRoot[n],c=rt(i);if(c.expandedPaths.includes(a)&&i)return s;const l={...s.byRoot,[n]:{...c,expandedPaths:[...c.expandedPaths,a]}};return{byRoot:ye(l,Fe)}})},expandPaths:(o,r)=>{const n=I((o||"").trim());if(!n||!r||r.length===0)return;const a=r.map(s=>I((s||"").trim())).filter(s=>s&&Re(s,n));a.length!==0&&e(s=>{const i=s.byRoot[n],c=rt(i),d=new Set(c.expandedPaths),l=a.filter(m=>!d.has(m));if(l.length===0)return s;const u={...s.byRoot,[n]:{...c,expandedPaths:[...c.expandedPaths,...l]}};return{byRoot:ye(u,Fe)}})}}),{name:"files-view-tabs-store",version:3,storage:Ur(),migrate:(e,t)=>t<3||!e||typeof e!="object"?{byRoot:{},activeRuntimeKey:L(),runtimeSnapshots:{}}:e,partialize:e=>{const t={...e.runtimeSnapshots,[e.activeRuntimeKey]:{byRoot:yt(e.byRoot),updatedAt:Date.now()}},o=Object.fromEntries(Object.entries(t).sort(([,r],[,n])=>n.updatedAt-r.updatedAt).slice(0,Ed).map(([r,n])=>[r,{byRoot:yt(n.byRoot),updatedAt:n.updatedAt}]));return{activeRuntimeKey:e.activeRuntimeKey,runtimeSnapshots:o}},merge:(e,t)=>{const o=e&&typeof e=="object"?e:{},r=o.runtimeSnapshots&&typeof o.runtimeSnapshots=="object"?o.runtimeSnapshots:{},n=L();return{...t,activeRuntimeKey:n,runtimeSnapshots:r,byRoot:yt(r[n]?.byRoot)}}}),{name:"files-view-tabs-store"}));function In(e){return e==="vim"?"vim":"default"}const Yt={completion:{title:"{agent_name} is ready",message:"{last_message}"},error:{title:"Tool error",message:"{last_message}"},question:{title:"{agent_name} needs input",message:"{last_message}"},subtask:{title:"Subtask complete",message:"{last_message}"}},Se={completion:{title:"",message:""},error:{title:"",message:""},question:{title:"",message:""},subtask:{title:"",message:""}},Qt=(e,t)=>e?e.title===t.title&&e.message===t.message:!1,Dd=e=>{if(!e||typeof e!="object")return!1;const t=e;return Qt(t.completion,Yt.completion)&&Qt(t.error,Yt.error)&&Qt(t.question,Yt.question)&&Qt(t.subtask,Yt.subtask)},kd=380,vd=380,Sd=1400,Xa=12,xn=120,bt=280,Vo=new Map,Ko=e=>(e??L()).trim()||"default",Bh=e=>$(e),$=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),o=t.startsWith("//");let r=t.replace(/\/+$/g,"");return r=r.replace(/\/+/g,"/"),o&&!r.startsWith("//")&&(r=`/${r}`),r===""?t.startsWith("/")?"/":"":r},Za=e=>Number.isFinite(e)?Math.min(Sd,Math.max(vd,Math.round(e))):kd,mo=e=>{if(typeof e!="string")return null;const t=e.trim();return t?t.replace(/\\/g,"/"):null},go=e=>{if(typeof e!="string")return null;const t=e.trim();return t?t.length>xn?t.slice(0,xn):t:null},Hr=e=>e==="working"||e==="staged"||e==="turn"?e:null,Md=(e,t)=>(e==="file"||e==="preview")&&t||e,es=(e,t,o)=>{if(e==="diff")return e;if(typeof o=="string"){const r=o.trim();if(r)return r}return Md(e,t)},ts=(e,t)=>t===e?e:`${e}:${t}`,os=e=>{const t=mo(e.targetPath),o=es(e.mode,t,e.dedupeKey);return{id:ts(e.mode,o),mode:e.mode,targetPath:t,dedupeKey:o,label:go(e.label),sessionTitleFallback:go(e.sessionTitleFallback),readOnly:e.readOnly===!0,stagedDiff:e.stagedDiff===!0,diffScope:Hr(e.diffScope)??(e.stagedDiff===!0?"staged":"working"),touchedAt:Date.now()}},rs=(e,t,o)=>{if(e.length<=t)return e;const n=[...e].sort((i,c)=>i.touchedAt-c.touchedAt).filter(i=>i.id!==o),a=e.length-t;if(a<=0||n.length===0)return e.slice(-t);const s=new Set(n.slice(0,a).map(i=>i.id));return e.filter(i=>!s.has(i.id))},ns=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r;if(n.mode!=="diff"&&n.mode!=="file"&&n.mode!=="context"&&n.mode!=="plan"&&n.mode!=="chat"&&n.mode!=="preview"&&n.mode!=="browser"&&n.mode!=="git"&&n.mode!=="pr"&&n.mode!=="notes"&&n.mode!=="terminal")continue;const a=mo(typeof n.targetPath=="string"?n.targetPath:null),s=es(n.mode,a,typeof n.dedupeKey=="string"?n.dedupeKey:null),i=ts(n.mode,s);!i||o.has(i)||(o.add(i),t.push({id:i,mode:n.mode,targetPath:a,dedupeKey:s,label:go(typeof n.label=="string"?n.label:null),sessionTitleFallback:go(typeof n.sessionTitleFallback=="string"?n.sessionTitleFallback:null),readOnly:n.readOnly===!0,stagedDiff:n.stagedDiff===!0,diffScope:Hr(n.diffScope)??(n.stagedDiff===!0?"staged":"working"),touchedAt:typeof n.touchedAt=="number"&&Number.isFinite(n.touchedAt)?n.touchedAt:Date.now()}))}return t},ut=(e,t)=>t&&e.some(o=>o.id===t)?t:e.length===0?null:e[e.length-1].id,He=e=>{if(e){const t=ns(e.tabs),o=ut(t,e.activeTabId);return{...e,tabs:t,activeTabId:o,touchedAt:Date.now()}}return{isOpen:!1,expanded:!1,tabs:[],activeTabId:null,widthByMode:{},touchedAt:Date.now()}},Td=(e,t)=>{const o=os(t),r=o.mode==="file"&&o.targetPath?e.tabs.filter(c=>!(c.mode==="file"&&!c.targetPath)):e.tabs,n=r.findIndex(c=>c.id===o.id),a=n===-1?[...r,o]:r.map((c,d)=>d===n?{...c,mode:o.mode,targetPath:o.targetPath||c.targetPath,dedupeKey:o.dedupeKey,label:o.label,sessionTitleFallback:o.sessionTitleFallback||c.sessionTitleFallback,stagedDiff:o.stagedDiff,diffScope:o.diffScope,readOnly:o.readOnly,touchedAt:Date.now()}:c),s=o.id,i=rs(a,Xa,s);return{...e,isOpen:!0,tabs:i,activeTabId:ut(i,s),touchedAt:Date.now()}},Pd=(e,t)=>{const o=e.tabs.find(s=>s.id===t)??null,r=e.tabs.filter(s=>s.id!==t);if(e.activeTabId!==t)return{...e,tabs:r,activeTabId:ut(r,e.activeTabId),isOpen:r.length>0?e.isOpen:!1,touchedAt:Date.now()};const n=o?r.filter(s=>s.mode===o.mode):[],a=n.length>0?n.reduce((s,i)=>i.touchedAt>=s.touchedAt?i:s):null;return{...e,tabs:r,activeTabId:a?.id??ut(r,null),isOpen:a?e.isOpen:!1,touchedAt:Date.now()}},Rd=(e,t,o)=>{if(t===o)return e;const r=e.tabs.findIndex(i=>i.id===t),n=e.tabs.findIndex(i=>i.id===o);if(r===-1||n===-1)return e;const a=[...e.tabs],[s]=a.splice(r,1);return s?(a.splice(n,0,s),{...e,tabs:a,touchedAt:Date.now()}):e},Id=(e,t,o)=>({...e,tabs:e.tabs.map(r=>r.id===t?{...r,targetPath:o}:r)}),Jo=e=>{if(!e||typeof e!="object")return{};const t=e,o={};for(const[r,n]of Object.entries(t)){const a=$(r);if(!a||!n||typeof n!="object")continue;const s=n;let i=ns(s.tabs),c=typeof s.activeTabId=="string"?s.activeTabId:null;i.length===0&&(s.mode==="diff"||s.mode==="file"||s.mode==="context"||s.mode==="plan"||s.mode==="chat")&&(i=[os({mode:s.mode,targetPath:typeof s.targetPath=="string"?s.targetPath:null,dedupeKey:typeof s.dedupeKey=="string"?s.dedupeKey:null,label:typeof s.label=="string"?s.label:null})],c=i[0]?.id??null);const d=ut(i,c),l=rs(i,Xa,d),u={};if(s.widthByMode&&typeof s.widthByMode=="object")for(const[m,g]of Object.entries(s.widthByMode))(m==="diff"||m==="file"||m==="context"||m==="plan"||m==="chat"||m==="preview"||m==="browser"||m==="git"||m==="pr"||m==="notes"||m==="terminal")&&typeof g=="number"&&Number.isFinite(g)&&(u[m]=Za(g));o[a]={isOpen:s.isOpen===!0,expanded:s.expanded===!0,tabs:l,activeTabId:ut(l,d),widthByMode:u,touchedAt:typeof s.touchedAt=="number"&&Number.isFinite(s.touchedAt)?s.touchedAt:Date.now()}}return o},je=(e,t)=>{const o=Object.entries(e);if(o.length<=t)return e;o.sort((n,a)=>(a[1]?.touchedAt??0)-(n[1]?.touchedAt??0));const r={};for(const[n,a]of o.slice(0,t))r[n]=a;return r},ie=_t()(Nt(Dr((e,t)=>({theme:"system",isMultiRunLauncherOpen:!1,multiRunLauncherPrefillPrompt:"",isSidebarOpen:!0,sidebarWidth:bt,hasManuallyResizedLeftSidebar:!1,contextPanelByDirectory:{},contextRailOrder:[],contextEditorTreeVisible:!0,contextEditorTreeWidth:240,notesPanelHeight:112,todoPanelHeight:259,isSessionSwitcherOpen:!1,isSessionDropdownOpen:!1,activeMainTab:"chat",mainTabGuard:null,sidebarOpenBeforeFullscreenTab:null,pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null,pendingDiagramFile:null,pendingFileNavigation:null,pendingFileFocusPath:null,isMobile:!1,isCommandPaletteOpen:!1,isHelpDialogOpen:!1,isAboutDialogOpen:!1,isOpenCodeStatusDialogOpen:!1,openCodeStatusText:"",isSessionCreateDialogOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null,isSettingsDialogOpen:!1,isNewWorktreeDialogOpen:!1,isModelSelectorOpen:!1,sidebarSection:"sessions",settingsPage:"home",settingsHasOpenedOnce:!1,settingsProjectsSelectedId:null,settingsRemoteInstancesSelectedId:null,eventStreamStatus:"idle",eventStreamHint:null,showReasoningTraces:!0,sessionRecapEnabled:!0,sessionSuggestionEnabled:!0,sessionGoalEnabled:!0,sessionGoalDefaultBudgetEnabled:!1,sessionGoalDefaultBudget:2e5,collapsibleThinkingBlocks:!0,chatRenderMode:"live",activityRenderMode:"summary",showDeletionDialog:!0,autoDeleteEnabled:!1,autoDeleteAfterDays:30,sessionRetentionAction:"archive",autoDeleteLastRunAt:null,messageLimit:200,fontSize:100,globalDraftStarters:null,terminalFontSize:14,terminalShell:"auto",terminalLoginShells:[],editorFontSize:13,uiFont:Fd,monoFont:yd,padding:100,cornerRadius:18,inputBarOffset:0,mobileKeyboardMode:wd(),favoriteModels:[],hiddenModels:[],providerOrder:[],collapsedModelProviders:[],recentModels:[],recentAgents:[],recentEfforts:{},diffLayoutPreference:"inline",diffFileLayout:{},diffWrapLines:!1,gitChangesViewMode:"flat",isTimelineDialogOpen:!1,isPromptNavigatorPanelOpen:!1,isImagePreviewOpen:!1,nativeNotificationsEnabled:!1,notificationMode:"hidden-only",notifyOnSubtasks:!0,dockBadgeEnabled:!0,notifyOnCompletion:!0,notifyOnError:!0,notifyOnQuestion:!0,notificationTemplates:{completion:{...Se.completion},error:{...Se.error},question:{...Se.question},subtask:{...Se.subtask}},summarizeLastMessage:!1,summaryThreshold:200,summaryLength:100,maxLastMessageLength:250,showTerminalQuickKeysOnDesktop:!1,persistChatDraft:!0,showOpenCodeUpdateNotifications:!0,agentControlToolEnabled:!0,inputSpellcheckEnabled:!1,wideChatLayoutEnabled:!1,codeBlockLineWrap:!0,showToolFileIcons:!0,showTurnChangedFiles:!1,showExpandedBashTools:!1,showExpandedEditTools:!1,timeFormatPreference:"auto",weekStartPreference:"auto",desktopWindowControlsPosition:"right",mermaidRenderingMode:"svg",userMessageRenderingMode:"markdown",collapsibleUserMessages:!0,stickyUserHeader:!1,promptNavigatorEnabled:!0,expandedEditorToolbar:!1,showSplitAssistantMessageActions:!1,allowPromptingSubagentSessions:!1,draftStartersVisible:!0,isMobileSessionStatusBarCollapsed:!1,mobileSessionPanelOpen:!1,mobileSessionFilterProjectId:null,isExpandedInput:!1,reportUsage:!0,shortcutOverrides:{},fileEditorKeymap:"default",setTheme:o=>{e({theme:o}),t().applyTheme()},toggleSidebar:()=>{e(o=>{const r=!o.isSidebarOpen;return r&&!o.hasManuallyResizedLeftSidebar?{isSidebarOpen:r,sidebarWidth:bt}:{isSidebarOpen:r}})},setSidebarOpen:o=>{e(r=>r.isSidebarOpen===o?o&&!r.hasManuallyResizedLeftSidebar&&r.sidebarWidth!==bt?{isSidebarOpen:o,sidebarWidth:bt}:r:o&&!r.hasManuallyResizedLeftSidebar?{isSidebarOpen:o,sidebarWidth:bt}:{isSidebarOpen:o})},setSidebarWidth:o=>{e({sidebarWidth:o,hasManuallyResizedLeftSidebar:!0})},setContextRailOrder:o=>{const r=Array.isArray(o)?o.filter((n,a)=>typeof n=="string"&&n.trim()!==""&&o.indexOf(n)===a):[];e({contextRailOrder:r})},toggleContextEditorTree:()=>{e(o=>({contextEditorTreeVisible:!o.contextEditorTreeVisible}))},setContextEditorTreeWidth:o=>{Number.isFinite(o)&&e({contextEditorTreeWidth:Math.min(480,Math.max(200,Math.round(o)))})},openContextSurface:(o,r)=>{const n=$((o||"").trim());if(!n)return;const a=t(),s=a.contextPanelByDirectory[n],i=s?.tabs??[],c=i.find(l=>l.id===s?.activeTabId)??null;if(s?.isOpen&&c?.mode===r){a.closeContextPanel(n);return}const d=i.filter(l=>l.mode===r);if(d.length>0){const l=d.reduce((u,m)=>m.touchedAt>=u.touchedAt?m:u);a.setActiveContextPanelTab(n,l.id);return}r==="preview"||r==="chat"||a.openContextPanelTab(n,{mode:r})},openContextPanelTab:(o,r)=>{const n=$((o||"").trim());n&&e(a=>{const s=a.contextPanelByDirectory[n],i=He(s),c={...a.contextPanelByDirectory,[n]:Td(i,r)};return{contextPanelByDirectory:je(c,20)}})},openContextDiff:(o,r,n=!1,a=null)=>{const s=$((o||"").trim()),i=(r||"").trim();if(!s||!i)return;const c=Hr(a)??(n?"staged":"working");t().openContextPanelTab(s,{mode:"diff",targetPath:i,stagedDiff:c==="staged",diffScope:c})},openContextFile:(o,r)=>{const n=$((o||"").trim()),a=mo(r);!n||!a||(t().openContextPanelTab(n,{mode:"file",targetPath:a}),t().setPendingFileFocusPath(a),t().setPendingFileNavigation(null))},openContextFileAtLine:(o,r,n,a)=>{const s=$((o||"").trim()),i=mo(r),c=Number.isFinite(n)?Math.max(1,Math.trunc(n)):1,d=Number.isFinite(a)?Math.max(1,Math.trunc(a)):1;!s||!i||(t().openContextPanelTab(s,{mode:"file",targetPath:i}),t().setPendingFileFocusPath(null),t().setPendingFileNavigation({path:i,line:c,column:d}))},openContextOverview:o=>{const r=$((o||"").trim());r&&t().openContextPanelTab(r,{mode:"context"})},openContextPlan:o=>{const r=$((o||"").trim());r&&t().openContextPanelTab(r,{mode:"plan"})},openContextPreview:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();if(!n||!a)return;let s=null;try{const i=new URL(a);(i.protocol==="http:"||i.protocol==="https:")&&(s=i.host||i.hostname||"Preview")}catch{}t().openContextPanelTab(n,{mode:"preview",targetPath:a,dedupeKey:a,label:s})},openContextBrowser:(o,r="")=>{const n=$((o||"").trim());if(!n)return;const a=typeof r=="string"&&r.trim().length>0?r.trim():"";t().openContextPanelTab(n,{mode:"browser",targetPath:a,dedupeKey:"desktop-browser",label:"Browser"})},setContextPanelTabTargetPath:(o,r,n)=>{const a=$((o||"").trim()),s=(r||"").trim();!a||!s||e(i=>{const c=i.contextPanelByDirectory[a];return c?{contextPanelByDirectory:{...i.contextPanelByDirectory,[a]:Id(c,s,n)}}:i})},setActiveContextPanelTab:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();!n||!a||e(s=>{const i=s.contextPanelByDirectory[n],c=He(i);if(!c.tabs.some(l=>l.id===a)||c.activeTabId===a&&c.isOpen)return s;const d={...s.contextPanelByDirectory,[n]:{...c,isOpen:!0,activeTabId:a,touchedAt:Date.now(),tabs:c.tabs.map(l=>l.id===a?{...l,touchedAt:Date.now()}:l)}};return{contextPanelByDirectory:je(d,20)}})},reorderContextPanelTabs:(o,r,n)=>{const a=$((o||"").trim()),s=(r||"").trim(),i=(n||"").trim();!a||!s||!i||e(c=>{const d=c.contextPanelByDirectory[a],l=He(d);if(!l.tabs.some(g=>g.id===s)||!l.tabs.some(g=>g.id===i))return c;const u=Rd(l,s,i);if(u.tabs===l.tabs)return c;const m={...c.contextPanelByDirectory,[a]:u};return{contextPanelByDirectory:je(m,20)}})},closeContextPanelTab:(o,r)=>{const n=$((o||"").trim()),a=(r||"").trim();if(!n||!a)return;const s=t().contextPanelByDirectory[n]?.tabs.find(i=>i.id===a);e(i=>{const c=i.contextPanelByDirectory[n],d=He(c);if(!d.tabs.some(u=>u.id===a))return i;const l={...i.contextPanelByDirectory,[n]:Pd(d,a)};return{contextPanelByDirectory:je(l,20)}}),s?.mode==="file"&&s.targetPath&&Bd.getState().removeOpenPath(n,s.targetPath)},closeContextPanel:o=>{const r=$((o||"").trim());r&&e(n=>{const a=n.contextPanelByDirectory[r];if(!a||!a.isOpen)return n;const s={...n.contextPanelByDirectory,[r]:{...He(a),isOpen:!1}};return{contextPanelByDirectory:je(s,20)}})},toggleContextPanelExpanded:o=>{const r=$((o||"").trim());r&&e(n=>{const a=n.contextPanelByDirectory[r],s=He(a),i={...n.contextPanelByDirectory,[r]:{...s,expanded:!s.expanded}};return{contextPanelByDirectory:je(i,20)}})},setContextPanelWidth:(o,r,n)=>{const a=$((o||"").trim());a&&e(s=>{const i=s.contextPanelByDirectory[a],c=He(i),d={...s.contextPanelByDirectory,[a]:{...c,widthByMode:{...c.widthByMode,[r]:Za(n)}}};return{contextPanelByDirectory:je(d,20)}})},setNotesPanelHeight:o=>{e({notesPanelHeight:o})},setTodoPanelHeight:o=>{e({todoPanelHeight:o})},setSessionSwitcherOpen:o=>{t().isSessionSwitcherOpen!==o&&e({isSessionSwitcherOpen:o})},setSessionDropdownOpen:o=>{t().isSessionDropdownOpen!==o&&e({isSessionDropdownOpen:o})},setMainTabGuard:o=>{t().mainTabGuard!==o&&e({mainTabGuard:o})},setActiveMainTab:o=>{const r=t().mainTabGuard;r&&!r(o)||(Vo.set(Ko(),o),e({activeMainTab:o}))},prepareForRuntimeSwitch:o=>{Vo.set(Ko(o),t().activeMainTab)},restoreForRuntimeSwitch:o=>{const r=Vo.get(Ko(o))??"chat";e({activeMainTab:r})},setPendingDiffFile:(o,r=!1,n=null)=>{e({pendingDiffFile:o,pendingDiffStaged:o?r:!1,pendingDiffScope:o?n:null})},setPendingDiagramFile:o=>{e({pendingDiagramFile:o})},setPendingFileNavigation:o=>{e({pendingFileNavigation:o})},setPendingFileFocusPath:o=>{e({pendingFileFocusPath:o})},navigateToDiff:(o,r=!1,n=null)=>{const a=t().mainTabGuard;a&&!a("diff")||e({pendingDiffFile:o,pendingDiffStaged:r,pendingDiffScope:n,activeMainTab:"diff"})},consumePendingDiffFile:()=>{const{pendingDiffFile:o}=t();return o&&e({pendingDiffFile:null,pendingDiffStaged:!1,pendingDiffScope:null}),o},navigateToDiagram:o=>{const r=t().mainTabGuard;r&&!r("diagram")||e({pendingDiagramFile:o,activeMainTab:"diagram"})},consumePendingDiagramFile:()=>{const{pendingDiagramFile:o}=t();return o&&e({pendingDiagramFile:null}),o},setIsMobile:o=>{e({isMobile:o})},toggleCommandPalette:()=>{e(o=>({isCommandPaletteOpen:!o.isCommandPaletteOpen}))},setCommandPaletteOpen:o=>{e({isCommandPaletteOpen:o})},toggleHelpDialog:()=>{e(o=>({isHelpDialogOpen:!o.isHelpDialogOpen}))},setHelpDialogOpen:o=>{e({isHelpDialogOpen:o})},setAboutDialogOpen:o=>{e({isAboutDialogOpen:o})},setOpenCodeStatusDialogOpen:o=>{e({isOpenCodeStatusDialogOpen:o})},setOpenCodeStatusText:o=>{e({openCodeStatusText:o})},setSessionCreateDialogOpen:o=>{e({isSessionCreateDialogOpen:o})},setScheduledTasksDialogOpen:o=>{e(o?{isScheduledTasksDialogOpen:!0,isArchivePageOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1}:{isScheduledTasksDialogOpen:!1})},setArchivePageOpen:o=>{e(o?{isArchivePageOpen:!0,isScheduledTasksDialogOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1}:{isArchivePageOpen:!1})},setWorktreesPageProjectId:o=>{e(o?{worktreesPageProjectId:o,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,isMultiRunLauncherOpen:!1}:{worktreesPageProjectId:null})},closeMainSurfaces:()=>{const o=t();!o.isScheduledTasksDialogOpen&&!o.isArchivePageOpen&&!o.worktreesPageProjectId&&!o.isMultiRunLauncherOpen||e({isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null,isMultiRunLauncherOpen:!1,multiRunLauncherPrefillPrompt:""})},setSettingsDialogOpen:o=>{e(r=>o?r.settingsHasOpenedOnce?{isSettingsDialogOpen:!0}:{isSettingsDialogOpen:!0,settingsHasOpenedOnce:!0}:{isSettingsDialogOpen:!1})},setNewWorktreeDialogOpen:o=>{e({isNewWorktreeDialogOpen:o})},setModelSelectorOpen:o=>{e({isModelSelectorOpen:o})},setSidebarSection:o=>{e({sidebarSection:o})},setSettingsPage:o=>{e({settingsPage:o})},setSettingsProjectsSelectedId:o=>{e({settingsProjectsSelectedId:o})},setSettingsRemoteInstancesSelectedId:o=>{e({settingsRemoteInstancesSelectedId:o})},setEventStreamStatus:(o,r)=>{e({eventStreamStatus:o,eventStreamHint:r??null})},setShowReasoningTraces:o=>{e({showReasoningTraces:o})},setSessionRecapEnabled:o=>{e({sessionRecapEnabled:o})},setSessionSuggestionEnabled:o=>{e({sessionSuggestionEnabled:o})},setSessionGoalEnabled:o=>{e({sessionGoalEnabled:o})},setSessionGoalDefaultBudgetEnabled:o=>{e({sessionGoalDefaultBudgetEnabled:o})},setSessionGoalDefaultBudget:o=>{e({sessionGoalDefaultBudget:o})},setCollapsibleThinkingBlocks:o=>{e({collapsibleThinkingBlocks:o})},setChatRenderMode:o=>{e({chatRenderMode:o})},setActivityRenderMode:o=>{e({activityRenderMode:o})},setShowDeletionDialog:o=>{e({showDeletionDialog:o})},setAutoDeleteEnabled:o=>{e({autoDeleteEnabled:o})},setAutoDeleteAfterDays:o=>{const r=Math.max(1,Math.min(365,o));e({autoDeleteAfterDays:r})},setSessionRetentionAction:o=>{e({sessionRetentionAction:o})},setAutoDeleteLastRunAt:o=>{e({autoDeleteLastRunAt:o})},setMessageLimit:o=>{const r=Math.max(10,Math.min(500,Math.round(o)));e({messageLimit:r})},setFontSize:o=>{const r=Math.max(50,Math.min(200,o));e({fontSize:r}),t().applyTypography()},setGlobalDraftStarters:o=>{e({globalDraftStarters:o})},setDraftStartersVisible:o=>{e({draftStartersVisible:o})},setTerminalFontSize:o=>{const r=Math.round(o),n=Math.max(9,Math.min(52,r));e({terminalFontSize:n})},setTerminalShell:o=>{e({terminalShell:o})},setTerminalLoginShells:o=>{e({terminalLoginShells:[...new Set(o)]})},setEditorFontSize:o=>{const r=Math.round(o),n=Math.max(9,Math.min(32,r));e({editorFontSize:n})},setUiFont:o=>{e({uiFont:o})},setMonoFont:o=>{e({monoFont:o})},setPadding:o=>{const r=Math.max(50,Math.min(200,o));e({padding:r}),t().applyPadding()},setCornerRadius:o=>{e({cornerRadius:o})},applyTypography:()=>{const{fontSize:o}=t(),r=document.documentElement,n=o/100,a=Object.entries(fd);if(n===1){for(const[s]of a)r.style.removeProperty(Tn(s));return}for(const[s,i]of a){const c=parseFloat(i);Number.isFinite(c)&&r.style.setProperty(Tn(s),`${c*n}rem`)}},applyPadding:()=>{const{padding:o}=t(),r=document.documentElement,n=o/100;if(n===1){r.style.removeProperty("--padding-scale"),r.style.removeProperty("--line-height-tight"),r.style.removeProperty("--line-height-normal"),r.style.removeProperty("--line-height-relaxed"),r.style.removeProperty("--line-height-loose");return}const a=Math.sqrt(n);r.style.setProperty("--padding-scale",a.toString());const s=1+(n-1)*.15;r.style.setProperty("--line-height-tight",(1.25*s).toFixed(3)),r.style.setProperty("--line-height-normal",(1.5*s).toFixed(3)),r.style.setProperty("--line-height-relaxed",(1.625*s).toFixed(3)),r.style.setProperty("--line-height-loose",(2*s).toFixed(3))},setDiffLayoutPreference:o=>{e({diffLayoutPreference:o})},setDiffFileLayout:(o,r)=>{e(n=>({diffFileLayout:{...n.diffFileLayout,[o]:r}}))},setDiffWrapLines:o=>{e({diffWrapLines:o})},setGitChangesViewMode:o=>{e({gitChangesViewMode:o})},setInputBarOffset:o=>{e({inputBarOffset:o})},setMobileKeyboardMode:o=>{e(r=>r.mobileKeyboardMode===o?r:{mobileKeyboardMode:o})},toggleFavoriteModel:(o,r)=>{e(n=>n.favoriteModels.some(s=>s.providerID===o&&s.modelID===r)?{favoriteModels:n.favoriteModels.filter(s=>!(s.providerID===o&&s.modelID===r))}:{favoriteModels:[{providerID:o,modelID:r},...n.favoriteModels]})},reorderFavoriteModel:(o,r,n,a)=>{e(s=>{const i=s.favoriteModels.findIndex(u=>u.providerID===o&&u.modelID===r),c=s.favoriteModels.findIndex(u=>u.providerID===n&&u.modelID===a);if(i===-1||c===-1||i===c)return s;const d=s.favoriteModels.slice(),[l]=d.splice(i,1);return l?(d.splice(c,0,l),{favoriteModels:d}):s})},setProviderOrder:o=>{e(r=>{const n=o.filter(s=>typeof s=="string"&&s.length>0),a=r.providerOrder;return a.length===n.length&&a.every((s,i)=>s===n[i])?r:{providerOrder:n}})},toggleHiddenModel:(o,r)=>{e(n=>n.hiddenModels.some(s=>s.providerID===o&&s.modelID===r)?{hiddenModels:n.hiddenModels.filter(s=>!(s.providerID===o&&s.modelID===r))}:{hiddenModels:[{providerID:o,modelID:r},...n.hiddenModels]})},isHiddenModel:(o,r)=>{const{hiddenModels:n}=t();return n.some(a=>a.providerID===o&&a.modelID===r)},hideAllModels:(o,r)=>{e(n=>{const a=n.hiddenModels.filter(i=>i.providerID!==o);return{hiddenModels:[...r.filter(i=>typeof i=="string"&&i.length>0).map(i=>({providerID:o,modelID:i})),...a]}})},showAllModels:o=>{e(r=>({hiddenModels:r.hiddenModels.filter(n=>n.providerID!==o)}))},toggleModelProviderCollapsed:o=>{const r=typeof o=="string"?o.trim():"";r&&e(n=>n.collapsedModelProviders.includes(r)?{collapsedModelProviders:n.collapsedModelProviders.filter(s=>s!==r)}:{collapsedModelProviders:[...n.collapsedModelProviders,r]})},setModelProvidersCollapsed:(o,r)=>{const n=Array.from(new Set(o.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean)));n.length!==0&&e(a=>{const s=new Set(n),i=a.collapsedModelProviders.filter(c=>!s.has(c));return{collapsedModelProviders:r?[...i,...n]:i}})},isFavoriteModel:(o,r)=>{const{favoriteModels:n}=t();return n.some(a=>a.providerID===o&&a.modelID===r)},addRecentModel:(o,r)=>{e(n=>{const a=n.recentModels.filter(s=>!(s.providerID===o&&s.modelID===r));return{recentModels:[{providerID:o,modelID:r},...a].slice(0,5)}})},addRecentAgent:o=>{const r=typeof o=="string"?o.trim():"";r&&e(n=>{if(n.recentAgents.includes(r))return n;const a=n.recentAgents;return{recentAgents:[r,...a].slice(0,5)}})},addRecentEffort:(o,r,n)=>{const a=typeof o=="string"?o.trim():"",s=typeof r=="string"?r.trim():"";if(!a||!s)return;const i=`${a}/${s}`,c=typeof n=="string"&&n.trim().length>0?n.trim():"default";e(d=>{const l=d.recentEfforts[i]??[];if(l.includes(c))return d;const u=l;return{recentEfforts:{...d.recentEfforts,[i]:[c,...u].slice(0,5)}}})},applyTheme:()=>{const{theme:o}=t(),r=document.documentElement;if(r.classList.remove("light","dark"),o==="system"){const n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.add(n)}else r.classList.add(o)},setMultiRunLauncherOpen:o=>{e(r=>({isMultiRunLauncherOpen:o,multiRunLauncherPrefillPrompt:o?r.multiRunLauncherPrefillPrompt:"",...o?{isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null}:{}}))},openMultiRunLauncher:()=>{e({isMultiRunLauncherOpen:!0,multiRunLauncherPrefillPrompt:"",isSessionSwitcherOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null})},openMultiRunLauncherWithPrompt:o=>{e({isMultiRunLauncherOpen:!0,multiRunLauncherPrefillPrompt:o,isSessionSwitcherOpen:!1,isScheduledTasksDialogOpen:!1,isArchivePageOpen:!1,worktreesPageProjectId:null})},setTimelineDialogOpen:o=>{e({isTimelineDialogOpen:o})},setPromptNavigatorPanelOpen:o=>{e({isPromptNavigatorPanelOpen:o})},togglePromptNavigatorPanel:()=>{e(o=>({isPromptNavigatorPanelOpen:!o.isPromptNavigatorPanelOpen}))},setImagePreviewOpen:o=>{e({isImagePreviewOpen:o})},setNativeNotificationsEnabled:o=>{e({nativeNotificationsEnabled:o})},setNotificationMode:o=>{e({notificationMode:o})},setShowTerminalQuickKeysOnDesktop:o=>{e({showTerminalQuickKeysOnDesktop:o})},setNotifyOnSubtasks:o=>{e({notifyOnSubtasks:o})},setDockBadgeEnabled:o=>{e({dockBadgeEnabled:o})},setNotifyOnCompletion:o=>{e({notifyOnCompletion:o})},setNotifyOnError:o=>{e({notifyOnError:o})},setNotifyOnQuestion:o=>{e({notifyOnQuestion:o})},setNotificationTemplates:o=>{e({notificationTemplates:o})},setSummarizeLastMessage:o=>{e({summarizeLastMessage:o})},setSummaryThreshold:o=>{e({summaryThreshold:o})},setSummaryLength:o=>{e({summaryLength:o})},setMaxLastMessageLength:o=>{e({maxLastMessageLength:o})},setPersistChatDraft:o=>{e({persistChatDraft:o})},setShowOpenCodeUpdateNotifications:o=>{e({showOpenCodeUpdateNotifications:o})},setAgentControlToolEnabled:o=>{e({agentControlToolEnabled:o})},setInputSpellcheckEnabled:o=>{e({inputSpellcheckEnabled:o})},setWideChatLayoutEnabled:o=>{e({wideChatLayoutEnabled:o})},setCodeBlockLineWrap:o=>{e({codeBlockLineWrap:o})},setShowToolFileIcons:o=>{e({showToolFileIcons:o})},setShowTurnChangedFiles:o=>{e({showTurnChangedFiles:o})},setShowExpandedBashTools:o=>{e({showExpandedBashTools:o})},setShowExpandedEditTools:o=>{e({showExpandedEditTools:o})},setTimeFormatPreference:o=>{e({timeFormatPreference:o})},setWeekStartPreference:o=>{e({weekStartPreference:o})},setDesktopWindowControlsPosition:o=>{e({desktopWindowControlsPosition:o==="left"?"left":"right"})},setMermaidRenderingMode:o=>{e({mermaidRenderingMode:o})},setUserMessageRenderingMode:o=>{e({userMessageRenderingMode:o})},setCollapsibleUserMessages:o=>{e({collapsibleUserMessages:o})},setStickyUserHeader:o=>{e({stickyUserHeader:o})},setPromptNavigatorEnabled:o=>{e({promptNavigatorEnabled:o})},setExpandedEditorToolbar:o=>{e({expandedEditorToolbar:o})},setShowSplitAssistantMessageActions:o=>{e({showSplitAssistantMessageActions:o})},setAllowPromptingSubagentSessions:o=>{e({allowPromptingSubagentSessions:o})},setIsMobileSessionStatusBarCollapsed:o=>{e({isMobileSessionStatusBarCollapsed:o})},setMobileSessionPanelOpen:o=>{e({mobileSessionPanelOpen:o})},setMobileSessionFilterProjectId:o=>{e({mobileSessionFilterProjectId:o})},setReportUsage:o=>{e({reportUsage:o})},viewPagerPage:"center",setViewPagerPage:o=>{e({viewPagerPage:o}),e({isSessionSwitcherOpen:o==="left"})},setShortcutOverride:(o,r)=>{e(n=>({shortcutOverrides:{...n.shortcutOverrides,[o]:r}}))},clearShortcutOverride:o=>{e(r=>{const n={...r.shortcutOverrides};return delete n[o],{shortcutOverrides:n}})},resetAllShortcutOverrides:()=>{e({shortcutOverrides:{}})},setFileEditorKeymap:o=>{e({fileEditorKeymap:In(o)})},toggleExpandedInput:()=>{e(o=>({isExpandedInput:!o.isExpandedInput}))},setExpandedInput:o=>{e({isExpandedInput:o})}}),{name:"ui-store",storage:Ur(),version:12,migrate:(e,t)=>{if(!e||typeof e!="object")return e;const o=e;if(t<12&&(o.desktopWindowControlsPosition==="auto"||o.desktopWindowControlsPosition==null)&&(o.desktopWindowControlsPosition="right"),t<11&&o.terminalFontSize===13&&(o.terminalFontSize=14),t<10&&delete o.diffViewMode,t<9&&((typeof o.notesPanelHeight!="number"||!Number.isFinite(o.notesPanelHeight))&&(o.notesPanelHeight=112),(typeof o.todoPanelHeight!="number"||!Number.isFinite(o.todoPanelHeight))&&(o.todoPanelHeight=259)),t<1&&Dd(o.notificationTemplates)&&(o.notificationTemplates={completion:{...Se.completion},error:{...Se.error},question:{...Se.question},subtask:{...Se.subtask}}),t<3){const r=new Set([90,120,180,220]),n=o.memoryLimitHistorical,a=o.memoryLimitActiveSession;typeof n=="number"&&!r.has(n)?o.messageLimit=n:typeof a=="number"&&!r.has(a)&&(o.messageLimit=a),delete o.memoryLimitHistorical,delete o.memoryLimitViewport,delete o.memoryLimitActiveSession}if(delete o.isRightSidebarOpen,delete o.rightSidebarWidth,delete o.rightSidebarTab,o.contextPanelByDirectory=Jo(o.contextPanelByDirectory),t<5)if(!o.shortcutOverrides||typeof o.shortcutOverrides!="object")o.shortcutOverrides={};else{const r=o.shortcutOverrides,n={};for(const[a,s]of Object.entries(r))typeof a=="string"&&typeof s=="string"&&(n[a]=s);o.shortcutOverrides=n}return t<6&&(o.contextPanelByDirectory=Jo(o.contextPanelByDirectory)),t<7&&(o.contextPanelByDirectory=Jo(o.contextPanelByDirectory)),t<8&&o.gitChangesViewMode!=="flat"&&o.gitChangesViewMode!=="tree"&&(o.gitChangesViewMode="flat"),o.fileEditorKeymap=In(o.fileEditorKeymap),o.contextRailOrder=Array.isArray(o.contextRailOrder)?o.contextRailOrder.filter(r=>typeof r=="string"&&r.trim()!==""):[],o},partialize:e=>({theme:e.theme,isSidebarOpen:e.isSidebarOpen,sidebarWidth:e.sidebarWidth,contextPanelByDirectory:e.contextPanelByDirectory,contextRailOrder:e.contextRailOrder,contextEditorTreeVisible:e.contextEditorTreeVisible,contextEditorTreeWidth:e.contextEditorTreeWidth,notesPanelHeight:e.notesPanelHeight,todoPanelHeight:e.todoPanelHeight,isSessionSwitcherOpen:e.isSessionSwitcherOpen,activeMainTab:e.activeMainTab,sidebarSection:e.sidebarSection,settingsPage:e.settingsPage,settingsHasOpenedOnce:e.settingsHasOpenedOnce,settingsProjectsSelectedId:e.settingsProjectsSelectedId,settingsRemoteInstancesSelectedId:e.settingsRemoteInstancesSelectedId,isSessionCreateDialogOpen:e.isSessionCreateDialogOpen,showReasoningTraces:e.showReasoningTraces,sessionRecapEnabled:e.sessionRecapEnabled,sessionSuggestionEnabled:e.sessionSuggestionEnabled,sessionGoalEnabled:e.sessionGoalEnabled,sessionGoalDefaultBudgetEnabled:e.sessionGoalDefaultBudgetEnabled,sessionGoalDefaultBudget:e.sessionGoalDefaultBudget,collapsibleThinkingBlocks:e.collapsibleThinkingBlocks,chatRenderMode:e.chatRenderMode,activityRenderMode:e.activityRenderMode,showDeletionDialog:e.showDeletionDialog,autoDeleteEnabled:e.autoDeleteEnabled,autoDeleteAfterDays:e.autoDeleteAfterDays,sessionRetentionAction:e.sessionRetentionAction,autoDeleteLastRunAt:e.autoDeleteLastRunAt,messageLimit:e.messageLimit,fontSize:e.fontSize,globalDraftStarters:e.globalDraftStarters,terminalFontSize:e.terminalFontSize,terminalShell:e.terminalShell,terminalLoginShells:e.terminalLoginShells,editorFontSize:e.editorFontSize,uiFont:e.uiFont,monoFont:e.monoFont,padding:e.padding,cornerRadius:e.cornerRadius,favoriteModels:e.favoriteModels,hiddenModels:e.hiddenModels,providerOrder:e.providerOrder,collapsedModelProviders:e.collapsedModelProviders,recentModels:e.recentModels,recentAgents:e.recentAgents,recentEfforts:e.recentEfforts,diffLayoutPreference:e.diffLayoutPreference,diffWrapLines:e.diffWrapLines,gitChangesViewMode:e.gitChangesViewMode,nativeNotificationsEnabled:e.nativeNotificationsEnabled,notificationMode:e.notificationMode,showTerminalQuickKeysOnDesktop:e.showTerminalQuickKeysOnDesktop,notifyOnSubtasks:e.notifyOnSubtasks,dockBadgeEnabled:e.dockBadgeEnabled,notifyOnCompletion:e.notifyOnCompletion,notifyOnError:e.notifyOnError,notifyOnQuestion:e.notifyOnQuestion,notificationTemplates:e.notificationTemplates,summarizeLastMessage:e.summarizeLastMessage,summaryThreshold:e.summaryThreshold,summaryLength:e.summaryLength,maxLastMessageLength:e.maxLastMessageLength,persistChatDraft:e.persistChatDraft,showOpenCodeUpdateNotifications:e.showOpenCodeUpdateNotifications,agentControlToolEnabled:e.agentControlToolEnabled,inputSpellcheckEnabled:e.inputSpellcheckEnabled,wideChatLayoutEnabled:e.wideChatLayoutEnabled,codeBlockLineWrap:e.codeBlockLineWrap,showToolFileIcons:e.showToolFileIcons,showTurnChangedFiles:e.showTurnChangedFiles,showExpandedBashTools:e.showExpandedBashTools,showExpandedEditTools:e.showExpandedEditTools,timeFormatPreference:e.timeFormatPreference,weekStartPreference:e.weekStartPreference,desktopWindowControlsPosition:e.desktopWindowControlsPosition,mermaidRenderingMode:e.mermaidRenderingMode,userMessageRenderingMode:e.userMessageRenderingMode,collapsibleUserMessages:e.collapsibleUserMessages,stickyUserHeader:e.stickyUserHeader,promptNavigatorEnabled:e.promptNavigatorEnabled,expandedEditorToolbar:e.expandedEditorToolbar,showSplitAssistantMessageActions:e.showSplitAssistantMessageActions,allowPromptingSubagentSessions:e.allowPromptingSubagentSessions,draftStartersVisible:e.draftStartersVisible,isMobileSessionStatusBarCollapsed:e.isMobileSessionStatusBarCollapsed,mobileSessionFilterProjectId:e.mobileSessionFilterProjectId,shortcutOverrides:e.shortcutOverrides,fileEditorKeymap:e.fileEditorKeymap})}),{name:"ui-store"})),xd=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const o=t.replace(/\\/g,"/").replace(/^([a-z]):/,(n,a)=>a.toUpperCase()+":");return o==="/"?"/":(o.length>1?o.replace(/\/+$/,""):o)||null},jr="queue",zr=e=>e==="steer"||e==="queue",$r=(e,t)=>e==="immediate"?"steer":zr(e)?e:t===!1?"steer":t===!0?"queue":jr,On=50,Od=(e,t,o=L())=>{const r=xd(t);return!o||!r||!e?null:{runtimeKey:o,directory:r,sessionId:e}},nt=e=>`${e.runtimeKey}
|
|
3
3
|
${e.directory}
|
|
4
4
|
${e.sessionId}`,Dh=e=>{const[t,o,...r]=e.split(`
|
|
5
5
|
`);return Od(r.join(`
|
|
6
|
-
`),o,t)},_d=(e,t)=>{const o=e??{},r=t<2?o.queuedMessages??{}:{};return{queuedMessages:t<2?{}:o.queuedMessages??{},quarantinedLegacyMessages:{...o.quarantinedLegacyMessages??{},...r},followUpBehavior:$r(o.followUpBehavior,o.queueModeEnabled??null)}},Nd=_t()(Nt(Dr((e,t)=>({queuedMessages:{},quarantinedLegacyMessages:{},followUpBehavior:jr,addToQueue:(o,r)=>{const n=nt(o),s={id:`queued-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,content:r.content,attachments:r.attachments,createdAt:Date.now(),sendConfig:r.sendConfig};e(i=>{const c=i.queuedMessages[n]??[],d={...i.queuedMessages,[n]:[...c,s].slice(-20)},l=Object.keys(d);if(l.length>On){l.sort((u,m)=>(d[u]?.[0]?.createdAt??0)-(d[m]?.[0]?.createdAt??0));for(const u of l.slice(0,l.length-On))delete d[u]}return{queuedMessages:d}})},removeFromQueue:(o,r)=>{const n=nt(o);e(a=>{const i=(a.queuedMessages[n]??[]).filter(c=>c.id!==r);if(i.length===0){const{[n]:c,...d}=a.queuedMessages;return{queuedMessages:d}}return{queuedMessages:{...a.queuedMessages,[n]:i}}})},reorderQueue:(o,r,n)=>{if(r===n)return;const a=nt(o);e(s=>{const i=s.queuedMessages[a];if(!i)return s;const c=i.findIndex(m=>m.id===r),d=i.findIndex(m=>m.id===n);if(c===-1||d===-1)return s;const l=i.slice(),[u]=l.splice(c,1);return l.splice(d,0,u),{queuedMessages:{...s.queuedMessages,[a]:l}}})},popToInput:(o,r)=>{const n=nt(o),i=(t().queuedMessages[n]??[]).find(c=>c.id===r);return i?(e(c=>{const l=(c.queuedMessages[n]??[]).filter(u=>u.id!==r);if(l.length===0){const{[n]:u,...m}=c.queuedMessages;return{queuedMessages:m}}return{queuedMessages:{...c.queuedMessages,[n]:l}}}),i):null},clearQueue:o=>{const r=nt(o);e(n=>{const{[r]:a,...s}=n.queuedMessages;return{queuedMessages:s}})},clearAllQueues:()=>{e({queuedMessages:{}})},setFollowUpBehavior:o=>{e({followUpBehavior:o}),be({followUpBehavior:o})},getQueueForTarget:o=>t().queuedMessages[nt(o)]??[]}),{name:"message-queue-store",version:2,storage:Ur(),partialize:e=>({queuedMessages:e.queuedMessages,quarantinedLegacyMessages:e.quarantinedLegacyMessages,followUpBehavior:e.followUpBehavior}),migrate:_d}),{name:"message-queue-store"})),ss="directoryTreeShowHidden",ir="directory-show-hidden-change",_n=()=>{if(typeof window>"u")return!0;try{const e=Lt().getItem(ss);return e===null?!0:e==="true"}catch{return!0}},Ud=()=>{typeof window>"u"||window.dispatchEvent(new Event(ir))},Ld=(e,t={})=>{if(!(typeof window>"u")){try{Lt().setItem(ss,e?"true":"false"),Ud()}catch{}t.persist!==!1&&be({directoryShowHidden:e})}},kh=()=>{const e=ta.c(2),[t,o]=ao.useState(_n);let r,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{if(typeof window>"u")return;const a=()=>{o(_n())};return window.addEventListener("storage",a),window.addEventListener(ir,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(ir,a)}},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),ao.useEffect(r,n),t},is="filesViewShowGitignored",cr="files-view-show-gitignored-change",Nn=()=>{if(typeof window>"u")return!1;try{return Lt().getItem(is)==="true"}catch{return!1}},Hd=()=>{typeof window>"u"||window.dispatchEvent(new Event(cr))},jd=(e,t={})=>{if(!(typeof window>"u")){try{Lt().setItem(is,e?"true":"false"),Hd()}catch{}t.persist!==!1&&be({filesViewShowGitignored:e})}},vh=()=>{const e=ta.c(2),[t,o]=ao.useState(Nn);let r,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{if(typeof window>"u")return;const a=()=>{o(Nn())};return window.addEventListener("storage",a),window.addEventListener(cr,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(cr,a)}},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),ao.useEffect(r,n),t},zd=e=>{if(!e||typeof e!="object")return null;const t={};return typeof e.showReasoningTraces=="boolean"&&(t.showReasoningTraces=e.showReasoningTraces),typeof e.collapsibleThinkingBlocks=="boolean"&&(t.collapsibleThinkingBlocks=e.collapsibleThinkingBlocks),Object.keys(t).length>0?t:null},$d=e=>{if(!e||typeof e!="object")return null;const t=e;return{showReasoningTraces:t.showReasoningTraces,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks}},Gd=e=>{const t=ie.getState();typeof e.showReasoningTraces=="boolean"&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.collapsibleThinkingBlocks=="boolean"&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks)},qd=async()=>{if(typeof window>"u")return null;const e=localStorage.getItem("appearance-preferences");if(!e)return null;try{const t=JSON.parse(e),o=$d(t);return zd(o)}catch(t){return console.warn("Failed to parse stored appearance preferences:",t),null}},cs=[{name:"explore",icon:"compass-3",labelKey:"chat.draftPresets.explore.label",command:"/explore"},{name:"catch-up",icon:"history",labelKey:"chat.draftPresets.catchup.label",command:"/catch-up"},{name:"weigh",icon:"scales-3",labelKey:"chat.draftPresets.weigh.label",command:"/weigh"},{name:"plan-feature",icon:"survey",labelKey:"chat.draftPresets.plan.label",command:"/plan-feature"},{name:"craft-goal",icon:"target",labelKey:"chat.draftPresets.craftGoal.label",command:"/craft-goal"},{name:"schedule-task",icon:"calendar-schedule",labelKey:"chat.draftPresets.scheduleTask.label",command:"/schedule-task"},{name:"debug",icon:"bug",labelKey:"chat.draftPresets.debug.label",command:"/debug"},{name:"review",icon:"search-eye",labelKey:"chat.draftPresets.review.label",command:"/workspace-review"}],Wd=new Map(cs.map(e=>[e.name,e])),Sh=e=>Wd.get(e),Mh=cs.map(e=>({type:"command",name:e.name})),Th="terminal-box",Ph="book-open",Rh=e=>`${e.type}:${e.name}`,Ih=(e,t)=>e.type===t.type&&e.name===t.name,xh=e=>{const t=e.replace(/^\//,"").replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e},ds=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r,a=n.type==="command"||n.type==="skill"?n.type:null,s=typeof n.name=="string"?n.name.trim():"";if(!a||!s)continue;const i=`${a}:${s}`;o.has(i)||(o.add(i),t.push({type:a,name:s}))}return t},Vd=["bash","zsh","sh","fish","pwsh","powershell","cmd","dash","ksh","nu"],po=e=>e==="auto"||typeof e=="string"&&Vd.includes(e),Kd="#8957e5",Jd="#8250df",Yd=e=>{const t=e.colors.syntax?.tokens??{},o=[t.className,t.enum,t.variableGlobal,e.colors.syntax?.base?.keyword].filter(r=>typeof r=="string"&&r.trim().length>0);return o.length>0?o[0]:e.metadata.variant==="dark"?Kd:Jd},Ht=e=>e.colors.pr?e:{...e,colors:{...e.colors,pr:{open:e.colors.status.success,draft:e.colors.surface.mutedForeground,blocked:e.colors.status.warning,merged:Yd(e),closed:e.colors.status.error}}},Qd={id:"aura-dark",name:"Aura",description:"Aura",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Xd={primary:{base:"#A277FF",hover:"#8D68DD",active:"#B08BFF",foreground:"#15141B",muted:"#A277FF80",emphasis:"#8D68DD"},surface:{background:"#15141B",foreground:"#EDECEE",muted:"#1A1921",mutedForeground:"#8a8282",elevated:"#201e2b",elevatedForeground:"#EDECEE",overlay:"#FFFFFF20",subtle:"#25232f"},interactive:{border:"#2D2B38",borderHover:"#47415a",borderFocus:"#4E496C",selection:"#95abe02d",selectionForeground:"#FFFFFF",focus:"#A277FF",focusRing:"#A277FF40",cursor:"#FFFFFF",hover:"#7887ac2d",active:"#95abe02d"},status:{error:"#FF6767",errorForeground:"#15141B",errorBackground:"#FF676720",errorBorder:"#FF676750",warning:"#FFCA85",warningForeground:"#15141B",warningBackground:"#FFCA8520",warningBorder:"#FFCA8550",success:"#61FFCA",successForeground:"#15141B",successBackground:"#61FFCA20",successBorder:"#61FFCA50",info:"#82E2FF",infoForeground:"#15141B",infoBackground:"#82E2FF20",infoBorder:"#82E2FF50"},pr:{open:"#61FFCA",draft:"#6D6D6D",blocked:"#FFCA85",merged:"#A277FF",closed:"#FF6767"},syntax:{base:{background:"#1A1921",foreground:"#EDECEE",comment:"#6D6D6D",keyword:"#A277FF",string:"#61FFCA",number:"#FF6767",function:"#A277FF",variable:"#EDECEE",type:"#FFCA85",operator:"#FF6767"},tokens:{boolean:"#FFCA85",class:"#A277FF",className:"#A277FF",commentDoc:"#606061",constant:"#82E2FF",decorator:"#FFCA85",enum:"#A277FF",exception:"#FF6767",functionCall:"#A277FF",interface:"#FFCA85",jsxTag:"#A277FF",key:"#A277FF",keywordImport:"#FF6767",label:"#FF6767",macro:"#82E2FF",method:"#61FFCA",module:"#FF6767",namespace:"#FFCA85",parameter:"#EDECEE",preprocessor:"#FF6767",punctuation:"#6D6D6D",regex:"#61FFCA",storageModifier:"#82E2FF",stringEscape:"#FFFFFF",struct:"#A277FF",tag:"#A277FF",tagAttribute:"#FFCA85",tagAttributeValue:"#61FFCA",typeParameter:"#FFCA85",url:"#A277FF",variableGlobal:"#A277FF",variableLocal:"#121118",variableOther:"#61FFCA",variableProperty:"#82E2FF"},highlights:{diffAdded:"#61FFCA",diffAddedBackground:"#162620",diffModified:"#82E2FF",diffModifiedBackground:"#1E1D2A",diffRemoved:"#FF6767",diffRemovedBackground:"#26161A",lineNumber:"#3E3A56",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#e7d7f4",heading2:"#e7e0ee",heading3:"#ece7f0",heading4:"#EDECEE",link:"#A277FF",linkHover:"#F694FF",inlineCode:"#61FFCA",inlineCodeBackground:"#1A1921",blockquote:"#6D6D6D",blockquoteBorder:"#2D2B38",listMarker:"#A277FF99"},chat:{userMessage:"#EDECEE",userMessageBackground:"#393647",assistantMessage:"#EDECEE",assistantMessageBackground:"#15141B",timestamp:"#6D6D6D",divider:"#2D2B38"},tools:{background:"#1A192180",border:"#43415480",headerHover:"#0F0E14",icon:"#6D6D6D",title:"#EDECEE",description:"#6D6D6D",edit:{added:"#61FFCA",addedBackground:"#61FFCA25",removed:"#FF6767",removedBackground:"#FF676725",lineNumber:"#3E3A56"}}},Zd={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},el={metadata:Qd,colors:Xd,config:Zd},tl={id:"aura-light",name:"Aura",description:"Aura",version:"1.0.0",variant:"light",tags:["light","palette"]},ol={primary:{base:"#A277FF",hover:"#B38FFF",active:"#8D68DD",foreground:"#F5F0FF",muted:"#A277FF80",emphasis:"#B38FFF"},surface:{background:"#F5F0FF",foreground:"#2D2640",muted:"#EFE8FC",mutedForeground:"#807b8b",elevated:"#f1ebfb",elevatedForeground:"#2D2640",overlay:"#15101F20",subtle:"#EFE8FC"},interactive:{border:"#E0D6F2",borderHover:"#D5C9EB",borderFocus:"#A593C8",selection:"#bdb2d74c",selectionForeground:"#15101F",focus:"#A277FF",focusRing:"#A277FF40",cursor:"#15101F",hover:"#bdb2d72d",active:"#bdb2d74c"},status:{error:"#D94F4F",errorForeground:"#F5F0FF",errorBackground:"#D94F4F20",errorBorder:"#D94F4F50",warning:"#D9A24A",warningForeground:"#F5F0FF",warningBackground:"#D9A24A20",warningBorder:"#D9A24A50",success:"#40BF7A",successForeground:"#F5F0FF",successBackground:"#40BF7A20",successBorder:"#40BF7A50",info:"#5BB8D9",infoForeground:"#F5F0FF",infoBackground:"#5BB8D920",infoBorder:"#5BB8D950"},pr:{open:"#40BF7A",draft:"#6D6D6D",blocked:"#D9A24A",merged:"#A277FF",closed:"#D94F4F"},syntax:{base:{background:"#EFE8FC",foreground:"#2D2640",comment:"#5C5270",keyword:"#A277FF",string:"#40BF7A",number:"#D94F4F",function:"#A277FF",variable:"#2D2640",type:"#D9A24A",operator:"#D94F4F"},tokens:{boolean:"#D9A24A",class:"#A277FF",className:"#A277FF",commentDoc:"#A9A1B8",constant:"#5BB8D9",decorator:"#D9A24A",enum:"#A277FF",exception:"#D94F4F",functionCall:"#A277FF",interface:"#D9A24A",jsxTag:"#A277FF",key:"#A277FF",keywordImport:"#D94F4F",label:"#D94F4F",macro:"#5BB8D9",method:"#40BF7A",module:"#D94F4F",namespace:"#D9A24A",parameter:"#2D2640",preprocessor:"#D94F4F",punctuation:"#5C5270",regex:"#40BF7A",storageModifier:"#5BB8D9",stringEscape:"#15101F",struct:"#A277FF",tag:"#A277FF",tagAttribute:"#D9A24A",tagAttributeValue:"#40BF7A",typeParameter:"#D9A24A",url:"#A277FF",variableGlobal:"#A277FF",variableLocal:"#FAF7FF",variableOther:"#40BF7A",variableProperty:"#5BB8D9"},highlights:{diffAdded:"#40BF7A",diffAddedBackground:"#E8F5ED",diffModified:"#5BB8D9",diffModifiedBackground:"#E8E4F5",diffRemoved:"#D94F4F",diffRemovedBackground:"#FAE8E8",lineNumber:"#C0B3DC",lineNumberActive:"#15101F"}},markdown:{heading1:"#A277FF",heading2:"#A277FF",heading3:"#D9A24A",heading4:"#2D2640",link:"#A277FF",linkHover:"#C17AC8",inlineCode:"#40BF7A",inlineCodeBackground:"#EFE8FC",blockquote:"#6D6D6D",blockquoteBorder:"#E0D6F2",listMarker:"#A277FF99"},chat:{userMessage:"#2D2640",userMessageBackground:"#EFE8FC",assistantMessage:"#2D2640",assistantMessageBackground:"#F5F0FF",timestamp:"#5C5270",divider:"#E0D6F2"},tools:{background:"#EFE8FC80",border:"#bdb5cd80",headerHover:"#FDFCFF",icon:"#5C5270",title:"#2D2640",description:"#5C5270",edit:{added:"#40BF7A",addedBackground:"#40BF7A25",removed:"#D94F4F",removedBackground:"#D94F4F25",lineNumber:"#C0B3DC"}}},rl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},nl={metadata:tl,colors:ol,config:rl},al={id:"ayu-dark",name:"Ayu",description:"Ayu",version:"1.0.0",variant:"dark",tags:["dark","palette"]},sl={primary:{base:"#3FB7E3",hover:"#389FC5",active:"#5BC1E7",foreground:"#0F1419",muted:"#3FB7E380",emphasis:"#389FC5"},surface:{background:"#0F1419",foreground:"#D6DAE0",muted:"#18222C",mutedForeground:"#777e86",elevated:"#17202a",elevatedForeground:"#D6DAE0",overlay:"#FBFBFD20",subtle:"#1e252d"},interactive:{border:"#2B3440",borderHover:"#323C49",borderFocus:"#56647C",selection:"#c7c7df1d",selectionForeground:"#FBFBFD",focus:"#3FB7E3",focusRing:"#3FB7E340",cursor:"#FBFBFD",hover:"#b6b6cc1d",active:"#b8b8ce1d"},status:{error:"#F58572",errorForeground:"#0F1419",errorBackground:"#F5857220",errorBorder:"#F5857250",warning:"#E4A75C",warningForeground:"#0F1419",warningBackground:"#E4A75C20",warningBorder:"#E4A75C50",success:"#78D05C",successForeground:"#0F1419",successBackground:"#78D05C20",successBorder:"#78D05C50",info:"#66C6F1",infoForeground:"#0F1419",infoBackground:"#66C6F120",infoBorder:"#66C6F150"},pr:{open:"#78D05C",draft:"#A3ADBA",blocked:"#E4A75C",merged:"#8a44f2",closed:"#F58572"},syntax:{base:{background:"#18222C",foreground:"#D6DAE0",comment:"#A3ADBA",keyword:"#3FB7E3",string:"#B1C74A",number:"#F2856F",function:"#3FB7E3",variable:"#D6DAE0",type:"#E4A75C",operator:"#F2856F"},tokens:{boolean:"#E4A75C",class:"#3FB7E3",className:"#3FB7E3",commentDoc:"#8D96A2",constant:"#66C6F1",decorator:"#E4A75C",enum:"#3FB7E3",exception:"#F2856F",functionCall:"#3FB7E3",interface:"#E4A75C",jsxTag:"#3FB7E3",key:"#3FB7E3",keywordImport:"#F2856F",label:"#F2856F",macro:"#66C6F1",method:"#78D05C",module:"#F2856F",namespace:"#E4A75C",parameter:"#D6DAE0",preprocessor:"#F2856F",punctuation:"#A3ADBA",regex:"#B1C74A",storageModifier:"#66C6F1",stringEscape:"#FBFBFD",struct:"#3FB7E3",tag:"#3FB7E3",tagAttribute:"#E4A75C",tagAttributeValue:"#B1C74A",typeParameter:"#E4A75C",url:"#66C6F1",variableGlobal:"#3FB7E3",variableLocal:"#0B1015",variableOther:"#78D05C",variableProperty:"#66C6F1"},highlights:{diffAdded:"#78D05C",diffAddedBackground:"#132F27",diffModified:"#66C6F1",diffModifiedBackground:"#1B2632",diffRemoved:"#F58572",diffRemovedBackground:"#361D20",lineNumber:"#415063",lineNumberActive:"#FBFBFD"}},markdown:{heading1:"#D6DAE0",heading2:"#D6DAE0",heading3:"#D6DAE0",heading4:"#D6DAE0",link:"#66C6F1",linkHover:"#3FB7E3",inlineCode:"#B1C74A",inlineCodeBackground:"#161d23",blockquote:"#E4A75C",blockquoteBorder:"#2B3440",listMarker:"#3FB7E399"},chat:{userMessage:"#D6DAE0",userMessageBackground:"#1d2935",assistantMessage:"#D6DAE0",assistantMessageBackground:"#0F1419",timestamp:"#A3ADBA",divider:"#2B3440"},tools:{background:"#18222C80",border:"#414e5f80",headerHover:"#080C10",icon:"#A3ADBA",title:"#D6DAE0",description:"#A3ADBA",edit:{added:"#78D05C",addedBackground:"#78D05C25",removed:"#F58572",removedBackground:"#F5857225",lineNumber:"#415063"}}},il={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},cl={metadata:al,colors:sl,config:il},dl={id:"ayu-light",name:"Ayu",description:"Ayu",version:"1.0.0",variant:"light",tags:["light","palette"]},ll={primary:{base:"#4AA8C8",hover:"#6EB8D1",active:"#4394B0",foreground:"#FDFAF4",muted:"#4AA8C880",emphasis:"#6EB8D1"},surface:{background:"#FDFAF4",foreground:"#394049",muted:"#f7f3eb",mutedForeground:"#777e87",elevated:"#faf6ed",elevatedForeground:"#4F5964",overlay:"#1B232B20",subtle:"#FFF7E5"},interactive:{border:"#E6DDCF",borderHover:"#DCD3C5",borderFocus:"#B09F8F",selection:"#9fb2c43e",selectionForeground:"#171e25",focus:"#4AA8C8",focusRing:"#4AA8C840",cursor:"#1B232B",hover:"#9fb2c42c",active:"#9fb2c43e"},status:{error:"#E6656A",errorForeground:"#FDFAF4",errorBackground:"#E6656A20",errorBorder:"#E6656A50",warning:"#EA9F41",warningForeground:"#FDFAF4",warningBackground:"#EA9F4120",warningBorder:"#EA9F4150",success:"#5FB978",successForeground:"#FDFAF4",successBackground:"#5FB97820",successBorder:"#5FB97850",info:"#2F9BCE",infoForeground:"#FDFAF4",infoBackground:"#2F9BCE20",infoBorder:"#2F9BCE50"},pr:{open:"#5FB978",draft:"#77818D",blocked:"#EA9F41",merged:"#7b3cda",closed:"#E6656A"},syntax:{base:{background:"#FCF9F3",foreground:"#4F5964",comment:"#77818D",keyword:"#4AA8C8",string:"#7FAD00",number:"#EF7D71",function:"#4AA8C8",variable:"#4F5964",type:"#ED982E",operator:"#EF7D71"},tokens:{boolean:"#ED982E",class:"#4AA8C8",className:"#4AA8C8",commentDoc:"#BABEC1",constant:"#2F9BCE",decorator:"#ED982E",enum:"#4AA8C8",exception:"#EF7D71",functionCall:"#4AA8C8",interface:"#ED982E",jsxTag:"#4AA8C8",key:"#4AA8C8",keywordImport:"#EF7D71",label:"#EF7D71",macro:"#2F9BCE",method:"#5FB978",module:"#EF7D71",namespace:"#ED982E",parameter:"#4F5964",preprocessor:"#EF7D71",punctuation:"#77818D",regex:"#7FAD00",storageModifier:"#2F9BCE",stringEscape:"#1B232B",struct:"#4AA8C8",tag:"#4AA8C8",tagAttribute:"#ED982E",tagAttributeValue:"#7FAD00",typeParameter:"#ED982E",url:"#2F9BCE",variableGlobal:"#4AA8C8",variableLocal:"#FBF8F2",variableOther:"#5FB978",variableProperty:"#2F9BCE"},highlights:{diffAdded:"#5FB978",diffAddedBackground:"#EEF5E4",diffModified:"#2F9BCE",diffModifiedBackground:"#E3EDF3",diffRemoved:"#E6656A",diffRemovedBackground:"#FDE5E5",lineNumber:"#C6BFAF",lineNumberActive:"#1B232B"}},markdown:{heading1:"#394049",heading2:"#394049",heading3:"#394049",heading4:"#394049",link:"#2F9BCE",linkHover:"#4AA8C8",inlineCode:"#7FAD00",inlineCodeBackground:"#FCF9F3",blockquote:"#ED982E",blockquoteBorder:"#E6DDCF",listMarker:"#4AA8C899"},chat:{userMessage:"#4F5964",userMessageBackground:"#fff7e5",assistantMessage:"#4F5964",assistantMessageBackground:"#FDFAF4",timestamp:"#77818D",divider:"#E6DDCF"},tools:{background:"#FCF9F380",border:"#cec6b980",headerHover:"#FAF7F1",icon:"#77818D",title:"#4F5964",description:"#77818D",edit:{added:"#5FB978",addedBackground:"#5FB97825",removed:"#E6656A",removedBackground:"#E6656A25",lineNumber:"#C6BFAF"}}},ul={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},fl={metadata:dl,colors:ll,config:ul},ml={id:"carbonfox-dark",name:"Carbonfox",description:"Carbonfox",version:"1.0.0",variant:"dark",tags:["dark","palette"]},gl={primary:{base:"#33B1FF",hover:"#2F9ADC",active:"#52BDFF",foreground:"#161616",muted:"#33B1FF80",emphasis:"#2F9ADC"},surface:{background:"#161616",foreground:"#F2F4F8",muted:"#222222",mutedForeground:"#8b8a8a",elevated:"#222222",elevatedForeground:"#F2F4F8",overlay:"#FFFFFF20",subtle:"#292828"},interactive:{border:"#393939",borderHover:"#4C4C4C",borderFocus:"#4589FF",selection:"#ffffff20",selectionForeground:"#FFFFFF",focus:"#4589FF",focusRing:"#4589FF40",cursor:"#FFFFFF",hover:"#ffffff12",active:"#ffffff12"},status:{error:"#FF8389",errorForeground:"#161616",errorBackground:"#FF838920",errorBorder:"#FF838950",warning:"#F1C21B",warningForeground:"#161616",warningBackground:"#F1C21B20",warningBorder:"#F1C21B50",success:"#42BE65",successForeground:"#161616",successBackground:"#42BE6520",successBorder:"#42BE6550",info:"#78A9FF",infoForeground:"#161616",infoBackground:"#78A9FF20",infoBorder:"#78A9FF50"},pr:{open:"#42BE65",draft:"#8D8D8D",blocked:"#F1C21B",merged:"#BE95FF",closed:"#FF8389"},syntax:{base:{background:"#262626",foreground:"#F2F4F8",comment:"#8D8D8D",keyword:"#78A9FF",string:"#42BE65",number:"#FF8389",function:"#78A9FF",variable:"#F2F4F8",type:"#08BDBA",operator:"#FF8389"},tokens:{boolean:"#08BDBA",class:"#78A9FF",className:"#78A9FF",commentDoc:"#7B7B7B",constant:"#BE95FF",decorator:"#08BDBA",enum:"#78A9FF",exception:"#FF8389",functionCall:"#78A9FF",interface:"#08BDBA",jsxTag:"#78A9FF",key:"#78A9FF",keywordImport:"#FF8389",label:"#FF8389",macro:"#78A9FF",method:"#42BE65",module:"#FF8389",namespace:"#08BDBA",parameter:"#F2F4F8",preprocessor:"#FF8389",punctuation:"#8D8D8D",regex:"#42BE65",storageModifier:"#78A9FF",stringEscape:"#FFFFFF",struct:"#78A9FF",tag:"#78A9FF",tagAttribute:"#08BDBA",tagAttributeValue:"#42BE65",typeParameter:"#08BDBA",url:"#33B1FF",variableGlobal:"#78A9FF",variableLocal:"#0D0D0D",variableOther:"#42BE65",variableProperty:"#BE95FF"},highlights:{diffAdded:"#42BE65",diffAddedBackground:"#0E3A22",diffModified:"#78A9FF",diffModifiedBackground:"#78A9FF20",diffRemoved:"#FF8389",diffRemovedBackground:"#4D1A1F",lineNumber:"#4C4C4C",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F2F4F8",heading2:"#F2F4F8",heading3:"#F2F4F8",heading4:"#F2F4F8",link:"#33B1FF",linkHover:"#78A9FF",inlineCode:"#42BE65",inlineCodeBackground:"#1e1e1e",blockquote:"#8D8D8D",blockquoteBorder:"#393939",listMarker:"#33B1FF99"},chat:{userMessage:"#F2F4F8",userMessageBackground:"#262626",assistantMessage:"#F2F4F8",assistantMessageBackground:"#161616",timestamp:"#8D8D8D",divider:"#393939"},tools:{background:"#26262680",border:"#4e4c4c80",headerHover:"#000000",icon:"#8D8D8D",title:"#F2F4F8",description:"#8D8D8D",edit:{added:"#42BE65",addedBackground:"#42BE6525",removed:"#FF8389",removedBackground:"#FF838925",lineNumber:"#4C4C4C"}}},pl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},hl={metadata:ml,colors:gl,config:pl},Fl={id:"carbonfox-light",name:"Carbonfox",description:"Carbonfox",version:"1.0.0",variant:"light",tags:["light","palette"]},yl={primary:{base:"#0072C3",hover:"#338ECF",active:"#0061A6",foreground:"#FFFFFF",muted:"#0072C380",emphasis:"#338ECF"},surface:{background:"#FFFFFF",foreground:"#161616",muted:"#F4F4F4",mutedForeground:"#868585",elevated:"#f4f4f7",elevatedForeground:"#161616",overlay:"#00000020",subtle:"#f2f2f8"},interactive:{border:"#DCDCDC",borderHover:"#D0D0D0",borderFocus:"#0F62FE",selection:"#cacfd87f",selectionForeground:"#000000",focus:"#0F62FE",focusRing:"#0F62FE40",cursor:"#000000",hover:"#43424214",active:"#43424212"},status:{error:"#DA1E28",errorForeground:"#FFFFFF",errorBackground:"#DA1E2820",errorBorder:"#DA1E2850",warning:"#F1C21B",warningForeground:"#FFFFFF",warningBackground:"#F1C21B20",warningBorder:"#F1C21B50",success:"#198038",successForeground:"#FFFFFF",successBackground:"#19803820",successBorder:"#19803850",info:"#0043CE",infoForeground:"#FFFFFF",infoBackground:"#0043CE20",infoBorder:"#0043CE50"},pr:{open:"#42BE65",draft:"#8D8D8D",blocked:"#F1C21B",merged:"#BE95FF",closed:"#FF8389"},syntax:{base:{background:"#F4F4F4",foreground:"#161616",comment:"#525252",keyword:"#0043CE",string:"#198038",number:"#DA1E28",function:"#0043CE",variable:"#161616",type:"#007D79",operator:"#DA1E28"},tokens:{boolean:"#007D79",class:"#0043CE",className:"#0043CE",commentDoc:"#A9A9A9",constant:"#6929C4",decorator:"#007D79",enum:"#0043CE",exception:"#DA1E28",functionCall:"#0043CE",interface:"#007D79",jsxTag:"#0043CE",key:"#0043CE",keywordImport:"#DA1E28",label:"#DA1E28",macro:"#0043CE",method:"#198038",module:"#DA1E28",namespace:"#007D79",parameter:"#161616",preprocessor:"#DA1E28",punctuation:"#525252",regex:"#198038",storageModifier:"#0043CE",stringEscape:"#000000",struct:"#0043CE",tag:"#0043CE",tagAttribute:"#007D79",tagAttributeValue:"#198038",typeParameter:"#007D79",url:"#0072C3",variableGlobal:"#0043CE",variableLocal:"#E8E8E8",variableOther:"#198038",variableProperty:"#6929C4"},highlights:{diffAdded:"#198038",diffAddedBackground:"#19803820",diffModified:"#0043CE",diffModifiedBackground:"#0043CE20",diffRemoved:"#DA1E28",diffRemovedBackground:"#DA1E2820",lineNumber:"#D0D0D0",lineNumberActive:"#000000"}},markdown:{heading1:"#161616",heading2:"#161616",heading3:"#161616",heading4:"#161616",link:"#0072C3",linkHover:"#0043CE",inlineCode:"#198038",inlineCodeBackground:"#F4F4F4",blockquote:"#525252",blockquoteBorder:"#DCDCDC",listMarker:"#0072C399"},chat:{userMessage:"#161616",userMessageBackground:"#f4f4f7",assistantMessage:"#161616",assistantMessageBackground:"#FFFFFF",timestamp:"#525252",divider:"#DCDCDC"},tools:{background:"#F4F4F480",border:"#bdbbbb80",headerHover:"#DCDCDC",icon:"#525252",title:"#161616",description:"#525252",edit:{added:"#198038",addedBackground:"#19803825",removed:"#DA1E28",removedBackground:"#DA1E2825",lineNumber:"#D0D0D0"}}},bl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Al={metadata:Fl,colors:yl,config:bl},wl={id:"catppuccin-dark",name:"Catppuccin",description:"Catppuccin",version:"1.0.0",variant:"dark",tags:["dark","palette"]},El={primary:{base:"#7d8fff",hover:"#9EA6DF",active:"#BEC6FE",foreground:"#1E1E2E",muted:"#B4BEFE80",emphasis:"#9EA6DF"},surface:{background:"#1E1E2E",foreground:"#CDD6F4",muted:"#2a273b",mutedForeground:"#969cb1",elevated:"#282841",elevatedForeground:"#CDD6F4",overlay:"#F4F2FF20",subtle:"#2f2f50"},interactive:{border:"#35324A",borderHover:"#393655",borderFocus:"#575379",selection:"#8883ae5c",selectionForeground:"#F4F2FF",focus:"#B4BEFE",focusRing:"#B4BEFE40",cursor:"#F4F2FF",hover:"#a19ace20",active:"#a19ace20"},status:{error:"#F38BA8",errorForeground:"#1E1E2E",errorBackground:"#F38BA820",errorBorder:"#F38BA850",warning:"#F4B8E4",warningForeground:"#1E1E2E",warningBackground:"#F4B8E420",warningBorder:"#F4B8E450",success:"#A6D189",successForeground:"#1E1E2E",successBackground:"#A6D18920",successBorder:"#A6D18950",info:"#89DCEB",infoForeground:"#1E1E2E",infoBackground:"#89DCEB20",infoBorder:"#89DCEB50"},pr:{open:"#A6D189",draft:"#A6ADC8",blocked:"#F9E2AF",merged:"#d8b4fe",closed:"#F38BA8"},syntax:{base:{background:"#211F31",foreground:"#CDD6F4",comment:"#A6ADC8",keyword:"#B4BEFE",string:"#A6E3A1",number:"#F38BA8",function:"#B4BEFE",variable:"#CDD6F4",type:"#F9E2AF",operator:"#F38BA8"},tokens:{boolean:"#F9E2AF",class:"#B4BEFE",className:"#B4BEFE",commentDoc:"#9298B1",constant:"#89DCEB",decorator:"#F9E2AF",enum:"#B4BEFE",exception:"#F38BA8",functionCall:"#B4BEFE",interface:"#F9E2AF",jsxTag:"#B4BEFE",key:"#B4BEFE",keywordImport:"#F38BA8",label:"#F38BA8",macro:"#89DCEB",method:"#A6D189",module:"#F38BA8",namespace:"#F9E2AF",parameter:"#CDD6F4",preprocessor:"#F38BA8",punctuation:"#A6ADC8",regex:"#A6E3A1",storageModifier:"#89DCEB",stringEscape:"#F4F2FF",struct:"#B4BEFE",tag:"#B4BEFE",tagAttribute:"#F9E2AF",tagAttributeValue:"#A6E3A1",typeParameter:"#F9E2AF",url:"#89DCEB",variableGlobal:"#B4BEFE",variableLocal:"#1C1C29",variableOther:"#A6D189",variableProperty:"#89DCEB"},highlights:{diffAdded:"#A6D189",diffAddedBackground:"#1D2C30",diffModified:"#89DCEB",diffModifiedBackground:"#232538",diffRemoved:"#F38BA8",diffRemovedBackground:"#2C1F2A",lineNumber:"#47436D",lineNumberActive:"#F4F2FF"}},markdown:{heading1:"#CDD6F4",heading2:"#CDD6F4",heading3:"#CDD6F4",heading4:"#CDD6F4",link:"#89DCEB",linkHover:"#B4BEFE",inlineCode:"#A6E3A1",inlineCodeBackground:"#2d2a42",blockquote:"#F9E2AF",blockquoteBorder:"#35324A",listMarker:"#B4BEFE99"},chat:{userMessage:"#CDD6F4",userMessageBackground:"#3a3a5b",assistantMessage:"#CDD6F4",assistantMessageBackground:"#1E1E2E",timestamp:"#A6ADC8",divider:"#35324A"},tools:{background:"#211F3180",border:"#534e7180",headerHover:"#191926",icon:"#A6ADC8",title:"#CDD6F4",description:"#A6ADC8",edit:{added:"#A6D189",addedBackground:"#A6D18925",removed:"#F38BA8",removedBackground:"#F38BA825",lineNumber:"#47436D"}}},Cl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Bl={metadata:wl,colors:El,config:Cl},Dl={id:"catppuccin-light",name:"Catppuccin",description:"Catppuccin",version:"1.0.0",variant:"light",tags:["light","palette"]},kl={primary:{base:"#7287FD",hover:"#8C99F6",active:"#6677DD",foreground:"#F5E0DC",muted:"#7287FD80",emphasis:"#8C99F6"},surface:{background:"#fff6f4",foreground:"#2e314a",muted:"#f8ebe9",mutedForeground:"#888992",elevated:"#fbefea",elevatedForeground:"#4C4F69",overlay:"#1F1F2A20",subtle:"#FDEEEE"},interactive:{border:"#E0CFD3",borderHover:"#D6C4C8",borderFocus:"#AB97A1",selection:"#ffffff",selectionForeground:"#1F1F2A",focus:"#7287FD",focusRing:"#7287FD40",cursor:"#1F1F2A",hover:"#ffffff8f",active:"#ffffff"},status:{error:"#D20F39",errorForeground:"#F5E0DC",errorBackground:"#D20F3920",errorBorder:"#D20F3950",warning:"#DF8E1D",warningForeground:"#F5E0DC",warningBackground:"#DF8E1D20",warningBorder:"#DF8E1D50",success:"#40A02B",successForeground:"#F5E0DC",successBackground:"#40A02B20",successBorder:"#40A02B50",info:"#04A5E5",infoForeground:"#F5E0DC",infoBackground:"#04A5E520",infoBorder:"#04A5E550"},pr:{open:"#40A02B",draft:"#6C6F85",blocked:"#DF8E1D",merged:"#9572fd",closed:"#D20F39"},syntax:{base:{background:"#F2D8D4",foreground:"#4C4F69",comment:"#6C6F85",keyword:"#7287FD",string:"#40A02B",number:"#D20F39",function:"#7287FD",variable:"#4C4F69",type:"#DF8E1D",operator:"#D20F39"},tokens:{boolean:"#DF8E1D",class:"#7287FD",className:"#7287FD",commentDoc:"#B1A8B1",constant:"#04A5E5",decorator:"#DF8E1D",enum:"#7287FD",exception:"#D20F39",functionCall:"#7287FD",interface:"#DF8E1D",jsxTag:"#7287FD",key:"#7287FD",keywordImport:"#D20F39",label:"#D20F39",macro:"#04A5E5",method:"#40A02B",module:"#D20F39",namespace:"#DF8E1D",parameter:"#4C4F69",preprocessor:"#D20F39",punctuation:"#6C6F85",regex:"#40A02B",storageModifier:"#04A5E5",stringEscape:"#1F1F2A",struct:"#7287FD",tag:"#7287FD",tagAttribute:"#DF8E1D",tagAttributeValue:"#40A02B",typeParameter:"#DF8E1D",url:"#04A5E5",variableGlobal:"#7287FD",variableLocal:"#F9E8E4",variableOther:"#40A02B",variableProperty:"#04A5E5"},highlights:{diffAdded:"#40A02B",diffAddedBackground:"#EDF5E6",diffModified:"#04A5E5",diffModifiedBackground:"#E4E2F6",diffRemoved:"#D20F39",diffRemovedBackground:"#FDE1E3",lineNumber:"#C2AEB4",lineNumberActive:"#1F1F2A"}},markdown:{heading1:"#2e314a",heading2:"#2e314a",heading3:"#2e314a",heading4:"#2e314a",link:"#04A5E5",linkHover:"#7287FD",inlineCode:"#40A02B",inlineCodeBackground:"#f6eeec",blockquote:"#DF8E1D",blockquoteBorder:"#E0CFD3",listMarker:"#7287FD99"},chat:{userMessage:"#2e314a",userMessageBackground:"#ffffff",assistantMessage:"#4C4F69",assistantMessageBackground:"#F5E0DC",timestamp:"#6C6F85",divider:"#E0CFD3"},tools:{background:"#F2D8D480",border:"#cbbec180",headerHover:"#FDEEEE",icon:"#6C6F85",title:"#4C4F69",description:"#6C6F85",edit:{added:"#40A02B",addedBackground:"#40A02B25",removed:"#D20F39",removedBackground:"#D20F3925",lineNumber:"#C2AEB4"}}},vl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Sl={metadata:Dl,colors:kl,config:vl},Ml={id:"dracula-dark",name:"Dracula",description:"Dracula",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Tl={primary:{base:"#BD93F9",hover:"#A480D8",active:"#C7A3FA",foreground:"#14151F",muted:"#BD93F980",emphasis:"#A480D8"},surface:{background:"#14151F",foreground:"#F8F8F2",muted:"#181926",mutedForeground:"#7c7e9c",elevated:"#161722",elevatedForeground:"#F8F8F2",overlay:"#FFFFFF20",subtle:"#222436"},interactive:{border:"#2D2F3C",borderHover:"#303244",borderFocus:"#4A4D6D",selection:"#30334b",selectionForeground:"#FFFFFF",focus:"#BD93F9",focusRing:"#BD93F940",cursor:"#FFFFFF",hover:"#30334ba3",active:"#30334b"},status:{error:"#FF5555",errorForeground:"#14151F",errorBackground:"#FF555520",errorBorder:"#FF555550",warning:"#FFB86C",warningForeground:"#14151F",warningBackground:"#FFB86C20",warningBorder:"#FFB86C50",success:"#50FA7B",successForeground:"#14151F",successBackground:"#50FA7B20",successBorder:"#50FA7B50",info:"#8BE9FD",infoForeground:"#14151F",infoBackground:"#8BE9FD20",infoBorder:"#8BE9FD50"},pr:{open:"#50FA7B",draft:"#B6B9E4",blocked:"#FFB86C",merged:"#BD93F9",closed:"#FF5555"},syntax:{base:{background:"#181926",foreground:"#F8F8F2",comment:"#B6B9E4",keyword:"#BD93F9",string:"#50FA7B",number:"#FF79C6",function:"#BD93F9",variable:"#F8F8F2",type:"#FFB86C",operator:"#FF79C6"},tokens:{boolean:"#FFB86C",class:"#BD93F9",className:"#BD93F9",commentDoc:"#9EA0C6",constant:"#8BE9FD",decorator:"#FFB86C",enum:"#BD93F9",exception:"#FF79C6",functionCall:"#BD93F9",interface:"#FFB86C",jsxTag:"#BD93F9",key:"#BD93F9",keywordImport:"#FF79C6",label:"#FF79C6",macro:"#8BE9FD",method:"#50FA7B",module:"#FF79C6",namespace:"#FFB86C",parameter:"#F8F8F2",preprocessor:"#FF79C6",punctuation:"#B6B9E4",regex:"#50FA7B",storageModifier:"#8BE9FD",stringEscape:"#FFFFFF",struct:"#BD93F9",tag:"#BD93F9",tagAttribute:"#FFB86C",tagAttributeValue:"#50FA7B",typeParameter:"#FFB86C",url:"#8BE9FD",variableGlobal:"#BD93F9",variableLocal:"#161722",variableOther:"#50FA7B",variableProperty:"#8BE9FD"},highlights:{diffAdded:"#50FA7B",diffAddedBackground:"#1F2A2F",diffModified:"#8BE9FD",diffModifiedBackground:"#24253A",diffRemoved:"#FF5555",diffRemovedBackground:"#2D1F27",lineNumber:"#3B3D55",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F8F8F2",heading2:"#F8F8F2",heading3:"#F8F8F2",heading4:"#F8F8F2",link:"#8BE9FD",linkHover:"#BD93F9",inlineCode:"#4aeb72",inlineCodeBackground:"#202132",blockquote:"#FFB86C",blockquoteBorder:"#2D2F3C",listMarker:"#BD93F999"},chat:{userMessage:"#F8F8F2",userMessageBackground:"#222436",assistantMessage:"#F8F8F2",assistantMessageBackground:"#14151F",timestamp:"#B6B9E4",divider:"#2D2F3C"},tools:{background:"#18192680",border:"#494c6180",headerHover:"#191A26",icon:"#B6B9E4",title:"#F8F8F2",description:"#B6B9E4",edit:{added:"#50FA7B",addedBackground:"#50FA7B25",removed:"#FF5555",removedBackground:"#FF555525",lineNumber:"#3B3D55"}}},Pl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Rl={metadata:Ml,colors:Tl,config:Pl},Il={id:"dracula-light",name:"Dracula",description:"Dracula",version:"1.0.0",variant:"light",tags:["light","palette"]},xl={primary:{base:"#7C6BF5",hover:"#9587F4",active:"#6A5CD2",foreground:"#F8F8F2",muted:"#7C6BF580",emphasis:"#9587F4"},surface:{background:"#F8F8F2",foreground:"#1F1F2F",muted:"#eff1eb",mutedForeground:"#6c6c7a",elevated:"#eeeee5",elevatedForeground:"#1F1F2F",overlay:"#05040C20",subtle:"#edeee7"},interactive:{border:"#E2E3DA",borderHover:"#D8D9D0",borderFocus:"#B0B2A7",selection:"#c2bcea63",selectionForeground:"#05040C",focus:"#7C6BF5",focusRing:"#7C6BF540",cursor:"#05040C",hover:"#c2bcea38",active:"#c2bcea63"},status:{error:"#D9536F",errorForeground:"#F8F8F2",errorBackground:"#D9536F20",errorBorder:"#D9536F50",warning:"#F7A14D",warningForeground:"#F8F8F2",warningBackground:"#F7A14D20",warningBorder:"#F7A14D50",success:"#2FBF71",successForeground:"#F8F8F2",successBackground:"#2FBF7120",successBorder:"#2FBF7150",info:"#1D7FC5",infoForeground:"#F8F8F2",infoBackground:"#1D7FC520",infoBorder:"#1D7FC550"},pr:{open:"#2FBF71",draft:"#52526B",blocked:"#F7A14D",merged:"#7C6BF5",closed:"#D9536F"},syntax:{base:{background:"#F1F2ED",foreground:"#1F1F2F",comment:"#52526B",keyword:"#7C6BF5",string:"#2FBF71",number:"#D16090",function:"#7C6BF5",variable:"#1F1F2F",type:"#F7A14D",operator:"#D16090"},tokens:{boolean:"#F7A14D",class:"#7C6BF5",className:"#7C6BF5",commentDoc:"#A5A5AF",constant:"#1D7FC5",decorator:"#F7A14D",enum:"#7C6BF5",exception:"#D16090",functionCall:"#7C6BF5",interface:"#F7A14D",jsxTag:"#7C6BF5",key:"#7C6BF5",keywordImport:"#D16090",label:"#D16090",macro:"#1D7FC5",method:"#2FBF71",module:"#D16090",namespace:"#F7A14D",parameter:"#1F1F2F",preprocessor:"#D16090",punctuation:"#52526B",regex:"#2FBF71",storageModifier:"#1D7FC5",stringEscape:"#05040C",struct:"#7C6BF5",tag:"#7C6BF5",tagAttribute:"#F7A14D",tagAttributeValue:"#2FBF71",typeParameter:"#F7A14D",url:"#1D7FC5",variableGlobal:"#7C6BF5",variableLocal:"#F6F6F1",variableOther:"#2FBF71",variableProperty:"#1D7FC5"},highlights:{diffAdded:"#2FBF71",diffAddedBackground:"#E4F5E6",diffModified:"#1D7FC5",diffModifiedBackground:"#DEDFE9",diffRemoved:"#D9536F",diffRemovedBackground:"#FAE4EB",lineNumber:"#C4C6BC",lineNumberActive:"#05040C"}},markdown:{heading1:"#1F1F2F",heading2:"#1F1F2F",heading3:"#1F1F2F",heading4:"#1F1F2F",link:"#1D7FC5",linkHover:"#7C6BF5",inlineCode:"#2FBF71",inlineCodeBackground:"#F1F2ED",blockquote:"#F7A14D",blockquoteBorder:"#E2E3DA",listMarker:"#7C6BF599"},chat:{userMessage:"#1F1F2F",userMessageBackground:"#F1F2ED",assistantMessage:"#1F1F2F",assistantMessageBackground:"#F8F8F2",timestamp:"#52526B",divider:"#E2E3DA"},tools:{background:"#F1F2ED80",border:"#E2E3DA80",headerHover:"#F2F2EC",icon:"#52526B",title:"#1F1F2F",description:"#52526B",edit:{added:"#2FBF71",addedBackground:"#2FBF7125",removed:"#D9536F",removedBackground:"#D9536F25",lineNumber:"#C4C6BC"}}},Ol={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},_l={metadata:Il,colors:xl,config:Ol},Nl={id:"gruvbox-dark",name:"Gruvbox",description:"Gruvbox",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Ul={primary:{base:"#83A598",hover:"#759287",active:"#95B09F",foreground:"#282828",muted:"#83A59880",emphasis:"#759287"},surface:{background:"#282828",foreground:"#EBDBB2",muted:"#32302F",mutedForeground:"#918574",elevated:"#25292b",elevatedForeground:"#EBDBB2",overlay:"#FBF1C720",subtle:"#3e3c3a"},interactive:{border:"#504945",borderHover:"#5A524B",borderFocus:"#7C6F64",selection:"#5a5647db",selectionForeground:"#FBF1C7",focus:"#83A598",focusRing:"#83A59840",cursor:"#FBF1C7",hover:"#5a5647d9",active:"#5a5647ec"},status:{error:"#FB4934",errorForeground:"#282828",errorBackground:"#FB493420",errorBorder:"#FB493450",warning:"#FABD2F",warningForeground:"#282828",warningBackground:"#FABD2F20",warningBorder:"#FABD2F50",success:"#B8BB26",successForeground:"#282828",successBackground:"#B8BB2620",successBorder:"#B8BB2650",info:"#D3869B",infoForeground:"#282828",infoBackground:"#D3869B20",infoBorder:"#D3869B50"},pr:{open:"#B8BB26",draft:"#A89984",blocked:"#FABD2F",merged:"#8973a8",closed:"#FB4934"},syntax:{base:{background:"#32302F",foreground:"#EBDBB2",comment:"#A89984",keyword:"#83A598",string:"#B8BB26",number:"#FB4934",function:"#83A598",variable:"#EBDBB2",type:"#FABD2F",operator:"#FB4934"},tokens:{boolean:"#FABD2F",class:"#83A598",className:"#83A598",commentDoc:"#958876",constant:"#D3869B",decorator:"#FABD2F",enum:"#83A598",exception:"#FB4934",functionCall:"#83A598",interface:"#FABD2F",jsxTag:"#83A598",key:"#83A598",keywordImport:"#FB4934",label:"#FB4934",macro:"#8EC07C",method:"#B8BB26",module:"#FB4934",namespace:"#FABD2F",parameter:"#EBDBB2",preprocessor:"#FB4934",punctuation:"#A89984",regex:"#B8BB26",storageModifier:"#8EC07C",stringEscape:"#FBF1C7",struct:"#83A598",tag:"#83A598",tagAttribute:"#FABD2F",tagAttributeValue:"#B8BB26",typeParameter:"#FABD2F",url:"#8EC07C",variableGlobal:"#83A598",variableLocal:"#1D2021",variableOther:"#B8BB26",variableProperty:"#D3869B"},highlights:{diffAdded:"#B8BB26",diffAddedBackground:"#2A3325",diffModified:"#D3869B",diffModifiedBackground:"#32302F",diffRemoved:"#FB4934",diffRemovedBackground:"#3C2222",lineNumber:"#70665D",lineNumberActive:"#FBF1C7"}},markdown:{heading1:"#EBDBB2",heading2:"#EBDBB2",heading3:"#EBDBB2",heading4:"#EBDBB2",link:"#8EC07C",linkHover:"#83A598",inlineCode:"#B8BB26",inlineCodeBackground:"#32302F",blockquote:"#928374",blockquoteBorder:"#504945",listMarker:"#83A59899"},chat:{userMessage:"#EBDBB2",userMessageBackground:"#3e3c3a",assistantMessage:"#EBDBB2",assistantMessageBackground:"#282828",timestamp:"#A89984",divider:"#504945"},tools:{background:"#32302F80",border:"#6e645e80",headerHover:"#141617",icon:"#A89984",title:"#EBDBB2",description:"#A89984",edit:{added:"#B8BB26",addedBackground:"#B8BB2625",removed:"#FB4934",removedBackground:"#FB493425",lineNumber:"#70665D"}}},Ll={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Hl={metadata:Nl,colors:Ul,config:Ll},jl={id:"gruvbox-light",name:"Gruvbox",description:"Gruvbox",version:"1.0.0",variant:"light",tags:["light","palette"]},zl={primary:{base:"#076678",hover:"#388288",active:"#0C5D6C",foreground:"#FBF1C7",muted:"#07667880",emphasis:"#388288"},surface:{background:"#FBF1C7",foreground:"#3C3836",muted:"#F2E5BC",mutedForeground:"#7C6F64",elevated:"#efebcd",elevatedForeground:"#3C3836",overlay:"#28282820",subtle:"#FDF9E8"},interactive:{border:"#D5C4A1",borderHover:"#C9B897",borderFocus:"#A89984",selection:"#fffdfdec",selectionForeground:"#282828",focus:"#076678",focusRing:"#07667840",cursor:"#282828",hover:"#fffdfdb3",active:"#fffdfdcf"},status:{error:"#9D0006",errorForeground:"#FBF1C7",errorBackground:"#9D000620",errorBorder:"#9D000650",warning:"#B57614",warningForeground:"#FBF1C7",warningBackground:"#B5761420",warningBorder:"#B5761450",success:"#79740E",successForeground:"#FBF1C7",successBackground:"#79740E20",successBorder:"#79740E50",info:"#8F3F71",infoForeground:"#FBF1C7",infoBackground:"#8F3F7120",infoBorder:"#8F3F7150"},pr:{open:"#79740E",draft:"#7C6F64",blocked:"#B57614",merged:"#5e4c76",closed:"#9D0006"},syntax:{base:{background:"#F2E5BC",foreground:"#3C3836",comment:"#7C6F64",keyword:"#076678",string:"#79740E",number:"#9D0006",function:"#076678",variable:"#3C3836",type:"#B57614",operator:"#9D0006"},tokens:{boolean:"#B57614",class:"#076678",className:"#076678",commentDoc:"#BCB096",constant:"#8F3F71",decorator:"#B57614",enum:"#076678",exception:"#9D0006",functionCall:"#076678",interface:"#B57614",jsxTag:"#076678",key:"#076678",keywordImport:"#9D0006",label:"#9D0006",macro:"#427B58",method:"#79740E",module:"#9D0006",namespace:"#B57614",parameter:"#3C3836",preprocessor:"#9D0006",punctuation:"#7C6F64",regex:"#79740E",storageModifier:"#427B58",stringEscape:"#282828",struct:"#076678",tag:"#076678",tagAttribute:"#B57614",tagAttributeValue:"#79740E",typeParameter:"#B57614",url:"#427B58",variableGlobal:"#076678",variableLocal:"#F9F5D7",variableOther:"#79740E",variableProperty:"#8F3F71"},highlights:{diffAdded:"#79740E",diffAddedBackground:"#DDE3B1",diffModified:"#8F3F71",diffModifiedBackground:"#EBDFB5",diffRemoved:"#9D0006",diffRemovedBackground:"#E8C7C3",lineNumber:"#B0A285",lineNumberActive:"#282828"}},markdown:{heading1:"#3C3836",heading2:"#3C3836",heading3:"#3C3836",heading4:"#3C3836",link:"#427B58",linkHover:"#076678",inlineCode:"#79740E",inlineCodeBackground:"#F2E5BC",blockquote:"#928374",blockquoteBorder:"#D5C4A1",listMarker:"#07667899"},chat:{userMessage:"#3C3836",userMessageBackground:"#FDF9E8",assistantMessage:"#3C3836",assistantMessageBackground:"#FBF1C7",timestamp:"#7C6F64",divider:"#D5C4A1"},tools:{background:"#F2E5BC80",border:"#a6997e80",headerHover:"#FDF9E8",icon:"#7C6F64",title:"#3C3836",description:"#7C6F64",edit:{added:"#79740E",addedBackground:"#79740E25",removed:"#9D0006",removedBackground:"#9D000625",lineNumber:"#B0A285"}}},$l={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gl={metadata:jl,colors:zl,config:$l},ql={id:"jetbrains-dark",name:"JetBrains",description:"JetBrains IDE-inspired colors for OpenChamber - dark variant",author:"Artem Evsevev, adapted for OpenChamber",version:"1.0.0",variant:"dark",tags:["dark","jetbrains","ide","blue"]},Wl={primary:{base:"#6796f5",hover:"#70AEFF",active:"#5594FA",foreground:"#1E1F22",muted:"#6796f580",emphasis:"#70AEFF"},surface:{background:"#1E1F22",foreground:"#DFE1E5",muted:"#26282B",mutedForeground:"#9fa0a2",elevated:"#2B2D30",elevatedForeground:"#DFE1E5",overlay:"#00000080",subtle:"#2c2d32"},interactive:{border:"#474a51",borderHover:"#4B5059",borderFocus:"#6796f5",selection:"#43454A",selectionForeground:"#DFE1E5",focus:"#6796f5",focusRing:"#6796f550",cursor:"#CED0D6",hover:"#3C3E41",active:"#494A4D"},status:{error:"#FA6675",errorForeground:"#1E1F22",errorBackground:"#402929",errorBorder:"#FA6675",warning:"#F2C55C",warningForeground:"#1E1F22",warningBackground:"#665014",warningBorder:"#F2C55C",success:"#57965D",successForeground:"#1E1F22",successBackground:"#253627",successBorder:"#57965D",info:"#3592C4",infoForeground:"#1E1F22",infoBackground:"#243846",infoBorder:"#3592C4"},pr:{open:"#5FAD65",draft:"#868A91",blocked:"#F2C55C",merged:"#A571E6",closed:"#DB5C5C"},syntax:{base:{background:"#1E1F22",foreground:"#BCBEC4",comment:"#7A7E85",keyword:"#CF8E6D",string:"#6AAB73",number:"#2AACB8",function:"#6AA2D7",variable:"#BCBEC4",type:"#A6BB77",operator:"#BCBEC4"},tokens:{commentDoc:"#5F826B",stringEscape:"#CF8E6D",keywordImport:"#CF8E6D",storageModifier:"#CF8E6D",functionCall:"#6AA2D7",method:"#6AA2D7",functionBuiltin:"#D5A563",variableProperty:"#C77DBB",variableOther:"#BCBEC4",variableGlobal:"#E59EAE",variableLocal:"#BCBEC4",parameter:"#3CACAC",constant:"#C77DBB",class:"#57AAF7",className:"#57AAF7",interface:"#8D91DC",struct:"#A6BB77",enum:"#A6BB77",typeParameter:"#3CACAC",namespace:"#BCBEC4",module:"#8D91DC",tag:"#D5B778",jsxTag:"#D5B778",tagAttribute:"#B3AE60",tagAttributeValue:"#6AAB73",boolean:"#CF8E6D",decorator:"#B3AE60",label:"#D5A563",punctuation:"#BCBEC4",macro:"#D5A563",preprocessor:"#D5A563",regex:"#6AAB73",url:"#57AAF7",key:"#C77DBB",exception:"#E59EAE"},highlights:{diffAdded:"#549159",diffAddedBackground:"#294436",diffRemoved:"#F75464",diffRemovedBackground:"#45302B",diffModified:"#70AEFF",diffModifiedBackground:"#243C63",lineNumber:"#4B5059",lineNumberActive:"#A1A3AB"}},markdown:{heading1:"#FFFFFF",heading2:"#DFE1E5",heading3:"#CED0D6",heading4:"#BCBEC4",link:"#56A8F5",linkHover:"#6796f5",inlineCode:"#6AAB73",inlineCodeBackground:"#26282B",blockquote:"#7A7E85",blockquoteBorder:"#393B41",listMarker:"#B3AE6099"},chat:{userMessage:"#DFE1E5",userMessageBackground:"#3a5b9d76",assistantMessage:"#DFE1E5",assistantMessageBackground:"#1E1F22",timestamp:"#7A7E85",divider:"#393B41"},tools:{background:"#26282B50",border:"#393B41",headerHover:"#3C3E4150",icon:"#B0B1B3",title:"#DFE1E5",description:"#B0B1B3",edit:{added:"#549159",addedBackground:"#29443640",removed:"#F75464",removedBackground:"#45302B40",lineNumber:"#4B5059"}}},Vl={fonts:{sans:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Kl={metadata:ql,colors:Wl,config:Vl},Jl={id:"jetbrains-light",name:"JetBrains",description:"JetBrains IDE-inspired colors for OpenChamber - light variant",author:"Artem Evsevev, adapted for OpenChamber",version:"1.0.0",variant:"light",tags:["light","jetbrains","ide","blue"]},Yl={primary:{base:"#195ce3",hover:"#2D61F0",active:"#0055FF",foreground:"#FFFFFF",muted:"#3573F080",emphasis:"#006DCC"},surface:{background:"#FFF",foreground:"#000000",muted:"#F7F8FA",mutedForeground:"#404040",elevated:"#FFFFFF",elevatedForeground:"#000000",overlay:"#00000025",subtle:"#ecf0f8"},interactive:{border:"#cfd3de",borderHover:"#AEB3C2",borderFocus:"#0055FF",selection:"#DFE1E5",selectionForeground:"#000000",focus:"#0055FF",focusRing:"#0055FF40",cursor:"#000000",hover:"#E6E6E8",active:"#DBDCDE"},status:{error:"#CE0606",errorForeground:"#FFFFFF",errorBackground:"#FFE8E8",errorBorder:"#CF5B56",warning:"#F49810",warningForeground:"#000000",warningBackground:"#FFF8DC",warningBorder:"#F49810",success:"#077D18",successForeground:"#FFFFFF",successBackground:"#E9F5E6",successBorder:"#55A76A",info:"#389FD6",infoForeground:"#000000",infoBackground:"#E7F4FB",infoBorder:"#389FD6"},pr:{open:"#369650",draft:"#808080",blocked:"#F49810",merged:"#834DF0",closed:"#E55765"},syntax:{base:{background:"#FFFFFF",foreground:"#080808",comment:"#8C8C8C",keyword:"#0033B3",string:"#067D17",number:"#1750EB",function:"#00627A",variable:"#000000",type:"#A04908",operator:"#080808"},tokens:{commentDoc:"#8C8C8C",stringEscape:"#0037A6",keywordImport:"#0033B3",storageModifier:"#0033B3",functionCall:"#00627A",method:"#00627A",functionBuiltin:"#C27203",variableProperty:"#871094",variableOther:"#000000",variableGlobal:"#1C5DFE",variableLocal:"#000000",parameter:"#007E8A",constant:"#871094",class:"#00627A",className:"#00627A",interface:"#835DDA",struct:"#A04908",enum:"#A04908",typeParameter:"#007E8A",namespace:"#000000",module:"#835DDA",tag:"#0033B3",jsxTag:"#0033B3",tagAttribute:"#9E880D",tagAttributeValue:"#067D17",boolean:"#0033B3",decorator:"#9E880D",label:"#C27203",punctuation:"#080808",macro:"#C27203",preprocessor:"#C27203",regex:"#067D17",url:"#00627A",key:"#871094",exception:"#1C5DFE"},highlights:{diffAdded:"#077D18",diffAddedBackground:"#BEE6BE",diffRemoved:"#FF0000",diffRemovedBackground:"#FFD5CC",diffModified:"#0133B3",diffModifiedBackground:"#DDE8FF",lineNumber:"#AEB3C2",lineNumberActive:"#767A8A"}},markdown:{heading1:"#000000",heading2:"#161617",heading3:"#404040",heading4:"#404040",link:"#006DCC",linkHover:"#3573F0",inlineCode:"#067D17",inlineCodeBackground:"#F5F7F9",blockquote:"#8C8C8C",blockquoteBorder:"#C9CCD6",listMarker:"#9E880D99"},chat:{userMessage:"#000000",userMessageBackground:"#E8F1FF",assistantMessage:"#000000",assistantMessageBackground:"#F7F8FA",timestamp:"#767A8A",divider:"#C9CCD6"},tools:{background:"#F5F7F950",border:"#AEB3C280",headerHover:"#E6E6E8",icon:"#404040",title:"#000000",description:"#404040",edit:{added:"#077D18",addedBackground:"#BEE6BE50",removed:"#FF0000",removedBackground:"#FFD5CC50",lineNumber:"#AEB3C2"}}},Ql={fonts:{sans:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Xl={metadata:Jl,colors:Yl,config:Ql},Zl={id:"kanagawa-dark",name:"Kanagawa",description:"A color scheme inspired by Japanese art and ink painting - dark variant",version:"1.0.0",variant:"dark",tags:["dark","japanese","ink","elegant"]},eu={primary:{base:"#7FB4CA",hover:"#9DC5E0",active:"#658594",foreground:"#1F1F28",muted:"#7FB4CA80",emphasis:"#7E9CD8"},surface:{background:"#1F1F28",foreground:"#DCD7BA",muted:"#23232d",mutedForeground:"#7e7e77",elevated:"#2A2A37",elevatedForeground:"#DCD7BA",overlay:"#16161DCC",subtle:"#2f2f3d"},interactive:{border:"#363646",borderHover:"#54546D",borderFocus:"#7FB4CA",selection:"#729fb333",selectionForeground:"#DCD7BA",focus:"#7FB4CA",focusRing:"#7FB4CA50",cursor:"#DCD7BA",hover:"#363646",active:"#54546D"},status:{error:"#E82424",errorForeground:"#DCD7BA",errorBackground:"#E8242420",errorBorder:"#E8242450",warning:"#FF9E3B",warningForeground:"#1F1F28",warningBackground:"#FF9E3B20",warningBorder:"#FF9E3B50",success:"#98BB6C",successForeground:"#1F1F28",successBackground:"#98BB6C20",successBorder:"#98BB6C50",info:"#7E9CD8",infoForeground:"#1F1F28",infoBackground:"#7E9CD820",infoBorder:"#7E9CD850"},pr:{open:"#98BB6C",draft:"#54546D",blocked:"#FF9E3B",merged:"#957FB8",closed:"#E82424"},syntax:{base:{background:"#16161D",foreground:"#DCD7BA",comment:"#54546D",keyword:"#7E9CD8",string:"#98BB6C",number:"#FF9E3B",function:"#E6C384",variable:"#DCD7BA",type:"#C8C093",operator:"#C34043"},tokens:{commentDoc:"#727169",stringEscape:"#DCD7BA",keywordImport:"#957FB8",storageModifier:"#7E9CD8",functionCall:"#E6C384",method:"#76946A",variableProperty:"#7E9CD8",variableOther:"#76946A",variableGlobal:"#D27E99",variableLocal:"#2A2A37",parameter:"#DCD7BA",constant:"#DCD7BA",class:"#E6C384",className:"#E6C384",interface:"#C8C093",struct:"#E6C384",enum:"#E6C384",typeParameter:"#E6C384",namespace:"#C8C093",module:"#C34043",tag:"#7E9CD8",jsxTag:"#D27E99",tagAttribute:"#C8C093",tagAttributeValue:"#98BB6C",boolean:"#C8C093",decorator:"#C8C093",label:"#D27E99",punctuation:"#54546D",macro:"#7E9CD8",preprocessor:"#D27E99",regex:"#98BB6C",url:"#7E9CD8",key:"#E6C384",exception:"#D27E99"},highlights:{diffAdded:"#98BB6C",diffAddedBackground:"#76946A20",diffRemoved:"#C34043",diffRemovedBackground:"#E8242420",diffModified:"#7E9CD8",diffModifiedBackground:"#7E9CD820",lineNumber:"#363646",lineNumberActive:"#DCD7BA"}},markdown:{heading1:"#DCD7BA",heading2:"#DCD7BA",heading3:"#DCD7BA",heading4:"#DCD7BA",link:"#7FB4CA",linkHover:"#7E9CD8",inlineCode:"#98BB6C",inlineCodeBackground:"#16161D",blockquote:"#54546D",blockquoteBorder:"#363646",listMarker:"#FF9E3B99"},chat:{userMessage:"#DCD7BA",userMessageBackground:"#2A2A37",assistantMessage:"#DCD7BA",assistantMessageBackground:"#2f2f3d",timestamp:"#54546D",divider:"#363646"},tools:{background:"#16161D50",border:"#4a4a5f80",headerHover:"#36364650",icon:"#afad9c",title:"#DCD7BA",description:"#5A595B",edit:{added:"#98BB6C",addedBackground:"#98BB6C25",removed:"#C34043",removedBackground:"#C3404325",lineNumber:"#56566d"}}},tu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ou={metadata:Zl,colors:eu,config:tu},ru={id:"kanagawa-light",name:"Kanagawa",description:"A color scheme inspired by Japanese art and ink painting - light variant (Lotus)",version:"1.0.0",variant:"light",tags:["light","japanese","lotus","elegant"]},nu={primary:{base:"#4D699B",hover:"#6693BF",active:"#5D57A3",foreground:"#F2ECBC",muted:"#4D699B80",emphasis:"#6693BF"},surface:{background:"#F2ECBC",foreground:"#545464",muted:"#E7DBA0",mutedForeground:"#6c6c67",elevated:"#eae4bf",elevatedForeground:"#545464",overlay:"#54546433",subtle:"#f4fff0"},interactive:{border:"#bfbaa4",borderHover:"#8A8980",borderFocus:"#4D699B",selection:"#e9f3e5cf",selectionForeground:"#545464",focus:"#4D699B",focusRing:"#4D699B40",cursor:"#545464",hover:"#e9f3e5a9",active:"#e9f3e5cf"},status:{error:"#E82424",errorForeground:"#F2ECBC",errorBackground:"#E8242420",errorBorder:"#E8242450",warning:"#DE9800",warningForeground:"#545464",warningBackground:"#DE980020",warningBorder:"#DE980050",success:"#6F894E",successForeground:"#F2ECBC",successBackground:"#98BB6C20",successBorder:"#6F894E50",info:"#4D699B",infoForeground:"#F2ECBC",infoBackground:"#6693BF20",infoBorder:"#4D699B50"},pr:{open:"#6F894E",draft:"#716E61",blocked:"#DE9800",merged:"#624C83",closed:"#E82424"},syntax:{base:{background:"#DCD5AC",foreground:"#545464",comment:"#716E61",keyword:"#4D699B",string:"#6F894E",number:"#836F4A",function:"#CC6D00",variable:"#545464",type:"#77713F",operator:"#C84053"},tokens:{commentDoc:"#8A8980",stringEscape:"#545464",keywordImport:"#624C83",storageModifier:"#4D699B",functionCall:"#CC6D00",method:"#6E915F",variableProperty:"#4D699B",variableOther:"#6E915F",variableGlobal:"#B35B79",variableLocal:"#D5CEA3",parameter:"#545464",constant:"#545464",class:"#CC6D00",className:"#CC6D00",interface:"#77713F",struct:"#CC6D00",enum:"#CC6D00",typeParameter:"#CC6D00",namespace:"#77713F",module:"#C84053",tag:"#4D699B",jsxTag:"#B35B79",tagAttribute:"#77713F",tagAttributeValue:"#6F894E",boolean:"#77713F",decorator:"#77713F",label:"#B35B79",punctuation:"#716E61",macro:"#4D699B",preprocessor:"#B35B79",regex:"#6F894E",url:"#4D699B",key:"#CC6D00",exception:"#B35B79"},highlights:{diffAdded:"#6F894E",diffAddedBackground:"#6F894E20",diffRemoved:"#C84053",diffRemovedBackground:"#C8405320",diffModified:"#4D699B",diffModifiedBackground:"#4D699B20",lineNumber:"#8A8980",lineNumberActive:"#545464"}},markdown:{heading1:"#545464",heading2:"#545464",heading3:"#545464",heading4:"#545464",link:"#5D57A3",linkHover:"#4D699B",inlineCode:"#6F894E",inlineCodeBackground:"#e7e2c7",blockquote:"#716E61",blockquoteBorder:"#716E61",listMarker:"#836F4A99"},chat:{userMessage:"#545464",userMessageBackground:"#e6f2e1",assistantMessage:"#545464",assistantMessageBackground:"#F2ECBC",timestamp:"#716E61",divider:"#716E61"},tools:{background:"#DCD5AC50",border:"#716E6180",headerHover:"#716E61",icon:"#8A8980",title:"#545464",description:"#8A8980",edit:{added:"#6F894E",addedBackground:"#6F894E25",removed:"#C84053",removedBackground:"#C8405325",lineNumber:"#8A8980"}}},au={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},su={metadata:ru,colors:nu,config:au},iu={id:"monokai-dark",name:"Monokai",description:"Monokai",version:"1.0.0",variant:"dark",tags:["dark","palette"]},cu={primary:{base:"#AE81FF",hover:"#9973DD",active:"#BA94FF",foreground:"#23241E",muted:"#AE81FF80",emphasis:"#9973DD"},surface:{background:"#23241E",foreground:"#F8F8F2",muted:"#282a20",mutedForeground:"#939390",elevated:"#21221a",elevatedForeground:"#F8F8F2",overlay:"#FFFFFF20",subtle:"#36372a"},interactive:{border:"#343528",borderHover:"#393A2D",borderFocus:"#555741",selection:"#434d3cfe",selectionForeground:"#FFFFFF",focus:"#AE81FF",focusRing:"#AE81FF40",cursor:"#FFFFFF",hover:"#36372a",active:"#36382e"},status:{error:"#F92672",errorForeground:"#23241E",errorBackground:"#F9267220",errorBorder:"#F9267250",warning:"#FD971F",warningForeground:"#23241E",warningBackground:"#FD971F20",warningBorder:"#FD971F50",success:"#A6E22E",successForeground:"#23241E",successBackground:"#A6E22E20",successBorder:"#A6E22E50",info:"#66D9EF",infoForeground:"#23241E",infoBackground:"#66D9EF20",infoBorder:"#66D9EF50"},pr:{open:"#A6E22E",draft:"#C5C5C0",blocked:"#FD971F",merged:"#AE81FF",closed:"#F92672"},syntax:{base:{background:"#27281F",foreground:"#F8F8F2",comment:"#C5C5C0",keyword:"#AE81FF",string:"#A6E22E",number:"#F92672",function:"#AE81FF",variable:"#F8F8F2",type:"#FD971F",operator:"#F92672"},tokens:{boolean:"#FD971F",class:"#AE81FF",className:"#AE81FF",commentDoc:"#ADADA8",constant:"#66D9EF",decorator:"#FD971F",enum:"#AE81FF",exception:"#F92672",functionCall:"#AE81FF",interface:"#FD971F",jsxTag:"#AE81FF",key:"#AE81FF",keywordImport:"#F92672",label:"#F92672",macro:"#66D9EF",method:"#A6E22E",module:"#F92672",namespace:"#FD971F",parameter:"#F8F8F2",preprocessor:"#F92672",punctuation:"#C5C5C0",regex:"#A6E22E",storageModifier:"#66D9EF",stringEscape:"#FFFFFF",struct:"#AE81FF",tag:"#AE81FF",tagAttribute:"#FD971F",tagAttributeValue:"#A6E22E",typeParameter:"#FD971F",url:"#66D9EF",variableGlobal:"#AE81FF",variableLocal:"#25261F",variableOther:"#A6E22E",variableProperty:"#66D9EF"},highlights:{diffAdded:"#A6E22E",diffAddedBackground:"#1E2A1D",diffModified:"#66D9EF",diffModifiedBackground:"#2F2F24",diffRemoved:"#F92672",diffRemovedBackground:"#301C24",lineNumber:"#454639",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F8F8F2",heading2:"#F8F8F2",heading3:"#F8F8F2",heading4:"#F8F8F2",link:"#66D9EF",linkHover:"#AE81FF",inlineCode:"#A6E22E",inlineCodeBackground:"#27281F",blockquote:"#FD971F",blockquoteBorder:"#343528",listMarker:"#AE81FF99"},chat:{userMessage:"#F8F8F2",userMessageBackground:"#36372a",assistantMessage:"#F8F8F2",assistantMessageBackground:"#23241E",timestamp:"#C5C5C0",divider:"#343528"},tools:{background:"#27281F80",border:"#4d4f3c80",headerHover:"#292A23",icon:"#C5C5C0",title:"#F8F8F2",description:"#C5C5C0",edit:{added:"#A6E22E",addedBackground:"#A6E22E25",removed:"#bd215a",removedBackground:"#F9267225",lineNumber:"#505142"}}},du={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},lu={metadata:iu,colors:cu,config:du},uu={id:"monokai-light",name:"Monokai",description:"Monokai",version:"1.0.0",variant:"light",tags:["light","palette"]},fu={primary:{base:"#BF7BFF",hover:"#CB94FB",active:"#A76CDB",foreground:"#FDF8EC",muted:"#BF7BFF80",emphasis:"#CB94FB"},surface:{background:"#FDF8EC",foreground:"#292318",muted:"#F8F2E6",mutedForeground:"#887c6a",elevated:"#FBF5E8",elevatedForeground:"#292318",overlay:"#1C150C20",subtle:"#F7EFDD"},interactive:{border:"#E9E0CF",borderHover:"#DFD5C3",borderFocus:"#B6A893",selection:"#1C150C22",selectionForeground:"#1C150C",focus:"#BF7BFF",focusRing:"#BF7BFF40",cursor:"#1C150C",hover:"#e6e0d5",active:"#FBF5E8"},status:{error:"#E54B4B",errorForeground:"#FDF8EC",errorBackground:"#E54B4B20",errorBorder:"#E54B4B50",warning:"#F1A948",warningForeground:"#FDF8EC",warningBackground:"#F1A94820",warningBorder:"#F1A94850",success:"#4FB54B",successForeground:"#FDF8EC",successBackground:"#4FB54B20",successBorder:"#4FB54B50",info:"#2D9AD7",infoForeground:"#FDF8EC",infoBackground:"#2D9AD720",infoBorder:"#2D9AD750"},pr:{open:"#4FB54B",draft:"#6D5C40",blocked:"#F1A948",merged:"#BF7BFF",closed:"#E54B4B"},syntax:{base:{background:"#F8F2E6",foreground:"#292318",comment:"#6D5C40",keyword:"#BF7BFF",string:"#4FB54B",number:"#D9487C",function:"#BF7BFF",variable:"#292318",type:"#F1A948",operator:"#D9487C"},tokens:{boolean:"#F1A948",class:"#BF7BFF",className:"#BF7BFF",commentDoc:"#B5AA96",constant:"#2D9AD7",decorator:"#F1A948",enum:"#BF7BFF",exception:"#D9487C",functionCall:"#BF7BFF",interface:"#F1A948",jsxTag:"#BF7BFF",key:"#BF7BFF",keywordImport:"#D9487C",label:"#D9487C",macro:"#2D9AD7",method:"#4FB54B",module:"#D9487C",namespace:"#F1A948",parameter:"#292318",preprocessor:"#D9487C",punctuation:"#6D5C40",regex:"#4FB54B",storageModifier:"#2D9AD7",stringEscape:"#1C150C",struct:"#BF7BFF",tag:"#BF7BFF",tagAttribute:"#F1A948",tagAttributeValue:"#4FB54B",typeParameter:"#F1A948",url:"#2D9AD7",variableGlobal:"#BF7BFF",variableLocal:"#FBF5E8",variableOther:"#4FB54B",variableProperty:"#2D9AD7"},highlights:{diffAdded:"#4FB54B",diffAddedBackground:"#E8F7E1",diffModified:"#2D9AD7",diffModifiedBackground:"#E9E0D0",diffRemoved:"#E54B4B",diffRemovedBackground:"#FDE5E4",lineNumber:"#CABFAD",lineNumberActive:"#1C150C"}},markdown:{heading1:"#292318",heading2:"#292318",heading3:"#292318",heading4:"#292318",link:"#2D9AD7",linkHover:"#BF7BFF",inlineCode:"#4FB54B",inlineCodeBackground:"#F8F2E6",blockquote:"#F1A948",blockquoteBorder:"#E9E0CF",listMarker:"#BF7BFF99"},chat:{userMessage:"#292318",userMessageBackground:"#F8F2E6",assistantMessage:"#292318",assistantMessageBackground:"#FDF8EC",timestamp:"#6D5C40",divider:"#E9E0CF"},tools:{background:"#F8F2E680",border:"#d0c8b880",headerHover:"#F7EFDD",icon:"#6D5C40",title:"#292318",description:"#6D5C40",edit:{added:"#4FB54B",addedBackground:"#4FB54B25",removed:"#E54B4B",removedBackground:"#E54B4B25",lineNumber:"#bfb5a4"}}},mu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},gu={metadata:uu,colors:fu,config:mu},pu={id:"nightowl-dark",name:"Night Owl",description:"Night Owl",version:"1.0.0",variant:"dark",tags:["dark","palette"]},hu={primary:{base:"#82AAFF",hover:"#6F94DF",active:"#95B7FF",foreground:"#011627",muted:"#82AAFF80",emphasis:"#6F94DF"},surface:{background:"#011627",foreground:"#D6DEEB",muted:"#0B253A",mutedForeground:"#7d8892",elevated:"#001122",elevatedForeground:"#D6DEEB",overlay:"#FFFFFF20",subtle:"#0f283f"},interactive:{border:"#1D3B53",borderHover:"#234561",borderFocus:"#82AAFF",selection:"#555d6d94",selectionForeground:"#FFFFFF",focus:"#82AAFF",focusRing:"#82AAFF40",cursor:"#FFFFFF",hover:"#555d6d68",active:"#555d6d94"},status:{error:"#EF5350",errorForeground:"#011627",errorBackground:"#EF535020",errorBorder:"#EF535050",warning:"#ECC48D",warningForeground:"#011627",warningBackground:"#ECC48D20",warningBorder:"#ECC48D50",success:"#C5E478",successForeground:"#011627",successBackground:"#C5E47820",successBorder:"#C5E47850",info:"#82AAFF",infoForeground:"#011627",infoBackground:"#82AAFF20",infoBorder:"#82AAFF50"},pr:{open:"#C5E478",draft:"#5F7E97",blocked:"#ECC48D",merged:"#BC82FF",closed:"#EF5350"},syntax:{base:{background:"#0B253A",foreground:"#D6DEEB",comment:"#5F7E97",keyword:"#82AAFF",string:"#ECC48D",number:"#F78C6C",function:"#82AAFF",variable:"#D6DEEB",type:"#C5E478",operator:"#F78C6C"},tokens:{boolean:"#C5E478",class:"#82AAFF",className:"#82AAFF",commentDoc:"#516E86",constant:"#7FDBCA",decorator:"#C5E478",enum:"#82AAFF",exception:"#F78C6C",functionCall:"#82AAFF",interface:"#C5E478",jsxTag:"#82AAFF",key:"#82AAFF",keywordImport:"#F78C6C",label:"#F78C6C",macro:"#82AAFF",method:"#C5E478",module:"#F78C6C",namespace:"#C5E478",parameter:"#D6DEEB",preprocessor:"#F78C6C",punctuation:"#5F7E97",regex:"#ECC48D",storageModifier:"#82AAFF",stringEscape:"#FFFFFF",struct:"#82AAFF",tag:"#82AAFF",tagAttribute:"#C5E478",tagAttributeValue:"#ECC48D",typeParameter:"#C5E478",url:"#7FDBCA",variableGlobal:"#82AAFF",variableLocal:"#001122",variableOther:"#C5E478",variableProperty:"#7FDBCA"},highlights:{diffAdded:"#C5E478",diffAddedBackground:"#0A2E1A",diffModified:"#82AAFF",diffModifiedBackground:"#0B253A",diffRemoved:"#EF5350",diffRemovedBackground:"#2D1B1B",lineNumber:"#82AAFF",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#D6DEEB",heading2:"#D6DEEB",heading3:"#D6DEEB",heading4:"#D6DEEB",link:"#7FDBCA",linkHover:"#82AAFF",inlineCode:"#C5E478",inlineCodeBackground:"#0B253A",blockquote:"#5F7E97",blockquoteBorder:"#1D3B53",listMarker:"#82AAFF99"},chat:{userMessage:"#D6DEEB",userMessageBackground:"#0f283f",assistantMessage:"#D6DEEB",assistantMessageBackground:"#011627",timestamp:"#5F7E97",divider:"#1D3B53"},tools:{background:"#0B253A80",border:"#24496780",headerHover:"#000C17",icon:"#5F7E97",title:"#D6DEEB",description:"#5F7E97",edit:{added:"#C5E478",addedBackground:"#C5E47825",removed:"#EF5350",removedBackground:"#EF535025",lineNumber:"#58698f"}}},Fu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},yu={metadata:pu,colors:hu,config:Fu},bu={id:"nightowl-light",name:"Night Owl",description:"Night Owl",version:"1.0.0",variant:"light",tags:["light","palette"]},Au={primary:{base:"#4876D6",hover:"#6C91DD",active:"#4168BA",foreground:"#FBFBFB",muted:"#4876D680",emphasis:"#6C91DD"},surface:{background:"#FBFBFB",foreground:"#403F53",muted:"#F0F0F0",mutedForeground:"#747a7a",elevated:"#FFFFFF",elevatedForeground:"#403F53",overlay:"#1A1A1A20",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#CCCCCC",borderFocus:"#4876D6",selection:"#706e6e22",selectionForeground:"#1A1A1A",focus:"#4876D6",focusRing:"#4876D640",cursor:"#1A1A1A",hover:"#706e6e16",active:"#706e6e22"},status:{error:"#DE3D3B",errorForeground:"#FBFBFB",errorBackground:"#DE3D3B20",errorBorder:"#DE3D3B50",warning:"#C96765",warningForeground:"#FBFBFB",warningBackground:"#C9676520",warningBorder:"#C9676550",success:"#2AA298",successForeground:"#FBFBFB",successBackground:"#2AA29820",successBorder:"#2AA29850",info:"#4876D6",infoForeground:"#FBFBFB",infoBackground:"#4876D620",infoBorder:"#4876D650"},pr:{open:"#2AA298",draft:"#7A8181",blocked:"#c98f65",merged:"#994CC3",closed:"#DE3D3B"},syntax:{base:{background:"#F0F0F0",foreground:"#403F53",comment:"#7A8181",keyword:"#4876D6",string:"#C96765",number:"#AA0982",function:"#4876D6",variable:"#403F53",type:"#994CC3",operator:"#AA0982"},tokens:{boolean:"#994CC3",class:"#4876D6",className:"#4876D6",commentDoc:"#BBBEBE",constant:"#2AA298",decorator:"#994CC3",enum:"#4876D6",exception:"#AA0982",functionCall:"#4876D6",interface:"#994CC3",jsxTag:"#4876D6",key:"#4876D6",keywordImport:"#AA0982",label:"#AA0982",macro:"#4876D6",method:"#2AA298",module:"#AA0982",namespace:"#994CC3",parameter:"#403F53",preprocessor:"#AA0982",punctuation:"#7A8181",regex:"#C96765",storageModifier:"#4876D6",stringEscape:"#1A1A1A",struct:"#4876D6",tag:"#4876D6",tagAttribute:"#994CC3",tagAttributeValue:"#C96765",typeParameter:"#994CC3",url:"#2AA298",variableGlobal:"#4876D6",variableLocal:"#FFFFFF",variableOther:"#2AA298",variableProperty:"#2AA298"},highlights:{diffAdded:"#2AA298",diffAddedBackground:"#EAF8F6",diffModified:"#4876D6",diffModifiedBackground:"#E8F0FC",diffRemoved:"#DE3D3B",diffRemovedBackground:"#FBE9E9",lineNumber:"#4876D6",lineNumberActive:"#1A1A1A"}},markdown:{heading1:"#403F53",heading2:"#403F53",heading3:"#403F53",heading4:"#403F53",link:"#2AA298",linkHover:"#4876D6",inlineCode:"#2AA298",inlineCodeBackground:"#F0F0F0",blockquote:"#7A8181",blockquoteBorder:"#D9D9D9",listMarker:"#4876D699"},chat:{userMessage:"#403F53",userMessageBackground:"#F0F0F0",assistantMessage:"#403F53",assistantMessageBackground:"#FBFBFB",timestamp:"#7A8181",divider:"#D9D9D9"},tools:{background:"#F0F0F080",border:"#D9D9D980",headerHover:"#FFFFFF",icon:"#7A8181",title:"#403F53",description:"#7A8181",edit:{added:"#2AA298",addedBackground:"#2AA29825",removed:"#DE3D3B",removedBackground:"#DE3D3B25",lineNumber:"#4876D6"}}},wu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Eu={metadata:bu,colors:Au,config:wu},Cu={id:"nord-dark",name:"Nord",description:"Nord",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Bu={primary:{base:"#88C0D0",hover:"#78A9B8",active:"#99C9D7",foreground:"#1F2430",muted:"#88C0D080",emphasis:"#78A9B8"},surface:{background:"#1F2430",foreground:"#E5E9F0",muted:"#222938",mutedForeground:"#7c828e",elevated:"#1C202A",elevatedForeground:"#E5E9F0",overlay:"#F8FAFC20",subtle:"#272f40"},interactive:{border:"#414755",borderHover:"#383F50",borderFocus:"#545B78",selection:"#3e4a56fe",selectionForeground:"#F8FAFC",focus:"#88C0D0",focusRing:"#88C0D040",cursor:"#F8FAFC",hover:"#3e4a5692",active:"#3e4a56fe"},status:{error:"#BF616A",errorForeground:"#1F2430",errorBackground:"#BF616A20",errorBorder:"#BF616A50",warning:"#D08770",warningForeground:"#1F2430",warningBackground:"#D0877020",warningBorder:"#D0877050",success:"#A3BE8C",successForeground:"#1F2430",successBackground:"#A3BE8C20",successBorder:"#A3BE8C50",info:"#81A1C1",infoForeground:"#1F2430",infoBackground:"#81A1C120",infoBorder:"#81A1C150"},pr:{open:"#A3BE8C",draft:"#A4ADBF",blocked:"#D08770",merged:"#b788d0",closed:"#BF616A"},syntax:{base:{background:"#222938",foreground:"#E5E9F0",comment:"#A4ADBF",keyword:"#88C0D0",string:"#A3BE8C",number:"#D57780",function:"#88C0D0",variable:"#E5E9F0",type:"#EAC196",operator:"#D57780"},tokens:{boolean:"#EAC196",class:"#88C0D0",className:"#88C0D0",commentDoc:"#9098AA",constant:"#81A1C1",decorator:"#EAC196",enum:"#88C0D0",exception:"#D57780",functionCall:"#88C0D0",interface:"#EAC196",jsxTag:"#88C0D0",key:"#88C0D0",keywordImport:"#D57780",label:"#D57780",macro:"#81A1C1",method:"#A3BE8C",module:"#D57780",namespace:"#EAC196",parameter:"#E5E9F0",preprocessor:"#D57780",punctuation:"#A4ADBF",regex:"#A3BE8C",storageModifier:"#81A1C1",stringEscape:"#F8FAFC",struct:"#88C0D0",tag:"#88C0D0",tagAttribute:"#EAC196",tagAttributeValue:"#A3BE8C",typeParameter:"#EAC196",url:"#81A1C1",variableGlobal:"#88C0D0",variableLocal:"#1C202A",variableOther:"#A3BE8C",variableProperty:"#81A1C1"},highlights:{diffAdded:"#A3BE8C",diffAddedBackground:"#1F2E33",diffModified:"#81A1C1",diffModifiedBackground:"#222B3A",diffRemoved:"#BF616A",diffRemovedBackground:"#2E212A",lineNumber:"#434A62",lineNumberActive:"#F8FAFC"}},markdown:{heading1:"#E5E9F0",heading2:"#E5E9F0",heading3:"#E5E9F0",heading4:"#E5E9F0",link:"#81A1C1",linkHover:"#88C0D0",inlineCode:"#A3BE8C",inlineCodeBackground:"#252c3c",blockquote:"#D08770",blockquoteBorder:"#343A47",listMarker:"#88C0D099"},chat:{userMessage:"#E5E9F0",userMessageBackground:"#272f40",assistantMessage:"#E5E9F0",assistantMessageBackground:"#1F2430",timestamp:"#A4ADBF",divider:"#343A47"},tools:{background:"#22293880",border:"#454e5f80",headerHover:"#181C24",icon:"#A4ADBF",title:"#E5E9F0",description:"#A4ADBF",edit:{added:"#A3BE8C",addedBackground:"#A3BE8C25",removed:"#BF616A",removedBackground:"#BF616A25",lineNumber:"#4a526b"}}},Du={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ku={metadata:Cu,colors:Bu,config:Du},vu={id:"nord-light",name:"Nord",description:"Nord",version:"1.0.0",variant:"light",tags:["light","palette"]},Su={primary:{base:"#5E81AC",hover:"#7A97BA",active:"#557399",foreground:"#ECEFF4",muted:"#5E81AC80",emphasis:"#7A97BA"},surface:{background:"#ECEFF4",foreground:"#2E3440",muted:"#E4E8F0",mutedForeground:"#6e7481",elevated:"#e7ebf5",elevatedForeground:"#2E3440",overlay:"#1F253020",subtle:"#dee4f0"},interactive:{border:"#c5cbd6",borderHover:"#C9D0DE",borderFocus:"#9CA4BA",selection:"#c6ccd881",selectionForeground:"#1F2530",focus:"#5E81AC",focusRing:"#5E81AC40",cursor:"#1F2530",hover:"#c6ccd84a",active:"#c6ccd881"},status:{error:"#BF616A",errorForeground:"#ECEFF4",errorBackground:"#BF616A20",errorBorder:"#BF616A50",warning:"#D08770",warningForeground:"#ECEFF4",warningBackground:"#D0877020",warningBorder:"#D0877050",success:"#8FBCBB",successForeground:"#ECEFF4",successBackground:"#8FBCBB20",successBorder:"#8FBCBB50",info:"#81A1C1",infoForeground:"#ECEFF4",infoBackground:"#81A1C120",infoBorder:"#81A1C150"},pr:{open:"#8FBCBB",draft:"#4C566A",blocked:"#D08770",merged:"#9b5eac",closed:"#BF616A"},syntax:{base:{background:"#E4E8F0",foreground:"#2E3440",comment:"#4C566A",keyword:"#5E81AC",string:"#A3BE8C",number:"#BF616A",function:"#5E81AC",variable:"#2E3440",type:"#D08770",operator:"#BF616A"},tokens:{boolean:"#D08770",class:"#5E81AC",className:"#5E81AC",commentDoc:"#9CA3AF",constant:"#81A1C1",decorator:"#D08770",enum:"#5E81AC",exception:"#BF616A",functionCall:"#5E81AC",interface:"#D08770",jsxTag:"#5E81AC",key:"#5E81AC",keywordImport:"#BF616A",label:"#BF616A",macro:"#81A1C1",method:"#8FBCBB",module:"#BF616A",namespace:"#D08770",parameter:"#2E3440",preprocessor:"#BF616A",punctuation:"#4C566A",regex:"#A3BE8C",storageModifier:"#81A1C1",stringEscape:"#1F2530",struct:"#5E81AC",tag:"#5E81AC",tagAttribute:"#D08770",tagAttributeValue:"#A3BE8C",typeParameter:"#D08770",url:"#81A1C1",variableGlobal:"#5E81AC",variableLocal:"#F1F3F8",variableOther:"#8FBCBB",variableProperty:"#81A1C1"},highlights:{diffAdded:"#8FBCBB",diffAddedBackground:"#E4F0E4",diffModified:"#81A1C1",diffModifiedBackground:"#DFE6F2",diffRemoved:"#BF616A",diffRemovedBackground:"#F4E1E4",lineNumber:"#B2BACC",lineNumberActive:"#1F2530"}},markdown:{heading1:"#2E3440",heading2:"#2E3440",heading3:"#2E3440",heading4:"#2E3440",link:"#81A1C1",linkHover:"#5E81AC",inlineCode:"#4f7034",inlineCodeBackground:"#E4E8F0",blockquote:"#D08770",blockquoteBorder:"#D5DBE7",listMarker:"#5E81AC99"},chat:{userMessage:"#2E3440",userMessageBackground:"#dee4f0",assistantMessage:"#2E3440",assistantMessageBackground:"#ECEFF4",timestamp:"#4C566A",divider:"#D5DBE7"},tools:{background:"#E4E8F080",border:"#b8bfcc80",headerHover:"#F6F8FC",icon:"#4C566A",title:"#2E3440",description:"#4C566A",edit:{added:"#8FBCBB",addedBackground:"#8FBCBB25",removed:"#BF616A",removedBackground:"#BF616A25",lineNumber:"#b7bfd1"}}},Mu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Tu={metadata:vu,colors:Su,config:Mu},Pu={id:"openchamber-dark",name:"Fields of the Shire",description:"Fields of the Shire theme - dark variant",author:"OpenChamber",version:"1.0.0",variant:"dark",tags:["dark","warm","earthy","brand"]},Ru={primary:{base:"#7a8a5a",hover:"#93a56b",active:"#a4b67d",foreground:"#0c0a08",muted:"#7a8a5a80",emphasis:"#93a56b"},surface:{background:"#1b1815",foreground:"#ebe0d1",muted:"#23201c",mutedForeground:"#83796f",elevated:"#2b2622",elevatedForeground:"#ebe0d1",overlay:"#1b1815cc",subtle:"#332d28"},interactive:{border:"#413e3a",borderHover:"#f0e6d830",borderFocus:"#373d2c",selection:"#f0e6d81f",selectionForeground:"#ebe0d1",focus:"#7a8a5a",focusRing:"#7a8a5a4d",cursor:"#ebe0d1",hover:"#332d28",active:"#f0e6d824"},status:{error:"#b34d3b",errorForeground:"#0c0a08",errorBackground:"#b85a4a20",errorBorder:"#b85a4a50",warning:"#c47a3a",warningForeground:"#0c0a08",warningBackground:"#c47a3a20",warningBorder:"#c47a3a50",success:"#7f905e",successForeground:"#0c0a08",successBackground:"#7a8a5a20",successBorder:"#7a8a5a50",info:"#667c8a",infoForeground:"#f0e6d8",infoBackground:"#5a6d7a20",infoBorder:"#5a6d7a50"},pr:{open:"#7a8a5a",draft:"#6a5e52",blocked:"#c47a3a",merged:"#5a6d7a",closed:"#b85a4a"},syntax:{base:{background:"#23201c",foreground:"#ebe0d1",comment:"#6a5e52",keyword:"#5a6d7a",string:"#93a56b",number:"#c47a3a",function:"#c47a3a",variable:"#ebe0d1",type:"#7a8a5a",operator:"#a89888"},tokens:{commentDoc:"#4a4238",stringEscape:"#ebe0d1",keywordImport:"#5a6d7a",storageModifier:"#5a6d7a",functionCall:"#c47a3a",method:"#93a56b",variableProperty:"#5a6d7a",variableOther:"#ebe0d1",variableGlobal:"#c47a3a",variableLocal:"#a89888",parameter:"#ebe0d1",constant:"#c47a3a",class:"#7a8a5a",className:"#7a8a5a",interface:"#7a8a5a",struct:"#7a8a5a",enum:"#7a8a5a",typeParameter:"#93a56b",namespace:"#5a6d7a",module:"#5a6d7a",tag:"#c47a3a",jsxTag:"#c47a3a",tagAttribute:"#93a56b",tagAttributeValue:"#93a56b",boolean:"#7a8a5a",decorator:"#5a6d7a",label:"#c47a3a",punctuation:"#a89888",macro:"#5a6d7a",preprocessor:"#5a6d7a",regex:"#93a56b",url:"#5a6d7a",key:"#c47a3a",exception:"#b85a4a"},highlights:{diffAdded:"#7a8a5a",diffAddedBackground:"#7a8a5a20",diffRemoved:"#b85a4a",diffRemovedBackground:"#b85a4a20",diffModified:"#5a6d7a",diffModifiedBackground:"#5a6d7a20",lineNumber:"#6a5e52",lineNumberActive:"#ebe0d1"}},markdown:{heading1:"#c47a3a",heading2:"#93a56b",heading3:"#ebe0d1",heading4:"#ebe0d1",link:"#5a6d7a",linkHover:"#93a56b",inlineCode:"#93a56b",inlineCodeBackground:"#23201c",blockquote:"#a89888",blockquoteBorder:"#f0e6d830",listMarker:"#c47a3a99"},chat:{userMessage:"#ebe0d1",userMessageBackground:"#272a25",assistantMessage:"#ebe0d1",assistantMessageBackground:"#1b1815",timestamp:"#6a5e52",divider:"#f0e6d81c"},tools:{background:"#23201c80",border:"#f0e6d830",headerHover:"#2a252180",icon:"#a89888",title:"#ebe0d1",description:"#a19a96",edit:{added:"#7a8a5a",addedBackground:"#7a8a5a25",removed:"#b85a4a",removedBackground:"#b85a4a25",lineNumber:"#6a5e52"}}},Iu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ls={metadata:Pu,colors:Ru,config:Iu},xu={id:"openchamber-light",name:"Fields of the Shire",description:"Fields of the Shire theme - light variant",author:"OpenChamber",version:"1.0.0",variant:"light",tags:["light","warm","earthy","brand"]},Ou={primary:{base:"#4a6030",hover:"#5e773f",active:"#708a50",foreground:"#faf8f5",muted:"#4a603080",emphasis:"#5e773f"},surface:{background:"#f9f5eb",foreground:"#1a1612",muted:"#f4efe3",mutedForeground:"#5a5048",elevated:"#fcf9f0",elevatedForeground:"#1a1612",overlay:"#1a161220",subtle:"#efe8da"},interactive:{border:"#1a16121c",borderHover:"#1a161230",borderFocus:"#4a6030",selection:"#1a16121a",selectionForeground:"#1a1612",focus:"#4a6030",focusRing:"#4a603040",cursor:"#1a1612",hover:"#efe8da",active:"#1a16121f"},status:{error:"#a24d3f",errorForeground:"#faf8f5",errorBackground:"#a24d3f20",errorBorder:"#a24d3f50",warning:"#8c5520",warningForeground:"#faf8f5",warningBackground:"#8c552020",warningBorder:"#8c552050",success:"#4a6030",successForeground:"#faf8f5",successBackground:"#4a603020",successBorder:"#4a603050",info:"#3d4f5a",infoForeground:"#faf8f5",infoBackground:"#3d4f5a20",infoBorder:"#3d4f5a50"},pr:{open:"#4a6030",draft:"#8a7e72",blocked:"#8c5520",merged:"#3d4f5a",closed:"#a24d3f"},syntax:{base:{background:"#ece5d6",foreground:"#1a1612",comment:"#8a7e72",keyword:"#3d4f5a",string:"#5e773f",number:"#8c5520",function:"#8c5520",variable:"#1a1612",type:"#4a6030",operator:"#5a5048"},tokens:{commentDoc:"#b8b0a4",stringEscape:"#1a1612",keywordImport:"#3d4f5a",storageModifier:"#3d4f5a",functionCall:"#8c5520",method:"#5e773f",variableProperty:"#3d4f5a",variableOther:"#1a1612",variableGlobal:"#8c5520",variableLocal:"#5a5048",parameter:"#1a1612",constant:"#8c5520",class:"#4a6030",className:"#4a6030",interface:"#4a6030",struct:"#4a6030",enum:"#4a6030",typeParameter:"#5e773f",namespace:"#3d4f5a",module:"#3d4f5a",tag:"#8c5520",jsxTag:"#8c5520",tagAttribute:"#4a6030",tagAttributeValue:"#5e773f",boolean:"#4a6030",decorator:"#3d4f5a",label:"#8c5520",punctuation:"#5a5048",macro:"#3d4f5a",preprocessor:"#3d4f5a",regex:"#5e773f",url:"#3d4f5a",key:"#8c5520",exception:"#a24d3f"},highlights:{diffAdded:"#4a6030",diffAddedBackground:"#4a603020",diffRemoved:"#a24d3f",diffRemovedBackground:"#a24d3f20",diffModified:"#3d4f5a",diffModifiedBackground:"#3d4f5a20",lineNumber:"#8a7e72",lineNumberActive:"#1a1612"}},markdown:{heading1:"#8c5520",heading2:"#4a6030",heading3:"#1a1612",heading4:"#1a1612",link:"#3d4f5a",linkHover:"#4a6030",inlineCode:"#4a6030",inlineCodeBackground:"#ece5d6",blockquote:"#5a5048",blockquoteBorder:"#1a161230",listMarker:"#8c552099"},chat:{userMessage:"#1a1612",userMessageBackground:"#efe8da",assistantMessage:"#1a1612",assistantMessageBackground:"#f9f5eb",timestamp:"#8a7e72",divider:"#1a16121c"},tools:{background:"#f4efe380",border:"#1a161230",headerHover:"#efe8da",icon:"#5a5048",title:"#1a1612",description:"#5a5048",edit:{added:"#4a6030",addedBackground:"#4a603025",removed:"#a24d3f",removedBackground:"#a24d3f25",lineNumber:"#8a7e72"}}},_u={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},us={metadata:xu,colors:Ou,config:_u},Nu={id:"onedarkpro-dark",name:"One Dark Pro",description:"One Dark Pro",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Uu={primary:{base:"#61AFEF",hover:"#579AD1",active:"#77BAF1",foreground:"#1E222A",muted:"#61AFEF80",emphasis:"#579AD1"},surface:{background:"#1E222A",foreground:"#ABB2BF",muted:"#212631",mutedForeground:"#737a89",elevated:"#232832",elevatedForeground:"#ABB2BF",overlay:"#F6F7FB20",subtle:"#2E3442"},interactive:{border:"#373e4f",borderHover:"#363D52",borderFocus:"#555C79",selection:"#a8aec533",selectionForeground:"#F6F7FB",focus:"#61AFEF",focusRing:"#61AFEF40",cursor:"#F6F7FB",hover:"#a8aec525",active:"#a8aec533"},status:{error:"#E06C75",errorForeground:"#1E222A",errorBackground:"#E06C7520",errorBorder:"#E06C7550",warning:"#E5C07B",warningForeground:"#1E222A",warningBackground:"#E5C07B20",warningBorder:"#E5C07B50",success:"#98C379",successForeground:"#1E222A",successBackground:"#98C37920",successBorder:"#98C37950",info:"#56B6C2",infoForeground:"#1E222A",infoBackground:"#56B6C220",infoBorder:"#56B6C250"},pr:{open:"#98C379",draft:"#818899",blocked:"#E5C07B",merged:"#bb61ef",closed:"#E06C75"},syntax:{base:{background:"#212631",foreground:"#ABB2BF",comment:"#818899",keyword:"#61AFEF",string:"#98C379",number:"#E06C75",function:"#61AFEF",variable:"#ABB2BF",type:"#E5C07B",operator:"#E06C75"},tokens:{boolean:"#E5C07B",class:"#61AFEF",className:"#61AFEF",commentDoc:"#727988",constant:"#56B6C2",decorator:"#E5C07B",enum:"#61AFEF",exception:"#E06C75",functionCall:"#61AFEF",interface:"#E5C07B",jsxTag:"#61AFEF",key:"#61AFEF",keywordImport:"#E06C75",label:"#E06C75",macro:"#56B6C2",method:"#98C379",module:"#E06C75",namespace:"#E5C07B",parameter:"#ABB2BF",preprocessor:"#E06C75",punctuation:"#818899",regex:"#98C379",storageModifier:"#56B6C2",stringEscape:"#F6F7FB",struct:"#61AFEF",tag:"#61AFEF",tagAttribute:"#E5C07B",tagAttributeValue:"#98C379",typeParameter:"#E5C07B",url:"#56B6C2",variableGlobal:"#61AFEF",variableLocal:"#1B1F27",variableOther:"#98C379",variableProperty:"#56B6C2"},highlights:{diffAdded:"#98C379",diffAddedBackground:"#1C2A26",diffModified:"#56B6C2",diffModifiedBackground:"#232836",diffRemoved:"#E06C75",diffRemovedBackground:"#2A1C22",lineNumber:"#424967",lineNumberActive:"#F6F7FB"}},markdown:{heading1:"#ABB2BF",heading2:"#ABB2BF",heading3:"#ABB2BF",heading4:"#ABB2BF",link:"#56B6C2",linkHover:"#61AFEF",inlineCode:"#a0c288",inlineCodeBackground:"#232937",blockquote:"#E5C07B",blockquoteBorder:"#323848",listMarker:"#61AFEF99"},chat:{userMessage:"#ABB2BF",userMessageBackground:"#2e3442",assistantMessage:"#ABB2BF",assistantMessageBackground:"#1E222A",timestamp:"#818899",divider:"#323848"},tools:{background:"#21263180",border:"#41495e80",headerHover:"#171B23",icon:"#818899",title:"#ABB2BF",description:"#818899",edit:{added:"#98C379",addedBackground:"#98C37925",removed:"#E06C75",removedBackground:"#E06C7525",lineNumber:"#545c81"}}},Lu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Hu={metadata:Nu,colors:Uu,config:Lu},ju={id:"onedarkpro-light",name:"One Dark Pro",description:"One Dark Pro",version:"1.0.0",variant:"light",tags:["light","palette"]},zu={primary:{base:"#528BFF",hover:"#73A0FE",active:"#4879DC",foreground:"#F5F6F8",muted:"#528BFF80",emphasis:"#73A0FE"},surface:{background:"#F5F6F8",foreground:"#2B303B",muted:"#EEF0F4",mutedForeground:"#6e727b",elevated:"#f0f5fa",elevatedForeground:"#2B303B",overlay:"#0E111820",subtle:"#eaedf4"},interactive:{border:"#cccfd6",borderHover:"#D4D9E3",borderFocus:"#A6ADBF",selection:"#d8dde6",selectionForeground:"#0E1118",focus:"#528BFF",focusRing:"#528BFF40",cursor:"#0E1118",hover:"#d8dde6c2",active:"#FAFBFC"},status:{error:"#E06C75",errorForeground:"#F5F6F8",errorBackground:"#E06C7520",errorBorder:"#E06C7550",warning:"#D19A66",warningForeground:"#F5F6F8",warningBackground:"#D19A6620",warningBorder:"#D19A6650",success:"#4FA66D",successForeground:"#F5F6F8",successBackground:"#4FA66D20",successBorder:"#4FA66D50",info:"#61AFEF",infoForeground:"#F5F6F8",infoBackground:"#61AFEF20",infoBorder:"#61AFEF50"},pr:{open:"#4FA66D",draft:"#6B717F",blocked:"#D19A66",merged:"#a052ff",closed:"#E06C75"},syntax:{base:{background:"#EEF0F4",foreground:"#2B303B",comment:"#6B717F",keyword:"#528BFF",string:"#4FA66D",number:"#D85462",function:"#528BFF",variable:"#2B303B",type:"#D19A66",operator:"#D85462"},tokens:{boolean:"#D19A66",class:"#528BFF",className:"#528BFF",commentDoc:"#B0B4BC",constant:"#61AFEF",decorator:"#D19A66",enum:"#528BFF",exception:"#D85462",functionCall:"#528BFF",interface:"#D19A66",jsxTag:"#528BFF",key:"#528BFF",keywordImport:"#D85462",label:"#D85462",macro:"#61AFEF",method:"#4FA66D",module:"#D85462",namespace:"#D19A66",parameter:"#2B303B",preprocessor:"#D85462",punctuation:"#6B717F",regex:"#4FA66D",storageModifier:"#61AFEF",stringEscape:"#0E1118",struct:"#528BFF",tag:"#528BFF",tagAttribute:"#D19A66",tagAttributeValue:"#4FA66D",typeParameter:"#D19A66",url:"#61AFEF",variableGlobal:"#528BFF",variableLocal:"#FAFBFC",variableOther:"#4FA66D",variableProperty:"#61AFEF"},highlights:{diffAdded:"#4FA66D",diffAddedBackground:"#E5F4EA",diffModified:"#61AFEF",diffModifiedBackground:"#E4E8F4",diffRemoved:"#E06C75",diffRemovedBackground:"#FDE7EA",lineNumber:"#BEC4D0",lineNumberActive:"#0E1118"}},markdown:{heading1:"#2B303B",heading2:"#2B303B",heading3:"#2B303B",heading4:"#2B303B",link:"#61AFEF",linkHover:"#528BFF",inlineCode:"#327d4c",inlineCodeBackground:"#EEF0F4",blockquote:"#D19A66",blockquoteBorder:"#DEE2EB",listMarker:"#528BFF99"},chat:{userMessage:"#2B303B",userMessageBackground:"#eaedf4",assistantMessage:"#2B303B",assistantMessageBackground:"#F5F6F8",timestamp:"#6B717F",divider:"#DEE2EB"},tools:{background:"#EEF0F480",border:"#c4c8d080",headerHover:"#FFFFFF",icon:"#6B717F",title:"#2B303B",description:"#6B717F",edit:{added:"#4FA66D",addedBackground:"#4FA66D25",removed:"#E06C75",removedBackground:"#E06C7525",lineNumber:"#afb5c1"}}},$u={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gu={metadata:ju,colors:zu,config:$u},qu={id:"solarized-dark",name:"Solarized",description:"Solarized",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Wu={primary:{base:"#278BD2",hover:"#5C65AC",active:"#8285C9",foreground:"#001F27",muted:"#6C71C480",emphasis:"#5C65AC"},surface:{background:"#001e25",foreground:"#93A1A1",muted:"#02232e",mutedForeground:"#6f7475",elevated:"#052832",elevatedForeground:"#93A1A1",overlay:"#FDF6E320",subtle:"#042b34"},interactive:{border:"#253f47",borderHover:"#243E47",borderFocus:"#3A5A6B",selection:"#98afbd33",selectionForeground:"#FDF6E3",focus:"#6C71C4",focusRing:"#6C71C440",cursor:"#FDF6E3",hover:"#98afbd25",active:"#98afbd33"},status:{error:"#DC322F",errorForeground:"#001F27",errorBackground:"#DC322F20",errorBorder:"#DC322F50",warning:"#B58900",warningForeground:"#001F27",warningBackground:"#B5890020",warningBorder:"#B5890050",success:"#859900",successForeground:"#001F27",successBackground:"#85990020",successBorder:"#85990050",info:"#2AA198",infoForeground:"#001F27",infoBackground:"#2AA19820",infoBorder:"#2AA19850"},pr:{open:"#859900",draft:"#6C7F80",blocked:"#B58900",merged:"#7f6cc4",closed:"#DC322F"},syntax:{base:{background:"#022733",foreground:"#93A1A1",comment:"#6C7F80",keyword:"#6C71C4",string:"#859900",number:"#D33682",function:"#6C71C4",variable:"#93A1A1",type:"#B58900",operator:"#D33682"},tokens:{boolean:"#B58900",class:"#6C71C4",className:"#6C71C4",commentDoc:"#5C7173",constant:"#2AA198",decorator:"#B58900",enum:"#6C71C4",exception:"#D33682",functionCall:"#6C71C4",interface:"#B58900",jsxTag:"#6C71C4",key:"#6C71C4",keywordImport:"#D33682",label:"#D33682",macro:"#2AA198",method:"#859900",module:"#D33682",namespace:"#B58900",parameter:"#93A1A1",preprocessor:"#D33682",punctuation:"#6C7F80",regex:"#859900",storageModifier:"#2AA198",stringEscape:"#FDF6E3",struct:"#6C71C4",tag:"#6C71C4",tagAttribute:"#B58900",tagAttributeValue:"#859900",typeParameter:"#B58900",url:"#2AA198",variableGlobal:"#6C71C4",variableLocal:"#01222B",variableOther:"#859900",variableProperty:"#2AA198"},highlights:{diffAdded:"#859900",diffAddedBackground:"#0F2F29",diffModified:"#2AA198",diffModifiedBackground:"#0F3844",diffRemoved:"#DC322F",diffRemovedBackground:"#321C1C",lineNumber:"#2D4958",lineNumberActive:"#FDF6E3"}},markdown:{heading1:"#93A1A1",heading2:"#93A1A1",heading3:"#93A1A1",heading4:"#93A1A1",link:"#2AA198",linkHover:"#6C71C4",inlineCode:"#859900",inlineCodeBackground:"#022733",blockquote:"#B58900",blockquoteBorder:"#20373F",listMarker:"#6C71C499"},chat:{userMessage:"#93A1A1",userMessageBackground:"#042B34",assistantMessage:"#93A1A1",assistantMessageBackground:"#001F27",timestamp:"#6C7F80",divider:"#20373F"},tools:{background:"#02273380",border:"#2b495380",headerHover:"#032830",icon:"#6C7F80",title:"#93A1A1",description:"#6C7F80",edit:{added:"#859900",addedBackground:"#85990025",removed:"#DC322F",removedBackground:"#DC322F25",lineNumber:"#345567"}}},Vu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Ku={metadata:qu,colors:Wu,config:Vu},Ju={id:"solarized-light",name:"Solarized",description:"Solarized",version:"1.0.0",variant:"light",tags:["light","palette"]},Yu={primary:{base:"#268BD2",hover:"#51A0D5",active:"#217EBC",foreground:"#FDF6E3",muted:"#268BD280",emphasis:"#51A0D5"},surface:{background:"#FDF6E3",foreground:"#586E75",muted:"#F6EFDA",mutedForeground:"#7a8587",elevated:"#FAF3DC",elevatedForeground:"#586E75",overlay:"#07364220",subtle:"#F6EFDA"},interactive:{border:"#e0decc",borderHover:"#D9D4C2",borderFocus:"#ACA58F",selection:"#10647a22",selectionForeground:"#073642",focus:"#268BD2",focusRing:"#268BD240",cursor:"#073642",hover:"#10647a14",active:"#10647a22"},status:{error:"#DC322F",errorForeground:"#FDF6E3",errorBackground:"#DC322F20",errorBorder:"#DC322F50",warning:"#B58900",warningForeground:"#FDF6E3",warningBackground:"#B5890020",warningBorder:"#B5890050",success:"#859900",successForeground:"#FDF6E3",successBackground:"#85990020",successBorder:"#85990050",info:"#2AA198",infoForeground:"#FDF6E3",infoBackground:"#2AA19820",infoBorder:"#2AA19850"},pr:{open:"#859900",draft:"#7A8C8E",blocked:"#B58900",merged:"#6e26d2",closed:"#DC322F"},syntax:{base:{background:"#F6EFDA",foreground:"#586E75",comment:"#7A8C8E",keyword:"#268BD2",string:"#859900",number:"#D33682",function:"#268BD2",variable:"#586E75",type:"#B58900",operator:"#D33682"},tokens:{boolean:"#B58900",class:"#268BD2",className:"#268BD2",commentDoc:"#BCC1B9",constant:"#2AA198",decorator:"#B58900",enum:"#268BD2",exception:"#D33682",functionCall:"#268BD2",interface:"#B58900",jsxTag:"#268BD2",key:"#268BD2",keywordImport:"#D33682",label:"#D33682",macro:"#2AA198",method:"#859900",module:"#D33682",namespace:"#B58900",parameter:"#586E75",preprocessor:"#D33682",punctuation:"#7A8C8E",regex:"#859900",storageModifier:"#2AA198",stringEscape:"#073642",struct:"#268BD2",tag:"#268BD2",tagAttribute:"#B58900",tagAttributeValue:"#859900",typeParameter:"#B58900",url:"#2AA198",variableGlobal:"#268BD2",variableLocal:"#FAF3DC",variableOther:"#859900",variableProperty:"#2AA198"},highlights:{diffAdded:"#859900",diffAddedBackground:"#EEF5D6",diffModified:"#2AA198",diffModifiedBackground:"#E3ECF3",diffRemoved:"#DC322F",diffRemovedBackground:"#FDE4DD",lineNumber:"#C5C0AD",lineNumberActive:"#073642"}},markdown:{heading1:"#586E75",heading2:"#586E75",heading3:"#586E75",heading4:"#586E75",link:"#2AA198",linkHover:"#268BD2",inlineCode:"#859900",inlineCodeBackground:"#F6EFDA",blockquote:"#B58900",blockquoteBorder:"#E3E0CD",listMarker:"#268BD299"},chat:{userMessage:"#586E75",userMessageBackground:"#F6EFDA",assistantMessage:"#586E75",assistantMessageBackground:"#FDF6E3",timestamp:"#7A8C8E",divider:"#E3E0CD"},tools:{background:"#F6EFDA80",border:"#d1cebc80",headerHover:"#F6EDD4",icon:"#7A8C8E",title:"#586E75",description:"#7A8C8E",edit:{added:"#859900",addedBackground:"#85990025",removed:"#DC322F",removedBackground:"#DC322F25",lineNumber:"#c3bead"}}},Qu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Xu={metadata:Ju,colors:Yu,config:Qu},Zu={id:"tokyonight-dark",name:"Tokyonight",description:"Tokyonight",version:"1.0.0",variant:"dark",tags:["dark","palette"]},ef={primary:{base:"#7AA2F7",hover:"#6A8CD6",active:"#8BADF8",foreground:"#0F111A",muted:"#7AA2F780",emphasis:"#6A8CD6"},surface:{background:"#0F111A",foreground:"#C0CAF5",muted:"#111428",mutedForeground:"#6a739d",elevated:"#131629",elevatedForeground:"#C0CAF5",overlay:"#EAEAFF20",subtle:"#171b30"},interactive:{border:"#31344a",borderHover:"#292C43",borderFocus:"#45496F",selection:"#b3b3cc33",selectionForeground:"#EAEAFF",focus:"#7AA2F7",focusRing:"#7AA2F740",cursor:"#EAEAFF",hover:"#272E49",active:"#262C46"},status:{error:"#F7768E",errorForeground:"#0F111A",errorBackground:"#F7768E20",errorBorder:"#F7768E50",warning:"#E0AF68",warningForeground:"#0F111A",warningBackground:"#E0AF6820",warningBorder:"#E0AF6850",success:"#9ECE6A",successForeground:"#0F111A",successBackground:"#9ECE6A20",successBorder:"#9ECE6A50",info:"#7DCFFF",infoForeground:"#0F111A",infoBackground:"#7DCFFF20",infoBorder:"#7DCFFF50"},pr:{open:"#9ECE6A",draft:"#7A88CF",blocked:"#E0AF68",merged:"#BB9AF7",closed:"#F7768E"},syntax:{base:{background:"#111428",foreground:"#C0CAF5",comment:"#7A88CF",keyword:"#BB9AF7",string:"#9ECE6A",number:"#FF9E64",function:"#BB9AF7",variable:"#C0CAF5",type:"#E0AF68",operator:"#FF9E64"},tokens:{boolean:"#E0AF68",class:"#BB9AF7",className:"#BB9AF7",commentDoc:"#6A76B4",constant:"#7DCFFF",decorator:"#E0AF68",enum:"#BB9AF7",exception:"#FF9E64",functionCall:"#BB9AF7",interface:"#E0AF68",jsxTag:"#BB9AF7",key:"#BB9AF7",keywordImport:"#FF9E64",label:"#FF9E64",macro:"#7DCFFF",method:"#9ECE6A",module:"#FF9E64",namespace:"#E0AF68",parameter:"#C0CAF5",preprocessor:"#FF9E64",punctuation:"#7A88CF",regex:"#9ECE6A",storageModifier:"#7DCFFF",stringEscape:"#EAEAFF",struct:"#BB9AF7",tag:"#BB9AF7",tagAttribute:"#E0AF68",tagAttributeValue:"#9ECE6A",typeParameter:"#E0AF68",url:"#7DCFFF",variableGlobal:"#BB9AF7",variableLocal:"#101324",variableOther:"#9ECE6A",variableProperty:"#7DCFFF"},highlights:{diffAdded:"#9ECE6A",diffAddedBackground:"#1C2A38",diffModified:"#7DCFFF",diffModifiedBackground:"#24283B",diffRemoved:"#F7768E",diffRemovedBackground:"#2A1F32",lineNumber:"#343755",lineNumberActive:"#EAEAFF"}},markdown:{heading1:"#C0CAF5",heading2:"#C0CAF5",heading3:"#C0CAF5",heading4:"#C0CAF5",link:"#7DCFFF",linkHover:"#7AA2F7",inlineCode:"#9ECE6A",inlineCodeBackground:"#111428",blockquote:"#E0AF68",blockquoteBorder:"#25283B",listMarker:"#7AA2F799"},chat:{userMessage:"#C0CAF5",userMessageBackground:"#171b30",assistantMessage:"#C0CAF5",assistantMessageBackground:"#0F111A",timestamp:"#7A88CF",divider:"#25283B"},tools:{background:"#11142880",border:"#393e5c80",headerHover:"#13172A",icon:"#7A88CF",title:"#C0CAF5",description:"#7A88CF",edit:{added:"#9ECE6A",addedBackground:"#9ECE6A25",removed:"#F7768E",removedBackground:"#F7768E25",lineNumber:"#3e4266"}}},tf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},of={metadata:Zu,colors:ef,config:tf},rf={id:"tokyonight-light",name:"Tokyonight",description:"Tokyonight",version:"1.0.0",variant:"light",tags:["light","palette"]},nf={primary:{base:"#2E7DE9",hover:"#5291E9",active:"#2B70D0",foreground:"#E1E2E7",muted:"#2E7DE980",emphasis:"#5291E9"},surface:{background:"#E1E2E7",foreground:"#273153",muted:"#DEE0EA",mutedForeground:"#686e9b",elevated:"#dee0ee",elevatedForeground:"#273153",overlay:"#1C254420",subtle:"#dadce6"},interactive:{border:"#bbbdc9",borderHover:"#C3C6D2",borderFocus:"#9599A8",selection:"#939cbf47",selectionForeground:"#1C2544",focus:"#2E7DE9",focusRing:"#2E7DE940",cursor:"#1C2544",hover:"#7b86ad2a",active:"#7b86ad47"},status:{error:"#C94060",errorForeground:"#E1E2E7",errorBackground:"#C9406020",errorBorder:"#C9406050",warning:"#8C6C3E",warningForeground:"#E1E2E7",warningBackground:"#8C6C3E20",warningBorder:"#8C6C3E50",success:"#587539",successForeground:"#E1E2E7",successBackground:"#58753920",successBorder:"#58753950",info:"#007197",infoForeground:"#E1E2E7",infoBackground:"#00719720",infoBorder:"#00719750"},pr:{open:"#587539",draft:"#5C6390",blocked:"#8C6C3E",merged:"#9854F1",closed:"#C94060"},syntax:{base:{background:"#DEE0EA",foreground:"#273153",comment:"#5C6390",keyword:"#9854F1",string:"#587539",number:"#B15C00",function:"#9854F1",variable:"#273153",type:"#3760BF",operator:"#B15C00"},tokens:{boolean:"#3760BF",class:"#9854F1",className:"#9854F1",commentDoc:"#9FA3BC",constant:"#007197",decorator:"#3760BF",enum:"#9854F1",exception:"#B15C00",functionCall:"#9854F1",interface:"#3760BF",jsxTag:"#9854F1",key:"#9854F1",keywordImport:"#B15C00",label:"#B15C00",macro:"#007197",method:"#587539",module:"#B15C00",namespace:"#3760BF",parameter:"#273153",preprocessor:"#B15C00",punctuation:"#5C6390",regex:"#587539",storageModifier:"#007197",stringEscape:"#1C2544",struct:"#9854F1",tag:"#9854F1",tagAttribute:"#3760BF",tagAttributeValue:"#587539",typeParameter:"#3760BF",url:"#007197",variableGlobal:"#9854F1",variableLocal:"#E5E6EE",variableOther:"#587539",variableProperty:"#007197"},highlights:{diffAdded:"#587539",diffAddedBackground:"#DFE7DA",diffModified:"#007197",diffModifiedBackground:"#CFD1DD",diffRemoved:"#C94060",diffRemovedBackground:"#F4DADD",lineNumber:"#AEB2BF",lineNumberActive:"#1C2544"}},markdown:{heading1:"#9854F1",heading2:"#B15C00",heading3:"#8C6C3E",heading4:"#273153",link:"#007197",linkHover:"#2E7DE9",inlineCode:"#587539",inlineCodeBackground:"#DEE0EA",blockquote:"#8C6C3E",blockquoteBorder:"#CDD0DC",listMarker:"#2E7DE999"},chat:{userMessage:"#273153",userMessageBackground:"#dcdee9",assistantMessage:"#273153",assistantMessageBackground:"#E1E2E7",timestamp:"#5C6390",divider:"#CDD0DC"},tools:{background:"#DEE0EA80",border:"#a5a8b580",headerHover:"#E9EAF1",icon:"#5C6390",title:"#273153",description:"#5C6390",edit:{added:"#587539",addedBackground:"#58753925",removed:"#C94060",removedBackground:"#C9406025",lineNumber:"#9b9ea9"}}},af={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},sf={metadata:rf,colors:nf,config:af},cf={id:"vesper-dark",name:"Vesper",description:"Vesper",version:"1.0.0",variant:"dark",tags:["dark","palette"]},df={primary:{base:"#FFC799",hover:"#DBAC84",active:"#FFCFA8",foreground:"#101010",muted:"#FFC79980",emphasis:"#DBAC84"},surface:{background:"#151515",foreground:"#e8e5e5",muted:"#1c1b1b",mutedForeground:"#848484",elevated:"#242121",elevatedForeground:"#FFFFFF",overlay:"#FFFFFF20",subtle:"#232323"},interactive:{border:"#494949",borderHover:"#202020",borderFocus:"#383838",selection:"#b1adad33",selectionForeground:"#FFFFFF",focus:"#FFC799",focusRing:"#FFC79940",cursor:"#FFFFFF",hover:"#ffffff1c",active:"#ffffff33"},status:{error:"#FF8080",errorForeground:"#101010",errorBackground:"#FF808020",errorBorder:"#FF808050",warning:"#FFC799",warningForeground:"#101010",warningBackground:"#FFC79920",warningBorder:"#FFC79950",success:"#99FFE4",successForeground:"#101010",successBackground:"#99FFE420",successBorder:"#99FFE450",info:"#FFC799",infoForeground:"#101010",infoBackground:"#FFC79920",infoBorder:"#FFC79950"},pr:{open:"#99FFE4",draft:"#A0A0A0",blocked:"#FFC799",merged:"#ca99ff",closed:"#FF8080"},syntax:{base:{background:"#141414",foreground:"#FFFFFF",comment:"#A0A0A0",keyword:"#FFC799",string:"#99FFE4",number:"#FF8080",function:"#FFC799",variable:"#FFFFFF",type:"#FFC799",operator:"#FF8080"},tokens:{boolean:"#FFC799",class:"#FFC799",className:"#FFC799",commentDoc:"#8A8A8A",constant:"#A0A0A0",decorator:"#FFC799",enum:"#FFC799",exception:"#FF8080",functionCall:"#FFC799",interface:"#FFC799",jsxTag:"#FFC799",key:"#FFC799",keywordImport:"#FF8080",label:"#FF8080",macro:"#8B8B8B",method:"#99FFE4",module:"#FF8080",namespace:"#FFC799",parameter:"#FFFFFF",preprocessor:"#FF8080",punctuation:"#A0A0A0",regex:"#99FFE4",storageModifier:"#8B8B8B",stringEscape:"#FFFFFF",struct:"#FFC799",tag:"#FFC799",tagAttribute:"#FFC799",tagAttributeValue:"#99FFE4",typeParameter:"#FFC799",url:"#A0A0A0",variableGlobal:"#FFC799",variableLocal:"#0C0C0C",variableOther:"#99FFE4",variableProperty:"#A0A0A0"},highlights:{diffAdded:"#99FFE4",diffAddedBackground:"#0D2818",diffModified:"#FFC799",diffModifiedBackground:"#141414",diffRemoved:"#FF8080",diffRemovedBackground:"#281A1A",lineNumber:"#282828",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#FFFFFF",heading2:"#FFFFFF",heading3:"#FFFFFF",heading4:"#FFFFFF",link:"#A0A0A0",linkHover:"#FFC799",inlineCode:"#bba2a2",inlineCodeBackground:"#292727",blockquote:"#FFFFFF",blockquoteBorder:"#1C1C1C",listMarker:"#FFFFFF99"},chat:{userMessage:"#FFFFFF",userMessageBackground:"#2b2a2a",assistantMessage:"#FFFFFF",assistantMessageBackground:"#101010",timestamp:"#A0A0A0",divider:"#1C1C1C"},tools:{background:"#14141480",border:"#48474780",headerHover:"#080808",icon:"#A0A0A0",title:"#FFFFFF",description:"#A0A0A0",edit:{added:"#99FFE4",addedBackground:"#99FFE425",removed:"#FF8080",removedBackground:"#FF808025",lineNumber:"#615f5f"}}},lf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},uf={metadata:cf,colors:df,config:lf},ff={id:"vesper-light",name:"Vesper",description:"Vesper",version:"1.0.0",variant:"light",tags:["light","palette"]},mf={primary:{base:"#a06535",hover:"#FFD2AD",active:"#D9A982",foreground:"#FFFFFF",muted:"#cf9c7280",emphasis:"#FFD2AD"},surface:{background:"#FFFFFF",foreground:"#101010",muted:"#F8F8F8",mutedForeground:"#6e6d6d",elevated:"#f6f5f5",elevatedForeground:"#101010",overlay:"#00000020",subtle:"#f5f3f3"},interactive:{border:"#d0cece",borderHover:"#E0E0E0",borderFocus:"#9e9e9e",selection:"#5e5b5b22",selectionForeground:"#000000",focus:"#be875b",focusRing:"#cf9c7240",cursor:"#000000",hover:"#5e5c5c22",active:"#48474722"},status:{error:"#d46868",errorForeground:"#FFFFFF",errorBackground:"#b95f5f20",errorBorder:"#b95f5f50",warning:"#cb7f40",warningForeground:"#FFFFFF",warningBackground:"#cf9c7220",warningBorder:"#cf9c7250",success:"#109b76",successForeground:"#FFFFFF",successBackground:"#99FFE420",successBorder:"#99FFE450",info:"#62bced",infoForeground:"#FFFFFF",infoBackground:"#cf9c7220",infoBorder:"#cf9c7250"},pr:{open:"#0f926f",draft:"#888787",blocked:"#bf6f2e",merged:"#9f5fc1",closed:"#c56161"},syntax:{base:{background:"#F8F8F8",foreground:"#101010",comment:"#868686",keyword:"#cf9c72",string:"#43ae91",number:"#b95f5f",function:"#cf9c72",variable:"#101010",type:"#cf9c72",operator:"#b95f5f"},tokens:{boolean:"#cf9c72",class:"#cf9c72",className:"#cf9c72",commentDoc:"#D0D0D0",constant:"#838282",decorator:"#cf9c72",enum:"#cf9c72",exception:"#b95f5f",functionCall:"#cf9c72",interface:"#cf9c72",jsxTag:"#cf9c72",key:"#cf9c72",keywordImport:"#b95f5f",label:"#b95f5f",macro:"#717070",method:"#74e8c9",module:"#b95f5f",namespace:"#cf9c72",parameter:"#101010",preprocessor:"#b95f5f",punctuation:"#717070",regex:"#67e7c5",storageModifier:"#7b7b7b",stringEscape:"#000000",struct:"#cf9c72",tag:"#cf9c72",tagAttribute:"#cf9c72",tagAttributeValue:"#6adebf",typeParameter:"#cf9c72",url:"#797878",variableGlobal:"#cf9c72",variableLocal:"#F0F0F0",variableOther:"#49dcb5",variableProperty:"#717070"},highlights:{diffAdded:"#56d8b5",diffAddedBackground:"#E8F5E8",diffModified:"#cf9c72",diffModifiedBackground:"#F0F0F0",diffRemoved:"#b95f5f",diffRemovedBackground:"#F5E8E8",lineNumber:"#D0D0D0",lineNumberActive:"#000000"}},markdown:{heading1:"#101010",heading2:"#101010",heading3:"#101010",heading4:"#101010",link:"#717070",linkHover:"#c48959",inlineCode:"#665050",inlineCodeBackground:"#f3f1f1",blockquote:"#101010",blockquoteBorder:"#E8E8E8",listMarker:"#10101099"},chat:{userMessage:"#101010",userMessageBackground:"#f4f1f1",assistantMessage:"#101010",assistantMessageBackground:"#FFFFFF",timestamp:"#717070",divider:"#E8E8E8"},tools:{background:"#F8F8F880",border:"#d0cece80",headerHover:"#E8E8E8",icon:"#717070",title:"#101010",description:"#717070",edit:{added:"#40d7af",addedBackground:"#99FFE425",removed:"#b95f5f",removedBackground:"#b95f5f25",lineNumber:"#b4b2b2"}}},gf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},pf={metadata:ff,colors:mf,config:gf},hf={id:"mono-plus-dark",name:"Mono Plus",description:"A pure monochromatic theme - dark variant with slight colors added",version:"1.0.0",variant:"dark",tags:["dark","monochrome","minimal"]},Ff={primary:{base:"#a2bee8",hover:"#E5E5E5",active:"#CCCCCC",foreground:"#000000",muted:"#FFFFFF80",emphasis:"#FFFFFF"},surface:{background:"#000000",foreground:"#E5E5E5",muted:"#0A0A0A",mutedForeground:"#808080",elevated:"#141414",elevatedForeground:"#E5E5E5",overlay:"#00000080",subtle:"#1A1A1A"},interactive:{border:"#454545",borderHover:"#333333",borderFocus:"#FFFFFF",selection:"#ffffff1f",selectionForeground:"#E5E5E5",focus:"#FFFFFF",focusRing:"#FFFFFF50",cursor:"#E5E5E5",hover:"#ffffff1f",active:"#ffffff1f"},status:{error:"#9e6a6a",errorForeground:"#0a0a0a",errorBackground:"#9e6a6a20",errorBorder:"#9e6a6a50",warning:"#9e8a6a",warningForeground:"#0a0a0a",warningBackground:"#9e8a6a20",warningBorder:"#9e8a6a50",success:"#6a8e6a",successForeground:"#0a0a0a",successBackground:"#6a8e6a20",successBorder:"#6a8e6a50",info:"#6a7e9e",infoForeground:"#0a0a0a",infoBackground:"#6a7e9e20",infoBorder:"#6a7e9e50"},pr:{open:"#6a8e6a",draft:"#8c8c8c",blocked:"#9e8a6a",merged:"#bda2e8",closed:"#9e6a6a"},syntax:{base:{background:"#0a0a0a",foreground:"#d4d4d4",comment:"#8c8c8c",keyword:"#dccdbeff",string:"#b6d8e6ff",number:"#e3bdadff",function:"#a2bee8",variable:"#d4d4d4",type:"#edcbb8ff",operator:"#dccdbeff"},tokens:{commentDoc:"#8c8c8c",stringEscape:"#b6d8e6ff",keywordImport:"#dccdbeff",storageModifier:"#dccdbeff",functionCall:"#a2bee8",method:"#a2bee8",variableProperty:"#c0dcc0ff",variableOther:"#d4d4d4",class:"#edcbb8ff",className:"#edcbb8ff",interface:"#edcbb8ff",tag:"#a2bee8",boolean:"#e3bdadff",url:"#b6d8e6ff",key:"#c0dcc0ff"},highlights:{diffAdded:"#6a8e6a",diffAddedBackground:"#6a8e6a20",diffRemoved:"#9e6a6a",diffRemovedBackground:"#9e6a6a20",lineNumber:"#7c7c7c",lineNumberActive:"#d4d4d4"}},markdown:{heading1:"#FFFFFF",heading2:"#F2F2F2",heading3:"#E5E5E5",heading4:"#D9D9D9",link:"#CCCCCC",linkHover:"#a2bee8",inlineCode:"#a2bee8",inlineCodeBackground:"#1A1A1A",blockquote:"#808080",blockquoteBorder:"#333333",listMarker:"#99999999"},chat:{userMessage:"#E5E5E5",userMessageBackground:"#1A1A1A",assistantMessage:"#E5E5E5",assistantMessageBackground:"#000000",timestamp:"#808080",divider:"#333333"},tools:{background:"#0A0A0A50",border:"#4040409d",headerHover:"#33333350",icon:"#A6A6A6",title:"#E5E5E5",description:"#808080",edit:{added:"#6a8e6a",addedBackground:"#6a8e6a20",removed:"#9e6a6a",removedBackground:"#9e6a6a20",lineNumber:"#2a2a2a"}}},yf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},bf={metadata:hf,colors:Ff,config:yf},Af={id:"mono-plus-light",name:"Mono Plus",description:"A pure monochromatic theme - light variant with slight colors added",version:"1.0.0",variant:"light",tags:["light","monochrome","minimal"]},wf={primary:{base:"#4a6a9e",hover:"#1A1A1A",active:"#333333",foreground:"#FFFFFF",muted:"#00000080",emphasis:"#000000"},surface:{background:"#FFFFFF",foreground:"#1A1A1A",muted:"#F5F5F5",mutedForeground:"#6f6f6f",elevated:"#FAFAFA",elevatedForeground:"#1A1A1A",overlay:"#00000020",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#B3B3B3",borderFocus:"#000000",selection:"#00000015",selectionForeground:"#1A1A1A",focus:"#000000",focusRing:"#00000040",cursor:"#1A1A1A",hover:"#00000010",active:"#00000015"},status:{error:"#8a5a5a",errorForeground:"#fafafa",errorBackground:"#8a5a5a18",errorBorder:"#8a5a5a40",warning:"#8a7a5a",warningForeground:"#fafafa",warningBackground:"#8a7a5a18",warningBorder:"#8a7a5a40",success:"#5a7a5a",successForeground:"#fafafa",successBackground:"#5a7a5a18",successBorder:"#5a7a5a40",info:"#5a6a8a",infoForeground:"#fafafa",infoBackground:"#5a6a8a18",infoBorder:"#5a6a8a40"},pr:{open:"#6a8e6a",draft:"#8c8c8c",blocked:"#8a7a5a",merged:"#8769b6",closed:"#8a5a5a"},syntax:{base:{background:"#f5f5f5",foreground:"#2a2a2a",comment:"#8c8c8c",keyword:"#6a5a4a",string:"#4a6a7a",number:"#7a5a4a",function:"#4a6a9e",variable:"#2a2a2a",type:"#6a5040",operator:"#6a5a4a"},tokens:{commentDoc:"#8c8c8c",stringEscape:"#4a6a7a",keywordImport:"#6a5a4a",storageModifier:"#6a5a4a",functionCall:"#4a6a9e",method:"#4a6a9e",variableProperty:"#4a6a4a",variableOther:"#2a2a2a",class:"#6a5040",className:"#6a5040",interface:"#6a5040",tag:"#4a6a9e",boolean:"#7a5a4a",url:"#4a6a7a",key:"#4a6a4a"},highlights:{diffAdded:"#5a7a5a",diffAddedBackground:"#5a7a5a18",diffRemoved:"#8a5a5a",diffRemovedBackground:"#8a5a5a18",lineNumber:"#b0b0b0",lineNumberActive:"#2a2a2a"}},markdown:{heading1:"#000000",heading2:"#0D0D0D",heading3:"#1A1A1A",heading4:"#262626",link:"#333333",linkHover:"#4a6a9e",inlineCode:"#4a6a9e",inlineCodeBackground:"#f1f1f1",blockquote:"#808080",blockquoteBorder:"#D9D9D9",listMarker:"#66666699"},chat:{userMessage:"#1A1A1A",userMessageBackground:"#E5E5E5",assistantMessage:"#1A1A1A",assistantMessageBackground:"#FFFFFF",timestamp:"#808080",divider:"#D9D9D9"},tools:{background:"#F5F5F550",border:"#B3B3B380",headerHover:"#D9D9D9",icon:"#666666",title:"#1A1A1A",description:"#808080",edit:{added:"#5a7a5a",addedBackground:"#5a7a5a18",removed:"#8a5a5a",removedBackground:"#8a5a5a18",lineNumber:"#d0d0d0"}}},Ef={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Cf={metadata:Af,colors:wf,config:Ef},Bf={id:"mono-dark",name:"Mono",description:"A pure monochromatic theme - dark variant with shades of grey",version:"1.0.0",variant:"dark",tags:["dark","monochrome","minimal","grayscale"]},Df={primary:{base:"#FFFFFF",hover:"#E5E5E5",active:"#CCCCCC",foreground:"#000000",muted:"#FFFFFF80",emphasis:"#FFFFFF"},surface:{background:"#000000",foreground:"#E5E5E5",muted:"#0A0A0A",mutedForeground:"#808080",elevated:"#141414",elevatedForeground:"#E5E5E5",overlay:"#00000080",subtle:"#1A1A1A"},interactive:{border:"#454545",borderHover:"#333333",borderFocus:"#FFFFFF",selection:"#ffffff1f",selectionForeground:"#E5E5E5",focus:"#FFFFFF",focusRing:"#FFFFFF50",cursor:"#E5E5E5",hover:"#ffffff1f",active:"#ffffff1f"},status:{error:"#666666",errorForeground:"#000000",errorBackground:"#ffffff10",errorBorder:"#ffffff20",warning:"#999999",warningForeground:"#000000",warningBackground:"#ffffff12",warningBorder:"#ffffff25",success:"#E5E5E5",successForeground:"#000000",successBackground:"#ffffff18",successBorder:"#ffffff30",info:"#A6A6A6",infoForeground:"#000000",infoBackground:"#ffffff14",infoBorder:"#ffffff28"},pr:{open:"#E5E5E5",draft:"#B3B3B3",blocked:"#999999",merged:"#CCCCCC",closed:"#666666"},syntax:{base:{background:"#0A0A0A",foreground:"#E5E5E5",comment:"#666666",keyword:"#FFFFFF",string:"#B3B3B3",number:"#999999",function:"#E5E5E5",variable:"#CCCCCC",type:"#D9D9D9",operator:"#808080"},tokens:{commentDoc:"#595959",stringEscape:"#E5E5E5",keywordImport:"#FFFFFF",storageModifier:"#E5E5E5",functionCall:"#D9D9D9",method:"#CCCCCC",variableProperty:"#B3B3B3",variableOther:"#CCCCCC",variableGlobal:"#999999",variableLocal:"#1A1A1A",parameter:"#CCCCCC",constant:"#E5E5E5",class:"#FFFFFF",className:"#FFFFFF",interface:"#D9D9D9",struct:"#E5E5E5",enum:"#E5E5E5",typeParameter:"#D9D9D9",namespace:"#CCCCCC",module:"#B3B3B3",tag:"#E5E5E5",jsxTag:"#FFFFFF",tagAttribute:"#B3B3B3",tagAttributeValue:"#999999",boolean:"#CCCCCC",decorator:"#999999",label:"#808080",punctuation:"#666666",macro:"#D9D9D9",preprocessor:"#B3B3B3",regex:"#A6A6A6",url:"#CCCCCC",key:"#E5E5E5",exception:"#999999"},highlights:{diffAdded:"#E5E5E5",diffAddedBackground:"#ffffff18",diffRemoved:"#666666",diffRemovedBackground:"#ffffff0d",diffModified:"#B3B3B3",diffModifiedBackground:"#ffffff12",lineNumber:"#404040",lineNumberActive:"#E5E5E5"}},markdown:{heading1:"#FFFFFF",heading2:"#F2F2F2",heading3:"#E5E5E5",heading4:"#D9D9D9",link:"#CCCCCC",linkHover:"#FFFFFF",inlineCode:"#B3B3B3",inlineCodeBackground:"#1A1A1A",blockquote:"#808080",blockquoteBorder:"#333333",listMarker:"#99999999"},chat:{userMessage:"#E5E5E5",userMessageBackground:"#1A1A1A",assistantMessage:"#E5E5E5",assistantMessageBackground:"#000000",timestamp:"#808080",divider:"#333333"},tools:{background:"#0A0A0A50",border:"#4040409d",headerHover:"#33333350",icon:"#A6A6A6",title:"#E5E5E5",description:"#808080",edit:{added:"#E5E5E5",addedBackground:"#ffffff20",removed:"#666666",removedBackground:"#ffffff10",lineNumber:"#404040"}}},kf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},vf={metadata:Bf,colors:Df,config:kf},Sf={id:"mono-light",name:"Mono",description:"A pure monochromatic theme - light variant with shades of grey",version:"1.0.0",variant:"light",tags:["light","monochrome","minimal","grayscale"]},Mf={primary:{base:"#000000",hover:"#1A1A1A",active:"#333333",foreground:"#FFFFFF",muted:"#00000080",emphasis:"#000000"},surface:{background:"#FFFFFF",foreground:"#1A1A1A",muted:"#F5F5F5",mutedForeground:"#757575",elevated:"#FAFAFA",elevatedForeground:"#1A1A1A",overlay:"#00000020",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#B3B3B3",borderFocus:"#000000",selection:"#00000015",selectionForeground:"#1A1A1A",focus:"#000000",focusRing:"#00000040",cursor:"#1A1A1A",hover:"#00000010",active:"#00000015"},status:{error:"#999999",errorForeground:"#FFFFFF",errorBackground:"#00000008",errorBorder:"#00000015",warning:"#666666",warningForeground:"#FFFFFF",warningBackground:"#0000000a",warningBorder:"#00000018",success:"#1A1A1A",successForeground:"#FFFFFF",successBackground:"#00000012",successBorder:"#00000020",info:"#595959",infoForeground:"#FFFFFF",infoBackground:"#0000000c",infoBorder:"#0000001a"},pr:{open:"#1A1A1A",draft:"#4D4D4D",blocked:"#999999",merged:"#333333",closed:"#666666"},syntax:{base:{background:"#F5F5F5",foreground:"#1A1A1A",comment:"#999999",keyword:"#000000",string:"#4D4D4D",number:"#666666",function:"#1A1A1A",variable:"#333333",type:"#262626",operator:"#808080"},tokens:{commentDoc:"#ABABAB",stringEscape:"#1A1A1A",keywordImport:"#000000",storageModifier:"#1A1A1A",functionCall:"#262626",method:"#333333",variableProperty:"#4D4D4D",variableOther:"#333333",variableGlobal:"#666666",variableLocal:"#E5E5E5",parameter:"#333333",constant:"#1A1A1A",class:"#000000",className:"#000000",interface:"#262626",struct:"#1A1A1A",enum:"#1A1A1A",typeParameter:"#262626",namespace:"#333333",module:"#4D4D4D",tag:"#1A1A1A",jsxTag:"#000000",tagAttribute:"#4D4D4D",tagAttributeValue:"#666666",boolean:"#333333",decorator:"#666666",label:"#808080",punctuation:"#999999",macro:"#262626",preprocessor:"#4D4D4D",regex:"#595959",url:"#333333",key:"#1A1A1A",exception:"#666666"},highlights:{diffAdded:"#1A1A1A",diffAddedBackground:"#00000012",diffRemoved:"#999999",diffRemovedBackground:"#00000008",diffModified:"#595959",diffModifiedBackground:"#0000000c",lineNumber:"#CCCCCC",lineNumberActive:"#1A1A1A"}},markdown:{heading1:"#000000",heading2:"#0D0D0D",heading3:"#1A1A1A",heading4:"#262626",link:"#333333",linkHover:"#000000",inlineCode:"#4D4D4D",inlineCodeBackground:"#f1f1f1",blockquote:"#808080",blockquoteBorder:"#D9D9D9",listMarker:"#66666699"},chat:{userMessage:"#1A1A1A",userMessageBackground:"#E5E5E5",assistantMessage:"#1A1A1A",assistantMessageBackground:"#FFFFFF",timestamp:"#808080",divider:"#D9D9D9"},tools:{background:"#F5F5F550",border:"#B3B3B380",headerHover:"#D9D9D9",icon:"#666666",title:"#1A1A1A",description:"#808080",edit:{added:"#1A1A1A",addedBackground:"#00000015",removed:"#999999",removedBackground:"#0000000a",lineNumber:"#CCCCCC"}}},Tf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Pf={metadata:Sf,colors:Mf,config:Tf},Rf={id:"vitesse-dark-dark",name:"Vitesse Dark",description:"Converted from VS Code theme",version:"1.0.0",variant:"dark",tags:["dark","converted","vscode"]},If={primary:{base:"#4d9375",hover:"#4d9375",active:"#5cb08c",foreground:"#121212",muted:"#4d937580",emphasis:"#64bf98"},surface:{background:"#121212",foreground:"#dbd7caee",muted:"#171717",mutedForeground:"#c0beb99c",elevated:"#1a1a1a",elevatedForeground:"#dbd7caee",overlay:"#12121280",subtle:"#212020"},interactive:{border:"#393939",borderHover:"#3c3c3c",borderFocus:"#00000000",selection:"#eeeeee18",selectionForeground:"#dbd7caee",focus:"#00000000",focusRing:"#0000000050",cursor:"#CECDC3",hover:"#eeeeee14",active:"#eeeeee18"},status:{error:"#cb7676",errorForeground:"#121212",errorBackground:"#cb767620",errorBorder:"#cb767650",warning:"#d4976c",warningForeground:"#121212",warningBackground:"#d4976c20",warningBorder:"#d4976c50",success:"#4d9375",successForeground:"#121212",successBackground:"#4d937520",successBorder:"#4d937550",info:"#6394bf",infoForeground:"#121212",infoBackground:"#6394bf20",infoBorder:"#6394bf50"},pr:{open:"#4d9375",draft:"#747f74",blocked:"#d4976c",merged:"#6c43be",closed:"#cb7676"},syntax:{base:{background:"#121212",foreground:"#dbd7caee",comment:"#758575dd",keyword:"#4d9375",string:"#c98a7d",number:"#4C9A91",function:"#80a665",variable:"#bd976a",type:"#5d99a9",operator:"#cb7676"},tokens:{commentDoc:"#575653",stringEscape:"#dbd7caee",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#80a665",method:"#879A39",variableProperty:"#b8a965",variableOther:"#879A39",class:"#6872ab",className:"#6872ab",interface:"#5d99a9",tag:"#4d9375",boolean:"#4d9375",url:"#c98a7d",key:"#b8a965"},highlights:{diffAdded:"#4d9375",diffAddedBackground:"#4d937520",diffRemoved:"#cb7676",diffRemovedBackground:"#cb767620",lineNumber:"#dedcd550",lineNumberActive:"#bfbaaa"}},markdown:{heading1:"#4d9375",heading2:"#4d9375",heading3:"#4d9375",heading4:"#dbd7caee",link:"#4d9375",linkHover:"#4d9375",inlineCode:"#80a665",inlineCodeBackground:"#121212",blockquote:"#dedcd550",blockquoteBorder:"#ffffff15",listMarker:"#4d937599"},chat:{userMessage:"#dbd7caee",userMessageBackground:"#252525",assistantMessage:"#dbd7caee",assistantMessageBackground:"#121212",timestamp:"#dedcd550",divider:"#ffffff15"},tools:{background:"#12121250",border:"#2d2c2c",headerHover:"#ffffff1550",icon:"#dedcd5a4",title:"#dbd7caee",description:"#dedcd550",edit:{added:"#4d9375",addedBackground:"#4d937520",removed:"#cb7676",removedBackground:"#cb767620",lineNumber:"#ffffff24"}}},xf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Of={metadata:Rf,colors:If,config:xf},_f={id:"vitesse-light-light",name:"Vitesse Light",description:"Converted from VS Code theme",version:"1.0.0",variant:"light",tags:["light","converted","vscode"]},Nf={primary:{base:"#1c6b48",hover:"#1c6b48",active:"#228056",foreground:"#ffffff",muted:"#1c6b4880",emphasis:"#248b5e"},surface:{background:"#ffffff",foreground:"#2c2c28",muted:"#ecebeb",mutedForeground:"#5b5c54cb",elevated:"#f7f7f7",elevatedForeground:"#393a34",overlay:"#ffffff80",subtle:"#ecebeb"},interactive:{border:"#d4d0d0",borderHover:"#cbc7c7",borderFocus:"#635454b8",selection:"#22222218",selectionForeground:"#393a34",focus:"#00000000",focusRing:"#0000000050",cursor:"#CECDC3",hover:"#22222218",active:"#22222218"},status:{error:"#ab5959",errorForeground:"#ffffff",errorBackground:"#ab595920",errorBorder:"#ab595950",warning:"#a65e2b",warningForeground:"#ffffff",warningBackground:"#a65e2b20",warningBorder:"#a65e2b50",success:"#1e754f",successForeground:"#ffffff",successBackground:"#1e754f20",successBorder:"#1e754f50",info:"#296aa3",infoForeground:"#ffffff",infoBackground:"#296aa320",infoBorder:"#296aa350"},pr:{open:"#1e754f",draft:"#a0ada0",blocked:"#a65e2b",merged:"#5843be",closed:"#ab5959"},syntax:{base:{background:"#ffffff",foreground:"#393a34",comment:"#a0ada0",keyword:"#1e754f",string:"#b56959",number:"#2f798a",function:"#59873a",variable:"#b07d48",type:"#2e808f",operator:"#ab5959"},tokens:{commentDoc:"#575653",stringEscape:"#393a34",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#59873a",method:"#879A39",variableProperty:"#998418",variableOther:"#879A39",class:"#5a6aa6",className:"#5a6aa6",interface:"#2e808f",tag:"#1e754f",boolean:"#1e754f",url:"#b56959",key:"#998418"},highlights:{diffAdded:"#1e754f",diffAddedBackground:"#1e754f20",diffRemoved:"#ab5959",diffRemovedBackground:"#ab595920",lineNumber:"#393a3450",lineNumberActive:"#4e4f47"}},markdown:{heading1:"#2c2c28",heading2:"#2c2c28",heading3:"#2c2c28",heading4:"#2c2c28",link:"#1e754f",linkHover:"#1c6b48",inlineCode:"#3a631e",inlineCodeBackground:"#f7f3f395",blockquote:"#2c2c2850",blockquoteBorder:"#00000015",listMarker:"#1c6b4899"},chat:{userMessage:"#2c2c28",userMessageBackground:"#f4f1f1",assistantMessage:"#393a34",assistantMessageBackground:"#ffffff",timestamp:"#393a3450",divider:"#00000015"},tools:{background:"#ffffff50",border:"#dbd7d7",headerHover:"#0000001550",icon:"#21221e86",title:"#393a34",description:"#404139b6",edit:{added:"#1e754f",addedBackground:"#1e754f20",removed:"#ab5959",removedBackground:"#ab595920",lineNumber:"#b9b6b6"}}},Uf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Lf={metadata:_f,colors:Nf,config:Uf},Hf=[ls,us,el,nl,cl,fl,hl,Al,Bl,Sl,Rl,_l,Hl,Gl,Kl,Xl,ou,su,lu,gu,yu,Eu,ku,Tu,Hu,Gu,Ku,Xu,of,sf,uf,pf,bf,Cf,vf,Pf,Of,Lf].map(e=>Ht(e)),jf={id:"flexoki-light",name:"Flexoki",description:"An inky color scheme for prose and code - light variant",version:"1.0.0",variant:"light",tags:["light","warm","natural","paper"]},zf={primary:{base:"#BC5215",hover:"#F9AE77",active:"#DA702C",foreground:"#fffdf4",muted:"#BC521580",emphasis:"#F9AE77"},surface:{background:"#fffdf4",foreground:"#100F0F",muted:"#f6f5ee",mutedForeground:"#686663",elevated:"#fbfaf2",elevatedForeground:"#100F0F",overlay:"#100F0F20",subtle:"#f7f4ec"},interactive:{border:"#DAD8CE",borderHover:"#CECDC3",borderFocus:"#BC5215",selection:"#76736f30",selectionForeground:"#100F0F",focus:"#BC5215",focusRing:"#BC521540",cursor:"#100F0F",hover:"#76736f20",active:"#76736f20"},status:{error:"#AF3029",errorForeground:"#fffdf4",errorBackground:"#D14D4120",errorBorder:"#D14D4150",warning:"#BC5215",warningForeground:"#fffdf4",warningBackground:"#DA702C20",warningBorder:"#DA702C50",success:"#66800B",successForeground:"#fffdf4",successBackground:"#879A3920",successBorder:"#879A3950",info:"#205EA6",infoForeground:"#fffdf4",infoBackground:"#4385BE20",infoBorder:"#4385BE50"},pr:{open:"#66800B",draft:"#6F6E69",blocked:"#BC5215",merged:"#5E409D",closed:"#AF3029"},syntax:{base:{background:"#f6f5ee",foreground:"#100F0F",comment:"#6F6E69",keyword:"#205EA6",string:"#24837B",number:"#5E409D",function:"#BC5215",variable:"#100F0F",type:"#AD8301",operator:"#AF3029"},tokens:{commentDoc:"#B7B5AC",stringEscape:"#100F0F",keywordImport:"#AF3029",storageModifier:"#205EA6",functionCall:"#BC5215",method:"#66800B",variableProperty:"#205EA6",variableOther:"#66800B",variableGlobal:"#A02F6F",variableLocal:"#E6E4D9",parameter:"#100F0F",constant:"#100F0F",class:"#BC5215",className:"#BC5215",interface:"#AD8301",struct:"#BC5215",enum:"#BC5215",typeParameter:"#BC5215",namespace:"#AD8301",module:"#AF3029",tag:"#205EA6",jsxTag:"#A02F6F",tagAttribute:"#AD8301",tagAttributeValue:"#24837B",boolean:"#AD8301",decorator:"#AD8301",label:"#A02F6F",punctuation:"#6F6E69",macro:"#205EA6",preprocessor:"#A02F6F",regex:"#24837B",url:"#205EA6",key:"#BC5215",exception:"#A02F6F"},highlights:{diffAdded:"#66800B",diffAddedBackground:"#879A3920",diffRemoved:"#AF3029",diffRemovedBackground:"#D14D4120",diffModified:"#205EA6",diffModifiedBackground:"#4385BE20",lineNumber:"#CECDC3",lineNumberActive:"#100F0F"}},markdown:{heading1:"#100F0F",heading2:"#100F0F",heading3:"#100F0F",heading4:"#100F0F",link:"#205EA6",linkHover:"#4385BE",inlineCode:"#24837B",inlineCodeBackground:"#f6f5ee",blockquote:"#6F6E69",blockquoteBorder:"#DAD8CE",listMarker:"#AD830199"},chat:{userMessage:"#100F0F",userMessageBackground:"#f7f4ec",assistantMessage:"#100F0F",assistantMessageBackground:"#fffdf4",timestamp:"#6F6E69",divider:"#DAD8CE"},tools:{background:"#f6f5ee50",border:"#b4b2a980",headerHover:"#DAD8CE",icon:"#6F6E69",title:"#100F0F",description:"#6F6E69",edit:{added:"#66800B",addedBackground:"#66800B25",removed:"#AF3029",removedBackground:"#AF302925",lineNumber:"#CECDC3"}}},$f={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gf={metadata:jf,colors:zf,config:$f},qf={id:"flexoki-dark",name:"Flexoki",description:"An inky color scheme for prose and code - dark variant",version:"1.0.0",variant:"dark",tags:["dark","warm","natural","ink"]},Wf={primary:{base:"#DA702C",hover:"#DA702C",active:"#F9AE77",foreground:"#171515",muted:"#DA702C80",emphasis:"#F9AE77"},surface:{background:"#171515",foreground:"#CECDC3",muted:"#1C1B1A",mutedForeground:"#807e79",elevated:"#1c1a19",elevatedForeground:"#CECDC3",overlay:"#00000080",subtle:"#1e1d1c"},interactive:{border:"#343331",borderHover:"#403E3C",borderFocus:"#DA702C",selection:"#f4f4f41f",selectionForeground:"#CECDC3",focus:"#DA702C",focusRing:"#DA702C50",cursor:"#CECDC3",hover:"#ffffff18",active:"#ffffff1f"},status:{error:"#D14D41",errorForeground:"#171515",errorBackground:"#AF302920",errorBorder:"#AF302950",warning:"#DA702C",warningForeground:"#171515",warningBackground:"#BC521520",warningBorder:"#BC521550",success:"#A0AF54",successForeground:"#171515",successBackground:"#66800B20",successBorder:"#66800B50",info:"#4385BE",infoForeground:"#171515",infoBackground:"#205EA620",infoBorder:"#205EA650"},pr:{open:"#A0AF54",draft:"#878580",blocked:"#DA702C",merged:"#8B7EC8",closed:"#D14D41"},syntax:{base:{background:"#1C1B1A",foreground:"#CECDC3",comment:"#878580",keyword:"#4385BE",string:"#3AA99F",number:"#8B7EC8",function:"#DA702C",variable:"#CECDC3",type:"#D0A215",operator:"#D14D41"},tokens:{commentDoc:"#575653",stringEscape:"#CECDC3",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#DA702C",method:"#879A39",variableProperty:"#4385BE",variableOther:"#879A39",variableGlobal:"#CE5D97",variableLocal:"#282726",parameter:"#CECDC3",constant:"#CECDC3",class:"#DA702C",className:"#DA702C",interface:"#D0A215",struct:"#DA702C",enum:"#DA702C",typeParameter:"#DA702C",namespace:"#D0A215",module:"#D14D41",tag:"#4385BE",jsxTag:"#CE5D97",tagAttribute:"#D0A215",tagAttributeValue:"#3AA99F",boolean:"#D0A215",decorator:"#D0A215",label:"#CE5D97",punctuation:"#878580",macro:"#4385BE",preprocessor:"#CE5D97",regex:"#3AA99F",url:"#4385BE",key:"#DA702C",exception:"#CE5D97"},highlights:{diffAdded:"#879A39",diffAddedBackground:"#66800B20",diffRemoved:"#D14D41",diffRemovedBackground:"#AF302920",diffModified:"#4385BE",diffModifiedBackground:"#205EA620",lineNumber:"#403E3C",lineNumberActive:"#CECDC3"}},markdown:{heading1:"#fbf9e6",heading2:"#e6e4d2",heading3:"#CECDC3",heading4:"#CECDC3",link:"#4385BE",linkHover:"#205EA6",inlineCode:"#A0AF53",inlineCodeBackground:"#1C1B1A",blockquote:"#878580",blockquoteBorder:"#343331",listMarker:"#D0A21599"},chat:{userMessage:"#CECDC3",userMessageBackground:"#27180E",assistantMessage:"#CECDC3",assistantMessageBackground:"#171515",timestamp:"#878580",divider:"#343331"},tools:{background:"#1C1B1A50",border:"#42403e9d",headerHover:"#34333150",icon:"#aca7a1",title:"#CECDC3",description:"#878580",edit:{added:"#879A39",addedBackground:"#66800B25",removed:"#D14D41",removedBackground:"#AF302925",lineNumber:"#403E3C"}}},Vf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Kf={metadata:qf,colors:Wf,config:Vf},fs=Ht(Gf),Jf=Ht(Kf),Yf=Ht(us),Qf=Ht(ls),ms="flexoki-light",gs="flexoki-dark",dr=[Yf,Qf,fs,Jf,...Hf.filter(e=>e.metadata.id!=="openchamber-light"&&e.metadata.id!=="openchamber-dark")];function Xf(e){const t=e==="app-light"?"flexoki-light":e==="app-dark"?"flexoki-dark":e;return dr.find(o=>o.metadata.id===t)}function Oh(e){const t=e?"dark":"light",r=Xf(e?gs:ms);return r&&r.metadata.variant===t?r:dr.find(n=>n.metadata.variant===t)??dr[0]??fs}const Zf=[{id:"finder",label:"Finder",appName:"Finder"},{id:"terminal",label:"Terminal",appName:"Terminal"},{id:"iterm2",label:"iTerm2",appName:"iTerm"},{id:"ghostty",label:"Ghostty",appName:"Ghostty"},{id:"vscode",label:"VS Code",appName:"Visual Studio Code"},{id:"vscode-insiders",label:"VS Code Insiders",appName:"Visual Studio Code - Insiders"},{id:"intellij",label:"IntelliJ",appName:"IntelliJ IDEA"},{id:"visual-studio",label:"Visual Studio",appName:"Visual Studio"},{id:"cursor",label:"Cursor",appName:"Cursor"},{id:"android-studio",label:"Android Studio",appName:"Android Studio"},{id:"pycharm",label:"PyCharm",appName:"PyCharm"},{id:"xcode",label:"Xcode",appName:"Xcode"},{id:"sublime-text",label:"Sublime",appName:"Sublime Text"},{id:"webstorm",label:"WebStorm",appName:"WebStorm"},{id:"rider",label:"Rider",appName:"Rider"},{id:"zed",label:"Zed",appName:"Zed"},{id:"phpstorm",label:"PhpStorm",appName:"PhpStorm"},{id:"eclipse",label:"Eclipse",appName:"Eclipse"},{id:"windsurf",label:"Windsurf",appName:"Windsurf"},{id:"vscodium",label:"VSCodium",appName:"VSCodium"},{id:"rustrover",label:"RustRover",appName:"RustRover"},{id:"kiro",label:"Kiro",appName:"Kiro"},{id:"antigravity",label:"Antigravity",appName:"Antigravity"},{id:"trae",label:"Trae",appName:"Trae"}],em="finder",_h=new Set(["finder","terminal"]),tm=e=>{if(typeof window>"u")return e;const t=window.__OPENCHAMBER_PLATFORM__;if(e.id==="finder"){if(t==="win32")return{...e,label:"Explorer",appName:"File Explorer"};if(t==="linux")return{...e,label:"File Manager"}}return e},Nh=e=>{if(!e)return null;const t=Zf.find(o=>o.id===e)??null;return t?tm(t):null},om=e=>{if(!(typeof window>"u")&&!(typeof window.__OPENCHAMBER_HOME__=="string"&&window.__OPENCHAMBER_HOME__.length>0))try{window.__OPENCHAMBER_HOME__=e}catch{}},Un="openchamber.settingsMirror.v2.index",rm="openchamber.settingsMirror.v2:",nm=5,Ln=e=>`${rm}${encodeURIComponent(e)}`,ue=(e,t)=>{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)},am=(e,t)=>{const o={themeId:e.themeId,themeVariant:e.themeVariant,lightThemeId:e.lightThemeId,darkThemeId:e.darkThemeId,useSystemTheme:e.useSystemTheme,lastDirectory:e.lastDirectory,homeDirectory:e.homeDirectory,projects:e.projects,activeProjectId:e.activeProjectId,pinnedDirectories:e.pinnedDirectories,gitmojiEnabled:e.gitmojiEnabled,directoryShowHidden:e.directoryShowHidden,filesViewShowGitignored:e.filesViewShowGitignored,openInAppId:e.openInAppId,pwaAppName:e.pwaAppName,mobileKeyboardMode:e.mobileKeyboardMode,openCodeUpdateToastDismissedVersion:e.openCodeUpdateToastDismissedVersion,dictationEnabled:e.dictationEnabled,sttProvider:e.sttProvider,sttServerUrl:e.sttServerUrl,sttModel:e.sttModel,sttLocalModel:e.sttLocalModel,sttLanguage:e.sttLanguage};localStorage.setItem(Ln(t),JSON.stringify(o));let r=[];try{const a=JSON.parse(localStorage.getItem(Un)??"[]");Array.isArray(a)&&(r=a.filter(s=>typeof s=="string"))}catch{r=[]}const n=[t,...r.filter(a=>a!==t)].slice(0,nm);for(const a of r)n.includes(a)||localStorage.removeItem(Ln(a));localStorage.setItem(Un,JSON.stringify(n))},sm=e=>{if(!(typeof window>"u")){if(am(e,L()),ue("selectedThemeId",e.themeId||null),ue("selectedThemeVariant",e.themeVariant||null),ue("lightThemeId",e.lightThemeId||null),ue("darkThemeId",e.darkThemeId||null),ue("useSystemTheme",typeof e.useSystemTheme=="boolean"?String(e.useSystemTheme):null),ue("lastDirectory",e.lastDirectory||null),e.homeDirectory?(localStorage.setItem("homeDirectory",e.homeDirectory),om(e.homeDirectory)):localStorage.removeItem("homeDirectory"),Array.isArray(e.projects)&&e.projects.length>0?localStorage.setItem("projects",JSON.stringify(e.projects)):localStorage.removeItem("projects"),e.activeProjectId?localStorage.setItem("activeProjectId",e.activeProjectId):localStorage.removeItem("activeProjectId"),Array.isArray(e.pinnedDirectories)&&e.pinnedDirectories.length>0?localStorage.setItem("pinnedDirectories",JSON.stringify(e.pinnedDirectories)):localStorage.removeItem("pinnedDirectories"),Array.isArray(e.projects)&&e.projects.length>0){const t=e.projects.filter(o=>o.sidebarCollapsed===!0).map(o=>o.id).filter(o=>typeof o=="string"&&o.length>0);t.length>0?localStorage.setItem("oc.sessions.projectCollapse",JSON.stringify(t)):localStorage.removeItem("oc.sessions.projectCollapse")}else localStorage.removeItem("oc.sessions.projectCollapse");if(typeof e.gitmojiEnabled=="boolean"?localStorage.setItem("gitmojiEnabled",String(e.gitmojiEnabled)):localStorage.removeItem("gitmojiEnabled"),typeof e.directoryShowHidden=="boolean"?localStorage.setItem("directoryTreeShowHidden",e.directoryShowHidden?"true":"false"):localStorage.removeItem("directoryTreeShowHidden"),typeof e.filesViewShowGitignored=="boolean"?localStorage.setItem("filesViewShowGitignored",e.filesViewShowGitignored?"true":"false"):localStorage.removeItem("filesViewShowGitignored"),ue("openInAppId",typeof e.openInAppId=="string"&&e.openInAppId.length>0?e.openInAppId:null),typeof e.pwaAppName=="string"){const t=e.pwaAppName.trim().replace(/\s+/g," ").slice(0,64);t.length>0?localStorage.setItem("openchamber.pwaName",t):localStorage.removeItem("openchamber.pwaName")}else localStorage.removeItem("openchamber.pwaName");if(Xa(e.mobileKeyboardMode),typeof e.openCodeUpdateToastDismissedVersion=="string"){const t=e.openCodeUpdateToastDismissedVersion.trim();t?localStorage.setItem("opencode-update-toast-dismissed-version",t):localStorage.removeItem("opencode-update-toast-dismissed-version")}else localStorage.removeItem("opencode-update-toast-dismissed-version");typeof e.dictationEnabled=="boolean"?localStorage.setItem("dictationEnabled",String(e.dictationEnabled)):localStorage.removeItem("dictationEnabled"),e.sttProvider==="local"||e.sttProvider==="openai-compatible"?localStorage.setItem("sttProvider",e.sttProvider):localStorage.removeItem("sttProvider"),ue("sttServerUrl",typeof e.sttServerUrl=="string"?e.sttServerUrl:null),ue("sttModel",typeof e.sttModel=="string"?e.sttModel:null),ue("sttLocalModel",typeof e.sttLocalModel=="string"?e.sttLocalModel:null),ue("sttLanguage",typeof e.sttLanguage=="string"?e.sttLanguage:null)}},lr=e=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("openchamber:settings-synced",{detail:e}))};let ur="idle",Xt=null;const fr=new Set,Uh=()=>ur,Lh=e=>(fr.add(e),()=>fr.delete(e)),Hh=e=>{Be(e)},Be=e=>{Xt&&(clearTimeout(Xt),Xt=null);const t=e==="saved"?"idle":e;t!==ur&&(ur=t,fr.forEach(o=>o())),t==="error"&&(Xt=setTimeout(()=>Be("saved"),6e3)),!(typeof window>"u")&&window.dispatchEvent(new CustomEvent("openchamber:settings-save-state",{detail:e}))},im=e=>{if(!Array.isArray(e))return;const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r,a=typeof n.id=="string"?n.id.trim():"",s=typeof n.label=="string"?n.label.trim():"",i=typeof n.source=="string"?n.source.trim():"",c=typeof n.subpath=="string"?n.subpath.trim():"",d=typeof n.gitIdentityId=="string"?n.gitIdentityId.trim():"";!a||!s||!i||o.has(a)||(o.add(a),t.push({id:a,label:s,source:i,...c?{subpath:c}:{},...d?{gitIdentityId:d}:{}}))}return t},cm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[o,r]of Object.entries(e)){const n=typeof o=="string"?o.trim():"",a=typeof r=="string"?r.trim():"";!n||!a||(t[n]=a)}return t},dm=(e,t)=>{const o=Object.entries(e),r=Object.entries(t);return o.length!==r.length?!1:o.every(([n,a])=>t[n]===a)},Yo=(e,t)=>e.length===t.length&&e.every((o,r)=>o.providerID===t[r]?.providerID&&o.modelID===t[r]?.modelID),mr=(e,t)=>e.length===t.length&&e.every((o,r)=>o===t[r]),gr=e=>{if(Array.isArray(e))return Array.from(new Set(e.filter(t=>typeof t=="string"&&t.length>0)))},lm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[o,r]of Object.entries(e)){if(!o||!Array.isArray(r))continue;const n=gr(r);n&&n.length>0&&(t[o]=n.slice(0,5))}return Object.keys(t).length>0?t:void 0},um=(e,t)=>{const o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>Array.isArray(t[r])&&mr(e[r],t[r]))},fm=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,mm=e=>{if(typeof e!="string")return null;const t=e.trim();return t&&fm.test(t)?t.toLowerCase():null},gm=e=>{if(!Array.isArray(e))return;const t=[],o=new Set,r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.path=="string"?a.path.trim():"";if(!s)continue;const i=s==="/"?s:s.replace(/\\/g,"/").replace(/\/+$/,"");if(!i)continue;const c=id(i);if(!c||o.has(c)||r.has(i))continue;o.add(c),r.add(i);const d={id:c,path:i};if(typeof a.label=="string"&&a.label.trim().length>0&&(d.label=a.label.trim()),typeof a.icon=="string"&&a.icon.trim().length>0&&(d.icon=a.icon.trim()),a.iconImage===null)d.iconImage=null;else if(a.iconImage&&typeof a.iconImage=="object"){const l=a.iconImage,u=typeof l.mime=="string"?l.mime.trim():"",m=typeof l.updatedAt=="number"&&Number.isFinite(l.updatedAt)?Math.max(0,Math.round(l.updatedAt)):0,g=l.source==="custom"||l.source==="auto"?l.source:null;u&&m>0&&g&&(d.iconImage={mime:u,updatedAt:m,source:g})}if(typeof a.color=="string"&&a.color.trim().length>0&&(d.color=a.color.trim()),a.iconBackground===null)d.iconBackground=null;else{const l=mm(a.iconBackground);l&&(d.iconBackground=l)}typeof a.addedAt=="number"&&Number.isFinite(a.addedAt)&&a.addedAt>=0&&(d.addedAt=a.addedAt),typeof a.lastOpenedAt=="number"&&Number.isFinite(a.lastOpenedAt)&&a.lastOpenedAt>=0&&(d.lastOpenedAt=a.lastOpenedAt),typeof a.sidebarCollapsed=="boolean"&&(d.sidebarCollapsed=a.sidebarCollapsed),t.push(d)}return t.length>0?t:void 0},pm=e=>{if(!Array.isArray(e))return;const t=[],o=new Set,r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.id=="string"?a.id.trim():"",i=typeof a.name=="string"?a.name.trim():"",c=typeof a.hostname=="string"?a.hostname.trim().toLowerCase():"";!s||!i||!c||o.has(s)||r.has(c)||(o.add(s),r.add(c),t.push({id:s,name:i,hostname:c}))}return t},hm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,o={};for(const[r,n]of Object.entries(t)){const a=r.trim(),s=typeof n=="string"?n.trim():"";!a||!s||(o[a]=s)}return Object.keys(o).length>0?o:void 0},Qo=(e,t)=>{if(!Array.isArray(e))return;const o=[],r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.providerID=="string"?a.providerID.trim():"",i=typeof a.modelID=="string"?a.modelID.trim():"";if(!s||!i)continue;const c=`${s}/${i}`;if(!r.has(c)&&(r.add(c),o.push({providerID:s,modelID:i}),o.length>=t))break}return o},ps=()=>{const e=ie.persist;if(e&&typeof e=="object")return e},hs=()=>Bo()?.settings??null,Fm=e=>{const t=ie.getInitialState();return{useSystemTheme:!0,lightThemeId:ms,darkThemeId:gs,openInAppId:em,showReasoningTraces:t.showReasoningTraces,sessionRecapEnabled:t.sessionRecapEnabled,sessionSuggestionEnabled:t.sessionSuggestionEnabled,sessionGoalEnabled:t.sessionGoalEnabled,sessionGoalDefaultBudgetEnabled:t.sessionGoalDefaultBudgetEnabled,sessionGoalDefaultBudget:t.sessionGoalDefaultBudget,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks,autoDeleteEnabled:t.autoDeleteEnabled,autoDeleteAfterDays:t.autoDeleteAfterDays,sessionRetentionAction:t.sessionRetentionAction,followUpBehavior:jr,showDeletionDialog:t.showDeletionDialog,nativeNotificationsEnabled:t.nativeNotificationsEnabled,notificationMode:t.notificationMode,notifyOnSubtasks:t.notifyOnSubtasks,notifyOnCompletion:t.notifyOnCompletion,notifyOnError:t.notifyOnError,notifyOnQuestion:t.notifyOnQuestion,notificationTemplates:t.notificationTemplates,summarizeLastMessage:t.summarizeLastMessage,summaryThreshold:t.summaryThreshold,summaryLength:t.summaryLength,maxLastMessageLength:t.maxLastMessageLength,inputSpellcheckEnabled:t.inputSpellcheckEnabled,showOpenCodeUpdateNotifications:t.showOpenCodeUpdateNotifications,agentControlToolEnabled:t.agentControlToolEnabled,showToolFileIcons:t.showToolFileIcons,codeBlockLineWrap:t.codeBlockLineWrap,showTurnChangedFiles:t.showTurnChangedFiles,showExpandedBashTools:t.showExpandedBashTools,showExpandedEditTools:t.showExpandedEditTools,timeFormatPreference:t.timeFormatPreference,weekStartPreference:t.weekStartPreference,desktopWindowControlsPosition:t.desktopWindowControlsPosition,chatRenderMode:t.chatRenderMode,activityRenderMode:t.activityRenderMode,mermaidRenderingMode:t.mermaidRenderingMode,userMessageRenderingMode:t.userMessageRenderingMode,collapsibleUserMessages:t.collapsibleUserMessages,messageStreamTransport:"auto",stickyUserHeader:t.stickyUserHeader,promptNavigatorEnabled:t.promptNavigatorEnabled,expandedEditorToolbar:t.expandedEditorToolbar,wideChatLayoutEnabled:t.wideChatLayoutEnabled,showSplitAssistantMessageActions:t.showSplitAssistantMessageActions,draftStartersVisible:t.draftStartersVisible,reportUsage:t.reportUsage,fontSize:t.fontSize,terminalFontSize:t.terminalFontSize,terminalShell:t.terminalShell,terminalLoginShells:t.terminalLoginShells,editorFontSize:t.editorFontSize,uiFont:t.uiFont,monoFont:t.monoFont,padding:t.padding,cornerRadius:t.cornerRadius,inputBarOffset:t.inputBarOffset,shortcutOverrides:t.shortcutOverrides,mobileKeyboardMode:"resize-content",favoriteModels:t.favoriteModels,hiddenModels:t.hiddenModels,collapsedModelProviders:t.collapsedModelProviders,recentModels:t.recentModels,recentAgents:t.recentAgents,recentEfforts:t.recentEfforts,diffLayoutPreference:t.diffLayoutPreference,gitChangesViewMode:t.gitChangesViewMode,directoryShowHidden:!0,filesViewShowGitignored:!1,dictationEnabled:!0,sttProvider:"local",sttServerUrl:"http://localhost:8001/v1",sttModel:"deepdml/faster-whisper-large-v3-turbo-ct2",sttLocalModel:"parakeet-tdt-0.6b-v2-int8",sttLanguage:"",...e}},pr=e=>{const t=ie.getState(),o=typeof window<"u"?window.__zustand_config_store__?.getState?.()??null:null,r=typeof window<"u"?window.__zustand_config_store__??null:null,n=Nd.getState();if(typeof e.showReasoningTraces=="boolean"&&e.showReasoningTraces!==t.showReasoningTraces&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.sessionRecapEnabled=="boolean"&&e.sessionRecapEnabled!==t.sessionRecapEnabled&&t.setSessionRecapEnabled(e.sessionRecapEnabled),typeof e.sessionSuggestionEnabled=="boolean"&&e.sessionSuggestionEnabled!==t.sessionSuggestionEnabled&&t.setSessionSuggestionEnabled(e.sessionSuggestionEnabled),typeof e.sessionGoalEnabled=="boolean"&&e.sessionGoalEnabled!==t.sessionGoalEnabled&&t.setSessionGoalEnabled(e.sessionGoalEnabled),typeof e.sessionGoalDefaultBudgetEnabled=="boolean"&&e.sessionGoalDefaultBudgetEnabled!==t.sessionGoalDefaultBudgetEnabled&&t.setSessionGoalDefaultBudgetEnabled(e.sessionGoalDefaultBudgetEnabled),typeof e.sessionGoalDefaultBudget=="number"&&Number.isFinite(e.sessionGoalDefaultBudget)&&e.sessionGoalDefaultBudget!==t.sessionGoalDefaultBudget&&t.setSessionGoalDefaultBudget(e.sessionGoalDefaultBudget),typeof e.collapsibleThinkingBlocks=="boolean"&&e.collapsibleThinkingBlocks!==t.collapsibleThinkingBlocks&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks),typeof e.autoDeleteEnabled=="boolean"&&e.autoDeleteEnabled!==t.autoDeleteEnabled&&t.setAutoDeleteEnabled(e.autoDeleteEnabled),typeof e.autoDeleteAfterDays=="number"&&Number.isFinite(e.autoDeleteAfterDays)){const s=Math.max(1,Math.min(365,e.autoDeleteAfterDays));s!==t.autoDeleteAfterDays&&t.setAutoDeleteAfterDays(s)}(e.sessionRetentionAction==="archive"||e.sessionRetentionAction==="delete")&&e.sessionRetentionAction!==t.sessionRetentionAction&&t.setSessionRetentionAction(e.sessionRetentionAction);let a=null;if(zr(e.followUpBehavior)?a=e.followUpBehavior:typeof e.queueModeEnabled=="boolean"&&(a=$r(void 0,e.queueModeEnabled)),a&&a!==n.followUpBehavior&&n.setFollowUpBehavior(a),typeof e.showDeletionDialog=="boolean"&&e.showDeletionDialog!==t.showDeletionDialog&&t.setShowDeletionDialog(e.showDeletionDialog),typeof e.nativeNotificationsEnabled=="boolean"&&e.nativeNotificationsEnabled!==t.nativeNotificationsEnabled&&t.setNativeNotificationsEnabled(e.nativeNotificationsEnabled),typeof e.notificationMode=="string"&&(e.notificationMode==="always"||e.notificationMode==="hidden-only")&&e.notificationMode!==t.notificationMode&&t.setNotificationMode(e.notificationMode),typeof e.notifyOnSubtasks=="boolean"&&e.notifyOnSubtasks!==t.notifyOnSubtasks&&t.setNotifyOnSubtasks(e.notifyOnSubtasks),typeof e.notifyOnCompletion=="boolean"&&e.notifyOnCompletion!==t.notifyOnCompletion&&t.setNotifyOnCompletion(e.notifyOnCompletion),typeof e.notifyOnError=="boolean"&&e.notifyOnError!==t.notifyOnError&&t.setNotifyOnError(e.notifyOnError),typeof e.notifyOnQuestion=="boolean"&&e.notifyOnQuestion!==t.notifyOnQuestion&&t.setNotifyOnQuestion(e.notifyOnQuestion),e.notificationTemplates&&typeof e.notificationTemplates=="object"&&t.setNotificationTemplates(e.notificationTemplates),typeof e.summarizeLastMessage=="boolean"&&e.summarizeLastMessage!==t.summarizeLastMessage&&t.setSummarizeLastMessage(e.summarizeLastMessage),typeof e.summaryThreshold=="number"&&Number.isFinite(e.summaryThreshold)&&t.setSummaryThreshold(e.summaryThreshold),typeof e.summaryLength=="number"&&Number.isFinite(e.summaryLength)&&t.setSummaryLength(e.summaryLength),typeof e.maxLastMessageLength=="number"&&Number.isFinite(e.maxLastMessageLength)&&t.setMaxLastMessageLength(e.maxLastMessageLength),typeof e.inputSpellcheckEnabled=="boolean"&&e.inputSpellcheckEnabled!==t.inputSpellcheckEnabled&&t.setInputSpellcheckEnabled(e.inputSpellcheckEnabled),typeof e.showOpenCodeUpdateNotifications=="boolean"&&e.showOpenCodeUpdateNotifications!==t.showOpenCodeUpdateNotifications&&t.setShowOpenCodeUpdateNotifications(e.showOpenCodeUpdateNotifications),typeof e.agentControlToolEnabled=="boolean"&&e.agentControlToolEnabled!==t.agentControlToolEnabled&&t.setAgentControlToolEnabled(e.agentControlToolEnabled),typeof e.showToolFileIcons=="boolean"&&e.showToolFileIcons!==t.showToolFileIcons&&t.setShowToolFileIcons(e.showToolFileIcons),typeof e.codeBlockLineWrap=="boolean"&&e.codeBlockLineWrap!==t.codeBlockLineWrap&&t.setCodeBlockLineWrap(e.codeBlockLineWrap),typeof e.showTurnChangedFiles=="boolean"&&e.showTurnChangedFiles!==t.showTurnChangedFiles&&t.setShowTurnChangedFiles(e.showTurnChangedFiles),typeof e.showExpandedBashTools=="boolean"&&e.showExpandedBashTools!==t.showExpandedBashTools&&t.setShowExpandedBashTools(e.showExpandedBashTools),typeof e.showExpandedEditTools=="boolean"&&e.showExpandedEditTools!==t.showExpandedEditTools&&t.setShowExpandedEditTools(e.showExpandedEditTools),typeof e.timeFormatPreference=="string"&&(e.timeFormatPreference==="auto"||e.timeFormatPreference==="12h"||e.timeFormatPreference==="24h")&&e.timeFormatPreference!==t.timeFormatPreference&&t.setTimeFormatPreference(e.timeFormatPreference),typeof e.weekStartPreference=="string"&&(e.weekStartPreference==="auto"||e.weekStartPreference==="sunday"||e.weekStartPreference==="monday")&&e.weekStartPreference!==t.weekStartPreference&&t.setWeekStartPreference(e.weekStartPreference),typeof e.desktopWindowControlsPosition=="string"){const s=e.desktopWindowControlsPosition==="left"?"left":e.desktopWindowControlsPosition==="right"||e.desktopWindowControlsPosition==="auto"?"right":null;s&&s!==t.desktopWindowControlsPosition&&t.setDesktopWindowControlsPosition(s)}if(typeof e.chatRenderMode=="string"&&(e.chatRenderMode==="sorted"||e.chatRenderMode==="live")&&e.chatRenderMode!==t.chatRenderMode&&t.setChatRenderMode(e.chatRenderMode),typeof e.activityRenderMode=="string"&&(e.activityRenderMode==="collapsed"||e.activityRenderMode==="summary")&&e.activityRenderMode!==t.activityRenderMode&&t.setActivityRenderMode(e.activityRenderMode),typeof e.mermaidRenderingMode=="string"&&(e.mermaidRenderingMode==="svg"||e.mermaidRenderingMode==="ascii")&&e.mermaidRenderingMode!==t.mermaidRenderingMode&&t.setMermaidRenderingMode(e.mermaidRenderingMode),typeof e.userMessageRenderingMode=="string"&&(e.userMessageRenderingMode==="markdown"||e.userMessageRenderingMode==="plain")&&e.userMessageRenderingMode!==t.userMessageRenderingMode&&t.setUserMessageRenderingMode(e.userMessageRenderingMode),typeof e.collapsibleUserMessages=="boolean"&&e.collapsibleUserMessages!==t.collapsibleUserMessages&&t.setCollapsibleUserMessages(e.collapsibleUserMessages),typeof e.messageStreamTransport=="string"&&(e.messageStreamTransport==="auto"||e.messageStreamTransport==="ws"||e.messageStreamTransport==="sse")&&o&&e.messageStreamTransport!==o.settingsMessageStreamTransport&&o.setSettingsMessageStreamTransport(e.messageStreamTransport),typeof e.stickyUserHeader=="boolean"&&e.stickyUserHeader!==t.stickyUserHeader&&t.setStickyUserHeader(e.stickyUserHeader),typeof e.promptNavigatorEnabled=="boolean"&&e.promptNavigatorEnabled!==t.promptNavigatorEnabled&&t.setPromptNavigatorEnabled(e.promptNavigatorEnabled),typeof e.expandedEditorToolbar=="boolean"&&e.expandedEditorToolbar!==t.expandedEditorToolbar&&t.setExpandedEditorToolbar(e.expandedEditorToolbar),typeof e.wideChatLayoutEnabled=="boolean"&&e.wideChatLayoutEnabled!==t.wideChatLayoutEnabled&&t.setWideChatLayoutEnabled(e.wideChatLayoutEnabled),typeof e.showSplitAssistantMessageActions=="boolean"&&e.showSplitAssistantMessageActions!==t.showSplitAssistantMessageActions&&t.setShowSplitAssistantMessageActions(e.showSplitAssistantMessageActions),typeof e.reportUsage=="boolean"&&e.reportUsage!==t.reportUsage&&t.setReportUsage(e.reportUsage),typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)&&e.fontSize!==t.fontSize&&t.setFontSize(e.fontSize),Array.isArray(e.draftStarters)){let s=ds(e.draftStarters);if(e.draftStartersCraftGoalAdded!==!0&&!s.some(i=>i.type==="command"&&i.name==="craft-goal")){const i=s.findIndex(d=>d.type==="command"&&d.name==="plan-feature"),c=i>=0?i+1:s.length;s=[...s.slice(0,c),{type:"command",name:"craft-goal"},...s.slice(c)]}if(e.draftStartersScheduleTaskAdded!==!0&&!s.some(i=>i.type==="command"&&i.name==="schedule-task")){const i=s.findIndex(d=>d.type==="command"&&d.name==="craft-goal"),c=i>=0?i+1:s.length;s=[...s.slice(0,c),{type:"command",name:"schedule-task"},...s.slice(c)]}JSON.stringify(t.globalDraftStarters)!==JSON.stringify(s)&&t.setGlobalDraftStarters(s),(e.draftStartersCraftGoalAdded!==!0||e.draftStartersScheduleTaskAdded!==!0)&&(e.draftStarters=s,e.draftStartersCraftGoalAdded=!0,e.draftStartersScheduleTaskAdded=!0)}else e.draftStartersCraftGoalAdded!==!0&&(e.draftStartersCraftGoalAdded=!0),e.draftStartersScheduleTaskAdded!==!0&&(e.draftStartersScheduleTaskAdded=!0);if(typeof e.draftStartersVisible=="boolean"&&e.draftStartersVisible!==t.draftStartersVisible&&t.setDraftStartersVisible(e.draftStartersVisible),typeof e.terminalFontSize=="number"&&Number.isFinite(e.terminalFontSize)&&e.terminalFontSize!==t.terminalFontSize&&t.setTerminalFontSize(e.terminalFontSize),po(e.terminalShell)&&e.terminalShell!==t.terminalShell&&t.setTerminalShell(e.terminalShell),Array.isArray(e.terminalLoginShells)&&(e.terminalLoginShells.length!==t.terminalLoginShells.length||e.terminalLoginShells.some((s,i)=>s!==t.terminalLoginShells[i]))&&t.setTerminalLoginShells(e.terminalLoginShells),typeof e.editorFontSize=="number"&&Number.isFinite(e.editorFontSize)&&e.editorFontSize!==t.editorFontSize&&t.setEditorFontSize(e.editorFontSize),Ya(e.uiFont)&&e.uiFont!==t.uiFont&&t.setUiFont(e.uiFont),Qa(e.monoFont)&&e.monoFont!==t.monoFont&&t.setMonoFont(e.monoFont),typeof e.padding=="number"&&Number.isFinite(e.padding)&&e.padding!==t.padding&&t.setPadding(e.padding),typeof e.cornerRadius=="number"&&Number.isFinite(e.cornerRadius)&&e.cornerRadius!==t.cornerRadius&&t.setCornerRadius(e.cornerRadius),typeof e.inputBarOffset=="number"&&Number.isFinite(e.inputBarOffset)&&e.inputBarOffset!==t.inputBarOffset&&t.setInputBarOffset(e.inputBarOffset),e.shortcutOverrides&&!dm(e.shortcutOverrides,t.shortcutOverrides)&&ie.setState({shortcutOverrides:e.shortcutOverrides}),typeof e.mobileKeyboardMode=="string"){const s=ko(e.mobileKeyboardMode,t.mobileKeyboardMode);s!==t.mobileKeyboardMode&&t.setMobileKeyboardMode(s)}if(r&&o){const s={};typeof e.dictationEnabled=="boolean"&&e.dictationEnabled!==o.dictationEnabled&&(s.dictationEnabled=e.dictationEnabled),(e.sttProvider==="local"||e.sttProvider==="openai-compatible")&&e.sttProvider!==o.sttProvider&&(s.sttProvider=e.sttProvider),typeof e.sttServerUrl=="string"&&e.sttServerUrl!==o.sttServerUrl&&(s.sttServerUrl=e.sttServerUrl),typeof e.sttModel=="string"&&e.sttModel!==o.sttModel&&(s.sttModel=e.sttModel),typeof e.sttLocalModel=="string"&&e.sttLocalModel!==o.sttLocalModel&&(s.sttLocalModel=e.sttLocalModel),typeof e.sttLanguage=="string"&&e.sttLanguage!==o.sttLanguage&&(s.sttLanguage=e.sttLanguage),Object.keys(s).length>0&&r.setState(s)}if(Array.isArray(e.favoriteModels)){const s=t.favoriteModels,i=e.favoriteModels;Yo(s,i)||ie.setState({favoriteModels:i})}if(Array.isArray(e.hiddenModels)){const s=t.hiddenModels,i=e.hiddenModels;Yo(s,i)||ie.setState({hiddenModels:i})}if(Array.isArray(e.collapsedModelProviders)){const s=t.collapsedModelProviders,i=e.collapsedModelProviders;mr(s,i)||ie.setState({collapsedModelProviders:i})}if(Array.isArray(e.recentModels)){const s=t.recentModels,i=e.recentModels;Yo(s,i)||ie.setState({recentModels:i})}if(Array.isArray(e.recentAgents)){const s=t.recentAgents,i=e.recentAgents;mr(s,i)||ie.setState({recentAgents:i})}if(e.recentEfforts&&typeof e.recentEfforts=="object"){const s=t.recentEfforts,i=e.recentEfforts;um(s,i)||ie.setState({recentEfforts:i})}typeof e.diffLayoutPreference=="string"&&(e.diffLayoutPreference==="dynamic"||e.diffLayoutPreference==="inline"||e.diffLayoutPreference==="side-by-side")&&e.diffLayoutPreference!==t.diffLayoutPreference&&t.setDiffLayoutPreference(e.diffLayoutPreference),typeof e.gitChangesViewMode=="string"&&(e.gitChangesViewMode==="flat"||e.gitChangesViewMode==="tree")&&e.gitChangesViewMode!==t.gitChangesViewMode&&t.setGitChangesViewMode(e.gitChangesViewMode),typeof e.directoryShowHidden=="boolean"&&Ld(e.directoryShowHidden,{persist:!1}),typeof e.filesViewShowGitignored=="boolean"&&jd(e.filesViewShowGitignored,{persist:!1})},Hn=e=>{if(!e||typeof e!="object")return null;const t=e,o={};if(typeof t.themeId=="string"&&t.themeId.length>0&&(o.themeId=t.themeId),(t.useSystemTheme===!0||t.useSystemTheme===!1)&&(o.useSystemTheme=t.useSystemTheme),typeof t.themeVariant=="string"&&(t.themeVariant==="light"||t.themeVariant==="dark")&&(o.themeVariant=t.themeVariant),typeof t.lightThemeId=="string"&&t.lightThemeId.length>0&&(o.lightThemeId=t.lightThemeId),typeof t.darkThemeId=="string"&&t.darkThemeId.length>0&&(o.darkThemeId=t.darkThemeId),typeof t.lastDirectory=="string"&&t.lastDirectory.length>0&&(o.lastDirectory=t.lastDirectory),typeof t.homeDirectory=="string"&&t.homeDirectory.length>0&&(o.homeDirectory=t.homeDirectory),typeof t.opencodeBinary=="string"){const p=t.opencodeBinary.trim();o.opencodeBinary=p.length>0?p:void 0}typeof t.desktopLanAccessEnabled=="boolean"&&(o.desktopLanAccessEnabled=t.desktopLanAccessEnabled),typeof t.desktopKeepAwakeEnabled=="boolean"&&(o.desktopKeepAwakeEnabled=t.desktopKeepAwakeEnabled),typeof t.desktopMinimizeToTrayEnabled=="boolean"&&(o.desktopMinimizeToTrayEnabled=t.desktopMinimizeToTrayEnabled),typeof t.desktopMacMenuBarEnabled=="boolean"&&(o.desktopMacMenuBarEnabled=t.desktopMacMenuBarEnabled);const r=gm(t.projects);if(r&&(o.projects=r),typeof t.activeProjectId=="string"&&t.activeProjectId.length>0&&(o.activeProjectId=t.activeProjectId),Array.isArray(t.securityScopedBookmarks)&&(o.securityScopedBookmarks=t.securityScopedBookmarks.filter(p=>typeof p=="string"&&p.length>0)),Array.isArray(t.pinnedDirectories)&&(o.pinnedDirectories=Array.from(new Set(t.pinnedDirectories.filter(p=>typeof p=="string"&&p.length>0)))),Array.isArray(t.draftStarters)&&(o.draftStarters=ds(t.draftStarters)),typeof t.draftStartersVisible=="boolean"&&(o.draftStartersVisible=t.draftStartersVisible),typeof t.draftStartersCraftGoalAdded=="boolean"&&(o.draftStartersCraftGoalAdded=t.draftStartersCraftGoalAdded),typeof t.draftStartersScheduleTaskAdded=="boolean"&&(o.draftStartersScheduleTaskAdded=t.draftStartersScheduleTaskAdded),typeof t.showReasoningTraces=="boolean"&&(o.showReasoningTraces=t.showReasoningTraces),typeof t.sessionRecapEnabled=="boolean"&&(o.sessionRecapEnabled=t.sessionRecapEnabled),typeof t.sessionSuggestionEnabled=="boolean"&&(o.sessionSuggestionEnabled=t.sessionSuggestionEnabled),typeof t.sessionGoalEnabled=="boolean"&&(o.sessionGoalEnabled=t.sessionGoalEnabled),typeof t.sessionGoalDefaultBudgetEnabled=="boolean"&&(o.sessionGoalDefaultBudgetEnabled=t.sessionGoalDefaultBudgetEnabled),typeof t.sessionGoalDefaultBudget=="number"&&Number.isFinite(t.sessionGoalDefaultBudget)&&t.sessionGoalDefaultBudget>0&&(o.sessionGoalDefaultBudget=Math.floor(t.sessionGoalDefaultBudget)),typeof t.collapsibleThinkingBlocks=="boolean"&&(o.collapsibleThinkingBlocks=t.collapsibleThinkingBlocks),typeof t.autoDeleteEnabled=="boolean"&&(o.autoDeleteEnabled=t.autoDeleteEnabled),typeof t.autoDeleteAfterDays=="number"&&Number.isFinite(t.autoDeleteAfterDays)&&(o.autoDeleteAfterDays=t.autoDeleteAfterDays),(t.sessionRetentionAction==="archive"||t.sessionRetentionAction==="delete")&&(o.sessionRetentionAction=t.sessionRetentionAction),typeof t.tunnelProvider=="string"){const p=t.tunnelProvider.trim().toLowerCase();p.length>0&&(o.tunnelProvider=p)}if(typeof t.tunnelMode=="string"){const p=t.tunnelMode.trim().toLowerCase();(p==="quick"||p==="managed-remote"||p==="managed-local")&&(o.tunnelMode=p)}if(t.tunnelBootstrapTtlMs===null?o.tunnelBootstrapTtlMs=null:typeof t.tunnelBootstrapTtlMs=="number"&&Number.isFinite(t.tunnelBootstrapTtlMs)&&(o.tunnelBootstrapTtlMs=t.tunnelBootstrapTtlMs),typeof t.tunnelSessionTtlMs=="number"&&Number.isFinite(t.tunnelSessionTtlMs)&&(o.tunnelSessionTtlMs=t.tunnelSessionTtlMs),t.managedLocalTunnelConfigPath===null)o.managedLocalTunnelConfigPath=null;else if(typeof t.managedLocalTunnelConfigPath=="string"){const p=t.managedLocalTunnelConfigPath.trim();o.managedLocalTunnelConfigPath=p.length>0?p:null}typeof t.managedRemoteTunnelHostname=="string"&&(o.managedRemoteTunnelHostname=t.managedRemoteTunnelHostname.trim()),t.managedRemoteTunnelToken===null?o.managedRemoteTunnelToken=null:typeof t.managedRemoteTunnelToken=="string"&&(o.managedRemoteTunnelToken=t.managedRemoteTunnelToken.trim());const n=pm(t.managedRemoteTunnelPresets);if(n&&(o.managedRemoteTunnelPresets=n),typeof t.managedRemoteTunnelSelectedPresetId=="string"){const p=t.managedRemoteTunnelSelectedPresetId.trim();o.managedRemoteTunnelSelectedPresetId=p.length>0?p:void 0}const a=hm(t.managedRemoteTunnelPresetTokens);if(a&&(o.managedRemoteTunnelPresetTokens=a),typeof t.defaultModel=="string"&&t.defaultModel.length>0&&(o.defaultModel=t.defaultModel),typeof t.defaultVariant=="string"&&t.defaultVariant.length>0&&(o.defaultVariant=t.defaultVariant),typeof t.defaultAgent=="string"&&t.defaultAgent.length>0&&(o.defaultAgent=t.defaultAgent),typeof t.smallModelUseDefault=="boolean"&&(o.smallModelUseDefault=t.smallModelUseDefault),typeof t.smallModelOverride=="string"&&t.smallModelOverride.length>0&&(o.smallModelOverride=t.smallModelOverride),typeof t.autoCreateWorktree=="boolean"&&(o.autoCreateWorktree=t.autoCreateWorktree),typeof t.gitmojiEnabled=="boolean"&&(o.gitmojiEnabled=t.gitmojiEnabled),zr(t.followUpBehavior)?o.followUpBehavior=t.followUpBehavior:typeof t.queueModeEnabled=="boolean"&&(o.followUpBehavior=$r(void 0,t.queueModeEnabled)),typeof t.showDeletionDialog=="boolean"&&(o.showDeletionDialog=t.showDeletionDialog),typeof t.nativeNotificationsEnabled=="boolean"&&(o.nativeNotificationsEnabled=t.nativeNotificationsEnabled),typeof t.notificationMode=="string"&&(t.notificationMode==="always"||t.notificationMode==="hidden-only")&&(o.notificationMode=t.notificationMode),typeof t.notifyOnSubtasks=="boolean"&&(o.notifyOnSubtasks=t.notifyOnSubtasks),typeof t.notifyOnCompletion=="boolean"&&(o.notifyOnCompletion=t.notifyOnCompletion),typeof t.notifyOnError=="boolean"&&(o.notifyOnError=t.notifyOnError),typeof t.notifyOnQuestion=="boolean"&&(o.notifyOnQuestion=t.notifyOnQuestion),t.notificationTemplates&&typeof t.notificationTemplates=="object"){const p=t.notificationTemplates,b=_=>{const re=p[_];if(!re||typeof re!="object")return;const de=re,pt=typeof de.title=="string"?de.title:"",vo=typeof de.message=="string"?de.message:"";return{title:pt,message:vo}},h=b("completion"),w=b("error"),D=b("question"),B=b("subtask");(h||w||D||B)&&(o.notificationTemplates={completion:h??{title:"Task Complete",message:"Your task has finished."},error:w??{title:"Error Occurred",message:"An error occurred while processing your task."},question:D??{title:"Input Needed",message:"Please provide input to continue."},subtask:B??{title:"Subtask Complete",message:"A subtask has finished."}})}if(typeof t.summarizeLastMessage=="boolean"&&(o.summarizeLastMessage=t.summarizeLastMessage),typeof t.summaryThreshold=="number"&&Number.isFinite(t.summaryThreshold)&&(o.summaryThreshold=Math.max(0,Math.round(t.summaryThreshold))),typeof t.summaryLength=="number"&&Number.isFinite(t.summaryLength)&&(o.summaryLength=Math.max(10,Math.round(t.summaryLength))),typeof t.maxLastMessageLength=="number"&&Number.isFinite(t.maxLastMessageLength)&&(o.maxLastMessageLength=Math.max(10,Math.round(t.maxLastMessageLength))),typeof t.usageAutoRefresh=="boolean"&&(o.usageAutoRefresh=t.usageAutoRefresh),typeof t.usageRefreshIntervalMs=="number"&&Number.isFinite(t.usageRefreshIntervalMs)&&(o.usageRefreshIntervalMs=t.usageRefreshIntervalMs),(t.usageDisplayMode==="usage"||t.usageDisplayMode==="remaining")&&(o.usageDisplayMode=t.usageDisplayMode),typeof t.usageShowPredValues=="boolean"&&(o.usageShowPredValues=t.usageShowPredValues),Array.isArray(t.usageDropdownProviders)&&(o.usageDropdownProviders=t.usageDropdownProviders.filter(p=>typeof p=="string"&&p.length>0)),t.usageSelectedModels&&typeof t.usageSelectedModels=="object"){const p={};for(const[b,h]of Object.entries(t.usageSelectedModels))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageSelectedModels=p)}if(t.usageCollapsedFamilies&&typeof t.usageCollapsedFamilies=="object"){const p={};for(const[b,h]of Object.entries(t.usageCollapsedFamilies))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageCollapsedFamilies=p)}if(t.usageExpandedFamilies&&typeof t.usageExpandedFamilies=="object"){const p={};for(const[b,h]of Object.entries(t.usageExpandedFamilies))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageExpandedFamilies=p)}if(t.usageModelGroups&&typeof t.usageModelGroups=="object"){const p={};for(const[b,h]of Object.entries(t.usageModelGroups))if(h&&typeof h=="object"){const w=h,D={};Array.isArray(w.customGroups)&&(D.customGroups=w.customGroups.filter(B=>B&&typeof B=="object").map(B=>({id:String(B.id??""),label:String(B.label??""),models:Array.isArray(B.models)?B.models.filter(_=>typeof _=="string"):[],order:typeof B.order=="number"?B.order:0}))),w.modelAssignments&&typeof w.modelAssignments=="object"&&(D.modelAssignments=Object.fromEntries(Object.entries(w.modelAssignments).filter(([,B])=>typeof B=="string").map(([B,_])=>[B,String(_)]))),w.renamedGroups&&typeof w.renamedGroups=="object"&&(D.renamedGroups=Object.fromEntries(Object.entries(w.renamedGroups).filter(([,B])=>typeof B=="string").map(([B,_])=>[B,String(_)]))),Object.keys(D).length>0&&(p[b]=D)}Object.keys(p).length>0&&(o.usageModelGroups=p)}typeof t.inputSpellcheckEnabled=="boolean"&&(o.inputSpellcheckEnabled=t.inputSpellcheckEnabled),typeof t.showOpenCodeUpdateNotifications=="boolean"&&(o.showOpenCodeUpdateNotifications=t.showOpenCodeUpdateNotifications),typeof t.agentControlToolEnabled=="boolean"&&(o.agentControlToolEnabled=t.agentControlToolEnabled),typeof t.openCodeUpdateToastDismissedVersion=="string"&&(o.openCodeUpdateToastDismissedVersion=t.openCodeUpdateToastDismissedVersion.trim().slice(0,128)),typeof t.showToolFileIcons=="boolean"&&(o.showToolFileIcons=t.showToolFileIcons),typeof t.codeBlockLineWrap=="boolean"&&(o.codeBlockLineWrap=t.codeBlockLineWrap),typeof t.showTurnChangedFiles=="boolean"&&(o.showTurnChangedFiles=t.showTurnChangedFiles),typeof t.showExpandedBashTools=="boolean"&&(o.showExpandedBashTools=t.showExpandedBashTools),typeof t.showExpandedEditTools=="boolean"&&(o.showExpandedEditTools=t.showExpandedEditTools),typeof t.timeFormatPreference=="string"&&(t.timeFormatPreference==="auto"||t.timeFormatPreference==="12h"||t.timeFormatPreference==="24h")&&(o.timeFormatPreference=t.timeFormatPreference),typeof t.weekStartPreference=="string"&&(t.weekStartPreference==="auto"||t.weekStartPreference==="sunday"||t.weekStartPreference==="monday")&&(o.weekStartPreference=t.weekStartPreference),typeof t.desktopWindowControlsPosition=="string"&&(t.desktopWindowControlsPosition==="left"?o.desktopWindowControlsPosition="left":(t.desktopWindowControlsPosition==="right"||t.desktopWindowControlsPosition==="auto")&&(o.desktopWindowControlsPosition="right")),typeof t.chatRenderMode=="string"&&(t.chatRenderMode==="sorted"||t.chatRenderMode==="live")&&(o.chatRenderMode=t.chatRenderMode),typeof t.messageStreamTransport=="string"&&(t.messageStreamTransport==="auto"||t.messageStreamTransport==="ws"||t.messageStreamTransport==="sse")&&(o.messageStreamTransport=t.messageStreamTransport),typeof t.activityRenderMode=="string"&&(t.activityRenderMode==="collapsed"||t.activityRenderMode==="summary")&&(o.activityRenderMode=t.activityRenderMode),typeof t.mermaidRenderingMode=="string"&&(t.mermaidRenderingMode==="svg"||t.mermaidRenderingMode==="ascii")&&(o.mermaidRenderingMode=t.mermaidRenderingMode),typeof t.userMessageRenderingMode=="string"&&(t.userMessageRenderingMode==="markdown"||t.userMessageRenderingMode==="plain")&&(o.userMessageRenderingMode=t.userMessageRenderingMode),typeof t.collapsibleUserMessages=="boolean"&&(o.collapsibleUserMessages=t.collapsibleUserMessages),typeof t.stickyUserHeader=="boolean"&&(o.stickyUserHeader=t.stickyUserHeader),typeof t.promptNavigatorEnabled=="boolean"&&(o.promptNavigatorEnabled=t.promptNavigatorEnabled),typeof t.expandedEditorToolbar=="boolean"&&(o.expandedEditorToolbar=t.expandedEditorToolbar),typeof t.wideChatLayoutEnabled=="boolean"&&(o.wideChatLayoutEnabled=t.wideChatLayoutEnabled),typeof t.showSplitAssistantMessageActions=="boolean"&&(o.showSplitAssistantMessageActions=t.showSplitAssistantMessageActions),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&(o.fontSize=t.fontSize),typeof t.terminalFontSize=="number"&&Number.isFinite(t.terminalFontSize)&&(o.terminalFontSize=t.terminalFontSize),po(t.terminalShell)&&(o.terminalShell=t.terminalShell),Array.isArray(t.terminalLoginShells)&&(o.terminalLoginShells=[...new Set(t.terminalLoginShells.filter(po))]),typeof t.editorFontSize=="number"&&Number.isFinite(t.editorFontSize)&&(o.editorFontSize=t.editorFontSize),Ya(t.uiFont)&&(o.uiFont=t.uiFont),Qa(t.monoFont)&&(o.monoFont=t.monoFont),typeof t.padding=="number"&&Number.isFinite(t.padding)&&(o.padding=t.padding),typeof t.cornerRadius=="number"&&Number.isFinite(t.cornerRadius)&&(o.cornerRadius=t.cornerRadius),typeof t.inputBarOffset=="number"&&Number.isFinite(t.inputBarOffset)&&(o.inputBarOffset=t.inputBarOffset);const s=cm(t.shortcutOverrides);s&&(o.shortcutOverrides=s),typeof t.mobileKeyboardMode=="string"&&(t.mobileKeyboardMode==="native"||t.mobileKeyboardMode==="resize-content")&&(o.mobileKeyboardMode=t.mobileKeyboardMode);const i=Qo(t.favoriteModels,64);i&&(o.favoriteModels=i);const c=Qo(t.hiddenModels,1024);c&&(o.hiddenModels=c);const d=gr(t.collapsedModelProviders);d&&(o.collapsedModelProviders=d);const l=Qo(t.recentModels,16);l&&(o.recentModels=l);const u=gr(t.recentAgents);u&&(o.recentAgents=u);const m=lm(t.recentEfforts);if(m&&(o.recentEfforts=m),typeof t.diffLayoutPreference=="string"&&(t.diffLayoutPreference==="dynamic"||t.diffLayoutPreference==="inline"||t.diffLayoutPreference==="side-by-side")&&(o.diffLayoutPreference=t.diffLayoutPreference),typeof t.gitChangesViewMode=="string"&&(t.gitChangesViewMode==="flat"||t.gitChangesViewMode==="tree")&&(o.gitChangesViewMode=t.gitChangesViewMode),typeof t.directoryShowHidden=="boolean"&&(o.directoryShowHidden=t.directoryShowHidden),typeof t.filesViewShowGitignored=="boolean"&&(o.filesViewShowGitignored=t.filesViewShowGitignored),typeof t.openInAppId=="string"&&t.openInAppId.length>0&&(o.openInAppId=t.openInAppId),typeof t.pwaAppName=="string"){const p=t.pwaAppName.trim().replace(/\s+/g," ").slice(0,64);o.pwaAppName=p.length>0?p:""}const g=im(t.skillCatalogs);return g&&(o.skillCatalogs=g),typeof t.reportUsage=="boolean"&&(o.reportUsage=t.reportUsage),typeof t.globalBehaviorPrompt=="string"&&(o.globalBehaviorPrompt=t.globalBehaviorPrompt),typeof t.responseStyleEnabled=="boolean"&&(o.responseStyleEnabled=t.responseStyleEnabled),typeof t.responseStylePreset=="string"&&(t.responseStylePreset==="concise"||t.responseStylePreset==="detailed"||t.responseStylePreset==="mentor"||t.responseStylePreset==="pushback"||t.responseStylePreset==="noFiller"||t.responseStylePreset==="matchEnergy"||t.responseStylePreset==="warmPeer"||t.responseStylePreset==="custom")&&(o.responseStylePreset=t.responseStylePreset),typeof t.responseStyleCustomInstructions=="string"&&(o.responseStyleCustomInstructions=t.responseStyleCustomInstructions),typeof t.dictationEnabled=="boolean"&&(o.dictationEnabled=t.dictationEnabled),t.sttProvider==="local"||t.sttProvider==="openai-compatible"?o.sttProvider=t.sttProvider:t.sttProvider==="server"?o.sttProvider="openai-compatible":(t.sttProvider==="browser"||t.sttProvider==="wasm")&&(o.sttProvider="local"),typeof t.sttServerUrl=="string"&&(o.sttServerUrl=t.sttServerUrl.trim()),typeof t.sttModel=="string"&&(o.sttModel=t.sttModel.trim()),typeof t.sttLocalModel=="string"&&(o.sttLocalModel=t.sttLocalModel.trim()),typeof t.sttLanguage=="string"&&(o.sttLanguage=t.sttLanguage.trim()),o};let Gr=0,De=null,Ge=null,xt=null,kt=null,Ie=null,hr=[],jn=!1;const ym=2e3,bm=200,qr=()=>({runtimeKey:L(),generation:Gr}),Fr=(e,t)=>e.runtimeKey===t.runtimeKey&&e.generation===t.generation,J=e=>e.generation===Gr&&e.runtimeKey===L(),Wr=()=>{jn||typeof window>"u"||(jn=!0,ac(e=>{e.runtimeKey!==e.previousRuntimeKey&&(Ie&&clearTimeout(Ie),xt&&yr())}),Oa(e=>{e.runtimeKey!==e.previousRuntimeKey&&(Gr+=1,De=null,Ge=null)}))},Am=async(e=qr())=>{if(Wr(),De&&Fr(De.context,e)&&Date.now()-De.at<ym)return De.value;if(Ge&&Fr(Ge.context,e))return Ge.promise;const t={context:e,promise:(async()=>{const o=hs();if(o)try{const r=await o.load();if(!J(e))return null;const n=Hn(r.settings);return De={value:n,at:Date.now(),context:e},n}catch(r){if(!J(e))return null;console.warn("Failed to load shared settings from runtime settings API:",r)}if(!J(e))return null;try{const r=await f("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!J(e)||!r.ok)return null;const n=await r.json().catch(()=>null);if(!J(e))return null;const a=Hn(n);return De={value:a,at:Date.now(),context:e},a}catch(r){return J(e)&&console.warn("Failed to load shared settings from server:",r),null}})()};return Ge=t,t.promise.finally(()=>{Ge===t&&(Ge=null)}),t.promise},jh=async()=>{if(typeof window>"u")return;Wr();const e=qr(),t=ps(),o=()=>!t?.hasHydrated||t.hasHydrated()||!t.onFinishHydration?Promise.resolve():new Promise(n=>{let a=!1;const s=()=>{a||(a=!0,n())},i=t.onFinishHydration(()=>{i?.(),s()});t.hasHydrated?.()&&s()}),r=async n=>{if(!J(e))return;const a=n.draftStartersCraftGoalAdded!==!0||n.draftStartersScheduleTaskAdded!==!0,s=Fm(n);try{sm(n)}catch(i){console.warn("persistToLocalStorage failed:",i)}if(await o(),!!J(e)){n.draftStarters===void 0&&ie.setState({globalDraftStarters:null});try{pr(s)}catch(i){console.warn("applyDesktopUiPreferences failed:",i)}a&&(await be({...s.draftStarters?{draftStarters:s.draftStarters}:{},draftStartersCraftGoalAdded:!0,draftStartersScheduleTaskAdded:!0}),!J(e))||lr(s)}};try{const n=await Am(e);n&&J(e)&&await r(n)}catch(n){console.warn("Failed to synchronise settings:",n)}};async function yr(){const e=xt,t=kt,o=hr;xt=null,kt=null,Ie=null,hr=[];try{if(!e||!t||Object.keys(e).length===0||!J(t)){Be("saved");return}const r=hs();if(r)try{const n=await r.save(e);if(!J(t))return;n&&(pr(n),lr(n),De=null),Be(n?"saved":"error");return}catch(n){if(!J(t))return;console.warn("Failed to update settings via runtime settings API:",n)}if(!J(t))return;try{const n=await f("/api/config/settings",{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!J(t))return;if(!n.ok){console.warn("Failed to update shared settings via API:",n.status,n.statusText),Be("error");return}const a=await n.json().catch(()=>null);if(!J(t))return;a?(pr(a),lr(a),Be("saved"),De=null):Be("error")}catch(n){J(t)&&(console.warn("Failed to update shared settings via API:",n),Be("error"))}}finally{o.forEach(r=>r())}}const be=async e=>{if(typeof window>"u")return;Wr();const t=qr();kt&&!Fr(kt,t)&&(Ie&&clearTimeout(Ie),yr()),xt={...xt??{},...e},kt=t,Be("saving"),Ie&&clearTimeout(Ie);const o=new Promise(r=>{hr.push(r)});return Ie=setTimeout(()=>{yr()},bm),o},zh=async()=>{if(typeof window>"u")return;const e=ps();try{const t=await qd();if(!t)return;const o=()=>Gd(t);if(e?.hasHydrated?.()){o();return}if(o(),e?.onFinishHydration){const r=e.onFinishHydration(()=>{r?.(),o()})}}catch(t){console.warn("Failed to load appearance preferences:",t)}},wm=3e4,Em=40,Cm=60,Bm=(e,t,o,r,n,a,s)=>{const i=t.trim(),c=o.trim().toLowerCase();return JSON.stringify([e,i,c,r,n,a,s])},zn=(e,t)=>{try{const o=JSON.parse(e);return Array.isArray(o)&&o[1]===t}catch{return!1}},Dm=_t()(Nt((e,t)=>({cache:{},cacheKeys:[],inFlight:{},async searchFiles(o,r,n=Cm,a){if(!o||o.trim().length===0)return[];const s=o.trim(),i=L(),c=typeof r=="string"?r.trim():"",d=!!a?.includeHidden,l=a?.respectGitignore??!0,u=a?.type==="directory"?"directory":"file",m=Bm(i,s,c,n,d,l,u),g=Date.now(),p=t().cache[m];if(p&&g-p.timestamp<wm)return p.files;const b=t().inFlight[m];if(b)return b;const h=Oe.searchFiles(c,{directory:s,limit:n,includeHidden:d,respectGitignore:l,dirs:u!=="file",type:u}).then(w=>(e(D=>{if(D.inFlight[m]!==h)return D;const B={...D.cache,[m]:{files:w,timestamp:Date.now()}},_=D.cacheKeys.filter(re=>re!==m);for(_.push(m);_.length>Em;){const re=_.shift();re&&delete B[re]}return{cache:B,cacheKeys:_}}),w)).finally(()=>{e(w=>{if(w.inFlight[m]!==h)return w;const D={...w.inFlight};return delete D[m],{inFlight:D}})});return e(w=>({inFlight:{...w.inFlight,[m]:h}})),h},invalidateDirectory(o){if(!o||o.trim().length===0){e({cache:{},cacheKeys:[],inFlight:{}});return}const r=o.trim();e(n=>{const a={...n.cache},s=n.cacheKeys.filter(d=>zn(d,r)?(delete a[d],!1):!0),i=Object.entries(n.inFlight).filter(([d])=>!zn(d,r)),c=Object.fromEntries(i);return{cache:a,cacheKeys:s,inFlight:c}})},resetForRuntimeSwitch(){e({cache:{},cacheKeys:[],inFlight:{}})}}),{name:"file-search-store"})),km=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem("openchamber_stream_debug")==="1"}catch{return!1}},br="openchamber_stream_perf",vm=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(br)==="1"}catch{return!1}};let Xe=vm();const $n=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),Sm=()=>{if(!Xe||typeof window>"u")return null;if(!window.__openchamberStreamPerfState){const e=Date.now();window.__openchamberStreamPerfState={counters:new Map,startedAt:e,lastUpdatedAt:e}}return window.__openchamberStreamPerfState},Fs=e=>Array.from(e.entries()).map(([t,o])=>({metric:t,count:o.count,avg:o.count>0?Number((o.total/o.count).toFixed(3)):0,max:Number(o.max.toFixed(3)),total:Number(o.total.toFixed(3)),last:Number(o.last.toFixed(3))})).sort((t,o)=>o.total-t.total||o.count-t.count),Vr=(e,t)=>{const o=Sm();if(!o)return;const r=o.counters.get(e)??{count:0,total:0,max:0,last:0};r.count+=1,r.total+=t,r.max=Math.max(r.max,t),r.last=t,o.counters.set(e,r),o.lastUpdatedAt=Date.now()},Mm=e=>{if(Xe=e,!(typeof window>"u"))try{if(e){window.localStorage.setItem(br,"1"),window.__openchamberStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()};return}window.localStorage.removeItem(br),delete window.__openchamberStreamPerfState,delete window.__openchamberVsCodeStreamPerfState}catch{}},Tm=()=>{typeof window>"u"||(Xe&&(window.__openchamberStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}),window.__openchamberVsCodeStreamPerfState&&(window.__openchamberVsCodeStreamPerfState={...window.__openchamberVsCodeStreamPerfState,counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}))},Pm=()=>{if(typeof window>"u")return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const e=window.__openchamberStreamPerfState;return!Xe||!e?{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]}:{enabled:!0,startedAt:e.startedAt,lastUpdatedAt:e.lastUpdatedAt,durationMs:Math.max(0,Date.now()-e.startedAt),entries:Fs(e.counters)}},$h=()=>{if(typeof window>"u")return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const e=window.__openchamberVsCodeStreamPerfState;if(!Xe||!e)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const t=typeof e.startedAt=="number"?e.startedAt:null,o=typeof e.lastUpdatedAt=="number"?e.lastUpdatedAt:null;return{enabled:!0,startedAt:t,lastUpdatedAt:o,durationMs:t?Math.max(0,Date.now()-t):0,entries:Fs(e.counters)}},Gh=(e,t=1)=>{Vr(e,t)},qh=(e,t)=>{Vr(e,t)},Wh=e=>{!Xe||typeof performance>"u"||typeof performance.mark!="function"||performance.mark(`openchamber.${e}`)},Vh=(e,t)=>{if(!Xe)return t();const o=$n();try{return t()}finally{Vr(e,$n()-o)}};typeof window<"u"&&(window.__openchamberStreamPerformance={setEnabled:Mm,reset:Tm,getSnapshot:Pm});var Rm={};let ge=null,Gn=0;const me=Lt(),qn=me.getItem("lastDirectory"),Im=typeof qn=="string"&&qn.length>0,Zt=e=>{try{Dm.getState().invalidateDirectory(e)}catch(t){console.warn("Failed to invalidate file search cache:",t)}},ft=e=>{const t=e.trim();if(!t)return t;const o=t.replace(/\\/g,"/").replace(/^([a-z]):/,(r,n)=>n.toUpperCase()+":");return o.length>1?o.replace(/\/+$/,""):o},xm=(e,t)=>{const o=e.trim();return o.startsWith("~")?o==="~"?t||o:(o.startsWith("~/")||o.startsWith("~\\"))&&t?`${t}${o.slice(1)}`:o:o},no=(e,t)=>{const o=xm(e,t);return ft(o)},Om=()=>{const e=me.getItem("homeDirectory");if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},_m=()=>{const e=me.getItem("lastDirectory");if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},Nm=()=>{if(typeof process>"u")return null;const e=Rm,t=e?.HOME||e?.USERPROFILE||(e?.HOMEDRIVE&&e?.HOMEPATH?`${e.HOMEDRIVE}${e.HOMEPATH}`:void 0);if(typeof t=="string"&&t.trim().length>0){const r=ft(t);return r.length>0?r:null}const o=process?.cwd?.();if(typeof o=="string"&&o.trim().length>0){const r=ft(o);return r.length>0?r:null}return null},ho=()=>{if(typeof window<"u"){if(ge)return ge;const t=typeof window.__OPENCHAMBER_HOME__=="string"&&window.__OPENCHAMBER_HOME__.length>0?window.__OPENCHAMBER_HOME__:null;if(t&&t.length>0)return ge=t,me.setItem("homeDirectory",t),t;const o=Om();if(o&&!Do())return ge=o,o}const e=Nm();return e||"/"},Um=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const o=t.replace(/\\/g,"/");if(o.length>1){const r=o.replace(/\/+$/,"");if(r&&r.length>0)return r==="/"?null:r}return o==="/"||o.length===0?null:o},Lm=e=>(ge=e,typeof window<"u"&&me.setItem("homeDirectory",e),be({homeDirectory:e}),e),Ar=async()=>{const e=r=>{const n=Um(r);return n?Lm(n):null};try{const r=await Oe.getFilesystemHome(),n=e(r);if(n)return n}catch(r){console.warn("Failed to obtain filesystem home directory:",r)}try{const r=await Oe.getSystemInfo(),n=e(r?.homeDirectory);if(n)return n}catch(r){console.warn("Failed to get home directory from system info:",r)}try{const r=await La(),n=e(r);if(n)return n}catch(r){console.warn("Failed to obtain desktop-integrated home directory:",r)}const t=ho(),o=e(t);return o||t},Hm=()=>{if(!Do())return null;const e=window.__VSCODE_CONFIG__?.workspaceFolder;if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},Ot=Hm()||ho(),Fo=(()=>{const e=_m();return e&&!Do()?no(e,Ot):Ot})();Fo&&Oe.setDirectory(Fo);const jm=!!(Ot&&Ot!=="/"),wr=_t()(Nt((e,t)=>({currentDirectory:Fo,directoryHistory:[Fo],historyIndex:0,homeDirectory:Ot,hasPersistedDirectory:Im,isHomeReady:jm,isSwitchingDirectory:!1,setDirectory:(o,r)=>{const n=ge||t().homeDirectory||me.getItem("homeDirectory"),a=no(o,n);km()&&console.log("[DirectoryStore] setDirectory called with path:",a),Oe.setDirectory(a),Zt(),e(s=>{const i=[...s.directoryHistory.slice(0,s.historyIndex+1),a];return me.setItem("lastDirectory",a),be({lastDirectory:a}),{currentDirectory:a,directoryHistory:i,historyIndex:i.length-1,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1}})},goBack:()=>{const o=t();if(o.historyIndex>0){const r=o.historyIndex-1,n=o.directoryHistory[r];Oe.setDirectory(n),Zt(),me.setItem("lastDirectory",n),be({lastDirectory:n}),e({currentDirectory:n,historyIndex:r,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goForward:()=>{const o=t();if(o.historyIndex<o.directoryHistory.length-1){const r=o.historyIndex+1,n=o.directoryHistory[r];Oe.setDirectory(n),Zt(),me.setItem("lastDirectory",n),be({lastDirectory:n}),e({currentDirectory:n,historyIndex:r,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goToParent:()=>{const{currentDirectory:o,setDirectory:r}=t(),n=ge||t().homeDirectory||ho();if(o===n||o==="/")return;const a=o.endsWith("/")?o.slice(0,-1):o,s=a.lastIndexOf("/");if(s===-1){const i=ge||ho();r(i)}else r(s===0?"/":a.substring(0,s))},goHome:async()=>{const o=ge||t().homeDirectory||await Ar();t().setDirectory(o)},synchronizeHomeDirectory:o=>{const r=t(),n=o;ge=n;const a=r.homeDirectory!==n,s=me.getItem("lastDirectory"),i=typeof s=="string"&&s.length>0,c=!i&&(r.currentDirectory==="/"||r.currentDirectory===r.homeDirectory||!r.currentDirectory);if(!a&&!c){r.isHomeReady||e({isHomeReady:!0});return}const d=typeof n=="string"&&n!==""&&n!=="/",l=r.currentDirectory?no(r.currentDirectory,n):r.currentDirectory,u=r.directoryHistory.map(b=>no(b,n)),m=u.some((b,h)=>b!==r.directoryHistory[h]),g=!!(l&&l!==r.currentDirectory),p={homeDirectory:n,hasPersistedDirectory:i,isHomeReady:d};if(c?(p.currentDirectory=n,p.directoryHistory=[n],p.historyIndex=0,p.isSwitchingDirectory=!1):(g||m)&&(p.currentDirectory=l,p.directoryHistory=u,p.historyIndex=Math.min(r.historyIndex,u.length-1),p.isSwitchingDirectory=!1),e(()=>p),(c||g)&&d){const b=c?n:l;Oe.setDirectory(b),Zt(),me.setItem("lastDirectory",b),be({lastDirectory:b})}be({homeDirectory:n})}}),{name:"directory-store"}));typeof window<"u"&&(Ar().then(e=>{wr.getState().synchronizeHomeDirectory(e)}),Oa(()=>{ge=null;const e=++Gn;Ar().then(t=>{e===Gn&&wr.getState().synchronizeHomeDirectory(t)})}));const zm=(e,t)=>{const o=bo();return o?o.openWebSocket(pi(e),t):Ci(new WebSocket(e))},ys=1,Wn=512*1024,$m=0,At=1,Kr=new TextEncoder,bs=new TextDecoder,Gm=e=>{const t=Kr.encode(JSON.stringify(e)),o=new Uint8Array(t.length+1);return o[0]=ys,o.set(t,1),o},qm=async e=>{let t;if(e instanceof ArrayBuffer)t=new Uint8Array(e);else if(e instanceof Uint8Array)t=e;else if(typeof Blob<"u"&&e instanceof Blob)t=new Uint8Array(await e.arrayBuffer());else if(typeof e=="string")t=Kr.encode(e);else return null;t[0]===ys&&(t=t.subarray(1));try{return JSON.parse(bs.decode(t))}catch{return null}},Jr=async(e,t)=>{const o=await e.json().catch(()=>null);return new Error(typeof o?.error=="string"?o.error:t)},Wm=e=>{const t=Kr.encode(e);if(t.byteLength<=Wn)return e;let o=t.byteLength-Wn;for(;o<t.byteLength&&(t[o]&192)===128;)o+=1;return bs.decode(t.subarray(o))};class As{constructor(t={refreshAuth:Co,openSocket:()=>zm(oe().websocket("/api/terminal/ws"))}){this.dependencies=t}socket=null;opening=null;openingGeneration=null;subscribers=new Map;projections=new Map;reconnectTimer=null;keepaliveTimer=null;failures=0;wakeCleanup=null;generation=0;disposed=!1;subscribe(t,o){const r={handlers:o,lastSequence:-1},n=this.subscribers.get(t)??new Set,a=n.size===0;n.add(r),this.subscribers.set(t,n);const s=this.projections.get(t);s&&(r.lastSequence=s.sequence,o.onEvent({type:"snapshot",sequence:s.sequence,data:s.history,status:s.status,exitCode:s.exitCode,signal:s.signal,runtime:s.runtime,ptyBackend:s.ptyBackend}));const i=this.socket?.readyState===At;return this.ensureConnected().then(()=>{a&&i&&n.has(r)&&this.send({t:"attach",v:3,s:t})}).catch(c=>{o.onError?.(c,!1),this.scheduleReconnect()}),()=>{const c=this.subscribers.get(t);c?.delete(r),c?.size===0&&(this.subscribers.delete(t),this.projections.delete(t),this.send({t:"detach",v:3,s:t})),this.subscribers.size===0&&(this.generation+=1,this.cancelReconnect(),this.closeSocket())}}async write(t,o){if(o&&(await this.ensureConnected(),!this.send({t:"write",v:3,s:t,d:o})&&(this.closeSocket(),await this.ensureConnected(),!this.send({t:"write",v:3,s:t,d:o}))))throw new Error("Terminal connection is unavailable")}dispose(){this.disposed=!0,this.generation+=1,this.subscribers.clear(),this.projections.clear(),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null,this.closeSocket()}forget(t){this.projections.delete(t)}async ensureConnected(){if(this.disposed)throw new Error("Terminal runtime changed");if(this.socket?.readyState===At)return;if(this.opening&&this.openingGeneration===this.generation)return await this.opening,this.socket?.readyState===At?void 0:this.ensureConnected();this.openingGeneration!==this.generation&&(this.opening=null,this.openingGeneration=null);const t=this.generation,o=(async()=>{if(await this.dependencies.refreshAuth(),t!==this.generation||this.disposed)throw new Error("Terminal runtime changed");await new Promise((r,n)=>{let a=!1,s=null;const i=d=>{a||(a=!0,clearTimeout(c),d?n(d):r())},c=setTimeout(()=>{s?.close(),i(new Error("Terminal connection timed out"))},1e4);try{const d=this.dependencies.openSocket();s=d,d.binaryType="arraybuffer",this.socket=d,d.onopen=()=>{if(t!==this.generation||this.disposed){d.close(),i(new Error("Terminal runtime changed"));return}this.failures=0,this.send({t:"hello",v:3});for(const l of this.subscribers.keys())this.send({t:"attach",v:3,s:l});this.startKeepalive(),i()},d.onmessage=l=>{this.handleMessage(l.data)},d.onerror=()=>{i(new Error("Terminal WebSocket failed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()},d.onclose=()=>{this.socket===d&&(this.socket=null),this.stopKeepalive(),i(new Error("Terminal WebSocket closed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()}}catch(d){i(d instanceof Error?d:new Error("Terminal WebSocket failed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()}})})();this.opening=o,this.openingGeneration=t;try{await o}finally{this.opening===o&&(this.opening=null,this.openingGeneration=null)}}async handleMessage(t){const o=await qm(t);if(!o||o.t==="hello"||o.t==="pong")return;if(o.t==="error"){const a=new Error(typeof o.message=="string"?o.message:"Terminal error");typeof o.code=="string"&&(a.code=o.code);const s=o.s?[o.s]:[...this.subscribers.keys()];for(const i of s)for(const c of this.subscribers.get(i)??[])c.handlers.onError?.(a,o.fatal===!0);return}if(!o.s)return;const r=this.subscribers.get(o.s);if(!r)return;if(o.t==="snapshot"){const a={sequence:typeof o.q=="number"?o.q:0,history:typeof o.history=="string"?o.history:"",status:o.status,exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null,runtime:o.runtime,ptyBackend:typeof o.ptyBackend=="string"?o.ptyBackend:void 0};this.projections.set(o.s,a);for(const s of r)s.lastSequence=a.sequence,s.handlers.onEvent({type:"snapshot",sequence:a.sequence,data:a.history,status:a.status,exitCode:a.exitCode,signal:a.signal,runtime:a.runtime,ptyBackend:a.ptyBackend});return}if(typeof o.q!="number")return;const n=this.projections.get(o.s);n&&o.q>n.sequence&&(o.t==="output"?this.projections.set(o.s,{...n,sequence:o.q,history:Wm(n.history+(typeof o.r=="string"?o.r:typeof o.d=="string"?o.d:""))}):o.t==="exit"?this.projections.set(o.s,{...n,sequence:o.q,status:"exited",exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null}):o.t==="restarted"&&this.projections.set(o.s,{...n,sequence:o.q,history:typeof o.history=="string"?o.history:"",status:"running",exitCode:void 0,signal:null}));for(const a of r)o.q<=a.lastSequence||(a.lastSequence=o.q,o.t==="output"?a.handlers.onEvent({type:"data",sequence:o.q,data:typeof o.d=="string"?o.d:"",replayData:typeof o.r=="string"?o.r:void 0}):o.t==="exit"?a.handlers.onEvent({type:"exit",sequence:o.q,exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null}):o.t==="restarted"&&a.handlers.onEvent({type:"snapshot",sequence:o.q,data:typeof o.history=="string"?o.history:"",status:"running"}))}send(t){if(!this.socket||this.socket.readyState!==At)return!1;try{return this.socket.send(Gm(t)),!0}catch{return!1}}scheduleReconnect(){if(this.reconnectTimer||this.disposed||this.subscribers.size===0)return;this.failures+=1;const t=typeof document<"u"&&document.visibilityState==="hidden"||typeof navigator<"u"&&!navigator.onLine,o=Math.min(500*2**Math.min(this.failures-1,10),t?6e4:8e3);for(const n of this.subscribers.values())for(const a of n)a.handlers.onEvent({type:"reconnecting",attempt:this.failures,maxAttempts:Number.POSITIVE_INFINITY});const r=()=>{typeof document<"u"&&document.visibilityState==="hidden"||typeof navigator<"u"&&!navigator.onLine||(this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null,this.ensureConnected().catch(()=>this.scheduleReconnect()))};typeof window<"u"&&window.addEventListener("online",r),typeof document<"u"&&document.addEventListener("visibilitychange",r),this.wakeCleanup=()=>{typeof window<"u"&&window.removeEventListener("online",r),typeof document<"u"&&document.removeEventListener("visibilitychange",r)},this.reconnectTimer=setTimeout(r,o)}startKeepalive(){this.stopKeepalive(),this.keepaliveTimer=setInterval(()=>this.send({t:"ping",v:3}),2e4)}stopKeepalive(){this.keepaliveTimer&&clearInterval(this.keepaliveTimer),this.keepaliveTimer=null}cancelReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null}closeSocket(){this.stopKeepalive();const t=this.socket;this.socket=null,t&&(t.readyState===$m||t.readyState===At)&&t.close()}}let Ye=new As;async function Vm(e){const t=await f("/api/terminal/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Jr(t,"Failed to create terminal session");return t.json()}async function Km(){const e=await f("/api/terminal/shells");if(!e.ok)throw await Jr(e,"Failed to list terminal shells");const t=await e.json().catch(()=>[]);return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"&&po(o.id)&&typeof o.name=="string"&&typeof o.supportsLogin=="boolean"):[]}function Jm(e,t,o){return Ye.subscribe(e,{onEvent:t,onError:o})}async function Ym(e,t){await Ye.write(e,t)}async function jt(e,t,o){const r={method:t};o!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(o));const n=await f(e,r);if(!n.ok)throw await Jr(n,"Terminal command failed");return n}async function Qm(e,t,o){await jt(`/api/terminal/${e}/resize`,"POST",{cols:t,rows:o})}async function Xm(e,t){await jt(`/api/terminal/${e}/appearance`,"POST",t)}async function Zm(e){await jt(`/api/terminal/${e}`,"DELETE"),Ye.forget(e)}async function eg(e,t){return(await jt(`/api/terminal/${e}/restart`,"POST",t)).json()}async function tg(e){const o=await(await jt("/api/terminal/force-kill","POST",e)).json().catch(()=>null);if(Array.isArray(o?.killedSessionIds))for(const r of o.killedSessionIds)typeof r=="string"&&Ye.forget(r);else e.sessionId&&Ye.forget(e.sessionId)}function Kh(){Ye.dispose(),Ye=new As}const og=()=>({async listShells(){return Km()},async createSession(e){return Vm(e)},connect(e,t){const o=Jm(e,t.onEvent,t.onError);return{close:()=>o()}},async sendInput(e,t){await Ym(e,t)},async resize(e){await Qm(e.sessionId,e.cols,e.rows)},async updateAppearance(e,t){await Xm(e,t)},async close(e){await Zm(e)},async restartSession(e,t){return eg(e,{cwd:t.cwd??"",cols:t.cols,rows:t.rows,themeMode:t.themeMode,terminalBackground:t.terminalBackground,terminalForeground:t.terminalForeground,shell:t.shell,loginShell:t.loginShell})},async forceKill(e){await tg(e)}}),F="/api/git",rg=1200,ng=5e3,Er=new Map,wt=new Map,ws=new Map,Vn=new Map,eo=new Map,Es=e=>e.trim(),Yr=(e,t)=>JSON.stringify([e,Es(t)]),Cs=(e,t,o)=>JSON.stringify([e,Es(t),o??"full"]),Cr=(e,t)=>ws.get(Yr(e,t))??0,_e=e=>{const t=L(),o=Yr(t,e);ws.set(o,Cr(t,e)+1);for(const r of[void 0,"light"]){const n=Cs(t,e,r);Er.delete(n),wt.delete(n)}};function y(e,t,o){const r={...o};return t&&(r.directory=t),oe().api(e,r)}async function ag(e){const t=Yr(L(),e),o=Date.now(),r=Vn.get(t);if(r&&r.expiresAt>o)return r.value;const n=eo.get(t);if(n)return n;const a=(async()=>{const s=await f(y(`${F}/check`,e));if(!s.ok)throw new Error(`Failed to check git repository: ${s.statusText}`);const c=!!(await s.json()).isGitRepository;return Vn.set(t,{value:c,expiresAt:Date.now()+ng}),c})();eo.set(t,a);try{return await a}finally{eo.get(t)===a&&eo.delete(t)}}async function sg(e,t){const o=t?.mode,r=L(),n=Cs(r,e,o),a=Date.now(),s=Er.get(n);if(s&&s.expiresAt>a)return s.value;const i=wt.get(n);if(i)return i;const c=(async()=>{const d=Cr(r,e),l=await f(y(`${F}/status`,e,o?{mode:o}:void 0));if(!l.ok)throw new Error(`Failed to get git status: ${l.statusText}`);const u=await l.json();return Cr(r,e)===d&&Er.set(n,{value:u,expiresAt:Date.now()+rg}),u})();wt.set(n,c);try{return await c}finally{wt.get(n)===c&&wt.delete(n)}}async function Jh(e){const t=await f(y(`${F}/primary-root`,e));if(!t.ok)throw new Error(`Failed to resolve git primary root: ${t.statusText}`);const o=await t.json().catch(()=>({}));return{root:typeof o.root=="string"&&o.root?o.root:e}}async function Yh(e){const t=await f(y(`${F}/toplevel`,e));if(!t.ok)throw new Error(`Failed to resolve git toplevel: ${t.statusText}`);const o=await t.json().catch(()=>({}));return{root:typeof o.root=="string"&&o.root?o.root:e}}async function Qh(e,t){const o=await f(y(`${F}/commit-summaries`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shas:t})});if(!o.ok)throw new Error(`Failed to get git commit summaries: ${o.statusText}`);const r=await o.json().catch(()=>({}));return{commits:Array.isArray(r.commits)?r.commits.map(n=>({sha:typeof n.sha=="string"?n.sha:"",short:typeof n.short=="string"?n.short:"",subject:typeof n.subject=="string"?n.subject:""})).filter(n=>n.sha&&n.short):[]}}async function ig(e,t){const{path:o,staged:r,contextLines:n}=t;if(!o)throw new Error("path is required to fetch git diff");const a=await f(y(`${F}/diff`,e,{path:o,staged:r?"true":void 0,context:n}));if(!a.ok)throw new Error(`Failed to get git diff: ${a.statusText}`);return a.json()}async function cg(e,t){const{path:o,staged:r}=t;if(!o)throw new Error("path is required to fetch git file diff");const n=await f(y(`${F}/file-diff`,e,{path:o,staged:r?"true":void 0}));if(!n.ok)throw new Error(`Failed to get git file diff: ${n.statusText}`);return n.json()}async function dg(e,t,o){if(!t)throw new Error("path is required to revert git changes");const r=await f(y(`${F}/revert`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,scope:o?.scope})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to revert git changes")}_e(e)}async function lg(e,t){await Bs(e,[t])}async function Bs(e,t){const o=t.map(n=>n.trim()).filter(Boolean);if(o.length===0)throw new Error("path is required to stage git changes");const r=await f(y(`${F}/stage`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to stage git changes")}_e(e)}async function ug(e,t){await Ds(e,[t])}async function Ds(e,t){const o=t.map(n=>n.trim()).filter(Boolean);if(o.length===0)throw new Error("path is required to unstage git changes");const r=await f(y(`${F}/unstage`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to unstage git changes")}_e(e)}async function fg(e,t,o){await Qr(e,t,o,"stage")}async function mg(e,t,o){await Qr(e,t,o,"unstage")}async function gg(e,t,o){await Qr(e,t,o,"discard")}async function Qr(e,t,o,r){if(!t)throw new Error("path is required to apply a git hunk");if(typeof o!="string"||!o.trim())throw new Error("patch is required to apply a git hunk");const n=await f(y(`${F}/apply-hunk`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,patch:o,action:r})});if(!n.ok){const a=await n.json().catch(()=>({error:n.statusText}));throw new Error(a.error||"Failed to apply git hunk")}_e(e)}async function pg(e){if(!e)return!1;const t=await f(y(`${F}/worktree-type`,e));if(!t.ok)throw new Error(`Failed to detect worktree type: ${t.statusText}`);return!!(await t.json()).linked}async function hg(e){const t=await f(y(`${F}/branches`,e));if(!t.ok)throw new Error(`Failed to get branches: ${t.statusText}`);return t.json()}async function Fg(e,t){if(!t?.branch)throw new Error("branch is required to delete a branch");const o=await f(y(`${F}/branches`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete branch")}return o.json()}async function yg(e,t){if(!t?.branch)throw new Error("branch is required to delete remote branch");const o=await f(y(`${F}/remote-branches`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete remote branch")}return o.json()}async function bg(e,t){const o=t?.remote?.trim();if(!o)throw new Error("remote is required to remove a remote");const r=await f(y(`${F}/remotes`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to remove remote")}return r.json()}async function Ag(e,t,o){if(!Array.isArray(t)||t.length===0)throw new Error("No files provided to generate commit message");const r={files:t};o?.zenModel&&(r.zenModel=o.zenModel),o?.providerId&&(r.providerId=o.providerId),o?.modelId&&(r.modelId=o.modelId);const n=await f(y(`${F}/commit-message`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){const c=await n.json().catch(()=>({error:n.statusText}));console.error("[git-generation][browser] http error",{status:n.status,statusText:n.statusText,error:c});const d=typeof c?.traceId=="string"&&c.traceId?` (traceId: ${c.traceId})`:"";throw new Error(`${c.error||"Failed to generate commit message"}${d}`)}const a=await n.json();if(!a?.message||typeof a.message!="object")throw new Error("Malformed commit generation response");const s=typeof a.message.subject=="string"&&a.message.subject.trim().length>0?a.message.subject.trim():"",i=Array.isArray(a.message.highlights)?a.message.highlights.filter(c=>typeof c=="string"&&c.trim().length>0).map(c=>c.trim()):[];return{message:{subject:s,highlights:i}}}async function wg(e,t){const{base:o,head:r,context:n,zenModel:a,providerId:s,modelId:i}=t;if(!o||!r)throw new Error("base and head are required");const c={base:o,head:r};n?.trim()&&(c.context=n.trim()),a&&(c.zenModel=a),s&&(c.providerId=s),i&&(c.modelId=i);const d=await f(y(`${F}/pr-description`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){const g=await d.json().catch(()=>({error:d.statusText}));throw new Error(g.error||"Failed to generate PR description")}const l=await d.json().catch(()=>null),u=typeof l?.title=="string"?l.title:"",m=typeof l?.body=="string"?l.body:"";if(!u&&!m)throw new Error("Malformed PR description response");return{title:u,body:m}}async function Kn(e){const t=await f(y(`${F}/worktrees`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to list worktrees")}return t.json()}async function Jn(e,t){const o=await f(y(`${F}/worktrees/validate`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to validate worktree")}return o.json()}async function Eg(e){const t=await f(y(`${F}/worktrees/bootstrap-status`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to get worktree bootstrap status")}return t.json()}async function Cg(e,t){const o=await f(y(`${F}/worktrees/preview`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to preview worktree")}return o.json()}async function Yn(e,t){const o=await f(y(`${F}/worktrees`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to create worktree")}return o.json()}async function Qn(e,t){const o=await f(y(`${F}/worktrees`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete worktree")}return o.json()}async function Bg(e,t,o={}){const r=await f(y(`${F}/commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t,addAll:o.addAll??!1,files:o.files,stageFiles:o.stageFiles})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to create commit")}const n=await r.json();return _e(e),n}async function Dg(e,t={}){const o=await f(y(`${F}/push`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to push")}const r=await o.json();return _e(e),r}async function kg(e,t={}){const o=await f(y(`${F}/pull`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to pull")}const r=await o.json();return _e(e),r}async function vg(e,t={}){const o=await f(y(`${F}/fetch`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to fetch")}const r=await o.json();return _e(e),r}async function Sg(e){const t=await f(y(`${F}/stashes`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to list stashes")}return t.json()}async function Mg(e,t){const o=await f(y(`${F}/stashes/file-counts`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refs:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to count stash files")}return o.json()}async function ks(e,t={}){const o=await f(y(`${F}/stash`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to stash changes")}return o.json()}const Xr=async(e,t,o)=>{const r=await f(y(`${F}/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||`Failed to ${t}`)}return r.json()},Tg=(e,t)=>Xr(e,"stash/apply",t),vs=(e,t)=>Xr(e,"stash/pop",t),Pg=(e,t)=>Xr(e,"stash/drop",t);async function Rg(e,t){const o=await f(y(`${F}/checkout`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to checkout branch")}return o.json()}async function Ig(e,t,o){const r=await f(y(`${F}/branches`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,startPoint:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to create branch")}return r.json()}async function xg(e,t,o){const r=await f(y(`${F}/branches/rename`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:t,newName:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to rename branch")}return r.json()}async function Og(e,t={}){const o=await f(y(`${F}/log`,e,{maxCount:t.maxCount,from:t.from,to:t.to,file:t.file,all:t.all?"true":void 0}));if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(`Failed to get git log: ${r.error||o.statusText}`)}return o.json()}async function _g(e,t){const o=await f(y(`${F}/commit-files`,e,{hash:t}));if(!o.ok)throw new Error(`Failed to get commit files: ${o.statusText}`);return o.json()}async function Xh(e,t,o,r){const n=await f(y(`${F}/commit-file-diff`,e,{hash:t,path:o,binary:r?"true":void 0}));if(!n.ok)throw new Error(`Failed to get commit file diff: ${n.statusText}`);return n.json()}async function Ng(){const e=await f(y(`${F}/identities`,void 0));if(!e.ok)throw new Error(`Failed to get git identities: ${e.statusText}`);return e.json()}async function Ug(e){const t=await f(y(`${F}/identities`,void 0),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to create git identity")}return t.json()}async function Lg(e,t){const o=await f(y(`${F}/identities/${e}`,void 0),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to update git identity")}return o.json()}async function Hg(e){const t=await f(y(`${F}/identities/${e}`,void 0),{method:"DELETE"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to delete git identity")}}async function jg(e){if(!e)return null;const t=await f(y(`${F}/current-identity`,e));if(!t.ok)throw new Error(`Failed to get current git identity: ${t.statusText}`);const o=await t.json();return o?{userName:o.userName??null,userEmail:o.userEmail??null,sshCommand:o.sshCommand??null}:null}async function zg(e){if(!e)return!1;const t=await f(y(`${F}/has-local-identity`,e));if(!t.ok)throw new Error(`Failed to check local identity: ${t.statusText}`);return(await t.json().catch(()=>null))?.hasLocalIdentity===!0}async function Zh(){const e=await f(y(`${F}/global-identity`,void 0));if(!e.ok)throw new Error(`Failed to get global git identity: ${e.statusText}`);const t=await e.json();return!t||!t.userName&&!t.userEmail?null:{userName:t.userName??null,userEmail:t.userEmail??null,sshCommand:t.sshCommand??null}}async function $g(e,t){const o=await f(y(`${F}/set-identity`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to set git identity")}return o.json()}async function eF(){const e=await f(y(`${F}/discover-credentials`,void 0));if(!e.ok)throw new Error(`Failed to discover git credentials: ${e.statusText}`);return e.json()}async function tF(e,t){if(!e)return null;const o=await f(y(`${F}/remote-url`,e,{remote:t}));return o.ok?(await o.json()).url??null:null}async function Gg(e){const t=await f(y(`${F}/remotes`,e));if(!t.ok)throw new Error(`Failed to get remotes: ${t.statusText}`);return t.json()}async function qg(e,t){const o=await f(y(`${F}/rebase`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to rebase")}return o.json()}async function Wg(e){const t=await f(y(`${F}/rebase/abort`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to abort rebase")}return t.json()}async function Vg(e,t){const o=await f(y(`${F}/merge`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to merge")}return o.json()}async function Kg(e,t){const o=await f(y(`${F}/checkout-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to checkout commit")}return o.json()}async function Jg(e,t){const o=await f(y(`${F}/cherry-pick`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to cherry-pick")}return o.json()}async function Yg(e,t){const o=await f(y(`${F}/revert-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to revert commit")}return o.json()}async function Qg(e,t,o,r){const n=await f(y(`${F}/reset-to-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t,mode:o,force:r})});if(!n.ok){const a=await n.json().catch(()=>({error:n.statusText}));throw new Error(a.error||"Failed to reset")}return n.json()}async function Xg(e){const t=await f(y(`${F}/merge/abort`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to abort merge")}return t.json()}async function Zg(e){const t=await f(y(`${F}/rebase/continue`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to continue rebase")}return t.json()}async function ep(e){const t=await f(y(`${F}/merge/continue`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to continue merge")}return t.json()}async function tp(e,t){return await ks(e,{message:t?.message}),{success:!0}}async function op(e){return await vs(e,{ref:"stash@{0}"}),{success:!0}}async function rp(e){const t=await f(y(`${F}/conflict-details`,e));if(!t.ok)throw new Error(`Failed to get conflict details: ${t.statusText}`);return t.json()}async function np(e,t){const o=await f(`${F}/validate-directory`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e,worktreeRoot:t})});if(!o.ok)throw new Error(`Failed to validate worktree directory: ${o.statusText}`);return o.json()}async function ap(e){const t=await f(`${F}/canonicalize-worktree-state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e})});if(!t.ok)throw new Error(`Failed to canonicalize worktree state: ${t.statusText}`);return t.json()}const sp=()=>({checkIsGitRepository:ag,getGitStatus:sg,getGitDiff:ig,getGitFileDiff:cg,revertGitFile:dg,stageGitFile:lg,stageGitFiles:Bs,unstageGitFile:ug,unstageGitFiles:Ds,stageGitHunk:fg,unstageGitHunk:mg,revertGitHunk:gg,isLinkedWorktree:pg,getGitBranches:hg,deleteGitBranch:Fg,deleteRemoteBranch:yg,removeRemote:bg,generateCommitMessage:Ag,generatePullRequestDescription:wg,listGitWorktrees:Kn,validateGitWorktree:Jn,createGitWorktree:Yn,deleteGitWorktree:Qn,validateWorktreeDirectory:np,canonicalizeWorktreeState:ap,createGitCommit(e,t,o){return Bg(e,t,o)},gitPush:Dg,gitPull:kg,gitFetch:vg,listGitStashes:Sg,countGitStashFiles:Mg,stashGitChanges:ks,applyGitStash:Tg,popGitStash:vs,dropGitStash:Pg,checkoutBranch:Rg,createBranch:Ig,renameBranch:xg,getGitLog(e,t){return Og(e,t)},getCommitFiles:_g,getCurrentGitIdentity:jg,hasLocalIdentity:zg,setGitIdentity:$g,getGitIdentities:Ng,createGitIdentity:Ug,updateGitIdentity:Lg,deleteGitIdentity:Hg,getRemotes:Gg,rebase:qg,abortRebase:Wg,continueRebase:Zg,merge:Vg,abortMerge:Xg,continueMerge:ep,checkoutCommit:Kg,cherryPick:Jg,revertCommit:Yg,resetToCommit:Qg,stash:tp,stashPop:op,getConflictDetails:rp,worktree:{list:Kn,validate:Jn,bootstrapStatus:Eg,preview:Cg,create:Yn,remove:Qn}}),K=e=>e.replace(/\\/g,"/"),ip=(e,t)=>{const o=K(t?.directory||t?.path||e),r=Array.isArray(t?.entries)?t.entries:[];return{directory:o,entries:r.filter(n=>!!(n&&typeof n.name=="string"&&typeof n.path=="string")).map(n=>({name:n.name,path:K(n.path),isDirectory:!!n.isDirectory}))}},he=(e,t)=>{const o=t||e?.();return o?{"x-opencode-directory":o}:void 0},cp=({getDirectory:e})=>({async listDirectory(t,o){const r=K(t),n=new URLSearchParams;r&&n.set("path",r),o?.respectGitignore&&n.set("respectGitignore","true");const a=await f("/api/fs/list",{query:n,headers:he(e)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to list directory")}const s=await a.json();return ip(r,s)},async search(t){const o=new URLSearchParams,r=K(t.directory);r&&o.set("directory",r),o.set("query",t.query),o.set("dirs","false"),o.set("type","file"),typeof t.maxResults=="number"&&Number.isFinite(t.maxResults)&&o.set("limit",String(t.maxResults));const n=await f("/api/find/file",{query:o,headers:he(e)});if(!n.ok){const i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error||"Failed to search files")}const a=await n.json();return(Array.isArray(a)?a:[]).map(i=>({path:K(`${r}/${i}`),preview:[K(i)]}))},async createDirectory(t){const o=K(t),r=await f("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to create directory")}const n=await r.json();return{success:!!n?.success,path:typeof n?.path=="string"?K(n.path):o}},async statFile(t,o){const r=K(t),n=new URLSearchParams({path:r});o?.allowOutsideWorkspace&&n.set("allowOutsideWorkspace","true"),o?.outsideFileGrant&&n.set("outsideFileGrant",o.outsideFileGrant);const a=await f("/api/fs/stat",{query:n,headers:he(e,o?.directory)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to stat file")}const s=await a.json().catch(()=>({}));return{path:typeof s.path=="string"?K(s.path):r,isFile:!!s.isFile,size:typeof s.size=="number"?s.size:0,mtimeMs:typeof s.mtimeMs=="number"?s.mtimeMs:void 0}},async readFile(t,o){const r=K(t),n=new URLSearchParams({path:r});o?.allowOutsideWorkspace&&n.set("allowOutsideWorkspace","true"),o?.outsideFileGrant&&n.set("outsideFileGrant",o.outsideFileGrant),o?.optional&&n.set("optional","true");const a=await f("/api/fs/read",{query:n,cache:o?.optional?"no-store":"default",headers:he(e,o?.directory)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to read file")}return{content:await a.text(),path:r}},async writeFile(t,o){const r=K(t),n=await f("/api/fs/write",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:r,content:o})});if(!n.ok){const s=await n.json().catch(()=>({error:n.statusText}));throw new Error(s.error||"Failed to write file")}const a=await n.json().catch(()=>({}));return{success:!!a.success,path:typeof a.path=="string"?K(a.path):r}},async delete(t){const o=K(t),r=await f("/api/fs/delete",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to delete file")}return{success:!!(await r.json().catch(()=>({}))).success}},async rename(t,o){const r=await f("/api/fs/rename",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({oldPath:t,newPath:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to rename file")}const n=await r.json().catch(()=>({}));return{success:!!n.success,path:typeof n.path=="string"?K(n.path):o}},async revealPath(t){const o=await f("/api/fs/reveal",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:K(t)})});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to reveal path")}return{success:!!(await o.json().catch(()=>({}))).success}},async downloadFile(t){const o=K(t),r=await f("/api/fs/raw",{query:{path:o,download:!0},headers:he(e)});if(!r.ok)throw new Error(`Download failed (${r.status})`);const n=await r.blob(),a=URL.createObjectURL(n),s=document.createElement("a");s.href=a,s.download=o.split("/").pop()||"file",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),100)}}),Xn="/api/config/settings",dp="/api/config/reload",Zn=e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid settings response");return e},lp=()=>({async load(){const e=await f(Xn,{method:"GET",headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`Failed to load settings: ${e.statusText}`);return{settings:Zn(await e.json()),source:"web"}},async save(e){const t=await f(Xn,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({error:t.statusText}));throw new Error(r.error||"Failed to save settings")}return Zn(await t.json())},async restartOpenCode(){const e=await f(dp,{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({error:e.statusText}));throw new Error(t.error||"Failed to restart OpenCode")}return{restarted:!0}}}),up=()=>({async requestDirectoryAccess(e){return{success:!0,path:e.path}},async startAccessingDirectory(e){return{success:!0}},async stopAccessingDirectory(e){return{success:!0}}}),fp=1500,Br=5e3,mp="openchamber-notification-claim:",vt=new Map,gp=()=>typeof document>"u"?!0:document.visibilityState==="visible"&&document.hasFocus(),pp=e=>{const t=typeof e?.tag=="string"?e.tag.trim():"";return t||[e?.sessionId,e?.kind,e?.title,e?.body].filter(o=>typeof o=="string"&&o.trim().length>0).map(o=>o.trim()).join("|")},hp=e=>{for(const[t,o]of vt)e-o>Br&&vt.delete(t)},Fp=e=>{const t=pp(e);if(!t)return!0;const o=Date.now();hp(o);const r=vt.get(t)??0;if(o-r<Br)return!1;try{if(typeof window<"u"&&window.localStorage){const n=`${mp}${t}`,a=Number(window.localStorage.getItem(n)??"0");if(Number.isFinite(a)&&o-a<Br)return vt.set(t,a),!1;Number.isFinite(a)&&a>0&&window.localStorage.removeItem(n),window.localStorage.setItem(n,String(o))}}catch{}return vt.set(t,o),!0},Ss=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;let e=null;try{e=await navigator.serviceWorker.getRegistration()??null}catch{e=null}if(e?.active)return e;if(!e)return null;try{return await Promise.race([navigator.serviceWorker.ready,new Promise(o=>{setTimeout(()=>o(null),fp)})])??e}catch{return e}},yp=async e=>{const t=await Ss();if(!t||typeof t.showNotification!="function")return!1;try{return await t.showNotification(e?.title??"OpenChamber",{body:e?.body,tag:e?.tag}),!0}catch(o){return console.warn("Failed to send notification via service worker",o),!1}},bp=async()=>{const e=await Ss();if(!e||!("pushManager"in e)||!e.pushManager)return!1;try{return!!await e.pushManager.getSubscription()}catch{return!1}},Ap=async e=>{if(e?.requireHidden&&typeof document<"u"&&document.hasFocus())return!0;if(typeof Notification>"u")return console.info("Notifications not supported in this environment",e),!1;if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return console.warn("Notification permission not granted"),!1;if(!gp()&&await bp()||!Fp(e))return!0;try{return await yp(e)||new Notification(e?.title??"OpenChamber",{body:e?.body,tag:e?.tag}),!0}catch(t){return console.warn("Failed to send notification",t),!1}},wp=async e=>{if(typeof window>"u")return!1;const t=window.__OPENCHAMBER_DESKTOP__;if(!t?.invoke)return!1;try{return await t.invoke("desktop_notify",{payload:{title:e?.title,body:e?.body,tag:e?.tag,kind:e?.kind,sessionId:e?.sessionId,directory:e?.directory,requireHidden:e?.requireHidden}}),!0}catch(o){return console.warn("Failed to send native notification (desktop)",o),!1}},Ep=()=>({async notifyAgentCompletion(e){return await wp(e)||await Ap(e)},canNotify:()=>typeof window<"u"&&window.__OPENCHAMBER_DESKTOP__?.invoke?!0:typeof Notification<"u"?Notification.permission==="granted":!1}),Cp=()=>({async getAvailableTools(){const e=await f("/api/experimental/tool/ids");if(!e.ok)throw new Error(`Tools API returned ${e.status} ${e.statusText}`);const t=await e.json();if(!Array.isArray(t))throw new Error("Tools API returned invalid data format");return t.filter(o=>typeof o=="string"&&o!=="invalid").sort()}}),at=async(e,t)=>{try{const o=await f(e,{...t,credentials:"include",headers:{Accept:"application/json",...t?.headers??{}}});return o.ok?await o.json():null}catch{return null}},Bp=()=>({async getVapidPublicKey(){return at("/api/push/vapid-public-key")},async subscribe(e){return at("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async unsubscribe(e){return at("/api/push/subscribe",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async setVisibility(e){return at("/api/push/visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0})},async registerApnsToken(e){return at("/api/push/apns-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async unregisterApnsToken(e){return at("/api/push/apns-token",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}),z=async e=>await e.json().catch(()=>null),Dp=({urls:e})=>({async authStatus(){const t=await f("/api/github/auth/status",{method:"GET",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to load GitHub status");return o},async authStart(){const t=await f("/api/github/auth/start",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({})}),o=await z(t);if(!t.ok||!o||!("deviceCode"in o))throw new Error(o?.error||t.statusText||"Failed to start GitHub auth");return o},async authComplete(t){const o=await f("/api/github/auth/complete",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({deviceCode:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to complete GitHub auth");return r},async authDisconnect(){const t=await f("/api/github/auth",{method:"DELETE",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok)throw new Error(o?.error||t.statusText||"Failed to disconnect GitHub");return{removed:!!o?.removed}},async authActivate(t){const o=await f("/api/github/auth/activate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({accountId:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to activate GitHub account");return r},async authSetGhCliDisabled(t){const o=await f("/api/github/auth/gh-cli",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({disabled:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to update gh CLI setting");return{disabled:!!r.disabled}},async me(){const t=await f("/api/github/me",{method:"GET",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to fetch GitHub user");return o},async prStatus(t,o,r,n){const a=new URLSearchParams({directory:t,branch:o,...r?{remote:r}:{},...n?.force?{force:"true"}:{}}),s=await f(`/api/github/pr/status?${a.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),i=await z(s);if(!s.ok||!i)throw new Error(i?.error||s.statusText||"Failed to load PR status");return i},async prCreate(t){const o=await f("/api/github/pr/create",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to create PR");return r},async prUpdate(t){const o=await f("/api/github/pr/update",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to update PR");return r},async prMerge(t){const o=await f("/api/github/pr/merge",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to merge PR");return r},async prReady(t){const o=await f("/api/github/pr/ready",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to mark PR ready");return r},async repoUpstream(t){const o=await f(`/api/github/repo/upstream?directory=${encodeURIComponent(t)}`,{method:"GET",headers:{Accept:"application/json"}}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to detect upstream repo");return r},async repoBranches(t,o){const r=await f(`/api/github/repo/branches?owner=${encodeURIComponent(t)}&repo=${encodeURIComponent(o)}`,{method:"GET",headers:{Accept:"application/json"}}),n=await z(r);if(!r.ok||!n)throw new Error(n?.error||r.statusText||"Failed to fetch repo branches");return n.branches??[]},async prsList(t,o){const r=o?.page??1,n=new URLSearchParams({directory:t,page:String(r)});o?.query&&n.set("query",o.query);const a=await f(`/api/github/pulls/list?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load pull requests");return s},async prContext(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.includeDiff&&n.set("diff","1"),r?.includeCheckDetails&&n.set("checkDetails","1"),r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/pulls/context",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load pull request context");return s},async issuesList(t,o){const r=o?.page??1,n=new URLSearchParams({directory:t,page:String(r)});o?.query&&n.set("query",o.query);const a=await f(`/api/github/issues/list?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issues");return s},async issueGet(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/issues/get",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issue");return s},async issueComments(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/issues/comments",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issue comments");return s}}),Me=async e=>await e.json().catch(()=>null),kp=()=>({async listClients(){const e=await f("/api/client-auth/clients",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load remote clients");return Array.isArray(t.clients)?t.clients:[]},async createClient(e={}){const t=await f("/api/client-auth/clients",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({label:e.label??""})}),o=await Me(t);if(!t.ok||!o?.client||typeof o.token!="string")throw new Error(o?.error||t.statusText||"Failed to create remote client token");return o},async createPairingSession(e={}){const t=await f("/api/client-auth/pairing/sessions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({label:e.label??"",...e.allowedClientKinds?{allowedClientKinds:e.allowedClientKinds}:{},...e.serverUrl?{serverUrl:e.serverUrl}:{},...typeof e.includeRelay=="boolean"?{includeRelay:e.includeRelay}:{},...typeof e.includeDirect=="boolean"?{includeDirect:e.includeDirect}:{}})}),o=await Me(t);if(!t.ok||typeof o?.pairing?.secret!="string"||!o?.server)throw new Error(o?.error||t.statusText||"Failed to create pairing session");return o},async listPendingPairings(){const e=await f("/api/client-auth/pairing/sessions",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load pending pairings");return Array.isArray(t.pending)?t.pending:[]},async getPairingTransports(){const e=await f("/api/client-auth/pairing/transports",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load pairing transports");return{local:t.local??null,lan:t.lan??null,relayAvailable:t.relayAvailable!==!1}},async cancelPairing(e){const t=await f(`/api/client-auth/pairing/sessions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}}),o=await Me(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to cancel pairing");return{cancelled:o.cancelled===!0}},async revokeClient(e){const t=await f(`/api/client-auth/clients/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}}),o=await Me(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to revoke remote client");return o},async purgeRevokedClients(){const e=await f("/api/client-auth/clients",{method:"DELETE",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to clear revoked clients");return t}}),vp=()=>({api:(...e)=>oe().api(...e),authenticatedAsset:(...e)=>oe().authenticatedAsset(...e),auth:(...e)=>oe().auth(...e),health:(...e)=>oe().health(...e),rawFile:(...e)=>oe().rawFile(...e),sse:(...e)=>oe().sse(...e),websocket:(...e)=>oe().websocket(...e)}),Sp=(e={})=>{const t=e.urls??Pr();Wi(t);const o=vp();return{runtime:{platform:"web",isDesktop:!1,isVSCode:!1,label:"web"},terminal:og(),git:sp(),files:cp({getDirectory:()=>wr.getState().currentDirectory}),settings:lp(),permissions:up(),notifications:Ep(),github:Dp({urls:o}),push:Bp(),clientAuth:kp(),tools:Cp()}},ea=(e,t)=>{if(!e||!t)return!1;try{return new URL(e).origin===new URL(t).origin}catch{return!1}};let Ms=Promise.resolve();const oF=()=>Ms,rF=()=>{const e=typeof window.__OPENCHAMBER_API_BASE_URL__=="string"?window.__OPENCHAMBER_API_BASE_URL__.trim():"",t=typeof window.__OPENCHAMBER_CLIENT_TOKEN__=="string"?window.__OPENCHAMBER_CLIENT_TOKEN__.trim():"",o=typeof window.__OPENCHAMBER_LOCAL_ORIGIN__=="string"?window.__OPENCHAMBER_LOCAL_ORIGIN__.trim():"",r=Ta({apiBaseUrl:e||void 0,realtimeBaseUrl:e||void 0});nc({apiBaseUrl:e,runtimeKey:ea(e,o)?"local":null}),ba(t||null),Aa(window.__OPENCHAMBER_RUNTIME_HEADERS__||null),Co(e||void 0).catch(()=>{}),o&&!ea(e,o)&&Object.keys(Eo()).length>0&&ka(o).catch(()=>{}),rc();const n=window.__OPENCHAMBER_RELAY_HOST_ID__;return Ms=Promise.race([Lc(typeof n=="string"&&n?n:void 0).catch(()=>{}),new Promise(a=>{window.setTimeout(a,1e4)})]),Sp({urls:r})};export{xd as $,ch as A,_h as B,tm as C,em as D,sh as E,gc as F,Gh as G,gt as H,Do as I,za as J,mh as K,Pc as L,Mc as M,G as N,Zf as O,wa as P,Vp as Q,Yp as R,kh as S,vh as T,Dm as U,Bd as V,ih as W,Rp as X,Ip as Y,Bh as Z,Kp as _,L as a,Od as a$,Wh as a0,ah as a1,nh as a2,Pm as a3,$h as a4,Tm as a5,Ah as a6,fe as a7,yh as a8,dc as a9,Nd as aA,Up as aB,Eh as aC,md as aD,Fd as aE,gd as aF,yd as aG,po as aH,Ld as aI,ko as aJ,jp as aK,$p as aL,qp as aM,zp as aN,Gp as aO,Wp as aP,hd as aQ,Jp as aR,Xp as aS,Zp as aT,Kh as aU,Lp as aV,Hp as aW,id as aX,km as aY,bh as aZ,Ka as a_,cc as aa,xp as ab,Mm as ac,Ch as ad,Op as ae,_p as af,mc as ag,Ur as ah,oh as ai,eh as aj,th as ak,Ut as al,Lh as am,Uh as an,Hh as ao,Rc as ap,fh as aq,Ic as ar,pe as as,Dc as at,$a as au,dh as av,lh as aw,ph as ax,rh as ay,jd as az,Lt as b,Bs as b$,Eg as b0,ds as b1,La as b2,wo as b3,zm as b4,ac as b5,Xg as b6,Wg as b7,Tg as b8,ap as b9,Og as bA,sg as bB,Zh as bC,tF as bD,Gg as bE,Jn as bF,Kn as bG,vg as bH,kg as bI,Dg as bJ,zg as bK,pg as bL,Sg as bM,Vg as bN,vs as bO,Cg as bP,qg as bQ,bg as bR,xg as bS,Qg as bT,Jh as bU,Yh as bV,Yg as bW,dg as bX,gg as bY,$g as bZ,lg as b_,ag as ba,Rg as bb,Kg as bc,Jg as bd,ep as be,Zg as bf,Mg as bg,Ig as bh,Bg as bi,Ug as bj,Yn as bk,Fg as bl,Hg as bm,Qn as bn,yg as bo,eF as bp,Pg as bq,Xh as br,_g as bs,rp as bt,jg as bu,hg as bv,Qh as bw,ig as bx,cg as by,Ng as bz,rF as c,fg as c0,tp as c1,ks as c2,op as c3,ug as c4,Ds as c5,mg as c6,Lg as c7,np as c8,Z as c9,pd as cA,uh as cB,wh as ca,fd as cb,dr as cc,Xf as cd,gs as ce,ms as cf,Fh as cg,hh as ch,gh as ci,Uc as cj,Eo as ck,Jt as cl,Wo as cm,nt as cn,Sh as co,Th as cp,xh as cq,Ph as cr,Mh as cs,Rh as ct,cs as cu,Ih as cv,qh as cw,Qp as cx,Vh as cy,Dh as cz,oe as d,Oh as e,_r as f,oF as g,wr as h,Tp as i,f as j,Pp as k,vr as l,Bo as m,Np as n,Oa as o,Ec as p,Oe as q,Co as r,nr as s,zh as t,ie as u,jh as v,Nh as w,be as x,Ua as y,ee as z};
|
|
6
|
+
`),o,t)},_d=(e,t)=>{const o=e??{},r=t<2?o.queuedMessages??{}:{};return{queuedMessages:t<2?{}:o.queuedMessages??{},quarantinedLegacyMessages:{...o.quarantinedLegacyMessages??{},...r},followUpBehavior:$r(o.followUpBehavior,o.queueModeEnabled??null)}},Nd=_t()(Nt(Dr((e,t)=>({queuedMessages:{},quarantinedLegacyMessages:{},followUpBehavior:jr,addToQueue:(o,r)=>{const n=nt(o),s={id:`queued-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,content:r.content,attachments:r.attachments,createdAt:Date.now(),sendConfig:r.sendConfig};e(i=>{const c=i.queuedMessages[n]??[],d={...i.queuedMessages,[n]:[...c,s].slice(-20)},l=Object.keys(d);if(l.length>On){l.sort((u,m)=>(d[u]?.[0]?.createdAt??0)-(d[m]?.[0]?.createdAt??0));for(const u of l.slice(0,l.length-On))delete d[u]}return{queuedMessages:d}})},removeFromQueue:(o,r)=>{const n=nt(o);e(a=>{const i=(a.queuedMessages[n]??[]).filter(c=>c.id!==r);if(i.length===0){const{[n]:c,...d}=a.queuedMessages;return{queuedMessages:d}}return{queuedMessages:{...a.queuedMessages,[n]:i}}})},reorderQueue:(o,r,n)=>{if(r===n)return;const a=nt(o);e(s=>{const i=s.queuedMessages[a];if(!i)return s;const c=i.findIndex(m=>m.id===r),d=i.findIndex(m=>m.id===n);if(c===-1||d===-1)return s;const l=i.slice(),[u]=l.splice(c,1);return l.splice(d,0,u),{queuedMessages:{...s.queuedMessages,[a]:l}}})},popToInput:(o,r)=>{const n=nt(o),i=(t().queuedMessages[n]??[]).find(c=>c.id===r);return i?(e(c=>{const l=(c.queuedMessages[n]??[]).filter(u=>u.id!==r);if(l.length===0){const{[n]:u,...m}=c.queuedMessages;return{queuedMessages:m}}return{queuedMessages:{...c.queuedMessages,[n]:l}}}),i):null},clearQueue:o=>{const r=nt(o);e(n=>{const{[r]:a,...s}=n.queuedMessages;return{queuedMessages:s}})},clearAllQueues:()=>{e({queuedMessages:{}})},setFollowUpBehavior:o=>{e({followUpBehavior:o}),be({followUpBehavior:o})},getQueueForTarget:o=>t().queuedMessages[nt(o)]??[]}),{name:"message-queue-store",version:2,storage:Ur(),partialize:e=>({queuedMessages:e.queuedMessages,quarantinedLegacyMessages:e.quarantinedLegacyMessages,followUpBehavior:e.followUpBehavior}),migrate:_d}),{name:"message-queue-store"})),as="directoryTreeShowHidden",ir="directory-show-hidden-change",_n=()=>{if(typeof window>"u")return!0;try{const e=Lt().getItem(as);return e===null?!0:e==="true"}catch{return!0}},Ud=()=>{typeof window>"u"||window.dispatchEvent(new Event(ir))},Ld=(e,t={})=>{if(!(typeof window>"u")){try{Lt().setItem(as,e?"true":"false"),Ud()}catch{}t.persist!==!1&&be({directoryShowHidden:e})}},kh=()=>{const e=ta.c(2),[t,o]=ao.useState(_n);let r,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{if(typeof window>"u")return;const a=()=>{o(_n())};return window.addEventListener("storage",a),window.addEventListener(ir,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(ir,a)}},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),ao.useEffect(r,n),t},ss="filesViewShowGitignored",cr="files-view-show-gitignored-change",Nn=()=>{if(typeof window>"u")return!1;try{return Lt().getItem(ss)==="true"}catch{return!1}},Hd=()=>{typeof window>"u"||window.dispatchEvent(new Event(cr))},jd=(e,t={})=>{if(!(typeof window>"u")){try{Lt().setItem(ss,e?"true":"false"),Hd()}catch{}t.persist!==!1&&be({filesViewShowGitignored:e})}},vh=()=>{const e=ta.c(2),[t,o]=ao.useState(Nn);let r,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{if(typeof window>"u")return;const a=()=>{o(Nn())};return window.addEventListener("storage",a),window.addEventListener(cr,a),()=>{window.removeEventListener("storage",a),window.removeEventListener(cr,a)}},n=[],e[0]=r,e[1]=n):(r=e[0],n=e[1]),ao.useEffect(r,n),t},zd=e=>{if(!e||typeof e!="object")return null;const t={};return typeof e.showReasoningTraces=="boolean"&&(t.showReasoningTraces=e.showReasoningTraces),typeof e.collapsibleThinkingBlocks=="boolean"&&(t.collapsibleThinkingBlocks=e.collapsibleThinkingBlocks),Object.keys(t).length>0?t:null},$d=e=>{if(!e||typeof e!="object")return null;const t=e;return{showReasoningTraces:t.showReasoningTraces,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks}},Gd=e=>{const t=ie.getState();typeof e.showReasoningTraces=="boolean"&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.collapsibleThinkingBlocks=="boolean"&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks)},qd=async()=>{if(typeof window>"u")return null;const e=localStorage.getItem("appearance-preferences");if(!e)return null;try{const t=JSON.parse(e),o=$d(t);return zd(o)}catch(t){return console.warn("Failed to parse stored appearance preferences:",t),null}},is=[{name:"explore",icon:"compass-3",labelKey:"chat.draftPresets.explore.label",command:"/explore"},{name:"catch-up",icon:"history",labelKey:"chat.draftPresets.catchup.label",command:"/catch-up"},{name:"weigh",icon:"scales-3",labelKey:"chat.draftPresets.weigh.label",command:"/weigh"},{name:"plan-feature",icon:"survey",labelKey:"chat.draftPresets.plan.label",command:"/plan-feature"},{name:"craft-goal",icon:"target",labelKey:"chat.draftPresets.craftGoal.label",command:"/craft-goal"},{name:"schedule-task",icon:"calendar-schedule",labelKey:"chat.draftPresets.scheduleTask.label",command:"/schedule-task"},{name:"debug",icon:"bug",labelKey:"chat.draftPresets.debug.label",command:"/debug"},{name:"review",icon:"search-eye",labelKey:"chat.draftPresets.review.label",command:"/workspace-review"}],Wd=new Map(is.map(e=>[e.name,e])),Sh=e=>Wd.get(e),Mh=is.map(e=>({type:"command",name:e.name})),Th="terminal-box",Ph="book-open",Rh=e=>`${e.type}:${e.name}`,Ih=(e,t)=>e.type===t.type&&e.name===t.name,xh=e=>{const t=e.replace(/^\//,"").replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t?t.charAt(0).toUpperCase()+t.slice(1):e},cs=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r,a=n.type==="command"||n.type==="skill"?n.type:null,s=typeof n.name=="string"?n.name.trim():"";if(!a||!s)continue;const i=`${a}:${s}`;o.has(i)||(o.add(i),t.push({type:a,name:s}))}return t},Vd=["bash","zsh","sh","fish","pwsh","powershell","cmd","dash","ksh","nu"],po=e=>e==="auto"||typeof e=="string"&&Vd.includes(e),Kd="#8957e5",Jd="#8250df",Yd=e=>{const t=e.colors.syntax?.tokens??{},o=[t.className,t.enum,t.variableGlobal,e.colors.syntax?.base?.keyword].filter(r=>typeof r=="string"&&r.trim().length>0);return o.length>0?o[0]:e.metadata.variant==="dark"?Kd:Jd},Ht=e=>e.colors.pr?e:{...e,colors:{...e.colors,pr:{open:e.colors.status.success,draft:e.colors.surface.mutedForeground,blocked:e.colors.status.warning,merged:Yd(e),closed:e.colors.status.error}}},Qd={id:"aura-dark",name:"Aura",description:"Aura",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Xd={primary:{base:"#A277FF",hover:"#8D68DD",active:"#B08BFF",foreground:"#15141B",muted:"#A277FF80",emphasis:"#8D68DD"},surface:{background:"#15141B",foreground:"#EDECEE",muted:"#1A1921",mutedForeground:"#8a8282",elevated:"#201e2b",elevatedForeground:"#EDECEE",overlay:"#FFFFFF20",subtle:"#25232f"},interactive:{border:"#2D2B38",borderHover:"#47415a",borderFocus:"#4E496C",selection:"#95abe02d",selectionForeground:"#FFFFFF",focus:"#A277FF",focusRing:"#A277FF40",cursor:"#FFFFFF",hover:"#7887ac2d",active:"#95abe02d"},status:{error:"#FF6767",errorForeground:"#15141B",errorBackground:"#FF676720",errorBorder:"#FF676750",warning:"#FFCA85",warningForeground:"#15141B",warningBackground:"#FFCA8520",warningBorder:"#FFCA8550",success:"#61FFCA",successForeground:"#15141B",successBackground:"#61FFCA20",successBorder:"#61FFCA50",info:"#82E2FF",infoForeground:"#15141B",infoBackground:"#82E2FF20",infoBorder:"#82E2FF50"},pr:{open:"#61FFCA",draft:"#6D6D6D",blocked:"#FFCA85",merged:"#A277FF",closed:"#FF6767"},syntax:{base:{background:"#1A1921",foreground:"#EDECEE",comment:"#6D6D6D",keyword:"#A277FF",string:"#61FFCA",number:"#FF6767",function:"#A277FF",variable:"#EDECEE",type:"#FFCA85",operator:"#FF6767"},tokens:{boolean:"#FFCA85",class:"#A277FF",className:"#A277FF",commentDoc:"#606061",constant:"#82E2FF",decorator:"#FFCA85",enum:"#A277FF",exception:"#FF6767",functionCall:"#A277FF",interface:"#FFCA85",jsxTag:"#A277FF",key:"#A277FF",keywordImport:"#FF6767",label:"#FF6767",macro:"#82E2FF",method:"#61FFCA",module:"#FF6767",namespace:"#FFCA85",parameter:"#EDECEE",preprocessor:"#FF6767",punctuation:"#6D6D6D",regex:"#61FFCA",storageModifier:"#82E2FF",stringEscape:"#FFFFFF",struct:"#A277FF",tag:"#A277FF",tagAttribute:"#FFCA85",tagAttributeValue:"#61FFCA",typeParameter:"#FFCA85",url:"#A277FF",variableGlobal:"#A277FF",variableLocal:"#121118",variableOther:"#61FFCA",variableProperty:"#82E2FF"},highlights:{diffAdded:"#61FFCA",diffAddedBackground:"#162620",diffModified:"#82E2FF",diffModifiedBackground:"#1E1D2A",diffRemoved:"#FF6767",diffRemovedBackground:"#26161A",lineNumber:"#3E3A56",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#e7d7f4",heading2:"#e7e0ee",heading3:"#ece7f0",heading4:"#EDECEE",link:"#A277FF",linkHover:"#F694FF",inlineCode:"#61FFCA",inlineCodeBackground:"#1A1921",blockquote:"#6D6D6D",blockquoteBorder:"#2D2B38",listMarker:"#A277FF99"},chat:{userMessage:"#EDECEE",userMessageBackground:"#393647",assistantMessage:"#EDECEE",assistantMessageBackground:"#15141B",timestamp:"#6D6D6D",divider:"#2D2B38"},tools:{background:"#1A192180",border:"#43415480",headerHover:"#0F0E14",icon:"#6D6D6D",title:"#EDECEE",description:"#6D6D6D",edit:{added:"#61FFCA",addedBackground:"#61FFCA25",removed:"#FF6767",removedBackground:"#FF676725",lineNumber:"#3E3A56"}}},Zd={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},el={metadata:Qd,colors:Xd,config:Zd},tl={id:"aura-light",name:"Aura",description:"Aura",version:"1.0.0",variant:"light",tags:["light","palette"]},ol={primary:{base:"#A277FF",hover:"#B38FFF",active:"#8D68DD",foreground:"#F5F0FF",muted:"#A277FF80",emphasis:"#B38FFF"},surface:{background:"#F5F0FF",foreground:"#2D2640",muted:"#EFE8FC",mutedForeground:"#807b8b",elevated:"#f1ebfb",elevatedForeground:"#2D2640",overlay:"#15101F20",subtle:"#EFE8FC"},interactive:{border:"#E0D6F2",borderHover:"#D5C9EB",borderFocus:"#A593C8",selection:"#bdb2d74c",selectionForeground:"#15101F",focus:"#A277FF",focusRing:"#A277FF40",cursor:"#15101F",hover:"#bdb2d72d",active:"#bdb2d74c"},status:{error:"#D94F4F",errorForeground:"#F5F0FF",errorBackground:"#D94F4F20",errorBorder:"#D94F4F50",warning:"#D9A24A",warningForeground:"#F5F0FF",warningBackground:"#D9A24A20",warningBorder:"#D9A24A50",success:"#40BF7A",successForeground:"#F5F0FF",successBackground:"#40BF7A20",successBorder:"#40BF7A50",info:"#5BB8D9",infoForeground:"#F5F0FF",infoBackground:"#5BB8D920",infoBorder:"#5BB8D950"},pr:{open:"#40BF7A",draft:"#6D6D6D",blocked:"#D9A24A",merged:"#A277FF",closed:"#D94F4F"},syntax:{base:{background:"#EFE8FC",foreground:"#2D2640",comment:"#5C5270",keyword:"#A277FF",string:"#40BF7A",number:"#D94F4F",function:"#A277FF",variable:"#2D2640",type:"#D9A24A",operator:"#D94F4F"},tokens:{boolean:"#D9A24A",class:"#A277FF",className:"#A277FF",commentDoc:"#A9A1B8",constant:"#5BB8D9",decorator:"#D9A24A",enum:"#A277FF",exception:"#D94F4F",functionCall:"#A277FF",interface:"#D9A24A",jsxTag:"#A277FF",key:"#A277FF",keywordImport:"#D94F4F",label:"#D94F4F",macro:"#5BB8D9",method:"#40BF7A",module:"#D94F4F",namespace:"#D9A24A",parameter:"#2D2640",preprocessor:"#D94F4F",punctuation:"#5C5270",regex:"#40BF7A",storageModifier:"#5BB8D9",stringEscape:"#15101F",struct:"#A277FF",tag:"#A277FF",tagAttribute:"#D9A24A",tagAttributeValue:"#40BF7A",typeParameter:"#D9A24A",url:"#A277FF",variableGlobal:"#A277FF",variableLocal:"#FAF7FF",variableOther:"#40BF7A",variableProperty:"#5BB8D9"},highlights:{diffAdded:"#40BF7A",diffAddedBackground:"#E8F5ED",diffModified:"#5BB8D9",diffModifiedBackground:"#E8E4F5",diffRemoved:"#D94F4F",diffRemovedBackground:"#FAE8E8",lineNumber:"#C0B3DC",lineNumberActive:"#15101F"}},markdown:{heading1:"#A277FF",heading2:"#A277FF",heading3:"#D9A24A",heading4:"#2D2640",link:"#A277FF",linkHover:"#C17AC8",inlineCode:"#40BF7A",inlineCodeBackground:"#EFE8FC",blockquote:"#6D6D6D",blockquoteBorder:"#E0D6F2",listMarker:"#A277FF99"},chat:{userMessage:"#2D2640",userMessageBackground:"#EFE8FC",assistantMessage:"#2D2640",assistantMessageBackground:"#F5F0FF",timestamp:"#5C5270",divider:"#E0D6F2"},tools:{background:"#EFE8FC80",border:"#bdb5cd80",headerHover:"#FDFCFF",icon:"#5C5270",title:"#2D2640",description:"#5C5270",edit:{added:"#40BF7A",addedBackground:"#40BF7A25",removed:"#D94F4F",removedBackground:"#D94F4F25",lineNumber:"#C0B3DC"}}},rl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},nl={metadata:tl,colors:ol,config:rl},al={id:"ayu-dark",name:"Ayu",description:"Ayu",version:"1.0.0",variant:"dark",tags:["dark","palette"]},sl={primary:{base:"#3FB7E3",hover:"#389FC5",active:"#5BC1E7",foreground:"#0F1419",muted:"#3FB7E380",emphasis:"#389FC5"},surface:{background:"#0F1419",foreground:"#D6DAE0",muted:"#18222C",mutedForeground:"#777e86",elevated:"#17202a",elevatedForeground:"#D6DAE0",overlay:"#FBFBFD20",subtle:"#1e252d"},interactive:{border:"#2B3440",borderHover:"#323C49",borderFocus:"#56647C",selection:"#c7c7df1d",selectionForeground:"#FBFBFD",focus:"#3FB7E3",focusRing:"#3FB7E340",cursor:"#FBFBFD",hover:"#b6b6cc1d",active:"#b8b8ce1d"},status:{error:"#F58572",errorForeground:"#0F1419",errorBackground:"#F5857220",errorBorder:"#F5857250",warning:"#E4A75C",warningForeground:"#0F1419",warningBackground:"#E4A75C20",warningBorder:"#E4A75C50",success:"#78D05C",successForeground:"#0F1419",successBackground:"#78D05C20",successBorder:"#78D05C50",info:"#66C6F1",infoForeground:"#0F1419",infoBackground:"#66C6F120",infoBorder:"#66C6F150"},pr:{open:"#78D05C",draft:"#A3ADBA",blocked:"#E4A75C",merged:"#8a44f2",closed:"#F58572"},syntax:{base:{background:"#18222C",foreground:"#D6DAE0",comment:"#A3ADBA",keyword:"#3FB7E3",string:"#B1C74A",number:"#F2856F",function:"#3FB7E3",variable:"#D6DAE0",type:"#E4A75C",operator:"#F2856F"},tokens:{boolean:"#E4A75C",class:"#3FB7E3",className:"#3FB7E3",commentDoc:"#8D96A2",constant:"#66C6F1",decorator:"#E4A75C",enum:"#3FB7E3",exception:"#F2856F",functionCall:"#3FB7E3",interface:"#E4A75C",jsxTag:"#3FB7E3",key:"#3FB7E3",keywordImport:"#F2856F",label:"#F2856F",macro:"#66C6F1",method:"#78D05C",module:"#F2856F",namespace:"#E4A75C",parameter:"#D6DAE0",preprocessor:"#F2856F",punctuation:"#A3ADBA",regex:"#B1C74A",storageModifier:"#66C6F1",stringEscape:"#FBFBFD",struct:"#3FB7E3",tag:"#3FB7E3",tagAttribute:"#E4A75C",tagAttributeValue:"#B1C74A",typeParameter:"#E4A75C",url:"#66C6F1",variableGlobal:"#3FB7E3",variableLocal:"#0B1015",variableOther:"#78D05C",variableProperty:"#66C6F1"},highlights:{diffAdded:"#78D05C",diffAddedBackground:"#132F27",diffModified:"#66C6F1",diffModifiedBackground:"#1B2632",diffRemoved:"#F58572",diffRemovedBackground:"#361D20",lineNumber:"#415063",lineNumberActive:"#FBFBFD"}},markdown:{heading1:"#D6DAE0",heading2:"#D6DAE0",heading3:"#D6DAE0",heading4:"#D6DAE0",link:"#66C6F1",linkHover:"#3FB7E3",inlineCode:"#B1C74A",inlineCodeBackground:"#161d23",blockquote:"#E4A75C",blockquoteBorder:"#2B3440",listMarker:"#3FB7E399"},chat:{userMessage:"#D6DAE0",userMessageBackground:"#1d2935",assistantMessage:"#D6DAE0",assistantMessageBackground:"#0F1419",timestamp:"#A3ADBA",divider:"#2B3440"},tools:{background:"#18222C80",border:"#414e5f80",headerHover:"#080C10",icon:"#A3ADBA",title:"#D6DAE0",description:"#A3ADBA",edit:{added:"#78D05C",addedBackground:"#78D05C25",removed:"#F58572",removedBackground:"#F5857225",lineNumber:"#415063"}}},il={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},cl={metadata:al,colors:sl,config:il},dl={id:"ayu-light",name:"Ayu",description:"Ayu",version:"1.0.0",variant:"light",tags:["light","palette"]},ll={primary:{base:"#4AA8C8",hover:"#6EB8D1",active:"#4394B0",foreground:"#FDFAF4",muted:"#4AA8C880",emphasis:"#6EB8D1"},surface:{background:"#FDFAF4",foreground:"#394049",muted:"#f7f3eb",mutedForeground:"#777e87",elevated:"#faf6ed",elevatedForeground:"#4F5964",overlay:"#1B232B20",subtle:"#FFF7E5"},interactive:{border:"#E6DDCF",borderHover:"#DCD3C5",borderFocus:"#B09F8F",selection:"#9fb2c43e",selectionForeground:"#171e25",focus:"#4AA8C8",focusRing:"#4AA8C840",cursor:"#1B232B",hover:"#9fb2c42c",active:"#9fb2c43e"},status:{error:"#E6656A",errorForeground:"#FDFAF4",errorBackground:"#E6656A20",errorBorder:"#E6656A50",warning:"#EA9F41",warningForeground:"#FDFAF4",warningBackground:"#EA9F4120",warningBorder:"#EA9F4150",success:"#5FB978",successForeground:"#FDFAF4",successBackground:"#5FB97820",successBorder:"#5FB97850",info:"#2F9BCE",infoForeground:"#FDFAF4",infoBackground:"#2F9BCE20",infoBorder:"#2F9BCE50"},pr:{open:"#5FB978",draft:"#77818D",blocked:"#EA9F41",merged:"#7b3cda",closed:"#E6656A"},syntax:{base:{background:"#FCF9F3",foreground:"#4F5964",comment:"#77818D",keyword:"#4AA8C8",string:"#7FAD00",number:"#EF7D71",function:"#4AA8C8",variable:"#4F5964",type:"#ED982E",operator:"#EF7D71"},tokens:{boolean:"#ED982E",class:"#4AA8C8",className:"#4AA8C8",commentDoc:"#BABEC1",constant:"#2F9BCE",decorator:"#ED982E",enum:"#4AA8C8",exception:"#EF7D71",functionCall:"#4AA8C8",interface:"#ED982E",jsxTag:"#4AA8C8",key:"#4AA8C8",keywordImport:"#EF7D71",label:"#EF7D71",macro:"#2F9BCE",method:"#5FB978",module:"#EF7D71",namespace:"#ED982E",parameter:"#4F5964",preprocessor:"#EF7D71",punctuation:"#77818D",regex:"#7FAD00",storageModifier:"#2F9BCE",stringEscape:"#1B232B",struct:"#4AA8C8",tag:"#4AA8C8",tagAttribute:"#ED982E",tagAttributeValue:"#7FAD00",typeParameter:"#ED982E",url:"#2F9BCE",variableGlobal:"#4AA8C8",variableLocal:"#FBF8F2",variableOther:"#5FB978",variableProperty:"#2F9BCE"},highlights:{diffAdded:"#5FB978",diffAddedBackground:"#EEF5E4",diffModified:"#2F9BCE",diffModifiedBackground:"#E3EDF3",diffRemoved:"#E6656A",diffRemovedBackground:"#FDE5E5",lineNumber:"#C6BFAF",lineNumberActive:"#1B232B"}},markdown:{heading1:"#394049",heading2:"#394049",heading3:"#394049",heading4:"#394049",link:"#2F9BCE",linkHover:"#4AA8C8",inlineCode:"#7FAD00",inlineCodeBackground:"#FCF9F3",blockquote:"#ED982E",blockquoteBorder:"#E6DDCF",listMarker:"#4AA8C899"},chat:{userMessage:"#4F5964",userMessageBackground:"#fff7e5",assistantMessage:"#4F5964",assistantMessageBackground:"#FDFAF4",timestamp:"#77818D",divider:"#E6DDCF"},tools:{background:"#FCF9F380",border:"#cec6b980",headerHover:"#FAF7F1",icon:"#77818D",title:"#4F5964",description:"#77818D",edit:{added:"#5FB978",addedBackground:"#5FB97825",removed:"#E6656A",removedBackground:"#E6656A25",lineNumber:"#C6BFAF"}}},ul={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},fl={metadata:dl,colors:ll,config:ul},ml={id:"carbonfox-dark",name:"Carbonfox",description:"Carbonfox",version:"1.0.0",variant:"dark",tags:["dark","palette"]},gl={primary:{base:"#33B1FF",hover:"#2F9ADC",active:"#52BDFF",foreground:"#161616",muted:"#33B1FF80",emphasis:"#2F9ADC"},surface:{background:"#161616",foreground:"#F2F4F8",muted:"#222222",mutedForeground:"#8b8a8a",elevated:"#222222",elevatedForeground:"#F2F4F8",overlay:"#FFFFFF20",subtle:"#292828"},interactive:{border:"#393939",borderHover:"#4C4C4C",borderFocus:"#4589FF",selection:"#ffffff20",selectionForeground:"#FFFFFF",focus:"#4589FF",focusRing:"#4589FF40",cursor:"#FFFFFF",hover:"#ffffff12",active:"#ffffff12"},status:{error:"#FF8389",errorForeground:"#161616",errorBackground:"#FF838920",errorBorder:"#FF838950",warning:"#F1C21B",warningForeground:"#161616",warningBackground:"#F1C21B20",warningBorder:"#F1C21B50",success:"#42BE65",successForeground:"#161616",successBackground:"#42BE6520",successBorder:"#42BE6550",info:"#78A9FF",infoForeground:"#161616",infoBackground:"#78A9FF20",infoBorder:"#78A9FF50"},pr:{open:"#42BE65",draft:"#8D8D8D",blocked:"#F1C21B",merged:"#BE95FF",closed:"#FF8389"},syntax:{base:{background:"#262626",foreground:"#F2F4F8",comment:"#8D8D8D",keyword:"#78A9FF",string:"#42BE65",number:"#FF8389",function:"#78A9FF",variable:"#F2F4F8",type:"#08BDBA",operator:"#FF8389"},tokens:{boolean:"#08BDBA",class:"#78A9FF",className:"#78A9FF",commentDoc:"#7B7B7B",constant:"#BE95FF",decorator:"#08BDBA",enum:"#78A9FF",exception:"#FF8389",functionCall:"#78A9FF",interface:"#08BDBA",jsxTag:"#78A9FF",key:"#78A9FF",keywordImport:"#FF8389",label:"#FF8389",macro:"#78A9FF",method:"#42BE65",module:"#FF8389",namespace:"#08BDBA",parameter:"#F2F4F8",preprocessor:"#FF8389",punctuation:"#8D8D8D",regex:"#42BE65",storageModifier:"#78A9FF",stringEscape:"#FFFFFF",struct:"#78A9FF",tag:"#78A9FF",tagAttribute:"#08BDBA",tagAttributeValue:"#42BE65",typeParameter:"#08BDBA",url:"#33B1FF",variableGlobal:"#78A9FF",variableLocal:"#0D0D0D",variableOther:"#42BE65",variableProperty:"#BE95FF"},highlights:{diffAdded:"#42BE65",diffAddedBackground:"#0E3A22",diffModified:"#78A9FF",diffModifiedBackground:"#78A9FF20",diffRemoved:"#FF8389",diffRemovedBackground:"#4D1A1F",lineNumber:"#4C4C4C",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F2F4F8",heading2:"#F2F4F8",heading3:"#F2F4F8",heading4:"#F2F4F8",link:"#33B1FF",linkHover:"#78A9FF",inlineCode:"#42BE65",inlineCodeBackground:"#1e1e1e",blockquote:"#8D8D8D",blockquoteBorder:"#393939",listMarker:"#33B1FF99"},chat:{userMessage:"#F2F4F8",userMessageBackground:"#262626",assistantMessage:"#F2F4F8",assistantMessageBackground:"#161616",timestamp:"#8D8D8D",divider:"#393939"},tools:{background:"#26262680",border:"#4e4c4c80",headerHover:"#000000",icon:"#8D8D8D",title:"#F2F4F8",description:"#8D8D8D",edit:{added:"#42BE65",addedBackground:"#42BE6525",removed:"#FF8389",removedBackground:"#FF838925",lineNumber:"#4C4C4C"}}},pl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},hl={metadata:ml,colors:gl,config:pl},Fl={id:"carbonfox-light",name:"Carbonfox",description:"Carbonfox",version:"1.0.0",variant:"light",tags:["light","palette"]},yl={primary:{base:"#0072C3",hover:"#338ECF",active:"#0061A6",foreground:"#FFFFFF",muted:"#0072C380",emphasis:"#338ECF"},surface:{background:"#FFFFFF",foreground:"#161616",muted:"#F4F4F4",mutedForeground:"#868585",elevated:"#f4f4f7",elevatedForeground:"#161616",overlay:"#00000020",subtle:"#f2f2f8"},interactive:{border:"#DCDCDC",borderHover:"#D0D0D0",borderFocus:"#0F62FE",selection:"#cacfd87f",selectionForeground:"#000000",focus:"#0F62FE",focusRing:"#0F62FE40",cursor:"#000000",hover:"#43424214",active:"#43424212"},status:{error:"#DA1E28",errorForeground:"#FFFFFF",errorBackground:"#DA1E2820",errorBorder:"#DA1E2850",warning:"#F1C21B",warningForeground:"#FFFFFF",warningBackground:"#F1C21B20",warningBorder:"#F1C21B50",success:"#198038",successForeground:"#FFFFFF",successBackground:"#19803820",successBorder:"#19803850",info:"#0043CE",infoForeground:"#FFFFFF",infoBackground:"#0043CE20",infoBorder:"#0043CE50"},pr:{open:"#42BE65",draft:"#8D8D8D",blocked:"#F1C21B",merged:"#BE95FF",closed:"#FF8389"},syntax:{base:{background:"#F4F4F4",foreground:"#161616",comment:"#525252",keyword:"#0043CE",string:"#198038",number:"#DA1E28",function:"#0043CE",variable:"#161616",type:"#007D79",operator:"#DA1E28"},tokens:{boolean:"#007D79",class:"#0043CE",className:"#0043CE",commentDoc:"#A9A9A9",constant:"#6929C4",decorator:"#007D79",enum:"#0043CE",exception:"#DA1E28",functionCall:"#0043CE",interface:"#007D79",jsxTag:"#0043CE",key:"#0043CE",keywordImport:"#DA1E28",label:"#DA1E28",macro:"#0043CE",method:"#198038",module:"#DA1E28",namespace:"#007D79",parameter:"#161616",preprocessor:"#DA1E28",punctuation:"#525252",regex:"#198038",storageModifier:"#0043CE",stringEscape:"#000000",struct:"#0043CE",tag:"#0043CE",tagAttribute:"#007D79",tagAttributeValue:"#198038",typeParameter:"#007D79",url:"#0072C3",variableGlobal:"#0043CE",variableLocal:"#E8E8E8",variableOther:"#198038",variableProperty:"#6929C4"},highlights:{diffAdded:"#198038",diffAddedBackground:"#19803820",diffModified:"#0043CE",diffModifiedBackground:"#0043CE20",diffRemoved:"#DA1E28",diffRemovedBackground:"#DA1E2820",lineNumber:"#D0D0D0",lineNumberActive:"#000000"}},markdown:{heading1:"#161616",heading2:"#161616",heading3:"#161616",heading4:"#161616",link:"#0072C3",linkHover:"#0043CE",inlineCode:"#198038",inlineCodeBackground:"#F4F4F4",blockquote:"#525252",blockquoteBorder:"#DCDCDC",listMarker:"#0072C399"},chat:{userMessage:"#161616",userMessageBackground:"#f4f4f7",assistantMessage:"#161616",assistantMessageBackground:"#FFFFFF",timestamp:"#525252",divider:"#DCDCDC"},tools:{background:"#F4F4F480",border:"#bdbbbb80",headerHover:"#DCDCDC",icon:"#525252",title:"#161616",description:"#525252",edit:{added:"#198038",addedBackground:"#19803825",removed:"#DA1E28",removedBackground:"#DA1E2825",lineNumber:"#D0D0D0"}}},bl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Al={metadata:Fl,colors:yl,config:bl},wl={id:"catppuccin-dark",name:"Catppuccin",description:"Catppuccin",version:"1.0.0",variant:"dark",tags:["dark","palette"]},El={primary:{base:"#7d8fff",hover:"#9EA6DF",active:"#BEC6FE",foreground:"#1E1E2E",muted:"#B4BEFE80",emphasis:"#9EA6DF"},surface:{background:"#1E1E2E",foreground:"#CDD6F4",muted:"#2a273b",mutedForeground:"#969cb1",elevated:"#282841",elevatedForeground:"#CDD6F4",overlay:"#F4F2FF20",subtle:"#2f2f50"},interactive:{border:"#35324A",borderHover:"#393655",borderFocus:"#575379",selection:"#8883ae5c",selectionForeground:"#F4F2FF",focus:"#B4BEFE",focusRing:"#B4BEFE40",cursor:"#F4F2FF",hover:"#a19ace20",active:"#a19ace20"},status:{error:"#F38BA8",errorForeground:"#1E1E2E",errorBackground:"#F38BA820",errorBorder:"#F38BA850",warning:"#F4B8E4",warningForeground:"#1E1E2E",warningBackground:"#F4B8E420",warningBorder:"#F4B8E450",success:"#A6D189",successForeground:"#1E1E2E",successBackground:"#A6D18920",successBorder:"#A6D18950",info:"#89DCEB",infoForeground:"#1E1E2E",infoBackground:"#89DCEB20",infoBorder:"#89DCEB50"},pr:{open:"#A6D189",draft:"#A6ADC8",blocked:"#F9E2AF",merged:"#d8b4fe",closed:"#F38BA8"},syntax:{base:{background:"#211F31",foreground:"#CDD6F4",comment:"#A6ADC8",keyword:"#B4BEFE",string:"#A6E3A1",number:"#F38BA8",function:"#B4BEFE",variable:"#CDD6F4",type:"#F9E2AF",operator:"#F38BA8"},tokens:{boolean:"#F9E2AF",class:"#B4BEFE",className:"#B4BEFE",commentDoc:"#9298B1",constant:"#89DCEB",decorator:"#F9E2AF",enum:"#B4BEFE",exception:"#F38BA8",functionCall:"#B4BEFE",interface:"#F9E2AF",jsxTag:"#B4BEFE",key:"#B4BEFE",keywordImport:"#F38BA8",label:"#F38BA8",macro:"#89DCEB",method:"#A6D189",module:"#F38BA8",namespace:"#F9E2AF",parameter:"#CDD6F4",preprocessor:"#F38BA8",punctuation:"#A6ADC8",regex:"#A6E3A1",storageModifier:"#89DCEB",stringEscape:"#F4F2FF",struct:"#B4BEFE",tag:"#B4BEFE",tagAttribute:"#F9E2AF",tagAttributeValue:"#A6E3A1",typeParameter:"#F9E2AF",url:"#89DCEB",variableGlobal:"#B4BEFE",variableLocal:"#1C1C29",variableOther:"#A6D189",variableProperty:"#89DCEB"},highlights:{diffAdded:"#A6D189",diffAddedBackground:"#1D2C30",diffModified:"#89DCEB",diffModifiedBackground:"#232538",diffRemoved:"#F38BA8",diffRemovedBackground:"#2C1F2A",lineNumber:"#47436D",lineNumberActive:"#F4F2FF"}},markdown:{heading1:"#CDD6F4",heading2:"#CDD6F4",heading3:"#CDD6F4",heading4:"#CDD6F4",link:"#89DCEB",linkHover:"#B4BEFE",inlineCode:"#A6E3A1",inlineCodeBackground:"#2d2a42",blockquote:"#F9E2AF",blockquoteBorder:"#35324A",listMarker:"#B4BEFE99"},chat:{userMessage:"#CDD6F4",userMessageBackground:"#3a3a5b",assistantMessage:"#CDD6F4",assistantMessageBackground:"#1E1E2E",timestamp:"#A6ADC8",divider:"#35324A"},tools:{background:"#211F3180",border:"#534e7180",headerHover:"#191926",icon:"#A6ADC8",title:"#CDD6F4",description:"#A6ADC8",edit:{added:"#A6D189",addedBackground:"#A6D18925",removed:"#F38BA8",removedBackground:"#F38BA825",lineNumber:"#47436D"}}},Cl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Bl={metadata:wl,colors:El,config:Cl},Dl={id:"catppuccin-light",name:"Catppuccin",description:"Catppuccin",version:"1.0.0",variant:"light",tags:["light","palette"]},kl={primary:{base:"#7287FD",hover:"#8C99F6",active:"#6677DD",foreground:"#F5E0DC",muted:"#7287FD80",emphasis:"#8C99F6"},surface:{background:"#fff6f4",foreground:"#2e314a",muted:"#f8ebe9",mutedForeground:"#888992",elevated:"#fbefea",elevatedForeground:"#4C4F69",overlay:"#1F1F2A20",subtle:"#FDEEEE"},interactive:{border:"#E0CFD3",borderHover:"#D6C4C8",borderFocus:"#AB97A1",selection:"#ffffff",selectionForeground:"#1F1F2A",focus:"#7287FD",focusRing:"#7287FD40",cursor:"#1F1F2A",hover:"#ffffff8f",active:"#ffffff"},status:{error:"#D20F39",errorForeground:"#F5E0DC",errorBackground:"#D20F3920",errorBorder:"#D20F3950",warning:"#DF8E1D",warningForeground:"#F5E0DC",warningBackground:"#DF8E1D20",warningBorder:"#DF8E1D50",success:"#40A02B",successForeground:"#F5E0DC",successBackground:"#40A02B20",successBorder:"#40A02B50",info:"#04A5E5",infoForeground:"#F5E0DC",infoBackground:"#04A5E520",infoBorder:"#04A5E550"},pr:{open:"#40A02B",draft:"#6C6F85",blocked:"#DF8E1D",merged:"#9572fd",closed:"#D20F39"},syntax:{base:{background:"#F2D8D4",foreground:"#4C4F69",comment:"#6C6F85",keyword:"#7287FD",string:"#40A02B",number:"#D20F39",function:"#7287FD",variable:"#4C4F69",type:"#DF8E1D",operator:"#D20F39"},tokens:{boolean:"#DF8E1D",class:"#7287FD",className:"#7287FD",commentDoc:"#B1A8B1",constant:"#04A5E5",decorator:"#DF8E1D",enum:"#7287FD",exception:"#D20F39",functionCall:"#7287FD",interface:"#DF8E1D",jsxTag:"#7287FD",key:"#7287FD",keywordImport:"#D20F39",label:"#D20F39",macro:"#04A5E5",method:"#40A02B",module:"#D20F39",namespace:"#DF8E1D",parameter:"#4C4F69",preprocessor:"#D20F39",punctuation:"#6C6F85",regex:"#40A02B",storageModifier:"#04A5E5",stringEscape:"#1F1F2A",struct:"#7287FD",tag:"#7287FD",tagAttribute:"#DF8E1D",tagAttributeValue:"#40A02B",typeParameter:"#DF8E1D",url:"#04A5E5",variableGlobal:"#7287FD",variableLocal:"#F9E8E4",variableOther:"#40A02B",variableProperty:"#04A5E5"},highlights:{diffAdded:"#40A02B",diffAddedBackground:"#EDF5E6",diffModified:"#04A5E5",diffModifiedBackground:"#E4E2F6",diffRemoved:"#D20F39",diffRemovedBackground:"#FDE1E3",lineNumber:"#C2AEB4",lineNumberActive:"#1F1F2A"}},markdown:{heading1:"#2e314a",heading2:"#2e314a",heading3:"#2e314a",heading4:"#2e314a",link:"#04A5E5",linkHover:"#7287FD",inlineCode:"#40A02B",inlineCodeBackground:"#f6eeec",blockquote:"#DF8E1D",blockquoteBorder:"#E0CFD3",listMarker:"#7287FD99"},chat:{userMessage:"#2e314a",userMessageBackground:"#ffffff",assistantMessage:"#4C4F69",assistantMessageBackground:"#F5E0DC",timestamp:"#6C6F85",divider:"#E0CFD3"},tools:{background:"#F2D8D480",border:"#cbbec180",headerHover:"#FDEEEE",icon:"#6C6F85",title:"#4C4F69",description:"#6C6F85",edit:{added:"#40A02B",addedBackground:"#40A02B25",removed:"#D20F39",removedBackground:"#D20F3925",lineNumber:"#C2AEB4"}}},vl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Sl={metadata:Dl,colors:kl,config:vl},Ml={id:"dracula-dark",name:"Dracula",description:"Dracula",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Tl={primary:{base:"#BD93F9",hover:"#A480D8",active:"#C7A3FA",foreground:"#14151F",muted:"#BD93F980",emphasis:"#A480D8"},surface:{background:"#14151F",foreground:"#F8F8F2",muted:"#181926",mutedForeground:"#7c7e9c",elevated:"#161722",elevatedForeground:"#F8F8F2",overlay:"#FFFFFF20",subtle:"#222436"},interactive:{border:"#2D2F3C",borderHover:"#303244",borderFocus:"#4A4D6D",selection:"#30334b",selectionForeground:"#FFFFFF",focus:"#BD93F9",focusRing:"#BD93F940",cursor:"#FFFFFF",hover:"#30334ba3",active:"#30334b"},status:{error:"#FF5555",errorForeground:"#14151F",errorBackground:"#FF555520",errorBorder:"#FF555550",warning:"#FFB86C",warningForeground:"#14151F",warningBackground:"#FFB86C20",warningBorder:"#FFB86C50",success:"#50FA7B",successForeground:"#14151F",successBackground:"#50FA7B20",successBorder:"#50FA7B50",info:"#8BE9FD",infoForeground:"#14151F",infoBackground:"#8BE9FD20",infoBorder:"#8BE9FD50"},pr:{open:"#50FA7B",draft:"#B6B9E4",blocked:"#FFB86C",merged:"#BD93F9",closed:"#FF5555"},syntax:{base:{background:"#181926",foreground:"#F8F8F2",comment:"#B6B9E4",keyword:"#BD93F9",string:"#50FA7B",number:"#FF79C6",function:"#BD93F9",variable:"#F8F8F2",type:"#FFB86C",operator:"#FF79C6"},tokens:{boolean:"#FFB86C",class:"#BD93F9",className:"#BD93F9",commentDoc:"#9EA0C6",constant:"#8BE9FD",decorator:"#FFB86C",enum:"#BD93F9",exception:"#FF79C6",functionCall:"#BD93F9",interface:"#FFB86C",jsxTag:"#BD93F9",key:"#BD93F9",keywordImport:"#FF79C6",label:"#FF79C6",macro:"#8BE9FD",method:"#50FA7B",module:"#FF79C6",namespace:"#FFB86C",parameter:"#F8F8F2",preprocessor:"#FF79C6",punctuation:"#B6B9E4",regex:"#50FA7B",storageModifier:"#8BE9FD",stringEscape:"#FFFFFF",struct:"#BD93F9",tag:"#BD93F9",tagAttribute:"#FFB86C",tagAttributeValue:"#50FA7B",typeParameter:"#FFB86C",url:"#8BE9FD",variableGlobal:"#BD93F9",variableLocal:"#161722",variableOther:"#50FA7B",variableProperty:"#8BE9FD"},highlights:{diffAdded:"#50FA7B",diffAddedBackground:"#1F2A2F",diffModified:"#8BE9FD",diffModifiedBackground:"#24253A",diffRemoved:"#FF5555",diffRemovedBackground:"#2D1F27",lineNumber:"#3B3D55",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F8F8F2",heading2:"#F8F8F2",heading3:"#F8F8F2",heading4:"#F8F8F2",link:"#8BE9FD",linkHover:"#BD93F9",inlineCode:"#4aeb72",inlineCodeBackground:"#202132",blockquote:"#FFB86C",blockquoteBorder:"#2D2F3C",listMarker:"#BD93F999"},chat:{userMessage:"#F8F8F2",userMessageBackground:"#222436",assistantMessage:"#F8F8F2",assistantMessageBackground:"#14151F",timestamp:"#B6B9E4",divider:"#2D2F3C"},tools:{background:"#18192680",border:"#494c6180",headerHover:"#191A26",icon:"#B6B9E4",title:"#F8F8F2",description:"#B6B9E4",edit:{added:"#50FA7B",addedBackground:"#50FA7B25",removed:"#FF5555",removedBackground:"#FF555525",lineNumber:"#3B3D55"}}},Pl={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Rl={metadata:Ml,colors:Tl,config:Pl},Il={id:"dracula-light",name:"Dracula",description:"Dracula",version:"1.0.0",variant:"light",tags:["light","palette"]},xl={primary:{base:"#7C6BF5",hover:"#9587F4",active:"#6A5CD2",foreground:"#F8F8F2",muted:"#7C6BF580",emphasis:"#9587F4"},surface:{background:"#F8F8F2",foreground:"#1F1F2F",muted:"#eff1eb",mutedForeground:"#6c6c7a",elevated:"#eeeee5",elevatedForeground:"#1F1F2F",overlay:"#05040C20",subtle:"#edeee7"},interactive:{border:"#E2E3DA",borderHover:"#D8D9D0",borderFocus:"#B0B2A7",selection:"#c2bcea63",selectionForeground:"#05040C",focus:"#7C6BF5",focusRing:"#7C6BF540",cursor:"#05040C",hover:"#c2bcea38",active:"#c2bcea63"},status:{error:"#D9536F",errorForeground:"#F8F8F2",errorBackground:"#D9536F20",errorBorder:"#D9536F50",warning:"#F7A14D",warningForeground:"#F8F8F2",warningBackground:"#F7A14D20",warningBorder:"#F7A14D50",success:"#2FBF71",successForeground:"#F8F8F2",successBackground:"#2FBF7120",successBorder:"#2FBF7150",info:"#1D7FC5",infoForeground:"#F8F8F2",infoBackground:"#1D7FC520",infoBorder:"#1D7FC550"},pr:{open:"#2FBF71",draft:"#52526B",blocked:"#F7A14D",merged:"#7C6BF5",closed:"#D9536F"},syntax:{base:{background:"#F1F2ED",foreground:"#1F1F2F",comment:"#52526B",keyword:"#7C6BF5",string:"#2FBF71",number:"#D16090",function:"#7C6BF5",variable:"#1F1F2F",type:"#F7A14D",operator:"#D16090"},tokens:{boolean:"#F7A14D",class:"#7C6BF5",className:"#7C6BF5",commentDoc:"#A5A5AF",constant:"#1D7FC5",decorator:"#F7A14D",enum:"#7C6BF5",exception:"#D16090",functionCall:"#7C6BF5",interface:"#F7A14D",jsxTag:"#7C6BF5",key:"#7C6BF5",keywordImport:"#D16090",label:"#D16090",macro:"#1D7FC5",method:"#2FBF71",module:"#D16090",namespace:"#F7A14D",parameter:"#1F1F2F",preprocessor:"#D16090",punctuation:"#52526B",regex:"#2FBF71",storageModifier:"#1D7FC5",stringEscape:"#05040C",struct:"#7C6BF5",tag:"#7C6BF5",tagAttribute:"#F7A14D",tagAttributeValue:"#2FBF71",typeParameter:"#F7A14D",url:"#1D7FC5",variableGlobal:"#7C6BF5",variableLocal:"#F6F6F1",variableOther:"#2FBF71",variableProperty:"#1D7FC5"},highlights:{diffAdded:"#2FBF71",diffAddedBackground:"#E4F5E6",diffModified:"#1D7FC5",diffModifiedBackground:"#DEDFE9",diffRemoved:"#D9536F",diffRemovedBackground:"#FAE4EB",lineNumber:"#C4C6BC",lineNumberActive:"#05040C"}},markdown:{heading1:"#1F1F2F",heading2:"#1F1F2F",heading3:"#1F1F2F",heading4:"#1F1F2F",link:"#1D7FC5",linkHover:"#7C6BF5",inlineCode:"#2FBF71",inlineCodeBackground:"#F1F2ED",blockquote:"#F7A14D",blockquoteBorder:"#E2E3DA",listMarker:"#7C6BF599"},chat:{userMessage:"#1F1F2F",userMessageBackground:"#F1F2ED",assistantMessage:"#1F1F2F",assistantMessageBackground:"#F8F8F2",timestamp:"#52526B",divider:"#E2E3DA"},tools:{background:"#F1F2ED80",border:"#E2E3DA80",headerHover:"#F2F2EC",icon:"#52526B",title:"#1F1F2F",description:"#52526B",edit:{added:"#2FBF71",addedBackground:"#2FBF7125",removed:"#D9536F",removedBackground:"#D9536F25",lineNumber:"#C4C6BC"}}},Ol={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},_l={metadata:Il,colors:xl,config:Ol},Nl={id:"gruvbox-dark",name:"Gruvbox",description:"Gruvbox",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Ul={primary:{base:"#83A598",hover:"#759287",active:"#95B09F",foreground:"#282828",muted:"#83A59880",emphasis:"#759287"},surface:{background:"#282828",foreground:"#EBDBB2",muted:"#32302F",mutedForeground:"#918574",elevated:"#25292b",elevatedForeground:"#EBDBB2",overlay:"#FBF1C720",subtle:"#3e3c3a"},interactive:{border:"#504945",borderHover:"#5A524B",borderFocus:"#7C6F64",selection:"#5a5647db",selectionForeground:"#FBF1C7",focus:"#83A598",focusRing:"#83A59840",cursor:"#FBF1C7",hover:"#5a5647d9",active:"#5a5647ec"},status:{error:"#FB4934",errorForeground:"#282828",errorBackground:"#FB493420",errorBorder:"#FB493450",warning:"#FABD2F",warningForeground:"#282828",warningBackground:"#FABD2F20",warningBorder:"#FABD2F50",success:"#B8BB26",successForeground:"#282828",successBackground:"#B8BB2620",successBorder:"#B8BB2650",info:"#D3869B",infoForeground:"#282828",infoBackground:"#D3869B20",infoBorder:"#D3869B50"},pr:{open:"#B8BB26",draft:"#A89984",blocked:"#FABD2F",merged:"#8973a8",closed:"#FB4934"},syntax:{base:{background:"#32302F",foreground:"#EBDBB2",comment:"#A89984",keyword:"#83A598",string:"#B8BB26",number:"#FB4934",function:"#83A598",variable:"#EBDBB2",type:"#FABD2F",operator:"#FB4934"},tokens:{boolean:"#FABD2F",class:"#83A598",className:"#83A598",commentDoc:"#958876",constant:"#D3869B",decorator:"#FABD2F",enum:"#83A598",exception:"#FB4934",functionCall:"#83A598",interface:"#FABD2F",jsxTag:"#83A598",key:"#83A598",keywordImport:"#FB4934",label:"#FB4934",macro:"#8EC07C",method:"#B8BB26",module:"#FB4934",namespace:"#FABD2F",parameter:"#EBDBB2",preprocessor:"#FB4934",punctuation:"#A89984",regex:"#B8BB26",storageModifier:"#8EC07C",stringEscape:"#FBF1C7",struct:"#83A598",tag:"#83A598",tagAttribute:"#FABD2F",tagAttributeValue:"#B8BB26",typeParameter:"#FABD2F",url:"#8EC07C",variableGlobal:"#83A598",variableLocal:"#1D2021",variableOther:"#B8BB26",variableProperty:"#D3869B"},highlights:{diffAdded:"#B8BB26",diffAddedBackground:"#2A3325",diffModified:"#D3869B",diffModifiedBackground:"#32302F",diffRemoved:"#FB4934",diffRemovedBackground:"#3C2222",lineNumber:"#70665D",lineNumberActive:"#FBF1C7"}},markdown:{heading1:"#EBDBB2",heading2:"#EBDBB2",heading3:"#EBDBB2",heading4:"#EBDBB2",link:"#8EC07C",linkHover:"#83A598",inlineCode:"#B8BB26",inlineCodeBackground:"#32302F",blockquote:"#928374",blockquoteBorder:"#504945",listMarker:"#83A59899"},chat:{userMessage:"#EBDBB2",userMessageBackground:"#3e3c3a",assistantMessage:"#EBDBB2",assistantMessageBackground:"#282828",timestamp:"#A89984",divider:"#504945"},tools:{background:"#32302F80",border:"#6e645e80",headerHover:"#141617",icon:"#A89984",title:"#EBDBB2",description:"#A89984",edit:{added:"#B8BB26",addedBackground:"#B8BB2625",removed:"#FB4934",removedBackground:"#FB493425",lineNumber:"#70665D"}}},Ll={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Hl={metadata:Nl,colors:Ul,config:Ll},jl={id:"gruvbox-light",name:"Gruvbox",description:"Gruvbox",version:"1.0.0",variant:"light",tags:["light","palette"]},zl={primary:{base:"#076678",hover:"#388288",active:"#0C5D6C",foreground:"#FBF1C7",muted:"#07667880",emphasis:"#388288"},surface:{background:"#FBF1C7",foreground:"#3C3836",muted:"#F2E5BC",mutedForeground:"#7C6F64",elevated:"#efebcd",elevatedForeground:"#3C3836",overlay:"#28282820",subtle:"#FDF9E8"},interactive:{border:"#D5C4A1",borderHover:"#C9B897",borderFocus:"#A89984",selection:"#fffdfdec",selectionForeground:"#282828",focus:"#076678",focusRing:"#07667840",cursor:"#282828",hover:"#fffdfdb3",active:"#fffdfdcf"},status:{error:"#9D0006",errorForeground:"#FBF1C7",errorBackground:"#9D000620",errorBorder:"#9D000650",warning:"#B57614",warningForeground:"#FBF1C7",warningBackground:"#B5761420",warningBorder:"#B5761450",success:"#79740E",successForeground:"#FBF1C7",successBackground:"#79740E20",successBorder:"#79740E50",info:"#8F3F71",infoForeground:"#FBF1C7",infoBackground:"#8F3F7120",infoBorder:"#8F3F7150"},pr:{open:"#79740E",draft:"#7C6F64",blocked:"#B57614",merged:"#5e4c76",closed:"#9D0006"},syntax:{base:{background:"#F2E5BC",foreground:"#3C3836",comment:"#7C6F64",keyword:"#076678",string:"#79740E",number:"#9D0006",function:"#076678",variable:"#3C3836",type:"#B57614",operator:"#9D0006"},tokens:{boolean:"#B57614",class:"#076678",className:"#076678",commentDoc:"#BCB096",constant:"#8F3F71",decorator:"#B57614",enum:"#076678",exception:"#9D0006",functionCall:"#076678",interface:"#B57614",jsxTag:"#076678",key:"#076678",keywordImport:"#9D0006",label:"#9D0006",macro:"#427B58",method:"#79740E",module:"#9D0006",namespace:"#B57614",parameter:"#3C3836",preprocessor:"#9D0006",punctuation:"#7C6F64",regex:"#79740E",storageModifier:"#427B58",stringEscape:"#282828",struct:"#076678",tag:"#076678",tagAttribute:"#B57614",tagAttributeValue:"#79740E",typeParameter:"#B57614",url:"#427B58",variableGlobal:"#076678",variableLocal:"#F9F5D7",variableOther:"#79740E",variableProperty:"#8F3F71"},highlights:{diffAdded:"#79740E",diffAddedBackground:"#DDE3B1",diffModified:"#8F3F71",diffModifiedBackground:"#EBDFB5",diffRemoved:"#9D0006",diffRemovedBackground:"#E8C7C3",lineNumber:"#B0A285",lineNumberActive:"#282828"}},markdown:{heading1:"#3C3836",heading2:"#3C3836",heading3:"#3C3836",heading4:"#3C3836",link:"#427B58",linkHover:"#076678",inlineCode:"#79740E",inlineCodeBackground:"#F2E5BC",blockquote:"#928374",blockquoteBorder:"#D5C4A1",listMarker:"#07667899"},chat:{userMessage:"#3C3836",userMessageBackground:"#FDF9E8",assistantMessage:"#3C3836",assistantMessageBackground:"#FBF1C7",timestamp:"#7C6F64",divider:"#D5C4A1"},tools:{background:"#F2E5BC80",border:"#a6997e80",headerHover:"#FDF9E8",icon:"#7C6F64",title:"#3C3836",description:"#7C6F64",edit:{added:"#79740E",addedBackground:"#79740E25",removed:"#9D0006",removedBackground:"#9D000625",lineNumber:"#B0A285"}}},$l={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gl={metadata:jl,colors:zl,config:$l},ql={id:"jetbrains-dark",name:"JetBrains",description:"JetBrains IDE-inspired colors for OpenChamber - dark variant",author:"Artem Evsevev, adapted for OpenChamber",version:"1.0.0",variant:"dark",tags:["dark","jetbrains","ide","blue"]},Wl={primary:{base:"#6796f5",hover:"#70AEFF",active:"#5594FA",foreground:"#1E1F22",muted:"#6796f580",emphasis:"#70AEFF"},surface:{background:"#1E1F22",foreground:"#DFE1E5",muted:"#26282B",mutedForeground:"#9fa0a2",elevated:"#2B2D30",elevatedForeground:"#DFE1E5",overlay:"#00000080",subtle:"#2c2d32"},interactive:{border:"#474a51",borderHover:"#4B5059",borderFocus:"#6796f5",selection:"#43454A",selectionForeground:"#DFE1E5",focus:"#6796f5",focusRing:"#6796f550",cursor:"#CED0D6",hover:"#3C3E41",active:"#494A4D"},status:{error:"#FA6675",errorForeground:"#1E1F22",errorBackground:"#402929",errorBorder:"#FA6675",warning:"#F2C55C",warningForeground:"#1E1F22",warningBackground:"#665014",warningBorder:"#F2C55C",success:"#57965D",successForeground:"#1E1F22",successBackground:"#253627",successBorder:"#57965D",info:"#3592C4",infoForeground:"#1E1F22",infoBackground:"#243846",infoBorder:"#3592C4"},pr:{open:"#5FAD65",draft:"#868A91",blocked:"#F2C55C",merged:"#A571E6",closed:"#DB5C5C"},syntax:{base:{background:"#1E1F22",foreground:"#BCBEC4",comment:"#7A7E85",keyword:"#CF8E6D",string:"#6AAB73",number:"#2AACB8",function:"#6AA2D7",variable:"#BCBEC4",type:"#A6BB77",operator:"#BCBEC4"},tokens:{commentDoc:"#5F826B",stringEscape:"#CF8E6D",keywordImport:"#CF8E6D",storageModifier:"#CF8E6D",functionCall:"#6AA2D7",method:"#6AA2D7",functionBuiltin:"#D5A563",variableProperty:"#C77DBB",variableOther:"#BCBEC4",variableGlobal:"#E59EAE",variableLocal:"#BCBEC4",parameter:"#3CACAC",constant:"#C77DBB",class:"#57AAF7",className:"#57AAF7",interface:"#8D91DC",struct:"#A6BB77",enum:"#A6BB77",typeParameter:"#3CACAC",namespace:"#BCBEC4",module:"#8D91DC",tag:"#D5B778",jsxTag:"#D5B778",tagAttribute:"#B3AE60",tagAttributeValue:"#6AAB73",boolean:"#CF8E6D",decorator:"#B3AE60",label:"#D5A563",punctuation:"#BCBEC4",macro:"#D5A563",preprocessor:"#D5A563",regex:"#6AAB73",url:"#57AAF7",key:"#C77DBB",exception:"#E59EAE"},highlights:{diffAdded:"#549159",diffAddedBackground:"#294436",diffRemoved:"#F75464",diffRemovedBackground:"#45302B",diffModified:"#70AEFF",diffModifiedBackground:"#243C63",lineNumber:"#4B5059",lineNumberActive:"#A1A3AB"}},markdown:{heading1:"#FFFFFF",heading2:"#DFE1E5",heading3:"#CED0D6",heading4:"#BCBEC4",link:"#56A8F5",linkHover:"#6796f5",inlineCode:"#6AAB73",inlineCodeBackground:"#26282B",blockquote:"#7A7E85",blockquoteBorder:"#393B41",listMarker:"#B3AE6099"},chat:{userMessage:"#DFE1E5",userMessageBackground:"#3a5b9d76",assistantMessage:"#DFE1E5",assistantMessageBackground:"#1E1F22",timestamp:"#7A7E85",divider:"#393B41"},tools:{background:"#26282B50",border:"#393B41",headerHover:"#3C3E4150",icon:"#B0B1B3",title:"#DFE1E5",description:"#B0B1B3",edit:{added:"#549159",addedBackground:"#29443640",removed:"#F75464",removedBackground:"#45302B40",lineNumber:"#4B5059"}}},Vl={fonts:{sans:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Kl={metadata:ql,colors:Wl,config:Vl},Jl={id:"jetbrains-light",name:"JetBrains",description:"JetBrains IDE-inspired colors for OpenChamber - light variant",author:"Artem Evsevev, adapted for OpenChamber",version:"1.0.0",variant:"light",tags:["light","jetbrains","ide","blue"]},Yl={primary:{base:"#195ce3",hover:"#2D61F0",active:"#0055FF",foreground:"#FFFFFF",muted:"#3573F080",emphasis:"#006DCC"},surface:{background:"#FFF",foreground:"#000000",muted:"#F7F8FA",mutedForeground:"#404040",elevated:"#FFFFFF",elevatedForeground:"#000000",overlay:"#00000025",subtle:"#ecf0f8"},interactive:{border:"#cfd3de",borderHover:"#AEB3C2",borderFocus:"#0055FF",selection:"#DFE1E5",selectionForeground:"#000000",focus:"#0055FF",focusRing:"#0055FF40",cursor:"#000000",hover:"#E6E6E8",active:"#DBDCDE"},status:{error:"#CE0606",errorForeground:"#FFFFFF",errorBackground:"#FFE8E8",errorBorder:"#CF5B56",warning:"#F49810",warningForeground:"#000000",warningBackground:"#FFF8DC",warningBorder:"#F49810",success:"#077D18",successForeground:"#FFFFFF",successBackground:"#E9F5E6",successBorder:"#55A76A",info:"#389FD6",infoForeground:"#000000",infoBackground:"#E7F4FB",infoBorder:"#389FD6"},pr:{open:"#369650",draft:"#808080",blocked:"#F49810",merged:"#834DF0",closed:"#E55765"},syntax:{base:{background:"#FFFFFF",foreground:"#080808",comment:"#8C8C8C",keyword:"#0033B3",string:"#067D17",number:"#1750EB",function:"#00627A",variable:"#000000",type:"#A04908",operator:"#080808"},tokens:{commentDoc:"#8C8C8C",stringEscape:"#0037A6",keywordImport:"#0033B3",storageModifier:"#0033B3",functionCall:"#00627A",method:"#00627A",functionBuiltin:"#C27203",variableProperty:"#871094",variableOther:"#000000",variableGlobal:"#1C5DFE",variableLocal:"#000000",parameter:"#007E8A",constant:"#871094",class:"#00627A",className:"#00627A",interface:"#835DDA",struct:"#A04908",enum:"#A04908",typeParameter:"#007E8A",namespace:"#000000",module:"#835DDA",tag:"#0033B3",jsxTag:"#0033B3",tagAttribute:"#9E880D",tagAttributeValue:"#067D17",boolean:"#0033B3",decorator:"#9E880D",label:"#C27203",punctuation:"#080808",macro:"#C27203",preprocessor:"#C27203",regex:"#067D17",url:"#00627A",key:"#871094",exception:"#1C5DFE"},highlights:{diffAdded:"#077D18",diffAddedBackground:"#BEE6BE",diffRemoved:"#FF0000",diffRemovedBackground:"#FFD5CC",diffModified:"#0133B3",diffModifiedBackground:"#DDE8FF",lineNumber:"#AEB3C2",lineNumberActive:"#767A8A"}},markdown:{heading1:"#000000",heading2:"#161617",heading3:"#404040",heading4:"#404040",link:"#006DCC",linkHover:"#3573F0",inlineCode:"#067D17",inlineCodeBackground:"#F5F7F9",blockquote:"#8C8C8C",blockquoteBorder:"#C9CCD6",listMarker:"#9E880D99"},chat:{userMessage:"#000000",userMessageBackground:"#E8F1FF",assistantMessage:"#000000",assistantMessageBackground:"#F7F8FA",timestamp:"#767A8A",divider:"#C9CCD6"},tools:{background:"#F5F7F950",border:"#AEB3C280",headerHover:"#E6E6E8",icon:"#404040",title:"#000000",description:"#404040",edit:{added:"#077D18",addedBackground:"#BEE6BE50",removed:"#FF0000",removedBackground:"#FFD5CC50",lineNumber:"#AEB3C2"}}},Ql={fonts:{sans:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'"JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Xl={metadata:Jl,colors:Yl,config:Ql},Zl={id:"kanagawa-dark",name:"Kanagawa",description:"A color scheme inspired by Japanese art and ink painting - dark variant",version:"1.0.0",variant:"dark",tags:["dark","japanese","ink","elegant"]},eu={primary:{base:"#7FB4CA",hover:"#9DC5E0",active:"#658594",foreground:"#1F1F28",muted:"#7FB4CA80",emphasis:"#7E9CD8"},surface:{background:"#1F1F28",foreground:"#DCD7BA",muted:"#23232d",mutedForeground:"#7e7e77",elevated:"#2A2A37",elevatedForeground:"#DCD7BA",overlay:"#16161DCC",subtle:"#2f2f3d"},interactive:{border:"#363646",borderHover:"#54546D",borderFocus:"#7FB4CA",selection:"#729fb333",selectionForeground:"#DCD7BA",focus:"#7FB4CA",focusRing:"#7FB4CA50",cursor:"#DCD7BA",hover:"#363646",active:"#54546D"},status:{error:"#E82424",errorForeground:"#DCD7BA",errorBackground:"#E8242420",errorBorder:"#E8242450",warning:"#FF9E3B",warningForeground:"#1F1F28",warningBackground:"#FF9E3B20",warningBorder:"#FF9E3B50",success:"#98BB6C",successForeground:"#1F1F28",successBackground:"#98BB6C20",successBorder:"#98BB6C50",info:"#7E9CD8",infoForeground:"#1F1F28",infoBackground:"#7E9CD820",infoBorder:"#7E9CD850"},pr:{open:"#98BB6C",draft:"#54546D",blocked:"#FF9E3B",merged:"#957FB8",closed:"#E82424"},syntax:{base:{background:"#16161D",foreground:"#DCD7BA",comment:"#54546D",keyword:"#7E9CD8",string:"#98BB6C",number:"#FF9E3B",function:"#E6C384",variable:"#DCD7BA",type:"#C8C093",operator:"#C34043"},tokens:{commentDoc:"#727169",stringEscape:"#DCD7BA",keywordImport:"#957FB8",storageModifier:"#7E9CD8",functionCall:"#E6C384",method:"#76946A",variableProperty:"#7E9CD8",variableOther:"#76946A",variableGlobal:"#D27E99",variableLocal:"#2A2A37",parameter:"#DCD7BA",constant:"#DCD7BA",class:"#E6C384",className:"#E6C384",interface:"#C8C093",struct:"#E6C384",enum:"#E6C384",typeParameter:"#E6C384",namespace:"#C8C093",module:"#C34043",tag:"#7E9CD8",jsxTag:"#D27E99",tagAttribute:"#C8C093",tagAttributeValue:"#98BB6C",boolean:"#C8C093",decorator:"#C8C093",label:"#D27E99",punctuation:"#54546D",macro:"#7E9CD8",preprocessor:"#D27E99",regex:"#98BB6C",url:"#7E9CD8",key:"#E6C384",exception:"#D27E99"},highlights:{diffAdded:"#98BB6C",diffAddedBackground:"#76946A20",diffRemoved:"#C34043",diffRemovedBackground:"#E8242420",diffModified:"#7E9CD8",diffModifiedBackground:"#7E9CD820",lineNumber:"#363646",lineNumberActive:"#DCD7BA"}},markdown:{heading1:"#DCD7BA",heading2:"#DCD7BA",heading3:"#DCD7BA",heading4:"#DCD7BA",link:"#7FB4CA",linkHover:"#7E9CD8",inlineCode:"#98BB6C",inlineCodeBackground:"#16161D",blockquote:"#54546D",blockquoteBorder:"#363646",listMarker:"#FF9E3B99"},chat:{userMessage:"#DCD7BA",userMessageBackground:"#2A2A37",assistantMessage:"#DCD7BA",assistantMessageBackground:"#2f2f3d",timestamp:"#54546D",divider:"#363646"},tools:{background:"#16161D50",border:"#4a4a5f80",headerHover:"#36364650",icon:"#afad9c",title:"#DCD7BA",description:"#5A595B",edit:{added:"#98BB6C",addedBackground:"#98BB6C25",removed:"#C34043",removedBackground:"#C3404325",lineNumber:"#56566d"}}},tu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ou={metadata:Zl,colors:eu,config:tu},ru={id:"kanagawa-light",name:"Kanagawa",description:"A color scheme inspired by Japanese art and ink painting - light variant (Lotus)",version:"1.0.0",variant:"light",tags:["light","japanese","lotus","elegant"]},nu={primary:{base:"#4D699B",hover:"#6693BF",active:"#5D57A3",foreground:"#F2ECBC",muted:"#4D699B80",emphasis:"#6693BF"},surface:{background:"#F2ECBC",foreground:"#545464",muted:"#E7DBA0",mutedForeground:"#6c6c67",elevated:"#eae4bf",elevatedForeground:"#545464",overlay:"#54546433",subtle:"#f4fff0"},interactive:{border:"#bfbaa4",borderHover:"#8A8980",borderFocus:"#4D699B",selection:"#e9f3e5cf",selectionForeground:"#545464",focus:"#4D699B",focusRing:"#4D699B40",cursor:"#545464",hover:"#e9f3e5a9",active:"#e9f3e5cf"},status:{error:"#E82424",errorForeground:"#F2ECBC",errorBackground:"#E8242420",errorBorder:"#E8242450",warning:"#DE9800",warningForeground:"#545464",warningBackground:"#DE980020",warningBorder:"#DE980050",success:"#6F894E",successForeground:"#F2ECBC",successBackground:"#98BB6C20",successBorder:"#6F894E50",info:"#4D699B",infoForeground:"#F2ECBC",infoBackground:"#6693BF20",infoBorder:"#4D699B50"},pr:{open:"#6F894E",draft:"#716E61",blocked:"#DE9800",merged:"#624C83",closed:"#E82424"},syntax:{base:{background:"#DCD5AC",foreground:"#545464",comment:"#716E61",keyword:"#4D699B",string:"#6F894E",number:"#836F4A",function:"#CC6D00",variable:"#545464",type:"#77713F",operator:"#C84053"},tokens:{commentDoc:"#8A8980",stringEscape:"#545464",keywordImport:"#624C83",storageModifier:"#4D699B",functionCall:"#CC6D00",method:"#6E915F",variableProperty:"#4D699B",variableOther:"#6E915F",variableGlobal:"#B35B79",variableLocal:"#D5CEA3",parameter:"#545464",constant:"#545464",class:"#CC6D00",className:"#CC6D00",interface:"#77713F",struct:"#CC6D00",enum:"#CC6D00",typeParameter:"#CC6D00",namespace:"#77713F",module:"#C84053",tag:"#4D699B",jsxTag:"#B35B79",tagAttribute:"#77713F",tagAttributeValue:"#6F894E",boolean:"#77713F",decorator:"#77713F",label:"#B35B79",punctuation:"#716E61",macro:"#4D699B",preprocessor:"#B35B79",regex:"#6F894E",url:"#4D699B",key:"#CC6D00",exception:"#B35B79"},highlights:{diffAdded:"#6F894E",diffAddedBackground:"#6F894E20",diffRemoved:"#C84053",diffRemovedBackground:"#C8405320",diffModified:"#4D699B",diffModifiedBackground:"#4D699B20",lineNumber:"#8A8980",lineNumberActive:"#545464"}},markdown:{heading1:"#545464",heading2:"#545464",heading3:"#545464",heading4:"#545464",link:"#5D57A3",linkHover:"#4D699B",inlineCode:"#6F894E",inlineCodeBackground:"#e7e2c7",blockquote:"#716E61",blockquoteBorder:"#716E61",listMarker:"#836F4A99"},chat:{userMessage:"#545464",userMessageBackground:"#e6f2e1",assistantMessage:"#545464",assistantMessageBackground:"#F2ECBC",timestamp:"#716E61",divider:"#716E61"},tools:{background:"#DCD5AC50",border:"#716E6180",headerHover:"#716E61",icon:"#8A8980",title:"#545464",description:"#8A8980",edit:{added:"#6F894E",addedBackground:"#6F894E25",removed:"#C84053",removedBackground:"#C8405325",lineNumber:"#8A8980"}}},au={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},su={metadata:ru,colors:nu,config:au},iu={id:"monokai-dark",name:"Monokai",description:"Monokai",version:"1.0.0",variant:"dark",tags:["dark","palette"]},cu={primary:{base:"#AE81FF",hover:"#9973DD",active:"#BA94FF",foreground:"#23241E",muted:"#AE81FF80",emphasis:"#9973DD"},surface:{background:"#23241E",foreground:"#F8F8F2",muted:"#282a20",mutedForeground:"#939390",elevated:"#21221a",elevatedForeground:"#F8F8F2",overlay:"#FFFFFF20",subtle:"#36372a"},interactive:{border:"#343528",borderHover:"#393A2D",borderFocus:"#555741",selection:"#434d3cfe",selectionForeground:"#FFFFFF",focus:"#AE81FF",focusRing:"#AE81FF40",cursor:"#FFFFFF",hover:"#36372a",active:"#36382e"},status:{error:"#F92672",errorForeground:"#23241E",errorBackground:"#F9267220",errorBorder:"#F9267250",warning:"#FD971F",warningForeground:"#23241E",warningBackground:"#FD971F20",warningBorder:"#FD971F50",success:"#A6E22E",successForeground:"#23241E",successBackground:"#A6E22E20",successBorder:"#A6E22E50",info:"#66D9EF",infoForeground:"#23241E",infoBackground:"#66D9EF20",infoBorder:"#66D9EF50"},pr:{open:"#A6E22E",draft:"#C5C5C0",blocked:"#FD971F",merged:"#AE81FF",closed:"#F92672"},syntax:{base:{background:"#27281F",foreground:"#F8F8F2",comment:"#C5C5C0",keyword:"#AE81FF",string:"#A6E22E",number:"#F92672",function:"#AE81FF",variable:"#F8F8F2",type:"#FD971F",operator:"#F92672"},tokens:{boolean:"#FD971F",class:"#AE81FF",className:"#AE81FF",commentDoc:"#ADADA8",constant:"#66D9EF",decorator:"#FD971F",enum:"#AE81FF",exception:"#F92672",functionCall:"#AE81FF",interface:"#FD971F",jsxTag:"#AE81FF",key:"#AE81FF",keywordImport:"#F92672",label:"#F92672",macro:"#66D9EF",method:"#A6E22E",module:"#F92672",namespace:"#FD971F",parameter:"#F8F8F2",preprocessor:"#F92672",punctuation:"#C5C5C0",regex:"#A6E22E",storageModifier:"#66D9EF",stringEscape:"#FFFFFF",struct:"#AE81FF",tag:"#AE81FF",tagAttribute:"#FD971F",tagAttributeValue:"#A6E22E",typeParameter:"#FD971F",url:"#66D9EF",variableGlobal:"#AE81FF",variableLocal:"#25261F",variableOther:"#A6E22E",variableProperty:"#66D9EF"},highlights:{diffAdded:"#A6E22E",diffAddedBackground:"#1E2A1D",diffModified:"#66D9EF",diffModifiedBackground:"#2F2F24",diffRemoved:"#F92672",diffRemovedBackground:"#301C24",lineNumber:"#454639",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#F8F8F2",heading2:"#F8F8F2",heading3:"#F8F8F2",heading4:"#F8F8F2",link:"#66D9EF",linkHover:"#AE81FF",inlineCode:"#A6E22E",inlineCodeBackground:"#27281F",blockquote:"#FD971F",blockquoteBorder:"#343528",listMarker:"#AE81FF99"},chat:{userMessage:"#F8F8F2",userMessageBackground:"#36372a",assistantMessage:"#F8F8F2",assistantMessageBackground:"#23241E",timestamp:"#C5C5C0",divider:"#343528"},tools:{background:"#27281F80",border:"#4d4f3c80",headerHover:"#292A23",icon:"#C5C5C0",title:"#F8F8F2",description:"#C5C5C0",edit:{added:"#A6E22E",addedBackground:"#A6E22E25",removed:"#bd215a",removedBackground:"#F9267225",lineNumber:"#505142"}}},du={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},lu={metadata:iu,colors:cu,config:du},uu={id:"monokai-light",name:"Monokai",description:"Monokai",version:"1.0.0",variant:"light",tags:["light","palette"]},fu={primary:{base:"#BF7BFF",hover:"#CB94FB",active:"#A76CDB",foreground:"#FDF8EC",muted:"#BF7BFF80",emphasis:"#CB94FB"},surface:{background:"#FDF8EC",foreground:"#292318",muted:"#F8F2E6",mutedForeground:"#887c6a",elevated:"#FBF5E8",elevatedForeground:"#292318",overlay:"#1C150C20",subtle:"#F7EFDD"},interactive:{border:"#E9E0CF",borderHover:"#DFD5C3",borderFocus:"#B6A893",selection:"#1C150C22",selectionForeground:"#1C150C",focus:"#BF7BFF",focusRing:"#BF7BFF40",cursor:"#1C150C",hover:"#e6e0d5",active:"#FBF5E8"},status:{error:"#E54B4B",errorForeground:"#FDF8EC",errorBackground:"#E54B4B20",errorBorder:"#E54B4B50",warning:"#F1A948",warningForeground:"#FDF8EC",warningBackground:"#F1A94820",warningBorder:"#F1A94850",success:"#4FB54B",successForeground:"#FDF8EC",successBackground:"#4FB54B20",successBorder:"#4FB54B50",info:"#2D9AD7",infoForeground:"#FDF8EC",infoBackground:"#2D9AD720",infoBorder:"#2D9AD750"},pr:{open:"#4FB54B",draft:"#6D5C40",blocked:"#F1A948",merged:"#BF7BFF",closed:"#E54B4B"},syntax:{base:{background:"#F8F2E6",foreground:"#292318",comment:"#6D5C40",keyword:"#BF7BFF",string:"#4FB54B",number:"#D9487C",function:"#BF7BFF",variable:"#292318",type:"#F1A948",operator:"#D9487C"},tokens:{boolean:"#F1A948",class:"#BF7BFF",className:"#BF7BFF",commentDoc:"#B5AA96",constant:"#2D9AD7",decorator:"#F1A948",enum:"#BF7BFF",exception:"#D9487C",functionCall:"#BF7BFF",interface:"#F1A948",jsxTag:"#BF7BFF",key:"#BF7BFF",keywordImport:"#D9487C",label:"#D9487C",macro:"#2D9AD7",method:"#4FB54B",module:"#D9487C",namespace:"#F1A948",parameter:"#292318",preprocessor:"#D9487C",punctuation:"#6D5C40",regex:"#4FB54B",storageModifier:"#2D9AD7",stringEscape:"#1C150C",struct:"#BF7BFF",tag:"#BF7BFF",tagAttribute:"#F1A948",tagAttributeValue:"#4FB54B",typeParameter:"#F1A948",url:"#2D9AD7",variableGlobal:"#BF7BFF",variableLocal:"#FBF5E8",variableOther:"#4FB54B",variableProperty:"#2D9AD7"},highlights:{diffAdded:"#4FB54B",diffAddedBackground:"#E8F7E1",diffModified:"#2D9AD7",diffModifiedBackground:"#E9E0D0",diffRemoved:"#E54B4B",diffRemovedBackground:"#FDE5E4",lineNumber:"#CABFAD",lineNumberActive:"#1C150C"}},markdown:{heading1:"#292318",heading2:"#292318",heading3:"#292318",heading4:"#292318",link:"#2D9AD7",linkHover:"#BF7BFF",inlineCode:"#4FB54B",inlineCodeBackground:"#F8F2E6",blockquote:"#F1A948",blockquoteBorder:"#E9E0CF",listMarker:"#BF7BFF99"},chat:{userMessage:"#292318",userMessageBackground:"#F8F2E6",assistantMessage:"#292318",assistantMessageBackground:"#FDF8EC",timestamp:"#6D5C40",divider:"#E9E0CF"},tools:{background:"#F8F2E680",border:"#d0c8b880",headerHover:"#F7EFDD",icon:"#6D5C40",title:"#292318",description:"#6D5C40",edit:{added:"#4FB54B",addedBackground:"#4FB54B25",removed:"#E54B4B",removedBackground:"#E54B4B25",lineNumber:"#bfb5a4"}}},mu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},gu={metadata:uu,colors:fu,config:mu},pu={id:"nightowl-dark",name:"Night Owl",description:"Night Owl",version:"1.0.0",variant:"dark",tags:["dark","palette"]},hu={primary:{base:"#82AAFF",hover:"#6F94DF",active:"#95B7FF",foreground:"#011627",muted:"#82AAFF80",emphasis:"#6F94DF"},surface:{background:"#011627",foreground:"#D6DEEB",muted:"#0B253A",mutedForeground:"#7d8892",elevated:"#001122",elevatedForeground:"#D6DEEB",overlay:"#FFFFFF20",subtle:"#0f283f"},interactive:{border:"#1D3B53",borderHover:"#234561",borderFocus:"#82AAFF",selection:"#555d6d94",selectionForeground:"#FFFFFF",focus:"#82AAFF",focusRing:"#82AAFF40",cursor:"#FFFFFF",hover:"#555d6d68",active:"#555d6d94"},status:{error:"#EF5350",errorForeground:"#011627",errorBackground:"#EF535020",errorBorder:"#EF535050",warning:"#ECC48D",warningForeground:"#011627",warningBackground:"#ECC48D20",warningBorder:"#ECC48D50",success:"#C5E478",successForeground:"#011627",successBackground:"#C5E47820",successBorder:"#C5E47850",info:"#82AAFF",infoForeground:"#011627",infoBackground:"#82AAFF20",infoBorder:"#82AAFF50"},pr:{open:"#C5E478",draft:"#5F7E97",blocked:"#ECC48D",merged:"#BC82FF",closed:"#EF5350"},syntax:{base:{background:"#0B253A",foreground:"#D6DEEB",comment:"#5F7E97",keyword:"#82AAFF",string:"#ECC48D",number:"#F78C6C",function:"#82AAFF",variable:"#D6DEEB",type:"#C5E478",operator:"#F78C6C"},tokens:{boolean:"#C5E478",class:"#82AAFF",className:"#82AAFF",commentDoc:"#516E86",constant:"#7FDBCA",decorator:"#C5E478",enum:"#82AAFF",exception:"#F78C6C",functionCall:"#82AAFF",interface:"#C5E478",jsxTag:"#82AAFF",key:"#82AAFF",keywordImport:"#F78C6C",label:"#F78C6C",macro:"#82AAFF",method:"#C5E478",module:"#F78C6C",namespace:"#C5E478",parameter:"#D6DEEB",preprocessor:"#F78C6C",punctuation:"#5F7E97",regex:"#ECC48D",storageModifier:"#82AAFF",stringEscape:"#FFFFFF",struct:"#82AAFF",tag:"#82AAFF",tagAttribute:"#C5E478",tagAttributeValue:"#ECC48D",typeParameter:"#C5E478",url:"#7FDBCA",variableGlobal:"#82AAFF",variableLocal:"#001122",variableOther:"#C5E478",variableProperty:"#7FDBCA"},highlights:{diffAdded:"#C5E478",diffAddedBackground:"#0A2E1A",diffModified:"#82AAFF",diffModifiedBackground:"#0B253A",diffRemoved:"#EF5350",diffRemovedBackground:"#2D1B1B",lineNumber:"#82AAFF",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#D6DEEB",heading2:"#D6DEEB",heading3:"#D6DEEB",heading4:"#D6DEEB",link:"#7FDBCA",linkHover:"#82AAFF",inlineCode:"#C5E478",inlineCodeBackground:"#0B253A",blockquote:"#5F7E97",blockquoteBorder:"#1D3B53",listMarker:"#82AAFF99"},chat:{userMessage:"#D6DEEB",userMessageBackground:"#0f283f",assistantMessage:"#D6DEEB",assistantMessageBackground:"#011627",timestamp:"#5F7E97",divider:"#1D3B53"},tools:{background:"#0B253A80",border:"#24496780",headerHover:"#000C17",icon:"#5F7E97",title:"#D6DEEB",description:"#5F7E97",edit:{added:"#C5E478",addedBackground:"#C5E47825",removed:"#EF5350",removedBackground:"#EF535025",lineNumber:"#58698f"}}},Fu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},yu={metadata:pu,colors:hu,config:Fu},bu={id:"nightowl-light",name:"Night Owl",description:"Night Owl",version:"1.0.0",variant:"light",tags:["light","palette"]},Au={primary:{base:"#4876D6",hover:"#6C91DD",active:"#4168BA",foreground:"#FBFBFB",muted:"#4876D680",emphasis:"#6C91DD"},surface:{background:"#FBFBFB",foreground:"#403F53",muted:"#F0F0F0",mutedForeground:"#747a7a",elevated:"#FFFFFF",elevatedForeground:"#403F53",overlay:"#1A1A1A20",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#CCCCCC",borderFocus:"#4876D6",selection:"#706e6e22",selectionForeground:"#1A1A1A",focus:"#4876D6",focusRing:"#4876D640",cursor:"#1A1A1A",hover:"#706e6e16",active:"#706e6e22"},status:{error:"#DE3D3B",errorForeground:"#FBFBFB",errorBackground:"#DE3D3B20",errorBorder:"#DE3D3B50",warning:"#C96765",warningForeground:"#FBFBFB",warningBackground:"#C9676520",warningBorder:"#C9676550",success:"#2AA298",successForeground:"#FBFBFB",successBackground:"#2AA29820",successBorder:"#2AA29850",info:"#4876D6",infoForeground:"#FBFBFB",infoBackground:"#4876D620",infoBorder:"#4876D650"},pr:{open:"#2AA298",draft:"#7A8181",blocked:"#c98f65",merged:"#994CC3",closed:"#DE3D3B"},syntax:{base:{background:"#F0F0F0",foreground:"#403F53",comment:"#7A8181",keyword:"#4876D6",string:"#C96765",number:"#AA0982",function:"#4876D6",variable:"#403F53",type:"#994CC3",operator:"#AA0982"},tokens:{boolean:"#994CC3",class:"#4876D6",className:"#4876D6",commentDoc:"#BBBEBE",constant:"#2AA298",decorator:"#994CC3",enum:"#4876D6",exception:"#AA0982",functionCall:"#4876D6",interface:"#994CC3",jsxTag:"#4876D6",key:"#4876D6",keywordImport:"#AA0982",label:"#AA0982",macro:"#4876D6",method:"#2AA298",module:"#AA0982",namespace:"#994CC3",parameter:"#403F53",preprocessor:"#AA0982",punctuation:"#7A8181",regex:"#C96765",storageModifier:"#4876D6",stringEscape:"#1A1A1A",struct:"#4876D6",tag:"#4876D6",tagAttribute:"#994CC3",tagAttributeValue:"#C96765",typeParameter:"#994CC3",url:"#2AA298",variableGlobal:"#4876D6",variableLocal:"#FFFFFF",variableOther:"#2AA298",variableProperty:"#2AA298"},highlights:{diffAdded:"#2AA298",diffAddedBackground:"#EAF8F6",diffModified:"#4876D6",diffModifiedBackground:"#E8F0FC",diffRemoved:"#DE3D3B",diffRemovedBackground:"#FBE9E9",lineNumber:"#4876D6",lineNumberActive:"#1A1A1A"}},markdown:{heading1:"#403F53",heading2:"#403F53",heading3:"#403F53",heading4:"#403F53",link:"#2AA298",linkHover:"#4876D6",inlineCode:"#2AA298",inlineCodeBackground:"#F0F0F0",blockquote:"#7A8181",blockquoteBorder:"#D9D9D9",listMarker:"#4876D699"},chat:{userMessage:"#403F53",userMessageBackground:"#F0F0F0",assistantMessage:"#403F53",assistantMessageBackground:"#FBFBFB",timestamp:"#7A8181",divider:"#D9D9D9"},tools:{background:"#F0F0F080",border:"#D9D9D980",headerHover:"#FFFFFF",icon:"#7A8181",title:"#403F53",description:"#7A8181",edit:{added:"#2AA298",addedBackground:"#2AA29825",removed:"#DE3D3B",removedBackground:"#DE3D3B25",lineNumber:"#4876D6"}}},wu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Eu={metadata:bu,colors:Au,config:wu},Cu={id:"nord-dark",name:"Nord",description:"Nord",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Bu={primary:{base:"#88C0D0",hover:"#78A9B8",active:"#99C9D7",foreground:"#1F2430",muted:"#88C0D080",emphasis:"#78A9B8"},surface:{background:"#1F2430",foreground:"#E5E9F0",muted:"#222938",mutedForeground:"#7c828e",elevated:"#1C202A",elevatedForeground:"#E5E9F0",overlay:"#F8FAFC20",subtle:"#272f40"},interactive:{border:"#414755",borderHover:"#383F50",borderFocus:"#545B78",selection:"#3e4a56fe",selectionForeground:"#F8FAFC",focus:"#88C0D0",focusRing:"#88C0D040",cursor:"#F8FAFC",hover:"#3e4a5692",active:"#3e4a56fe"},status:{error:"#BF616A",errorForeground:"#1F2430",errorBackground:"#BF616A20",errorBorder:"#BF616A50",warning:"#D08770",warningForeground:"#1F2430",warningBackground:"#D0877020",warningBorder:"#D0877050",success:"#A3BE8C",successForeground:"#1F2430",successBackground:"#A3BE8C20",successBorder:"#A3BE8C50",info:"#81A1C1",infoForeground:"#1F2430",infoBackground:"#81A1C120",infoBorder:"#81A1C150"},pr:{open:"#A3BE8C",draft:"#A4ADBF",blocked:"#D08770",merged:"#b788d0",closed:"#BF616A"},syntax:{base:{background:"#222938",foreground:"#E5E9F0",comment:"#A4ADBF",keyword:"#88C0D0",string:"#A3BE8C",number:"#D57780",function:"#88C0D0",variable:"#E5E9F0",type:"#EAC196",operator:"#D57780"},tokens:{boolean:"#EAC196",class:"#88C0D0",className:"#88C0D0",commentDoc:"#9098AA",constant:"#81A1C1",decorator:"#EAC196",enum:"#88C0D0",exception:"#D57780",functionCall:"#88C0D0",interface:"#EAC196",jsxTag:"#88C0D0",key:"#88C0D0",keywordImport:"#D57780",label:"#D57780",macro:"#81A1C1",method:"#A3BE8C",module:"#D57780",namespace:"#EAC196",parameter:"#E5E9F0",preprocessor:"#D57780",punctuation:"#A4ADBF",regex:"#A3BE8C",storageModifier:"#81A1C1",stringEscape:"#F8FAFC",struct:"#88C0D0",tag:"#88C0D0",tagAttribute:"#EAC196",tagAttributeValue:"#A3BE8C",typeParameter:"#EAC196",url:"#81A1C1",variableGlobal:"#88C0D0",variableLocal:"#1C202A",variableOther:"#A3BE8C",variableProperty:"#81A1C1"},highlights:{diffAdded:"#A3BE8C",diffAddedBackground:"#1F2E33",diffModified:"#81A1C1",diffModifiedBackground:"#222B3A",diffRemoved:"#BF616A",diffRemovedBackground:"#2E212A",lineNumber:"#434A62",lineNumberActive:"#F8FAFC"}},markdown:{heading1:"#E5E9F0",heading2:"#E5E9F0",heading3:"#E5E9F0",heading4:"#E5E9F0",link:"#81A1C1",linkHover:"#88C0D0",inlineCode:"#A3BE8C",inlineCodeBackground:"#252c3c",blockquote:"#D08770",blockquoteBorder:"#343A47",listMarker:"#88C0D099"},chat:{userMessage:"#E5E9F0",userMessageBackground:"#272f40",assistantMessage:"#E5E9F0",assistantMessageBackground:"#1F2430",timestamp:"#A4ADBF",divider:"#343A47"},tools:{background:"#22293880",border:"#454e5f80",headerHover:"#181C24",icon:"#A4ADBF",title:"#E5E9F0",description:"#A4ADBF",edit:{added:"#A3BE8C",addedBackground:"#A3BE8C25",removed:"#BF616A",removedBackground:"#BF616A25",lineNumber:"#4a526b"}}},Du={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ku={metadata:Cu,colors:Bu,config:Du},vu={id:"nord-light",name:"Nord",description:"Nord",version:"1.0.0",variant:"light",tags:["light","palette"]},Su={primary:{base:"#5E81AC",hover:"#7A97BA",active:"#557399",foreground:"#ECEFF4",muted:"#5E81AC80",emphasis:"#7A97BA"},surface:{background:"#ECEFF4",foreground:"#2E3440",muted:"#E4E8F0",mutedForeground:"#6e7481",elevated:"#e7ebf5",elevatedForeground:"#2E3440",overlay:"#1F253020",subtle:"#dee4f0"},interactive:{border:"#c5cbd6",borderHover:"#C9D0DE",borderFocus:"#9CA4BA",selection:"#c6ccd881",selectionForeground:"#1F2530",focus:"#5E81AC",focusRing:"#5E81AC40",cursor:"#1F2530",hover:"#c6ccd84a",active:"#c6ccd881"},status:{error:"#BF616A",errorForeground:"#ECEFF4",errorBackground:"#BF616A20",errorBorder:"#BF616A50",warning:"#D08770",warningForeground:"#ECEFF4",warningBackground:"#D0877020",warningBorder:"#D0877050",success:"#8FBCBB",successForeground:"#ECEFF4",successBackground:"#8FBCBB20",successBorder:"#8FBCBB50",info:"#81A1C1",infoForeground:"#ECEFF4",infoBackground:"#81A1C120",infoBorder:"#81A1C150"},pr:{open:"#8FBCBB",draft:"#4C566A",blocked:"#D08770",merged:"#9b5eac",closed:"#BF616A"},syntax:{base:{background:"#E4E8F0",foreground:"#2E3440",comment:"#4C566A",keyword:"#5E81AC",string:"#A3BE8C",number:"#BF616A",function:"#5E81AC",variable:"#2E3440",type:"#D08770",operator:"#BF616A"},tokens:{boolean:"#D08770",class:"#5E81AC",className:"#5E81AC",commentDoc:"#9CA3AF",constant:"#81A1C1",decorator:"#D08770",enum:"#5E81AC",exception:"#BF616A",functionCall:"#5E81AC",interface:"#D08770",jsxTag:"#5E81AC",key:"#5E81AC",keywordImport:"#BF616A",label:"#BF616A",macro:"#81A1C1",method:"#8FBCBB",module:"#BF616A",namespace:"#D08770",parameter:"#2E3440",preprocessor:"#BF616A",punctuation:"#4C566A",regex:"#A3BE8C",storageModifier:"#81A1C1",stringEscape:"#1F2530",struct:"#5E81AC",tag:"#5E81AC",tagAttribute:"#D08770",tagAttributeValue:"#A3BE8C",typeParameter:"#D08770",url:"#81A1C1",variableGlobal:"#5E81AC",variableLocal:"#F1F3F8",variableOther:"#8FBCBB",variableProperty:"#81A1C1"},highlights:{diffAdded:"#8FBCBB",diffAddedBackground:"#E4F0E4",diffModified:"#81A1C1",diffModifiedBackground:"#DFE6F2",diffRemoved:"#BF616A",diffRemovedBackground:"#F4E1E4",lineNumber:"#B2BACC",lineNumberActive:"#1F2530"}},markdown:{heading1:"#2E3440",heading2:"#2E3440",heading3:"#2E3440",heading4:"#2E3440",link:"#81A1C1",linkHover:"#5E81AC",inlineCode:"#4f7034",inlineCodeBackground:"#E4E8F0",blockquote:"#D08770",blockquoteBorder:"#D5DBE7",listMarker:"#5E81AC99"},chat:{userMessage:"#2E3440",userMessageBackground:"#dee4f0",assistantMessage:"#2E3440",assistantMessageBackground:"#ECEFF4",timestamp:"#4C566A",divider:"#D5DBE7"},tools:{background:"#E4E8F080",border:"#b8bfcc80",headerHover:"#F6F8FC",icon:"#4C566A",title:"#2E3440",description:"#4C566A",edit:{added:"#8FBCBB",addedBackground:"#8FBCBB25",removed:"#BF616A",removedBackground:"#BF616A25",lineNumber:"#b7bfd1"}}},Mu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Tu={metadata:vu,colors:Su,config:Mu},Pu={id:"openchamber-dark",name:"Fields of the Shire",description:"Fields of the Shire theme - dark variant",author:"OpenChamber",version:"1.0.0",variant:"dark",tags:["dark","warm","earthy","brand"]},Ru={primary:{base:"#7a8a5a",hover:"#93a56b",active:"#a4b67d",foreground:"#0c0a08",muted:"#7a8a5a80",emphasis:"#93a56b"},surface:{background:"#1b1815",foreground:"#ebe0d1",muted:"#23201c",mutedForeground:"#83796f",elevated:"#2b2622",elevatedForeground:"#ebe0d1",overlay:"#1b1815cc",subtle:"#332d28"},interactive:{border:"#413e3a",borderHover:"#f0e6d830",borderFocus:"#373d2c",selection:"#f0e6d81f",selectionForeground:"#ebe0d1",focus:"#7a8a5a",focusRing:"#7a8a5a4d",cursor:"#ebe0d1",hover:"#332d28",active:"#f0e6d824"},status:{error:"#b34d3b",errorForeground:"#0c0a08",errorBackground:"#b85a4a20",errorBorder:"#b85a4a50",warning:"#c47a3a",warningForeground:"#0c0a08",warningBackground:"#c47a3a20",warningBorder:"#c47a3a50",success:"#7f905e",successForeground:"#0c0a08",successBackground:"#7a8a5a20",successBorder:"#7a8a5a50",info:"#667c8a",infoForeground:"#f0e6d8",infoBackground:"#5a6d7a20",infoBorder:"#5a6d7a50"},pr:{open:"#7a8a5a",draft:"#6a5e52",blocked:"#c47a3a",merged:"#5a6d7a",closed:"#b85a4a"},syntax:{base:{background:"#23201c",foreground:"#ebe0d1",comment:"#6a5e52",keyword:"#5a6d7a",string:"#93a56b",number:"#c47a3a",function:"#c47a3a",variable:"#ebe0d1",type:"#7a8a5a",operator:"#a89888"},tokens:{commentDoc:"#4a4238",stringEscape:"#ebe0d1",keywordImport:"#5a6d7a",storageModifier:"#5a6d7a",functionCall:"#c47a3a",method:"#93a56b",variableProperty:"#5a6d7a",variableOther:"#ebe0d1",variableGlobal:"#c47a3a",variableLocal:"#a89888",parameter:"#ebe0d1",constant:"#c47a3a",class:"#7a8a5a",className:"#7a8a5a",interface:"#7a8a5a",struct:"#7a8a5a",enum:"#7a8a5a",typeParameter:"#93a56b",namespace:"#5a6d7a",module:"#5a6d7a",tag:"#c47a3a",jsxTag:"#c47a3a",tagAttribute:"#93a56b",tagAttributeValue:"#93a56b",boolean:"#7a8a5a",decorator:"#5a6d7a",label:"#c47a3a",punctuation:"#a89888",macro:"#5a6d7a",preprocessor:"#5a6d7a",regex:"#93a56b",url:"#5a6d7a",key:"#c47a3a",exception:"#b85a4a"},highlights:{diffAdded:"#7a8a5a",diffAddedBackground:"#7a8a5a20",diffRemoved:"#b85a4a",diffRemovedBackground:"#b85a4a20",diffModified:"#5a6d7a",diffModifiedBackground:"#5a6d7a20",lineNumber:"#6a5e52",lineNumberActive:"#ebe0d1"}},markdown:{heading1:"#c47a3a",heading2:"#93a56b",heading3:"#ebe0d1",heading4:"#ebe0d1",link:"#5a6d7a",linkHover:"#93a56b",inlineCode:"#93a56b",inlineCodeBackground:"#23201c",blockquote:"#a89888",blockquoteBorder:"#f0e6d830",listMarker:"#c47a3a99"},chat:{userMessage:"#ebe0d1",userMessageBackground:"#272a25",assistantMessage:"#ebe0d1",assistantMessageBackground:"#1b1815",timestamp:"#6a5e52",divider:"#f0e6d81c"},tools:{background:"#23201c80",border:"#f0e6d830",headerHover:"#2a252180",icon:"#a89888",title:"#ebe0d1",description:"#a19a96",edit:{added:"#7a8a5a",addedBackground:"#7a8a5a25",removed:"#b85a4a",removedBackground:"#b85a4a25",lineNumber:"#6a5e52"}}},Iu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ds={metadata:Pu,colors:Ru,config:Iu},xu={id:"openchamber-light",name:"Fields of the Shire",description:"Fields of the Shire theme - light variant",author:"OpenChamber",version:"1.0.0",variant:"light",tags:["light","warm","earthy","brand"]},Ou={primary:{base:"#4a6030",hover:"#5e773f",active:"#708a50",foreground:"#faf8f5",muted:"#4a603080",emphasis:"#5e773f"},surface:{background:"#f9f5eb",foreground:"#1a1612",muted:"#f4efe3",mutedForeground:"#5a5048",elevated:"#fcf9f0",elevatedForeground:"#1a1612",overlay:"#1a161220",subtle:"#efe8da"},interactive:{border:"#1a16121c",borderHover:"#1a161230",borderFocus:"#4a6030",selection:"#1a16121a",selectionForeground:"#1a1612",focus:"#4a6030",focusRing:"#4a603040",cursor:"#1a1612",hover:"#efe8da",active:"#1a16121f"},status:{error:"#a24d3f",errorForeground:"#faf8f5",errorBackground:"#a24d3f20",errorBorder:"#a24d3f50",warning:"#8c5520",warningForeground:"#faf8f5",warningBackground:"#8c552020",warningBorder:"#8c552050",success:"#4a6030",successForeground:"#faf8f5",successBackground:"#4a603020",successBorder:"#4a603050",info:"#3d4f5a",infoForeground:"#faf8f5",infoBackground:"#3d4f5a20",infoBorder:"#3d4f5a50"},pr:{open:"#4a6030",draft:"#8a7e72",blocked:"#8c5520",merged:"#3d4f5a",closed:"#a24d3f"},syntax:{base:{background:"#ece5d6",foreground:"#1a1612",comment:"#8a7e72",keyword:"#3d4f5a",string:"#5e773f",number:"#8c5520",function:"#8c5520",variable:"#1a1612",type:"#4a6030",operator:"#5a5048"},tokens:{commentDoc:"#b8b0a4",stringEscape:"#1a1612",keywordImport:"#3d4f5a",storageModifier:"#3d4f5a",functionCall:"#8c5520",method:"#5e773f",variableProperty:"#3d4f5a",variableOther:"#1a1612",variableGlobal:"#8c5520",variableLocal:"#5a5048",parameter:"#1a1612",constant:"#8c5520",class:"#4a6030",className:"#4a6030",interface:"#4a6030",struct:"#4a6030",enum:"#4a6030",typeParameter:"#5e773f",namespace:"#3d4f5a",module:"#3d4f5a",tag:"#8c5520",jsxTag:"#8c5520",tagAttribute:"#4a6030",tagAttributeValue:"#5e773f",boolean:"#4a6030",decorator:"#3d4f5a",label:"#8c5520",punctuation:"#5a5048",macro:"#3d4f5a",preprocessor:"#3d4f5a",regex:"#5e773f",url:"#3d4f5a",key:"#8c5520",exception:"#a24d3f"},highlights:{diffAdded:"#4a6030",diffAddedBackground:"#4a603020",diffRemoved:"#a24d3f",diffRemovedBackground:"#a24d3f20",diffModified:"#3d4f5a",diffModifiedBackground:"#3d4f5a20",lineNumber:"#8a7e72",lineNumberActive:"#1a1612"}},markdown:{heading1:"#8c5520",heading2:"#4a6030",heading3:"#1a1612",heading4:"#1a1612",link:"#3d4f5a",linkHover:"#4a6030",inlineCode:"#4a6030",inlineCodeBackground:"#ece5d6",blockquote:"#5a5048",blockquoteBorder:"#1a161230",listMarker:"#8c552099"},chat:{userMessage:"#1a1612",userMessageBackground:"#efe8da",assistantMessage:"#1a1612",assistantMessageBackground:"#f9f5eb",timestamp:"#8a7e72",divider:"#1a16121c"},tools:{background:"#f4efe380",border:"#1a161230",headerHover:"#efe8da",icon:"#5a5048",title:"#1a1612",description:"#5a5048",edit:{added:"#4a6030",addedBackground:"#4a603025",removed:"#a24d3f",removedBackground:"#a24d3f25",lineNumber:"#8a7e72"}}},_u={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},ls={metadata:xu,colors:Ou,config:_u},Nu={id:"onedarkpro-dark",name:"One Dark Pro",description:"One Dark Pro",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Uu={primary:{base:"#61AFEF",hover:"#579AD1",active:"#77BAF1",foreground:"#1E222A",muted:"#61AFEF80",emphasis:"#579AD1"},surface:{background:"#1E222A",foreground:"#ABB2BF",muted:"#212631",mutedForeground:"#737a89",elevated:"#232832",elevatedForeground:"#ABB2BF",overlay:"#F6F7FB20",subtle:"#2E3442"},interactive:{border:"#373e4f",borderHover:"#363D52",borderFocus:"#555C79",selection:"#a8aec533",selectionForeground:"#F6F7FB",focus:"#61AFEF",focusRing:"#61AFEF40",cursor:"#F6F7FB",hover:"#a8aec525",active:"#a8aec533"},status:{error:"#E06C75",errorForeground:"#1E222A",errorBackground:"#E06C7520",errorBorder:"#E06C7550",warning:"#E5C07B",warningForeground:"#1E222A",warningBackground:"#E5C07B20",warningBorder:"#E5C07B50",success:"#98C379",successForeground:"#1E222A",successBackground:"#98C37920",successBorder:"#98C37950",info:"#56B6C2",infoForeground:"#1E222A",infoBackground:"#56B6C220",infoBorder:"#56B6C250"},pr:{open:"#98C379",draft:"#818899",blocked:"#E5C07B",merged:"#bb61ef",closed:"#E06C75"},syntax:{base:{background:"#212631",foreground:"#ABB2BF",comment:"#818899",keyword:"#61AFEF",string:"#98C379",number:"#E06C75",function:"#61AFEF",variable:"#ABB2BF",type:"#E5C07B",operator:"#E06C75"},tokens:{boolean:"#E5C07B",class:"#61AFEF",className:"#61AFEF",commentDoc:"#727988",constant:"#56B6C2",decorator:"#E5C07B",enum:"#61AFEF",exception:"#E06C75",functionCall:"#61AFEF",interface:"#E5C07B",jsxTag:"#61AFEF",key:"#61AFEF",keywordImport:"#E06C75",label:"#E06C75",macro:"#56B6C2",method:"#98C379",module:"#E06C75",namespace:"#E5C07B",parameter:"#ABB2BF",preprocessor:"#E06C75",punctuation:"#818899",regex:"#98C379",storageModifier:"#56B6C2",stringEscape:"#F6F7FB",struct:"#61AFEF",tag:"#61AFEF",tagAttribute:"#E5C07B",tagAttributeValue:"#98C379",typeParameter:"#E5C07B",url:"#56B6C2",variableGlobal:"#61AFEF",variableLocal:"#1B1F27",variableOther:"#98C379",variableProperty:"#56B6C2"},highlights:{diffAdded:"#98C379",diffAddedBackground:"#1C2A26",diffModified:"#56B6C2",diffModifiedBackground:"#232836",diffRemoved:"#E06C75",diffRemovedBackground:"#2A1C22",lineNumber:"#424967",lineNumberActive:"#F6F7FB"}},markdown:{heading1:"#ABB2BF",heading2:"#ABB2BF",heading3:"#ABB2BF",heading4:"#ABB2BF",link:"#56B6C2",linkHover:"#61AFEF",inlineCode:"#a0c288",inlineCodeBackground:"#232937",blockquote:"#E5C07B",blockquoteBorder:"#323848",listMarker:"#61AFEF99"},chat:{userMessage:"#ABB2BF",userMessageBackground:"#2e3442",assistantMessage:"#ABB2BF",assistantMessageBackground:"#1E222A",timestamp:"#818899",divider:"#323848"},tools:{background:"#21263180",border:"#41495e80",headerHover:"#171B23",icon:"#818899",title:"#ABB2BF",description:"#818899",edit:{added:"#98C379",addedBackground:"#98C37925",removed:"#E06C75",removedBackground:"#E06C7525",lineNumber:"#545c81"}}},Lu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Hu={metadata:Nu,colors:Uu,config:Lu},ju={id:"onedarkpro-light",name:"One Dark Pro",description:"One Dark Pro",version:"1.0.0",variant:"light",tags:["light","palette"]},zu={primary:{base:"#528BFF",hover:"#73A0FE",active:"#4879DC",foreground:"#F5F6F8",muted:"#528BFF80",emphasis:"#73A0FE"},surface:{background:"#F5F6F8",foreground:"#2B303B",muted:"#EEF0F4",mutedForeground:"#6e727b",elevated:"#f0f5fa",elevatedForeground:"#2B303B",overlay:"#0E111820",subtle:"#eaedf4"},interactive:{border:"#cccfd6",borderHover:"#D4D9E3",borderFocus:"#A6ADBF",selection:"#d8dde6",selectionForeground:"#0E1118",focus:"#528BFF",focusRing:"#528BFF40",cursor:"#0E1118",hover:"#d8dde6c2",active:"#FAFBFC"},status:{error:"#E06C75",errorForeground:"#F5F6F8",errorBackground:"#E06C7520",errorBorder:"#E06C7550",warning:"#D19A66",warningForeground:"#F5F6F8",warningBackground:"#D19A6620",warningBorder:"#D19A6650",success:"#4FA66D",successForeground:"#F5F6F8",successBackground:"#4FA66D20",successBorder:"#4FA66D50",info:"#61AFEF",infoForeground:"#F5F6F8",infoBackground:"#61AFEF20",infoBorder:"#61AFEF50"},pr:{open:"#4FA66D",draft:"#6B717F",blocked:"#D19A66",merged:"#a052ff",closed:"#E06C75"},syntax:{base:{background:"#EEF0F4",foreground:"#2B303B",comment:"#6B717F",keyword:"#528BFF",string:"#4FA66D",number:"#D85462",function:"#528BFF",variable:"#2B303B",type:"#D19A66",operator:"#D85462"},tokens:{boolean:"#D19A66",class:"#528BFF",className:"#528BFF",commentDoc:"#B0B4BC",constant:"#61AFEF",decorator:"#D19A66",enum:"#528BFF",exception:"#D85462",functionCall:"#528BFF",interface:"#D19A66",jsxTag:"#528BFF",key:"#528BFF",keywordImport:"#D85462",label:"#D85462",macro:"#61AFEF",method:"#4FA66D",module:"#D85462",namespace:"#D19A66",parameter:"#2B303B",preprocessor:"#D85462",punctuation:"#6B717F",regex:"#4FA66D",storageModifier:"#61AFEF",stringEscape:"#0E1118",struct:"#528BFF",tag:"#528BFF",tagAttribute:"#D19A66",tagAttributeValue:"#4FA66D",typeParameter:"#D19A66",url:"#61AFEF",variableGlobal:"#528BFF",variableLocal:"#FAFBFC",variableOther:"#4FA66D",variableProperty:"#61AFEF"},highlights:{diffAdded:"#4FA66D",diffAddedBackground:"#E5F4EA",diffModified:"#61AFEF",diffModifiedBackground:"#E4E8F4",diffRemoved:"#E06C75",diffRemovedBackground:"#FDE7EA",lineNumber:"#BEC4D0",lineNumberActive:"#0E1118"}},markdown:{heading1:"#2B303B",heading2:"#2B303B",heading3:"#2B303B",heading4:"#2B303B",link:"#61AFEF",linkHover:"#528BFF",inlineCode:"#327d4c",inlineCodeBackground:"#EEF0F4",blockquote:"#D19A66",blockquoteBorder:"#DEE2EB",listMarker:"#528BFF99"},chat:{userMessage:"#2B303B",userMessageBackground:"#eaedf4",assistantMessage:"#2B303B",assistantMessageBackground:"#F5F6F8",timestamp:"#6B717F",divider:"#DEE2EB"},tools:{background:"#EEF0F480",border:"#c4c8d080",headerHover:"#FFFFFF",icon:"#6B717F",title:"#2B303B",description:"#6B717F",edit:{added:"#4FA66D",addedBackground:"#4FA66D25",removed:"#E06C75",removedBackground:"#E06C7525",lineNumber:"#afb5c1"}}},$u={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gu={metadata:ju,colors:zu,config:$u},qu={id:"solarized-dark",name:"Solarized",description:"Solarized",version:"1.0.0",variant:"dark",tags:["dark","palette"]},Wu={primary:{base:"#278BD2",hover:"#5C65AC",active:"#8285C9",foreground:"#001F27",muted:"#6C71C480",emphasis:"#5C65AC"},surface:{background:"#001e25",foreground:"#93A1A1",muted:"#02232e",mutedForeground:"#6f7475",elevated:"#052832",elevatedForeground:"#93A1A1",overlay:"#FDF6E320",subtle:"#042b34"},interactive:{border:"#253f47",borderHover:"#243E47",borderFocus:"#3A5A6B",selection:"#98afbd33",selectionForeground:"#FDF6E3",focus:"#6C71C4",focusRing:"#6C71C440",cursor:"#FDF6E3",hover:"#98afbd25",active:"#98afbd33"},status:{error:"#DC322F",errorForeground:"#001F27",errorBackground:"#DC322F20",errorBorder:"#DC322F50",warning:"#B58900",warningForeground:"#001F27",warningBackground:"#B5890020",warningBorder:"#B5890050",success:"#859900",successForeground:"#001F27",successBackground:"#85990020",successBorder:"#85990050",info:"#2AA198",infoForeground:"#001F27",infoBackground:"#2AA19820",infoBorder:"#2AA19850"},pr:{open:"#859900",draft:"#6C7F80",blocked:"#B58900",merged:"#7f6cc4",closed:"#DC322F"},syntax:{base:{background:"#022733",foreground:"#93A1A1",comment:"#6C7F80",keyword:"#6C71C4",string:"#859900",number:"#D33682",function:"#6C71C4",variable:"#93A1A1",type:"#B58900",operator:"#D33682"},tokens:{boolean:"#B58900",class:"#6C71C4",className:"#6C71C4",commentDoc:"#5C7173",constant:"#2AA198",decorator:"#B58900",enum:"#6C71C4",exception:"#D33682",functionCall:"#6C71C4",interface:"#B58900",jsxTag:"#6C71C4",key:"#6C71C4",keywordImport:"#D33682",label:"#D33682",macro:"#2AA198",method:"#859900",module:"#D33682",namespace:"#B58900",parameter:"#93A1A1",preprocessor:"#D33682",punctuation:"#6C7F80",regex:"#859900",storageModifier:"#2AA198",stringEscape:"#FDF6E3",struct:"#6C71C4",tag:"#6C71C4",tagAttribute:"#B58900",tagAttributeValue:"#859900",typeParameter:"#B58900",url:"#2AA198",variableGlobal:"#6C71C4",variableLocal:"#01222B",variableOther:"#859900",variableProperty:"#2AA198"},highlights:{diffAdded:"#859900",diffAddedBackground:"#0F2F29",diffModified:"#2AA198",diffModifiedBackground:"#0F3844",diffRemoved:"#DC322F",diffRemovedBackground:"#321C1C",lineNumber:"#2D4958",lineNumberActive:"#FDF6E3"}},markdown:{heading1:"#93A1A1",heading2:"#93A1A1",heading3:"#93A1A1",heading4:"#93A1A1",link:"#2AA198",linkHover:"#6C71C4",inlineCode:"#859900",inlineCodeBackground:"#022733",blockquote:"#B58900",blockquoteBorder:"#20373F",listMarker:"#6C71C499"},chat:{userMessage:"#93A1A1",userMessageBackground:"#042B34",assistantMessage:"#93A1A1",assistantMessageBackground:"#001F27",timestamp:"#6C7F80",divider:"#20373F"},tools:{background:"#02273380",border:"#2b495380",headerHover:"#032830",icon:"#6C7F80",title:"#93A1A1",description:"#6C7F80",edit:{added:"#859900",addedBackground:"#85990025",removed:"#DC322F",removedBackground:"#DC322F25",lineNumber:"#345567"}}},Vu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Ku={metadata:qu,colors:Wu,config:Vu},Ju={id:"solarized-light",name:"Solarized",description:"Solarized",version:"1.0.0",variant:"light",tags:["light","palette"]},Yu={primary:{base:"#268BD2",hover:"#51A0D5",active:"#217EBC",foreground:"#FDF6E3",muted:"#268BD280",emphasis:"#51A0D5"},surface:{background:"#FDF6E3",foreground:"#586E75",muted:"#F6EFDA",mutedForeground:"#7a8587",elevated:"#FAF3DC",elevatedForeground:"#586E75",overlay:"#07364220",subtle:"#F6EFDA"},interactive:{border:"#e0decc",borderHover:"#D9D4C2",borderFocus:"#ACA58F",selection:"#10647a22",selectionForeground:"#073642",focus:"#268BD2",focusRing:"#268BD240",cursor:"#073642",hover:"#10647a14",active:"#10647a22"},status:{error:"#DC322F",errorForeground:"#FDF6E3",errorBackground:"#DC322F20",errorBorder:"#DC322F50",warning:"#B58900",warningForeground:"#FDF6E3",warningBackground:"#B5890020",warningBorder:"#B5890050",success:"#859900",successForeground:"#FDF6E3",successBackground:"#85990020",successBorder:"#85990050",info:"#2AA198",infoForeground:"#FDF6E3",infoBackground:"#2AA19820",infoBorder:"#2AA19850"},pr:{open:"#859900",draft:"#7A8C8E",blocked:"#B58900",merged:"#6e26d2",closed:"#DC322F"},syntax:{base:{background:"#F6EFDA",foreground:"#586E75",comment:"#7A8C8E",keyword:"#268BD2",string:"#859900",number:"#D33682",function:"#268BD2",variable:"#586E75",type:"#B58900",operator:"#D33682"},tokens:{boolean:"#B58900",class:"#268BD2",className:"#268BD2",commentDoc:"#BCC1B9",constant:"#2AA198",decorator:"#B58900",enum:"#268BD2",exception:"#D33682",functionCall:"#268BD2",interface:"#B58900",jsxTag:"#268BD2",key:"#268BD2",keywordImport:"#D33682",label:"#D33682",macro:"#2AA198",method:"#859900",module:"#D33682",namespace:"#B58900",parameter:"#586E75",preprocessor:"#D33682",punctuation:"#7A8C8E",regex:"#859900",storageModifier:"#2AA198",stringEscape:"#073642",struct:"#268BD2",tag:"#268BD2",tagAttribute:"#B58900",tagAttributeValue:"#859900",typeParameter:"#B58900",url:"#2AA198",variableGlobal:"#268BD2",variableLocal:"#FAF3DC",variableOther:"#859900",variableProperty:"#2AA198"},highlights:{diffAdded:"#859900",diffAddedBackground:"#EEF5D6",diffModified:"#2AA198",diffModifiedBackground:"#E3ECF3",diffRemoved:"#DC322F",diffRemovedBackground:"#FDE4DD",lineNumber:"#C5C0AD",lineNumberActive:"#073642"}},markdown:{heading1:"#586E75",heading2:"#586E75",heading3:"#586E75",heading4:"#586E75",link:"#2AA198",linkHover:"#268BD2",inlineCode:"#859900",inlineCodeBackground:"#F6EFDA",blockquote:"#B58900",blockquoteBorder:"#E3E0CD",listMarker:"#268BD299"},chat:{userMessage:"#586E75",userMessageBackground:"#F6EFDA",assistantMessage:"#586E75",assistantMessageBackground:"#FDF6E3",timestamp:"#7A8C8E",divider:"#E3E0CD"},tools:{background:"#F6EFDA80",border:"#d1cebc80",headerHover:"#F6EDD4",icon:"#7A8C8E",title:"#586E75",description:"#7A8C8E",edit:{added:"#859900",addedBackground:"#85990025",removed:"#DC322F",removedBackground:"#DC322F25",lineNumber:"#c3bead"}}},Qu={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Xu={metadata:Ju,colors:Yu,config:Qu},Zu={id:"tokyonight-dark",name:"Tokyonight",description:"Tokyonight",version:"1.0.0",variant:"dark",tags:["dark","palette"]},ef={primary:{base:"#7AA2F7",hover:"#6A8CD6",active:"#8BADF8",foreground:"#0F111A",muted:"#7AA2F780",emphasis:"#6A8CD6"},surface:{background:"#0F111A",foreground:"#C0CAF5",muted:"#111428",mutedForeground:"#6a739d",elevated:"#131629",elevatedForeground:"#C0CAF5",overlay:"#EAEAFF20",subtle:"#171b30"},interactive:{border:"#31344a",borderHover:"#292C43",borderFocus:"#45496F",selection:"#b3b3cc33",selectionForeground:"#EAEAFF",focus:"#7AA2F7",focusRing:"#7AA2F740",cursor:"#EAEAFF",hover:"#272E49",active:"#262C46"},status:{error:"#F7768E",errorForeground:"#0F111A",errorBackground:"#F7768E20",errorBorder:"#F7768E50",warning:"#E0AF68",warningForeground:"#0F111A",warningBackground:"#E0AF6820",warningBorder:"#E0AF6850",success:"#9ECE6A",successForeground:"#0F111A",successBackground:"#9ECE6A20",successBorder:"#9ECE6A50",info:"#7DCFFF",infoForeground:"#0F111A",infoBackground:"#7DCFFF20",infoBorder:"#7DCFFF50"},pr:{open:"#9ECE6A",draft:"#7A88CF",blocked:"#E0AF68",merged:"#BB9AF7",closed:"#F7768E"},syntax:{base:{background:"#111428",foreground:"#C0CAF5",comment:"#7A88CF",keyword:"#BB9AF7",string:"#9ECE6A",number:"#FF9E64",function:"#BB9AF7",variable:"#C0CAF5",type:"#E0AF68",operator:"#FF9E64"},tokens:{boolean:"#E0AF68",class:"#BB9AF7",className:"#BB9AF7",commentDoc:"#6A76B4",constant:"#7DCFFF",decorator:"#E0AF68",enum:"#BB9AF7",exception:"#FF9E64",functionCall:"#BB9AF7",interface:"#E0AF68",jsxTag:"#BB9AF7",key:"#BB9AF7",keywordImport:"#FF9E64",label:"#FF9E64",macro:"#7DCFFF",method:"#9ECE6A",module:"#FF9E64",namespace:"#E0AF68",parameter:"#C0CAF5",preprocessor:"#FF9E64",punctuation:"#7A88CF",regex:"#9ECE6A",storageModifier:"#7DCFFF",stringEscape:"#EAEAFF",struct:"#BB9AF7",tag:"#BB9AF7",tagAttribute:"#E0AF68",tagAttributeValue:"#9ECE6A",typeParameter:"#E0AF68",url:"#7DCFFF",variableGlobal:"#BB9AF7",variableLocal:"#101324",variableOther:"#9ECE6A",variableProperty:"#7DCFFF"},highlights:{diffAdded:"#9ECE6A",diffAddedBackground:"#1C2A38",diffModified:"#7DCFFF",diffModifiedBackground:"#24283B",diffRemoved:"#F7768E",diffRemovedBackground:"#2A1F32",lineNumber:"#343755",lineNumberActive:"#EAEAFF"}},markdown:{heading1:"#C0CAF5",heading2:"#C0CAF5",heading3:"#C0CAF5",heading4:"#C0CAF5",link:"#7DCFFF",linkHover:"#7AA2F7",inlineCode:"#9ECE6A",inlineCodeBackground:"#111428",blockquote:"#E0AF68",blockquoteBorder:"#25283B",listMarker:"#7AA2F799"},chat:{userMessage:"#C0CAF5",userMessageBackground:"#171b30",assistantMessage:"#C0CAF5",assistantMessageBackground:"#0F111A",timestamp:"#7A88CF",divider:"#25283B"},tools:{background:"#11142880",border:"#393e5c80",headerHover:"#13172A",icon:"#7A88CF",title:"#C0CAF5",description:"#7A88CF",edit:{added:"#9ECE6A",addedBackground:"#9ECE6A25",removed:"#F7768E",removedBackground:"#F7768E25",lineNumber:"#3e4266"}}},tf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},of={metadata:Zu,colors:ef,config:tf},rf={id:"tokyonight-light",name:"Tokyonight",description:"Tokyonight",version:"1.0.0",variant:"light",tags:["light","palette"]},nf={primary:{base:"#2E7DE9",hover:"#5291E9",active:"#2B70D0",foreground:"#E1E2E7",muted:"#2E7DE980",emphasis:"#5291E9"},surface:{background:"#E1E2E7",foreground:"#273153",muted:"#DEE0EA",mutedForeground:"#686e9b",elevated:"#dee0ee",elevatedForeground:"#273153",overlay:"#1C254420",subtle:"#dadce6"},interactive:{border:"#bbbdc9",borderHover:"#C3C6D2",borderFocus:"#9599A8",selection:"#939cbf47",selectionForeground:"#1C2544",focus:"#2E7DE9",focusRing:"#2E7DE940",cursor:"#1C2544",hover:"#7b86ad2a",active:"#7b86ad47"},status:{error:"#C94060",errorForeground:"#E1E2E7",errorBackground:"#C9406020",errorBorder:"#C9406050",warning:"#8C6C3E",warningForeground:"#E1E2E7",warningBackground:"#8C6C3E20",warningBorder:"#8C6C3E50",success:"#587539",successForeground:"#E1E2E7",successBackground:"#58753920",successBorder:"#58753950",info:"#007197",infoForeground:"#E1E2E7",infoBackground:"#00719720",infoBorder:"#00719750"},pr:{open:"#587539",draft:"#5C6390",blocked:"#8C6C3E",merged:"#9854F1",closed:"#C94060"},syntax:{base:{background:"#DEE0EA",foreground:"#273153",comment:"#5C6390",keyword:"#9854F1",string:"#587539",number:"#B15C00",function:"#9854F1",variable:"#273153",type:"#3760BF",operator:"#B15C00"},tokens:{boolean:"#3760BF",class:"#9854F1",className:"#9854F1",commentDoc:"#9FA3BC",constant:"#007197",decorator:"#3760BF",enum:"#9854F1",exception:"#B15C00",functionCall:"#9854F1",interface:"#3760BF",jsxTag:"#9854F1",key:"#9854F1",keywordImport:"#B15C00",label:"#B15C00",macro:"#007197",method:"#587539",module:"#B15C00",namespace:"#3760BF",parameter:"#273153",preprocessor:"#B15C00",punctuation:"#5C6390",regex:"#587539",storageModifier:"#007197",stringEscape:"#1C2544",struct:"#9854F1",tag:"#9854F1",tagAttribute:"#3760BF",tagAttributeValue:"#587539",typeParameter:"#3760BF",url:"#007197",variableGlobal:"#9854F1",variableLocal:"#E5E6EE",variableOther:"#587539",variableProperty:"#007197"},highlights:{diffAdded:"#587539",diffAddedBackground:"#DFE7DA",diffModified:"#007197",diffModifiedBackground:"#CFD1DD",diffRemoved:"#C94060",diffRemovedBackground:"#F4DADD",lineNumber:"#AEB2BF",lineNumberActive:"#1C2544"}},markdown:{heading1:"#9854F1",heading2:"#B15C00",heading3:"#8C6C3E",heading4:"#273153",link:"#007197",linkHover:"#2E7DE9",inlineCode:"#587539",inlineCodeBackground:"#DEE0EA",blockquote:"#8C6C3E",blockquoteBorder:"#CDD0DC",listMarker:"#2E7DE999"},chat:{userMessage:"#273153",userMessageBackground:"#dcdee9",assistantMessage:"#273153",assistantMessageBackground:"#E1E2E7",timestamp:"#5C6390",divider:"#CDD0DC"},tools:{background:"#DEE0EA80",border:"#a5a8b580",headerHover:"#E9EAF1",icon:"#5C6390",title:"#273153",description:"#5C6390",edit:{added:"#587539",addedBackground:"#58753925",removed:"#C94060",removedBackground:"#C9406025",lineNumber:"#9b9ea9"}}},af={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},sf={metadata:rf,colors:nf,config:af},cf={id:"vesper-dark",name:"Vesper",description:"Vesper",version:"1.0.0",variant:"dark",tags:["dark","palette"]},df={primary:{base:"#FFC799",hover:"#DBAC84",active:"#FFCFA8",foreground:"#101010",muted:"#FFC79980",emphasis:"#DBAC84"},surface:{background:"#151515",foreground:"#e8e5e5",muted:"#1c1b1b",mutedForeground:"#848484",elevated:"#242121",elevatedForeground:"#FFFFFF",overlay:"#FFFFFF20",subtle:"#232323"},interactive:{border:"#494949",borderHover:"#202020",borderFocus:"#383838",selection:"#b1adad33",selectionForeground:"#FFFFFF",focus:"#FFC799",focusRing:"#FFC79940",cursor:"#FFFFFF",hover:"#ffffff1c",active:"#ffffff33"},status:{error:"#FF8080",errorForeground:"#101010",errorBackground:"#FF808020",errorBorder:"#FF808050",warning:"#FFC799",warningForeground:"#101010",warningBackground:"#FFC79920",warningBorder:"#FFC79950",success:"#99FFE4",successForeground:"#101010",successBackground:"#99FFE420",successBorder:"#99FFE450",info:"#FFC799",infoForeground:"#101010",infoBackground:"#FFC79920",infoBorder:"#FFC79950"},pr:{open:"#99FFE4",draft:"#A0A0A0",blocked:"#FFC799",merged:"#ca99ff",closed:"#FF8080"},syntax:{base:{background:"#141414",foreground:"#FFFFFF",comment:"#A0A0A0",keyword:"#FFC799",string:"#99FFE4",number:"#FF8080",function:"#FFC799",variable:"#FFFFFF",type:"#FFC799",operator:"#FF8080"},tokens:{boolean:"#FFC799",class:"#FFC799",className:"#FFC799",commentDoc:"#8A8A8A",constant:"#A0A0A0",decorator:"#FFC799",enum:"#FFC799",exception:"#FF8080",functionCall:"#FFC799",interface:"#FFC799",jsxTag:"#FFC799",key:"#FFC799",keywordImport:"#FF8080",label:"#FF8080",macro:"#8B8B8B",method:"#99FFE4",module:"#FF8080",namespace:"#FFC799",parameter:"#FFFFFF",preprocessor:"#FF8080",punctuation:"#A0A0A0",regex:"#99FFE4",storageModifier:"#8B8B8B",stringEscape:"#FFFFFF",struct:"#FFC799",tag:"#FFC799",tagAttribute:"#FFC799",tagAttributeValue:"#99FFE4",typeParameter:"#FFC799",url:"#A0A0A0",variableGlobal:"#FFC799",variableLocal:"#0C0C0C",variableOther:"#99FFE4",variableProperty:"#A0A0A0"},highlights:{diffAdded:"#99FFE4",diffAddedBackground:"#0D2818",diffModified:"#FFC799",diffModifiedBackground:"#141414",diffRemoved:"#FF8080",diffRemovedBackground:"#281A1A",lineNumber:"#282828",lineNumberActive:"#FFFFFF"}},markdown:{heading1:"#FFFFFF",heading2:"#FFFFFF",heading3:"#FFFFFF",heading4:"#FFFFFF",link:"#A0A0A0",linkHover:"#FFC799",inlineCode:"#bba2a2",inlineCodeBackground:"#292727",blockquote:"#FFFFFF",blockquoteBorder:"#1C1C1C",listMarker:"#FFFFFF99"},chat:{userMessage:"#FFFFFF",userMessageBackground:"#2b2a2a",assistantMessage:"#FFFFFF",assistantMessageBackground:"#101010",timestamp:"#A0A0A0",divider:"#1C1C1C"},tools:{background:"#14141480",border:"#48474780",headerHover:"#080808",icon:"#A0A0A0",title:"#FFFFFF",description:"#A0A0A0",edit:{added:"#99FFE4",addedBackground:"#99FFE425",removed:"#FF8080",removedBackground:"#FF808025",lineNumber:"#615f5f"}}},lf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},uf={metadata:cf,colors:df,config:lf},ff={id:"vesper-light",name:"Vesper",description:"Vesper",version:"1.0.0",variant:"light",tags:["light","palette"]},mf={primary:{base:"#a06535",hover:"#FFD2AD",active:"#D9A982",foreground:"#FFFFFF",muted:"#cf9c7280",emphasis:"#FFD2AD"},surface:{background:"#FFFFFF",foreground:"#101010",muted:"#F8F8F8",mutedForeground:"#6e6d6d",elevated:"#f6f5f5",elevatedForeground:"#101010",overlay:"#00000020",subtle:"#f5f3f3"},interactive:{border:"#d0cece",borderHover:"#E0E0E0",borderFocus:"#9e9e9e",selection:"#5e5b5b22",selectionForeground:"#000000",focus:"#be875b",focusRing:"#cf9c7240",cursor:"#000000",hover:"#5e5c5c22",active:"#48474722"},status:{error:"#d46868",errorForeground:"#FFFFFF",errorBackground:"#b95f5f20",errorBorder:"#b95f5f50",warning:"#cb7f40",warningForeground:"#FFFFFF",warningBackground:"#cf9c7220",warningBorder:"#cf9c7250",success:"#109b76",successForeground:"#FFFFFF",successBackground:"#99FFE420",successBorder:"#99FFE450",info:"#62bced",infoForeground:"#FFFFFF",infoBackground:"#cf9c7220",infoBorder:"#cf9c7250"},pr:{open:"#0f926f",draft:"#888787",blocked:"#bf6f2e",merged:"#9f5fc1",closed:"#c56161"},syntax:{base:{background:"#F8F8F8",foreground:"#101010",comment:"#868686",keyword:"#cf9c72",string:"#43ae91",number:"#b95f5f",function:"#cf9c72",variable:"#101010",type:"#cf9c72",operator:"#b95f5f"},tokens:{boolean:"#cf9c72",class:"#cf9c72",className:"#cf9c72",commentDoc:"#D0D0D0",constant:"#838282",decorator:"#cf9c72",enum:"#cf9c72",exception:"#b95f5f",functionCall:"#cf9c72",interface:"#cf9c72",jsxTag:"#cf9c72",key:"#cf9c72",keywordImport:"#b95f5f",label:"#b95f5f",macro:"#717070",method:"#74e8c9",module:"#b95f5f",namespace:"#cf9c72",parameter:"#101010",preprocessor:"#b95f5f",punctuation:"#717070",regex:"#67e7c5",storageModifier:"#7b7b7b",stringEscape:"#000000",struct:"#cf9c72",tag:"#cf9c72",tagAttribute:"#cf9c72",tagAttributeValue:"#6adebf",typeParameter:"#cf9c72",url:"#797878",variableGlobal:"#cf9c72",variableLocal:"#F0F0F0",variableOther:"#49dcb5",variableProperty:"#717070"},highlights:{diffAdded:"#56d8b5",diffAddedBackground:"#E8F5E8",diffModified:"#cf9c72",diffModifiedBackground:"#F0F0F0",diffRemoved:"#b95f5f",diffRemovedBackground:"#F5E8E8",lineNumber:"#D0D0D0",lineNumberActive:"#000000"}},markdown:{heading1:"#101010",heading2:"#101010",heading3:"#101010",heading4:"#101010",link:"#717070",linkHover:"#c48959",inlineCode:"#665050",inlineCodeBackground:"#f3f1f1",blockquote:"#101010",blockquoteBorder:"#E8E8E8",listMarker:"#10101099"},chat:{userMessage:"#101010",userMessageBackground:"#f4f1f1",assistantMessage:"#101010",assistantMessageBackground:"#FFFFFF",timestamp:"#717070",divider:"#E8E8E8"},tools:{background:"#F8F8F880",border:"#d0cece80",headerHover:"#E8E8E8",icon:"#717070",title:"#101010",description:"#717070",edit:{added:"#40d7af",addedBackground:"#99FFE425",removed:"#b95f5f",removedBackground:"#b95f5f25",lineNumber:"#b4b2b2"}}},gf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},pf={metadata:ff,colors:mf,config:gf},hf={id:"mono-plus-dark",name:"Mono Plus",description:"A pure monochromatic theme - dark variant with slight colors added",version:"1.0.0",variant:"dark",tags:["dark","monochrome","minimal"]},Ff={primary:{base:"#a2bee8",hover:"#E5E5E5",active:"#CCCCCC",foreground:"#000000",muted:"#FFFFFF80",emphasis:"#FFFFFF"},surface:{background:"#000000",foreground:"#E5E5E5",muted:"#0A0A0A",mutedForeground:"#808080",elevated:"#141414",elevatedForeground:"#E5E5E5",overlay:"#00000080",subtle:"#1A1A1A"},interactive:{border:"#454545",borderHover:"#333333",borderFocus:"#FFFFFF",selection:"#ffffff1f",selectionForeground:"#E5E5E5",focus:"#FFFFFF",focusRing:"#FFFFFF50",cursor:"#E5E5E5",hover:"#ffffff1f",active:"#ffffff1f"},status:{error:"#9e6a6a",errorForeground:"#0a0a0a",errorBackground:"#9e6a6a20",errorBorder:"#9e6a6a50",warning:"#9e8a6a",warningForeground:"#0a0a0a",warningBackground:"#9e8a6a20",warningBorder:"#9e8a6a50",success:"#6a8e6a",successForeground:"#0a0a0a",successBackground:"#6a8e6a20",successBorder:"#6a8e6a50",info:"#6a7e9e",infoForeground:"#0a0a0a",infoBackground:"#6a7e9e20",infoBorder:"#6a7e9e50"},pr:{open:"#6a8e6a",draft:"#8c8c8c",blocked:"#9e8a6a",merged:"#bda2e8",closed:"#9e6a6a"},syntax:{base:{background:"#0a0a0a",foreground:"#d4d4d4",comment:"#8c8c8c",keyword:"#dccdbeff",string:"#b6d8e6ff",number:"#e3bdadff",function:"#a2bee8",variable:"#d4d4d4",type:"#edcbb8ff",operator:"#dccdbeff"},tokens:{commentDoc:"#8c8c8c",stringEscape:"#b6d8e6ff",keywordImport:"#dccdbeff",storageModifier:"#dccdbeff",functionCall:"#a2bee8",method:"#a2bee8",variableProperty:"#c0dcc0ff",variableOther:"#d4d4d4",class:"#edcbb8ff",className:"#edcbb8ff",interface:"#edcbb8ff",tag:"#a2bee8",boolean:"#e3bdadff",url:"#b6d8e6ff",key:"#c0dcc0ff"},highlights:{diffAdded:"#6a8e6a",diffAddedBackground:"#6a8e6a20",diffRemoved:"#9e6a6a",diffRemovedBackground:"#9e6a6a20",lineNumber:"#7c7c7c",lineNumberActive:"#d4d4d4"}},markdown:{heading1:"#FFFFFF",heading2:"#F2F2F2",heading3:"#E5E5E5",heading4:"#D9D9D9",link:"#CCCCCC",linkHover:"#a2bee8",inlineCode:"#a2bee8",inlineCodeBackground:"#1A1A1A",blockquote:"#808080",blockquoteBorder:"#333333",listMarker:"#99999999"},chat:{userMessage:"#E5E5E5",userMessageBackground:"#1A1A1A",assistantMessage:"#E5E5E5",assistantMessageBackground:"#000000",timestamp:"#808080",divider:"#333333"},tools:{background:"#0A0A0A50",border:"#4040409d",headerHover:"#33333350",icon:"#A6A6A6",title:"#E5E5E5",description:"#808080",edit:{added:"#6a8e6a",addedBackground:"#6a8e6a20",removed:"#9e6a6a",removedBackground:"#9e6a6a20",lineNumber:"#2a2a2a"}}},yf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},bf={metadata:hf,colors:Ff,config:yf},Af={id:"mono-plus-light",name:"Mono Plus",description:"A pure monochromatic theme - light variant with slight colors added",version:"1.0.0",variant:"light",tags:["light","monochrome","minimal"]},wf={primary:{base:"#4a6a9e",hover:"#1A1A1A",active:"#333333",foreground:"#FFFFFF",muted:"#00000080",emphasis:"#000000"},surface:{background:"#FFFFFF",foreground:"#1A1A1A",muted:"#F5F5F5",mutedForeground:"#6f6f6f",elevated:"#FAFAFA",elevatedForeground:"#1A1A1A",overlay:"#00000020",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#B3B3B3",borderFocus:"#000000",selection:"#00000015",selectionForeground:"#1A1A1A",focus:"#000000",focusRing:"#00000040",cursor:"#1A1A1A",hover:"#00000010",active:"#00000015"},status:{error:"#8a5a5a",errorForeground:"#fafafa",errorBackground:"#8a5a5a18",errorBorder:"#8a5a5a40",warning:"#8a7a5a",warningForeground:"#fafafa",warningBackground:"#8a7a5a18",warningBorder:"#8a7a5a40",success:"#5a7a5a",successForeground:"#fafafa",successBackground:"#5a7a5a18",successBorder:"#5a7a5a40",info:"#5a6a8a",infoForeground:"#fafafa",infoBackground:"#5a6a8a18",infoBorder:"#5a6a8a40"},pr:{open:"#6a8e6a",draft:"#8c8c8c",blocked:"#8a7a5a",merged:"#8769b6",closed:"#8a5a5a"},syntax:{base:{background:"#f5f5f5",foreground:"#2a2a2a",comment:"#8c8c8c",keyword:"#6a5a4a",string:"#4a6a7a",number:"#7a5a4a",function:"#4a6a9e",variable:"#2a2a2a",type:"#6a5040",operator:"#6a5a4a"},tokens:{commentDoc:"#8c8c8c",stringEscape:"#4a6a7a",keywordImport:"#6a5a4a",storageModifier:"#6a5a4a",functionCall:"#4a6a9e",method:"#4a6a9e",variableProperty:"#4a6a4a",variableOther:"#2a2a2a",class:"#6a5040",className:"#6a5040",interface:"#6a5040",tag:"#4a6a9e",boolean:"#7a5a4a",url:"#4a6a7a",key:"#4a6a4a"},highlights:{diffAdded:"#5a7a5a",diffAddedBackground:"#5a7a5a18",diffRemoved:"#8a5a5a",diffRemovedBackground:"#8a5a5a18",lineNumber:"#b0b0b0",lineNumberActive:"#2a2a2a"}},markdown:{heading1:"#000000",heading2:"#0D0D0D",heading3:"#1A1A1A",heading4:"#262626",link:"#333333",linkHover:"#4a6a9e",inlineCode:"#4a6a9e",inlineCodeBackground:"#f1f1f1",blockquote:"#808080",blockquoteBorder:"#D9D9D9",listMarker:"#66666699"},chat:{userMessage:"#1A1A1A",userMessageBackground:"#E5E5E5",assistantMessage:"#1A1A1A",assistantMessageBackground:"#FFFFFF",timestamp:"#808080",divider:"#D9D9D9"},tools:{background:"#F5F5F550",border:"#B3B3B380",headerHover:"#D9D9D9",icon:"#666666",title:"#1A1A1A",description:"#808080",edit:{added:"#5a7a5a",addedBackground:"#5a7a5a18",removed:"#8a5a5a",removedBackground:"#8a5a5a18",lineNumber:"#d0d0d0"}}},Ef={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Cf={metadata:Af,colors:wf,config:Ef},Bf={id:"mono-dark",name:"Mono",description:"A pure monochromatic theme - dark variant with shades of grey",version:"1.0.0",variant:"dark",tags:["dark","monochrome","minimal","grayscale"]},Df={primary:{base:"#FFFFFF",hover:"#E5E5E5",active:"#CCCCCC",foreground:"#000000",muted:"#FFFFFF80",emphasis:"#FFFFFF"},surface:{background:"#000000",foreground:"#E5E5E5",muted:"#0A0A0A",mutedForeground:"#808080",elevated:"#141414",elevatedForeground:"#E5E5E5",overlay:"#00000080",subtle:"#1A1A1A"},interactive:{border:"#454545",borderHover:"#333333",borderFocus:"#FFFFFF",selection:"#ffffff1f",selectionForeground:"#E5E5E5",focus:"#FFFFFF",focusRing:"#FFFFFF50",cursor:"#E5E5E5",hover:"#ffffff1f",active:"#ffffff1f"},status:{error:"#666666",errorForeground:"#000000",errorBackground:"#ffffff10",errorBorder:"#ffffff20",warning:"#999999",warningForeground:"#000000",warningBackground:"#ffffff12",warningBorder:"#ffffff25",success:"#E5E5E5",successForeground:"#000000",successBackground:"#ffffff18",successBorder:"#ffffff30",info:"#A6A6A6",infoForeground:"#000000",infoBackground:"#ffffff14",infoBorder:"#ffffff28"},pr:{open:"#E5E5E5",draft:"#B3B3B3",blocked:"#999999",merged:"#CCCCCC",closed:"#666666"},syntax:{base:{background:"#0A0A0A",foreground:"#E5E5E5",comment:"#666666",keyword:"#FFFFFF",string:"#B3B3B3",number:"#999999",function:"#E5E5E5",variable:"#CCCCCC",type:"#D9D9D9",operator:"#808080"},tokens:{commentDoc:"#595959",stringEscape:"#E5E5E5",keywordImport:"#FFFFFF",storageModifier:"#E5E5E5",functionCall:"#D9D9D9",method:"#CCCCCC",variableProperty:"#B3B3B3",variableOther:"#CCCCCC",variableGlobal:"#999999",variableLocal:"#1A1A1A",parameter:"#CCCCCC",constant:"#E5E5E5",class:"#FFFFFF",className:"#FFFFFF",interface:"#D9D9D9",struct:"#E5E5E5",enum:"#E5E5E5",typeParameter:"#D9D9D9",namespace:"#CCCCCC",module:"#B3B3B3",tag:"#E5E5E5",jsxTag:"#FFFFFF",tagAttribute:"#B3B3B3",tagAttributeValue:"#999999",boolean:"#CCCCCC",decorator:"#999999",label:"#808080",punctuation:"#666666",macro:"#D9D9D9",preprocessor:"#B3B3B3",regex:"#A6A6A6",url:"#CCCCCC",key:"#E5E5E5",exception:"#999999"},highlights:{diffAdded:"#E5E5E5",diffAddedBackground:"#ffffff18",diffRemoved:"#666666",diffRemovedBackground:"#ffffff0d",diffModified:"#B3B3B3",diffModifiedBackground:"#ffffff12",lineNumber:"#404040",lineNumberActive:"#E5E5E5"}},markdown:{heading1:"#FFFFFF",heading2:"#F2F2F2",heading3:"#E5E5E5",heading4:"#D9D9D9",link:"#CCCCCC",linkHover:"#FFFFFF",inlineCode:"#B3B3B3",inlineCodeBackground:"#1A1A1A",blockquote:"#808080",blockquoteBorder:"#333333",listMarker:"#99999999"},chat:{userMessage:"#E5E5E5",userMessageBackground:"#1A1A1A",assistantMessage:"#E5E5E5",assistantMessageBackground:"#000000",timestamp:"#808080",divider:"#333333"},tools:{background:"#0A0A0A50",border:"#4040409d",headerHover:"#33333350",icon:"#A6A6A6",title:"#E5E5E5",description:"#808080",edit:{added:"#E5E5E5",addedBackground:"#ffffff20",removed:"#666666",removedBackground:"#ffffff10",lineNumber:"#404040"}}},kf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},vf={metadata:Bf,colors:Df,config:kf},Sf={id:"mono-light",name:"Mono",description:"A pure monochromatic theme - light variant with shades of grey",version:"1.0.0",variant:"light",tags:["light","monochrome","minimal","grayscale"]},Mf={primary:{base:"#000000",hover:"#1A1A1A",active:"#333333",foreground:"#FFFFFF",muted:"#00000080",emphasis:"#000000"},surface:{background:"#FFFFFF",foreground:"#1A1A1A",muted:"#F5F5F5",mutedForeground:"#757575",elevated:"#FAFAFA",elevatedForeground:"#1A1A1A",overlay:"#00000020",subtle:"#F0F0F0"},interactive:{border:"#D9D9D9",borderHover:"#B3B3B3",borderFocus:"#000000",selection:"#00000015",selectionForeground:"#1A1A1A",focus:"#000000",focusRing:"#00000040",cursor:"#1A1A1A",hover:"#00000010",active:"#00000015"},status:{error:"#999999",errorForeground:"#FFFFFF",errorBackground:"#00000008",errorBorder:"#00000015",warning:"#666666",warningForeground:"#FFFFFF",warningBackground:"#0000000a",warningBorder:"#00000018",success:"#1A1A1A",successForeground:"#FFFFFF",successBackground:"#00000012",successBorder:"#00000020",info:"#595959",infoForeground:"#FFFFFF",infoBackground:"#0000000c",infoBorder:"#0000001a"},pr:{open:"#1A1A1A",draft:"#4D4D4D",blocked:"#999999",merged:"#333333",closed:"#666666"},syntax:{base:{background:"#F5F5F5",foreground:"#1A1A1A",comment:"#999999",keyword:"#000000",string:"#4D4D4D",number:"#666666",function:"#1A1A1A",variable:"#333333",type:"#262626",operator:"#808080"},tokens:{commentDoc:"#ABABAB",stringEscape:"#1A1A1A",keywordImport:"#000000",storageModifier:"#1A1A1A",functionCall:"#262626",method:"#333333",variableProperty:"#4D4D4D",variableOther:"#333333",variableGlobal:"#666666",variableLocal:"#E5E5E5",parameter:"#333333",constant:"#1A1A1A",class:"#000000",className:"#000000",interface:"#262626",struct:"#1A1A1A",enum:"#1A1A1A",typeParameter:"#262626",namespace:"#333333",module:"#4D4D4D",tag:"#1A1A1A",jsxTag:"#000000",tagAttribute:"#4D4D4D",tagAttributeValue:"#666666",boolean:"#333333",decorator:"#666666",label:"#808080",punctuation:"#999999",macro:"#262626",preprocessor:"#4D4D4D",regex:"#595959",url:"#333333",key:"#1A1A1A",exception:"#666666"},highlights:{diffAdded:"#1A1A1A",diffAddedBackground:"#00000012",diffRemoved:"#999999",diffRemovedBackground:"#00000008",diffModified:"#595959",diffModifiedBackground:"#0000000c",lineNumber:"#CCCCCC",lineNumberActive:"#1A1A1A"}},markdown:{heading1:"#000000",heading2:"#0D0D0D",heading3:"#1A1A1A",heading4:"#262626",link:"#333333",linkHover:"#000000",inlineCode:"#4D4D4D",inlineCodeBackground:"#f1f1f1",blockquote:"#808080",blockquoteBorder:"#D9D9D9",listMarker:"#66666699"},chat:{userMessage:"#1A1A1A",userMessageBackground:"#E5E5E5",assistantMessage:"#1A1A1A",assistantMessageBackground:"#FFFFFF",timestamp:"#808080",divider:"#D9D9D9"},tools:{background:"#F5F5F550",border:"#B3B3B380",headerHover:"#D9D9D9",icon:"#666666",title:"#1A1A1A",description:"#808080",edit:{added:"#1A1A1A",addedBackground:"#00000015",removed:"#999999",removedBackground:"#0000000a",lineNumber:"#CCCCCC"}}},Tf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Pf={metadata:Sf,colors:Mf,config:Tf},Rf={id:"vitesse-dark-dark",name:"Vitesse Dark",description:"Converted from VS Code theme",version:"1.0.0",variant:"dark",tags:["dark","converted","vscode"]},If={primary:{base:"#4d9375",hover:"#4d9375",active:"#5cb08c",foreground:"#121212",muted:"#4d937580",emphasis:"#64bf98"},surface:{background:"#121212",foreground:"#dbd7caee",muted:"#171717",mutedForeground:"#c0beb99c",elevated:"#1a1a1a",elevatedForeground:"#dbd7caee",overlay:"#12121280",subtle:"#212020"},interactive:{border:"#393939",borderHover:"#3c3c3c",borderFocus:"#00000000",selection:"#eeeeee18",selectionForeground:"#dbd7caee",focus:"#00000000",focusRing:"#0000000050",cursor:"#CECDC3",hover:"#eeeeee14",active:"#eeeeee18"},status:{error:"#cb7676",errorForeground:"#121212",errorBackground:"#cb767620",errorBorder:"#cb767650",warning:"#d4976c",warningForeground:"#121212",warningBackground:"#d4976c20",warningBorder:"#d4976c50",success:"#4d9375",successForeground:"#121212",successBackground:"#4d937520",successBorder:"#4d937550",info:"#6394bf",infoForeground:"#121212",infoBackground:"#6394bf20",infoBorder:"#6394bf50"},pr:{open:"#4d9375",draft:"#747f74",blocked:"#d4976c",merged:"#6c43be",closed:"#cb7676"},syntax:{base:{background:"#121212",foreground:"#dbd7caee",comment:"#758575dd",keyword:"#4d9375",string:"#c98a7d",number:"#4C9A91",function:"#80a665",variable:"#bd976a",type:"#5d99a9",operator:"#cb7676"},tokens:{commentDoc:"#575653",stringEscape:"#dbd7caee",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#80a665",method:"#879A39",variableProperty:"#b8a965",variableOther:"#879A39",class:"#6872ab",className:"#6872ab",interface:"#5d99a9",tag:"#4d9375",boolean:"#4d9375",url:"#c98a7d",key:"#b8a965"},highlights:{diffAdded:"#4d9375",diffAddedBackground:"#4d937520",diffRemoved:"#cb7676",diffRemovedBackground:"#cb767620",lineNumber:"#dedcd550",lineNumberActive:"#bfbaaa"}},markdown:{heading1:"#4d9375",heading2:"#4d9375",heading3:"#4d9375",heading4:"#dbd7caee",link:"#4d9375",linkHover:"#4d9375",inlineCode:"#80a665",inlineCodeBackground:"#121212",blockquote:"#dedcd550",blockquoteBorder:"#ffffff15",listMarker:"#4d937599"},chat:{userMessage:"#dbd7caee",userMessageBackground:"#252525",assistantMessage:"#dbd7caee",assistantMessageBackground:"#121212",timestamp:"#dedcd550",divider:"#ffffff15"},tools:{background:"#12121250",border:"#2d2c2c",headerHover:"#ffffff1550",icon:"#dedcd5a4",title:"#dbd7caee",description:"#dedcd550",edit:{added:"#4d9375",addedBackground:"#4d937520",removed:"#cb7676",removedBackground:"#cb767620",lineNumber:"#ffffff24"}}},xf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Of={metadata:Rf,colors:If,config:xf},_f={id:"vitesse-light-light",name:"Vitesse Light",description:"Converted from VS Code theme",version:"1.0.0",variant:"light",tags:["light","converted","vscode"]},Nf={primary:{base:"#1c6b48",hover:"#1c6b48",active:"#228056",foreground:"#ffffff",muted:"#1c6b4880",emphasis:"#248b5e"},surface:{background:"#ffffff",foreground:"#2c2c28",muted:"#ecebeb",mutedForeground:"#5b5c54cb",elevated:"#f7f7f7",elevatedForeground:"#393a34",overlay:"#ffffff80",subtle:"#ecebeb"},interactive:{border:"#d4d0d0",borderHover:"#cbc7c7",borderFocus:"#635454b8",selection:"#22222218",selectionForeground:"#393a34",focus:"#00000000",focusRing:"#0000000050",cursor:"#CECDC3",hover:"#22222218",active:"#22222218"},status:{error:"#ab5959",errorForeground:"#ffffff",errorBackground:"#ab595920",errorBorder:"#ab595950",warning:"#a65e2b",warningForeground:"#ffffff",warningBackground:"#a65e2b20",warningBorder:"#a65e2b50",success:"#1e754f",successForeground:"#ffffff",successBackground:"#1e754f20",successBorder:"#1e754f50",info:"#296aa3",infoForeground:"#ffffff",infoBackground:"#296aa320",infoBorder:"#296aa350"},pr:{open:"#1e754f",draft:"#a0ada0",blocked:"#a65e2b",merged:"#5843be",closed:"#ab5959"},syntax:{base:{background:"#ffffff",foreground:"#393a34",comment:"#a0ada0",keyword:"#1e754f",string:"#b56959",number:"#2f798a",function:"#59873a",variable:"#b07d48",type:"#2e808f",operator:"#ab5959"},tokens:{commentDoc:"#575653",stringEscape:"#393a34",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#59873a",method:"#879A39",variableProperty:"#998418",variableOther:"#879A39",class:"#5a6aa6",className:"#5a6aa6",interface:"#2e808f",tag:"#1e754f",boolean:"#1e754f",url:"#b56959",key:"#998418"},highlights:{diffAdded:"#1e754f",diffAddedBackground:"#1e754f20",diffRemoved:"#ab5959",diffRemovedBackground:"#ab595920",lineNumber:"#393a3450",lineNumberActive:"#4e4f47"}},markdown:{heading1:"#2c2c28",heading2:"#2c2c28",heading3:"#2c2c28",heading4:"#2c2c28",link:"#1e754f",linkHover:"#1c6b48",inlineCode:"#3a631e",inlineCodeBackground:"#f7f3f395",blockquote:"#2c2c2850",blockquoteBorder:"#00000015",listMarker:"#1c6b4899"},chat:{userMessage:"#2c2c28",userMessageBackground:"#f4f1f1",assistantMessage:"#393a34",assistantMessageBackground:"#ffffff",timestamp:"#393a3450",divider:"#00000015"},tools:{background:"#ffffff50",border:"#dbd7d7",headerHover:"#0000001550",icon:"#21221e86",title:"#393a34",description:"#404139b6",edit:{added:"#1e754f",addedBackground:"#1e754f20",removed:"#ab5959",removedBackground:"#ab595920",lineNumber:"#b9b6b6"}}},Uf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Lf={metadata:_f,colors:Nf,config:Uf},Hf=[ds,ls,el,nl,cl,fl,hl,Al,Bl,Sl,Rl,_l,Hl,Gl,Kl,Xl,ou,su,lu,gu,yu,Eu,ku,Tu,Hu,Gu,Ku,Xu,of,sf,uf,pf,bf,Cf,vf,Pf,Of,Lf].map(e=>Ht(e)),jf={id:"flexoki-light",name:"Flexoki",description:"An inky color scheme for prose and code - light variant",version:"1.0.0",variant:"light",tags:["light","warm","natural","paper"]},zf={primary:{base:"#BC5215",hover:"#F9AE77",active:"#DA702C",foreground:"#fffdf4",muted:"#BC521580",emphasis:"#F9AE77"},surface:{background:"#fffdf4",foreground:"#100F0F",muted:"#f6f5ee",mutedForeground:"#686663",elevated:"#fbfaf2",elevatedForeground:"#100F0F",overlay:"#100F0F20",subtle:"#f7f4ec"},interactive:{border:"#DAD8CE",borderHover:"#CECDC3",borderFocus:"#BC5215",selection:"#76736f30",selectionForeground:"#100F0F",focus:"#BC5215",focusRing:"#BC521540",cursor:"#100F0F",hover:"#76736f20",active:"#76736f20"},status:{error:"#AF3029",errorForeground:"#fffdf4",errorBackground:"#D14D4120",errorBorder:"#D14D4150",warning:"#BC5215",warningForeground:"#fffdf4",warningBackground:"#DA702C20",warningBorder:"#DA702C50",success:"#66800B",successForeground:"#fffdf4",successBackground:"#879A3920",successBorder:"#879A3950",info:"#205EA6",infoForeground:"#fffdf4",infoBackground:"#4385BE20",infoBorder:"#4385BE50"},pr:{open:"#66800B",draft:"#6F6E69",blocked:"#BC5215",merged:"#5E409D",closed:"#AF3029"},syntax:{base:{background:"#f6f5ee",foreground:"#100F0F",comment:"#6F6E69",keyword:"#205EA6",string:"#24837B",number:"#5E409D",function:"#BC5215",variable:"#100F0F",type:"#AD8301",operator:"#AF3029"},tokens:{commentDoc:"#B7B5AC",stringEscape:"#100F0F",keywordImport:"#AF3029",storageModifier:"#205EA6",functionCall:"#BC5215",method:"#66800B",variableProperty:"#205EA6",variableOther:"#66800B",variableGlobal:"#A02F6F",variableLocal:"#E6E4D9",parameter:"#100F0F",constant:"#100F0F",class:"#BC5215",className:"#BC5215",interface:"#AD8301",struct:"#BC5215",enum:"#BC5215",typeParameter:"#BC5215",namespace:"#AD8301",module:"#AF3029",tag:"#205EA6",jsxTag:"#A02F6F",tagAttribute:"#AD8301",tagAttributeValue:"#24837B",boolean:"#AD8301",decorator:"#AD8301",label:"#A02F6F",punctuation:"#6F6E69",macro:"#205EA6",preprocessor:"#A02F6F",regex:"#24837B",url:"#205EA6",key:"#BC5215",exception:"#A02F6F"},highlights:{diffAdded:"#66800B",diffAddedBackground:"#879A3920",diffRemoved:"#AF3029",diffRemovedBackground:"#D14D4120",diffModified:"#205EA6",diffModifiedBackground:"#4385BE20",lineNumber:"#CECDC3",lineNumberActive:"#100F0F"}},markdown:{heading1:"#100F0F",heading2:"#100F0F",heading3:"#100F0F",heading4:"#100F0F",link:"#205EA6",linkHover:"#4385BE",inlineCode:"#24837B",inlineCodeBackground:"#f6f5ee",blockquote:"#6F6E69",blockquoteBorder:"#DAD8CE",listMarker:"#AD830199"},chat:{userMessage:"#100F0F",userMessageBackground:"#f7f4ec",assistantMessage:"#100F0F",assistantMessageBackground:"#fffdf4",timestamp:"#6F6E69",divider:"#DAD8CE"},tools:{background:"#f6f5ee50",border:"#b4b2a980",headerHover:"#DAD8CE",icon:"#6F6E69",title:"#100F0F",description:"#6F6E69",edit:{added:"#66800B",addedBackground:"#66800B25",removed:"#AF3029",removedBackground:"#AF302925",lineNumber:"#CECDC3"}}},$f={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Gf={metadata:jf,colors:zf,config:$f},qf={id:"flexoki-dark",name:"Flexoki",description:"An inky color scheme for prose and code - dark variant",version:"1.0.0",variant:"dark",tags:["dark","warm","natural","ink"]},Wf={primary:{base:"#DA702C",hover:"#DA702C",active:"#F9AE77",foreground:"#171515",muted:"#DA702C80",emphasis:"#F9AE77"},surface:{background:"#171515",foreground:"#CECDC3",muted:"#1C1B1A",mutedForeground:"#807e79",elevated:"#1c1a19",elevatedForeground:"#CECDC3",overlay:"#00000080",subtle:"#1e1d1c"},interactive:{border:"#343331",borderHover:"#403E3C",borderFocus:"#DA702C",selection:"#f4f4f41f",selectionForeground:"#CECDC3",focus:"#DA702C",focusRing:"#DA702C50",cursor:"#CECDC3",hover:"#ffffff18",active:"#ffffff1f"},status:{error:"#D14D41",errorForeground:"#171515",errorBackground:"#AF302920",errorBorder:"#AF302950",warning:"#DA702C",warningForeground:"#171515",warningBackground:"#BC521520",warningBorder:"#BC521550",success:"#A0AF54",successForeground:"#171515",successBackground:"#66800B20",successBorder:"#66800B50",info:"#4385BE",infoForeground:"#171515",infoBackground:"#205EA620",infoBorder:"#205EA650"},pr:{open:"#A0AF54",draft:"#878580",blocked:"#DA702C",merged:"#8B7EC8",closed:"#D14D41"},syntax:{base:{background:"#1C1B1A",foreground:"#CECDC3",comment:"#878580",keyword:"#4385BE",string:"#3AA99F",number:"#8B7EC8",function:"#DA702C",variable:"#CECDC3",type:"#D0A215",operator:"#D14D41"},tokens:{commentDoc:"#575653",stringEscape:"#CECDC3",keywordImport:"#D14D41",storageModifier:"#4385BE",functionCall:"#DA702C",method:"#879A39",variableProperty:"#4385BE",variableOther:"#879A39",variableGlobal:"#CE5D97",variableLocal:"#282726",parameter:"#CECDC3",constant:"#CECDC3",class:"#DA702C",className:"#DA702C",interface:"#D0A215",struct:"#DA702C",enum:"#DA702C",typeParameter:"#DA702C",namespace:"#D0A215",module:"#D14D41",tag:"#4385BE",jsxTag:"#CE5D97",tagAttribute:"#D0A215",tagAttributeValue:"#3AA99F",boolean:"#D0A215",decorator:"#D0A215",label:"#CE5D97",punctuation:"#878580",macro:"#4385BE",preprocessor:"#CE5D97",regex:"#3AA99F",url:"#4385BE",key:"#DA702C",exception:"#CE5D97"},highlights:{diffAdded:"#879A39",diffAddedBackground:"#66800B20",diffRemoved:"#D14D41",diffRemovedBackground:"#AF302920",diffModified:"#4385BE",diffModifiedBackground:"#205EA620",lineNumber:"#403E3C",lineNumberActive:"#CECDC3"}},markdown:{heading1:"#fbf9e6",heading2:"#e6e4d2",heading3:"#CECDC3",heading4:"#CECDC3",link:"#4385BE",linkHover:"#205EA6",inlineCode:"#A0AF53",inlineCodeBackground:"#1C1B1A",blockquote:"#878580",blockquoteBorder:"#343331",listMarker:"#D0A21599"},chat:{userMessage:"#CECDC3",userMessageBackground:"#27180E",assistantMessage:"#CECDC3",assistantMessageBackground:"#171515",timestamp:"#878580",divider:"#343331"},tools:{background:"#1C1B1A50",border:"#42403e9d",headerHover:"#34333150",icon:"#aca7a1",title:"#CECDC3",description:"#878580",edit:{added:"#879A39",addedBackground:"#66800B25",removed:"#D14D41",removedBackground:"#AF302925",lineNumber:"#403E3C"}}},Vf={fonts:{sans:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',mono:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace',heading:'ui-monospace, "SFMono-Regular", "Menlo", "Cascadia Mono", "Segoe UI Mono", monospace'},transitions:{fast:"150ms ease",normal:"250ms ease",slow:"350ms ease"}},Kf={metadata:qf,colors:Wf,config:Vf},us=Ht(Gf),Jf=Ht(Kf),Yf=Ht(ls),Qf=Ht(ds),fs="flexoki-light",ms="flexoki-dark",dr=[Yf,Qf,us,Jf,...Hf.filter(e=>e.metadata.id!=="openchamber-light"&&e.metadata.id!=="openchamber-dark")];function Xf(e){const t=e==="app-light"?"flexoki-light":e==="app-dark"?"flexoki-dark":e;return dr.find(o=>o.metadata.id===t)}function Oh(e){const t=e?"dark":"light",r=Xf(e?ms:fs);return r&&r.metadata.variant===t?r:dr.find(n=>n.metadata.variant===t)??dr[0]??us}const Zf=[{id:"finder",label:"Finder",appName:"Finder"},{id:"terminal",label:"Terminal",appName:"Terminal"},{id:"iterm2",label:"iTerm2",appName:"iTerm"},{id:"ghostty",label:"Ghostty",appName:"Ghostty"},{id:"vscode",label:"VS Code",appName:"Visual Studio Code"},{id:"vscode-insiders",label:"VS Code Insiders",appName:"Visual Studio Code - Insiders"},{id:"intellij",label:"IntelliJ",appName:"IntelliJ IDEA"},{id:"visual-studio",label:"Visual Studio",appName:"Visual Studio"},{id:"cursor",label:"Cursor",appName:"Cursor"},{id:"android-studio",label:"Android Studio",appName:"Android Studio"},{id:"pycharm",label:"PyCharm",appName:"PyCharm"},{id:"xcode",label:"Xcode",appName:"Xcode"},{id:"sublime-text",label:"Sublime",appName:"Sublime Text"},{id:"webstorm",label:"WebStorm",appName:"WebStorm"},{id:"rider",label:"Rider",appName:"Rider"},{id:"zed",label:"Zed",appName:"Zed"},{id:"phpstorm",label:"PhpStorm",appName:"PhpStorm"},{id:"eclipse",label:"Eclipse",appName:"Eclipse"},{id:"windsurf",label:"Windsurf",appName:"Windsurf"},{id:"vscodium",label:"VSCodium",appName:"VSCodium"},{id:"rustrover",label:"RustRover",appName:"RustRover"},{id:"kiro",label:"Kiro",appName:"Kiro"},{id:"antigravity",label:"Antigravity",appName:"Antigravity"},{id:"trae",label:"Trae",appName:"Trae"}],em="finder",_h=new Set(["finder","terminal"]),tm=e=>{if(typeof window>"u")return e;const t=window.__OPENCHAMBER_PLATFORM__;if(e.id==="finder"){if(t==="win32")return{...e,label:"Explorer",appName:"File Explorer"};if(t==="linux")return{...e,label:"File Manager"}}return e},Nh=e=>{if(!e)return null;const t=Zf.find(o=>o.id===e)??null;return t?tm(t):null},om=e=>{if(!(typeof window>"u")&&!(typeof window.__OPENCHAMBER_HOME__=="string"&&window.__OPENCHAMBER_HOME__.length>0))try{window.__OPENCHAMBER_HOME__=e}catch{}},Un="openchamber.settingsMirror.v2.index",rm="openchamber.settingsMirror.v2:",nm=5,Ln=e=>`${rm}${encodeURIComponent(e)}`,ue=(e,t)=>{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)},am=(e,t)=>{const o={themeId:e.themeId,themeVariant:e.themeVariant,lightThemeId:e.lightThemeId,darkThemeId:e.darkThemeId,useSystemTheme:e.useSystemTheme,lastDirectory:e.lastDirectory,homeDirectory:e.homeDirectory,projects:e.projects,activeProjectId:e.activeProjectId,pinnedDirectories:e.pinnedDirectories,gitmojiEnabled:e.gitmojiEnabled,directoryShowHidden:e.directoryShowHidden,filesViewShowGitignored:e.filesViewShowGitignored,openInAppId:e.openInAppId,pwaAppName:e.pwaAppName,mobileKeyboardMode:e.mobileKeyboardMode,openCodeUpdateToastDismissedVersion:e.openCodeUpdateToastDismissedVersion,dictationEnabled:e.dictationEnabled,sttProvider:e.sttProvider,sttServerUrl:e.sttServerUrl,sttModel:e.sttModel,sttLocalModel:e.sttLocalModel,sttLanguage:e.sttLanguage};localStorage.setItem(Ln(t),JSON.stringify(o));let r=[];try{const a=JSON.parse(localStorage.getItem(Un)??"[]");Array.isArray(a)&&(r=a.filter(s=>typeof s=="string"))}catch{r=[]}const n=[t,...r.filter(a=>a!==t)].slice(0,nm);for(const a of r)n.includes(a)||localStorage.removeItem(Ln(a));localStorage.setItem(Un,JSON.stringify(n))},sm=e=>{if(!(typeof window>"u")){if(am(e,L()),ue("selectedThemeId",e.themeId||null),ue("selectedThemeVariant",e.themeVariant||null),ue("lightThemeId",e.lightThemeId||null),ue("darkThemeId",e.darkThemeId||null),ue("useSystemTheme",typeof e.useSystemTheme=="boolean"?String(e.useSystemTheme):null),ue("lastDirectory",e.lastDirectory||null),e.homeDirectory?(localStorage.setItem("homeDirectory",e.homeDirectory),om(e.homeDirectory)):localStorage.removeItem("homeDirectory"),Array.isArray(e.projects)&&e.projects.length>0?localStorage.setItem("projects",JSON.stringify(e.projects)):localStorage.removeItem("projects"),e.activeProjectId?localStorage.setItem("activeProjectId",e.activeProjectId):localStorage.removeItem("activeProjectId"),Array.isArray(e.pinnedDirectories)&&e.pinnedDirectories.length>0?localStorage.setItem("pinnedDirectories",JSON.stringify(e.pinnedDirectories)):localStorage.removeItem("pinnedDirectories"),Array.isArray(e.projects)&&e.projects.length>0){const t=e.projects.filter(o=>o.sidebarCollapsed===!0).map(o=>o.id).filter(o=>typeof o=="string"&&o.length>0);t.length>0?localStorage.setItem("oc.sessions.projectCollapse",JSON.stringify(t)):localStorage.removeItem("oc.sessions.projectCollapse")}else localStorage.removeItem("oc.sessions.projectCollapse");if(typeof e.gitmojiEnabled=="boolean"?localStorage.setItem("gitmojiEnabled",String(e.gitmojiEnabled)):localStorage.removeItem("gitmojiEnabled"),typeof e.directoryShowHidden=="boolean"?localStorage.setItem("directoryTreeShowHidden",e.directoryShowHidden?"true":"false"):localStorage.removeItem("directoryTreeShowHidden"),typeof e.filesViewShowGitignored=="boolean"?localStorage.setItem("filesViewShowGitignored",e.filesViewShowGitignored?"true":"false"):localStorage.removeItem("filesViewShowGitignored"),ue("openInAppId",typeof e.openInAppId=="string"&&e.openInAppId.length>0?e.openInAppId:null),typeof e.pwaAppName=="string"){const t=e.pwaAppName.trim().replace(/\s+/g," ").slice(0,64);t.length>0?localStorage.setItem("openchamber.pwaName",t):localStorage.removeItem("openchamber.pwaName")}else localStorage.removeItem("openchamber.pwaName");if(Qa(e.mobileKeyboardMode),typeof e.openCodeUpdateToastDismissedVersion=="string"){const t=e.openCodeUpdateToastDismissedVersion.trim();t?localStorage.setItem("opencode-update-toast-dismissed-version",t):localStorage.removeItem("opencode-update-toast-dismissed-version")}else localStorage.removeItem("opencode-update-toast-dismissed-version");typeof e.dictationEnabled=="boolean"?localStorage.setItem("dictationEnabled",String(e.dictationEnabled)):localStorage.removeItem("dictationEnabled"),e.sttProvider==="local"||e.sttProvider==="openai-compatible"?localStorage.setItem("sttProvider",e.sttProvider):localStorage.removeItem("sttProvider"),ue("sttServerUrl",typeof e.sttServerUrl=="string"?e.sttServerUrl:null),ue("sttModel",typeof e.sttModel=="string"?e.sttModel:null),ue("sttLocalModel",typeof e.sttLocalModel=="string"?e.sttLocalModel:null),ue("sttLanguage",typeof e.sttLanguage=="string"?e.sttLanguage:null)}},lr=e=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("openchamber:settings-synced",{detail:e}))};let ur="idle",Xt=null;const fr=new Set,Uh=()=>ur,Lh=e=>(fr.add(e),()=>fr.delete(e)),Hh=e=>{Be(e)},Be=e=>{Xt&&(clearTimeout(Xt),Xt=null);const t=e==="saved"?"idle":e;t!==ur&&(ur=t,fr.forEach(o=>o())),t==="error"&&(Xt=setTimeout(()=>Be("saved"),6e3)),!(typeof window>"u")&&window.dispatchEvent(new CustomEvent("openchamber:settings-save-state",{detail:e}))},im=e=>{if(!Array.isArray(e))return;const t=[],o=new Set;for(const r of e){if(!r||typeof r!="object")continue;const n=r,a=typeof n.id=="string"?n.id.trim():"",s=typeof n.label=="string"?n.label.trim():"",i=typeof n.source=="string"?n.source.trim():"",c=typeof n.subpath=="string"?n.subpath.trim():"",d=typeof n.gitIdentityId=="string"?n.gitIdentityId.trim():"";!a||!s||!i||o.has(a)||(o.add(a),t.push({id:a,label:s,source:i,...c?{subpath:c}:{},...d?{gitIdentityId:d}:{}}))}return t},cm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[o,r]of Object.entries(e)){const n=typeof o=="string"?o.trim():"",a=typeof r=="string"?r.trim():"";!n||!a||(t[n]=a)}return t},dm=(e,t)=>{const o=Object.entries(e),r=Object.entries(t);return o.length!==r.length?!1:o.every(([n,a])=>t[n]===a)},Yo=(e,t)=>e.length===t.length&&e.every((o,r)=>o.providerID===t[r]?.providerID&&o.modelID===t[r]?.modelID),mr=(e,t)=>e.length===t.length&&e.every((o,r)=>o===t[r]),gr=e=>{if(Array.isArray(e))return Array.from(new Set(e.filter(t=>typeof t=="string"&&t.length>0)))},lm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[o,r]of Object.entries(e)){if(!o||!Array.isArray(r))continue;const n=gr(r);n&&n.length>0&&(t[o]=n.slice(0,5))}return Object.keys(t).length>0?t:void 0},um=(e,t)=>{const o=Object.keys(e);return o.length!==Object.keys(t).length?!1:o.every(r=>Array.isArray(t[r])&&mr(e[r],t[r]))},fm=/^#(?:[\da-fA-F]{3}|[\da-fA-F]{6})$/,mm=e=>{if(typeof e!="string")return null;const t=e.trim();return t&&fm.test(t)?t.toLowerCase():null},gm=e=>{if(!Array.isArray(e))return;const t=[],o=new Set,r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.path=="string"?a.path.trim():"";if(!s)continue;const i=s==="/"?s:s.replace(/\\/g,"/").replace(/\/+$/,"");if(!i)continue;const c=id(i);if(!c||o.has(c)||r.has(i))continue;o.add(c),r.add(i);const d={id:c,path:i};if(typeof a.label=="string"&&a.label.trim().length>0&&(d.label=a.label.trim()),typeof a.icon=="string"&&a.icon.trim().length>0&&(d.icon=a.icon.trim()),a.iconImage===null)d.iconImage=null;else if(a.iconImage&&typeof a.iconImage=="object"){const l=a.iconImage,u=typeof l.mime=="string"?l.mime.trim():"",m=typeof l.updatedAt=="number"&&Number.isFinite(l.updatedAt)?Math.max(0,Math.round(l.updatedAt)):0,g=l.source==="custom"||l.source==="auto"?l.source:null;u&&m>0&&g&&(d.iconImage={mime:u,updatedAt:m,source:g})}if(typeof a.color=="string"&&a.color.trim().length>0&&(d.color=a.color.trim()),a.iconBackground===null)d.iconBackground=null;else{const l=mm(a.iconBackground);l&&(d.iconBackground=l)}typeof a.addedAt=="number"&&Number.isFinite(a.addedAt)&&a.addedAt>=0&&(d.addedAt=a.addedAt),typeof a.lastOpenedAt=="number"&&Number.isFinite(a.lastOpenedAt)&&a.lastOpenedAt>=0&&(d.lastOpenedAt=a.lastOpenedAt),typeof a.sidebarCollapsed=="boolean"&&(d.sidebarCollapsed=a.sidebarCollapsed),t.push(d)}return t.length>0?t:void 0},pm=e=>{if(!Array.isArray(e))return;const t=[],o=new Set,r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.id=="string"?a.id.trim():"",i=typeof a.name=="string"?a.name.trim():"",c=typeof a.hostname=="string"?a.hostname.trim().toLowerCase():"";!s||!i||!c||o.has(s)||r.has(c)||(o.add(s),r.add(c),t.push({id:s,name:i,hostname:c}))}return t},hm=e=>{if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,o={};for(const[r,n]of Object.entries(t)){const a=r.trim(),s=typeof n=="string"?n.trim():"";!a||!s||(o[a]=s)}return Object.keys(o).length>0?o:void 0},Qo=(e,t)=>{if(!Array.isArray(e))return;const o=[],r=new Set;for(const n of e){if(!n||typeof n!="object")continue;const a=n,s=typeof a.providerID=="string"?a.providerID.trim():"",i=typeof a.modelID=="string"?a.modelID.trim():"";if(!s||!i)continue;const c=`${s}/${i}`;if(!r.has(c)&&(r.add(c),o.push({providerID:s,modelID:i}),o.length>=t))break}return o},gs=()=>{const e=ie.persist;if(e&&typeof e=="object")return e},ps=()=>Bo()?.settings??null,Fm=e=>{const t=ie.getInitialState();return{useSystemTheme:!0,lightThemeId:fs,darkThemeId:ms,openInAppId:em,showReasoningTraces:t.showReasoningTraces,sessionRecapEnabled:t.sessionRecapEnabled,sessionSuggestionEnabled:t.sessionSuggestionEnabled,sessionGoalEnabled:t.sessionGoalEnabled,sessionGoalDefaultBudgetEnabled:t.sessionGoalDefaultBudgetEnabled,sessionGoalDefaultBudget:t.sessionGoalDefaultBudget,collapsibleThinkingBlocks:t.collapsibleThinkingBlocks,autoDeleteEnabled:t.autoDeleteEnabled,autoDeleteAfterDays:t.autoDeleteAfterDays,sessionRetentionAction:t.sessionRetentionAction,followUpBehavior:jr,showDeletionDialog:t.showDeletionDialog,nativeNotificationsEnabled:t.nativeNotificationsEnabled,notificationMode:t.notificationMode,notifyOnSubtasks:t.notifyOnSubtasks,notifyOnCompletion:t.notifyOnCompletion,notifyOnError:t.notifyOnError,notifyOnQuestion:t.notifyOnQuestion,notificationTemplates:t.notificationTemplates,summarizeLastMessage:t.summarizeLastMessage,summaryThreshold:t.summaryThreshold,summaryLength:t.summaryLength,maxLastMessageLength:t.maxLastMessageLength,inputSpellcheckEnabled:t.inputSpellcheckEnabled,showOpenCodeUpdateNotifications:t.showOpenCodeUpdateNotifications,agentControlToolEnabled:t.agentControlToolEnabled,showToolFileIcons:t.showToolFileIcons,codeBlockLineWrap:t.codeBlockLineWrap,showTurnChangedFiles:t.showTurnChangedFiles,showExpandedBashTools:t.showExpandedBashTools,showExpandedEditTools:t.showExpandedEditTools,timeFormatPreference:t.timeFormatPreference,weekStartPreference:t.weekStartPreference,desktopWindowControlsPosition:t.desktopWindowControlsPosition,chatRenderMode:t.chatRenderMode,activityRenderMode:t.activityRenderMode,mermaidRenderingMode:t.mermaidRenderingMode,userMessageRenderingMode:t.userMessageRenderingMode,collapsibleUserMessages:t.collapsibleUserMessages,messageStreamTransport:"auto",stickyUserHeader:t.stickyUserHeader,promptNavigatorEnabled:t.promptNavigatorEnabled,expandedEditorToolbar:t.expandedEditorToolbar,wideChatLayoutEnabled:t.wideChatLayoutEnabled,showSplitAssistantMessageActions:t.showSplitAssistantMessageActions,draftStartersVisible:t.draftStartersVisible,reportUsage:t.reportUsage,fontSize:t.fontSize,terminalFontSize:t.terminalFontSize,terminalShell:t.terminalShell,terminalLoginShells:t.terminalLoginShells,editorFontSize:t.editorFontSize,uiFont:t.uiFont,monoFont:t.monoFont,padding:t.padding,cornerRadius:t.cornerRadius,inputBarOffset:t.inputBarOffset,shortcutOverrides:t.shortcutOverrides,mobileKeyboardMode:"resize-content",favoriteModels:t.favoriteModels,hiddenModels:t.hiddenModels,collapsedModelProviders:t.collapsedModelProviders,recentModels:t.recentModels,recentAgents:t.recentAgents,recentEfforts:t.recentEfforts,diffLayoutPreference:t.diffLayoutPreference,gitChangesViewMode:t.gitChangesViewMode,directoryShowHidden:!0,filesViewShowGitignored:!1,dictationEnabled:!0,sttProvider:"local",sttServerUrl:"http://localhost:8001/v1",sttModel:"deepdml/faster-whisper-large-v3-turbo-ct2",sttLocalModel:"parakeet-tdt-0.6b-v2-int8",sttLanguage:"",...e}},pr=e=>{const t=ie.getState(),o=typeof window<"u"?window.__zustand_config_store__?.getState?.()??null:null,r=typeof window<"u"?window.__zustand_config_store__??null:null,n=Nd.getState();if(typeof e.showReasoningTraces=="boolean"&&e.showReasoningTraces!==t.showReasoningTraces&&t.setShowReasoningTraces(e.showReasoningTraces),typeof e.sessionRecapEnabled=="boolean"&&e.sessionRecapEnabled!==t.sessionRecapEnabled&&t.setSessionRecapEnabled(e.sessionRecapEnabled),typeof e.sessionSuggestionEnabled=="boolean"&&e.sessionSuggestionEnabled!==t.sessionSuggestionEnabled&&t.setSessionSuggestionEnabled(e.sessionSuggestionEnabled),typeof e.sessionGoalEnabled=="boolean"&&e.sessionGoalEnabled!==t.sessionGoalEnabled&&t.setSessionGoalEnabled(e.sessionGoalEnabled),typeof e.sessionGoalDefaultBudgetEnabled=="boolean"&&e.sessionGoalDefaultBudgetEnabled!==t.sessionGoalDefaultBudgetEnabled&&t.setSessionGoalDefaultBudgetEnabled(e.sessionGoalDefaultBudgetEnabled),typeof e.sessionGoalDefaultBudget=="number"&&Number.isFinite(e.sessionGoalDefaultBudget)&&e.sessionGoalDefaultBudget!==t.sessionGoalDefaultBudget&&t.setSessionGoalDefaultBudget(e.sessionGoalDefaultBudget),typeof e.collapsibleThinkingBlocks=="boolean"&&e.collapsibleThinkingBlocks!==t.collapsibleThinkingBlocks&&t.setCollapsibleThinkingBlocks(e.collapsibleThinkingBlocks),typeof e.autoDeleteEnabled=="boolean"&&e.autoDeleteEnabled!==t.autoDeleteEnabled&&t.setAutoDeleteEnabled(e.autoDeleteEnabled),typeof e.autoDeleteAfterDays=="number"&&Number.isFinite(e.autoDeleteAfterDays)){const s=Math.max(1,Math.min(365,e.autoDeleteAfterDays));s!==t.autoDeleteAfterDays&&t.setAutoDeleteAfterDays(s)}(e.sessionRetentionAction==="archive"||e.sessionRetentionAction==="delete")&&e.sessionRetentionAction!==t.sessionRetentionAction&&t.setSessionRetentionAction(e.sessionRetentionAction);let a=null;if(zr(e.followUpBehavior)?a=e.followUpBehavior:typeof e.queueModeEnabled=="boolean"&&(a=$r(void 0,e.queueModeEnabled)),a&&a!==n.followUpBehavior&&n.setFollowUpBehavior(a),typeof e.showDeletionDialog=="boolean"&&e.showDeletionDialog!==t.showDeletionDialog&&t.setShowDeletionDialog(e.showDeletionDialog),typeof e.nativeNotificationsEnabled=="boolean"&&e.nativeNotificationsEnabled!==t.nativeNotificationsEnabled&&t.setNativeNotificationsEnabled(e.nativeNotificationsEnabled),typeof e.notificationMode=="string"&&(e.notificationMode==="always"||e.notificationMode==="hidden-only")&&e.notificationMode!==t.notificationMode&&t.setNotificationMode(e.notificationMode),typeof e.notifyOnSubtasks=="boolean"&&e.notifyOnSubtasks!==t.notifyOnSubtasks&&t.setNotifyOnSubtasks(e.notifyOnSubtasks),typeof e.notifyOnCompletion=="boolean"&&e.notifyOnCompletion!==t.notifyOnCompletion&&t.setNotifyOnCompletion(e.notifyOnCompletion),typeof e.notifyOnError=="boolean"&&e.notifyOnError!==t.notifyOnError&&t.setNotifyOnError(e.notifyOnError),typeof e.notifyOnQuestion=="boolean"&&e.notifyOnQuestion!==t.notifyOnQuestion&&t.setNotifyOnQuestion(e.notifyOnQuestion),e.notificationTemplates&&typeof e.notificationTemplates=="object"&&t.setNotificationTemplates(e.notificationTemplates),typeof e.summarizeLastMessage=="boolean"&&e.summarizeLastMessage!==t.summarizeLastMessage&&t.setSummarizeLastMessage(e.summarizeLastMessage),typeof e.summaryThreshold=="number"&&Number.isFinite(e.summaryThreshold)&&t.setSummaryThreshold(e.summaryThreshold),typeof e.summaryLength=="number"&&Number.isFinite(e.summaryLength)&&t.setSummaryLength(e.summaryLength),typeof e.maxLastMessageLength=="number"&&Number.isFinite(e.maxLastMessageLength)&&t.setMaxLastMessageLength(e.maxLastMessageLength),typeof e.inputSpellcheckEnabled=="boolean"&&e.inputSpellcheckEnabled!==t.inputSpellcheckEnabled&&t.setInputSpellcheckEnabled(e.inputSpellcheckEnabled),typeof e.showOpenCodeUpdateNotifications=="boolean"&&e.showOpenCodeUpdateNotifications!==t.showOpenCodeUpdateNotifications&&t.setShowOpenCodeUpdateNotifications(e.showOpenCodeUpdateNotifications),typeof e.agentControlToolEnabled=="boolean"&&e.agentControlToolEnabled!==t.agentControlToolEnabled&&t.setAgentControlToolEnabled(e.agentControlToolEnabled),typeof e.showToolFileIcons=="boolean"&&e.showToolFileIcons!==t.showToolFileIcons&&t.setShowToolFileIcons(e.showToolFileIcons),typeof e.codeBlockLineWrap=="boolean"&&e.codeBlockLineWrap!==t.codeBlockLineWrap&&t.setCodeBlockLineWrap(e.codeBlockLineWrap),typeof e.showTurnChangedFiles=="boolean"&&e.showTurnChangedFiles!==t.showTurnChangedFiles&&t.setShowTurnChangedFiles(e.showTurnChangedFiles),typeof e.showExpandedBashTools=="boolean"&&e.showExpandedBashTools!==t.showExpandedBashTools&&t.setShowExpandedBashTools(e.showExpandedBashTools),typeof e.showExpandedEditTools=="boolean"&&e.showExpandedEditTools!==t.showExpandedEditTools&&t.setShowExpandedEditTools(e.showExpandedEditTools),typeof e.timeFormatPreference=="string"&&(e.timeFormatPreference==="auto"||e.timeFormatPreference==="12h"||e.timeFormatPreference==="24h")&&e.timeFormatPreference!==t.timeFormatPreference&&t.setTimeFormatPreference(e.timeFormatPreference),typeof e.weekStartPreference=="string"&&(e.weekStartPreference==="auto"||e.weekStartPreference==="sunday"||e.weekStartPreference==="monday")&&e.weekStartPreference!==t.weekStartPreference&&t.setWeekStartPreference(e.weekStartPreference),typeof e.desktopWindowControlsPosition=="string"){const s=e.desktopWindowControlsPosition==="left"?"left":e.desktopWindowControlsPosition==="right"||e.desktopWindowControlsPosition==="auto"?"right":null;s&&s!==t.desktopWindowControlsPosition&&t.setDesktopWindowControlsPosition(s)}if(typeof e.chatRenderMode=="string"&&(e.chatRenderMode==="sorted"||e.chatRenderMode==="live")&&e.chatRenderMode!==t.chatRenderMode&&t.setChatRenderMode(e.chatRenderMode),typeof e.activityRenderMode=="string"&&(e.activityRenderMode==="collapsed"||e.activityRenderMode==="summary")&&e.activityRenderMode!==t.activityRenderMode&&t.setActivityRenderMode(e.activityRenderMode),typeof e.mermaidRenderingMode=="string"&&(e.mermaidRenderingMode==="svg"||e.mermaidRenderingMode==="ascii")&&e.mermaidRenderingMode!==t.mermaidRenderingMode&&t.setMermaidRenderingMode(e.mermaidRenderingMode),typeof e.userMessageRenderingMode=="string"&&(e.userMessageRenderingMode==="markdown"||e.userMessageRenderingMode==="plain")&&e.userMessageRenderingMode!==t.userMessageRenderingMode&&t.setUserMessageRenderingMode(e.userMessageRenderingMode),typeof e.collapsibleUserMessages=="boolean"&&e.collapsibleUserMessages!==t.collapsibleUserMessages&&t.setCollapsibleUserMessages(e.collapsibleUserMessages),typeof e.messageStreamTransport=="string"&&(e.messageStreamTransport==="auto"||e.messageStreamTransport==="ws"||e.messageStreamTransport==="sse")&&o&&e.messageStreamTransport!==o.settingsMessageStreamTransport&&o.setSettingsMessageStreamTransport(e.messageStreamTransport),typeof e.stickyUserHeader=="boolean"&&e.stickyUserHeader!==t.stickyUserHeader&&t.setStickyUserHeader(e.stickyUserHeader),typeof e.promptNavigatorEnabled=="boolean"&&e.promptNavigatorEnabled!==t.promptNavigatorEnabled&&t.setPromptNavigatorEnabled(e.promptNavigatorEnabled),typeof e.expandedEditorToolbar=="boolean"&&e.expandedEditorToolbar!==t.expandedEditorToolbar&&t.setExpandedEditorToolbar(e.expandedEditorToolbar),typeof e.wideChatLayoutEnabled=="boolean"&&e.wideChatLayoutEnabled!==t.wideChatLayoutEnabled&&t.setWideChatLayoutEnabled(e.wideChatLayoutEnabled),typeof e.showSplitAssistantMessageActions=="boolean"&&e.showSplitAssistantMessageActions!==t.showSplitAssistantMessageActions&&t.setShowSplitAssistantMessageActions(e.showSplitAssistantMessageActions),typeof e.reportUsage=="boolean"&&e.reportUsage!==t.reportUsage&&t.setReportUsage(e.reportUsage),typeof e.fontSize=="number"&&Number.isFinite(e.fontSize)&&e.fontSize!==t.fontSize&&t.setFontSize(e.fontSize),Array.isArray(e.draftStarters)){let s=cs(e.draftStarters);if(e.draftStartersCraftGoalAdded!==!0&&!s.some(i=>i.type==="command"&&i.name==="craft-goal")){const i=s.findIndex(d=>d.type==="command"&&d.name==="plan-feature"),c=i>=0?i+1:s.length;s=[...s.slice(0,c),{type:"command",name:"craft-goal"},...s.slice(c)]}if(e.draftStartersScheduleTaskAdded!==!0&&!s.some(i=>i.type==="command"&&i.name==="schedule-task")){const i=s.findIndex(d=>d.type==="command"&&d.name==="craft-goal"),c=i>=0?i+1:s.length;s=[...s.slice(0,c),{type:"command",name:"schedule-task"},...s.slice(c)]}JSON.stringify(t.globalDraftStarters)!==JSON.stringify(s)&&t.setGlobalDraftStarters(s),(e.draftStartersCraftGoalAdded!==!0||e.draftStartersScheduleTaskAdded!==!0)&&(e.draftStarters=s,e.draftStartersCraftGoalAdded=!0,e.draftStartersScheduleTaskAdded=!0)}else e.draftStartersCraftGoalAdded!==!0&&(e.draftStartersCraftGoalAdded=!0),e.draftStartersScheduleTaskAdded!==!0&&(e.draftStartersScheduleTaskAdded=!0);if(typeof e.draftStartersVisible=="boolean"&&e.draftStartersVisible!==t.draftStartersVisible&&t.setDraftStartersVisible(e.draftStartersVisible),typeof e.terminalFontSize=="number"&&Number.isFinite(e.terminalFontSize)&&e.terminalFontSize!==t.terminalFontSize&&t.setTerminalFontSize(e.terminalFontSize),po(e.terminalShell)&&e.terminalShell!==t.terminalShell&&t.setTerminalShell(e.terminalShell),Array.isArray(e.terminalLoginShells)&&(e.terminalLoginShells.length!==t.terminalLoginShells.length||e.terminalLoginShells.some((s,i)=>s!==t.terminalLoginShells[i]))&&t.setTerminalLoginShells(e.terminalLoginShells),typeof e.editorFontSize=="number"&&Number.isFinite(e.editorFontSize)&&e.editorFontSize!==t.editorFontSize&&t.setEditorFontSize(e.editorFontSize),Ja(e.uiFont)&&e.uiFont!==t.uiFont&&t.setUiFont(e.uiFont),Ya(e.monoFont)&&e.monoFont!==t.monoFont&&t.setMonoFont(e.monoFont),typeof e.padding=="number"&&Number.isFinite(e.padding)&&e.padding!==t.padding&&t.setPadding(e.padding),typeof e.cornerRadius=="number"&&Number.isFinite(e.cornerRadius)&&e.cornerRadius!==t.cornerRadius&&t.setCornerRadius(e.cornerRadius),typeof e.inputBarOffset=="number"&&Number.isFinite(e.inputBarOffset)&&e.inputBarOffset!==t.inputBarOffset&&t.setInputBarOffset(e.inputBarOffset),e.shortcutOverrides&&!dm(e.shortcutOverrides,t.shortcutOverrides)&&ie.setState({shortcutOverrides:e.shortcutOverrides}),typeof e.mobileKeyboardMode=="string"){const s=ko(e.mobileKeyboardMode,t.mobileKeyboardMode);s!==t.mobileKeyboardMode&&t.setMobileKeyboardMode(s)}if(r&&o){const s={};typeof e.dictationEnabled=="boolean"&&e.dictationEnabled!==o.dictationEnabled&&(s.dictationEnabled=e.dictationEnabled),(e.sttProvider==="local"||e.sttProvider==="openai-compatible")&&e.sttProvider!==o.sttProvider&&(s.sttProvider=e.sttProvider),typeof e.sttServerUrl=="string"&&e.sttServerUrl!==o.sttServerUrl&&(s.sttServerUrl=e.sttServerUrl),typeof e.sttModel=="string"&&e.sttModel!==o.sttModel&&(s.sttModel=e.sttModel),typeof e.sttLocalModel=="string"&&e.sttLocalModel!==o.sttLocalModel&&(s.sttLocalModel=e.sttLocalModel),typeof e.sttLanguage=="string"&&e.sttLanguage!==o.sttLanguage&&(s.sttLanguage=e.sttLanguage),Object.keys(s).length>0&&r.setState(s)}if(Array.isArray(e.favoriteModels)){const s=t.favoriteModels,i=e.favoriteModels;Yo(s,i)||ie.setState({favoriteModels:i})}if(Array.isArray(e.hiddenModels)){const s=t.hiddenModels,i=e.hiddenModels;Yo(s,i)||ie.setState({hiddenModels:i})}if(Array.isArray(e.collapsedModelProviders)){const s=t.collapsedModelProviders,i=e.collapsedModelProviders;mr(s,i)||ie.setState({collapsedModelProviders:i})}if(Array.isArray(e.recentModels)){const s=t.recentModels,i=e.recentModels;Yo(s,i)||ie.setState({recentModels:i})}if(Array.isArray(e.recentAgents)){const s=t.recentAgents,i=e.recentAgents;mr(s,i)||ie.setState({recentAgents:i})}if(e.recentEfforts&&typeof e.recentEfforts=="object"){const s=t.recentEfforts,i=e.recentEfforts;um(s,i)||ie.setState({recentEfforts:i})}typeof e.diffLayoutPreference=="string"&&(e.diffLayoutPreference==="dynamic"||e.diffLayoutPreference==="inline"||e.diffLayoutPreference==="side-by-side")&&e.diffLayoutPreference!==t.diffLayoutPreference&&t.setDiffLayoutPreference(e.diffLayoutPreference),typeof e.gitChangesViewMode=="string"&&(e.gitChangesViewMode==="flat"||e.gitChangesViewMode==="tree")&&e.gitChangesViewMode!==t.gitChangesViewMode&&t.setGitChangesViewMode(e.gitChangesViewMode),typeof e.directoryShowHidden=="boolean"&&Ld(e.directoryShowHidden,{persist:!1}),typeof e.filesViewShowGitignored=="boolean"&&jd(e.filesViewShowGitignored,{persist:!1})},Hn=e=>{if(!e||typeof e!="object")return null;const t=e,o={};if(typeof t.themeId=="string"&&t.themeId.length>0&&(o.themeId=t.themeId),(t.useSystemTheme===!0||t.useSystemTheme===!1)&&(o.useSystemTheme=t.useSystemTheme),typeof t.themeVariant=="string"&&(t.themeVariant==="light"||t.themeVariant==="dark")&&(o.themeVariant=t.themeVariant),typeof t.lightThemeId=="string"&&t.lightThemeId.length>0&&(o.lightThemeId=t.lightThemeId),typeof t.darkThemeId=="string"&&t.darkThemeId.length>0&&(o.darkThemeId=t.darkThemeId),typeof t.lastDirectory=="string"&&t.lastDirectory.length>0&&(o.lastDirectory=t.lastDirectory),typeof t.homeDirectory=="string"&&t.homeDirectory.length>0&&(o.homeDirectory=t.homeDirectory),typeof t.opencodeBinary=="string"){const p=t.opencodeBinary.trim();o.opencodeBinary=p.length>0?p:void 0}typeof t.desktopLanAccessEnabled=="boolean"&&(o.desktopLanAccessEnabled=t.desktopLanAccessEnabled),typeof t.desktopKeepAwakeEnabled=="boolean"&&(o.desktopKeepAwakeEnabled=t.desktopKeepAwakeEnabled),typeof t.desktopMinimizeToTrayEnabled=="boolean"&&(o.desktopMinimizeToTrayEnabled=t.desktopMinimizeToTrayEnabled),typeof t.desktopMacMenuBarEnabled=="boolean"&&(o.desktopMacMenuBarEnabled=t.desktopMacMenuBarEnabled);const r=gm(t.projects);if(r&&(o.projects=r),typeof t.activeProjectId=="string"&&t.activeProjectId.length>0&&(o.activeProjectId=t.activeProjectId),Array.isArray(t.securityScopedBookmarks)&&(o.securityScopedBookmarks=t.securityScopedBookmarks.filter(p=>typeof p=="string"&&p.length>0)),Array.isArray(t.pinnedDirectories)&&(o.pinnedDirectories=Array.from(new Set(t.pinnedDirectories.filter(p=>typeof p=="string"&&p.length>0)))),Array.isArray(t.draftStarters)&&(o.draftStarters=cs(t.draftStarters)),typeof t.draftStartersVisible=="boolean"&&(o.draftStartersVisible=t.draftStartersVisible),typeof t.draftStartersCraftGoalAdded=="boolean"&&(o.draftStartersCraftGoalAdded=t.draftStartersCraftGoalAdded),typeof t.draftStartersScheduleTaskAdded=="boolean"&&(o.draftStartersScheduleTaskAdded=t.draftStartersScheduleTaskAdded),typeof t.showReasoningTraces=="boolean"&&(o.showReasoningTraces=t.showReasoningTraces),typeof t.sessionRecapEnabled=="boolean"&&(o.sessionRecapEnabled=t.sessionRecapEnabled),typeof t.sessionSuggestionEnabled=="boolean"&&(o.sessionSuggestionEnabled=t.sessionSuggestionEnabled),typeof t.sessionGoalEnabled=="boolean"&&(o.sessionGoalEnabled=t.sessionGoalEnabled),typeof t.sessionGoalDefaultBudgetEnabled=="boolean"&&(o.sessionGoalDefaultBudgetEnabled=t.sessionGoalDefaultBudgetEnabled),typeof t.sessionGoalDefaultBudget=="number"&&Number.isFinite(t.sessionGoalDefaultBudget)&&t.sessionGoalDefaultBudget>0&&(o.sessionGoalDefaultBudget=Math.floor(t.sessionGoalDefaultBudget)),typeof t.collapsibleThinkingBlocks=="boolean"&&(o.collapsibleThinkingBlocks=t.collapsibleThinkingBlocks),typeof t.autoDeleteEnabled=="boolean"&&(o.autoDeleteEnabled=t.autoDeleteEnabled),typeof t.autoDeleteAfterDays=="number"&&Number.isFinite(t.autoDeleteAfterDays)&&(o.autoDeleteAfterDays=t.autoDeleteAfterDays),(t.sessionRetentionAction==="archive"||t.sessionRetentionAction==="delete")&&(o.sessionRetentionAction=t.sessionRetentionAction),typeof t.tunnelProvider=="string"){const p=t.tunnelProvider.trim().toLowerCase();p.length>0&&(o.tunnelProvider=p)}if(typeof t.tunnelMode=="string"){const p=t.tunnelMode.trim().toLowerCase();(p==="quick"||p==="managed-remote"||p==="managed-local")&&(o.tunnelMode=p)}if(t.tunnelBootstrapTtlMs===null?o.tunnelBootstrapTtlMs=null:typeof t.tunnelBootstrapTtlMs=="number"&&Number.isFinite(t.tunnelBootstrapTtlMs)&&(o.tunnelBootstrapTtlMs=t.tunnelBootstrapTtlMs),typeof t.tunnelSessionTtlMs=="number"&&Number.isFinite(t.tunnelSessionTtlMs)&&(o.tunnelSessionTtlMs=t.tunnelSessionTtlMs),t.managedLocalTunnelConfigPath===null)o.managedLocalTunnelConfigPath=null;else if(typeof t.managedLocalTunnelConfigPath=="string"){const p=t.managedLocalTunnelConfigPath.trim();o.managedLocalTunnelConfigPath=p.length>0?p:null}typeof t.managedRemoteTunnelHostname=="string"&&(o.managedRemoteTunnelHostname=t.managedRemoteTunnelHostname.trim()),t.managedRemoteTunnelToken===null?o.managedRemoteTunnelToken=null:typeof t.managedRemoteTunnelToken=="string"&&(o.managedRemoteTunnelToken=t.managedRemoteTunnelToken.trim());const n=pm(t.managedRemoteTunnelPresets);if(n&&(o.managedRemoteTunnelPresets=n),typeof t.managedRemoteTunnelSelectedPresetId=="string"){const p=t.managedRemoteTunnelSelectedPresetId.trim();o.managedRemoteTunnelSelectedPresetId=p.length>0?p:void 0}const a=hm(t.managedRemoteTunnelPresetTokens);if(a&&(o.managedRemoteTunnelPresetTokens=a),typeof t.defaultModel=="string"&&t.defaultModel.length>0&&(o.defaultModel=t.defaultModel),typeof t.defaultVariant=="string"&&t.defaultVariant.length>0&&(o.defaultVariant=t.defaultVariant),typeof t.defaultAgent=="string"&&t.defaultAgent.length>0&&(o.defaultAgent=t.defaultAgent),typeof t.smallModelUseDefault=="boolean"&&(o.smallModelUseDefault=t.smallModelUseDefault),typeof t.smallModelOverride=="string"&&t.smallModelOverride.length>0&&(o.smallModelOverride=t.smallModelOverride),typeof t.autoCreateWorktree=="boolean"&&(o.autoCreateWorktree=t.autoCreateWorktree),typeof t.gitmojiEnabled=="boolean"&&(o.gitmojiEnabled=t.gitmojiEnabled),zr(t.followUpBehavior)?o.followUpBehavior=t.followUpBehavior:typeof t.queueModeEnabled=="boolean"&&(o.followUpBehavior=$r(void 0,t.queueModeEnabled)),typeof t.showDeletionDialog=="boolean"&&(o.showDeletionDialog=t.showDeletionDialog),typeof t.nativeNotificationsEnabled=="boolean"&&(o.nativeNotificationsEnabled=t.nativeNotificationsEnabled),typeof t.notificationMode=="string"&&(t.notificationMode==="always"||t.notificationMode==="hidden-only")&&(o.notificationMode=t.notificationMode),typeof t.notifyOnSubtasks=="boolean"&&(o.notifyOnSubtasks=t.notifyOnSubtasks),typeof t.notifyOnCompletion=="boolean"&&(o.notifyOnCompletion=t.notifyOnCompletion),typeof t.notifyOnError=="boolean"&&(o.notifyOnError=t.notifyOnError),typeof t.notifyOnQuestion=="boolean"&&(o.notifyOnQuestion=t.notifyOnQuestion),t.notificationTemplates&&typeof t.notificationTemplates=="object"){const p=t.notificationTemplates,b=_=>{const re=p[_];if(!re||typeof re!="object")return;const de=re,pt=typeof de.title=="string"?de.title:"",vo=typeof de.message=="string"?de.message:"";return{title:pt,message:vo}},h=b("completion"),w=b("error"),D=b("question"),B=b("subtask");(h||w||D||B)&&(o.notificationTemplates={completion:h??{title:"Task Complete",message:"Your task has finished."},error:w??{title:"Error Occurred",message:"An error occurred while processing your task."},question:D??{title:"Input Needed",message:"Please provide input to continue."},subtask:B??{title:"Subtask Complete",message:"A subtask has finished."}})}if(typeof t.summarizeLastMessage=="boolean"&&(o.summarizeLastMessage=t.summarizeLastMessage),typeof t.summaryThreshold=="number"&&Number.isFinite(t.summaryThreshold)&&(o.summaryThreshold=Math.max(0,Math.round(t.summaryThreshold))),typeof t.summaryLength=="number"&&Number.isFinite(t.summaryLength)&&(o.summaryLength=Math.max(10,Math.round(t.summaryLength))),typeof t.maxLastMessageLength=="number"&&Number.isFinite(t.maxLastMessageLength)&&(o.maxLastMessageLength=Math.max(10,Math.round(t.maxLastMessageLength))),typeof t.usageAutoRefresh=="boolean"&&(o.usageAutoRefresh=t.usageAutoRefresh),typeof t.usageRefreshIntervalMs=="number"&&Number.isFinite(t.usageRefreshIntervalMs)&&(o.usageRefreshIntervalMs=t.usageRefreshIntervalMs),(t.usageDisplayMode==="usage"||t.usageDisplayMode==="remaining")&&(o.usageDisplayMode=t.usageDisplayMode),typeof t.usageShowPredValues=="boolean"&&(o.usageShowPredValues=t.usageShowPredValues),Array.isArray(t.usageDropdownProviders)&&(o.usageDropdownProviders=t.usageDropdownProviders.filter(p=>typeof p=="string"&&p.length>0)),t.usageSelectedModels&&typeof t.usageSelectedModels=="object"){const p={};for(const[b,h]of Object.entries(t.usageSelectedModels))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageSelectedModels=p)}if(t.usageCollapsedFamilies&&typeof t.usageCollapsedFamilies=="object"){const p={};for(const[b,h]of Object.entries(t.usageCollapsedFamilies))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageCollapsedFamilies=p)}if(t.usageExpandedFamilies&&typeof t.usageExpandedFamilies=="object"){const p={};for(const[b,h]of Object.entries(t.usageExpandedFamilies))Array.isArray(h)&&(p[b]=h.filter(w=>typeof w=="string"));Object.keys(p).length>0&&(o.usageExpandedFamilies=p)}if(t.usageModelGroups&&typeof t.usageModelGroups=="object"){const p={};for(const[b,h]of Object.entries(t.usageModelGroups))if(h&&typeof h=="object"){const w=h,D={};Array.isArray(w.customGroups)&&(D.customGroups=w.customGroups.filter(B=>B&&typeof B=="object").map(B=>({id:String(B.id??""),label:String(B.label??""),models:Array.isArray(B.models)?B.models.filter(_=>typeof _=="string"):[],order:typeof B.order=="number"?B.order:0}))),w.modelAssignments&&typeof w.modelAssignments=="object"&&(D.modelAssignments=Object.fromEntries(Object.entries(w.modelAssignments).filter(([,B])=>typeof B=="string").map(([B,_])=>[B,String(_)]))),w.renamedGroups&&typeof w.renamedGroups=="object"&&(D.renamedGroups=Object.fromEntries(Object.entries(w.renamedGroups).filter(([,B])=>typeof B=="string").map(([B,_])=>[B,String(_)]))),Object.keys(D).length>0&&(p[b]=D)}Object.keys(p).length>0&&(o.usageModelGroups=p)}typeof t.inputSpellcheckEnabled=="boolean"&&(o.inputSpellcheckEnabled=t.inputSpellcheckEnabled),typeof t.showOpenCodeUpdateNotifications=="boolean"&&(o.showOpenCodeUpdateNotifications=t.showOpenCodeUpdateNotifications),typeof t.agentControlToolEnabled=="boolean"&&(o.agentControlToolEnabled=t.agentControlToolEnabled),typeof t.openCodeUpdateToastDismissedVersion=="string"&&(o.openCodeUpdateToastDismissedVersion=t.openCodeUpdateToastDismissedVersion.trim().slice(0,128)),typeof t.showToolFileIcons=="boolean"&&(o.showToolFileIcons=t.showToolFileIcons),typeof t.codeBlockLineWrap=="boolean"&&(o.codeBlockLineWrap=t.codeBlockLineWrap),typeof t.showTurnChangedFiles=="boolean"&&(o.showTurnChangedFiles=t.showTurnChangedFiles),typeof t.showExpandedBashTools=="boolean"&&(o.showExpandedBashTools=t.showExpandedBashTools),typeof t.showExpandedEditTools=="boolean"&&(o.showExpandedEditTools=t.showExpandedEditTools),typeof t.timeFormatPreference=="string"&&(t.timeFormatPreference==="auto"||t.timeFormatPreference==="12h"||t.timeFormatPreference==="24h")&&(o.timeFormatPreference=t.timeFormatPreference),typeof t.weekStartPreference=="string"&&(t.weekStartPreference==="auto"||t.weekStartPreference==="sunday"||t.weekStartPreference==="monday")&&(o.weekStartPreference=t.weekStartPreference),typeof t.desktopWindowControlsPosition=="string"&&(t.desktopWindowControlsPosition==="left"?o.desktopWindowControlsPosition="left":(t.desktopWindowControlsPosition==="right"||t.desktopWindowControlsPosition==="auto")&&(o.desktopWindowControlsPosition="right")),typeof t.chatRenderMode=="string"&&(t.chatRenderMode==="sorted"||t.chatRenderMode==="live")&&(o.chatRenderMode=t.chatRenderMode),typeof t.messageStreamTransport=="string"&&(t.messageStreamTransport==="auto"||t.messageStreamTransport==="ws"||t.messageStreamTransport==="sse")&&(o.messageStreamTransport=t.messageStreamTransport),typeof t.activityRenderMode=="string"&&(t.activityRenderMode==="collapsed"||t.activityRenderMode==="summary")&&(o.activityRenderMode=t.activityRenderMode),typeof t.mermaidRenderingMode=="string"&&(t.mermaidRenderingMode==="svg"||t.mermaidRenderingMode==="ascii")&&(o.mermaidRenderingMode=t.mermaidRenderingMode),typeof t.userMessageRenderingMode=="string"&&(t.userMessageRenderingMode==="markdown"||t.userMessageRenderingMode==="plain")&&(o.userMessageRenderingMode=t.userMessageRenderingMode),typeof t.collapsibleUserMessages=="boolean"&&(o.collapsibleUserMessages=t.collapsibleUserMessages),typeof t.stickyUserHeader=="boolean"&&(o.stickyUserHeader=t.stickyUserHeader),typeof t.promptNavigatorEnabled=="boolean"&&(o.promptNavigatorEnabled=t.promptNavigatorEnabled),typeof t.expandedEditorToolbar=="boolean"&&(o.expandedEditorToolbar=t.expandedEditorToolbar),typeof t.wideChatLayoutEnabled=="boolean"&&(o.wideChatLayoutEnabled=t.wideChatLayoutEnabled),typeof t.showSplitAssistantMessageActions=="boolean"&&(o.showSplitAssistantMessageActions=t.showSplitAssistantMessageActions),typeof t.fontSize=="number"&&Number.isFinite(t.fontSize)&&(o.fontSize=t.fontSize),typeof t.terminalFontSize=="number"&&Number.isFinite(t.terminalFontSize)&&(o.terminalFontSize=t.terminalFontSize),po(t.terminalShell)&&(o.terminalShell=t.terminalShell),Array.isArray(t.terminalLoginShells)&&(o.terminalLoginShells=[...new Set(t.terminalLoginShells.filter(po))]),typeof t.editorFontSize=="number"&&Number.isFinite(t.editorFontSize)&&(o.editorFontSize=t.editorFontSize),Ja(t.uiFont)&&(o.uiFont=t.uiFont),Ya(t.monoFont)&&(o.monoFont=t.monoFont),typeof t.padding=="number"&&Number.isFinite(t.padding)&&(o.padding=t.padding),typeof t.cornerRadius=="number"&&Number.isFinite(t.cornerRadius)&&(o.cornerRadius=t.cornerRadius),typeof t.inputBarOffset=="number"&&Number.isFinite(t.inputBarOffset)&&(o.inputBarOffset=t.inputBarOffset);const s=cm(t.shortcutOverrides);s&&(o.shortcutOverrides=s),typeof t.mobileKeyboardMode=="string"&&(t.mobileKeyboardMode==="native"||t.mobileKeyboardMode==="resize-content")&&(o.mobileKeyboardMode=t.mobileKeyboardMode);const i=Qo(t.favoriteModels,64);i&&(o.favoriteModels=i);const c=Qo(t.hiddenModels,1024);c&&(o.hiddenModels=c);const d=gr(t.collapsedModelProviders);d&&(o.collapsedModelProviders=d);const l=Qo(t.recentModels,16);l&&(o.recentModels=l);const u=gr(t.recentAgents);u&&(o.recentAgents=u);const m=lm(t.recentEfforts);if(m&&(o.recentEfforts=m),typeof t.diffLayoutPreference=="string"&&(t.diffLayoutPreference==="dynamic"||t.diffLayoutPreference==="inline"||t.diffLayoutPreference==="side-by-side")&&(o.diffLayoutPreference=t.diffLayoutPreference),typeof t.gitChangesViewMode=="string"&&(t.gitChangesViewMode==="flat"||t.gitChangesViewMode==="tree")&&(o.gitChangesViewMode=t.gitChangesViewMode),typeof t.directoryShowHidden=="boolean"&&(o.directoryShowHidden=t.directoryShowHidden),typeof t.filesViewShowGitignored=="boolean"&&(o.filesViewShowGitignored=t.filesViewShowGitignored),typeof t.openInAppId=="string"&&t.openInAppId.length>0&&(o.openInAppId=t.openInAppId),typeof t.pwaAppName=="string"){const p=t.pwaAppName.trim().replace(/\s+/g," ").slice(0,64);o.pwaAppName=p.length>0?p:""}const g=im(t.skillCatalogs);return g&&(o.skillCatalogs=g),typeof t.reportUsage=="boolean"&&(o.reportUsage=t.reportUsage),typeof t.globalBehaviorPrompt=="string"&&(o.globalBehaviorPrompt=t.globalBehaviorPrompt),typeof t.responseStyleEnabled=="boolean"&&(o.responseStyleEnabled=t.responseStyleEnabled),typeof t.responseStylePreset=="string"&&(t.responseStylePreset==="concise"||t.responseStylePreset==="detailed"||t.responseStylePreset==="mentor"||t.responseStylePreset==="pushback"||t.responseStylePreset==="noFiller"||t.responseStylePreset==="matchEnergy"||t.responseStylePreset==="warmPeer"||t.responseStylePreset==="custom")&&(o.responseStylePreset=t.responseStylePreset),typeof t.responseStyleCustomInstructions=="string"&&(o.responseStyleCustomInstructions=t.responseStyleCustomInstructions),typeof t.dictationEnabled=="boolean"&&(o.dictationEnabled=t.dictationEnabled),t.sttProvider==="local"||t.sttProvider==="openai-compatible"?o.sttProvider=t.sttProvider:t.sttProvider==="server"?o.sttProvider="openai-compatible":(t.sttProvider==="browser"||t.sttProvider==="wasm")&&(o.sttProvider="local"),typeof t.sttServerUrl=="string"&&(o.sttServerUrl=t.sttServerUrl.trim()),typeof t.sttModel=="string"&&(o.sttModel=t.sttModel.trim()),typeof t.sttLocalModel=="string"&&(o.sttLocalModel=t.sttLocalModel.trim()),typeof t.sttLanguage=="string"&&(o.sttLanguage=t.sttLanguage.trim()),o};let Gr=0,De=null,Ge=null,xt=null,kt=null,Ie=null,hr=[],jn=!1;const ym=2e3,bm=200,qr=()=>({runtimeKey:L(),generation:Gr}),Fr=(e,t)=>e.runtimeKey===t.runtimeKey&&e.generation===t.generation,J=e=>e.generation===Gr&&e.runtimeKey===L(),Wr=()=>{jn||typeof window>"u"||(jn=!0,nc(e=>{e.runtimeKey!==e.previousRuntimeKey&&(Ie&&clearTimeout(Ie),xt&&yr())}),Oa(e=>{e.runtimeKey!==e.previousRuntimeKey&&(Gr+=1,De=null,Ge=null)}))},Am=async(e=qr())=>{if(Wr(),De&&Fr(De.context,e)&&Date.now()-De.at<ym)return De.value;if(Ge&&Fr(Ge.context,e))return Ge.promise;const t={context:e,promise:(async()=>{const o=ps();if(o)try{const r=await o.load();if(!J(e))return null;const n=Hn(r.settings);return De={value:n,at:Date.now(),context:e},n}catch(r){if(!J(e))return null;console.warn("Failed to load shared settings from runtime settings API:",r)}if(!J(e))return null;try{const r=await f("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!J(e)||!r.ok)return null;const n=await r.json().catch(()=>null);if(!J(e))return null;const a=Hn(n);return De={value:a,at:Date.now(),context:e},a}catch(r){return J(e)&&console.warn("Failed to load shared settings from server:",r),null}})()};return Ge=t,t.promise.finally(()=>{Ge===t&&(Ge=null)}),t.promise},jh=async()=>{if(typeof window>"u")return;Wr();const e=qr(),t=gs(),o=()=>!t?.hasHydrated||t.hasHydrated()||!t.onFinishHydration?Promise.resolve():new Promise(n=>{let a=!1;const s=()=>{a||(a=!0,n())},i=t.onFinishHydration(()=>{i?.(),s()});t.hasHydrated?.()&&s()}),r=async n=>{if(!J(e))return;const a=n.draftStartersCraftGoalAdded!==!0||n.draftStartersScheduleTaskAdded!==!0,s=Fm(n);try{sm(n)}catch(i){console.warn("persistToLocalStorage failed:",i)}if(await o(),!!J(e)){n.draftStarters===void 0&&ie.setState({globalDraftStarters:null});try{pr(s)}catch(i){console.warn("applyDesktopUiPreferences failed:",i)}a&&(await be({...s.draftStarters?{draftStarters:s.draftStarters}:{},draftStartersCraftGoalAdded:!0,draftStartersScheduleTaskAdded:!0}),!J(e))||lr(s)}};try{const n=await Am(e);n&&J(e)&&await r(n)}catch(n){console.warn("Failed to synchronise settings:",n)}};async function yr(){const e=xt,t=kt,o=hr;xt=null,kt=null,Ie=null,hr=[];try{if(!e||!t||Object.keys(e).length===0||!J(t)){Be("saved");return}const r=ps();if(r)try{const n=await r.save(e);if(!J(t))return;n&&(pr(n),lr(n),De=null),Be(n?"saved":"error");return}catch(n){if(!J(t))return;console.warn("Failed to update settings via runtime settings API:",n)}if(!J(t))return;try{const n=await f("/api/config/settings",{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!J(t))return;if(!n.ok){console.warn("Failed to update shared settings via API:",n.status,n.statusText),Be("error");return}const a=await n.json().catch(()=>null);if(!J(t))return;a?(pr(a),lr(a),Be("saved"),De=null):Be("error")}catch(n){J(t)&&(console.warn("Failed to update shared settings via API:",n),Be("error"))}}finally{o.forEach(r=>r())}}const be=async e=>{if(typeof window>"u")return;Wr();const t=qr();kt&&!Fr(kt,t)&&(Ie&&clearTimeout(Ie),yr()),xt={...xt??{},...e},kt=t,Be("saving"),Ie&&clearTimeout(Ie);const o=new Promise(r=>{hr.push(r)});return Ie=setTimeout(()=>{yr()},bm),o},zh=async()=>{if(typeof window>"u")return;const e=gs();try{const t=await qd();if(!t)return;const o=()=>Gd(t);if(e?.hasHydrated?.()){o();return}if(o(),e?.onFinishHydration){const r=e.onFinishHydration(()=>{r?.(),o()})}}catch(t){console.warn("Failed to load appearance preferences:",t)}},wm=3e4,Em=40,Cm=60,Bm=(e,t,o,r,n,a,s)=>{const i=t.trim(),c=o.trim().toLowerCase();return JSON.stringify([e,i,c,r,n,a,s])},zn=(e,t)=>{try{const o=JSON.parse(e);return Array.isArray(o)&&o[1]===t}catch{return!1}},Dm=_t()(Nt((e,t)=>({cache:{},cacheKeys:[],inFlight:{},async searchFiles(o,r,n=Cm,a){if(!o||o.trim().length===0)return[];const s=o.trim(),i=L(),c=typeof r=="string"?r.trim():"",d=!!a?.includeHidden,l=a?.respectGitignore??!0,u=a?.type==="directory"?"directory":"file",m=Bm(i,s,c,n,d,l,u),g=Date.now(),p=t().cache[m];if(p&&g-p.timestamp<wm)return p.files;const b=t().inFlight[m];if(b)return b;const h=Oe.searchFiles(c,{directory:s,limit:n,includeHidden:d,respectGitignore:l,dirs:u!=="file",type:u}).then(w=>(e(D=>{if(D.inFlight[m]!==h)return D;const B={...D.cache,[m]:{files:w,timestamp:Date.now()}},_=D.cacheKeys.filter(re=>re!==m);for(_.push(m);_.length>Em;){const re=_.shift();re&&delete B[re]}return{cache:B,cacheKeys:_}}),w)).finally(()=>{e(w=>{if(w.inFlight[m]!==h)return w;const D={...w.inFlight};return delete D[m],{inFlight:D}})});return e(w=>({inFlight:{...w.inFlight,[m]:h}})),h},invalidateDirectory(o){if(!o||o.trim().length===0){e({cache:{},cacheKeys:[],inFlight:{}});return}const r=o.trim();e(n=>{const a={...n.cache},s=n.cacheKeys.filter(d=>zn(d,r)?(delete a[d],!1):!0),i=Object.entries(n.inFlight).filter(([d])=>!zn(d,r)),c=Object.fromEntries(i);return{cache:a,cacheKeys:s,inFlight:c}})},resetForRuntimeSwitch(){e({cache:{},cacheKeys:[],inFlight:{}})}}),{name:"file-search-store"})),km=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem("openchamber_stream_debug")==="1"}catch{return!1}},br="openchamber_stream_perf",vm=()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(br)==="1"}catch{return!1}};let Xe=vm();const $n=()=>typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),Sm=()=>{if(!Xe||typeof window>"u")return null;if(!window.__openchamberStreamPerfState){const e=Date.now();window.__openchamberStreamPerfState={counters:new Map,startedAt:e,lastUpdatedAt:e}}return window.__openchamberStreamPerfState},hs=e=>Array.from(e.entries()).map(([t,o])=>({metric:t,count:o.count,avg:o.count>0?Number((o.total/o.count).toFixed(3)):0,max:Number(o.max.toFixed(3)),total:Number(o.total.toFixed(3)),last:Number(o.last.toFixed(3))})).sort((t,o)=>o.total-t.total||o.count-t.count),Vr=(e,t)=>{const o=Sm();if(!o)return;const r=o.counters.get(e)??{count:0,total:0,max:0,last:0};r.count+=1,r.total+=t,r.max=Math.max(r.max,t),r.last=t,o.counters.set(e,r),o.lastUpdatedAt=Date.now()},Mm=e=>{if(Xe=e,!(typeof window>"u"))try{if(e){window.localStorage.setItem(br,"1"),window.__openchamberStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()};return}window.localStorage.removeItem(br),delete window.__openchamberStreamPerfState,delete window.__openchamberVsCodeStreamPerfState}catch{}},Tm=()=>{typeof window>"u"||(Xe&&(window.__openchamberStreamPerfState={counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}),window.__openchamberVsCodeStreamPerfState&&(window.__openchamberVsCodeStreamPerfState={...window.__openchamberVsCodeStreamPerfState,counters:new Map,startedAt:Date.now(),lastUpdatedAt:Date.now()}))},Pm=()=>{if(typeof window>"u")return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const e=window.__openchamberStreamPerfState;return!Xe||!e?{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]}:{enabled:!0,startedAt:e.startedAt,lastUpdatedAt:e.lastUpdatedAt,durationMs:Math.max(0,Date.now()-e.startedAt),entries:hs(e.counters)}},$h=()=>{if(typeof window>"u")return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const e=window.__openchamberVsCodeStreamPerfState;if(!Xe||!e)return{enabled:!1,startedAt:null,lastUpdatedAt:null,durationMs:0,entries:[]};const t=typeof e.startedAt=="number"?e.startedAt:null,o=typeof e.lastUpdatedAt=="number"?e.lastUpdatedAt:null;return{enabled:!0,startedAt:t,lastUpdatedAt:o,durationMs:t?Math.max(0,Date.now()-t):0,entries:hs(e.counters)}},Gh=(e,t=1)=>{Vr(e,t)},qh=(e,t)=>{Vr(e,t)},Wh=e=>{!Xe||typeof performance>"u"||typeof performance.mark!="function"||performance.mark(`openchamber.${e}`)},Vh=(e,t)=>{if(!Xe)return t();const o=$n();try{return t()}finally{Vr(e,$n()-o)}};typeof window<"u"&&(window.__openchamberStreamPerformance={setEnabled:Mm,reset:Tm,getSnapshot:Pm});var Rm={};let ge=null,Gn=0;const me=Lt(),qn=me.getItem("lastDirectory"),Im=typeof qn=="string"&&qn.length>0,Zt=e=>{try{Dm.getState().invalidateDirectory(e)}catch(t){console.warn("Failed to invalidate file search cache:",t)}},ft=e=>{const t=e.trim();if(!t)return t;const o=t.replace(/\\/g,"/").replace(/^([a-z]):/,(r,n)=>n.toUpperCase()+":");return o.length>1?o.replace(/\/+$/,""):o},xm=(e,t)=>{const o=e.trim();return o.startsWith("~")?o==="~"?t||o:(o.startsWith("~/")||o.startsWith("~\\"))&&t?`${t}${o.slice(1)}`:o:o},no=(e,t)=>{const o=xm(e,t);return ft(o)},Om=()=>{const e=me.getItem("homeDirectory");if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},_m=()=>{const e=me.getItem("lastDirectory");if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},Nm=()=>{if(typeof process>"u")return null;const e=Rm,t=e?.HOME||e?.USERPROFILE||(e?.HOMEDRIVE&&e?.HOMEPATH?`${e.HOMEDRIVE}${e.HOMEPATH}`:void 0);if(typeof t=="string"&&t.trim().length>0){const r=ft(t);return r.length>0?r:null}const o=process?.cwd?.();if(typeof o=="string"&&o.trim().length>0){const r=ft(o);return r.length>0?r:null}return null},ho=()=>{if(typeof window<"u"){if(ge)return ge;const t=typeof window.__OPENCHAMBER_HOME__=="string"&&window.__OPENCHAMBER_HOME__.length>0?window.__OPENCHAMBER_HOME__:null;if(t&&t.length>0)return ge=t,me.setItem("homeDirectory",t),t;const o=Om();if(o&&!Do())return ge=o,o}const e=Nm();return e||"/"},Um=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const o=t.replace(/\\/g,"/");if(o.length>1){const r=o.replace(/\/+$/,"");if(r&&r.length>0)return r==="/"?null:r}return o==="/"||o.length===0?null:o},Lm=e=>(ge=e,typeof window<"u"&&me.setItem("homeDirectory",e),be({homeDirectory:e}),e),Ar=async()=>{const e=r=>{const n=Um(r);return n?Lm(n):null};try{const r=await Oe.getFilesystemHome(),n=e(r);if(n)return n}catch(r){console.warn("Failed to obtain filesystem home directory:",r)}try{const r=await Oe.getSystemInfo(),n=e(r?.homeDirectory);if(n)return n}catch(r){console.warn("Failed to get home directory from system info:",r)}try{const r=await Ua(),n=e(r);if(n)return n}catch(r){console.warn("Failed to obtain desktop-integrated home directory:",r)}const t=ho(),o=e(t);return o||t},Hm=()=>{if(!Do())return null;const e=window.__VSCODE_CONFIG__?.workspaceFolder;if(typeof e!="string"||e.trim().length===0)return null;const t=ft(e);return t.length>0?t:null},Ot=Hm()||ho(),Fo=(()=>{const e=_m();return e&&!Do()?no(e,Ot):Ot})();Fo&&Oe.setDirectory(Fo);const jm=!!(Ot&&Ot!=="/"),wr=_t()(Nt((e,t)=>({currentDirectory:Fo,directoryHistory:[Fo],historyIndex:0,homeDirectory:Ot,hasPersistedDirectory:Im,isHomeReady:jm,isSwitchingDirectory:!1,setDirectory:(o,r)=>{const n=ge||t().homeDirectory||me.getItem("homeDirectory"),a=no(o,n);km()&&console.log("[DirectoryStore] setDirectory called with path:",a),Oe.setDirectory(a),Zt(),e(s=>{const i=[...s.directoryHistory.slice(0,s.historyIndex+1),a];return me.setItem("lastDirectory",a),be({lastDirectory:a}),{currentDirectory:a,directoryHistory:i,historyIndex:i.length-1,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1}})},goBack:()=>{const o=t();if(o.historyIndex>0){const r=o.historyIndex-1,n=o.directoryHistory[r];Oe.setDirectory(n),Zt(),me.setItem("lastDirectory",n),be({lastDirectory:n}),e({currentDirectory:n,historyIndex:r,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goForward:()=>{const o=t();if(o.historyIndex<o.directoryHistory.length-1){const r=o.historyIndex+1,n=o.directoryHistory[r];Oe.setDirectory(n),Zt(),me.setItem("lastDirectory",n),be({lastDirectory:n}),e({currentDirectory:n,historyIndex:r,hasPersistedDirectory:!0,isHomeReady:!0,isSwitchingDirectory:!1})}},goToParent:()=>{const{currentDirectory:o,setDirectory:r}=t(),n=ge||t().homeDirectory||ho();if(o===n||o==="/")return;const a=o.endsWith("/")?o.slice(0,-1):o,s=a.lastIndexOf("/");if(s===-1){const i=ge||ho();r(i)}else r(s===0?"/":a.substring(0,s))},goHome:async()=>{const o=ge||t().homeDirectory||await Ar();t().setDirectory(o)},synchronizeHomeDirectory:o=>{const r=t(),n=o;ge=n;const a=r.homeDirectory!==n,s=me.getItem("lastDirectory"),i=typeof s=="string"&&s.length>0,c=!i&&(r.currentDirectory==="/"||r.currentDirectory===r.homeDirectory||!r.currentDirectory);if(!a&&!c){r.isHomeReady||e({isHomeReady:!0});return}const d=typeof n=="string"&&n!==""&&n!=="/",l=r.currentDirectory?no(r.currentDirectory,n):r.currentDirectory,u=r.directoryHistory.map(b=>no(b,n)),m=u.some((b,h)=>b!==r.directoryHistory[h]),g=!!(l&&l!==r.currentDirectory),p={homeDirectory:n,hasPersistedDirectory:i,isHomeReady:d};if(c?(p.currentDirectory=n,p.directoryHistory=[n],p.historyIndex=0,p.isSwitchingDirectory=!1):(g||m)&&(p.currentDirectory=l,p.directoryHistory=u,p.historyIndex=Math.min(r.historyIndex,u.length-1),p.isSwitchingDirectory=!1),e(()=>p),(c||g)&&d){const b=c?n:l;Oe.setDirectory(b),Zt(),me.setItem("lastDirectory",b),be({lastDirectory:b})}be({homeDirectory:n})}}),{name:"directory-store"}));typeof window<"u"&&(Ar().then(e=>{wr.getState().synchronizeHomeDirectory(e)}),Oa(()=>{ge=null;const e=++Gn;Ar().then(t=>{e===Gn&&wr.getState().synchronizeHomeDirectory(t)})}));const zm=(e,t)=>{const o=bo();return o?o.openWebSocket(gi(e),t):Ei(new WebSocket(e))},Fs=1,Wn=512*1024,$m=0,At=1,Kr=new TextEncoder,ys=new TextDecoder,Gm=e=>{const t=Kr.encode(JSON.stringify(e)),o=new Uint8Array(t.length+1);return o[0]=Fs,o.set(t,1),o},qm=async e=>{let t;if(e instanceof ArrayBuffer)t=new Uint8Array(e);else if(e instanceof Uint8Array)t=e;else if(typeof Blob<"u"&&e instanceof Blob)t=new Uint8Array(await e.arrayBuffer());else if(typeof e=="string")t=Kr.encode(e);else return null;t[0]===Fs&&(t=t.subarray(1));try{return JSON.parse(ys.decode(t))}catch{return null}},Jr=async(e,t)=>{const o=await e.json().catch(()=>null);return new Error(typeof o?.error=="string"?o.error:t)},Wm=e=>{const t=Kr.encode(e);if(t.byteLength<=Wn)return e;let o=t.byteLength-Wn;for(;o<t.byteLength&&(t[o]&192)===128;)o+=1;return ys.decode(t.subarray(o))};class bs{constructor(t={refreshAuth:Co,openSocket:()=>zm(oe().websocket("/api/terminal/ws"))}){this.dependencies=t}socket=null;opening=null;openingGeneration=null;subscribers=new Map;projections=new Map;reconnectTimer=null;keepaliveTimer=null;failures=0;wakeCleanup=null;generation=0;disposed=!1;subscribe(t,o){const r={handlers:o,lastSequence:-1},n=this.subscribers.get(t)??new Set,a=n.size===0;n.add(r),this.subscribers.set(t,n);const s=this.projections.get(t);s&&(r.lastSequence=s.sequence,o.onEvent({type:"snapshot",sequence:s.sequence,data:s.history,status:s.status,exitCode:s.exitCode,signal:s.signal,runtime:s.runtime,ptyBackend:s.ptyBackend}));const i=this.socket?.readyState===At;return this.ensureConnected().then(()=>{a&&i&&n.has(r)&&this.send({t:"attach",v:3,s:t})}).catch(c=>{o.onError?.(c,!1),this.scheduleReconnect()}),()=>{const c=this.subscribers.get(t);c?.delete(r),c?.size===0&&(this.subscribers.delete(t),this.projections.delete(t),this.send({t:"detach",v:3,s:t})),this.subscribers.size===0&&(this.generation+=1,this.cancelReconnect(),this.closeSocket())}}async write(t,o){if(o&&(await this.ensureConnected(),!this.send({t:"write",v:3,s:t,d:o})&&(this.closeSocket(),await this.ensureConnected(),!this.send({t:"write",v:3,s:t,d:o}))))throw new Error("Terminal connection is unavailable")}dispose(){this.disposed=!0,this.generation+=1,this.subscribers.clear(),this.projections.clear(),this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null,this.closeSocket()}forget(t){this.projections.delete(t)}async ensureConnected(){if(this.disposed)throw new Error("Terminal runtime changed");if(this.socket?.readyState===At)return;if(this.opening&&this.openingGeneration===this.generation)return await this.opening,this.socket?.readyState===At?void 0:this.ensureConnected();this.openingGeneration!==this.generation&&(this.opening=null,this.openingGeneration=null);const t=this.generation,o=(async()=>{if(await this.dependencies.refreshAuth(),t!==this.generation||this.disposed)throw new Error("Terminal runtime changed");await new Promise((r,n)=>{let a=!1,s=null;const i=d=>{a||(a=!0,clearTimeout(c),d?n(d):r())},c=setTimeout(()=>{s?.close(),i(new Error("Terminal connection timed out"))},1e4);try{const d=this.dependencies.openSocket();s=d,d.binaryType="arraybuffer",this.socket=d,d.onopen=()=>{if(t!==this.generation||this.disposed){d.close(),i(new Error("Terminal runtime changed"));return}this.failures=0,this.send({t:"hello",v:3});for(const l of this.subscribers.keys())this.send({t:"attach",v:3,s:l});this.startKeepalive(),i()},d.onmessage=l=>{this.handleMessage(l.data)},d.onerror=()=>{i(new Error("Terminal WebSocket failed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()},d.onclose=()=>{this.socket===d&&(this.socket=null),this.stopKeepalive(),i(new Error("Terminal WebSocket closed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()}}catch(d){i(d instanceof Error?d:new Error("Terminal WebSocket failed")),!this.disposed&&this.subscribers.size>0&&this.scheduleReconnect()}})})();this.opening=o,this.openingGeneration=t;try{await o}finally{this.opening===o&&(this.opening=null,this.openingGeneration=null)}}async handleMessage(t){const o=await qm(t);if(!o||o.t==="hello"||o.t==="pong")return;if(o.t==="error"){const a=new Error(typeof o.message=="string"?o.message:"Terminal error");typeof o.code=="string"&&(a.code=o.code);const s=o.s?[o.s]:[...this.subscribers.keys()];for(const i of s)for(const c of this.subscribers.get(i)??[])c.handlers.onError?.(a,o.fatal===!0);return}if(!o.s)return;const r=this.subscribers.get(o.s);if(!r)return;if(o.t==="snapshot"){const a={sequence:typeof o.q=="number"?o.q:0,history:typeof o.history=="string"?o.history:"",status:o.status,exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null,runtime:o.runtime,ptyBackend:typeof o.ptyBackend=="string"?o.ptyBackend:void 0};this.projections.set(o.s,a);for(const s of r)s.lastSequence=a.sequence,s.handlers.onEvent({type:"snapshot",sequence:a.sequence,data:a.history,status:a.status,exitCode:a.exitCode,signal:a.signal,runtime:a.runtime,ptyBackend:a.ptyBackend});return}if(typeof o.q!="number")return;const n=this.projections.get(o.s);n&&o.q>n.sequence&&(o.t==="output"?this.projections.set(o.s,{...n,sequence:o.q,history:Wm(n.history+(typeof o.r=="string"?o.r:typeof o.d=="string"?o.d:""))}):o.t==="exit"?this.projections.set(o.s,{...n,sequence:o.q,status:"exited",exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null}):o.t==="restarted"&&this.projections.set(o.s,{...n,sequence:o.q,history:typeof o.history=="string"?o.history:"",status:"running",exitCode:void 0,signal:null}));for(const a of r)o.q<=a.lastSequence||(a.lastSequence=o.q,o.t==="output"?a.handlers.onEvent({type:"data",sequence:o.q,data:typeof o.d=="string"?o.d:"",replayData:typeof o.r=="string"?o.r:void 0}):o.t==="exit"?a.handlers.onEvent({type:"exit",sequence:o.q,exitCode:typeof o.exitCode=="number"?o.exitCode:void 0,signal:typeof o.signal=="number"?o.signal:null}):o.t==="restarted"&&a.handlers.onEvent({type:"snapshot",sequence:o.q,data:typeof o.history=="string"?o.history:"",status:"running"}))}send(t){if(!this.socket||this.socket.readyState!==At)return!1;try{return this.socket.send(Gm(t)),!0}catch{return!1}}scheduleReconnect(){if(this.reconnectTimer||this.disposed||this.subscribers.size===0)return;this.failures+=1;const t=typeof document<"u"&&document.visibilityState==="hidden"||typeof navigator<"u"&&!navigator.onLine,o=Math.min(500*2**Math.min(this.failures-1,10),t?6e4:8e3);for(const n of this.subscribers.values())for(const a of n)a.handlers.onEvent({type:"reconnecting",attempt:this.failures,maxAttempts:Number.POSITIVE_INFINITY});const r=()=>{typeof document<"u"&&document.visibilityState==="hidden"||typeof navigator<"u"&&!navigator.onLine||(this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null,this.ensureConnected().catch(()=>this.scheduleReconnect()))};typeof window<"u"&&window.addEventListener("online",r),typeof document<"u"&&document.addEventListener("visibilitychange",r),this.wakeCleanup=()=>{typeof window<"u"&&window.removeEventListener("online",r),typeof document<"u"&&document.removeEventListener("visibilitychange",r)},this.reconnectTimer=setTimeout(r,o)}startKeepalive(){this.stopKeepalive(),this.keepaliveTimer=setInterval(()=>this.send({t:"ping",v:3}),2e4)}stopKeepalive(){this.keepaliveTimer&&clearInterval(this.keepaliveTimer),this.keepaliveTimer=null}cancelReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.wakeCleanup?.(),this.wakeCleanup=null}closeSocket(){this.stopKeepalive();const t=this.socket;this.socket=null,t&&(t.readyState===$m||t.readyState===At)&&t.close()}}let Ye=new bs;async function Vm(e){const t=await f("/api/terminal/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await Jr(t,"Failed to create terminal session");return t.json()}async function Km(){const e=await f("/api/terminal/shells");if(!e.ok)throw await Jr(e,"Failed to list terminal shells");const t=await e.json().catch(()=>[]);return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"&&po(o.id)&&typeof o.name=="string"&&typeof o.supportsLogin=="boolean"):[]}function Jm(e,t,o){return Ye.subscribe(e,{onEvent:t,onError:o})}async function Ym(e,t){await Ye.write(e,t)}async function jt(e,t,o){const r={method:t};o!==void 0&&(r.headers={"Content-Type":"application/json"},r.body=JSON.stringify(o));const n=await f(e,r);if(!n.ok)throw await Jr(n,"Terminal command failed");return n}async function Qm(e,t,o){await jt(`/api/terminal/${e}/resize`,"POST",{cols:t,rows:o})}async function Xm(e,t){await jt(`/api/terminal/${e}/appearance`,"POST",t)}async function Zm(e){await jt(`/api/terminal/${e}`,"DELETE"),Ye.forget(e)}async function eg(e,t){return(await jt(`/api/terminal/${e}/restart`,"POST",t)).json()}async function tg(e){const o=await(await jt("/api/terminal/force-kill","POST",e)).json().catch(()=>null);if(Array.isArray(o?.killedSessionIds))for(const r of o.killedSessionIds)typeof r=="string"&&Ye.forget(r);else e.sessionId&&Ye.forget(e.sessionId)}function Kh(){Ye.dispose(),Ye=new bs}const og=()=>({async listShells(){return Km()},async createSession(e){return Vm(e)},connect(e,t){const o=Jm(e,t.onEvent,t.onError);return{close:()=>o()}},async sendInput(e,t){await Ym(e,t)},async resize(e){await Qm(e.sessionId,e.cols,e.rows)},async updateAppearance(e,t){await Xm(e,t)},async close(e){await Zm(e)},async restartSession(e,t){return eg(e,{cwd:t.cwd??"",cols:t.cols,rows:t.rows,themeMode:t.themeMode,terminalBackground:t.terminalBackground,terminalForeground:t.terminalForeground,shell:t.shell,loginShell:t.loginShell})},async forceKill(e){await tg(e)}}),F="/api/git",rg=1200,ng=5e3,Er=new Map,wt=new Map,As=new Map,Vn=new Map,eo=new Map,ws=e=>e.trim(),Yr=(e,t)=>JSON.stringify([e,ws(t)]),Es=(e,t,o)=>JSON.stringify([e,ws(t),o??"full"]),Cr=(e,t)=>As.get(Yr(e,t))??0,_e=e=>{const t=L(),o=Yr(t,e);As.set(o,Cr(t,e)+1);for(const r of[void 0,"light"]){const n=Es(t,e,r);Er.delete(n),wt.delete(n)}};function y(e,t,o){const r={...o};return t&&(r.directory=t),oe().api(e,r)}async function ag(e){const t=Yr(L(),e),o=Date.now(),r=Vn.get(t);if(r&&r.expiresAt>o)return r.value;const n=eo.get(t);if(n)return n;const a=(async()=>{const s=await f(y(`${F}/check`,e));if(!s.ok)throw new Error(`Failed to check git repository: ${s.statusText}`);const c=!!(await s.json()).isGitRepository;return Vn.set(t,{value:c,expiresAt:Date.now()+ng}),c})();eo.set(t,a);try{return await a}finally{eo.get(t)===a&&eo.delete(t)}}async function sg(e,t){const o=t?.mode,r=L(),n=Es(r,e,o),a=Date.now(),s=Er.get(n);if(s&&s.expiresAt>a)return s.value;const i=wt.get(n);if(i)return i;const c=(async()=>{const d=Cr(r,e),l=await f(y(`${F}/status`,e,o?{mode:o}:void 0));if(!l.ok)throw new Error(`Failed to get git status: ${l.statusText}`);const u=await l.json();return Cr(r,e)===d&&Er.set(n,{value:u,expiresAt:Date.now()+rg}),u})();wt.set(n,c);try{return await c}finally{wt.get(n)===c&&wt.delete(n)}}async function Jh(e){const t=await f(y(`${F}/primary-root`,e));if(!t.ok)throw new Error(`Failed to resolve git primary root: ${t.statusText}`);const o=await t.json().catch(()=>({}));return{root:typeof o.root=="string"&&o.root?o.root:e}}async function Yh(e){const t=await f(y(`${F}/toplevel`,e));if(!t.ok)throw new Error(`Failed to resolve git toplevel: ${t.statusText}`);const o=await t.json().catch(()=>({}));return{root:typeof o.root=="string"&&o.root?o.root:e}}async function Qh(e,t){const o=await f(y(`${F}/commit-summaries`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shas:t})});if(!o.ok)throw new Error(`Failed to get git commit summaries: ${o.statusText}`);const r=await o.json().catch(()=>({}));return{commits:Array.isArray(r.commits)?r.commits.map(n=>({sha:typeof n.sha=="string"?n.sha:"",short:typeof n.short=="string"?n.short:"",subject:typeof n.subject=="string"?n.subject:""})).filter(n=>n.sha&&n.short):[]}}async function ig(e,t){const{path:o,staged:r,contextLines:n}=t;if(!o)throw new Error("path is required to fetch git diff");const a=await f(y(`${F}/diff`,e,{path:o,staged:r?"true":void 0,context:n}));if(!a.ok)throw new Error(`Failed to get git diff: ${a.statusText}`);return a.json()}async function cg(e,t){const{path:o,staged:r}=t;if(!o)throw new Error("path is required to fetch git file diff");const n=await f(y(`${F}/file-diff`,e,{path:o,staged:r?"true":void 0}));if(!n.ok)throw new Error(`Failed to get git file diff: ${n.statusText}`);return n.json()}async function dg(e,t,o){if(!t)throw new Error("path is required to revert git changes");const r=await f(y(`${F}/revert`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,scope:o?.scope})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to revert git changes")}_e(e)}async function lg(e,t){await Cs(e,[t])}async function Cs(e,t){const o=t.map(n=>n.trim()).filter(Boolean);if(o.length===0)throw new Error("path is required to stage git changes");const r=await f(y(`${F}/stage`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to stage git changes")}_e(e)}async function ug(e,t){await Bs(e,[t])}async function Bs(e,t){const o=t.map(n=>n.trim()).filter(Boolean);if(o.length===0)throw new Error("path is required to unstage git changes");const r=await f(y(`${F}/unstage`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to unstage git changes")}_e(e)}async function fg(e,t,o){await Qr(e,t,o,"stage")}async function mg(e,t,o){await Qr(e,t,o,"unstage")}async function gg(e,t,o){await Qr(e,t,o,"discard")}async function Qr(e,t,o,r){if(!t)throw new Error("path is required to apply a git hunk");if(typeof o!="string"||!o.trim())throw new Error("patch is required to apply a git hunk");const n=await f(y(`${F}/apply-hunk`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,patch:o,action:r})});if(!n.ok){const a=await n.json().catch(()=>({error:n.statusText}));throw new Error(a.error||"Failed to apply git hunk")}_e(e)}async function pg(e){if(!e)return!1;const t=await f(y(`${F}/worktree-type`,e));if(!t.ok)throw new Error(`Failed to detect worktree type: ${t.statusText}`);return!!(await t.json()).linked}async function hg(e){const t=await f(y(`${F}/branches`,e));if(!t.ok)throw new Error(`Failed to get branches: ${t.statusText}`);return t.json()}async function Fg(e,t){if(!t?.branch)throw new Error("branch is required to delete a branch");const o=await f(y(`${F}/branches`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete branch")}return o.json()}async function yg(e,t){if(!t?.branch)throw new Error("branch is required to delete remote branch");const o=await f(y(`${F}/remote-branches`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete remote branch")}return o.json()}async function bg(e,t){const o=t?.remote?.trim();if(!o)throw new Error("remote is required to remove a remote");const r=await f(y(`${F}/remotes`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to remove remote")}return r.json()}async function Ag(e,t,o){if(!Array.isArray(t)||t.length===0)throw new Error("No files provided to generate commit message");const r={files:t};o?.zenModel&&(r.zenModel=o.zenModel),o?.providerId&&(r.providerId=o.providerId),o?.modelId&&(r.modelId=o.modelId);const n=await f(y(`${F}/commit-message`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){const c=await n.json().catch(()=>({error:n.statusText}));console.error("[git-generation][browser] http error",{status:n.status,statusText:n.statusText,error:c});const d=typeof c?.traceId=="string"&&c.traceId?` (traceId: ${c.traceId})`:"";throw new Error(`${c.error||"Failed to generate commit message"}${d}`)}const a=await n.json();if(!a?.message||typeof a.message!="object")throw new Error("Malformed commit generation response");const s=typeof a.message.subject=="string"&&a.message.subject.trim().length>0?a.message.subject.trim():"",i=Array.isArray(a.message.highlights)?a.message.highlights.filter(c=>typeof c=="string"&&c.trim().length>0).map(c=>c.trim()):[];return{message:{subject:s,highlights:i}}}async function wg(e,t){const{base:o,head:r,context:n,zenModel:a,providerId:s,modelId:i}=t;if(!o||!r)throw new Error("base and head are required");const c={base:o,head:r};n?.trim()&&(c.context=n.trim()),a&&(c.zenModel=a),s&&(c.providerId=s),i&&(c.modelId=i);const d=await f(y(`${F}/pr-description`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok){const g=await d.json().catch(()=>({error:d.statusText}));throw new Error(g.error||"Failed to generate PR description")}const l=await d.json().catch(()=>null),u=typeof l?.title=="string"?l.title:"",m=typeof l?.body=="string"?l.body:"";if(!u&&!m)throw new Error("Malformed PR description response");return{title:u,body:m}}async function Kn(e){const t=await f(y(`${F}/worktrees`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to list worktrees")}return t.json()}async function Jn(e,t){const o=await f(y(`${F}/worktrees/validate`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to validate worktree")}return o.json()}async function Eg(e){const t=await f(y(`${F}/worktrees/bootstrap-status`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to get worktree bootstrap status")}return t.json()}async function Cg(e,t){const o=await f(y(`${F}/worktrees/preview`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to preview worktree")}return o.json()}async function Yn(e,t){const o=await f(y(`${F}/worktrees`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to create worktree")}return o.json()}async function Qn(e,t){const o=await f(y(`${F}/worktrees`,e),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to delete worktree")}return o.json()}async function Bg(e,t,o={}){const r=await f(y(`${F}/commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t,addAll:o.addAll??!1,files:o.files,stageFiles:o.stageFiles})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to create commit")}const n=await r.json();return _e(e),n}async function Dg(e,t={}){const o=await f(y(`${F}/push`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to push")}const r=await o.json();return _e(e),r}async function kg(e,t={}){const o=await f(y(`${F}/pull`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to pull")}const r=await o.json();return _e(e),r}async function vg(e,t={}){const o=await f(y(`${F}/fetch`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to fetch")}const r=await o.json();return _e(e),r}async function Sg(e){const t=await f(y(`${F}/stashes`,e));if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to list stashes")}return t.json()}async function Mg(e,t){const o=await f(y(`${F}/stashes/file-counts`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refs:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to count stash files")}return o.json()}async function Ds(e,t={}){const o=await f(y(`${F}/stash`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to stash changes")}return o.json()}const Xr=async(e,t,o)=>{const r=await f(y(`${F}/${t}`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||`Failed to ${t}`)}return r.json()},Tg=(e,t)=>Xr(e,"stash/apply",t),ks=(e,t)=>Xr(e,"stash/pop",t),Pg=(e,t)=>Xr(e,"stash/drop",t);async function Rg(e,t){const o=await f(y(`${F}/checkout`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to checkout branch")}return o.json()}async function Ig(e,t,o){const r=await f(y(`${F}/branches`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,startPoint:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to create branch")}return r.json()}async function xg(e,t,o){const r=await f(y(`${F}/branches/rename`,e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldName:t,newName:o})});if(!r.ok){const n=await r.json().catch(()=>({error:r.statusText}));throw new Error(n.error||"Failed to rename branch")}return r.json()}async function Og(e,t={}){const o=await f(y(`${F}/log`,e,{maxCount:t.maxCount,from:t.from,to:t.to,file:t.file,all:t.all?"true":void 0}));if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(`Failed to get git log: ${r.error||o.statusText}`)}return o.json()}async function _g(e,t){const o=await f(y(`${F}/commit-files`,e,{hash:t}));if(!o.ok)throw new Error(`Failed to get commit files: ${o.statusText}`);return o.json()}async function Xh(e,t,o,r){const n=await f(y(`${F}/commit-file-diff`,e,{hash:t,path:o,binary:r?"true":void 0}));if(!n.ok)throw new Error(`Failed to get commit file diff: ${n.statusText}`);return n.json()}async function Ng(){const e=await f(y(`${F}/identities`,void 0));if(!e.ok)throw new Error(`Failed to get git identities: ${e.statusText}`);return e.json()}async function Ug(e){const t=await f(y(`${F}/identities`,void 0),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to create git identity")}return t.json()}async function Lg(e,t){const o=await f(y(`${F}/identities/${e}`,void 0),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to update git identity")}return o.json()}async function Hg(e){const t=await f(y(`${F}/identities/${e}`,void 0),{method:"DELETE"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to delete git identity")}}async function jg(e){if(!e)return null;const t=await f(y(`${F}/current-identity`,e));if(!t.ok)throw new Error(`Failed to get current git identity: ${t.statusText}`);const o=await t.json();return o?{userName:o.userName??null,userEmail:o.userEmail??null,sshCommand:o.sshCommand??null}:null}async function zg(e){if(!e)return!1;const t=await f(y(`${F}/has-local-identity`,e));if(!t.ok)throw new Error(`Failed to check local identity: ${t.statusText}`);return(await t.json().catch(()=>null))?.hasLocalIdentity===!0}async function Zh(){const e=await f(y(`${F}/global-identity`,void 0));if(!e.ok)throw new Error(`Failed to get global git identity: ${e.statusText}`);const t=await e.json();return!t||!t.userName&&!t.userEmail?null:{userName:t.userName??null,userEmail:t.userEmail??null,sshCommand:t.sshCommand??null}}async function $g(e,t){const o=await f(y(`${F}/set-identity`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to set git identity")}return o.json()}async function eF(){const e=await f(y(`${F}/discover-credentials`,void 0));if(!e.ok)throw new Error(`Failed to discover git credentials: ${e.statusText}`);return e.json()}async function tF(e,t){if(!e)return null;const o=await f(y(`${F}/remote-url`,e,{remote:t}));return o.ok?(await o.json()).url??null:null}async function Gg(e){const t=await f(y(`${F}/remotes`,e));if(!t.ok)throw new Error(`Failed to get remotes: ${t.statusText}`);return t.json()}async function qg(e,t){const o=await f(y(`${F}/rebase`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to rebase")}return o.json()}async function Wg(e){const t=await f(y(`${F}/rebase/abort`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to abort rebase")}return t.json()}async function Vg(e,t){const o=await f(y(`${F}/merge`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to merge")}return o.json()}async function Kg(e,t){const o=await f(y(`${F}/checkout-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to checkout commit")}return o.json()}async function Jg(e,t){const o=await f(y(`${F}/cherry-pick`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to cherry-pick")}return o.json()}async function Yg(e,t){const o=await f(y(`${F}/revert-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t})});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||"Failed to revert commit")}return o.json()}async function Qg(e,t,o,r){const n=await f(y(`${F}/reset-to-commit`,e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hash:t,mode:o,force:r})});if(!n.ok){const a=await n.json().catch(()=>({error:n.statusText}));throw new Error(a.error||"Failed to reset")}return n.json()}async function Xg(e){const t=await f(y(`${F}/merge/abort`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to abort merge")}return t.json()}async function Zg(e){const t=await f(y(`${F}/rebase/continue`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to continue rebase")}return t.json()}async function ep(e){const t=await f(y(`${F}/merge/continue`,e),{method:"POST"});if(!t.ok){const o=await t.json().catch(()=>({error:t.statusText}));throw new Error(o.error||"Failed to continue merge")}return t.json()}async function tp(e,t){return await Ds(e,{message:t?.message}),{success:!0}}async function op(e){return await ks(e,{ref:"stash@{0}"}),{success:!0}}async function rp(e){const t=await f(y(`${F}/conflict-details`,e));if(!t.ok)throw new Error(`Failed to get conflict details: ${t.statusText}`);return t.json()}async function np(e,t){const o=await f(`${F}/validate-directory`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e,worktreeRoot:t})});if(!o.ok)throw new Error(`Failed to validate worktree directory: ${o.statusText}`);return o.json()}async function ap(e){const t=await f(`${F}/canonicalize-worktree-state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:e})});if(!t.ok)throw new Error(`Failed to canonicalize worktree state: ${t.statusText}`);return t.json()}const sp=()=>({checkIsGitRepository:ag,getGitStatus:sg,getGitDiff:ig,getGitFileDiff:cg,revertGitFile:dg,stageGitFile:lg,stageGitFiles:Cs,unstageGitFile:ug,unstageGitFiles:Bs,stageGitHunk:fg,unstageGitHunk:mg,revertGitHunk:gg,isLinkedWorktree:pg,getGitBranches:hg,deleteGitBranch:Fg,deleteRemoteBranch:yg,removeRemote:bg,generateCommitMessage:Ag,generatePullRequestDescription:wg,listGitWorktrees:Kn,validateGitWorktree:Jn,createGitWorktree:Yn,deleteGitWorktree:Qn,validateWorktreeDirectory:np,canonicalizeWorktreeState:ap,createGitCommit(e,t,o){return Bg(e,t,o)},gitPush:Dg,gitPull:kg,gitFetch:vg,listGitStashes:Sg,countGitStashFiles:Mg,stashGitChanges:Ds,applyGitStash:Tg,popGitStash:ks,dropGitStash:Pg,checkoutBranch:Rg,createBranch:Ig,renameBranch:xg,getGitLog(e,t){return Og(e,t)},getCommitFiles:_g,getCurrentGitIdentity:jg,hasLocalIdentity:zg,setGitIdentity:$g,getGitIdentities:Ng,createGitIdentity:Ug,updateGitIdentity:Lg,deleteGitIdentity:Hg,getRemotes:Gg,rebase:qg,abortRebase:Wg,continueRebase:Zg,merge:Vg,abortMerge:Xg,continueMerge:ep,checkoutCommit:Kg,cherryPick:Jg,revertCommit:Yg,resetToCommit:Qg,stash:tp,stashPop:op,getConflictDetails:rp,worktree:{list:Kn,validate:Jn,bootstrapStatus:Eg,preview:Cg,create:Yn,remove:Qn}}),K=e=>e.replace(/\\/g,"/"),ip=(e,t)=>{const o=K(t?.directory||t?.path||e),r=Array.isArray(t?.entries)?t.entries:[];return{directory:o,entries:r.filter(n=>!!(n&&typeof n.name=="string"&&typeof n.path=="string")).map(n=>({name:n.name,path:K(n.path),isDirectory:!!n.isDirectory}))}},he=(e,t)=>{const o=t||e?.();return o?{"x-opencode-directory":o}:void 0},cp=({getDirectory:e})=>({async listDirectory(t,o){const r=K(t),n=new URLSearchParams;r&&n.set("path",r),o?.respectGitignore&&n.set("respectGitignore","true");const a=await f("/api/fs/list",{query:n,headers:he(e)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to list directory")}const s=await a.json();return ip(r,s)},async search(t){const o=new URLSearchParams,r=K(t.directory);r&&o.set("directory",r),o.set("query",t.query),o.set("dirs","false"),o.set("type","file"),typeof t.maxResults=="number"&&Number.isFinite(t.maxResults)&&o.set("limit",String(t.maxResults));const n=await f("/api/find/file",{query:o,headers:he(e)});if(!n.ok){const i=await n.json().catch(()=>({error:n.statusText}));throw new Error(i.error||"Failed to search files")}const a=await n.json();return(Array.isArray(a)?a:[]).map(i=>({path:K(`${r}/${i}`),preview:[K(i)]}))},async createDirectory(t){const o=K(t),r=await f("/api/fs/mkdir",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to create directory")}const n=await r.json();return{success:!!n?.success,path:typeof n?.path=="string"?K(n.path):o}},async statFile(t,o){const r=K(t),n=new URLSearchParams({path:r});o?.allowOutsideWorkspace&&n.set("allowOutsideWorkspace","true"),o?.outsideFileGrant&&n.set("outsideFileGrant",o.outsideFileGrant);const a=await f("/api/fs/stat",{query:n,headers:he(e,o?.directory)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to stat file")}const s=await a.json().catch(()=>({}));return{path:typeof s.path=="string"?K(s.path):r,isFile:!!s.isFile,size:typeof s.size=="number"?s.size:0,mtimeMs:typeof s.mtimeMs=="number"?s.mtimeMs:void 0}},async readFile(t,o){const r=K(t),n=new URLSearchParams({path:r});o?.allowOutsideWorkspace&&n.set("allowOutsideWorkspace","true"),o?.outsideFileGrant&&n.set("outsideFileGrant",o.outsideFileGrant),o?.optional&&n.set("optional","true");const a=await f("/api/fs/read",{query:n,cache:o?.optional?"no-store":"default",headers:he(e,o?.directory)});if(!a.ok){const i=await a.json().catch(()=>({error:a.statusText}));throw new Error(i.error||"Failed to read file")}return{content:await a.text(),path:r}},async writeFile(t,o){const r=K(t),n=await f("/api/fs/write",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:r,content:o})});if(!n.ok){const s=await n.json().catch(()=>({error:n.statusText}));throw new Error(s.error||"Failed to write file")}const a=await n.json().catch(()=>({}));return{success:!!a.success,path:typeof a.path=="string"?K(a.path):r}},async delete(t){const o=K(t),r=await f("/api/fs/delete",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to delete file")}return{success:!!(await r.json().catch(()=>({}))).success}},async rename(t,o){const r=await f("/api/fs/rename",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({oldPath:t,newPath:o})});if(!r.ok){const a=await r.json().catch(()=>({error:r.statusText}));throw new Error(a.error||"Failed to rename file")}const n=await r.json().catch(()=>({}));return{success:!!n.success,path:typeof n.path=="string"?K(n.path):o}},async revealPath(t){const o=await f("/api/fs/reveal",{method:"POST",headers:{"Content-Type":"application/json",...he(e)},body:JSON.stringify({path:K(t)})});if(!o.ok){const n=await o.json().catch(()=>({error:o.statusText}));throw new Error(n.error||"Failed to reveal path")}return{success:!!(await o.json().catch(()=>({}))).success}},async downloadFile(t){const o=K(t),r=await f("/api/fs/raw",{query:{path:o,download:!0},headers:he(e)});if(!r.ok)throw new Error(`Download failed (${r.status})`);const n=await r.blob(),a=URL.createObjectURL(n),s=document.createElement("a");s.href=a,s.download=o.split("/").pop()||"file",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),100)}}),Xn="/api/config/settings",dp="/api/config/reload",Zn=e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid settings response");return e},lp=()=>({async load(){const e=await f(Xn,{method:"GET",headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`Failed to load settings: ${e.statusText}`);return{settings:Zn(await e.json()),source:"web"}},async save(e){const t=await f(Xn,{method:"PUT",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(e)});if(!t.ok){const r=await t.json().catch(()=>({error:t.statusText}));throw new Error(r.error||"Failed to save settings")}return Zn(await t.json())},async restartOpenCode(){const e=await f(dp,{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({error:e.statusText}));throw new Error(t.error||"Failed to restart OpenCode")}return{restarted:!0}}}),up=()=>({async requestDirectoryAccess(e){return{success:!0,path:e.path}},async startAccessingDirectory(e){return{success:!0}},async stopAccessingDirectory(e){return{success:!0}}}),fp=1500,Br=5e3,mp="openchamber-notification-claim:",vt=new Map,gp=()=>typeof document>"u"?!0:document.visibilityState==="visible"&&document.hasFocus(),pp=e=>{const t=typeof e?.tag=="string"?e.tag.trim():"";return t||[e?.sessionId,e?.kind,e?.title,e?.body].filter(o=>typeof o=="string"&&o.trim().length>0).map(o=>o.trim()).join("|")},hp=e=>{for(const[t,o]of vt)e-o>Br&&vt.delete(t)},Fp=e=>{const t=pp(e);if(!t)return!0;const o=Date.now();hp(o);const r=vt.get(t)??0;if(o-r<Br)return!1;try{if(typeof window<"u"&&window.localStorage){const n=`${mp}${t}`,a=Number(window.localStorage.getItem(n)??"0");if(Number.isFinite(a)&&o-a<Br)return vt.set(t,a),!1;Number.isFinite(a)&&a>0&&window.localStorage.removeItem(n),window.localStorage.setItem(n,String(o))}}catch{}return vt.set(t,o),!0},vs=async()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;let e=null;try{e=await navigator.serviceWorker.getRegistration()??null}catch{e=null}if(e?.active)return e;if(!e)return null;try{return await Promise.race([navigator.serviceWorker.ready,new Promise(o=>{setTimeout(()=>o(null),fp)})])??e}catch{return e}},yp=async e=>{const t=await vs();if(!t||typeof t.showNotification!="function")return!1;try{return await t.showNotification(e?.title??"OpenChamber",{body:e?.body,tag:e?.tag}),!0}catch(o){return console.warn("Failed to send notification via service worker",o),!1}},bp=async()=>{const e=await vs();if(!e||!("pushManager"in e)||!e.pushManager)return!1;try{return!!await e.pushManager.getSubscription()}catch{return!1}},Ap=async e=>{if(e?.requireHidden&&typeof document<"u"&&document.hasFocus())return!0;if(typeof Notification>"u")return console.info("Notifications not supported in this environment",e),!1;if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return console.warn("Notification permission not granted"),!1;if(!gp()&&await bp()||!Fp(e))return!0;try{return await yp(e)||new Notification(e?.title??"OpenChamber",{body:e?.body,tag:e?.tag}),!0}catch(t){return console.warn("Failed to send notification",t),!1}},wp=async e=>{if(typeof window>"u")return!1;const t=window.__OPENCHAMBER_DESKTOP__;if(!t?.invoke)return!1;try{return await t.invoke("desktop_notify",{payload:{title:e?.title,body:e?.body,tag:e?.tag,kind:e?.kind,sessionId:e?.sessionId,directory:e?.directory,requireHidden:e?.requireHidden}}),!0}catch(o){return console.warn("Failed to send native notification (desktop)",o),!1}},Ep=()=>({async notifyAgentCompletion(e){return await wp(e)||await Ap(e)},canNotify:()=>typeof window<"u"&&window.__OPENCHAMBER_DESKTOP__?.invoke?!0:typeof Notification<"u"?Notification.permission==="granted":!1}),Cp=()=>({async getAvailableTools(){const e=await f("/api/experimental/tool/ids");if(!e.ok)throw new Error(`Tools API returned ${e.status} ${e.statusText}`);const t=await e.json();if(!Array.isArray(t))throw new Error("Tools API returned invalid data format");return t.filter(o=>typeof o=="string"&&o!=="invalid").sort()}}),at=async(e,t)=>{try{const o=await f(e,{...t,credentials:"include",headers:{Accept:"application/json",...t?.headers??{}}});return o.ok?await o.json():null}catch{return null}},Bp=()=>({async getVapidPublicKey(){return at("/api/push/vapid-public-key")},async subscribe(e){return at("/api/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async unsubscribe(e){return at("/api/push/subscribe",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async setVisibility(e){return at("/api/push/visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0})},async registerApnsToken(e){return at("/api/push/apns-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})},async unregisterApnsToken(e){return at("/api/push/apns-token",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}),z=async e=>await e.json().catch(()=>null),Dp=({urls:e})=>({async authStatus(){const t=await f("/api/github/auth/status",{method:"GET",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to load GitHub status");return o},async authStart(){const t=await f("/api/github/auth/start",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({})}),o=await z(t);if(!t.ok||!o||!("deviceCode"in o))throw new Error(o?.error||t.statusText||"Failed to start GitHub auth");return o},async authComplete(t){const o=await f("/api/github/auth/complete",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({deviceCode:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to complete GitHub auth");return r},async authDisconnect(){const t=await f("/api/github/auth",{method:"DELETE",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok)throw new Error(o?.error||t.statusText||"Failed to disconnect GitHub");return{removed:!!o?.removed}},async authActivate(t){const o=await f("/api/github/auth/activate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({accountId:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to activate GitHub account");return r},async authSetGhCliDisabled(t){const o=await f("/api/github/auth/gh-cli",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({disabled:t})}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to update gh CLI setting");return{disabled:!!r.disabled}},async me(){const t=await f("/api/github/me",{method:"GET",headers:{Accept:"application/json"}}),o=await z(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to fetch GitHub user");return o},async prStatus(t,o,r,n){const a=new URLSearchParams({directory:t,branch:o,...r?{remote:r}:{},...n?.force?{force:"true"}:{}}),s=await f(`/api/github/pr/status?${a.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),i=await z(s);if(!s.ok||!i)throw new Error(i?.error||s.statusText||"Failed to load PR status");return i},async prCreate(t){const o=await f("/api/github/pr/create",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to create PR");return r},async prUpdate(t){const o=await f("/api/github/pr/update",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to update PR");return r},async prMerge(t){const o=await f("/api/github/pr/merge",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to merge PR");return r},async prReady(t){const o=await f("/api/github/pr/ready",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to mark PR ready");return r},async repoUpstream(t){const o=await f(`/api/github/repo/upstream?directory=${encodeURIComponent(t)}`,{method:"GET",headers:{Accept:"application/json"}}),r=await z(o);if(!o.ok||!r)throw new Error(r?.error||o.statusText||"Failed to detect upstream repo");return r},async repoBranches(t,o){const r=await f(`/api/github/repo/branches?owner=${encodeURIComponent(t)}&repo=${encodeURIComponent(o)}`,{method:"GET",headers:{Accept:"application/json"}}),n=await z(r);if(!r.ok||!n)throw new Error(n?.error||r.statusText||"Failed to fetch repo branches");return n.branches??[]},async prsList(t,o){const r=o?.page??1,n=new URLSearchParams({directory:t,page:String(r)});o?.query&&n.set("query",o.query);const a=await f(`/api/github/pulls/list?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load pull requests");return s},async prContext(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.includeDiff&&n.set("diff","1"),r?.includeCheckDetails&&n.set("checkDetails","1"),r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/pulls/context",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load pull request context");return s},async issuesList(t,o){const r=o?.page??1,n=new URLSearchParams({directory:t,page:String(r)});o?.query&&n.set("query",o.query);const a=await f(`/api/github/issues/list?${n.toString()}`,{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issues");return s},async issueGet(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/issues/get",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issue");return s},async issueComments(t,o,r){const n=new URLSearchParams({directory:t,number:String(o)});r?.sourceRepo?.owner&&r.sourceRepo.repo&&(n.set("owner",r.sourceRepo.owner),n.set("repo",r.sourceRepo.repo));const a=await f(e.api("/api/github/issues/comments",n),{method:"GET",headers:{Accept:"application/json"}}),s=await z(a);if(!a.ok||!s)throw new Error(s?.error||a.statusText||"Failed to load issue comments");return s}}),Me=async e=>await e.json().catch(()=>null),kp=()=>({async listClients(){const e=await f("/api/client-auth/clients",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load remote clients");return Array.isArray(t.clients)?t.clients:[]},async createClient(e={}){const t=await f("/api/client-auth/clients",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({label:e.label??""})}),o=await Me(t);if(!t.ok||!o?.client||typeof o.token!="string")throw new Error(o?.error||t.statusText||"Failed to create remote client token");return o},async createPairingSession(e={}){const t=await f("/api/client-auth/pairing/sessions",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({label:e.label??"",...e.allowedClientKinds?{allowedClientKinds:e.allowedClientKinds}:{},...e.serverUrl?{serverUrl:e.serverUrl}:{},...typeof e.includeRelay=="boolean"?{includeRelay:e.includeRelay}:{},...typeof e.includeDirect=="boolean"?{includeDirect:e.includeDirect}:{}})}),o=await Me(t);if(!t.ok||typeof o?.pairing?.secret!="string"||!o?.server)throw new Error(o?.error||t.statusText||"Failed to create pairing session");return o},async listPendingPairings(){const e=await f("/api/client-auth/pairing/sessions",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load pending pairings");return Array.isArray(t.pending)?t.pending:[]},async getPairingTransports(){const e=await f("/api/client-auth/pairing/transports",{method:"GET",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to load pairing transports");return{local:t.local??null,lan:t.lan??null,relayAvailable:t.relayAvailable!==!1}},async cancelPairing(e){const t=await f(`/api/client-auth/pairing/sessions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}}),o=await Me(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to cancel pairing");return{cancelled:o.cancelled===!0}},async revokeClient(e){const t=await f(`/api/client-auth/clients/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}}),o=await Me(t);if(!t.ok||!o)throw new Error(o?.error||t.statusText||"Failed to revoke remote client");return o},async purgeRevokedClients(){const e=await f("/api/client-auth/clients",{method:"DELETE",headers:{Accept:"application/json"}}),t=await Me(e);if(!e.ok||!t)throw new Error(t?.error||e.statusText||"Failed to clear revoked clients");return t}}),vp=()=>({api:(...e)=>oe().api(...e),authenticatedAsset:(...e)=>oe().authenticatedAsset(...e),auth:(...e)=>oe().auth(...e),health:(...e)=>oe().health(...e),rawFile:(...e)=>oe().rawFile(...e),sse:(...e)=>oe().sse(...e),websocket:(...e)=>oe().websocket(...e)}),Sp=(e={})=>{const t=e.urls??Pr();qi(t);const o=vp();return{runtime:{platform:"web",isDesktop:!1,isVSCode:!1,label:"web"},terminal:og(),git:sp(),files:cp({getDirectory:()=>wr.getState().currentDirectory}),settings:lp(),permissions:up(),notifications:Ep(),github:Dp({urls:o}),push:Bp(),clientAuth:kp(),tools:Cp()}},ea=(e,t)=>{if(!e||!t)return!1;try{return new URL(e).origin===new URL(t).origin}catch{return!1}};let Ss=Promise.resolve();const oF=()=>Ss,rF=()=>{const e=typeof window.__OPENCHAMBER_API_BASE_URL__=="string"?window.__OPENCHAMBER_API_BASE_URL__.trim():"",t=typeof window.__OPENCHAMBER_CLIENT_TOKEN__=="string"?window.__OPENCHAMBER_CLIENT_TOKEN__.trim():"",o=typeof window.__OPENCHAMBER_LOCAL_ORIGIN__=="string"?window.__OPENCHAMBER_LOCAL_ORIGIN__.trim():"",r=Ta({apiBaseUrl:e||void 0,realtimeBaseUrl:e||void 0});rc({apiBaseUrl:e,runtimeKey:ea(e,o)?"local":null}),ba(t||null),Aa(window.__OPENCHAMBER_RUNTIME_HEADERS__||null),Co(e||void 0).catch(()=>{}),o&&!ea(e,o)&&Object.keys(Eo()).length>0&&ka(o).catch(()=>{}),oc();const n=window.__OPENCHAMBER_RELAY_HOST_ID__;return Ss=Promise.race([Lc(typeof n=="string"&&n?n:void 0).catch(()=>{}),new Promise(a=>{window.setTimeout(a,1e4)})]),Sp({urls:r})};export{xd as $,tm as A,sh as B,gc as C,em as D,Gh as E,gt as F,Do as G,ja as H,mh as I,Pc as J,Mc as K,G as L,wa as M,Vp as N,Zf as O,Yp as P,kh as Q,vh as R,Dm as S,Bd as T,ih as U,oe as V,Rp as W,Co as X,Ip as Y,Bh as Z,Kp as _,L as a,Od as a$,Wh as a0,ah as a1,nh as a2,Pm as a3,$h as a4,Tm as a5,Ah as a6,fe as a7,yh as a8,cc as a9,Nd as aA,Up as aB,Eh as aC,md as aD,Fd as aE,gd as aF,yd as aG,po as aH,Ld as aI,ko as aJ,jp as aK,$p as aL,qp as aM,zp as aN,Gp as aO,Wp as aP,hd as aQ,Jp as aR,Xp as aS,Zp as aT,Kh as aU,Lp as aV,Hp as aW,id as aX,km as aY,bh as aZ,Va as a_,ic as aa,xp as ab,Mm as ac,Ch as ad,Op as ae,_p as af,mc as ag,Ur as ah,oh as ai,eh as aj,th as ak,Ut as al,Lh as am,Uh as an,Hh as ao,Rc as ap,fh as aq,Ic as ar,pe as as,Dc as at,za as au,dh as av,lh as aw,ph as ax,rh as ay,jd as az,Lt as b,Cs as b$,Eg as b0,cs as b1,Ua as b2,wo as b3,zm as b4,nc as b5,Xg as b6,Wg as b7,Tg as b8,ap as b9,Og as bA,sg as bB,Zh as bC,tF as bD,Gg as bE,Jn as bF,Kn as bG,vg as bH,kg as bI,Dg as bJ,zg as bK,pg as bL,Sg as bM,Vg as bN,ks as bO,Cg as bP,qg as bQ,bg as bR,xg as bS,Qg as bT,Jh as bU,Yh as bV,Yg as bW,dg as bX,gg as bY,$g as bZ,lg as b_,ag as ba,Rg as bb,Kg as bc,Jg as bd,ep as be,Zg as bf,Mg as bg,Ig as bh,Bg as bi,Ug as bj,Yn as bk,Fg as bl,Hg as bm,Qn as bn,yg as bo,eF as bp,Pg as bq,Xh as br,_g as bs,rp as bt,jg as bu,hg as bv,Qh as bw,ig as bx,cg as by,Ng as bz,rF as c,fg as c0,tp as c1,Ds as c2,op as c3,ug as c4,Bs as c5,mg as c6,Lg as c7,np as c8,Z as c9,pd as cA,uh as cB,wh as ca,fd as cb,dr as cc,Xf as cd,ms as ce,fs as cf,Fh as cg,hh as ch,gh as ci,Uc as cj,Eo as ck,Jt as cl,Wo as cm,nt as cn,Sh as co,Th as cp,xh as cq,Ph as cr,Mh as cs,Rh as ct,is as cu,Ih as cv,qh as cw,Qp as cx,Vh as cy,Dh as cz,Oh as d,wr as e,_r as f,oF as g,Pp as h,Tp as i,vr as j,Bo as k,Np as l,Oa as m,zh as n,Oe as o,Ec as p,jh as q,f as r,nr as s,Nh as t,ie as u,be as v,Na as w,ee as x,ch as y,_h as z};
|