openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 3.96 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Am as t,GN as n,MN as r,Mm as i,WN as a,jN as o}from"./_2_____________________________.js";import{B as s,C as c,F as l,O as u,U as d,d as f,g as p,j as m,l as h,o as g,p as _,s as v,u as y,v as b,x}from"./_6____________________.js";function S(e){let n=`sparkline-tile-gradient-${++N}`,[r,i]=s(null),o=l(()=>{let t=e.floorMax,n=1/0;for(let r of e.samples)r.value>t&&(t=r.value),r.value<n&&(n=r.value);if(Number.isFinite(n)||(n=0),!e.autorange)return{min:0,span:t>0?t:1};let r=Math.max(t-n,t*.02,1e-9),i=Math.max(n-r*.5,0);return{min:i,span:Math.max(t-i,1e-9)}}),d=e=>{let t=o(),n=Math.min(Math.max((e-t.min)/t.span,0),1);return M-n*36},v=()=>j/(e.samples.length-1),y=l(()=>e.samples.map((e,t)=>`${t*v()},${d(e.value)}`).join(` `)),x=l(()=>e.stackColors.flatMap((t,n)=>{let r=[],i=[],a=[],o=()=>{i.length>1&&r.push({points:[...i,...a.toReversed()].join(` `),color:t}),i=[],a=[]};for(let[t,r]of e.samples.entries()){if(r.stack?.length!==e.stackColors.length){o();continue}let s=r.stack.slice(0,n).reduce((e,t)=>e+t,0);a.push(`${t*v()},${d(s)}`),i.push(`${t*v()},${d(s+r.stack[n])}`)}return o(),r})),S=()=>e.samples.at(-1),P=()=>r()===null?void 0:e.samples[r()],F=()=>P()??S(),I=l(()=>(a(),F()?e.format(F().value):`–`)),L=()=>r()===null?0:r()/(e.samples.length-1)*100,R=l(()=>{a();let e=P(),n=S();return e&&n&&n.at>e.at?t(n.at-e.at):null});return[(()=>{var t=w(),n=t.firstChild;return n.nextSibling,f(n,()=>e.label),f(t,m(u,{get when(){return e.sub},get children(){var t=C();return f(t,()=>e.sub),t}}),null),t})(),(()=>{var e=E(),t=e.firstChild,n=t.nextSibling;return f(e,I,t),f(e,m(u,{get when(){return R()},get children(){var e=T();return e.firstChild,f(e,R,null),e}}),n),e})(),m(u,{get when(){return F()?.secondary},get children(){var e=D();return f(e,()=>F()?.secondary),e}}),m(u,{get when(){return e.samples.length>=2},get children(){var t=k(),r=t.firstChild,a=r.firstChild,o=a.firstChild,s=a.nextSibling,l=s.nextSibling,v=r.nextSibling;return t.addEventListener(`pointerleave`,()=>i(null)),t._$$pointermove=t=>{let n=t.offsetX/Math.max(t.currentTarget.clientWidth,1);i(Math.min(Math.max(Math.round(n*(e.samples.length-1)),0),e.samples.length-1))},p(o,`id`,n),p(s,`fill`,`url(#${n})`),f(r,m(c,{get each(){return x()},children:e=>(()=>{var t=A();return h(()=>({e:e.points,t:e.color}),({e,t:n},r)=>{e!==r?.e&&p(t,`points`,e),n!==r?.t&&p(t,`fill`,n)}),t})()}),l),f(t,m(u,{get when(){return P()},get children(){var e=O();return h(()=>`${L()}%`,t=>{b(e,`left`,t)}),e}}),v),h(()=>({e:`0,${M} ${y()} ${j},${M}`,t:y(),a:_([`sparkline-tile__dot`,P()?`sparkline-tile__dot--hover`:`sparkline-tile__dot--now`]),o:P()?`${L()}%`:`calc(100% - 3px)`,i:`${d(F().value)/M*100}%`}),({e,t,a:n,o:r,i},a)=>{e!==a?.e&&p(s,`points`,e),t!==a?.t&&p(l,`points`,t),g(v,n,a?.a),r!==a?.o&&b(v,`left`,r),i!==a?.i&&b(v,`top`,i)}),t}})]}var C,w,T,E,D,O,k,A,j,M,N;function P(){return(P=e((()=>{y(),d(),i(),n(),r(),C=x(`<span class="sparkline-tile__sub mono">`),w=x(`<div class=sparkline-tile__head><span class=sparkline-tile__label></span> `),T=x(`<span class=sparkline-tile__age>−`),E=x(`<div class="sparkline-tile__value mono"> <!>`),D=x(`<div class=sparkline-tile__secondary>`),O=x(`<div class=sparkline-tile__hairline>`),k=x(`<div class=sparkline-tile__chart><svg viewBox="0 0 100 40"preserveAspectRatio=none aria-hidden=true><defs><linearGradient x1=0 y1=0 x2=0 y2=1><stop offset=0 stop-color=currentColor stop-opacity=0.28></stop><stop offset=1 stop-color=currentColor stop-opacity=0.02></stop></linearGradient></defs><polygon></polygon><polyline></polyline></svg><div>`),A=x(`<svg><polygon class=sparkline-tile__stack></svg>`,2),j=100,M=40,N=0,o(`openclaw-sparkline`,S,{properties:{label:{default:``},sub:{default:``},samples:{default:[],attribute:!1},format:{default:String,attribute:!1},floorMax:{default:0,attribute:!1},stackColors:{default:[],attribute:!1},autorange:{default:!1}}}),v([`pointermove`])})))()}export{P as t};