@synnaxlabs/pluto 0.36.0 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{LinePlot-CQN3l2Pu.cjs → LinePlot-CFpCtIU5.cjs} +1 -1
- package/dist/{LinePlot-rWkRDg70.js → LinePlot-Cyj5fPvs.js} +5 -14
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.js +2181 -2155
- package/dist/pluto.css +1 -1
- package/dist/src/vis/rule/Rule.d.ts +1 -0
- package/dist/src/vis/rule/Rule.d.ts.map +1 -1
- package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -21,4 +21,4 @@ void main(void) {
|
|
|
21
21
|
transformed = transformed + a_translate;
|
|
22
22
|
gl_Position = vec4(transformed, 0.0, 1.0);
|
|
23
23
|
}
|
|
24
|
-
`,hs=d.g.FLOAT32.density.valueOf(),Di=p.z.object({x:Je,y:Je,label:p.z.string().optional(),color:l.Color.z,strokeWidth:p.z.number().default(1),downsample:p.z.number().min(1).max(50).optional().default(1)}),Dc=(e,n,t)=>e===-1||n===-1||e>=t.length?NaN:Number(t[e].at(n)),Oc=d.w$1.milliseconds(2);l.G.NAN,l.G.NAN,l.ZERO;const Et=class Et extends d.GLProgram{constructor(t){super(t,zc,Yc);h(this,"translationBufferCache",new Map);this.translationBufferCache=new Map}bindState({strokeWidth:t,color:r}){return this.uniformColor("u_color",r),this.attrStrokeWidth(t)}bindScale(t,r){const s=l.G.scale(t.scale,r.scale),i=l.G.translate(l.G.scale(r.scale,t.offset),r.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",i)}draw({x:t,y:r,count:s,downsample:i,xOffset:a,yOffset:o},c){const{gl:u}=this.ctx;this.bindAttrBuffer("x",t.glBuffer,i,a),this.bindAttrBuffer("y",r.glBuffer,i,o),u.drawArraysInstanced(u.LINE_STRIP,0,s/i,c)}static create(t){const r=d.Context.use(t),s=new Et(r);return t.set(Et.CONTEXT_KEY,s),s}static use(t){return t.get(Et.CONTEXT_KEY)}bindAttrBuffer(t,r,s,i=0){const{gl:a}=this.ctx;a.bindBuffer(a.ARRAY_BUFFER,r);const o=a.getAttribLocation(this.prog,`a_${t}`);a.vertexAttribPointer(o,1,a.FLOAT,!1,hs*s,hs*i),a.enableVertexAttribArray(o)}getAndBindTranslationBuffer(t){const{gl:r}=this.ctx,s=`${this.ctx.aspect}:${t}`,i=this.translationBufferCache.get(s);if(i!=null)return r.bindBuffer(r.ARRAY_BUFFER,i.glBuffer),i;const a=r.createBuffer();if(a==null)throw new d.Re("Failed to create buffer from WebGL context");const o=Lc(this.ctx.aspect,t);r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW);const c={glBuffer:a,jsBuffer:o};return this.translationBufferCache.set(s,c),c}attrStrokeWidth(t){const{gl:r}=this.ctx,{jsBuffer:s}=this.getAndBindTranslationBuffer(t),i=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.vertexAttribDivisor(i,1),s.length/2}};h(Et,"CONTEXT_KEY","pluto-line-gl-program");let hn=Et;class we extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Di)}async afterUpdate(){var r,s;if(this.deleted)return;const{internal:t}=this;t.xTelem=await H(this.ctx,this.state.x,t.xTelem),t.yTelem=await H(this.ctx,this.state.y,t.yTelem),t.instrumentation=De(this.ctx,"line"),t.prog=hn.use(this.ctx),t.requestRender=Z.useRequest(this.ctx),(r=t.stopListeningXTelem)==null||r.call(t),(s=t.stopListeningYTelem)==null||s.call(t),t.stopListeningXTelem=t.xTelem.onChange(()=>t.requestRender(Bn)),t.stopListeningYTelem=t.yTelem.onChange(()=>t.requestRender(Bn)),t.requestRender(K)}async afterDelete(){var r,s,i,a;const{internal:t}=this;await((s=(r=t.xTelem).cleanup)==null?void 0:s.call(r)),await((a=(i=t.yTelem).cleanup)==null?void 0:a.call(i)),t.requestRender(K)}async xBounds(){return(await this.internal.xTelem.value())[0]}async yBounds(){return(await this.internal.yTelem.value())[0]}async findByXValue(t,r){const{xTelem:s,yTelem:i}=this.internal,[,a]=await s.value();let[o,c]=[-1,-1];a.find((M,D)=>{const P=M.binarySearch(r),z=P>=0&&P<M.length;return z&&([o,c]=[P,D]),z});const{key:u}=this,{color:f,label:g}=this.state,m={key:u,color:f,label:g,position:{x:0,y:0},value:{x:NaN,y:NaN}};if(o===-1||c===-1)return m;const w=a[c];m.value.x=Dc(c,o,a);const[,b]=await i.value(),v=b.find(M=>l.H.contains(M.alignmentBounds,w.alignment+BigInt(o)));if(v==null)return m;const E=Number(v.alignment-w.alignment);return m.value.y=Number(v.at(o-E)),m.position={x:t.dataToDecimalScale.x.pos(m.value.x),y:t.dataToDecimalScale.y.pos(m.value.y)},m}async render(t){if(this.deleted)return;const{downsample:r}=this.state,{xTelem:s,yTelem:i,prog:a}=this.internal,{dataToDecimalScale:o,exposure:c}=t,[[,u],[,f]]=await Promise.all([s.value(),i.value()]);u.forEach(v=>v.updateGLBuffer(a.ctx.gl)),f.forEach(v=>v.updateGLBuffer(a.ctx.gl));const g=Gc(u,f,c,r,Oc);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:r,scale:o.transform,props:t.region,ops:Bc(g)}));const m=a.setAsActive(),w=a.bindState(this.state),b=a.ctx.scaleRegion(t.region).transform;g.forEach(v=>{const E=Uc(o,v).transform;a.bindScale(E,b),a.draw(v,w)}),m()}}h(we,"TYPE","line");const Ac=5e3,Lc=(e,n)=>Nc(Zc(e),n).map((t,r)=>Math.floor(r/$c)*(1/(Ac*e))*t),$c=5,Zc=e=>new Float32Array([0,0,0,e,0,-e,1,0,-1,0]),Nc=(e,n)=>{const t=new Float32Array(e.length*n);for(let r=0;r<n;r++)t.set(e,r*e.length);return t},Uc=(e,n)=>e.translate(e.x.dim(Number(n.x.sampleOffset)),e.y.dim(Number(n.y.sampleOffset))),Ic={[we.TYPE]:we},Gc=(e,n,t,r,s)=>{if(e.length===0||n.length===0)return[];const i=[];return e.forEach(a=>n.forEach(o=>{if(!Fc(a,o,s))return;let c=0,u=0;a.alignment<o.alignment?c=Number(o.alignment-a.alignment):o.alignment<a.alignment&&(u=Number(a.alignment-o.alignment));const f=Math.min(a.length-c,o.length-u);if(f===0)return;const g=l.Y(Math.round(t*4*f),r,51);i.push({x:a,y:o,xOffset:c,yOffset:u,count:f,downsample:g})})),i},Bc=e=>e.map(n=>({...n,x:n.x.digest,y:n.y.digest})),Fc=(e,n,t)=>{if(!(e._timeRange!=null&&n._timeRange!=null))throw new d.Re(`Encountered series without time range in buildDrawOperations. X series present: ${e._timeRange!=null}, Y series present: ${n._timeRange!=null}`);const s=e.timeRange.overlapsWith(n.timeRange,t),i=l.H.overlapsWith(e.alignmentBounds,n.alignmentBounds);return s&&i};class jt{constructor(n,t){h(this,"canvas");h(this,"theme");this.canvas=n,this.theme=t}rule({direction:n,region:t,position:r,...s}){return n==="x"?this.line({start:l.G.construct(l.Eo.left(t),r),end:l.G.construct(l.Eo.right(t),r),...s}):this.line({start:l.G.construct(r,l.Eo.top(t)),end:l.G.construct(r,l.Eo.bottom(t)),...s})}line({stroke:n,lineWidth:t,lineDash:r,start:s,end:i}){const a=this.canvas;a.strokeStyle=n.hex,a.lineWidth=t,a.setLineDash([r]),a.beginPath(),a.moveTo(...l.G.couple(s)),a.lineTo(...l.G.couple(i)),a.stroke()}circle({fill:n,radius:t,position:r}){const s=this.canvas;s.fillStyle=n.hex,s.beginPath(),s.arc(...l.G.couple(r),t,0,2*Math.PI),s.fill()}resolveColor(n,t){return n==null?this.resolveColor(t):typeof n=="function"?n(this.theme):new l.Color(n)}border({region:n,color:t,width:r,radius:s,location:i}){const a=this.canvas;a.strokeStyle=this.resolveColor(t,this.theme.colors.border).hex,a.lineWidth=r??this.theme.sizes.border.width,s??(s=this.theme.sizes.border.radius),i==null||i===!0?s>0?(a.roundRect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n)),s),a.stroke()):(a.rect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n))),a.stroke()):d.A(i).forEach(o=>{const[c,u]=l.Eo.edgePoints(n,o);a.beginPath(),a.moveTo(...l.G.couple(c)),a.lineTo(...l.G.couple(u)),a.stroke()})}container({region:n,bordered:t=!0,rounded:r=!0,borderColor:s,borderRadius:i,borderWidth:a,backgroundColor:o}){i??(i=this.theme.sizes.border.radius),a??(a=1);const c=this.canvas;c.fillStyle=this.resolveColor(o,this.theme.colors.gray.l1).hex,c.strokeStyle=this.resolveColor(s,this.theme.colors.border).hex,c.setLineDash([]),c.lineWidth=1,c.beginPath(),r?c.roundRect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n)),i):c.rect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n))),c.fill(),t&&this.border({region:n,color:s,radius:i,width:a,location:t})}textContainer(n){const[t,r]=this.spacedTextDrawF(n);t.width+=12,t.height+=12;const{root:s=l.K.TOP_LEFT,offset:i=l.G.ZERO}=n,a={...n.position};s.x==="right"?a.x-=t.width+i.x:a.x+=i.x,s.y==="bottom"?a.y-=t.height+i.y:a.y+=i.y,this.container({region:l.Eo.construct(a,t.width,t.height),...n}),this.canvas.filter="none",r(l.G.translate(a,[6,6]))}spacedTextDrawF({text:n,direction:t,spacing:r=1,level:s="p"}){const i=d.fontString(this.theme,{level:s}),a=n.map(u=>d.dimensions(u,i,this.canvas)),o=this.theme.sizes.base*r,c=Math.max(...a.map(u=>u[l.g.dimension(t)]))+o;return[{[l.g.dimension(l.g.swap(t))]:Math.max(...a.map(u=>u[l.g.dimension(l.g.swap(t))])),[l.g.dimension(t)]:c*n.length-o},u=>{const f=d.fontString(this.theme,{level:s});this.canvas.font=f,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",n.forEach((g,m)=>{this.canvas.fillText(g,u.x,u.y+c*m)})}]}drawTextInCenter({box:n,text:t,level:r}){const s=d.dimensions(t,this.canvas.font,this.canvas),i=l.Eo.positionInCenter(l.Eo.construct(l.G.ZERO,s),n);return this.text({text:t,position:l.Eo.topLeft(i),level:r})}text({text:n,position:t,level:r="p",weight:s,shade:i,maxWidth:a,code:o}){this.canvas.font=d.fontString(this.theme,{level:r,weight:s,code:o}),i==null?this.canvas.fillStyle=this.theme.colors.text.hex:this.canvas.fillStyle=this.theme.colors.gray[`l${i}`].hex,this.canvas.textBaseline="top";let c;a!=null&&(c=this.canvas.scissor(l.Eo.construct(t,a,1e3))),this.canvas.fillText(n,t.x,t.y),c==null||c()}}const Yr=p.z.object({position:p.z.number().optional(),pixelPosition:p.z.number().optional(),dragging:p.z.boolean(),lineWidth:p.z.number().optional().default(1),lineDash:p.z.number().optional().default(20),color:l.Color.z}),_c=3;class Gt extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Yr);h(this,"lastUpdateRef",null)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx);const t=d.use(this.ctx);this.internal.draw=new jt(this.internal.renderCtx.upper2d,t),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,et)}updatePositions({decimalToDataScale:t,plot:r,container:s}){const i=this.state.dragging,a=this.prevState.dragging&&!i;if((i||a)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??(this.lastUpdateRef=this.state.pixelPosition),Math.abs(this.state.pixelPosition-this.lastUpdateRef)<_c&&!a)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const u=t.pos((this.state.pixelPosition-l.Eo.top(r)+l.Eo.top(s))/l.Eo.height(r));return this.setState(f=>({...f,position:u})),this.state.pixelPosition}if(this.state.position==null){const c=t.pos(.5);this.setState(u=>({...u,position:c}))}const o=t.reverse().pos(this.state.position)*l.Eo.height(r)+l.Eo.top(r)-l.Eo.top(s);if(!isNaN(o)){if(this.state.pixelPosition!=null&&Math.abs(o-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(c=>({...c,pixelPosition:o}))}return o}async render(t){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:i}=t,a=l.K.direction(s),{upper2d:o}=r,c=this.internal.draw;let u=this.updatePositions(t);u+=l.Eo.top(t.container),c.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:a,region:i,position:u}),o.fillStyle=this.state.color.hex,o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const f=4;if(s==="left"){const g=l.Eo.left(i)-1;o.moveTo(g,u),o.lineTo(g-f,u-f),o.lineTo(g-f,u+f)}else s==="right"&&(o.moveTo(l.Eo.right(i),u),o.lineTo(l.Eo.right(i)+f,u-f),o.lineTo(l.Eo.right(i)+f,u+f));o.closePath(),o.stroke()}}h(Gt,"TYPE","Rule");const Oi={[Gt.TYPE]:Gt},Hc=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Oi,Rule:Gt,ruleStateZ:Yr},Symbol.toStringTag,{value:"Module"})),qc=Le.extend({location:l.K.x.optional().default("left")}),ds=2,jc=e=>l.Eo.signedWidth(e)<ds||l.Eo.signedHeight(e)<ds;class be extends Yi{constructor(){super(...arguments);h(this,"schema",Le)}async xBounds(){return l.H.max((await Promise.all(this.lines.map(async t=>await t.xBounds()))).filter(t=>l.H.isFinite(t)))}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport),i=r.invert().reverse();if(this.renderAxis(t,i),await this.renderLines(t,r),await this.renderRules(t,i),s!=null)throw s}async renderLines({xDataToDecimalScale:t,plot:r,canvases:s,exposure:i},a){if(!s.includes("gl")||jc(r))return;const o={region:r,dataToDecimalScale:new l.b.XY(t,a),exposure:i};await Promise.all(this.lines.map(async c=>await c.render(o)))}async renderRules({container:t,plot:r,canvases:s},i){if(!s.includes("upper2d"))return;const{location:a}=this.state,{render:o}=this.internal,c=l.Eo.construct(l.Eo.left(t),l.Eo.top(r),l.Eo.width(t),l.Eo.height(r)),u=o.scissor(c,l.G.ZERO,["upper2d"]),f={container:t,plot:r,decimalToDataScale:i,location:a};await Promise.all(this.rules.map(async g=>await g.render(f))),u()}async findByXValue({xDataToDecimalScale:t,plot:r,viewport:s,hold:i,exposure:a},o){const[c,u]=await this.dataToDecimalScale(i,this.dataBounds.bind(this),s);if(u!=null)throw u;const f=new l.b.XY(t,c),g={region:r,dataToDecimalScale:f,exposure:a};return(await Promise.all(this.lines.map(async m=>await m.findByXValue(g,o)))).map(m=>({...m,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async t=>await t.yBounds()))}get lines(){return this.childrenOfType(we.TYPE)}get rules(){return this.childrenOfType(Gt.TYPE)}}h(be,"TYPE","YAxis");const Ai=p.z.object({start:d.m.z,end:d.m.z});class dn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ai)}async afterUpdate(){this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,d.use(this.ctx))}async render(){}}h(dn,"TYPE","range-annotation");const Wc=p.z.object({region:l.Eo.box,clearOverScan:l.G.crudeZ.optional().default(0),visible:p.z.boolean().optional().default(!0)}),In=["upper2d","lower2d"],Ct=class Ct extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ct.stateZ)}async afterUpdate(){const{internal:t}=this;t.renderCtx=d.Context.use(this.ctx),Z.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){const t=l.Eo.copy(this.state.region);if(!this.state.visible)return async()=>this.internal.renderCtx.erase(this.state.region,this.state.clearOverScan,...In);const{renderCtx:r}=this.internal,s=l.b.XY.translate(l.Eo.topLeft(this.state.region)),i=r.scissor(this.state.region,l.G.construct(this.state.clearOverScan),In);try{for(const a of this.children)await a.render({viewportScale:s})}catch(a){console.error(a)}finally{i()}return async()=>{this.internal.renderCtx.erase(t,this.state.clearOverScan)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Ct.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:In})}};h(Ct,"TYPE","Table"),h(Ct,"stateZ",Wc);let ve=Ct;const Vc={[ve.TYPE]:ve},Li=p.z.object({triggered:p.z.boolean(),status:d.specZ$1,sink:Pn.optional().default(Sn),source:ir.optional().default(nr)});class fn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Li)}async afterUpdate(){var s,i,a;const{sink:t,source:r}=this.state;this.internal.source=await H(this.ctx,r,this.internal.source),this.internal.sink=await Ye(this.ctx,t,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&this.internal.sink.set(((s=this.state.status.data)==null?void 0:s.authority)!==d.wp.Absolute.valueOf()).catch(console.error),await this.updateEnabledState(),(a=(i=this.internal).stopListening)==null||a.call(i),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})}async updateEnabledState(){const t=await this.internal.source.value();t.time.equals(this.state.status.time)||this.setState(r=>({...r,status:t,triggered:!1}))}async afterDelete(){this.asyncAfterDelete().catch(console.error)}async asyncAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}render(){}}h(fn,"TYPE","Chip");const $i=p.z.object({}),fs="control-state-provider",Zi=d.Fg.stateZ.extend({subjectColor:l.Color.z});class Bt extends d.Composite{constructor(){super(...arguments);h(this,"schema",$i);h(this,"colors",new Map);h(this,"tracker");h(this,"disconnectTrackerChange");h(this,"obs",new Qn.Observer)}static use(t){return t.get(fs)}async afterUpdate(){const{internal:t}=this;t.instrumentation=De(this.ctx,"control-state");const r=d.use(this.ctx);t.palette=r.colors.visualization.palettes.default,t.defaultColor=r.colors.gray.l6;const s=Me(this.ctx);t.client!=null&&s===t.client||(t.client=s,this.ctx.set(fs,this),await this.maybeCloseTracker(),t.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(t.client)))}async maybeCloseTracker(){var t;this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),(t=this.disconnectTrackerChange)==null||t.call(this),await this.tracker.close(),this.tracker=void 0)}async afterDelete(){await this.maybeCloseTracker()}onChange(t){return this.obs.onChange(t)}get(t){return Array.isArray(t)?d.n(t).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(t)}getOne(t){if(this.tracker==null)return;const r=this.tracker.states.get(t);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async openTracker(t){var i;const{internal:r}=this,{instrumentation:s}=r;try{this.tracker=await t.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}(i=this.disconnectTrackerChange)==null||i.call(this),this.disconnectTrackerChange=this.tracker.onChange(a=>{if(s.L.debug("transfer",{transfers:a.map(o=>d.Fg.transferString(o))}),this.tracker==null)throw new d.Re("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(a)})}updateColors(t){const r=t.subjects(),s=r.map(o=>o.key),i=Array.from(this.colors.values());this.colors.forEach((o,c)=>!s.includes(c)&&this.colors.delete(c));const{palette:a}=this.internal;r.forEach(o=>{if(this.colors.has(o.key))return;const c=a.find(u=>!i.includes(u))??a[0];this.colors.set(o.key,c),i.push(c)})}}h(Bt,"TYPE","StateProvider");const Ni=["acquired","released","overridden","failed"],Ui=p.z.enum(Ni),Ii=p.z.object({name:p.z.string(),authority:p.z.number().default(0),acquireTrigger:p.z.number(),status:Ui.optional(),needsControlOf:d.Ug.keyZ.array().optional().default([])});class pn extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ii);h(this,"registry",new Map);h(this,"writer")}async afterUpdate(){this.internal.instrumentation=De(this.ctx),(this.internal.prevTrigger==null||Math.abs(this.state.acquireTrigger-this.internal.prevTrigger)>1)&&(this.internal.prevTrigger=this.state.acquireTrigger);const t=Me(this.ctx),r=Bt.use(this.ctx);this.internal.client=t,this.internal.client==null&&await this.release(),this.internal.stateProv=r,xs(this.ctx,this),this.internal.addStatus=d.useAggregate(this.ctx),this.state.acquireTrigger>this.internal.prevTrigger?(this.acquire(),this.internal.prevTrigger=this.state.acquireTrigger):this.state.acquireTrigger<this.internal.prevTrigger&&(this.release(),this.internal.prevTrigger=this.state.acquireTrigger)}async afterDelete(){await this.release()}async updateNeedsControlOf(){const{client:t}=this.internal;if(t==null)return;const r=new Set([]);for(const i of this.registry.keys())(await i.needsControlOf(t)).forEach(o=>o!==0&&r.add(o));const s=Array.from(r);d.F.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==d.F.EQUAL&&this.setState(i=>({...i,needsControlOf:s}))}async acquire(){const{client:t,addStatus:r}=this.internal;if(t==null)return r({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return r({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});this.writer=await t.openWriter({start:d.k.now(),channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(i=>({...i,status:"acquired"}))}catch(s){this.setState(i=>({...i,status:"failed"})),r({message:`${this.state.name} failed to acquire control: ${s.message}`,variant:"error"})}}async release(){var t;try{await((t=this.writer)==null?void 0:t.close()),this.setState(r=>({...r,status:"released"}))}catch(r){this.internal.addStatus({message:`${this.state.name} failed to release control: ${r.message}`,variant:"error"})}finally{this.writer=void 0}}async set(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(t))}async setAuthority(t,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(t.map(i=>[i,r]))))}async releaseAuthority(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(t.map(s=>[s,this.state.authority]))))}deleteTelem(t){this.registry.delete(t),this.updateNeedsControlOf()}create(t){const s=(()=>{switch(t.type){case Te.TYPE:{const i=new Te(this,t.props);return this.registry.set(i,null),i}case Ee.TYPE:{const i=new Ee(this,this.internal.stateProv,t.props);return this.registry.set(i,null),i}case Se.TYPE:return new Se(this,t.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}h(pn,"TYPE","Controller");const Gi=p.z.object({channel:p.z.number()});class Te extends Rn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Gi);this.controller=t}invalidate(){}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){if(this.props.channel===0)return[];const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),i={[s.key]:t};if(s.index!==0){const a=await r.channels.retrieve(s.index);i[a.key]=d.k.now()}await this.controller.set(i)}}h(Te,"TYPE","controlled-numeric-telem-sink");const Xc=e=>({type:Te.TYPE,props:e,variant:"sink",valueType:"number"}),Bi=p.z.object({authority:p.z.number().default(d.Fg.Authority.Absolute.valueOf()),channel:p.z.number()});class Se extends Rn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Bi);this.controller=t}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const i=await s.channels.retrieve(this.props.channel),a=[i.key];i.index!==0&&a.push(i.index),t?await this.controller.setAuthority(a,this.props.authority):await this.controller.releaseAuthority(a)}}h(Se,"TYPE","acquire-channel-control");const Kc=e=>({type:Se.TYPE,props:e,variant:"sink",valueType:"boolean"}),Fi=p.z.object({channel:p.z.number()});class Ee extends F{constructor(t,r,s){super(s);h(this,"prov");h(this,"valid",!1);h(this,"stopListening");h(this,"controller");h(this,"schema",Fi);this.prov=r,this.controller=t}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:t}=this.props;(s=this.stopListening)==null||s.call(this);const r=d.Q.filterTransfersByChannelKey(t);this.stopListening=this.prov.onChange(i=>{var a;r(i).length!==0&&((a=this.notify)==null||a.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const t=d.k.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:t,data:{valid:!1,authority:0}};const r=this.prov.get(this.props.channel);return r==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:t,data:{valid:!0,color:void 0,authority:0}}:{key:r.subject.key,variant:r.subject.key===this.controller.key?"success":"error",message:`Controlled by ${r.subject.name}`,time:t,data:{valid:!0,color:r.subjectColor,authority:r.authority}}}async cleanup(){var t;this.controller.deleteTelem(this),(t=this.stopListening)==null||t.call(this)}}h(Ee,"TYPE","controlled-status-source");const Qc=e=>({type:Ee.TYPE,props:e,variant:"source",valueType:"status"}),_i=p.z.object({statusSource:ir.optional().default(nr),colorSource:sr.optional().default(En),status:d.specZ$1,color:l.Color.z.optional()});class gn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",_i);h(this,"stopListeningStatus");h(this,"stopListeningColor")}async afterUpdate(){var r,s;const{internal:t}=this;t.statusSource=await H(this.ctx,this.state.statusSource,t.statusSource),t.colorSource=await H(this.ctx,this.state.colorSource,t.colorSource),await this.updateState(),(r=this.stopListeningStatus)==null||r.call(this),this.stopListeningStatus=t.statusSource.onChange(()=>{this.updateState()}),(s=this.stopListeningColor)==null||s.call(this),this.stopListeningColor=t.colorSource.onChange(()=>{this.updateState()})}async afterDelete(){this.internalAfterDelete().catch(console.error)}async internalAfterDelete(){var t,r,s,i;await((r=(t=this.internal.statusSource).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.colorSource).cleanup)==null?void 0:i.call(s))}async render(){}async updateState(){const t=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();t.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:t,status:r}))}}h(gn,"TYPE","Indicator");const Hi=p.z.object({needsControlOf:d.Ug.keyZ.array(),states:Zi.array()});class mn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Hi)}async afterUpdate(){var a;const{internal:t}=this;t.stateProv=Bt.use(this.ctx);const r=this.state.needsControlOf;(a=t.disconnectStateProv)==null||a.call(t);const s=d.Q.filterTransfersByChannelKey(...r),i=t.stateProv.get(r);this.setState(o=>({...o,states:i})),t.disconnectStateProv=t.stateProv.onChange(o=>{if(s(o).length===0)return;const c=t.stateProv.get(r);this.setState(u=>({...u,states:c}))})}async afterDelete(){var r;const{internal:t}=this;(r=t.disconnectStateProv)==null||r.call(t)}async render(){}}h(mn,"TYPE","Legend");const Jc={[pn.TYPE]:pn,[Bt.TYPE]:Bt,[gn.TYPE]:gn,[fn.TYPE]:fn,[mn.TYPE]:mn},qi=p.z.object({trigger:p.z.number(),sink:Pn.optional().default(Sn)});class yn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",qi)}async afterUpdate(){var s;const{sink:t}=this.state;(s=this.internal).prevTrigger??(s.prevTrigger=this.state.trigger),this.internal.sink=await Ye(this.ctx,t,this.internal.sink);const r=this.internal.prevTrigger;this.internal.prevTrigger=this.state.trigger,!(this.state.trigger<=r)&&this.internal.sink.set(!0).catch(console.error)}render(){}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var r,s;const{internal:t}=this;await((s=(r=t.sink).cleanup)==null?void 0:s.call(r))}}h(yn,"TYPE","Button");const tu={[yn.TYPE]:yn},zr=p.z.object({dpr:p.z.number(),region:l.Eo.box,bootstrap:p.z.boolean().optional().default(!1),bootstrapped:p.z.boolean().optional().default(!1),glCanvas:p.z.any().optional(),upper2dCanvas:p.z.any().optional(),lower2dCanvas:p.z.any().optional(),os:d.w.osZ});class Ce extends d.Composite{constructor(){super(...arguments);h(this,"schema",zr);h(this,"renderContextSet",!1)}async afterUpdate(){let t=d.Context.useOptional(this.ctx);if(t==null){if(this.renderContextSet)throw new d.Re("[vis.worker.Canvas] - expected render context to be set");if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:i,os:a}=this.state;if(r==null||s==null||i==null)throw new d.Re("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");t=d.Context.create(this.ctx,r,s,i,a),hn.create(this.ctx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else t.update(this.ctx);t.resize(this.state.region,this.state.dpr)}}h(Ce,"TYPE","Canvas");const ji={[Ce.TYPE]:Ce},eu=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Ce,REGISTRY:ji,canvasStateZ:zr},Symbol.toStringTag,{value:"Module"})),Dr=p.z.object({position:l.G.xy,zoom:p.z.number(),region:l.Eo.box,clearOverScan:l.G.crudeZ.optional().default(10),visible:p.z.boolean().optional().default(!0)}),Ge=["upper2d","lower2d"],Pt=class Pt extends d.Composite{constructor(){super(...arguments);h(this,"schema",Pt.stateZ)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx),this.internal.addStatus=d.useAggregate(this.ctx),Z.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const{renderCtx:t,addStatus:r}=this.internal,{zoom:s,position:i}=this.state,a=l.Eo.construct(this.state.region);if(!this.state.visible)return async()=>t.erase(a,this.state.clearOverScan,...Ge);const o=t.scissor(a,l.G.ZERO,Ge),c=l.b.XY.magnify(l.G.construct(s)).translate(l.Eo.topLeft(a)).translate(i);try{await Promise.all(this.children.map(async f=>await f.render({viewportScale:c})))}catch(f){r({variant:"error",message:f.message})}finally{o()}const u=l.Eo.copy(this.state.region);return async()=>{this.internal.renderCtx.erase(u,this.state.clearOverScan,...Ge)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Pt.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Ge})}};h(Pt,"TYPE","Diagram"),h(Pt,"stateZ",Dr);let Ft=Pt;const Wi={[Ft.TYPE]:Ft},nu=Object.freeze(Object.defineProperty({__proto__:null,Diagram:Ft,REGISTRY:Wi,diagramStateZ:Dr},Symbol.toStringTag,{value:"Module"})),Vi=p.z.object({enabled:p.z.boolean(),source:rr.optional().default(er)});class xn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Vi)}async afterUpdate(){var s;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{source:t}=this.state,{internal:r}=this;this.internal.source=await H(this.ctx,t,this.internal.source),await this.updateEnabledState(),(s=r.stopListening)==null||s.call(r),r.stopListening=r.source.onChange(()=>this.updateEnabledState().catch(this.reportError.bind(this)))}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Light: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t))}async render(){}}h(xn,"TYPE","Light");const ru={[xn.TYPE]:xn},Or=p.z.object({position:l.G.xy.or(p.z.null()),textColor:l.Color.z.optional().default(l.ZERO),backgroundColor:l.Color.z.optional().default(l.ZERO),borderColor:l.Color.z.optional().default(l.ZERO),ruleColor:l.Color.z.optional().default(l.ZERO),ruleStrokeWidth:p.z.number().optional().default(1),ruleStrokeDash:p.z.number().default(0)});class _t extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Or)}async afterUpdate(){const t=d.use(this.ctx);this.state.textColor.isZero&&(this.state.textColor=t.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=t.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=t.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=t.colors.gray.l5),this.internal.dotColor=t.colors.text,this.internal.dotColorContrast=t.colors.textInverted,this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,t),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,et)}async render(t){if(this.deleted||this.state.position==null)return;const{region:r}=t,s=l.b.XY.scale(l.Eo.DECIMAL).scale(r),i=l.b.XY.scale(r).scale(l.Eo.DECIMAL),a=await t.findByXDecimal(i.x.pos(this.state.position.x)),o=a.filter(b=>l.G.isFinite(b.value)),{draw:c}=this.internal,u=o.reduce((b,v)=>b+v.position.x,0)/o.length,f=new d.m(o.reduce((b,v)=>b+v.value.x,0)/o.length),g=s.x.pos(u);if(!l.H.contains(l.Eo.xBounds(r),g))return;c.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:g}),o.forEach(b=>{const v=s.pos(b.position);c.circle({fill:b.color.setAlpha(.5),radius:8,position:v}),c.circle({fill:b.color.setAlpha(.8),radius:5,position:v}),c.circle({fill:b.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:v})});const m=a.map(b=>`${b.label??""}: ${b.value.y.toFixed(2)}`);m.unshift(`Time: ${f.fString("preciseDate","local")}`);const w=i.pos(this.state.position);c.textContainer({text:m,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:this.state.position,direction:"y",level:"small",spacing:.5,offset:{x:12,y:12},root:{x:w.x>.8?"right":"left",y:w.y>.8?"top":"bottom"}})}}h(_t,"TYPE","tooltip");const Xi={[_t.TYPE]:_t},su=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Xi,Tooltip:_t,tooltipStateZ:Or},Symbol.toStringTag,{value:"Module"})),Ki=p.z.object({region:l.Eo.box,wheelPos:p.z.number(),scrolling:p.z.boolean(),empty:p.z.boolean(),visible:p.z.boolean(),telem:Je.optional().default(Ts),font:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),overshoot:l.G.xy.optional().default({x:0,y:0})}),iu=.98,Kt="lower2d",au={offset:0n,offsetRef:0n,scrollRef:0},ie=class ie extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ie.z);h(this,"values",new d.Dt([]));h(this,"scrollState",au)}async afterUpdate(){var c;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.telem);const{scrolling:r,wheelPos:s}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const u=this.values.alignmentBounds.upper-1n;this.scrollState={offset:u,offsetRef:u,scrollRef:this.state.wheelPos}}else if(r){const{scrollState:u,values:f}=this,g=Math.ceil((s-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(g)),u.offset<f.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=f.alignmentBounds.lower,this.setState(m=>({...m,wheelPos:this.prevState.wheelPos}))),u.offset>=f.alignmentBounds.upper&&this.setState(m=>({...m,scrolling:!1}))}const[a,o]=await this.internal.telem.value();this.values=new d.Dt(o),this.checkEmpty(),(c=t.stopListeningTelem)==null||c.call(t),t.stopListeningTelem=t.telem.onChange(()=>this.internal.telem.value().then(([u,f])=>{this.checkEmpty(),this.values=new d.Dt(f),this.requestRender()})),this.requestRender()}checkEmpty(){const t=this.values.length===0;t!==this.state.empty&&this.setState(r=>({...r,empty:t}))}async afterDelete(){var s;const{telem:t,render:r}=this.internal;await((s=t.cleanup)==null?void 0:s.call(t)),r.erase(l.Eo.construct(this.state.region),l.G.ZERO,Kt)}requestRender(){const{render:t}=this.internal;t.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(),priority:"high",canvases:[Kt]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((l.Eo.height(this.state.region)-12)/this.lineHeight),this.values.length)}async render(){const{render:t}=this.internal,r=this.state.region;if(l.Eo.areaIsZero(r))return;if(!this.state.visible)return async()=>t.erase(r,l.G.ZERO,Kt);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const f=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(f,this.visibleLineCount)}const i=this.state.region,a=t[Kt],o=new jt(a,this.internal.theme),c=t.scissor(i,l.G.ZERO,[Kt]);this.renderElements(o,s),this.renderScrollbar(o),c();const u=l.Eo.copy(this.state.region);return async({canvases:f})=>t.erase(u,this.state.overshoot,...f)}renderScrollbar(t){const r=this.state.region,s=l.Eo.height(r)/this.totalHeight*l.Eo.height(r);if(s>=l.Eo.height(r)*iu)return;let i=l.Eo.bottom(r)-s;this.state.scrolling&&(i-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*l.Eo.height(r)),i<0&&(i=l.Eo.top(r)),t.container({region:l.Eo.construct({x:l.Eo.right(r)-6,y:i},{width:6,height:s}),bordered:!1,backgroundColor:a=>a.colors.gray.l4})}renderElements(t,r){const s=this.state.region;let i=0;for(const a of r){const o=this.values.dataType.equals(d.g.JSON)?JSON.stringify(a):a.toString();t.text({text:o,level:this.state.font,shade:9,position:l.G.translate(l.Eo.topLeft(s),{x:6,y:i*this.lineHeight+6}),code:!0}),i++}}};h(ie,"TYPE","log"),h(ie,"z",Ki);let Pe=ie;const ou={[Pe.TYPE]:Pe},Ar=p.z.object({one:l.G.xy.nullable(),two:l.G.xy.nullable(),hover:l.G.xy.nullable(),color:p.z.union([l.Color.z,p.z.object({verticalLine:l.Color.z.optional().default(l.ZERO),horizontalLine:l.Color.z.optional().default(l.ZERO),obliqueLine:l.Color.z.optional().default(l.ZERO)})]).optional().default(l.ZERO),strokeWidth:p.z.number().optional().default(1),strokeDash:p.z.number().optional().default(2)});class Ht extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ar)}async afterUpdate(){const t=d.Context.use(this.ctx);this.internal.theme=d.use(this.ctx),this.internal.render=t,this.internal.draw=new jt(t.upper2d,this.internal.theme),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,K)}get verticalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.verticalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.verticalLine}get horizontalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.horizontalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.horizontalLine}get obliqueLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.obliqueLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.obliqueLine}async find(t){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:i,two:a}=this.prevState,{dataOne:o,dataTwo:c}=this.internal;if(i!=null&&l.G.equals(r,i)&&a!=null&&l.G.equals(s,a)&&o!=null&&c!=null){const[E,M]=[await t.findByXValue(o.x),await t.findByXValue(c.x)];return E.length===0||M.length===0?null:[E.sort((D,P)=>l.G.distance(o,D.value)-l.G.distance(o,P.value))[0],M.sort((D,P)=>l.G.distance(c,D.value)-l.G.distance(c,P.value))[0]]}const u=l.b.XY.scale(t.region).scale(l.Eo.DECIMAL),[f,g]=[u.pos(r),u.pos(s)],[m,w]=[await t.findByXDecimal(f.x),await t.findByXDecimal(g.x)];if(m.length===0||w.length===0)return null;const[b,v]=[m.sort((E,M)=>l.G.distance(f,E.position)-l.G.distance(f,M.position))[0],w.sort((E,M)=>l.G.distance(g,E.position)-l.G.distance(g,M.position))[0]];return this.internal.dataOne=b.value,this.internal.dataTwo=v.value,[b,v]}async renderHover(t){if(this.state.hover==null)return;const r=this.state.hover,s=l.b.XY.scale(t.region).scale(l.Eo.DECIMAL),i=s.pos(r),a=await t.findByXDecimal(s.pos(r).x);if(a.length===0)return;const o=a.sort((u,f)=>l.G.distance(i,u.position)-l.G.distance(i,f.position))[0],{draw:c}=this.internal;c.circle({fill:o.color.setAlpha(.5),radius:9,position:s.reverse().pos(o.position)})}async render(t){if(this.deleted)return;await this.renderHover(t);const r=await this.find(t);if(r==null)return;const[s,i]=r,{draw:a}=this.internal,{strokeDash:o,strokeWidth:c}=this.state,u=l.b.XY.scale(l.Eo.DECIMAL).scale(t.region),f=u.pos(s.position),g=u.pos(i.position),m=new d.w$1(Math.abs(s.value.x-i.value.x)),w=Math.abs(s.value.y-i.value.y),b=w/m.seconds;a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(f.x,g.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${w.toFixed(2)} ${s.units??""}`],direction:"x",position:l.G.construct(f.x,(f.y+g.y)/2),level:"small"}),a.line({start:l.G.construct(f.x,g.y),end:l.G.construct(g.x,g.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[m.truncate(d.w$1.MILLISECOND).toString()],direction:"x",position:l.G.construct((f.x+g.x)/2,g.y),level:"small"}),a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(g.x,g.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${b.toFixed(2)} ${s.units??""} / S`],direction:"x",position:l.G.construct((f.x+g.x)/2,(f.y+g.y)/2),level:"small"}),a.circle({fill:s.color.setAlpha(.5),radius:8,position:f}),a.circle({fill:s.color.setAlpha(.8),radius:5,position:f}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:f}),a.circle({fill:i.color.setAlpha(.5),radius:8,position:g}),a.circle({fill:i.color.setAlpha(.8),radius:5,position:g}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:g})}}h(Ht,"TYPE","measure");const Qi={[Ht.TYPE]:Ht},lu=Object.freeze(Object.defineProperty({__proto__:null,Measure:Ht,REGISTRY:Qi,measureStateZ:Ar},Symbol.toStringTag,{value:"Module"})),Ji=p.z.object({trigger:p.z.number(),command:p.z.number().optional(),value:p.z.number(),sink:ks.optional().default(ws),source:Ps.optional().default(bs)});class wn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ji)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,trigger:s,command:i}=this.state,{trigger:a}=this.prevState,{internal:o}=this;this.internal.source=await H(this.ctx,r,this.internal.source),o.sink=await Ye(this.ctx,t,o.sink),s!==a&&i!=null&&this.internal.sink.set(i),await this.updateValue(),(c=o.stopListening)==null||c.call(o),o.stopListening=o.source.onChange(()=>{this.updateValue().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Setpoint: ${t.message}`})}async updateValue(){const t=await this.internal.source.value();t!==this.state.value&&this.setState(r=>({...r,value:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}async render(){}}h(wn,"TYPE","Setpoint");const cu={[wn.TYPE]:wn},ta=p.z.object({triggered:p.z.boolean(),enabled:p.z.boolean(),sink:Pn.optional().default(Sn),source:rr.optional().default(er)});class bn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ta)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,triggered:s,enabled:i}=this.state,{triggered:a}=this.prevState,{internal:o}=this;this.internal.source=await H(this.ctx,r,this.internal.source),o.sink=await Ye(this.ctx,t,o.sink),s&&!a&&await o.sink.set(!i),await this.updateEnabledState(),(c=o.stopListening)==null||c.call(o),o.stopListening=o.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Toggle: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}async render(){}}h(bn,"TYPE","Toggle");const uu={[bn.TYPE]:bn},hu=p.z.object({box:l.Eo.box,telem:ar.optional().default(vs),backgroundTelem:sr.optional().default(En),level:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),precision:p.z.number().optional().default(2),minWidth:p.z.number().optional().default(60),width:p.z.number().optional(),notation:Bs.optional().default("standard"),location:l.K.xy.optional().default({x:"left",y:"center"})}),du=["upper2d","lower2d"],ae=class ae extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ae.z)}async afterUpdate(){var r,s;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.telem),(r=t.stopListening)==null||r.call(t),t.stopListening=this.internal.telem.onChange(()=>this.requestRender()),t.backgroundTelem=await H(this.ctx,this.state.backgroundTelem,t.backgroundTelem),(s=t.stopListeningBackground)==null||s.call(t),t.stopListeningBackground=this.internal.backgroundTelem.onChange(()=>this.requestRender()),this.internal.requestRender=Z.useOptionalRequest(this.ctx),this.requestRender()}async afterDelete(){var i;const{requestRender:t,telem:r,render:s}=this.internal;await((i=r.cleanup)==null?void 0:i.call(r)),t==null?s.erase(l.Eo.construct(this.state.box),l.G.ZERO,...du):t(K)}requestRender(){const{requestRender:t}=this.internal;t!=null?t(K):this.render({})}get fontHeight(){const{theme:t}=this.internal;return t.typography[this.state.level].size*t.sizes.base}maybeUpdateWidth(t){const{theme:r}=this.internal,s=t+r.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<s||this.state.minWidth>s&&this.state.width!==this.state.minWidth?this.setState(i=>({...i,width:Math.max(s,i.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(i=>({...i,width:Math.max(s,i.minWidth)}))}async render({viewportScale:t=l.b.XY.IDENTITY}){const{render:r,telem:s,backgroundTelem:i}=this.internal,a=l.Eo.construct(this.state.box);if(l.Eo.areaIsZero(a))return;const{location:o}=this.state,c=r.lower2d.applyScale(t);let u=await s.value();const f=d.fontString(this.internal.theme,{level:this.state.level,code:!0});c.font=f;const g=this.fontHeight,m=u[0]=="-";m&&(u=u.slice(1));const{theme:w}=this.internal,b=d.dimensions(u,f,c).width+w.sizes.base;this.internal.requestRender==null&&r.erase(l.Eo.construct(this.prevState.box)),this.maybeUpdateWidth(b);const v={...l.G.ZERO};o.x==="left"&&(v.x=6+g*.75),o.x==="center"&&(v.x=l.Eo.width(a)/2-b/2),o.y==="center"&&(v.y=l.Eo.height(a)/2);const E=l.G.translate(l.Eo.topLeft(a),v),M=c.scissor(a,void 0);let D=!0;if(this.state.backgroundTelem.type!=En.type){const P=r.lower2d.applyScale(t),z=await i.value();D=z.isZero,z.isZero||(P.fillStyle=z.hex,P.rect(...l.G.couple(l.Eo.topLeft(a)),l.Eo.width(a),l.Eo.height(a)),P.fill(),c.fillStyle=z.pickByContrast(w.colors.gray.l0,w.colors.gray.l9).hex)}D&&(c.fillStyle=this.internal.textColor.hex),c.textBaseline="middle",m&&c.fillText("-",...l.G.couple(l.G.translateX(E,-g*.6))),c.fillText(u,...l.G.couple(E)),M()}};h(ae,"TYPE","value"),h(ae,"z",hu);let qt=ae;const ea={[qt.TYPE]:qt},fu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ea,Value:qt},Symbol.toStringTag,{value:"Module"})),pu=d.cp.payloadZ.extend({viewport:l.H.bounds}),ps=e=>l.Color.z.safeParse(e).success,na=p.z.object({cursor:l.G.xy.or(p.z.null()),hovered:pu.or(p.z.null()),count:p.z.number()});class ke extends d.Leaf{constructor(){super(...arguments);h(this,"schema",na);h(this,"fetchedInitial",d.E.ZERO)}async afterUpdate(){const{internal:t}=this;t.render=d.Context.use(this.ctx),t.draw=new jt(t.render.upper2d,d.use(this.ctx)),t.ranges??(t.ranges=new Map);const r=Me(this.ctx);r!=null&&(t.client=r,t.tracker==null&&(t.tracker=await t.client.ranges.openTracker(),t.tracker.onChange(async s=>{s.forEach(async i=>{i.variant==="delete"?t.ranges.delete(i.key):ps(i.value.color)&&t.ranges.set(i.key,i.value)}),Z.requestRender(this.ctx,et),this.setState(i=>({...i,count:t.ranges.size}))}),Z.requestRender(this.ctx,et)))}async fetchInitial(t){const{internal:r}=this;if(r.client==null||this.fetchedInitial.roughlyEquals(t,d.w$1.minutes(1)))return;this.fetchedInitial=t,(await r.client.ranges.retrieve(t)).forEach(i=>{ps(i.color)&&r.ranges.set(i.key,i)}),this.setState(i=>({...i,count:r.ranges.size}))}async render(t){const{dataToDecimalScale:r,region:s,viewport:i,timeRange:a}=t;await this.fetchInitial(a);const{draw:o,ranges:c}=this.internal,u=r.scale(l.Eo.xBounds(s)),f=this.state.cursor==null?null:this.state.cursor.x;let g=null;const m=o.canvas.scissor(l.Eo.construct({x:l.Eo.left(s),y:l.Eo.top(s)-35},{x:l.Eo.right(s),y:l.Eo.bottom(s)}));c.forEach(w=>{const b=l.Color.z.safeParse(w.color);if(!b.success)return;const v=b.data;let E=u.pos(Number(w.timeRange.start.valueOf()));const M=u.pos(Number(w.timeRange.end.valueOf()));if(M<l.Eo.left(s)||E>l.Eo.right(s))return;E=l.Y(E,l.Eo.left(s)-2,l.Eo.right(s)-1);let D=!1;f!=null&&(D=l.H.contains({lower:E,upper:M},f)),D&&(g={key:w.key,name:w.name,color:w.color,timeRange:w.timeRange,viewport:{lower:r.scale(l.Eo.xBounds(i)).pos(Number(w.timeRange.start.valueOf())),upper:r.scale(l.Eo.xBounds(i)).pos(Number(w.timeRange.end.valueOf()))}}),o.container({region:l.Eo.construct({x:E,y:l.Eo.top(s)-1},{x:M,y:l.Eo.bottom(s)-1}),backgroundColor:v.setAlpha(.2),bordered:!1});const P=l.Eo.construct({x:E+1,y:l.Eo.top(s)-34},{x:M-1,y:l.Eo.top(s)-12});o.container({region:P,backgroundColor:l.Eo.width(P)<20?v.setAlpha(.4):z=>D?z.colors.gray.l2:z.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:v.setAlpha(.8)}),o.text({text:w.name,position:{x:E+8,y:l.Eo.top(s)-30},level:"small",shade:8,weight:500,maxWidth:M-E-16})}),m(),g!=null?this.setState(w=>({...w,hovered:g})):this.state.hovered&&this.setState(w=>({...w,hovered:null}))}}h(ke,"TYPE","range-provider");const gu={[dn.TYPE]:dn,[ke.TYPE]:ke},mu=Le;class Re extends Yi{constructor(){super(...arguments);h(this,"schema",Le)}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(this.renderAxis(t,r.reverse()),await this.renderYAxes(t,r),await this.renderRangeAnnotations(t,r),s!=null)throw s}async findByXDecimal(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;return await this.findByXValue(t,s.reverse().pos(r))}async findByXValue(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;const a={...t,xDataToDecimalScale:s},o=this.yAxes.map(async c=>await c.findByXValue(a,r));return(await Promise.all(o)).flat()}async renderYAxes(t,r){const s={...t,xDataToDecimalScale:r};await Promise.all(this.yAxes.map(async i=>await i.render(s)))}get yAxes(){return this.childrenOfType(be.TYPE)}get rangeAnnotations(){return this.childrenOfType(ke.TYPE)}async renderRangeAnnotations(t,r){const[s,i]=await this.bounds(t.hold,this.dataBounds.bind(this));if(i!=null)throw i;await Promise.all(this.rangeAnnotations.map(async a=>await a.render({dataToDecimalScale:r,region:t.plot,viewport:t.viewport,timeRange:new d.E(s.lower,s.upper)})))}async dataBounds(){return await Promise.all(this.yAxes.map(async t=>await t.xBounds()))}}h(Re,"TYPE","XAxis");const ra=p.z.object({container:l.Eo.box,viewport:l.Eo.box,hold:p.z.boolean().optional().default(!1),grid:p.z.record(oi),visible:p.z.boolean().optional().default(!0),clearOverScan:l.G.crudeZ.optional().default(l.G.ZERO)}),yu=(e,n)=>{const t=l.Eo.width(e)*Math.sqrt(l.Eo.height(e)),r=l.Eo.width(n)*Math.sqrt(l.Eo.height(n));return t/r};class vn extends d.Composite{constructor(){super(...arguments);h(this,"schema",ra)}async afterUpdate(){this.internal.instrumentation=De(this.ctx,"lineplot"),this.internal.aggregate=d.useAggregate(this.ctx),this.internal.renderCtx=d.Context.use(this.ctx),Z.control(this.ctx,t=>this.requestRender("low",t)),this.requestRender("high",K)}async afterDelete(){this.internal.renderCtx=d.Context.use(this.ctx),this.requestRender("high",K)}async findByXDecimal(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXDecimal(r,t));return(await Promise.all(s)).flat()}async findByXValue(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXValue(r,t));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(Re.TYPE)}get tooltips(){return this.childrenOfType(_t.TYPE)}get measures(){return this.childrenOfType(Ht.TYPE)}get exposure(){return yu(this.state.viewport,this.state.container)}async renderAxes(t,r){const s={...this.state,plot:t,canvases:r,exposure:this.exposure};await Promise.all(this.axes.map(async i=>await i.render(s)))}async renderTooltips(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:t,canvases:r};await Promise.all(this.tooltips.map(async i=>await i.render(s)))}async renderMeasures(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:t,canvases:r};await Promise.all(this.measures.map(async i=>await i.render(s)))}calculatePlot(){return eo(this.state.grid,this.state.container)}async render(t){const{renderCtx:r}=this.internal,{instrumentation:s}=this.internal;if(this.deleted){s.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return s.L.debug("not visible, skipping render",{key:this.key}),async({canvases:f})=>r.erase(this.state.container,this.state.clearOverScan,...f);const i=this.calculatePlot();s.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:i,canvases:t});const a=l.G.construct(this.state.clearOverScan),o=r.scissor(this.state.container,a,t.filter(f=>f!=="gl")),c=r.scissor(i,l.G.ZERO,t.filter(f=>f==="gl"));try{await this.renderAxes(i,t),await this.renderTooltips(i,t),await this.renderMeasures(i,t),r.gl.finish(),r.gl.flush(),r.gl.finish()}catch(f){if(f.message.toLowerCase().includes("bigint"))return;this.internal.aggregate({key:`${this.type}-${this.key}`,variant:"error",message:f.message})}finally{o(),c()}s.L.debug("rendered",{key:this.key});const u=l.Eo.copy(this.state.container);return async({canvases:f})=>r.erase(u,this.state.clearOverScan,...f)}requestRender(t,r){const{renderCtx:s}=this.internal;let i=["upper2d","lower2d","gl"];r===et&&(i=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(i),priority:t,canvases:i})}}h(vn,"TYPE","LinePlot");const xu={[vn.TYPE]:vn,[Re.TYPE]:Re,[be.TYPE]:be};exports.AcquireChannelControl=Se;exports.Annotation=dn;exports.AuthoritySource=Ee;exports.BaseProvider=$t;exports.Button=yn;exports.Canvas=ki;exports.Canvas$1=Ce;exports.Chip=fn;exports.Controller=Z;exports.Controller$1=pn;exports.Diagram=nu;exports.Diagram$1=Ft;exports.Indicator=gn;exports.Legend=mn;exports.Light=xn;exports.Line=we;exports.LinePlot=vn;exports.Log=Pe;exports.Measure=Ht;exports.Provider=_e;exports.Provider$1=ke;exports.Provider$2=_n;exports.REASON_DATA=Bn;exports.REASON_LAYOUT=K;exports.REASON_TOOL=et;exports.REGISTRY=Na;exports.REGISTRY$1=tu;exports.REGISTRY$10=Oi;exports.REGISTRY$11=cu;exports.REGISTRY$12=gs;exports.REGISTRY$13=ai;exports.REGISTRY$14=uu;exports.REGISTRY$15=Xi;exports.REGISTRY$16=ea;exports.REGISTRY$17=ou;exports.REGISTRY$18=Vc;exports.REGISTRY$2=ji;exports.REGISTRY$3=Jc;exports.REGISTRY$4=Wi;exports.REGISTRY$5=ru;exports.REGISTRY$6=Ic;exports.REGISTRY$7=xu;exports.REGISTRY$8=Qi;exports.REGISTRY$9=gu;exports.Rule=Gt;exports.STATUSES=Ni;exports.SetChannelValue=Te;exports.Setpoint=wn;exports.StateProvider=Bt;exports.Table=ve;exports.Toggle=bn;exports.Tooltip=_t;exports.Value=qt;exports.XAxis=Re;exports.YAxis=be;exports.ZERO_CONTEXT_VALUE=Jn;exports.acquireChannelControl=Kc;exports.acquireChannelControlPropsZ=Bi;exports.aether=Hc;exports.annotationStateZ=Ai;exports.authoritySource=Qc;exports.authoritySourceProps=Fi;exports.axisStateZ=Mr;exports.buttonStateZ=qi;exports.canvas=eu;exports.canvasStateZ=zr;exports.channelData=As;exports.chipStateZ=Li;exports.color=Zt;exports.colorGradient=Ks;exports.controllerStateZ=Ii;exports.coreAxisStateZ=Le;exports.diagramStateZ=Dr;exports.external=Ja;exports.indicatorStateZ=_i;exports.interpolateNumber=xe;exports.interpolateRgb=Wn;exports.interpolateString=di;exports.legendStateZ=Hi;exports.lightStateZ=Vi;exports.linePlotStateZ=ra;exports.logState=Ki;exports.measure=lu;exports.measureStateZ=Ar;exports.newTickFactory=Kn;exports.parseAutoBounds=zi;exports.provider=ba;exports.providerStateZ=na;exports.providerStateZ$1=ni;exports.providerStateZ$2=mr;exports.regions=ut;exports.rollingAverage=Vs;exports.rollingAverageProps=gr;exports.ruleStateZ=Yr;exports.scaleNumber=Js;exports.setChannelValue=Xc;exports.setChannelValuePropsZ=Gi;exports.setpoint=_s;exports.setpointStateZ=Ji;exports.sinkPipeline=Ds;exports.sinkPipelinePropsZ=cr;exports.sourcePipeline=zs;exports.sourcePipelinePropsZ=lr;exports.stateProviderStateZ=$i;exports.stateZ=Di;exports.statusZ=Ui;exports.streamChannelData=Ls;exports.streamChannelValue=$s;exports.streamChannelValuePropsZ=ur;exports.stringSourceSpecZ=ar;exports.stringifyNumber=Ws;exports.stringifyNumberProps=pr;exports.sugaredStateZ=Zi;exports.tickFactoryProps=Rr;exports.tickType=kr;exports.toggleStateZ=ta;exports.tooltip=su;exports.tooltipStateZ=Or;exports.value=fu;exports.withinBounds=Hs;exports.withinBoundsProps=fr;exports.withinSizeThreshold=Ri;exports.xAxisStateZ=mu;exports.yAxisStateZ=qc;
|
|
24
|
+
`,hs=d.g.FLOAT32.density.valueOf(),Di=p.z.object({x:Je,y:Je,label:p.z.string().optional(),color:l.Color.z,strokeWidth:p.z.number().default(1),downsample:p.z.number().min(1).max(50).optional().default(1)}),Dc=(e,n,t)=>e===-1||n===-1||e>=t.length?NaN:Number(t[e].at(n)),Oc=d.w$1.milliseconds(2);l.G.NAN,l.G.NAN,l.ZERO;const Et=class Et extends d.GLProgram{constructor(t){super(t,zc,Yc);h(this,"translationBufferCache",new Map);this.translationBufferCache=new Map}bindState({strokeWidth:t,color:r}){return this.uniformColor("u_color",r),this.attrStrokeWidth(t)}bindScale(t,r){const s=l.G.scale(t.scale,r.scale),i=l.G.translate(l.G.scale(r.scale,t.offset),r.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",i)}draw({x:t,y:r,count:s,downsample:i,xOffset:a,yOffset:o},c){const{gl:u}=this.ctx;this.bindAttrBuffer("x",t.glBuffer,i,a),this.bindAttrBuffer("y",r.glBuffer,i,o),u.drawArraysInstanced(u.LINE_STRIP,0,s/i,c)}static create(t){const r=d.Context.use(t),s=new Et(r);return t.set(Et.CONTEXT_KEY,s),s}static use(t){return t.get(Et.CONTEXT_KEY)}bindAttrBuffer(t,r,s,i=0){const{gl:a}=this.ctx;a.bindBuffer(a.ARRAY_BUFFER,r);const o=a.getAttribLocation(this.prog,`a_${t}`);a.vertexAttribPointer(o,1,a.FLOAT,!1,hs*s,hs*i),a.enableVertexAttribArray(o)}getAndBindTranslationBuffer(t){const{gl:r}=this.ctx,s=`${this.ctx.aspect}:${t}`,i=this.translationBufferCache.get(s);if(i!=null)return r.bindBuffer(r.ARRAY_BUFFER,i.glBuffer),i;const a=r.createBuffer();if(a==null)throw new d.Re("Failed to create buffer from WebGL context");const o=Lc(this.ctx.aspect,t);r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW);const c={glBuffer:a,jsBuffer:o};return this.translationBufferCache.set(s,c),c}attrStrokeWidth(t){const{gl:r}=this.ctx,{jsBuffer:s}=this.getAndBindTranslationBuffer(t),i=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.vertexAttribDivisor(i,1),s.length/2}};h(Et,"CONTEXT_KEY","pluto-line-gl-program");let hn=Et;class we extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Di)}async afterUpdate(){var r,s;if(this.deleted)return;const{internal:t}=this;t.xTelem=await H(this.ctx,this.state.x,t.xTelem),t.yTelem=await H(this.ctx,this.state.y,t.yTelem),t.instrumentation=De(this.ctx,"line"),t.prog=hn.use(this.ctx),t.requestRender=Z.useRequest(this.ctx),(r=t.stopListeningXTelem)==null||r.call(t),(s=t.stopListeningYTelem)==null||s.call(t),t.stopListeningXTelem=t.xTelem.onChange(()=>t.requestRender(Bn)),t.stopListeningYTelem=t.yTelem.onChange(()=>t.requestRender(Bn)),t.requestRender(K)}async afterDelete(){var r,s,i,a;const{internal:t}=this;await((s=(r=t.xTelem).cleanup)==null?void 0:s.call(r)),await((a=(i=t.yTelem).cleanup)==null?void 0:a.call(i)),t.requestRender(K)}async xBounds(){return(await this.internal.xTelem.value())[0]}async yBounds(){return(await this.internal.yTelem.value())[0]}async findByXValue(t,r){const{xTelem:s,yTelem:i}=this.internal,[,a]=await s.value();let[o,c]=[-1,-1];a.find((M,D)=>{const P=M.binarySearch(r),z=P>=0&&P<M.length;return z&&([o,c]=[P,D]),z});const{key:u}=this,{color:f,label:g}=this.state,m={key:u,color:f,label:g,position:{x:0,y:0},value:{x:NaN,y:NaN}};if(o===-1||c===-1)return m;const w=a[c];m.value.x=Dc(c,o,a);const[,b]=await i.value(),v=b.find(M=>l.H.contains(M.alignmentBounds,w.alignment+BigInt(o)));if(v==null)return m;const E=Number(v.alignment-w.alignment);return m.value.y=Number(v.at(o-E)),m.position={x:t.dataToDecimalScale.x.pos(m.value.x),y:t.dataToDecimalScale.y.pos(m.value.y)},m}async render(t){if(this.deleted)return;const{downsample:r}=this.state,{xTelem:s,yTelem:i,prog:a}=this.internal,{dataToDecimalScale:o,exposure:c}=t,[[,u],[,f]]=await Promise.all([s.value(),i.value()]);u.forEach(v=>v.updateGLBuffer(a.ctx.gl)),f.forEach(v=>v.updateGLBuffer(a.ctx.gl));const g=Gc(u,f,c,r,Oc);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:r,scale:o.transform,props:t.region,ops:Bc(g)}));const m=a.setAsActive(),w=a.bindState(this.state),b=a.ctx.scaleRegion(t.region).transform;g.forEach(v=>{const E=Uc(o,v).transform;a.bindScale(E,b),a.draw(v,w)}),m()}}h(we,"TYPE","line");const Ac=5e3,Lc=(e,n)=>Nc(Zc(e),n).map((t,r)=>Math.floor(r/$c)*(1/(Ac*e))*t),$c=5,Zc=e=>new Float32Array([0,0,0,e,0,-e,1,0,-1,0]),Nc=(e,n)=>{const t=new Float32Array(e.length*n);for(let r=0;r<n;r++)t.set(e,r*e.length);return t},Uc=(e,n)=>e.translate(e.x.dim(Number(n.x.sampleOffset)),e.y.dim(Number(n.y.sampleOffset))),Ic={[we.TYPE]:we},Gc=(e,n,t,r,s)=>{if(e.length===0||n.length===0)return[];const i=[];return e.forEach(a=>n.forEach(o=>{if(!Fc(a,o,s))return;let c=0,u=0;a.alignment<o.alignment?c=Number(o.alignment-a.alignment):o.alignment<a.alignment&&(u=Number(a.alignment-o.alignment));const f=Math.min(a.length-c,o.length-u);if(f===0)return;const g=l.Y(Math.round(t*4*f),r,51);i.push({x:a,y:o,xOffset:c,yOffset:u,count:f,downsample:g})})),i},Bc=e=>e.map(n=>({...n,x:n.x.digest,y:n.y.digest})),Fc=(e,n,t)=>{if(!(e._timeRange!=null&&n._timeRange!=null))throw new d.Re(`Encountered series without time range in buildDrawOperations. X series present: ${e._timeRange!=null}, Y series present: ${n._timeRange!=null}`);const s=e.timeRange.overlapsWith(n.timeRange,t),i=l.H.overlapsWith(e.alignmentBounds,n.alignmentBounds);return s&&i};class jt{constructor(n,t){h(this,"canvas");h(this,"theme");this.canvas=n,this.theme=t}rule({direction:n,region:t,position:r,...s}){return n==="x"?this.line({start:l.G.construct(l.Eo.left(t),r),end:l.G.construct(l.Eo.right(t),r),...s}):this.line({start:l.G.construct(r,l.Eo.top(t)),end:l.G.construct(r,l.Eo.bottom(t)),...s})}line({stroke:n,lineWidth:t,lineDash:r,start:s,end:i}){const a=this.canvas;a.strokeStyle=n.hex,a.lineWidth=t,a.setLineDash([r]),a.beginPath(),a.moveTo(...l.G.couple(s)),a.lineTo(...l.G.couple(i)),a.stroke()}circle({fill:n,radius:t,position:r}){const s=this.canvas;s.fillStyle=n.hex,s.beginPath(),s.arc(...l.G.couple(r),t,0,2*Math.PI),s.fill()}resolveColor(n,t){return n==null?this.resolveColor(t):typeof n=="function"?n(this.theme):new l.Color(n)}border({region:n,color:t,width:r,radius:s,location:i}){const a=this.canvas;a.strokeStyle=this.resolveColor(t,this.theme.colors.border).hex,a.lineWidth=r??this.theme.sizes.border.width,s??(s=this.theme.sizes.border.radius),i==null||i===!0?s>0?(a.roundRect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n)),s),a.stroke()):(a.rect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n))),a.stroke()):d.A(i).forEach(o=>{const[c,u]=l.Eo.edgePoints(n,o);a.beginPath(),a.moveTo(...l.G.couple(c)),a.lineTo(...l.G.couple(u)),a.stroke()})}container({region:n,bordered:t=!0,rounded:r=!0,borderColor:s,borderRadius:i,borderWidth:a,backgroundColor:o}){i??(i=this.theme.sizes.border.radius),a??(a=1);const c=this.canvas;c.fillStyle=this.resolveColor(o,this.theme.colors.gray.l1).hex,c.strokeStyle=this.resolveColor(s,this.theme.colors.border).hex,c.setLineDash([]),c.lineWidth=1,c.beginPath(),r?c.roundRect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n)),i):c.rect(...l.G.couple(l.Eo.topLeft(n)),...l.G.couple(l.Eo.dims(n))),c.fill(),t&&this.border({region:n,color:s,radius:i,width:a,location:t})}textContainer(n){const[t,r]=this.spacedTextDrawF(n);t.width+=12,t.height+=12;const{root:s=l.K.TOP_LEFT,offset:i=l.G.ZERO}=n,a={...n.position};s.x==="right"?a.x-=t.width+i.x:a.x+=i.x,s.y==="bottom"?a.y-=t.height+i.y:a.y+=i.y,this.container({region:l.Eo.construct(a,t.width,t.height),...n}),this.canvas.filter="none",r(l.G.translate(a,[6,6]))}spacedTextDrawF({text:n,direction:t,spacing:r=1,level:s="p"}){const i=d.fontString(this.theme,{level:s}),a=n.map(u=>d.dimensions(u,i,this.canvas)),o=this.theme.sizes.base*r,c=Math.max(...a.map(u=>u[l.g.dimension(t)]))+o;return[{[l.g.dimension(l.g.swap(t))]:Math.max(...a.map(u=>u[l.g.dimension(l.g.swap(t))])),[l.g.dimension(t)]:c*n.length-o},u=>{const f=d.fontString(this.theme,{level:s});this.canvas.font=f,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",n.forEach((g,m)=>{this.canvas.fillText(g,u.x,u.y+c*m)})}]}drawTextInCenter({box:n,text:t,level:r}){const s=d.dimensions(t,this.canvas.font,this.canvas),i=l.Eo.positionInCenter(l.Eo.construct(l.G.ZERO,s),n);return this.text({text:t,position:l.Eo.topLeft(i),level:r})}text({text:n,position:t,level:r="p",weight:s,shade:i,maxWidth:a,code:o}){this.canvas.font=d.fontString(this.theme,{level:r,weight:s,code:o}),i==null?this.canvas.fillStyle=this.theme.colors.text.hex:this.canvas.fillStyle=this.theme.colors.gray[`l${i}`].hex,this.canvas.textBaseline="top";let c;a!=null&&(c=this.canvas.scissor(l.Eo.construct(t,a,1e3))),this.canvas.fillText(n,t.x,t.y),c==null||c()}}const Yr=p.z.object({position:p.z.number().optional(),pixelPosition:p.z.number().optional(),dragging:p.z.boolean(),lineWidth:p.z.number().optional().default(1),lineDash:p.z.number().optional().default(20),color:l.Color.z}),_c=3;class Gt extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Yr);h(this,"lastUpdateRef",null)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx);const t=d.use(this.ctx);this.internal.draw=new jt(this.internal.renderCtx.upper2d,t),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,et)}updatePositions({decimalToDataScale:t,plot:r,container:s}){const i=this.state.dragging,a=this.prevState.dragging&&!i;if((i||a)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??(this.lastUpdateRef=this.state.pixelPosition),Math.abs(this.state.pixelPosition-this.lastUpdateRef)<_c&&!a)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const u=t.pos(this.state.pixelPosition/l.Eo.height(r));return this.setState(f=>({...f,position:u})),this.state.pixelPosition}if(this.state.position==null){const c=t.pos(.5);this.setState(u=>({...u,position:c}))}const o=t.reverse().pos(this.state.position)*l.Eo.height(r);if(!isNaN(o)){if(this.state.pixelPosition!=null&&Math.abs(o-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(c=>({...c,pixelPosition:o}))}return o}async render(t){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:i}=t,a=l.K.direction(s),{upper2d:o}=r,c=this.internal.draw,u=this.updatePositions(t)+l.Eo.top(t.plot);c.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:a,region:i,position:u}),o.fillStyle=this.state.color.hex,o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const f=4;if(s==="left"){const g=l.Eo.left(i)-1;o.moveTo(g,u),o.lineTo(g-f,u-f),o.lineTo(g-f,u+f)}else s==="right"&&(o.moveTo(l.Eo.right(i),u),o.lineTo(l.Eo.right(i)+f,u-f),o.lineTo(l.Eo.right(i)+f,u+f));o.closePath(),o.stroke()}}h(Gt,"TYPE","Rule");const Oi={[Gt.TYPE]:Gt},Hc=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Oi,Rule:Gt,ruleStateZ:Yr},Symbol.toStringTag,{value:"Module"})),qc=Le.extend({location:l.K.x.optional().default("left")}),ds=2,jc=e=>l.Eo.signedWidth(e)<ds||l.Eo.signedHeight(e)<ds;class be extends Yi{constructor(){super(...arguments);h(this,"schema",Le)}async xBounds(){return l.H.max((await Promise.all(this.lines.map(async t=>await t.xBounds()))).filter(t=>l.H.isFinite(t)))}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport),i=r.invert().reverse();if(this.renderAxis(t,i),await this.renderLines(t,r),await this.renderRules(t,i),s!=null)throw s}async renderLines({xDataToDecimalScale:t,plot:r,canvases:s,exposure:i},a){if(!s.includes("gl")||jc(r))return;const o={region:r,dataToDecimalScale:new l.b.XY(t,a),exposure:i};await Promise.all(this.lines.map(async c=>await c.render(o)))}async renderRules({container:t,plot:r,canvases:s},i){if(!s.includes("upper2d"))return;const{location:a}=this.state,{render:o}=this.internal,c=l.Eo.construct(l.Eo.left(t),l.Eo.top(r),l.Eo.width(t),l.Eo.height(r)),u=o.scissor(c,l.G.ZERO,["upper2d"]),f={container:t,plot:r,decimalToDataScale:i,location:a};await Promise.all(this.rules.map(async g=>await g.render(f))),u()}async findByXValue({xDataToDecimalScale:t,plot:r,viewport:s,hold:i,exposure:a},o){const[c,u]=await this.dataToDecimalScale(i,this.dataBounds.bind(this),s);if(u!=null)throw u;const f=new l.b.XY(t,c),g={region:r,dataToDecimalScale:f,exposure:a};return(await Promise.all(this.lines.map(async m=>await m.findByXValue(g,o)))).map(m=>({...m,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async t=>await t.yBounds()))}get lines(){return this.childrenOfType(we.TYPE)}get rules(){return this.childrenOfType(Gt.TYPE)}}h(be,"TYPE","YAxis");const Ai=p.z.object({start:d.m.z,end:d.m.z});class dn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ai)}async afterUpdate(){this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,d.use(this.ctx))}async render(){}}h(dn,"TYPE","range-annotation");const Wc=p.z.object({region:l.Eo.box,clearOverScan:l.G.crudeZ.optional().default(0),visible:p.z.boolean().optional().default(!0)}),In=["upper2d","lower2d"],Ct=class Ct extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ct.stateZ)}async afterUpdate(){const{internal:t}=this;t.renderCtx=d.Context.use(this.ctx),Z.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){const t=l.Eo.copy(this.state.region);if(!this.state.visible)return async()=>this.internal.renderCtx.erase(this.state.region,this.state.clearOverScan,...In);const{renderCtx:r}=this.internal,s=l.b.XY.translate(l.Eo.topLeft(this.state.region)),i=r.scissor(this.state.region,l.G.construct(this.state.clearOverScan),In);try{for(const a of this.children)await a.render({viewportScale:s})}catch(a){console.error(a)}finally{i()}return async()=>{this.internal.renderCtx.erase(t,this.state.clearOverScan)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Ct.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:In})}};h(Ct,"TYPE","Table"),h(Ct,"stateZ",Wc);let ve=Ct;const Vc={[ve.TYPE]:ve},Li=p.z.object({triggered:p.z.boolean(),status:d.specZ$1,sink:Pn.optional().default(Sn),source:ir.optional().default(nr)});class fn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Li)}async afterUpdate(){var s,i,a;const{sink:t,source:r}=this.state;this.internal.source=await H(this.ctx,r,this.internal.source),this.internal.sink=await Ye(this.ctx,t,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&this.internal.sink.set(((s=this.state.status.data)==null?void 0:s.authority)!==d.wp.Absolute.valueOf()).catch(console.error),await this.updateEnabledState(),(a=(i=this.internal).stopListening)==null||a.call(i),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})}async updateEnabledState(){const t=await this.internal.source.value();t.time.equals(this.state.status.time)||this.setState(r=>({...r,status:t,triggered:!1}))}async afterDelete(){this.asyncAfterDelete().catch(console.error)}async asyncAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}render(){}}h(fn,"TYPE","Chip");const $i=p.z.object({}),fs="control-state-provider",Zi=d.Fg.stateZ.extend({subjectColor:l.Color.z});class Bt extends d.Composite{constructor(){super(...arguments);h(this,"schema",$i);h(this,"colors",new Map);h(this,"tracker");h(this,"disconnectTrackerChange");h(this,"obs",new Qn.Observer)}static use(t){return t.get(fs)}async afterUpdate(){const{internal:t}=this;t.instrumentation=De(this.ctx,"control-state");const r=d.use(this.ctx);t.palette=r.colors.visualization.palettes.default,t.defaultColor=r.colors.gray.l6;const s=Me(this.ctx);t.client!=null&&s===t.client||(t.client=s,this.ctx.set(fs,this),await this.maybeCloseTracker(),t.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(t.client)))}async maybeCloseTracker(){var t;this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),(t=this.disconnectTrackerChange)==null||t.call(this),await this.tracker.close(),this.tracker=void 0)}async afterDelete(){await this.maybeCloseTracker()}onChange(t){return this.obs.onChange(t)}get(t){return Array.isArray(t)?d.n(t).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(t)}getOne(t){if(this.tracker==null)return;const r=this.tracker.states.get(t);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async openTracker(t){var i;const{internal:r}=this,{instrumentation:s}=r;try{this.tracker=await t.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}(i=this.disconnectTrackerChange)==null||i.call(this),this.disconnectTrackerChange=this.tracker.onChange(a=>{if(s.L.debug("transfer",{transfers:a.map(o=>d.Fg.transferString(o))}),this.tracker==null)throw new d.Re("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(a)})}updateColors(t){const r=t.subjects(),s=r.map(o=>o.key),i=Array.from(this.colors.values());this.colors.forEach((o,c)=>!s.includes(c)&&this.colors.delete(c));const{palette:a}=this.internal;r.forEach(o=>{if(this.colors.has(o.key))return;const c=a.find(u=>!i.includes(u))??a[0];this.colors.set(o.key,c),i.push(c)})}}h(Bt,"TYPE","StateProvider");const Ni=["acquired","released","overridden","failed"],Ui=p.z.enum(Ni),Ii=p.z.object({name:p.z.string(),authority:p.z.number().default(0),acquireTrigger:p.z.number(),status:Ui.optional(),needsControlOf:d.Ug.keyZ.array().optional().default([])});class pn extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ii);h(this,"registry",new Map);h(this,"writer")}async afterUpdate(){this.internal.instrumentation=De(this.ctx),(this.internal.prevTrigger==null||Math.abs(this.state.acquireTrigger-this.internal.prevTrigger)>1)&&(this.internal.prevTrigger=this.state.acquireTrigger);const t=Me(this.ctx),r=Bt.use(this.ctx);this.internal.client=t,this.internal.client==null&&await this.release(),this.internal.stateProv=r,xs(this.ctx,this),this.internal.addStatus=d.useAggregate(this.ctx),this.state.acquireTrigger>this.internal.prevTrigger?(this.acquire(),this.internal.prevTrigger=this.state.acquireTrigger):this.state.acquireTrigger<this.internal.prevTrigger&&(this.release(),this.internal.prevTrigger=this.state.acquireTrigger)}async afterDelete(){await this.release()}async updateNeedsControlOf(){const{client:t}=this.internal;if(t==null)return;const r=new Set([]);for(const i of this.registry.keys())(await i.needsControlOf(t)).forEach(o=>o!==0&&r.add(o));const s=Array.from(r);d.F.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==d.F.EQUAL&&this.setState(i=>({...i,needsControlOf:s}))}async acquire(){const{client:t,addStatus:r}=this.internal;if(t==null)return r({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return r({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});this.writer=await t.openWriter({start:d.k.now(),channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(i=>({...i,status:"acquired"}))}catch(s){this.setState(i=>({...i,status:"failed"})),r({message:`${this.state.name} failed to acquire control: ${s.message}`,variant:"error"})}}async release(){var t;try{await((t=this.writer)==null?void 0:t.close()),this.setState(r=>({...r,status:"released"}))}catch(r){this.internal.addStatus({message:`${this.state.name} failed to release control: ${r.message}`,variant:"error"})}finally{this.writer=void 0}}async set(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(t))}async setAuthority(t,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(t.map(i=>[i,r]))))}async releaseAuthority(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(t.map(s=>[s,this.state.authority]))))}deleteTelem(t){this.registry.delete(t),this.updateNeedsControlOf()}create(t){const s=(()=>{switch(t.type){case Te.TYPE:{const i=new Te(this,t.props);return this.registry.set(i,null),i}case Ee.TYPE:{const i=new Ee(this,this.internal.stateProv,t.props);return this.registry.set(i,null),i}case Se.TYPE:return new Se(this,t.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}h(pn,"TYPE","Controller");const Gi=p.z.object({channel:p.z.number()});class Te extends Rn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Gi);this.controller=t}invalidate(){}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){if(this.props.channel===0)return[];const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),i={[s.key]:t};if(s.index!==0){const a=await r.channels.retrieve(s.index);i[a.key]=d.k.now()}await this.controller.set(i)}}h(Te,"TYPE","controlled-numeric-telem-sink");const Xc=e=>({type:Te.TYPE,props:e,variant:"sink",valueType:"number"}),Bi=p.z.object({authority:p.z.number().default(d.Fg.Authority.Absolute.valueOf()),channel:p.z.number()});class Se extends Rn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Bi);this.controller=t}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const i=await s.channels.retrieve(this.props.channel),a=[i.key];i.index!==0&&a.push(i.index),t?await this.controller.setAuthority(a,this.props.authority):await this.controller.releaseAuthority(a)}}h(Se,"TYPE","acquire-channel-control");const Kc=e=>({type:Se.TYPE,props:e,variant:"sink",valueType:"boolean"}),Fi=p.z.object({channel:p.z.number()});class Ee extends F{constructor(t,r,s){super(s);h(this,"prov");h(this,"valid",!1);h(this,"stopListening");h(this,"controller");h(this,"schema",Fi);this.prov=r,this.controller=t}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:t}=this.props;(s=this.stopListening)==null||s.call(this);const r=d.Q.filterTransfersByChannelKey(t);this.stopListening=this.prov.onChange(i=>{var a;r(i).length!==0&&((a=this.notify)==null||a.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const t=d.k.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:t,data:{valid:!1,authority:0}};const r=this.prov.get(this.props.channel);return r==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:t,data:{valid:!0,color:void 0,authority:0}}:{key:r.subject.key,variant:r.subject.key===this.controller.key?"success":"error",message:`Controlled by ${r.subject.name}`,time:t,data:{valid:!0,color:r.subjectColor,authority:r.authority}}}async cleanup(){var t;this.controller.deleteTelem(this),(t=this.stopListening)==null||t.call(this)}}h(Ee,"TYPE","controlled-status-source");const Qc=e=>({type:Ee.TYPE,props:e,variant:"source",valueType:"status"}),_i=p.z.object({statusSource:ir.optional().default(nr),colorSource:sr.optional().default(En),status:d.specZ$1,color:l.Color.z.optional()});class gn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",_i);h(this,"stopListeningStatus");h(this,"stopListeningColor")}async afterUpdate(){var r,s;const{internal:t}=this;t.statusSource=await H(this.ctx,this.state.statusSource,t.statusSource),t.colorSource=await H(this.ctx,this.state.colorSource,t.colorSource),await this.updateState(),(r=this.stopListeningStatus)==null||r.call(this),this.stopListeningStatus=t.statusSource.onChange(()=>{this.updateState()}),(s=this.stopListeningColor)==null||s.call(this),this.stopListeningColor=t.colorSource.onChange(()=>{this.updateState()})}async afterDelete(){this.internalAfterDelete().catch(console.error)}async internalAfterDelete(){var t,r,s,i;await((r=(t=this.internal.statusSource).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.colorSource).cleanup)==null?void 0:i.call(s))}async render(){}async updateState(){const t=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();t.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:t,status:r}))}}h(gn,"TYPE","Indicator");const Hi=p.z.object({needsControlOf:d.Ug.keyZ.array(),states:Zi.array()});class mn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Hi)}async afterUpdate(){var a;const{internal:t}=this;t.stateProv=Bt.use(this.ctx);const r=this.state.needsControlOf;(a=t.disconnectStateProv)==null||a.call(t);const s=d.Q.filterTransfersByChannelKey(...r),i=t.stateProv.get(r);this.setState(o=>({...o,states:i})),t.disconnectStateProv=t.stateProv.onChange(o=>{if(s(o).length===0)return;const c=t.stateProv.get(r);this.setState(u=>({...u,states:c}))})}async afterDelete(){var r;const{internal:t}=this;(r=t.disconnectStateProv)==null||r.call(t)}async render(){}}h(mn,"TYPE","Legend");const Jc={[pn.TYPE]:pn,[Bt.TYPE]:Bt,[gn.TYPE]:gn,[fn.TYPE]:fn,[mn.TYPE]:mn},qi=p.z.object({trigger:p.z.number(),sink:Pn.optional().default(Sn)});class yn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",qi)}async afterUpdate(){var s;const{sink:t}=this.state;(s=this.internal).prevTrigger??(s.prevTrigger=this.state.trigger),this.internal.sink=await Ye(this.ctx,t,this.internal.sink);const r=this.internal.prevTrigger;this.internal.prevTrigger=this.state.trigger,!(this.state.trigger<=r)&&this.internal.sink.set(!0).catch(console.error)}render(){}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var r,s;const{internal:t}=this;await((s=(r=t.sink).cleanup)==null?void 0:s.call(r))}}h(yn,"TYPE","Button");const tu={[yn.TYPE]:yn},zr=p.z.object({dpr:p.z.number(),region:l.Eo.box,bootstrap:p.z.boolean().optional().default(!1),bootstrapped:p.z.boolean().optional().default(!1),glCanvas:p.z.any().optional(),upper2dCanvas:p.z.any().optional(),lower2dCanvas:p.z.any().optional(),os:d.w.osZ});class Ce extends d.Composite{constructor(){super(...arguments);h(this,"schema",zr);h(this,"renderContextSet",!1)}async afterUpdate(){let t=d.Context.useOptional(this.ctx);if(t==null){if(this.renderContextSet)throw new d.Re("[vis.worker.Canvas] - expected render context to be set");if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:i,os:a}=this.state;if(r==null||s==null||i==null)throw new d.Re("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");t=d.Context.create(this.ctx,r,s,i,a),hn.create(this.ctx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else t.update(this.ctx);t.resize(this.state.region,this.state.dpr)}}h(Ce,"TYPE","Canvas");const ji={[Ce.TYPE]:Ce},eu=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Ce,REGISTRY:ji,canvasStateZ:zr},Symbol.toStringTag,{value:"Module"})),Dr=p.z.object({position:l.G.xy,zoom:p.z.number(),region:l.Eo.box,clearOverScan:l.G.crudeZ.optional().default(10),visible:p.z.boolean().optional().default(!0)}),Ge=["upper2d","lower2d"],Pt=class Pt extends d.Composite{constructor(){super(...arguments);h(this,"schema",Pt.stateZ)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx),this.internal.addStatus=d.useAggregate(this.ctx),Z.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const{renderCtx:t,addStatus:r}=this.internal,{zoom:s,position:i}=this.state,a=l.Eo.construct(this.state.region);if(!this.state.visible)return async()=>t.erase(a,this.state.clearOverScan,...Ge);const o=t.scissor(a,l.G.ZERO,Ge),c=l.b.XY.magnify(l.G.construct(s)).translate(l.Eo.topLeft(a)).translate(i);try{await Promise.all(this.children.map(async f=>await f.render({viewportScale:c})))}catch(f){r({variant:"error",message:f.message})}finally{o()}const u=l.Eo.copy(this.state.region);return async()=>{this.internal.renderCtx.erase(u,this.state.clearOverScan,...Ge)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Pt.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Ge})}};h(Pt,"TYPE","Diagram"),h(Pt,"stateZ",Dr);let Ft=Pt;const Wi={[Ft.TYPE]:Ft},nu=Object.freeze(Object.defineProperty({__proto__:null,Diagram:Ft,REGISTRY:Wi,diagramStateZ:Dr},Symbol.toStringTag,{value:"Module"})),Vi=p.z.object({enabled:p.z.boolean(),source:rr.optional().default(er)});class xn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Vi)}async afterUpdate(){var s;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{source:t}=this.state,{internal:r}=this;this.internal.source=await H(this.ctx,t,this.internal.source),await this.updateEnabledState(),(s=r.stopListening)==null||s.call(r),r.stopListening=r.source.onChange(()=>this.updateEnabledState().catch(this.reportError.bind(this)))}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Light: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t))}async render(){}}h(xn,"TYPE","Light");const ru={[xn.TYPE]:xn},Or=p.z.object({position:l.G.xy.or(p.z.null()),textColor:l.Color.z.optional().default(l.ZERO),backgroundColor:l.Color.z.optional().default(l.ZERO),borderColor:l.Color.z.optional().default(l.ZERO),ruleColor:l.Color.z.optional().default(l.ZERO),ruleStrokeWidth:p.z.number().optional().default(1),ruleStrokeDash:p.z.number().default(0)});class _t extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Or)}async afterUpdate(){const t=d.use(this.ctx);this.state.textColor.isZero&&(this.state.textColor=t.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=t.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=t.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=t.colors.gray.l5),this.internal.dotColor=t.colors.text,this.internal.dotColorContrast=t.colors.textInverted,this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,t),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,et)}async render(t){if(this.deleted||this.state.position==null)return;const{region:r}=t,s=l.b.XY.scale(l.Eo.DECIMAL).scale(r),i=l.b.XY.scale(r).scale(l.Eo.DECIMAL),a=await t.findByXDecimal(i.x.pos(this.state.position.x)),o=a.filter(b=>l.G.isFinite(b.value)),{draw:c}=this.internal,u=o.reduce((b,v)=>b+v.position.x,0)/o.length,f=new d.m(o.reduce((b,v)=>b+v.value.x,0)/o.length),g=s.x.pos(u);if(!l.H.contains(l.Eo.xBounds(r),g))return;c.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:g}),o.forEach(b=>{const v=s.pos(b.position);c.circle({fill:b.color.setAlpha(.5),radius:8,position:v}),c.circle({fill:b.color.setAlpha(.8),radius:5,position:v}),c.circle({fill:b.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:v})});const m=a.map(b=>`${b.label??""}: ${b.value.y.toFixed(2)}`);m.unshift(`Time: ${f.fString("preciseDate","local")}`);const w=i.pos(this.state.position);c.textContainer({text:m,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:this.state.position,direction:"y",level:"small",spacing:.5,offset:{x:12,y:12},root:{x:w.x>.8?"right":"left",y:w.y>.8?"top":"bottom"}})}}h(_t,"TYPE","tooltip");const Xi={[_t.TYPE]:_t},su=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Xi,Tooltip:_t,tooltipStateZ:Or},Symbol.toStringTag,{value:"Module"})),Ki=p.z.object({region:l.Eo.box,wheelPos:p.z.number(),scrolling:p.z.boolean(),empty:p.z.boolean(),visible:p.z.boolean(),telem:Je.optional().default(Ts),font:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),overshoot:l.G.xy.optional().default({x:0,y:0})}),iu=.98,Kt="lower2d",au={offset:0n,offsetRef:0n,scrollRef:0},ie=class ie extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ie.z);h(this,"values",new d.Dt([]));h(this,"scrollState",au)}async afterUpdate(){var c;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.telem);const{scrolling:r,wheelPos:s}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const u=this.values.alignmentBounds.upper-1n;this.scrollState={offset:u,offsetRef:u,scrollRef:this.state.wheelPos}}else if(r){const{scrollState:u,values:f}=this,g=Math.ceil((s-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(g)),u.offset<f.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=f.alignmentBounds.lower,this.setState(m=>({...m,wheelPos:this.prevState.wheelPos}))),u.offset>=f.alignmentBounds.upper&&this.setState(m=>({...m,scrolling:!1}))}const[a,o]=await this.internal.telem.value();this.values=new d.Dt(o),this.checkEmpty(),(c=t.stopListeningTelem)==null||c.call(t),t.stopListeningTelem=t.telem.onChange(()=>this.internal.telem.value().then(([u,f])=>{this.checkEmpty(),this.values=new d.Dt(f),this.requestRender()})),this.requestRender()}checkEmpty(){const t=this.values.length===0;t!==this.state.empty&&this.setState(r=>({...r,empty:t}))}async afterDelete(){var s;const{telem:t,render:r}=this.internal;await((s=t.cleanup)==null?void 0:s.call(t)),r.erase(l.Eo.construct(this.state.region),l.G.ZERO,Kt)}requestRender(){const{render:t}=this.internal;t.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(),priority:"high",canvases:[Kt]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((l.Eo.height(this.state.region)-12)/this.lineHeight),this.values.length)}async render(){const{render:t}=this.internal,r=this.state.region;if(l.Eo.areaIsZero(r))return;if(!this.state.visible)return async()=>t.erase(r,l.G.ZERO,Kt);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const f=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(f,this.visibleLineCount)}const i=this.state.region,a=t[Kt],o=new jt(a,this.internal.theme),c=t.scissor(i,l.G.ZERO,[Kt]);this.renderElements(o,s),this.renderScrollbar(o),c();const u=l.Eo.copy(this.state.region);return async({canvases:f})=>t.erase(u,this.state.overshoot,...f)}renderScrollbar(t){const r=this.state.region,s=l.Eo.height(r)/this.totalHeight*l.Eo.height(r);if(s>=l.Eo.height(r)*iu)return;let i=l.Eo.bottom(r)-s;this.state.scrolling&&(i-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*l.Eo.height(r)),i<0&&(i=l.Eo.top(r)),t.container({region:l.Eo.construct({x:l.Eo.right(r)-6,y:i},{width:6,height:s}),bordered:!1,backgroundColor:a=>a.colors.gray.l4})}renderElements(t,r){const s=this.state.region;let i=0;for(const a of r){const o=this.values.dataType.equals(d.g.JSON)?JSON.stringify(a):a.toString();t.text({text:o,level:this.state.font,shade:9,position:l.G.translate(l.Eo.topLeft(s),{x:6,y:i*this.lineHeight+6}),code:!0}),i++}}};h(ie,"TYPE","log"),h(ie,"z",Ki);let Pe=ie;const ou={[Pe.TYPE]:Pe},Ar=p.z.object({one:l.G.xy.nullable(),two:l.G.xy.nullable(),hover:l.G.xy.nullable(),color:p.z.union([l.Color.z,p.z.object({verticalLine:l.Color.z.optional().default(l.ZERO),horizontalLine:l.Color.z.optional().default(l.ZERO),obliqueLine:l.Color.z.optional().default(l.ZERO)})]).optional().default(l.ZERO),strokeWidth:p.z.number().optional().default(1),strokeDash:p.z.number().optional().default(2)});class Ht extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ar)}async afterUpdate(){const t=d.Context.use(this.ctx);this.internal.theme=d.use(this.ctx),this.internal.render=t,this.internal.draw=new jt(t.upper2d,this.internal.theme),Z.requestRender(this.ctx,et)}async afterDelete(){Z.requestRender(this.ctx,K)}get verticalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.verticalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.verticalLine}get horizontalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.horizontalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.horizontalLine}get obliqueLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.obliqueLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.obliqueLine}async find(t){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:i,two:a}=this.prevState,{dataOne:o,dataTwo:c}=this.internal;if(i!=null&&l.G.equals(r,i)&&a!=null&&l.G.equals(s,a)&&o!=null&&c!=null){const[E,M]=[await t.findByXValue(o.x),await t.findByXValue(c.x)];return E.length===0||M.length===0?null:[E.sort((D,P)=>l.G.distance(o,D.value)-l.G.distance(o,P.value))[0],M.sort((D,P)=>l.G.distance(c,D.value)-l.G.distance(c,P.value))[0]]}const u=l.b.XY.scale(t.region).scale(l.Eo.DECIMAL),[f,g]=[u.pos(r),u.pos(s)],[m,w]=[await t.findByXDecimal(f.x),await t.findByXDecimal(g.x)];if(m.length===0||w.length===0)return null;const[b,v]=[m.sort((E,M)=>l.G.distance(f,E.position)-l.G.distance(f,M.position))[0],w.sort((E,M)=>l.G.distance(g,E.position)-l.G.distance(g,M.position))[0]];return this.internal.dataOne=b.value,this.internal.dataTwo=v.value,[b,v]}async renderHover(t){if(this.state.hover==null)return;const r=this.state.hover,s=l.b.XY.scale(t.region).scale(l.Eo.DECIMAL),i=s.pos(r),a=await t.findByXDecimal(s.pos(r).x);if(a.length===0)return;const o=a.sort((u,f)=>l.G.distance(i,u.position)-l.G.distance(i,f.position))[0],{draw:c}=this.internal;c.circle({fill:o.color.setAlpha(.5),radius:9,position:s.reverse().pos(o.position)})}async render(t){if(this.deleted)return;await this.renderHover(t);const r=await this.find(t);if(r==null)return;const[s,i]=r,{draw:a}=this.internal,{strokeDash:o,strokeWidth:c}=this.state,u=l.b.XY.scale(l.Eo.DECIMAL).scale(t.region),f=u.pos(s.position),g=u.pos(i.position),m=new d.w$1(Math.abs(s.value.x-i.value.x)),w=Math.abs(s.value.y-i.value.y),b=w/m.seconds;a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(f.x,g.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${w.toFixed(2)} ${s.units??""}`],direction:"x",position:l.G.construct(f.x,(f.y+g.y)/2),level:"small"}),a.line({start:l.G.construct(f.x,g.y),end:l.G.construct(g.x,g.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[m.truncate(d.w$1.MILLISECOND).toString()],direction:"x",position:l.G.construct((f.x+g.x)/2,g.y),level:"small"}),a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(g.x,g.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${b.toFixed(2)} ${s.units??""} / S`],direction:"x",position:l.G.construct((f.x+g.x)/2,(f.y+g.y)/2),level:"small"}),a.circle({fill:s.color.setAlpha(.5),radius:8,position:f}),a.circle({fill:s.color.setAlpha(.8),radius:5,position:f}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:f}),a.circle({fill:i.color.setAlpha(.5),radius:8,position:g}),a.circle({fill:i.color.setAlpha(.8),radius:5,position:g}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:g})}}h(Ht,"TYPE","measure");const Qi={[Ht.TYPE]:Ht},lu=Object.freeze(Object.defineProperty({__proto__:null,Measure:Ht,REGISTRY:Qi,measureStateZ:Ar},Symbol.toStringTag,{value:"Module"})),Ji=p.z.object({trigger:p.z.number(),command:p.z.number().optional(),value:p.z.number(),sink:ks.optional().default(ws),source:Ps.optional().default(bs)});class wn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ji)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,trigger:s,command:i}=this.state,{trigger:a}=this.prevState,{internal:o}=this;this.internal.source=await H(this.ctx,r,this.internal.source),o.sink=await Ye(this.ctx,t,o.sink),s!==a&&i!=null&&this.internal.sink.set(i),await this.updateValue(),(c=o.stopListening)==null||c.call(o),o.stopListening=o.source.onChange(()=>{this.updateValue().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Setpoint: ${t.message}`})}async updateValue(){const t=await this.internal.source.value();t!==this.state.value&&this.setState(r=>({...r,value:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}async render(){}}h(wn,"TYPE","Setpoint");const cu={[wn.TYPE]:wn},ta=p.z.object({triggered:p.z.boolean(),enabled:p.z.boolean(),sink:Pn.optional().default(Sn),source:rr.optional().default(er)});class bn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ta)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,triggered:s,enabled:i}=this.state,{triggered:a}=this.prevState,{internal:o}=this;this.internal.source=await H(this.ctx,r,this.internal.source),o.sink=await Ye(this.ctx,t,o.sink),s&&!a&&await o.sink.set(!i),await this.updateEnabledState(),(c=o.stopListening)==null||c.call(o),o.stopListening=o.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Toggle: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}async render(){}}h(bn,"TYPE","Toggle");const uu={[bn.TYPE]:bn},hu=p.z.object({box:l.Eo.box,telem:ar.optional().default(vs),backgroundTelem:sr.optional().default(En),level:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),precision:p.z.number().optional().default(2),minWidth:p.z.number().optional().default(60),width:p.z.number().optional(),notation:Bs.optional().default("standard"),location:l.K.xy.optional().default({x:"left",y:"center"})}),du=["upper2d","lower2d"],ae=class ae extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ae.z)}async afterUpdate(){var r,s;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.telem),(r=t.stopListening)==null||r.call(t),t.stopListening=this.internal.telem.onChange(()=>this.requestRender()),t.backgroundTelem=await H(this.ctx,this.state.backgroundTelem,t.backgroundTelem),(s=t.stopListeningBackground)==null||s.call(t),t.stopListeningBackground=this.internal.backgroundTelem.onChange(()=>this.requestRender()),this.internal.requestRender=Z.useOptionalRequest(this.ctx),this.requestRender()}async afterDelete(){var i;const{requestRender:t,telem:r,render:s}=this.internal;await((i=r.cleanup)==null?void 0:i.call(r)),t==null?s.erase(l.Eo.construct(this.state.box),l.G.ZERO,...du):t(K)}requestRender(){const{requestRender:t}=this.internal;t!=null?t(K):this.render({})}get fontHeight(){const{theme:t}=this.internal;return t.typography[this.state.level].size*t.sizes.base}maybeUpdateWidth(t){const{theme:r}=this.internal,s=t+r.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<s||this.state.minWidth>s&&this.state.width!==this.state.minWidth?this.setState(i=>({...i,width:Math.max(s,i.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(i=>({...i,width:Math.max(s,i.minWidth)}))}async render({viewportScale:t=l.b.XY.IDENTITY}){const{render:r,telem:s,backgroundTelem:i}=this.internal,a=l.Eo.construct(this.state.box);if(l.Eo.areaIsZero(a))return;const{location:o}=this.state,c=r.lower2d.applyScale(t);let u=await s.value();const f=d.fontString(this.internal.theme,{level:this.state.level,code:!0});c.font=f;const g=this.fontHeight,m=u[0]=="-";m&&(u=u.slice(1));const{theme:w}=this.internal,b=d.dimensions(u,f,c).width+w.sizes.base;this.internal.requestRender==null&&r.erase(l.Eo.construct(this.prevState.box)),this.maybeUpdateWidth(b);const v={...l.G.ZERO};o.x==="left"&&(v.x=6+g*.75),o.x==="center"&&(v.x=l.Eo.width(a)/2-b/2),o.y==="center"&&(v.y=l.Eo.height(a)/2);const E=l.G.translate(l.Eo.topLeft(a),v),M=c.scissor(a,void 0);let D=!0;if(this.state.backgroundTelem.type!=En.type){const P=r.lower2d.applyScale(t),z=await i.value();D=z.isZero,z.isZero||(P.fillStyle=z.hex,P.rect(...l.G.couple(l.Eo.topLeft(a)),l.Eo.width(a),l.Eo.height(a)),P.fill(),c.fillStyle=z.pickByContrast(w.colors.gray.l0,w.colors.gray.l9).hex)}D&&(c.fillStyle=this.internal.textColor.hex),c.textBaseline="middle",m&&c.fillText("-",...l.G.couple(l.G.translateX(E,-g*.6))),c.fillText(u,...l.G.couple(E)),M()}};h(ae,"TYPE","value"),h(ae,"z",hu);let qt=ae;const ea={[qt.TYPE]:qt},fu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ea,Value:qt},Symbol.toStringTag,{value:"Module"})),pu=d.cp.payloadZ.extend({viewport:l.H.bounds}),ps=e=>l.Color.z.safeParse(e).success,na=p.z.object({cursor:l.G.xy.or(p.z.null()),hovered:pu.or(p.z.null()),count:p.z.number()});class ke extends d.Leaf{constructor(){super(...arguments);h(this,"schema",na);h(this,"fetchedInitial",d.E.ZERO)}async afterUpdate(){const{internal:t}=this;t.render=d.Context.use(this.ctx),t.draw=new jt(t.render.upper2d,d.use(this.ctx)),t.ranges??(t.ranges=new Map);const r=Me(this.ctx);r!=null&&(t.client=r,t.tracker==null&&(t.tracker=await t.client.ranges.openTracker(),t.tracker.onChange(async s=>{s.forEach(async i=>{i.variant==="delete"?t.ranges.delete(i.key):ps(i.value.color)&&t.ranges.set(i.key,i.value)}),Z.requestRender(this.ctx,et),this.setState(i=>({...i,count:t.ranges.size}))}),Z.requestRender(this.ctx,et)))}async fetchInitial(t){const{internal:r}=this;if(r.client==null||this.fetchedInitial.roughlyEquals(t,d.w$1.minutes(1)))return;this.fetchedInitial=t,(await r.client.ranges.retrieve(t)).forEach(i=>{ps(i.color)&&r.ranges.set(i.key,i)}),this.setState(i=>({...i,count:r.ranges.size}))}async render(t){const{dataToDecimalScale:r,region:s,viewport:i,timeRange:a}=t;await this.fetchInitial(a);const{draw:o,ranges:c}=this.internal,u=r.scale(l.Eo.xBounds(s)),f=this.state.cursor==null?null:this.state.cursor.x;let g=null;const m=o.canvas.scissor(l.Eo.construct({x:l.Eo.left(s),y:l.Eo.top(s)-35},{x:l.Eo.right(s),y:l.Eo.bottom(s)}));c.forEach(w=>{const b=l.Color.z.safeParse(w.color);if(!b.success)return;const v=b.data;let E=u.pos(Number(w.timeRange.start.valueOf()));const M=u.pos(Number(w.timeRange.end.valueOf()));if(M<l.Eo.left(s)||E>l.Eo.right(s))return;E=l.Y(E,l.Eo.left(s)-2,l.Eo.right(s)-1);let D=!1;f!=null&&(D=l.H.contains({lower:E,upper:M},f)),D&&(g={key:w.key,name:w.name,color:w.color,timeRange:w.timeRange,viewport:{lower:r.scale(l.Eo.xBounds(i)).pos(Number(w.timeRange.start.valueOf())),upper:r.scale(l.Eo.xBounds(i)).pos(Number(w.timeRange.end.valueOf()))}}),o.container({region:l.Eo.construct({x:E,y:l.Eo.top(s)-1},{x:M,y:l.Eo.bottom(s)-1}),backgroundColor:v.setAlpha(.2),bordered:!1});const P=l.Eo.construct({x:E+1,y:l.Eo.top(s)-34},{x:M-1,y:l.Eo.top(s)-12});o.container({region:P,backgroundColor:l.Eo.width(P)<20?v.setAlpha(.4):z=>D?z.colors.gray.l2:z.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:v.setAlpha(.8)}),o.text({text:w.name,position:{x:E+8,y:l.Eo.top(s)-30},level:"small",shade:8,weight:500,maxWidth:M-E-16})}),m(),g!=null?this.setState(w=>({...w,hovered:g})):this.state.hovered&&this.setState(w=>({...w,hovered:null}))}}h(ke,"TYPE","range-provider");const gu={[dn.TYPE]:dn,[ke.TYPE]:ke},mu=Le;class Re extends Yi{constructor(){super(...arguments);h(this,"schema",Le)}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(this.renderAxis(t,r.reverse()),await this.renderYAxes(t,r),await this.renderRangeAnnotations(t,r),s!=null)throw s}async findByXDecimal(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;return await this.findByXValue(t,s.reverse().pos(r))}async findByXValue(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;const a={...t,xDataToDecimalScale:s},o=this.yAxes.map(async c=>await c.findByXValue(a,r));return(await Promise.all(o)).flat()}async renderYAxes(t,r){const s={...t,xDataToDecimalScale:r};await Promise.all(this.yAxes.map(async i=>await i.render(s)))}get yAxes(){return this.childrenOfType(be.TYPE)}get rangeAnnotations(){return this.childrenOfType(ke.TYPE)}async renderRangeAnnotations(t,r){const[s,i]=await this.bounds(t.hold,this.dataBounds.bind(this));if(i!=null)throw i;await Promise.all(this.rangeAnnotations.map(async a=>await a.render({dataToDecimalScale:r,region:t.plot,viewport:t.viewport,timeRange:new d.E(s.lower,s.upper)})))}async dataBounds(){return await Promise.all(this.yAxes.map(async t=>await t.xBounds()))}}h(Re,"TYPE","XAxis");const ra=p.z.object({container:l.Eo.box,viewport:l.Eo.box,hold:p.z.boolean().optional().default(!1),grid:p.z.record(oi),visible:p.z.boolean().optional().default(!0),clearOverScan:l.G.crudeZ.optional().default(l.G.ZERO)}),yu=(e,n)=>{const t=l.Eo.width(e)*Math.sqrt(l.Eo.height(e)),r=l.Eo.width(n)*Math.sqrt(l.Eo.height(n));return t/r};class vn extends d.Composite{constructor(){super(...arguments);h(this,"schema",ra)}async afterUpdate(){this.internal.instrumentation=De(this.ctx,"lineplot"),this.internal.aggregate=d.useAggregate(this.ctx),this.internal.renderCtx=d.Context.use(this.ctx),Z.control(this.ctx,t=>this.requestRender("low",t)),this.requestRender("high",K)}async afterDelete(){this.internal.renderCtx=d.Context.use(this.ctx),this.requestRender("high",K)}async findByXDecimal(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXDecimal(r,t));return(await Promise.all(s)).flat()}async findByXValue(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXValue(r,t));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(Re.TYPE)}get tooltips(){return this.childrenOfType(_t.TYPE)}get measures(){return this.childrenOfType(Ht.TYPE)}get exposure(){return yu(this.state.viewport,this.state.container)}async renderAxes(t,r){const s={...this.state,plot:t,canvases:r,exposure:this.exposure};await Promise.all(this.axes.map(async i=>await i.render(s)))}async renderTooltips(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:t,canvases:r};await Promise.all(this.tooltips.map(async i=>await i.render(s)))}async renderMeasures(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:t,canvases:r};await Promise.all(this.measures.map(async i=>await i.render(s)))}calculatePlot(){return eo(this.state.grid,this.state.container)}async render(t){const{renderCtx:r}=this.internal,{instrumentation:s}=this.internal;if(this.deleted){s.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return s.L.debug("not visible, skipping render",{key:this.key}),async({canvases:f})=>r.erase(this.state.container,this.state.clearOverScan,...f);const i=this.calculatePlot();s.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:i,canvases:t});const a=l.G.construct(this.state.clearOverScan),o=r.scissor(this.state.container,a,t.filter(f=>f!=="gl")),c=r.scissor(i,l.G.ZERO,t.filter(f=>f==="gl"));try{await this.renderAxes(i,t),await this.renderTooltips(i,t),await this.renderMeasures(i,t),r.gl.finish(),r.gl.flush(),r.gl.finish()}catch(f){if(f.message.toLowerCase().includes("bigint"))return;this.internal.aggregate({key:`${this.type}-${this.key}`,variant:"error",message:f.message})}finally{o(),c()}s.L.debug("rendered",{key:this.key});const u=l.Eo.copy(this.state.container);return async({canvases:f})=>r.erase(u,this.state.clearOverScan,...f)}requestRender(t,r){const{renderCtx:s}=this.internal;let i=["upper2d","lower2d","gl"];r===et&&(i=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(i),priority:t,canvases:i})}}h(vn,"TYPE","LinePlot");const xu={[vn.TYPE]:vn,[Re.TYPE]:Re,[be.TYPE]:be};exports.AcquireChannelControl=Se;exports.Annotation=dn;exports.AuthoritySource=Ee;exports.BaseProvider=$t;exports.Button=yn;exports.Canvas=ki;exports.Canvas$1=Ce;exports.Chip=fn;exports.Controller=Z;exports.Controller$1=pn;exports.Diagram=nu;exports.Diagram$1=Ft;exports.Indicator=gn;exports.Legend=mn;exports.Light=xn;exports.Line=we;exports.LinePlot=vn;exports.Log=Pe;exports.Measure=Ht;exports.Provider=_e;exports.Provider$1=ke;exports.Provider$2=_n;exports.REASON_DATA=Bn;exports.REASON_LAYOUT=K;exports.REASON_TOOL=et;exports.REGISTRY=Na;exports.REGISTRY$1=tu;exports.REGISTRY$10=Oi;exports.REGISTRY$11=cu;exports.REGISTRY$12=gs;exports.REGISTRY$13=ai;exports.REGISTRY$14=uu;exports.REGISTRY$15=Xi;exports.REGISTRY$16=ea;exports.REGISTRY$17=ou;exports.REGISTRY$18=Vc;exports.REGISTRY$2=ji;exports.REGISTRY$3=Jc;exports.REGISTRY$4=Wi;exports.REGISTRY$5=ru;exports.REGISTRY$6=Ic;exports.REGISTRY$7=xu;exports.REGISTRY$8=Qi;exports.REGISTRY$9=gu;exports.Rule=Gt;exports.STATUSES=Ni;exports.SetChannelValue=Te;exports.Setpoint=wn;exports.StateProvider=Bt;exports.Table=ve;exports.Toggle=bn;exports.Tooltip=_t;exports.Value=qt;exports.XAxis=Re;exports.YAxis=be;exports.ZERO_CONTEXT_VALUE=Jn;exports.acquireChannelControl=Kc;exports.acquireChannelControlPropsZ=Bi;exports.aether=Hc;exports.annotationStateZ=Ai;exports.authoritySource=Qc;exports.authoritySourceProps=Fi;exports.axisStateZ=Mr;exports.buttonStateZ=qi;exports.canvas=eu;exports.canvasStateZ=zr;exports.channelData=As;exports.chipStateZ=Li;exports.color=Zt;exports.colorGradient=Ks;exports.controllerStateZ=Ii;exports.coreAxisStateZ=Le;exports.diagramStateZ=Dr;exports.external=Ja;exports.indicatorStateZ=_i;exports.interpolateNumber=xe;exports.interpolateRgb=Wn;exports.interpolateString=di;exports.legendStateZ=Hi;exports.lightStateZ=Vi;exports.linePlotStateZ=ra;exports.logState=Ki;exports.measure=lu;exports.measureStateZ=Ar;exports.newTickFactory=Kn;exports.parseAutoBounds=zi;exports.provider=ba;exports.providerStateZ=na;exports.providerStateZ$1=ni;exports.providerStateZ$2=mr;exports.regions=ut;exports.rollingAverage=Vs;exports.rollingAverageProps=gr;exports.ruleStateZ=Yr;exports.scaleNumber=Js;exports.setChannelValue=Xc;exports.setChannelValuePropsZ=Gi;exports.setpoint=_s;exports.setpointStateZ=Ji;exports.sinkPipeline=Ds;exports.sinkPipelinePropsZ=cr;exports.sourcePipeline=zs;exports.sourcePipelinePropsZ=lr;exports.stateProviderStateZ=$i;exports.stateZ=Di;exports.statusZ=Ui;exports.streamChannelData=Ls;exports.streamChannelValue=$s;exports.streamChannelValuePropsZ=ur;exports.stringSourceSpecZ=ar;exports.stringifyNumber=Ws;exports.stringifyNumberProps=pr;exports.sugaredStateZ=Zi;exports.tickFactoryProps=Rr;exports.tickType=kr;exports.toggleStateZ=ta;exports.tooltip=su;exports.tooltipStateZ=Or;exports.value=fu;exports.withinBounds=Hs;exports.withinBoundsProps=fr;exports.withinSizeThreshold=Ri;exports.xAxisStateZ=mu;exports.yAxisStateZ=qc;
|
|
@@ -3966,16 +3966,14 @@ class De extends z {
|
|
|
3966
3966
|
if (this.lastUpdateRef ?? (this.lastUpdateRef = this.state.pixelPosition), Math.abs(this.state.pixelPosition - this.lastUpdateRef) < wu && !i)
|
|
3967
3967
|
return this.state.pixelPosition;
|
|
3968
3968
|
this.lastUpdateRef = this.state.pixelPosition;
|
|
3969
|
-
const l = t.pos(
|
|
3970
|
-
(this.state.pixelPosition - p.top(s) + p.top(r)) / p.height(s)
|
|
3971
|
-
);
|
|
3969
|
+
const l = t.pos(this.state.pixelPosition / p.height(s));
|
|
3972
3970
|
return this.setState((h) => ({ ...h, position: l })), this.state.pixelPosition;
|
|
3973
3971
|
}
|
|
3974
3972
|
if (this.state.position == null) {
|
|
3975
3973
|
const c = t.pos(0.5);
|
|
3976
3974
|
this.setState((l) => ({ ...l, position: c }));
|
|
3977
3975
|
}
|
|
3978
|
-
const o = t.reverse().pos(this.state.position) * p.height(s)
|
|
3976
|
+
const o = t.reverse().pos(this.state.position) * p.height(s);
|
|
3979
3977
|
if (!isNaN(o)) {
|
|
3980
3978
|
if (this.state.pixelPosition != null && Math.abs(o - this.state.pixelPosition) < 1)
|
|
3981
3979
|
return this.state.pixelPosition;
|
|
@@ -3985,9 +3983,8 @@ class De extends z {
|
|
|
3985
3983
|
}
|
|
3986
3984
|
async render(t) {
|
|
3987
3985
|
if (this.deleted) return;
|
|
3988
|
-
const { renderCtx: s } = this.internal, { location: r, plot: a } = t, i = dt.direction(r), { upper2d: o } = s, c = this.internal.draw;
|
|
3989
|
-
|
|
3990
|
-
l += p.top(t.container), c.rule({
|
|
3986
|
+
const { renderCtx: s } = this.internal, { location: r, plot: a } = t, i = dt.direction(r), { upper2d: o } = s, c = this.internal.draw, l = this.updatePositions(t) + p.top(t.plot);
|
|
3987
|
+
c.rule({
|
|
3991
3988
|
stroke: this.state.color,
|
|
3992
3989
|
lineWidth: this.state.lineWidth,
|
|
3993
3990
|
lineDash: this.state.lineDash,
|
|
@@ -3999,13 +3996,7 @@ class De extends z {
|
|
|
3999
3996
|
if (r === "left") {
|
|
4000
3997
|
const d = p.left(a) - 1;
|
|
4001
3998
|
o.moveTo(d, l), o.lineTo(d - h, l - h), o.lineTo(d - h, l + h);
|
|
4002
|
-
} else r === "right" && (o.moveTo(p.right(a), l), o.lineTo(
|
|
4003
|
-
p.right(a) + h,
|
|
4004
|
-
l - h
|
|
4005
|
-
), o.lineTo(
|
|
4006
|
-
p.right(a) + h,
|
|
4007
|
-
l + h
|
|
4008
|
-
));
|
|
3999
|
+
} else r === "right" && (o.moveTo(p.right(a), l), o.lineTo(p.right(a) + h, l - h), o.lineTo(p.right(a) + h, l + h));
|
|
4009
4000
|
o.closePath(), o.stroke();
|
|
4010
4001
|
}
|
|
4011
4002
|
}
|
package/dist/ether.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-q3hNa4qv.cjs"),r=require("./css-C3zWKgOb.cjs"),e=require("./LinePlot-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-q3hNa4qv.cjs"),r=require("./css-C3zWKgOb.cjs"),e=require("./LinePlot-CFpCtIU5.cjs"),l=Object.freeze(Object.defineProperty({__proto__:null,Color:r.Color,ZERO:r.ZERO,crudeZ:r.crudeZ,cssString:r.cssString,fromGradient:r.fromGradient,fromHSLA:r.fromHSLA,gradientZ:r.gradientZ,paletteZ:r.paletteZ,stopZ:r.stopZ,toHex:r.toHex},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null,Context:t.Context,Controller:e.Controller,Eraser:t.Eraser,GLProgram:t.GLProgram,Loop:t.Loop,REASON_DATA:e.REASON_DATA,REASON_LAYOUT:e.REASON_LAYOUT,REASON_TOOL:e.REASON_TOOL},Symbol.toStringTag,{value:"Module"})),i=Object.freeze(Object.defineProperty({__proto__:null,Provider:t.Provider,REGISTRY:t.REGISTRY,SYNNAX_DARK:t.SYNNAX_DARK,SYNNAX_LIGHT:t.SYNNAX_LIGHT,SYNNAX_THEMES:t.SYNNAX_THEMES,fontSpecZ:t.fontSpecZ,fontString:t.fontString,themeZ:t.themeZ,use:t.use},Symbol.toStringTag,{value:"Module"})),s=()=>{const o=new t.l((S,R)=>postMessage(S,R));onmessage=o.handle.bind(o);const n={...e.REGISTRY,...e.REGISTRY$1,...e.REGISTRY$2,...e.REGISTRY$3,...e.REGISTRY$4,...t.REGISTRY$1,...e.REGISTRY$5,...e.REGISTRY$6,...e.REGISTRY$7,...e.REGISTRY$8,...e.REGISTRY$9,...e.REGISTRY$10,...e.REGISTRY$11,...t.REGISTRY$2,...e.REGISTRY$12,...e.REGISTRY$13,...t.REGISTRY,...e.REGISTRY$14,...e.REGISTRY$15,...e.REGISTRY$16,...e.REGISTRY$17,...e.REGISTRY$18};t.render({worker:o.route("vis"),registry:n})},T=Object.freeze(Object.defineProperty({__proto__:null,render:s},Symbol.toStringTag,{value:"Module"})),E=Object.freeze(Object.defineProperty({__proto__:null,LinePlot:e.LinePlot,REGISTRY:e.REGISTRY$7,XAxis:e.XAxis,YAxis:e.YAxis,linePlotStateZ:e.linePlotStateZ,xAxisStateZ:e.xAxisStateZ,yAxisStateZ:e.yAxisStateZ},Symbol.toStringTag,{value:"Module"}));exports.aether=t.aether;exports.canvas=e.canvas;exports.diagram=e.Diagram;exports.measure=e.measure;exports.rule=e.aether;exports.synnax=e.provider;exports.telem=e.external;exports.tooltip=e.tooltip;exports.value=e.value;exports.color=l;exports.lineplot=E;exports.pluto=T;exports.render=a;exports.theming=i;
|
package/dist/ether.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { g as R, E as n, G as S, h as l, P as i, R as a, S as E, a as T, b as Y, i as G, j as $, t as p, k as c, m as _, o as m, p as I, r as d } from "./aggregator-D6gAHK4j.js";
|
|
2
2
|
import { q as ce } from "./aggregator-D6gAHK4j.js";
|
|
3
3
|
import { a as g, Z as u, c as f, b, f as x, d as O, g as A, p as y, s as j, t as Z } from "./css-DnIb4t_E.js";
|
|
4
|
-
import { C as v, R as P, a as N, b as L, c as h, d as M, e as z, f as C, g as X, h as k, i as w, j as s, k as H, l as D, m as q, n as B, o as F, p as K, q as U, r as J, s as Q, t as V, u as W, L as ee, X as ae, Y as se, E as te, F as oe, G as re } from "./LinePlot-
|
|
5
|
-
import { x as me, D as Ie, z as de, A as ge, v as ue, w as fe, y as be, B as xe } from "./LinePlot-
|
|
4
|
+
import { C as v, R as P, a as N, b as L, c as h, d as M, e as z, f as C, g as X, h as k, i as w, j as s, k as H, l as D, m as q, n as B, o as F, p as K, q as U, r as J, s as Q, t as V, u as W, L as ee, X as ae, Y as se, E as te, F as oe, G as re } from "./LinePlot-Cyj5fPvs.js";
|
|
5
|
+
import { x as me, D as Ie, z as de, A as ge, v as ue, w as fe, y as be, B as xe } from "./LinePlot-Cyj5fPvs.js";
|
|
6
6
|
const ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
7
|
__proto__: null,
|
|
8
8
|
Color: g,
|