openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 6.01 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{QA as t,ZA as n,dj as r,mj as i,pj as a}from"./control-ui-boot-shared-DFTSUQQ0.js";import{C as o,F as s,O as c,Rt as ee,U as l,a as te,d as u,f as d,g as f,j as p,l as m,u as h,x as g}from"./solid-runtime-C416s-HC.js";import{D as _,O as v,S as ne,c as re,f as y,g as b,j as ie,m as x,y as S}from"./config-runtime-ECF4aWQv.js";import{n as ae,t as oe}from"./en-board-document-CgVI8wPN.js";import{n as C,t as w}from"./board-widget-error-Ca87fMFk.js";import{n as T,r as se}from"./board-layout-2ytmMZqb.js";function ce(e){if(new TextEncoder().encode(JSON.stringify(e)).byteLength>8192)throw new T(`invalid_operation`,`Report exceeds 8KB JSON budget`);let t=j.safeParse(e);if(!t.success){let e=t.error.issues[0];throw new T(`invalid_operation`,`Invalid report at ${e?.path.join(`.`)||`root`}: ${e?.message}`)}return t.data}var E,D,O,k,A,j;function M(){return(M=e((()=>{b(),se(),E=v().min(1).max(120).optional(),D=v().min(1).max(160),O=v().max(240).optional(),k=v().max(500),A=_({type:S(`table`),title:E,columns:y(D).min(1).max(8),rows:y(y(k).max(8)).max(40)}).refine(e=>e.rows.every(t=>t.length===e.columns.length),{message:`Every table row must match the columns`}),j=_({blocks:y(x(`type`,[_({type:S(`text`),title:E,text:v().min(1).max(4e3)}),_({type:S(`metrics`),items:y(_({label:D,value:v().min(1).max(80),detail:O})).min(1).max(8)}),A,_({type:S(`chart`),title:E,style:re([`bar`,`line`]).optional(),points:y(_({label:D,value:ne().min(-(2**53-1)).max(2**53-1)})).min(1).max(40)}),_({type:S(`links`),title:E,items:y(_({label:D,url:ie({protocol:/^https?$/,normalize:!0}).max(2048),detail:O})).min(1).max(20)})])).min(1).max(24)})})))()}function le(e){let t=s(()=>{let t=e.block.points.map(e=>e.value),n=Math.min(0,...t),r=Math.max(0,...t)-n||1,i=e=>164-(e-n)/r*148,a=e.block.style===`line`,o=608/e.block.points.length;return{baseline:i(0),line:a,width:o,coordinates:t.map((e,n)=>({x:a?t.length===1?320:16+n/(t.length-1)*608:16+(n+.5)*o,y:i(e)}))}});var n=F(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return u(n,p(c,{get when(){return e.block.title},get children(){var t=N();return u(t,()=>e.block.title),t}}),r),u(r,p(c,{get when(){return t().line},get fallback(){return p(o,{get each(){return t().coordinates},children:e=>(()=>{var n=I();return m(()=>({e:e.x-t().width*.35,t:Math.min(e.y,t().baseline),a:t().width*.7,o:Math.max(1,Math.abs(e.y-t().baseline))}),({e,t,a:r,o:i},a)=>{e!==a?.e&&f(n,`x`,e),t!==a?.t&&f(n,`y`,t),r!==a?.a&&f(n,`width`,r),i!==a?.o&&f(n,`height`,i)}),n})()})},get children(){return[(()=>{var e=P();return m(()=>t().coordinates.map(e=>`${e.x},${e.y}`).join(` `),t=>{f(e,`points`,t)}),e})(),p(o,{get each(){return t().coordinates},children:e=>(()=>{var t=L();return m(()=>({e:e.x,t:e.y}),({e,t:n},r)=>{e!==r?.e&&f(t,`cx`,e),n!==r?.t&&f(t,`cy`,n)}),t})()})]}}),null),u(a,p(o,{get each(){return e.block.points},children:e=>(()=>{var t=R(),n=t.firstChild,r=n.nextSibling;return u(n,()=>e.label),u(r,()=>e.value),t})()})),m(()=>({e:t().baseline,t:t().baseline}),({e,t},n)=>{e!==n?.e&&f(i,`y1`,e),t!==n?.t&&f(i,`y2`,t)}),n}function ue(e){let t=s(()=>{let t=e.block;switch(t.type){case`text`:var n=B(),r=n.firstChild;return u(n,p(c,{get when(){return t.title},get children(){var e=z();return u(e,()=>t.title),e}}),r),u(r,()=>t.text),n;case`metrics`:var i=V();return u(i,p(o,{get each(){return t.items},children:e=>(()=>{var t=R(),n=t.firstChild,r=n.nextSibling;return u(n,()=>e.label),u(r,()=>e.value),u(t,p(c,{get when(){return e.detail},get children(){var t=H();return u(t,()=>e.detail),t}}),null),t})()})),i;case`table`:var a=W(),s=a.firstChild,l=s.firstChild,d=l.firstChild,h=l.nextSibling;return u(s,p(c,{get when(){return t.title},get children(){var e=U();return u(e,()=>t.title),e}}),l),u(d,p(o,{get each(){return t.columns},children:e=>(()=>{var t=G();return u(t,e),t})()})),u(h,p(o,{get each(){return t.rows},children:e=>(()=>{var t=K();return u(t,p(o,{each:e,children:e=>(()=>{var t=q();return u(t,e),t})()})),t})()})),a;case`chart`:return p(le,{block:t});case`links`:var g=J(),_=g.firstChild;return u(g,p(c,{get when(){return t.title},get children(){var e=z();return u(e,()=>t.title),e}}),_),u(_,p(o,{get each(){return t.items},children:e=>(()=>{var t=X(),n=t.firstChild,r=ee();return u(n,()=>e.label),u(t,p(c,{get when(){return e.detail},get children(){var t=Y();return u(t,()=>e.detail),t}}),null),m(()=>e.url,e=>{f(n,`href`,e),te(n,r)}),t})()})),g}return t});return d(t)}function de(e){let t=s(()=>{try{return{report:ce(e.widget?.props)}}catch(e){return{error:e}}},{equals:(e,t)=>e.report!==void 0&&t.report!==void 0&&JSON.stringify(e.report)===JSON.stringify(t.report)});return p(c,{get when(){return t().report},get fallback(){return p(w,{get error(){return t().error}})},children:t=>(()=>{var n=Z();return u(n,p(o,{get each(){return t().blocks},children:e=>p(ue,{block:e})})),m(()=>e.widget?.title??i(`board.widget.kindReport`),e=>{f(n,`aria-label`,e)}),n})()})}var N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q;function $(){return($=e((()=>{h(),l(),M(),C(),oe(),r(),t(),N=g(`<figcaption>`),P=g(`<svg><polyline class=board-report__line></svg>`,2),F=g(`<figure class=board-report__chart><svg viewBox="0 0 640 180"aria-hidden=true><line class=board-report__axis x1=16 x2=624></line></svg><dl class=board-report__values>`),I=g(`<svg><rect class=board-report__bar rx=2></svg>`,2),L=g(`<svg><circle class=board-report__point r=3></svg>`,2),R=g(`<div><dt></dt><dd>`),z=g(`<h3>`),B=g(`<section><p class=board-report__text>`),V=g(`<dl class=board-report__metrics>`),H=g(`<dd class=board-report__metric-detail>`),U=g(`<caption>`),W=g(`<div class=board-report__table><table><thead><tr></tr></thead><tbody>`),G=g(`<th scope=col>`),K=g(`<tr>`),q=g(`<td>`),J=g(`<section><ul class=board-report__links>`),Y=g(`<span>`),X=g(`<li><a target=_blank rel="noopener noreferrer">`),Z=g(`<article class=board-report>`),a(ae),Q=n(`openclaw-report-widget`,de,{properties:{widget:{default:void 0,attribute:!1}}})})))()}$();export{Q as ReportWidget};