openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 8.53 kB
JavaScript
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Dw as n,GN as r,JN as i,YN as a,ZN as o,_x as s,kw as c,mb as l,mx as u,pb as d,qN as f}from"./_2_____________________________.js";import{B as p,C as m,F as h,O as g,Rt as _,U as v,d as y,f as b,g as x,gt as S,j as C,l as w,m as T,s as ee,u as te,x as E}from"./_6____________________.js";import"./owner-devices-dialog-DlHzLOTK.js";import{n as ne,t as D}from"./en-openclaw-id-dialogs-BFGCHK4v.js";import{n as re,t as O}from"./en-openclaw-id-Don6YXzi.js";import{n as ie,t as ae}from"./feature-lifetime-BHVdXhSD.js";import{r as k,t as oe}from"./ui-error-Bk6jJOft.js";import{n as A,t as j}from"./error-message-B7DmySYB.js";import{t as M}from"./claw-name-Dq5hFb9H.js";import{n as N,t as se}from"./owner-approval-lifetime-B8hNV4Yn.js";function P(){let e=new Map,t=new Map,n,r,i=()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=e=>{clearTimeout(t.get(e)),t.delete(e),e.style.height=``,e.style.overflow=``,e.style.transition=``},o=()=>{let r=new Map;for(let[n,i]of e)n.isConnected?r.set(n,t.has(n)?n.getBoundingClientRect().height:i):(a(n),e.delete(n));for(let e of t.keys())a(e);for(let t of e.keys())e.set(t,t.getBoundingClientRect().height);if(!i()){for(let[t,n]of e){let e=r.get(t)??n;n!==void 0&&e!==void 0&&(Math.abs(n-e)<1||(t.style.height=`${e}px`,t.style.overflow=`hidden`))}n.getBoundingClientRect();for(let[n,r]of e)n.style.height&&(n.style.transition=`height .28s cubic-bezier(.2,.8,.2,1)`,n.style.height=`${r}px`,t.set(n,setTimeout(()=>a(n),300)))}};return S(()=>{for(let t of e.keys())e.set(t,t.getBoundingClientRect().height);let i=new MutationObserver(o);i.observe(n,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`]});let s=c([n],()=>{if(t.size===0)for(let t of e.keys())e.set(t,t.getBoundingClientRect().height)});return()=>{i.disconnect(),s(),r?.();for(let e of t.keys())a(e)}}),{card:t=>{n=t,e.set(t,t.getBoundingClientRect().height)},section:t=>{e.set(t,void 0)},async collapse(t){if(!(i()||t.length===0)){for(let n of t){let t=n.getBoundingClientRect().height;a(n),e.delete(n),n.style.height=`${t}px`}n.getBoundingClientRect();for(let e of t)e.classList.add(`openclaw-id-devices__row--gone`),e.style.height=`0px`;await new Promise(e=>{let t=setTimeout(()=>{r=void 0,e()},280);r=()=>{clearTimeout(t),e()}}),e.set(n,n.getBoundingClientRect().height)}}}}function F(){return(F=e((()=>{v(),n()})))()}var ce=t({showOwnerApprovalDialog:()=>L});function I(e){let[t,n]=p(``),r=()=>t().trim()?Number(t()):null,a=()=>r()===null||Number.isSafeInteger(r())&&r()>0&&r()<=3650,o=()=>e.request.expired||e.request.uncertain,s=h(()=>e.request.error?k(e.request.error,`approval`):null);var c=U(),l=c.firstChild,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,m=f.nextSibling,v=m.nextSibling,S=v.nextSibling,T=S.nextSibling;return y(l,()=>e.request.label),y(c,C(g,{get when(){return b(()=>!e.request.error)()&&!e.request.expired},get children(){var e=R();return y(e,()=>i(`openclawId.approvalCompare`)),e}}),u),y(c,C(g,{get when(){return b(()=>!(e.request.error||e.request.expired))()?e.request.tools:!e.request.error&&!e.request.expired},children:t=>(()=>{var n=R();return y(n,()=>i(`openclawId.approvalRunsTools`,{device:e.request.label,claw:e.claw,surface:[...new Set([...t().caps,...t().commands])].join(`, `)||i(`openclawId.approvalNoTools`)})),n})()}),d),y(c,C(g,{get when(){return s()},children:e=>(()=>{var t=W();return y(t,()=>e().message),t})()}),f),y(c,C(g,{get when(){return e.request.code||!o()},get children(){var t=z();return y(t,C(g,{get when(){return e.request.code},get fallback(){var e=G();return e.firstChild,y(e,()=>i(`openclawId.approvalWaiting`),null),e},children:e=>(()=>{var t=K();return y(t,()=>e().replace(/^(\d{3})(\d{3})$/,`$1 $2`)),t})()})),w(()=>!!o(),e=>{t.classList.toggle(`openclaw-id-approval__number--inactive`,e)}),t}}),m),y(c,C(g,{get when(){return s()?.detail},children:e=>(()=>{var t=q(),n=t.firstChild,r=n.nextSibling;return y(n,()=>i(`openclawId.technicalDetails`)),y(r,e),t})()}),v),y(c,C(g,{get when(){return!o()},get children(){return[(()=>{var r=B(),a=r.firstChild,o=a.firstChild,s=a.nextSibling;return y(a,()=>i(`openclawId.regenExpiry`),o),y(o,()=>i(`openclawId.regenExpiryHint`)),s._$$input=e=>n(e.currentTarget.value),w(()=>({e:t(),t:e.request.busy}),({e,t},n)=>{s.value=e??``,t!==n?.t&&x(s,`disabled`,t)}),r})(),(()=>{var t=V(),n=t.firstChild,o=n.nextSibling;return t._$owner=_(),n._$$click=()=>void e.owner.decide(e.request.id,!1),y(n,()=>i(`openclawId.approvalDeny`)),o._$$click=()=>{let t=r();e.owner.decide(e.request.id,!0,t===null?null:Math.floor(Date.now()/1e3)+t*86400)},y(o,()=>i(`openclawId.approvalApprove`)),w(()=>({e:e.request.busy,t:e.request.busy||!e.request.code||!a()}),({e,t},r)=>{e!==r?.e&&x(n,`disabled`,e),t!==r?.t&&x(o,`disabled`,t)}),t})()]}}),S),y(c,C(g,{get when(){return e.request.uncertain},get children(){var t=H(),n=t.firstChild;return t._$owner=_(),n._$$click=()=>e.onDevices(),y(n,()=>i(`openclawId.yourDevices`)),t}}),T),c}function L(e){let t=N(e.client),n={signal:ie(),value:void 0};return l(n,n=>{n.render(()=>{let r=P(),a=t?o(t,e=>e.read()):null;var s=X(),c=s.firstChild,l=c.firstChild,d=l.nextSibling,f=d.nextSibling,p=f.nextSibling,h=p.nextSibling,v=h.nextSibling;s.addEventListener(`modal-cancel`,()=>n.finish(void 0)),s._$owner=_();var S=r.card;return typeof S==`function`||Array.isArray(S)?T(()=>S,c):r.card=c,y(l,C(g,{get when(){return a?.read().hostname},get fallback(){return i(`openclawId.approveNewDevice`)},children:e=>i(`openclawId.approveNewDeviceFor`,{claw:M(e())})})),y(c,C(u,{class:`openclaw-id-devices__close`,icon:`x`,get label(){return i(`common.close`)},tooltip:!1,onClick:()=>n.finish(void 0)}),d),y(c,C(g,{when:!t,get children(){var e=J();return y(e,()=>i(`openclawId.approvalRequiresKey`)),e}}),f),y(c,C(g,{get when(){return a?.read().error},children:e=>(()=>{var n=Q(),r=n.firstChild,o=r.nextSibling;return y(n,C(j,{get error(){return k(e(),`approval`)}}),r),y(n,C(g,{get when(){return!a?.read().requests.some(e=>e.uncertain)},get children(){var e=Z(),n=e.firstChild;return e._$owner=_(),n._$$click=()=>t?.retry(),y(n,()=>i(`common.retry`)),e}}),o),n})()}),p),y(c,C(g,{get when(){return b(()=>!(!t||a?.read().error))()?a?.read().requests.length===0:t&&!a?.read().error},get children(){var e=Y();return y(e,()=>i(`openclawId.approvalEmpty`)),e}}),h),y(c,C(m,{get each(){return a?.read().requests??[]},keyed:e=>e.id,children:r=>C(I,{get request(){return r()},get claw(){return M(a?.read().hostname??``)||i(`openclawId.yourClaw`)},owner:t,onDevices:()=>{n.finish(void 0),e.onDevices()}})}),v),w(()=>i(`openclawId.approveNewDevice`),e=>{x(s,`label`,e)}),s})})}var R,z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q;function $(){return($=e((()=>{te(),v(),D(),O(),ae(),se(),oe(),r(),a(),d(),s(),A(),F(),R=E(`<p class="openclaw-id-devices__description openclaw-id-owner-enter">`),z=E(`<div class=openclaw-id-approval__number aria-live=polite>`),B=E(`<label class="openclaw-id-approval__expiry openclaw-id-owner-enter"><span><small></small></span><input type=number min=1 max=3650 inputmode=numeric>`),V=E(`<openclaw-modal-actions class="exec-approval-actions openclaw-id-owner-enter"><button type=button class=btn></button><button type=button class="btn primary">`,1),H=E(`<openclaw-modal-actions class="exec-approval-actions openclaw-id-owner-enter"><button type=button class="btn primary">`,1),U=E(`<section class=openclaw-id-approval__request><strong class="openclaw-id-approval__browser openclaw-id-owner-enter"></strong><!><!><!><!><!><!><!>`),W=E(`<div class="openclaw-id-devices__error openclaw-id-owner-enter"role=alert>`),G=E(`<span class="openclaw-id-approval__waiting openclaw-id-owner-enter"><span class=btn__spinner aria-hidden=true>`),K=E(`<span class=openclaw-id-owner-enter>`),q=E(`<details class="openclaw-id-approval__details openclaw-id-owner-enter"><summary></summary><div>`),J=E(`<p class="callout info openclaw-id-owner-enter">`),Y=E(`<p class="openclaw-id-devices__description openclaw-id-approval__empty openclaw-id-owner-enter">`),X=E(`<openclaw-modal-dialog class="openclaw-id-owner-dialog openclaw-id-owner-dialog--approval"><div class="exec-approval-card openclaw-id-devices"><h2 class=openclaw-id-devices__title></h2><!><!><!><!><!>`,1),Z=E(`<openclaw-modal-actions class=exec-approval-actions><button type=button class="btn primary">`,1),Q=E(`<div class="openclaw-id-devices__error openclaw-id-owner-enter"role=alert><!><!>`),f(ne),f(re),ee([`input`,`click`])})))()}export{F as a,P as i,ce as n,L as r,$ as t};