4223 lines
724 KiB
JavaScript
4223 lines
724 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./sidebar-attention-panel.runtime-DcNkyKMY.js","./rolldown-runtime-DkW27tQK.js","./control-ui-core-pH6nakZ-.js","./control-ui-foundation-CeFMP1Ly.js","./lit-runtime-BEtFSUCp.js","./control-ui-core-DGVkFhVB.js","./control-ui-core-Br5DB0Zj.js","./gateway-runtime-DUNO4Mi1.js","./control-ui-core-C8H8-RSs.css","./hub-tabs-mHLCJmKB.js","./hub-tabs-D2dXz8I8.css","./sidebar-update-card-CQqrU8d1.js","./update-confirmation-BNyRSVb0.js","./sidebar-update-card-CqgCtvZC.css","./sidebar-attention-panel-Cx69EZk2.css","./custodian-alert-store-KwahxieH.js","./custodian-alert-store-BIkN3I10.js","./channel-avatar-CNP_6012.js","./session-organizer-operations.runtime-Bya7cfJM.js","./worktree-preservation-ITy-qaJx.js","./input-dialog-BErqtvL-.js","./session-group-defaults-dialog-Db8Bcufo.js","./control-ui-boot-D1DWJlBr.js","./control-ui-boot-wpHCbPL9.js","./control-ui-boot-gfE6fZcA.js","./config-runtime-C4gfjhZc.js","./control-ui-boot-9_2QGLIL.js","./control-ui-boot-B1lcIXow.js","./control-ui-boot-Clhp68JE.js","./control-ui-boot-J-x6DHHT.js","./control-ui-boot-CKTkvwFZ.js","./control-ui-boot-BPFwXC8p.js","./control-ui-boot-DdPrPuw0.js","./control-ui-boot-CQvujP8f.js","./control-ui-boot-BW_XZcbY.js","./control-ui-boot-__AsqpzJ.css","./place-browser-DiRCxEEz.js","./new-session-Df5ycn44.js","./new-session-C99rZtoz.css","./web-awesome-popover-DTDr8XNA.js","./sidebar-people.runtime-DFHUV6XT.js","./portaled-hovercard-Cn6SxKYU.js","./session-progress-hovercard.runtime-C62MSXJB.js"])))=>i.map(i=>d[i]);
|
|
import{a as e,n as t}from"./rolldown-runtime-DkW27tQK.js";import{Ai as n,Ci as r,Di as i,Ei as a,F as o,Fi as s,Gt as c,Jt as l,L as u,Nr as d,Pr as f,Sn as p,Ut as m,Yt as h,_t as g,ai as _,an as v,bn as y,c as b,dt as x,er as S,ht as C,in as ee,ji as te,ki as w,kn as ne,l as re,ln as ie,mt as ae,nn as oe,oi as se,pt as ce,qt as le,un as ue,wi as de,wn as T,xt as fe,yn as pe}from"./control-ui-foundation-CeFMP1Ly.js";import{$a as me,$i as he,Ao as ge,Ba as _e,Bc as ve,Bt as ye,Cc as be,Co as xe,Da as Se,Dc as E,Do as Ce,Ds as we,E as Te,Ec as Ee,Eo as De,G as Oe,Ga as ke,Gc as Ae,Hc as je,Ja as Me,Jc as Ne,Js as Pe,Ka as Fe,Kc as Ie,La as Le,Mc as Re,Na as ze,Nc as Be,Oc as Ve,Oo as He,Or as Ue,Qa as We,Qc as Ge,Ra as Ke,Rc as qe,Sc as Je,So as Ye,T as Xe,Ta as Ze,Tc as Qe,To as $e,U as et,Uc as tt,Va as nt,W as D,Wa as rt,Wc as it,X as at,Yc as ot,Yi as st,Ys as ct,Z as lt,Zc as ut,Zi as dt,_ as ft,_c as pt,a as mt,al as ht,ao as gt,b as _t,bc as O,bo as vt,bt as yt,c as bt,dl as xt,do as St,dr as Ct,ei as wt,el as Tt,fl as Et,fo as Dt,fr as Ot,fs as k,g as kt,gc as At,gl as jt,go as Mt,gs as Nt,h as Pt,hc as Ft,hl as A,hs as It,il as Lt,io as Rt,ja as zt,jc as Bt,jo as Vt,ka as Ht,kc as Ut,ks as Wt,l as Gt,lr as Kt,mc as j,ml as M,mo as qt,ms as N,ni as Jt,o as Yt,ol as Xt,oo as Zt,p as Qt,pl as $t,pr as en,q as tn,qa as nn,qc as rn,qs as an,rl as on,s as sn,tc as cn,ti as ln,to as un,vo as dn,vr as fn,w as pn,wo as mn,x as hn,xc as gn,xo as _n,xt as vn,yc as yn,yr as bn,yt as xn,za as Sn,zt as Cn}from"./control-ui-core-pH6nakZ-.js";import{$ as wn,C as Tn,G as P,H as En,I as Dn,J as F,K as On,R as kn,U as An,W as I,X as L,Z as R,_ as jn,a as Mn,at as z,b as Nn,c as Pn,d as Fn,et as In,f as Ln,h as Rn,i as zn,lt as Bn,m as Vn,n as Hn,rt as B,s as Un,t as Wn,u as Gn,w as Kn,x as qn}from"./lit-runtime-BEtFSUCp.js";import{$t as Jn,A as Yn,At as Xn,B as Zn,Bn as Qn,Cn as $n,Dn as er,Dt as tr,E as nr,En as rr,F as ir,I as ar,In as or,Jt as sr,K as cr,L as lr,M as ur,Mt as dr,On as fr,Ot as pr,Qt as mr,T as hr,Tt as gr,Vn as _r,Vt as vr,Wn as yr,Xn as br,Xt as xr,Yt as Sr,Z as Cr,Zt as wr,_ as Tr,_n as Er,an as Dr,c as Or,cn as kr,d as Ar,dn as jr,en as Mr,er as Nr,f as Pr,fn as Fr,gn as Ir,hn as Lr,k as Rr,kn as zr,kt as Br,ln as Vr,m as Hr,mn as Ur,p as Wr,qn as Gr,s as Kr,sn as qr,tr as Jr,un as Yr,v as Xr,wt as Zr,xn as Qr,zn as $r}from"./control-ui-core-DGVkFhVB.js";import{A as ei,D as ti,F as ni,Ft as ri,Gt as ii,Ht as V,I as ai,K as oi,L as si,Lt as H,M as ci,N as li,Nt as ui,O as di,P as fi,Qt as pi,Rt as U,S as mi,Vt as hi,Zt as gi,_ as _i,ft as vi,ht as yi,i as bi,it as xi,j as Si,k as Ci,nt as wi,ot as Ti,q as Ei,qt as W,r as Di,rt as Oi,ut as ki,vt as Ai,w as ji,zt as Mi}from"./control-ui-core-Br5DB0Zj.js";import{$ as Ni,A as Pi,Bt as Fi,C as Ii,Ct as Li,F as Ri,Fn as zi,G as Bi,I as Vi,In as Hi,It as Ui,K as Wi,L as Gi,Ln as Ki,Lt as qi,N as Ji,Nn as Yi,O as Xi,Ot as Zi,P as Qi,Q as $i,Rt as ea,S as ta,Sn as na,St as ra,U as ia,W as aa,at as oa,b as sa,d as ca,et as la,f as ua,g as da,h as fa,it as pa,j as ma,jt as ha,k as ga,lt as _a,m as va,nt as ya,ot as ba,p as xa,rt as Sa,st as Ca,t as wa,tt as Ta,u as Ea,ut as Da,wn as Oa,x as ka,xt as Aa,y as ja,zt as Ma}from"./control-ui-boot-wpHCbPL9.js";import{a as Na,n as Pa,r as Fa}from"./gateway-runtime-DUNO4Mi1.js";import{D as Ia,E as La,T as Ra,_ as za,b as Ba,d as Va,h as Ha,v as Ua,x as Wa}from"./config-runtime-C4gfjhZc.js";import{C as Ga,E as Ka,S as qa,T as Ja,a as Ya,c as Xa,d as Za,f as Qa,g as $a,h as eo,i as to,l as no,m as ro,n as io,o as ao,p as oo,s as so,t as co,u as lo,w as uo,x as fo}from"./control-ui-boot-CKTkvwFZ.js";import{_ as po,a as mo,c as ho,d as go,f as _o,g as vo,h as yo,i as bo,l as xo,m as So,o as Co,p as wo,s as To,u as Eo}from"./control-ui-boot-9_2QGLIL.js";import{ct as Do,dt as Oo,ft as ko,lt as Ao,st as jo,ut as Mo}from"./control-ui-boot-J-x6DHHT.js";import{Ar as No,In as Po,Ln as Fo,Rn as Io,jr as Lo}from"./control-ui-boot-D1DWJlBr.js";import{g as Ro,h as zo}from"./control-ui-boot-CQvujP8f.js";import{At as Bo,B as Vo,Dt as Ho,Et as Uo,F as Wo,H as Go,I as Ko,J as qo,K as Jo,M as Yo,N as Xo,Ot as Zo,U as Qo,V as $o,W as es,bt as ts,ct as ns,dt as rs,ft as is,gt as as,ht as os,it as ss,j as cs,kt as ls,lt as us,mt as ds,nt as fs,ot as ps,pt as ms,q as hs,st as gs,tt as _s,ut as vs,vt as ys,wt as bs,xt as xs,yt as Ss}from"./control-ui-boot-BPFwXC8p.js";import{g as Cs}from"./control-ui-boot-DdPrPuw0.js";import"./control-ui-boot-BW_XZcbY.js";import{A as ws,D as Ts,E as Es,F as Ds,M as Os,N as ks,O as As,P as js,S as Ms,_ as Ns,a as Ps,b as Fs,c as Is,d as Ls,g as Rs,h as zs,l as Bs,n as Vs,p as Hs,r as Us,s as Ws,t as Gs,v as Ks,w as qs,x as Js,y as Ys}from"./markdown-runtime-BcrsAQtF.js";function Xs(e){let t;return n=>{let r=()=>{let r=n.state.scopeId;if(t===void 0){t=r;return}if(r===t)return;let i=t;t=r,e(r,i)};return r(),n.subscribe(r)}}function Zs(){return(Zs=t((()=>{})))()}function Qs(e){return e.reason instanceof Error?e.reason:new DOMException(`Gateway wait aborted`,`AbortError`)}function $s(e,t){let n=e.snapshot.client;return t.aborted?Promise.reject(Qs(t)):n&&e.snapshot.phase===`connected`?Promise.resolve(n):new Promise((n,r)=>{let i=()=>void 0,a=!1,o=()=>{i(),t.removeEventListener(`abort`,s)},s=()=>{o(),r(Qs(t))};t.addEventListener(`abort`,s,{once:!0}),i=e.subscribe(e=>{e.phase===`connected`&&e.client&&(a=!0,o(),n(e.client))}),(a||t.aborted)&&i()})}function ec(){return(ec=t((()=>{})))()}function tc(e,t){let n=e?.trim();if(!n||!t)return null;let i=r(n);return t.agents.some(e=>r(e.id)===i)?i:null}function nc(e,t){let n=new URLSearchParams(e.search);if(!n.has(`session`))return null;let r=Gr(`chat`,t),i=Gr(`dashboard`,t),a=e.pathname===r||e.pathname===`${r}/`?`chat`:e.pathname===i||e.pathname===`${i}/`?`dashboard`:null;return a?{face:n.get(`face`)===`dashboard`?`dashboard`:a,sessionKey:n.get(`session`)?.trim()??``}:null}async function rc(e){let t=nc(e.location,e.basePath);if(!t)return null;let n=!!(e.agentsList()?.mainKey?.trim()||e.gateway.snapshot.phase===`connected`&&e.gateway.snapshot.hello),r=E(t.sessionKey);t.sessionKey&&!n&&await $s(e.gateway,e.signal);let i={agentsList:e.agentsList(),hello:e.gateway.snapshot.hello},a=r?.agentId??(tc(e.selectedAgentId,i.agentsList)||Be(i)),o=Bt(i),s=t.sessionKey?wr(t.face,a,t.sessionKey,e.basePath,{mainKey:o}):null,c=new URLSearchParams(e.location.search);c.delete(`session`),c.delete(`face`);let l=c.toString();return{...e.location,pathname:s??Gr(t.face,e.basePath),search:l?`?${l}`:``}}function ic(e,t,n,r,i){if(!ye(e,t,br)||!n.trim())return e;let a=E(n)?.agentId??r.trim();if(!a)return e;let o=wr(`chat`,a,n,t,{mainKey:i});return o?{...e,pathname:o}:e}async function ac(e){let t=await rc(e);if(t)return t;if(!ye(e.location,e.basePath,br))return e.location;E(e.sessionKey)||await $s(e.gateway,e.signal);let n={agentsList:e.agentsList(),hello:e.gateway.snapshot.hello};return ic(e.location,e.basePath,e.sessionKey.trim()||e.gateway.snapshot.sessionKey,tc(e.selectedAgentId,n.agentsList)||Be(n),Bt(n))}function oc(){return(oc=t((()=>{$r(),vr(),xr(),O(),Cn()})))()}function sc(e){let t=e.now??Date.now,n=e.setTimer??((e,t)=>globalThis.setTimeout(e,t)),r=e.clearTimer??(e=>globalThis.clearTimeout(e)),i=null,a=null,o=null,s=0,c=0,l=!1,u=e=>l&&c===e,d=()=>{a!==null&&(r(a),a=null)},f=(e,t)=>{u(t)&&(d(),a=n(()=>{u(t)&&(a=null,m(t))},ae(e,{minMs:uc})))},p=e=>{if(!u(e))return;s+=1;let t=Math.min(fc*2**(s-1),pc);f(t,e)},m=n=>{if(o?.generation===n||!u(n)||!i)return;let r=i,a=Promise.resolve().then(()=>e.request(`plugin.surface.refresh`,{surface:`canvas`,observedUrl:r})).then(a=>{if(!u(n)||i!==r)return;let o=cc(a);if(!o){p(n);return}s=0,i=o.canvasUrl,e.onChange(i);let c=o.expiresAtMs===void 0?dc:Math.max(uc,o.expiresAtMs-t()-lc);f(c,n)}).catch(()=>p(n)).finally(()=>{o?.promise===a&&(o=null)});o={generation:n,promise:a}};return{start(t){c+=1,l=!0,s=0,d(),e.onConnectionChange?.(),i=t?.trim()||null,e.onChange(i),i&&m(c)},stop(){!l&&i===null&&a===null||(c+=1,l=!1,s=0,d(),e.onConnectionChange?.(),i=null,e.onChange(null))}}}function cc(e){if(!e||typeof e!=`object`)return;let t=e;if(t.surface!==`canvas`)return;let n=t.pluginSurfaceUrls;if(!T(n))return;let r=n.canvas;if(typeof r!=`string`||!r.trim())return;let i=t.expiresAtMs;if(!(i!==void 0&&(typeof i!=`number`||!Number.isSafeInteger(i)||i<=0)))return{surface:`canvas`,canvasUrl:r.trim(),...i===void 0?{}:{expiresAtMs:i}}}var lc,uc,dc,fc,pc;function mc(){return(mc=t((()=>{ce(),lc=15e3,uc=1e3,dc=6e4,fc=1e3,pc=3e5})))()}function hc(e,t,n){if(!T(e))return null;let r=e;return Object.keys(r).some(e=>!Nc.has(e))||r.key!==t||r.agentId!==n||r.message!==``||r.worktree!==!0||r.incognito!==void 0&&r.incognito!==!0||r.visibility!==void 0&&r.visibility!==`draft`||r.fastMode!==void 0&&!ha(_a.properties.fastMode,r.fastMode)||r.permissionMode!==void 0&&!ha(Aa,r.permissionMode)||r.toolOverrides!==void 0&&!ha(ra,r.toolOverrides)||r.projectId!==void 0&&r.cwd!==void 0||Mc.some(e=>r[e]!==void 0&&!de(r[e]))?null:r}function gc(e){try{let t=JSON.parse(e);return T(t)?t:null}catch{return null}}function _c(e,t,n){return e.gatewayUrl===t&&e.recoveryScope===n}function vc(e){return T(e)?e.kind===`profile`&&Object.keys(e).every(e=>e===`kind`||e===`profileId`||e===`machineClass`)&&de(e.profileId)&&(e.machineClass===void 0||de(e.machineClass)&&e.machineClass.length<=128)||e.kind===`device`&&Object.keys(e).every(e=>e===`kind`||e===`deviceId`)&&de(e.deviceId)?e:e.kind===`auto-device`&&Object.keys(e).every(e=>e===`kind`)?{kind:`auto-device`}:null:null}function yc(e,t,n,r){return e.createParams?.incognito===!0||!de(e.sessionKey)||r!==void 0&&e.sessionKey!==r||!de(e.messageId)||typeof e.message!=`string`||!de(e.message)&&!e.attachments?.length||e.attachments!==void 0&&!Array.isArray(e.attachments)||!vc(e.target)||!de(e.agentId)||!_c(e,t,n)||e.phase!==`creating`&&e.phase!==`dispatching`&&e.phase!==`sending`&&e.phase!==`paused`||e.phase===`paused`&&(e.reason!==`not-sent`&&e.reason!==`rejected`&&e.reason!==`unconfirmed`||!de(e.error)||e.error.length>jc)||e.phase===`creating`&&!hc(e.createParams,e.sessionKey,e.agentId)?null:e}function bc(e,t){try{return e.removeItem(t),e.getItem(t)===null}catch{return!1}}function xc(e,t,n,r,i){try{let a=e.getItem(t);if(a===null)return null;let o=gc(a),s=o?yc(o,n,r,i):null;return!s||t!==sn(n,r,s.sessionKey)?(bc(e,t),null):s}catch{return null}}function Sc(e,t,n,r){let i=sn(r.gatewayUrl,r.recoveryScope,r.sessionKey),a=JSON.stringify(r);try{if(e.removeItem(t),e.getItem(t)!==null)return null;e.setItem(i,a);let n=xc(e,i,r.gatewayUrl,r.recoveryScope,r.sessionKey);if(n)return n}catch{}bc(e,i);try{e.setItem(t,n)}catch{}return null}function Cc(e,t){if(!e||!t)return[];try{let n=globalThis.sessionStorage;if(!n)return[];let r=new Map;for(let i of Yt(e,t)){let a=xc(n,i,e,t);a&&r.set(a.sessionKey,a)}return[...r.values()].toSorted((e,t)=>e.sessionKey.localeCompare(t.sessionKey))}catch{return[]}}function wc(e,t,n){for(let r of Cc(e,t))Dc({...r,recoveryScope:n})&&kc(e,t,r.sessionKey,r.messageId)}function Tc(e,t,n){if(!e||!t||!n)return null;try{let r=globalThis.sessionStorage;return r?xc(r,sn(e,t,n),e,t,n):null}catch{return null}}function Ec(e){let{gatewayUrl:t,recoveryScope:n,sessionKey:r}=e;if(!t||!n||!yc(e,t,n,r))return!1;try{let i=globalThis.sessionStorage;if(!i)return!1;let a=sn(t,n,r);return i.setItem(a,JSON.stringify(e)),!!xc(i,a,t,n,r)}catch{return!1}}function Dc(e,t=e.messageId){let n=Tc(e.gatewayUrl,e.recoveryScope,e.sessionKey);return n&&n.messageId!==t?!1:Ec(e)}function Oc(e,t){if(e===t.sessionKey)return Dc(t);try{let n=globalThis.sessionStorage;if(!n||!e)return!1;let r=sn(t.gatewayUrl,t.recoveryScope,e),i=n.getItem(r),a=xc(n,r,t.gatewayUrl,t.recoveryScope,e);if(!i||!a)return Dc(t);if(a.messageId!==t.messageId)return!1;let o=xc(n,sn(t.gatewayUrl,t.recoveryScope,t.sessionKey),t.gatewayUrl,t.recoveryScope,t.sessionKey);return o?o.messageId===t.messageId&&bc(n,r):!!Sc(n,r,i,t)}catch{return!1}}function kc(e,t,n,r){if(!(!e||!t))try{let i=globalThis.sessionStorage;if(!i)return;if(n){let a=sn(e,t,n);if(r&&gc(i.getItem(a)??``)?.messageId!==r)return;bc(i,a);return}let a=bt(e,t);for(let e=i.length-1;e>=0;--e){let t=i.key(e);t?.startsWith(a)&&bc(i,t)}}catch{}}function Ac(e,t,n,r=e.phase===`paused`?e.reason:e.phase===`sending`?`unconfirmed`:`not-sent`){let i={...e,phase:`paused`,reason:r,error:k(t).slice(0,jc)};return n&&!Dc(i)&&(Tc(e.gatewayUrl,e.recoveryScope,e.sessionKey)?.phase!==`paused`&&kc(e.gatewayUrl,e.recoveryScope,e.sessionKey,e.messageId),i.error=`Recovery could not be saved in this tab. Keep this page open.\n${i.error}`.slice(0,jc)),i}var jc,Mc,Nc;function Pc(){return(Pc=t((()=>{Da(),Li(),Zi(),N(),mt(),jc=4096,Mc=[`category`,`model`,`contextWindow`,`thinkingLevel`,`worktreeBaseRef`,`worktreeName`,`cwd`,`catalogId`,`projectId`],Nc=new Set([`key`,`agentId`,`message`,`worktree`,`incognito`,`visibility`,`permissionMode`,`fastMode`,`toolOverrides`,...Mc])})))()}function Fc(e){return e.orderKey??e.createdAt}function Ic(e,t){return Fc(e)-Fc(t)}function Lc(e){return!e.pendingRunId&&!e.intent&&(e.sendState===void 0||e.sendState===`waiting-idle`||e.sendState===`waiting-reconnect`||e.sendState===`failed`)}function Rc(e,t=Lc){let n=[],r=[];for(let i of e.toSorted(Ic)){if(t(i)){r.push(i);continue}r.length>0&&(n.push(r),r=[])}return r.length>0&&n.push(r),n}function zc(e,t,n){let r=e.toSorted(Ic),i=r.findIndex(e=>e.id===t),a=Math.min(Math.max(n,0),r.length-1);if(i<0||i===a)return[];let o=r.map(Fc);for(let e=1;e<o.length;e+=1)o[e]=Math.max(o[e],o[e-1]+1);let s=r.splice(i,1)[0];return r.splice(a,0,s),r.flatMap((e,t)=>Fc(e)===o[t]?[]:[{...e,orderKey:o[t]}])}function Bc(){return(Bc=t((()=>{})))()}function Vc(e,t){return e??Error(t)}function Hc(e){return new Promise((t,n)=>{e.addEventListener(`success`,()=>t(e.result),{once:!0}),e.addEventListener(`error`,()=>n(Vc(e.error,`IndexedDB request failed`)),{once:!0})})}function Uc(e){return new Promise((t,n)=>{e.addEventListener(`complete`,()=>t(),{once:!0}),e.addEventListener(`abort`,()=>n(Vc(e.error,`IndexedDB transaction aborted`)),{once:!0}),e.addEventListener(`error`,()=>n(Vc(e.error,`IndexedDB transaction failed`)),{once:!0})})}function Wc(){return Yc||(Yc=new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB is unavailable`));return}let n=indexedDB.open(Gc,Kc);n.addEventListener(`upgradeneeded`,()=>{let e=n.result;e.objectStoreNames.contains(`outboxPayloads`)||e.createObjectStore(`outboxPayloads`,{keyPath:`key`});let t=e.objectStoreNames.contains(qc)?n.transaction?.objectStore(qc):e.createObjectStore(qc,{keyPath:`key`});t&&!t.indexNames.contains(Jc)&&t.createIndex(Jc,Jc,{unique:!1})},{once:!0});let r=!1;n.addEventListener(`success`,()=>{let t=n.result;if(r){t.close(),Yc=null;return}t.addEventListener(`versionchange`,()=>{t.close(),Yc=null}),e(t)},{once:!0}),n.addEventListener(`error`,()=>{Yc=null,t(Vc(n.error,`IndexedDB open failed`))},{once:!0}),n.addEventListener(`blocked`,()=>{r=!0,t(Error(`IndexedDB upgrade was blocked`))},{once:!0})}),Yc)}var Gc,Kc,qc,Jc,Yc;function Xc(){return(Xc=t((()=>{Gc=`openclaw-control-ui`,Kc=2,qc=`composerDrafts`,Jc=`ownerKey`,Yc=null})))()}function Zc(e){return{status:`failed`,reason:e instanceof DOMException&&e.name===`QuotaExceededError`?`capacity`:`unavailable`}}async function Qc(e,t){let n=t.reduce((e,t)=>e+t.blob.size,0);if(n>al)return{status:`failed`,reason:`capacity`};try{let r=(await Wc()).transaction(il,`readwrite`,{durability:`strict`}),i=Uc(r),a=r.objectStore(il),o=await Hc(a.getAll()).catch(async e=>{throw await i,e}),s=o.reduce((e,t)=>e+(T(t)&&typeof t.bytes==`number`&&Number.isSafeInteger(t.bytes)&&t.bytes>=0?t.bytes:ol),0);if(o.length>=sl||s+n>ol)return await i,{status:`failed`,reason:`capacity`};let c=JSON.stringify([e.gatewayOwner,e.recoveryScope,e.queueId,crypto.randomUUID()]);return a.add({key:c,owner:e,bytes:n,attachments:t}),await i,{status:`ready`,value:{key:c,recoveryScope:e.recoveryScope,tabId:e.tabId}}}catch(e){return Zc(e)}}async function $c(e,t){if(t.recoveryScope!==e.recoveryScope)return{status:`failed`,reason:`missing`};try{let n=(await Wc()).transaction(il),r=Uc(n),[i]=await Promise.all([Hc(n.objectStore(il).get(t.key)),r]);if(!T(i)||!T(i.owner)||i.key!==t.key||i.owner.gatewayOwner!==e.gatewayOwner||i.owner.recoveryScope!==e.recoveryScope||i.owner.queueId!==e.queueId||i.owner.tabId!==t.tabId||!Array.isArray(i.attachments)||!i.attachments.length)return{status:`failed`,reason:`missing`};let a=[];for(let e of i.attachments){if(!T(e)||!(e.blob instanceof Blob)||typeof e.mimeType!=`string`||e.fileName!==void 0&&typeof e.fileName!=`string`||e.sizeBytes!==void 0&&e.sizeBytes!==e.blob.size)return{status:`failed`,reason:`missing`};a.push({blob:e.blob,mimeType:e.mimeType,...typeof e.fileName==`string`?{fileName:e.fileName}:{},...typeof e.sizeBytes==`number`?{sizeBytes:e.sizeBytes}:{}})}return i.bytes===a.reduce((e,t)=>e+t.blob.size,0)?{status:`ready`,value:a}:{status:`failed`,reason:`missing`}}catch(e){return Zc(e)}}async function el(e){try{let t=await tl(),n=e.filter(e=>e.tabId===t);if(!n.length)return;let r=(await Wc()).transaction(il,`readwrite`),i=r.objectStore(il);for(let e of n)i.delete(e.key);await Uc(r)}catch{}}function tl(){return ll??=(async()=>{let e=jt();if(!e||!globalThis.navigator?.locks)throw Error(`Outbox ownership unavailable`);let t=e=>new Promise((t,n)=>{navigator.locks.request(`openclaw-outbox:${e}`,{ifAvailable:!0},e=>(t(!!e),e?new Promise(()=>{}):void 0)).catch(n)}),n=e.getItem(cl),r=n&&await t(n)?n:crypto.randomUUID();if(r!==n&&!await t(r))throw Error(`Outbox ownership unavailable`);return e.setItem(cl,r),r})().catch(e=>{throw ll=null,e})}function nl(e){let t=e.client;if(!t||e.connected&&!t.recoveryScopeReady)return;t.recoveryScopeReady&&t.recoveryScope&&ul.set(t,t.recoveryScope);let n=ul.get(t);return n===t.recoveryScope?n:void 0}function rl(e,t){return!t.attachmentPayload||t.attachmentPayload.recoveryScope===nl(e)}var il,al,ol,sl,cl,ll,ul;function dl(){return(dl=t((()=>{Xc(),il=`outboxPayloads`,al=26214400,ol=262144e3,sl=1e3,cl=`openclaw.control.outboxTab.v1`,ll=null,ul=new WeakMap})))()}function fl(e){if(!T(e)||e.sessionId!==void 0&&typeof e.sessionId!=`string`)return!1;let t=e.action===`start`?[`action`,`sessionId`]:[`action`,`sessionId`,`goalId`,`previousDraft`];return Object.keys(e).every(e=>t.includes(e))&&(e.action===`start`||e.action===`edit`&&typeof e.goalId==`string`&&e.goalId.length>0&&typeof e.previousDraft==`string`)}function pl(){return(pl=t((()=>{})))()}function ml(e){let t=i(e?.name)??i(e?.username);if(t)return t;let n=i(e?.id);return n?/^([^@\s]+)@[^@\s]+$/.exec(n)?.[1]??n:null}function hl(e){let t=i(e?.id),n=i(e?.name),r=i(e?.username),a=i(e?.profileAvatarUrl),o=po(e?.identity);return!t&&!n&&!r&&!a?null:{...o?{identity:o}:{},...t?{id:t}:{},...n?{name:n}:{},...r?{username:r}:{},...a?{profileAvatarUrl:a}:{}}}function gl(e){return e?e.identity?JSON.stringify(e.identity,Object.keys(e.identity).toSorted()):[e.id??``,e.name??``,e.username??``,e.profileAvatarUrl??``].join(`\0`):null}function _l(){return(_l=t((()=>{vo()})))()}function vl(e){return typeof e==`boolean`?e:void 0}function yl(e){if(!T(e))return null;let t=e,r=n(t.id),i=n(t.mimeType);if(!r||!i)return null;let a={id:r,mimeType:i},o=n(t.fileName);o&&(a.fileName=o),typeof t.sizeBytes==`number`&&Number.isFinite(t.sizeBytes)&&(a.sizeBytes=t.sizeBytes);let s=n(t.dataUrl);return s&&(a.dataUrl=s),a}function bl(e){if(!T(e))return null;let t=e,i=n(t.id),a=typeof t.text==`string`?t.text:``,o=typeof t.createdAt==`number`&&Number.isFinite(t.createdAt)?t.createdAt:Date.now();if(!i||!a.trim()&&!Array.isArray(t.attachments)&&t.attachmentPayload===void 0&&t.attachmentStorageError===void 0)return null;let s=Array.isArray(t.attachments)?t.attachments.map(yl).filter(e=>e!==null):[],c={id:i,text:a,createdAt:o};if(t.attachmentPayload!==void 0){let e=t.attachmentPayload;T(e)&&typeof e.key==`string`&&typeof e.recoveryScope==`string`&&typeof e.tabId==`string`?c.attachmentPayload={key:e.key,recoveryScope:e.recoveryScope,tabId:e.tabId}:c.attachmentStorageError=`missing`}if((t.attachmentStorageError===`missing`||t.attachmentStorageError===`unavailable`||t.attachmentStorageError===`capacity`)&&(c.attachmentStorageError=t.attachmentStorageError),Array.isArray(t.attachments)&&s.length!==t.attachments.length&&(c.attachmentStorageError=`missing`),c.attachmentPayload&&!s.length&&(c.attachmentStorageError=`missing`),t.intent!==void 0){let e=t.intent;if(!T(e)||Object.keys(e).length!==3||e.kind!==`session-goal-start`||e.version!==1||typeof e.issuedAtMs!=`number`||!Number.isSafeInteger(e.issuedAtMs)||e.issuedAtMs<=0)return null;c.intent={kind:e.kind,version:e.version,issuedAtMs:e.issuedAtMs};let r=n(t.sessionId);r&&(c.sessionId=r),(t.expectedLeafEntryId===null||typeof t.expectedLeafEntryId==`string`)&&(c.expectedLeafEntryId=t.expectedLeafEntryId)}typeof t.orderKey==`number`&&Number.isFinite(t.orderKey)&&(c.orderKey=t.orderKey);let l=hl(t.sender);l&&(c.sender=l);let u=t.kind===`steered`||n(t.steerTargetRunId)!==void 0||t.sendState===`steering`?`steer`:Ka(typeof t.queueMode==`string`?t.queueMode:void 0);u&&(c.queueMode=u),s.length&&(c.attachments=s);let d=vl(t.refreshSessions);d!==void 0&&(c.refreshSessions=d);let f=n(t.replyToId);f&&(c.replyToId=f),t.sendState===`steering`||t.sendState===`executing-command`?c.sendState=`unconfirmed`:t.sendState===`sending`?c.sendState=`waiting-reconnect`:t.sendState===`failed`||t.sendState===`unconfirmed`||t.sendState===`waiting-idle`||t.sendState===`waiting-reconnect`?c.sendState=t.sendState:t.sendState===`waiting-model`&&(c.sendState=`failed`,c.sendError=Cl);let p=n(t.sendError);p&&(c.sendError=p);let m=n(t.sendRunId);m&&(c.sendRunId=m),typeof t.sendAttempts==`number`&&Number.isFinite(t.sendAttempts)&&(c.sendAttempts=t.sendAttempts);let h=n(t.localCommandArgs);h&&(c.localCommandArgs=h);let g=n(t.localCommandName);g&&(c.localCommandName=g);let _=n(t.sessionKey);_&&(c.sessionKey=_);let v=n(t.agentId);return v&&(c.agentId=r(v)),c}function xl(e){if(!T(e))return null;let t=e,r=typeof t.draft==`string`?t.draft:void 0;if(t.goalMode!==void 0&&!fl(t.goalMode))return null;let i=t.goalMode;if(Array.isArray(t.queue)&&t.queue.length>Sl)return null;let a=Array.isArray(t.queue)?t.queue.map(bl).filter(e=>e!==null):void 0,o=Array.isArray(t.removedQueueItemIds)?t.removedQueueItemIds.map(n).filter(e=>e!==void 0):void 0,s=new Set(o??[]),c=a?.filter(e=>!s.has(e.id)),l=typeof t.updatedAt==`number`&&Number.isFinite(t.updatedAt)?t.updatedAt:Date.now(),u=(typeof t.draftRevision==`number`&&Number.isSafeInteger(t.draftRevision)?t.draftRevision:void 0)??(r?l:void 0);return!r&&!i&&u===void 0&&(!c||c.length===0)?null:{...t.awaitingDefaults===!0?{awaitingDefaults:!0}:{},...r?{draft:r}:{},...i?{goalMode:i}:{},...u===void 0?{}:{draftRevision:u},...c&&c.length>0?{queue:c}:{},updatedAt:l}}var Sl,Cl;function wl(){return(wl=t((()=>{Ja(),O(),pl(),_l(),Sl=1e3,Cl=`Chat settings update was interrupted. Review and retry when ready.`})))()}function Tl(e){jl=Math.max(jl,e??0)}function El(e=0){let t=Math.max(Date.now(),jl+1,e+1);return jl=t,t}function Dl(e,t,n,r){if(r===void 0)return;let i=Ml.get(e);i||(i=new Map,Ml.set(e,i));let a=i.get(t);a||(a=new Map,i.set(t,a)),a.set(n,Math.max(a.get(n)??0,r))}function Ol(e,t,n,r){let i=Nl.get(e);i||(i=new Map,Nl.set(e,i));let a=i.get(t);a||(a=new Map,i.set(t,a)),a.set(n,Math.max(a.get(n)??0,r))}function kl(e,t,n){return Ml.get(e)?.get(t)?.get(n)??0}function Al(e,t,n){return Nl.get(e)?.get(t)?.get(n)??0}var jl,Ml,Nl;function Pl(){return(Pl=t((()=>{jl=0,Ml=new WeakMap,Nl=new WeakMap})))()}function Fl(e){return ru.add(e),!iu&&typeof window<`u`&&(iu=!0,window.addEventListener(`storage`,Ll)),()=>{ru.delete(e),iu&&ru.size===0&&typeof window<`u`&&(iu=!1,window.removeEventListener(`storage`,Ll))}}function Il(){for(let e of ru)try{e()}catch(e){console.error(`[openclaw] stored chat outbox listener failed`,e)}}function Ll(e){if(e.key===null&&e.storageArea){su.get(e.storageArea)?.clear(),Il();return}(e.key?.startsWith(tu)||e.key?.startsWith(Ql)||e.key?.startsWith($l)||e.key?.startsWith(eu))&&(e.storageArea&&su.get(e.storageArea)?.clear(),Il())}function Rl(e){let t=e?.trim()||`default`,n=encodeURIComponent(t);return{key:`${tu}${n}`,legacyKey:`${Ql}${n.slice(0,240)}`,previousKey:`${$l}${n}`,blobKey:`${eu}${n}`,gatewayOwner:t,legacyOwnerIsUnambiguous:n.length<240}}function zl(e){let t=e.lastIndexOf(`\0agent:`);if(t<1)return null;let n=e.slice(0,t),i=e.slice(t+7),a=E(n)?.agentId;if(a&&r(i)!==r(a))return null;let o=a??(n===`global`&&i!==nu?i:void 0);return{sessionKey:n,...o?{agentId:r(o)}:{}}}function Bl(e,t){let n=!1;for(let[r,i]of Object.entries(e.sessions)){if(!i.awaitingDefaults||!yn(t))continue;let a=zl(r);if(!a)continue;let o=Vl(t,a.sessionKey,a.agentId),s=Wl(o),{awaitingDefaults:c,...l}=i,u=e.sessions[s];if(s!==r&&u){let t=new Set(u.queue?.map(e=>e.id)),n=l.queue?.some(e=>t.has(e.id)),i=(l.draftRevision??0)>(u.draftRevision??0);if(n||l.draft&&!i)Gl(e,`pending:${r}`,4,r,l);else{let t=i?l:u;e.sessions[s]={...t,queue:[...u.queue??[],...(l.queue??[]).map(e=>Zl(e,o))],updatedAt:Math.max(l.updatedAt,u.updatedAt)}}}else e.sessions[s]={...l,...l.queue?{queue:l.queue.map(e=>Zl(e,o))}:{}};s!==r&&delete e.sessions[r],n=!0}return n}function Vl(e,t,n){return Re(e,t,n)}function Hl(e,t,n){return{scope:Vl(e,t,n),awaitingDefaults:!yn(e)}}function Ul(e){return e.agentId??E(e.sessionKey)?.agentId}function Wl(e){let t=e.sessionKey.trim().toLowerCase(),n=Ul(e)??(t===`global`||t===`main`?nu:`main`);return`${e.sessionKey}\u0000agent:${n}`}function Gl(e,t,n,r,i){let{queue:a,...o}=i,s=new Map;(o.draft||o.goalMode||!a?.length&&o.draftRevision!==void 0)&&s.set(void 0,[]);for(let e of a??[]){let t=e.attachmentPayload?.recoveryScope;s.set(t,[...s.get(t)??[],e])}for(let[a,c]of s)e.recovery[`${t}:${JSON.stringify(a??null)}`]={sourceVersion:n,sourceScopeKey:r,session:{...a===void 0?o:{updatedAt:i.updatedAt,draftRevision:i.draftRevision},...c.length?{queue:c}:{}}}}function Kl(e,t,n,r,i,a){let o=i?Wl(i):n,s=r.queue?.some(e=>e.sessionKey&&e.sessionKey!==i?.sessionKey||e.agentId&&e.agentId!==i?.agentId);i&&!s&&!e.sessions[o]&&Object.keys(e.sessions).length<20?e.sessions[o]={...r,...r.queue?{queue:r.queue.map(e=>({...e,...i}))}:{}}:Gl(e,`${t}:${a}:${n}`,t,n,r)}function ql(e,t){let n=e.getItem(t.key),r=n?JSON.parse(n):{version:4,gatewayOwner:t.gatewayOwner,sessions:{},recovery:{}};if(n){if(r.version!==4||r.gatewayOwner!==t.gatewayOwner||!r.sessions||!r.recovery)throw Error(`Chat outbox owner or version mismatch`);for(let[n,i]of Object.entries(r.sessions)){let a=xl(i);if(!a)throw Error(`Invalid chat outbox record`);r.sessions[n]=a,Tl(a.draftRevision),Dl(e,t.key,n,a.draftRevision)}}let i=[];for(let[a,o]of[[t.blobKey,3],[t.previousKey,2],...t.legacyOwnerIsUnambiguous?[[t.legacyKey,1]]:[]]){let s=e.getItem(a);if(!s)continue;let c=Yi(Oa(new TextEncoder().encode(s)));if(r.legacyReceipts?.[o]===c){i.push({key:a,raw:s});continue}let l=JSON.parse(s);if(l.version!==o||o!==1&&l.gatewayOwner!==t.gatewayOwner||!l.sessions)throw Error(`Chat outbox legacy owner or version mismatch`);let u={...r.sessions},d={...r.recovery};for(let[e,t]of Object.entries(l.sessions)){let i=xl(t),a=T(t)&&Array.isArray(t.removedQueueItemIds)?t.removedQueueItemIds:[],s=T(t)&&Array.isArray(t.queue)?t.queue.filter(e=>!T(e)||!a.includes(e.id)):[];if(!i||s.length!==(i.queue?.length??0))throw Error(`Invalid legacy chat outbox record`);let u=zl(e),d=u&&(E(u.sessionKey)||o===1&&u.sessionKey===`global`&&u.agentId||u.sessionKey!==`global`&&u.sessionKey!==`main`&&u.sessionKey!==l.mainAlias?.key);if(!n&&o!==1&&u?.sessionKey===`global`){let t=new Map;i.queue=i.queue?.filter(e=>{let n=E(e.sessionKey);if(!n||e.agentId&&e.agentId!==n.agentId)return!0;let i=Wl({sessionKey:e.sessionKey,agentId:n.agentId});return!t.has(i)&&Object.keys(r.sessions).length+t.size>=20||(t.set(i,[...t.get(i)??[],e]),!1)});for(let[n,a]of t)Kl(r,o,`${e}:${n}`,{queue:a,updatedAt:i.updatedAt},zl(n),c)}(i.draft||i.goalMode||i.draftRevision!==void 0||i.queue?.length)&&Kl(r,o,e,i,!n&&d?u:null,c)}if(Object.keys(r.recovery).length>au){r.sessions=u,r.recovery=d,r.recoveryBlocked=!0;continue}r.legacyReceipts={...r.legacyReceipts,[o]:c},i.push({key:a,raw:s})}if(i.length){ou.set(r,i);try{Yl(e,t,r)}catch{}}return r}function Jl(e,t){let n=su.get(e),r=n?.get(t.key);if(r)return r;let i=ql(e,t),a=n??new Map;return a.set(t.key,i),su.set(e,a),i}function Yl(e,t,n){let r=e.getItem(t.key);if(su.get(e)?.delete(t.key),Object.keys(n.recovery).length>au)throw Error(`Chat outbox recovery limit reached; legacy source retained`);let i=Object.entries(n.sessions),a=i.filter(([,e])=>e.queue?.length);if(a.length>20)throw Error(`Chat outbox session limit reached`);let o=i.filter(([,e])=>!e.queue?.length),s=`global\u0000agent:${nu}`,c=(e,t)=>Number(t[1].awaitingDefaults===!0&&!E(t[0]))-Number(e[1].awaitingDefaults===!0&&!E(e[0]))||t[1].updatedAt-e[1].updatedAt||(t[1].draftRevision??0)-(e[1].draftRevision??0)||e[0].localeCompare(t[0]),l=o.find(([e])=>e===s),u=[...l?[l]:[],...o.filter(([e,t])=>e!==s&&!t.draft&&t.draftRevision!==void 0).toSorted(c)].slice(0,20),d=[...[...a.toSorted(c),...o.filter(([e,t])=>e!==s&&!!t.draft).toSorted(c)].slice(0,20),...u];if(d.length===0&&Object.keys(n.recovery).length===0&&!ou.has(n)&&!n.legacyReceipts){if(e.removeItem(t.key),e.getItem(t.key)!==null)throw Error(`Chat outbox removal verification failed`);Xl(e,t,r,null);return}if(ou.has(n)&&d.length<i.length)throw Error(`Chat outbox migration exceeds retention; source retained`);let f=JSON.stringify({version:4,gatewayOwner:t.gatewayOwner,sessions:Object.fromEntries(d),recovery:n.recovery,...n.legacyReceipts?{legacyReceipts:n.legacyReceipts}:{}});if(e.setItem(t.key,f),e.getItem(t.key)!==f)throw Error(`Chat outbox write verification failed`);for(let t of ou.get(n)??[])if(e.getItem(t.key)===t.raw)try{e.removeItem(t.key)}catch{}ou.delete(n),Xl(e,t,r,f)}function Xl(e,t,n,r){if(n)try{if([t.legacyKey,t.previousKey,t.blobKey].some(t=>e.getItem(t)!==null))return;let i=e=>{if(e===null)return[];let n=JSON.parse(e);if(!T(n)||n.version!==4||n.gatewayOwner!==t.gatewayOwner||!T(n.sessions)||!T(n.recovery))throw Error(`Unreadable outbox retention source`);return[...Object.values(n.sessions),...Object.values(n.recovery).map(e=>{if(!T(e))throw Error(`Unreadable recovery source`);return e.session})].flatMap(e=>{if(!T(e)||e.queue!==void 0&&!Array.isArray(e.queue))throw Error(`Unreadable outbox row`);return(e.queue??[]).flatMap(e=>{if(!T(e))throw Error(`Unreadable outbox item`);let t=e.attachmentPayload;if(t===void 0)return[];if(!T(t)||typeof t.key!=`string`||typeof t.recoveryScope!=`string`||typeof t.tabId!=`string`)throw Error(`Unreadable outbox payload reference`);return[{key:t.key,recoveryScope:t.recoveryScope,tabId:t.tabId}]})})},a=new Set(i(r).map(e=>e.key)),o=i(n).filter(e=>!a.has(e.key));o.length&&el(o)}catch{}}function Zl(e,t){let{agentId:n,...r}=e,i=Ul(t);return{...r,sessionKey:t.sessionKey,...i?{agentId:i}:{}}}var Ql,$l,eu,tu,nu,ru,iu,au,ou,su;function cu(){return(cu=t((()=>{na(),zi(),O(),dl(),wl(),Pl(),Ql=`openclaw.control.chatComposer.v1:`,$l=`openclaw.control.chatComposer.v2:`,eu=`openclaw.control.chatComposer.v3:`,tu=`openclaw.control.chatComposer.v4:`,nu=`@unresolved`,ru=new Set,iu=!1,au=80,ou=new WeakMap,su=new WeakMap})))()}function lu(e){let t=jt();if(!t)return[];try{let n=Rl(e.settings?.gatewayUrl),r=Jl(t,n);if(Bl(r,e))try{Yl(t,n,r)}catch{}return Object.entries(r.sessions).flatMap(([t,n])=>{let r=zl(t);return r?[{scope:r,session:{...n,queue:n.queue?.filter(t=>rl(e,t))}}]:[]})}catch{return[]}}function uu(e){return lu(e).flatMap(({scope:e,session:t})=>t.queue?.length?[{...e,queue:t.queue.toSorted(Ic)}]:[]).toSorted((e,t)=>(e.queue[0]?.createdAt??2**53-1)-(t.queue[0]?.createdAt??2**53-1)||e.sessionKey.localeCompare(t.sessionKey))}function du(e){let t=new Map,n=new Set;for(let{scope:r,session:i}of lu(e)){let e=Wl(r);i.draft&&n.add(e);let a=t.get(e)??{all:new Set,attention:new Set};for(let e of i.queue??[])e.pendingRunId||(a.all.add(e.id),(e.sendState===`failed`||e.sendState===`unconfirmed`)&&a.attention.add(e.id));a.all.size&&t.set(e,a)}let r=new Map,i=new Map,a=0;for(let[e,n]of t)r.set(e,n.all.size),a+=n.all.size,n.attention.size&&i.set(e,n.attention.size);return{countsByScope:r,attentionCountsByScope:i,draftScopes:n,total:a}}function fu(){return(fu=t((()=>{dl(),cu()})))()}function pu(e){return e.startsWith(`/`)&&_u.some(t=>e.startsWith(t)||e.includes(t))}function mu(e){let t=e.trim();if(!t)return;let n;try{if(/^https?:\/\//i.test(t)||pu(t)){let e=new URL(t,`https://openclaw.invalid`).pathname;n=e.slice(e.lastIndexOf(`/`)+1);try{let e=n.replace(/%2f/gi,`%252F`).replace(/%5c/gi,`%255C`);n=decodeURIComponent(e)}catch{}}else n=t.split(/[\\/]/).pop()??t}catch{n=t.split(/[\\/]/).pop()??t}return n||void 0}function hu(e){let t=mu(e);if(t)return/\.([a-zA-Z0-9]+)$/.exec(t)?.[1]?.toLowerCase()}function gu(e){let t=hu(e);return t!==void 0&&vu.has(t)}var _u,vu;function yu(){return(yu=t((()=>{_u=[`/__openclaw__/assistant-media`,`/__openclaw__/media/`,`/api/chat/media/outgoing/`,`/media/inbound/`],vu=new Set([`avi`,`m4v`,`mkv`,`mov`,`mp4`,`mpeg`,`mpg`,`webm`])})))()}function bu(e){return{key:e.key,agentId:e.agentId,...e.target.kind===`profile`?{profileId:e.target.profileId,...e.target.machineClass?{machineClass:e.target.machineClass}:{}}:e.target.kind===`device`?{deviceId:e.target.deviceId}:{autoDevice:!0}}}function xu(e){return e instanceof Jn?e.retryable||e.gatewayCode===`UNAVAILABLE`:!0}async function Su(e,t){try{let n=await e.request(`sessions.describe`,{key:t});if(n?.session===null)return{status:`missing`};let r=n?.session?.sessionId;return{status:`read`,placement:n?.session?.placement,...typeof r==`string`&&r.trim()?{sessionId:r}:{}}}catch(e){return xu(e)?{status:`unavailable`}:{status:`rejected`,error:k(e)}}}async function Cu(e,t){t.abortRun&&await e.request(`sessions.abort`,{key:t.key,agentId:t.agentId}).catch(()=>void 0);try{await e.request(`sessions.reclaim`,{key:t.key,agentId:t.agentId});return}catch(e){return k(e)}}async function wu(e,t,n){let r=t.initial?{status:`read`,placement:t.initial}:void 0,i=0,a=0;for(let o=0;o<Au;o+=1){let o=r??await Su(e,t.key);if(r=void 0,o.status===`missing`)return{status:`missing`};if(o.status===`rejected`)return{status:`cleanup-rejected`,error:o.error};if(o.status===`unavailable`){i+=1;let r=!n();if(r||i>=ju){if(!t.cleanupOnCancellation&&r)return{status:`interrupted`};let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});if(r)return n?{status:`cleanup-rejected`,error:n}:{status:`cancelled`};let i=`session placement could not be verified`;return{status:`cleanup-rejected`,error:n?`${i}; cleanup failed: ${n}`:i}}await new Promise(e=>{globalThis.setTimeout(e,ku)});continue}if(i=0,o.status===`read`){let r=o.placement;if(r)a=0;else if(a+=1,a>=Mu)return{status:`cleanup-rejected`,error:`session placement could not be verified`};if(!n()){if(!t.cleanupOnCancellation)return{status:`interrupted`};let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});return n?{status:`cleanup-rejected`,error:n}:{status:`cancelled`}}if(r?.state===`active`)return{status:`active`,placement:r};if(r&&!Nu.has(r.state)){if(r.state===`failed`){let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});if(n)return{status:`cleanup-rejected`,error:n}}return{status:`rejected`,placement:r}}}await new Promise(e=>{globalThis.setTimeout(e,ku)})}if(!t.cleanupOnCancellation&&!n())return{status:`interrupted`};if(!n()){let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});return n?{status:`cleanup-rejected`,error:n}:{status:`cancelled`}}return{status:`cleanup-rejected`,error:n()?`session placement reconciliation timed out`:`session placement cleanup timed out`}}async function Tu(e,t,n){if(!e)return`gateway unavailable during draft cleanup`;let r=await Su(e,t);if(r.status!==`missing`)return r.status===`rejected`?r.error:r.status===`unavailable`?`placement draft session could not be verified`:r.sessionId?Eu(e,{key:t,agentId:n,sessionId:r.sessionId}):`placement draft session identity is unavailable`}async function Eu(e,t){try{await e.request(`sessions.patch`,{key:t.key,agentId:t.agentId,archived:!0,expectedSessionId:t.sessionId})}catch(e){return k(e)}try{if((await e.request(`sessions.delete`,{key:t.key,agentId:t.agentId,deleteTranscript:!0,expectedSessionId:t.sessionId,archivedOnly:!0})).deleted!==!0)throw Error(`placement draft session was not deleted`);return}catch(n){let r=k(n);try{await e.request(`sessions.patch`,{key:t.key,agentId:t.agentId,archived:!1,expectedSessionId:t.sessionId})}catch(e){return`${r}; restoring the placement draft failed: ${k(e)}`}return r}}async function Du(e,t,n){if(!e)return`gateway unavailable during draft cleanup`;let r=await Su(e,t);if(r.status!==`missing`){if(r.status===`rejected`)return r.error;if(r.status===`unavailable`)return`session placement could not be verified`;if(r.placement){let r=await Cu(e,{key:t,agentId:n,abortRun:!1});if(r)return r}return r.sessionId?Eu(e,{key:t,agentId:n,sessionId:r.sessionId}):`placement draft session identity is unavailable`}}async function Ou(e,t,n,r=()=>!0){let i=t.cleanupOnCancellation!==!1,a,o=``;if(t.recovering){let r=await Su(e,t.key);a=r.status===`missing`?{status:`missing`}:r.status===`rejected`?{status:`cleanup-rejected`,error:r.error}:await wu(e,{key:t.key,agentId:t.agentId,initial:r.status===`read`?r.placement:void 0,cleanupOnCancellation:i},n)}if(!a)try{let r=await e.request(`sessions.dispatch`,bu({key:t.key,agentId:t.agentId,target:t.target}));a=await wu(e,{key:t.key,agentId:t.agentId,initial:r.placement,cleanupOnCancellation:i},n)}catch(r){if(o=k(r),!i&&!n())return{status:`interrupted`};if(!xu(r))return{status:`dispatch-rejected`,error:o};a=await wu(e,{key:t.key,agentId:t.agentId,cleanupOnCancellation:i},n)}if(!i&&!n())return{status:`interrupted`};if(a.status===`cancelled`||a.status===`interrupted`||a.status===`cleanup-rejected`)return a;if(a.status===`missing`)return{status:`session-missing`,error:`placement draft session no longer exists`};if(a.status===`rejected`){let e=typeof a.placement?.state==`string`?a.placement.state:``;return{status:`dispatch-rejected`,error:o||(e?`session placement became ${e}`:``)}}if(!n()){if(!i)return{status:`interrupted`};let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});return n?{status:`cleanup-rejected`,error:n}:{status:`cancelled`}}let s=t.messageId??ge(),c=async(n,r)=>{let i=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!1});return{status:r,messageId:s,error:i?`${n}; cleanup failed: ${i}`:n}};if(!r())return c(`placement recovery storage is unavailable`,`send-not-started`);try{let r=await e.request(`sessions.send`,{key:t.key,agentId:t.agentId,message:t.message,attachments:t.attachments,idempotencyKey:s});if(!n()){if(!i)return{status:`interrupted`};let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!0});return n?{status:`cleanup-rejected`,error:n,messageId:s}:{status:`cancelled`}}let a=Ao(r,s);if(Do(a))return c(Oo(a,`chat`),`send-definitive-rejected`);let o=r?.messageSeq;return{status:`started`,messageId:s,...typeof o==`number`&&Number.isSafeInteger(o)&&o>0?{messageSeq:o}:{}}}catch(r){if(!n()){if(!i)return{status:`interrupted`};let n=await Cu(e,{key:t.key,agentId:t.agentId,abortRun:!0});return n?{status:`cleanup-rejected`,error:n,messageId:s}:{status:`cancelled`}}return r instanceof mr||r instanceof Error&&!(r instanceof Jn)&&r.message===`gateway not connected`?c(k(r),`send-not-started`):xu(r)?{status:`send-rejected`,error:k(r),messageId:s}:c(k(r),`send-definitive-rejected`)}}var ku,Au,ju,Mu,Nu;function Pu(){return(Pu=t((()=>{Mr(),N(),Vt(),jo(),ko(),ku=250,Au=1200,ju=4,Mu=20,Nu=new Set([`requested`,`provisioning`,`syncing`,`starting`,`draining`,`reconciling`])})))()}async function Fu(e){let t=e.persistRecovery!==!1,n=e.recovery,r=`not-sent`,i=(e,i=r)=>({status:`paused`,recovery:Ac(n,e,t,i)}),a=()=>e.isLifecycleCurrent()&&e.ownsRecovery();if(n.phase===`sending`||n.phase===`paused`&&n.reason===`unconfirmed`){if(!a())return{status:`interrupted`};let t=await e.client.request(`chat.history`,{sessionKey:n.sessionKey,...be(n.sessionKey)?{agentId:n.agentId}:{},limit:1e3}).catch(e=>({messages:[],error:k(e)}));return a()?Mo(t.messages,{id:n.messageId,text:n.message,createdAt:Date.now(),sendRunId:n.messageId},!0)?(e.clearRecovery(`resolved`),{status:`started`,messageId:n.messageId}):i(`error`in t?t.error:`No matching user message was found in the available history. Delivery remains unconfirmed.`,`unconfirmed`):{status:`interrupted`}}if(n.phase===`paused`)return{status:`paused`,recovery:n};let o=e.recovering&&t?Tc(n.gatewayUrl,n.recoveryScope,n.sessionKey):null;if(!a()){if(!e.cleanupOnCancellation)return{status:`interrupted`};let r=t?e.recovering?o?.messageId===n.messageId:Dc(n):!1,i=e.recovering?await Du(e.client,n.sessionKey,n.agentId):await Tu(e.client,n.sessionKey,n.agentId);return i||e.clearRecovery(`resolved`),{status:`cancelled`,cleanupError:i,recoveryPersisted:i?r:!1}}let s=t?e.recovering?o?.messageId===n.messageId:Dc(n):!0;if(!a()||!s){if(!e.cleanupOnCancellation&&!a())return{status:`interrupted`};if(e.recovering&&!s)return{status:`cancelled`,cleanupError:`placement recovery storage is unavailable`,recoveryPersisted:!1};let t=e.recovering?await Du(e.client,n.sessionKey,n.agentId):await Tu(e.client,n.sessionKey,n.agentId);return t||e.clearRecovery(`resolved`),{status:`cancelled`,cleanupError:t,recoveryPersisted:s}}let c=await Ou(e.client,{key:n.sessionKey,agentId:n.agentId,target:n.target,message:n.message,attachments:n.attachments,messageId:n.messageId,recovering:e.recovering,cleanupOnCancellation:e.cleanupOnCancellation},a,()=>{if(!t)return r=`unconfirmed`,e.setRecoveryPhase(`sending`,!1),!0;let i=Tc(n.gatewayUrl,n.recoveryScope,n.sessionKey);if(i&&i.messageId!==n.messageId)return!1;let a=Ec({...n,phase:`sending`});return a&&(r=`unconfirmed`,e.setRecoveryPhase(`sending`,!0)),a});if(!e.cleanupOnCancellation&&!a())return{status:`interrupted`};if(c.status===`interrupted`)return c;if(c.status===`cancelled`){let r=await Tu(e.client,n.sessionKey,n.agentId);return r||e.clearRecovery(`resolved`),{status:`cancelled`,cleanupError:r,recoveryPersisted:t}}return c.status===`cleanup-rejected`?i(c.error):c.status===`session-missing`?(e.clearRecovery(`resolved`),{status:`cancelled`,recoveryPersisted:!1}):c.status===`send-not-started`?i(c.error,`not-sent`):c.status===`send-definitive-rejected`?i(c.error,`rejected`):c.status===`dispatch-rejected`||c.status===`send-rejected`?i(c.error):e.isLifecycleCurrent()?e.ownsRecovery()?(e.clearRecovery(`resolved`),c):(e.clearRecovery(`resolved`),{status:`ownership-lost`}):(e.clearRecovery(`interrupted`),{status:`interrupted`})}function Iu(){return(Iu=t((()=>{ko(),N(),O(),Pc(),Pu()})))()}function Lu(e){return Bu.has(e)}function Ru(e){let t=e.work.recovery;return{id:t.messageId,text:t.message,attachments:e.attachments,createdAt:e.createdAt,sessionKey:t.sessionKey,agentId:t.agentId,sendRunId:t.messageId,sendAttempts:1,sendState:e.work.kind===`checking`?`unconfirmed`:t.phase===`paused`?t.reason===`unconfirmed`?`unconfirmed`:`failed`:`sending`,...t.phase===`paused`?{sendError:t.error}:{}}}function zu(e){let t=new Set,n=new Map,r=He(e.gateway.snapshot),i=()=>{for(let e of t)e()},a=e=>{for(let[t,r]of n)if(j(t,e))return{key:t,entry:r};return null},o=e=>a(e.owner.sessionKey)?.entry===e,s=t=>{let n=e.gateway.snapshot;return!!(t.retainsConnection()&&r.isCurrent(t.scope)&&n.client?.recoveryScopeReady)},c=e=>{let t=e.persistRecovery?Tc(e.owner.gatewayUrl,e.owner.recoveryScope,e.owner.sessionKey):null;return o(e)&&(!t||t.messageId===e.owner.messageId)},l=e=>s(e)&&c(e),u=(e,t=!0)=>{let r=a(e.owner.sessionKey);r?.entry===e&&(n.delete(r.key),t&&i())},d=(t,n,r)=>{let i=No({text:n.message,attachments:t.attachments,createdAt:t.createdAt,runId:r.messageId,sequence:r.messageSeq});i&&e.initialUserMessage.prepare({sessionKey:t.owner.sessionKey,owner:t.scope.client,pendingRunId:r.messageId,message:i})},f=t=>{l(t)&&e.sessions.refresh({force:!0,backgroundHydrate:!0}).catch(()=>void 0)},p=(e,t,n)=>{e.work={kind:`paused`,recovery:Ac(t,n,e.persistRecovery)},i()},m=(t,n,r)=>{let a=!1,o=n;Fu({client:t.scope.client,recovery:o,persistRecovery:t.persistRecovery,cleanupOnCancellation:!t.persistRecovery,recovering:r,isLifecycleCurrent:()=>s(t),ownsRecovery:()=>c(t),clearRecovery:()=>kc(t.owner.gatewayUrl,t.owner.recoveryScope,t.owner.sessionKey,t.owner.messageId),setRecoveryPhase:e=>{o={...o,phase:e},t.work={kind:`running`,recovery:o},i()}}).then(n=>{if(!c(t)||!t.retainsConnection()){u(t);return}if(n.status===`paused`){t.work={kind:`paused`,recovery:n.recovery},i(),g(e.gateway.snapshot);return}if(n.status===`cancelled`&&n.cleanupError){p(t,o,n.cleanupError),g(e.gateway.snapshot);return}if(!s(t)){n.status!==`interrupted`&&u(t);return}n.status===`started`&&(a=!0,d(t,o,n)),u(t)}).catch(e=>{l(t)&&p(t,o,k(e))}).finally(()=>{a||f(t)})},h=t=>{if(t.recovery.phase===`creating`)return;r.transition(e.gateway.snapshot);let o=a(t.recovery.sessionKey)?.entry;if(o&&l(o)&&o.owner.messageId===t.recovery.messageId&&(o.work.kind!==`paused`||t.recovery.phase===`paused`))return;o&&u(o,!1);let s=r.capture();if(!s)return;let c={sessionKey:t.recovery.sessionKey,messageId:t.recovery.messageId,gatewayUrl:t.recovery.gatewayUrl,recoveryScope:t.recovery.recoveryScope},d={work:t.recovery.phase===`paused`?{kind:`paused`,recovery:t.recovery}:{kind:t.recovery.phase===`sending`?`checking`:`running`,recovery:t.recovery},owner:c,attachments:Ro(t.recovery.attachments),persistRecovery:t.persistRecovery,createdAt:t.createdAt,scope:s,retainsConnection:Tr(e.gateway,c)};n.set(c.sessionKey,d),i(),t.recovery.phase!==`paused`&&m(d,t.recovery,t.recovering)},g=t=>{if(r.transition(t),t.phase===`connected`&&!(!t.client?.recoveryScopeReady||!t.client.recoveryScope)){for(let e of n.values())e.work.kind!==`running`&&!s(e)&&e.retainsConnection()&&c(e)&&h({recovery:e.work.recovery,persistRecovery:e.persistRecovery,recovering:!0,createdAt:e.createdAt});for(let n of Cc(e.gateway.connection.gatewayUrl,t.client.recoveryScope))h({recovery:n,persistRecovery:!0,recovering:!0,createdAt:Date.now()})}};return{resumeRecovery:()=>g(e.gateway.snapshot),hasPendingTurn(e){let t=a(e)?.entry;return!!(t&&t.retainsConnection()&&c(t))},get(t){let n=a(t)?.entry;if(!n||!l(n))return null;let r=n.work.kind===`running`?n.work.recovery.phase===`sending`?`sending`:`pending`:`failed`;if(r===`pending`){let t=(e.sessions.state.result?.sessions.find(e=>j(e.key,n.owner.sessionKey)))?.placement?.state;t&&Lu(t)&&(r=t)}return{sessionKey:n.owner.sessionKey,phase:r,startedAt:n.createdAt,initialTurn:Ru(n),...n.work.kind===`running`?{}:{...n.work.recovery.phase===`paused`?{error:n.work.recovery.error}:{},retryable:!0,action:n.work.kind===`checking`||n.work.recovery.phase===`paused`&&n.work.recovery.reason===`unconfirmed`?`check-delivery`:`retry`}}},start:h,retry(e){let t=a(e)?.entry;if(!t||t.work.kind!==`paused`||!l(t))return;if(t.work.recovery.reason===`unconfirmed`){t.work={kind:`checking`,recovery:t.work.recovery},i(),m(t,t.work.recovery,!0);return}let{reason:n,error:r,...o}=t.work.recovery,s={...o,phase:`dispatching`,messageId:n===`rejected`?ge():o.messageId};if(t.persistRecovery&&!Dc(s,o.messageId)){p(t,t.work.recovery,`placement recovery storage is unavailable`);return}h({recovery:s,persistRecovery:t.persistRecovery,recovering:!1,createdAt:t.createdAt})},subscribe(e){return t.add(e),()=>t.delete(e)},dispose(){r.dispose(),n.clear(),t.clear()}}}var Bu;function Vu(){return(Vu=t((()=>{N(),O(),Pc(),Iu(),Vt(),zo(),Lo(),Xr(),Bu=new Set([`requested`,`provisioning`,`syncing`,`starting`,`active`])})))()}function Hu(){let e,t=new Promise((t,n)=>{e=setTimeout(()=>n(Error(`Service worker not ready (timed out)`)),cd)});return Promise.race([navigator.serviceWorker.ready,t]).finally(()=>{e!==void 0&&clearTimeout(e)})}function Uu(e){let t=e?.pushManager;return t&&typeof t.getSubscription==`function`?t:null}function Wu(e){let t=Uu(e);if(!t||typeof t.subscribe!=`function`)throw Error(`Web Push is unavailable in this browser. On iPhone or iPad, add OpenClaw to the Home Screen and open the installed app.`);return t}function Gu(e){let t=(e+`=`.repeat((4-e.length%4)%4)).replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r}async function Ku(){return`serviceWorker`in navigator?await Uu(await navigator.serviceWorker.getRegistration())?.getSubscription()??null:null}async function qu(e){let t=(await e.request(`push.web.vapidPublicKey`,{})).vapidPublicKey;if(!t)throw Error(`Failed to retrieve VAPID public key`);return Gu(t)}function Ju(e,t){let n=e.options.applicationServerKey;if(!n)return!1;let r=new Uint8Array(n);return r.length===t.length&&r.every((e,n)=>e===t[n])}function Yu(e){let t=e.toJSON();if(!t.endpoint||!t.keys?.p256dh||!t.keys.auth)throw Error(`Invalid push subscription from browser`);return{endpoint:t.endpoint,keys:{p256dh:t.keys.p256dh,auth:t.keys.auth}}}async function Xu(e,t,n){return Ju(t,n)?(await e.request(`push.web.subscribe`,Yu(t)),{state:`registered`}):(await e.request(`push.web.unsubscribe`,{endpoint:t.endpoint}).catch(()=>void 0),{state:`vapid-mismatch`,error:ld})}async function Zu(e,t){return{subscription:t.state,preferences:t.state===`registered`?await ad(e):null,error:t.state===`vapid-mismatch`?t.error:null}}async function Qu(e){let t=await Ku();return await Zu(e,t?await Xu(e,t,await qu(e)):{state:`missing`})}function $u(e){let t=null,n=0,r=!1,i=async(t,i)=>{let a;try{a=await Qu(t)}catch(e){a={error:k(e)}}!r&&i===n&&e.gateway.snapshot.phase===`connected`&&e.gateway.snapshot.client===t&&e.publish(a)},a=r=>{let a=r.phase===`connected`?r.client:null;if(a===t)return;t=a;let o=++n;e.publish({subscription:`unknown`,preferences:null,error:null}),a&&i(a,o)},o=e.gateway.subscribe(a),s=e.gateway.subscribeEvents(t=>{let r=t.payload,a=e.gateway.snapshot.client;t.event!==`users.prefs.changed`||!a||!r||typeof r!=`object`||!(`profileId`in r)||r.profileId!==e.gateway.snapshot.selfUser?.id||!(`keys`in r)||!Array.isArray(r.keys)||!r.keys.includes(ud)||i(a,++n)});return a(e.gateway.snapshot),()=>{r=!0,n+=1,o(),s()}}function ed(e){let t=null;return{run(n){let r=e.gateway.snapshot.client;if(!r)return Promise.resolve();let i=()=>e.gateway.snapshot.phase===`connected`&&e.gateway.snapshot.client===r;t||e.publish({loading:!0,error:null});let a=(t??Promise.resolve()).then(async()=>{if(!i())throw Error(`Gateway changed before the notification change could be saved.`);e.publish({error:null});let t=await sd(r,n);i()&&e.publish(t)}).catch(t=>{i()&&e.publish({error:k(t)})}).finally(()=>{t===a&&(t=null,e.publish({loading:!1,permission:`Notification`in window?Notification.permission:`unsupported`}))});return t=a,a},dispose:$u(e)}}async function td(e){let t=await Notification.requestPermission();if(t!==`granted`)throw Error(`Notification permission ${t}`);let n=Wu(await Hu()),r=await qu(e),i=await n.getSubscription();if(i)return await Xu(e,i,r);let a=await n.subscribe({userVisibleOnly:!0,applicationServerKey:r.buffer});try{return await Xu(e,a,r)}catch(e){try{await a.unsubscribe()}catch{}throw e}}async function nd(e){let t=await Ku();if(t){try{await e.request(`push.web.unsubscribe`,{endpoint:t.endpoint})}catch{}await t.unsubscribe()}}async function rd(e){await e.request(`push.web.test`,{})}async function id(){let e=await Ku();if(!e)throw Error(`Enable notifications before changing notification preferences.`);return e}async function ad(e){let t=await id();return await e.request(`push.web.preferences.get`,{endpoint:t.endpoint})}async function od(e,t,n){let r=await id();return await e.request(`push.web.preferences.set`,{endpoint:r.endpoint,scope:t,preferences:n}),await ad(e)}async function sd(e,t){switch(t.kind){case`enable`:return await Zu(e,await td(e));case`disable`:return await nd(e),{subscription:`missing`,preferences:null};case`test`:return await rd(e),{};case`set`:return{preferences:await od(e,t.scope,t.preferences)};default:return t}}var cd,ld,ud;function dd(){return(dd=t((()=>{N(),cd=1e4,ld=`This browser push subscription belongs to another Gateway. Open this Gateway's own Control UI, or configure every mutually trusted Gateway behind this PWA with the same VAPID keypair.`,ud=`notifications.web.v1`})))()}function fd(e){return e.matches(`:hover`)||e.matches(`:focus-within`)}function pd(e){return e.classList.contains(`hover-marquee`)?e:e.querySelector(`.hover-marquee`)}function md(e){let t=Ed.get(e);t!==void 0&&(window.clearTimeout(t),Ed.delete(e))}function hd(e){!Dd&&typeof ResizeObserver==`function`&&(Dd=new ResizeObserver(e=>{for(let t of e){if(!(t.target instanceof HTMLElement))continue;let e=t.target,n=e.closest(`.session-row-host`);if(!n||!fd(n)){Dd?.unobserve(e);continue}md(e),e.classList.remove(`hover-marquee--scrolling`),gd(n)}})),Dd?.observe(e)}function gd(e){let t=pd(e);if(!t||(hd(t),t.classList.contains(`hover-marquee--scrolling`)))return;md(t);let n=Number.parseFloat(getComputedStyle(t).textIndent)||0,r=t.scrollWidth-n-t.clientWidth;if(r<=1){t.style.removeProperty(`--hover-marquee-shift`),t.style.removeProperty(`--hover-marquee-duration`);return}let i=Number(t.dataset.hoverMarqueeExtraShift??0),a=r+(Number.isFinite(i)?Math.max(0,i):0),o=Math.max(wd,Math.round(a/Cd*1e3));t.style.setProperty(`--hover-marquee-shift`,`${-a}px`),t.style.setProperty(`--hover-marquee-duration`,`${o}ms`);let s=Number(t.dataset.hoverMarqueeDelay);Ed.set(t,window.setTimeout(()=>{Ed.delete(t),t.classList.add(`hover-marquee--scrolling`)},Number.isFinite(s)?Math.max(0,s):Td))}function _d(e){let t=pd(e);t&&(md(t),t.classList.remove(`hover-marquee--scrolling`),Dd?.unobserve(t))}function vd(e){e.currentTarget instanceof HTMLElement&&gd(e.currentTarget)}function yd(e){e.currentTarget instanceof HTMLElement&&_d(e.currentTarget)}function bd(e,t){e instanceof HTMLElement&&queueMicrotask(()=>{let n=e.isConnected?e.closest(`.session-row-host`):null;n&&t(n)&&gd(n)})}function xd(e){bd(e,e=>e.matches(`:hover`))}function Sd(e){bd(e,fd)}var Cd,wd,Td,Ed,Dd;function Od(){return(Od=t((()=>{Cd=80,wd=300,Td=500,Ed=new WeakMap})))()}function kd(e){return e===`none`||e===`person`?e:`project`}function Ad(e){let t=e?.identity;return t?t.type===`profile`||t.type===`agent`?`${t.type}:${t.id}`:JSON.stringify(t,Object.keys(t).toSorted()):``}function jd(e){let t=e.replace(/[\\/]+$/,``);if(!t)return null;let n=t.match(/^(.*?)[\\/]\.claude[\\/]worktrees[\\/][^\\/]/);return n?n[1]||null:t}function Md(e){return e.split(/[\\/]/).findLast(Boolean)??e}function Nd(e){let t=[],n=[],r=new Map,i=new Map,a=[];for(let o of e){let e=o.customGroup?.trim();if(e){let n=`custom:${e}`,i=r.get(e);i||(i={kind:`custom`,key:n,legacySectionKey:n,label:e,title:`Custom group: ${e}`,sessions:[]},r.set(e,i),t.push(i)),i.sessions.push(o);continue}let s=o.cwd?.trim(),c=s?jd(s):null;if(!c){a.push(o);continue}let l=i.get(c);l||(l={kind:`project`,key:`project:${c}`,legacySectionKey:c,label:Md(c),title:c,sessions:[]},i.set(c,l),n.push(l)),l.sessions.push(o)}return{groups:[...t,...n],ungrouped:a}}function Pd(e){let t=new Map,n=[];for(let r of e){let e=r.createdActor,i=Ad(e);if(!e?.identity||!i){n.push(r);continue}let a=`person:${i}`,o=t.get(a);if(!o){let n=e.label?.trim()||e.identity.id;o={kind:`person`,key:a,legacySectionKey:`person:${e.id}`,label:n,title:`Created by ${n}`,sessions:[]},t.set(a,o)}o.sessions.push(r)}return{groups:[...t.values()].toSorted((e,t)=>e.label.localeCompare(t.label)),ungrouped:n}}function Fd(e){let t=Date.now();return e!=null&&Number.isFinite(e)&&e<=t&&t-e<6e4?W(`common.now`):_t(e,{fallback:``,suffix:e!=null&&e>t})}function Id(e){return e!==void 0&&e<0xe8d4a51000?e*1e3:e}function Ld(e){for(let t of e.catalogs)for(let n of t.hosts)for(let r of n.sessions){if((r.sessionKey??Mt({catalogId:t.id,hostId:n.hostId,threadId:r.threadId}))!==e.sessionKey)continue;let i=w(r.cwd),a=w(r.gitBranch);return{...e.liveRow,hasAutomation:e.liveRow?.hasAutomation===!0,label:e.liveRow?.label??(r.name||r.threadId),color:e.liveRow?e.liveRow.color:r.color,createdActor:e.liveRow?.createdActor??r.createdActor,createdAt:e.liveRow?.createdAt??Id(r.createdAt),updatedAt:e.liveRow?.updatedAt??Id(r.updatedAt),workContext:i?a||r.pullRequest?{kind:`project`,name:xe(i),path:i,...a?{branch:a}:{}}:{kind:`workspace`,name:xe(i),path:i}:e.liveRow?.workContext}}return e.liveRow}function Rd(e){let t=new Set;for(let n of e)for(let e of n.hosts)for(let n of e.sessions)n.sessionKey&&t.add(n.sessionKey);return t}function zd(e,t,n){return n?[]:e.filter(e=>!t.has(e.id))}function Bd(e,t,n=new Map){let r=[];for(let i of e){let e=i.sessions.filter(e=>{if(!t)return!0;let r=e.sessionKey;return(r&&n.has(r)&&r?n.get(r):e.createdActor?.id)===t});e.length>0&&r.push(e.length===i.sessions.length?i:{...i,sessions:e})}return r}function Vd(e,t){return e.map(e=>e.id===t.catalogId?{...e,hosts:e.hosts.map(e=>e.hostId===t.hostId?{...e,sessions:e.sessions.map(e=>e.threadId===t.threadId?{...e,sessionKey:t.sessionKey}:e)}:e)}:e)}function Hd(){return(Hd=t((()=>{V(),pn(),_n(),dn()})))()}function Ud(e,t){e.setData(Qd,t),e.setData(`text/plain`,t),e.effectAllowed=`copyMove`}function Wd(e){return e?.getData(`application/x-openclaw-session-key`).trim()||null}function Gd(e){return Array.from(e?.types??[]).includes(Qd)}function Kd(e,t){e.setData($d,t),e.effectAllowed=`move`}function qd(e){return e?.getData($d).trim()||null}function Jd(e){return Array.from(e?.types??[]).includes($d)}function Yd(e,t){e.setData(ef,t),e.effectAllowed=`move`}function Xd(e){return e?.getData(ef).trim()||null}function Zd(e){return Array.from(e?.types??[]).includes(ef)}var Qd,$d,ef;function tf(){return(tf=t((()=>{Qd=`application/x-openclaw-session-key`,$d=`application/x-openclaw-session-group`,ef=`application/x-openclaw-sidebar-route`})))()}function nf(e){let t=e.draggable!==!1&&!e.disabledReason;return F`
|
|
<div
|
|
class="sidebar-recent-sessions__head ${t?`sidebar-recent-sessions__head--draggable`:``}"
|
|
draggable=${t?`true`:`false`}
|
|
title=${e.disabledReason??P}
|
|
@mousedown=${e=>{e.currentTarget.toggleAttribute(`data-section-drag-blocked`,!!e.target.closest(`button, a`))}}
|
|
@mouseup=${e=>{e.currentTarget.removeAttribute(`data-section-drag-blocked`)}}
|
|
@dragstart=${n=>{if(!t){n.preventDefault();return}let r=n.currentTarget,i=!!n.target.closest(`button, a`)||r.hasAttribute(`data-section-drag-blocked`);if(r.removeAttribute(`data-section-drag-blocked`),i){n.preventDefault();return}n.dataTransfer&&(Kd(n.dataTransfer,e.sectionId),e.onStartDrag(e.sectionId))}}
|
|
@dragend=${t=>{t.currentTarget.removeAttribute(`data-section-drag-blocked`),e.onFinishDrag()}}
|
|
@contextmenu=${e.onContextMenu??P}
|
|
>
|
|
<span class="sidebar-session-group-drag-handle" aria-hidden="true"></span>
|
|
${e.content}
|
|
</div>
|
|
`}function rf(){return(rf=t((()=>{I(),tf()})))()}function af(e,t){let n=new Set(e),r=t.map(e=>w(e.category)).filter(e=>typeof e==`string`&&!n.has(e)).toSorted((e,t)=>e.localeCompare(t));return[...e,...new Set(r)]}function of(e,t,n=[]){let r=[...new Set(t.map(e=>e.trim()).filter(Boolean))],i=new Set(r),a=[...new Set(n.map(e=>e.trim()).filter(Boolean))],o=new Set(a),s=(Sn(e)??[]).filter(e=>e.startsWith(`category:`)?i.has(e.slice(9)):!e.startsWith(`catalog:`)||o.has(e.slice(8)));for(let e of r){let t=`category:${e}`;if(s.includes(t))continue;let n=s.findIndex(e=>yf.includes(e));s.splice(n<0?s.length:n,0,t)}for(let[e,t]of yf.entries()){if(s.includes(t))continue;if(e===0){s.push(t);continue}let n=yf[e-1];s.splice(s.indexOf(n)+1,0,t)}let c=a.map(e=>`catalog:${e}`).filter(e=>!s.includes(e));return s.splice(s.indexOf(`work`)+1,0,...c),s}function sf(e,t,n,r){return Ke(e,t,n,r)}function cf(e){return _f.includes(e)?e:`none`}function lf(e,t){if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return``;let n=new Date(t),r=e=>new Date(n.getFullYear(),n.getMonth(),n.getDate()-e).getTime();return e>=r(0)?`today`:e>=r(1)?`yesterday`:e>=r(6)?`week`:`older`}function uf(e){return e.channel??Ve(e.key)?.channel??``}function df(e,t,n){switch(t){case`category`:return e.category?.trim()??``;case`person`:return Ad(e.owner?.actor);case`channel`:return uf(e);case`kind`:return e.kind;case`agent`:return E(e.key)?.agentId??``;case`date`:return lf(e.updatedAt,n);default:return``}}function ff(e){let t=e.now??Date.now(),n=new Map;for(let r of e.rows){let i=df(r,e.mode,t),a=n.get(i);a?a.push(r):n.set(i,[r])}return gf(e.mode,n,e.knownCategories??[]).map(e=>({id:e,rows:n.get(e)??[]}))}function pf(e){return e===`none`||e===`person`||e===`project`?e:`category`}function mf(e,t){return t===`category`&&e.pinned!==!0&&!!e.category?.trim()&&e.kind===`group`}function hf(e,t={}){let n=t.grouping??`category`,r=[],i=[],a=[],o=[],s=new Map,c=[],l=new Map,u=new Map;if(n===`category`)for(let e of t.knownGroups??[]){let t=e.trim();t&&!s.has(t)&&(s.set(t,[]),c.push(t))}for(let t of e){if(t.pinned===!0){r.push(t);continue}if(n===`none`){i.push(t);continue}let e=n===`project`&&t.workContext?jd(t.workContext.path):null;if(e){let n=u.get(e);n?n.rows.push(t):u.set(e,{id:`project:${e}`,project:{name:Md(e),path:e},rows:[t]});continue}let c=n===`person`?t.owner?.actor:void 0,d=c?.identity?.id,f=Ad(c);if(c&&d&&f){let e=l.get(f);e?e.rows.push(t):l.set(f,{id:`person:${f}`,personOwner:{...c,id:d},rows:[t]});continue}let p=n===`category`?t.category?.trim():void 0;if(p){let e=s.get(p);e?e.push(t):s.set(p,[t]);continue}if(t.kind===`group`){a.push(t);continue}if(t.workSession===!0||t.acpSession===!0){o.push(t);continue}i.push(t)}let d=[];r.length>0&&d.push({id:`pinned`,rows:r}),d.push(...[...l.values()].toSorted((e,n)=>{let r=e.personOwner,i=n.personOwner;return(r.identity?.type===`agent`?2:r.identity?.type===`profile`&&r.id===t.selfOwnerId?0:1)-(i.identity?.type===`agent`?2:i.identity?.type===`profile`&&i.id===t.selfOwnerId?0:1)||(r.label||r.id).localeCompare(i.label||i.id)||r.id.localeCompare(i.id)})),d.push(...[...u.values()].toSorted((e,t)=>{let n=e.project,r=t.project;return n.name.localeCompare(r.name)||n.path.localeCompare(r.path)}));let f=[...c,...[...s.keys()].slice(c.length).toSorted((e,t)=>e.localeCompare(t))],p=f.map(e=>({id:`category:${e}`,category:e,rows:s.get(e)??[]}));p.push({id:`ungrouped`,rows:i});let m=e.some(e=>mf(e,n));(a.length>0||m)&&p.push({id:`groups`,groups:!0,rows:a}),p.push({id:`work`,work:!0,rows:o});let h=[...new Set((t.catalogIds??[]).map(e=>e.trim()).filter(Boolean))];if(p.push(...h.map(e=>({id:`catalog:${e}`,rows:[]}))),t.sectionOrder){let e=new Map(p.map(e=>[e.id,e]));for(let n of of(t.sectionOrder,f,h)){let t=e.get(n);t&&(d.push(t),e.delete(t.id))}return d.push(...p.filter(t=>e.has(t.id))),d}return d.push(...p),d}function gf(e,t,n){if(e===`date`)return vf.filter(e=>t.has(e));if(e===`category`){let e=[...new Set(n.map(e=>e.trim()).filter(Boolean))],r=[...t.keys()].filter(t=>t!==``&&!e.includes(t)).toSorted((e,t)=>e.localeCompare(t));return[...e,...r,``]}let r=[...t.keys()].filter(e=>e!==``);return r.sort((e,t)=>e.localeCompare(t)),t.has(``)&&r.push(``),r}var _f,vf,yf;function bf(){return(bf=t((()=>{Le(),O(),_f=[`none`,`category`,`person`,`channel`,`kind`,`agent`,`date`],vf=[`today`,`yesterday`,`week`,`older`,``],yf=[`ungrouped`,`groups`,`work`]})))()}function xf(e){switch(e.kind){case`question`:case`approval`:return 3;case`agent`:return 2;case`error`:return 1;case`none`:return 0;default:return e}}function Sf(e,t=0){return t===1?e.hasActiveRun:t===2?e.attention.kind!==`none`:e.visuallyActive||e.containsActiveDescendant||e.hasActiveRun||e.runningChildCount>0||e.attention.kind!==`none`}function Cf(e){let t=Math.max(0,e.scrollHeight-e.clientHeight);return t<=1?`none`:e.scrollTop<=1?`top`:e.scrollTop>=t-1?`bottom`:`middle`}function wf(e){return`sidebar-session-meta-${encodeURIComponent(e)}`}function Tf(e){return`sidebar-session-state-${encodeURIComponent(e)}`}function Ef(){return pf(A()?.getItem(Qf))}function Df(){return kd(A()?.getItem($f))}function Of(){return A()?.getItem(tp)===`true`}function kf(){return A()?.getItem(ep)===`true`}function Af(){return A()?.getItem(np)===`true`}function jf(){let e=A()?.getItem(rp);return e===`archived`||e===`all`?e:`active`}function Mf(e,t){return`${sp}${fe(e)}:${encodeURIComponent(t)}`}function Nf(e,t){try{let n=A()?.getItem(Mf(e,t)),r=n?.startsWith(`owner:`)?n.slice(6).trim():``;return{ownerId:n===`involving-me`?null:r||null,involvingMe:n===`involving-me`}}catch{return{ownerId:null,involvingMe:!1}}}function Pf(){let e=A()?.getItem(ip);return e===`updated`||e===`people`?e:`created`}function Ff(){try{let e=A()?.getItem(ap);if(e==null)return new Set([`work`]);let t=JSON.parse(e);return new Set(Array.isArray(t)?t.flatMap(e=>typeof e==`string`&&e?[e]:[]):[])}catch{return new Set([`work`])}}function If(){try{let e=JSON.parse(A()?.getItem(op)??`[]`);return new Set(Array.isArray(e)?e.flatMap(e=>typeof e==`string`&&e?[e]:[]):[])}catch{return new Set}}function Lf(e){A()?.setItem(Qf,e)}function Rf(e){A()?.setItem($f,e)}function zf(e){A()?.setItem(tp,String(e))}function Bf(e){A()?.setItem(ep,String(e))}function Vf(e){A()?.setItem(np,String(e))}function Hf(e){A()?.setItem(rp,e)}function Uf(e,t,n){try{let r=A(),i=Mf(e,t),a=n.involvingMe?`involving-me`:n.ownerId?`owner:${n.ownerId}`:null;a===null?r?.removeItem(i):r?.setItem(i,a)}catch{}}function Wf(e,t){return e===`people`&&!t?`created`:e}function Gf(e,t){let n=Wf(e,t!==!1);try{A()?.setItem(ip,n)}catch{}return n}function Kf(e){A()?.setItem(ap,JSON.stringify([...e]))}function qf(e){A()?.setItem(op,JSON.stringify([...e])),typeof window<`u`&&window.dispatchEvent(new CustomEvent(cp))}function Jf(e,t){let n=new Set(If());t?n.add(e):n.delete(e),qf(n)}function Yf(e,t){return`${e}\u0000${t}`}var Xf,Zf,Qf,$f,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up;function G(){return(G=t((()=>{bf(),Xf={kind:`none`},Zf=function(e){return e[e.Any=0]=`Any`,e[e.ActiveRun=1]=`ActiveRun`,e[e.Attention=2]=`Attention`,e}({}),Qf=`openclaw:sidebar:sessions:grouping`,$f=`openclaw:sidebar:sessions:catalog-grouping`,ep=`openclaw:sidebar:sessions:show-preview`,tp=`openclaw:sidebar:sessions:show-cron`,np=`openclaw:sidebar:sessions:show-system`,rp=`openclaw:sidebar:sessions:status-filter`,ip=`openclaw:sidebar:sessions:sort-mode`,ap=`openclaw:sidebar:sessions:collapsed-sections`,op=`openclaw:sidebar:sessions:hidden-catalogs`,sp=`openclaw.control.sidebarSessionOwnerFilter.v1:`,cp=`openclaw:sidebar-hidden-catalogs-changed`,lp=[{mode:`created`,labelKey:`chat.sidebar.sortCreated`},{mode:`updated`,labelKey:`chat.sidebar.sortUpdated`},{mode:`people`,labelKey:`sessionsView.owners`}],up=[`active`,`archived`,`all`]})))()}function dp(e){return e.split(/[-_]+/u).filter(Boolean).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function fp(e){return xp[e]??dp(e)}function pp(e){let t=e.indexOf(`/`);return(t>0?e.slice(0,t).trim().toLowerCase():``)||null}function mp(e){let t=e.trim().toLowerCase(),n=bp[t]??t;return yp.has(n)?n:null}function hp(e){return mp(e)!==null}function gp(e){return rr(`provider-icons/ProviderIcon-${e}.svg`)}function _p(e,t){let n=t?.className?` ${t.className}`:``,r=Lt(e.trim().toUpperCase(),1)||`?`;return F`
|
|
<span
|
|
class="provider-brand-icon provider-brand-icon--fallback${n}"
|
|
aria-hidden="true"
|
|
>
|
|
${r}
|
|
</span>
|
|
`}function vp(e,t){let n=t?.className?` ${t.className}`:``,r=mp(e);return r?F`
|
|
<span
|
|
class="provider-brand-icon${n}"
|
|
data-provider-icon=${r}
|
|
style=${`--provider-icon-url: url("${gp(r)}")`}
|
|
aria-hidden="true"
|
|
></span>
|
|
`:_p(e,t)}var yp,bp,xp;function Sp(){return(Sp=t((()=>{I(),er(),on(),yp=new Set(`abacus.alibaba.amp.antigravity.arcee.augment.baseten.bedrock.byteplus.cerebras.chutes.claude.clawrouter.cloudflare.codebuff.codex.cohere.comfy.commandcode.copilot.crof.crossmodel.cursor.deepgram.deepinfra.deepseek.devin.doubao.elevenlabs.factory.fal.featherless.fireworks.gemini.grok.groq.huggingface.jetbrains.kilo.kimi.kiro.litellm.llamacpp.llmproxy.lmstudio.longcat.manus.meta.microsoft.mimo.minimax.mistral.novita.nvidia.ollama.opencode.opencodego.openrouter.perplexity.pi.pixverse.poe.qianfan.qoder.runway.sakana.stepfun.synthetic.t3chat.tencent.together.venice.vercel.vertexai.vllm.volcengine.warp.windsurf.zai.zed`.split(`.`)),bp={anthropic:`claude`,"amazon-bedrock":`bedrock`,"aws-bedrock":`bedrock`,"claude-cli":`claude`,"cloudflare-ai-gateway":`cloudflare`,"copilot-proxy":`copilot`,google:`gemini`,"google-gemini-cli":`gemini`,"github-copilot":`copilot`,kilocode:`kilo`,"kimi-coding":`kimi`,"llama-cpp":`llamacpp`,"microsoft-foundry":`microsoft`,"minimax-portal":`minimax`,"ollama-cloud":`ollama`,openai:`codex`,moonshot:`kimi`,"opencode-go":`opencodego`,"opencode-zen":`opencode`,qwen:`alibaba`,"qwen-token-plan":`alibaba`,"stepfun-plan":`stepfun`,"tencent-tokenhub":`tencent`,"tencent-tokenplan":`tencent`,xai:`grok`,xiaomi:`mimo`,"xiaomi-token-plan":`mimo`,"vercel-ai-gateway":`vercel`,"vertex-ai":`vertexai`,"z-ai":`zai`},xp={anthropic:`Anthropic`,google:`Google`,"github-copilot":`GitHub`,"llama-cpp":`llama.cpp`,lmstudio:`LM Studio`,longcat:`LongCat`,openai:`OpenAI`,moonshot:`Moonshot AI`,opencode:`OpenCode`,openrouter:`OpenRouter`,qwen:`Qwen Cloud`,zai:`Z.AI`}})))()}function Cp(e){switch(e){case`open`:return W(`chat.pullRequests.open`);case`draft`:return W(`chat.pullRequests.draft`);case`merged`:return W(`chat.pullRequests.merged`);case`closed`:return W(`chat.pullRequests.closed`);default:return e}}function wp(e){return`${e.numbers.map(e=>`#${e}`).join(`, `)} · ${Cp(e.state)}`}function Tp(e,t,n=``,r=0,i,a,o,s=0){return F`<openclaw-tooltip .content=${e}>
|
|
<span
|
|
class=${`session-row-badge${n?` ${n}`:``}`}
|
|
data-pull-request-state=${i??P}
|
|
data-placement-state=${a??P}
|
|
data-disk-space-status=${o??P}
|
|
data-workspace-conflicts=${s?String(s):P}
|
|
role="img"
|
|
aria-label=${e}
|
|
>${t}${r?F`<span aria-hidden="true">${r}</span>`:P}</span
|
|
>
|
|
</openclaw-tooltip>`}function Ep(e){let t=e.pullRequest?wp(e.pullRequest):void 0,n=e.pullRequest?.state,r=e.isChild?void 0:e.placementState,i=oa(r)?r:void 0,a=Math.max(0,Math.floor(e.workspaceConflictCount??0)),o=a>0?e.placementState:void 0,s=i??o,c=a>0,l=e.isChild?void 0:e.diskSpaceStatus,u=l===`critical`?W(`sessionsView.cloudWorkerDiskCritical`):l===`warning`?W(`sessionsView.cloudWorkerDiskWarning`):``,d=Math.max(0,Math.floor(e.outboxAttentionCount??0)),f=d>0?W(d===1?`sessionsView.messageNeedsAttention`:`sessionsView.messagesNeedAttention`,{count:String(d)}):``;if(!e.incognito&&!t&&!e.hasApproval&&d===0&&!e.hasComposerDraft&&!s&&!c)return P;let p=s?e.placementProviderId&&e.placementProfileId?`${e.placementProviderId} · ${e.placementProfileId} · ${s}`:W(`sessionsView.cloudWorkerPlacement`,{state:s}):``,m=[c?s?W(a===1?`sessionsView.placementWorkspaceConflict`:`sessionsView.placementWorkspaceConflicts`,{placement:p,count:String(a)}):W(a===1?`sessionsView.cloudWorkerDescendantConflict`:`sessionsView.cloudWorkerDescendantConflicts`,{count:String(a)}):p,u].filter(Boolean).join(` · `);return F`<span class="session-row-badges">
|
|
${e.incognito?Tp(W(`sessionsView.incognito`),H.lock,`session-row-badge--incognito`):P}
|
|
${t?Tp(t,n===`merged`?H.gitMerge:H.gitPullRequest,`session-row-badge--pull-request`,0,n):P}
|
|
${e.hasApproval?Tp(W(`sessionsView.approvalNeeded`),H.alertTriangle,`session-row-badge--approval`):P}
|
|
${d>0?Tp(f,H.alertTriangle,`session-row-badge--attention`,d):P}
|
|
${e.hasComposerDraft?Tp(W(`sessionsView.unsentDraft`),H.pencil,`session-row-badge--draft`):P}
|
|
${s||c?Tp(m,H.globe,`session-row-badge--cloud`,0,void 0,s,l,c?a:0):P}
|
|
</span>`}function Dp(e){if(e.kind===`restarting`)return F`<span
|
|
class="sidebar-footer-bar__status sidebar-footer-bar__status--restarting"
|
|
role="status"
|
|
aria-live="polite"
|
|
><span class="sidebar-footer-bar__status-dot" aria-hidden="true"></span>${W(`connection.restarting`)}</span
|
|
>`;let t=W(`common.offline`),n=e.queuedOutboxCount??0,r=n?W(`connection.queuedCount`,{count:String(n)}):null;return F`<openclaw-tooltip .content=${e.title??``}>
|
|
<button
|
|
type="button"
|
|
class="sidebar-footer-bar__status"
|
|
aria-live="polite"
|
|
aria-label=${`${t} — ${W(`connection.retryNow`)}${r?` — ${r}`:``}`}
|
|
@click=${e.onRetry}
|
|
>
|
|
<span class="sidebar-footer-bar__status-dot" aria-hidden="true"></span>${t}<span
|
|
class="sidebar-footer-bar__status-detail"
|
|
>· ${W(`connection.reconnecting`)}</span
|
|
>${r?F`<span class="sidebar-footer-bar__status-detail">· ${r}</span>`:P}
|
|
</button>
|
|
</openclaw-tooltip>`}function Op(){return(Op=t((()=>{I(),pa(),V(),U()})))()}function kp(e,t,n,r,i){let a=document.activeElement instanceof HTMLElement?document.activeElement:null,o=a?.closest(`[data-session-key]`),s=Ip.find(e=>a?.matches(e)),c=s!==void 0&&(o?.dataset.catalogSessionKey===e||o?.dataset.sessionKey===e||o?.dataset.sessionKey===t);if(!(!r&&!c))return e=>{e instanceof HTMLElement&&(r&&i.onCatalogMenuTriggerRendered(n,e.querySelector(Ip[3])??void 0),c&&queueMicrotask(()=>{e.isConnected&&document.activeElement===document.body&&e.querySelector(s)?.focus({preventScroll:!0})}))}}function Ap(e=!0){return F`<span
|
|
class="session-run-spinner"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.activeRun`)}
|
|
title=${e?W(`sessionsView.activeRun`):P}
|
|
></span>`}function jp(e,t){return e?Ap():t?F`<span
|
|
class="session-unread-dot"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.unread`)}
|
|
></span>`:P}function Mp(e){let t=new Set,n=e=>{e&&t.add(k(`[${e.code}] ${e.message}`))};n(e.error);for(let t of e.hosts)t.error?.code!==`NODE_OFFLINE`&&n(t.error);return[...t]}function Np(e){let t=new Map,n=new Map;for(let r of e.liveRows)t.has(r.key)||(t.set(r.key,r),n.set(r.key,r.owner?.actor.id));return e.catalogs.map(r=>{let i=`catalog:${r.id}`,a=e.collapsedSections.has(i),o=r.hosts,s=Bd(o,e.ownerId,n),c=s.flatMap(e=>e.sessions.map(t=>({host:e,session:t}))),l=c.flatMap(({session:e})=>{let n=e.sessionKey?t.get(e.sessionKey):void 0;return n?[n]:[]}),u=l.some(We),d=l.some(e=>e.unread===!0),f=hp(r.id),p=e.loadingMoreCatalogIds.has(r.id),m=o.some(e=>!!e.nextCursor),h=r.capabilities.createSession!==void 0,g=Mp(r),_=g.length>0;if(c.length===0&&!m&&!_&&!r.capabilities.createSession)return P;let v=g.join(`; `),y=W(`chat.sidebar.catalogDiscoveryHelp`,{error:v}),b=[`sidebar-recent-sessions__group`,`sidebar-recent-sessions__group--zone-coding`,a?`sidebar-recent-sessions__group--collapsed`:``,e.draggingSectionId===i?`sidebar-recent-sessions__group--dragging`:``,e.sectionDropTarget?.sectionId===i?`sidebar-recent-sessions__group--section-drop-${e.sectionDropTarget.position}`:``].filter(Boolean).join(` `);return F`
|
|
<div
|
|
class=${b}
|
|
data-session-section=${i}
|
|
@dragover=${e.sectionDragDisabledReason?P:t=>e.onSectionDragOver(t,i)}
|
|
@dragleave=${e.sectionDragDisabledReason?P:t=>e.onSectionDragLeave(t,i)}
|
|
@drop=${e.sectionDragDisabledReason?P:t=>e.onSectionDrop(t,i)}
|
|
>
|
|
${nf({sectionId:i,disabledReason:e.sectionDragDisabledReason,onStartDrag:e.onStartSectionDrag,onFinishDrag:e.onFinishSectionDrag,onContextMenu:t=>{t.preventDefault();let n=t.currentTarget,i=n.querySelector(`[data-session-catalog-view-menu]`)??n;e.onOpenViewMenu(r.id,i,{x:t.clientX,y:t.clientY})},content:F`
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-group-toggle"
|
|
aria-expanded=${String(!a)}
|
|
aria-label=${_?`${r.label}: ${y}`:r.label}
|
|
title=${_?y:P}
|
|
@click=${()=>e.onToggleSection(i)}
|
|
>
|
|
<span
|
|
class="sidebar-session-group-toggle__lead ${f?`sidebar-session-group-toggle__lead--branded`:``}"
|
|
aria-hidden="true"
|
|
>
|
|
${f?vp(r.id,{className:`sidebar-session-catalog-provider-icon`}):P}
|
|
<span class="sidebar-session-group-toggle__icon"
|
|
>${a?H.chevronRight:H.chevronDown}</span
|
|
>
|
|
</span>
|
|
<span class="sidebar-recent-sessions__label-text">${r.label}</span>
|
|
${jp(u,d)}
|
|
${_||a&&c.length>0?F`<span
|
|
class="sidebar-session-group-count ${_?`sidebar-session-group-count--error`:``}"
|
|
data-session-catalog-error=${_?r.id:P}
|
|
aria-hidden="true"
|
|
>${_?H.alertTriangle:c.length}</span
|
|
>`:P}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-group-actions sidebar-session-sort sidebar-session-catalog-grouping ${e.ownerFilterActive?`sidebar-session-sort--filtered`:``}"
|
|
data-session-catalog-view-menu=${r.id}
|
|
title=${W(`chat.sidebar.catalogViewOptions`)}
|
|
aria-label=${W(`chat.sidebar.catalogViewOptions`)}
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(e.viewMenuOpenCatalogId===r.id)}
|
|
@click=${t=>{t.stopPropagation(),e.onOpenViewMenu(r.id,t.currentTarget)}}
|
|
>
|
|
${H.listFilter}
|
|
</button>
|
|
${h?bi({basePath:e.basePath,agentId:e.newSessionAgentId,target:{catalogId:r.id},className:`sidebar-session-group-actions sidebar-session-new sidebar-session-catalog-new`,label:`${W(`chat.runControls.newSession`)} — ${r.label}`,disabledReason:e.newSessionDisabledReason,onOpen:e.onOpenNewSession}):P}
|
|
`})}
|
|
${a?P:F`<div class="sidebar-recent-sessions__list">
|
|
${s.map(n=>Pp(r,n,t,e))}
|
|
</div>
|
|
${m?F`<button
|
|
type="button"
|
|
class="sidebar-session-catalog-load-more"
|
|
data-session-catalog-load-more=${r.id}
|
|
?disabled=${p}
|
|
aria-busy=${String(p)}
|
|
@click=${()=>e.onLoadMore(r.id)}
|
|
>
|
|
${W(`chat.selectors.loadMoreSessions`)}
|
|
</button>`:P}`}
|
|
</div>
|
|
`})}function Pp(e,t,n,r){let i=t.error?k(`[${t.error.code}] ${t.error.message}`):void 0,a=r.projectGrouping===`project`?Nd(t.sessions):r.projectGrouping===`person`?Pd(t.sessions):null,o=(i,a=!1)=>Rn(i,n=>Mt({catalogId:e.id,hostId:t.hostId,threadId:n.threadId}),i=>Fp(e,t,i,n,r,a)),s=t.kind!==`gateway`;return F`
|
|
<section class="sidebar-session-catalog-host" data-session-catalog-host=${t.hostId}>
|
|
${s?F`<div
|
|
class="sidebar-session-catalog-host__head"
|
|
aria-label=${i?`${t.label}: ${i}`:t.label}
|
|
title=${i??t.label}
|
|
>
|
|
<span class="sidebar-session-group-toggle__lead" aria-hidden="true">
|
|
<span class="sidebar-session-group-toggle__icon">${H.monitor}</span>
|
|
</span>
|
|
<span class="sidebar-session-catalog-host__label">${t.label}</span>
|
|
<span
|
|
class="sidebar-session-catalog-host__count ${t.error?`sidebar-session-catalog-host__count--error`:``}"
|
|
aria-hidden="true"
|
|
>${t.error?H.alertTriangle:t.sessions.length}</span
|
|
>
|
|
</div>`:P}
|
|
<div class="sidebar-session-catalog-host__sessions" role="list" aria-label=${t.label}>
|
|
${a?F`${Rn(a.groups,e=>e.key,n=>{let i=`catalog-${n.kind}:${e.id}:${t.hostId}:${n.key}`,a=n.legacySectionKey?`catalog-project:${e.id}:${t.hostId}:${n.legacySectionKey}`:null,s=r.collapsedSections.has(i)?i:a&&r.collapsedSections.has(a)?a:null,c=s!==null;return F`
|
|
<div class="sidebar-session-catalog-project" role="listitem">
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-catalog-project__head"
|
|
data-session-catalog-project=${n.key}
|
|
aria-expanded=${String(!c)}
|
|
title=${n.title}
|
|
@click=${()=>r.onToggleSection(s??i)}
|
|
>
|
|
<span class="sidebar-session-catalog-project__icon" aria-hidden="true"
|
|
>${c?H.chevronRight:H.chevronDown}</span
|
|
>
|
|
<span class="sidebar-session-catalog-project__label">${n.label}</span>
|
|
<span class="sidebar-session-catalog-project__count" aria-hidden="true"
|
|
>${n.sessions.length}</span
|
|
>
|
|
</button>
|
|
${c?P:F`<div
|
|
class="sidebar-session-catalog-project__sessions"
|
|
role="list"
|
|
aria-label=${`${t.label}: ${n.label}`}
|
|
>
|
|
${o(n.sessions,!0)}
|
|
</div>`}
|
|
</div>
|
|
`})}
|
|
${o(a.ungrouped)}`:o(t.sessions)}
|
|
</div>
|
|
</section>
|
|
`}function Fp(e,t,n,r,i,a=!1){let o=Id(n.recencyAt??n.updatedAt??n.createdAt),s={catalogId:e.id,hostId:t.hostId,threadId:n.threadId},c=Mt(s),l=n.sessionKey??c,u=i.isMenuOpen(s),d=kp(c,l,s,u,i),f=n.sessionKey?r.get(n.sessionKey):void 0;if(f)return i.renderLiveRow(f,{catalogIdentityKey:c,catalogMenuOpen:u,...d?{rowRef:d}:{},...n.pullRequest?{pullRequest:n.pullRequest}:{}});let p=n.name||n.threadId,m=Fd(o),h=Ma(n.color??``),g=`chat`,{href:_,options:v}=zt({face:g,sessionKey:l,fallbackAgentId:i.newSessionAgentId,basePath:i.basePath,mainKey:i.mainKey}),y=(n.sessionKey??Mt(s,i.newSessionAgentId))===i.routeSessionKey,b=n.status===`active`||n.status===`running`,x=b?W(`sessionsView.activeRun`):``,S=b?Tf(l):void 0,C=n.canOpenTerminal===!0&&i.terminalAvailable,ee=()=>i.onOpenTerminal(s,i.newSessionAgentId),te=(e,t,r)=>i.onOpenMenu({key:s,agentId:i.newSessionAgentId,routeId:g,navigation:v,canOpenTerminal:n.canOpenTerminal===!0,meta:m},e,t,r),w=e=>at(e,e instanceof KeyboardEvent?e.currentTarget.querySelector(`[data-catalog-session-menu]`):null,(e,t,n)=>te(t,n,e??void 0)),ne=Kn(JSON.stringify([p,n.status,n.pullRequest]),F`<span
|
|
${Nn(xd)}
|
|
class="sidebar-recent-session__name hover-marquee"
|
|
>${p}</span
|
|
>`);return F`
|
|
<div
|
|
${d?Nn(d):P}
|
|
class="sidebar-recent-session session-row-host sidebar-recent-session--single-line ${h?`sidebar-recent-session--colored`:``} ${y?`sidebar-recent-session--active`:``} ${a?`sidebar-recent-session--catalog-project-child`:``} ${b?`session-row-host--running`:``}"
|
|
style=${h?`--session-color: var(--session-color-${h})`:P}
|
|
data-session-key=${l}
|
|
data-catalog-session-key=${c}
|
|
data-session-row-action-count="1"
|
|
role="listitem"
|
|
@contextmenu=${w}
|
|
@keydown=${w}
|
|
@mouseenter=${vd}
|
|
@mouseleave=${yd}
|
|
>
|
|
<a
|
|
href=${dr(_)}
|
|
class="sidebar-recent-session__link"
|
|
aria-current=${y?`page`:P}
|
|
aria-describedby=${S??P}
|
|
@click=${e=>{et(e)&&(e.preventDefault(),i.catalogOpenTarget===`terminal`&&C?ee():i.onNavigate?.(g,v))}}
|
|
>
|
|
<span class="sidebar-session-indicator"></span>
|
|
<span class="sidebar-recent-session__text">
|
|
<span class="sidebar-recent-session__title-row"> ${ne} </span>
|
|
<span class="sidebar-recent-session__details">
|
|
<span class="sidebar-recent-session__details-endcap">
|
|
${Ep({pullRequest:n.pullRequest})}
|
|
${b?F`<span class="session-row-aside">
|
|
<span
|
|
class="session-row-state"
|
|
id=${S}
|
|
role="img"
|
|
aria-label=${x}
|
|
>${Ap(!1)}</span
|
|
>
|
|
</span>`:P}
|
|
</span>
|
|
</span>
|
|
</span>
|
|
</a>
|
|
<span class="sidebar-recent-session__aside session-row-aside">
|
|
<span class="session-row-actions">
|
|
<button
|
|
class="session-action"
|
|
data-catalog-session-menu="true"
|
|
type="button"
|
|
title=${W(`chat.sidebar.openSessionMenu`)}
|
|
aria-label=${W(`chat.sidebar.openSessionMenu`)}
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(u)}
|
|
@click=${e=>{e.stopPropagation();let t=e.currentTarget,n=t.getBoundingClientRect();te(n.right,n.bottom+4,t)}}
|
|
>
|
|
${H.moreHorizontal}
|
|
</button>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
`}var Ip;function Lp(){return(Lp=t((()=>{I(),Tn(),jn(),Vn(),ea(),Xn(),V(),N(),Od(),lt(),dn(),Se(),Hd(),rf(),G(),U(),Di(),Sp(),Op(),Ip=[`.sidebar-recent-session__link`,`[data-child-session-toggle]`,`[data-sidebar-session-pin]`,`[data-catalog-session-menu], [data-session-menu]`]})))()}function Rp(e,t=300){let n=$a(e,{mode:`message`}),r=n.didStrip&&/^[*`~_]+$/.test(n.text)?``:n.text;return{shouldSkip:n.shouldSkip||n.didStrip&&r.length<=t,text:r}}function zp(e){return e===`thinking`||e===`reasoning`}function Bp(e){if(typeof e==`string`)return{text:e,hasVisibleNonTextContent:!1};if(!Array.isArray(e))return{text:``,hasVisibleNonTextContent:e!=null};let t=!1;return{text:e.filter(e=>!e||typeof e!=`object`||!(`type`in e)?(t=!0,!1):e.type===`text`?typeof e.text==`string`||(t=!0,!1):(zp(e.type)||(t=!0),!1)).map(e=>e.text).join(``),hasVisibleNonTextContent:t}}function Vp(e){if(!e||typeof e!=`object`)return!1;let t=e;if(a(t.role)!==`assistant`||typeof t.senderLabel==`string`&&t.senderLabel.trim())return!1;let{text:n,hasVisibleNonTextContent:r}=Bp(typeof t.content==`string`||Array.isArray(t.content)?t.content:t.text);return!r&&Rp(n).shouldSkip}function Hp(){return(Hp=t((()=>{eo()})))()}function Up(e){return ds(e)}function Wp(){return(Wp=t((()=>{ms()})))()}function Gp(e,t){return e===`text`||t===`user`&&e===`input_text`||t===`assistant`&&(e===`input_text`||e===`output_text`)}function Kp(e,t){let n=a(t)===`user`,r=uo(e);return t===`assistant`?Up(r):n?ro(Ss(r)):Ss(r)}function qp(e){if(e==null)return null;let t=e,n=typeof t.role==`string`?t.role:``,r=n===`assistant`?os(e):Zp(e);return r?Kp(r,n):null}function Jp(e){if(!e||typeof e!=`object`)return qp(e);let t=e;if(nm.has(t))return nm.get(t)??null;let n=qp(e);return nm.set(t,n),n}function Yp(e){if(e==null)return null;let t=e.content,n=[];if(Array.isArray(t))for(let e of t){let t=e;if(t.type===`thinking`&&typeof t.thinking==`string`){let e=t.thinking.trim();e&&n.push(e)}}return n.length>0?n.join(`
|
|
`):null}function Xp(e){if(!e||typeof e!=`object`)return Yp(e);let t=e;if(rm.has(t))return rm.get(t)??null;let n=Yp(e);return rm.set(t,n),n}function Zp(e){if(e==null)return null;let t=e,n=a(t.role),r=t.content;if(typeof r==`string`)return r;if(Array.isArray(r)){let e=r.map(e=>{let t=e;return Gp(t.type,n)&&typeof t.text==`string`?t.text:null}).filter(e=>typeof e==`string`);if(e.length>0)return e.join(`
|
|
`)}return typeof t.text==`string`?t.text:null}function Qp(e){return!e||typeof e!=`object`?[]:(xs(e)??[]).flatMap(e=>{let t=e.path??e.url;return t?[{path:t,mediaType:e.contentType??e.kind,fileName:e.fileName,...e.sizeBytes===void 0?{}:{sizeBytes:e.sizeBytes},...e.durationMs===void 0?{}:{durationMs:e.durationMs},...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}]:[]})}function $p(e){let t=e.trim();if(!t)return``;let n=t.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>`_${e}_`);return n.length?[`_Reasoning:_`,...n].join(`
|
|
`):``}function em(e){if(typeof e==`string`)return!0;if(!Array.isArray(e))return!1;if(e.length===0)return!0;let t=!1;for(let n of e){if(!n||typeof n!=`object`)return!1;let e=n;if(e.type!==`text`||(t=!0,typeof e.text!=`string`))return!1}return t}function tm(e){if(!e||typeof e!=`object`)return!1;let t=e;return a(t.role)!==`user`||Qp(t).length>0||!em(t.content??t.text)?!1:(qp(e)?.trim()??``)===``}var nm,rm;function im(){return(im=t((()=>{Ga(),oo(),ts(),ys(),as(),Wp(),nm=new WeakMap,rm=new WeakMap})))()}function am(e,t){return t?{sessionKey:e,...t.agentId?{agentId:t.agentId}:{},runId:t.runId,revision:t.revision,updatedAt:t.updatedAt,headline:t.headline,health:t.health}:null}function om(e){return e===`stuck`||e===`waiting-on-user`}function sm(e){return e.localRunId?e.localRunId:!e.session?.hasActiveRun||!e.digest?.runId?null:e.session.activeRunIds?.includes(e.digest.runId)?e.digest.runId:null}function cm(e,t){return e?t?e.revision===t.revision?e.updatedAt>=t.updatedAt?e:t:e.revision>t.revision?e:t:e:t??null}function lm(){return(lm=t((()=>{})))()}function um(e){let t=e.replace(/```[\s\S]*?```/g,` `).split(/\n\s*\n/).map(e=>Cs(e)).filter(Boolean).at(-1)??``;if(!t)return``;let n=t.match(/[^.!?…]+(?:[.!?…]+(?=\s|$)|$)/g)?.map(e=>e.trim()).findLast(e=>!!e)??t;return Gt(n,dm)}var dm;function fm(){return(fm=t((()=>{pn(),dm=120})))()}function pm(e){let t=Bo(uo(Uo(e).text)),n=Rp(t);return!t||ls(t)||Zo(t)||n.shouldSkip?null:n.text}function mm(e){let t=[fo,qa];for(let n=Math.min(e.length,...t.map(e=>e.length-1));n>=1;--n){let r=e.slice(-n);if(t.some(e=>e.startsWith(r)))return r}return``}function hm(e){return e.startedAt??e.updatedAt??0}function gm(e,t){return typeof t!=`string`||!t.trim()||r(t)===r(e)}var _m,vm,ym,bm;function xm(){return(xm=t((()=>{Zi(),Ca(),Ga(),Ho(),bs(),V(),Hp(),im(),O(),fm(),_m=6,vm=2e3,ym=16384,bm=class{constructor(e,t=()=>void 0){this.onLinesChanged=e,this.onObserverDigestsChanged=t,this.source=null,this.connectionIdentity=null,this.connected=!1,this.enabled=!1,this.agentId=`main`,this.desiredKeys=new Set,this.subscriptions=new Map,this.pendingSubscriptions=new Map,this.internalRuntimeBlockDepth=new Map,this.internalRuntimeDelimiterTails=new Map,this.consumedStreamLength=new Map,this.visibleText=new Map,this.runIds=new Map,this.throttles=new Map,this.lines=new Map,this.observerDigests=new Map}sync(e){let t=this.connectionIdentity!==e.connectionIdentity,n=this.source!==e.source,i=!e.connected||!e.connectionIdentity||!e.source;if((t||n||i)&&this.resetSubscriptions(),this.source=e.source,this.connectionIdentity=e.connectionIdentity,this.connected=e.connected,this.enabled=e.enabled,this.agentId=r(e.agentId),i||!e.enabled){this.desiredKeys=new Set,this.resetSubscriptions(),this.clearAllLines();return}let a=e.openSessionKey.trim(),o=new Set,s=0;for(let t of e.rows.filter(e=>e.hasActiveRun).toSorted((e,t)=>hm(t)-hm(e))){let e=j(t.key,a);!e&&s>=_m||(o.add(t.key),e||(s+=1))}for(let e of this.desiredKeys)o.has(e)||this.releaseKey(e);this.desiredKeys=o;for(let e of o){let t=this.subscriptionAgentId(e),n=this.subscriptions.get(e)?.subscription.agentId??null,r=this.pendingSubscriptions.get(e)?.agentId??null;(this.subscriptions.has(e)&&n!==t||this.pendingSubscriptions.has(e)&&r!==t)&&this.releaseKey(e),!(this.subscriptions.has(e)||this.pendingSubscriptions.has(e))&&this.subscribeKey(e)}}handleEvent(e){if(!(!this.enabled||!this.connected)){if(e.event===`chat`){this.handleChatEvent(e.payload);return}if(e.event===`session.observer`){this.handleObserverEvent(e.payload);return}(e.event===`agent`||e.event===`session.tool`)&&this.handleAgentEvent(e.payload)}}disconnect(){this.desiredKeys=new Set,this.resetSubscriptions(),this.clearAllLines(),this.connected=!1}async subscribeKey(e){let t=this.source;if(!t||!this.connectionIdentity||!this.connected||!this.enabled||!this.desiredKeys.has(e))return;let n=Symbol(e),r=this.subscriptionAgentId(e);this.pendingSubscriptions.set(e,{agentId:r,operationId:n});try{let i=await t.subscribeMessages(e,{agentId:r??void 0});if(this.pendingSubscriptions.get(e)?.operationId!==n){await t.unsubscribeMessages(i).catch(()=>void 0);return}if(this.pendingSubscriptions.delete(e),t!==this.source||!this.connected||!this.enabled||!this.desiredKeys.has(e)){await t.unsubscribeMessages(i).catch(()=>void 0);return}this.subscriptions.set(e,{source:t,subscription:i})}catch{this.pendingSubscriptions.get(e)?.operationId===n&&this.pendingSubscriptions.delete(e)}}subscriptionAgentId(e){return be(e)?this.agentId:null}releaseKey(e){this.pendingSubscriptions.delete(e);let t=this.subscriptions.get(e);this.subscriptions.delete(e),t&&t.source.unsubscribeMessages(t.subscription).catch(()=>void 0),this.clearLine(e)}resetSubscriptions(){let e=new Set([...this.subscriptions.keys(),...this.pendingSubscriptions.keys()]);for(let t of e)this.releaseKey(t)}matchingDesiredKey(e,t){if(typeof e!=`string`||!e.trim())return null;for(let n of this.desiredKeys)if(j(n,e)&&(!be(n)||gm(this.agentId,t)))return n;return null}handleChatEvent(e){if(!e||typeof e!=`object`)return;let t=e,n=this.matchingDesiredKey(t.sessionKey,t.agentId);if(!n||(this.observeRun(n,t.runId),this.observerDigests.has(n)))return;let r=t.message;if(r&&typeof r.role==`string`&&r.role!==`assistant`)return;let i=typeof t.deltaText==`string`?t.deltaText:``,a=r?qp(r):null,o=this.consumedStreamLength.get(n)??0;if(t.replace===!0){let e=i||a||``;this.publishText(n,{streamLength:e.length,fragment:e,reset:!0});return}if(i){a?o>0&&a.length-i.length===o?this.publishText(n,{streamLength:a.length,fragment:i,reset:!1}):this.publishText(n,{streamLength:a.length,fragment:a,reset:!0}):o>0&&this.publishText(n,{streamLength:o+i.length,fragment:i,reset:!1});return}a&&this.publishText(n,{streamLength:a.length,fragment:a,reset:!0})}publishText(e,t){if(t.streamLength<=0){t.reset&&this.clearLine(e);return}if(this.consumedStreamLength.set(e,t.streamLength),t.reset){this.internalRuntimeBlockDepth.delete(e),this.internalRuntimeDelimiterTails.delete(e),this.visibleText.delete(e);let t=this.throttles.get(e);t&&(t.pending=null)}let n=this.stripInternalRuntimeFragment(e,t.fragment),r=`${t.reset?``:this.visibleText.get(e)??``}${n}`;if(!r){t.reset&&this.lines.delete(e)&&this.onLinesChanged(new Map(this.lines));return}let i=r.length>ym?le(r,-16384):r;this.visibleText.set(e,i),this.publishThrottled(e,{kind:`text`,text:i})}stripInternalRuntimeFragment(e,t){let n=this.internalRuntimeDelimiterTails.get(e)??``;this.internalRuntimeDelimiterTails.delete(e);let r=`${n}${t}`,i=this.internalRuntimeBlockDepth.get(e)??0,a=0,o=``;for(;a<r.length;){let e=r.indexOf(fo,a),t=r.indexOf(qa,a);if(i===0){if(e===-1&&t===-1){o+=r.slice(a);break}if(t!==-1&&(e===-1||t<e)){a=t+qa.length;continue}o+=r.slice(a,e),i=1,a=e+fo.length;continue}if(e===-1&&t===-1)break;if(e!==-1&&(t===-1||e<t)){i+=1,a=e+fo.length;continue}--i,a=t+qa.length}let s=mm(r);return s&&(this.internalRuntimeDelimiterTails.set(e,s),i===0&&o.endsWith(s)&&(o=o.slice(0,-s.length))),i>0?this.internalRuntimeBlockDepth.set(e,i):this.internalRuntimeBlockDepth.delete(e),o}handleAgentEvent(e){if(!e||typeof e!=`object`)return;let t=e,n=this.matchingDesiredKey(t.sessionKey,t.agentId);if(!n||(this.observeRun(n,t.runId),this.observerDigests.has(n)))return;let r=t.data;if(t.stream===`tool`){let e=typeof r?.name==`string`?r.name.trim():``;if(!e)return;this.publishThrottled(n,{kind:`line`,line:W(`chat.sidebar.toolActivity`,{tool:e})});return}if(t.stream!==`assistant`)return;let i=typeof r?.text==`string`?r.text:``,a=typeof r?.delta==`string`?r.delta:``,o=this.consumedStreamLength.get(n)??0;if(r?.replace===!0){let e=i||a;this.publishText(n,{streamLength:e.length,fragment:e,reset:!0});return}if(i){a&&o>0&&i.length-a.length===o?this.publishText(n,{streamLength:i.length,fragment:a,reset:!1}):i.length!==o&&this.publishText(n,{streamLength:i.length,fragment:i,reset:!0});return}a&&o>0&&this.publishText(n,{streamLength:o+a.length,fragment:a,reset:!1})}handleObserverEvent(e){if(!e||typeof e!=`object`)return;let t=e,n=this.matchingDesiredKey(t.sessionKey,t.agentId),r=typeof t.runId==`string`?t.runId.trim():``;if(!n||!r||typeof t.headline!=`string`||typeof t.health!=`string`||typeof t.updatedAt!=`number`||typeof t.revision!=`number`)return;let i={...t,runId:r};if(!ha(ba,i))return;this.observeRun(n,r);let a=this.observerDigests.get(n);a&&cm(a,i)===a||(this.clearNarration(n),this.observerDigests.set(n,i),this.onObserverDigestsChanged(new Map(this.observerDigests)))}observeRun(e,t){let n=typeof t==`string`?t.trim():``;if(!n)return;let r=this.runIds.get(e);r&&r!==n&&this.clearLine(e),this.runIds.set(e,n)}publishThrottled(e,t){let n=Date.now(),r=this.throttles.get(e);if(!r||n-r.lastPublishedAt>=vm){r?.timer&&globalThis.clearTimeout(r.timer),this.throttles.set(e,{lastPublishedAt:n,pending:null,timer:null}),this.publishActivity(e,t);return}r.pending=t,!r.timer&&(r.timer=globalThis.setTimeout(()=>{r.timer=null;let t=r.pending;r.pending=null,!(!t||!this.desiredKeys.has(e))&&(r.lastPublishedAt=Date.now(),this.publishActivity(e,t))},vm-(n-r.lastPublishedAt)))}publishActivity(e,t){let n=t.kind===`text`?pm(t.text):null,r=n?um(n):t.kind===`line`?t.line:``;if(r){this.setLine(e,r);return}t.kind===`text`&&this.lines.delete(e)&&this.onLinesChanged(new Map(this.lines))}setLine(e,t){this.lines.get(e)!==t&&(this.lines.set(e,t),this.onLinesChanged(new Map(this.lines)))}clearLine(e){this.clearNarration(e),this.runIds.delete(e),this.observerDigests.delete(e)&&this.onObserverDigestsChanged(new Map(this.observerDigests))}clearNarration(e){this.internalRuntimeBlockDepth.delete(e),this.internalRuntimeDelimiterTails.delete(e),this.consumedStreamLength.delete(e),this.visibleText.delete(e);let t=this.throttles.get(e);t?.timer&&globalThis.clearTimeout(t.timer),this.throttles.delete(e),this.lines.delete(e)&&this.onLinesChanged(new Map(this.lines))}clearAllLines(){for(let e of this.throttles.values())e.timer&&globalThis.clearTimeout(e.timer);this.internalRuntimeBlockDepth.clear(),this.internalRuntimeDelimiterTails.clear(),this.consumedStreamLength.clear(),this.visibleText.clear(),this.runIds.clear(),this.throttles.clear(),this.lines.size>0&&(this.lines.clear(),this.onLinesChanged(new Map)),this.observerDigests.size>0&&(this.observerDigests.clear(),this.onObserverDigestsChanged(new Map))}}})))()}function Sm(e){if(!ha($i,e))return null;let t=e.id.trim(),n=e.taskId?.trim()||t;return!t||!n?null:{...e,id:t,taskId:n}}function Cm(){return(Cm=t((()=>{Zi(),Sa()})))()}function wm(e,t,n){let r=t.replaceAll(`\\`,`/`);return`${e}://file${(r.startsWith(`/`)?r:`/${r}`).split(`/`).map((e,t)=>t===1&&/^[a-z]:$/i.test(e)?e:encodeURIComponent(e)).join(`/`)}${n?`:${n}`:``}`}function Tm(e,t,n){return window.open(wm(e,t,n))}var Em,Dm;function Om(){return(Om=t((()=>{Em=[`cursor`,`vscode`,`windsurf`,`zed`],Dm={cursor:`Cursor`,vscode:`VS Code`,windsurf:`Windsurf`,zed:`Zed`}})))()}function km(e){return qi.some(t=>t===e)}function Am(e){return km(e)?jm[e]:null}var jm;function Mm(){return(Mm=t((()=>{ea(),U(),jm={braces:H.braces,book:H.book,monitor:H.monitor,bot:H.bot,kanban:H.kanban,coins:H.coins}})))()}function Nm(){let e=globalThis.navigator?.platform??``;return/Mac|iPhone|iPad|iPod/u.test(e)?`⌃⌘Space`:/Win/u.test(e)?`Win+.`:null}function Pm(e){let t=Fi(e.customIconValue),n=Nm();return F`
|
|
<div
|
|
slot=${e.inline?P:`submenu`}
|
|
class="session-menu__icon-picker session-menu__icon-custom-entry"
|
|
>
|
|
<div class="session-menu__icon-custom-header">
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-back"
|
|
aria-label=${W(`common.back`)}
|
|
@click=${e.onBack}
|
|
>
|
|
${H.arrowLeft}
|
|
</button>
|
|
<span>${W(`sessionsView.customEmojiTitle`)}</span>
|
|
</div>
|
|
<div class="session-menu__icon-custom-controls">
|
|
<input
|
|
class="session-menu__icon-custom-input"
|
|
type="text"
|
|
autocomplete="off"
|
|
autofocus
|
|
aria-label=${W(`sessionsView.customEmojiTitle`)}
|
|
.value=${e.customIconValue}
|
|
@input=${e.onInput}
|
|
/>
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-set"
|
|
?disabled=${!t||e.disabled}
|
|
@click=${e.onApply}
|
|
>
|
|
${W(`sessionsView.customEmojiSet`)}
|
|
</button>
|
|
</div>
|
|
<div class="session-menu__icon-custom-hint">
|
|
${n?W(`sessionsView.customEmojiHint`,{shortcut:n}):W(`sessionsView.customEmojiHintNoShortcut`)}
|
|
</div>
|
|
</div>
|
|
`}function Fm(e){if(e.mode===`custom`)return Pm(e);let t=[...Im,...qi].find(t=>t===e.currentIcon);return F`
|
|
<div slot=${e.inline?P:`submenu`} class="session-menu__icon-picker">
|
|
<div
|
|
class="session-menu__icon-options"
|
|
role="group"
|
|
aria-label=${W(`sessionsView.setIconMenu`)}
|
|
@keydown=${e.onGridKeydown}
|
|
>
|
|
<div class="session-menu__icon-section-label">${W(`sessionsView.iconEmojiSection`)}</div>
|
|
<div class="session-menu__icon-grid">
|
|
${Im.map((n,r)=>{let i=e.currentIcon===n;return F`
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-choice"
|
|
aria-pressed=${String(i)}
|
|
tabindex=${n===t||!t&&r===0?`0`:`-1`}
|
|
?disabled=${e.disabled}
|
|
title=${e.disabledReason??P}
|
|
@click=${t=>e.onSelect(t,n)}
|
|
>
|
|
${n}
|
|
</button>
|
|
`})}
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-choice session-menu__icon-choice--custom"
|
|
aria-label=${W(`sessionsView.customEmojiCell`)}
|
|
aria-pressed="false"
|
|
tabindex="-1"
|
|
?disabled=${e.disabled}
|
|
title=${e.disabledReason??P}
|
|
@click=${e.onShowCustom}
|
|
>
|
|
${H.moreHorizontal}
|
|
</button>
|
|
</div>
|
|
<div class="session-menu__icon-section-label">${W(`sessionsView.iconGlyphSection`)}</div>
|
|
<div class="session-menu__icon-grid">
|
|
${qi.map(n=>{let r=e.currentIcon===n;return F`
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-choice session-menu__icon-choice--glyph"
|
|
aria-label=${n}
|
|
aria-pressed=${String(r)}
|
|
tabindex=${n===t?`0`:`-1`}
|
|
?disabled=${e.disabled}
|
|
title=${e.disabledReason??P}
|
|
@click=${t=>e.onSelect(t,n)}
|
|
>
|
|
${Am(n)}
|
|
</button>
|
|
`})}
|
|
</div>
|
|
</div>
|
|
${e.currentIcon?F`
|
|
<div class="session-menu__icon-separator" role="separator"></div>
|
|
<button
|
|
type="button"
|
|
class="session-menu__icon-remove"
|
|
?disabled=${e.disabled}
|
|
title=${e.disabledReason??P}
|
|
@click=${e.onRemove}
|
|
>
|
|
${W(`sessionsView.removeIcon`)}
|
|
</button>
|
|
`:P}
|
|
</div>
|
|
`}var Im;function Lm(){return(Lm=t((()=>{I(),ea(),V(),U(),Mm(),Im=[`🦞`,`🚀`,`🐛`,`✅`,`🔥`,`📦`,`🧪`,`📝`,`🔍`,`⚡`,`🎯`]})))()}function Rm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function zm(){return(zm=t((()=>{})))()}function Bm(e,t,n=yt().resourceBasePath){try{let r=new URL(e,Gm),i=r.origin===Gm,a=rs(r.pathname,n),o=us(`agentAvatar`,r.pathname,n),s=a?`${n}${a}`:o.matched&&o.value?gs(`agentAvatar`,n,o.value):null;if(!s)return null;let c=`${s}${r.search}`;return i?t?new URL(c,t).toString():c:t&&r.origin===t?t+c:null}catch{return null}}function Vm(e){return e.trim().split(/\s+/u).filter(Boolean).slice(0,2).map(e=>Lt(e,1)).join(``).toUpperCase()||`?`}function Hm(e){let t=e.id?.trim(),n=ml(e)??`?`;return{kind:`initials`,initials:Vm(n),colorSeed:Rm(t||n)}}function Um(e){return Hm(e).colorSeed%360}function Wm(e){let t=e.identity;if(t&&t.type!==`profile`&&t.type!==`agent`)return Hm(e);let{origin:n,resourceBasePath:r}=yt(),i=e.profileAvatarUrl?.trim();if(i){let e=Bm(i,n);if(e&&(!t||us(t.type===`agent`?`agentAvatar`:`userAvatar`,new URL(e,Gm).pathname,r).matched))return{kind:`profile`,url:e}}if(t?.type===`profile`){let e=Bm(vs(t.id),n);if(e)return{kind:`profile`,url:e}}return Hm(e)}var Gm;function Km(){return(Km=t((()=>{ns(),is(),_l(),on(),xn(),Gm=`https://origin-probe.invalid`})))()}function qm(e){return e?.trim()||void 0}function Jm(e){return[...e].map(qm).filter(e=>e!==void 0).toSorted()[0]}function Ym(e){return[qm(e.host)??``,qm(e.platform)??``,qm(e.deviceFamily)??``,qm(e.instanceId)??``,String(e.ts??0).padStart(16,`0`)].join(`\0`)}function Xm(e,t){return e<t?-1:+(e>t)}function Zm(e){let t=new Map;for(let n of e){if(n.reason===`disconnect`||!n.user?.id)continue;let e=ps(n.user),r=t.get(e);r?r.push(n):t.set(e,[n])}return{users:[...t.entries()].toSorted(([e],[t])=>e<t?-1:+(e>t)).map(([,e])=>({id:e[0].user.id,identity:e[0].user.identity,name:Jm(e.map(e=>e.user?.name)),email:Jm(e.map(e=>e.user?.email)),avatarUrl:Jm(e.map(e=>e.user?.avatarUrl)),watchedSessions:[...new Set(e.flatMap(e=>e.watchedSessions??[]))].toSorted(),entries:e.toSorted((e,t)=>Xm(Ym(e),Ym(t)))}))}}function Qm(e){return lh&&ch===e?lh:(ch=e,lh=Zm(ir(e)??[]),lh)}function $m(e){return e.name??e.email??e.id}function eh(e){let t=(e.entries??[]).flatMap(e=>e.lastInputSeconds===void 0?[]:[e.lastInputSeconds]);return t.length>0&&t.every(e=>e>sh)}function th(e,t){let n=Number(eh(e))-Number(eh(t));return n===0?Xm($m(e).toLowerCase(),$m(t).toLowerCase())||Xm(ps(e),ps(t)):n}function nh(e,t){return t?.type===`profile`&&e.identity?.id===t.id}function rh(e,t,n,r,i){let a=t??lr(ir(e)??[],n),o=a?ps(a):void 0;return Qm(e).users.filter(e=>ps(e)!==o&&!nh(e,i)&&(r===void 0||e.watchedSessions.includes(r)))}function ih(e,t,n){return rh(e,t,n).toSorted(th)}function ah(e,t,n,r){return rh(e,t,n,r).length>0}function oh(e){return Qm(e).users.length>=2}var sh,ch,lh;function uh(){return(uh=t((()=>{sh=120})))()}function dh(){for(let e of yh.values())e.blobUrl&&URL.revokeObjectURL(e.blobUrl);yh.clear()}function fh(e){for(;yh.size>gh;){let t=!1;for(let[n,r]of yh)if(!(!r.blobUrl||!r.loaded||r===e)){yh.delete(n),URL.revokeObjectURL(r.blobUrl),t=!0;break}if(!t)break}}function ph(e){let t=yh.get(e);if(t)return yh.delete(e),yh.set(e,t),t.loaded&&t.blobUrl?t.blobUrl:t.promise;let n={blobUrl:null,loaded:!1,promise:Promise.resolve(null)},{authHeader:r}=yt();return n.promise=(async()=>{try{let t=await fetch(e,{credentials:`include`,...r?{headers:{Authorization:r}}:{},signal:AbortSignal.timeout(_h)});if(!t.ok)return null;let i=await t.blob();if(i.size===0||i.size>2097152||!vh.has(i.type.toLowerCase()))return null;let a=URL.createObjectURL(i);return yh.get(e)===n?(n.blobUrl=a,fh(n),a):(URL.revokeObjectURL(a),null)}catch{return null}finally{!n.blobUrl&&yh.get(e)===n&&yh.delete(e)}})(),yh.set(e,n),fh(n),n.promise}function mh(e){let{authHeader:t,origin:n,resourceBasePath:r}=yt(),i=Bm(e,n,r);if(!i)return null;let a=globalThis.location?.origin,o=a?new URL(i,a).origin!==a:!1;return n||t||o?ph(i):i}function hh(e){if(e?.startsWith(`blob:`)){for(let t of yh.values())if(t.blobUrl===e){t.loaded=!0,fh();return}}}var gh,_h,vh,yh;function bh(){return(bh=t((()=>{m(),xn(),Km(),gh=128,_h=3e4,vh=new Set([`image/gif`,`image/jpeg`,`image/png`,`image/webp`,`image/svg+xml`]),yh=new Map,vn(dh)})))()}function xh(e){let t=Wm(e),n=t.kind===`initials`?t:Hm(e),r=t.kind===`profile`?mh(t.url):null;return{fallback:n,imageUrl:r,pending:r!==null&&typeof r!=`string`}}function Sh(e,t){return Ln([e,t.imageUrl,t.pending],()=>Gn(`${e}${t.pending?` is-fallback`:``}`))}function Ch(e,t,n){let r=e.currentTarget;r instanceof HTMLImageElement&&(hh(r.getAttribute(`src`)),r.closest(t)?.classList.toggle(`is-fallback`,n))}function wh({view:e,fallbackSelector:t,className:n,alt:r=``,ariaHidden:i=!1}){return e.imageUrl?F`<img
|
|
class=${n??P}
|
|
src=${typeof e.imageUrl==`string`?e.imageUrl:Un(e.imageUrl.then(e=>e??P),P)}
|
|
alt=${r}
|
|
aria-hidden=${i?`true`:P}
|
|
referrerpolicy="no-referrer"
|
|
@error=${e=>Ch(e,t,!0)}
|
|
@load=${e=>Ch(e,t,!1)}
|
|
/>`:P}function Th(){return(Th=t((()=>{I(),Fn(),Pn(),Mn(),bh(),Km()})))()}function Eh(e,t){return{basePath:e.basePath,navigate:n=>{t?.(),e.navigate(`activity`,or(n,e.basePath))}}}function Dh(e,t){let n=e?.trim();return!n||!t?null:{href:or(n,t.basePath).href,open:e=>{et(e)&&(e.preventDefault(),t.navigate(n))}}}function Oh(e,t,n){return t?F`<a class="${n} person-activity-link" href=${t.href} @click=${t.open}
|
|
>${e}</a
|
|
>`:F`<span class=${n}>${e}</span>`}function kh(e,t){return t?F`<a
|
|
class="person-activity-avatar-link"
|
|
href=${t.href}
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
@click=${t.open}
|
|
>${e}</a
|
|
>`:e}function Ah(e,t){return t?F`<a class="person-activity-avatar-link" href=${t.href} @click=${t.open}
|
|
>${e}</a
|
|
>`:e}function jh(){return(jh=t((()=>{I(),$r()})))()}function Mh(e){let t=F`<span
|
|
class=${e.imageUrl?`viewer-avatar__fallback`:P}
|
|
style=${`background: hsl(${e.fallback.colorSeed%360} 48% 42%)`}
|
|
>${e.fallback.initials}</span
|
|
>`;return e.imageUrl?F`${wh({view:e,fallbackSelector:`.viewer-avatar`})}${t}`:t}var Nh,Ph;function Fh(){return(Fh=t((()=>{I(),R(),V(),uh(),M(),Th(),jh(),ri(),Nh=class extends xt{constructor(...e){super(...e),this.user=null,this.variant=`session`,this.markAsViewer=!0}render(){let e=this.user;if(!e)return P;let t=$m(e),n=xh({identity:this.identity??e.identity,id:e.id,name:e.name,username:e.email,profileAvatarUrl:e.avatarUrl});return F`<span
|
|
class=${Sh(`viewer-avatar viewer-avatar--${this.variant}`,n)}
|
|
data-viewer-id=${this.markAsViewer?e.id:P}
|
|
aria-label=${t}
|
|
>
|
|
${Mh(n)}
|
|
</span>`}},S([z({attribute:!1})],Nh.prototype,`user`,void 0),S([z()],Nh.prototype,`variant`,void 0),S([z({attribute:!1})],Nh.prototype,`identity`,void 0),S([z({type:Boolean,attribute:!1})],Nh.prototype,`markAsViewer`,void 0),Ph=class extends xt{constructor(...e){super(...e),this.maxVisible=3}render(){let e=rh(this.presencePayload,this.selfUser,this.selfInstanceId,this.sessionKey,this.excludeIdentity),t=this.staticParticipants?this.staticParticipants.map(({identity:e,label:t,avatarUrl:n})=>({identity:e,id:e.id,name:t,avatarUrl:n,watchedSessions:[]})):this.staticUsers??e;if(t.length===0)return P;let n=t.slice(0,this.maxVisible),r=t.slice(this.maxVisible),i=Math.max(t.length,this.totalCount??0)-n.length,a=r.length===i?r.map($m).join(`
|
|
`):W(`sessionHovercard.moreParticipantsLabel`,{count:String(i)});return F`<span
|
|
class="viewer-facepile viewer-facepile--session"
|
|
data-viewer-count=${Math.max(t.length,this.totalCount??0)}
|
|
aria-label=${t.map($m).join(`, `)}
|
|
>
|
|
${n.map(e=>F`<openclaw-tooltip .content=${$m(e)}>
|
|
<span class="viewer-facepile__tooltip-anchor">
|
|
${Ah(F`<openclaw-viewer-avatar
|
|
.user=${e}
|
|
.identity=${e.identity}
|
|
.markAsViewer=${!this.staticParticipants}
|
|
variant="session"
|
|
></openclaw-viewer-avatar>`,e.identity?.type===`profile`?Dh(e.identity.id,this.personActivity):null)}
|
|
</span>
|
|
</openclaw-tooltip>`)}
|
|
${i>0?F`<openclaw-tooltip .content=${a}>
|
|
<span class="viewer-avatar viewer-avatar--overflow" aria-label=${a}
|
|
>+${i}</span
|
|
>
|
|
</openclaw-tooltip>`:P}
|
|
</span>`}},S([z({attribute:!1})],Ph.prototype,`presencePayload`,void 0),S([z({attribute:!1})],Ph.prototype,`selfUser`,void 0),S([z({attribute:!1})],Ph.prototype,`selfInstanceId`,void 0),S([z({attribute:!1})],Ph.prototype,`sessionKey`,void 0),S([z({attribute:!1})],Ph.prototype,`excludeIdentity`,void 0),S([z({attribute:!1})],Ph.prototype,`staticParticipants`,void 0),S([z({attribute:!1})],Ph.prototype,`staticUsers`,void 0),S([z({type:Number,attribute:`max-visible`})],Ph.prototype,`maxVisible`,void 0),S([z({type:Number,attribute:!1})],Ph.prototype,`totalCount`,void 0),S([z({attribute:!1})],Ph.prototype,`personActivity`,void 0),globalThis.customElements&&(customElements.get(`openclaw-viewer-avatar`)||customElements.define(`openclaw-viewer-avatar`,Nh),customElements.get(`openclaw-viewer-facepile`)||customElements.define(`openclaw-viewer-facepile`,Ph))})))()}function Ih(e){let t=new Map((e.facet??[]).map(e=>[e.id,e]));e.self?.id&&t.get(e.self.id)?.type!==`agent`&&t.set(e.self.id,{type:`human`,id:e.self.id,identity:{type:`profile`,id:e.self.id},...e.self.name?{label:e.self.name}:{},...e.self.avatarUrl?{avatarUrl:e.self.avatarUrl}:{}});for(let n of e.agents??[]){let e=t.get(n.id);t.set(n.id,{type:`agent`,id:n.id,identity:{type:`agent`,id:n.id},...n.name?{label:n.name}:{},...e?.type===`agent`?e:{}})}return[...t.values()].toSorted((e,t)=>e.type.localeCompare(t.type)||(e.label??e.id).localeCompare(t.label??t.id)||e.id.localeCompare(t.id))}function Lh(e,t,n=`created`,r,i,a){return e?.id?F`<openclaw-session-owner-chip
|
|
.owner=${e}
|
|
size=${t}
|
|
attribution=${n}
|
|
.viewingNow=${r}
|
|
.participants=${i??[]}
|
|
.participantCount=${a??i?.length??0}
|
|
></openclaw-session-owner-chip>`:P}function Rh(e){let t=e.label?.trim()||e.id?.trim()||``;if(!t)return``;let n=t.replace(/@.*$/u,``).split(/[\s._-]+/u).filter(Boolean),r=e=>e?Lt(e,1):``;return(r(n[0])+r(n[1])).toUpperCase()||r(t).toUpperCase()}function zh(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%360}function Bh(e){return F`<openclaw-viewer-avatar
|
|
.identity=${e.identity}
|
|
.user=${{id:e.id,name:e.label,avatarUrl:e.avatarUrl,watchedSessions:[]}}
|
|
.markAsViewer=${!1}
|
|
variant="session"
|
|
aria-hidden="true"
|
|
></openclaw-viewer-avatar>`}var Vh;function Hh(){return(Hh=t((()=>{I(),R(),V(),on(),Km(),M(),Fh(),Vh=class extends Et{constructor(...e){super(...e),this.owner=null,this.size=`row`,this.attribution=`created`,this.participants=[],this.participantCount=0}render(){let e=this.owner;if(!e?.id)return P;let t=Rh(e);if(!t)return P;let n=e.label||e.id,r=this.attribution===`archived`?`sessionsView.archivedBy`:this.attribution===`owned`?`sessionsView.ownedBy`:`sessionsView.createdBy`,i=W(r,{name:n}),a=this.viewingNow?`${i} · ${W(`sessionsView.viewingNow`)}`:i,o=Wm({id:e.id,identity:e.identity,name:e.label,profileAvatarUrl:e.avatarUrl}),s=this.size===`row`&&this.participantCount>0,c=F`
|
|
<span
|
|
class="session-owner-chip session-owner-chip--${this.size} ${this.viewingNow===!1?`session-owner-chip--away`:``} ${s?`session-owner-stack__front`:``}"
|
|
style="--owner-hue: ${zh(e.id)}"
|
|
role="img"
|
|
aria-label=${a}
|
|
title=${a}
|
|
>${o?.kind===`profile`?Bh({...e,id:e.id}):t}</span
|
|
>
|
|
`;if(!s)return c;let l=this.participants[0],u=l?.label||l?.identity.id,d=this.participantCount===1&&u?`${a} · ${W(`sessionsView.withParticipant`,{name:u})}`:`${a} · ${W(`sessionsView.withMoreParticipants`,{count:String(this.participantCount)})}`;return F`<span class="session-owner-stack" role="group" aria-label=${d}>
|
|
<span class="session-owner-stack__back" aria-hidden="true">
|
|
${this.participantCount===1&&l?F`<openclaw-viewer-avatar
|
|
.user=${{id:l.identity.id,name:l.label,avatarUrl:l.avatarUrl,watchedSessions:[]}}
|
|
.markAsViewer=${!1}
|
|
.identity=${l.identity}
|
|
variant="session"
|
|
></openclaw-viewer-avatar>`:F`<span class="session-owner-stack__overflow">+${this.participantCount}</span>`}
|
|
</span>
|
|
${c}
|
|
</span>`}},S([z({attribute:!1})],Vh.prototype,`owner`,void 0),S([z({type:String})],Vh.prototype,`size`,void 0),S([z({type:String})],Vh.prototype,`attribution`,void 0),S([z({attribute:!1})],Vh.prototype,`viewingNow`,void 0),S([z({attribute:!1})],Vh.prototype,`participants`,void 0),S([z({type:Number})],Vh.prototype,`participantCount`,void 0),customElements.get(`openclaw-session-owner-chip`)||customElements.define(`openclaw-session-owner-chip`,Vh)})))()}function Uh(e){if(!e.startsWith(`assign-owner:`))return null;let[,t,n]=e.split(`:`),r=n?decodeURIComponent(n):``;return(t===`human`||t===`agent`)&&r?{type:t,id:r}:null}function Wh(e,t=!1){let n=e.disabledReason??P;return e.ownerOptions.map(r=>{let i=r.id===e.currentOwnerId;return F`
|
|
<wa-dropdown-item
|
|
slot=${t?P:`submenu`}
|
|
class="session-menu__item"
|
|
value=${`assign-owner:${r.type}:${encodeURIComponent(r.id)}`}
|
|
role="menuitemradio"
|
|
aria-checked=${String(i)}
|
|
${Nn(e=>fi(e,i))}
|
|
?disabled=${e.disabled||i}
|
|
title=${n}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${Bh(r)}</span
|
|
>
|
|
<span class="session-menu__text">${r.label??r.id}</span>
|
|
${i?F`<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${H.check}</span
|
|
>`:P}
|
|
</wa-dropdown-item>
|
|
`})}function Gh(e){let t=e.disabledReason??P;return F`
|
|
${e.selfOwner?F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value=${`assign-owner:${e.selfOwner.type}:${encodeURIComponent(e.selfOwner.id)}`}
|
|
?disabled=${e.disabled||e.currentOwnerId===e.selfOwner.id}
|
|
title=${t}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.users}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.assignToMe`)}</span>
|
|
</wa-dropdown-item>`:P}
|
|
${e.ownerOptions.length>0?F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
?disabled=${e.disabled}
|
|
title=${t}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.users}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.assignTo`)}</span>
|
|
${Wh(e)}
|
|
</wa-dropdown-item>`:P}
|
|
`}function Kh(){return(Kh=t((()=>{I(),jn(),V(),U(),Hh(),li()})))()}function qh(e){return Qh[e]??null}function Jh(e,t){return!t||e.some(e=>e.id===t.id)?e:[t,...e]}function Yh(e){return F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value=${`compact:open-${e.view}`}
|
|
?disabled=${e.disabled??!1}
|
|
title=${e.title??P}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${e.icon}</span>
|
|
<span class="session-menu__text">${e.label}</span>
|
|
<span slot="details" class="session-menu__icon session-menu__chevron" aria-hidden="true"
|
|
>${H.chevronRight}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
`}function Xh(e){return F`
|
|
<wa-dropdown-item class="session-menu__item session-menu__back" value="compact:back">
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.arrowLeft}</span>
|
|
<span class="session-menu__text">${W(`common.back`)}</span>
|
|
</wa-dropdown-item>
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
${e}
|
|
`}function Zh(e){return e.view===`root`?P:Xh(e.view===`open-in`?e.renderOpenIn():e.view===`assign-owner`?Wh({ownerOptions:e.ownerOptions,currentOwnerId:e.currentOwnerId,disabled:e.assignOwnerDisabled,disabledReason:e.assignOwnerDisabledReason},!0):e.view===`icon`?e.renderIcon():e.renderGroup())}var Qh;function $h(){return($h=t((()=>{I(),V(),U(),Kh(),Qh={"compact:back":`root`,"compact:open-assign-owner":`assign-owner`,"compact:open-group":`group`,"compact:open-icon":`icon`,"compact:open-open-in":`open-in`}})))()}function eg(e){let t=Ma(e??``);return t?F`<span
|
|
class="session-color-dot"
|
|
style=${`--session-color: var(--session-color-${t})`}
|
|
role="img"
|
|
aria-label=${W(`sessionsView.sessionColor`,{color:W(`sessionsView.colors.${t}`)})}
|
|
></span>`:P}function tg(){return(tg=t((()=>{I(),ea(),V()})))()}function ng(e){return F`
|
|
${Em.map(t=>F`
|
|
<wa-dropdown-item
|
|
slot=${e.inline?P:`submenu`}
|
|
class="session-menu__item"
|
|
value=${`open-in:${t}`}
|
|
?disabled=${e.disabled}
|
|
>
|
|
<span class="session-menu__text">${Dm[t]}</span>
|
|
</wa-dropdown-item>
|
|
`)}
|
|
`}function rg(e){let t=1,n=()=>t<=9?String(t++):null,r=(t,r,i,a=!0)=>{let o=n(),s=i===`new-group`?`new-group`:`move-to-group`;return F`
|
|
<wa-dropdown-item
|
|
slot=${e.inline?P:`submenu`}
|
|
class="session-menu__item"
|
|
value=${i}
|
|
role=${a?`menuitemradio`:`menuitem`}
|
|
aria-checked=${a?String(r):P}
|
|
${a?Nn(e=>fi(e,r)):P}
|
|
data-shortcut=${o??P}
|
|
aria-keyshortcuts=${o??P}
|
|
?disabled=${e.actionDisabled(s)}
|
|
title=${e.actionTitle(s)}
|
|
>
|
|
<span class="session-menu__text">${t}</span>
|
|
${a&&r?F`<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${H.check}</span
|
|
>`:P}
|
|
${o?Ci(o):P}
|
|
</wa-dropdown-item>
|
|
`};return F`
|
|
${e.groups.map(t=>r(t,e.category===t,`move-to-group:${encodeURIComponent(t)}`))}
|
|
${e.category?r(W(e.categoryClearReturnsToGroups?`sessionsView.moveBackToGroups`:`sessionsView.removeFromGroup`),!1,`move-to-group:`,!1):P}
|
|
${r(W(`sessionsView.newGroup`),!1,`new-group`,!1)}
|
|
`}function ig(e){let t=Ma(e.color??``);return F`${[null,...Ui].map(n=>{let r=t===n;return F`<wa-dropdown-item
|
|
slot=${e.inline?P:`submenu`}
|
|
class="session-menu__item"
|
|
value=${`set-color:${n??``}`}
|
|
role="menuitemradio"
|
|
aria-checked=${String(r)}
|
|
${Nn(e=>fi(e,r))}
|
|
?disabled=${e.disabled}
|
|
title=${e.disabledReason??P}
|
|
>
|
|
<span slot="icon" aria-hidden="true">${eg(n)}</span>
|
|
<span class="session-menu__text"
|
|
>${W(n?`sessionsView.colors.${n}`:`common.default`)}</span
|
|
>
|
|
${r?F`<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${H.check}</span
|
|
>`:P}
|
|
</wa-dropdown-item>`})}`}function ag(){return(ag=t((()=>{I(),jn(),ea(),V(),Om(),U(),di(),tg(),li()})))()}var og,sg,cg;function lg(){return(lg=t((()=>{I(),ea(),V(),Om(),U(),di(),Lm(),$h(),ag(),Kh(),og={label:``,sessionId:null,pinned:!1,unread:!1,archived:!1,category:null,icon:null,color:null,categoryClearReturnsToGroups:!1},sg=6,cg=class{constructor(e,t,n,r){this.host=e,this.readState=t,this.onAction=n,this.onClose=r,this.iconPickerMode=`grid`,this.customIconValue=``,this.selectIcon=(e,t)=>{e.stopPropagation(),this.runAction({kind:`set-icon`,icon:t})},this.showCustomIconEntry=e=>{e.stopPropagation(),this.iconPickerMode=`custom`,this.customIconValue=``,this.host.requestUpdate(),this.host.updateComplete.then(()=>{this.host.querySelector(`.session-menu__icon-custom-input`)?.focus()})},this.showIconGrid=e=>{e?.stopPropagation(),this.iconPickerMode=`grid`,this.customIconValue=``,this.host.requestUpdate(),this.host.updateComplete.then(()=>{this.host.querySelector(`.session-menu__icon-choice--custom`)?.focus()})},this.updateCustomIconValue=e=>{e.currentTarget instanceof HTMLInputElement&&(this.customIconValue=e.currentTarget.value,this.host.requestUpdate())},this.applyCustomIcon=e=>{e?.stopPropagation();let t=Fi(this.customIconValue);t&&this.runAction({kind:`set-icon`,icon:t})},this.removeIcon=e=>{e.stopPropagation(),this.runAction({kind:`set-icon`,icon:null})},this.handleIconGridKeydown=e=>{let t=e.target;if(!(t instanceof HTMLButtonElement))return;let n={ArrowLeft:-1,ArrowRight:1,ArrowUp:-6,ArrowDown:sg}[e.key];if(n===void 0)return;let r=e.currentTarget;if(!(r instanceof HTMLElement))return;let i=Array.from(r.querySelectorAll(`.session-menu__icon-choice:not(:disabled)`)),a=i.indexOf(t);if(a<0)return;e.preventDefault(),e.stopPropagation();let o=(a+n+i.length)%i.length;t.tabIndex=-1;let s=i[o];s&&(s.tabIndex=0,s.focus())},this.focusIconGridOnOpen=e=>{let t=e.currentTarget;!(t instanceof HTMLElement)||e.detail.item!==t||t.getAttribute(`aria-expanded`)!==`true`&&(this.iconPickerMode=`grid`,this.customIconValue=``,this.host.requestUpdate(),this.host.updateComplete.then(()=>requestAnimationFrame(()=>{t.querySelector(`.session-menu__icon-choice[tabindex="0"]`)?.focus()})))}}actionDisabled(e,t=!1){let n=this.readState();return n.disabled||t||!!n.actionDisabledReasons[e]}actionTitle(e){return this.readState().actionDisabledReasons[e]??P}actionExtraDisabled(e){let t=this.readState(),{session:n}=t,r=t.selectionCount>1;switch(e){case`open-in`:return r||!t.worktreePath;case`copy-session-id`:return r||!n.sessionId;case`toggle-pin`:return r||n.isChild===!0||n.archived;case`rename`:case`set-icon`:case`set-color`:case`assign-owner`:return r;case`fork`:return r||t.forkDisabled;case`move-to-group`:case`new-group`:return n.isChild===!0;case`toggle-archived`:return!r&&!n.archived&&!t.archiveAllowed;case`delete`:return!t.deleteAllowed;case`toggle-unread`:return!1;default:return e}}runAction(e){this.actionDisabled(e.kind,this.actionExtraDisabled(e.kind))||(this.onClose(),this.onAction(e))}handleSelect(e){if(e===`copy-session-id`||e===`toggle-pin`||e===`toggle-unread`||e===`rename`||e===`fork`||e===`new-group`||e===`toggle-archived`||e===`delete`)return this.runAction({kind:e}),!0;if(e.startsWith(`open-in:`)){let t=this.readState(),n=Em.find(t=>t===e.slice(8));return t.worktreePath&&n&&this.runAction({kind:`open-in`,editor:n,path:t.worktreePath}),!0}if(e.startsWith(`move-to-group:`)){let t=e.slice(14);return this.runAction({kind:`move-to-group`,category:t?decodeURIComponent(t):null}),!0}if(e.startsWith(`set-icon:`)){let t=e.slice(9);return this.runAction({kind:`set-icon`,icon:t?decodeURIComponent(t):null}),!0}if(e.startsWith(`set-color:`)){let t=e.slice(10),n=Ma(t);return(!t||n)&&this.runAction({kind:`set-color`,color:n}),!0}let t=Uh(e);return t?(this.runAction({kind:`assign-owner`,owner:t}),!0):!1}prepareCompactView(e){e===`icon`&&(this.iconPickerMode=`grid`,this.customIconValue=``)}handleKeydown(e){let t=e.composedPath().find(e=>e instanceof HTMLInputElement&&e.classList.contains(`session-menu__icon-custom-input`));return t?(e.stopPropagation(),e.key===`Escape`?(e.preventDefault(),this.showIconGrid()):e.key===`Enter`&&Fi(t.value)&&(e.preventDefault(),this.customIconValue=t.value,this.applyCustomIcon()),!0):!1}renderOpenInEntry(e){let t=this.readState();return t.compact?Yh({view:`open-in`,label:W(`sessionsView.openInEditorMenu`),icon:H.externalLink,disabled:t.disabled||!e}):F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
?disabled=${t.disabled||!e}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.externalLink}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.openInEditorMenu`)}</span>
|
|
${e?this.renderEditorSubmenu():P}
|
|
</wa-dropdown-item>`}renderPrimaryActions(){let e=this.readState(),{session:t}=e,n=e.selectionCount>1,r=String(e.selectionCount),i=t.isChild!==!0;return F`
|
|
${n||!i?P:F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="toggle-pin"
|
|
data-shortcut="p"
|
|
aria-keyshortcuts="P"
|
|
?disabled=${this.actionDisabled(`toggle-pin`,t.archived)}
|
|
title=${this.actionTitle(`toggle-pin`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${t.pinned?H.pinOff:H.pin}</span
|
|
>
|
|
<span class="session-menu__text"
|
|
>${t.pinned?W(`sessionsView.unpinSession`):W(`sessionsView.pinSession`)}</span
|
|
>
|
|
${Ci(`p`)}
|
|
</wa-dropdown-item>`}
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="toggle-unread"
|
|
data-shortcut="u"
|
|
aria-keyshortcuts="U"
|
|
?disabled=${this.actionDisabled(`toggle-unread`)}
|
|
title=${this.actionTitle(`toggle-unread`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${t.unread?H.eye:H.circle}</span
|
|
>
|
|
<span class="session-menu__text"
|
|
>${n?t.unread?W(`sessionsView.markReadCount`,{count:r}):W(`sessionsView.markUnreadCount`,{count:r}):t.unread?W(`sessionsView.markRead`):W(`sessionsView.markUnread`)}</span
|
|
>
|
|
${Ci(`u`)}
|
|
</wa-dropdown-item>
|
|
${n?P:F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="rename"
|
|
data-shortcut="r"
|
|
aria-keyshortcuts="R"
|
|
?disabled=${this.actionDisabled(`rename`)}
|
|
title=${this.actionTitle(`rename`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.edit}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.renameSessionMenu`)}</span>
|
|
${Ci(`r`)}
|
|
</wa-dropdown-item>
|
|
${e.compact?Jh(e.ownerOptions,e.selfOwner).length>0?Yh({view:`assign-owner`,label:W(`sessionsView.assignTo`),icon:H.users,disabled:this.actionDisabled(`assign-owner`),title:e.actionDisabledReasons[`assign-owner`]}):P:Gh({ownerOptions:e.ownerOptions,selfOwner:e.selfOwner,currentOwnerId:e.currentOwnerId,disabled:this.actionDisabled(`assign-owner`),disabledReason:e.actionDisabledReasons[`assign-owner`]})}
|
|
${e.compact?Yh({view:`icon`,label:W(`sessionsView.setIconColorMenu`),icon:H.star,disabled:this.actionDisabled(`set-icon`),title:e.actionDisabledReasons[`set-icon`]}):F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
data-shortcut="i"
|
|
aria-keyshortcuts="I"
|
|
?disabled=${this.actionDisabled(`set-icon`)}
|
|
title=${this.actionTitle(`set-icon`)}
|
|
@submenu-opening=${this.focusIconGridOnOpen}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${H.star}</span
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.setIconMenu`)}</span>
|
|
${Ci(`i`)} ${this.renderIconSubmenu()}
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
?disabled=${this.actionDisabled(`set-color`)}
|
|
title=${this.actionTitle(`set-color`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${H.palette}</span
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.setColorMenu`)}</span>
|
|
${this.renderColorSubmenu()}
|
|
</wa-dropdown-item>`}
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="fork"
|
|
data-shortcut="f"
|
|
aria-keyshortcuts="F"
|
|
?disabled=${this.actionDisabled(`fork`,e.forkDisabled)}
|
|
title=${this.actionTitle(`fork`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.copy}</span>
|
|
<span class="session-menu__text"
|
|
>${W(e.forkFromLastCompleted?`sessionsView.forkFromLastCompleted`:`sessionsView.forkSession`)}</span
|
|
>
|
|
${Ci(`f`)}
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="copy-session-id"
|
|
data-shortcut="c"
|
|
aria-keyshortcuts="C"
|
|
?disabled=${!t.sessionId}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.copy}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.copySessionId`)}</span>
|
|
${Ci(`c`)}
|
|
</wa-dropdown-item>
|
|
`}
|
|
`}renderGroupAction(){let e=this.readState(),t=e.selectionCount>1,n=String(e.selectionCount);return e.session.isChild===!0?P:e.compact?Yh({view:`group`,label:t?W(`sessionsView.moveToGroupMenuCount`,{count:n}):W(`sessionsView.moveToGroupMenu`),icon:H.folder,disabled:this.actionDisabled(`move-to-group`),title:e.actionDisabledReasons[`move-to-group`]}):F`<wa-dropdown-item
|
|
class="session-menu__item"
|
|
?disabled=${this.actionDisabled(`move-to-group`)}
|
|
title=${this.actionTitle(`move-to-group`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.folder}</span>
|
|
<span class="session-menu__text"
|
|
>${t?W(`sessionsView.moveToGroupMenuCount`,{count:n}):W(`sessionsView.moveToGroupMenu`)}</span
|
|
>
|
|
${this.renderGroupSubmenu()}
|
|
</wa-dropdown-item>`}renderLifecycleActions(){let e=this.readState(),{session:t}=e,n=e.selectionCount>1,r=String(e.selectionCount);return F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="toggle-archived"
|
|
data-shortcut="a"
|
|
aria-keyshortcuts="A"
|
|
?disabled=${this.actionDisabled(`toggle-archived`,!n&&!t.archived&&!e.archiveAllowed)}
|
|
title=${this.actionTitle(`toggle-archived`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${t.archived?H.archiveRestore:H.archive}</span
|
|
>
|
|
<span class="session-menu__text"
|
|
>${n?t.archived?W(`sessionsView.restoreSessionCount`,{count:r}):W(`sessionsView.archiveSessionCount`,{count:r}):t.archived?W(`sessionsView.restoreSession`):W(`sessionsView.archiveSession`)}</span
|
|
>
|
|
${Ci(`a`)}
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item session-menu__item--destructive"
|
|
value="delete"
|
|
variant="danger"
|
|
data-shortcut="d"
|
|
aria-keyshortcuts="D"
|
|
?disabled=${this.actionDisabled(`delete`,!e.deleteAllowed)}
|
|
title=${this.actionTitle(`delete`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.trash}</span>
|
|
<span class="session-menu__text"
|
|
>${n?W(`sessionsView.deleteSessionCount`,{count:r}):W(`sessionsView.deleteSessionMenu`)}</span
|
|
>
|
|
${Ci(`d`)}
|
|
</wa-dropdown-item>
|
|
`}renderCompactView(e){let t=this.readState();return Zh({view:e,ownerOptions:Jh(t.ownerOptions,t.selfOwner),currentOwnerId:t.currentOwnerId,assignOwnerDisabled:this.actionDisabled(`assign-owner`),assignOwnerDisabledReason:t.actionDisabledReasons[`assign-owner`],renderOpenIn:()=>this.renderEditorSubmenu(!0),renderIcon:()=>F`${this.renderIconSubmenu(!0)}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
${this.renderColorSubmenu(!0)}`,renderGroup:()=>this.renderGroupSubmenu(!0)})}renderEditorSubmenu(e=!1){return ng({inline:e,disabled:this.readState().disabled})}renderGroupSubmenu(e=!1){let t=this.readState();return rg({inline:e,category:t.session.category,categoryClearReturnsToGroups:t.session.categoryClearReturnsToGroups,groups:t.groups,actionDisabled:e=>this.actionDisabled(e),actionTitle:e=>this.actionTitle(e)})}renderColorSubmenu(e=!1){return ig({inline:e,color:this.readState().session.color,disabled:this.actionDisabled(`set-color`),disabledReason:this.readState().actionDisabledReasons[`set-color`]})}renderIconSubmenu(e=!1){let t=this.readState();return Fm({inline:e,mode:this.iconPickerMode,currentIcon:t.session.icon,customIconValue:this.customIconValue,disabled:this.actionDisabled(`set-icon`),disabledReason:t.actionDisabledReasons[`set-icon`],onSelect:this.selectIcon,onShowCustom:this.showCustomIconEntry,onBack:this.showIconGrid,onInput:this.updateCustomIconValue,onApply:this.applyCustomIcon,onRemove:this.removeIcon,onGridKeydown:this.handleIconGridKeydown})}}})))()}var K;function ug(){return(ug=t((()=>{I(),R(),Tn(),V(),M(),Si(),U(),di(),ai(),lg(),$h(),K=class extends Et{constructor(...e){super(...e),this.session=og,this.compact=!1,this.selectionCount=1,this.lastActive=``,this.anchor={x:0,y:0},this.trigger=null,this.disabled=!1,this.actionDisabledReasons={},this.forkDisabled=!1,this.forkFromLastCompleted=!1,this.archiveAllowed=!1,this.deleteAllowed=!1,this.cloudWorkerStopAllowed=!1,this.groups=[],this.ownerOptions=[],this.selfOwner=null,this.currentOwnerId=null,this.work=null,this.workboard=null,this.onAction=()=>{},this.onClose=()=>{},this.compactView=`root`,this.managementActions=new cg(this,()=>({session:this.session,selectionCount:this.selectionCount,compact:this.compact,disabled:this.disabled,actionDisabledReasons:this.actionDisabledReasons,forkDisabled:this.forkDisabled,forkFromLastCompleted:this.forkFromLastCompleted,archiveAllowed:this.archiveAllowed,deleteAllowed:this.deleteAllowed,groups:this.groups,ownerOptions:this.ownerOptions,selfOwner:this.selfOwner,currentOwnerId:this.currentOwnerId,worktreePath:this.work?.worktreePath??null}),e=>this.onAction(e),()=>this.onClose()),this.menuLifecycle=new ei(this,{getTrigger:()=>this.trigger,onClose:()=>this.onClose(),onKeydown:e=>{this.managementActions.handleKeydown(e)||ti(this,e)}}),this.handleSelect=e=>{e.preventDefault();let t=e.detail.item.value;if(!t)return;let n=qh(t);if(n){this.compactView=n,this.managementActions.prepareCompactView(n),this.updateComplete.then(()=>{this.querySelector(`wa-dropdown-item:not([disabled])`)?.focus()});return}if(!this.managementActions.handleSelect(t)){if(t===`workboard`||t===`stop-cloud-worker`){this.runAction({kind:t});return}t===`open-pr`&&this.work?.pullRequestUrl&&this.runAction({kind:`open-pr`,url:this.work.pullRequestUrl})}},this.handleAfterHide=e=>{e.currentTarget instanceof Node&&e.currentTarget.isConnected&&this.onClose()}}connectedCallback(){super.connectedCallback(),si(this)}runAction(e){this.actionDisabledReasons[e.kind]||(this.onClose(),this.onAction(e))}actionDisabled(e,t=!1){return this.disabled||t||!!this.actionDisabledReasons[e]}actionTitle(e){return this.actionDisabledReasons[e]??P}renderWorkItems(){let e=this.work;if(!e)return P;let t=e.pullRequestUrl,n=e.worktreePath,r=e.loading||!!n;return F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="open-pr"
|
|
data-new-tab-action
|
|
data-shortcut="g"
|
|
aria-keyshortcuts="G"
|
|
?disabled=${this.disabled||!t}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${H.gitPullRequest}</span
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.openPullRequest`)}</span>
|
|
${Ci(`g`)}
|
|
</wa-dropdown-item>
|
|
${r?this.managementActions.renderOpenInEntry(n):P}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
`}render(){let e=Math.max(8,Math.min(this.anchor.x,window.innerWidth-240-8)),t=Math.max(8,Math.min(this.anchor.y,window.innerHeight-460-8)),n=this.session,r=this.selectionCount>1,i=String(this.selectionCount),a=r?W(`chat.sidebar.sessionMenuMany`,{count:i}):W(`chat.sidebar.sessionMenu`,{session:n.label});return Kn(this.anchor,F`<wa-dropdown
|
|
class=${`session-menu${this.compact?` session-menu--compact`:``}`}
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${a}
|
|
@wa-select=${this.handleSelect}
|
|
@wa-after-hide=${this.handleAfterHide}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${a}
|
|
style="position: fixed; left: ${e}px; top: ${t}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
${this.compact&&this.compactView!==`root`?this.managementActions.renderCompactView(this.compactView):F`
|
|
${!r&&this.lastActive?F`<div class="session-menu__info">
|
|
${W(`sessionsView.lastActive`,{time:this.lastActive})}
|
|
</div>`:P}
|
|
${r?P:this.renderWorkItems()}
|
|
${this.managementActions.renderPrimaryActions()}
|
|
${!r&&this.workboard?F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="workboard"
|
|
data-shortcut="w"
|
|
aria-keyshortcuts="W"
|
|
?disabled=${this.disabled||this.workboard.busy}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${this.workboard.captured?H.check:H.plus}</span
|
|
>
|
|
<span class="session-menu__text"
|
|
>${this.workboard.captured?W(`sessionsView.openWorkboardCard`):W(`sessionsView.addToWorkboard`)}</span
|
|
>
|
|
${Ci(`w`)}
|
|
</wa-dropdown-item>
|
|
`:P}
|
|
${this.managementActions.renderGroupAction()}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
${!r&&this.cloudWorkerStopAllowed?F`
|
|
<wa-dropdown-item
|
|
class="session-menu__item session-menu__item--destructive"
|
|
value="stop-cloud-worker"
|
|
variant="danger"
|
|
?disabled=${this.actionDisabled(`stop-cloud-worker`)}
|
|
title=${this.actionTitle(`stop-cloud-worker`)}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${H.stop}</span
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.stopCloudWorker`)}</span>
|
|
</wa-dropdown-item>
|
|
`:P}
|
|
${this.managementActions.renderLifecycleActions()}
|
|
`}
|
|
</wa-dropdown>`)}},S([z({attribute:!1})],K.prototype,`session`,void 0),S([z({attribute:!1})],K.prototype,`compact`,void 0),S([z({attribute:!1})],K.prototype,`selectionCount`,void 0),S([z({attribute:!1})],K.prototype,`lastActive`,void 0),S([z({attribute:!1})],K.prototype,`anchor`,void 0),S([z({attribute:!1})],K.prototype,`trigger`,void 0),S([z({attribute:!1})],K.prototype,`disabled`,void 0),S([z({attribute:!1})],K.prototype,`actionDisabledReasons`,void 0),S([z({attribute:!1})],K.prototype,`forkDisabled`,void 0),S([z({attribute:!1})],K.prototype,`forkFromLastCompleted`,void 0),S([z({attribute:!1})],K.prototype,`archiveAllowed`,void 0),S([z({attribute:!1})],K.prototype,`deleteAllowed`,void 0),S([z({attribute:!1})],K.prototype,`cloudWorkerStopAllowed`,void 0),S([z({attribute:!1})],K.prototype,`groups`,void 0),S([z({attribute:!1})],K.prototype,`ownerOptions`,void 0),S([z({attribute:!1})],K.prototype,`selfOwner`,void 0),S([z({attribute:!1})],K.prototype,`currentOwnerId`,void 0),S([z({attribute:!1})],K.prototype,`work`,void 0),S([z({attribute:!1})],K.prototype,`workboard`,void 0),S([z({attribute:!1})],K.prototype,`onAction`,void 0),S([z({attribute:!1})],K.prototype,`onClose`,void 0),S([B()],K.prototype,`compactView`,void 0),customElements.get(`openclaw-session-menu`)||customElements.define(`openclaw-session-menu`,K)})))()}function dg(e){if(e.status!==503)return;let t=e.headers?.get(`retry-after`)?.trim();if(!t||!/^\d+$/.test(t))return;let n=Number(t)*1e3;return Number.isSafeInteger(n)&&n>0&&n<=_g?n:void 0}function fg(e,t){bg.get(e)===t&&(bg.delete(e),t.retryTimer!==void 0&&(clearTimeout(t.retryTimer),t.retryTimer=void 0),t.controller.abort(),t.blobUrl&&URL.revokeObjectURL(t.blobUrl))}function pg(e,t,n,r){return`${n?`stable-miss`:`retry-miss`}\0${r?`retry-503`:`drop-503`}\0${t.join(``)}\0${e}`}function mg(e,t){let n=bg.get(e);n&&(n.consumers.delete(t),!(n.consumers.size>0||n.releaseTimer!==void 0)&&(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!(bg.get(e)!==n||n.consumers.size>0)&&fg(e,n)},0)))}async function hg(e,t,n,r,i,a){let o=setTimeout(()=>a.controller.abort(),gg),s=null,c=!1,l;try{for(let e of n.length>0?n:[``]){let n=await fetch(t,{...e?{headers:{Authorization:`Bearer ${e}`}}:{},signal:a.controller.signal});if(n.ok){s=URL.createObjectURL(await n.blob());break}if(c=n.status===404,l=i?dg(n):void 0,n.status!==401&&n.status!==403)break}}catch{}finally{clearTimeout(o)}if(bg.get(e)!==a){s&&URL.revokeObjectURL(s);return}if(!s){if(c&&r)return;if(l!==void 0){a.consumers.size>0&&a.retryAttempts<vg?(a.retryAttempts+=1,a.retryTimer=setTimeout(()=>{a.retryTimer=void 0,bg.get(e)===a&&a.consumers.size!==0&&(a.controller=new AbortController,hg(e,t,n,r,i,a))},l)):a.consumers.size>0&&(a.retryEligibleAt=Date.now()+yg);return}fg(e,a);return}a.blobUrl=s;for(let e of a.consumers.values())e()}var gg,_g,vg,yg,bg,xg;function Sg(){return(Sg=t((()=>{gg=3e4,_g=3e4,vg=3,yg=3e4,bg=new Map,xg=class{constructor(e,t={}){this.onUpdate=e,this.options=t,this.owner=Symbol(`authenticated-avatar-route-owner`),this.keys=new Set}reset(){for(let e of this.keys)mg(e,this.owner);this.keys.clear()}withActiveRoutes(e){let t=this.keys;this.keys=new Set;try{return e()}finally{for(let e of t)this.keys.has(e)||mg(e,this.owner)}}resolve(e,t){if(!e.startsWith(`/`))return e;let n=this.options.cacheNotFound===!0,r=this.options.retryUnavailable===!0,i=pg(e,t,n,r),a=bg.get(i);return a?a.blobUrl===null&&a.retryTimer===void 0&&a.retryEligibleAt!==void 0&&Date.now()>=a.retryEligibleAt&&(a.retryAttempts=0,a.retryEligibleAt=void 0,a.controller=new AbortController,hg(i,e,t,n,r,a)):(a={blobUrl:null,consumers:new Map,controller:new AbortController,releaseTimer:void 0,retryTimer:void 0,retryAttempts:0,retryEligibleAt:void 0},bg.set(i,a),hg(i,e,t,n,r,a)),a.releaseTimer!==void 0&&(clearTimeout(a.releaseTimer),a.releaseTimer=void 0),a.consumers.set(this.owner,this.onUpdate),this.keys.add(i),a.blobUrl}}})))()}var q;function Cg(){return(Cg=t((()=>{I(),R(),V(),Sg(),M(),U(),q=class extends xt{constructor(...e){super(...e),this.agentName=``,this.avatarUrl=null,this.authToken=null,this.avatarAuthReady=!1,this.avatarText=``,this.subtitle=``,this.environment=null,this.menuOpen=!1,this.menuUnread=!1,this.switcherAvailable=!1,this.avatarLoader=new xg(()=>{this.isConnected&&this.requestUpdate()})}disconnectedCallback(){this.avatarLoader.reset(),super.disconnectedCallback()}render(){return this.avatarLoader.withActiveRoutes(()=>this.renderContent())}renderContent(){let e=this.avatarUrl?.startsWith(`/`)?this.avatarAuthReady?this.avatarLoader.resolve(this.avatarUrl,this.authToken?[this.authToken]:[]):null:this.avatarUrl,t=this.switcherAvailable?W(`agentChip.switchAgent`):W(`agentChip.menuLabel`);return F`
|
|
<div class="sidebar-agent-card ${this.menuOpen?`sidebar-agent-card--open`:``}">
|
|
<button
|
|
type="button"
|
|
class="sidebar-agent-card__main"
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(this.menuOpen)}
|
|
aria-label="${this.agentName} · ${t}"
|
|
@pointerenter=${e=>{this.switcherAvailable&&e.currentTarget instanceof HTMLElement&&this.onMenuPointerEnter?.(e.currentTarget,e)}}
|
|
@pointerleave=${()=>this.onMenuPointerLeave?.()}
|
|
@pointerdown=${e=>{e.stopPropagation()}}
|
|
@click=${e=>{e.stopPropagation(),e.currentTarget instanceof HTMLElement&&this.onToggleMenu?.(e.currentTarget)}}
|
|
>
|
|
<span
|
|
class="sidebar-agent-card__avatar ${this.environment?`sidebar-agent-card__avatar--environment`:``}"
|
|
>
|
|
${e?F`<img
|
|
src=${e}
|
|
alt=""
|
|
aria-hidden="true"
|
|
loading="lazy"
|
|
decoding="async"
|
|
/>`:F`<span class="sidebar-agent-card__avatar-text" aria-hidden="true"
|
|
>${this.avatarText}</span
|
|
>`}
|
|
</span>
|
|
<span class="sidebar-agent-card__text">
|
|
<span class="sidebar-agent-card__name">
|
|
${this.agentName}
|
|
<span class="sidebar-agent-card__chevron" aria-hidden="true"
|
|
>${H.chevronDown}</span
|
|
>
|
|
</span>
|
|
${this.subtitle||this.environment?F`<span class="sidebar-agent-card__subtitle-row">
|
|
${this.subtitle?F`<span class="sidebar-agent-card__subtitle">${this.subtitle}</span>`:P}
|
|
${this.environment?F`<span class="control-ui-environment-pill"
|
|
>${this.environment.label}</span
|
|
>`:P}
|
|
</span>`:P}
|
|
</span>
|
|
${this.menuUnread&&!this.menuOpen?F`<span
|
|
class="session-unread-dot sidebar-agent-card__menu-unread"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.unread`)}
|
|
></span>`:P}
|
|
</button>
|
|
</div>
|
|
`}},S([z({attribute:!1})],q.prototype,`agentName`,void 0),S([z({attribute:!1})],q.prototype,`avatarUrl`,void 0),S([z({attribute:!1})],q.prototype,`authToken`,void 0),S([z({attribute:!1})],q.prototype,`avatarAuthReady`,void 0),S([z({attribute:!1})],q.prototype,`avatarText`,void 0),S([z({attribute:!1})],q.prototype,`subtitle`,void 0),S([z({attribute:!1})],q.prototype,`environment`,void 0),S([z({attribute:!1})],q.prototype,`menuOpen`,void 0),S([z({attribute:!1})],q.prototype,`menuUnread`,void 0),S([z({attribute:!1})],q.prototype,`switcherAvailable`,void 0),S([z({attribute:!1})],q.prototype,`onToggleMenu`,void 0),S([z({attribute:!1})],q.prototype,`onMenuPointerEnter`,void 0),S([z({attribute:!1})],q.prototype,`onMenuPointerLeave`,void 0),customElements.get(`openclaw-sidebar-agent-card`)||customElements.define(`openclaw-sidebar-agent-card`,q)})))()}function wg(e){return e.state?.lastRunStatus??e.state?.lastStatus??`unknown`}function Tg(e){let t=e.state?.runningAtMs;return typeof t==`number`&&Number.isFinite(t)}function Eg(e){return e.state?.autoDisabled?!0:e.enabled&&wg(e)===`error`}function Dg(){return(Dg=t((()=>{})))()}function Og(e,t){let n=e.trim();if(!kg.test(n))return;let[r,i=``]=n.split(`.`),a=(r||`0`).replace(/^0+/u,``)||`0`,o=i.replace(/0+$/u,``);if(a.length>String(2**53-1).length||o.length>10)return;let s=10n**BigInt(o.length),c=(BigInt(a)*s+BigInt(o||`0`))*BigInt(Ag[t]);if(c%s!==0n)return;let l=c/s;return l>0n&&l<=BigInt(2**53-1)?Number(l):void 0}var kg,Ag;function jg(){return(jg=t((()=>{kg=/^(?:\d+(?:\.\d*)?|\.\d+)$/u,Ag={seconds:1e3,minutes:6e4,hours:36e5,days:864e5}})))()}async function Mg(e){if(!(!e.client||!e.connected))try{let t=await e.client.request(`cron.list`,{...e.cronAgentId?{agentId:e.cronAgentId}:{},enabled:`enabled`,includeDeliveryPreviews:!1,lastRunStatus:`error`,limit:1,offset:0});e.cronFailingCount=typeof t?.total==`number`?t.total:null}catch{e.cronFailingCount=null}}async function Ng(e){if(!e.client||!e.connected||!e.cronAgentId){e.cronScopedTotal=null,e.cronScopedNextWakeAtMs=null;return}try{let[t,n]=await Promise.all([e.client.request(`cron.list`,{agentId:e.cronAgentId,includeDisabled:!0,includeDeliveryPreviews:!1,limit:1,offset:0}),e.client.request(`cron.list`,{agentId:e.cronAgentId,enabled:`enabled`,includeDeliveryPreviews:!1,limit:1,offset:0,sortBy:`nextRunAtMs`,sortDir:`asc`})]);e.cronScopedTotal=typeof t.total==`number`?t.total:null;let r=n.jobs[0]?.state?.nextRunAtMs;e.cronScopedNextWakeAtMs=typeof r==`number`&&Number.isFinite(r)?r:null}catch{e.cronScopedTotal=null,e.cronScopedNextWakeAtMs=null}}function Pg(){return(Pg=t((()=>{})))()}function Fg(e){return T(e)?e.kind===`systemEvent`?typeof e.text==`string`:e.kind===`agentTurn`?typeof e.message==`string`:e.kind===`command`?Array.isArray(e.argv)&&e.argv.every(e=>typeof e==`string`):e.kind===`script`?typeof e.script==`string`:!!ss(e.kind):!1}function Ig(e){return e===`main`||e===`isolated`||e===`current`||e.startsWith(`session:`)&&e.length>8}function Lg(e){let t=e.payload;return Fg(t)?t:null}function Rg(e){return Lg(e)!==null}function zg(e={}){return{client:e.client??null,connected:e.connected??!1,cronLoading:!1,cronJobsError:null,cronJobsLoadingMore:!1,cronJobsReloadPending:!1,cronJobsReloadPendingTableFilters:!1,cronJobs:[],cronJobsSnapshotRevision:null,cronJobsTotal:0,cronJobsHasMore:!1,cronJobsNextOffset:null,cronJobsLimit:50,cronJobsQuery:``,cronJobsEnabledFilter:`all`,cronJobsScheduleKindFilter:`all`,cronJobsLastStatusFilter:`all`,cronJobsTriggerFilter:`all`,cronJobsSortBy:`nextRunAtMs`,cronJobsSortDir:`asc`,cronAgentId:null,cronStatus:null,cronScopedTotal:null,cronScopedNextWakeAtMs:null,cronFailingCount:null,cronError:null,cronForm:{...z_},cronCreateOpen:!1,cronFieldErrors:{},cronEditingJob:null,cronCloningJob:null,cronEditingJobId:null,cronEditingConfigRevision:null,cronRunsJobId:null,cronRunsLoadingMore:!1,cronRuns:[],cronRunsTotal:0,cronRunsHasMore:!1,cronRunsNextOffset:null,cronRunsLimit:50,cronRunsScope:`all`,cronRunsStatuses:[],cronRunsDeliveryStatuses:[],cronRunsStatusFilter:`all`,cronRunsQuery:``,cronRunsSortDir:`desc`,cronBusy:!1}}function Bg(e){return e.sessionTarget!==`main`&&(e.payloadKind===`agentTurn`||e.payloadLocked)}function Vg(e,t={}){let n=e;if(!e.payloadLocked){if(t.sessionTarget!==void 0){let t=e.sessionTarget===`main`?`systemEvent`:`agentTurn`;e.payloadKind!==t&&(n={...n,payloadKind:t})}else e.payloadKind===`systemEvent`&&e.sessionTarget!==`main`?n={...n,sessionTarget:`main`}:e.payloadKind===`agentTurn`&&e.sessionTarget===`main`&&(n={...n,sessionTarget:`isolated`})}return n.deliveryMode!==`announce`||Bg(n)?n:{...n,deliveryMode:`none`}}function Hg(e){let t={};if(e.name.trim()||(t.name=`cron.errors.nameRequired`),e.scheduleKind===`at`){let n=Date.parse(e.scheduleAt);Number.isFinite(n)||(t.scheduleAt=`cron.errors.scheduleAtInvalid`)}else if(e.scheduleKind===`every`){let n=Og(e.everyAmount,e.everyUnit);n===void 0?t.everyAmount=`cron.errors.everyAmountInvalid`:e.triggerEnabled&&n<yo()&&(t.everyAmount=`cron.errors.triggerIntervalTooShort`)}else if(e.scheduleKind===`cron`&&(e.cronExpr.trim()||(t.cronExpr=`cron.errors.cronExprRequired`),!e.scheduleExact)){let n=e.staggerAmount.trim();n&&Xe(n,0)<=0&&(t.staggerAmount=`cron.errors.staggerAmountInvalid`)}if(e.triggerEnabled&&(e.payloadKind===`script`?t.triggerScript=`cron.errors.triggerScriptPayloadUnsupported`:e.scheduleKind!==`every`&&e.scheduleKind!==`cron`&&e.scheduleKind!==`stream`?t.triggerScript=`cron.errors.triggerScheduleUnsupported`:e.triggerScript.trim()||(t.triggerScript=`cron.errors.triggerScriptRequired`)),!e.payloadLocked&&!e.payloadText.trim()&&(t.payloadText=e.payloadKind===`systemEvent`?`cron.errors.systemTextRequired`:`cron.errors.agentMessageRequired`),!e.payloadLocked&&e.payloadKind===`agentTurn`){let n=e.timeoutSeconds.trim();if(n){let e=Xe(n,NaN);(!Number.isFinite(e)||e<0)&&(t.timeoutSeconds=`cron.errors.timeoutInvalid`)}}if(e.deliveryMode===`webhook`){let n=e.deliveryTo.trim();n?/^https?:\/\//i.test(n)||(t.deliveryTo=`cron.errors.webhookUrlInvalid`):t.deliveryTo=`cron.errors.webhookUrlRequired`}if(e.failureAlertMode===`custom`){let n=e.failureAlertAfter.trim();if(n){let e=Xe(n,0);(!Number.isFinite(e)||e<=0)&&(t.failureAlertAfter=`Failure alert threshold must be greater than 0.`)}let r=e.failureAlertCooldownSeconds.trim();if(r){let e=Xe(r,-1);(!Number.isFinite(e)||e<0)&&(t.failureAlertCooldownSeconds=`Cooldown must be 0 or greater.`)}}return t}function Ug(e){return Object.keys(e).length>0}async function Wg(e){if(!(!e.client||!e.connected))try{e.cronStatus=await e.client.request(`cron.status`,{})}catch(t){Jt(t)?(e.cronStatus=null,e.cronError=wt(`cron status`)):e.cronError=k(t)}}async function Gg(e,t){if(!(!e.client||!e.connected||!t))try{let n=(await e.client.request(`models.list`,{agentId:t,view:`configured`,preparedOnly:!0}))?.models;if(!Array.isArray(n)){e.cronModelSuggestions=[];return}let r=n.map(e=>{if(!e||typeof e!=`object`)return``;let t=e.id;return typeof t==`string`?t.trim():``}).filter(Boolean);e.cronModelSuggestions=oe(r)}catch{e.cronModelSuggestions=[]}}function Kg(e,t){if(typeof t!=`string`)return;let n=t.trim();n&&e.add(n)}function qg(e,t){if(!t)return;if(typeof t==`string`){Kg(e,t);return}if(typeof t!=`object`)return;let n=t;Kg(e,n.primary),Kg(e,n.model),Kg(e,n.id),Kg(e,n.value);let r=Array.isArray(n.fallbacks)?n.fallbacks:Array.isArray(n.fallback)?n.fallback:[];for(let t of r)Kg(e,t)}function Jg(e){if(!e||typeof e!=`object`)return[];let t=e.agents;if(!t||typeof t!=`object`)return[];let n=new Set,r=t.defaults;if(r&&typeof r==`object`){let e=r;qg(n,e.model);let t=e.models;if(t&&typeof t==`object`)for(let e of Object.keys(t))Kg(n,e)}let i=t.entries;if(i&&typeof i==`object`&&!Array.isArray(i))for(let e of Object.values(i))e&&typeof e==`object`&&qg(n,e.model);return oe([...n])}async function Yg(e,t){let n=e.client;if(!(!n||!e.connected||e.cronBusy)){e.cronBusy=!0,e.cronError=null;try{await t(n)}catch(t){e.cronError=k(t)}finally{e.cronBusy=!1}}}function Xg(e){if(e)return e;throw Error(`This automation is missing its configuration revision. Refresh and try again.`)}function Zg(e,t){e.cronJobs=e.cronJobs.map(e=>e.id===t.id?t:e)}function Qg(e){return(T(e)&&T(e.details)?e.details:null)?.code===`CRON_JOB_CHANGED`}function $g(e){let t=typeof e.totalRaw==`number`&&Number.isFinite(e.totalRaw)?Math.max(0,Math.floor(e.totalRaw)):e.pageCount,n=typeof e.offsetRaw==`number`&&Number.isFinite(e.offsetRaw)?Math.max(0,Math.floor(e.offsetRaw)):0,r=typeof e.hasMoreRaw==`boolean`?e.hasMoreRaw:n+e.pageCount<Math.max(t,n+e.pageCount);return{total:t,hasMore:r,nextOffset:typeof e.nextOffsetRaw==`number`&&Number.isFinite(e.nextOffsetRaw)?Math.max(0,Math.floor(e.nextOffsetRaw)):r?n+e.pageCount:null}}function e_(e,t){if(!T(e)||!Array.isArray(e.jobs)||typeof e.snapshotRevision!=`string`||e.snapshotRevision.length===0||typeof e.total!=`number`||!Number.isSafeInteger(e.total)||e.total<0||typeof e.offset!=`number`||!Number.isSafeInteger(e.offset)||e.offset<0||typeof e.limit!=`number`||!Number.isSafeInteger(e.limit)||e.limit<1||e.limit>t||e.jobs.length>e.limit||typeof e.hasMore!=`boolean`||e.nextOffset!==null&&(typeof e.nextOffset!=`number`||!Number.isSafeInteger(e.nextOffset)||e.nextOffset<0))throw Error(`cron.list returned an invalid inventory page`);return e}function t_(e,t){let n=t+e.jobs.length;if(e.offset!==t||!Number.isSafeInteger(n)||n>e.total||(e.hasMore?e.nextOffset!==n||n<=t||n>=e.total:e.nextOffset!==null||n!==e.total))throw Error(`cron.list returned an invalid inventory page`)}function n_(e,t){e.cronJobsReloadPending||(e.cronJobsReloadPending=!0,e.cronJobsReloadPendingTableFilters=t)}async function r_(e){if(!e.cronJobsReloadPending)return;let t=e.cronJobsReloadPendingTableFilters;e.cronJobsReloadPending=!1,e.cronJobsReloadPendingTableFilters=!1,await i_(e,{tableFilters:t})}async function i_(e,t){if(!e.client||!e.connected)return;let n=t?.append===!0;if(e.cronLoading||e.cronJobsLoadingMore){n||(e.cronJobsReloadPending=!0,e.cronJobsReloadPendingTableFilters=t?.tableFilters===!0);return}if(!(n&&!e.cronJobsHasMore)){n?e.cronJobsLoadingMore=!0:e.cronLoading=!0,e.cronJobsError=null;try{let r=n?Math.max(0,e.cronJobsNextOffset??e.cronJobs.length):0,i=e_(await e.client.request(`cron.list`,{...e.cronAgentId?{agentId:e.cronAgentId}:{},includeDisabled:e.cronJobsEnabledFilter===`all`,includeDeliveryPreviews:!1,limit:e.cronJobsLimit,offset:r,query:e.cronJobsQuery.trim()||void 0,enabled:e.cronJobsEnabledFilter,...t?.tableFilters?{scheduleKind:e.cronJobsScheduleKindFilter,lastRunStatus:e.cronJobsLastStatusFilter,trigger:e.cronJobsTriggerFilter}:{},sortBy:e.cronJobsSortBy,sortDir:e.cronJobsSortDir}),e.cronJobsLimit);if(n&&(i.snapshotRevision!==e.cronJobsSnapshotRevision||i.total!==e.cronJobsTotal)){n_(e,t?.tableFilters===!0);return}t_(i,r);let a=i.jobs.filter(Rg);e.cronJobs=n?[...e.cronJobs,...a]:a,e.cronJobsSnapshotRevision=i.snapshotRevision,e.cronJobsTotal=i.total,e.cronJobsHasMore=i.hasMore,e.cronJobsNextOffset=i.nextOffset}catch(t){e.cronJobsError=k(t)}finally{n?e.cronJobsLoadingMore=!1:e.cronLoading=!1,await r_(e)}}}function a_(e,t){typeof t.cronJobsQuery==`string`&&(e.cronJobsQuery=t.cronJobsQuery),e.cronJobsEnabledFilter=t.cronJobsEnabledFilter??e.cronJobsEnabledFilter,e.cronJobsScheduleKindFilter=t.cronJobsScheduleKindFilter??e.cronJobsScheduleKindFilter,e.cronJobsLastStatusFilter=t.cronJobsLastStatusFilter??e.cronJobsLastStatusFilter,e.cronJobsTriggerFilter=t.cronJobsTriggerFilter??e.cronJobsTriggerFilter,e.cronJobsSortBy=t.cronJobsSortBy??e.cronJobsSortBy,e.cronJobsSortDir=t.cronJobsSortDir??e.cronJobsSortDir}function o_(e){return e.cronJobs.filter(t=>{let n=s_(t);return!(!n||e.cronJobsScheduleKindFilter!==`all`&&n!==e.cronJobsScheduleKindFilter||e.cronJobsLastStatusFilter!==`all`&&wg(t)!==e.cronJobsLastStatusFilter||e.cronJobsTriggerFilter===`conditional`&&!t.trigger||e.cronJobsTriggerFilter===`unconditional`&&t.trigger)})}function s_(e){let t=e.schedule?.kind;return t===`at`||t===`every`||t===`cron`||t===`on-exit`||t===`stream`?t:null}function c_(e){e.cronEditingJob=null,e.cronCloningJob=null,e.cronEditingJobId=null,e.cronEditingConfigRevision=null}function l_(e){e.cronRuns=[],e.cronRunsTotal=0,e.cronRunsHasMore=!1,e.cronRunsNextOffset=null}function u_(e,t){e.cronCloningJob=null,e.cronForm={...z_,agentId:t??``},e.cronFieldErrors={}}function d_(e){let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=new Date(t);return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,`0`)}-${String(n.getDate()).padStart(2,`0`)}T${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}`}function f_(e){return e%864e5==0?{everyAmount:String(e/864e5),everyUnit:`days`}:e%36e5==0?{everyAmount:String(e/36e5),everyUnit:`hours`}:e%6e4==0?{everyAmount:String(e/6e4),everyUnit:`minutes`}:{everyAmount:p_(e),everyUnit:`seconds`}}function p_(e){let t=BigInt(e),n=t/1000n,r=t%1000n;return r===0n?String(n):`${n}.${r.toString().padStart(3,`0`).replace(/0+$/u,``)}`}function m_(e){return e===0?{scheduleExact:!0,staggerAmount:``,staggerUnit:`seconds`}:typeof e!=`number`||!Number.isFinite(e)||e<0?{scheduleExact:!1,staggerAmount:``,staggerUnit:`seconds`}:e%6e4==0?{scheduleExact:!1,staggerAmount:String(Math.max(1,e/6e4)),staggerUnit:`minutes`}:{scheduleExact:!1,staggerAmount:String(Math.max(1,Math.ceil(e/1e3))),staggerUnit:`seconds`}}function h_(e){return e?.kind===`command`||e?.kind===`script`||ss(e?.kind)}function g_(e,t){let n=e.failureAlert,r=Lg(e),i=h_(r);if(!Ig(e.sessionTarget))throw TypeError(`Invalid cron session target: ${e.sessionTarget}`);let a={...t,name:e.name,description:e.description??``,agentId:e.agentId??``,sessionKey:e.sessionKey??``,clearAgent:!1,enabled:e.enabled,deleteAfterRun:e.deleteAfterRun??e.schedule.kind===`at`,scheduleKind:e.schedule.kind,scheduleAt:``,everyAmount:t.everyAmount,everyUnit:t.everyUnit,cronExpr:t.cronExpr,cronTz:``,scheduleExact:!1,staggerAmount:``,staggerUnit:`seconds`,triggerEnabled:e.trigger!==void 0,triggerScript:e.trigger?.script??``,triggerOnce:e.trigger?.once===!0,sessionTarget:e.sessionTarget,wakeMode:e.wakeMode,payloadKind:r?.kind??z_.payloadKind,payloadLocked:i,payloadText:r?.kind===`systemEvent`?r.text:r?.kind===`agentTurn`?r.message:r?.kind===`command`?r.argv.join(` `):r?.kind===`script`?r.script:``,payloadModel:r?.kind===`agentTurn`?r.model??``:``,payloadThinking:r?.kind===`agentTurn`?r.thinking??``:``,payloadLightContext:r?.kind===`agentTurn`&&r.lightContext===!0,deliveryMode:e.delivery?.mode??`none`,deliveryChannel:e.delivery?.channel??R_,deliveryTo:e.delivery?.to??``,deliveryAccountId:e.delivery?.accountId??``,deliveryBestEffort:e.delivery?.bestEffort??!1,deliveryThreadId:e.delivery?.threadId,deliveryCompletionDestination:e.delivery?.mode===`announce`?e.delivery.completionDestination:void 0,deliveryFailureDestination:e.delivery?.failureDestination,failureAlertMode:n===!1?`disabled`:n&&typeof n==`object`?`custom`:`inherit`,failureAlertAfter:n&&typeof n==`object`&&typeof n.after==`number`?String(n.after):z_.failureAlertAfter,failureAlertCooldownSeconds:n&&typeof n==`object`&&typeof n.cooldownMs==`number`?String(Math.floor(n.cooldownMs/1e3)):z_.failureAlertCooldownSeconds,failureAlertChannel:n&&typeof n==`object`?n.channel??R_:R_,failureAlertTo:n&&typeof n==`object`?n.to??``:``,failureAlertDeliveryMode:n&&typeof n==`object`?n.mode??`announce`:`announce`,failureAlertAccountId:n&&typeof n==`object`?n.accountId??``:``,timeoutSeconds:r?.kind===`agentTurn`&&typeof r.timeoutSeconds==`number`?String(r.timeoutSeconds):``};if(e.schedule.kind===`at`)a.scheduleAt=d_(e.schedule.at);else if(e.schedule.kind===`every`){let t=f_(e.schedule.everyMs);a.everyAmount=t.everyAmount,a.everyUnit=t.everyUnit}else if(e.schedule.kind===`cron`){a.cronExpr=e.schedule.expr,a.cronTz=e.schedule.tz??``;let t=m_(e.schedule.staggerMs);a.scheduleExact=t.scheduleExact,a.staggerAmount=t.staggerAmount,a.staggerUnit=t.staggerUnit}return Vg(a)}function __(e,t){let n=t.schedule;if(e.scheduleKind!==n.kind)return!1;if(n.kind===`at`)return e.scheduleAt===d_(n.at);if(n.kind===`every`)return Og(e.everyAmount,e.everyUnit)===n.everyMs;if(n.kind===`cron`){let t=m_(n.staggerMs);return e.cronExpr.trim()===n.expr&&e.cronTz.trim()===(n.tz??``)&&e.scheduleExact===t.scheduleExact&&e.staggerAmount.trim()===t.staggerAmount&&e.staggerUnit===t.staggerUnit}return!0}function v_(e){if(e.scheduleKind===`at`){let t=Date.parse(e.scheduleAt);if(!Number.isFinite(t))throw Error(W(`cron.errors.invalidRunTime`));return{kind:`at`,at:new Date(t).toISOString()}}if(e.scheduleKind===`every`){let t=Og(e.everyAmount,e.everyUnit);if(t===void 0)throw Error(W(`cron.errors.invalidIntervalAmount`));return{kind:`every`,everyMs:t}}let t=e.cronExpr.trim();if(!t)throw Error(W(`cron.errors.cronExprRequiredShort`));if(e.scheduleExact)return{kind:`cron`,expr:t,tz:e.cronTz.trim()||void 0,staggerMs:0};let n=e.staggerAmount.trim();if(!n)return{kind:`cron`,expr:t,tz:e.cronTz.trim()||void 0};let r=Xe(n,0);if(r<=0)throw Error(W(`cron.errors.invalidStaggerAmount`));let i=e.staggerUnit===`minutes`?r*6e4:r*1e3;return{kind:`cron`,expr:t,tz:e.cronTz.trim()||void 0,staggerMs:i}}function y_(e){if(e.payloadKind===`systemEvent`){let t=e.payloadText.trim();if(!t)throw Error(W(`cron.errors.systemEventTextRequired`));return{kind:`systemEvent`,text:t}}if(e.payloadKind!==`agentTurn`)throw Error(`Cron ${e.payloadKind} payloads are read-only in Control UI.`);let t=e.payloadText.trim();if(!t)throw Error(W(`cron.errors.agentMessageRequiredShort`));let n={kind:`agentTurn`,message:t},r=e.payloadModel.trim();r&&(n.model=r);let i=e.payloadThinking.trim();i&&(n.thinking=i);let a=e.timeoutSeconds.trim();if(a){let e=Xe(a,NaN);Number.isFinite(e)&&e>=0&&(n.timeoutSeconds=e)}return e.payloadLightContext&&(n.lightContext=!0),n}function b_(e,t={}){let n=e.trim();if(n)return n===R_?t.preserveLastOnUpdate?R_:void 0:n}function x_(e,t){if(e.failureAlertMode===`disabled`)return!1;if(e.failureAlertMode!==`custom`)return t===void 0?void 0:null;let n=t&&typeof t==`object`?t:void 0,r=Xe(e.failureAlertAfter.trim(),0),i=e.failureAlertCooldownSeconds.trim(),a=i.length>0?Xe(i,0):void 0,o=a!==void 0&&Number.isFinite(a)&&a>=0?Math.floor(a*1e3):void 0,s=e.failureAlertDeliveryMode,c=e.failureAlertAccountId.trim(),l=e.failureAlertTo.trim(),u={after:r>0?Math.floor(r):n?.after===void 0?void 0:null,channel:b_(e.failureAlertChannel,{preserveLastOnUpdate:!!n?.channel}),to:l||(n?.to?null:void 0),...o===void 0?n?.cooldownMs===void 0?{}:{cooldownMs:null}:{cooldownMs:o}};return s&&(u.mode=s),u.accountId=c||(n?.accountId?null:void 0),u}function S_(e){if(!e||typeof e!=`object`)return null;let t=`job`in e?e.job:e;if(!t||typeof t!=`object`)return null;let n=t.id;return typeof n==`string`&&n.length>0?n:null}async function C_(e){let t={saved:!1};return await Yg(e,async n=>{let r=Vg(e.cronForm);r!==e.cronForm&&(e.cronForm=r);let i=Hg(r);if(e.cronFieldErrors=i,Ug(i))return;let a=e.cronEditingJob,o=a?Xg(e.cronEditingConfigRevision):void 0,s=a?Lg(a):null,c=a??e.cronCloningJob,l=c&&__(r,c)?a?void 0:c.schedule:v_(r),u=a&&r.payloadLocked&&h_(s)?void 0:y_(r);u?.kind===`agentTurn`&&a&&s?.kind===`agentTurn`&&(!r.payloadModel.trim()&&s.model!==void 0&&(u.model=null),!r.payloadThinking.trim()&&s.thinking!==void 0&&(u.thinking=null),!r.payloadLightContext&&s.lightContext!==void 0&&(u.lightContext=!1));let d=r.deliveryMode,f=r.deliveryAccountId.trim(),p=d===`announce`?f||(a?.delivery?.accountId?null:void 0):void 0,m=d&&d!==`none`?{mode:d,channel:d===`announce`?b_(r.deliveryChannel,{preserveLastOnUpdate:!!a?.delivery?.channel}):void 0,to:r.deliveryTo.trim()||(d===`announce`&&a?.delivery?.to?null:void 0),accountId:p,bestEffort:r.deliveryBestEffort,...r.deliveryThreadId===void 0?{}:{threadId:r.deliveryThreadId},...d===`announce`&&r.deliveryCompletionDestination?{completionDestination:r.deliveryCompletionDestination}:{},...r.deliveryFailureDestination?{failureDestination:r.deliveryFailureDestination}:{}}:d===`none`?{mode:`none`,...r.deliveryBestEffort?{bestEffort:!0}:{},...r.deliveryThreadId===void 0?{}:{threadId:r.deliveryThreadId},...r.deliveryFailureDestination?{failureDestination:r.deliveryFailureDestination}:{}}:void 0,h=x_(r,a?.failureAlert),g=r.triggerScript.trim(),_=r.triggerEnabled?a?.trigger?.script===g&&a.trigger.once===!0===r.triggerOnce?void 0:{script:g,once:r.triggerOnce}:a?.trigger?null:void 0,v=r.clearAgent?null:r.agentId.trim(),y=r.sessionKey.trim()||(a?.sessionKey?null:void 0),b={name:r.name.trim(),description:r.description.trim(),agentId:v===null?null:v||void 0,sessionKey:y,enabled:r.enabled,...r.scheduleKind===`at`||r.scheduleKind===`on-exit`?{deleteAfterRun:r.deleteAfterRun}:{},sessionTarget:r.sessionTarget,wakeMode:r.wakeMode,trigger:_,delivery:m,failureAlert:h};if(l&&(b.schedule=l),u&&(b.payload=u),!b.name)throw Error(W(`cron.errors.nameRequiredShort`));if(a){let r=a.id;try{let t=await n.request(`cron.update`,{id:r,expectedConfigRevision:o,patch:b});Zg(e,t),P_(e,t)}catch(t){if(!Qg(t))throw t;await w_(e);try{P_(e,await n.request(`cron.get`,{id:r})),e.cronError=`This automation changed on the Gateway. The latest definition is loaded; review it before retrying.`}catch{e.cronError=`This automation changed on the Gateway, but the latest definition could not be loaded. Refresh before retrying.`}return}t={saved:!0,jobId:r}}else{let r=await n.request(`cron.add`,b);u_(e,v),t={saved:!0,jobId:S_(r)}}await w_(e)}),t}async function w_(e){await i_(e,{tableFilters:!0}),await Wg(e),await Mg(e)}async function T_(e,t,n){let r=!1;return await Yg(e,async i=>{let a=await i.request(`cron.update`,{id:t.id,expectedConfigRevision:Xg(t.configRevision),patch:{enabled:n}});Zg(e,a),e.cronEditingJob?.id===a.id&&N_(e,a,{...e.cronForm,enabled:a.enabled}),r=!0,await w_(e)}),r}function E_(e){if(!(`reason`in e))return W(`cron.runNotStarted.unknown`);switch(e.reason){case`not-due`:return W(`cron.runNotStarted.notDue`);case`already-running`:return W(`cron.runNotStarted.alreadyRunning`);case`restart-recovery-pending`:return W(`cron.runNotStarted.recoveryPending`);case`invalid-spec`:return W(`cron.runNotStarted.invalidSpec`);case`stopped`:return W(`cron.runNotStarted.stopped`)}return W(`cron.runNotStarted.unknown`)}async function D_(e,t,n=`force`){await Yg(e,async r=>{let i=await r.request(`cron.run`,{id:t,mode:n});if(!i.ok||`ran`in i&&!i.ran){e.cronError=E_(i),`reason`in i&&i.reason===`invalid-spec`&&await A_(e,e.cronRunsScope===`all`?null:t);return}await A_(e,e.cronRunsScope===`all`?null:t),`enqueued`in i&&i.enqueued&&(e.cronError=`Run queued. Run ID: ${i.runId}`)})}async function O_(e,t){await Yg(e,async n=>{await n.request(`cron.remove`,{id:t.id});let r=e.cronJobs.length;e.cronJobs=e.cronJobs.filter(e=>e.id!==t.id),e.cronJobs.length!==r&&(e.cronJobsTotal=Math.max(0,e.cronJobsTotal-1)),e.cronEditingJob?.id===t.id&&c_(e),e.cronRunsJobId===t.id&&(e.cronRunsJobId=null,l_(e)),await w_(e)})}function k_(e,t){return B_.get(e)===t&&e.connected&&e.client===t.client&&e.cronAgentId===t.agentId&&e.cronRunsScope===t.scope&&(t.scope!==`job`||e.cronRunsJobId===t.jobId)&&e.cronRunsLimit===t.limit&&e.cronRunsStatusFilter===t.status&&e.cronRunsQuery.trim()===t.query&&e.cronRunsSortDir===t.sortDir&&e.cronRunsStatuses.length===t.statuses.length&&e.cronRunsStatuses.every((e,n)=>e===t.statuses[n])&&e.cronRunsDeliveryStatuses.length===t.deliveryStatuses.length&&e.cronRunsDeliveryStatuses.every((e,n)=>e===t.deliveryStatuses[n])&&(!t.append||Math.max(0,e.cronRunsNextOffset??e.cronRuns.length)===t.offset)}async function A_(e,t,n){let r=e.client;if(!r||!e.connected)return`skipped`;let i=e.cronRunsScope,a=t??e.cronRunsJobId;if(i===`job`&&!a)return l_(e),`skipped`;let o=n?.append===!0;if(o&&!e.cronRunsHasMore)return`skipped`;let s={client:r,agentId:e.cronAgentId,scope:i,jobId:i===`job`?a:null,limit:e.cronRunsLimit,offset:o?Math.max(0,e.cronRunsNextOffset??e.cronRuns.length):0,statuses:[...e.cronRunsStatuses],status:e.cronRunsStatusFilter,deliveryStatuses:[...e.cronRunsDeliveryStatuses],query:e.cronRunsQuery.trim(),sortDir:e.cronRunsSortDir,append:o};B_.set(e,s),e.cronRunsLoadingMore=o;try{let t=await r.request(`cron.runs`,{...s.agentId?{agentId:s.agentId}:{},scope:s.scope,id:s.jobId??void 0,limit:s.limit,offset:s.offset,statuses:s.statuses.length>0?s.statuses:void 0,status:s.status,deliveryStatuses:s.deliveryStatuses.length>0?s.deliveryStatuses:void 0,query:s.query||void 0,sortDir:s.sortDir});if(!k_(e,s))return`skipped`;let n=Array.isArray(t.entries)?t.entries:[];e.cronRuns=o?[...e.cronRuns,...n]:n;let i=$g({totalRaw:t.total,offsetRaw:t.offset,nextOffsetRaw:t.nextOffset,hasMoreRaw:t.hasMore,pageCount:n.length});return e.cronRunsTotal=Math.max(i.total,e.cronRuns.length),e.cronRunsHasMore=i.hasMore,e.cronRunsNextOffset=i.nextOffset,`ok`}catch(t){return k_(e,s)?(e.cronError=k(t),`error`):`skipped`}finally{o&&B_.get(e)===s&&(e.cronRunsLoadingMore=!1)}}async function j_(e){e.cronRunsScope===`job`&&!e.cronRunsJobId||await A_(e,e.cronRunsJobId,{append:!0})}function M_(e,t){e.cronRunsScope=t.cronRunsScope??e.cronRunsScope,Array.isArray(t.cronRunsStatuses)&&(e.cronRunsStatuses=t.cronRunsStatuses,e.cronRunsStatusFilter=t.cronRunsStatuses[0]??`all`),Array.isArray(t.cronRunsDeliveryStatuses)&&(e.cronRunsDeliveryStatuses=t.cronRunsDeliveryStatuses),t.cronRunsStatusFilter&&(e.cronRunsStatusFilter=t.cronRunsStatusFilter,e.cronRunsStatuses=t.cronRunsStatusFilter===`all`?[]:[t.cronRunsStatusFilter]),typeof t.cronRunsQuery==`string`&&(e.cronRunsQuery=t.cronRunsQuery),e.cronRunsSortDir=t.cronRunsSortDir??e.cronRunsSortDir}function N_(e,t,n){e.cronEditingJob=t,e.cronCloningJob=null,e.cronEditingJobId=t.id,e.cronEditingConfigRevision=t.configRevision??null,e.cronRunsJobId=t.id,e.cronForm=n,e.cronFieldErrors=Hg(n)}function P_(e,t){N_(e,t,g_(t,e.cronForm))}function F_(e,t){let n=e.trim()||`Job`,r=`${n} copy`;if(!t.has(a(r)))return r;let i=2;for(;i<1e3;){let e=`${n} copy ${i}`;if(!t.has(a(e)))return e;i+=1}return`${n} copy ${Date.now()}`}function I_(e,t){c_(e),e.cronCloningJob=t,e.cronRunsJobId=t.id;let n=new Set(e.cronJobs.map(e=>a(e.name))),r=g_(t,e.cronForm);r.name=F_(t.name,n),r.payloadLocked&&(r.payloadLocked=!1,r.payloadKind=z_.payloadKind,r.payloadText=``),e.cronForm=Vg(r,{payloadKind:r.payloadKind}),e.cronFieldErrors=Hg(e.cronForm)}function L_(e,t){c_(e),u_(e,t)}var R_,z_,B_;function V_(){return(V_=t((()=>{h(),So(),V(),N(),pn(),ln(),jg(),R_=`last`,z_={name:``,description:``,agentId:``,sessionKey:``,clearAgent:!1,enabled:!0,deleteAfterRun:!1,scheduleKind:`every`,scheduleAt:``,everyAmount:`30`,everyUnit:`minutes`,cronExpr:`0 7 * * *`,cronTz:``,scheduleExact:!1,staggerAmount:``,staggerUnit:`seconds`,triggerEnabled:!1,triggerScript:``,triggerOnce:!1,sessionTarget:`isolated`,wakeMode:`now`,payloadKind:`agentTurn`,payloadLocked:!1,payloadText:``,payloadModel:``,payloadThinking:``,payloadLightContext:!1,deliveryMode:`none`,deliveryChannel:`last`,deliveryTo:``,deliveryAccountId:``,deliveryBestEffort:!1,deliveryThreadId:void 0,deliveryCompletionDestination:void 0,deliveryFailureDestination:void 0,failureAlertMode:`inherit`,failureAlertAfter:`2`,failureAlertCooldownSeconds:`3600`,failureAlertChannel:`last`,failureAlertTo:``,failureAlertDeliveryMode:`announce`,failureAlertAccountId:``,timeoutSeconds:``},B_=new WeakMap})))()}function H_(e){let t=Qi(e);return fs(t)??t}function U_(e){return e.status===`missing`?!0:Array.isArray(e.profiles)?e.profiles.some(e=>e.type===`oauth`||e.type===`token`):!1}function W_(e){let t=new Map;for(let n of e){let e=H_(n.provider),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t].map(([e,t])=>{let n=t.reduce((e,t)=>q_.indexOf(t.status)<q_.indexOf(e.status)?t:e);return Object.assign({},n,{provider:e,profiles:t.flatMap(e=>e.profiles)})})}async function G_(e,t){let n={...t?.refresh?{refresh:!0}:{},agentId:t.agentId};return(t?.signal?await e.request(`models.authStatus`,n,{signal:t.signal}):await e.request(`models.authStatus`,n))??K_}var K_,q_;function J_(){return(J_=t((()=>{Ji(),_s(),K_={ts:0,providers:[]},q_=[`expired`,`missing`,`expiring`,`ok`,`static`]})))()}function Y_(e){return e.state.phase===`hidden`?null:{type:`scopeUpgrade`,category:`system`,dismissal:(e.state.phase===`guidance`||e.state.phase===`available`)&&e.scopes?{kind:`scopeUpgrade`,signature:JSON.stringify([e.state.phase,...e.scopes.toSorted()])}:null,requiresAction:!0,severity:e.state.phase===`error`||e.state.phase===`rejected`?`error`:`warning`,state:e.state}}function X_(e){return e.visible?{type:`update`,category:`system`,dismissal:e.canDismiss&&!e.forced?e.dismissal:null,requiresAction:e.requiresAction,severity:e.severity}:null}function Z_(e){let t=e.approvals.map(e=>({type:`approval`,approval:e,category:`approvals`,dismissal:null,requiresAction:!0,severity:`warning`})),n=e.attention.filter(e=>e.severity===`error`),r=e.attention.filter(e=>e.severity===`warning`);return[...t,...e.update?.severity===`error`?[e.update]:[],...e.scopeUpgrade?[e.scopeUpgrade]:[],...n,...e.update?.severity===`warning`?[e.update]:[],...r]}function Q_(e,t){return t===`all`||e.category===t}function $_(e){let t=e.filter(e=>e.requiresAction);return{all:t.length,approvals:t.filter(e=>e.category===`approvals`).length,automations:t.filter(e=>e.category===`automations`).length,system:t.filter(e=>e.category===`system`).length}}var ev,tv;function nv(){return(nv=t((()=>{ev=[`cronFailed`,`cronOverdue`,`modelAuthExpired`],tv=[...ev,`scopeUpgrade`,`updateAvailable`]})))()}function rv(e){return`${pv}${fe(e)}`}function iv(e){let t=A();if(!t)return{};try{let n=JSON.parse(t.getItem(rv(e))??`null`),r=y(n);if(!r)return{};let i={};for(let e of tv){let t=r[e],n=Array.isArray(t)?t.filter(e=>typeof e==`string`):typeof t==`string`?[t]:[];n.length>0&&(i[e]=[...new Set(n)])}return i}catch{return{}}}function av(e,t){let n=A();if(n)try{Object.keys(t).length===0?n.removeItem(rv(e)):n.setItem(rv(e),JSON.stringify(t))}catch{}}function ov(e,t){let n=iv(e),r={...n,[t.kind]:[...new Set([...n[t.kind]??[],t.signature])]};return av(e,r),r}function sv(e){let t=e.updateSchedule?.target,n=(t?.kind===`package`?t.version:t?.upstreamSha)??e.updateAvailable?.upstreamSha??e.updateAvailable?.latestVersion,r=e.gatewayBootId?.trim(),i=n?.trim();return r&&i?{kind:`updateAvailable`,signature:JSON.stringify([i,r])}:null}function cv(e){return e===`warn`||e===`danger`}function lv(e,t){return e[t.kind]?.includes(t.signature)===!0}function uv(e,t,n){let r={},i=!1;for(let a of tv){let o=e[a];if(!o)continue;let s=o.filter(e=>!(!n||(a===`modelAuthExpired`?n.modelAuthAgentId&&(!e.startsWith(`agent:`)||e.startsWith(`agent:${n.modelAuthAgentId}\n`)):a!==`cronFailed`&&a!==`cronOverdue`||n.cronInventoryComplete))||t.some(t=>t.kind===a&&t.signature===e));s.length>0&&(r[a]=s),s.length!==o.length&&(i=!0)}return i?r:e}function dv(e){let t=iv(e.gatewayUrl),n=uv(t,e.active,e.scope);return n!==t&&av(e.gatewayUrl,n),n}function fv(e,t){let n=iv(e);if(!n[t])return n;let r={...n};return delete r[t],av(e,r),r}var pv;function mv(){return(mv=t((()=>{nv(),pv=`openclaw.control.sidebarAttention.v1:`})))()}function hv(e,t){return yv[e.kind]-yv[t.kind]}function gv(e){let t=[],n=e=>e.name?.trim()||e.id,r=(t,n,r)=>{let i=e.cronOwnerByJobId?.get(t.id);return{...i?{context:i}:{},status:n,time:r}},i=e=>Gt(e,vv),a=(e,t)=>({...e,type:`attention`,category:t,dismissal:{kind:e.kind,signature:e.signature},requiresAction:!0}),o=(e,t)=>({...e,action:{kind:`askCustodian`,alert:{...t,id:`${e.kind}:${e.signature}`}}}),s=e.cronJobs.filter(Eg).toSorted((e,t)=>(t.state?.lastRunAtMs??t.updatedAtMs)-(e.state?.lastRunAtMs??e.updatedAtMs));for(let i of s){let o=n(i),s=hn(Math.max(0,e.now-(i.state?.lastRunAtMs??i.updatedAtMs)));t.push(a({kind:`cronFailed`,severity:`error`,icon:`clock`,label:o,detail:W(`attention.automationFailed`,{time:s}),meta:r(i,W(`attention.failed`),s),action:{kind:`navigate`,routeId:`cron`},signature:i.id},`automations`))}let c=e.cronJobs.filter(t=>e.cronSchedulerEnabled!==!1&&t.enabled&&!Tg(t)&&t.state?.nextRunAtMs!=null&&e.now-t.state.nextRunAtMs>_v).toSorted((e,t)=>(t.state?.nextRunAtMs??t.updatedAtMs)-(e.state?.nextRunAtMs??e.updatedAtMs));for(let i of c){let o=n(i),s=`${i.id}@${i.state?.nextRunAtMs}`,c=hn(Math.max(0,e.now-(i.state?.nextRunAtMs??i.updatedAtMs)));t.push(a({kind:`cronOverdue`,severity:`warning`,icon:`clock`,label:o,detail:W(`attention.automationOverdue`,{time:c}),meta:r(i,W(`attention.overdue`),c),action:{kind:`navigate`,routeId:`cron`},signature:s},`automations`))}let l=W_(e.modelAuthStatus?.providers??[]).filter(U_).filter(e=>e.status===`expired`||e.status===`missing`);for(let n of l){let r=e.modelAuthAgentId?`agent:${e.modelAuthAgentId}\n${n.provider}`:n.provider,s=`${n.displayName}: ${n.status}`,c=n.profiles.find(e=>e.status===`expired`||e.status===`missing`)?.profileId??e.modelAuthAgentId?.trim(),l=hn(Math.max(0,e.now-(e.modelAuthStatus?.ts??e.now)),{suffix:!1}),u=c?W(`attention.modelAuthExpiredWithScope`,{scope:c,time:l}):W(`attention.modelAuthExpiredState`,{time:l}),d=W(`attention.modelAuthExpired`,{providers:n.displayName});t.push(a(o({kind:`modelAuthExpired`,severity:`error`,icon:`plug`,label:n.displayName,detail:u,meta:{...c?{context:c}:{},status:W(`attention.authExpired`),time:l},inlineAction:{label:W(`attention.reconnect`),routeId:`model-providers`},signature:r},{title:d,facts:[s],question:i(W(`attention.alerts.modelAuthExpiredQuestion`,{facts:s})),action:{label:W(`routeTitles.modelProviders`),target:{kind:`navigate`,routeId:`model-providers`}}}),`system`))}return t}var _v,vv,yv;function bv(){return(bv=t((()=>{V(),pn(),J_(),_v=3e5,vv=1e3,yv={modelAuthExpired:0,cronFailed:1,cronOverdue:2}})))()}function xv(e){let t=e.overlays.snapshot,n=t.updateSchedule?.campaign,r=t.updateRunning||t.updateReconciliationPending||n?.state===`applying`,i=Pa(e.gateway.snapshot,`update.run`,`operator.admin`),a=Pa(e.gateway.snapshot,`update.status`,`operator.admin`),o=n&&!t.updateCampaignStatusHydrated&&a,s=t.updateReconciliationPending?!0:o?!!(t.updateRunning||t.updateStatusBanner):!!(t.updateRunning||t.updateStatusBanner||t.updateAvailable||n),c=sv({gatewayBootId:e.gateway.snapshot.hello?.server?.bootId,updateAvailable:t.updateAvailable,updateSchedule:t.updateSchedule}),l=t.updateRunning||t.updateReconciliationPending||n?.state===`applying`||cv(t.updateStatusBanner?.tone);return{actionable:nr(t.updateAvailable,t.updateSchedule,r),busy:r,canUpdate:i,dismissal:c,forced:l,present:s}}function Sv(){return(Sv=t((()=>{hr(),Fa(),mv()})))()}var Cv,wv,J;function Tv(){return(Tv=t((()=>{Ki(),Ri(),I(),R(),Hr(),ur(),V(),an(),V_(),Fa(),J_(),O(),M(),bn(),U(),ji(),mv(),nv(),bv(),Sv(),ri(),f(),Cv=6e4,wv=6e5,J=class extends Et{constructor(...e){super(...e),this.cronJobs=[],this.cronSchedulerEnabled=null,this.modelAuthStatus=null,this.dismissed={},this.panelOpen=!1,this.panelPosition={left:8,anchor:`bottom`,bottom:8},this.selectedTab=`all`,this.overflowAbove=!1,this.overflowBelow=!1,this.loadedClient=null,this.loadedGateway=null,this.loadedAgentScope=null,this.modelAuthAgentId=null,this.loadedAtMs=0,this.dismissedScope=null,this.idleRefreshTimer=null,this.panelTrigger=null,this.panelRenderer=null,this.panelLoad=null,this.panelGeneration=0,this.nativeUpdateDeclined=!1,this.loadTask=new Vi(this,{autoRun:!1,args:()=>[null,null,null,!0],task:async([e,t,n,r],{signal:i})=>{if(!e||!t||!n)return Gi;let a=zg({client:t,connected:!0});a.cronAgentId=n.scopeId;let o=[Promise.all([i_(a),Wg(a)]).then(()=>{i.aborted||(this.cronJobs=a.cronJobs,this.cronSchedulerEnabled=a.cronStatus?.enabled??null)})];return r&&n.selectedId?o.push(G_(t,{agentId:n.selectedId,signal:i}).catch(()=>null).then(e=>{i.aborted||(this.modelAuthStatus=e,this.modelAuthAgentId=n.selectedId)})):n.selectedId||(this.modelAuthStatus=null,this.modelAuthAgentId=null),await Promise.allSettled(o),!0},onComplete:()=>{this.loadedAtMs=Date.now(),this.pruneAfterRefresh()}}),this.subscriptions=new fn(this).effect(()=>this.context?.gateway,e=>(this.synchronize(e),e.subscribe(()=>this.synchronize(e)))).watch(()=>this.context?.agentSelection,(e,t)=>e.subscribe(t),()=>{let e=this.context?.gateway;e&&this.synchronize(e,{refreshModelAuth:!1})}).effect(()=>this.context?.gateway,e=>e.subscribeEvents(t=>{this.context?.gateway===e&&t.event===`cron`&&(this.loadedClient=null,this.synchronize(e,{refreshModelAuth:!1}))})).watch(()=>this.context?.overlays,(e,t)=>e.subscribe(()=>t())).watch(()=>this.context?.scopeUpgrade,(e,t)=>e.subscribe(()=>{this.reconcileScopeUpgradeDismissal(),t()})).watch(()=>this.context?.sessions,(e,t)=>e.subscribe(t)).watch(()=>this.context?.agents,(e,t)=>e.subscribe(t)).watch(()=>this.context?.agentIdentity,(e,t)=>e.subscribe(t)),this.syncDismissalsFromStorage=e=>{this.dismissedScope&&(e.key===null||e.key===rv(this.dismissedScope))&&(this.dismissed=iv(this.dismissedScope))},this.refreshIfStale=()=>{if(document.visibilityState!==`visible`)return;let e=this.context?.gateway;e&&Date.now()-this.loadedAtMs>=Cv&&(this.loadedClient=null,this.synchronize(e))},this.handleNativeUpdateAvailabilityChanged=()=>{this.nativeUpdateDeclined=!1,this.requestUpdate()},this.handleNativeUpdateDeclined=()=>{if(this.nativeUpdateDeclined)return;this.nativeUpdateDeclined=!0;let e=this.context?.overlays.snapshot,t=e?.updateSchedule?.campaign,n=e?.updateRunning||e?.updateReconciliationPending||t?.state===`applying`;e&&(e.updateAvailable||t)&&!n&&!e.controlUiRefreshRequired&&Pa(this.context?.gateway.snapshot,`update.run`,`operator.admin`)&&this.context?.overlays.runUpdate()},this.handleOutsideInteraction=e=>{(e instanceof KeyboardEvent?e.key===`Escape`&&!this.panelOpen&&!e.defaultPrevented:!e.composedPath().includes(this))&&(e instanceof KeyboardEvent&&this.panelTrigger&&(e.preventDefault(),e.stopPropagation()),this.closePanel(!1))},this.syncOverflowCue=()=>{let e=this.querySelector(`.sidebar-issues-panel__list`),t=!!(e&&e.scrollTop>2),n=!!(e&&e.scrollHeight-e.scrollTop-e.clientHeight>2);t!==this.overflowAbove&&(this.overflowAbove=t),n!==this.overflowBelow&&(this.overflowBelow=n)},this.handlePanelKeydown=e=>{if(e.key===`Escape`){e.preventDefault(),this.closePanel(!0);return}if(e.key!==`Tab`)return;let t=e.currentTarget;if(!(t instanceof HTMLElement))return;let n=Array.from(t.querySelectorAll(`summary, button, a[href], [tabindex]:not([tabindex='-1'])`)).filter(e=>{let t=e.closest(`details:not([open])`),n=e.tagName===`SUMMARY`||!!e.parentElement?.closest(`summary`);return!e.hasAttribute(`disabled`)&&!e.closest(`[hidden]`)&&(!t||n)}),r=n[0],i=n.at(-1);e.shiftKey&&document.activeElement===r?(e.preventDefault(),i?.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r?.focus())}}connectedCallback(){super.connectedCallback(),this.nativeUpdateDeclined=!1,document.addEventListener(`pointerdown`,this.handleOutsideInteraction,!0),document.addEventListener(`keydown`,this.handleOutsideInteraction,!0),document.addEventListener(`visibilitychange`,this.refreshIfStale),globalThis.addEventListener(`storage`,this.syncDismissalsFromStorage),window.addEventListener(Rr,this.handleNativeUpdateAvailabilityChanged),window.addEventListener(Yn,this.handleNativeUpdateDeclined),this.idleRefreshTimer=globalThis.setInterval(this.refreshIfStale,wv)}disconnectedCallback(){document.removeEventListener(`pointerdown`,this.handleOutsideInteraction,!0),document.removeEventListener(`keydown`,this.handleOutsideInteraction,!0),document.removeEventListener(`visibilitychange`,this.refreshIfStale),globalThis.removeEventListener(`storage`,this.syncDismissalsFromStorage),window.removeEventListener(Rr,this.handleNativeUpdateAvailabilityChanged),window.removeEventListener(Yn,this.handleNativeUpdateDeclined),this.closePanel(!1),this.idleRefreshTimer!==null&&(globalThis.clearInterval(this.idleRefreshTimer),this.idleRefreshTimer=null),this.subscriptions.clear(),this.loadTask.run([null,null,null,!1]),this.loadedClient=null,this.loadedGateway=null,this.loadedAgentScope=null,this.modelAuthAgentId=null,super.disconnectedCallback()}willUpdate(e){e.has(`activeRouteId`)&&e.get(`activeRouteId`)!==void 0&&this.closePanel(!1)}updated(e){super.updated(e),this.panelOpen&&this.syncOverflowCue()}synchronize(e,t={}){let n=e.snapshot,r=e.connection.gatewayUrl;if(r&&r!==this.dismissedScope&&(this.dismissedScope=r,this.dismissed=iv(r),this.reconcileScopeUpgradeDismissal()),n.phase!==`connected`||!n.client){this.loadTask.run([null,null,null,!1]),this.loadedClient=null,this.loadedGateway=null,this.loadedAgentScope=null,this.modelAuthAgentId=null,this.cronJobs=[],this.cronSchedulerEnabled=null,this.modelAuthStatus=null;return}let i={selectedId:this.context?.agentSelection.state.selectedId??null,scopeId:this.context?.agentSelection.state.scopeId??null},a=this.loadedAgentScope;e===this.loadedGateway&&n.client===this.loadedClient&&a&&i.selectedId===a.selectedId&&i.scopeId===a.scopeId||(a&&i.selectedId!==a.selectedId&&(this.modelAuthStatus=null,this.modelAuthAgentId=null),a&&i.scopeId!==a.scopeId&&(this.cronJobs=[]),this.loadedGateway=e,this.loadedClient=n.client,this.loadedAgentScope=i,this.loadTask.run([e,n.client,i,t.refreshModelAuth!==!1||i.selectedId!==this.modelAuthAgentId]))}pruneAfterRefresh(){this.dismissedScope&&(this.dismissed=dv({active:this.buildInboxEntries().flatMap(e=>e.dismissal?[e.dismissal]:[]),gatewayUrl:this.dismissedScope,scope:{cronInventoryComplete:this.loadedAgentScope?.scopeId===null,modelAuthAgentId:this.modelAuthAgentId}}))}reconcileScopeUpgradeDismissal(){if(!this.dismissedScope||!this.context)return;let e=this.context.gateway.snapshot,t=e.hello?.auth?.scopes,n=Y_({scopes:t,state:this.context.scopeUpgrade.state});e.phase===`connected`&&t!==void 0&&!n?.dismissal&&(this.dismissed=fv(this.dismissedScope,`scopeUpgrade`))}dismiss(e){this.dismissedScope&&(this.dismissed=ov(this.dismissedScope,e))}buildAttentionEntries(){return gv({cronJobs:this.cronJobs,cronSchedulerEnabled:this.cronSchedulerEnabled,cronOwnerByJobId:this.cronOwnerByJobId(),modelAuthStatus:this.modelAuthStatus,modelAuthAgentId:this.modelAuthAgentId,now:Date.now()})}cronOwnerByJobId(){let e=this.context?.agentSelection.state,t=this.context?.agents?.state.agentsList;if(!e||e.scopeId!==null||!t)return;let n=new Map(t.agents.map(e=>[r(e.id),ct(e)])),i=r(t.defaultId);return new Map(this.cronJobs.map(e=>{let t=r(e.agentId??i);return[e.id,n.get(t)??t]}))}buildInboxEntries(){let e=this.context;if(!e||e.gateway.snapshot.phase!==`connected`)return[];let t=e.overlays.snapshot,n=xv(e),r=X_({canDismiss:n.canUpdate,dismissal:n.dismissal,forced:n.forced,requiresAction:n.forced||n.canUpdate&&n.actionable,severity:t.updateStatusBanner?.tone===`danger`?`error`:`warning`,visible:n.present}),i=Y_({scopes:e.gateway.snapshot.hello?.auth?.scopes,state:e.scopeUpgrade.state});return Z_({approvals:t.approvalQueue,attention:this.buildAttentionEntries().toSorted(hv),scopeUpgrade:i,update:r})}currentInboxEntries(){return this.buildInboxEntries().filter(e=>!e.dismissal||!lv(this.dismissed,e.dismissal))}async openPanel(e){let t=++this.panelGeneration;this.panelTrigger=e,this.panelLoad??=d(()=>import(`./sidebar-attention-panel.runtime-DcNkyKMY.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url);let n=await this.panelLoad;if(!this.isConnected||t!==this.panelGeneration)return;this.context?.scopeUpgrade.activate(n.ScopeUpgradeController);let r=e.getBoundingClientRect(),i=Math.min(390,globalThis.innerWidth-16),a=r.left+r.width/2-i/2,o=Math.max(8,Math.min(a,globalThis.innerWidth-i-8));this.panelRenderer=n.renderSidebarAttentionPanel,this.panelPosition=r.top<globalThis.innerHeight/2?{left:o,anchor:`top`,top:Math.max(8,r.bottom+8)}:{left:o,anchor:`bottom`,bottom:Math.max(8,globalThis.innerHeight-r.top+8)},this.selectedTab=`all`,this.panelOpen=!0,await this.updateComplete,t===this.panelGeneration&&this.querySelector(`.sidebar-issues-panel__list`)?.focus()}closePanel(e){let t=++this.panelGeneration,n=e&&this.panelOpen?this.panelTrigger:null;this.panelOpen=!1,this.overflowAbove=!1,this.overflowBelow=!1,this.panelTrigger=null,n&&this.updateComplete.then(()=>{t===this.panelGeneration&&n.focus()})}dismissPanel(){let e=this.panelOpen;return this.closePanel(!1),e}selectTab(e){this.selectedTab=e,this.updateComplete.then(()=>{if(!this.panelOpen||this.selectedTab!==e)return;let t=this.querySelector(`.sidebar-issues-panel__list`);t&&(t.scrollTop=0),this.syncOverflowCue()})}async open(e){if(this.closePanel(!1),e.action.kind===`navigate`){this.onNavigate?.(e.action.routeId);return}let{custodianAlertStore:t}=await d(async()=>{let{custodianAlertStore:e}=await import(`./custodian-alert-store-KwahxieH.js`);return{custodianAlertStore:e}},__vite__mapDeps([15,16,1]),import.meta.url);t.present(e.action.alert);let n=this.context?.gateway.snapshot;Pa(n,`openclaw.chat`,`operator.admin`)?window.dispatchEvent(new CustomEvent(_i,{detail:{open:!0}})):(this.onNavigate??(e=>this.context?.navigate(e)))(`custodian`)}async decideApproval(e,t,n){let r=this.context;if(!r)return;let i=e.currentTarget;if(!(i instanceof HTMLElement))return;let a=Array.from(this.querySelectorAll(`[data-issue-row-focus]`)),o=i.closest(`[data-approval-id]`)?.querySelector(`[data-issue-row-focus]`)??null,s=o?a.indexOf(o):0,c=this.panelGeneration;if(await r.overlays.decideApproval(n,t),await this.updateComplete,c!==this.panelGeneration||i.isConnected)return;let l=Array.from(this.querySelectorAll(`[data-issue-row-focus]`));l[Math.min(Math.max(s,0),l.length-1)]?.focus()}render(){if(this.context?.gateway.snapshot.phase!==`connected`)return P;let e=this.currentInboxEntries(),t=$_(e).all,n=W(t===1?`attention.issueCount`:`attention.issueCountPlural`,{count:String(t)});return F`
|
|
<span class="sr-only" role="status" aria-live="polite">${n}</span>
|
|
<button
|
|
type="button"
|
|
class="sidebar-issues-button"
|
|
aria-expanded=${String(this.panelOpen)}
|
|
aria-haspopup="dialog"
|
|
aria-controls="sidebar-issues-panel"
|
|
aria-label=${n}
|
|
@click=${e=>{let t=e.currentTarget;t instanceof HTMLElement&&(this.panelOpen?this.closePanel(!0):this.openPanel(t))}}
|
|
>
|
|
<span class="sidebar-issues-button__icon" aria-hidden="true">${H.inbox}</span>
|
|
${t>0?F`<span class="sidebar-issues-button__count" aria-hidden="true"
|
|
>${t>9?`9+`:t}</span
|
|
>`:P}
|
|
</button>
|
|
${this.panelOpen&&this.panelRenderer?this.panelRenderer({context:this.context,entries:e,onApprovalDecision:(e,t,n)=>void this.decideApproval(e,t,n),onClose:e=>this.closePanel(e),onDismiss:e=>this.dismiss(e),onKeydown:this.handlePanelKeydown,onNavigate:e=>{this.closePanel(!1),(this.onNavigate??(e=>this.context?.navigate(e)))(e)},onOpen:e=>void this.open(e),onScroll:this.syncOverflowCue,onSelectTab:e=>this.selectTab(e),overflowAbove:this.overflowAbove,overflowBelow:this.overflowBelow,panelPosition:this.panelPosition,selectedTab:this.selectedTab,watchUpdateProgress:this.watchUpdateProgress}):P}
|
|
`}},S([Hi({context:Wr,subscribe:!0})],J.prototype,`context`,void 0),S([B()],J.prototype,`cronJobs`,void 0),S([B()],J.prototype,`cronSchedulerEnabled`,void 0),S([B()],J.prototype,`modelAuthStatus`,void 0),S([B()],J.prototype,`dismissed`,void 0),S([B()],J.prototype,`panelOpen`,void 0),S([B()],J.prototype,`panelPosition`,void 0),S([B()],J.prototype,`selectedTab`,void 0),S([B()],J.prototype,`overflowAbove`,void 0),S([B()],J.prototype,`overflowBelow`,void 0),S([z({attribute:!1})],J.prototype,`activeRouteId`,void 0),S([z({attribute:!1})],J.prototype,`onNavigate`,void 0),S([z({attribute:!1})],J.prototype,`watchUpdateProgress`,void 0),customElements.get(`openclaw-sidebar-attention`)||customElements.define(`openclaw-sidebar-attention`,J)})))()}var Ev;function Dv(){return(Dv=t((()=>{I(),R(),V(),M(),U(),ri(),Ev=class extends xt{constructor(...e){super(...e),this.mode=`system`,this.handleModeChange=e=>{let t=this.mode===`system`?`light`:this.mode===`light`?`dark`:`system`;this.dispatchEvent(new CustomEvent(`theme-change`,{detail:{mode:t,element:e.currentTarget},bubbles:!0,composed:!0}))}}render(){let e=this.mode===`system`?`common.system`:this.mode===`light`?`common.light`:`common.dark`,t=W(e),n=W(`common.colorModeOption`,{mode:t});return F`
|
|
<openclaw-tooltip .content=${n}>
|
|
<button
|
|
type="button"
|
|
class="theme-mode-toggle"
|
|
aria-label=${n}
|
|
@click=${this.handleModeChange}
|
|
>
|
|
${this.mode===`system`?H.monitor:this.mode===`light`?H.sun:H.moon}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
`}},S([z({attribute:!1})],Ev.prototype,`mode`,void 0),customElements.get(`openclaw-theme-mode-toggle`)||customElements.define(`openclaw-theme-mode-toggle`,Ev)})))()}function Ov(e,t){return e===void 0?!1:t===`config`?Fr(e):t===`plugins`?Yr(e):t===`sessions`?jr(e):e===t}function kv(e){let t=e??[];return[`chat`,`control`,`agent`,`settings`].flatMap(e=>t.filter(t=>(t.group??`control`)===e))}function Av(e){return F`
|
|
<a
|
|
href=${e.href}
|
|
class="nav-item ${e.active?`nav-item--active`:``}"
|
|
@focus=${t=>e.onPreload(t)}
|
|
@blur=${e.onCancelPreload}
|
|
@pointerenter=${t=>e.onPreload(t)}
|
|
@pointerleave=${e.onCancelPreload}
|
|
@touchstart=${t=>e.onPreload(t,!0)}
|
|
@click=${t=>{et(t)&&(t.preventDefault(),e.onNavigate())}}
|
|
>
|
|
<span class="nav-item__icon" aria-hidden="true"
|
|
>${H[Ur(e.routeId)]}</span
|
|
>
|
|
<span class="nav-item__text">${$n(e.routeId)}</span>
|
|
</a>
|
|
`}function jv(e){let t=he({pluginId:e.tab.pluginId,id:e.tab.id}),n=Object.hasOwn(H,e.tab.icon)?e.tab.icon:`puzzle`;return F`
|
|
<a
|
|
href=${`${Gr(`plugin`,e.basePath)}${t}`}
|
|
class="nav-item ${e.active?`nav-item--active`:``}"
|
|
aria-current=${e.active?`page`:P}
|
|
@click=${n=>{et(n)&&(n.preventDefault(),e.onNavigate(t))}}
|
|
>
|
|
<span class="nav-item__icon" aria-hidden="true">${H[n]}</span>
|
|
<span class="nav-item__text">${e.tab.label}</span>
|
|
</a>
|
|
`}function Mv(e,t){let n=Ov(e.activeRouteId,t);return F`
|
|
<wa-dropdown-item
|
|
value=${t}
|
|
class="sidebar-customize-menu__item ${n?`sidebar-customize-menu__item--active`:``}"
|
|
aria-current=${n?`page`:P}
|
|
@pointerenter=${n=>e.onPreloadRoute(t,n)}
|
|
@pointerleave=${e.onCancelPreload}
|
|
@click=${e=>{if(!et(e)){e.currentTarget.dataset.nativeNavigation=`true`;return}e.preventDefault()}}
|
|
>
|
|
<a href=${Gr(t,e.basePath)} tabindex="-1">
|
|
<span class="nav-item__icon" aria-hidden="true"
|
|
>${H[Ur(t)]}</span
|
|
>
|
|
<span class="sidebar-customize-menu__text">${$n(t)}</span>
|
|
</a>
|
|
</wa-dropdown-item>
|
|
`}function Nv(e){let t=e.position;if(!t)return P;let n=Qr(e.sidebarEntries).filter(t=>e.isRouteEnabled(t));return F`
|
|
<wa-dropdown
|
|
class="sidebar-customize-menu sidebar-more-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`nav.more`)}
|
|
@wa-select=${t=>{t.preventDefault();let r=t.detail.item;if(r.dataset.nativeNavigation){delete r.dataset.nativeNavigation;return}let i=r.value;if(i===`customize`){e.onEditPinnedItems();return}i&&n.includes(i)&&e.onNavigateRoute(i)}}
|
|
@keydown=${t=>ni(t,e.onTabAway)}
|
|
@wa-after-hide=${t=>e.onClose(ci(t))}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${W(`nav.more`)}
|
|
style="position: fixed; left: ${t.x}px; top: ${t.y}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
${n.map(t=>Mv(e,t))}
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="customize">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.penLine}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`nav.customize`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`}function Pv(e){let t=e.position;return t?F`
|
|
<wa-dropdown
|
|
class="sidebar-customize-menu sidebar-pin-editor-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`nav.customize`)}
|
|
@wa-select=${t=>{t.preventDefault();let n=t.detail.item.value;if(n===`reset`)e.onReset();else if(n?.startsWith(`workboard:`)){let t=n.slice(10);e.workboardBoards.some(e=>e.id===t)&&e.onToggleWorkboardBoard(t)}else n&&qr.includes(n)&&e.onToggleRoute(n)}}
|
|
@keydown=${t=>ni(t,e.onTabAway)}
|
|
@wa-after-hide=${t=>e.onClose(ci(t))}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${W(`nav.customize`)}
|
|
style="position: fixed; left: ${t.x}px; top: ${t.y}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
<div class="sidebar-customize-menu__title">${W(`nav.customize`)}</div>
|
|
${e.preferencesBrowserOnly?F`<div class="sidebar-customize-menu__provenance" role="note">
|
|
${W(`quickSettings.personal.browserOnly`)}
|
|
</div>`:P}
|
|
${qr.filter(t=>e.isRouteEnabled(t)).map(t=>{let n=e.sidebarEntries.includes(Er({type:`route`,route:t}));return F`
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item"
|
|
type="checkbox"
|
|
value=${t}
|
|
.checked=${n}
|
|
>
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true"
|
|
>${H[Ur(t)]}</span
|
|
>
|
|
<span class="sidebar-customize-menu__text">${$n(t)}</span>
|
|
</wa-dropdown-item>
|
|
`})}
|
|
${e.isRouteEnabled(`workboard`)&&e.workboardBoards.length>0?e.workboardRenderers?.renderCustomize(e.workboardBoards,e.sidebarEntries):P}
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="reset">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.refresh}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`nav.customizeReset`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`:P}function Fv(){return(Fv=t((()=>{I(),Vr(),$r(),V(),st(),U(),li()})))()}function Iv(e){return Lv[e]}var Lv;function Rv(){return(Rv=t((()=>{U(),Lv={hand:H.hand,key:H.key,alert:H.alertTriangle,flag:H.flag,lock:H.lock,hourglass:H.hourglass}})))()}function zv(e){if(e.kind===`none`)return P;let t=e.kind===`question`?H.hand:e.kind===`approval`?H.shieldQuestion:e.kind===`agent`?Iv(e.icon):H.alertTriangle;return F`<span
|
|
class="sidebar-session-attention__icon sidebar-session-attention__icon--${e.kind}"
|
|
data-session-attention=${e.kind}
|
|
aria-hidden="true"
|
|
>${t}</span
|
|
>`}function Bv(e){switch(e.kind){case`question`:return W(`sessionsView.waitingForAnswer`);case`approval`:return W(`sessionsView.waitingForApproval`);case`error`:return W(`sessionsView.runFailedReason`,{reason:e.reason});case`agent`:return e.note;case`none`:return;default:return e}}function Vv(e=!0){return F`<span
|
|
class="session-run-spinner sidebar-recent-session__state"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.activeRun`)}
|
|
title=${e?W(`sessionsView.activeRun`):P}
|
|
></span>`}function Hv(e){return e.hasActiveRun||e.runningChildCount>0}function Uv(e,t=!0){if(e.hasActiveRun&&e.status===`queued`){let e=W(`sessionsView.statusQueued`);return F`<span
|
|
class="sidebar-child-session__status sidebar-child-session__status--queued"
|
|
role="img"
|
|
aria-label=${e}
|
|
title=${t?e:P}
|
|
>${H.hourglass}</span
|
|
>`}if(Hv(e))return Vv(t);if(!e.isChild)return e.unread?F`<span
|
|
class="session-unread-dot sidebar-recent-session__unread"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.unread`)}
|
|
></span>`:P;let n=e.status;if(!n)return P;let r=n===`done`?{icon:H.check,label:W(`sessionsView.statusDone`)}:n===`killed`?{icon:H.stop,label:W(`sessionsView.statusKilled`)}:n===`timeout`?{icon:H.alertTriangle,label:W(`sessionsView.statusTimeout`)}:n===`failed`?{icon:H.alertTriangle,label:W(`sessionsView.statusFailed`)}:null;return r?F`<span
|
|
class="sidebar-child-session__status sidebar-child-session__status--${n}"
|
|
role="img"
|
|
aria-label=${r.label}
|
|
title=${r.label}
|
|
>${r.icon}</span
|
|
>`:P}function Wv(){return(Wv=t((()=>{I(),V(),U(),Rv()})))()}function Gv(e){let{content:t,running:n,circular:r=!1,badge:i=P}=e;return F`<span class="session-glyph${`${r?` session-glyph--circular`:``}${n?` session-glyph--running`:``}`}">
|
|
<span class="session-glyph__content">${t}</span>
|
|
${n?F`<span
|
|
class="session-glyph__ring"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.activeRun`)}
|
|
></span>`:P}
|
|
${i}
|
|
</span>`}function Kv(){return F`<span
|
|
class="session-glyph__badge session-glyph__badge--unread"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.unread`)}
|
|
></span>`}function qv(){return(qv=t((()=>{I(),V()})))()}async function Jv(e,t,n){let r=e.currentTarget;if(!(r instanceof HTMLButtonElement))return;let i=await Kt(t);r.dataset.copied=i?`1`:`0`,r.setAttribute(`aria-label`,W(i?`aboutPage.copiedCommit`:`common.copyFailed`)),window.setTimeout(()=>{r.isConnected&&(delete r.dataset.copied,r.setAttribute(`aria-label`,n))},iy)}function Yv(e){return!e||e===`main`?``:`${e.length>ry?`${l(e,ry)}…`:e}@`}function Xv(e){return e.commit?`${Yv(e.branch)}${`${e.commit.slice(0,7)}${e.dirty===!0?`*`:``}`}`:null}function Zv(e){let t=Xv(e);return t?e.branch&&e.branch!==`main`?t:`git@${t}`:null}function Qv(e){return e.release?null:Zv(e)}function $v(e){let t=Qv(e);if(!t)return null;let n=e.commitAt?Date.parse(e.commitAt):NaN;return Number.isFinite(n)?`${t} · ${_t(n)}`:t}function ey(e,t){let n=e.version??t,r=Qv(e);return r?[n,r].filter(e=>!!e).join(` · `):n}function ty(e,t){let n=e.builtAt?Date.parse(e.builtAt):NaN;return{summary:e.version?`v${e.version}`:null,commit:e.commit?.slice(0,12)??null,builtAt:Number.isFinite(n)?`${Pt(n,{day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZone:`UTC`})} UTC`:null,gatewayVersion:t}}function ny(e,t){let n=ty(e,t),r=n.commit,i=W(`aboutPage.unavailable`),a=W(`aboutPage.copyCommit`);return F`
|
|
<div class="sidebar-hover-card__server-details">
|
|
<div class="sidebar-hover-card__summary">${n.summary||i}</div>
|
|
<dl class="sidebar-hover-card__metadata">
|
|
<div class="sidebar-hover-card__metadata-row">
|
|
<dt>${W(`aboutPage.commit`)}</dt>
|
|
<dd class="sidebar-hover-card__metadata-value--mono sidebar-build-hover-card__commit">
|
|
<span>${r??i}</span>
|
|
${r?F`<button
|
|
type="button"
|
|
class="sidebar-build-hover-card__copy"
|
|
aria-label=${a}
|
|
@click=${e=>void Jv(e,r,a)}
|
|
>
|
|
<span class="sidebar-build-hover-card__copy-idle" aria-hidden="true"
|
|
>${H.copy}</span
|
|
>
|
|
<span class="sidebar-build-hover-card__copy-done" aria-hidden="true"
|
|
>${H.check}</span
|
|
>
|
|
</button>`:null}
|
|
</dd>
|
|
</div>
|
|
<div class="sidebar-hover-card__metadata-row">
|
|
<dt>${W(`aboutPage.built`)}</dt>
|
|
<dd>${n.builtAt??i}</dd>
|
|
</div>
|
|
<div class="sidebar-hover-card__metadata-row">
|
|
<dt>${W(`aboutPage.gateway`)}</dt>
|
|
<dd>
|
|
${n.gatewayVersion?F`<span class="sidebar-build-hover-card__gateway-state" aria-hidden="true"></span
|
|
><span class="sr-only">${W(`common.connected`)}</span>`:null}
|
|
${n.gatewayVersion??i}
|
|
</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
`}var ry,iy;function ay(){return(ay=t((()=>{I(),V(),pn(),U(),ry=14,iy=1500})))()}function oy(){if(!Pr())return null;let e=window.__OPENCLAW_NATIVE_GATEWAYS__;return!e||!Array.isArray(e.gateways)||e.gateways.length<2?null:e.gateways.find(t=>t.id===e.currentId)??null}function sy(e){let{activeId:t,agent:n,agents:i,identity:a}=e.activeChipAgent(),o=i.some(n=>{let i=r(n.id);return i!==t&&e.agentUnreadCount(i)>0}),s=ct(n??{id:t},a),c=e.sessionDataContext?.gateway,l=c?tr({hello:c.snapshot.hello,settings:{token:c.connection.token},password:c.connection.password}):null,u=!!(c&&(c.snapshot.hello||c.connection.token.trim()||c.connection.password.trim())),d=(n?cn(n,a):a?.emoji)??(ut(s||t)||`?`),f=e.readNewSessionAccess();return F`
|
|
<div class="sidebar-brand">
|
|
<openclaw-sidebar-agent-card
|
|
.agentName=${s}
|
|
.avatarUrl=${n?Tt(n,a):a?.avatar}
|
|
.authToken=${l}
|
|
.avatarAuthReady=${u}
|
|
.avatarText=${d}
|
|
.subtitle=${e.agentChipSubtitle(t)}
|
|
.environment=${e.sessionDataContext?.config?.current?.environment??null}
|
|
.menuOpen=${e.sidebarMenus.agentMenuPosition!==null}
|
|
.menuUnread=${o}
|
|
.switcherAvailable=${i.length>1}
|
|
.onToggleMenu=${t=>e.sidebarMenus.toggleAgentMenu(t)}
|
|
.onMenuPointerEnter=${(t,n)=>e.sidebarMenus.scheduleAgentMenuHoverOpen(t,n)}
|
|
.onMenuPointerLeave=${()=>e.sidebarMenus.handleAgentMenuTriggerPointerLeave()}
|
|
@contextmenu=${t=>{if(t.preventDefault(),e.sidebarMenus.agentMenuPosition!==null)return;let n=t.currentTarget,r=n.querySelector(`.sidebar-agent-card__main`)??n;e.sidebarMenus.toggleAgentMenu(r)}}
|
|
></openclaw-sidebar-agent-card>
|
|
<div class="sidebar-brand__actions">
|
|
${bi({basePath:e.basePath,agentId:e.expandedAgentId(),className:`sidebar-brand__icon sidebar-brand__new-thread`,label:W(`chat.runControls.newSession`),disabledReason:f.allowed?void 0:f.reason,onOpen:(t,n)=>e.requestOpenNewSession(t,n)})}
|
|
</div>
|
|
</div>
|
|
`}function cy(e){let t=e.activeChipAgent().activeId,n=e.selectedAgentMainSessionKey(t),r=e.mainSessionRow(t),i=e.resolveHomeSessionAttention(n,r),a=Bv(i),o=e.outboxAttentionCountForSession(n),s=_r(e.activeRouteId)&&j(e.getRouteSessionKey(),n),c=e.hasSessionDraft(n),l=r?We(r):!1,u=r?.unread===!0&&!s,d=l?W(`sessionsView.activeRun`):``,f=u?W(`sessionsView.unread`):``,p=a||d&&f?[a,d,f].filter(Boolean).join(` · `):``,m=Gv({content:i.kind===`none`?F`<span class="nav-item__icon" aria-hidden="true">${H.home}</span>`:zv(i),running:!1,badge:u&&!l?Kv():P});return F`
|
|
<a
|
|
href=${zt({face:Ht(r),sessionKey:n,fallbackAgentId:t,basePath:e.basePath,row:r??void 0,mainKey:E(n)?.rest,preferenceDerivedFace:!0}).href}
|
|
class="nav-item nav-item--home ${s?`nav-item--active`:``}"
|
|
aria-label=${p?`${W(`nav.home`)} · ${p}`:P}
|
|
aria-current=${s?`page`:P}
|
|
@click=${n=>{et(n)&&(n.preventDefault(),e.openMainSession(t))}}
|
|
>
|
|
${a?F`<openclaw-tooltip .content=${a}>${m}</openclaw-tooltip>`:m}
|
|
<span class="nav-item__text">${W(`nav.home`)}</span>
|
|
${l||o>0||c?F`<span class="nav-item__state sidebar-home-session-states">
|
|
${l?Vv():P}
|
|
${Ep({outboxAttentionCount:o,hasComposerDraft:c})}
|
|
</span>`:P}
|
|
</a>
|
|
`}function ly(e){return F`
|
|
<div class="sidebar-nav__head">
|
|
<span class="sidebar-recent-sessions__label-text sr-only">${W(`nav.pages`)}</span>
|
|
<button
|
|
type="button"
|
|
class="sidebar-nav__head-action"
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(e.sidebarMenus.moreMenuPosition!==null)}
|
|
aria-label=${W(`nav.customize`)}
|
|
@click=${t=>e.sidebarMenus.toggleMoreMenu(t.currentTarget)}
|
|
>
|
|
${H.penLine}
|
|
</button>
|
|
</div>
|
|
`}function uy(e){let t=`online`,n=e.collapsedSessionSections.has(t),r=W(`presence.rosterTitle`),i=ar({snapshotUser:e.sessionDataContext?.gateway.snapshot.selfUser,presenceEntries:ir(e.sessionData.presencePayload),presenceInstanceId:e.sessionData.presenceInstanceId}),a=ih(e.sessionData.presencePayload,i,e.sessionData.presenceInstanceId);return a.length===0?P:F`
|
|
<section class="sidebar-online" aria-label=${r} data-session-section=${t}>
|
|
${nf({sectionId:t,draggable:!1,onStartDrag:()=>void 0,onFinishDrag:()=>void 0,content:F`
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-group-toggle"
|
|
aria-expanded=${String(!n)}
|
|
aria-label=${r}
|
|
@click=${()=>e.toggleSection(t)}
|
|
>
|
|
<span class="sidebar-session-group-toggle__lead" aria-hidden="true">
|
|
<span class="sidebar-session-group-toggle__icon"
|
|
>${n?H.chevronRight:H.chevronDown}</span
|
|
>
|
|
</span>
|
|
<span class="sidebar-recent-sessions__label-text">${r}</span>
|
|
${n?F`<span class="sidebar-online__facepile">
|
|
<openclaw-viewer-facepile
|
|
.staticUsers=${a}
|
|
.maxVisible=${2}
|
|
></openclaw-viewer-facepile>
|
|
</span>`:P}
|
|
</button>
|
|
`})}
|
|
${n?P:F`<div class="sidebar-online__list">
|
|
${Rn(a,ps,e=>F`<div class="sidebar-online__row">
|
|
<button
|
|
class="sidebar-online__person ${eh(e)?`sidebar-online__person--away`:``}"
|
|
type="button"
|
|
data-online-user-id=${e.id}
|
|
data-online-user-key=${ps(e)}
|
|
aria-haspopup="dialog"
|
|
aria-expanded="false"
|
|
aria-label=${W(`presence.card.details`,{name:$m(e)})}
|
|
>
|
|
<openclaw-viewer-avatar
|
|
.user=${e}
|
|
.markAsViewer=${!1}
|
|
variant="footer"
|
|
aria-hidden="true"
|
|
></openclaw-viewer-avatar>
|
|
<span class="sidebar-online__person-name">${$m(e)}</span>
|
|
<span class="sidebar-online__person-action" aria-hidden="true"
|
|
>${H.chevronRight}</span
|
|
>
|
|
</button>
|
|
</div>`)}
|
|
</div>`}
|
|
</section>
|
|
`}function dy(e){let t=ar({snapshotUser:e.sessionDataContext?.gateway.snapshot.selfUser,presenceEntries:ir(e.sessionData.presencePayload),presenceInstanceId:e.sessionData.presenceInstanceId}),n=t?.name??t?.email??W(`nav.account`),r={...t??{id:`account`,name:n},watchedSessions:[]},i=e.offline?null:oy(),a=$v(yi),o=i?.isPrimary?W(`chat.sessionHeader.gatewayPicker.primaryTag`):null,s=W(`profilePage.identity.menuButtonLabel`,{name:n}),c=e.offline?W(`connection.reconnecting`):i?`${i.name}${o?`, ${o}`:``}`:a;return F`
|
|
<div class="sidebar-footer-bar sidebar-footer-bar--one-action">
|
|
<button
|
|
type="button"
|
|
class="sidebar-identity-card"
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(e.sidebarMenus.identityMenuPosition!==null)}
|
|
aria-label=${c?`${s}: ${c}`:s}
|
|
@click=${t=>e.sidebarMenus.toggleIdentityMenu(t.currentTarget)}
|
|
>
|
|
<openclaw-viewer-avatar .user=${r} variant="footer"></openclaw-viewer-avatar>
|
|
<span class="sidebar-identity-card__text">
|
|
<span class="sidebar-identity-card__name" title=${n}>${n}</span>
|
|
</span>
|
|
</button>
|
|
${e.restartPending||e.offline?Dp({kind:e.restartPending?`restarting`:`offline`,queuedOutboxCount:e.queuedOutboxCount,title:e.lastError?Ei(e.lastError):W(`connection.reconnecting`),onRetry:()=>e.onRetryConnect?.()}):P}
|
|
<span class="sidebar-footer-actions">${hy(e)}</span>
|
|
</div>
|
|
`}function fy(e,t,n,r){if(t.type===`route`&&!e.sidebarMenus.isRouteEnabled(t.route)||t.type===`workboard`&&!e.sidebarMenus.isRouteEnabled(`workboard`))return P;let i=Er(t),a=e.sessionOrganizer.sidebarZoneDropTarget?.entry===i?e.sessionOrganizer.sidebarZoneDropTarget.position:null,o=t.type===`route`?e.sidebarMenus.renderRoute(t.route):t.type===`workboard`?my(e,r.get(t.boardId)):n.has(t.key)?e.renderPinnedSidebarSession(n.get(t.key)):P,s=t.type===`route`||t.type===`workboard`;return F`
|
|
<div
|
|
class="sidebar-zone-entry ${a?`sidebar-zone-entry--drop-${a}`:``} ${e.sessionOrganizer.draggingSidebarEntry===i?`sidebar-zone-entry--dragging`:``}"
|
|
data-sidebar-entry=${i}
|
|
draggable=${s?`true`:`false`}
|
|
@dragstart=${t.type===`route`?n=>e.sessionOrganizer.startSidebarRouteDrag(n,t.route):t.type===`workboard`?n=>e.sessionOrganizer.startSidebarWorkboardDrag(n,t.boardId):P}
|
|
@dragend=${s?()=>e.sessionOrganizer.finishSidebarEntryDrag():P}
|
|
@dragover=${t=>e.sessionOrganizer.handleSidebarZoneDragOver(t,i)}
|
|
@drop=${t=>e.sessionOrganizer.handleSidebarZoneDrop(t,i)}
|
|
>
|
|
${o}
|
|
</div>
|
|
`}function py(e,t){let n={pluginId:t.pluginId,id:t.id},r=dt(n),i=t.placement?.startsWith(`route:`)?t.placement.slice(6):``,a=Qn(i)?i:null;return F`
|
|
<div class="sidebar-zone-entry" data-sidebar-entry=${`plugin:${r}`}>
|
|
${a?e.sidebarMenus.renderRoute(a):jv({tab:t,basePath:e.basePath,active:e.activeRouteId===`plugin`&&e.activePluginTabId===r,onNavigate:t=>e.onNavigate?.(`plugin`,{search:t})})}
|
|
</div>
|
|
`}function my(e,t){if(!t)return P;let n=e.activeRouteId===`workboard`&&e.activeWorkboardBoardId===t.id;return e.workboardRenderers?.renderEntry({board:t,basePath:e.basePath,active:n,onNavigate:t=>e.onNavigate?.(`workboard`,{pathname:t})})??P}function hy(e){return F`<openclaw-sidebar-attention
|
|
.activeRouteId=${e.activeRouteId}
|
|
.onNavigate=${t=>e.onNavigate?.(t)}
|
|
.watchUpdateProgress=${e.watchUpdateProgress}
|
|
></openclaw-sidebar-attention>`}function gy(){return(gy=t((()=>{I(),Vn(),Vr(),$r(),Zr(),Ar(),Ai(),V(),an(),Ge(),uh(),Se(),O(),st(),Fv(),rf(),U(),oi(),Di(),Wv(),qv(),Op(),ay()})))()}function _y(e){window.dispatchEvent(new CustomEvent(mi,{detail:e}))}function vy(e,t){_y({open:!0,agentId:t,catalog:e})}function yy(e){_y({open:!0,terminalSessionId:e})}function by(){return(by=t((()=>{ji()})))()}function xy(e,t){let n=Ee(t);return!n||vt(n)?null:e.find(e=>Ee(e.request.sessionKey)===n)??null}function Sy(e){let t=new Map,n=new Set;for(let i of e){let e=i.request.agentId?.trim()||E(i.request.sessionKey)?.agentId;if(e){let n=r(e);t.set(n,(t.get(n)??0)+1)}let a=Ee(i.request.sessionKey);a&&n.add(a)}return{agentCounts:t,sessionKeys:n}}function Cy(e,t){let n=Ee(t);return n?e.sessionKeys.has(n):!1}function wy(){return(wy=t((()=>{dn(),O()})))()}function Ty(){ky??=d(()=>import(`./channel-avatar-CNP_6012.js`),__vite__mapDeps([17,1,3,2,4,5,6,7,8]),import.meta.url)}function Ey(e){let t=Am(e);return t?F`<span class="session-glyph__icon" aria-hidden="true">${t}</span>`:F`<span class="session-glyph__emoji" aria-hidden="true">${e}</span>`}function Dy(e){let t=e.hasActiveRun&&e.status===`queued`?W(`sessionsView.statusQueued`):W(`sessionsView.activeRun`);return[e.forkSource?W(`sessionsView.forkedSession`):``,Hv(e)?t:``,e.unread?W(`sessionsView.unread`):``].filter(Boolean).join(` · `)}function Oy(e,t,n,r,i,a,o){let s=Hv(e),c=e.isChild?P:Uv(e,!1);if(e.isChild)return e.attention.kind===`none`?e.icon?{running:s,leadingIndicator:Gv({content:Ey(e.icon),running:s,badge:e.unread&&!e.hasActiveRun?Kv():P}),trailingIndicator:c}:e.channelAvatarUrl?(Ty(),{running:s,leadingIndicator:Gv({content:F`<openclaw-channel-avatar
|
|
.routeUrl=${e.channelAvatarUrl}
|
|
.authTokens=${o?.authTokens??[]}
|
|
.authReady=${o?.authReady??!1}
|
|
></openclaw-channel-avatar>`,running:s,circular:!0,badge:e.unread&&!e.hasActiveRun?Kv():P}),trailingIndicator:c}):{running:s,leadingIndicator:Uv(e),trailingIndicator:c}:{running:s,leadingIndicator:Gv({content:zv(e.attention),running:s,badge:e.unread&&!e.hasActiveRun?Kv():P}),trailingIndicator:c};if(e.attention.kind!==`none`)return{running:s,leadingIndicator:Gv({content:zv(e.attention),running:!1}),trailingIndicator:c};if(e.icon)return{running:s,leadingIndicator:Gv({content:Ey(e.icon),running:!1}),trailingIndicator:c};let l=!e.isChild&&t?.id?.trim()?Lh(t,`row`,n,r,i,a):void 0;return e.channelAvatarUrl?(Ty(),{running:s,leadingIndicator:Gv({content:F`<openclaw-channel-avatar
|
|
.routeUrl=${e.channelAvatarUrl}
|
|
.authTokens=${o?.authTokens??[]}
|
|
.authReady=${o?.authReady??!1}
|
|
.fallback=${l??P}
|
|
></openclaw-channel-avatar>`,running:!1,circular:!0}),trailingIndicator:c}):l?{running:s,leadingIndicator:Gv({content:l,running:!1,circular:!0}),trailingIndicator:c,renderedOwnerIdentity:t?.identity}:{running:s,leadingIndicator:P,trailingIndicator:c}}var ky;function Ay(){return(Ay=t((()=>{I(),V(),Wv(),qv(),Mm(),Hh(),f()})))()}function jy(e){let{session:t}=e,n=Bv(t.attention),r=t.hasActiveRun,i=t.activeRunIds??[],a=e=>!!(e?.runId&&i.includes(e.runId)),o=a(e.observerDigest)?e.observerDigest:void 0,s=a(t.observerDigest)?t.observerDigest:void 0,c=r?cm(o,s):cm(e.observerDigest,t.observerDigest),l=!!(c&&(c.health===`done`||c.health===`failed`)&&(t.lastReadAt??0)<c.updatedAt),u=r||l?c?.headline:void 0;if(!e.showPreview){let e=om(c?.health)?u:void 0;return{subtitle:n??e,narration:void 0}}let d=t.agentStatusNote||void 0,f=n||d||u||!e.sidebarLiveActivity||!r?void 0:e.narrationLine,p=e.hasDisplay?e.displaySubtitle:t.subtitle&&t.workSession&&t.subtitle!==t.label?t.subtitle:void 0,m=!r&&!e.hasDisplay&&t.lastMessagePreview?.trim()||void 0;return{subtitle:r?n??d??u??f??p:n??d??u??m??p,narration:f}}function My(e){return e.subtitle?e.narration?Kn(e.narration,F`<span
|
|
class="sidebar-recent-session__subtitle sidebar-recent-session__subtitle--narration"
|
|
>${e.subtitle}</span
|
|
>`):F`<span class="sidebar-recent-session__subtitle">${e.subtitle}</span>`:P}function Ny(){return(Ny=t((()=>{I(),Tn(),Wv()})))()}var Py;function Fy(){return(Fy=t((()=>{Py=class{constructor(e,t,n,r=!0){this.intervalMs=t,this.tick=n,this.autoStart=r,this.timer=null,e.addController(this)}hostConnected(){this.autoStart&&this.start()}hostDisconnected(){this.stop()}start(){return this.timer===null&&(this.timer=globalThis.setInterval(()=>{this.tick()},this.intervalMs),!0)}stop(){this.timer!==null&&(globalThis.clearInterval(this.timer),this.timer=null)}}})))()}var Iy;function Ly(){return(Ly=t((()=>{I(),R(),pn(),M(),Fy(),Iy=class extends xt{constructor(...e){super(...e),this.startMs=null,this.endMs=null,this.minimumUnit=`second`,this.singleUnit=!1,this.polling=new Py(this,1e3,()=>this.requestUpdate(),!1)}connectedCallback(){super.connectedCallback(),this.syncTimer()}updated(){this.syncTimer()}syncTimer(){this.isConnected&&this.startMs!=null&&this.endMs==null?this.polling.start():this.polling.stop()}render(){let e=this.startMs;if(e==null)return P;let t=this.endMs??Date.now(),n=this.minimumUnit===`minute`?6e4:1e3,r=Math.max(n,t-e);return F`${this.singleUnit?ft(r):kt(this.minimumUnit===`minute`?Math.floor(r/6e4)*6e4:r)}`}},S([z({type:Number})],Iy.prototype,`startMs`,void 0),S([z({type:Number})],Iy.prototype,`endMs`,void 0),S([z({type:String})],Iy.prototype,`minimumUnit`,void 0),S([z({type:Boolean})],Iy.prototype,`singleUnit`,void 0),customElements.get(`openclaw-elapsed-time`)||customElements.define(`openclaw-elapsed-time`,Iy)})))()}function Ry(e){return e.fullyShown?e.session.children:e.session.children.filter((e,t)=>t<Hy||Sf(e))}function zy(e){let{host:t,session:n,display:r,listItem:i=!0}=e,a=t.readSessionMutationAccess({method:`sessions.patch`,params:{key:n.key,pinned:!n.pinned}}),o=n.label,{subtitle:s,narration:c}=t.sessionProjection.resolveSubtitle({session:n,hasDisplay:r!==void 0,displaySubtitle:r?.subtitle,sidebarLiveActivity:t.sidebarLiveActivity,showPreview:t.sessionsShowPreview,narrationLine:t.sidebarNarrationLines.get(n.key),observerDigest:t.sidebarObserverDigests.get(n.key)??null}),l=n.pullRequest??r?.pullRequest,u=n.worktreeId?t.sessionPullRequests.summary(n.key,n.worktreeId,l):l,d=t.sessionsStatusFilter===`archived`?`archived`:n.owner?.assignedAt===void 0?`created`:`owned`,f=t.sessionOwnershipVisible?t.sessionsStatusFilter===`archived`?n.archivedBy:n.owner?.actor:void 0,p=f?.identity?.type===`profile`?Qm(t.sessionData.presencePayload).users.some(e=>nh(e,f.identity)&&e.watchedSessions.includes(n.key)):void 0,m=t.sessionsGrouping===`person`&&!n.pinned&&d!==`archived`&&p!==!0?void 0:f,h=t.sessionDataContext?.gateway,g={authTokens:h?gr({hello:h.snapshot.hello,settings:{token:h.connection.token},password:h.connection.password}):[],authReady:!!(h&&(h.snapshot.hello||h.connection.token.trim()||h.connection.password.trim()))},{running:_,leadingIndicator:v,trailingIndicator:y,renderedOwnerIdentity:b}=Oy(n,m,d,p,n.participants,n.participantCount,g),x=n.isChild?_&&n.unread?W(`sessionsView.unread`):``:Dy(n),S=n.isChild&&(n.runtimeMs!=null||n.startedAt!=null),C=S?wf(n.key):void 0,ee=x?Tf(n.key):void 0,te=e=>at(e,e.currentTarget.querySelector(`[data-session-menu]`),(e,r,i)=>t.sidebarMenus.openSessionMenu(n,r,i,e)),w=`${W(n.pinned?`sessionsView.unpinSession`:`sessionsView.pinSession`)}: ${o}`,ne=W(`chat.sidebar.openSessionMenu`),re=`${ne}: ${o}`,ie=t.sidebarMenus.sessionMenu?.session.key===n.key||r?.catalogMenuOpen===!0,ae=Ma(n.color??``),oe=[`sidebar-recent-session`,`session-row-host`,ae?`sidebar-recent-session--colored`:``,n.isChild?`sidebar-recent-session--child`:``,s?``:`sidebar-recent-session--single-line`,n.archived?`sidebar-session--archived`:``,n.visuallyActive?`sidebar-recent-session--active`:``,t.selectedSessionKeys.has(n.key)?`sidebar-recent-session--selected`:``,n.pinned?`session-row-host--pinned`:``,_?`session-row-host--running`:``,n.visibility===`draft`?`session-row-host--draft`:``,n.visibility===`draft`?n.draftOwnedBySelf?`session-row-host--draft-owner`:`session-row-host--draft-other`:``,n.attention.kind===`error`?`sidebar-recent-session--attention-danger`:n.attention.kind===`none`?``:`sidebar-recent-session--attention-amber`,t.sessionOrganizer.draggingSessionKey===n.key?`sidebar-recent-session--dragging`:``].filter(Boolean).join(` `),se=t.isSessionChildrenExpanded(n),ce=t.readSessionMutationAccess({method:`sessions.groups.put`,requiredScope:`operator.write`}),le=!n.isChild&&ce.allowed,ue=F`<span
|
|
${r?Nn(xd):P}
|
|
class="sidebar-recent-session__name hover-marquee"
|
|
>${n.archived?F`<span
|
|
class="sidebar-session__archive-glyph"
|
|
aria-label=${W(`sessionsView.archived`)}
|
|
title=${W(`sessionsView.archived`)}
|
|
>${H.archive}</span
|
|
>`:P}${n.forkSource?F`<span
|
|
class="sidebar-session-fork-indicator"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.forkedSession`)}
|
|
>${H.gitFork}</span
|
|
>`:P}${o}</span
|
|
>`,de=r?Kn(JSON.stringify([o,n.archived===!0,n.forkSource!==void 0,u]),ue):ue,T=F`
|
|
<div
|
|
${r?.rowRef?Nn(r.rowRef):P}
|
|
class=${oe}
|
|
style=${ae?`--session-color: var(--session-color-${ae})`:P}
|
|
data-session-key=${n.key}
|
|
data-catalog-session-key=${r?.catalogIdentityKey??P}
|
|
role=${kn(i?`listitem`:void 0)}
|
|
draggable=${le?`true`:`false`}
|
|
@dragstart=${le?e=>{e.dataTransfer&&(Ud(e.dataTransfer,n.key),t.startSessionDrag(n))}:P}
|
|
@dragend=${le?()=>{t.finishSessionDrag()}:P}
|
|
@contextmenu=${te}
|
|
@keydown=${te}
|
|
@mouseenter=${vd}
|
|
@mouseleave=${yd}
|
|
>
|
|
<a
|
|
href=${dr(n.href)}
|
|
class="sidebar-recent-session__link"
|
|
draggable="false"
|
|
aria-current=${n.visuallyActive?`page`:P}
|
|
aria-describedby=${[ee,C].filter(Boolean).join(` `)||P}
|
|
@click=${e=>t.handleSessionRowClick(e,n)}
|
|
>
|
|
<span class="sidebar-session-indicator"
|
|
>${v}
|
|
${n.visibility===`draft`?F`<span class="session-row-draft-indicator" title=${W(`chat.sessionSharing.draft`)}
|
|
>👻</span
|
|
>`:P}</span
|
|
>
|
|
<span class="sidebar-recent-session__text">
|
|
<span class="sidebar-recent-session__title-row"> ${de} </span>
|
|
<span class="sidebar-recent-session__details">
|
|
${My({subtitle:s,narration:c})}
|
|
<span class="sidebar-recent-session__details-endcap">
|
|
<openclaw-viewer-facepile
|
|
.presencePayload=${t.sessionData.presencePayload}
|
|
.selfUser=${t.sessionDataContext?.gateway.snapshot.selfUser}
|
|
.selfInstanceId=${t.sessionData.presenceInstanceId}
|
|
.sessionKey=${n.key}
|
|
.excludeIdentity=${b}
|
|
.maxVisible=${3}
|
|
variant="session"
|
|
></openclaw-viewer-facepile>
|
|
${Ep({isChild:n.isChild,incognito:n.incognito,placementState:n.placementState,placementProviderId:n.placementProviderId,placementProfileId:n.placementProfileId,diskSpaceStatus:n.diskSpaceStatus,workspaceConflictCount:n.workspaceConflictCount,outboxAttentionCount:n.outboxAttentionCount,hasComposerDraft:n.hasComposerDraft===!0,pullRequest:u,hasApproval:Cy(t.sessionData.approvalBadgeSnapshot(),n.key)})}
|
|
${y===P?x?F`<span class="sr-only" id=${ee}>${x}</span>`:P:F`<span class="session-row-aside">
|
|
<span
|
|
class="session-row-state"
|
|
id=${ee}
|
|
role="img"
|
|
aria-label=${x}
|
|
>${y}</span
|
|
>
|
|
</span>`}
|
|
${S?F`<span class="session-row-trail" id=${C}
|
|
>${n.runtimeMs==null?F`<openclaw-elapsed-time
|
|
.startMs=${n.startedAt}
|
|
.endMs=${n.endedAt??null}
|
|
></openclaw-elapsed-time>`:n.hasActiveRun?F`<openclaw-elapsed-time
|
|
.startMs=${n.runtimeSampledAt-n.runtimeMs}
|
|
></openclaw-elapsed-time>`:kt(n.runtimeMs)??`0ms`}</span
|
|
>`:P}
|
|
</span>
|
|
</span>
|
|
</span>
|
|
</a>
|
|
${n.childSessionKeys.length>0?F`<button
|
|
class="sidebar-child-session-toggle ${n.runningChildCount>0?`sidebar-child-session-toggle--running`:n.failedChildCount>0?`sidebar-child-session-toggle--failed`:``}"
|
|
type="button"
|
|
data-child-session-toggle=${n.key}
|
|
aria-expanded=${String(se)}
|
|
aria-label=${W(se?`sessionsView.hideChildSessions`:`sessionsView.showChildSessions`,{count:String(n.childSessionKeys.length),session:o})}
|
|
@click=${()=>t.toggleSessionChildren(n)}
|
|
>
|
|
<span class="sidebar-child-session-toggle__icon" aria-hidden="true"
|
|
>${se?H.chevronDown:H.chevronRight}</span
|
|
>
|
|
${se?P:F`<span class="sidebar-child-session-toggle__count"
|
|
>${n.childSessionKeys.length}</span
|
|
>`}
|
|
</button>`:P}
|
|
<span class="sidebar-recent-session__aside session-row-aside">
|
|
<span class="session-row-actions">
|
|
${n.isChild?P:F`<button
|
|
class="session-action session-action--pin"
|
|
data-sidebar-session-pin="true"
|
|
type="button"
|
|
title=${a.allowed?w:a.reason}
|
|
aria-label=${w}
|
|
?disabled=${!a.allowed}
|
|
@click=${()=>t.toggleSessionPin(n)}
|
|
>
|
|
${H.pin}
|
|
</button>`}
|
|
<openclaw-tooltip .content=${ne} .describe=${!1} .disabled=${ie}>
|
|
<button
|
|
class="session-action"
|
|
data-session-menu="true"
|
|
type="button"
|
|
aria-label=${re}
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(ie)}
|
|
@click=${e=>{e.stopPropagation();let r=e.currentTarget;t.toggleSessionMenu(n,r)}}
|
|
>
|
|
${H.moreHorizontal}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
`;return Kn(n.key,T)}function By(e,t){let n=e.sessionData.childSessionErrorsByParent.get(t);return n?F`<div
|
|
class="sidebar-session-error callout danger"
|
|
data-child-session-error=${t}
|
|
role="alert"
|
|
>
|
|
<span>${n}</span>
|
|
<button
|
|
class="sidebar-session-tree__show-more"
|
|
type="button"
|
|
data-retry-child-sessions=${t}
|
|
@click=${()=>e.sessionData.retryChildSessions(t)}
|
|
>
|
|
${W(`common.retry`)}
|
|
</button>
|
|
</div>`:P}function Vy(e){let{host:t,session:n,listItem:r=!0}=e,i=t.isSessionChildrenExpanded(n),a=Ry({session:n,fullyShown:t.isSessionChildrenFullyShown(n.key)}),o=n.children.length-a.length;return F`<div
|
|
class="sidebar-session-tree"
|
|
data-session-tree=${n.key}
|
|
role=${kn(r?`listitem`:void 0)}
|
|
>
|
|
${zy({host:t,session:n,listItem:!1})}
|
|
${i?F`<div class="sidebar-session-tree__children">
|
|
${a.length>0?F`<div
|
|
class="sidebar-session-tree__list"
|
|
role=${kn(r?`list`:void 0)}
|
|
aria-label=${kn(r?W(`sessionsView.childSessions`):void 0)}
|
|
>
|
|
${Rn(a,e=>e.key,e=>Vy({host:t,session:e,listItem:r}))}
|
|
</div>`:P}
|
|
${o>0?F`<button
|
|
class="sidebar-session-tree__show-more"
|
|
type="button"
|
|
data-show-more-children=${n.key}
|
|
aria-label=${W(`sessionsView.showMoreChildren`,{count:String(o)})}
|
|
@click=${()=>t.showMoreChildren(n.key)}
|
|
>
|
|
${W(`sessionsView.showMoreChildren`,{count:String(o)})}
|
|
</button>`:P}
|
|
${By(t,n.key)}
|
|
${n.loadingChildren&&n.children.length===0?F`<span class="sidebar-session-tree__loading">${W(`common.loading`)}</span>`:P}
|
|
</div>`:P}
|
|
</div>`}var Hy;function Uy(){return(Uy=t((()=>{I(),Dn(),Tn(),jn(),Vn(),ea(),Xn(),wy(),Zr(),V(),pn(),Od(),lt(),uh(),tf(),G(),U(),Ay(),Op(),Ny(),Ly(),ri(),Hy=4})))()}function Wy(e){let{host:t,section:n}=e,r=n.totalRowCount,i=n.category,a=n.personOwner,o=n.renderHeader&&t.collapsedSessionSections.has(n.id),s=a?a.label||a.id:n.project?n.project.name:n.groups?W(`chat.sidebar.groups`):n.work?W(`chat.sidebar.coding`):i||W(`chat.sidebar.otherSessions`),c=a?`person`:n.project?`project`:n.groups?`groups`:n.work?`coding`:i?`category`:`threads`,l=o&&n.work&&n.rows.some(e=>Sf(e,Zf.ActiveRun)),u=o&&n.rows.some(e=>Sf(e,Zf.Attention)),d=t.readNewSessionAccess(),f=t.readSessionMutationAccess({method:`sessions.groups.put`,requiredScope:`operator.write`}),p=!!(a||n.project),m=f.allowed&&!p,h=[`sidebar-recent-sessions__group`,`sidebar-recent-sessions__group--zone-${c}`,o?`sidebar-recent-sessions__group--collapsed`:``,t.sessionOrganizer.draggingSidebarSection===n.id?`sidebar-recent-sessions__group--dragging`:``,t.sessionOrganizer.sessionDropTarget===n.id?`sidebar-recent-sessions__group--session-drop`:``,t.sessionOrganizer.sidebarSectionDropTarget?.sectionId===n.id?`sidebar-recent-sessions__group--section-drop-${t.sessionOrganizer.sidebarSectionDropTarget.position}`:``].filter(Boolean).join(` `);return F`
|
|
<div
|
|
class=${h}
|
|
data-session-section=${n.id}
|
|
data-zone=${c}
|
|
@dragover=${m?e=>t.sectionDragOver(e,n.id,i):P}
|
|
@dragleave=${m?e=>t.sectionDragLeave(e,n.id,i):P}
|
|
@drop=${m?e=>t.sectionDrop(e,n.id,i):P}
|
|
>
|
|
${n.renderHeader?nf({sectionId:n.id,draggable:!p,disabledReason:f.allowed?void 0:f.reason,onStartDrag:e=>t.startSidebarSectionDrag(e),onFinishDrag:()=>t.finishSidebarSectionDrag(),onContextMenu:i?e=>{e.preventDefault(),t.sidebarMenus.openSessionGroupMenu(i,e.clientX,e.clientY,null)}:void 0,content:F`
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-group-toggle"
|
|
aria-expanded=${String(!o)}
|
|
aria-label=${s}
|
|
title=${n.project?.path??P}
|
|
@click=${()=>t.toggleSection(n.id)}
|
|
>
|
|
<span class="sidebar-session-group-toggle__lead" aria-hidden="true">
|
|
<span class="sidebar-session-group-toggle__icon"
|
|
>${o?H.chevronRight:H.chevronDown}</span
|
|
>
|
|
</span>
|
|
${a?F`<openclaw-viewer-avatar
|
|
.identity=${a.identity}
|
|
.user=${{id:a.id,name:a.label,avatarUrl:a.avatarUrl,watchedSessions:[]}}
|
|
.markAsViewer=${!1}
|
|
variant="session"
|
|
aria-hidden="true"
|
|
></openclaw-viewer-avatar>`:P}
|
|
<span class="sidebar-recent-sessions__label-text">${s}</span>
|
|
${o&&r>0?F`<span class="sidebar-session-group-count">${r}</span>`:P}
|
|
${l?F`<span
|
|
class="session-run-spinner sidebar-session-group-running"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.activeRun`)}
|
|
title=${W(`sessionsView.activeRun`)}
|
|
></span>`:P}
|
|
${u?F`<span
|
|
class="sidebar-session-group-attention"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.attentionRequired`)}
|
|
title=${W(`sessionsView.attentionRequired`)}
|
|
></span>`:P}
|
|
</button>
|
|
${i?F`
|
|
${bi({basePath:t.basePath,agentId:t.expandedAgentId(),target:{group:i},className:`sidebar-session-group-actions sidebar-new-session`,label:W(`sessionsView.newSessionInGroup`,{group:i}),disabledReason:d.allowed?void 0:d.reason,onOpen:(e,n)=>t.requestOpenNewSession(e,n)})}
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-group-actions"
|
|
title=${W(`sessionsView.groupMenu`,{group:i})}
|
|
aria-label=${W(`sessionsView.groupMenu`,{group:i})}
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(t.sidebarMenus.sessionGroupMenu?.group===i)}
|
|
@click=${e=>{e.stopPropagation();let n=e.currentTarget,r=n.getBoundingClientRect();t.sidebarMenus.openSessionGroupMenu(i,r.right,r.bottom+4,n)}}
|
|
>
|
|
${H.moreHorizontal}
|
|
</button>
|
|
`:P}
|
|
`}):P}
|
|
${o?P:F`
|
|
${n.rows.length>0?F`<div class="sidebar-recent-sessions__list" role="list" aria-label=${s}>
|
|
${Rn(n.rows,e=>e.key,e=>Vy({host:t,session:e}))}
|
|
</div>`:P}
|
|
${Ky({host:t,section:n})}
|
|
`}
|
|
</div>
|
|
`}function Gy(e,t,n){return n?F`
|
|
<div class="sidebar-session-pagination sidebar-session-pagination--roster">
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-pagination__button"
|
|
aria-label=${W(`chat.selectors.loadMoreRosterSessions`)}
|
|
@click=${()=>{e.loadMoreSidebarSessions().then(()=>{for(let n of t)e.setVisibleSessionLimit(n.id,n.visibleLimit+10)})}}
|
|
>
|
|
${W(`chat.selectors.loadMoreRosterSessions`)}
|
|
</button>
|
|
</div>
|
|
`:P}function Ky(e){let{host:t,section:n}=e,r=n.visibleRowCount<n.totalRowCount,i=n.visibleRowCount>30&&n.visibleRowCount>n.collapsedVisibleRowCount;return!r&&!i?P:F`
|
|
<div class="sidebar-session-pagination">
|
|
${r?F`<button
|
|
type="button"
|
|
class="sidebar-session-pagination__button"
|
|
aria-label=${W(`chat.selectors.loadMoreSessions`)}
|
|
@click=${()=>{t.setVisibleSessionLimit(n.id,n.visibleLimit+10)}}
|
|
>
|
|
${W(`chat.selectors.loadMoreSessions`)}
|
|
</button>`:P}
|
|
${i?F`<button
|
|
type="button"
|
|
class="sidebar-session-pagination__button"
|
|
aria-label=${W(`usage.details.collapse`)}
|
|
@click=${()=>{t.clearSessionSelection(),t.setVisibleSessionLimit(n.id,10)}}
|
|
>
|
|
${W(`usage.details.collapse`)}
|
|
</button>`:P}
|
|
</div>
|
|
`}function qy(e){let{host:t,snapshot:n,catalog:r,renderer:i}=e,a=t.readNewSessionAccess(),o=t.readSessionMutationAccess({method:`sessions.groups.put`,requiredScope:`operator.write`});return F`
|
|
${i({catalogs:[r],connected:t.connected,basePath:n.basePath,routeSessionKey:n.routeSessionKey,newSessionAgentId:n.newSessionAgentId,mainKey:n.mainKey,collapsedSections:t.collapsedSessionSections,loadingMoreCatalogIds:n.loadingMoreCatalogIds,projectGrouping:n.projectGrouping,liveRows:n.liveRows,ownerId:n.ownerId,renderLiveRow:(e,r)=>zy({host:t,session:n.toSidebarSession(e),display:r}),onToggleSection:e=>t.toggleSection(e),draggingSectionId:t.sessionOrganizer.draggingSidebarSection,sectionDropTarget:t.sessionOrganizer.sidebarSectionDropTarget,onSectionDragOver:(e,n)=>t.sectionDragOver(e,n),onSectionDragLeave:(e,n)=>t.sectionDragLeave(e,n),onSectionDrop:(e,n)=>t.sectionDrop(e,n),onStartSectionDrag:e=>t.startSidebarSectionDrag(e),onFinishSectionDrag:()=>t.finishSidebarSectionDrag(),viewMenuOpenCatalogId:t.sidebarMenus.catalogViewMenuPosition?.catalogId??null,ownerFilterActive:t.sessionOwnerFilterActive,onOpenViewMenu:(e,n,r)=>{if(r){t.sidebarMenus.openCatalogViewMenu(e,r.x,r.y,n);return}t.sidebarMenus.toggleCatalogViewMenu(e,n)},onLoadMore:e=>void t.sessionData.loadMoreSessionCatalog(e),onOpenNewSession:(e,n)=>t.requestOpenNewSession(e,n),newSessionDisabledReason:a.allowed?void 0:a.reason,sectionDragDisabledReason:o.allowed?void 0:o.reason,onNavigate:t.onNavigate,catalogOpenTarget:n.catalogOpenTarget,terminalAvailable:n.terminalAvailable,onOpenTerminal:vy,onOpenMenu:(e,n,r,i)=>t.openCatalogMenu(e,n,r,i),onCatalogMenuTriggerRendered:(e,n)=>t.retargetCatalogMenuTrigger(e,n),isMenuOpen:e=>t.sidebarMenus.catalogMenu.isOpenFor(e)})}
|
|
`}function Jy(e){let{host:t}=e,n=new Map(e.catalogs.catalogs.map(e=>[`catalog:${e.id}`,e]));return F`
|
|
${Rn(e.sections,e=>e.id,r=>{if(r.id.startsWith(`catalog:`)){let i=n.get(r.id);return i&&e.catalogRenderer?qy({host:t,snapshot:e.catalogs,catalog:i,renderer:e.catalogRenderer}):P}return r.id===`work`?r.totalRowCount===0?P:Wy({host:t,section:r}):r.id===`ungrouped`&&r.totalRowCount===0&&!e.nativeSessionsHaveMore&&!t.sessionOwnershipVisible&&t.sessionsStatusFilter===`active`&&t.sessionOrganizer.draggingSessionKey===null?P:Wy({host:t,section:r})})}
|
|
`}function Yy(e){let t=e.readNewSessionAccess(),n=e.sessionOwnerFilterActive||e.sessionsStatusFilter!==`active`;return F`
|
|
<div class="sidebar-session-toolbar">
|
|
<span class="sidebar-recent-sessions__label-text">${W(`chat.sidebar.threads`)}</span>
|
|
<button
|
|
type="button"
|
|
class="sidebar-session-toolbar__button sidebar-session-sort ${n?`sidebar-session-sort--filtered`:``}"
|
|
title=${W(`chat.sidebar.sortSessions`)}
|
|
aria-label=${W(`chat.sidebar.sortSessions`)}
|
|
aria-haspopup="menu"
|
|
aria-expanded=${String(e.sidebarMenus.sessionSortMenuPosition!==null)}
|
|
@click=${t=>e.sidebarMenus.toggleSessionSortMenu(t.currentTarget)}
|
|
>
|
|
${H.listFilter}
|
|
</button>
|
|
${bi({basePath:e.basePath,agentId:e.expandedAgentId(),className:`sidebar-session-toolbar__button sidebar-new-session`,label:W(`chat.runControls.newSession`),disabledReason:t.allowed?void 0:t.reason,onOpen:(t,n)=>e.requestOpenNewSession(t,n)})}
|
|
</div>
|
|
`}function Xy(e){let{host:t}=e,n=t.mainSessionRow()?.key;return F`
|
|
<section
|
|
class="sidebar-sessions ${t.sessionOrganizer.sessionListRemovalDrop?`sidebar-sessions--removal-drop`:``}"
|
|
@dragover=${e=>t.handleSessionListDragOver(e)}
|
|
@dragleave=${e=>t.handleSessionListDragLeave(e)}
|
|
@drop=${e=>t.handleSessionListDrop(e)}
|
|
>
|
|
${Yy(t)}
|
|
${n?By(t,n):P}
|
|
${t.sessionData.sessionMutationError?F`
|
|
<div
|
|
class="sidebar-session-error callout danger callout--dismissible"
|
|
role="alert"
|
|
data-sidebar-session-error
|
|
>
|
|
<span class="callout__content">${t.sessionData.sessionMutationError}</span>
|
|
<openclaw-tooltip .content=${W(`chat.actions.dismissError`)}>
|
|
<button
|
|
class="callout__dismiss"
|
|
type="button"
|
|
@click=${()=>t.dismissSessionMutationError()}
|
|
aria-label=${W(`chat.actions.dismissError`)}
|
|
>
|
|
${H.x}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
</div>
|
|
`:P}
|
|
<div class="sidebar-recent-sessions">
|
|
${Jy({host:t,sections:e.sections,nativeSessionsHaveMore:e.nativeSessionsHaveMore,catalogs:e.catalogs,catalogRenderer:e.catalogRenderer})}
|
|
${Gy(t,e.sections,e.nativeSessionsHaveMore)}
|
|
${t.sessionsStatusFilter===`archived`&&e.empty?F`<span class="sidebar-session-empty-hint"
|
|
>${W(`sessionsView.noArchivedSessions`)}</span
|
|
>`:P}
|
|
</div>
|
|
</section>
|
|
`}function Zy(){return(Zy=t((()=>{I(),Vn(),V(),by(),Uy(),rf(),G(),U(),Di()})))()}function Qy(e){let t=new CustomEvent(rb,{cancelable:!0,detail:e});return globalThis.dispatchEvent(t),t.defaultPrevented}function $y(e,t){let n={},r=e.activeRouteId,i=e.sessionKey;ab.set(e,n);let a={...t,commit:()=>!e.isConnected||e.activeRouteId!==r||e.sessionKey!==i||ab.get(e)!==n?!1:(ab.delete(e),t.commit())};Qy(a)||a.commit()}function eb(e,t,n){let{client:r,hello:i}=e.snapshot,a={pathname:t,sessionKey:n,client:r,hello:i};ib.set(e,a),globalThis.setTimeout(()=>{ib.get(e)===a&&ib.delete(e)},nb)}function tb(e,t){let n=ib.get(e);if(!n||n.pathname!==t)return;ib.delete(e);let{client:r,hello:i}=e.snapshot;if(n.client===r&&n.hello===i)return n.sessionKey}var nb,rb,ib,ab;function ob(){return(ob=t((()=>{nb=2e3,rb=`openclaw:session-navigation-intent`,ib=new WeakMap,ab=new WeakMap})))()}var Y;function sb(){return(sb=t((()=>{Ki(),R(),Vr(),pr(),Hr(),_e(),ob(),Se(),O(),M(),Y=class extends xt{constructor(...e){super(...e),this.basePath=``,this.activePluginTabId=``,this.activeWorkboardBoardId=``,this.connected=!1,this.offline=!1,this.restartPending=!1,this.queuedOutboxCount=0,this.lastError=null,this.outboxAttentionCountForSession=e=>0,this.hasSessionDraft=()=>!1,this.terminalAvailable=!1,this.catalogOpenTarget=`viewer`,this.canPairDevice=!1,this.preferencesBrowserOnly=!1,this.sessionKey=``,this.sidebarEntries=Dr,this.workboardBoards=[],this.workboardBoardsReady=!1,this.sidebarLiveActivity=!0,this.pinnedAgentIds=[],this.themeMode=`system`,this.lobsterPetVisits=!0,this.lobsterPetSounds=!1,this.gatewayVersion=null,this.devGitBranch=null,this.watchUpdateProgress=void 0}setApplicationSession(e,t){let n=this.context;n&&Br({selection:n.agentSelection,gateway:n.gateway,sessionKey:e,agentId:E(e)?.agentId??t})}prepareSessionNavigation(e,t){this.context&&eb(this.context.gateway,t,e)}bindLiteralSession(e,t,n){new URLSearchParams(n.search??``).has(`__openclawSessionKey`)||this.setApplicationSession(e,t)}sessionMainKey(){return Bt({agentsList:this.context?.agents.state.agentsList,hello:this.context?.gateway.snapshot.hello})}readNewSessionAccess(){return nt(this.connected?this.context?.gateway.snapshot:null,{method:`sessions.create`,params:{}})}readSessionMutationAccess(e){return nt(this.connected?this.context?.gateway.snapshot:null,e)}requestOpenNewSession(e,t){this.readNewSessionAccess().allowed&&(t?this.onOpenNewSession?.(e,t):this.onOpenNewSession?.(e))}},S([z({attribute:!1})],Y.prototype,`basePath`,void 0),S([z({attribute:!1})],Y.prototype,`activeRouteId`,void 0),S([z({attribute:!1})],Y.prototype,`activePluginTabId`,void 0),S([z({attribute:!1})],Y.prototype,`activeWorkboardBoardId`,void 0),S([z({attribute:!1})],Y.prototype,`enabledRouteIds`,void 0),S([z({attribute:!1})],Y.prototype,`connected`,void 0),S([z({attribute:!1})],Y.prototype,`offline`,void 0),S([z({attribute:!1})],Y.prototype,`restartPending`,void 0),S([z({attribute:!1})],Y.prototype,`queuedOutboxCount`,void 0),S([z({attribute:!1})],Y.prototype,`lastError`,void 0),S([z({attribute:!1})],Y.prototype,`outboxAttentionCountForSession`,void 0),S([z({attribute:!1})],Y.prototype,`hasSessionDraft`,void 0),S([z({attribute:!1})],Y.prototype,`terminalAvailable`,void 0),S([z({attribute:!1})],Y.prototype,`catalogOpenTarget`,void 0),S([z({attribute:!1})],Y.prototype,`canPairDevice`,void 0),S([z({attribute:!1})],Y.prototype,`preferencesBrowserOnly`,void 0),S([z({attribute:!1})],Y.prototype,`sessionKey`,void 0),S([z({attribute:!1})],Y.prototype,`sidebarEntries`,void 0),S([z({attribute:!1})],Y.prototype,`workboardBoards`,void 0),S([z({attribute:!1})],Y.prototype,`workboardBoardsReady`,void 0),S([z({attribute:!1})],Y.prototype,`workboardRenderers`,void 0),S([z({attribute:!1})],Y.prototype,`sidebarLiveActivity`,void 0),S([z({attribute:!1})],Y.prototype,`pinnedAgentIds`,void 0),S([z({attribute:!1})],Y.prototype,`themeMode`,void 0),S([z({attribute:!1})],Y.prototype,`lobsterPetVisits`,void 0),S([z({attribute:!1})],Y.prototype,`lobsterPetSounds`,void 0),S([z({attribute:!1})],Y.prototype,`gatewayVersion`,void 0),S([z({attribute:!1})],Y.prototype,`devGitBranch`,void 0),S([z({attribute:!1})],Y.prototype,`watchUpdateProgress`,void 0),S([z({attribute:!1})],Y.prototype,`onOpenApprovals`,void 0),S([z({attribute:!1})],Y.prototype,`onRetryConnect`,void 0),S([z({attribute:!1})],Y.prototype,`onOpenNewSession`,void 0),S([z({attribute:!1})],Y.prototype,`onUpdateSidebarEntries`,void 0),S([z({attribute:!1})],Y.prototype,`onPairMobile`,void 0),S([z({attribute:!1})],Y.prototype,`onNavigate`,void 0),S([z({attribute:!1})],Y.prototype,`onPreloadRoute`,void 0),S([Hi({context:Wr,subscribe:!0})],Y.prototype,`context`,void 0)})))()}function cb(e){let t=t=>{let n=e.archiveVisibility(t);return e.deletionState(t,e.selectedAgentId)||n===`pending`||e.statusFilter===`active`&&n===`archived`},n=r(e.selectedAgentId),i=(n===r(e.sessionData.sessionsAgentId??``)?e.sessionData.sessionsResult?.sessions??[]:e.sessionData.sessionResultsByAgent[n]?.sessions??[]).filter(e=>!t(e.key));return{childSessionRowsByParent:Object.fromEntries(Object.entries(e.sessionData.childSessionRowsByParent).map(([e,n])=>[e,n.filter(e=>!t(e.key))])),isSessionHidden:t,rows:i}}function lb(){return(lb=t((()=>{O()})))()}function ub(e,t,n,r=new Set,i=[],a=!1,o=!1,s=!1){let c=new Set(t.map(e=>e.key)),l=new Set(n),u=new Set(i.map(e=>e.id)),d=new Set,f=[],p=[];for(let t of e){let e=Lr(t);if(!e)continue;let n=Er(e);if(!d.has(n)){if(e.type===`route`){if(e.route===`workboard`){d.add(n),p.push(n),s&&f.push(e);continue}if(!l.has(e.route))continue;d.add(n),f.push(e),p.push(n);continue}if(e.type===`workboard`){if(d.add(n),p.push(n),!a||!o)continue;if(!u.has(e.boardId)){p.pop();continue}f.push(e);continue}if(c.has(e.key)){d.add(n),f.push(e),p.push(n);continue}r.has(e.key)||(d.add(n),p.push(n))}}for(let e of t){let t={type:`session`,key:e.key},n=Er(t);d.has(n)||(d.add(n),f.push(t),p.push(n))}return{entries:f,sidebarEntries:p}}function db(){return(db=t((()=>{Vr()})))()}function fb(e){return!e||!oa(e.state)?null:{method:`sessions.reclaim`,requiredScope:`operator.write`,blocksActiveRun:e.state===`active`}}async function pb(e,t){await e.request(`sessions.reclaim`,{key:t.key,...t.agentId?{agentId:t.agentId}:{}},{timeoutMs:6e5})}function mb(){return(mb=t((()=>{pa()})))()}function hb(e,t,n){return e.knownSessionAttention().find(e=>j(e.sessionKey,t))?.attention??(n?e.resolveSessionAttention(n):Xf)}function gb(e){let{a:t,b:n}=e;if(e.sortMode!==`people`)return e.sortMode===`updated`?me(t,n):_b(t,n,e.createdOrder);let r=e.owners??[],i=t.owner?.actor,a=n.owner?.actor,o=i?.id?.trim()??``,s=a?.id?.trim()??``;if(o!==s){let e=r.find(e=>e.id===o),t=r.find(e=>e.id===s),n=e?.label?.trim()||i?.label?.trim()||o,c=t?.label?.trim()||a?.label?.trim()||s,l=n.localeCompare(c)||o.localeCompare(s);if(l!==0)return l}return _b(t,n,e.createdOrder)}function _b(e,t,n){let r=typeof e.createdAt==`number`&&Number.isFinite(e.createdAt)&&e.createdAt>=0?e.createdAt:null,i=typeof t.createdAt==`number`&&Number.isFinite(t.createdAt)&&t.createdAt>=0?t.createdAt:null;if(r!==null||i!==null){if(r===null)return 1;if(i===null)return-1;let e=i-r;if(e!==0)return e}return(n.get(e.key)??2**53-1)-(n.get(t.key)??2**53-1)||e.key.localeCompare(t.key)}function vb(e,t){return e.visibility===`draft`&&(e.sharingRole===`owner`||!!(t&&e.createdActor?.id===t))}function yb(e){let{context:t}=e,n=t?Bt({agentsList:t.agents.state.agentsList,hello:t.gateway.snapshot.hello}):void 0,r=Zt({result:e.sessionsResult,activeSession:e.activeSession,resultAgentId:e.sessionsAgentId,sessionKey:e.routeSessionKey,assistantAgentId:t?.agentSelection.state.selectedId??t?.gateway.snapshot.assistantAgentId,hello:t?.gateway.snapshot.hello,showCron:e.showCron,showSystem:e.showSystem,archivedFilter:e.statusFilter,compareSessions:e.compareSessions});return{routeSessionKey:r.currentSessionKey,selectedAgentId:r.selectedAgentId,activeRowKey:r.activeRowKey,visibleSessionRows:r.visibleSessions,toSidebarSession:(i,a=!1)=>{let o=mn(i.key,i.channel),s=i.runtimeSampledAt;return i.runtimeMs!=null&&s==null&&(s=e.runtimeSampledAtByRow.get(i),s??(s=Date.now(),e.runtimeSampledAtByRow.set(i,s))),{key:i.key,sessionId:i.sessionId,displayName:i.displayName,incognito:i.incognito===!0,createdActor:i.createdActor,owner:i.owner,participants:i.participants,participantCount:i.participantCount,archivedBy:i.archivedBy,label:$e(i.key,i,{includeSubagentPrefix:!1}),userLabel:i.label,subtitle:Ce(i),workContext:De(i),href:zt({face:Ht(i),sessionKey:i.key,fallbackAgentId:r.selectedAgentId,basePath:t?.basePath??``,row:i,mainKey:n,preferenceDerivedFace:!0}).href,active:i.key===r.activeRowKey,visuallyActive:e.highlightCurrentSession&&i.key===r.currentSessionKey,hasActiveRun:i.archived!==!0&&We(i),gatewayHasActiveRun:i.hasActiveRun,activeRunIds:i.archived===!0?void 0:i.activeRunIds,modelSelectionLocked:i.modelSelectionLocked===!0,kind:i.kind,pinned:i.pinned===!0,archived:i.archived===!0,visibility:i.visibility,draftOwnedBySelf:vb(i,t?.gateway.snapshot.selfUser?.id),category:w(i.category),icon:w(i.icon),color:w(i.color),channelAvatarUrl:w(i.channelAvatarUrl),boardFace:i.boardFace,channel:o.channel,channelSession:o.channelSession,workSession:!!(i.worktree||i.execNode)||t?.sessions.isPreparedWorkSession(i.key)===!0,acpSession:gn(i.key),worktreeId:i.worktree?.id,execNode:i.execNode,placementState:i.placement?.state,placementProviderId:i.placement&&`providerId`in i.placement?i.placement.providerId:void 0,placementProfileId:i.placement&&`profileId`in i.placement?i.placement.profileId:void 0,diskSpaceStatus:i.placement?.state===`active`?i.placement.diskSpace?.status:void 0,workspaceConflictCount:i.placement&&`workspaceResultConflict`in i.placement&&Math.max(i.placement.workspaceResultConflict?.paths.length??0,i.placement.workspaceResultConflict?.totalCount??0)||void 0,cloudWorkerStopAction:fb(i.placement),hasAutomation:i.hasAutomation===!0,pullRequest:t?.sessions.pullRequestSummary(i.key),outboxAttentionCount:e.outboxAttentionCountForSessionKey(i.key),hasComposerDraft:e.hasSessionDraft(i.key),unread:i.archived!==!0&&i.unread===!0,lastMessagePreview:w(i.lastMessagePreview),lastReadAt:i.lastReadAt,attention:i.archived===!0?Xf:e.resolveAttention(i),agentStatusNote:e.resolveAgentStatusNote(i),observerDigest:i.observerDigest,spawnedBy:i.spawnedBy,forkSource:i.forkSource,status:i.status,createdAt:i.createdAt,startedAt:i.startedAt,updatedAt:i.updatedAt,endedAt:i.endedAt,runtimeMs:i.runtimeMs,runtimeSampledAt:s,childSessionKeys:i.archived===!0?[]:i.childSessions??[],children:[],isChild:a,loadingChildren:e.loadingChildSessionKeys.has(i.key),containsActiveDescendant:!1,runningChildCount:0,failedChildCount:0}}}}function bb(e){let t=e.rows.filter(e=>e.pinned),n=new Set(e.rows.filter(e=>!e.pinned).map(e=>e.key));return{...ub(e.sidebarEntries,t,qr,n,e.workboardBoards,e.enabledRouteIds?.includes(`workboard`)??!0,e.workboardBoardsReady,e.controlUiTabs?.some(e=>e.placement===`route:workboard`)===!0),sessionRows:new Map(t.map(e=>[e.key,e])),workboardRows:new Map(e.workboardBoards.map(e=>[e.id,e]))}}function xb(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),{selectedKeys:n,anchor:n.has(t)?t:null}}function Sb(e){let t=e.anchor??e.rows.find(e=>e.visuallyActive||e.active)?.key??e.key,n=e.rows.findIndex(e=>e.key===t),r=e.rows.findIndex(t=>t.key===e.key);if(n===-1||r===-1)return{selectedKeys:new Set([e.key]),anchor:e.key};let[i,a]=n<=r?[n,r]:[r,n];return{selectedKeys:new Set(e.rows.slice(i,a+1).map(e=>e.key)),anchor:t}}function Cb(e){let t=r(e.agentId),n=t===r(e.sessionsAgentId??``)?e.sessionsResult?.sessions??[]:e.sessionResultsByAgent[t]?.sessions??[];return un(n,{agentId:t,defaultAgentId:e.defaultAgentId,filterByAgent:!0,archivedFilter:`active`}).reduce((e,t)=>e!==null&&me(e,t)<=0?e:t,null)}function wb(e){let t=new Map(e.identities.map(e=>[e.agentId,e]));return{activeId:e.activeId,agent:e.roster.find(t=>r(t.id)===e.activeId),agents:Pe(e.roster),identity:t.get(e.activeId)??null,identities:t}}function Tb(e){return Cb({agentId:e.agentId,sessionsAgentId:e.sessionData.sessionsAgentId,sessionsResult:e.sessionData.sessionsResult,sessionResultsByAgent:e.sessionData.sessionResultsByAgent,defaultAgentId:Be({agentsList:e.context?.agents.state.agentsList,hello:e.context?.gateway.snapshot.hello})})}function Eb(e){return[...new Map([...Object.values(e.childRowsByParent).flat(),...e.rows].map(e=>[e.key,e])).values()]}function Db(e){return e.rows.filter(t=>{let n=qe(t);return n!=null&&e.mainSessionKeys.has(n)&&!e.scopedRootKeys.has(t.key)&&!t.archived&&(e.showCron||!Ye(t.key))&&(e.showSystem||!Rt(t))})}function Ob(e){let t=new Set(e.scopedRoots.map(e=>e.key));return e.rows.filter(n=>!t.has(n.key)&&w(n.category)!=null&&qe(n)!=null&&Dt(n,e.visibilityOptions))}function kb(e,t,n){return e?.key??Ft({agentId:t,mainKey:n})}function Ab(e){return e&&We(e)?W(`agentChip.working`):e?$e(e.key,e):W(`agentChip.ready`)}function jb(e){if(e.hasLoaded)return[...e.loadedCatalogIds];let t=e.sectionOrder.flatMap(e=>e.startsWith(`catalog:`)?[e.slice(8)]:[]);return[...new Set([...e.loadedCatalogIds,...t])]}function Mb(e){let t={agentsList:e.agentsList,hello:e.hello};return Je(t)?w(Ut(t)?.mainSessionKey)??`global`:Ft({agentId:e.agentId,mainKey:Bt(t)})}function Nb(e,t){return e.find(e=>j(e.key,t))??null}function Pb(e,t){return af(e,t)}function Fb(e,t){let n=[...e];for(;n.length>0;){let e=n.pop();if(e){if(t(e))return!0;n.push(...e.children)}}return!1}function Ib(e){let t=e.navigationState.visibleSessionRows.find(t=>t.key===e.sessionKey);if(t)return e.navigationState.toSidebarSession(t);for(let t of Object.values(e.sessionResultsByAgent)){let n=t.sessions.find(t=>t.key===e.sessionKey);if(n)return e.navigationState.toSidebarSession(n)}}function Lb(e){let t=e.ownerFacet??[],n=e.self?.id,r=n?Ih({facet:t,self:e.self}).find(e=>e.type===`human`&&e.id===n):void 0,i=r?[r,...t.filter(e=>e.id!==r.id)]:t,a=i.length<2&&Fb(e.projected,e=>(e.participantCount??0)>0),o=i.length>=2||a,s=e.selectedOwnerId?.trim()||null,c=s&&(e.ownerFacet===void 0||i.some(e=>e.id===s))?s:null;if(!c)return{rows:e.projected,ownerOptions:i,ownershipVisible:o,activeOwnerId:c};let l=e=>{let t=[];for(let n of e){let e=l(n.children);if(n.owner?.actor.id===c)t.push({...n,children:e});else for(let n of e)t.push({...n,isChild:!1})}return t};return{rows:l(e.projected),ownerOptions:i,ownershipVisible:o,activeOwnerId:c}}function Rb(){return(Rb=t((()=>{Vr(),V(),an(),_n(),bf(),ze(),Se(),O(),db(),G(),mb(),Hh()})))()}function zb(e,t){return[e.activeSessionLineageSelectedRow,e.activeSessionLineageRoot,...Object.values(e.childSessionRowsByParent).flat()].find(e=>e!=null&&j(e.key,t))}function Bb(e,t){let n=e.getSessionNavigationState(),r=zb(e.sessionData,t),i=Ib({sessionKey:t,navigationState:n,sessionResultsByAgent:e.sessionData.sessionResultsByAgent})??(r?n.toSidebarSession(r,!0):void 0);return Ld({catalogs:e.visibleSessionCatalogs(),sessionKey:t,liveRow:i})}function Vb(e){if(e.adopted.size===0)return e.rows;let t=new Map(e.rows.map(e=>[e.key,e])),n=[...e.sessionsResult?.sessions??[],...Object.values(e.sessionResultsByAgent).flatMap(e=>e.sessions)];for(let r of n)e.adopted.has(r.key)&&!t.has(r.key)&&t.set(r.key,e.navigationState.toSidebarSession(r));return[...t.values()]}function Hb(){return(Hb=t((()=>{O(),Hd(),Rb()})))()}function Ub(){let e=null,t=Wb,n=()=>{e!==null&&(globalThis.clearTimeout(e),e=null)};return{cancel:n,reset(){n(),t=Wb},schedule(r){n();let i=t;t=Math.min(t*2,Gb),e=globalThis.setTimeout(()=>{e=null,r()},i)}}}var Wb,Gb;function Kb(){return(Kb=t((()=>{Wb=3e4,Gb=3e5})))()}function qb(e,t){let n=e.find(({state:e})=>e===`open`)??e.find(({state:e})=>e===`draft`)??e.find(({state:e})=>e===`merged`)??e[0];if(!n)return;let r=[...new Set(e.map(e=>e.number))].slice(0,20).toSorted((e,t)=>e-t);return t?.state===n.state&&t.numbers.join(`,`)===r.join(`,`)?t:{numbers:r,state:n.state}}function Jb(e,t){let n=e.trim();return!n||E(n)||!t?.trim()?n:`agent:${r(t)}:${n}`}function Yb(e){if(!e||typeof e!=`object`||!(`sessions`in e))return null;let t=e.sessions;return y(t)}function Xb(e){let t=new Map,n=new WeakMap,r=new Map,i=new Set,a=new Map,o=new Set,s=Ub(),c=He(e.snapshot),l=null,u=null,d=0,f=!1,p=0,m=!1,h=null,g=null,_=null,v=()=>{for(let e of Array.from(i))e()},b=(e,t)=>{let n=a.get(e);if(n){a.delete(e);for(let e of n)e(t)}},x=()=>{let e=new Map;for(let n of t.values())for(let t of n.keys)e.set(t,(e.get(t)??!1)||n.foreground);return[...e].toSorted(([e,t],[n,r])=>Number(r)-Number(t)||e.localeCompare(n)).slice(0,200).map(([e])=>e)},S=()=>{let e=new Set(x());for(let t of o)e.has(t)||o.delete(t);for(let t of a.keys())e.has(t)||b(t);for(let t of r.keys())e.has(t)||r.delete(t)},C=()=>t.size>0||i.size>0||a.size>0,ee=()=>{d+=1,l=null,u=null;let e=r.size>0;r.clear();for(let e of a.keys())b(e);e&&v()},te=e=>{let t=c.transition(e);t&&ee(),(t||e.hello!==l)&&(s.reset(),oe())},w=t=>{if(t.event===`sessions.changed`){let n=Me(t.payload),i=y(t.payload)?.reason;if(!n||!$b.has(i))return;let a=x().filter(t=>ve({assistantAgentId:e.snapshot.assistantAgentId,hello:e.snapshot.hello,sessionKey:t},n.key,n.agentId));if(a.length===0)return;let c=!1;for(let e of a)c=r.delete(e)||c,o.add(e);s.reset(),c&&v(),oe();return}if(t.event!==`controlUi.sessionPullRequests.changed`)return;let n=Yb(t.payload);if(!n)return;let i=new Set(x());for(let[e,t]of Object.entries(n)){if(!i.has(e))continue;let n=r.get(e),a=t;n&&t.status===`rate-limited`&&t.pullRequests.length===0?a={...t,pullRequests:n.pullRequests,branch:t.branch??n.branch}:n&&t.status===`unavailable`&&(n.pullRequests.length>0||n.branch!==void 0)&&(a={...n,status:`unavailable`}),r.set(e,a),b(e,a)}v()},ne=()=>{s.reset(),oe()},re=()=>{m||(m=!0,c.transition(e.snapshot)&&ee(),l=null,u=null,h=e.subscribe(te),g=e.subscribeEvents(w),typeof document<`u`&&(document.addEventListener(`visibilitychange`,ne),_=document))},ie=()=>{m&&(m=!1,h?.(),h=null,g?.(),g=null,_?.removeEventListener(`visibilitychange`,ne),_=null,s.reset(),d+=1,p+=1,f=!1,l=null,u=null,r.clear())};function ae(){if(f=!1,!m)return;let t=e.snapshot,n=t.client;if(t.phase!==`connected`||n===null||t.hello===null||Na(t,`controlUi.sessionPullRequests.subscribe`)!==!0){l=null,u=null;for(let e of a.keys())b(e);C()||ie();return}let r=typeof document<`u`&&document.visibilityState===`hidden`?[]:x(),i=new Set(r),c=[...o].filter(e=>i.has(e)),p=JSON.stringify(r.toSorted());if(t.hello===l&&p===u&&c.length===0){C()||ie();return}l=t.hello,u=p;let h=++d,g=()=>m&&C()&&h===d&&t.hello===l&&p===u;s.cancel();let _=n.request(Qb,{sessionKeys:r,...c.length>0?{refreshSessionKeys:c}:{}});C()||ie(),_.then(()=>{if(g()){for(let e of c)o.delete(e);s.reset()}}).catch(()=>{if(g()){u=null,s.schedule(()=>{m&&C()&&oe()});for(let e of r)b(e)}})}function oe(){if(!m||f)return;f=!0;let e=p;globalThis.queueMicrotask(()=>{e===p&&ae()})}let se=(e,n,r={})=>{let i=C(),a=new Set(n.map(e=>e.trim()).filter(Boolean)),o=t.get(e);(o===void 0?a.size===0:o.keys.size===a.size&&o.foreground===(r.foreground===!0)&&[...a].every(e=>o.keys.has(e)))||(a.size===0?t.delete(e):t.set(e,{keys:a,foreground:r.foreground===!0}),s.reset(),S(),C()?(i||(l=null,u=null),re(),oe()):m&&ae())};return{watch:se,unwatch:e=>{n.delete(e),se(e,[])},load:async(i,o)=>{let s=o.trim();if(!s)return;let c={};n.set(i,c),se(i,[s],{foreground:!0});try{return r.get(s)||(e.snapshot.phase!==`connected`||Na(e.snapshot,`controlUi.sessionPullRequests.subscribe`)!==!0?void 0:await new Promise(e=>{let t=a.get(s)??new Set;t.add(e),a.set(s,t),oe()}))}finally{let e=t.get(i);n.get(i)===c&&e?.keys.size===1&&e.keys.has(s)&&(n.delete(i),se(i,[]))}},refresh:e=>{let t=e.trim();!t||!x().includes(t)||(o.add(t),s.reset(),oe())},get:e=>r.get(e),subscribe:e=>{let t=C();return i.add(e),t||(l=null,u=null),re(),()=>{i.delete(e)&&(C()?oe():m&&ae())}}}}function Zb(e){let t=ex.get(e);if(t)return t;let n=Xb(e);return ex.set(e,n),n}var Qb,$b,ex;function tx(){return(tx=t((()=>{Jo(),Fa(),Kb(),Fe(),O(),Qb=`controlUi.sessionPullRequests.subscribe`,$b=new Set([`new`,`reset`,`branch-switch`,`fork`,`rewind`]),ex=new WeakMap})))()}var nx;function rx(){return(rx=t((()=>{Fa(),tx(),O(),nx=class{constructor(e,t){this.host=e,this.options=t,this.states=new Map,this.gateway=null,this.client=null,this.agentId=null,this.store=null,this.stopStoreUpdates=null,this.connected=!1,this.refreshScheduled=!1,e.addController(this)}hostConnected(){this.connected=!0}hostUpdated(){this.scheduleRefresh()}hostDisconnected(){this.connected=!1,this.releaseStore(),this.reset(!1)}summary(e,t,n){let r=this.states.get(e);return r?.worktreeId===t?r.summary:n}scheduleRefresh(){this.refreshScheduled||(this.refreshScheduled=!0,globalThis.setTimeout(()=>{this.refreshScheduled=!1,this.connected&&this.refreshVisible()},0))}releaseStore(){this.store?.unwatch(this),this.stopStoreUpdates?.(),this.stopStoreUpdates=null,this.store=null,this.gateway=null,this.client=null,this.agentId=null}reset(e){this.states.size!==0&&(this.states.clear(),e&&this.host.requestUpdate())}eligibleRows(){return this.options.getRows().filter(e=>!e.isChild&&e.worktreeId)}scopedKey(e){return Jb(e,E(e)?.agentId??this.options.getSelectedAgentId())}applySnapshots(){let e=this.store;if(!e)return;let t=!1;for(let n of this.eligibleRows()){if(!n.worktreeId)continue;let r=e.get(this.scopedKey(n.key));if(!r){let e=this.states.delete(n.key);if(e){let e=this.options.getSessions();e&&e.setPullRequestSummary(n.key,void 0,e.capturePullRequestEpoch(n.key))}t=e||t;continue}if(r.status!==`ready`&&r.pullRequests.length===0)continue;let i=this.states.get(n.key),a={summary:qb(r.pullRequests,i?.summary),worktreeId:n.worktreeId};(!i||i.summary!==a.summary||i.worktreeId!==a.worktreeId)&&(this.states.set(n.key,a),t=!0)}t&&this.host.requestUpdate()}refreshVisible(){let e=this.options.getGateway();if(!e||!this.options.getConnected()||Na(e.snapshot,`controlUi.sessionPullRequests.subscribe`)!==!0){this.releaseStore(),this.reset(!0);return}e!==this.gateway&&(this.releaseStore(),this.gateway=e,this.store=Zb(e),this.stopStoreUpdates=this.store.subscribe(()=>this.applySnapshots())),e.snapshot.client!==this.client&&(this.client=e.snapshot.client,this.reset(!0));let t=this.options.getSelectedAgentId();t!==this.agentId&&(this.agentId=t,this.reset(!0));let n=this.eligibleRows(),r=new Set(n.map(e=>e.key)),i=!1;for(let e of this.states.keys())r.has(e)||(this.states.delete(e),i=!0);i&&this.host.requestUpdate(),this.store?.watch(this,n.map(e=>this.scopedKey(e.key))),this.applySnapshots()}}})))()}function ix(e){return!!(Bv(e.attention)||e.agentStatusNote||e.hasActiveRun&&e.status===`queued`)}var ax,ox,sx;function cx(){return(cx=t((()=>{bf(),G(),Wv(),Ny(),ax=1e3,ox=2e3,sx=class{constructor(e=()=>Date.now()){this.now=e,this.observedOrder=new Map,this.nextCreatedOrder=0,this.stickySections=new Map,this.childModes=new Map,this.heldSubtitles=new Map,this.previousInput=null,this.previousCollapsedSections=new Set}get createdOrder(){return this.observedOrder}observeRows(e){for(let t of e)for(let{key:e}of t.sessions)e&&!this.observedOrder.has(e)&&this.observedOrder.set(e,this.nextCreatedOrder++);if(this.observedOrder.size<=ax)return;let t=new Set(e.flatMap(e=>e.sessions.map(({key:e})=>e)));for(let e of this.observedOrder.keys()){if(this.observedOrder.size<=ax)break;t.has(e)||this.observedOrder.delete(e)}}promoteCreatedSession(e){let t=this.observedOrder.get(e);if(t===0)return!1;for(let[n,r]of this.observedOrder)n!==e&&(t===void 0||r<t)&&(this.observedOrder.set(n,r+1),this.nextCreatedOrder=Math.max(this.nextCreatedOrder,r+2));return this.observedOrder.set(e,0),this.nextCreatedOrder=Math.max(this.nextCreatedOrder,1),!0}project(e){let t=this.previousInput,n=t!==null&&(t.agentId!==e.agentId||t.connectionIdentity!==e.connectionIdentity||t.listSource!==e.listSource);(n||t!==null&&(t.grouping!==e.grouping||t.sortMode!==e.sortMode||t.statusFilter!==e.statusFilter))&&this.resetMembership(),t!==null&&(t.agentId!==e.agentId||t.connectionIdentity!==e.connectionIdentity)&&this.childModes.clear(),n&&this.heldSubtitles.clear();for(let t of e.collapsedSections)this.previousCollapsedSections.has(t)||this.resetMembership(t);this.previousInput={grouping:e.grouping,sortMode:e.sortMode,statusFilter:e.statusFilter,agentId:e.agentId,connectionIdentity:e.connectionIdentity,listSource:e.listSource},this.previousCollapsedSections=new Set(e.collapsedSections);let r=new Set([...this.childModes.keys(),...this.heldSubtitles.keys()]),i=t=>{r.delete(t.key),t.containsActiveDescendant&&!this.childModes.has(t.key)&&this.childModes.set(t.key,`expanded`),this.observeSubtitle(t,e.subtitle);for(let e of t.children)i(e)};e.rows.forEach(i);for(let e of r)this.childModes.delete(e),this.heldSubtitles.delete(e);let{grouping:a,knownGroups:o,selfOwnerId:s,sectionOrder:c,catalogIds:l}=e,u=hf(e.rows,{grouping:a,knownGroups:o,selfOwnerId:s,sectionOrder:c,catalogIds:l}).filter(t=>t.id!==`pinned`&&!e.hideEmptyOwnerFilteredGroup(t.category,t.rows.length)),d=new Set(u.map(e=>e.id));for(let e of this.stickySections.keys())d.has(e)||this.stickySections.delete(e);let f=e.grouping!==`none`&&u.some(e=>e.id!==`ungrouped`&&(e.id!==`work`||e.rows.length>0)),p=[],m=[],h=[];for(let t of u){let n=t.rows.length,r=t.id!==`ungrouped`||f,i=r&&e.collapsedSections.has(t.id),a=e.visibleSessionLimits.get(t.id)??10,o=t.rows.reduce((e,t)=>e+Number(t.active||t.pinned),0),s=Math.max(o,Math.min(n,10)),c=0;if(!i){p.push(...t.rows);let e=Math.max(0,a-o),n=this.stickySections.get(t.id);t.rows=t.rows.filter(t=>t.active||t.pinned?!0:e>0?(--e,!0):n?.has(t.key)===!0),this.stickySections.set(t.id,new Set(t.rows.map(e=>e.key))),m.push(...t.rows),c=t.rows.length}h.push(Object.assign(t,{totalRowCount:n,visibleRowCount:c,visibleLimit:a,collapsedVisibleRowCount:s,renderHeader:r}))}return{sections:h,expandedRows:p,visibleRows:m}}resetMembership(e){e===void 0?this.stickySections.clear():this.stickySections.delete(e)}isChildrenExpanded(e){let t=this.childModes.get(e);return t===`expanded`||t===`expanded-fully`}isChildrenFullyShown(e){return this.childModes.get(e)===`expanded-fully`}toggleChildren(e){return this.isChildrenExpanded(e.key)?(this.childModes.set(e.key,`collapsed-by-user`),{expanded:!1}):(this.childModes.set(e.key,`expanded`),{expanded:!0})}showMoreChildren(e){this.isChildrenExpanded(e)&&this.childModes.set(e,`expanded-fully`)}resolveSubtitle(e){if(!e.session.hasActiveRun||!e.showPreview)return jy(e);let t=this.heldSubtitles.get(e.session.key);return t?e.hasDisplay?t.catalogValue??jy(e):t.value:jy(e)}observeSubtitle(e,t){if(!e.hasActiveRun||!t.showPreview){this.heldSubtitles.delete(e.key);return}!t.sidebarLiveActivity&&this.heldSubtitles.get(e.key)?.value.narration&&this.heldSubtitles.delete(e.key);let n={session:e,hasDisplay:!1,displaySubtitle:void 0,sidebarLiveActivity:t.sidebarLiveActivity,showPreview:t.showPreview,narrationLine:t.narrationLines.get(e.key),observerDigest:t.observerDigests.get(e.key)??null},r=jy(n);if(!r.subtitle)return;let i=this.heldSubtitles.get(e.key),a=this.now(),o=i!==void 0&&i.value.subtitle!==r.subtitle;if(o&&a-i.shownAt<ox&&!ix(e))return;let s=jy({...n,hasDisplay:!0});this.heldSubtitles.set(e.key,{value:r,...s.subtitle?{catalogValue:s}:{},shownAt:i!==void 0&&!o?i.shownAt:a})}}})))()}function lx(e){let{roots:t,agentRows:n,childRowsByParent:r,loadingChildKeys:i,knownSessionAttention:a,toSidebarSession:o}=e,s=new Map;for(let e of Object.values(r))for(let t of e)s.set(t.key,t);for(let e of n)s.set(e.key,e);let c=new Map,l=e=>typeof e?.category==`string`&&e.category.trim().length>0,u=(e,t)=>{let n=c.get(e)??[];n.includes(t)||(n.push(t),c.set(e,n))};for(let e of s.values())for(let t of e.childSessions??[]){let n=s.get(t);if(l(n))continue;let r=qe(n);(!r||j(r,e.key))&&u(e.key,t)}for(let e of s.values()){let t=qe(e);t&&!l(e)&&u(t,e.key)}let d=(e,t,n)=>{let r=e.archived===!0?[]:c.get(e.key)??[],l=new Set(n);l.add(e.key);let u=r.flatMap(e=>{let t=s.get(e);return t&&!l.has(e)?[d(t,!0,l)]:[]}),f=o(e,t),p=u.reduce((e,t)=>e+ +!!t.hasActiveRun+t.runningChildCount,0),m=Math.max(p,+!!e.hasActiveSubagentRun),h=u.reduce((e,t)=>e+ +(t.status===`failed`||t.status===`timeout`)+t.failedChildCount,0),g=Math.min(2**53-1,(f.workspaceConflictCount??0)+u.reduce((e,t)=>e+(t.workspaceConflictCount??0),0)),_=r.filter(e=>!s.has(e)),v=a.reduce((e,t)=>_.some(e=>j(t.sessionKey,e))&&xf(t.attention)>xf(e)?t.attention:e,Xf),y=u.reduce((e,t)=>Sf(t,Zf.Attention)&&xf(t.attention)>xf(e)?t.attention:e,xf(v)>xf(f.attention)?v:f.attention);return{...f,attention:y,childSessionKeys:r,children:u,loadingChildren:i.has(e.key),containsActiveDescendant:u.some(e=>e.active||e.visuallyActive||e.containsActiveDescendant),workspaceConflictCount:g||void 0,runningChildCount:m,failedChildCount:h}},f=new Set(t.map(e=>e.key));return t.filter(e=>{if(l(e))return!0;let t=qe(e);return!t||!f.has(t)}).map(e=>d(e,!1,new Set))}function ux(){return(ux=t((()=>{O(),G()})))()}function dx(e,t){let n=hx.get(e);n||(n=new Set,hx.set(e,n)),n.add(t)}function fx(e,t){let n=hx.get(e);n&&(n.delete(t),n.size===0&&hx.delete(e))}function px(e,t){let n=hx.get(e);if(!n)return;let r=Array.from(n,e=>({owner:e,generation:e.clientGeneration}));for(let{owner:i,generation:a}of r)n.has(i)&&i.client===e&&i.clientGeneration===a&&i.onQuestionResolution(t)}function mx(e,t,n,r){let i=r===void 0?x:Math.min(x,Math.max(0,r-Date.now()));return e.request(t,n,{timeoutMs:i})}var hx;function gx(){return(gx=t((()=>{ce(),hx=new WeakMap})))()}function _x(e){if(!T(e))return null;let{name:t,kind:n,allowedHosts:r,reason:i}=e;return typeof t!=`string`||!/^[A-Z][A-Z0-9_]{0,127}$/.test(t)||n!==`secret`&&n!==`env`||i!==void 0&&(typeof i!=`string`||i.length>200)||r!==void 0&&(n!==`secret`||!Array.isArray(r)||r.length>128||r.some(e=>typeof e!=`string`||!e||e.length>253)||new Set(r).size!==r.length)?null:{name:t,kind:n,...r===void 0?{}:{allowedHosts:[...r]},...i===void 0?{}:{reason:i}}}function vx(e){if(!T(e))return null;let t=ie(e.updatedAtMs,{min:0}),n=e.updatedBy===void 0?void 0:i(e.updatedBy);return t===void 0||e.updatedBy!==void 0&&!n?null:{updatedAtMs:t,...n?{updatedBy:n}:{}}}function yx(e){if(e.isSecret!==void 0&&typeof e.isSecret!=`boolean`)return null;let t=e.secretStore===void 0?void 0:_x(e.secretStore),n=e.secretStoreExisting===void 0?void 0:vx(e.secretStoreExisting);return t===null||n===null||t&&!e.isSecret||n&&!t?null:{...typeof e.isSecret==`boolean`?{isSecret:e.isSecret}:{},...t?{secretStore:t}:{},...n?{secretStoreExisting:n}:{}}}function bx(e,t){for(let n of e)n.isSecret&&t.delete(n.questionId)}function xx(e,t){if(!T(e))return null;if(e.status===`cancelled`)return{status:`cancelled`};let n=t(e.answers);return e.status===`answered`&&n?{status:`answered`,answers:n}:null}function Sx(e,t,n,r){if(!(`answers`in n))return{requestParams:{id:e,cancel:!0}};let i={answers:Object.fromEntries(Object.entries(n.answers).map(([e,t])=>[e,[...t]]))},a=t[0]?.secretStore?t[0]:void 0,o=a?.secretStore?.kind===`secret`?r===void 0?a.secretStore.allowedHosts:r.split(/[,\s]+/u).map(e=>e.trim()).filter(Boolean):void 0;return{requestParams:{id:e,answers:i,...o===void 0?{}:{secretStoreAllowedHosts:o}},submittedAnswers:a?{answers:{[a.questionId]:[`stored`]}}:i}}function Cx(){return(Cx=t((()=>{ue()})))()}function wx(e){return ie(e,{min:0})??null}function Tx(e){let t=[...new Intl.Segmenter().segment(e)];return t.length<=Zx?e:t.slice(0,Zx).map(e=>e.segment).join(``)}function Ex(e){if(!T(e))return null;let t=i(e.questionId),n=typeof e.header==`string`?e.header:null,r=i(e.question);if(!t||!/^[a-z][a-z0-9_]*$/.test(t)||n===null||!r)return null;let a=Tx(n);if(!Array.isArray(e.options)||e.options.length>4)return null;let o=e.options.flatMap(e=>{if(!T(e))return[];let t=i(e.label);return!t||e.description!==void 0&&typeof e.description!=`string`?[]:[{label:t,...typeof e.description==`string`?{description:e.description}:{}}]});if(o.length!==e.options.length)return null;for(let t of[`multiSelect`,`isOther`])if(e[t]!==void 0&&typeof e[t]!=`boolean`)return null;let s=yx(e);return s?{questionId:t,header:a,question:r,options:o,...e.multiSelect===!0?{multiSelect:!0}:{},...typeof e.isOther==`boolean`?{isOther:e.isOther}:{},...s}:null}function Dx(e){if(!T(e)||!T(e.answers))return null;let t={};for(let[n,r]of Object.entries(e.answers)){if(!/^[a-z][a-z0-9_]*$/.test(n)||!Array.isArray(r)||!r.every(e=>typeof e==`string`))return null;t[n]=[...r]}return{answers:t}}function Ox(e,t){if(!e||!t)return!1;let n=Object.keys(e.answers).toSorted(),r=Object.keys(t.answers).toSorted();return n.length===r.length&&n.every((n,i)=>n===r[i]&&e.answers[n]?.length===t.answers[n]?.length&&e.answers[n]?.every((e,r)=>Object.is(e,t.answers[n]?.[r])))}function kx(e){if(!T(e))return null;let t=i(e.id),n=wx(e.createdAtMs),r=wx(e.expiresAtMs);if(!t||n===null||r===null||!Array.isArray(e.questions)||e.questions.length<1||e.questions.length>3)return null;let a=e.questions.map(Ex);if(a.some(e=>e===null)||new Set(a.map(e=>e?.questionId)).size!==a.length)return null;let o=e.agentId===void 0?void 0:i(e.agentId),s=e.sessionKey===void 0?void 0:i(e.sessionKey),c=e.runId===void 0?void 0:i(e.runId);if(e.agentId!==void 0&&!o||e.sessionKey!==void 0&&!s||e.runId!==void 0&&!c)return null;let l={id:t,questions:a,...o?{agentId:o}:{},...s?{sessionKey:s}:{},...c?{runId:c}:{},createdAtMs:n,expiresAtMs:r};if(e.status===`pending`)return{...l,status:`pending`};if(e.status===`answered`){let t=Dx(e.answers);return t?{...l,status:`answered`,answers:t}:null}return e.status===`cancelled`?{...l,status:`cancelled`}:e.status===`expired`?{...l,status:`expired`}:null}function Ax(e){let t=kx(e);return t?.status===`pending`?t:null}function jx(e){if(!T(e))return null;let t=i(e.id);if(!t)return null;if(e.status===`answered`){let n=Dx(e.answers);return n?{id:t,status:`answered`,answers:n}:null}return e.status===`cancelled`||e.status===`expired`?{id:t,status:e.status}:null}function Mx(e){let t={client:null,ownerClient:null,clientGeneration:0,prompts:new Map,unmatchedResolutions:new Map,revision:0,tickTimer:null,refreshRetryTimer:null,onChange:e,onQuestionResolution:e=>Ix(t,e)};return t}function Nx(e){e.tickTimer||![...e.prompts.values()].some(e=>e.status===`pending`)||(e.tickTimer=globalThis.setTimeout(()=>{e.tickTimer=null;let t=Date.now(),n=!1;for(let r of e.prompts.values())r.status===`pending`&&r.expiresAtMs<=t&&(r.status=`expired`,bx(r.questions,r.drafts),r.locallyExpired=!0,r.submitting=!1,r.error=null,r.revision=++e.revision,n=!0);e.onChange(),(n||[...e.prompts.values()].some(e=>e.status===`pending`))&&Nx(e)},1e3))}function Px(e,t,n){let r=++e.revision,i=n?.drafts??new Map;return t.status!==`pending`&&bx(t.questions,i),{id:t.id,questions:t.questions,...t.agentId?{agentId:t.agentId}:{},...t.sessionKey?{sessionKey:t.sessionKey}:{},...t.runId?{runId:t.runId}:{},createdAtMs:t.createdAtMs,expiresAtMs:t.expiresAtMs,status:t.status,...t.status===`answered`?{answers:t.answers}:{},...n?.submittedAnswers?{submittedAnswers:n.submittedAnswers}:{},answeredElsewhere:t.status===`answered`&&!(n?.localResolutionConfirmed??!1)&&!(n?.submitting??!1),localResolutionConfirmed:n?.localResolutionConfirmed??!1,locallyExpired:!1,submitting:t.status===`pending`||t.status===`answered`&&!(n?.localResolutionConfirmed??!1)?n?.submitting??!1:!1,error:t.status===`pending`?n?.error??null:null,drafts:i,...n?.secretStoreAllowedHostsDraft===void 0?{}:{secretStoreAllowedHostsDraft:n.secretStoreAllowedHostsDraft},revision:r}}function Fx(e,t,n){t.status=n.status,bx(t.questions,t.drafts),t.answers=n.status===`answered`?n.answers:void 0;let r=n.status===`answered`&&Ox(t.submittedAnswers,n.answers);t.answeredElsewhere=n.status===`answered`&&!t.localResolutionConfirmed&&!r&&!t.submitting,t.locallyExpired=!1,(n.status!==`answered`||t.localResolutionConfirmed)&&(t.submitting=!1),t.error=null,t.revision=++e.revision}function Ix(e,t){let n=e.prompts.get(t.id);n?Fx(e,n,t):(e.unmatchedResolutions.set(t.id,t),e.revision+=1),e.onChange()}function Lx(e,t){if(t.event===`question.requested`){let n=Ax(t.payload);if(!n)return!1;let r=e.prompts.get(n.id);if(r&&r.status!==`pending`)return!0;let i=Px(e,n,r),a=e.unmatchedResolutions.get(n.id);return a&&(e.unmatchedResolutions.delete(n.id),Fx(e,i,a)),e.prompts.set(n.id,i),Nx(e),e.onChange(),!0}if(t.event!==`question.resolved`)return!1;let n=jx(t.payload);return n?(Ix(e,n),!0):!1}function Rx(e){if(!T(e)||!Array.isArray(e.questions))return null;let t=e.questions.map(Ax);return t.some(e=>e===null)?null:t}function zx(e){return T(e)?kx(e.question):null}function Bx(e){return e instanceof Jn&&T(e.details)&&e.details.reason===`QUESTION_NOT_FOUND`}function Vx(e,t){t.status=`unavailable`,bx(t.questions,t.drafts),t.answers=void 0,t.answeredElsewhere=!1,t.localResolutionConfirmed=!1,t.locallyExpired=!1,t.submitting=!1,t.error=null,t.revision=++e.revision}async function Hx(e,t,n=()=>e.client===t){let r=e.revision,i=Rx(await mx(t,`question.list`,{}));if(!i||!n())return!1;let a=new Set(i.map(e=>e.id));for(let t of i){let n=e.prompts.get(t.id);if(!n||n.revision<=r||n.locallyExpired){let r=Px(e,t,n),i=e.unmatchedResolutions.get(t.id);i&&(e.unmatchedResolutions.delete(t.id),Fx(e,r,i)),e.prompts.set(t.id,r)}}Nx(e),e.onChange();let o=[...e.prompts.values()].filter(e=>(e.locallyExpired||e.status===`pending`&&e.revision<=r)&&!a.has(e.id)).map(e=>({id:e.id,prompt:e,revision:e.revision})),s=new Set(o.map(e=>e.id));for(let t of e.unmatchedResolutions.keys())!a.has(t)&&!s.has(t)&&(o.push({id:t,prompt:void 0,revision:e.revision}),s.add(t));let c=await Promise.all(o.map(async r=>{let i=await mx(t,`question.get`,{id:r.id}).then(e=>({ok:!0,value:e}),e=>({ok:!1,error:e}));if(!n())return!1;let a=e.prompts.get(r.id);if(r.prompt&&a!==r.prompt)return!!(a&&a.status!==`pending`&&!a.locallyExpired);if(r.prompt&&a?.revision!==r.revision&&!a?.locallyExpired)return a?.status!==`pending`;if(!r.prompt&&!e.unmatchedResolutions.has(r.id))return!0;if(!i.ok)return Bx(i.error)?(a&&Vx(e,a),e.unmatchedResolutions.delete(r.id),e.onChange(),!0):!1;let o=zx(i.value);if(!o)return!1;let s=Px(e,o,a),c=e.unmatchedResolutions.get(r.id);return c&&(e.unmatchedResolutions.delete(r.id),Fx(e,s,c)),e.prompts.set(r.id,s),Nx(e),e.onChange(),!0}));return n()&&c.every(Boolean)}function Ux(e,t,n=()=>e.client===t){let r=e.clientGeneration,i=()=>e.client===t&&e.clientGeneration===r&&n(),a=0,o=async()=>{if(!i())return;let n;try{n=await Hx(e,t,i)}catch{n=!1}if(n||!i())return;let r=Xx[a];a=Math.min(a+1,Xx.length-1),e.refreshRetryTimer=globalThis.setTimeout(()=>{e.refreshRetryTimer=null,o()},r)};o()}function Wx(e,t){if(e.refreshRetryTimer&&=(globalThis.clearTimeout(e.refreshRetryTimer),null),e.client===t)return;e.client&&fx(e.client,e),e.clientGeneration+=1;let n=t!==null&&e.ownerClient!==null&&e.ownerClient!==t;if(e.client=t,t!==null&&(e.ownerClient=t,dx(t,e)),n){let t=e.prompts.size>0||e.unmatchedResolutions.size>0;e.tickTimer&&=(globalThis.clearTimeout(e.tickTimer),null),e.prompts.clear(),e.unmatchedResolutions.clear(),t&&(e.revision+=1,e.onChange());return}t&&Nx(e);let r=!1;for(let t of e.prompts.values())t.submitting&&(t.submitting=!1,t.revision=++e.revision,r=!0);r&&e.onChange()}function Gx(e){e.client&&fx(e.client,e),e.tickTimer&&=(globalThis.clearTimeout(e.tickTimer),null),e.refreshRetryTimer&&=(globalThis.clearTimeout(e.refreshRetryTimer),null),e.clientGeneration+=1,e.client=null}async function Kx(e,t,n){let r=e.prompts.get(t),i=e.client,a=e.clientGeneration;if(!r||r.status!==`pending`||r.submitting)return;if(!i){r.error=W(`chat.questions.disconnected`),r.revision=++e.revision,e.onChange();return}r.submitting=!0;let o=Sx(t,r.questions,n,r.secretStoreAllowedHostsDraft);r.submittedAnswers=o.submittedAnswers,r.error=null,r.revision=++e.revision,e.onChange();try{let n=xx(await mx(i,`question.resolve`,o.requestParams,r.expiresAtMs),Dx);if(!n||n.status!==(o.submittedAnswers?`answered`:`cancelled`))throw Error(`invalid question.resolve response`);if(e.client===i&&e.clientGeneration===a){let n=e.prompts.get(t);n&&(n.localResolutionConfirmed=!0)}px(i,{...n,id:t})}catch(n){if(e.client!==i||e.clientGeneration!==a)return;let r=e.prompts.get(t);if(!r)return;if(r.submitting=!1,r.status===`pending`){r.error=k(n),r.revision=++e.revision,e.onChange();return}r.status===`answered`&&!r.localResolutionConfirmed&&(r.answeredElsewhere=!Ox(r.submittedAnswers,r.answers)),r.revision=++e.revision,e.onChange()}}async function qx(e,t,n){await Kx(e,t,{answers:n})}async function Jx(e,t){await Kx(e,t,{cancel:!0})}function Yx(e){return[...e.prompts.values()].toSorted((e,t)=>e.createdAtMs-t.createdAtMs||e.id.localeCompare(t.id))}var Xx,Zx;function Qx(){return(Qx=t((()=>{ue(),Mr(),V(),N(),gx(),Cx(),Xx=[1e3,2e3,4e3],Zx=12})))()}var $x;function eS(){return(eS=t((()=>{Qx(),V(),Fa(),O(),bn(),G(),$x=class{constructor(e){this.host=e,this.attentionGateway=null,this.attentionGatewayClient=null,this.attentionGatewayConnected=!1,this.agentStatusExpiryTimer=null,this.agentStatusExpiryAt=null,e.addController(this),this.attentionSubscriptions=new fn(e),this.questionPromptState=Mx(()=>e.requestUpdate()),this.attentionSubscriptions.watch(()=>e.sessionAttentionContext?.gateway,(e,t)=>e.subscribe(t),e=>this.synchronizeAttentionGateway(e)).effect(()=>e.sessionAttentionContext?.gateway,e=>e.subscribeEvents(e=>{Lx(this.questionPromptState,e)})).watch(()=>e.sessionAttentionContext?.overlays,(e,t)=>e.subscribe(t))}hostDisconnected(){this.attentionGateway=null,this.attentionGatewayClient=null,this.attentionGatewayConnected=!1,this.agentStatusExpiryTimer&&(globalThis.clearTimeout(this.agentStatusExpiryTimer),this.agentStatusExpiryTimer=null,this.agentStatusExpiryAt=null),Gx(this.questionPromptState)}synchronizeAttentionGateway(e){let t=e.snapshot.phase===`connected`,n=t&&Na({hello:e.snapshot.hello},`question.list`)===!0&&typeof e.snapshot.client?.request==`function`?e.snapshot.client:null;(e!==this.attentionGateway||n!==this.attentionGatewayClient||t!==this.attentionGatewayConnected)&&(this.attentionGateway=e,this.attentionGatewayClient=n,this.attentionGatewayConnected=t,Wx(this.questionPromptState,n),n&&Ux(this.questionPromptState,n,()=>this.host.isConnected&&this.host.sessionAttentionContext?.gateway===e&&e.snapshot.phase===`connected`&&e.snapshot.client===n))}resolveSessionAttention(e){let t=this.knownSessionAttention().find(t=>j(t.sessionKey,e.key));if(t)return t.attention;let n=this.resolveSessionAgentStatus(e);if(n?.attention)return{kind:`agent`,note:n.note,icon:n.attention};if(e.status!==`failed`&&e.status!==`timeout`)return Xf;let r=e.endedAt??e.updatedAt??0;return e.lastReadAt!=null&&r<=e.lastReadAt?Xf:{kind:`error`,reason:e.lastRunError?.trim()||W(e.status===`timeout`?`sessionsView.runErrorTimedOut`:`sessionsView.runErrorUnknown`)}}resolveSessionAgentStatus(e){let t=e.agentStatus;if(!(!t||t.expiresAt<=Date.now()||!t.note.trim()))return this.scheduleAgentStatusExpiry(t.expiresAt),t}scheduleAgentStatusExpiry(e){this.agentStatusExpiryAt!==null&&this.agentStatusExpiryAt<=e||(this.agentStatusExpiryTimer&&globalThis.clearTimeout(this.agentStatusExpiryTimer),this.agentStatusExpiryAt=e,this.agentStatusExpiryTimer=globalThis.setTimeout(()=>{this.agentStatusExpiryTimer=null,this.agentStatusExpiryAt=null,this.host.requestUpdate()},Math.max(0,e-Date.now()+1)))}knownSessionAttention(){let e=Yx(this.questionPromptState).flatMap(e=>e.status===`pending`&&e.sessionKey!==void 0?[{sessionKey:e.sessionKey,attention:{kind:`question`}}]:[]),t=(this.host.sessionAttentionContext?.overlays?.snapshot.approvalQueue??[]).flatMap(e=>typeof e.request.sessionKey==`string`?[{sessionKey:e.request.sessionKey,attention:{kind:`approval`}}]:[]);return[...e,...t]}}})))()}async function tS(e){if(e.initialResult===null)return[];let t=new Map,n;for(let r=0;r<nS;r+=1){let i=t.size,a=new Set,o=0,s=r===0?e.initialResult:void 0;for(;!a.has(o);){a.add(o);let r=s??await e.list(o);if(s=void 0,e.isCurrent&&!e.isCurrent())return null;if(!r)throw Error(e.missingResultError);typeof r.totalCount==`number`&&(n=Math.max(n??0,r.totalCount));let i=e.mapPageRows?.(r.sessions)??r.sessions;for(let e of i)t.set(e.key,e);if(!(r.hasMore??(typeof r.totalCount==`number`&&o+r.sessions.length<r.totalCount)))break;let c=r.nextOffset??(r.offset??o)+r.sessions.length;if(c<=o){if(e.stalledPaginationError)throw Error(e.stalledPaginationError);break}o=c}if(t.size===i||n===void 0||t.size>=n)break}if(e.incompletePaginationError&&n!==void 0&&t.size<n)throw Error(e.incompletePaginationError);return[...t.values()]}var nS;function rS(){return(rS=t((()=>{nS=4})))()}async function iS(e){let t=e.pageSize??aS;return tS({list:n=>e.sessions.list({spawnedBy:e.parentKey,...n>0?{offset:n}:{},limit:t,includeGlobal:!1,includeUnknown:!1,configuredAgentsOnly:!0}),isCurrent:e.isCurrent,missingResultError:`child session list returned no result`,mapPageRows:e=>{let t=Date.now();return e.map(e=>({...e,runtimeSampledAt:t}))}})}var aS;function oS(){return(oS=t((()=>{rS(),aS=100})))()}function sS(e,t){let n=new Map;for(let r of[...Object.values(t).flat(),...e]){let e=Qe(r.key)||r.key;n.delete(e),n.set(e,r)}return new Map([...n.values()].map(e=>[e.key,e]))}async function cS(e){let t={},n=e.sessionKey,r=null,i=!1,a=new Set;try{for(let i=0;i<pS&&!a.has(n);i+=1){a.add(n);let i=e.knownRows.get(n)??[...e.knownRows.values()].find(e=>j(e.key,n));if(!i){let t=await e.client.request(`sessions.describe`,{key:n});if(!e.isCurrent())return null;if(i=t?.session?{...t.session,runtimeSampledAt:Date.now()}:void 0,!i)break;e.knownRows.set(i.key,i)}r=i;let o=qe(i);if(!o)break;t[o]=[...(t[o]??[]).filter(e=>e.key!==i.key),i],n=o}}catch{i=!0}return{rowsByParent:t,topmostRow:r,lookupFailed:i}}function lS(e,t){let n=Object.fromEntries(Object.entries(e).map(([e,t])=>[e,[...t]]));for(let[e,r]of Object.entries(t)){let t=n[e]??[];for(let e of r)t.some(t=>t.key===e.key)||t.push(e);n[e]=t}return n}function uS(e,t){let n={},r=e?.trim(),i=new Set;for(;r&&!i.has(r);){i.add(r);let e=Object.entries(t).find(([,e])=>e.some(e=>j(e.key,r)));if(!e)break;n[e[0]]=e[1].filter(e=>j(e.key,r)),r=e[0]}return n}function dS(e,t,n,r){let i=e.activeSessionLineageRoot,a=e.activeSessionLineageSelectedRow,o=n=>{let r=j(n.key,t)?a:i&&j(n.key,i.key)?i:null,o=e.sessionsResult?.sessions.find(e=>j(e.key,n.key));return nn(o??n,r??void 0)},s=n.topmostRow?o(n.topmostRow):null,c=Object.fromEntries(Object.entries(n.rowsByParent).map(([e,t])=>[e,t.map(o)]));e.childSessionRowsByParent=lS(e.childSessionRowsByParent,c),e.activeSessionLineageRoot=s;let l=[s,...Object.values(c).flat(),...sS(e.sessionsResult?.sessions??[],e.childSessionRowsByParent).values()].filter(e=>e!=null&&j(e.key,t)).reduce((e,t)=>!e||(t.updatedAt??0)>(e.updatedAt??0)?t:e,void 0);e.activeSessionLineageSelectedRow=l??(n.lookupFailed?a:null),l&&e.context?.sessions.reconcile(l,e.sessionsResult?.defaults,{archivedFilter:`all`,sourceCanonicalListRevision:r})}function fS(e,t){if(!t)return;let n=e.context?.gateway?.snapshot.sessionKey?.trim();if(n&&j(n,t))return;let r=e.sessionsResult?.sessions.find(e=>j(e.key,t))??[e.activeSessionLineageSelectedRow,e.activeSessionLineageRoot,...Object.values(e.childSessionRowsByParent).flat()].find(e=>e!=null&&j(e.key,t));r?.archived===!0&&(e.childSessionRowsByParent=Object.fromEntries(Object.entries(e.childSessionRowsByParent).map(([e,n])=>[e,n.filter(e=>!j(e.key,t))])),e.context?.sessions.reconcile(r,e.sessionsResult?.defaults,{archivedFilter:`active`}))}var pS;function mS(){return(mS=t((()=>{Fe(),O(),oS(),pS=16})))()}function hS(e){return{code:e instanceof Jn?e.gatewayCode:`UNAVAILABLE`,message:k(e)}}function gS(e,t){let n=new Set(e.map(e=>e.threadId));return[...e,...t.filter(e=>!n.has(e.threadId))]}function _S(e,t){if(!t)return e;let{sessions:n,nextCursor:r,...i}=e,{nextCursor:a,...o}=t;return{...o,...i,...a===void 0?{}:{nextCursor:a}}}function vS(e){let t=new Map(e.page.hosts.map(e=>[e.hostId,e])),n=[],r=e.current.hosts.map(r=>{let i=e.cursors[r.hostId],a=t.get(r.hostId);if(i===void 0||r.nextCursor!==i||!a)return r;if(a.error)return _S(a,r);n.push(r.hostId);let{nextCursor:o,sessions:s,error:c,...l}=a,{nextCursor:u,error:d,...f}=r;return{...f,...l,sessions:gS(r.sessions,s),...o?{nextCursor:o}:{}}}),{hosts:i,error:a,...o}=e.current,{hosts:s,error:c,...l}=e.page;return{catalog:{...o,...l,hosts:r,...c?{error:c}:{}},advancedHostIds:n}}async function yS(e){let t=new Map(e.previousCatalogs.map(e=>[e.id,e]));return Promise.all(e.catalogs.map(async n=>{let r=new Map(t.get(n.id)?.hosts.map(e=>[e.hostId,e])??[]),i=await Promise.all(n.hosts.map(async t=>{let i=e.pageDepths.get(Yf(n.id,t.hostId))??0;if(i===0)return t;let a=r.get(t.hostId);if(t.error)return _S(t,a);let o=t.sessions,s=t.nextCursor;for(let r=0;r<i&&s;r+=1){let r;try{r=await e.client.request(`sessions.catalog.list`,{agentId:e.agentId,catalogId:n.id,cursors:{[t.hostId]:s}})}catch{return a??t}if(!e.isCurrent())return a??t;let i=r.catalogs.find(e=>e.id===n.id)?.hosts.find(e=>e.hostId===t.hostId);if(!i)return a??t;if(i.error)return _S({...t,...i},a??t);o=gS(o,i.sessions),s=i.nextCursor}let{nextCursor:c,sessions:l,...u}=t;return{...u,sessions:o,...s?{nextCursor:s}:{}}}));return{...n,hosts:i}}))}function bS(){return(bS=t((()=>{Mr(),N(),G()})))()}function xS(e){return JSON.stringify(e.map(e=>({id:e.id,label:e.label,hosts:e.hosts.map(e=>({hostId:e.hostId,label:e.label,connected:e.connected,errorCode:e.error?.code,sessions:e.sessions.map(e=>({threadId:e.threadId,name:e.name,status:e.status,archived:e.archived})).toSorted((e,t)=>e.threadId.localeCompare(t.threadId))})).toSorted((e,t)=>e.hostId.localeCompare(t.hostId))})).toSorted((e,t)=>e.id.localeCompare(t.id)))}function SS(e,t){return!t||e?.phase!==`connected`||!e.client||Na(e,`sessions.catalog.list`)!==!0?null:e.client}function CS(e){if(!(e instanceof Jn)||e.gatewayCode!==`INVALID_REQUEST`)return!1;let t=e.message.toLowerCase();return t.includes(`progressid`)&&/(?:unexpected|unknown|unrecognized) property|additional propert(?:y|ies)/.test(t)}function wS(e){let t=y(e),n=y(t?.catalog),r=Array.isArray(n?.hosts)?n.hosts:[],i=y(r[0]);return!!(t&&n&&i&&typeof t.progressId==`string`&&t.progressId.length>0&&typeof t.agentId==`string`&&t.agentId.length>0&&typeof n.id==`string`&&typeof n.label==`string`&&n.capabilities!==null&&typeof n.capabilities==`object`&&r.length===1&&typeof i.hostId==`string`&&Array.isArray(i.sessions))}async function TS(e){let{live:t,client:n,generation:r,revision:i}=e;if(t.requestGeneration===r)return;let{progressId:a,progressSequence:o,requestOwner:s}=t.beginRequest(r),c=e.catalogs().length>0,l=xS(e.catalogs()),u=null,d=()=>t.ownsRequest(s)&&r===e.currentGeneration()&&n===e.currentClient(),f=()=>d()&&i===e.currentRevision();try{let r=await t.requestList(n,e.agentId,a);if(!d()||!r?.catalogs)return;u=t.beginRefetch(e.pageDepths.size>0);let i=e.catalogs(),s=await yS({catalogs:t.mergeFinal(r.catalogs,i),previousCatalogs:i,client:n,agentId:e.agentId,pageDepths:e.pageDepths,isCurrent:f});if(!f())return;e.applyFinal(s,new Set([...e.catalogs(),...s].map(e=>e.id))),t.markFinal({catalogs:s,hadCatalogs:c,previousMaterialSnapshot:l,progressSequence:o})}catch(n){f()&&(t.warnRequestError(n),e.applyError(n))}finally{t.endRefetch(u);let n=t.ownsRequest(s);if(n&&(t.requestGeneration=null),n&&d()&&e.connected()){let n=t.refreshPending?0:t.sawChange?ES:DS;t.refreshPending=!1,t.schedule(n,e.connected(),e.refresh)}}}var ES,DS,OS;function kS(){return(kS=t((()=>{Mr(),N(),Fa(),O(),Vt(),bS(),G(),ES=5e3,DS=3e4,OS=class{constructor(){this.timer=null,this.requestGeneration=null,this.sawChange=!1,this.refreshPending=!1,this.progressive=!0,this.activationTimer=null,this.activationQueueIfActive=!1,this.connectionEpoch=0,this.refetchOwner=null,this.presenceSignature=null,this.progressSequence=0,this.progressSequences=new Map,this.hostProgressSequences=new Map,this.knownHostKeys=new Set,this.requestChangedHostKeys=new Set,this.warnedRequestErrors=new Set,this.requestOwner=null}cancelTimer(e=`timer`){let t=this[e];t!==null&&(globalThis.clearTimeout(t),this[e]=null)}clear(){this.cancelScheduledRefreshes(),this.requestGeneration=null,this.requestOwner=null,this.progressSequences.clear(),this.hostProgressSequences.clear(),this.knownHostKeys.clear(),this.requestChangedHostKeys.clear(),this.presenceSignature=null,this.sawChange=!1,this.refreshPending=!1,this.refetchOwner=null}resetConnection(){this.retireConnection(!0)}retireConnection(e=!1){this.clear(),e&&(this.connectionEpoch+=1,this.progressive=!0)}async requestList(e,t,n){let r=this.connectionEpoch,i={agentId:t,limitPerHost:40},a=this.progressive,o;try{o=await e.request(`sessions.catalog.list`,{...i,...a?{progressId:n}:{}})}catch(t){if(!a||!CS(t))throw t;o=await e.request(`sessions.catalog.list`,i),a=!1}return r===this.connectionEpoch&&(this.progressive=a),o}mergeFinal(e,t){let n=new Map(t.flatMap(e=>e.hosts.map(t=>[Yf(e.id,t.hostId),t])));return e.map(e=>({...e,hosts:e.hosts.map(t=>{let r=Yf(e.id,t.hostId),i=n.get(r);return t.error&&this.requestChangedHostKeys.has(r)&&i&&!i.error?i:t})}))}get refetching(){return this.refetchOwner!==null}get hasRequested(){return this.progressSequence>0}beginRefetch(e){if(!e)return null;let t=Symbol(`session-catalog-refetch`);return this.refetchOwner=t,t}endRefetch(e){e!==null&&this.refetchOwner===e&&(this.refetchOwner=null)}beginRequest(e){this.requestGeneration=e;let t=Symbol(`session-catalog-request`);this.requestOwner=t,this.sawChange=!1,this.requestChangedHostKeys.clear();let n=ge(),r=++this.progressSequence;if(this.progressSequences.set(n,r),this.progressSequences.size>8){let e=this.progressSequences.keys().next().value;e&&this.progressSequences.delete(e)}return{progressId:n,progressSequence:r,requestOwner:t}}ownsRequest(e){return this.requestOwner===e}warnRequestError(e){let t=`${e instanceof Jn?e.gatewayCode:`UNAVAILABLE`}\u0000${k(e)}`;this.warnedRequestErrors.has(t)||(this.warnedRequestErrors.add(t),console.warn(`Session catalog refresh failed`,e))}markFinal(e){this.sawChange=e.hadCatalogs&&(this.sawChange||e.previousMaterialSnapshot!==xS(e.catalogs));let t=new Set;for(let n of e.catalogs)for(let r of n.hosts){let i=Yf(n.id,r.hostId);t.add(i),!r.error&&this.hostProgressSequences.set(i,Math.max(this.hostProgressSequences.get(i)??-1,e.progressSequence))}for(let n of this.knownHostKeys)t.has(n)||this.hostProgressSequences.set(n,e.progressSequence);this.knownHostKeys=t}observePresence(e){let t=y(e)?.presence;if(!Array.isArray(t))return!1;let n=new Map;for(let e of t){let t=y(e);if(!t)continue;let r=typeof t.deviceId==`string`?t.deviceId:t.instanceId,i=typeof r==`string`?r.trim().toLowerCase():``,a=typeof t.mode==`string`?t.mode.trim().toLowerCase():``,o=a?a===`node`:Array.isArray(t.roles)&&t.roles.some(e=>typeof e==`string`&&e.trim().toLowerCase()===`node`);if(!i||!o)continue;let s=typeof t.reason==`string`?t.reason.trim().toLowerCase():``;n.set(i,s===`disconnect`?`offline`:`connected`)}let r=JSON.stringify([...n].toSorted(([e],[t])=>e.localeCompare(t))),i=this.presenceSignature;return this.presenceSignature=r,i===null?n.size>0:i!==r}applyHost(e){if(!wS(e.payload))return null;let t=e.payload;if(r(t.agentId)!==r(e.agentId))return null;let n=this.progressSequences.get(t.progressId),i=t.catalog.hosts[0];if(n===void 0||!i)return null;let a=Yf(t.catalog.id,i.hostId);if(n<(this.hostProgressSequences.get(a)??-1))return null;this.hostProgressSequences.set(a,n),this.requestGeneration!==null&&this.requestChangedHostKeys.add(a);let o=e.catalogs.find(e=>e.id===t.catalog.id),s,c;if(!o)c={...t.catalog,hosts:[i]},s=[...e.catalogs,c].toSorted((e,t)=>e.id.localeCompare(t.id));else{let n=o.hosts.find(e=>e.hostId===i.hostId),r=(e.pageDepths.get(a)??0)>0?_S(i,n):i,l=n?o.hosts.map(e=>e.hostId===i.hostId?r:e):[...o.hosts,r];c={...t.catalog,hosts:l.toSorted((e,t)=>e.label.localeCompare(t.label))},s=e.catalogs.map(e=>e.id===t.catalog.id?c:e)}let l=o?.hosts.find(e=>e.hostId===i.hostId),u=c.hosts.find(e=>e.hostId===i.hostId);if(o!==void 0&&o.label===c.label&&JSON.stringify(o.capabilities)===JSON.stringify(c.capabilities)&&JSON.stringify(o.error)===JSON.stringify(c.error)&&JSON.stringify(l)===JSON.stringify(u))return null;let d=!o||!l||!u||xS([{...c,hosts:[u]}])!==xS([{...o,hosts:[l]}]);return this.sawChange||=d,{catalogs:s,catalogId:t.catalog.id,materialChange:d}}schedule(e,t,n){document.visibilityState===`hidden`||!t||(this.cancelTimer(),this.timer=globalThis.setTimeout(()=>{this.timer=null,n()},e))}requestRefresh(e){if(!(!e.visible||!e.connected)&&!(!e.queueIfActive&&this.timer!==null)){if(this.cancelTimer(),this.requestGeneration===e.generation){this.refreshPending||=e.queueIfActive;return}e.refresh()}}cancelActivation(){this.cancelTimer(`activationTimer`),this.activationQueueIfActive=!1}cancelScheduledRefreshes(){this.cancelTimer(),this.cancelActivation()}scheduleActivation(e,t){this.activationQueueIfActive||=e,this.activationTimer===null&&(this.activationTimer=globalThis.setTimeout(()=>{this.activationTimer=null;let e=this.activationQueueIfActive;this.activationQueueIfActive=!1,t(e)},50))}}})))()}function AS(){return{error:null,hasLoaded:!1,stale:!1}}function jS(e,t){return{...e,error:t?.clearError===!1?e.error:null}}function MS(){return{error:null,hasLoaded:!0,stale:!1}}function NS(e,t){return{error:k(t),hasLoaded:e.hasLoaded,stale:e.hasLoaded}}function PS(e){let{status:t}=e,n=e.errorMessage??t.error,r=n&&k(n);if(!r&&!t.stale)return P;let i=e.className?` ${e.className}`:``;return r?F`
|
|
<div class="callout danger callout--dismissible${i}" role="alert">
|
|
<span class="callout__content">
|
|
<span>${r}</span>
|
|
${t.stale?F`<br /><strong>${W(`common.staleData`)}</strong>`:P}
|
|
</span>
|
|
<button class="btn btn--sm" ?disabled=${e.retryDisabled} @click=${e.onRetry}>
|
|
${W(`common.retry`)}
|
|
</button>
|
|
</div>
|
|
`:F`
|
|
<div class="callout warn${i}" role="status">
|
|
<strong>${W(`common.staleData`)}</strong>
|
|
</div>
|
|
`}function FS(){return(FS=t((()=>{I(),V(),N()})))()}function IS(e){return document.visibilityState===`hidden`?null:SS(e.context?.gateway.snapshot,e.sessionDataHostConnected)}function LS(e,t=e.expandedAgentId()){let n=e.context,i=n?.gateway.snapshot;if(i?.phase===`connected`&&Na(i,`sessions.catalog.list`)===!1)return null;let a=n?.agents.state,o=i?.phase===`connected`&&i.client&&a?.connected&&a.client===i.client?a.agentsList:null;if(o){let e=n?n.agentSelection.state.selectedId:t,i=e?.trim()?r(e):null;if(i&&o.agents.some(e=>r(e.id)===i))return i;let a=r(o.defaultId);return o.agents.some(e=>r(e.id)===a)?a:null}if(i?.phase!==`connected`||!i.hello||!i.assistantAgentId)return null;let s=r(i.assistantAgentId),c=n?.agentSelection.state.selectedId,l=c?.trim()?r(c):null;return l&&l!==s?null:s}function RS(e,t=!1){if(document.visibilityState===`hidden`){e.sessionCatalogLive.cancelScheduledRefreshes();return}e.sessionCatalogLive.scheduleActivation(t,t=>{let n=e.context?.gateway.snapshot;e.sessionCatalogLive.requestRefresh({visible:document.visibilityState!==`hidden`,connected:e.isSessionDataHostConnected&&e.sessionCatalogAgentId!==null&&!!SS(n,e.sessionDataHostConnected),generation:e.sessionScopeGeneration,queueIfActive:t,refresh:()=>void e.refreshSessionCatalogs()})})}function zS(e,t=!1){if(e.context&&e.synchronizeSessionScope(),!(!IS(e)||e.sessionCatalogLive.timer||e.sessionCatalogLive.requestGeneration===e.sessionScopeGeneration)){if(t&&e.sessionCatalogLive.hasRequested){RS(e);return}e.refreshSessionCatalogs()}}function BS(e,t){e.sessionCatalogLive.observePresence(t)&&RS(e,!0)}function VS(e,t){let n=e.sessionCatalogLive.applyHost({payload:t,agentId:e.sessionCatalogAgentId??``,catalogs:e.sessionCatalogs,pageDepths:e.sessionCatalogPageDepths});if(!n)return;e.sessionCatalogs=n.catalogs,e.requestSessionDataUpdate(),e.sessionCatalogRevision+=+!!e.sessionCatalogLive.refetching;let r=e.sessionCatalogRevisions.get(n.catalogId)??0;e.sessionCatalogRevisions.set(n.catalogId,r+1),n.materialChange&&e.sessionCatalogLive.requestGeneration!==e.sessionScopeGeneration&&e.sessionCatalogLive.schedule(ES,e.isSessionDataHostConnected,()=>void e.refreshSessionCatalogs())}async function HS(e){e.synchronizeSessionScope();let t=e.sessionCatalogAgentId,n=IS(e);if(!n||!t)return;let r=e.sessionScopeGeneration,i=e.sessionCatalogRevision;await TS({live:e.sessionCatalogLive,client:n,agentId:t,generation:r,revision:i,currentGeneration:()=>e.sessionScopeGeneration,currentRevision:()=>e.sessionCatalogRevision,currentClient:()=>e.sessionCatalogGatewayClient(),catalogs:()=>e.sessionCatalogs,pageDepths:e.sessionCatalogPageDepths,connected:()=>e.isSessionDataHostConnected,applyFinal:(t,n)=>{e.sessionCatalogs=t,e.sessionCatalogRefreshStatus=MS(),e.requestSessionDataUpdate();for(let t of n)e.sessionCatalogRevisions.set(t,(e.sessionCatalogRevisions.get(t)??0)+1);e.sessionCatalogRevision+=1},applyError:t=>{e.sessionCatalogRefreshStatus=NS(e.sessionCatalogRefreshStatus,hS(t).message),e.requestSessionDataUpdate()},refresh:()=>void e.refreshSessionCatalogs()})}async function US(e,t){if(e.loadingMoreSessionCatalogIds.has(t))return;let n=e.sessionCatalogs.find(e=>e.id===t),r=Object.fromEntries((n?.hosts??[]).flatMap(e=>e.nextCursor?[[e.hostId,e.nextCursor]]:[]));if(!n||Object.keys(r).length===0)return;let i=e.context?.gateway.snapshot.client,a=LS(e);if(!i||!e.sessionDataHostConnected||!a||a!==e.sessionCatalogAgentId)return;let o=e.sessionScopeGeneration,s=e.sessionCatalogRevisions.get(t)??0;e.loadingMoreSessionCatalogIds=new Set([...e.loadingMoreSessionCatalogIds,t]),e.requestSessionDataUpdate();try{let n=await i.request(`sessions.catalog.list`,{agentId:a,catalogId:t,cursors:r});if(!WS(e,t,i,o,s))return;let c=n.catalogs.find(e=>e.id===t),l=e.sessionCatalogs.find(e=>e.id===t);if(!c||!l)return;let u=vS({current:l,page:c,cursors:r});for(let n of u.advancedHostIds){let r=Yf(t,n);e.sessionCatalogPageDepths.set(r,(e.sessionCatalogPageDepths.get(r)??0)+1)}e.sessionCatalogs=e.sessionCatalogs.map(e=>e.id===t?u.catalog:e),e.requestSessionDataUpdate(),e.sessionCatalogRevisions.set(t,s+1),e.sessionCatalogRevision+=1}catch(n){if(!WS(e,t,i,o,s))return;e.sessionCatalogs=e.sessionCatalogs.map(e=>e.id===t?{...e,error:hS(n)}:e),e.requestSessionDataUpdate(),e.sessionCatalogRevisions.set(t,s+1),e.sessionCatalogRevision+=1}finally{if(o===e.sessionScopeGeneration){let n=new Set(e.loadingMoreSessionCatalogIds);n.delete(t),e.loadingMoreSessionCatalogIds=n,e.requestSessionDataUpdate()}}}function WS(e,t,n,r,i){return r===e.sessionScopeGeneration&&i===(e.sessionCatalogRevisions.get(t)??0)&&n===e.sessionCatalogGatewayClient()}function GS(){return(GS=t((()=>{Fa(),O(),kS(),bS(),G(),FS()})))()}function KS(e,t,n){(n!==`list`||tC.get(e)!==`action`)&&(e.sessionMutationError=t,t===null?tC.delete(e):tC.set(e,n))}function qS(e,t){let n=new Set(t.map(r));for(let t of Object.keys(e.sessionResultsByAgent))n.has(t)||delete e.sessionResultsByAgent[t];e.sessionsAgentId&&!n.has(r(e.sessionsAgentId))&&(e.sessionsResult=null,e.sessionsAgentId=null)}function JS(e,t,n){let r=()=>{let n=e.state.agentsList;n&&qS(t,n.agents.map(e=>e.id))};return r(),e.subscribe(()=>{r(),n()})}function YS(e){let{ownerId:t,involvingMe:n}=e.sidebarSessionOwnerFilter();return e.sidebarSessionStatusFilter()!==`active`||!!(t||n)}function XS(e,t){let{ownerId:n,involvingMe:r}=e.sidebarSessionOwnerFilter();return{ownerId:r?void 0:n||void 0,involvingMe:r||void 0,agentId:t,archivedFilter:e.sidebarSessionStatusFilter(),limit:200,includeDerivedTitles:!0,includeLastMessage:!0}}function ZS(e,t){e.sessionsResult=t.result,e.sessionsAgentId=t.agentId,t.result&&t.agentId&&(e.sessionResultsByAgent[r(t.agentId)]=t.result)}function QS(e,t,n,r){let i=t=>{r()&&(e.context?.gateway.snapshot.phase!==`connected`&&!t.result||(ZS(e,t),e.sessionsLoading=t.loading,KS(e,t.error,`list`),e.requestSessionDataUpdate()))},a=t.subscribeList(n,i);return i(t.listSnapshot(n)),()=>{a(),KS(e,null,`list`)}}function $S(e,t,n=!1){let i=e.sessionsResult,a=i?.nextOffset===void 0?i?.sessions.length:i.nextOffset;return!e.context?.sessions||!t||n&&(e.sessionsLoading||!i?.hasMore||typeof a!=`number`||r(t)!==r(e.expandedAgentId()))?Promise.resolve():e.context.sessions.refreshList({...e.sessionListQuery(t),...n&&typeof a==`number`?{offset:a,append:!0}:{},force:!0})}function eC(e,t){return e.subscribeEvents(e=>{if(e.event===`sessions.catalog.host`){t.handleSessionCatalogHostEvent(e.payload);return}if(e.event===`presence`){let n=ir(e.payload);t.presencePayload=n?{presence:n}:void 0,t.requestSessionDataUpdate(),t.handleSessionCatalogPresence(e.payload)}})}var tC;function nC(){return(nC=t((()=>{O(),tC=new WeakMap})))()}var rC;function iC(){return(iC=t((()=>{G(),rC=class{constructor(e){this.notify=e,this.state=`none`,this.element=null,this.resizeObserver=null,this.frame=null}synchronize(e){let t=e.querySelector(`.sidebar-shell__body`);t!==this.element&&(this.resizeObserver?.disconnect(),this.element=t,this.resizeObserver=null,t&&typeof ResizeObserver==`function`&&(this.resizeObserver=new ResizeObserver(()=>this.update(t)),this.resizeObserver.observe(t))),t&&this.frame===null&&(this.frame=requestAnimationFrame(()=>{this.frame=null,this.element?.isConnected&&this.update(this.element)}))}update(e){let t=Cf(e);t!==this.state&&(this.state=t,this.notify())}dispose(){this.resizeObserver?.disconnect(),this.resizeObserver=null,this.element=null,this.frame!==null&&(cancelAnimationFrame(this.frame),this.frame=null)}}})))()}var aC;function oC(){return(oC=t((()=>{wy(),N(),dn(),Fe(),O(),bn(),mS(),kS(),Hd(),FS(),GS(),nC(),iC(),aC=class{constructor(e){this.host=e,this.sessionCatalogs=[],this.sessionCatalogRefreshStatus=AS(),this.loadingMoreSessionCatalogIds=new Set,this.visibleSessionLimits=new Map,this.sessionsResult=null,this.sessionsAgentId=null,this.sessionsLoading=!1,this.childSessionRowsByParent={},this.loadedChildSessionKeys=new Set,this.childSessionErrorsByParent=new Map,this.loadingChildSessionKeys=new Set,this.activeSessionLineageRoot=null,this.activeSessionLineageSelectedRow=null,this.sessionMutationError=null,this.sessionResultsByAgent={},this.sessionCatalogLive=new OS,this.sessionScopeGeneration=0,this.sessionCatalogAgentId=null,this.sessionCatalogRevision=0,this.sessionCatalogPageDepths=new Map,this.sessionCatalogRevisions=new Map,this.sessionScopeAgentId=null,this.sessionsSource=null,this.filteredSessionScope=null,this.unsubscribeFilteredSessions=null,this.childSessionGeneration=0,this.childSessionCanonicalListRevision=null,this.activeSessionLineageRouteKey=null,this.activeSessionLineageLoaded=!1,this.activeSessionLineageRequest=null,this.activeSessionLineageRetryTimer=null,this.reconnectListRevision=null,this.gatewaySource=null,this.gatewayConnectionRevision=0,this.gatewayClient=null,this.gatewayConnected=!1,this.sessionMutationEpoch=0,this.sessionMutationAbortController=new AbortController,this.scroll=new rC(()=>this.notify()),this.approvalBadgeQueue=[],this.approvalBadges=Sy([]),this.sessionListQuery=e=>XS(this.host,e),this.notify=()=>this.requestSessionDataUpdate(),this.handleCatalogSessionContinued=e=>{let t=e.detail,n=typeof t?.agentId==`string`?t.agentId.trim():``,i=n?r(n):null,a=this.sessionCatalogAgentId?r(this.sessionCatalogAgentId):null;!t?.sessionKey||!i||i!==a||(this.sessionCatalogs=Vd(this.sessionCatalogs,t),this.notify(),this.sessionCatalogRevision+=1,this.sessionCatalogRevisions.set(t.catalogId,(this.sessionCatalogRevisions.get(t.catalogId)??0)+1))},this.handleSessionCatalogPageActivation=e=>{RS(this,e.type===`visibilitychange`)},this.updateSessions=e=>{if(this.childSessionCanonicalListRevision!==e.canonicalListRevision){this.childSessionCanonicalListRevision=e.canonicalListRevision;let t=this.activeSessionLineageRouteKey;if(t){let n=this.activeSessionLineageSelectedRow??this.sessionsResult?.sessions.find(e=>j(e.key,t)),r=e.state.result?.sessions.find(e=>j(e.key,t));this.activeSessionLineageSelectedRow=r?nn(r,n):n??null}this.resetChildSessionState(!0),this.notify()}let t=e.state;if(YS(this.host))return;let n=this.context?.gateway,r=n!==void 0&&n===this.gatewaySource&&n.snapshot.client!==null&&n.snapshot.phase!==`connected`;r&&this.reconnectListRevision===null&&(this.reconnectListRevision=e.canonicalListRevision+1);let i=this.reconnectListRevision!==null&&e.canonicalListRevision<this.reconnectListRevision;!r&&!i&&(this.reconnectListRevision=null,ZS(this,t)),this.sessionsLoading=t.loading,this.notify()},e.addController(this),this.subscriptions=new fn({addController:()=>void 0,removeController:()=>void 0,requestUpdate:()=>e.requestUpdate(),get updateComplete(){return e.updateComplete}}),this.subscriptions.watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.synchronizeGateway(e)).watch(()=>this.context?.sessions,(e,t)=>e.subscribe(t),e=>this.synchronizeSessions(e)).effect(()=>this.context?.sessions,t=>t.subscribeCreated(t=>e.promoteCreatedSession(t))).effect(()=>this.context?.gateway,e=>eC(e,this)).watch(()=>this.context?.agents,(e,t)=>JS(e,this,t)).watch(()=>this.context?.agentSelection,(e,t)=>e.subscribe(t),()=>this.synchronizeSessionScope()).watch(()=>this.context?.overlays,(e,t)=>e.subscribe(t))}get context(){return this.host.sessionDataContext}get isSessionDataHostConnected(){return this.host.isConnected}get sessionDataHostConnected(){return this.host.connected}expandedAgentId(){return this.host.expandedAgentId()}requestSessionDataUpdate(){this.host.requestUpdate()}hostConnected(){this.subscriptions.hostConnected(),this.connectSessionCatalogListeners()}hostUpdate(){this.subscriptions.hostUpdate()}hostUpdated(){this.synchronizeSessionScope(),this.scroll.synchronize(this.host),this.updateSessionCatalogData(!0)}hostDisconnected(){this.retireFilteredSessions(),this.disconnectSessionCatalogListeners(),this.host.dismissTransientMenus(),this.invalidateSessionMutations(),this.gatewaySource=null,this.gatewayClient=null,this.gatewayConnected=!1,this.retireSessionCatalogData(),this.scroll.dispose(),this.clearActiveSessionLineageRetry(),this.subscriptions.hostDisconnected()}approvalBadgeSnapshot(){let e=this.context?.overlays?.snapshot.approvalQueue??[];return e!==this.approvalBadgeQueue&&(this.approvalBadgeQueue=e,this.approvalBadges=Sy(e)),this.approvalBadges}sessionCatalogGatewayClient(){return this.gatewayClient}connectSessionCatalogListeners(){document.addEventListener(qt,this.handleCatalogSessionContinued),document.addEventListener(`visibilitychange`,this.handleSessionCatalogPageActivation),globalThis.addEventListener(`focus`,this.handleSessionCatalogPageActivation)}disconnectSessionCatalogListeners(){document.removeEventListener(qt,this.handleCatalogSessionContinued),document.removeEventListener(`visibilitychange`,this.handleSessionCatalogPageActivation),globalThis.removeEventListener(`focus`,this.handleSessionCatalogPageActivation)}retireSessionCatalogData(e=!1){this.sessionScopeGeneration+=1,this.sessionsLoading=!1,this.loadingMoreSessionCatalogIds=new Set,this.sessionCatalogLive.retireConnection(e)}resetSessionCatalogConnection(){this.retireSessionCatalogData(),this.sessionCatalogRevision+=1,this.sessionCatalogLive.resetConnection(),this.sessionCatalogs=[],this.sessionCatalogRefreshStatus=AS(),this.sessionCatalogPageDepths.clear(),this.sessionCatalogRevisions.clear(),this.notify()}synchronizeSessionScope(){let e=this.context,t=e?r(this.host.expandedAgentId()):null,n=LS(this)??(e?.gateway.snapshot.phase===`connected`?null:this.sessionCatalogAgentId);if(t===this.sessionScopeAgentId&&n===this.sessionCatalogAgentId)return;let i=this.sessionScopeAgentId,a=this.sessionCatalogAgentId,o=i!==null&&i!==t,s=a!==null&&a!==n,c=this.sessionsAgentId,l=!YS(this.host)&&t!==null&&c!==null&&r(c)===t&&this.sessionsResult===e?.sessions.state.result;this.sessionScopeAgentId=t,this.sessionCatalogAgentId=n,this.retireSessionCatalogData(),this.sessionCatalogRevision+=1,this.sessionCatalogRefreshStatus=AS(),(o||s)&&(this.sessionCatalogs=[],this.sessionCatalogPageDepths.clear(),this.sessionCatalogRevisions.clear()),o&&!l&&this.clearSessionCache(),this.bindFilteredSessions(t??``),this.notify(),o&&e?.gateway.snapshot.phase===`connected`&&YS(this.host)&&this.refreshSidebarSessions()}updateSessionCatalogData(e=!1){zS(this,e)}handleSessionCatalogHostEvent(e){VS(this,e)}handleSessionCatalogPresence(e){BS(this,e)}refreshSessionCatalogs(){return HS(this)}loadMoreSessionCatalog(e){return US(this,e)}get sessionsScrollState(){return this.scroll.state}clearActiveSessionLineageRetry(){this.activeSessionLineageRetryTimer&&=(globalThis.clearTimeout(this.activeSessionLineageRetryTimer),null)}updateSessionsScrollState(e){this.scroll.update(e)}resetChildSessionState(e=!1){this.childSessionGeneration+=1,this.childSessionRowsByParent=e?uS(this.activeSessionLineageRouteKey,this.childSessionRowsByParent):{},this.loadedChildSessionKeys=new Set,this.loadingChildSessionKeys=new Set,e||(this.childSessionErrorsByParent=new Map,this.activeSessionLineageRoot=null,this.activeSessionLineageSelectedRow=null,this.activeSessionLineageRouteKey=null),this.activeSessionLineageLoaded=!1,this.activeSessionLineageRequest=null,this.clearActiveSessionLineageRetry()}synchronizeSessions(e){let t=e!==this.sessionsSource;t&&(this.invalidateSessionMutations(),this.retireFilteredSessions(),this.clearSessionCache(),this.sessionsSource=e),this.updateSessions(e),this.context?.gateway.snapshot.phase===`connected`&&(e.groupsLoad(),t&&YS(this.host)&&this.refreshSidebarSessions())}synchronizeGateway(e){let t=e.snapshot.client,n=e.snapshot.phase===`connected`,r=e!==this.gatewaySource||e.connectionRevision!==this.gatewayConnectionRevision,i=t!==this.gatewayClient,a=n&&!this.gatewayConnected,o=r||i,s=n!==this.gatewayConnected;if(!(!o&&!s)){if(this.invalidateSessionMutations(),this.gatewaySource=e,this.gatewayConnectionRevision=e.connectionRevision,this.gatewayClient=t,this.gatewayConnected=n,this.presenceInstanceId=t?.instanceId,!n)this.presencePayload=void 0;else if(i||a){let t=ir(e.snapshot.hello?.snapshot);this.presencePayload=t?{presence:t}:void 0}if(this.notify(),!o){this.retireSessionCatalogData(!n),n&&this.sessionsSource&&YS(this.host)&&this.refreshSidebarSessions();return}r&&this.clearSessionCache(),this.resetSessionCatalogConnection(),n&&this.sessionsSource&&YS(this.host)&&this.refreshSidebarSessions()}}clearSessionCache(){this.childSessionCanonicalListRevision=null,this.reconnectListRevision=null,this.sessionsResult=null,this.sessionsAgentId=null,this.sessionResultsByAgent={},this.resetChildSessionState(),this.visibleSessionLimits.clear(),this.notify()}retireFilteredSessions(){this.unsubscribeFilteredSessions?.(),this.unsubscribeFilteredSessions=null,this.filteredSessionScope=null}bindFilteredSessions(e){let t=this.context?.sessions;if(!t||!YS(this.host)){this.retireFilteredSessions();return}let n=r(e),i=this.sessionListQuery(n),a=JSON.stringify(i);this.filteredSessionScope!==a&&(this.retireFilteredSessions(),this.filteredSessionScope=a,this.unsubscribeFilteredSessions=QS(this,t,i,()=>this.filteredSessionScope===a&&this.context?.sessions===t&&this.host.sidebarSessionStatusFilter()===i.archivedFilter&&r(this.host.expandedAgentId())===n))}refreshSidebarSessions(e=this.host.expandedAgentId()){return this.bindFilteredSessions(e),$S(this,e)}loadMoreSidebarSessions(){return $S(this,this.sessionsAgentId,!0)}async loadChildSessions(e){if(!e||this.loadedChildSessionKeys.has(e)||this.childSessionErrorsByParent.has(e)||this.loadingChildSessionKeys.has(e))return;let t=this.context?.sessions;if(!t)return;let n=this.childSessionGeneration;this.loadingChildSessionKeys=new Set([...this.loadingChildSessionKeys,e]),this.notify();try{let r=()=>n===this.childSessionGeneration&&t===this.context?.sessions,i=await iS({sessions:t,parentKey:e,isCurrent:r});if(!i||!r())return;for(let t of this.childSessionRowsByParent[e]??[])i.some(e=>e.key===t.key)||i.push(t);this.childSessionRowsByParent={...this.childSessionRowsByParent,[e]:i},this.loadedChildSessionKeys=new Set([...this.loadedChildSessionKeys,e])}catch(r){if(n!==this.childSessionGeneration||t!==this.context?.sessions)return;this.childSessionRowsByParent={...this.childSessionRowsByParent,[e]:this.childSessionRowsByParent[e]??[]},this.childSessionErrorsByParent=new Map(this.childSessionErrorsByParent).set(e,k(r)),this.notify()}finally{if(n===this.childSessionGeneration&&t===this.context?.sessions){let t=new Set(this.loadingChildSessionKeys);t.delete(e),this.loadingChildSessionKeys=t,this.notify()}}}async loadActiveSessionLineage(e){let t=e.trim();(!this.activeSessionLineageRouteKey||!j(t,this.activeSessionLineageRouteKey))&&(fS(this,this.activeSessionLineageRouteKey),this.activeSessionLineageRouteKey=t,this.activeSessionLineageLoaded=!1,this.activeSessionLineageRequest=null,this.activeSessionLineageRoot=null,this.activeSessionLineageSelectedRow=null,this.clearActiveSessionLineageRetry(),this.notify());let{gateway:n,sessions:r}=this.context??{},i=n?.snapshot.client;if(!t||this.activeSessionLineageLoaded||this.activeSessionLineageRequest!==null||this.activeSessionLineageRetryTimer!==null||n?.snapshot.phase!==`connected`||!r||typeof i?.request!=`function`)return;let a=this.childSessionGeneration,o={sourceRevision:r.canonicalListRevision};this.activeSessionLineageRequest=o;let s=()=>a===this.childSessionGeneration&&o===this.activeSessionLineageRequest&&n===this.context?.gateway&&i===n.snapshot.client,c=await cS({client:i,sessionKey:t,knownRows:sS(this.sessionsResult?.sessions??[],this.childSessionRowsByParent),isCurrent:s});if(!(!c||!s())){if(dS(this,t,c,o.sourceRevision),this.notify(),this.activeSessionLineageRequest=null,c.lookupFailed){this.activeSessionLineageRetryTimer=globalThis.setTimeout(()=>{this.activeSessionLineageRetryTimer=null,this.activeSessionLineageRouteKey===t&&this.notify()},5e3);return}this.activeSessionLineageLoaded=!0}}setVisibleSessionLimit(e,t){this.visibleSessionLimits.set(e,t),this.notify()}dismissSessionMutationError(){KS(this,null,`action`),this.notify()}resetSessionList(){this.retireFilteredSessions(),this.sessionsLoading=!1,this.visibleSessionLimits.clear(),this.resetChildSessionState(),this.sessionResultsByAgent={},!YS(this.host)&&this.context?(this.sessionsResult=this.context.sessions.state.result,this.sessionsAgentId=this.context.sessions.state.agentId):this.context&&this.bindFilteredSessions(this.host.expandedAgentId()),this.notify()}discardEmptyChildSessionSnapshot(e){if(this.childSessionRowsByParent[e]?.length===0){let t={...this.childSessionRowsByParent};delete t[e],this.childSessionRowsByParent=t;let n=new Set(this.loadedChildSessionKeys);n.delete(e),this.loadedChildSessionKeys=n,this.notify()}}retryChildSessions(e){if(this.childSessionErrorsByParent.has(e)){let t=new Map(this.childSessionErrorsByParent);t.delete(e),this.childSessionErrorsByParent=t,this.notify()}this.loadChildSessions(e)}invalidateSessionMutations(){this.sessionMutationEpoch+=1,KS(this,null,`action`),this.sessionMutationAbortController.abort(),this.sessionMutationAbortController=new AbortController,this.notify()}beginSessionMutation(){let e=this.context;if(!e||!this.host.connected)return null;let t=e.gateway,n=t.snapshot.client;return t.snapshot.phase!==`connected`||!n?null:(KS(this,null,`action`),this.notify(),{epoch:this.sessionMutationEpoch,context:e,gateway:t,sessions:e.sessions,client:n,selectedAgentId:this.host.selectedAgentIdForSessions(),signal:this.sessionMutationAbortController.signal})}isSessionMutationScopeCurrent(e){let t=this.context,n=t?.gateway;return this.host.connected&&this.sessionMutationEpoch===e.epoch&&t===e.context&&n===e.gateway&&t.sessions===e.sessions&&n.snapshot.phase===`connected`&&n.snapshot.client===e.client}publishSessionMutationError(e,t){this.isSessionMutationScopeCurrent(e)&&(KS(this,k(t),`action`),this.notify())}}})))()}var sC;function cC(){return(cC=t((()=>{G(),sC=class{constructor(e,t){this.host=e,this.getContext=t,this.ownerId=null,this.involvingMe=!1,this.scope=null,this.ownerFacetResolved=!1,this.ownerOptions=[],this.pendingFacetRefresh=null,e.addController(this)}hostUpdated(){this.restore(),!this.pendingFacetRefresh&&this.ownerFacetResolved&&this.ownerId&&!this.ownerOptions.some(e=>e.id===this.ownerId)&&this.set(null)}observeOwnerFacet(e,t){this.pendingFacetRefresh||(this.ownerFacetResolved=e,this.ownerOptions=t)}set(e,t=!1){this.pendingFacetRefresh=null,this.ownerId=t?null:e?.trim()||null,this.involvingMe=t;let n=this.getContext(),r=n?.gateway.snapshot.selfUser?.id.trim();n&&r&&Uf(n.gateway.connection.gatewayUrl,r,this.currentFilter()),this.host.requestUpdate(),this.refresh()}restore(){let e=this.getContext(),t=e?.gateway.snapshot.selfUser?.id.trim();if(!e||!t)return;let n=e.gateway.connection.gatewayUrl,r=`${n}\0${t}`;if(r===this.scope)return;let i=this.scope;if(this.scope=r,i===null&&(this.ownerId||this.involvingMe))Uf(n,t,this.currentFilter());else{let e=Nf(n,t);this.ownerId=e.ownerId,this.involvingMe=e.involvingMe}if(this.host.requestUpdate(),i!==null||this.ownerId||this.involvingMe){this.ownerFacetResolved=!1,this.ownerOptions=[];let e=this.refresh();this.pendingFacetRefresh=e,e.finally(()=>{this.pendingFacetRefresh===e&&(this.pendingFacetRefresh=null,this.host.requestUpdate())})}}refresh(){return this.host.sessionData.resetSessionList(),this.host.sessionData.refreshSidebarSessions()}currentFilter(){return{ownerId:this.ownerId,involvingMe:this.involvingMe}}}})))()}var lC;function uC(){return(uC=t((()=>{R(),Vr(),$r(),V(),ze(),ob(),Se(),O(),sb(),lb(),Hd(),Hb(),Rb(),rx(),cx(),ux(),G(),eS(),oC(),cC(),lC=class extends Y{constructor(...e){super(...e),this.sessionSortMode=Pf(),this.sessionProjection=new sx,this.sessionData=new aC(this),this.sessionPullRequests=new nx(this,{getConnected:()=>this.connected,getRows:()=>Vb({rows:this.visibleSessionRowsInOrder(),adopted:Rd(this.visibleSessionCatalogs()),sessionsResult:this.sessionData.sessionsResult,sessionResultsByAgent:this.sessionData.sessionResultsByAgent,navigationState:this.getSessionNavigationState()}),getSelectedAgentId:()=>this.selectedAgentIdForSessions(),getGateway:()=>this.context?.gateway,getSessions:()=>this.context?.sessions}),this.compareSidebarSessionRows=(e,t)=>gb({a:e,b:t,sortMode:this.effectiveSessionSortMode(),owners:this.selectedAgentSessionResult()?.owners,createdOrder:this.sessionProjection.createdOrder}),this.sessionOwnerFilter=new sC(this,()=>this.context),this.sessionOwnerOptions=[],this.activeSessionOwnerId=null,this.sessionOwnershipVisible=!1,this.selectedSessionKeys=new Set,this.sessionsGrouping=Ef(),this.sessionsShowCron=Of(),this.sessionsShowPreview=kf(),this.sessionsShowSystem=Af(),this.sessionsStatusFilter=jf(),this.hiddenSessionCatalogIds=If(),this.visibleSessionCatalogs=()=>zd(this.sessionData.sessionCatalogs,this.hiddenSessionCatalogIds,this.sessionsStatusFilter===`archived`),this.sessionSelectionAnchor=null,this.runtimeSampledAtByRow=new WeakMap,this.attention=new $x(this),this.setSessionOwnerFilter=(e,t=!1)=>this.sessionOwnerFilter.set(e,t),this.selectSession=e=>{let t=this.getSessionNavigationState(),n=this.sessionData.sessionResultsByAgent,r=Ib({sessionKey:e,navigationState:t,sessionResultsByAgent:n}),i=Ht(r),a=zt({face:i,sessionKey:e,fallbackAgentId:t.selectedAgentId,basePath:this.basePath,row:r,mainKey:this.sessionMainKey(),preferenceDerivedFace:!0,navigationKey:e});$y(this,{commit:()=>(this.prepareSessionNavigation(e,a.options.pathname),this.onNavigate?.(i,a.options),this.bindLiteralSession(e,this.selectedAgentIdForSessions(),a.options),!0),face:i,sessionKey:e})},this.expandAgent=e=>{let t=this.context;if(!t)return;let n=r(e);if(n===r(this.expandedAgentId())){t.agentSelection.setScope(n);return}this.clearSessionSelection(),this.sessionProjection.resetMembership(),this.sessionData.visibleSessionLimits.clear(),t.agentSelection.set(n),this.sessionData.refreshSidebarSessions(n)},this.knownSectionOrder=()=>[...this.context?.sessions.state.sectionOrder??[]],this.openMainSession=e=>{if(!this.connected){this.onNavigate?.(`appearance`);return}this.clearSessionSelection(),this.selectSession(this.selectedAgentMainSessionKey(r(e)))}}sessionPeopleSortCapability(){let e=this.selectedAgentSessionResult()?.owners;return e?e.length>=2:void 0}sessionPeopleSortAvailable(){return this.sessionPeopleSortCapability()===!0}effectiveSessionSortMode(){return Wf(this.sessionSortMode,this.sessionPeopleSortAvailable())}effectiveSessionsGrouping(){let e=this.sessionsGrouping;return e===`person`&&!this.sessionPeopleSortAvailable()?`category`:e}setSessionSortMode(e){this.sessionSortMode=Gf(e,this.sessionPeopleSortCapability())}sidebarSessionOwnerFilter(){return this.sessionOwnerFilter}get sessionOwnerFilterId(){return this.sessionOwnerFilter.ownerId}get sessionInvolvingMeFilterActive(){return this.sessionOwnerFilter.involvingMe}get sessionOwnerFilterActive(){return this.sessionOwnerFilter.ownerId!==null}get sessionAttentionContext(){return this.context}get sessionDataContext(){return this.context}get collapsedSessionSections(){return this.sessionOrganizer.collapsedSessionSections}dismissTransientMenus(){return this.sidebarMenus.dismissTransientMenus()}closeAgentMenu(e){this.sidebarMenus.closeAgentMenu(e)}promoteCreatedSession(e){this.sessionProjection.promoteCreatedSession(e)&&this.requestUpdate()}updated(e){super.updated(e),this.sessionSortMode===`people`&&this.sessionPeopleSortCapability()===!1&&this.setSessionSortMode(`created`);let t=_r(this.activeRouteId)?this.getRouteSessionKey():``;_r(this.activeRouteId)&&this.sessionData.loadActiveSessionLineage(t);let n=[...this.visibleSessionRowsInOrder()];for(;n.length>0;){let e=n.shift();e&&(n.push(...e.children),e.childSessionKeys.length>0&&(e.visuallyActive||this.isSessionChildrenExpanded(e))&&!this.sessionData.loadedChildSessionKeys.has(e.key)&&!this.sessionData.childSessionErrorsByParent.has(e.key)&&!this.sessionData.loadingChildSessionKeys.has(e.key)&&this.sessionData.loadChildSessions(e.key))}let r=this.mainSessionRow();r&&(r.childSessions?.length??0)>0&&!this.sessionData.loadedChildSessionKeys.has(r.key)&&!this.sessionData.childSessionErrorsByParent.has(r.key)&&!this.sessionData.loadingChildSessionKeys.has(r.key)&&this.sessionData.loadChildSessions(r.key)}applySessionOwnerFilter(e,t){let n=Lb({projected:e,ownerFacet:t,selectedOwnerId:this.sessionOwnerFilterId,self:this.context?.gateway.snapshot.selfUser});return this.sessionOwnerFilter.observeOwnerFacet(t!==void 0,n.ownerOptions),this.sessionOwnerOptions=n.ownerOptions,this.sessionOwnershipVisible=n.ownershipVisible,this.activeSessionOwnerId=n.activeOwnerId,n.rows}getRouteSessionKey(){return this.sessionKey.trim()||this.context?.gateway.snapshot.sessionKey.trim()||``}getSessionNavigationState(){let e=this.getRouteSessionKey();return yb({context:this.context,routeSessionKey:e,sessionsResult:this.sessionData.sessionsResult,activeSession:zb(this.sessionData,e),sessionsAgentId:this.sessionData.sessionsAgentId,showCron:this.sessionsShowCron,showSystem:this.sessionsShowSystem,statusFilter:this.sessionsStatusFilter,compareSessions:this.compareSidebarSessionRows,highlightCurrentSession:_r(this.activeRouteId),runtimeSampledAtByRow:this.runtimeSampledAtByRow,loadingChildSessionKeys:this.sessionData.loadingChildSessionKeys,outboxAttentionCountForSessionKey:this.outboxAttentionCountForSession,hasSessionDraft:e=>this.hasSessionDraft(e),resolveAttention:e=>this.attention.resolveSessionAttention(e),resolveAgentStatusNote:e=>this.attention.resolveSessionAgentStatus(e)?.note})}selectedAgentIdForSessions(){return this.getSessionNavigationState().selectedAgentId}sidebarSessionStatusFilter(){return this.sessionsStatusFilter}zonedVisibleSections(e){let t=this.effectiveSessionsGrouping();return this.sessionProjection.project({rows:e,grouping:t,knownGroups:t===`category`?this.knownSessionGroups():[],selfOwnerId:this.context?.gateway.snapshot.selfUser?.id??null,sectionOrder:this.knownSectionOrder(),catalogIds:this.sessionsStatusFilter===`archived`?[]:this.visibleSessionCatalogs().map(e=>e.id),collapsedSections:this.collapsedSessionSections,hideEmptyOwnerFilteredGroup:(e,t)=>this.sessionOwnerFilterActive&&!!e&&t===0,visibleSessionLimits:this.sessionData.visibleSessionLimits,sortMode:this.effectiveSessionSortMode(),statusFilter:this.sessionsStatusFilter,agentId:this.expandedAgentId(),connectionIdentity:this.context?.gateway.snapshot.phase===`connected`?this.context.gateway.snapshot.client??null:null,listSource:this.context?.sessions??null,subtitle:{sidebarLiveActivity:this.sidebarLiveActivity,showPreview:this.sessionsShowPreview,narrationLines:this.sidebarNarrationLines,observerDigests:this.sidebarObserverDigests}})}reconciledSidebarZone(){let e=this.getSessionNavigationState(),t=this.selectedAgentSessionRows(e);return bb({sidebarEntries:this.sidebarEntries,rows:t,workboardBoards:this.workboardBoards,enabledRouteIds:this.enabledRouteIds,workboardBoardsReady:this.workboardBoardsReady,controlUiTabs:this.context?.gateway.snapshot.hello?.controlUiTabs})}pruneSidebarSessionEntry(e){let t=Er({type:`session`,key:e});this.sidebarEntries.includes(t)&&this.onUpdateSidebarEntries?.(this.sidebarEntries.filter(e=>e!==t))}visibleSessionRowsInOrder(){let e=this.getSessionNavigationState(),t=this.selectedAgentSessionRows(e),{visibleRows:n}=this.zonedVisibleSections(t),{entries:r,sessionRows:i}=this.reconciledSidebarZone();return[...r.flatMap(e=>{let t=e.type===`session`?i.get(e.key):void 0;return t?[t]:[]}),...n]}selectedVisibleSessions(){return this.selectedSessionKeys.size===0?[]:this.visibleSessionRowsInOrder().filter(e=>this.selectedSessionKeys.has(e.key))}handleSessionRowClick(e,t){if(t.isChild&&et(e)){e.preventDefault(),this.clearSessionSelection(),this.selectSession(t.key);return}if(!(t.isChild||e.defaultPrevented||e.button!==0)&&!(e.metaKey||e.ctrlKey)){if(e.shiftKey){e.preventDefault(),this.extendSessionSelection(t.key);return}if(e.altKey){e.preventDefault(),this.toggleSessionSelected(t.key);return}e.preventDefault(),this.clearSessionSelection(),this.selectSession(t.key)}}toggleSessionSelected(e){let t=xb(this.selectedSessionKeys,e);this.sessionSelectionAnchor=t.anchor,this.selectedSessionKeys=t.selectedKeys}extendSessionSelection(e){let t=Sb({rows:this.visibleSessionRowsInOrder(),anchor:this.sessionSelectionAnchor,key:e});this.sessionSelectionAnchor=t.anchor,this.selectedSessionKeys=t.selectedKeys}clearSessionSelection(){this.sessionSelectionAnchor=null,this.selectedSessionKeys.size>0&&(this.selectedSessionKeys=new Set)}expandedAgentId(){let e=w(this.context?.agentSelection.state.selectedId);return r(e||this.getSessionNavigationState().selectedAgentId)}activeChipAgent(){return wb({activeId:this.expandedAgentId(),roster:this.context?.agents.state.agentsList?.agents??[],identities:this.context?.agentIdentity.entries()??[]})}latestAgentSessionRow(e){return Tb({agentId:e,sessionData:this.sessionData,context:this.context})}agentResumeKey(e){return kb(this.latestAgentSessionRow(e),e,this.sessionMainKey())}openAgentConversation(e){if(!this.connected){this.onNavigate?.(`appearance`);return}this.selectSession(this.agentResumeKey(e))}agentChipSubtitle(e){return Ab(this.latestAgentSessionRow(e))}switchChipAgent(e){this.closeAgentMenu(),this.expandAgent(e),this.openAgentConversation(e)}askAgentCapabilities(e){if(this.closeAgentMenu(),!this.connected)return;let t=this.agentResumeKey(e),n=zt({face:`chat`,sessionKey:t,fallbackAgentId:e,basePath:this.basePath,row:this.findSidebarSessionByKey(t),mainKey:this.sessionMainKey()});this.setApplicationSession(t,this.selectedAgentIdForSessions()),this.onNavigate?.(`chat`,{...n.options,search:Ze(W(`chat.welcome.suggestions.whatCanYouDo`))})}knownSessionGroups(){return Pb(this.context?.sessions.state.groups??[],this.sessionData.sessionsResult?.sessions??[])}knownSessionCatalogIds(){return jb({loadedCatalogIds:this.sessionData.sessionCatalogs.map(e=>e.id),hasLoaded:this.sessionData.sessionCatalogRefreshStatus.hasLoaded,sectionOrder:this.knownSectionOrder()})}findSidebarSessionByKey(e){return Ib({sessionKey:e,navigationState:this.getSessionNavigationState(),sessionResultsByAgent:this.sessionData.sessionResultsByAgent})}findSidebarHovercardRowByKey(e){return Bb(this,e)}selectedAgentSessionRows(e){let t=Rd(this.visibleSessionCatalogs()),n=this.expandedAgentId(),i=r(this.sessionData.sessionsAgentId??``),a=r(e.selectedAgentId),o={agentId:n,defaultAgentId:Be({agentsList:this.context?.agents.state.agentsList,hello:this.context?.gateway.snapshot.hello}),filterByAgent:!0,showCron:this.sessionsShowCron,showSystem:this.sessionsShowSystem,archivedFilter:this.sessionsStatusFilter},{childSessionRowsByParent:s,isSessionHidden:c,rows:l}=cb({sessionData:this.sessionData,selectedAgentId:n,statusFilter:this.sessionsStatusFilter,deletionState:(e,t)=>this.context?.sessions.deletionState(e,t),archiveVisibility:e=>this.context?.sessions.archiveVisibility(e)}),u=new Map(l.map(e=>[e.key,e])),d=n===a&&n===i?e.visibleSessionRows.flatMap(e=>{let t=u.get(e.key);return t?[t]:[]}):un(l,o).toSorted(this.compareSidebarSessionRows),f=this.selectedAgentMainSessionKey(n),p=this.sessionData.activeSessionLineageRoot,m=r(E(p?.key??``)?.agentId??``),h=e.visibleSessionRows.find(r=>(n===a||m===n)&&r.key===e.activeRowKey&&!c(r.key)&&!t.has(r.key)&&!j(r.key,f)),g=new Set([f]),_=d.filter(e=>!j(e.key,f)||(g.add(e.key),!1)),v=r(E(e.routeSessionKey)?.agentId??``);p&&!c(p.key)&&(j(p.key,e.routeSessionKey)||St(p,this.sessionsStatusFilter))&&(m===n||v===n)&&!t.has(p.key)&&!j(p.key,f)&&!_.some(e=>e.key===p.key)&&_.push(p);let y=Eb({rows:l,childRowsByParent:s}),b=Ob({rows:y,scopedRoots:_,visibilityOptions:o});_.push(...b);let x=new Set(_.map(e=>e.key)),S=Db({rows:y,mainSessionKeys:g,scopedRootKeys:x,showCron:this.sessionsShowCron,showSystem:this.sessionsShowSystem});for(let e of S)x.has(e.key)||(x.add(e.key),_.push(e));let C=lx({roots:(S.length>0||b.length>0?_.toSorted(this.compareSidebarSessionRows):_).filter(e=>!t.has(e.key)),agentRows:l,childRowsByParent:s,loadingChildKeys:this.sessionData.loadingChildSessionKeys,knownSessionAttention:this.attention.knownSessionAttention(),toSidebarSession:e.toSidebarSession});return h&&!Fb(C,e=>e.key===h.key)&&C.unshift(e.toSidebarSession(h)),this.applySessionOwnerFilter(C,this.selectedAgentSessionResult()?.owners)}selectedAgentSessionResult(){let e=this.expandedAgentId();return e===r(this.sessionData.sessionsAgentId??``)?this.sessionData.sessionsResult:this.sessionData.sessionResultsByAgent[e]??null}selectedAgentMainSessionKey(e){return Mb({agentId:e??this.expandedAgentId(),agentsList:this.context?.agents.state.agentsList,hello:this.context?.gateway.snapshot.hello})}resolveHomeSessionAttention(e,t){return hb(this.attention,e,t)}mainSessionRow(e){let t=r(e??this.expandedAgentId()),n=this.selectedAgentMainSessionKey(t);return Nb(t===r(this.sessionData.sessionsAgentId??``)?this.sessionData.sessionsResult?.sessions??[]:this.sessionData.sessionResultsByAgent[t]?.sessions??[],n)}isSessionChildrenExpanded(e){return this.sessionProjection.isChildrenExpanded(e.key)}isSessionChildrenFullyShown(e){return this.sessionProjection.isChildrenFullyShown(e)}toggleSessionChildren(e){this.sessionProjection.toggleChildren(e).expanded?this.sessionData.retryChildSessions(e.key):this.sessionData.discardEmptyChildSessionSnapshot(e.key),this.requestUpdate()}showMoreChildren(e){this.sessionProjection.showMoreChildren(e),this.requestUpdate()}agentUnreadCount(e){return(this.sessionData.sessionResultsByAgent[r(e)]?.sessions??[]).filter(e=>e.unread===!0&&e.archived!==!0).length}},S([B()],lC.prototype,`sessionSortMode`,void 0),S([B()],lC.prototype,`selectedSessionKeys`,void 0),S([B()],lC.prototype,`sessionsGrouping`,void 0),S([B()],lC.prototype,`sessionsShowCron`,void 0),S([B()],lC.prototype,`sessionsShowPreview`,void 0),S([B()],lC.prototype,`sessionsShowSystem`,void 0),S([B()],lC.prototype,`sessionsStatusFilter`,void 0),S([B()],lC.prototype,`hiddenSessionCatalogIds`,void 0)})))()}function dC(e){return(Rm(e)^mC)>>>0}function fC(e){let t=null;for(let n of e??[]){if(!n.status||n.status===`running`)continue;let e=n.endedAt??n.lastActivityAt??n.updatedAt??0;(!t||e>t.at)&&(t={at:e,outcome:n.status===`failed`||n.status===`timeout`?`error`:n.status===`killed`?`aborted`:`ok`})}return t?.outcome??`ok`}function pC(e,t){return e?t?.some(We)?`busy`:`idle`:`offline`}var mC;function hC(){return(hC=t((()=>{mC=Math.trunc(Math.random()*4294967295)})))()}var gC;function _C(){return(_C=t((()=>{Vr(),V(),tf(),bf(),G(),f(),gC=class{constructor(e){this.host=e,this.collapsedSessionSections=Ff(),this.draggingSessionKey=null,this.draggingSidebarSection=null,this.sessionDropTarget=null,this.sidebarSectionDropTarget=null,this.draggingSidebarEntry=null,this.sidebarZoneDropTarget=null,this.sessionListRemovalDrop=!1,this.operationsLoad=null,this.patchSession=async(e,t,n=this.host.sessionData.beginSessionMutation())=>{if(!n)return`stale`;let r=await this.loadOperations(n);return r?r.patchSession(this.host,e,t,n):this.host.sessionData.isSessionMutationScopeCurrent(n)?`failed`:`stale`}}async loadOperations(e){let t=this.operationsLoad??=d(()=>import(`./session-organizer-operations.runtime-Bya7cfJM.js`),__vite__mapDeps([18,1,3,2,4,5,6,7,8,19]),import.meta.url);try{return await t}catch(n){return this.operationsLoad===t&&(this.operationsLoad=null),this.host.sessionData.isSessionMutationScopeCurrent(e)&&this.host.sessionData.publishSessionMutationError(e,n),null}}async patchSessions(e,t,n=this.host.sessionData.beginSessionMutation()){if(!n)return`stale`;let r=await this.loadOperations(n);return r?r.patchSessions(this.host,e,t,n):this.host.sessionData.isSessionMutationScopeCurrent(n)?`failed`:`stale`}async archiveSessionWithUndo(e){let t=this.host.sessionData.beginSessionMutation();t&&await(await this.loadOperations(t))?.archiveSessionWithUndo(this.host,e,t)}async deleteSessionsBatch(e){let t=this.host.sessionData.beginSessionMutation();t&&await(await this.loadOperations(t))?.deleteSessionsBatch(this.host,e,t)}async runBatchSessionAction(e,t,n){if(e.kind===`new-group`){await this.createSessionGroup(t);return}let r=this.host.sessionData.beginSessionMutation();r&&await(await this.loadOperations(r))?.runBatchSessionAction(this.host,e,t,n,r)}async forkSession(e){let t=this.host.sessionData.beginSessionMutation();t&&await(await this.loadOperations(t))?.forkSession(this.host,e,t)}async stopCloudWorker(e){let t=this.host.sessionData.beginSessionMutation();t&&await(await this.loadOperations(t))?.stopCloudWorker(this.host,e,t)}async assignSessionOwner(e,t){let n=this.host.sessionData.beginSessionMutation();n&&await(await this.loadOperations(n))?.assignSessionOwner(this.host,e,t,n)}async deleteSession(e){let t=this.host.sessionData.beginSessionMutation();t&&await(await this.loadOperations(t))?.deleteSession(this.host,e,t,{offerSkip:!0})}startSidebarRouteDrag(e,t){e.dataTransfer&&(Yd(e.dataTransfer,t),this.draggingSidebarEntry=Er({type:`route`,route:t}),this.host.requestUpdate())}startSidebarWorkboardDrag(e,t){if(!e.dataTransfer)return;let n=Er({type:`workboard`,boardId:t});Yd(e.dataTransfer,n),this.draggingSidebarEntry=n,this.host.requestUpdate()}finishSidebarEntryDrag(){this.draggingSidebarEntry=null,this.host.requestUpdate(),this.draggingSessionKey=null,this.host.requestUpdate(),this.sidebarZoneDropTarget=null,this.host.requestUpdate(),this.sessionListRemovalDrop=!1,this.host.requestUpdate()}startSessionDrag(e){this.draggingSessionKey=e.key,this.host.requestUpdate(),this.draggingSidebarEntry=e.pinned?`session:${e.key}`:null,this.host.requestUpdate()}finishSessionDrag(){this.finishSidebarEntryDrag(),this.sessionDropTarget=null,this.host.requestUpdate()}startSidebarSectionDrag(e){this.draggingSidebarSection=e,this.host.requestUpdate()}finishSidebarSectionDrag(){this.draggingSidebarSection=null,this.host.requestUpdate(),this.sidebarSectionDropTarget=null,this.host.requestUpdate()}draggedSidebarEntry(e){let t=Xd(e),n=Lr(t?`route:${t}`:null);if(n?.type===`route`)return Er(n);let r=Lr(t);if(r?.type===`workboard`)return Er(r);let i=Wd(e);return i?Er({type:`session`,key:i}):null}handleSidebarZoneDragOver(e,t){if(!Zd(e.dataTransfer)&&!Gd(e.dataTransfer))return;if(e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),!t){this.sidebarZoneDropTarget=null,this.host.requestUpdate();return}let n=e.currentTarget.getBoundingClientRect();this.sidebarZoneDropTarget={entry:t,position:e.clientY<n.top+n.height/2?`before`:`after`},this.host.requestUpdate()}handleSidebarZoneDragLeave(e){let t=e.currentTarget;e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.sidebarZoneDropTarget=null,this.host.requestUpdate())}writeSidebarEntryAt(e,t,n){let r=this.host.reconciledSidebarZone().sidebarEntries.filter(t=>t!==e),i=t?r.indexOf(t):-1,a=+(n===`after`);r.splice(i<0?r.length:i+a,0,e),this.host.onUpdateSidebarEntries?.(r)}handleSidebarZoneDrop(e,t){let n=this.draggedSidebarEntry(e.dataTransfer);if(!n)return;if(e.preventDefault(),e.stopPropagation(),t===n){this.finishSidebarEntryDrag();return}let r=this.sidebarZoneDropTarget?.position,i=Wd(e.dataTransfer),a=i?this.host.findSidebarSessionByKey(i):void 0;a&&!a.pinned?this.patchSession(a,{pinned:!0}).then(e=>{e===`completed`&&this.writeSidebarEntryAt(n,t,r)}):this.writeSidebarEntryAt(n,t,r),this.finishSidebarEntryDrag()}removeSidebarEntry(e){let t=this.host.reconciledSidebarZone().sidebarEntries.filter(t=>t!==e);this.host.onUpdateSidebarEntries?.(t)}handleSessionListDragOver(e){let t=Zd(e.dataTransfer),n=Wd(e.dataTransfer),r=n?this.host.findSidebarSessionByKey(n):void 0;!t&&!r?.pinned||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`),this.sessionListRemovalDrop=!0,this.host.requestUpdate())}handleSessionListDragLeave(e){let t=e.currentTarget;e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||(this.sessionListRemovalDrop=!1,this.host.requestUpdate())}handleSessionListDrop(e){let t=Xd(e.dataTransfer),n=Lr(t?`route:${t}`:null),r=Lr(t),i=n?.type===`route`?n:r?.type===`workboard`?r:null;if(i){e.preventDefault(),this.removeSidebarEntry(Er(i)),this.finishSidebarEntryDrag();return}let a=Wd(e.dataTransfer),o=a?this.host.findSidebarSessionByKey(a):void 0;o?.pinned&&(e.preventDefault(),this.patchSession(o,{pinned:!1})),this.finishSidebarEntryDrag()}async loadInputDialog(){try{return(await d(async()=>{let{showInputDialog:e}=await import(`./input-dialog-BErqtvL-.js`);return{showInputDialog:e}},__vite__mapDeps([20,1,2,3,4,5,6,7,8]),import.meta.url)).showInputDialog}catch(e){let t=this.host.sessionData.beginSessionMutation();return t&&this.host.sessionData.publishSessionMutationError(t,e),null}}async renameSession(e){let t=await(await this.loadInputDialog())?.({title:W(`sessionsView.renameSessionPrompt`),defaultValue:w(e.userLabel)??``})??null;if(t===null)return;let n=this.host.sessionData.beginSessionMutation();n&&await(await this.loadOperations(n))?.renameSession(this.host,e,t,n)}async createSessionGroup(e=[]){await(await this.loadInputDialog())?.({title:W(`sessionsView.newGroupTitle`),label:W(`sessionsView.newGroupPrompt`),submitLabel:W(`sessionsView.newGroupCreate`),requireValue:!0,submit:t=>this.writeSessionGroup(t,e)})}async writeSessionGroup(e,t){let n=this.host.sessionData.beginSessionMutation();if(!n)return W(`sessionsView.newGroupFailed`);let r=await this.loadOperations(n);if(!r)return this.host.sessionData.isSessionMutationScopeCurrent(n)?this.sessionGroupFailure():W(`sessionsView.newGroupStale`);let i=await r.createSessionGroup(this.host,e,t,n);return i===`failed`?this.sessionGroupFailure():i===`stale`?W(`sessionsView.newGroupStale`):null}sessionGroupFailure(){return this.host.sessionData.sessionMutationError??W(`sessionsView.newGroupFailed`)}async renameSessionGroupFromMenu(e){let t=await(await this.loadInputDialog())?.({title:W(`sessionsView.renameGroupTitle`,{group:e}),label:W(`sessionsView.groupNameLabel`),defaultValue:e,requireValue:!0,requireChange:!0});if(!t)return;let n=this.host.sessionData.beginSessionMutation();if(!n)return;let r=await this.loadOperations(n);if(!r||!await r.renameSessionGroup(this.host,e,t,n))return;let i=`category:${e}`;if(this.collapsedSessionSections.has(i)){let e=new Set(this.collapsedSessionSections);e.delete(i),e.add(`category:${t}`),this.saveCollapsedSessionSections(e)}this.host.requestUpdate()}async deleteSessionGroupFromMenu(e){let t=this.host.sessionData.beginSessionMutation();if(!t)return;let n=await this.loadOperations(t);if(!n||!await n.deleteSessionGroup(this.host,e,t))return;let r=new Set(this.collapsedSessionSections);r.delete(`category:${e}`),this.saveCollapsedSessionSections(r),this.host.requestUpdate()}async editSessionGroupDefaults(e){let t;try{t=(await d(async()=>{let{showSessionGroupDefaultsDialog:e}=await import(`./session-group-defaults-dialog-Db8Bcufo.js`);return{showSessionGroupDefaultsDialog:e}},__vite__mapDeps([21,1,3,2,4,5,6,7,8,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39]),import.meta.url)).showSessionGroupDefaultsDialog}catch(e){let t=this.host.sessionData.beginSessionMutation();t&&this.host.sessionData.publishSessionMutationError(t,e);return}let n=this.host.sessionGroupDefaults(e);n&&await t({group:e,defaults:n,listDirectory:e=>this.host.listSessionGroupFolders(e),inspectRepository:e=>this.host.inspectSessionGroupRepository(e),submit:async t=>{let n=this.host.sessionData.beginSessionMutation();if(!n||!this.host.sessionGroupDefaults(e))return W(`sessionsView.groupDefaultsStale`);let r=await(await this.loadOperations(n))?.updateSessionGroupDefaults(this.host,e,{cwd:t.cwd||null,worktree:t.worktree},n);return r===`completed`?null:r===`stale`?W(`sessionsView.groupDefaultsStale`):this.host.sessionData.sessionMutationError??W(`sessionsView.groupDefaultsFailed`)}})}saveCollapsedSessionSections(e){this.collapsedSessionSections=new Set(e),this.host.requestUpdate();try{Kf(e)}catch{}}toggleSection(e){let t=new Set(this.collapsedSessionSections);t.has(e)?t.delete(e):t.add(e),this.saveCollapsedSessionSections(t)}async reorderSidebarSection(e,t,n){let r=this.host.sessionData.beginSessionMutation();r&&await(await this.loadOperations(r))?.reorderSidebarSection(this.host,e,t,n,r)}async assignSessionCategory(e,t,n={}){let r=this.host.sessionData.beginSessionMutation();r&&await(await this.loadOperations(r))?.assignSessionCategory(this.host,e,t,r,n)}sectionAcceptsSession(e,t,n){return e===`pinned`||this.host.sessionsGrouping===`category`&&(e===`ungrouped`||t)?!0:e===`groups`&&!!(n&&mf(n,this.host.sessionsGrouping))}sectionDragOver(e,t,n){let r=e.dataTransfer;if(Jd(r)&&this.draggingSidebarSection!==t){e.preventDefault(),r&&(r.dropEffect=`move`);let n=e.currentTarget,i=(n.querySelector(`:scope > .sidebar-recent-sessions__head`)??n).getBoundingClientRect(),a=e.clientY<i.top+i.height/2?`before`:`after`;this.sidebarSectionDropTarget={sectionId:t,position:a},this.host.requestUpdate(),this.sessionDropTarget=null,this.host.requestUpdate();return}if(!Gd(r))return;let i=this.draggingSessionKey?this.host.findSidebarSessionByKey(this.draggingSessionKey):void 0;if(!this.sectionAcceptsSession(t,n,i)){e.stopPropagation();return}e.preventDefault(),r&&(r.dropEffect=`move`),this.sessionDropTarget=t,this.host.requestUpdate(),this.sidebarSectionDropTarget=null,this.host.requestUpdate()}sectionDragLeave(e,t,n){let r=e.currentTarget;e.relatedTarget instanceof Node&&r.contains(e.relatedTarget)||(this.sessionDropTarget===t&&(this.sessionDropTarget=null,this.host.requestUpdate()),this.sidebarSectionDropTarget?.sectionId===t&&(this.sidebarSectionDropTarget=null,this.host.requestUpdate()))}sectionDrop(e,t,n){let r=qd(e.dataTransfer),i=Wd(e.dataTransfer);if(!r&&!i)return;let a=i?this.host.findSidebarSessionByKey(i):void 0;if(!r&&!this.sectionAcceptsSession(t,n,a)){e.stopPropagation();return}if(e.preventDefault(),e.stopPropagation(),r&&r!==t){let e=this.sidebarSectionDropTarget?.sectionId===t?this.sidebarSectionDropTarget.position:`before`;this.reorderSidebarSection(r,t,e)}else if(a&&t===`pinned`)a.pinned||this.patchSession(a,{pinned:!0});else if(a){let e=n??null;(a.category!==e||a.pinned)&&this.assignSessionCategory(a,e,a.pinned?{pinned:!1}:{})}this.finishSidebarEntryDrag(),this.draggingSidebarSection=null,this.host.requestUpdate(),this.sessionDropTarget=null,this.host.requestUpdate(),this.sidebarSectionDropTarget=null,this.host.requestUpdate()}setSessionsGrouping(e){this.host.sessionsGrouping=e;try{Lf(e)}catch{}}setSessionsShowCron(e){this.host.sessionsShowCron=e;try{zf(e)}catch{}}setSessionsShowPreview(e){this.host.sessionsShowPreview=e;try{Bf(e)}catch{}}setSessionsShowSystem(e){this.host.sessionsShowSystem=e;try{Vf(e)}catch{}}setSessionsStatusFilter(e){if(e!==this.host.sessionsStatusFilter){this.host.sessionsStatusFilter=e,this.host.clearSessionSelection(),this.host.sessionData.resetSessionList();try{Hf(e)}catch{}this.host.sessionData.refreshSidebarSessions()}}}})))()}var vC;function yC(){return(yC=t((()=>{I(),R(),V(),M(),Si(),U(),ai(),li(),vC=class extends Et{constructor(...e){super(...e),this.x=0,this.y=0,this.trigger=null,this.lastActive=``,this.terminalDisabled=!1,this.onAction=()=>{},this.onClose=()=>{},this.menuLifecycle=new ei(this,{getTrigger:()=>this.trigger,onClose:()=>this.onClose()}),this.handleSelect=e=>{e.preventDefault();let t=e.detail.item.value;t&&this.run(t)},this.handleAfterHide=e=>{e.currentTarget instanceof Node&&e.currentTarget.isConnected&&this.onClose()}}connectedCallback(){super.connectedCallback(),si(this)}run(e){this.onAction(e),this.onClose()}render(){let e=Math.max(8,Math.min(this.x,window.innerWidth-240-8)),t=Math.max(8,Math.min(this.y,window.innerHeight-140-8)),n=W(`chat.catalog.sessionMenu`);return F`
|
|
<wa-dropdown
|
|
class="session-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${n}
|
|
@wa-select=${this.handleSelect}
|
|
@wa-after-hide=${this.handleAfterHide}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${n}
|
|
style="position: fixed; left: ${e}px; top: ${t}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
${this.lastActive?F`<div class="session-menu__info">
|
|
${W(`sessionsView.lastActive`,{time:this.lastActive})}
|
|
</div>`:``}
|
|
<wa-dropdown-item class="session-menu__item" value="viewer">
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true"
|
|
>${H.messageSquare}</span
|
|
>
|
|
<span class="session-menu__text">${W(`chat.catalog.openInOpenClaw`)}</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="terminal"
|
|
title=${this.terminalDisabled?W(`chat.catalog.terminalUnavailable`):``}
|
|
?disabled=${this.terminalDisabled}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.terminal}</span>
|
|
<span class="session-menu__text">${W(`chat.catalog.openInTerminal`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`}},S([z({attribute:!1})],vC.prototype,`x`,void 0),S([z({attribute:!1})],vC.prototype,`y`,void 0),S([z({attribute:!1})],vC.prototype,`trigger`,void 0),S([z({attribute:!1})],vC.prototype,`lastActive`,void 0),S([z({attribute:!1})],vC.prototype,`terminalDisabled`,void 0),S([z({attribute:!1})],vC.prototype,`onAction`,void 0),S([z({attribute:!1})],vC.prototype,`onClose`,void 0),customElements.get(`openclaw-catalog-session-menu`)||customElements.define(`openclaw-catalog-session-menu`,vC)})))()}function bC(e){if(e instanceof PointerEvent&&e.pointerType===`touch`)return null;for(let t of e.composedPath()){if(t instanceof HTMLElement&&t.matches(TC))return t;if(t===e.currentTarget)break}return null}function xC(e){return e.matches(CC)?`horizontal`:`vertical`}var SC,CC,wC,TC;function EC(){return(EC=t((()=>{SC=`a.markdown-session-link[data-session-key]`,CC=`.sidebar-recent-session[data-session-key]`,wC=`openclaw-session-menu-open`,TC=`${SC}, ${CC}`})))()}var DC;function OC(){return(OC=t((()=>{I(),by(),yC(),EC(),DC=class{constructor(e){this.hooks=e,this.state=null,this.trigger=null}get isOpen(){return this.state!==null}isOpenFor(e){let t=this.state?.key;return t?.catalogId===e.catalogId&&t.hostId===e.hostId&&t.threadId===e.threadId}open(e,t,n,r=null){r?.dispatchEvent(new CustomEvent(wC,{bubbles:!0,composed:!0})),this.hooks.beforeOpen(),this.trigger=r,this.state={...e,x:t,y:n},this.hooks.requestUpdate()}close(){!this.state&&!this.trigger||(this.trigger=null,this.state=null,this.hooks.requestUpdate())}retargetTrigger(e,t){!(t instanceof HTMLElement)||!this.isOpenFor(e)||queueMicrotask(()=>{t.isConnected&&!this.trigger?.isConnected&&this.isOpenFor(e)&&(this.trigger=t,this.hooks.requestUpdate())})}handleAction(e,t){if(t===`terminal`){e.canOpenTerminal&&this.hooks.terminalAvailable()&&vy(e.key,e.agentId);return}this.hooks.navigate(e)}render(){let e=this.state;return e?F`
|
|
<openclaw-catalog-session-menu
|
|
.x=${e.x}
|
|
.y=${e.y}
|
|
.trigger=${this.trigger}
|
|
.lastActive=${e.meta}
|
|
.terminalDisabled=${!e.canOpenTerminal||!this.hooks.terminalAvailable()}
|
|
.onAction=${t=>this.handleAction(e,t)}
|
|
.onClose=${()=>this.close()}
|
|
></openclaw-catalog-session-menu>
|
|
`:P}}})))()}function kC(e){if(!e||typeof e!=`object`)return null;let t=e;return Array.isArray(t.gateways)&&typeof t.currentId==`string`?t:null}function AC(){if(typeof window>`u`)return null;let e=window,t=e.webkit?.messageHandlers?.openclawGateways;if(!t?.postMessage)return null;let n=t.postMessage.bind(t),r=(e,t)=>n({type:e,id:t}),i=kC(e.__OPENCLAW_NATIVE_GATEWAYS__),a=new Set;return window.addEventListener(MC,e=>{let t=kC(e.detail);t&&(i=t,a.forEach(e=>e(t)))}),{get snapshot(){return i},subscribe(e){return a.add(e),()=>a.delete(e)},select:e=>r(`select`,e),openWindow:e=>r(`open-window`,e),setPrimary:e=>r(`set-primary`,e),openSettings:()=>n({type:`open-settings`})}}function jC(){return NC===void 0&&(NC=AC()),NC}var MC,NC;function PC(){return(PC=t((()=>{MC=`openclaw:native-gateways-changed`})))()}function FC(){let e=jC()?.snapshot;return e?.gateways.find(t=>t.id===e.currentId)?.kind===`local`}function IC(e,t){return t||!FC()?null:/^(?:\/|[a-z]:[\\/]|\\\\)/i.test(e.path)?e.path:e.root?`${e.root.replace(/[\\/]+$/,``)}/${e.path.replace(/^[\\/]+/,``)}`:null}function LC(e,t){new fn(e).watch(jC,(e,t)=>e.subscribe(t),t)}function RC(){return(RC=t((()=>{bn(),PC()})))()}function zC(e){for(let t of UC){let n=e.find(e=>e.state===t);if(n)return n.url}return null}async function BC(e){try{return zC((await e.loadPullRequests?.())?.pullRequests??[])}catch{return null}}async function VC(e){let t=e.worktreeId;if(!t||e.execNode||!FC())return null;try{return(await e.client.request(`worktrees.list`,{})).worktrees.find(e=>e.id===t&&e.removedAt===void 0)?.path??null}catch{return null}}async function HC(e){let[t,n]=await Promise.all([BC(e),VC(e)]);return{pullRequestUrl:t,worktreePath:n}}var UC;function WC(){return(WC=t((()=>{RC(),UC=[`open`,`draft`,`merged`,`closed`]})))()}var GC,KC,qC,JC;function YC(){return(YC=t((()=>{I(),Vr(),$r(),Fa(),tx(),Se(),O(),OC(),Fv(),WC(),EC(),f(),GC=300,KC=200,qC=264,JC=class{constructor(e){this.host=e,this.customizeMenuPosition=null,this.moreMenuPosition=null,this.sessionMenu=null,this.sessionMenuWork=null,this.sessionGroupMenu=null,this.sessionSortMenuPosition=null,this.catalogViewMenuPosition=null,this.agentMenuPosition=null,this.identityMenuPosition=null,this.customizeMenuTrigger=null,this.moreMenuTrigger=null,this.sessionMenuTrigger=null,this.sessionMenuWorkVersion=0,this.sessionGroupMenuTrigger=null,this.sessionSortMenuTrigger=null,this.catalogViewMenuTrigger=null,this.agentMenuTrigger=null,this.agentMenuInteractionState=`closed`,this.identityMenuTrigger=null,this.agentMenuHoverOpenTimer=null,this.agentMenuHoverCloseTimer=null,this.agentMenuFocusBeforeHover=null,this.routePreloadTimers=new Map,this.menuRenderer=null,this.menuRendererImport=Ue(()=>d(()=>import(`./sidebar-menus-render-ACpRlCrG.js`),[],import.meta.url),e=>{this.menuRenderer=e,this.host.requestUpdate()}),this.cancelPreload=e=>{kr(this.routePreloadTimers,e)},this.openCustomizeMenuFromContext=e=>{e.preventDefault(),this.openCustomizeMenu(e.clientX,e.clientY)},e.addController(this),this.catalogMenu=new DC({beforeOpen:()=>void this.dismissTransientMenus(),requestUpdate:()=>e.requestUpdate(),terminalAvailable:()=>e.terminalAvailable,navigate:({routeId:t,navigation:n})=>e.onNavigate?.(t,n)})}hostConnected(){this.menuRendererImport.schedule()}hostDisconnected(){this.menuRendererImport.dispose(),this.clearAgentMenuHoverTimers();for(let e of this.routePreloadTimers.values())globalThis.clearTimeout(e);this.routePreloadTimers.clear()}updateState(e,t){Object.assign(this,{[e]:t}),this.host.requestUpdate()}preloadMenuRenderer(){return this.menuRendererImport.load()}loadMenuRenderer(){this.preloadMenuRenderer().catch(()=>void 0)}dismissTransientMenus(){let e=!!(this.customizeMenuPosition||this.moreMenuPosition||this.sessionMenu||this.catalogMenu.isOpen||this.sessionGroupMenu||this.sessionSortMenuPosition||this.catalogViewMenuPosition||this.agentMenuPosition||this.identityMenuPosition);return this.closeCustomizeMenu(),this.closeMoreMenu(),this.closeSessionMenu(),this.catalogMenu.close(),this.closeSessionGroupMenu(),this.closeSessionSortMenu(),this.closeCatalogViewMenu(),this.closeAgentMenu(),this.closeIdentityMenu(),e}preloadRoute(e,t,n=!1){Ir(this.routePreloadTimers,e,t,e=>this.host.onPreloadRoute?.(e),e===this.host.activeRouteId||!this.isRouteEnabled(e),n)}isRouteEnabled(e){return this.host.enabledRouteIds?.includes(e)??!0}openCustomizeMenu(e,t,n=null){this.loadMenuRenderer(),this.dismissTransientMenus(),this.customizeMenuTrigger=n,this.updateState(`customizeMenuPosition`,{x:Math.max(8,Math.min(e,window.innerWidth-240-8)),y:Math.max(8,Math.min(t,window.innerHeight-420-8))})}closeCustomizeMenu(e={}){let t=this.customizeMenuTrigger;this.customizeMenuTrigger=null,this.updateState(`customizeMenuPosition`,null),e.restoreFocus&&t?.focus()}toggleMoreMenu(e){if(this.moreMenuPosition){this.closeMoreMenu();return}this.loadMenuRenderer();let t=e.getBoundingClientRect();this.dismissTransientMenus(),this.moreMenuTrigger=e,this.updateState(`moreMenuPosition`,{x:Math.max(8,Math.min(t.left,window.innerWidth-240-8)),y:Math.max(8,Math.min(t.bottom+4,window.innerHeight-420-8))})}closeMoreMenu(e={}){let t=this.moreMenuTrigger;this.moreMenuTrigger=null,this.updateState(`moreMenuPosition`,null),e.restoreFocus&&t?.focus()}openSessionMenu(e,t,n,r=null){r?.dispatchEvent(new CustomEvent(wC,{bubbles:!0,composed:!0})),this.host.selectedSessionKeys.has(e.key)||this.host.clearSessionSelection(),this.showSessionMenu(e,t,n,r)}showSessionMenu(e,t,n,r=null){this.loadMenuRenderer(),this.dismissTransientMenus(),this.sessionMenuTrigger=r,this.updateState(`sessionMenu`,{session:e,x:t,y:n}),this.loadSessionMenuWork(e)}closeSessionMenu(){let e=this.host.sessionDataContext?.gateway;e&&Zb(e).unwatch(this),this.sessionMenuTrigger=null,this.sessionMenuWorkVersion+=1,this.updateState(`sessionMenu`,null),this.updateState(`sessionMenuWork`,null)}loadSessionMenuWork(e){let t=++this.sessionMenuWorkVersion;if(!e.worktreeId){this.updateState(`sessionMenuWork`,null);return}this.updateState(`sessionMenuWork`,{loading:!0,pullRequestUrl:null,worktreePath:null});let n=this.host.sessionDataContext,r=n?.gateway.snapshot.client;if(!n||!r){this.updateState(`sessionMenuWork`,{loading:!1,pullRequestUrl:null,worktreePath:null});return}let{selectedAgentId:i}=this.host.getSessionNavigationState(),a=Zb(n.gateway),o=Jb(e.key,E(e.key)?.agentId??i);HC({client:r,loadPullRequests:Na(n.gateway.snapshot,`controlUi.sessionPullRequests.subscribe`)===!0?()=>a.load(this,o):void 0,worktreeId:e.worktreeId,execNode:e.execNode}).then(e=>{t===this.sessionMenuWorkVersion&&this.updateState(`sessionMenuWork`,{loading:!1,...e})})}openSessionGroupMenu(e,t,n,r){this.loadMenuRenderer(),this.dismissTransientMenus(),this.sessionGroupMenuTrigger=r,this.updateState(`sessionGroupMenu`,{group:e,x:Math.max(8,Math.min(t,window.innerWidth-224-8)),y:Math.max(8,Math.min(n,window.innerHeight-160-8))})}closeSessionGroupMenu(e={}){let t=this.sessionGroupMenuTrigger;this.sessionGroupMenuTrigger=null,this.updateState(`sessionGroupMenu`,null),e.restoreFocus&&t?.focus()}toggleSessionSortMenu(e){if(this.sessionSortMenuPosition){this.closeSessionSortMenu();return}this.loadMenuRenderer();let t=e.getBoundingClientRect();this.dismissTransientMenus(),this.sessionSortMenuTrigger=e,this.updateState(`sessionSortMenuPosition`,{x:Math.max(8,Math.min(t.right,window.innerWidth-200-8)),y:Math.max(8,Math.min(t.bottom+4,window.innerHeight-280-8))})}toggleCatalogViewMenu(e,t){if(this.catalogViewMenuPosition?.catalogId===e){this.closeCatalogViewMenu();return}let n=t.getBoundingClientRect();this.openCatalogViewMenu(e,n.right,n.bottom+4,t)}openCatalogViewMenu(e,t,n,r=null){this.loadMenuRenderer(),this.dismissTransientMenus(),this.catalogViewMenuTrigger=r,this.updateState(`catalogViewMenuPosition`,{catalogId:e,x:Math.max(8,Math.min(t,window.innerWidth-200-8)),y:Math.max(8,Math.min(n,window.innerHeight-360-8))})}closeCatalogViewMenu(e={}){let t=this.catalogViewMenuTrigger;this.catalogViewMenuTrigger=null,this.updateState(`catalogViewMenuPosition`,null),e.restoreFocus&&t?.focus()}closeSessionSortMenu(e={}){let t=this.sessionSortMenuTrigger;this.sessionSortMenuTrigger=null,this.updateState(`sessionSortMenuPosition`,null),e.restoreFocus&&t?.focus()}toggleAgentMenu(e){if(this.clearAgentMenuHoverTimers(),this.agentMenuInteractionState===`open-click`){this.closeAgentMenu();return}if(this.agentMenuInteractionState===`open-hover`){this.agentMenuFocusBeforeHover=null,this.updateState(`agentMenuInteractionState`,`open-click`);return}this.openAgentMenu(e,`open-click`)}openAgentMenu(e,t){this.clearAgentMenuHoverTimers(),this.loadMenuRenderer();let n=qC,r=e.getBoundingClientRect();this.closeCustomizeMenu(),this.closeMoreMenu(),this.closeSessionMenu(),this.closeSessionGroupMenu(),this.closeSessionSortMenu(),this.closeCatalogViewMenu(),this.closeIdentityMenu(),this.agentMenuTrigger=e,this.agentMenuFocusBeforeHover=t===`open-hover`&&document.activeElement instanceof HTMLElement?document.activeElement:null,this.updateState(`agentMenuInteractionState`,t),this.updateState(`agentMenuPosition`,{x:Math.max(8,Math.min(r.left,window.innerWidth-n-8)),top:Math.min(r.bottom+4,window.innerHeight-8)})}scheduleAgentMenuHoverOpen(e,t){globalThis.clearTimeout(this.agentMenuHoverCloseTimer??void 0),this.agentMenuHoverCloseTimer=null,!(this.agentMenuInteractionState===`open-hover`||this.agentMenuInteractionState===`open-click`||t.pointerType===`touch`||!globalThis.matchMedia(`(hover: hover) and (pointer: fine)`).matches)&&(this.loadMenuRenderer(),globalThis.clearTimeout(this.agentMenuHoverOpenTimer??void 0),this.updateState(`agentMenuInteractionState`,`hover-pending`),this.agentMenuHoverOpenTimer=globalThis.setTimeout(()=>{this.agentMenuHoverOpenTimer=null,this.agentMenuInteractionState===`hover-pending`&&this.openAgentMenu(e,`open-hover`)},GC))}handleAgentMenuTriggerPointerLeave(){if(globalThis.clearTimeout(this.agentMenuHoverOpenTimer??void 0),this.agentMenuHoverOpenTimer=null,this.agentMenuInteractionState===`hover-pending`){this.updateState(`agentMenuInteractionState`,`closed`);return}this.scheduleAgentMenuHoverClose()}handleAgentMenuPointerEnter(){globalThis.clearTimeout(this.agentMenuHoverCloseTimer??void 0),this.agentMenuHoverCloseTimer=null}handleAgentMenuPointerLeave(){this.scheduleAgentMenuHoverClose()}restoreFocusAfterAgentMenuHoverOpen(){if(this.agentMenuInteractionState!==`open-hover`)return;let e=this.agentMenuFocusBeforeHover;this.agentMenuFocusBeforeHover=null,e&&e!==document.body&&e.isConnected?e.focus({preventScroll:!0}):document.activeElement instanceof HTMLElement&&document.activeElement.closest(`.sidebar-agent-menu`)&&document.activeElement.blur()}closeAgentMenu(e={}){let t=this.agentMenuTrigger;this.clearAgentMenuHoverTimers(),this.agentMenuTrigger=null,this.agentMenuFocusBeforeHover=null,this.updateState(`agentMenuInteractionState`,`closed`),this.updateState(`agentMenuPosition`,null),e.restoreFocus&&t?.focus()}scheduleAgentMenuHoverClose(){this.agentMenuInteractionState===`open-hover`&&(globalThis.clearTimeout(this.agentMenuHoverCloseTimer??void 0),this.agentMenuHoverCloseTimer=globalThis.setTimeout(()=>{this.agentMenuHoverCloseTimer=null,this.agentMenuInteractionState===`open-hover`&&(document.activeElement?.closest(`.sidebar-agent-menu`)||this.closeAgentMenu())},KC))}clearAgentMenuHoverTimers(){globalThis.clearTimeout(this.agentMenuHoverOpenTimer??void 0),globalThis.clearTimeout(this.agentMenuHoverCloseTimer??void 0),this.agentMenuHoverOpenTimer=null,this.agentMenuHoverCloseTimer=null}toggleIdentityMenu(e){if(this.identityMenuPosition){this.closeIdentityMenu();return}this.loadMenuRenderer();let t=e.getBoundingClientRect(),n=Math.max(240,t.width);this.dismissTransientMenus(),this.identityMenuTrigger=e,this.updateState(`identityMenuPosition`,{x:Math.max(8,Math.min(t.right-n,window.innerWidth-n-8)),bottom:Math.max(8,window.innerHeight-t.top+4),width:t.width})}closeIdentityMenu(e={}){let t=this.identityMenuTrigger;this.identityMenuTrigger=null,this.updateState(`identityMenuPosition`,null),e.restoreFocus&&t?.focus()}renderCustomizeMenu(){return this.menuRenderer?.renderSidebarCustomizeMenuForController(this)??P}renderAgentMenu(){return this.menuRenderer?.renderSidebarAgentMenuForController(this)??P}renderIdentityMenu(){return this.menuRenderer?.renderSidebarIdentityMenuForController(this)??P}renderSessionMenu(){return this.menuRenderer?.renderSidebarSessionMenuForController(this)??P}renderSessionGroupMenu(){return this.menuRenderer?.renderSidebarSessionGroupMenuForController(this)??P}renderSessionSortMenu(){return this.menuRenderer?.renderSidebarSessionSortMenuForController(this)??P}renderCatalogViewMenu(){return this.menuRenderer?.renderSidebarCatalogViewMenuForController(this)??P}renderRoute(e){if(!this.isRouteEnabled(e))return P;let t=_r(e)?this.host.getRouteSessionKey():``,n=this.host.sessionDataContext,r=_r(e)&&t&&n?zt({context:n,face:e,sessionKey:t}):null;return Av({routeId:e,href:r?.href??Gr(e,this.host.basePath),active:Ov(this.host.activeRouteId,e)&&!(e===`workboard`&&this.activeWorkboardBoardIsPinned()),onNavigate:()=>{this.host.onNavigate?.(e,r?.options)},onPreload:(t,n)=>this.preloadRoute(e,t,n),onCancelPreload:this.cancelPreload})}renderMoreMenu(){return this.menuRenderer?.renderSidebarMoreMenuForController(this)??P}activeWorkboardBoardIsPinned(){return!!(this.host.activeWorkboardBoardId&&this.host.reconciledSidebarZone().entries.some(e=>e.type===`workboard`&&e.boardId===this.host.activeWorkboardBoardId))}}})))()}var XC,ZC;function QC(){return(QC=t((()=>{V(),rt(),f(),XC=[`pointerover`,`pointerout`,`focusin`,`focusout`,`click`,`keydown`],ZC=class{constructor(e){this.host=e,this.runtime=null,this.loading=null,this.generation=0,this.pendingTarget=null,this.cancelPending=e=>{(e instanceof KeyboardEvent?e.key===`Escape`:e.target instanceof Node&&!this.pendingTarget?.contains(e.target))&&(this.generation+=1,this.clearPending())},this.handleEvent=e=>{if(this.runtime){this.runtime.handleEvent(e);return}let t=e.target instanceof Element?e.target.closest(`.sidebar-online__row`):null;if(!t||![`pointerover`,`focusin`,`click`].includes(e.type))return;let n=++this.generation;this.pendingTarget=t,document.addEventListener(`pointerdown`,this.cancelPending,!0),document.addEventListener(`keydown`,this.cancelPending,!0);let r=this.host.sessionDataContext?.gateway.snapshot.client,i=this.host.sessionDataContext?.gateway,a=i?.snapshot.hello,o=this.host.activeRouteId,s=this.host.sessionKey,c=performance.now();this.loading??=d(()=>import(`./sidebar-people.runtime-DFHUV6XT.js`),__vite__mapDeps([40,1,3,2,4,5,6,7,8,31,23,24,30,32,41]),import.meta.url),this.loading.then(l=>{n===this.generation&&this.clearPending(),!(n!==this.generation||!this.host.isConnected||!t.isConnected||i!==this.host.sessionDataContext?.gateway||r!==i?.snapshot.client||a!==i?.snapshot.hello||o!==this.host.activeRouteId||s!==this.host.sessionKey)&&(this.runtime??=new l.SidebarPeopleRuntime(this.host),this.runtime.handleEvent(e,c))},()=>{this.loading=null,n===this.generation&&this.host.isConnected&&(this.clearPending(),ke({message:W(`presence.card.loadFailed`)}))})},e.addController(this)}hostConnected(){for(let e of XC)this.host.addEventListener(e,this.handleEvent)}hostUpdated(){this.runtime?.sync()}dismiss(){return this.generation+=1,this.clearPending(),this.runtime?.dismiss()??!1}hostDisconnected(){for(let e of XC)this.host.removeEventListener(e,this.handleEvent);this.generation+=1,this.clearPending(),this.runtime?.dispose(),this.runtime=null}clearPending(){this.pendingTarget=null,document.removeEventListener(`pointerdown`,this.cancelPending,!0),document.removeEventListener(`keydown`,this.cancelPending,!0)}}})))()}var $C,ew;function tw(){return(tw=t((()=>{I(),R(),$r(),Jr(),V(),ug(),Cg(),Tv(),Dv(),ri(),rt(),bn(),Wt(),Fv(),gy(),Zy(),uC(),Uy(),G(),U(),hC(),FS(),_C(),YC(),QC(),f(),$C=Ue(()=>d(()=>import(`./lobster-pet.runtime-B3cNmhhB.js`),[],import.meta.url)),ew=class extends lC{sessionGroupDefaults(e){if(this.context?.sessions.groupsStatus()!==`ready`)return null;let t=this.context?.sessions.state.groupSettings.find(t=>t.name===e);return t?{cwd:t.cwd??``,worktree:t.worktree===!0}:null}async listSessionGroupFolders(e){let t=this.context?.sessions,n=t?.captureConnectionScope();if(!t||!n)throw Error(W(`sessionsView.groupDefaultsStale`));let r=await n.client.request(`fs.listDir`,e?{path:e}:{});if(this.context?.sessions!==t||!t.isConnectionScopeCurrent(n))throw Error(W(`sessionsView.groupDefaultsStale`));return r}async inspectSessionGroupRepository(e){let t=e?.trim(),n=this.activeChipAgent().agent;if(!t)return n?.workspaceGit===!0?`git`:n?.workspaceGit===!1?`not_git`:`unavailable`;let r=this.context?.sessions,i=r?.captureConnectionScope();if(!r||!i)throw Error(W(`sessionsView.groupDefaultsStale`));let a=await i.client.request(`worktrees.branches`,{repoRoot:t,includeRepositoryStatus:!0});if(this.context?.sessions!==r||!r.isConnectionScopeCurrent(i))throw Error(W(`sessionsView.groupDefaultsStale`));return a.repositoryStatus===`git`||a.repositoryStatus===`not_git`?a.repositoryStatus:`unavailable`}constructor(){super(),this.sidebarNarrationLines=new Map,this.sidebarObserverDigests=new Map,this.sessionOrganizer=new gC(this),this.sidebarMenus=new JC(this),this.people=new ZC(this),this.narration=null,this.narrationLoad=null,this.projectedSessionSections={sections:[],expandedRows:[],visibleRows:[]},this.subscriptions=new fn(this).effect(()=>this.context?.gateway,e=>e.subscribeEvents(e=>this.narration?.handleEvent(e))).watch(()=>this.context?.agentIdentity,(e,t)=>e.subscribe(t)),this.nativeGatewaysChanged=()=>this.sidebarMenus.closeSessionMenu(),this.refreshAppearanceSettings=()=>this.context?.theme.refresh(),this.hiddenSessionCatalogsChanged=()=>{this.hiddenSessionCatalogIds=If()},this.catalogRenderer=null,this.catalogRendererImport=Ue(()=>d(()=>import(`./app-sidebar-session-catalog-render-DxlzfJen.js`),[],import.meta.url),e=>{this.catalogRenderer=e.renderSessionCatalogGroups,this.isConnected&&this.requestUpdate()}),this.catalogProjectGrouping=Df(),this.subscriptions}dismissTransientMenus(){let e=this.people.dismiss();return super.dismissTransientMenus()||e}disconnectedCallback(){window.removeEventListener(`openclaw:native-gateways-changed`,this.nativeGatewaysChanged),window.removeEventListener(cp,this.hiddenSessionCatalogsChanged),this.narration?.disconnect(),this.catalogRendererImport.dispose(),super.disconnectedCallback()}willUpdate(e){super.willUpdate(e);let t=this.sessionData.sessionsResult;this.sessionProjection.observeRows([...t?[t]:[],...Object.values(this.sessionData.sessionResultsByAgent)]),this.sessionNavigationState=super.getSessionNavigationState(),this.projectedSessionRows=super.selectedAgentSessionRows(this.sessionNavigationState),this.projectedSessionSections=super.zonedVisibleSections(this.projectedSessionRows);let n=this.activeChipAgent(),r=this.sidebarMenus.agentMenuPosition===null?[n.activeId]:n.agents.map(e=>e.id);this.ensureAgentIdentities(r)}ensureAgentIdentities(e){this.connected&&this.context?.agentIdentity.ensure(e)}getSessionNavigationState(){return this.sessionNavigationState??super.getSessionNavigationState()}selectedAgentSessionRows(e){return this.projectedSessionRows??super.selectedAgentSessionRows(e)}zonedVisibleSections(e){return this.projectedSessionSections}updated(e){super.updated(e),this.narration?this.narration.sync(this.narrationSyncInput()):this.sidebarLiveActivity&&this.ensureNarrationController(),this.sessionNavigationState=void 0,this.projectedSessionRows=void 0}visibleNarrationRowsInOrder(){let e=[],t=n=>{e.push(n),this.isSessionChildrenExpanded(n)&&Ry({session:n,fullyShown:this.isSessionChildrenFullyShown(n.key)}).forEach(t)};return this.visibleSessionRowsInOrder().forEach(t),e}narrationSyncInput(){let e=this.context?.gateway.snapshot;return{enabled:this.sidebarLiveActivity,connected:this.connected&&e?.phase===`connected`,connectionIdentity:e?.client??null,source:this.context?.sessions??null,rows:this.visibleNarrationRowsInOrder(),openSessionKey:_r(this.activeRouteId)?this.getRouteSessionKey():``,agentId:this.selectedAgentIdForSessions()}}ensureNarrationController(){this.narration||this.narrationLoad||(this.narrationLoad=d(()=>import(`./app-sidebar-session-narration-BHXO89da.js`).then(e=>{this.narrationLoad=null,this.isConnected&&(this.narration=new e.SidebarSessionNarrationController(e=>{this.sidebarNarrationLines=e},e=>{this.sidebarObserverDigests=e}),this.narration.sync(this.narrationSyncInput()))}),[],import.meta.url))}connectedCallback(){super.connectedCallback(),window.addEventListener(`openclaw:native-gateways-changed`,this.nativeGatewaysChanged),this.hiddenSessionCatalogsChanged(),window.addEventListener(cp,this.hiddenSessionCatalogsChanged),$C.schedule(),this.catalogRendererImport.schedule()}firstUpdated(){requestAnimationFrame(()=>requestAnimationFrame(()=>this.classList.add(`sidebar-r`)))}startSessionDrag(e){this.sessionOrganizer.startSessionDrag(e)}finishSessionDrag(){this.sessionOrganizer.finishSessionDrag()}toggleSessionPin(e){this.sessionOrganizer.patchSession(e,{pinned:!e.pinned})}toggleSessionMenu(e,t){if(this.sidebarMenus.sessionMenu?.session.key===e.key){this.sidebarMenus.closeSessionMenu();return}let n=t.getBoundingClientRect();this.sidebarMenus.openSessionMenu(e,n.right,n.bottom+4,t)}startSidebarSectionDrag(e){this.sessionOrganizer.startSidebarSectionDrag(e)}finishSidebarSectionDrag(){this.sessionOrganizer.finishSidebarSectionDrag()}sectionDragOver(e,t,n){this.sessionOrganizer.sectionDragOver(e,t,n)}sectionDragLeave(e,t,n){this.sessionOrganizer.sectionDragLeave(e,t,n)}sectionDrop(e,t,n){this.sessionOrganizer.sectionDrop(e,t,n)}toggleSection(e){this.collapsedSessionSections.has(e)||this.sessionProjection.resetMembership(e),this.sessionOrganizer.toggleSection(e)}handleSessionListDragOver(e){this.sessionOrganizer.handleSessionListDragOver(e)}handleSessionListDragLeave(e){this.sessionOrganizer.handleSessionListDragLeave(e)}handleSessionListDrop(e){this.sessionOrganizer.handleSessionListDrop(e)}setVisibleSessionLimit(e,t){t<(this.sessionData.visibleSessionLimits.get(e)??10)&&this.sessionProjection.resetMembership(e),this.sessionData.setVisibleSessionLimit(e,t)}loadMoreSidebarSessions(){return this.sessionData.loadMoreSidebarSessions()}dismissSessionMutationError(){this.sessionData.dismissSessionMutationError()}preloadCatalogRenderer(){return this.catalogRendererImport.load()}setCatalogProjectGrouping(e){Rf(e),this.catalogProjectGrouping=e}hideSessionCatalog(e){let t=this.sessionData.sessionCatalogs.find(t=>t.id===e)?.label??e;Jf(e,!0);let n=we.appearanceSidebar,r=Gr(n.routeId,this.basePath)+n.search+n.hash;ke({message:F`${W(`chat.sidebar.sectionHidden`,{section:t})}
|
|
<a
|
|
class="session-link"
|
|
href=${r}
|
|
@click=${e=>{et(e)&&(e.preventDefault(),this.onNavigate?.(n.routeId,{search:n.search,hash:n.hash}))}}
|
|
>${W(`chat.sidebar.sectionHiddenRecovery`)}</a
|
|
>`,actionLabel:W(`common.undo`),onAction:()=>Jf(e,!1),durationMs:12e3})}openCatalogMenu(e,t,n,r){this.sidebarMenus.catalogMenu.open(e,t,n,r)}retargetCatalogMenuTrigger(e,t){this.sidebarMenus.catalogMenu.retargetTrigger(e,t)}renderPinnedSidebarSession(e){return Vy({host:this,session:e,listItem:!1})}renderSessions(){let e=this.getSessionNavigationState(),t=this.selectedAgentSessionRows(e),n=this.expandedAgentId(),r=[...this.sessionData.sessionsResult?.sessions??[],...Object.values(this.sessionData.sessionResultsByAgent).flatMap(e=>e.sessions)],{sections:i}=this.zonedVisibleSections(t),a=this.visibleSessionCatalogs(),o=new Set(a.map(e=>e.id)),s=i.filter(e=>!e.id.startsWith(`catalog:`)||o.has(e.id.slice(8)));return!this.catalogRenderer&&(a.length>0||this.sessionData.sessionCatalogRefreshStatus.error!==null)&&this.preloadCatalogRenderer().catch(()=>void 0),Xy({host:this,empty:t.length===0,sections:s,nativeSessionsHaveMore:this.sessionData.sessionsResult?.hasMore===!0,catalogRenderer:this.catalogRenderer,catalogs:{catalogs:a,basePath:this.basePath,routeSessionKey:_r(this.activeRouteId)?this.getRouteSessionKey():``,newSessionAgentId:n,mainKey:this.sessionMainKey(),loadingMoreCatalogIds:this.sessionData.loadingMoreSessionCatalogIds,projectGrouping:this.catalogProjectGrouping,liveRows:r,toSidebarSession:e.toSidebarSession,ownerId:this.activeSessionOwnerId,catalogOpenTarget:this.catalogOpenTarget,terminalAvailable:this.terminalAvailable}})}render(){let e=this.reconciledSidebarZone(),t=new Set(e.entries.flatMap(e=>e.type===`route`?[`route:${e.route}`]:[]));return F`
|
|
<aside
|
|
class="sidebar"
|
|
@contextmenu=${e=>{e.target.closest(`input, textarea, [contenteditable]`)||e.preventDefault()}}
|
|
>
|
|
<div class="sidebar-shell" @mousedown=${Nr}>
|
|
${sy(this)}
|
|
<div class="sidebar-shell__content">
|
|
<div
|
|
class="sidebar-shell__body sidebar-shell__body--scroll-${this.sessionData.sessionsScrollState}"
|
|
@scroll=${e=>this.sessionData.updateSessionsScrollState(e.currentTarget)}
|
|
>
|
|
<nav
|
|
class="sidebar-nav"
|
|
@contextmenu=${this.sidebarMenus.openCustomizeMenuFromContext}
|
|
>
|
|
${ly(this)}
|
|
<div
|
|
class="nav-section__items"
|
|
@dragover=${e=>this.sessionOrganizer.handleSidebarZoneDragOver(e)}
|
|
@dragleave=${e=>this.sessionOrganizer.handleSidebarZoneDragLeave(e)}
|
|
@drop=${e=>this.sessionOrganizer.handleSidebarZoneDrop(e)}
|
|
>
|
|
${cy(this)}
|
|
${e.entries.map(t=>fy(this,t,e.sessionRows,e.workboardRows))}
|
|
${kv(this.context?.gateway.snapshot.hello?.controlUiTabs).filter(e=>!e.placement||!t.has(e.placement)).map(e=>py(this,e))}
|
|
</div>
|
|
</nav>
|
|
${uy(this)} ${this.renderSessions()}
|
|
</div>
|
|
${this.sessionsStatusFilter===`archived`?P:PS({status:this.sessionData.sessionCatalogRefreshStatus,onRetry:()=>void this.sessionData.refreshSessionCatalogs(),className:`sidebar-session-error sidebar-session-catalog-error`})}
|
|
</div>
|
|
<div class="sidebar-shell__footer">
|
|
<openclaw-lobster-pet
|
|
.seed=${dC(this.sessionKey)}
|
|
.mode=${pC(!this.offline,this.sessionData.sessionsResult?.sessions)}
|
|
.runOutcome=${fC(this.sessionData.sessionsResult?.sessions)}
|
|
.visitsEnabled=${this.lobsterPetVisits}
|
|
.soundsEnabled=${this.lobsterPetSounds}
|
|
.gatewayVersion=${this.gatewayVersion}
|
|
.onVisitsDisabled=${this.refreshAppearanceSettings}
|
|
></openclaw-lobster-pet>
|
|
${this.devGitBranch?F`<openclaw-tooltip .content=${this.devGitBranch}>
|
|
<div class="sidebar-footer-branch">
|
|
<span class="sidebar-footer-branch__icon" aria-hidden="true"
|
|
>${H.gitBranch}</span
|
|
>
|
|
<span class="sidebar-footer-branch__name">${this.devGitBranch}</span>
|
|
</div>
|
|
</openclaw-tooltip>`:P}
|
|
${dy(this)}
|
|
</div>
|
|
</div>
|
|
${this.sidebarMenus.renderCustomizeMenu()} ${this.sidebarMenus.renderMoreMenu()}
|
|
${this.sidebarMenus.renderAgentMenu()} ${this.sidebarMenus.renderIdentityMenu()}
|
|
${this.sidebarMenus.renderSessionMenu()} ${this.sidebarMenus.catalogMenu.render()}
|
|
${this.sidebarMenus.renderSessionGroupMenu()} ${this.sidebarMenus.renderSessionSortMenu()}
|
|
${this.sidebarMenus.renderCatalogViewMenu()}
|
|
</aside>
|
|
`}},S([B()],ew.prototype,`sidebarNarrationLines`,void 0),S([B()],ew.prototype,`sidebarObserverDigests`,void 0),S([B()],ew.prototype,`catalogProjectGrouping`,void 0),customElements.get(`openclaw-app-sidebar`)||customElements.define(`openclaw-app-sidebar`,ew)})))()}var nw;function rw(){return(rw=t((()=>{N(),nw=class{constructor(){this.entries=new Map}clear(){this.entries.clear()}prune(e){let t=new Set(e.filter(e=>e.contentKind===`mcp-app`).map(e=>this.key(e)));for(let e of this.entries.keys())t.has(e)||this.entries.delete(e)}async resolve(e,t,n){let r=this.key(e);n&&this.entries.delete(r);let i=this.entries.get(r);if(i)return await i;let a=t().then(e=>({status:`ready`,...e})).catch(e=>({status:`stale`,error:k(e)}));this.entries.set(r,a);let o=await a;return this.entries.get(r)===a&&this.entries.set(r,o),o}key(e){return`${e.name}\0${e.revision}\0${e.instanceId??``}\0${e.grantState}`}}})))()}function iw(e){return{sessionKey:e,revision:0,tabs:[],widgets:[]}}function aw(e){let t=e?.trim()??``;return t?Array.from(t).slice(0,80).join(``):void 0}var ow,sw;function cw(){return(cw=t((()=>{ow=class{constructor(e){this.value=e,this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}set(e){this.value=e;for(let e of this.listeners)e()}},sw=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(e){for(let t of this.listeners)t(e)}}})))()}function lw(e){let t=14695981039346656037n;for(let n of new TextEncoder().encode(e))t^=BigInt(n),t=BigInt.asUintN(64,t*1099511628211n);return t.toString(16).padStart(16,`0`)}function uw(e){let t=`canvas-${e.toLowerCase().replace(/[^a-z0-9._-]/gu,`-`)}`;return t===`canvas-${e}`&&t.length<=64?t:`${t.slice(0,47).replace(/[._-]+$/gu,``)||`canvas-widget`}-${lw(e)}`}function dw(e){return`mcp-app-${lw(e)}`}function fw(){return(fw=t((()=>{})))()}function pw(e,t=Date.now()){e.viewTicket&&e.viewTicketTtlMs&&gw.set(e,t)}function mw(e,t,n=Date.now()){e.viewTicket&&e.viewTicketTtlMs&&gw.set(e,gw.get(t)??n)}function hw(e,t=Date.now()){let n=e.viewTicketTtlMs;if(!e.viewTicket||!n)return;let r=gw.get(e);return r===void 0?n:Math.max(0,n-(t-r))}var gw;function _w(){return(_w=t((()=>{gw=new WeakMap})))()}function vw(e,t){return{...e,...t.frameUrl===void 0?{}:{frameUrl:t.frameUrl},...t.viewTicket===void 0?{}:{viewTicket:t.viewTicket},...t.viewTicketTtlMs===void 0?{}:{viewTicketTtlMs:t.viewTicketTtlMs},...t.viewGeneration===void 0?{}:{viewGeneration:t.viewGeneration},...t.sandboxUrl===void 0?{}:{sandboxUrl:t.sandboxUrl},...t.sandboxPort===void 0?{}:{sandboxPort:t.sandboxPort},...t.sandboxOrigin===void 0?{}:{sandboxOrigin:t.sandboxOrigin}}}var yw;function bw(){return(bw=t((()=>{g(),N(),O(),rw(),cw(),_w(),yw=class{constructor(e,t,n=!0,r=!0,i=!1,a=!0,o=!0){this.sessionKey=e,this.canPinWidgets=r,this.canPinMcpApps=i,this.canMutate=a,this.canGrant=o,this.loadErrorSignal=new ow(null),this.eventStream=new sw,this.retiredClients=new WeakSet,this.clientGeneration=0,this.refreshRequested=!1,this.userRefreshRequested=!1,this.changedWidgets=new Set,this.stateGeneration=0,this.connected=!1,this.appViews=new nw,this.disposed=!1,this.snapshotLoaded=!1,this.snapshotSignal=new ow(iw(e)),this.snapshot$=this.snapshotSignal,this.loadError$=this.loadErrorSignal,this.events=this.eventStream,this.client=t,this.connected=n,this.subscribe(t),n&&this.activate()}attachClient(e,t=!0){if(this.disposed||e!==this.client&&this.retiredClients.has(e))return;let n=t!==this.connected,r=t&&!this.connected;if(this.connected=t,t||this.wakeRetryDelay?.(),e===this.client){n&&(this.clientGeneration+=1,this.stateGeneration+=1,this.appViews.clear(),this.publishAppViewGeneration()),r&&this.activate();return}this.retiredClients.add(this.client),this.unsubscribe?.(),this.client=e,this.clientGeneration+=1,this.stateGeneration+=1,this.changedWidgets.clear(),this.appViews.clear(),this.snapshotLoaded=!1,this.setLoadError(null),this.snapshotSignal.set(iw(this.sessionKey)),this.subscribe(e),t&&this.activate()}activate(){return this.requestRefresh()}get hasLoadedSnapshot(){return this.snapshotLoaded}get appViewGeneration(){return this.clientGeneration}dispose(){this.disposed||(this.disposed=!0,this.connected=!1,this.unsubscribe?.(),this.unsubscribe=void 0,this.clientGeneration+=1,this.stateGeneration+=1,this.refreshRequested=!1,this.userRefreshRequested=!1,this.changedWidgets.clear(),this.appViews.clear(),this.wakeRetryDelay?.())}async applyOps(e){await this.mutate(`board.update`,{sessionKey:this.sessionKey,ops:e})}async grant(e,t){let n=this.snapshotSignal.value.widgets.find(t=>t.name===e);if(!n)throw this.requestRefresh(),Error(`Dashboard widget not found: ${e}`);await this.mutate(`board.widget.grant`,{sessionKey:this.sessionKey,name:e,decision:t,revision:n.revision,...n.instanceId?{instanceId:n.instanceId}:{}})}pinWidget(e){return this.pinBoardWidget(e,e.name??uw(e.docId),{kind:`canvas-doc`,docId:e.docId})}pinMcpApp(e){return this.pinBoardWidget(e,e.name??dw(e.viewId),{kind:`mcp-app`,viewId:e.viewId})}async pinBoardWidget(e,t,n){let r=aw(e.title);await this.mutate(`board.widget.put`,{sessionKey:this.sessionKey,name:t,...r?{title:r}:{},content:n,...e.tabId||e.size||e.after?{placement:{...e.tabId?{tabId:e.tabId}:{},...e.size?{size:e.size}:{},...e.after?{after:e.after}:{}}}:{}},t)}widgetFrameUrl(e,t){return this.snapshotSignal.value.widgets.find(n=>n.name===e&&n.revision===t)?.frameUrl??``}refreshWidgetFrame(e){return this.requestRefresh(e,!0)}async widgetAppView(e,t){return await this.resolveWidgetAppView(e,t,!1)}async refreshWidgetAppView(e,t){return await this.resolveWidgetAppView(e,t,!0)}async resolveWidgetAppView(e,t,n){if(this.disposed||!this.connected)return{status:`stale`,error:`Dashboard MCP App view unavailable`};let r=this.snapshotSignal.value.widgets.find(n=>n.name===e&&n.revision===t&&n.contentKind===`mcp-app`);if(!r)return{status:`stale`,error:`Dashboard MCP App widget unavailable`};let i=this.client,a=this.clientGeneration,o=await this.appViews.resolve(r,async()=>await i.request(`board.widget.appView`,{sessionKey:this.sessionKey,name:e,revision:t,...r.instanceId?{instanceId:r.instanceId}:{}}),n);return this.disposed||!this.connected||i!==this.client||a!==this.clientGeneration?{status:`stale`,error:`Dashboard MCP App view unavailable`}:o}subscribe(e){this.unsubscribe=e.addEventListener(t=>{if(!(this.disposed||e!==this.client)){if(t.event===`board.changed`){let e=t.payload;e&&this.matchesSession(e.sessionKey)&&(this.stateGeneration+=1,this.requestRefresh(e.widget));return}if(t.event===`board.command`){let e=t.payload;e?.command&&this.matchesSession(e.sessionKey)&&this.eventStream.emit({sessionKey:this.sessionKey,command:e.command})}}})}matchesSession(e){return typeof e==`string`&&Ee(e)===Ee(this.sessionKey)}requestRefresh(e,t=!1){return this.disposed?Promise.resolve():(this.refreshRequested=!0,this.userRefreshRequested||=t,e&&this.changedWidgets.add(e),this.wakeRetryDelay?.(),this.refreshLoop??=this.runRefreshLoop().finally(()=>{this.refreshLoop=void 0,this.refreshRequested&&(this.connected||this.userRefreshRequested)&&this.requestRefresh()}),this.refreshLoop)}async runRefreshLoop(){let e={delayMs:1e3};for(;this.refreshRequested;){if(this.disposed){this.refreshRequested=!1;return}if(!this.connected&&!this.userRefreshRequested)return;this.userRefreshRequested=!1;let t=new Set(this.changedWidgets);this.changedWidgets.clear();let n=this.client,r=this.stateGeneration;try{let i=await n.request(`board.get`,{sessionKey:this.sessionKey});if(this.disposed)return;if(n!==this.client){this.refreshRequested=!0;continue}if(this.userRefreshRequested=!1,r!==this.stateGeneration){this.refreshRequested=!0;for(let e of t)this.changedWidgets.add(e);continue}for(let e of this.changedWidgets)t.add(e);this.changedWidgets.clear(),this.refreshRequested=!1,this.setSnapshot(i,t),e.delayMs=1e3}catch(i){if(this.disposed)return;if(this.refreshRequested=!0,n!==this.client)continue;this.setLoadError(k(i));for(let e of t)this.changedWidgets.add(e);if(i instanceof C&&i.gatewayCode===`UNAVAILABLE`&&!i.retryable){this.refreshRequested=this.stateGeneration!==r||this.userRefreshRequested;continue}if(!this.connected){if(this.userRefreshRequested)continue;return}let a=e.delayMs;e.delayMs=Math.min(a*2,3e4),await this.waitForRetry(a);continue}}}waitForRetry(e){return new Promise(t=>{let n,r=()=>{n&&(clearTimeout(n),n=void 0,this.wakeRetryDelay===r&&(this.wakeRetryDelay=void 0),t())};n=setTimeout(r,e),this.wakeRetryDelay=r})}async mutate(e,t,n){if(this.disposed)throw Error(`Session dashboard provider is no longer active`);let r=this.client,i=this.clientGeneration,a=++this.stateGeneration;try{let o=await r.request(e,t);!this.disposed&&r===this.client&&i===this.clientGeneration&&a===this.stateGeneration&&(this.stateGeneration+=1,this.setSnapshot(o,n?new Set([n]):new Set,!0))}catch(e){throw!this.disposed&&r===this.client&&i===this.clientGeneration&&a===this.stateGeneration&&this.requestRefresh(),e}}setSnapshot(e,t=new Set,n=!1){let r=Date.now(),i=new Map(this.snapshotSignal.value.widgets.map(e=>[e.name,e])),a=e.widgets.map(e=>{let a=i.get(e.name);if(n&&a&&!t.has(e.name)&&a.revision===e.revision&&a.instanceId===e.instanceId&&e.viewGeneration===void 0){let t=vw(e,a);return mw(t,a,r),t}if(a&&!t.has(e.name)&&a.revision===e.revision&&a.instanceId===e.instanceId&&a.viewGeneration===e.viewGeneration&&!e.sandboxUrl&&a.frameUrl){let t={...e,frameUrl:a.frameUrl};return pw(t,r),t}return pw(e,r),e});this.appViews.prune(a),this.snapshotLoaded=!0,this.snapshotSignal.set({...e,widgets:a}),this.setLoadError(null)}setLoadError(e){this.loadErrorSignal.value!==e&&this.loadErrorSignal.set(e)}publishAppViewGeneration(){let e=this.snapshotSignal.value;e.widgets.some(e=>e.contentKind===`mcp-app`)&&this.snapshotSignal.set({...e,widgets:e.widgets.map(e=>e.contentKind===`mcp-app`?Object.assign({},e):e)})}}})))()}function xw(e){let t=e.tabs.toSorted((e,t)=>e.position-t.position).map((e,t)=>Object.assign({},e,{position:t})),n=new Map(t.map(e=>[e.tabId,e.position])),r=new Map,i=e.widgets.toSorted((e,t)=>(n.get(e.tabId)??2**53-1)-(n.get(t.tabId)??2**53-1)||e.position-t.position).map(e=>{let t=r.get(e.tabId)??0;return r.set(e.tabId,t+1),Object.assign({},e,{position:t})});return{...e,tabs:t,widgets:i}}function Sw(e,t){switch(t.kind){case`tab_create`:return e.tabs.some(e=>e.tabId===t.tabId)?e:{...e,tabs:[...e.tabs,{tabId:t.tabId,title:t.title,position:e.tabs.length,chatDock:t.chatDock??`right`}]};case`tab_update`:{let n=e.tabs.toSorted((e,t)=>e.position-t.position),r=n.findIndex(e=>e.tabId===t.tabId);if(r<0)return e;let[i]=n.splice(r,1),a={...i,...t.title===void 0?{}:{title:t.title},...t.chatDock===void 0?{}:{chatDock:t.chatDock}},o=Math.max(0,Math.min(t.position===void 0?r:Math.trunc(t.position),n.length));return n.splice(o,0,a),{...e,tabs:n.map((e,t)=>Object.assign({},e,{position:t}))}}case`tab_delete`:{let n=e.tabs.filter(e=>e.tabId!==t.tabId);if(n.length===0&&e.widgets.length>0)return e;let r=n[0]?.tabId;return{...e,tabs:n,widgets:e.widgets.map(e=>e.tabId===t.tabId&&r?{...e,tabId:r,position:2**53-1}:e)}}case`tabs_reorder`:{let n=new Set(t.tabIds);return t.tabIds.length!==e.tabs.length||n.size!==e.tabs.length||e.tabs.some(e=>!n.has(e.tabId))?e:{...e,tabs:t.tabIds.flatMap((t,n)=>{let r=e.tabs.find(e=>e.tabId===t);return r?[{...r,position:n}]:[]})}}case`widget_move`:{let n=e.widgets.find(e=>e.name===t.name),r=t.after?e.widgets.find(e=>e.name===t.after):void 0;if(!n||t.after&&(!r||r.name===n.name))return e;let i=t.tabId??n.tabId;if(t.position!==void 0&&t.after!==void 0||!e.tabs.some(e=>e.tabId===i)||r&&r.tabId!==i)return e;let a=e.widgets.filter(e=>e.name!==n.name),o=a.filter(e=>e.tabId===i).toSorted((e,t)=>e.position-t.position),s=r?o.findIndex(e=>e.name===r.name):-1,c=r?s+1:Math.max(0,Math.min(t.position??o.length,o.length));return o.splice(c,0,{...n,tabId:i}),{...e,widgets:e.tabs.flatMap(e=>(e.tabId===i?o:a.filter(t=>t.tabId===e.tabId).toSorted((e,t)=>e.position-t.position)).map((e,t)=>Object.assign({},e,{position:t})))}}case`widget_resize`:return{...e,widgets:e.widgets.map(e=>e.name===t.name?{...e,sizeW:Math.min(12,Math.max(1,Math.trunc(t.sizeW))),sizeH:Math.min(20,Math.max(1,Math.trunc(t.sizeH))),heightMode:t.heightMode??`fixed`}:e)};case`widget_remove`:return{...e,widgets:e.widgets.filter(e=>e.name!==t.name)}}return e}function Cw(e){return{sessionKey:e,revision:1,tabs:[{tabId:`main`,title:W(`chat.board.mockOverview`),position:0,chatDock:`right`},{tabId:`research`,title:W(`chat.board.mockResearch`),position:1,chatDock:`bottom`}],widgets:[{name:`session-status`,tabId:`main`,title:W(`chat.board.mockSessionStatus`),contentKind:`html`,sizeW:4,sizeH:3,position:0,grantState:`granted`,revision:1},{name:`recent-findings`,tabId:`main`,title:W(`chat.board.mockRecentFindings`),contentKind:`mcp-app`,sizeW:8,sizeH:6,position:1,grantState:`pending`,revision:1},{name:`source-map`,tabId:`research`,title:W(`chat.board.mockSourceMap`),contentKind:`html`,sizeW:12,sizeH:8,position:0,grantState:`none`,revision:1}]}}function ww(e){return e.tabs.length>0||e.widgets.length>0}function Tw(){let e=globalThis.location;return new URLSearchParams(e?.search??``).get(`mockBoard`)===`1`?e:null}function Ew(){return Tw()!==null}function Dw(e){return/^agent:[^:]+:[^:]+$/u.test(e)}function Ow(e){let t=Ee(e);return t===`main`?Ft({agentId:`main`}):t}function kw(e,t=!0){let n=Ow(e),r=Tw();if(r&&Dw(n)){r!==Rw&&(Iw.clear(),Rw=r);let e=Iw.get(n);return e||(e=new Nw(n),Iw.set(n,e)),e}let i=t?Lw.get(n)?.provider:void 0;if(i)return i;let a=Fw.get(n);return a||(a=new Mw(n),Fw.set(n,a)),a}function Aw(e,t,n=!0,r=!0,i=!1,a=!0,o=!0){let s=Ow(e),c=kw(s);if(c instanceof Nw)return{provider:c,update:()=>void 0,release:()=>void 0};let l=Lw.get(s);l?l.provider.attachClient(t,n):(l={provider:new yw(s,t,n),consumers:0},Lw.set(s,l));let u=new Pw(l.provider,{canPinWidgets:r,canPinMcpApps:i,canMutate:a,canGrant:o});l.consumers+=1;let d=!1;return{provider:u,update:(e,t,n)=>{d||Lw.get(s)?.provider!==l.provider||(u.updateCapabilities(n),l.provider.attachClient(e,t))},release:()=>{if(d)return;d=!0,u.deactivate();let e=Lw.get(s);!e||e.provider!==l.provider||(--e.consumers,!(e.consumers>0)&&(Lw.delete(s),e.provider.dispose()))}}}function jw(e){return e instanceof yw||e instanceof Pw?e.hasLoadedSnapshot:!0}var Mw,Nw,Pw,Fw,Iw,Lw,Rw;function zw(){return(zw=t((()=>{V(),O(),bw(),cw(),Mw=class{constructor(e=``){this.sessionKey=e,this.appViewGeneration=0,this.canMutate=!1,this.canGrant=!1,this.canPinWidgets=!1,this.canPinMcpApps=!1,this.loadError$=new ow(null),this.events=new sw,this.snapshot$=new ow(iw(e))}async applyOps(e){}async grant(e,t){}async pinWidget(e){throw Error(`Session dashboard unavailable`)}async pinMcpApp(e){throw Error(`Session dashboard unavailable`)}widgetFrameUrl(e,t){return``}async refreshWidgetFrame(e){}async widgetAppView(e,t){return{status:`stale`,error:`Session dashboard unavailable`}}async refreshWidgetAppView(e,t){return{status:`stale`,error:`Session dashboard unavailable`}}},Nw=class{constructor(e){this.sessionKey=e,this.appViewGeneration=0,this.canMutate=!0,this.canGrant=!0,this.canPinWidgets=!0,this.canPinMcpApps=!0,this.loadError$=new ow(null),this.eventStream=new sw,this.snapshotSignal=new ow(Cw(e)),this.snapshot$=this.snapshotSignal,this.events=this.eventStream}async applyOps(e){let t=this.snapshotSignal.value;for(let n of e)t=xw(Sw(t,n));this.snapshotSignal.set({...t,revision:t.revision+1})}async grant(e,t){let n=this.snapshotSignal.value,r=n.widgets.slice(),i=r.findIndex(t=>t.name===e),a=r[i];a&&(r[i]={...a,grantState:t}),this.snapshotSignal.set({...n,revision:n.revision+1,widgets:r})}async pinWidget(e){let t=e.name??uw(e.docId);this.pinMockBoardWidget(e,t,`html`)}async pinMcpApp(e){let t=e.name??dw(e.viewId);this.pinMockBoardWidget(e,t,`mcp-app`)}pinMockBoardWidget(e,t,n){let r=this.snapshotSignal.value,i=aw(e.title),a=e.tabId??r.tabs[0]?.tabId??`main`,o=r.tabs.length?r.tabs:[{tabId:`main`,title:W(`chat.board.defaultTab`),position:0,chatDock:`right`}],s=r.widgets.find(e=>e.name===t),c=r.widgets.filter(e=>e.name!==t);c.push({name:t,tabId:a,...i?{title:i}:{},contentKind:n,sizeW:s?.sizeW??6,sizeH:s?.sizeH??4,position:s?.position??c.filter(e=>e.tabId===a).length,grantState:`none`,revision:(s?.revision??0)+1,...n===`html`?{frameUrl:`about:blank#board-widget=${encodeURIComponent(t)}`}:{}}),this.snapshotSignal.set(xw({...r,revision:r.revision+1,tabs:o,widgets:c}))}widgetFrameUrl(e,t){return this.snapshotSignal.value.widgets.find(n=>n.name===e&&n.revision===t)?.frameUrl??`about:blank#board-widget=${encodeURIComponent(e)}&revision=${t}`}async refreshWidgetFrame(e){}async widgetAppView(e,t){return{status:`stale`,error:`MCP App mock view unavailable`}}async refreshWidgetAppView(e,t){return await this.widgetAppView(e,t)}emitCommand(e){this.eventStream.emit({sessionKey:this.sessionKey,command:e})}},Pw=class{constructor(e,t){this.transport=e,this.capabilities=t,this.active=!0,this.loadError$=e.loadError$,this.snapshot$=e.snapshot$,this.events=e.events}get sessionKey(){return this.transport.sessionKey}get appViewGeneration(){return this.transport.appViewGeneration}get canPinWidgets(){return this.active&&this.capabilities.canPinWidgets}get canPinMcpApps(){return this.active&&this.capabilities.canPinMcpApps}get canMutate(){return this.active&&this.capabilities.canMutate}get canGrant(){return this.active&&this.capabilities.canGrant}get hasLoadedSnapshot(){return this.transport.hasLoadedSnapshot}updateCapabilities(e){this.active&&(this.capabilities=e)}deactivate(){this.active=!1}async applyOps(e){if(!this.canMutate)throw Error(`Session dashboard mutation unavailable`);await this.transport.applyOps(e)}async grant(e,t){if(!this.canGrant)throw Error(`Session dashboard approval unavailable`);await this.transport.grant(e,t)}async pinWidget(e){if(!this.canMutate||!this.canPinWidgets)throw Error(`Session dashboard widget pinning unavailable`);await this.transport.pinWidget(e)}async pinMcpApp(e){if(!this.canMutate||!this.canPinMcpApps)throw Error(`Session dashboard MCP App pinning unavailable`);await this.transport.pinMcpApp(e)}widgetFrameUrl(e,t){return this.transport.widgetFrameUrl(e,t)}refreshWidgetFrame(e){return this.transport.refreshWidgetFrame(e)}widgetAppView(e,t){return this.transport.widgetAppView(e,t)}refreshWidgetAppView(e,t){return this.transport.refreshWidgetAppView(e,t)}},Fw=new Map,Iw=new Map,Lw=new Map,Rw=null})))()}function Bw(e,t){e instanceof ma&&e.updateComplete.then(()=>{let n=e.shadowRoot?.querySelector(`[role="tablist"]`);e.isConnected&&n instanceof HTMLElement&&n.setAttribute(`aria-label`,t)})}function Vw(){return(Vw=t((()=>{Pi(),ga(),Xi()})))()}function Hw(e,t){let n=new URL(e||t,t);if(n.protocol===`ws:`?n.protocol=`http:`:n.protocol===`wss:`&&(n.protocol=`https:`),n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`Gateway URL is invalid`);return n.origin}function Uw(e,t,n,r,i,a=`Sandbox host URL is invalid`){if(!Number.isInteger(t)||t<1||t>65535)throw Error(a);let o;try{o=Hw(r,i)}catch{throw Error(a)}let s=n?new URL(n):new URL(o);if(n){if(s.origin!==n.replace(/\/$/u,``)||s.username!==``||s.password!==``)throw Error(a)}else s.port=String(t);s.pathname=`/`,s.search=``,s.hash=``;let c=new URL(e,s);if(s.protocol!==`http:`&&s.protocol!==`https:`||s.origin===new URL(i).origin||s.origin===o||c.origin!==s.origin||c.pathname!==`/mcp-app-sandbox`)throw Error(a);return c.href}function Ww(){return(Ww=t((()=>{})))()}function Gw(e){if(typeof e!=`string`)return null;let t=e.trim(),n=t.startsWith(`/`)||t.startsWith(`!`);return!t||t.length>$w||n?null:t}function Kw(e,t){let n=t-eT,r=(rT.get(e)??[]).filter(e=>e>n);if(!rT.has(e)&&rT.size>=nT){let e=rT.keys().next().value;e!==void 0&&rT.delete(e)}return r.length>=tT?(rT.set(e,r),!1):(r.push(t),rT.set(e,r),!0)}function qw(e){if(!e.isConnected||!(typeof e.checkVisibility==`function`?e.checkVisibility():e.getClientRects().length>0))return!1;let t=e.ownerDocument.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t===e}function Jw(e,t,n,r){let i=Gw(t);return!i||!qw(e)||!Kw(n,Date.now())||r&&!r(i)?!1:(e.dispatchEvent(new CustomEvent(Zw,{bubbles:!0,composed:!0,detail:{text:i}})),!0)}function Yw(e,t=!1,n=!1,r=!1){return{openLinks:{},serverTools:{},sandbox:{csp:e??{}},...r?{serverResources:{}}:{},...t?{message:{text:{}}}:{},...n?{updateModelContext:{text:{}}}:{}}}function Xw(e,t,n,r,i){return Uw(e,t,n,r,i,W(`mcpApp.errors.invalidSandboxUrl`))}var Zw,Qw,$w,eT,tT,nT,rT;function iT(){return(iT=t((()=>{V(),Zw=`openclaw-widget-prompt`,Qw=`openclaw-mcp-app-view-expired`,$w=4e3,eT=6e4,tT=10,nT=100,rT=new Map})))()}function aT(e){if(!a(e).startsWith(lT))return!1;let t=e.indexOf(`,`);if(t<5)return!1;let n=e.slice(5,t),r=a(n.split(`;`)[0]);return r.startsWith(`image/`)?!dT.has(r):!1}function oT(e,t,n={}){let r=e.trim();if(!r)return null;if(n.allowDataImage===!0&&aT(r))return r;if(a(r).startsWith(lT))return null;try{let e=new URL(r,t);return uT.has(a(e.protocol))?e.toString():null}catch{return null}}function sT(){let e=window.open(`about:blank`,`_blank`);return e&&(e.opener=null),e}function cT(e,t={}){let n=oT(e,t.baseHref??window.location.href,t);if(!n)return null;let r=window.open(n,`_blank`,`noopener,noreferrer`);return r&&(r.opener=null),r}var lT,uT,dT;function fT(){return(fT=t((()=>{lT=`data:`,uT=new Set([`http:`,`https:`,`blob:`]),dT=new Set([`image/svg+xml`])})))()}function pT(e){let t={};for(let n of _T){let r=e(vT[n]).trim();r&&(t[n]=r)}return t}function mT(){let e=document.documentElement,t=getComputedStyle(e);return{type:`openclaw:widget-theme`,mode:e.dataset.themeMode===`light`?`light`:`dark`,tokens:pT(e=>t.getPropertyValue(e))}}function hT(e,t=`*`){e.contentWindow?.postMessage(mT(),t)}function gT(){if(typeof window>`u`||typeof document>`u`||typeof MutationObserver>`u`||yT.has(window))return;yT.add(window);let e=document.documentElement;new MutationObserver(()=>{for(let e of document.querySelectorAll(`.chat-tool-card__preview-frame, .board-widget__frame`))hT(e)}).observe(e,{attributes:!0,attributeFilter:[`data-theme`,`data-theme-mode`,`style`]})}var _T,vT,yT;function bT(){return(bT=t((()=>{_T=[`surface`,`card`,`elevated`,`text`,`text-strong`,`muted`,`border`,`border-strong`,`accent`,`accent-fill`,`accent-fg`,`ok`,`warn`,`danger`,`info`,`radius`,`radius-full`,`scrollbar-size`,`scrollbar-thumb-inset`,`scrollbar-thumb`,`scrollbar-thumb-hover`,`font-body`,`font-mono`],vT={surface:`--bg`,card:`--card`,elevated:`--bg-elevated`,text:`--text`,"text-strong":`--text-strong`,muted:`--muted`,border:`--border`,"border-strong":`--border-strong`,accent:`--accent`,"accent-fill":`--primary`,"accent-fg":`--primary-foreground`,ok:`--ok`,warn:`--warn`,danger:`--danger`,info:`--info`,radius:`--radius`,"radius-full":`--radius-full`,"scrollbar-size":`--scrollbar-size`,"scrollbar-thumb-inset":`--scrollbar-thumb-inset`,"scrollbar-thumb":`--scrollbar-thumb`,"scrollbar-thumb-hover":`--scrollbar-thumb-hover`,"font-body":`--font-body`,"font-mono":`--mono`},yT=new WeakSet})))()}function xT(e){let t={open:!1,dock:e.defaultDock,height:e.defaultHeight,width:e.defaultWidth},n=()=>Math.max(e.minHeight,Math.floor((globalThis.innerHeight||800)*.8)),r=()=>Math.max(e.minWidth,Math.floor((globalThis.innerWidth||1280)*.8)),i=(e,t,n,r)=>Math.min(typeof e==`number`&&Number.isFinite(e)&&e>=t?e:r,n);return{defaults:t,minHeight:e.minHeight,minWidth:e.minWidth,maxHeight:n,maxWidth:r,load(){try{let a=globalThis.localStorage?.getItem(e.storageKey);if(!a)return{...t};let o=JSON.parse(a);return{open:!!o.open,dock:e.supportedDocks.includes(o.dock)?o.dock:t.dock,height:i(o.height,e.minHeight,n(),t.height),width:i(o.width,e.minWidth,r(),t.width)}}catch{return{...t}}},save(t){try{globalThis.localStorage?.setItem(e.storageKey,JSON.stringify(t))}catch{}}}}function ST(){return(ST=t((()=>{})))()}function CT(e,t=``,n){let r=new URLSearchParams({source:e}),i=n?.trim();return i&&r.set(`mediaTicket`,i),`${se(t)}/__openclaw__/assistant-media?${r.toString()}`}function wT(){return(wT=t((()=>{_()})))()}function TT(e,t,n=()=>!0){return{async request(r,i){if(!n())throw new DOMException(`Browser request scope ended`,`AbortError`);let a=y(i);return await e.request(r,t?{...a,target:t.target,...t.target===`node`?{node:t.node}:{},query:{...y(a?.query),profile:t.profile}}:i)}}}function ET(e,t){return e.request(qT,t)}function DT(e){return te(e)??``}function OT(e){let t=y(e),n=DT(t?.targetId);return n?{id:DT(t?.tabId)||n,targetId:n,title:DT(t?.title),url:DT(t?.url),...t?.urlUnavailableReason===`navigation_blocked`||t?.urlUnavailableReason===`navigation_check_failed`?{urlUnavailableReason:t.urlUnavailableReason}:{}}:null}async function kT(e){let t=y(await ET(e,{method:`GET`,path:`/tabs`})),n=Array.isArray(t?.tabs)?t.tabs.flatMap(e=>OT(e)??[]):[];return{running:t?.running===!0,tabs:n}}async function AT(e){await ET(e,{method:`POST`,path:`/start`,body:{}})}async function jT(e,t){return OT(await ET(e,{method:`POST`,path:`/tabs/open`,body:{url:t}}))}async function MT(e,t){await ET(e,{method:`POST`,path:`/tabs/focus`,body:{targetId:t}})}async function NT(e,t){await ET(e,{method:`DELETE`,path:`/tabs/${encodeURIComponent(t)}`})}async function PT(e,t){let n=y(await ET(e,{method:`POST`,path:`/navigate`,body:t}));return{targetId:DT(n?.targetId)||t.targetId||``,url:DT(n?.url)||t.url}}async function FT(e,t){let n=y(await ET(e,{method:`POST`,path:`/screenshot`,body:{targetId:t,type:`png`}})),r=DT(n?.path);if(!r)throw Error(W(`browser.errors.screenshotPathMissing`));return{path:r,targetId:DT(n?.targetId)||t,url:DT(n?.url)}}async function IT(e,t){await ET(e,{method:`POST`,path:`/act`,body:{kind:`clickCoords`,targetId:t.targetId,x:Math.max(0,Math.round(t.x)),y:Math.max(0,Math.round(t.y)),...t.doubleClick?{doubleClick:!0}:{}}})}async function LT(e,t){await ET(e,{method:`POST`,path:`/act`,body:{kind:`press`,targetId:t.targetId,key:t.key}})}async function RT(e,t){await ET(e,{method:`POST`,path:`/act`,body:{kind:`resize`,targetId:t.targetId,width:Math.round(t.width),height:Math.round(t.height)}})}async function zT(e,t){return y(await ET(e,{method:`POST`,path:`/act`,body:{kind:`evaluate`,targetId:t.targetId,fn:t.fn}}))?.result??null}function BT(e){return e instanceof Jn&&y(e.details)?.reason===`navigation_blocked`}function VT(e){if(!(e instanceof Error))return!1;let t=e instanceof Jn?y(e.details):null,n=t?.code;return n===void 0&&t?.unrecognizedCode!==!0?e.message.includes(`evaluateEnabled=false`):n===`ACT_EVALUATE_DISABLED`}async function HT(e,t){let n=Math.round(t.deltaX),r=Math.round(t.deltaY);await zT(e,{targetId:t.targetId,fn:`() => { window.scrollBy(${n}, ${r}); return true; }`})}async function UT(e,t){await zT(e,{targetId:t.targetId,fn:`() => { history.go(${t.delta}); return true; }`})}async function WT(e,t){let n=y(await zT(e,{targetId:t,fn:`() => ({ cssWidth: window.innerWidth, cssHeight: window.innerHeight, title: document.title, url: location.href })`})),r=v(n?.cssWidth),i=v(n?.cssHeight);return!r||!i||r<=0||i<=0?null:{cssWidth:r,cssHeight:i,title:DT(n?.title),url:DT(n?.url)}}async function GT(e,t){let n=Math.max(0,Math.round(t.x)),r=Math.max(0,Math.round(t.y)),i=y(await zT(e,{targetId:t.targetId,fn:`() => {
|
|
const el = document.elementFromPoint(${n}, ${r});
|
|
if (!el) return null;
|
|
const rect = el.getBoundingClientRect();
|
|
const label = el.getAttribute("aria-label") || el.getAttribute("alt") || el.getAttribute("title") || "";
|
|
const text = (el.textContent || "").replace(/\\s+/g, " ").trim();
|
|
const nameSource = label || text;
|
|
const nameLimit = 120;
|
|
// This serialized page function cannot call imported helpers; back up only when the cap splits a surrogate pair.
|
|
const nameEnd = (nameSource.codePointAt(nameLimit - 1) || 0) > 0xffff ? nameLimit - 1 : nameLimit;
|
|
return {
|
|
tag: el.tagName.toLowerCase(),
|
|
id: el.id || "",
|
|
classes: Array.from(el.classList).slice(0, 6),
|
|
role: el.getAttribute("role") || "",
|
|
name: nameSource.slice(0, nameEnd),
|
|
rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
|
|
focusable: typeof el.tabIndex === "number" && el.tabIndex >= 0,
|
|
};
|
|
}`}));if(!i)return null;let a=y(i.rect);return{tag:DT(i.tag),id:DT(i.id),classes:Array.isArray(i.classes)?i.classes.filter(e=>typeof e==`string`):[],role:DT(i.role),name:DT(i.name),rect:{x:v(a?.x)??0,y:v(a?.y)??0,width:v(a?.width)??0,height:v(a?.height)??0},focusable:i.focusable===!0}}async function KT(e){let t=new Headers({Accept:`image/*`});e.authToken&&t.set(`Authorization`,`Bearer ${e.authToken}`);let n=new AbortController,r=setTimeout(()=>n.abort(new DOMException(W(`browser.errors.screenshotFetchTimedOut`),`TimeoutError`)),JT),i;try{let r=await fetch(CT(e.path,e.resourceBasePath),{method:`GET`,headers:t,credentials:`same-origin`,signal:n.signal});if(!r.ok)throw r.body?.cancel().catch(()=>void 0),Error(W(`browser.errors.screenshotFetchFailed`,{status:String(r.status)}));i=await r.blob()}finally{clearTimeout(r)}return await new Promise((e,t)=>{let n=new FileReader;n.addEventListener(`load`,()=>{typeof n.result==`string`?e(n.result):t(Error(W(`browser.errors.screenshotReadFailed`)))}),n.addEventListener(`error`,()=>t(n.error??Error(W(`browser.errors.screenshotReadFailed`)))),n.readAsDataURL(i)})}var qT,JT;function YT(){return(YT=t((()=>{ue(),Mr(),wT(),V(),qT=`browser.request`,JT=3e4})))()}function XT(e){let t=new CustomEvent(lE,{detail:e,cancelable:!0});return window.dispatchEvent(t),t.defaultPrevented?`accepted`:t.rejection?`rejected`:`unhandled`}function ZT(e){return Math.min(1,Math.max(0,e))}function QT(e){if(e.points.length===0)return null;let t=1,n=1,r=0,i=0;for(let a of e.points)t=Math.min(t,ZT(a.x)),n=Math.min(n,ZT(a.y)),r=Math.max(r,ZT(a.x)),i=Math.max(i,ZT(a.y));return{x:t,y:n,width:r-t,height:i-n}}function $T(e){return String(Math.round(ZT(e)*100))}function eE(e,t){return l(e.replace(/\s+/g,` `).trim(),t)}function tE(e){let t=eE(e,dE);try{let e=new URL(t);return!e.username&&!e.password?t:(e.username=``,e.password=``,l(e.href,dE))}catch{let e=t.replace(/^([a-z][a-z\d+.-]*:\/\/)[^/?#\s]*@/i,`$1`);return l(e,dE)}}function nE(e){try{let t=new URL(e).hostname;if(t)return eE(t,fE)}catch{}return l(e,fE)}function rE(e,t=40){return e.replace(/[^\w-]/g,``).slice(0,t)}function iE(e){let t=e.classes.slice(0,3).map(e=>rE(e)).filter(e=>e.length>0).map(e=>`.${e}`).join(``),n=rE(e.tag)||`element`,r=rE(e.id),i=`${n}${r?`#${r}`:``}${t}`,a=eE(e.name,uE);return`${i}${a?` "${a}"`:``}${e.role?` (role=${eE(e.role,40)})`:``}`}function aE(e){let t=tE(e.url),n=eE(e.title,uE),r=nE(t),i=e.strokes.flatMap(e=>QT(e)??[]),a=e.element?{descriptor:iE(e.element),width:String(Math.round(e.element.rect.width)),height:String(Math.round(e.element.rect.height)),x:String(Math.round(e.element.rect.x)),y:String(Math.round(e.element.rect.y))}:null,o=[n?W(`browser.annotatePrompt.introTitled`,{url:t,title:n}):W(`browser.annotatePrompt.introUntitled`,{url:t})];return e.browserTab&&o.push(W(`browser.annotatePrompt.browserTarget`,{target:JSON.stringify(e.browserTab)})),i.slice(0,pE).forEach((e,t)=>{o.push(W(`browser.annotatePrompt.region`,{index:String(t+1),x:$T(e.x+e.width/2),y:$T(e.y+e.height/2),width:$T(e.width),height:$T(e.height)}))}),i.length>pE&&o.push(W(`browser.annotatePrompt.moreRegions`,{count:String(i.length-pE)})),a&&o.push(W(`browser.annotatePrompt.elementDetail`,{descriptor:a.descriptor,width:a.width,height:a.height,x:a.x,y:a.y})),o.push(W(`browser.annotatePrompt.outro`)),{modelContext:o.join(`
|
|
`),card:{title:n||l(r,uE),displayUrl:r,markedRegionCount:i.length,inspectedElement:a!==null}}}function oE(e){return Math.max(4,Math.round(e*.005))}function sE(e,t){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=mE,e.lineWidth=oE(t.width);for(let n of t.strokes)if(n.points.length!==0){if(e.beginPath(),n.points.forEach((n,r)=>{let i=ZT(n.x)*t.width,a=ZT(n.y)*t.height;r===0?e.moveTo(i,a):e.lineTo(i,a)}),n.points.length===1){let r=n.points[0];r&&e.lineTo(ZT(r.x)*t.width+.1,ZT(r.y)*t.height)}e.stroke()}if(t.highlight){let{x:n,y:r,width:i,height:a}=t.highlight;e.strokeRect(ZT(n)*t.width,ZT(r)*t.height,Math.max(2,i*t.width),Math.max(2,a*t.height))}}function cE(e){let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);if(!n)throw Error(W(`browser.errors.canvasUnavailable`));return n.drawImage(e.image,0,0,e.width,e.height),sE(n,e),t.toDataURL(`image/png`)}var lE,uE,dE,fE,pE,mE;function hE(){return(hE=t((()=>{V(),lE=`openclaw:browser-annotation`,uE=80,dE=500,fE=160,pE=8,mE=`#e0442d`})))()}function gE(e,t=128){return typeof e==`string`&&e.length>0&&e.length<=t&&e.trim()===e}function _E(e){let t=y(e);if(!gE(t?.targetId)||!gE(t.profile))return;let n={targetId:t.targetId,profile:t.profile};if(t.target===`host`&&t.node===void 0)return{...n,target:`host`};if(t.target===`node`&&gE(t.node,256))return{...n,target:`node`,node:t.node}}function vE(e){return JSON.stringify([e?.target,e?.node,e?.profile])}function yE(e){return JSON.stringify([e.target,e.node,e.profile,e.targetId])}function bE(){return(bE=t((()=>{})))()}function xE(e){return F`<openclaw-panel-empty-state
|
|
.heading=${e.heading}
|
|
.description=${e.description}
|
|
>
|
|
${e.icon}${e.action!=null&&e.action!==P?F`<span slot="action">${e.action}</span>`:P}
|
|
</openclaw-panel-empty-state>`}var SE;function CE(){return(CE=t((()=>{I(),R(),M(),SE=class extends $t{constructor(...e){super(...e),this.heading=``,this.description=``}render(){return F`<div class="empty-state" role="status">
|
|
<div class="empty-state__icon" aria-hidden="true"><slot></slot></div>
|
|
<strong class="empty-state__title">${this.heading}</strong>
|
|
<p class="empty-state__description">${this.description}</p>
|
|
<slot name="action"></slot>
|
|
</div>`}static{this.styles=Bn`
|
|
:host {
|
|
display: flex;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
height: 100%;
|
|
min-width: 0;
|
|
min-height: 0;
|
|
flex: 1 1 auto;
|
|
}
|
|
|
|
.empty-state {
|
|
display: flex;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
min-height: 0;
|
|
flex: 1 1 auto;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 24px;
|
|
color: var(--muted);
|
|
text-align: center;
|
|
transform: translateY(-10px);
|
|
}
|
|
|
|
.empty-state__icon {
|
|
display: inline-flex;
|
|
width: 32px;
|
|
height: 32px;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 18px;
|
|
color: var(--muted);
|
|
}
|
|
|
|
::slotted(svg) {
|
|
width: 32px;
|
|
height: 32px;
|
|
stroke-width: 1.5px;
|
|
}
|
|
|
|
.empty-state__title {
|
|
color: var(--text);
|
|
font-size: calc(16px * var(--control-ui-text-scale, 1));
|
|
font-weight: 500;
|
|
line-height: 1.25;
|
|
}
|
|
|
|
.empty-state__description {
|
|
max-width: 320px;
|
|
margin: 8px 0 0;
|
|
color: var(--muted);
|
|
font-size: calc(13px * var(--control-ui-text-scale, 1));
|
|
line-height: 1.45;
|
|
}
|
|
|
|
::slotted([slot="action"]) {
|
|
margin-top: 16px;
|
|
}
|
|
`}},S([z()],SE.prototype,`heading`,void 0),S([z()],SE.prototype,`description`,void 0),customElements.get(`openclaw-panel-empty-state`)||customElements.define(`openclaw-panel-empty-state`,SE)})))()}function wE(e,t,n=!1,r=!1){return F`
|
|
<openclaw-panel-loading-skeleton
|
|
.variant=${e}
|
|
?compact=${n}
|
|
?overlay=${r}
|
|
role="status"
|
|
aria-busy="true"
|
|
aria-label=${t}
|
|
></openclaw-panel-loading-skeleton>
|
|
`}var TE;function EE(){return(EE=t((()=>{I(),R(),M(),TE=class extends $t{constructor(...e){super(...e),this.variant=`files`,this.compact=!1,this.overlay=!1}static{this.styles=Bn`
|
|
:host {
|
|
display: block;
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
min-height: 100%;
|
|
padding: 14px;
|
|
color: var(--muted);
|
|
}
|
|
|
|
:host([compact]) {
|
|
min-height: 0;
|
|
padding: 8px;
|
|
}
|
|
|
|
:host([overlay]) {
|
|
position: absolute;
|
|
inset: 0;
|
|
z-index: 2;
|
|
min-height: 0;
|
|
background: color-mix(in srgb, var(--bg, #0e1015) 92%, transparent);
|
|
pointer-events: none;
|
|
}
|
|
|
|
:host([compact]) .viewport,
|
|
:host([compact]) .terminal,
|
|
:host([compact]) .discussion-frame {
|
|
min-height: 72px;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.skeleton {
|
|
position: relative;
|
|
overflow: hidden;
|
|
background: var(--skeleton-base, var(--bg-muted));
|
|
border-radius: var(--radius-md);
|
|
}
|
|
|
|
.skeleton::after {
|
|
content: "";
|
|
position: absolute;
|
|
inset: 0;
|
|
background: linear-gradient(
|
|
90deg,
|
|
transparent 25%,
|
|
var(--skeleton-highlight, var(--bg-hover)) 50%,
|
|
transparent 75%
|
|
);
|
|
transform: translateX(-100%);
|
|
animation: panel-skeleton-shimmer var(--skeleton-duration, 1.5s) ease-in-out infinite;
|
|
will-change: transform;
|
|
}
|
|
|
|
.line {
|
|
height: 10px;
|
|
}
|
|
|
|
.short {
|
|
width: 36%;
|
|
}
|
|
|
|
.medium {
|
|
width: 62%;
|
|
}
|
|
|
|
.long {
|
|
width: 88%;
|
|
}
|
|
|
|
.row,
|
|
.toolbar,
|
|
.bubble,
|
|
.card,
|
|
.summary {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
}
|
|
|
|
.rows,
|
|
.conversation,
|
|
.code {
|
|
display: grid;
|
|
gap: 12px;
|
|
}
|
|
|
|
.toolbar {
|
|
padding-bottom: 12px;
|
|
border-bottom: 1px solid var(--border);
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.icon {
|
|
width: 18px;
|
|
height: 18px;
|
|
flex: 0 0 auto;
|
|
border-radius: 5px;
|
|
}
|
|
|
|
.copy {
|
|
display: grid;
|
|
flex: 1;
|
|
gap: 6px;
|
|
}
|
|
|
|
.meta {
|
|
height: 7px;
|
|
width: 28%;
|
|
}
|
|
|
|
.viewport {
|
|
min-height: 220px;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.address {
|
|
height: 28px;
|
|
flex: 1;
|
|
border-radius: 7px;
|
|
}
|
|
|
|
.button {
|
|
width: 28px;
|
|
height: 28px;
|
|
flex: 0 0 auto;
|
|
}
|
|
|
|
.card {
|
|
min-height: 58px;
|
|
padding: 10px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.summary {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.pill {
|
|
width: 64px;
|
|
height: 24px;
|
|
border-radius: 999px;
|
|
}
|
|
|
|
.file-heading {
|
|
height: 30px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.code .line {
|
|
height: 9px;
|
|
border-radius: 3px;
|
|
}
|
|
|
|
.terminal {
|
|
display: grid;
|
|
gap: 11px;
|
|
padding: 12px;
|
|
min-height: 220px;
|
|
align-content: start;
|
|
border-radius: 8px;
|
|
background: color-mix(in srgb, var(--bg) 76%, transparent);
|
|
}
|
|
|
|
.bubble {
|
|
width: 82%;
|
|
min-height: 58px;
|
|
padding: 12px;
|
|
align-items: flex-start;
|
|
border-radius: 12px;
|
|
background: color-mix(in srgb, var(--bg-muted) 76%, transparent);
|
|
}
|
|
|
|
.bubble.user {
|
|
width: 58%;
|
|
margin-left: auto;
|
|
}
|
|
|
|
.discussion-frame {
|
|
min-height: 280px;
|
|
padding: 18px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
@keyframes panel-skeleton-shimmer {
|
|
to {
|
|
transform: translateX(100%);
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.skeleton::after {
|
|
animation-duration: 0.01ms;
|
|
animation-iteration-count: 1;
|
|
}
|
|
}
|
|
`}line(e=`long`){return F`<div class="skeleton line ${e}"></div>`}rows(e){return Array.from({length:e},(e,t)=>F`
|
|
<div class="row">
|
|
<div class="skeleton icon"></div>
|
|
<div class="copy">
|
|
${this.line(t%2==0?`long`:`medium`)}
|
|
<div class="skeleton meta"></div>
|
|
</div>
|
|
</div>
|
|
`)}renderContent(){switch(this.variant){case`browser`:return F`
|
|
<div class="toolbar">
|
|
<div class="skeleton button"></div>
|
|
<div class="skeleton button"></div>
|
|
<div class="skeleton address"></div>
|
|
</div>
|
|
<div class="skeleton viewport"></div>
|
|
`;case`chat`:return F`
|
|
<div class="conversation">
|
|
<div class="bubble"><div class="copy">${this.line()}${this.line(`medium`)}</div></div>
|
|
<div class="bubble user"><div class="copy">${this.line(`medium`)}</div></div>
|
|
<div class="bubble"><div class="copy">${this.line()}${this.line(`short`)}</div></div>
|
|
</div>
|
|
`;case`desktop`:return F`
|
|
<div class="toolbar">${this.line(`medium`)}</div>
|
|
<div class="rows">${this.rows(3).map(e=>F`<div class="card">${e}</div>`)}</div>
|
|
`;case`discussion`:return F`
|
|
<div class="discussion-frame">
|
|
<div class="conversation">
|
|
${this.line(`medium`)} ${this.line()} ${this.line(`long`)} ${this.line(`short`)}
|
|
</div>
|
|
</div>
|
|
`;case`review`:return F`
|
|
<div class="summary">
|
|
<div class="skeleton pill"></div>
|
|
<div class="skeleton pill"></div>
|
|
</div>
|
|
<div class="skeleton file-heading"></div>
|
|
<div class="code">
|
|
${this.line()} ${this.line(`long`)} ${this.line(`medium`)} ${this.line()}
|
|
${this.line(`short`)}
|
|
</div>
|
|
`;case`terminal`:return F`
|
|
<div class="toolbar">
|
|
<div class="skeleton pill"></div>
|
|
<div class="skeleton pill"></div>
|
|
</div>
|
|
<div class="terminal">
|
|
${this.line(`medium`)} ${this.line()} ${this.line(`short`)} ${this.line(`long`)}
|
|
</div>
|
|
`;case`tasks`:return F`
|
|
<div class="toolbar">${this.line(`short`)}</div>
|
|
<div class="rows">${this.rows(4)}</div>
|
|
`;default:return F`
|
|
<div class="toolbar">
|
|
<div class="skeleton address"></div>
|
|
<div class="skeleton button"></div>
|
|
</div>
|
|
<div class="rows">${this.rows(5)}</div>
|
|
`}}render(){return F`${this.renderContent()}`}},S([z({reflect:!0,attribute:`data-panel-skeleton`})],TE.prototype,`variant`,void 0),S([z({type:Boolean,reflect:!0})],TE.prototype,`compact`,void 0),S([z({type:Boolean,reflect:!0})],TE.prototype,`overlay`,void 0),customElements.get(`openclaw-panel-loading-skeleton`)||customElements.define(`openclaw-panel-loading-skeleton`,TE)})))()}function DE(e){if(e.signal?.aborted)return Promise.resolve(!1);let t=document.createElement(`div`);return document.body.append(t),new Promise(n=>{let r=!1,i=!1,a=i=>{r||(r=!0,e.signal?.removeEventListener(`abort`,o),On(P,t),t.remove(),n(i))},o=()=>a(!1);e.signal?.addEventListener(`abort`,o,{once:!0});let s=e.title??W(`common.confirm`);On(F`
|
|
<openclaw-modal-dialog
|
|
label=${s}
|
|
description=${e.message}
|
|
@modal-cancel=${()=>a(!1)}
|
|
>
|
|
<div class="exec-approval-card">
|
|
<div class="exec-approval-header">
|
|
<div>
|
|
<div class="exec-approval-title">${s}</div>
|
|
<div class="exec-approval-sub" style="white-space: pre-line">
|
|
${e.message}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
${e.details?F`<div class="exec-approval-command mono">${e.details}</div>`:P}
|
|
${e.skipPreference?F`<label class="field checkbox exec-approval-skip">
|
|
<input
|
|
type="checkbox"
|
|
@change=${e=>{i=e.target.checked}}
|
|
/>
|
|
<span>${W(`common.dontAskAgain`)}</span>
|
|
</label>`:P}
|
|
<div class="exec-approval-actions">
|
|
<button
|
|
type="button"
|
|
class="btn ${e.danger?`danger`:`primary`}"
|
|
@click=${()=>{i&&e.skipPreference?.remember(),a(!0)}}
|
|
>
|
|
${e.confirmLabel??W(`common.confirm`)}
|
|
</button>
|
|
<button type="button" class="btn" autofocus @click=${()=>a(!1)}>
|
|
${e.cancelLabel??W(`common.cancel`)}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</openclaw-modal-dialog>
|
|
`,t)})}function OE(e){return e.skipPreference?.skipped?Promise.resolve(!0):kE?Promise.resolve(!1):(kE=!0,DE(e).finally(()=>{kE=!1}))}var kE;function AE(){return(AE=t((()=>{I(),V(),ui(),kE=!1})))()}function jE(e,t){return`${RE}${t(e)}${zE}`}function ME(e){let t=BE.get(e);if(t)return t;let n=new Set,r=0;for(let t=0;t<e.length;t+=1){let i=e[t]?.type;i===`link_open`?r+=1:i===`link_close`?r=Math.max(0,r-1):i===`image`&&r>0&&n.add(t)}return BE.set(e,n),n}function NE(e,t){return ME(e).has(t)}function PE(e,t,n){let r=``,i=0;for(let a of t){let t=Math.max(i,Math.min(a.start,e.length)),o=Math.max(t,Math.min(a.end,e.length));r+=n(e.slice(i,t)),o>t&&(r+=jE(e.slice(t,o),n)),i=o}return r+n(e.slice(i))}function FE(e,t){e.use(Ii,{isStructuralHtmlInline:e=>e.meta?.taskListPlugin===!0}),e.renderer.rules[ka]=(e,n)=>{let r=e[n];return r?jE(r.content,t):``}}function IE(e,t){e.renderer.rules.image=(e,n,r,i)=>{let a=e[n];if(!a)return``;let o=String(a.attrGet(`src`)??``).trim(),s=t.normalizeLabel(a.content),c=a.meta?.assistantTranscriptRoleImage,l=NE(e,n);if(!t.isInlineDataImage(o)&&!t.allowRemoteImages(i)){let e=c?PE(c.text,c.spans,t.escapeHtml):t.escapeHtml(s);return t.renderExternalImageFallback(o,e,l)}let u=`<img class="markdown-inline-image" src="${t.escapeHtml(o)}" alt="${t.escapeHtml(s)}">`,d=l||!t.interactiveImages(i)?u:`<button class="markdown-inline-image-button" type="button" aria-label="${t.escapeHtml(t.openImageLabel(s,a.content.trim().length>0))}">${u}</button>`;return c?`${jE(`${t.assistantLabel()}:`,t.escapeHtml)} ${d}`:d}}function LE(e,t,n,r){let i=r(e);return t?`<div class="markdown-plain-text-fallback">${jE(`${n()}:`,r)}\n<span class="markdown-plain-text-source">${i}</span></div>`:`<div class="markdown-plain-text-fallback">${i}</div>`}var RE,zE,BE;function VE(){return(VE=t((()=>{ta(),RE=`<code class="assistant-transcript-role">`,zE=`</code>`,BE=new WeakMap})))()}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function HE(e){return e.replace(/\r\n?|[\u2028\u2029]/g,`
|
|
`)}function UE(e){if(!GE.test(e))return!1;let t=HE(e).split(`
|
|
`).filter(e=>e.trim().length>0);if(t.length<2)return!1;let n=0;for(let e of t){if(!WE.test(e)||!GE.test(e))return!1;n+=Array.from(e).filter(e=>GE.test(e)).length}return n>=8}var WE,GE;function KE(){return(KE=t((()=>{WE=/^[\t \u00a0▀▄█]+$/u,GE=/[▀▄█]/u})))()}function qE(e){return e}function JE(e){return qE(e)?.codeBlockChrome!==`none`}function YE(e){return qE(e)?.codeBlockInteraction===`interactive`}function XE(e){return`${pD}${JSON.stringify(e)}`}function ZE(e,t){if(t!==mD||!e.startsWith(pD))return e;try{let t=JSON.parse(e.slice(24));return typeof t==`string`?t:e}catch{return e}}function QE(e){let t=e.target;if(!(t instanceof Element))return;$E(t);let n=t.closest(`.code-block-copy`);if(!n)return;let r=ZE(n.dataset.code??``,n.dataset.codeEncoding),i=(gD.get(n)??0)+1;gD.set(n,i),Kt(r).then(e=>{if(gD.get(n)!==i)return;n.classList.toggle(`copied`,e),n.classList.toggle(`copy-failed`,!e),n.setAttribute(`aria-label`,W(e?`common.copied`:`common.copyFailed`)),clearTimeout(_D.get(n));let t=setTimeout(()=>{n.classList.remove(`copied`),n.classList.remove(`copy-failed`),n.setAttribute(`aria-label`,W(`common.copyCode`)),_D.delete(n)},e?1500:2e3);_D.set(n,t)})}function $E(e){let t=e.closest(`.code-block-wrapper`);if(!t)return;e.closest(`.code-block-expand`)&&(t.classList.add(`is-expanded`),e.closest(`.code-block-expand`)?.setAttribute(`aria-expanded`,`true`));let n=e.closest(`.code-block-wrap`);if(!n)return;let r=t.classList.toggle(`is-wrapped`),i=W(r?`chat.codeBlock.disableWrap`:`chat.codeBlock.enableWrap`);n.setAttribute(`aria-pressed`,String(r)),n.setAttribute(`aria-label`,i),n.title=i,eD(t)}function eD(e){let t=e.querySelector(`.code-block-viewport`),n=t?.querySelector(`code`);if(!t||!n)return;let r=!e.classList.contains(`is-wrapped`)&&n.scrollWidth>t.clientWidth+1;e.classList.toggle(`has-horizontal-overflow`,r)}function tD(e){bD.add(e),SD?.observe(e)}function nD(){for(let e of bD)e.isConnected||(SD?.unobserve(e),bD.delete(e))}function rD(e){for(let t of e.querySelectorAll(`.code-block-wrapper`)){if(yD.has(t))continue;let e=t.querySelector(`.code-block-viewport`),n=e?.querySelector(`code`);if(!e||!n)continue;yD.add(t);let r=t.querySelector(`.code-block-expand`);if(r){vD+=1;let t=`code-block-${vD}`;e.id=t,r.setAttribute(`aria-controls`,t)}tD(e),tD(n),eD(t)}}function iD(e){let t=xD.size>0;xD.add(e),!t&&queueMicrotask(()=>{let e=[...xD];xD.clear(),nD();for(let t of e)rD(t)})}function aD(e,t){let n=t.trim().toLowerCase();try{if(n&&Os.getLanguage(n))return Os.highlight(e,{language:n,ignoreIllegals:!0}).value;if(!n&&e.trim()){let t=Os.highlightAuto(e);if(t.relevance>=2)return t.value}}catch{}return X(e)}function oD(e){return aD(e,`json`)}function sD(e,t){let n=[t.includes(`hljs-`)?`hljs`:``,e?`language-${e}`:``].filter(Boolean);return n.length>0?` class="${X(n.join(` `))}"`:``}function cD(e,t,n={}){if(n.blockArt||UE(e))return`<pre><code class="markdown-block-art">${X(e)}</code></pre>`;let r=n.highlight===!1?X(e):aD(e,t);return`<pre><code${sD(t,r)}>${r}</code></pre>`}function lD(e,t){return`<div class="code-block-header"><span class="code-block-lang">${X(e||W(`chat.codeBlock.languageFallback`))}</span><div class="code-block-actions">${t}</div></div>`}function uD(e,t,n){let r=n??e;return`<button type="button" class="code-block-copy" data-code="${X(t?XE(r):r)}"${t?` data-code-encoding="${mD}"`:``} aria-label="${X(W(`common.copyCode`))}"><span class="code-block-copy__idle" aria-hidden="true"></span><span class="code-block-copy__done" aria-hidden="true"></span><span class="code-block-copy__failed" aria-hidden="true">!</span></button>`}function dD(e,t,n,r={}){let i=r.blockArt||UE(e),a=cD(e,t,{blockArt:i,highlight:r.highlight});if(!JE(n)&&!YE(n))return a;let o=JE(n)?uD(e,i,r.copyText):``;if(!YE(n))return`<div class="code-block-wrapper">${lD(t,o)}${a}</div>`;let s=[`text`,`md`,`markdown`].includes(t.trim().toLowerCase())?0:Math.max(0,fD(e).split(`
|
|
`).length-hD),c={count:String(s)},l=W(s===1?`chat.codeBlock.showHiddenLine`:`chat.codeBlock.showHiddenLines`,c),u=W(s===1?`chat.codeBlock.hiddenLine`:`chat.codeBlock.hiddenLines`,c),d=s?`<button type="button" class="code-block-expand" aria-label="${X(l)}" aria-expanded="false"><span class="code-block-chevron" aria-hidden="true"></span><span>${X(u)}</span></button>`:``,f=X(W(`chat.codeBlock.enableWrap`)),p=lD(t,`${`<button type="button" class="code-block-wrap" aria-label="${f}" title="${f}" aria-pressed="false"><span class="code-block-wrap__enable" aria-hidden="true"></span><span class="code-block-wrap__disable" aria-hidden="true"></span></button>`}${o}`);return`<div class="code-block-wrapper${s?` is-collapsible`:``}">${p}<div class="code-block-viewport">${a}</div>${d}</div>`}function fD(e){return e.endsWith(`
|
|
`)?e.slice(0,-1):e}var pD,mD,hD,gD,_D,vD,yD,bD,xD,SD;function CD(){return(CD=t((()=>{ks(),Ts(),Fs(),Ks(),Rs(),Is(),V(),KE(),pD=`openclaw:block-art-code:`,mD=`block-art-json`,hD=7,gD=new WeakMap,_D=new WeakMap,vD=0;for(let[e,t]of Object.entries({bash:ws,cpp:As,css:Es,diff:qs,go:Ms,java:Js,javascript:Ys,json:Ns,markdown:zs,python:Hs,rust:Ls,typescript:Bs,xml:Ws,yaml:Ps}))Os.registerLanguage(e,t);Os.registerAliases(`shell`,{languageName:`bash`}),yD=new WeakSet,bD=new Set,xD=new Set,SD=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>{for(let t of e){let e=t.target.closest(`.code-block-wrapper`);e&&eD(e)}})})))()}function wD(e){let t=e.target;if(!(t instanceof Element))return null;let n=t.closest(`a[data-file-path]`),r=n?.dataset.filePath;if(!r)return null;let i=n.dataset.fileLine;return{path:r,line:i?Number.parseInt(i,10):null}}function TD(e){if(e.key!==`Enter`&&e.key!==` `)return null;let t=wD(e);return t&&e.preventDefault(),t}function ED(e){let t=UD.exec(e),n=t?.[1];return t&&n?{path:e.slice(0,t.index),line:Number.parseInt(n,10)}:{path:e,line:null}}function DD(e){if(e.includes(`/`)||e.includes(`\\`))return!1;let t=VD.exec(e);return!!(t?.[1]&&WD.has(t[1].toLowerCase()))}function OD(e){let t=e.trim();return!zD.test(t)&&!BD.test(t)&&!DD(t)?null:ED(t)}function kD(e){return AD.test(e.trim())}var AD,jD,MD,ND,PD,FD,ID,LD,RD,zD,BD,VD,HD,UD,WD;function GD(){return(GD=t((()=>{AD=/^(?:~\/|\/(?:Users|home|tmp|private\/tmp|var\/folders|private\/var\/folders)\/|\/[A-Za-z]:\/|[A-Za-z]:[\\/])/,jD=`[A-Za-z0-9_.@#+-]+`,MD=`[A-Za-z0-9]{1,8}`,ND=`:\\d{1,6}(?::\\d{1,6})?`,PD=`${jD}\\.${MD}`,FD=`(?:~\\/|\\.\\.\\/|\\.\\/|\\/)(?:${jD}\\/)*${PD}`,ID=`${jD}(?:\\/${jD})*\\/${PD}`,LD=`(?:${FD}|${`[A-Za-z]:[\\\\/](?:${jD}[\\\\/])*${PD}`}|${ID})(?:${ND})?`,RD=`${jD}\\.${MD}${ND}`,zD=RegExp(`^${LD}$`),BD=RegExp(`^${RD}$`),VD=RegExp(`^${jD}\\.(${MD})$`,`i`),HD=RegExp(`${LD}|${RD}`,`g`),UD=/:(\d{1,6})(?::\d{1,6})?$/,WD=new Set(`astro.bash.c.cc.cfg.cjs.conf.cpp.cs.css.diff.fish.go.h.hpp.htm.html.ini.java.js.json.jsonc.jsx.kt.kts.less.lock.log.markdown.md.mdx.mjs.patch.plist.proto.py.rb.rs.scss.sh.sql.svelte.svg.swift.toml.ts.tsx.txt.vue.xml.yaml.yml.zsh`.split(`.`))})))()}function KD(e){let t=e.split($D);return t[t.length-1]??e}function qD(e){let t=KD(e).toLowerCase(),n=ZD[t];if(n)return n;let r=t.lastIndexOf(`.`),i=r>0?t.slice(r+1):``;return QD[i]??`file`}function JD(e,t){let n=e;for(let e=t.length-1;e>=0;e--){let r=t[e],i=n.children.get(r);i||(i={pathCount:0,children:new Map},n.children.set(r,i)),n=i,n.pathCount+=1}}function YD(e,t){let n=e;for(let e=1;e<=t.length;e++)if(n=n.children.get(t[t.length-e])??n,n.pathCount===1||e===t.length)return e;return t.length}function XD(e){let t=[...new Set(e)],n=new Map(t.map(e=>[e,e.split($D).filter(Boolean)])),r={pathCount:0,children:new Map};for(let e of n.values())JD(r,e);let i=new Map;for(let e of t){let t=n.get(e)??[],a=YD(r,t);i.set(e,t.slice(-a).join(e.includes(`\\`)?`\\`:`/`))}return i}var ZD,QD,$D;function eO(){return(eO=t((()=>{ZD={"bun.lock":`package`,"package-lock.json":`package`,"package.json":`package`,"pnpm-lock.yaml":`package`,"yarn.lock":`package`},QD={astro:`component`,avif:`image`,bash:`shell`,c:`code`,cc:`code`,cfg:`data`,cjs:`code`,conf:`data`,cpp:`code`,cs:`code`,css:`code`,cts:`code`,fish:`shell`,gif:`image`,go:`code`,h:`code`,hpp:`code`,htm:`code`,html:`code`,ico:`image`,ini:`data`,java:`code`,jpeg:`image`,jpg:`image`,js:`code`,json:`data`,jsonc:`data`,jsx:`component`,kt:`code`,kts:`code`,less:`code`,lock:`data`,markdown:`markdown`,md:`markdown`,mdx:`markdown`,mjs:`code`,mts:`code`,php:`code`,plist:`data`,png:`image`,proto:`data`,py:`code`,rb:`code`,rs:`code`,scss:`code`,sh:`shell`,sql:`code`,svelte:`component`,svg:`image`,swift:`code`,toml:`data`,ts:`code`,tsx:`component`,vue:`component`,webp:`image`,xml:`data`,yaml:`data`,yml:`data`,zsh:`shell`},$D=/[\\/]/})))()}function tO(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function nO(e,t){return t.some(([t,n])=>e>=t&&e<n)}function rO(e){let t=pO.exec(e);return t?t[1]?`details_open_expanded`:`details_open`:mO.test(e)?`details_close`:hO.test(e)?`summary_open`:gO.test(e)?`summary_close`:null}function iO(e,t=Wi(e),n=0){if(!/^[ \t]*<\/?(?:details|summary)(?=[\s>])/i.exec(e))return null;let r=[];for(let i of e.matchAll(fO)){let a=i.index??0;tO(e,a)||nO(n+a,t)||r.push({end:a+i[0].length,raw:i[0],start:a})}return r.length>0?r:null}function aO(e,t,n){if(!t.trim())return;let r=e.push(`paragraph_open`,`p`,1);r.map=[n,n+1];let i=e.push(`inline`,``,0);i.content=t,i.map=[n,n+1],i.children=[],e.push(`paragraph_close`,`p`,-1)}function oO(e,t,n){let r=e.push(`summary_open`,`summary`,1);r.map=[n,n+1];let i=e.push(`inline`,``,0);i.content=t,i.map=[n,n+1],i.children=[],e.push(`summary_close`,`summary`,-1)}function sO(e,t,n,r){let i=iO(t);if(!i)return!1;let a=i.map(e=>rO(e.raw)),o=Array.from({length:i.length},()=>-1),s=-1;for(let e=i.length-1;e>=0;--e)o[e]=s,a[e]===`summary_close`&&(s=e);let c=0,l=``,u=()=>{aO(e,l,n),l=``};for(let s=0;s<i.length;s+=1){let d=i[s];if(!d)continue;l+=t.slice(c,d.start);let f=a[s];if((f===`details_open`||f===`details_open_expanded`)&&r.length<32){u();let t=e.push(`details_open`,`details`,1);f===`details_open_expanded`&&t.attrSet(`open`,``),r.push({hasSummary:!1})}else if(f===`details_close`&&r.length>0)u(),e.push(`details_close`,`details`,-1),r.pop();else if(f===`summary_open`){let a=r.at(-1),f=o[s]??-1,p=f>=0?i[f]:void 0;if(a&&!a.hasSummary&&p){u(),oO(e,t.slice(d.end,p.start),n),a.hasSummary=!0,c=p.end,s=f;continue}l+=d.raw}else l+=d.raw;c=d.end}return l+=t.slice(c),u(),!0}function cO(e,t,n,r){if((e.sCount[t]??0)-e.blkIndent>=4)return!1;let i=(e.bMarks[t]??0)+(e.tShift[t]??0),a=e.eMarks[t]??e.src.length,o=e.src.slice(i,a);return iO(o)?r?!0:(sO(e,o,t,e[_O]??=[]),e.line=t+1,!0):!1}function lO(e){let t=e.trimStart();if(t.startsWith(`<!--`))return`comment`;if(t.startsWith(`<?`))return`processing_instruction`;if(t.startsWith(`<![CDATA[`))return`cdata`;if(/^<![A-Z]/.test(t))return`declaration`;let n=/^<(pre|script|style|textarea)(?=[\s>]|$)/i.exec(t)?.[1];return n?{element:n.toLowerCase()}:null}function uO(e,t){return typeof e==`object`?t.toLowerCase().includes(`</${e.element}>`):e===`comment`?t.includes(`-->`):e===`processing_instruction`?t.includes(`?>`):e===`declaration`?t.includes(`>`):t.includes(`]]>`)}function dO(e){e.block.ruler.before(`html_block`,`details_block`,cO,{alt:[`paragraph`,`reference`,`blockquote`]}),e.core.ruler.after(`block`,`details_balance`,e=>{let t=[],n=[];for(let r of e.tokens){if(r.type===`details_open`){n.push({hasSummary:!1}),t.push(r);continue}if(r.type===`summary_open`){let e=n.at(-1);e&&(e.hasSummary=!0),t.push(r);continue}if(r.type===`details_close`){n.pop(),t.push(r);continue}if(r.type!==`html_block`||n.length===0){t.push(r);continue}let i=r.level,a=[],o={push(t,n,r){let o=new e.Token(t,n,r);return o.block=!0,r<0&&--i,o.level=i,r>0&&(i+=1),a.push(o),o}},s=r.content.split(`
|
|
`),c=``,l=null,u=()=>{if(!c)return;let e=o.push(`html_block`,``,0);e.content=c,e.map=r.map,c=``};for(let[e,t]of s.entries()){let i=e<s.length-1;if(l){c+=t+(i?`
|
|
`:``),uO(l,t)&&(l=null);continue}let a=lO(t);if(a){c+=t+(i?`
|
|
`:``),uO(a,t)||(l=a);continue}if(!iO(t)){c+=t+(i?`
|
|
`:``);continue}u(),sO(o,t,(r.map?.[0]??0)+e,n)}u(),t.push(...a)}for(;n.length>0;){let r=new e.Token(`details_close`,`details`,-1);r.block=!0,t.push(r),n.pop()}let r=0;for(let e of t)e.nesting<0&&--r,e.level=r,e.nesting>0&&(r+=1);e.tokens=t}),e.renderer.rules.details_open=(e,t)=>e[t]?.attrGet(`open`)===null?`<details>`:`<details open>`,e.renderer.rules.details_close=()=>`</details>
|
|
`,e.renderer.rules.summary_open=()=>`<summary>`,e.renderer.rules.summary_close=()=>`</summary>`}var fO,pO,mO,hO,gO,_O;function vO(){return(vO=t((()=>{Bi(),fO=/<\/?(?:details|summary)(?=[\s>])[^>]*>/gi,pO=/^<details( open)?>$/i,mO=/^<\/details>$/i,hO=/^<summary>$/i,gO=/^<\/summary>$/i,_O=Symbol(`markdownDetailsStack`)})))()}function yO(e,t){let n=e[t-1];return n===void 0||/\s/.test(n)||`([{<"'\``.includes(n)}function bO(e,t){let n=e[t];return n===void 0||/\s/.test(n)||`.,;:!?)]}>"'`.includes(n)}function xO(e){let t=e.trim(),n=E(t);return!n||`agent:${n.agentId}:${n.rest}`!==t.toLowerCase()?null:{sessionKey:t,agentId:n.agentId}}function SO(e,t){e.core.ruler.after(`linkify`,`session-links`,e=>{if(e.env?.sessionLinks===!0)for(let n of e.tokens){if(n.type!==`inline`||!n.children)continue;let r=n.children,i=0;for(let n=0;n<r.length;n++){let a=r[n];if(!a)continue;if(a.type===`link_open`){i+=1;continue}if(a.type===`link_close`){i=Math.max(0,i-1);continue}if(i>0)continue;if(a.type===`code_inline`){let e=xO(a.content);e&&(a.meta={...a.meta,sessionLink:{sessionKey:e.sessionKey}});continue}if(a.type!==`text`)continue;let o=[],s=0;t.lastIndex=0;for(let n of a.content.matchAll(t)){let t=n.index,r=n[0],i=t+r.length;if(!yO(a.content,t)||!bO(a.content,i)||!xO(r))continue;if(t>s){let n=new e.Token(`text`,``,0);n.content=a.content.slice(s,t),o.push(n)}let c=new e.Token(`link_open`,`a`,1);c.markup=`session-link`,c.attrSet(`class`,`markdown-session-link`),c.attrSet(`role`,`link`),c.attrSet(`tabindex`,`0`),c.attrSet(`data-session-key`,r);let l=new e.Token(`text`,``,0);l.content=r;let u=new e.Token(`link_close`,`a`,-1);u.markup=`session-link`,o.push(c,l,u),s=i}if(o.length!==0){if(s<a.content.length){let t=new e.Token(`text`,``,0);t.content=a.content.slice(s),o.push(t)}r.splice(n,1,...o),n+=o.length-1}}}})}function CO(e){let t=e.target;if(!(t instanceof Element))return null;let n=t.closest(`a[data-session-key]`)?.dataset.sessionKey;return n?xO(n):null}function wO(e,t,n=``){let r=e.target;if(!(r instanceof Element))return null;let i=r.closest(`a[href]`)?.getAttribute(`href`)?.trim(),a=globalThis.location;if(!i||!a)return null;let o;try{o=new URL(i,a.href)}catch{return null}if(o.origin!==a.origin)return null;let s=t(o.pathname,n);return s?{namespace:s.namespace,pathname:o.pathname,...o.search?{search:o.search}:{},...o.hash?{hash:o.hash}:{}}:null}function TO(e){if(e.key!==`Enter`&&e.key!==` `)return null;let t=CO(e);return t&&e.preventDefault(),t}function EO(e,t){if(`pathname`in t){let{namespace:n,...r}=t;e.navigate(n,r);return}let n=zt({context:e,face:`chat`,sessionKey:t.sessionKey,agentId:t.agentId,exactKey:!0,preferenceDerivedFace:!0});e.navigate(`chat`,n.options)}var DO;function OO(){return(OO=t((()=>{Se(),O(),DO=/agent:[^\s<>"'`]*[^\s<>"'`.,;:!?)}\]]/g})))()}function kO(e){return typeof e==`object`&&!!e&&`tableInteractions`in e&&e.tableInteractions===`enabled`}function AO(e){let t=e.renderer.rules.table_open,n=e.renderer.rules.table_close;e.renderer.rules.table_open=(e,n,r,i,a)=>kO(i)?`<div class="markdown-table" data-table-interactions><div class="markdown-table__viewport"><table>`:t?.(e,n,r,i,a)??`<table>
|
|
`,e.renderer.rules.table_close=(e,t,r,i,a)=>kO(i)?`</table></div><div class="markdown-table__actions"><button type="button" class="markdown-table__expand" aria-label="${X(W(`common.expandTable`))}"></button><button type="button" class="markdown-table__copy" aria-label="${X(W(`common.copyTable`))}"></button></div></div>`:n?.(e,t,r,i,a)??`</table>
|
|
`}function jO(e){return[...e.rows].map(e=>[...e.cells].map(e=>e.textContent?.trim()??``).join(` `)).join(`
|
|
`)}function MO(e){let t=e.querySelector(zO);if(!t)return;let n=t.scrollWidth-t.clientWidth>1;e.classList.toggle(`markdown-table--can-scroll-left`,n&&t.scrollLeft>1),e.classList.toggle(`markdown-table--can-scroll-right`,n&&t.scrollLeft+t.clientWidth<t.scrollWidth-1)}function NO(e,t){if(BO.has(e)){MO(e);return}let n=e.querySelector(zO),r=e.querySelector(`.markdown-table__expand`),i=e.querySelector(`.markdown-table__copy`);!n||!r||!i||(BO.add(e),On(hi.maximize,r),On(H.copy,i),n.addEventListener(`scroll`,()=>MO(e),{passive:!0}),t?.observe(n),MO(e))}function PO(e){let t=VO.get(e);if(!t){let n=new Set,r=typeof ResizeObserver==`function`?new ResizeObserver(e=>{for(let t of e){let e=t.target.closest(RO);e&&MO(e)}}):null,i=new MutationObserver(()=>{for(let t of n)(!t.isConnected||!e.contains(t))&&(r?.unobserve(t),n.delete(t));for(let t of e.querySelectorAll(RO)){let e=t.querySelector(zO);NO(t,r),e&&n.add(e)}});i.observe(e,{childList:!0,subtree:!0}),t={mutationObserver:i,resizeObserver:r,observedViewports:n},VO.set(e,t)}for(let n of e.querySelectorAll(RO)){let e=n.querySelector(zO);NO(n,t.resizeObserver),e&&t.observedViewports.add(e)}}function FO(e){let t=VO.get(e);t&&(t.mutationObserver.disconnect(),t.resizeObserver?.disconnect(),t.observedViewports.clear(),VO.delete(e))}function IO(e,t){let n=document.createElement(`dialog`);n.className=`markdown-table-dialog chat-text`,n.setAttribute(`aria-label`,W(`common.expandedTable`));let r=document.createElement(`button`);r.type=`button`,r.className=`markdown-table-dialog__close`,r.setAttribute(`aria-label`,W(`common.closeTable`)),On(H.x,r);let i=e.cloneNode(!0);n.append(r,i),r.addEventListener(`click`,()=>n.close()),n.addEventListener(`click`,e=>{if(e.target!==n)return;let t=n.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&n.close()}),n.addEventListener(`close`,()=>{n.remove(),t.isConnected&&t.focus({preventScroll:!0})}),document.body.append(n),n.showModal(),r.focus({preventScroll:!0})}function LO(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(RO);if(!n)return;NO(n);let r=n.querySelector(`table`);if(!r)return;let i=t.closest(`.markdown-table__expand`);if(i){IO(r,i);return}let a=t.closest(`.markdown-table__copy`);a&&Kt(jO(r)).then(e=>{a.setAttribute(`aria-label`,W(e?`common.copied`:`common.copyFailed`)),e&&On(H.check,a),clearTimeout(HO.get(a));let t=setTimeout(()=>{On(H.copy,a),a.setAttribute(`aria-label`,W(`common.copyTable`)),HO.delete(a)},e?1500:2e3);HO.set(a,t)})}var RO,zO,BO,VO,HO;function UO(){return(UO=t((()=>{I(),V(),Mi(),U(),KE(),RO=`.chat-text .markdown-table[data-table-interactions]`,zO=`.markdown-table__viewport`,BO=new WeakSet,VO=new WeakMap,HO=new WeakMap})))()}function WO(e,t,n,r){let i=e[t];if(!i)return``;let a=i.content;return n?ik.test(a.trim())?a:``:X(a)+(r?`
|
|
`:``)}function GO(e,t){let n=``;for(let r=t+1;r<e.length;r++){let t=e[r];if(!t||t.type===`link_close`)break;(t.type===`text`||t.type===`code_inline`)&&(n+=t.content)}return n.trim()}function KO(e){return e?.trim()||`image`}function qO(e){let t;try{t=new URL(e)}catch{return null}return t.protocol===`https:`||t.protocol===`http:`?t:null}function JO(e){let t=e.pathname.split(`/`).filter(Boolean),n=vi(e);if(n)return t.length===4&&!e.search&&!e.hash?`#${n.number}`:e.href;if(t.length===2)return t.map(e=>Ti(e)??e).join(`/`);if(t[2]===`blob`&&t.length>4){let e=Ti(t.at(-1)??``);if(e)return e}return[`github.com`,...(t.length>2?t.slice(2):t).map(e=>Ti(e)??e)].join(`/`)}function YO(e,t){let n=e[t-1];return n===void 0||/\s/.test(n)||`([{<"'\``.includes(n)}function XO(e,t){let n=e[t];return n===void 0||/\s/.test(n)||`.,;:!?)]}>"'`.includes(n)}function ZO(){let e=new Vs({html:!0,breaks:!0,linkify:!0}),t=e.renderer.rules.code_inline;return e.enable(`strikethrough`),FE(e,X),dO(e),AO(e),e.linkify.set({fuzzyLink:!1}),e.linkify.add(`www`,{validate(e,t){let n=e.slice(t),r=n.match(/^\.(?:[a-zA-Z0-9-]+\.?)+[^\s<\u2E80-\u2FFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFF01-\uFF60]*/);if(!r)return 0;let i=r[0].length,a={")":`(`,"]":`[`,"}":`{`,'"':`"`,"'":`'`},o={};for(let[e,t]of Object.entries(a)){o[e]=0;for(let r=0;r<i;r++){let i=n.charAt(r);t===e?i===t&&(o[e]=+(o[e]===0)):i===t?o[e]=(o[e]??0)+1:i===e&&(o[e]=(o[e]??0)-1)}}for(;i>0;){let e=n.charAt(i-1);if(/[?!.,:*_~]/.test(e)){i--;continue}if(e===`;`){let e=i-2;for(;e>=0&&/[a-zA-Z0-9]/.test(n.charAt(e));)e--;if(e>=0&&n.charAt(e)===`&`&&e<i-2){i=e;continue}break}let t=a[e];if(t!==void 0){if(t===e){if((o[e]??0)!==0){o[e]=0,i--;continue}}else if((o[e]??0)<0){o[e]=(o[e]??0)+1,i--;continue}}break}return i},normalize(e){e.url=`http://`+e.url}}),e.validateLink=()=>!0,e.core.ruler.after(`linkify`,`disallowed-link-schemes`,e=>{for(let t of e.tokens){let e=t.children;if(t.type!==`inline`||!e)continue;let n=!1;for(let t of e)t.type===`link_open`&&ek.test(String(t.attrGet(`href`)??``))?(t.hidden=!0,n=!0):t.type===`link_close`&&n&&(t.hidden=!0,n=!1)}}),e.core.ruler.after(`linkify`,`linkify-cjk-trim`,e=>{for(let t of e.tokens){if(t.type!==`inline`||!t.children)continue;let n=t.children;for(let t=n.length-1;t>=0;t--){let r=n[t];if(!r||r.type!==`link_open`||r.markup!==`linkify`)continue;let i=n[t+1];if(!i||i.type!==`text`)continue;let a=i.content,o=a.length;for(;o>0&&tk.test(a.charAt(o-1));)o--;if(o<=0||o===a.length)continue;let s=a.slice(0,o),c=a.slice(o),l=String(r.attrGet(`href`)??``),u=l.indexOf(a),d=u>0?l.slice(0,u):``;r.attrSet(`href`,d+s),i.content=s;for(let r=t+1;r<n.length;r++)if(n[r]?.type===`link_close`){let t=new e.Token(`text`,``,0);t.content=c,n.splice(r+1,0,t);break}}}}),e.core.ruler.after(`linkify`,`file-links`,e=>{if(e.env?.fileLinks!==!0)return;let t=[];for(let n of e.tokens){if(n.type!==`inline`||!n.children)continue;let r=n.children,i=0;for(let n=0;n<r.length;n++){let a=r[n];if(!a)continue;if(a.type===`link_open`){let e=String(a.attrGet(`href`)??``);if(e){let t=e;try{t=decodeURIComponent(e)}catch{}if(!t.includes(`://`)){let e=OD(t)??(kD(t)?ED(t.trim()):null);if(e){a.attrs=a.attrs?.filter(([e])=>e!==`href`)??null,a.attrJoin(`class`,`markdown-file-link`),a.attrSet(`role`,`button`),a.attrSet(`tabindex`,`0`),a.attrSet(`data-file-path`,e.path),a.attrSet(`data-file-kind`,qD(e.path)),e.line!==null&&a.attrSet(`data-file-line`,String(e.line));let i=t.trim();GO(r,n)!==i&&a.attrSet(`title`,i)}}}i+=1;continue}if(a.type===`link_close`){i=Math.max(0,i-1);continue}if(i>0)continue;if(a.type===`code_inline`){let e=OD(a.content);if(e){let n=a.content.trim(),r={path:e.path,line:e.line,title:null};a.meta={...a.meta,fileLink:r},t.push({path:e.path,reference:n,applyLabel:e=>{a.content=e,r.title=e===n?null:n}})}continue}if(a.type!==`text`)continue;let o=[],s=0;HD.lastIndex=0;for(let n of a.content.matchAll(HD)){let r=n.index,i=n[0],c=r+i.length;if(!YO(a.content,r)||!XO(a.content,c))continue;let l=OD(i);if(!l)continue;if(r>s){let t=new e.Token(`text`,``,0);t.content=a.content.slice(s,r),o.push(t)}let u=new e.Token(`link_open`,`a`,1);u.markup=`file-link`,u.attrSet(`class`,`markdown-file-link`),u.attrSet(`role`,`button`),u.attrSet(`tabindex`,`0`),u.attrSet(`data-file-path`,l.path),u.attrSet(`data-file-kind`,qD(l.path)),l.line!==null&&u.attrSet(`data-file-line`,String(l.line));let d=new e.Token(`text`,``,0);d.content=i;let f=new e.Token(`link_close`,`a`,-1);f.markup=`file-link`,o.push(u,d,f),t.push({path:l.path,reference:i,applyLabel:e=>{d.content=e,e!==i&&u.attrSet(`title`,i)}}),s=c}if(o.length!==0){if(s<a.content.length){let t=new e.Token(`text`,``,0);t.content=a.content.slice(s),o.push(t)}r.splice(n,1,...o),n+=o.length-1}}}let n=XD(t.map(e=>e.path));for(let e of t){let t=n.get(e.path)??e.path;e.applyLabel(t+e.reference.slice(e.path.length))}}),SO(e,DO),e.core.ruler.after(`linkify`,`web-link-classes`,e=>{for(let t of e.tokens){if(t.type!==`inline`||!t.children)continue;let n=t.children;for(let t=0;t<n.length;t++){let r=n[t];if(r?.type!==`link_open`)continue;let i=String(r.attrGet(`href`)??``),a=i?qO(i):null;if(!a)continue;let o=r.markup===`linkify`||r.markup===`autolink`,s=a.hostname.toLowerCase(),c=s===`github.com`||s===`www.github.com`;o&&r.attrJoin(`class`,rk);let l=null;for(let e=t+1;e<n.length;e++){let t=n[e];if(!t||t.type===`link_close`)break;if((t.type===`text`||t.type===`code_inline`)&&t.content.trim()!==``){l=t;break}}if(c&&l&&r.attrJoin(`class`,nk),c&&o&&l&&(l.content=JO(a),r.attrSet(`title`,i??a.href)),!c&&l&&e.env.linkFavicons){let r=new e.Token(`link_favicon`,`img`,0);r.meta={hostname:s},n.splice(t+1,0,r),t+=1}}}}),e.use(QO.default,{enabled:!1,label:!1}),e.core.ruler.after(`github-task-lists`,`task-list-allowlist`,e=>{for(let[t,n]of e.tokens.entries()){if(n.type!==`list_item_open`||n.attrGet(`class`)!==`task-list-item`)continue;let r=e.tokens[t+2]?.children?.[0];r?.type===`html_inline`&&(r.meta={taskListPlugin:!0})}}),e.renderer.rules.html_block=(e,t,n,r)=>WO(e,t,r?.progressBars===!0,!0),e.renderer.rules.html_inline=(e,t,n,r)=>{let i=e[t];return i?.meta?.taskListPlugin===!0?i.content:WO(e,t,r?.progressBars===!0,!1)},e.renderer.rules.link_favicon=(e,t)=>{let n=e[t]?.meta?.hostname;return typeof n==`string`?`<img class="markdown-link-favicon" data-link-favicon-host="${X(n)}" alt="" role="presentation">`:``},e.renderer.rules.code_inline=(e,n,r,i,a)=>{let o=t(e,n,r,i,a),s=e[n]?.meta?.fileLink;if(s){let e=s.line===null?``:` data-file-line="${X(String(s.line))}"`,t=s.title===null?``:` title="${X(s.title)}"`;return`<a class="markdown-file-link" role="button" tabindex="0" data-file-path="${X(s.path)}" data-file-kind="${qD(s.path)}"${e}${t}>${o}</a>`}let c=p(e[n]?.meta?.sessionLink)?.sessionKey;return typeof c==`string`?`<a class="markdown-session-link" role="link" tabindex="0" data-session-key="${X(c)}">${o}</a>`:o},IE(e,{escapeHtml:X,isInlineDataImage:e=>$O.test(e),normalizeLabel:KO,assistantLabel:()=>W(`sessionsView.assistant`),openImageLabel:(e,t)=>W(`chat.imageLightbox.open`,{title:t?e:W(`chat.imageLightbox.untitled`)}),renderExternalImageFallback:(e,t,n)=>qO(e)?`<span class="markdown-external-image">${`<span>${X(W(`chat.externalImage.notLoaded`))}: ${t}</span>`}${n?``:` <a href="${X(e)}">${X(W(`chat.externalImage.open`))}</a>`}</span>`:t,interactiveImages:e=>e?.interactiveImages===!0,allowRemoteImages:e=>e?.mode===`document`}),e.renderer.rules.fence=(e,t,n,r)=>{let i=e[t];if(!i)return``;let a=i.info.trim().split(/\s+/)[0]||``,o=r?.streamingOpenFence===!0;return dD(i.content,a,r,{copyText:fD(i.content),highlight:!o||e.findLastIndex(({nesting:e})=>e!==-1)!==t})},e.renderer.rules.code_block=(e,t,n,r)=>{let i=e[t]?.content;return i===void 0?``:dD(i,``,r,{copyText:fD(i)})},e}var QO,$O,ek,tk,nk,rk,ik;function ak(){return(ak=t((()=>{Us(),QO=e(Gs(),1),V(),eO(),ki(),VE(),CD(),vO(),GD(),OO(),UO(),KE(),$O=/^data:image\/[a-z0-9.+-]+;base64,/i,ek=/^(?!(?:https?|mailto):)[a-z][a-z0-9+.-]*:/i,tk=RegExp(`[\\u2E80-\\u2FFF\\u3000-\\u303F\\u3040-\\u309F\\u30A0-\\u30FF\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uAC00-\\uD7AF\\uF900-\\uFAFF\\uFF01-\\uFF60]`),nk=`markdown-github-link`,rk=`markdown-bare-url`,ik=/^(?:<progress(?:\s[^<>]*)?>\s*(?:<\/progress>)?|<\/progress>)$/iu})))()}function ok(e={}){return{assistantTranscriptRoleHeaders:e.assistantTranscriptRoleHeaders??!1,codeBlockChrome:e.codeBlockChrome??`copy`,codeBlockInteraction:e.codeBlockInteraction??`static`,fileLinks:e.fileLinks??!1,interactiveImages:e.interactiveImages??!1,linkFavicons:e.linkFavicons??!1,progressBars:e.progressBars??!1,mode:e.mode??`message`,sessionLinks:e.sessionLinks??!1,tableInteractions:e.tableInteractions??`none`}}function sk(e){let t=e,n=0;for(let e=0;e<8;e+=1){let e=_k.exec(t)?.[0];if(!e)return{content:t,offset:n};t=t.slice(e.length),n+=e.length}return{content:t,offset:n}}function ck(e){let t=gk.exec(sk(e).content)?.[1];return t?{length:t.length,marker:t.charAt(0)}:null}function lk(e,t){let n=sk(e).content.trimEnd(),r=gk.exec(n),i=r?.[1];return!r||!i?!1:i.charAt(0)===t.marker&&i.length>=t.length&&n.slice(r[0].length).trim()===``}function uk(e,t,n,r,i){let a=sk(e),o=iO(a.content,r,i+a.offset);if(!o)return!1;let s=o.map(e=>rO(e.raw)),c=Array.from({length:o.length},()=>-1),l=-1;for(let e=o.length-1;e>=0;--e)c[e]=l,s[e]===`summary_close`&&(l=e);for(let e=0;e<o.length;e+=1){let r=s[e];if((r===`details_open`||r===`details_open_expanded`)&&t.length<32)t.push({hasSummary:!1});else if(r===`details_close`&&t.length>0)t.pop();else if(r===`summary_open`){let r=t.at(-1);if(!r||r.hasSummary)continue;let i=c[e]??-1;if(i>=0)r.hasSummary=!0,e=i;else if(n)return!0}}return!1}function dk(e,t){return Wi(e.slice(t)).map(([e,n])=>[e+t,n+t])}function fk(e,t={boundary:0,firstListOffset:null,hasLinkReferenceDefinition:!1,index:0,lastFenceOffset:0,lineMode:null,openFence:null}){let{boundary:n,firstListOffset:r,hasLinkReferenceDefinition:i,index:a,lastFenceOffset:o}=t,s=t.lineMode,c=t.openFence,l=[],u,d=t;for(;a<e.length;){let t=e.indexOf(`
|
|
`,a),f=t===-1?e.length:t+1;if(s){a=f,s=t===-1?s:null,d={boundary:n,firstListOffset:r,hasLinkReferenceDefinition:i,index:a,lastFenceOffset:o,lineMode:s,openFence:c};continue}let p=e.slice(a,t===-1?f:t),m=c;if(c)lk(p,c)&&(c=null,o=f,l.length===0&&(n=f));else{r===null&&vk.test(p)&&(r=a);let t=ck(p);if(t)c=t,o=f;else{let t=sk(p).content;bk.test(t)&&uk(p,l,!1,u??=dk(e,r??n),a),l.length===0&&(yk.test(t)&&(i=!0),p.trim()===``&&(n=f))}}a=f,l.length===0&&(t!==-1||pk(p,m))&&(s=t===-1?m?`fence`:`plain`:null,d={boundary:n,firstListOffset:r,hasLinkReferenceDefinition:i,index:a,lastFenceOffset:o,lineMode:s,openFence:c})}return i?n=0:r!==null&&(n=Math.min(n,r)),{cursor:d,result:{boundary:n,tailRepairStart:c?null:Math.max(n,o)}}}function pk(e,t){let n=sk(e).content.charAt(0);return n?t?n!==t.marker:!/[\s`~<[\]*+\-\d>]/u.test(n):!1}function mk(e,t,n=e.length){if(!t)return fk(e).result;let r=e.slice(0,n),i=Sk.get(t),a=fk(r,i&&r.startsWith(i.markdown)?i.cursor:void 0);for(Sk.delete(t),Sk.set(t,{cursor:a.cursor,markdown:r});Sk.size>xk;){let e=Sk.keys().next().value;if(e===void 0)break;Sk.delete(e)}return n===e.length?a.result:fk(e,a.cursor).result}function hk(e,t=0){let n=e.slice(0,t)+ja(e.slice(t),Ck);if(!n.includes(`<`))return n;let r=[],i=Wi(n),a=null,o=!1,s=0;for(;s<n.length;){let e=n.indexOf(`
|
|
`,s),t=e===-1?n.length:e+1,c=n.slice(s,e===-1?t:e);a?lk(c,a)&&(a=null):(a=ck(c),a||(o=uk(c,r,t===n.length,i,s))),s=t}return o?`${n}</summary>`:n}var gk,_k,vk,yk,bk,xk,Sk,Ck;function wk(){return(wk=t((()=>{sa(),Bi(),vO(),gk=/^[ \t]{0,3}(`{3,}|~{3,})/,_k=/^[ \t]{0,3}(?:(?:>\s?)|(?:(?:[-+*]|\d{1,9}[.)])[ \t]+))/,vk=/^[ \t]{0,3}(?:[-+*]|\d{1,9}[.)])[ \t]+/u,yk=/^[ \t]*\[/u,bk=/^[ \t]*<\/?(?:details|summary)(?=[\s>])/iu,xk=8,Sk=new Map,Ck={katex:!1,linkMode:`text-only`}})))()}function Tk(e){let t=nA.get(e);return t===void 0?null:(nA.delete(e),nA.set(e,t),t)}function Ek(e,t){if(nA.set(e,t),nA.size<=Yk)return;let n=nA.keys().next().value;n&&nA.delete(n)}function Dk(e){if(br(e)!==null)return!0;let t=Ok();return!t||e!==t&&!e.startsWith(`${t}/`)?!1:br(e,t)!==null}function Ok(){return typeof window>`u`?``:zr(window.location.pathname)[0]}function kk(e){return e.split(`/`).filter(Boolean)}function Ak(e){let t=kk(e),n=kk(Ok());return n.length===0||n.some((e,n)=>t[n]!==e)?t:t.slice(n.length)}function jk(e,t){return t.every((t,n)=>e[n]===t)}function Mk(e){if(e.includes(`__openclaw__`)||e.includes(`__openclaw`))return!0;let t=e[0];return!t||eA.has(t)?!0:tA.some(t=>jk(e,t))}function Nk(e,t){if($k.has(e))return!0;let n=t[0];return n?Qk.has(n):!1}function Pk(e){let t=e.trim();if(!t.startsWith(`/`)||t.startsWith(`//`))return e;try{let n=new URL(t,Zk);if(n.origin!==Zk)return e;let r=n.pathname.replace(/\/+$/,``)||`/`;if(Dk(r))return e;let i=kk(r);return Mk(Ak(r))?e:Nk(r,i)?n.href:e}catch{return e}}function Fk(){Kk||(Kk=!0,Ds.addHook(`afterSanitizeAttributes`,e=>{if(!(e instanceof HTMLAnchorElement))return;let t=e.getAttribute(`href`);if(!t)return;if(kD(t)){e.removeAttribute(`href`);return}let n=Pk(t);n!==t&&e.setAttribute(`href`,n);try{let t=new URL(n,window.location.href);if(t.protocol!==`http:`&&t.protocol!==`https:`&&t.protocol!==`mailto:`){e.removeAttribute(`href`);return}if(t.origin===window.location.origin&&Dk(t.pathname)){e.removeAttribute(`rel`),e.removeAttribute(`target`);return}}catch{}e.setAttribute(`rel`,`noreferrer noopener`),e.setAttribute(`target`,`_blank`)}))}function Ik(e){let t=e.truncated?`\n\n${W(`chat.markdown.truncated`,{total:String(e.total),shown:String(e.text.length)})}`:``;return`${e.text}${t}`}function Lk(e,t){Fk();let n=t.progressBars?Wk:Uk,r=t.mode===`document`,i=r?{text:e,truncated:!1,total:e.length}:Te(e,qk),a=t.progressBars?Ik(i).replace(Gk,``):Ik(i);if(UE(i.text))return Ds.sanitize(dD(a,``,t,{blockArt:!0}),n);if(!r&&i.text.length>Jk)return Ds.sanitize(zk(a,t),n);let o;try{o=rA.render(a,t)}catch(e){console.warn(`[markdown] md.render failed, falling back to plain text:`,e),o=zk(a,t)}return Ds.sanitize(o,n)}function Rk(e,t={}){let n=ok(t),r=HE(es(e)),i=r.trim();if(!i)return``;let a=UE(r)?r:i;if(i.length>Xk)return Lk(a,n);let o=`${ii.getLocale()}\0${n.assistantTranscriptRoleHeaders}\0${n.codeBlockChrome}\0${n.codeBlockInteraction}\0${n.fileLinks}\0${n.interactiveImages}\0${n.linkFavicons}\0${n.progressBars}\0${n.mode}\0${n.sessionLinks}\0${n.tableInteractions}\0${a}`,s=Tk(o);if(s!==null)return s;let c=Lk(a,n);return Ek(o,c),c}function zk(e,t){return LE(HE(e),t.assistantTranscriptRoleHeaders,()=>W(`sessionsView.assistant`),X)}function Bk(e,t={},n){let r=ok(t),i=HE(es(e));if(UE(i))return Lk(i,r);let a=i.trim();if(!a)return``;let o=Te(a,qk),s=Ik(o),{boundary:c,tailRepairStart:l}=mk(s,n,o.text.length),u=s.slice(0,c),d=s.slice(c),f=c>0?Rk(u,t):``;return d.trim()?`${f}${l===null?Lk(d,{...r,streamingOpenFence:!0}):Lk(hk(d,l-c),r)}`:f}var Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k,eA,tA,nA,rA;function iA(){return(iA=t((()=>{js(),qo(),Qo(),$r(),fr(),V(),pn(),VE(),CD(),GD(),ak(),wk(),KE(),Vk=`a.b.blockquote.br.button.code.del.details.div.em.h1.h2.h3.h4.hr.i.input.li.ol.p.pre.s.span.strong.summary.table.tbody.td.th.thead.tr.ul.img`.split(`.`),Hk=[`checked`,`class`,`disabled`,`href`,`open`,`rel`,`target`,`tabindex`,`title`,`start`,`src`,`alt`,`data-code`,`data-code-encoding`,`data-file-kind`,`data-file-line`,`data-file-path`,`data-link-favicon-host`,`data-session-key`,`data-table-interactions`,`type`,`aria-expanded`,`aria-label`,`aria-pressed`,`role`],Uk={ALLOWED_TAGS:Vk,ALLOWED_ATTR:Hk,ADD_DATA_URI_TAGS:[`img`]},Wk={...Uk,ALLOWED_TAGS:[...Vk,`progress`],ALLOWED_ATTR:[...Hk,`value`,`max`]},Gk=/<(script|style|iframe|object|template)\b[^>]*>[\s\S]*?<\/\1\s*>/giu,Kk=!1,qk=14e4,Jk=4e4,Yk=500,Xk=5e4,Zk=`https://docs.openclaw.ai`,Qk=new Set(`agent-runtime-architecture.announcements.auth-credential-semantics.automation.brave-search.channels.ci.clawhub.cli.concepts.date-time.debug.diagnostics.gateway.help.index.install.logging.maturity-scorecard.network.nodes.openclaw-agent-runtime.perplexity.plan.platforms.plugins.prose.providers.refactor.reference.security.specs.start.tools.tts.vps.web`.split(`.`)),$k=new Set(`/AGENTS.default,/RELEASING,/agent,/agent-loop,/agent-send,/agent-workspace,/android,/anthropic,/architecture,/audio,/auth-monitoring,/azure,/background-process,/bash,/bonjour,/browser,/browser-linux-troubleshooting,/bun,/camera,/clawd,/clawdhub,/compaction,/configuration,/context,/context-engine,/control-ui,/cron,/cron-jobs,/cron-vs-heartbeat,/dashboard,/device-models,/discord,/discovery,/docker,/doctor,/duckduckgo-search,/elevated,/exa-search,/experiments/plans/cron-add-hardening,/experiments/plans/group-policy-hardening,/faq,/gateway-lock,/gcp,/gemini-search,/getting-started,/glm,/gmail-pubsub,/grammy,/grok-search,/group-messages,/groups,/health,/heartbeat,/hubs,/images,/imessage,/ios,/kimi-search,/line,/linux,/location,/location-command,/lore,/mac/bun,/mac/canvas,/mac/child-process,/mac/dev-setup,/mac/health,/mac/icon,/mac/logging,/mac/menu-bar,/mac/peekaboo,/mac/permissions,/mac/release,/mac/remote,/mac/signing,/mac/skills,/mac/voice-overlay,/mac/voicewake,/mac/webchat,/mac/xpc,/macos,/mattermost,/mcp,/message,/messages,/minimax,/mistral,/model,/model-failover,/models,/moonshot,/multi-agent,/nix,/northflank,/oauth,/onboarding,/openai,/opencode,/opencode-go,/openrouter,/pairing,/pi,/pi-dev,/plugin,/podman,/poll,/presence,/provider-routing,/qianfan,/queue,/quickstart,/railway,/remote,/remote-gateway-readme,/render,/rpc,/sandbox,/sandboxing,/session,/session-tool,/sessions,/setup,/showcase,/signal,/skill-workshop,/skills,/skills-config,/slack,/slash-commands,/subagents,/tailscale,/talk,/telegram,/templates/AGENTS,/templates/BOOT,/templates/BOOTSTRAP,/templates/HEARTBEAT,/templates/IDENTITY,/templates/SOUL,/templates/TOOLS,/templates/USER,/test,/thinking,/timezone,/troubleshooting,/tui,/typebox,/updating,/voicewake,/web-fetch,/webchat,/webhook,/whatsapp,/windows,/wizard,/xiaomi,/zai`.split(`,`)),eA=new Set([`__openclaw`,`__openclaw__`,`_next`,`api`,`assets`,`avatar`,`manifest.json`,`media`,`res`,`socket.io`,`static`,`ws`,...hs]),tA=[[`plugins`,`diffs`],[`plugins`,`diffs-language-pack`]],nA=new Map,rA=ZO()})))()}function aA(e,t=/[\s\p{P}\p{S}]/u){if(!e)return`ltr`;for(let n of e)if(!t.test(n))return oA.test(n)?`rtl`:`ltr`;return`ltr`}var oA;function sA(){return(sA=t((()=>{oA=/\p{Script=Hebrew}|\p{Script=Arabic}|\p{Script=Syriac}|\p{Script=Thaana}|\p{Script=Nko}|\p{Script=Samaritan}|\p{Script=Mandaic}|\p{Script=Adlam}|\p{Script=Phoenician}|\p{Script=Lydian}/u})))()}function cA(e){return e===`image`||e===`audio`||e===`video`||e===`document`}function lA(e){let t=p(e);if(!t||t.type!==`attachment`&&t.type!==`attachment_error`)return;let n=p(t.attachment);if(!n||!cA(n.kind)||typeof n.label!=`string`)return[];let r=typeof n.mimeType==`string`?n.mimeType:void 0;return t.type===`attachment_error`?n.code!==`file-not-found`&&n.code!==`unsupported-format`&&n.code!==`delivery-failed`?[]:[{type:`attachment_error`,attachment:{code:n.code,kind:n.kind,label:n.label,...r===void 0?{}:{mimeType:r}}}]:typeof n.url==`string`?[{type:`attachment`,attachment:{url:n.url,kind:n.kind,label:n.label,...r===void 0?{}:{mimeType:r},...n.isVoiceNote===!0?{isVoiceNote:!0}:{},...typeof n.artifactId==`string`?{artifactId:n.artifactId}:{},...n.playback===`native`||n.playback===`transcode`?{playback:n.playback}:{},...typeof n.sizeBytes==`number`&&n.sizeBytes>=0?{sizeBytes:n.sizeBytes}:{},...typeof n.durationMs==`number`&&n.durationMs>=0?{durationMs:n.durationMs}:{},...typeof n.width==`number`&&n.width>0?{width:n.width}:{},...typeof n.height==`number`&&n.height>0?{height:n.height}:{}}}]:[]}function uA(){return(uA=t((()=>{})))()}function dA(e){let t=e.toLowerCase();return t===`user`?`user`:t===`assistant`?`assistant`:t===`system`?`system`:t===`toolresult`||t===`tool_result`||t===`tool`||t===`function`?`tool`:e}function fA(e){let t=FA.parse(e).role?.toLowerCase()??``;return t===`toolresult`||t===`tool_result`}function pA(e){let t=FA.parse(e);return(t.role?dA(t.role):`unknown`)===`tool`||t.toolCallId!==void 0||t.tool_call_id!==void 0||t.toolUseId!==void 0||t.tool_use_id!==void 0||t.toolName!==void 0||t.tool_name!==void 0}function mA(e,t){return e.text!==void 0&&(e.type===`text`||t===`user`&&e.type===`input_text`||t===`assistant`&&(e.type===`input_text`||e.type===`output_text`))}function hA(e){if(!e||e.kind!==`canvas`||e.surface===`tool_card`)return null;let t=e.render===`url`?`url`:null;if(!t)return null;let n=e.mcpApp,r=wo(e.boardWidgetName)?e.boardWidgetName:void 0;return{kind:`canvas`,surface:`assistant_message`,render:t,...e.title===void 0?{}:{title:e.title},...e.preferredHeight===void 0?{}:{preferredHeight:e.preferredHeight},...e.url===void 0?{}:{url:e.url},...e.viewId===void 0?{}:{viewId:e.viewId},...e.className===void 0?{}:{className:e.className},...e.style===void 0?{}:{style:e.style},...e.sandbox===`strict`||e.sandbox===`scripts`?{sandbox:e.sandbox}:{},...r?{boardWidgetName:r}:{},...n?.viewId?.trim()?{mcpApp:{viewId:n.viewId,...n.serverName===void 0?{}:{serverName:n.serverName},...n.toolName===void 0?{}:{toolName:n.toolName},...n.uiResourceUri===void 0?{}:{uiResourceUri:n.uiResourceUri},...n.toolCallId===void 0?{}:{toolCallId:n.toolCallId},...n.originSessionKey===void 0?{}:{originSessionKey:n.originSessionKey}}}:{}}}function gA(e){let t=hu(e);return t?IA[t]:void 0}function _A(e){let t=gA(e),n=aa(t);return{kind:!n||n===`sticker`||n===`unknown`?`document`:n,mimeType:t,label:(()=>{try{if(/^https?:\/\//i.test(e)){let t=new URL(e);return t.pathname.split(`/`).pop()?.trim()||t.hostname||e}}catch{}return e.split(/[\\/]/).pop()?.trim()||e})()}}function vA(e){if(e.type!==`audio`)return null;let t=e.source;if(!t)return null;let n=t.media_type?.trim().toLowerCase().startsWith(`audio/`)?t.media_type.trim():`audio/mpeg`;if(t.type===`base64`&&t.data!==void 0){let r=t.data.trim();return r?{type:`attachment`,attachment:{url:r.startsWith(`data:`)?r:`data:${n};base64,${r}`,kind:`audio`,label:e.label?.trim()||`Audio`,mimeType:n,...e.isVoiceNote===!0?{isVoiceNote:!0}:{}}}:null}if(t.type===`url`&&t.url!==void 0){let r=t.url.trim();return r?{type:`attachment`,attachment:{url:r,kind:`audio`,label:e.label?.trim()||`Audio`,mimeType:n,...e.isVoiceNote===!0?{isVoiceNote:!0}:{}}}:null}return null}function yA(e){if(e.type!==`audio`&&e.type!==`video`||e.url===void 0)return null;let t=e.url.trim();if(!t)return null;let n=e.type,r=n===`audio`?`Audio`:`Video`;return{type:`attachment`,attachment:{url:t,kind:n,label:e.fileName?.trim()||e.label?.trim()||r,...e.mimeType===void 0?{}:{mimeType:e.mimeType},...e.artifactId===void 0?{}:{artifactId:e.artifactId},...n===`audio`&&e.isVoiceNote===!0?{isVoiceNote:!0}:{},...e.playback===`native`||e.playback===`transcode`?{playback:e.playback}:{},...e.sizeBytes!==void 0&&e.sizeBytes>=0?{sizeBytes:e.sizeBytes}:{},...e.durationMs!==void 0&&e.durationMs>=0?{durationMs:e.durationMs}:{},...n===`video`&&e.width!==void 0&&e.width>0?{width:e.width}:{},...n===`video`&&e.height!==void 0&&e.height>0?{height:e.height}:{}}}}function bA(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.type===`text`&&e?.type===`text`){e.text=[e.text,n.text].filter(e=>e!==void 0).join(`
|
|
`);continue}t.push(n)}return t.filter(e=>e.type!==`text`||!!e.text?.trim())}function xA(e){return ro(e)}function SA(e){return e.map(e=>e.type!==`text`||typeof e.text!=`string`?e:{...e,text:xA(e.text)}).filter(e=>e.type!==`text`||!!e.text?.trim())}function CA(e,t){let n=go(e),r=Go(n.text,{extractAudioDirectives:!1}),i=[],a=t?.audioAsVoice===!0,o=t?.replyToId?.trim(),s=o?{kind:`id`,id:o}:t?.replyToCurrent===!0?{kind:`current`}:null,c=r.segments??[{type:`text`,text:r.text}];for(let e of c){if(e.type===`media`){if($o(e.url)){i.push({type:`text`,text:`MEDIA:${e.url}`});continue}let t=_A(e.url);i.push({type:`attachment`,attachment:{url:e.url,kind:t.kind,label:t.label,mimeType:t.mimeType}});continue}e.text&&i.push({type:`text`,text:e.text})}for(let e of n.previews)e.surface===`assistant_message`&&i.push({type:`canvas`,preview:{...e,surface:`assistant_message`},rawText:null});let l=bA(i.map(e=>e.type===`attachment`&&e.attachment.kind===`audio`&&a?Object.assign({},e,{attachment:{...e.attachment,isVoiceNote:!0}}):e));return{content:l.length>0?l:(r.mediaUrls??[]).some($o)?(r.mediaUrls??[]).filter($o).map(e=>({type:`text`,text:`MEDIA:${e}`})):s===null&&!a&&r.text.trim().length>0?[{type:`text`,text:r.text}]:[],audioAsVoice:a,replyTarget:s}}function wA(e){let t=FA.parse(e),n=t.role??`unknown`,r=t.toolCallId!==void 0||t.tool_call_id!==void 0||t.toolUseId!==void 0||t.tool_use_id!==void 0,i=t.content,a=Array.isArray(i)?i:null,o=a?.some(e=>Co(e.type)||mo(e.type))??!1,s=t.toolName!==void 0||t.tool_name!==void 0;(r||o||s)&&(n=`toolResult`);let c=n===`assistant`,l=c?t.openclawDelivery:void 0,u=[],d=!1,f=null;if(typeof t.content==`string`){if(c){let e=CA(t.content,l);u=e.content,d=e.audioAsVoice,f=e.replyTarget}else u=[{type:`text`,text:t.content}]}else if(a)u=a.flatMap(e=>{if(c){let t=yA(e);if(t)return[t];let n=vA(e);if(n)return[n]}else if(e.type===`audio`)return[];let t=lA(e);if(t)return t;if(e.type===`canvas`&&e.preview){let t=hA(e.preview);return t?[{type:`canvas`,preview:t,rawText:e.rawText??null}]:[]}if(mA(e,n)){if(c){let t=CA(e.text,l);return d||=t.audioAsVoice,(t.replyTarget?.kind===`id`||t.replyTarget?.kind===`current`&&f===null)&&(f=t.replyTarget),t.content}return[{type:`text`,text:e.text,name:void 0,args:void 0}]}return[{type:e.type||`text`,text:e.text,name:e.name,args:To(e)}]});else if(t.text!==void 0){if(c){let e=CA(t.text,l);u=e.content,d=e.audioAsVoice,f=e.replyTarget}else u=[{type:`text`,text:t.text}]}let p=t.timestamp??Date.now(),m=t.id,h=t.__openclaw,g=h?.replyToId?.trim()??``;g&&(f={kind:`id`,id:g});let _=h?.replyToPreview,v=_?.text?.trim()??``,y=_?.senderLabel?.trim()??``,b=po(h?.senderIdentity),x=hl({identity:b,id:h?.senderId,name:h?.senderName,username:h?.senderUsername,profileAvatarUrl:b?.type===`profile`?h?.senderProfileAvatarUrl:void 0}),S=t.senderLabel?.trim()??``,C=S?S.replace(TA,``).trim():ml(x),ee=x??(C?{name:C}:null);return u=SA(u),{role:n,content:u,timestamp:p,id:m,senderLabel:C,...ee?{sender:ee}:{},...d?{audioAsVoice:!0}:{},...v?{replyPreview:{text:v,...y?{senderLabel:y}:{}}}:{},...f?{replyTarget:f}:{}}}var TA,Z,EA,DA,OA,kA,AA,jA,MA,NA,PA,FA,IA;function LA(){return(LA=t((()=>{ia(),Ha(),oo(),_o(),vo(),bo(),Vo(),yu(),uA(),_l(),TA=/\s+\(([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\)$/iu,Z=Ra().optional().catch(void 0),EA=Ba().optional().catch(void 0),DA=Ua({viewId:Z,serverName:Z,toolName:Z,uiResourceUri:Z,toolCallId:Z,originSessionKey:Z}).optional().catch(void 0),OA=Ua({title:Z,preferredHeight:EA,url:Z,viewId:Z,className:Z,style:Z,mcpApp:DA}).optional().catch(void 0),kA=Ua({code:Z,kind:Z,url:Z,label:Z,mimeType:Z,artifactId:Z,sizeBytes:EA,durationMs:EA,width:EA,height:EA}).optional().catch(void 0),AA=Ua({media_type:Z,data:Z,url:Z}).optional().catch(void 0),jA=Ua({text:Z,source:AA,attachment:kA,preview:OA,rawText:Z,label:Z,fileName:Z,mimeType:Z,artifactId:Z,url:Z,sizeBytes:EA,durationMs:EA,width:EA,height:EA}),MA=Va(La([jA,Ia().transform(()=>null)])).transform(e=>e.filter(e=>e!==null)),NA=Ua({replyToId:Z,replyToPreview:Wa({text:Z,senderLabel:Z}).optional().catch(void 0)}).optional().catch(void 0),PA=Wa({audioAsVoice:za(!0).optional(),replyToCurrent:za(!0).optional(),replyToId:Z}).optional().catch(void 0),FA=Ua({role:Z,content:La([Ra(),MA]).optional().catch(void 0),text:Z,timestamp:EA,id:Z,senderLabel:Z,toolCallId:Z,tool_call_id:Z,toolUseId:Z,tool_use_id:Z,toolName:Z,tool_name:Z,__openclaw:NA,openclawDelivery:PA}).catch({}),IA={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`,heic:`image/heic`,heif:`image/heif`,ogg:`audio/ogg`,oga:`audio/ogg`,mp3:`audio/mpeg`,wav:`audio/wav`,flac:`audio/flac`,aac:`audio/aac`,opus:`audio/opus`,m4a:`audio/mp4`,m2a:`audio/mpeg`,mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,pdf:`application/pdf`,txt:`text/plain`,md:`text/markdown`,csv:`text/csv`,json:`application/json`,zip:`application/zip`}})))()}function RA(e,t){let n=typeof e==`string`?e.trim():``;return n?l(n,t):void 0}function zA(e){return e!==void 0&&GA.has(e)}function BA(e){let t=y(e),n=RA(t?.id,256),r=RA(t?.label,80),i=RA(t?.status,32);if(!n||!r||!zA(i))return null;let a=RA(t?.riskLevel,40),o=RA(t?.userAuthorization,40),s=RA(t?.rationale,2e3);return{id:n,label:r,status:i,...a?{riskLevel:a}:{},...o?{userAuthorization:o}:{},...s?{rationale:s}:{}}}function VA(e){let t=y(e)?.approvalReviews;return Array.isArray(t)?t.slice(-16).map(BA).filter(e=>e!==null):[]}function HA(e,t,n){return{...y(e)??(e===void 0?{}:{toolDetails:e}),approvalReviews:[...t],...n?{approvalReviewOutcome:n}:{}}}function UA(e){let t=y(e)?.approvalReviewOutcome;return t===`approved`||t===`denied`||t===`reviewing`?t:void 0}function WA(e,t=[]){return t.includes(`denied`)||e.some(e=>[`denied`,`timed_out`,`aborted`].includes(e.status))?`denied`:t.includes(`reviewing`)||e.some(e=>e.status===`in_progress`)?`reviewing`:t.includes(`approved`)||e.some(e=>e.status===`approved`)?`approved`:null}var GA;function KA(){return(KA=t((()=>{GA=new Set([`in_progress`,`approved`,`denied`,`timed_out`,`aborted`])})))()}function qA(e){let t=0,n=0;for(let r of e)r.kind===`add`?t+=1:r.kind===`del`&&(n+=1);return{added:t,removed:n}}function JA(e){if(!e.trim())return null;let t=[],n=!1;for(let r of e.split(`
|
|
`)){if(!r)continue;if(/^\s*\.\.\.\(truncated\)\.\.\.\s*$/.test(r)){n=!0,t.push({kind:`skip`,text:``});continue}if(/^\s*\.\.\.\s*$/.test(r)){t.push({kind:`skip`,text:``});continue}let e=r.match(/^([+\- ])\s*(\d+) ?(.*)$/s);if(!e)return null;let[,i,a,o]=e;if(!i||!a)return null;if(t.push({kind:i===`+`?`add`:i===`-`?`del`:`ctx`,lineNo:Number.parseInt(a,10),text:o??``}),t.length>400){t.push({kind:`skip`,text:``}),n=!0;break}}return t.some(e=>e.kind===`add`||e.kind===`del`)?n?{kind:`truncated`,lines:t}:{kind:`complete`,lines:t,stat:qA(t)}:null}function YA(e){let t=e.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`);if(t===``)return[];let n=t.split(`
|
|
`);return n.length>1&&n[n.length-1]===``&&n.pop(),n}function XA(e,t,n){if(!n&&e.length<=400&&!t)return e;if(!e.some(e=>e.kind===`add`||e.kind===`del`))return n&&!t?[]:t?[{kind:`skip`,text:``}]:[...e.slice(0,400),{kind:`skip`,text:``}];let r=new Uint8Array(e.length);for(let t=0;t<e.length;t++){let n=e[t];if(!n||n.kind!==`add`&&n.kind!==`del`)continue;let i=Math.max(0,t-3),a=Math.min(e.length,t+4);r.fill(1,i,a)}let i=[],a=!1,o=t;for(let t=0;t<e.length;t++){if(r[t]===0){a=!0,o=!0;continue}if(a&&i.at(-1)?.kind!==`skip`&&i.push({kind:`skip`,text:``}),a=!1,i.length>=400){o=!0;break}let n=e[t];n&&i.push(n)}return o&&i.at(-1)?.kind!==`skip`&&i.push({kind:`skip`,text:``}),i}function ZA(e,t,n){let r=YA(e),i=YA(t),a=r.length>tj||i.length>tj,o=r.length===i.length&&r.every((e,t)=>e===i[t]),s=a&&!o,c=r.slice(0,tj),l=i.slice(0,tj),u=c.length,d=l.length,f=Array.from({length:u+1},()=>Array.from({length:d+1},()=>0));for(let e=u-1;e>=0;e--){let t=f[e],n=f[e+1];if(!(!t||!n))for(let r=d-1;r>=0;r--)t[r]=c[e]===l[r]?(n[r+1]??0)+1:Math.max(n[r]??0,t[r+1]??0)}let p=[],m=0,h=0;for(;m<u&&h<d;){let e=c[m],t=l[h];if(e===void 0||t===void 0)break;e===t?(p.push({kind:`ctx`,text:e}),m++,h++):(f[m+1]?.[h]??0)>=(f[m]?.[h+1]??0)?(p.push({kind:`del`,text:e}),m++):(p.push({kind:`add`,text:t}),h++)}for(;m<u;){let e=c[m];e!==void 0&&p.push({kind:`del`,text:e}),m++}for(;h<d;){let e=l[h];e!==void 0&&p.push({kind:`add`,text:e}),h++}let g=XA(p,s,n?.compactUnchanged===!0);return s?{kind:`truncated`,lines:g}:{kind:`complete`,lines:g,stat:qA(p)}}function QA(e,t=80){let n=YA(e),r=[];for(let[e,i]of n.slice(0,t).entries())r.push({kind:`add`,lineNo:e+1,text:i});return n.length>t&&r.push({kind:`skip`,text:``}),r}function $A(e){return YA(e).length}function ej(e,t){let n=t?.maxLines??400,r=[],i=t?.truncated===!0||e.some(e=>e.kind===`truncated`),a=i;for(let t of e){if(t.lines.length===0)continue;if(r.length>0){if(r.length>=n){a=!0;break}r.push({kind:`skip`,text:``})}let e=n-r.length;if(t.lines.length>e){r.push(...t.lines.slice(0,e)),a=!0;break}r.push(...t.lines)}return a&&r.at(-1)?.kind!==`skip`&&r.push({kind:`skip`,text:``}),i?{kind:`truncated`,lines:r}:{kind:`complete`,lines:r,stat:e.reduce((e,t)=>({added:e.added+(t.kind===`complete`?t.stat.added:0),removed:e.removed+(t.kind===`complete`?t.stat.removed:0)}),{added:0,removed:0})}}var tj;function nj(){return(nj=t((()=>{tj=600})))()}function rj(e){if(e===``)return[];let t=e.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`).split(`
|
|
`);return t.length>1&&t.at(-1)===``&&t.pop(),t}function ij(e,t,n){let r=n.trim(),i={operation:t,sourcePath:r,path:r,lines:[],stat:{added:0,removed:0}};return e.sections.push(i),i}function aj(e,t,n){n.kind===`add`?t.stat.added+=1:n.kind===`del`&&(t.stat.removed+=1),e.storedRows<400?(t.lines.push(n),e.storedRows+=1):e.truncated=!0}function oj(e,t){t.lines.length!==0&&t.lines.at(-1)?.kind!==`skip`&&aj(e,t,{kind:`skip`,text:``})}function sj(e){let t=e.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);return t?{oldLine:Number.parseInt(t[1]??``,10),oldLeft:t[2]===void 0?1:Number.parseInt(t[2],10),newLine:Number.parseInt(t[3]??``,10),newLeft:t[4]===void 0?1:Number.parseInt(t[4],10)}:{}}function cj(e,t,n,r){let i,a;n.startsWith(`+`)?(i=`add`,a=r.newLine,r.newLine!==void 0&&(r.newLine+=1,r.newLeft=Math.max(0,(r.newLeft??0)-1))):n.startsWith(`-`)?(i=`del`,a=r.oldLine,r.oldLine!==void 0&&(r.oldLine+=1,r.oldLeft=Math.max(0,(r.oldLeft??0)-1))):(i=`ctx`,a=r.newLine,r.oldLine!==void 0&&r.newLine!==void 0&&(r.oldLine+=1,r.newLine+=1,r.oldLeft=Math.max(0,(r.oldLeft??0)-1),r.newLeft=Math.max(0,(r.newLeft??0)-1))),aj(e,t,{kind:i,...a===void 0?{}:{lineNo:a},text:n===``?``:n.slice(1)})}function lj(e){return e.oldLeft!==void 0&&e.oldLeft===0&&e.newLeft===0}function uj(e){return e.operation===`update`&&e.path!==e.sourcePath?`Move ${e.sourcePath} → ${e.path}`:`${e.operation===`add`?`Add`:e.operation===`delete`?`Delete`:`Update`} ${e.path}`}function dj(e){if(e.sections.length===0)return null;let t=[...new Set(e.sections.map(e=>e.path).filter(Boolean))],n=e.sections.map(({operation:e,path:t,sourcePath:n})=>({operation:e,path:t,...e===`update`&&n!==t?{oldPath:n}:{}})),r=e.sections.reduce((e,t)=>({added:e.added+t.stat.added,removed:e.removed+t.stat.removed}),{added:0,removed:0}),i=[],a=e.truncated,o=e=>{i.length<400?i.push(e):a=!0};for(let[t,r]of e.sections.entries()){e.sections.length>1&&(i.length>0&&i.at(-1)?.kind!==`skip`&&o({kind:`skip`,text:``}),o({kind:`file`,path:r.path,...`oldPath`in n[t]?{oldPath:r.sourcePath}:{},text:uj(r)}));for(let e of r.lines)o(e)}a&&i.at(-1)?.kind!==`skip`&&i.push({kind:`skip`,text:``});let s=e.sections.length===1?e.sections.at(0):void 0,c=s&&s.operation===`update`&&s.sourcePath!==s.path?{from:s.sourcePath,to:s.path}:void 0;return{paths:t,fileOperations:n,lines:i,stat:r,...c?{move:c}:{}}}function fj(e){let t={sections:[],storedRows:0,truncated:!1},n=null,r=`outside`,i=null;for(let a of rj(e)){let e=r===`update`?a.trimEnd():a.trim(),o=e.match(/^\*\*\* (Update|Add|Delete) File: (.+)$/);if(o){let e=o[1],a=o[2];if(!e||!a)continue;r=e.toLowerCase(),n=ij(t,r,a),i=null;continue}let s=r===`update`?e.match(/^\*\*\* Move to: (.+)$/):null;if(s&&n){n.path=s[1]?.trim()??n.path;continue}if(!(e===`*** Begin Patch`||e===`*** End Patch`||e===`*** End of File`||e.startsWith(`*** Environment ID:`))&&n){if(r===`update`&&a.startsWith(`@@`)){oj(t,n),i=sj(a);continue}r===`add`&&a.startsWith(`+`)?aj(t,n,{kind:`add`,lineNo:n.stat.added+1,text:a.slice(1)}):r===`update`&&(a===``||a.startsWith(`+`)||a.startsWith(`-`)||a.startsWith(` `))&&(cj(t,n,a,i??{}),i&&lj(i)&&(i=null))}}return dj(t)}function pj(e){return(e.split(` `,1)[0]?.trim()??``).replace(/^[ab]\//,``)}function mj(e,t,n,r,i){let a=pj(n.slice(4)),o=pj(r.slice(4)),s=a===`/dev/null`?`add`:o===`/dev/null`?`delete`:`update`,c=o===`/dev/null`?a:o,l=i&&t?t:ij(e,s,c);return l.operation=s,l.sourcePath=a||l.sourcePath,l.path=c||l.path,l}function hj(e){let t={sections:[],storedRows:0,truncated:!1},n=rj(e),r=null,i=null,a=!1;for(let e=0;e<n.length;e++){let o=n[e];if(o===void 0)continue;let s=o.match(/^diff --git a\/(.+) b\/(.+)$/);if(s){let e=s[1],n=s[2];if(!e||!n)continue;r=ij(t,`update`,n),r.sourcePath=e,i=null,a=!0;continue}let c=n[e+1];if(!i&&o.startsWith(`--- `)&&c?.startsWith(`+++ `)){r=mj(t,r,o,c,a),a=!1,e+=1;continue}if(o.startsWith(`@@`)){r&&oj(t,r),i=sj(o),a=!1;continue}/^index |^new file mode |^deleted file mode |^similarity index /.test(o)||r&&i&&(o.startsWith(`+`)||o.startsWith(`-`)||o.startsWith(` `))&&(cj(t,r,o,i),lj(i)&&(i=null))}return dj(t)}function gj(e){let t=typeof e==`string`?e:y(e)?.type;return t===`add`||t===`delete`?t:`update`}function _j(e){let t=y(e),n=t?.added,r=t?.removed;return typeof n==`number`&&typeof r==`number`&&n>=0&&r>=0?{added:Math.trunc(n),removed:Math.trunc(r)}:null}function vj(e,t,n){let r=null;for(let i of rj(n))i.startsWith(`@@`)?(oj(e,t),r=sj(i)):r&&(i.startsWith(`+`)||i.startsWith(`-`)||i.startsWith(` `))&&(cj(e,t,i,r),lj(r)&&(r=null))}function yj(e){let t={sections:[],storedRows:0,truncated:!1};for(let r of e){let e=y(r),i=n(e?.path)?.trim();if(!e||!i)continue;let a=gj(e.kind),o=ij(t,a,i),s=n(y(e.kind)?.move_path??y(e.kind)?.movePath);if(s&&(o.path=s.trim()),typeof e.diff==`string`){if(a===`update`)vj(t,o,e.diff);else{let n=a===`add`?`add`:`del`;for(let[r,i]of rj(e.diff).entries())aj(t,o,{kind:n,lineNo:r+1,text:i})}}let c=_j(e.stat);c&&(o.stat=c),t.truncated||=e.diffTruncated===!0}return dj(t)}function bj(e){let t=y(e);if(!t)return null;if(Array.isArray(t.changes)){let e=yj(t.changes);if(e)return e}let r=n(t.patch)??n(t.input)??n(t.diff);return r?/(?:^|\n)\s*\*\*\* (?:Begin Patch|Update File:|Add File:|Delete File:)/.test(r)?fj(r):hj(r):null}function xj(){return(xj=t((()=>{nj()})))()}function Sj(e){if(e)return n(e.path)??n(e.file_path)??n(e.filePath)??n(e.file)??n(e.filepath)??n(e.filename)??n(e.notebook_path)}function Cj(e){let t=e.replace(/\\/g,`/`).replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n<=0?{base:t||e}:{base:t.slice(n+1),dir:t.slice(0,n)}}function wj(e){let t=[],n=0,r=!1,i=(e,i)=>{if(typeof e==`string`&&typeof i==`string`){let a=e.length+i.length;if(n+a>qj){r=!0;return}n+=a,t.push({oldText:e,newText:i})}};if(Array.isArray(e.edits))for(let t=0;t<e.edits.length;t++){if(t>=Kj){r=!0;break}let n=e.edits[t],a=y(n);if(a&&(i(a.oldText??a.old_string??a.oldString??a.old_str,a.newText??a.new_string??a.newString??a.new_str),r))break}else i(e.oldText??e.old_string??e.oldString??e.old_str,e.newText??e.new_string??e.newString??e.new_str);return{pairs:t,truncated:r}}function Tj(e){let t=y(e),r=t?n(t.diff):void 0;if(!r)return null;let i=JA(r);return i?{lines:i.lines,...i.kind===`complete`?{stat:i.stat}:{}}:null}function Ej(e){let t=Tj(e.details);if(t)return t;let n=y(e.args);if(!n)return null;let{pairs:r,truncated:i}=wj(n);if(r.length===0)return i?{lines:[{kind:`skip`,text:``}]}:null;let a=ej(r.map(e=>ZA(e.oldText,e.newText)),{truncated:i});return a.lines.length===0?null:{lines:a.lines,...a.kind===`complete`?{stat:a.stat}:{}}}function Dj(e,t){let r=Tj(e.details);if(r)return r;let i=t?n(t.insert_text):void 0;if(!i)return null;let a=ZA(``,i).lines;return a.length>0?{lines:a}:null}function Oj(e){return bj(e)}function kj(e){let t=Oj(e);if(!t)return null;if(t.paths.length>1)return{kind:`edit`,target:`${t.paths.length} files`,fileOperations:t.fileOperations,diff:t.lines,stat:t.stat};if(t.move){let e=Cj(t.move.from),n=Cj(t.move.to),r=e.dir===n.dir?e.dir:void 0;return{kind:`edit`,target:r?`${e.base} → ${n.base}`:`${t.move.from} → ${t.move.to}`,targetDetail:r,fileOperations:t.fileOperations,diff:t.lines,stat:t.stat}}let n=t.paths[0]?Cj(t.paths[0]):null;return{kind:`edit`,target:n?.base,targetDetail:n?.dir,fileOperations:t.fileOperations,diff:t.lines,stat:t.stat}}function Aj(e){return e.trim().toLowerCase()}function jj(e){let t=n(y(e)?.command)?.trim().toLowerCase();switch(t){case`view`:case`str_replace`:case`create`:case`insert`:case`undo_edit`:return t;default:return}}function Mj(e,t){let n=y(t);if(Gj.has(Aj(e)))return Oj(n)?.paths??[];let r=Sj(n);return r?[r]:[]}function Nj(e,t){if(Gj.has(Aj(e)))return Oj(y(t))?.fileOperations}function Pj(e,t){let n=Aj(e);if(Vj.has(n))switch(jj(t)){case`view`:return`read`;case`str_replace`:case`insert`:case`undo_edit`:return`edit`;case`create`:return`write`;default:return`generic`}if(Rj.has(n))return`command`;if(zj.has(n))return`read`;if(Bj.has(n)||Gj.has(n))return`edit`;if(Hj.has(n))return`write`;if(Uj.has(n))return`search`;if(Wj.has(n))return`fetch`;let r=y(t);return r&&typeof r.command==`string`&&Object.keys(r).length<=3?`command`:`generic`}function Fj(e){let t=y(e.args),n=t??y(e.details),r=Aj(e.name);if(n){let t=Jj.get(n);if(t&&t.details===e.details&&t.name===r)return t.view}let i=Lj(e,t);return n&&Jj.set(n,{details:e.details,name:r,view:i}),i}function Ij(e){return e.match(/^\s*(?:\/(?:usr\/)?bin\/)?(?:ba|z|da)?sh\s+-l?c\s+(['"])([\s\S]+)\1\s*$/)?.[2]??e}function Lj(e,t){let r=Pj(e.name,e.args),i=Aj(e.name),a=Vj.has(i)?jj(e.args):void 0;if(r===`command`){let e=t?n(t.command):void 0;return{kind:r,command:e&&Ij(e)}}if(r===`read`){let e=Sj(t);if(!e)return{kind:`generic`};let{base:n,dir:i}=Cj(e);return{kind:r,target:n,targetDetail:i}}if(r===`edit`){if(Gj.has(i))return kj(t)??{kind:`generic`};let n=Sj(t);if(!n)return{kind:`generic`};let{base:o,dir:s}=Cj(n),c=a===`insert`?Dj(e,t):a===`undo_edit`?Tj(e.details):Ej(e);return{kind:r,target:o,targetDetail:s,...c?{diff:c.lines,...c.stat?{stat:c.stat}:{}}:{}}}if(r===`write`){let i=Sj(t);if(!i)return{kind:`generic`};let{base:o,dir:s}=Cj(i),c=Tj(e.details);if(c)return{kind:r,target:o,targetDetail:s,diff:c.lines,...c.stat?{stat:c.stat}:{}};let l=y(e.details);if(l?.changed===!1)return{kind:r,target:o,targetDetail:s};let u=t?n(a===`create`?t.file_text:t.content):void 0;return u?{kind:r,target:o,targetDetail:s,diff:QA(u),...l&&l.created!==!0?{}:{stat:{added:$A(u),removed:0}}}:{kind:r,target:o,targetDetail:s}}if(r===`search`){let e=t?n(t.pattern)??n(t.query)??n(t.glob):void 0,i=Sj(t)??(t?n(t.path):void 0);return!e&&!i?{kind:`generic`}:{kind:r,target:e??i,targetDetail:e?i:void 0}}if(r===`fetch`){let e=t?n(t.url):void 0;return e?{kind:r,target:e}:{kind:`generic`}}return{kind:`generic`}}var Rj,zj,Bj,Vj,Hj,Uj,Wj,Gj,Kj,qj,Jj;function Yj(){return(Yj=t((()=>{nj(),xj(),Rj=new Set([`bash`,`exec`,`shell`,`run_command`,`run_terminal_cmd`]),zj=new Set([`read`,`read_file`,`readfile`,`notebookread`,`notebook_read`]),Bj=new Set([`edit`,`edit_file`,`multiedit`,`multi_edit`,`notebookedit`,`notebook_edit`]),Vj=new Set([`str_replace_editor`,`str_replace_based_edit_tool`]),Hj=new Set([`write`,`write_file`,`create_file`]),Uj=new Set([`grep`,`find`,`glob`,`ls`,`list`,`codebase_search`]),Wj=new Set([`web_fetch`,`webfetch`,`fetch`]),Gj=new Set([`apply_patch`,`applypatch`,`patch`]),Kj=8,qj=12e4,Jj=new WeakMap})))()}function Xj(e){return e?uM[e]??`puzzle`:`puzzle`}function Zj(e){return{icon:Xj(e?.emoji),title:e?.title,label:e?.label,detailKeys:e?.detailKeys,actions:e?.actions}}function Qj(e){if(!e)return e;for(let t of[{re:/^\/Users\/[^/]+(\/|$)/,replacement:`~$1`},{re:/^\/home\/[^/]+(\/|$)/,replacement:`~$1`},{re:/^C:\\Users\\[^\\]+(\\|$)/i,replacement:`~$1`}])if(t.re.test(e))return e.replace(t.re,t.replacement);return e}function $j(e){let t=Za(e.name),n=a(t),r=pM[n],i=r?.icon??fM.icon??`puzzle`,o=r?.title??Xa(t),s=r?.label??o,c=Qa({toolKey:n,args:e.args,meta:e.meta,spec:r,fallbackDetailKeys:fM.detailKeys,detailMode:`first`,toolDetailMode:e.detailMode,detailCoerce:{includeFalsy:!0}}),{verb:l}=c,{detail:u}=c;return u&&=Qj(u),{name:t,icon:i,title:o,label:s,verb:l,detail:u}}function eM(e){return no(e.detail,{prefixWithWith:!0})}function tM(e){return e===cM||e.startsWith(`${cM}/`)||e===sM||e.startsWith(`${sM}/`)}function nM(e){return e.protocol===`http:`||e.protocol===`https:`}function rM(e,t=!1){try{let n=new URL(e,`http://localhost`);return n.origin===`http://localhost`?tM(n.pathname)?`${n.pathname}${n.search}${n.hash}`:void 0:!t||!nM(n)?void 0:n.toString()}catch{return}}function iM(e){let t=e?.trim();return!!(t&&rM(t,!1))}function aM(e,t,n=!1){let r=e?.trim();if(!r)return;let i=rM(r,n);if(i){if(!t?.trim())return i;try{let e=new URL(t),n=e.pathname.replace(/\/+$/,``);if(!n.startsWith(lM))return i;let r=new URL(i,e.origin);return tM(r.pathname)?(r.protocol=e.protocol,r.username=e.username,r.password=e.password,r.host=e.host,r.pathname=`${n}${r.pathname}`,r.toString()):i}catch{return i}}}function oM(e,t){if(t===`strict`||t===`scripts`&&e===`strict`)return``;if(t===`scripts`)return`allow-scripts`;switch(e){case`strict`:return``;case`trusted`:return`allow-scripts allow-same-origin`;default:return`allow-scripts`}}var sM,cM,lM,uM,dM,fM,pM;function mM(){return(mM=t((()=>{fa(),lo(),sM=`/__openclaw__/a2ui`,cM=`/__openclaw__/canvas`,lM=`/__openclaw__/cap`,uM={"🧩":`puzzle`,"🛠️":`wrench`,"🧰":`wrench`,"📖":`fileText`,"✍️":`edit`,"📝":`penLine`,"📎":`paperclip`,"🌐":`globe`,"📺":`monitor`,"🧾":`fileText`,"🔐":`settings`,"💻":`monitor`,"🔌":`plug`,"💬":`messageSquare`},dM=da,fM=Zj(dM.fallback??{emoji:`🧩`}),pM=Object.fromEntries(Object.entries(dM.tools??{}).map(([e,t])=>[e,Zj(t)]))})))()}function hM(e,t,n){let r=e.files[t];r.calls+=1;for(let e of n)e.trim()&&r.paths.add(e.trim())}function gM(e,t){let n=Pj(t.name,t.args),r=Nj(t.name,t.args);if(r)for(let{operation:t,path:n}of r)hM(e,t===`add`?`write`:t===`delete`?`delete`:`edit`,[n]);else{let r=Mj(t.name,t.args);switch(n){case`command`:e.commands+=1;break;case`read`:hM(e,`read`,r);break;case`edit`:hM(e,`edit`,r);break;case`write`:hM(e,`write`,r);break;case`search`:e.searches+=1;break;case`fetch`:e.fetches+=1;break;default:e.others+=1,e.otherNames.add($j({name:t.name,args:t.args}).label)}}}function _M(e,t,n){return W(e===1?t:n,{count:String(e)})}function vM(e,t){return t.size>0?t.size:e}function yM(e){let t={commands:0,files:{read:{calls:0,paths:new Set},edit:{calls:0,paths:new Set},write:{calls:0,paths:new Set},delete:{calls:0,paths:new Set}},searches:0,fetches:0,otherNames:new Set,others:0};for(let n of e)gM(t,n);let n=[];t.commands>0&&n.push(_M(t.commands,`chat.toolCards.group.commandsOne`,`chat.toolCards.group.commandsMany`));for(let[e,r,i]of[[`read`,`readsOne`,`readsMany`],[`edit`,`editsOne`,`editsMany`],[`write`,`writesOne`,`writesMany`],[`delete`,`deletesOne`,`deletesMany`]]){let{calls:a,paths:o}=t.files[e];a>0&&n.push(_M(vM(a,o),`chat.toolCards.group.${r}`,`chat.toolCards.group.${i}`))}if(t.searches>0&&n.push(_M(t.searches,`chat.toolCards.group.searchesOne`,`chat.toolCards.group.searchesMany`)),t.fetches>0&&n.push(_M(t.fetches,`chat.toolCards.group.fetchesOne`,`chat.toolCards.group.fetchesMany`)),t.others>0){let e=[...t.otherNames].slice(0,2).join(`, `);n.push(t.otherNames.size<=2&&e?W(t.others>t.otherNames.size?`chat.toolCards.group.namedToolRepeated`:`chat.toolCards.group.namedTool`,{names:e,count:String(t.others)}):_M(t.others,`chat.toolCards.group.otherOne`,`chat.toolCards.group.otherMany`))}if(n.length===0)return _M(e.length,`chat.toolCards.group.emptyOne`,`chat.toolCards.group.emptyMany`);let r=n.join(`, `);return r.charAt(0).toUpperCase()+r.slice(1)}function bM(){return(bM=t((()=>{V(),Yj(),mM()})))()}function xM(e){if(typeof e.messageId==`string`&&e.messageId.trim())return e.messageId;let t=e.__openclaw,n=y(t);return typeof n?.id==`string`&&n.id.trim()?n.id:void 0}function SM(e){return Array.isArray(e)?e.filter(e=>!!e&&typeof e==`object`):[]}function CM(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t||!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function wM(e){let t=e.trim();if(!t.startsWith(`{`)||!t.endsWith(`}`))return null;try{return pe(JSON.parse(t))}catch{return null}}function TM(e){if(typeof e.text==`string`)return e.text;if(typeof e.content==`string`)return e.content;if(Array.isArray(e.content)){let t=e.content.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e.text;return typeof t==`string`?[t]:[]});if(t.length>0)return t.join(`
|
|
`)}}function EM(e){let t=e.isError??e.is_error;return typeof t==`boolean`?t:void 0}function DM(...e){for(let t of e){let e=pe(t),n=e?.exitCode??e?.exit_code;if(typeof n==`number`&&Number.isInteger(n))return n}}function OM(e){return typeof e==`string`&&qM.has(e.trim().toLowerCase())}function kM(e){if(!e)return!1;let t=e.trim();if(!t)return!1;if(GM.test(t))return!0;if(t.length>KM||!t.startsWith(`{`)||!t.endsWith(`}`))return!1;let n;try{n=JSON.parse(t)}catch{return!1}if(!T(n))return!1;let r=n,i=EM(r);if(i!==void 0)return i;if(`error`in r){let e=r.error;if(typeof e==`string`)return e.trim().length>0;if(typeof e==`boolean`)return e;if(e&&typeof e==`object`)return!0}return OM(r.status)}function AM(e){let t=e.live!==!0||e.completed===!0;return e.isError??(t&&kM(e.outputText))}function jM(e,t){return AM(e)?`failed`:t===!0&&e.live===!0&&e.completed!==!0?`running`:e.completed===!0||e.live!==!0&&e.outputText!==void 0?`succeeded`:`unknown`}function MM(e,t){let n=Eo(e,t);return n?.surface===`assistant_message`?{...n,surface:`assistant_message`}:void 0}function NM(e,t,n,r=n){let i=xo(e),a=i?.surface===`assistant_message`?{...i,surface:`assistant_message`}:MM(t,n);if(a)return{...a,surface:`assistant_message`};let o=y(y(e)?.browserTab),s=_E(o);if(!(r!==`browser`||!o||!s))return{kind:`browser-tab`,...s,...typeof o.url==`string`?{url:l(o.url,2048)}:{},...typeof o.title==`string`?{title:l(o.title,512)}:{}}}function PM(e,t){return ho(e)||typeof e.callId==`string`&&e.callId.trim()||typeof t.toolCallId==`string`&&t.toolCallId.trim()||typeof t.tool_call_id==`string`&&t.tool_call_id.trim()||typeof t.toolUseId==`string`&&t.toolUseId.trim()||typeof t.tool_use_id==`string`&&t.tool_use_id.trim()||void 0}function FM(e,t){return typeof e.name==`string`&&e.name.trim()||typeof t.toolName==`string`&&t.toolName.trim()||typeof t.tool_name==`string`&&t.tool_name.trim()||`tool`}function IM(e,t,n,r=`tool`){let i=PM(e,t);return i?`${r}:${i}`:`${r}:${FM(e,t)}:${n}`}function LM(e){if(e!=null){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?String(e):typeof e==`symbol`?e.description?`Symbol(${e.description})`:`Symbol()`:Object.prototype.toString.call(e)}}}function RM(e){let t=e?.trim().replace(/\s+/g,` `);if(t)return t.replace(/^with\s+/i,``).trim()||t}function zM(e){return RM(e)?.toLowerCase().replace(/[\s._-]+/g,``)}function BM(e,t){let n=RM(e);if(!n)return;let r=zM(n),i=zM(t);return r&&i&&r===i?void 0:n}function VM(e){let t=RM(e);if(t)return l(t,120)}function HM(e){if(!T(e))return;let t=e;for(let e of JM){let n=t[e];if(typeof n!=`string`)continue;let r=n.split(/\r\n?|\n/).find(e=>e.trim().length>0),i=VM(r?Nt(r):void 0);if(i)return i}}function UM(e,t=`tool`){let n=e,r=typeof n.role==`string`?n.role.toLowerCase():``,i=fA(e)||r===`tool`||r===`function`||typeof n.toolName==`string`||typeof n.tool_name==`string`,a=SM(n.content),o=EM(n),s=n.__openclawToolStreamLive===!0,c=pe(n.__openclawToolStreamDiffStat),l=typeof c?.added==`number`&&Number.isInteger(c.added)&&c.added>=0&&typeof c.removed==`number`&&Number.isInteger(c.removed)&&c.removed>=0?{added:c.added,removed:c.removed}:void 0,u=[],d=new WeakSet,f=xM(n);for(let e=0;e<a.length;e++){let r=a[e]??{};if(mo(r.type)||typeof r.name==`string`&&(r.arguments!=null||r.args!=null||r.input!=null)){let i=CM(r.arguments??r.args??r.input),a=PM(r,n),o=r.details??n.details;u.push({id:IM(r,n,e,t),...a?{callId:a}:{},name:FM(r,n),args:i,inputText:LM(i),...o===void 0?{}:{details:o},...s?{live:!0,completed:n.__openclawToolStreamResultReceived===!0}:{},...l?{liveDiffStat:l}:{},messageId:f});continue}if(Co(r.type)){let a=FM(r,n),c=IM(r,n,e,t),l=PM(r,n),p=u.find(e=>e.id===c)??u.find(e=>(!l||!e.callId)&&e.name===a&&e.outputText===void 0&&!d.has(e)),m=TM(r),h=r.details??n.details,g=i?FM({},n):void 0,_=NM(h,m,a,g&&g!==`browser`?g:p?.name??g??a),v=EM(r)??o,y=DM(r,h,m?wM(m):void 0,n);if(p){d.add(p),p.callId??=l,s||(p.completed=!0),p.outputText=m,p.preview=_,h!==void 0&&(p.details=h),v!==void 0&&(p.isError=v),y!==void 0&&(p.exitCode=y);continue}u.push({id:c,...l?{callId:l}:{},name:a,completed:!0,outputText:m,...h===void 0?{}:{details:h},messageId:f,...v===void 0?{}:{isError:v},...y===void 0?{}:{exitCode:y},preview:_})}}if(i&&u.length===0){let i=typeof n.toolName==`string`&&n.toolName||typeof n.tool_name==`string`&&n.tool_name||`tool`,a=Jp(e)??void 0,s=PM({},n),c=DM(n,n.details,a?wM(a):void 0);u.push({id:IM({},n,0,t),...s?{callId:s}:{},name:i,completed:fA(e)||r===`tool`||r===`function`,outputText:a,...n.details===void 0?{}:{details:n.details},messageId:f,...o===void 0?{}:{isError:o},...c===void 0?{}:{exitCode:c},preview:NM(n.details,a,i)})}for(let[e,t]of u.entries()){if(t.preview?.kind!==`browser-tab`||t.callId||t.messageId)continue;let r=YM.get(n);r===void 0&&(r=++XM,YM.set(n,r)),t.previewRevision=`${r}:${e}`}return u}function WM(e,t=`tool`){if(!e||typeof e!=`object`)return UM(e,t);let n=ZM.get(e);n||(n=new Map,ZM.set(e,n));let r=n.get(t);if(r)return r;let i=UM(e,t);return n.set(t,i),i}var GM,KM,qM,JM,YM,XM,ZM;function QM(){return(QM=t((()=>{_o(),bo(),bE(),It(),im(),LA(),GM=/^tool not found\.?$/i,KM=2e4,qM=new Set([`error`,`failed`,`timeout`]),JM=[`message`,`prompt`,`task`,`query`,`text`,`description`],YM=new WeakMap,XM=0,ZM=new WeakMap})))()}function $M(e){return typeof e.itemId==`string`&&e.itemId.trim().length>0}function eN(e){return e.boundaryMarker!==!0&&!$M(e)}function tN(e,t){return t.trim()&&(e===null||t.startsWith(e))?t:e}function nN(e,t){return!t||!e.startsWith(t)?e:e.slice(t.length).trimStart()}function rN(e,t=e=>e){let n=null;for(let r of e)eN(r)&&(n=tN(n,t(r.text)));return n}function iN(){return(iN=t((()=>{})))()}function aN(e){return e.callId??e.messageId??e.previewRevision}function oN(e,t){let n=new Map;for(let r of[e,t])for(let e of r)if(T(e))for(let t of WM(e)){let e=aN(t);if(t.preview?.kind===`browser-tab`&&e&&jM(t,!1)===`succeeded`){let r=yE(t.preview);n.delete(r),n.set(r,{tab:t.preview,revision:e})}}return n}function sN(e){let t=yE(e.tab),n=cN.get(e.client);n||(n={tabs:new Map,images:new Map},cN.set(e.client,n));let{tabs:r,images:i}=n,a=r.get(t);if(a||(a={revisions:new Set},r.set(t,a)),a.revisions.has(e.revision))return a.pending??Promise.resolve(i.get(t));a.revisions.add(e.revision);let o=(a.pending??Promise.resolve()).then(async()=>{try{let n=await FT(TT(e.client,e.tab),e.tab.targetId),r=await KT({resourceBasePath:e.resourceBasePath,authToken:e.authToken,path:n.path});if(i.delete(t),i.set(t,r),i.size>lN){let e=i.keys().next().value;e!==void 0&&i.delete(e)}return r}catch{i.delete(t);return}finally{a.pending===o&&(a.pending=void 0)}});return a.pending=o,o}var cN,lN;function uN(){return(uN=t((()=>{YT(),bE(),QM(),cN=new WeakMap,lN=32})))()}function dN(e,t){let n=fN.length;return(Rm(`${e}:offset`)%n+t*(1+Rm(`${e}:stride`)%(n-1)))%n}var fN,pN,mN,hN;function gN(){return(gN=t((()=>{I(),R(),V(),M(),Fy(),fN=[`shelling`,`scuttling`,`clawing`,`pinching`,`molting`,`bubbling`,`tiding`,`reefing`,`cracking`,`sifting`,`brining`,`nautiling`,`krilling`,`barnacling`,`lobstering`,`tidepooling`,`pearling`,`snapping`,`surfacing`],pN=3e4,mN=45e3,hN=class extends xt{constructor(...e){super(...e),this.startMs=null,this.seed=``,this.polling=new Py(this,1e3,()=>this.requestUpdate(),!1)}connectedCallback(){super.connectedCallback(),this.syncTimer()}updated(){this.syncTimer()}syncTimer(){this.isConnected&&this.startMs!=null?this.polling.start():this.polling.stop()}render(){if(this.startMs==null)return P;let e=Date.now()-this.startMs;if(e<pN)return P;let t=e-pN,n=Math.floor(t/mN),r=dN(this.seed,n);return F`<span>·</span> ${W(`chat.progressLabels.${fN[r]}`)}…`}},S([z({type:Number})],hN.prototype,`startMs`,void 0),S([z()],hN.prototype,`seed`,void 0),customElements.get(`openclaw-working-phrase`)||customElements.define(`openclaw-working-phrase`,hN)})))()}var _N,vN;function yN(){return(yN=t((()=>{pi(),_N={sessionsView:{placementFactService:`Service`,placementFactProfile:`Profile`,placementFactMachine:`Machine`,placementFactState:`State`,placementFactDisk:`Disk`,placementDiskFree:`{free} free`,runsOnDevice:`Runs on device`,deviceOffline:`Device offline`,waitingForDevice:`Waiting for device to reconnect; retry after it returns.`,continueOnGatewayMenu:`Continue on Gateway…`,continueOnGatewayAction:`Continue on Gateway`,continueOnGatewayConfirm:`Continue "{session}" on the Gateway? Unsynced device files and in-flight work may be lost. OpenClaw will continue from the last Gateway-synced state and will not replay the interrupted turn.`,stopDeviceWorker:`Stop device worker…`,offlineDeviceStopUnavailable:`Reconnect the device to stop and sync its workspace, or Continue on Gateway.`,stopDeviceWorkerConfirm:`Stop the device worker for "{session}" after it reconnects?`,stopDeviceWorkerConfirmAction:`Stop device worker`}},vN=Object.assign(()=>{Object.assign(gi.sessionsView,_N.sessionsView)},{catalog:_N})})))()}var bN;function xN(){return(xN=t((()=>{I(),U(),bN=class{constructor(e,t){this.host=e,this.options=t,this.active=!1,this.errorText=null,this.restoreFocus=!1,this.onFullscreenChange=()=>this.handleFullscreenChange(),e.addController(this)}hostConnected(){document.addEventListener(`fullscreenchange`,this.onFullscreenChange)}hostDisconnected(){document.removeEventListener(`fullscreenchange`,this.onFullscreenChange),this.restoreFocus=!1,this.fullscreenElement()===this.options.section()&&document.exitFullscreen().catch(()=>{})}renderButton(){let e=this.supported(),t=this.active?this.options.exitLabel():e?this.options.enterLabel():this.options.unavailableLabel();return F`<openclaw-tooltip .content=${t}>
|
|
<button
|
|
class=${this.options.buttonClass}
|
|
type="button"
|
|
aria-label=${t}
|
|
aria-pressed=${this.active?`true`:`false`}
|
|
aria-disabled=${e?`false`:`true`}
|
|
@click=${()=>void this.toggle()}
|
|
>
|
|
<span class=${this.options.iconClass} aria-hidden="true">
|
|
${this.active?H.minimize:H.maximize}
|
|
</span>
|
|
</button>
|
|
</openclaw-tooltip>`}async exit(){if(this.active)try{await document.exitFullscreen()}catch(e){this.setError(this.options.errorMessage(e))}}fullscreenElement(){return(this.host.renderRoot instanceof ShadowRoot?this.host.renderRoot.fullscreenElement:null)??document.fullscreenElement}supported(){return document.fullscreenEnabled&&typeof Element.prototype.requestFullscreen==`function`}handleFullscreenChange(){let e=this.active;this.active=this.fullscreenElement()===this.options.section(),this.options.onChange(),this.host.requestUpdate(),e&&!this.active&&this.restoreFocus&&this.host.updateComplete.then(()=>{this.host.renderRoot.querySelector(this.options.buttonSelector)?.focus(),this.restoreFocus=!1})}async toggle(){if(this.setError(null),this.active){await this.exit();return}let e=this.options.section();if(!e||!this.supported()){this.setError(this.options.unavailableLabel());return}this.restoreFocus=!0;try{await e.requestFullscreen()}catch(e){this.restoreFocus=!1,this.setError(this.options.errorMessage(e))}}setError(e){this.errorText=e,e&&this.options.onError?.(e),this.host.requestUpdate()}}})))()}function Q(e,...t){return{id:e,label:`shortcutsOverlay.labels.${e}`,combos:t}}function SN(e,t){return{id:e,label:`shortcutsOverlay.sections.${e}`,entries:t}}function CN(e=`enter`){return e===`modifier-enter`?wN.map(e=>e.entries.some(e=>TN.has(e.id))?SN(e.id,e.entries.map(e=>TN.has(e.id)?Q(e.id,D.modifiedEnter):e)):e):wN}var wN,TN;function EN(){return(EN=t((()=>{tn(),wN=[SN(`general`,[Q(`commandPalette`,D.commandPalette),Q(`keyboardShortcuts`,D.keyboardShortcuts),Q(`toggleSidebar`,D.toggleSidebar),Q(`debugOverlay`,D.debugOverlay),Q(`appearanceSettings`,D.appearanceSettings),Q(`startNewSession`,D.sendMessage),Q(`closeDialog`,D.escape)]),SN(`chat`,[Q(`sendMessage`,D.sendMessage),Q(`newline`,D.newline),Q(`steerImmediately`,D.modifiedEnter),Q(`historyRecall`,D.historyPrevious,D.historyNext),Q(`transcriptSearch`,D.transcriptSearch),Q(`clearReply`,D.escape),Q(`stopResponse`,D.escape),Q(`cancelDictation`,D.escape),Q(`saveQueuedMessage`,D.modifiedEnter)]),SN(`panels`,[Q(`terminalPanel`,D.terminalPanel),Q(`workspaceFiles`,D.workspaceFiles)]),SN(`sidebar`,[Q(`toggleSessionSelect`,D.toggleSessionSelect),Q(`extendSessionSelect`,D.extendSessionSelect)]),SN(`imageViewer`,[Q(`zoomIn`,D.zoomIn),Q(`zoomOut`,D.zoomOut),Q(`zoomReset`,D.zoomReset)]),SN(`approvals`,[Q(`approveOnce`,D.modifiedEnter),Q(`approveAlways`,D.approveAlways),Q(`denyApproval`,D.denyApproval)])],TN=new Set([`sendMessage`,`startNewSession`])})))()}function DN(e,t){return e>t?W(`execApproval.expiresIn`,{time:Qt(e,t,!0)}):W(`execApproval.expired`)}function ON(e,t,n){return t?F`<div class="exec-approval-meta-row">
|
|
<span>${e}</span><span>${n?.path?Ko(t):t}</span>
|
|
</div>`:P}function kN(e){let t=[...e.commandSpans??[]].filter(t=>Number.isSafeInteger(t.startIndex)&&Number.isSafeInteger(t.endIndex)&&t.startIndex>=0&&t.endIndex>t.startIndex&&t.endIndex<=e.command.length).toSorted((e,t)=>e.startIndex-t.startIndex||t.endIndex-e.endIndex),n=[],r=0;for(let e of t)e.startIndex>=r&&(n.push(e),r=e.endIndex);if(!n.length)return F`<div class="exec-approval-command mono">${e.command}</div>`;let i=[];r=0;for(let t of n)t.startIndex>r&&i.push(e.command.slice(r,t.startIndex)),i.push(F`<mark class="exec-approval-command-span"
|
|
>${e.command.slice(t.startIndex,t.endIndex)}</mark
|
|
>`),r=t.endIndex;return r<e.command.length&&i.push(e.command.slice(r)),F`<div class="exec-approval-command mono">${i}</div>`}function AN(e){return F`<details class="exec-approval-details">
|
|
<summary>${W(`execApproval.details`)}</summary>
|
|
<div class="exec-approval-meta">${e}</div>
|
|
</details>`}function jN(e,t){return t?F`<span class="exec-approval-chip mono" data-approval-chip=${e}>${t}</span>`:P}function MN(e){switch(e.kind){case`standing-grant`:return e.expiresInDays===void 0?W(`execApproval.scope.standingGrant`,{automation:e.automation}):W(`execApproval.scope.standingGrantDays`,{automation:e.automation,count:String(e.expiresInDays)});case`message-send`:return W(`execApproval.scope.messageSend`,{count:String(e.recipientCount),target:e.target});case`payment`:return W(`execApproval.scope.payment`,{amount:e.amount,currency:e.currency,target:e.target});case`external-post`:return W(`execApproval.scope.externalPost`,{target:e.target})}return e}function NN(e,t){return F` ${kN(e)}
|
|
${e.scope?F`<div class="exec-approval-scope">${MN(e.scope)}</div>`:P}
|
|
<div class="exec-approval-meta">
|
|
${ON(W(`execApproval.labels.host`),e.host)}
|
|
${ON(W(`execApproval.labels.cwd`),e.cwd,{path:!0})}
|
|
</div>
|
|
${AN(F`
|
|
${ON(W(`execApproval.labels.resolved`),e.resolvedPath,{path:!0})}
|
|
${ON(W(`execApproval.labels.security`),e.security)}
|
|
${ON(W(`execApproval.labels.ask`),e.ask)}
|
|
${t===`modal`?ON(W(`execApproval.labels.session`),e.sessionKey):P}
|
|
`)}`}function PN(e,t){return F` ${e.pluginDescription?F`<pre class="exec-approval-command mono">${e.pluginDescription}</pre>`:P}
|
|
${t===`modal`&&e.request.sessionKey?AN(F`${ON(W(`execApproval.labels.session`),e.request.sessionKey)}`):P}`}function FN(e){let t=e.replace(/\s+/g,` `).trim();return t.length>64?`${l(t,61)}…`:t}function IN(e,t){return W(e===`allow-once`?`execApproval.allowOnce`:e===`allow-always`?t===`exec`?`execApproval.alwaysAllowHere`:`execApproval.alwaysAllow`:`execApproval.deny`)}function LN(e){return e===`allow-once`?`btn primary`:e===`deny`?`btn danger`:`btn`}function RN(e){return e===`allow-once`?`Ctrl/Cmd+Enter`:e===`allow-always`?`Ctrl/Cmd+Shift+Enter`:`Ctrl/Cmd+D`}function zN(e){return e.request.allowedDecisions?.length?e.request.allowedDecisions:e.kind===`exec`&&e.request.ask===`always`?[`allow-once`,`deny`]:UN}function BN(e){return e.kind===`exec`?W(`execApproval.execApprovalNeeded`):e.pluginTitle??W(`execApproval.pluginApprovalNeeded`)}function VN(e){let t=e.approval,n=Date.now(),r=t.expiresAtMs<=n,i=FN(t.request.command),a=t.request.sessionKey?.trim(),o=e.sessionTitle??(a?$e(a):BN(t)),s=r||t.expiresAtMs-n<12e4,c=DN(t.expiresAtMs,n),l=W(`execApproval.reviewOnly`),u=!e.canGrant&&e.error===l;return F`<article
|
|
class="sidebar-approval-row sidebar-issues-panel__details--warning"
|
|
data-attention-kind="pendingApproval"
|
|
data-approval-id=${t.id}
|
|
>
|
|
<span class="sidebar-issues-panel__icon sidebar-approval-row__icon" aria-hidden="true"
|
|
>${H.shieldQuestion}</span
|
|
>
|
|
<div class="sidebar-approval-row__content">
|
|
<div class="sidebar-approval-row__header" data-issue-row-focus tabindex="-1">
|
|
<span class="sidebar-issues-panel__entity" title=${o}>${o}</span>
|
|
<openclaw-approval-countdown
|
|
class="sidebar-approval-row__timer ${s?`sidebar-approval-row__timer--urgent`:``}"
|
|
role="timer"
|
|
aria-label=${c}
|
|
title=${c}
|
|
.expiresAtMs=${t.expiresAtMs}
|
|
.compact=${!0}
|
|
></openclaw-approval-countdown>
|
|
</div>
|
|
<div class="sidebar-approval-row__command mono" title=${t.request.command}>
|
|
<span aria-hidden="true">$ </span>${i}
|
|
</div>
|
|
${t.request.scope?F`<div class="exec-approval-scope">
|
|
${MN(t.request.scope)}
|
|
</div>`:P}
|
|
<div
|
|
class="sidebar-approval-row__actions"
|
|
role="group"
|
|
aria-label=${W(`approvalPage.actionsLabel`)}
|
|
>
|
|
${zN(t).map(n=>{let a=IN(n,t.kind);return F`<button
|
|
type="button"
|
|
class="btn btn--xs ${n===`deny`?`btn--ghost`:``} sidebar-approval-row__action sidebar-approval-row__action--${n}"
|
|
aria-label=${W(`execApproval.decisionRequest`,{decision:a,command:i})}
|
|
?disabled=${e.busy||!e.canGrant||r}
|
|
@click=${r=>e.onDecision(r,t.id,n)}
|
|
>
|
|
${a}
|
|
</button>`})}
|
|
${e.openSessionHref&&e.onOpenSession?F`<a
|
|
class="sidebar-approval-row__open-session"
|
|
href=${e.openSessionHref}
|
|
aria-label=${W(`sessionsView.openSession`)}
|
|
title=${W(`sessionsView.openSession`)}
|
|
@click=${e.onOpenSession}
|
|
>
|
|
${H.arrowUpRight}
|
|
</a>`:P}
|
|
</div>
|
|
${e.canGrant?P:F`<div class="sidebar-approval-row__message" role=${u?`alert`:`note`}>
|
|
${l}
|
|
</div>`}
|
|
${e.error&&!u?F`<div
|
|
class="sidebar-approval-row__message sidebar-approval-row__message--error"
|
|
role="alert"
|
|
>
|
|
${e.error}
|
|
</div>`:P}
|
|
</div>
|
|
</article>`}function HN(e){let t=e.approval,n=zN(t),r=W(`execApproval.reviewOnly`),i=!e.canGrant&&e.error===r,a=t.pluginSeverity?.trim().toLowerCase(),o=t.kind===`exec`||a===`warning`||a===`warn`?`warning`:a===`danger`||a===`critical`||a===`error`?`danger`:`info`,s=t.kind===`plugin`?t.pluginId?.trim():null,c=e.variant===`modal`?t.request.agentId?.trim():null;return F` <div
|
|
class="exec-approval-card exec-approval-card--${e.variant} exec-approval-card--severity-${o}"
|
|
data-approval-id=${t.id}
|
|
>
|
|
<div class="exec-approval-header">
|
|
<div>
|
|
<div class="exec-approval-title">${BN(t)}</div>
|
|
${s||c?F`<div class="exec-approval-chips">
|
|
${jN(`plugin`,s)} ${jN(`agent`,c)}
|
|
</div>`:P}
|
|
<openclaw-approval-countdown
|
|
class="exec-approval-sub exec-approval-countdown"
|
|
role="timer"
|
|
.expiresAtMs=${t.expiresAtMs}
|
|
></openclaw-approval-countdown>
|
|
</div>
|
|
${(e.queueCount??0)>1?F`<div class="exec-approval-queue">
|
|
${W(`execApproval.pending`,{count:String(e.queueCount)})}
|
|
</div>`:P}
|
|
</div>
|
|
${e.variant===`inline`&&t.sourceSessionKey?F`<div class="exec-approval-warning" role="note">
|
|
${W(`execApproval.requestedBySession`,{session:$e(t.sourceSessionKey)})}
|
|
</div>`:P}
|
|
${t.kind===`exec`?NN(t.request,e.variant):PN(t,e.variant)}
|
|
${t.kind===`exec`&&!n.includes(`allow-always`)?F`<div class="exec-approval-warning">${W(`execApproval.allowAlwaysUnavailable`)}</div>`:P}
|
|
${e.canGrant?P:F`<div
|
|
class=${i?`exec-approval-error`:`exec-approval-warning`}
|
|
role=${i?`alert`:`note`}
|
|
>
|
|
${r}
|
|
</div>`}
|
|
${e.error&&!i?F`<div class="exec-approval-error" role="alert">${e.error}</div>`:P}
|
|
<div class="exec-approval-actions">
|
|
${n.map(n=>{let r=IN(n,e.approval.kind);return F`<button
|
|
class=${LN(n)}
|
|
type="button"
|
|
aria-label=${r}
|
|
?disabled=${e.busy||!e.canGrant}
|
|
title=${e.variant===`modal`&&e.canGrant?`${r} (${RN(n)})`:r}
|
|
@click=${()=>e.onDecision(t.id,n)}
|
|
>
|
|
<span>${r}</span>
|
|
</button>`})}
|
|
</div>
|
|
</div>`}var UN,WN;function GN(){return(GN=t((()=>{I(),R(),V(),pn(),_n(),M(),Fy(),U(),UN=[`allow-once`,`allow-always`,`deny`],WN=class extends xt{constructor(...e){super(...e),this.expiresAtMs=0,this.compact=!1,this.polling=new Py(this,1e3,()=>{this.requestUpdate(),this.compact||this.closest(`openclaw-modal-dialog`)?.setAttribute(`description`,DN(this.expiresAtMs,Date.now()))},!1)}connectedCallback(){super.connectedCallback(),this.polling.start()}render(){let e=Date.now();return F`${this.compact?Qt(this.expiresAtMs,e,!0):DN(this.expiresAtMs,e)}`}},S([z({type:Number})],WN.prototype,`expiresAtMs`,void 0),S([z({type:Boolean})],WN.prototype,`compact`,void 0),customElements.get(`openclaw-approval-countdown`)||customElements.define(`openclaw-approval-countdown`,WN)})))()}function KN(){try{let e=A()?.getItem(iP),t=e?JSON.parse(e):{},n=new Map;if(Array.isArray(t)){for(let e of t)typeof e==`string`&&e&&n.set(e,{firstSeenAt:null,name:null,shinySeenAt:null});return n}if(t&&typeof t==`object`)for(let[e,r]of Object.entries(t))e&&n.set(e,{firstSeenAt:typeof r?.firstSeenAt==`number`?r.firstSeenAt:null,name:typeof r?.name==`string`&&r.name?r.name:null,shinySeenAt:typeof r?.shinySeenAt==`number`?r.shinySeenAt:null});return n}catch{return new Map}}function qN(e){let t={};for(let[n,r]of[...e.entries()].toSorted(([e],[t])=>e.localeCompare(t)))t[n]={...r.firstSeenAt===null?{}:{firstSeenAt:r.firstSeenAt},...r.name===null?{}:{name:r.name},...r.shinySeenAt===null?{}:{shinySeenAt:r.shinySeenAt}};A()?.setItem(iP,JSON.stringify(t))}function JN(){return new Set(KN().keys())}function YN(){return KN()}function XN(e,t={}){try{let n=KN(),r=n.get(e);if(r){let i=t.shiny===!0&&r.shinySeenAt===null;if(r.firstSeenAt!==null&&r.name!==null&&!i)return;n.set(e,{firstSeenAt:r.firstSeenAt??Date.now(),name:r.name??t.name??null,shinySeenAt:r.shinySeenAt??(t.shiny===!0?Date.now():null)})}else n.set(e,{firstSeenAt:Date.now(),name:t.name??null,shinySeenAt:t.shiny===!0?Date.now():null});qN(n)}catch{}}function ZN(){try{let e=A()?.getItem(aP),t=e?JSON.parse(e):{},n=t&&typeof t==`object`?t:{};return{visits:typeof n.visits==`number`&&n.visits>=0?n.visits:0,shoos:typeof n.shoos==`number`&&n.shoos>=0?n.shoos:0}}catch{return{visits:0,shoos:0}}}function QN(e){try{A()?.setItem(aP,JSON.stringify(e))}catch{}}function $N(){let e=ZN();QN({...e,visits:e.visits+1})}function eP(){let e=ZN();QN({...e,shoos:e.shoos+1})}function tP(){let{visits:e,shoos:t}=ZN();return{tier:e<3?`shy`:e<15?`regular`:`friend`,wary:t>=3&&t>e*.3,visits:e,shoos:t}}function nP(e){for(let[t,n]of sP)if(e>=t)return n;return null}function rP(e,t){if(e===null||t.getTime()-e<cP)return!1;let n=new Date(e);return n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()}var iP,aP,oP,sP,cP;function lP(){return(lP=t((()=>{iP=`openclaw.control.lobsterdex.v1`,aP=`openclaw.control.lobsterpet.familiarity.v1`,oP={shy:{stayMul:.6,firstDelayMul:1.3,gapMul:1},regular:{stayMul:1,firstDelayMul:1,gapMul:1},friend:{stayMul:1.6,firstDelayMul:.7,gapMul:.8},waryGapMul:1.7},sP=[[250,`Elder`],[100,`Captain`],[50,`Sir`]],cP=2592e7})))()}function uP(e,t,n){let r=e;if(!t)return r;try{let e=window.AudioContext;if(!e)return r;r??=new e,r.state===`suspended`&&r.resume();let t=r.currentTime,i=r.createOscillator(),a=r.createGain();i.type=`sine`,n===`poke`?(i.frequency.setValueAtTime(330,t),i.frequency.exponentialRampToValueAtTime(165,t+.09)):(i.frequency.setValueAtTime(392,t),i.frequency.exponentialRampToValueAtTime(523,t+.18)),a.gain.setValueAtTime(1e-4,t),a.gain.exponentialRampToValueAtTime(.05,t+.02),a.gain.exponentialRampToValueAtTime(1e-4,t+(n===`poke`?.12:.24)),i.connect(a).connect(r.destination),i.start(t),i.stop(t+.26)}catch{}return r}function dP(){let e=uP(null,!0,`poke`);e&&window.setTimeout(()=>void e.close().catch(()=>{}),300)}function fP(){return(fP=t((()=>{})))()}function pP(e){let t=e.position;return t?F`
|
|
<wa-dropdown
|
|
class="session-menu lobster-pet-dismiss-menu"
|
|
.open=${!0}
|
|
placement="top-start"
|
|
.distance=${0}
|
|
aria-label=${W(`quickSettings.appearance.lobsterVisits`)}
|
|
@wa-select=${t=>{t.preventDefault(),t.detail.item.value===`dismiss`?e.onDismiss(!1):t.detail.item.value===`dismiss-permanently`&&e.onDismiss(!0)}}
|
|
@wa-after-hide=${e.onClose}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${W(`quickSettings.appearance.lobsterVisits`)}
|
|
style="position: fixed; left: ${t.x}px; top: ${t.y}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
<wa-dropdown-item class="session-menu__item" value="dismiss"
|
|
>${W(`common.dismiss`)}</wa-dropdown-item
|
|
>
|
|
<wa-dropdown-item class="session-menu__item" value="dismiss-permanently"
|
|
>${W(`common.dismissAndDontShowAgain`)}</wa-dropdown-item
|
|
>
|
|
</wa-dropdown>
|
|
`:P}function mP(){return(mP=t((()=>{I(),V(),li()})))()}function hP(e){return _P[e]??e}function gP(e){return ne(vP[(e>>>3)%vP.length],`lobster pet name catalog entry`)}var _P,vP,yP;function bP(){return(bP=t((()=>{c(),_P={blue:`Blueberry`,gold:`Goldie`,lumen:`Glimmer`,magma:`Ember`,oilslick:`Slick`,aurora:`Borealis`,nebula:`Cosmo`,banana:`Peel`,mood:`Ringo`,bee:`Buzz`,rubberduck:`Debuggy`,watermelon:`Pips`,clawtron:`Clawtron`,selene:`Selene`,geode:`Amethyst`,ghost:`Boo`,glass:`Prism`,split:`Picasso`,sourdough:`Boule`,zombie:`Shambles`,plush:`Buttons`,balloon:`Squeaky`,cottoncandy:`Taffy`,cryptid:`Nessie`,flatpack:`Skaldjur`,tinfoil:`Mulder`,actual:`Homarus`,disco:`Boogie`,chimera:`Frankie`,blueprint:`Prototype`,phosphor:`TTY`,ascii:`Figlet`,portal:`Warp`,notexture:`Magenta`,loading:`Spinner`,eclipse:`Umbra`,heisenbug:`Segfault`,invisible:`Nobody`,pixel:`Sprite`,retro:`OG`,goldenretro:`24K`},vP=[`Pinchy`,`Barnaby`,`Thermidor`,`Clawdette`,`Sheldon`,`Scuttles`,`Bisque`,`Crusty`,`Snips`,`Bubbles`,`Clawdia`,`Ferdinand`,`Maple`,`Pearl`,`Biscuit`,`Captain`,`Ziggy`,`Noodle`,`Waffles`,`Pippin`,`Squirt`,`Chip`,`Clementine`,`Moss`],yP={crimson:{flavor:`The classic red, first in every tide pool.`,hint:`Where every story starts.`},blue:{flavor:`1 in 2 million, and knows it.`,hint:`One in two million.`},gold:{flavor:`1 in 30 million karats.`,hint:`Worth its weight.`},lumen:{flavor:`Brings its own night lights.`,hint:`Glows where it's darkest.`},magma:{flavor:`Fresh from the vent, still cooling.`,hint:`Runs hot.`},oilslick:{flavor:`Black shell, rainbow finish.`,hint:`Spilled, not stirred.`},aurora:{flavor:`Northern lights, southern claws.`,hint:`Best seen on clear nights.`},nebula:{flavor:`Not from any ocean on this planet.`,hint:`Came from very far away.`},banana:{flavor:`Banana. For scale.`,hint:`For scale.`},mood:{flavor:`Wears whatever color you're feeling.`,hint:`Matches your vibe.`},bee:{flavor:`Technically not a bee.`,hint:`Do not tell the bees.`},rubberduck:{flavor:`Listens to your bugs. Judges silently.`,hint:`Quack.`},watermelon:{flavor:`Contains 6% lobster.`,hint:`Ripe when thumped.`},clawtron:{flavor:`60% rivets, 40% love.`,hint:`Beep boop snip.`},selene:{flavor:`Carries the current moon on its belly.`,hint:`Waxes and wanes.`},geode:{flavor:`Rock outside, amethyst inside.`,hint:`Crack the surface.`},ghost:{flavor:`1 in 100 million, barely there.`,hint:`You'd walk right past it.`},glass:{flavor:`Fully transparent. Nothing to hide.`,hint:`Easy to miss, hard to forget.`},split:{flavor:`Two lobsters, one shell.`,hint:`Can't pick a side.`},sourdough:{flavor:`Started from a starter. 24-hour proof.`,hint:`Still proofing.`},zombie:{flavor:`Slightly used. Still friendly.`,hint:`It's been better.`},plush:{flavor:`Machine washable. Air dry only.`,hint:`Soft to the touch.`},balloon:{flavor:`Do not pop.`,hint:`Handle with care.`},cottoncandy:{flavor:`Pastel, like the famous Maine catch.`,hint:`Sweeter than it looks.`},cryptid:{flavor:`Every photo comes out blurry.`,hint:`Sightings unconfirmed.`},flatpack:{flavor:`Some assembly required.`,hint:`Missing one screw.`},tinfoil:{flavor:`The tide is a psyop.`,hint:`They know.`},actual:{flavor:`An actual lobster. Unsettling, honestly.`,hint:`Anatomically correct.`},disco:{flavor:`Born under a mirror ball.`,hint:`The night is still young.`},chimera:{flavor:`Borrowed parts. No refunds.`,hint:`Something's off.`},blueprint:{flavor:`Final hardware pending approval.`,hint:`Still on the drawing board.`},phosphor:{flavor:`80 columns, 24 rows, one lobster.`,hint:`Hums at sixty hertz.`},ascii:{flavor:`Renders anywhere. Even over SSH.`,hint:`chmod +x`},portal:{flavor:`Arrives before it leaves.`,hint:`Mind the gap.`},notexture:{flavor:`Texture not found.`,hint:`404.`},loading:{flavor:`Still loading. Any second now.`,hint:`…`},eclipse:{flavor:`Do not look directly at it.`,hint:`Once in a blue moon.`},heisenbug:{flavor:`Only renders right when nobody's watching.`,hint:`Cannot be reproduced.`},invisible:{flavor:`It's right there. Look closer.`,hint:`Trust me, it exists.`},pixel:{flavor:`Rendered in 1987. Still runs.`,hint:`Insert coin.`},retro:{flavor:`The original: big claw, no apologies.`,hint:`The one that started it all.`},goldenretro:{flavor:`One in a generation.`,hint:`Worth the wait.`}}})))()}function xP(e){return((e.getTime()-CP)/864e5%SP+SP)%SP/SP}var SP,CP;function wP(){return(wP=t((()=>{SP=29.53059,CP=Date.parse(`2000-01-06T18:14:00.000Z`)})))()}function TP(e){let t=kP.map(e=>ne(OP.find(t=>t.id===e),`chimera donor palette ${e}`)),n=()=>{let n=Math.floor(e()*t.length);return ne(t.splice(n,1)[0],`distinct chimera donor`)};return{body:n().shell,clawLeft:n().shell,clawRight:n().shell,antennae:n().shell}}function EP(e){return OP.find(t=>t.shell===e)?.claw}var DP,OP,kP,AP;function jP(){return(jP=t((()=>{c(),DP=[[{id:`crimson`,shell:`#ff4f40`,claw:`#ff775f`},26],[{id:`blue`,shell:`#4a7dfc`,claw:`#7fa4ff`},7],[{id:`gold`,shell:`#f4b840`,claw:`#f9d47a`},5],[{id:`lumen`,shell:`#1d2f4e`,claw:`#2e4a77`},2],[{id:`magma`,shell:`#241214`,claw:`#3a1d18`},2],[{id:`oilslick`,shell:`#15171d`,claw:`#23262e`},2],[{id:`aurora`,shell:`#dce6f0`,claw:`#e9f0f7`},2],[{id:`nebula`,shell:`#34255c`,claw:`#4a3a7d`},2],[{id:`banana`,shell:`#f7e27d`,claw:`#f3d55b`},2],[{id:`mood`,shell:`var(--accent, #7f77dd)`,claw:`var(--accent-hover, #9a93e8)`},1.5],[{id:`bee`,shell:`#f4c531`,claw:`#2b2b23`},1.5],[{id:`rubberduck`,shell:`#ffd93b`,claw:`#ffb03b`},1.5],[{id:`watermelon`,shell:`#3f9d63`,claw:`#4fb072`},1.5],[{id:`clawtron`,shell:`#8d99a6`,claw:`#a2aeba`},1],[{id:`selene`,shell:`#c9ced8`,claw:`#d8dde5`},1],[{id:`geode`,shell:`#6b6474`,claw:`#7d7588`},1],[{id:`ghost`,shell:`#dce8f2`,claw:`#ecf3fa`},1],[{id:`glass`,shell:`#cfe4f4`,claw:`#e0eef8`},1],[{id:`split`,shell:`#ff4f40`,claw:`#ff775f`},1],[{id:`sourdough`,shell:`#d9a662`,claw:`#e6bc82`},1],[{id:`zombie`,shell:`#9db08a`,claw:`#86a17a`},1],[{id:`plush`,shell:`#e8967a`,claw:`#f2b09a`},1],[{id:`balloon`,shell:`#ff5c8a`,claw:`#ff7ea1`},1],[{id:`cryptid`,shell:`#6e6257`,claw:`#7d7263`},.9],[{id:`flatpack`,shell:`#d9c9a8`,claw:`#d9c9a8`},.9],[{id:`tinfoil`,shell:`#9aa4ad`,claw:`#a8b2bb`},.9],[{id:`actual`,shell:`#a63c28`,claw:`#8f3220`},.9],[{id:`cottoncandy`,shell:`#f6a8c9`,claw:`#a5c6f0`},.8],[{id:`disco`,shell:`#b8c4d8`,claw:`#cbd5e6`},.8],[{id:`chimera`,shell:`#b0685a`,claw:`#b0685a`},.75],[{id:`pixel`,shell:`#d84c3e`,claw:`#ef8f6a`},.7],[{id:`blueprint`,shell:`#123a66`,claw:`#123a66`},.7],[{id:`phosphor`,shell:`#0d2415`,claw:`#0f2b19`},.7],[{id:`ascii`,shell:`var(--lob-ascii-ink, #d8dee6)`,claw:`var(--lob-ascii-ink, #d8dee6)`},.7],[{id:`portal`,shell:`#4a9df8`,claw:`#ff9a2e`},.7],[{id:`notexture`,shell:`#ff00dc`,claw:`#111111`},.65],[{id:`loading`,shell:`#3a4150`,claw:`#454d5e`},.65],[{id:`eclipse`,shell:`#14161d`,claw:`#1d2026`},.65],[{id:`heisenbug`,shell:`#262a33`,claw:`#343945`},.6],[{id:`invisible`,shell:`rgba(127,140,160,0.07)`,claw:`rgba(127,140,160,0.07)`},.55],[{id:`retro`,shell:`#e8262c`,claw:`#f04a3e`},.5],[{id:`goldenretro`,shell:`#e8b422`,claw:`#f6cf5a`},.1]],OP=DP.map(([e])=>e),kP=[`crimson`,`blue`,`gold`,`banana`,`watermelon`],AP={body:`#ff4f40`,clawLeft:`#4a7dfc`,clawRight:`#f4b840`,antennae:`#3f9d63`}})))()}function MP(e,t){return L`
|
|
<g class="lob-flatpack">
|
|
<path
|
|
d="M48 10 C28 10 17 25 17 41 C17 58 29 69 48 69 C67 69 79 58 79 41 C79 25 68 10 48 10 Z"
|
|
fill="var(--lob-shell)"
|
|
stroke="#8a7c5f"
|
|
stroke-width="2"
|
|
stroke-dasharray="4 3"
|
|
/>
|
|
<g class="lob-eye-open" style=${e}>
|
|
<circle cx="39" cy="34" r="4.5" fill="#0a1014" />
|
|
<circle cx="57" cy="34" r="4.5" fill="#0a1014" />
|
|
<circle cx="40.2" cy="32.8" r="1.7" fill="var(--lob-glint, #00e5cc)" />
|
|
<circle cx="58.2" cy="32.8" r="1.7" fill="var(--lob-glint, #00e5cc)" />
|
|
</g>
|
|
<g
|
|
class="lob-eye-closed"
|
|
stroke="#0a1014"
|
|
stroke-width="2.5"
|
|
stroke-linecap="round"
|
|
fill="none"
|
|
style=${t}
|
|
>
|
|
<path d="M34 35 Q39 31 44 35" />
|
|
<path d="M52 35 Q57 31 62 35" />
|
|
</g>
|
|
|
|
<g fill="none" stroke="#8a7c5f" stroke-width="1.5" stroke-dasharray="4 3">
|
|
<path d="M27 48 Q50 58 75 61" />
|
|
<path d="M68 47 Q79 58 92 70" />
|
|
</g>
|
|
<g class="lob-claw lob-claw--l">
|
|
<path
|
|
d="M76 53 C66 50 62 58 67 65 C72 72 82 68 85 60 C87 55 82 53 76 53 Z"
|
|
fill="var(--lob-claw)"
|
|
stroke="#8a7c5f"
|
|
stroke-width="1.5"
|
|
stroke-dasharray="4 3"
|
|
/>
|
|
</g>
|
|
<g class="lob-claw lob-claw--r">
|
|
<path
|
|
d="M98 65 C109 62 115 70 111 79 C107 88 96 84 91 76 C88 70 92 66 98 65 Z"
|
|
fill="var(--lob-claw)"
|
|
stroke="#8a7c5f"
|
|
stroke-width="1.5"
|
|
stroke-dasharray="4 3"
|
|
/>
|
|
</g>
|
|
|
|
<g fill="var(--lob-shell)" stroke="#8a7c5f" stroke-width="1.5" stroke-dasharray="4 3">
|
|
<rect x="15" y="88" width="15" height="6" rx="2" />
|
|
<rect x="34" y="88" width="15" height="6" rx="2" />
|
|
<rect x="53" y="88" width="15" height="6" rx="2" />
|
|
<rect x="72" y="88" width="15" height="6" rx="2" />
|
|
</g>
|
|
|
|
<g fill="none" stroke="#5f5648" stroke-width="3" stroke-linecap="round">
|
|
<path d="M84 24 L101 8" />
|
|
<path d="M93 31 L113 14" />
|
|
</g>
|
|
<g fill="#8a7c5f">
|
|
<circle cx="105" cy="29" r="3" />
|
|
<circle cx="113" cy="35" r="3" />
|
|
</g>
|
|
<path
|
|
class="lob-flatpack__allen-key"
|
|
d="M101 84 L101 99 L115 99"
|
|
fill="none"
|
|
stroke="#5f5648"
|
|
stroke-width="3"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
/>
|
|
</g>
|
|
`}function NP(e,t){return L`
|
|
<!-- Skeleton placeholders stay neutral instead of inheriting palette colors. -->
|
|
<g class="lob-skeleton">
|
|
<rect class="lob-skeleton__block" style="--i:0" x="24" y="18" width="72" height="64" rx="10" fill="#2f3542" />
|
|
<rect class="lob-skeleton__block" style="--i:1" x="2" y="43" width="24" height="20" rx="8" fill="#39404f" />
|
|
<rect class="lob-skeleton__block" style="--i:2" x="94" y="43" width="24" height="20" rx="8" fill="#39404f" />
|
|
<path class="lob-skeleton__block" style="--i:3" d="M45 21 L34 7" stroke="#39404f" stroke-width="6" stroke-linecap="round" />
|
|
<path class="lob-skeleton__block" style="--i:4" d="M75 21 L86 7" stroke="#39404f" stroke-width="6" stroke-linecap="round" />
|
|
<rect class="lob-skeleton__block" style="--i:5" x="31" y="79" width="10" height="22" rx="4" fill="#2f3542" />
|
|
<rect class="lob-skeleton__block" style="--i:6" x="46" y="79" width="10" height="24" rx="4" fill="#39404f" />
|
|
<rect class="lob-skeleton__block" style="--i:7" x="64" y="79" width="10" height="24" rx="4" fill="#39404f" />
|
|
<rect class="lob-skeleton__block" style="--i:8" x="79" y="79" width="10" height="22" rx="4" fill="#2f3542" />
|
|
<g class="lob-eye-open" style=${e}>
|
|
<circle cx="47" cy="43" r="5" fill="#4a5364" />
|
|
<circle cx="73" cy="43" r="5" fill="#4a5364" />
|
|
</g>
|
|
<g class="lob-eye-closed" style=${t} fill="#4a5364">
|
|
<rect x="41" y="42" width="12" height="3" rx="1.5" />
|
|
<rect x="67" y="42" width="12" height="3" rx="1.5" />
|
|
</g>
|
|
</g>
|
|
`}function PP(e,t){return L`
|
|
<g class="lob-actual">
|
|
<g fill="none" stroke="#6f281d" stroke-linecap="round">
|
|
<path d="M47 27 Q27 5 2 3" stroke-width="2" />
|
|
<path d="M73 27 Q93 5 118 3" stroke-width="2" />
|
|
<path d="M46 29 Q34 16 22 13" stroke-width="1.3" />
|
|
<path d="M74 29 Q86 16 98 13" stroke-width="1.3" />
|
|
</g>
|
|
|
|
<g fill="none" stroke="#7f3022" stroke-width="2.2" stroke-linecap="round">
|
|
<path d="M39 48 Q22 52 10 65" />
|
|
<path d="M38 56 Q20 62 8 77" />
|
|
<path d="M40 65 Q24 72 15 88" />
|
|
<path d="M43 74 Q31 82 27 97" />
|
|
<path d="M81 48 Q98 52 110 65" />
|
|
<path d="M82 56 Q100 62 112 77" />
|
|
<path d="M80 65 Q96 72 105 88" />
|
|
<path d="M77 74 Q89 82 93 97" />
|
|
</g>
|
|
|
|
<g class="lob-actual__tail" fill="#8f3220" stroke="#6f281d" stroke-width="1.4">
|
|
<path d="M48 88 Q38 91 31 103 Q44 103 55 96 Z" />
|
|
<path d="M72 88 Q82 91 89 103 Q76 103 65 96 Z" />
|
|
<path d="M54 89 Q60 96 66 89 L69 104 Q60 101 51 104 Z" />
|
|
</g>
|
|
|
|
<g class="lob-claw lob-claw--l">
|
|
<path
|
|
d="M34 43 Q25 31 12 33 Q0 35 2 48 Q4 61 17 63 Q28 64 35 54 L30 49 Q22 54 15 50 Q10 47 13 42 Q17 37 24 42 Z"
|
|
fill="var(--lob-claw)"
|
|
stroke="#6f281d"
|
|
stroke-width="1.5"
|
|
/>
|
|
</g>
|
|
<g class="lob-claw lob-claw--r">
|
|
<path
|
|
d="M86 44 Q94 32 104 34 Q113 35 116 42 L107 45 L118 49 Q115 58 105 60 Q96 61 87 53 Z"
|
|
fill="var(--lob-claw)"
|
|
stroke="#6f281d"
|
|
stroke-width="1.5"
|
|
/>
|
|
</g>
|
|
|
|
<path
|
|
class="lob-actual__carapace"
|
|
d="M60 20 Q38 20 34 38 Q32 50 41 58 Q49 64 60 64 Q71 64 79 58 Q88 50 86 38 Q82 20 60 20 Z"
|
|
fill="var(--lob-shell)"
|
|
stroke="#6f281d"
|
|
stroke-width="1.8"
|
|
/>
|
|
<g class="lob-actual__abdomen" stroke="#6f281d" stroke-width="1.4">
|
|
<path d="M39 54 Q60 62 81 54 L79 65 Q60 72 41 65 Z" fill="#b34b35" />
|
|
<path d="M41 65 Q60 72 79 65 L76 76 Q60 82 44 76 Z" fill="#a63c28" />
|
|
<path d="M44 76 Q60 82 76 76 L72 87 Q60 92 48 87 Z" fill="#b34b35" />
|
|
<path d="M48 87 Q60 92 72 87 L67 96 Q60 99 53 96 Z" fill="#a63c28" />
|
|
</g>
|
|
<path d="M48 42 Q60 48 72 42 Q69 56 60 58 Q51 56 48 42 Z" fill="#bd6044" opacity="0.72" />
|
|
|
|
<g fill="none" stroke="#6f281d" stroke-width="2.2" stroke-linecap="round">
|
|
<path d="M47 28 L45 23" />
|
|
<path d="M73 28 L75 23" />
|
|
</g>
|
|
<g class="lob-eye-open" style=${e}>
|
|
<circle cx="45" cy="22" r="3.5" fill="#17100e" />
|
|
<circle cx="75" cy="22" r="3.5" fill="#17100e" />
|
|
<circle cx="46" cy="21" r="1" fill="#f2c6a8" />
|
|
<circle cx="76" cy="21" r="1" fill="#f2c6a8" />
|
|
</g>
|
|
<g class="lob-eye-closed" style=${t} fill="none" stroke="#17100e" stroke-width="2" stroke-linecap="round">
|
|
<path d="M41.5 22 H48.5" />
|
|
<path d="M71.5 22 H78.5" />
|
|
</g>
|
|
</g>
|
|
`}function FP(e,t){return L`
|
|
<g class="lob-balloon">
|
|
<g fill="none" stroke="var(--lob-shell)" stroke-width="4" stroke-linecap="round">
|
|
<path d="M48 13 Q45 5 42 3" />
|
|
<path d="M72 13 Q75 5 78 3" />
|
|
</g>
|
|
|
|
<g class="lob-claw lob-claw--l" fill="var(--lob-claw)">
|
|
<ellipse cx="29" cy="29" rx="9" ry="7" transform="rotate(-20 29 29)" />
|
|
<ellipse cx="20" cy="35" rx="8" ry="6" transform="rotate(18 20 35)" />
|
|
</g>
|
|
<g class="lob-claw lob-claw--r" fill="var(--lob-claw)">
|
|
<ellipse cx="91" cy="29" rx="9" ry="7" transform="rotate(20 91 29)" />
|
|
<ellipse cx="100" cy="35" rx="8" ry="6" transform="rotate(-18 100 35)" />
|
|
</g>
|
|
|
|
<ellipse cx="60" cy="29" rx="24" ry="19" fill="var(--lob-shell)" />
|
|
<circle cx="60" cy="48" r="4" fill="#d94b72" />
|
|
<ellipse cx="60" cy="61" rx="18" ry="14" fill="var(--lob-shell)" />
|
|
<circle cx="60" cy="75" r="3.5" fill="#d94b72" />
|
|
<ellipse cx="60" cy="86" rx="13" ry="10" fill="var(--lob-shell)" />
|
|
|
|
<g fill="#ffffff" opacity="0.55">
|
|
<ellipse cx="50" cy="22" rx="4" ry="10" transform="rotate(35 50 22)" />
|
|
<ellipse cx="52" cy="56" rx="3" ry="7" transform="rotate(32 52 56)" />
|
|
<ellipse cx="54" cy="82" rx="2.4" ry="5" transform="rotate(28 54 82)" />
|
|
</g>
|
|
|
|
<g class="lob-eye-open" style=${e}>
|
|
<circle cx="50" cy="30" r="4.5" fill="#0a1014" />
|
|
<circle cx="70" cy="30" r="4.5" fill="#0a1014" />
|
|
<circle cx="51.3" cy="28.7" r="1.8" fill="var(--lob-glint, #00e5cc)" />
|
|
<circle cx="71.3" cy="28.7" r="1.8" fill="var(--lob-glint, #00e5cc)" />
|
|
</g>
|
|
<g
|
|
class="lob-eye-closed"
|
|
style=${t}
|
|
fill="none"
|
|
stroke="#0a1014"
|
|
stroke-width="2.5"
|
|
stroke-linecap="round"
|
|
>
|
|
<path d="M45 31 Q50 27 55 31" />
|
|
<path d="M65 31 Q70 27 75 31" />
|
|
</g>
|
|
|
|
<path d="M55 96 L60 91 L65 96 L60 101 Z" fill="#d94b72" />
|
|
<path
|
|
d="M60 100 Q67 102 62 105 Q57 108 65 111"
|
|
fill="none"
|
|
stroke="#c9d2da"
|
|
stroke-width="1.2"
|
|
stroke-linecap="round"
|
|
/>
|
|
</g>
|
|
`}function IP(e,t){return L`
|
|
<!-- Like pet names and lore, terminal glyph art is an English-only easter-egg channel. -->
|
|
<g
|
|
class="lob-ascii"
|
|
fill="var(--lob-shell)"
|
|
font-family="ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
font-size="11"
|
|
text-anchor="middle"
|
|
xml:space="preserve"
|
|
>
|
|
<text x="60" y="17">\\ / \\ /</text>
|
|
<text x="60" y="31">{ \\_______/ }</text>
|
|
<g class="lob-eye-open" style=${e}>
|
|
<text x="60" y="45">(o) (o)</text>
|
|
</g>
|
|
<g class="lob-eye-closed" style=${t}>
|
|
<text x="60" y="45">(-) (-)</text>
|
|
</g>
|
|
<text x="60" y="59">( '---' )</text>
|
|
<text x="60" y="73"> \\ _____ /</text>
|
|
<text x="60" y="87"> (_________)</text>
|
|
<text x="60" y="101"> | | | |</text>
|
|
</g>
|
|
`}function LP(e,t){return L`
|
|
<g class="lob-portal">
|
|
<ellipse
|
|
class="lob-portal-ring lob-portal-ring--blue"
|
|
cx="30"
|
|
cy="50"
|
|
rx="14"
|
|
ry="30"
|
|
fill="#0d1b33"
|
|
fill-opacity="0.85"
|
|
stroke="currentColor"
|
|
stroke-width="3"
|
|
transform="rotate(-12 30 50)"
|
|
/>
|
|
|
|
<!-- Fixed lobster red preserves the split-body gag while shell/claw vars carry portal identity. -->
|
|
<path d="M31 30 Q45 20 56 30 Q62 39 60 53 Q58 64 47 70 L31 67 Z" fill="#b0432f" />
|
|
<g class="lob-claw lob-claw--l">
|
|
<path
|
|
d="M52 54 Q58 48 63 51 Q67 56 63 62 Q58 67 52 63 Z"
|
|
fill="#b0432f"
|
|
/>
|
|
</g>
|
|
<g fill="none" stroke="#b0432f" stroke-width="2" stroke-linecap="round">
|
|
<path d="M42 31 Q43 16 50 7" />
|
|
<path d="M52 28 Q58 14 66 9" />
|
|
</g>
|
|
<g class="lob-eye-open" style=${e}>
|
|
<circle cx="45" cy="39" r="4" fill="#0a1014" />
|
|
<circle cx="57" cy="37" r="4" fill="#0a1014" />
|
|
<circle cx="46" cy="38" r="1.5" fill="var(--lob-glint, #00e5cc)" />
|
|
<circle cx="58" cy="36" r="1.5" fill="var(--lob-glint, #00e5cc)" />
|
|
</g>
|
|
<g
|
|
class="lob-eye-closed"
|
|
style=${t}
|
|
fill="none"
|
|
stroke="#0a1014"
|
|
stroke-width="2.2"
|
|
stroke-linecap="round"
|
|
>
|
|
<path d="M41 40 Q45 37 49 40" />
|
|
<path d="M53 38 Q57 35 61 38" />
|
|
</g>
|
|
|
|
<g class="lob-portal-rear" fill="#b0432f">
|
|
<path d="M91 44 Q82 40 75 44 L82 51 L74 56 L82 61 L75 68 Q83 70 92 64 Z" />
|
|
<path d="M88 52 Q82 49 78 45" fill="none" stroke="#7f3022" stroke-width="2" />
|
|
<path d="M88 61 Q82 64 78 69" fill="none" stroke="#7f3022" stroke-width="2" />
|
|
</g>
|
|
<ellipse
|
|
class="lob-portal-ring lob-portal-ring--orange"
|
|
cx="92"
|
|
cy="58"
|
|
rx="14"
|
|
ry="30"
|
|
fill="#0d1b33"
|
|
fill-opacity="0.85"
|
|
stroke="currentColor"
|
|
stroke-width="3"
|
|
transform="rotate(10 92 58)"
|
|
/>
|
|
</g>
|
|
`}function RP(e){return L`
|
|
<g class="lob-tinfoil" fill="none" stroke="#c9d2da" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
<path d="M27 31 L38 27 L45 34 L55 25 L64 33 L75 26 L91 34" />
|
|
<path d="M20 51 L31 45 L43 54 L55 45 L68 54 L82 44 L100 53" />
|
|
<path d="M23 70 L36 64 L47 73 L60 63 L74 72 L90 65 L98 72" />
|
|
<path d="M35 86 L46 80 L58 87 L70 79 L84 85" />
|
|
</g>
|
|
${e?L`
|
|
<g class="lob-tinfoil-hat">
|
|
<path d="M43 14 L57 0 L78 15 L60 11 Z" fill="#c0c9d1" />
|
|
<path d="M57 0 L60 11 L78 15" fill="none" stroke="#7f8992" stroke-width="1.5" />
|
|
<path d="M43 14 L60 11 L53 5" fill="none" stroke="#9aa4ad" stroke-width="1.5" />
|
|
</g>
|
|
`:``}
|
|
`}var zP,BP,VP,HP,UP;function WP(){return(WP=t((()=>{I(),zP=L`
|
|
<g class="lob-watermelon">
|
|
<g fill="none" stroke="#2c7a4a" stroke-width="4" stroke-linecap="round">
|
|
<path d="M31 25 Q39 13 48 11" />
|
|
<path d="M48 22 Q54 10 60 9" />
|
|
<path d="M66 22 Q72 10 80 15" />
|
|
<path d="M82 28 Q89 20 94 30" />
|
|
</g>
|
|
<ellipse cx="60" cy="69" rx="35" ry="23" fill="#e5484d" />
|
|
<g fill="#28211c">
|
|
<ellipse cx="42" cy="62" rx="2" ry="3.4" transform="rotate(-20 42 62)" />
|
|
<ellipse cx="58" cy="58" rx="2" ry="3.4" transform="rotate(8 58 58)" />
|
|
<ellipse cx="76" cy="64" rx="2" ry="3.4" transform="rotate(24 76 64)" />
|
|
<ellipse cx="49" cy="77" rx="2" ry="3.4" transform="rotate(18 49 77)" />
|
|
<ellipse cx="68" cy="79" rx="2" ry="3.4" transform="rotate(-16 68 79)" />
|
|
<ellipse cx="84" cy="75" rx="1.8" ry="3.1" transform="rotate(30 84 75)" />
|
|
</g>
|
|
</g>
|
|
`,BP=L`
|
|
<path
|
|
class="lob-eclipse-corona"
|
|
d="M29 31 Q40 10 61 9 Q82 9 94 31"
|
|
fill="none"
|
|
stroke="#ffe9b8"
|
|
stroke-width="2.5"
|
|
stroke-linecap="round"
|
|
/>
|
|
`,VP=[{y:12,x:44,count:4},{y:20,x:36,count:6},{y:28,x:28,count:8},{y:36,x:20,count:10},{y:44,x:16,count:11},{y:52,x:16,count:11},{y:60,x:16,count:11},{y:68,x:20,count:10},{y:76,x:24,count:9},{y:84,x:32,count:7},{y:92,x:44,count:4}],HP=L`
|
|
<g class="lob-notexture" shape-rendering="crispEdges">
|
|
${VP.flatMap((e,t)=>Array.from({length:e.count},(n,r)=>L`<rect
|
|
x=${e.x+r*8}
|
|
y=${e.y}
|
|
width="8"
|
|
height="8"
|
|
fill=${(t+r)%2==0?`#ff00dc`:`#111111`}
|
|
/>`))}
|
|
</g>
|
|
`,UP=L`
|
|
<g class="lob-chimera-stitches" fill="none" stroke="#4a3f3a" stroke-width="1.8" stroke-linecap="round">
|
|
<path d="M18 47 L27 50 M19 51 L22 46 M23 53 L26 48" />
|
|
<path d="M93 50 L102 47 M94 48 L97 53 M98 46 L101 51" />
|
|
</g>
|
|
`})))()}function GP(e){let t=(Math.round(e)%8+8)%8;if(t===0)return L`<g class="lob-selene-moon"><circle cx="60" cy="64" r="12" fill="#26304a" /><circle cx="60" cy="64" r="11" fill="none" stroke="#f4f7fc" stroke-width="1" /></g>`;if(t===4)return L`<g class="lob-selene-moon"><circle cx="60" cy="64" r="12" fill="#26304a" /><circle cx="60" cy="64" r="11" fill="#f4f7fc" /></g>`;let n=t<4?[-5,-9,-14][t-1]:[14,9,5][t-5];return L`
|
|
<g class="lob-selene-moon">
|
|
<circle cx="60" cy="64" r="12" fill="#26304a" />
|
|
<circle cx="60" cy="64" r="11" fill="#f4f7fc" />
|
|
<circle cx=${60+(n??0)} cy="64" r="11" fill="#26304a" />
|
|
</g>
|
|
`}function KP(e,t){return L`
|
|
<g class="lob-pixel-frame" shape-rendering="crispEdges">
|
|
<g class="lob-pixel-antennae" fill="#d84c3e">
|
|
<rect x="30" y="0" width="6" height="6" /><rect x="36" y="6" width="6" height="6" /><rect x="42" y="12" width="6" height="6" />
|
|
<rect x="84" y="0" width="6" height="6" /><rect x="78" y="6" width="6" height="6" /><rect x="72" y="12" width="6" height="6" />
|
|
</g>
|
|
<g class="lob-pixel-claws">
|
|
<path d="M18 42 H6 V48 H0 V60 H6 V66 H18 V60 H24 V48 H18 Z M6 48 H12 V60 H6 Z" fill="#d84c3e" />
|
|
<rect x="6" y="60" width="12" height="6" fill="#a83428" />
|
|
<path d="M102 42 H114 V48 H120 V60 H114 V66 H102 V60 H96 V48 H102 Z M108 48 H114 V60 H108 Z" fill="#d84c3e" />
|
|
<rect x="102" y="60" width="12" height="6" fill="#a83428" />
|
|
</g>
|
|
<!-- Main cells keep the palette variable so offline and mood-style tinting still read. -->
|
|
<g class="lob-pixel-body" fill="var(--lob-shell, #d84c3e)">
|
|
<rect x="42" y="12" width="36" height="6" /><rect x="36" y="18" width="48" height="6" />
|
|
<rect x="30" y="24" width="60" height="6" /><rect x="24" y="30" width="72" height="48" />
|
|
<rect x="30" y="78" width="60" height="12" /><rect x="36" y="90" width="48" height="6" />
|
|
<rect x="36" y="96" width="12" height="9" /><rect x="72" y="96" width="12" height="9" />
|
|
</g>
|
|
<g fill="#ef8f6a"><rect x="36" y="24" width="24" height="6" /><rect x="30" y="30" width="18" height="12" /><rect x="24" y="42" width="12" height="12" /></g>
|
|
<g fill="#a83428"><rect x="30" y="78" width="60" height="12" /><rect x="36" y="90" width="48" height="6" /><rect x="36" y="96" width="12" height="9" /><rect x="72" y="96" width="12" height="9" /></g>
|
|
<g class="lob-eye-open" style=${e}>
|
|
<rect x="42" y="30" width="6" height="6" fill="#0a1014" /><rect x="72" y="30" width="6" height="6" fill="#0a1014" />
|
|
<rect x="42" y="30" width="2.5" height="2.5" fill="#fff" /><rect x="72" y="30" width="2.5" height="2.5" fill="#fff" />
|
|
</g>
|
|
<g class="lob-eye-closed" style=${t} fill="#0a1014"><rect x="42" y="33" width="6" height="3" /><rect x="72" y="33" width="6" height="3" /></g>
|
|
</g>
|
|
`}function qP(){return L`
|
|
<svg
|
|
class="lobster-pet__svg"
|
|
viewBox="0 0 120 105"
|
|
preserveAspectRatio="none"
|
|
aria-hidden="true"
|
|
>
|
|
<g stroke="#a63a2e" stroke-width="4" stroke-linecap="round" fill="none">
|
|
<path d="M22 78 L8 88" />
|
|
<path d="M28 88 L16 99" />
|
|
<path d="M98 78 L112 88" />
|
|
<path d="M92 88 L104 99" />
|
|
</g>
|
|
<g stroke="#c44536" stroke-width="3.5" stroke-linecap="round" fill="none">
|
|
<path d="M44 38 L40 24" />
|
|
<path d="M76 38 L80 24" />
|
|
</g>
|
|
<circle cx="40" cy="22" r="4.5" fill="#0a1014" />
|
|
<circle cx="80" cy="22" r="4.5" fill="#0a1014" />
|
|
<circle cx="41.5" cy="20.5" r="1.8" fill="#ffd166" />
|
|
<circle cx="81.5" cy="20.5" r="1.8" fill="#ffd166" />
|
|
<ellipse cx="60" cy="70" rx="46" ry="30" fill="#c44536" />
|
|
<ellipse cx="48" cy="60" rx="16" ry="9" fill="#ffffff" opacity="0.1" />
|
|
<path
|
|
d="M16 58 C2 52 -2 62 4 72 C10 82 20 76 24 66 C26 60 22 58 16 58 Z"
|
|
fill="#d95f4b"
|
|
/>
|
|
<path
|
|
d="M104 58 C118 52 122 62 116 72 C110 82 100 76 96 66 C94 60 98 58 104 58 Z"
|
|
fill="#d95f4b"
|
|
/>
|
|
<path d="M48 82 Q60 90 72 82" stroke="#7e2a20" stroke-width="3" stroke-linecap="round" fill="none" />
|
|
</svg>
|
|
`}function JP(){return L`
|
|
<svg
|
|
class="lobster-pet__svg"
|
|
viewBox="0 0 120 105"
|
|
preserveAspectRatio="none"
|
|
aria-hidden="true"
|
|
>
|
|
<path
|
|
d="M14 96 Q32 84 58 88 L96 88 Q110 90 112 97 Q112 103 102 103 L24 103 Q14 103 14 96 Z"
|
|
fill="#c9a06a"
|
|
/>
|
|
<g stroke="#c9a06a" stroke-width="3.5" stroke-linecap="round" fill="none">
|
|
<path d="M94 88 Q96 76 91 68" />
|
|
<path d="M103 88 Q107 76 103 66" />
|
|
</g>
|
|
<circle cx="90" cy="65" r="3.6" fill="#0a1014" />
|
|
<circle cx="103" cy="63" r="3.6" fill="#0a1014" />
|
|
<circle cx="91" cy="64" r="1.3" fill="#ffd166" />
|
|
<circle cx="104" cy="62" r="1.3" fill="#ffd166" />
|
|
<circle cx="50" cy="62" r="27" fill="#8a5a2b" />
|
|
<path
|
|
d="M50 41 a21 21 0 1 1 -15 36 a14 14 0 1 0 11 -25 a8 8 0 1 0 4 14"
|
|
stroke="#5f3d1c"
|
|
stroke-width="4"
|
|
stroke-linecap="round"
|
|
fill="none"
|
|
/>
|
|
</svg>
|
|
`}function YP(){return L`
|
|
<svg
|
|
class="lobster-pet__svg"
|
|
viewBox="0 0 120 105"
|
|
preserveAspectRatio="none"
|
|
aria-hidden="true"
|
|
>
|
|
<path d="M30 82 Q20 74 27 65 Q30 76 40 79 Z" fill="#f0b52e" />
|
|
<ellipse cx="58" cy="85" rx="34" ry="17" fill="#ffd23e" />
|
|
<circle cx="82" cy="50" r="18" fill="#ffd23e" />
|
|
<path d="M98 49 Q112 52 99 59 Q95 56 95 51 Z" fill="#ff8c2e" />
|
|
<circle cx="86" cy="44" r="3.6" fill="#0a1014" />
|
|
<circle cx="87" cy="43" r="1.3" fill="#ffffff" />
|
|
<path d="M44 82 Q58 72 72 82 Q58 93 44 82 Z" fill="#f0b52e" opacity="0.75" />
|
|
</svg>
|
|
`}function XP(){return L`
|
|
<svg
|
|
class="lobster-pet__svg"
|
|
viewBox="0 0 120 105"
|
|
preserveAspectRatio="none"
|
|
aria-hidden="true"
|
|
>
|
|
<g class="lob-jelly-tentacles" stroke="#9f7dfa" stroke-width="2.5" stroke-linecap="round" fill="none" opacity="0.8">
|
|
<path d="M40 58 Q35 74 42 90" />
|
|
<path d="M54 61 Q52 78 57 96" />
|
|
<path d="M68 61 Q71 78 64 94" />
|
|
<path d="M80 58 Q85 72 78 88" />
|
|
</g>
|
|
<path
|
|
d="M30 52 C30 22 90 22 90 52 L90 58 Q82 52 75 58 Q67 52 60 58 Q52 52 45 58 Q38 52 30 58 Z"
|
|
fill="#b79bff"
|
|
opacity="0.78"
|
|
/>
|
|
<ellipse cx="47" cy="37" rx="12" ry="6" fill="#ffffff" opacity="0.25" />
|
|
<circle cx="52" cy="45" r="2.6" fill="#0a1014" />
|
|
<circle cx="66" cy="45" r="2.6" fill="#0a1014" />
|
|
</svg>
|
|
`}function ZP(e){return L`
|
|
<svg class="lobster-bottle__svg" viewBox="0 0 48 44" aria-hidden="true">
|
|
<g transform="rotate(-16 24 30)">
|
|
<rect x="5" y="18" width="30" height="16" rx="7" fill="#7fc8b8" opacity="0.72" />
|
|
<rect x="33" y="22" width="9" height="8" rx="2.5" fill="#7fc8b8" opacity="0.72" />
|
|
${e?L`
|
|
<rect x="36" y="20" width="11" height="7" rx="1.5" fill="#f2e5c9" transform="rotate(-24 41 23)" />
|
|
<rect x="43" y="30" width="4.5" height="8" rx="1.6" fill="#8a5a2b" transform="rotate(38 45 34)" />
|
|
`:L`<rect x="41" y="21.5" width="5" height="9" rx="1.8" fill="#8a5a2b" />`}
|
|
<rect x="11" y="22" width="12" height="8" rx="1.5" fill="#f2e5c9" />
|
|
<path d="M13 24.5 L21 24.5 M13 27 L19 27" stroke="#b6a071" stroke-width="1" />
|
|
<ellipse cx="13" cy="20.5" rx="5" ry="2" fill="#ffffff" opacity="0.35" />
|
|
</g>
|
|
</svg>
|
|
`}var QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF;function NF(){return(NF=t((()=>{I(),WP(),QP={crown:L`
|
|
<path
|
|
d="M46 12 L46 2 L53 8 L60 0 L67 8 L74 2 L74 12 Q60 8 46 12 Z"
|
|
fill="#f6c945"
|
|
/>
|
|
`,sprout:L`
|
|
<g>
|
|
<path d="M60 12 Q58 4 63 1" stroke="#3f9d63" stroke-width="3" stroke-linecap="round" fill="none" />
|
|
<ellipse cx="67" cy="3" rx="5" ry="3" fill="#57c785" transform="rotate(-24 67 3)" />
|
|
</g>
|
|
`,patch:L`
|
|
<g>
|
|
<path d="M28 27 Q60 14 92 22" stroke="#101820" stroke-width="4" stroke-linecap="round" fill="none" />
|
|
<circle cx="75" cy="32" r="9" fill="#101820" />
|
|
</g>
|
|
`,santa:L`
|
|
<g>
|
|
<path d="M47 10 Q54 1 68 3 L72 9 Z" fill="#e0312f" />
|
|
<circle cx="71" cy="3.5" r="3.5" fill="#f5f7fa" />
|
|
<ellipse cx="59" cy="10.5" rx="15" ry="3.5" fill="#f5f7fa" />
|
|
</g>
|
|
`,pumpkin:L`
|
|
<g>
|
|
<ellipse cx="60" cy="6.5" rx="8.5" ry="5.5" fill="#e8871e" />
|
|
<path d="M56 2.5 Q56 6.5 56 10.5 M64 2.5 Q64 6.5 64 10.5" stroke="#c96a10" stroke-width="1.5" fill="none" />
|
|
<path d="M60 1.5 Q60.5 0 63 0.5" stroke="#4c9a4c" stroke-width="2.5" stroke-linecap="round" fill="none" />
|
|
</g>
|
|
`,party:L`
|
|
<g>
|
|
<path d="M52 11 L60 0.5 L68 11 Z" fill="#7c5cff" />
|
|
<path d="M55.5 6.5 L64.5 6.5" stroke="#ffd166" stroke-width="2" />
|
|
<circle cx="60" cy="1" r="2.4" fill="#ff5c8a" />
|
|
</g>
|
|
`,barnacle:L`
|
|
<g class="lob-barnacles">
|
|
<path d="M32 22 L36.5 13 L41 22 Z" fill="#cfd8de" />
|
|
<path d="M42 18 L45.5 11 L49 18 Z" fill="#b8c4cc" />
|
|
<path d="M27 26 L30 20.5 L33 26 Z" fill="#b8c4cc" />
|
|
<circle cx="36.5" cy="18.5" r="1.1" fill="#8a949d" />
|
|
<circle cx="45.5" cy="15" r="0.9" fill="#8a949d" />
|
|
</g>
|
|
`,monocle:L`
|
|
<g class="lob-monocle" fill="none" stroke="#f4b840">
|
|
<circle cx="75" cy="32" r="8.5" stroke-width="2.5" />
|
|
<path d="M81 39 Q85 48 80 56" stroke-width="1.5" />
|
|
</g>
|
|
`},$P=L`
|
|
<g class="lob-freckles" fill="#ffffff" opacity="0.3">
|
|
<circle cx="42" cy="45" r="1.6" />
|
|
<circle cx="50" cy="41" r="1.2" />
|
|
<circle cx="70" cy="45" r="1.6" />
|
|
<circle cx="78" cy="41" r="1.2" />
|
|
<circle cx="55" cy="62" r="1.4" />
|
|
<circle cx="67" cy="66" r="1.2" />
|
|
</g>
|
|
`,eF=L`
|
|
<g class="lob-lumen" fill="#7ef5dd">
|
|
<circle cx="36" cy="54" r="2.4" />
|
|
<circle cx="50" cy="66" r="2" />
|
|
<circle cx="66" cy="70" r="2.2" />
|
|
<circle cx="80" cy="60" r="2" />
|
|
<circle cx="88" cy="46" r="1.7" />
|
|
<circle cx="60" cy="86" r="1.7" />
|
|
</g>
|
|
`,tF=L`
|
|
<g class="lob-magma" fill="none" stroke="#ff6a3d" stroke-width="2" stroke-linecap="round">
|
|
<path d="M40 44 L48 54 L42 66 L50 78" />
|
|
<path d="M74 40 L68 52 L78 64" />
|
|
<path d="M56 82 L62 90" />
|
|
</g>
|
|
`,nF=L`
|
|
<g class="lob-oilsheen">
|
|
<ellipse cx="46" cy="60" rx="22" ry="11" fill="#7f77dd" opacity="0.3" transform="rotate(-14 46 60)" />
|
|
<ellipse cx="76" cy="74" rx="17" ry="8" fill="#1d9e75" opacity="0.28" transform="rotate(10 76 74)" />
|
|
</g>
|
|
`,rF=L`
|
|
<g class="lob-aurora" fill="none" stroke-linecap="round">
|
|
<path class="lob-aurora__band1" d="M24 62 Q48 48 70 58 T102 54" stroke="#4ecfa6" stroke-width="6" opacity="0.5" />
|
|
<path class="lob-aurora__band2" d="M28 76 Q54 62 78 72 T100 68" stroke="#a184ec" stroke-width="5" opacity="0.45" />
|
|
</g>
|
|
`,iF=L`
|
|
<g class="lob-nebula-stars">
|
|
<circle cx="38" cy="52" r="1" fill="#fff" />
|
|
<circle cx="52" cy="70" r="1.2" fill="#fff" />
|
|
<circle cx="84" cy="48" r="1.4" fill="#fff" />
|
|
<circle cx="66" cy="86" r="1" fill="#fff" />
|
|
<circle cx="72" cy="60" r="1.6" fill="#8be9fd" />
|
|
<circle cx="46" cy="40" r="1.4" fill="#ff9de2" />
|
|
<path class="lob-twinkle" d="M60 52 L61.5 55.5 L65 57 L61.5 58.5 L60 62 L58.5 58.5 L55 57 L58.5 55.5 Z" fill="#fff" />
|
|
</g>
|
|
`,aF=L`
|
|
<g class="lob-glass-glints" fill="none" stroke="#ffffff" stroke-width="2.5" stroke-linecap="round" opacity="0.7">
|
|
<path d="M34 22 L28 32" />
|
|
<path d="M40 16 L37 22" />
|
|
</g>
|
|
`,oF=L`
|
|
<g class="lob-geode-facets">
|
|
<polygon points="70,34 80,30 78,44" fill="#9b6ff0" />
|
|
<polygon points="82,46 94,42 88,58" fill="#b48ef0" />
|
|
<polygon points="72,58 84,62 74,74" fill="#7a4fd0" />
|
|
<polygon points="86,68 96,64 90,80" fill="#9b6ff0" />
|
|
<circle class="lob-twinkle" cx="90" cy="50" r="1.8" fill="#fff" />
|
|
</g>
|
|
`,sF=L`
|
|
<g class="lob-scanlines" stroke="#3fff7d" stroke-width="1" opacity="0.16">
|
|
<path d="M40 20 H80 M30 27 H90 M26 34 H94 M21 41 H99 M18 48 H102 M17 55 H103 M17 62 H103 M18 69 H102 M22 76 H98 M31 83 H89 M45 90 H75" />
|
|
</g>
|
|
`,cF=L`
|
|
<g class="lob-glitch-ghosts">
|
|
<path d="M60 8 C32 8 16 32 16 52 C16 72 30 90 44 95 L44 104 L54 104 L54 96 C58 97.5 62 97.5 66 96 L66 104 L76 104 L76 95 C90 90 104 72 104 52 C104 32 88 8 60 8 Z" transform="translate(-3 0)" fill="#ff3355" opacity="0.4" />
|
|
<path d="M60 8 C32 8 16 32 16 52 C16 72 30 90 44 95 L44 104 L54 104 L54 96 C58 97.5 62 97.5 66 96 L66 104 L76 104 L76 95 C90 90 104 72 104 52 C104 32 88 8 60 8 Z" transform="translate(3 1)" fill="#22d3ee" opacity="0.4" />
|
|
</g>
|
|
`,lF=L`
|
|
<g class="lob-blueprint" fill="none" stroke="#cfe3ff">
|
|
<path class="lob-bp-outline" d="M60 8 C32 8 16 32 16 52 C16 72 30 90 44 95 L44 104 L54 104 L54 96 C58 97.5 62 97.5 66 96 L66 104 L76 104 L76 95 C90 90 104 72 104 52 C104 32 88 8 60 8 Z" stroke-width="1.5" stroke-dasharray="5 3" />
|
|
<path d="M54 58 H66 M60 52 V64" stroke-width="1" opacity="0.7" />
|
|
<path d="M16 100 H104" stroke-width="1" stroke-dasharray="2 3" opacity="0.7" />
|
|
</g>
|
|
`,uF=L`
|
|
<g class="lob-mecha">
|
|
<g fill="none" stroke="#5f6a75" stroke-width="1.5">
|
|
<path d="M28 56 Q60 66 92 56" />
|
|
<path d="M34 74 Q60 82 86 74" />
|
|
</g>
|
|
<g fill="#5f6a75">
|
|
<circle cx="36" cy="61" r="1.4" />
|
|
<circle cx="60" cy="64" r="1.4" />
|
|
<circle cx="84" cy="61" r="1.4" />
|
|
</g>
|
|
<circle class="lob-led" cx="89" cy="7" r="3" fill="#ff4444" />
|
|
</g>
|
|
`,dF=new Set(`split.retro.lumen.magma.oilslick.aurora.nebula.glass.geode.phosphor.heisenbug.blueprint.clawtron.selene.pixel.banana.bee.rubberduck.watermelon.sourdough.zombie.plush.balloon.disco.cryptid.flatpack.tinfoil.actual.chimera.notexture.loading.eclipse.ascii.portal.invisible.goldenretro`.split(`.`)),fF=L`
|
|
<g fill="#8a6430">
|
|
<rect x="56" y="8" width="8" height="6" rx="2.5" />
|
|
<ellipse cx="60" cy="91" rx="6" ry="3.5" />
|
|
<circle cx="37" cy="48" r="2.5" />
|
|
<circle cx="79" cy="55" r="2" />
|
|
<circle cx="47" cy="70" r="1.8" />
|
|
<circle cx="72" cy="79" r="2.3" />
|
|
</g>
|
|
`,pF=L`
|
|
<g class="lob-bee-wings" fill="#ffffff" opacity="0.45">
|
|
<ellipse cx="38" cy="14" rx="8" ry="4.5" transform="rotate(-24 38 14)" />
|
|
<ellipse cx="82" cy="14" rx="8" ry="4.5" transform="rotate(24 82 14)" />
|
|
</g>
|
|
<g fill="#2b2b23" opacity="0.9">
|
|
<path d="M19 42 Q60 51 101 42 L103 50 Q60 60 17 50 Z" />
|
|
<path d="M17 58 Q60 67 103 58 L101 67 Q60 76 19 67 Z" />
|
|
<path d="M24 76 Q60 84 96 76 L90 85 Q60 92 30 85 Z" />
|
|
</g>
|
|
`,mF=L`
|
|
<g>
|
|
<ellipse cx="60" cy="71" rx="21" ry="14" fill="#ffffff" opacity="0.5" />
|
|
<rect x="47" y="41" width="26" height="8" rx="4" fill="#ff9a2e" />
|
|
<rect x="50" y="47" width="20" height="5" rx="2.5" fill="#e98322" />
|
|
</g>
|
|
`,hF=L`
|
|
<g fill="none" stroke="#a8763e" stroke-width="2.5" stroke-linecap="round">
|
|
<path d="M38 23 Q45 29 52 30" />
|
|
<path d="M52 17 Q59 24 66 25" />
|
|
<path d="M67 18 Q74 24 81 25" />
|
|
</g>
|
|
<g fill="#ffffff" opacity="0.5">
|
|
<circle cx="34" cy="39" r="1.2" /><circle cx="86" cy="38" r="1" />
|
|
<circle cx="45" cy="57" r="1.4" /><circle cx="74" cy="62" r="1.1" />
|
|
<circle cx="56" cy="78" r="1" /><circle cx="83" cy="75" r="1.3" />
|
|
</g>
|
|
`,gF=L`
|
|
<g fill="none" stroke="#5a6b52" stroke-width="2" stroke-linecap="round">
|
|
<path d="M32 24 Q47 19 61 23" />
|
|
<path d="M38 19 L40 26 M46 18 L47 25 M54 19 L53 26" />
|
|
<path d="M57 72 Q72 78 87 72" />
|
|
<path d="M65 72 L63 79 M73 73 L72 80 M81 71 L83 78" />
|
|
</g>
|
|
<ellipse cx="35" cy="61" rx="9" ry="6" fill="#86987a" opacity="0.8" transform="rotate(-18 35 61)" />
|
|
`,_F=L`
|
|
<g fill="none" stroke="#c97a5e" stroke-width="1.5" stroke-dasharray="3 3">
|
|
<path d="M30 32 Q60 4 90 32" />
|
|
<path d="M60 50 Q58 72 60 96" />
|
|
</g>
|
|
<g class="lob-plush-button">
|
|
<circle cx="78" cy="44" r="3.5" fill="#7a4a3a" />
|
|
<circle cx="76.8" cy="44" r="0.7" fill="#e8967a" />
|
|
<circle cx="79.2" cy="44" r="0.7" fill="#e8967a" />
|
|
</g>
|
|
`,vF=L`
|
|
<g class="lob-disco" fill="#ffffff">
|
|
<rect x="42" y="18" width="4" height="4" opacity="0.3" /><rect x="52" y="16" width="4" height="4" opacity="0.5" />
|
|
<rect x="63" y="17" width="4" height="4" opacity="0.25" /><rect x="74" y="20" width="4" height="4" opacity="0.4" />
|
|
<rect x="31" y="40" width="4" height="4" opacity="0.4" /><rect x="53" y="39" width="4" height="4" opacity="0.25" />
|
|
<rect x="65" y="42" width="4" height="4" opacity="0.5" /><rect x="86" y="40" width="4" height="4" opacity="0.3" />
|
|
<rect x="39" y="59" width="4" height="4" opacity="0.25" /><rect x="51" y="62" width="4" height="4" opacity="0.45" />
|
|
<rect x="68" y="60" width="4" height="4" opacity="0.3" /><rect x="80" y="58" width="4" height="4" opacity="0.5" />
|
|
<rect x="49" y="79" width="4" height="4" opacity="0.35" /><rect x="70" y="80" width="4" height="4" opacity="0.25" />
|
|
</g>
|
|
`,yF={lumen:eF,magma:tF,oilslick:nF,aurora:rF,nebula:iF,glass:aF,geode:oF,phosphor:sF,blueprint:lF,clawtron:uF,banana:fF,bee:pF,rubberduck:mF,sourdough:hF,zombie:gF,plush:_F,disco:vF,watermelon:zP,eclipse:BP,notexture:HP,chimera:UP},bF=L`
|
|
<path
|
|
class="lob-split-half"
|
|
d="M60 8 C88 8 104 32 104 52 C104 72 90 90 76 95 L76 104 L66 104 L66 96 C64 96.8 62 97.1 60 97.1 L60 8 Z"
|
|
fill="var(--lob-shell2, #46536b)"
|
|
/>
|
|
`,xF=L`
|
|
<path
|
|
d="M95 55 C112 53 119 39 116 25 C113 11 99 5 91 12 C88 15 87 19 88 23 C83 27 83 36 88 43 C91 49 93 52 95 55 Z"
|
|
fill="var(--lob-claw)"
|
|
/>
|
|
<path
|
|
d="M92 14 C97 22 99 31 95 41"
|
|
class="lob-retro-claw-line"
|
|
stroke="#b8151b"
|
|
stroke-width="3"
|
|
stroke-linecap="round"
|
|
fill="none"
|
|
/>
|
|
`,SF=L`
|
|
<g class="lob-antennae" stroke="var(--lob-shell)" stroke-width="4" stroke-linecap="round" fill="none">
|
|
<path d="M50 16 Q45 4 37 1" />
|
|
<path d="M70 16 Q75 4 83 1" />
|
|
</g>
|
|
`,CF=L`
|
|
<g stroke="#0a1014" stroke-linecap="round" fill="none">
|
|
<path d="M37 24 L51 28" stroke-width="3.5" />
|
|
<path d="M69 28 L83 24" stroke-width="3.5" />
|
|
<path d="M49 45 Q59 51 69 45 L72 42" stroke-width="3" />
|
|
</g>
|
|
`,wF=L`
|
|
<g class="lob-tail">
|
|
<ellipse cx="16" cy="84" rx="11" ry="7" transform="rotate(-32 16 84)" />
|
|
<ellipse cx="104" cy="84" rx="11" ry="7" transform="rotate(32 104 84)" />
|
|
</g>
|
|
`,TF=L`
|
|
<g class="lob-bindle">
|
|
<path d="M70 62 L99 30" stroke="#8a5a2b" stroke-width="3.5" stroke-linecap="round" />
|
|
<circle cx="101" cy="27" r="9.5" fill="#e8b04b" />
|
|
<circle cx="98" cy="24" r="1.6" fill="#b6791f" />
|
|
<circle cx="104" cy="29" r="1.6" fill="#b6791f" />
|
|
<circle cx="100" cy="32" r="1.3" fill="#b6791f" />
|
|
</g>
|
|
`,EF=new Set([`crown`,`sprout`,`santa`,`pumpkin`,`party`]),DF=L`
|
|
<g class="lob-cap">
|
|
<path d="M46 10 Q60 -3 74 10 L74 13 Q60 7 46 13 Z" fill="#f5f7fa" />
|
|
<path d="M45 12 Q60 6 75 12 L75 16 Q60 10.5 45 16 Z" fill="#dfe7ee" />
|
|
<circle cx="60" cy="2.5" r="1.8" fill="#3b6ea5" />
|
|
</g>
|
|
`,OF=L`
|
|
<g stroke="#0a1014" stroke-linecap="round" fill="none">
|
|
<path d="M37 24 L51 28" stroke-width="3.5" />
|
|
<path d="M69 28 L83 24" stroke-width="3.5" />
|
|
<path d="M50 48 Q60 42 70 48" stroke-width="3" />
|
|
</g>
|
|
`,kF={perky:L`
|
|
<g class="lob-antennae" stroke="var(--lob-shell)" stroke-width="4" stroke-linecap="round" fill="none">
|
|
<path d="M46 14 Q38 4 31 7" />
|
|
<path d="M74 14 Q82 4 89 7" />
|
|
</g>
|
|
`,droopy:L`
|
|
<g class="lob-antennae" stroke="var(--lob-shell)" stroke-width="4" stroke-linecap="round" fill="none">
|
|
<path d="M46 14 Q36 8 34 18" />
|
|
<path d="M74 14 Q84 8 86 18" />
|
|
</g>
|
|
`},AF={crab:qP,snail:JP,duck:YP,jellyfish:XP},jF=L`
|
|
<svg class="lobster-pet__balloon" viewBox="0 0 40 62" aria-hidden="true">
|
|
<path d="M20 34 Q23 46 18 60" stroke="#8a949d" stroke-width="1.5" fill="none" />
|
|
<ellipse cx="20" cy="16" rx="13" ry="15" fill="#ff5c8a" />
|
|
<path d="M17 30 L20 34.5 L23 30 Z" fill="#e0446f" />
|
|
<ellipse cx="15" cy="10" rx="4" ry="6" fill="#ffffff" opacity="0.3" />
|
|
</svg>
|
|
`,MF={stranger:`a stranger`,crab:`definitely a lobster`,snail:`in no particular hurry`,duck:`a duck. obviously`,jellyfish:`just drifting`}})))()}function PF(e){return{palette:e,scale:2,accessory:`none`,antennae:`perky`,side:`left`,spotPct:0,facing:1,personality:`friendly`,blinkDelayS:Rm(e.id)%36/10,build:`round`,clawSize:`regular`,tailFan:!1,shiny:!1,crusherSide:null,freckles:!1,glint:null,chimeraParts:e.id===`chimera`?AP:null}}function FF(e){return e.getMonth()===QF.month&&e.getDate()===QF.day}function IF(e){let t=e.getMonth(),n=e.getDate();return t===11?[[`santa`,18]]:t===9&&n>=20?[[`pumpkin`,18]]:t===8&&n===25?[[`monocle`,24]]:[]}function LF(e,t){let n=hP(e.palette.id);return n===e.palette.id?gP(t):n}function RF(e,t){for(let n=1;n<=24;n++){let r=HF(e+n*7919>>>0);if(r.palette.id!==t)return r}return HF(e+1>>>0)}function zF(e){let t=e>>>0;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function BF(e,t){let n=t.reduce((e,[,t])=>e+t,0),r=e()*n;for(let[e,n]of t)if(r-=n,r<=0)return e;return ne(t.at(-1),`weighted lobster choice fallback`)[0]}function VF(e,t,n){return t+e()*(n-t)}function HF(e,t=new Date){let n=zF(e),r=BF(n,DP),i=BF(n,eI),a=BF(n,[...ZF,...IF(t)]),o=n()<.6?`perky`:`droopy`,s=n()<.5?`left`:`right`,c=sI[s],l=Math.round(VF(n,c[0],c[1])),u=n()<.5?1:-1,d=BF(n,$F),f=Math.round(VF(n,0,4)*10)/10,p=BF(n,tI),m=BF(n,nI),h=n()<.3,g=n()<1/512,_=n(),v=n()<.5?`left`:`right`,y=_<.15?v:null,b=n()<.12,x=n(),S=aI[Math.floor(n()*aI.length)]??null,C=x<.3?S:null,ee=TP(n),te={palette:r,scale:i,accessory:a,antennae:o,side:s,spotPct:l,facing:u,personality:d,blinkDelayS:f,build:p,clawSize:m,tailFan:h,shiny:g,crusherSide:y,freckles:b,glint:C,chimeraParts:r.id===`chimera`?ee:null},w=r.id===`clawtron`?{...te,antennae:`perky`}:te;if(r.id===`zombie`&&(w={...te,antennae:`droopy`}),FF(t)){let e=DP.find(([e])=>e.id===`retro`)?.[0];return{...w,palette:e??r,accessory:`party`,chimeraParts:null}}return w}function UF(e,t={}){let n=e.palette.id===`pixel`,r=e.palette.id===`flatpack`,i=e.palette.id===`loading`,a=e.palette.id===`actual`,o=e.palette.id===`balloon`,s=e.palette.id===`ascii`,c=e.palette.id===`portal`,l=o||s||c,u=YF.has(e.palette.id),d=t.shell||t.sleeping&&!t.reading,f=d?`display:none`:``,p=d?`opacity:1`:t.standalone||t.reading?`display:none`:``,m=Math.round(xP(new Date)*8)%8;return L`
|
|
<svg
|
|
class="lobster-pet__svg"
|
|
viewBox="0 0 120 105"
|
|
preserveAspectRatio="none"
|
|
aria-hidden="true"
|
|
>
|
|
<g class=${XF[e.palette.id]??``}>
|
|
${r?MP(f,p):i?NP(f,p):a?PP(f,p):o?FP(f,p):s?IP(f,p):c?LP(f,p):n?KP(f,p):L`
|
|
${u?SF:kF[e.antennae]}
|
|
${e.tailFan?wF:P}
|
|
<g class="lob-claw lob-claw--l">
|
|
<path d="M20 42 C5 37 0 47 5 57 C10 67 20 62 25 52 C28 45 25 42 20 42 Z" fill="var(--lob-claw)" />
|
|
</g>
|
|
${u?P:L`<g class="lob-claw lob-claw--r"><path d="M100 42 C115 37 120 47 115 57 C110 67 100 62 95 52 C92 45 95 42 100 42 Z" fill="var(--lob-claw)" /></g>`}
|
|
${e.palette.id===`heisenbug`?cF:P}
|
|
<path class="lob-standard-dome" d="M60 8 C32 8 16 32 16 52 C16 72 30 90 44 95 L44 104 L54 104 L54 96 C58 97.5 62 97.5 66 96 L66 104 L76 104 L76 95 C90 90 104 72 104 52 C104 32 88 8 60 8 Z" fill="var(--lob-shell)" />
|
|
${e.palette.id===`split`||e.palette.id===`geode`?bF:P}
|
|
${e.palette.id===`selene`?GP(m):P}
|
|
${yF[e.palette.id]??P}
|
|
${e.palette.id===`tinfoil`?RP(!EF.has(e.accessory)):P}
|
|
${e.freckles&&!dF.has(e.palette.id)?$P:P}
|
|
${e.palette.id===`invisible`?P:L`<ellipse cx="48" cy="28" rx="20" ry="11" fill="#ffffff" opacity="0.1" />`}
|
|
<g class="lob-eye-open" style=${f}>
|
|
<circle cx="45" cy="32" r="5.5" fill="#0a1014" />
|
|
<circle cx="75" cy="32" r="5.5" fill="#0a1014" />
|
|
<circle cx="46.5" cy="30.5" r="2.2" fill="var(--lob-glint, #00e5cc)" />
|
|
<circle cx="76.5" cy="30.5" r="2.2" fill="var(--lob-glint, #00e5cc)" />
|
|
</g>
|
|
${t.sleeping&&!t.reading?L`<g class="lob-eye-peek"><circle cx="45" cy="32" r="4" fill="#0a1014" /><circle cx="46" cy="30.8" r="1.6" fill="var(--lob-glint, #00e5cc)" /></g>`:P}
|
|
<g class="lob-eye-closed" stroke="#0a1014" stroke-width="3" stroke-linecap="round" fill="none" style=${p}>
|
|
<path d="M39 33 Q45 28 51 33" /><path d="M69 33 Q75 28 81 33" />
|
|
</g>
|
|
`}
|
|
${u?L`
|
|
${CF}
|
|
<g class="lob-claw lob-claw--r">${xF}</g>
|
|
`:P}
|
|
${t.grumpy&&!u&&!r&&!i&&!a&&!l?OF:P}
|
|
${e.accessory===`none`||t.shell||r?P:QP[e.accessory]}
|
|
${t.bindle&&!u&&!r?TF:P}
|
|
${t.sailorCap&&!t.shell&&!r&&!EF.has(e.accessory)&&e.palette.id!==`tinfoil`?DF:P}
|
|
${t.reading?oI:P}
|
|
</g>
|
|
</svg>
|
|
`}function WF(e){let t=e.crusherSide,n=(Rm(e.palette.id)>>>8)%34/10,r=e.chimeraParts?EP(e.chimeraParts.body):void 0,i=n=>t===null?iI[e.clawSize]:t===n?iI.mighty:iI.dainty;return[`--lob-shell:${e.chimeraParts?.body??e.palette.shell}`,`--lob-claw:${r??e.palette.claw}`,`--lob-blink-delay:${e.blinkDelayS}s`,`--lob-breathe-delay:-${n}s`,`--lob-w:${rI[e.build].w}`,`--lob-h:${rI[e.build].h}`,`--lob-claw-l:${i(`left`)}`,`--lob-claw-r:${i(`right`)}`,...e.chimeraParts?[`--lob-chimera-l:${e.chimeraParts.clawLeft}`,`--lob-chimera-r:${e.chimeraParts.clawRight}`,`--lob-antennae-color:${e.chimeraParts.antennae}`]:[],...e.glint?[`--lob-glint-seed:${e.glint}`]:[]]}function GF(e){return WF(e).join(`;`)}function KF(e,t,n,r){return[...WF(e),`--lob-scale:${t}`,`--lob-x:${n}%`,`--lob-face:${r}`].join(`;`)}function qF(e){let t=t=>e.anchor===`bar`?Math.min(t,e.barMaxScale):t,n=n=>{let r=e.anniversary&&e.look.accessory!==`party`?{...e.look,accessory:`party`}:e.look,i=[`lobster-pet`,`lobster-pet--${e.mode}`,`lobster-pet--palette-${e.look.palette.id}`,n?`lobster-pet--twin`:``,r.accessory===`party`?`lobster-pet--party`:``,e.look.shiny?`lobster-pet--shiny`:``,e.elder?`lobster-pet--elder`:``,e.presence===`leaving`?`lobster-pet--away`:``,e.entering?`lobster-pet--entering`:``,e.entering&&e.entrance!==`walk`?`lobster-pet--enter-${e.entrance}`:``,e.grumpy?`lobster-pet--grumpy`:``,e.vigil?`lobster-pet--vigil`:``,e.act?`lobster-pet--act-${e.act}`:``].filter(Boolean).join(` `),a=n?Math.min(e.zone[1],Math.max(e.zone[0],e.spotPct+(e.facing===1?-12:12))):e.spotPct,o=t(n?e.look.scale*.55:e.look.scale),s=n?`${KF(e.look,o,a,e.facing===1?-1:1)};--lob-act-delay:0.18s`:KF(e.look,o,a,e.facing),c=nP(e.familiarityVisits),l=e.nameOverride??LF(e.look,e.seed),u=c?`${c} ${l}`:l,d=e.look.shiny?`✦ ${u}`:u,f=e.movingDay&&!n,p=n?`${d} Jr.`:f?`${d} · just moved in`:e.flavor?`${d} · ${e.flavor}`:d;return F`
|
|
<div
|
|
class=${i}
|
|
style=${s}
|
|
aria-hidden="true"
|
|
title=${p}
|
|
@pointerdown=${e.onPointerDown}
|
|
@pointerup=${e.onPointerUp}
|
|
@pointercancel=${e.onPointerCancel}
|
|
@pointerleave=${e.onPointerCancel}
|
|
@contextmenu=${e.onContextMenu}
|
|
>
|
|
<div class="lobster-pet__body">
|
|
${UF(r,{grumpy:e.grumpy,bindle:f,sailorCap:e.sailorDay})}
|
|
${e.entering&&e.entrance===`balloon`?jF:P}
|
|
${e.entering&&e.entrance===`bubble`?F`<span class="lobster-pet__entry-bubble"></span>`:P}
|
|
${e.look.shiny?F`
|
|
<span class="lobster-pet__sparkle" style="--i:0;left:12%;bottom:64%">✦</span>
|
|
<span class="lobster-pet__sparkle" style="--i:1;left:76%;bottom:82%">✦</span>
|
|
`:P}
|
|
<span class="lobster-pet__z" style="--i:0">z</span>
|
|
<span class="lobster-pet__z" style="--i:1">z</span>
|
|
<span class="lobster-pet__z" style="--i:2">Z</span>
|
|
<span class="lobster-pet__bubble" style="--i:0"></span>
|
|
<span class="lobster-pet__bubble" style="--i:1"></span>
|
|
<span class="lobster-pet__bubble" style="--i:2"></span>
|
|
<span class="lobster-pet__heart">♥</span>
|
|
<svg class="lobster-pet__broom" viewBox="0 0 24 40" aria-hidden="true">
|
|
<path d="M12 2 L12 24" stroke="#8a5a2b" stroke-width="3" stroke-linecap="round" />
|
|
<path d="M6 24 L18 24 L21 38 L3 38 Z" fill="#e8b04b" />
|
|
<path
|
|
d="M7.5 28 L6.5 36 M12 28 L12 36 M16.5 28 L17.5 36"
|
|
stroke="#b6791f"
|
|
stroke-width="1.5"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
`},r=e.presence!==`out`,i=e.shellVisible&&e.visitsEnabled&&!e.dismissed,a=e.passer!==null&&e.visitsEnabled,o=e.bottle!==null&&e.visitsEnabled&&!e.dismissed;if(!r&&!i&&!a&&!o)return P;let s=KF(e.look,t(e.shellScale),e.shellSpotPct,e.facing),c=e.passer?.kind===`stranger`?RF(e.seed,e.look.palette.id):e.look,l=e.passer?[`lobster-pet`,`lobster-pet--passer`,e.passer.kind===`stranger`?`lobster-pet--palette-${c.palette.id}`:`lobster-pet--${e.passer.kind}`,e.passer.kind===`stranger`&&c.shiny?`lobster-pet--shiny`:``,e.passer.direction===1?`lobster-pet--passer-ltr`:`lobster-pet--passer-rtl`].filter(Boolean).join(` `):``,u=e.passer?`${JF(e.passer.kind,e.passer.direction,c)};--lob-cross:${e.passer.crossMs}ms`:``;return F`
|
|
${i?F`
|
|
<div class="lobster-pet lobster-pet--shell" style=${s} aria-hidden="true">
|
|
<div class="lobster-pet__body">${UF(e.look,{shell:!0})}</div>
|
|
</div>
|
|
`:P}
|
|
${o&&e.bottle?F`
|
|
<div
|
|
class="lobster-bottle ${e.bottle.opened?`lobster-bottle--open`:``}"
|
|
style="--lob-x:${e.bottle.spotPct}%"
|
|
title=${e.bottle.opened?e.bottle.fortune:`a message in a bottle`}
|
|
aria-hidden="true"
|
|
@pointerdown=${e.onBottleOpen}
|
|
>
|
|
${ZP(e.bottle.opened)}
|
|
</div>
|
|
`:P}
|
|
${r?n(!1):P}
|
|
${r&&e.twinPlanned?n(!0):P}
|
|
${a&&e.passer?F`
|
|
<div
|
|
class=${l}
|
|
style=${u}
|
|
aria-hidden="true"
|
|
title=${MF[e.passer.kind]}
|
|
>
|
|
<div class="lobster-pet__body">
|
|
${e.passer.kind===`stranger`?UF(c,{standalone:!0}):AF[e.passer.kind]()}
|
|
</div>
|
|
</div>
|
|
`:P}
|
|
`}function JF(e,t,n){return e===`stranger`?KF(n,Math.min(n.scale,2),0,t):{crab:`--lob-scale:2;--lob-w:1;--lob-h:0.82;--lob-face:1`,snail:`--lob-scale:1.7;--lob-w:1;--lob-h:0.9;--lob-face:${t}`,duck:`--lob-scale:1.9;--lob-w:1;--lob-h:1;--lob-face:${t}`,jellyfish:`--lob-scale:1.7;--lob-w:0.9;--lob-h:1.1;--lob-face:1`}[e]}var YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI;function cI(){return(cI=t((()=>{c(),I(),lP(),bP(),wP(),jP(),WP(),NF(),YF=new Set([`retro`,`goldenretro`]),XF={heisenbug:`lob-heisenbug-frame`,cryptid:`lob-cryptid-frame`,balloon:`lob-balloon-frame`},ZF=[[`none`,62],[`sprout`,14],[`patch`,14],[`crown`,10]],QF={month:10,day:24},$F=[[`sleepy`,25],[`zoomy`,25],[`friendly`,25],[`showoff`,25]],eI=[[1.7,25],[2,55],[2.5,20]],tI=[[`round`,40],[`squat`,30],[`slender`,30]],nI=[[`regular`,55],[`dainty`,25],[`mighty`,20]],rI={round:{w:1,h:1},squat:{w:1.14,h:.94},slender:{w:.88,h:1.1}},iI={dainty:.85,regular:1,mighty:1.18},aI=[`#ffd166`,`#ff8ac2`,`#b79bff`],oI=L`
|
|
<g class="lob-reading-book" transform="translate(0 2)">
|
|
<path
|
|
d="M25 62 Q43 56 59 66 L59 92 Q43 82 25 86 Z M61 66 Q77 56 95 62 L95 86 Q77 82 61 92 Z"
|
|
fill="var(--lob-claw)"
|
|
stroke="color-mix(in srgb, var(--lob-claw) 72%, #0a1014)"
|
|
stroke-width="2.5"
|
|
stroke-linejoin="round"
|
|
/>
|
|
<path d="M29 62 Q44 58 59 68 L59 88 Q44 79 29 82 Z" fill="#fffaf0" />
|
|
<path d="M61 68 Q76 58 91 62 L91 82 Q76 79 61 88 Z" fill="#fffaf0" />
|
|
<path d="M60 67 L60 89" stroke="#d7cfc0" stroke-width="1.5" />
|
|
<g stroke="#b8b0a3" stroke-width="1.25" stroke-linecap="round" opacity="0.58">
|
|
<path d="M34 67 L51 71" /><path d="M34 72 L50 75" /><path d="M67 71 L85 67" />
|
|
<path d="M68 76 L85 72" /><path d="M70 80 L83 77" />
|
|
</g>
|
|
<path
|
|
class="lob-reading-book__page-glow"
|
|
d="M31 62 Q45 59 57 68 L57 72 Q44 65 31 67 Z"
|
|
fill="#ffffff"
|
|
opacity="0"
|
|
/>
|
|
</g>
|
|
`,sI={left:[12,38],right:[60,84]}})))()}function lI(e,t,n=new Date){return e===`busy`||e===`offline`?TI[e]:xI(n)?wI.sleepy:t?wI[t]:null}function uI(e){return e===`error`?`droop`:e===`aborted`?`startle`:`cheer`}function dI(e){return e<.06?`balloon`:e<.13?`bubble`:`walk`}function fI(e){return zF((e^12317)>>>0)()<.12}function pI(e){return zF((e^30485)>>>0)()<.04}function mI(e){let t=zF((e^3243)>>>0),n=t();return n>=.095?null:{kind:n<.015?`crab`:n<.027?`snail`:n<.039?`duck`:n<.05?`jellyfish`:`stranger`,atMs:Math.round(6e4+t()*84e4),direction:t()<.5?1:-1}}function hI(e){return zF((e^57811)>>>0)()<.015}function gI(e,t){if(t.length===0)return null;let n=zF((e^61982)>>>0);return n()>=.08?null:t[Math.floor(n()*t.length)]??null}function _I(e,t){let n=JN(),r={elder:!1,oldFriend:!1,friendName:null,dexComplete:OP.every(e=>n.has(e.id)),look:t};if(hI(e))return{...r,elder:!0,look:{...t,scale:3,accessory:`barnacle`,personality:`sleepy`,clawSize:`mighty`,crusherSide:null}};if(t.palette.id===`retro`||t.palette.id===`goldenretro`)return r;let i=gI(e,[...n].filter(e=>OP.some(t=>t.id===e)).toSorted()),a=i?OP.find(e=>e.id===i):void 0;return a?{...r,oldFriend:!0,friendName:YN().get(a.id)?.name??null,look:{...t,palette:a,chimeraParts:a.id===`chimera`?PF(a).chimeraParts:null}}:r}function vI(e,t){return e.elder?`Methuselah`:e.friendName??LF(e.look,t)}function yI(e){let t=zF((e^45175)>>>0);return t()>=.03?null:{atMs:Math.round(45e3+t()*855e3),spotPct:Math.round(15+t()*70),fortuneIndex:Math.floor(t()*NI.length)}}function bI(e){try{let t=A();if(!t)return!1;let n=t.getItem(PI);return n!==e&&(t.setItem(PI,e),n!==null)}catch{return!1}}function xI(e=new Date){let t=e.getHours();return t>=22||t<6}function SI(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI;function FI(){return(FI=t((()=>{lP(),cI(),jP(),CI={wave:1400,snip:1e3,hop:750,spin:950,peek:1700,nap:4400,bubble:2600,scuttle:1250,startle:750,cheer:1300,molt:2600,pet:1500,droop:1600,sweep:1800},wI={sleepy:{delayMs:[6e3,12e3],acts:[[`nap`,40],[`bubble`,20],[`wave`,12],[`scuttle`,12],[`peek`,10],[`hop`,6]]},zoomy:{delayMs:[2800,6e3],acts:[[`scuttle`,42],[`hop`,22],[`spin`,12],[`peek`,12],[`wave`,12]]},friendly:{delayMs:[3600,7500],acts:[[`wave`,32],[`snip`,22],[`scuttle`,18],[`hop`,14],[`bubble`,14]]},showoff:{delayMs:[3600,7500],acts:[[`spin`,24],[`snip`,22],[`peek`,20],[`hop`,18],[`wave`,16]]}},TI={busy:{delayMs:[2200,4500],acts:[[`scuttle`,40],[`hop`,20],[`snip`,20],[`wave`,12],[`spin`,8]]},offline:{delayMs:[2800,5600],acts:[[`scuttle`,55],[`peek`,30],[`hop`,15]]}},EI={walk:450,balloon:1250,bubble:700},DI={stranger:11e3,crab:11e3,snail:9e4,duck:14e3,jellyfish:16e3},OI=[18,50],kI=1.7,AI=[12e4,6e5],jI=[9e4,3e5],MI=[18e5,36e5],NI=[`the tide returns every branch to shore`,`molt before you feel ready`,`a shell is just armor you outgrew`,`somewhere, a test is green because of you`,`swim sideways when forward fails`,`the reef remembers kind commits`,`even the deep keeps a night light`,`barnacles are only patient passengers`,`no current lasts forever`,`bury your treasure in version control`,`the crab was a lobster all along`,`small claws, firm grip`,`rest is also progress`,`what washes away was never pinned`],PI=`openclaw.control.lobsterpet.gatewayVersion.v1`})))()}var II;function LI(){return(LI=t((()=>{c(),FI(),II=class{constructor(e,t){this.host=e,this.hooks=t,this.passer=null,this.bottlePlan=null,this.bottleVisible=!1,this.bottleOpened=!1,this.passerTimer=null,this.passerEndTimer=null,this.passerWatchTimer=null,this.bottleTimer=null,this.bottleEndTimer=null,this.openBottle=()=>{this.bottleOpened||!this.bottleVisible||(this.bottleOpened=!0,this.armBottleEbb(12e4),this.host.requestUpdate())},e.addController(this)}hostDisconnected(){this.clearTimers(),this.passer=null,this.bottleVisible=!1,this.host.requestUpdate()}reset(e){this.clearTimers(),this.passer=null,this.bottleVisible=!1,this.bottleOpened=!1,this.schedulePasser(e),this.scheduleBottle(e)}passerCrossMs(){return this.passer?DI[this.passer.kind]:0}bottle(){return!this.bottleVisible||!this.bottlePlan?null:{spotPct:this.bottlePlan.spotPct,opened:this.bottleOpened,fortune:ne(NI[this.bottlePlan.fortuneIndex],`lobster bottle fortune`)}}clearTimers(){for(let e of[this.passerTimer,this.passerEndTimer,this.passerWatchTimer,this.bottleTimer,this.bottleEndTimer])e!==null&&window.clearTimeout(e);this.passerTimer=null,this.passerEndTimer=null,this.passerWatchTimer=null,this.bottleTimer=null,this.bottleEndTimer=null}schedulePasser(e){let t=mI(e);!t||SI()||(this.passerTimer=window.setTimeout(()=>{if(this.passerTimer=null,!this.hooks.visitsEnabled()||document.hidden)return;this.passer=t,this.host.requestUpdate();let e=DI[t.kind];this.hooks.onPasserFacing(t.direction===1?-1:1),this.passerWatchTimer=window.setTimeout(()=>{this.passerWatchTimer=null,this.hooks.onPasserFacing(t.direction),this.hooks.onPasserMidCross()},e/2),this.passerEndTimer=window.setTimeout(()=>{this.passerEndTimer=null,this.passer=null,this.host.requestUpdate(),this.hooks.onPasserDone()},e)},t.atMs))}scheduleBottle(e){this.bottlePlan=yI(e),this.bottlePlan&&(this.bottleTimer=window.setTimeout(()=>{this.bottleTimer=null,this.bottleVisible=!0,this.host.requestUpdate(),this.armBottleEbb(3e5)},this.bottlePlan.atMs))}armBottleEbb(e){this.bottleEndTimer!==null&&window.clearTimeout(this.bottleEndTimer),this.bottleEndTimer=window.setTimeout(()=>{this.bottleEndTimer=null,this.bottleVisible=!1,this.host.requestUpdate()},e)}}})))()}var $;function RI(){return(RI=t((()=>{c(),I(),R(),Zn(),lP(),hC(),mP(),cI(),FI(),LI(),$=class extends s{constructor(...e){super(...e),this.seed=0,this.mode=`idle`,this.visitsEnabled=!0,this.runOutcome=`ok`,this.soundsEnabled=!1,this.gatewayVersion=null,this.onVisitsDisabled=()=>void 0,this.act=null,this.spotPct=80,this.facing=1,this.entering=!1,this.entrance=`walk`,this.presence=`out`,this.anchor=`ledge`,this.scheduledVisiting=!1,this.dismissed=!1,this.dismissMenuPosition=null,this.grumpy=!1,this.vigil=!1,this.outcomePresenceOwner=null,this.movingDay=!1,this.movingDayChecked=!1,this.anniversary=!1,this.sailorDay=!1,this.identity=null,this.entranceRng=zF(0),this.traffic=new II(this,{visitsEnabled:()=>this.visitsEnabled,onPasserFacing:e=>this.watchTraffic(e),onPasserMidCross:()=>this.reactToPasser(),onPasserDone:()=>this.scheduleNextAct()}),this.shellVisible=!1,this.shellSpotPct=50,this.shellScale=2,this.molted=!1,this.moltPlanned=!1,this.twinPlanned=!1,this.shellTimer=null,this.familiarity={tier:`regular`,wary:!1,visits:0,shoos:0},this.greetedThisLoad=!1,this.look=null,this.rng=zF(0),this.visitRng=zF(0),this.idleTimer=null,this.actEndTimer=null,this.enterTimer=null,this.visitTimer=null,this.leaveTimer=null,this.grumpyTimer=null,this.vigilTimer=null,this.holdTimer=null,this.holdPetted=!1,this.audioCtx=null,this.pokeTimes=[],this.lastGazeAt=0,this.restartPending=!1,this.handleVisibilityChange=()=>{document.hidden?(this.outcomePresenceOwner=null,this.clearActTimers(),this.act=null):this.scheduleNextAct()},this.handleHoldStart=e=>{e.button!==0||SI()||(this.holdPetted=!1,this.holdTimer!==null&&window.clearTimeout(this.holdTimer),this.holdTimer=window.setTimeout(()=>{this.holdTimer=null,this.holdPetted=!0,this.grumpy=!1,this.playChirp(`pet`),this.performAct(`pet`)},600))},this.handleHoldEnd=e=>{e.button===0&&(this.holdTimer!==null&&(window.clearTimeout(this.holdTimer),this.holdTimer=null,this.holdPetted||this.pokeNow()),this.holdPetted=!1)},this.handleHoldCancel=()=>{this.holdTimer!==null&&(window.clearTimeout(this.holdTimer),this.holdTimer=null),this.holdPetted=!1},this.handleGaze=e=>{if(this.presence!==`in`||this.act!==null||this.vigil||SI())return;let t=Date.now();if(t-this.lastGazeAt<120)return;this.lastGazeAt=t;let n=this.querySelector(`.lobster-pet:not(.lobster-pet--shell)`);if(!n)return;let r=n.getBoundingClientRect(),i=r.left+r.width/2,a=e.clientX<i?-1:1;a!==this.facing&&(this.facing=a)},this.openDismissMenu=e=>{e.preventDefault(),e.stopPropagation(),this.handleHoldCancel(),this.dismissMenuPosition={x:e.clientX,y:e.clientY}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),document.addEventListener(`visibilitychange`,this.handleVisibilityChange),document.addEventListener(`pointermove`,this.handleGaze,{passive:!0})}disconnectedCallback(){document.removeEventListener(`visibilitychange`,this.handleVisibilityChange),this.clearActTimers(),this.clearVisitTimers(),this.grumpyTimer!==null&&(window.clearTimeout(this.grumpyTimer),this.grumpyTimer=null),this.shellTimer!==null&&(window.clearTimeout(this.shellTimer),this.shellTimer=null);for(let e of[this.vigilTimer,this.holdTimer])e!==null&&window.clearTimeout(e);this.vigilTimer=null,this.holdTimer=null,this.audioCtx&&=(this.audioCtx.close().catch(()=>{}),null),document.removeEventListener(`pointermove`,this.handleGaze),super.disconnectedCallback()}wantsVisible(){return this.visitsEnabled&&!this.dismissed&&(this.mode===`offline`||this.vigil||this.outcomePresenceOwner!==null||this.scheduledVisiting)}willUpdate(e){if(this.look===null||e.has(`seed`))this.look=HF(this.seed),this.rng=zF(this.seed^2654435769),this.visitRng=zF(this.seed^99282957),this.entranceRng=zF((this.seed^57978)>>>0),this.identity=_I(this.seed,this.look),this.look=this.identity.look,this.spotPct=this.look.spotPct,this.facing=this.look.facing,this.clearActTimers(),this.act=null,this.dismissed=!1,this.dismissMenuPosition=null,this.presence=`out`,this.molted=!1,this.shellVisible=!1,this.shellTimer!==null&&(window.clearTimeout(this.shellTimer),this.shellTimer=null),this.moltPlanned=fI(this.seed)&&!this.identity.elder,this.twinPlanned=pI(this.seed),this.familiarity=tP(),this.sailorDay=Wo(new Date),this.greetedThisLoad=!1,this.scheduleVisits(),this.traffic.reset(this.seed),this.vigil=!1,this.outcomePresenceOwner=null,this.trackVigil();else if(e.has(`mode`)){let t=e.get(`mode`)===`busy`&&this.mode===`idle`,n=t&&this.vigil?`vigil`:null;if(this.trackVigil(),this.presence===`in`&&!SI()){let e=uI(this.runOutcome);this.performAct(t?e:`startle`,n)}}e.has(`visitsEnabled`)&&(this.visitsEnabled?e.get(`visitsEnabled`)===!1&&(this.dismissed=!1):this.dismissMenuPosition=null),!this.movingDayChecked&&this.gatewayVersion&&(this.movingDayChecked=!0,this.movingDay=bI(this.gatewayVersion)),this.toggleAttribute(`data-dex-complete`,(this.identity?.dexComplete??!1)&&this.visitsEnabled&&!this.dismissed),this.reconcilePresence()}reconcilePresence(){let e=this.wantsVisible();if(e&&this.presence!==`in`){this.leaveTimer!==null&&(window.clearTimeout(this.leaveTimer),this.leaveTimer=null),this.presence===`out`&&(this.rollPerch(),this.entrance=dI(this.entranceRng()),this.look&&(this.anniversary=rP(YN().get(this.look.palette.id)?.firstSeenAt??null,new Date),XN(this.look.palette.id,{name:this.identity?vI(this.identity,this.seed):LF(this.look,this.seed),shiny:this.look.shiny}),$N())),this.presence=`in`,this.entering=!SI(),this.restartPending=!0;return}!e&&this.presence===`in`&&(this.dismissMenuPosition=null,this.outcomePresenceOwner=null,this.clearActTimers(),this.act=null,this.entering=!1,this.presence=`leaving`,this.leaveTimer=window.setTimeout(()=>{this.leaveTimer=null,this.presence=`out`},350))}updated(){this.restartPending&&(this.restartPending=!1,this.enterTimer=window.setTimeout(()=>{this.enterTimer=null,this.entering=!1,!this.greetedThisLoad&&(this.familiarity.tier===`friend`||this.identity?.oldFriend===!0)&&this.presence===`in`&&!SI()&&(this.greetedThisLoad=!0,this.performAct(`wave`))},EI[this.entrance]),this.scheduleNextAct())}playChirp(e){this.audioCtx=uP(this.audioCtx,this.soundsEnabled,e)}pokeNow(){this.playChirp(`poke`);let e=Date.now();if(this.pokeTimes=[...this.pokeTimes.filter(t=>e-t<6e3),e],this.pokeTimes.length>=10&&this.mode!==`offline`){this.huffOff();return}this.pokeTimes.length>=3&&this.enterGrumpy(),this.performAct(`startle`)}enterGrumpy(){this.grumpy=!0,this.grumpyTimer!==null&&window.clearTimeout(this.grumpyTimer),this.grumpyTimer=window.setTimeout(()=>{this.grumpyTimer=null,this.grumpy=!1},6e4)}huffOff(){this.pokeTimes=[],this.grumpy=!1,this.clearVisitTimers(),this.scheduledVisiting=!1,this.armArrival(VF(this.visitRng,MI[0],MI[1]))}trackVigil(){this.vigilTimer!==null&&(window.clearTimeout(this.vigilTimer),this.vigilTimer=null),this.mode===`busy`?this.vigilTimer=window.setTimeout(()=>{this.vigilTimer=null,this.vigil=!0,this.clearActTimers(),this.act=null},6e5):this.vigil=!1}dismiss(e){this.dismissMenuPosition=null,this.dismissed=!0,eP(),e&&(this.visitsEnabled=!1,Cr({lobsterPetVisits:!1}),this.onVisitsDisabled())}clearActTimers(){for(let e of[this.idleTimer,this.actEndTimer,this.enterTimer])e!==null&&window.clearTimeout(e);this.idleTimer=null,this.actEndTimer=null,this.enterTimer=null}clearVisitTimers(){for(let e of[this.visitTimer,this.leaveTimer])e!==null&&window.clearTimeout(e);this.visitTimer=null,this.leaveTimer=null}scheduleVisits(){if(this.clearVisitTimers(),this.scheduledVisiting=!1,this.visitRng()<.5)return;let e=oP[this.familiarity.tier];this.armArrival(VF(this.visitRng,AI[0],AI[1])*e.firstDelayMul)}armArrival(e){this.visitTimer=window.setTimeout(()=>{this.visitTimer=null,this.rollPerch(),this.scheduledVisiting=!0,this.armDeparture(VF(this.visitRng,jI[0],jI[1])*oP[this.familiarity.tier].stayMul)},e)}armDeparture(e){this.visitTimer=window.setTimeout(()=>{this.visitTimer=null,this.scheduledVisiting=!1;let e=oP[this.familiarity.tier],t=this.familiarity.wary?oP.waryGapMul:1;this.armArrival(VF(this.visitRng,MI[0],MI[1])*e.gapMul*t)},e)}watchTraffic(e){this.presence===`in`&&this.act!==`scuttle`&&!this.vigil&&(this.facing=e)}reactToPasser(){let e=this.familiarity.tier===`friend`?`wave`:this.familiarity.tier===`shy`?`peek`:null;e===null||this.presence!==`in`||this.act!==null||this.vigil||this.mode!==`idle`||SI()||this.performAct(e)}rollPerch(){this.anchor=this.visitRng()<.6?`ledge`:`bar`,this.setAttribute(`data-spot`,this.anchor);let e=this.currentZone();this.spotPct=Math.round(VF(this.visitRng,e[0],e[1])),this.facing=this.visitRng()<.5?1:-1}currentZone(){if(this.anchor===`bar`)return OI;let e=this.look?.side??`right`;return sI[e]}scheduleNextAct(){if(!this.look||this.presence!==`in`||this.vigil||this.traffic.passer!==null||this.idleTimer!==null||this.actEndTimer!==null||SI())return;let e=lI(this.mode,this.look.personality);if(!e)return;let t=VF(this.rng,e.delayMs[0],e.delayMs[1]);this.idleTimer=window.setTimeout(()=>{this.idleTimer=null;let e=lI(this.mode,this.look?.personality??null);if(!(!e||document.hidden||this.presence!==`in`||this.traffic.passer!==null)){if(this.moltPlanned&&!this.molted&&this.mode===`idle`){this.performAct(`molt`);return}this.performAct(BF(this.rng,e.acts))}},t)}performAct(e,t=null){this.clearActTimers(),this.outcomePresenceOwner=t,this.entering=!1,e===`scuttle`&&this.startScuttle(),this.act=e,this.actEndTimer=window.setTimeout(()=>{if(this.actEndTimer=null,this.act=null,e===`molt`&&this.completeMolt(),e===`droop`){this.performAct(`sweep`,t);return}this.outcomePresenceOwner=null,this.wantsVisible()&&this.scheduleNextAct()},CI[e])}completeMolt(){if(this.molted=!0,this.look){let e=[1.7,2,2.5],t=e.indexOf(this.look.scale);this.shellScale=this.look.scale,this.look={...this.look,scale:ne(e[Math.min(t+1,e.length-1)],`lobster molt size tier`)}}this.shellSpotPct=this.spotPct,this.shellVisible=!0;let e=this.currentZone();this.spotPct=Math.min(e[1],Math.max(e[0],this.spotPct+(this.facing===1?9:-9))),this.shellTimer!==null&&window.clearTimeout(this.shellTimer),this.shellTimer=window.setTimeout(()=>{this.shellTimer=null,this.shellVisible=!1},6e4)}startScuttle(){if(!this.look)return;let e=this.currentZone(),t=Math.round(VF(this.rng,e[0],e[1]));Math.abs(t-this.spotPct)<4&&(t=Math.abs(e[0]-this.spotPct)>Math.abs(e[1]-this.spotPct)?e[0]:e[1]),this.facing=t<this.spotPct?-1:1,this.spotPct=t}render(){let e=this.look;if(!e)return P;let t=this.identity,n=t?.elder?`old as the tides`:t?.oldFriend?`an old friend`:null;return[qF({look:e,mode:this.mode,presence:this.presence,shellVisible:this.shellVisible,visitsEnabled:this.visitsEnabled,dismissed:this.dismissed,passer:this.traffic.passer?{kind:this.traffic.passer.kind,direction:this.traffic.passer.direction,crossMs:this.traffic.passerCrossMs()}:null,twinPlanned:this.twinPlanned,anniversary:this.anniversary,entering:this.entering,entrance:this.entrance,grumpy:this.grumpy,vigil:this.vigil,elder:t?.elder??!1,act:this.act,zone:this.currentZone(),spotPct:this.spotPct,facing:this.facing,anchor:this.anchor,barMaxScale:kI,shellScale:this.shellScale,shellSpotPct:this.shellSpotPct,familiarityVisits:this.familiarity.visits,seed:this.seed,movingDay:this.movingDay,sailorDay:this.sailorDay,nameOverride:t?vI(t,this.seed):null,flavor:n,bottle:this.traffic.bottle(),onPointerDown:this.handleHoldStart,onPointerUp:this.handleHoldEnd,onPointerCancel:this.handleHoldCancel,onContextMenu:this.openDismissMenu,onBottleOpen:this.traffic.openBottle}),pP({position:this.dismissMenuPosition,onDismiss:e=>this.dismiss(e),onClose:()=>{this.dismissMenuPosition=null}})]}},S([z({attribute:!1})],$.prototype,`seed`,void 0),S([z({attribute:!1})],$.prototype,`mode`,void 0),S([z({attribute:!1})],$.prototype,`visitsEnabled`,void 0),S([z({attribute:!1})],$.prototype,`runOutcome`,void 0),S([z({attribute:!1})],$.prototype,`soundsEnabled`,void 0),S([z({attribute:!1})],$.prototype,`gatewayVersion`,void 0),S([z({attribute:!1})],$.prototype,`onVisitsDisabled`,void 0),S([B()],$.prototype,`act`,void 0),S([B()],$.prototype,`spotPct`,void 0),S([B()],$.prototype,`facing`,void 0),S([B()],$.prototype,`entering`,void 0),S([B()],$.prototype,`entrance`,void 0),S([B()],$.prototype,`presence`,void 0),S([B()],$.prototype,`anchor`,void 0),S([B()],$.prototype,`scheduledVisiting`,void 0),S([B()],$.prototype,`dismissed`,void 0),S([B()],$.prototype,`dismissMenuPosition`,void 0),S([B()],$.prototype,`grumpy`,void 0),S([B()],$.prototype,`vigil`,void 0),S([B()],$.prototype,`outcomePresenceOwner`,void 0),S([B()],$.prototype,`movingDay`,void 0),S([B()],$.prototype,`anniversary`,void 0),S([B()],$.prototype,`shellVisible`,void 0),customElements.get(`openclaw-lobster-pet`)||customElements.define(`openclaw-lobster-pet`,$)})))()}function zI(e){for(let t of e)for(let e of t.addedNodes)if(e instanceof Element&&(e.matches(`a.markdown-session-link[data-session-key]`)||e.querySelector(`a.markdown-session-link[data-session-key]`))){UI.define();return}}async function BI(e,t){if(t===`pointer`&&(e instanceof PointerEvent&&e.pointerType===`touch`||!globalThis.matchMedia?.(`(hover: hover)`).matches))return;let n=bC(e);if(!n||!UI.providerFor(n))return;await UI.define();let r=e.target;!(r instanceof EventTarget)||!n.isConnected||!Oi(n,t,!0)||r.dispatchEvent(new Event(t===`pointer`?`pointerover`:`focusin`,{bubbles:!0,composed:!0}))}var VI,HI,UI;function WI(){return(WI=t((()=>{xi(),EC(),f(),VI=`openclaw-session-progress-hovercard-provider`,HI=null,UI=new wi({tag:VI,load:async()=>(await d(async()=>{let{SessionProgressHovercardProvider:e}=await import(`./session-progress-hovercard.runtime-C62MSXJB.js`);return{SessionProgressHovercardProvider:e}},__vite__mapDeps([42,1,3,2,4,5,6,7,8,22,23,24,25,26,27,28,29,30,31,32,33,34,35,41]),import.meta.url)).SessionProgressHovercardProvider,snapshot:e=>({client:e.client??null,context:e.context??null,gateway:e.gateway??null}),restore:(e,t)=>{delete e.client,delete e.context,delete e.gateway,e.client=t.client,e.context=t.context,e.gateway=t.gateway},onDefined:()=>{HI?.disconnect(),HI=null}}),UI.install(BI),customElements.get(VI)||(HI=new MutationObserver(zI),HI.observe(document,{childList:!0,subtree:!0}),document.querySelector(`a.markdown-session-link[data-session-key]`)&&UI.define())})))()}function GI(e){return!T(e)||typeof e.step!=`string`||e.status!==`pending`&&e.status!==`in_progress`&&e.status!==`completed`?null:{status:e.status,step:e.step}}function KI(e,t){if(!T(e))throw Error(`Progress card response was invalid`);let n=e.card;if(n===null)return null;if(!T(n))throw Error(`Progress card response was invalid`);let r=n.markdown,i=n.revision,a=ee(n.updatedAt),o=n.steps;if(n.sessionKey!==t||r!==void 0&&typeof r!=`string`||o!==void 0&&!Array.isArray(o)||typeof i!=`number`||!Number.isInteger(i)||i<1||a===void 0||!Number.isInteger(a))throw Error(`Progress card response did not match the requested session`);let s=Array.isArray(o)?o.map(GI):void 0;if(s?.some(e=>e===null))throw Error(`Progress card response contained invalid steps`);let c=s?.filter(e=>e!==null);if(r===void 0&&(!c||c.length===0))throw Error(`Progress card response contained no content`);return{sessionKey:t,revision:i,updatedAt:a,...r===void 0?{}:{markdown:r},...c&&c.length>0?{steps:c}:{}}}function qI(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Set,s=e.snapshot.client,c=!1,l=null,u=null,d=()=>{for(let e of o)e()},f=()=>new Set(Array.from(t.values()).flatMap(e=>Array.from(e))),p=(e,t)=>{for(n.delete(e),n.set(e,t);n.size>QI;){let e=f(),t=[...n.keys()].find(t=>!e.has(t));if(t===void 0)break;n.delete(t)}},m=()=>e.snapshot.phase===`connected`&&e.snapshot.client!==null&&Na(e.snapshot,YI)===!0,h=async t=>{let o=t.trim();if(!o||!m())return null;let s=n.get(o);if(s)return p(o,s),s.card;let c=i.get(o);if(c)return c;let l=e.snapshot.client;if(!l)return null;r.delete(o)&&d();let u=a.get(o)??0,f=l,h=l.request(YI,{sessionKey:o}).then(t=>{let n=KI(t,o);return(a.get(o)??0)!==u||e.snapshot.client!==f?null:(p(o,{card:n,revision:n?.revision??null}),d(),n)}).catch(t=>{if((a.get(o)??0)===u&&e.snapshot.client===f){let e=t instanceof Jn&&T(t.details)&&t.details.code===`SESSION_PARTICIPATION_REQUIRED`;r.set(o,e?`access-denied`:`unavailable`),d()}throw t}).finally(()=>{i.get(o)===h&&i.delete(o)});return i.set(o,h),h},g=()=>{for(let e of f())h(e).catch(()=>void 0)},_=e=>{let t=e.client!==s,o=m(),l=o&&!c;if(c=o,!(!t&&!l)){if(t){s=e.client;for(let e of i.keys())a.set(e,(a.get(e)??0)+1);n.clear(),r.clear(),i.clear(),d()}g()}},v=e=>{if(e.event!==ZI||!T(e.payload))return;let t=e.payload.sessionKey,o=e.payload.revision;if(!(typeof t!=`string`||o!==null&&(typeof o!=`number`||!Number.isInteger(o)))&&n.get(t)?.revision!==o){if(o===null){a.set(t,(a.get(t)??0)+1),r.delete(t),p(t,{card:null,revision:null}),d();return}if(a.set(t,(a.get(t)??0)+1),n.delete(t),r.delete(t),f().has(t)){let e=i.get(t);e?e.finally(()=>void h(t).catch(()=>void 0)).catch(()=>void 0):h(t).catch(()=>void 0)}}},y=()=>{l||u||(c=m(),l=e.subscribe(_),u=e.subscribeEvents(v))},b=()=>{t.size>0||o.size>0||(l?.(),u?.(),l=null,u=null,i.clear())},x=(e,n)=>{let r=new Set(n.map(e=>e.trim()).filter(Boolean));if(r.size===0){t.delete(e),b();return}t.set(e,r),y();for(let e of r)h(e).catch(()=>void 0)};return{watch:x,unwatch:e=>x(e,[]),load:h,dismiss:async t=>{let r=e.snapshot.client;if(!r)return!1;let i=KI(await r.request(XI,{sessionKey:t.sessionKey,expectedRevision:t.revision}),t.sessionKey),a=i===null;return a&&n.get(t.sessionKey)?.revision===t.revision?(p(t.sessionKey,{card:null,revision:null}),d()):i&&(p(t.sessionKey,{card:i,revision:i.revision}),d()),a},get:e=>n.get(e)?.card,getError:e=>r.get(e),subscribe:e=>(o.add(e),y(),()=>{o.delete(e),b()})}}function JI(e){let t=$I.get(e);if(t)return t;let n=qI(e);return $I.set(e,n),n}var YI,XI,ZI,QI,$I;function eL(){return(eL=t((()=>{ue(),Mr(),Fa(),YI=`progressCard.get`,XI=`progressCard.put`,ZI=`progressCard.changed`,QI=100,$I=new WeakMap})))()}function tL(e,t,n){!(e instanceof HTMLDetailsElement)||gL.get(e)===t||(e.open=n,gL.set(e,t))}function nL(e){let t=e.steps;return t?.length?{completed:t.filter(e=>e.status===`completed`).length,total:t.length}:null}function rL(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)??e.findLast(e=>e.status===`completed`)}function iL(e,t){if(e===`in_progress`&&t===`done`)return H.check;if(e===`in_progress`&&(t===`failed`||t===`timeout`||t===`killed`))return H.circleX;switch(e){case`completed`:return H.check;case`in_progress`:return F`<span class="session-run-spinner"></span>`;case`paused`:case`pending`:return H.clock}return e}function aL(e){let t=rL(e),n=t?e.indexOf(t):-1;return Math.max(1,n+1)}function oL(e){return e?F`<div class="session-progress-card__markdown sidebar-markdown">
|
|
${zn(Rk(e,{progressBars:!0}))}
|
|
</div>`:P}function sL(e,t,n){let r=e.steps;return r?.length?F`<ol class="session-progress-card__steps">
|
|
${r.map(e=>{let r=e.status===`in_progress`&&n?pL[n]:void 0,i=e.status===`in_progress`&&!t&&!r?`paused`:e.status,a=W(r??(i===`paused`?`sessionProgressCard.status.paused`:uL[i]));return F`<li
|
|
class="session-progress-card__step session-progress-card__step--${i}"
|
|
aria-label=${W(`sessionProgressCard.stepLabel`,{status:a,step:e.step})}
|
|
>
|
|
<span
|
|
class="session-progress-card__step-marker"
|
|
data-status=${i}
|
|
data-outcome=${r?n:P}
|
|
aria-hidden="true"
|
|
>${iL(i,n)}</span
|
|
>
|
|
<span class="session-progress-card__step-text">${e.step}</span>
|
|
</li>`})}
|
|
</ol>`:P}function cL(e,t,n){return F`<div class="session-progress-card__body">
|
|
${oL(e.markdown)} ${sL(e,t,n)}
|
|
</div>`}function lL(e,t,n,r,i,a,o=!0,s=!1){if(!e)return P;let c=nL(e),l=c?W(`sessionProgressCard.countLabel`,{completed:String(c.completed),total:String(c.total)}):W(`sessionProgressCard.noteLabel`),u=ee(i),d=ee(a),f=ee(e.updatedAt),p=u!==void 0&&d!==void 0&&d>=u&&f!==void 0&&f>=u,m=r&&fL[r]&&p?d:void 0,h=r&&fL[r]&&!m?void 0:r,g=m??f??Date.now(),_=m?dL[r]:`sessionProgressCard.activity.updated`,v=l,y=hL(g,_),b=n&&e.steps?.length&&e.steps.every(e=>e.status===`completed`)?F`<button
|
|
class="rail-header__action session-progress-card__dismiss"
|
|
type="button"
|
|
aria-label=${W(`sessionProgressCard.dismiss`)}
|
|
title=${W(`sessionProgressCard.dismiss`)}
|
|
@click=${t=>{t.preventDefault(),t.stopPropagation(),n?.(e)}}
|
|
>
|
|
${H.x}
|
|
</button>`:P;if(t===`composer`){let t=e.steps??[],n=rL(t),r=aL(t),i=t.length>0&&t.every(e=>e.status===`completed`),a=c?W(`sessionProgressCard.countLabel`,{completed:String(c.completed),total:String(c.total)}):W(`sessionProgressCard.noteLabel`),u=n?.step??W(`sessionProgressCard.noteLabel`),d=h?fL[h]:void 0,f=`${u}. ${d?W(d):l}`,p=c?W(`sessionProgressCard.shortCount`,{completed:String(r),total:String(c.total)}):P,m=n?.status===`in_progress`&&!o&&!d?`paused`:n?.status,g=h===`done`?H.check:h===`failed`||h===`timeout`||h===`killed`?H.circleX:i?H.check:n?.status===`in_progress`?iL(m??`pending`):H.clock;return F`<details
|
|
class="session-progress-card session-progress-card--composer"
|
|
data-progress-card-placement="composer"
|
|
data-complete=${String(i)}
|
|
${Nn(t=>tL(t,e.sessionKey,!i&&!s))}
|
|
>
|
|
<summary class="session-progress-card__summary" aria-label=${f}>
|
|
<span
|
|
class="session-progress-card__summary-indicator session-progress-card__current-marker${i||h===`done`?` session-progress-card__summary-indicator--complete`:``}"
|
|
data-status=${m??`pending`}
|
|
data-outcome=${h??P}
|
|
aria-hidden="true"
|
|
>
|
|
${g}
|
|
</span>
|
|
<span class="session-progress-card__summary-collapsed">
|
|
<span class="session-progress-card__current">${u}</span>
|
|
</span>
|
|
${c?F`<span
|
|
class="session-progress-card__summary-count session-progress-card__summary-count--collapsed"
|
|
data-outcome=${h??P}
|
|
>${d?W(d):`${r}/${c.total}`}</span
|
|
>`:P}
|
|
<span class="session-progress-card__summary-expanded">
|
|
<span class="session-progress-card__summary-title"
|
|
>${W(`sessionProgressCard.composerTitle`)}</span
|
|
>
|
|
<span class="session-progress-card__heading-actions"
|
|
><span>${y}${c?F` · ${p}`:P}</span
|
|
>${b}</span
|
|
>
|
|
</span>
|
|
<span
|
|
class="session-progress-card__summary-chevron session-progress-card__chevron"
|
|
aria-hidden="true"
|
|
>${H.chevronDown}</span
|
|
>
|
|
</summary>
|
|
<div class="session-progress-card__body" role="region" aria-label=${a}>
|
|
${oL(e.markdown)} ${sL(e,o,h)}
|
|
</div>
|
|
</details>`}return F`<section
|
|
class="session-progress-card session-progress-card--${t}"
|
|
data-progress-card-placement=${t}
|
|
aria-label=${v}
|
|
>
|
|
<div class="session-progress-card__heading">
|
|
<span>${W(`sessionProgressCard.title`)}</span>
|
|
<span class="session-progress-card__heading-actions">
|
|
<span
|
|
>${y}${c?F` · ${c.completed}/${c.total}`:P}</span
|
|
>${b}
|
|
</span>
|
|
</div>
|
|
${cL(e,o,h)}
|
|
</section>`}var uL,dL,fL,pL,mL,hL,gL;function _L(){return(_L=t((()=>{ue(),I(),Wn(),An(),jn(),Hn(),V(),pn(),U(),iA(),uL={completed:`sessionProgressCard.status.completed`,in_progress:`sessionProgressCard.status.inProgress`,pending:`sessionProgressCard.status.pending`},dL={queued:`sessionProgressCard.activity.updated`,running:`sessionProgressCard.activity.updated`,done:`sessionProgressCard.activity.completed`,failed:`sessionProgressCard.activity.failed`,killed:`sessionProgressCard.activity.stopped`,timeout:`sessionProgressCard.activity.failed`},fL={done:`sessionProgressCard.outcome.completed`,failed:`sessionProgressCard.outcome.failed`,killed:`sessionProgressCard.outcome.stopped`,timeout:`sessionProgressCard.outcome.failed`},pL={done:`sessionProgressCard.status.completed`,failed:`sessionProgressCard.status.failed`,killed:`sessionProgressCard.status.stopped`,timeout:`sessionProgressCard.status.failed`},mL=class extends qn{constructor(...e){super(...e),this.timestamp=0,this.labelKey=`sessionProgressCard.activity.updated`}render(e,t){return this.timestamp=e,this.labelKey=t,this.isConnected&&this.startTimer(),this.renderTime()}disconnected(){this.stopTimer()}reconnected(){this.setValue(this.renderTime()),this.startTimer()}startTimer(){this.timer||=setInterval(()=>this.setValue(this.renderTime()),3e4)}stopTimer(){this.timer&&=(clearInterval(this.timer),void 0)}renderTime(){let e=W(this.labelKey,{time:_t(this.timestamp)});return F`<time
|
|
datetime=${new Date(this.timestamp).toISOString()}
|
|
aria-label=${e}
|
|
title=${e}
|
|
>${e}</time
|
|
>`}},hL=En(mL),gL=new WeakMap})))()}var vL;function yL(){return(yL=t((()=>{I(),R(),$r(),Ai(),V(),M(),ay(),ri(),vL=class extends xt{constructor(...e){super(...e),this.basePath=``,this.gatewayVersion=null,this.updateAttentionDismissed=!1,this.variant=`compact`}render(){let e=this.variant===`settings`?ey(yi,this.gatewayVersion):this.variant===`identity`?this.updateAttentionDismissed?ey(yi,this.gatewayVersion):$v(yi):Xv(yi);return!e&&!this.updateAttentionDismissed?P:F`
|
|
<openclaw-tooltip class="sidebar-hover-tooltip" .delay=${600} .closeDelay=${300}>
|
|
<a
|
|
class="sidebar-footer-build"
|
|
href=${Gr(`about`,this.basePath)}
|
|
aria-label=${this.updateAttentionDismissed?`${W(`aboutPage.artifactDetails`)}. ${W(`updates.sidebar.availableTitle`)}`:W(`aboutPage.artifactDetails`)}
|
|
@click=${e=>{et(e)&&(e.preventDefault(),this.onNavigate?.(`about`))}}
|
|
>${e?F`<span class="sidebar-footer-build__text">${e}</span>`:P}
|
|
${this.updateAttentionDismissed?F`<span class="agent-select__badge sidebar-footer-build__update"
|
|
>${W(`updates.sidebar.availableTitle`)}</span
|
|
>`:P}</a
|
|
>
|
|
<div slot="content" class="sidebar-hover-card sidebar-build-hover-card">
|
|
${ny(yi,this.gatewayVersion)}
|
|
</div>
|
|
</openclaw-tooltip>
|
|
`}},S([z({attribute:!1})],vL.prototype,`basePath`,void 0),S([z({attribute:!1})],vL.prototype,`gatewayVersion`,void 0),S([z({attribute:!1})],vL.prototype,`updateAttentionDismissed`,void 0),S([z({attribute:!1})],vL.prototype,`onNavigate`,void 0),S([z({attribute:!1})],vL.prototype,`variant`,void 0),globalThis.customElements&&!customElements.get(`openclaw-sidebar-build-chip`)&&customElements.define(`openclaw-sidebar-build-chip`,vL)})))()}function bL(e,t=null,n){let r=n===void 0&&e.agent?Tt(e.agent,t):n??null;if(r)return F`<img class="agent-select__avatar" src=${r} alt="" loading="lazy" />`;if(e.icon)return F`<span class="agent-select__avatar agent-select__avatar--icon" aria-hidden="true"
|
|
>${e.icon}</span
|
|
>`;let i=e.agent?cn(e.agent,t):null,a=ut(e.label)||`?`;return F`
|
|
<span
|
|
class="agent-select__avatar agent-select__avatar--text"
|
|
data-avatar=${i??a}
|
|
aria-hidden="true"
|
|
></span>
|
|
`}function xL(e){return F`
|
|
<span class="agent-select__option-copy">
|
|
<span class="agent-select__option-label">${e.label}</span>
|
|
${e.description?F`<span class="agent-select__option-description">${e.description}</span>`:P}
|
|
</span>
|
|
`}var SL;function CL(){return(CL=t((()=>{re(),b(),I(),R(),jn(),V(),an(),Sg(),Ge(),M(),U(),li(),SL=class extends Et{constructor(...e){super(...e),this.options=[],this.value=``,this.placeholder=``,this.accessibleLabel=``,this.menuLabel=``,this.identityById={},this.authToken=null,this.disabled=!1,this.onSelect=()=>{},this.onCreateAgent=null,this.avatarLoader=new xg(()=>{this.isConnected&&this.requestUpdate()}),this.handleSelect=e=>{if(this.disabled){e.preventDefault();return}let t=e.detail.item;if(t.hasAttribute(`data-create-agent`)){this.onCreateAgent?.();return}let n=t.value??t.getAttribute(`value`);if(n!=null){if(n===this.value){e.preventDefault();let t=e.currentTarget;t.querySelector(`[slot="trigger"]`)?.focus({preventScroll:!0}),t.open=!1;return}this.onSelect(n)}},this.handleAfterShow=e=>{let t=e.currentTarget,n=Array.from(t.querySelectorAll(`wa-dropdown-item[data-agent-option]:not([disabled])`)),r=n.find(e=>e.hasAttribute(`data-selected`))??n[0];if(r){for(let e of n)e.active=e===r;r.focus({preventScroll:!0}),r.scrollIntoView?.({block:`nearest`})}}}disconnectedCallback(){this.avatarLoader.reset(),super.disconnectedCallback()}willUpdate(e){if(e.has(`disabled`)&&this.disabled){let e=this.querySelector(`wa-dropdown`);e&&(e.open=!1)}}renderAvatar(e){let t=e.agent?.id,n=t?this.identityById[t]??null:null,r=e.agent?Tt(e.agent,n):null;return bL(e,n,r?this.avatarLoader.resolve(r,this.authToken?[this.authToken]:[]):null)}render(){return this.avatarLoader.withActiveRoutes(()=>this.renderContent())}renderContent(){let e=this.options.find(e=>e.value===this.value),t=!e&&this.value?{value:this.value,label:this.value,agent:{id:this.value}}:null,n=e??t,r=this.disabled||this.options.length===0&&!this.onCreateAgent,i=n?.label??(this.placeholder||W(`agents.noAgents`)),a=e?.badge,o=a?`${i}, ${a}`:i;return F`
|
|
<wa-dropdown
|
|
class="agent-select"
|
|
placement="bottom-start"
|
|
aria-label=${this.accessibleLabel||i}
|
|
@wa-select=${this.handleSelect}
|
|
@wa-after-show=${this.handleAfterShow}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
class="agent-select__trigger"
|
|
aria-label=${this.accessibleLabel?`${this.accessibleLabel}: ${o}`:o}
|
|
?disabled=${r}
|
|
>
|
|
${n?this.renderAvatar(n):P}
|
|
<span class="agent-select__label">${i}</span>
|
|
${a?F`<span class="agent-select__badge">${a}</span>`:P}
|
|
<span class="agent-select__chevron" aria-hidden="true">${H.chevronDown}</span>
|
|
</button>
|
|
${this.menuLabel?F`<div class="agent-select__menu-title">${this.menuLabel}</div>`:P}
|
|
${this.options.map(e=>{let t=e.value===this.value,n=[e.label,e.description,e.badge].filter(Boolean).join(`, `);return F`
|
|
<wa-dropdown-item
|
|
class="agent-select__option"
|
|
data-agent-option
|
|
?data-selected=${t}
|
|
aria-label=${n}
|
|
.value=${e.value}
|
|
?disabled=${this.disabled||e.disabled}
|
|
${Nn(e=>fi(e,t))}
|
|
>
|
|
<span slot="icon">${this.renderAvatar(e)}</span>
|
|
${xL(e)}
|
|
<span slot="details" class="agent-select__option-state" aria-hidden="true">
|
|
${e.badge?F`<span class="agent-select__badge">${e.badge}</span>`:P}
|
|
${t?F`<span class="agent-select__option-check">${H.check}</span>`:P}
|
|
</span>
|
|
</wa-dropdown-item>
|
|
`})}
|
|
${this.onCreateAgent?F`
|
|
${this.options.length>0?F`<div class="agent-select__separator" role="separator"></div>`:P}
|
|
<wa-dropdown-item
|
|
class="agent-select__option"
|
|
data-create-agent
|
|
?disabled=${this.disabled}
|
|
>
|
|
<span slot="icon" class="agent-select__footer-icon" aria-hidden="true"
|
|
>${H.users}</span
|
|
>
|
|
<span class="agent-select__option-label">${W(`custodian.newAgent`)}</span>
|
|
</wa-dropdown-item>
|
|
`:P}
|
|
</wa-dropdown>
|
|
`}},S([z({attribute:!1})],SL.prototype,`options`,void 0),S([z({attribute:!1})],SL.prototype,`value`,void 0),S([z({attribute:!1})],SL.prototype,`placeholder`,void 0),S([z({attribute:!1})],SL.prototype,`accessibleLabel`,void 0),S([z({attribute:!1})],SL.prototype,`menuLabel`,void 0),S([z({attribute:!1})],SL.prototype,`identityById`,void 0),S([z({attribute:!1})],SL.prototype,`authToken`,void 0),S([z({attribute:!1})],SL.prototype,`disabled`,void 0),S([z({attribute:!1})],SL.prototype,`onSelect`,void 0),S([z({attribute:!1})],SL.prototype,`onCreateAgent`,void 0)})))()}function wL(e){return[...e?.querySelectorAll(`:scope > wa-dropdown-item:not([disabled]), :scope > .sidebar-agent-menu__agent-grid > wa-dropdown-item:not([disabled])`)??[]]}function TL(e,t){e.forEach(e=>e.active=e===t),t.focus({preventScroll:!0}),t.scrollIntoView?.({block:`nearest`})}function EL(e,t){e.target===e.currentTarget&&t(ci(e))}function DL(e){if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)||e.target instanceof HTMLInputElement&&(e.key===`Home`||e.key===`End`))return!1;let t=e.currentTarget.closest(`wa-dropdown`),n=wL(t),r=t?.querySelector(`.sidebar-identity-menu__footer`),i=[...n,...r?.querySelectorAll(`a[href], button:not([disabled])`)??[]],a=e.target instanceof HTMLElement?e.target:null,o=a?i.indexOf(a):-1;if(r&&o<0)return!1;let s=e.key===`ArrowDown`?1:-1,c=e.key===`Home`?n[0]:e.key===`End`?n.at(-1):o<0?n.at(s===1?0:-1):i[(o+s+i.length)%i.length];return!c||r&&!r.contains(a)&&!r.contains(c)?!1:(e.preventDefault(),e.stopPropagation(),TL(n,c),!0)}function OL(e){if(e.key.length!==1||e.metaKey||e.ctrlKey||e.altKey)return!1;let t=e.currentTarget;if(!(t instanceof HTMLElement))return!1;let n=zL.get(t);if(e.key===` `&&!n?.query)return!1;e.preventDefault(),e.stopPropagation(),n&&clearTimeout(n.timeout);let r=`${n?.query??``}${e.key}`.trim().toLowerCase(),i=setTimeout(()=>zL.delete(t),1e3);zL.set(t,{query:r,timeout:i});let a=wL(t),o=a.find(e=>(e.textContent??``).trim().toLowerCase().startsWith(r));return o&&TL(a,o),!0}function kL(e){let t=wL(e),n=t.find(e=>e.classList.contains(`sidebar-agent-menu__agent-switch--active`))??t.find(e=>e.classList.contains(`sidebar-agent-menu__agent-switch`));n&&TL(t,n)}function AL(e){let{agents:t}=e,n=new Set(t.map(e=>r(e.id))),i=new Set(e.pinnedAgentIds.map(e=>r(e)).filter(e=>n.has(e)));return t.toSorted((e,t)=>!i.has(r(e.id))-+!i.has(r(t.id)))}function jL(e,t){let n=r(e.id),i=t.identities.get(n)??null,a=ct(e,i),o=n===t.activeId,s=o?0:t.agentUnreadCount(n),c={value:n,label:a,agent:e};return F`
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item sidebar-agent-menu__agent-switch agent-select__option ${o?`sidebar-agent-menu__agent-switch--active`:``}"
|
|
value=${`${IL}${encodeURIComponent(n)}`}
|
|
type="checkbox"
|
|
role="menuitemradio"
|
|
aria-checked=${String(o)}
|
|
${Nn(e=>fi(e,o))}
|
|
>
|
|
<span class="sidebar-agent-menu__agent-tile">
|
|
<span class="sidebar-agent-menu__agent-avatar">
|
|
${bL(c,i)}
|
|
</span>
|
|
${xL(c)}
|
|
<span class="sidebar-agent-menu__agent-status">
|
|
${s>0?F`<span
|
|
class="session-unread-dot"
|
|
role="img"
|
|
aria-label=${W(`sessionsView.unread`)}
|
|
></span>`:P}
|
|
</span>
|
|
</span>
|
|
</wa-dropdown-item>
|
|
`}function ML(){return F`
|
|
${FL.map(e=>F`
|
|
<wa-dropdown-item
|
|
slot="submenu"
|
|
class="sidebar-customize-menu__item"
|
|
value=${`${RL}${encodeURIComponent(e.href)}`}
|
|
data-new-tab-action
|
|
@click=${e=>{e.target instanceof Element&&e.target.closest(`a`)&&(e.currentTarget.dataset.nativeNavigation=`true`)}}
|
|
>
|
|
<a
|
|
href=${e.href}
|
|
target=${Ct}
|
|
rel=${Ot()}
|
|
tabindex="-1"
|
|
>
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H[e.icon]}</span>
|
|
<span class="sidebar-customize-menu__text">${e.label()}</span>
|
|
</a>
|
|
</wa-dropdown-item>
|
|
`)}
|
|
`}function NL(e){let t=e.position;if(!t)return P;let{activeId:n,activeName:r,agents:i}=e,a=AL(e);return F`
|
|
<wa-dropdown
|
|
class="sidebar-customize-menu sidebar-agent-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`agentChip.menuLabel`)}
|
|
@pointerenter=${e.onPointerEnter}
|
|
@pointerleave=${e.onPointerLeave}
|
|
@wa-select=${t=>{t.preventDefault();let r=t.detail.item;if(r.dataset.nativeNavigation){delete r.dataset.nativeNavigation,e.onClose(!1);return}let i=r.value;if(i){if(e.onClose(!1),i.startsWith(IL)){e.onSwitchAgent(decodeURIComponent(i.slice(6)));return}switch(i){case`${LL}capabilities`:e.onAskCapabilities(n);break;case`${LL}agent-settings`:e.onNavigate(`agents`,{pathname:yr(n,null,e.basePath)});break;case`${LL}new-agent`:e.onNavigate(`custodian`,{search:`?intent=new-agent`})}}}}
|
|
@wa-after-show=${t=>{t.currentTarget instanceof HTMLElement&&(e.onAfterShow(),e.openMode!==`hover`&&kL(t.currentTarget))}}
|
|
@keydown=${t=>{if(DL(t)||OL(t))return;let n=t.target instanceof HTMLElement?t.target.closest(`.sidebar-agent-menu__agent-grid > wa-dropdown-item:not([disabled])`):null;if((t.key===`Enter`||t.key===` `)&&n){t.preventDefault(),t.stopPropagation(),n.click();return}ni(t,e.onTabAway)}}
|
|
@wa-after-hide=${t=>EL(t,e.onClose)}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${W(`agentChip.menuLabel`)}
|
|
style="position: fixed; left: ${t.x}px; top: ${t.top}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
${i.length>1?F`
|
|
<div class="sidebar-customize-menu__title">${W(`agentChip.agents`)}</div>
|
|
<div class="sidebar-agent-menu__agent-grid">
|
|
${a.map(t=>jL(t,e))}
|
|
</div>
|
|
`:P}
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:new-agent">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.users}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`custodian.newAgent`)}</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item"
|
|
value="command:capabilities"
|
|
?disabled=${!e.connected}
|
|
>
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.bot}</span>
|
|
<span class="sidebar-customize-menu__text">
|
|
${W(`agentChip.whatCanAgentDo`,{name:r})}
|
|
</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:agent-settings">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.users}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`agentChip.agentSettings`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`}function PL(e){let t=e.position;if(!t)return P;let n=e.profileViewer?.name??e.profileViewer?.email,r=e.profileViewer?.email&&e.profileViewer.email!==n?e.profileViewer.email:null;return F`
|
|
<wa-dropdown
|
|
class="sidebar-customize-menu sidebar-identity-menu"
|
|
style=${`--sidebar-identity-menu-min-width: ${e.triggerWidth}px`}
|
|
.open=${!0}
|
|
placement="top-start"
|
|
.distance=${0}
|
|
aria-label=${W(`profilePage.identity.menuLabel`)}
|
|
@wa-select=${t=>{t.preventDefault();let n=t.detail.item;if(n.dataset.nativeNavigation){delete n.dataset.nativeNavigation,e.onClose(!1);return}let r=n.value;if(r){if(e.onClose(!1),r.startsWith(RL)){cT(decodeURIComponent(r.slice(5)));return}switch(r){case`${LL}profile`:e.onNavigate(`profile`,{hash:`#settings-profile-identity`});break;case`${LL}settings`:e.onNavigate(`appearance`);break;case`${LL}usage`:e.onNavigate(`usage`);break;case`${LL}pair-mobile`:e.onPairMobile();break;case`${LL}apps`:e.onNavigate(`apps`);break;case`${LL}debug-overlay`:Io();break;case`${LL}retry-connect`:e.onRetryConnect?.()}}}}
|
|
@keydown=${t=>{DL(t)||ni(t,e.onTabAway)}}
|
|
@wa-after-hide=${t=>EL(t,e.onClose)}
|
|
>
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${W(`profilePage.identity.menuLabel`)}
|
|
style="position: fixed; left: ${t.x}px; bottom: ${t.bottom}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
${n?F`<wa-dropdown-item
|
|
class="sidebar-customize-menu__item sidebar-identity-menu__header"
|
|
value="command:profile"
|
|
>
|
|
<span slot="icon" class="sidebar-identity-menu__avatar" aria-hidden="true">
|
|
<openclaw-viewer-avatar
|
|
.user=${e.profileViewer}
|
|
variant="footer"
|
|
></openclaw-viewer-avatar>
|
|
</span>
|
|
<span class="sidebar-identity-menu__identity">
|
|
<span class="sidebar-identity-menu__name" title=${n}>${n}</span>
|
|
${r?F`<span class="sidebar-identity-menu__email" title=${r}
|
|
>${r}</span
|
|
>`:P}
|
|
</span>
|
|
</wa-dropdown-item>
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>`:P}
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:settings">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.settings}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`nav.settings`)}</span>
|
|
<kbd slot="details" class="session-menu__shortcut" aria-hidden="true"
|
|
>${Oe(D.appearanceSettings)}</kbd
|
|
>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:usage">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.coins}</span>
|
|
<span class="sidebar-customize-menu__text">${$n(`usage`)}</span>
|
|
</wa-dropdown-item>
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item sidebar-pair-mobile"
|
|
value="command:pair-mobile"
|
|
?disabled=${!e.canPairDevice}
|
|
title=${e.canPairDevice?P:W(`devices.pairing.adminRequired`)}
|
|
>
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.smartphone}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`devices.pairing.button`)}</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:apps">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.layoutGrid}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`agentChip.getApps`)}</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item class="sidebar-customize-menu__item" value="command:debug-overlay">
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true">${H.activity}</span>
|
|
<span class="sidebar-customize-menu__text">${W(`debug.overlay.title`)}</span>
|
|
<span slot="details" class="session-menu__shortcut" aria-hidden="true"
|
|
>${Po}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item sidebar-identity-menu__help"
|
|
value="command:help"
|
|
>
|
|
<span slot="icon" class="nav-item__icon" aria-hidden="true"
|
|
>${H.circleQuestionMark}</span
|
|
>
|
|
<span class="sidebar-customize-menu__text">${W(`agentChip.help`)}</span>
|
|
${ML()}
|
|
</wa-dropdown-item>
|
|
${e.offline?F`<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item
|
|
class="sidebar-customize-menu__item sidebar-identity-menu__retry"
|
|
value="command:retry-connect"
|
|
>
|
|
<span class="sidebar-customize-menu__text">${W(`connection.retryNow`)}</span>
|
|
</wa-dropdown-item>`:P}
|
|
<div class="sidebar-customize-menu__separator" role="separator"></div>
|
|
<div class="sidebar-identity-menu__footer">
|
|
<openclaw-sidebar-build-chip
|
|
.variant=${`identity`}
|
|
.basePath=${e.basePath}
|
|
.gatewayVersion=${e.gatewayVersion}
|
|
.updateAttentionDismissed=${e.updateAttentionDismissed}
|
|
.onNavigate=${t=>{e.onClose(),e.onNavigate(t)}}
|
|
></openclaw-sidebar-build-chip>
|
|
<span class="sidebar-mode-switch">
|
|
<openclaw-theme-mode-toggle .mode=${e.themeMode}></openclaw-theme-mode-toggle>
|
|
</span>
|
|
</div>
|
|
</wa-dropdown>
|
|
`}var FL,IL,LL,RL,zL;function BL(){return(BL=t((()=>{I(),jn(),Vr(),$r(),V(),an(),en(),EN(),fT(),O(),Fo(),CL(),U(),yL(),Fh(),li(),FL=[{href:`https://docs.openclaw.ai`,icon:`book`,label:()=>W(`common.docs`)},{href:`https://docs.openclaw.ai/help`,icon:`messageSquare`,label:()=>W(`agentChip.getHelp`)},{href:`https://discord.gg/clawd`,icon:`users`,label:()=>W(`agentChip.discord`)},{href:`https://docs.openclaw.ai/releases`,icon:`scrollText`,label:()=>W(`agentChip.viewChangelog`)}],IL=`agent:`,LL=`command:`,RL=`link:`,zL=new WeakMap})))()}function VL(e,t){return F`
|
|
<button
|
|
slot="trigger"
|
|
type="button"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
aria-label=${t}
|
|
style="position: fixed; left: ${e.x}px; top: ${e.y}px; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
|
|
></button>
|
|
`}function HL(e){return F`
|
|
<wa-dropdown-item
|
|
class="sidebar-session-sort-menu__item"
|
|
value=${e.value}
|
|
role="menuitemradio"
|
|
aria-checked=${String(e.checked)}
|
|
${Nn(t=>fi(t,e.checked))}
|
|
>
|
|
<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${e.checked?H.check:P}</span
|
|
>
|
|
<span class="row session-menu__label">
|
|
${e.owner?Lh(e.owner,`row`,`owned`):P}
|
|
<span class="session-menu__text">${e.label}</span>
|
|
</span>
|
|
</wa-dropdown-item>
|
|
`}function UL(e,t,n,r){return e.length===0&&t===null&&!n?P:F`
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<div class="sidebar-session-sort-menu__title">${W(`sessionsView.owners`)}</div>
|
|
${HL({value:`owner:`,checked:t===null&&!n,label:W(`sessionsView.allOwners`)})}
|
|
${HL({value:`involving-me`,checked:n,label:W(`sessionsView.involvingMe`)})}
|
|
${e.map(e=>HL({value:`owner:${e.id}`,checked:t===e.id,label:e.id===r?W(`sessionsView.ownerYou`,{name:e.label??e.id}):e.label??e.id,owner:e}))}
|
|
`}function WL(e){let t=e.menu;return t?Kn(t,F`
|
|
<wa-dropdown
|
|
class="session-menu sidebar-session-group-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`sessionsView.groupMenu`,{group:t.group})}
|
|
@wa-select=${n=>{n.preventDefault();let r=n.detail.item.value;(r===`group-defaults`||r===`rename-group`||r===`new-group`||r===`delete-group`)&&!e.actionDisabledReasons?.[r]&&e.onAction(r,t.group)}}
|
|
@keydown=${t=>ni(t,()=>e.trigger?.focus())}
|
|
@wa-after-hide=${t=>e.onClose(ci(t))}
|
|
>
|
|
${VL(t,W(`sessionsView.groupMenu`,{group:t.group}))}
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="group-defaults"
|
|
?disabled=${!e.connected||!!e.actionDisabledReasons?.[`group-defaults`]}
|
|
title=${e.actionDisabledReasons?.[`group-defaults`]??P}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.settings}</span>
|
|
<span class="session-menu__text"
|
|
>${e.groupDefaultsUnavailable?`${W(`common.retry`)}: ${W(`sessionsView.groupDefaultsMenu`)}`:W(`sessionsView.groupDefaultsMenu`)}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="rename-group"
|
|
?disabled=${!e.connected||!!e.actionDisabledReasons?.[`rename-group`]}
|
|
title=${e.actionDisabledReasons?.[`rename-group`]??P}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.edit}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.renameGroupMenu`)}</span>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="session-menu__item"
|
|
value="new-group"
|
|
?disabled=${!e.connected||!!e.actionDisabledReasons?.[`new-group`]}
|
|
title=${e.actionDisabledReasons?.[`new-group`]??P}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.folder}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.newGroup`)}</span>
|
|
</wa-dropdown-item>
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item
|
|
class="session-menu__item session-menu__item--destructive"
|
|
value="delete-group"
|
|
variant="danger"
|
|
?disabled=${!e.connected||!!e.actionDisabledReasons?.[`delete-group`]}
|
|
title=${e.actionDisabledReasons?.[`delete-group`]??P}
|
|
>
|
|
<span slot="icon" class="session-menu__icon" aria-hidden="true">${H.trash}</span>
|
|
<span class="session-menu__text">${W(`sessionsView.deleteGroupMenu`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`):P}function GL(e){let t=e.position;if(!t)return P;let n=[{grouping:`project`,label:W(`chat.sidebar.catalogGroupByProject`)},{grouping:`person`,label:W(`chat.sidebar.catalogGroupByPerson`)},{grouping:`none`,label:W(`sessionsView.groupByNone`)}];return Kn(t,F`
|
|
<wa-dropdown
|
|
class="sidebar-session-sort-menu sidebar-catalog-view-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`chat.sidebar.catalogViewOptions`)}
|
|
@wa-select=${t=>{t.preventDefault();let n=t.detail.item.value;n?.startsWith(`grouping:`)?e.onGroupingChange(n.slice(9)):n?.startsWith(`owner:`)?e.onOwnerFilterChange(n.slice(6)||null):n===`involving-me`?e.onOwnerFilterChange(null,!0):n===`hide-catalog`&&e.onHide()}}
|
|
@keydown=${t=>ni(t,()=>e.trigger?.focus())}
|
|
@wa-after-hide=${t=>e.onClose(ci(t))}
|
|
>
|
|
${VL(t,W(`chat.sidebar.catalogViewOptions`))}
|
|
<div class="sidebar-session-sort-menu__title">${W(`sessionsView.groupBy`)}</div>
|
|
${n.map(t=>HL({value:`grouping:${t.grouping}`,checked:e.grouping===t.grouping,label:t.label}))}
|
|
${UL(e.owners,e.ownerFilterId,e.involvingMe,e.selfOwnerId)}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item class="sidebar-session-sort-menu__item" value="hide-catalog">
|
|
<span class="session-menu__text">${W(`chat.sidebar.hideFromSidebar`)}</span>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`)}function KL(e){let t=e.position;if(!t)return P;let n=[{grouping:`category`,label:W(`sessionsView.groupByCategory`)},{grouping:`project`,label:W(`chat.sidebar.catalogGroupByProject`)},{grouping:`person`,label:W(`sessionsView.groupByPerson`)},{grouping:`none`,label:W(`sessionsView.groupByNone`)}];return Kn(t,F`
|
|
<wa-dropdown
|
|
class="sidebar-session-sort-menu"
|
|
.open=${!0}
|
|
placement="bottom-start"
|
|
.distance=${0}
|
|
aria-label=${W(`chat.sidebar.sortSessions`)}
|
|
@wa-select=${t=>{t.preventDefault();let n=t.detail.item.value;n?.startsWith(`grouping:`)?e.onGroupingChange(n.slice(9)):n?.startsWith(`sort:`)?e.onSortModeChange(n.slice(5)):n?.startsWith(`status:`)?e.onStatusFilterChange(n.slice(7)):n?.startsWith(`owner:`)?e.onOwnerFilterChange(n.slice(6)||null):n===`involving-me`?e.onOwnerFilterChange(null,!0):n===`show-preview`?e.onShowPreviewChange(!e.showPreview):n===`show-cron`?e.onShowCronChange(!e.showCron):n===`show-system`&&e.onShowSystemChange(!e.showSystem)}}
|
|
@keydown=${t=>ni(t,()=>e.trigger?.focus())}
|
|
@wa-after-hide=${t=>e.onClose(ci(t))}
|
|
>
|
|
${VL(t,W(`chat.sidebar.sortSessions`))}
|
|
<div class="sidebar-session-sort-menu__title">${W(`sessionsView.groupBy`)}</div>
|
|
${n.filter(t=>t.grouping!==`person`||e.peopleSortAvailable).map(t=>HL({value:`grouping:${t.grouping}`,checked:e.grouping===t.grouping,label:t.label}))}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<div class="sidebar-session-sort-menu__title">${W(`chat.sidebar.sortBy`)}</div>
|
|
${lp.filter(t=>t.mode!==`people`||e.peopleSortAvailable).map(t=>HL({value:`sort:${t.mode}`,checked:e.sortMode===t.mode,label:W(t.labelKey)}))}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<div class="sidebar-session-sort-menu__title">${W(`sessionsView.status`)}</div>
|
|
${up.map(t=>HL({value:`status:${t}`,checked:e.statusFilter===t,label:W(t===`active`?`common.active`:t===`archived`?`sessionsView.archived`:`sessionsView.all`)}))}
|
|
${UL(e.owners,e.ownerFilterId,e.involvingMe,e.selfOwnerId)}
|
|
<div class="session-menu__separator" role="separator"></div>
|
|
<wa-dropdown-item
|
|
class="sidebar-session-sort-menu__item"
|
|
type="checkbox"
|
|
value="show-preview"
|
|
.checked=${e.showPreview}
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.showSessionPreview`)}</span>
|
|
<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${e.showPreview?H.check:P}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="sidebar-session-sort-menu__item"
|
|
type="checkbox"
|
|
value="show-cron"
|
|
.checked=${e.showCron}
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.showCronSessions`)}</span>
|
|
<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${e.showCron?H.check:P}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
<wa-dropdown-item
|
|
class="sidebar-session-sort-menu__item"
|
|
type="checkbox"
|
|
value="show-system"
|
|
.checked=${e.showSystem}
|
|
>
|
|
<span class="session-menu__text">${W(`sessionsView.showSystemSessions`)}</span>
|
|
<span slot="details" class="session-menu__check" aria-hidden="true"
|
|
>${e.showSystem?H.check:P}</span
|
|
>
|
|
</wa-dropdown-item>
|
|
</wa-dropdown>
|
|
`)}function qL(){return(qL=t((()=>{I(),Tn(),jn(),V(),G(),U(),Hh(),li()})))()}function JL(e){let{snapshot:t,session:n,batchRows:r=null,cloudWorkerStopAction:i}=e,a=e=>{let n=nt(t,e);return n.allowed?void 0:n.reason},o=a({method:`sessions.patch`,params:{key:n.key,label:null}}),s=e=>{if(!r)return o;let n=nt(t,{method:`sessions.patchMany`,params:{targets:r.map(e=>({key:e.key,...e.sessionId?{expectedSessionId:e.sessionId}:{}})),patch:e}});if(!n.allowed)return n.cause===`method-unavailable`?o:n.reason},c=s({unread:!0}),l=s({category:null}),u=(r??[n]).some(e=>!e.sessionId?.trim())?`Session lifecycle action requires a durable session identity.`:s({archived:!0}),d=a({method:`sessions.groups.put`,requiredScope:`operator.write`}),f=(r??[n]).map(e=>a({method:`sessions.delete`,params:{key:e.key,...e.sessionId?{expectedSessionId:e.sessionId}:{},...e.archived?{archivedOnly:!0}:{}}})).find(e=>!!e),p=r?void 0:a({method:`sessions.create`,params:{parentSessionKey:n.key,fork:!0}}),m=i?a(i):void 0;return{...o?{"toggle-pin":o,rename:o,"set-icon":o,"set-color":o}:{},...c?{"toggle-unread":c}:{},...l?{"move-to-group":l}:{},...u?{"toggle-archived":u}:{},...d||l?{"new-group":d??l}:{},...p?{fork:p}:{},...m?{"stop-cloud-worker":m}:{},...f?{delete:f}:{}}}function YL(){return(YL=t((()=>{_e()})))()}function XL(e){let{host:t}=e,n=e.customizeMenuPosition,r=e.customizeMenuTrigger;return Pv({position:n,sidebarEntries:t.sidebarEntries,preferencesBrowserOnly:t.preferencesBrowserOnly,isRouteEnabled:t=>e.isRouteEnabled(t),workboardBoards:t.workboardBoards,workboardRenderers:t.workboardRenderers,onTabAway:()=>r?.focus(),onClose:t=>{e.customizeMenuPosition===n&&e.closeCustomizeMenu({restoreFocus:t})},onToggleRoute:e=>{let n=Er({type:`route`,route:e}),r=t.reconciledSidebarZone().sidebarEntries,i=r.includes(n)?r.filter(e=>e!==n):[...r,n];t.onUpdateSidebarEntries?.(i)},onToggleWorkboardBoard:e=>{let n=Er({type:`workboard`,boardId:e}),r=t.reconciledSidebarZone().sidebarEntries,i=r.includes(n)?r.filter(e=>e!==n):[...r,n];t.onUpdateSidebarEntries?.(i)},onReset:()=>{let n=t.reconciledSidebarZone().sidebarEntries.filter(e=>e.startsWith(`session:`));t.onUpdateSidebarEntries?.([...Dr,...n]),e.closeCustomizeMenu({restoreFocus:!0})}})}function ZL(e){let{host:t}=e,n=e.agentMenuPosition,r=e.agentMenuTrigger,{activeId:i,agent:a,agents:o,identity:s,identities:c}=t.activeChipAgent();return NL({position:n,basePath:t.basePath,activeId:i,activeName:ct(a??{id:i},s),agents:o,identities:c,pinnedAgentIds:t.pinnedAgentIds,connected:t.connected,openMode:e.agentMenuInteractionState===`open-hover`?`hover`:`click`,agentUnreadCount:e=>t.agentUnreadCount(e),onPointerEnter:()=>e.handleAgentMenuPointerEnter(),onPointerLeave:()=>e.handleAgentMenuPointerLeave(),onAfterShow:()=>e.restoreFocusAfterAgentMenuHoverOpen(),onSwitchAgent:e=>t.switchChipAgent(e),onAskCapabilities:e=>t.askAgentCapabilities(e),onTabAway:()=>r?.focus(),onClose:t=>{e.agentMenuPosition===n&&e.closeAgentMenu({restoreFocus:t})},onNavigate:(e,n)=>t.onNavigate?.(e,n)})}function QL(e){let{host:t}=e,n=e.identityMenuPosition,r=e.identityMenuTrigger,i=ar({snapshotUser:t.sessionDataContext?.gateway.snapshot.selfUser,presenceEntries:ir(t.sessionData.presencePayload),presenceInstanceId:t.sessionData.presenceInstanceId}),a=t.sessionDataContext,o=a?.overlays.snapshot,s=sv({gatewayBootId:a?.gateway.snapshot.hello?.server?.bootId,updateAvailable:o?.updateAvailable,updateSchedule:o?.updateSchedule}),c=!!(a&&s&&nr(o?.updateAvailable,o?.updateSchedule,!!(o?.updateRunning||o?.updateReconciliationPending))&&!o?.updateRunning&&!o?.updateReconciliationPending&&o?.updateSchedule?.campaign?.state!==`applying`&&!cv(o?.updateStatusBanner?.tone)&&lv(iv(a.gateway.connection.gatewayUrl),s));return PL({position:n,canPairDevice:t.canPairDevice,basePath:t.basePath,gatewayVersion:t.gatewayVersion,updateAttentionDismissed:c,profileViewer:i?{...i,watchedSessions:[]}:void 0,offline:t.offline,themeMode:t.themeMode,triggerWidth:n?.width??0,onTabAway:()=>r?.focus(),onClose:t=>{e.identityMenuPosition===n&&e.closeIdentityMenu({restoreFocus:t})},onNavigate:(e,n)=>t.onNavigate?.(e,n),onPairMobile:()=>t.onPairMobile?.(),onRetryConnect:t.onRetryConnect})}function $L(e){let{host:t}=e,n=e.sessionMenu;if(!n)return P;let r=t.sessionDataContext,{session:i}=n,a=Bt({agentsList:t.sessionDataContext?.agents.state.agentsList,hello:t.sessionDataContext?.gateway.snapshot.hello}),o=t.selectedVisibleSessions(),s=o.length>1&&o.some(e=>e.key===i.key)?o:null,c=s??[i],l=c.every(e=>At(e,a)),u=pt(c,a),d=c.every(e=>e.unread),f=c.every(e=>e.archived===!0),p=c.every(e=>(e.category??null)===(c[0]?.category??null))?c[0]?.category??null:null,m=i.cloudWorkerStopAction,h=!!(!s&&m&&(!m.blocksActiveRun||!i.hasActiveRun)&&r&&Na(r.gateway.snapshot,m.method)===!0),g=r?.gateway.snapshot.selfUser??null,_=Ih({facet:[t.sessionData.sessionsResult,...Object.values(t.sessionData.sessionResultsByAgent)].find(e=>e?.sessions.some(e=>e.key===i.key))?.owners,agents:r?.agents.state.agentsList?.agents,self:g}),v=g?_.find(e=>e.type===`human`&&e.id===g.id)??null:null,y=t.readSessionMutationAccess({method:`sessions.assignOwner`,params:{key:i.key,owner:{type:`human`,id:g?.id??`profile`}},requiredScope:`operator.write`}),b={...JL({snapshot:r?.gateway.snapshot,session:i,batchRows:s,cloudWorkerStopAction:i.cloudWorkerStopAction}),...y.allowed?{}:{"assign-owner":y.reason}};return Kn(n,F`
|
|
<openclaw-session-menu
|
|
.session=${{label:i.label,sessionId:i.sessionId??null,isChild:i.isChild,pinned:i.pinned,unread:s?d:i.unread,archived:f,category:s?p:i.category??null,icon:s?null:i.icon??null,color:s?null:i.color??null,categoryClearReturnsToGroups:p!==null&&c.every(e=>mf(e,t.sessionsGrouping))}}
|
|
.selectionCount=${c.length}
|
|
.compact=${Or()}
|
|
.lastActive=${s?``:Fd(i.updatedAt)}
|
|
.anchor=${n}
|
|
.trigger=${e.sessionMenuTrigger}
|
|
.disabled=${!t.connected}
|
|
.actionDisabledReasons=${b}
|
|
.forkDisabled=${t.sessionData.sessionsLoading||i.modelSelectionLocked}
|
|
.forkFromLastCompleted=${i.gatewayHasActiveRun??i.hasActiveRun}
|
|
.archiveAllowed=${l}
|
|
.deleteAllowed=${u}
|
|
.cloudWorkerStopAllowed=${h}
|
|
.groups=${t.knownSessionGroups()}
|
|
.ownerOptions=${_}
|
|
.selfOwner=${v}
|
|
.currentOwnerId=${i.owner?.actor.id??null}
|
|
.work=${s?null:e.sessionMenuWork}
|
|
.workboard=${null}
|
|
.onClose=${()=>{e.sessionMenu===n&&e.closeSessionMenu()}}
|
|
.onAction=${e=>{if(s){t.sessionOrganizer.runBatchSessionAction(e,s,d);return}switch(e.kind){case`open-pr`:cT(e.url);break;case`open-in`:Tm(e.editor,e.path);break;case`copy-session-id`:Kt(i.sessionId??``).then(e=>{ke({message:W(e?`common.copied`:`common.copyFailed`)})});break;case`toggle-pin`:t.sessionOrganizer.patchSession(i,{pinned:!i.pinned});break;case`toggle-unread`:t.sessionOrganizer.patchSession(i,{unread:!i.unread});break;case`rename`:t.sessionOrganizer.renameSession(i);break;case`set-color`:t.sessionOrganizer.patchSession(i,{color:e.color});break;case`set-icon`:t.sessionOrganizer.patchSession(i,{icon:e.icon});break;case`assign-owner`:t.sessionOrganizer.assignSessionOwner(i,e.owner);break;case`fork`:t.sessionOrganizer.forkSession(i);break;case`workboard`:break;case`move-to-group`:(e.category===null||i.category!==e.category)&&t.sessionOrganizer.assignSessionCategory(i,e.category);break;case`new-group`:t.sessionOrganizer.createSessionGroup([i]);break;case`toggle-archived`:i.archived?t.sessionOrganizer.patchSession(i,{archived:!1}):t.sessionOrganizer.archiveSessionWithUndo(i);break;case`stop-cloud-worker`:t.sessionOrganizer.stopCloudWorker(i);break;case`delete`:t.sessionOrganizer.deleteSession(i)}}}
|
|
></openclaw-session-menu>
|
|
`)}function eR(e){let{host:t}=e,n=e.sessionGroupMenu,r=t.sessionDataContext?.sessions.groupsStatus()??`idle`,i={"group-defaults":nt(t.sessionDataContext?.gateway.snapshot,{method:`sessions.groups.update`,requiredScope:`operator.write`}),"rename-group":nt(t.sessionDataContext?.gateway.snapshot,{method:`sessions.groups.rename`,requiredScope:`operator.write`}),"new-group":nt(t.sessionDataContext?.gateway.snapshot,{method:`sessions.groups.put`,requiredScope:`operator.write`}),"delete-group":nt(t.sessionDataContext?.gateway.snapshot,{method:`sessions.groups.delete`,requiredScope:`operator.write`})};return WL({menu:n,trigger:e.sessionGroupMenuTrigger,connected:t.connected,groupDefaultsUnavailable:r===`unavailable`,actionDisabledReasons:Object.fromEntries(Object.entries(i).flatMap(([e,t])=>t.allowed?e===`group-defaults`&&r!==`ready`&&r!==`unavailable`?[[e,W(`common.loading`)]]:[]:[[e,t.reason]])),onAction:(n,i)=>{switch(e.closeSessionGroupMenu({restoreFocus:!0}),n){case`group-defaults`:if(r===`unavailable`){t.sessionDataContext?.sessions.groupsInvalidate(),t.sessionDataContext?.sessions.groupsLoad();break}t.sessionOrganizer.editSessionGroupDefaults(i);break;case`rename-group`:t.sessionOrganizer.renameSessionGroupFromMenu(i);break;case`new-group`:t.sessionOrganizer.createSessionGroup();break;case`delete-group`:t.sessionOrganizer.deleteSessionGroupFromMenu(i)}},onClose:t=>{e.sessionGroupMenu===n&&e.closeSessionGroupMenu({restoreFocus:t})}})}function tR(e){let{host:t}=e,n=e.sessionSortMenuPosition;return KL({position:n,trigger:e.sessionSortMenuTrigger,grouping:t.effectiveSessionsGrouping(),sortMode:t.effectiveSessionSortMode(),peopleSortAvailable:t.sessionPeopleSortAvailable(),statusFilter:t.sessionsStatusFilter,showCron:t.sessionsShowCron,showPreview:t.sessionsShowPreview,showSystem:t.sessionsShowSystem,owners:t.sessionOwnershipVisible?t.sessionOwnerOptions:[],ownerFilterId:t.sessionOwnerFilterActive?t.sessionOwnerFilterId:null,involvingMe:t.sessionInvolvingMeFilterActive,selfOwnerId:t.sessionDataContext?.gateway.snapshot.selfUser?.id??null,onGroupingChange:n=>{t.sessionOrganizer.setSessionsGrouping(n),e.closeSessionSortMenu({restoreFocus:!0})},onSortModeChange:n=>{t.setSessionSortMode(n),e.closeSessionSortMenu({restoreFocus:!0})},onStatusFilterChange:n=>{t.sessionOrganizer.setSessionsStatusFilter(n),e.closeSessionSortMenu({restoreFocus:!0})},onOwnerFilterChange:(n,r=!1)=>{t.setSessionOwnerFilter(n,r),e.closeSessionSortMenu({restoreFocus:!0})},onShowCronChange:n=>{t.sessionOrganizer.setSessionsShowCron(n),e.closeSessionSortMenu({restoreFocus:!0})},onShowPreviewChange:n=>{t.sessionOrganizer.setSessionsShowPreview(n),e.closeSessionSortMenu({restoreFocus:!0})},onShowSystemChange:n=>{t.sessionOrganizer.setSessionsShowSystem(n),e.closeSessionSortMenu({restoreFocus:!0})},onClose:t=>{e.sessionSortMenuPosition===n&&e.closeSessionSortMenu({restoreFocus:t})}})}function nR(e){let{host:t}=e,n=e.catalogViewMenuPosition;return GL({position:n,trigger:e.catalogViewMenuTrigger,grouping:t.catalogProjectGrouping,owners:t.sessionOwnershipVisible?t.sessionOwnerOptions:[],ownerFilterId:t.sessionOwnerFilterActive?t.sessionOwnerFilterId:null,involvingMe:t.sessionInvolvingMeFilterActive,selfOwnerId:t.sessionDataContext?.gateway.snapshot.selfUser?.id??null,onGroupingChange:n=>{t.setCatalogProjectGrouping(n),e.closeCatalogViewMenu({restoreFocus:!0})},onHide:()=>{!n||e.catalogViewMenuPosition!==n||(t.hideSessionCatalog(n.catalogId),e.closeCatalogViewMenu())},onOwnerFilterChange:(n,r=!1)=>{t.setSessionOwnerFilter(n,r),e.closeCatalogViewMenu({restoreFocus:!0})},onClose:t=>{e.catalogViewMenuPosition===n&&e.closeCatalogViewMenu({restoreFocus:t})}})}function rR(e){let{host:t}=e,n=e.moreMenuPosition,r=e.moreMenuTrigger;return Nv({position:n,basePath:t.basePath,activeRouteId:t.activeRouteId,sidebarEntries:t.sidebarEntries,isRouteEnabled:t=>e.isRouteEnabled(t),onTabAway:()=>r?.focus(),onClose:t=>{e.moreMenuPosition===n&&e.closeMoreMenu({restoreFocus:t})},onNavigateRoute:n=>{e.closeMoreMenu({restoreFocus:!0}),t.onNavigate?.(n)},onPreloadRoute:(t,n)=>e.preloadRoute(t,n),onCancelPreload:t=>e.cancelPreload(t),onEditPinnedItems:()=>{let t=e.moreMenuPosition,n=e.moreMenuTrigger;t&&e.openCustomizeMenu(t.x,t.y,n)}})}function iR(){return(iR=t((()=>{I(),Tn(),Vr(),Kr(),hr(),V(),an(),Om(),Fa(),fT(),_e(),bf(),O(),rt(),BL(),Fv(),Hd(),qL(),YL(),Hh(),mv()})))()}function aR(e){return typeof e==`string`&&e.length>0}function oR(e){for(let t of[`sessionId`,`agentId`,`shell`,`cwd`])if(!aR(e[t]))return t;return null}function sR(e){return e instanceof Error&&/^gateway request timed out after \d+ms: terminal\.open$/u.test(e.message)}function cR(e){return e instanceof Error&&(e.message===`terminal open timed out`||sR(e))}var lR,uR,dR,fR,pR,mR,hR,gR;function _R(){return(_R=t((()=>{Xo(),lR=2e4,uR=5e3,dR=2,fR=5e3,pR=35e3,mR=class extends Error{constructor(e){super(`terminal open timed out`,{cause:e}),this.name=`TerminalOpenTimeoutError`}},hR=class extends Error{constructor(e){super(`terminal session response is missing ${e}`),this.field=e,this.name=`TerminalOpenUnusableSessionError`}},gR=class e{static{this.MAX_PENDING_EVENTS=512}constructor(e){this.streams=new Map,this.pending=new Map,this.unsubscribe=null,this.disposed=!1,this.pendingOpenCount=0,this.livenessTimer=null,this.livenessProbeInFlight=!1,this.livenessProbeFailures=0,this.lastLivenessFailureActivityVersion=null,this.lastTerminalActivityAtMs=Date.now(),this.inboundActivityVersion=0,this.client=e}ensureSubscribed(){this.unsubscribe||=this.client.addEventListener(e=>{if(e.event===`terminal.data`){this.noteTerminalActivity();let t=e.payload;if(t?.sessionId&&typeof t.seq==`number`&&typeof t.data==`string`){let e={kind:`data`,seq:t.seq,data:t.data},n=this.streams.get(t.sessionId);n?this.deliverData(t.sessionId,n,e):this.bufferEarly(t.sessionId,e)}return}if(e.event===`terminal.exit`){this.noteTerminalActivity();let t=e.payload;if(t?.sessionId){let e={exitCode:t.exitCode??null,signal:t.signal??null,reason:t.reason,error:t.error},n=this.streams.get(t.sessionId);n?n.recovering?this.bufferEarly(t.sessionId,{kind:`exit`,info:e}):this.deliverExit(t.sessionId,n,e):this.bufferEarly(t.sessionId,{kind:`exit`,info:e})}}})}async open(e,t){let n;try{n=await this.requestWhileHoldingStream(()=>this.client.request(`terminal.open`,e,{timeoutMs:pR}))}catch(e){throw cR(e)?(sR(e)&&this.forceReconnect(`terminal open watchdog timeout`),new mR(e)):e}let r=oR(n);if(r)throw aR(n.sessionId)&&this.close(n.sessionId),new hR(r);if(this.disposed)return n;let i=this.setStream(n.sessionId,t,{seqMode:`unknown`,expectedSeq:0,recovering:!1});return this.flushPending(n.sessionId,i),this.scheduleLivenessCheck(),n}async attach(e,t){let n=await this.requestWhileHoldingStream(()=>this.client.request(`terminal.attach`,{sessionId:e})),r=oR(n)??(typeof n.buffer==`string`?null:`buffer`);if(r)throw new hR(r);let i=typeof n.seq==`number`&&Number.isSafeInteger(n.seq)?n.seq:null;if(this.disposed)return n;let a=this.setStream(e,t,{seqMode:i===null?`counter`:`offset`,expectedSeq:i,recovering:!0}),o=a.abort.signal;try{await t.onReplay({data:n.buffer,newlyObservedFrom:n.buffer.length,mode:`initial`,signal:o})}catch(t){throw o.aborted||(this.removeStream(e),this.pending.delete(e),this.maybeUnsubscribe()),t}return o.aborted?n:(a.recovering=!1,this.flushPending(e,a,i??void 0,!0),this.scheduleLivenessCheck(),n)}async list(){return(await this.client.request(`terminal.list`))?.sessions??[]}async requestWhileHoldingStream(e){this.ensureSubscribed(),this.pendingOpenCount+=1;try{let t=await e();return--this.pendingOpenCount,t}catch(e){throw--this.pendingOpenCount,this.maybeUnsubscribe(),e}}deliverData(e,t,n){if(t.recovering){this.bufferEarly(e,n);return}if(!Number.isSafeInteger(n.seq)){this.recoverGap(e,t,n);return}if(t.seqMode===`counter`){t.expectedSeq=n.seq+1,t.sink.onData(n.data);return}if(n.seq-n.data.length===t.expectedSeq){n.data.length>0&&(t.seqMode=`offset`),t.expectedSeq=n.seq,t.sink.onData(n.data);return}if(t.seqMode===`unknown`&&t.expectedSeq===0&&n.seq===0){t.seqMode=`counter`,t.expectedSeq=1,t.sink.onData(n.data);return}this.recoverGap(e,t,n)}recoverGap(e,t,n){if(t.recovering)return;t.recovering=!0;let r=t.abort.signal;this.client.request(`terminal.attach`,{sessionId:e}).then(async i=>{if(r.aborted)return;let a=typeof i.seq==`number`&&Number.isSafeInteger(i.seq)?i.seq:null;if(a===null){t.seqMode=`counter`,t.expectedSeq=null,t.recovering=!1,this.deliverData(e,t,n),this.flushPending(e,t,void 0,!0);return}let o=t.expectedSeq;t.seqMode=`offset`,t.expectedSeq=a;let s=a-i.buffer.length,c=typeof o==`number`?Math.max(0,Math.min(i.buffer.length,o-s)):0;await t.sink.onReplay({data:i.buffer,newlyObservedFrom:c,mode:`recovery`,signal:r}),!r.aborted&&(t.recovering=!1,this.flushPending(e,t,a,!0))}).catch(()=>{if(r.aborted)return;let i=this.pending.get(e)?.drain();if(i?.some(e=>e.kind===`exit`)){this.pending.delete(e),t.recovering=!1,t.sink.onData(n.data);for(let n of i)if(n.kind===`data`)t.sink.onData(n.data);else{this.deliverExit(e,t,n.info);break}return}t.recovering=!1,this.pending.delete(e),this.forceReconnect(`terminal replay failed`)})}flushPending(e,t,n,r=!1){let i=this.pending.get(e);if(!i)return;this.pending.delete(e);let a=i.drain();for(let i of a){if(this.streams.get(e)!==t)break;if(!(r&&i.kind===`exit`&&i.info.reason===`detached`)){if(i.kind===`data`){if(n!==void 0&&i.seq<=n)continue;this.deliverData(e,t,i)}else t.recovering?this.bufferEarly(e,i):this.deliverExit(e,t,i.info)}}}deliverExit(e,t,n){this.removeStream(e),t.sink.onExit(n),this.pending.delete(e),this.maybeUnsubscribe()}setStream(e,t,n){this.removeStream(e);let r={abort:new AbortController,sink:t,...n};return this.streams.set(e,r),this.lastTerminalActivityAtMs=Date.now(),r}removeStream(e){this.streams.get(e)?.abort.abort(),this.streams.delete(e)}bufferEarly(t,n){let r=this.pending.get(t)??new Yo(e.MAX_PENDING_EVENTS,{mode:`drop-oldest`});this.pending.set(t,r),r.push(n)}noteTerminalActivity(){this.resetLivenessProbeFailures(),this.lastTerminalActivityAtMs=Date.now(),this.inboundActivityVersion+=1}forceReconnect(e){this.resetLivenessProbeFailures(),this.client.forceReconnect(e)}resetLivenessProbeFailures(){this.livenessProbeFailures=0,this.lastLivenessFailureActivityVersion=null}scheduleLivenessCheck(e=lR){this.livenessTimer||this.livenessProbeInFlight||this.streams.size===0||(this.livenessTimer=setTimeout(()=>{this.livenessTimer=null,this.checkLiveness()},Math.max(0,e)))}checkLiveness(){if(this.streams.size===0)return;let e=lR-(Date.now()-this.lastTerminalActivityAtMs);if(e>0){this.scheduleLivenessCheck(e);return}let t=this.client.inboundActivitySeq??this.inboundActivityVersion;if(this.lastLivenessFailureActivityVersion!==null&&t!==this.lastLivenessFailureActivityVersion){this.resetLivenessProbeFailures(),this.lastTerminalActivityAtMs=Date.now(),this.scheduleLivenessCheck();return}let n=lR;this.livenessProbeInFlight=!0,this.client.request(`terminal.list`,void 0,{timeoutMs:uR}).then(()=>{this.resetLivenessProbeFailures(),this.lastTerminalActivityAtMs=Date.now()}).catch(()=>{if(this.streams.size===0){this.resetLivenessProbeFailures();return}let e=this.client.inboundActivitySeq??this.inboundActivityVersion;if(e!==t){this.resetLivenessProbeFailures(),this.lastTerminalActivityAtMs=Date.now();return}if(this.livenessProbeFailures+=1,this.lastLivenessFailureActivityVersion=e,this.livenessProbeFailures>=dR){this.forceReconnect(`terminal liveness timeout`);return}n=fR}).finally(()=>{this.livenessProbeInFlight=!1,this.scheduleLivenessCheck(n)})}async input(e,t){await this.requestAction(`terminal.input`,e,{sessionId:e,data:t})}async resize(e,t,n){await this.requestAction(`terminal.resize`,e,{sessionId:e,cols:t,rows:n})}async requestAction(e,t,n){let r=this.streams.get(t);(await this.client.request(e,n).catch(()=>null))?.ok!==!1||!r||this.streams.get(t)!==r||this.deliverExit(t,r,{exitCode:null,signal:null,reason:`disconnected`,error:`Terminal session is no longer available. Open a new terminal session.`})}async close(e){this.removeStream(e),this.pending.delete(e),await this.client.request(`terminal.close`,{sessionId:e}).catch(()=>void 0),this.pending.delete(e),this.maybeUnsubscribe()}get size(){return this.streams.size}dispose(){this.disposed=!0;for(let e of this.streams.values())e.abort.abort();this.streams.clear(),this.pending.clear(),this.stopLiveness(),this.dropSubscriptions()}maybeUnsubscribe(){this.streams.size===0&&this.pendingOpenCount===0&&(this.pending.clear(),this.stopLiveness(),this.dropSubscriptions())}stopLiveness(){this.resetLivenessProbeFailures(),this.livenessTimer&&=(clearTimeout(this.livenessTimer),null)}dropSubscriptions(){this.unsubscribe?.(),this.unsubscribe=null}}})))()}function vR(e){return typeof e==`string`&&e.length>0}function yR(e){return T(e)&&vR(e.catalogId)&&vR(e.hostId)&&vR(e.threadId)?{catalogId:e.catalogId,hostId:e.hostId,threadId:e.threadId}:null}function bR(e){if(!T(e))return null;if(e.kind===`attach`)return vR(e.sessionId)&&typeof e.agentOwned==`boolean`?{kind:`attach`,sessionId:e.sessionId,agentOwned:e.agentOwned}:null;let t=e.agentId;if(t!==null&&!vR(t))return null;if(e.kind===`restore`||e.kind===`open`)return{kind:e.kind,agentId:t};if(e.kind===`catalog`){let n=yR(e.catalog);return n?{kind:`catalog`,agentId:t,catalog:n}:null}return null}function xR(){try{let e=globalThis.sessionStorage?.getItem(ER);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function SR(e){try{globalThis.sessionStorage?.setItem(ER,JSON.stringify(e))}catch{}}function CR(e){SR(e.filter(e=>e.status===`live`&&e.gatewaySessionId).map(e=>e.gatewaySessionId))}function wR(){try{let e=globalThis.sessionStorage?.getItem(DR);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{let t=bR(e);return t?[t]:[]}):[]}catch{return[]}}function TR(e){try{if(e.length===0){globalThis.sessionStorage?.removeItem(DR);return}globalThis.sessionStorage?.setItem(DR,JSON.stringify(e))}catch{}}var ER,DR;function OR(){return(OR=t((()=>{ER=`openclaw.terminal.sessions.v1`,DR=`openclaw.terminal.actions.v1`})))()}function kR(e,t){let n=e instanceof CustomEvent&&typeof e.detail==`object`&&e.detail!==null?e.detail:null;if(!n||n.open===!1)return null;let r=n.agentId?.trim()||t;return n.terminalSessionId?{kind:`attach`,sessionId:n.terminalSessionId,agentOwned:!0}:n.catalog?{kind:`catalog`,agentId:r,catalog:n.catalog}:n.open===!0?{kind:`restore`,agentId:r}:null}var AR,jR,MR;function NR(){return(NR=t((()=>{_R(),OR(),AR=class{constructor(){this.action=null}remember(e,t){this.action=e?{kind:`catalog`,agentId:t,catalog:e}:{kind:`open`,agentId:t}}clearUnlessRetryable(e){e instanceof mR||e instanceof hR||this.clear()}clear(){this.action=null}get available(){return this.action!==null}run(){let e=this.action;this.clear(),e&&MR.queue(e)}},jR=class{constructor(){this.refreshPending=!1,this.refreshTimedOut=!1,this.refreshTimer=null,this.drainScheduled=!1,this.hosts=[],this.fenceHost=null,this.fenceGeneration=0,this.timeoutHost=null,this.actions=[],this.rehydrate()}rehydrate(){let e=wR(),t=e.some(e=>e.kind!==`restore`)?e.filter(e=>e.kind!==`restore`):e;this.actions.splice(0,this.actions.length,...t),t.length!==e.length&&TR(this.actions)}get host(){return this.hosts.at(-1)??null}bindHost(e){this.hosts.length===0&&this.rehydrate(),this.hosts=[...this.hosts.filter(t=>t!==e),e],this.drain()}releaseHost(e){this.hosts=this.hosts.filter(t=>t!==e),this.fenceHost===e&&this.resetLifecycle(e),this.hosts.length===0&&(this.clearRefreshTimer(),this.refreshTimedOut=!1,this.timeoutHost=null,this.rehydrate())}get hasActions(){return this.actions.length>0}get fenced(){return this.refreshPending}get waitingForRefresh(){return this.refreshPending&&!this.refreshTimedOut&&this.actions.length>0}beginRefreshFence(e,t){this.refreshPending=!0,this.fenceHost=e,this.fenceGeneration=t,this.clearRefreshFailure(),this.clearRefreshTimer(),this.armRefreshTimer()}releaseRefreshFence(e){this.fenceHost===e&&(this.clearRefreshTimer(),this.refreshPending=!1,this.fenceHost=null,this.clearRefreshFailure(),this.drain())}resetLifecycle(e){(this.fenceHost===null||this.fenceHost===e)&&(this.clearRefreshTimer(),this.refreshPending=!1,this.fenceHost=null,this.clearRefreshFailure())}async queue(e,t={}){let n=!1;if(e.kind!==`restore`)for(let e=this.actions.length-1;e>=0;--e)this.actions[e]?.kind===`restore`&&(this.actions.splice(e,1),n=!0);let r=this.actions.some(e=>e.kind!==`restore`),i=JSON.stringify(e);if(!(e.kind===`restore`&&r)&&!this.actions.some(e=>JSON.stringify(e)===i)&&(this.actions.push(e),n=!0),n&&TR(this.actions),t.deferUntilHostChange)return;this.armRefreshTimer();let a=this.host;this.refreshPending?a?.requestUpdate():a&&!a.hasTabs()&&a.setBooting(!0),await this.drain()}async drain(){let e=this.host;if(!(this.drainScheduled||this.actions.length===0||!e||!this.canRun(e))){this.drainScheduled=!0;try{await e.bootQueue.enqueue(async t=>{let n=this.actions[0];if(!n||!t()||!this.canRun(e)||!await this.execute(e,n)||!t())return;let r=this.actions.indexOf(n);r!==-1&&(this.actions.splice(r,1),TR(this.actions))})}finally{this.drainScheduled=!1;let e=this.host;this.actions.length>0&&e&&this.canRun(e)?this.drain():this.actions.length===0&&e&&!e.hasTabs()&&e.setBooting(!1)}}}cancel(e){this.host===e&&(this.actions.splice(0),TR(this.actions),e.setBooting(!1),this.clearRefreshFailure())}canRun(e){return!this.refreshPending&&e.canRun()}async execute(e,t){return t.kind===`attach`?e.attach(t.sessionId,t.agentOwned):t.kind===`open`?e.open(void 0,t.agentId):(await e.reattach(),this.canRun(e)?t.kind===`catalog`?e.open(t.catalog,t.agentId):e.ensureInitial(t.agentId):!1)}clearRefreshTimer(){this.refreshTimer!==null&&(globalThis.clearTimeout(this.refreshTimer),this.refreshTimer=null)}clearRefreshFailure(){this.refreshTimedOut&&=(this.timeoutHost?.clearTimeout(),this.timeoutHost=null,!1)}armRefreshTimer(){let e=this.fenceHost;if(!this.refreshPending||!e||this.refreshTimer!==null||this.actions.length===0)return;let t=this.fenceGeneration;this.refreshTimer=globalThis.setTimeout(()=>{this.refreshTimer=null,!(this.fenceHost!==e||t!==e.currentGeneration()||!this.refreshPending||this.actions.length===0)&&(this.refreshTimedOut=!0,this.timeoutHost=e,e.showTimeout(),e.setBooting(!1))},e.timeoutMs())}},MR=new jR})))()}function PR(e){return W(ZR[e])}function FR(e){switch(e.runtime){case`subagent`:return W(`tasksPage.runtime.subagent`);case`cron`:return W(`tasksPage.runtime.cron`);case`acp`:return W(`tasksPage.runtime.acp`);case`cli`:return W(`tasksPage.runtime.cli`);default:return W(`tasksPage.runtime.unknown`)}}function IR(e){return e.title??e.kind??(e.runtime?FR(e):W(`tasksPage.untitled`))}function LR(e){return e.status===`queued`||e.status===`running`?e.progressSummary??null:e.status===`failed`||e.status===`timed_out`?e.error??e.terminalSummary??e.progressSummary??null:e.terminalSummary??e.error??e.progressSummary??null}function RR(e){return e.status===`queued`||e.status===`running`}function zR(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=Date.parse(e);return Number.isFinite(t)?t:0}return 0}function BR(e,t,n){let r=n.prompt??t.prompt;return r&&e.prompt!==r?{...e,prompt:r}:e}function VR(e,t,n=`detail`){if(!t)return e;let r=zR(e.updatedAt??e.endedAt??e.createdAt),i=zR(t.updatedAt??t.endedAt??t.createdAt);if(i>r)return BR(t,e,t);if(i<r)return e;let a=RR(e);if(a!==RR(t))return BR(a?t:e,e,t);if(!a)return n===`event`?BR(t,e,t):e;if(e.status===`running`&&t.status===`queued`)return BR(e,e,t);if(e.status===`queued`&&t.status===`running`)return BR(t,e,t);let o=e.toolUseCount??0,s=t.toolUseCount??0;return BR(o>s?e:s>o||n!==`detail`?t:e,e,t)}function HR(e){return e.toSorted((e,t)=>{let n=zR(t.updatedAt)-zR(e.updatedAt);return n===0?e.id<t.id?-1:+(e.id>t.id):n})}function UR(e){let t=HR(e);return{active:t.filter(e=>e.status===`queued`||e.status===`running`),recent:t.filter(e=>e.status!==`queued`&&e.status!==`running`).slice(0,50)}}function WR(e){return ha(Ta,e)?{tasks:HR(e.tasks.map(Sm).filter(e=>e!==null)),...e.nextCursor===void 0?{}:{nextCursor:e.nextCursor}}:null}function GR(e){return ha(la,e)?Sm(e.task):null}function KR(...e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.id);t.set(e.id,n?VR(n,e,`snapshot`):e)}return HR([...t.values()])}function qR(e){if(!ha(Ni,e))return null;let t=w(e.reason),n=Sm(e.task);return{found:e.found,cancelled:e.cancelled,...t?{reason:t}:{},...n?{task:n}:{}}}function JR(e){return ha(ya,e)?{results:e.results.map(e=>{let t=Sm(e.task),{task:n,...r}=e;return{...r,...t?{task:t}:{}}})}:null}function YR(e){if(!T(e))return null;if(e.action===`restored`)return{action:`restored`};if(e.action===`deleted`){let t=w(e.taskId);return t?{action:`deleted`,taskId:t}:null}if(e.action===`upserted`){let t=Sm(e.task);return t?{action:`upserted`,task:t}:null}return null}function XR(e,t){let n=YR(t);if(!n||n.action===`restored`)return{tasks:[...e],refetch:!0};if(n.action===`deleted`)return{tasks:HR(e.filter(e=>e.id!==n.taskId)),refetch:!1};let r=e.find(e=>e.id===n.task.id);return{tasks:HR([r?VR(r,n.task,`event`):n.task,...e.filter(e=>e.id!==n.task.id)]),refetch:!1}}var ZR;function QR(){return(QR=t((()=>{Zi(),Sa(),V(),Cm(),ZR={queued:`tasksPage.status.queued`,running:`tasksPage.status.running`,completed:`tasksPage.status.completed`,failed:`tasksPage.status.failed`,cancelled:`tasksPage.status.cancelled`,timed_out:`tasksPage.status.timedOut`}})))()}async function $R(){let e=await Wc();return Tz!==e&&(Tz=e,globalThis.setTimeout(()=>void cz(e).catch(()=>void 0),0)),e}function ez(e){return JSON.stringify([e.gatewayOwner,e.recoveryScope])}function tz(e){return JSON.stringify([e.gatewayOwner,e.recoveryScope,e.scopeKey])}function nz(e){let t=Math.max(Date.now(),e+1,wz+1);return wz=t,t}function rz(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.blob instanceof Blob&&typeof t.mimeType==`string`}function iz(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.key!=`string`||typeof t.ownerKey!=`string`||typeof t.gatewayOwner!=`string`||typeof t.recoveryScope!=`string`||typeof t.scopeKey!=`string`||typeof t.updatedAt!=`number`||typeof t.writeId!=`string`||typeof t.text!=`string`||t.goalMode!==void 0&&!fl(t.goalMode)||typeof t.revision!=`number`||!Number.isSafeInteger(t.revision)||t.revision<=0||!Array.isArray(t.attachments)||!t.attachments.every(rz)?null:t}function az(e){return!!(e.text||e.goalMode||e.attachments.length>0)}function oz(e,t){let n=nz(e.revision);return{...e,revision:n,text:``,goalMode:void 0,attachments:[],updatedAt:t,writeId:`fence:${n}`}}function sz(e,t){if(!(uz(e)||e.updatedAt>t-xz))return az(e)?oz(e,t):null}async function cz(e){let t=e.transaction(vz,`readwrite`),n=t.objectStore(vz),r=Date.now(),i=n.openCursor();i.addEventListener(`success`,()=>{try{let e=i.result;if(!e)return;let t=iz(e.value),n=t?sz(t,r):void 0;n===null?e.delete():n&&e.update(n),e.continue()}catch{t.abort()}}),await Uc(t)}async function lz(e,t,n){let r=(await Hc(e.index(yz).getAll(t))).flatMap(e=>{let t=iz(e);return t?[t]:[]}),i=[];for(let t of r){let r=sz(t,n);if(r===null){e.delete(t.key);continue}if(r){e.put(r);continue}az(t)&&!uz(t)&&i.push(t)}i.sort((e,t)=>t.updatedAt-e.updatedAt);for(let t of i.slice(Sz))e.put(oz(t,n))}function uz(e){return!e.scopeKey.startsWith(bz)&&e.scopeKey.includes(`\0agent:`)&&az(e)}async function dz(e){let t;try{t=(await $R()).transaction(vz,`readwrite`);let n=t.objectStore(vz),r=await Hc(n.index(yz).getAll(ez({...e,scopeKey:``}))),i=[],a=r.filter(e=>{let t=iz(e);return t&&az(t)&&!uz(t)}).length;for(let t of r){let r=iz(t);if(!r||!uz(r))continue;if(r.gatewayOwner!==e.gatewayOwner||r.recoveryScope!==e.recoveryScope)throw Error(`Composer recovery owner mismatch`);let o=zl(r.scopeKey),s=o&&![`global`,`main`].includes(o.sessionKey),c={...e,scopeKey:`${bz}${o?Wl(o):r.scopeKey}`},l=await Hc(n.get(tz(c))),u=iz(l);s&&u&&!az(u)&&u.revision>r.revision?n.put(oz(r,Date.now())):s&&a<Sz&&l===void 0?(n.put({...r,key:tz(c),scopeKey:c.scopeKey,updatedAt:Date.now()}),a++,n.put(oz(r,Date.now()))):i.push({scopeKey:r.scopeKey,revision:r.revision,writeId:r.writeId,text:r.text,attachmentNames:r.attachments.map(e=>e.fileName??e.mimeType)})}return await Uc(t),{status:`ready`,entries:i}}catch{try{t?.abort()}catch{}return{status:`storage-failed`}}}async function fz(e,t,n,r,i,a){let o;try{o=(await $R()).transaction(vz,`readwrite`);let s=o.objectStore(vz),c=iz(await Hc(s.get(tz({...e,scopeKey:t.scopeKey})))),l=iz(await Hc(s.get(tz(e))));if(!i()||!c||!uz(c)||c.gatewayOwner!==e.gatewayOwner||c.recoveryScope!==e.recoveryScope||c.revision!==t.revision||c.writeId!==t.writeId||(l?.revision??0)!==n||l?.writeId!==r||l&&az(l))return o.abort(),{status:`conflict`};let u=nz(Math.max(a,c.revision,l?.revision??0));return s.put({...c,key:tz(e),scopeKey:e.scopeKey,revision:u,writeId:`recovered:${u}`,updatedAt:Date.now()}),s.put(oz(c,Date.now())),await Uc(o),{status:`persisted`,revision:u}}catch{try{o?.abort()}catch{}return{status:`storage-failed`}}}async function pz(e){try{let t=(await $R()).transaction(vz,`readwrite`),n=t.objectStore(vz),r=await Hc(n.get(tz(e))),i=iz(r),a=Date.now();if(!i)return r!==void 0&&n.delete(tz(e)),await Uc(t),{status:`not-found`};if(i.gatewayOwner!==e.gatewayOwner||i.recoveryScope!==e.recoveryScope||i.scopeKey!==e.scopeKey)return t.abort(),{status:`storage-failed`};let o=sz(i,a);return o===null?(n.delete(i.key),await Uc(t),{status:`not-found`}):o?(n.put(o),await Uc(t),{status:`not-found`,revision:o.revision,writeId:o.writeId}):(await Uc(t),az(i)?{status:`found`,draft:{revision:i.revision,writeId:i.writeId,text:i.text,...i.goalMode?{goalMode:i.goalMode}:{},attachments:i.attachments}}:{status:`not-found`,revision:i.revision,writeId:i.writeId})}catch{return{status:`storage-failed`}}}async function mz(e,t,n){if(t.attachments.reduce((e,t)=>e+t.blob.size,0)>Cz){let r=await mz(e,{revision:t.revision,text:t.text,goalMode:t.goalMode,attachments:[]},n);return r.status===`persisted`?{status:`payload-too-large`,revision:r.revision,writeId:r.writeId}:r}try{let r=(await $R()).transaction(vz,`readwrite`),i=r.objectStore(vz),a=tz(e),o=iz(await Hc(i.get(a)));if(o?.revision===t.revision)return r.abort(),o.writeId===n.writeId?{status:`persisted`,revision:o.revision,writeId:o.writeId}:{status:`conflict`};if(!(o?o.revision===n.expectedRevision&&(n.expectedWriteId===void 0||o.writeId===n.expectedWriteId)||n.expectedWriteIds?.includes(o.writeId)===!0:n.expectedRevision===0&&n.expectedWriteId===void 0)||(o?.revision??0)>t.revision)return r.abort(),{status:`conflict`};let s=Date.now(),c={key:a,ownerKey:ez(e),gatewayOwner:e.gatewayOwner,recoveryScope:e.recoveryScope,scopeKey:e.scopeKey,revision:t.revision,text:t.text,...t.goalMode?{goalMode:t.goalMode}:{},attachments:t.attachments,updatedAt:s,writeId:n.writeId};return i.put(c),await lz(i,c.ownerKey,s),await Uc(r),{status:`persisted`,revision:t.revision,writeId:n.writeId}}catch{return{status:`storage-failed`}}}async function hz(e,t=0,n){try{let r=(await $R()).transaction(vz,`readwrite`),i=r.objectStore(vz),a=Date.now(),o=await gz(i,e,t,n,a);return o.status===`conflict`?(r.abort(),o):(await lz(i,ez(e),a),await Uc(r),o)}catch{return{status:`storage-failed`}}}async function gz(e,t,n,r,i){let a=tz(t),o=iz(await Hc(e.get(a)));if(r!==void 0&&(o?.revision??0)>=r)return{status:`conflict`};let s=nz(Math.max(n,o?.revision??0)),c=`retired:${s}`;return e.put({key:a,ownerKey:ez(t),gatewayOwner:t.gatewayOwner,recoveryScope:t.recoveryScope,scopeKey:t.scopeKey,revision:s,text:``,attachments:[],updatedAt:i,writeId:c}),{status:`persisted`,revision:s,writeId:c}}async function _z(e,t){try{let n=(await $R()).transaction(vz,`readwrite`),r=n.objectStore(vz),i=Date.now();for(let n of t)await gz(r,{...e,scopeKey:n.scopeKey},n.minimumRevision,n.retireBeforeRevision,i);return await lz(r,ez({...e,scopeKey:``}),i),await Uc(n),`completed`}catch{return`storage-failed`}}var vz,yz,bz,xz,Sz,Cz,wz,Tz;function Ez(){return(Ez=t((()=>{Xc(),pl(),cu(),vz=`composerDrafts`,yz=`ownerKey`,bz=`chat:v3:`,xz=6048e5,Sz=20,Cz=26214400,wz=0,Tz=null})))()}function Dz(){return(Dz=t((()=>{Pc()})))()}function Oz(e){if(typeof e==`boolean`)return e;let t=y(e)?.enabled;return typeof t==`boolean`?t:void 0}function kz(e,t){let n=y(e),i=Oz(y(n?.tools)?.swarm),a=y(n?.agents),o=y(a?.entries),s=t?r(t):null,c=s?Object.keys(o??{}).find(e=>r(e)===s):null,l=c?y(o?.[c]):null;return Oz(y(l?.tools)?.swarm)??i??!1}function Az(e,t){return(e.updatedAt??0)>=(t.updatedAt??0)}function jz(e,t){let n=new Map;for(let r of[...e,...t]){let e=n.get(r.key);(!e||Az(r,e))&&n.set(r.key,r)}return[...n.values()]}async function Mz(e){let t=await iS({sessions:e.sessions,parentKey:e.parentKey,isCurrent:e.isCurrent,pageSize:Nz});return t?jz(e.currentRows,t):null}var Nz,Pz;function Fz(){return(Fz=t((()=>{oS(),O(),Nz=1e4,Pz=class{constructor(){this.rows=[],this.key=``,this.revision=-1,this.generation=0,this.attemptRevision=-1,this.attempts=0,this.timer=null}update(e){let t=`${e.sourceEpoch}:${e.parentKey}`;this.key!==t&&this.reset(t),this.rows=jz(this.rows,e.currentRows()),e.onRows(this.rows);let n=e.sessions.canonicalListRevision;this.attemptRevision!==n&&(this.attemptRevision=n,this.attempts=0),this.revision!==n&&this.timer===null&&(this.timer=setTimeout(()=>this.hydrate(e),250))}dispose(){this.reset(``)}hydrate(e){let t=this.generation,n=e.sessions.canonicalListRevision,r=`${e.sourceEpoch}:${e.parentKey}`,i=()=>t===this.generation&&this.key===r,a=e.currentRows(),o=new Map(a.map(e=>[e.key,JSON.stringify(e)])),s=!1,c=!1;this.attempts+=1,Mz({sessions:e.sessions,parentKey:e.parentKey,currentRows:a,isCurrent:i}).then(t=>{if(!t||!i())return;s=!0,this.revision=n;let r=e.currentRows().filter(e=>o.get(e.key)!==JSON.stringify(e));this.rows=jz(t,r),e.onRows(this.rows)}).catch(()=>{if(!i())return;c=!0;let t=Math.min(3e4,1e3*2**Math.min(this.attempts-1,5));this.timer=setTimeout(()=>{this.timer=null,i()&&this.update(e)},t)}).finally(()=>{i()&&(c||(this.timer=null),s&&this.revision!==e.sessions.canonicalListRevision&&this.update(e))})}reset(e){this.timer!==null&&clearTimeout(this.timer),this.rows=[],this.key=e,this.revision=-1,this.generation+=1,this.attemptRevision=-1,this.attempts=0,this.timer=null}}})))()}function Iz(e,t={}){let n=t.wide?`settings-page settings-page--wide`:`settings-page`;return F`<div class=${n}>${e}</div>`}function Lz(e,t){return F`<a href=${e} target=${Ct} rel=${Ot()}
|
|
>${t}</a
|
|
>`}function Rz(e){let t=e.icon===`info`?H.info:H.circleQuestionMark;return F`
|
|
<openclaw-tooltip .content=${e.tooltip}>
|
|
<button
|
|
id=${e.id}
|
|
type="button"
|
|
class="settings-section__help-button"
|
|
aria-label=${e.label}
|
|
aria-controls=${e.popoverId}
|
|
aria-haspopup="dialog"
|
|
>
|
|
<span aria-hidden="true">${t}</span>
|
|
</button>
|
|
</openclaw-tooltip>
|
|
`}function zz(e){return F`<a
|
|
class="learn-more-link"
|
|
href=${e}
|
|
target=${Ct}
|
|
rel=${Ot()}
|
|
>${W(`common.learnMore`)}</a
|
|
>`}function Bz(e){return F`
|
|
<section class="content-header">
|
|
<div>
|
|
<div class="page-title">${e.title}</div>
|
|
${e.subtitle?F`<div class="page-subtitle">${e.subtitle}</div>`:P}
|
|
</div>
|
|
${e.actions?F`<div class="page-header-actions">${e.actions}</div>`:P}
|
|
</section>
|
|
`}function Vz(e,t){let n=e.description?F`<p class="settings-section__desc">${e.description}</p>`:P,r=e.title||e.description?F`
|
|
<div class="settings-section__copy">
|
|
${e.title?F`
|
|
<h2 class="settings-section__heading">
|
|
${e.title}${e.count===void 0?P:F` <span class="settings-count">${e.count}</span>`}
|
|
</h2>
|
|
`:P}
|
|
${n}
|
|
</div>
|
|
`:P,i=r||e.actions?F`
|
|
<div class="settings-section__header">
|
|
${r}
|
|
${e.actions?F`<div class="settings-section__actions">${e.actions}</div>`:P}
|
|
</div>
|
|
`:P,a=e.danger?`settings-group settings-group--danger`:`settings-group`;return F`
|
|
<section class="settings-section">
|
|
${i}
|
|
<div class=${a}>${t}</div>
|
|
</section>
|
|
`}function Hz(e,t={}){let n=t.danger?`settings-group settings-group--danger`:`settings-group`;return F`<div class=${n}>${e}</div>`}function Uz(e){let t=e.stacked?`settings-row settings-row--stacked`:e.stackedOnNarrow?`settings-row settings-row--stacked-on-narrow`:`settings-row`;return F`
|
|
<div class=${t}>
|
|
<div class="settings-row__text">
|
|
<span class="settings-row__title">${e.title}</span>
|
|
${e.description?F`<span class="settings-row__desc">${e.description}</span>`:P}
|
|
</div>
|
|
${e.control!==void 0&&e.control!==P?F`<div class="settings-row__control">${e.control}</div>`:P}
|
|
</div>
|
|
`}function Wz(e){return F`
|
|
<button type="button" class="settings-row settings-row--nav" @click=${e.onClick}>
|
|
<div class="settings-row__text">
|
|
<span class="settings-row__title">${e.title}</span>
|
|
${e.description?F`<span class="settings-row__desc">${e.description}</span>`:P}
|
|
</div>
|
|
<div class="settings-row__control">
|
|
${e.control??P}
|
|
<span class="settings-row__chevron">${H.chevronRight}</span>
|
|
</div>
|
|
</button>
|
|
`}function Gz(e){return F`
|
|
<wa-switch
|
|
class="settings-toggle"
|
|
size="s"
|
|
.checked=${Gn(e.checked)}
|
|
?disabled=${e.disabled??!1}
|
|
@change=${t=>{let n=t.currentTarget;e.onChange(n.checked)===!1&&(n.checked=e.checked)}}
|
|
>
|
|
<span class="settings-control__sr-label">${e.ariaLabel}</span>
|
|
</wa-switch>
|
|
`}function Kz(e){let t=t=>{if(!t.composedPath().some(e=>e instanceof HTMLInputElement)||t instanceof KeyboardEvent&&t.key!==`ArrowLeft`&&t.key!==`ArrowRight`)return;let n=t.currentTarget.checked;n!==e.checked&&e.onAct?.(n)};return F`
|
|
<div
|
|
class="settings-row settings-row--toggle"
|
|
@click=${t=>{let n=t.target;if(e.disabled||n instanceof Element&&n.closest(`wa-switch`)!==null)return;let r=!e.checked;e.onAct?.(r),e.onChange(r)}}
|
|
>
|
|
<div class="settings-row__text">
|
|
<span class="settings-row__title">${e.title}</span>
|
|
${e.description?F`<span class="settings-row__desc">${e.description}</span>`:P}
|
|
</div>
|
|
<div class="settings-row__control">
|
|
<wa-switch
|
|
class="settings-toggle"
|
|
size="s"
|
|
.checked=${Gn(e.checked)}
|
|
?disabled=${e.disabled??!1}
|
|
@click=${t}
|
|
@keydown=${t}
|
|
@change=${t=>{let n=t.currentTarget;e.onChange(n.checked)===!1&&(n.checked=e.checked)}}
|
|
>
|
|
<span class="settings-control__sr-label">${e.ariaLabel??e.title}</span>
|
|
</wa-switch>
|
|
</div>
|
|
</div>
|
|
`}function qz(e,t){return F`${W(t?`configForm.defaultValue`:`configForm.usingDefault`,{value:e})}`}function Jz(e){return F`
|
|
<wa-radio-group
|
|
class="settings-segmented ${e.className??``}"
|
|
size="s"
|
|
orientation="horizontal"
|
|
.value=${Gn(e.value)}
|
|
?disabled=${e.disabled??!1}
|
|
@change=${t=>{let n=t.currentTarget.value;if(n!==void 0){let r=t.currentTarget,i=[...r.querySelectorAll(`wa-radio`)].find(e=>e.getAttribute(`value`)===n);e.onChange(n,i??r)}}}
|
|
>
|
|
${e.ariaLabel?F`<span slot="label" class="settings-control__sr-label">${e.ariaLabel}</span>`:P}
|
|
${e.options.map(t=>F`
|
|
<wa-radio
|
|
class="settings-segmented__btn ${t.value===e.value?`settings-segmented__btn--active`:``}"
|
|
appearance="button"
|
|
value=${t.value}
|
|
.checked=${Gn(t.value===e.value)}
|
|
title=${t.title??P}
|
|
data-test-id=${t.testId??P}
|
|
@click=${n=>{t.value===e.value&&n.currentTarget instanceof HTMLElement&&e.onReselect?.(t.value,n.currentTarget)}}
|
|
>
|
|
${t.label}
|
|
</wa-radio>
|
|
`)}
|
|
</wa-radio-group>
|
|
`}function Yz(e){let t=e.kind===`muted`?``:` settings-status--${e.kind}`;return F`
|
|
<span class="settings-status${t}">
|
|
${e.dot===!1?P:F`<span class="settings-status__dot"></span>`}
|
|
${e.label}
|
|
</span>
|
|
`}function Xz(e,t={}){let n=t.mono?`settings-row__value settings-row__value--mono`:`settings-row__value`;return F`<span class=${n}>${e}</span>`}function Zz(e){return F`<div class="settings-empty">${e}</div>`}function Qz(e){return F`
|
|
<span class="settings-secret">
|
|
<input
|
|
class="settings-input"
|
|
type=${e.visible?`text`:`password`}
|
|
aria-label=${e.ariaLabel}
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
.value=${e.value}
|
|
placeholder=${e.placeholder??``}
|
|
?disabled=${e.disabled??!1}
|
|
@input=${t=>e.onInput(t.target.value)}
|
|
/>
|
|
<openclaw-tooltip .content=${e.visible?e.hideLabel:e.showLabel}>
|
|
<button
|
|
type="button"
|
|
class="settings-secret__toggle"
|
|
aria-label=${e.toggleLabel}
|
|
aria-pressed=${e.visible}
|
|
?disabled=${e.disabled??!1}
|
|
@click=${e.onToggle}
|
|
>
|
|
${e.visible?H.eye:H.eyeOff}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
</span>
|
|
`}function $z(){return($z=t((()=>{va(),xa(),ua(),I(),Pn(),V(),en(),U(),ri()})))()}function eB(e=`smooth`){return e===`smooth`&&typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:e}function tB(){return(tB=t((()=>{})))()}function nB(e){let t=new Map,n=Ub(),r=e.snapshot.client,i=null,a=null,o=null,s=0,c=0,l=!1,u=0,d=!1,f=null,p=null,m=()=>t.size>0,h=()=>{let n=e.snapshot.hello,r=new Set;for(let e of t.values())for(let t of e){let e=gt(t,n).trim();e&&r.add(e)}return[...r].toSorted().slice(0,32)},g=()=>x(),_=()=>{n.reset(),x()},v=()=>{d||(d=!0,r=e.snapshot.client,i=null,a=null,o=null,s=0,f=e.subscribe(g),typeof document<`u`&&(document.addEventListener(`visibilitychange`,_),p=document))},y=()=>{d&&(d=!1,f?.(),f=null,p?.removeEventListener(`visibilitychange`,_),p=null,n.reset(),c+=1,u+=1,l=!1,i=null,a=null,o=null,s=0)};function b(){if(l=!1,!d)return;let t=e.snapshot,u=t.client;if(u!==r&&(n.reset(),r=u,i=null,a=null,o=null,s=0),t.phase!==`connected`||u===null||t.hello===null||Na(t,iB)!==!0){i=null,a=null,o=null,s=0,m()||y();return}let f=typeof document<`u`&&document.visibilityState===`hidden`?[]:h(),p=f.some(e=>!e.startsWith(`agent:`))?t.assistantAgentId:void 0,g=JSON.stringify({agentId:p,sessionKeys:f});if(t.hello===i&&g===a){!m()&&o===g&&s===c&&y();return}i=t.hello,a=g;let _=++c,v=()=>d&&_===c&&t.hello===i&&g===a;n.cancel(),u.request(iB,{...p?{agentId:p}:{},sessionKeys:f}).then(()=>{v()&&(o=g,s=_,n.reset(),m()||y())}).catch(()=>{v()&&(a=null,n.schedule(()=>{d&&x()}))})}function x(){if(!d||l)return;l=!0;let e=u;globalThis.queueMicrotask(()=>{e===u&&b()})}let S=(e,r)=>{let i=new Set(r.map(e=>e.trim()).filter(Boolean)),a=t.get(e);(a===void 0?i.size===0:a.size===i.size&&[...i].every(e=>a.has(e)))||(i.size===0?t.delete(e):t.set(e,i),n.reset(),m()?(v(),x()):d&&b())};return{watch:S,unwatch:e=>S(e,[])}}function rB(e){let t=aB.get(e);if(t)return t;let n=nB(e);return aB.set(e,n),n}var iB,aB;function oB(){return(oB=t((()=>{Fa(),Kb(),ze(),iB=`sessions.viewers.set`,aB=new WeakMap})))()}function sB(e){return typeof e==`string`?Ka(e):void 0}function cB(e,t={}){let n=p(e),r=p(n?.messages),i=p(r?.queue),a=sB(p(i?.byChannel)?.webchat)??sB(i?.mode),o=sB(t.effectiveMode),s=sB(t.sessionMode);if(s)return s;if(t.configNeedsApply)return o;if(!(t.sessionMetadataLoaded===!1&&!o)&&!(!n&&!o))return a??o??`steer`}function lB(e,t){return cr(e)??t}function uB(){return(uB=t((()=>{Ja(),cs(),Zn()})))()}function dB(e){let t=Ne(e??``);return!!(t&&TB.has(t))}function fB(e){return Object.hasOwn(e.modelOverrides,e.sessionKey)?e.modelOverrides[e.sessionKey]==null?null:`user`:e.activeSession?.modelOverrideSource}function pB(e){let t=e.chatModelCatalog??[],n=e.modelOverrides;if(Object.hasOwn(n,e.sessionKey))return rn(n[e.sessionKey],t);let r=e.activeSession;return ot(r?.model,r?.modelProvider,t)}function mB(e){return ot(e.agentDefaultModel,void 0,e.chatModelCatalog??[])||ot(e.sessionsResult?.defaults?.model,e.sessionsResult?.defaults?.modelProvider,e.chatModelCatalog??[])}function hB(e){let t=e.trim().toLowerCase(),n=t.indexOf(`/`);return n<=0?t:`${Ne(t.slice(0,n))}/${t.slice(n+1)}`}function gB(e,t){let n=e.trim().toLowerCase();if(!n)return e;let r=hB(e);for(let e of[!1,!0]){let i=t.find(t=>!!t.disabled===e&&(t.value.trim().toLowerCase()===n||hB(t.value)===r));if(i)return i.value}return e}function _B(e,t){let n=new Set,r=[];for(let i of e.toSorted((e,t)=>Number(e.available===!1)-Number(t.available===!1)||Number(e.provider.trim().toLowerCase()!==Ne(e.provider))-Number(t.provider.trim().toLowerCase()!==Ne(t.provider)))){let e=tt(i,t),a=e.value.trim(),o=a.toLowerCase();!a||n.has(o)||(n.add(o),r.push({...e,...i.available===!1?{disabled:!0,unavailableReason:i.unavailableReason}:{}}))}return r}function vB(e,t,n){let r=hB(ot(e,t,n)),i=n.filter(e=>hB(it(e.id,e.provider))===r);if(!(!i.length||i.some(e=>e.available!==!1||!e.unavailableReason)))return i.some(e=>e.unavailableReason===`cooldown`)?`cooldown`:i.some(e=>e.unavailableReason===`auth-failed`)?`auth-failed`:`missing-auth`}function yB(e){return e===`missing-auth`?W(`modelSetup.missingAuth`):e===`auth-failed`?`${W(`modelSetup.failure.auth`)}. ${W(`modelSetup.failureGuidance.auth`)}`:void 0}function bB(e){let t=e.chatModelCatalog??[],n=new Set(t.filter(e=>e.available!==!1).map(e=>hB(it(e.id,e.provider)))),r=t.filter(e=>e.available!==!1||!n.has(hB(it(e.id,e.provider)))),i=je(r),a=_B(r,i),o=gB(pB(e),a),s=gB(mB(e),a),c=Ae(s,i);return{currentOverride:o,defaultModel:s,defaultLabel:s?`Default (${c})`:`Default model`,modelOverrideSource:fB(e),options:a}}function xB(e){if(e===`auto`)return`auto`;if(e===`on`)return!0;if(e===`off`)return!1}function SB(e){let t=e?.effectiveFastMode??e?.fastMode,n=t===`auto`?W(`chat.commandResults.fast.autoValue`,{seconds:String(e?.fastAutoOnSeconds??60)}):W(t===!0?`chat.commandResults.fast.on`:`chat.commandResults.fast.off`),r=e?.effectiveFastModeSource,i=r===`session`?W(`chat.commandResults.fast.sourceSession`):r===`agent`?W(`chat.commandResults.fast.sourceAgent`):r===`config`?W(`chat.commandResults.fast.sourceModel`):r==="default"?W(`chat.commandResults.fast.sourceDefault`):``;return`${W(`chat.commandResults.fast.current`,{value:n})}${i}.`}function CB(e,t,n,r){let i=e.trim().toLowerCase();if(!i)return n??r;let a=new Set,o=new Set,s=!1;for(let e of t){let t=e.id.trim().toLowerCase()===i,n=it(e.id,e.provider).trim().toLowerCase()===i;if(!t&&!n)continue;s=!0;let r=Ne(e.provider);r&&(t&&a.add(r),n&&o.add(r))}return o.size===1?[...o][0]??null:n&&a.has(n)&&!o.has(n)?n:a.size===1?[...a][0]??null:s?null:n??r}function wB(e){let t=e.fastModeTarget,n=Ne(t?.modelProvider??``)||null,r=Ne(e.sessionsResult?.defaults?.modelProvider??``)||null,i=CB(e.currentModelOverride,e.catalog,n,r),a=t?.fastMode===`auto`?`auto`:t?.fastMode===!0?`on`:t?.fastMode===!1?`off`:``,o=i===`openai`,s=t?.effectiveFastMode??t?.fastMode,c=o?s===!0?`on`:s===`auto`?`auto`:`off`:a,l=dB(i),u=l||!!a,d=s===!0||s===`auto`,f=s===`auto`?`Auto`:d?`Fast`:o||c===`off`?`Standard`:`Default`,p=l?d?`off`:`on`:``;return{active:d,currentOverride:c,disabled:!u||!e.connected||e.loading||e.sending||!!e.activeRunId||e.stream!==null||!e.gatewayAvailable,label:f,nextValue:p,supported:u}}var TB;function EB(){return(EB=t((()=>{V(),Ie(),TB=new Set([`anthropic`,`minimax`,`minimax-portal`,`openai`,`xai`])})))()}function DB(e,t,n){let r=p(n)??lr(ir(e?.snapshot)??[],t?.trim());return r?hl({id:r.id??r.email,name:r.name,identity:r.identity,profileAvatarUrl:r.avatarUrl}):null}function OB(){return(OB=t((()=>{_l()})))()}function kB(e){return e.split(`;`,1)[0]?.trim().toLowerCase()??``}function AB(e){let t=/^data:([^,]*)/i.exec(e)?.[1];return t===void 0?void 0:kB(t)}var jB,MB,NB,PB;function FB(){return(FB=t((()=>{ca(),I(),R(),V(),M(),U(),ui(),jB=new Set([`image/avif`,`image/gif`,`image/jpeg`,`image/png`,`image/webp`]),MB=4,NB=2.5,PB=class extends $t{constructor(...e){super(...e),this.mediaKind=`image`,this.src=``,this.originalSrc=``,this.imageTitle=``,this.openOriginalUrl=``,this.scale=1,this.imageReady=!1,this.originalBlobUrl=``,this.originalUrlRequest=0,this.handleImageLoad=e=>{let t=e.currentTarget;t instanceof HTMLImageElement&&t===this.image&&this.initializePanzoom(t)},this.handleImageError=e=>{e.currentTarget===this.image&&(this.destroyPanzoom(),this.scale=1,this.imageReady=!1)},this.handlePanzoomChange=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail;typeof t!=`object`||!t||!(`scale`in t)||typeof t.scale!=`number`||(this.scale=t.scale)},this.handleWheel=e=>{this.panzoom&&(e.preventDefault(),this.panzoom.zoomWithWheel(e))},this.handleDoubleClick=e=>{if(this.panzoom){if(e.preventDefault(),this.scale>1){this.resetZoom();return}this.panzoom?.zoomToPoint(NB,e)}},this.handleStagePointerDown=e=>{let t=e.currentTarget;if(e.button!==0||!e.isPrimary||e.target!==t||!(t instanceof HTMLElement)){this.backdropPointer=void 0;return}this.backdropPointer={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY},t.setPointerCapture?.(e.pointerId)},this.handleStagePointerUp=e=>{let t=this.backdropPointer;this.backdropPointer=void 0;let n=e.currentTarget,r=this.shadowRoot?.elementFromPoint?.(e.clientX,e.clientY);e.button===0&&e.isPrimary&&t?.pointerId===e.pointerId&&r===n&&Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)<=4&&this.emitClose()},this.resetBackdropPointer=()=>{this.backdropPointer=void 0},this.handleMotionPreferenceChange=e=>{this.panzoom?.setOptions({duration:e.matches?0:200})},this.zoomIn=()=>this.panzoom?.zoomIn(),this.zoomOut=()=>this.panzoom?.zoomOut(),this.resetZoom=()=>this.panzoom?.reset({animate:!1}),this.handleKeydown=e=>{if(this.panzoom&&(e.key===`+`||e.key===`=`)){e.preventDefault(),this.zoomIn();return}if(this.panzoom&&e.key===`-`){e.preventDefault(),this.zoomOut();return}if(this.panzoom&&e.key===`0`){e.preventDefault(),this.resetZoom();return}if(e.key!==`Tab`)return;let t=[...this.focusables].filter(e=>!(e instanceof HTMLButtonElement&&e.disabled)),n=t[0],r=t.at(-1);if(!n||!r)return;let i=e.composedPath()[0];e.shiftKey&&i===n?(e.preventDefault(),r.focus()):!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())},this.emitClose=()=>{this.dispatchEvent(new CustomEvent(`image-lightbox-close`,{bubbles:!0,composed:!0}))}}static{this.styles=Bn`
|
|
:host {
|
|
--image-lightbox-control-background: rgba(12, 16, 24, 0.64);
|
|
--image-lightbox-control-background-hover: rgba(12, 16, 24, 0.78);
|
|
display: contents;
|
|
}
|
|
|
|
:host-context([data-theme-mode="dark"]) {
|
|
--image-lightbox-control-background: rgba(255, 255, 255, 0.16);
|
|
--image-lightbox-control-background-hover: rgba(255, 255, 255, 0.22);
|
|
}
|
|
|
|
openclaw-modal-dialog {
|
|
--openclaw-modal-width: 100vw;
|
|
--openclaw-modal-max-width: 100vw;
|
|
--openclaw-modal-max-height: 100dvh;
|
|
--openclaw-modal-backdrop-filter: none;
|
|
}
|
|
|
|
.lightbox {
|
|
width: 100vw;
|
|
height: 100dvh;
|
|
display: grid;
|
|
grid-template-rows: minmax(0, 1fr);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.header {
|
|
display: contents;
|
|
}
|
|
|
|
.actions {
|
|
position: fixed;
|
|
z-index: 1;
|
|
top: max(16px, calc(12px + var(--safe-area-top, 0px)));
|
|
right: max(16px, calc(12px + var(--safe-area-right, 0px)));
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.actions .action,
|
|
.action.zoom-control {
|
|
color: var(--media-foreground);
|
|
background-color: var(--image-lightbox-control-background);
|
|
-webkit-backdrop-filter: blur(16px) saturate(140%);
|
|
backdrop-filter: blur(16px) saturate(140%);
|
|
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
|
|
}
|
|
|
|
.actions .action {
|
|
border-radius: 999px;
|
|
transition: background-color 180ms ease;
|
|
}
|
|
|
|
.actions .action:hover,
|
|
.zoom-control:hover:not(:disabled) {
|
|
background-color: var(--image-lightbox-control-background-hover);
|
|
}
|
|
|
|
.title {
|
|
display: none;
|
|
}
|
|
|
|
.action {
|
|
min-height: 36px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 12px;
|
|
border: 0;
|
|
border-radius: var(--radius-md);
|
|
background: transparent;
|
|
color: #fff;
|
|
font: inherit;
|
|
font-size: 12px;
|
|
font-weight: 650;
|
|
text-decoration: none;
|
|
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
|
|
}
|
|
|
|
.action:hover {
|
|
background: color-mix(in srgb, var(--text) 10%, transparent);
|
|
}
|
|
|
|
.action:focus-visible {
|
|
outline: 2px solid #fff;
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
.action:focus:not(:focus-visible) {
|
|
outline: none;
|
|
}
|
|
|
|
.open-original {
|
|
min-height: 44px;
|
|
}
|
|
|
|
.open-original-icon {
|
|
display: none;
|
|
}
|
|
|
|
.close {
|
|
width: 44px;
|
|
height: 44px;
|
|
padding: 0;
|
|
color: rgba(255, 255, 255, 0.82);
|
|
}
|
|
|
|
.close svg {
|
|
width: 17px;
|
|
height: 17px;
|
|
/* Shadow DOM: global icon stroke rules don't reach in here; without a
|
|
stroke the open-path x icon renders invisible. */
|
|
fill: none;
|
|
stroke: currentColor;
|
|
stroke-width: 2;
|
|
stroke-linecap: round;
|
|
stroke-linejoin: round;
|
|
}
|
|
|
|
.stage {
|
|
min-height: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: grid;
|
|
place-items: center;
|
|
box-sizing: border-box;
|
|
padding: 20px 20px 72px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.image,
|
|
.video {
|
|
display: block;
|
|
min-width: 0;
|
|
min-height: 0;
|
|
max-width: 100%;
|
|
max-height: 100%;
|
|
height: auto;
|
|
object-fit: contain;
|
|
}
|
|
|
|
.image {
|
|
width: auto;
|
|
cursor: zoom-in;
|
|
-webkit-user-drag: none;
|
|
}
|
|
|
|
.video {
|
|
width: min(1280px, 100%);
|
|
background: var(--media-bg);
|
|
}
|
|
|
|
.image.zoomed {
|
|
cursor: grab;
|
|
}
|
|
|
|
.zoom-controls {
|
|
position: fixed;
|
|
z-index: 1;
|
|
bottom: max(14px, calc(10px + var(--safe-area-bottom, 0px)));
|
|
left: 50%;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
transform: translateX(-50%);
|
|
}
|
|
|
|
.zoom-control {
|
|
min-width: 40px;
|
|
min-height: 40px;
|
|
padding: 0 10px;
|
|
border: 0;
|
|
font-size: 15px;
|
|
}
|
|
|
|
.zoom-control:disabled {
|
|
color: rgba(255, 255, 255, 0.8);
|
|
}
|
|
|
|
.zoom-level {
|
|
min-width: 58px;
|
|
font-size: 11px;
|
|
}
|
|
|
|
@media (max-width: 768px),
|
|
(max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
|
|
openclaw-modal-dialog {
|
|
--openclaw-modal-width: 100vw;
|
|
--openclaw-modal-max-width: 100vw;
|
|
--openclaw-modal-max-height: 100dvh;
|
|
}
|
|
|
|
.lightbox {
|
|
width: 100vw;
|
|
height: 100dvh;
|
|
}
|
|
|
|
.stage {
|
|
padding: calc(68px + var(--safe-area-top, 0px)) calc(12px + var(--safe-area-right, 0px))
|
|
calc(64px + var(--safe-area-bottom, 0px)) calc(12px + var(--safe-area-left, 0px));
|
|
}
|
|
|
|
.open-original {
|
|
width: 44px;
|
|
padding: 0;
|
|
}
|
|
|
|
.open-original-label {
|
|
display: none;
|
|
}
|
|
|
|
.open-original-icon {
|
|
display: inline-flex;
|
|
}
|
|
|
|
.open-original-icon svg {
|
|
width: 17px;
|
|
height: 17px;
|
|
}
|
|
|
|
.zoom-control {
|
|
min-width: 44px;
|
|
min-height: 44px;
|
|
}
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
openclaw-modal-dialog {
|
|
--show-duration: 0ms;
|
|
--hide-duration: 0ms;
|
|
}
|
|
|
|
.actions .action {
|
|
transition: none;
|
|
}
|
|
}
|
|
`}connectedCallback(){super.connectedCallback(),this.motionQuery=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`),this.motionQuery?.addEventListener(`change`,this.handleMotionPreferenceChange),this.hasUpdated&&(this.resolveOriginalUrl(),this.updateComplete.then(()=>{let e=this.image;e?.complete&&e.naturalWidth>0&&this.initializePanzoom(e)}))}disconnectedCallback(){this.originalUrlRequest+=1,this.motionQuery?.removeEventListener(`change`,this.handleMotionPreferenceChange),this.motionQuery=void 0,this.destroyPanzoom(),this.revokeOriginalBlobUrl(),super.disconnectedCallback()}updated(e){(e.has(`src`)||e.has(`originalSrc`)||e.has(`mediaKind`))&&(this.destroyPanzoom(),this.scale=1,this.resolveOriginalUrl())}render(){let e=this.imageTitle.trim()||W(`chat.imageLightbox.untitled`),t=this.mediaKind===`video`?W(`chat.mediaPlayer.videoPreview`,{title:e}):W(`chat.imageLightbox.label`,{title:e}),n=this.mediaKind===`video`?W(`chat.mediaPlayer.closeVideoPreview`):W(`chat.imageLightbox.close`),r=this.imageReady&&this.panzoom!==void 0;return F`
|
|
<openclaw-modal-dialog
|
|
class="mobile-edge-to-edge viewport-edge-to-edge"
|
|
label=${t}
|
|
@modal-cancel=${this.emitClose}
|
|
@keydown=${this.handleKeydown}
|
|
>
|
|
<section class="lightbox">
|
|
<header class="header">
|
|
<strong class="title">${e}</strong>
|
|
<div class="actions">
|
|
${this.openOriginalUrl?F`
|
|
<a
|
|
class="action open-original"
|
|
href=${this.openOriginalUrl}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
aria-label=${W(`chat.imageLightbox.openOriginal`)}
|
|
>
|
|
<span class="open-original-label">
|
|
${W(`chat.imageLightbox.openOriginal`)}
|
|
</span>
|
|
<span class="open-original-icon" aria-hidden="true">
|
|
${H.externalLink}
|
|
</span>
|
|
</a>
|
|
`:P}
|
|
<button
|
|
class="action close"
|
|
type="button"
|
|
autofocus
|
|
aria-label=${n}
|
|
@click=${this.emitClose}
|
|
>
|
|
${H.x}
|
|
</button>
|
|
</div>
|
|
</header>
|
|
<div
|
|
class="stage"
|
|
@pointerdown=${this.handleStagePointerDown}
|
|
@pointerup=${this.handleStagePointerUp}
|
|
@pointercancel=${this.resetBackdropPointer}
|
|
@dblclick=${this.handleDoubleClick}
|
|
>
|
|
${this.mediaKind===`video`?F`<video
|
|
class="video"
|
|
src=${this.src}
|
|
aria-label=${e}
|
|
controls
|
|
autoplay
|
|
playsinline
|
|
tabindex="0"
|
|
></video>`:F`<img
|
|
class=${this.scale>1?`image zoomed`:`image`}
|
|
src=${this.src}
|
|
alt=${e}
|
|
@load=${this.handleImageLoad}
|
|
@error=${this.handleImageError}
|
|
@dragstart=${e=>e.preventDefault()}
|
|
/>`}
|
|
</div>
|
|
${this.mediaKind===`image`?F`<div class="zoom-controls">
|
|
<button
|
|
class="action zoom-control"
|
|
type="button"
|
|
aria-label=${W(`chat.imageLightbox.zoomOut`)}
|
|
?disabled=${!r||this.scale<=1}
|
|
@click=${this.zoomOut}
|
|
>
|
|
−
|
|
</button>
|
|
<button
|
|
class="action zoom-control zoom-level"
|
|
type="button"
|
|
aria-label=${W(`chat.imageLightbox.resetZoom`)}
|
|
?disabled=${!r||this.scale===1}
|
|
@click=${this.resetZoom}
|
|
>
|
|
${Math.round(this.scale*100)}%
|
|
</button>
|
|
<button
|
|
class="action zoom-control"
|
|
type="button"
|
|
aria-label=${W(`chat.imageLightbox.zoomIn`)}
|
|
?disabled=${!r||this.scale>=MB}
|
|
@click=${this.zoomIn}
|
|
>
|
|
+
|
|
</button>
|
|
</div>`:P}
|
|
</section>
|
|
</openclaw-modal-dialog>
|
|
`}initializePanzoom(e){let t=this.stage;!t||e!==this.image||(this.destroyPanzoom(),this.panzoomImage=e,this.panzoomStage=t,this.panzoom=Ea(e,{duration:this.motionQuery?.matches?0:200,maxScale:MB,minScale:1,panOnlyWhenZoomed:!0}),e.addEventListener(`panzoomchange`,this.handlePanzoomChange),t.addEventListener(`wheel`,this.handleWheel,{passive:!1}),this.imageReady=!0)}destroyPanzoom(){let e=this.panzoomImage;e?.removeEventListener(`panzoomchange`,this.handlePanzoomChange),this.panzoomStage?.removeEventListener(`wheel`,this.handleWheel),this.panzoom?.destroy(),this.panzoom?.resetStyle(),e?.style.removeProperty(`transform`),e?.style.removeProperty(`transition`),this.panzoom=void 0,this.panzoomImage=void 0,this.panzoomStage=void 0,this.imageReady=!1}revokeOriginalBlobUrl(){this.originalBlobUrl&&=(URL.revokeObjectURL(this.originalBlobUrl),``)}async resolveOriginalUrl(){let e=++this.originalUrlRequest;this.revokeOriginalBlobUrl();let t=(this.originalSrc||this.src).trim();if(!t){this.openOriginalUrl=``;return}let n=t.slice(0,5).toLowerCase(),r=n===`data:`,i=n===`blob:`;if(!r&&!i){this.openOriginalUrl=t;return}this.openOriginalUrl=``;let a=r?AB(t):void 0;if(!(r&&(!a||!jB.has(a))))try{let n=await(await fetch(t)).blob();if(!this.isConnected||e!==this.originalUrlRequest||!jB.has(kB(n.type)))return;if(i){this.openOriginalUrl=t;return}this.originalBlobUrl=URL.createObjectURL(n),this.openOriginalUrl=this.originalBlobUrl}catch{}}},S([z()],PB.prototype,`mediaKind`,void 0),S([z()],PB.prototype,`src`,void 0),S([z()],PB.prototype,`originalSrc`,void 0),S([z({attribute:!1})],PB.prototype,`imageTitle`,void 0),S([In(`.stage`)],PB.prototype,`stage`,void 0),S([In(`.image`)],PB.prototype,`image`,void 0),S([wn(`.action, video[controls]`)],PB.prototype,`focusables`,void 0),S([B()],PB.prototype,`openOriginalUrl`,void 0),S([B()],PB.prototype,`scale`,void 0),S([B()],PB.prototype,`imageReady`,void 0),customElements.get(`openclaw-image-lightbox`)||customElements.define(`openclaw-image-lightbox`,PB)})))()}function IB(e){let t=e.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`).split(`
|
|
`);return t.at(-1)===``&&t.pop(),t}function LB(e,t){for(let n of e)if((n.kind===`add`||n.kind===`ctx`)&&n.lineNo!==void 0&&t[n.lineNo-1]!==n.text)return!1;return!0}function RB(e,t,n){return Array.from({length:n},(n,r)=>({kind:`ctx`,lineNo:t+r,text:e[t+r-1]}))}function zB(e,t,n,r,i){let a=e.findIndex(e=>e.kind===`skip`&&e.gap===t),o=t.newStart+t.count-1;if(a<0||t.newStart<1||t.count<1||o>n.length||!LB(e,n))return null;let s=r===`all`||t.count<=VB?t.count:Math.min(BB,t.count),c=t.count-s,l=RB(n,r===`up`?t.newStart+c:t.newStart,s),u=[];return r===`up`&&c>0&&u.push({kind:`skip`,text:i(c),gap:{...t,count:c}}),u.push(...l),r!==`up`&&c>0&&u.push({kind:`skip`,text:i(c),gap:{oldStart:t.oldStart+s,newStart:t.newStart+s,count:c}}),[...e.slice(0,a),...u,...e.slice(a+1)]}var BB,VB;function HB(){return(HB=t((()=>{BB=20,VB=25})))()}function UB(e,t,n=WB){let r=[],i=!1,a=!1,o=0,s=0,c,l,u=e.replace(/\r\n/g,`
|
|
`).split(`
|
|
`);u.at(-1)===``&&u.pop();for(let e of u){let u=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);if(u){let e=Number.parseInt(u[1]??``,10),n=Number.parseInt(u[2]??``,10),i=c===void 0?e-1:e-c;i>0&&r.push({kind:`skip`,text:t(i),gap:{oldStart:c??e-i,newStart:l??n-i,count:i}}),o=e,s=n,a=!0;continue}if(!(!a||e.startsWith(`\\`))){if(r.length>=n){i=!0;break}e.startsWith(`+`)?(r.push({kind:`add`,lineNo:s,text:e.slice(1)}),s+=1):e.startsWith(`-`)?(r.push({kind:`del`,lineNo:o,text:e.slice(1)}),o+=1):(r.push({kind:`ctx`,lineNo:s,text:e.slice(1)}),o+=1,s+=1),c=o,l=s}}return{lines:r,truncated:i}}var WB;function GB(){return(GB=t((()=>{WB=600})))()}function KB(e){let t=[];for(let n=0;n<e.length;){let r=e[n];if(!r)break;if(r.kind!==`add`&&r.kind!==`del`){t.push({kind:`span`,line:r}),n+=1;continue}let i=[],a=[];for(;n<e.length;){let t=e[n];if(t?.kind===`del`)i.push(t);else if(t?.kind===`add`)a.push(t);else break;n+=1}let o=Math.max(i.length,a.length);for(let e=0;e<o;e+=1)t.push({kind:`pair`,...i[e]?{left:i[e]}:{},...a[e]?{right:a[e]}:{}})}return t}function qB(){return(qB=t((()=>{})))()}function JB(e){let t=jt();if(!t)throw Error(`Browser storage is unavailable`);let n=ql(t,Rl(e.settings?.gatewayUrl));return{entries:Object.entries(n.recovery).filter(([,t])=>(t.session.queue??[]).every(t=>rl(e,t))).map(([e,t])=>Object.assign({},t,{id:e})),blocked:n.recoveryBlocked===!0}}function YB(e,t){let n=jt();if(!n||!yn(e)||e.selectedChatSessionIncognito||e.connected&&e.client&&!e.client.recoveryScopeReady)return null;let r=Rl(e.settings?.gatewayUrl),i=ql(n,r);Bl(i,e);let a=Wl(Vl(e,t.sessionKey,t.agentId)),o=i.sessions[a]??null;return{scope:t,gatewayOwner:r.gatewayOwner,recoveryScope:nl(e),session:JSON.stringify(o),revision:Math.max(o?.draftRevision??0,kl(n,r.key,a),Al(n,r.key,a))}}function XB(e,t,n,r=0){let i=jt();if(!i)return`storage-failed`;try{let a=YB(e,n.scope);if(!a||JSON.stringify(a)!==JSON.stringify(n))return`conflict`;let o=Rl(e.settings?.gatewayUrl),s=ql(i,o),{id:c,...l}=t;if(JSON.stringify(s.recovery[c])!==JSON.stringify(l)||!(t.session.queue??[]).every(t=>rl(e,t)))return`conflict`;let u=Vl(e,n.scope.sessionKey,n.scope.agentId);if(Wl(u)!==Wl(n.scope))return`conflict`;let d=Wl(u),f=s.sessions[d];if(f?.draft||f?.goalMode||f?.queue?.length)return`conflict`;let p=t.session;s.sessions[d]={...p,awaitingDefaults:void 0,draftRevision:El(Math.max(r,n.revision,p.draftRevision??0)),queue:p.queue?.map(e=>Object.assign({},e,u,{sendState:(e.sendAttempts??0)>0||e.sendState===`unconfirmed`?`unconfirmed`:`failed`,sendError:e.sendError??`Recovered message. Review this destination and retry only if it did not arrive.`}))},delete s.recovery[c],Yl(i,o,s);let m=ql(i,o);return m.recovery[c]||JSON.stringify(m.sessions[d])!==JSON.stringify(xl(s.sessions[d]))?`storage-failed`:(Il(),`restored`)}catch{return`storage-failed`}}function ZB(){return(ZB=t((()=>{O(),dl(),wl(),Pl(),cu()})))()}function QB(e){let t=JSON.parse(e),n=Object.create(null);if(t.avatars&&typeof t.avatars==`object`&&!Array.isArray(t.avatars))for(let[e,r]of Object.entries(t.avatars)){let t=w(e),i=w(r);t&&i&&(n[t]=i)}let r=w(t.avatar),i=w(t.agentId);return r&&i&&!Object.hasOwn(n,i)&&(n[i]=r),{avatars:n,legacyAvatar:i?null:r??null}}function $B(e,t){if(Object.keys(t).length===0){e?.removeItem(rV);return}e?.setItem(rV,JSON.stringify({avatars:t}))}function eV(e){let t=w(e?.agentId);if(!t)return{avatar:null};let n=A();try{let e=n?.getItem(rV);if(!e)return{avatar:null};let{avatars:r,legacyAvatar:i}=QB(e);return!Object.hasOwn(r,t)&&i&&(r[t]=i,$B(n,r)),{avatar:Object.hasOwn(r,t)?r[t]??null:null,agentId:t}}catch{return{avatar:null}}}function tV(e){e&&aV.delete(e)}function nV(e,t){let n=aV.get(e);n||(n=new Map,aV.set(e,n));let r=t.trim(),i=n.get(r);if(i?.kind===`result`&&Date.now()-i.cachedAt<iV)return Promise.resolve(i.result);if(i?.kind===`result`&&n.delete(r),i?.kind===`pending`)return i.pending;let a=e.request(`agent.identity.get`,{agentId:r}).then(e=>{if(!e)return null;let t=Xt(e),n=eV({agentId:t.agentId}).avatar;return n?{...t,avatar:n,avatarSource:n,avatarStatus:`data`,avatarReason:null}:t}).then(e=>{let t=n.get(r);return t?.kind===`pending`&&t.pending===a&&n.set(r,{kind:`result`,result:e,cachedAt:Date.now()}),e},e=>{let t=n.get(r);throw t?.kind===`pending`&&t.pending===a&&n.delete(r),e});return n.set(r,{kind:`pending`,pending:a}),a}var rV,iV,aV;function oV(){return(oV=t((()=>{ht(),rV=`openclaw.control.assistant.v1`,iV=6e4,aV=new WeakMap})))()}function sV(e){if(e.querySelector(`.agent-chat__composer-combobox`))return{cancel:()=>void 0,ready:Promise.resolve()};let t,n=new Promise(e=>{t=e}),r=()=>t();return e.addEventListener(uV,r,{once:!0}),{cancel:()=>e.removeEventListener(uV,r),ready:n}}async function cV(e,t,n){let r=e.querySelector(`openclaw-router-outlet`),i=sV(e);try{await t(),await r?.updateComplete,await i.ready}finally{i.cancel()}n||await(r?.animate?.(dV,fV))?.finished.catch(()=>void 0)}async function lV(e){let{document:t,from:n,navigate:r,prepare:i,prefersReducedMotion:a,to:o}=e;if(n!==`new-session`||o!==`chat`)return r();try{await i?.()}catch{return r()}return cV(t,r,a)}var uV,dV,fV;function pV(){return(pV=t((()=>{uV=`openclaw-chat-route-ready`,dV=[{transform:`translateY(5px) scale(0.997)`},{transform:`none`}],fV={duration:180,easing:`cubic-bezier(0.16, 1, 0.3, 1)`}})))()}function mV(e){let t=e.replace(/\s+/g,` `).trim();return l(t,vV)}function hV(e){let t=mV(e);return t?`Explain "${t}" from this conversation in more detail.`:null}function gV(e){let t=mV(e);return t?`Regarding "${t}": `:null}function _V(e){return e.trim().replace(/^\/(?:btw|side)(?::\s*|\s+|$)/i,``).trim()}var vV;function yV(){return(yV=t((()=>{vV=300})))()}function bV(e,t,n){return t===`worktree`?{taskId:e}:{taskId:e,mode:t,...n?{cloudProfileId:n}:{}}}function xV(){return(xV=t((()=>{})))()}var SV;function CV(){return(CV=t((()=>{eL(),SV=class{constructor(e,t){this.host=e,this.options=t,this.store=null,this.stopUpdates=null,this.sessionKey=``,this.dismiss=e=>this.store?.dismiss(e)??Promise.resolve(!1),e.addController(this)}get card(){return this.store?.get(this.sessionKey)??null}hostUpdate(){this.synchronize()}hostDisconnected(){this.release()}synchronize(){let e=this.options.gateway()??null,t=this.options.sessionKey()?.trim()??``,n=e?JI(e):null;n!==this.store&&(this.release(),this.store=n,this.stopUpdates=n?.subscribe(()=>this.host.requestUpdate())??null),t!==this.sessionKey&&(this.sessionKey=t,this.store?.watch(this,t?[t]:[]))}release(){this.store?.unwatch(this),this.stopUpdates?.(),this.stopUpdates=null,this.store=null,this.sessionKey=``}}})))()}var wV;function TV(){return(TV=t((()=>{wV=class{constructor(){this.activeSessionKey=``,this.activationObserved=!1,this.requested=!1}beginActivation(e){this.activeSessionKey=e.trim(),this.activationObserved=!1,this.activationMarkedUnreadAt=void 0,this.requested=!1}shouldPatch(e,t,n){let r=e.trim(),i=n??void 0;return r!==this.activeSessionKey&&this.beginActivation(r),r?(this.activationObserved||(this.activationObserved=!0,this.activationMarkedUnreadAt=i),t===!1?(this.activationMarkedUnreadAt=void 0,this.requested=!1,!1):i!==void 0&&i!==this.activationMarkedUnreadAt||t!==!0||this.requested?!1:(this.requested=!0,!0)):!1}patchFailed(e){e.trim()===this.activeSessionKey&&(this.requested=!1)}}})))()}function EV(e){let t=e.busy||e.disabled===!0;return F`
|
|
<form class="mcp-server-form" @submit=${t=>{t.preventDefault();let n=t.currentTarget,r=new FormData(n),i=r.get(`mcp-name`),a=r.get(`mcp-transport`),o=r.get(`mcp-target`);e.onSubmit({name:typeof i==`string`?i.trim():``,transport:a===`sse`||a===`stdio`?a:`streamable-http`,target:typeof o==`string`?o.trim():``})}}>
|
|
<label>
|
|
<span>${W(`mcpServers.nameLabel`)}</span>
|
|
<input
|
|
name="mcp-name"
|
|
class="settings-input"
|
|
type="text"
|
|
required
|
|
placeholder="context7"
|
|
autocomplete="off"
|
|
?autofocus=${e.autofocus??!1}
|
|
title=${e.blockedReason??``}
|
|
?disabled=${t}
|
|
/>
|
|
</label>
|
|
<label>
|
|
<span>${W(`mcpServers.transportLabel`)}</span>
|
|
<select
|
|
name="mcp-transport"
|
|
class="settings-select"
|
|
title=${e.blockedReason??``}
|
|
?disabled=${t}
|
|
>
|
|
<option value="streamable-http">${W(`mcpServers.transportStreamableHttp`)}</option>
|
|
<option value="sse">${W(`mcpServers.transportSse`)}</option>
|
|
<option value="stdio">${W(`mcpServers.transportStdio`)}</option>
|
|
</select>
|
|
</label>
|
|
<label class="mcp-server-form__target">
|
|
<span>${W(`mcpServers.targetLabel`)}</span>
|
|
<input
|
|
name="mcp-target"
|
|
class="settings-input"
|
|
type="text"
|
|
required
|
|
placeholder="https://mcp.example.com/mcp · npx some-mcp-server"
|
|
autocomplete="off"
|
|
title=${e.blockedReason??``}
|
|
?disabled=${t}
|
|
/>
|
|
</label>
|
|
<div class="mcp-server-form__actions">
|
|
<button
|
|
type="submit"
|
|
class="btn btn--sm"
|
|
title=${e.blockedReason??``}
|
|
?disabled=${t}
|
|
>
|
|
${e.busy?W(`mcpServers.adding`):W(`mcpServers.add`)}
|
|
</button>
|
|
<button type="button" class="btn btn--sm" ?disabled=${e.busy} @click=${e.onCancel}>
|
|
${W(`common.cancel`)}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
`}function DV(){return(DV=t((()=>{I(),V()})))()}function OV(e){let t=[],n=``,r=null,i=!1;for(let a=0;a<e.length;a+=1){let o=e[a]??``;if(o===`\\`&&r===`"`){let t=1;for(;e[a+t]===`\\`;)t+=1;e[a+t]===`"`?(n+=`\\`.repeat(Math.floor(t/2)),t%2==0?r=null:n+=`"`,a+=t):(n+=`\\`.repeat(t),a+=t-1),i=!0;continue}if(o===`\\`&&r===null){let t=e[a+1];t&&(t===`"`||t===`'`||/\s/u.test(t))?(n+=t,i=!0,a+=1):(n+=o,i=!0);continue}if(r){o===r?r=null:n+=o,i=!0;continue}if(o===`'`||o===`"`){r=o,i=!0;continue}if(/\s/u.test(o)){i&&=(t.push(n),n=``,!1);continue}n+=o,i=!0}return r?null:(i&&t.push(n),t)}function kV(e,t){if(t!==`stdio`)try{let n=new URL(e).protocol;return n===`http:`||n===`https:`?{url:e,transport:t}:null}catch{return null}if(/^https?:\/\//i.test(e))return null;let[n,...r]=OV(e.trim())??[];return n?r.length>0?{command:n,args:r}:{command:n}:null}function AV(e){if(!e)return null;let t=y(y(e.mcp)?.servers)??{};return Object.entries(t).map(([e,t])=>{let n=y(t)??{},r=typeof n.url==`string`?n.url:``,i=typeof n.command==`string`?n.command:``,a=i?`stdio`:r?n.transport===`streamable-http`?`streamable-http`:n.transport===void 0||n.transport===`sse`?`sse`:`invalid`:`invalid`;return{name:e,enabled:n.enabled!==!1,transport:a,target:i||u(r),auth:typeof n.auth==`string`?n.auth:null,toolFilter:!!n.toolFilter,parallel:n.supportsParallelToolCalls===!0,tls:n.sslVerify===!1?`verify-off`:n.clientCert||n.clientKey?`mtls`:null}}).toSorted((e,t)=>e.name.localeCompare(t.name))}function jV(e,t,n){return Object.hasOwn(e,t)?{error:W(`mcpServers.nameTaken`,{name:t})}:{patch:{[t]:n}}}function MV(e,t,n){return Object.hasOwn(e,t)?{patch:{[t]:{enabled:n?null:!1}}}:{error:W(`mcpServers.missing`,{name:t})}}function NV(e,t){return Object.hasOwn(e,t)?{patch:{[t]:null}}:{error:W(`mcpServers.missing`,{name:t})}}async function PV(e,t){try{return await e.ensureLoaded(),await e.patchFromSnapshot(e=>{let n=y(y(e.mcp)?.servers)??{},r=t.buildPatch(n);return`error`in r?r:{options:{raw:{mcp:{servers:r.patch}},note:t.note}}})?(await e.refresh(),{ok:!0}):{ok:!1,error:e.state.lastError??W(`mcpServers.configUnavailable`)}}catch(e){return{ok:!1,error:k(e)}}}var FV;function IV(){return(IV=t((()=>{o(),V(),N(),FV=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/})))()}function LV(e,t=e=>e){let n={};for(let[r,i]of Object.entries(e??{}))Object.defineProperty(n,r,{configurable:!0,enumerable:!0,value:t(i),writable:!0});return n}function RV(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function zV(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function BV(e){return{...e?.mcpServers?{mcpServers:LV(e.mcpServers)}:{},...e?.mcpToolsDeny?{mcpToolsDeny:LV(e.mcpToolsDeny,e=>[...e])}:{},...e?.skills?{skills:LV(e.skills)}:{},...e?.webSearch===void 0?{}:{webSearch:e.webSearch}}}function VV(e,t){return t??e}function HV(e,t,n,r,i){let a=BV(e),o=LV(Object.hasOwn(a,t)?a[t]:void 0);return r===i?delete o[n]:zV(o,n,r),Object.keys(o).length===0?delete a[t]:a[t]=o,a}function UV(e,t,n=!0){let r=BV(e);return t===n?delete r.webSearch:r.webSearch=t,r}function WV(e,t,n,r){let i=BV(e),a=Object.hasOwn(i,`mcpToolsDeny`)?i.mcpToolsDeny:void 0,o=new Set(RV(a,t)??[]);r?o.add(n):o.delete(n);let s=LV(a,e=>[...e]);return o.size>0?zV(s,t,[...o].toSorted()):delete s[t],Object.keys(s).length===0?delete i.mcpToolsDeny:i.mcpToolsDeny=s,i}function GV(e){return Object.keys(e?.mcpServers??{}).length+Object.keys(e?.skills??{}).length+Object.keys(e?.mcpToolsDeny??{}).length+(e?.webSearch===void 0?0:1)}function KV(){return(KV=t((()=>{})))()}function qV(e){let t=e.get(`content-length`);if(!t||!/^\d+$/u.test(t))return null;let n=Number(t);return Number.isSafeInteger(n)?n:1/0}async function JV(e,t){let n=qV(e.headers);if(n!==null&&n>t.maxBytes)throw e.body?.cancel().catch(()=>void 0),Error(t.tooLargeMessage);if(!e.body){if(t.missingBodyMessage)throw Error(t.missingBodyMessage);return``}let r=e.body.getReader(),i=new TextDecoder,a=[],o=0;try{for(;;){let{done:e,value:n}=await r.read();if(e){let e=i.decode();e&&a.push(e);break}if(o+=n.byteLength,o>t.maxBytes)throw r.cancel().catch(()=>void 0),Error(t.tooLargeMessage);a.push(i.decode(n,{stream:!0}))}}finally{r.releaseLock()}return a.join(``)}function YV(){return(YV=t((()=>{})))()}async function XV(e,t){switch(t.kind){case`device-pairing`:{let t=e.gateway.snapshot;return t.phase!==`connected`||!Sr(t).canAdmin?!1:e.overlays.openDevicePairSetup()}default:return t.kind,!1}}function ZV(){return(ZV=t((()=>{sr()})))()}function QV(){return typeof window<`u`&&window.event!==void 0}function $V(e){return e.connected&&e.directComposerSend&&!e.isCommand&&(e.message.trim().length>0||e.hasAttachments)}function eH(e){try{e.setItem(nH,`1`)}catch{}}function tH(e){let t;try{if(t=localStorage,t.getItem(nH)!==null)return}catch{return}let n=e.nativeNotifications;if(n){if(n.snapshot.permission!==`notDetermined`)return;eH(t);try{n.requestPermission()}catch{}return}let r=e.webPush.snapshot;if(!(!r.supported||r.permission!=="default"||r.subscription===`registered`||r.subscription===`vapid-mismatch`||r.loading)){eH(t);try{Notification.requestPermission().then(t=>{t===`granted`&&e.webPush.run({kind:`enable`})}).catch(()=>{})}catch{}}}var nH;function rH(){return(rH=t((()=>{nH=`openclaw.control.notificationsAutoPrompt.v1`})))()}function iH(e){return e.source!==`skill`}function aH(e){return e.key.replace(/[:.-]/g,`_`)}function oH(e){return(e.aliases??[]).map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith(`/`)?e.slice(1):e)}function sH(e){return e.name.trim()||null}function cH(e){if(e.args?.length)return e.args.map(e=>{let t=`<${e.name}>`;return e.required?t:`[${e.name}]`}).join(` `)}function lH(e){return typeof e==`string`?e:e.value}function uH(e){let t=e.args?.[0];if(!t)return;let n=t.choices?.map(lH).filter(Boolean);return n?.length?n:void 0}function dH(e){let t=KH[aH(e)];if(t)return t;switch(e.category){case`session`:return`session`;case`options`:return`model`;case`management`:return`tools`;default:return`tools`}}function fH(e){return UH[aH(e)]??`terminal`}function pH(e){let t=e.tier;return t===`essential`||t===`standard`||t===`power`?t:`standard`}function mH(e,t=`local`){let n=sH(e);if(!n)return null;let r=e.source??(t===`local`?`native`:void 0);return{key:e.key,name:n,aliases:oH(e).filter(e=>e!==n),description:JH[e.key]??e.description,...qH[e.key]?{descriptionKey:qH[e.key]}:{},args:YH[e.key]??cH(e),icon:fH(e),category:dH(e),executeLocal:t===`local`&&WH.has(e.key),argOptions:uH(e),tier:t===`local`?pH(e):`standard`,...r?{source:r}:{},...e.skillDisplayName?{skillDisplayName:e.skillDisplayName}:{},...e.skillModelVisible===void 0?{}:{skillModelVisible:e.skillModelVisible},...e.clientPresentation?{clientPresentation:e.clientPresentation}:{}}}function hH(e){let t=e.trim().replace(/^\//u,``).slice(0,BH),n=a(t);return!n||!FH.test(n)?null:n}function gH(e,t){let n=typeof e==`string`?e:``;return n.length>t?l(n,t):n}function _H(e){let t=`args`in e?e.args:void 0;return Array.isArray(t)?t.map(e=>y(e)).filter(e=>e!==null):[]}function vH(e){if(e.dynamic===!0)return[];let t=e.choices;return Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return gH(e,BH);let t=y(e);return t?{value:gH(t.value,BH),label:gH(t.label,BH)}:null}).filter(e=>e?typeof e==`string`?!!e:!!e.value:!1):[]}function yH(e){let t=y(e);if(!t||Object.keys(t).length!==2||!Object.hasOwn(t,`when`)||!Object.hasOwn(t,`action`)||t.when!==`no-arguments`)return;let n=y(t.action);if(!(!n||Object.keys(n).length!==1||!Object.hasOwn(n,`kind`)||n.kind!==`device-pairing`))return{when:`no-arguments`,action:{kind:`device-pairing`}}}function bH(){return[...co().map(e=>({key:e.key,name:e.textAliases[0]?.replace(/^\//u,``)??e.key,aliases:e.textAliases,description:e.description,args:e.args?.map(e=>({name:e.name,required:e.required,choices:Array.isArray(e.choices)?e.choices:void 0})),category:e.category,tier:e.tier})).map(e=>mH(e,`local`)).filter(e=>e!==null),...GH]}function xH(e=bH()){let t=new Set;for(let n of e){t.add(a(n.name));for(let e of n.aliases??[]){let n=hH(e);n&&t.add(n)}}return t}function SH(e,t){let n=(Array.isArray(e.textAliases)?e.textAliases:[]).slice(0,LH).filter(e=>typeof e==`string`).map(hH).filter(e=>!!e).filter(e=>!t.has(e)),r=n[0]??(typeof e.name==`string`?hH(e.name):null);if(!r||t.has(r))return null;let i=_H(e).slice(0,RH).map(e=>({name:gH(e.name,HH),required:e.required===!0,choices:vH(e).slice(0,zH)})).filter(e=>e.name.length>0).map(e=>Object.assign({name:e.name},e.required?{required:!0}:{},e.choices.length>0?{choices:e.choices}:{}));return{key:r,name:r,aliases:n.map(e=>`/${e}`),description:gH(e.description,VH),...i.length>0?{args:i}:{},category:typeof e.category==`string`?e.category:void 0,source:e.source===`native`||e.source===`plugin`||e.source===`skill`?e.source:void 0,skillDisplayName:typeof e.skillDisplayName==`string`&&gH(e.skillDisplayName,BH).trim()||void 0,skillModelVisible:typeof e.skillModelVisible==`boolean`?e.skillModelVisible:void 0,clientPresentation:e.source===`plugin`?yH(e.clientPresentation):void 0}}function CH(e){XH.splice(0,XH.length,...e)}function wH(e){let t=bH(),n=xH(t),r=e.slice(0,IH).map(e=>SH(e,n)).filter(e=>e!==null).map(e=>mH(e,`remote`)).filter(e=>e!==null),i=new Map;for(let e of[...t,...r]){let t=a(e.name);!t||i.has(t)||i.set(t,e)}return Array.from(i.values())}function TH(e){let t=e?.commands;return Array.isArray(t)?t.map(e=>y(e)).filter(e=>e!==null):[]}function EH(){return bH()}function DH(e){return W(`chat.commands.categories.${e}`)}function OH(e){return e.descriptionKey?W(e.descriptionKey):e.description}function kH(e,t){let n=[e.name,...e.aliases??[]].map(a);return n.some(e=>e===t)?0:n.some(e=>e.startsWith(t))?1:n.some(e=>e.includes(t))?2:a(OH(e)).includes(t)?3:$H}function AH(e,t){let n=a(e),r=t?.showAll??!1,i=t?.inlineOnly?XH.filter(e=>e.source===`skill`&&e.skillModelVisible===!0||iH(e)&&t.allowImmediateInlineCommands!==!1):XH;return i=n?i.filter(e=>kH(e,n)<$H):i,!n&&!r&&(i=i.filter(e=>(e.tier??`standard`)!==`power`)),i.toSorted((e,t)=>{if(n){let r=kH(e,n)-kH(t,n);if(r!==0)return r}let r=QH[e.tier??`standard`]??1,i=QH[t.tier??`standard`]??1;if(r!==i)return r-i;let a=ZH.indexOf(e.category??`session`),o=ZH.indexOf(t.category??`session`);return a===o?0:a-o})}function jH(e,t=e.length){let n=Math.max(0,Math.min(t,e.length)),r=e.slice(0,n).match(/(?:^|\s)\/([^\s/:]*)(:?)$/u);if(!r||r.index===void 0)return null;let i=r[0].indexOf(`/`),a=r.index+i;if(e[a+1]===`/`)return null;let o=n;for(;o<e.length&&!/\s/u.test(e[o]??``);)o+=1;let s=r[1]??``;return/^[^\s/:]*$/u.test(s)?{query:s,start:a,end:o,inline:e.slice(0,a).trim().length>0||e.slice(o).trim().length>0||r[2]===`:`,...r[2]===`:`?{skillOnly:!0}:{}}:null}function MH(e){return e.skillDisplayName?.trim()||e.name}function NH(e){let t=a(e),n=t.replace(/[\s_]+/gu,`-`);return XH.filter(e=>e.source===`skill`&&e.skillModelVisible===!0).filter(e=>{let r=a(MH(e)),i=r.replace(/[\s_]+/gu,`-`),o=a(e.name).replace(/[\s_]+/gu,`-`);return!t||r.includes(t)||i.includes(n)||o.startsWith(n)||a(OH(e)).includes(t)}).toSorted((e,t)=>MH(e).localeCompare(MH(t)))}function PH(e){let t=e.trim();if(!t.startsWith(`/`))return null;let n=t.slice(1),r=n.search(/[\s:]/u),i=r===-1?n:n.slice(0,r),o=r===-1?``:n.slice(r).trimStart();o.startsWith(`:`)&&(o=o.slice(1).trimStart());let s=o.trim();if(!i)return null;let c=a(i),l=XH.find(e=>e.name===c||e.aliases?.some(e=>a(e)===c));return l?{command:l,args:s}:null}var FH,IH,LH,RH,zH,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H;function eU(){return(eU=t((()=>{io(),V(),FH=/^[a-z0-9][a-z0-9_-]*$/u,IH=500,LH=20,RH=20,zH=50,BH=200,VH=2e3,HH=200,UH={help:`book`,status:`barChart`,usage:`barChart`,export:`download`,export_session:`download`,tools:`terminal`,skill:`zap`,commands:`book`,new:`plus`,reset:`refresh`,compact:`loader`,stop:`stop`,clear:`trash`,model:`brain`,models:`brain`,think:`brain`,verbose:`terminal`,fast:`zap`,agents:`monitor`,subagents:`folder`,steer:`send`,tts:`volume2`},WH=new Set([`help`,`new`,`reset`,`stop`,`compact`,`model`,`think`,`fast`,`verbose`,`export-session`,`usage`,`agents`,`steer`,`redirect`]),GH=[{key:`clear`,name:`clear`,description:`Clear chat history`,descriptionKey:`chat.commands.clearDescription`,icon:`trash`,category:`session`,executeLocal:!0,tier:`standard`},{key:`redirect`,name:`redirect`,description:`Abort and restart with a new message`,descriptionKey:`chat.commands.redirectDescription`,args:`<message>`,icon:`refresh`,category:`agents`,executeLocal:!0,tier:`power`}],KH={help:`tools`,commands:`tools`,tools:`tools`,skill:`tools`,status:`tools`,export_session:`tools`,usage:`tools`,tts:`tools`,agents:`agents`,subagents:`agents`,steer:`agents`,redirect:`agents`,session:`session`,stop:`session`,reset:`session`,new:`session`,compact:`session`,model:`model`,models:`model`,think:`model`,verbose:`model`,fast:`model`,reasoning:`model`,elevated:`model`,queue:`model`},qH={steer:`chat.commands.steerDescription`},JH={steer:`Inject a message into the active run`},YH={steer:`<message>`},XH=EH(),ZH=[`session`,`model`,`tools`,`agents`],QH={essential:0,standard:1,power:2},$H=4})))()}function tU(e,t,n,r){let i=n.trim();if(!i)return;let o=a(i);t.has(o)||(t.add(o),e.push({value:i,label:r(i)}))}function nU(){return(nU=t((()=>{})))()}function rU(e,t){let n=e?.agentRuntime?.id?.trim(),r=t?.agentRuntime?.id?.trim();return(!e?.modelProvider||e.modelProvider===t?.modelProvider)&&(!e?.model||e.model===t?.model)&&(!n||!r||n===r)}function iU(){return(iU=t((()=>{})))()}function aU(e,t,n=[],r){let{provider:i,model:a}=mU({defaults:t,session:e});return gU({catalog:n,defaults:t,fallbackLabels:r,model:a,provider:i,session:e})}function oU(e,t,n=[]){let r=aU(e,t,n,[]).map(e=>vU(e.id));return r.length>0?[`default`,...new Set(r.filter(e=>e&&e!=="default"))]:[]}function sU(e,t,n=[]){let r=aU(e,t,n).map(e=>e.label).join(`, `);return r.split(`, `).includes(`default`)?r:`default, ${r}`}function cU(e,t,n,r=[]){let i=ao(e);if(i)return i;let o=a(e);return aU(t,n,r).map(e=>({id:ao(e.id)??a(e.id),label:a(e.label)})).find(e=>e.id===o||e.label===o)?.id}function lU(e,t,n,r=[]){return aU(e,t,r).some(e=>(ao(e.id)??a(e.id))===n||ao(e.label)===n)}function uU(e,t,n){let r=ao(e?.thinkingLevel);if(r)return aU(e,t).find(e=>ao(e.id)===r)?.label??r;if(e?.thinkingDefault)return e.thinkingDefault;if((!e||rU(e,t))&&t?.thinkingDefault)return t.thinkingDefault;let i=e?.modelProvider??t?.modelProvider,a=e?.model??t?.model;return!i||!a?`off`:so({provider:i,model:a,catalog:n})}function dU(e){let t=new Set,n=[],r=(e,r)=>{let i=vU(e);tU(n,t,i,()=>bU(i,r))};for(let t of e)r(t.id,t.label);return n}function fU(e){return vU(e??``)===`off`}function pU(e){return e.every(e=>fU(e.id||e.label))}function mU(e){return{provider:e.session?.modelProvider??e.defaults?.modelProvider??null,model:e.session?.model??e.defaults?.model??null}}function hU(e,t,n){return t&&n?e.find(e=>e.provider===t&&e.id===n):void 0}function gU(e){let t=rU(e.session,e.defaults),n=hU(e.catalog,e.provider,e.model),r=(e.session?.thinkingLevels?.length?e.session.thinkingLevels:null)??(e.session?.model&&n?.thinkingLevels?.length?n.thinkingLevels:null)??(t&&e.defaults?.thinkingLevels?.length?e.defaults.thinkingLevels:null);if(r)return e.hideUnsupportedOffOnly&&n?.reasoning===!1&&pU(r)?[]:r;let i=(e.session?.thinkingOptions?.length?e.session.thinkingOptions:null)??(t&&e.defaults?.thinkingOptions?.length?e.defaults.thinkingOptions:null);return e.hideUnsupportedOffOnly&&n?.reasoning===!1&&(!i||i.every(fU))?[]:(i??e.fallbackLabels??to).map(e=>({id:ao(e)??a(e),label:e}))}function _U(e){let t=e.session??e.sessionsResult?.sessions?.find(t=>j(t.key,e.sessionKey)),n=t?.thinkingLevel,r=typeof n==`string`&&n.trim()?ao(n)??n.trim():``,i=e.defaults??e.sessionsResult?.defaults,{provider:a,model:o}=mU({defaults:i,session:t}),s=hU(e.catalog,a,o),c=gU({catalog:e.catalog,defaults:i,hideUnsupportedOffOnly:!0,model:o,provider:a,session:t}),l=(!t||rU(t,i))&&i?.thinkingDefault?i.thinkingDefault:void 0,u=t?.thinkingDefault??(t?.model?s?.thinkingDefault:void 0)??l??(a&&o?so({provider:a,model:o,catalog:[...e.catalog]}):`off`),d=c.length===0&&r===`off`?``:r,f=dU(c),p=vU(u),m={value:p,displayLabel:yU(u)},h=d||p,g=f.findIndex(e=>e.value===h),_=d?`override`:`default`,v=d?f[g]?.label??bU(d):m.displayLabel;return{selection:g>=0?{kind:`anchored`,source:_,value:h,displayLabel:v,index:g}:{kind:`unanchored`,source:_,value:h,displayLabel:v},inherited:m,options:f}}function vU(e){return ao(e)??a(e)}function yU(e){return`Inherited: ${xU(e?vU(e):`off`)}`}function bU(e,t){let n=vU(e);return!n||n===`off`?`Off`:xU(t?.trim()||n)}function xU(e){let t=a(e);if([`on`,`enable`,`enabled`].includes(t))return`On`;switch(vU(e)){case`adaptive`:return`Adaptive`;case`minimal`:return`Minimal`;case`low`:return`Low`;case`medium`:return`Medium`;case`high`:return`High`;case`xhigh`:return`Extra high`;case`max`:return`Maximum`;case`ultra`:return`Ultra`;default:return e.charAt(0).toUpperCase()+e.slice(1)}}function SU(){return(SU=t((()=>{Ya(),nU(),O()})))()}function CU(e){if(!Number.isFinite(e)||e<=0)return`0`;if(e<1e3)return String(Math.round(e));if(e<1e6){let t=e>=1e4?Math.round(e/1e3):Math.round(e/100)/10;return t>=1e3?`1m`:`${t}k`}return`${e>=1e7?Math.round(e/1e6):Math.round(e/1e5)/10}m`}function wU(e){return typeof e.tokenBudget==`number`&&Number.isFinite(e.tokenBudget)?`${CU(e.tokensUsed)}/${CU(e.tokenBudget)}`:e.tokensUsed>0?`${CU(e.tokensUsed)} used`:null}function TU(e){switch(e){case`active`:return`Pursuing goal`;case`paused`:return`Goal paused`;case`blocked`:return`Goal blocked`;case`usage_limited`:return`Goal hit usage limits`;case`budget_limited`:return`Goal unmet`;case`complete`:return`Goal achieved`}return e}function EU(e){let t=wU(e),n=TU(e.status);return t?`${n} (${t})`:n}function DU(e,t){let n=(()=>{switch(e.status){case`active`:return t;case`paused`:return e.pausedAt??e.updatedAt;case`blocked`:return e.blockedAt??e.updatedAt;case`usage_limited`:return e.usageLimitedAt??e.updatedAt;case`budget_limited`:return e.budgetLimitedAt??e.updatedAt;case`complete`:return e.completedAt??e.updatedAt}return e.status})();return Math.max(0,n-e.createdAt)}function OU(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=String(t%60).padStart(2,`0`);return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${String(n%60).padStart(2,`0`)}m ${r}s`}function kU(e){let t=e.lastStatusNote?` - ${e.lastStatusNote}`:``;return`${EU(e)}: ${e.objective}${t}`}function AU(){return(AU=t((()=>{})))()}function jU(e){try{return e.getItem(PU)===null&&(e.setItem(PU,`1`),!0)}catch{return!1}}function MU(){return Array.from({length:LU},(e,t)=>({color:FU[t%FU.length]??FU[0],angle:-Math.PI*(.2+Math.random()*.6),speed:260+Math.random()*360,size:4+Math.random()*5,spin:(Math.random()-.5)*12,rotation:Math.random()*Math.PI}))}function NU(){if(typeof document>`u`||typeof window>`u`||!document.body||typeof window.requestAnimationFrame!=`function`||window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return;let e;try{e=window.localStorage}catch{return}if(!jU(e))return;let t=document.createElement(`canvas`);t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{position:`fixed`,inset:`0`,width:`100vw`,height:`100vh`,pointerEvents:`none`,zIndex:`2147483647`});let n=t.getContext(`2d`);if(!n)return;document.body.append(t);let r=Math.min(2,Math.max(1,window.devicePixelRatio||1)),i=window.innerWidth,a=window.innerHeight;t.width=Math.round(i*r),t.height=Math.round(a*r),n.setTransform(r,0,0,r,0,0);let o=MU(),s={x:i/2,y:a*.62},c=performance.now(),l=e=>{let r=e-c,u=r/1e3,d=r/IU;n.clearRect(0,0,i,a),n.globalAlpha=d<.65?1:Math.max(0,(1-d)/.35);for(let e of o){let t=Math.max(0,1-u*.22),r=s.x+Math.cos(e.angle)*e.speed*u*t,i=s.y+Math.sin(e.angle)*e.speed*u+420*u*u;n.save(),n.translate(r,i),n.rotate(e.rotation+e.spin*u),n.fillStyle=e.color,n.fillRect(-e.size/2,-e.size/4,e.size,e.size/2),n.restore()}d<1?window.requestAnimationFrame(l):t.remove()};window.requestAnimationFrame(l)}var PU,FU,IU,LU;function RU(){return(RU=t((()=>{PU=`openclaw.confetti.firstReply`,FU=[`#ff4d4d`,`#ff7079`,`#00e5cc`,`#f2a833`],IU=1500,LU=64})))()}function zU(e){let t=ee(e);if(t===void 0)return null;let n=t-Date.now();if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60),a=r%60;if(i<24)return a>0?`${i}h ${a}m`:`${i}h`;let o=Math.floor(i/24);if(o<7){let e=i%24;return e>0?`${o}d ${e}h`:`${o}d`}return new Date(t).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function BU(e){return Math.max(0,Math.min(100,Math.round(e)))}function VU(e,t){let n=[];for(let r of(e?.providers??[]).filter(t)){let e=r.usage;if(!e)continue;let t=(e.windows??[]).map(e=>{let t={label:(e.label||``).trim(),usedPercent:BU(e.usedPercent)};return e.resetAt!==void 0&&(t.resetAt=e.resetAt),t}),i=(e.billing??[]).flatMap(e=>{if(e.type!==`budget`||!Number.isFinite(e.used)||!Number.isFinite(e.limit)||e.used<0||e.limit<=0)return[];let t={used:e.used,limit:e.limit,unit:e.unit};return e.label&&(t.label=e.label),[t]});if(t.length===0&&i.length===0)continue;let a=[...new Set([r.provider,e.providerId].filter(e=>!!e))],o=JSON.stringify([r.displayName,e.accountEmail??null,t,i]),s=n.find(e=>e.identity===o);if(s){for(let e of a)s.group.providers.includes(e)||s.group.providers.push(e);continue}n.push({identity:o,group:{providers:a,displayName:r.displayName,...e.plan?{plan:e.plan}:{},...e.accountEmail?{accountEmail:e.accountEmail}:{},windows:t,budgets:i}})}return n.map(e=>e.group)}function HU(){return(HU=t((()=>{ue()})))()}function UU(e,t,n={}){let r=e.querySelector(`:scope > summary`),i=e.querySelector(`:scope > wa-popup[data-anchored-overlay]`);!r||!i||(i.anchor=n.anchor??r,i.placement=`${t}-${n.alignment??`start`}`,i.boundary=`viewport`,i.distance=6,i.flip=!0,i.flipPadding=WU,i.shift=!0,i.shiftPadding=GU,i.autoSize=`vertical`,i.autoSizePadding=WU,i.active=e.open)}var WU,GU;function KU(){return(KU=t((()=>{wa(),WU=8,GU=12})))()}var qU;function JU(){return(JU=t((()=>{I(),R(),Sg(),M(),U(),qU=class extends xt{constructor(...e){super(...e),this.routeUrl=null,this.authTokens=[],this.authReady=!1,this.undecodableRouteUrl=null,this.loader=new xg(()=>{this.isConnected&&this.requestUpdate()},{cacheNotFound:!0,retryUnavailable:!0})}disconnectedCallback(){this.loader.reset(),super.disconnectedCallback()}render(){return this.loader.withActiveRoutes(()=>this.renderContent())}renderContent(){let e=this.routeUrl,t=e&&this.authReady&&this.undecodableRouteUrl!==e?this.loader.resolve(e,this.authTokens):null;return t?F`<img
|
|
class="workspace-icon"
|
|
src=${t}
|
|
alt=""
|
|
aria-hidden="true"
|
|
decoding="async"
|
|
@error=${()=>{this.undecodableRouteUrl=e}}
|
|
/>`:F`<span class="workspace-icon-fallback" aria-hidden="true">${H.folder}</span>`}},S([z({attribute:!1})],qU.prototype,`routeUrl`,void 0),S([z({attribute:!1})],qU.prototype,`authTokens`,void 0),S([z({attribute:!1})],qU.prototype,`authReady`,void 0),S([B()],qU.prototype,`undecodableRouteUrl`,void 0),customElements.get(`openclaw-workspace-icon`)||customElements.define(`openclaw-workspace-icon`,qU)})))()}export{WV as $,LT as $a,bh as $c,iA as $i,If as $l,IR as $n,dC as $o,CN as $r,o_ as $s,uB as $t,Dl as $u,wH as A,yE as Aa,og as Ac,mc as Ad,oM as Ai,Xp as Al,Ez as An,kw as Ao,RI as Ar,eb as As,YB as At,bu as Au,PH as B,FT as Ba,Lh as Bc,UA as Bi,Lp as Bl,KR as Bn,HC as Bo,hP as Br,Tv as Bs,IB as Bt,cu as Bu,uU as C,AE as Ca,Eg as Cc,Pc as Cd,jM as Ci,lm as Cl,Xz as Cn,Hw as Co,CL as Cr,qb as Cs,uV as Ct,$u as Cu,rU as D,CE as Da,xg as Dc,Oc as Dd,mM as Di,sm as Dl,kz as Dn,Aw as Do,eL as Dr,rb as Ds,oV as Dt,Vu as Du,iU as E,wE as Ea,Cg as Ec,hc as Ed,eM as Ei,am as El,Fz as En,Bw as Eo,lL as Er,fb as Es,nV as Et,zu as Eu,MH as F,cE as Fa,qh as Fc,$s as Fd,Ij as Fi,Wp as Fl,_z as Fn,hw as Fo,UF as Fr,xy as Fs,KB as Ft,fu as Fu,$V as G,UT as Ga,Eh as Gc,pA as Gi,hp as Gl,WR as Gn,LC as Go,DN as Gr,J_ as Gs,EB as Gt,Vl as Gu,tH as H,NT as Ha,Fh as Hc,WA as Hi,Op as Hl,YR as Hn,RC as Ho,dP as Hr,Q_ as Hs,OB as Ht,zl as Hu,DH as I,XT as Ia,$h as Ic,Zs as Id,ZA as Ii,Up as Il,mz as In,uw as Io,OP as Ir,wy as Is,GB as It,uu as Iu,YV as J,VT as Ja,Ah as Jc,xA as Ji,pp as Jl,HR as Jn,wC as Jo,GN as Jr,G_ as Js,wB as Jt,Fl as Ju,XV as K,YT as Ka,kh as Kc,wA as Ki,Sp as Kl,JR as Kn,PC as Ko,BN as Kr,U_ as Ks,dB as Kt,Rl as Ku,AH as L,hE as La,Xh as Lc,Xs as Ld,nj as Li,Hp as Ll,XR as Ln,fw as Lo,jP as Lr,by as Ls,UB as Lt,du as Lu,jH as M,_E as Ma,lg as Mc,ic as Md,Yj as Mi,im as Ml,pz as Mn,zw as Mo,HF as Mr,Ly as Ms,JB as Mt,mu as Mu,TH as N,lE as Na,tg as Nc,ac as Nd,Pj as Ni,tm as Nl,fz as Nn,Ew as No,cI as Nr,Py as Ns,XB as Nt,gu as Nu,XH as O,xE as Oa,Sg as Oc,Ec as Od,iM as Oi,qp as Ol,jz as On,ww as Oo,JI as Or,tb as Os,tV as Ot,Tu as Ou,NH as P,aE as Pa,eg as Pc,ec as Pd,Fj as Pi,Qp as Pl,hz as Pn,_w as Po,GF as Pr,Fy as Ps,qB as Pt,yu as Pu,HV as Q,jT as Qa,xh as Qc,sA as Qi,G as Ql,zR as Qn,hC as Qo,EN as Qr,Lg as Qs,vB as Qt,Ol as Qu,OH as R,sE as Ra,Hh as Rc,KA as Ri,Vp as Rl,QR as Rn,dw as Ro,yP as Rr,yy as Rs,zB as Rt,Zl as Ru,_U as S,UE as Sa,Dg as Sc,kc as Sd,HM as Si,xm as Sl,Kz as Sn,Ww as So,SL as Sr,Zb as Ss,yV as St,od as Su,cU as T,EE as Ta,wg as Tc,wc as Td,yM as Ti,cm as Tl,Mz as Tn,Vw as To,_L as Tr,pb as Ts,lV as Tt,nd as Tu,QV as U,KT as Ua,jh as Uc,HA as Ui,Dp as Ul,qR as Un,FC as Uo,YN as Ur,$_ as Us,DB as Ut,ql as Uu,CH as V,IT as Va,Rh as Vc,VA as Vi,Np as Vl,VR as Vn,WC as Vo,fP as Vr,nv as Vs,FB as Vt,Il as Vu,rH as W,MT as Wa,Dh as Wc,LA as Wi,dp as Wl,GR as Wn,IC as Wo,lP as Wr,H_ as Ws,yB as Wt,Bl as Wu,GV as X,kT as Xa,Th as Xc,lA as Xi,_p as Xl,FR as Xn,xC as Xo,VN as Xr,L_ as Xs,pB as Xt,Pl as Xu,JV as Y,BT as Ya,Sh as Yc,uA as Yi,vp as Yl,LR as Yn,EC as Yo,HN as Yr,C_ as Ys,SB as Yt,Yl as Yu,KV as Z,PT as Za,wh as Zc,aA as Zi,cp as Zl,PR as Zn,bC as Zo,zN as Zr,zg as Zs,bB as Zt,El as Zu,sU as _,aD as _a,Pg as _c,Fc as _d,VM as _i,Om as _l,Qz as _n,Zw as _o,eR as _r,gx as _s,xV as _t,Ku as _u,zU as a,FO as aa,Wg as ac,xl as ad,aN as ai,nh as al,eB as an,wT as ao,xR as ar,PS as as,NV as at,sf as au,lU as b,iD as ba,jg as bc,Lc as bd,QM as bi,Sm as bl,Yz as bn,iT as bo,YL as br,tx as bs,hV as bt,sd as bu,RU as c,CO as ca,O_ as cc,gl as cd,sN as ci,Qm as cl,zz as cn,mT as co,mR as cr,Jx as cs,kV as ct,Qd as cu,TU as d,qD as da,I_ as dc,rl as dd,iN as di,Hm as dl,Hz as dn,hT as do,iR as dr,Lx as ds,DV as dt,Gd as du,Rk as ea,Ug as ec,Al as ed,bN as ei,mh as el,lB as en,WT as eo,AR as er,jS as es,UV as et,Jf as eu,EU as f,eO as fa,P_ as fc,tl as fd,$M as fi,Um as fl,Rz as fn,fT as fo,ZL as fr,Qx as fs,EV as ft,Od as fu,yU as g,QE as ga,Hg as gc,Rc as gd,MM as gi,Dm as gl,Uz as gn,Qw as go,rR as gr,qx as gs,CV as gt,ed as gu,AU as h,TD as ha,M_ as hc,Qc as hd,WM as hi,Em as hl,Bz as hn,oT as ho,QL as hr,Wx as hs,SV as ht,yd as hu,VU as i,UO as ia,A_ as ic,bl as id,gN as ii,eh as il,tB as in,CT as io,OR as ir,FS as is,jV as it,bf as iu,iH as j,bE as ja,cg as jc,oc as jd,$j as ji,$p as jl,dz as jn,jw as jo,PF as jr,$y as js,ZB as jt,hu as ju,EH as k,vE as ka,ug as kc,sc as kd,aM as ki,Jp as kl,Dz as kn,Ow as ko,WI as kr,ob as ks,eV as kt,Pu as ku,kU as l,TO as la,Jg as lc,dl as ld,rN as li,rh as ll,qz as ln,bT as lo,hR as lr,Mx as ls,PV as lt,tf as lu,DU as m,wD as ma,a_ as mc,el as md,nN as mi,zm as ml,Iz as mn,sT as mo,XL as mr,Ux as ms,TV as mt,vd as mu,KU as n,PO as na,i_ as nc,Cl as nd,yN as ni,ah as nl,oB as nn,HT as no,MR as nr,AS as ns,VV as nt,af as nu,HU as o,OO as oa,j_ as oc,ml as od,uN as oi,$m as ol,$z as on,xT as oo,CR as or,tS as os,MV as ot,of as ou,wU as p,GD as pa,T_ as pc,$c as pd,eN as pi,Rm as pl,Wz as pn,cT as po,nR as pr,Yx as ps,wV as pt,Sd as pu,ZV as q,GT as qa,Oh as qc,dA as qi,fp as ql,UR as qn,jC as qo,FN as qr,W_ as qs,xB as qt,Wl as qu,UU as r,LO as ra,Gg as rc,wl as rd,vN as ri,uh as rl,rB as rn,AT as ro,kR as rr,NS as rs,FV as rt,ff as ru,NU as s,wO as sa,Vg as sc,_l as sd,oN as si,ih as sl,Lz as sn,ST as so,gR as sr,rS as ss,IV as st,cf as su,JU as t,Bk as ta,V_ as tc,kl as td,xN as ti,oh as tl,cB as tn,RT as to,NR as tr,MS as ts,RV as tt,_f as tu,OU as u,EO as ua,D_ as uc,nl as ud,tN as ui,Km as ul,Zz as un,gT as uo,_R as ur,Gx as us,AV as ut,Wd as uu,bU as v,oD as va,Mg as vc,Ic as vd,RM as vi,Tm as vl,Vz as vn,Yw as vo,$L as vr,mx as vs,bV as vt,ad as vu,oU as w,OE as wa,Tg as wc,Cc as wd,bM as wi,om as wl,Pz as wn,Uw as wo,yL as wr,mb as ws,pV as wt,td as wu,vU as x,KE as xa,Og as xc,zc as xd,AM as xi,bm as xl,Gz as xn,Xw as xo,JL as xr,Jb as xs,_V as xt,rd as xu,SU as y,CD as ya,Ng as yc,Bc as yd,BM as yi,Cm as yl,Jz as yn,Jw as yo,tR as yr,Qb as ys,gV as yt,dd as yu,eU as z,TT as za,Ih as zc,BA as zi,Rp as zl,RR as zn,tw as zo,bP as zr,Dv as zs,HB as zt,Hl as zu};
|
|
//# sourceMappingURL=control-ui-boot-Cdpgu1Gm.js.map
|