UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.02 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Qt as n,Xt as r,Yt as i}from"./control-ui-connection-Bfj9beF_.js";import{A_ as a,N_ as o,Ry as s,dj as c,mj as l,zy as u}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as d,F as f,I as p,O as m,Rt as h,S as g,U as _,d as v,g as y,gt as b,j as x,l as S,m as C,s as w,u as T,x as E,yt as D}from"./solid-runtime-C416s-HC.js";var O=t({showInputDialog:()=>k});function k(e){return N?Promise.resolve(null):(N=!0,u({signal:e.signal,value:null},t=>t.render(()=>A(e,t.finish,()=>t.settled))).finally(()=>{N=!1}))}function A(e,t,n){let a=e.gateway?o(e.gateway):void 0,s,c=!1,[u,_]=p(!1),[w,T]=d(),E=f(()=>w()??null,{loadingValue:null}),O=f(()=>w()?.then(e=>!!e,()=>!0)??!1,{loadingValue:!1}),[k,A]=d(e.defaultValue??``),N=t=>e.requireValue?t.trim():t,P=t=>{let n=N(t),r=a?.read().snapshot.phase===`connected`,i=e.canSubmit?.();return i===!1||a!==void 0&&!r&&i!==!0||e.requireValue===!0&&!n.length||e.requireChange===!0&&n===(e.defaultValue??``)},F=D(function*(e,r){_(!0);try{(yield r)===null&&!n()&&t(e)}finally{c=!1,b(()=>{n()||s.focus()})}});async function I(a){if(a.preventDefault(),n()||c||P(s.value))return;let o=N(s.value),l=e.submit;if(!l){t(o);return}c=!0;let u;try{u=l(o)}catch(e){u=Promise.reject(e instanceof Error?e:new i(r(e)))}T(u),u.catch(()=>void 0),await Promise.resolve(),n()||await F(o,u)}var L=M(),R=L.firstChild,z=R.firstChild,B=z.firstChild,V=z.nextSibling,H=V.firstChild,U=H.nextSibling,W=V.nextSibling,G=W.firstChild,K=G.nextSibling;return L.addEventListener(`modal-cancel`,e=>{c?e.preventDefault():t(null)}),L.initialFocus=()=>s,L._$owner=h(),R.addEventListener(`submit`,e=>{I(e).catch(()=>void 0)}),v(B,()=>e.title),v(H,()=>e.label??e.title),U._$$input=e=>A(e.currentTarget.value),C(()=>e=>{s=e},U),v(R,x(m,{get when(){return!u()},get children(){return x(g,{fallback:e=>(()=>{var t=j();return v(t,()=>r(e())),t})(),get children(){return x(m,{get when(){return E()},get children(){var e=j();return v(e,E),e}})}})}}),W),W._$owner=h(),G._$$click=()=>t(null),v(G,()=>e.cancelLabel??l(`common.cancel`)),v(K,()=>e.submitLabel??l(`common.save`)),S(()=>({e:e.title,t:e.label??e.title,a:k(),o:u(),i:!u()&&O()?`true`:void 0,n:u(),s:u()||P(k())}),({e,t,a:n,o:r,i,n:a,s:o},s)=>{e!==s?.e&&y(L,`label`,e),t!==s?.t&&y(L,`description`,t),U.value=n??``,r!==s?.o&&y(U,`disabled`,r),i!==s?.i&&y(U,`aria-invalid`,i),a!==s?.n&&y(G,`disabled`,a),o!==s?.s&&y(K,`disabled`,o)}),L}var j,M,N;function P(){return(P=e((()=>{T(),_(),n(),a(),c(),s(),j=E(`<div class=exec-approval-error role=alert>`),M=E(`<openclaw-modal-dialog><form class=exec-approval-card><div class=exec-approval-header><div class=exec-approval-title></div></div><label class="field input-dialog__field"><span></span><input name=value type=text autocomplete=off spellcheck=false autofocus></label><openclaw-modal-actions class=exec-approval-actions><button type=button class=btn></button><button type=submit class="btn primary">`,1),N=!1,w([`input`,`click`])})))()}export{O as n,k as r,P as t};