@adhdev/daemon-standalone 1.0.31 → 1.0.32-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/{index-lXuAcqlb.js → index-CYjQsV8D.js} +3 -3
- package/public/assets/{terminal-BZj_X5zy.js → terminal-DiXj2eIR.js} +1 -1
- package/public/assets/{vendor-cL4V2vaO.js → vendor-DyCWA2YZ.js} +57 -49
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js +20 -24
- package/vendor/mcp-server/index.js.map +1 -1
- package/vendor/session-host-daemon/index.js +0 -0
- package/vendor/session-host-daemon/index.mjs +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhdev/daemon-standalone",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32-rc.2",
|
|
4
4
|
"description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "AGPL-3.0-or-later",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@adhdev/ghostty-vt-node": "*",
|
|
40
|
-
"@adhdev/session-host-core": "
|
|
40
|
+
"@adhdev/session-host-core": "1.0.32-rc.2",
|
|
41
41
|
"@xterm/addon-serialize": "^0.14.0",
|
|
42
42
|
"@xterm/xterm": "^6.0.0",
|
|
43
43
|
"chalk": "^5.3.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-
|
|
2
|
-
var Hh=Object.defineProperty;var Fh=(e,t,n)=>t in e?Hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var nt=(e,t,n)=>Fh(e,typeof t!="symbol"?t+"":t,n);import{r as l,j as s,u as Ne,M as $i,a as Bh,b as Wh,c as Oh,t as Uh,d as Gh,i as Ct,e as qh,f as un,R as Pt,T as si,g as Mr,h as ni,k as ri,D as zh,E as Kh,l as Vh,C as Yh,m as Jh,B as Qh,n as Xh,o as Zh,p as ef,H as _r,P as Es,q as tf,s as sf,v as nf,w as $l,x as rf,y as af,z as Hi,A as of,F as lf,G as cf,I as df,J as _s,N as ai,K as uf}from"./vendor-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-DiXj2eIR.js","assets/vendor-DyCWA2YZ.js","assets/terminal-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Hh=Object.defineProperty;var Fh=(e,t,n)=>t in e?Hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var nt=(e,t,n)=>Fh(e,typeof t!="symbol"?t+"":t,n);import{r as l,j as s,u as Ne,M as $i,a as Bh,b as Wh,c as Oh,t as Uh,d as Gh,i as Ct,e as qh,f as un,R as Pt,T as si,g as Mr,h as ni,k as ri,D as zh,E as Kh,l as Vh,C as Yh,m as Jh,B as Qh,n as Xh,o as Zh,p as ef,H as _r,P as Es,q as tf,s as sf,v as nf,w as $l,x as rf,y as af,z as Hi,A as of,F as lf,G as cf,I as df,J as _s,N as ai,K as uf}from"./vendor-DyCWA2YZ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();function pf(e={}){const t=Math.max(1,Math.floor(e.capacity||200)),n=[];return{record(r){const a={id:`webdbg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,ts:Date.now(),...r,payload:r.payload?{...r.payload}:{}};return n.push(a),n.length>t&&n.splice(0,n.length-t),a},list(r={}){const a=Math.max(1,Math.floor(r.limit||100));return n.filter(o=>!r.interactionId||o.interactionId===r.interactionId).filter(o=>!r.topic||o.topic===r.topic).filter(o=>!r.kind||o.kind===r.kind).slice(-a).map(o=>({...o,payload:o.payload?{...o.payload}:{}}))},clear(){n.splice(0,n.length)}}}const Ln=pf();function Hl(e){const t={};for(const n of e)n.transport&&(t[n.transport]=(t[n.transport]||0)+1);return{count:e.length,ids:e.map(n=>n.id),statuses:e.map(n=>String(n.status||"unknown")),transports:t}}function mf(e,t){return typeof e=="string"&&e.trim().length>0&&e!==t}function Fl(e){return Array.isArray(e)?[...e]:[]}function tu(e,t){if(!e)return t??null;const n=Object.prototype.hasOwnProperty.call(e,"messages"),r=Object.prototype.hasOwnProperty.call(e,"activeModal"),a=typeof e.id=="string"?e.id.trim():"",o=typeof(t==null?void 0:t.id)=="string"?t.id.trim():"",i=!!a&&!!o&&a!==o;return t?{...t,...e,messages:n?Fl(e.messages):i?[]:t.messages,activeModal:r?e.activeModal??null:t.activeModal,inputContent:e.inputContent??t.inputContent}:{...e,...n?{messages:Fl(e.messages)}:{},...r?{activeModal:e.activeModal??null}:{}}}function ir(e,t){const n=mf(e.providerName,e.providerType)?e.providerName:void 0;return{...e,parentId:e.parentId??(t==null?void 0:t.parentSessionId)??null,providerSessionId:e.providerSessionId??(t==null?void 0:t.providerSessionId),providerName:n??(t==null?void 0:t.providerName)??(t==null?void 0:t.cliName)??(t==null?void 0:t.type)??e.providerName??e.providerType,title:e.title??(t==null?void 0:t.title)??n??(t==null?void 0:t.providerName)??e.providerName??e.providerType,workspace:e.workspace??(t==null?void 0:t.workspace)??null,mode:e.mode??(t==null?void 0:t.mode),capabilities:e.capabilities??(t==null?void 0:t.sessionCapabilities)??(t==null?void 0:t.capabilities)??[],cdpConnected:e.cdpConnected??(t==null?void 0:t.cdpConnected),activeChat:tu(e.activeChat,t==null?void 0:t.activeChat),activeInteractivePrompt:Object.prototype.hasOwnProperty.call(e,"activeInteractivePrompt")?e.activeInteractivePrompt??null:(t==null?void 0:t.activeInteractivePrompt)??null,controlValues:e.controlValues??(t==null?void 0:t.controlValues),providerControls:e.providerControls??(t==null?void 0:t.providerControls),summaryMetadata:e.summaryMetadata??(t==null?void 0:t.summaryMetadata),runtimeWriteOwner:e.runtimeWriteOwner??(t==null?void 0:t.runtimeWriteOwner),runtimeAttachedClients:e.runtimeAttachedClients??(t==null?void 0:t.runtimeAttachedClients),lastMessagePreview:e.lastMessagePreview??(t==null?void 0:t.lastMessagePreview),lastMessageRole:e.lastMessageRole??(t==null?void 0:t.lastMessageRole),lastMessageAt:e.lastMessageAt??(t==null?void 0:t.lastMessageAt),lastMessageHash:e.lastMessageHash??(t==null?void 0:t.lastMessageHash),unread:e.unread??(t==null?void 0:t.unread),lastSeenAt:e.lastSeenAt??(t==null?void 0:t.lastSeenAt),inboxBucket:e.inboxBucket??(t==null?void 0:t.inboxBucket),completionMarker:e.completionMarker??(t==null?void 0:t.completionMarker),seenCompletionMarker:e.seenCompletionMarker??(t==null?void 0:t.seenCompletionMarker),surfaceHidden:e.surfaceHidden??(t==null?void 0:t.surfaceHidden),muted:e.muted??(t==null?void 0:t.muted),resume:e.resume??(t==null?void 0:t.resume),runtimeKey:e.runtimeKey??(t==null?void 0:t.runtimeKey),runtimeDisplayName:e.runtimeDisplayName??(t==null?void 0:t.runtimeDisplayName),runtimeWorkspaceLabel:e.runtimeWorkspaceLabel??(t==null?void 0:t.runtimeWorkspaceLabel),settings:e.settings??(t==null?void 0:t.settings)}}function su(e,t,n){if(!(t!=null&&t.length))return(n==null?void 0:n.preserveMissing)===!1&&Array.isArray(t)?t:e;if(!(e!=null&&e.length))return t;const r=t.map(a=>{const o=e.find(i=>i.id===a.id);return o?ir(a,o):a});if((n==null?void 0:n.preserveMissing)!==!1){const a=new Set(t.map(o=>o.id));for(const o of e)a.has(o.id)||r.push(o)}return r}function Bl(e){return!!e&&typeof e=="object"&&"text"in e}function Fi(e,t){const n=(t==null?void 0:t.joiner)??" ",r=(t==null?void 0:t.normalizeWhitespace)??!1;let a="";return typeof e=="string"?a=e:Array.isArray(e)?a=e.map(o=>typeof o=="string"?o:Bl(o)?String(o.text||""):"").join(n):Bl(e)?a=String(e.text||""):a=String(e||""),r?a.replace(/\s+/g," ").trim():a}function Rn(e){return Fi(e,{normalizeWhitespace:!0})}function hf(e){let t="";for(let n=0;n<e.length;n++){const r=e[n],a=e.charCodeAt(n);if(!(a<=31&&r!==`
|
|
3
3
|
`&&r!==" ")&&!(a>=127&&a<=159)&&!(a>=8203&&a<=8207||a>=8234&&a<=8238||a===8288||a===65279)&&a!==65533){if(a===65038||a===65039){const o=t.length>0?t[t.length-1]:"";if(!o||o===`
|
|
4
4
|
`||o===" "||o===" ")continue}t+=r}}return t}function Wl(e){var n,r;let t=0;return e.activeChat!==void 0&&(t+=4),e.activeInteractivePrompt!==void 0&&(t+=2),(n=e.childSessions)!=null&&n.length&&(t+=2),e.workspace&&(t+=1),e.machine&&(t+=1),(r=e.agents)!=null&&r.length&&(t+=1),t}function nu(e,t,n){if(n.type!=="adhdev-daemon")return n;const r={...n},a=t.version??n.version??e.version,o=t.serverVersion??e.serverVersion??n.serverVersion,i=t.versionMismatch===!0||e.versionMismatch===!0,c=t.versionUpdateRequired===!0||e.versionUpdateRequired===!0,u=t.versionUpdateReason??e.versionUpdateReason??n.versionUpdateReason;return a&&(r.version=a),o&&(r.serverVersion=o),u&&(r.versionUpdateReason=u),a&&o&&a===o?(delete r.versionMismatch,delete r.serverVersion,delete r.versionUpdateRequired,delete r.versionUpdateReason,r):((t.versionMismatch===!0||i&&a&&o&&a!==o)&&(r.versionMismatch=!0),c&&(r.versionUpdateRequired=!0),r)}function ff(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function oo(e){if(!e||typeof e!="object")return"";const t=e,n=ff(Rn(t.content).slice(0,512));return[String(t.id||""),String(t._localId||""),String(t._turnKey||""),String(t.index??""),String(t.role||""),String(t.receivedAt??t.timestamp??""),n].join(":")}function bf(e,t){if(!Array.isArray(e))return e;if(t!=null&&t.has(e))return{count:e.length,sharedRef:!0};let n=2166136261;for(const r of e){const a=oo(r);for(let o=0;o<a.length;o+=1)n^=a.charCodeAt(o),n=Math.imul(n,16777619)>>>0}return{count:e.length,hash:n.toString(16).padStart(8,"0"),first:oo(e[0]),last:oo(e[e.length-1])}}function oi(e){return!!e&&typeof e=="object"&&"messages"in e&&("activeModal"in e||"inputContent"in e||"status"in e)}function ii(e,t,n){if(!e||!t||typeof e!="object"||typeof t!="object")return;if(oi(e)&&oi(t)){const i=e.messages;Array.isArray(i)&&i===t.messages&&n.add(i)}if(Array.isArray(e)&&Array.isArray(t)){const i=Math.min(e.length,t.length);for(let c=0;c<i;c+=1)ii(e[c],t[c],n);return}const r=e,a=t,o=new Set([...Object.keys(r),...Object.keys(a)]);for(const i of o)i!=="messages"&&ii(r[i],a[i],n)}function ur(e,t){return Array.isArray(e)?e.map(n=>ur(n,t)):!e||typeof e!="object"?e:oi(e)?Object.fromEntries(Object.entries(e).filter(([r])=>r!=="timestamp"&&r!=="_lastUpdate").sort(([r],[a])=>r.localeCompare(a)).map(([r,a])=>[r,r==="messages"?bf(a,t):ur(a,t)])):Object.fromEntries(Object.entries(e).filter(([n])=>n!=="timestamp"&&n!=="_lastUpdate").sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>[n,ur(r,t)]))}function gf(e,t){try{const n=new WeakSet;return ii(e,t,n),JSON.stringify(ur(e,n))===JSON.stringify(ur(t,n))}catch{return!1}}function li(e,t,n){return gf(e,t)?(e._lastUpdate=n,typeof t.timestamp=="number"&&(e.timestamp=t.timestamp),e):t}function ru(e){var t;return e.daemonId||((t=e.id)==null?void 0:t.split(":")[0])||e.id}function xf(e,t,n){t[n]!==void 0&&(e[n]=t[n])}function Ol(e,t,n,r){var u;const a=(u=t.chats)!=null&&u.length?t.chats:e.chats,o=su(e.childSessions,t.childSessions,{preserveMissing:r}),i=tu(t.activeChat,e.activeChat),c=t.workspace||e.workspace;return nu(e,t,{...e,...t,chats:a,childSessions:o,activeChat:i,workspace:c,_lastUpdate:n})}function vf(e,t,n){var a,o;const r={};t.status&&t.status!==e.status&&(r.status=t.status),t.cdpConnected!==void 0&&(r.cdpConnected=t.cdpConnected),t.childSessions!==void 0&&(r.childSessions=su(e.childSessions,t.childSessions,{preserveMissing:n})),(a=t.chats)!=null&&a.length&&!((o=e.chats)!=null&&o.length)&&(r.chats=t.chats),t.workspace&&(r.workspace=t.workspace);for(const i of["title","providerSessionId","parentSessionId","sessionKind","sessionCapabilities","controlValues","providerControls","summaryMetadata","activeInteractivePrompt","lastMessagePreview","lastMessageRole","lastMessageAt","lastMessageHash","lastUpdated","unread","lastSeenAt","inboxBucket","completionMarker","seenCompletionMarker","surfaceHidden","muted","runtimeKey","runtimeDisplayName","runtimeWorkspaceLabel","runtimeWriteOwner","runtimeAttachedClients","version","serverVersion","versionUpdateReason","versionUpdateRequired","updateCommand","updatePolicy","updateChannel","releaseChannel"])xf(r,t,i);return t.machineNickname!==void 0&&t.machineNickname!==e.machineNickname&&(r.machineNickname=t.machineNickname),t.versionMismatch===!0&&(r.versionMismatch=!0),r}function yf(e,t,n,r){const a=vf(e,t,r),o=Object.keys(a).length>0?nu(e,t,{...e,...a,_lastUpdate:n}):{...e,_lastUpdate:n};return li(e,o,n)}function wf(e){const t=new Set(e.map(o=>o.id)),n=new Set,r=new Set,a=new Set;for(const o of e){const i=ru(o);i&&n.add(i),i&&o.type!=="adhdev-daemon"&&r.add(i),i&&o.type==="adhdev-daemon"&&o._sessionListAuthoritative&&a.add(i)}return{incomingIds:t,incomingDaemonIds:n,daemonIdsWithSessionEntries:r,daemonIdsWithAuthoritativeSessionList:a}}function kf(e,t,n,r,a,o){return!a.has(t)||!o.has(t)||r.has(e.id)?!1:e.transport==="pty"||e.transport==="acp"?n>1e4:e.transport==="cdp-page"?n>3e4:!1}function Sf(e,t,n,r,a){return e.transport?n.has(t)&&!r.has(t)?!0:a.has(t):!1}function Cf(e,t,n){var d,m;const r=Date.now(),a=new Set((n==null?void 0:n.authoritativeDaemonIds)||[]);if(t.length===0)return e.map(f=>({...f,_lastUpdate:r}));const o=new Map;for(const f of t)o.set(f.id,f);const{incomingIds:i,incomingDaemonIds:c,daemonIdsWithSessionEntries:u,daemonIdsWithAuthoritativeSessionList:p}=wf(e);for(const f of e){const g=o.get(f.id);if(!g){o.set(f.id,{...f,_lastUpdate:r});continue}const S=Wl(f),h=Wl(g),x=ru(f),y=!a.has(x);if(S>h){const v=Ol(g,f,r,y);o.set(f.id,li(g,v,r));continue}if(S<h){o.set(f.id,yf(g,f,r,y));continue}const b=v=>typeof v=="number"&&Number.isFinite(v),C=b(f.timestamp)&&b(g.timestamp),j=C?f.timestamp:f.timestamp||r,k=C?g.timestamp:g._lastUpdate||g.timestamp||0;if(j>=k){const v=Ol(g,f,r,y);o.set(f.id,li(g,v,r));continue}(d=f.chats)!=null&&d.length&&!((m=g.chats)!=null&&m.length)&&o.set(f.id,{...g,chats:f.chats})}for(const[f,g]of o){const S=g.daemonId||f.split(":")[0];if(!c.has(S))continue;if(a.has(S)&&p.has(S)&&!i.has(f)){o.delete(f);continue}const h=r-(g._lastUpdate||g.timestamp||0);kf(g,S,h,i,a,u)&&o.delete(f)}for(const[f,g]of o){const S=g.daemonId||f.split(":")[0];if(Sf(g,S,c,u,o))continue;r-(g._lastUpdate||g.timestamp||0)>3e5&&g.status!=="online"&&o.delete(f)}return Array.from(o.values())}function jf(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}const au=l.createContext({ides:[],updateRouteChats:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1,userName:void 0,setUserName:()=>{},isP2PActive:!1,p2pStates:{},userRole:void 0,connectionRetryStatuses:void 0}),ou=l.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Nf({children:e,connectionOverrides:t}){const[n,r]=l.useState([]),[a,o]=l.useState(!1),[i,c]=l.useState([]),[u,p]=l.useState(void 0),d=l.useRef(n);l.useEffect(()=>{d.current=n},[n]);const m=l.useCallback((y,b)=>{r(C=>{let j=!1;const k=C.map(v=>v.id!==y||v.chats===b?v:(j=!0,{...v,chats:b}));return j?k:C})},[]),f=l.useCallback((y,b)=>{r(C=>{const j=C.length===0?y:Cf(y,C,b),k=!jf(C,j);return k&&Ln.record({kind:"dashboard.entries_applied",payload:{incoming:Hl(y),next:Hl(j)}}),k?j:C})},[]),g=l.useCallback(()=>o(!0),[]),S=l.useMemo(()=>({injectEntries:f,markLoaded:g,getIdes:()=>d.current}),[f,g]),h=t,x=l.useMemo(()=>({ides:n,updateRouteChats:m,initialLoaded:a,toasts:i,setToasts:c,wsStatus:(h==null?void 0:h.wsStatus)??"connected",isConnected:(h==null?void 0:h.isConnected)??!0,connectionStates:(h==null?void 0:h.connectionStates)??{},connectionTransports:(h==null?void 0:h.connectionTransports)??{},showReconnected:(h==null?void 0:h.showReconnected)??!1,retryConnection:h==null?void 0:h.retryConnection,retryServerConnection:h==null?void 0:h.retryServerConnection,connectionLoginUrl:h==null?void 0:h.connectionLoginUrl,isP2PActive:(h==null?void 0:h.isP2PActive)??!1,p2pStates:(h==null?void 0:h.p2pStates)??{},userRole:h==null?void 0:h.userRole,connectionRetryStatuses:h==null?void 0:h.connectionRetryStatuses,userName:u,setUserName:p}),[n,m,a,i,h==null?void 0:h.wsStatus,h==null?void 0:h.isConnected,h==null?void 0:h.connectionStates,h==null?void 0:h.connectionTransports,h==null?void 0:h.showReconnected,h==null?void 0:h.retryConnection,h==null?void 0:h.retryServerConnection,h==null?void 0:h.connectionLoginUrl,h==null?void 0:h.isP2PActive,h==null?void 0:h.p2pStates,h==null?void 0:h.userRole,h==null?void 0:h.connectionRetryStatuses,u]);return s.jsx(ou.Provider,{value:S,children:s.jsx(au.Provider,{value:x,children:e})})}function As(){return l.useContext(au)}function yr(){return l.useContext(ou)}function iu(e){const{baseUrl:t,getToken:n,onUnauthorized:r}=e;function a(c){return c.startsWith("http")?c:`${t}${c.startsWith("/")?"":"/"}${c}`}function o(c){const u=n==null?void 0:n(),p=a(c),d=c.startsWith("http")?new URL(p):new URL(p,typeof window<"u"?window.location.origin:"http://localhost");return u&&d.searchParams.set("token",u),!c.startsWith("http")&&!t?`${d.pathname}${d.search}${d.hash}`:d.toString()}async function i(c,u={}){const p={"Content-Type":"application/json",...u.headers||{}},d=n==null?void 0:n();d&&(p.Authorization=`Bearer ${d}`);const m=a(c),f=new AbortController,g=setTimeout(()=>f.abort(),15e3);try{const S=await fetch(m,{...u,headers:p,signal:f.signal});if(S.status===401)throw r==null||r(),new Error("Unauthorized");if(!S.ok){const h=await S.json().catch(()=>({error:S.statusText}));throw new Error(h.error||`API Error: ${S.status}`)}return S.json()}finally{clearTimeout(g)}}return{getDaemons:()=>i("/api/v1/daemons"),getDaemonStatus:c=>i(`/api/v1/daemons/${c}/status`),sendCommand:(c,u,p={})=>i(`/api/v1/daemons/${c}/command`,{method:"POST",body:JSON.stringify({type:u,payload:p})}),execTerminal:(c,u,p)=>i(`/api/v1/daemons/${c}/terminal`,{method:"POST",body:JSON.stringify({command:u,name:p})}),sendAgentMessage:(c,u,p)=>i(`/api/v1/shortcuts/${c}/chat`,{method:"POST",body:JSON.stringify({agentType:u,message:p})}),getAgentStatus:c=>i(`/api/v1/shortcuts/${c}/status`),approveAgent:(c,u,p)=>i(`/api/v1/shortcuts/${c}/approve`,{method:"POST",body:JSON.stringify({agentType:u,action:p?"approve":"reject"})}),getMuxState:c=>i(`/api/v1/mux/${encodeURIComponent(c)}/state`),getMuxSocketInfo:c=>i(`/api/v1/mux/${encodeURIComponent(c)}/socket-info`),controlMux:(c,u,p={})=>i(`/api/v1/mux/${encodeURIComponent(c)}/control`,{method:"POST",body:JSON.stringify({type:u,payload:p})}),getMuxEventsUrl:c=>o(`/api/v1/mux/${encodeURIComponent(c)}/events`),getRuntimeEventsUrl:c=>o(`/api/v1/runtime/${encodeURIComponent(c)}/events`),request:i}}const Af=iu({baseUrl:"http://localhost:3847"}),Tf=l.createContext(Af);function Mf({client:e,children:t}){return s.jsx(Tf.Provider,{value:e,children:t})}const Df={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},lu=l.createContext(Df);function If({value:e,children:t}){return s.jsx(lu.Provider,{value:e,children:t})}function St(){return l.useContext(lu)}function cu(e){return e&&typeof e=="object"&&e.result&&typeof e.result=="object"?e.result:e}function Pf(e){const t=cu(e);if(!t||t.error!=="untrusted_external_provider")return null;const n=t.provider&&typeof t.provider=="object"?t.provider:null;return{providerType:typeof(n==null?void 0:n.type)=="string"?n.type:null,sourceName:typeof(n==null?void 0:n.sourceName)=="string"?n.sourceName:null,description:typeof t.hint=="string"?t.hint:void 0}}function Lf(e){const[t,n]=l.useState(null),r=l.useCallback(async(i,c)=>{const u=m=>e(i,"launch_cli",{...c,...m}),p=await u({}),d=Pf(p);return d?new Promise(m=>{n({providerType:d.providerType||String(c.cliType??"?"),sourceName:d.sourceName,description:d.description,retry:()=>u({confirmExternalUntrusted:!0}),resolve:f=>{f.cancelled?m({success:!1,error:"user_cancelled_untrusted_launch"}):m(f.response)}})}):p},[e]),a=l.useCallback(async()=>{const i=t;if(i){n(null);try{const c=await i.retry(),u=cu(c);u!=null&&u.success?i.resolve({ok:!0,response:c}):i.resolve({ok:!1,error:(u==null?void 0:u.error)||"launch failed after confirm",response:c})}catch(c){i.resolve({ok:!1,error:(c==null?void 0:c.message)||String(c)})}}},[t]),o=l.useCallback(()=>{const i=t;i&&(n(null),i.resolve({ok:!1,cancelled:!0}))},[t]);return{launchCli:r,pending:t,confirm:a,cancel:o}}function Rf({providerType:e,sourceName:t,description:n,onConfirm:r,onCancel:a}){const{t:o}=Ne("common"),i=l.useRef(null);return l.useEffect(()=>{var c;(c=i.current)==null||c.focus()},[]),l.useEffect(()=>{const c=u=>{u.key==="Escape"&&a()};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[a]),s.jsx("div",{role:"dialog","aria-modal":"true","aria-label":o("machine.confirmExternal.dialogAria"),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:a,style:{pointerEvents:"auto"},children:s.jsxs("div",{className:"bg-[var(--surface-primary)] text-text-primary border border-amber-500/40 rounded-lg shadow-xl max-w-lg w-full",onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:"px-4 py-3 border-b border-border-subtle flex items-center gap-2",children:[s.jsx("span",{"aria-hidden":!0,className:"text-amber-400 text-base",children:"⚠"}),s.jsx("h2",{className:"text-sm font-semibold",children:o("machine.confirmExternal.title")})]}),s.jsxs("div",{className:"px-4 py-3 text-[12px] flex flex-col gap-3",children:[s.jsxs("p",{children:["You're about to activate ",s.jsx("span",{className:"font-mono",children:e}),t?s.jsxs(s.Fragment,{children:[" from ",s.jsx("span",{className:"font-mono",children:t})]}):null,"."]}),s.jsx("p",{className:"text-text-secondary",children:n??o("machine.confirmExternal.description")}),s.jsx("p",{className:"text-text-secondary",children:o("machine.confirmExternal.proceedWarning")})]}),s.jsxs("div",{className:"px-4 py-2 border-t border-border-subtle flex justify-end gap-2",children:[s.jsx("button",{ref:i,type:"button",onClick:a,className:"px-3 py-1 text-sm rounded border border-border-default hover:bg-surface-secondary",children:o("machine.confirmExternal.cancel")}),s.jsx("button",{type:"button",onClick:r,className:"px-3 py-1 text-sm rounded bg-amber-500 text-black font-semibold hover:opacity-90",children:o("machine.confirmExternal.activate")})]})]})})}const du=l.createContext(null);function Ef({sendDaemonCommand:e,children:t}){const n=Lf(e),r=l.useMemo(()=>({launchCli:n.launchCli}),[n.launchCli]);return s.jsxs(du.Provider,{value:r,children:[t,n.pending&&s.jsx(Rf,{providerType:n.pending.providerType,sourceName:n.pending.sourceName,description:n.pending.description,onConfirm:n.confirm,onCancel:n.cancel})]})}function $a(){const e=l.useContext(du);return e||{launchCli:async()=>{throw new Error("useLaunchCli must be used inside <LaunchCliProvider>")}}}function uu(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}function _f(e,t,n){return Number(e.receivedAt||n[ba(e)]||0)||0}function pu(e){return/[`*_#[\]()>-]|https?:\/\/|\n\s*[-*]\s|\n\s*\d+\.\s|\|/.test(e)}function $f(e){return Array.isArray(e)&&e.some(t=>!!t&&typeof t=="object"&&"type"in t)}function Kn(e,t){if(!e)return t;try{return(e.startsWith("file://")?new URL(e).pathname:e).split(/[\\/]/).filter(Boolean).pop()||t}catch{return e.split(/[\\/]/).filter(Boolean).pop()||t}}function io(e){if(typeof e.uri=="string"&&e.uri)return e.uri;if(typeof e.data=="string"&&e.data&&typeof e.mimeType=="string"&&e.mimeType)return`data:${e.mimeType};base64,${e.data}`}function Hf(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t^e.charCodeAt(n),t|=0;return(t>>>0).toString(36)}function ba(e,t){const n=e,r=Fi(e.content,{joiner:`
|
|
5
5
|
`}),a=[e.id?`id:${e.id}`:"",n._localId?`local:${n._localId}`:"",n._turnKey?`turn:${n._turnKey}`:"",e.bubbleId?`bubble:${e.bubbleId}`:"",e.providerUnitKey?`unit:${e.providerUnitKey}`:"",typeof e.index=="number"?`msgIndex:${e.index}`:"",typeof e.sequence=="number"?`seq:${e.sequence}`:""].filter(Boolean);if(a.length>0)return a.join("|");const o=e.receivedAt||e.timestamp||0;return[e.role?`role:${e.role}`:"role:",`chash:${Hf(r)}`,o?`ts:${o}`:""].filter(Boolean).join("|")}function Ff(e){let t=2166136261;for(const n of e){const r=String(n||"");for(let a=0;a<r.length;a+=1)t^=r.charCodeAt(a),t=Math.imul(t,16777619)>>>0;t^=255,t=Math.imul(t,16777619)>>>0}return t.toString(16).padStart(8,"0")}function Bf(e){try{return JSON.stringify(e??"")}catch{return String(e??"")}}function mu(e){return e?Ff([String(e.id||""),String(e.index??""),String(e.role||""),String(e.receivedAt??e.timestamp??""),Bf(e.content)]):""}const Bi=200,Wf=80,Ul=650,Vn=new Map;function ga(e,t){if(!e)return!1;const n=String(e.messageFingerprint||"");return n?n===String(t||""):!0}function Of(e,t){if(!Array.isArray(e)||e.length===0)return"0:empty";const n=String(t||"").trim();if(n)return`${e.length}:${n}`;const r=e[e.length-1];return`${e.length}:${mu(r)}`}function Uf(e,t,n,r){return e||!t?!1:ga(n,r)}function Gf({scrollTop:e,scrollHeight:t,clientHeight:n,topThresholdPx:r=Wf,bottomThresholdPx:a=Bi}){const o=Math.max(0,Number(e)||0),i=Math.max(0,Number(t)||0),c=Math.max(0,Number(n)||0);return Math.max(0,i-c)<=0?{showTop:!1,showBottom:!1}:{showTop:o>r,showBottom:Math.max(0,i-o-c)>a}}function qf(e){return Gf({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})}function lr(e,t=Bi){return!!e&&e.fromBottom>=t}function zf(e,t){return ga(e,t)?!lr(e):!0}function Kf({hasSelection:e,userScrolledUp:t,hasChatContentChanged:n=!0}){return!(e||t||!n)}function Vf({hasSelection:e,userScrolledUp:t,contextAutoScrollActive:n}){return e?!1:n||!t}function lo(e,t){const n=Math.max(0,e.scrollHeight-e.clientHeight-t.fromBottom);e.scrollTop=Number.isFinite(n)?n:t.top}const et={size:18};function hu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function Wi({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Os({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),s.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),s.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),s.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function fu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function Yf({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function Jf({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}function bu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),s.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"}),s.jsx("line",{x1:"9",y1:"7",x2:"16",y2:"7"}),s.jsx("line",{x1:"9",y1:"11",x2:"14",y2:"11"})]})}function gu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),s.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),s.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),s.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),s.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function xu({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Ha({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function Oi({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function Qf({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function Xf({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}function bn({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function xs({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function Ui({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),s.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function En({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Fa({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function pn({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function wr({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M12 22v-5"}),s.jsx("path",{d:"M9 8V2"}),s.jsx("path",{d:"M15 8V2"}),s.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function os({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"5",r:"2"}),s.jsx("circle",{cx:"5",cy:"19",r:"2"}),s.jsx("circle",{cx:"19",cy:"19",r:"2"}),s.jsx("line",{x1:"12",y1:"7",x2:"5",y2:"17"}),s.jsx("line",{x1:"12",y1:"7",x2:"19",y2:"17"}),s.jsx("line",{x1:"5",y1:"19",x2:"19",y2:"19"})]})}function Zf({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),s.jsx("polyline",{points:"2 12 12 17 22 12"}),s.jsx("polyline",{points:"2 17 12 22 22 17"})]})}function vu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Gi({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 20C5 20 1 12 1 12a21.8 21.8 0 0 1 5.06-5.94"}),s.jsx("path",{d:"M9.9 4.24A10.93 10.93 0 0 1 12 4c7 0 11 8 11 8a21.77 21.77 0 0 1-2.16 3.19"}),s.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),s.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function yu({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function eb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),s.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),s.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function qi({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"4 17 10 11 4 5"}),s.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function tb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"})]})}function wu({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}function zi({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Mt({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function sb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),s.jsx("path",{d:"M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),s.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),s.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function nb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),s.jsx("path",{d:"M12 2v6"}),s.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function rb({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function ab({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),s.jsx("path",{d:"M12 2c-1.5 2-3 3.5-3 5a3 3 0 0 0 6 0c0-1.5-1.5-3-3-5z"})]})}function Un({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})}function ku({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M8.7 3A6 6 0 0 1 18 8c0 3 .6 5 1.4 6.5"}),s.jsx("path",{d:"M17 17H3s3-2 3-9a5.98 5.98 0 0 1 .6-2.6"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"}),s.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})}function ob({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),s.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),s.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),s.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),s.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),s.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),s.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function ib({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function lb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function Su({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),s.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]})}function cb({size:e=et.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}function db({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),s.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"})]})}function ub({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M14.5 10c-.83 0-1.5-.89-1.5-2s.67-2 1.5-2 1.5.89 1.5 2-.67 2-1.5 2z"}),s.jsx("path",{d:"M9.5 10c-.83 0-1.5-.89-1.5-2s.67-2 1.5-2 1.5.89 1.5 2-.67 2-1.5 2z"}),s.jsx("path",{d:"M19.35 6.07A16.03 16.03 0 0 0 15 4a.84.84 0 0 0-.46.33 11 11 0 0 0-.74 1.5 15.68 15.68 0 0 0-3.6 0 11.23 11.23 0 0 0-.74-1.5A.84.84 0 0 0 9 4a16.03 16.03 0 0 0-4.35 2.07A16.8 16.8 0 0 0 2 15a16.22 16.22 0 0 0 4 3c.12.08.27.06.37-.04a11.14 11.14 0 0 0 1.2-1.92.35.35 0 0 0-.18-.46 10.4 10.4 0 0 1-1.63-.78.36.36 0 0 1 .03-.6 6.8 6.8 0 0 0 .32-.24.36.36 0 0 1 .37-.04c2.2.98 4.6.98 6.8 0a.36.36 0 0 1 .37.04c.1.08.21.16.32.24a.36.36 0 0 1 .03.6 10.4 10.4 0 0 1-1.63.78.35.35 0 0 0-.18.46c.39.67.8 1.3 1.2 1.92a.37.37 0 0 0 .37.04 16.22 16.22 0 0 0 4-3 16.8 16.8 0 0 0-2.65-8.93z"})]})}function pb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"7",width:"15",height:"14",rx:"2"}),s.jsx("path",{d:"M13 2h9v9"}),s.jsx("path",{d:"M22 2L13 11"})]})}function mb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"9 14 4 9 9 4"}),s.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}function hb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("line",{x1:"6",y1:"8",x2:"6.01",y2:"8"}),s.jsx("line",{x1:"10",y1:"8",x2:"10.01",y2:"8"}),s.jsx("line",{x1:"14",y1:"8",x2:"14.01",y2:"8"}),s.jsx("line",{x1:"18",y1:"8",x2:"18.01",y2:"8"}),s.jsx("line",{x1:"6",y1:"12",x2:"6.01",y2:"12"}),s.jsx("line",{x1:"10",y1:"12",x2:"10.01",y2:"12"}),s.jsx("line",{x1:"14",y1:"12",x2:"14.01",y2:"12"}),s.jsx("line",{x1:"18",y1:"12",x2:"18.01",y2:"12"}),s.jsx("line",{x1:"7",y1:"16",x2:"17",y2:"16"})]})}function fb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"6",width:"13",height:"13",rx:"2"}),s.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"})]})}function bb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"}),s.jsx("line",{x1:"3",y1:"12",x2:"12",y2:"12"})]})}function gb({size:e=et.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),s.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}const Cu="adhdev_chat_activity_visible",Gl=new Set(["hidden","debug","internal"]),ql=new Set(["visible","user","chat"]),xb=new Set(["debug","trace","internal"]),vb=new Set(["tool_call","terminal_command","runtime_activity"]),yb=new Set(["runtime_status","provider_chrome","control"]),wb=new Set(["thought","tool","terminal"]);function ju(e){const t=e.meta;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function kn(e){return typeof e=="string"?e.trim().toLowerCase():""}function co(e,t,n){return e[n]??(t==null?void 0:t[n])}function zl(e,t,n){const r=e;return n.some(a=>r[a]===!0||(t==null?void 0:t[a])===!0)}function kb(e,t){const n=kn(e.kind);return n||(t==="tool"?"tool":"standard")}function uo(e,t,n){const r=ju(e),a=typeof(r==null?void 0:r.label)=="string"?r.label.trim():"";return a||(t==="terminal"||n==="terminal_command"?"Terminal":t==="tool"||n==="tool_call"?"Tool":t==="thought"?"Thought":n==="runtime_activity"?"Runtime":"Activity")}function Sb(e){const t=e.content;return Array.isArray(t)&&t.some(n=>!!n&&typeof n=="object"&&n.type!=="text")}function Ki(e){if(!e)return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:"",kind:"standard",label:"Internal"};const t=ju(e),n=kn(e.role),r=kb(e,n),a=kn(co(e,t,"visibility")),o=kn(e.transcriptVisibility??(t==null?void 0:t.transcriptVisibility)??a),i=kn(co(e,t,"audience")),c=kn(co(e,t,"source")),u=Gl.has(a)||Gl.has(o)||xb.has(i)||zl(e,t,["internal","isInternal","debug","statusOnly","controlOnly"]),p=ql.has(a)||ql.has(o)||i==="chat"||zl(e,t,["userFacing"]),d=wb.has(r)||vb.has(c);if(u)return{surface:d?"activity":"internal",isUserFacing:!1,isActivityFacing:d,isInternal:!d,role:n,kind:r,label:uo(e,r,c)};if(p)return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:n,kind:r,label:uo(e,r,c)};if((n==="system"||r==="system")&&Sb(e))return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:n,kind:r,label:"Chat"};if(yb.has(c)||n==="system"||r==="system")return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:n,kind:r,label:"Internal"};if(d)return{surface:"activity",isUserFacing:!1,isActivityFacing:!0,isInternal:!1,role:n,kind:r,label:uo(e,r,c)};const m=(n==="user"||n==="human"||n==="assistant")&&(r==="standard"||r==="");return{surface:m?"chat":"internal",isUserFacing:m,isActivityFacing:!1,isInternal:!m,role:n,kind:r,label:m?"Chat":"Internal"}}function Cb(e){return(Array.isArray(e)?e:[]).filter(t=>Ki(t).isUserFacing)}function Nu(e){return(Array.isArray(e)?e:[]).filter(t=>Ki(t).isActivityFacing)}function Au(e){const t=e.content;return typeof t=="string"?t:(()=>{try{return JSON.stringify(t??"")}catch{return String(t??"")}})()}function jb(e){return`${String(e.role||"")}::${Au(e)}`}function Nb(e){if(e.length<2)return e;const t=[];let n="";for(const r of e){const a=jb(r);Au(r).trim().length>0&&a===n||(t.push(r),n=a)}return t}function Ab(e,t,n){return!n||t.length===0?e:[...e,...t].sort((r,a)=>{const o=Number(r.receivedAt??r.timestamp??0)||0,i=Number(a.receivedAt??a.timestamp??0)||0;if(o!==i)return o-i;const c=Number(r.index??0)||0,u=Number(a.index??0)||0;return c-u})}function Kl(e=typeof localStorage<"u"?localStorage:void 0){try{return(e==null?void 0:e.getItem(Cu))==="1"}catch{return!1}}function Tb({text:e}){const{t}=Ne("common"),[n,r]=l.useState(!1),a=l.useCallback(()=>{navigator.clipboard.writeText(e).catch(()=>{}),r(!0),setTimeout(()=>r(!1),1500)},[e]);return s.jsx("button",{type:"button",onClick:a,"aria-label":t("chat.copyMessage"),className:"chat-copy-btn",children:n?s.jsx(xu,{size:11}):s.jsx(gu,{size:11})})}const Tu=[Bh,{singleTilde:!1}],Mu=[Tu,Wh,Oh],Mb=[Tu];function $r(e,t,n){return s.jsxs("div",{className:"rounded-md border border-border-subtle p-2 text-sm",role:"note",children:[s.jsx("span",{className:"font-medium",children:e}),t?s.jsx("span",{className:"ml-1 break-all",children:t}):null,n?s.jsx("div",{className:"mt-1 opacity-80",style:{whiteSpace:"pre-wrap"},children:n}):null]})}function Vl(e,t){return e?t?s.jsx("pre",{className:"chat-preformatted",children:e}):pu(e)?s.jsx($i,{remarkPlugins:Mu,children:e}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:e}):null}const Db=l.memo(function({content:t,renderAsPreformatted:n,renderAsMarkdown:r}){return n?s.jsx("pre",{className:"chat-preformatted",children:t}):r?s.jsx($i,{remarkPlugins:Mu,children:t}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:t})});function Yn({parts:e,renderAsPreformatted:t}){return s.jsx("div",{className:"flex flex-col gap-2",children:e.map((n,r)=>{if(n.type==="text")return s.jsx("div",{children:Vl(String(n.text||""),t)},`text-${r}`);if(n.type==="image"){const a=io(n),o=n.alt||n.description||Kn(n.uri,"image");return a?s.jsx("img",{src:a,alt:o,className:"max-w-full rounded-md border border-border-subtle"},`image-${r}`):s.jsx("div",{children:$r("Image",o,n.mimeType)},`image-fallback-${r}`)}if(n.type==="audio"){const a=io(n);return a?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("audio",{controls:!0,src:a,className:"max-w-full"}),n.transcript?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:n.transcript}):null]},`audio-${r}`):s.jsx("div",{children:$r("Audio",Kn(n.uri,"audio"),n.transcript||n.mimeType)},`audio-fallback-${r}`)}if(n.type==="video"){const a=io(n),o=n.title||n.name||n.alt||Kn(n.uri,"video"),i=[n.transcript,n.description,n.mimeType].filter(Boolean).join(`
|
|
6
6
|
`);return s.jsxs("div",{className:"flex flex-col gap-1",children:[a?s.jsx("video",{controls:!0,src:a,poster:n.posterUri,className:"max-w-full rounded-md border border-border-subtle"}):$r("Video",o,i),a&&i?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:i}):null]},`video-${r}`)}if(n.type==="resource_link"){const a=n.title||n.name||Kn(n.uri,"resource"),o=[n.description,n.mimeType].filter(Boolean).join(`
|
|
7
7
|
`);return s.jsxs("div",{className:"flex flex-col gap-1",children:[n.uri?s.jsx("a",{href:n.uri,target:"_blank",rel:"noreferrer",download:!0,className:"underline break-all",children:a}):$r("Resource",a,o),n.uri&&o?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:o}):null]},`resource-link-${r}`)}if(n.type==="resource"&&n.resource){const a=Kn(n.resource.uri,"resource");if(n.resource.text)return s.jsxs("div",{className:"rounded-md border border-border-subtle p-2",children:[s.jsx("div",{className:"text-[11px] opacity-70 mb-1",children:a}),Vl(n.resource.text,!0)]},`resource-${r}`);if(n.resource.uri)return s.jsx("a",{href:n.resource.uri,target:"_blank",rel:"noreferrer",className:"underline break-all",children:a},`resource-uri-${r}`)}return null})})}const Ib=l.memo(function({log:t}){return s.jsxs("div",{className:"self-center chat-msg-action",children:[s.jsx($i,{remarkPlugins:Mb,children:t.text}),s.jsx("span",{className:"action-time",children:uu(t.timestamp)})]})},(e,t)=>e.log===t.log);function Yl(e){const t=e.meta;return[mu(e),e.kind||"",e.senderName||"",e.bubbleId||"",e.bubbleState||"",e.visibility||"",e.transcriptVisibility||"",e.audience||"",e.source||"",e.userFacing===void 0?"":String(e.userFacing),e.internal===void 0?"":String(e.internal),e.isInternal===void 0?"":String(e.isInternal),e.debug===void 0?"":String(e.debug),t?String(t.label??""):"",t?String(t.isRunning??""):"",t?String(t.renderMode??""):""].join("")}const Pb=l.memo(function({message:t,receivedAt:n,agentName:r,userName:a,isCliMode:o,isTextExpanded:i,onToggleTextExpanded:c}){var w,A,T;const u=(t.role||"").toLowerCase(),p=u==="user"||u==="human",d=t.kind||(u==="tool"?"tool":"standard"),m=Ki(t),f=$f(t.content)?t.content:null,g=!!(f!=null&&f.some(I=>I.type!=="text")),S=Fi(t.content,{joiner:`
|
|
8
|
-
`});if(m.isActivityFacing&&d!=="thought"&&d!=="tool"&&d!=="terminal"){const I=m.label||"Activity";return s.jsxs("div",{className:"self-start chat-msg-activity","data-chat-activity-row":"true",children:[s.jsxs("div",{className:"chat-msg-activity-meta","aria-label":"Activity message",children:[s.jsx("span",{className:"activity-dot"}),s.jsx("span",{children:I})]}),g&&f?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:S})]})}if(d==="thought"){const I=typeof((w=t.meta)==null?void 0:w.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(rb,{size:13}),s.jsx("span",{children:I})]}),s.jsx("div",{className:"chat-msg-body",children:S})]})}if(d==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-tool-meta","aria-label":"Tool message",children:[s.jsx("span",{className:"tool-icon",children:"⏺"}),s.jsx("span",{className:"tool-label",children:"Tool"})]}),g&&f?s.jsx("div",{className:"tool-text w-full",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:S})]});if(d==="terminal"){const I=(A=t.meta)!=null&&A.isRunning?"⏳":"✅",P=typeof((T=t.meta)==null?void 0:T.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:I}),s.jsx("span",{children:P})]}),g&&f?s.jsx("div",{className:"chat-msg-body",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:S})]})}if(d==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:g&&f?s.jsx(Yn,{parts:f,renderAsPreformatted:!1}):S.slice(0,100)});const h=t.meta,y=(typeof(h==null?void 0:h.renderMode)=="string"?h.renderMode.trim():"")==="preformatted",b=S,C=!1,j=b,k=y,v=!p&&!k&&pu(j),N=["chat-message-row",p?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:N,children:(b||g||p)&&s.jsxs("div",{className:`chat-bubble ${p?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${b||g?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:p?a||"You":t.senderName||r}),s.jsxs("span",{className:"chat-bubble-header-end",children:[(b||g)&&s.jsx(Tb,{text:S}),n!=null&&s.jsx("span",{className:"chat-time",children:uu(n)})]})]}),(b||g)&&s.jsx("div",{className:"chat-markdown",children:g&&f?s.jsx(Yn,{parts:f,renderAsPreformatted:k}):s.jsx(Db,{content:j,renderAsPreformatted:k,renderAsMarkdown:v})}),C]})})},(e,t)=>(e.message===t.message||Yl(e.message)===Yl(t.message))&&e.receivedAt===t.receivedAt&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isTextExpanded===t.isTextExpanded),Lb=l.forwardRef(function({messages:t,actionLogs:n,agentName:r="Agent",userName:a,isCliMode:o=!1,isWorking:i=!1,contextKey:c="",receivedAtMap:u={},lastMessageHash:p,showActivityMessages:d=!1,emptyState:m,onLoadMore:f,isLoadingMore:g,hasMoreHistory:S,hiddenLiveCount:h=0,loadError:x,scrollToBottomRequestNonce:y,isVisible:b=!0},C){const{t:j}=Ne("common"),k=l.useRef(null),v=l.useRef(null),N=l.useRef(null),w=l.useRef(0),A=l.useRef(""),T=l.useRef(""),I=l.useRef(!1),P=l.useRef(null),D=l.useRef(!1),_=l.useRef(null),W=l.useRef(!1),[$,E]=l.useState(new Set),[B,L]=l.useState({showTop:!1,showBottom:!1}),R=l.useRef(!1),M=l.useRef(!1),F=l.useRef(b),K=l.useRef(b),J=l.useRef(null);K.current=b;const V=()=>{const de=k.current;return de?de.scrollHeight-de.scrollTop-de.clientHeight<Bi:!0},Y=l.useCallback(()=>{const de=k.current,H=de?qf(de):{showTop:!1,showBottom:!1};L(he=>he.showTop===H.showTop&&he.showBottom===H.showBottom?he:H)},[]),se=l.useCallback((de="auto")=>{var he;const H=k.current;H&&(H.scrollTo({top:H.scrollHeight,behavior:de}),(he=H.ownerDocument.defaultView)==null||he.requestAnimationFrame(()=>Y()))},[Y]),ie=l.useCallback((de="auto")=>{var he;const H=k.current;H&&(H.scrollTo({top:0,behavior:de}),(he=H.ownerDocument.defaultView)==null||he.requestAnimationFrame(()=>Y()))},[Y]),Z=l.useCallback(()=>{var ye;const de=k.current,H=(ye=window.getSelection)==null?void 0:ye.call(window);if(!de||!H||H.rangeCount===0||H.isCollapsed){W.current=!1;return}const he=H.anchorNode,fe=H.focusNode;W.current=!!(he&&fe&&de.contains(he)&&de.contains(fe))},[]),O=l.useMemo(()=>{const de=Cb(t),H=Nu(t);return Nb(Ab(de,H,d))},[t,d]),ee=O.length===t.length?p:void 0,G=Of(O,ee),le=l.useCallback(()=>{const de=k.current;if(!de||!c||!K.current)return;const H={top:de.scrollTop,fromBottom:Math.max(0,de.scrollHeight-de.scrollTop-de.clientHeight),messageFingerprint:G};J.current={contextKey:c,snapshot:H},Vn.set(c,H)},[c,G]),je=l.useCallback((de="auto")=>{P.current!=null&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{P.current=null,se(de)})},[se]),ge=l.useCallback(()=>{R.current=!1,D.current=!0,M.current=!0,_.current!=null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{D.current=!1,_.current=null},Ul)},[]);l.useEffect(()=>{const de=!I.current,H=T.current!==c;if(T.current=c,de||H){I.current=!0;const fe=c?Vn.get(c):null,ye=!!fe&&ga(fe,G);R.current=ye?lr(fe):!1,D.current=zf(fe,G),W.current||(ye?requestAnimationFrame(()=>{const Pe=k.current;Pe&&(lo(Pe,fe),R.current=lr(fe),Y(),M.current=!0)}):je("auto")),w.current=O.length,A.current=G;return}O.length>w.current;const he=G!==A.current;Kf({hasSelection:W.current,userScrolledUp:R.current,hasChatContentChanged:he})&&je("auto"),w.current=O.length,A.current=G},[G,c,O.length,je,Y]),l.useEffect(()=>{y&&(ge(),W.current||je("auto"))},[ge,je,y]),l.useEffect(()=>{const de=F.current;de&&!b&&le(),K.current=b,F.current=b;const H=c?Vn.get(c):null;if(Uf(de,b,H,G)){if(!H)return;R.current=lr(H),D.current=!1,W.current||requestAnimationFrame(()=>{const he=k.current;he&&(lo(he,H),Y())});return}},[b,c,G,ge,le,je,Y]),l.useEffect(()=>()=>{const de=J.current;de&&Vn.set(de.contextKey,de.snapshot),P.current!=null&&cancelAnimationFrame(P.current),_.current!=null&&window.clearTimeout(_.current)},[]),l.useEffect(()=>{const de=v.current,H=k.current;if(!de||!H)return;const he=()=>{_.current!=null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{D.current=!1,_.current=null},Ul)},fe=new ResizeObserver(()=>{Y();const ye=D.current;Vf({hasSelection:W.current,userScrolledUp:R.current,contextAutoScrollActive:ye})&&(je("auto"),ye&&he())});return fe.observe(de),H!==de&&fe.observe(H),()=>{fe.disconnect(),_.current!=null&&(window.clearTimeout(_.current),_.current=null)}},[je,c,Y]),l.useImperativeHandle(C,()=>({scrollToBottom:(de="smooth")=>{se(de)}}),[se]),l.useEffect(()=>{const de=k.current;if(!de)return;let H;const he=()=>{le(),clearTimeout(H),H=setTimeout(()=>{R.current=!V(),Y()},50)};return de.addEventListener("scroll",he,{passive:!0}),()=>{de.removeEventListener("scroll",he),clearTimeout(H)}},[le,Y]),l.useEffect(()=>(document.addEventListener("selectionchange",Z),()=>document.removeEventListener("selectionchange",Z)),[Z]);const Ce=l.useRef(0),ue=l.useRef(!1);l.useEffect(()=>{const de=k.current;if(!de||!ue.current||Ce.current===0)return;const H=de.scrollHeight-Ce.current;H>0&&(de.scrollTop=H),Y(),le(),Ce.current=0,ue.current=!1},[O.length,le,Y]),l.useEffect(()=>{if(M.current||!c)return;const de=Vn.get(c),H=k.current;if(!(!de||!H)){if(!ga(de,G)){se("auto"),M.current=!0;return}lo(H,de),R.current=lr(de),Y(),M.current=!0}},[c,G,O.length,se,Y]);const z=()=>{const de=k.current;de&&(Ce.current=de.scrollHeight),ue.current=!0,f==null||f()},U=()=>{R.current=!0,ie("smooth"),le()},q=()=>{ge(),se("smooth"),le()},Q=l.useMemo(()=>{const de=O.map((ye,Pe)=>({type:"message",data:ye,index:Pe,ts:_f(ye,Pe,u)}));if(!n||n.length===0)return de;const H=[...n].sort((ye,Pe)=>ye.timestamp-Pe.timestamp).map((ye,Pe)=>({type:"action",data:ye,index:Pe,ts:ye.timestamp})),he=[];let fe=0;for(const ye of de){for(;fe<H.length&&ye.ts>0&&H[fe].ts<ye.ts;)he.push(H[fe++]);he.push(ye)}for(;fe<H.length;)he.push(H[fe++]);return he},[O,n,u]),me=h>0||!!S,Ae=h>0?h>80?j("chatList.showEarlierMessagesHidden",{count:Math.min(h,80),total:h}):j("chatList.showEarlierMessages",{count:Math.min(h,80)}):x?j("chatList.loadErrorRetry",{error:x}):j("chatList.loadOlderMessages");return s.jsxs("div",{className:"chat-scroll-frame",children:[s.jsx("div",{ref:k,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:v,className:"chat-container-content",children:[g&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:j("chatList.loadingOlderMessages")}),me&&!g&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:z,className:`text-[11px] rounded-xl px-4 py-1.5 cursor-pointer border transition-all ${x&&h===0?"bg-transparent border-yellow-500/30 text-yellow-400 opacity-80 hover:opacity-100":"bg-transparent border-border-subtle text-text-muted opacity-70 hover:opacity-100 hover:border-accent/40"}`,children:Ae})}),Q.length===0&&!me&&(m||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:j("chatList.waitingForMessages")})),Q.map(de=>{if(de.type==="action"){const He=de.data;return s.jsx(Ib,{log:He},`action-${de.index}`)}const H=de.data;de.index;const he=ba(H),fe=H.receivedAt||u[he],ye=`${c}-${he}`,Pe=$.has(ye);return s.jsx(Pb,{message:H,receivedAt:fe,agentName:r,userName:a,isCliMode:o,isTextExpanded:Pe,onToggleTextExpanded:()=>E(He=>{const ke=new Set(He);return Pe?ke.delete(ye):ke.add(ye),ke})},`msg-${he}`)}),i&&s.jsx("div",{className:"self-start chat-typing-wrapper",children:s.jsxs("div",{className:"typing-indicator",children:[s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:j("chatList.agentGenerating")})]})}),s.jsx("div",{className:"min-h-10",ref:N})]})}),(B.showTop||B.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":j("chatList.jumpToTop"),children:[B.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:U,"aria-label":j("chatList.jumpToOldestMessages"),title:j("chatList.jumpToTop"),children:j("chatList.top")}),B.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:q,"aria-label":j("chatList.jumpToLatestMessages"),title:j("chatList.jumpToBottom"),children:j("chatList.latest")})]})]})}),Rb=l.memo(Lb,(e,t)=>e.messages===t.messages&&e.actionLogs===t.actionLogs&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isWorking===t.isWorking&&e.contextKey===t.contextKey&&e.receivedAtMap===t.receivedAtMap&&e.lastMessageHash===t.lastMessageHash&&e.showActivityMessages===t.showActivityMessages&&e.emptyState===t.emptyState&&e.onLoadMore===t.onLoadMore&&e.isLoadingMore===t.isLoadingMore&&e.hasMoreHistory===t.hasMoreHistory&&e.hiddenLiveCount===t.hiddenLiveCount&&e.loadError===t.loadError&&e.scrollToBottomRequestNonce===t.scrollToBottomRequestNonce&&e.isVisible===t.isVisible),Eb="modulepreload",_b=function(e){return"/"+e},Jl={},$b=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));a=Promise.allSettled(n.map(u=>{if(u=_b(u),u in Jl)return;Jl[u]=!0;const p=u.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":Eb,p||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),p)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})};let Ql=!1;const Du=l.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:n,fontSize:r=13,readOnly:a=!1,sizingMode:o="measured"},i)=>{const c=l.useRef(null),[u,p]=l.useState(null),d=l.useRef([]),m=l.useRef(!1),f=l.useRef(!1),g=l.useRef(!1),S=l.useRef(!1),h=()=>{const x=c.current;if(x){m.current&&(x.clear(),m.current=!1);for(const y of d.current)x.write(y.data,y.onProcessed);d.current=[],f.current&&(x.fit(),f.current=!1),g.current&&(x.bumpResize(),g.current=!1),S.current&&(x.scrollToTop(),S.current=!1)}};return l.useImperativeHandle(i,()=>({write:(x,y)=>{c.current?c.current.write(x,y):d.current.push({data:x,onProcessed:y})},clear:()=>{c.current?c.current.clear():(d.current=[],m.current=!0)},reset:()=>{c.current&&typeof c.current.reset=="function"?c.current.reset():(d.current=[],m.current=!0)},resize:(x,y)=>{c.current&&typeof c.current.resize=="function"&&c.current.resize(x,y)},fit:()=>{c.current?c.current.fit():f.current=!0},bumpResize:()=>{c.current?c.current.bumpResize():g.current=!0},scrollToTop:()=>{c.current?c.current.scrollToTop():S.current=!0},getSelection:()=>{var x,y;return((y=(x=c.current)==null?void 0:x.getSelection)==null?void 0:y.call(x))||""},getVisibleText:()=>{var x,y;return((y=(x=c.current)==null?void 0:x.getVisibleText)==null?void 0:y.call(x))||""}}),[]),l.useEffect(()=>{u&&h()},[u]),l.useEffect(()=>{let x=!1;return $b(()=>import("./terminal-BZj_X5zy.js"),__vite__mapDeps([0,1,2])).then(y=>{Ql||(Ql=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),x||p(()=>y.GhosttyTerminalView)}).catch(y=>{console.error("[CliTerminal] failed to load terminal renderer",y)}),()=>{x=!0}},[]),u?s.jsx(u,{ref:c,onInput:e,onViewportMetrics:t,onScrollMetrics:n,fontSize:r,readOnly:a,sizingMode:o,className:"w-full h-full rounded-lg overflow-hidden"}):s.jsx("div",{className:"w-full h-full rounded-lg overflow-hidden animate-pulse",style:{background:"#0f1117"}})});Du.displayName="CliTerminal";function Wt(...e){return Uh(Gh(e))}const Hb={lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl"},Fb={none:"",sm:"p-3",md:"px-4 py-3.5",lg:"px-5 py-4"},Ls=l.forwardRef(function({radius:t="xl",padding:n="md",className:r,...a},o){return s.jsx("div",{ref:o,className:Wt("border border-border-subtle bg-bg-secondary",Hb[t],Fb[n],r),...a})});function Hr({label:e,value:t,sub:n,icon:r}){return s.jsxs(Ls,{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-base flex items-center",children:r}),s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),s.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),n&&s.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:n})]})}function Xl({value:e,max:t,label:n,color:r="#8b5cf6",detail:a,compact:o=!1}){const i=t>0?Math.min(Math.round(e/t*100),100):0,c=i>85?"#ef4444":i>60?"var(--status-warning)":r;return o?s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-0.5",children:[s.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:n}),s.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[i,"%"]})]}),s.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${i}%`,background:c}})})]}):s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-1.5",children:[s.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:n}),s.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[i,"%"]})]}),s.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${i}%`,background:`linear-gradient(90deg, ${c}, ${c}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function Bb({cursorPos:e,viewportRef:t,imgRef:n}){var b;if(!e||!n.current)return null;const r=n.current,a=r.getBoundingClientRect(),o=(b=t.current)==null?void 0:b.getBoundingClientRect();if(!o)return null;const i=r.naturalWidth||a.width,c=r.naturalHeight||a.height,u=i/c,p=a.width/a.height;let d,m,f,g;u>p?(d=a.width,m=a.width/u,f=0,g=(a.height-m)/2):(m=a.height,d=a.height*u,f=(a.width-d)/2,g=0);const S=a.left-o.left+f+d*e.nx,h=a.top-o.top+g+m*e.ny,x=Math.max(8,Math.min(o.width-8,S)),y=Math.max(8,Math.min(o.height-8,h));return s.jsxs("div",{style:{position:"absolute",left:x-8,top:y-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[s.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})}function Wb({inputMode:e,onToggleInputMode:t,isImeOpen:n,setIsImeOpen:r,isMenuOpen:a,setIsMenuOpen:o,imeText:i,setImeText:c,handleImeSubmit:u,isConnActive:p,zoom:d,isMobile:m,mobileFillZoom:f,onZoomOut:g,onZoomReset:S,onZoomIn:h,transportType:x,screenshotUsage:y,lastActionStatus:b}){const{t:C}=Ne("common");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:j=>j.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-20 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[s.jsxs("div",{onClick:t,className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${e==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[s.jsx("span",{className:"text-sm",children:e==="mouse"?"🖱️":"👆"}),s.jsx("span",{className:`text-[10px] font-bold ${e==="mouse"?"text-blue-400":"text-slate-400"}`,children:C(e==="mouse"?"remote.mouse":"remote.touch")})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>{r(j=>!j),o(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${n?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⌨️"})}),n&&s.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-20",style:{animation:"slideUp 0.15s ease-out"},children:s.jsx("input",{type:"text",placeholder:C("remote.typeAndEnter"),value:i,autoFocus:!0,onTouchStart:j=>j.stopPropagation(),onChange:j=>c(j.target.value),onKeyDown:j=>{u(j)},className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),s.jsx("div",{className:"relative",children:s.jsx("div",{onClick:()=>{o(j=>!j),r(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${a?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⚙️"})})}),s.jsx("div",{className:"w-px h-[18px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:p?"rgba(34,197,94,0.12)":"rgba(234,179,8,0.12)"},children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#22c55e":"#eab308",boxShadow:p?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:p?"#22c55e":"#eab308"},children:C(p?"remote.connected":"remote.ws")})]}),d>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(d*100),"%"]}),x==="direct"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"#22c55e",background:"rgba(34,197,94,0.12)"},title:C("remote.directP2PTitle"),children:C("remote.direct")}),x==="relay"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"var(--status-warning)",background:"color-mix(in srgb, var(--status-warning) 12%, transparent)"},title:C("remote.turnRelayTitle"),children:C("remote.relay")}),y&&y.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:y.budgetExhausted?"#ef4444":"#c4b5fd",background:y.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:C("remote.dailyTurnTitle"),children:y.budgetExhausted?C("remote.turnBlocked"):C("remote.turnUsage",{used:y.dailyUsedMinutes,budget:y.dailyBudgetMinutes})}),b&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:b})]})]}),a&&s.jsxs("div",{onTouchStart:j=>j.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:20,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[s.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:C("remote.settings")}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:[C("remote.zoom")," ",d<=(m?f:1)+.01?C(m?"remote.fill":"remote.fit"):`${Math.round(d*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:j=>{j.stopPropagation(),g()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),s.jsx("button",{onClick:j=>{j.stopPropagation(),S()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:C(m?"remote.fill":"remote.fit")}),s.jsx("button",{onClick:j=>{j.stopPropagation(),h()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]})]})]})}function Ob({waitingLabel:e,waitingHint:t,transportType:n}){const{t:r}=Ne("common");return s.jsxs("div",{className:"text-center flex flex-col items-center gap-3 px-6",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center border border-white/10 bg-white/[0.04] shadow-[0_10px_30px_rgba(0,0,0,0.35)]",style:{animation:"remote-float 2.8s ease-in-out infinite"},children:s.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-8 h-8 opacity-90"})}),s.jsx("div",{className:"text-white/85 text-[13px] font-semibold tracking-wide",children:e}),s.jsx("div",{className:"text-[11px] text-white/40",children:t}),n==="relay"&&s.jsx("div",{className:"text-[10px] font-medium",style:{color:"var(--status-warning)",opacity:.8},children:r("remote.waitingState.turnRelayActive")})]})}function Ub(){if(typeof window>"u")return!1;try{return window.__ADHDEV_DEBUG_RENDERS__===!0||window.localStorage.getItem("adhdev_debug_renders")==="1"}catch{return window.__ADHDEV_DEBUG_RENDERS__===!0}}function Zl(e){return e==null||typeof e=="number"||typeof e=="boolean"?e:typeof e=="string"?e.length>64?`${e.slice(0,61)}...`:e:Array.isArray(e)?`Array(${e.length})`:typeof e=="object"?"Object":typeof e}function Dr(e,t){const n=l.useRef(null),r=l.useRef(0);l.useEffect(()=>{if(!Ub())return;r.current+=1;const a=n.current;if(!a){console.debug(`[render-trace] ${e}#${r.current}`,{changed:["mount"],snapshot:Object.fromEntries(Object.entries(t).map(([i,c])=>[i,Zl(c)]))}),n.current=t;return}const o=Object.keys({...a,...t}).filter(i=>!Object.is(a[i],t[i]));o.length>0&&console.debug(`[render-trace] ${e}#${r.current}`,{changed:o,snapshot:Object.fromEntries(o.map(i=>[i,Zl(t[i])]))}),n.current=t})}function Gb({containerRef:e,viewportRef:t,imgRef:n,inputMode:r,setInputMode:a,minZoom:o,zoomRef:i,panXRef:c,panYRef:u,setPanX:p,setPanY:d,setZoom:m,lastWheelTimeRef:f,onAction:g,setLastActionStatus:S,spawnRippleFromNormalized:h,clampPan:x,isMobile:y,mobileFillZoom:b}){const[C,j]=l.useState(null),k=l.useRef(null),v=l.useRef(null),N=l.useRef(null),w=l.useRef(!1),A=l.useRef(null),T=l.useRef(0),I=l.useRef(null),P=l.useRef(1),D=l.useRef({x:0,y:0}),_=l.useRef(!1),W=l.useRef(r),$=l.useRef(g),E=30,B=550,L=18,R=60,M=400,F=12,K=()=>{if(k.current)return;const Y={nx:.5,ny:.5};k.current=Y,j(Y)};return l.useEffect(()=>{W.current=r,r==="mouse"&&K()},[r]),l.useEffect(()=>{$.current=g},[g]),l.useEffect(()=>{const Y=e.current;if(!Y)return;const se=le=>{if(!n.current)return null;const je=n.current.getBoundingClientRect();return!je.width||!je.height?null:{nx:Math.max(0,Math.min(1,(le.clientX-je.left)/je.width)),ny:Math.max(0,Math.min(1,(le.clientY-je.top)/je.height))}},ie=(le,je)=>{if(!n.current)return{dnx:0,dny:0};const ge=n.current,Ce=ge.getBoundingClientRect(),ue=ge.naturalWidth||Ce.width,z=ge.naturalHeight||Ce.height,U=ue/z,q=Ce.width/Ce.height;let Q,me;return U>q?(Q=Ce.width,me=Ce.width/U):(me=Ce.height,Q=Ce.height*U),{dnx:le/Q,dny:je/me}},Z=(le,je,ge)=>{if(ge<=1.05)return;const Ce=-(le-.5)*100,ue=-(je-.5)*100,z=x(Ce,ue,ge);(Math.abs(z.x-c.current)>.1||Math.abs(z.y-u.current)>.1)&&(p(z.x),d(z.y),c.current=z.x,u.current=z.y)},O=le=>{const je=t.current;if(je&&le.target instanceof Node&&je.contains(le.target))le.preventDefault();else return;if(le.touches.length===1){const ge=le.touches[0];v.current={x:ge.clientX,y:ge.clientY,time:Date.now()},N.current={x:ge.clientX,y:ge.clientY},_.current||(w.current=!1),A.current=setTimeout(()=>{if(!w.current&&!_.current)if(w.current=!0,W.current==="mouse"){const Ce=k.current||{nx:.5,ny:.5};S("Right Click"),h(Ce.nx,Ce.ny,"right"),$.current("input_click",{...Ce,button:"right"}).catch(()=>{})}else{const Ce=se(ge);Ce&&(S("Right Click"),h(Ce.nx,Ce.ny,"right"),$.current("input_click",{...Ce,button:"right"}).catch(()=>{}))}},500);return}if(le.touches.length===2){A.current&&clearTimeout(A.current),w.current=!0,_.current=!0;const ge=le.touches[1].clientX-le.touches[0].clientX,Ce=le.touches[1].clientY-le.touches[0].clientY;I.current=Math.sqrt(ge*ge+Ce*Ce),P.current=i.current,D.current={x:(le.touches[0].clientX+le.touches[1].clientX)/2,y:(le.touches[0].clientY+le.touches[1].clientY)/2}}},ee=le=>{const je=t.current;if(je&&le.target instanceof Node&&je.contains(le.target)&&le.preventDefault(),le.touches.length===1&&N.current){const ge=le.touches[0],Ce=ge.clientX-N.current.x,ue=ge.clientY-N.current.y;if(!w.current&&v.current){const z=ge.clientX-v.current.x,U=ge.clientY-v.current.y;Math.sqrt(z*z+U*U)>8&&(w.current=!0,A.current&&clearTimeout(A.current))}if(w.current)if(W.current==="mouse"){const z=ie(Ce,ue),U=k.current||{nx:.5,ny:.5},q=Math.max(0,Math.min(1,U.nx+z.dnx)),Q=Math.max(0,Math.min(1,U.ny+z.dny));k.current={nx:q,ny:Q},j({nx:q,ny:Q}),S(`Cursor: ${Math.round(q*100)}%, ${Math.round(Q*100)}%`),Z(q,Q,i.current);const me=Date.now();me-f.current>=30&&(f.current=me,$.current("input_mouseMoved",{nx:q,ny:Q}).catch(()=>{}))}else if(i.current>1){const z=t.current;if(z){const U=z.clientWidth,q=z.clientHeight,Q=c.current+Ce/U*100,me=u.current+ue/q*100,Ae=x(Q,me,i.current);p(Ae.x),d(Ae.y),c.current=Ae.x,u.current=Ae.y}}else{const z=se(ge);if(z){const U=Date.now();U-f.current>=40&&(f.current=U,S("Scroll"),$.current("input_wheel",{nx:z.nx,ny:z.ny,deltaX:Math.round(-Ce*2.5),deltaY:Math.round(-ue*2.5)}).catch(()=>{}))}}N.current={x:ge.clientX,y:ge.clientY};return}if(le.touches.length===2&&I.current!==null){const ge=le.touches[1].clientX-le.touches[0].clientX,Ce=le.touches[1].clientY-le.touches[0].clientY,z=Math.sqrt(ge*ge+Ce*Ce)/I.current,U=(le.touches[0].clientX+le.touches[1].clientX)/2,q=(le.touches[0].clientY+le.touches[1].clientY)/2,Q=U-D.current.x,me=q-D.current.y,Ae=Math.abs(z-1)>.03;if(W.current==="mouse"){if(Ae){const de=Math.max(o,Math.min(5,P.current*z));m(de),i.current=de}else if(Math.abs(Q)>2||Math.abs(me)>2){const de=k.current||{nx:.5,ny:.5},H=Date.now();H-f.current>=30&&(f.current=H,S("Scroll"),$.current("input_wheel",{nx:de.nx,ny:de.ny,deltaX:Math.round(-Q*3),deltaY:Math.round(-me*3)}).catch(()=>{}))}}else{const de=Math.max(o,Math.min(5,P.current*z));m(de),i.current=de;const H=t.current;if(H&&de>1){const he=H.clientWidth,fe=H.clientHeight,ye=c.current+Q/he*100,Pe=u.current+me/fe*100,He=x(ye,Pe,de);p(He.x),d(He.y),c.current=He.x,u.current=He.y}}D.current={x:U,y:q}}},G=le=>{var je;if(A.current&&clearTimeout(A.current),I.current=null,le.touches.length===1&&_.current){const ge=le.touches[0];v.current={x:ge.clientX,y:ge.clientY,time:Date.now()},N.current={x:ge.clientX,y:ge.clientY},w.current=!0;return}if(le.touches.length===0){if(_.current){_.current=!1,w.current=!1;return}if(le.changedTouches.length===1){const ge=le.changedTouches[0],Ce=Date.now(),ue=Ce-(((je=v.current)==null?void 0:je.time)||0),z=v.current?ge.clientX-v.current.x:0,U=v.current?ge.clientY-v.current.y:0,q=Math.sqrt(z*z+U*U);if(W.current==="mouse"){if(ue<E||ue>B||q>L){w.current=!1;return}const Q=k.current||se(ge);Q&&(S(`Click: ${Math.round(Q.nx*100)}%, ${Math.round(Q.ny*100)}%`),h(Q.nx,Q.ny,"left"),$.current("input_click",{...Q}).catch(()=>{}))}else{if(w.current){w.current=!1;return}if(ue<R||ue>M||q>F){w.current=!1;return}const Q=se(ge);if(!Q)return;Ce-T.current<300?(S("Double tap"),h(Q.nx,Q.ny,"double"),$.current("input_click",{...Q,clickCount:2}).catch(()=>{}),T.current=0):(S(`Tap: ${Math.round(Q.nx*100)}%, ${Math.round(Q.ny*100)}%`),h(Q.nx,Q.ny,"left"),$.current("input_click",{...Q}).catch(()=>{}),T.current=Ce)}}w.current=!1}};return Y.addEventListener("touchstart",O,{passive:!1}),Y.addEventListener("touchmove",ee,{passive:!1}),Y.addEventListener("touchend",G,{passive:!1}),()=>{Y.removeEventListener("touchstart",O),Y.removeEventListener("touchmove",ee),Y.removeEventListener("touchend",G),A.current&&clearTimeout(A.current)}},[e,t,n,o,i,c,u,p,d,m,f,S,h,x]),{cursorPos:C,cursorPosRef:k,handleToggleInputMode:()=>{a(Y=>{const se=Y==="touch"?"mouse":"touch";return se==="mouse"&&K(),se})},handleZoomReset:()=>{const Y=y?b:1;m(Y),i.current=Y,p(0),d(0),c.current=0,u.current=0}}}function Iu({onAction:e,addLog:t,connState:n,connScreenshot:r,screenshotUsage:a,transportType:o}){const i=l.useRef(null),c=l.useRef(null),u=l.useRef(null),[p,d]=l.useState(null),[m,f]=l.useState(""),[,g]=l.useState(!1),[S,h]=l.useState([]),x=l.useRef(0),[y,b]=l.useState(!1),[C,j]=l.useState(!1),k=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[v,N]=l.useState(k?"mouse":"touch"),[w,A]=l.useState(1),T=l.useRef(!1),[I,P]=l.useState(1),[D,_]=l.useState(0),[W,$]=l.useState(0);Dr("RemoteView",{connState:n,hasScreenshot:!!r,inputMode:v,zoom:I,panX:D,panY:W,isMenuOpen:y,isImeOpen:C});const E=l.useRef(0),B=l.useRef(I),L=l.useRef(D),R=l.useRef(W);l.useEffect(()=>{B.current=I},[I]),l.useEffect(()=>{L.current=D},[D]),l.useEffect(()=>{R.current=W},[W]),l.useEffect(()=>{var ue;(ue=i.current)==null||ue.focus()},[]);const M=n==="connected",F=r,K=M?"Connected. Waiting for first frame...":n==="connecting"?"Connecting to Host...":"Reconnecting to Host...",J=M?"The remote stream is warming up":"Waiting for the remote stream to catch up";l.useEffect(()=>{if(!k||T.current||!F)return;const ue=u.current,z=c.current;if(!ue||!z)return;const U=()=>{const q=z.clientWidth,Q=z.clientHeight,me=ue.naturalWidth,Ae=ue.naturalHeight;if(!me||!Ae||!q||!Q)return;const de=Math.min(q/me,Q/Ae),he=Math.max(q/me,Q/Ae)/de;he>1.01&&(A(he),P(he),B.current=he),T.current=!0};ue.complete&&ue.naturalWidth?U():ue.addEventListener("load",U,{once:!0})},[F,k]);const V=.5;l.useEffect(()=>{I<=V&&(_(0),$(0))},[I,V]);const Y=(ue,z,U)=>{if(U<=V)return{x:0,y:0};const q=(U-1)/(2*U)*100,Q=(U-1)/(2*U)*100;return{x:Math.max(-q,Math.min(q,ue)),y:Math.max(-Q,Math.min(Q,z))}},se=(ue,z)=>{if(!u.current)return null;const U=u.current.getBoundingClientRect();return!U.width||!U.height?null:{nx:Math.max(0,Math.min(1,(ue-U.left)/U.width)),ny:Math.max(0,Math.min(1,(z-U.top)/U.height))}},ie=(ue,z,U)=>{const q=c.current;if(!q)return;const Q=q.getBoundingClientRect(),me=++x.current;h(Ae=>[...Ae,{id:me,x:ue-Q.left,y:z-Q.top,type:U}]),setTimeout(()=>h(Ae=>Ae.filter(de=>de.id!==me)),600)},Z=(ue,z,U)=>{const q=u.current,Q=c.current;if(!q||!Q)return;const me=q.getBoundingClientRect(),Ae=Q.getBoundingClientRect(),de=q.naturalWidth||me.width,H=q.naturalHeight||me.height,he=de/H,fe=me.width/me.height;let ye,Pe,He,ke;he>fe?(ye=me.width,Pe=me.width/he,He=0,ke=(me.height-Pe)/2):(Pe=me.height,ye=me.height*he,He=(me.width-ye)/2,ke=0);const pe=me.left-Ae.left+He+ye*ue,st=me.top-Ae.top+ke+Pe*z,De=++x.current;h(_e=>[..._e,{id:De,x:pe,y:st,type:U}]),setTimeout(()=>h(_e=>_e.filter(ae=>ae.id!==De)),600)},O=async ue=>{var U;const z=se(ue.clientX,ue.clientY);if(z){d(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),ie(ue.clientX,ue.clientY,"left"),(U=i.current)==null||U.focus();try{const q=await e("input_click",{nx:z.nx,ny:z.ny});q!=null&&q.success||t(`❌ Click failed: ${q==null?void 0:q.error}`)}catch(q){t(`❌ Click error: ${q.message||q}`)}}},ee=async(ue,z,U,q=0)=>{try{await e("input_key",{type:U?"char":"keyDown",key:ue,code:z,text:U?ue:void 0,unmodifiedText:U?ue:void 0,modifiers:q})}catch(Q){t(`❌ Key error: ${Q.message||Q}`)}},G=async ue=>{if(ue.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ue.key)&&ue.preventDefault();let U=0;ue.altKey&&(U|=1),ue.ctrlKey&&(U|=2),ue.metaKey&&(U|=4),ue.shiftKey&&(U|=8),d(`Key: ${ue.key}`),await ee(ue.key,ue.code,ue.key.length===1,U)},le=async ue=>{if(ue.key==="Enter"){if(ue.nativeEvent.isComposing)return;if(m){const z=m;f(""),d(`IME Sent: ${z}`);try{const U=await e("input_type",{text:z});U!=null&&U.success||t(`❌ IME error: ${U==null?void 0:U.error}`)}catch(U){t(`❌ IME error: ${U.message}`)}}else d("Key: Enter"),await ee("Enter","Enter",!1)}};l.useEffect(()=>{const ue=i.current;if(!ue)return;const z=U=>{var q;if((q=u.current)!=null&&q.contains(U.target)){U.preventDefault();const Q=Date.now();if(Q-E.current<40)return;E.current=Q;const me=se(U.clientX,U.clientY);if(!me)return;d(`Scroll: ${Math.round(U.deltaY)}`),e("input_wheel",{nx:me.nx,ny:me.ny,deltaX:Math.round(U.deltaX),deltaY:Math.round(U.deltaY)}).catch(()=>{})}};return ue.addEventListener("wheel",z,{passive:!1}),()=>ue.removeEventListener("wheel",z)},[e]);const{cursorPos:je,handleToggleInputMode:ge,handleZoomReset:Ce}=Gb({containerRef:i,viewportRef:c,imgRef:u,inputMode:v,setInputMode:N,minZoom:V,zoomRef:B,panXRef:L,panYRef:R,setPanX:_,setPanY:$,setZoom:P,lastWheelTimeRef:E,onAction:e,setLastActionStatus:d,spawnRippleFromNormalized:Z,clampPan:Y,isMobile:k,mobileFillZoom:w});return s.jsxs("div",{ref:i,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:G,onContextMenu:ue=>ue.preventDefault(),onFocus:()=>g(!0),onBlur:()=>g(!1),tabIndex:0,children:[s.jsxs("div",{ref:c,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[F?s.jsx("img",{ref:u,src:F,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${I}) translate(${D}%, ${W}%)`,transformOrigin:"center center",cursor:v==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:O,onContextMenu:ue=>ue.preventDefault(),onDragStart:ue=>ue.preventDefault()}):s.jsx(Ob,{waitingLabel:K,waitingHint:J,transportType:o}),v==="mouse"&&F&&s.jsx(Bb,{cursorPos:je,viewportRef:c,imgRef:u}),S.map(ue=>{const U={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[ue.type];return s.jsxs("div",{style:{position:"absolute",left:ue.x,top:ue.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${U}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${U}, 0.9)`,boxShadow:`0 0 12px rgba(${U}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},ue.id)})]}),s.jsx(Wb,{inputMode:v,onToggleInputMode:ge,isImeOpen:C,setIsImeOpen:j,isMenuOpen:y,setIsMenuOpen:b,imeText:m,setImeText:f,handleImeSubmit:le,isConnActive:M,zoom:I,isMobile:k,mobileFillZoom:w,onZoomOut:()=>P(ue=>Math.max(.5,ue-.25)),onZoomReset:Ce,onZoomIn:()=>P(ue=>Math.min(5,ue+.25)),transportType:o,screenshotUsage:a,lastActionStatus:p}),s.jsx("style",{children:`
|
|
8
|
+
`});if(m.isActivityFacing&&d!=="thought"&&d!=="tool"&&d!=="terminal"){const I=m.label||"Activity";return s.jsxs("div",{className:"self-start chat-msg-activity","data-chat-activity-row":"true",children:[s.jsxs("div",{className:"chat-msg-activity-meta","aria-label":"Activity message",children:[s.jsx("span",{className:"activity-dot"}),s.jsx("span",{children:I})]}),g&&f?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:S})]})}if(d==="thought"){const I=typeof((w=t.meta)==null?void 0:w.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(rb,{size:13}),s.jsx("span",{children:I})]}),s.jsx("div",{className:"chat-msg-body",children:S})]})}if(d==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-tool-meta","aria-label":"Tool message",children:[s.jsx("span",{className:"tool-icon",children:"⏺"}),s.jsx("span",{className:"tool-label",children:"Tool"})]}),g&&f?s.jsx("div",{className:"tool-text w-full",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:S})]});if(d==="terminal"){const I=(A=t.meta)!=null&&A.isRunning?"⏳":"✅",P=typeof((T=t.meta)==null?void 0:T.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":m.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:I}),s.jsx("span",{children:P})]}),g&&f?s.jsx("div",{className:"chat-msg-body",children:s.jsx(Yn,{parts:f,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:S})]})}if(d==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:g&&f?s.jsx(Yn,{parts:f,renderAsPreformatted:!1}):S.slice(0,100)});const h=t.meta,y=(typeof(h==null?void 0:h.renderMode)=="string"?h.renderMode.trim():"")==="preformatted",b=S,C=!1,j=b,k=y,v=!p&&!k&&pu(j),N=["chat-message-row",p?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:N,children:(b||g||p)&&s.jsxs("div",{className:`chat-bubble ${p?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${b||g?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:p?a||"You":t.senderName||r}),s.jsxs("span",{className:"chat-bubble-header-end",children:[(b||g)&&s.jsx(Tb,{text:S}),n!=null&&s.jsx("span",{className:"chat-time",children:uu(n)})]})]}),(b||g)&&s.jsx("div",{className:"chat-markdown",children:g&&f?s.jsx(Yn,{parts:f,renderAsPreformatted:k}):s.jsx(Db,{content:j,renderAsPreformatted:k,renderAsMarkdown:v})}),C]})})},(e,t)=>(e.message===t.message||Yl(e.message)===Yl(t.message))&&e.receivedAt===t.receivedAt&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isTextExpanded===t.isTextExpanded),Lb=l.forwardRef(function({messages:t,actionLogs:n,agentName:r="Agent",userName:a,isCliMode:o=!1,isWorking:i=!1,contextKey:c="",receivedAtMap:u={},lastMessageHash:p,showActivityMessages:d=!1,emptyState:m,onLoadMore:f,isLoadingMore:g,hasMoreHistory:S,hiddenLiveCount:h=0,loadError:x,scrollToBottomRequestNonce:y,isVisible:b=!0},C){const{t:j}=Ne("common"),k=l.useRef(null),v=l.useRef(null),N=l.useRef(null),w=l.useRef(0),A=l.useRef(""),T=l.useRef(""),I=l.useRef(!1),P=l.useRef(null),D=l.useRef(!1),_=l.useRef(null),W=l.useRef(!1),[$,E]=l.useState(new Set),[B,L]=l.useState({showTop:!1,showBottom:!1}),R=l.useRef(!1),M=l.useRef(!1),F=l.useRef(b),K=l.useRef(b),J=l.useRef(null);K.current=b;const V=()=>{const de=k.current;return de?de.scrollHeight-de.scrollTop-de.clientHeight<Bi:!0},Y=l.useCallback(()=>{const de=k.current,H=de?qf(de):{showTop:!1,showBottom:!1};L(he=>he.showTop===H.showTop&&he.showBottom===H.showBottom?he:H)},[]),se=l.useCallback((de="auto")=>{var he;const H=k.current;H&&(H.scrollTo({top:H.scrollHeight,behavior:de}),(he=H.ownerDocument.defaultView)==null||he.requestAnimationFrame(()=>Y()))},[Y]),ie=l.useCallback((de="auto")=>{var he;const H=k.current;H&&(H.scrollTo({top:0,behavior:de}),(he=H.ownerDocument.defaultView)==null||he.requestAnimationFrame(()=>Y()))},[Y]),Z=l.useCallback(()=>{var ye;const de=k.current,H=(ye=window.getSelection)==null?void 0:ye.call(window);if(!de||!H||H.rangeCount===0||H.isCollapsed){W.current=!1;return}const he=H.anchorNode,fe=H.focusNode;W.current=!!(he&&fe&&de.contains(he)&&de.contains(fe))},[]),O=l.useMemo(()=>{const de=Cb(t),H=Nu(t);return Nb(Ab(de,H,d))},[t,d]),ee=O.length===t.length?p:void 0,G=Of(O,ee),le=l.useCallback(()=>{const de=k.current;if(!de||!c||!K.current)return;const H={top:de.scrollTop,fromBottom:Math.max(0,de.scrollHeight-de.scrollTop-de.clientHeight),messageFingerprint:G};J.current={contextKey:c,snapshot:H},Vn.set(c,H)},[c,G]),je=l.useCallback((de="auto")=>{P.current!=null&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{P.current=null,se(de)})},[se]),ge=l.useCallback(()=>{R.current=!1,D.current=!0,M.current=!0,_.current!=null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{D.current=!1,_.current=null},Ul)},[]);l.useEffect(()=>{const de=!I.current,H=T.current!==c;if(T.current=c,de||H){I.current=!0;const fe=c?Vn.get(c):null,ye=!!fe&&ga(fe,G);R.current=ye?lr(fe):!1,D.current=zf(fe,G),W.current||(ye?requestAnimationFrame(()=>{const Pe=k.current;Pe&&(lo(Pe,fe),R.current=lr(fe),Y(),M.current=!0)}):je("auto")),w.current=O.length,A.current=G;return}O.length>w.current;const he=G!==A.current;Kf({hasSelection:W.current,userScrolledUp:R.current,hasChatContentChanged:he})&&je("auto"),w.current=O.length,A.current=G},[G,c,O.length,je,Y]),l.useEffect(()=>{y&&(ge(),W.current||je("auto"))},[ge,je,y]),l.useEffect(()=>{const de=F.current;de&&!b&&le(),K.current=b,F.current=b;const H=c?Vn.get(c):null;if(Uf(de,b,H,G)){if(!H)return;R.current=lr(H),D.current=!1,W.current||requestAnimationFrame(()=>{const he=k.current;he&&(lo(he,H),Y())});return}},[b,c,G,ge,le,je,Y]),l.useEffect(()=>()=>{const de=J.current;de&&Vn.set(de.contextKey,de.snapshot),P.current!=null&&cancelAnimationFrame(P.current),_.current!=null&&window.clearTimeout(_.current)},[]),l.useEffect(()=>{const de=v.current,H=k.current;if(!de||!H)return;const he=()=>{_.current!=null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>{D.current=!1,_.current=null},Ul)},fe=new ResizeObserver(()=>{Y();const ye=D.current;Vf({hasSelection:W.current,userScrolledUp:R.current,contextAutoScrollActive:ye})&&(je("auto"),ye&&he())});return fe.observe(de),H!==de&&fe.observe(H),()=>{fe.disconnect(),_.current!=null&&(window.clearTimeout(_.current),_.current=null)}},[je,c,Y]),l.useImperativeHandle(C,()=>({scrollToBottom:(de="smooth")=>{se(de)}}),[se]),l.useEffect(()=>{const de=k.current;if(!de)return;let H;const he=()=>{le(),clearTimeout(H),H=setTimeout(()=>{R.current=!V(),Y()},50)};return de.addEventListener("scroll",he,{passive:!0}),()=>{de.removeEventListener("scroll",he),clearTimeout(H)}},[le,Y]),l.useEffect(()=>(document.addEventListener("selectionchange",Z),()=>document.removeEventListener("selectionchange",Z)),[Z]);const Ce=l.useRef(0),ue=l.useRef(!1);l.useEffect(()=>{const de=k.current;if(!de||!ue.current||Ce.current===0)return;const H=de.scrollHeight-Ce.current;H>0&&(de.scrollTop=H),Y(),le(),Ce.current=0,ue.current=!1},[O.length,le,Y]),l.useEffect(()=>{if(M.current||!c)return;const de=Vn.get(c),H=k.current;if(!(!de||!H)){if(!ga(de,G)){se("auto"),M.current=!0;return}lo(H,de),R.current=lr(de),Y(),M.current=!0}},[c,G,O.length,se,Y]);const z=()=>{const de=k.current;de&&(Ce.current=de.scrollHeight),ue.current=!0,f==null||f()},U=()=>{R.current=!0,ie("smooth"),le()},q=()=>{ge(),se("smooth"),le()},Q=l.useMemo(()=>{const de=O.map((ye,Pe)=>({type:"message",data:ye,index:Pe,ts:_f(ye,Pe,u)}));if(!n||n.length===0)return de;const H=[...n].sort((ye,Pe)=>ye.timestamp-Pe.timestamp).map((ye,Pe)=>({type:"action",data:ye,index:Pe,ts:ye.timestamp})),he=[];let fe=0;for(const ye of de){for(;fe<H.length&&ye.ts>0&&H[fe].ts<ye.ts;)he.push(H[fe++]);he.push(ye)}for(;fe<H.length;)he.push(H[fe++]);return he},[O,n,u]),me=h>0||!!S,Ae=h>0?h>80?j("chatList.showEarlierMessagesHidden",{count:Math.min(h,80),total:h}):j("chatList.showEarlierMessages",{count:Math.min(h,80)}):x?j("chatList.loadErrorRetry",{error:x}):j("chatList.loadOlderMessages");return s.jsxs("div",{className:"chat-scroll-frame",children:[s.jsx("div",{ref:k,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:v,className:"chat-container-content",children:[g&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:j("chatList.loadingOlderMessages")}),me&&!g&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:z,className:`text-[11px] rounded-xl px-4 py-1.5 cursor-pointer border transition-all ${x&&h===0?"bg-transparent border-yellow-500/30 text-yellow-400 opacity-80 hover:opacity-100":"bg-transparent border-border-subtle text-text-muted opacity-70 hover:opacity-100 hover:border-accent/40"}`,children:Ae})}),Q.length===0&&!me&&(m||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:j("chatList.waitingForMessages")})),Q.map(de=>{if(de.type==="action"){const He=de.data;return s.jsx(Ib,{log:He},`action-${de.index}`)}const H=de.data;de.index;const he=ba(H),fe=H.receivedAt||u[he],ye=`${c}-${he}`,Pe=$.has(ye);return s.jsx(Pb,{message:H,receivedAt:fe,agentName:r,userName:a,isCliMode:o,isTextExpanded:Pe,onToggleTextExpanded:()=>E(He=>{const ke=new Set(He);return Pe?ke.delete(ye):ke.add(ye),ke})},`msg-${he}`)}),i&&s.jsx("div",{className:"self-start chat-typing-wrapper",children:s.jsxs("div",{className:"typing-indicator",children:[s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:j("chatList.agentGenerating")})]})}),s.jsx("div",{className:"min-h-10",ref:N})]})}),(B.showTop||B.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":j("chatList.jumpToTop"),children:[B.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:U,"aria-label":j("chatList.jumpToOldestMessages"),title:j("chatList.jumpToTop"),children:j("chatList.top")}),B.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:q,"aria-label":j("chatList.jumpToLatestMessages"),title:j("chatList.jumpToBottom"),children:j("chatList.latest")})]})]})}),Rb=l.memo(Lb,(e,t)=>e.messages===t.messages&&e.actionLogs===t.actionLogs&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isWorking===t.isWorking&&e.contextKey===t.contextKey&&e.receivedAtMap===t.receivedAtMap&&e.lastMessageHash===t.lastMessageHash&&e.showActivityMessages===t.showActivityMessages&&e.emptyState===t.emptyState&&e.onLoadMore===t.onLoadMore&&e.isLoadingMore===t.isLoadingMore&&e.hasMoreHistory===t.hasMoreHistory&&e.hiddenLiveCount===t.hiddenLiveCount&&e.loadError===t.loadError&&e.scrollToBottomRequestNonce===t.scrollToBottomRequestNonce&&e.isVisible===t.isVisible),Eb="modulepreload",_b=function(e){return"/"+e},Jl={},$b=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));a=Promise.allSettled(n.map(u=>{if(u=_b(u),u in Jl)return;Jl[u]=!0;const p=u.endsWith(".css"),d=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const m=document.createElement("link");if(m.rel=p?"stylesheet":Eb,p||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),p)return new Promise((f,g)=>{m.addEventListener("load",f),m.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})};let Ql=!1;const Du=l.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:n,fontSize:r=13,readOnly:a=!1,sizingMode:o="measured"},i)=>{const c=l.useRef(null),[u,p]=l.useState(null),d=l.useRef([]),m=l.useRef(!1),f=l.useRef(!1),g=l.useRef(!1),S=l.useRef(!1),h=()=>{const x=c.current;if(x){m.current&&(x.clear(),m.current=!1);for(const y of d.current)x.write(y.data,y.onProcessed);d.current=[],f.current&&(x.fit(),f.current=!1),g.current&&(x.bumpResize(),g.current=!1),S.current&&(x.scrollToTop(),S.current=!1)}};return l.useImperativeHandle(i,()=>({write:(x,y)=>{c.current?c.current.write(x,y):d.current.push({data:x,onProcessed:y})},clear:()=>{c.current?c.current.clear():(d.current=[],m.current=!0)},reset:()=>{c.current&&typeof c.current.reset=="function"?c.current.reset():(d.current=[],m.current=!0)},resize:(x,y)=>{c.current&&typeof c.current.resize=="function"&&c.current.resize(x,y)},fit:()=>{c.current?c.current.fit():f.current=!0},bumpResize:()=>{c.current?c.current.bumpResize():g.current=!0},scrollToTop:()=>{c.current?c.current.scrollToTop():S.current=!0},getSelection:()=>{var x,y;return((y=(x=c.current)==null?void 0:x.getSelection)==null?void 0:y.call(x))||""},getVisibleText:()=>{var x,y;return((y=(x=c.current)==null?void 0:x.getVisibleText)==null?void 0:y.call(x))||""}}),[]),l.useEffect(()=>{u&&h()},[u]),l.useEffect(()=>{let x=!1;return $b(()=>import("./terminal-DiXj2eIR.js"),__vite__mapDeps([0,1,2])).then(y=>{Ql||(Ql=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),x||p(()=>y.GhosttyTerminalView)}).catch(y=>{console.error("[CliTerminal] failed to load terminal renderer",y)}),()=>{x=!0}},[]),u?s.jsx(u,{ref:c,onInput:e,onViewportMetrics:t,onScrollMetrics:n,fontSize:r,readOnly:a,sizingMode:o,className:"w-full h-full rounded-lg overflow-hidden"}):s.jsx("div",{className:"w-full h-full rounded-lg overflow-hidden animate-pulse",style:{background:"#0f1117"}})});Du.displayName="CliTerminal";function Wt(...e){return Uh(Gh(e))}const Hb={lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl"},Fb={none:"",sm:"p-3",md:"px-4 py-3.5",lg:"px-5 py-4"},Ls=l.forwardRef(function({radius:t="xl",padding:n="md",className:r,...a},o){return s.jsx("div",{ref:o,className:Wt("border border-border-subtle bg-bg-secondary",Hb[t],Fb[n],r),...a})});function Hr({label:e,value:t,sub:n,icon:r}){return s.jsxs(Ls,{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-base flex items-center",children:r}),s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),s.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),n&&s.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:n})]})}function Xl({value:e,max:t,label:n,color:r="#8b5cf6",detail:a,compact:o=!1}){const i=t>0?Math.min(Math.round(e/t*100),100):0,c=i>85?"#ef4444":i>60?"var(--status-warning)":r;return o?s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-0.5",children:[s.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:n}),s.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[i,"%"]})]}),s.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${i}%`,background:c}})})]}):s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-1.5",children:[s.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:n}),s.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[i,"%"]})]}),s.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${i}%`,background:`linear-gradient(90deg, ${c}, ${c}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function Bb({cursorPos:e,viewportRef:t,imgRef:n}){var b;if(!e||!n.current)return null;const r=n.current,a=r.getBoundingClientRect(),o=(b=t.current)==null?void 0:b.getBoundingClientRect();if(!o)return null;const i=r.naturalWidth||a.width,c=r.naturalHeight||a.height,u=i/c,p=a.width/a.height;let d,m,f,g;u>p?(d=a.width,m=a.width/u,f=0,g=(a.height-m)/2):(m=a.height,d=a.height*u,f=(a.width-d)/2,g=0);const S=a.left-o.left+f+d*e.nx,h=a.top-o.top+g+m*e.ny,x=Math.max(8,Math.min(o.width-8,S)),y=Math.max(8,Math.min(o.height-8,h));return s.jsxs("div",{style:{position:"absolute",left:x-8,top:y-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[s.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})}function Wb({inputMode:e,onToggleInputMode:t,isImeOpen:n,setIsImeOpen:r,isMenuOpen:a,setIsMenuOpen:o,imeText:i,setImeText:c,handleImeSubmit:u,isConnActive:p,zoom:d,isMobile:m,mobileFillZoom:f,onZoomOut:g,onZoomReset:S,onZoomIn:h,transportType:x,screenshotUsage:y,lastActionStatus:b}){const{t:C}=Ne("common");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:j=>j.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-20 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[s.jsxs("div",{onClick:t,className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${e==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[s.jsx("span",{className:"text-sm",children:e==="mouse"?"🖱️":"👆"}),s.jsx("span",{className:`text-[10px] font-bold ${e==="mouse"?"text-blue-400":"text-slate-400"}`,children:C(e==="mouse"?"remote.mouse":"remote.touch")})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>{r(j=>!j),o(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${n?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⌨️"})}),n&&s.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-20",style:{animation:"slideUp 0.15s ease-out"},children:s.jsx("input",{type:"text",placeholder:C("remote.typeAndEnter"),value:i,autoFocus:!0,onTouchStart:j=>j.stopPropagation(),onChange:j=>c(j.target.value),onKeyDown:j=>{u(j)},className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),s.jsx("div",{className:"relative",children:s.jsx("div",{onClick:()=>{o(j=>!j),r(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${a?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⚙️"})})}),s.jsx("div",{className:"w-px h-[18px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:p?"rgba(34,197,94,0.12)":"rgba(234,179,8,0.12)"},children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:p?"#22c55e":"#eab308",boxShadow:p?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:p?"#22c55e":"#eab308"},children:C(p?"remote.connected":"remote.ws")})]}),d>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(d*100),"%"]}),x==="direct"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"#22c55e",background:"rgba(34,197,94,0.12)"},title:C("remote.directP2PTitle"),children:C("remote.direct")}),x==="relay"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"var(--status-warning)",background:"color-mix(in srgb, var(--status-warning) 12%, transparent)"},title:C("remote.turnRelayTitle"),children:C("remote.relay")}),y&&y.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:y.budgetExhausted?"#ef4444":"#c4b5fd",background:y.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:C("remote.dailyTurnTitle"),children:y.budgetExhausted?C("remote.turnBlocked"):C("remote.turnUsage",{used:y.dailyUsedMinutes,budget:y.dailyBudgetMinutes})}),b&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:b})]})]}),a&&s.jsxs("div",{onTouchStart:j=>j.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:20,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[s.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:C("remote.settings")}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:[C("remote.zoom")," ",d<=(m?f:1)+.01?C(m?"remote.fill":"remote.fit"):`${Math.round(d*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:j=>{j.stopPropagation(),g()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),s.jsx("button",{onClick:j=>{j.stopPropagation(),S()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:C(m?"remote.fill":"remote.fit")}),s.jsx("button",{onClick:j=>{j.stopPropagation(),h()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]})]})]})}function Ob({waitingLabel:e,waitingHint:t,transportType:n}){const{t:r}=Ne("common");return s.jsxs("div",{className:"text-center flex flex-col items-center gap-3 px-6",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center border border-white/10 bg-white/[0.04] shadow-[0_10px_30px_rgba(0,0,0,0.35)]",style:{animation:"remote-float 2.8s ease-in-out infinite"},children:s.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-8 h-8 opacity-90"})}),s.jsx("div",{className:"text-white/85 text-[13px] font-semibold tracking-wide",children:e}),s.jsx("div",{className:"text-[11px] text-white/40",children:t}),n==="relay"&&s.jsx("div",{className:"text-[10px] font-medium",style:{color:"var(--status-warning)",opacity:.8},children:r("remote.waitingState.turnRelayActive")})]})}function Ub(){if(typeof window>"u")return!1;try{return window.__ADHDEV_DEBUG_RENDERS__===!0||window.localStorage.getItem("adhdev_debug_renders")==="1"}catch{return window.__ADHDEV_DEBUG_RENDERS__===!0}}function Zl(e){return e==null||typeof e=="number"||typeof e=="boolean"?e:typeof e=="string"?e.length>64?`${e.slice(0,61)}...`:e:Array.isArray(e)?`Array(${e.length})`:typeof e=="object"?"Object":typeof e}function Dr(e,t){const n=l.useRef(null),r=l.useRef(0);l.useEffect(()=>{if(!Ub())return;r.current+=1;const a=n.current;if(!a){console.debug(`[render-trace] ${e}#${r.current}`,{changed:["mount"],snapshot:Object.fromEntries(Object.entries(t).map(([i,c])=>[i,Zl(c)]))}),n.current=t;return}const o=Object.keys({...a,...t}).filter(i=>!Object.is(a[i],t[i]));o.length>0&&console.debug(`[render-trace] ${e}#${r.current}`,{changed:o,snapshot:Object.fromEntries(o.map(i=>[i,Zl(t[i])]))}),n.current=t})}function Gb({containerRef:e,viewportRef:t,imgRef:n,inputMode:r,setInputMode:a,minZoom:o,zoomRef:i,panXRef:c,panYRef:u,setPanX:p,setPanY:d,setZoom:m,lastWheelTimeRef:f,onAction:g,setLastActionStatus:S,spawnRippleFromNormalized:h,clampPan:x,isMobile:y,mobileFillZoom:b}){const[C,j]=l.useState(null),k=l.useRef(null),v=l.useRef(null),N=l.useRef(null),w=l.useRef(!1),A=l.useRef(null),T=l.useRef(0),I=l.useRef(null),P=l.useRef(1),D=l.useRef({x:0,y:0}),_=l.useRef(!1),W=l.useRef(r),$=l.useRef(g),E=30,B=550,L=18,R=60,M=400,F=12,K=()=>{if(k.current)return;const Y={nx:.5,ny:.5};k.current=Y,j(Y)};return l.useEffect(()=>{W.current=r,r==="mouse"&&K()},[r]),l.useEffect(()=>{$.current=g},[g]),l.useEffect(()=>{const Y=e.current;if(!Y)return;const se=le=>{if(!n.current)return null;const je=n.current.getBoundingClientRect();return!je.width||!je.height?null:{nx:Math.max(0,Math.min(1,(le.clientX-je.left)/je.width)),ny:Math.max(0,Math.min(1,(le.clientY-je.top)/je.height))}},ie=(le,je)=>{if(!n.current)return{dnx:0,dny:0};const ge=n.current,Ce=ge.getBoundingClientRect(),ue=ge.naturalWidth||Ce.width,z=ge.naturalHeight||Ce.height,U=ue/z,q=Ce.width/Ce.height;let Q,me;return U>q?(Q=Ce.width,me=Ce.width/U):(me=Ce.height,Q=Ce.height*U),{dnx:le/Q,dny:je/me}},Z=(le,je,ge)=>{if(ge<=1.05)return;const Ce=-(le-.5)*100,ue=-(je-.5)*100,z=x(Ce,ue,ge);(Math.abs(z.x-c.current)>.1||Math.abs(z.y-u.current)>.1)&&(p(z.x),d(z.y),c.current=z.x,u.current=z.y)},O=le=>{const je=t.current;if(je&&le.target instanceof Node&&je.contains(le.target))le.preventDefault();else return;if(le.touches.length===1){const ge=le.touches[0];v.current={x:ge.clientX,y:ge.clientY,time:Date.now()},N.current={x:ge.clientX,y:ge.clientY},_.current||(w.current=!1),A.current=setTimeout(()=>{if(!w.current&&!_.current)if(w.current=!0,W.current==="mouse"){const Ce=k.current||{nx:.5,ny:.5};S("Right Click"),h(Ce.nx,Ce.ny,"right"),$.current("input_click",{...Ce,button:"right"}).catch(()=>{})}else{const Ce=se(ge);Ce&&(S("Right Click"),h(Ce.nx,Ce.ny,"right"),$.current("input_click",{...Ce,button:"right"}).catch(()=>{}))}},500);return}if(le.touches.length===2){A.current&&clearTimeout(A.current),w.current=!0,_.current=!0;const ge=le.touches[1].clientX-le.touches[0].clientX,Ce=le.touches[1].clientY-le.touches[0].clientY;I.current=Math.sqrt(ge*ge+Ce*Ce),P.current=i.current,D.current={x:(le.touches[0].clientX+le.touches[1].clientX)/2,y:(le.touches[0].clientY+le.touches[1].clientY)/2}}},ee=le=>{const je=t.current;if(je&&le.target instanceof Node&&je.contains(le.target)&&le.preventDefault(),le.touches.length===1&&N.current){const ge=le.touches[0],Ce=ge.clientX-N.current.x,ue=ge.clientY-N.current.y;if(!w.current&&v.current){const z=ge.clientX-v.current.x,U=ge.clientY-v.current.y;Math.sqrt(z*z+U*U)>8&&(w.current=!0,A.current&&clearTimeout(A.current))}if(w.current)if(W.current==="mouse"){const z=ie(Ce,ue),U=k.current||{nx:.5,ny:.5},q=Math.max(0,Math.min(1,U.nx+z.dnx)),Q=Math.max(0,Math.min(1,U.ny+z.dny));k.current={nx:q,ny:Q},j({nx:q,ny:Q}),S(`Cursor: ${Math.round(q*100)}%, ${Math.round(Q*100)}%`),Z(q,Q,i.current);const me=Date.now();me-f.current>=30&&(f.current=me,$.current("input_mouseMoved",{nx:q,ny:Q}).catch(()=>{}))}else if(i.current>1){const z=t.current;if(z){const U=z.clientWidth,q=z.clientHeight,Q=c.current+Ce/U*100,me=u.current+ue/q*100,Ae=x(Q,me,i.current);p(Ae.x),d(Ae.y),c.current=Ae.x,u.current=Ae.y}}else{const z=se(ge);if(z){const U=Date.now();U-f.current>=40&&(f.current=U,S("Scroll"),$.current("input_wheel",{nx:z.nx,ny:z.ny,deltaX:Math.round(-Ce*2.5),deltaY:Math.round(-ue*2.5)}).catch(()=>{}))}}N.current={x:ge.clientX,y:ge.clientY};return}if(le.touches.length===2&&I.current!==null){const ge=le.touches[1].clientX-le.touches[0].clientX,Ce=le.touches[1].clientY-le.touches[0].clientY,z=Math.sqrt(ge*ge+Ce*Ce)/I.current,U=(le.touches[0].clientX+le.touches[1].clientX)/2,q=(le.touches[0].clientY+le.touches[1].clientY)/2,Q=U-D.current.x,me=q-D.current.y,Ae=Math.abs(z-1)>.03;if(W.current==="mouse"){if(Ae){const de=Math.max(o,Math.min(5,P.current*z));m(de),i.current=de}else if(Math.abs(Q)>2||Math.abs(me)>2){const de=k.current||{nx:.5,ny:.5},H=Date.now();H-f.current>=30&&(f.current=H,S("Scroll"),$.current("input_wheel",{nx:de.nx,ny:de.ny,deltaX:Math.round(-Q*3),deltaY:Math.round(-me*3)}).catch(()=>{}))}}else{const de=Math.max(o,Math.min(5,P.current*z));m(de),i.current=de;const H=t.current;if(H&&de>1){const he=H.clientWidth,fe=H.clientHeight,ye=c.current+Q/he*100,Pe=u.current+me/fe*100,He=x(ye,Pe,de);p(He.x),d(He.y),c.current=He.x,u.current=He.y}}D.current={x:U,y:q}}},G=le=>{var je;if(A.current&&clearTimeout(A.current),I.current=null,le.touches.length===1&&_.current){const ge=le.touches[0];v.current={x:ge.clientX,y:ge.clientY,time:Date.now()},N.current={x:ge.clientX,y:ge.clientY},w.current=!0;return}if(le.touches.length===0){if(_.current){_.current=!1,w.current=!1;return}if(le.changedTouches.length===1){const ge=le.changedTouches[0],Ce=Date.now(),ue=Ce-(((je=v.current)==null?void 0:je.time)||0),z=v.current?ge.clientX-v.current.x:0,U=v.current?ge.clientY-v.current.y:0,q=Math.sqrt(z*z+U*U);if(W.current==="mouse"){if(ue<E||ue>B||q>L){w.current=!1;return}const Q=k.current||se(ge);Q&&(S(`Click: ${Math.round(Q.nx*100)}%, ${Math.round(Q.ny*100)}%`),h(Q.nx,Q.ny,"left"),$.current("input_click",{...Q}).catch(()=>{}))}else{if(w.current){w.current=!1;return}if(ue<R||ue>M||q>F){w.current=!1;return}const Q=se(ge);if(!Q)return;Ce-T.current<300?(S("Double tap"),h(Q.nx,Q.ny,"double"),$.current("input_click",{...Q,clickCount:2}).catch(()=>{}),T.current=0):(S(`Tap: ${Math.round(Q.nx*100)}%, ${Math.round(Q.ny*100)}%`),h(Q.nx,Q.ny,"left"),$.current("input_click",{...Q}).catch(()=>{}),T.current=Ce)}}w.current=!1}};return Y.addEventListener("touchstart",O,{passive:!1}),Y.addEventListener("touchmove",ee,{passive:!1}),Y.addEventListener("touchend",G,{passive:!1}),()=>{Y.removeEventListener("touchstart",O),Y.removeEventListener("touchmove",ee),Y.removeEventListener("touchend",G),A.current&&clearTimeout(A.current)}},[e,t,n,o,i,c,u,p,d,m,f,S,h,x]),{cursorPos:C,cursorPosRef:k,handleToggleInputMode:()=>{a(Y=>{const se=Y==="touch"?"mouse":"touch";return se==="mouse"&&K(),se})},handleZoomReset:()=>{const Y=y?b:1;m(Y),i.current=Y,p(0),d(0),c.current=0,u.current=0}}}function Iu({onAction:e,addLog:t,connState:n,connScreenshot:r,screenshotUsage:a,transportType:o}){const i=l.useRef(null),c=l.useRef(null),u=l.useRef(null),[p,d]=l.useState(null),[m,f]=l.useState(""),[,g]=l.useState(!1),[S,h]=l.useState([]),x=l.useRef(0),[y,b]=l.useState(!1),[C,j]=l.useState(!1),k=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[v,N]=l.useState(k?"mouse":"touch"),[w,A]=l.useState(1),T=l.useRef(!1),[I,P]=l.useState(1),[D,_]=l.useState(0),[W,$]=l.useState(0);Dr("RemoteView",{connState:n,hasScreenshot:!!r,inputMode:v,zoom:I,panX:D,panY:W,isMenuOpen:y,isImeOpen:C});const E=l.useRef(0),B=l.useRef(I),L=l.useRef(D),R=l.useRef(W);l.useEffect(()=>{B.current=I},[I]),l.useEffect(()=>{L.current=D},[D]),l.useEffect(()=>{R.current=W},[W]),l.useEffect(()=>{var ue;(ue=i.current)==null||ue.focus()},[]);const M=n==="connected",F=r,K=M?"Connected. Waiting for first frame...":n==="connecting"?"Connecting to Host...":"Reconnecting to Host...",J=M?"The remote stream is warming up":"Waiting for the remote stream to catch up";l.useEffect(()=>{if(!k||T.current||!F)return;const ue=u.current,z=c.current;if(!ue||!z)return;const U=()=>{const q=z.clientWidth,Q=z.clientHeight,me=ue.naturalWidth,Ae=ue.naturalHeight;if(!me||!Ae||!q||!Q)return;const de=Math.min(q/me,Q/Ae),he=Math.max(q/me,Q/Ae)/de;he>1.01&&(A(he),P(he),B.current=he),T.current=!0};ue.complete&&ue.naturalWidth?U():ue.addEventListener("load",U,{once:!0})},[F,k]);const V=.5;l.useEffect(()=>{I<=V&&(_(0),$(0))},[I,V]);const Y=(ue,z,U)=>{if(U<=V)return{x:0,y:0};const q=(U-1)/(2*U)*100,Q=(U-1)/(2*U)*100;return{x:Math.max(-q,Math.min(q,ue)),y:Math.max(-Q,Math.min(Q,z))}},se=(ue,z)=>{if(!u.current)return null;const U=u.current.getBoundingClientRect();return!U.width||!U.height?null:{nx:Math.max(0,Math.min(1,(ue-U.left)/U.width)),ny:Math.max(0,Math.min(1,(z-U.top)/U.height))}},ie=(ue,z,U)=>{const q=c.current;if(!q)return;const Q=q.getBoundingClientRect(),me=++x.current;h(Ae=>[...Ae,{id:me,x:ue-Q.left,y:z-Q.top,type:U}]),setTimeout(()=>h(Ae=>Ae.filter(de=>de.id!==me)),600)},Z=(ue,z,U)=>{const q=u.current,Q=c.current;if(!q||!Q)return;const me=q.getBoundingClientRect(),Ae=Q.getBoundingClientRect(),de=q.naturalWidth||me.width,H=q.naturalHeight||me.height,he=de/H,fe=me.width/me.height;let ye,Pe,He,ke;he>fe?(ye=me.width,Pe=me.width/he,He=0,ke=(me.height-Pe)/2):(Pe=me.height,ye=me.height*he,He=(me.width-ye)/2,ke=0);const pe=me.left-Ae.left+He+ye*ue,st=me.top-Ae.top+ke+Pe*z,De=++x.current;h(_e=>[..._e,{id:De,x:pe,y:st,type:U}]),setTimeout(()=>h(_e=>_e.filter(ae=>ae.id!==De)),600)},O=async ue=>{var U;const z=se(ue.clientX,ue.clientY);if(z){d(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),ie(ue.clientX,ue.clientY,"left"),(U=i.current)==null||U.focus();try{const q=await e("input_click",{nx:z.nx,ny:z.ny});q!=null&&q.success||t(`❌ Click failed: ${q==null?void 0:q.error}`)}catch(q){t(`❌ Click error: ${q.message||q}`)}}},ee=async(ue,z,U,q=0)=>{try{await e("input_key",{type:U?"char":"keyDown",key:ue,code:z,text:U?ue:void 0,unmodifiedText:U?ue:void 0,modifiers:q})}catch(Q){t(`❌ Key error: ${Q.message||Q}`)}},G=async ue=>{if(ue.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ue.key)&&ue.preventDefault();let U=0;ue.altKey&&(U|=1),ue.ctrlKey&&(U|=2),ue.metaKey&&(U|=4),ue.shiftKey&&(U|=8),d(`Key: ${ue.key}`),await ee(ue.key,ue.code,ue.key.length===1,U)},le=async ue=>{if(ue.key==="Enter"){if(ue.nativeEvent.isComposing)return;if(m){const z=m;f(""),d(`IME Sent: ${z}`);try{const U=await e("input_type",{text:z});U!=null&&U.success||t(`❌ IME error: ${U==null?void 0:U.error}`)}catch(U){t(`❌ IME error: ${U.message}`)}}else d("Key: Enter"),await ee("Enter","Enter",!1)}};l.useEffect(()=>{const ue=i.current;if(!ue)return;const z=U=>{var q;if((q=u.current)!=null&&q.contains(U.target)){U.preventDefault();const Q=Date.now();if(Q-E.current<40)return;E.current=Q;const me=se(U.clientX,U.clientY);if(!me)return;d(`Scroll: ${Math.round(U.deltaY)}`),e("input_wheel",{nx:me.nx,ny:me.ny,deltaX:Math.round(U.deltaX),deltaY:Math.round(U.deltaY)}).catch(()=>{})}};return ue.addEventListener("wheel",z,{passive:!1}),()=>ue.removeEventListener("wheel",z)},[e]);const{cursorPos:je,handleToggleInputMode:ge,handleZoomReset:Ce}=Gb({containerRef:i,viewportRef:c,imgRef:u,inputMode:v,setInputMode:N,minZoom:V,zoomRef:B,panXRef:L,panYRef:R,setPanX:_,setPanY:$,setZoom:P,lastWheelTimeRef:E,onAction:e,setLastActionStatus:d,spawnRippleFromNormalized:Z,clampPan:Y,isMobile:k,mobileFillZoom:w});return s.jsxs("div",{ref:i,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:G,onContextMenu:ue=>ue.preventDefault(),onFocus:()=>g(!0),onBlur:()=>g(!1),tabIndex:0,children:[s.jsxs("div",{ref:c,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[F?s.jsx("img",{ref:u,src:F,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${I}) translate(${D}%, ${W}%)`,transformOrigin:"center center",cursor:v==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:O,onContextMenu:ue=>ue.preventDefault(),onDragStart:ue=>ue.preventDefault()}):s.jsx(Ob,{waitingLabel:K,waitingHint:J,transportType:o}),v==="mouse"&&F&&s.jsx(Bb,{cursorPos:je,viewportRef:c,imgRef:u}),S.map(ue=>{const U={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[ue.type];return s.jsxs("div",{style:{position:"absolute",left:ue.x,top:ue.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${U}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${U}, 0.9)`,boxShadow:`0 0 12px rgba(${U}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},ue.id)})]}),s.jsx(Wb,{inputMode:v,onToggleInputMode:ge,isImeOpen:C,setIsImeOpen:j,isMenuOpen:y,setIsMenuOpen:b,imeText:m,setImeText:f,handleImeSubmit:le,isConnActive:M,zoom:I,isMobile:k,mobileFillZoom:w,onZoomOut:()=>P(ue=>Math.max(.5,ue-.25)),onZoomReset:Ce,onZoomIn:()=>P(ue=>Math.min(5,ue+.25)),transportType:o,screenshotUsage:a,lastActionStatus:p}),s.jsx("style",{children:`
|
|
9
9
|
@keyframes slideUp {
|
|
10
10
|
from { opacity: 0; transform: translateY(6px); }
|
|
11
11
|
to { opacity: 1; transform: translateY(0); }
|