openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1,639 lines • 425 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./command-palette-C4J0pnIL.js","./session-snapshot-database-BurLa_ut.js","./control-ui-boot-shared-umGE-sEP.js","./control-ui-boot-shared-Dfs-gZII.js","./control-ui-boot-shared-Sj2zqjOr.js","./control-ui-boot-shared-em9-jnbz.js","./config-runtime-BecGLziM.js","./control-ui-boot-shared-D4XEBdOG.js","./plugin-contracts-runtime-CNCaYops.js","./markdown-runtime-ORQpioyT.js","./control-ui-boot-chat-VeeaXyJz.js","./control-ui-boot-shared-DJkUdZmL.js","./control-ui-boot-shared-xfDhIVun.js","./control-ui-boot-shared-D3oo_6Fq.js","./control-ui-boot-shared-styles-BaQ2sAfZ.js","./sidebar-update-runtime-DonYLwN5.js","./control-ui-boot-chat-DxoNF0Ad.js","./control-ui-boot-chat-C8hdsB2M.js","./control-ui-boot-chat-Ck7W_FPO.js","./chat-transcript-styles-Dzr3t9kA.js","./control-ui-boot-chat-styles-BRrYkFSc.js","./control-ui-boot-new-CxgnwT6A.js","./control-ui-boot-new-styles-Bb6Ub5D3.js","./transcript-search-C_sHjcNy.js","./en-apps-BZRaTvSe.js","./settings-targets-B_ZHOn2L.js","./consent-dialog-qHYDRXx-.js","./reasoned-disabled-control-U3kHzkKT.js","./control-ui-core-yIvVj14Y.css","./control-ui-boot-shared-styles-DKyMAG_6.css","./control-ui-boot-shared-CXHNz0Bh.css","./sidebar-update-runtime-ah7rgQE7.css","./chat-transcript-styles-B_dd5Ueo.css","./control-ui-boot-chat-styles-C_Ls1c0m.css","./control-ui-boot-chat-mLz7NUiY.css","./control-ui-boot-new-styles-u1aN_ui5.css","./control-ui-boot-new-D-SpiTTi.css","./command-palette-NBC8ATMP.css","./debug-overlay-M8snAaYH.js","./keyboard-shortcuts-dialog-CnISCcj1.js","./macos-titlebar-controls.runtime-B094_r0z.js","./terminal-panel-registration-DwNbVu-U.js","./scrollbar-styles-BIL0YPCY.js","./dock-panel-styles-C_3Cdw6M.js","./panel-tab-strip-DvSbDG3-.js","./dock-destination-controls-CzLuh1pj.js","./panel-empty-state-DS_rQC2v.js","./theme-color-DAo4KRoc.js","./catalog-terminal-start-BmIoZaYn.js","./browser-panel-CpBLyCyg.js","./gateway-websocket-url-cYJwVUmD.js","./browser-document-DcyyNtT-.js","./desktop-panel-DON9OquX.js","./control-ui-boot-chat-BPMc7uzL.js","./control-ui-boot-chat-XcDaYmck.js","./desktop-focus-window-BNmA4flB.js","./control-ui-boot-chat-Dh5vtL-G.css","./link-reader-panel-DRh0JX44.js","./link-reader-response-DDChabPB.js","./board-document-moYm3_VL.js","./board-view-1zQa7RX5.js","./control-ui-disabled-DfZ2EcL3.js","./near-viewport-observer-WgGck829.js","./widget-sandbox-host-BtiBzdny.js","./mcp-app-confirm-C5ZrOS-h.js","./board-view-DsuslJec.css","./board-document-B0Y4zGJq.css","./approval-page-registration-BQEjGJz-.js","./approval-BhCMRUNv.js","./approval-D_3q8zgZ.css","./question-page-registration-DRlvkUky.js","./exec-approval-3rJoRXhI.js","./login-runtime-ULR4eeNT.js","./tooltip-DzbnNMct.js","./assistant-panel-content-COU9ZNyM.js","./custodian-surface-DEGhn11a.js","./plugin-help-B4SbmTLF.js","./custodian-alert-store-DMTYYmJp.js","./wizard-step-controls-C7I6IQZe.js","./wizard-step-controls-D2NAzKG1.css","./custodian-surface-BS8BC9z-.css","./assistant-panel-content-DzJupYdl.css","./link-reader-hovercard-uMLprW41.js","./link-reader-hovercard-CzYUpnNa.css","./gateway-scope-upgrade.runtime-CxRpEm5T.js","./theme-catalog-DV1e-9j0.js","./theme-palette-BXs1N4qF.js","./plugin-capabilities.runtime-CPaMzr40.js","./mcp-app-routing-BHjVXpEf.js","./native-link-menu.runtime-BWyTHQLY.js","./update-failure-report-BvjBN3tT.js","./en-update-actions-Bqyjfcr4.js","./update-triage.runtime-TEN2WfyM.js","./en-settings-KEcvGj5Z.js","./browser-bootstrap.runtime-B2AJy4aH.js","./response-body-DtENYz2O.js","./native-startup.runtime-DBKID_wJ.js","./native-embed-CiDYfKFT.css","./nav-drawer-swipe.runtime-AOmYXPDm.js","./server-prefs-profile-runtime-DknSjRPw.js","./user-prefs-request-WwABZdqk.js","./update-confirmation.runtime-C3m74WAv.js","./update-run-view--bA96Nt4.js","./stream-auto-follow-controller-BZ0UzGsg.js","./update-run-view-CS3ezHvV.css","./settings-sidebar-C4XbE7eb.js","./config-form.tiers-CqQphhDm.js","./config-form.search-DJEvDtN5.js","./setup-schema-CsxjHw97.js","./slots-DxbTdEPp.js","./view-pairing.runtime-DT3f5Mzn.js","./en-devices-CbdD7BkR.js","./onboarding-memory-import-DPGJSUnb.js","./onboarding-memory-import-DuWLEvoz.css","./composer-draft-retirement.runtime-Z2pZ8i7S.js"])))=>i.map(i=>d[i]);
import{n as e,r as t}from"./rolldown-runtime-8BhlS34s.js";import{$ as n,$a as r,$o as i,$t as a,Aa as o,Ac as s,As as c,Ba as l,Bc as u,Bn as d,C as f,Ca as p,Cc as m,Cs as h,Cu as g,Da as _,Dc as v,Dl as y,Ds as b,Ea as x,Ei as S,Es as C,Eu as w,Fl as T,Fn as E,Fs as D,Fu as O,Ga as ee,Gu as te,Ha as ne,Hc as k,Hr as A,Hs as re,Ht as ie,Hu as j,Ic as ae,Ii as M,Il as oe,In as se,Is as ce,It as le,J as ue,Ja as de,Ka as fe,Kr as pe,Lc as me,Li as he,Ll as ge,Ls as _e,Ma as ve,Ms as ye,Na as be,Nl as xe,Ns as Se,Nt as Ce,O as we,Oa as Te,Oc as Ee,On as De,P as Oe,Pt as ke,Q as Ae,Qa as je,Qo as Me,Qs as Ne,Qt as Pe,Rs as Fe,Rt as Ie,Ru as Le,S as Re,Sa as ze,Sl as Be,Sn as Ve,Ss as He,Su as Ue,Ta as We,Tc as Ge,Ts as Ke,Tu as qe,Ua as Je,Uc as Ye,Ur as Xe,Ut as Ze,Va as Qe,Vl as $e,Vn as et,Vo as tt,Vt as nt,Vu as rt,W as it,Wa as at,Ws as ot,Wt as st,Wu as ct,X as lt,Xa as ut,Xo as dt,Y as ft,Ya as pt,Yc as mt,Ys as ht,Z as gt,Za as _t,Zc as vt,Zo as yt,Zt as bt,_ as xt,_a as St,_i as Ct,_l as wt,_n as Tt,_r as Et,_s as Dt,_t as Ot,_u as N,aa as kt,an as At,ao as jt,at as Mt,ba as Nt,bc as Pt,bi as Ft,br as It,bs as Lt,bt as Rt,bu as zt,ca as Bt,cc as Vt,cn as Ht,co as Ut,cr as Wt,cu as Gt,da as Kt,dn as qt,do as Jt,dr as Yt,ds as Xt,dt as Zt,du as Qt,en as $t,eo as en,es as tn,et as nn,f as rn,fa as an,fn as on,fo as sn,fr as cn,fs as ln,ft as un,fu as dn,g as fn,ga as pn,gc as mn,gi as hn,gs as gn,gt as _n,h as vn,ha as yn,hc as bn,hi as xn,ho as Sn,hr as Cn,hs as wn,i as Tn,ia as En,il as Dn,io as On,it as kn,ja as An,ji as jn,jl as Mn,jr as Nn,js as Pn,ju as P,ka as Fn,kc as In,ki as Ln,kl as Rn,kn as zn,kr as Bn,ks as Vn,kt as Hn,ku as Un,la as Wn,lc as Gn,lo as Kn,lr as qn,ls as Jn,lt as Yn,lu as Xn,m as Zn,ma as Qn,mc as $n,mi as er,mo as tr,mr as nr,ms as rr,n as ir,nl as ar,nn as or,no as sr,nr as cr,ns as lr,nt as ur,nu as dr,oa as fr,oc as pr,oo as mr,or as hr,ot as gr,ou as _r,pa as vr,pr as yr,ps as br,pt as xr,pu as Sr,q as Cr,qa as wr,qr as Tr,qs as Er,ra as Dr,rc as Or,rl as kr,rn as Ar,ro as jr,rr as Mr,rs as Nr,ru as Pr,sa as Fr,sc as Ir,so as Lr,sr as Rr,st as zr,su as Br,ta as Vr,tn as Hr,to as Ur,ts as Wr,tt as Gr,ua as Kr,uo as qr,us as Jr,ut as Yr,uu as Xr,v as Zr,vi as Qr,vn as $r,vr as ei,vs as ti,vt as ni,vu as ri,wa as ii,wc as ai,ws as oi,wt as si,wu as ci,xa as li,xi as ui,xn as di,xr as fi,xs as pi,xt as mi,xu as hi,y as gi,yi as _i,yn as vi,yr as yi,ys as bi,yu as xi,zl as Si,zn as Ci,zs as wi,zu as Ti}from"./control-ui-core-BncvAZjR.js";import{$ as F,B as Ei,F as Di,I as Oi,M as ki,N as Ai,R as ji,X as I,Y as L,Z as Mi,at as Ni,ct as R,d as Pi,g as Fi,mt as Ii,nt as Li,tt as z,u as Ri,ut as B}from"./lit-runtime-B8uOr6OX.js";import{c as zi,d as Bi,l as Vi}from"./gateway-runtime-Cr51Pi7N.js";import{$r as Hi,A as Ui,Aa as Wi,An as Gi,Ao as Ki,At as qi,C as Ji,Ca as Yi,Ct as Xi,D as Zi,Da as Qi,Dn as $i,Do as V,Dt as ea,Ea as ta,En as na,Er as ra,Et as ia,F as aa,Fa as oa,Fn as sa,Ft as ca,Ga as la,Gt as ua,Ha as da,I as fa,Jr as pa,Kt as ma,La as ha,M as ga,Ma as _a,Mt as va,N as ya,No as ba,Nt as xa,O as Sa,Oa as Ca,Oo as wa,P as Ta,Pi as Ea,Pt as Da,Qi as Oa,Qr as ka,Qt as Aa,Ra as ja,S as Ma,Sa as Na,Sn as Pa,Ta as Fa,Tn as Ia,Tr as La,Tt as Ra,Ua as za,Va as Ba,Wt as Va,Xa as Ha,Xr as Ua,Xt as Wa,Yi as Ga,Yr as Ka,Yt as qa,Zi as Ja,Zr as Ya,Zt as Xa,_ as Za,_a as H,_n as Qa,an as $a,ba as eo,bn as to,cn as no,ct as ro,d as io,dn as ao,do as oo,en as so,eo as co,f as lo,fa as uo,fn as fo,h as po,hi as mo,hn as ho,ht as go,ii as U,in as _o,j as vo,ja as yo,jo as bo,jt as xo,k as So,kt as Co,lo as wo,lt as To,m as Eo,ma as Do,mn as Oo,mt as ko,n as Ao,nn as jo,oa as W,on as Mo,p as No,pn as Po,qi as Fo,qt as Io,r as Lo,ri as Ro,rn as zo,ro as G,sa as K,sn as q,ta as Bo,to as Vo,un as Ho,ut as Uo,vo as Wo,wa as Go,wo as Ko,wt as qo,x as Jo,xa as Yo,ya as Xo,yn as Zo}from"./ui-DuRgK6kL.js";function Qo(e){let t=e.slug;if(t){if(Js.has(t)){Zs.has(t)||(Zs.add(t),console.warn(`[openclaw] /${t} is a native route; using /plugin.`));return}return t}}function $o(e=[]){Xs.clear();for(let t of e){let e=Qo(t);e&&!Xs.has(e)&&Xs.set(e,t)}}function es(e,t=``){let n=_a(e),r=yo(t);if(!n.startsWith(`${r}/`))return null;let i=n.slice(r.length+1);return i.length<=64&&/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(i)&&!Js.has(i)?i:null}function ts(e,t=``){return Xs.get(es(e,t)??``)??null}function ns(e,t=``){let n=Qo(e);return{pathname:n?`${yo(t)}/${n}`:J(`plugin`,t),search:n?``:`?${new URLSearchParams({plugin:e.pluginId,id:e.id})}`,hash:``}}function rs(e,t=``){if(_a(e.pathname)!==J(`plugin`,t))return e;let n=new URLSearchParams(e.search),r=[...Xs.values()].find(e=>e.pluginId===n.get(`plugin`)&&e.id===n.get(`id`));if(!r)return e;let i=new URLSearchParams([...n].filter(([e])=>e.startsWith(`p.`)));return{...ns(r,t),search:i.size?`?${i}`:``,hash:e.hash}}function is(e){return Object.hasOwn(Ws,e)}function as(e){return{id:e,...Ws[e]}}function J(e,t=``){return`${yo(t)}${Ws[e].path}`}function os(e,t,n){let r=_a(e),i=J(t,n);if(r===i)return``;let a=`${i}/`;return r.startsWith(a)&&r.slice(a.length)||null}function ss(e){return e.length===36&&oa.test(e)}function cs(e,t=``,n,r=12){let i=ss(e),a=j(oo(n),48).replace(/-+$/u,``),o=i?`${a?`${a}-`:``}${e.replaceAll(`-`,``).slice(0,r).toLowerCase()}`:e,s=encodeURIComponent(ss(o)?`person-${o}`:o).replaceAll(`.`,`%2E`);i||(s=s.replace(/-(?=[0-9a-f]{8,32}$)/u,`%2D`));let c=`${J(`activity`,t)}/${s}`;return{pathname:c,search:``,href:c}}function ls(e,t=``){let n=os(e,`activity`,t);if(!n||n.includes(`/`))return null;try{let e=decodeURIComponent(n);return!e.trim()||e===`.`||e===`..`?null:ss(e)?e:n.match($s)?.[1]??e}catch{return null}}function us(e,t=``){if(!Qi(e))throw Error(`Invalid Workboard board id.`);let n=encodeURIComponent(e).replaceAll(`.`,`%2E`);return`${J(`workboard`,t)}/${n}`}function ds(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=`${J(`agents`,n)}/${r}`;return t?`${i}/${t}`:i}function fs(e,t=``){let n=os(e,`agents`,t);if(!n)return null;let r=n.split(`/`);if(r.length>2||!r[0])return null;let i;try{i=decodeURIComponent(r[0])}catch{return null}if(!i||i.includes(`/`)||i===`.`||i===`..`)return null;let a=r[1]??null,o=a&&te(a)?a:null;return{agentId:i,panel:o??`overview`,panelSegment:o,invalidPanel:a!==null&&o===null}}function ps(e,t=``){let n=J(`memory`,t);return e===`overview`?n:`${n}/${e}`}function ms(e,t=``){let n=os(e,`memory`,t);return n===``?`overview`:n===`memories`||n===`dreams`||n===`settings`?n:null}function hs(e,t=``){return _a(e)===`${J(`plugin-settings`,t)}/discover`}function gs(e){return/^[A-Za-z0-9_-]+$/u.test(e)}function _s(e,t=``){if(!gs(e))throw Error(`Invalid plugin catalog id for a route path.`);return`${J(`plugins`,t)}/${e}`}function vs(e,t=``){let n=os(e,`plugins`,t);return n&&gs(n)?n:null}function ys(e,t=``){if(!e||e===`.`||e===`..`)throw Error(`Invalid plugin id for a route path.`);let n=e===`discover`?`%64iscover`:encodeURIComponent(e).replaceAll(`.`,`%2E`);return`${J(`plugin-settings`,t)}/${n}`}function bs(e,t=``){let n=os(e,`plugin-settings`,t);if(!n||n.includes(`/`)||n===`discover`)return null;try{let e=decodeURIComponent(n);return e&&e!==`.`&&e!==`..`?e:null}catch{return null}}function xs(e){return e===`chat`||e===`dashboard`}function Ss(e,t=``){let n=_a(e),r=yo(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`:Ba({pathname:n,basePath:r})?`chat`:null}function Cs(e,t=``){return`${J(`terminal`,t)}/${encodeURIComponent(e)}`}function ws(e,t,n){let r=os(e,t,n);if(!r||r.includes(`/`))return null;try{return decodeURIComponent(r)}catch{return null}}function Ts(e,t=``){return ws(e,`terminal`,t)?.trim()||null}function Es(e,t=``){let n=ws(e,`workboard`,t);return Qi(n)?n:null}function Ds(e,t=``){return Ts(e,t)?`terminal`:ts(e,t)?`plugin`:fs(e,t)?`agents`:ls(e,t)?`activity`:Es(e,t)?`workboard`:ms(e,t)?`memory`:hs(e,t)?`plugins`:bs(e,t)?`plugin-settings`:Ss(e,t)}function Os(e,t){let n=vs(e,t)?`plugins`:Ds(e,t);return n&&(n!==`memory`||ms(e,t)!==`overview`)?[n,ec[n],e]:null}function ks(e,t=``){let n=_a(e),r=yo(t);if(r&&n!==r&&!n.startsWith(`${r}/`))return null;let i=r?n.slice(r.length)||`/`:n;return vs(n,r)?`plugins`:qs.get(i.toLowerCase())??Ds(n,r)}function As(e){if(Ks.includes(e))return!0;let t=e.split(`/`).find(Boolean);return Ks.some(e=>e.startsWith(`/${t}/`))}function js(e){let t=za(e);if(t!==null)return t;let n=e.trim().endsWith(`/`),r=_a(e);if(r.toLowerCase().endsWith(`/index.html`))return yo(r.slice(0,-11));if(r===`/`)return``;let i=r.split(`/`).filter(Boolean);for(let e=0;e<i.length;e+=1){let t=`/${i.slice(e).join(`/`)}`,n=qs.has(t)?t:void 0,r=Object.values(Us).find(e=>t===e||t.startsWith(`${e}/`)),a=Ds(t);if(!n&&!r&&!a)continue;let o=i[e-1],s=r??(a?Ws[a].path:null),c=(n??s??``).split(`/`)[1];if(e===0||o===c)return``;let l=`/${i.slice(0,e).join(`/`)}`;return As(l)?``:l}if(!n||i.length===0)return``;let a=`/${i.join(`/`)}`;return As(a)?``:a}function Ms(e,t){return{pathname:J(e,t),search:``,hash:``}}function Ns(e,t){let n=new URLSearchParams(e.search),r=n.get(t)??e.pathname;n.delete(t);let i=n.toString();return{pathname:r,search:i?`?${i}`:``,hash:e.hash}}function Ps(e,t){return e?.pathname===t?.pathname&&e?.search===t?.search&&e?.hash===t?.hash}var Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec;function Y(){return(Y=e((()=>{wo(),ja(),Wi(),ta(),ct(),rt(),Fs=`__openclawAgentPath`,Is=`__openclawActivityPath`,Ls=`__openclawTerminalPath`,Rs=`__openclawSessionPath`,zs=`__openclawMemoryPath`,Bs=`__openclawPluginsPath`,Vs=`__openclawPluginSettingsPath`,Hs=`__openclawWorkboardPath`,Us={approval:`/approve`,question:`/ask`},Ws={settings:{path:`/settings`},chat:{path:`/chat`},terminal:{path:`/terminal`},dashboard:{path:`/dashboard`},dashboards:{path:`/dashboards`},custodian:{path:`/custodian`},"new-session":{path:`/new`},activity:{path:`/activity`},meetings:{path:`/meetings`},apps:{path:`/apps`},portals:{path:`/portals`},"agents-home":{path:`/agents`},agents:{path:`/settings/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`]},device:{path:`/settings/device`},"device-permissions":{path:`/settings/device/permissions`},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`},search:{path:`/settings/search`},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`]},systems:{path:`/systems`},usage:{path:`/usage`},debug:{path:`/debug`},logs:{path:`/logs`},"skill-workshop":{path:`/skills/workshop`},skills:{path:`/skills`},"skill-settings":{path:`/settings/skills`},plugins:{path:`/plugins`},"plugin-settings":{path:`/settings/plugins`},cron:{path:`/automations`,aliases:[`/cron`]},devices:{path:`/settings/devices`,aliases:[`/nodes`]},"cloud-workers":{path:`/settings/cloud-workers`},plugin:{path:`/plugin`}},Gs=Object.keys(Ws),Ks=[],qs=new Map;for(let e of Gs){let t=Ws[e],n=`aliases`in t?[t.path,...t.aliases]:[t.path];for(let t of n){let n=_a(t);Ks.push(n),qs.has(n)||qs.set(n,e)}}Js=new Set(Ks.map(e=>e.split(`/`)[1])),Ys=`__openclawPluginPath`,Xs=new Map,Zs=new Set,Qs=`person`,$s=/(?:^|-)([0-9a-f]{8,32})$/u,ec={terminal:Ls,plugin:Ys,agents:Fs,activity:Is,workboard:Hs,memory:zs,plugins:Bs,"plugin-settings":Vs,chat:Rs,dashboard:Rs}})))()}function tc(){}function nc(e){return!1}function rc(e){return e}function ic(e){try{let t=new URL(rc(e),location.href);return t.protocol=t.protocol.replace(/^ws/u,`http`),t.origin===location.origin}catch{return!1}}function ac(e){return e}function oc(){return(oc=e((()=>{})))()}function sc(){return window.__OPENCLAW_NATIVE_WEB_CHROME__===!0}function cc(){let e=window.__OPENCLAW_NATIVE_EMBED__;if(!H(e))return null;let{platform:t,formFactor:n,surface:r}=e;return(t===`ios`||t===`macos`||t===`android`)&&(n===`phone`||n===`pad`||n===`desktop`)&&(r===void 0||r===`conversation`)?{platform:t,formFactor:n,...r?{surface:r}:{}}:null}function lc(){return cc()!==null}function uc(){let e=window.__OPENCLAW_NATIVE_HISTORY__;return e&&typeof e.canGoBack==`boolean`&&typeof e.canGoForward==`boolean`?e:{canGoBack:!1,canGoForward:!1}}var dc;function fc(){return(fc=e((()=>{dc=`openclaw:native-history-state`,typeof window<`u`&&window.dispatchEvent(new Event(`openclaw:native-window-chrome-available`))})))()}function pc(){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(Xo);return t===null?null:yo(t)}function mc(e){let t=pc(),n=t===``&&es(e)?``:t||js(e);return[n,t??n]}function hc(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function gc(e){return`${e.pathname}${e.search}${e.hash}`}function _c(){let e=window.history.state;if(e&&typeof e==`object`&&`openclawNativeEmbedDepth`in e){let t=e.openclawNativeEmbedDepth;if(typeof t==`number`&&Number.isSafeInteger(t)&&t>=0)return t}return 0}function vc(){return _c()>0}function yc(){let e=lc(),t=new Set,n,r=()=>{if(n)return;let e=()=>{let e=hc();for(let n of t)n(e)};window.addEventListener(`popstate`,e),n=()=>window.removeEventListener(`popstate`,e)},i=()=>{t.size===0&&(n?.(),n=void 0)};return{location:hc,push:t=>window.history.pushState(e?{openclawNativeEmbedDepth:_c()+1}:{},``,gc(t)),replace:t=>window.history.replaceState(e?{openclawNativeEmbedDepth:_c()}:{},``,gc(t)),listen:e=>(t.add(e),r(),()=>{t.delete(e),i()})}}function bc(){return(bc=e((()=>{Fa(),Y(),fc()})))()}function xc(e,t){let n=e!==`sw.js`&&typeof document<`u`?document.documentElement.getAttribute(bo):null,r=n?`?v=${encodeURIComponent(n)}`:``;return`${yo(t??``)}/${e}${r}`}function Sc(e,t){return xc(e,t?.resourceBasePath??(t?.pathname===void 0?mc(typeof window>`u`?`/`:window.location.pathname)[1]:js(t.pathname)))}function Cc(){return(Cc=e((()=>{ba(),Y(),bc()})))()}function wc(e){return e===`plugins`||e===`skills`||e===`skill-workshop`}function Tc(e){return e===`sessions`||e===`worktrees`}function Ec(e){return Kc.includes(e)}function Dc(e){if(typeof e!=`string`)return null;if(e.startsWith(`route:`)){let t=e.slice(6);return t===`workboard`?{type:`plugin`,key:`workboard/workboard`}:Ec(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 Qi(t)?{type:`plugin`,key:`workboard/board-${t}`}:null}if(e.startsWith(`plugin:`)){let t=e.slice(7),n=t.indexOf(`/`);return n>0&&n<t.length-1?{type:`plugin`,key:t}:null}return null}function Oc(e){return e.type===`route`?`route:${e.route}`:e.type===`plugin`?`plugin:${e.key}`:`session:${e.key}`}function kc(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Dc(n);if(!e)continue;let r=Oc(e);t.includes(r)||t.push(r)}return t}function Ac(e){let t=new Set(e.flatMap(e=>{let t=Dc(e);return t?.type===`route`?[t.route]:[]}));return Kc.filter(e=>!t.has(e))}function jc(e,t){let n=Un.getLocale();if(Jc!==n&&(Jc=n,Yc=typeof Intl<`u`&&`Segmenter`in Intl?new Intl.Segmenter(n,{granularity:`word`}):null),!Yc)return e.split(/[^\p{L}\p{N}]+/u).some(e=>e.startsWith(t));for(let n of Yc.segment(e))if(n.isWordLike!==!1&&n.segment.startsWith(t))return!0;return!1}function Mc(e,t){let n=Ko(e).normalize(`NFC`),r=Ko(t).normalize(`NFC`);return r?r.length>2?n.includes(r):jc(n,r):!1}function Nc(e,t,n=null){if(e===`device`)return n!==null;if(e===`device-permissions`){let e=n?.snapshot;return!!(e&&(e.permissions.entries.length>0||e.permissions.location||e.capabilities?.activeComputerPresenceEnabled!==void 0))}return e===`updates`?t||n!==null:t||Zc.has(e)}function Pc(e){let t=e?.device;if(t?.platform===`macos`)return`nav.settingsGroupDevice`;if(t?.platform===`linux`||t?.platform===`windows`)return`nav.settingsGroupThisComputer`;if(t?.platform===`ios`){if(t.formFactor===`phone`)return`nav.settingsGroupThisIPhone`;if(t.formFactor===`pad`)return`nav.settingsGroupThisIPad`}return`nav.settingsGroupThisDevice`}function Fc(e,t=null){return Xc.map(n=>({labelKey:n.labelKey===`nav.settingsGroupDevice`?Pc(t?.snapshot):n.labelKey,routes:n.routes.filter(n=>Nc(n,e,t))})).filter(e=>e.routes.length>0)}function X(e,t){return[e,`tabs.${t}`,`subtitles.${t}`]}function Ic(e){return tl.has(e)}function Lc(e){return e!==void 0&&Ic(e)}function Rc(e){return el[e]??e}function zc(e){return nl[e]?.[0]??`folder`}function Bc(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){Vc(e,n),s();return}e.has(o)||e.set(o,globalThis.setTimeout(s,50))}function Vc(e,t){let n=t.currentTarget;if(!n)return;let r=e.get(n);r!==void 0&&(globalThis.clearTimeout(r),e.delete(n))}function Hc(e){let[,t]=nl[e];return P(t)}function Uc(e){let t=e.context.endsWith(`OpenClaw`)?e.context:`${e.context} — OpenClaw`;return e.gatewayDisconnected?`(${P(`connection.disconnectedTitle`)}) ${t}`:e.attentionCount&&e.attentionCount>0?`(${e.attentionCount}) ${t}`:t}function Wc(e,t){return e===`device`&&t?P(Pc(t)):e===`custodian`?P(`nav.askOpenClaw`):Hc(e)}function Gc(e){let t=nl[e][2];return P(t)}var Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl;function rl(){return(rl=e((()=>{ta(),w(),Kc=[`agents-home`,`dashboards`,`usage`,`cron`,`sessions`,`systems`,`activity`,`meetings`,`plugins`,`apps`,`portals`],qc=[`agents-home`,`dashboards`,`systems`,`cron`,`plugins`].map(e=>Oc({type:`route`,route:e})),Jc=``,Yc=null,Xc=[{labelKey:null,routes:[`custodian`,`profile`,`appearance`,`notifications`]},{labelKey:`nav.settingsGroupDevice`,routes:[`device`,`device-permissions`]},{labelKey:`nav.settingsGroupConnections`,routes:[`connection`,`channels`,`communications`,`talk`,`devices`,`cloud-workers`]},{labelKey:`nav.settingsGroupAgents`,routes:[`agents`,`model-providers`,`search`,`plugin-settings`,`skill-settings`,`mcp`,`memory`,`automation`]},{labelKey:`nav.settingsGroupSecurity`,routes:[`security`,`secrets`,`approvals`]},{labelKey:`nav.settingsGroupSystem`,routes:[`infrastructure`,`labs`,`advanced`,`debug`,`logs`,`updates`,`about`]}],Zc=new Set([`profile`,`appearance`,`notifications`,`connection`,`channels`,`talk`,`devices`,`agents`,`model-providers`,`search`,`plugin-settings`,`skill-settings`,`memory`,`approvals`,`advanced`,`debug`,`logs`,`about`]),Qc=[`config`,`ai-agents`,`model-setup`,`lobsterdex`],$c=[`ai-agents`],el={"ai-agents":`agents`,"model-setup":`model-providers`},tl=new Set([...Xc.flatMap(e=>e.routes),...Qc]),nl={settings:[`settings`,`nav.settings`,`common.settingsSections`],"agents-home":X(`bot`,`agentsHome`),agents:X(`bot`,`agents`),activity:X(`activity`,`activity`),meetings:X(`book`,`meetings`),apps:X(`layoutGrid`,`apps`),portals:X(`monitor`,`portals`),approvals:X(`badgeCheck`,`approvals`),workboard:X(`kanban`,`workboard`),worktrees:X(`folder`,`worktrees`),channels:X(`link`,`channels`),connection:X(`radio`,`connection`),sessions:X(`fileText`,`sessions`),systems:X(`monitor`,`systems`),usage:X(`coins`,`usage`),cron:X(`calendarClock`,`cron`),skills:X(`bookOpenText`,`skills`),"skill-settings":X(`bookOpenText`,`skills`),plugins:X(`plug`,`plugins`),"plugin-settings":X(`plug`,`plugins`),"skill-workshop":X(`wrench`,`skillWorkshop`),device:X(`monitor`,`device`),"device-permissions":X(`shieldCheck`,`devicePermissions`),devices:X(`monitorSmartphone`,`devices`),"cloud-workers":X(`server`,`cloudWorkers`),chat:X(`messageSquare`,`chat`),terminal:[`terminal`,`terminal.title`,`terminal.open`],dashboard:X(`layoutDashboard`,`chat`),dashboards:X(`layoutDashboard`,`dashboards`),custodian:X(`lobster`,`custodian`),config:[`settings`,`nav.settings`,`subtitles.config`],profile:X(`circleUser`,`profile`),communications:X(`send`,`communications`),appearance:X(`palette`,`appearance`),lobsterdex:X(`bug`,`lobsterdex`),automation:X(`terminal`,`automation`),mcp:X(`wrench`,`mcp`),memory:X(`book`,`memory`),search:X(`search`,`search`),talk:X(`mic`,`talk`),infrastructure:X(`globe`,`infrastructure`),labs:X(`flaskConical`,`labs`),updates:X(`download`,`updates`),about:X(`fileText`,`about`),"ai-agents":X(`brain`,`aiAgents`),"model-setup":X(`spark`,`modelSetup`),"model-providers":[`box`,`routeTitles.modelProviders`,`subtitles.modelProviders`],"memory-import":X(`download`,`memoryImport`),notifications:[`bell`,`routeTitles.notifications`,`subtitles.notifications`],security:X(`shieldCheck`,`security`),secrets:[`key`,`tabs.secrets`,`secretsStore.hint`],advanced:[`fileCode`,`routeTitles.advanced`,`subtitles.advanced`],debug:X(`bug`,`debug`),logs:X(`scrollText`,`logs`),plugin:X(`plug`,`plugin`),"new-session":[`plus`,`newSession.title`,`newSession.hint`]}})))()}function il(){return typeof window>`u`?void 0:window}function al(){return(al=e((()=>{})))()}function ol(){let e=il()?.webkit?.messageHandlers?.openclawWindowDrag;return e?.postMessage.bind(e)}function sl(e){if(e.button!==0||e.defaultPrevented)return;for(let t of e.composedPath())if(t instanceof Element&&t.matches(ll))return;let t=ol();if(t){try{t({type:`window-drag`})}catch{return}e.preventDefault()}}function cl(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||sl(e)}var ll;function ul(){return(ul=e((()=>{ll=`a, button, input, select, textarea, [role='button'], [role='tab'], [role='menu'], [role^='menuitem'], [contenteditable]`})))()}var dl;function fl(){return(fl=e((()=>{L(),dl=z`
<svg viewBox="0 0 24 24" class="icon--filled" width="16" height="16" fill="currentColor" stroke="none" aria-hidden="true">
<path
d="M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56 0-.27-.01-1.17-.02-2.12-3.2.7-3.87-1.36-3.87-1.36-.52-1.33-1.28-1.68-1.28-1.68-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.19 1.76 1.19 1.03 1.76 2.7 1.25 3.36.96.1-.75.4-1.25.72-1.54-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.28 1.19-3.09-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.78 0c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.83 1.19 3.09 0 4.42-2.7 5.39-5.26 5.68.41.35.78 1.05.78 2.12 0 1.53-.01 2.76-.01 3.14 0 .3.21.67.8.55A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"
/>
</svg>
`})))()}function pl(e){hl=e}function ml(){return hl}var hl;function gl(){return(gl=e((()=>{hl={mascot:`claw`,critters:[]}})))()}function _l({fill:e,glyph:t}){let n=e=>e.replaceAll(`&`,`&`).replaceAll(`"`,`"`).replaceAll(`<`,`<`);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${vl.viewBox}" fill="none"><rect x="${vl.inset}" y="${vl.inset}" width="${vl.size}" height="${vl.size}" rx="${vl.radius}" fill="${n(e)}"/><path d="${vl.glyph}" fill="none" stroke="${n(t)}" stroke-width="${vl.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"/></svg>`}var vl,yl;function bl(){return(bl=e((()=>{L(),gl(),vl={viewBox:`0 0 120 120`,inset:8,size:104,radius:28,glyph:`M40 42L62 60L40 78M68 80H88`,strokeWidth:11},yl=z`<svg viewBox=${vl.viewBox} width="100%" height="100%" fill="none" aria-hidden="true">
<rect
x=${vl.inset}
y=${vl.inset}
width=${vl.size}
height=${vl.size}
rx=${vl.radius}
style="fill: var(--primary); stroke: none"
/>
<path
d=${vl.glyph}
style="fill: none; stroke: var(--primary-foreground)"
stroke-width=${vl.strokeWidth}
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>`})))()}function Z(e,t){return F`
<svg
viewBox="0 0 24 24"
style=${t??I}
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
${e}
</svg>
`}var xl,Sl;function Cl(){return(Cl=e((()=>{L(),bl(),xl={"⌘":z`<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3" />`,"⌥":z`<path d="M3 3h6l6 18h6M14 3h7" />`,"⇧":z`<path d="M9 19a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-6a1 1 0 0 1 1-1h3.293a.707.707 0 0 0 .5-1.207l-7.086-7.086a1 1 0 0 0-1.414 0l-7.086 7.086a.707.707 0 0 0 .5 1.207H8a1 1 0 0 1 1 1z" />`,"⌃":z`<path d="m18 15-6-6-6 6" />`,"⏎":z`<polyline points="9 10 4 15 9 20" /><path d="M20 4v7a4 4 0 0 1-4 4H4" />`,"↑":z`<path d="M12 19V5m-7 7 7-7 7 7" />`,"↓":z`<path d="M12 5v14m7-7-7 7-7-7" />`,"←":z`<path d="m12 19-7-7 7-7M19 12H5" />`,"→":z`<path d="M5 12h14m-7-7 7 7-7 7" />`},Sl={bookOpenText:Z(z`<path d="M12 5v16M16 13h2M16 9h2" />
<path d="M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z" />
<path d="M6 13h2M6 9h2" />`),mark:yl,shieldCheck:Z(z`<path d="M20 13c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V5l8-3 8 3zM9 12l2 2 4-4" />`),shieldX:Z(z`<path d="M20 13c0 5-3.5 7.5-8 9-4.5-1.5-8-4-8-9V5l8-3 8 3zM9.5 9.5l5 5m0-5-5 5" />`),cpu:Z(z` <rect width="16" height="16" x="4" y="4" rx="2" />
<rect width="6" height="6" x="9" y="9" rx="1" />
<path d="M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2" />`),foldVertical:Z(z`<path d="M12 22v-6M12 8V2M4 12H2M10 12H8M16 12h-2M22 12h-2M19 9l-3 3 3 3M5 15l3-3-3-3" />`),wrench:Z(z` <path
d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
/>`),fileCode:Z(z` <path
d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
/>
<polyline points="14 2 14 8 20 8" />
<path d="M10 13l-2 2 2 2M14 17l2-2-2-2" />`),edit:Z(z`<path
d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"
/>`),home:Z(z` <path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
<polyline points="9 22 9 12 15 12 15 22" />`),cloud:Z(z`<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z" />`),penLine:Z(z`<path d="M12 20h9M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" />`),paperclip:Z(z` <path
d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"
/>`),globe:Z(z` <circle cx="12" cy="12" r="10" />
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
<path d="M2 12h20" />`),image:Z(z` <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />`),copyImage:Z(z` <rect width="14" height="14" x="8" y="8" rx="2" />
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
<circle cx="13" cy="13" r="1" />
<path d="m21 18-3-3-5 5" />`),camera:Z(z` <path
d="M14.5 4 16 7h3a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h3l1.5-3z"
/>
<circle cx="12" cy="13" r="3" />`),cameraOff:Z(z`<path
d="M14.564 14.558a3 3 0 1 1-4.122-4.121M2 2l20 20M20 20H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 .819-.175M9.695 4.024A2 2 0 0 1 10.004 4h3.993a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v7.344"
/>`),smartphone:Z(z` <rect width="14" height="20" x="5" y="2" rx="2" ry="2" />
<path d="M12 18h.01" />`),circleQuestionMark:Z(z` <circle cx="12" cy="12" r="10" />
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3M12 17h.01" />`),plug:Z(z`<path d="M12 22v-5M9 8V2M15 8V2M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />`),circle:Z(z`<circle cx="12" cy="12" r="10" />`),hourglass:Z(z`<path d="M5 2h14M5 22h14M7 2v5l10 10v5M17 2v5L7 17v5" />`),puzzle:Z(z` <path
d="M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.076.874.54 1.02 1.02a2.5 2.5 0 1 0 3.237-3.237c-.48-.146-.944-.505-1.02-1.02a.98.98 0 0 1 .303-.917l1.526-1.526A2.402 2.402 0 0 1 11.998 2c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.236 3.236c-.464.18-.894.527-.967 1.02Z"
/>`),panelLeft:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M9 3v18" />`),panelLeftClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M9 3v18M16 10l-3 2 3 2" />`),panelLeftOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M9 3v18M14 10l3 2-3 2" />`),chevronDown:Z(z`<path d="M6 9l6 6 6-6" />`),chevronRight:Z(z`<path d="M9 18l6-6-6-6" />`),chevronLeft:Z(z`<path d="M15 18l-6-6 6-6" />`),externalLink:Z(z`<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3" />`),send:Z(z`<path d="m22 2-7 20-4-9-9-4ZM22 2 11 13" />`),forward:Z(z`<path d="m15 17 5-5-5-5M4 18v-2a4 4 0 0 1 4-4h12" />`),stop:Z(z`<rect width="14" height="14" x="5" y="5" rx="1" />`),pin:Z(z` <line x1="12" x2="12" y1="17" y2="22" />
<path
d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"
/>`),pinOff:Z(z` <line x1="2" x2="22" y1="2" y2="22" />
<line x1="12" x2="12" y1="17" y2="22" />
<path
d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0-.39.04"
/>`),download:Z(z` <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" x2="12" y1="15" y2="3" />`),mic:Z(z`<path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3ZM19 10v2a7 7 0 0 1-14 0v-2M12 19v3" />`),volume2:Z(z` <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
<path d="M15.54 8.46a5 5 0 0 1 0 7.07M19.07 4.93a10 10 0 0 1 0 14.14" />`),volumeX:Z(z` <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
<path d="m22 9-6 6" />
<path d="m16 9 6 6" />`),bookmark:Z(z`<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" />`),plus:Z(z`<path d="M5 12h14M12 5v14" />`),gitBranch:Z(z` <circle cx="6" cy="5" r="2" />
<circle cx="18" cy="6" r="2" />
<circle cx="6" cy="19" r="2" />
<path d="M6 7v10M8 9h5a5 5 0 0 0 5-5" />`),gitFork:Z(z` <circle cx="6" cy="6" r="3" />
<circle cx="18" cy="6" r="3" />
<circle cx="12" cy="18" r="3" />
<path d="M6 9a6 6 0 0 0 6 6M18 9a6 6 0 0 1-6 6" />`),gitPullRequest:Z(z` <circle cx="6" cy="6" r="3" />
<circle cx="18" cy="18" r="3" />
<path d="M13 6h3a2 2 0 0 1 2 2v7M6 9v12" />`),gitPullRequestDraft:Z(z` <circle cx="6" cy="6" r="3" />
<circle cx="18" cy="18" r="3" />
<path d="M6 9v12" />
<path d="M18 6v.01" />
<path d="M18 11v.01" />`),gitPullRequestClosed:Z(z` <circle cx="6" cy="6" r="3" />
<path d="M6 9v12" />
<path d="m15 9 6 6" />
<path d="m21 9-6 6" />`),gitMerge:Z(z` <circle cx="6" cy="6" r="3" />
<circle cx="18" cy="18" r="3" />
<path d="M6 21V9a9 9 0 0 0 9 9" />`),terminal:Z(z` <polyline points="4 17 10 11 4 5" />
<line x1="12" x2="20" y1="19" y2="19" />`),squareTerminal:Z(z` <path d="m7 11 2-2-2-2M11 13h4" />
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" />`),listTree:Z(z`<path d="M21 12h-8M21 6H8M21 18h-8M3 6v4c0 1.1.9 2 2 2h3M3 10v6c0 1.1.9 2 2 2h3" />`),claw:Z(z` <path
d="M8.2 10 A5.2 5.2 0 1 0 8.2 20.4 A5.2 5.2 0 0 0 8.2 10 Z M10.2 20 C14.5 20.8 19 18.6 22.3 13.2 C21 12.9 19.7 12.7 18.4 12.8 L17.5 14.6 L16 12.9 L14.3 14.5 L13.5 13 L11.5 14.2 Z"
/>
<path
class="claw-icon__jaw"
d="M5.6 12.2 C5.2 5.6 10.4 1.4 15.6 2 C19.4 2.6 21.8 5.2 22.6 8.2 C20.9 7.7 19.2 7.6 17.6 7.9 L16.9 6.3 L15.2 8.5 C13.6 9.4 12.2 10.9 11.6 12.4 L6.8 13 Z"
/>`),spark:Z(z` <path
d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"
/>`),lobster:F`
<svg viewBox="0 0 120 120" fill="none">
<defs>
<linearGradient id="lob-g" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color: var(--lobster-icon-body, #ff4d4d)" />
<stop offset="100%" style="stop-color: var(--lobster-icon-shade, #991b1b)" />
</linearGradient>
</defs>
<path
d="M60 10C30 10 15 35 15 55C15 75 30 95 45 100L45 110L55 110L55 100C55 100 60 102 65 100L65 110L75 110L75 100C90 95 105 75 105 55C105 35 90 10 60 10Z"
fill="url(#lob-g)"
/>
<path d="M20 45C5 40 0 50 5 60C10 70 20 65 25 55C28 48 25 45 20 45Z" fill="url(#lob-g)" />
<path
d="M100 45C115 40 120 50 115 60C110 70 100 65 95 55C92 48 95 45 100 45Z"
fill="url(#lob-g)"
/>
<path
d="M45 15Q35 5 30 8"
style="stroke: var(--lobster-icon-body, #ff4d4d)"
stroke-width="3"
stroke-linecap="round"
/>
<path
d="M75 15Q85 5 90 8"
style="stroke: var(--lobster-icon-body, #ff4d4d)"
stroke-width="3"
stroke-linecap="round"
/>
<circle cx="45" cy="35" r="6" style="fill: var(--lobster-icon-eye, #050810)" />
<circle cx="75" cy="35" r="6" style="fill: var(--lobster-icon-eye, #050810)" />
<circle cx="46" cy="34" r="2.5" fill="#00e5cc" />
<circle cx="76" cy="34" r="2.5" fill="#00e5cc" />
</svg>
`,circleUser:Z(z` <path d="M18 20a6 6 0 0 0-12 0" />
<circle cx="12" cy="10" r="4" />
<circle cx="12" cy="12" r="10" />`),bell:Z(z`<path
d="M10.268 21a2 2 0 0 0 3.464 0M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"
/>`),palette:Z(z` <path
d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"
/>
<circle cx="13.5" cy="6.5" r=".5" fill="currentColor" />
<circle cx="17.5" cy="10.5" r=".5" fill="currentColor" />
<circle cx="6.5" cy="12.5" r=".5" fill="currentColor" />
<circle cx="8.5" cy="7.5" r=".5" fill="currentColor" />`),flaskConical:Z(z`<path
d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2M6.453 15h11.094M8.5 2h7"
/>`),badgeCheck:Z(z` <path
d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"
/>
<path d="m9 12 2 2 4-4" />`),refresh:Z(z`<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8M21 3v5h-5" />`),rotateCcw:Z(z`<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8M3 3v5h5" />`),trash:Z(z`<path
d="M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6"
/>`),eye:Z(z` <path
d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"
/>
<circle cx="12" cy="12" r="3" />`),eyeOff:Z(z`<path
d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"
/>`),arrowUpDown:Z(z`<path d="M21 16l-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16" />`),panelRightOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M15 3v18M10 10l-3 2 3 2" />`),panelRightClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M15 3v18M8 10l3 2-3 2" />`),columns2:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M12 3v18" />`),panelBottomOpen:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 15h18M10 8l2 3 2-3" />`),panelBottomClose:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" />
<path d="M3 15h18M10 11l2-3 2 3" />`),maximize:Z(z` <polyline points="15 3 21 3 21 9" />
<polyline points="9 21 3 21 3 15" />
<line x1="21" x2="14" y1="3" y2="10" />
<line x1="3" x2="10" y1="21" y2="14" />`),minimize:Z(z` <polyline points="4 14 10 14 10 20" />
<polyline points="20 10 14 10 14 4" />
<line x1="14" x2="21" y1="10" y2="3" />
<line x1="3" x2="10" y1="21" y2="14" />`)}})))()}function wl(e){return Tl[e]}var Tl;function El(){return(El=e((()=>{L(),fl(),Cl(),Tl={github:dl,repeat:Z(z`<path d="m17 2 4 4-4 4"/><path d="M3 11V9a3 3 0 0 1 3-3h15M7 22l-4-4 4-4"/><path d="M21 13v2a3 3 0 0 1-3 3H3"/>`),layers:Z(z`<path d="m12 3 10 5-10 5L2 8Z"/><path d="m2 12 10 5 10-5M2 16l10 5 10-5"/>`),messageCircle:Z(z`<path
d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"
/>`),messageSquare:Z(z` <path
d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
/>`),messageSquarePlus:Z(z` <path
d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
/>
<path d="M12 7v6" />
<path d="M9 10h6" />`),messageCircleOff:Z(z` <path d="m2 2 20 20" />
<path
d="M4.93 4.929a10 10 0 0 0-1.938 11.412 2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 0 0 11.302-1.989"
/>
<path d="M8.35 2.69A10 10 0 0 1 21.3 15.65" />`),layoutGrid:Z(z` <rect width="7" height="7" x="3" y="3" rx="1" />
<rect width="7" height="7" x="14" y="3" rx="1" />
<rect width="7" height="7" x="14" y="14" rx="1" />
<rect width="7" height="7" x="3" y="14" rx="1" />`),barChart:Z(z` <line x1="12" x2="12" y1="20" y2="10" />
<line x1="18" x2="18" y1="20" y2="4" />
<line x1="6" x2="6" y1="20" y2="16" />`),layoutDashboard:Z(z` <rect width="7" height="9" x="3" y="3" rx="1" />
<rect width="7" height="5" x="14" y="3" rx="1" />
<rect width="7" height="9" x="14" y="12" rx="1" />
<rect width="7" height="5" x="3" y="16" rx="1" />`),coins:Z(z` <circle cx="8" cy="8" r="6" />
<path d="M18.09 10.37A6 6 0 1 1 10.34 18" />
<path d="M7 6h1v4" />
<path d="m16.71 13.88.7.71-2.82 2.82" />`),activity:Z(z` <path d="M22 12h-4l-3 9L9 3l-3 9H2" />`),clock:Z(z` <circle cx="12" cy="12" r="10" />
<polyline points="12 6 12 12 16 14" />`),circleX:Z(z` <circle cx="12" cy="12" r="10" />
<path d="m15 9-6 6" />
<path d="m9 9 6 6" />`),arrowLeftRight:Z(z`<path d="m8 3-4 4 4 4" />
<path d="M4 7h16" />
<path d="m16 21 4-4-4-4" />
<path d="M20 17H4" />`),arrowUpRight:Z(z` <path d="M7 17 17 7" />
<path d="M7 7h10v10" />`),link:Z(z` <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />`),radio:Z(z` <circle cx="12" cy="12" r="2" />
<path
d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"
/>`),fileText:Z(z` <path
d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"
/>
<polyline points="14 2 14 8 20 8" />
<line x1="16" x2="8" y1="13" y2="13" />
<line x1="16" x2="8" y1="17" y2="17" />
<line x1="10" x2="8" y1="9" y2="9" />`),file:Z(z` <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />`),fileDiff:Z(z` <path
d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.7.71l3.59 3.58A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"
/>
<path d="M9 10h6" />
<path d="M12 13V7" />
<path d="M9 17h6" />`),diff:Z(z` <path d="M12 3v14" />
<path d="M5 10h14" />
<path d="M5 21h14" />`),braces:Z(z` <path
d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"
/>
<path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" />`),mail:Z(z` <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" />
<polyline points="22,6 12,13 2,6" />`),outbox:Z(z` <polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
<path d="M2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6" />
<path d="M12 10V3" />
<path d="m8 6 4-4 4 4" />`),inbox:Z(z` <polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
<path d="m5.45 5.11-3.45 6.89v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89a2 2 0 0 0-1.79-1.11h-9.52a2 2 0 0 0-1.79 1.11z" />`),star:Z(z`<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" />`),wandSparkles:Z(z` <path d="M15 4V2" />
<path d="M15 16v-2" />
<path d="M8 9h2" />
<path d="M20 9h2" />
<path d="M17.8 11.8 19 13" />
<path d="M15 9h0" />
<path d="M17.8 6.2 19 5" />
<path d="m3 21 9-9" />
<path d="M12.2 6.2 11 5" />`),chrome:Z(z` <circle cx="12" cy="12" r="10" />
<circle cx="12" cy="12" r="4" />
<line x1="21.17" y1="8" x2="12" y2="8" />
<line x1="3.95" y1="6.06" x2="8.54" y2="14" />
<line x1="10.88" y1="21.94" x2="15.46" y2="14" />`),panelsTopLeft:Z(z` <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
<line x1="3" y1="9" x2="21" y2="9" />
<line x1="9" y1="21" x2="9" y2="9" />`),box:Z(z` <path
d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"
/>
<polyline points="3.27 6.96 12 12.01 20.73 6.96" />
<line x1="12" y1="22.08" x2="12" y2="12" />`),music:Z(z` <path d="M9 18V5l12-2v13" />
<circle cx="6" cy="18" r="3" />
<circle cx="18" cy="16" r="3" />`),asterisk:Z(z` <path d="M12 2v6" />
<path d="m4.93 10.93 4.24 4.24" />
<path d="M2 12h6" />
<path d="m4.93 13.07 4.24-4.24" />
<path d="M12 22v-6" />
<path d="m19.07 13.07-4.24-4.24" />
<path d="M22 12h-6" />
<path d="m19.07 10.93-4.24 4.24" />`),zap:Z(z`<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />`),monitor:Z(z` <rect width="20" height="14" x="2" y="3" rx="2" />
<line x1="8" x2="16" y1="21" y2="21" />
<line x1="12" x2="12" y1="17" y2="21" />`),monitorSmartphone:Z(z` <path
d="M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8"
/>
<path d="M10 19v-3.96 3.15" />
<path d="M7 19h5" />
<rect width="6" height="10" x="16" y="12" rx="2" />`),server:Z(z` <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
<rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
<line x1="6" x2="6.01" y1="6" y2="6" />
<line x1="6" x2="6.01" y1="18" y2="18" />`),sun:Z(z` <circle cx="12" cy="12" r="4" />
<path d="M12 2v2" />
<path d="M12 20v2" />
<path d="m4.93 4.93 1.41 1.41" />
<path d="m17.66 17.66 1.41 1.41" />
<path d="M2 12h2" />
<path d="M20 12h2" />
<path d="m6.34 17.66-1.41 1.41" />
<path d="m19.07 4.93-1.41 1.41" />`),moon:Z(z` <path d="M12 3a6.5 6.5 0 0 0 9 9 9 9 0 1 1-9-9Z" />`),settings:Z(z` <path
d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"
/>
<circle cx="12" cy="12" r="3" />`),bug:Z(z` <path d="m8 2 1.88 1.88" />
<path d="M14.12 3.88 16 2" />
<path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1" />
<path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6" />
<path d="M12 20v-9" />
<path d="M6.53 9C4.6 8.8 3 7.1 3 5" />
<path d="M6 13H2" />
<path d="M3 21c0-2.1 1.7-3.9 3.8-4" />
<path d="M20.97 5c0 2.1-1.6 3.8-3.5 4" />
<path d="M22 13h-4" />
<path d="M17.2 17c2.1.1 3.8 1.9 3.8 4" />`),scrollText:Z(z` <path
d="M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4"
/>
<path d="M19 17V5a2 2 0 0 0-2-2H4" />
<path d="M15 8h-5" />
<path d="M15 12h-5" />`),folder:Z(z` <path
d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
/>`),kanban:Z(z` <rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M8 7v7" />
<path d="M12 7v4" />
<path d="M16 7v9" />`),bot:Z(z` <path d="M12 8V4H8" />
<rect width="16" height="12" x="4" y="8" rx="2" />
<path d="M2 14h2" />
<path d="M20 14h2" />
<path d="M15 13v2" />
<path d="M9 13v2" />`),users:Z(z` <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" />
<circle cx="9" cy="7" r="4" />
<path d="M22 21v-2a4 4 0 0 0-3-3.87" />
<path d="M16 3.13a4 4 0 0 1 0 7.75" />`),shieldQuestion:Z(z` <path
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
/>
<path d="M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3" />
<path d="M12 17h.01" />`),shield:Z(z` <path
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
/>`),shieldEllipsis:Z(z` <path
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
/>
<path d="M8 12h.01" /><path d="M12 12h.01" /><path d="M16 12h.01" />`),shieldLock:Z(z` <path
d="M20 9.807V6a1 1 0 0 0-1-1c-2 0-4.49-1.19-6.24-2.72a1.17 1.17 0 0 0-1.52 0C9.5 3.8 7 5 5 5a1 1 0 0 0-1 1v7c0 3.88 2.107 6.254 5 7.796"
/>
<path d="M19 17v-2a2 2 0 0 0-4 0v2" />
<rect x="13" y="17" width="8" height="5" rx="1" />`),shieldCog:Z(z` <path d="m10.929 14.467-.383.924" />
<path d="M10.929 8.923 10.546 8" />
<path d="M13.225 8.923 13.608 8" />
<path d="m13.607 15.391-.382-.924" />
<path d="m14.849 10.547.923-.383" />
<path d="m14.849 12.843.923.383" />
<path
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
/>
<path d="m9.305 10.547-.923-.383" />
<path d="m9.305 12.843-.923.383" />
<circle cx="12.077" cy="11.695" r="3" />`),shieldAlert:Z(z` <path
d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"
/>
<path d="M12 8v4" />
<path d="M12 16h.01" />`),menu:Z(z` <line x1="4" x2="20" y1="12" y2="12" />
<line x1="4" x2="20" y1="6" y2="6" />
<line x1="4" x2="20" y1="18" y2="18" />`),x:Z(z` <path d="M18 6 6 18" />
<path d="m6 6 12 12" />`),check:Z(z`<path d="M20 6 9 17l-5-5" />`),info:Z(z`<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`),square:Z(z`<rect width="18" height="18" x="3" y="3" rx="2" />`),play:Z(z`<polygon points="6 3 20 12 6 21 6 3" />`),pause:Z(z` <rect x="14" y="4" width="4" height="16" rx="1" />
<rect x="6" y="4" width="4" height="16" rx="1" />`),target:Z(z` <circle cx="12" cy="12" r="10" />
<circle cx="12" cy="12" r="6" />
<circle cx="12" cy="12" r="2" />`),switchCamera:Z(z` <path d="M11 19H6.5a4.5 4.5 0 0 1 0-9H8" />
<path d="m8 16 3 3-3 3" />
<path d="M13 5h4.5a4.5 4.5 0 0 1 0 9H16" />
<path d="m16 8-3-3 3-3" />`),archive:Z(z` <rect width="20" height="5" x="2" y="3" rx="1" />
<path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" />
<path d="M10 12h4" />`),archiveRestore:Z(z` <rect width="20" height="5" x="2" y="3" rx="1" />
<path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" />
<path d="m9 15 3-3 3 3" />
<path d="M12 12v6" />`),alertTriangle:Z(z` <path
d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"
/>
<path d="M12 9v4" />
<path d="M12 17h.01" />`),globeOff:Z(z` <path
d="M10.114 4.462A14.5 14.5 0 0 1 12 2a10 10 0 0 1 9.313 13.643"
/>
<path d="M15.557 15.556A14.5 14.5 0 0 1 12 22 10 10 0 0 1 4.929 4.929" />
<path d="M15.892 10.234A14.5 14.5 0 0 0 12 2a10 10 0 0 0-3.643.687" />
<path d="M17.656 12H22" />
<path d="M19.071 19.071A10 10 0 0 1 12 22 14.5 14.5 0 0 1 8.44 8.45" />
<path d="M2 12h10" />
<path d="m2 2 20 20" />`),hand:Z(z` <path d="M18 11V6a2 2 0 0 0-4 0v5" />
<path d="M14 10V4a2 2 0 0 0-4 0v6" />
<path d="M10 10.5V6a2 2 0 0 0-4 0v8" />
<path d="M6 14v-2a2 2 0 0 0-4 0v4c0 4.4 3.6 8 8 8h2c4.4 0 8-3.6 8-8v-5a2 2 0 0 0-4 0v2" />`),key:Z(z` <circle cx="7.5" cy="15.5" r="5.5" />
<path d="m21 2-9.6 9.6" />
<path d="m15.5 7.5 3 3L22 7l-3-3" />`),flag:Z(z` <path d="M5 22V4" />
<path d="M5 4c5-4 9 4 14 0v11c-5 4-9-4-14 0" />`),lock:Z(z` <rect width="18" height="11" x="3" y="11" rx="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" />`),pencil:Z(z` <path
d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
/>
<path d="m15 5 4 4" />`),pipette:Z(z` <path
d="m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12"
/>
<path
d="m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z"
/>
<path d="m2 22 .414-.414" />`),pencilSparkles:Z(z` <path d="M10 3H8" />
<path d="m15.007 5.008 3.987 3.986" />
<path d="M20 15v4" />
<path
d="M21.174 6.813a2.82 2.82 0 0 0-3.986-3.987L3.842 16.175a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
/>
<path d="M22 17h-4" />
<path d="M4 5v4" />
<path d="M6 7H2" />
<path d="M9 2v2" />`),layoutComfortable:Z(z` <rect width="16" height="5" x="4" y="4" rx="1.5" />
<rect width="16" height="5" x="4" y="15" rx="1.5" />
<line x1="7" x2="16" y1="7" y2="7" />
<line x1="7" x2="16" y1="18" y2="18" />`),layoutCompact:Z(z` <rect width="16" height="3" x="4" y="4" rx="1" />
<rect width="16" height="3" x="4" y="9" rx="1" />
<rect width="16" height="3" x="4" y="14" rx="1" />
<rect width="16" height="3" x="4" y="19" rx="1" />`),listFilter:Z(z` <path d="M3 6h18" />
<path d="M7 12h10" />
<path d="M10 18h4" />`),gripVertical:Z(z` <circle cx="9" cy="6" r="1.1" fill="currentColor" stroke="none" />
<circle cx="9" cy="12" r="1.1" fill="currentColor" stroke="none" />
<circle cx="9" cy="18" r="1.1" fill="currentColor" stroke="none" />
<circle cx="15" cy="6" r="1.1" fill="currentColor" stroke="none" />
<circle cx="15" cy="12" r="1.1" fill="currentColor" stroke="none" />
<circle cx="15" cy="18" r="1.1" fill="currentColor" stroke="none" />`),arrowDown:Z(xl[`↓`]),arrowUp:Z(xl[`↑`]),audioLines:Z(z`<path d="M2 10v3" />
<path d="M6 6v11" />
<path d="M10 3v18" />
<path d="M14 8v7" />
<path d="M18 5v13" />
<path d="M22 10v3" />`),chevronUp:Z(xl[`⌃`]),chevronsUpDown:Z(z`<path d="m7 15 5 5 5-5" />
<path d="m7 9 5-5 5 5" />`),arrowRight:Z(xl[`→`]),arrowLeft:Z(xl[`←`]),cornerDownLeft:Z(xl[`⏎`]),cornerUpLeft:Z(z` <polyline points="9 14 4 9 9 4" />
<path d="M20 20v-7a4 4 0 0 0-4-4H4" />`),cornerDownRight:Z(z` <polyline points="15 10 20 15 15 20" />
<path d="M4 4v7a4 4 0 0 0 4 4h12" />`),copy:Z(z` <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />`),search:Z(z` <circle cx="11" cy="11" r="8" />
<path d="m21 21-4.3-4.3" />`),wrapText:Z(z` <path d="M3 6h18" />
<path d="M3 12h15a3 3 0 1 1 0 6h-4" />
<path d="m16 16-2 2 2 2" />
<path d="M3 18h7" />`),brain:Z(z` <path
d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"
/>
<path
d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"
/>
<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4" />
<path d="M17.599 6.5a3 3 0 0 0 .399-1.375" />
<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
<path d="M3.477 10.896a4 4 0 0 1 .585-.396" />
<path d="M19.938 10.5a4 4 0 0 1 .585.396" />
<path d="M6 18a4 4 0 0 1-1.967-.516" />
<path d="M19.967 17.484A4 4 0 0 1 18 18" />`),book:Z(z` <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20" />`),loader:Z(z` <path d="M12 2v4" />
<path d="m16.2 7.8 2.9-2.9" />
<path d="M18 12h4" />
<path d="m16.2 16.2 2.9 2.9" />
<path d="M12 18v4" />
<path d="m4.9 19.1 2.9-2.9" />
<path d="M2 12h4" />
<path d="m4.9 4.9 2.9 2.9" />`),calendarClock:Z(z` <path
d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"
/>
<path d="M16 2v4" />
<path d="M8 2v4" />
<path d="M3 10h5" />
<path d="M17.5 17.5 16 16.3V14" />
<circle cx="16" cy="16" r="6" />`),listChecks:Z(z` <path d="m3 17 2 2 4-4" />
<path d="m3 7 2 2 4-4" />
<path d="M13 6h8" />
<path d="M13 12h8" />
<path d="M13 18h8" />`),moreHorizontal:Z(z` <circle cx="5" cy="12" r="1" />
<circle cx="12" cy="12" r="1" />
<circle cx="19" cy="12" r="1" />`),...Sl}})))()}function Dl(e){return Object.hasOwn(xl,e)}function Ol(e){let t=e===`↵`?`⏎`:e;return Dl(t)?F`<span
class="kbd__symbol"
style="position:relative;display:inline-block;width:1em;height:1em"
><span
style="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap"
>${e}</span
><span aria-hidden="true" style="position:absolute;inset:0;display:flex;align-items:center"
>${Z(xl[t],`width:1em;height:1em;stroke-width:2.3`)}</span
></span
>`:F`<span class="kbd__text">${e}</span>`}function kl(e,t={}){let n=typeof e==`string`||typeof e==`number`?[String(e)]:e;return F`<kbd
class=${`shortcut-kbd${t.className?` ${t.className}`:``}`}
style=${t.inline?`font:inherit`:I}
slot=${t.slot??I}
aria-hidden=${t.ariaHidden?`true`:I}
?hidden=${t.hidden}
${t.ref?Di(t.ref):I}
>${n.map(Ol)}</kbd
>`}function Al(e,t={}){let n=t.applePlatform??Bo(),r=xi(e,n);return t.separateKeys?F`${r.map(e=>kl(e,t))}`:kl(n?r:r.flatMap((e,t)=>t===0?[e]:[`+`,e]),t)}function jl(e,t){return F`${e}${` (`}${Al(t,{inline:!0})})`}function Ml(e,t){return F`${e.split(`{shortcut}`).map((e,n)=>n===0?e:F`${t}${e}`)}`}function Nl(){return(Nl=e((()=>{L(),ki(),zt(),Cl()})))()}function Pl(e){return H(e)&&e.type===`sw-updated`&&typeof e.version==`string`&&e.version!==Il.buildId}function Fl(e){if(e.controlUiBuildSource===`configured`)return!1;let t=Il.buildId?.trim(),n=e.buildId?.trim();if(t&&t!==`dev`&&n)return t!==n;let r=Il.version?.trim(),i=e.version?.trim();return!!(r&&i&&r!==i)}var Il;function Ll(){return(Ll=e((()=>{Il={version:`2026.10.4`,commit:`383c124cc32ffee3f8e56f549b88da94d269a4af`,builtAt:`2026-10-15T17:18:22.749Z`,release:!0,commitAt:`2026-10-15T07:58:34.000Z`,branch:`release-ci/383c124cc32f-1792084080131`,dirty:!0,buildId:`2026.10.4-release-383c124cc32f-2026-10-15T17-18-22.749Z`}})))()}function Rl(e,t){let n={canReload:e,onBlocked:t};return Bl.add(n),()=>void Bl.delete(n)}function zl(e=!1){let t=[...Bl].find(e=>!e.canReload());return t&&e&&t.onBlocked(),!t}var Bl;function Vl(){return(Vl=e((()=>{Bl=new Set})))()}function Hl(e){return e instanceof Error&&tu.test(e.message)}function Ul(e=new URL(window.location.href)){e.searchParams.set(`openclaw_mount_recovery`,String(Date.now())),window.location.replace(e.href)}function Wl(){if(iu)return iu;let e=(async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),$l);try{let t=new URL(window.location.href),[n,r]=mc(t.pathname);return t.pathname=`${r}/index.html`,t.search=``,t.hash=``,(await fetch(t.href,{method:`HEAD`,cache:`no-store`,signal:e.signal})).ok}catch{return!1}finally{clearTimeout(t)}})().finally(()=>{iu===e&&(iu=null)});return iu=e,e}function Gl(e,t){if(!e)return!1;try{return e.setItem(Zl,t),!0}catch{return!1}}async function Kl(e={}){if(e.canReload?.()===!1||!zl())return!1;let t=e.storage===void 0?Ti():e.storage,n=e.buildId??Il.buildId;try{if(t?.getItem(Zl)===n)return!1}catch{}let r=Date.now(),i=t??ru,a=nu.get(i)??[new Map,n],o=a[0],s=a[1];if(e.buildId===void 0&&s!==null&&s!==n&&(o.get(s)?.active??0)>0)return!1;for(let[e,t]of o)t.active===0&&r-t.attemptedAt>=Ql&&o.delete(e);let c=o.get(n);if(c&&(c.active===0||a[1]!==n))return!1;let l=c??{attemptedAt:r,active:0};if(!c&&e.buildId!==void 0){let e=Math.floor(Math.random()*eu);e>0&&(l.ready=Oa(e))}l.active+=1,o.set(n,l),a[1]=n,nu.set(i,a);try{if(l.ready&&await l.ready,!await ql({timeoutMs:e.buildId===void 0?0:void 0},()=>e.canReload?.()!==!1&&zl()&&a[1]===n))return!1}finally{--l.active,l.attemptedAt=Date.now()}let u=e.reload??Ul;return!zl()||e.canReload?.()===!1||a[1]!==n||!Gl(t,n)?!1:(a[1]=null,u(),!0)}async function ql(e,t){let n=Date.now()+(e.timeoutMs??au);for(let e=0;;e+=1){if(!t())return!1;let r=n-Date.now();if(e>0&&r<=0)return!1;let i=await Ja(Wl,r>0?r:$l,()=>!1);if(!t())return!1;if(i)return!0;let a=n-Date.now();if(a<=0)return!1;await new Promise(e=>{setTimeout(e,Math.min(ou,a))})}}async function Jl(e={}){if(!await ql(e,()=>e.canReload?.()!==!1&&zl(!0))||e.canReload?.()===!1||!zl(!0))return!1;let t=e.storage===void 0?Ti():e.storage,n=t??ru,r=e.reload??Ul,i=nu.get(n)??[new Map,Il.buildId];nu.set(n,i);let a=i[1];return a!==null&&(i[1]=null,Gl(t,a),r(),!0)}function Yl(){let e=e=>{let t=e.payload;Hl(t)&&Kl()};return window.addEventListener(`vite:preloadError`,e),()=>window.removeEventListener(`vite:preloadError`,e)}function Xl(){let e=!1,t=!1,n=null,r=()=>{window.removeEventListener(`load`,o),window.removeEventListener(`error`,s,!0)},i=()=>{if(t||n)return;n=document.createElement(`div`),n.role=`alert`,n.style.cssText=`position:fixed;inset:0 0 auto;z-index:2147483647;padding:12px;text-align:center;background:#1f2937;color:#fff;font:14px system-ui`;let e=document.createElement(`button`);e.textContent=P(`common.reload`),e.addEventListener(`click`,()=>void Jl({timeoutMs:0})),n.append(P(`lazyView.stylesFailed`),` `,e),document.body.append(n)},a=async()=>{e||t||(e=!0,r(),await Kl()||i())};function o(){if(getComputedStyle(document.documentElement).getPropertyValue(`--openclaw-css-ok`).trim()===`1`){r();return}a()}function s(e){let t=e.target;t instanceof HTMLLinkElement&&t.relList.contains(`stylesheet`)&&a()}return window.addEventListener(`error`,s,!0),document.readyState===`complete`?o():window.addEventListener(`load`,o,{once:!0}),()=>{t=!0,r(),n?.remove(),n=null}}var Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou;function su(){return(su=e((()=>{Ga(),Ll(),w(),bc(),Vl(),Zl=`openclaw.controlUi.staleChunkReloadBuildId`,Ql=5e3,$l=3e3,eu=2e3,tu=/importing a module script failed|failed to fetch dynamically imported module|error loading dynamically imported module|unable to preload css/i,nu=new WeakMap,ru={},iu=null,au=3e4,ou=1e3})))()}function cu(e,t){if(customElements.get(e))return Promise.resolve();let n=uu.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(()=>{uu.delete(e)});return uu.set(e,r),r}function lu(e){return customElements.get(e.tagName)!==void 0}var uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au;function ju(){return(ju=e((()=>{w(),su(),K(),uu=new Map,du=class{constructor(e,t,n=e=>Jl({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){lu(e)||this.preloads.has(e.tagName)||(this.preloads.add(e.tagName),cu(e.tagName,e.loadModule).then(()=>this.host.requestUpdate(),n=>{t?.reportError&&!this.current&&(this.current={element:e,error:n,stale:Hl(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&&!lu(this.active)&&this.request(this.active)}load(e){cu(e.element.tagName,e.element.loadModule).then(async()=>{this.host.requestUpdate(),this.current===e&&(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:Hl(t),status:`error`},this.host.requestUpdate())})}},fu={tagName:`openclaw-command-palette`,label:`command palette`,loadModule:()=>W(()=>import(`./command-palette-C4J0pnIL.js`),__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,24,25,26,27,28,29,30,31,32,33,34,35,36,37]),import.meta.url)},pu={tagName:`openclaw-debug-overlay`,get label(){return P(`debug.overlay.title`)},loadModule:()=>W(()=>import(`./debug-overlay-M8snAaYH.js`),__vite__mapDeps([38,1,28]),import.meta.url)},mu={tagName:`openclaw-keyboard-shortcuts-dialog`,get label(){return P(`shortcutsOverlay.title`)},loadModule:()=>W(()=>import(`./keyboard-shortcuts-dialog-CnISCcj1.js`),__vite__mapDeps([39,1,11,3,2,4,5,8,7,6,9,12,13,14,15,28,29,30,31]),import.meta.url)},hu=`openclaw-app-sidebar`,gu={tagName:hu,label:hu,loadModule:()=>W(()=>import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.Cn(),e.Sn)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url)},_u=`openclaw-macos-titlebar-controls`,vu={tagName:_u,label:_u,loadModule:()=>W(()=>import(`./macos-titlebar-controls.runtime-B094_r0z.js`),__vite__mapDeps([40,1,28]),import.meta.url)},yu={tagName:`openclaw-sidebar-attention`,label:P(`attention.issues`),loadModule:()=>W(()=>import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.gr(),e._r)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url)},bu={tagName:`openclaw-terminal-panel`,label:`terminal panel`,loadModule:()=>W(()=>import(`./terminal-panel-registration-DwNbVu-U.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([41,1,5,4,17,3,2,8,7,6,9,10,11,12,13,14,15,18,16,19,20,42,43,44,45,46,47,48,28,29,30,31,32,33,34]),import.meta.url)},xu={tagName:`openclaw-browser-panel`,label:`browser panel`,loadModule:()=>W(()=>import(`./browser-panel-CpBLyCyg.js`).then(e=>(e.n(),e.t)),__vite__mapDeps([49,1,11,3,2,4,5,8,7,6,9,12,13,14,15,17,10,18,16,19,20,42,43,44,50,45,46,28,29,30,31,32,33,34]),import.meta.url)},Su={tagName:`openclaw-browser-document`,label:xu.label,loadModule:()=>W(()=>import(`./browser-document-DcyyNtT-.js`),__vite__mapDeps([51,1,12,3,2,4,5,8,7,6,9,11,13,14,15,49,17,10,18,16,19,20,42,43,44,50,45,46,28,29,30,31,32,33,34]),import.meta.url)},Cu={tagName:`openclaw-desktop-panel`,label:`desktop panel`,loadModule:()=>W(()=>import(`./desktop-panel-DON9OquX.js`).then(e=>(e.n(),e.t)),__vite__mapDeps([52,1,13,3,2,4,5,8,7,6,9,11,12,14,15,53,10,18,17,16,19,20,54,42,43,50,27,55,28,29,31,30,32,33,34,56]),import.meta.url)},wu={tagName:`openclaw-link-reader-panel`,get label(){return P(`linkReader.title`)},loadModule:()=>W(()=>import(`./link-reader-panel-DRh0JX44.js`),__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,12,11,13,14,15,43,44,58,28,29,30,31]),import.meta.url)},Tu={tagName:`openclaw-board-document`,label:`dashboard document`,loadModule:()=>W(()=>import(`./board-document-moYm3_VL.js`),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,17,10,11,12,13,14,15,18,16,19,20,60,61,62,63,64,28,29,30,31,32,33,34,65,66]),import.meta.url)},Eu={tagName:`openclaw-approval-page`,label:`approval page`,loadModule:()=>W(()=>import(`./approval-page-registration-BQEjGJz-.js`),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,12,11,13,14,15,68,28,29,30,31,69]),import.meta.url)},Du=`openclaw-question-page`,Ou={tagName:Du,label:Du,loadModule:()=>W(()=>import(`./question-page-registration-DRlvkUky.js`),__vite__mapDeps([70,1,12,3,2,4,5,8,7,6,9,11,13,14,15,54,10,18,53,17,16,19,20,68,28,29,30,31,32,33,34,56,69]),import.meta.url)},ku={tagName:`openclaw-exec-approval`,get label(){return P(`tabs.approvals`)},loadModule:()=>W(()=>import(`./exec-approval-3rJoRXhI.js`),__vite__mapDeps([71,1,12,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url)},Au={tagName:`openclaw-login-gate`,label:`login screen`,loadModule:()=>W(()=>import(`./login-runtime-ULR4eeNT.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([72,1,11,3,2,4,5,8,7,6,9,12,13,14,15,28,29,30,31]),import.meta.url)}})))()}var Mu;function Nu(){return(Nu=e((()=>{L(),Mu=Ii`
.shortcut-kbd:where(:not([hidden])) {
display: inline-flex;
align-items: center;
justify-content: center;
vertical-align: middle;
}
.shortcut-kbd > span + span {
margin-inline-start: 0.15em;
}
.kbd__text {
text-box: trim-both cap alphabetic;
}
.shortcut-kbd::before {
content: "";
height: 1lh;
}
`})))()}function Pu(e){return e.replace(/\s+/g,` `).trim()}function Fu(e){return typeof e==`object`&&!!e&&`namespaceURI`in e&&(e.namespaceURI===`http://www.w3.org/1999/xhtml`||e.namespaceURI===`http://www.w3.org/2000/svg`)}function Iu(e){return e.nodeType===Node.ELEMENT_NODE}function Lu(e,t){let n=e.ownerDocument.defaultView?.getComputedStyle(e);if(e.hasAttribute(`hidden`)||!t&&e.getAttribute(`aria-hidden`)===`true`||n?.display===`none`||n?.contentVisibility===`hidden`)return``;let r=n?.visibility!==`hidden`&&n?.visibility!==`collapse`&&(n?.display===`contents`||typeof e.checkVisibility!=`function`||e.checkVisibility({checkOpacity:t,checkVisibilityCSS:!0}));return[...e.childNodes].map(e=>Iu(e)?Lu(e,t):e.nodeType===Node.TEXT_NODE&&r?e.textContent??``:``).join(` `)}function Ru(e){return Lu(e,!1)}function zu(e){return e.matches(`[data-tooltip-overflow]`)||e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight}function Bu(e,t){let n=Pu(e),r=Pu(Lu(t,!0));if(!n||!r.includes(n)||zu(t))return!1;for(let e of t.querySelectorAll(`*`))if(Fu(e)&&zu(e))return!1;return!0}function Vu(){return`openclaw-tooltip-${++qu}`}function Hu(e){let t=e?.closest(`openclaw-tooltip`);t&&e?t.focusTriggerWithoutOpening(e):e?.focus()}var Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu;function Zu(){return(Zu=e((()=>{L(),Li(),ju(),Sr(),Xn(),qe(),Nu(),K(),Uu=`a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])`,Wu=150,Gu=300,Ku=100,qu=0,Ju=class extends ci{constructor(...e){super(...e),this.delay=Wu,this.skipDelay=Gu,this.delayed=!0,this.#e=`keyboard`,this.#t=null,this.#r=e=>{[`Alt`,`Control`,`Meta`,`Shift`].includes(e.key)||(this.#e=`keyboard`)},this.#i=()=>{this.#e=`pointer`}}#e;#t;connectedCallback(){super.connectedCallback(),this.style.display=`contents`,this.#e=`keyboard`,this.ownerDocument.addEventListener(`keydown`,this.#r,!0),this.ownerDocument.addEventListener(`pointerdown`,this.#i,!0)}disconnectedCallback(){this.ownerDocument.removeEventListener(`keydown`,this.#r,!0),this.ownerDocument.removeEventListener(`pointerdown`,this.#i,!0),Yu.closeForProvider(this),this.#n(),this.delayed=!0,super.disconnectedCallback()}focusOpensTooltip(){return this.#e===`keyboard`}openTooltip(){this.delayed=!1,this.#n()}closeTooltip(){if(this.#n(),this.skipDelay<=0){this.delayed=!0;return}this.#t=window.setTimeout(()=>{this.#t=null,this.delayed=!0},this.skipDelay)}#n(){this.#t!==null&&(window.clearTimeout(this.#t),this.#t=null)}#r;#i;render(){return F`<slot></slot>`}},U([B({type:Number})],Ju.prototype,`delay`,void 0),U([B({type:Number})],Ju.prototype,`skipDelay`,void 0),Yu=class e extends ci{constructor(...t){super(...t),this.content=``,this.placement=`top`,this.closeDelay=Ku,this.describe=!0,this.autoSize=!1,this.disabled=!1,this.openOnClick=!1,this.anchor=null,this.materialized=!1,this.#t=null,this.#n=!1,this.#r=null,this.#i=null,this.#a=null,this.#o=!1,this.#s=!1,this.#c=!1,this.#l=null,this.#u=!1,this.#d=!1,this.#f=null,this.#p=null,this.#m=null,this.#h=Vu(),this.#g=`${this.#h}-description`,this.#b=e=>{(!(`pointerType`in e)||e.pointerType!==`touch`)&&(this.#o=!0,this.#c=!1,this.#B(),this.#k())},this.#x=e=>{(!(`pointerType`in e)||e.pointerType!==`touch`)&&(this.#o=!1,this.#c=!0,this.#U(!1),this.#H())},this.#S=e=>{e.pointerType!==`touch`&&(this.#s=!0,this.#c=!1,this.#B(),this.#A())},this.#C=e=>{e.pointerType!==`touch`&&(this.#s=!1,this.#c=!0,this.#H())},this.#w=()=>{this.openOnClick||this.#F()},this.#T=()=>{this.#F()},this.#E=()=>{if(this.#d){this.#d=!1,this.#F();return}this.#m?.focusOpensTooltip()!==!1&&this.#A()},this.#D=e=>{e instanceof FocusEvent&&e.relatedTarget instanceof Node&&this.#P(e.relatedTarget)||this.#n||this.#o||this.#s||this.#F()},this.#O=()=>{if(this.openOnClick&&!this.#n){this.#A(),this.#n=this.hasAttribute(`open`);return}this.#F()},this.#j=t=>{e.consumeEscape(t,this.ownerDocument)},this.#M=e=>{e.composedPath().some(e=>e===this||e===this.#t)||this.#F()},this.#N=e=>{e.pointerType!==`touch`&&this.#c&&this.#a===null&&!e.composedPath().includes(this)&&this.#H(!0)},this.#q=()=>{this.#K(),this.#R(),this.#G||this.#F()}}static#e=new WeakMap;static{this.consumeEscape=(t,n)=>{if(t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.keyCode===229)return!1;let r=e.#e.get(n);if(!r)return!1;t.preventDefault(),t.stopImmediatePropagation();let i=n.activeElement,a=i&&r.contains(i)&&!r.#t?.contains(i)?r.#L():null;return r.#F(),a instanceof HTMLElement&&r.focusTriggerWithoutOpening(a),!0}}static closeForProvider(t){let n=e.#e.get(t.ownerDocument);n&&n.#m===t&&n.#F()}#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;static{this.styles=[Mu,Ii`
:host {
display: contents;
}
wa-tooltip:not(:defined) {
display: none;
}
wa-tooltip {
--max-width: var(--openclaw-tooltip-max-width, min(260px, calc(100vw - 16px)));
--wa-tooltip-arrow-size: var(--openclaw-tooltip-arrow-size, 0px);
--wa-tooltip-background-color: var(
--openclaw-tooltip-background-color,
color-mix(in srgb, var(--bg-elevated) 97%, var(--text) 3%)
);
--wa-tooltip-border-color: var(
--openclaw-tooltip-border-color,
var(--overlay-border, var(--border-strong))
);
--wa-tooltip-border-width: 1px;
--wa-tooltip-border-style: solid;
--wa-tooltip-content-color: var(--text);
--wa-tooltip-border-radius: var(--openclaw-tooltip-border-radius, var(--radius-md));
--show-duration: var(--openclaw-tooltip-popup-show-duration, var(--wa-transition-fast));
--hide-duration: var(--openclaw-tooltip-popup-hide-duration, var(--wa-transition-fast));
font-family: var(--font-body);
}
wa-tooltip::part(body) {
padding: var(--openclaw-tooltip-padding, 5px 7px);
box-shadow: var(--openclaw-tooltip-shadow, var(--overlay-shadow, var(--shadow-md)));
font-size: 11px;
font-weight: 500;
line-height: 1.25;
overflow-wrap: anywhere;
}
:host(.sidebar-hover-tooltip) wa-tooltip[open]::part(base__popup) {
animation: var(--openclaw-tooltip-open-animation);
}
@media (prefers-reduced-motion: reduce) {
wa-tooltip {
--show-duration: 0ms;
--hide-duration: 0ms;
}
:host(.sidebar-hover-tooltip) wa-tooltip[open]::part(base__popup) {
animation: none;
}
}
@keyframes openclaw-tooltip-hover-card-in {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}
.tooltip-content {
display: block;
text-align: center;
white-space: pre-line;
}
.tooltip-rich-content {
display: block;
pointer-events: auto;
text-align: left;
}
`]}connectedCallback(){super.connectedCallback(),this.style.display=`contents`}updated(){this.#_(),this.#R(),this.#y(),(this.disabled||!this.#G||this.hasAttribute(`open`)&&this.#I())&&this.#F()}disconnectedCallback(){this.#F(),this.#p?.disconnect(),this.#p=null,this.#m=null,this.#v(),super.disconnectedCallback()}#_(){let e=this.renderRoot.querySelector(`slot:not([name])`),t=this.anchor??e?.assignedElements({flatten:!0}).find(Fu);if(t===this.#t||(this.#F(),this.#v(),!t))return;this.#t=t,this.#m=null;let n=t;for(;n;){let e=n.closest(`openclaw-tooltip-provider`);if(e){this.#m=e;break}let t=n.getRootNode();n=t instanceof ShadowRoot?t.host:null}t.addEventListener(`pointerenter`,this.#b),t.addEventListener(`pointerleave`,this.#x),t.addEventListener(`pointerdown`,this.#w),t.addEventListener(`pointercancel`,this.#T),t.addEventListener(`focusin`,this.#E),t.addEventListener(`focusout`,this.#D),t.addEventListener(`click`,this.#O,!0),this.#K(),this.#R(),this.#y()}#v(){let e=this.#t;e&&(e.removeEventListener(`pointerenter`,this.#b),e.removeEventListener(`pointerleave`,this.#x),e.removeEventListener(`pointerdown`,this.#w),e.removeEventListener(`pointercancel`,this.#T),e.removeEventListener(`focusin`,this.#E),e.removeEventListener(`focusout`,this.#D),e.removeEventListener(`click`,this.#O,!0),this.#z(),this.#t=null)}previewForAnchor(e,t,n){this.anchor=e,this.content=t,this.updateComplete.then(()=>{this.anchor===e&&e.isConnected&&this.isConnected&&(n===`focus`?this.#E():(this.#o=!0,this.#k()))})}async#y(){let e=this.webAwesomeTooltip;if(!e)return;e.showDelay=0,e.hideDelay=0;let t=this.#t;if(!customElements.get(`wa-tooltip`)){e.anchor=t;return}if(await e.updateComplete,this.webAwesomeTooltip===e&&this.#t===t){e.anchor=t;let n=e.popup;if(!n)return;this.autoSize?n.setAttribute(`auto-size`,`vertical`):n.removeAttribute(`auto-size`),n.autoSizePadding=this.autoSize?8:0,n.shiftPadding=this.autoSize?8:0}}#b;#x;#S;#C;#w;#T;#E;#D;#O;#k(){if(this.disabled||this.hasAttribute(`open`)||this.#i!==null)return;let e=this.#m,t=this.delay===void 0&&e?.delayed===!1?0:Math.max(0,this.delay??e?.delay??Wu);this.#i=window.setTimeout(()=>{this.#i=null,this.#A()},t)}#A(){if(this.disabled||!this.#t||!this.#G||this.#I())return;this.materialized=!0,cu(`wa-tooltip`,()=>W(()=>import(`./tooltip-DzbnNMct.js`),__vite__mapDeps([73,1,5,4,28]),import.meta.url)).then(async()=>{await this.updateComplete,await this.#y();let t=this.webAwesomeTooltip;t&&this.isConnected&&e.#e.get(this.ownerDocument)===this&&(t.placement=this.#J(),t.open=!0)}).catch(t=>{e.#e.get(this.ownerDocument)===this&&(this.#F(),Xr({message:Qt(t)}))}),this.#U(!1);let t=e.#e.get(this.ownerDocument);t&&t!==this&&t.#F(),e.#e.set(this.ownerDocument,this),this.#m?.openTooltip(),this.#R(),this.setAttribute(`open`,``),this.ownerDocument.addEventListener(`pointerdown`,this.#M,!0),this.ownerDocument.addEventListener(`focusin`,this.#M,!0),this.hoverDismissDelay!==void 0&&this.ownerDocument.addEventListener(`pointermove`,this.#N,!0),this.ownerDocument.defaultView?.addEventListener(`keydown`,this.#j,!0)}#j;#M;#N;#P(e){return this.contains(e)||this.#t?.contains(e)===!0}#F(){this.#n=!1,this.removeAttribute(`open`),this.ownerDocument.removeEventListener(`pointerdown`,this.#M,!0),this.ownerDocument.removeEventListener(`focusin`,this.#M,!0),this.ownerDocument.removeEventListener(`pointermove`,this.#N,!0),this.ownerDocument.defaultView?.removeEventListener(`keydown`,this.#j,!0),this.#U(),this.webAwesomeTooltip?.open&&(this.webAwesomeTooltip.open=!1),e.#e.get(this.ownerDocument)===this&&(e.#e.delete(this.ownerDocument),this.#m?.closeTooltip())}#I(){return!this.#W&&this.#t!==null&&Bu(this.content,this.#t)}#L(){let e=this.#t;return e?e.matches(Uu)?e:e.querySelector(Uu)??e:null}#R(){let e=this.#W;if(this.webAwesomeTooltip?.style.setProperty(`pointer-events`,e?`auto`:`none`),!this.describe){this.#z();return}let t=this.#L();if(!t)return;this.#r=t;let n=t.getAttribute(`aria-describedby`);if(this.#u||=(this.#l=n,!0),!this.#f){let e=this.ownerDocument.createElement(`span`);e.id=this.#g,e.hidden=!0;let n=t.getRootNode();(n instanceof ShadowRoot?n:this).append(e),this.#f=e}let r=e||this.content;this.#f.textContent!==r&&(this.#f.textContent=r);let i=new Set((n??``).split(/\s+/u).filter(Boolean));i.add(this.#g);let a=[...i].join(` `);n!==a&&t.setAttribute(`aria-describedby`,a)}#z(){let e=this.#r??this.#t;e&&(this.#l?e.setAttribute(`aria-describedby`,this.#l):e.removeAttribute(`aria-describedby`),this.#r=null,this.#f?.remove(),this.#f=null,this.#l=null,this.#u=!1)}#B(){this.#a!==null&&(window.clearTimeout(this.#a),this.#a=null)}#V(e=!1){if(e)return this.#o||this.#s;let t=this.#t?.getRootNode(),n=t instanceof ShadowRoot?t.activeElement:this.ownerDocument.activeElement;return this.#n||this.#o||this.#s||n instanceof Node&&this.#P(n)}#H(e=!1){if(this.#B(),!this.#V(e)){if(!this.#W){this.#F();return}this.#a=window.setTimeout(()=>{this.#a=null,this.#V(e)||this.#F()},this.hoverDismissDelay??this.closeDelay)}}#U(e=!0){this.#i!==null&&(window.clearTimeout(this.#i),this.#i=null),this.#B(),e&&(this.#o=!1,this.#s=!1,this.#c=!1)}get#W(){return Pu(this.renderRoot.querySelector(`slot[name="content"]`)?.assignedNodes({flatten:!0}).map(e=>e.textContent??``).join(` `)??``)}get#G(){return this.#W||this.content}#K(){this.#p?.disconnect(),this.#p??=new MutationObserver(()=>this.#R());let e=this.renderRoot.querySelector(`slot[name="content"]`);for(let t of e?.assignedNodes({flatten:!0})??[])this.#p.observe(t,{characterData:!0,childList:!0,subtree:!0})}#q;#J(){return(this.placement===`right-start`||this.placement===`right`)&&this.ownerDocument.defaultView?.matchMedia?.(`(max-width: 640px)`).matches?`bottom-start`:this.placement}render(){return F`
<slot @slotchange=${()=>this.#_()}></slot>
${this.materialized?F`<wa-tooltip
id=${this.#h}
placement=${this.#J()}
trigger="manual"
@wa-hide=${()=>this.#F()}
>
<span class="tooltip-content">${this.contentTemplate??this.content}</span>
<span
class="tooltip-rich-content"
@pointerenter=${this.#S}
@pointerleave=${this.#C}
@focusin=${this.#E}
@focusout=${this.#D}
>
<slot name="content" @slotchange=${this.#q}></slot>
</span>
</wa-tooltip>`:F` <slot name="content" hidden @slotchange=${this.#q}></slot> `}
`}focusTriggerWithoutOpening(e){this.#t?.contains(e)&&!e.matches(`:focus`)&&(this.#d=!0),e.focus()}},U([B()],Yu.prototype,`content`,void 0),U([B({attribute:!1})],Yu.prototype,`contentTemplate`,void 0),U([B()],Yu.prototype,`placement`,void 0),U([B({type:Number})],Yu.prototype,`closeDelay`,void 0),U([B({type:Number})],Yu.prototype,`hoverDismissDelay`,void 0),U([B({type:Number})],Yu.prototype,`delay`,void 0),U([B({type:Boolean})],Yu.prototype,`describe`,void 0),U([B({type:Boolean,attribute:`auto-size`})],Yu.prototype,`autoSize`,void 0),U([B({type:Boolean})],Yu.prototype,`disabled`,void 0),U([B({type:Boolean,attribute:`open-on-click`})],Yu.prototype,`openOnClick`,void 0),U([B({attribute:!1})],Yu.prototype,`anchor`,void 0),U([Ni(`wa-tooltip`)],Yu.prototype,`webAwesomeTooltip`,void 0),U([R()],Yu.prototype,`materialized`,void 0),Xu=Yu.consumeEscape,customElements.get(`openclaw-tooltip-provider`)||customElements.define(`openclaw-tooltip-provider`,Ju),customElements.get(`openclaw-tooltip`)||customElements.define(`openclaw-tooltip`,Yu)})))()}var Qu;function $u(){return($u=e((()=>{L(),Li(),ul(),Cc(),w(),qe(),El(),Nl(),Zu(),Qu=class extends Ue{constructor(...e){super(...e),this.navDrawerOpen=!1,this.resourceBasePath=``,this.environment=null}render(){let e=this.navDrawerOpen?P(`nav.collapse`):P(`nav.expand`);return F`
<header class="topbar">
<div class="topnav-shell">
<openclaw-tooltip .content=${e}>
<button
type="button"
class="topbar-icon-btn topbar-nav-toggle"
@click=${e=>this.onToggleDrawer(e.currentTarget)}
aria-label=${e}
aria-expanded=${String(this.navDrawerOpen)}
>
<span class="nav-collapse-toggle__icon" aria-hidden="true">${Tl.menu}</span>
</button>
</openclaw-tooltip>
<div class="topnav-shell__content" @mousedown=${sl}>
<div class="topbar-brand" aria-label="OpenClaw">
<img
class="topbar-brand__logo"
src=${xc(`apple-touch-icon.png`,this.resourceBasePath)}
loading="lazy"
alt=""
aria-hidden="true"
/>
<span class="topbar-brand__title">OpenClaw</span>
${this.environment&&F`<span class="control-ui-environment-pill">${this.environment.label}</span>`}
</div>
</div>
<div class="topnav-shell__actions">
<openclaw-tooltip
.content=${P(`chat.commandPaletteTitle`)}
.contentTemplate=${Ml(P(`chat.commandPaletteTitle`).replace(`⌘K`,`{shortcut}`),kl([`⌘`,`K`],{inline:!0}))}
>
<button
class="topbar-search"
@click=${this.onOpenPalette}
aria-label=${P(`chat.openCommandPalette`)}
>
${Tl.search}
</button>
</openclaw-tooltip>
</div>
</div>
</header>
`}},U([B({attribute:!1})],Qu.prototype,`navDrawerOpen`,void 0),U([B({attribute:!1})],Qu.prototype,`resourceBasePath`,void 0),U([B({attribute:!1})],Qu.prototype,`environment`,void 0),U([B({attribute:!1})],Qu.prototype,`onToggleDrawer`,void 0),U([B({attribute:!1})],Qu.prototype,`onOpenPalette`,void 0),customElements.get(`openclaw-app-topbar`)||customElements.define(`openclaw-app-topbar`,Qu)})))()}function ed(e){let t=nd.get(e);return t||(t=new td,nd.set(e,t)),t}var td,nd;function rd(){return(rd=e((()=>{td=class{constructor(){this.region=`page`,this.listeners=new Set}get current(){return this.region}claim(e){if(this.region!==e){this.region=e;for(let e of this.listeners)e()}}subscribe(e){return Ka(this.listeners,e)}},nd=new WeakMap})))()}var id;function ad(){return(ad=e((()=>{id=Ro(`openclaw.application`)})))()}function od(e,t,n,r=``,i={}){return ha({namespace:e,sessionKey:n,fallbackAgentId:t,basePath:r,displayName:i.displayName??void 0,exactKey:i.exactKey,mainKey:i.mainKey??void 0,shortIdLength:i.shortIdLength??32})}function sd(){return(sd=e((()=>{ja()})))()}function cd(e){let t=e.agentId?.trim()||Mn(e.sessionKey)?.agentId;t&&(e.background?e.selection.set(G(t),{background:!0}):e.selection.set(G(t))),e.gateway.setSessionKey(e.sessionKey)}function ld(e,t,n,r,i={}){let a=e=>{let n=e?.trim()?G(e):null,r=t.state.agentsList;if(!r&&!i.requireConfiguredAgent)return n;let a=r?.agents.filter(e=>!i.requireConfiguredAgent||e.kind!==`system`)??[],o=e=>a.some(t=>G(t.id)===e),s=r?G(r.defaultId):null;return o(n)?n:o(s)?s:a[0]?G(a[0].id):null},o=e=>{let n=e?.trim()?G(e):null;return t.state.agentsList?.agents.some(e=>e.kind===`system`&&G(e.id)===n)?null:n},s=e.connection.gatewayUrl,c=n?.load(s)?.trim(),l=a(c?G(c):e.snapshot.assistantAgentId?G(e.snapshot.assistantAgentId):null),u=i.requireConfiguredAgent&&!t.state.agentsList&&c?G(c):null,d=r?.settings.sidebarAgentsMode===`roster`,f=e=>o(r?.settings.sidebarPreTeamScope===void 0?e:r.settings.sidebarPreTeamScope),p=f(l),m=r?.settings.sidebarPreTeamScope===void 0&&!t.state.agentsList,h=!d&&m,g=new Set(t.state.agentsList?.agents.map(e=>G(e.id))),_={selectedId:l,scopeId:i.requireConfiguredAgent?l:d?null:p},v=e.snapshot.assistantAgentId?G(e.snapshot.assistantAgentId):null,y=!c||!u&&l!==G(c);c&&y&&n?.save(s,null);let b=new Set,x=0,S=x,C=e=>{let t=a(e.selectedId),n=i.requireConfiguredAgent?t:d||t===e.selectedId?e.scopeId:t,r={selectedId:t,scopeId:o(n)};if(_.selectedId!==r.selectedId||_.scopeId!==r.scopeId||S!==x){S=x,_=r;for(let e of b)e(_)}},w=r?.subscribe(()=>{if(e.connection.gatewayUrl!==s)return;let t=r.settings.sidebarAgentsMode===`roster`;t!==d&&(x+=1,d=t,d?(p=_.scopeId,m=h):p=f(p),h=!d&&m,r.patch({sidebarPreTeamScope:d?p:void 0}),C({..._,scopeId:d?null:p}))}),T=e.subscribe(i=>{let a=i.assistantAgentId?G(i.assistantAgentId):null,o=a!==v;v=a;let c=e.connection.gatewayUrl;if(c!==s){s=c,x+=1,u=null;let e=n?.load(s)?.trim();y=!e;let i=e?G(e):a;d=r?.settings.sidebarAgentsMode===`roster`,p=f(i),m=r?.settings.sidebarPreTeamScope===void 0&&!t.state.agentsList,h=!d&&m,g.clear(),C({selectedId:i,scopeId:d?null:p});return}o&&y&&a&&(d||(h=!t.state.agentsList),C({selectedId:a,scopeId:d?_.scopeId:a}))}),E=t.subscribe(()=>{if(i.requireConfiguredAgent){let e=u??(y?v:_.selectedId),r=a(e);t.state.agentsList?(u=null,!y&&r!==e&&(y=!0,n?.save(s,null))):y||(u=e),C({selectedId:r,scopeId:r});return}let e=new Set(t.state.agentsList?.agents.map(e=>G(e.id))),c=_.scopeId;t.state.agentsList&&(p&&(m||g.has(p))&&!e.has(p)&&(p=o(a(p)),d&&r?.patch({sidebarPreTeamScope:p})),m=!1,h=!1,d&&_.scopeId&&g.has(_.scopeId)&&!e.has(_.scopeId)&&(c=null),g=e),!y&&a(_.selectedId)!==_.selectedId&&(y=!0,n?.save(s,null)),C(y&&v?{selectedId:v,scopeId:d||_.selectedId===v?c:v}:{..._,scopeId:c})}),D=(e,r)=>{r?.background||(x+=1);let o=e?.trim()?G(e):null;u=i.requireConfiguredAgent&&!t.state.agentsList?o:null,y=!o||!u&&a(o)!==o,d||(h=!t.state.agentsList),n?.save(s,y?null:o),C({selectedId:o,scopeId:d?_.scopeId:o})};return{get state(){return _},get intentRevision(){return x},set:D,setScope(e){if(i.requireConfiguredAgent){D(e);return}x+=1,h=!1;let t=e?.trim()?G(e):null;C({..._,scopeId:t})},subscribe:e=>Ka(b,e),dispose(){w?.(),T(),E(),b.clear()}}}function ud(){return(ud=e((()=>{Be()})))()}function dd(){return F`<div
class="assistant-panel-loading"
role="status"
aria-live="polite"
aria-label=${P(`common.loading`)}
aria-busy="true"
>
<div class="assistant-panel-loading__content" aria-hidden="true">
<div class="assistant-panel-loading__messages">
<div>
<div class="assistant-panel-loading__lines"><span></span><span></span><span></span></div>
</div>
<div class="assistant-panel-loading__message--reply">
<div class="assistant-panel-loading__lines"><span></span><span></span></div>
</div>
<div>
<div class="assistant-panel-loading__lines"><span></span><span></span></div>
</div>
</div>
<div class="assistant-panel-loading__composer"></div>
</div>
</div>`}function fd(){return(fd=e((()=>{L(),w()})))()}var pd,md;function hd(){return(hd=e((()=>{L(),Li(),w(),qe(),pd=[`pointerup`,`pointercancel`,`blur`],md=class extends ci{constructor(...e){super(...e),this.splitRatio=.6,this.minRatio=.4,this.maxRatio=.7,this.label=``,this.orientation=`vertical`,this.startPosition=0,this.startRatio=0,this.dragRatio=0,this.dragSize=0,this.dragFrame=0,this.pendingPosition=null,this.activePointerId=null,this.handlePointerDown=e=>{if(e.button===0&&this.activePointerId===null&&(this.startPosition=this.orientation===`horizontal`?e.clientY:e.clientX,this.startRatio=this.currentRatio(),this.dragRatio=this.startRatio,this.dragSize=this.measureDragSize(),!(this.dragSize<=0))){this.classList.add(`dragging`),this.capturePointer(e.pointerId),window.addEventListener(`pointermove`,this.handlePointerMove);for(let e of pd)window.addEventListener(e,this.finishDragging);this.addEventListener(`lostpointercapture`,this.finishDragging),e.preventDefault(),this.dispatchEvent(new CustomEvent(`resize-start`,{bubbles:!0,composed:!0}))}},this.handlePointerMove=e=>{e.pointerId===this.activePointerId&&(this.pendingPosition=this.orientation===`horizontal`?e.clientY:e.clientX,this.dragFrame||=requestAnimationFrame(this.flushPointerMove))},this.flushPointerMove=()=>{this.dragFrame=0;let e=this.pendingPosition;this.pendingPosition=null,e!==null&&(this.dragRatio=this.emitResize(this.startRatio+(e-this.startPosition)/this.dragSize))},this.handleKeyDown=e=>{let t=e.shiftKey?.05:.02,n=this.currentRatio(),r=null,i=this.orientation===`horizontal`?`ArrowUp`:`ArrowLeft`,a=this.orientation===`horizontal`?`ArrowDown`:`ArrowRight`;e.key===i?r=n-t:e.key===a?r=n+t:e.key===`Home`?r=this.minRatio:e.key===`End`&&(r=this.maxRatio),r!=null&&(e.preventDefault(),this.emitResize(r),this.emitResize(r,`resize-end`))},this.finishDragging=e=>{`pointerId`in e&&e.pointerId!==this.activePointerId||(this.activePointerId!==null&&(this.dragFrame&&=(cancelAnimationFrame(this.dragFrame),0),this.flushPointerMove(),this.emitResize(this.dragRatio,`resize-end`)),this.stopDragging())}}static{this.styles=Ii`
:host {
width: var(--resize-handle-size, 6px);
cursor: col-resize;
flex-shrink: 0;
position: relative;
touch-action: none;
user-select: none;
}
:host::before {
content: "";
position: absolute;
top: 0;
left: -4px;
right: -4px;
bottom: 0;
}
/* The visible divider is a centered hairline, not the whole gutter:
filling the host paints a fat bar that stacks with neighboring pane
borders into a multi-line smear while dragging. */
:host::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
inset-inline-start: var(--resize-handle-line-inline, 50%);
width: var(--resize-handle-line-size, 1px);
transform: translateX(-50%);
background: var(--resize-handle-rest-color, var(--border, #1e2028));
transition:
background 150ms ease-out,
width 150ms ease-out;
}
:host(:hover)::after,
:host(.dragging)::after,
:host(:focus-visible)::after {
width: var(--resize-handle-active-line-size, 2px);
background: var(--resize-handle-active-color, currentColor);
}
:host(:focus-visible) {
outline: 2px solid var(--accent, #ff5c5c);
outline-offset: 2px;
}
:host([orientation="horizontal"]) {
width: auto;
height: var(--resize-handle-size, 6px);
cursor: row-resize;
}
:host([orientation="horizontal"])::before {
top: -4px;
left: 0;
right: 0;
bottom: -4px;
}
:host([orientation="horizontal"])::after {
top: var(--resize-handle-line-block, 50%);
bottom: auto;
inset-inline-start: 0;
left: 0;
right: 0;
width: auto;
height: var(--resize-handle-line-size, 1px);
transform: translateY(-50%);
transition:
background 150ms ease-out,
height 150ms ease-out;
}
:host([orientation="horizontal"]:hover)::after,
:host([orientation="horizontal"].dragging)::after,
:host([orientation="horizontal"]:focus-visible)::after {
width: auto;
height: var(--resize-handle-active-line-size, 2px);
}
`}render(){return I}connectedCallback(){super.connectedCallback(),this.setStaticAccessibilityAttributes(),this.addEventListener(`pointerdown`,this.handlePointerDown),this.addEventListener(`keydown`,this.handleKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this.handlePointerDown),this.removeEventListener(`keydown`,this.handleKeyDown),this.finishDragging(new Event(`disconnect`))}updated(){this.setAttribute(`aria-valuemin`,String(this.toAriaValue(this.minRatio))),this.setAttribute(`aria-valuemax`,String(this.toAriaValue(this.maxRatio))),this.setCurrentAriaValue(this.currentRatio()),this.setAttribute(`aria-label`,this.label||P(`common.resizeSplitView`)),this.setAttribute(`aria-orientation`,this.orientation)}stopDragging(){let e=this.activePointerId;if(e!==null){this.classList.remove(`dragging`),this.removeEventListener(`lostpointercapture`,this.finishDragging),this.releaseActivePointer(e),this.dragFrame&&=(cancelAnimationFrame(this.dragFrame),0),this.pendingPosition=null,window.removeEventListener(`pointermove`,this.handlePointerMove);for(let e of pd)window.removeEventListener(e,this.finishDragging)}}emitResize(e,t=`resize`){let n=this.clampRatio(e);return t===`resize`&&this.setCurrentAriaValue(n),this.dispatchEvent(new CustomEvent(t,{detail:{splitRatio:n},bubbles:!0,composed:!0})),n}clampRatio(e){return Math.max(this.minRatio,Math.min(this.maxRatio,e))}measureDragSize(){let e=this.measureSize?.()??0;if(e>0)return e;let t=this.previousElementSibling?.getBoundingClientRect(),n=this.nextElementSibling?.getBoundingClientRect(),r=this.orientation===`horizontal`?(t?.height??0)+(n?.height??0):(t?.width??0)+(n?.width??0);if(r>0)return r;let i=this.parentElement?.getBoundingClientRect();return this.orientation===`horizontal`?i?.height??0:i?.width??0}currentRatio(){let e=this.measureRatio?.();return e!==void 0&&Number.isFinite(e)?this.clampRatio(e):this.splitRatio}toAriaValue(e){return Math.round(e*100)}setCurrentAriaValue(e){this.setAttribute(`aria-valuenow`,String(this.toAriaValue(e)))}setStaticAccessibilityAttributes(){this.setAttribute(`role`,`separator`),this.setAttribute(`tabindex`,`0`),this.setAttribute(`aria-orientation`,this.orientation)}capturePointer(e){this.activePointerId=e,typeof this.setPointerCapture==`function`&&this.setPointerCapture(e)}releaseActivePointer(e){this.activePointerId=null,typeof this.releasePointerCapture==`function`&&(typeof this.hasPointerCapture!=`function`||this.hasPointerCapture(e))&&this.releasePointerCapture(e)}},U([B({type:Number})],md.prototype,`splitRatio`,void 0),U([B({type:Number})],md.prototype,`minRatio`,void 0),U([B({type:Number})],md.prototype,`maxRatio`,void 0),U([B({type:String})],md.prototype,`label`,void 0),U([B({type:String,reflect:!0})],md.prototype,`orientation`,void 0),U([B({attribute:!1})],md.prototype,`measureRatio`,void 0),U([B({attribute:!1})],md.prototype,`measureSize`,void 0),customElements.get(`resizable-divider`)||customElements.define(`resizable-divider`,md)})))()}var gd;function _d(){return(_d=e((()=>{L(),hd(),gd=class{constructor(e,t){this.host=e,this.options=t,this.open=!1,this.suppressed=!1,this.persistedOpen=!1,this.onViewportResize=()=>{let e=Math.min(this.height,this.options.layout.maxHeight()),t=Math.min(this.width,this.maxWidth());(e!==this.height||t!==this.width)&&(this.height=e,this.width=t,this.syncReservation(),this.options.onResize?.(),this.host.requestUpdate())},this.dock=t.layout.defaults.dock,this.height=t.layout.defaults.height,this.width=t.layout.defaults.width,e.addController(this)}hostConnected(){if(this.isFullscreen()){this.open=this.options.isAvailable();return}let e=this.options.layout.load();this.persistedOpen=e.open,this.open=e.open&&this.options.isAvailable(),this.dock=e.dock,this.height=e.height,this.width=Math.min(e.width,this.maxWidth()),window.addEventListener(`resize`,this.onViewportResize)}hostDisconnected(){window.removeEventListener(`resize`,this.onViewportResize),this.clearReservation()}setOpen(e,t=!0){this.open=e,this.syncReservation(),t&&this.persist(),this.host.requestUpdate()}hideWithoutPersisting(){this.setOpen(!1,!1)}setSuppressed(e){return this.suppressed!==e&&(this.suppressed=e,e?(this.hideWithoutPersisting(),!1):this.restoreOpenState())}restoreOpenState(){return this.suppressed||!this.options.isAvailable()||this.open||!this.isFullscreen()&&!this.persistedOpen?!1:(this.setOpen(!0,!1),!0)}setDock(e,t=!0){this.dock=e,this.syncReservation(),t&&this.persist(),this.host.requestUpdate()}persist(){this.persistedOpen=this.open,this.options.layout.save({open:this.open,dock:this.dock,height:this.height,width:this.width})}syncReservation(){if(!this.reservesViewport())return;let e=this.options.isAvailable()&&this.open,t=document.documentElement.style;t.setProperty(`--oc-${this.options.reservationPrefix}-reserve-bottom`,e&&this.dock===`bottom`?`${this.height}px`:`0px`),t.setProperty(`--oc-${this.options.reservationPrefix}-reserve-right`,e&&this.dock===`right`?`${this.width}px`:`0px`)}resize(e){let t=this.dock===`bottom`,n=t?this.options.layout.minHeight:this.options.layout.minWidth,r=t?this.options.layout.maxHeight():this.maxWidth(),i=Math.min(r,Math.max(n,(1-e.detail.splitRatio)*this.size()));t?this.height=i:this.width=i,this.syncReservation(),this.options.onResize?.(),this.host.requestUpdate()}size(){return this.dock===`bottom`?window.innerHeight:window.innerWidth}renderResizer(e,t){if(this.isFullscreen()||this.dock===`main`)return I;let n=this.dock===`bottom`,r=this.size(),i=n?this.options.layout.minHeight:this.options.layout.minWidth,a=n?this.options.layout.maxHeight():this.maxWidth(),o=n?this.height:this.width;return F`<resizable-divider
class="${e}-resizer ${e}-resizer--${this.dock}"
.orientation=${n?`horizontal`:`vertical`}
.label=${t}
.splitRatio=${1-o/r}
.minRatio=${1-a/r}
.maxRatio=${1-i/r}
.measureRatio=${()=>1-(n?this.height:this.width)/this.size()}
.measureSize=${()=>this.size()}
@resize=${e=>this.resize(e)}
@resize-end=${()=>this.persist()}
></resizable-divider>`}clearReservation(){if(!this.reservesViewport())return;let e=document.documentElement.style;e.setProperty(`--oc-${this.options.reservationPrefix}-reserve-bottom`,`0px`),e.setProperty(`--oc-${this.options.reservationPrefix}-reserve-right`,`0px`)}reservesViewport(){return this.options.reserveViewport!==!1&&!this.isFullscreen()&&!(this.host instanceof HTMLElement&&this.host.hasAttribute(`embedded`))}isFullscreen(){return this.options.isFullscreen?.()===!0}maxWidth(){return Math.max(this.options.layout.minWidth,Math.min(this.options.layout.maxWidth(),this.options.maxWidth?.()??1/0))}}})))()}function vd(e){let t={open:!1,dock:e.defaultDock,height:e.defaultHeight,width:e.defaultWidth},n=()=>Math.max(e.minHeight,Math.floor((globalThis.innerHeight||800)*.8)),r=()=>Math.max(e.minWidth,Math.floor((globalThis.innerWidth||1280)*.8)),i=(e,t,n,r)=>Math.min(typeof e==`number`&&Number.isFinite(e)&&e>=t?e:r,n);return{defaults:t,minHeight:e.minHeight,minWidth:e.minWidth,maxHeight:n,maxWidth:r,load(){try{let a=globalThis.localStorage?.getItem(e.storageKey);if(!a)return{...t};let o=JSON.parse(a);return{open:!!o.open,dock:e.supportedDocks.includes(o.dock)?o.dock:t.dock,height:i(o.height,e.minHeight,n(),t.height),width:i(o.width,e.minWidth,r(),t.width)}}catch{return{...t}}},save(t){try{globalThis.localStorage?.setItem(e.storageKey,JSON.stringify(t))}catch{}}}}var yd,bd,xd;function Sd(){return(Sd=e((()=>{yd=vd({storageKey:`openclaw.terminal.panel.v1`,minHeight:140,minWidth:320,defaultDock:`bottom`,supportedDocks:[`bottom`,`right`,`main`],defaultHeight:320,defaultWidth:520}),bd=vd({storageKey:`openclaw.browser.panel.v1`,minHeight:240,minWidth:380,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:560}),xd=vd({storageKey:`openclaw.custodian.panel.v1`,minHeight:240,minWidth:320,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:440})})))()}function Cd(){return F`<div class="loading-skeleton" aria-hidden="true">
<div class="loading-skeleton__header">
<div class="skeleton loading-skeleton__avatar"></div>
<div class="skeleton skeleton-line loading-skeleton__title"></div>
</div>
<div class="loading-skeleton__messages">
<div class="loading-skeleton__message loading-skeleton__message--user">
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line skeleton-line--medium"></div>
</div>
<div class="loading-skeleton__message">
<div class="skeleton loading-skeleton__avatar"></div>
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line skeleton-line--long"></div>
<div class="skeleton skeleton-line skeleton-line--medium"></div>
</div>
</div>
<div class="skeleton loading-skeleton__composer"></div>
</div>`}function wd(e){return F`<main
class="connect-splash connect-splash--skeleton"
role="status"
aria-live="polite"
aria-label=${e??P(`common.loading`)}
>
<div class="connect-splash__layout" aria-hidden="true" @mousedown=${sl}>
<aside class="connect-splash__sidebar">
<div class="skeleton loading-skeleton__avatar"></div>
<div class="skeleton connect-splash__new-session"></div>
${[85,65,75,55,80,60].map(e=>F`<div class="skeleton skeleton-line" style=${`width: ${e}%`}></div>`)}
</aside>
${Cd()}
</div>
${e?F`<span class="connect-splash__status">${e}</span>`:I}
</main>`}function Td(){return(Td=e((()=>{L(),ul(),w()})))()}function Ed(){return F`
<section
class="lazy-view-state lazy-view-state--loading"
role="status"
aria-live="polite"
aria-label=${P(`common.loading`)}
>
${Cd()}
</section>
`}function Dd(){return(Dd=e((()=>{L(),w(),Td()})))()}function Od(){return F`<section class="agent-startup-state" role="status" aria-live="polite">
<span class="btn__spinner" aria-hidden="true"></span>
<div>${P(`agentStartup.title`)}</div>
<div>${P(`agentStartup.description`)}</div>
</section>`}function kd(e,t,n){return e.status===`loading`?Ed():jd({actionLabel:P(`common.retry`),error:e.error,stale:e.stale,subtitle:e.element.label,onRetry:t,onClose:n})}function Ad(e){let t=e.visibleState;if(!t)return I;let n=()=>e.close(),r=t.status===`loading`;return F`<openclaw-modal-dialog
class=${r?`lazy-element-loading-modal`:I}
label=${t.element.label}
@modal-cancel=${n}
>
${r?F`<section class="lazy-element-loading">
<header class="lazy-element-loading__header">
<h2>${t.element.label}</h2>
<button
class="btn btn--ghost btn--icon"
type="button"
aria-label=${P(`common.close`)}
@click=${n}
>
${wl(`x`)}
</button>
</header>
<div
class="lazy-element-loading__status"
role="status"
aria-live="polite"
aria-label=${P(`common.loading`)}
>
<span class="btn__spinner" aria-hidden="true"></span>
<span>${P(`common.loading`)}</span>
</div>
</section>`:kd(t,()=>e.retry(),n)}
</openclaw-modal-dialog>`}function jd({actionLabel:e,error:t,onClose:n,onRetry:r,render:i,stale:a=!1,subtitle:o}){let s=Qt(t);return F`
${i?.()??I}
${Md({title:P(a?`lazyView.staleTitle`:`lazyView.errorTitle`),subtitle:o??P(a?`lazyView.staleSubtitle`:`lazyView.genericSubtitle`),actions:F`
<button class="btn lazy-view-error__action" @click=${r}>
${e??P(a?`common.reload`:`lazyView.retry`)}
</button>
${n?F`<button class="btn" type="button" @click=${n}>
${P(`common.close`)}
</button>`:I}
`,detail:s,inline:!!i,stale:a})}
`}function Md({actions:e,className:t,detail:n,inline:r=!1,role:i=`alert`,stale:a=!1,subtitle:o,title:s}){let c=`lazy-view-error${r?` lazy-view-error--inline`:``}${a?` lazy-view-error--stale`:``}${t?` ${t}`:``}`;return F`
<div class=${c} role=${i}>
<div class="lazy-view-error__icon" aria-hidden="true">
${wl(a?`refresh`:`alertTriangle`)}
</div>
<div class="lazy-view-error__title">${s}</div>
<div class="lazy-view-error__subtitle">${o}</div>
${e?F`<div class="lazy-view-error__actions">${e}</div>`:I}
${n?F`<details class="lazy-view-error__details">
<summary>${P(`chat.details`)}</summary>
<code class="lazy-view-error__detail">${n}</code>
</details>`:I}
</div>
`}function Nd(){return(Nd=e((()=>{L(),w(),Sr(),El(),Dd()})))()}function Pd(e){return hi(N.terminalPanel,e)}function Fd(e){return hi(N.homePanel,e)}var Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd;function Jd(){return(Jd=e((()=>{zt(),Id=`openclaw:terminal-toggle`,Ld=`openclaw:terminal-dock-bottom`,Rd=`openclaw:browser-toggle`,zd=`openclaw:desktop-toggle`,Bd=`openclaw:portal-toggle`,Vd=`openclaw:home-toggle`,Hd=`openclaw:custodian-toggle`,Ud=`openclaw:debug-overlay-request`,Wd=`openclaw:keyboard-shortcuts-request`,Gd=`openclaw:link-reader-panel-toggle`,Kd=`openclaw:plugin-panel-toggle`,qd=`openclaw:ui-command`})))()}var Yd,Xd;function Zd(){return(Zd=e((()=>{Ya(),L(),Li(),rl(),Y(),rd(),ad(),ju(),ul(),w(),ar(),me(),Be(),qe(),s(),Ee(),mn(),fd(),_d(),Sd(),El(),Nd(),Jd(),K(),Yd={tagName:`openclaw-assistant-panel-content`,get label(){return P(`assistantPanel.title`)},loadModule:()=>W(()=>import(`./assistant-panel-content-COU9ZNyM.js`),__vite__mapDeps([74,1,3,2,4,5,8,7,6,9,75,11,12,13,14,15,76,17,10,18,16,19,20,77,78,54,53,28,29,30,31,32,33,34,79,56,80,81]),import.meta.url)},Xd=class extends g{constructor(){super(),this.custodianAvailable=!1,this.homeAvailable=!1,this.custodianSuppressed=!1,this.pageSessionKey=``,this.pageAgentId=``,this.pageRouteId=`chat`,this.pageRouteFailed=!1,this.homeStarted=!1,this.pendingPrimaryPane=null,this.destination=`custodian`,this.builtInDestination=`custodian`,this.publishedSessionKey=null,this.contentLoader=new du(this),this.minimizeRequestId=0,this.dockLayout=new gd(this,{layout:xd,reservationPrefix:`assistant`,isAvailable:()=>this.available}),this.onToggleRequest=e=>this.handleToggleRequest(e),this.handledMinimizeRequestId=0,this.targetScope=``,this.homeDefaults={},this.startHomeAfterPrimaryChat=()=>{if(this.homeStarted||!this.dockLayout.open||this.destination!==`home`)return;if(this.pageRouteId!==`chat`||this.pageRouteFailed){this.homeStarted=!0;return}let e=this.primaryChatPane();if(!e?.transcriptReady||this.pendingPrimaryPane===e)return;this.pendingPrimaryPane=e;let t=this.context;Promise.resolve().then(()=>e.updateComplete).then(()=>{this.pendingPrimaryPane===e&&(this.pendingPrimaryPane=null,this.isConnected&&this.context===t&&this.primaryChatPane()===e&&e.transcriptReady&&(this.homeStarted=!0))})},new In(this).effect(()=>this.context?.assistantDock,e=>e.attach(this)).watch(()=>this.context,(e,t)=>Pt(e,t)).watchStore(()=>this.store).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.context?.agents).watchStore(()=>this.context?.gateway)}connectedCallback(){super.connectedCallback(),document.addEventListener(Ge,this.startHomeAfterPrimaryChat),document.addEventListener(v,this.startHomeAfterPrimaryChat),window.addEventListener(Hd,this.onToggleRequest),window.addEventListener(Vd,this.onToggleRequest),this.dockLayout.setSuppressed(this.restoreSuppressed)}disconnectedCallback(){document.removeEventListener(Ge,this.startHomeAfterPrimaryChat),document.removeEventListener(v,this.startHomeAfterPrimaryChat),this.pendingPrimaryPane=null,window.removeEventListener(Hd,this.onToggleRequest),window.removeEventListener(Vd,this.onToggleRequest),typeof this.destination!=`string`&&this.closeSession(),this.claimInput(`page`),super.disconnectedCallback()}willUpdate(){let e=this.dockLayout.open,t=this.context?.gateway.connection.gatewayUrl??``;if(t!==this.targetScope){this.targetScope=t,this.homeStarted=!1,this.pendingPrimaryPane=null,this.homeDefaults={};let e=null;try{e=uo(JSON.parse(Le()?.getItem(this.targetStorageKey)??`null`))}catch{}this.destination=e?.destination===`home`?`home`:`custodian`,this.builtInDestination=this.destination}this.context?.gateway.snapshot.phase===`connected`&&(this.homeDefaults={agentsList:this.context.agents.state.agentsList??this.homeDefaults.agentsList,hello:this.context.gateway.snapshot.hello}),this.dockLayout.setSuppressed(this.restoreSuppressed),this.minimizeRequestId>0&&this.minimizeRequestId!==this.handledMinimizeRequestId&&this.custodianAvailable&&this.store&&(this.handledMinimizeRequestId=this.minimizeRequestId,typeof this.destination==`string`&&this.store.hasRealUserTurn()&&this.openDestination(`custodian`)),this.available?this.dockLayout.restoreOpenState():this.dockLayout.hideWithoutPersisting(),e&&!this.dockLayout.open&&this.claimInput(`page`),typeof this.destination==`string`&&this.context&&this.custodianAvailable&&!this.custodianSuppressed&&window.innerWidth>1100&&$n(this.context)&&this.openDestination(`custodian`),this.startHomeAfterPrimaryChat(),this.contentLoader.requestWhileActive(Yd,this.dockLayout.open&&(this.destination!==`home`||this.homeStarted)||this.custodianAvailable&&this.minimizeRequestId>this.handledMinimizeRequestId),this.dockLayout.syncReservation(),this.publishSessionKey()}primaryChatPane(){return[...(this.closest(`openclaw-app-shell`)??this.parentElement)?.querySelectorAll(`openclaw-chat-pane.chat-pane-cache__pane--active`)??[]].find(e=>e.presented!==!1&&e.sessionKey&&wt(e.sessionKey,this.pageSessionKey))}get targetStorageKey(){return`openclaw.assistant.panel.target.v1:${this.targetScope}`}persistTarget(){if(typeof this.destination==`string`)try{Le()?.setItem(this.targetStorageKey,JSON.stringify({destination:this.destination}))}catch{}}get homeTarget(){let e=this.homeDefaults,t=kr(e.agentsList?.agents??[]),n=ge(e),r=this.context?.agentSelection.state.selectedId,i=r?G(r):``,a=t.find(e=>e.id===i)?.id??t.find(e=>e.id===n)?.id??t[0]?.id??n;return{...oe(e,Ha({agentId:a,mainKey:T(e)}),a),agentId:a}}availableFor(e){return typeof e!=`string`||(e===`home`?this.homeAvailable:this.custodianAvailable)}get available(){return this.availableFor(this.destination)}get suppressed(){if(this.destination===`custodian`)return this.custodianSuppressed;let e=this.context,t=this.destination===`home`?this.pageRouteId===`chat`:xs(this.pageRouteId);if(!e||!t)return!1;let n=oe(this.homeDefaults,this.pageSessionKey,this.pageAgentId),r=typeof this.destination==`string`?this.homeTarget:oe(this.homeDefaults,this.destination.params.sessionKey,this.destination.params.agentId);return n.sessionKey===r.sessionKey&&G(n.agentId)===G(r.agentId)}claimInput(e){this.context&&ed(this.context).claim(e)}get restoreSuppressed(){return this.suppressed||this.destination===`custodian`&&Lc(this.pageRouteId)}openSession(e,t){typeof this.destination==`string`&&(this.builtInDestination=this.destination),this.openDestination({kind:`session`,params:structuredClone(e),activation:t})}closeSession(e){(!e||typeof this.destination!=`string`&&this.destination.activation===e)&&this.setOpen(!1)}get openSessionKey(){return this.dockLayout.open&&!this.suppressed&&typeof this.destination!=`string`?this.destination.params.sessionKey:null}publishSessionKey(){let e=this.openSessionKey;e!==this.publishedSessionKey&&(this.publishedSessionKey=e,this.context?.assistantDock?.notify())}openDestination(e){this.destination=e,this.dockLayout.setSuppressed(this.restoreSuppressed),this.available&&(this.setOpen(!0),this.suppressed&&(this.dockLayout.hideWithoutPersisting(),this.claimInput(`page`),e===`home`&&this.openHomePage())),this.publishSessionKey()}openHomePage(){if(this.context){let{sessionKey:e,agentId:t}=this.homeTarget,n=Ye({context:this.context,face:`chat`,sessionKey:e,agentId:t,focusComposer:!0});this.context.navigate(`chat`,n.options)}}setOpen(e){!e&&this.destination!==`home`&&this.context&&bn(this.context),e&&this.destination===`home`&&(this.homeStarted=!0),this.persistTarget(),this.dockLayout.setOpen(e),this.claimInput(e?`dock`:`page`),!e&&typeof this.destination!=`string`&&(this.destination=this.builtInDestination),this.publishSessionKey()}toggle(){if(this.available){if(this.suppressed){this.destination===`home`&&this.openHomePage();return}this.setOpen(!this.dockLayout.open)}}handleToggleRequest(e){let t=e.type===`openclaw:home-toggle`?`home`:`custodian`;if(!this.availableFor(t))return;let n=uo(e instanceof CustomEvent?e.detail:null),r=n?.dock;(r===`right`||r===`bottom`)&&this.dockLayout.setDock(r,!1),n?.open===!1?this.destination===t&&this.setOpen(!1):this.destination!==t||n?.open===!0?this.openDestination(t):this.toggle()}get assistantPanelOpen(){return this.dockLayout.open}render(){let e=this.available&&this.dockLayout.open,t=this.dockLayout.dock,n=typeof this.destination==`string`?void 0:this.destination.params,r=n??this.homeTarget,i=typeof this.destination==`string`?this.destination:`session`,a=this.contentLoader.visibleState,o=t===`bottom`?`height:${this.dockLayout.height}px`:`width:${this.dockLayout.width}px`;return F`
<section
class="assistant-panel assistant-panel--${t}"
style=${o}
?hidden=${!e}
aria-label=${P(`assistantPanel.title`)}
@pointerdown=${()=>this.claimInput(`dock`)}
@focusin=${()=>this.claimInput(`dock`)}
>
${this.dockLayout.renderResizer(`assistant-panel`,P(`assistantPanel.resize`))}
<header class="rail-header assistant-panel-header" @mousedown=${sl}>
<div class="assistant-panel-title">
<openclaw-mascot
.mood=${this.destination===`custodian`&&this.store?.sending?`thinking`:`idle`}
.size=${16}
></openclaw-mascot>
${n?F`<button type="button" class="assistant-panel-tab rail-header__title" aria-pressed="true" title=${n.label}>${n.label}</button>`:I}
${[`home`,`custodian`].map(e=>this.availableFor(e)?F`<button
type="button"
class="assistant-panel-tab"
aria-pressed=${this.destination===e}
@click=${()=>this.openDestination(e)}
>
${P(e===`home`?`assistantPanel.home`:`nav.askOpenClaw`)}
</button>`:I)}
</div>
<div class="rail-header__actions assistant-panel-actions">
${this.destination===`home`?F`<button
class="rail-header__action assistant-panel-icon"
type="button"
aria-label=${P(`assistantPanel.openHome`)}
@click=${()=>this.openHomePage()}
>
${Tl.maximize}
</button>`:I}
<button
class="rail-header__action assistant-panel-icon"
type="button"
aria-label=${P(t===`bottom`?`assistantPanel.dockRight`:`assistantPanel.dockBottom`)}
@click=${()=>this.dockLayout.setDock(t===`bottom`?`right`:`bottom`)}
>
${t===`bottom`?Tl.panelRightOpen:Tl.panelBottomOpen}
</button>
<button
class="rail-header__action assistant-panel-icon"
type="button"
aria-label=${P(`assistantPanel.close`)}
@click=${()=>this.setOpen(!1)}
>
${Tl.x}
</button>
</div>
</header>
${lu(Yd)?F`<openclaw-assistant-panel-content
?hidden=${!e||this.destination===`home`&&!this.homeStarted}
.active=${e&&(this.destination!==`home`||this.homeStarted)}
.destination=${i}
.sessionKey=${r.sessionKey}
.agentId=${r.agentId}
.sessionContext=${n?.context}
.context=${this.context}
.pageRouteId=${this.pageRouteId}
.pageSessionKey=${this.pageSessionKey}
.pageAgentId=${this.pageAgentId}
.store=${this.store}
@assistant-custodian-store=${e=>{this.store=e.detail}}
></openclaw-assistant-panel-content>`:I}
${e&&(!lu(Yd)||this.destination===`home`&&!this.homeStarted)?a?.status===`error`?kd(a,()=>this.contentLoader.retry(),()=>this.setOpen(!1)):dd():I}
</section>
`}},U([Ua({context:id,subscribe:!0}),B({attribute:!1})],Xd.prototype,`context`,void 0),U([B({type:Boolean})],Xd.prototype,`custodianAvailable`,void 0),U([B({type:Boolean})],Xd.prototype,`homeAvailable`,void 0),U([B({type:Boolean})],Xd.prototype,`custodianSuppressed`,void 0),U([B()],Xd.prototype,`pageSessionKey`,void 0),U([B()],Xd.prototype,`pageAgentId`,void 0),U([B()],Xd.prototype,`pageRouteId`,void 0),U([B({type:Boolean})],Xd.prototype,`pageRouteFailed`,void 0),U([R()],Xd.prototype,`homeStarted`,void 0),U([R()],Xd.prototype,`destination`,void 0),U([B({type:Number})],Xd.prototype,`minimizeRequestId`,void 0),U([B({attribute:!1})],Xd.prototype,`store`,void 0),customElements.get(`openclaw-assistant-panel`)||customElements.define(`openclaw-assistant-panel`,Xd)})))()}function Qd(){return typeof(typeof window>`u`?void 0:window)?.webkit?.messageHandlers?.openclawBrowser?.postMessage==`function`}function $d(){return($d=e((()=>{})))()}var ef=t({OpenClawModalDialog:()=>af});function tf(e){e.focus({preventScroll:!0}),e.dispatchEvent(new Event(`openclaw:restore-focus`))}function nf(e,t){let n=rf.size>0;rf.delete(e),t&&rf.add(e);let r=rf.size>0;n!==r&&window.dispatchEvent(new CustomEvent(`openclaw:native-modal-state`,{detail:{open:r}}))}var rf,af;function of(){return(of=e((()=>{sa(),L(),Li(),Gn(),qe(),rf=document.openClawModalLayers??=new Set,af=class extends ci{constructor(...e){super(...e),this.open=!0,this.manual=!1,this.label=``,this.description=``,this.#t=null,this.#r=0,this.#i=!1,this.#a=!1,this.#o=!1,this.#u=()=>{this.#a&&(this.#o=!0)},this.#d=e=>{e.target===e.currentTarget&&this.#f(e instanceof FocusEvent?e.relatedTarget:null)},this.#p=e=>{if(e.target!==e.currentTarget)return;this.#l();let t=this.#n,n=this.#t;this.#n=void 0,this.open=!1,this.#t=null,t!==void 0&&setTimeout(()=>{t===null?n&&document.activeElement===n&&n.blur():t.isConnected&&tf(t)},0)},this.#m=e=>{if(e.target!==e.currentTarget)return;if(this.#i){this.#i=!1;return}let t=new CustomEvent(`modal-cancel`,{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented&&e.preventDefault()}}get#e(){return this.renderRoot?.querySelector(`wa-dialog`)}#t;#n;#r;#i;#a;#o;#s;static{this.styles=Ii`
:host {
/* Slotted document panels share the standard/fullscreen shell height limit. */
--openclaw-modal-height-limit: var(--openclaw-modal-max-height, calc(100dvh - 48px));
display: contents;
}
wa-dialog {
--width: min(var(--openclaw-modal-width, 540px), calc(100vw - 48px));
--spacing: 0;
--backdrop-filter: var(--openclaw-modal-backdrop-filter, blur(4px));
}
wa-dialog::part(dialog) {
max-width: var(--openclaw-modal-max-width, calc(100vw - 48px));
max-height: var(--openclaw-modal-height-limit);
padding: 0;
border: 0;
background: transparent;
color: var(--text);
overflow: visible;
}
wa-dialog::part(body) {
padding: 0;
overflow: visible;
}
:host(.fullscreen) {
--openclaw-modal-height-limit: calc(100dvh - 20px);
}
:host(.fullscreen) wa-dialog {
--width: calc(100vw - 20px);
}
:host(.fullscreen) wa-dialog::part(dialog) {
max-width: calc(100vw - 20px);
}
:host(.viewport-edge-to-edge) wa-dialog {
--width: 100vw;
}
:host(.viewport-edge-to-edge) wa-dialog::part(dialog) {
width: 100vw;
height: 100dvh;
max-width: none;
max-height: none;
margin: 0;
border-radius: 0;
}
/* Slotted scroll containers need the body's definite viewport height. */
:host(.viewport-edge-to-edge) wa-dialog::part(body),
:host(.drawer) wa-dialog::part(body) {
height: 100%;
}
:host(.palette) wa-dialog::part(dialog) {
margin-block-start: min(20dvh, 160px);
margin-block-end: auto;
}
:host(.palette) wa-dialog {
--openclaw-modal-backdrop-filter: none;
--wa-color-overlay-modal: color-mix(in oklab, black 12%, transparent);
--show-duration: 0ms;
--hide-duration: 0ms;
}
:host(.drawer) wa-dialog {
--width: min(var(--openclaw-modal-width, 100vw), 100vw);
--show-duration: 200ms;
--hide-duration: 0ms;
}
:host(.drawer) wa-dialog::part(dialog) {
height: 100dvh;
max-width: 100vw;
max-height: 100dvh;
margin: 0 0 0 auto;
border-radius: 0;
}
:host(.drawer) wa-dialog[open]::part(dialog) {
animation: openclaw-drawer-in 200ms cubic-bezier(0.32, 0.72, 0, 1);
}
:host(.drawer--floating) {
--openclaw-drawer-inset: 20px;
--openclaw-modal-height-limit: calc(100dvh - var(--openclaw-drawer-inset) * 2);
}
:host(.drawer--floating) wa-dialog {
--width: min(
var(--openclaw-modal-width, 620px),
calc(100vw - var(--openclaw-drawer-inset) * 2)
);
}
:host(.drawer--floating) wa-dialog::part(body) {
height: 100%;
}
:host(.drawer--floating) wa-dialog::part(dialog) {
height: calc(100dvh - var(--openclaw-drawer-inset) * 2);
max-width: calc(100vw - var(--openclaw-drawer-inset) * 2);
max-height: calc(100dvh - var(--openclaw-drawer-inset) * 2);
margin: var(--openclaw-drawer-inset) var(--openclaw-drawer-inset) auto auto;
border-radius: var(--radius-xl);
}
@keyframes openclaw-drawer-in {
from {
transform: translateX(calc(100% + var(--openclaw-drawer-inset, 0px)));
}
to {
transform: translateX(0);
}
}
@media (prefers-reduced-motion: reduce) {
:host(.drawer) wa-dialog {
--show-duration: 0ms;
}
:host(.drawer) wa-dialog[open]::part(dialog) {
animation: none;
}
}
@media (max-width: 640px) {
:host(.drawer--floating) {
--openclaw-drawer-inset: 12px;
}
:host {
--openclaw-modal-height-limit: 90dvh;
}
wa-dialog {
--width: min(var(--openclaw-modal-width, 540px), calc(100vw - 24px));
}
wa-dialog::part(dialog) {
max-width: var(--openclaw-modal-max-width, calc(100vw - 24px));
}
}
@media (max-width: 768px),
(max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
:host(.mobile-edge-to-edge) wa-dialog {
--width: 100vw;
}
:host(.mobile-edge-to-edge) wa-dialog::part(dialog) {
width: 100vw;
height: 100dvh;
max-width: none;
max-height: none;
margin: 0;
border-radius: 0;
}
:host(.mobile-edge-to-edge) wa-dialog::part(body) {
height: 100%;
}
}
`}connectedCallback(){this.manual&&(this.open=!1),super.connectedCallback(),this.open&&(nf(this,!0),this.#s??=Vt()),this.updateComplete.then(()=>this.#c())}disconnectedCallback(){nf(this,!1),this.#l(),this.#r+=1,this.#a=!1;let e=this.#e,t=e?.shadowRoot?.querySelector(`dialog`);t?.open&&t.close(),e&&(e.open=!1);let n=this.#n===void 0?this.#t:this.#n;this.#t=null,this.#n=void 0,n?.isConnected&&tf(n),super.disconnectedCallback()}render(){return F`
<wa-dialog
without-header
light-dismiss
.label=${this.label}
@pointerdown=${{handleEvent:this.#u,capture:!0}}
@keydown=${{handleEvent:this.#u,capture:!0}}
@focusin=${this.#d}
@wa-after-show=${this.#d}
@wa-after-hide=${this.#p}
@wa-hide=${this.#m}
>
<slot></slot>
</wa-dialog>
`}updated(e){e.has(`open`)&&(nf(this,this.open&&this.isConnected),this.open&&this.isConnected&&(this.#s??=Vt())),this.#c()}async#c(){let e=++this.#r,t=this.#e;if(!t||(await t.updateComplete,e!==this.#r||!this.isConnected))return;let n=t.shadowRoot?.querySelector(`dialog`);if(n){n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`true`);for(let[e,t]of Object.entries({"aria-label":this.label,"aria-description":this.description}))t?n.setAttribute(e,t):n.removeAttribute(e);if(this.open){n?.open||(this.#t=document.activeElement instanceof HTMLElement?document.activeElement:null,this.#a=!0,this.#o=!1,t.open=!0,await t.updateComplete),e===this.#r&&this.isConnected&&this.open&&n?.open&&this.#a&&(this.#a=!1,this.#f(null,n,!this.#o));return}this.#a=!1,t.open||n?.open?(this.#i=!0,t.open=!1):this.#l()}}#l(){this.#s?.(),this.#s=void 0}#u;#d;#f(e=null,t,n=!1){if(!this.isConnected)return;let r=this.getRootNode(),i=r instanceof ShadowRoot?r.activeElement:this.ownerDocument.activeElement,a=this.querySelector(`[autofocus]`);i instanceof HTMLElement&&i!==this&&this.contains(i)&&(!n||!a||i===a)||(e instanceof HTMLElement&&this.contains(e)?e:a??t)?.focus({preventScroll:!0})}#p;#m;show(){this.open=!0}setReturnFocusTarget(e){this.#n=e}hide(){this.open=!1}},U([B({type:Boolean})],af.prototype,`open`,void 0),U([B({type:Boolean,reflect:!0})],af.prototype,`manual`,void 0),U([B()],af.prototype,`label`,void 0),U([B()],af.prototype,`description`,void 0),customElements.get(`openclaw-modal-dialog`)||customElements.define(`openclaw-modal-dialog`,af)})))()}function sf(e,t){return t?.status===`pending`&&t.module===void 0&&t.error===void 0&&e?e:t??e}function cf(e){return{status:e.status,active:e.matches[0],pending:e.pendingMatches[0]}}function lf(){return{status:`idle`,active:void 0,pending:void 0,settled:void 0,showPending:!1}}var uf,df;function ff(){return(ff=e((()=>{Fe(),uf=1e3,df=class{constructor(e,t={}){this.invalidate=e,this.connected=!1,this.selection=lf(),this.snapshotValue=lf(),this.showPending=!1,this.notFoundActive=!1,this.notFoundDeclined=!1,this.notFoundQueued=!1,this.notFoundGeneration=0,this.notFoundRecoveryReady=!0,this.retryEnabled=!0,this.startupAttempt=0,this.pendingDelayMs=t.pendingDelayMs??uf}get snapshot(){return this.snapshotValue}setInputs(e){(this.retryContext!==e.retryContext||this.retryEnabled!==(e.retryEnabled??!0))&&this.clearStartupRetry(),this.retryContext=e.retryContext,this.retryEnabled=e.retryEnabled??!0,this.onNotFound=e.onNotFound;let t=e.notFoundRecoveryReady??!0,n=!this.notFoundRecoveryReady&&t&&this.notFoundDeclined;if(this.notFoundRecoveryReady=t,this.router===e.router){this.updateStartupRetry(),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?cf(e.router.getState()):lf();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(lf(),e);return}this.applySelection(cf(t.getState()),e),this.unsubscribe=t.subscribe(()=>this.applySelection(cf(t.getState())))}}detachSource(){this.unsubscribe?.(),this.unsubscribe=void 0,this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1,this.cancelNotFoundEffect(),this.clearStartupRetry()}applySelection(e,t=!0){if(this.selection=e,e.status===`idle`||e.status===`notFound`)this.settled=void 0;else{let t=sf(e.active,e.pending);t?.status===`success`?this.settled=t:(t?.status===`error`||t?.status===`notFound`||t?.status===`redirected`)&&(this.settled=void 0)}let n=e.pending;n?.status!==`pending`||n.module!==void 0||n.error!==void 0||e.active?(this.clearPendingTimer(),this.pendingMatchId=void 0,this.showPending=!1):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.updateStartupRetry(),this.publish({...e,settled:this.settled,showPending:this.showPending,startupPending:this.startupMatchId!==void 0},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))}updateStartupRetry(){let e=this.selection.pending??this.selection.active;if(e?.id!==this.startupMatchId&&this.clearStartupRetry(),!this.connected||!this.retryEnabled||this.retryContext===void 0||!e){this.clearStartupRetry();return}if(e.status===`pending`||e.isFetching){globalThis.clearTimeout(this.startupTimer),this.startupTimer=void 0;return}if(!wi(e.error)){this.clearStartupRetry();return}this.startupMatchId=e.id,this.startupTimer===void 0&&(this.startupTimer=globalThis.setTimeout(()=>{this.startupTimer=void 0;let t=this.selection.pending??this.selection.active;this.connected&&this.retryEnabled&&t?.id===e.id&&wi(t.error)&&this.retryContext!==void 0&&this.router?.revalidate(this.retryContext,e.routeId).catch(()=>void 0)},re(e.error,this.startupAttempt++)))}clearStartupRetry(){globalThis.clearTimeout(this.startupTimer),this.startupTimer=void 0,this.startupMatchId=void 0,this.startupAttempt=0}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||n.startupPending!==e.startupPending)&&(this.snapshotValue=e,t&&this.connected&&this.invalidate())}clearPendingTimer(){this.pendingTimer!==void 0&&(globalThis.clearTimeout(this.pendingTimer),this.pendingTimer=void 0)}}})))()}function pf(e,t){if(!xs(e)||!t||typeof t!=`object`)return;let n=t;return n.kind===`session`&&typeof n.sessionKey==`string`&&n.sessionKey.trim()||void 0}function mf(e){let t=sf(e.matches[0],e.pendingMatches[0]),n=e.matches[0],r=n?pf(n.routeId,n.data):void 0;return{routeId:t?.routeId,location:t?.location,routeFailed:t?t.status===`error`||t.status===`notFound`:e.status===`notFound`||void 0,committedRouteId:n?.routeId,committedLocation:n?.location,committedSessionKey:r}}function hf(e,t){return e.routeId===t.routeId&&e.routeFailed===t.routeFailed&&Ps(e.location,t.location)&&e.committedRouteId===t.committedRouteId&&Ps(e.committedLocation,t.committedLocation)&&e.committedSessionKey===t.committedSessionKey}function gf(){return(gf=e((()=>{Y(),ff()})))()}var _f;function vf(){return(vf=e((()=>{L(),Li(),w(),_e(),qe(),El(),of(),_f=class extends Ue{render(){let e=this.props;if(!e?.pendingGatewayUrl)return I;let t=P(`connection.switchGateway.title`),n=P(`connection.switchGateway.summary`),r=ce(e.currentGatewayUrl),i=ce(e.pendingGatewayUrl),a=!!e.currentGatewayUrl.trim()&&no(e.currentGatewayUrl)!==no(e.pendingGatewayUrl),o=[P(`connection.switchGateway.note`),e.linkCarriesToken?P(`connection.switchGateway.noteToken`):null,a?P(`connection.switchGateway.noteScoped`,{host:r}):null].filter(Boolean);return F`
<openclaw-modal-dialog label=${t} description=${n} @modal-cancel=${e.onCancel}>
<div class="gateway-switch">
<div class="gateway-switch__head">
<span class="gateway-switch__icon" aria-hidden="true">${Tl.shieldAlert}</span>
<div class="gateway-switch__text">
<h2 class="gateway-switch__title">${t}</h2>
<p class="gateway-switch__summary">${n}</p>
</div>
</div>
<div class="gateway-switch__hosts">
<div class="gateway-switch__host">
<span class="gateway-switch__label">${P(`connection.switchGateway.current`)}</span>
<code translate="no">${e.currentGatewayUrl.trim()||P(`common.na`)}</code>
</div>
<span class="gateway-switch__arrow" aria-hidden="true">${Tl.arrowRight}</span>
<div class="gateway-switch__host gateway-switch__host--next">
<span class="gateway-switch__label">${P(`connection.switchGateway.next`)}</span>
<code translate="no">${e.pendingGatewayUrl}</code>
</div>
</div>
<p class="gateway-switch__note">${o.join(` `)}</p>
<div class="gateway-switch__actions">
<button type="button" class="btn primary" @click=${e.onConfirm}>
${P(`connection.switchGateway.confirm`,{host:i})}
</button>
<button type="button" class="btn" @click=${e.onCancel}>
${P(`connection.switchGateway.cancel`)}
</button>
</div>
</div>
</openclaw-modal-dialog>
`}},U([B({attribute:!1})],_f.prototype,`props`,void 0),customElements.get(`openclaw-gateway-url-confirmation`)||customElements.define(`openclaw-gateway-url-confirmation`,_f)})))()}function yf(e){let t={focus:t=>void e(t,`focus`),pointer:t=>void e(t,`pointer`)};return document.addEventListener(`pointerover`,t.pointer,!0),document.addEventListener(`focusin`,t.focus,!0),()=>{document.removeEventListener(`pointerover`,t.pointer,!0),document.removeEventListener(`focusin`,t.focus,!0)}}function bf(e,t,n=!1){return t===`pointer`?e.matches(`:hover`):n?document.activeElement instanceof Node&&e.contains(document.activeElement):e.matches(`:focus`)}function xf(e,t){return Math.max(0,t-(performance.now()-e))}var Sf;function Cf(){return(Cf=e((()=>{ju(),Sf=class{constructor(e){this.params=e,this.stopListeners=null}install(e){customElements.get(this.params.tag)||(this.stopListeners=yf(e))}providerFor(e){let t=e;for(;t;){let e=t.closest(this.params.tag);if(e)return e;t=ye(t)}return null}async define(){await cu(this.params.tag,async()=>{let e=await this.params.load();customElements.get(this.params.tag)||customElements.define(this.params.tag,e)}),this.stopListeners?.(),this.stopListeners=null,this.params.onDefined?.()}}})))()}function wf(e){return/^(?:www\.)?github\.com\.?$/i.test(e)}function Tf(e,t){try{let n=decodeURIComponent(e),r=decodeURIComponent(t);return/^[a-z\d](?:[a-z\d-]{0,37}[a-z\d])?$/i.test(n)&&/^[a-z\d._-]{1,100}$/i.test(r)&&!/^\.{1,2}$|\.(?:git|atom)$/i.test(r)?[n,r]:null}catch{return null}}function Ef(e){if(!e.href.startsWith(`https://github.com/`))return!1;let t=/^\/([^/]+)\/([^/]+)\/?$/u.exec(e.pathname),n=t?Tf(t[1],t[2]):null;return!(!n||/^(?:account|accounts|apps|auth|codespaces|copilot|dashboard|discussions|email|emails|enterprises|github-copilot|issues|join|login|logout|marketplace|new|notifications|oauth|orgs|organizations|projects|pulls|repositories|session|sessions|settings|signup|sponsors|stars|two-factor|user|users|verify|watching)$/i.test(n[0]))}function Df(e){let t=/^\/([^/]+)\/([^/]+)\/(?:issues\/([1-9]\d{0,9})|pull\/([1-9]\d{0,9})(?:\/(?:files|checks|commits(?:\/[a-fA-F\d]{7,40})?))?)\/?$/u.exec(e.pathname);if(!t)return null;let n=Tf(t[1],t[2]);return n?[...n,t[3],t[4]]:null}function Of(e){return e.href.startsWith(`https://github.com/`)?Df(e):null}function kf(){return(kf=e((()=>{})))()}function Af(e,t){if(!e||e.length>8192)return null;let n=URL.parse(e);if(!n||n.protocol!==`https:`||n.username||n.password||n.port)return null;for(let e of t){if(!e.linkReader.hosts.includes(n.hostname))continue;let t=Lf.get(e);if(t===void 0){try{t=new RegExp(e.linkReader.pathPattern,`u`)}catch{t=null}Lf.set(e,t)}if(t?.test(n.pathname))return{href:n.href,reader:e}}return null}function jf(e){return e.reader.pluginId+`:`+e.reader.id+`:`+e.href.split(`#`,1)[0]}function Mf(e){let t=URL.parse(e.href);if(t&&wf(t.hostname)&&!Of(t)&&!Ef(t)||e.matches(`[download], [data-file-path], [data-session-href], .markdown-session-link, [data-link-reader-external]`))return!1;for(let t=e;t;t=ye(t))if(t.matches(`openclaw-tooltip, openclaw-browser-tab-card, wa-popover, .link-reader-hovercard, .link-hovercard, .session-progress-hovercard, .chat-source-card`))return!1;return!0}function Nf(e){let t=e.pagePreviewContext;return!!(t?.config.current.automaticallyFetchFavicons&&t.gateway.snapshot.client===e.client&&zi(t.gateway.snapshot,`controlUi.linkPreview`,`operator.read`,{requireAdvertisement:!1}))}function Pf(e,t){if(!t.client||!Mf(e))return null;let n=Af(e.href,t.claimedReaders?.length?t.claimedReaders:t.readers);if(n)return n.reader.linkReader.previewMethod&&t.readers.includes(n.reader)?n:null;if(!Nf(t))return null;let r=URL.parse(e.href);return r&&[`http:`,`https:`].includes(r.protocol)&&r.origin!==location.origin&&!r.username&&!r.password&&r.href.length<=2048?{kind:`page`,href:r.href}:null}var Ff,If,Lf;function Rf(){return(Rf=e((()=>{Vi(),Ff=`openclaw-link-reader-hovercard-provider`,If=[],Lf=new WeakMap})))()}function zf(e){let t=Hf.providerFor(e);return t?Pf(e,t):null}function Bf(e){let t=zf(e);return!!(t&&(t.reader||customElements.get(`openclaw-link-reader-hovercard-provider`)))}async function Vf(e,t){if(t===`pointer`&&e instanceof PointerEvent&&e.pointerType===`touch`)return;let n=Pn(e),r=n?zf(n):null;if(r&&!r.reader&&t===`focus`&&!n?.matches(`:focus-visible`)||!n||!r)return;let i=performance.now();try{await Hf.define()}catch{return}let a=Hf.providerFor(n);await a?.updateComplete;let o=zf(n);a&&o&&n.isConnected&&o?.reader===r.reader&&o.href===r.href&&bf(n,t)&&a.activateFromBootstrap(n,r,t,t===`pointer`?xf(i,250):0)}var Hf;function Uf(){return(Uf=e((()=>{Cf(),Rf(),K(),Hf=new Sf({tag:Ff,load:async()=>(await W(async()=>{let{LinkReaderHovercardProvider:e}=await import(`./link-reader-hovercard-uMLprW41.js`);return{LinkReaderHovercardProvider:e}},__vite__mapDeps([82,1,2,3,4,5,6,7,8,9,11,12,13,14,15,18,10,17,16,19,20,58,28,29,30,31,32,33,34,83]),import.meta.url)).LinkReaderHovercardProvider}),Hf.install(Vf)})))()}function Wf(e){return e.hasAttribute(`aria-label`)||e.hasAttribute(`aria-labelledby`)||e.matches(`img[alt], input[alt]`)||Ru(e).trim()?!1:e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?!e.labels?.length&&!e.matches(`input[type="button"], input[type="submit"], input[type="reset"]`):!0}function Gf(e){let t=null,n=null,r=()=>{if(!n)return;let{anchor:e,title:r,label:i}=n;n=null,o.disconnect(),e.removeEventListener(`pointerleave`,s),e.removeEventListener(`focusout`,c),r!==null&&e.getAttribute(`title`)===``&&e.setAttribute(`title`,r),i!==null&&e.getAttribute(`aria-label`)===i&&e.removeAttribute(`aria-label`),t&&(t.anchor=null,t.remove())},i=e=>!!(e&&Bf(e)),a=()=>i(n?.link)||n?.anchor.matches(`[aria-haspopup="dialog"][aria-expanded="true"]`)?``:n?.anchor.getAttribute(`data-tooltip`)??n?.title??``,o=new MutationObserver(e=>{if(n){if(!n.anchor.isConnected){r();return}i(n.link)&&(n.previewOwned=!0,t&&(t.content=``)),e.some(e=>n?.anchor.contains(e.target)||e.target===n?.link)&&(e.some(e=>e.target===n?.anchor&&e.attributeName===`title`)&&(n.title=n.anchor.getAttribute(`title`),n.title!==null&&(n.anchor.setAttribute(`title`,``),o.takeRecords())),n.label!==null&&n.anchor.getAttribute(`aria-label`)===n.label&&(n.anchor.removeAttribute(`aria-label`),n.label=null),n.title&&Wf(n.anchor)&&(n.label=n.title,n.anchor.setAttribute(`aria-label`,n.label)),t&&(t.content=a()))}}),s=e=>{n&&e.target===n.anchor&&(n.pointer=!1,n.focus||r())},c=e=>{!n||e instanceof FocusEvent&&e.relatedTarget instanceof Node&&n.anchor.contains(e.relatedTarget)||(n.focus=!1,n.pointer||r())},l=l=>{if(`pointerType`in l&&l.pointerType===`touch`)return;let u=l.composedPath().filter(Fu),d=Pn(l),f=u.some(e=>e.localName===`openclaw-tooltip`),p;for(let e of u){if(e.localName===`iframe`)break;let t=e===n?.anchor?n.title:e.getAttribute(`title`),r=e.getAttribute(`data-tooltip`)??t;if(r!==null){p=r?e:void 0;break}}let m=l.type===`focusin`?`focus`:`pointer`,h=i(d);if(p===n?.anchor&&h===n?.previewOwned){n&&(n.link=d,n[m]=!0,d&&!n.anchor.contains(d)&&o.observe(d,{attributes:!0,attributeFilter:[`href`]}));return}if(!p&&n?.focus&&m===`pointer`||(r(),!p))return;let g=p.getAttribute(`title`),_=g&&Wf(p)?g:null;n={anchor:p,link:d,previewOwned:h,title:g,label:_,pointer:m===`pointer`,focus:m===`focus`},g!==null&&p.setAttribute(`title`,``),_!==null&&p.setAttribute(`aria-label`,_),p.addEventListener(`pointerleave`,s),p.addEventListener(`focusout`,c),o.observe(p,{attributes:!0,attributeFilter:[`title`,`data-tooltip`,`aria-hidden`,`aria-haspopup`,`aria-expanded`,`href`],characterData:!0,subtree:!0}),d&&!p.contains(d)&&o.observe(d,{attributes:!0,attributeFilter:[`href`]}),o.observe(e,{childList:!0,subtree:!0});let v=p.getRootNode();v instanceof ShadowRoot&&o.observe(v,{childList:!0,subtree:!0});let y=a();!f&&y&&(t??=e.createElement(`openclaw-tooltip`),(u.find(e=>e.localName===`openclaw-modal-dialog`)??e.body).append(t),t.previewForAnchor(p,y,m))};return e.addEventListener(`pointerover`,l,!0),e.addEventListener(`focusin`,l,!0),()=>{e.removeEventListener(`pointerover`,l,!0),e.removeEventListener(`focusin`,l,!0),r()}}function Kf(){return(Kf=e((()=>{Zu(),Uf()})))()}function qf(e,t,n){return e?!e.scopes||qo({role:e.role??`operator`,requestedScopes:[t],allowedScopes:e.scopes}):n}function Jf(e){let t=e?.hello?.auth??null;return{canWrite:Yf(t),canAdmin:Zf(t),canPair:Qf(t),canReviewApprovals:!t||$f(t),canGrantApprovals:$f(t)}}function Yf(e){return qf(e,`operator.write`,!0)}function Xf(e){return qf(e,`operator.read`,!0)}function Zf(e){return qf(e,`operator.admin`,!0)}function Qf(e){return qf(e,`operator.pairing`,!1)}function $f(e){return qf(e,`operator.approvals`,!1)}function ep(e){return Xf(e)||qf(e,`operator.sessions.read`,!0)}function tp(e,t,n){let r=e.hello?.auth?.sessionCap,i=t?.sharingRole;if(!t||!i||n.archived||n.catalog||r===`none`||!zi(e,`session.reactions.set`,`operator.write`))return!1;let a=t.visibility??`shared`;return a===`draft`?i===`owner`||i===`admin`:i===`viewer`?a===`shared`?r!==`view`&&r!==`suggest`:a===`suggest`&&r!==`view`:!0}function np(){return(np=e((()=>{Xi(),Vi()})))()}function rp(e){return Ka(Sp,e)}function ip(e){pa(Sp,e,e=>console.error(`[boot-record] observer failed`,e))}function ap(e){return e.recoveryScope?{recoveryScope:e.recoveryScope}:{authMethod:e.authMethod,credential:e.credential}}function op(e,t){return!e||!t?!1:e.recoveryScope===void 0?t.recoveryScope===void 0&&e.authMethod===t.authMethod&&e.credential===t.credential:e.recoveryScope===t.recoveryScope}function sp(e){let t=e?.trim();return t?b(t).toString(16):null}function cp(e,t){let n=e?.method===`bootstrap-token`?`device-token`:e?.method;if(e?.recoveryScope?.trim()&&n&&[`trusted-proxy`,`tailscale`,`password`].includes(n))return{authMethod:n,credential:``};if(n!==`token`&&n!==`device-token`)return null;let r=sp(n===`token`?t:e?.deviceToken);return r?{authMethod:n,credential:r}:null}function lp(e){if(!H(e)||!H(e.agents))return!1;let t=e.agents;return e.version===2&&([`token`,`device-token`].includes(String(e.authMethod))||[`trusted-proxy`,`tailscale`,`password`].includes(String(e.authMethod))&&typeof e.recoveryScope==`string`&&e.recoveryScope.length>0)&&(e.recoveryScope===void 0||typeof e.recoveryScope==`string`&&e.recoveryScope.length>0)&&typeof e.credential==`string`&&typeof e.savedAt==`number`&&Number.isFinite(e.savedAt)&&e.savedAt>=0&&typeof e.scope==`string`&&(e.profileId===null||typeof e.profileId==`string`)&&typeof t.defaultId==`string`&&t.defaultId.trim().length>0&&typeof t.mainKey==`string`&&t.mainKey.trim().length>0&&(t.scope===`per-sender`||t.scope===`global`)&&Array.isArray(t.agents)&&t.agents.every(e=>H(e)&&typeof e.id==`string`)&&Array.isArray(e.groups)&&e.groups.every(e=>H(e)&&typeof e.name==`string`&&typeof e.position==`number`)&&Array.isArray(e.sectionOrder)&&e.sectionOrder.every(e=>typeof e==`string`)}function up(e,t){if(!e||new TextEncoder().encode(e).length>yp)return null;try{let n=JSON.parse(e);return lp(n)&&n.scope===t?n:null}catch{return null}}function dp(e,t){let n=Le(),r=vp+e;try{let i=n?.getItem(r);if(i==null)return null;let a=up(i,e);if(a&&Date.now()-a.savedAt<=bp)try{let e=t(a.authMethod);return([`trusted-proxy`,`tailscale`,`password`].includes(a.authMethod)?e===``:a.credential===sp(e))?a:null}catch{return null}}catch{}try{n?.removeItem(r)}catch{}return null}function fp(e,t){Tp&&Tp.record.scope===e&&op(ap(Tp.record),t)&&(Tp=void 0,clearTimeout(wp),wp=void 0)}function pp(e,t){try{let n=Le(),r=vp+e,i=n?.getItem(r),a=i?JSON.parse(i):null;lp(a)&&a.scope===e&&op(ap(a),t)&&n?.removeItem(r)}catch{}}function mp(e,t){if(t){fp(e,t),pp(e,t),ip({scope:e,retiredOwner:t});return}xp+=1,ip({scope:e});try{let t=Le();if(!t)return;if(e!==void 0){t.removeItem(vp+e);return}for(let e=t.length-1;e>=0;--e){let n=t.key(e);n?.startsWith(vp)&&t.removeItem(n)}}catch{}}function hp(e){let t=e.client;if(!t||t.offlineRecoveryRetired||e.connected&&!t.recoveryScopeReady)return;t.recoveryScopeReady&&t.recoveryScope&&Cp.set(t,t.recoveryScope);let n=Cp.get(t);return(t.recoveryScopeReady?t.recoveryScope:t.offlineRecoveryScope??(n===t.recoveryScope?n:void 0))?.trim()||void 0}function gp(){clearTimeout(wp),wp=void 0;let e=Tp;if(Tp=void 0,!e||e.generation!==xp)return;let{record:t}=e,n=Le(),r=vp+t.scope;try{let e={...t.agents,agents:t.agents.agents.map(e=>{let t=e.identity?{...e.identity}:void 0;return t&&(delete t.avatar,delete t.avatarUrl),{...e,identity:t}})},i=JSON.stringify({...t,agents:e});new TextEncoder().encode(i).length>yp?pp(t.scope,ap(t)):(n?.setItem(r,i),n?.getItem(r)===i&&ip({scope:t.scope,replacement:ap(t)}))}catch{pp(t.scope,ap(t))}}function _p(e){clearTimeout(wp),Tp={record:e,generation:xp},wp=setTimeout(gp,500)}var vp,yp,bp,xp,Sp,Cp,wp,Tp;function Ep(){return(Ep=e((()=>{vp=`openclaw.control.bootRecord.v1:`,yp=65536,bp=2592e6,xp=0,Sp=new Set,Cp=new WeakMap,typeof window<`u`&&typeof window.addEventListener==`function`&&typeof document<`u`&&typeof document.addEventListener==`function`&&(window.addEventListener(`storage`,e=>{if(e.key!==null&&!e.key.startsWith(vp))return;let t=e.key?.slice(31),n=up(e.newValue,t),r=n&&Date.now()-n.savedAt<=bp?ap(n):void 0,i=e.newValue===null?up(e.oldValue,t):null,a=i?ap(i):void 0;(!t||Tp?.record.scope===t)&&(!a||Tp&&op(a,ap(Tp.record)))&&!op(r,Tp?ap(Tp.record):void 0)&&(xp+=1),ip({scope:t,external:!0,replacement:r,retiredOwner:a})}),window.addEventListener(`pagehide`,gp),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&gp()}))})))()}function Dp(e){let t=e.connectionRevision,n=e.snapshot,r=n.phase===`connected`&&n.client?.recoveryScopeReady!==!1,i=n.phase===`connected`?n.selfUser??null:void 0,a=i?.id,o=n.client?.offlineRecoveryRetired?void 0:n.hello?.auth?.recoveryScope??hp({client:n.client}),s=Op.get(e);if(!s||s.revision!==t||s.recoveryScope!==void 0&&o!==void 0&&s.recoveryScope!==o||n.client?.offlineRecoveryRetired===!0&&s.recoveryScope!==void 0||a!==void 0&&s.userId!==void 0&&s.userId!==a){let n={scope:{key:++kp,displayUser:i??null,readyOnce:r},revision:t,userId:a,recoveryScope:o};return Op.set(e,n),n.scope}return s.userId??=a,s.recoveryScope??=o,s.scope.readyOnce||=r,i===void 0?n.phase!==`reconnecting`&&n.phase!==`reload-required`&&(s.scope.displayUser=null):s.scope.displayUser=i,s.scope}var Op,kp;function Ap(){return(Ap=e((()=>{Ep(),Op=new WeakMap,kp=0})))()}function jp(e){let t=new URLSearchParams(e).get(`onboarding`);return t!==null&&/^(?:1|true|yes|on)$/iu.test(t.trim())}function Mp(){return(Mp=e((()=>{})))()}var Np,Pp,Fp,Ip,Lp;function Rp(){return(Rp=e((()=>{L(),Fi(),Ei(),Np=[[`pluginEmbed`,`content--plugin-embed`],[`hubHeader`,`content--hub-header`],[`toolbarHeader`,`content--toolbar-header`],[`workbench`,`content--workbench`],[`settingsPage`,`content--settings-page`],[`settingsWide`,`content--settings-wide`],[`settingsWorkspace`,`content--settings-workspace`],[`memoryPage`,`content--memory-page`],[`logsPage`,`content--logs-page`],[`activityPage`,`content--activity-page`],[`terminalPage`,`content--terminal-page`]],Pp=new WeakMap,Fp=class extends Oi{constructor(...e){super(...e),this.traits={}}render(e){return I}update(e,[t]){return this.host=e.options?.host instanceof Element?e.options.host:void 0,this.traits=t,this.publish(),I}publish(){let e=this.isConnected&&this.host?.isConnected?this.host.closest(`main.content`):null,t=e?Pp.get(e):void 0;t!==this.controller&&(this.controller?.clear(this),this.controller=t),this.host&&this.controller?.record(this,this.host,this.traits)}disconnected(){this.controller?.clear(this),this.controller=void 0}reconnected(){this.publish()}},Ip=ji(Fp),Lp=class{constructor(e){this.host=e,this.reporters=new Map,this.contentRef=e=>{e!==this.content&&(this.content&&Pp.delete(this.content),this.content=e,e&&(Pp.set(e,this),this.apply()))},e.addController(this)}record(e,t,n){if(!t.isConnected||!this.content?.contains(t)||!Np.some(([e])=>n[e])){this.clear(e);return}let r=this.reporters.get(e);r?.host===t&&Np.every(([e])=>!!r.traits[e]==!!n[e])||(this.reporters.set(e,{host:t,traits:{...n}}),this.apply(),this.host.requestUpdate())}clear(e){this.reporters.delete(e)&&(this.apply(),this.host.requestUpdate())}get current(){let e={};for(let[t,n]of this.reporters){if(!n.host.isConnected||!this.content?.contains(n.host)){this.reporters.delete(t);continue}for(let[t]of Np)n.traits[t]&&(e[t]=!0)}return e}get className(){let e=this.current;return Np.filter(([t])=>e[t]).map(([,e])=>e).join(` `)}apply(){let e=this.current;for(let[t,n]of Np)this.content?.classList.toggle(n,!!e[t])}hostDisconnected(){this.reporters.clear(),this.apply()}}})))()}function zp(e,t,n){let r=ks(t.pathname,n),i=r?e.getRoute(r):null;i&&Promise.resolve(i.component()).catch(()=>void 0)}function Bp(e,t,n){return e===`workboard`?Wn(t,n).canonicalLocation??t:e===`plugin`?rs(t,n):t}function Vp(){let e=Ca({routes:Kp});return{...e,navigate:(t,n,r,i)=>n.nativeConversation?.interceptNavigation(i??Ms(t,n.basePath))?Promise.resolve():e.navigate(t,n,r,i?Bp(t,i,n.basePath):void 0),routeIdFromPath:ks}}function Hp(e,t){let n=Os(e.pathname,t);if(!n)return e;let[r,i,a]=n,o=new URLSearchParams(e.search);return o.set(i,a),{...e,pathname:J(r,t),search:`?${o.toString()}`}}function Up(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`notFound`}async function Wp(e){try{await e}catch(e){if(!Up(e))throw e}}async function Gp(e,t,n,r){$o(r.gateway.snapshot.hello?.controlUiTabs);let i=t.location(),a=Bp(ks(i.pathname,n),i,n);Ps(i,a)||(t.replace(a),i=t.location());let o=fs(i.pathname,n);o?.invalidPanel&&(t.replace({...i,pathname:ds(o.agentId,null,n)}),i=t.location()),ks(i.pathname,n)===null&&!es(i.pathname,n)&&(t.replace({...i,pathname:e.pathForRoute(`chat`,n)}),i=t.location());let s=Os(i.pathname,n);await Wp(e.start({location:()=>Hp(t.location(),n),push:e=>t.push(e),replace:e=>t.replace(e),listen:i=>{let a=!0,o=!1,s=r.gateway.snapshot.hello,c,l=()=>{let t=e.getState();return t.pendingMatches[0]??t.matches[0]},u=async(t,n)=>{let i=t.data;if(i?.kind!==`session`||!n&&!i.sessionResolutionFromCache)return;let{client:o,hello:s}=r.gateway.snapshot,c=Dp(r.gateway),u=()=>a&&r.gateway.snapshot.phase===`connected`&&r.gateway.snapshot.client===o&&r.gateway.snapshot.hello===s&&Dp(r.gateway)===c&&l()?.abortController===t.abortController&&e.getState().pendingMatches.length===0;try{let{sessionRouteTargetFromLocation:n}=await W(async()=>{let{sessionRouteTargetFromLocation:e}=await import(`./control-ui-boot-chat-XcDaYmck.js`).then(e=>(e.t(),e.n));return{sessionRouteTargetFromLocation:e}},__vite__mapDeps([54,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,18,53,17,16,19,20,28,29,30,31,32,33,34,56]),import.meta.url);if(!u())return;let a=n(r,t.location)?.target;if(!a||!(a.kind===`short`||a.kind===`literal`&&a.slugCandidate))return;let{querySessionReference:o}=await W(async()=>{let{querySessionReference:e}=await import(`./control-ui-boot-chat-XcDaYmck.js`).then(e=>(e.r(),e.i));return{querySessionReference:e}},__vite__mapDeps([54,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,18,53,17,16,19,20,28,29,30,31,32,33,34,56]),import.meta.url);if(!u())return;(await o(r,{key:i.sessionKey,agentId:a.agentId},t.abortController.signal))?.kind===`not-found`&&u()&&await e.revalidate(r,t.routeId)}catch{}},d=()=>{let t=l();if(!t||!xs(t.routeId)){c=void 0;return}let n=Dp(r.gateway);if(c?.controller!==t.abortController&&(c=void 0),!(c&&c.scope!==n)){if(r.gateway.snapshot.phase!==`connected`){(t.status===`pending`||t.status===`success`||t.isFetching===`loader`)&&(c={controller:t.abortController,scope:n,verifySession:c?.verifySession===!0||s!==null||t.data!==void 0});return}if(t.status===`success`&&!t.isFetching){let e=c;c=void 0,e&&u(t,e.verifySession)}c&&!o&&t.status===`error`&&(o=!0,queueMicrotask(()=>{o=!1;let t=l();a&&c&&t?.abortController===c.controller&&Dp(r.gateway)===c.scope&&r.gateway.snapshot.phase===`connected`&&t.status===`error`&&(c=void 0,t.abortController.abort(),l()?.abortController===t.abortController&&e.navigate(t.routeId,r,{history:`none`,revalidate:!0},t.location).catch(()=>void 0))}))}},f=e.subscribe(d),p=r.gateway.subscribe(o=>{d(),s!==o.hello&&(s=o.hello,$o(o.hello?.controlUiTabs),queueMicrotask(()=>{if(!a||r.gateway.snapshot.phase!==`connected`)return;let o=t.location(),s=rs(o,n),c=e.getState();if(c.pendingMatches.some(e=>!Ps(e.location,o)))return;let l=o.pathname!==J(`plugin`,n)&&[...c.matches,...c.pendingMatches].some(e=>e.routeId===`plugin`);!Ps(o,s)||l&&ts(o.pathname,n)?e.navigate(`plugin`,r,{history:`replace`},s).catch(e=>{console.error(`[openclaw] Plugin tab navigation failed`,e)}):l&&i(o)}))}),m=t.listen(a=>{if(r.nativeConversation?.interceptNavigation(a)){let n=e.getState().location;n&&t.replace(n);return}let o=Bp(ks(a.pathname,n),a,n);Ps(a,o)||t.replace(o);let s=Os(o.pathname,n);if(s){e.navigate(s[0],r,{history:`none`},o).catch(e=>{console.error(`[openclaw] Dynamic route navigation failed`,e)});return}i(o)});return()=>{a=!1,c=void 0,f(),p(),m()}}},n,r)),s&&Ps(t.location(),i)&&await Wp(e.navigate(s[0],r,{history:`none`},i))}var Kp;function qp(){return(qp=e((()=>{Wi(),Y(),Ap(),Ke(),h(),pi(),bi(),Dt(),wn(),br(),Xt(),Jn(),lr(),tn(),Me(),dt(),tr(),Jt(),Ut(),mr(),On(),sr(),en(),je(),ut(),de(),fe(),at(),l(),ve(),o(),Te(),x(),ii(),ze(),Nt(),pn(),Qn(),an(),Kr(),Bt(),fr(),En(),K(),Kp=[...ln,yt,ee,vr,oi,r,Sn,gn,An,He,Lt,ti,rr,Jr,Wr,jt,C,jr,...Nr,wr,pt,_t,Fn,Fr,kt,p,yn,We,_,Kt,sn,Ur,li,...St,...be,i,Kn,qr,Lr,Qe]})))()}function Jp(){return(Jp=e((()=>{ko()})))()}function Yp(e){if(Object.keys(e).length===1){if(typeof e.deviceToken==`string`&&e.deviceToken)return{deviceToken:e.deviceToken};if(typeof e.token==`string`&&e.token)return{token:e.token};if(typeof e.password==`string`&&e.password)return{password:e.password}}throw Error(`The app returned an invalid Gateway credential. Reconnect in the app.`)}function Xp(e,t){let n=H(e)?e:{},r=H(n.client)?n.client:{},i=H(n.device)?n.device:{},a=H(n.auth)?n.auth:{},o=va(typeof r.id==`string`?r.id:void 0),s=xa(typeof r.mode==`string`?r.mode:void 0);if(!o||!s||typeof r.version!=`string`||typeof r.platform!=`string`||!Array.isArray(n.scopes)||!n.scopes.every(e=>typeof e==`string`)||typeof i.id!=`string`||typeof i.publicKey!=`string`||typeof i.signature!=`string`||i.nonce!==t.nonce||i.signedAt!==t.signedAt)throw Error(`The app returned an invalid Gateway authorization. Reconnect in the app.`);return{client:{id:o,mode:s,version:r.version,platform:r.platform,...typeof r.deviceFamily==`string`?{deviceFamily:r.deviceFamily}:{},...typeof r.instanceId==`string`?{instanceId:r.instanceId}:{}},scopes:n.scopes,auth:Yp(a),device:{id:i.id,publicKey:i.publicKey,signature:i.signature,nonce:t.nonce,signedAt:t.signedAt}}}function Zp(e,t={}){let n=window,r=n.OpenClawNativeGatewayAuth,i=n.webkit?.messageHandlers?.OpenClawNativeGatewayAuth,a=new Map,o=new Map,s,c=!1,l=e=>{let t=e;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return}H(t)&&typeof t.id==`string`&&a.get(t.id)?.(t)};if(r&&(r.onmessage=e=>l(e.data)),t.messagePort&&n.top===n){let t=r=>{let i=r.ports[0];if(c||s||r.source!==null||r.origin!==``||r.ports.length!==1||!i)return;let a;try{a=typeof r.data==`string`?JSON.parse(r.data):void 0}catch{return}if(H(a)&&a.type===`openclaw.native-control-auth`&&typeof a.gatewayUrl==`string`&&q(a.gatewayUrl)===q(e)){s=i,s.addEventListener(`message`,e=>l(e.data)),s.start(),n.removeEventListener(`message`,t);for(let[e,t]of o)try{s.postMessage(t)}catch(t){l({id:e,error:Qt(t)})}o.clear()}};n.addEventListener(`message`,t),n.addEventListener(`pagehide`,()=>{c=!0,n.removeEventListener(`message`,t),s?.close();for(let e of a.keys())l({id:e,error:`Native dashboard document closed`});o.clear()},{once:!0})}return async({gatewayUrl:u,nonce:d,signedAt:f,signal:p})=>{if(q(u)!==q(e))throw Error(`This dashboard belongs to a different Gateway. Select the Gateway in the app.`);if(c||n.top!==n||!r&&!i&&!t.messagePort)throw Error(`Native Gateway authorization is unavailable. Reopen this dashboard in the app.`);if(!/[^\p{White_Space}\p{Control}\ufeff]/u.test(d)||new TextEncoder().encode(d).length>512||d.includes(`|`)||!Number.isSafeInteger(f)||f<=0)throw Error(`The Gateway did not provide a valid native authentication challenge.`);p.throwIfAborted();let m={id:Da(),nonce:d,signedAt:f};return await new Promise((e,t)=>{let n=(n,r)=>{a.delete(m.id)&&(o.delete(m.id),clearTimeout(u),p.removeEventListener(`abort`,c),n===void 0?r&&e(r):t(n))},c=()=>n(Error(Qt(p.reason??`Native Gateway authorization cancelled.`))),u=setTimeout(()=>n(new Qp(`The app did not authorize this dashboard in time. Reconnect in the app.`)),qa/2);a.set(m.id,e=>{try{if(typeof e.error==`string`)throw new Qp(e.error);n(void 0,Xp(e.result,m))}catch(e){n(e instanceof Error?e:Error(Qt(e)))}}),p.addEventListener(`abort`,c,{once:!0});try{let e;r?e=r.postMessage(JSON.stringify(m)):i?e=i.postMessage(m):s?s.postMessage(JSON.stringify(m)):o.set(m.id,JSON.stringify(m)),e&&e.then(l,e=>n(new Qp(Qt(e))))}catch(e){n(new Qp(Qt(e)))}})}}var Qp;function $p(){return($p=e((()=>{Wa(),xo(),Sr(),ca(),Qp=class extends Error{}})))()}function em(e){let t=e&&typeof e==`object`&&`name`in e?e.name:void 0;return typeof t==`string`&&t.trim()?t:void 0}function tm(e){let t=em(e)?.toLowerCase(),n=Qt(e).toLowerCase();return t===`securityerror`||n.includes(`security error`)||n.includes(`mixed content`)||n.includes(`insecure websocket`)}function nm(e,t){let n=tm(e),r=Qt(e),i=t.trim().toLowerCase().startsWith(`ws://`),a={code:n?om:am,browserErrorName:em(e),browserMessage:r};return n?{code:om,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:am,message:`Could not create the Gateway WebSocket: ${r}`,details:a}}async function rm(e,t){try{let n=new URL(e,window.location.href);n.protocol=n.protocol.replace(/^ws/u,`http`);let r=new URL(ac(new URL(`/healthz`,n).href),window.location.href);if(r.origin!==new URL(window.location.href).origin)return!1;let i=await fetch(r,{cache:`no-store`,credentials:`same-origin`,redirect:`error`,signal:t});if(!i.ok)return!1;let a=await i.json();return typeof a==`object`&&!!a&&`ok`in a&&a.ok===!0&&`status`in a&&a.status===`live`}catch{return!1}}function im(e,t,n){let r=new WebSocket(rc(e)),i=!0,a,o,s=()=>{i=!1,o!==void 0&&(clearTimeout(o),o=void 0)};return r.addEventListener(`open`,()=>{s(),t.open()}),r.addEventListener(`message`,e=>t.message(String(e.data??``))),r.addEventListener(`close`,e=>{s(),t.close(e.code,e.reason||a||``)}),r.addEventListener(`error`,()=>{s(),a||t.error(Error(`websocket error`))}),o=setTimeout(()=>{if(o=void 0,i){i=!1,a=`gateway websocket opening timed out after ${qa}ms`;try{t.error(Error(a))}finally{r.close()}}},qa),{isOpen:()=>r.readyState===WebSocket.OPEN,send:e=>{let t=n?.();if(t!==void 0&&new TextEncoder().encode(e).byteLength>t)throw new sm;r.send(e)},close:(e,t)=>{s(),r.close(e===1008?4008:e,t)}}}var am,om,sm;function cm(){return(cm=e((()=>{Wa(),Sr(),am=`BROWSER_WEBSOCKET_CONSTRUCTOR_ERROR`,om=`BROWSER_WEBSOCKET_SECURITY_ERROR`,sm=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`}}})))()}var lm;function um(){return(um=e((()=>{$i(),ja(),lm=class{constructor(e){this.reconnect=e,this.stream=new na,this.projectedEvents=new WeakMap,this.generation=0}clear(){this.generation+=1,this.stream.clear()}async request(e,t,n,r){let i=this.generation,a=await e.request(t,n,r);if(t===`sessions.messages.unsubscribe`&&i===this.generation){let e=uo(a)?.key,t=uo(n),r=(typeof e==`string`?co(e)?.agentId:void 0)??t?.agentId??(e===`global`&&typeof t?.key==`string`?co(t.key)?.agentId:void 0);this.stream.retire(t=>{let n=t.agentId??co(t.sessionKey)?.agentId;return t.sessionKey===e&&n===r})}return a}dispatch(e,t){let n=this.project(e);n&&t?.(n)}project(e){if(e.event!==`chat`)return e;if(this.projectedEvents.has(e))return this.projectedEvents.get(e)??null;let t=this.stream.project(e),n=t.missingBaseline?null:t.event;return t.missingBaseline&&this.reconnect(`chat stream baseline missing`),this.projectedEvents.set(e,n),n}}})))()}function dm(e,t){return to(t)===ho.PROTOCOL_MISMATCH||!e?.toLowerCase().includes(`protocol mismatch`)?t:{code:ho.PROTOCOL_MISMATCH,clientMinProtocol:4,clientMaxProtocol:4,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}}}function fm(e){return to(e?.details)}function pm(){return(pm=e((()=>{Zo()})))()}async function mm(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=Gi({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}),a=await Ft(t.privateKey,i);return{id:t.deviceId,publicKey:t.publicKey,signature:a,signedAt:n,nonce:r}}function hm(){return(hm=e((()=>{xn()})))()}function gm(){if(navigator.platform===`MacIntel`)return navigator.maxTouchPoints>1||/iPad/u.test(navigator.userAgent)?`iPad`:`Mac`}async function _m({opts:e,connectNonce:t,connectChallengeTs:n,generation:r,serverCapabilities:i,nativeSignal:a,selectAuth:o,onDeviceIdentityReady:s}){let c=vm,l=Intl.DateTimeFormat().resolvedOptions().timeZone||void 0,u={id:e.clientName??qi.CONTROL_UI,version:e.clientVersion??`control-ui`,buildId:e.clientBuildId,platform:e.platform??navigator.platform??`web`,deviceFamily:e.deviceFamily??(e.platform===void 0?gm():void 0),mode:e.mode??Co.WEBCHAT,instanceId:e.instanceId,...l?{timeZone:l}:{}},d=e.token?.trim()||void 0,f={authToken:d,authPassword:e.password?.trim()||void 0},p;if(e.nativeConnectAuth){if(!t||typeof n!=`number`||!Number.isSafeInteger(n))throw Error(`The Gateway did not provide a valid native authentication challenge.`);p=await e.nativeConnectAuth({gatewayUrl:e.url,nonce:t,signedAt:n,signal:a}),a.throwIfAborted(),u={...p.client,buildId:e.clientBuildId,...l?{timeZone:l}:{}},f={authToken:p.auth.token,authPassword:p.auth.password,resolvedDeviceToken:p.auth.deviceToken}}let m=p?null:await Qr().catch(()=>null);s(m!==null),m&&(f=o({role:c,deviceId:m.deviceId})),p||(f.authPassword??=f.authToken);let h=p?.scopes??fo({requestedScopes:f.authBootstrapToken?e.bootstrapProfile===`owner`?[...To]:[...ro]:e.scopes,usingStoredDeviceToken:f.usingStoredDeviceToken,storedScopes:f.storedScopes,defaultScopes:ym}),g=p?.device??await mm({deviceIdentity:m,client:u,role:c,scopes:h,authToken:f.signatureToken,connectNonce:t,connectChallengeTs:n});return{generation:r,params:{minProtocol:4,maxProtocol:4,client:u,role:c,scopes:h,device:g,...Mo({modelCatalog:e.modelCatalog,serverCapabilities:i,caps:[`agent-kind`,`approvals`,`task-suggestions`,`terminal-offset-seq`,`terminal-session-metadata`,`terminal-upload-path-style`,`tool-events`,`chat-only-assistant-text`,`session-scoped-events`,`inline-widgets`,`model-selection-policy`,`ui-commands`,`ultrafast`,`usage-refreshing`]}),auth:p?.auth??Ho(f),userAgent:navigator.userAgent,locale:Un.getRequestedLocale()},explicitGatewayToken:p?void 0:d,selectedAuth:f,deviceIdentity:m}}var vm,ym;function bm(){return(bm=e((()=>{ao(),xo(),$a(),Fa(),Uo(),w(),xn(),hm(),vm=`operator`,ym=[`operator.admin`,`operator.read`,`operator.write`,`operator.approvals`,`operator.questions`,`operator.pairing`]})))()}function xm(){return(typeof window<`u`?window:void 0)?.isSecureContext===!0}function Sm(e){try{let t=new URL(e,window.location.href);return S(t.hostname)||t.host===new URL(window.location.href).host}catch{return!1}}function Cm(e){let{gatewayCode:t,message:n,details:r,retryable:i,retryAfterMs:a}=e;return{code:t,message:n,details:r,retryable:i,retryAfterMs:a}}async function wm(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``}}var Tm,Em,Dm,Om,km,Am,jm;function Mm(){return(Mm=e((()=>{Zo(),Io(),so(),ao(),Ra(),Wa(),Va(),Xi(),$p(),Sr(),xn(),ca(),cm(),um(),pm(),bm(),K(),Tm=class extends Aa{constructor(e){let t=dm(e.message,e.details);super({...e,details:t,message:Qa({message:e.message,details:t})}),this.name=`GatewayRequestError`}},Em=4008,Dm=4013,Om=1006,km=3e4,Am=1e3,jm=class{constructor(e){this.opts=e,this.chatEvents=new lm(e=>this.forceReconnect(e)),this.scopeUpgradeRuntime=null,this.inboundActivitySeq=0,this.lastInboundActivityAtMs=null,this.maxInboundSilenceMs=null,this.pendingDeviceTokenRetry=!1,this.deviceTokenRetryBudgetUsed=!1,this.nativeAuthAbort=null,this.nativeAuthError=null,this.recovery={value:``,resolved:!1,generation:0},this.scopeUpgradeBinding=null,this.reachabilityProbe=null,this.offlineStorageRetired=!1,this.client=new ma({createSocket:e=>(this.reachabilityProbe?.abort(),this.reachabilityProbe=null,this.chatEvents.clear(),this.maxPayloadBytes=void 0,im(this.opts.url,e,()=>this.maxPayloadBytes)),createRequestId:Da,createRequestError:e=>new Tm({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,serverCapabilities:r})=>this.buildConnectPlan(e,t,n,r),buildConnectParams:e=>e.params,onConnectPlanError:e=>this.opts.nativeConnectAuth?(this.nativeAuthError=e instanceof Tm?e:new Tm({code:`UNAVAILABLE`,message:Qt(e),retryable:e instanceof Qp}),{closeCode:Em,closeReason:`native authorization unavailable`,stop:!this.nativeAuthError.retryable}):{closeCode:Em,closeReason:`connect failed`},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.nativeAuthAbort?.abort(),this.chatEvents.clear(),this.recovery={...this.recovery,generation:e.generation+1,resolved:!1},this.clearInboundActivity(),this.scopeUpgradeBinding=null;let n=e.connectFailure?.error??this.nativeAuthError;if(this.client.recordTiming(`failed`,e.generation,void 0,{errorCode:n instanceof Tm?n.code:`SOCKET_CLOSED`}),t.notify){let r={code:e.code,reason:e.reason,error:n instanceof Tm?Cm(n):void 0,willRetry:t.retry};if(t.retry&&!e.socketOpened&&e.code===Om&&!r.error){let e=new AbortController;this.reachabilityProbe=e;let t=setTimeout(()=>e.abort(),1e3);rm(this.opts.url,e.signal).then(n=>{clearTimeout(t),this.reachabilityProbe===e&&(this.reachabilityProbe=null,this.opts.onClose?.({...r,...n&&!e.signal.aborted?{busy:!0}:{}}))}).catch(e=>console.error(`[gateway] close handler error:`,e))}else this.opts.onClose?.(r)}},onReconnectScheduled:e=>this.opts.onReconnectScheduled?.(e),onSocketFactoryError:e=>this.handleSocketFactoryError(e),onEvent:e=>this.chatEvents.dispatch(e,this.opts.onEvent),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.nativeAuthAbort?.abort(),this.reachabilityProbe?.abort(),this.reachabilityProbe=null,this.chatEvents.clear(),this.clearInboundActivity(),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 needsWakeReconnect(){return!this.client.connected||this.lastInboundActivityAtMs!==null&&this.maxInboundSilenceMs!==null&&Date.now()-this.lastInboundActivityAtMs>=this.maxInboundSilenceMs}get connectionGeneration(){return this.recovery.generation}get recoveryScope(){return this.recovery.value}get offlineRecoveryRetired(){return this.offlineStorageRetired}get offlineRecoveryScope(){return this.opts.offlineRecoveryScope}retireOfflineRecoveryScope(){this.opts.offlineRecoveryScope=void 0,this.offlineStorageRetired=!0}get recoveryScopeReady(){return this.recovery.resolved}get scopeUpgradeReady(){return this.connected&&this.scopeUpgradeBinding!==null}connectPlanTimingPayload(e){return{secureContext:xm(),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,r){this.nativeAuthError=null,this.recovery={...this.recovery,generation:n,resolved:!1},this.nativeAuthAbort?.abort(),this.nativeAuthAbort=new AbortController;let i=await _m({opts:this.opts,connectNonce:e,connectChallengeTs:t,generation:n,serverCapabilities:r,nativeSignal:this.nativeAuthAbort.signal,selectAuth:e=>this.selectConnectAuth(e),onDeviceIdentityReady:e=>{this.client.recordTiming(`device-identity-ready`,n,void 0,{secureContext:xm(),hasDeviceIdentity:e})}});return this.pendingDeviceTokenRetry&&i.selectedAuth.authDeviceToken&&(this.pendingDeviceTokenRetry=!1),i}handleConnectHello(e,t){if(this.recovery.value=e.auth?.recoveryScope??``,this.opts.offlineRecoveryScope=e.auth?.recoveryScope,this.offlineStorageRetired=!1,this.maxPayloadBytes=e.policy?.maxPayload,this.initializeInboundActivity(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??`operator`},e?.auth?.deviceToken&&t.deviceIdentity){let n=e.auth.role??t.params.role??`operator`,r=n===t.params.role&&e.auth.deviceToken===t.selectedAuth.storedToken?t.selectedAuth.storedScopes??e.auth.scopes??[]:e.auth.scopes??[];ui({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 wm(e.auth?.deviceToken??t.selectedAuth.authDeviceToken??t.selectedAuth.resolvedDeviceToken??t.selectedAuth.authToken),i=n&&e.auth?.recoveryMigrationAllowed===!0&&r?(await W(async()=>{let{default:e}=await import(`./control-ui-boot-shared-D3oo_6Fq.js`).then(e=>(e.s(),e.c));return{default:e}},__vite__mapDeps([13,1,3,2,4,5,8,7,6,9,11,12,14,15,28,29,31,30]),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.offlineRecoveryScope=this.recovery.value||void 0,this.opts.onRecoveryScopeChange?.())}initializeInboundActivity(e){let t=e.policy?.tickIntervalMs,n=Xa(typeof t==`number`&&Number.isFinite(t)&&t>0?t:km,{minMs:Am});this.maxInboundSilenceMs=n*2,this.lastInboundActivityAtMs=Date.now()}clearInboundActivity(){this.lastInboundActivityAtMs=null,this.maxInboundSilenceMs=null}handleConnectFailure(e,t){let n=e instanceof Tm?fm(e):null;Oo({retryBudgetUsed:this.deviceTokenRetryBudgetUsed,currentDeviceToken:t.selectedAuth.authDeviceToken,explicitToken:t.explicitGatewayToken,storedToken:t.selectedAuth.storedToken,trustedEndpoint:!!t.deviceIdentity&&Sm(this.opts.url),errorDetails:e instanceof Tm?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===ho.AUTH_DEVICE_TOKEN_MISMATCH&&er({deviceId:t.deviceIdentity.deviceId,gatewayUrl:this.opts.url,role:t.params.role??`operator`});let r=ea(e);return r===null?{closeCode:Em,closeReason:`connect failed`}:{closeCode:Dm,closeReason:`gateway starting`,reconnectDelayMs:Math.ceil(r*(1+Math.random()*.2))}}selectConnectAuth(e){let t=Ct({deviceId:e.deviceId,gatewayUrl:this.opts.url,role:e.role}),n=t?.scopes??[],r=e.role!==`operator`||qo({role:e.role,requestedScopes:[`operator.sessions.read`],allowedScopes:n});return Po({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:Sm(this.opts.url),preferBootstrapToken:!0})}request(e,t,n){return this.chatEvents.request(this.client,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:ym,onPending:e.onPending})}cancelScopeUpgrade(){this.scopeUpgradeRuntime?.then(e=>e.cancelScopeUpgrade()).catch(()=>void 0)}loadScopeUpgradeRuntime(){return this.scopeUpgradeRuntime??=W(async()=>{let{createGatewayScopeUpgradeRuntime:e}=await import(`./gateway-scope-upgrade.runtime-CxRpEm5T.js`);return{createGatewayScopeUpgradeRuntime:e}},__vite__mapDeps([84,1,28]),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(t=>this.chatEvents.dispatch(t,e))}forceReconnect(e){this.client.closeSocket(4e3,e)}resolveClose(e){if(this.nativeAuthError)return{retry:this.nativeAuthError.retryable,notify:!0,pendingError:this.nativeAuthError};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 Tm?Cm(t):void 0;return{retry:fm(r)===ho.AUTH_TOKEN_MISMATCH?this.pendingDeviceTokenRetry:!ua({details:r?.details,protocolMismatchIsTerminal:!0}),notify:!0,pendingError:t}}handleSocketFactoryError(e){let t=nm(e,this.opts.url);this.pendingDeviceTokenRetry=!1;try{this.opts.onClose?.({code:Om,reason:t.code===`BROWSER_WEBSOCKET_SECURITY_ERROR`?`security error`:`websocket error`,error:t,willRetry:!1})}catch(e){console.error(`[gateway] close handler error:`,e)}}}})))()}function Nm(e){if(!Bm.test(e))return;let[t=``,n]=e.toLowerCase().split(`e`),r=t.startsWith(`-`),[i=``,a=``]=(r?t.slice(1):t).split(`.`),o=`${i||`0`}${a}`;if(/^0+$/u.test(o))return{numerator:0n,denominator:1n};let s=Number(n??0);if(!Number.isSafeInteger(s))return;let c=a.length-s;if(o.length>Vm||Math.abs(c)>Vm)return;let l=BigInt(o),u=c<0?l*10n**BigInt(-c):l;return{numerator:r?-u:u,denominator:c>0?10n**BigInt(c):1n}}function Pm(e,t){return e.numerator*t.denominator===t.numerator*e.denominator}function Fm(e){return Bm.test(e.trim())}function Im(e){let t=e.trim();return/^-?\d+$/u.test(t)&&!Number.isSafeInteger(Number(t))}function Lm(e,t){let n=e.trim();if(n===``)return;let r=Nm(n),i=Number(n);if(!r||!Number.isFinite(i)||t&&!Number.isInteger(i))return e;let a=Number.isInteger(i)?void 0:zm(i);return(Number.isInteger(i)?r.numerator===BigInt(i)*r.denominator:a&&Pm(r,a))?i:e}function Rm(e){return Number.isInteger(e)?BigInt(e).toString():String(e)}function zm(e){if(Number.isFinite(e))return Nm(String(e))}var Bm,Vm;function Hm(){return(Hm=e((()=>{Bm=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,Vm=1024})))()}function Um(e,t,n){let r=`${yo(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 Wm(e,t){let n=Um(e,t,Us.approval);if(n!==void 0)return{kind:`approval`,approvalId:n};let r=Um(e,t,Us.question);return r===void 0?null:{kind:`question`,questionId:r}}function Gm(){return(Gm=e((()=>{Y()})))()}var Km;function qm(){return(qm=e((()=>{Km=class{constructor(){this.listeners=new Set}attach(e){return this.owner=e,this.notify(),()=>{this.owner===e&&(this.owner=void 0,this.notify())}}openSession(e,t){if(!this.owner)throw Error(`The conversation dock is unavailable. Reopen the Control UI and try again.`);this.owner.openSession(e,t)}close(e){this.owner?.closeSession(e)}get openSessionKey(){return this.owner?.openSessionKey??null}subscribe(e){return Ka(this.listeners,e)}notify(){for(let e of this.listeners)e()}}})))()}function Jm(e){let t=Do(e)?.phase;return t===`accepting`||t===`preparing`||t===`draining`||t===`prepared`?t:void 0}function Ym(e){return e.reason instanceof Error?e.reason:new DOMException(`Gateway wait aborted`,`AbortError`)}function Xm(e,t){let n=e.snapshot.client;return t.aborted?Promise.reject(Ym(t)):n&&e.snapshot.phase===`connected`?Promise.resolve(n):new Promise((n,r)=>{let i=()=>void 0,a=!1,o=()=>{i(),t.removeEventListener(`abort`,s)},s=()=>{o(),r(Ym(t))};t.addEventListener(`abort`,s,{once:!0}),i=e.subscribe(e=>{e.phase===`connected`&&e.client&&(a=!0,o(),n(e.client))}),(a||t.aborted)&&i()})}function Zm(){return(Zm=e((()=>{})))()}function Qm(e,t){let n=e?.trim();if(!n||!t)return null;let r=G(n);return t.agents.some(e=>G(e.id)===r)?r:null}function $m(e,t){let n=new URLSearchParams(e.search);if(!n.has(`session`))return null;let r=J(`chat`,t),i=J(`dashboard`,t),a=e.pathname===r||e.pathname===`${r}/`?`chat`:e.pathname===i||e.pathname===`${i}/`?`dashboard`:null;return a?{face:n.get(`face`)===`dashboard`?`dashboard`:a,sessionKey:n.get(`session`)?.trim()??``}:null}function eh(){return(eh=e((()=>{Y(),Be()})))()}function th(e){if(!lh.test(e))throw Error(`Unsupported tweakcn link. Expected a theme share URL.`)}function nh(e,t){let n=V(e);if(!n||n.length>dh)throw Error(`Unsupported tweakcn token: ${t}`);let r=n.toLowerCase();if(fh.some(e=>r.includes(e)))throw Error(`Unsupported tweakcn token: ${t}`);for(let e of n){let n=e.charCodeAt(0);if(n<32||n===127||"{};<>`".includes(e))throw Error(`Unsupported tweakcn token: ${t}`)}return n}function rh(e,t){let n=nh(e,t);if(/[^A-Za-z0-9 ,'"._-]/.test(n))throw Error(`Unsupported tweakcn token: ${t}`);return n}function ih(e){if(!e)return null;let t=[];for(let n of ph){let r=n===`font-body`||n===`font-display`||n===`mono`?rh(e[n],n):nh(e[n],n);t.push([n,r])}return Object.fromEntries(t)}function ah(e){let t=V(e);return t?Fo(t,80):`Custom`}function oh(e){let t=uo(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{th(r);let e=ih(uo(t.light)??void 0),o=ih(uo(t.dark)??void 0);return!e||!o?null:{sourceUrl:n,themeId:r,label:ah(i),importedAt:a,light:e,dark:o}}catch{return null}}function sh(e){let t=ih(e.light),n=ih(e.dark);if(!t||!n)throw Error(`Stored custom theme is missing required tokens.`);let r=e=>ph.map(t=>` --${t}: ${e[t]};`).join(`
`);return[`:root[data-theme="custom"] {`,r(n),`}`,`:root[data-theme="custom-light"] {`,r(t),`}`].join(`
`)}function ch(e){if(typeof document>`u`)return;let t=document.getElementById(uh);if(!e){t?.remove();return}let n;try{n=sh(e)}catch{t?.remove();return}t||(t=document.createElement(`style`),t.id=uh,document.head.appendChild(t)),t.textContent=n}var lh,uh,dh,fh,ph;function mh(){return(mh=e((()=>{lh=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,uh=`openclaw-custom-theme`,dh=240,fh=[`url(`,`image(`,`image-set(`,`-webkit-image-set(`,`cross-fade(`,`element(`,`-moz-element(`,`paint(`,`@import`,`expression(`,`/*`,`*/`,`\\`],ph=`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 hh(e,t){return{theme:e===`custom`||aa(e)?e:`claw`,mode:fa(t)??`system`}}function gh(e,t){let n=t;if(n===`system`&&(n=typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`),e===`claw`)return n;let r=Ta(e)?e===`knot`?`openknot`:e:`custom`;return n===`light`?`${r}-light`:r}function _h(e,t){if(typeof document>`u`||e===`claw`||!Ta(e)){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=Sc(`themes/${e}.css`),document.head.append(i))}function vh(){return(vh=e((()=>{ya(),Cc()})))()}function yh(e){return vo.find(t=>t===e)}function bh(e,t,n){let r=kh[Ta(e)?e:`custom`];return{ui:t??r.ui,chat:n??r.chat}}function xh(e){let t=`openclaw-typeface-${e}`,n=Oh[e].asset;if(!n||document.getElementById(t))return;let r=document.createElement(`link`);r.id=t,r.rel=`stylesheet`,r.href=Sc(n),document.head.append(r)}function Sh(e){typeof document<`u`&&(xh(e.ui),xh(e.chat),xh(`jetbrains-mono`))}function Ch(){vo.forEach(xh)}function wh(e,t){for(let[n,r]of[[`--font-body`,e],[`--font-chat`,t]])r?document.documentElement.style.setProperty(n,Oh[r].stack):document.documentElement.style.removeProperty(n)}function Th(e){Dh[e].kind===`serif`?document.documentElement.style.setProperty(`--chat-font-smoothing`,`auto`):document.documentElement.style.removeProperty(`--chat-font-smoothing`)}var Eh,Dh,Oh,kh;function Ah(){return(Ah=e((()=>{ga(),ya(),Cc(),Eh={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`},Dh={"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`}},Oh=Object.fromEntries(vo.map(e=>{let{label:t,family:n=t,kind:r}=Dh[e];return[e,{label:t,stack:e===`system`?Eh.sans:`"${n}", ${Eh[r]}`,asset:e===`system`?void 0:`fonts/${e}.css`}]})),kh={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`},crt:{ui:`jetbrains-mono`,chat:`jetbrains-mono`},manuscript:{ui:`lora`,chat:`lora`},rose:{ui:`dm-sans`,chat:`dm-sans`},miami:{ui:`space-grotesk`,chat:`space-grotesk`},custom:{ui:`system`,chat:`system`}}})))()}function jh(e){let t=V(e);return t?Pr(t)?t.length<=Rh?t:null:/[\r\n]/.test(t)?null:t.length<=Lh?t:null:null}function Mh(e){let t=V(e?.name);return{name:t?Fo(t,Ih):null,avatar:jh(e?.avatar)}}function Nh(e,t=`You`){return Mh(e).name??t}function Ph(e){let t=Mh(e);return _r(t.avatar,{identity:{avatar:t.avatar??void 0}})}function Fh(e){let t=Mh(e),n=t.avatar;return n?Ph(t)?null:n:null}var Ih,Lh,Rh;function zh(){return(zh=e((()=>{dr(),Ih=50,Lh=16,Rh=2e6})))()}function Bh(e){return`${hg}${no(e)}`}function Vh(e){return`${vg}${no(e)}`}function Hh(e){for(let t of e.matchAll(Dg)){let e=t[0].toLowerCase();if(!wg.has(e)&&!Cg.has(e)&&!Tg.has(e))return!1}return!0}function Uh(e){if(typeof e!=`string`)return;let t=e.trim().replace(/\s+/g,` `);if(t.length!==0&&!(t.length>kg)){if(Cg.has(t.toLowerCase())||Og.test(t))return t;if(Eg.test(t)&&CSS.supports(`max-width`,t)&&Hh(t))return/^(?:calc|clamp|fit-content|max|min)\(.+\)$/i.test(t)?t:void 0}}function Wh(e,t){return n=>e.find(e=>e===n)??t}function Gh(e){return Mg.find(t=>t===e)}function Kh(e){return Ui(`ui.accent`,e)}function qh(e,t=100){if(typeof e!=`number`||!Number.isFinite(e))return t;let n=Sg[0],r=Math.abs(e-n);for(let t of Sg){let i=Math.abs(e-t);i<r&&(n=t,r=i)}return n}function Jh(e){let t=V(e);return e===null?null:t?G(t):void 0}function Yh(e,t){return typeof e==`boolean`?e:t}function Xh(){return typeof document>`u`?!1:!!document.querySelector(`script[src*="/@vite/client"]`)}function Zh(e,t){return`${e.includes(`:`)&&!e.startsWith(`[`)?`[${e}]`:e}:${t}`}function Qh(){let e=location.protocol===`https:`?`wss`:`ws`,t=mc(location.pathname)[0],n=`${e}://${location.host}${t}`;return Xh()?{pageUrl:n,effectiveUrl:`${e}://${Zh(location.hostname,`18789`)}`}:{pageUrl:n,effectiveUrl:n}}function $h(e){let{effectiveUrl:t}=Qh();if(no(e.gatewayUrl)===no(t))return e;let n=ig(t);return{...e,gatewayUrl:t,token:og(e.gatewayUrl,t,{token:e.token,password:``}).token,sessionKey:n.sessionKey,lastActiveSessionKey:n.lastActiveSessionKey}}function eg(e){return e?Ea(e)??null:null}function tg(e,t){let n=eg(e?.getItem(Bh(t))??null),r=V(n?.gatewayUrl);return n&&(!r||no(r)===no(t))?{gatewayUrl:r??t,parsed:n}:null}function ng(e){return`${xg}${no(e)}`}function rg(e,t,n){let r=t.sessionsByGateway?.[no(e)],i=V(r?.sessionKey),a=V(r?.lastActiveSessionKey),o=V(r?.selectedAgentId);return i&&a?{sessionKey:i,lastActiveSessionKey:a,...o?{selectedAgentId:G(o)}:{}}:n}function ig(e){let t={sessionKey:`main`,lastActiveSessionKey:`main`};try{let n=tg(Le(),e);return n?rg(e,n.parsed,t):t}catch{return t}}function ag(e){try{let t=Ti();if(!t)return``;t.removeItem(bg);let n=t.getItem(ng(e));return V(n)??``}catch{return``}}function og(e,t,n){let r=no(e)===no(t),i=q(e)===q(t);return{token:r?n.token:ag(t),password:i?n.password:``}}function sg(e,t){try{let n=Ti();if(!n)return;n.removeItem(bg);let r=ng(e),i=V(t)??``;if(i){n.setItem(r,i);return}n.removeItem(r)}catch{}}function cg(e){return zg=e,()=>{zg===e&&(zg=null)}}function lg(e=zg?.gatewayUrl()){let t=ug(e);return{...t,token:ag(t.gatewayUrl)}}function ug(e=void 0){let t=Rg;if(t&&(!e||no(t.gatewayUrl)===no(e)))return e?{...t,gatewayUrl:e}:t;let{pageUrl:n,effectiveUrl:r}=Qh(),i=Le(),a={gatewayUrl:e??r,sessionKey:`main`,lastActiveSessionKey:`main`,theme:Lg.theme,themeMode:Lg.themeMode,chatShowThinking:!0,chatShowToolCalls:!0,chatPersistCommentary:!0,chatShowTaskProgress:Lg.chatShowTaskProgress,chatCollapseTaskProgress:Lg.chatCollapseTaskProgress,chatSendShortcut:Lg.chatSendShortcut,catalogOpenTarget:Lg.catalogOpenTarget,navCollapsed:!1,navWidth:_g,sidebarAgentsMode:`chip`,sidebarEntries:[...qc],sidebarLiveActivity:Lg.sidebarLiveActivity,showAdvancedSettings:!1,pinnedAgentIds:[],composerHoldToRecord:Lg.composerHoldToRecord};try{let t=e??V(i?.getItem(Vh(n))),o=(t?tg(i,t):null)??(e?null:tg(i,r));if(!o)return a;let s=o.parsed,c=o.gatewayUrl,l=e??(c===n?r:c),u=rg(l,s,a),f=oh(s.customTheme),{theme:p,mode:m}=hh(s.theme,s.themeMode),h=Do(s)??{},g=Object.hasOwn(h,`sidebarEntries`)?null:Array.isArray(h.sidebarPinnedRoutes)?kc(h.sidebarPinnedRoutes.map(e=>typeof e==`string`?`route:${e}`:e)):null,_={gatewayUrl:l,sessionKey:u.sessionKey,lastActiveSessionKey:u.lastActiveSessionKey,selectedAgentId:u.selectedAgentId,theme:p===`custom`&&!f?`claw`:p,themeMode:m,accent:Kh(s.accent),fontUi:yh(s.fontUi),fontChat:yh(s.fontChat),chatShowThinking:Yh(s.chatShowThinking,a.chatShowThinking),chatShowToolCalls:Yh(s.chatShowToolCalls,a.chatShowToolCalls),chatPersistCommentary:Yh(s.chatPersistCommentary,a.chatPersistCommentary),chatShowTaskProgress:Yh(s.chatShowTaskProgress,a.chatShowTaskProgress),chatCollapseTaskProgress:Yh(s.chatCollapseTaskProgress,a.chatCollapseTaskProgress),chatSendShortcut:jg(s.chatSendShortcut),chatFollowUpMode:Gh(s.chatFollowUpMode),catalogOpenTarget:Fg(s.catalogOpenTarget),realtimeTalkInputDeviceId:V(s.realtimeTalkInputDeviceId),realtimeTalkVideoDeviceId:V(s.realtimeTalkVideoDeviceId),composerHoldToRecord:Yh(s.composerHoldToRecord,a.composerHoldToRecord),talkCameraAutoEnable:typeof s.talkCameraAutoEnable==`boolean`?s.talkCameraAutoEnable:void 0,chatSplitLayout:se(s.chatSplitLayout),chatWorkspaceDock:Ig(s.chatWorkspaceDock),boardSessionViews:Mr(s.boardSessionViews),sidebarSessionLayouts:et(s.sidebarSessionLayouts),sidebarSessionActivePanels:d(s.sidebarSessionActivePanels),navCollapsed:a.navCollapsed,navWidth:typeof s.navWidth==`number`&&s.navWidth>=240&&s.navWidth<=400?s.navWidth:a.navWidth,sidebarAgentsMode:s.sidebarAgentsMode===`roster`?`roster`:`chip`,sidebarPreTeamScope:Jh(s.sidebarPreTeamScope),sidebarCollapsedAgentIds:Wo(s.sidebarCollapsedAgentIds),sidebarEntries:kc(h.sidebarEntries)??g??a.sidebarEntries,sidebarLiveActivity:Yh(s.sidebarLiveActivity,a.sidebarLiveActivity),chatMessageMaxWidth:Uh(s.chatMessageMaxWidth),showAdvancedSettings:Yh(s.showAdvancedSettings,a.showAdvancedSettings),pinnedAgentIds:Wo(s.pinnedAgentIds),textScale:typeof s.textScale==`number`&&qh(s.textScale)!==Lg.textScale?qh(s.textScale):void 0,customTheme:f??void 0,locale:O(s.locale)?s.locale:void 0,...s.lobsterPetVisits===!1?{lobsterPetVisits:!1}:{},...s.lobsterPetSounds===!0?{lobsterPetSounds:!0}:{},...s.sessionDeleteConfirm===!1?{sessionDeleteConfirm:!1}:{},...s.openLinksInControlUiBrowser===!0?{openLinksInControlUiBrowser:!0}:{},...s.openLinksExternally===!0?{openLinksExternally:!0}:{}};return g!==null&&mg({..._,token:ag(l)},{selectGateway:!e}),_}catch{return a}}function dg(e){Bg=e}function fg(e,t={}){let n=lg(e.gatewayUrl),r={...n,...e};return mg(r,{selectGateway:t.selectGateway??e.gatewayUrl!==void 0}),Bg?.(n,r),r}function pg(){let e=Le();try{let t=e?.getItem(yg);return t?Mh(JSON.parse(t)):Mh()}catch{return Mh()}}function mg(e,t={}){let n=Le(),r=no(e.gatewayUrl),i=Bh(e.gatewayUrl),a={};try{let t=tg(n,e.gatewayUrl);if(t){let e=t.parsed;e.sessionsByGateway&&typeof e.sessionsByGateway==`object`&&(a=e.sessionsByGateway)}}catch{}let o=Object.fromEntries([...Object.entries(a).filter(([e])=>e!==r),[r,{sessionKey:e.sessionKey,lastActiveSessionKey:e.lastActiveSessionKey,...V(e.selectedAgentId)?{selectedAgentId:G(e.selectedAgentId)}:{}}]].slice(-10)),s={gatewayUrl:e.gatewayUrl,theme:e.theme,themeMode:e.themeMode,accent:Kh(e.accent),fontUi:yh(e.fontUi),fontChat:yh(e.fontChat),chatShowThinking:e.chatShowThinking,chatShowToolCalls:e.chatShowToolCalls,chatPersistCommentary:e.chatPersistCommentary??!0,chatShowTaskProgress:e.chatShowTaskProgress!==!1&&void 0,chatCollapseTaskProgress:e.chatCollapseTaskProgress===!0||void 0,chatSendShortcut:e.chatSendShortcut===`modifier-enter`?`modifier-enter`:void 0,chatFollowUpMode:Gh(e.chatFollowUpMode),catalogOpenTarget:e.catalogOpenTarget===`terminal`?`terminal`:void 0,realtimeTalkInputDeviceId:V(e.realtimeTalkInputDeviceId),realtimeTalkVideoDeviceId:V(e.realtimeTalkVideoDeviceId),composerHoldToRecord:e.composerHoldToRecord!==!1&&void 0,talkCameraAutoEnable:typeof e.talkCameraAutoEnable==`boolean`?e.talkCameraAutoEnable:void 0,chatSplitLayout:e.chatSplitLayout||void 0,chatWorkspaceDock:e.chatWorkspaceDock===`bottom`?`bottom`:void 0,boardSessionViews:e.boardSessionViews&&Object.keys(e.boardSessionViews).length>0?Mr(e.boardSessionViews):void 0,sidebarSessionLayouts:e.sidebarSessionLayouts&&Object.keys(e.sidebarSessionLayouts).length>0?et(e.sidebarSessionLayouts):void 0,sidebarSessionActivePanels:e.sidebarSessionActivePanels&&Object.keys(e.sidebarSessionActivePanels).length>0?d(e.sidebarSessionActivePanels):void 0,navWidth:e.navWidth,sidebarAgentsMode:e.sidebarAgentsMode===`roster`?`roster`:`chip`,sidebarPreTeamScope:Jh(e.sidebarPreTeamScope),sidebarCollapsedAgentIds:e.sidebarCollapsedAgentIds?.length?Wo(e.sidebarCollapsedAgentIds):void 0,sidebarEntries:e.sidebarEntries,sidebarLiveActivity:e.sidebarLiveActivity!==!1&&void 0,chatMessageMaxWidth:Uh(e.chatMessageMaxWidth),showAdvancedSettings:e.showAdvancedSettings===!0||void 0,pinnedAgentIds:e.pinnedAgentIds?.length?e.pinnedAgentIds:void 0,textScale:e.textScale===void 0?void 0:qh(e.textScale),customTheme:e.customTheme||void 0,sessionsByGateway:o,locale:e.locale||void 0,lobsterPetVisits:e.lobsterPetVisits!==!1&&void 0,lobsterPetSounds:e.lobsterPetSounds===!0||void 0,sessionDeleteConfirm:e.sessionDeleteConfirm!==!1&&void 0,openLinksInControlUiBrowser:e.openLinksInControlUiBrowser===!0||void 0,openLinksExternally:e.openLinksExternally===!0||void 0},c=JSON.stringify(s),{token:l,...u}=e;Rg=u;try{let{pageUrl:r}=Qh(),a=Vh(r);n?.setItem(i,c),(t.selectGateway||n?.getItem(a)==null)&&n?.setItem(a,e.gatewayUrl),n?.removeItem(gg),n&&(Rg=null)}catch{}let f=zg;f&&no(f.gatewayUrl())===r&&f.refresh()}var hg,gg,_g,vg,yg,bg,xg,Sg,Cg,wg,Tg,Eg,Dg,Og,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig,Lg,Rg,zg,Bg;function Vg(){return(Vg=e((()=>{mo(),Vo(),wo(),So(),rl(),w(),cr(),Ci(),E(),bc(),mh(),vh(),Ah(),zh(),hg=`openclaw.control.settings.v1:`,gg=`openclaw.control.settings.v1`,_g=258,vg=`openclaw.control.currentGateway.v1:`,yg=`openclaw.control.user.v1`,bg=`openclaw.control.token.v1`,xg=`openclaw.control.token.v1:`,Sg=[90,100,110,125,140],Cg=new Set([`none`,`min-content`,`max-content`]),wg=new Set([`calc`,`clamp`,`fit-content`,`max`,`min`]),Tg=new Set([`ch`,`em`,`rem`,`vh`,`vmax`,`vmin`,`vw`,`px`]),Eg=/^[0-9A-Za-z.%+\-*/(),\s]+$/,Dg=/[A-Za-z][A-Za-z0-9-]*/g,Og=/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|rem|em|ch|vw|vh|vmin|vmax|%)$/i,kg=96,Ag=[`enter`,`modifier-enter`],jg=Wh(Ag,`enter`),Mg=[`queue`,`steer`],Ng=Wh(Mg,`steer`),Pg=[`viewer`,`terminal`],Fg=Wh(Pg,`viewer`),Ig=Wh([`right`,`bottom`],`right`),Lg={theme:`claw`,themeMode:`system`,textScale:100,sidebarLiveActivity:!0,chatMessageMaxWidth:`48rem`,chatShowTaskProgress:!0,chatCollapseTaskProgress:!1,chatSendShortcut:`enter`,catalogOpenTarget:`viewer`,composerHoldToRecord:!0,lobsterPetVisits:!0,lobsterPetSounds:!1,sessionDeleteConfirm:!0},Rg=null,zg=null,Bg=null})))()}function Hg(e,t){return!new URLSearchParams(e.search+`&`+e.hash.slice(1)).has(`session`)&&!es(e.pathname,t)&&(ks(e.pathname,t)===null||/^\/chat\/?$/u.test(e.pathname.slice(t.length)))}async function Ug(e){let t=$m(e.location,e.basePath);if(!t)return null;let n=!!(e.agentsList()?.mainKey?.trim()||e.gateway.snapshot.phase===`connected`&&e.gateway.snapshot.hello),r=Mn(t.sessionKey);t.sessionKey&&!n&&await Xm(e.gateway,e.signal);let i={agentsList:e.agentsList(),hello:e.gateway.snapshot.hello},a=r?.agentId??(Qm(e.selectedAgentId,i.agentsList)||ge(i)),o=T(i),s=t.sessionKey?od(t.face,a,t.sessionKey,e.basePath,{mainKey:o}):null,c=new URLSearchParams(e.location.search);c.delete(`session`),c.delete(`face`);let l=c.toString();return{...e.location,pathname:s??J(t.face,e.basePath),search:l?`?${l}`:``}}function Wg(e,t,n,r,i){if(!Hg(e,t)||!n.trim())return e;let a=Mn(n)?.agentId??r.trim();if(!a)return e;let{options:o}=Ye({face:`chat`,sessionKey:n,fallbackAgentId:a,basePath:t,mainKey:i,exactKey:!0});if(o.pathname===J(`chat`,t))return e;let s=new URLSearchParams(e.search);return new URLSearchParams(o.search).forEach((e,t)=>s.set(t,e)),{...e,pathname:o.pathname,search:s.size?`?${s}`:``}}function Gg(e,t,n){if(ks(e.pathname,t)===`new-session`){let t=hr(e.search).agentId;return t?{agentId:t}:{}}let r=ig(n);if(ks(e.pathname,t)===`model-providers`)return r.selectedAgentId?{agentId:r.selectedAgentId}:{};let i=Wg(e,t,r.sessionKey,r.selectedAgentId??``),a=go(i.pathname,t);if(a?.kind===`literal`)return{agentId:a.agentId,sessionKey:a.sessionKey};if(a?.kind===`main`)return{agentId:a.agentId,sessionKey:Ha({agentId:a.agentId})};if(a?.kind===`short`)return{agentId:a.agentId,shortId:a.shortId,...a.slugHint?{slugHint:a.slugHint}:{}};if(nr(e,t,ks)){let e=Mn(r.sessionKey)?.agentId??r.selectedAgentId;return{sessionKey:r.sessionKey,...e?{agentId:e}:{}}}}function Kg(e){let t=null;return()=>t??=e.resolve().catch(t=>{if(e.signal.aborted)return e.fallback;throw t})}async function qg(e){let t=await Ug(e);if(t)return t;if(!Hg(e.location,e.basePath))return e.location;let n=await Xm(e.gateway,e.signal),r=e.gateway.snapshot.hello,i=e.agentsList(),a={agentsList:i,hello:e.gateway.snapshot.hello},o=e.sessionKey.trim()||e.gateway.snapshot.sessionKey,s=ge(a),c=Mn(o)?.agentId??Qm(e.selectedAgentId,i)??s;if(i=await e.ensureAgentsList?.()??i,e.signal.throwIfAborted(),e.gateway.snapshot.client!==n||e.gateway.snapshot.hello!==r)return qg(e);s=ge({agentsList:i,hello:r}),i&&!Qm(c,i)&&(c=Qm(e.selectedAgentId,i)??s,o=Ha({agentId:c,mainKey:T({agentsList:i,hello:e.gateway.snapshot.hello})}));let l={agentsList:i,hello:e.gateway.snapshot.hello},u=T(l),d=oe(l,o,c);o=d.sessionKey,c=d.agentId??c;let f=Mn(o),p=y(o)||(f?.rest??o).toLowerCase()===u.toLowerCase(),m=null;if(!p&&!vt(o)){try{m=await n.request(`sessions.resolve`,{key:o,agentId:c,allowMissing:!0},{signal:e.signal})}catch{e.signal.throwIfAborted()}if(e.signal.throwIfAborted(),e.gateway.snapshot.client!==n||e.gateway.snapshot.hello!==r)return qg(e);m&&!m.ok&&(o=Ha({agentId:c,mainKey:u}))}let h=m?.ok?m:void 0;return Wg(e.location,e.basePath,h?.key??o,h?.agentId??c,u)}function Jg({router:e,gateway:t,agents:n,agentSelection:r,connectionBootstrap:i,initialChatRoute:a,chatSubmissions:o}){i.setForegroundRoute(a?void 0:null);let s=t.subscribe(e=>{i.synchronize({client:e.client,connected:e.phase===`connected`})}),c=e=>{let a=e.pendingMatches[0]??e.matches[0];if(!a&&e.status===`idle`)return;let s=Do(a?.data),c=s?.kind===`session`&&typeof s.sessionKey==`string`?s.sessionKey:null;i.setForegroundRoute(a?.routeId!==`chat`||o.creation?null:a.status===`pending`?void 0:a.status===`success`&&c&&!vt(c)?qn({settings:t.connection,client:t.snapshot.client,agentsList:n.state.agentsList,hello:t.snapshot.hello,assistantAgentId:r.state.selectedId},{sessionKey:c,agentId:typeof s?.agentId==`string`?s.agentId:void 0}):null)},l=()=>c(e.getState()),u=[s,e.subscribe(c),r.subscribe(l),o.subscribeCreate(l)];return()=>u.forEach(e=>e())}function Yg(){return(Yg=e((()=>{Y(),qp(),sd(),Jp(),mt(),me(),Be(),Wt(),yr(),Zm(),eh(),Vg()})))()}function Xg(e){let t=!1,n=()=>({navCollapsed:t,navWidth:e.settings.navWidth,sidebarEntries:e.settings.sidebarEntries,pinnedAgentIds:e.settings.pinnedAgentIds??[]}),r=new Set;return{get snapshot(){return n()},update(e){let i=e.navCollapsed!==void 0&&e.navCollapsed!==t;e.navCollapsed!==void 0&&(t=e.navCollapsed);let a={};if(e.navWidth!==void 0&&(a.navWidth=e.navWidth),e.sidebarEntries!==void 0&&(a.sidebarEntries=[...e.sidebarEntries]),e.pinnedAgentIds!==void 0&&(a.pinnedAgentIds=[...e.pinnedAgentIds]),Object.keys(a).length>0&&fg(a),i)for(let e of r)e(n())},subscribe(t){r.add(t);let i=e.subscribe(()=>t(n()));return()=>{r.delete(t),i()}}}}function Zg(){return(Zg=e((()=>{Vg()})))()}function Qg(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 $g(){return($g=e((()=>{})))()}function e_(){if(typeof document>`u`)return;let e=document.documentElement,t=document.querySelector(`.shell--chat`)!==null;e.classList.toggle(`control-ui-chat-shell`,t);let n=getComputedStyle(e),r=n.getPropertyValue(`--bg`).trim(),i=globalThis.matchMedia?.(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`).matches&&t&&n.getPropertyValue(`--bg-content`).trim()||r;if(i){e.style.setProperty(`--control-ui-system-chrome-background`,i);for(let e of document.querySelectorAll(`meta[name="theme-color"]`))e.content=i,e.removeAttribute(`media`)}}function t_(e){a_=e;let t=document.documentElement,n=(a_===`theme`?void 0:a_??i_)?.trim().replace(/^#/,``),r=n&&/^[0-9a-fA-F]{6}$/.test(n)?`#${n}`:null;if(!r){for(let e of r_)t.style.removeProperty(e);return}let i=Qg(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 n_(e){i_=e,t_(a_)}var r_,i_,a_;function o_(){return(o_=e((()=>{r_=[`--ring`,`--accent`,`--accent-foreground`,`--accent-hover`,`--accent-muted`,`--accent-subtle`,`--accent-glow`,`--primary`,`--primary-hover`,`--primary-foreground`,`--focus`,`--focus-ring`,`--focus-glow`]})))()}var s_;function c_(){return(c_=e((()=>{s_=({nextTheme:e,applyTheme:t,currentTheme:n})=>{let r=n===e?void 0:globalThis.document?.documentElement;t(),r&&(r.classList.remove(`theme-transition`),r.style.removeProperty(`--theme-switch-x`),r.style.removeProperty(`--theme-switch-y`))}})))()}function l_(e,t){return t?.branding??Zi(Ma.find(t=>t.id===e.theme))}function u_(e,t){if(typeof globalThis.matchMedia!=`function`)return;let n=globalThis.matchMedia(e);if(typeof n.addEventListener==`function`)return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t);if(typeof n.addListener==`function`)return n.addListener(t),()=>n.removeListener(t)}function d_(e,t){if(typeof document>`u`)return;let n=document.documentElement,r=e.theme.includes(`/`)&&!t?`claw`:e.theme,i=gh(r,t?.mode??e.themeMode);n.dataset.themeId=r,n.dataset.theme=i,n.dataset.themeMode=i.endsWith(`light`)?`light`:`dark`;let a=l_(e,t);n.dataset.themeMascot=a.mascot,a.avatarHat?n.dataset.themeAvatarHat=a.avatarHat:delete n.dataset.themeAvatarHat,n.dataset.themeResolved=n.dataset.themeMode,n.classList.toggle(`wa-light`,n.dataset.themeMode===`light`),n.classList.toggle(`wa-dark`,n.dataset.themeMode===`dark`),n.style.colorScheme=n.dataset.themeMode,n.style.setProperty(`--control-ui-text-scale`,`${(e.textScale??100)/100}`);let o=bh(r,e.fontUi,e.fontChat);Sh(o),wh(e.fontUi,e.fontChat),Th(o.chat),ch(t?.palette??e.customTheme),t_(e.accent),e_()}function f_(e){let{sessionKey:t,lastActiveSessionKey:n,selectedAgentId:r,...i}=e;return JSON.stringify(i)}function p_(e,t){let{token:n,...r}=e,i=r,a=null,o,s=new Set,c=0,l,u=!1,d=!1,f,p=!1,m=()=>{let e=++c,t=!1;pl(l_(i,l?.theme(i.theme))),_h(i.theme,()=>{if(e!==c)return;let n=typeof document>`u`?void 0:document.documentElement.dataset.themeMascot;if(d_(i,l?.theme(i.theme)),t)for(let e of s)e();typeof document<`u`&&(n===`none`||document.documentElement.dataset.themeMascot===`none`)&&W(async()=>{let{invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.va(),e._a));return{invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url).then(({invalidateControlUiFaviconPalette:e,syncControlUiFavicon:t})=>{p||(e(),t())})}),t=!0;for(let e of s)e()},h=async()=>{if(!(p||l||u||t.snapshot.phase!==`connected`||!d&&!i.theme.includes(`/`))){u=!0;try{let{createThemeCatalog:e}=await W(async()=>{let{createThemeCatalog:e}=await import(`./theme-catalog-DV1e-9j0.js`);return{createThemeCatalog:e}},__vite__mapDeps([85,1,86,28]),import.meta.url);p||(l=e(t,m),f=void 0)}catch(e){p||(f={themes:[],error:e instanceof Error?e.message:String(e)},m())}finally{u=!1}}},g=()=>{o?.(),o=void 0},_=()=>{g(),i.themeMode===`system`&&(o=u_(`(prefers-color-scheme: light)`,()=>{i.themeMode===`system`&&m()}))},v=u_(`(max-width: 768px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`,()=>e_()),y=()=>{let e=ug(t.connection.gatewayUrl),n=f_(e)!==f_(i);i=e,n&&(h(),m(),_())},b=cg({gatewayUrl:()=>t.connection.gatewayUrl,refresh:y}),x=e=>{(e.key===null||e.key===Bh(t.connection.gatewayUrl))&&y()};globalThis.addEventListener?.(`storage`,x);let S=t.subscribe(()=>{h(),i.gatewayUrl!==t.connection.gatewayUrl&&y()});return _(),m(),h(),{get branding(){return l_(i,l?.theme(i.theme))},get catalog(){return d||(d=!0,h()),l?.snapshot(i.theme)??f},get settings(){return i},get mode(){return i.themeMode},get resolvedMode(){let e=l?.theme(i.theme)?.mode??i.themeMode;return gh(i.theme,e).endsWith(`light`)?`light`:`dark`},get serverSelection(){return a},recordServerSelection(e,t){a={revision:(a?.revision??0)+1,scope:t,theme:e},m()},setMode(e){let t=gh(i.theme,i.themeMode),n=gh(i.theme,e);s_({nextTheme:n,currentTheme:t,applyTheme:()=>{fg({themeMode:e})}})},refresh:y,retryCatalog(){l?.refresh()??h()},subscribe:e=>Ka(s,e),dispose(){p=!0,l?.dispose(),b(),globalThis.removeEventListener?.(`storage`,x),S(),c+=1,g(),v?.(),s.clear()}}}function m_(){return(m_=e((()=>{Ji(),o_(),mh(),Vg(),gl(),c_(),vh(),Ah(),K()})))()}function h_(e,t){Mn(t)&&vi(qn({agentsList:e.agents,hello:null,assistantAgentId:null,settings:{gatewayUrl:e.scope},client:{offlineRecoveryScope:e.recoveryScope}},{sessionKey:t}))}function g_(e,t){mp(e,t);let n=t.recoveryScope,r=De(Nn(e,n));if(!n)return r;let i=Ve(`scope:${JSON.stringify([e,n])}\u0000`);return Promise.all([r,i]).then(()=>void 0)}function __(e,t,n){let r=e.connectionRevision,i=t?.profileId,a=t?.recoveryScope,o=t?ap(t):void 0,s=rp(({scope:t,external:r,replacement:s,retiredOwner:c})=>{if(t===void 0||t===q(e.connection.gatewayUrl)){let t=e.snapshot,l=t.hello?.auth?.recoveryScope,u=l??hp({client:t.client})??a,d=o,f=u?{recoveryScope:u}:d;if(s&&!op(s,d)&&(o=void 0),!f||c&&!op(c,f)&&!op(c,d)||op(s,f))return;i=void 0,o=void 0,(r||!l||a!==void 0&&l===a)&&(fp(q(e.connection.gatewayUrl),f),e.snapshot.client?.retireOfflineRecoveryScope?.()),n(),r&&e.stop()}}),c=e.subscribe(t=>{if(t.phase===`connected`&&$r(),e.connectionRevision!==r&&(i=void 0,o=void 0),i!==void 0&&(t.lastErrorAuthReason||typeof t.lastErrorCode==`string`&&t.lastErrorCode!==`GATEWAY_BUSY`)&&(n(),o&&mp(q(e.connection.gatewayUrl),o),i=void 0),t.phase!==`connected`||i===void 0)return;let s=a!==void 0&&t.hello?.auth?.recoveryScope!==a,c=a===void 0&&i!==(t.selfUser?.id??null);i=void 0,(c||s)&&(n(),o&&g_(q(e.connection.gatewayUrl),o)),a=t.hello?.auth?.recoveryScope});return()=>{s(),c()}}function v_({gateway:e,agents:t,sessions:n},r){let i=r?{gatewayScope:r.scope,recoveryScope:r.recoveryScope,mainKey:r.agents.mainKey,scope:r.agents.scope}:null,a=()=>{if(e.snapshot.phase!==`connected`||e.snapshot.client?.offlineRecoveryRetired)return;let r=q(e.connection.gatewayUrl),a=cp(e.snapshot.hello?.auth,e.connection.token);if(!a)return;let o=t.state.agentsList;o&&(i={gatewayScope:r,recoveryScope:e.snapshot.hello?.auth?.recoveryScope,mainKey:o.mainKey,scope:o.scope}),o&&n.groupsStatus()===`ready`&&_p({version:2,recoveryScope:e.snapshot.client?.recoveryScopeReady?e.snapshot.client.recoveryScope:e.snapshot.hello?.auth?.recoveryScope,...a,savedAt:Date.now(),scope:r,profileId:e.snapshot.selfUser?.id??null,agents:o,groups:[...n.state.groupSettings],sectionOrder:[...n.state.sectionOrder]})},o=[e,t,n].map(e=>e.subscribe(a));return{readSessionDefaults:()=>{let t=hp({client:e.snapshot.client});return e.snapshot.phase!==`connected`&&t&&i?.recoveryScope===t&&i.gatewayScope===q(e.connection.gatewayUrl)?{mainKey:i.mainKey,scope:i.scope}:null},dispose:()=>o.forEach(e=>e())}}function y_(){return(y_=e((()=>{Be(),zn(),Bn(),di(),Wt(),Tt(),Ep()})))()}function b_(e,t){if(e?.signal?.aborted)return Promise.resolve(e.value);let n=document.createElement(`div`);return document.body.append(n),new Promise(r=>{let i={host:n,settled:!1,render(e){i.settled||Mi(e(),n)},finish(t){i.settled||(i.settled=!0,e?.signal?.removeEventListener(`abort`,a),Mi(I,n),n.remove(),r(t))}},a=()=>e&&i.finish(e.value);e?.signal?.addEventListener(`abort`,a,{once:!0}),t(i)})}function x_(){return(x_=e((()=>{L(),of()})))()}function S_(e){return E_.add(e),()=>void E_.delete(e)}function C_(e){return D_.add(e),()=>void D_.delete(e)}function w_(){let e=[...D_];for(let t of e)t()}async function T_(e,t){let n=()=>{if(!t?.signal?.aborted)for(let t of E_)t(e)};try{let r=await fetch(e,t);return r.status===401&&n(),r}catch(e){throw n(),e}}var E_,D_;function O_(){return(O_=e((()=>{E_=new Set,D_=new Set})))()}async function k_(e,t){let n=null;try{n=uo(await e.json())}catch{t.throwIfAborted()}let r=n?.error,i=typeof r==`string`?r:r&&typeof r==`object`&&`message`in r&&typeof r.message==`string`?r.message:``,a=dn(i);return{data:n,response:e,errorMessage:a?`HTTP ${e.status}: ${a}`:`HTTP ${e.status}`}}function A_(e){return Wo([e.hello?.auth?.deviceToken,e.settings?.token,e.password]).filter(e=>!/[\r\n]/.test(e))}function j_(e){return A_(e)[0]??null}function M_(e){return{authTokens:A_(e),authReady:!!(e.hello||e.settings?.token?.trim()||e.password?.trim())}}async function N_(e,t,n,r){let i=n.length?n:[``],a=!t.method||t.method===`GET`||t.method===`HEAD`;for(let n=0;;n++){if(t.signal.throwIfAborted(),!r())throw new DOMException(`Gateway request is no longer current`,`AbortError`);let o=i[n],s=await T_(e,{...t,...o?{headers:{...t.headers,Authorization:`Bearer ${o}`}}:{}});if(t.signal.throwIfAborted(),n===i.length-1||s.status!==401&&!(a&&s.status===403))return s;s.body?.cancel().catch(()=>void 0)}}function P_(){return(P_=e((()=>{wo(),Sr(),O_()})))()}function F_(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=document.createElement(`iframe`);r.hidden=!0,r.setAttribute(`sandbox`,`allow-same-origin`),r.referrerPolicy=`no-referrer`,r.src=e.href;let i=()=>{window.clearTimeout(a),t.removeEventListener(`abort`,i),r.remove(),n()},a=window.setTimeout(i,1e4);r.addEventListener(`load`,i,{once:!0}),r.addEventListener(`error`,i,{once:!0}),t.addEventListener(`abort`,i,{once:!0}),document.body.append(r)})}function I_(e,t=()=>({})){let n=new URL(`${yo(e)}/`,window.location.origin),r=new URL(eo.slice(1),n),i=new AbortController,a,o=-1/0,s=!1,c=!1,l=!1,u,d,f=()=>{u||c||i.signal.aborted||b_({signal:i.signal,value:void 0},e=>{let t=()=>{c=!0,e.finish(void 0)},r=()=>F`
<openclaw-modal-dialog
label=${P(`connection.browserSignIn.title`)}
description=${P(`connection.browserSignIn.description`)}
@modal-cancel=${t}
>
<div class="exec-approval-card">
<div class="exec-approval-header">
<div style="min-width: 0">
<div class="exec-approval-title">${P(`connection.browserSignIn.title`)}</div>
<div class="exec-approval-sub" style="white-space: normal">
${P(`connection.browserSignIn.description`)}
</div>
</div>
</div>
${l?F`<p>${P(`connection.browserSignIn.returnHint`)}</p>`:I}
<p role="status" aria-live="polite">
${a?P(`connection.browserSignIn.checking`):d===`unavailable`?P(`connection.browserSignIn.unavailable`):d===`sign-in`?P(`connection.browserSignIn.stillRequired`):I}
</p>
<div class="exec-approval-actions">
<button
class="btn primary"
@click=${async()=>{if(il()?.webkit?.messageHandlers?.openclawGateways){let{nativeGatewaysCapability:e}=await W(async()=>{let{nativeGatewaysCapability:e}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.na(),e.ra));return{nativeGatewaysCapability:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url);if(i.signal.aborted||c)return;let t=e(),n=t?.snapshot?.currentId;if(t&&n){t.reconnect(n);return}}l=!0,d=void 0,on(n.href),e.render(r)}}
>
${P(`connection.browserSignIn.action`)}
</button>
${l?F`<button class="btn" ?disabled=${!!a} @click=${()=>void p(!0)}>${P(`connection.browserSignIn.checkAgain`)}</button>`:I}
<button class="btn" @click=${t}>
${P(`connection.browserSignIn.dismiss`)}
</button>
</div>
</div>
</openclaw-modal-dialog>
`;u={close:()=>e.finish(void 0),update:()=>e.render(r)},e.render(r)}).finally(()=>{u=void 0})};function p(e=!1){if(i.signal.aborted||a||!e&&Date.now()-o<3e4)return a;o=Date.now();let n=A_(t()),p=()=>{let e=A_(t());return!i.signal.aborted&&e.length===n.length&&e.every((e,t)=>e===n[t])};return a=(async()=>{try{let e=()=>N_(r.href,{method:`HEAD`,credentials:`same-origin`,cache:`no-store`,redirect:`manual`,signal:AbortSignal.any([i.signal,AbortSignal.timeout(5e3)])},n,p),t=await e();if(!p())return;if(t.type===`opaqueredirect`&&!s){if(s=!0,await F_(r,i.signal),!p())return;t=await e()}if(!p())return;if(t.type===`opaqueredirect`)s=!0,d=l?`sign-in`:void 0,f();else if(t.ok&&t.headers.get(`content-type`)?.split(`;`)[0]?.trim()===`application/json`){let e=s;s=!1,c=!1,l=!1,u?.close(),e&&w_()}else d=`unavailable`}catch{p()&&(d=`unavailable`)}})().finally(()=>{a=void 0,u?.update()}),u?.update(),a}let m=S_(e=>{let t;try{t=new URL(e,window.location.href)}catch{return}t.origin===n.origin&&t.pathname.startsWith(n.pathname)&&p()}),h=navigator.serviceWorker,g=e=>{h?.controller&&e.source===h.controller&&e.data?.type===`openclaw-http-request-failed`&&p()},_=()=>{s&&p(!0)};return h?.addEventListener(`message`,g,{signal:i.signal}),window.addEventListener(`focus`,_,{signal:i.signal}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&_()},{signal:i.signal}),()=>{i.abort(),m()}}function L_(){return(L_=e((()=>{L(),Fa(),Y(),x_(),w(),qt(),O_(),P_(),K()})))()}function R_(e,t){let{connection:n,snapshot:{client:r}}=e;return{canReload:()=>t?.()!==!1&&r!==null&&e.snapshot.client===r&&e.connection===n&&(!n.bootstrapToken||z_(n.gatewayUrl)),reload:()=>{let e=new URL(window.location.href);if(n.bootstrapToken){e.searchParams.delete(`gatewayUrl`);let t=new URLSearchParams(e.hash.slice(1));t.set(`gatewayUrl`,n.gatewayUrl),t.set(`bootstrapToken`,n.bootstrapToken),n.bootstrapProfile&&t.set(Yo,n.bootstrapProfile),e.hash=t.toString()}Ul(e)}}}function z_(e){try{return new URL(e.replace(/^ws/u,`http`)).origin===globalThis.location?.origin}catch{return!1}}function B_(){return(B_=e((()=>{Fa(),su()})))()}function V_(e){let{recovery:t,attachments:n,createdAt:r,checking:i,reconnecting:a,error:o}=e,s={id:t.messageId,text:t.message,...t.mentions?.length?{mentions:t.mentions}:{},attachments:n,createdAt:r,sessionKey:t.sessionKey,agentId:t.agentId,sendRunId:t.messageId,sendAttempts:1,sendState:a?`waiting-reconnect`:i?`unconfirmed`:o?`failed`:t.phase===`paused`?t.reason===`unconfirmed`?`unconfirmed`:`failed`:`sending`,...o||t.phase===`paused`?{sendError:o??(t.phase===`paused`?t.error:void 0)}:{}},c=H_.get(t),l=Reflect.ownKeys(s);return c&&Reflect.ownKeys(c).length===l.length&&l.every(e=>Object.hasOwn(c,e)&&Object.is(Reflect.get(c,e),Reflect.get(s,e)))?c:(H_.set(t,s),s)}var H_;function U_(){return(U_=e((()=>{H_=new WeakMap})))()}function W_(e,{gatewayUrl:t,recoveryScope:n}){let r=e.connectionRevision,i=Dp(e);return()=>{let a=e.snapshot.client,o=e.snapshot.hello?.auth?.recoveryScope??(a?.recoveryScopeReady?a.recoveryScope:void 0);return e.connectionRevision===r&&Dp(e)===i&&e.connection.gatewayUrl===t&&(n===void 0||!o||o===n)}}function G_(e,t=()=>W(()=>import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.Ji(),e.Yi)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url)){let n=new Map,{gateway:r}=e,i=!1,a,o,s=new Set,c,l,u=()=>s.forEach(e=>e()),d=()=>{let{client:e,phase:t}=r.snapshot;return t===`connected`&&e?.recoveryScopeReady?e:null},f=()=>[...n.values()].map(e=>e()).filter(e=>e!==void 0),p=()=>f().every(e=>e.persisted),m=()=>{let e=f(),t=e[0];if(!t)return;let a=o,s=W_(r,t.input.recovery),c=()=>!i&&o===a&&s();return()=>{let t=f();if(c()&&e.length===t.length&&!e.some((e,n)=>e!==t[n])){for(let{input:t,persisted:r}of e)r||n.delete(t.recovery.sessionKey);u(),c()&&zl(!0)&&Ul()}}},h=Rl(p,()=>Xr({message:P(`newSession.placementReloadBlocked`),actionLabel:P(`newSession.discardUnsavedAndReload`),onAction:m()})),g=(s,f=!1)=>{if(i)return;if(c??=r.subscribe(()=>g()),(s||f)&&o?.error&&(o=void 0,s||u()),s){let{input:e}=s;if(a){a.start(e);return}let t=e.recovery.sessionKey;n.delete(t);let i=W_(r,e.recovery),o={...s,input:{...e,displayAttachments:e.displayAttachments??$t(e.recovery.attachments)}};n.set(t,()=>i()?o:void 0),n.size>32&&n.delete(n.keys().next().value),u()}let p=d();if(a){if(p)for(let[e,t]of n){let r=t()?.input;n.delete(e),r&&a.start(r)}a?.resumeRecovery(),p&&l&&(l=void 0,u());return}if(p&&!s){if(!l?.current()){let e={gatewayUrl:r.connection.gatewayUrl,recoveryScope:p.recoveryScope},t=W_(r,e),n=[],i={startedAt:Date.now()};l={current:t,refresh:()=>{n=or(e.gatewayUrl,e.recoveryScope)},read:r=>t()&&n.includes(Ar(e.gatewayUrl,e.recoveryScope,r))?i:void 0}}l.refresh()}if(o)return;let m={};o=m,t().then(({default:t})=>{i||(a=t(e),a.subscribe(u),g())},e=>{m.error=Error(Qt(e)),u()})};return{get(e){let t=n.get(e)?.()?.input,r=t?{targetKind:t.recovery.target.kind,startedAt:t.createdAt}:l?.read(e);if(!r)return a?.get(e)??null;let i=o?.error,s=Hl(i)&&!p(),c=s?P(`newSession.placementReloadBlocked`):i?.message,u=!d();return!u||t?{sessionKey:e,...r,phase:u?`reconnecting`:i?`failed`:`pending`,error:c,retryable:!u&&!!i&&!s,...t?{initialTurn:V_({recovery:t.recovery,attachments:t.displayAttachments,createdAt:t.createdAt,error:c,reconnecting:u})}:{},...s&&!u?{discardAndReload:m()}:{}}:null},hasPendingTurn(e){return!!(n.get(e)?.()||a?.hasPendingTurn(e)||l?.read(e))},start:e=>g({input:e,persisted:e.persistRecovery}),pause(e,t,o){let s=d();if(i||!s)return;if(a){a.pause(e,t,o);return}let c=n.get(e)?.()?.input,l=c?.recovery??o.readSessionPlacementRecovery(r.connection.gatewayUrl,s.recoveryScope,e);if(!l)return;let{recovery:u,persisted:f}=o.pauseSessionPlacementRecovery(l,t,c?.persistRecovery??!0);g({input:{recovery:u,persistRecovery:c?.persistRecovery??!0,mode:`recover`,createdAt:c?.createdAt??Date.now(),displayAttachments:c?.displayAttachments},persisted:f})},retry(e){if(!d())return;let t=n.get(e)?.();if(t||l?.read(e)){let n=o,r=n?.error;if(Hl(r)){g();let t=l;if(!t?.read(e))return;Jl({canReload:()=>(t.refresh(),!i&&o===n&&l===t&&!!t.read(e)&&p())});return}return g(t,!0)}a?.retry(e)},resumeRecovery:g,subscribe:e=>Ka(s,e),dispose(){c?.(),h(),i=!0,a?.dispose(),a=void 0,n.clear(),l=void 0,s.clear()}}}function K_(){return(K_=e((()=>{w(),Sr(),Hr(),Xn(),a(),Vl(),Ap(),U_(),su(),K()})))()}function q_(e){let t=new Map,n=!1,r,i=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()]},a=(e,t=new Set)=>{e&&Ht(i(e).filter(e=>!t.has(e.id)))},o=(e,t)=>JSON.stringify([e,t]),s=e=>{let n=t.get(e);return n&&(t.delete(e),r?.key===e&&r.controller.abort()),n},c=e=>{if((e.incognito||e.newSessionDraft?.incognito)&&Y_(e))return{draft:e,fallbackKey:void 0};for(let[t,n]of Object.entries(e.fallbacks))if(n.incognito&&Y_(n))return{draft:n,fallbackKey:t}},l=()=>new Set([...t.values()].flatMap(i).map(e=>e.id)),u=()=>{for(let[e,n]of t)c(n)&&!n.isConnectionCurrent()&&a(s(e),l())},d=e.subscribe(u),f=()=>{u();for(let[e,n]of t){let t=c(n);if(t)return{key:e,entry:n,...t}}},p=async()=>{let i=f();if(!i||r)return;let{key:a,entry:o,draft:c,fallbackKey:u}=i,d=new AbortController;r={key:a,controller:d};let p=e.connection,m=e.snapshot.client,h=()=>!n&&!d.signal.aborted&&t.get(a)===o&&o.isConnectionCurrent()&&e.snapshot.client===m&&e.connection===p,g=R_(e);try{if(!h()||!await o.reviewPrivateDraft({text:c.message,attachments:c.attachments,hasGoal:!!c.goalMode,pendingReads:0,isCurrent:h,signal:d.signal})||!h())return;let e=[...c.attachments];u===void 0?(o.message=``,o.attachments=[],o.goalMode=null,o.replyTarget=null,o.mentions=[]):delete o.fallbacks[u],!o.message&&!o.attachments.length&&!o.goalMode&&!o.replyTarget&&!Object.keys(o.fallbacks).length&&s(a);let t=l();Ht(e.filter(e=>!t.has(e.id))),await Jl({timeoutMs:0,...g})}catch{h()&&Xr({message:P(`chat.privateDraftReload.unavailable`)})}finally{r?.controller===d&&(r=void 0)}},m=Rl(()=>!f(),()=>Xr({message:P(`chat.privateDraftReload.blocked`),actionLabel:P(`chat.privateDraftReload.review`),onAction:()=>void p()}));return{prepare:({owner:r,paneId:i,scopeKey:c,attachments:l,fallbacks:u,message:d=``,draftRevision:f,goalMode:p,replyTarget:m,mentions:h,newSessionDraft:g,incognito:_,reviewPrivateDraft:v})=>{let y=o(i,c),b=s(y),x=Object.entries(u);if(!d&&!p&&!m&&l.length===0&&x.length===0){a(b);return}let S=new Set(l.map(e=>e.id));for(let e of Object.values(u))for(let t of e.attachments)S.add(t.id);if(a(b,S),!r||n){Ht(l);for(let e of Object.values(u))Ht(e.attachments);return}t.set(y,{owner:r,reviewPrivateDraft:v,isConnectionCurrent:W_(e,{gatewayUrl:e.connection.gatewayUrl,recoveryScope:r.recoveryScope||void 0}),preparedAt:Date.now(),paneId:i,scopeKey:c,attachments:[...l],...g?{newSessionDraft:g}:{},..._?{incognito:_}:{},message:d,...f===void 0?{}:{draftRevision:f},...p?{goalMode:p}:{},...m?{replyTarget:{...m}}:{},...h?.length?{mentions:h.map(e=>({...e}))}:{},fallbacks:Object.fromEntries(x.map(([e,t])=>[e,{...t,attachments:[...t.attachments]}]))});for(let e of t.keys()){if(t.size<=J_)break;a(s(e))}},consume:({owner:e,paneId:t,scopeKey:n})=>{let r=s(o(t,n));return r?.owner===e&&r.isConnectionCurrent()?{attachments:r.attachments,fallbacks:r.fallbacks,...r.newSessionDraft?{newSessionDraft:r.newSessionDraft}:{},...r.message?{message:r.message}:{},...r.draftRevision===void 0?{}:{draftRevision:r.draftRevision},...r.goalMode?{goalMode:r.goalMode}:{},...r.replyTarget?{replyTarget:r.replyTarget}:{},...r.mentions?{mentions:r.mentions}:{}}:(a(r),null)},retainedAttachmentIds:e=>{let t=new Set(e.map(e=>e.id));return new Set([...l()].filter(e=>t.has(e)))},retireScope:(n,r)=>{for(let[i,o]of t)o.owner===e.snapshot.client&&o.isConnectionCurrent()&&o.scopeKey===n&&o.preparedAt<r&&a(s(i),l())},clearPane:e=>{for(let[n,r]of t)r.paneId===e&&a(s(n))},dispose:()=>{n=!0,m(),d(),r?.controller.abort();for(let e of t.values())a(e);t.clear()}}}var J_,Y_;function X_(){return(X_=e((()=>{w(),Xn(),At(),Vl(),B_(),K_(),su(),J_=32,Y_=e=>!!(e.message||e.attachments.length||e.goalMode||e.replyTarget||e.mentions?.length)})))()}function Z_(e){Object.assign(e,{pending:!1,message:null})}function Q_(){let e=new Map,t,n=new Set,r=e=>{t=e;for(let e of n)e()},i=new WeakMap,a=t=>[...e.keys()].find(e=>wt(e,t)),o=(t,n,r)=>{let i=e.get(a(t)??``);return i?.kind===`initial`&&i.owner===n&&(!i.sessionId||!r||i.sessionId===r)?i:null};return{retain:t=>{if(!t)return;let n=t.kind===`initial`,r=n?e:i.get(t.owner)??new Map,o=n?a(t.sessionKey)??t.sessionKey:t.deliveryKey,s=r.get(o);if(n&&s?.kind===`initial`&&s.owner===t.owner&&s.pendingRunId===t.pendingRunId)return s.consumedByEventId??=t.consumedByEventId,s;n||i.set(t.owner,r);let c={...t,pending:!0};r.delete(o),r.set(o,c);let l=n?32:64;return r.size>l&&r.delete(r.keys().next().value),c},beginCreate:e=>(r(e),()=>{t===e&&r(void 0)}),get creation(){return t?.creation},readCreateMessage:e=>t?.creation.sessionKey===e&&t.canDisplay()?t.message:null,subscribeCreate:e=>Ka(n,e),readInitial:o,observeInitialSession:(e,t,n)=>{let r=o(e,t);r?.pending&&n&&(r.sessionId&&r.sessionId!==n?Z_(r):r.sessionId=n)},readDelivered:(e,t)=>i.get(t)?.get(e),clear:()=>{e.clear(),i=new WeakMap,r(void 0)}}}function $_(){return($_=e((()=>{Be()})))()}function ev(){if(typeof document>`u`)return null;let e=document.documentElement.getAttribute(Go);return e===`true`||e!==`false`&&null}function tv(e,t,n){let r=document.documentElement;(e||t||r.hasAttribute(`data-openclaw-environment`)||r.style.getPropertyValue(`--ring`))&&W(async()=>{let{applyControlUiPresentation:e}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.va(),e._a));return{applyControlUiPresentation:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url).then(({applyControlUiPresentation:r})=>{n()&&r({environment:e,seamColor:t})})}function nv(e){return{assistantIdentity:Gt({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,embedSandboxMode:e.embedSandbox??`scripts`,allowExternalEmbedUrls:!!e.allowExternalEmbedUrls,automaticallyFetchFavicons:!!e.automaticallyFetchFavicons,communityInvite:e.communityInvite===!0,newSessionModelDefaults:e.newSessionModelDefaults??`last-used`,terminalEnabled:!!e.terminalEnabled,uploadsEnabled:e.uploadsEnabled!==!1,cliAgentsEnabled:!!e.cliAgentsEnabled,pluginAssetsRequireAuth:e.pluginAssetsRequireAuth!==!1,pluginFrameGrants:(e.pluginFrameGrants??[]).filter(e=>typeof e?.pluginId==`string`&&typeof e.path==`string`&&(e.match===`exact`||e.match===`prefix`)).map(e=>({pluginId:e.pluginId,path:ac(e.path),match:e.match}))}}async function rv(e){if(typeof window>`u`||typeof fetch!=`function`)return null;try{let t=null;for(let n of e.authCandidates.length?e.authCandidates:[``]){let r={Accept:`application/json`};if(n&&(r.Authorization=`Bearer ${n}`),t=await fetch(e.url,{method:`GET`,headers:r,credentials:`same-origin`,signal:e.signal}),t.ok)break;if(t.status!==401&&t.status!==403)return null}if(!t?.ok)return null;let n=await t.json();return{config:nv(n),seamColor:n.seamColor}}catch{return null}}function iv(e){let t=av,n=0,r=0,i=0,a=document.documentElement.getAttribute(Na);a&&(t={...t,environment:JSON.parse(a)},tv(t.environment,void 0,()=>i===0));let o=`${yo(e.resourceBasePath)}${eo}`,s=new URL(o,window.location.origin).origin===window.location.origin,c=()=>s?A_(e.getAuth?.()??{}):[],l=[],u,d=new Set;return{get current(){return t},async refresh(e){let a=c();if((a.length!==l.length||a.some((e,t)=>e!==l[t]))&&(l=a,n++,u=void 0),e?.skipWithoutAuthCandidate&&s&&!a.length)return null;if(u&&u.signal===e?.signal)return u.promise;let f=++r,p=n,m=e?.signal,h=()=>{let e=c();return p===n&&!m?.aborted&&a.length===e.length&&a.every((t,n)=>t===e[n])},g=rv({url:o,authCandidates:a,signal:m}).then(e=>{if(!e||!h())return null;let n=e.config;if(f<i)return n;i=f,tv(n.environment,e.seamColor,()=>h()&&f===i);let r=ev();if(r!==null&&n.terminalEnabled!==r)return zl()&&window.location.reload(),n;t=n;for(let e of d)e(t);return n});u={promise:g,signal:m};try{return await g}finally{u?.promise===g&&(u=void 0)}},subscribe:e=>Ka(d,e)}}var av;function ov(){return(ov=e((()=>{Wi(),Fa(),Br(),P_(),Vl(),K(),av={assistantIdentity:Gt(),serverVersion:null,serverBuildId:null,devGitBranch:null,environment:null,embedSandboxMode:`strict`,allowExternalEmbedUrls:!1,automaticallyFetchFavicons:!1,communityInvite:!1,newSessionModelDefaults:null,terminalEnabled:ev()??!1,uploadsEnabled:!0,cliAgentsEnabled:!1,pluginAssetsRequireAuth:!0,pluginFrameGrants:[]}})))()}function sv(){let e=null,t=0,n=0,r=null,i,a=new Map,o=()=>{for(let[s,c]of a){if(!e||n>=cv)return;let l=r!==null&&(!i?.ready||i.client!==e||i.sessionKey!==r);if(c.started||l&&c.background)continue;c.started=!0,n++;let u=t,d=()=>{u===t&&(a.delete(s),n--),c.resolve(),u===t&&o()};try{c.run().then(d,d)}catch{d()}}},s=()=>{t+=1,e=null,n=0,i=void 0;for(let e of a.values())e.started||e.resolve();a.clear()};return{reset:s,synchronize(t){let n=t.connected?t.client:null;(!n||e&&e!==n)&&s(),e=n,o()},setForegroundRoute(e){r=e,o()},setForegroundPane(e,t){t&&(r===void 0||t.sessionKey===r)?i={owner:e,...t}:!t&&i?.owner===e&&(i=void 0),o()},run(e,t,n){let r=a.get(e);if(r)return r.promise;let i=La();return a.set(e,{...i,run:t,started:!1,background:n?.background===!0}),o(),i.promise}}}var cv;function lv(){return(lv=e((()=>{ra(),cv=2})))()}function uv(e){let t=e.hello?.auth;return e.phase!==`connected`||t?.scopes===void 0||Zf(t)?{phase:`hidden`}:Bi(e,`device.scopes.requestUpgrade`)===!0&&Bi(e,`device.scopes.waitUpgrade`)===!0&&e.client?.scopeUpgradeReady===!0?{phase:`available`}:{phase:`guidance`}}function dv(){return(dv=e((()=>{Vi(),np()})))()}function fv(e){let t=new Set,n=e.snapshot,r=null,i=uv(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??uv(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=>Ka(t,e),dispose(){s(),r?.dispose(),r=null,t.clear()}}}function pv(){return(pv=e((()=>{dv()})))()}function mv(e,t,n){let r=!1,i=!1,a=!1,o=t.visibilityState===`hidden`,s=n=>{t.visibilityState!==`hidden`&&(a||=n,!i&&(i=!0,queueMicrotask(()=>{i=!1;let n=a;if(a=!1,r||t.visibilityState===`hidden`)return;let o=e.snapshot.client;o&&(n||o.needsWakeReconnect)&&e.connect(),W(async()=>{let{refreshControlUiServiceWorker:e}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.Ki(),e.qi));return{refreshControlUiServiceWorker:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url).then(({refreshControlUiServiceWorker:e})=>e()).catch(e=>{console.warn(`OpenClaw service worker refresh failed after page activation.`,e)})})))},c=()=>{if(t.visibilityState===`hidden`){o=!0;return}o&&(o=!1,s(!1))},l=e=>{e.persisted&&s(!0)},u=()=>s(!1);return t.addEventListener(`visibilitychange`,c),n.addEventListener(`pageshow`,l),n.addEventListener(`online`,u),()=>{r=!0,t.removeEventListener(`visibilitychange`,c),n.removeEventListener(`pageshow`,l),n.removeEventListener(`online`,u)}}function hv(){return(hv=e((()=>{K()})))()}function gv(e,t){let n=!1,r=-1/0,i=!1,a=()=>{let{client:a,phase:o}=e.snapshot;if(n||i||!a||o!==`connected`||t.visibilityState!==`visible`)return;let s=Date.now();if(s>=r&&s-r<_v)return;r=s,i=!0;let c=()=>{i=!1};a.request(`presence.activity`,{}).then(c,c)},o=()=>{e.snapshot.phase!==`connected`||yv.has(t)||(yv.add(t),a())},s=e=>{e.isTrusted&&a()};for(let e of vv)t.addEventListener(e,s,{capture:!0,passive:!0});let c=e.subscribe(o);return o(),()=>{n=!0,c();for(let e of vv)t.removeEventListener(e,s,!0)}}var _v,vv,yv;function bv(){return(bv=e((()=>{_v=3e4,vv=[`keydown`,`pointerdown`,`pointermove`,`wheel`,`touchstart`],yv=new WeakSet})))()}function xv(e,t){let n=null,r=null,i=null,a=0,o=!1,s=()=>r??=W(async()=>{let{createCanvasSurfaceLease:e}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.ba(),e.ya));return{createCanvasSurfaceLease:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url).then(({createCanvasSurfaceLease:r})=>(n=r({request:(t,n)=>{let r=i;return!r||e()!==r?Promise.reject(Error(`canvas surface lease has no current gateway client`)):r.request(t,n)},onChange:n=>{i&&e()===i&&t(n)}}),n)).catch(e=>{throw r=null,e});return{begin:(e,t)=>(i=null,n?.stop(),a+=1,i=e,o=Xf(t),ke(),a),start:(t,n,r)=>{o&&s().then(o=>{a===n&&i===t&&e()===t&&o.start(r)}).catch(()=>{})},stop:()=>{i&&(a+=1,i=null,n?.stop(),ke())},get generation(){return a}}}function Sv(){return(Sv=e((()=>{le(),np(),K()})))()}function Cv(e){Tv.delete(e)}async function wv(e,t){Cv(e);try{return await e.request(`users.prefs.set`,t)}finally{Cv(e)}}var Tv;function Ev(){return(Ev=e((()=>{Tv=new WeakMap})))()}function Dv(e){return t=>{if(!e.isAttached())return;let n=e.project(t);if(n){try{e.record(n)}catch(e){console.error(`[gateway] event handler error:`,e)}Ov(e.listeners,n,`event listener`,e.isCurrent)}}}function Ov(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 kv(){let e=[],t=0,n=null,r=()=>(t+=1,e=[],e);return{get entries(){return e},get revision(){return t},clear(){e=[]},resetConnection(){return n=null,r()},bindRecoveryScope(e){let t=e??``,i=n!==null&&n!==t;return n=t,i?r():null},record(t){return e=[{ts:Date.now(),event:t.event,payload:t.payload},...e].slice(0,250),e}}}function Av(e){let t,n,r=e=>JSON.stringify(`shortId`in e?[`short`,e.agentId,e.shortId,e.slugHint]:[`scope`,e.agentId,e.sessionKey]);return{captureTarget(e){return t=e,e},synchronize(r,i){let a=r.client!==i.client||r.hello!==i.hello;if(r.client&&(a||r.selfUser?.id!==i.selfUser?.id||r.phase===`connected`&&i.phase!==`connected`)&&(Cv(r.client),xr(r.client),Yr(r.client),mi(r.client),ni(r.client),!e(i)))return!1;if(!i.client||!i.hello||i.phase!==`connected`||!a&&r.phase===`connected`)return!0;let{client:o,hello:s}=i,c=t&&!(`shortId`in t)?t.sessionKey?oe({hello:s},t.sessionKey,t.agentId):{}:void 0;return n=t?Rt(o,c,void 0,c?.agentId===void 0):void 0,!0},receive(e,i){if(i.client&&(e.event===`cron`||e.event===`config.changed`)&&xr(i.client),e.event!==`models.snapshot`)return e;let a=n;if(!a)return;let o=e.payload;if(!t||r(t)!==r(o.target))return;n=void 0;let s=o.scope.sessionKey?oe(i,o.scope.sessionKey,o.scope.agentId):o.scope,c=Ce(a,s,o.catalog);return a.cache.reads.delete(a),c?{...e,payload:{...o,scope:s}}:void 0}}}function jv(){return(jv=e((()=>{_n(),un(),Yn(),si(),Be(),Ev()})))()}function Mv(e){let t=null,n={};return{clearOfflineIndicatorTimer:()=>{globalThis.clearTimeout(t??void 0),t=null},setUnavailableDeadline:(t,r)=>{globalThis.clearTimeout(n[t]),delete n[t],r!==void 0&&(n[t]=globalThis.setTimeout(()=>{delete n[t],e.applySnapshot({[t]:t!==`restartPending`&&void 0})},Xa(r*3,{minMs:15e3})))},scheduleOfflineIndicator:()=>{let n=e.getSnapshot();e.isStopped()||n.phase===`connected`||n.offlineStable||t!==null||(t=globalThis.setTimeout(()=>{t=null,!e.isStopped()&&e.getSnapshot().phase!==`connected`&&e.applySnapshot({offlineStable:!0})},Nv))},hasSuspensionDeadline:()=>n.suspensionPhase!==void 0}}var Nv;function Pv(){return(Pv=e((()=>{Wa(),Nv=2e3})))()}function Fv(e){let t,n,r;return{prepare(r,i,a){t=q(r.gatewayUrl);let o=e&&!i&&!r.bootstrapToken&&!r.password?dp(t,e=>e===`token`?r.token:r.token.trim()?null:e===`device-token`?hn(r.gatewayUrl):``):null;return o&&(n=ap(o)),{offlineRecoveryScope:e&&!i?a?.offlineRecoveryScope??o?.recoveryScope:void 0,url:r.gatewayUrl,token:r.token.trim()?r.token:void 0,bootstrapToken:r.bootstrapToken.trim()?r.bootstrapToken:void 0,bootstrapProfile:r.bootstrapProfile,password:r.password.trim()?r.password:void 0}},acceptHello(t,n){if(!e)return;let i=cp(t,n);r=t?.recoveryScope?{recoveryScope:t.recoveryScope}:i?ap(i):void 0},retire(e){let i=t,a=n?[n]:[];if(r&&!op(n,r)&&a.push(r),n=void 0,r=void 0,i)for(let t of a)e?g_(i,t):mp(i,t)}}}function Iv(){return(Iv=e((()=>{xn(),Ep(),y_()})))()}function Lv(e){let t=()=>{let t=_i();return t&&Ct({deviceId:t,gatewayUrl:e.gatewayUrl(),role:`operator`})?t:null};return{hasStoredDeviceToken:()=>t()!==null,forgetDeviceToken:()=>{let n=t();if(!n)return!1;let r=e.gatewayUrl();return mp(q(r)),e.retireOfflineAccess(),er({deviceId:n,gatewayUrl:r,role:vm}),sg(r,``),Pe(r),e.isStopped()||e.connect({token:``,bootstrapToken:``,password:``}),!0}}}function Rv(){return(Rv=e((()=>{Mm(),bt(),xn(),Ep(),Vg()})))()}function zv(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 Bv(e){if(!e||typeof e!=`object`)return;let t=e.presence;return Array.isArray(t)?t:void 0}function Vv(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 Hv({snapshotUser:e,presenceEntries:t,presenceInstanceId:n}){return e===void 0?Vv(t??[],n):e}function Uv(){return(Uv=e((()=>{})))()}function Wv(e){let t=null,n;return{load:()=>{let r=e.getSnapshot().client,i=e.getSnapshot().hello;if(!r||!i||e.getSnapshot().phase!==`connected`||!ep(i.auth??null))return Promise.resolve(null);if(t)return t;let a=e.getSnapshot().selfUser,o=()=>e.getSnapshot().client===r&&e.getSnapshot().hello===i&&e.getSnapshot().phase===`connected`&&t===s,s=r.request(`users.self`,{}).then(({profile:t})=>{if(!o())return null;let s=e.getSnapshot().selfUser,c=s?.id===t.id?s:null,l=c&&s!==a?c:null,u=Vv(Bv(i.snapshot)??[],r.instanceId),d=c?.avatarUrl??(u?.id===t.id?u.avatarUrl:void 0),f=zr(e.getConnection().gatewayUrl,t.id,t.updatedAt,e.resourceBasePath)??void 0,p=d&&d!==n?d:f;n=f;let m={id:t.id,identity:{type:`profile`,id:t.id},name:l?l.name:t.displayName??void 0,email:t.emails[0],avatarUrl:p};return zv(e.getSnapshot().selfUser,m)||e.publish(m),o()?t:null}).catch(t=>{if(!o())return null;if(t instanceof Tm&&t.code===`FORBIDDEN`)return e.publish(null),null;throw t}).finally(()=>{t===s&&(t=null)});return t=s,s},applyPresence:r=>{let i=e.getSnapshot(),a=i.selfUser;if(i.phase!==`connected`)return;let o=Vv(Bv(r)??[],i.client?.instanceId);if(o){if(Xf(i.hello?.auth??null)&&(o.id!==a?.id||o.identity&&o.identity.id!==a.identity?.id))t=null,n=void 0,e.publish(o);else if(o.id===a?.id){let t={...a,name:o.name,avatarUrl:o.avatarUrl??a.avatarUrl};zv(a,t)||e.publish(t)}}},invalidate:()=>{t=null,e.getSnapshot().phase!==`connected`&&(n=void 0)}}}function Gv(){return(Gv=e((()=>{Mm(),gr(),np()})))()}function Kv(e){return e.features?.methods===void 0&&!e.controlUiTabs?.length&&!e.controlUiWidgetKinds?.length&&!e.controlUiLinkReaders?.length&&!Object.keys(e.pluginSurfaceUrls??{}).length?null:{ok:!0,descriptors:[],methods:e.features?.methods??[],controlUiTabs:e.controlUiTabs??[],controlUiWidgetKinds:e.controlUiWidgetKinds??[],controlUiLinkReaders:e.controlUiLinkReaders??[],pluginSurfaceUrls:e.pluginSurfaceUrls??{}}}function qv(e,t=``,n=``,r=Jv,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=Fv(i.ownsWarmBoot!==!1),u={client:null,phase:`stopped`,offlineStable:!1,hello:null,pluginCapabilities:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,sessionKey:a.sessionKey,lastError:null,lastErrorCode:null,lastErrorAuthReason:null,selfUser:null},d=null,f=Wv({getSnapshot:()=>u,getConnection:()=>s,publish:e=>D({selfUser:e}),resourceBasePath:i.resourceBasePath}),p=xv(()=>d,e=>D({canvasPluginSurfaceUrl:e})),m=!1,h=!0,g=e=>!h&&d===e,_=Mv({isStopped:()=>h,getSnapshot:()=>u,applySnapshot:e=>D(e)}),{clearOfflineIndicatorTimer:v,setUnavailableDeadline:y,scheduleOfflineIndicator:b}=_,x=new Set,S=new Set,C=new Set,w=kv(),T=Av(e=>e===u),E=e=>{Ov(C,e,`event`,e=>e===w.entries)},D=e=>{let t=u;u={...t,...e},u.phase!==`connecting`&&u.phase!==`reconnecting`&&(u.reconnectAt=void 0),(t.client!==u.client||t.hello!==u.hello||u.phase!==`connected`)&&f.invalidate(),u.phase===`connected`?(v(),u.offlineStable=!1):(u.suspensionPhase=_.hasSuspensionDeadline()?u.suspensionPhase:void 0,u.pluginCapabilities=null,u.usagePublications=void 0,b()),T.synchronize(t,u)&&Ov(x,u,`snapshot`,e=>e===u)},O=()=>{let e=d,t=u.hello;f.load().catch(n=>{g(e)&&u.hello===t&&u.phase===`connected`&&D({lastError:Qt(n)})})},ee=(e,t=!1)=>{if(!o&&!t){a={...a,...e};return}o=!0,a=fg(e,{selectGateway:t})},te=e=>{let t=d;if((e.event===`plugins.changed`||e.event===`plugins.controlUi.changed`)&&t){let n=u.hello,r=()=>g(t)&&u.hello===n&&u.phase===`connected`?u:null;W(async()=>{let{refreshPluginCapabilities:e}=await import(`./plugin-capabilities.runtime-CPaMzr40.js`);return{refreshPluginCapabilities:e}},__vite__mapDeps([87,1,28]),import.meta.url).then(({refreshPluginCapabilities:n})=>n(e,t,r,D,e=>p.start(t,p.generation,e))).catch(e=>{r()&&D({lastError:Qt(e)})})}else if(e.event===`chat.metadata.changed`){let t=Do(e.payload),n=t?.agentId,r=t?.usageUpdatedAt;typeof n==`string`&&typeof r==`number`&&r>(u.usagePublications?.[n]?.usageUpdatedAt??0)&&D({usagePublications:{...u.usagePublications,[n]:{usageUpdatedAt:r,committedAt:t?.usageRefreshFailed===!0?u.usagePublications?.[n]?.committedAt??0:r,usageRefreshFailed:t?.usageRefreshFailed===!0||void 0}}})}else if(e.event===`gateway.suspension`){let t=Jm(e.payload);t&&D({suspensionPhase:t})}else if(e.event===`shutdown`){let t=Do(e.payload)?.restartExpectedMs;typeof t==`number`&&(y(`restartPending`,t),D({restartPending:!0}))}else e.event===`presence`?f.applyPresence(e.payload):e.event===`sessions.changed`&&Do(e.payload)?.reason===`profile-identity`&&(f.invalidate(),O());if(!g(t)||C.size===0)return;let n=w.record(e);Ov(C,n,`event`,e=>e===w.entries&&g(t))},ne=(e={})=>{e.gatewayUrl??s.gatewayUrl,y(`suspensionPhase`),h=!1;let{sessionKey:t,...n}=e,f=n.gatewayUrl??s.gatewayUrl,_=q(f)!==q(s.gatewayUrl),v=og(s.gatewayUrl,f,s),b={...s,...n,..._&&n.token===void 0?{token:v.token}:{},..._&&n.password===void 0?{password:v.password}:{},..._&&n.bootstrapToken===void 0?{bootstrapToken:``,bootstrapProfile:void 0}:{},...n.bootstrapToken!==void 0&&n.bootstrapProfile===void 0?{bootstrapProfile:void 0}:{}},x=b.gatewayUrl!==s.gatewayUrl||b.token!==s.token||b.password!==s.password||b.bootstrapToken!==s.bootstrapToken||b.bootstrapProfile!==s.bootstrapProfile,C=x?w.resetConnection():null;x&&(c+=1,l.retire(!0));let A=n.gatewayUrl!==void 0&&n.gatewayUrl!==s.gatewayUrl,re=A?ig(b.gatewayUrl):null,ie=t!==void 0,j=ie?t.trim():re?.sessionKey??u.sessionKey;A&&(m=!1),s=b;let ae=e=>{nt(b.gatewayUrl,A_({hello:e,settings:b,password:b.password}),i.resourceBasePath)};ae(),ee({gatewayUrl:b.gatewayUrl,token:b.token,...ie?{sessionKey:j,lastActiveSessionKey:j}:re??{},...re?{selectedAgentId:re.selectedAgentId}:{}},o||A),p.stop(),d?.stop();let M=r({...l.prepare(b,x,d),clientName:i.clientOptions?.clientName??`openclaw-control-ui`,clientVersion:Il.version??`dev`,clientBuildId:Il.buildId,platform:i.clientOptions?.platform,deviceFamily:i.clientOptions?.deviceFamily,mode:i.clientOptions?.mode??`webchat`,instanceId:i.clientOptions?.instanceId??Da(),scopes:i.clientOptions?.scopes,nativeConnectAuth:i.clientOptions?.nativeConnectAuth,get modelCatalog(){return d===M?T.captureTarget(i.getModelCatalogTarget?.(b.gatewayUrl)):void 0},onHello:e=>{if(d!==M)return;l.acceptHello(e.auth,b.token),sg(b.gatewayUrl,Do(e.snapshot)?.authMode===`token`?b.token:``),y(`suspensionPhase`),s={...s,bootstrapToken:``,bootstrapProfile:void 0};let t=w.bindRecoveryScope(e.auth?.recoveryScope);if(t&&(E(t),!g(M)))return;let n=!!e.server?.buildId?.trim();if(z_(b.gatewayUrl)&&(n||m)&&Fl({version:e.server?.version,buildId:e.server?.buildId,controlUiBuildSource:e.server?.controlUiBuildSource})){D({client:M,phase:`reconnecting`,hello:e,canvasPluginSurfaceUrl:null,selfUser:null,lastError:null,lastErrorCode:null,lastErrorAuthReason:null});let t=e.server?.buildId?.trim()||e.server?.version?.trim();t&&Kl({buildId:t,...R_(k,()=>g(M)&&z_(b.gatewayUrl))});return}ae(e),o&&(a=lg());let r=xe({hello:e}),i=tt(u.sessionKey,e),c=tt(a.lastActiveSessionKey,e);(i!==a.sessionKey||c!==a.lastActiveSessionKey)&&ee({sessionKey:i,lastActiveSessionKey:c}),m=!0;let f=e.pluginSurfaceUrls?.canvas?.trim()||null,h=p.begin(M,e.auth);y(`restartPending`),D({client:M,phase:`connected`,restartPending:!1,suspensionPhase:Jm(Do(e.snapshot)?.suspension),hello:e,pluginCapabilities:Kv(e),canvasPluginSurfaceUrl:f,assistantAgentId:r?.defaultAgentId?.trim()||null,sessionKey:i,lastError:null,lastErrorCode:null,lastErrorAuthReason:null,selfUser:Vv(Bv(e.snapshot)??[],M.instanceId)}),g(M)&&!u.selfUser&&O(),p.start(M,h,f??void 0)},onRecoveryScopeChange:()=>{d===M&&u.phase===`connected`&&(Pe(b.gatewayUrl,M.recoveryScope),D({}))},onReconnectScheduled:e=>{d===M&&D({reconnectAt:Date.now()+e})},onClose:({code:e,reason:t,error:n,willRetry:r,busy:i})=>{if(d!==M)return;p.stop(),(Ze(n?.details)||n?.code===`PAIRING_REQUIRED`)&&(M.retireOfflineRecoveryScope?.(),m=!1,l.retire(!1));let a=Pa(n?.details);a&&Kl({buildId:a,...R_(k,()=>g(M)&&z_(b.gatewayUrl))});let o=a===null&&!m&&r&&ia(n);if(o&&u.phase===`starting`)return;let c=fm(n)??n?.code??null;c===ho.AUTH_BOOTSTRAP_TOKEN_INVALID&&(s={...s,bootstrapToken:``,bootstrapProfile:void 0});let f=zo(n);f&&y(`restartPending`,0);let h=_o(n)?Jm(n?.details)??`prepared`:void 0;y(`suspensionPhase`,h?0:void 0);let _=dn(t);D({client:M,phase:a===null?o?`starting`:m?r?`reconnecting`:`offline`:r?`connecting`:`stopped`:`reload-required`,hello:null,canvasPluginSurfaceUrl:null,selfUser:null,restartPending:f||u.restartPending===!0,suspensionPhase:h,lastError:o?null:n?.message?Qt(n.message):_?`disconnected (${e}): ${_}`:P(r?`connection.interruptedRetrying`:`connection.interrupted`,{code:String(e)}),lastErrorCode:o?null:i?`GATEWAY_BUSY`:c,lastErrorAuthReason:o?null:Ze(n?.details)})},onGap:({expected:e,received:t})=>{g(M)&&(D({lastError:`event gap detected (expected seq ${e}, got ${t}); reconnecting`,lastErrorCode:null,lastErrorAuthReason:null}),g(M)&&ne())},onEvent:Dv({isAttached:()=>d===M,isCurrent:()=>g(M),project:e=>T.receive(e,u),record:te,listeners:S})});d=M,D({client:M,phase:m?`reconnecting`:`connecting`,reconnectAt:void 0,hello:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,selfUser:null,sessionKey:j,lastError:null,lastErrorCode:null,lastErrorAuthReason:null}),C&&E(C),g(M)&&M.start()},k={get snapshot(){return u},get connection(){return s},get connectionRevision(){return c},get eventLog(){return w.entries},get eventLogRevision(){return w.revision},connect:ne,setSessionKey:e=>{let t=e.trim();t&&t!==u.sessionKey&&(ee({sessionKey:t,lastActiveSessionKey:t}),D({sessionKey:t}))},start:()=>ne(),stop:()=>{h=!0,v(),y(`restartPending`),y(`suspensionPhase`),p.stop(),d?.stop(),d=null,m=!1,D({client:null,phase:`stopped`,offlineStable:!1,restartPending:!1,hello:null,canvasPluginSurfaceUrl:null,assistantAgentId:null,selfUser:null,lastError:null,lastErrorCode:null,lastErrorAuthReason:null})},subscribe:e=>Ka(x,e),subscribeEventLog:e=>(C.add(e),()=>{C.delete(e),C.size===0&&w.clear()}),subscribeEvents:e=>Ka(S,e),loadSelfProfile:f.load,updateSelfUser:e=>{u.selfUser&&(f.invalidate(),D({selfUser:{...u.selfUser,...e}}))},...Lv({gatewayUrl:()=>s.gatewayUrl,connect:ne,isStopped:()=>h,retireOfflineAccess:()=>{d?.retireOfflineRecoveryScope?.(),m=!1,c+=1}})};return k}var Jv;function Yv(){return(Yv=e((()=>{Zo(),Ra(),jo(),Mm(),Ll(),w(),bt(),ie(),Sr(),Ie(),fi(),Be(),ca(),P_(),Sv(),B_(),jv(),Zm(),Pv(),Iv(),Rv(),Gv(),Vg(),su(),K(),Jv=e=>new jm(e)})))()}function Xv(e){return e.phase===`connected`?(e.pluginCapabilities?.controlUiLinkReaders??If).filter(t=>e.pluginCapabilities?.methods?.includes(t.linkReader.detailMethod)===!0&&zi(e,t.linkReader.detailMethod,`operator.read`,{requireAdvertisement:!1})):If}function Zv(e){return Xv(e).filter(t=>!!(t.linkReader.previewMethod&&e.pluginCapabilities?.methods?.includes(t.linkReader.previewMethod)))}function Qv(e,t={}){let n=n=>{if(t.shouldOpenExternally?.()||!D(n)||e().phase!==`connected`)return;let r=n.composedPath(),i=r.find(e=>e instanceof HTMLAnchorElement);if(!i||!r.some(e=>e instanceof Element&&e.localName===`openclaw-app-shell`)||i.hasAttribute(`download`)||i.hasAttribute(`data-file-path`)||i.hasAttribute(`data-link-reader-external`))return;let a=Af(i.href,Xv(e()));if(!a)return;let o=new CustomEvent(Gd,{cancelable:!0,detail:{url:a.href,open:!0,trigger:i,newTab:!r.some(e=>e instanceof Element&&e.localName===`openclaw-link-reader-panel`)}});window.dispatchEvent(o)||n.preventDefault()};return document.addEventListener(`click`,n),{dispose:()=>document.removeEventListener(`click`,n)}}function $v(){return($v=e((()=>{Rf(),Jd(),Vi()})))()}function ey(e){return/^(?:(?:codex|chatgpt|openclaw):\/\/plugins\/|https:\/\/chatgpt\.com\/plugins\/)[^/?#]+\/app\/[^/?#]+\/?(?:[?#]|$)/iu.test(e)}function ty(e){let t=!1,n=n=>{if(!D(n))return;let r=n.composedPath().find(e=>e instanceof HTMLAnchorElement);if(!r||r.hasAttribute(`download`))return;let i=r.href;ey(i)&&(n.preventDefault(),W(async()=>{let{navigateMcpAppLink:e}=await import(`./mcp-app-routing-BHjVXpEf.js`).then(e=>(e.t(),e.n));return{navigateMcpAppLink:e}},__vite__mapDeps([88,11,1,3,2,4,5,8,7,6,9,12,13,14,15,28,29,30,31]),import.meta.url).then(({navigateMcpAppLink:n})=>{t||n(e,i)}).catch(e=>{t||console.error(`[openclaw] MCP app link failed to load; click to retry`,e)}))};return document.addEventListener(`click`,n),{dispose:()=>{t=!0,document.removeEventListener(`click`,n)}}}function ny(){return(ny=e((()=>{K()})))()}function ry(){return window.chrome?.webview}function iy(e){if(!e||typeof e!=`object`||!(`type`in e)||e.type!==`draft-text`)return null;let t=`payload`in e?e.payload:null,n=t&&typeof t==`object`&&`text`in t?t.text:null;return typeof n==`string`?n:null}function ay(){let e=ry();if(!e)return{subscribe:()=>()=>{},dispose:()=>{}};let t=null,n=new Set,r=e=>{let r=iy(e.data);if(r!==null){if(n.size===0){t=r;return}for(let e of n)e(r)}};return e.addEventListener(`message`,r),ry()?.postMessage({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 oy(){let e=il()?.webkit?.messageHandlers?.openclawLink;return e?.postMessage.bind(e)}function sy(){return il()?.webkit?.messageHandlers?.openclawUpdate}function cy(){return sy()!==void 0}function ly(){let e=sy();return e?(e.postMessage.bind(e)({type:`start-update`}),window.dispatchEvent(new CustomEvent(vy)),!0):!1}function uy(e){if(!e.isTrusted)return null;let t=Pn(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 dy(e,t){try{return e({type:`open-link`,url:t.href,target:`external`}),!0}catch{return!1}}function fy(e){let t=oy();if(!t)return!1;try{return dy(t,new URL(e))}catch{return!1}}function py(e){window.dispatchEvent(new CustomEvent(Rd,{detail:{open:!0,url:e.href,...Qd()?{native:!0}:{}}}))}function my(e){return!e.defaultPrevented&&!e.shiftKey&&!e.altKey&&(e.type===`click`&&e.button===0||e.type===`auxclick`&&e.button===1)}function hy(e={}){if(e.signal?.aborted||typeof window>`u`||typeof document>`u`)return{dispose(){}};let t=oy();if(!t&&!Qd()&&!e.shouldOpenInControlUiBrowser&&!e.onNativeUpdateDeclined)return{dispose(){}};let n=null,r,i=0,a=!1,o=!1,s=()=>{o=!0},c=()=>{o&&(o=!1,e.onNativeUpdateDeclined?.())},l=e=>{e&&n!==e||(i+=1,n?.remove(),n=null)},u=n=>{Qd()&&e.canPresentBrowserPanel?.()===!1?t&&dy(t,n):py(n)},d=async(o,s,c)=>{l();let d=i,f=o.composedPath(),{mountNativeLinkMenu:p}=await(r??=W(()=>import(`./native-link-menu.runtime-BWyTHQLY.js`),__vite__mapDeps([89,1,12,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url));a||e.signal?.aborted||d!==i||!s.isConnected||(n=p({path:f,anchor:s,url:c,x:o.clientX,y:o.clientY,close:l,openExternal:()=>t&&dy(t,c),openInline:()=>u(c)}))},f=n=>{let r=Se(n);if(r&&(r.anchor.hasAttribute(`data-link-reader-external`)||e.shouldOpenExternally?.())){t&&D(n)&&dy(t,r.url)&&(l(),n.preventDefault());return}if(r&&(Qd()?D(n):my(n))&&(Qd()||e.shouldOpenInControlUiBrowser?.())){u(r.url),l(),n.preventDefault();return}if(!t||!D(n))return;let i=uy(n);i&&dy(t,i.url)&&(l(),n.preventDefault())},p=e=>{if(!t||e.defaultPrevented)return;let n=Se(e);n&&(e.preventDefault(),e.stopPropagation(),d(e,n.anchor,n.url).catch(e=>{r=void 0,a||console.error(`[openclaw] native link menu failed to load; right-click to retry`,e)}))};window.addEventListener(`click`,f),window.addEventListener(`auxclick`,f),window.addEventListener(vy,s),window.addEventListener(gy,c),t&&document.addEventListener(`contextmenu`,p,!0);let m=()=>{a=!0,e.signal?.removeEventListener(`abort`,m),window.removeEventListener(`click`,f),window.removeEventListener(`auxclick`,f),window.removeEventListener(vy,s),window.removeEventListener(gy,c),document.removeEventListener(`contextmenu`,p,!0),l()};return e.signal?.addEventListener(`abort`,m,{once:!0}),{dispose:m}}var gy,_y,vy;function yy(){return(yy=e((()=>{Jd(),K(),gy=`openclaw:native-update-declined`,_y=`openclaw:native-update-availability-changed`,vy=`openclaw:native-update-posted`})))()}function by(e,t){if(!Array.isArray(e))return;let n=e.filter(e=>{if(!H(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 xy(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 Sy(e){if(!H(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 Cy(e,t){if(!H(t)||!H(t.request))return null;let n=V(t.id),r=t.request,i=typeof t.createdAtMs==`number`?t.createdAtMs:0,a=typeof t.expiresAtMs==`number`?t.expiresAtMs:0;if(!n||!i||!a)return null;let o={id:n,kind:e,createdAtMs:i,expiresAtMs:a},s={agentId:Ki(r.agentId)??null,sessionKey:Ki(r.sessionKey)??null};if(e===`exec`){let e=wa(r.command);return e?{...o,request:{...s,command:e,cwd:Ki(r.cwd)??null,host:Ki(r.host)??null,security:Ki(r.security)??null,ask:Ki(r.ask)??null,resolvedPath:Ki(r.resolvedPath)??null,runId:Ki(r.runId)??null,commandSpans:by(r.commandSpans,e.length),allowedDecisions:xy(r.allowedDecisions),scope:Sy(r.scope)}}:null}let c=V(r.title);if(!c)return null;if(e===`plugin`)return{...o,request:{...s,command:c,allowedDecisions:xy(r.allowedDecisions)},pluginTitle:c,pluginDescription:Ki(r.description)??null,pluginDetail:Ki(r.detail)??null,pluginSeverity:Ki(r.severity)??null,pluginId:Ki(r.pluginId)??null,pluginActions:r.actions};let l=V(r.description),u=V(r.command),d=V(r.proposalHash);return!l||!u||!d?null:{...o,request:{...s,command:u,allowedDecisions:[`allow-once`,`deny`]},pluginTitle:c,pluginDescription:l,proposalHash:d}}function wy(e,t){if(e!==`exec.approval.resolved`&&e!==`plugin.approval.resolved`&&e!==`openclaw.approval.resolved`||!H(t))return null;let n=V(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 Ty(e,t){return e===`exec.approval.requested`?Cy(`exec`,t):e===`plugin.approval.requested`?Cy(`plugin`,t):e===`openclaw.approval.requested`?Cy(`system-agent`,t):null}async function Ey(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 Dy(e){let t=Date.now();return e.filter(e=>e.expiresAtMs>t)}function Oy(e){if(!(e instanceof Error))return!1;let t=H(e)?e:null,n=H(t?.details)?V(t.details.reason):void 0;return n===By||n===Vy||V(t?.gatewayCode)===Vy||/unknown or expired approval id/i.test(e.message)}function ky(e,t,n){return e.status===`rejected`?Dy(n).filter(e=>e.kind===t):Array.isArray(e.value)?e.value.flatMap(e=>{let n=Cy(t,e);return n?[n]:[]}):[]}function Ay(e){return e.toSorted((e,t)=>e.createdAtMs-t.createdAtMs||e.id.localeCompare(t.id))}function jy(e,t,n,r){let i=new Set(t.map(e=>e.id)),a=Dy(n),o=new Set(a.map(e=>e.id)),s=Dy(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 Ay([...s,...l])}function My(e,t){let n=e.execApprovalExpiryTimers?.get(t);n!==void 0&&(globalThis.clearTimeout(n),e.execApprovalExpiryTimers?.delete(t))}function Ny(e,t){My(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);Py(e,t.id),i&&e.execApprovalChanged?.()},Math.max(0,t.expiresAtMs-Date.now()+500));e.execApprovalExpiryTimers?.set(t.id,n)}function Py(e,t){My(e,t),e.execApprovalQueue=Dy(e.execApprovalQueue).filter(e=>e.id!==t),e.execApprovalErrors.delete(t)}function Fy(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 Iy(e){for(let t of e.execApprovalExpiryTimers?.values()??[])globalThis.clearTimeout(t);e.execApprovalExpiryTimers?.clear()}function Ly(e,t){let n=Dy(e.execApprovalQueue).filter(e=>e.id!==t.id);n.push(t),e.execApprovalQueue=Ay(n),Ny(e,t)}async function Ry(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=Dy(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=jy([...ky(i,`exec`,e.execApprovalQueue),...ky(o,`plugin`,e.execApprovalQueue),...ky(s,`system-agent`,e.execApprovalQueue)],a,e.execApprovalQueue,r.removedIds);if(t?.isCurrentClient&&!t.isCurrentClient(n))return!1;e.execApprovalQueue=c,Fy(e);let l=new Set(c.map(e=>e.id));for(let t of e.execApprovalExpiryTimers?.keys()??[])l.has(t)||My(e,t);for(let t of c)Ny(e,t);return!0}finally{i.delete(r),i.size===0&&(e.execApprovalRefreshes=void 0)}}function zy(e,t){Py(e,t);for(let n of e.execApprovalRefreshes??[])n.removedIds.add(t)}var By,Vy;function Hy(){return(Hy=e((()=>{By=`APPROVAL_ALREADY_RESOLVED`,Vy=`APPROVAL_NOT_FOUND`})))()}function Uy(e){let t=Jf(e);return t.canAdmin||t.canPair}function Wy(e,t){let n=Jf(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 Gy(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||!Uy(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&&Uy(e.gateway.snapshot)&&(e.state.pendingCount=Array.isArray(i.pending)?i.pending.length:0,e.publish())}}}function Ky(e){return async(t,n=e.getConnectedEpoch(),r=e.getReviewGeneration())=>{e.canReview()&&r===e.getReviewGeneration()&&Jf(e.gateway.snapshot).canReviewApprovals&&await Ry(e.state,{isCurrentClient:i=>i===t&&n===e.getConnectedEpoch()&&r===e.getReviewGeneration()&&e.canReview()&&Jf(e.gateway.snapshot).canReviewApprovals&&e.isCurrentClient(t)})&&!e.isDisposed()&&e.publish()}}function qy(){return(qy=e((()=>{Hy(),np()})))()}function Jy(e){let t=null,n=0,r=()=>{n+=1,t!==null&&(globalThis.clearTimeout(t),t=null)},i=async()=>{t=null;let r=n;e.canPoll()&&await e.refresh(),r===n&&a()},a=()=>{if(!e.canPoll()){r();return}t===null&&(t=globalThis.setTimeout(()=>void i(),5e3))};return{stop:r,sync:a}}function Yy(e){return!!e.selfUser?.id?.trim()&&zi(e,`update.report`,`operator.admin`,{requireAdvertisement:!1})}function Xy(e){let t=0,n=null;return{invalidate:()=>{t+=1,n=null},report:async r=>{let i=e.getClient();if(!i||n!==null||!e.isCurrent(r,i))return;let a=++t;n=a;let o=()=>n===a&&t===a&&e.isCurrent(r,i);e.setBusy(!0);try{let{reportUpdateFailure:t}=await W(async()=>{let{reportUpdateFailure:e}=await import(`./update-failure-report-BvjBN3tT.js`);return{reportUpdateFailure:e}},__vite__mapDeps([90,1,12,3,2,4,5,8,7,6,9,11,13,14,15,91,28,29,30,31]),import.meta.url),n=await t({attemptId:r,client:i,isCurrent:o});n&&o()&&e.setResult(r,n)}catch(t){o()&&e.setResult(r,{status:`error`,message:Qt(t)})}finally{n===a&&(n=null,e.setBusy(!1))}}}}function Zy(){return(Zy=e((()=>{Sr(),Vi(),K()})))()}function Qy(e,t){return typeof e==`number`&&Number.isInteger(e)&&e>=t}function $y(e){let t=e?.snapshot;return H(t)?eb(t.updateAvailable):null}function eb(e){if(!H(e)||!Ia(e.currentVersion)||!Ia(e.latestVersion)||!Ia(e.channel))return null;let t=e.commits,n=Array.isArray(t)?t.filter(e=>H(e)&&Ia(e.sha)&&typeof e.subject==`string`).map(e=>({sha:e.sha,subject:e.subject})).slice(0,cb):void 0;return{currentVersion:e.currentVersion,latestVersion:e.latestVersion,channel:e.channel,...Ia(e.currentSha)?{currentSha:e.currentSha}:{},...Ia(e.upstreamRef)?{upstreamRef:e.upstreamRef}:{},...Ia(e.upstreamSha)?{upstreamSha:e.upstreamSha}:{},...Ia(e.repositoryUrl)?{repositoryUrl:e.repositoryUrl}:{},...Qy(e.commitsBehind,0)?{commitsBehind:e.commitsBehind}:{},...n?.length?{commits:n}:{}}}function tb(e){return H(e)?e.kind===`package`?Ia(e.version)?{kind:`package`,version:e.version}:null:e.kind===`git`&&Ia(e.upstreamRef)&&Ia(e.upstreamSha)&&Qy(e.commitsBehind,0)?{kind:`git`,upstreamRef:e.upstreamRef,upstreamSha:e.upstreamSha,commitsBehind:e.commitsBehind}:null:null}function nb(e){return{...Ia(e.currentSha)?{currentSha:e.currentSha}:{},...Ia(e.upstreamSha)?{upstreamSha:e.upstreamSha}:{},...Ia(e.repositoryUrl)?{repositoryUrl:e.repositoryUrl}:{},...Qy(e.commitAtMs,0)?{commitAtMs:e.commitAtMs}:{},...Qy(e.installedAtMs,0)?{installedAtMs:e.installedAtMs}:{}}}function rb(e){if(!H(e))return null;let t=nb(e);return e.status===`current`?{...t,status:`current`}:e.status===`behind`&&Qy(e.commitsBehind,1)?{...t,status:`behind`,commitsBehind:e.commitsBehind}:e.status===`ahead`&&Qy(e.commitsAhead,1)?{...t,status:`ahead`,commitsAhead:e.commitsAhead}:e.status===`diverged`&&Qy(e.commitsAhead,1)&&Qy(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 ib(e){return!H(e)||!Ia(e.id)||e.state!==`waiting-for-idle`&&e.state!==`countdown`&&e.state!==`applying`||!Qy(e.announcedAtMs,0)||!Qy(e.forceAtMs,0)||!Qy(e.updatedAtMs,0)?null:{id:e.id,state:e.state,announcedAtMs:e.announcedAtMs,...Qy(e.applyAtMs,0)?{applyAtMs:e.applyAtMs}:{},...Qy(e.holdUntilMs,0)?{holdUntilMs:e.holdUntilMs}:{},forceAtMs:e.forceAtMs,updatedAtMs:e.updatedAtMs}}function ab(e){if(!H(e)||!Ia(e.root)||typeof e.currentSha!=`string`||!/^[a-f0-9]{40}$/.test(e.currentSha)||!Ia(e.currentPath))return null;let t;if(e.prepared!==void 0){let n=e.prepared;if(!H(n)||typeof n.sha!=`string`||!/^[a-f0-9]{40}$/.test(n.sha)||!Ia(n.path)||typeof n.buildDigest!=`string`||!/^[a-f0-9]{64}$/.test(n.buildDigest)||!Qy(n.preparedAtMs,0))return null;t={sha:n.sha,path:n.path,buildDigest:n.buildDigest,preparedAtMs:n.preparedAtMs}}return{root:e.root,currentSha:e.currentSha,currentPath:e.currentPath,...t?{prepared:t}:{}}}function ob(e){if(!H(e)||!Ia(e.channel)||typeof e.autoEnabled!=`boolean`)return null;let t=H(e.install)?e.install:null,n=t?.kind,r=n===`package`||n===`git`||n===`immutable`||n===`unknown`?n:void 0;if(e.install!==void 0&&r===void 0)return null;let i=t?.git===void 0?void 0:rb(t.git);if(t?.git!==void 0&&!i)return null;let a=t?.immutable===void 0?void 0:ab(t.immutable);if(t?.immutable!==void 0&&!a)return null;let o=e.target===void 0?void 0:tb(e.target),s=e.campaign===void 0?void 0:ib(e.campaign);return e.target!==void 0&&!o||e.campaign!==void 0&&!s?null:{channel:e.channel,autoEnabled:e.autoEnabled,...r?{install:{kind:r,...i?{git:i}:{},...a?{immutable:a}:{}}}:{},...o?{target:o}:{},...s?{campaign:s}:{}}}function sb(e){let t=e?.snapshot;return H(t)?ob(t.updateSchedule):null}var cb;function lb(){return(lb=e((()=>{cb=5})))()}function ub(e,t){let n=e.updateSchedule?.campaign,r=t?.campaign;return{updateSchedule:t,heldUpdateCampaignId:db(t,e.heldUpdateCampaignId),updateCampaignStatusHydrated:!r||e.updateCampaignStatusHydrated&&n?.id===r.id&&n.updatedAtMs===r.updatedAtMs}}function db(e,t){return e?.campaign?.holdUntilMs===void 0?t:e.campaign.id}function fb(e,t){return{updateAvailable:$y(t),...ub(e,sb(t))}}function pb(e,t){let n=t&&Object.hasOwn(t,`schedule`)?ob(t.schedule):void 0;return{updateAvailable:eb(t?.updateAvailable),...n===void 0?{}:ub(e,n)}}function mb(e,t=Date.now()){let n=e?.campaign;return n?n.state===`applying`?P(`updates.campaign.applying`):n.holdUntilMs!==void 0&&n.holdUntilMs>t?P(`updates.campaign.held`,{time:Oe(n.holdUntilMs,t)}):n.state===`waiting-for-idle`?P(`updates.campaign.waitingForIdle`,{time:Oe(n.forceAtMs,t)}):P(`updates.campaign.countdown`,{time:Oe(n.applyAtMs??n.forceAtMs,t)}):null}function hb(e,t){let n=e?.target;if(n?.kind===`package`||e?.install?.kind===`package`)return null;let r=e?.install?.git;if(e?.campaign&&n?.kind===`git`){let e=t?.upstreamSha===n.upstreamSha&&(!r?.currentSha||r.currentSha===t.currentSha)?t.currentSha:void 0;return{upstreamSha:n.upstreamSha,...e?{currentSha:e,repositoryUrl:t?.repositoryUrl,commitsBehind:t?.commitsBehind}:{}}}return r&&r.status!==`unavailable`?{currentSha:r.currentSha,upstreamSha:r.upstreamSha,repositoryUrl:r.repositoryUrl,commitsBehind:`commitsBehind`in r&&r.commitsBehind}:t?.upstreamSha||t?.commitsBehind!==void 0?t:n?.kind===`git`?{upstreamSha:n.upstreamSha,commitsBehind:n.commitsBehind}:null}function gb(e,t){let n=e?.target,r=hb(e,t);if(r){let e=r.commitsBehind;return typeof e==`number`?P(e===1?`updates.target.commitBehind`:`updates.target.commitsBehind`,{count:String(e)}):null}let i=n?.kind===`package`?n.version:t?.latestVersion;return i?P(`updates.target.version`,{version:i}):null}function _b(e,t){let n=hb(e,t);if(!n?.upstreamSha||n.commitsBehind===!1)return null;let{currentSha:r,upstreamSha:i,repositoryUrl:a}=n;return{currentSha:r,targetSha:i,compareUrl:a&&/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+$/u.test(a)&&r&&/^[a-f\d]{7,40}$/iu.test(r)&&/^[a-f\d]{7,40}$/iu.test(i)?`${a}/compare/${r}...${i}`:void 0}}function vb(e,t,n){let r=hb(t,e)?.commitsBehind;return!!(n||t?.campaign||r!==!1&&(e?.latestVersion!==e?.currentVersion||r))}function yb(){return(yb=e((()=>{w(),it(),lb()})))()}function bb(e){let t=e?.stats?.runId?.trim()||e?.stats?.handoffId?.trim();return t&&t.length<=256?t:null}function xb(e){if(e?.kind!==`update`||!e.status)return null;let t=e.stats,n=io({status:e.status,reason:t?.reason??void 0}),r=n!==`succeeded`&&n!==`pending`,i=r?Cb(e):null,a=r&&typeof e.ts==`number`?{timestampMs:e.ts,status:e.status,reason:t?.reason?.trim()||`unexpected-error`,installKind:t?.mode?.trim()||null,beforeVersion:t?.before?.version?.trim()||null,beforeSha:t?.before?.sha?.trim()||null,afterVersion:t?.after?.version?.trim()||null,afterSha:t?.after?.sha?.trim()||null,failure:i}:null,o=r?kb({status:e.status,reason:t?.reason??void 0,cause:i}):null;o&&n===`failed`&&(o.text+=` ${P(`updates.triage.hostHint`)}`);let s={id:bb(e)??(typeof e.ts==`number`?`recorded:${e.ts}`:null),timestampMs:e.ts??null};return{attempt:a,banner:o,failure:n===`failed`&&s.id&&o?{id:s.id,outcome:n,attempt:a,banner:o,reconciledRecord:s}:null}}function Sb(e){let t=dn(e).split(`
`).map(e=>e.trim()).filter(Boolean).at(-1);return t?t.slice(0,Mb):null}function Cb(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=Sb(n?.log?.stderrTail)??Sb(n?.log?.stdoutTail),i=n?.name?.trim();return i&&r?{step:i,detail:r}:null}function wb(e){let t=0,n=0,r=0,i=0,a=async(o=`manual`)=>{let s=e.getClient(),c=e.getEpoch();if(!s||!e.canRefresh()||!e.isCurrent(s,c))return!1;let l=o===`manual`,u=l?++n:++t,d=e.getRevision(),f=r,p=i,m=()=>u===(l?n:t)&&e.isCurrent(s,c),h=()=>m()&&e.canRefresh()&&d===e.getRevision();l&&e.onRefreshing(!0);try{let t=s.request(`update.status`,l?{refreshCheckout:!0}:{},l?void 0:{timeoutMs:5e3}).catch(t=>(o!==`background`&&h()&&e.onError(t,o),null)),n=l?a(`background`):null,c=await t;if(c&&h()){if(l){r++;let t=p!==i,{activeRun:o,lastRun:s,sentinel:l}=c;(!t||o||s)&&e.onStatus({activeRun:o,lastRun:s,...t?{}:{sentinel:l}}),e.onCheckout(c,t),n?.then(()=>{h()&&a(`background`)})}else i++,e.onError(null,`completion`),e.onStatus(c,f!==r);return!0}return!1}finally{l&&m()&&e.onRefreshing(!1)}};return a}function Tb(e,t,n=!1){let r=xb(e.sentinel);return{failure:r?.failure??null,updateStatusBanner:r?r.banner:t.updateStatusBanner,recordedUpdateAttempt:r?r.attempt:t.recordedUpdateAttempt,...Eb(e,t,n?`install`:void 0)}}function Eb(e,t,n){let r=Object.hasOwn(e,`schedule`)?ob(e.schedule):void 0,i=n===`schedule`?t.updateSchedule:r,a=n===`schedule`?r:t.updateSchedule;return n&&i&&a?.channel===i.channel&&a.install&&(i={...i,install:a.install}),{...n!==`schedule`&&Object.hasOwn(e,`updateAvailable`)?{updateAvailable:eb(e.updateAvailable)}:{},...i===void 0?{}:{updateSchedule:i,heldUpdateCampaignId:db(i,t.heldUpdateCampaignId)}}}function Db(e){if(po(e)||e.status!==`failed`&&e.status!==`rolled-back`)return null;let t=e.steps.findLast(e=>e.status===`failed`);return{id:e.runId,reconciledRecord:{id:e.runId,timestampMs:e.finishedAtMs??e.updatedAtMs},outcome:`failed`,banner:{tone:e.reason===`legacy-driver-expired`?`warn`:`danger`,text:Lo(e).markdown},attempt:{timestampMs:e.finishedAtMs??e.updatedAtMs,status:e.status,reason:e.reason??`unexpected-error`,installKind:e.target.kind??null,beforeVersion:e.before.version??null,beforeSha:e.before.sha??null,afterVersion:e.after.version??null,afterSha:e.after.sha??null,failure:t?{step:t.step,detail:t.detail??``}:null}}}function Ob(e){return{tone:`warn`,text:P(`updates.checkError`,{error:Qt(e)})}}function kb(e){let t=(e.status??`error`).trim()||`error`,n=(e.reason??`unexpected-error`).trim()||`unexpected-error`,r=P(jb[n]??`updates.failureReasons.default`),i=e.cause;return{tone:t===`skipped`?`warn`:`danger`,text:i?`${P(`updates.failedAtStep`,{step:i.step,cause:i.detail})} ${r}`:P(`updates.status`,{status:t,reason:n,guidance:r})}}function Ab(){return{tone:`danger`,text:P(`updates.outcomeUnknown`)}}var jb,Mb;function Nb(){return(Nb=e((()=>{Za(),Eo(),Ao(),lo(),w(),Sr(),lb(),yb(),jb={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`,"external-supervisor-update-required":`updates.failureReasons.externalSupervisorUpdateRequired`,"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`,"managed-service-handoff-unavailable":`updates.failureReasons.managedServiceHandoffUnavailable`,"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`},Mb=180})))()}function Pb(){let e=Le(),t=()=>{try{let t=e?.getItem(Fb);if(t==null)return[];let n=t.length<32768?JSON.parse(t):null;return Array.isArray(n)&&n.every(e=>typeof e==`string`)?n.slice(-32):null}catch{return null}},n=(e,t,n)=>JSON.stringify([e,t,n]);return{acknowledged:(e,r,i)=>(t()??[]).includes(n(e,r,i)),acknowledge:(r,i,a)=>{try{let o=t();if(!e||!o)return!1;let s=[...new Set([...o,n(r,i,a)])].slice(-32);return e.setItem(Fb,JSON.stringify(s)),!0}catch{return!1}}}}var Fb;function Ib(){return(Ib=e((()=>{Fb=`openclaw:control-ui:update-acknowledged:v1`})))()}function Lb(e,t,n={}){let r={updateAvailable:null,updateSchedule:null,heldUpdateCampaignId:null,updateRunning:!1,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0,updateReconciliationPending:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null,diagnosableUpdateFailureId:null,reportableUpdateFailureId:null,updateFailureReportBusy:!1,updateFailureReportNotice:null,updateRun:null,updateRunAcknowledged:!1,controlUiRefreshRequired:!1},i=!1,a=e.snapshot.client,o=e.snapshot.hello,s=null,c=0,l=Jf(e.snapshot),u=q(e.connection.gatewayUrl),d=e.snapshot.selfUser?.id??null,f=Pb(),p=!1,m=0,h=0,g=0,_=!1,v=null,y={kind:`unknown`},b=null,x=null,S=0,C=Xy({getClient:()=>e.snapshot.client,isCurrent:(t,n)=>E(n)&&!r.updateRunning&&!r.updateReconciliationPending&&r.reportableUpdateFailureId===t&&Yy(e.snapshot),setBusy:e=>{r={...r,updateFailureReportBusy:e},O()},setResult:(e,t)=>{r={...r,updateFailureReportNotice:{attemptId:e,result:t}}}});function w(){C.invalidate(),r={...r,updateFailureReportBusy:!1,updateFailureReportNotice:null}}function T(e){JSON.stringify(x)!==JSON.stringify(e)&&(x=e,w())}let E=t=>!i&&a===t&&e.snapshot.client===t&&e.snapshot.phase===`connected`&&Jf(e.snapshot).canAdmin;function D(t){let i=x,o=u,s=d,l=a,f=c;if(!i||i.id!==t||!l||!E(l)||r.updateRunning||r.updateFailureReportBusy||r.updateReconciliationPending)return;let p=++S,m=()=>p===S&&f===c&&E(l)&&x===i&&q(e.connection.gatewayUrl)===o&&(e.snapshot.selfUser?.id??null)===s&&!r.updateRunning&&!r.updateReconciliationPending,h=!1;n.onUpdateFailure?.(i,{isCurrent:m,admit:()=>h||!m()?!1:(h=!0,!0)})}function O(){let e=r.updateSchedule?.campaign,n=e?.state===`applying`&&r.updateRun?.origin.campaignId!==e.id;r={...r,updateRunning:p||r.updateRun?.status===`running`||n,updateReconciliationPending:v!==null&&(!r.updateRun||r.updateRun.status===`running`)},n&&T(null),r={...r,diagnosableUpdateFailureId:x&&r.updateRun?.target.installationMethod!==`ocm`&&a&&E(a)&&!r.updateRunning&&!r.updateReconciliationPending?x.id:null,reportableUpdateFailureId:r.updateRunning||r.updateReconciliationPending||r.updateRun?.target.installationMethod===`ocm`?null:r.updateRun?!po(r.updateRun)&&No(r.updateRun)?r.updateRun.runId:null:x?.outcome===`failed`&&x.attempt?x.id:null},t()}let ee=(e,t)=>{r={...r,updateStatusBanner:{...t?{source:t}:{},tone:`danger`,text:P(`updates.error`,{error:Qt(e)})}},O()},te=e=>{let t=r.updateRun;if(t?.runId===e.runId&&t.updatedAtMs>e.updatedAtMs){O();return}(t?.runId!==e.runId||t.updatedAtMs!==e.updatedAtMs)&&w(),v=e.runId,b=null;let n=Db(e);T(n),r={...r,updateRun:e,updateRunAcknowledged:po(e)||f.acknowledged(u,d,e.runId),recordedUpdateAttempt:n?.attempt??null,updateStatusBanner:n?.banner??null},O(),re.sync()},ne=async()=>{let e=a,t=v;if(!e||!t||!E(e))return;let n=++g,i=c,o=()=>n===g&&i===c&&t===v&&E(e);try{let n=await e.request(`update.runs.get`,{runId:t});if(!o())return;n.run?(te(n.run),n.run.status!==`running`&&k(`completion`)):(v=null,T(null),r={...r,updateRun:null,updateStatusBanner:Ab()},O())}catch(e){o()&&ee(e,`read`)}},k=wb({getClient:()=>a,getEpoch:()=>c,getRevision:()=>m,canRefresh:()=>!i&&l.canAdmin,isCurrent:(e,t)=>t===c&&E(e),onRefreshing:e=>{r={...r,updateStatusRefreshing:e},O()},onStatus:(e,t=!1)=>{let{failure:n,updateStatusBanner:i,recordedUpdateAttempt:a,...o}=Tb(e,r,t),s=e.activeRun??e.lastRun,c=b?.history,l=c!==void 0&&(!s||c.kind===`known`&&s.runId===c.runId||c.kind===`unknown`&&s.status!==`running`&&s.runId!==v);y={kind:`known`,runId:s?.runId??null},r={...r,...o,updateCampaignStatusHydrated:!0},s&&!l&&(!r.updateRun||s.runId===r.updateRun.runId||s.createdAtMs>=r.updateRun.createdAtMs)?te(s):(!r.updateRun&&!l&&(T(n),r={...r,updateStatusBanner:i,recordedUpdateAttempt:a}),O()),re.sync()},onCheckout:(e,t)=>{r={...r,...Eb(e,r,t?`schedule`:void 0),updateStatusCheckBanner:null},O(),re.sync()},onError:(e,t)=>{(t!==`completion`||r.updateStatusCheckBanner?.mode!==`manual`)&&(e!==null||r.updateStatusCheckBanner!==null)&&(r={...r,updateStatusCheckBanner:e===null?null:{...Ob(e),mode:t}},O())}}),A=()=>v?.startsWith(`ocm:`)&&r.updateReconciliationPending,re=Jy({canPoll:()=>!!(a&&E(a)&&(r.updateSchedule?.campaign||A())),refresh:async()=>{A()?await ne():await k(`background`)}}),ie=(e,t)=>n.connectionBootstrap?.run(e,t)??t();return{get snapshot(){return r},synchronizeGateway:t=>{let n=q(e.connection.gatewayUrl),i=t.selfUser?.id??null,f=Jf(t),_=!l.canAdmin&&f.canAdmin,x=t.phase===`connected`,S=n!==u||x&&i!==d||!!t.hello?.auth&&!f.canAdmin;S&&(C.invalidate(),h++,g++,m++,v=null,y={kind:`unknown`},b=null,p=!1,T(null),r={...r,updateRun:null,updateRunAcknowledged:!1,updateStatusRefreshing:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null,heldUpdateCampaignId:null}),u=n,x&&(d=i);let w=x?t.client:null,E=s!==w,D=o!==t.hello;if(l=f,a=t.client,o=t.hello,s=w,E&&(C.invalidate(),r={...r,updateFailureReportBusy:!1},b?.requestSent&&!v&&!r.updateRun&&!r.updateStatusBanner&&(r={...r,updateStatusBanner:Ab()}),c++,g++,m++,h++,p=!1),!x||!t.client){r={...r,updateAvailable:null,updateSchedule:null,updateStatusRefreshing:!1,updateCampaignStatusHydrated:!0},re.stop(),t.phase===`reload-required`?r={...r,controlUiRefreshRequired:!0}:t.client?t.hello&&(r={...r,controlUiRefreshRequired:!0}):(c=0,r={...r,controlUiRefreshRequired:!1}),O();return}let ee={version:t.hello?.server?.version,buildId:t.hello?.server?.buildId,controlUiBuildSource:t.hello?.server?.controlUiBuildSource};r={...r,...E||D?fb(r,t.hello):{},controlUiRefreshRequired:E?!nc(e.connection.gatewayUrl)&&(!!ee.buildId?.trim()||c>1)&&Fl(ee):r.controlUiRefreshRequired},O(),re.sync(),(E||S||_)&&l.canAdmin&&ie(`update-run`,()=>v?ne():k(`background`))},handleUpdateRunChanged(e){let t=b?.history;if(!H(e)||typeof e.runId!=`string`||t?.kind===`known`&&e.runId===t.runId||!v&&t?.kind===`unknown`&&e.status!==`running`||typeof e.updatedAtMs!=`number`||!a||!E(a))return;let n=r.updateRun;n?.runId===e.runId&&e.updatedAtMs<=n.updatedAtMs||(T(null),C.invalidate(),r={...r,updateFailureReportBusy:!1},O(),m++,v&&v!==e.runId?k(`completion`):(v=e.runId,ne()))},handleUpdateAvailable(e){if(i)return;let t=r.updateSchedule?.campaign;m++,r={...r,...pb(r,e)},O(),re.sync(),t?.state===`applying`&&r.updateSchedule?.campaign?.state!==`applying`&&k(`completion`)},refreshUpdateStatus:k,diagnoseUpdateFailure:D,acknowledgeUpdateRun(){let e=r.updateRun;e&&e.status!==`running`&&(f.acknowledge(u,d,e.runId),r={...r,updateRunAcknowledged:!0},O())},async runUpdate(e){let t=a;if(!t||!E(t)||r.updateRunning||r.updateReconciliationPending)return;let i=++h,o=e?.sessionKey??n.getActiveSessionKey?.();m++,g++;let s={history:r.updateRun?{kind:`known`,runId:r.updateRun.runId}:y,requestSent:!1};b=s,v=null,p=!0,T(null),r={...r,updateRun:null,updateRunAcknowledged:!1,updateStatusBanner:null,updateStatusCheckBanner:null,recordedUpdateAttempt:null},O();let c=()=>i===h&&E(t);try{if(await n.drainConfigWrites?.(),!c()||r.updateSchedule?.campaign?.state===`applying`)return;let e=await t.request(`update.run`,o?{sessionKey:o}:{},{onSent:()=>{s.requestSent=!0}});if(!c())return;if(e.runId)v=e.runId,await ne();else{let t=xb(e.sentinel?.payload);T(t?.failure??null),r={...r,recordedUpdateAttempt:t?.attempt??null,updateStatusBanner:t?.banner??kb({status:e.result?.status??`error`,reason:e.result?.reason})}}}catch(e){c()&&(ee(e),s.requestSent&&!(e instanceof Tm)&&await k(`completion`))}finally{c()&&(p=!1,O(),re.sync())}},async holdUpdate(){let t=e.snapshot.client,n=r.updateSchedule?.campaign,a=_||r.updateRunning||r.updateReconciliationPending;if(!t||e.snapshot.phase!==`connected`||i||a||!n||n.state===`applying`||r.heldUpdateCampaignId===n.id||!Jf(e.snapshot).canAdmin)return!1;let o=h,s=m,c=()=>o===h&&E(t);_=!0;try{let e=await t.request(`update.hold`,{});if(!c())return!1;let i=e.schedule&&ob(e.schedule);return s===m&&(i!==void 0||e.ok)&&(m+=1,r={...r,...i===void 0?{}:{updateSchedule:i},heldUpdateCampaignId:e.ok?n.id:db(i??r.updateSchedule,r.heldUpdateCampaignId)},O()),e.ok}catch(e){return c()&&s===m&&ee(e),!1}finally{_=!1}},reportUpdateFailure:C.report,dispose(){i=!0,C.invalidate(),h++,g++,re.stop()}}}function Rb(){return(Rb=e((()=>{Eo(),lo(),Mm(),Ll(),w(),Sr(),np(),Zy(),Nb(),Ib(),lb(),yb()})))()}function zb(e,t={}){let r=Lb(e,_,t),i=(e,n)=>t.connectionBootstrap?.run(e,n)??n(),a={...r.snapshot,approvalQueue:[],approvalBusy:!1,approvalCanGrant:!1,approvalErrors:new Map,devicePairSetupOpen:!1,devicePairSetupLifecycle:{phase:`selection`,access:`full`},devicePairPendingCount:0},o=new Set,s=!1,c=e.snapshot.client,l=null,u=0,d=Jf(e.snapshot),f=0,p=0,m=null,h=ft({client:e.snapshot.client,connected:e.snapshot.phase===`connected`,onChange:()=>_()}),g={client:c,execApprovalQueue:[],execApprovalBusy:!1,execApprovalErrors:new Map,execApprovalExpiryTimers:new Map};function _(){a={...a,...r.snapshot,approvalQueue:g.execApprovalQueue,approvalBusy:g.execApprovalBusy,approvalCanGrant:Jf(e.snapshot).canGrantApprovals,approvalErrors:new Map(g.execApprovalErrors),...Gr(h)};for(let e of o)e(a)}g.execApprovalChanged=_;let v=Gy({gateway:e,state:h,isDisposed:()=>s,publish:_}),y=async e=>{_(),await e,s||(Mt(h,_),_())},b=t=>!s&&c===t&&e.snapshot.client===t&&e.snapshot.phase===`connected`,x=Ky({gateway:e,state:g,getConnectedEpoch:()=>u,getReviewGeneration:()=>f,canReview:()=>d.canReviewApprovals,isCurrentClient:b,isDisposed:()=>s,publish:_}),S=e=>{let t=c,n=e.phase===`connected`,a=n?e.client:null,o=l!==a,s=Wy(d,e);if(d=s.access,s.reviewChanged&&(f+=1),s.grantChanged&&(p+=1),s.grantRevoked){let e=m;e&&g.execApprovalQueue.some(t=>t.id===e.id)&&g.execApprovalErrors.set(e.id,P(`execApproval.reviewOnly`)),m=null,g.execApprovalBusy=!1}if((s.adminRevoked||s.pairingSetupRevoked)&&(Cr(h),v.invalidate({clear:!0})),s.pairingChanged&&v.invalidate({clear:!(d.canAdmin||d.canPair)}),c=e.client,l=a,g.client=e.client,h.client=e.client,h.connected=n,(t!==e.client||!n)&&(m=null,v.invalidate({clear:!0}),Cr(h)),n&&!d.canReviewApprovals&&(m=null),(!n||!e.client||!d.canReviewApprovals)&&(g.execApprovalQueue=[],g.execApprovalBusy=!1,g.execApprovalErrors.clear(),Iy(g)),!n||!e.client){e.phase!==`reload-required`&&!e.client&&(u=0),r.synchronizeGateway(e);return}let _=e.client;r.synchronizeGateway(e),s.pairingChanged&&h.devicePairSetupOpen&&(d.canAdmin||d.canPair)&&i(`pairing-pending-count`,()=>v.refresh()).catch(()=>void 0),o&&(u+=1),(o||s.reviewChanged)&&d.canReviewApprovals&&i(`approvals`,()=>x(_,u,f)).catch(()=>void 0)},C=e.subscribe(S),w=e.subscribeEvents(t=>{if(s)return;if(t.event===`device.pair.setup.completed`){let e=n(t.payload);e&&ue(h,e);return}if(t.event===`device.pair.setup.deliveryUncertain`){let e=nn(t.payload);e&>(h,e);return}if(t.event===`device.pair.requested`||t.event===`device.pair.resolved`){v.refresh();return}if(t.event===`update.available`){r.handleUpdateAvailable(t.payload);return}if(t.event===`update.run.changed`){r.handleUpdateRunChanged(t.payload);return}if(!d.canReviewApprovals||!Jf(e.snapshot).canReviewApprovals)return;let i=Ty(t.event,t.payload);if(i){Ly(g,i),_();return}let a=wy(t.event,t.payload);a&&(zy(g,a.id),_())});return S(e.snapshot),{get snapshot(){return a},subscribe:e=>Ka(o,e),refreshUpdateStatus:r.refreshUpdateStatus,acknowledgeUpdateRun:r.acknowledgeUpdateRun,runUpdate:r.runUpdate,holdUpdate:r.holdUpdate,diagnoseUpdateFailure:r.diagnoseUpdateFailure,reportUpdateFailure:r.reportUpdateFailure,async decideApproval(t,n,r){let i=n?g.execApprovalQueue.find(e=>e.id===n)??(r?.id===n?r:void 0):g.execApprovalQueue[0],a=e.snapshot.client;if(!i||g.execApprovalBusy||s)return;let o=i===r;if(!a||e.snapshot.phase!==`connected`){g.execApprovalErrors.set(i.id,P(`sessionsView.actionRequiresConnection`)),_();return}if(!Jf(e.snapshot).canGrantApprovals){g.execApprovalErrors.set(i.id,P(`execApproval.reviewOnly`)),_();return}g.execApprovalBusy=!0,g.execApprovalErrors.delete(i.id);let l={client:a,epoch:u,accessGeneration:f,grantGeneration:p,id:i.id};m=l;let d=()=>m===l&&l.epoch===u&&l.accessGeneration===f&&l.grantGeneration===p&&Jf(e.snapshot).canGrantApprovals&&b(l.client);_();try{if(await Ey(a,i,t),!d())return;zy(g,i.id)}catch(e){if(Oy(e)){if(!d())return;zy(g,i.id);let e=c,t=u;e&&d()&&await x(e,t);return}d()&&(o||g.execApprovalQueue.some(e=>e.id===i.id))&&g.execApprovalErrors.set(i.id,`Approval failed: ${Qt(e)}`)}finally{m===l&&(m=null,g.execApprovalBusy=!1,_())}},async openDevicePairSetup(){let t=Jf(e.snapshot);if(s||!t.canAdmin&&!t.canPair)return!1;h.pendingCount=0;let n=Ae(h);return v.refresh(),await y(n),h.devicePairSetupOpen},async refreshDevicePairSetup(){!s&&Jf(e.snapshot).canAdmin&&await y(ur(h))},async setDevicePairSetupAccess(t){!s&&Jf(e.snapshot).canAdmin&&await y(kn(h,t))},closeDevicePairSetup(){v.invalidate({clear:!0}),Cr(h),_()},dispose(){s=!0,m=null,r.dispose(),v.invalidate(),Cr(h),C(),w(),Iy(g),g.execApprovalErrors.clear(),o.clear()}}}function Bb(){return(Bb=e((()=>{Jo(),w(),lt(),Sr(),Hy(),np(),qy(),Rb()})))()}function Vb(e,t){return e.phase===`connected`&&Zf(e.hello?.auth??null)&&Bi(e,t)===!0}function Hb(e){return Vb(e,`browser.request`)}function Ub(e){return Hb(e)||zi(e,`browser.dashboard.request`,`operator.sessions.write`)}function Wb(e){return Qd()||Hb(e)}function Gb(e){return Vb(e,`desktop.observe`)}function Kb(e){if(!e)return!1;let t=e.snapshot,n=e.connection.gatewayUrl;if(t.phase===`connected`){let r=zi(t,`chat.history`,`operator.read`)&&zi(t,`chat.send`,`operator.write`);return qb.set(e,{gatewayUrl:n,allowed:r}),r}let r=qb.get(e);return r?.gatewayUrl!==n||t.phase===`reload-required`?(qb.delete(e),!1):r.allowed}var qb;function Jb(){return(Jb=e((()=>{Vi(),np(),qb=new WeakMap})))()}function Yb(e){let t=e.snapshot,n=t.selfUser?.id;return t.phase===`connected`&&n&&e.connection.gatewayUrl?`${sx}${JSON.stringify([q(e.connection.gatewayUrl),n])}`:null}function Xb(e){if(!e)return{};let t=Le();if(!t)return{};try{let n=JSON.parse(t.getItem(e)??`null`),r=uo(n);if(!r)return{};let i={};for(let e of ox){let t=r[e],n=Array.isArray(t)?t.filter(e=>typeof e==`string`):[];n.length>0&&(i[e]=[...new Set(n)])}return i}catch{return{}}}function Zb(e,t){if(!e)return;let n=Le();if(n)try{Object.keys(t).length===0?n.removeItem(e):n.setItem(e,JSON.stringify(t))}catch{}}function Qb(e,t){if(!e)return{};let n=Xb(e),r={...n,[t.kind]:[...new Set([...n[t.kind]??[],t.signature])]};return Zb(e,r),r}function $b(e){return(e.state.phase===`guidance`||e.state.phase===`available`)&&e.scopes?{kind:`scopeUpgrade`,signature:JSON.stringify([e.state.phase,...e.scopes.toSorted()])}:null}function ex(e){let t=e.updateSchedule?.target,n=(t?.kind===`package`?t.version:t?.upstreamSha)??e.updateAvailable?.upstreamSha??e.updateAvailable?.latestVersion,r=e.gatewayBootId?.trim(),i=n?.trim();return r&&i?{kind:`updateAvailable`,signature:JSON.stringify([i,r])}:null}function tx(e){return e===`warn`||e===`danger`}function nx(e,t){return e[t.kind]?.includes(t.signature)===!0}function rx(e,t,n){let r={},i=!1;for(let a of ox){let o=e[a];if(!o)continue;let s=o.filter(e=>!(!n||(a===`modelAuthExpired`?n.modelAuthAgentId&&(!e.startsWith(`agent:`)||e.startsWith(`agent:${n.modelAuthAgentId}\n`)):a!==`cronFailed`&&a!==`cronOverdue`||n.cronInventoryComplete))||t.some(t=>t.kind===a&&t.signature===e));s.length>0&&(r[a]=s),s.length!==o.length&&(i=!0)}return i?r:e}function ix(e){let t=Xb(e.key),n=rx(t,e.active,e.scope);return n!==t&&Zb(e.key,n),n}function ax(e,t){let n=Xb(e);if(!n[t])return n;let r={...n};return delete r[t],Zb(e,r),r}var ox,sx;function cx(){return(cx=e((()=>{ox=[`outbox`,`cronFailed`,`cronOverdue`,`modelAuthExpired`,`scopeUpgrade`,`updateAvailable`],sx=`openclaw.control.sidebarAttention.v2:`})))()}function lx(e){let t=new Set,n=null,r=()=>{for(let e of t)e()},i=()=>{let t=e.gateway.snapshot,r=t.hello?.auth?.scopes;t.phase===`connected`&&r&&!$b({scopes:r,state:e.scopeUpgrade.state})&&ax(Yb(e.gateway),`scopeUpgrade`),n?.syncDismissals()},a=e.gateway.subscribe(i),o=e.scopeUpgrade.subscribe(i);return i(),{get entries(){return n?.entries??[]},activate(t){return n??=new t(e,r),n.mentions},dismiss(e){n?.dismiss(e)},subscribe:e=>Ka(t,e),dispose(){a(),o(),n?.dispose(),n=null,t.clear()}}}function ux(){return(ux=e((()=>{cx()})))()}function dx(){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 fx(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:da({kind:`terminal`},t),search:i?`?${i}`:``,hash:e.hash}}function px(e,t){let n=e,r=!1,i=null,a=null,o=null,s=null,c=null,l=!1,u=null,d=e=>{Object.entries(e).every(([e,t])=>n[e]===t)||(n={...n,...e},r=!0)},f=typeof window>`u`?void 0:window.__OPENCLAW_NATIVE_CONTROL_AUTH__,p=new URLSearchParams(t.hash.replace(/^#/,``)).get(`nativeControlAuth`),m=f??(p?{gatewayUrl:p,nativeConnectAuth:!0}:void 0);if(m){try{delete window.__OPENCLAW_NATIVE_CONTROL_AUTH__}catch{window.__OPENCLAW_NATIVE_CONTROL_AUTH__=void 0}let e=V(m.gatewayUrl),t=V(m.token),r=V(m.password),a=e?og(n.gatewayUrl,e,{token:n.token,password:``}):null,o=m.client,s=va(V(o?.id)),c=xa(V(o?.mode)),l=V(o?.platform),h=V(o?.deviceFamily),g=V(o?.instanceId),_=Wo(o?.scopes);s&&c&&l&&h&&_.length>0&&(u={clientName:s,mode:c,platform:l,deviceFamily:h,...g?{instanceId:g}:{},scopes:_}),m.nativeConnectAuth===!0&&e&&(u={nativeConnectAuth:Zp(e,{messagePort:!f&&!!p})}),d({...e?{gatewayUrl:e}:{},...m.nativeConnectAuth===!0?{token:``}:m.token===null||t?{token:t??``}:a?{token:a.token}:{}}),r&&m.nativeConnectAuth!==!0&&(i=r)}if(!t.search&&!t.hash)return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,queryTokenUsed:l,nativeClient:u,location:t,changed:r};let h=new URL(`${t.pathname}${t.search}${t.hash}`,`http://openclaw.local`),g=new URLSearchParams(h.search),_=new URLSearchParams(h.hash.startsWith(`#`)?h.hash.slice(1):h.hash),v=g.get(`gatewayUrl`)??_.get(`gatewayUrl`),y=V(v)??``,b=!!(y&&y!==n.gatewayUrl),x=g.get(`token`),S=_.get(`token`),C=S!=null||x!=null,w=V(S??x),T=_.has(`bootstrapToken`),E=V(_.get(`bootstrapToken`)),D=_.has(Yo),O=V(_.get(Yo)),ee=Ss(t.pathname,js(t.pathname)),te=!(!w||ee||b),ne=!1;if(g.has(`token`)&&(g.delete(`token`),ne=!0),C&&(x!=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.`)),w&&b?o=w:w&&d({token:w}),_.delete(`token`),ne=!0),T&&(s=E??null,c=E&&O===`owner`?Yi:null,_.delete(`bootstrapToken`),ne=!0),D&&(_.delete(Yo),ne=!0),te&&d({sessionKey:`main`,lastActiveSessionKey:`main`}),(g.has(`password`)||_.has(`password`))&&(g.delete(`password`),_.delete(`password`),ne=!0),v!=null&&(a=b?y:null,(!b||s)&&(o=null),g.delete(`gatewayUrl`),_.delete(`gatewayUrl`),ne=!0),ne){h.search=g.toString();let e=_.toString();h.hash=e?`#${e}`:``}return{settings:n,password:i,pendingGatewayUrl:a,pendingGatewayToken:o,pendingBootstrapToken:s,pendingBootstrapProfile:c,queryTokenUsed:l,nativeClient:u,location:ne?{pathname:h.pathname,search:h.search,hash:h.hash}:t,changed:r}}function mx(){return(mx=e((()=>{xo(),wo(),ja(),Fa(),Y(),$p(),Vg()})))()}function hx(e,t){let n=async()=>{await e.refreshUpdateStatus(`completion`)},r=()=>{let r=e.snapshot;t.setWritesSuspended(r.updateRunning||r.updateReconciliationPending,n)},i=e.subscribe(r);return r(),i}async function gx(e,t,n){try{let{presentUpdateFailureTriage:r}=await W(async()=>{let{presentUpdateFailureTriage:e}=await import(`./update-triage.runtime-TEN2WfyM.js`);return{presentUpdateFailureTriage:e}},__vite__mapDeps([92,1,91,93,77,28]),import.meta.url);r(e,t,n)}catch{n.isCurrent()&&e.navigate(`updates`)}}function _x(){return(_x=e((()=>{K()})))()}function vx(e,t={}){let n=globalThis.navigator,r=!we()||n.standalone===!0,i=r&&`serviceWorker`in n&&`PushManager`in globalThis&&`Notification`in globalThis,a={supported:i,permission:r?i?Notification.permission:`unsupported`:`install-required`,subscription:`unknown`,loading:!1},o=new Set,s=e=>{Object.assign(a,e);for(let e of o)e()},c=a.supported?W(async()=>{let{createWebPushCapabilityRuntime:e}=await import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.Li(),e.Ri));return{createWebPushCapabilityRuntime:e}},__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url).then(({createWebPushCapabilityRuntime:n})=>n({gateway:e,publish:s,connectionBootstrap:t.connectionBootstrap})).catch(e=>(s({supported:!1,permission:`unsupported`,subscription:`unknown`,preferences:null,error:Qt(e)}),null)):null;return{snapshot:a,subscribe:e=>Ka(o,e),run:e=>c?c.then(t=>t?.run(e)):Promise.resolve(),dispose(){c?.then(e=>e?.dispose()),o.clear()}}}function yx(){return(yx=e((()=>{Sr(),K()})))()}function bx(){let e=yc(),t=e.location(),[n,r]=mc(t.pathname||globalThis.location?.pathname||`/`),i=Wm(t.pathname,n),a=lg(),o=i?$h(a):a,s=px(o,t),c=no(s.settings.gatewayUrl)===no(o.gatewayUrl)?null:ig(s.settings.gatewayUrl),l=c?{...s.settings,...c,selectedAgentId:c.selectedAgentId}:s.settings;Ps(s.location,t)||e.replace(s.location),s.changed&&!i&&mg(l);let u=fx(s.location,n);u!==s.location&&e.replace(u);let d=la(u,n),f=i===null&&d===null,p=f&&nr(u,n,ks),m=s.pendingGatewayUrl!==null,h=qv(l,s.password??``,m?``:s.pendingBootstrapToken??``,void 0,{persistDefaultConnectionSettings:i===null,ownsWarmBoot:f,resourceBasePath:r,getModelCatalogTarget:t=>Gg(e.location(),n,t),...!m&&s.pendingBootstrapProfile?{bootstrapProfile:s.pendingBootstrapProfile}:{},...s.nativeClient?{clientOptions:s.nativeClient}:{}}),g=()=>({hello:h.snapshot.hello,settings:{token:h.connection.token},password:h.connection.password}),_=q(`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${r}`),v=I_(r,()=>q(h.connection.gatewayUrl)===_?g():{}),y=sv(),b=Q_(),x=Vp(),S=f&&!m?dp(q(l.gatewayUrl),e=>s.pendingBootstrapToken||s.password?null:[`trusted-proxy`,`tailscale`,`password`].includes(e)?l.token.trim()?null:``:e===`token`?l.token:l.token.trim()?null:hn(l.gatewayUrl)):null,C=S!==null&&f&&!m,w=h.connectionRevision;C&&S&&h_(S,l.sessionKey);let T=f?__(h,S,()=>{C=!1}):void 0,E=M(h),D=dx(),O=Mn(l.sessionKey),ee=p&&!O,te=null,ne=ee?new Promise(e=>{te=e}):null,k=Kg({fallback:u,signal:D.signal,resolve:()=>i||d?Promise.resolve(u):qg({location:u,basePath:n,sessionKey:l.sessionKey,gateway:h,agentsList:()=>E.state.agentsList,ensureAgentsList:()=>E.ensureList(),selectedAgentId:l.selectedAgentId,signal:D.signal})}),A=p&&O?Wg(u,n,l.sessionKey,O.agentId):u,re=p?Promise.resolve(A):k(),ie=Vr(h),j=p_(l,h),ae=ld(h,E,f?{load:e=>ig(e).selectedAgentId??null,save:(e,t)=>{h.connection.gatewayUrl===e&&fg({selectedAgentId:t??void 0})}}:void 0,{get settings(){return j.settings},subscribe:j.subscribe,patch:fg}),oe=ld(h,E,void 0,void 0,{requireConfiguredAgent:!0}),se=Ln(h),ce=Jg({router:x,chatSubmissions:b,gateway:h,agents:E,agentSelection:ae,connectionBootstrap:y,initialChatRoute:f&&go(u.pathname,n)?.namespace===`chat`}),le=fv(h),ue=iv({resourceBasePath:r,getAuth:g}),de=It(h,ae,{bootRecord:S,connectionBootstrap:y}),fe=f?v_({gateway:h,agents:E,sessions:de},S):void 0,me=pe(h),he=zb(h,{connectionBootstrap:y,getActiveSessionKey:()=>h.snapshot.sessionKey||void 0,drainConfigWrites:()=>me.waitForPendingWrites(),onUpdateFailure:(e,t)=>void gx(We,e,t)}),ge=lx({gateway:h,agentSelection:ae,agents:E,overlays:he,scopeUpgrade:le,connectionBootstrap:y}),_e=hx(he,me),ve=Xg(j),ye=ay(),be=()=>j.settings.openLinksExternally===!0,xe=ty({navigate:(e,t)=>We.navigate(e,t)}),Se=Qv(()=>h.snapshot,{shouldOpenExternally:be}),Ce=hy({shouldOpenExternally:be,signal:D.signal,canPresentBrowserPanel:()=>{let e=document.querySelector(`openclaw-app-shell`);return e?.isConnected===!0&&!Lc(e.routeState.routeId)},onNativeUpdateDeclined:()=>{let e=he.snapshot,t=e.updateSchedule?.campaign,n=e.updateRunning||e.updateReconciliationPending||t?.state===`applying`;(e.updateAvailable||t)&&!n&&!e.controlUiRefreshRequired&&he.runUpdate()},shouldOpenInControlUiBrowser:()=>lg().openLinksInControlUiBrowser===!0&&Hb(h.snapshot)&&document.querySelector(`openclaw-app-shell`)?.isConnected===!0}),we=null,Te=null,Ee=vx(h,{connectionBootstrap:y}),De=G_({gateway:h,sessions:de,chatSubmissions:b}),Oe=q_(h),ke=!1,Ae=null,je=s.pendingGatewayUrl===null?null:{gatewayUrl:s.pendingGatewayUrl,token:s.pendingGatewayToken,bootstrapToken:s.pendingBootstrapToken??``,...s.pendingBootstrapProfile?{bootstrapProfile:s.pendingBootstrapProfile}:{}},Me=null,Ne=null,Pe=!!(m||s.nativeClient||s.pendingBootstrapToken),Fe=h.connectionRevision,Ie=h.subscribe(e=>{if(e.phase===`connected`&&(Pe=!0),!Pe&&e.phase===`stopped`&&(e.lastErrorCode===ho.AUTH_TOKEN_MISSING||e.lastErrorCode===ho.AUTH_PASSWORD_MISSING)&&(Pe=!0,D.trackDisposer(W(async()=>{let{startBrowserBootstrapRecovery:e}=await import(`./browser-bootstrap.runtime-B2AJy4aH.js`);return{startBrowserBootstrapRecovery:e}},__vite__mapDeps([94,1,95,2,3,4,5,6,7,8,9,28]),import.meta.url).then(({startBrowserBootstrapRecovery:t})=>h.snapshot.client===e.client&&h.connectionRevision===Fe&&!D.signal.aborted?t(h,n):()=>{}),()=>{})),e.phase!==`connected`||!e.client){Me=null,Ne=null;return}let t=e.client;Me!==t&&(Me=t,y.run(`config`,()=>ue.refresh()),y.run(`session-observer`,()=>Et(t,yi()!==`off`))),t.recoveryScopeReady&&Ne!==t&&(Ne=t,De.resumeRecovery())}),Le=(e,t)=>{let r=Ms(e,n),i=x.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?{...r,pathname:t?.pathname??a??r.pathname,search:t?.search??``,hash:t?.hash??``}:r},Re=()=>{let e=je;if(!e)return;je=null;let t=og(h.connection.gatewayUrl,e.gatewayUrl,h.connection);h.connect({gatewayUrl:e.gatewayUrl,token:e.bootstrapToken?``:e.token??t.token,password:t.password,bootstrapToken:e.bootstrapToken,bootstrapProfile:e.bootstrapProfile})},ze=()=>{je=null},Be=(t,n,r)=>{let i=Le(t,n);ke||(Ae={location:i,mode:r});let a=ke&&Ps(e.location(),i)?`replace`:r,o=x.navigate(t,We,{history:a},i);return o.catch(e=>{console.error(`[openclaw] route navigation failed`,e)}),o},Ve=(e,t)=>Be(e,t,`push`),He=new Yt(()=>We),Ue=null,We={basePath:n,resourceBasePath:r,lifecycleAbortSignal:D.signal,router:x,gateway:h,connectionBootstrap:y,agents:E,get offlineSessionDefaults(){return C&&h.connectionRevision===w?fe?.readSessionDefaults()??null:null},agentIdentity:ie,agentSelection:ae,settingsAgentSelection:oe,channels:se,config:ue,scopeUpgrade:le,sidebarAttention:ge,runtimeConfig:me,sessions:de,placementStartup:De,plugins:He,assistantDock:new Km,overlays:he,navigation:ve,theme:j,nativeChatDrafts:ye,get nativeConversation(){return Ue},get nativeDeviceSettings(){return we},get nativeNotifications(){return Te},webPush:Ee,chatSubmissions:b,chatAttachmentHandoff:Oe,navigate:(e,t)=>{Ve(e,t)},navigateAndWait:Ve,replace:(e,t)=>{Be(e,t,`replace`)},revalidate:e=>x.revalidate(We,e),preload:e=>x.preloadLocation(Ms(e,n),We)};return{context:We,router:x,documentMode:i,get warmBoot(){return C&&h.connectionRevision===w},focusLocation:d,get pendingGatewayConnection(){return je},confirmPendingGatewayConnection:Re,cancelPendingGatewayConnection:ze,start:()=>{let t=()=>x.stop();f&&D.addDisposer(t);let r=[()=>(h.start(),()=>h.stop()),()=>mv(h,document,window),()=>gv(h,document),()=>(He.start(),()=>He.dispose())];return f&&!p&&r.unshift(()=>zp(x,u,n)),window.webkit?.messageHandlers&&r.unshift(async()=>{let{startNativeCapabilities:e}=await W(async()=>{let{startNativeCapabilities:e}=await import(`./native-startup.runtime-DBKID_wJ.js`);return{startNativeCapabilities:e}},__vite__mapDeps([96,1,28]),import.meta.url);return e(We,D,e=>{Ue=e.conversation,we=e.deviceSettings,Te=e.notifications})}),r.push(()=>Cn({context:We,enabled:p,history:e,initialLocationReady:re,...ee?{redirect:()=>e.replace({...Ms(`model-setup`,n),search:`?firstRun=1`}),onInitialDecision:()=>te?.()}:{}})),r.push(()=>{ue.refresh({skipWithoutAuthCandidate:!0})}),f&&(ne&&r.push(()=>ne),r.push(async()=>{let r=Ae;return Ae=null,ke=!0,r&&e[r.mode](r.location),await Gp(x,e,n,We),t})),p&&r.push(()=>{D.trackDisposer(Cn({context:We,enabled:!1,history:e,initialLocationReady:k(),installLocation:async t=>{let r=ks(t.pathname,n);r?await x.navigate(r,We,{history:`replace`},t):e.replace(t)},shouldInstallLocation:()=>O?Ps(e.location(),A):nr(e.location(),n,ks)}),e=>{console.error(`[openclaw] initial session location failed`,e)})}),D.run(r)},stop:()=>{v(),D.stop(),T?.(),fe?.dispose(),Ie(),ce(),y.reset(),E.dispose(),ae.dispose(),oe.dispose(),se.dispose(),le.dispose(),ge.dispose(),De.dispose(),de.dispose(),_e(),me.dispose(),he.dispose(),j.dispose(),ye.dispose(),Se.dispose(),xe.dispose(),Ce.dispose(),Ee.dispose(),b.clear(),Oe.dispose()}}}function xx(){return(xx=e((()=>{ja(),Zo(),rl(),Y(),qp(),Jp(),Dr(),he(),jn(),Tr(),xn(),fi(),Be(),ei(),yr(),cn(),ud(),Gm(),qm(),Ep(),Yg(),Zg(),m_(),y_(),L_(),bc(),X_(),$_(),ov(),lv(),pv(),hv(),bv(),Yv(),$v(),ny(),yy(),Bb(),Jb(),K_(),Vg(),ux(),mx(),_x(),yx(),K()})))()}function Sx(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLTextAreaElement?!e.readOnly&&!e.disabled:e instanceof HTMLInputElement?!e.readOnly&&!e.disabled&&![`button`,`checkbox`,`color`,`file`,`hidden`,`image`,`radio`,`range`,`reset`,`submit`].includes(e.type):e instanceof HTMLElement&&e.isContentEditable}function Cx(){let e=window.visualViewport;if(!e)return()=>{};let t=document.documentElement,n=new AbortController,r=null,i=null,a=t.clientWidth||window.innerWidth,o=()=>{r=null;let n=t.clientHeight||window.innerHeight,o=t.clientWidth||window.innerWidth,s=Sx();(a!==o||!s)&&(i=null),a=o,s&&(i??=Math.max(n,e.height));let c=e.scale===1;c&&s&&Math.max(n,i??0)-e.height>=wx?t.style.setProperty(`--shell-safe-area-bottom`,`0px`):t.style.removeProperty(`--shell-safe-area-bottom`),c?t.style.setProperty(`--shell-viewport-height`,String(Math.max(0,e.height+e.offsetTop))+`px`):t.style.removeProperty(`--shell-viewport-height`)},s=()=>{r??=requestAnimationFrame(o)},c={signal:n.signal};return e.addEventListener(`resize`,s,c),e.addEventListener(`scroll`,s,c),window.addEventListener(`resize`,s,c),window.addEventListener(`orientationchange`,s,c),document.addEventListener(`focusin`,()=>{Sx()&&(i??=e.height),s()},c),document.addEventListener(`focusout`,s,c),o(),()=>{n.abort(),r!==null&&cancelAnimationFrame(r),t.style.removeProperty(`--shell-viewport-height`),t.style.removeProperty(`--shell-safe-area-bottom`)}}var wx;function Tx(){return(Tx=e((()=>{wx=80})))()}function Ex(e){return`${e.pathname}${e.search}${e.hash}`}function Dx(e){return`type`in e&&e.type===`notFound`}var Ox;function kx(){return(kx=e((()=>{Hi(),ja(),L(),Li(),vf(),Uf(),Nd(),Td(),Kf(),w(),Sr(),Be(),Vn(),qe(),s(),xx(),ad(),ju(),$v(),fc(),Jb(),Vg(),Tx(),K(),Ox=class extends g{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.startupPending=!1,this.loginGatePinned=!1,this.loginGatewayUrl=``,this.loginToken=``,this.loginPassword=``,this.loginShowGatewaySecret=!1,this.pendingGatewayUrl=null,this.onboarding=jp(globalThis.location?.search??``),this.focusDashboardRoute={kind:`loading`},this.contextProvider=new ka(this,{context:id}),this.subscriptions=new In(this),this.loginGatewaySource=null,this.loginConnectionClient=null,this.focusDashboardAbort=null,this.loginGateLoader=new du(this),this.lazyCustomElements=new du(this,()=>this.closeDocument(this.context?.basePath??``)),this.subscriptions.watchStore(()=>this.context?.gateway,e=>this.synchronizeGateway(e)).watchStore(()=>this.terminalOnly?this.context?.config:void 0).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.terminalOnly?this.context?.theme:void 0).watchStore(()=>this.context?.router).effect(()=>this.ownerDocument,Gf)}connectedCallback(){super.connectedCallback(),this.disconnectViewport?.(),this.disconnectViewport=Cx();let e=cc();this.ownerDocument.documentElement.classList.toggle(`openclaw-native-embed`,e!==null),this.toggleAttribute(`data-native-titlebar`,e?.platform===`macos`&&e.formFactor===`desktop`&&e.surface===`conversation`),e&&W(()=>Promise.resolve({}),__vite__mapDeps([97]),import.meta.url),W(()=>import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.g(),e._)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url),this.resetLoginSensitivePresentation(),this.runtime=bx();let t=this.runtime;this.startupPending=!0;let n=this.focusTarget;n&&this.requestLazyDocument({terminal:bu,desktop:Cu,browser:Su,dashboard:Tu}[n.kind]),this.runtime.documentMode?.kind===`approval`&&this.requestLazyDocument(Eu),this.runtime.documentMode?.kind===`question`&&this.requestLazyDocument(Ou);let r=this.runtime.context;this.pendingGatewayUrl=this.runtime.pendingGatewayConnection?.gatewayUrl??null,this.contextProvider.setValue(r),this.syncLoginConnection(),this.requestUpdate(),t.start().finally(()=>{this.runtime===t&&(this.startupPending=!1)}).then(()=>this.resolveFocusDashboard()).catch(e=>{console.error(`[openclaw] application start failed`,e)})}disconnectedCallback(){this.subscriptions.clear(),this.disconnectViewport?.(),this.disconnectViewport=void 0,this.focusDashboardAbort?.abort(),this.focusDashboardAbort=null,this.lazyCustomElements.abandon(),this.loginGateLoader.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.loginShowGatewaySecret=!1}updateLoginGatewayUrl(e){let t=og(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 sc()?I:F`<button
class="btn btn--ghost"
type="button"
@click=${()=>this.closeDocument(this.context?.basePath??``)}
>
${e}
</button>`}requestLazyDocument(e){lu(e)||this.lazyCustomElements.request(e)}renderLazyDocumentState(e){let t=this.lazyCustomElements.visibleState;return!t||t.element!==e?I:F`<main class="connect-splash">
${kd(t,()=>this.lazyCustomElements.retry(),()=>this.lazyCustomElements.close())}
</main>`}renderApprovalDocument(e){if(this.lazyCustomElements.visibleState?.element===Eu)return this.renderLazyDocumentState(Eu);let t=e.documentMode?.kind===`approval`?e.documentMode.approvalId:``;return F`<openclaw-approval-page .approvalId=${t??``}></openclaw-approval-page>`}renderQuestionDocument(e){if(this.lazyCustomElements.visibleState?.element===Ou)return this.renderLazyDocumentState(Ou);let t=e.documentMode?.kind===`question`?e.documentMode.questionId:``;return F`<openclaw-question-page .questionId=${t??``}></openclaw-question-page>`}replaceFocusDashboardLocation(e,t){let n=this.context?.basePath??``,r=da({kind:`dashboard`,path:Ex(t)},n),i=da({kind:`dashboard`,path:Ex(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 W(async()=>{let{loadChatRoute:e}=await import(`./control-ui-boot-chat-XcDaYmck.js`).then(e=>(e.t(),e.n));return{loadChatRoute:e}},__vite__mapDeps([54,1,3,2,4,5,8,7,6,9,10,11,12,13,14,15,18,53,17,16,19,20,28,29,30,31,32,33,34,56]),import.meta.url),i=await e(t,r,`dashboard`,n.signal);if(n.signal.aborted||this.focusDashboardAbort!==n)return;if(Dx(i)||i.kind===`missing-session`){this.focusDashboardRoute={kind:`not-found`};return}if(i.kind===`route-error`){this.focusDashboardRoute={kind:`error`,message:i.message};return}if(i.kind===`ambiguous`){this.focusDashboardRoute={kind:`ambiguous`,data:{...i,candidates:i.candidates.map(e=>({...e,href:da({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:Qt(e)})}}renderFocusDashboard(e,t,n){let r=this.focusDashboardRoute;return r.kind===`loading`?wd(n):r.kind===`not-found`?F`<main class="board-document">
<section class="board-document__state stack" role="status">
<span>${P(`dashboardDocument.notFound`)}</span>
${this.renderFocusEscape(P(`dashboardDocument.close`))}
</section>
</main>`:r.kind===`error`?F`<main class="board-document">
<section class="board-document__state board-document__state--error stack" role="alert">
<span>${P(`dashboardDocument.loadFailed`,{error:r.message})}</span>
${this.renderFocusEscape(P(`dashboardDocument.close`))}
</section>
</main>`:r.kind===`ambiguous`?F`<main class="board-document">
<section class="card board-document__state">
<h2>${P(`chat.sessionRoute.chooseTitle`)}</h2>
<p>
${r.data.candidates.length>1?P(`chat.sessionRoute.multipleMatches`,{shortId:r.data.shortId}):P(`chat.sessionRoute.additionalMatches`)}
</p>
${r.data.candidates.map(e=>F`<p>
<a href=${e.href}>${e.displayName}</a><br />
<small>${e.agentId} · ${e.idPrefix}</small>
</p>`)}
${r.data.truncated?F`<p><small>${P(`chat.sessionRoute.additionalMatches`)}</small></p>`:I}
${this.renderFocusEscape(P(`dashboardDocument.close`))}
</section>
</main>`:F`
<openclaw-board-document
.gatewaySnapshot=${e}
.sessions=${this.context?.sessions}
.sessionKey=${r.data.sessionKey}
.preparedSession=${r.data.agentId?{sessionKey:r.data.sessionKey,agentId:r.data.agentId}:null}
.onDocumentClose=${sc()?null:()=>this.closeDocument(this.context?.basePath??``)}
></openclaw-board-document>
${!t&&e.lastError===null?wd(n):I}
${t?this.renderLazyDocumentState(Tu):I}
`}render(){let e=this.context,t=this.runtime;if(!e||!t)return F`<main class="app-shell app-shell--booting" aria-busy="true"></main>`;let n=this.pendingGatewayUrl?F`
<openclaw-gateway-url-confirmation
.props=${{pendingGatewayUrl:this.pendingGatewayUrl,currentGatewayUrl:t.context.gateway.connection.gatewayUrl,linkCarriesToken:!!t.pendingGatewayConnection?.token,onConfirm:()=>{t.confirmPendingGatewayConnection(),this.pendingGatewayUrl=null},onCancel:()=>{t.cancelPendingGatewayConnection(),this.pendingGatewayUrl=null}}}
></openclaw-gateway-url-confirmation>
`:I;return F`<openclaw-tooltip-provider>
${this.renderDocument(e,t)} ${n}
</openclaw-tooltip-provider>`}renderDocument(e,t){let n=e.gateway.snapshot,r=n.phase===`connected`,i=n.phase===`starting`?P(`common.gatewayStarting`):void 0;if(t.focusLocation?.status===`unsupported`)return F`<main class="connect-splash" role="alert">
<div class="stack">
<span class="connect-splash__status">${P(`focus.unsupported`)}</span>
${this.renderFocusEscape(P(`common.back`))}
</div>
</main>`;let a=this.focusTarget;if(a?.kind===`browser`)return F`
<openclaw-browser-document
.props=${{context:e,target:a,renderEscape:e=>this.renderFocusEscape(e)}}
></openclaw-browser-document>
${this.renderLazyDocumentState(Su)}
`;if(a?.kind===`terminal`){let t=c(n,e.config.current.terminalEnabled??!1),a=e.agentSelection.state.selectedId??n.assistantAgentId,o=a?G(a):null;return F`
<openclaw-terminal-panel
.client=${r?n.client:null}
.available=${t}
.agentId=${o}
.themeMode=${e.theme.resolvedMode}
fullscreen
></openclaw-terminal-panel>
${!r&&n.lastError===null?wd(i):I}
${t?this.renderLazyDocumentState(bu):I}
${!t&&(r||n.lastError)?F`<div class="terminal-view-unavailable">
<div class="stack">
<span>${P(`terminal.unavailable`)}</span>
${this.renderFocusEscape(P(`common.back`))}
</div>
</div>`:I}
`}if(a?.kind===`desktop`){let t=Gb(n),o=a.selector?.kind===`source`?a.selector.value:null,s=a.selector?.kind===`session`?a.selector.value:null;return F`
<openclaw-desktop-panel
.client=${r?n.client:null}
.sessions=${e.sessions}
.available=${t}
.documentMode=${!0}
.requestedSource=${o}
.sessionKey=${s}
.documentControl=${a.control}
.onDocumentClose=${()=>this.closeDocument(e.basePath)}
></openclaw-desktop-panel>
${!r&&n.lastError===null?wd(i):I}
${t?this.renderLazyDocumentState(Cu):I}
${!t&&(r||n.lastError)?F`<div class="desktop-view-unavailable">
<div class="stack">
<span>${P(`desktop.unavailable`)}</span>
${this.renderFocusEscape(P(`common.back`))}
</div>
</div>`:I}
`}if(a?.kind===`dashboard`)return this.renderFocusDashboard(n,r,i);let o=t.documentMode===null&&n.lastError===null&&(this.startupPending&&n.phase===`stopped`||n.phase===`starting`||n.phase===`connecting`&&!this.loginGatePinned),s=t.documentMode===null&&t.warmBoot&&!this.loginGatePinned&&(o||n.phase===`connecting`&&!n.lastErrorAuthReason&&(n.lastErrorCode===null||n.lastErrorCode===`GATEWAY_BUSY`));if(o&&!s)return wd(i);let l=e.router.getState(),u=(l.pendingMatches[0]??l.matches[0])?.routeId===`connection`&&(e.gateway.hasStoredDeviceToken?.()??!1)||n.phase===`reconnecting`||n.phase===`reload-required`||s,d=!r&&!u;if(d&&!lu(Au)){let e=this.loginGateLoader.visibleState;return e||this.loginGateLoader.preload(Au,{reportError:!0}),e?.status===`error`?jd({error:e.error,stale:e.stale,onRetry:()=>this.loginGateLoader.retry()}):wd()}return d?F`
<openclaw-login-gate
.props=${{resourceBasePath:e.resourceBasePath,mascot:e.theme.branding.mascot,connected:r,lastError:n.lastError,reconnectAt:n.reconnectAt,reconnectPending:n.lastError!==null&&(n.phase===`connecting`||n.phase===`reconnecting`),lastErrorCode:n.lastErrorCode,lastErrorAuthReason:n.lastErrorAuthReason,hasToken:!!this.loginToken.trim(),hasPassword:!!this.loginPassword.trim(),gatewayUrl:this.loginGatewayUrl,secret:this.loginToken||this.loginPassword,showGatewaySecret:this.loginShowGatewaySecret,onGatewayUrlChange:e=>{this.updateLoginGatewayUrl(e)},onSecretChange:e=>{this.loginToken=e,this.loginPassword=``},onToggleGatewaySecret:()=>{this.loginShowGatewaySecret=!this.loginShowGatewaySecret},onOpenGatewaySettings:e.gateway.hasStoredDeviceToken?.()?()=>e.navigate(`connection`):void 0,onConnect:()=>{this.loginGatePinned=!0,e.gateway.connect({gatewayUrl:this.loginGatewayUrl,token:this.loginToken,password:this.loginPassword})}}}
></openclaw-login-gate>
`:t.documentMode?.kind===`approval`?this.pendingGatewayUrl?I:this.renderApprovalDocument(t):t.documentMode?.kind===`question`?this.renderQuestionDocument(t):F`
<openclaw-link-reader-hovercard-provider
.client=${r?n.client:null}
.readers=${Zv(n)}
.claimedReaders=${Xv(n)}
.pagePreviewContext=${e}
.agentId=${e.agentSelection.state.selectedId??n.assistantAgentId??void 0}
>
<openclaw-session-progress-hovercard-provider
.client=${n.client}
.context=${e}
.gateway=${e.gateway}
>
<openclaw-app-shell
.runtime=${t}
.onboarding=${this.onboarding}
></openclaw-app-shell>
</openclaw-session-progress-hovercard-provider>
</openclaw-link-reader-hovercard-provider>
`}},U([R()],Ox.prototype,`startupPending`,void 0),U([R()],Ox.prototype,`loginGatePinned`,void 0),U([R()],Ox.prototype,`loginGatewayUrl`,void 0),U([R()],Ox.prototype,`loginToken`,void 0),U([R()],Ox.prototype,`loginPassword`,void 0),U([R()],Ox.prototype,`loginShowGatewaySecret`,void 0),U([R()],Ox.prototype,`pendingGatewayUrl`,void 0),U([R()],Ox.prototype,`onboarding`,void 0),U([R()],Ox.prototype,`focusDashboardRoute`,void 0)})))()}function Ax(e){let t=e instanceof CustomEvent?e.detail:void 0,n=t&&typeof t==`object`&&`trigger`in t?t.trigger:null;return n instanceof HTMLElement?n:void 0}function jx(e){return hi(N.commandPalette,e)}function Mx(e){return typeof e==`object`&&!!e&&`owner`in e&&e.owner instanceof Element&&`onSlashCommand`in e&&(e.onSlashCommand===null||typeof e.onSlashCommand==`function`)}function Nx(e,t){let n=t instanceof CustomEvent?t.detail:void 0;Mx(n)&&(e.commandPaletteTarget=n.onSlashCommand?n:e.commandPaletteTarget?.owner===n.owner?void 0:e.commandPaletteTarget,e.requestUpdate())}var Px,Fx,Ix,Lx;function Rx(){return(Rx=e((()=>{zt(),Px=`--openclaw-modal-width: min(740px, calc(100vw - 32px));`,Fx=`openclaw-command-palette-target`,Ix=`openclaw:command-palette-open`,Lx=`openclaw:shell-nav-drawer-toggle`})))()}function zx(e){let t=e.closest(`.cmd-palette__entry`),n=e.scrollHeight-e.clientHeight;t?.toggleAttribute(`data-scroll-fade-top`,n>1&&e.scrollTop>1),t?.toggleAttribute(`data-scroll-fade-bottom`,n>1&&e.scrollTop<n-1)}function Bx(e,t=!1){let n=e.closest(`.cmd-palette__entry`),r=n?.querySelector(`.cmd-palette__input-actions`);n&&r&&n.style.setProperty(`--cmd-palette-actions-width`,`${r.getBoundingClientRect().width}px`);let i=Number.parseFloat(getComputedStyle(e).lineHeight);if(!Number.isFinite(i)||i<=0)return;let a=e.scrollTop,o=t&&document.activeElement===e&&e.selectionStart===e.selectionEnd&&e.selectionEnd===e.value.length;e.style.overflowY=`hidden`,e.style.height=`0px`,e.style.height=`${Math.max(i,Math.min(i*3,e.scrollHeight))}px`;let s=e.scrollHeight>e.clientHeight+1;e.style.overflowY=s?`auto`:`hidden`,e.scrollTop=s?o?e.scrollHeight:a:0,zx(e),Wx.set(e,e.value)}function Vx(e){let t=e.currentTarget;t instanceof HTMLTextAreaElement&&t.isConnected&&zx(t)}function Hx(e){return F`
<div class="cmd-palette__entry">
<div class="cmd-palette__input-scroll">
<textarea
${Kx(e.value,e.placeholder)}
autofocus
rows="1"
id=${Ux}
class="cmd-palette__input"
aria-label=${e.placeholder}
aria-autocomplete=${e.controls?`list`:I}
aria-haspopup=${e.controls?`listbox`:I}
aria-controls=${e.controls??I}
aria-activedescendant=${e.activeDescendant??I}
aria-describedby=${e.describedBy??I}
placeholder=${e.placeholder}
.value=${e.value}
?disabled=${e.disabled}
?readonly=${e.readOnly}
@scroll=${Vx}
@paste=${e.onPaste??I}
@beforeinput=${e.onBeforeInput??I}
@select=${e.onSelectionChange??I}
@pointerup=${e.onSelectionChange??I}
@keyup=${t=>{(t.key.startsWith(`Arrow`)||t.key===`Home`||t.key===`End`)&&e.onSelectionChange?.(t)}}
@compositionstart=${e.onCompositionStart??I}
@compositionend=${e.onCompositionEnd??I}
${Di(e.onInputRef)}
@input=${t=>{t.currentTarget instanceof HTMLTextAreaElement&&(e.onValueChange(t.currentTarget.value,t),Bx(t.currentTarget,!0))}}
></textarea>
</div>
<div class="cmd-palette__input-actions">${e.actions??I}</div>
</div>
`}var Ux,Wx,Gx,Kx;function qx(){return(qx=e((()=>{L(),Fi(),Ei(),ki(),Ux=`cmd-palette-input`,Wx=new WeakMap,Gx=class extends Oi{#e;#t;#n;#r;render(e,t){return I}update(e,[t,n]){let r=e.element instanceof HTMLTextAreaElement?e.element:void 0,i=r&&(this.#e!==r||this.#t!==n||Wx.get(r)!==t);return this.#e=r,this.#t=n,i&&this.#i(),I}#i=()=>{this.#r===void 0&&(this.#r=requestAnimationFrame(()=>{this.#r=void 0;let e=this.#e;if(this.isConnected&&e?.isConnected){if(!this.#n&&typeof ResizeObserver==`function`){this.#n=new ResizeObserver(this.#i);let t=e.closest(`.cmd-palette__entry`);if(t){this.#n.observe(t);let e=t.querySelector(`.cmd-palette__input-actions`);e&&this.#n.observe(e)}}Bx(e)}}))};disconnected(){this.#n?.disconnect(),this.#n=void 0,this.#r!==void 0&&(cancelAnimationFrame(this.#r),this.#r=void 0)}reconnected(){this.#i()}},Kx=ji(Gx)})))()}function Jx(e,t){let n=t instanceof CustomEvent?t.detail:null;return H(n)?{eventType:e,detail:n}:{eventType:e}}function Yx(){try{let e=Ti()?.getItem(Qx),t=e?JSON.parse(e):null;if(!H(t)||!Object.hasOwn(t,`eventType`))return Zx(),null;let n=Object.keys(t).length,r=eS.find(e=>e===t.eventType);if(r&&n===1)return{eventType:r};let i=t.detail;if(r&&n===2&&Object.hasOwn(t,`detail`)&&H(i))return{eventType:r,detail:i}}catch{}return Zx(),null}function Xx(e){try{let t=Ti();return t?(t.setItem(Qx,JSON.stringify(e)),!0):!1}catch{}return Zx(),!1}function Zx(){try{Ti()?.removeItem(Qx)}catch{}}var Qx,$x,eS;function tS(){return(tS=e((()=>{Rx(),Jd(),Qx=`openclaw:lazy-event`,$x=`openclaw:approvals-open`,eS=[Ix,Ud,Wd,Id,Rd,Gd,zd,Hd,Vd,$x]})))()}function nS(e,t){let n=P(`palette.placeholder`);return F`<openclaw-modal-dialog
class="cmd-palette-overlay palette"
label=${n}
style=${Px}
@modal-cancel=${t}
>
<div
class="cmd-palette"
aria-busy="true"
@compositionstart=${e.handleCompositionStart}
@compositionend=${e.handleCompositionEnd}
@keydown=${e.handleKeydown}
>
${Hx({value:e.value,placeholder:n,onInputRef:e.inputRef,onValueChange:e.captureInput,onPaste:e.handlePaste,readOnly:e.submitRequested})}
<div class="cmd-palette__empty" role="status">${P(`common.loading`)}</div>
</div>
</openclaw-modal-dialog>`}var rS,iS;function aS(){return(aS=e((()=>{L(),Rx(),qx(),w(),zt(),Xn(),Zn(),Ap(),tS(),rS=class{#e;#t;#n;constructor(e,t){this.open=()=>{let e=this.#t.commandPalette,t=Jx(Ix);if(e){this.loading.handoff(()=>{if(this.loading.active){let t=this.loading.captureHandoff();e.openPalette(()=>(this.synchronizeScope(),t()))}else e.openPalette();this.#n.clear(t)});return}this.synchronizeScope(),this.loading.begin(),this.#n.request(this.#t.commandPaletteElement,t,this.open)},this.#t=e,this.#n=t,this.loading=new iS(e)}closePending(){this.#n.cancel(),this.#t.lazyCustomElements.abandon(),this.#t.requestUpdate()}synchronizeScope(){let e=this.#t.context?.gateway,t=e?Dp(e):void 0;this.#e&&this.#e!==t&&(this.loading.active||this.#n.pending())&&this.closePending(),this.#e=t}toggle(){this.loading.active||this.#t.lazyCustomElements.visibleState?.element===this.#t.commandPaletteElement?this.closePending():this.#t.commandPalette?this.#t.commandPalette.togglePalette():this.open()}handleSlashCommand(e){let t=this.#t,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()}`})}handlePendingShortcut(e){return e.defaultPrevented||e.isComposing||e.keyCode===229||!this.loading.active||!jx(e)?!1:(e.preventDefault(),this.toggle(),!0)}},iS=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e){this.submitRequested=!1,this.#t=[],this.#a=!1,this.#c=!1,this.#l=0,this.captureInput=(e,t)=>{if(!this.active||!this.#r)return;let n=this.#r;if(!this.#a&&!t?.isComposing&&t?.inputType===`insertText`&&t.data?.includes(`@`))this.#n=n.selectionStart-t.data.length+t.data.lastIndexOf(`@`);else if(this.#n!==void 0){let e=this.#n+1;(t?.inputType===`insertFromPaste`||t?.inputType===`insertFromDrop`||this.#e?.value.slice(0,e)!==n.value.slice(0,e))&&(this.#n=void 0)}this.#e=this.#d(),this.#u.requestUpdate()},this.inputRef=e=>{if(!(e instanceof HTMLTextAreaElement)){this.active&&this.#r&&(this.#e=this.#d()),this.#r=void 0;return}if(!this.active)return;this.#r=e;let t=this.#e;e.closest(`openclaw-modal-dialog`)?.setReturnFocusTarget(this.#i??null),t&&!this.#a&&e.setSelectionRange(t.selectionStart,t.selectionEnd,t.selectionDirection)},this.handleCompositionStart=()=>{this.active&&(this.#a=!0,this.#n=void 0,this.#s!==void 0&&(cancelAnimationFrame(this.#s),this.#s=void 0))},this.handleCompositionEnd=()=>{this.active&&(this.#a=!1,this.#s!==void 0&&cancelAnimationFrame(this.#s),this.#s=requestAnimationFrame(()=>{this.#s=void 0;let e=this.#o;this.#o=void 0,e?.()}))},this.handlePaste=e=>{if(!this.active||this.submitRequested)return;let t=Array.from(e.clipboardData?.items??[],e=>e.getAsFile()).filter(e=>e?.type.startsWith(`image/`)===!0);if(t.length){if(e.preventDefault(),!fn(this.#u.context?.config)){Xr({message:vn()});return}this.#t.push(...t)}},this.handleKeydown=e=>{if(this.#a||e.isComposing||e.keyCode===229){e.stopPropagation();return}e.key===`Enter`&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),e.stopPropagation(),!e.repeat&&(this.value.trim()||this.#t.length>0)&&hi(N.modifiedEnter,e)&&(this.submitRequested=!0,this.#u.requestUpdate()))},this.#u=e}get active(){return this.#i!==void 0}get waitingForComposition(){return this.#c}begin(){this.active||(this.#i=document.activeElement instanceof HTMLElement?document.activeElement:null)}get value(){return this.#e?.value??``}#d(){let e=this.#r;return e?{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,selectionDirection:e.selectionDirection}:this.#e}handoff(e){this.#a||this.#s!==void 0?(this.#c=!0,this.#o=e):e()}captureHandoff(){let e=this.#l;return()=>e===this.#l?this.#f():void 0}#f(){if(!this.active)return;let e=this.#d()??{value:``,selectionStart:0,selectionEnd:0,selectionDirection:`none`},t=this.#i,n=this.submitRequested,r=this.#t,i=this.#n;return this.#r?.closest(`openclaw-modal-dialog`)?.setReturnFocusTarget(null),this.clear(),this.#u.requestUpdate(),{...e,returnFocus:t,...n?{submitRequested:!0}:{},...r.length?{imageFiles:r}:{},...i===void 0?{}:{mentionTrigger:i}}}clear(){this.submitRequested=!1,this.#l+=1,this.#c=!1,this.#s!==void 0&&(cancelAnimationFrame(this.#s),this.#s=void 0),this.#o=void 0,this.#a=!1,this.#r=void 0,this.#e=void 0,this.#t=[],this.#n=void 0,this.#i=void 0}}})))()}function oS(e,t){let n=e.context;return e.onboardingMode||t===`shortcut`&&(document.openClawModalLayers?.size||document.querySelector(`.shell-nav[aria-modal='true']`))?!1:n?Xe(n.gateway.snapshot,{method:`sessions.create`,params:{},sessionScope:!0}).allowed?(e.openNewSession(n.agentSelection.state.selectedId??``),t===`shortcut`&&e.querySelector(`openclaw-new-session-page`)?.focusComposer(),!0):!1:t===`native`&&(e.pendingNativeNewSession=!0,!0)}function sS(){return(sS=e((()=>{A()})))()}var cS;function lS(){return(lS=e((()=>{Sd(),cS=vd({storageKey:`openclaw.desktopPanel`,minHeight:240,minWidth:380,defaultDock:`right`,supportedDocks:[`bottom`,`right`],defaultHeight:420,defaultWidth:560})})))()}function uS(e,t,n){return`${e}:${e.startsWith(`plugin:`)&&n?`${n}:`:``}${t?Rn(t):``}`}function dS(e){return e instanceof CustomEvent&&typeof e.detail?.sessionKey==`string`?e.detail.sessionKey:void 0}function fS(e,t){let n=Date.now();for(let[e,t]of gS){let r=t.filter(e=>n-e.createdAt<=hS);r.length?gS.set(e,r):gS.delete(e)}let r=uS(e,dS(t),t instanceof CustomEvent?t.detail?.agentId:void 0),i=t instanceof CustomEvent&&t.detail?.open===!1,a=e===`link-reader`&&!i?gS.get(r)??[]:[];a.push({event:t,createdAt:n}),gS.set(r,a)}function pS(e,t){let n=uS(e,dS(t),t instanceof CustomEvent?t.detail?.agentId:void 0),r=gS.get(n)?.filter(e=>e.event!==t);r?.length?gS.set(n,r):gS.delete(n)}function mS(e,t,n){let r=uS(e,t,n),i=gS.has(r)?r:gS.has(uS(e,t))?uS(e,t):uS(e),a=gS.get(i)?.filter(e=>Date.now()-e.createdAt<=hS)??[],o=a.shift();return a.length?gS.set(i,a):gS.delete(i),o?.event??null}var hS,gS;function _S(){return(_S=e((()=>{Be(),hS=1e4,gS=new Map})))()}var vS;function yS(){return(yS=e((()=>{rl(),Y(),lS(),Sd(),Rf(),Jd(),_S(),Vn(),ju(),tS(),$v(),fc(),Jb(),vS=class{constructor(e,t){this.host=e,this.requestLazyElement=t,this.restoredPanels=new Set,this.handleDeferredTerminalToggle=e=>this.handleDeferredToggle(`terminal`,e),this.handleDeferredBrowserToggle=e=>this.handleDeferredToggle(`browser`,e),this.handleDeferredLinkReaderToggle=e=>{let t=this.host,n=t.context?.gateway.snapshot,r=e instanceof CustomEvent?e.detail:null;if(!n||Lc(t.routeState.routeId)||lc())return;let i=Xv(n);if(r?.open===!1||i.length&&(r?.url===void 0||Af(r.url,i))){if(this.isSessionRoute()){fS(`link-reader`,e),e.preventDefault();return}lu(t.linkReaderPanelElement)||(e.preventDefault(),this.requestLazyElement(t.linkReaderPanelElement,Jx(Gd,e)))}},this.handleDeferredDesktopToggle=e=>{let t=this.host;if(t.routeState.routeId===`systems`)return;if(this.isSessionRoute()){fS(`desktop`,e);return}let n=t.context;if(!n||!Gb(n.gateway.snapshot)){e.preventDefault(),e.stopImmediatePropagation();return}lu(t.desktopPanelElement)||this.requestLazyElement(t.desktopPanelElement,Jx(zd,e))}}reset(){this.restoredPanels.clear()}restore(){let e=this.host,t=e.context,n=t?.gateway?.snapshot;if(!n)return;let r=Gb(n),i=xs(e.routeState.routeId),a=c(n,t.config.current.terminalEnabled??!1),o=!i&&Wb(n);for(let[t,n,s]of[[e.terminalPanelElement,yd,a],[e.browserPanelElement,bd,o],[e.desktopPanelElement,cS,!i&&e.routeState.routeId!==`systems`&&r]]){if(!s)continue;let r=!this.restoredPanels.has(t)&&n.load().open;this.restoredPanels.add(t),r&&e.lazyCustomElements.preload(t,{reportError:!0})}}isSessionRoute(){return xs(ks(globalThis.location?.pathname??``,this.host.context?.basePath??``)??this.host.routeState.routeId)}handleDeferredToggle(e,t){let n=this.host;if(this.isSessionRoute()){fS(e,t);return}let r=e===`terminal`?n.terminalPanelElement:n.browserPanelElement;if(lu(r))return;let i=n.context,a=i?.gateway?.snapshot;if(!a||!(e===`terminal`?c(a,i.config.current.terminalEnabled??!1):Wb(a))){t.preventDefault();return}this.requestLazyElement(r,Jx(e===`terminal`?Id:Rd,t))}}})))()}function bS(){return sc()?`(max-width: ${ES}px)`:`(max-width: ${TS}px), (max-width: 932px) and (max-height: 500px) and (orientation: landscape)`}function xS(){return globalThis.matchMedia?.(bS()).matches??!1}function SS(){return DS.some(e=>document.documentElement.classList.contains(e))}function CS(e){return e.mobileNavLayout&&xs(e.routeId)&&!e.onboarding&&!SS()}function wS(e,t){return CS({mobileNavLayout:e,routeId:`chat`,onboarding:t})}var TS,ES,DS;function OS(){return(OS=e((()=>{Y(),fc(),TS=900,ES=600,DS=[`openclaw-native-macos`,`openclaw-native-nav`,`openclaw-native-web-chrome`]})))()}var kS;function AS(){return(AS=e((()=>{K(),kS=class{constructor(e,t){this.host=e,this.requestOpen=t,this.pending=!1}load(){this.owner||this.pending||(this.pending=!0,W(async()=>{let{NavDrawerSwipeOwner:e}=await import(`./nav-drawer-swipe.runtime-AOmYXPDm.js`);return{NavDrawerSwipeOwner:e}},__vite__mapDeps([98]),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?.reset()}}})))()}function jS(e){return[...e.querySelectorAll(VS)].filter(e=>e.checkVisibility())}function MS(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 NS(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=jS(n),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 PS(e,t){t.defaultPrevented||hi(N.escape,t)||(hi(N.toggleSidebar,t)?(t.preventDefault(),e.closeNavDrawer({restoreFocus:!0})):t.key===`Tab`?NS(e,t):(jx(t)||Pd(t)||hi(N.workspaceFiles,t)||hi(N.sideChat,t))&&(t.preventDefault(),t.stopImmediatePropagation()))}function FS(e){let t=e.querySelector(`.shell-nav`),n=e.querySelector(`openclaw-toast-host`);t&&n&&n.parentElement!==t&&t.append(n)}function IS(e){let t=e.querySelector(`.shell`),n=e.querySelector(`openclaw-toast-host`);t&&n?.parentElement?.classList.contains(`shell-nav`)&&t.append(n)}function LS(e){return[...e.querySelectorAll(`.topbar-nav-toggle, .chat-pane__nav-toggle`)].find(e=>e.checkVisibility())}function RS(e){return e.onboarding||(e.mobileNavLayout?!e.navDrawerOpen:e.navCollapsed)}function zS(e){return e.navigationSurfaceHidden&&!e.mobileNavLayout&&!e.onboarding&&!e.compact}function BS(e){let t=zS(e),n=!e.compact&&e.refreshRequired;return!t&&!n?I:F`${t?F`<openclaw-sidebar-attention
class="sidebar-attention--floating"
.onNavigate=${e.onNavigate}
></openclaw-sidebar-attention>`:I}${n?F`<openclaw-sidebar-update-card
class="sidebar-update-card--floating"
.updateRun=${e.updateRun??null}
.statusBanner=${e.statusBanner??null}
.refreshRequired=${e.refreshRequired}
.onRefresh=${e.onRefresh}
></openclaw-sidebar-update-card>`:I}`}var VS;function HS(){return(HS=e((()=>{L(),Rx(),Jd(),zt(),VS=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])`})))()}var US,WS;function GS(){return(GS=e((()=>{rl(),Y(),Rx(),Jd(),Zu(),Vi(),zt(),Vn(),Ee(),Zr(),aS(),sS(),yS(),ju(),tS(),OS(),fc(),AS(),HS(),Jb(),Vg(),su(),WS=class{constructor(e){this.host=e,this.pendingLazyAction=Yx(),this.toggleNavigationSurface=e=>{let t=this.host,n=t.context;if(!n||t.onboardingMode||Lc(t.routeState.routeId)&&!xS())return;if(xS()){if(this.navDrawerSwipe.load(),t.navDrawerOpen){t.closeNavDrawer({restoreFocus:!0});return}t.navDrawerTrigger=e??LS(t)??null,t.navDrawerOpen=!0,FS(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`))})},this.restoreFocusTo=e=>Hu(e?.isConnected&&e.checkVisibility()?e:this.host.querySelector(`.content`)),this.closeNavDrawer=(e={})=>{let t=this.host,n=t.navDrawerOpen&&e.restoreFocus;t.navDrawerOpen&&(this.dismissSidebarTransientMenus(),this.navDrawerSwipe.closed()),IS(t);let r=n?t.navDrawerTrigger:null;t.navDrawerOpen=!1,t.navDrawerTrigger=null,n&&requestAnimationFrame(()=>this.restoreFocusTo(r))},this.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})},this.handleNativeToggleSidebar=()=>this.toggleNavigationSurface(),this.handleNativeOpenSearch=()=>this.openPalette(),this.handleNativeToggleSearch=e=>{e.preventDefault(),this.togglePalette()},this.handleNativeNewSession=()=>{oS(this.host,`native`)},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=ks(n),a=this.host.context;if(!i||!a)return;e.preventDefault();let o={pathname:`${a.basePath}${n}`},s=t?.search;typeof s==`string`&&s.startsWith(`?`)&&!s.includes(`#`)&&(o.search=s),this.host.navigate(i,o)},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=xS(),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(()=>{xS()&&!e.navDrawerOpen&&n&&requestAnimationFrame(()=>{this.restoreFocusTo(LS(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=()=>MS(this.host),this.handleDocumentKeydownBubble=e=>{let t=this.host;!e.defaultPrevented&&hi(N.escape,e)&&(t.navDrawerOpen&&xS()&&!document.openClawModalLayers?.size?(e.preventDefault(),t.closeNavDrawer({restoreFocus:!0})):Lc(t.routeState.routeId)&&!this.shouldIgnoreSettingsEscape(e)&&(e.preventDefault(),t.exitSettings()))},this.handleDocumentKeydown=e=>{let t=this.host;if(t.lazyCustomElements.visibleState?.element===pu&&f(e,this.pendingDebugOverlayMode,t.querySelector(`.debug-overlay`))){e.preventDefault(),t.lazyCustomElements.close();return}if(!this.palette.handlePendingShortcut(e)&&!document.openClawModalLayers?.size){if(t.navDrawerOpen&&xS()){PS(t,e);return}if(!t.commandPalette&&jx(e)){e.preventDefault(),this.togglePalette();return}if(Pd(e)&&!xs(t.routeState.routeId)&&!e.defaultPrevented&&!t.onboardingMode&&!Lc(t.routeState.routeId)&&t.context&&c(t.context.gateway.snapshot,t.context.config.current.terminalEnabled??!1)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Id));return}if(Fd(e)&&Kb(t.context?.gateway)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Vd));return}if(!e.defaultPrevented){if(hi(N.newSession,e)){!e.repeat&&oS(this.host,`shortcut`)&&e.preventDefault();return}if(hi(N.keyboardShortcuts,e)){e.preventDefault(),window.dispatchEvent(new CustomEvent(Wd));return}if(hi(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(Ud));return}if(hi(N.escape,e)&&Lc(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(hi(N.appearanceSettings,e)){e.preventDefault(),t.navigate(`appearance`);return}hi(N.toggleSidebar,e)&&(e.preventDefault(),this.toggleNavigationSurface())}}},this.handleDebugOverlayRequest=e=>{let t=this.host;if(t.navDrawerOpen&&xS()&&t.closeNavDrawer({restoreFocus:!1}),t.lazyCustomElements.visibleState?.element===pu){this.pendingDebugOverlayMode===`minimized`?this.togglePendingDebugOverlayMode():t.lazyCustomElements.close();return}let n=Jx(Ud,e),r=lu(pu)?t.querySelector(pu.tagName):null;if(r){this.clearPendingLazyAction(n),n.detail&&`mode`in n.detail?r.open(gi(n)):r.toggle();return}this.requestLazyElement(pu,n,()=>{if(this.pendingLazyAction!==n)return;let e=t.querySelector(pu.tagName);if(!e)return;let r=this.pendingDebugOverlayMode;this.clearPendingLazyAction(n),e.open(r)})},this.handleAssistantToggleBeforeMount=e=>{let t=this.host;if(t.querySelector(`openclaw-assistant-panel`))return;let n=e.type===Vd;if(n?!Kb(t.context?.gateway):!zi(t.context?.gateway.snapshot,`openclaw.chat`,`operator.admin`)){e.preventDefault();return}let r=Jx(n?Vd:Hd,e);this.pendingLazyAction=r,Xx(r),t.requestUpdate()},this.handleKeyboardShortcutsRequest=e=>{let t=Jx(Wd,e);if(lu(mu)){this.host.querySelector(mu.tagName)?.toggle(),this.clearPendingLazyAction(t);return}this.requestLazyElement(mu,t)},this.openPalette=()=>this.palette.open(),this.closePendingPalette=()=>this.palette.closePending(),this.togglePalette=()=>this.palette.toggle(),this.handleShellNavDrawerToggle=e=>{this.toggleNavigationSurface(Ax(e))},this.handleApprovalsOpen=e=>{let t=this.host,n=Jx($x,e);if(lu(t.execApprovalElement)){t.approvalOverlay?.show(),this.clearPendingLazyAction(n);return}this.requestLazyElement(t.execApprovalElement,n)},this.restorePendingLazyAction=()=>{let e=this.pendingLazyAction;if(!e||this.host.lazyCustomElements.visibleState||this.commandPaletteLoading.waitingForComposition)return;let t=this.shellEventElementTag(e.eventType);(!customElements.get(t)||this.host.querySelector(t))&&this.dispatchLazyShellEvent(e)&&!this.host.lazyCustomElements.visibleState&&this.clearPendingLazyAction(e)},this.handleCommandPaletteSlashCommand=e=>this.palette.handleSlashCommand(e),this.handleCommandPaletteTarget=e=>Nx(this.host,e),this.nativeNavCollapsed=()=>{let e=this.host,t=xS();return e.onboardingMode||t||Lc(e.routeState.routeId)&&!t||!e.navDrawerOpen&&!e.desktopNavigationExpanded&&(e.context?.navigation.snapshot.navCollapsed??!1)},this.palette=new rS(e,{request:(e,t,n)=>this.requestLazyElement(e,t,n),clear:e=>this.clearPendingLazyAction(e),cancel:()=>this.cancelPendingLazyAction(),pending:()=>this.pendingLazyAction?.eventType===Ix}),this.panels=new vS(e,(e,t)=>this.requestLazyElement(e,t)),this.navDrawerSwipe=new kS(e,()=>this.toggleNavigationSurface())}connect(){this.disconnect(),this.listeners=new AbortController;let e={signal:this.listeners.signal},t=this.host;t.nativeHistoryState=uc(),t.addEventListener(Fx,this.handleCommandPaletteTarget,e);for(let n of[m,ai])t.addEventListener(n,()=>t.requestUpdate(),e);document.addEventListener(`keydown`,this.handleDocumentKeydown,{capture:!0,signal:this.listeners.signal}),document.addEventListener(`keydown`,this.handleDocumentKeydownBubble,e),window.addEventListener(`dragover`,this.handleUnhandledFileDrag,e),window.addEventListener(`drop`,this.handleUnhandledFileDrag,e);for(let[t,n]of[[Ix,this.palette.open],[Lx,this.handleShellNavDrawerToggle],[Ud,this.handleDebugOverlayRequest],[Wd,this.handleKeyboardShortcutsRequest],[`resize`,this.handleWindowResize],[dc,this.handleNativeHistoryState],[`openclaw:native-toggle-sidebar`,this.handleNativeToggleSidebar],[`openclaw:native-open-search`,this.handleNativeOpenSearch],[`openclaw:native-toggle-search`,this.handleNativeToggleSearch],[`openclaw:native-new-session`,this.handleNativeNewSession],[`openclaw:native-navigate`,this.handleNativeNavigate],[Id,this.panels.handleDeferredTerminalToggle],[Rd,this.panels.handleDeferredBrowserToggle],[Gd,this.panels.handleDeferredLinkReaderToggle],[zd,this.panels.handleDeferredDesktopToggle],[Hd,this.handleAssistantToggleBeforeMount],[Vd,this.handleAssistantToggleBeforeMount],[$x,this.handleApprovalsOpen]])window.addEventListener(t,n,e);this.navDrawerSwipe.connect(),xS()&&this.navDrawerSwipe.load(),US=this.listeners,Object.assign(window,{__OPENCLAW_NATIVE_COMMANDS_READY__:!0}),window.dispatchEvent(new Event(`openclaw:native-commands-state`))}disconnect(){this.commandPaletteLoading.clear();let e=this.listeners;this.listeners?.abort(),this.listeners=void 0,this.navDrawerSwipe.disconnect(),e&&US===e&&(US=void 0,Object.assign(window,{__OPENCLAW_NATIVE_COMMANDS_READY__:!1}),window.dispatchEvent(new Event(`openclaw:native-commands-state`)))}get pendingDebugOverlayMode(){return gi(this.pendingLazyAction)}togglePendingDebugOverlayMode(){let e=this.pendingLazyAction;e?.eventType===`openclaw:debug-overlay-request`&&this.host.lazyCustomElements.visibleState?.element===pu&&(e.detail={mode:this.pendingDebugOverlayMode===`minimized`?`expanded`:`minimized`},Xx(e),this.host.requestUpdate())}shouldIgnoreSettingsEscape(e){let t=this.host,n=t.context?.overlays.snapshot;if(t.commandPalette?.isOpen||t.querySelector(mu.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], wa-dropdown[open], [contenteditable], dialog, [role='dialog'], [role='menu'], [role='listbox']`)!==null}get commandPaletteLoading(){return this.palette.loading}synchronizeCommandPaletteScope(){this.palette.synchronizeScope()}shellEventElementTag(e){let t=this.host;return{[Ix]:t.commandPaletteElement.tagName,[Ud]:pu.tagName,[Wd]:mu.tagName,[Id]:t.terminalPanelElement.tagName,[Rd]:t.browserPanelElement.tagName,[Gd]:t.linkReaderPanelElement.tagName,[zd]:t.desktopPanelElement.tagName,[Hd]:`openclaw-assistant-panel`,[Vd]:`openclaw-assistant-panel`,[$x]:t.execApprovalElement.tagName}[e]}requestLazyElement(e,t,n=()=>this.dispatchLazyShellEvent(t)){e!==this.host.commandPaletteElement&&this.commandPaletteLoading.clear(),this.pendingLazyAction=t,Xx(t),this.host.lazyCustomElements.request(e,()=>{n(),this.clearPendingLazyAction(t)})}retryPendingLazyAction(e){let t=this.pendingLazyAction;return Jl({canReload:()=>e()&&this.pendingLazyAction===t&&(!t||Xx(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)&&(Zx(),this.pendingLazyAction=null)}cancelPendingLazyAction(){this.commandPaletteLoading.clear();let e=this.pendingLazyAction;e&&this.clearPendingLazyAction(e)}abandonPendingLazyActionForContext(){this.commandPaletteLoading.clear(),this.panels.reset(),this.pendingLazyAction=null,Zx(),this.host.lazyCustomElements.abandon()}preservePendingLazyActionForReload(){this.panels.reset(),this.host.lazyCustomElements.abandon()}}})))()}function KS(e){return Object.hasOwn(Sa,e)}function qS(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function JS(e,t,n){let r=(n,r)=>{qS(t[n],r)||(e[n]=r)};for(let e of Object.keys(n))r(e,n[e])}function YS(e){let t=uo(uo(uo(e)?.ui)?.prefs);if(!t)return{};let n={};for(let e of nC){if(tC[e].configSync===!1)continue;let r=tC[e].extract(t[e]);r!==void 0&&(n[e]=r)}return n}function XS(e,t,n,r,i,a){let o=tC[t],s=o.local(r),c=o.reset?.(r),l=c?o.local({...r,...c}):void 0,u=e=>{let t=!qS(s,e);return{overridden:t,provenance:t||o.configSync===!1&&i===!1?`device-local`:`default`,resetValue:e,value:s}},d=uo(uo(uo(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&&KS(t)?f??l:l,_=m!==void 0&&(!o.canApply||o.canApply(m,r)),v=_?m:l;if(i===null&&a!=null&&KS(t))return{...u(v),provenance:`device-local`};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 m===void 0?u(l):_?qS(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 ZS(e,t,{appearanceReady:n,scopeChanged:r,firstSnapshot:i,shadowPrefs:a,retainedLocalKeys:o}){let s={};for(let c of nC){if(a&&c in a||o.has(c))continue;let l=KS(c),u=n||!l;Object.hasOwn(e,c)?u&&(r||i||!qS(e[c],t[c]))&&Object.assign(s,{[c]:e[c]}):!(c in e)&&tC[c].clearable&&(u&&Object.hasOwn(t,c)||r&&l)&&(s[c]=null)}return s}function QS(e,t){let n={};for(let r of nC){let i=tC[r],a=e[r];if(a!==void 0){if(a===null){let e=i.clearable?i.reset?.(t):void 0;e&&JS(n,t,e);continue}qS(a,i.local(t))||(!i.canApply||i.canApply(a,t))&&(n[r]=a)}}return Object.keys(n).length>0?n:null}var $S,eC,tC,nC;function rC(){return(rC=e((()=>{So(),ya(),rl(),w(),Vg(),Ah(),$S=e=>e,eC=(e,t,n=!0)=>$S({configSync:n,extract:t,local:n=>t(n[e]),write:t=>({[e]:t}),clearable:!0,reset:()=>({[e]:void 0})}),tC={theme:$S({extract:e=>e===`custom`||aa(e)?e:void 0,local:e=>e.theme,write:e=>({theme:e??Lg.theme}),clearable:!0,reset:()=>({theme:Lg.theme}),canApply:(e,t)=>e!==`custom`||!!t.customTheme}),themeMode:$S({extract:fa,local:e=>e.themeMode,write:e=>({themeMode:e??Lg.themeMode}),clearable:!0,reset:()=>({themeMode:Lg.themeMode})}),accent:eC(`accent`,Kh),fontUi:eC(`fontUi`,yh,!1),fontChat:eC(`fontChat`,yh,!1),locale:$S({extract:e=>typeof e==`string`&&O(e)?e:void 0,local:e=>e.locale,write:e=>({locale:e}),clearable:!0,reset:()=>({locale:void 0})}),chatShowThinking:$S({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatShowThinking}),chatShowToolCalls:$S({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatShowToolCalls}),chatPersistCommentary:$S({extract:e=>typeof e==`boolean`?e:void 0,local:e=>e.chatPersistCommentary!==!1}),chatSendShortcut:$S({extract:e=>e===`enter`||e===`modifier-enter`?e:void 0,local:e=>jg(e.chatSendShortcut),write:e=>({chatSendShortcut:e}),clearable:!0,reset:()=>({chatSendShortcut:void 0})}),chatFollowUpMode:eC(`chatFollowUpMode`,Gh),sidebarEntries:$S({extract:e=>kc(e)??void 0,local:e=>e.sidebarEntries})},nC=Object.keys(tC)})))()}function iC(e,t){(t===`device-local`?lC:cC).add(e)}function aC(){cC.clear(),lC.clear(),uC.clear()}function oC(e,t){let n={};for(let r of nC){let i=uC.delete(r),a=cC.delete(r);if(lC.delete(r))continue;if(a){n[r]=null;continue}let o=tC[r],s=o.local(e),c=o.local(t);if(i||!qS(s,c)){if(c===void 0){o.clearable&&(n[r]=null);continue}n[r]=c}}return Object.keys(n).length>0?n:null}function sC(e,t={}){return e===lg().theme?fg({...t,theme:e}):(uC.add(`accent`),cC.add(`fontUi`),cC.add(`fontChat`),fg({...t,theme:e,fontUi:void 0,fontChat:void 0,accent:`theme`}))}var cC,lC,uC;function dC(){return(dC=e((()=>{rC(),Vg(),cC=new Set,lC=new Set,uC=new Set})))()}function fC(e,t){return t?`${e}:profile:${t}`:e}function pC(e,t){return t&&vC?.profileId===t&&vC.scope===e?vC.prefs:null}function mC(e){return yC?.scope===e?yC.profileId:null}function hC(e,t){yC={scope:e,profileId:t}}function gC(){vC=null,yC=null,bC+=1}async function _C(e,t,n){hC(n,t);let r=++bC,{readProfileAppearancePrefs:i}=await W(async()=>{let{readProfileAppearancePrefs:e}=await import(`./server-prefs-profile-runtime-DknSjRPw.js`);return{readProfileAppearancePrefs:e}},__vite__mapDeps([99,1,100,28]),import.meta.url);if(r!==bC)return!1;let a=await i(e,t);return r!==bC||!a?!1:(vC={profileId:t,scope:n,prefs:a},!0)}var vC,yC,bC;function xC(){return(xC=e((()=>{K(),vC=null,yC=null,bC=0})))()}function SC(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 CC(e,t){return SC(e,t).value}function wC(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 TC(e){let t=uo(Ea(e??`null`));return t&&Object.keys(t).length?t:null}function EC(e,t){let n=SC(e,t);return{available:n.available,prefs:TC(n.value)}}function DC(e){let t=TC(CC(jC,e));if(!t)return new Set;let n=Object.keys(t).filter(e=>Object.hasOwn(tC,e));return new Set(n)}function OC(e,t){wC(jC,e,t.size?JSON.stringify(Object.fromEntries([...t].map(e=>[e,!0]))):null)}var kC,AC,jC;function MC(){return(MC=e((()=>{mo(),rC(),kC=`openclaw.control.serverPrefs.v1`,AC=`openclaw.control.serverPrefs.pending.v1`,jC=`openclaw.control.serverPrefs.retained-local.v1`})))()}function NC(e,t,n=``,r=lg(n||void 0),i={}){let a=!i.profileId&&KS(t)&&i.canSync===null,o=i.profileId??(a?mC(n):null),s=fC(n,o),c=s===Q?$:TC(CC(AC,s)),l=pC(n,o),u=o&&KS(t)&&l===null,d=u?TC(CC(`openclaw.control.serverPrefs.v1`,s))??{}:l,f=XS(e,t,c,r,i.canSync,d);return u&&f.provenance===`profile`?{...f,provenance:`synced`}:f}function PC(){pw!==null&&(clearTimeout(pw),pw=null),mw=0}function FC(e,t,n){let r=DC(e);for(let e of t)n?r.add(e):r.delete(e);OC(e,r),n&&e===hw&&(gw=null)}function IC(e,t=!1){if(!t&&e===Q)return;Q=e;let n=EC(AC,e);$=n.prefs,iw=new Set(n.available&&n.prefs?Object.keys(n.prefs):[])}function LC(e){wC(`openclaw.control.serverPrefs.pending.v1`,Q,e?JSON.stringify(e):null)?iw=new Set($?Object.keys($):[]):iw.clear()}function RC(e,t){e===Q&&VC();let n=e===Q?$:null,r={...TC(CC(AC,e)),...n};for(let e of t)delete r[e];let i=Object.keys(r).length?r:null;if(e===Q){$=i,LC(i);return}wC(AC,e,i?JSON.stringify(i):null)}function zC(){let e={...TC(CC(`openclaw.control.serverPrefs.pending.v1`,Q))??{},...$};LC(Object.keys(e).length?e:null)}function BC(e){let t={...TC(CC(AC,Q))};for(let n of Object.keys(e))qS(t[n],e[n])&&delete t[n];let n={...t,...$};LC(Object.keys(n).length?n:null)}function VC(){if(!$||iw.size===0)return;let e=EC(AC,Q);if(!e.available)return;let t=e.prefs??{};for(let e of iw){if(!Object.hasOwn(t,e)){delete $[e],iw.delete(e);continue}let n=t[e];qS($[e],n)||($[e]=n)}Object.keys($).length||($=null)}function HC(e){let t=$;return!!(t&&Object.keys(e).every(n=>Object.hasOwn(t,n)&&qS(t[n],e[n])))}function UC(){PC(),rw=uw=dw=!1,Q=``,$=aw=null,iw.clear(),ow=``,sw=null,cw=!1,hw=``,gw=null,gC(),aC()}function WC(e,t,n=Q,r){let i=tC[e],a=t=>e===`theme`&&t.theme!==void 0?sC(t.theme):fg(t),o=fC(n,KS(e)?r??mC(n):null),s=i.reset;if(!s)throw Error(`Server UI preference is not resettable: ${e}`);let c=i.write;if(t?.provenance===`device-local`){if(!c)throw Error(`Server UI preference cannot restore a retained local value: ${e}`);let r=c(t.resetValue),i=e===`theme`&&r.theme!==lg().theme?[e,`accent`,`fontUi`,`fontChat`]:[e];RC(o,i),o!==n&&RC(n,i),FC(o,i,!1);for(let e of i)iC(e,`device-local`);return a(r)}return iC(e,`server`),a(t&&c?c(t.resetValue):s(lg()))}function GC(e,t){let n=t.scope??``,r=fC(n,t.profileId);if(r===hw&&e===gw)return!1;let i=hw!==``&&r!==hw,a=pC(n,t.profileId),o=!t.profileId||a!==null||i,s=()=>{hw=r,gw=e},c=r===Q?$:TC(CC(AC,r)),l=DC(r),u=[...l].filter(e=>o||!KS(e)),d={...YS(e),...a},f=CC(kC,r),p=TC(f)??{};if(!o)for(let e of nC)KS(e)&&(delete d[e],Object.hasOwn(p,e)&&Object.assign(d,{[e]:p[e]}));let m=JSON.stringify(d);if(!i&&m===f)return u.length&&FC(r,u,!1),s(),!1;let h=ZS(d,p,{appearanceReady:o,scopeChanged:i,firstSnapshot:f===null,shadowPrefs:c,retainedLocalKeys:l});wC(kC,r,m),u.length&&FC(r,u,!1),s(),Object.hasOwn(h,`theme`)&&t.onThemeChanged?.(h.theme??null);let g=QS(h,lg(n||void 0));if(!g)return!1;rw=!0;try{fg(g)}finally{rw=!1}return t.onApplied(g),!0}async function KC(e){let t=e.scope??e.client.gatewayUrl;return await _C(e.client,e.profileId,t)?(gw=null,GC(e.configObject,{...e,scope:t})):!1}function qC(){return rw}function JC(e,t){let n=t.profileId??t.profile?.selfUser?.id??null,r=e.state.client?.gatewayUrl??``;n&&hC(r,n);let i=fC(r,n);if(cw=t.canWrite??Yf(t.profile?.hello?.auth??null),aw===e&&ow===i&&sw===n)return;VC();let a=Q===``?{...TC(CC(AC,``)),...$}:null;PC(),fw+=1,aw=e,ow=i,sw=n,uw=!1,IC(i,!0),i&&a&&Object.keys(a).length&&($={...$,...a},zC(),wC(AC,``,null))}function YC(e){if($){for(let t of Object.keys(e))qS($[t],e[t])&&(delete $[t],iw.delete(t));Object.keys($).length||($=null)}}function XC(e,t){pw!==null||mw>=nw||(mw+=1,pw=setTimeout(()=>{pw=null,aw===e&&fw===t&&$&&QC(e)},tw))}async function ZC(e,t){for(;$;){if(aw!==e||fw!==t||(VC(),!$))return;let n=nC.filter(e=>$?.[e]!==void 0&&(tC[e].configSync===!1||e===`theme`&&typeof $.theme==`string`&&$.theme.includes(`/`))&&!(sw&&cw));if(n.length){if(!e.state.connected)return;RC(Q,n),FC(Q,n,!0),lw?.({needsRefresh:!1,retainedLocal:!0});continue}if(sw&&$.theme===`custom`){RC(Q,[`theme`]),FC(Q,[`theme`],!0);continue}let r={};if(sw&&cw)for(let e of nC)KS(e)&&Object.hasOwn($,e)&&Object.assign(r,{[e]:$[e]});let i=Object.keys(r).length>0,a=i?r:{...$},o=lw;for(let n=0;n<2;n+=1){if(aw!==e||fw!==t)return;i&&e.state.client&&Cv(e.state.client);let r=i?await W(async()=>{let{writeProfileAppearancePrefs:e}=await import(`./server-prefs-profile-runtime-DknSjRPw.js`);return{writeProfileAppearancePrefs:e}},__vite__mapDeps([99,1,100,28]),import.meta.url).then(({writeProfileAppearancePrefs:n})=>n(e.state.client,a,aw===e&&fw===t&&e.state.connected&&cw&&HC(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,configWriteAck:e=>e,canDispatch:()=>e.canPatch!==!1&&(VC(),HC(a)?!0:(dw=!!$,!1)),dispatchError:`Access changed before preferences could sync.`});if(aw!==e||fw!==t)return;if(r.ok){YC(a);let n={...TC(CC(`openclaw.control.serverPrefs.v1`,Q))??{},...a},s=pC(e.state.client?.gatewayUrl??``,sw);if(i&&s){let t=YS(e.state.configSnapshot?.config);for(let e of nC)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]}));gw=null}if(wC(kC,Q,JSON.stringify(n)),BC(a),PC(),aw!==e||fw!==t||(r.refresh.ok&&o&&hw===Q&&(gw=null),o?.({needsRefresh:!r.refresh.ok}),aw!==e||fw!==t))return;break}if(r.reason===`conflict`&&n===0){await Oa(250);continue}if(r.reason===`conflict`){XC(e,t);return}if(r.reason===`error`||r.reason===`unavailable`||r.reason===`suspended`)return;YC(a),BC(a),o?.({needsRefresh:!1,retainedLocal:!0});return}}}function QC(e){if(uw){dw=!0;return}if(!$||e.state.connected&&e.canPatch===!1&&!(sw&&cw&&Object.keys($).some(KS)))return;uw=!0;let t=fw;ZC(e,t).catch(()=>void 0).finally(()=>{aw===e&&fw===t&&(uw=!1,dw&&(dw=!1,QC(e)))})}function $C(e,t,n={}){JC(e,n),PC(),lw=n.afterCommit;let r=nC.filter(e=>Object.hasOwn(t,e)),i=e.state.connected?r.filter(n=>tC[n].configSync===!1&&!sw?!0:sw&&KS(n)?!cw||n===`theme`&&t.theme===`custom`:e.canPatch===!1):[];if(i.length&&(RC(Q,i),FC(Q,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;VC(),$={...$,...a},zC(),QC(e)}function ew(e,t={}){JC(e,t),PC(),fw+=1,uw=dw=!1,lw=t.afterCommit,QC(e)}var tw,nw,rw,Q,$,iw,aw,ow,sw,cw,lw,uw,dw,fw,pw,mw,hw,gw;function _w(){return(_w=e((()=>{Ga(),np(),dC(),xC(),rC(),MC(),Vg(),Ev(),K(),tw=1e3,nw=5,rw=!1,Q=``,$=null,iw=new Set,aw=null,ow=``,sw=null,cw=!1,uw=!1,dw=!1,fw=0,pw=null,mw=0,hw=``,gw=null})))()}function vw(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 yw,bw;function xw(){return(xw=e((()=>{Y(),Jd(),_S(),w(),_n(),Yn(),si(),Be(),np(),_w(),Ev(),yw=100,bw=class{constructor(e){this.host=e,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null}observeSessions(e,t){let n=!0,r=()=>{n&&this.host.context?.sessions===e&&(this.host.observeDeletedSessions(e.state),this.host.recoverDeletedActiveSession(e.state),t())};r();let i=e.subscribe(r);return()=>{n=!1,i()}}reconcileServerUiPrefs(e){let t=e.state.configSnapshot,n=this.host.context;if(!t?.config||!n||n.runtimeConfig!==e||n.gateway.snapshot.phase!==`connected`)return;let r=n.gateway.connection.gatewayUrl;GC(t.config,{scope:r,profileId:n.gateway.snapshot?.selfUser?.id,onThemeChanged:e=>n.theme.recordServerSelection(e,r),onApplied:()=>n.theme.refresh()}),this.refreshProfileAppearancePrefs(n).catch(()=>void 0);let i=NC(t.config,`locale`,r),a=JSON.stringify([r,i.overridden,i.value]);if(a!==this.host.lastLocalePrefSignature){if(this.host.lastLocalePrefSignature=a,i.overridden&&O(i.value)){Un.setLocale(i.value);return}Un.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){let t=this.host.context,n=t?.gateway?.snapshot.client;n&&e.event===`sessions.changed`&&Ot(n,e.payload,{hello:t?.gateway.snapshot.hello,agentsList:t?.agents.state.agentsList});let r=Hn(e);if(n&&Zt(e)&&Yr(n),n&&(r||e.event===`chat.metadata.changed`)&&ni(n,void 0,void 0,r??`preserve`),e.event===`sessions.changed`){let e=this.host.context;e&&this.host.recoverDeletedActiveSession(e.sessions.state);return}if(e.event===`config.changed`){this.host.context?.config.refresh();let e=this.host.context?.runtimeConfig;e&&!e.state.configFormDirty&&e.refresh({background:!0}),this.scheduleAgentRosterRefresh();return}if(e.event===`users.prefs.changed`){let e=this.host.context,t=e?.gateway.snapshot.selfUser?.id;e&&t&&(e.gateway.snapshot.client&&Cv(e.gateway.snapshot.client),this.refreshProfileAppearancePrefs(e,!0).catch(()=>void 0));return}if(e.event!==`ui.command`||!e.payload)return;let i=this.host.context;if(!i)return;let a=e.payload,{command:o}=a;if(o){if(o.kind===`sidebar`){this.host.desktopNavigationExpanded=!1,i.navigation.update({navCollapsed:!o.visible});return}if(o.kind===`panel`){let e=a.sessionKey??(o.panel===`portal`||o.panel===`plugin`?this.host.activeSessionKey:void 0);e&&(!wt(e,this.host.activeSessionKey)||!xs(this.host.routeState.routeId)||o.panel===`plugin`&&a.agentId!==void 0&&a.agentId!==i.agentSelection.state.selectedId)&&this.host.selectChatSession(e,a.agentId);let t=new CustomEvent({terminal:Id,browser:Rd,desktop:zd,portal:Bd,plugin:Kd}[o.panel],{detail:{open:o.open,...o.panel===`plugin`?{pluginId:o.pluginId,panelId:o.panelId,agentId:a.agentId}:{},...e?{sessionKey:e}:{},...o.dock?{dock:o.dock}:{},...o.panel===`terminal`&&o.terminalSessionId?{terminalSessionId:o.terminalSessionId}:{},...`environmentId`in o&&o.environmentId?{environmentId:o.environmentId}:{},...`portalId`in o&&o.portalId?{portalId:o.portalId}:{}}});e&&fS(o.panel===`plugin`?`plugin:${o.pluginId}/${o.panelId}`:o.panel,t),window.dispatchEvent(t);return}window.dispatchEvent(new CustomEvent(`openclaw:ui-command`,{detail:a,cancelable:!0}))&&(o.kind===`navigate`||o.kind===`split`)&&this.host.selectChatSession(o.sessionKey,a.agentId)}}scheduleAgentRosterRefresh(){this.host.agentRosterRefreshTimer!==null&&globalThis.clearTimeout(this.host.agentRosterRefreshTimer),this.host.agentRosterRefreshTimer=globalThis.setTimeout(()=>{this.host.agentRosterRefreshTimer=null,this.refreshAgentRoster()},yw)}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=vw(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,{background:!0})}synchronizeGateway(e){let t=this.host.previousGatewayPhase;this.host.previousGatewayPhase=e.phase,this.updateGatewaySessionKey(e);let n=this.host.context;if(n&&this.host.recoverDeletedActiveSession(n.sessions.state),e.phase===`connected`&&n){let t=n.connectionBootstrap;t.run(`runtime-config`,async()=>(await this.ensureRuntimeConfig(e,n.runtimeConfig),this.refreshProfileAppearancePrefs(n))),this.host.routeState.routeId&&!n.agents.state.agentsList&&t.run(`agents`,()=>this.ensureAgentsList(e,n.agents)),t.run(`outbox`,()=>this.host.outboxStoreImport.load())}t!==`connected`&&e.phase===`connected`&&Un.retryPendingLocale()}ensureRuntimeConfig(e,t=this.host.context?.runtimeConfig){if(e.phase!==`connected`||!e.client||!t)return this.host.runtimeConfigClient=null,this.runtimeConfigProfileId=null,this.profileAppearanceSource=null,Promise.resolve();let n=e.selfUser?.id??null;return this.host.runtimeConfigClient===e.client&&this.host.runtimeConfigSource===t&&this.runtimeConfigProfileId===n?Promise.resolve():(this.host.runtimeConfigClient=e.client,this.host.runtimeConfigSource=t,this.runtimeConfigProfileId=n,ew(t,{profileId:n,canWrite:Yf(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)return this.host.agentsListClient=null,Promise.resolve();let n=this.host.routeState.routeId;return!t||!n||t.state.agentsList||this.host.agentsListClient===e.client&&this.host.agentsListSource===t?Promise.resolve():(this.host.agentsListClient=e.client,this.host.agentsListSource=t,t.ensureList().then(()=>void 0))}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 Promise.resolve();let i=n.client,a=e.runtimeConfig.state.configSnapshot?.config;if(n.phase!==`connected`||!i||!a)return Promise.resolve();let o=this.profileAppearanceSource;if(!t&&o?.client===i&&o.profileId===r)return Promise.resolve();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;return KC({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.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),UC()}dispose(){this.host.lastLocalePrefSignature=null,this.reset()}}})))()}function Sw(e,t){let n=e.placementStartup.get(t);return n?.initialTurn&&(n.phase===`cancelled`||e.sessions.deletionState(t)===`confirmed`)?n:null}function Cw(){return(Cw=e((()=>{})))()}function ww(e,t=sc()){let n=t?e??Le():null;if(!n)return null;try{let e=n.getItem(Ow);if(e===null)return null;let t=JSON.parse(e);if(typeof t.routeId==`string`&&is(t.routeId)&&typeof t.pathname==`string`&&typeof t.search==`string`)return{routeId:t.routeId,pathname:t.pathname,search:t.search};n.removeItem(Ow)}catch{try{n.removeItem(Ow)}catch{}}return null}function Tw(e){let t=new URLSearchParams(e);t.delete(`draft`);let n=t.toString();return n?`?${n}`:``}function Ew(e,t,n,r,i=sc()){let a=i?r??Le():null;if(a)try{a.setItem(Ow,JSON.stringify({routeId:e,pathname:t,search:Tw(n)}))}catch{}}function Dw(e,t,n,r,i=sc()){if(!i||e!==`chat`||!t.endsWith(`/chat`)||n!==``)return null;let a=ww(r,i);return!a||a.routeId===e&&a.pathname===t&&a.search===n?null:a}var Ow;function kw(){return(kw=e((()=>{qp(),fc(),Ow=`openclaw.native.lastRoute`})))()}var Aw;function jw(){return(jw=e((()=>{rl(),Y(),qp(),me(),Be(),ud(),kw(),Aw=class{constructor(e){this.host=e,this.navigate=(e,t)=>{let n=this.host.context;n&&is(e)&&(this.host.closeNavDrawer({restoreFocus:!0}),n.navigate(e,xs(e)?this.chatNavigationOptions(e,t):t))}}selectChatSession(e,t){let n=this.host.context;if(!n)return;cd({selection:n.agentSelection,gateway:n.gateway,sessionKey:e,agentId:t});let r=k(n,e,t);this.navigate(r,Ye({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?Ye({context:r,face:e,sessionKey:n}).options:void 0)}recoverNotFoundRoute(){let e=this.host.context,t=this.host.routeState.location??window.location;if(e&&es(t.pathname,e.basePath)){if(e.gateway.snapshot.phase!==`connected`)return!1;if(ts(t.pathname,e.basePath))return e.replace(`plugin`,{pathname:t.pathname,search:t.search,hash:t.hash}),!0}return this.replaceChatWithCurrentSession()}replaceChatWithCurrentSession(){let e=this.host.context,t=this.host.activeSessionKey.trim();if(!e)return!0;if(!Mn(t)&&e.gateway.snapshot.phase!==`connected`)return!1;let n=this.host.routeState.routeId===`dashboard`?`dashboard`:`chat`;if(n===`chat`&&Sw(e,t))return!0;let r=e.sessions.deletionState(t),i=ae(e,t),a=this.host.routeState.location?.pathname,o=!a||a===Ye({context:e,face:n,sessionKey:t}).options.pathname,s=Mn(t)?.agentId,c=e.agents.state.agentsList?.agents,l=s&&(!c||c.some(e=>G(e.id)===s))?s:u(e),d=!r&&(i?.key||!o)?t:Ha({agentId:l,mainKey:T({agentsList:e.agents.state.agentsList,hello:e.gateway.snapshot.hello})});return r&&d===t?!0:(d!==t&&(this.host.activeSessionKey=d,cd({selection:e.agentSelection,gateway:e.gateway,sessionKey:d})),e.replace(n,Ye({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&&xs(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=i.chatSubmissions.creation||e.routeId!==t||(e.location?.pathname??``)!==n||(e.location?.search??``)!==r;if(!this.host.didConsiderNativeRouteRestore){this.host.didConsiderNativeRouteRestore=!0;let e=a?null:Dw(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)){if(t===`chat`&&Sw(i,a))return;this.replaceChatWithCurrentSession();return}Ew(t,n,r),a&&(this.host.activeSessionKey=a,cd({selection:i.agentSelection,gateway:i.gateway,sessionKey:a,background:!0}))}}let a=this.host.context;a&&this.host.ensureAgentsList(a.gateway.snapshot),e.routeId&&!Ic(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:Rr(e,t)})}exitSettings(){let e=this.host.lastWorkspaceLocation;if(e){let{routeId:t,...n}=e;this.navigate(t,n);return}this.navigate(`chat`)}}})))()}function Mw(e){return t=>{let n=()=>{let n=e.overlays.snapshot,r=n.updateStatusBanner;t({run:n.updateRun,busy:n.updateRunning||n.updateReconciliationPending,connected:e.gateway.snapshot.phase===`connected`,failure:r&&r.tone!==`info`&&r.source!==`read`?r.text:null,readError:n.updateStatusCheckBanner?.text??(r?.source===`read`?r.text:null)})},r=e.overlays.subscribe(n),i=e.gateway.subscribe(n);return n(),()=>{r(),i()}}}async function Nw(e){let{confirmAndStartUpdateRuntime:t}=await W(async()=>{let{confirmAndStartUpdateRuntime:e}=await import(`./update-confirmation.runtime-C3m74WAv.js`);return{confirmAndStartUpdateRuntime:e}},__vite__mapDeps([101,1,12,3,2,4,5,8,7,6,9,11,13,14,15,91,102,103,28,29,30,31,104]),import.meta.url);await t(e)}function Pw(){return(Pw=e((()=>{K()})))()}function Fw(e){return{retryGateway:()=>e.context?.gateway.connect(),toggleSidebar:()=>e.toggleNavigationSurface(),updateSidebarEntries:t=>e.context?.navigation.update({sidebarEntries:t}),openDevicePairSetup:()=>void e.context?.overlays.openDevicePairSetup(),preloadRoute:t=>is(t)?e.context?.preload(t)??Promise.resolve():Promise.resolve(),requestOpenNewSession:(t,n)=>{let r=e.context;r&&Xe(r.gateway.snapshot,{method:`sessions.create`,params:{},sessionScope:!0}).allowed&&e.openNewSession(t,n)},watchUpdateProgress:t=>{let n=e.context;return n?Mw(n)(t):()=>void 0}}}function Iw(){return(Iw=e((()=>{qp(),A(),Pw()})))()}function Lw(e){return e===`reconnecting`||e===`offline`}function Rw(e){let{kind:t}=e;if(!t)return I;let n=P(`connection.${t}`),r=F`<span class="gateway-status__state"
><span class="gateway-status__icon" aria-hidden="true"
>${t===`suspending`||t===`suspended`?Tl.pause:t===`offline`?Tl.alertTriangle:Tl.refresh}</span
><span class="gateway-status__label">${n}</span></span
>`,i=`gateway-status gateway-status--${t}`,a=e.onRetry&&Lw(t)?F`<button
type="button"
class=${i}
aria-label=${[n,P(`connection.retryNow`)].filter(Boolean).join(` — `)}
@click=${e.onRetry}
>
${r}
</button>`:F`<span class=${i}>${r}</span>`;return F`<openclaw-tooltip
class="gateway-status-tooltip"
.content=${e.lastError&&Lw(t)?st(e.lastError):``}
><span
role=${e.announce===!1?I:`status`}
aria-live=${e.announce===!1?I:`polite`}
>${a}</span
></openclaw-tooltip
>`}function zw(){return(zw=e((()=>{L(),w(),ie(),El()})))()}function Bw(e){let t=!!e.disabledReason,n=`${J(`new-session`,e.basePath)}${Rr(e.agentId,e.target)}`,r=e.showShortcut?`${e.label} (${ri(N.newSession)})`:e.label;return F`<openclaw-tooltip
.content=${e.disabledReason??r}
.contentTemplate=${e.disabledReason==null&&e.showShortcut?jl(e.label,N.newSession):void 0}
>
<a
class=${e.className}
role="link"
href=${t?I:n}
aria-label=${e.label}
aria-disabled=${t?`true`:I}
tabindex=${t?`-1`:I}
@contextmenu=${e=>{e.stopPropagation()}}
@click=${n=>{if(t){n.preventDefault();return}D(n)&&(n.preventDefault(),e.onOpen?.(e.agentId,e.target))}}
>
${Tl.plus}
</a>
</openclaw-tooltip>`}function Vw(){return(Vw=e((()=>{L(),Y(),zt(),El(),Nl(),Zu()})))()}function Hw(e,t){let n=e.settingsSidebarRenderer;if(n)return n(t);let r=e.settingsSidebarLoadFailed;return r||e.loadSettingsSidebarRenderer(),t.presentation===`embed-list`||t.presentation===`embed-page`?F`<section
class=${t.presentation===`embed-list`?`settings-embed-list`:`native-embed-header`}
aria-busy=${r?`false`:`true`}
>
${t.presentation===`embed-page`?F`<button class="native-embed-header__back btn btn--ghost" type="button" @click=${t.onExit}>${P(`common.back`)}</button>`:I}
<h1 class="page-title">
${t.presentation===`embed-list`?P(`nav.settings`):Hc(t.activeRouteId)}
</h1>
<p role=${r?`alert`:`status`}>
${P(r?`nav.settingsLoadFailed`:`common.loading`)}
</p>
${r?F`<button class="btn" @click=${()=>e.retrySettingsSidebarRenderer()}>${P(`common.retry`)}</button>`:I}
</section>`:F`<aside class="settings-sidebar" aria-busy=${r?I:`true`}>
<header class="settings-sidebar__header" @mousedown=${cl}>
<button type="button" class="settings-sidebar__back" @click=${t.onExit}>
<span class="settings-sidebar__back-icon" aria-hidden="true">${Tl.arrowLeft}</span>
${P(`nav.exitSettings`)}
</button>
<h1 class="settings-sidebar__title">${P(`nav.settings`)}</h1>
</header>
${r?F`<div class="settings-sidebar__empty" role="alert">
${P(`nav.settingsLoadFailed`)}
<button
class="btn btn--sm"
type="button"
@click=${()=>e.retrySettingsSidebarRenderer()}
>
${P(`common.retry`)}
</button>
</div>`:Uw(t)}
</aside>`}function Uw(e){let t=Fc(!!e.canAdmin,e.nativeDeviceSettings??null);return F`<div class="settings-sidebar__agent" aria-hidden="true">
<span class="skeleton settings-sidebar__loading-agent"></span>
</div>
<div class="settings-sidebar__search" aria-hidden="true">
<span class="skeleton settings-sidebar__loading-search"></span>
</div>
<div
class="settings-sidebar__nav settings-loading-skeleton settings-sidebar__loading"
role="status"
aria-busy="true"
aria-label=${P(`common.loading`)}
>
${t.map(e=>F`<div class="settings-sidebar__group" aria-hidden="true">
${e.labelKey?F`<span class="skeleton settings-sidebar__loading-group-label"></span>`:I}
${e.routes.map(()=>F`<span class="settings-sidebar__item settings-sidebar__loading-item">
<span class="skeleton settings-sidebar__loading-icon"></span>
<span class="skeleton settings-sidebar__loading-label"></span>
</span>`)}
</div>`)}
</div>`}function Ww(){return(Ww=e((()=>{L(),rl(),ul(),w(),El()})))()}function Gw(e,t){if(!t.open)return I;let n=e.devicePairSetupRenderer;if(n)return n(t);let r=e.devicePairSetupLoadFailed;r||e.loadDevicePairSetupRenderer();let i=P(`devices.pairing.title`),a=P(r?`devices.pairing.loadFailed`:`common.loading`);return F`<openclaw-modal-dialog
label=${i}
description=${a}
@modal-cancel=${t.onClose}
>
<section class="device-pair-setup" aria-busy=${r?I:`true`}>
<header class="device-pair-setup__header">
<div>
<h2>${i}</h2>
<p role=${r?I:`status`}>${a}</p>
</div>
</header>
<footer class="device-pair-setup__footer">
${r?F`<button
class="btn btn--primary"
type="button"
@click=${()=>e.retryDevicePairSetupRenderer()}
>
${P(`common.retry`)}
</button>`:I}
<button class="btn btn--ghost" type="button" @click=${t.onClose}>
${P(`common.close`)}
</button>
</footer>
</section>
</openclaw-modal-dialog>`}function Kw(){return(Kw=e((()=>{L(),w()})))()}function qw(e,t,n,r,i){let a=e.gateway.snapshot,o=a.phase===`connected`;return F` <openclaw-browser-panel
?inert=${t}
data-chat-autotype-exempt
.client=${o?a.client:null}
.available=${Wb(a)}
.remoteAvailable=${Hb(a)}
.suppressed=${n}
.resourceBasePath=${e.resourceBasePath}
.authToken=${j_({hello:a.hello,settings:{token:e.gateway.connection.token},password:e.gateway.connection.password})}
></openclaw-browser-panel>
<openclaw-desktop-panel
?inert=${t}
data-chat-autotype-exempt
.client=${o?a.client:null}
.available=${Gb(a)}
.suppressed=${n||i===`systems`}
.basePath=${e.basePath}
></openclaw-desktop-panel>
<openclaw-link-reader-panel
?inert=${t}
data-chat-autotype-exempt
.client=${o?a.client:null}
.available=${o}
.readers=${Xv(a)}
.agentId=${r}
.suppressed=${n}
></openclaw-link-reader-panel>`}function Jw(){return(Jw=e((()=>{L(),P_(),$v(),Jb()})))()}function Yw(e,t,n,r){let i=e.lazyCustomElements.visibleState,a=e.context?.theme.settings;return F`
${e.commandPaletteLoading.active&&(!i||i.status===`loading`&&i.element===e.commandPaletteElement)?nS(e.commandPaletteLoading,()=>e.closePendingPalette()):i?.element===pu?Re(e,i):Ad(e.lazyCustomElements)}
${lu(e.commandPaletteElement)?F`<openclaw-command-palette
.desktopAvailable=${t}
.custodianAvailable=${n}
.onNavigate=${(t,n)=>e.navigate(t,n)}
.onSelectSession=${t=>e.selectChatSession(t)}
.onSlashCommand=${t=>e.handleCommandPaletteSlashCommand(t)}
></openclaw-command-palette>`:I}
${lu(pu)?xt:I}
${!r&&lu(mu)?F`<openclaw-keyboard-shortcuts-dialog
.sendShortcut=${jg(a?.chatSendShortcut)}
.newSessionHost=${e}
></openclaw-keyboard-shortcuts-dialog>`:I}
`}function Xw(){return(Xw=e((()=>{L(),Nd(),Zr(),aS(),ju(),Vg()})))()}function Zw(){return F`<openclaw-tooltip
.content=${`${P(`assistantPanel.toggle`)} (${ri(N.homePanel)})`}
>
<button
type="button"
class="shell-chrome-controls__button shell-chrome-controls__home"
aria-label=${P(`assistantPanel.toggle`)}
@click=${()=>window.dispatchEvent(new CustomEvent(Vd))}
>
${Tl.home}
</button>
</openclaw-tooltip>`}function Qw(){return(Qw=e((()=>{L(),El(),Jd(),w(),zt()})))()}function $w(e){let t=e.context,n=e.runtime,r=e.viewCallbacks;if(!t||!n)return I;if(e.routeState.routeId===void 0&&!e.routeState.routeFailed)return wd();let i=t.gateway.snapshot,a=t.config.current,o=i.phase===`connected`,s=Jf(i),l=t.navigation.snapshot,u=t.overlays.snapshot,d=u.controlUiRefreshRequired,f=[...e.querySelectorAll(`openclaw-chat-pane`)].some(e=>e.conversationPresented&&e.historyRecovering),p=rn(i,d,f),m=Dp(t.gateway),h=!m.readyOnce&&!i.offlineStable&&(p===`connecting`||p===`starting`||p===`restoring`),g=u.updateRunning||u.updateReconciliationPending,_=r.watchUpdateProgress,v=c(i,a.terminalEnabled??!1),y=Gb(i),b=Kb(t.gateway),x=zi(i,`openclaw.chat`,`operator.admin`),S=e.routeState.routeId??`chat`,C=xs(S),w=i.phase===`reload-required`,T=!w&&!o&&!C&&S!==`new-session`&&S!==`appearance`&&S!==`connection`,E=S===`plugin`?Je(e.routeState.location?.search??``,e.routeState.location?.pathname,t.basePath):null,D=lc(),O=D&&S===`settings`,ee=D&&(S===`settings`||Ic(S)||S===`skills`||S===`cron`),te=Lc(S)&&!e.onboardingMode&&!D,k=t.runtimeConfig.state,A=e.onboardingMode,re=A&&S!==`custodian`;e.lazyCustomElements.requestWhileActive(e.onboardingMemoryImportElement,re);let ie=e.navDrawerOpen&&!A&&!D,j=xS(),ae=sc()&&!D;ae&&!A&&e.lazyCustomElements.preload(vu,{reportError:!0});let M=CS({mobileNavLayout:j,routeId:S,onboarding:A}),oe=!D&&l.navCollapsed&&!e.desktopNavigationExpanded&&!ie&&!te,se=RS({onboarding:A,navCollapsed:oe,navDrawerOpen:ie,mobileNavLayout:j}),ce=!D&&zS({navigationSurfaceHidden:se,mobileNavLayout:j,onboarding:A,compact:M});!D&&(A||ce)&&e.lazyCustomElements.preload(yu,{reportError:!0});let le=Math.max(globalThis.innerWidth||0,400),ue=e.newSessionRouteAgentId(),de=ue?G(ue):null,fe=de!==null&&t.agents.state.agentsList?.agents.some(e=>G(e.id)===de)===!0?de:G(t.agentSelection.state.selectedId??i.assistantAgentId),pe=Xe(i,{method:`sessions.create`,params:{},sessionScope:!0}),me=r.requestOpenNewSession,he=t.theme.settings,ge=C||S===`new-session`||S===`systems`;!te&&!D&&Object.assign(e.navigationSidebar,{basePath:t.basePath,activeRouteId:S,router:e.runtime.router,activePluginTabId:E?ne(E):``,enabledRouteIds:Gs,sessionKey:e.activeSessionKey,connected:o,connectionStatus:p,lastError:i.lastError,storedOutboxes:e.storedOutboxes,terminalAvailable:v,catalogOpenTarget:Fg(he.catalogOpenTarget),canPairDevice:o&&(s.canAdmin||s.canPair),preferencesBrowserOnly:o&&t.runtimeConfig.canPatch===!1,sidebarEntries:l.sidebarEntries,navigationVisible:!se,sidebarAgentsMode:he.sidebarAgentsMode??`chip`,sidebarLiveActivity:he.sidebarLiveActivity!==!1,pinnedAgentIds:l.pinnedAgentIds,themeMode:t.theme.mode,gatewayVersion:a.serverVersion??i.hello?.server?.version??null,devGitBranch:a.devGitBranch,watchUpdateProgress:_,onOpenPalette:e.openPalette,onRetryConnect:r.retryGateway,onToggleSidebar:r.toggleSidebar,onOpenNewSession:me,onUpdateSidebarEntries:r.updateSidebarEntries,onPairMobile:r.openDevicePairSetup,onNavigate:e.navigate,onPreloadRoute:r.preloadRoute});let _e=D&&(cc()?.surface!==`conversation`||S!==`chat`),ve=!D&&oe&&!A&&!te&&!j,ye=(se||(te?e.settingsSidebarRenderer===null:!lu(gu)))&&!D&&!A&&!h?p:null,be={navigationSurfaceHidden:se,mobileNavLayout:j,onboarding:A,compact:M&&!d,statusBanner:u.updateStatusBanner,updateRun:u.updateRun,refreshRequired:d,onRefresh:e.refreshControlUi,onNavigate:e.navigate},xe=te||_e?Hw(e,{presentation:D?O?`embed-list`:`embed-page`:`sidebar`,basePath:t.basePath,activeRouteId:S,agents:t.agents.state.agentsList?.agents??[],agentIdentity:t.agentIdentity,settingsAgentSelection:t.settingsAgentSelection,activePathname:e.routeState.location?.pathname??``,activeSearch:e.routeState.location?.search??``,activeHash:e.routeState.location?.hash??``,connectionStatus:p,lastError:i.lastError,gatewayVersion:a.serverVersion??i.hello?.server?.version??``,searchQuery:O?``:e.settingsSearchQuery,searchParams:{query:e.settingsSearchQuery,schema:k.configSchema,value:k.configForm??k.configSnapshot?.config??null,uiHints:k.configUiHints,identityAvailable:!!i.selfUser,multipleProfiles:i.hello?.policy?.hasMultipleSessionSharingIdentities===!0,basePath:t.basePath,canAdmin:s.canAdmin,nativeDeviceSettings:t.nativeDeviceSettings},onExit:()=>{D?vc()?window.history.back():S===`memory-import`?t.replace(`memory`):e.navigate(`settings`):e.exitSettings()},onRetryConnect:r.retryGateway,onNavigate:e.navigate,onPreload:r.preloadRoute,onSearchQueryChange:t=>void e.handleSettingsSearchQueryChange(t),preloadTimers:e.settingsPreloadTimers,saveIndicator:{status:k.configRecoveryError?`recovery`:k.configAutoSaveStatus,lastError:k.configRecoveryError??k.lastError,needsApply:k.configNeedsApply,applying:k.configApplying,applyDisabled:t.runtimeConfig.canApply===!1||k.configLoading||k.configSaving||k.configFormDirty&&k.configFormMode===`raw`||g,onRetry:()=>void t.runtimeConfig.retry(),onSave:()=>void t.runtimeConfig.save(),onReload:()=>void t.runtimeConfig.discardDraft(),onApply:()=>void t.runtimeConfig.apply()},canAdmin:s.canAdmin,nativeDeviceSettings:t.nativeDeviceSettings}):e.navigationSidebar,Se=F`
${Yw(e,y,x,D)}
<div
class="shell ${ge?`shell--chat`:``} ${oe?`shell--nav-collapsed`:``} ${j?`shell--mobile-nav`:``} ${M?`shell--merged-chat-chrome`:``} ${ie?`shell--nav-drawer-open`:``} ${A?`shell--onboarding`:``} ${D?`shell--embed`:``} ${ee?`shell--embed-settings`:``} ${te?`shell--settings`:``} ${ve&&b?`shell--home-control`:``} ${ye?`shell--connection-status`:``} ${zS(be)?`shell--floating-attention`:``} ${e.navResizing?`shell--nav-resizing`:``}"
style=${`--shell-nav-expanded-width: ${l.navWidth}px`}
@theme-change=${t=>e.handleThemeChange(t)}
>
<a class="shell-skip-link" href="#control-ui-main" ?inert=${ie}>
${P(`common.skipToMainContent`)}
</a>
${ae&&!A?F`
<openclaw-macos-titlebar-controls
?inert=${ie}
.navCollapsed=${e.nativeNavCollapsed()}
.historyOnly=${te}
.canGoBack=${e.nativeHistoryState.canGoBack}
.canGoForward=${e.nativeHistoryState.canGoForward}
.newSessionDisabledReason=${pe.allowed?void 0:pe.reason}
.onToggleSidebar=${r.toggleSidebar}
.onOpenPalette=${e.openPalette}
.onOpenNewSession=${e.handleNativeNewSession}
></openclaw-macos-titlebar-controls>
`:I}
${D?I:F`<openclaw-app-topbar
?inert=${ie}
.resourceBasePath=${t.resourceBasePath}
.environment=${a.environment}
.navDrawerOpen=${ie}
.onOpenPalette=${e.openPalette}
.onToggleDrawer=${e.toggleNavigationSurface}
></openclaw-app-topbar>`}
${ve?F`
<div class="shell-chrome-controls">
<openclaw-tooltip
.content=${`${P(`nav.expand`)} (${ri(N.toggleSidebar)})`}
>
<button
type="button"
class="shell-chrome-controls__button shell-chrome-controls__nav-toggle"
aria-label=${P(`nav.expand`)}
aria-expanded="false"
data-env-avatar=${a.environment?a.assistantIdentity.name.charAt(0):I}
@click=${r.toggleSidebar}
>
${Tl.panelLeftOpen}
</button>
</openclaw-tooltip>
${Bw({basePath:t.basePath,agentId:fe,className:`shell-chrome-controls__button shell-chrome-controls__new-thread`,label:P(`chat.runControls.newSession`),showShortcut:!0,disabledReason:pe.allowed?void 0:pe.reason,onOpen:me})}
<openclaw-tooltip
.content=${`${P(`chat.openCommandPalette`)} (${ri(N.commandPalette)})`}
>
<button
type="button"
class="shell-chrome-controls__button shell-chrome-controls__search"
aria-label=${P(`chat.openCommandPalette`)}
@click=${e.openPalette}
>
${Tl.search}
</button>
</openclaw-tooltip>
${b?Zw():I}
</div>
`:I}
${D?I:F`<button
type="button"
class="shell-nav-backdrop"
tabindex="-1"
aria-hidden="true"
?inert=${!ie}
@click=${()=>e.closeNavDrawer({restoreFocus:!0})}
></button>
<div
class="shell-nav ${j?`nav-drawer`:``}"
role=${j?`dialog`:I}
aria-modal=${j&&ie?`true`:I}
aria-label=${j?P(`palette.categories.navigation`):I}
aria-hidden=${j&&se?`true`:I}
tabindex=${j?-1:I}
?inert=${se}
>
${xe}
</div>`}
${!D&&!oe&&!A&&!te?F`
<resizable-divider
class="sidebar-resizer"
.label=${P(`nav.resize`)}
.splitRatio=${l.navWidth/le}
.minRatio=${240/le}
.maxRatio=${400/le}
aria-valuetext=${`${l.navWidth} pixels`}
title=${P(`nav.resize`)}
@resize-start=${()=>{e.navResizing=!0}}
@resize-end=${()=>{e.navResizing=!1}}
@resize=${t=>e.resizeNavigation(t.detail.splitRatio)}
></resizable-divider>
`:I}
<main
id="control-ui-main"
class="content ${ge?`content--chat`:``} ${S===`custodian`?`content--custodian`:``} ${S===`workboard`?`content--workboard`:``} ${T?`content--actions-blocked`:``} ${e.shellLayout.className}"
${Di(e.shellLayout.contentRef)}
.tabIndex=${-1}
@mousedown=${cl}
?inert=${!D&&T||j&&ie}
>
${T?F`<div class="connection-action-block" role="status" aria-live="polite">
<span class="connection-action-block__icon" aria-hidden="true"
>${Tl.globeOff}</span
>
<span class="connection-action-block__text">
${P(te?`connection.settingsChangesUnavailable`:`connection.actionsUnavailable`)}
</span>
</div>`:I}
${BS(be)}
${_e?xe:I}
<openclaw-router-outlet
?inert=${T||w}
aria-disabled=${T||w?`true`:I}
.router=${n.router}
.retryContext=${t}
.retryEnabled=${o}
.retentionScope=${m}
.onNotFound=${e.recoverNotFoundRoute}
.notFoundRecoveryReady=${o}
></openclaw-router-outlet>
</main>
${ye?F`<div class="shell-connection-status">
${Rw({kind:ye,lastError:i.lastError,onRetry:r.retryGateway})}
</div>`:I}
<openclaw-terminal-panel
?inert=${ie}
.client=${o?i.client:null}
.available=${v}
.agentId=${fe}
.sessionKey=${C?e.activeSessionKey:null}
.suppressed=${te||D}
.themeMode=${t.theme.resolvedMode}
.basePath=${t.basePath}
></openclaw-terminal-panel>
${C?I:qw(t,ie,te||D,fe,S)}
<openclaw-assistant-panel
?inert=${ie}
.custodianAvailable=${x&&!D}
.homeAvailable=${b&&!D}
.custodianSuppressed=${S===`custodian`}
.pageSessionKey=${e.activeSessionKey}
.pageAgentId=${fe}
.pageRouteId=${S}
.pageRouteFailed=${e.routeState.routeFailed===!0}
.minimizeRequestId=${e.custodianMinimizeRequestId}
></openclaw-assistant-panel>
${lu(e.execApprovalElement)?F`<openclaw-exec-approval
.props=${{queue:u.approvalQueue,busy:u.approvalBusy,canGrant:u.approvalCanGrant,errors:u.approvalErrors,onDecision:(e,n)=>t.overlays.decideApproval(n,e)}}
></openclaw-exec-approval>`:I}
${Gw(e,{open:u.devicePairSetupOpen,lifecycle:u.devicePairSetupLifecycle,nowMs:Date.now(),pendingCount:u.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`)}})}
${re&&lu(e.onboardingMemoryImportElement)?F`<openclaw-onboarding-memory-import
.active=${!0}
.context=${t}
></openclaw-onboarding-memory-import>`:I}
<openclaw-toast-host></openclaw-toast-host>
</div>
`;return S===`plugins`||S===`plugin-settings`?Se:Tn(`workspace`,{sessionKey:e.activeSessionKey,agentId:$e({assistantAgentId:t.agentSelection.state.selectedId??i.assistantAgentId,agentsList:t.agents.state.agentsList,hello:i.hello},e.activeSessionKey),routeId:S},Se)}function eT(){return(eT=e((()=>{L(),ki(),rl(),Y(),qp(),zw(),El(),Td(),Vw(),Ww(),w(),Vi(),zt(),A(),Be(),Vn(),l(),ir(),Kw(),Jw(),Xw(),bc(),Ap(),ju(),OS(),fc(),ul(),HS(),np(),Jb(),Vg(),Qw()})))()}function tT(e){try{il()?.webkit?.messageHandlers?.openclawNav?.postMessage({type:`nav-state`,...e})}catch{}}function nT(){return(nT=e((()=>{})))()}function rT(e){return typeof Reflect.get(e,`restartAfterTeardown`)==`function`&&typeof Reflect.get(e,`teardown`)==`function`}function iT(e,t=`mcp-app-view`){let n=new Set;for(let r of e){r instanceof Element&&r.matches(t)&&rT(r)&&n.add(r);for(let e of r.querySelectorAll(t))rT(e)&&n.add(e)}return[...n]}var aT;function oT(){return(oT=e((()=>{aT=class{constructor(e,t=`mcp-app-view`){this.host=e,this.selector=t,this.renderedKey=null,this.pending=!1,this.restartTargets=null}get retiring(){return this.pending||this.restartTargets!==null}apply(e,t){return this.renderedValue=t(),this.renderedKey=e,this.renderedValue}render(e,t,n,r={}){if(this.pending)return this.renderedValue;if(this.restartTargets){let n=this.restartTargets;return this.restartTargets=null,queueMicrotask(()=>{for(let e of n)e.isConnected&&e.restartAfterTeardown()}),this.renderedKey===e&&r.retainRenderedValue?this.renderedValue:this.apply(e,t)}if(this.renderedKey===e&&r.retainRenderedValue)return this.renderedValue;if(this.renderedKey===null||this.renderedKey===e)return this.apply(e,t);let i=iT(n(),this.selector);return i.length===0?this.apply(e,t):(this.pending=!0,Promise.allSettled(i.map(e=>e.teardown())).then(()=>{this.pending=!1,this.restartTargets=i,this.host.requestUpdate()}),this.renderedValue)}}})))()}function sT(e){return typeof e==`object`&&!!e&&`render`in e&&typeof e.render==`function`}function cT(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 lT(e){if(!e)return()=>{};let t=e.textContent;return e.disabled=!0,e.textContent=P(`lazyView.reloading`),()=>{e.disabled=!1,e.textContent=t}}function uT(e,t,n,r,i){if(wi(n))return Od();let a=Hl(n);a&&Kl();let o=()=>{t!==void 0&&e.revalidate(t,r).catch(()=>void 0)};return jd({error:n,onRetry:e=>{if(!a){o();return}let t=lT(e.currentTarget instanceof HTMLButtonElement?e.currentTarget:null);Jl().then(e=>{e||t()})},render:i,stale:a})}function dT(e,t,n,r={}){if(!n||n.status===`notFound`||n.status===`redirected`)return I;let i=n.routeId;if(!n.module)return n.error?uT(e,r.retryContext,n.error,i):t.showPending?Ed():I;let a=n.module;if(!sT(a))return n.error?uT(e,r.retryContext,n.error,i):null;let o=()=>cT(i,()=>r.presented===!1?a.render(n.data,n.isFetching===`loader`,!1):a.render(n.data,n.isFetching===`loader`));return n.error?uT(e,r.retryContext,n.error,i,a.retainOnNavigate?void 0:o):o()}var fT,pT,mT;function hT(){return(hT=e((()=>{L(),Li(),Ri(),ki(),Y(),Nd(),Dd(),oT(),w(),Fe(),qe(),ff(),su(),fT=class{constructor(e,t){this.inputs=t,this.controller=new df(()=>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()}},pT=class extends g{constructor(...e){super(...e),this.ownerKey=``,this.renderPage=()=>I,this.presentedValue=!1}get presented(){return this.presentedValue}set presented(e){let t=this.presentedValue;this.presentedValue=e,this.style.display=e?`contents`:`none`,this.toggleAttribute(`inert`,!e),this.setAttribute(`aria-hidden`,e?`false`:`true`),this.requestUpdate(`presented`,t)}render(){return this.renderPage(this.presented)}},U([B({attribute:!1})],pT.prototype,`ownerKey`,void 0),U([B({attribute:!1})],pT.prototype,`renderPage`,void 0),U([B({attribute:!1})],pT.prototype,`presented`,null),mT=class extends g{constructor(...e){super(...e),this.retryEnabled=!0,this.outlet=new fT(this,()=>({router:this.router,onNotFound:this.onNotFound,notFoundRecoveryReady:this.notFoundRecoveryReady,retryContext:this.retryContext,retryEnabled:this.retryEnabled})),this.retainedUnmountGate=new aT(this),this.transientUnmountGate=new aT(this),this.retainedPresentation=Ai(),this.retainedPresented=!1,this.scopeInitialized=!1,this.scopeGeneration=0,this.scopeRefreshing=!1,this.retiredSessionMatches=new Set}synchronizeRetentionScope(e){let t=this.scopeRouter!==e,n=this.scopeInitialized&&(t||this.scopeOwner!==this.retentionScope);if(this.scopeInitialized=!0,this.scopeRouter=e,this.scopeOwner=this.retentionScope,!n)return;let r=++this.scopeGeneration;if(this.retainedMatch=void 0,this.retainedOwnerKey=void 0,this.retainedPresented=!1,this.scopeRefreshing=!1,this.retiredSessionMatches=new Set(t?[]:[...e.getState().matches,...e.getState().pendingMatches].filter(e=>xs(e.routeId)).map(e=>e.id)),t)return;let i=this.retryContext,a=this.retentionScope,o=e.getState(),s=o.pendingMatches[0]??o.matches[0];i!==void 0&&s&&xs(s.routeId)&&(this.scopeRefreshing=!0,e.navigate(s.routeId,i,{history:`none`,revalidate:!0},s.location).finally(()=>{this.router===e&&this.retentionScope===a&&this.scopeGeneration===r&&(this.scopeRefreshing=!1,this.requestUpdate())}).catch(()=>void 0))}render(){let e=this.router;if(!e)return I;let t=this.outlet.snapshot,n=sf(t.active,t.pending);this.synchronizeRetentionScope(e);let r=n?.status===`success`&&n.error===void 0,i=n!==void 0&&this.retiredSessionMatches.has(n.id),a=!this.scopeRefreshing&&!i,o=n?`${n.routeId}:${n.status}`:`empty`,s=n?.module,c=sT(s)?s:void 0,l=n?c?.renderOwnerKey?.(n,t.settled):void 0,u=n?.error===void 0?l:void 0,d=n?.status===`pending`||n?.isFetching===`loader`,f=d&&this.retainedPresented&&this.retainedOwnerKey===u,p=a&&c?.retainOnNavigate===!0&&u!==void 0&&(r||f);p&&r?(this.retainedMatch=n,this.retainedOwnerKey=u):(t.status===`idle`||a&&c?.retainOnNavigate&&!d)&&(this.retainedMatch=void 0,this.retainedOwnerKey=void 0),this.retainedPresented=p;let m=this.retainedMatch,h=`${this.scopeGeneration}:${this.retainedOwnerKey??`empty`}`,g=p?`empty`:u??o,_=()=>t.startupPending?Od():xs(n?.routeId)&&!a?!i&&n?.error!==void 0?uT(e,this.retryContext,n.error,n.routeId):Ed():c?.retainOnNavigate&&d?n?.routeId===`chat`&&t.settled?.routeId===`new-session`?dT(e,t,t.settled,{retryContext:this.retryContext}):Ed():dT(e,t,n,{retryContext:this.retryContext}),v=F`
${this.retainedUnmountGate.render(h,()=>m?Pi(h,F`<openclaw-route-presentation
${Di(this.retainedPresentation)}
.ownerKey=${h}
.presented=${p}
.renderPage=${n=>dT(e,t,m,{retryContext:this.retryContext,presented:n})}
></openclaw-route-presentation>`):I,()=>this.retainedPresentation.value?[this.retainedPresentation.value]:[])}
${this.transientUnmountGate.render(g,()=>p?I:_(),()=>[...this.children].filter(e=>e!==this.retainedPresentation.value),{retainRenderedValue:!c?.retainOnNavigate&&u!==void 0&&n?.status===`pending`&&n.data===void 0})}
${p&&this.retainedUnmountGate.retiring?Ed():I}
`;return this.retainedPresentation.value&&(this.retainedPresentation.value.presented=p&&!this.retainedUnmountGate.retiring&&this.retainedPresentation.value.ownerKey===h),v}},U([B({attribute:!1})],mT.prototype,`router`,void 0),U([B({attribute:!1})],mT.prototype,`retryContext`,void 0),U([B({attribute:!1})],mT.prototype,`onNotFound`,void 0),U([B({attribute:!1})],mT.prototype,`notFoundRecoveryReady`,void 0),U([B({attribute:!1})],mT.prototype,`retryEnabled`,void 0),U([B({attribute:!1})],mT.prototype,`retentionScope`,void 0),customElements.get(`openclaw-route-presentation`)||customElements.define(`openclaw-route-presentation`,pT),customElements.get(`openclaw-router-outlet`)||customElements.define(`openclaw-router-outlet`,mT)})))()}var gT;function _T(){return(_T=e((()=>{Li(),rl(),$u(),Zd(),of(),Y(),hd(),w(),ar(),pr(),ht(),Be(),Xn(),qe(),s(),ot(),gf(),kx(),GS(),xw(),jw(),Iw(),eT(),o_(),B_(),ju(),nT(),fc(),hT(),dC(),_w(),K_(),Vg(),Rp(),su(),K(),Un.setLocaleLoadRecovery({isUnrecoverableError:Hl,onUnrecoverableLocaleLoad:()=>{Kl()}}),gT=class extends g{loadSettingsSidebarRenderer(){this.settingsSidebarRuntime??=W(()=>import(`./settings-sidebar-C4XbE7eb.js`).then(e=>{this.settingsSidebarRenderer=e.renderSettingsSidebar,this.settingsSidebarLoadFailed=!1}),__vite__mapDeps([105,1,12,3,2,4,5,8,7,6,9,11,13,14,15,93,25,106,107,10,108,109,28,29,30,31]),import.meta.url).catch(()=>{this.settingsSidebarLoadFailed=!0,this.settingsSidebarRuntime=null})}retrySettingsSidebarRenderer(){this.settingsSidebarLoadFailed=!1,this.loadSettingsSidebarRenderer()}loadSidebarUpdateCard(){this.sidebarUpdateCardImport.load().catch(e=>{Hl(e)&&Kl()})}loadDevicePairSetupRenderer(){this.devicePairSetupRuntime??=W(()=>import(`./view-pairing.runtime-DT3f5Mzn.js`).then(e=>{this.devicePairSetupRenderer=e.renderDevicePairSetup,this.devicePairSetupLoadFailed=!1}),__vite__mapDeps([110,1,11,3,2,4,5,8,7,6,9,12,13,14,15,111,28,29,30,31]),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:jp(e)}get workspaceChromeVisible(){let e=this.routeState.routeId;return e!==void 0&&!Ic(e)&&!this.onboardingMode}storedOutboxScopeHost(e){let t=e.gateway.snapshot;return{client:t.client,connected:t.phase===`connected`,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=Mn(n),i=y(n)?Si(t):r?.rest===T(t)?G(r.agentId):void 0,a=i?e.agents.state.agentsList?.agents.find(e=>G(e.id)===i):void 0;return a?Dn(a):Ne(n,e.sessions.presentation.result?.sessions.find(e=>e.key===n))}constructor(){super(),this.onboarding=!1,this.navDrawerOpen=!1,this.navResizing=!1,this.shellLayout=new Lp(this),this.desktopNavigationExpanded=!1,this.activeSessionKey=``,this.settingsSearchQuery=``,this.routeState={},this.nativeHistoryState=uc(),this.commandPaletteElement=fu,this.terminalPanelElement=bu,this.browserPanelElement=xu,this.linkReaderPanelElement=wu,this.desktopPanelElement=Cu,this.execApprovalElement=ku,this.onboardingMemoryImportElement={tagName:`openclaw-onboarding-memory-import`,label:P(`onboarding.memoryImport.title`),loadModule:()=>W(()=>import(`./onboarding-memory-import-DPGJSUnb.js`),__vite__mapDeps([112,1,5,4,28,113]),import.meta.url)},this.lazyCustomElements=new du(this,()=>this.shellChrome.cancelPendingLazyAction(),e=>this.shellChrome.retryPendingLazyAction(e)),this.queryRenderedElement=e=>this.renderRoot?.querySelector(e)??null,this.navDrawerTrigger=null,this.navigationSidebar=document.createElement(gu.tagName),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.agentRosterRefreshTimer=null,this.outboxStoreRuntime=null,this.outboxStoreUnsubscribe=null,this.lastDeletedSessions=null,this.outboxStoreImport=Or(()=>W(()=>import(`./control-ui-boot-shared-DJkUdZmL.js`).then(e=>(e.Mi(),e.Pi)).then(e=>e.createStoredChatOutboxReader()),__vite__mapDeps([11,1,3,2,4,5,8,7,6,9,12,13,14,15,28,29,30,31]),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=Or(()=>W(()=>import(`./sidebar-update-runtime-DonYLwN5.js`).then(e=>(e.t(),e.n)),__vite__mapDeps([15,1,11,3,2,4,5,8,7,6,9,12,13,14,28,29,30,31]),import.meta.url)),this.devicePairSetupRenderer=null,this.devicePairSetupLoadFailed=!1,this.devicePairSetupRuntime=null,this.subscriptions=new In(this),this.shellNavigation=new Aw(this),this.shellChrome=new WS(this),this.shellGateway=new bw(this),this.viewCallbacks=Fw(this),this.reconcileServerUiPrefs=this.shellGateway.reconcileServerUiPrefs.bind(this.shellGateway),this.reconcileCommittedServerUiPrefs=this.shellGateway.reconcileCommittedServerUiPrefs.bind(this.shellGateway),this.refreshStoredOutboxPresentation=()=>{this.refreshStoredOutboxSummary(),this.requestUpdate()},this.selectChatSession=this.shellNavigation.selectChatSession.bind(this.shellNavigation),this.handleGatewayEvent=this.shellGateway.handleGatewayEvent.bind(this.shellGateway),this.handleThemeChange=e=>{let t=this.context;t&&t.theme.setMode(e.detail.mode,e.detail.element)},this.chatNavigationOptions=this.shellNavigation.chatNavigationOptions.bind(this.shellNavigation),this.navigate=this.shellNavigation.navigate,this.recoverNotFoundRoute=this.shellNavigation.recoverNotFoundRoute.bind(this.shellNavigation),this.recoverDeletedActiveSession=this.shellNavigation.recoverDeletedActiveSession.bind(this.shellNavigation),this.exitSettings=this.shellNavigation.exitSettings.bind(this.shellNavigation),this.toggleNavigationSurface=this.shellChrome.toggleNavigationSurface,this.closeNavDrawer=this.shellChrome.closeNavDrawer,this.resizeNavigation=this.shellChrome.resizeNavigation,this.openNewSession=this.shellNavigation.openNewSession.bind(this.shellNavigation),this.handleNativeToggleSidebar=this.shellChrome.handleNativeToggleSidebar,this.handleNativeOpenSearch=this.shellChrome.handleNativeOpenSearch,this.handleNativeToggleSearch=this.shellChrome.handleNativeToggleSearch,this.handleNativeNewSession=this.shellChrome.handleNativeNewSession,this.handleNativeNavigate=this.shellChrome.handleNativeNavigate,this.handleNativeHistoryState=this.shellChrome.handleNativeHistoryState,this.handleWindowResize=this.shellChrome.handleWindowResize,this.handleDocumentKeydown=this.shellChrome.handleDocumentKeydown,this.togglePendingDebugOverlayMode=this.shellChrome.togglePendingDebugOverlayMode.bind(this.shellChrome),this.openPalette=this.shellChrome.openPalette,this.closePendingPalette=this.shellChrome.closePendingPalette,this.refreshControlUi=()=>{let e=this.context;return e?Jl({timeoutMs:0,...R_(e.gateway,()=>this.context===e&&e.overlays.snapshot.controlUiRefreshRequired)}):Promise.resolve(!1)},this.handleShellNavDrawerToggle=this.shellChrome.handleShellNavDrawerToggle,this.handleCommandPaletteSlashCommand=this.shellChrome.handleCommandPaletteSlashCommand,this.restorePendingLazyAction=this.shellChrome.restorePendingLazyAction,this.nativeNavCollapsed=this.shellChrome.nativeNavCollapsed,this.newSessionRouteAgentId=this.shellNavigation.newSessionRouteAgentId.bind(this.shellNavigation),this.updateRouteState=this.shellNavigation.updateRouteState.bind(this.shellNavigation),this.subscriptions.effect(()=>this.context,e=>(this.pendingNativeNewSession&&(this.pendingNativeNewSession=!1,this.handleNativeNewSession()),()=>{this.context!==e&&this.resetForContextEpoch()})).effect(()=>this.context,e=>{let t=Date.now(),n=!0,r,i=Or(()=>W(()=>import(`./control-ui-boot-shared-xfDhIVun.js`).then(e=>(e.aa(),e.ia)),__vite__mapDeps([12,1,3,2,4,5,8,7,6,9,11,13,14,15,28,29,30,31]),import.meta.url),({connectControlUiFavicon:i})=>{n&&(r=i(this,e,t))});return i.schedule(),()=>{n=!1,i.dispose(),r?.()}}).watchStore(()=>this.context?.nativeDeviceSettings).watchStore(()=>this.context?.navigation).watchStore(()=>this.context?.plugins).watchStore(()=>this.context?.agentSelection).watchStore(()=>this.context?.settingsAgentSelection).watchStore(()=>this.context?.agentIdentity).watchStore(()=>this.context?.gateway,e=>{this.shellChrome.synchronizeCommandPaletteScope(),this.shellGateway.synchronizeGateway(e.snapshot),this.refreshStoredOutboxSummary()}).effect(()=>this.context?.gateway,e=>e.subscribeEvents(this.handleGatewayEvent)).watchStore(()=>this.context?.config).watchStore(()=>this.context?.theme).watchStore(()=>this.context?.agents,e=>{this.refreshStoredOutboxSummary();let t=this.context?.gateway.snapshot;t&&this.ensureAgentsList(t,e)}).effect(()=>this.runtime?.router,e=>(this.updateRouteState(mf(e.getState())),e.subscribeSelector(mf,e=>this.updateRouteState(e),hf))).watchStore(()=>this.context?.overlays).effect(()=>this.context?.sessions,e=>this.shellGateway.observeSessions(e,()=>this.syncDocumentTitle())).watchStore(()=>this.context?.placementStartup,()=>{this.context&&this.recoverDeletedActiveSession(this.context.sessions.state)}).watch(()=>this.context?.runtimeConfig,(e,t)=>e.subscribe(()=>{this.reconcileServerUiPrefs(e),t()}),e=>{let t=this.context?.gateway.snapshot;t&&this.ensureRuntimeConfig(t,e),this.reconcileServerUiPrefs(e)})}connectedCallback(){super.connectedCallback(),this.outboxStoreRuntime&&this.installOutboxStoreRuntime(this.outboxStoreRuntime),this.outboxStoreImport.schedule(),this.shellChrome.connect(),dg((e,t)=>{if(qC())return;let n=oC(e,t),r=this.context?.runtimeConfig;n&&r&&$C(r,n,{profile:this.context?.gateway.snapshot,afterCommit:({needsRefresh:e,retainedLocal:t})=>this.reconcileCommittedServerUiPrefs(r,e,t)})})}disconnectedCallback(){this.shellChrome.disconnect(),e_(),this.outboxStoreImport.dispose(),this.sidebarUpdateCardImport.dispose(),this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=null,this.lastLocalePrefSignature=null,dg(null),this.resetForDocumentDisconnect(),super.disconnectedCallback()}installOutboxStoreRuntime(e){this.outboxStoreRuntime=e,e.invalidate(),this.isConnected&&(this.outboxStoreUnsubscribe?.(),this.outboxStoreUnsubscribe=e.subscribe(this.refreshStoredOutboxPresentation),this.refreshStoredOutboxPresentation())}refreshStoredOutboxSummary(){let e=this.context;this.storedOutboxes=e?this.outboxStoreRuntime?.read(this.storedOutboxScopeHost(e)):void 0,e?.nativeConversation?.publishSessionFacts(this.storedOutboxes?.sessions??null)}resetForContextEpoch(){this.shellChrome.abandonPendingLazyActionForContext(),this.resetShellState()}resetForDocumentDisconnect(){this.shellChrome.preservePendingLazyActionForReload(),this.resetShellState()}resetShellState(){this.outboxStoreRuntime?.invalidate(),this.navDrawerOpen=!1,this.desktopNavigationExpanded=!1,this.navDrawerTrigger=null,this.lastWorkspaceLocation=null,this.activeSessionKey=``,this.settingsSearchQuery=``,this.commandPaletteTarget=void 0,this.lastDeletedSessions=null,this.storedOutboxes=void 0,this.shellGateway.reset();for(let e of this.settingsPreloadTimers.values())globalThis.clearTimeout(e);this.settingsPreloadTimers.clear()}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{}}observeDeletedSessions(e){let t=this.context,n=e.deletedSessions;if(!t||Object.is(n,this.lastDeletedSessions)||(this.lastDeletedSessions=n,n.length===0))return;let{client:r,assistantAgentId:i,hello:a}=t.gateway.snapshot;Er(t,n);for(let{key:e,agentId:r,retireBeforeRevision:i}of n)t.chatAttachmentHandoff.retireScope(Ir({sessionKey:e,agentId:r}),i);let o=t.gateway.connection.gatewayUrl,s=W_(t.gateway,{gatewayUrl:o,recoveryScope:r?.recoveryScope||void 0}),c={client:r,gatewayUrl:o,isCurrent:()=>t.gateway.snapshot.client===r&&s(),assistantAgentId:i,hello:a,agentsList:t.agents.state.agentsList};W(async()=>{let{retireDeletedComposerDrafts:e}=await import(`./composer-draft-retirement.runtime-Z2pZ8i7S.js`);return{retireDeletedComposerDrafts:e}},__vite__mapDeps([114,1,11,3,2,4,5,8,7,6,9,12,13,14,15,28,29,30,31]),import.meta.url).then(({retireDeletedComposerDrafts:e})=>e(t,c,n),()=>Xr({message:P(`sessionsView.draftCleanupFailed`)}))}get pendingDebugOverlayMode(){return this.shellChrome.pendingDebugOverlayMode}get commandPaletteLoading(){return this.shellChrome.commandPaletteLoading}syncDocumentTitle(){let e=this.routeState.routeId,t=this.context;if(!e||!t)return;let n=this.storedOutboxScopeHost(t),r=e===`custodian`?P(`nav.askOpenClaw`):Hc(e);xs(e)&&this.activeSessionKey&&(r=this.chatTitleContext(t,n)||r);let i=t.gateway.snapshot.phase!==`connected`,a=Uc({context:r,attentionCount:t.overlays.snapshot.approvalQueue.length,gatewayDisconnected:i}),o=t.config?.current.environment;o&&(a+=` · ${o.label}`),document.title!==a&&(document.title=a)}updated(e){this.syncDocumentTitle(),(e.has(`routeState`)||e.has(`runtime`))&&e_(),this.restorePendingLazyAction(),!customElements.get(`openclaw-sidebar-update-card`)&&this.querySelector(`openclaw-sidebar-update-card`)&&this.loadSidebarUpdateCard();let t=this.querySelector(`openclaw-chat-page`);t&&(t.navDrawerOpen=this.navDrawerOpen&&!this.onboardingMode);let n=this.context;if(!n)return;this.querySelector(`.settings-sidebar__agent`)&&n.agentIdentity.ensure([n.settingsAgentSelection.state.selectedId]),this.workspaceChromeVisible&&this.shellChrome.panels.restore(),(n.overlays?.snapshot.approvalQueue.length??0)>0&&this.lazyCustomElements.preload(this.execApprovalElement),this.restorePendingLazyAction();let r={collapsed:this.nativeNavCollapsed(),width:n.navigation.snapshot.navWidth};(r.collapsed!==this.lastNativeNavState?.collapsed||r.width!==this.lastNativeNavState.width)&&(this.lastNativeNavState=r,tT(r))}ensureRuntimeConfig(e,t=this.context?.runtimeConfig){this.shellGateway.ensureRuntimeConfig(e,t).catch(()=>void 0)}ensureAgentsList(e,t=this.context?.agents){this.shellGateway.ensureAgentsList(e,t).catch(()=>void 0)}render(){return this.refreshStoredOutboxSummary(),this.workspaceChromeVisible&&this.lazyCustomElements.preload(gu),$w(this)}},U([B({attribute:!1})],gT.prototype,`runtime`,void 0),U([B({attribute:!1})],gT.prototype,`onboarding`,void 0),U([R()],gT.prototype,`navDrawerOpen`,void 0),U([R()],gT.prototype,`navResizing`,void 0),U([R()],gT.prototype,`desktopNavigationExpanded`,void 0),U([R()],gT.prototype,`activeSessionKey`,void 0),U([R()],gT.prototype,`settingsSearchQuery`,void 0),U([R()],gT.prototype,`routeState`,void 0),U([R()],gT.prototype,`nativeHistoryState`,void 0),U([Ni(`openclaw-command-palette`)],gT.prototype,`commandPalette`,void 0),U([Ni(`openclaw-exec-approval`)],gT.prototype,`approvalOverlay`,void 0),U([R()],gT.prototype,`settingsSidebarRenderer`,void 0),U([R()],gT.prototype,`settingsSidebarLoadFailed`,void 0),U([R()],gT.prototype,`devicePairSetupRenderer`,void 0),U([R()],gT.prototype,`devicePairSetupLoadFailed`,void 0),customElements.get(`openclaw-app`)||customElements.define(`openclaw-app`,Ox),customElements.get(`openclaw-app-shell`)||customElements.define(`openclaw-app-shell`,gT)})))()}export{Xb as $,ac as $a,jl as $i,fm as $n,Gd as $r,j_ as $t,fS as A,Dc as Aa,Zu as Ai,Ah as An,Ns as Ao,jf as Ar,Hv as At,Ux as B,xc as Ba,Yl as Bi,rh as Bn,xf as Br,$_ as Bt,OS as C,Pc as Ca,od as Ci,fg as Cn,Cs as Co,Uf as Cr,fy as Ct,pS as D,Ic as Da,rd as Di,Ph as Dn,es as Do,Nf as Dr,$v as Dt,bS as E,Tc as Ea,ed as Ei,Fh as En,bs as Eo,Ff as Er,Xv as Et,oS as F,Mc as Fa,cu as Fi,gh as Fn,Es as Fo,Df as Fr,Cv as Ft,Fx as G,fc as Ga,Vl as Gi,zm as Gn,ef as Gr,U_ as Gt,Hx as H,Cc as Ha,Jl as Hi,Zm as Hn,sf as Hr,W_ as Ht,Zx as I,Ac as Ia,ju as Ii,lh as In,Of as Ir,wv as It,jx as J,cc as Ja,Pl as Ji,Fm as Jn,Rd as Jr,z_ as Jt,Lx as K,lc as Ka,Rl as Ki,Rm as Kn,Qd as Kr,R_ as Kt,tS as L,Gc as La,lu as Li,ah as Ln,Sf as Lr,Tv as Lt,cS as M,Oc as Ma,Mu as Mi,yh as Mn,as as Mo,Af as Mr,jv as Mt,lS as N,Wc as Na,Tu as Ni,bh as Nn,Ps as No,kf as Nr,Ov as Nt,_S as O,Nc as Oa,Xu as Oi,Nh as On,ns as Oo,Rf as Or,Uv as Ot,sS as P,Rc as Pa,du as Pi,vh as Pn,Ts as Po,wf as Pr,Ev as Pt,tx as Q,nc as Qa,Al as Qi,pm as Qn,Vd as Qr,A_ as Qt,Xx as R,Hc as Ra,su as Ri,mh as Rn,bf as Rr,dv as Rt,jS as S,Vc as Sa,sd as Si,qh as Sn,J as So,Jf as Sr,yy as St,wS as T,wc as Ta,ad as Ti,zh as Tn,vs as To,If as Tr,Zv as Tt,Px as U,bc as Ua,Kl as Ui,Xm as Un,af as Ur,K_ as Ut,qx as V,Sc as Va,Hl as Vi,th as Vn,ff as Vr,Z_ as Vt,Ix as W,mc as Wa,zl as Wi,Lm as Wn,of as Wr,V_ as Wt,cx as X,ic as Xa,Nl as Xi,Tm as Xn,Ud as Xr,P_ as Xt,Qb as Y,tc as Ya,Ll as Yi,Im as Yn,Hd as Yr,N_ as Yt,nx as Z,oc as Za,kl as Zi,Mm as Zn,zd as Zr,k_ as Zt,dC as _,al as _a,gd as _i,Fg as _n,ms as _o,$f as _r,Zy as _t,Bw as a,Z as aa,Jd as ai,b_ as an,Ys as ao,Mp as ar,Ub as at,KS as b,$c as ba,ud as bi,Uh as bn,_s as bo,Yf as br,_y as bt,Rw as c,yl as ca,Md as ci,n_ as cn,Ls as co,Ap as cr,Gb as ct,Pw as d,gl as da,Td as di,$g as dn,cs as do,hp as dr,gb as dt,Ml as ea,Kd as ei,M_ as en,Qs as eo,sm as er,ix as et,Cw as f,dl as fa,wd as fi,Sg as fn,fs as fo,cp as fr,hb as ft,NC as g,ul as ga,yd as gi,lg as gn,xs as go,Zf as gr,Yy as gt,WC as h,cl as ha,Sd as hi,pg as hn,is as ho,tp as hr,vb as ht,Vw as i,Cl as ia,qd as ii,x_ as in,Bs as io,Ip as ir,Jb as it,mS as j,Bc as ja,Nu as ji,Ch as jn,ks as jo,Pf as jr,Vv as jt,dS as k,zc as ka,Hu as ki,Oh as kn,ts as ko,Mf as kr,Bv as kt,Nw as l,_l as la,Dd as li,o_ as ln,Hs as lo,ap as lr,Kb as lt,_w as m,sl as ma,vd as mi,Vg as mn,Y as mo,rp as mr,yb as mt,aT as n,Tl as na,Ld as ni,O_ as nn,Fs as no,Jp as nr,Yb as nt,Lw as o,Sl as oa,Nd as oi,c_ as on,Vs as oo,jp as or,Hb as ot,Sw as p,fl as pa,bd as pi,Lg as pn,js as po,op as pr,_b as pt,Rx as q,sc as qa,Il as qi,Hm as qn,$d as qr,B_ as qt,oT as r,El as ra,Id as ri,C_ as rn,zs as ro,Rp as rr,ex as rt,zw as s,bl as sa,jd as si,s_ as sn,Rs as so,Dp as sr,Wb as st,_T as t,wl as ta,Bd as ti,T_ as tn,Is as to,cm as tr,$b as tt,Mw as u,ml as ua,Ed as ui,Qg as un,ls as uo,Ep as ur,mb as ut,sC as v,il as va,_d as vi,Ng as vn,ds as vo,Qf as vr,Hy as vt,xS as w,rl as wa,id as wi,og as wn,us as wo,Hf as wr,ly as wt,HS as x,Kc as xa,cd as xi,jg as xn,ys as xo,np as xr,cy as xt,rC as y,qc as ya,hd as yi,Gh as yn,ps as yo,Xf as yr,wy as yt,Yx as z,Fc as za,Xl as zi,nh as zn,Cf as zr,uv as zt};