388 lines
218 KiB
JavaScript
388 lines
218 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./session-placement-recovery-migration.runtime-BzhgJrX_.js","./control-ui-boot-Cdpgu1Gm.js","./rolldown-runtime-DkW27tQK.js","./control-ui-foundation-CeFMP1Ly.js","./control-ui-core-pH6nakZ-.js","./lit-runtime-BEtFSUCp.js","./control-ui-core-Br5DB0Zj.js","./gateway-runtime-DUNO4Mi1.js","./control-ui-core-C8H8-RSs.css","./control-ui-boot-wpHCbPL9.js","./control-ui-boot-gfE6fZcA.js","./config-runtime-C4gfjhZc.js","./control-ui-boot-CKTkvwFZ.js","./control-ui-boot-BPFwXC8p.js","./control-ui-boot-DdPrPuw0.js","./control-ui-boot-9_2QGLIL.js","./control-ui-boot-J-x6DHHT.js","./control-ui-boot-B1lcIXow.js","./control-ui-boot-Clhp68JE.js","./control-ui-boot-D1DWJlBr.js","./control-ui-boot-CQvujP8f.js","./control-ui-boot-BW_XZcbY.js","./control-ui-boot-__AsqpzJ.css","./markdown-runtime-BcrsAQtF.js","./gateway-scope-upgrade.runtime-DyqtDpM9.js","./command-palette-BoOc-8Xf.js","./transcript-search-BCLBZZfW.js","./debug-overlay-ptF-J8ul.js","./lane-table-QMAsbx-S.js","./lane-table-BXDlcREF.css","./keyboard-shortcuts-dialog-H2IcvF5A.js","./macos-titlebar-controls.runtime-ByLqIm3x.js","./sidebar-attention-fzt-pwc4.js","./terminal-panel-registration-CCniUaOS.js","./scrollbar-styles-BYLTmsP_.js","./dock-layout-controller-uvZhgHTs.js","./dock-destination-controls-qvkD_2gG.js","./browser-panel-BNW001UL.js","./desktop-panel-D3-Tqe5h.js","./board-document-CjY7JU6O.js","./board-view-DEfofU9J.js","./board-view-Cufc5TOV.css","./board-document-B0Y4zGJq.css","./custodian-panel-WuoyOsWA.js","./custodian-surface-BijreBg_.js","./wizard-step-controls-D3s65of1.js","./channel-picker-DBMoQAsl.js","./presentation-B6OSZPWo.js","./select-picker-BINM0f88.js","./select-picker-qE697RJ3.css","./channel-picker-B2ncUyiM.css","./wizard-step-controls-CUvrnOcR.css","./text-BRLnxsjx.js","./text-CmAPg1E6.css","./update-confirmation-BNyRSVb0.js","./custodian-alert-store-BIkN3I10.js","./custodian-surface-Dz7yg29n.css","./custodian-panel-DqvIMjZP.css","./approval-page-registration-90H9Ag-v.js","./approval-result-validators-Bwny6Cwa.js","./approval-Dpr9VMH2.js","./approval-COwc0-bg.css","./question-page-registration-zhqoLjJ5.js","./question-page-registration-BJyeJ3XJ.css","./exec-approval-BnwUQx-C.js","./control-ui-environment-presentation.runtime-CUzY9dKZ.js","./canvas-surface-lease.runtime-BGKi1noP.js","./session-placement-startup.runtime-DE487O8e.js","./web-push.runtime-KQs-HLHc.js","./src-DLHBykgZ.js","./bootstrap-location-ChIZAqbj.js","./session-progress-hovercard-registration-CvDu6Gsh.js","./route-loader-BScCw0Rs.js","./nav-drawer-swipe.runtime-XKu72Qdc.js","./critical-observer-notice.runtime-D52VYdrT.js","./app-sidebar-workboard.runtime-BV8rPjRk.js","./normalization-m-N_6hXH.js","./workboard-board-glyph-f8SLNsbu.js","./app-sidebar-CnFPscC2.js","./settings-sidebar-C0XMfym-.js","./config-form.tiers-DLXolKGz.js","./memory-schema-3MkJhUhF.js","./slots-B92pe9ar.js","./settings-targets-GAGqNu16.js","./view-pairing.runtime-Dv0qtb6U.js","./onboarding-memory-import-B_Qn6P0k.js","./onboarding-memory-import-DuWLEvoz.css","./outbox-store-projection-XOJ4hhmZ.js","./sidebar-update-card-SvaXnUMr.js","./sidebar-update-card-CQqrU8d1.js","./sidebar-update-card-CqgCtvZC.css","./composer-draft-retirement.runtime-CqmtfZn-.js"])))=>i.map(i=>d[i]);
|
|
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{A as t,At as n,B as r,Br as i,Bt as a,Ci as o,Ct as s,Dt as c,Ei as l,Et as u,Fr as d,Ft as f,G as p,Gt as m,Ir as h,Jt as g,K as _,Lr as v,Mt as y,Nr as b,Nt as x,Ot as S,Pr as C,R as w,Rr as T,Rt as E,S as ee,Si as te,Sn as D,Tt as O,Vr as k,W as A,Yt as j,_ as M,_t as ne,ai as re,b as N,bn as P,bt as ie,ct as ae,d as oe,er as F,et as se,f as ce,ft as le,g as ue,gi as de,gn as fe,h as pe,hi as me,ht as he,k as ge,ki as I,lt as _e,m as ve,mi as ye,mt as be,ni as xe,nt as Se,oi as Ce,p as we,pt as Te,ri as Ee,rn as De,s as Oe,si as ke,st as Ae,ti as je,tn as Me,tt as Ne,u as Pe,ut as Fe,v as Ie,wn as L,wt as Le,xt as R,y as Re,yi as ze,z as Be,zr as Ve}from"./control-ui-foundation-CeFMP1Ly.js";import{$ as He,$c as Ue,$r as We,A as Ge,Aa as Ke,Ai as qe,Ao as Je,As as Ye,B as Xe,Ba as Ze,Br as Qe,Bs as $e,Bt as et,Cc as tt,Cs as nt,Ct as rt,D as it,Da as at,Dc as ot,Di as st,Ea as ct,Ei as lt,Er as ut,F as dt,Fc as ft,Fi as pt,Fn as mt,Fs as ht,G as gt,Ga as _t,Gn as vt,Gt as yt,Ho as bt,I as xt,Ii as St,In as Ct,Io as wt,Is as Tt,It as Et,Jt as Dt,Li as Ot,Lr as kt,Ls as At,M as jt,Ma as Mt,Mi as Nt,Mr as Pt,Ms as Ft,N as It,Na as Lt,Ni as Rt,Ns as zt,Nt as Bt,O as Vt,Oa as Ht,Oi as Ut,Or as Wt,P as Gt,Pi as Kt,Po as qt,Ps as Jt,Qc as Yt,Qi as Xt,Qo as Zt,Qr as Qt,R as $t,Ro as en,Rr as tn,Rs as nn,Ss as rn,St as an,Ti as on,To as sn,Tr as cn,Tt as ln,U as un,Un as dn,Ut as fn,V as pn,Va as mn,Vs as hn,Vt as gn,W as _n,Wa as vn,Wt as yn,Xi as bn,Xn as xn,Y as Sn,Yi as Cn,Ys as wn,Zi as Tn,Zn as En,Zo as Dn,_a as On,_s as kn,a as An,aa as jn,ai as Mn,al as Nn,ao as Pn,at as Fn,ba as In,bc as Ln,bl as Rn,br as zn,bs as Bn,ca as Vn,ci as Hn,cl as Un,da as Wn,ds as Gn,dt as Kn,ea as qn,et as Jn,fa as Yn,fl as Xn,fs as Zn,ga as Qn,gl as $n,ha as er,hc as tr,hl as nr,ht as rr,i as ir,ia as ar,it as or,j as sr,ja as cr,jc as lr,ji as ur,jo as dr,jr as fr,js as pr,k as mr,kc as hr,la as gr,ll as _r,lr as vr,ma as yr,mc as br,ml as xr,ms as Sr,na as Cr,nl as wr,o as Tr,oa as Er,oi as Dr,ol as Or,p as kr,pa as Ar,ps as jr,pt as Mr,q as Nr,qs as Pr,qt as Fr,ra as Ir,rt as Lr,s as Rr,sa as zr,si as Br,sl as Vr,sr as Hr,ta as Ur,ua as Wr,ul as Gr,ut as Kr,vr as qr,vs as Jr,w as Yr,wr as Xr,ws as Zr,xa as Qr,xo as $r,xr as ei,xs as ti,yl as ni,yr as ri,ys as ii,yt as ai,z as oi,zr as si,zs as ci,zt as li}from"./control-ui-core-pH6nakZ-.js";import{G as z,J as B,W as ui,Z as di,at as fi,et as pi,rt as V}from"./lit-runtime-BEtFSUCp.js";import{At as mi,Ct as hi,Dt as gi,E as _i,G as vi,Gt as yi,Ht as H,I as bi,K as xi,L as Si,Lt as Ci,Mt as wi,Nt as Ti,Ot as Ei,Pt as Di,Rt as Oi,S as ki,St as Ai,T as ji,Tt as Mi,W as Ni,Xt as Pi,_ as Fi,b as Ii,bt as Li,d as Ri,f as zi,g as Bi,gt as Vi,h as Hi,ht as Ui,i as Wi,jt as Gi,kt as Ki,l as qi,m as Ji,mt as Yi,n as Xi,o as Zi,p as Qi,qt as U,r as $i,s as ea,t as ta,tt as na,u as ra,v as ia,vt as aa,w as oa,wt as sa,xt as ca,y as la,yt as ua}from"./control-ui-core-Br5DB0Zj.js";import{a as da,n as fa,r as pa}from"./gateway-runtime-DUNO4Mi1.js";function ma(){let e=window.webkit?.messageHandlers?.openclawWindowDrag;return e?.postMessage.bind(e)}function ha(e){if(e.button!==0||e.defaultPrevented)return;for(let t of e.composedPath())if(t instanceof Element&&t.matches(_a))return;let t=ma();if(t){try{t({type:`window-drag`})}catch{return}e.preventDefault()}}function ga(e){if(e.target!==e.currentTarget||!(e.currentTarget instanceof HTMLElement))return;let t=Number.parseFloat(getComputedStyle(e.currentTarget).paddingTop);!Number.isFinite(t)||e.offsetY>t||ha(e)}var _a;function va(){return(va=e((()=>{_a=`a, button, input, select, textarea, [role='button'], [contenteditable]`})))()}function ya(e){return e in Ga}function ba(e){let t=Ga[e];return`aliases`in t?{id:e,path:t.path,aliases:t.aliases}:{id:e,path:t.path}}function xa(e){return Ce(e)}function Sa(e){return ke(e)}function W(e,t=``){let n=xa(t),r=Ga[e].path;return n?`${n}${r}`:r}function Ca(e,t=``){let n=W(`activity`,t),r=`?${new URLSearchParams({[qa]:e}).toString()}`;return{pathname:n,search:r,href:`${n}${r}`}}function wa(e,t=``){if(!xe(e))throw Error(`Invalid Workboard board id.`);let n=encodeURIComponent(e).replaceAll(`.`,`%2E`);return`${W(`workboard`,t)}/${n}`}function Ta(e,t=null,n=``){if(!e||e.includes(`/`)||e===`.`||e===`..`)throw Error(`Invalid agent id for a route path.`);let r=encodeURIComponent(e).replaceAll(`.`,`%2E`),i=`${W(`agents`,n)}/${r}`;return t?`${i}/${t}`:i}function Ea(e,t=``){let n=Sa(e),r=`${W(`agents`,t)}/`;if(!n.startsWith(r))return null;let i=n.slice(r.length).split(`/`);if(i.length>2||!i[0])return null;let a;try{a=decodeURIComponent(i[0])}catch{return null}if(!a||a.includes(`/`)||a===`.`||a===`..`)return null;let o=i[1]??null,s=o&&Rn(o)?o:null;return{agentId:a,panel:s??`files`,panelSegment:s,invalidPanel:o!==null&&s===null}}function Da(e,t=``){let n=W(`memory`,t);return e===`overview`?n:`${n}/${e}`}function Oa(e,t=``){let n=Sa(e),r=W(`memory`,t);if(n===r)return`overview`;let i=`${r}/`;if(!n.startsWith(i))return null;let a=n.slice(i.length);return a===`memories`||a===`dreams`||a===`settings`?a:null}function ka(e,t=``){let n=W(`plugins`,t);return e===`installed`?n:`${n}/discover`}function Aa(e,t=``){let n=Sa(e),r=W(`plugins`,t);return n===r?`installed`:n===`${r}/discover`?`discover`:null}function ja(e){return e===`chat`||e===`dashboard`}function Ma(e,t=``){let n=Sa(e),r=xa(t);if(r&&n!==r&&!n.startsWith(`${r}/`))return null;let i=n.slice(r.length);return i.startsWith(`/chat/`)?`chat`:i.startsWith(`/dashboard/`)?`dashboard`:null}function Na(e,t=``){let n=Sa(e),r=`${W(`workboard`,t)}/`;if(!n.startsWith(r))return null;let i=n.slice(r.length);if(!i||i.includes(`/`))return null;try{let e=decodeURIComponent(i);return xe(e)?e:null}catch{return null}}function Pa(e,t=``){let n=Sa(e),r=xa(t);if(!(!r||n===r||n.startsWith(`${r}/`)))return null;let i=r?n.slice(r.length)||`/`:n;if(Ea(n,r))return`agents`;if(Na(n,r))return`workboard`;if(Oa(n,r))return`memory`;if(Aa(n,r))return`plugins`;let a=Ma(n,r);if(a)return a;let o=i.toLowerCase();for(let e of Ka){let t=Ga[e];if((`aliases`in t?[t.path,...t.aliases]:[t.path]).some(e=>Sa(e)===o))return e}return null}function Fa(){return Ka.flatMap(e=>{let t=Ga[e],n=[t.path];return`aliases`in t&&n.push(...t.aliases),n})}function Ia(e){let t=Fa().map(e=>Sa(e));if(t.includes(e))return!0;let n=e.split(`/`).filter(Boolean);for(let e=1;e<=n.length;e+=1){let r=`/${n.slice(0,e).join(`/`)}`;if(t.some(e=>e.startsWith(`${r}/`)))return!0}return!1}function La(e){let t=de(e);if(t!==null)return t;let n=e.trim().endsWith(`/`),r=Sa(e);if(r.toLowerCase().endsWith(`/index.html`))return xa(r.slice(0,-11));if(r===`/`)return``;let i=r.split(`/`).filter(Boolean),a=Fa();for(let e=0;e<i.length;e+=1){let t=`/${i.slice(e).join(`/`)}`,n=a.find(e=>Sa(e)===t),r=Object.values(Wa).find(e=>t===e||t.startsWith(`${e}/`)),o=Ea(t)!==null,s=Na(t)!==null,c=Oa(t)!==null,l=Aa(t)!==null,u=Ma(t),d=u!==null;if(!n&&!r&&!o&&!s&&!c&&!l&&!d)continue;let f=i[e-1],p=r||(o?Ga.agents.path:s?Ga.workboard.path:c?Ga.memory.path:l?Ga.plugins.path:u?Ga[u].path:null),m=(n??p??``).split(`/`).find(Boolean);if(e>0&&f===m&&(t===n||r||o||s||c||l||d)||e===0)return``;let h=`/${i.slice(0,e).join(`/`)}`;return Ia(h)?``:h}if(!n||i.length===0)return``;let o=`/${i.join(`/`)}`;return Ia(o)?``:o}function Ra(e,t){return{pathname:W(e,t),search:``,hash:``}}var za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa;function G(){return(G=e((()=>{ye(),re(),je(),ni(),za=`__openclawAgentPath`,Ba=`__openclawSessionPath`,Va=`__openclawMemoryPath`,Ha=`__openclawPluginsPath`,Ua=`__openclawWorkboardPath`,Wa={approval:`/approve`,question:`/ask`},Ga={chat:{path:`/chat`},dashboard:{path:`/dashboard`},dashboards:{path:`/dashboards`},custodian:{path:`/custodian`},"new-session":{path:`/new`},activity:{path:`/activity`},apps:{path:`/apps`},portals:{path:`/portals`},agents:{path:`/settings/agents`,aliases:[`/agents`]},channels:{path:`/settings/channels`,aliases:[`/channels`]},connection:{path:`/settings/connection`},config:{path:`/settings/general`,aliases:[`/config`]},profile:{path:`/settings/profile`,aliases:[`/profile`]},communications:{path:`/settings/communications`,aliases:[`/communications`]},appearance:{path:`/settings/appearance`,aliases:[`/appearance`]},lobsterdex:{path:`/settings/lobsterdex`,aliases:[`/lobsterdex`]},notifications:{path:`/settings/notifications`},security:{path:`/settings/security`},secrets:{path:`/settings/secrets`},advanced:{path:`/settings/advanced`},approvals:{path:`/settings/approvals`},automation:{path:`/settings/automation`,aliases:[`/automation`]},mcp:{path:`/settings/mcp`,aliases:[`/mcp`]},memory:{path:`/settings/memory`},talk:{path:`/settings/talk`},infrastructure:{path:`/settings/infrastructure`,aliases:[`/infrastructure`]},labs:{path:`/settings/labs`},updates:{path:`/settings/updates`},about:{path:`/settings/about`},"ai-agents":{path:`/settings/ai-agents`,aliases:[`/ai-agents`]},"model-setup":{path:`/settings/model-setup`,aliases:[`/model-setup`]},"model-providers":{path:`/settings/model-providers`,aliases:[`/model-providers`]},"memory-import":{path:`/memory-import`,aliases:[`/settings/memory-import`]},workboard:{path:`/workboard`},worktrees:{path:`/worktrees`,aliases:[`/settings/worktrees`]},sessions:{path:`/sessions`,aliases:[`/settings/sessions`]},usage:{path:`/usage`},debug:{path:`/debug`},logs:{path:`/logs`},"skill-workshop":{path:`/skills/workshop`},skills:{path:`/skills`},plugins:{path:`/settings/plugins`},cron:{path:`/automations`,aliases:[`/cron`]},tasks:{path:`/tasks`},devices:{path:`/settings/devices`,aliases:[`/nodes`]},"cloud-workers":{path:`/settings/cloud-workers`},plugin:{path:`/plugin`}},Ka=Object.keys(Ga),qa=`person`})))()}function Ja(){let e=typeof window>`u`?void 0:window.__OPENCLAW_CONTROL_UI_BASE_PATH__,t=typeof e==`string`?e:typeof document>`u`?null:document.documentElement.getAttribute(d);return t===null?null:xa(t)}function Ya(e){let t=Ja(),n=t||La(e);return[n,t??n]}function Xa(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Za(e){return`${e.pathname}${e.search}${e.hash}`}function Qa(){let e=new Set,t,n=()=>{if(t)return;let n=()=>{let t=Xa();for(let n of e)n(t)};window.addEventListener(`popstate`,n),t=()=>window.removeEventListener(`popstate`,n)},r=()=>{e.size===0&&(t?.(),t=void 0)};return{location:Xa,push:e=>window.history.pushState({},``,Za(e)),replace:e=>window.history.replaceState({},``,Za(e)),listen:t=>(e.add(t),n(),()=>{e.delete(t),r()})}}function $a(){return($a=e((()=>{k(),G()})))()}function eo(e,t){return`${xa(t??``)}/${e}`}function to(e,t){return eo(e,t?.resourceBasePath??(t?.pathname===void 0?Ya(no())[1]:La(t.pathname)))}function no(){return typeof window>`u`?`/`:window.location.pathname}function ro(){return(ro=e((()=>{G(),$a()})))()}function io(e){return Do.has(e)}function ao(e){return Oo.has(e)}function oo(e){return Eo.includes(e)}function so(e){if(typeof e!=`string`)return null;if(e.startsWith(`route:`)){let t=e.slice(6);return oo(t)?{type:`route`,route:t}:null}if(e.startsWith(`session:`)){let t=e.slice(8).trim();return t?{type:`session`,key:t}:null}if(e.startsWith(`workboard:`)){let t=e.slice(10).trim();return xe(t)?{type:`workboard`,boardId:t}:null}return null}function co(e){return e.type===`route`?`route:${e.route}`:e.type===`workboard`?`workboard:${e.boardId}`:`session:${e.key}`}function lo(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=so(n);if(!e)continue;let r=co(e);t.includes(r)||t.push(r)}return t}function uo(e){let t=new Set(e.flatMap(e=>{let t=so(e);return t?.type===`route`?[t.route]:[]}));return To.filter(e=>!t.has(e))}function fo(e,t){let n=yi.getLocale();if(Ao!==n&&(Ao=n,jo=typeof Intl<`u`&&`Segmenter`in Intl?new Intl.Segmenter(n,{granularity:`word`}):null),!jo)return e.split(/[^\p{L}\p{N}]+/u).some(e=>e.startsWith(t));for(let n of jo.segment(e))if(n.isWordLike!==!1&&n.segment.startsWith(t))return!0;return!1}function po(e,t){let n=l(e).normalize(`NFC`),r=l(t).normalize(`NFC`);return r?r.length>2?n.includes(r):fo(n,r):!1}function mo(e,t){return t||No.some(t=>t.routes.some(t=>t===e))}function ho(e){return e?Mo:No}function go(e){return Lo.has(e)}function _o(e){return Io[e]??e}function vo(e){return Ro[e]??`folder`}function yo(e,t,n,r,i=!1,a=!1){if(i||!r)return;let o=n.currentTarget;if(!o)return;let s=()=>{e.delete(o);try{Promise.resolve(r(t)).catch(()=>void 0)}catch{}};if(a){bo(e,n),s();return}e.has(o)||e.set(o,globalThis.setTimeout(s,50))}function bo(e,t){let n=t.currentTarget;if(!n)return;let r=e.get(n);r!==void 0&&(globalThis.clearTimeout(r),e.delete(n))}function xo(e){return U(zo[e].titleKey)}function So(e){let t=e.context.endsWith(`OpenClaw`)?e.context:`${e.context} — OpenClaw`;if(e.gatewayDisconnected){let n=e.queuedCount&&e.queuedCount>0?` · ${U(`connection.queuedCount`,{count:String(e.queuedCount)})}`:``;return`(${U(`connection.disconnectedTitle`)}${n}) ${t}`}return e.attentionCount&&e.attentionCount>0?`(${e.attentionCount}) ${t}`:t}function Co(e){return e===`custodian`?U(`nav.askOpenClaw`):xo(e)}function wo(e){return U(zo[e].subtitleKey)}var To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo;function Bo(){return(Bo=e((()=>{je(),H(),To=[`dashboards`,`usage`,`cron`,`tasks`,`sessions`,`activity`,`plugins`,`apps`,`portals`],Eo=[`workboard`,...To],Do=new Set([`plugins`,`skills`,`skill-workshop`]),Oo=new Set([`sessions`,`worktrees`]),ko=[`cron`,`plugins`].map(e=>co({type:`route`,route:e})),Ao=``,jo=null,Mo=[{labelKey:null,routes:[`custodian`,`profile`,`appearance`,`notifications`]},{labelKey:`nav.settingsGroupConnections`,routes:[`connection`,`channels`,`communications`,`talk`,`devices`,`cloud-workers`]},{labelKey:`nav.settingsGroupAgents`,routes:[`agents`,`labs`,`model-providers`,`mcp`,`memory`,`automation`]},{labelKey:`nav.settingsGroupSecurity`,routes:[`security`,`secrets`,`approvals`]},{labelKey:`nav.settingsGroupSystem`,routes:[`infrastructure`,`advanced`,`debug`,`logs`,`updates`,`about`]}],No=[{labelKey:null,routes:[`profile`,`appearance`,`notifications`]},{labelKey:`nav.settingsGroupConnections`,routes:[`connection`,`channels`,`talk`,`devices`]},{labelKey:`nav.settingsGroupAgents`,routes:[`agents`,`model-providers`,`memory`]},{labelKey:`nav.settingsGroupSecurity`,routes:[`approvals`]},{labelKey:`nav.settingsGroupSystem`,routes:[`advanced`,`debug`,`logs`,`about`]}],Po=[`ai-agents`,`model-setup`,`lobsterdex`],Fo=[`ai-agents`],Io={"ai-agents":`agents`,"model-setup":`model-providers`},Lo=new Set([...Mo.flatMap(e=>e.routes),...Po]),Ro={agents:`bot`,activity:`activity`,apps:`layoutGrid`,portals:`monitor`,approvals:`badgeCheck`,workboard:`kanban`,worktrees:`folder`,channels:`link`,connection:`radio`,sessions:`fileText`,usage:`coins`,cron:`calendarClock`,tasks:`listChecks`,skills:`zap`,plugins:`puzzle`,"skill-workshop":`wrench`,devices:`monitorSmartphone`,"cloud-workers":`server`,chat:`messageSquare`,dashboard:`layoutDashboard`,dashboards:`layoutDashboard`,custodian:`lobster`,config:`settings`,profile:`circleUser`,communications:`send`,appearance:`palette`,lobsterdex:`bug`,automation:`terminal`,mcp:`wrench`,memory:`book`,talk:`mic`,infrastructure:`globe`,labs:`flaskConical`,updates:`download`,about:`fileText`,"ai-agents":`brain`,"model-setup":`spark`,"model-providers":`plug`,"memory-import":`download`,notifications:`bell`,security:`shieldCheck`,secrets:`key`,advanced:`fileCode`,debug:`bug`,logs:`scrollText`,plugin:`puzzle`,"new-session":`plus`},zo={agents:{titleKey:`tabs.agents`,subtitleKey:`subtitles.agents`},activity:{titleKey:`tabs.activity`,subtitleKey:`subtitles.activity`},apps:{titleKey:`tabs.apps`,subtitleKey:`subtitles.apps`},portals:{titleKey:`tabs.portals`,subtitleKey:`subtitles.portals`},approvals:{titleKey:`tabs.approvals`,subtitleKey:`subtitles.approvals`},workboard:{titleKey:`tabs.workboard`,subtitleKey:`subtitles.workboard`},worktrees:{titleKey:`tabs.worktrees`,subtitleKey:`subtitles.worktrees`},channels:{titleKey:`tabs.channels`,subtitleKey:`subtitles.channels`},connection:{titleKey:`tabs.connection`,subtitleKey:`subtitles.connection`},sessions:{titleKey:`tabs.sessions`,subtitleKey:`subtitles.sessions`},usage:{titleKey:`tabs.usage`,subtitleKey:`subtitles.usage`},cron:{titleKey:`tabs.cron`,subtitleKey:`subtitles.cron`},tasks:{titleKey:`tabs.tasks`,subtitleKey:`subtitles.tasks`},skills:{titleKey:`tabs.skills`,subtitleKey:`subtitles.skills`},plugins:{titleKey:`tabs.plugins`,subtitleKey:`subtitles.plugins`},"skill-workshop":{titleKey:`tabs.skillWorkshop`,subtitleKey:`subtitles.skillWorkshop`},devices:{titleKey:`tabs.devices`,subtitleKey:`subtitles.devices`},"cloud-workers":{titleKey:`tabs.cloudWorkers`,subtitleKey:`subtitles.cloudWorkers`},chat:{titleKey:`tabs.chat`,subtitleKey:`subtitles.chat`},dashboard:{titleKey:`tabs.chat`,subtitleKey:`subtitles.chat`},dashboards:{titleKey:`tabs.dashboards`,subtitleKey:`subtitles.dashboards`},custodian:{titleKey:`tabs.custodian`,subtitleKey:`subtitles.custodian`},config:{titleKey:`nav.settings`,subtitleKey:`subtitles.config`},profile:{titleKey:`tabs.profile`,subtitleKey:`subtitles.profile`},communications:{titleKey:`tabs.communications`,subtitleKey:`subtitles.communications`},appearance:{titleKey:`tabs.appearance`,subtitleKey:`subtitles.appearance`},lobsterdex:{titleKey:`tabs.lobsterdex`,subtitleKey:`subtitles.lobsterdex`},automation:{titleKey:`tabs.automation`,subtitleKey:`subtitles.automation`},mcp:{titleKey:`tabs.mcp`,subtitleKey:`subtitles.mcp`},memory:{titleKey:`tabs.memory`,subtitleKey:`subtitles.memory`},talk:{titleKey:`tabs.talk`,subtitleKey:`subtitles.talk`},infrastructure:{titleKey:`tabs.infrastructure`,subtitleKey:`subtitles.infrastructure`},labs:{titleKey:`tabs.labs`,subtitleKey:`subtitles.labs`},updates:{titleKey:`tabs.updates`,subtitleKey:`subtitles.updates`},about:{titleKey:`tabs.about`,subtitleKey:`subtitles.about`},"ai-agents":{titleKey:`tabs.aiAgents`,subtitleKey:`subtitles.aiAgents`},"model-setup":{titleKey:`tabs.modelSetup`,subtitleKey:`subtitles.modelSetup`},"model-providers":{titleKey:`routeTitles.modelProviders`,subtitleKey:`subtitles.modelProviders`},"memory-import":{titleKey:`tabs.memoryImport`,subtitleKey:`subtitles.memoryImport`},notifications:{titleKey:`routeTitles.notifications`,subtitleKey:`subtitles.notifications`},security:{titleKey:`tabs.security`,subtitleKey:`subtitles.security`},secrets:{titleKey:`tabs.secrets`,subtitleKey:`secretsStore.hint`},advanced:{titleKey:`routeTitles.advanced`,subtitleKey:`subtitles.advanced`},debug:{titleKey:`tabs.debug`,subtitleKey:`subtitles.debug`},logs:{titleKey:`tabs.logs`,subtitleKey:`subtitles.logs`},plugin:{titleKey:`tabs.plugin`,subtitleKey:`subtitles.plugin`},"new-session":{titleKey:`newSession.title`,subtitleKey:`newSession.hint`}}})))()}function Vo(e){let t=new URLSearchParams(e).get(`onboarding`);return t!==null&&/^(?:1|true|yes|on)$/iu.test(t.trim())}function Ho(){return(Ho=e((()=>{})))()}function Uo(e,t){let n=new WebSocket(e),r=!0,i,a,o=()=>{r=!1,a!==void 0&&(clearTimeout(a),a=void 0)};return n.addEventListener(`open`,()=>{o(),t.open()}),n.addEventListener(`message`,e=>t.message(String(e.data??``))),n.addEventListener(`close`,e=>{o(),t.close(e.code,e.reason||i||``)}),n.addEventListener(`error`,()=>{o(),i||t.error(Error(`websocket error`))}),a=setTimeout(()=>{if(a=void 0,r){r=!1,i=`gateway websocket opening timed out after ${le}ms`;try{t.error(Error(i))}finally{n.close()}}},le),{isOpen:()=>n.readyState===WebSocket.OPEN,send:e=>n.send(e),close:(e,t)=>{o(),n.close(e===1008?4008:e,t)}}}function Wo(){return(Wo=e((()=>{Te()})))()}function Go(e,t){return x(t)===S.PROTOCOL_MISMATCH||!e?.toLowerCase().includes(`protocol mismatch`)?t:{code:S.PROTOCOL_MISMATCH,clientMinProtocol:4,clientMaxProtocol:4,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}}}function Ko(e){return x(e?.details)}function qo(){return(qo=e((()=>{y()})))()}function Jo(){return(typeof window<`u`?window:void 0)?.isSecureContext===!0}function Yo(e){try{let t=new URL(e,window.location.href);return Gn(t.hostname)||t.host===new URL(window.location.href).host}catch{return!1}}function Xo(e){let{gatewayCode:t,message:n,details:r,retryable:i,retryAfterMs:a}=e;return{code:t,message:n,details:r,retryable:i,retryAfterMs:a}}function Zo(e){let t=e&&typeof e==`object`&&`name`in e?e.name:void 0;return typeof t==`string`&&t.trim()?t:void 0}function Qo(e){let t=Zo(e)?.toLowerCase(),n=Zn(e).toLowerCase();return t===`securityerror`||n.includes(`security error`)||n.includes(`mixed content`)||n.includes(`insecure websocket`)}function $o(e,t){let n=Qo(e),r=Zn(e),i=t.trim().toLowerCase().startsWith(`ws://`),a={code:n?ls:cs,browserErrorName:Zo(e),browserMessage:r};return n?{code:ls,message:`Browser refused the Gateway WebSocket for security reasons.`+(i?` Use wss:// when the Control UI is served over HTTPS/Tailscale Serve, or open the loopback dashboard at http://127.0.0.1:18789.`:` Check the Gateway WebSocket URL and browser security policy.`),details:a}:{code:cs,message:`Could not create the Gateway WebSocket: ${r}`,details:a}}async function es(e){if(!e||typeof crypto>`u`||!crypto.subtle)return``;try{let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}catch{return``}}async function ts(e){let{deviceIdentity:t}=e;if(!t)return;if(e.connectChallengeTs===null)throw Error(`gateway connect challenge timestamp invalid`);let n=e.connectChallengeTs??Date.now(),r=e.connectNonce??``,i=a({deviceId:t.deviceId,clientId:e.client.id,clientMode:e.client.mode,role:e.role,scopes:e.scopes,signedAtMs:n,token:e.authToken??null,nonce:r}),o=await Dn(t.privateKey,i);return{id:t.deviceId,publicKey:t.publicKey,signature:o,signedAt:n,nonce:r}}var ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps;function ms(){return(ms=e((()=>{Le(),y(),Se(),Fe(),ne(),A(),Te(),Ae(),k(),r(),Sr(),wt(),dr(),Wo(),qo(),C(),ns=class extends he{constructor(e){let t=Go(e.message,e.details);super({...e,details:t,message:n({message:e.message,details:t})}),this.name=`GatewayRequestError`}},rs=`operator`,is=[`operator.admin`,`operator.read`,`operator.write`,`operator.approvals`,`operator.questions`,`operator.pairing`],as=4008,os=4013,ss=1006,cs=`BROWSER_WEBSOCKET_CONSTRUCTOR_ERROR`,ls=`BROWSER_WEBSOCKET_SECURITY_ERROR`,us=3e4,ds=1e3,fs=class{constructor(e){this.opts=e,this.scopeUpgradeRuntime=null,this.inboundActivitySeq=0,this.lastInboundActivityAtMs=null,this.tickWatchTimer=null,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.recovery={value:``,resolved:!1,generation:0},this.scopeUpgradeBinding=null,this.client=new _e({createSocket:e=>{this.maxPayloadBytes=void 0;let t=Uo(this.opts.url,e);return{...t,send:e=>{if(this.maxPayloadBytes!==void 0&&new TextEncoder().encode(e).byteLength>this.maxPayloadBytes)throw new ps;t.send(e)}}},createRequestId:Je,createRequestError:e=>new ns({code:e.code??`UNAVAILABLE`,message:e.message??`request failed`,details:e.details,retryable:e.retryable,retryAfterMs:e.retryAfterMs}),buildConnectPlan:({nonce:e,challengeTs:t,generation:n})=>this.buildConnectPlan(e,t,n),buildConnectParams:e=>e.params,onConnectHello:(e,t)=>this.handleConnectHello(e,t.plan),onHello:e=>this.opts.onHello?.(e),onConnectFailure:(e,t)=>(this.client.recordTiming(`failed`,t.generation,t.plan,{errorCode:e.code}),this.handleConnectFailure(e,t.plan)),resolveClose:e=>this.resolveClose(e),onClose:(e,t)=>{this.recovery={...this.recovery,generation:e.generation+1,resolved:!1},this.stopTickWatch(),this.scopeUpgradeBinding=null;let n=e.connectFailure?.error;this.client.recordTiming(`failed`,e.generation,void 0,{errorCode:n instanceof ns?n.code:`SOCKET_CLOSED`}),t.notify&&this.opts.onClose?.({code:e.code,reason:e.reason,error:n instanceof ns?Xo(n):void 0,willRetry:t.retry})},onSocketFactoryError:e=>this.handleSocketFactoryError(e),onEvent:e=>this.opts.onEvent?.(e),onGap:e=>this.opts.onGap?.(e),onActivity:()=>{this.inboundActivitySeq+=1,this.lastInboundActivityAtMs=Date.now()},onTiming:({plan:e,detail:t,...n})=>{this.opts.onConnectTiming?.({...n,...e?this.connectPlanTimingPayload(e):{},...t&&typeof t==`object`?t:{}})},onRequestTiming:e=>this.opts.onRequestTiming?.(e),onCallbackError:(e,t)=>console.error(`[gateway] ${e} handler error:`,t),handshake:{mode:`fallback`,timeoutMs:750},reconnect:{initialMs:800,multiplier:1.7,maxMs:15e3},nowMs:()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()})}get instanceId(){return this.opts.instanceId}get gatewayUrl(){return this.opts.url}start(){this.client.start()}stop(){this.stopTickWatch(),this.recovery={...this.recovery,generation:this.recovery.generation+1,resolved:!1},this.client.stop(),this.cancelScopeUpgrade(),this.scopeUpgradeBinding=null,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1}get connected(){return this.client.connected}get recoveryScope(){return this.recovery.value}get recoveryScopeReady(){return this.recovery.resolved}get scopeUpgradeReady(){return this.connected&&this.scopeUpgradeBinding!==null}connectPlanTimingPayload(e){return{secureContext:Jo(),hasDeviceIdentity:!!e.deviceIdentity,hasDevice:!!e.params.device,hasAuthToken:!!e.selectedAuth.authToken,hasBootstrapToken:!!e.selectedAuth.authBootstrapToken,hasDeviceToken:!!(e.selectedAuth.authDeviceToken??e.selectedAuth.resolvedDeviceToken),hasPassword:!!e.selectedAuth.authPassword}}async buildConnectPlan(e,t,n){this.recovery={...this.recovery,generation:n,resolved:!1};let r=rs,i=Intl.DateTimeFormat().resolvedOptions().timeZone||void 0,a={id:this.opts.clientName??Ne.CONTROL_UI,version:this.opts.clientVersion??`control-ui`,buildId:this.opts.clientBuildId,platform:this.opts.platform??navigator.platform??`web`,mode:this.opts.mode??se.WEBCHAT,instanceId:this.opts.instanceId,...i?{timeZone:i}:{}},o=this.opts.token?.trim()||void 0,c={authToken:o,authPassword:this.opts.password?.trim()||void 0},l=await bt().catch(()=>null);this.client.recordTiming(`device-identity-ready`,n,void 0,{secureContext:Jo(),hasDeviceIdentity:l!==null}),l&&(c=this.selectConnectAuth({role:r,deviceId:l.deviceId}));let u=O({requestedScopes:c.authBootstrapToken?this.opts.bootstrapProfile===`owner`?[...Be]:[...w]:void 0,usingStoredDeviceToken:c.usingStoredDeviceToken,storedScopes:c.storedScopes,defaultScopes:is}),d={generation:n,params:{minProtocol:4,maxProtocol:4,client:a,role:r,scopes:u,device:await ts({deviceIdentity:l,client:a,role:r,scopes:u,authToken:c.authBootstrapToken??c.authToken,connectNonce:e,connectChallengeTs:t}),caps:[`agent-kind`,`approvals`,`task-suggestions`,`terminal-offset-seq`,`tool-events`,`inline-widgets`,`ui-commands`,`usage-refreshing`],auth:s(c),userAgent:navigator.userAgent,locale:navigator.language},explicitGatewayToken:o,selectedAuth:c,deviceIdentity:l};return this.pendingDeviceTokenRetry&&d.selectedAuth.authDeviceToken&&(this.pendingDeviceTokenRetry=!1),d}handleConnectHello(e,t){if(this.maxPayloadBytes=e.policy?.maxPayload,this.startTickWatch(e),this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.opts.bootstrapToken=void 0,this.opts.bootstrapProfile=void 0,this.scopeUpgradeBinding=t.deviceIdentity&&{clientId:t.params.client.id,deviceId:t.deviceIdentity.deviceId,role:t.params.role??rs},e?.auth?.deviceToken&&t.deviceIdentity){let n=e.auth.role??t.params.role??rs,r=n===t.params.role&&e.auth.deviceToken===t.selectedAuth.storedToken?t.selectedAuth.storedScopes??e.auth.scopes??[]:e.auth.scopes??[];Zt({deviceId:t.deviceIdentity.deviceId,gatewayUrl:this.opts.url,role:n,token:e.auth.deviceToken,scopes:r})}this.resolveRecoveryScope(e,t)}async resolveRecoveryScope(e,t){let n=e.auth?.recoveryScope,r=await es(e.auth?.deviceToken??t.selectedAuth.authDeviceToken??t.selectedAuth.resolvedDeviceToken??t.selectedAuth.authToken),i=n&&e.auth?.recoveryMigrationAllowed===!0&&r?(await b(async()=>{let{default:e}=await import(`./session-placement-recovery-migration.runtime-BzhgJrX_.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)).default:void 0;t.generation!==this.recovery.generation||!this.client.connected||(i?.(this.opts.url,r,n),this.recovery.value=n??r,this.recovery.resolved=!0,this.opts.onRecoveryScopeChange?.())}startTickWatch(e){this.stopTickWatch();let t=e.policy?.tickIntervalMs,n=be(typeof t==`number`&&Number.isFinite(t)&&t>0?t:us,{minMs:ds});this.lastInboundActivityAtMs=Date.now(),this.tickWatchTimer=setInterval(()=>{let e=this.lastInboundActivityAtMs;e!==null&&Date.now()-e>n*2&&this.forceReconnect(`tick timeout`)},n)}stopTickWatch(){this.tickWatchTimer!==null&&(clearInterval(this.tickWatchTimer),this.tickWatchTimer=null),this.lastInboundActivityAtMs=null}handleConnectFailure(e,t){let n=e instanceof ns?Ko(e):null;c({retryBudgetUsed:this.deviceTokenRetryBudgetUsed,currentDeviceToken:t.selectedAuth.authDeviceToken,explicitToken:t.explicitGatewayToken,storedToken:t.selectedAuth.storedToken,trustedEndpoint:!!t.deviceIdentity&&Yo(this.opts.url),errorDetails:e instanceof ns?e.details:void 0})&&(this.pendingDeviceTokenRetry=!0,this.deviceTokenRetryBudgetUsed=!0),t.selectedAuth.storedToken&&(t.selectedAuth.resolvedDeviceToken===t.selectedAuth.storedToken||t.selectedAuth.authDeviceToken===t.selectedAuth.storedToken)&&t.deviceIdentity&&n===S.AUTH_DEVICE_TOKEN_MISMATCH&&qt({deviceId:t.deviceIdentity.deviceId,gatewayUrl:this.opts.url,role:t.params.role??rs});let r=_(e);return p(e)?{closeCode:os,closeReason:`gateway starting`,reconnectDelayMs:r??void 0}:{closeCode:as,closeReason:`connect failed`}}selectConnectAuth(e){let t=en({deviceId:e.deviceId,gatewayUrl:this.opts.url,role:e.role}),n=t?.scopes??[],r=e.role!==rs||n.includes(`operator.read`)||n.includes(`operator.write`)||n.includes(`operator.admin`);return u({token:this.opts.token,bootstrapToken:this.opts.bootstrapToken,password:this.opts.password,storedToken:r?t?.token:void 0,storedScopes:t?.scopes,pendingDeviceTokenRetry:this.pendingDeviceTokenRetry,trustedDeviceTokenRetry:Yo(this.opts.url),preferBootstrapToken:!0})}async request(e,t,n){return await this.client.request(e,t,n)}async requestScopeUpgrade(e={}){let t=this.scopeUpgradeBinding;if(!this.connected||!t)throw Error(`scope upgrade requires a connected browser device`);return(await this.loadScopeUpgradeRuntime()).requestScopeUpgrade({binding:t,scopes:is,onPending:e.onPending})}cancelScopeUpgrade(){this.scopeUpgradeRuntime?.then(e=>e.cancelScopeUpgrade()).catch(()=>void 0)}loadScopeUpgradeRuntime(){return this.scopeUpgradeRuntime??=b(async()=>{let{createGatewayScopeUpgradeRuntime:e}=await import(`./gateway-scope-upgrade.runtime-DyqtDpM9.js`);return{createGatewayScopeUpgradeRuntime:e}},__vite__mapDeps([24,2,4,3,5,6,7,8]),import.meta.url).then(({createGatewayScopeUpgradeRuntime:e})=>e({gatewayUrl:this.opts.url,request:(e,t,n)=>this.request(e,t,n),reconnect:()=>this.forceReconnect(`scope upgrade approved`)})).catch(e=>{throw this.scopeUpgradeRuntime=null,e})}addEventListener(e){return this.client.addEventListener(e)}forceReconnect(e){this.client.closeSocket(4e3,e)}resolveClose(e){let t=e.connectFailure?.error,n=e.connectFailure?.reconnectDelayMs;if(n!==void 0)return{retry:!0,notify:!0,reconnectDelayMs:n,pendingError:t};let r=t instanceof ns?Xo(t):void 0;return{retry:Ko(r)===S.AUTH_TOKEN_MISMATCH?this.pendingDeviceTokenRetry:!ae({details:r?.details,protocolMismatchIsTerminal:!0}),notify:!0,pendingError:t}}handleSocketFactoryError(e){let t=$o(e,this.opts.url);this.pendingDeviceTokenRetry=!1;try{this.opts.onClose?.({code:ss,reason:t.code===ls?`security error`:`websocket error`,error:t,willRetry:!1})}catch(e){console.error(`[gateway] close handler error:`,e)}}},ps=class extends Error{constructor(){super(`Request exceeds the Gateway payload limit. Shorten the message or remove one or more attachments and retry.`),this.name=`GatewayPayloadLimitError`}}})))()}function hs(e){_s=e}function gs(e,t,n,r=``,i={}){return _s?.({namespace:e,sessionKey:n,fallbackAgentId:t,basePath:r,displayName:i.displayName??void 0,exactKey:i.exactKey,mainKey:i.mainKey??void 0,shortIdLength:i.shortIdLength})??null}var _s;function vs(){return(vs=e((()=>{})))()}function ys(e,n,r){return e?!e.scopes||t({role:e.role??`operator`,requestedScopes:[n],allowedScopes:e.scopes}):r}function K(e){let t=e?.hello?.auth??null;return{canWrite:bs(t),canAdmin:Ss(t),canPair:Cs(t),canReviewApprovals:!t||ws(t),canGrantApprovals:ws(t)}}function bs(e){return ys(e,`operator.write`,!0)}function xs(e){return ys(e,`operator.read`,!0)}function Ss(e){return ys(e,`operator.admin`,!0)}function Cs(e){return ys(e,`operator.pairing`,!1)}function ws(e){return ys(e,`operator.approvals`,!1)}function Ts(){return(Ts=e((()=>{ge()})))()}function Es(){return{...Ee({routes:Ns}),routeIdFromPath:Pa}}function Ds(e,t){if(Ea(e,t))return[`agents`,za,e];if(Na(e,t))return[`workboard`,Ua,e];let n=Oa(e,t);if(n&&n!==`overview`)return[`memory`,Va,e];if(Aa(e,t)===`discover`)return[`plugins`,Ha,e];let r=Ma(e,t);return r?[r,Ba,e]:null}function Os(e,t){let n=Ds(e.pathname,t);if(!n)return e;let[r,i,a]=n,o=new URLSearchParams(e.search);return o.set(i,a),{...e,pathname:W(r,t),search:`?${o.toString()}`}}function ks(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash}function As(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`notFound`}async function js(e){try{await e}catch(e){if(!As(e))throw e}}async function Ms(e,t,n,r){let i=t.location(),a=Ea(i.pathname,n);a?.invalidPanel&&(t.replace({...i,pathname:Ta(a.agentId,null,n)}),i=t.location()),Pa(i.pathname,n)===null&&(t.replace({...i,pathname:e.pathForRoute(`chat`,n)}),i=t.location());let o=Ds(i.pathname,n);await js(e.start({location:()=>Os(t.location(),n),push:e=>t.push(e),replace:e=>t.replace(e),listen:i=>t.listen(t=>{let a=Ds(t.pathname,n);if(a){e.navigate(a[0],r,{history:`none`},t).catch(e=>{console.error(`[openclaw] Dynamic route navigation failed`,e)});return}i(t)})},n,r)),o&&ks(t.location(),i)&&await js(e.navigate(o[0],r,{history:`none`},i))}var Ns;function Ps(){return(Ps=e((()=>{re(),G(),_r(),Vr(),$e(),nn(),Tt(),Jt(),Ft(),Ye(),nt(),ti(),ii(),kn(),In(),Qn(),yr(),Yn(),Wr(),Vn(),Er(),ar(),Cr(),qn(),Cn(),St(),Kt(),Nt(),qe(),st(),on(),Br(),Mn(),Qt(),si(),kt(),Ns=[...zt,Jr,Ur,Un,Qr,At,pt,hn,ci,ht,pr,rn,Ar,Gr,Wn,...Zr,Ir,jn,zr,Rt,Qe,tn,Ut,ur,We,On,gr,lt,Hn,Ot,Bn,Dr,er,bn]})))()}function Fs(e,t){return t?.status===`pending`&&t.module===void 0&&t.error===void 0&&e?e:t??e}function Is(e){return{status:e.status,active:e.matches[0],pending:e.pendingMatches[0]}}function Ls(e,t){return e.status===t.status&&e.active===t.active&&e.pending===t.pending}function Rs(){return{status:`idle`,active:void 0,pending:void 0,settled:void 0,showPending:!1}}var zs,Bs;function Vs(){return(Vs=e((()=>{zs=1e3,Bs=class{constructor(e,t={}){this.invalidate=e,this.connected=!1,this.selection=Rs(),this.snapshotValue=Rs(),this.showPending=!1,this.notFoundActive=!1,this.notFoundDeclined=!1,this.notFoundQueued=!1,this.notFoundGeneration=0,this.notFoundRecoveryReady=!0,this.pendingDelayMs=t.pendingDelayMs??zs}get snapshot(){return this.snapshotValue}setInputs(e){this.onNotFound=e.onNotFound;let t=e.notFoundRecoveryReady??!0,n=!this.notFoundRecoveryReady&&t&&this.notFoundDeclined;if(this.notFoundRecoveryReady=t,this.router===e.router){n&&this.selection.status===`notFound`&&(this.cancelNotFoundEffect(),this.updateNotFoundEffect(this.selection.status));return}if(this.detachSource(),this.router=e.router,this.settled=void 0,this.connected){this.attachSource();return}let r=e.router?Is(e.router.getState()):Rs();this.applySelection(r)}connect(){this.connected||(this.connected=!0,this.attachSource(!1),this.invalidate())}disconnect(){this.connected&&(this.connected=!1,this.detachSource())}attachSource(e=!0){let t=this.router;if(!this.unsubscribe){if(!t){this.applySelection(Rs(),e);return}this.applySelection(Is(t.getState()),e),this.unsubscribe=t.subscribeSelector(Is,e=>this.applySelection(e),Ls)}}detachSource(){this.unsubscribe?.(),this.unsubscribe=void 0,this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1,this.cancelNotFoundEffect()}applySelection(e,t=!0){if(this.selection=e,e.status===`idle`)this.settled=void 0;else{let t=Fs(e.active,e.pending);t?.status===`success`&&(this.settled=t)}let n=e.pending;n?.status===`pending`&&n.module===void 0&&n.error===void 0&&!e.active?this.pendingMatchId===n.id?this.connected&&!this.showPending&&this.pendingTimer===void 0&&this.schedulePendingFallback(n.id):(this.clearPendingTimer(),this.pendingMatchId=n.id,this.showPending=!1,this.schedulePendingFallback(n.id)):(this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1),this.publish({...e,settled:this.settled,showPending:this.showPending},t),this.updateNotFoundEffect(e.status)}schedulePendingFallback(e){this.connected&&(this.pendingTimer=globalThis.setTimeout(()=>{this.pendingTimer=void 0;let t=this.selection.pending,n=t?.id===e&&t.status===`pending`&&t.module===void 0&&t.error===void 0&&!this.selection.active;!this.connected||this.pendingMatchId!==e||!n||(this.showPending=!0,this.publish({...this.selection,settled:this.settled,showPending:!0}))},this.pendingDelayMs))}updateNotFoundEffect(e){if(e!==`notFound`){(this.notFoundActive||this.notFoundQueued)&&this.cancelNotFoundEffect();return}if(!this.connected||this.notFoundActive)return;this.notFoundActive=!0,this.notFoundQueued=!0;let t=++this.notFoundGeneration;queueMicrotask(()=>{!this.connected||t!==this.notFoundGeneration||this.selection.status!==`notFound`||(this.notFoundQueued=!1,this.onNotFound?.()===!1&&(this.notFoundDeclined=!0))})}cancelNotFoundEffect(){this.notFoundGeneration+=1,this.notFoundActive=!1,this.notFoundDeclined=!1,this.notFoundQueued=!1}publish(e,t=!0){let n=this.snapshotValue;(n.status!==e.status||n.active!==e.active||n.pending!==e.pending||n.settled!==e.settled||n.showPending!==e.showPending)&&(this.snapshotValue=e,t&&this.connected&&this.invalidate())}clearPendingTimer(){this.pendingTimer!==void 0&&(globalThis.clearTimeout(this.pendingTimer),this.pendingTimer=void 0)}}})))()}function Hs(e){return e instanceof Error&&tc.some(t=>t.test(e.message))}function Us(){let e=new URL(window.location.href);e.searchParams.set(`openclaw_mount_recovery`,String(Date.now())),window.location.replace(e.href)}function Ws(e){if(ic)return ic.promise;let t=(async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),ec);try{return(await fetch(window.location.href,{method:`HEAD`,cache:`no-store`,signal:e.signal})).ok}catch{return!1}finally{clearTimeout(t)}})().finally(()=>{ic?.promise===t&&(ic=null)});return ic={buildId:e,promise:t},t}function Gs(e){try{return e?.getItem(Qs)??null}catch{return null}}function Ks(e,t){if(!e)return!1;try{return e.setItem(Qs,t),!0}catch{return!1}}async function qs(e={}){let t=e.storage===void 0?$n():e.storage,n=e.buildId??Ui.buildId;if(Gs(t)===n)return!1;let r=e.now?.()??Date.now(),i=t??rc,a=nc.get(i)??{attemptsByBuild:new Map,latestBuildId:n},{attemptsByBuild:o}=a;for(let[e,t]of o)r-t>=$s&&o.delete(e);if(o.has(n))return!1;o.set(n,r),a.latestBuildId=n,nc.set(i,a);let s=!!(ic&&ic.buildId!==n);return!await Ws(n)&&(!s||!await Ws(n))||a.latestBuildId!==n||!Ks(t,n)?!1:((e.reload??Us)(),!0)}async function Js(e,t){let n,r=new Promise(e=>{n=setTimeout(()=>e(!1),t)});try{return await Promise.race([e(),r])}finally{clearTimeout(n)}}async function Ys(e={}){if(e.canReload?.()===!1)return!1;let t=e.now??Date.now,n=e.probe??Ws,r=e.wait??(e=>new Promise(t=>{setTimeout(t,e)})),i=e.intervalMs??oc,a=t()+(e.timeoutMs??ac);for(let o=0;;o+=1){let s=a-t();if(o>0&&s<=0)return!1;if(s>0?await Js(n,s):await n())return e.canReload?.()!==!1&&((e.reload??Us)(),!0);if(t()>=a)return!1;await r(i)}}function Xs(e=qs){let t=t=>{let n=t.payload;Hs(n)&&e()};return window.addEventListener(`vite:preloadError`,t),()=>window.removeEventListener(`vite:preloadError`,t)}function Zs(e={}){let t=e.isCssApplied??(()=>getComputedStyle(document.documentElement).getPropertyValue(`--openclaw-css-ok`).trim()===`1`),n=e.schedule??qs,r=e.retry??(()=>Ys({timeoutMs:0})),i=!1,a=!1,o=null,s=()=>{window.removeEventListener(`load`,u),window.removeEventListener(`error`,d,!0)},c=()=>{if(a||o)return;o=document.createElement(`div`),o.setAttribute(`role`,`alert`),Object.assign(o.style,{position:`fixed`,top:`0`,left:`0`,right:`0`,zIndex:`2147483647`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`12px 16px`,background:`#1f2937`,color:`#ffffff`,fontFamily:`system-ui, sans-serif`,fontSize:`14px`});let e=document.createElement(`span`);e.textContent=U(`lazyView.stylesFailed`);let t=document.createElement(`button`);t.type=`button`,t.textContent=U(`common.reload`),Object.assign(t.style,{border:`0`,borderRadius:`4px`,padding:`6px 12px`,background:`#ffffff`,color:`#111827`,cursor:`pointer`,font:`inherit`}),t.addEventListener(`click`,()=>void r()),o.append(e,t),document.body.append(o)},l=async()=>{i||a||(i=!0,s(),await n()||c())};function u(){if(t()){s();return}l()}function d(e){let t=e.target;!(t instanceof HTMLLinkElement)||!t.relList.contains(`stylesheet`)||l()}return window.addEventListener(`error`,d,!0),document.readyState===`complete`?u():window.addEventListener(`load`,u,{once:!0}),()=>{a=!0,s(),o?.remove(),o=null}}var Qs,$s,ec,tc,nc,rc,ic,ac,oc;function sc(){return(sc=e((()=>{aa(),H(),Qs=`openclaw.controlUi.staleChunkReloadBuildId`,$s=5e3,ec=3e3,tc=[/importing a module script failed/i,/failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/unable to preload css/i],nc=new WeakMap,rc={},ic=null,ac=3e4,oc=1e3})))()}function cc(e){return typeof e==`object`&&!!e&&`render`in e&&typeof e.render==`function`}function lc(e,t){let n=globalThis.performance?.now()??0,r=t(),i=Math.round((globalThis.performance?.now()??n)-n);return i>=16&&console.debug(`[openclaw] routed render`,{routeId:e,durationMs:i}),r}function uc(e){if(!e)return()=>{};let t=e.textContent;return e.disabled=!0,e.textContent=U(`lazyView.reloading`),()=>{e.disabled=!1,e.textContent=t}}function dc(e,t,n,r,i){let a=Hs(n);a&&qs();let o=()=>{t!==void 0&&e.revalidate(t,r).catch(()=>void 0)};return Mi({error:n,onRetry:e=>{if(!a){o();return}let t=uc(e.currentTarget instanceof HTMLButtonElement?e.currentTarget:null);Ys().then(e=>{e||(t(),o())})},render:i,stale:a})}function fc(e,t,n,r={}){if(n?.status===`notFound`||n?.status===`redirected`||!n)return z;let i=n.routeId;if(!n?.module)return n.error?dc(e,r.retryContext,n.error,i):t.showPending?Ei():z;let a=n.module;if(!cc(a))return n.error?dc(e,r.retryContext,n.error,i):null;let o=()=>lc(i,()=>a.render(n.data));return n.error?dc(e,r.retryContext,n.error,i,o):o()}var pc,mc;function hc(){return(hc=e((()=>{ui(),di(),Ai(),gi(),ca(),H(),xr(),Vs(),sc(),pc=class{constructor(e,t){this.inputs=t,this.controller=new Bs(()=>e.requestUpdate()),e.addController(this)}get snapshot(){return this.controller.snapshot}hostConnected(){this.controller.setInputs(this.inputs()),this.controller.connect()}hostUpdate(){this.controller.setInputs(this.inputs())}hostDisconnected(){this.controller.disconnect()}},mc=class extends Xn{constructor(...e){super(...e),this.outlet=new pc(this,()=>({router:this.router,onNotFound:this.onNotFound,notFoundRecoveryReady:this.notFoundRecoveryReady})),this.mcpAppUnmountGate=new Li(this)}render(){let e=this.router;if(!e)return z;let t=this.outlet.snapshot,n=Fs(t.active,t.pending),r=n?`${n.routeId}:${n.status}`:`empty`,i=n?.module,a=n&&cc(i)?i.renderOwnerKey?.(n,t.settled):void 0,o=n?.error===void 0?a:void 0,s=o!==void 0&&n?.status===`pending`&&n.data===void 0;return this.mcpAppUnmountGate.render(o??r,()=>fc(e,t,n,{retryContext:this.retryContext}),()=>[this],{retainRenderedValue:s})}},F([fi({attribute:!1})],mc.prototype,`router`,void 0),F([fi({attribute:!1})],mc.prototype,`retryContext`,void 0),F([fi({attribute:!1})],mc.prototype,`onNotFound`,void 0),F([fi({attribute:!1})],mc.prototype,`notFoundRecoveryReady`,void 0),customElements.get(`openclaw-router-outlet`)||customElements.define(`openclaw-router-outlet`,mc)})))()}function gc(e,t){if(!ja(e)||!t||typeof t!=`object`)return;let n=t;return n.kind===`session`&&typeof n.sessionKey==`string`&&n.sessionKey.trim()||void 0}function _c(e){let t=Fs(e.matches[0],e.pendingMatches[0]),n=e.matches[0],r=n?gc(n.routeId,n.data):void 0;return{...t?{routeId:t.routeId,location:t.location}:{},...n?{committedRouteId:n.routeId,committedLocation:n.location}:{},...r?{committedSessionKey:r}:{}}}function vc(){return(vc=e((()=>{G(),hc()})))()}function yc(e,t){if(customElements.get(e))return Promise.resolve();let n=bc.get(e);if(n)return n;let r=Promise.resolve().then(t).then(()=>{if(!customElements.get(e))throw Error(`Custom element module did not define ${e}`)}).finally(()=>{bc.delete(e)});return bc.set(e,r),r}function q(e){return customElements.get(e.tagName)!==void 0}var bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc;function Bc(){return(Bc=e((()=>{H(),sc(),C(),bc=new Map,xc=class{constructor(e,t,n=e=>Ys({canReload:e})){this.host=e,this.onClose=t,this.retryStale=n,this.preloads=new Set,this.activeDismissed=!1}get visibleState(){return this.current}preload(e,t){q(e)||this.preloads.has(e.tagName)||(this.preloads.add(e.tagName),yc(e.tagName,e.loadModule).then(()=>this.host.requestUpdate(),n=>{t?.reportError&&!this.current&&(this.current={element:e,error:n,stale:Hs(n),status:`error`},this.host.requestUpdate())}).finally(()=>this.preloads.delete(e.tagName)))}request(e,t){let n={action:t,element:e,status:`loading`};this.current=n,this.host.requestUpdate(),this.load(n)}requestWhileActive(e,t){t?this.active!==e&&(this.active=e,this.activeDismissed=!1):this.active===e&&(this.active=void 0,this.activeDismissed=!1),!t&&this.current?.element===e?this.abandon():this.pumpActive()}retry(){let e=this.current;if(e?.status!==`error`)return;let t={action:e.action,element:e.element,status:`loading`};this.current=t,this.host.requestUpdate(),(e.stale?this.retryStale(()=>this.current===t):Promise.resolve(!1)).then(e=>{!e&&this.current===t&&this.load(t)})}close(){this.current&&(this.current.element===this.active&&(this.activeDismissed=!0),this.onClose?.(),this.abandon())}abandon(){this.current&&(this.current=void 0,this.host.requestUpdate(),this.pumpActive())}pumpActive(){this.active&&!this.activeDismissed&&!this.current&&!q(this.active)&&this.request(this.active)}load(e){yc(e.element.tagName,e.element.loadModule).then(async()=>{this.current===e&&(this.host.requestUpdate(),await this.host.updateComplete,this.current===e&&((!this.host.queryRenderedElement||this.host.queryRenderedElement(e.element.tagName)!==null)&&e.action?.(),this.current===e&&this.abandon()))},t=>{this.current===e&&(this.current={action:e.action,element:e.element,error:t,stale:Hs(t),status:`error`},this.host.requestUpdate())})}},Sc={tagName:`openclaw-command-palette`,label:`command palette`,loadModule:()=>b(()=>import(`./command-palette-BoOc-8Xf.js`),__vite__mapDeps([25,2,3,4,5,6,7,8,9,10,26,1,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)},Cc=`openclaw-debug-overlay`,wc={tagName:Cc,label:Cc,loadModule:()=>b(()=>import(`./debug-overlay-ptF-J8ul.js`),__vite__mapDeps([27,2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,19,20,21,22,23,28,29]),import.meta.url)},Tc=`openclaw-keyboard-shortcuts-dialog`,Ec={tagName:Tc,label:Tc,loadModule:()=>b(()=>import(`./keyboard-shortcuts-dialog-H2IcvF5A.js`),__vite__mapDeps([30,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)},Dc=`openclaw-macos-titlebar-controls`,Oc={tagName:Dc,label:Dc,loadModule:()=>b(()=>import(`./macos-titlebar-controls.runtime-ByLqIm3x.js`),__vite__mapDeps([31,2,3,4,5,6,7,8]),import.meta.url)},kc={tagName:`openclaw-sidebar-attention`,label:U(`attention.issues`),loadModule:()=>b(()=>import(`./sidebar-attention-fzt-pwc4.js`),__vite__mapDeps([32,6,2,3,4,5,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)},Ac={tagName:`openclaw-terminal-panel`,label:`terminal panel`,loadModule:()=>b(()=>import(`./terminal-panel-registration-CCniUaOS.js`),__vite__mapDeps([33,2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,19,20,21,22,23,34,35,36]),import.meta.url)},jc={tagName:`openclaw-browser-panel`,label:`browser panel`,loadModule:()=>b(()=>import(`./browser-panel-BNW001UL.js`),__vite__mapDeps([37,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,34,35,36]),import.meta.url)},Mc={tagName:`openclaw-desktop-panel`,label:`desktop panel`,loadModule:()=>b(()=>import(`./desktop-panel-D3-Tqe5h.js`),__vite__mapDeps([38,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,34,35]),import.meta.url)},Nc={tagName:`openclaw-board-document`,label:`dashboard document`,loadModule:()=>b(()=>import(`./board-document-CjY7JU6O.js`),__vite__mapDeps([39,2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,19,20,21,22,23,40,41,42]),import.meta.url)},Pc={tagName:`openclaw-custodian-panel`,label:`custodian panel`,loadModule:()=>b(()=>import(`./custodian-panel-WuoyOsWA.js`),__vite__mapDeps([43,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,44,45,46,47,48,49,50,51,52,53,54,55,56,35,57]),import.meta.url)},Fc={tagName:`openclaw-approval-page`,label:`approval page`,loadModule:()=>b(()=>import(`./approval-page-registration-90H9Ag-v.js`),__vite__mapDeps([58,2,3,4,5,6,7,8,9,10,59,60,61]),import.meta.url)},Ic=`openclaw-question-page`,Lc={tagName:Ic,label:Ic,loadModule:()=>b(()=>import(`./question-page-registration-zhqoLjJ5.js`),__vite__mapDeps([62,2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,19,20,21,22,23,60,61,63]),import.meta.url)},Rc=`openclaw-exec-approval`,zc={tagName:Rc,label:Rc,loadModule:()=>b(()=>import(`./exec-approval-BnwUQx-C.js`),__vite__mapDeps([64,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)}})))()}function Vc(e){let t=e.indexOf(`#`),n=t===-1?e:e.slice(0,t),r=t===-1?``:e.slice(t),i=n.indexOf(`?`);return i!==-1&&new URLSearchParams(n.slice(i+1)).has(Uc.name)?e:`${n}${i===-1?`?`:`&`}${Uc.name}=${Uc.value}${r}`}function Hc(e,t=``,n){return Ie(e,t,n)}var Uc;function Wc(){return(Wc=e((()=>{M(),Uc={name:`nav`,value:`collapsed`}})))()}function Gc(e){let t=e.agentId?.trim()||ot(e.sessionKey)?.agentId;t&&e.selection.set(o(t)),e.gateway.setSessionKey(e.sessionKey)}function Kc(e,t,n){let r=e=>{let n=e?.trim()?o(e):null,r=t.state.agentsList;if(!r||r.agents.length===0)return n;let i=o(r.defaultId);return!n||!r.agents.some(e=>o(e.id)===n)?i:n},i=e=>{let n=e?.trim()?o(e):null;return t.state.agentsList?.agents.some(e=>e.kind===`system`&&o(e.id)===n)?null:n},a=e.connection.gatewayUrl,s=n?.load(a)?.trim(),c=r(s?o(s):e.snapshot.assistantAgentId?o(e.snapshot.assistantAgentId):null),l={selectedId:c,scopeId:i(c)},u=e.snapshot.assistantAgentId?o(e.snapshot.assistantAgentId):null,d=!s||c!==o(s);s&&d&&n?.save(a,null);let f=new Set,p=e=>{let t=r(e.selectedId),n=t===e.selectedId?e.scopeId:t,a={selectedId:t,scopeId:i(n)};if(l.selectedId!==a.selectedId||l.scopeId!==a.scopeId){l=a;for(let e of f)e(l)}};return e.subscribe(t=>{let r=t.assistantAgentId?o(t.assistantAgentId):null,i=r!==u;u=r;let s=e.connection.gatewayUrl;if(s!==a){a=s;let e=n?.load(a)?.trim();d=!e;let t=e?o(e):r;p({selectedId:t,scopeId:t});return}i&&d&&r&&p({selectedId:r,scopeId:r})}),t.subscribe(()=>{!d&&r(l.selectedId)!==l.selectedId&&(d=!0,n?.save(a,null)),p(d&&u?{selectedId:u,scopeId:l.selectedId===u?l.scopeId:u}:l)}),{get state(){return l},set(e){let t=e?.trim()?o(e):null;d=!t||r(t)!==t,n?.save(a,d?null:t),p({selectedId:t,scopeId:t})},setScope(e){let t=e?.trim()?o(e):null;p({...l,scopeId:t})},subscribe(e){return f.add(e),()=>f.delete(e)}}}function qc(){return(qc=e((()=>{Ln()})))()}function Jc(e,t,n){let r=`${xa(t)}${n}`;if(e===r||e===`${r}/`)return null;let i=`${r}/`;if(!e.startsWith(i))return;let a=e.slice(i.length);if(!a||a.includes(`/`))return null;try{let e=decodeURIComponent(a);return e&&e!==`.`&&e!==`..`?e:null}catch{return null}}function Yc(e,t){let n=Jc(e,t,Wa.approval);return n===void 0?null:{kind:`approval`,approvalId:n}}function Xc(e,t){let n=Jc(e,t,Wa.question);return n===void 0?null:{kind:`question`,questionId:n}}function Zc(e,t){return Yc(e,t)??Xc(e,t)}function Qc(){return(Qc=e((()=>{G()})))()}function $c(){let e=new Map,t=!1,n=(e=[])=>Et(e),r=e=>{let t=new Map(e.attachments.map(e=>[e.id,e]));for(let n of Object.values(e.fallbacks))for(let e of n.attachments)t.set(e.id,e);return[...t.values()]},i=(e,t=new Set)=>{e&&n(r(e).filter(e=>!t.has(e.id)))},a=(e,t)=>JSON.stringify([e,t]),o=t=>{let n=e.get(t);return n&&e.delete(t),n};return{prepare:({owner:r,paneId:s,scopeKey:c,attachments:l,fallbacks:u,message:d=``})=>{let f=a(s,c),p=o(f),m=Object.entries(u);if(!d&&l.length===0&&m.length===0){i(p);return}let h=new Set(l.map(e=>e.id));for(let e of Object.values(u))for(let t of e.attachments)h.add(t.id);if(i(p,h),!r||t){n(l);for(let e of Object.values(u))n(e.attachments);return}e.set(f,{owner:r,preparedAt:Date.now(),paneId:s,scopeKey:c,attachments:[...l],message:d,fallbacks:Object.fromEntries(m.map(([e,t])=>[e,{...t,attachments:[...t.attachments]}]))});for(let t of e.keys()){if(e.size<=el)break;i(o(t))}},consume:({owner:e,paneId:t,scopeKey:n})=>{let r=o(a(t,n));return r?.owner===e?{attachments:r.attachments,fallbacks:r.fallbacks,...r.message?{message:r.message}:{}}:(i(r),null)},retireScope:(t,n)=>{for(let[r,a]of e)a.scopeKey===t&&a.preparedAt<n&&i(o(r))},clearPane:t=>{for(let[n,r]of e)r.paneId===t&&i(o(n))},dispose:()=>{t=!0;for(let t of e.values())i(t);e.clear()}}}var el;function tl(){return(tl=e((()=>{Bt(),el=32})))()}function nl(e){return e?/[\r\n]/.test(e)?null:e:null}function rl(e){return nl(I(e.hello?.auth?.deviceToken)??null)??nl(I(e.settings?.token)??null)??nl(I(e.password)??null)??null}function il(e){let t=rl(e);return t?`Bearer ${t}`:null}function al(e){return De([I(e.hello?.auth?.deviceToken),I(e.settings?.token),I(e.password)].flatMap(e=>nl(e??null)??[]))}function ol(){return(ol=e((()=>{j()})))()}function sl(){if(typeof document>`u`)return null;let e=document.documentElement.getAttribute(i);return e===`true`||e!==`false`&&null}function cl(e,t){let n=document.documentElement;(e||t||n.hasAttribute(`data-openclaw-environment`)||n.style.getPropertyValue(`--ring`))&&b(async()=>{let{applyControlUiPresentation:e}=await import(`./control-ui-environment-presentation.runtime-CUzY9dKZ.js`);return{applyControlUiPresentation:e}},__vite__mapDeps([65,2,3,4,5,6,7,8]),import.meta.url).then(({applyControlUiPresentation:n})=>n({environment:e,seamColor:t}))}function ll(e){return{assistantIdentity:Or({agentId:e.assistantAgentId,name:e.assistantName,avatar:e.assistantAvatar,avatarSource:e.assistantAvatarSource,avatarStatus:e.assistantAvatarStatus,avatarReason:e.assistantAvatarReason}),serverVersion:e.serverVersion??null,serverBuildId:e.serverBuildId??null,devGitBranch:e.devGitBranch?.trim()||null,environment:e.environment??null,localMediaPreviewRoots:e.localMediaPreviewRoots??[],embedSandboxMode:e.embedSandbox??`scripts`,allowExternalEmbedUrls:!!e.allowExternalEmbedUrls,automaticallyFetchFavicons:!!e.automaticallyFetchFavicons,terminalEnabled:!!e.terminalEnabled,cliAgentsEnabled:!!e.cliAgentsEnabled,pluginFrameGrants:(e.pluginFrameGrants??[]).filter(e=>typeof e?.pluginId==`string`&&typeof e.path==`string`&&(e.match===`exact`||e.match===`prefix`))}}async function ul(e){if(typeof window>`u`||typeof fetch!=`function`)return null;let t=`${Ce(e.resourceBasePath)}${h}`;try{let n=new URL(t,window.location.origin).origin===window.location.origin,r=n?al(e.auth??{}):[];if(e.skipWithoutAuthCandidate&&n&&!r.length)return null;let i=null;for(let n of r.length?r:[``]){let r={Accept:`application/json`};if(n&&(r.Authorization=`Bearer ${n}`),i=await fetch(t,{method:`GET`,headers:r,credentials:`same-origin`,signal:e.signal}),i.ok)break;if(i.status!==401&&i.status!==403)return null}if(!i?.ok)return null;let a=await i.json(),o=ll(a);return cl(o.environment,a.seamColor),o}catch{return null}}function dl(e){let t=fl,n=document.documentElement.getAttribute(T);n&&(t={...t,environment:JSON.parse(n)},cl(t.environment));let r=e.auth,i=0,a=new Set;return{get current(){return t},async refresh(n){r=n?.auth??r;let o=++i,s=await ul({resourceBasePath:e.resourceBasePath,auth:r,skipWithoutAuthCandidate:n?.skipWithoutAuthCandidate,signal:n?.signal});if(!s||o!==i)return null;let c=sl();if(c!==null&&s.terminalEnabled!==c)return window.location.reload(),s;t=s;for(let e of a)e(t);return s},subscribe(e){return a.add(e),()=>a.delete(e)}}}var fl;function pl(){return(pl=e((()=>{re(),k(),Nn(),ol(),C(),fl={assistantIdentity:Or(),serverVersion:null,serverBuildId:null,devGitBranch:null,environment:null,localMediaPreviewRoots:[],embedSandboxMode:`strict`,allowExternalEmbedUrls:!1,automaticallyFetchFavicons:!1,terminalEnabled:sl()??!1,cliAgentsEnabled:!1,pluginFrameGrants:[]}})))()}function ml(e){let t=e.trim().replace(/^#/,``);if(!/^[0-9a-fA-F]{6}$/.test(t))return`#ffffff`;let n=e=>{let n=Number.parseInt(t.slice(e,e+2),16)/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(2)+.0722*n(4)>.179?`#000000`:`#ffffff`}function hl(){return(hl=e((()=>{})))()}function gl(){if(typeof document>`u`)return;let e=document.documentElement,t=getComputedStyle(e),n=t.getPropertyValue(`--bg`).trim(),r=globalThis.matchMedia?.(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`).matches&&document.querySelector(`.shell--chat`)&&t.getPropertyValue(`--bg-content`).trim()||n;if(r){e.style.setProperty(`--control-ui-system-chrome-background`,r);for(let e of document.querySelectorAll(`meta[name="theme-color"]`))e.content=r,e.removeAttribute(`media`)}}function _l(e){xl=e;let t=document.documentElement,n=(xl??bl)?.trim().replace(/^#/,``),r=n&&/^[0-9a-fA-F]{6}$/.test(n)?`#${n}`:null;if(!r){for(let e of yl)t.style.removeProperty(e);return}let i=ml(r),a=(e,t)=>`color-mix(in srgb, var(${e}) ${t}%, transparent)`;for(let e of[`--ring`,`--accent`,`--accent-muted`,`--primary`])t.style.setProperty(e,r);for(let e of[`--accent-foreground`,`--primary-foreground`])t.style.setProperty(e,i);t.style.setProperty(`--accent-hover`,`color-mix(in srgb, var(--accent) 82%, white 18%)`),t.style.setProperty(`--primary-hover`,`color-mix(in srgb, var(--primary) 82%, white 18%)`),t.style.setProperty(`--accent-subtle`,a(`--accent`,16)),t.style.setProperty(`--accent-glow`,a(`--accent`,30)),t.style.setProperty(`--focus`,a(`--ring`,22)),t.style.setProperty(`--focus-ring`,`0 0 0 2px var(--bg), 0 0 0 3px ${a(`--ring`,80)}`),t.style.setProperty(`--focus-glow`,`0 0 0 2px var(--bg), 0 0 0 3px var(--ring), 0 0 16px var(--accent-glow)`)}function vl(e){bl=e,_l(xl)}var yl,bl,xl;function Sl(){return(Sl=e((()=>{yl=[`--ring`,`--accent`,`--accent-foreground`,`--accent-hover`,`--accent-muted`,`--accent-subtle`,`--accent-glow`,`--primary`,`--primary-hover`,`--primary-foreground`,`--focus`,`--focus-ring`,`--focus-glow`]})))()}function Cl(e){if(!Nl.test(e))throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function wl(e,t){let n=I(e);if(!n||n.length>Fl)throw Error(`Unsupported tweakcn token: ${t}`);let r=n.toLowerCase();if(Il.some(e=>r.includes(e))||n.includes(`/*`)||n.includes(`*/`)||n.includes(`\\`))throw Error(`Unsupported tweakcn token: ${t}`);for(let e of n){let n=e.charCodeAt(0);if(n<32||n===127||e===`{`||e===`}`||e===`;`||e===`<`||e===`>`||e==="`")throw Error(`Unsupported tweakcn token: ${t}`)}return n}function Tl(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||e===` `||Ll.has(e)}function El(e,t){let n=wl(e,t);if(n.includes(`(`)||n.includes(`)`)||!Array.from(n).every(Tl))throw Error(`Unsupported tweakcn token: ${t}`);return n}function Dl(e){return Object.fromEntries(e)}function Ol(e){if(!e||typeof e!=`object`)return null;let t=[];for(let n of Rl){let r=n===`font-body`||n===`font-display`||n===`mono`?El(e[n],n):wl(e[n],n);t.push([n,r])}return Dl(t)}function kl(e){let t=I(e);return t?g(t,80):`Custom`}function Al(e){let t=P(e);if(!t)return null;let{sourceUrl:n,themeId:r,label:i,importedAt:a}=t;if(typeof n!=`string`||typeof r!=`string`||typeof i!=`string`||typeof a!=`string`)return null;try{Cl(r);let e=Ol(P(t.light)??void 0),o=Ol(P(t.dark)??void 0);return!e||!o?null:{sourceUrl:n,themeId:r,label:kl(i),importedAt:a,light:e,dark:o}}catch{return null}}function jl(e){let t=Ol(e.light),n=Ol(e.dark);if(!t||!n)throw Error(`Stored custom theme is missing required tokens.`);let r=e=>Rl.map(t=>` --${t}: ${e[t]};`).join(`
|
|
`);return[`:root[data-theme="custom"] {`,r(n),`}`,`:root[data-theme="custom-light"] {`,r(t),`}`].join(`
|
|
`)}function Ml(e){if(typeof document>`u`)return;let t=document.getElementById(Pl);if(!e){t?.remove();return}let n;try{n=jl(e)}catch{t?.remove();return}if(!n){t?.remove();return}t||(t=document.createElement(`style`),t.id=Pl,document.head.appendChild(t)),t.textContent=n}var Nl,Pl,Fl,Il,Ll,Rl;function zl(){return(zl=e((()=>{Nl=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Pl=`openclaw-custom-theme`,Fl=240,Il=[`url(`,`image(`,`image-set(`,`-webkit-image-set(`,`cross-fade(`,`element(`,`-moz-element(`,`paint(`,`@import`,`expression(`],Ll=new Set([`,`,`'`,`"`,`.`,`_`,`-`]),Rl=`bg.bg-accent.bg-elevated.bg-hover.bg-muted.bg-content.card.card-foreground.card-highlight.popover.popover-foreground.panel.panel-strong.panel-hover.chrome.chrome-strong.text.text-strong.chat-text.muted.muted-strong.muted-foreground.border.border-strong.border-hover.input.ring.accent.accent-hover.accent-muted.accent-subtle.accent-foreground.accent-glow.primary.primary-foreground.secondary.secondary-foreground.accent-2.accent-2-muted.accent-2-subtle.destructive.destructive-foreground.danger.danger-muted.danger-subtle.focus.focus-ring.focus-glow.font-body.font-display.mono.grid-line`.split(`.`)})))()}function Bl(e){let t=e.hello?.auth;return e.phase!==`connected`||t?.scopes===void 0||Ss(t)?{phase:`hidden`}:da(e,`device.scopes.requestUpgrade`)===!0&&da(e,`device.scopes.waitUpgrade`)===!0&&e.client?.scopeUpgradeReady===!0?{phase:`available`}:{phase:`guidance`}}function Vl(){return(Vl=e((()=>{pa(),Ts()})))()}function Hl(e){let t=new Set,n=e.snapshot,r=null,i=Bl(n),a=e=>{if(JSON.stringify(i)!==JSON.stringify(e)){i=e;for(let e of t)e()}},o=()=>{r&&a(r.state)},s=e.subscribe(e=>{n=e,r?.sync(n),a(r?.state??Bl(n))});return{get state(){return i},activate(e){r??=new e(n,o),r.sync(n),a(r.state)},request:()=>r?.request(),retry:()=>r?.retry(),cancel:()=>r?.cancel(),subscribe(e){return t.add(e),()=>t.delete(e)},dispose(){s(),r?.dispose(),r=null,t.clear()}}}function Ul(){return(Ul=e((()=>{Vl()})))()}function Wl(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(`(prefers-color-scheme: light)`).matches}function Gl(e,t){let n=typeof e==`string`?e:``,r=typeof t==`string`?t:``;return{theme:Yl.has(n)?n:`claw`,mode:Xl.has(r)?r:`system`}}function Kl(e){return e===`system`?Wl()?`light`:`dark`:e}function ql(e,t){let n=Kl(t);if(e===`claw`)return n===`light`?`light`:`dark`;let r=e===`knot`?`openknot`:e;return n===`light`?`${r}-light`:r}function Jl(e,t){if(typeof document>`u`||e===`claw`||e===`custom`){t();return}let n=`openclaw-theme-palette-${e}`,r=document.getElementById(n);if(r instanceof HTMLLinkElement&&r.sheet){t();return}let i=r instanceof HTMLLinkElement?r:document.createElement(`link`),a=e=>{i.removeEventListener(`load`,a),i.removeEventListener(`error`,a),e.type===`error`&&(console.error(`Theme palette failed to load; reload to retry: ${i.href}`),i.remove()),t()};i.addEventListener(`load`,a),i.addEventListener(`error`,a),r||(i.id=n,i.rel=`stylesheet`,i.href=to(`themes/${e}.css`),document.head.append(i))}var Yl,Xl;function Zl(){return(Zl=e((()=>{ro(),Yl=new Set([`claw`,`knot`,`dash`,`absolutely`,`tide`,`beacon`,`phosphor`,`custom`]),Xl=new Set([`system`,`light`,`dark`])})))()}function Ql(e){return ce.find(t=>t===e)}function $l(e,t,n){let r=cu[e];return{ui:t??r.ui,chat:n??r.chat}}function eu(e){let t=`openclaw-typeface-${e}`,n=su[e].asset;if(!n||document.getElementById(t))return;let r=document.createElement(`link`);r.id=t,r.rel=`stylesheet`,r.href=to(n),document.head.append(r)}function tu(e){typeof document>`u`||(eu(e.ui),eu(e.chat),eu(`jetbrains-mono`))}function nu(){ce.forEach(eu)}function ru(e,t){for(let[n,r]of[[`--font-body`,e],[`--font-chat`,t]])r?document.documentElement.style.setProperty(n,su[r].stack):document.documentElement.style.removeProperty(n)}function iu(e){ou[e].kind===`serif`?document.documentElement.style.setProperty(`--chat-font-smoothing`,`auto`):document.documentElement.style.removeProperty(`--chat-font-smoothing`)}var au,ou,su,cu;function lu(){return(lu=e((()=>{we(),ro(),au={sans:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`,serif:`Georgia, "Times New Roman", serif`,mono:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace`},ou={"instrument-sans":{label:`Instrument Sans`,kind:`sans`},geist:{label:`Geist`,kind:`sans`},"dm-sans":{label:`DM Sans`,kind:`sans`},"ibm-plex-sans":{label:`IBM Plex Sans`,kind:`sans`},"space-grotesk":{label:`Space Grotesk`,kind:`sans`},"atkinson-hyperlegible":{label:`Atkinson Hyperlegible`,family:`Atkinson Hyperlegible Next`,kind:`sans`},fraunces:{label:`Fraunces`,kind:`serif`},lora:{label:`Lora`,kind:`serif`},"jetbrains-mono":{label:`JetBrains Mono`,kind:`mono`},system:{label:`System`,kind:`sans`}},su=Object.fromEntries(ce.map(e=>{let{label:t,family:n=t,kind:r}=ou[e];return[e,{label:t,stack:e===`system`?au.sans:`"${n}", ${au[r]}`,asset:e===`system`?void 0:`fonts/${e}.css`}]})),cu={claw:{ui:`instrument-sans`,chat:`instrument-sans`},knot:{ui:`geist`,chat:`geist`},dash:{ui:`dm-sans`,chat:`fraunces`},absolutely:{ui:`space-grotesk`,chat:`lora`},tide:{ui:`ibm-plex-sans`,chat:`ibm-plex-sans`},beacon:{ui:`atkinson-hyperlegible`,chat:`atkinson-hyperlegible`},phosphor:{ui:`jetbrains-mono`,chat:`jetbrains-mono`},custom:{ui:`system`,chat:`system`}}})))()}function uu(e){let t=I(e);return t?Ue(t)?t.length<=_u?t:null:/[\r\n]/.test(t)?null:t.length<=gu?t:null:null}function du(e){let t=I(e?.name);return{name:t?g(t,hu):null,avatar:uu(e?.avatar)}}function fu(e,t=`You`){return du(e).name??t}function pu(e){let t=du(e);return wr(t.avatar,{identity:{avatar:t.avatar??void 0}})}function mu(e){let t=du(e),n=I(t.avatar);return n?pu(t)?null:n:null}var hu,gu,_u;function vu(){return(vu=e((()=>{Yt(),hu=50,gu=16,_u=2e6})))()}function yu(e){return`${Yu}${R(e)}`}function bu(e){return`${Qu}${R(e)}`}function xu(e){let t=0;for(let n of e)if(n===`(`)t++;else if(n===`)`&&(t--,t<0))return!1;return t===0}function Su(e){for(let t of e.matchAll(sd)){let e=t[0].toLowerCase();if(!id.has(e)&&!rd.has(e)&&!ad.has(e))return!1}return!0}function Cu(e){if(typeof e!=`string`)return;let t=e.trim().replace(/\s+/g,` `);if(t.length!==0&&!(t.length>ld)){if(rd.has(t.toLowerCase())||cd.test(t))return t;if(!(!od.test(t)||!xu(t)||!Su(t)))return/^(?:calc|clamp|fit-content|max|min)\(.+\)$/i.test(t)?t:void 0}}function wu(e,t){return n=>e.includes(n)?n:t}function Tu(e){return fd.includes(e)?e:void 0}function Eu(e){return typeof e==`string`&&/^#[0-9a-f]{6}$/i.test(e)?e.toLowerCase():void 0}function Du(e,t=100){if(typeof e!=`number`||!Number.isFinite(e))return t;let n=nd[0],r=Math.abs(e-n);for(let t of nd){let i=Math.abs(e-t);i<r&&(n=t,r=i)}return n}function Ou(e,t){let n=t.trim();!n||e.settings.lastActiveSessionKey===n||e.applySettings({lastActiveSessionKey:n})}function ku(){return typeof document>`u`?!1:!!document.querySelector(`script[src*="/@vite/client"]`)}function Au(e,t){return`${e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}:${t}`}function ju(){let e=location.protocol===`https:`?`wss`:`ws`,t=Ya(location.pathname)[0],n=`${e}://${location.host}${t}`;return ku()?{pageUrl:n,effectiveUrl:`${e}://${Au(location.hostname,`18789`)}`}:{pageUrl:n,effectiveUrl:n}}function Mu(e){let{effectiveUrl:t}=ju();if(R(e.gatewayUrl)===R(t))return e;let n=zu(t);return{...e,gatewayUrl:t,token:Vu(e.gatewayUrl,t,{token:e.token,password:``}).token,sessionKey:n.sessionKey,lastActiveSessionKey:n.lastActiveSessionKey}}function Nu(){return $n()}function Pu(e){return e?fe(e)??null:null}function Fu(e,t){let n=I(e.gatewayUrl);return n?R(n)===R(t):!1}function Iu(e,t){let n=Pu(e?.getItem(yu(t))??null);return n&&(!I(n.gatewayUrl)||Fu(n,t))?{gatewayUrl:I(n.gatewayUrl)??t,parsed:n}:null}function Lu(e){return`${td}${R(e)}`}function Ru(e,t,n){let r=R(e),i=t.sessionsByGateway?.[r],a=I(i?.sessionKey),s=I(i?.lastActiveSessionKey),c=I(i?.selectedAgentId);if(a&&s)return{sessionKey:a,lastActiveSessionKey:s,...c?{selectedAgentId:o(c)}:{}};let l=I(t.sessionKey)??n.sessionKey;return{sessionKey:l,lastActiveSessionKey:I(t.lastActiveSessionKey)??l??n.lastActiveSessionKey}}function zu(e){let t={sessionKey:`main`,lastActiveSessionKey:`main`};try{let n=Iu(nr(),e);return n?Ru(e,n.parsed,t):t}catch{return t}}function Bu(e){try{let t=Nu();if(!t)return``;t.removeItem(ed);let n=t.getItem(Lu(e));return I(n)??``}catch{return``}}function Vu(e,t,n){let r=R(e)===R(t),i=ie(e)===ie(t);return{token:r?n.token:Bu(t),password:i?n.password:``}}function Hu(e,t){try{let n=Nu();if(!n)return;n.removeItem(ed);let r=Lu(e),i=I(t)??``;if(i){n.setItem(r,i);return}n.removeItem(r)}catch{}}function Uu(){let e=vd;if(e)return{...e,token:Bu(e.gatewayUrl)};let{pageUrl:t,effectiveUrl:n}=ju(),r=nr(),i={gatewayUrl:n,token:Bu(n),sessionKey:`main`,lastActiveSessionKey:`main`,theme:J.theme,themeMode:J.themeMode,chatShowThinking:!0,chatShowToolCalls:!0,chatPersistCommentary:!0,chatCollapseTaskProgress:J.chatCollapseTaskProgress,chatSendShortcut:J.chatSendShortcut,catalogOpenTarget:J.catalogOpenTarget,navCollapsed:!1,navWidth:Zu,sidebarEntries:[...ko],sidebarLiveActivity:J.sidebarLiveActivity,showAdvancedSettings:!1,pinnedAgentIds:[],composerHoldToRecord:J.composerHoldToRecord};try{let e=I(r?.getItem(bu(t))),a=(e?Iu(r,e):null)??Iu(r,n);if(!a)return i;let o=a.parsed,s=a.gatewayUrl,c=s===t?n:s,l=Ru(c,o,i),u=Al(o.customTheme),{theme:d,mode:f}=Gl(o.theme,o.themeMode),p=D(o)??{},m=Object.hasOwn(p,`sidebarEntries`)?null:Array.isArray(p.sidebarPinnedRoutes)?lo(p.sidebarPinnedRoutes.flatMap(e=>oo(e)?[co({type:`route`,route:e})]:[])):null,h={gatewayUrl:c,token:Bu(c),sessionKey:l.sessionKey,lastActiveSessionKey:l.lastActiveSessionKey,selectedAgentId:l.selectedAgentId,theme:d===`custom`&&!u?`claw`:d,themeMode:f,accent:Eu(o.accent),fontUi:Ql(o.fontUi),fontChat:Ql(o.fontChat),chatShowThinking:typeof o.chatShowThinking==`boolean`?o.chatShowThinking:i.chatShowThinking,chatShowToolCalls:typeof o.chatShowToolCalls==`boolean`?o.chatShowToolCalls:i.chatShowToolCalls,chatPersistCommentary:typeof o.chatPersistCommentary==`boolean`?o.chatPersistCommentary:i.chatPersistCommentary,chatCollapseTaskProgress:typeof o.chatCollapseTaskProgress==`boolean`?o.chatCollapseTaskProgress:i.chatCollapseTaskProgress,chatSendShortcut:dd(o.chatSendShortcut),chatFollowUpMode:Tu(o.chatFollowUpMode),catalogOpenTarget:hd(o.catalogOpenTarget),realtimeTalkInputDeviceId:I(o.realtimeTalkInputDeviceId),realtimeTalkVideoDeviceId:I(o.realtimeTalkVideoDeviceId),composerHoldToRecord:typeof o.composerHoldToRecord==`boolean`?o.composerHoldToRecord:i.composerHoldToRecord,talkCameraAutoEnable:typeof o.talkCameraAutoEnable==`boolean`?o.talkCameraAutoEnable:void 0,chatSplitLayout:Jn(o.chatSplitLayout),chatWorkspaceDock:_d(o.chatWorkspaceDock),boardSessionViews:Kn(o.boardSessionViews),sidebarSessionLayouts:Fn(o.sidebarSessionLayouts),sidebarSessionActivePanels:or(o.sidebarSessionActivePanels),navCollapsed:i.navCollapsed,navWidth:typeof o.navWidth==`number`&&o.navWidth>=240&&o.navWidth<=400?o.navWidth:i.navWidth,sidebarEntries:lo(p.sidebarEntries)??m??i.sidebarEntries,sidebarLiveActivity:typeof o.sidebarLiveActivity==`boolean`?o.sidebarLiveActivity:i.sidebarLiveActivity,chatMessageMaxWidth:Cu(o.chatMessageMaxWidth),showAdvancedSettings:typeof o.showAdvancedSettings==`boolean`?o.showAdvancedSettings:i.showAdvancedSettings,pinnedAgentIds:Me(o.pinnedAgentIds),textScale:typeof o.textScale==`number`&&Du(o.textScale)!==J.textScale?Du(o.textScale):void 0,customTheme:u??void 0,locale:Pi(o.locale)?o.locale:void 0,...o.lobsterPetVisits===!1?{lobsterPetVisits:!1}:{},...o.lobsterPetSounds===!0?{lobsterPetSounds:!0}:{},...o.sessionDeleteConfirm===!1?{sessionDeleteConfirm:!1}:{},...o.openLinksInControlUiBrowser===!0?{openLinksInControlUiBrowser:!0}:{}};return(`token`in o||m!==null)&&Ju(h,{selectGateway:!0}),h}catch{return i}}function Wu(e){Ju(e)}function Gu(e){yd=e}function Ku(e,t={}){let n=Uu(),r={...n,...e};return Ju(r,{selectGateway:t.selectGateway??e.gatewayUrl!==void 0}),yd?.(n,r),r}function qu(){let e=nr();try{let t=e?.getItem($u);return t?du(JSON.parse(t)):du()}catch{return du()}}function Ju(e,t={}){Hu(e.gatewayUrl,e.token);let n=nr(),r=R(e.gatewayUrl),i=yu(e.gatewayUrl),a=Eu(e.accent),s=Ql(e.fontUi),c=Ql(e.fontChat),l=Tu(e.chatFollowUpMode),u={};try{let t=Iu(n,e.gatewayUrl);if(t){let e=t.parsed;e.sessionsByGateway&&typeof e.sessionsByGateway==`object`&&(u=e.sessionsByGateway)}}catch{}let d=Object.fromEntries([...Object.entries(u).filter(([e])=>e!==r),[r,{sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,...I(e.selectedAgentId)?{selectedAgentId:o(e.selectedAgentId)}:{}}]].slice(-10)),f={gatewayUrl:e.gatewayUrl,theme:e.theme,themeMode:e.themeMode,...a?{accent:a}:{},...s?{fontUi:s}:{},...c?{fontChat:c}:{},chatShowThinking:e.chatShowThinking,chatShowToolCalls:e.chatShowToolCalls,chatPersistCommentary:e.chatPersistCommentary??!0,...e.chatCollapseTaskProgress===!0?{chatCollapseTaskProgress:!0}:{},...dd(e.chatSendShortcut)===`modifier-enter`?{chatSendShortcut:`modifier-enter`}:{},...l?{chatFollowUpMode:l}:{},...hd(e.catalogOpenTarget)===`terminal`?{catalogOpenTarget:`terminal`}:{},...I(e.realtimeTalkInputDeviceId)?{realtimeTalkInputDeviceId:I(e.realtimeTalkInputDeviceId)}:{},...I(e.realtimeTalkVideoDeviceId)?{realtimeTalkVideoDeviceId:I(e.realtimeTalkVideoDeviceId)}:{},...e.composerHoldToRecord===!1?{composerHoldToRecord:!1}:{},...typeof e.talkCameraAutoEnable==`boolean`?{talkCameraAutoEnable:e.talkCameraAutoEnable}:{},...e.chatSplitLayout?{chatSplitLayout:e.chatSplitLayout}:{},...e.chatWorkspaceDock===`bottom`?{chatWorkspaceDock:`bottom`}:{},...e.boardSessionViews&&Object.keys(e.boardSessionViews).length>0?{boardSessionViews:Kn(e.boardSessionViews)}:{},...e.sidebarSessionLayouts&&Object.keys(e.sidebarSessionLayouts).length>0?{sidebarSessionLayouts:Fn(e.sidebarSessionLayouts)}:{},...e.sidebarSessionActivePanels&&Object.keys(e.sidebarSessionActivePanels).length>0?{sidebarSessionActivePanels:or(e.sidebarSessionActivePanels)}:{},navWidth:e.navWidth,sidebarEntries:e.sidebarEntries,...e.sidebarLiveActivity===!1?{sidebarLiveActivity:!1}:{},...Cu(e.chatMessageMaxWidth)?{chatMessageMaxWidth:Cu(e.chatMessageMaxWidth)}:{},...e.showAdvancedSettings===!0?{showAdvancedSettings:!0}:{},...e.pinnedAgentIds&&e.pinnedAgentIds.length>0?{pinnedAgentIds:e.pinnedAgentIds}:{},...e.textScale===void 0?{}:{textScale:Du(e.textScale)},...e.customTheme?{customTheme:e.customTheme}:{},sessionsByGateway:d,...e.locale?{locale:e.locale}:{},...e.lobsterPetVisits===!1?{lobsterPetVisits:!1}:{},...e.lobsterPetSounds===!0?{lobsterPetSounds:!0}:{},...e.sessionDeleteConfirm===!1?{sessionDeleteConfirm:!1}:{},...e.openLinksInControlUiBrowser===!0?{openLinksInControlUiBrowser:!0}:{}},p=JSON.stringify(f);vd=e;try{let{pageUrl:r}=ju(),a=bu(r);n?.setItem(i,p),(t.selectGateway||n?.getItem(a)==null)&&n?.setItem(a,e.gatewayUrl),n?.removeItem(Xu),n&&(vd=null)}catch{}}var Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,J,vd,yd;function bd(){return(bd=e((()=>{m(),te(),j(),Bo(),H(),Kr(),Lr(),He(),$a(),zl(),Zl(),lu(),vu(),Yu=`openclaw.control.settings.v1:`,Xu=`openclaw.control.settings.v1`,Zu=258,Qu=`openclaw.control.currentGateway.v1:`,$u=`openclaw.control.user.v1`,ed=`openclaw.control.token.v1`,td=`openclaw.control.token.v1:`,nd=[90,100,110,125,140],rd=new Set([`none`,`min-content`,`max-content`]),id=new Set([`calc`,`clamp`,`fit-content`,`max`,`min`]),ad=new Set([`ch`,`em`,`rem`,`vh`,`vmax`,`vmin`,`vw`,`px`]),od=/^[0-9A-Za-z.%+\-*/(),\s]+$/,sd=/[A-Za-z][A-Za-z0-9-]*/g,cd=/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|ch|vw|vh|vmin|vmax|%)$/i,ld=96,ud=[`enter`,`modifier-enter`],dd=wu(ud,`enter`),fd=[`queue`,`steer`],pd=wu(fd,`steer`),md=[`viewer`,`terminal`],hd=wu(md,`viewer`),gd=[`right`,`bottom`],_d=wu(gd,`right`),J={theme:`claw`,themeMode:`system`,textScale:100,sidebarLiveActivity:!0,chatMessageMaxWidth:`48rem`,chatCollapseTaskProgress:!1,chatSendShortcut:`enter`,catalogOpenTarget:`viewer`,composerHoldToRecord:!0,lobsterPetVisits:!0,lobsterPetSounds:!1,sessionDeleteConfirm:!0},vd=null,yd=null})))()}function xd(e){if(!e||typeof e!=`object`)return;let t=e.presence;return Array.isArray(t)?t:void 0}function Sd(e,t){if(!t)return null;let n=e.find(e=>e.instanceId===t&&e.reason!==`disconnect`);return n?.user?.id?n.user:null}function Cd({snapshotUser:e,presenceEntries:t,presenceInstanceId:n}){return e??Sd(t??[],n)}function wd(){return(wd=e((()=>{})))()}function Td(e,t,n,r){for(let i of Array.from(e)){if(r&&!r(t))return;try{i(t)}catch(e){console.error(`[gateway] ${n} handler error:`,e)}}}function Ed(e,t){return e?.id===t?.id&&e?.identity?.id===t?.identity?.id&&e?.email===t?.email&&e?.name===t?.name&&e?.avatarUrl===t?.avatarUrl}function Dd(e,t=``,n=``,r=Ad,i={}){let a=e,o=i.persistDefaultConnectionSettings!==!1,s={gatewayUrl:a.gatewayUrl,token:a.token,bootstrapToken:n,...i.bootstrapProfile?{bootstrapProfile:i.bootstrapProfile}:{},password:t},c=0,l={client:null,phase:`stopped`,offlineStable:!1,hello:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,sessionKey:a.sessionKey,lastError:null,lastErrorCode:null,selfUser:null},u=null,d=null,m=null,h=null,g=!1,_=0,v=!1,y=!0,x=e=>!y&&u===e,S=null,C=null,w=new Set,T=new Set,E=new Set,ee=[],te=()=>{S!==null&&(globalThis.clearTimeout(S),S=null)},D=()=>{C!==null&&(globalThis.clearTimeout(C),C=null)},O=e=>{D(),C=globalThis.setTimeout(()=>{C=null,y||A({...l,restartPending:!1})},be((e??0)*3,{minMs:15e3}))},k=()=>{y||l.phase===`connected`||l.offlineStable||S!==null||(S=globalThis.setTimeout(()=>{S=null,!y&&l.phase!==`connected`&&A({...l,offlineStable:!0})},jd))},A=e=>{e.phase===`connected`?(te(),l=e.offlineStable?{...e,offlineStable:!1}:e):(l=e,k()),Td(w,l,`snapshot`,e=>e===l)},j=()=>{if(d)return Promise.resolve(d);if(m)return m;let e=b(async()=>{let{createCanvasSurfaceLease:e}=await import(`./canvas-surface-lease.runtime-BGKi1noP.js`);return{createCanvasSurfaceLease:e}},__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).then(({createCanvasSurfaceLease:e})=>{let t=e({request:(e,t)=>{let n=h;return!n||u!==n?Promise.reject(Error(`canvas surface lease has no current gateway client`)):n.request(e,t)},onChange:e=>{!h||u!==h||A({...l,canvasPluginSurfaceUrl:e})}});return d=t,t});return m=e,e.catch(()=>{m===e&&(m=null)}),e},M=e=>(h=null,d?.stop(),_+=1,g=!0,h=e,rt(),_),ne=(e,t,n)=>{j().then(r=>{g&&_===t&&h===e&&u===e&&r.start(n)}).catch(()=>{})},re=()=>{if(!g){h=null;return}_+=1,g=!1,h=null,d?.stop(),rt()},N=(e,t=!1)=>{let n={...a,...e};if(!o&&!t){a=n,(e.gatewayUrl!==void 0||e.token!==void 0)&&Hu(n.gatewayUrl,n.token);return}o=!0,a=Ku(e,{selectGateway:t})},P=e=>{let t=u;if(e.event===`shutdown`){let n=e.payload,r=n&&typeof n==`object`&&`restartExpectedMs`in n?n.restartExpectedMs:void 0;if(typeof r==`number`&&(O(r),A({...l,restartPending:!0}),!x(t)))return}else if(e.event===`presence`){let n=xd(e.payload);if(n){let e=Sd(n,u?.instanceId);if(e&&!Ed(l.selfUser,e)&&(A({...l,selfUser:e}),!x(t)))return}}ee=[{ts:Date.now(),event:e.event,payload:e.payload},...ee].slice(0,250),Td(E,ee,`event`,e=>e===ee&&x(t))},ae=(e={})=>{y=!1;let{sessionKey:t,...n}=e,d=n.gatewayUrl??s.gatewayUrl,m=ie(d)!==ie(s.gatewayUrl),h=Vu(s.gatewayUrl,d,s),g={...s,...n,...m&&n.token===void 0?{token:h.token}:{},...m&&n.password===void 0?{password:h.password}:{},...m&&n.bootstrapToken===void 0?{bootstrapToken:``,bootstrapProfile:void 0}:{},...n.bootstrapToken!==void 0&&n.bootstrapProfile===void 0?{bootstrapProfile:void 0}:{}};(g.gatewayUrl!==s.gatewayUrl||g.token!==s.token||g.password!==s.password||g.bootstrapToken!==s.bootstrapToken||g.bootstrapProfile!==s.bootstrapProfile)&&(c+=1,Mr());let _=n.gatewayUrl!==void 0&&n.gatewayUrl!==s.gatewayUrl,b=_?zu(g.gatewayUrl):null,S=t!==void 0,C=S?t.trim():b?.sessionKey??l.sessionKey;_&&(v=!1),s=g,an(g.gatewayUrl,il({settings:{token:g.token},password:g.password}),i.resourceBasePath),N({gatewayUrl:g.gatewayUrl,token:g.token,...S?{sessionKey:C,lastActiveSessionKey:C}:b??{},...b?{selectedAgentId:b.selectedAgentId}:{}},o||_),re(),u?.stop();let w=r({url:g.gatewayUrl,token:g.token.trim()?g.token:void 0,bootstrapToken:g.bootstrapToken.trim()?g.bootstrapToken:void 0,bootstrapProfile:g.bootstrapProfile,password:g.password.trim()?g.password:void 0,clientName:`openclaw-control-ui`,clientVersion:Ui.version??`dev`,clientBuildId:Ui.buildId,mode:`webchat`,instanceId:Je(),onHello:e=>{if(u!==w)return;let t=!!e.server?.buildId?.trim();if(Od(g.gatewayUrl)&&(t||v)&&Vi({version:e.server?.version,buildId:e.server?.buildId,controlUiBuildSource:e.server?.controlUiBuildSource})){A({...l,client:w,phase:`reconnecting`,hello:e,canvasPluginSurfaceUrl:null,selfUser:null,lastError:null,lastErrorCode:null});let t=e.server?.buildId?.trim()||e.server?.version?.trim();t&&qs({buildId:t});return}an(g.gatewayUrl,il({hello:e,settings:{token:g.token},password:g.password}),i.resourceBasePath),s={...s,bootstrapToken:``,bootstrapProfile:void 0},o&&(a=Uu());let n=hr({hello:e}),r=Pn(l.sessionKey,e),c=Pn(a.lastActiveSessionKey,e);(r!==a.sessionKey||c!==a.lastActiveSessionKey)&&N({sessionKey:r,lastActiveSessionKey:c}),v=!0;let d=kd(e.pluginSurfaceUrls?.canvas),f=M(w);D(),A({...l,client:w,phase:`connected`,restartPending:!1,hello:e,canvasPluginSurfaceUrl:d,assistantAgentId:n?.defaultAgentId?.trim()||null,sessionKey:r,lastError:null,lastErrorCode:null,selfUser:Sd(xd(e.snapshot)??[],w.instanceId)}),ne(w,f,d??void 0)},onRecoveryScopeChange:()=>{u===w&&l.phase===`connected`&&A({...l})},onClose:({code:e,reason:t,error:n,willRetry:r})=>{if(u!==w)return;re();let i=f(n?.details);i&&qs({buildId:i});let a=i===null&&!v&&r&&p(n);if(a&&l.phase===`starting`)return;let o=Ko(n)??n?.code??null,s=ue(n);s&&O(),A({...l,client:w,phase:i===null?a?`starting`:v?r?`reconnecting`:`offline`:r?`connecting`:`stopped`:`reload-required`,hello:null,canvasPluginSurfaceUrl:null,selfUser:null,restartPending:s||l.restartPending===!0,lastError:a?null:n?.message?Zn(n.message):`disconnected (${e}): ${jr(t,U(`common.unknown`))}`,lastErrorCode:a?null:o})},onGap:({expected:e,received:t})=>{x(w)&&(A({...l,lastError:`event gap detected (expected seq ${e}, got ${t}); reconnecting`,lastErrorCode:null}),x(w)&&ae())},onEvent:e=>{if(u===w){try{P(e)}catch(e){console.error(`[gateway] event handler error:`,e)}Td(T,e,`event listener`,()=>x(w))}}});u=w,A({...l,client:w,phase:v?`reconnecting`:`connecting`,hello:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,selfUser:null,sessionKey:C,lastError:null,lastErrorCode:null}),x(w)&&w.start()};return{get snapshot(){return l},get connection(){return s},get connectionRevision(){return c},get eventLog(){return ee},connect:ae,setSessionKey:e=>{let t=e.trim();!t||t===l.sessionKey||(N({sessionKey:t,lastActiveSessionKey:t}),A({...l,sessionKey:t}))},start:()=>ae(),stop:()=>{y=!0,te(),D(),re(),u?.stop(),u=null,v=!1,A({...l,client:null,phase:`stopped`,offlineStable:!1,restartPending:!1,hello:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,selfUser:null,lastError:null,lastErrorCode:null})},subscribe:e=>(w.add(e),()=>w.delete(e)),subscribeEventLog:e=>(E.add(e),()=>E.delete(e)),subscribeEvents:e=>(T.add(e),()=>T.delete(e)),updateSelfUser:e=>{l.selfUser&&A({...l,selfUser:{...l.selfUser,...e}})}}}function Od(e){try{return new URL(e.replace(/^ws/u,`http`)).origin===globalThis.location?.origin}catch{return!1}}function kd(e){return e?.trim()||null}var Ad,jd;function Md(){return(Md=e((()=>{A(),y(),Te(),pe(),ms(),aa(),H(),ln(),Sr(),ai(),Lt(),Ln(),dr(),rr(),ol(),bd(),sc(),C(),Ad=e=>new fs(e),jd=2e3})))()}function Nd(){let e=new Map,t=t=>{for(let n of e.keys())if(br(n,t))return n};return{prepare:n=>{let r=t(n.sessionKey);for(r&&e.delete(r),e.set(n.sessionKey,n);e.size>Pd;){let t=e.keys().next().value;if(t===void 0)break;e.delete(t)}},read:(n,r)=>{let i=e.get(t(n)??``);return i&&i.owner===r?i:null},clear:n=>{if(n===void 0){e.clear();return}let r=t(n);r&&e.delete(r)}}}var Pd;function Fd(){return(Fd=e((()=>{Ln(),Pd=32})))()}function Id(){return window.chrome?.webview}function Ld(e){Id()?.postMessage(e)}function Rd(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.type!=`string`)return null;if(t.type===`draft-text`){let e=t.payload&&typeof t.payload==`object`?t.payload.text:void 0;if(typeof e==`string`)return e}return null}function zd(){let e=Id();if(!e)return{subscribe:()=>()=>{},dispose:()=>{}};let t=null,n=new Set,r=e=>{let r=Rd(e.data);if(r!==null){if(n.size===0){t=r;return}for(let e of n)e(r)}};return e.addEventListener(`message`,r),Ld({type:`ready`}),{subscribe(e){if(n.add(e),t!==null){let n=t;t=null,e(n)}return()=>n.delete(e)},dispose(){n.clear(),t=null,e.removeEventListener(`message`,r)}}}function Bd(){let e=window.webkit?.messageHandlers?.openclawLink;return e?.postMessage.bind(e)}function Vd(){return window.webkit?.messageHandlers?.openclawUpdate}function Hd(){return Vd()!==void 0}function Ud(){let e=Vd();return e?(e.postMessage.bind(e)({type:`start-update`}),!0):!1}function Wd(e){if(!e.isTrusted)return null;let t=Xe(e);if(!t||t.hasAttribute(`download`)||t.hasAttribute(`data-file-path`))return null;try{let e=new URL(t.href,window.location.href);return e.protocol===`mailto:`||e.protocol===`tel:`?{anchor:t,url:e}:null}catch{return null}}function Gd(e){let t=e.composedPath(),n=t.find(e=>e instanceof HTMLElement&&e.localName===`openclaw-modal-dialog`);if(n instanceof HTMLElement)return n;for(let e of t)if(e instanceof HTMLDialogElement&&e.open&&e.getRootNode()===document)return e;return document.body}function Kd(e,t,n){try{return e({type:`open-link`,url:t.href,target:n}),!0}catch{return!1}}function qd(e){return!e.defaultPrevented&&!e.shiftKey&&!e.altKey&&(e.type===`click`&&e.button===0||e.type===`auxclick`&&e.button===1)}function Jd(e={}){if(typeof window>`u`||typeof document>`u`)return{dispose(){}};let t=Bd();if(!t&&!e.shouldOpenInControlUiBrowser)return{dispose(){}};let n=null,r=e=>{e&&n!==e||(n?.remove(),n=null)},i=(e,t,i,a,o,s)=>{r();let c=document.createElement(`openclaw-native-link-menu`);c.x=a,c.y=o,c.trigger=t,c.onClose=()=>r(c),c.onAction=t=>{if(t===`copy`){vr(i.href);return}Kd(e,i,t)},n=c,s.append(c),Si(c)},a=n=>{let i=pn(n);if(i&&qd(n)&&e.shouldOpenInControlUiBrowser?.()){window.dispatchEvent(new CustomEvent(Bi,{detail:{open:!0,url:i.url.href}})),r(),n.preventDefault();return}if(!t||!un(n))return;let a=Wd(n),o=a??i,s=a?`external`:`inline`;!o||!Kd(t,o.url,s)||(r(),n.preventDefault())},o=e=>{if(!t||e.defaultPrevented)return;let n=pn(e);n&&(e.preventDefault(),e.stopPropagation(),i(t,n.anchor,n.url,e.clientX,e.clientY,Gd(e)))};return window.addEventListener(`click`,a),window.addEventListener(`auxclick`,a),t&&document.addEventListener(`contextmenu`,o,!0),{dispose(){window.removeEventListener(`click`,a),window.removeEventListener(`auxclick`,a),document.removeEventListener(`contextmenu`,o,!0),r()}}}var Yd,Xd;function Zd(){return(Zd=e((()=>{bi(),_i(),oa(),Yd=`openclaw:native-update-declined`,Xd=`openclaw:native-update-availability-changed`})))()}function Qd(e){return e===`granted`||e===`denied`||e===`notDetermined`}function $d(e){if(typeof e!=`object`||!e||!(`permission`in e)||!Qd(e.permission))return null;if(!(`test`in e))return{permission:e.permission,test:null};let t=e.test;return t===null?{permission:e.permission,test:null}:typeof t!=`object`||!t||!(`state`in t)?null:t.state===`pending`||t.state===`sent`?{permission:e.permission,test:{state:t.state}}:t.state===`error`&&`message`in t&&typeof t.message==`string`?{permission:e.permission,test:{state:`error`,message:t.message}}:null}function ef(){if(typeof window>`u`)return;let e=window.webkit?.messageHandlers?.openclawNotifications;return e?.postMessage.bind(e)}function tf(){let e=ef();if(!e)return null;let t=$d(window.__OPENCLAW_NATIVE_NOTIFICATIONS__)??{permission:`unknown`,test:null},n=new Set,r=e=>{t=e;for(let e of n)e(t)},i=e=>{let t=$d(e.detail);t&&r(t)},a=()=>e({type:`status`});return window.addEventListener(nf,i),window.addEventListener(`focus`,a),a(),{get snapshot(){return t},subscribe(e){return n.add(e),()=>n.delete(e)},requestPermission(){e({type:`request-permission`})},sendTest(){t.test?.state!==`pending`&&(r({...t,test:{state:`pending`}}),e({type:`send-test`}))},dispose(){window.removeEventListener(nf,i),window.removeEventListener(`focus`,a),n.clear()}}}var nf;function rf(){return(rf=e((()=>{nf=`openclaw:native-notifications-status`})))()}function af(e,t){if(!Array.isArray(e))return;let n=e.filter(e=>{if(!L(e))return!1;let{startIndex:n,endIndex:r}=e;return Number.isSafeInteger(n)&&Number.isSafeInteger(r)&&typeof n==`number`&&typeof r==`number`&&n>=0&&r>n&&r<=t});return n.length>0?n:void 0}function of(e){if(!Array.isArray(e))return;let t=e.filter(e=>e===`allow-once`||e===`allow-always`||e===`deny`);return t.length>0?t:void 0}function sf(e){if(!L(e))return null;switch(e.kind){case`standing-grant`:return typeof e.automation==`string`&&typeof e.command==`string`?{kind:`standing-grant`,automation:e.automation,command:e.command,...typeof e.expiresInDays==`number`?{expiresInDays:e.expiresInDays}:{}}:null;case`message-send`:return typeof e.target==`string`&&typeof e.recipientCount==`number`?{kind:`message-send`,target:e.target,recipientCount:e.recipientCount,...Array.isArray(e.recipients)&&e.recipients.every(e=>typeof e==`string`)?{recipients:e.recipients}:{},...e.audience===`internal`||e.audience===`external`?{audience:e.audience}:{}}:null;case`payment`:return typeof e.amount==`string`&&typeof e.currency==`string`&&typeof e.target==`string`?{kind:`payment`,amount:e.amount,currency:e.currency,target:e.target}:null;case`external-post`:return typeof e.target==`string`&&(e.visibility===`public`||e.visibility===`restricted`)?{kind:`external-post`,target:e.target,visibility:e.visibility}:null;default:return null}}function cf(e){if(!L(e))return null;let t=I(e.id)??``,n=e.request;if(!t||!L(n))return null;let r=typeof n.command==`string`?n.command:``;if(r.trim().length===0)return null;let i=typeof e.createdAtMs==`number`?e.createdAtMs:0,a=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;return!i||!a?null:{id:t,kind:`exec`,request:{command:r,cwd:typeof n.cwd==`string`?n.cwd:null,host:typeof n.host==`string`?n.host:null,security:typeof n.security==`string`?n.security:null,ask:typeof n.ask==`string`?n.ask:null,agentId:typeof n.agentId==`string`?n.agentId:null,resolvedPath:typeof n.resolvedPath==`string`?n.resolvedPath:null,sessionKey:typeof n.sessionKey==`string`?n.sessionKey:null,runId:typeof n.runId==`string`?n.runId:null,commandSpans:af(n.commandSpans,r.length),allowedDecisions:of(n.allowedDecisions),scope:sf(n.scope)},createdAtMs:i,expiresAtMs:a}}function lf(e,t){if(e!==`exec.approval.resolved`&&e!==`plugin.approval.resolved`&&e!==`openclaw.approval.resolved`||!L(t))return null;let n=I(t.id)??``;return n?{id:n,decision:typeof t.decision==`string`?t.decision:null,resolvedBy:typeof t.resolvedBy==`string`?t.resolvedBy:null,ts:typeof t.ts==`number`?t.ts:null}:null}function uf(e){if(!L(e))return null;let t=I(e.id)??``;if(!t)return null;let n=typeof e.createdAtMs==`number`?e.createdAtMs:0,r=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;if(!n||!r)return null;let i=L(e.request)?e.request:{},a=I(i.title)??``;if(!a)return null;let o=typeof i.description==`string`?i.description:null,s=typeof i.severity==`string`?i.severity:null,c=typeof i.pluginId==`string`?i.pluginId:null;return{id:t,kind:`plugin`,request:{command:a,agentId:typeof i.agentId==`string`?i.agentId:null,sessionKey:typeof i.sessionKey==`string`?i.sessionKey:null,allowedDecisions:of(i.allowedDecisions)},pluginTitle:a,pluginDescription:o,pluginSeverity:s,pluginId:c,createdAtMs:n,expiresAtMs:r}}function df(e){if(!L(e))return null;let t=I(e.id)??``,n=L(e.request)?e.request:{},r=I(n.title)??``,i=I(n.description),a=I(n.command),o=I(n.proposalHash),s=typeof e.createdAtMs==`number`?e.createdAtMs:0,c=typeof e.expiresAtMs==`number`?e.expiresAtMs:0;return!t||!r||!i||!a||!o||!s||!c?null:{id:t,kind:`system-agent`,request:{command:a,agentId:typeof n.agentId==`string`?n.agentId:null,sessionKey:typeof n.sessionKey==`string`?n.sessionKey:null,allowedDecisions:[`allow-once`,`deny`]},pluginTitle:r,pluginDescription:i,proposalHash:o,createdAtMs:s,expiresAtMs:c}}function ff(e,t){return e===`exec.approval.requested`?cf(t):e===`plugin.approval.requested`?uf(t):e===`openclaw.approval.requested`?df(t):null}async function pf(e,t,n){if(t.kind===`system-agent`){await e.request(`approval.resolve`,{id:t.id,kind:`system-agent`,decision:n});return}let r=t.kind===`plugin`?`plugin.approval.resolve`:`exec.approval.resolve`;await e.request(r,{id:t.id,decision:n})}function mf(e){let t=Date.now();return e.filter(e=>e.expiresAtMs>t)}function hf(e,t){let n=mf(e).filter(e=>e.id!==t.id);return n.push(t),xf(n)}function gf(e,t){return mf(e).filter(e=>e.id!==t)}function _f(e){return L(e)?I(e.gatewayCode)??null:null}function vf(e){if(!L(e))return null;let{details:t}=e;return L(t)?I(t.reason)??null:null}function yf(e){if(!(e instanceof Error))return!1;let t=_f(e),n=vf(e);return n===Mf||n===Nf||t===Nf||/unknown or expired approval id/i.test(e.message)}function bf(e,t){return Array.isArray(e)?e.flatMap(e=>{let n=t(e);return n?[n]:[]}):null}function xf(e){return e.toSorted((e,t)=>e.createdAtMs-t.createdAtMs||e.id.localeCompare(t.id))}function Sf(e,t){return mf(e).filter(e=>e.kind===t)}function Cf(e,t,n,r){let i=new Set(t.map(e=>e.id)),a=mf(n),o=new Set(a.map(e=>e.id)),s=mf(e).filter(e=>!r.has(e.id)&&(!i.has(e.id)||o.has(e.id))),c=new Set(s.map(e=>e.id)),l=a.filter(e=>!i.has(e.id)&&!c.has(e.id));return xf([...s,...l])}function wf(e,t){let n=e.execApprovalExpiryTimers?.get(t);n!==void 0&&(globalThis.clearTimeout(n),e.execApprovalExpiryTimers?.delete(t))}function Tf(e,t){wf(e,t.id);let n=globalThis.setTimeout(()=>{let r=e.execApprovalExpiryTimers?.get(t.id);if(r!==void 0&&r!==n)return;e.execApprovalExpiryTimers?.delete(t.id);let i=e.execApprovalQueue.some(e=>e.id===t.id);Ef(e,t.id),i&&e.execApprovalChanged?.()},Math.max(0,t.expiresAtMs-Date.now()+500));e.execApprovalExpiryTimers?.set(t.id,n)}function Ef(e,t){wf(e,t),e.execApprovalQueue=gf(e.execApprovalQueue,t),e.execApprovalErrors.delete(t)}function Df(e){let t=new Set(e.execApprovalQueue.map(e=>e.id));for(let n of e.execApprovalErrors.keys())t.has(n)||e.execApprovalErrors.delete(n)}function Of(e){for(let t of e.execApprovalExpiryTimers?.values()??[])globalThis.clearTimeout(t);e.execApprovalExpiryTimers?.clear()}function kf(e,t){e.execApprovalQueue=hf(e.execApprovalQueue,t),Tf(e,t)}async function Af(e,t){let n=e.client;if(!n||t?.isCurrentClient&&!t.isCurrentClient(n))return!1;let r={removedIds:new Set},i=e.execApprovalRefreshes??=new Set;i.add(r);let a=mf(e.execApprovalQueue);try{let[i,o,s]=await Promise.allSettled([n.request(`exec.approval.list`,{}),n.request(`plugin.approval.list`,{}),n.request(`openclaw.approval.list`,{})]),c=i.status===`fulfilled`?bf(i.value,cf)??[]:Sf(e.execApprovalQueue,`exec`),l=o.status===`fulfilled`?bf(o.value,uf)??[]:Sf(e.execApprovalQueue,`plugin`),u=s.status===`fulfilled`?bf(s.value,df)??[]:Sf(e.execApprovalQueue,`system-agent`),d=Cf(xf([...c,...l,...u]),a,e.execApprovalQueue,r.removedIds);if(t?.isCurrentClient&&!t.isCurrentClient(n))return!1;e.execApprovalQueue=d,Df(e);let f=new Set(d.map(e=>e.id));for(let t of e.execApprovalExpiryTimers?.keys()??[])f.has(t)||wf(e,t);for(let t of d)Tf(e,t);return!0}finally{i.delete(r),i.size===0&&(e.execApprovalRefreshes=void 0)}}function jf(e,t){Ef(e,t);for(let n of e.execApprovalRefreshes??[])n.removedIds.add(t)}var Mf,Nf;function Pf(){return(Pf=e((()=>{Mf=`APPROVAL_ALREADY_RESOLVED`,Nf=`APPROVAL_NOT_FOUND`})))()}function Ff(e){let t=K(e);return t.canAdmin||t.canPair}function If(e,t){let n=K(t);return{access:n,reviewChanged:e.canReviewApprovals!==n.canReviewApprovals,grantChanged:e.canGrantApprovals!==n.canGrantApprovals,grantRevoked:e.canGrantApprovals&&!n.canGrantApprovals,adminRevoked:e.canAdmin&&!n.canAdmin,pairingChanged:e.canPair!==n.canPair,pairingSetupRevoked:(e.canAdmin||e.canPair)&&!(n.canAdmin||n.canPair)}}function Lf(e){let t=0;return{invalidate(n={}){t+=1,n.clear&&(e.state.pendingCount=0)},async refresh(){let n=e.gateway.snapshot.client;if(!n||e.gateway.snapshot.phase!==`connected`||e.isDisposed()||!e.state.devicePairSetupOpen||!Ff(e.gateway.snapshot))return;let r=++t,i;try{i=await n.request(`device.pair.list`,{})}catch{return}e.isDisposed()||r!==t||e.gateway.snapshot.client!==n||e.gateway.snapshot.phase!==`connected`||!e.state.devicePairSetupOpen||!Ff(e.gateway.snapshot)||(e.state.pendingCount=Array.isArray(i.pending)?i.pending.length:0,e.publish())}}}function Rf(e){return async(t,n=e.getConnectedEpoch(),r=e.getReviewGeneration())=>{!e.canReview()||r!==e.getReviewGeneration()||!K(e.gateway.snapshot).canReviewApprovals||await Af(e.state,{isCurrentClient:i=>i===t&&n===e.getConnectedEpoch()&&r===e.getReviewGeneration()&&e.canReview()&&K(e.gateway.snapshot).canReviewApprovals&&e.isCurrentClient(t)})&&!e.isDisposed()&&e.publish()}}function zf(){return(zf=e((()=>{Pf(),Ts()})))()}function Y(e,t){return Number.isInteger(e)&&e>=t}function Bf(e){let t=e?.snapshot;if(!L(t))return null;let n=t.updateAvailable;return Vf(n)}function Vf(e){if(!L(e)||!E(e.currentVersion)||!E(e.latestVersion)||!E(e.channel))return null;let t=e.commits,n=Array.isArray(t)?t.filter(e=>L(e)&&E(e.sha)&&typeof e.subject==`string`).map(e=>({sha:e.sha,subject:e.subject})).slice(0,Jf):void 0;return{currentVersion:e.currentVersion,latestVersion:e.latestVersion,channel:e.channel,...E(e.currentSha)?{currentSha:e.currentSha}:{},...E(e.upstreamRef)?{upstreamRef:e.upstreamRef}:{},...E(e.upstreamSha)?{upstreamSha:e.upstreamSha}:{},...Y(e.commitsBehind,0)?{commitsBehind:e.commitsBehind}:{},...n?.length?{commits:n}:{}}}function Hf(e){return L(e)?e.kind===`package`?E(e.version)?{kind:`package`,version:e.version}:null:e.kind===`git`&&E(e.upstreamRef)&&E(e.upstreamSha)&&Y(e.commitsBehind,0)?{kind:`git`,upstreamRef:e.upstreamRef,upstreamSha:e.upstreamSha,commitsBehind:e.commitsBehind}:null:null}function Uf(e){return{...E(e.currentSha)?{currentSha:e.currentSha}:{},...Y(e.commitAtMs,0)?{commitAtMs:e.commitAtMs}:{},...Y(e.installedAtMs,0)?{installedAtMs:e.installedAtMs}:{}}}function Wf(e){if(!L(e))return null;let t=Uf(e);return e.status===`current`?{...t,status:`current`}:e.status===`behind`&&Y(e.commitsBehind,1)?{...t,status:`behind`,commitsBehind:e.commitsBehind}:e.status===`ahead`&&Y(e.commitsAhead,1)?{...t,status:`ahead`,commitsAhead:e.commitsAhead}:e.status===`diverged`&&Y(e.commitsAhead,1)&&Y(e.commitsBehind,1)?{...t,status:`diverged`,commitsAhead:e.commitsAhead,commitsBehind:e.commitsBehind}:e.status===`unavailable`&&(e.reason===`fetch-failed`||e.reason===`no-upstream`||e.reason===`no-upstream-sha`||e.reason===`comparison-failed`||e.reason===`git-unavailable`)?{...t,status:`unavailable`,reason:e.reason}:null}function Gf(e){return!L(e)||!E(e.id)||e.state!==`waiting-for-idle`&&e.state!==`countdown`&&e.state!==`applying`||!Y(e.announcedAtMs,0)||!Y(e.forceAtMs,0)||!Y(e.updatedAtMs,0)?null:{id:e.id,state:e.state,announcedAtMs:e.announcedAtMs,...Y(e.applyAtMs,0)?{applyAtMs:e.applyAtMs}:{},...Y(e.holdUntilMs,0)?{holdUntilMs:e.holdUntilMs}:{},forceAtMs:e.forceAtMs,updatedAtMs:e.updatedAtMs}}function Kf(e){if(!L(e)||!E(e.channel)||typeof e.autoEnabled!=`boolean`)return null;let t=L(e.install)?e.install:null,n=t?.kind,r=n===`package`||n===`git`||n===`unknown`?n:void 0;if(e.install!==void 0&&r===void 0)return null;let i=t?.git===void 0?void 0:Wf(t.git);if(t?.git!==void 0&&!i)return null;let a=e.target===void 0?void 0:Hf(e.target),o=e.campaign===void 0?void 0:Gf(e.campaign);return e.target!==void 0&&!a||e.campaign!==void 0&&!o?null:{channel:e.channel,autoEnabled:e.autoEnabled,...r?{install:{kind:r,...i?{git:i}:{}}}:{},...a?{target:a}:{},...o?{campaign:o}:{}}}function qf(e){let t=e?.snapshot;return L(t)?Kf(t.updateSchedule):null}var Jf;function Yf(){return(Yf=e((()=>{Jf=5})))()}function Xf(e){return t=>{let n=()=>{let n=e.overlays.snapshot,r=n.updateStatusBanner;t({busy:n.updateRunning||n.updateReconciliationPending,connected:e.gateway.snapshot.phase===`connected`,failure:r&&r.tone!==`info`?r.text:null})},r=e.overlays.subscribe(n),i=e.gateway.subscribe(n);return n(),()=>{r(),i()}}}function Zf(e){if(e?.kind!==`update`||!e.status||e.status===`ok`||_p(e)||typeof e.ts!=`number`)return null;let t=e.stats;return{timestampMs:e.ts,status:e.status,reason:t?.reason?.trim()||`unexpected-error`,installKind:t?.mode?.trim()||null,installedVersion:t?.before?.version?.trim()||null,installedSha:t?.before?.sha?.trim()||null,targetVersion:t?.after?.version?.trim()||null,targetSha:t?.after?.sha?.trim()||null,failure:$f(e)}}function Qf(e){let t=(e??``).split(`
|
|
`).map(e=>e.trim()).filter(Boolean).at(-1);return t?t.slice(0,Ep):null}function $f(e){let t=e?.stats?.steps,n=Array.isArray(t)?t.findLast(e=>typeof e?.log?.exitCode==`number`&&e.log.exitCode!==0):void 0,r=Qf(n?.log?.stderrTail)??Qf(n?.log?.stdoutTail),i=n?.name?.trim();return i&&r?{step:i,detail:jr(r)}:null}async function ep(e,t,n={},r){try{return await e.request(`update.status`,n,{timeoutMs:t})}catch(e){return r?.(e),null}}function tp(e){let t=0;return async()=>{let n=e.getClient(),r=e.getEpoch();if(!n||!e.canRefresh())return;let i=++t,a=()=>i===t&&e.isCurrent(n,r);e.onRefreshing(!0);try{let t=await ep(n,5e3,{refreshCheckout:!0},t=>{a()&&e.onError(t)});t&&a()&&e.onStatus(t)}finally{a()&&e.onRefreshing(!1)}}}function np(e,t){let n=e.result?.status??(e.ok===!0?`ok`:`error`),r=e.result?.after?.version?.trim()||t.expectedVersion,i=e.result?.after?.sha?.trim()||t.expectedSha;return e.ok===!0&&n===`skipped`&&e.result?.reason===vp&&e.handoff?.status===`started`?{pending:{expectedVersion:r,expectedSha:i,kind:`handoff`},banner:null}:e.ok===!0&&n===`ok`?{pending:{expectedVersion:r,expectedSha:i,kind:`restart`},banner:e.restart?.coalesced===!0?{tone:`info`,text:U(`updates.coalescedRestart`)}:null}:null}function rp(e,t){return e?.target?.kind===`git`?e.target.upstreamSha.trim()||null:t?.upstreamSha?.trim()||null}function ip(e,t,n){return{expectedVersion:t,expectedSha:n,kind:e}}function ap(e,t){let n=e.trim().toLowerCase(),r=t.trim().toLowerCase();return n.length>=7&&r.length>=7&&(n.startsWith(r)||r.startsWith(n))}function op(e){let t=0,n=null,r=e=>{if(!n)return;let t=n;n=null,globalThis.clearTimeout(t.timer),t.resolve(e)},i=()=>{t+=1,r(!1)},a=(e,i)=>new Promise(a=>{r(!1);let o=globalThis.setTimeout(()=>{n?.timer===o&&(n=null,a(i===t))},e);n={timer:o,resolve:a}});return{cancel:i,verify:async(n,r)=>{let i=t,o=e.getPending();if(!o)return;let s=o.expectedVersion?.trim()||null,c=o.expectedSha?.trim()||null,l=()=>i===t&&e.isCurrent(n,r),{deadline:u,pollMs:d}=cp(o.kind===`handoff`?`handoff`:`restart`);for(;l()&&Date.now()<u;){let t=await ep(n,Math.max(0,u-Date.now()));if(!l())return;let r=t?.sentinel;if(_p(r)){o.kind!==`handoff`&&(o.kind=`handoff`,{deadline:u,pollMs:d}=cp(`handoff`),e.publish());let t=u-Date.now();if(t<=0)break;if(!await a(Math.min(d,t),i))return;continue}if(r?.kind===`update`&&r.status&&r.status!==`ok`){e.clearPending(),e.publishRecordedFailure({attempt:Zf(r),banner:pp({status:`error`,...r.stats?.reason?{reason:r.stats.reason}:{},cause:$f(r)})});return}let f=r?.stats?.after?.version?.trim()||null,p=r?.stats?.after?.sha?.trim()||null;if(r?.kind===`update`&&r.status===`ok`){let t=!s||f===s,n=!c||p!==null&&ap(c,p);if(t&&n&&(f!==null||p!==null||s===null&&c===null)){e.clearPending(),e.publishRecordedAttempt?.(null),e.onVerifiedInstall?.({version:f,sha:p}),e.publishBanner(null);return}let r=s!==null&&f!==null&&f!==s,i=c!==null&&p!==null&&!ap(c,p);if(r||i){e.clearPending(),e.publishBanner(mp({expectedVersion:s,actualVersion:f,expectedSha:c,actualSha:p}));return}}let m=u-Date.now();if(m<=0)break;if(!await a(Math.min(d,m),i))return}if(!l())return;let f=e.getHello()?.server?.version?.trim()||null;e.clearPending(),e.publishBanner(c||s&&f!==s?mp({expectedVersion:s,actualVersion:f,expectedSha:c,actualSha:null}):o.kind===`handoff`?hp():gp())}}}function sp(e){let t=null,n=()=>{t!==null&&(globalThis.clearTimeout(t),t=null)},r=async()=>{t=null;let n=e.getClient(),r=e.getEpoch(),a=e.getSchedule()?.campaign;if(!n||!e.canPoll()||!a)return;let o=await ep(n,5e3),s=e.getSchedule()?.campaign,c=s?.id===a.id&&s.updatedAtMs===a.updatedAtMs;o&&c&&e.canPoll()&&e.isCurrent(n,r)&&e.onStatus(o),i()},i=()=>{if(!e.getClient()||!e.canPoll()||!e.getSchedule()?.campaign){n();return}t===null&&(t=globalThis.setTimeout(()=>void r(),5e3))};return{stop:n,sync:i}}function cp(e,t=Date.now()){let n=e===`handoff`;return{deadline:t+(n?Cp:xp),pollMs:n?Sp:bp}}function lp(e,t){let n=e.sentinel,r=Object.hasOwn(e,`schedule`)?Kf(e.schedule):void 0;return{updateStatusBanner:n?.kind===`update`&&n.status?n.status===`ok`||_p(n)?null:pp({status:n.status,reason:n.stats?.reason??void 0,cause:$f(n)}):t.updateStatusBanner,recordedUpdateAttempt:n?.kind===`update`&&n.status?Zf(n):t.recordedUpdateAttempt,...Object.hasOwn(e,`updateAvailable`)?{updateAvailable:Vf(e.updateAvailable)}:{},...r===void 0?{}:{updateSchedule:r,heldUpdateCampaignId:r?.campaign?.holdUntilMs===void 0?t.heldUpdateCampaignId:r.campaign.id}}}function up(e,t=Date.now()){let n=e?.campaign;return n?n.holdUntilMs!==void 0&&n.holdUntilMs>t?U(`updates.campaign.held`,{time:kr(n.holdUntilMs,t)}):n.state===`applying`?U(`updates.campaign.applying`):n.state===`waiting-for-idle`?U(`updates.campaign.waitingForIdle`,{time:kr(n.forceAtMs,t)}):U(`updates.campaign.countdown`,{time:kr(n.applyAtMs??n.forceAtMs,t)}):null}function dp(e,t){let n=e?.target,r=n?.kind===`git`?n.commitsBehind:t?.commitsBehind;if(r!==void 0)return U(r===1?`updates.target.commitBehind`:`updates.target.commitsBehind`,{count:String(r)});let i=n?.kind===`package`?n.version:t?.latestVersion;return i?U(`updates.target.version`,{version:i}):null}function fp(e,t,n){let r=t?.target;return!!(n||t?.campaign||e&&e.latestVersion!==e.currentVersion||e?.commitsBehind!==void 0&&e.commitsBehind>0||r?.kind===`git`&&r.commitsBehind>0)}function pp(e){let t=(e.status??`error`).trim()||`error`,n=(e.reason??`unexpected-error`).trim()||`unexpected-error`,r=U(Tp[n]??`updates.failureReasons.default`),i=e.cause;return{tone:t===`skipped`?`warn`:`danger`,text:i?`${U(`updates.failedAtStep`,{step:i.step,cause:i.detail})} ${r}`:U(`updates.status`,{status:t,reason:n,guidance:r})}}function mp(e){let t=e.expectedSha?e.expectedSha.slice(0,12):e.expectedVersion?`v${e.expectedVersion}`:U(`common.unknown`),n=e.actualSha?e.actualSha.slice(0,12):e.actualVersion?`v${e.actualVersion}`:U(`common.unknown`);return{tone:`danger`,text:U(`updates.verificationFailedWithIdentity`,{expected:t,actual:n})}}function hp(){return{tone:`danger`,text:U(`updates.handoffTimeout`)}}function gp(){return{tone:`danger`,text:U(`updates.outcomeUnknown`)}}function _p(e){let t=e?.stats?.reason;return e?.kind===`update`&&e.status===`skipped`&&typeof t==`string`&&wp.has(t)}var vp,yp,bp,xp,Sp,Cp,wp,Tp,Ep;function Dp(){return(Dp=e((()=>{H(),Sr(),Yr(),Yf(),vp=`managed-service-handoff-started`,yp=`restart-health-pending`,bp=250,xp=1e4,Sp=1e3,Cp=21e5,wp=new Set([vp,yp]),Tp={dirty:`updates.failureReasons.dirty`,"no-upstream":`updates.failureReasons.noUpstream`,"not-git-install":`updates.failureReasons.notGitInstall`,"not-openclaw-root":`updates.failureReasons.notOpenclawRoot`,"deps-install-failed":`updates.failureReasons.depsInstallFailed`,"build-failed":`updates.failureReasons.buildFailed`,"build-dirty":`updates.failureReasons.buildDirty`,"ui-build-failed":`updates.failureReasons.uiBuildFailed`,"global-install-failed":`updates.failureReasons.globalInstallFailed`,"restart-disabled":`updates.failureReasons.restartDisabled`,"restart-unavailable":`updates.failureReasons.restartUnavailable`,"restart-unhealthy":`updates.failureReasons.restartUnhealthy`,"restart-revision-mismatch":`updates.failureReasons.restartRevisionMismatch`,"restart-revision-unavailable":`updates.failureReasons.restartRevisionUnavailable`,"already-current":`updates.failureReasons.alreadyCurrent`,"managed-service-handoff-already-running":`updates.failureReasons.managedServiceHandoffAlreadyRunning`,"doctor-failed":`updates.failureReasons.doctorFailed`,"managed-service-handoff-failed":`updates.failureReasons.managedServiceHandoffFailed`,"managed-service-handoff-spawn-failed":`updates.failureReasons.managedServiceHandoffSpawnFailed`,"managed-service-handoff-helper-failed":`updates.failureReasons.managedServiceHandoffFailed`,"managed-service-handoff-parent-timeout":`updates.failureReasons.managedServiceHandoffParentTimeout`},Ep=180})))()}function Op(e,t,n){let r=e?.campaign,i=t?.campaign;return!i||n&&r?.id===i.id&&r.updatedAtMs===i.updatedAtMs}function kp(e,t){return e?.campaign?.holdUntilMs===void 0?t:e.campaign.id}function Ap(e,t){let n=qf(t);return{updateAvailable:Bf(t),updateSchedule:n,heldUpdateCampaignId:kp(n,e.heldUpdateCampaignId),updateCampaignStatusHydrated:Op(e.updateSchedule,n,e.updateCampaignStatusHydrated)}}function jp(e,t){let n=t&&Object.hasOwn(t,`schedule`)?Kf(t.schedule):void 0;return{updateAvailable:Vf(t?.updateAvailable),...n===void 0?{}:{updateSchedule:n,heldUpdateCampaignId:kp(n,e.heldUpdateCampaignId),updateCampaignStatusHydrated:Op(e.updateSchedule,n,e.updateCampaignStatusHydrated)}}}function Mp(){return(Mp=e((()=>{Yf()})))()}function Np(e){let t=e.sha?.trim();if(t)return U(`updates.succeededCommit`,{sha:t.slice(0,7)});let n=e.version?.trim();return n?U(`updates.succeededVersion`,{version:n}):U(`updates.succeeded`)}function Pp(){try{let e=$n(),t=e?.getItem(Lp)??null;return e?.removeItem(Lp),t}catch{return null}}function Fp(e){try{$n()?.setItem(Lp,JSON.stringify(e))}catch{}ua(e)||(Pp(),_t({message:Np(e)}))}function Ip(){let e=Pp();if(!e)return;let t;try{let n=JSON.parse(e);t={version:typeof n.version==`string`?n.version:null,sha:typeof n.sha==`string`?n.sha:null}}catch{return}_t({message:Np(t)})}var Lp;function Rp(){return(Rp=e((()=>{aa(),H(),vn(),Lp=`openclaw:control-ui:update-succeeded:v1`})))()}function zp(e){return!!(e&&typeof e==`object`&&`event`in e)}function Bp(e,t={}){let n={updateAvailable:null,updateSchedule:null,heldUpdateCampaignId:null,updateRunning:!1,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0,updateReconciliationPending:!1,updateStatusBanner:null,recordedUpdateAttempt:null,controlUiRefreshRequired:!1,approvalQueue:[],approvalBusy:!1,approvalCanGrant:!1,approvalErrors:new Map,devicePairSetupOpen:!1,devicePairSetupLifecycle:{phase:`selection`,access:`full`},devicePairPendingCount:0},r=new Set,i=!1,a=e.snapshot.client,o=e.snapshot.hello,s=null,c=0,l=K(e.snapshot),u=0,d=0,f=null,p=0,m=!1,h=null,g=mr({client:e.snapshot.client,connected:e.snapshot.phase===`connected`,onChange:()=>v()}),_={client:a,execApprovalQueue:[],execApprovalBusy:!1,execApprovalErrors:new Map,execApprovalExpiryTimers:new Map};function v(){n={...n,updateReconciliationPending:f!==null,approvalQueue:_.execApprovalQueue,approvalBusy:_.execApprovalBusy,approvalCanGrant:K(e.snapshot).canGrantApprovals,approvalErrors:new Map(_.execApprovalErrors),...dt(g)};for(let e of r)e(n)}_.execApprovalChanged=v;let y=Lf({gateway:e,state:g,isDisposed:()=>i,publish:v}),b=async e=>{v(),await e,i||(oi(g,v),v())},x=t=>!i&&a===t&&e.snapshot.client===t&&e.snapshot.phase===`connected`,S=Rf({gateway:e,state:_,getConnectedEpoch:()=>c,getReviewGeneration:()=>u,canReview:()=>l.canReviewApprovals,isCurrentClient:x,isDisposed:()=>i,publish:v}),C=e=>{n={...n,updateStatusBanner:e},v()},w=op({getPending:()=>f,clearPending:()=>{f=null},isCurrent:(e,t)=>t===c&&x(e),getHello:()=>e.snapshot.hello,publish:v,publishBanner:C,publishRecordedAttempt:e=>{n={...n,recordedUpdateAttempt:e},v()},publishRecordedFailure:({attempt:e,banner:t})=>{n={...n,recordedUpdateAttempt:e,updateStatusBanner:t},v()},onVerifiedInstall:Fp}),T=e=>{n={...n,...lp(e,{updateStatusBanner:n.updateStatusBanner,recordedUpdateAttempt:n.recordedUpdateAttempt,heldUpdateCampaignId:n.heldUpdateCampaignId}),updateCampaignStatusHydrated:!0},v()},E=sp({getClient:()=>a,getEpoch:()=>c,canPoll:()=>l.canAdmin,getSchedule:()=>n.updateSchedule,isCurrent:(e,t)=>t===c&&x(e),onStatus:T}),ee=tp({getClient:()=>a,getEpoch:()=>c,canRefresh:()=>l.canAdmin,isCurrent:(e,t)=>t===c&&x(e),onRefreshing:e=>{n={...n,updateStatusRefreshing:e},v()},onStatus:T,onError:e=>{C({tone:`danger`,text:U(`updates.error`,{error:Zn(e)})})}}),te=e=>{let t=a,r=o!==e.hello,i=e.phase===`connected`,m=i?e.client:null,b=s!==m,x=If(l,e);if(l=x.access,x.reviewChanged&&(u+=1),x.grantChanged&&(d+=1),x.grantRevoked){let e=h;e&&_.execApprovalQueue.some(t=>t.id===e.id)&&_.execApprovalErrors.set(e.id,U(`execApproval.reviewOnly`)),h=null,_.execApprovalBusy=!1}if((x.adminRevoked||x.pairingSetupRevoked)&&(it(g),y.invalidate({clear:!0}),x.adminRevoked)){p+=1,w.cancel();let e=f?gp():n.updateStatusBanner;f=null,n={...n,updateRunning:!1,updateStatusRefreshing:!1,updateStatusBanner:e}}if(x.pairingChanged&&y.invalidate({clear:!(l.canAdmin||l.canPair)}),a=e.client,o=e.hello,s=m,_.client=e.client,g.client=e.client,g.connected=i,b&&(p+=1,w.cancel()),(t!==e.client||!i)&&(h=null,y.invalidate({clear:!0}),it(g)),i&&!l.canReviewApprovals&&(h=null,_.execApprovalQueue=[],_.execApprovalBusy=!1,_.execApprovalErrors.clear(),Of(_)),!i||!e.client){_.execApprovalQueue=[],_.execApprovalBusy=!1,_.execApprovalErrors.clear(),n={...n,updateAvailable:null,updateSchedule:null,updateRunning:!1,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0},E.stop(),e.phase===`reload-required`?n={...n,controlUiRefreshRequired:!0}:e.client?e.hello&&(n={...n,controlUiRefreshRequired:!0}):(c=0,n={...n,controlUiRefreshRequired:!1}),Of(_),v();return}let C={version:e.hello?.server?.version,buildId:e.hello?.server?.buildId,controlUiBuildSource:e.hello?.server?.controlUiBuildSource},T=!!C.buildId?.trim();n={...n,...b||r?Ap(n,e.hello):{},controlUiRefreshRequired:b?(T||c>0)&&Vi(C):n.controlUiRefreshRequired},v(),E.sync(),x.pairingChanged&&g.devicePairSetupOpen&&(l.canAdmin||l.canPair)&&y.refresh(),b?(c+=1,l.canReviewApprovals&&S(e.client,c,u),w.verify(e.client,c)):x.reviewChanged&&l.canReviewApprovals&&S(e.client,c,u)},D=e.subscribe(te),O=e.subscribeEvents(t=>{if(i||!zp(t))return;if(t.event===`device.pair.setup.completed`){let e=It(t.payload);e&&Vt(g,e);return}if(t.event===`device.pair.setup.deliveryUncertain`){let e=Gt(t.payload);e&&sr(g,e);return}if(t.event===`device.pair.requested`||t.event===`device.pair.resolved`){y.refresh();return}if(t.event===`update.available`){let e=t.payload;n={...n,...jp(n,e)},v(),E.sync();return}if(!l.canReviewApprovals||!K(e.snapshot).canReviewApprovals)return;let r=ff(t.event,t.payload);if(r){kf(_,r),v();return}let a=lf(t.event,t.payload);a&&(jf(_,a.id),v())});return te(e.snapshot),Ip(),{get snapshot(){return n},subscribe(e){return r.add(e),()=>r.delete(e)},refreshUpdateStatus:ee,async runUpdate(){let r=e.snapshot.client;if(!r||e.snapshot.phase!==`connected`||i||n.updateRunning||f!==null||!K(e.snapshot).canAdmin)return;let o=++p;n={...n,updateRunning:!0,updateStatusBanner:null,recordedUpdateAttempt:null},v();try{if(await t.drainConfigWrites?.(),i||o!==p||!K(e.snapshot).canAdmin)return;f=ip(`ambiguous`,n.updateAvailable?.latestVersion?.trim()||null,rp(n.updateSchedule,n.updateAvailable)),v();let s=await r.request(`update.run`,{});if(i||o!==p||a!==r||e.snapshot.client!==r)return;let c=np(s,f);if(c){f=c.pending,c.banner&&(n={...n,updateStatusBanner:c.banner});return}f=null,n={...n,updateStatusBanner:pp({status:s.result?.status??`error`,reason:s.result?.reason})}}catch(t){if(i||o!==p||a!==r||e.snapshot.client!==r)return;f=null,n={...n,updateStatusBanner:{tone:`danger`,text:U(`updates.error`,{error:Zn(t)})}}}finally{!i&&o===p&&a===r&&e.snapshot.client===r&&(n={...n,updateRunning:!1},v())}},async holdUpdate(){let t=e.snapshot.client,r=n.updateSchedule?.campaign,a=m||n.updateRunning||f!==null;if(!t||e.snapshot.phase!==`connected`||i||a||!r||r.state===`applying`||n.heldUpdateCampaignId===r.id||!K(e.snapshot).canAdmin)return!1;m=!0;try{let a=await t.request(`update.hold`,{});if(i||e.snapshot.client!==t)return!1;let o=a.schedule&&Kf(a.schedule);return(o!==void 0||a.ok)&&(n={...n,...o===void 0?{}:{updateSchedule:o},heldUpdateCampaignId:a.ok?r.id:kp(o??n.updateSchedule,n.heldUpdateCampaignId)},v()),a.ok}catch(n){if(!i&&e.snapshot.client===t){let e=Zn(n);C({tone:`danger`,text:U(`updates.error`,{error:e})})}return!1}finally{m=!1}},async decideApproval(t,n,r){let o=n?_.execApprovalQueue.find(e=>e.id===n)??(r?.id===n?r:void 0):_.execApprovalQueue[0],s=e.snapshot.client;if(!o||_.execApprovalBusy||i)return;let l=o===r;if(!s||e.snapshot.phase!==`connected`){_.execApprovalErrors.set(o.id,U(`sessionsView.actionRequiresConnection`)),v();return}if(!K(e.snapshot).canGrantApprovals){_.execApprovalErrors.set(o.id,U(`execApproval.reviewOnly`)),v();return}_.execApprovalBusy=!0,_.execApprovalErrors.delete(o.id);let f={client:s,epoch:c,accessGeneration:u,grantGeneration:d,id:o.id};h=f;let p=()=>h===f&&f.epoch===c&&f.accessGeneration===u&&f.grantGeneration===d&&K(e.snapshot).canGrantApprovals&&x(f.client);v();try{if(await pf(s,o,t),!p())return;jf(_,o.id)}catch(e){if(yf(e)){if(!p())return;jf(_,o.id);let e=a,t=c;e&&p()&&await S(e,t);return}p()&&(l||_.execApprovalQueue.some(e=>e.id===o.id))&&_.execApprovalErrors.set(o.id,`Approval failed: ${Zn(e)}`)}finally{h===f&&(h=null,_.execApprovalBusy=!1,v())}},async openDevicePairSetup(){let t=K(e.snapshot);if(i||!t.canAdmin&&!t.canPair)return!1;g.pendingCount=0;let n=jt(g);return y.refresh(),await b(n),g.devicePairSetupOpen},async refreshDevicePairSetup(){i||!K(e.snapshot).canAdmin||await b(xt(g))},async setDevicePairSetupAccess(t){i||!K(e.snapshot).canAdmin||await b($t(g,t))},closeDevicePairSetup(){y.invalidate({clear:!0}),it(g),v()},dispose(){i=!0,h=null,p+=1,y.invalidate(),w.cancel(),E.stop(),it(g),D(),O(),Of(_),_.execApprovalErrors.clear(),r.clear()}}}function Vp(){return(Vp=e((()=>{Oe(),aa(),H(),Ge(),Sr(),Pf(),Ts(),zf(),Dp(),Yf(),Mp(),Rp()})))()}function Hp(e,t){return e.phase===`connected`&&Ss(e.hello?.auth??null)&&da(e,t)===!0}function Up(e){return Hp(e,`browser.request`)}function Wp(e){return Hp(e,`desktop.observe`)}function Gp(){return(Gp=e((()=>{pa(),Ts()})))()}function Kp(e,{gatewayUrl:t,recoveryScope:n}){let r=e.connectionRevision;return()=>{let i=e.snapshot.client;return e.connectionRevision===r&&e.connection.gatewayUrl===t&&(!i?.recoveryScopeReady||i.recoveryScope===n)}}function qp(e,t=()=>b(()=>import(`./session-placement-startup.runtime-DE487O8e.js`),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)){let n=new Map,{gateway:r}=e,i=!1,a,o,s,c=new Set,l,u,d=()=>c.forEach(e=>e()),f=()=>{let{client:e,phase:t}=r.snapshot;return t===`connected`&&e?.recoveryScopeReady?e:null},p=c=>{if(i)return;if(l??=r.subscribe(()=>p()),c){if(a){a.start(c);return}let e=c.recovery.sessionKey;s=void 0,n.delete(e);let t=Kp(r,c.recovery);n.set(e,()=>t()?c:void 0),n.size>32&&n.delete(n.keys().next().value),d()}let m=f();if(a){if(m)for(let[e,t]of n){let r=t();n.delete(e),r&&a.start(r)}a?.resumeRecovery(),m&&u&&(u=void 0,d());return}if(m&&!c){let e={gatewayUrl:r.connection.gatewayUrl,recoveryScope:m.recoveryScope},t=Kp(r,e),n=Tr(e.gatewayUrl,e.recoveryScope);u=r=>t()&&n.includes(Rr(e.gatewayUrl,e.recoveryScope,r))}o??=t().then(({default:t})=>{i||(a=t(e),a.subscribe(d),p())},e=>{o=void 0,s=Zn(e),d()})};return{get(e){let t=n.get(e)?.();return t?f()?{sessionKey:e,phase:s?`failed`:`pending`,startedAt:t.createdAt,error:s,retryable:!!s}:null:a?.get(e)??null},hasPendingTurn(e){return!!(n.get(e)?.()||a?.hasPendingTurn(e)||u?.(e))},start:p,retry(e){let t=n.get(e)?.();if(t)return p(t);a?.retry(e)},resumeRecovery:p,subscribe(e){return c.add(e),()=>c.delete(e)},dispose(){l?.(),i=!0,a?.dispose(),a=void 0,n.clear(),u=void 0,c.clear()}}}function Jp(){return(Jp=e((()=>{Sr(),An(),C()})))()}function Yp(e){return{...e.value}}function Xp(){let e=new Map,t=new Set,n=!1,r=()=>{for(let e of t)e()},i=t=>{let i=t.generation;return{completion:t.execute(Yp(t),a=>n||e.get(t.value.id)!==t||t.generation!==i||t.value.phase!==`pending`?null:(t.value={...t.value,...a},r(),Yp(t))).then(n=>(e.get(t.value.id)===t&&t.generation===i&&(e.delete(t.value.id),r()),n.status===`admitted`?{id:t.value.id,sessionKey:n.sessionKey,status:`admitted`}:{id:t.value.id,status:`revision-changed`})).catch(n=>{let a=n instanceof Error?n.message:String(n);return e.get(t.value.id)===t&&t.generation===i&&(t.value={...t.value,error:a,phase:`retryable-failed`},r()),{error:a,id:t.value.id,status:`retryable-failed`}}),entry:Yp(t)}};return{start(t,a){let o=Je(),s={execute:a,generation:0,value:{...t,id:o,idempotencyKey:Je(),phase:`pending`}};if(n)throw Error(`Skill Workshop revision admission owner is disposed.`);return e.set(o,s),r(),i(s)},retry(t){let a=e.get(t);return!a||a.value.phase!==`retryable-failed`||n?null:(a.generation+=1,a.value={...a.value,error:void 0,phase:`pending`},r(),i(a))},get(t){let n=e.get(t);return n?Yp(n):null},firstFailed(t){let n=o(t);for(let t of e.values())if(t.value.phase===`retryable-failed`&&o(t.value.proposalAgentId)===n)return Yp(t);return null},subscribe(e){return t.add(e),()=>t.delete(e)},dispose(){n=!0,e.clear(),t.clear()}}}function Zp(){return(Zp=e((()=>{Ln(),dr()})))()}function Qp(){let e=new AbortController,t=new Set,n=n=>{if(e.signal.aborted){n();return}t.add(n)};return{signal:e.signal,addDisposer:n,async run(t){for(let r of t){if(e.signal.aborted)return;let t=await r();t&&n(t)}},trackDisposer(t,r){t.then(n).catch(t=>{e.signal.aborted||r(t)})},stop(){e.abort();for(let e of[...t].toReversed())e();t.clear()}}}function $p(e,t){let n=t?`${t}/`:`/`;if(e.pathname!==n)return e;let r=new URLSearchParams(e.search);if(r.get(`view`)!==`terminal`)return e;r.delete(`view`);let i=r.toString();return{pathname:me({kind:`terminal`},t),search:i?`?${i}`:``,hash:e.hash}}function em(e,t){let n=e,r=!1,i=null,a=null,o=null,s=null,c=null,l=!1,u=e=>{Object.entries(e).every(([e,t])=>n[e]===t)||(n={...n,...e},r=!0)},d=typeof window>`u`?void 0:window.__OPENCLAW_NATIVE_CONTROL_AUTH__;if(d){try{delete window.__OPENCLAW_NATIVE_CONTROL_AUTH__}catch{window.__OPENCLAW_NATIVE_CONTROL_AUTH__=void 0}let e=I(d.gatewayUrl),t=I(d.token),r=I(d.password),a=e?Vu(n.gatewayUrl,e,{token:n.token,password:``}):null;u({...e?{gatewayUrl:e}:{},...t?{token:t}:a?{token:a.token}:{}}),r&&(i=r)}if(!t.search&&!t.hash)return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,queryTokenUsed:l,location:t,changed:r};let f=new URL(`${t.pathname}${t.search}${t.hash}`,`http://openclaw.local`),p=new URLSearchParams(f.search),m=new URLSearchParams(f.hash.startsWith(`#`)?f.hash.slice(1):f.hash),h=p.get(`gatewayUrl`)??m.get(`gatewayUrl`),g=I(h)??``,_=!!(g&&g!==n.gatewayUrl),y=p.get(`token`),b=m.get(`token`),x=b!=null||y!=null,S=I(b??y),C=m.has(`bootstrapToken`),w=I(m.get(`bootstrapToken`)),T=m.has(v),E=I(m.get(v)),ee=Ma(t.pathname,La(t.pathname)),te=!!(S&&!ee&&!_),D=!1;if(p.has(`token`)&&(p.delete(`token`),D=!0),x&&(y!=null&&(l=!0,console.warn(`[openclaw] Auth token passed as query parameter (?token=). Use URL fragment instead: #token=<token>. Query parameters may appear in server logs.`)),S&&_?o=S:S&&u({token:S}),m.delete(`token`),D=!0),C&&(s=w??null,c=w&&E===`owner`?Ve:null,m.delete(`bootstrapToken`),D=!0),T&&(m.delete(v),D=!0),te&&u({sessionKey:`main`,lastActiveSessionKey:`main`}),(p.has(`password`)||m.has(`password`))&&(p.delete(`password`),m.delete(`password`),D=!0),h!=null&&(a=_?g:null,_?s&&(o=null):o=null,p.delete(`gatewayUrl`),m.delete(`gatewayUrl`),D=!0),D){f.search=p.toString();let e=m.toString();f.hash=e?`#${e}`:``}return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,queryTokenUsed:l,location:D?{pathname:f.pathname,search:f.search,hash:f.hash}:t,changed:r}}function tm(){return(tm=e((()=>{ye(),k(),G(),bd()})))()}var nm,rm;function im(){return(im=e((()=>{nm=e=>{e.classList.remove(`theme-transition`),e.style.removeProperty(`--theme-switch-x`),e.style.removeProperty(`--theme-switch-y`)},rm=({nextTheme:e,applyTheme:t,currentTheme:n})=>{if(n===e){t();return}let r=globalThis.document??null;if(!r){t();return}let i=r.documentElement;t(),nm(i)}})))()}function am(e){let t=globalThis.navigator,n=!(/iPad|iPhone|iPod/u.test(t.userAgent)||t.platform===`MacIntel`&&t.maxTouchPoints>1)||t.standalone===!0,r=n&&`serviceWorker`in t&&`PushManager`in globalThis&&`Notification`in globalThis,i={supported:r,permission:n?r?Notification.permission:`unsupported`:`install-required`,subscription:`unknown`,loading:!1},a=new Set,o=e=>{Object.assign(i,e);for(let e of a)e()},s=i.supported?b(async()=>{let{createWebPushCapabilityRuntime:e}=await import(`./web-push.runtime-KQs-HLHc.js`);return{createWebPushCapabilityRuntime:e}},__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).then(({createWebPushCapabilityRuntime:t})=>t({gateway:e,publish:o})).catch(e=>(o({supported:!1,permission:`unsupported`,subscription:`unknown`,preferences:null,error:Zn(e)}),null)):null;return{snapshot:i,subscribe(e){return a.add(e),()=>a.delete(e)},run:e=>s?s.then(t=>t?.run(e)):Promise.resolve(),dispose(){s?.then(e=>e?.dispose()),a.clear()}}}function om(){return(om=e((()=>{Sr(),C()})))()}function sm(e){if(typeof document>`u`)return;let t=document.documentElement,n=ql(e.theme,e.themeMode);t.dataset.theme=n,t.dataset.themeMode=n.endsWith(`light`)?`light`:`dark`,t.dataset.themeResolved=t.dataset.themeMode,t.classList.toggle(`wa-light`,t.dataset.themeMode===`light`),t.classList.toggle(`wa-dark`,t.dataset.themeMode===`dark`),t.style.colorScheme=t.dataset.themeMode,t.style.setProperty(`--control-ui-text-scale`,`${(e.textScale??100)/100}`);let r=$l(e.theme,e.fontUi,e.fontChat);tu(r),ru(e.fontUi,e.fontChat),iu(r.chat),Ml(e.customTheme),_l(e.accent),gl()}function cm(e){let t=e,n=null,r,i,a=new Set,o=0,s=()=>{let e=++o;Jl(t.theme,()=>{if(e===o){sm(t);for(let e of a)e()}})},c=()=>{r?.(),r=void 0},l=()=>{if(c(),t.themeMode!==`system`||typeof globalThis.matchMedia!=`function`)return;let e=globalThis.matchMedia(`(prefers-color-scheme: light)`),n=()=>{t.themeMode===`system`&&s()};typeof e.addEventListener==`function`?(e.addEventListener(`change`,n),r=()=>e.removeEventListener(`change`,n)):typeof e.addListener==`function`&&(e.addListener(n),r=()=>e.removeListener(n))};if(typeof globalThis.matchMedia==`function`){let e=globalThis.matchMedia(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`),t=()=>gl();typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),i=()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`&&(e.addListener(t),i=()=>e.removeListener(t))}return l(),s(),{get settings(){return t},get mode(){return t.themeMode},get resolvedMode(){return ql(t.theme,t.themeMode).endsWith(`light`)?`light`:`dark`},get serverSelection(){return n},recordServerSelection(e,t){n={revision:(n?.revision??0)+1,scope:t,theme:e},s()},setMode(e,n){let r=Uu(),i={...r,themeMode:e},a=ql(r.theme,r.themeMode),o=ql(i.theme,i.themeMode);rm({nextTheme:o,currentTheme:a,context:{element:n},applyTheme:()=>{t=Ku({themeMode:e}),s(),l()}})},refresh(){t=Uu(),s(),l()},subscribe(e){return a.add(e),()=>a.delete(e)},dispose(){o+=1,c(),i?.(),a.clear()}}}function lm(e,t){let n={navCollapsed:t,navWidth:e.navWidth,sidebarEntries:e.sidebarEntries,pinnedAgentIds:e.pinnedAgentIds??[]},r=new Set;return{get snapshot(){return n},update(e){let t={...n,...e},i=t.navWidth!==n.navWidth||t.sidebarEntries!==n.sidebarEntries||t.pinnedAgentIds!==n.pinnedAgentIds;if(!(!i&&t.navCollapsed===n.navCollapsed)){i&&Ku({navWidth:t.navWidth,sidebarEntries:[...t.sidebarEntries],pinnedAgentIds:[...t.pinnedAgentIds]}),n=t;for(let e of r)e(n)}},subscribe(e){return r.add(e),()=>r.delete(e)}}}function um(e={}){let t=Qa(),n=t.location(),[r,i]=Ya(n.pathname||globalThis.location?.pathname||`/`),a=Zc(n.pathname,r),o=Uu(),s=a?Mu(o):o,c=em(s,n),l=R(c.settings.gatewayUrl)===R(s.gatewayUrl)?null:zu(c.settings.gatewayUrl),u=l?{...c.settings,...l,selectedAgentId:l.selectedAgentId}:c.settings;(c.location.pathname!==n.pathname||c.location.search!==n.search||c.location.hash!==n.hash)&&t.replace(c.location),c.changed&&(a?Hu(u.gatewayUrl,u.token):Wu(u));let d=$p(c.location,r),f=new URLSearchParams(d.search),p=f.get(Uc.name)===Uc.value;if(p){f.delete(Uc.name);let e=f.toString();d={...d,search:e?`?${e}`:``}}d!==c.location&&t.replace(d);let m=ze(d,r),h=a===null&&m===null,g=h&&et(d,r,Pa),_=e.sessionPathBuilderReady??(a||m?.status===`valid`&&m.target.kind!==`dashboard`?Promise.resolve():b(()=>import(`./src-DLHBykgZ.js`).then(e=>{hs(e.buildControlUiSessionPath)}),__vite__mapDeps([69,3,2,4,5,6,7,8]),import.meta.url)),v=c.pendingGatewayUrl!==null,y=Dd(u,c.password??``,v?``:c.pendingBootstrapToken??``,void 0,{persistDefaultConnectionSettings:a===null,resourceBasePath:i,...!v&&c.pendingBootstrapProfile?{bootstrapProfile:c.pendingBootstrapProfile}:{}}),x=xn(y),S=Qp(),C=g&&!ot(u.sessionKey),w=null,T=C?new Promise(e=>{w=e}):null,E=(a||m?Promise.resolve(d):Promise.all([_,b(()=>import(`./bootstrap-location-ChIZAqbj.js`),__vite__mapDeps([70,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)]).then(([,e])=>e.resolveInitialApplicationLocation({location:d,basePath:r,sessionKey:u.sessionKey,gateway:y,agentsList:()=>x.state.agentsList,selectedAgentId:u.selectedAgentId,signal:S.signal}))).catch(e=>{if(S.signal.aborted)return d;throw e}),ee=Hr(y),te=Kc(y,x,h?{load:e=>zu(e).selectedAgentId??null,save:(e,t)=>{y.connection.gatewayUrl===e&&Ku({selectedAgentId:t??void 0})}}:void 0),D=dn(y),O=Hl(y),k=dl({resourceBasePath:i,auth:{settings:{token:u.token},password:c.password??``}}),A=Mt(y),j=Fr(),M=mt(y),ne=Bp(y,{drainConfigWrites:()=>M.waitForPendingWrites()}),re=()=>{let e=ne.snapshot;M.setWritesSuspended(e.updateRunning||e.updateReconciliationPending)},N=ne.subscribe(re);re();let P=lm(u,p&&Hc(d.pathname,r)?.namespace===`chat`),ie=cm(u),ae=zd(),oe=Jd({shouldOpenInControlUiBrowser:()=>Uu().openLinksInControlUiBrowser===!0&&Up(y.snapshot)&&document.querySelector(`openclaw-app-shell`)?.isConnected===!0}),F=tf(),se=am(y),ce=Xp(),le=Nd(),ue=qp({gateway:y,sessions:A,initialUserMessage:le}),de=$c(),fe=Es(),pe=!1,me=null,he=c.pendingGatewayUrl===null?null:{gatewayUrl:c.pendingGatewayUrl,token:c.pendingGatewayToken,bootstrapToken:c.pendingBootstrapToken??``,...c.pendingBootstrapProfile?{bootstrapProfile:c.pendingBootstrapProfile}:{}},ge=null,I=null,_e=y.subscribe(e=>{if(e.phase!==`connected`||!e.client){ge=null,I=null;return}ge!==e.client&&(ge=e.client,k.refresh({auth:{hello:e.hello,settings:{token:y.connection.token},password:y.connection.password}}),fn(e.client,yt()!==`off`).catch(()=>void 0)),!(!e.client.recoveryScopeReady||I===e.client)&&(I=e.client,ue.resumeRecovery())}),ve=(e,t)=>{let n=Ra(e,r),i=fe.getState().matches[0],a=i?.routeId===e&&e===`workboard`?i.location.pathname:null;return t?.pathname!==void 0||t?.search!==void 0||t?.hash!==void 0?{...n,pathname:t?.pathname??a??n.pathname,search:t?.search??``,hash:t?.hash??``}:n},ye=()=>{let e=he;if(!e)return;he=null;let t=Vu(y.connection.gatewayUrl,e.gatewayUrl,y.connection);y.connect({gatewayUrl:e.gatewayUrl,token:e.bootstrapToken?``:e.token??t.token,password:t.password,bootstrapToken:e.bootstrapToken,bootstrapProfile:e.bootstrapProfile})},be=()=>{he=null},xe=(e,n,r)=>{let i=ve(e,n);pe||(me={routeId:e,location:i,mode:r});let a=pe&&ks(t.location(),i)?`replace`:r,o=fe.navigate(e,Ce,{history:a},i);return o.catch(e=>{console.error(`[openclaw] route navigation failed`,e)}),o},Se=(e,t)=>xe(e,t,`push`),Ce={basePath:r,resourceBasePath:i,gateway:y,agents:x,agentIdentity:ee,agentSelection:te,channels:D,config:k,scopeUpgrade:O,runtimeConfig:M,sessions:A,placementStartup:ue,workboard:j,overlays:ne,navigation:P,theme:ie,nativeChatDrafts:ae,nativeNotifications:F,webPush:se,skillWorkshopRevisionAdmissions:ce,initialUserMessage:le,chatAttachmentHandoff:de,navigate:(e,t)=>{Se(e,t)},navigateAndWait:Se,replace:(e,t)=>{xe(e,t,`replace`)},revalidate:e=>fe.revalidate(Ce,e),preload:(e,t)=>fe.preloadLocation(ve(e,t),Ce)};return{context:Ce,router:fe,documentMode:a,focusLocation:m,get pendingGatewayConnection(){return he},confirmPendingGatewayConnection:ye,cancelPendingGatewayConnection:be,start:()=>{let e=()=>fe.stop();h&&S.addDisposer(e);let n=[()=>(y.start(),()=>y.stop()),()=>_];return n.push(()=>gn({context:Ce,enabled:g,history:t,initialLocationReady:C?Promise.resolve(d):E,...C?{redirect:()=>t.replace({...Ra(`model-setup`,r),search:`?firstRun=1`}),onInitialDecision:()=>w?.()}:{}})),n.push(()=>{k.refresh({skipWithoutAuthCandidate:!0})}),h&&(T&&n.push(()=>T),n.push(async()=>{let n=me;return me=null,pe=!0,n&&t[n.mode](n.location),await Ms(fe,t,r,Ce),e})),C&&n.push(()=>{S.trackDisposer(gn({context:Ce,enabled:!1,history:t,initialLocationReady:E,installLocation:async e=>{let n=Pa(e.pathname,r);n?await fe.navigate(n,Ce,{history:`replace`},e):t.replace(e)},shouldInstallLocation:()=>et(t.location(),r,Pa)}),e=>{console.error(`[openclaw] initial session location failed`,e)})}),S.run(n)},stop:()=>{S.stop(),_e(),x.dispose(),D.dispose(),O.dispose(),ue.dispose(),A.dispose(),j.dispose(),N(),M.dispose(),ne.dispose(),ie.dispose(),ae.dispose(),oe.dispose(),F?.dispose(),se.dispose(),ce.dispose(),le.clear(),de.dispose()}}}function dm(){return(dm=e((()=>{ye(),Ps(),vs(),Wc(),En(),vt(),Ct(),Lt(),Ln(),Dt(),yn(),li(),qc(),Qc(),$a(),tl(),pl(),Sl(),zl(),Ul(),Md(),Fd(),Zd(),rf(),Vp(),Gp(),Jp(),bd(),Zp(),tm(),im(),Zl(),lu(),om(),C()})))()}var fm;function pm(){return(pm=e((()=>{fm=ee(`openclaw.application`)})))()}function mm(e){return`${e.pathname}${e.search}${e.hash}`}function hm(e){return`type`in e&&e.type===`notFound`}function gm(e){return B`
|
|
<main
|
|
class="connect-splash"
|
|
role="status"
|
|
aria-live="polite"
|
|
aria-label=${e??U(`common.loading`)}
|
|
>
|
|
<openclaw-mascot mood="thinking" .size=${120}></openclaw-mascot>
|
|
${e?B`<span class="connect-splash__status">${e}</span>`:z}
|
|
</main>
|
|
`}var _m;function vm(){return(vm=e((()=>{N(),ye(),ui(),di(),Yi(),na(),xi(),Ki(),Ai(),Ni(),H(),Sr(),Ln(),zn(),xr(),ri(),dm(),pm(),Bc(),Gp(),bd(),C(),_m=class extends Xn{get context(){return this.runtime?.context}get focusTarget(){let e=this.runtime?.focusLocation;return e?.status===`valid`?e.target:null}get terminalOnly(){return this.focusTarget?.kind===`terminal`}constructor(){super(),this.loginGatePinned=!1,this.loginGatewayUrl=``,this.loginToken=``,this.loginPassword=``,this.loginShowGatewayToken=!1,this.loginShowGatewayPassword=!1,this.pendingGatewayUrl=null,this.onboarding=Vo(globalThis.location?.search??``),this.focusDashboardRoute={kind:`loading`},this.contextProvider=new Re(this,{context:fm}),this.subscriptions=new qr(this),this.loginGatewaySource=null,this.loginConnectionClient=null,this.focusDashboardAbort=null,this.lazyCustomElements=new xc(this,()=>this.closeDocument(this.context?.basePath??``)),this.subscriptions.watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.synchronizeGateway(e)).watch(()=>this.terminalOnly?this.context?.config:void 0,(e,t)=>e.subscribe(t)).watch(()=>this.terminalOnly?this.context?.agentSelection:void 0,(e,t)=>e.subscribe(t)).watch(()=>this.terminalOnly?this.context?.theme:void 0,(e,t)=>e.subscribe(t)).effect(()=>this.ownerDocument,vi)}connectedCallback(){super.connectedCallback(),b(()=>import(`./session-progress-hovercard-registration-CvDu6Gsh.js`),__vite__mapDeps([71,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url),this.resetLoginSensitivePresentation(),this.runtime=um();let e=this.focusTarget;e?.kind===`terminal`&&this.requestLazyDocument(Ac),e?.kind===`desktop`&&this.requestLazyDocument(Mc),e?.kind===`dashboard`&&this.requestLazyDocument(Nc),this.runtime.documentMode?.kind===`approval`&&this.requestLazyDocument(Fc),this.runtime.documentMode?.kind===`question`&&this.requestLazyDocument(Lc);let t=this.runtime.context;this.pendingGatewayUrl=this.runtime.pendingGatewayConnection?.gatewayUrl??null,this.contextProvider.setValue(t),this.syncLoginConnection(),this.requestUpdate(),this.runtime.start().then(()=>this.resolveFocusDashboard()).catch(e=>{console.error(`[openclaw] application start failed`,e)})}disconnectedCallback(){this.subscriptions.clear(),this.focusDashboardAbort?.abort(),this.focusDashboardAbort=null,this.lazyCustomElements.abandon(),this.runtime?.stop(),this.runtime=void 0,this.loginGatewaySource=null,this.loginConnectionClient=null,this.pendingGatewayUrl=null,this.resetLoginSensitivePresentation(),super.disconnectedCallback()}firstUpdated(){this.runtime&&globalThis.dispatchEvent(new Event(`openclaw-control-ui-rendered`))}synchronizeGateway(e){let t=e!==this.loginGatewaySource;t&&(this.loginGatewaySource=e,this.loginConnectionClient=null,this.resetLoginSensitivePresentation());let n=e.snapshot,r=n.client!==this.loginConnectionClient;r&&(this.loginConnectionClient=n.client,this.resetLoginSensitivePresentation()),(t||r)&&this.syncLoginConnection(e),n.phase===`connected`&&(this.loginGatePinned=!1)}syncLoginConnection(e=this.context?.gateway){let t=e?.connection;t&&(this.loginGatewayUrl=t.gatewayUrl,this.loginToken=t.token,this.loginPassword=t.password)}resetLoginSensitivePresentation(){this.loginShowGatewayToken=!1,this.loginShowGatewayPassword=!1}updateLoginGatewayUrl(e){let t=Vu(this.loginGatewayUrl,e,{token:this.loginToken,password:this.loginPassword});this.loginGatewayUrl=e,this.loginToken=t.token,this.loginPassword=t.password}closeDocument(e){globalThis.history.length>1?globalThis.history.back():globalThis.location.assign(e||`/`)}renderFocusEscape(e){return B`<button
|
|
class="btn btn--ghost"
|
|
type="button"
|
|
@click=${()=>this.closeDocument(this.context?.basePath??``)}
|
|
>
|
|
${e}
|
|
</button>`}requestLazyDocument(e){q(e)||this.lazyCustomElements.request(e)}renderLazyDocumentState(e){let t=this.lazyCustomElements.visibleState;return!t||t.element!==e?z:B`<main class="connect-splash">
|
|
${sa(t,()=>this.lazyCustomElements.retry(),()=>this.lazyCustomElements.close())}
|
|
</main>`}renderApprovalDocument(e){if(this.lazyCustomElements.visibleState?.element===Fc)return this.renderLazyDocumentState(Fc);let t=e.documentMode?.kind===`approval`?e.documentMode.approvalId:``;return B`<openclaw-approval-page .approvalId=${t??``}></openclaw-approval-page>`}renderQuestionDocument(e){if(this.lazyCustomElements.visibleState?.element===Lc)return this.renderLazyDocumentState(Lc);let t=e.documentMode?.kind===`question`?e.documentMode.questionId:``;return B`<openclaw-question-page .questionId=${t??``}></openclaw-question-page>`}replaceFocusDashboardLocation(e,t){let n=this.context?.basePath??``,r=me({kind:`dashboard`,path:mm(t)},n),i=me({kind:`dashboard`,path:mm(e)},n),a=`${globalThis.location.pathname}${globalThis.location.search}${globalThis.location.hash}`;!r||!i||a!==r||i===a||globalThis.history.replaceState(globalThis.history.state,``,i)}async resolveFocusDashboard(){let e=this.focusTarget,t=this.context;if(e?.kind!==`dashboard`||!t)return;this.focusDashboardAbort?.abort();let n=new AbortController;this.focusDashboardAbort=n,this.focusDashboardRoute={kind:`loading`};let r=e.route;try{let{loadChatRoute:e}=await b(async()=>{let{loadChatRoute:e}=await import(`./route-loader-BScCw0Rs.js`);return{loadChatRoute:e}},__vite__mapDeps([72,19,2,3,4,5,6,7,8,9,10,1,11,12,13,14,15,16,17,18,20,21,22,23]),import.meta.url),i=await e(t,r,`dashboard`,n.signal);if(n.signal.aborted||this.focusDashboardAbort!==n)return;if(hm(i)||i.kind===`missing-session`){this.focusDashboardRoute={kind:`not-found`};return}if(i.kind===`ambiguous`){this.focusDashboardRoute={kind:`ambiguous`,data:{...i,candidates:i.candidates.map(e=>({...e,href:me({kind:`dashboard`,path:e.href},t.basePath)??e.href}))}};return}this.focusDashboardRoute={kind:`session`,data:i},i.canonicalLocation&&i.canonicalLocationSource&&this.replaceFocusDashboardLocation(i.canonicalLocation,i.canonicalLocationSource);let a=i.canonicalLocationSource;i.canonicalLocationReady&&a&&i.canonicalLocationReady.then(e=>{e&&!n.signal.aborted&&this.focusDashboardAbort===n&&this.replaceFocusDashboardLocation(e,a)})}catch(e){!n.signal.aborted&&this.focusDashboardAbort===n&&(this.focusDashboardRoute={kind:`error`,message:Zn(e)})}}renderFocusDashboard(e,t,n){let r=this.focusDashboardRoute;return r.kind===`loading`?gm(n):r.kind===`not-found`?B`<main class="board-document">
|
|
<section class="board-document__state stack" role="status">
|
|
<span>${U(`dashboardDocument.notFound`)}</span>
|
|
${this.renderFocusEscape(U(`dashboardDocument.close`))}
|
|
</section>
|
|
</main>`:r.kind===`error`?B`<main class="board-document">
|
|
<section class="board-document__state board-document__state--error stack" role="alert">
|
|
<span>${U(`dashboardDocument.loadFailed`,{error:r.message})}</span>
|
|
${this.renderFocusEscape(U(`dashboardDocument.close`))}
|
|
</section>
|
|
</main>`:r.kind===`ambiguous`?B`<main class="board-document">
|
|
<section class="card board-document__state">
|
|
<h2>${U(`chat.sessionRoute.chooseTitle`)}</h2>
|
|
<p>
|
|
${r.data.candidates.length>1?U(`chat.sessionRoute.multipleMatches`,{shortId:r.data.shortId}):U(`chat.sessionRoute.additionalMatches`)}
|
|
</p>
|
|
${r.data.candidates.map(e=>B`<p>
|
|
<a href=${e.href}>${e.displayName}</a><br />
|
|
<small>${e.agentId} · ${e.idPrefix}</small>
|
|
</p>`)}
|
|
${r.data.truncated?B`<p><small>${U(`chat.sessionRoute.additionalMatches`)}</small></p>`:z}
|
|
${this.renderFocusEscape(U(`dashboardDocument.close`))}
|
|
</section>
|
|
</main>`:B`
|
|
<openclaw-board-document
|
|
.gatewaySnapshot=${e}
|
|
.sessionKey=${r.data.sessionKey}
|
|
.onDocumentClose=${()=>this.closeDocument(this.context?.basePath??``)}
|
|
></openclaw-board-document>
|
|
${!t&&e.lastError===null?gm(n):z}
|
|
${t?this.renderLazyDocumentState(Nc):z}
|
|
`}render(){let e=this.context,t=this.runtime;if(!e||!t)return B`<main class="app-shell app-shell--booting" aria-busy="true"></main>`;let n=e.gateway.snapshot,r=n.phase===`connected`,i=n.phase===`starting`?U(`common.gatewayStarting`):void 0,a=this.pendingGatewayUrl?B`
|
|
<openclaw-gateway-url-confirmation
|
|
.props=${{pendingGatewayUrl:this.pendingGatewayUrl,onConfirm:()=>{t.confirmPendingGatewayConnection(),this.pendingGatewayUrl=null},onCancel:()=>{t.cancelPendingGatewayConnection(),this.pendingGatewayUrl=null}}}
|
|
></openclaw-gateway-url-confirmation>
|
|
`:z;if(t.focusLocation?.status===`unsupported`)return B`<main class="connect-splash" role="alert">
|
|
<div class="stack">
|
|
<span class="connect-splash__status">${U(`focus.unsupported`)}</span>
|
|
${this.renderFocusEscape(U(`common.back`))}
|
|
</div>
|
|
</main>`;let s=this.focusTarget;if(s?.kind===`terminal`){let t=ei(n,e.config.current.terminalEnabled??!1),a=e.agentSelection.state.selectedId??n.assistantAgentId,s=a?o(a):null;return B`
|
|
<openclaw-terminal-panel
|
|
.client=${r?n.client:null}
|
|
.available=${t}
|
|
.agentId=${s}
|
|
.themeMode=${e.theme.resolvedMode}
|
|
fullscreen
|
|
></openclaw-terminal-panel>
|
|
${!r&&n.lastError===null?gm(i):z}
|
|
${t?this.renderLazyDocumentState(Ac):z}
|
|
${!t&&(r||n.lastError)?B`<div class="terminal-view-unavailable">
|
|
<div class="stack">
|
|
<span>${U(`terminal.unavailable`)}</span>
|
|
${this.renderFocusEscape(U(`common.back`))}
|
|
</div>
|
|
</div>`:z}
|
|
`}if(s?.kind===`desktop`){let t=Wp(n),a=s.selector?.kind===`source`?s.selector.value:null,o=s.selector?.kind===`session`?s.selector.value:null;return B`
|
|
<openclaw-desktop-panel
|
|
.client=${r?n.client:null}
|
|
.available=${t}
|
|
.documentMode=${!0}
|
|
.requestedSource=${a}
|
|
.sessionKey=${o}
|
|
.documentControl=${s.control}
|
|
.onDocumentClose=${()=>this.closeDocument(e.basePath)}
|
|
></openclaw-desktop-panel>
|
|
${!r&&n.lastError===null?gm(i):z}
|
|
${t?this.renderLazyDocumentState(Mc):z}
|
|
${!t&&(r||n.lastError)?B`<div class="desktop-view-unavailable">
|
|
<div class="stack">
|
|
<span>${U(`desktop.unavailable`)}</span>
|
|
${this.renderFocusEscape(U(`common.back`))}
|
|
</div>
|
|
</div>`:z}
|
|
`}if(s?.kind===`dashboard`)return this.renderFocusDashboard(n,r,i);if(t.documentMode===null&&n.lastError===null&&(n.phase===`starting`||n.phase===`connecting`&&!this.loginGatePinned))return B`
|
|
<openclaw-tooltip-provider>
|
|
${gm(i)} ${a}
|
|
</openclaw-tooltip-provider>
|
|
`;let c=n.phase===`reconnecting`||n.phase===`reload-required`;return!r&&!c?B`
|
|
<openclaw-tooltip-provider>
|
|
<openclaw-login-gate
|
|
.props=${{resourceBasePath:e.resourceBasePath,connected:r,lastError:n.lastError,lastErrorCode:n.lastErrorCode,hasToken:!!this.loginToken.trim(),hasPassword:!!this.loginPassword.trim(),gatewayUrl:this.loginGatewayUrl,token:this.loginToken,password:this.loginPassword,showGatewayToken:this.loginShowGatewayToken,showGatewayPassword:this.loginShowGatewayPassword,onGatewayUrlChange:e=>{this.updateLoginGatewayUrl(e)},onTokenChange:e=>{this.loginToken=e},onPasswordChange:e=>{this.loginPassword=e},onToggleGatewayToken:()=>{this.loginShowGatewayToken=!this.loginShowGatewayToken},onToggleGatewayPassword:()=>{this.loginShowGatewayPassword=!this.loginShowGatewayPassword},onConnect:()=>{this.loginGatePinned=!0,e.gateway.connect({gatewayUrl:this.loginGatewayUrl,token:this.loginToken,password:this.loginPassword})}}}
|
|
></openclaw-login-gate>
|
|
${a}
|
|
</openclaw-tooltip-provider>
|
|
`:t.documentMode?.kind===`approval`?B`
|
|
<openclaw-tooltip-provider>
|
|
${this.pendingGatewayUrl?a:this.renderApprovalDocument(t)}
|
|
</openclaw-tooltip-provider>
|
|
`:t.documentMode?.kind===`question`?B`
|
|
<openclaw-tooltip-provider>
|
|
${a} ${this.renderQuestionDocument(t)}
|
|
</openclaw-tooltip-provider>
|
|
`:B`
|
|
<openclaw-tooltip-provider>
|
|
<openclaw-github-link-hovercard-provider .client=${n.client}>
|
|
<openclaw-session-progress-hovercard-provider
|
|
.client=${n.client}
|
|
.context=${e}
|
|
.gateway=${e.gateway}
|
|
>
|
|
${a}
|
|
<openclaw-app-shell
|
|
.runtime=${t}
|
|
.onboarding=${this.onboarding}
|
|
></openclaw-app-shell>
|
|
</openclaw-session-progress-hovercard-provider>
|
|
</openclaw-github-link-hovercard-provider>
|
|
</openclaw-tooltip-provider>
|
|
`}},F([V()],_m.prototype,`loginGatePinned`,void 0),F([V()],_m.prototype,`loginGatewayUrl`,void 0),F([V()],_m.prototype,`loginToken`,void 0),F([V()],_m.prototype,`loginPassword`,void 0),F([V()],_m.prototype,`loginShowGatewayToken`,void 0),F([V()],_m.prototype,`loginShowGatewayPassword`,void 0),F([V()],_m.prototype,`pendingGatewayUrl`,void 0),F([V()],_m.prototype,`onboarding`,void 0),F([V()],_m.prototype,`focusDashboardRoute`,void 0)})))()}function ym(e,t){let n=t instanceof CustomEvent?t.detail:null;return typeof n==`object`&&n&&!Array.isArray(n)?{eventType:e,detail:n}:{eventType:e}}function bm(){try{let e=$n()?.getItem(Cm),t=e?JSON.parse(e):null;if(typeof t!=`object`||!t||Array.isArray(t))return Sm(),null;let n=Object.entries(t),r=n.find(([e])=>e===`eventType`)?.[1],i=Tm.find(e=>e===r);if(i&&n.length===1)return{eventType:i};let a=n.find(([e])=>e===`detail`)?.[1];if(i&&n.length===2&&typeof a==`object`&&a&&!Array.isArray(a))return{eventType:i,detail:a}}catch{}return Sm(),null}function xm(e){try{let t=$n();return t?(t.setItem(Cm,JSON.stringify(e)),!0):!1}catch{}return Sm(),!1}function Sm(){try{$n()?.removeItem(Cm)}catch{}}var Cm,wm,Tm;function Em(){return(Em=e((()=>{Qi(),oa(),Cm=`openclaw:lazy-event`,wm=`openclaw:approvals-open`,Tm=[qi,ia,Ii,ki,Bi,la,Fi,wm]})))()}function Dm(){return window.__OPENCLAW_NATIVE_WEB_CHROME__===!0}function Om(){let e=window.__OPENCLAW_NATIVE_HISTORY__;return e&&typeof e.canGoBack==`boolean`&&typeof e.canGoForward==`boolean`?e:{canGoBack:!1,canGoForward:!1}}var km;function Am(){return(Am=e((()=>{km=`openclaw:native-history-state`})))()}function jm(){return`(max-width: ${Dm()?Lm:Im}px)`}function Mm(){return globalThis.matchMedia?.(jm()).matches??!1}function Nm(){return Rm.some(e=>document.documentElement.classList.contains(e))}function Pm(e){return e.mobileNavLayout&&ja(e.routeId)&&!e.onboarding&&!Nm()}function Fm(e,t){return Pm({mobileNavLayout:e,routeId:`chat`,onboarding:t})}var Im,Lm,Rm;function zm(){return(zm=e((()=>{G(),Am(),Im=1100,Lm=600,Rm=[`openclaw-native-macos`,`openclaw-native-nav`,`openclaw-native-web-chrome`]})))()}var Bm;function Vm(){return(Vm=e((()=>{C(),Bm=class{constructor(e,t){this.host=e,this.requestOpen=t,this.pending=!1}load(){this.owner||this.pending||(this.pending=!0,b(async()=>{let{NavDrawerSwipeOwner:e}=await import(`./nav-drawer-swipe.runtime-XKu72Qdc.js`);return{NavDrawerSwipeOwner:e}},__vite__mapDeps([73,2]),import.meta.url).then(({NavDrawerSwipeOwner:e})=>{this.owner=new e(this.host,this.requestOpen),this.pending=!1,this.host.isConnected&&this.owner.connect()},()=>this.pending=!1))}connect(){this.owner?.connect()}disconnect(){this.owner?.disconnect()}opened(){return this.owner?.opened(),!!this.owner}closed(){this.owner?.closed()}}})))()}function Hm(e){let t=[...e.querySelectorAll(`openclaw-sidebar-attention:defined`)].map(e=>e.dismissPanel()).some(e=>e);return e.querySelector(`openclaw-app-sidebar:defined`)?.dismissTransientMenus()===!0||t}function Um(e,t){let n=e.querySelector(`.shell-nav`);if(!n||t.composedPath().some(e=>e instanceof Element&&e!==n&&e.matches(`dialog, [role='dialog']`)))return;let r=[...n.querySelectorAll(Zm)].filter(e=>e.checkVisibility()),i=t.shiftKey?r.at(-1):r[0],a=t.shiftKey?r[0]:r.at(-1);(!n.contains(document.activeElement)||document.activeElement===a||t.shiftKey&&document.activeElement===n)&&(t.preventDefault(),(i??n).focus({preventScroll:!0}))}function Wm(e,t){t.defaultPrevented||Sn(_n.escape,t)||(Sn(_n.toggleSidebar,t)?(t.preventDefault(),e.closeNavDrawer({restoreFocus:!0})):t.key===`Tab`?Um(e,t):(Ji(t)||ji(t)||Sn(_n.workspaceFiles,t))&&(t.preventDefault(),t.stopImmediatePropagation()))}function Gm(e){let t=e.querySelector(`.shell-nav`),n=e.querySelector(`openclaw-toast-host`);t&&n&&n.parentElement!==t&&t.moveBefore(n,null)}function Km(e){let t=e.querySelector(`.shell`),n=e.querySelector(`openclaw-toast-host`);t&&n?.parentElement?.classList.contains(`shell-nav`)&&t.moveBefore(n,null)}function qm(e){return[...e.querySelectorAll(`.topbar-nav-toggle, .chat-pane__nav-toggle`)].find(e=>e.checkVisibility())}function Jm(e){return e.onboarding||(e.mobileNavLayout?!e.navDrawerOpen:e.navCollapsed)}function Ym(e){return(e.settingsTakeover||e.navigationSurfaceHidden&&(!e.mobileNavLayout||e.onboarding))&&!e.compact}function Xm(e){let t=Ym(e),n=!e.compact&&e.refreshRequired;return!t&&!n?z:B`${t?B`<openclaw-sidebar-attention
|
|
class="sidebar-attention--floating"
|
|
.onNavigate=${e.onNavigate}
|
|
.onOpenApprovals=${e.onOpenApprovals}
|
|
></openclaw-sidebar-attention>`:z}${n?B`<openclaw-sidebar-update-card
|
|
class="sidebar-update-card--floating"
|
|
.updateAvailable=${e.updateAvailable}
|
|
.updateSchedule=${e.updateSchedule??null}
|
|
.heldUpdateCampaignId=${e.heldUpdateCampaignId??null}
|
|
.updateBusy=${e.updateBusy}
|
|
.statusBanner=${e.statusBanner??null}
|
|
.watchUpdateProgress=${e.watchUpdateProgress}
|
|
.canUpdate=${e.canUpdate??!1}
|
|
.canHoldUpdate=${e.canHoldUpdate??!1}
|
|
.onUpdate=${e.onUpdate}
|
|
.refreshRequired=${e.refreshRequired}
|
|
.onRefresh=${e.onRefresh}
|
|
.onHoldUpdate=${e.onHoldUpdate??(async()=>!1)}
|
|
.onReviewUpdate=${e.onReviewUpdate??(()=>void 0)}
|
|
></openclaw-sidebar-update-card>`:z}`}var Zm;function Qm(){return(Qm=e((()=>{ui(),Qi(),oa(),Nr(),Zm=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])`})))()}function $m(e){return e!==void 0&&go(e)}var eh;function th(){return(th=e((()=>{Bo(),G(),Qi(),oa(),Zi(),pa(),Nr(),Ze(),zn(),Bc(),Em(),zm(),Am(),Vm(),Qm(),Gp(),bd(),sc(),eh=class{constructor(e){this.host=e,this.pendingLazyAction=bm(),this.restoreFocusTo=e=>(e?.isConnected&&e.checkVisibility()?e:this.host.querySelector(`.content`))?.focus(),this.handleNativeToggleSidebar=()=>this.toggleNavigationSurface(),this.handleNativeOpenSearch=()=>this.openPalette(),this.handleNativeToggleSearch=e=>{e.preventDefault(),this.togglePalette()},this.handleNativeNewSession=()=>{let e=this.host,t=e.context;if(!e.onboardingMode){if(!t){e.pendingNativeNewSession=!0;return}mn(t.gateway.snapshot,{method:`sessions.create`,params:{}}).allowed&&e.openNewSession(t.agentSelection.state.selectedId??``)}},this.handleNativeNavigate=e=>{let t=e.detail,n=t?.path,r=typeof n==`string`?n.slice(1):``;if(typeof n!=`string`||!n.startsWith(`/`)||n.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(r))return;let i=Pa(n);if(!i||!this.host.context)return;e.preventDefault();let a=t?.search;if(typeof a==`string`&&a.startsWith(`?`)&&!a.includes(`#`)){this.host.navigate(i,{search:a});return}this.host.navigate(i)},this.handleNativeHistoryState=e=>{let t=e.detail;typeof t?.canGoBack==`boolean`&&typeof t.canGoForward==`boolean`&&(this.host.nativeHistoryState=t)},this.handleWindowResize=()=>{let e=this.host,t=Mm(),n=t&&!e.navDrawerOpen&&this.dismissSidebarTransientMenus();t?(this.navDrawerSwipe.load(),e.desktopNavigationExpanded=!1):e.navDrawerOpen&&(e.closeNavDrawer({restoreFocus:!1}),e.desktopNavigationExpanded=e.context?.navigation.snapshot.navCollapsed??!1),e.requestUpdate(),e.updateComplete.then(()=>{Mm()&&!e.navDrawerOpen&&n&&requestAnimationFrame(()=>{this.restoreFocusTo(qm(e))})})},this.handleUnhandledFileDrag=e=>{let t=e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`file`&&!e.disabled);e.defaultPrevented||t||!Array.from(e.dataTransfer?.types??[]).includes(`Files`)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`none`))},this.dismissSidebarTransientMenus=()=>Hm(this.host),this.handleDocumentKeydownBubble=e=>{let t=this.host;e.defaultPrevented||!Sn(_n.escape,e)||(t.navDrawerOpen&&Mm()&&!document.openClawModalLayers?.size?(e.preventDefault(),t.closeNavDrawer({restoreFocus:!0})):$m(t.routeState.routeId)&&!this.shouldIgnoreSettingsEscape(e)&&(e.preventDefault(),t.exitSettings()))},this.handleDocumentKeydown=e=>{let t=this.host;if(!document.openClawModalLayers?.size){if(t.navDrawerOpen&&Mm()){Wm(t,e);return}if(!t.commandPalette&&Ji(e)){e.preventDefault(),this.togglePalette();return}if(!ja(t.routeState.routeId)&&!q(t.terminalPanelElement)&&ji(e)){e.preventDefault(),window.dispatchEvent(new CustomEvent(ki));return}if(!e.defaultPrevented){if(Sn(_n.keyboardShortcuts,e)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Ii));return}if(Sn(_n.debugOverlay,e)){let t=e.target;if(t instanceof Element&&t.closest(`input, textarea, [contenteditable]:not([contenteditable='false'])`))return;e.preventDefault(),window.dispatchEvent(new CustomEvent(ia));return}if(Sn(_n.escape,e)&&$m(t.routeState.routeId)){if(t.navDrawerOpen){e.preventDefault(),t.closeNavDrawer({restoreFocus:!0});return}if(e.eventPhase===Event.CAPTURING_PHASE||this.shouldIgnoreSettingsEscape(e))return;e.preventDefault(),t.exitSettings();return}if(Sn(_n.appearanceSettings,e)){e.preventDefault(),t.navigate(`appearance`);return}Sn(_n.toggleSidebar,e)&&(e.preventDefault(),this.toggleNavigationSurface())}}},this.handleDebugOverlayRequest=e=>{let t=this.host;t.navDrawerOpen&&Mm()&&t.closeNavDrawer({restoreFocus:!1});let n=ym(ia,e);if(q(wc)){t.querySelector(wc.tagName)?.toggle(),this.clearPendingLazyAction(n);return}this.requestLazyElement(wc,n)},this.handleKeyboardShortcutsRequest=e=>{let t=ym(Ii,e);if(q(Ec)){this.host.querySelector(Ec.tagName)?.toggle(),this.clearPendingLazyAction(t);return}this.requestLazyElement(Ec,t)},this.handleCommandPaletteOpen=(e,t)=>{let n=this.host,r=n.commandPalette,i=ym(qi,e);if(r){r.openPalette(),this.clearPendingLazyAction(i);return}this.requestLazyElement(n.commandPaletteElement,i,t)},this.openPalette=()=>this.handleCommandPaletteOpen(new CustomEvent(qi),this.openPalette),this.refreshControlUi=()=>globalThis.location.reload(),this.handleShellNavDrawerToggle=e=>{this.toggleNavigationSurface(Hi(e))},this.togglePalette=()=>{let e=this.host.commandPalette;e?e.togglePalette():this.openPalette()},this.openApprovals=()=>void window.dispatchEvent(new CustomEvent(wm)),this.handleApprovalsOpen=e=>{let t=this.host,n=ym(wm,e);if(q(t.execApprovalElement)){t.approvalOverlay?.show(),this.clearPendingLazyAction(n);return}this.requestLazyElement(t.execApprovalElement,n)},this.handleDeferredTerminalToggle=e=>{let t=this.host;if(this.isSessionRoute()){ea(`terminal`,e);return}if(q(t.terminalPanelElement))return;let n=t.context,r=n?.gateway?.snapshot;if(!r||!ei(r,n.config.current.terminalEnabled??!1)){e.preventDefault();return}this.requestLazyElement(t.terminalPanelElement,ym(ki,e))},this.handleDeferredBrowserToggle=e=>{let t=this.host;if(this.isSessionRoute()){ea(`browser`,e);return}if(q(t.browserPanelElement))return;let n=t.context?.gateway?.snapshot;n&&Up(n)?this.requestLazyElement(t.browserPanelElement,ym(Bi,e)):e.preventDefault()},this.handleDeferredDesktopToggle=e=>{let t=this.host;if(this.isSessionRoute()){ea(`desktop`,e);return}let n=t.context;if(!n||!Wp(n.gateway.snapshot)){e.preventDefault(),e.stopImmediatePropagation();return}q(t.desktopPanelElement)||this.requestLazyElement(t.desktopPanelElement,ym(la,e))},this.handleDeferredCustodianToggle=e=>{let t=this.host;if(q(t.custodianPanelElement))return;let n=t.context?.gateway?.snapshot;fa(n,`openclaw.chat`,`operator.admin`)?this.requestLazyElement(t.custodianPanelElement,ym(Fi,e)):e.preventDefault()},this.handleCommandPaletteSlashCommand=e=>{let t=this.host,n=t.commandPaletteTarget?.owner.isConnected?t.commandPaletteTarget.onSlashCommand:null;if(n){n(e);return}let r=t.chatNavigationOptions(`chat`),i=new URLSearchParams(r?.search??``);i.set(`draft`,e.endsWith(` `)?e:`${e} `),t.navigate(`chat`,{...r,search:`?${i.toString()}`})},this.handleCommandPaletteTarget=e=>zi(this.host,e),this.navDrawerSwipe=new Bm(e,()=>this.toggleNavigationSurface())}isSessionRoute(){return ja(Pa(globalThis.location?.pathname??``,this.host.context?.basePath??``)??this.host.routeState.routeId)}connect(){this.disconnect(),this.listeners=new AbortController;let e={signal:this.listeners.signal},t=this.host;t.nativeHistoryState=Om(),t.addEventListener(ra,this.handleCommandPaletteTarget,e),window.addEventListener(qi,this.handleCommandPaletteOpen,e),window.addEventListener(Ri,this.handleShellNavDrawerToggle,e),window.addEventListener(ia,this.handleDebugOverlayRequest,e),window.addEventListener(Ii,this.handleKeyboardShortcutsRequest,e),document.addEventListener(`keydown`,this.handleDocumentKeydown,{capture:!0,signal:this.listeners.signal}),document.addEventListener(`keydown`,this.handleDocumentKeydownBubble,e),window.addEventListener(`resize`,this.handleWindowResize,e),window.addEventListener(`dragover`,this.handleUnhandledFileDrag,e),window.addEventListener(`drop`,this.handleUnhandledFileDrag,e),window.addEventListener(km,this.handleNativeHistoryState,e),window.addEventListener(`openclaw:native-toggle-sidebar`,this.handleNativeToggleSidebar,e),window.addEventListener(`openclaw:native-open-search`,this.handleNativeOpenSearch,e),window.addEventListener(`openclaw:native-toggle-search`,this.handleNativeToggleSearch,e),window.addEventListener(`openclaw:native-new-session`,this.handleNativeNewSession,e),window.addEventListener(`openclaw:native-navigate`,this.handleNativeNavigate,e),window.addEventListener(ki,this.handleDeferredTerminalToggle,e),window.addEventListener(Bi,this.handleDeferredBrowserToggle,e),window.addEventListener(la,this.handleDeferredDesktopToggle,e),window.addEventListener(Fi,this.handleDeferredCustodianToggle,e),window.addEventListener(wm,this.handleApprovalsOpen,e),this.navDrawerSwipe.connect(),Mm()&&this.navDrawerSwipe.load()}disconnect(){this.listeners?.abort(),this.listeners=void 0,this.navDrawerSwipe.disconnect()}toggleNavigationSurface(e){let t=this.host,n=t.context;if(!n||t.onboardingMode||$m(t.routeState.routeId)&&!Mm())return;if(Mm()){if(this.navDrawerSwipe.load(),t.navDrawerOpen){t.closeNavDrawer({restoreFocus:!0});return}t.navDrawerTrigger=e??qm(t)??null,t.navDrawerOpen=!0,Gm(t),this.navDrawerSwipe.opened()||t.updateComplete.then(()=>{t.isConnected&&t.navDrawerOpen&&t.querySelector(`.shell-nav`)?.focus({preventScroll:!0})});return}let r=t.navDrawerOpen||!(n.navigation.snapshot.navCollapsed&&!t.desktopNavigationExpanded);t.desktopNavigationExpanded=!1,r&&this.dismissSidebarTransientMenus(),t.closeNavDrawer(),n.navigation.update({navCollapsed:r}),r&&t.updateComplete.then(()=>{this.restoreFocusTo(t.querySelector(`.shell-chrome-controls__nav-toggle`))})}closeNavDrawer(e={}){let t=this.host;t.navDrawerOpen&&(this.dismissSidebarTransientMenus(),this.navDrawerSwipe.closed()),Km(t);let n=e.restoreFocus?t.navDrawerTrigger:null;t.navDrawerOpen=!1,t.navDrawerTrigger=null,e.restoreFocus&&requestAnimationFrame(()=>this.restoreFocusTo(n))}resizeNavigation(e){let t=this.host,n=t.querySelector(`.shell`),r=t.context;if(!n||!r)return;let i=Math.round(Math.min(400,Math.max(240,e*n.clientWidth)));r.navigation.update({navWidth:i})}shouldIgnoreSettingsEscape(e){let t=this.host,n=t.context?.overlays.snapshot;if(t.commandPalette?.isOpen||t.querySelector(Ec.tagName)?.isOpen||n?.devicePairSetupOpen||t.approvalOverlay?.dialogOpen===!0||document.openClawModalLayers?.size)return!0;let r=e.target;return r instanceof Element&&r.closest(`input, textarea, select, wa-select[open], [contenteditable], dialog, [role='dialog'], [role='menu'], [role='listbox']`)!==null}lazyElementForShellEvent(e){let t=this.host;return{[qi]:t.commandPaletteElement,[ia]:wc,[Ii]:Ec,[ki]:t.terminalPanelElement,[Bi]:t.browserPanelElement,[la]:t.desktopPanelElement,[Fi]:t.custodianPanelElement,[wm]:t.execApprovalElement}[e]}restorePendingLazyAction(){let e=this.pendingLazyAction;if(!e||this.host.lazyCustomElements.visibleState)return;let t=this.lazyElementForShellEvent(e.eventType);q(t)&&!this.host.querySelector(t.tagName)||this.dispatchLazyShellEvent(e)&&!this.host.lazyCustomElements.visibleState&&this.clearPendingLazyAction(e)}requestLazyElement(e,t,n=()=>this.dispatchLazyShellEvent(t)){this.pendingLazyAction=t,xm(t),this.host.lazyCustomElements.request(e,()=>{n(),this.clearPendingLazyAction(t)})}retryPendingLazyAction(e){let t=this.pendingLazyAction;return Ys({canReload:()=>e()&&this.pendingLazyAction===t&&(!t||xm(t))})}dispatchLazyShellEvent({eventType:e,detail:t}){return window.dispatchEvent(new CustomEvent(e,{cancelable:!0,detail:t}))}clearPendingLazyAction(e){JSON.stringify(this.pendingLazyAction)===JSON.stringify(e)&&(Sm(),this.pendingLazyAction=null)}cancelPendingLazyAction(){let e=this.pendingLazyAction;e&&this.clearPendingLazyAction(e)}abandonPendingLazyActionForContext(){this.pendingLazyAction=null,Sm(),this.host.lazyCustomElements.abandon()}preservePendingLazyActionForReload(){this.host.lazyCustomElements.abandon()}nativeNavCollapsed(){let e=this.host,t=Mm();return e.onboardingMode||t||$m(e.routeState.routeId)&&!t||!e.navDrawerOpen&&!e.desktopNavigationExpanded&&(e.context?.navigation.snapshot.navCollapsed??!1)}}})))()}function nh(e){return e===`theme`||e===`themeMode`||e===`accent`||e===`fontUi`||e===`fontChat`}function rh(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function ih(e,t,n){let r=(n,r)=>{rh(t[n],r)||(e[n]=r)};for(let e of Object.keys(n))r(e,n[e])}function ah(e){let t=P(P(P(e)?.ui)?.prefs);if(!t)return{};let n={};for(let e of fh){if(X[e].configSync===!1)continue;let r=X[e].extract(t[e]);r!==void 0&&(n[e]=r)}return n}function oh(e,t,n,r,i,a){let o=X[t],s=o.local(r),c=o.reset?.(r),l=c?o.local({...r,...c}):void 0,u=e=>{let t=!rh(s,e);return{overridden:t,provenance:t||o.configSync===!1&&i===!1?`device-local`:`default`,resetValue:e,value:s}},d=P(P(P(e)?.ui)?.prefs),f=o.configSync!==!1&&d&&Object.hasOwn(d,t)?o.extract(d[t]):void 0,p=a?.[t]??void 0,m=p??f,h=p!==void 0,g=a!=null&&nh(t)?f??l:l,_=m!==void 0&&(!o.canApply||o.canApply(m,r)),v=_?m:l;if(n&&t in n){if(i===!1)return{...u(v),provenance:`device-local`};let e=n[t];return e===null?{...u(g),provenance:`pending`}:{overridden:!0,provenance:`pending`,resetValue:g,value:e}}return(!d||!Object.hasOwn(d,t))&&!h||m===void 0?u(l):_?rh(s,m)?{overridden:!0,provenance:h?`profile`:`synced`,resetValue:g,value:m}:u(m):i===!1?u(l):{overridden:!0,provenance:h?`profile`:`synced`,resetValue:g,value:s}}function sh(e,t){let n={};for(let r of fh){let i=X[r],a=e[r];if(a!==void 0){if(a===null){let e=i.clearable?i.reset?.(t):void 0;e&&ih(n,t,e);continue}rh(a,i.local(t))||i.canApply&&!i.canApply(a,t)||(n[r]=a)}}return Object.keys(n).length>0?n:null}var ch,lh,uh,dh,X,fh;function ph(){return(ph=e((()=>{we(),Bo(),H(),bd(),lu(),ch=new Set([...oe,`custom`]),lh=new Set([`light`,`dark`,`system`]),uh=e=>e,dh=e=>uh({configSync:!1,extract:Ql,local:t=>Ql(t[e]),write:t=>({[e]:t}),clearable:!0,reset:()=>({[e]:void 0})}),X={theme:uh({extract:e=>ch.has(e)?e:void 0,local:e=>e.theme,write:e=>({theme:e??J.theme}),clearable:!0,reset:()=>({theme:J.theme}),canApply:(e,t)=>e!==`custom`||!!t.customTheme}),themeMode:uh({extract:e=>lh.has(e)?e:void 0,local:e=>e.themeMode,write:e=>({themeMode:e??J.themeMode}),clearable:!0,reset:()=>({themeMode:J.themeMode})}),accent:uh({extract:Eu,local:e=>Eu(e.accent),write:e=>({accent:e}),clearable:!0,reset:()=>({accent:void 0})}),fontUi:dh(`fontUi`),fontChat:dh(`fontChat`),locale:uh({extract:e=>typeof e==`string`&&Pi(e)?e:void 0,local:e=>e.locale,write:e=>({locale:e}),clearable:!0,reset:()=>({locale:void 0})}),chatShowThinking:uh({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatShowThinking}),chatShowToolCalls:uh({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatShowToolCalls}),chatPersistCommentary:uh({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatPersistCommentary!==!1}),chatSendShortcut:uh({extract:e=>e===`enter`||e===`modifier-enter`?dd(e):void 0,local:e=>dd(e.chatSendShortcut),write:e=>({chatSendShortcut:e}),clearable:!0,reset:()=>({chatSendShortcut:void 0})}),chatFollowUpMode:uh({extract:e=>Tu(e),local:e=>Tu(e.chatFollowUpMode),write:e=>({chatFollowUpMode:e}),clearable:!0,reset:()=>({chatFollowUpMode:void 0})}),sidebarEntries:uh({extract:e=>lo(e)??void 0,local:e=>e.sidebarEntries})},fh=Object.keys(X)})))()}function mh(e,t){return t?`${e}:profile:${t}`:e}function hh(e,t){return t&&bh?.profileId===t&&bh.scope===e?bh.prefs:null}function gh(e){return bh?.scope===e?bh.profileId:null}function _h(){bh=null,xh+=1}async function vh(e,t,n){let r=++xh,i=await e.request(`users.prefs.get`,{keys:Object.values(Pe)});if(r!==xh||i.status!==`ok`)return!1;let a={};for(let[e,t]of Object.entries(Pe)){if(!nh(e))continue;let n=ve(t,i.entries[t]);n!==void 0&&Object.assign(a,{[e]:n})}return bh={profileId:t,scope:n,prefs:a},!0}async function yh(e,t,n){if(!e||!n)return{ok:!1,reason:`unavailable`,error:`Profile preferences are unavailable.`};let r=Object.fromEntries(Object.entries(t).flatMap(([e,t])=>nh(e)?[[Pe[e],t]]:[]));try{let t=await e.request(`users.prefs.set`,{entries:r});return t.status===`ok`?{ok:!0,value:t,refresh:{ok:!0}}:{ok:!1,reason:`rejected`,error:`Profile preferences are unavailable.`}}catch(e){return{ok:!1,reason:e instanceof ns&&(e.gatewayCode===`INVALID_REQUEST`||e.gatewayCode===`FORBIDDEN`)?`rejected`:`error`,error:e instanceof Error?e.message:String(e)}}}var bh,xh;function Sh(){return(Sh=e((()=>{we(),ms(),ph(),bh=null,xh=0})))()}function Ch(e,t){try{let n=globalThis.localStorage;return n?{available:!0,value:n.getItem(`${e}:${t}`)}:{available:!1,value:null}}catch{return{available:!1,value:null}}}function wh(e,t){return Ch(e,t).value}function Th(e,t,n){try{let r=globalThis.localStorage;if(!r)return!1;let i=`${e}:${t}`;return n===null?r.removeItem(i):r.setItem(i,n),!0}catch{return!1}}function Eh(e){try{let t=P(JSON.parse(e??`null`));return t&&Object.keys(t).length?t:null}catch{return null}}function Dh(e,t){let n=Ch(e,t);return{available:n.available,prefs:Eh(n.value)}}function Oh(e){let t=Eh(wh(Mh,e));if(!t)return new Set;let n=Object.keys(t).filter(e=>Object.hasOwn(X,e));return new Set(n)}function kh(e,t){Th(Mh,e,t.size?JSON.stringify(Object.fromEntries([...t].map(e=>[e,!0]))):null)}var Ah,jh,Mh;function Nh(){return(Nh=e((()=>{ph(),Ah=`openclaw.control.serverPrefs.v1`,jh=`openclaw.control.serverPrefs.pending.v1`,Mh=`openclaw.control.serverPrefs.retained-local.v1`})))()}function Ph(e,t,n=``,r=Uu(),i={}){let a=mh(n,i.profileId);return oh(e,t,a===Z?Q:Eh(wh(jh,a)),r,i.canSync,hh(n,i.profileId))}function Fh(e,t){let n={};for(let r of fh){if(og.delete(r))continue;if(ag.delete(r)){n[r]=null;continue}let i=X[r],a=i.local(e),o=i.local(t);if(!rh(a,o)){if(o===void 0){i.clearable&&(n[r]=null);continue}n[r]=o}}return Object.keys(n).length>0?n:null}function Ih(){_g!==null&&(clearTimeout(_g),_g=null),vg=0}function Lh(e,t,n){let r=Oh(e);for(let e of t)n?r.add(e):r.delete(e);kh(e,r),n&&e===yg&&(bg=null)}function Rh(e,t=!1){if(!t&&e===Z)return;Z=e;let n=Dh(jh,e);Q=n.prefs,cg=new Set(n.available&&n.prefs?Object.keys(n.prefs):[])}function zh(e){Th(`openclaw.control.serverPrefs.pending.v1`,Z,e?JSON.stringify(e):null)?cg=new Set(Q?Object.keys(Q):[]):cg.clear()}function Bh(e,t){e===Z&&Uh();let n=e===Z?Q:null,r={...Eh(wh(jh,e)),...n};for(let e of t)delete r[e];let i=Object.keys(r).length?r:null;if(e===Z){Q=i,zh(i);return}Th(jh,e,i?JSON.stringify(i):null)}function Vh(){let e={...Eh(wh(`openclaw.control.serverPrefs.pending.v1`,Z))??{},...Q};zh(Object.keys(e).length?e:null)}function Hh(e){let t={...Eh(wh(jh,Z))};for(let n of Object.keys(e))rh(t[n],e[n])&&delete t[n];let n={...t,...Q};zh(Object.keys(n).length?n:null)}function Uh(){if(!Q||cg.size===0)return;let e=Dh(jh,Z);if(!e.available)return;let t=e.prefs??{};for(let e of cg){if(!Object.hasOwn(t,e)){delete Q[e],cg.delete(e);continue}let n=t[e];rh(Q[e],n)||(Q[e]=n)}Object.keys(Q).length||(Q=null)}function Wh(e){let t=Q;return!!(t&&Object.keys(e).every(n=>Object.hasOwn(t,n)&&rh(t[n],e[n])))}function Gh(){Ih(),sg=mg=hg=!1,Z=``,Q=lg=null,cg.clear(),ug=``,dg=null,fg=!1,yg=``,bg=null,_h(),ag.clear(),og.clear()}function Kh(e,t,n=Z){let r=X[e],i=nh(e)?gh(n):null,a=mh(n,i),o=r.reset;if(!o)throw Error(`Server UI preference is not resettable: ${e}`);if(t?.provenance===`device-local`){let n=r.write;if(!n)throw Error(`Server UI preference cannot restore a retained local value: ${e}`);return Bh(a,[e]),Lh(a,[e],!1),og.add(e),Ku(n(t.resetValue))}if(ag.add(e),i&&t){let e=r.write;if(e)return Ku(e(t.resetValue))}return Ku(o(Uu()))}function qh(e,t){let n=t.scope??``,r=mh(n,t.profileId);if(r===yg&&e===bg)return!1;let i=yg!==``&&r!==yg,a=()=>{yg=r,bg=e},o=r===Z?Q:Eh(wh(jh,r)),s=Oh(r),c={...ah(e),...hh(n,t.profileId)},l=JSON.stringify(c),u=wh(Ah,r);if(!i&&l===u)return s.size&&Lh(r,[...s],!1),a(),!1;let d=Eh(u)??{},f={};for(let e of Object.keys(c))!(o&&e in o)&&!s.has(e)&&(i||u===null||!rh(c[e],d[e]))&&(f[e]=c[e]);for(let e of Object.keys(d))!(e in c)&&!(o&&e in o)&&!s.has(e)&&X[e]?.clearable&&(f[e]=null);if(i)for(let e of fh)nh(e)&&!(e in c)&&!(o&&e in o)&&!s.has(e)&&X[e].clearable&&(f[e]=null);Th(Ah,r,l),s.size&&Lh(r,[...s],!1),a(),Object.hasOwn(f,`theme`)&&t.onThemeChanged?.(f.theme??null);let p=sh(f,Uu());if(!p)return!1;sg=!0;try{Ku(p)}finally{sg=!1}return t.onApplied(p),!0}async function Jh(e){let t=e.scope??e.client.gatewayUrl;return await vh(e.client,e.profileId,t)?(bg=null,qh(e.configObject,{...e,scope:t})):!1}function Yh(){return sg}function Xh(e,t){let n=t.profileId??t.profile?.selfUser?.id??null,r=mh(e.state.client?.gatewayUrl??``,n);if(fg=t.canWrite??bs(t.profile?.hello?.auth??null),lg===e&&ug===r&&dg===n)return;Uh();let i=Z===``?{...Eh(wh(jh,``)),...Q}:null;Ih(),gg+=1,lg=e,ug=r,dg=n,mg=!1,Rh(r,!0),r&&i&&Object.keys(i).length&&(Q={...Q,...i},Vh(),Th(jh,``,null))}function Zh(e){if(Q){for(let t of Object.keys(e))rh(Q[t],e[t])&&(delete Q[t],cg.delete(t));Object.keys(Q).length||(Q=null)}}function Qh(e,t){_g!==null||vg>=ig||(vg+=1,_g=setTimeout(()=>{_g=null,lg===e&&gg===t&&Q&&eg(e)},rg))}async function $h(e,t){for(;Q;){if(lg!==e||gg!==t||(Uh(),!Q))return;let n=fh.filter(e=>Q?.[e]!==void 0&&X[e].configSync===!1&&!(dg&&fg));if(n.length){if(!e.state.connected)return;Bh(Z,n),Lh(Z,n,!0),pg?.({needsRefresh:!1,retainedLocal:!0});continue}if(dg&&Q.theme===`custom`){Bh(Z,[`theme`]),Lh(Z,[`theme`],!0);continue}let r={};if(dg&&fg)for(let e of fh)nh(e)&&Object.hasOwn(Q,e)&&Object.assign(r,{[e]:Q[e]});let i=!!(r&&Object.keys(r).length),a=i?r:{...Q},o=pg;for(let n=0;n<2;n+=1){if(lg!==e||gg!==t)return;let r=i?await yh(e.state.client,a,e.state.connected&&fg&&Wh(a)):await e.runExternalMutation(e=>e.request(`config.patch`,{raw:JSON.stringify({ui:{prefs:a}}),...a.sidebarEntries===void 0?{}:{replacePaths:[`ui.prefs.sidebarEntries`]},note:`control-ui prefs sync`}),{waitForWritesResumed:!0,canDispatch:()=>e.canPatch!==!1&&(Uh(),Wh(a)?!0:(hg=!!Q,!1)),dispatchError:`Access changed before preferences could sync.`});if(lg!==e||gg!==t)return;if(r.ok){Zh(a);let n={...Eh(wh(`openclaw.control.serverPrefs.v1`,Z))??{},...a},s=hh(e.state.client?.gatewayUrl??``,dg);if(i&&s){let t=ah(e.state.configSnapshot?.config);for(let e of fh)Object.hasOwn(a,e)&&(a[e]===null?(delete s[e],t[e]===void 0?delete n[e]:Object.assign(n,{[e]:t[e]})):Object.assign(s,{[e]:a[e]}));bg=null}if(Th(Ah,Z,JSON.stringify(n)),Hh(a),Ih(),lg!==e||gg!==t||(r.refresh.ok&&o&&yg===Z&&(bg=null),o?.({needsRefresh:!r.refresh.ok}),lg!==e||gg!==t))return;break}if(r.reason===`conflict`&&n===0){await new Promise(e=>{setTimeout(e,250)});continue}if(r.reason===`conflict`){Qh(e,t);return}if(r.reason===`error`||r.reason===`unavailable`||r.reason===`suspended`)return;Zh(a),Hh(a),o?.({needsRefresh:!1,retainedLocal:!0});return}}}function eg(e){if(mg){hg=!0;return}if(!Q||e.state.connected&&e.canPatch===!1&&!(dg&&fg&&Object.keys(Q).some(nh)))return;mg=!0;let t=gg;$h(e,t).catch(()=>void 0).finally(()=>{lg===e&&gg===t&&(mg=!1,hg&&(hg=!1,eg(e)))})}function tg(e,t,n={}){Xh(e,n),Ih(),pg=n.afterCommit;let r=fh.filter(e=>Object.hasOwn(t,e)),i=e.state.connected?r.filter(n=>X[n].configSync===!1&&!dg?!0:dg&&nh(n)?!fg||n===`theme`&&t.theme===`custom`:e.canPatch===!1):[];if(i.length&&(Bh(Z,i),Lh(Z,i,!0),n.afterCommit?.({needsRefresh:!1,retainedLocal:!0}),i.length===r.length))return;let a=i.length?Object.fromEntries(Object.entries(t).filter(([e])=>!i.some(t=>t===e))):t;Uh(),Q={...Q,...a},Vh(),eg(e)}function ng(e,t={}){Xh(e,t),Ih(),gg+=1,mg=hg=!1,pg=t.afterCommit,eg(e)}var rg,ig,ag,og,sg,Z,Q,cg,lg,ug,dg,fg,pg,mg,hg,gg,_g,vg,yg,bg;function xg(){return(xg=e((()=>{Ts(),Sh(),ph(),Nh(),bd(),rg=1e3,ig=5,ag=new Set,og=new Set,sg=!1,Z=``,Q=null,cg=new Set,lg=null,ug=``,dg=null,fg=!1,mg=!1,hg=!1,gg=0,_g=null,vg=0,yg=``,bg=null})))()}function Sg(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[];for(let t of e){let e=n.get(t.id);e?JSON.stringify(e)!==JSON.stringify(t)&&(r.push(t.id),i.push(t.id)):r.push(t.id)}return{invalidatedIds:r,changedIds:i}}var Cg,wg;function Tg(){return(Tg=e((()=>{oa(),H(),Ts(),xg(),C(),Cg=100,wg=class{constructor(e){this.host=e,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null}reconcileServerUiPrefs(e){let t=e.state.configSnapshot,n=this.host.context;if(!t?.config||!n||n.runtimeConfig!==e)return;let r=n.gateway.connection.gatewayUrl;qh(t.config,{scope:r,profileId:n.gateway.snapshot?.selfUser?.id,onThemeChanged:e=>n.theme.recordServerSelection(e,r),onApplied:e=>{e.sidebarEntries!==void 0&&n.navigation.update({sidebarEntries:e.sidebarEntries}),n.theme.refresh()}}),this.refreshProfileAppearancePrefs(n);let i=Ph(t.config,`locale`,r),a=JSON.stringify([r,i.overridden,i.value]);if(a!==this.host.lastLocalePrefSignature){if(this.host.lastLocalePrefSignature=a,i.overridden&&Pi(i.value)){yi.setLocale(i.value);return}yi.useSystemLocale()}}reconcileCommittedServerUiPrefs(e,t,n=!1){if(this.host.context?.runtimeConfig===e){if(t){e.refresh();return}this.reconcileServerUiPrefs(e),n&&this.host.context?.theme.refresh()}}handleGatewayEvent(e){if(this.host.sidebarWorkboardRuntime?.handleGatewayEvent(e.event),e.event===`sessions.changed`){let e=this.host.context;e&&this.host.recoverDeletedActiveSession(e.sessions.state);return}if(e.event===`session.observer`){let t=this.host.context;if(t){this.host.criticalNoticeRuntime??=b(()=>import(`./critical-observer-notice.runtime-D52VYdrT.js`),__vite__mapDeps([74,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url);let n=e.payload;this.host.criticalNoticeRuntime.then(e=>e.handleCriticalObserverDigest({payload:n,selectedSessionKey:this.host.activeSessionKey,sessionHost:this.host.storedOutboxScopeHost(t),sessions:t.sessions.state.result?.sessions??[],onOpen:(e,t)=>this.host.selectChatSession(e,t)}))}return}if(e.event===`config.changed`){let e=this.host.context?.runtimeConfig;e&&!e.state.configFormDirty&&e.refresh(),this.scheduleAgentRosterRefresh();return}if(e.event===`users.prefs.changed`){let t=this.host.context,n=t?.gateway.snapshot.selfUser?.id,r=e.payload;t&&n&&r&&typeof r==`object`&&`profileId`in r&&r.profileId===n&&this.refreshProfileAppearancePrefs(t,!0);return}if(e.event!==`ui.command`||!e.payload)return;let t=this.host.context;if(!t)return;let n=e.payload,{command:r}=n;if(r){if(r.kind===`sidebar`){this.host.desktopNavigationExpanded=!1,t.navigation.update({navCollapsed:!r.visible});return}if(r.kind===`panel`){window.dispatchEvent(new CustomEvent(r.panel===`terminal`?ki:Bi,{detail:{open:r.open,...r.dock?{dock:r.dock}:{},...r.panel===`terminal`&&r.terminalSessionId?{terminalSessionId:r.terminalSessionId}:{}}}));return}window.dispatchEvent(new CustomEvent(`openclaw:ui-command`,{detail:n,cancelable:!0}))&&(r.kind===`navigate`||r.kind===`split`)&&this.host.selectChatSession(r.sessionKey)}}scheduleAgentRosterRefresh(){this.host.agentRosterRefreshTimer!==null&&globalThis.clearTimeout(this.host.agentRosterRefreshTimer),this.host.agentRosterRefreshTimer=globalThis.setTimeout(()=>{this.host.agentRosterRefreshTimer=null,this.refreshAgentRoster()},Cg)}async refreshAgentRoster(){let e=this.host.context;if(!e)return;let t=e.agents.state.agentsList,n=e.agentSelection.state.selectedId,r=await e.agents.refreshList();if(!r||this.host.context!==e)return;let i=Sg(t?.agents??[],r.agents);i.invalidatedIds.length>0&&(e.agents.invalidateFiles(i.invalidatedIds),e.agentIdentity.invalidate(i.invalidatedIds)),i.changedIds.length>0&&e.agentIdentity.ensure(i.changedIds);let a=new Set(r.agents.map(e=>e.id));n&&e.agentSelection.state.selectedId===n&&r.agents.length>0&&!a.has(n)&&e.agentSelection.set(r.defaultId)}synchronizeGateway(e){let t=this.host.previousGatewayPhase;this.host.previousGatewayPhase=e.phase,this.updateGatewaySessionKey(e),this.ensureAgentsList(e),this.ensureRuntimeConfig(e);let n=this.host.context;n&&this.refreshProfileAppearancePrefs(n),t!==`connected`&&e.phase===`connected`&&yi.retryPendingLocale(),this.host.syncSidebarWorkboard(),e.phase===`connected`&&this.host.outboxStoreImport.load().catch(()=>void 0)}ensureRuntimeConfig(e,t=this.host.context?.runtimeConfig){if(e.phase!==`connected`||!e.client||!t){this.host.runtimeConfigClient=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null;return}let n=e.selfUser?.id??null;(this.host.runtimeConfigClient!==e.client||this.host.runtimeConfigSource!==t||this.runtimeConfigProfileId!==n)&&(this.host.runtimeConfigClient=e.client,this.host.runtimeConfigSource=t,this.runtimeConfigProfileId=n,ng(t,{profileId:n,canWrite:bs(e.hello?.auth??null),afterCommit:({needsRefresh:e,retainedLocal:n})=>this.reconcileCommittedServerUiPrefs(t,e,n)}),t.ensureLoaded())}ensureAgentsList(e,t=this.host.context?.agents){if(e.phase!==`connected`||!e.client){this.host.agentsListClient=null;return}let n=this.host.routeState.routeId;!t||!n||t.state.agentsList||(this.host.agentsListClient!==e.client||this.host.agentsListSource!==t)&&(this.host.agentsListClient=e.client,this.host.agentsListSource=t,t.ensureList())}updateGatewaySessionKey(e){let t=e.sessionKey.trim();(e.client!==this.host.sessionKeyClient||t!==this.host.activeSessionKey)&&(this.host.sessionKeyClient=e.client,t&&(this.host.activeSessionKey=t))}refreshProfileAppearancePrefs(e,t=!1){let n=e.gateway.snapshot,r=n?.selfUser?.id;if(!r)return;let i=n.client,a=e.runtimeConfig.state.configSnapshot?.config;if(n.phase!==`connected`||!i||!a)return;let o=this.profileAppearanceSource;if(!t&&o?.client===i&&o.profileId===r)return;let s={client:i,profileId:r};this.profileAppearanceSource=s;let c=e.gateway.connection.gatewayUrl,l=()=>this.host.context===e&&e.gateway.snapshot.client===i&&e.gateway.snapshot.selfUser?.id===r&&this.profileAppearanceSource===s;Jh({client:i,profileId:r,configObject:a,scope:c,onApplied:()=>{l()&&e.theme.refresh()},onThemeChanged:t=>{l()&&e.theme.recordServerSelection(t,c)}}).then(t=>{!t&&l()&&e.theme.refresh()}).catch(e=>{l()&&console.error(`[gateway] profile appearance preference refresh failed:`,e)})}reset(){this.host.criticalNoticeRuntime?.then(e=>e.resetCriticalObserverTracker()),this.host.agentsListClient=null,this.host.agentsListSource=null,this.host.sessionKeyClient=null,this.host.runtimeConfigClient=null,this.host.runtimeConfigSource=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null,this.host.previousGatewayPhase=null,this.host.agentRosterRefreshTimer!==null&&(globalThis.clearTimeout(this.host.agentRosterRefreshTimer),this.host.agentRosterRefreshTimer=null),Gh()}dispose(){this.host.lastLocalePrefSignature=null,this.reset()}}})))()}function Eg(e){try{return e??localStorage}catch{return null}}function Dg(e,t=Dm()){let n=t?Eg(e):null;if(!n)return null;try{let e=n.getItem(Mg);if(e===null)return null;let t=JSON.parse(e);if(typeof t.routeId==`string`&&ya(t.routeId)&&typeof t.pathname==`string`&&typeof t.search==`string`)return{routeId:t.routeId,pathname:t.pathname,search:t.search};n.removeItem(Mg)}catch{try{n.removeItem(Mg)}catch{}}return null}function Og(e){let t=new URLSearchParams(e);for(let e of Ng)t.delete(e);let n=t.toString();return n?`?${n}`:``}function kg(e,t,n,r,i=Dm()){let a=i?Eg(r):null;if(a)try{a.setItem(Mg,JSON.stringify({routeId:e,pathname:t,search:Og(n)}))}catch{}}function Ag(e,t,n,r){return r&&e===`chat`&&t.endsWith(`/chat`)&&n===``}function jg(e,t,n,r,i=Dm()){if(!Ag(e,t,n,i))return null;let a=Dg(r,i);return!a||a.routeId===e&&a.pathname===t&&a.search===n?null:a}var Mg,Ng;function Pg(){return(Pg=e((()=>{Ps(),Am(),Mg=`openclaw.native.lastRoute`,Ng=[`draft`]})))()}var Fg;function Ig(){return(Ig=e((()=>{Bo(),G(),Ps(),at(),Ln(),qc(),Pg(),Fg=class{constructor(e){this.host=e}selectChatSession(e,t){let n=this.host.context;if(!n)return;Gc({selection:n.agentSelection,gateway:n.gateway,sessionKey:e,agentId:t});let r=Ke(n,e,t);this.navigate(r,cr({context:n,face:r,sessionKey:e,...t?{agentId:t}:{},preferenceDerivedFace:!0}).options)}chatNavigationOptions(e,t){let n=this.host.activeSessionKey.trim(),r=this.host.context;return t??(n&&r?cr({context:r,face:e,sessionKey:n}).options:void 0)}navigate(e,t){let n=this.host.context;!n||!ya(e)||(this.host.closeNavDrawer({restoreFocus:!0}),n.navigate(e,ja(e)?this.chatNavigationOptions(e,t):t))}replaceChatWithCurrentSession(){let e=this.host.context,t=this.host.activeSessionKey.trim();if(!e)return!0;if(!ot(t)&&e.gateway.snapshot.phase!==`connected`)return!1;let n=this.host.routeState.routeId===`dashboard`?`dashboard`:`chat`,r=e.sessions.deletionState(t),i=ct(e,t),a=this.host.routeState.location?.pathname,s=!a||a===cr({context:e,face:n,sessionKey:t}).options.pathname,c=ot(t)?.agentId,l=e.agents.state.agentsList?.agents,u=c&&(!l||l.some(e=>o(e.id)===c))?c:Ht(e),d=!r&&(i?.key||!s)?t:tr({agentId:u,mainKey:lr({agentsList:e.agents.state.agentsList,hello:e.gateway.snapshot.hello})});return r&&d===t?!0:(d!==t&&(this.host.activeSessionKey=d,Gc({selection:e.agentSelection,gateway:e.gateway,sessionKey:d})),e.replace(n,cr({context:e,face:n,sessionKey:d}).options),!0)}recoverDeletedActiveSession(e){let t=this.host.context,n=this.host.routeState.routeId,r=this.host.activeSessionKey.trim();!t||!n||!ja(n)||!r||t.sessions.deletionState(r)&&this.replaceChatWithCurrentSession()}updateRouteState(e){this.host.routeState=e,e.routeId!==void 0&&(this.host.lastConcreteRouteId===`custodian`&&e.routeId!==`custodian`&&(this.host.custodianMinimizeRequestId+=1),this.host.lastConcreteRouteId=e.routeId);let t=e.committedRouteId,n=e.committedLocation?.pathname??``,r=e.committedLocation?.search??``,i=this.host.context;if(t&&i){let a=e.routeId!==t||(e.location?.pathname??``)!==n||(e.location?.search??``)!==r;if(!this.host.didConsiderNativeRouteRestore){this.host.didConsiderNativeRouteRestore=!0;let e=a?null:jg(t,n,r);if(e){i.replace(e.routeId,{pathname:e.pathname,search:e.search});return}}if(!a){let a=e.committedSessionKey;if(a!==void 0&&i.sessions.deletionState(a)){this.replaceChatWithCurrentSession();return}kg(t,n,r),a&&(this.host.activeSessionKey=a,Gc({selection:i.agentSelection,gateway:i.gateway,sessionKey:a}))}}let a=this.host.context;a&&this.host.ensureAgentsList(a.gateway.snapshot),e.routeId&&!go(e.routeId)&&(this.host.settingsSearchQuery=``,this.host.lastWorkspaceLocation={routeId:e.routeId,pathname:e.location?.pathname??``,search:e.location?.search??``,hash:e.location?.hash??``})}newSessionRouteAgentId(){return this.host.routeState.routeId===`new-session`?new URLSearchParams(this.host.routeState.location?.search??``).get(`agent`)?.trim()??``:``}openNewSession(e,t){this.navigate(`new-session`,{search:ir(e,t)})}exitSettings(){let e=this.host.lastWorkspaceLocation;if(e){let{routeId:t,...n}=e;this.navigate(t,n);return}this.navigate(`chat`)}}})))()}function Lg(e){let t=U(`palette.placeholder`);return B`<openclaw-modal-dialog
|
|
class="cmd-palette-overlay palette"
|
|
label=${t}
|
|
style="--openclaw-modal-width: min(640px, calc(100vw - 32px));"
|
|
@modal-cancel=${e}
|
|
>
|
|
<div class="cmd-palette" role="status" aria-label=${U(`common.loading`)}>
|
|
<input class="cmd-palette__input" disabled placeholder=${t} />
|
|
<div class="cmd-palette__empty">${U(`common.loading`)}</div>
|
|
</div>
|
|
</openclaw-modal-dialog>`}function Rg(){return(Rg=e((()=>{ui(),H()})))()}function zg(e,t){if(!t.open)return z;let n=e.devicePairSetupRenderer;return n?n(t):e.devicePairSetupLoadFailed?Vg(e,t):(e.loadDevicePairSetupRenderer(),Bg(t))}function Bg(e){let t=U(`devices.pairing.title`),n=U(`common.loading`);return B`<openclaw-modal-dialog
|
|
label=${t}
|
|
description=${n}
|
|
@modal-cancel=${e.onClose}
|
|
>
|
|
<section class="device-pair-setup" aria-busy="true">
|
|
<header class="device-pair-setup__header">
|
|
<div>
|
|
<h2>${t}</h2>
|
|
<p role="status">${n}</p>
|
|
</div>
|
|
</header>
|
|
<footer class="device-pair-setup__footer">
|
|
<button class="btn btn--ghost" type="button" @click=${e.onClose}>
|
|
${U(`common.close`)}
|
|
</button>
|
|
</footer>
|
|
</section>
|
|
</openclaw-modal-dialog>`}function Vg(e,t){let n=U(`devices.pairing.title`),r=U(`devices.pairing.loadFailed`);return B`<openclaw-modal-dialog
|
|
label=${n}
|
|
description=${r}
|
|
@modal-cancel=${t.onClose}
|
|
>
|
|
<section class="device-pair-setup">
|
|
<header class="device-pair-setup__header">
|
|
<div>
|
|
<h2>${n}</h2>
|
|
<p>${r}</p>
|
|
</div>
|
|
</header>
|
|
<footer class="device-pair-setup__footer">
|
|
<button
|
|
class="btn btn--primary"
|
|
type="button"
|
|
@click=${()=>e.retryDevicePairSetupRenderer()}
|
|
>
|
|
${U(`common.retry`)}
|
|
</button>
|
|
<button class="btn btn--ghost" type="button" @click=${t.onClose}>
|
|
${U(`common.close`)}
|
|
</button>
|
|
</footer>
|
|
</section>
|
|
</openclaw-modal-dialog>`}function Hg(e){let t=e.context,n=e.runtime;if(!t||!n)return z;if(e.routeState.routeId===void 0)return B`<main class="connect-splash" role="status" aria-label=${U(`common.loading`)}>
|
|
<openclaw-mascot mood="thinking" .size=${120}></openclaw-mascot>
|
|
</main>`;let r=t.gateway.snapshot,i=t.config.current,a=r.phase===`connected`,s=K(r),c=fa(r,`update.run`,`operator.admin`),l=c&&fa(r,`update.hold`,`operator.admin`),u=e.storedOutboxScopeHost(t),d=e.outboxStoreRuntime,f=d?.summarizeStoredChatOutboxes(u)??null,p=d?e=>{let t=d.resolveStoredChatOutboxScope(u,e),n=d.storedChatOutboxScopeKey(t);return f?.attentionCountsByScope.get(n)??0}:()=>0,m=d?e=>{let t=d.resolveStoredChatOutboxScope(u,e);return f?.draftScopes.has(d.storedChatOutboxScopeKey(t))===!0}:Ug,h=t.navigation.snapshot,g=t.overlays.snapshot,_=g.updateRunning||g.updateReconciliationPending,v=Xf(t),y=ei(r,i.terminalEnabled??!1),b=Up(r),x=Wp(r),S=fa(r,`openclaw.chat`,`operator.admin`),C=e.lazyCustomElements.visibleState,w=e.routeState.routeId??`chat`,T=ja(w),E=r.phase===`reload-required`||!a&&w!==`chat`&&w!==`new-session`&&w!==`appearance`,ee=w===`plugin`?Xt(e.routeState.location?.search??``):null,te=ee?Tn(ee):``,D=go(w)&&!e.onboardingMode,O=t.runtimeConfig.state,k=e.onboardingMode,A=k&&w!==`custodian`;e.lazyCustomElements.requestWhileActive(e.onboardingMemoryImportElement,A);let j=e.navDrawerOpen&&!k,M=Mm(),ne=Dm();ne&&!k&&e.lazyCustomElements.preload(Oc,{reportError:!0});let re=Pm({mobileNavLayout:M,routeId:w,onboarding:k}),N=h.navCollapsed&&!e.desktopNavigationExpanded&&!j&&!D,P=Jm({onboarding:k,navCollapsed:N,navDrawerOpen:j,mobileNavLayout:M});Ym({navigationSurfaceHidden:P,mobileNavLayout:M,onboarding:k,settingsTakeover:D,compact:re})&&e.lazyCustomElements.preload(kc,{reportError:!0});let ie=Math.max(globalThis.innerWidth||0,400),ae=e.newSessionRouteAgentId(),oe=ae?o(ae):null,F=oe!==null&&t.agents.state.agentsList?.agents.some(e=>o(e.id)===oe)===!0?oe:o(t.agentSelection.state.selectedId??r.assistantAgentId),se=mn(r,{method:`sessions.create`,params:{}}),ce=(n,r)=>{mn(t.gateway.snapshot,{method:`sessions.create`,params:{}}).allowed&&e.openNewSession(n,r)},le=t.theme.settings,ue=T||w===`new-session`,de=w===`custodian`;D||Object.assign(e.navigationSidebar,{basePath:t.basePath,activeRouteId:w,activePluginTabId:te,enabledRouteIds:e.enabledRouteIds(),activeWorkboardBoardId:Na(e.routeState.location?.pathname??``,t.basePath)??``,sessionKey:e.activeSessionKey,connected:a,offline:r.offlineStable,restartPending:r.restartPending===!0,queuedOutboxCount:f?.total??0,lastError:r.lastError,outboxAttentionCountForSession:p,hasSessionDraft:m,terminalAvailable:y,catalogOpenTarget:hd(le.catalogOpenTarget),canPairDevice:a&&(s.canAdmin||s.canPair),preferencesBrowserOnly:a&&t.runtimeConfig.canPatch===!1,sidebarEntries:h.sidebarEntries,workboardBoards:e.sidebarWorkboardSnapshot.boards,workboardBoardsReady:e.sidebarWorkboardSnapshot.ready,workboardRenderers:e.sidebarWorkboardRenderers,sidebarLiveActivity:le.sidebarLiveActivity!==!1,pinnedAgentIds:h.pinnedAgentIds,themeMode:t.theme.mode,lobsterPetVisits:le.lobsterPetVisits!==!1,lobsterPetSounds:le.lobsterPetSounds===!0,gatewayVersion:i.serverVersion??r.hello?.server?.version??null,devGitBranch:i.devGitBranch,watchUpdateProgress:v,onOpenApprovals:()=>e.openApprovals(),onRetryConnect:()=>t.gateway.connect(),onOpenNewSession:ce,onUpdateSidebarEntries:e=>t.navigation.update({sidebarEntries:e}),onPairMobile:()=>void t.overlays.openDevicePairSetup(),onNavigate:(t,n)=>e.navigate(t,n),onPreloadRoute:e=>ya(e)?t.preload(e):Promise.resolve()});let fe=D?Xi(e,{basePath:t.basePath,activeRouteId:w,activePathname:e.routeState.location?.pathname??``,activeSearch:e.routeState.location?.search??``,activeHash:e.routeState.location?.hash??``,offline:r.offlineStable,restartPending:r.restartPending,queuedOutboxCount:f?.total??0,lastError:r.lastError,gatewayVersion:i.serverVersion??r.hello?.server?.version??``,updateAvailable:P?null:g.updateAvailable,updateSchedule:P?null:g.updateSchedule,heldUpdateCampaignId:g.heldUpdateCampaignId,updateBusy:_,updateStatusBanner:g.updateStatusBanner,watchUpdateProgress:v,canUpdate:c,canHoldUpdate:l,onUpdate:()=>void t.overlays.runUpdate(),refreshRequired:!P&&g.controlUiRefreshRequired,onRefresh:()=>e.refreshControlUi(),onHoldUpdate:()=>t.overlays.holdUpdate(),onReviewUpdate:()=>e.navigate(`updates`),searchQuery:e.settingsSearchQuery,searchParams:{query:e.settingsSearchQuery,schema:O.configSchema,value:O.configForm??O.configSnapshot?.config??null,uiHints:O.configUiHints,identityAvailable:!!r.selfUser,basePath:t.basePath,canAdmin:s.canAdmin},onExit:()=>e.exitSettings(),onRetryConnect:()=>t.gateway.connect(),onNavigate:(t,n)=>e.navigate(t,n),onOpenApprovals:()=>e.openApprovals(),onPreload:e=>t.preload(e),onSearchQueryChange:t=>{e.handleSettingsSearchQueryChange(t)},preloadTimers:e.settingsPreloadTimers,saveIndicator:{status:O.configAutoSaveStatus,lastError:O.lastError,needsApply:O.configNeedsApply,applying:O.configApplying,applyDisabled:t.runtimeConfig.canApply===!1||O.configLoading||O.configSaving||O.configFormDirty&&O.configFormMode===`raw`||_,onRetry:()=>void t.runtimeConfig.save(),onReload:()=>void t.runtimeConfig.discardDraft(),onApply:()=>void t.runtimeConfig.apply()},canAdmin:s.canAdmin}):e.navigationSidebar;return B`
|
|
${C?.status===`loading`&&C.element===e.commandPaletteElement?Lg(()=>e.lazyCustomElements.close()):hi(e.lazyCustomElements)}
|
|
${q(e.commandPaletteElement)?B`<openclaw-command-palette
|
|
.onNavigate=${(t,n)=>e.navigate(t,n)}
|
|
.onSelectSession=${t=>e.selectChatSession(t)}
|
|
.onSlashCommand=${t=>e.handleCommandPaletteSlashCommand(t)}
|
|
></openclaw-command-palette>`:z}
|
|
${q(wc)?B`<openclaw-debug-overlay></openclaw-debug-overlay>`:z}
|
|
${q(Ec)?B`<openclaw-keyboard-shortcuts-dialog
|
|
.sendShortcut=${dd(le.chatSendShortcut)}
|
|
></openclaw-keyboard-shortcuts-dialog>`:z}
|
|
<div
|
|
class="shell ${ue?`shell--chat`:``} ${N?`shell--nav-collapsed`:``} ${M?`shell--mobile-nav`:``} ${re?`shell--merged-chat-chrome`:``} ${j?`shell--nav-drawer-open`:``} ${k?`shell--onboarding`:``} ${D?`shell--settings`:``}"
|
|
style=${`--shell-nav-expanded-width: ${h.navWidth}px`}
|
|
@theme-change=${t=>e.handleThemeChange(t)}
|
|
>
|
|
<a class="shell-skip-link" href="#control-ui-main" ?inert=${j}>
|
|
${U(`common.skipToMainContent`)}
|
|
</a>
|
|
${ne&&!k?B`
|
|
<openclaw-macos-titlebar-controls
|
|
?inert=${j}
|
|
.navCollapsed=${e.nativeNavCollapsed()}
|
|
.historyOnly=${D}
|
|
.canGoBack=${e.nativeHistoryState.canGoBack}
|
|
.canGoForward=${e.nativeHistoryState.canGoForward}
|
|
.newSessionDisabledReason=${se.allowed?void 0:se.reason}
|
|
.onToggleSidebar=${()=>e.toggleNavigationSurface()}
|
|
.onOpenPalette=${()=>e.openPalette()}
|
|
.onOpenNewSession=${()=>e.handleNativeNewSession()}
|
|
></openclaw-macos-titlebar-controls>
|
|
`:z}
|
|
<openclaw-app-topbar
|
|
?inert=${j}
|
|
.resourceBasePath=${t.resourceBasePath}
|
|
.environment=${i.environment}
|
|
.navDrawerOpen=${j}
|
|
.onOpenPalette=${()=>e.openPalette()}
|
|
.onToggleDrawer=${t=>e.toggleNavigationSurface(t)}
|
|
></openclaw-app-topbar>
|
|
${!k&&!D&&!M?B`
|
|
<div class="shell-chrome-controls">
|
|
<openclaw-tooltip
|
|
.content=${`${U(N?`nav.expand`:`nav.collapse`)} (${gt(_n.toggleSidebar)})`}
|
|
>
|
|
<button
|
|
type="button"
|
|
class="shell-chrome-controls__button shell-chrome-controls__nav-toggle"
|
|
aria-label=${U(N?`nav.expand`:`nav.collapse`)}
|
|
aria-expanded=${N?`false`:`true`}
|
|
data-env-avatar=${N&&i.environment?i.assistantIdentity.name.charAt(0):z}
|
|
@click=${()=>e.toggleNavigationSurface()}
|
|
>
|
|
${N?Ci.panelLeftOpen:Ci.panelLeftClose}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
${N?Wi({basePath:t.basePath,agentId:F,className:`shell-chrome-controls__button shell-chrome-controls__new-thread`,label:U(`chat.runControls.newSession`),disabledReason:se.allowed?void 0:se.reason,onOpen:ce}):z}
|
|
<openclaw-tooltip
|
|
.content=${`${U(`chat.openCommandPalette`)} (${gt(_n.commandPalette)})`}
|
|
>
|
|
<button
|
|
type="button"
|
|
class="shell-chrome-controls__button shell-chrome-controls__search"
|
|
aria-label=${U(`chat.openCommandPalette`)}
|
|
@click=${()=>e.openPalette()}
|
|
>
|
|
${Ci.search}
|
|
</button>
|
|
</openclaw-tooltip>
|
|
${N&&S?B`<openclaw-tooltip .content=${U(`nav.askOpenClaw`)}>
|
|
<button
|
|
type="button"
|
|
class="shell-chrome-controls__button shell-chrome-controls__custodian"
|
|
aria-label=${U(`nav.askOpenClaw`)}
|
|
@click=${()=>window.dispatchEvent(new CustomEvent(Fi))}
|
|
>
|
|
${Ci.lobster}
|
|
</button>
|
|
</openclaw-tooltip>`:z}
|
|
</div>
|
|
`:z}
|
|
<button
|
|
type="button"
|
|
class="shell-nav-backdrop"
|
|
tabindex="-1"
|
|
aria-hidden="true"
|
|
?inert=${!j}
|
|
@click=${()=>e.closeNavDrawer({restoreFocus:!0})}
|
|
></button>
|
|
<div
|
|
class="shell-nav ${M?`nav-drawer`:``}"
|
|
role=${M?`dialog`:z}
|
|
aria-modal=${M&&j?`true`:z}
|
|
aria-label=${M?U(`palette.categories.navigation`):z}
|
|
aria-hidden=${M&&P?`true`:z}
|
|
tabindex=${M?-1:z}
|
|
?inert=${P}
|
|
>
|
|
${fe}
|
|
</div>
|
|
${!N&&!k&&!D?B`
|
|
<resizable-divider
|
|
class="sidebar-resizer"
|
|
.label=${U(`nav.resize`)}
|
|
.splitRatio=${h.navWidth/ie}
|
|
.minRatio=${240/ie}
|
|
.maxRatio=${400/ie}
|
|
aria-valuetext=${`${h.navWidth} pixels`}
|
|
title=${U(`nav.resize`)}
|
|
@resize=${t=>e.resizeNavigation(t.detail.splitRatio)}
|
|
></resizable-divider>
|
|
`:z}
|
|
<main
|
|
id="control-ui-main"
|
|
class="content ${ue?`content--chat`:``} ${de?`content--custodian`:``} ${w===`workboard`?`content--workboard`:``}"
|
|
.tabIndex=${-1}
|
|
?inert=${E||M&&j}
|
|
>
|
|
${E&&r.phase!==`reload-required`?B`<div class="connection-action-block" role="status" aria-live="polite">
|
|
<span class="connection-action-block__icon" aria-hidden="true"
|
|
>${Ci.globeOff}</span
|
|
>
|
|
<span class="connection-action-block__text">
|
|
${U(D?`connection.settingsChangesUnavailable`:`connection.actionsUnavailable`)}
|
|
</span>
|
|
</div>`:z}
|
|
${Xm({navigationSurfaceHidden:P,mobileNavLayout:M,onboarding:k,settingsTakeover:D,compact:re,updateAvailable:g.updateAvailable,updateSchedule:g.updateSchedule,heldUpdateCampaignId:g.heldUpdateCampaignId,updateBusy:_,statusBanner:g.updateStatusBanner,watchUpdateProgress:v,canUpdate:c,canHoldUpdate:l,onUpdate:()=>void t.overlays.runUpdate(),refreshRequired:g.controlUiRefreshRequired,onRefresh:()=>e.refreshControlUi(),onHoldUpdate:()=>t.overlays.holdUpdate(),onReviewUpdate:()=>e.navigate(`updates`),onNavigate:t=>e.navigate(t),onOpenApprovals:()=>e.openApprovals()})}
|
|
<openclaw-router-outlet
|
|
?inert=${E}
|
|
aria-disabled=${E?`true`:z}
|
|
.router=${n.router}
|
|
.retryContext=${t}
|
|
.onNotFound=${()=>e.replaceChatWithCurrentSession()}
|
|
.notFoundRecoveryReady=${a}
|
|
></openclaw-router-outlet>
|
|
</main>
|
|
<openclaw-terminal-panel
|
|
?inert=${j}
|
|
.client=${a?r.client:null}
|
|
.available=${y}
|
|
.agentId=${F}
|
|
.sessionKey=${T?e.activeSessionKey:null}
|
|
.suppressed=${D}
|
|
.themeMode=${t.theme.resolvedMode}
|
|
.basePath=${t.basePath}
|
|
></openclaw-terminal-panel>
|
|
${T?z:B`
|
|
<openclaw-browser-panel
|
|
?inert=${j}
|
|
data-chat-autotype-exempt
|
|
.client=${a?r.client:null}
|
|
.available=${b}
|
|
.suppressed=${D}
|
|
.resourceBasePath=${t.resourceBasePath}
|
|
.authToken=${rl({hello:r.hello,settings:{token:t.gateway.connection.token},password:t.gateway.connection.password})}
|
|
></openclaw-browser-panel>
|
|
<openclaw-desktop-panel
|
|
?inert=${j}
|
|
data-chat-autotype-exempt
|
|
.client=${a?r.client:null}
|
|
.available=${x}
|
|
.suppressed=${D}
|
|
.basePath=${t.basePath}
|
|
></openclaw-desktop-panel>
|
|
`}
|
|
<openclaw-custodian-panel
|
|
?inert=${j}
|
|
.available=${S}
|
|
.suppressed=${w===`custodian`}
|
|
.minimizeRequestId=${e.custodianMinimizeRequestId}
|
|
></openclaw-custodian-panel>
|
|
${q(e.execApprovalElement)?B`<openclaw-exec-approval
|
|
.props=${{queue:g.approvalQueue,busy:g.approvalBusy,canGrant:g.approvalCanGrant,errors:g.approvalErrors,onDecision:(e,n)=>t.overlays.decideApproval(n,e)}}
|
|
></openclaw-exec-approval>`:z}
|
|
${zg(e,{open:g.devicePairSetupOpen,lifecycle:g.devicePairSetupLifecycle,nowMs:Date.now(),pendingCount:g.devicePairPendingCount,onRefresh:()=>void t.overlays.refreshDevicePairSetup(),onAccessChange:e=>void t.overlays.setDevicePairSetupAccess(e),onClose:()=>t.overlays.closeDevicePairSetup(),onManageDevices:()=>{t.overlays.closeDevicePairSetup(),e.navigate(`devices`)},onGetApps:()=>{t.overlays.closeDevicePairSetup(),e.navigate(`apps`)}})}
|
|
${A&&q(e.onboardingMemoryImportElement)?B`<openclaw-onboarding-memory-import
|
|
.active=${!0}
|
|
.context=${t}
|
|
></openclaw-onboarding-memory-import>`:z}
|
|
<openclaw-toast-host></openclaw-toast-host>
|
|
</div>
|
|
`}var Ug;function Wg(){return(Wg=e((()=>{ui(),Bo(),G(),Ps(),Oi(),Ai(),$i(),oa(),ta(),H(),pa(),Nr(),Ze(),Ln(),zn(),Cn(),Rg(),ol(),Bc(),zm(),Am(),Qm(),Ts(),Gp(),bd(),Dp(),Ug=()=>!1})))()}var Gg;function Kg(){return(Kg=e((()=>{Gi(),C(),Gg=class{constructor(e){this.host=e}syncSidebarWorkboard(){let e=this.host,t=e.context,n=t?.gateway.snapshot,r=t?.runtimeConfig.state.configSnapshot;if(!t||!n||!r)return;if(!Xr(r)){this.disposeSidebarWorkboard();return}let i=e.sidebarWorkboardRuntime;if(i){if(e.sidebarWorkboardHost!==t.workboard){this.disposeSidebarWorkboard(),this.syncSidebarWorkboard();return}i.sync(n.client,n.phase===`connected`);return}if(e.sidebarWorkboardRuntimeLoad)return;let a=e.sidebarWorkboardEpoch,o=b(()=>import(`./app-sidebar-workboard.runtime-BV8rPjRk.js`),__vite__mapDeps([75,2,4,3,5,6,7,8,76,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,77]),import.meta.url);e.sidebarWorkboardRuntimeLoad=o,o.then(t=>{if(e.sidebarWorkboardEpoch!==a||e.sidebarWorkboardRuntime)return;let n=e.context;if(!n)return;let r=t.createSidebarWorkboardRuntime(t=>{e.sidebarWorkboardRuntime===r&&(e.sidebarWorkboardSnapshot=t,e.requestUpdate())},n.workboard);e.sidebarWorkboardRuntime=r,e.sidebarWorkboardHost=n.workboard,e.sidebarWorkboardRenderers={renderEntry:t.renderSidebarWorkboardEntry,renderCustomize:t.renderSidebarWorkboardCustomize};let i=n?.gateway.snapshot;n&&i&&Xr(n.runtimeConfig.state.configSnapshot)&&r.sync(i.client,i.phase===`connected`)}).catch(()=>{e.sidebarWorkboardEpoch===a&&e.sidebarWorkboardRuntimeLoad===o&&(e.sidebarWorkboardRuntimeLoad=null)})}disposeSidebarWorkboard(){let e=this.host;e.sidebarWorkboardEpoch+=1;let t=e.sidebarWorkboardRuntime;t?.dispose(),t||e.context?.workboard.clearBoards(),e.sidebarWorkboardRuntime=null,e.sidebarWorkboardHost=null,e.sidebarWorkboardRenderers=void 0,e.sidebarWorkboardRuntimeLoad=null,e.sidebarWorkboardSnapshot!==mi&&(e.sidebarWorkboardSnapshot=mi,e.requestUpdate())}}})))()}function qg(e){try{window.webkit?.messageHandlers?.openclawNav?.postMessage({type:`nav-state`,...e})}catch{}}function Jg(e,t){return e.routeId===t.routeId&&e.location?.pathname===t.location?.pathname&&e.location?.search===t.location?.search&&e.location?.hash===t.location?.hash&&e.committedRouteId===t.committedRouteId&&e.committedLocation?.pathname===t.committedLocation?.pathname&&e.committedLocation?.search===t.committedLocation?.search&&e.committedLocation?.hash===t.committedLocation?.hash&&e.committedSessionKey===t.committedSessionKey}var Yg,Xg,Zg,$;function Qg(){return(Qg=e((()=>{di(),Di(),Ti(),Bo(),wi(),G(),Ps(),Gi(),H(),Pr(),fr(),pa(),cn(),$r(),Ln(),zn(),vn(),xr(),ri(),vc(),vm(),th(),Tg(),Ig(),Wg(),Kg(),Sl(),Bc(),Am(),Gp(),xg(),bd(),sc(),C(),Yg=`openclaw-app-sidebar`,Xg=Ka.filter(e=>e!==`workboard`),Zg={tagName:Yg,label:Yg,loadModule:()=>b(()=>import(`./app-sidebar-CnFPscC2.js`),__vite__mapDeps([78,6,2,3,4,5,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url)},yi.setLocaleLoadRecovery({isUnrecoverableError:Hs,onUnrecoverableLocaleLoad:()=>{qs()}}),$=class extends Xn{loadSettingsSidebarRenderer(){this.settingsSidebarRuntime??=b(()=>import(`./settings-sidebar-C0XMfym-.js`).then(e=>{this.settingsSidebarRenderer=e.renderSettingsSidebar,this.settingsSidebarLoadFailed=!1}),__vite__mapDeps([79,2,3,4,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,80,81,82,83]),import.meta.url).catch(()=>{this.settingsSidebarLoadFailed=!0,this.settingsSidebarRuntime=null})}retrySettingsSidebarRenderer(){this.settingsSidebarLoadFailed=!1,this.loadSettingsSidebarRenderer()}loadSidebarUpdateCard(){this.sidebarUpdateCardImport.load().catch(e=>{Hs(e)&&qs()})}loadDevicePairSetupRenderer(){this.devicePairSetupRuntime??=b(()=>import(`./view-pairing.runtime-Dv0qtb6U.js`).then(e=>{this.devicePairSetupRenderer=e.renderDevicePairSetup,this.devicePairSetupLoadFailed=!1}),__vite__mapDeps([84,2,4,3,5,6,7,8]),import.meta.url).catch(()=>{this.devicePairSetupLoadFailed=!0,this.devicePairSetupRuntime=null})}retryDevicePairSetupRenderer(){this.devicePairSetupLoadFailed=!1,this.loadDevicePairSetupRenderer()}get context(){return this.runtime?.context}get onboardingMode(){let e=this.routeState.location?.search;return e===void 0?this.onboarding:Vo(e)}get workspaceChromeVisible(){let e=this.routeState.routeId;return e!==void 0&&!go(e)&&!this.onboardingMode}storedOutboxScopeHost(e){let t=e.gateway.snapshot;return{settings:{gatewayUrl:e.gateway.connection.gatewayUrl},assistantAgentId:t.assistantAgentId,agentsList:e.agents.state.agentsList,hello:t.hello}}chatTitleContext(e,t){let n=this.activeSessionKey,r=ot(n),i=tt(n)?ft(t):r?.rest===lr(t)?o(r.agentId):void 0,a=i?e.agents.state.agentsList?.agents.find(e=>o(e.id)===i):void 0;return a?wn(a):sn(n,e.sessions.state.result?.sessions.find(e=>e.key===n))}constructor(){super(),this.onboarding=!1,this.navDrawerOpen=!1,this.desktopNavigationExpanded=!1,this.activeSessionKey=``,this.settingsSearchQuery=``,this.routeState={},this.nativeHistoryState=Om(),this.commandPaletteElement=Sc,this.terminalPanelElement=Ac,this.browserPanelElement=jc,this.desktopPanelElement=Mc,this.custodianPanelElement=Pc,this.execApprovalElement=zc,this.onboardingMemoryImportElement={tagName:`openclaw-onboarding-memory-import`,label:U(`onboarding.memoryImport.title`),loadModule:()=>b(()=>import(`./onboarding-memory-import-B_Qn6P0k.js`),__vite__mapDeps([85,2,3,4,5,6,7,8,9,10,86]),import.meta.url)},this.lazyCustomElements=new xc(this,()=>this.shellChrome.cancelPendingLazyAction(),e=>this.shellChrome.retryPendingLazyAction(e)),this.queryRenderedElement=e=>this.renderRoot?.querySelector(e)??null,this.navDrawerTrigger=null,this.navigationSidebar=document.createElement(Yg),this.lastWorkspaceLocation=null,this.custodianMinimizeRequestId=0,this.agentsListClient=null,this.agentsListSource=null,this.sessionKeyClient=null,this.runtimeConfigClient=null,this.runtimeConfigSource=null,this.lastLocalePrefSignature=null,this.previousGatewayPhase=null,this.sidebarWorkboardSnapshot=mi,this.sidebarWorkboardRuntime=null,this.sidebarWorkboardHost=null,this.sidebarWorkboardRuntimeLoad=null,this.sidebarWorkboardEpoch=0,this.agentRosterRefreshTimer=null,this.outboxStoreRuntime=null,this.outboxStoreUnsubscribe=null,this.lastDeletedSessions=null,this.outboxStoreImport=Wt(()=>b(()=>import(`./outbox-store-projection-XOJ4hhmZ.js`).then(e=>e),__vite__mapDeps([87,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url),e=>this.installOutboxStoreRuntime(e)),this.didConsiderNativeRouteRestore=!1,this.pendingNativeNewSession=!1,this.settingsPreloadTimers=new Map,this.settingsSidebarRenderer=null,this.settingsSidebarLoadFailed=!1,this.settingsSidebarRuntime=null,this.sidebarUpdateCardImport=Wt(()=>b(()=>import(`./sidebar-update-card-SvaXnUMr.js`),__vite__mapDeps([88,6,2,3,4,5,7,8,89,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,54,90]),import.meta.url)),this.criticalNoticeRuntime=null,this.devicePairSetupRenderer=null,this.devicePairSetupLoadFailed=!1,this.devicePairSetupRuntime=null,this.subscriptions=new qr(this),this.shellNavigation=new Fg(this),this.shellWorkboard=new Gg(this),this.shellChrome=new eh(this),this.shellGateway=new wg(this),this.handleGatewayEvent=e=>{if(e.event===`config.changed`||e.event===`chat.metadata.changed`){let e=this.context?.gateway?.snapshot.client;e&&(ut(e),Pt(e))}this.shellGateway.handleGatewayEvent(e)},this.handleThemeChange=e=>{let t=this.context;t&&t.theme.setMode(e.detail.mode,e.detail.element)},this.resizeNavigation=e=>this.shellChrome.resizeNavigation(e),this.handleNativeToggleSidebar=()=>this.shellChrome.handleNativeToggleSidebar(),this.handleNativeOpenSearch=()=>this.shellChrome.handleNativeOpenSearch(),this.handleNativeToggleSearch=e=>this.shellChrome.handleNativeToggleSearch(e),this.handleNativeNewSession=()=>this.shellChrome.handleNativeNewSession(),this.handleNativeNavigate=e=>this.shellChrome.handleNativeNavigate(e),this.handleNativeHistoryState=e=>this.shellChrome.handleNativeHistoryState(e),this.handleWindowResize=()=>this.shellChrome.handleWindowResize(),this.handleDocumentKeydown=e=>this.shellChrome.handleDocumentKeydown(e),this.openPalette=()=>this.shellChrome.openPalette(),this.refreshControlUi=()=>this.shellChrome.refreshControlUi(),this.handleShellNavDrawerToggle=e=>this.shellChrome.handleShellNavDrawerToggle(e),this.openApprovals=()=>this.shellChrome.openApprovals(),this.handleCommandPaletteSlashCommand=e=>this.shellChrome.handleCommandPaletteSlashCommand(e),this.restorePendingLazyAction=()=>this.shellChrome.restorePendingLazyAction(),this.nativeNavCollapsed=()=>this.shellChrome.nativeNavCollapsed(),this.subscriptions.effect(()=>this.context,e=>(this.pendingNativeNewSession&&(this.pendingNativeNewSession=!1,this.handleNativeNewSession()),()=>{this.context!==e&&this.resetForContextEpoch()})).watch(()=>this.context?.navigation,(e,t)=>e.subscribe(t)).watch(()=>this.context?.agentSelection,(e,t)=>e.subscribe(t)).watch(()=>this.context?.gateway,(e,t)=>e.subscribe(t),e=>this.synchronizeGateway(e.snapshot)).effect(()=>this.context?.gateway,e=>e.subscribeEvents(this.handleGatewayEvent)).watch(()=>this.context?.config,(e,t)=>e.subscribe(t)).watch(()=>this.context?.theme,(e,t)=>e.subscribe(t)).watch(()=>this.context?.agents,(e,t)=>e.subscribe(t),e=>{let t=this.context?.gateway.snapshot;t&&this.ensureAgentsList(t,e)}).effect(()=>this.runtime?.router,e=>(this.updateRouteState(_c(e.getState())),e.subscribeSelector(_c,e=>this.updateRouteState(e),Jg))).watch(()=>this.context?.overlays,(e,t)=>e.subscribe(t)).watch(()=>this.context?.sessions,(e,t)=>e.subscribe(t),e=>{this.observeDeletedSessions(e.state),this.recoverDeletedActiveSession(e.state)}).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(()=>{this.reconcileServerUiPrefs(e),this.syncSidebarWorkboard(),t()}),e=>{let t=this.context?.gateway.snapshot;t&&this.ensureRuntimeConfig(t,e),this.reconcileServerUiPrefs(e),this.syncSidebarWorkboard()})}reconcileServerUiPrefs(e){this.shellGateway.reconcileServerUiPrefs(e)}reconcileCommittedServerUiPrefs(e,t,n=!1){this.shellGateway.reconcileCommittedServerUiPrefs(e,t,n)}connectedCallback(){super.connectedCallback(),this.outboxStoreRuntime&&this.installOutboxStoreRuntime(this.outboxStoreRuntime),this.outboxStoreImport.schedule(),this.shellChrome.connect(),Gu((e,t)=>{if(Yh())return;let n=Fh(e,t),r=this.context?.runtimeConfig;n&&r&&tg(r,n,{profile:this.context?.gateway.snapshot,afterCommit:({needsRefresh:e,retainedLocal:t})=>this.reconcileCommittedServerUiPrefs(r,e,t)})})}disconnectedCallback(){this.shellChrome.disconnect(),gl(),this.outboxStoreImport.dispose(),this.sidebarUpdateCardImport.dispose(),this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=null,this.lastLocalePrefSignature=null,Gu(null),this.resetForDocumentDisconnect(),super.disconnectedCallback()}installOutboxStoreRuntime(e){this.outboxStoreRuntime=e,this.isConnected&&(this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=e.subscribeStoredChatOutboxChanges(()=>this.requestUpdate()),this.requestUpdate())}resetForContextEpoch(){this.shellChrome.abandonPendingLazyActionForContext(),this.resetShellState()}resetForDocumentDisconnect(){this.shellChrome.preservePendingLazyActionForReload(),this.resetShellState()}resetShellState(){this.navDrawerOpen=!1,this.desktopNavigationExpanded=!1,this.navDrawerTrigger=null,this.lastWorkspaceLocation=null,this.activeSessionKey=``,this.settingsSearchQuery=``,this.commandPaletteTarget=void 0,this.lastDeletedSessions=null,this.shellGateway.reset(),this.disposeSidebarWorkboard();for(let e of this.settingsPreloadTimers.values())globalThis.clearTimeout(e);this.settingsPreloadTimers.clear()}selectChatSession(e,t){this.shellNavigation.selectChatSession(e,t)}async handleSettingsSearchQueryChange(e){this.settingsSearchQuery=e;let t=this.context?.runtimeConfig;if(!(!t||!e.trim()))try{await t.ensureLoaded(),this.context?.runtimeConfig===t&&await t.ensureSchemaLoaded()}catch{}}chatNavigationOptions(e,t){return this.shellNavigation.chatNavigationOptions(e,t)}navigate(e,t){this.shellNavigation.navigate(e,t)}replaceChatWithCurrentSession(){return this.shellNavigation.replaceChatWithCurrentSession()}recoverDeletedActiveSession(e){this.shellNavigation.recoverDeletedActiveSession(e)}observeDeletedSessions(e){let t=this.context,n=e.deletedSessions;!t||Object.is(n,this.lastDeletedSessions)||(this.lastDeletedSessions=n,n.length!==0&&b(async()=>{let{retireDeletedComposerDrafts:e}=await import(`./composer-draft-retirement.runtime-CqmtfZn-.js`);return{retireDeletedComposerDrafts:e}},__vite__mapDeps([91,2,4,3,5,6,7,8,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]),import.meta.url).then(({retireDeletedComposerDrafts:e})=>e(t,n),()=>_t({message:U(`sessionsView.draftCleanupFailed`)})))}exitSettings(){this.shellNavigation.exitSettings()}toggleNavigationSurface(e){this.shellChrome.toggleNavigationSurface(e)}closeNavDrawer(e={}){this.shellChrome.closeNavDrawer(e)}openNewSession(e,t){this.shellNavigation.openNewSession(e,t)}syncDocumentTitle(){let e=this.routeState.routeId,t=this.context;if(!e||!t)return;let n=this.storedOutboxScopeHost(t),r=e===`custodian`?U(`nav.askOpenClaw`):xo(e);ja(e)&&this.activeSessionKey&&(r=this.chatTitleContext(t,n)||r);let i=t.gateway.snapshot.phase!==`connected`,a=So({context:r,attentionCount:t.overlays.snapshot.approvalQueue.length,gatewayDisconnected:i,...i&&{queuedCount:this.outboxStoreRuntime?.summarizeStoredChatOutboxes(n).total}}),o=t.config?.current.environment;o&&(a+=` · ${o.label}`),document.title!==a&&(document.title=a)}updated(){this.syncDocumentTitle(),gl(),this.restorePendingLazyAction(),!customElements.get(`openclaw-sidebar-update-card`)&&this.querySelector(`openclaw-sidebar-update-card`)&&this.loadSidebarUpdateCard();let e=this.querySelector(`openclaw-chat-page`);e&&(e.navDrawerOpen=this.navDrawerOpen&&!this.onboardingMode);let t=this.context;if(!t)return;let n=t.gateway?.snapshot;if(n&&this.workspaceChromeVisible){let e=Wp(n),r=fa(n,`openclaw.chat`,`operator.admin`);this.commandPalette&&(this.commandPalette.desktopAvailable=e,this.commandPalette.custodianAvailable=r),ei(n,t.config?.current.terminalEnabled??!1)&&this.lazyCustomElements.preload(this.terminalPanelElement),Up(n)&&this.lazyCustomElements.preload(this.browserPanelElement),e&&this.lazyCustomElements.preload(this.desktopPanelElement),r&&this.lazyCustomElements.preload(this.custodianPanelElement)}(t.overlays?.snapshot.approvalQueue.length??0)>0&&this.lazyCustomElements.preload(this.execApprovalElement),this.restorePendingLazyAction();let r={collapsed:this.nativeNavCollapsed(),width:t.navigation.snapshot.navWidth};(r.collapsed!==this.lastNativeNavState?.collapsed||r.width!==this.lastNativeNavState.width)&&(this.lastNativeNavState=r,qg(r))}synchronizeGateway(e){this.previousGatewayPhase===`connected`&&e.phase!==`connected`&&e.client&&(ut(e.client),Pt(e.client)),this.shellGateway.synchronizeGateway(e)}syncSidebarWorkboard(){this.shellWorkboard.syncSidebarWorkboard()}disposeSidebarWorkboard(){this.shellWorkboard.disposeSidebarWorkboard()}ensureRuntimeConfig(e,t=this.context?.runtimeConfig){this.shellGateway.ensureRuntimeConfig(e,t)}enabledRouteIds(){return Xr(this.context?.runtimeConfig.state.configSnapshot)?Ka:Xg}newSessionRouteAgentId(){return this.shellNavigation.newSessionRouteAgentId()}ensureAgentsList(e,t=this.context?.agents){this.shellGateway.ensureAgentsList(e,t)}updateRouteState(e){this.shellNavigation.updateRouteState(e)}render(){return this.workspaceChromeVisible&&this.lazyCustomElements.preload(Zg),Hg(this)}},F([fi({attribute:!1})],$.prototype,`runtime`,void 0),F([fi({attribute:!1})],$.prototype,`onboarding`,void 0),F([V()],$.prototype,`navDrawerOpen`,void 0),F([V()],$.prototype,`desktopNavigationExpanded`,void 0),F([V()],$.prototype,`activeSessionKey`,void 0),F([V()],$.prototype,`settingsSearchQuery`,void 0),F([V()],$.prototype,`routeState`,void 0),F([V()],$.prototype,`nativeHistoryState`,void 0),F([pi(`openclaw-command-palette`)],$.prototype,`commandPalette`,void 0),F([pi(`openclaw-exec-approval`)],$.prototype,`approvalOverlay`,void 0),F([V()],$.prototype,`settingsSidebarRenderer`,void 0),F([V()],$.prototype,`settingsSidebarLoadFailed`,void 0),F([V()],$.prototype,`devicePairSetupRenderer`,void 0),F([V()],$.prototype,`devicePairSetupLoadFailed`,void 0),customElements.get(`openclaw-app`)||customElements.define(`openclaw-app`,_m),customElements.get(`openclaw-app-shell`)||customElements.define(`openclaw-app-shell`,$)})))()}export{Ou as $,ha as $n,ns as $t,Yd as A,qa as An,Wc as At,bd as B,ya as Bn,qs as Bt,up as C,xo as Cn,hl as Ct,Pf as D,ro as Dn,rl as Dt,fp as E,to as En,il as Et,xd as F,Ua as Fn,sc as Ft,pd as G,Da as Gn,Cs as Gt,qu as H,Oa as Hn,ks as Ht,Cd as I,Ca as In,Zs as It,dd as J,wa as Jn,Ts as Jt,Tu as K,ka as Kn,xs as Kt,Sd as L,Ea as Ln,Xs as Lt,Zd as M,Va as Mn,Vc as Mt,Ud as N,Ha as Nn,yc as Nt,lf as O,$a as On,qc as Ot,wd as P,Ba as Pn,Bc as Pt,Vu as Q,Na as Qn,ps as Qt,nd as R,La as Rn,Hs as Rt,Xf as S,wo as Sn,ml as St,Dp as T,eo as Tn,al as Tt,Uu as U,xa as Un,Ss as Ut,zu as V,ja as Vn,Ps as Vt,hd as W,Ta as Wn,ws as Wt,Du as X,Pa as Xn,vs as Xt,_d as Y,Aa as Yn,K as Yt,Ku as Z,ba as Zn,gs as Zt,Kp as _,co as _n,wl as _t,ph as a,ko as an,su as at,Up as b,po as bn,vl as bt,Mm as c,bo as cn,Ql as ct,Am as d,ao as dn,Vl as dt,ms as en,ga as er,vu as et,Dm as f,go as fn,Bl as ft,rm as g,yo as gn,Dl as gt,im as h,so as hn,zl as ht,Ph as i,Vo as in,cu as it,Hd as j,za as jn,Hc as jt,Xd as k,Ya as kn,Gc as kt,Fm as l,Bo as ln,Zl as lt,pm as m,vo as mn,kl as mt,xg as n,Ko as nn,pu as nt,nh as o,Fo as on,lu as ot,fm as p,mo as pn,Nl as pt,Cu as q,W as qn,bs as qt,Kh as r,Ho as rn,fu as rt,zm as s,To as sn,nu as st,Qg as t,qo as tn,va as tr,mu as tt,jm as u,io as un,ql as ut,Jp as v,Co as vn,El as vt,dp as w,ho as wn,ol as wt,Wp as x,uo as xn,Sl as xt,Gp as y,_o as yn,Cl as yt,J as z,G as zn,Ys as zt};
|
|
//# sourceMappingURL=control-ui-core-DGVkFhVB.js.map
|