openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 982 B
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{K as t,U as n}from"./_4____________________________.js";import{IN as r,PN as i,ak as a,iT as o,ok as s,sT as c}from"./_2_____________________________.js";import{F as l,U as u}from"./_6____________________.js";function d(e,t,i){let o=r(),s=o?c(o.gateway):void 0,u=l(()=>{let t=s?.read()?.snapshot;if(!(t&&(!t.client||t.phase===`stopped`||t.lastErrorAuthReason||t.phase===`connected`&&t.hello&&!n(t.hello.auth??null))))return{key:e(),client:t?.client,scope:o?a(o.gateway).key:0}},{equals:(e,t)=>e?.key===t?.key&&e?.client===t?.client&&e?.scope===t?.scope}),d=l(e=>{let n=u();if(!n)return;let r=t();return e?.identity===n&&(i()||s&&s.read().snapshot.phase!==`connected`)?e:{identity:n,src:r}});return{identity:u,src:()=>d()?.src,active:()=>{let e=o?.gateway.snapshot;return!e||e.phase===`connected`&&!e.lastErrorAuthReason&&n(e.hello?.auth??null)}}}function f(){return(f=e((()=>{u(),s(),t(),o(),i()})))()}export{f as n,d as t};