UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 83.7 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./owner-devices-dialog-DlHzLOTK.js","./en-openclaw-id-dialogs-BFGCHK4v.js","./en-openclaw-id-Don6YXzi.js","./ui-error-Bk6jJOft.js","./error-message-B7DmySYB.js","./_1____________________________.css","./_0____________________________________.css","./owner-devices-dialog-Cqj3g9OJ.css"])))=>i.map(i=>d[i]);
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{$u as t,B as n,Fr as r,G as i,Gr as a,Gu as o,Ir as s,It as c,K as l,Lr as u,Nr as d,Pr as f,Qu as p,Rt as m,U as h,W as g,b as _,ca as v,ii as ee,li as y,mi as te,oi as b,pi as x,ri as S,sa as C,v as w,y as T}from"./_4____________________________.js";import{$w as ne,AN as E,ED as re,EN as D,Ej as ie,FN as O,Fv as ae,GN as k,Iv as oe,JN as A,Ks as se,Lv as ce,Oy as le,PN as j,Qw as ue,Sl as de,Tp as fe,Ut as pe,Wt as me,XN as he,YN as ge,ZN as _e,_j as ve,_l as ye,ck as be,dT as xe,eD as Se,eT as Ce,fN as we,fT as Te,hl as Ee,iT as De,ib as Oe,jj as ke,jy as Ae,mj as je,nD as Me,oT as Ne,pN as Pe,pj as Fe,qN as M,qs as Ie,rb as Le,rv as Re,sT as ze,sk as Be,tD as Ve,uk as He,vt as Ue,wD as We,wl as Ge,wp as Ke,xl as qe,yj as Je,yt as Ye}from"./_2_____________________________.js";import{Bi as Xe,Hi as Ze}from"./deferred-ui-support-DZEPWjAk.js";import{$ as Qe,B as N,C as $e,Ct as et,F as P,I as tt,L as nt,N as rt,O as F,Rt as I,S as it,St as at,T as L,U as R,_t as ot,a as st,d as z,f as B,g as V,gt as H,j as U,k as ct,l as W,m as lt,s as G,u as K,v as ut,w as dt,x as q,yt as ft}from"./_6____________________.js";import{n as pt,t as mt}from"./_5_________________________.js";import{n as ht,t as gt}from"./en-route-subtitles-CjswZHfJ.js";import{n as _t,r as vt}from"./wizard-step-controls-Cub-DAGP.js";import{i as yt,n as bt,t as xt}from"./provider-presentation-K1_wXrAZ.js";import{o as St,r as Ct}from"./settings-targets-bvwku6ua.js";import{C as wt,c as J,d as Tt,f as Et,g as Y,l as Dt,m as X,o as Ot,p as kt,s as At,u as jt,w as Z,x as Mt,y as Q}from"./settings-controls-runtime-CwXZmgDo.js";import{a as Nt,o as Pt}from"./route-chrome-Dr9fhzjf.js";import{n as Ft,r as It,t as Lt}from"./settings-disclosure-C2Lxm_wL.js";import{a as Rt,i as zt,n as Bt}from"./account-BSv2LwQC.js";import{n as Vt,t as Ht}from"./feature-lifetime-BHVdXhSD.js";import{t as Ut}from"./claw-name-Dq5hFb9H.js";import{n as Wt,t as Gt}from"./en-profile-edyrJlYL.js";import{n as Kt,r as qt,t as Jt}from"./avatar-processing-CIFdZoi2.js";import{a as Yt,i as Xt,n as Zt,r as Qt,t as $t}from"./device-scope-upgrade-owner.runtime-gcN2lG_x.js";import{n as en,t as tn}from"./en-github-connections-DbO30xwn.js";import{n as nn,t as rn}from"./domain-github-identity-Cc2860m6.js";import{i as an,n as on,o as sn,r as cn,s as ln,t as un}from"./github-identity-view-DoFcfDaZ.js";import{n as dn,t as fn}from"./model-account-settings-english-BeUzfLXr.js";function pn(e){let[t,n]=N(),r,i=()=>A(`common.helpFor`,{section:e.section});var a=mn(),o=a.firstChild,s=o.firstChild;return o._$$click=()=>r.overlay.request(!r.overlay.open),lt(()=>n,o),z(s,U(we,{name:`circleQuestionMark`})),z(a,U(F,{get when(){return t()},children:t=>U(se,{ref:e=>r=e,lazy:`while-open`,get id(){return e.id},get label(){return i()},class:`settings-section__help-popover`,get anchor(){return t()},placement:`bottom-end`,get children(){var t=hn();return z(t,()=>e.children),t}})}),null),W(()=>({e:i(),t:e.id}),({e,t},n)=>{e!==n?.e&&V(o,`aria-label`,e),t!==n?.t&&V(o,`aria-controls`,t)}),a}var mn,hn;function gn(){return(gn=e((()=>{K(),R(),k(),Pe(),Ie(),mn=q(`<span class=settings-section__docs><button type=button class=settings-section__help-button aria-haspopup=dialog><span aria-hidden=true>`),hn=q(`<div class=settings-section__help-panel>`),G([`click`])})))()}function _n(e){let t=e.phase===`connected`?e.selfUser?.id??null:null,r=e.phase===`connected`&&!!e.hello?.auth&&h(e.hello?.auth??null);return{profileId:t,canRead:r,canAdmin:r&&n(e.hello?.auth??null)}}function vn(e,t,n){var r=xn(),i=r.firstChild,a=i.nextSibling,o=a.nextSibling;return z(r,e,i),z(r,t?(()=>{var e=Sn();return e.firstChild,z(e,t,null),e})():void 0,a),z(r,n?(()=>{var e=Cn();return z(e,n),e})():void 0,o),r}function yn(e){let t=O(),n=rn({authorizationSucceeded:()=>e.onCloseSetup(),runExternalMutation:(e,n)=>t.runtimeConfig.runExternalMutation(e,n)});H(()=>e.register(e.agent.id,n));let r=()=>n.read(),i=()=>e.agent.identity?.name??e.agent.name??e.agent.id,a=()=>r().status?.effective??null,o=()=>r().status?.selected.configured===!0,s=()=>e.locked||!r().status||r().loading||r().busy||r().authorizationActive,c=()=>{if(!r().status)return;let e=a();return o()?e?A(`githubConnections.ownAccountKind`,{kind:A(Fn[e.credentialKind])}):A(`githubConnections.ownAccount`):A(`githubConnections.usesShared`)},l=()=>{e.onCloseSetup(),n.hidePatFallback()};var u=En(),d=u.firstChild,f=d.nextSibling,p=f.nextSibling;return z(u,U(X,{get title(){return i()},get description(){return vn(U(an,{get identity(){return a()},get request(){return r()}}),a()?.account?.login,c())},get control(){return U(F,{get when(){return o()},get fallback(){var t=$();return t._$$click=()=>e.onOpenSetup(),z(t,()=>A(`githubConnections.giveOwnShort`)),W(()=>({e:s(),t:A(`githubConnections.giveOwn`,{agent:i()})}),({e,t:n},r)=>{e!==r?.e&&V(t,`disabled`,e),n!==r?.t&&V(t,`aria-label`,n)}),t},get children(){return[(()=>{var t=$();return t._$$click=()=>e.onOpenSetup(),z(t,()=>A(`githubConnections.changeShort`)),W(()=>({e:s(),t:A(`githubConnections.changeAgent`,{agent:i()})}),({e,t:n},r)=>{e!==r?.e&&V(t,`disabled`,e),n!==r?.t&&V(t,`aria-label`,n)}),t})(),(()=>{var t=$();return t._$$click=()=>{e.onCloseSetup(),n.inherit()},z(t,()=>A(`agentTools.githubUseSystemNewRuns`)),W(()=>({e:s(),t:A(`githubConnections.useSharedFor`,{agent:i()})}),({e,t:n},r)=>{e!==r?.e&&V(t,`disabled`,e),n!==r?.t&&V(t,`aria-label`,n)}),t})()]}})}}),d),z(u,U(F,{get when(){return e.setupOpen||r().authorizationActive},get children(){var e=Tn(),t=e.firstChild,a=t.nextSibling,o=a.nextSibling;return z(e,U(X,{get title(){return A(`githubConnections.agentSetupTitle`,{agent:i()})},get description(){return A(`githubConnections.agentSetupHint`,{agent:i()})}}),t),z(e,U(on,{identity:n,get saveLabel(){return A(`githubConnections.saveForAgent`,{agent:i()})}}),a),z(e,U(F,{get when(){return B(()=>!r().busy)()&&!r().authorizationActive},get children(){var e=wn(),t=e.firstChild.firstChild;return t._$$click=l,z(t,()=>A(`common.close`)),e}}),o),e}}),f),z(u,U(un,{get error(){return r().error},get completion(){return r().completion}}),p),W(()=>e.agent.id,e=>{V(u,`data-agent-id`,e)}),u}function bn(){let e=O(),t=ze(e.gateway),r=de(e.agents),i=Ge(e.runtimeConfig),[a,o]=N(null),s=null,c=0,l=!1,u=!1,d=null,f=new Map,p=()=>o(null),m=rn({authorizationSucceeded:p}),g=rn({authorizationSucceeded:p,runExternalMutation:(t,n)=>e.runtimeConfig.runExternalMutation(t,n)}),_=e=>({client:e.client,connected:e.phase===`connected`&&e.selfUser!==void 0,permissionsReady:e.phase===`connected`&&!!e.hello,clientRevision:c}),v=(t,n)=>{s&&(n.sync({..._(s),target:{kind:`shared`,scope:`agent`,profileId:d,agentId:t,config:ie(e.runtimeConfig.state)},statusReadable:u,authorizable:u,configurable:u}),n.ensureVerified())},ee=()=>{if(!s)return;m.sync({..._(s),target:d?{kind:`personal`,profileId:d}:null,statusReadable:l&&d!==null,authorizable:l&&d!==null,configurable:!1});let t=e.settingsAgentSelection.state.selectedId;g.sync({..._(s),target:t?{kind:`shared`,scope:`system`,profileId:d,agentId:t,config:ie(e.runtimeConfig.state)}:null,statusReadable:u,authorizable:u,configurable:u}),m.ensureVerified(),g.ensureVerified(),f.forEach((e,t)=>v(t,e))},y=(e,t)=>(f.set(e,t),v(e,t),()=>{f.get(e)===t&&f.delete(e)}),te=t=>{let r=!s||s.client!==t.client||t.phase===`connected`&&t.selfUser!==void 0&&d!==(t.selfUser?.id??null),i=!s||s.client!==t.client||s.phase!==t.phase||s.hello!==t.hello||s.selfUser===void 0!=(t.selfUser===void 0)||t.selfUser!==void 0&&d!==(t.selfUser?.id??null);s=t,d=t.phase===`connected`&&t.selfUser!==void 0||r?t.selfUser?.id??null:d;let a=l,f=u;(t.phase===`connected`||r)&&(l=!!t.hello?.auth&&h(t.hello?.auth??null),u=l&&n(t.hello?.auth??null)),i&&(c+=1),(r||a&&!l||f&&!u)&&o(null),ee(),u&&e.runtimeConfig.ensureLoaded()};H(()=>{let t=[e.gateway.subscribe(te),e.agents.subscribe(ee),e.settingsAgentSelection.subscribe(ee),e.runtimeConfig.subscribe(ee)];return te(e.gateway.snapshot),()=>t.forEach(e=>e())});let b=P(()=>{let e=t.read().snapshot,n=m.read(),a=g.read(),o=n.personal,s=je(r.read().agentsList?.agents??[]),c=ie(i.read().state),f=o?.state===`connected`,p=o?.state===`unavailable`||o?.refreshState===`expired`||o?.refreshState===`failed`;return{account:o,agentList:s,sharedAgentCount:c?s.filter(e=>!ve(c,e.id).entry?.tools?.github).length:null,connected:f,reconnectRequired:p,profileId:d,canRead:l,canAdmin:u,systemIdentity:a.status?.selected.identity??n.system,locked:e.phase!==`connected`||e.selfUser===void 0||n.loading||a.loading||n.authorizationActive||a.authorizationActive||n.busy||a.busy,personalLabel:A(d?p?`githubConnections.reconnectRequired`:f?`githubConnections.connected`:`githubConnections.disconnected`:`githubConnections.signInRequired`)}}),x=m.read,S=g.read,C=t=>{let n=_n(e.gateway.snapshot);b().locked||(t===`personal`?!n.profileId||!n.canRead:!n.canAdmin)||(a()===`personal`?m.hidePatFallback():a()===`system`&&g.hidePatFallback(),o(t))},w=e=>{a()===e&&o(null)},T=()=>{m.verify(),g.verify(),f.forEach(e=>void e.verify())},ne=e=>{let t=e===`personal`?m:g;return a()===e||t.read().authorizationActive?(()=>{var n=Dn(),r=n.firstChild,i=r.nextSibling;return z(n,U(on,{identity:t}),r),z(n,(()=>{var n=B(()=>!b().locked);return()=>n()?[B(()=>B(()=>!!(e===`personal`&&b().account&&b().account?.state!==`disconnected`&&b().canRead))()?U(X,{get title(){return A(`githubConnections.disconnectMine`)},get description(){return A(`githubConnections.disconnectDescription`)},get control(){var e=kn();return e._$$click=()=>{w(`personal`),m.disconnect()},z(e,()=>A(`githubConnections.disconnect`)),e}}):void 0),(()=>{var n=On(),r=n.firstChild,i=r.nextSibling,a=i.firstChild;return z(r,()=>A(e===`personal`?`githubConnections.personalSetupHint`:`githubConnections.systemSetupHint`)),z(i,(()=>{var t=B(()=>!!(e===`system`&&b().canAdmin&&S().status?.selected.configured));return()=>t()?(()=>{var e=$();return e._$$click=()=>void g.inherit(),z(e,()=>A(`agentTools.githubUseNativeNewRuns`)),e})():void 0})(),a),a._$$click=()=>{w(e),t.hidePatFallback()},z(a,()=>A(`common.close`)),n})()]:void 0})(),i),n})():void 0},E=()=>{let e=b().sharedAgentCount;return e===null?A(`githubConnections.changeShort`):e===1?A(`githubConnections.changeSystemForOne`):A(`githubConnections.changeSystemForMany`,{count:String(e)})};var re=Mn(),D=re.firstChild,ae=D.firstChild,k=ae.nextSibling;return re._$owner=I(),z(D,U(Y,{get title(){return A(`githubConnections.title`)},get description(){return A(`githubConnections.description`)},get actions(){return[B(()=>B(()=>!!(b().canRead&&(b().profileId||b().canAdmin)))()?(()=>{var e=$();return e._$$click=T,z(e,()=>A(`agentTools.githubVerify`)),W(()=>b().locked,t=>{V(e,`disabled`,t)}),e})():void 0),U(pn,{id:`settings-profile-github-connections-help`,get section(){return A(`githubConnections.title`)},get children(){return[(()=>{var e=Nn();return z(e,()=>A(`githubConnections.descriptionMore`)),e})(),(()=>{var e=Pn(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`githubConnections.mine`)),z(e,()=>A(b().profileId?`githubConnections.personalDescription`:`githubConnections.unboundDescription`),null),e})(),(()=>{var e=Pn(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`githubConnections.system`)),z(e,()=>A(`githubConnections.systemDescription`),null),e})(),(()=>{var e=Pn(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`githubConnections.agentsTitle`)),z(e,()=>A(`githubConnections.agentsHelp`),null),e})(),(()=>{var e=Pn(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`githubConnections.usage`)),z(e,()=>A(`githubConnections.usageDescription`),null),e})()]}})]},get children(){return[(()=>{var e=An(),t=e.firstChild,n=t.nextSibling;return z(e,U(X,{get title(){return A(`githubConnections.mine`)},get description(){return vn(b().profileId&&!b().account?U(sn,{get request(){return x()}}):U(Q,{get kind(){return B(()=>!!b().reconnectRequired)()?`warn`:b().connected?`ok`:`muted`},get label(){return b().personalLabel}}),b().account?.account?.login,b().profileId?A(`githubConnections.personalUse`):void 0)},get control(){return B(()=>!!(b().profileId&&b().canRead))()?(()=>{var e=$();return e._$$click=()=>C(`personal`),z(e,()=>A(b().account?b().connected?`githubConnections.changeShort`:`githubConnections.connectShort`:`githubConnections.manageShort`)),W(()=>({e:b().locked,t:A(b().account?b().connected?`githubConnections.changeMine`:`githubConnections.connectMine`:`githubConnections.manage`)}),({e:t,t:n},r)=>{t!==r?.e&&V(e,`disabled`,t),n!==r?.t&&V(e,`aria-label`,n)}),e})():void 0}}),t),z(e,()=>ne(`personal`),n),e})(),U(un,{get error(){return x().error},get completion(){return x().completion},get control(){var e=$();return e._$$click=T,z(e,()=>A(`common.retry`)),W(()=>b().locked,t=>{V(e,`disabled`,t)}),e}})]}}),ae),z(D,U(Y,{get title(){return A(`githubConnections.agentsTitle`)},get description(){return A(`githubConnections.agentsDescription`)},get children(){return[(()=>{var e=jn(),t=e.firstChild,n=t.nextSibling;return z(e,U(Lt,{get detailsLabel(){return A(`githubConnections.details`)},get hasDetails(){return!!b().systemIdentity},get title(){return A(`githubConnections.system`)},get description(){return vn(U(an,{get identity(){return b().systemIdentity},get request(){return B(()=>!!b().canAdmin)()?S():x()}}),b().systemIdentity?.account?.login,A(`githubConnections.systemUse`))},get control(){return B(()=>!!b().canAdmin)()?(()=>{var e=$();return e._$$click=()=>C(`system`),z(e,E),W(()=>({e:b().locked||!S().status,t:A(`githubConnections.changeSystem`)}),({e:t,t:n},r)=>{t!==r?.e&&V(e,`disabled`,t),n!==r?.t&&V(e,`aria-label`,n)}),e})():U(wt,{get value(){return A(`githubConnections.adminManaged`)}})},get children(){return U(cn,{get identity(){return b().systemIdentity}})}}),t),z(e,()=>ne(`system`),n),e})(),U(un,{get error(){return S().error},get completion(){return S().completion},get control(){var e=$();return e._$$click=T,z(e,()=>A(`common.retry`)),W(()=>b().locked,t=>{V(e,`disabled`,t)}),e}}),U(F,{get when(){return b().canAdmin},get children(){return U($e,{get each(){return b().agentList},keyed:e=>e.id,children:e=>U(yn,{get agent(){return e()},register:y,get locked(){return b().locked},get setupOpen(){return a()===`agent:${e().id}`},onOpenSetup:()=>C(`agent:${e().id}`),onCloseSetup:()=>w(`agent:${e().id}`)})})}})]}}),k),W(()=>Ct.githubConnections,e=>{V(D,`id`,e)}),re}var xn,Sn,Cn,wn,Tn,En,$,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn;function In(){return(In=e((()=>{K(),R(),l(),It(),gn(),Z(),tn(),Fe(),ke(),De(),j(),qe(),nn(),k(),St(),ln(),xn=q(`<span class=settings-row__meta><!><!><!>`),Sn=q(`<span class=github-connection__login>@`),Cn=q(`<span>`),wn=q(`<div class="settings-row settings-row--actions"><div class=settings-row__control><button class="btn btn--sm">`),Tn=q(`<div class=settings-subrows data-github-setup><!><!><!>`),En=q(`<div data-github-connection=agent><!><!><!>`),$=q(`<button class="btn btn--sm">`),Dn=q(`<div class=settings-subrows data-github-setup><!><!>`),On=q(`<div class=settings-row><span class=settings-row__desc></span><div class=settings-row__control><button class="btn btn--sm">`),kn=q(`<button class="btn btn--sm danger">`),An=q(`<div data-github-connection=personal><!><!>`),jn=q(`<div data-github-connection=system><!><!>`),Mn=q(`<openclaw-github-connections><div class=settings-stack><!><!>`,1),Nn=q(`<p>`),Pn=q(`<p><strong></strong> `),Fn={native:`agentTools.githubKindNative`,"managed-pat":`agentTools.githubKindPat`,"managed-oauth":`agentTools.githubKindOAuth`,"app-installation":`agentTools.githubKindAppInstallation`},en(),G([`click`])})))()}var Ln;function Rn(){return(Rn=e((()=>{s(),l(),b(),E(),Ee(),Ln=class{constructor(e){this.publish=e,this.accounts=[],this.accountId=``,this.error=null,this.loading=!1,this.busy=!1,this.available=!1,this.flow=null,this.client=null,this.profileId=null,this.connectionId=null,this.generation=0}get selected(){return this.accounts.find(e=>e.accountId===this.accountId)}sync(e){let t=e.selfUser?.id??null,n=e.hello?.server?.connId??null,r=e.phase===`connected`&&!!t&&t!==`gateway-owner`&&g(e.hello?.auth??null);(this.client!==e.client||this.profileId!==t||this.connectionId!==n||this.available!==r)&&(this.dispose(),this.client=e.client,this.profileId=t,this.connectionId=n,this.available=r,this.accounts=[],this.accountId=``,this.error=null,this.busy=!1,this.loading=!1,r&&this.load(),this.publish())}clearFlow(){clearTimeout(this.timer),this.flow&&(document.cookie=`openclaw-channel-link-`+this.flow.nonce+`=; Path=/; Max-Age=0; SameSite=Lax`),this.flow=null}dispose(){this.generation++;let e=this.flow;this.clearFlow(),e&&this.client&&this.client.request(`users.channelIdentity`,{action:`cancel`,channelId:`discord`,accountId:e.accountId,requestId:e.requestId}).catch(()=>{}),this.client=null,this.available=!1}request(e){if(!this.client||!this.available)throw Error(y(`profilePage.discord.reconnect`));return this.client.request(`users.channelIdentity`,e)}async load(){let e=this.generation;this.loading=!0,this.publish();try{let t=await this.request({action:`status`,channelId:`discord`});if(e!==this.generation)return;this.accounts=t.accounts??[],this.selected||(this.accountId=this.accounts.find(e=>e.senderIds.length>0)?.accountId??this.accounts.find(e=>e.available)?.accountId??this.accounts[0]?.accountId??``),this.error=null}catch(t){e===this.generation&&(this.error=D(t))}finally{e===this.generation&&(this.loading=!1,this.publish())}}async connect(){if(this.busy||!this.selected?.available||this.flow)return;let e=this.generation,t=this.accountId,n=crypto.randomUUID(),r=`openclaw-channel-link-`+n;document.cookie=r+`=`+n+`; Path=/; Max-Age=300; SameSite=Lax`+(location.protocol===`https:`?`; Secure`:``);let i=ye();this.busy=!0,this.error=null,this.publish();try{let r=await this.request({action:`start`,channelId:`discord`,accountId:t,browserNonce:n});if(e!==this.generation){i?.close();return}if(!r.requestId||!r.authorizationUrl)throw Error(y(`profilePage.discord.startFailed`));this.flow={requestId:r.requestId,accountId:t,nonce:n,url:r.authorizationUrl},i&&(i.location.href=r.authorizationUrl),this.timer=setTimeout(()=>void this.poll(),1500)}catch(t){i?.close(),e===this.generation&&(this.error=D(t))}finally{(!this.flow||this.flow.nonce!==n)&&(document.cookie=r+`=; Path=/; Max-Age=0; SameSite=Lax`),e===this.generation&&(this.busy=!1,this.publish())}}async poll(){let e=this.flow,t=this.generation;if(e){try{let n=await this.request({action:`poll`,channelId:`discord`,accountId:e.accountId,requestId:e.requestId});if(t!==this.generation||this.flow!==e)return;if(n.status===`pending`){this.timer=setTimeout(()=>void this.poll(),1500);return}this.clearFlow(),n.status===`linked`?await this.load():this.error=n.message??y(`profilePage.discord.incomplete`)}catch(n){t===this.generation&&this.flow===e&&(this.clearFlow(),this.error=D(n))}t===this.generation&&this.publish()}}async mutate(e){if(this.busy)return;let t=this.generation,n=this.flow;this.busy=!0,this.error=null,this.publish();try{if(e===`cancel`&&n?await this.request({action:e,channelId:`discord`,accountId:n.accountId,requestId:n.requestId}):e===`disconnect`&&await this.request({action:e,channelId:`discord`,accountId:this.accountId}),t!==this.generation)return;this.clearFlow(),await this.load()}catch(e){t===this.generation&&(this.error=D(e))}finally{t===this.generation&&(this.busy=!1,this.publish())}}}})))()}function zn(){let e=O(),{owner:t,view:n}=me(e=>new Ln(e),e=>e),r=()=>!n.read().loading&&!n.read().selected?.available&&!n.read().selected?.senderIds.length&&!n.read().error,i=()=>!n.read().loading&&!!n.read().selected?.senderIds.length;return H(()=>{let n=e.gateway.subscribe(e=>t.sync(e)),r=e.gateway.subscribeEvents(e=>{e.event===`sessions.changed`&&o(e.payload)?.reason===`profile-identity`&&!t.busy&&!t.flow&&t.load()});return t.sync(e.gateway.snapshot),()=>{n(),r(),t.dispose()}}),[U(X,{get title(){return A(`profilePage.discord.title`)},get description(){var e=Vn(),t=e.firstChild,a=t.nextSibling;return z(t,()=>A(`profilePage.discord.unavailable`)),z(a,(()=>{var e=B(()=>!!n.read().flow);return()=>e()?U(Q,{kind:`muted`,get label(){return A(`profilePage.discord.waiting`)}}):B(()=>!!i())()?(()=>{var e=Hn(),t=e.firstChild;return z(e,U(Q,{kind:`ok`,get label(){return A(`profilePage.discord.verified`)}}),t),z(t,()=>n.read().selected?.senderIds.join(`, `)),e})():B(()=>!!r())()?A(`profilePage.discord.unavailable`):(()=>{var e=Un();return z(e,U(Q,{kind:`muted`,get label(){return A(`profilePage.discord.notConnected`)}})),W(()=>({e:n.read().loading||n.read().error?`hidden`:`visible`,t:n.read().loading||n.read().error?`true`:void 0}),({e:t,t:n},r)=>{t!==r?.e&&ut(e,`visibility`,t),n!==r?.t&&V(e,`aria-hidden`,n)}),e})()})()),e},get control(){return U(F,{get when(){return!n.read().loading},get fallback(){var e=Gn();return z(e,()=>A(`profilePage.discord.connectShort`)),W(()=>A(`profilePage.discord.connect`),t=>{V(e,`aria-label`,t)}),e},get children(){return U(F,{get when(){return n.read().selected?.senderIds.length},get fallback(){return U(F,{get when(){return n.read().flow},get fallback(){var e=Wn();return e._$$click=()=>void t.connect(),z(e,()=>A(`profilePage.discord.connectShort`)),W(()=>({e:!n.read().available||!n.read().selected?.available||n.read().busy,t:A(`profilePage.discord.connect`)}),({e:t,t:n},r)=>{t!==r?.e&&V(e,`disabled`,t),n!==r?.t&&V(e,`aria-label`,n)}),e},children:e=>[(()=>{var t=Kn(),n=I();return z(t,()=>A(`profilePage.discord.continue`)),W(()=>e().url,e=>{V(t,`href`,e),st(t,n)}),t})(),(()=>{var e=Wn();return e._$$click=()=>void t.mutate(`cancel`),z(e,()=>A(`common.cancel`)),W(()=>n.read().busy,t=>{V(e,`disabled`,t)}),e})()]})},get children(){var e=Wn();return e._$$click=()=>void t.mutate(`disconnect`),z(e,()=>A(`profilePage.discord.disconnect`)),W(()=>!n.read().available||n.read().busy,t=>{V(e,`disabled`,t)}),e}})}})}}),U(F,{get when(){return n.read().accounts.length>1},get children(){var e=Bn();return z(e,U(X,{get title(){return A(`profilePage.discord.gatewayAccount`)},stackedOnNarrow:!0,get control(){return U(Ke,{style:Jn,get params(){return{label:A(`profilePage.discord.gatewayAccount`),value:n.read().accountId,options:n.read().accounts.map(({accountId:e})=>({value:e,label:e})),disabled:n.read().busy||!!n.read().flow,onChange:e=>{t.accountId=e,t.publish()}}}})}})),e}}),U(F,{get when(){return n.read().error},children:e=>(()=>{var n=qn(),r=n.firstChild,i=r.nextSibling.firstChild;return z(r,e),i._$$click=()=>void t.load(),z(i,()=>A(`common.retry`)),n})()})]}var Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn;function Yn(){return(Yn=e((()=>{K(),R(),fe(),Z(),pe(),j(),k(),Rn(),Bn=q(`<div class=settings-subrows>`),Vn=q(`<span class=profile-discord-description><span class=profile-discord-reservation aria-hidden=true></span><span>`),Hn=q(`<span class=settings-row__meta><span class=identity-account>`),Un=q(`<span class=settings-row__meta>`),Wn=q(`<button class="btn btn--sm">`),Gn=q(`<button class="btn btn--sm"disabled aria-busy=true>`),Kn=q(`<a class="btn btn--sm"target=_blank rel="noopener noreferrer">`),qn=q(`<div class="settings-row identity-error"role=alert><span class=settings-row__desc></span><div class=settings-row__control><button class="btn btn--sm">`),Jn=`width:340px;max-width:100%;min-width:0`,G([`click`])})))()}function Xn(e){let t=P(()=>{let t=e();return{target:t.target,connected:t.connected,hello:t.hello}},{equals:(e,t)=>e.target===t.target&&e.connected===t.connected&&e.hello===t.hello}),n=P(()=>{let n=t(),r=P(()=>e().links),[i,a]=nt(()=>r().map(({provider:e,authProfileId:t})=>({provider:e,authProfileId:t})),[],{key:`provider`}),o=P(()=>e().connectFlow),[s,c]=tt(!1);return{...n,links:i,setLinks:a,flow:o,saving:s,setSaving:c}}),r=ft(function*(t,n,r,i,a){let o=()=>{let n=e();return n.target===t.target&&n.connected===t.connected&&n.hello===t.hello&&n.generation===i&&n.actionRetired===r};try{o()&&(t.setSaving(!0),a&&t.setLinks(e=>{let t=a.kind===`select`?a.link.provider:a.provider,n=e.findIndex(e=>e.provider===t),r=e[n];a.kind===`unlink`?n!==-1&&e.splice(n,1):r?r.authProfileId=a.link.authProfileId:e.push(a.link)}),Qe(t.links),Qe(t.flow)),yield Promise.race([n,r]),o()&&(yield Promise.all([ot(t.links),ot(t.flow)]))}catch(t){if(o()){let n=e();n.error=[A(`profilePage.modelAccounts.actionFailed`),D(t)].filter(Boolean).join(` `),n.publish()}}});async function i(t,i){let a=e(),o=n(),s=a.generation,c=t(a);if(!c||a.generation===s)return c;let l=a.generation,u=a.actionRetired;return await Promise.resolve(),r(o,c,u,l,i)}return{links:()=>n().links,flow:()=>n().flow(),saving:()=>n().saving(),updateAccount(t,n){let r=e().accounts.find(e=>e.authProfileId===n);return i(e=>e.updateAccount(t,n),t===`unlink`?{kind:t,provider:n}:t===`select`&&r?{kind:t,link:{provider:r.provider,authProfileId:n}}:void 0)},startConnect:()=>i(e=>e.startConnect()),answerStep:(e,t)=>i(n=>n.answerStep(e,t)),cancel:()=>i(e=>e.connectStatus(`cancel`))}}function Zn(){return(Zn=e((()=>{R(),E(),k()})))()}function Qn(e){let t=URL.parse(e);return t?`${t.origin}${t.pathname}`:A(`profilePage.modelAccounts.gatewayUnavailable`)}function $n(e){let t=yt(),n=()=>e.readState(),r=()=>t(e.provider),i=P(()=>{let t=e.accounts.map(e=>e.label);return[...e.accounts.map(e=>{let n=A(`profilePage.modelAccounts.authTypes.${e.authType}`);return{value:e.authProfileId,label:e.label,description:t.indexOf(e.label)===t.lastIndexOf(e.label)?n:`${n} · ${e.authProfileId}`}}),...e.linkedId&&!e.accounts.some(t=>t.authProfileId===e.linkedId)?[{value:e.linkedId,label:A(`profilePage.modelAccounts.gatewayAccount`)}]:[],{value:br,label:A(`profilePage.modelAccounts.unlinkAction`)}]});return U(X,{get title(){return r()},get control(){return U(Ke,{style:xr,get params(){return{label:`${r()}: ${A(`profilePage.modelAccounts.linkedStatus`)}`,className:`profile-auth-account-picker`,value:e.linkedId??br,options:i(),disabled:e.pending||e.actions.saving()||n().busy,onChange:t=>{t===br?e.actions.updateAccount(`unlink`,e.provider):e.actions.updateAccount(`select`,t)}}}})}})}function er(e){let t=()=>e.readState(),n=()=>t().signIn,r=()=>n()?.providers.find(e=>e.id===n()?.provider);var i=sr(),a=i.firstChild,o=a.nextSibling,s=o.nextSibling,c=s.firstChild,l=c.firstChild;return z(i,U(X,{get title(){return A(`profilePage.modelAccounts.provider`)},stackedOnNarrow:!0,get control(){return U(Ke,{style:xr,get params(){return{label:A(`profilePage.modelAccounts.provider`),className:`profile-auth-provider`,value:n()?.provider||null,options:n()?.providers.map(e=>({value:e.id,label:e.label}))??[],disabled:e.pending||t().busy,renderLeading:e=>U(xt,{get provider(){return e.value}}),onChange:e=>t().selectProvider(e)}}})}}),a),z(i,U(F,{get when(){return r()},get children(){return U(X,{get title(){return A(`profilePage.modelAccounts.method`)},stackedOnNarrow:!0,get control(){return U(Ke,{style:xr,get params(){return{label:A(`profilePage.modelAccounts.method`),className:`profile-auth-method`,value:n()?.method||null,options:r()?.methods.map(e=>({value:e.id,label:e.label,description:e.hint}))??[],disabled:e.pending||t().busy,onChange:e=>t().selectMethod(e)}}})}})}}),o),z(i,U(F,{get when(){return B(()=>!(e.pending||t().busy||t().error))()?n()?.providers.length===0:!e.pending&&!t().busy&&!t().error},get children(){return U(X,{get title(){return A(`profilePage.modelAccounts.noMethods`)}})}}),s),z(c,()=>e.cancel,l),l._$$click=()=>void e.actions.startConnect(),z(l,()=>A(`profilePage.modelAccounts.connectAction`)),W(()=>e.pending||t().busy||!n()?.method,e=>{V(l,`disabled`,e)}),i}function tr(e){let t=()=>e.readState();return U(F,{get when(){return t().statusUnavailable||e.pending},get children(){var n=cr();return n._$$click=()=>e.onCheck(),z(n,()=>A(`profilePage.modelAccounts.checkStatusAction`)),W(()=>e.pending||t().cancelBusy,e=>{V(n,`disabled`,e)}),n}})}function nr(e){let t=()=>e.readState(),n=()=>t().props.target.read().gateway,r=()=>n().selfUser?.id===t().props.target.read().identityId?n().selfUser:null,i=()=>r()||t().target?t().props.personLabel||r()?.name||r()?.email||A(`profilePage.modelAccounts.currentPerson`):null;return[U(X,{get title(){return A(`profilePage.modelAccounts.gateway`)},get control(){return U(wt,{mono:!0,get value(){return Qn((t().target?.client??n().client).gatewayUrl)}})}}),U(X,{get title(){return A(`profilePage.modelAccounts.person`)},get control(){return U(wt,{get value(){return i()??A(`profilePage.modelAccounts.noPerson`)}})}})]}function rr(e){let t=()=>e.readState(),n=()=>t().signIn,r=()=>n()?.providers.find(e=>e.id===n()?.provider),i=()=>e.actions.flow(),a=P(()=>t().catalogReceipt),o=rt(()=>a().result.then(e=>{if(e)throw Error(e)})),s=P(()=>t().statusReceipt),c=rt(()=>s().result.then(e=>{if(e)throw Error(e)})),l=()=>(o(),null),u=()=>(c(),null),d=()=>(()=>{var n=lr();return n._$$click=()=>{i()?e.actions.cancel():t().closeSignIn()},z(n,()=>A(`profilePage.modelAccounts.cancelAction`)),W(()=>t().cancelBusy,e=>{V(n,`disabled`,e)}),n})();return U(F,{get when(){return n()},get children(){return U(F,{get when(){return i()},get fallback(){return[U(X,{get title(){return A(`profilePage.modelAccounts.addAccount`)},get description(){return A(`profilePage.modelAccounts.personalDescription`)}}),U(nr,{get readState(){return e.readState}}),U(it,{fallback:()=>U(er,{get readState(){return e.readState},get actions(){return e.actions},pending:!1,get cancel(){return d()}}),get children(){return U(dt,{get fallback(){return U(er,{get readState(){return e.readState},get actions(){return e.actions},pending:!0,get cancel(){return d()}})},get children(){return[B(()=>l()),U(er,{get readState(){return e.readState},get actions(){return e.actions},get pending(){return at(o)},get cancel(){return d()}})]}})}})]},get children(){return U(X,{stacked:!0,get title(){return i()?.step?.title??r()?.label??A(`profilePage.modelAccounts.connectAction`)},get control(){var n=ur(),r=n.firstChild,a=r.nextSibling;return z(n,U(F,{get when(){return i()?.step},get fallback(){return[(()=>{var e=dr();return z(e,()=>A(`common.loading`)),e})(),B(d)]},children:n=>U(_t,{get step(){return n()},get value(){return t().stepValue},get busy(){return t().busy},inputId:`profile-account-auth-answer`,get leadingAction(){return d()},onValueChange:e=>t().setStepValue(n().id,e),onAnswer:t=>void e.actions.answerStep(n().id,t)})}),r),z(n,U(it,{fallback:(n,r)=>U(tr,{get readState(){return e.readState},get actions(){return e.actions},pending:!1,onCheck:()=>{t().connectStatus(`status`),r()}}),get children(){return U(dt,{get fallback(){return U(tr,{get readState(){return e.readState},get actions(){return e.actions},pending:!0,onCheck:()=>void t().connectStatus(`status`)})},get children(){return[B(()=>u()),U(tr,{get readState(){return e.readState},get actions(){return e.actions},get pending(){return at(c)},onCheck:()=>void t().connectStatus(`status`)})]}})}}),a),n}})}})}})}function ir(e){let t=()=>e.readState(),n=P(()=>t().accounts),r=P(()=>Map.groupBy(n(),e=>e.provider)),i=P(()=>new Map(e.actions.links().map(e=>[e.provider,e.authProfileId]))),a=P(()=>[...new Set([...r().keys(),...i().keys()])]);return[U(F,{get when(){return a().length},get fallback(){return U(F,{get when(){return B(()=>!e.pending)()&&!t().inventoryLoading},get fallback(){return U(jt,{get label(){return A(`common.loading`)},rows:2})},get children(){return U(F,{get when(){return!t().inventoryError},get children(){return U(J,{get message(){return A(`profilePage.modelAccounts.empty`)}})}})}})},get children(){return U($e,{get each(){return a()},keyed:e=>e,children:t=>U($n,{get readState(){return e.readState},get actions(){return e.actions},get pending(){return e.pending},get provider(){return t()},get accounts(){return r().get(t())??[]},get linkedId(){return i().get(t())}})})}}),U(F,{get when(){return!!t().nextCursor},get children(){return U(X,{get title(){return A(`profilePage.modelAccounts.savedAccounts`)},get control(){var n=fr();return n._$$click=()=>void t().loadAccounts(t().nextCursor),z(n,()=>A(`profilePage.modelAccounts.loadMore`)),W(()=>e.pending||e.actions.saving()||t().busy,e=>{V(n,`disabled`,e)}),n}})}})]}function ar(e){let t=()=>e.readState();return[U(rr,{get readState(){return e.readState},get actions(){return e.actions}}),U(F,{get when(){return B(()=>!!t().signIn)()?t().target?.canAdmin:t().signIn},get children(){return U(X,{get title(){return A(`profilePage.modelAccounts.inputLabel`)},get description(){return A(`profilePage.modelAccounts.inputDescription`)},stackedOnNarrow:!0,get control(){var n=gr(),r=n.firstChild,i=r.nextSibling;return n.addEventListener(`submit`,n=>{n.preventDefault(),e.actions.updateAccount(`link`,t().linkDraft.trim())}),r._$$input=e=>t().setLinkDraft(e.currentTarget.value),z(i,()=>A(`profilePage.modelAccounts.linkAction`)),W(()=>({e:A(`profilePage.modelAccounts.inputLabel`),t:t().linkDraft,a:A(`profilePage.modelAccounts.inputPlaceholder`),o:e.actions.saving()||t().busy,i:t().busy||!t().linkDraft.trim()}),({e,t,a:n,o:a,i:o},s)=>{e!==s?.e&&V(r,`aria-label`,e),r.value=t??``,n!==s?.a&&V(r,`placeholder`,n),a!==s?.o&&V(r,`disabled`,a),o!==s?.i&&V(i,`disabled`,o)}),n}})}}),U(F,{get when(){return t().notice},get children(){var e=pr(),n=e.firstChild;return z(n,()=>A(`profilePage.modelAccounts.notices.${t().notice}`)),e}}),U(F,{get when(){return t().error},get children(){var e=mr(),n=e.firstChild;return z(n,()=>t().error),e}}),U(F,{get when(){return t().inventoryError},get children(){var e=hr(),n=e.firstChild,r=n.firstChild,i=r.nextSibling;return z(n,()=>A(`profilePage.modelAccounts.inventoryFailed`),r),z(n,()=>t().inventoryError,i),e}})]}function or(e){let t=()=>e.readState(),n=()=>t().props.target.read().gateway,r=()=>n().selfUser?.id===t().props.target.read().identityId?n().selfUser:null,a=()=>n().phase===`connected`?r()?i(n().hello?.auth??null)?`profile`:`write`:`identity`:`disconnected`;return U(Y,{get title(){return A(`profilePage.modelAccounts.title`)},get description(){return A(`profilePage.modelAccounts.description`)},get actions(){return[U(F,{get when(){return B(()=>!!t().target)()?!t().signIn:t().target},get children(){var n=_r();return n._$$click=()=>t().openSignIn(),z(n,()=>A(`profilePage.modelAccounts.addAccount`)),W(()=>e.actions.saving()||t().busy,e=>{V(n,`disabled`,e)}),n}}),U(pn,{id:`settings-profile-model-accounts-help`,get section(){return A(`profilePage.modelAccounts.title`)},get children(){var e=vr();return z(e,()=>A(`profilePage.modelAccounts.descriptionMore`)),e}})]},get children(){return[U(F,{get when(){return B(()=>!!t().target)()?n().phase!==`connected`:t().target},get children(){return U(X,{get title(){return A(`profilePage.modelAccounts.signInUnavailable`)},get description(){return A(`profilePage.modelAccounts.unavailable.disconnected`)}})}}),U(F,{get when(){return t().target},get fallback(){return[U(nr,{get readState(){return e.readState}}),U(X,{get title(){return A(`profilePage.modelAccounts.signInUnavailable`)},get description(){return A(`profilePage.modelAccounts.unavailable.${a()}`)},stacked:!0,get control(){return[(()=>{var e=yr();return e._$$click=()=>t().context.navigate(`connection`),z(e,()=>A(`profilePage.modelAccounts.connectionSettings`)),e})(),U(Ot,{url:`https://docs.openclaw.ai/concepts/multi-user#per-person-model-accounts`})]}})]},get children(){return[B(()=>e.inventory),U(ar,{get readState(){return e.readState},get actions(){return e.actions}})]}})]}})}var sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr;function Sr(){return(Sr=e((()=>{K(),R(),l(),fe(),gn(),Z(),vt(),fn(),k(),bt(),sr=q(`<div class=model-accounts-choice><!><!><div class="settings-row settings-row--actions"><div class=settings-row__control><button type=button class="btn btn--sm primary profile-auth-connect-start">`),cr=q(`<button type=button class="btn btn--sm profile-auth-connect-check">`),lr=q(`<button type=button class="btn btn--sm profile-auth-connect-cancel">`),ur=q(`<div class=model-accounts-flow><!><!>`),dr=q(`<span role=status>`),fr=q(`<button type=button class="btn btn--sm profile-auth-accounts-more">`),pr=q(`<div class="settings-row model-accounts-notice"role=status><span class=settings-row__desc>`),mr=q(`<div class="settings-row model-accounts-error"role=alert><span class=settings-row__desc>`),hr=q(`<div class="settings-row model-accounts-error"role=alert><span class=settings-row__desc> <!>`),gr=q(`<form class=model-accounts-form><input class="settings-input profile-auth-link-input"type=text><button type=submit class="btn btn--sm profile-auth-link-submit">`),_r=q(`<button type=button class="btn btn--sm primary profile-auth-add-account">`),vr=q(`<p>`),yr=q(`<button type=button class="btn btn--sm">`),M(dn),br=`gateway-default`,xr=`width:340px;max-width:100%;min-width:0`,G([`click`,`input`])})))()}var Cr;function wr(){return(wr=e((()=>{l(),E(),k(),Cr=class{get actionRetired(){return this.actionLifetime.promise}retireAction(){this.actionLifetime.resolve(),this.actionLifetime=Promise.withResolvers()}constructor(e,t,n){this.context=e,this.props=t,this.publish=n,this.links=[],this.accounts=[],this.inventoryLoading=!1,this.inventoryError=null,this.inventoryReceipt={result:Promise.resolve(null)},this.action=null,this.error=null,this.notice=null,this.linkDraft=``,this.signIn=null,this.connectFlow=null,this.statusUnavailable=!1,this.catalogReceipt={result:Promise.resolve(null)},this.statusReceipt={result:Promise.resolve(null)},this.actionLifetime=Promise.withResolvers(),this.target=null,this.generation=0,this.inventoryRequest=0,this.pollTimer=null,this.connected=!0}dispose(){this.actionLifetime.resolve(),this.connected=!1,this.generation+=1,this.target=null,this.stopPoll()}applySnapshot({gateway:e,identityId:t,profileId:r}){let a=e.phase===`connected`,o=a&&e.selfUser!==void 0,s=o!==this.connected||o&&this.hello!==e.hello,c=a?i(e.hello?.auth??null):this.target!==null,l=c?e.client:null,u=o?e.selfUser?.id??null:this.target?.identityId??null,d=l&&u===t?r:null,f=a?c&&n(e.hello?.auth??null):this.target?.canAdmin??!1,p=this.target?.client===l&&this.target?.identityId===u&&this.target?.profileId===d&&this.target?.canAdmin===f;this.connected=o,this.hello=e.hello,(!p||s)&&(this.retireAction(),this.generation+=1,this.stopPoll(),this.inventoryRequest+=1,this.inventoryLoading=!1,this.inventoryError=null,this.inventoryReceipt={result:Promise.resolve(null)},this.catalogReceipt={result:Promise.resolve(null)},this.statusReceipt={result:Promise.resolve(null)},this.action=null,this.error=null,this.notice=null,p||(this.target=l&&u&&d?{client:l,identityId:u,profileId:d,canAdmin:f}:null,this.links=[],this.accounts=[],this.nextCursor=void 0,this.linkDraft=``,this.signIn=null,this.connectFlow=null,this.stepValue=void 0,this.statusUnavailable=!1),this.publish(),this.target&&o&&(this.loadAccounts(),this.schedulePoll()))}applyLinks(e){this.links=e,this.accounts=this.accounts.map(t=>({...t,selected:e.some(e=>e.authProfileId===t.authProfileId)}))}loadAccounts(e){let t=this.target;if(!t||!this.connected)return Promise.resolve();let n=++this.inventoryRequest;this.inventoryLoading=!0,this.inventoryError=null;let r=this.readAccounts(t,n,e);return this.inventoryReceipt={result:r},this.publish(),r.then(()=>{})}async readAccounts(e,t,n){let r=()=>this.connected&&this.target===e&&t===this.inventoryRequest;try{let t=await e.client.request(`users.listModelAccounts`,{profileId:e.profileId,...n?{cursor:n}:{}});return r()&&(this.accounts=n?[...this.accounts,...t.accounts]:t.accounts,this.nextCursor=t.nextCursor,this.applyLinks(t.links)),null}catch(e){return r()?(this.inventoryError=D(e),this.inventoryError):null}finally{r()&&(this.inventoryLoading=!1,this.publish())}}isCurrent(e,t){return this.connected&&this.target===e&&this.generation===t}async runAction(e,t,n){let r=this.target;if(!r||!this.connected||this.action&&(e!==`cancel`||this.action!==`answer`))return;this.retireAction();let i=++this.generation;this.stopPoll(),this.action=e,this.error=null,this.notice=null,this.statusUnavailable=!1,this.publish();try{let e=await t(r);this.isCurrent(r,i)&&n(e)}catch(e){this.isCurrent(r,i)&&(this.error=[A(`profilePage.modelAccounts.actionFailed`),D(e)].filter(Boolean).join(` `))}finally{this.isCurrent(r,i)&&(this.action=null,this.schedulePoll(this.connectFlow?.step?2e3:0),this.publish())}}updateAccount(e,t){if(e===`link`&&(!t||!this.target?.canAdmin))return;let n={link:`users.linkAuthProfile`,unlink:`users.unlinkAuthProfile`,select:`users.selectModelAccount`};return this.runAction(`request`,r=>r.client.request(n[e],{profileId:r.profileId,...e===`unlink`?{provider:t}:{authProfileId:t}}),t=>{this.applyLinks(t.links),e!==`select`&&(this.linkDraft=``),this.notice=e===`unlink`?`cleared`:`selected`,this.loadAccounts()})}openSignIn(){this.signIn={providers:[],provider:``,method:``};let e=this.runAction(`request`,e=>e.client.request(`users.authConnect.catalog`,{profileId:e.profileId}),e=>{this.signIn={providers:e.providers,provider:``,method:``}}),t=this.generation;this.catalogReceipt={result:e.then(()=>this.generation===t?this.error:null)},this.publish()}selectProvider(e){let t=this.signIn,n=t?.providers.find(t=>t.id===e);t&&n&&!this.action&&!this.connectFlow&&(this.signIn={...t,provider:e,method:n.methods.length===1?n.methods[0]?.id??``:``},this.publish())}startConnect(){let e=this.signIn;if(e?.providers.some(t=>t.id===e.provider&&t.methods.some(t=>t.id===e.method)))return this.runAction(`request`,t=>t.client.request(`users.authConnect.start`,{profileId:t.profileId,provider:e.provider,method:e.method}),e=>{this.connectFlow=e,this.stepValue=void 0})}applyConnectStatus(e){e.status===`pending`?(e.error&&(this.error=[A(`profilePage.modelAccounts.signInFailed`),D(e.error)].filter(Boolean).join(` `)),this.connectFlow&&=(this.connectFlow.step?.id!==e.step?.id&&(this.stepValue=e.step?.sensitive?void 0:e.step?.initialValue),{...this.connectFlow,step:e.step})):(this.error=null,this.statusUnavailable=!1,this.stopPoll(),this.signIn=null,this.connectFlow=null,this.stepValue=void 0,e.status===`failed`?this.error=A(`profilePage.modelAccounts.connectErrors.${e.reason}`):(e.status===`connected`&&(this.applyLinks(e.links),this.loadAccounts()),this.notice=e.status))}connectStatus(e){let t=this.connectFlow;if(!t)return;let n=this.runAction(e===`status`?`request`:e,n=>n.client.request(`users.authConnect.${e}`,{profileId:n.profileId,connectId:t.connectId}),e=>this.applyConnectStatus(e));if(e===`status`){let e=this.generation;this.statusReceipt={result:n.then(()=>this.generation===e?(this.error&&this.connectFlow&&(this.statusUnavailable=!0,this.publish()),this.error):null)},this.publish()}return n}answerStep(e,t){let n=this.connectFlow,r=n?.step;if(this.connected&&n&&r&&r.id===e&&r.type!==`progress`)return r.sensitive&&(this.stepValue=void 0),this.runAction(`answer`,e=>e.client.request(`users.authConnect.answer`,{profileId:e.profileId,connectId:n.connectId,stepId:r.id,...t===void 0?{}:{value:t}}),e=>this.applyConnectStatus(e))}stopPoll(){this.pollTimer!==null&&(clearTimeout(this.pollTimer),this.pollTimer=null)}schedulePoll(e=2e3){this.stopPoll();let t=this.connectFlow;if(!this.connected||!t||!this.target||this.action)return;let n=Math.max(0,Math.min(e,t.expiresAtMs-Date.now()));this.pollTimer=setTimeout(()=>{this.pollTimer=null,this.pollStatus()},n)}async pollStatus(){let e=this.target,t=this.connectFlow,n=this.generation;if(this.connected&&e&&t&&!this.action)try{let r=await e.client.request(`users.authConnect.status`,{profileId:e.profileId,connectId:t.connectId});if(!this.isCurrent(e,n)||this.connectFlow?.connectId!==t.connectId)return;this.applyConnectStatus(r),this.publish(),this.connectFlow&&(Date.now()>=t.expiresAtMs?(this.statusUnavailable=!0,this.error=A(`profilePage.modelAccounts.statusTimedOut`),this.publish()):this.schedulePoll())}catch(t){this.isCurrent(e,n)&&(this.statusUnavailable=!0,this.error=[A(`profilePage.modelAccounts.statusFailed`),D(t)].filter(Boolean).join(` `),this.publish())}}get busy(){return!this.connected||this.inventoryLoading||this.action!==null}get cancelBusy(){return!this.connected||this.action!==null&&this.action!==`answer`}setLinkDraft(e){this.linkDraft=e,this.publish()}selectMethod(e){this.signIn&&!this.action&&!this.connectFlow&&(this.signIn={...this.signIn,method:e},this.publish())}closeSignIn(){!this.action&&!this.connectFlow&&(this.signIn=null,this.error=null,this.publish())}setStepValue(e,t){this.connectFlow?.step?.id===e&&(this.stepValue=t,this.publish())}}})))()}function Tr(e){let t=O(),n=new Cr(t,e,()=>r.publish()),r=he(n,e=>e),i=r.read,a=Xn(i),o=P(()=>i().target),s=P(()=>i().inventoryReceipt),c=rt(()=>s().result.then(e=>{if(e)throw Error(e)})),l=()=>(c(),null);H(()=>{let r=e.target,i=()=>{n.applySnapshot(r.read()),n.publish()},a=r.subscribe(i),o=r.subscribeRefresh?.(()=>void n.loadAccounts()),s=t.gateway.subscribeEvents(e=>{re(e)&&n.loadAccounts()});return i(),()=>{s(),o?.(),a(),n.dispose()}});var u=Er();return u._$owner=I(),z(u,U(F,{get when(){return i().target||i().context.gateway.snapshot.phase===`connected`},get children(){return U(or,{readState:i,actions:a,get inventory(){return U(it,{fallback:()=>U(ir,{readState:i,actions:a,pending:!1}),get children(){return U(dt,{get on(){return et(o)},get fallback(){return U(ir,{readState:i,actions:a,pending:!0})},get children(){return[B(()=>l()),U(ir,{readState:i,actions:a,get pending(){return at(c)}})]}})}})}})}})),W(()=>a.saving()?`true`:`false`,e=>{V(u,`aria-busy`,e)}),u}var Er;function Dr(){return(Dr=e((()=>{K(),R(),fn(),We(),j(),k(),ge(),Zn(),Sr(),wr(),Er=q(`<openclaw-model-accounts>`,1),M(dn)})))()}async function Or(e){let t=zt();if(t){let n=Rt();try{return(await e.request(`openclawId.account`,{action:`link_held`,idToken:t.idToken})).link}catch(e){if(!(e instanceof w)||_(e)!==`sign_in_not_held`)throw e;if(Rt()!==n)throw Error(`You signed out while linking was in progress. Sign in again.`,{cause:e})}}let{showDeviceSignInDialog:n}=await p(async()=>{let{showDeviceSignInDialog:e}=await import(`./device-sign-in-dialog-Cd2yPFpR.js`);return{showDeviceSignInDialog:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url),r=await n({client:e,basePath:v(window.location.pathname)[0],link:!0});return r?r.link??null:null}function kr(){return(kr=e((()=>{T(),C(),Bt(),t()})))()}function Ar(){let e=O(),[t,n]=N(Vt().aborted?{kind:`off`}:{kind:`loading`}),[r,i]=N(!1),[a,o]=N(null),s=()=>e.gateway.snapshot.client,c=async()=>{let e=s();if(!e||Vt().aborted){n({kind:`off`});return}let t=await e.request(`openclawId.status`,{});if(t.status.state===`off`){n({kind:`off`});return}if(t.accountSignIn!==`device`){n({kind:`unavailable`});return}let{linked:r}=await e.request(`openclawId.account`,{action:`link_status`});n({kind:`ready`,links:r,claw:t.link.hostname?Ut(t.link.hostname):null})},l=()=>{n({kind:`loading`}),c().catch(()=>n({kind:`failed`}))},u=async e=>{i(!0),o(null);try{await e(),await c()}catch(e){o(D(e instanceof Error?e.message:A(`profilePage.openclawId.failed`)))}finally{i(!1)}},d=()=>u(async()=>{let e=s();if(!e)return;let t=await Or(e);t===`linked_elsewhere`?o(A(`profilePage.openclawId.linkedElsewhere`)):t===`profile_linked`?o(A(`profilePage.openclawId.profileLinked`)):(t===`owner_profile`||t===`profile_changed`)&&o(A(`profilePage.openclawId.failed`))}),f=()=>u(async()=>{await s()?.request(`openclawId.account`,{action:`unlink`})}),p=(e,t)=>{let n=e.email??A(`profilePage.openclawId.title`);return e.owner&&t?A(`profilePage.openclawId.ownerOf`,{email:n,claw:t}):n},m=()=>{let e=t();return e.kind===`ready`?e:void 0};H(l);let h=e=>(()=>{var t=jr();return t._$$click=()=>void d(),V(t,`disabled`,e),z(t,()=>A(`profilePage.openclawId.linkShort`)),W(()=>A(`profilePage.openclawId.link`),e=>{V(t,`aria-label`,e)}),t})();return U(F,{get when(){return t().kind!==`off`},get children(){return[U(X,{get title(){return A(`profilePage.openclawId.title`)},get description(){return U(ct,{get children(){return[U(L,{get when(){return t().kind===`loading`},get children(){return U(Q,{kind:`muted`,get label(){return A(`common.loading`)}})}}),U(L,{get when(){return t().kind===`unavailable`},get children(){return U(Q,{kind:`muted`,get label(){return A(`profilePage.openclawId.unavailable`)}})}}),U(L,{get when(){return t().kind===`failed`},get children(){return U(Q,{kind:`danger`,get label(){return A(`profilePage.openclawId.loadFailed`)}})}}),U(L,{get when(){return m()},children:e=>U(F,{get when(){return e().links.length>0},get fallback(){return U(Q,{kind:`muted`,get label(){return A(`profilePage.openclawId.notLinked`)}})},get children(){var t=Nr();return z(t,U($e,{get each(){return e().links},children:t=>(()=>{var n=Pr();return z(n,()=>p(t,e().claw)),n})()})),t}})})]}})},get control(){return U(ct,{get fallback(){return h(!0)},get children(){return[U(L,{get when(){return t().kind===`failed`},get children(){return U(At,{onRetry:l})}}),U(L,{get when(){return t().kind===`unavailable`},children:null}),U(L,{get when(){return m()},children:e=>U(F,{get when(){return e().links.length>0},get fallback(){return h(r())},get children(){var e=jr();return e._$$click=()=>void f(),z(e,()=>A(`profilePage.openclawId.unlink`)),W(()=>r(),t=>{V(e,`disabled`,t)}),e}})})]}})}}),U(F,{get when(){return a()},get children(){var e=Mr(),t=e.firstChild;return z(t,a),e}})]}})}var jr,Mr,Nr,Pr;function Fr(){return(Fr=e((()=>{K(),R(),Z(),Gt(),E(),Ht(),kr(),j(),k(),jr=q(`<button class="btn btn--sm">`),Mr=q(`<div class="settings-row identity-error"role=alert><span class=settings-row__desc>`),Nr=q(`<span class=identity-emails>`),Pr=q(`<span class=identity-account>`),M(Wt),G([`click`])})))()}var Ir,Lr;function Rr(){return(Rr=e((()=>{te(),Ir={profilePage:{personalInstructions:{signIn:`Sign in with your personal profile to edit your instructions.`,offline:`Reconnect to edit your instructions.`,accessRequired:`You need permission to view your own sessions to edit your instructions. Ask an admin for access.`,noAgents:`No agents yet. Ask an admin to add one.`,guidance:`{count} / 4,000 characters. Keep it brief: preferences, context, and working style.`,missing:`Your personal file will be created when you save.`,tooLong:`Shorten your instructions to 4,000 characters before saving.`,reload:`Reload`,dirty:`Unsaved changes`,saved:`Saved`,discard:`Discard your unsaved instructions and load the saved file?`,discardBody:`Your edits since the last save are lost.`,discardAction:`Discard`,failureHint:`Your draft is unchanged. If the file changed elsewhere, copy your draft, then reload before saving again.`,contextChanged:`The returned file does not match this profile and agent. Reload before trying again.`}}},Lr=Object.assign(()=>{Object.assign(x.profilePage.personalInstructions,Ir.profilePage.personalInstructions)},{catalog:Ir})})))()}function zr(e){let t=O(),n=de(t.agents),[r,i]=N(0,{ownedWrite:!0}),[a,o]=N(null,{ownedWrite:!0}),s=P(()=>Promise.resolve(a())),[c,l]=tt(),u=ft(function*(e){l(e),yield e}),d=new Yr(t,()=>i(e=>e+1),e=>{o(e)}),f=()=>{let e=d.save();e&&setTimeout(()=>{d.available&&a()===e&&u(e).catch(()=>{})},0)},p=()=>(r(),d);H(()=>{let e=()=>d.syncContext(),n=[t.gateway.subscribe(e),t.agents.subscribe(e),t.settingsAgentSelection.subscribe(e)];return d.syncContext(),t.agents.ensureList(),()=>{n.forEach(e=>e()),d.dispose()}});function m(e){var t=Gr(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,o=i.nextSibling;return z(t,U(F,{get when(){return B(()=>!!e.file)()?p().file:e.file},get children(){return[(()=>{var t=Br();return t._$$input=e=>{d.draft=e.currentTarget.value,d.saved=!1,d.publish()},W(()=>({e:p().draft,t:e.pending,a:A(`profilePage.personalInstructions.title`)}),({e,t:n,a:r},i)=>{t.value=e??``,n!==i?.t&&V(t,`disabled`,n),r!==i?.a&&V(t,`aria-label`,r)}),t})(),(()=>{var e=Vr(),t=e.firstChild,n=t.nextSibling;return z(e,()=>A(`profilePage.personalInstructions.guidance`,{count:String(p().draft.length)}),t),z(e,(()=>{var e=B(()=>!!p().file?.missing);return()=>e()?` ${A(`profilePage.personalInstructions.missing`)}`:null})(),n),e})(),U(F,{get when(){return p().draft.length>4e3},get children(){var e=Hr();return z(e,()=>A(`profilePage.personalInstructions.tooLong`)),e}})]}}),n),z(t,U(F,{get when(){return e.error},get children(){var t=Ur(),n=t.firstChild,r=n.nextSibling;return z(t,()=>e.error,n),z(t,U(F,{get when(){return p().dirty},get children(){return A(`profilePage.personalInstructions.failureHint`)}}),r),t}}),r),i._$$click=f,z(i,(()=>{var e=B(()=>c()===a());return()=>e()?A(`common.saving`):A(`common.save`)})()),z(r,U(F,{get when(){return e.error},get children(){var t=Wr();return t._$$click=()=>void d.reload(),z(t,()=>A(`profilePage.personalInstructions.reload`)),W(()=>e.pending,e=>{V(t,`disabled`,e)}),t}}),o),z(o,(()=>{var e=B(()=>!!p().dirty);return()=>e()?A(`profilePage.personalInstructions.dirty`):B(()=>!!p().saved)()?A(`profilePage.personalInstructions.saved`):null})()),W(()=>({e:e.pending?`true`:`false`,t:!p().file||!p().dirty||e.pending||p().draft.length>4e3||!p().agents.some(e=>e.id===p().agentId)}),({e,t:n},r)=>{e!==r?.e&&V(t,`aria-busy`,e),n!==r?.t&&V(i,`disabled`,n)}),t}var h=qr();return h._$owner=I(),z(h,U(F,{get when(){return p().multipleProfiles},get children(){var e=Kr();return z(e,U(Y,{get title(){return A(`profilePage.personalInstructions.title`)},get description(){return A(`profilePage.personalInstructions.description`)},get children(){return U(F,{get when(){return p().available},get fallback(){return U(J,{get message(){return p().unavailableMessage}})},get children(){return[U(F,{get when(){return n.read().agentsError},get children(){return U(J,{get message(){var e=Jr(),r=e.firstChild,i=r.nextSibling;return z(e,()=>D(n.read().agentsError),r),z(e,U(At,{type:`button`,onRetry:()=>void t.agents.ensureList()}),i),e}})}}),U(F,{get when(){return p().agents.length},get fallback(){return U(F,{get when(){return!n.read().agentsError},get children(){return U(F,{get when(){return B(()=>!!n.read().agentsList)()?!n.read().agentsLoading:n.read().agentsList},get fallback(){return U(jt,{get label(){return A(`common.loading`)},rows:1})},get children(){return U(J,{get message(){return A(`profilePage.personalInstructions.noAgents`)}})}})}})},get children(){return U(dt,{get on(){return a()},get fallback(){return U(m,{get file(){return p().file},pending:!0})},get children(){return U(it,{fallback:e=>U(m,{get file(){return p().file},get error(){return D(e())}}),get children(){return U(m,{get file(){return s()},get pending(){return at(s)}})}})}})}})]}})}})),W(()=>Ct.personalInstructions,t=>{V(e,`id`,t)}),e}})),W(()=>e.hidden,e=>{V(h,`hidden`,e)}),h}var Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr;function Xr(){return(Xr=e((()=>{K(),R(),l(),Xe(),Z(),Rr(),E(),j(),qe(),k(),St(),Br=q(`<textarea id=personal-instructions-content class="settings-input personal-instructions__editor"rows=7 aria-describedby=personal-instructions-guidance>`),Vr=q(`<div id=personal-instructions-guidance class=settings-row__desc><!><!>`),Hr=q(`<div role=alert>`),Ur=q(`<div class=personal-instructions__error role=alert> <!>`),Wr=q(`<button class=btn>`),Gr=q(`<div class=personal-instructions><!><div class=personal-instructions__actions><button class=btn></button><span class=settings-row__desc role=status>`),Kr=q(`<div>`),qr=q(`<openclaw-personal-instructions>`,1),Jr=q(`<span role=alert> <!>`),M(Lr),Yr=class{constructor(e,t,n){this.context=e,this.publish=t,this.presentFile=n,this.agentId=``,this.file=null,this.draft=``,this.busy=!1,this.saved=!1,this.client=null,this.profileId=null,this.connectionId=null,this.gatewayUrl=null,this.available=!1,this.multipleProfiles=!1,this.drafts=new Map}get agents(){return this.context.agents.state?.agentsList?.agents??[]}get dirty(){return this.file!==null&&this.draft!==this.file.content}get unavailableMessage(){let e=this.context.gateway.snapshot;return e.phase===`connected`?!this.multipleProfiles||!e.selfUser?.id?A(`profilePage.personalInstructions.signIn`):A(`profilePage.personalInstructions.accessRequired`):A(`profilePage.personalInstructions.offline`)}dispose(){this.client=null,this.available=!1}syncContext(){let e=this.context.gateway.snapshot,t=e.phase===`connected`,n=e.selfUser?.id??this.profileId,r=this.context.gateway.connection.gatewayUrl,i=e.hello?.server?.connId??null;this.multipleProfiles=e.hello?.policy?.hasMultipleSessionSharingIdentities===!0;let a=t&&this.multipleProfiles&&!!e.selfUser?.id&&g(e.hello?.auth??null),o=n!==this.profileId||r!==this.gatewayUrl,s=o||e.client!==this.client||i!==this.connectionId||a!==this.available;s&&(this.client=e.client,this.connectionId=i,this.gatewayUrl=r,this.profileId=n,this.available=a,o&&(this.file=null,this.draft=``,this.agentId=``,this.drafts.clear()));let c=this.context.settingsAgentSelection.state.selectedId,l=this.agents.some(e=>e.id===c)?c:``,u=l!==this.agentId;if(u){this.dirty&&this.file?this.drafts.set(this.agentId,{file:this.file,content:this.draft}):this.drafts.delete(this.agentId),this.agentId=l;let e=this.drafts.get(l);this.drafts.delete(l),this.file=e?.file??null,this.draft=e?.content??``}(s||u)&&(this.busy=!1,this.saved=!1,this.presentFile(this.file)),this.available&&this.agentId&&!this.dirty&&(s||u)&&this.load(),this.publish()}load(){let e=this.client,t=this.agentId,n=this.profileId;e&&this.available&&t&&!this.busy&&this.requestFile(`load`,{agentId:t,profileId:n},()=>e.request(`users.personalFile.get`,{agentId:t}))}save(){let e=this.client,t=this.file;if(!e||!t||!this.available||this.busy||!this.dirty||t.agentId!==this.agentId||this.draft.length>4e3||!this.agents.some(e=>e.id===t.agentId))return;let n=this.draft;return this.requestFile(`save`,t,()=>e.request(`users.personalFile.set`,{agentId:t.agentId,content:n,expectedHash:t.hash}))}requestFile(e,t,n){let r=this.client,i=this.connectionId,a=this.draft,o=()=>this.available&&this.client===r&&this.connectionId===i&&this.agentId===t.agentId&&this.profileId===t.profileId;this.busy=!0,this.saved=!1;let s=(async()=>{try{let r=await n();if(!o())return null;if(r.agentId!==t.agentId||r.profileId!==t.profileId)throw Error(A(`profilePage.personalInstructions.contextChanged`));return this.file=r,this.draft===a&&(this.busy=!1,this.draft=r.content),this.drafts.delete(r.agentId),this.saved=e===`save`&&this.draft===r.content,r}catch(e){if(o())throw e;return null}finally{o()&&(this.draft===a&&(this.busy=!1),this.publish())}})();return s.catch(()=>{o()&&this.presentFile(s)}),this.presentFile(s),this.publish(),s}async reload(){(!this.dirty||await Ze({title:A(`profilePage.personalInstructions.discard`),message:A(`profilePage.personalInstructions.discardBody`),confirmLabel:A(`profilePage.personalInstructions.discardAction`),danger:!0}))&&this.load()}},G([`input`,`click`])})))()}function Zr(e){let t=()=>e.getView().ownProfile?.id===d;return U(F,{get when(){return B(()=>!!e.getView().selfUser)()?e.getView().ownProfile:e.getView().selfUser},get children(){var n=$r();return z(n,U(Y,{get title(){return A(`profilePage.identity.attribution`)},get actions(){return U(pn,{id:`settings-profile-attribution-help`,get section(){return A(`profilePage.identity.attribution`)},get children(){return[(()=>{var e=ei(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`profilePage.identity.gitCoauthor`)),z(e,()=>A(`profilePage.identity.gitCoauthorDescription`),null),e})(),(()=>{var e=ei(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`profilePage.identity.prAttribution`)),z(e,()=>A(`profilePage.identity.prAttributionDescription`),null),e})()]}})},get children(){return[U(Mt,{get title(){return A(`profilePage.identity.gitCoauthor`)},get description(){var n=ti(),r=n.firstChild;return z(r,(()=>{var n=B(()=>!!t());return()=>n()?A(`profilePage.identity.ownerGitCoauthorDescription`):B(()=>!!e.getView().gitCoauthorOrganization)()?A(`profilePage.identity.gitCoauthorOrganization`):B(()=>!!e.getView().ownProfile?.gitCoauthorIdentity)()?A(`profilePage.identity.gitCoauthorGithub`):B(()=>!!e.getView().gitCoauthorAvailable)()?A(`profilePage.identity.gitCoauthorShort`):A(`profilePage.identity.gitCoauthorConfigure`)})()),z(n,U(F,{get when(){return B(()=>!(t()||!e.getView().gitCoauthorAvailable))()?e.getView().gitCoauthorIdentity:!t()&&e.getView().gitCoauthorAvailable},children:e=>(()=>{var t=ni();return z(t,()=>`${e().name} <${e().email}>`),t})()}),null),n},get checked(){return B(()=>!(t()||!e.getView().gitCoauthorAvailable))()?e.gitCoauthorEnabled:!t()&&e.getView().gitCoauthorAvailable},get disabled(){return!e.canEdit||e.busy!==null&&e.busy!==`git-coauthor`||t()||!e.getView().gitCoauthorAvailable},get saving(){return e.busy===`git-coauthor`},onChange:t=>void e.onSave({kind:`git-coauthor`,enabled:t})}),U(Mt,{get title(){return A(`profilePage.identity.prAttribution`)},get description(){return[B(()=>A(`profilePage.identity.prAttributionShort`)),` `,(()=>{var e=ri(),t=I();return V(e,`target`,ue),z(e,()=>A(`profilePage.identity.prAttributionLink`)),W(()=>ne(),n=>{V(e,`rel`,n),st(e,t)}),e})()]},get checked(){return e.prAttributionEnabled},get disabled(){return!e.canEdit||e.busy!==null},onChange:t=>void e.onSave({kind:`pr-attribution`,enabled:t})}),U(F,{get when(){return e.getView().attributionError},get children(){var t=Qr(),n=t.firstChild;return z(n,()=>e.getView().attributionError),t}})]}})),W(()=>Ct.attribution,e=>{V(n,`id`,e)}),n}})}var Qr,$r,ei,ti,ni,ri;function ii(){return(ii=e((()=>{K(),R(),s(),gn(),Z(),Ce(),k(),St(),Qr=q(`<div class="settings-row identity-error"role=alert><span class=settings-row__desc>`),$r=q(`<div>`),ei=q(`<p><strong></strong> `),ti=q(`<span class=settings-row__text><span>`),ni=q(`<code class=identity-account>`),ri=q(`<a class=identity-attribution-link href=https://openclaw.ai>`)})))()}function ai(e){let t=Oe,n=()=>({id:e.row.id,name:r(),avatar:m(e.row,e.identity),textAvatar:Je(e.row,e.identity)}),r=()=>e.user?e.user.name?.trim()||e.user.email||A(`nav.owner`):e.identity?.name?.trim()||e.row.identity?.name?.trim()||e.row.name?.trim()||e.row.id,i=()=>e.user?e.user.email:`@${e.row.id}`;return U(Dt,{get children(){var a=si(),o=a.firstChild,s=o.nextSibling,c=s.nextSibling,l=c.firstChild;return z(o,U(F,{get when(){return e.user},get fallback(){return U(le,{get agent(){return n()}})},children:e=>(()=>{var t=ci();return t._$owner=I(),W(()=>({...e(),name:r(),watchedSessions:[]}),e=>{t.user=e}),t})()})),z(s,r),z(c,U(F,{get when(){return i()},get children(){var e=oi();return z(e,i),e}}),l),z(l,()=>t.read().brandName),a}})}var oi,si,ci;function li(){return(li=e((()=>{K(),R(),Ae(),Z(),Fe(),Re(),c(),k(),Le(),oi=q(`<span class=profile-hero__email>`),si=q(`<section class=profile-hero><div class=profile-hero__avatar></div><div class=profile-hero__name></div><div class=profile-hero__handle><span class=profile-hero__badge>`),ci=q(`<openclaw-viewer-avatar variant=profile>`,1)})))()}function ui(e){if(typeof e!=`object`||!e||Array.isArray(e)||!(`name`in e)||!(`email`in e)||typeof e.name!=`string`||typeof e.email!=`string`||/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}<>]/u.test(e.name)||/[\p{Cc}\p{Cf}]/u.test(e.email))return;let t=e.name.trim(),n=e.email.trim();if(!(!t||t.length>256||n.length>254||!/^[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9.-]+$/u.test(n)))return{name:t,email:n.toLowerCase()}}function di(e){let t=ui(e);if(!(!t||typeof e!=`object`||!e||!(`policy`in e)||typeof e.policy!=`string`||!e.policy||e.policy.length>2048))return{...t,policy:e.policy}}var fi;function pi(){return(pi=e((()=>{fi=`git.coauthor.organization`})))()}var mi;function hi(){return(hi=e((()=>{s(),pi(),oe(),l(),Se(),E(),k(),be(),Kt(),Ue(),t(),mi=class{constructor(e,t){this.context=e,this.invalidate=t,this.modelAccountsTarget={read:()=>({gateway:this.context.gateway.snapshot,identityId:this.selfUser?.id??null,profileId:this.ownProfile?.id??null}),subscribe:e=>(this.publishTarget=e,()=>{this.publishTarget=void 0}),subscribeRefresh:e=>(this.refreshAccounts=e,()=>{this.refreshAccounts=void 0})},this.selfUser=null,this.ownProfile=null,this.displayName=``,this.gitCoauthorEnabled=!0,this.prAttributionEnabled=!1,this.identityLoading=!1,this.identityRefreshPending=!1,this.identityBusy=null,this.identityError=null,this.attributionError=null,this.client=null,this.connected=!1,this.identityReady=!1,this.connecting=!1,this.canRead=!1,this.canWrite=!1,this.connectionScopes=null,this.identityRequestId=0,this.identityScope={},this.presentationLifetime=Promise.withResolvers(),this.identityReceipt={result:Promise.resolve()}}publish(){this.invalidate(),this.publishTarget?.()}retirePresentation(){this.presentationLifetime.resolve(),this.presentationLifetime=Promise.withResolvers()}dispose(){this.publishTarget=void 0,this.retirePresentation(),this.identityRequestId+=1,this.client=null,this.connected=!1,this.identityReady=!1}applyGatewaySnapshot(e){let t=e.client!==this.client,n=e.phase===`connected`,r=n&&e.selfUser!==void 0,i=g(e.hello?.auth??null),a=n&&i,o=n!==this.connected||r!==this.identityReady||n&&this.hello!==e.hello,s=r?ae({snapshotUser:e.selfUser}):t?null:this.selfUser,c=s?.id!==this.selfUser?.id||s?.identity?.id!==this.selfUser?.identity?.id,l=n&&this.canRead&&!i,u=t||c||l;this.client=e.client,this.connected=n,this.identityReady=r,this.hello=e.hello,this.connecting=e.phase===`connecting`||e.phase===`reconnecting`,this.canRead=n?i:!t&&this.canRead,this.canWrite=a&&r,this.connectionScopes=n||t?e.hello?.auth?.scopes??null:this.connectionScopes,this.selfUser=s,(u||o)&&(this.retirePresentation(),this.identityRequestId+=1,this.identityScope={},this.identityReceipt={result:Promise.resolve()},this.identityLoading=!1,this.identityBusy=null,this.identityError=null,this.attributionError=null),u&&(this.ownProfile=null,this.displayName=``,this.gitCoauthorEnabled=!0,this.gitCoauthorOrganization=void 0,this.prAttributionEnabled=!1),this.publish(),r&&e.client&&((u||o)&&this.loadIdentity(),this.context.agents.ensureList().then(e=>{e&&this.context.agentIdentity.ensure([e.defaultId])}))}refreshPublishedIdentity(){this.client&&Ve(this.client),this.identityBusy?this.identityRefreshPending=!0:(this.identityRequestId+=1,this.identityLoading=!1,this.loadIdentity())}loadIdentity(){let e=this.client;if(!e||!this.identityReady||!this.canRead||this.identityLoading)return;this.identityRefreshPending=!1;let t=++this.identityRequestId,n=this.ownProfile,r=this.displayName,i=n!==null&&r.trim()!==(n.displayName??``);this.identityLoading=!0,this.identityError=null,this.attributionError=null;let a=this.readIdentity(e,t,i,r);this.identityReceipt={result:a},this.publish()}async readIdentity(e,t,n,i){let a=!1;try{let o=await this.context.gateway.loadSelfProfile();if(t!==this.identityRequestId||(this.ownProfile=o,!o))return;a=!0,this.displayName=n?i:o.displayName??``,this.gitCoauthorEnabled=!0,this.prAttributionEnabled=!1,this.publish();let{loadUserPreferences:s}=await p(async()=>{let{loadUserPreferences:e}=await import(`./user-prefs-request-DMVPtOdQ.js`).then(e=>(e.t(),e.r));return{loadUserPreferences:e}},__vite__mapDeps([5,6]),import.meta.url);if(t!==this.identityRequestId)return;let c=await s(e,o.id,{keys:o.id===`gateway-owner`?[r]:[f,r,fi]});if(t!==this.identityRequestId)return;let l=c.status===`ok`?c.entries:{};this.gitCoauthorOrganization=di(l[fi]);let d=l[f];this.gitCoauthorEnabled=o.id!==`gateway-owner`&&c.status===`ok`&&this.gitCoauthorAvailable&&(this.gitCoauthorOrganization?d===!0:u(d)),this.prAttributionEnabled=c.status===`ok`&&c.entries[`github.prAttribution.enabled`]===!0}catch(e){if(t===this.identityRequestId){let t=D(e,A(`profilePage.identity.profileUnavailable`));a?this.attributionError=t:this.identityError=t}}finally{t===this.identityRequestId&&(this.identityLoading=!1,this.publish())}}get gitCoauthorIdentity(){return this.gitCoauthorOrganization??this.ownProfile?.gitCoauthorIdentity}get gitCoauthorAvailable(){return!!(this.gitCoauthorOrganization||this.ownProfile?.gitCoauthorAvailable!==!1)}retainCreditAvailability(e){return this.ownProfile?.id===e.id?{...e,gitCoauthorAvailable:e.gitCoauthorAvailable??this.ownProfile.gitCoauthorAvailable,gitCoauthorIdentity:e.gitCoauthorIdentity??this.ownProfile.gitCoauthorIdentity}:e}async saveIdentity(e){let t=this.client,n=this.ownProfile;if(!t||!n||!this.canWrite||this.identityBusy||this.identityLoading||e.kind===`git-coauthor`&&!this.gitCoauthorAvailable||e.kind===`git-coauthor`&&n.id===`gateway-owner`)return;this.identityBusy=e.kind,this.identityError=null,this.attributionError=null,this.publish();let i=this.identityRequestId,a=()=>t===this.client&&i===this.identityRequestId;try{switch(e.kind){case`display-name`:{let e=await t.request(`users.setDisplayName`,{profileId:n.id,displayName:this.displayName.trim()||null});if(!a())return;this.ownProfile=this.retainCreditAvailability(e.profile),this.displayName=e.profile.displayName??``,this.context.gateway.updateSelfUser?.({name:ce(e.profile.id,e.profile.displayName,e.profile.githubIdentity?.login)});break}case`avatar`:{Be(this.context.config);let r=this.displayName,i=r.trim()!==(n.displayName??``),o=this.selfUser?.id===n.id?this.selfUser.avatarUrl:void 0,s=await qt(e.file);if(!a())return;Be(this.context.config);let c=await t.request(`users.setAvatar`,{profileId:n.id,mime:s.mime,avatarBase64:s.avatarBase64});if(!a())return;this.ownProfile=this.retainCreditAvailability(c.profile),this.displayName=i?r:c.profile.displayName??``;let l=Ye(this.context.gateway.connection.gatewayUrl,c.profile.id,c.avatarRevision,this.context.resourceBasePath),u=this.selfUser?.id===c.profile.id&&this.selfUser.avatarUrl!==o;l&&!u&&this.context.gateway.updateSelfUser?.({avatarUrl:l});break}case`git-coauthor`:case`pr-attribution`:{let n=e.kind===`git-coauthor`?f:r,i=await Me(t,{entries:{[n]:e.enabled},...e.kind===`git-coauthor`&&e.enabled?{expectedEntries:{[fi]:this.gitCoauthorOrganization??null}}:{}});if(!a())return;if(i.status===`conflict`&&e.kind===`git-coauthor`){this.identityBusy=null,this.loadIdentity(),this.attributionError=A(`profilePage.identity.gitCoauthorChanged`),this.publish();return}if(i.status!==`ok`)throw Error(A(`profilePage.identity.profileUnavailable`));e.kind===`git-coauthor`?this.gitCoauthorEnabled=e.enabled:this.prAttributionEnabled=e.enabled;return}}}catch(t){a()&&(e.kind===`git-coauthor`||e.kind===`pr-attribution`)?this.attributionError=D(t,A(`profilePage.identity.profileUnavailable`)):a()&&(this.identityError=e.kind===`avatar`&&t instanceof Jt?A(t.code===`too-large`?`profilePage.identity.avatarErrors.tooLarge`:t.code===`source-too-large`?`profilePage.identity.avatarErrors.sourceTooLarge`:`profilePage.identity.avatarErrors.invalid`):D(t,A(`profilePage.identity.profileUnavailable`)));return}finally{a()&&this.identityBusy===e.kind&&(this.identityBusy=null,this.publish(),this.identityRefreshPending&&this.loadIdentity())}if(a())return this.loadIdentity(),this.identityReceipt.result}refreshManually(){this.identityReady&&!this.identityBusy&&!this.identityLoading&&(this.client&&Ve(this.client),this.loadIdentity(),this.refreshAccounts?.())}}})))()}function gi(e){return e===null?`unknown`:e.length===0?`none`:[[`operator.admin`,`admin`],[`operator.write`,`write`],[`operator.sessions.write`,`sessionWrite`],[`operator.read`,`read`],[`operator.sessions.read`,`sessionRead`]].find(([t])=>e.includes(t))?.[1]??`limited`}function _i(){let e=O(),t=_e(e.scopeUpgrade,e=>e.state.phase===`hidden`?null:e.state);H(()=>e.scopeUpgrade.activate($t));let n=_e(e.agents,e=>e.state.agentsList),r=_e(e.agentIdentity,e=>e),[i,a]=N(0,{ownedWrite:!0}),s=new mi(e,()=>a(e=>e+1)),c=()=>(i(),s),l=P(()=>c().canWrite),u=P(()=>c().identityScope),f=P(()=>{let e=u(),[t,n]=tt(null),[r,i]=tt(()=>c().gitCoauthorEnabled),[a,o]=tt(()=>c().prAttributionEnabled);return{scope:e,saving:t,setSaving:n,gitCoauthorEnabled:r,setGitCoauthorEnabled:i,prAttributionEnabled:a,setPrAttributionEnabled:o}}),p=()=>f().saving()??c().identityBusy,m=ft(function*(e,t,n,r){let i=()=>e.scope===s.identityScope&&n===s.presentationLifetime.promise;try{i()&&(e.setSaving(r.kind),r.kind===`git-coauthor`?e.setGitCoauthorEnabled(r.enabled):r.kind===`pr-attribution`?e.setPrAttributionEnabled(r.enabled):Qe(x)),yield Promise.race([t,n]),i()&&(yield ot(r.kind===`git-coauthor`?e.gitCoauthorEnabled:r.kind===`pr-attribution`?e.prAttributionEnabled:x))}catch(e){if(i()){let t=D(e,A(`profilePage.identity.profileUnavailable`));r.kind===`git-coauthor`||r.kind===`pr-attribution`?s.attributionError=t:s.identityError=t,s.publish()}}});async function h(e){let t=f(),n=s.presentationLifetime.promise,r=s.saveIdentity(e);return s.identityBusy===e.kind?(await Promise.resolve(),m(t,r,n,e)):r}H(()=>{let t=e.router.subscribe(()=>{s.retirePresentation(),s.publish()}),n=e.gateway.subscribe(e=>s.applyGatewaySnapshot(e)),r=e.gateway.subscribeEvents(e=>{(e.event===`users.prefs.changed`||e.event===`sessions.changed`&&o(e.payload)?.reason===`profile-identity`)&&s.refreshPublishedIdentity()});return s.applyGatewaySnapshot(e.gateway.snapshot),()=>{t(),n(),r(),s.dispose()}});let g=()=>c().connected&&c().client!==null,_=()=>g()||c().connectionScopes!==null||c().selfUser!==null,v=()=>c().ownProfile===null&&(c().identityLoading||c().connected&&!c().identityReady),y=()=>{let e=n.read(),t=e?.defaultId??`main`;return e?.agents.find(e=>e.id===t)??{id:t}},te=()=>{let t=c().ownProfile;return t?c().selfUser?.id===t.id&&c().selfUser?.avatarUrl?c().selfUser.avatarUrl:Ye(e.gateway.connection.gatewayUrl,t.id,t.updatedAt,e.resourceBasePath):null},b=P(()=>c().identityReceipt),x=P(()=>b().result),C=t=>U(F,{get when(){return B(()=>!!c().selfUser)()?c().ownProfile:c().selfUser},get fallback(){var e=vi();return z(e,U(Y,{get title(){return A(`profilePage.identity.title`)},get children(){return B(()=>!!(t.pending||c().connected&&!c().identityReady))()?U(jt,{get label(){return A(`profilePage.identity.loading`)},rows:2}):U(J,{get message(){return c().identityError??A(c().selfUser?`profilePage.identity.profileUnavailable`:`profilePage.identity.unidentified`)}})}})),W(()=>Ct.identity,t=>{V(e,`id`,t)}),e},children:n=>{function r(){let r=()=>p()??(t.pending?`loading`:null),i=P(()=>{let t=e.config;return t?Ne(t):null}),a=()=>i()?.read().uploadsEnabled!==!1,o=()=>et(l),u=()=>n().id===d;var f=vi();return z(f,U(Y,{get title(){return A(`profilePage.identity.title`)},get actions(){return U(pn,{id:`settings-profile-identity-help`,get section(){return A(`profilePage.identity.title`)},get children(){return[(()=>{var e=bi(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`profilePage.identity.avatar`)),z(e,()=>A(`profilePage.identity.avatarDescription`),null),e})(),U(F,{get when(){return!u()},get children(){return[(()=>{var e=bi(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`profilePage.identity.linkedEmails`)),z(e,()=>A(`profilePage.identity.linkedEmailsDescription`),null),e})(),(()=>{var e=bi(),t=e.firstChild;return t.nextSibling,z(t,()=>A(`profilePage.discord.title`)),z(e,()=>A(`profilePage.discord.description`),null),e})()]}}),(()=>{var e=xi(),t=e.firstChild,r=t.nextSibling.nextSibling,i=r.nextSibling;return z(t,()=>A(`profilePage.identity.githubAccount`)),z(e,(()=>{var e=B(()=>!!u());return()=>e()?A(`profilePage.identity.ownerGithubDescription`):A(`profilePage.identity.githubAccountDescription`)})(),r),z(e,U(F,{get when(){return!n().githubIdentity},get children(){return[` `,B(()=>A(`profilePage.identity.githubUnavailableDescription`))]}}),i),e})()]}})},get children(){return[U(F,{get when(){return B(()=>!o())()&&c().identityReady},get children(){return U(X,{get title(){return A(`profilePage.identity.writeRequired`)}})}}),U(X,{get title(){return A(`profilePage.identity.avatar`)},get description(){return A(`profilePage.identity.avatarLimits`)},get control(){var t=wi(),i=t.firstChild;return i._$owner=I(),z(t,U(F,{get when(){return B(()=>!!o())()?a():o()},get children(){return[(()=>{var t=Si();return t._$$click=t=>{let n=t.currentTarget.nextElementSibling;o()&&He(e.config)&&n instanceof HTMLInputElement&&n.click()},z(t,(()=>{var e=B(()=>r()===`avatar`);return()=>e()?A(`profilePage.identity.processingAvatar`):A(`profilePage.identity.chooseAvatar`)})()),W(()=>r()!==null,e=>{V(t,`disabled`,e)}),t})(),(()=>{var t=Ci();return t.addEventListener(`change`,t=>{let n=t.currentTarget,r=n.files?.[0];n.value=``,r&&o()&&He(e.config)&&h({kind:`avatar`,file:r})}),W(()=>r()!==null,e=>{V(t,`disabled`,e)}),t})()]}}),null),W(()=>({id:n().id,name:ce(n().id,n().displayName,n().githubIdentity?.login),email:n().emails[0],avatarUrl:te()??void 0,watchedSessions:[]}),e=>{i.user=e}),t}}),U(X,{get title(){return A(`profilePage.identity.displayName`)},get description(){return A(`profilePage.identity.displayNameDescription`)},get control(){var e=Ti(),t=e.firstChild,i=t.nextSibling;return e.addEventListener(`submit`,e=>{e.preventDefault(),h({kind:`display-name`})}),t._$$input=e=>{s.displayName=e.currentTarget.value,s.publish()},z(i,(()=>{var e=B(()=>r()===`display-name`);return()=>e()?A(`common.saving`):A(`common.save`)})()),W(()=>({e:A(`profilePage.identity.displayName`),t:c().displayName,a:!o()||r()!==null&&r()!==`display-name`,o:r()===`display-name`,i:!o()||r()!==null||c().displayName.trim()===(n().displayName??``)}),({e,t:n,a:r,o:a,i:o},s)=>{e!==s?.e&&V(t,`aria-label`,e),t.value=n??``,r!==s?.a&&V(t,`disabled`,r),a!==s?.o&&V(t,`readonly`,a),o!==s?.i&&V(i,`disabled`,o)}),e}}),U(F,{get when(){return B(()=>!u())()&&n().emails.length>0},get children(){return U(X,{get title(){return A(`profilePage.identity.linkedEmails`)},get description(){return A(`profilePage.identity.linkedEmailsDescription`)},get control(){var e=Ei();return z(e,U($e,{get each(){return n().emails},children:e=>(()=>{var t=Di();return z(t,e),t})()})),e}})}}),U(F,{get when(){return!u()},get children(){return U(zn,{})}}),U(X,{get title(){return A(`profilePage.identity.githubAccount`)},get description(){var e=Oi(),t=e.firstChild,r=t.nextSibling;return z(e,U(Q,{get kind(){return n().githubIdentity?`ok`:`muted`},get label(){return A(n().githubIdentity?`profilePage.identity.githubVerified`:`profilePage.identity.githubUnavailable`)}}),t),z(e,U(F,{get when(){return n().githubIdentity},children:e=>(()=>{var t=ki();t.firstChild;var n=I();return V(t,`target`,ue),z(t,()=>e().login,null),W(()=>({e:e().profileUrl,t:ne(),a:`@${e().login}`}),({e,t:r,a:i},a)=>{e!==a?.e&&V(t,`href`,e),r!==a?.t&&V(t,`rel`,r),i!==a?.a&&V(t,`title`,i),st(t,n)}),t})()}),r),e}}),U(F,{get when(){return!u()},get children(){return U(Ar,{})}}),U(F,{get when(){return c().identityError},get children(){var e=yi(),t=e.firstChild;return z(t,()=>c().identityError),e}})]}})),W(()=>Ct.identity,e=>{V(f,`id`,e)}),f}return U(r,{})}});var w=ji(),T=w.firstChild,E=T.nextSibling;return w._$owner=I(),z(w,U(kt,{get title(){return ee(`profile`)},get subtitle(){return[B(()=>S(`profile`)),` `,U(Ot,{url:Fi})]},get actions(){return U(F,{get when(){return c().connected},get children(){return U(mt,{class:`profile-refresh`,get label(){return B(()=>!!c().identityLoading)()?A(`common.refreshing`):A(`common.refresh`)},get busy(){return c().identityLoading},get disabled(){return!c().identityReady||p()!==null},onClick:()=>s.refreshManually()})}})}}),T),z(w,U(Nt,{get children(){return U(Et,{get children(){return[U(F,{get when(){return _()},get fallback(){return U(Dt,{get children(){return B(()=>!!c().connecting)()?(()=>{var e=Mi();return z(e,U(J,{get message(){return A(`profilePage.access.connecting`)}})),e})():U(J,{get message(){return A(`profilePage.offline`)}})}})},get children(){return[U(F,{get when(){return c().selfUser||!v()},get children(){return U(ai,{get row(){return y()},get user(){return c().selfUser},get identity(){return r.read().get(y().id)}})}}),U(F,{get when(){return!v()},get fallback(){return U(C,{pending:!0})},get children(){return U(it,{fallback:(e,t)=>[U(xe,{tone:`danger`,role:`alert`,get children(){return[B(()=>D(e())),` `,(()=>{var e=Ni();return e._$$click=()=>{s.refreshManually(),t()},z(e,()=>A(`common.retry`)),e})()]}}),U(C,{pending:!1})],get children(){return U(dt,{get on(){return et(u)},get fallback(){return U(C,{pending:!0})},get children(){return[B(()=>(et(x),null)),U(C,{get pending(){return at(x)}})]}})}})}})]}}),U(zr,{get hidden(){return v()||!_()||c().context.gateway.snapshot.hello?.policy?.hasMultipleSessionSharingIdentities!==!0}}),U(F,{get when(){return B(()=>!!_())()?!v():_()},get children(){return[U(Tr,{get target(){return s.modelAccountsTarget},get personLabel(){return B(()=>!!c().ownProfile)()?ce(c().ownProfile.id,c().ownProfile.displayName,c().ownProfile.githubIdentity?.login)||A(`profilePage.modelAccounts.currentPerson`):null}}),U(bn,{}),U(Zr,{getView:c,get canEdit(){return et(l)},get busy(){return p()??(c().identityLoading?`loading`:null)},get gitCoauthorEnabled(){return f().gitCoauthorEnabled()},get prAttributionEnabled(){return f().prAttributionEnabled()},onSave:h})]}}),U(F,{get when(){return _()},get children(){var n=Ai();return z(n,U(Y,{get title(){return A(`profilePage.access.title`)},get children(){return[U(X,{get title(){return A(`profilePage.access.${gi(c().connectionScopes)}`)},get description(){return A(`profilePage.access.limits`)}}),U(X,{get title(){return A(`profilePage.access.help`)},get description(){return A(`profilePage.access.nextStep`)},stackedOnNarrow:!0,get control(){var t=Pi();return t._$$click=()=>e.gateway.connect(),z(t,()=>A(`profilePage.access.reconnect`)),W(()=>p()!==null,e=>{V(t,`disabled`,e)}),t}}),U(F,{get when(){return t.read()},children:t=>U(X,{get title(){return A(`profilePage.access.adminRequest`)},get description(){return B(()=>t().phase===`available`)()?A(`profilePage.access.adminRequestHint`):Yt(t())},stackedOnNarrow:!0,get control(){return U(Qt,{get state(){return t()},onRequest:()=>e.scopeUpgrade.request(),onRetry:()=>e.scopeUpgrade.retry(),onCancel:()=>e.scopeUpgrade.cancel()})}})}),U(Ft,{quiet:!0,get title(){return A(`profilePage.access.details`)},get children(){return U(X,{get title(){return A(`profilePage.access.scopes`)},get description(){return A(`profilePage.access.description`)},stacked:!0,get control(){return U(wt,{get mono(){return B(()=>c().connectionScopes!==null)()&&c().connectionScopes.length>0},get value(){return B(()=>c().connectionScopes===null)()?A(`profilePage.access.unknown`):B(()=>c().connectionScopes.length===0)()?A(`profilePage.access.none`):c().connectionScopes.join(`, `)}})}})}})]}})),n}}),U(F,{get when(){return B(()=>!!_())()?!v():_()},get children(){return U(Dt,{get children(){return U(Tt,{get title(){return A(`profilePage.usageStatistics`)},get description(){return A(`profilePage.usageStatisticsDescription`)},onClick:()=>e.navigate(`usage`)})}})}})]}})}}),E),w}var vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi;function Ii(){return(Ii=e((()=>{K(),R(),s(),oe(),a(),Zt(),Xt(),Te(),pt(),It(),gn(),Z(),Pt(),In(),fn(),Gt(),gt(),Re(),Ce(),E(),De(),j(),k(),ge(),be(),St(),Yn(),Dr(),Fr(),Xr(),ii(),Ue(),li(),hi(),vi=q(`<div>`),yi=q(`<div class="settings-row identity-error"role=alert><span class=settings-row__desc>`),bi=q(`<p><strong></strong> `),xi=q(`<p><strong></strong> <!><!>`),Si=q(`<button type=button class="btn btn--sm">`),Ci=q(`<input type=file accept=image/png,image/jpeg,image/webp hidden>`),wi=q(`<span class=identity-avatar-control><openclaw-viewer-avatar variant=profile>`,1),Ti=q(`<form class=identity-name-control><input class=settings-input type=text maxlength=256><button type=submit class="btn btn--sm">`),Ei=q(`<span class=identity-emails>`),Di=q(`<span class=identity-account>`),Oi=q(`<span class=settings-row__meta><!><!>`),ki=q(`<a class="identity-account identity-github-login">@`),Ai=q(`<div id=settings-profile-access>`),ji=q(`<openclaw-profile-page><!><!>`,1),Mi=q(`<div role=status>`),Ni=q(`<button class="btn btn--sm">`),Pi=q(`<button type=button class=btn>`),ht(),M(dn),M(Wt),Fi=`https://docs.openclaw.ai/concepts/user-model`,G([`click`,`input`])})))()}Ii();export{_i as ProfilePage};