UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 5.97 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./owner-devices-dialog-DlHzLOTK.js","./en-openclaw-id-dialogs-BFGCHK4v.js","./error-message-B7DmySYB.js","./src-UIxrOiBg.js","./owner-approval-lifetime-B8hNV4Yn.js","./account-BSv2LwQC.js","./device-key-DH9ZSZCT.js","./owner-approval-dialog-CdJ_2bpR.js","./claw-name-Dq5hFb9H.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,Ka as n,Qu as r,Wl as i}from"./_4____________________________.js";import{FN as a,GN as o,JN as s,PN as c,fk as l,mb as u,mk as d,pb as f,qN as p}from"./_2_____________________________.js";import{B as m,O as h,Rt as g,U as _,d as v,g as y,gt as b,j as x,l as S,s as C,u as w,x as T}from"./_6____________________.js";import{n as E,t as D}from"./en-openclaw-id-Don6YXzi.js";import{n as O,r as k,t as A}from"./feature-lifetime-BHVdXhSD.js";import{n as j,t as M}from"./ui-error-Bk6jJOft.js";function N(e){p(E);let t=!1,n=()=>{},i=e=>d({severity:`error`,message:j(e,`open`)}),a=n=>{let a=e.snapshot;if(t||a.phase!==`connected`||a.client?.gatewayUrl!==n.gatewayUrl)return;let o=a.client;r(async()=>{let{showOwnerDevicesDialog:e}=await import(`./owner-devices-dialog-CWAtkD2N.js`);return{showOwnerDevicesDialog:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url).then(({showOwnerDevicesDialog:e})=>t?void 0:e({client:o})).catch(i)},o=n=>{let o=e.snapshot;if(t||o.phase!==`connected`||o.client?.gatewayUrl!==n.gatewayUrl)return;let s=o.client;r(async()=>{let{showOwnerApprovalDialog:e}=await import(`./owner-approval-dialog-CdJ_2bpR.js`).then(e=>(e.t(),e.n));return{showOwnerApprovalDialog:e}},__vite__mapDeps([0,1,2,8,4,5,3,6,9,10,11]),import.meta.url).then(({showOwnerApprovalDialog:e})=>{t||e({client:s,onDevices:()=>a(s)})}).catch(i)};return r(async()=>{let{bindOwnerApproval:e}=await import(`./owner-approval-lifetime-B8hNV4Yn.js`).then(e=>(e.t(),e.r));return{bindOwnerApproval:e}},__vite__mapDeps([5,3,6,9,10]),import.meta.url).then(({bindOwnerApproval:r})=>{t||(n=r(e,e=>d({severity:`info`,message:s(`openclawId.approvalNotice`),actionLabel:s(`openclawId.approveNewDevice`),durationMs:3e4,onAction:()=>o(e)}),(e,t)=>d({severity:`warning`,message:t?s(`openclawId.kitUsedNotice`,{device:t}):s(`openclawId.kitUsedNoticeUnknown`),description:s(`openclawId.kitUsedNoticeBody`),actionLabel:s(`openclawId.yourDevices`),durationMs:3e4,onAction:()=>a(e)}),()=>d({severity:`info`,message:s(`openclawId.memberDeviceAddedNotice`),description:s(`openclawId.memberDeviceAddedNoticeBody`),durationMs:3e4})))}).catch(e=>{t||i(e)}),()=>{t=!0,n()}}function P(){return(P=e((()=>{D(),o(),l(),M(),t()})))()}function F(e){return e.filter(e=>e.type===`attention`&&e.kind===`openClawIdRequest`)}function I(e){let{phase:t,selfUser:n}=e.snapshot,r=e.connection.gatewayUrl;return t===`connected`&&r&&n!==void 0?`openclaw.control.openclawIdJoinPrompts.v1:${JSON.stringify([i(r),n?.id??null])}`:null}function L(e){try{let t=e?JSON.parse(n()?.getItem(e)??`[]`):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function R(e,t){try{e&&t.length?n()?.setItem(e,JSON.stringify(t)):e&&n()?.removeItem(e)}catch{}}function z(e){let[t,n]=m(e),r;return{update:e=>n(e),close:()=>r?.(`closed`),outcome:u({signal:O(),value:`closed`},e=>{r=e.finish;let n=()=>t()[0];e.render(()=>(()=>{var r=H(),i=r.firstChild.firstChild.firstChild,a=i.firstChild,o=a.firstChild.firstChild,c=o.nextSibling,l=a.nextSibling,u=i.nextSibling,d=u.firstChild,f=d.nextSibling;return r.addEventListener(`modal-cancel`,()=>e.finish(`later`)),r._$owner=g(),v(o,()=>n().label),v(c,()=>n().meta?.status),v(a,x(h,{get when(){return t().length>1},get children(){var e=V();return v(e,()=>s(`openclawId.joinRequestMore`,{count:String(t().length-1)})),e}}),null),v(l,()=>n().detail),u._$owner=g(),d._$$click=()=>e.finish(`later`),v(d,()=>s(`openclawId.joinRequestLater`)),f._$$click=()=>e.finish(`review`),v(f,()=>s(`openclawId.joinRequestReview`)),S(()=>({e:n().label,t:n().meta?.status??``,a:n().label}),({e,t,a:n},i)=>{e!==i?.e&&y(r,`label`,e),t!==i?.t&&y(r,`description`,t),n!==i?.a&&y(o,`title`,n)}),r})())})}}function B(e){let t=new Set,n=!1,r=null,i=()=>{let a=I(e.gateway);if(r&&r.key!==a){r.view.close();return}let o=a?F(e.sidebarAttention.entries):[],s=o.map(e=>e.signature),c=L(a),l=c.filter(e=>s.includes(e));s.length>0&&l.length!==c.length&&R(a,l);let u=o.filter(e=>!l.includes(e.signature)&&!t.has(`${a}\n${e.signature}`));if(r){u.length===0?r.view.close():(r.requests=u,r.view.update(u));return}if(!a||u.length===0)return;let d={key:a,requests:u,view:z(u)};r=d,d.view.outcome.then(a=>{if(r===d&&(r=null),n)return;if(a===`closed`){i();return}let o=d.requests.map(e=>e.signature);o.forEach(e=>t.add(`${d.key}\n${e}`)),R(d.key,[...new Set([...L(d.key),...o])]);let s=d.requests[0]?.action;a===`review`&&s?.kind===`navigate`&&e.navigate(s.routeId,s.search?{search:s.search}:void 0)})},a=[e.sidebarAttention.subscribe(i),e.gateway.subscribe(i)];return i(),()=>{n=!0,a.forEach(e=>e()),r?.view.close()}}var V,H;function U(){return(U=e((()=>{w(),_(),D(),A(),o(),f(),V=T(`<div class=exec-approval-queue>`),H=T(`<openclaw-modal-dialog><div class=exec-approval-modal-stack><div class="exec-approval-card exec-approval-card--modal exec-approval-card--severity-warning"><div class=exec-approval-modal-content><div class=exec-approval-header><div class=exec-approval-heading><div class=exec-approval-title></div><div class=exec-approval-sub></div></div></div><p class=exec-approval-sub></p></div><openclaw-modal-actions class=exec-approval-actions><button type=button class=btn></button><button type=button class="btn primary">`,1),p(E),C([`click`])})))()}function W(){let e=a();return b(()=>{let t=k(),n=N(e.gateway),r=B(e);return()=>{r(),n(),t()}}),null}function G(){return(G=e((()=>{_(),A(),P(),c(),U()})))()}G();export{W as OpenClawIdNotifications};