kline-orderbook-chart 1.6.2 → 2.0.0
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/CHANGELOG.md +43 -1
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/chart-engine.mjs +390 -10
- package/dist/chart_engine.js +23292 -13
- package/dist/chart_engine_bg.wasm +0 -0
- package/dist/index.d.ts +6 -0
- package/dist/ingestWorker.js +14 -0
- package/dist/panelWorker.js +56 -0
- package/dist/tickWorker.js +394 -0
- package/package.json +2 -2
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* chart-engine / kline-orderbook-chart
|
|
3
|
+
* Copyright (c) 2025-2026 Tape Delta. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Proprietary and confidential. Licensed, not sold. Unauthorized
|
|
6
|
+
* copying, redistribution, modification, reverse-engineering, or
|
|
7
|
+
* removal of this notice is strictly prohibited. See the LICENSE
|
|
8
|
+
* file shipped with this package for the full terms.
|
|
9
|
+
*
|
|
10
|
+
* Contact: support@tapedelta.com
|
|
11
|
+
* Web: https://tapedelta.com
|
|
12
|
+
* NPM: https://www.npmjs.com/package/kline-orderbook-chart
|
|
13
|
+
*/
|
|
14
|
+
var G={FILL_RECT:1,FILL_ROUND_RECT:27,FILL_ELLIPSE:38,FILL_RECT_SMOOTH_X:30,STROKE_RECT:2,LINE:3,CANDLE:34,CANDLE_BORDERED:36,OHLC_BAR:37,DASHED_LINE:4,POLYLINE:5,TEXT:6,STYLED_TEXT:33,CIRCLE:7,TRIANGLE:8,SAVE:9,RESTORE:10,CLIP_RECT:11,ROTATED_TEXT:12,BUBBLE_3D:13,FILL_POLYGON:14,DASHED_POLYLINE:15,GRADIENT_RECT:16,GRADIENT_RECT_H:28,GRADIENT_RECT_H_MULTI:29,LINEAR_POLYLINE:17,SMOOTH_POLYLINE:24,BEGIN_HEATMAP_LAYER:18,END_HEATMAP_LAYER:19,HEATMAP_BITMAP:20,LINE_WITH_EXTEND:21,LABEL_CALLOUT:22,HEATMAP_WORLD:23,HEATMAP_BG:31,HEATMAP_WORLD_INTENSITY:32,OB_HEATMAP:35,DRAW_IMAGE:25,FILL_SMOOTH_BAND:26,END_FRAME:255},qo=(()=>{try{return typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches}catch{return!1}})(),jo=qo?1.5:1/0;function Re(){return typeof window<"u"&&window.devicePixelRatio||1}function Ko(t,i){return typeof OffscreenCanvas<"u"?new OffscreenCanvas(t,i):Object.assign(document.createElement("canvas"),{width:t,height:i})}var Ct=null,yo=null;function Qo(t,i){return Ct?(Ct.width!==t||Ct.height!==i)&&(Ct.width=t,Ct.height=i):(Ct=Ko(t,i),yo=Ct.getContext("2d")),yo}var ze=new Float32Array(0);function Jo(t){return ze.length<t&&(ze=new Float32Array(t)),ze}var se=new Float64Array(0),Ye=new Float64Array(0),Xe=new Float64Array(0),le=new Float64Array(0);function Zo(t){return se.length<t&&(se=new Float64Array(t)),se}function tn(t){return Ye.length<t&&(Ye=new Float64Array(t)),Ye}function en(t){return Xe.length<t&&(Xe=new Float64Array(t)),Xe}function on(t){return le.length<t&&(le=new Float64Array(t)),le}function Ve(t,i){if(i<2)return;let c=i-1,m=Zo(c),v=tn(c),o=en(c);for(let _=0;_<c;_++){let w=t[_*2],n=t[_*2+1],r=t[(_+1)*2],e=t[(_+1)*2+1];m[_]=r-w,v[_]=e-n,o[_]=m[_]>0?v[_]/m[_]:0}let d=on(i);d[0]=o[0],d[i-1]=o[c-1];for(let _=1;_<c;_++){let w=o[_-1],n=o[_];d[_]=w*n<=0?0:(w+n)*.5}for(let _=0;_<c;_++){let w=o[_];if(w===0){d[_]=0,d[_+1]=0;continue}let n=d[_]/w,r=d[_+1]/w,e=n*n+r*r;if(e>9){let F=3/Math.sqrt(e);d[_]=F*n*w,d[_+1]=F*r*w}}}function Ao(t,i,c){let m=c-1,v=se,o=le;for(let d=0;d<m;d++){let _=i[d*2],w=i[d*2+1],n=i[(d+1)*2],r=i[(d+1)*2+1],e=v[d];if(e<=0){t.lineTo(n,r);continue}let F=e/3;t.bezierCurveTo(_+F,w+o[d]*F,n-F,r-o[d+1]*F,n,r)}}function nn(t,i,c){let m=c-1,v=se,o=le;for(let d=m-1;d>=0;d--){let _=i[d*2],w=i[d*2+1],n=i[(d+1)*2],r=i[(d+1)*2+1],e=v[d];if(e<=0){t.lineTo(_,w);continue}let F=e/3;t.bezierCurveTo(n-F,r-o[d+1]*F,_+F,w+o[d]*F,_,w)}}var po=["left","center","right"],pe=new Map,rn=4096;function an(t,i,c,m){return t<<24|i<<16|c<<8|m}function $(t,i,c,m){let v=an(t,i,c,m),o=pe.get(v);return o||(o=`rgba(${t},${i},${c},${(m/255).toFixed(3)})`,pe.size>=rn&&pe.clear(),pe.set(v,o),o)}var Te=new TextDecoder;function Xt(t,i){return Math.round(t*i)/i}var _e=new Map;function Ee(t,i){let c=_e.get(i);if(c!==void 0)return c;let m=t.font,v=t.textBaseline;t.font=i,t.textBaseline="alphabetic";let o=t.measureText("0"),d=o.actualBoundingBoxAscent||0,_=o.actualBoundingBoxDescent||0;return c=(d-_)/2,(!Number.isFinite(c)||c===0)&&(c=(parseFloat(i)||11)*.35),_e.size>=256&&_e.clear(),_e.set(i,c),t.font=m,t.textBaseline=v,c}var To=new WeakMap;function sn(t,i,c,m,v){let o=To.get(t);o||(o=new Map,To.set(t,o));let d=Math.round(i),_=`${d}|${c}|${m}|${v}`,w=o.get(_);if(w)return w;let n=-d*.25,r=-d*.25,e=t.createRadialGradient(n,r,d*.08,0,0,d);e.addColorStop(0,m),e.addColorStop(1,c);let F=null;v&&(F=t.createRadialGradient(0,0,d*.85,0,0,d*1.2),F.addColorStop(0,v),F.addColorStop(1,v.replace(/[\d.]+\)$/,"0)")));let W=d*.2,D=t.createRadialGradient(n,r,0,n,r,W);return D.addColorStop(0,"rgba(255,255,255,0.22)"),D.addColorStop(1,"rgba(255,255,255,0)"),w={body:e,glow:F,spec:D,hlX:n,hlY:r,specR:W},o.set(_,w),w}function at(t,i,c){let m=Math.max(1,Math.round(i*c)),v=Math.round(t*c)/c;return m&1?v+.5/c:v}function xt(t,i,c,m,v){let o=Math.round(t*v),d=Math.round(i*v),_=Math.round((t+c)*v),w=Math.round((i+m)*v);return{x:o/v,y:d/v,w:(_-o)/v,h:(w-d)/v}}function ln(t,i,c,m,v){return{x:Math.round(t*v)/v,y:Math.round(i*v)/v,w:Math.max(1,Math.round(c*v))/v,h:Math.max(1,Math.round(m*v))/v}}function $e(t,i,c,m,v){let o=Math.round(i*v),d=Math.round((i+m)*v);return{x:t,y:o/v,w:c,h:(d-o)/v}}function _o(t,i,c,m,v=null,o=null,d=null,_=null){let w=i.buffer;if(c+m>w.byteLength)return;let n=new DataView(w,c,m),r=new Uint8Array(w,c,m),e=0,F="",W="",D=-1,j="",g=Math.max(1,Math.abs(t.getTransform?.().a||Re())),et=null,it=[],I=_&&_.geom&&_.geom.available?_.geom:null,V=t,x=!1,q="";for(;e<m;){let Z=r[e];if(e+=1,Z===G.END_FRAME)break;switch(Z){case G.FILL_RECT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];if(e+=4,I){I.rect(u,a,s,l,f,h,b,y,0,0,0,0,0,0,0);break}let p=$(f,h,b,y);p!==F&&(t.fillStyle=p,F=p);let R=xt(u,a,s,l,g);t.fillRect(R.x,R.y,R.w,R.h);break}case G.FILL_RECT_SMOOTH_X:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];if(e+=4,I){I.rect(u,a,s,l,f,h,b,y,0,0,0,0,0,0,1);break}let p=$(f,h,b,y);p!==F&&(t.fillStyle=p,F=p);let R=$e(u,a,s,l,g);t.fillRect(R.x,R.y,R.w,R.h);break}case G.FILL_ELLIPSE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];if(e+=4,I){I.rect(u-s,a-l,s*2,l*2,f,h,b,y,-1,0,0,0,0,0,2);break}let p=$(f,h,b,y);p!==F&&(t.fillStyle=p,F=p),t.beginPath(),t.ellipse(u,a,Math.max(s,.1),Math.max(l,.1),0,0,Math.PI*2),t.fill();break}case G.FILL_ROUND_RECT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];e+=4;let p=n.getFloat32(e,!0);if(e+=4,I){I.rect(u,a,s,l,f,h,b,y,p,0,0,0,0,0,0);break}let R=$(f,h,b,y);R!==F&&(t.fillStyle=R,F=R);let T=xt(u,a,s,l,g),E=Math.min(p,T.w*.5,T.h*.5);E<=.5?t.fillRect(T.x,T.y,T.w,T.h):(t.beginPath(),t.moveTo(T.x+E,T.y),t.lineTo(T.x+T.w-E,T.y),t.arcTo(T.x+T.w,T.y,T.x+T.w,T.y+E,E),t.lineTo(T.x+T.w,T.y+T.h-E),t.arcTo(T.x+T.w,T.y+T.h,T.x+T.w-E,T.y+T.h,E),t.lineTo(T.x+E,T.y+T.h),t.arcTo(T.x,T.y+T.h,T.x,T.y+T.h-E,E),t.lineTo(T.x,T.y+E),t.arcTo(T.x,T.y,T.x+E,T.y,E),t.closePath(),t.fill());break}case G.STROKE_RECT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];e+=4;let p=n.getFloat32(e,!0);if(e+=4,I){let O=p*.5;I.rect(u-O,a-O,s+p,l+p,0,0,0,0,0,p,f,h,b,y,0);break}let R=$(f,h,b,y);R!==W&&(t.strokeStyle=R,W=R),p!==D&&(t.lineWidth=p,D=p);let T=at(u,p,g),E=at(a,p,g),S=Math.round(s*g)/g,M=Math.round(l*g)/g;t.strokeRect(T,E,S,M);break}case G.LINE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];e+=4;let p=n.getFloat32(e,!0);if(e+=4,I){I.seg(u,a,s,l,f,h,b,y,p,0,0);break}let R=$(f,h,b,y);t.beginPath(),R!==W&&(t.strokeStyle=R,W=R),p!==D&&(t.lineWidth=p,D=p),t.setLineDash([]),t.moveTo(at(u,p,g),at(a,p,g)),t.lineTo(at(s,p,g),at(l,p,g)),t.stroke();break}case G.CANDLE:case G.CANDLE_BORDERED:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4;let y=n.getFloat32(e,!0);e+=4;let p=r[e+3],R=$(r[e],r[e+1],r[e+2],p);e+=4;let T=r[e+3],E=$(r[e],r[e+1],r[e+2],T);e+=4;let S=null;Z===G.CANDLE_BORDERED&&(S=$(r[e],r[e+1],r[e+2],r[e+3]),e+=4);let M=Math.max(1,Math.floor(b*g)),O=Math.max(1,Math.floor(y*g));M>O&&(M=O);let N=Math.min(Math.max(1,Math.floor(h*g)),O);N<M?N=M:(N^M)&1&&(N-=1);let H=u*g,U=M&1?Math.round(H-.5)+.5:Math.round(H),L=Math.max(1,Math.round(g)),B=Math.round(Math.min(l,f)*g),k=Math.max(B+L,Math.round(Math.max(l,f)*g)),Q=Math.round(Math.min(a,s)*g),P=Math.max(Q+1,Math.round(Math.max(a,s)*g)),J=Math.min(a,s),Nt=Math.max(a,s),Zt=Math.min(l,f),te=Math.max(l,f);if(J<Zt&&Q>=B&&(Q=B-1),Nt>te&&P<=k&&(P=k+1),T>0&&(Q<B||P>k)){E!==F&&(t.fillStyle=E,F=E);let ee=(U-M/2)/g,oe=M/g;p===255?t.fillRect(ee,Q/g,oe,(P-Q)/g):(Q<B&&t.fillRect(ee,Q/g,oe,(B-Q)/g),P>k&&t.fillRect(ee,k/g,oe,(P-k)/g))}let rt=U-N/2,ft=k-B;if(S===null){p>0&&(R!==F&&(t.fillStyle=R,F=R),t.fillRect(rt/g,B/g,N/g,ft/g));break}let st=Math.max(1,Math.floor(g));if(S!==F&&(t.fillStyle=S,F=S),N<=2*st||ft<=2*st){t.fillRect(rt/g,B/g,N/g,ft/g);break}p===255?t.fillRect(rt/g,B/g,N/g,ft/g):(t.fillRect(rt/g,B/g,N/g,st/g),t.fillRect(rt/g,(k-st)/g,N/g,st/g),t.fillRect(rt/g,(B+st)/g,st/g,(ft-2*st)/g),t.fillRect((rt+N-st)/g,(B+st)/g,st/g,(ft-2*st)/g)),p>0&&(R!==F&&(t.fillStyle=R,F=R),t.fillRect((rt+st)/g,(B+st)/g,(N-2*st)/g,(ft-2*st)/g));break}case G.OHLC_BAR:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let y=r[e];e+=1;let p=Math.max(1,Math.floor(h*g)),R=Math.max(1,Math.floor(g)),T=y&1?R:Math.max(R,Math.floor(p/6));T>p&&(T=p);let E=u*g,M=(T&1?Math.round(E-.5)+.5:Math.round(E))-T/2,O=Math.round(Math.min(s,l)*g),N=Math.max(O+1,Math.round(Math.max(s,l)*g));b!==F&&(t.fillStyle=b,F=b),t.fillRect(M/g,O/g,T/g,(N-O)/g);let H=Math.floor((Math.floor(p*.8)-T)/2);if(H>=1){if(!(y&2)){let L=Math.round(a*g-T/2);t.fillRect((M-H)/g,L/g,H/g,T/g)}let U=Math.round(f*g-T/2);t.fillRect((M+T)/g,U/g,H/g,T/g)}break}case G.DASHED_LINE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e],h=r[e+1],b=r[e+2],y=r[e+3];e+=4;let p=n.getFloat32(e,!0);e+=4;let R=n.getFloat32(e,!0);e+=4;let T=n.getFloat32(e,!0);if(e+=4,I){I.seg(u,a,s,l,f,h,b,y,p,R,T);break}let E=$(f,h,b,y);t.beginPath(),E!==W&&(t.strokeStyle=E,W=E),p!==D&&(t.lineWidth=p,D=p),t.setLineDash([R,T]),t.moveTo(at(u,p,g),at(a,p,g)),t.lineTo(at(s,p,g),at(l,p,g)),t.stroke(),t.setLineDash([]);break}case G.LINEAR_POLYLINE:{let u=n.getUint16(e,!0);e+=2;let a=r[e],s=r[e+1],l=r[e+2],f=r[e+3];e+=4;let h=n.getFloat32(e,!0);if(e+=4,I){let y=0,p=0;for(let R=0;R<u;R++){let T=n.getFloat32(e,!0),E=n.getFloat32(e+4,!0);e+=8,R>0&&I.seg(y,p,T,E,a,s,l,f,h,0,0),y=T,p=E}break}let b=$(a,s,l,f);if(u>1){t.beginPath(),b!==W&&(t.strokeStyle=b,W=b),h!==D&&(t.lineWidth=h,D=h),t.setLineDash([]),t.lineJoin="miter",t.lineCap="butt",t.miterLimit=10;let y=n.getFloat32(e,!0);e+=4;let p=n.getFloat32(e,!0);e+=4,t.moveTo(y,p);for(let R=1;R<u;R++)t.lineTo(n.getFloat32(e,!0),n.getFloat32(e+4,!0)),e+=8;t.stroke()}else e+=u*8;break}case G.SMOOTH_POLYLINE:{let u=n.getUint16(e,!0);e+=2;let a=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let s=n.getFloat32(e,!0);if(e+=4,u>1){let l=new Float32Array(u*2);for(let f=0;f<u;f++)l[f*2]=n.getFloat32(e,!0),e+=4,l[f*2+1]=n.getFloat32(e,!0),e+=4;t.beginPath(),a!==W&&(t.strokeStyle=a,W=a),s!==D&&(t.lineWidth=s,D=s),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",u===2?(t.moveTo(l[0],l[1]),t.lineTo(l[2],l[3])):(Ve(l,u),t.moveTo(l[0],l[1]),Ao(t,l,u)),t.stroke()}else e+=u*8;break}case G.POLYLINE:{let u=n.getUint16(e,!0);e+=2;let a=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let s=n.getFloat32(e,!0);if(e+=4,u>0){let l=new Float32Array(u*2);for(let f=0;f<u;f++)l[f*2]=n.getFloat32(e,!0),e+=4,l[f*2+1]=n.getFloat32(e,!0),e+=4;if(t.beginPath(),a!==W&&(t.strokeStyle=a,W=a),s!==D&&(t.lineWidth=s,D=s),t.setLineDash([]),t.lineJoin="round",t.lineCap="round",u===2)t.moveTo(l[0],l[1]),t.lineTo(l[2],l[3]);else{t.moveTo(l[0],l[1]);for(let f=0;f<u-1;f++){let h=f>0?f-1:0,b=f,y=f+1,p=f<u-2?f+2:u-1,R=l[h*2],T=l[h*2+1],E=l[b*2],S=l[b*2+1],M=l[y*2],O=l[y*2+1],N=l[p*2],H=l[p*2+1],U=E+(M-R)/6,L=S+(O-T)/6,B=M-(N-E)/6,k=O-(H-S)/6;t.bezierCurveTo(U,L,B,k,M,O)}}t.stroke()}break}case G.TEXT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e];e+=1;let h=n.getUint16(e,!0);e+=2;let b=Te.decode(new Uint8Array(i.buffer,c+e,h));e+=h,s!==F&&(t.fillStyle=s,F=s);let y=`${Math.round(l)}px "IBM Plex Mono",monospace`;y!==j&&(t.font=y,j=y),t.textAlign=po[f]||"left",t.textBaseline="alphabetic";let p=a+Ee(t,y);t.fillText(b,Xt(u,g),Xt(p,g));break}case G.STYLED_TEXT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e];e+=1;let h=r[e];e+=1;let b=n.getUint16(e,!0);e+=2;let y=Te.decode(new Uint8Array(i.buffer,c+e,b));e+=b,s!==F&&(t.fillStyle=s,F=s);let p=h&2?"italic ":"",R=h&1?"700 ":"",T=`${p}${R}${Math.round(l)}px "IBM Plex Mono",monospace`;T!==j&&(t.font=T,j=T),t.textAlign=po[f]||"left",t.textBaseline="alphabetic";let E=a+Ee(t,T);t.fillText(y,Xt(u,g),Xt(E,g));break}case G.CIRCLE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=r[e],f=r[e+1],h=r[e+2],b=r[e+3],y=I?"":$(l,f,h,b);e+=4;let p=r[e],R=r[e+1],T=r[e+2],E=r[e+3],S=I?"":$(p,R,T,E);e+=4;let M=n.getFloat32(e,!0);if(e+=4,I){I.disc(u,a,s,l,f,h,b,p,R,T,E,0,0,0,0,M,0);break}t.beginPath(),t.arc(u,a,s,0,Math.PI*2),y!==F&&(t.fillStyle=y,F=y),t.fill(),M>0&&(S!==W&&(t.strokeStyle=S,W=S),M!==D&&(t.lineWidth=M,D=M),t.stroke());break}case G.TRIANGLE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=r[e],y=r[e+1],p=r[e+2],R=r[e+3];if(e+=4,I){I.tri(u,a,s,l,f,h,b,y,p,R);break}let T=$(b,y,p,R);t.beginPath(),t.moveTo(u,a),t.lineTo(s,l),t.lineTo(f,h),t.closePath(),T!==F&&(t.fillStyle=T,F=T),t.fill();break}case G.SAVE:{t.save(),it.push(et);break}case G.RESTORE:{t.restore(),et=it.length?it.pop():null,I&&I.setClip(et),F="",W="",D=-1,j="";break}case G.CLIP_RECT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=xt(u,a,s,l,g);t.beginPath(),t.rect(f.x,f.y,f.w,f.h),t.clip(),et=f,I&&I.setClip(f);break}case G.ROTATED_TEXT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);e+=4;let h=n.getUint16(e,!0);e+=2;let b=Te.decode(r.subarray(e,e+h));e+=h;let y=`${l}px sans-serif`;y!==j&&(t.font=y,j=y),s!==F&&(t.fillStyle=s,F=s),t.textAlign="center",t.textBaseline="alphabetic";let p=Ee(t,y);t.save(),t.translate(u,a),t.rotate(f),t.fillText(b,0,p),t.restore();break}case G.BUBBLE_3D:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=r[e],f=r[e+1],h=r[e+2],b=r[e+3];e+=4;let y=r[e],p=r[e+1],R=r[e+2],T=r[e+3];e+=4;let E=r[e],S=r[e+1],M=r[e+2],O=r[e+3];e+=4;let N=n.getFloat32(e,!0);e+=4;let H=s;if(I){I.disc(u,a,H,l,f,h,b,E,S,M,O,y,p,R,T,N,H<4?0:1);break}if(H<4){let U=`rgba(${l},${f},${h},${(b/255).toFixed(3)})`;t.beginPath(),t.arc(u,a,H,0,Math.PI*2),t.fillStyle=U,t.fill(),F=""}else{let U=Math.round(H),L=H>=6,B=H>=16,k=`rgba(${l},${f},${h},${(b/255).toFixed(3)})`,Q=`rgba(${y},${p},${R},${(T/255).toFixed(3)})`,P=B?`rgba(${E},${S},${M},${(O/255*.5).toFixed(3)})`:null,J=sn(t,U,k,Q,P);t.save(),t.translate(u,a),B&&J.glow&&(t.beginPath(),t.arc(0,0,U*1.2,0,Math.PI*2),t.fillStyle=J.glow,t.fill()),t.beginPath(),t.arc(0,0,U,0,Math.PI*2),t.fillStyle=J.body,t.fill(),L&&(t.beginPath(),t.arc(J.hlX,J.hlY,J.specR,0,Math.PI*2),t.fillStyle=J.spec,t.fill()),t.restore(),F=""}break}case G.FILL_POLYGON:{let u=n.getUint16(e,!0);e+=2;let a=r[e],s=r[e+1],l=r[e+2],f=r[e+3];if(e+=4,I){let b=Jo(u*2);for(let y=0;y<u;y++)b[y*2]=n.getFloat32(e,!0),b[y*2+1]=n.getFloat32(e+4,!0),e+=8;I.poly(b,u,a,s,l,f);break}let h=$(a,s,l,f);if(u>2){t.beginPath();let b=n.getFloat32(e,!0);e+=4;let y=n.getFloat32(e,!0);e+=4,t.moveTo(b,y);for(let p=1;p<u;p++)t.lineTo(n.getFloat32(e,!0),n.getFloat32(e+4,!0)),e+=8;t.closePath(),h!==F&&(t.fillStyle=h,F=h),t.fill()}else e+=u*8;break}case G.FILL_SMOOTH_BAND:{let u=n.getUint16(e,!0);e+=2;let a=n.getUint16(e,!0);e+=2;let s=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let l=new Float32Array(u*2);for(let h=0;h<u;h++)l[h*2]=n.getFloat32(e,!0),e+=4,l[h*2+1]=n.getFloat32(e,!0),e+=4;let f=new Float32Array(a*2);for(let h=0;h<a;h++)f[h*2]=n.getFloat32(e,!0),e+=4,f[h*2+1]=n.getFloat32(e,!0),e+=4;u>=2&&a>=2&&(t.beginPath(),s!==F&&(t.fillStyle=s,F=s),u===2?(t.moveTo(l[0],l[1]),t.lineTo(l[2],l[3])):(Ve(l,u),t.moveTo(l[0],l[1]),Ao(t,l,u)),t.lineTo(f[(a-1)*2],f[(a-1)*2+1]),a===2?t.lineTo(f[0],f[1]):(Ve(f,a),nn(t,f,a)),t.closePath(),t.fill());break}case G.DASHED_POLYLINE:{let u=n.getUint16(e,!0);e+=2;let a=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);if(e+=4,u>1){t.beginPath(),a!==W&&(t.strokeStyle=a,W=a),s!==D&&(t.lineWidth=s,D=s),t.setLineDash([l,f]),t.lineJoin="round";let h=n.getFloat32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4,t.moveTo(h,b);for(let y=1;y<u;y++)t.lineTo(n.getFloat32(e,!0),n.getFloat32(e+4,!0)),e+=8;t.stroke(),t.setLineDash([])}else e+=u*8;break}case G.GRADIENT_RECT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let h=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let b=xt(u,a,s,l,g),y=t.createLinearGradient(b.x,b.y,b.x,b.y+b.h);y.addColorStop(0,f),y.addColorStop(1,h),t.fillStyle=y,F="",t.fillRect(b.x,b.y,b.w,b.h);break}case G.GRADIENT_RECT_H:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let h=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let b=xt(u,a,s,l,g),y=t.createLinearGradient(b.x,b.y,b.x+b.w,b.y);y.addColorStop(0,f),y.addColorStop(1,h),t.fillStyle=y,F="",t.fillRect(b.x,b.y,b.w,b.h);break}case G.GRADIENT_RECT_H_MULTI:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=r[e];e+=1;let h=xt(u,a,s,l,g),b=t.createLinearGradient(h.x,h.y,h.x+h.w,h.y);for(let y=0;y<f;y++){let p=n.getFloat32(e,!0);e+=4;let R=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4,b.addColorStop(p<0?0:p>1?1:p,R)}t.fillStyle=b,F="",t.fillRect(h.x,h.y,h.w,h.h);break}case G.BEGIN_HEATMAP_LAYER:{let u=e-1,a=n.getUint32(e,!0);e+=4;let s=n.getUint32(e,!0);e+=4;let l=n.getUint32(e,!0);if(e+=4,!v||l===0)break;let f=V.canvas.width,h=V.canvas.height,b=`${a}|${s}|${f}|${h}|${g}`;if(v.getKey()===b&&v.getCanvas()){let y=f/g,p=h/g;V.drawImage(v.getCanvas(),0,0,y,p),e=u+l}else{let y=Math.min(g,jo),p=Math.max(1,Math.round(f/g*y)),R=Math.max(1,Math.round(h/g*y)),T=v.ensureSize(p,R,y);if(!T)break;T.save(),T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,p,R),T.restore(),t=T,F="",W="",D=-1,j="",x=!0,q=b}break}case G.END_HEATMAP_LAYER:{if(!x)break;let u=V.canvas.width/g,a=V.canvas.height/g;V.drawImage(v.getCanvas(),0,0,u,a),v.setKey(q),t=V,F="",W="",D=-1,j="",x=!1,q="";break}case G.HEATMAP_BITMAP:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getUint32(e,!0);e+=4;let l=n.getUint32(e,!0);e+=4;let f=s*l*4;if(e+f>r.byteLength){e=r.byteLength;break}let h=new Uint8ClampedArray(r.buffer,r.byteOffset+e,f);e+=f;let b=new ImageData(h,s,l),y=Qo(s,l);if(!y)break;y.putImageData(b,0,0),t.drawImage(Ct,u,a,s,l);break}case G.HEATMAP_WORLD:{let u=n.getUint32(e,!0);e+=4;let a=n.getUint32(e,!0);e+=4;let s=n.getUint32(e,!0);e+=4;let l=n.getUint32(e,!0);e+=4;let f=n.getUint32(e,!0);e+=4;let h=n.getUint32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4;let y=n.getFloat32(e,!0);e+=4;let p=n.getFloat32(e,!0);e+=4;let R=n.getFloat32(e,!0);e+=4;let T=n.getFloat32(e,!0);e+=4;let E=n.getFloat32(e,!0);e+=4;let S=n.getFloat32(e,!0);e+=4;let M=n.getFloat32(e,!0);e+=4;let O=r[e];e+=1;let N=(O&1)!==0,H=f*h*4;if(e+H>r.byteLength){e=r.byteLength;break}if(!o||u===0||a===0){e+=H;break}let U=o.ensureSize(u,a);if(!U){e+=H;break}if(N&&U.clearRect(0,0,u,a),H>0){let L=new Uint8ClampedArray(r.buffer,r.byteOffset+e,H),B=new ImageData(L,f,h);U.putImageData(B,s,l)}if(e+=H,p>0&&R>0&&S>0&&M>0){let L=ln(T,E,S,M,g);if(L.w>0&&L.h>0){let B=t.imageSmoothingEnabled;t.imageSmoothingEnabled=!1,t.drawImage(o.getCanvas(),b,y,p,R,L.x,L.y,L.w,L.h),t.imageSmoothingEnabled=B}}break}case G.LINE_WITH_EXTEND:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4;let y=n.getFloat32(e,!0);e+=4;let p=r[e];e+=1,f!==W&&(t.strokeStyle=f,W=f),h!==D&&(t.lineWidth=h,D=h),t.setLineDash(b>0?[b,y]:[]);let R=1e5,T=u,E=a,S=s,M=l,O=s-u,N=l-a,H=Math.hypot(O,N);if(H>0&&p!==0){let U=O/H,L=N/H;p&1&&(T=u-U*R,E=a-L*R),p&2&&(S=s+U*R,M=l+L*R),p&4&&L<0&&(T=u-U*R,E=a-L*R),p&8&&L>0&&(S=s+U*R,M=l+L*R)}t.beginPath(),t.moveTo(at(T,h,g),at(E,h,g)),t.lineTo(at(S,h,g),at(M,h,g)),t.stroke(),b>0&&t.setLineDash([]);break}case G.LABEL_CALLOUT:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let l=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let f=$(r[e],r[e+1],r[e+2],r[e+3]);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4;let y=r[e];e+=1;let p=r[e];e+=1;let R=n.getUint16(e,!0);e+=2;let T=Te.decode(r.subarray(e,e+R));e+=R;let E=`${Math.round(h)}px "IBM Plex Mono",monospace`;E!==j&&(t.font=E,j=E);let S=4,M=6,O=T.indexOf(`
|
|
15
|
+
`)>=0?T.split(`
|
|
16
|
+
`):[T],N=Math.round(h),H=3,U=0;for(let rt=0;rt<O.length;rt++){let ft=t.measureText(O[rt]).width;ft>U&&(U=ft)}let L=O.length*N+(O.length-1)*H+S*2,B=Math.ceil(U)+S*2,k,Q;switch(p){case 1:Q=a-M-L,k=u-B/2;break;case 2:Q=a+M,k=u-B/2;break;case 3:Q=a-L/2,k=u+M;break;case 4:Q=a-L/2,k=u-M-B;break;default:Q=a-L/2,y===1?k=u-B/2:y===2?k=u-B:k=u;break}let P=xt(k,Q,B,L,g),J=Math.min(3,P.w*.5,P.h*.5),Nt=()=>{t.beginPath(),J<=.5?t.rect(P.x,P.y,P.w,P.h):(t.moveTo(P.x+J,P.y),t.lineTo(P.x+P.w-J,P.y),t.arcTo(P.x+P.w,P.y,P.x+P.w,P.y+J,J),t.lineTo(P.x+P.w,P.y+P.h-J),t.arcTo(P.x+P.w,P.y+P.h,P.x+P.w-J,P.y+P.h,J),t.lineTo(P.x+J,P.y+P.h),t.arcTo(P.x,P.y+P.h,P.x,P.y+P.h-J,J),t.lineTo(P.x,P.y+J),t.arcTo(P.x,P.y,P.x+J,P.y,J)),t.closePath()};if(s!==F&&(t.fillStyle=s,F=s),Nt(),t.fill(),b>0&&(l!==W&&(t.strokeStyle=l,W=l),b!==D&&(t.lineWidth=b,D=b),t.setLineDash([]),Nt(),t.stroke()),p>=1&&p<=4){switch(s!==F&&(t.fillStyle=s,F=s),t.beginPath(),p){case 1:t.moveTo(u-M/2,Q+L),t.lineTo(u+M/2,Q+L),t.lineTo(u,a);break;case 2:t.moveTo(u-M/2,Q),t.lineTo(u+M/2,Q),t.lineTo(u,a);break;case 3:t.moveTo(k,a-M/2),t.lineTo(k,a+M/2),t.lineTo(u,a);break;case 4:t.moveTo(k+B,a-M/2),t.lineTo(k+B,a+M/2),t.lineTo(u,a);break}t.closePath(),t.fill()}f!==F&&(t.fillStyle=f,F=f),t.textAlign="center",t.textBaseline="alphabetic";let Zt=Ee(t,E),te=k+B/2;for(let rt=0;rt<O.length;rt++){let ft=Q+S+N/2+rt*(N+H);t.fillText(O[rt],Xt(te,g),Xt(ft+Zt,g))}break}case G.DRAW_IMAGE:{let u=n.getFloat32(e,!0);e+=4;let a=n.getFloat32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getUint32(e,!0);if(e+=4,!d||f===0||s<=0||l<=0)break;let h=d.get(f);if(!h)break;try{t.drawImage(h,u,a,s,l)}catch(b){d.delete(f),console.warn("[canvasRenderer] drawImage failed for id="+f,b?.message||b)}break}case G.HEATMAP_BG:{let u=r[e],a=r[e+1],s=r[e+2],l=r[e+3],f=r[e+4],h=r[e+5],b=r[e+6],y=r[e+7],p=r[e+8]!==0;e+=9,_&&(t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,t.canvas.width,t.canvas.height),t.restore(),_.bg(u,a,s,l,f,h,b,y,p));break}case G.HEATMAP_WORLD_INTENSITY:{let u=n.getUint32(e,!0);e+=4;let a=n.getUint32(e,!0);e+=4;let s=n.getUint32(e,!0);e+=4;let l=n.getUint32(e,!0);e+=4;let f=n.getUint32(e,!0);e+=4;let h=n.getUint32(e,!0);e+=4;let b=n.getFloat32(e,!0);e+=4;let y=n.getFloat32(e,!0);e+=4;let p=n.getFloat32(e,!0);e+=4;let R=n.getFloat32(e,!0);e+=4;let T=n.getFloat32(e,!0);e+=4;let E=n.getFloat32(e,!0);e+=4;let S=n.getFloat32(e,!0);e+=4;let M=n.getFloat32(e,!0);e+=4;let O=n.getUint32(e,!0);e+=4;let N=r[e];e+=1;let H=n.getFloat32(e,!0);e+=4;let U=(N&2)!==0,L=(N&4)!==0,B=N&8?1:0,k=f*h;if(e+k>r.byteLength){e=r.byteLength;break}if(_){let Q=k>0?new Uint8Array(r.buffer,r.byteOffset+e,k):null;_.heatmap({worldCols:u,worldRows:a,patchX:s,patchY:l,patchW:f,patchH:h,srcX:b,srcY:y,srcW:p,srcH:R,destX:T,destY:E,destW:S,destH:M,lutSeq:O,hd:U,subpx:L,subTexelX:H,fullRebuild:(N&1)!==0,layer:B,clip:et},Q)}e+=k;break}case G.OB_HEATMAP:{let u=n.getUint32(e,!0);e+=4;let a=n.getUint32(e,!0);e+=4;let s=n.getFloat32(e,!0);e+=4;let l=n.getFloat32(e,!0);e+=4;let f=n.getFloat32(e,!0);e+=4;let h=n.getFloat32(e,!0);e+=4;let b=r[e],y=r[e+1],p=r[e+2],R=r[e+3];e+=4;let T=n.getFloat32(e,!0);e+=4;let E=n.getUint32(e,!0);e+=4,e+=1;let S=u*a*2;if(e+S>r.byteLength){e=r.byteLength;break}_&&typeof _.obHeatmap=="function"&&_.obHeatmap({cols:u,rows:a,destX:s,destY:l,destW:f,destH:h,bgR:b,bgG:y,bgB:p,bgA:R,alphaMul:T,lutSeq:E},S>0?new Uint8Array(r.buffer,r.byteOffset+e,S):null),e+=S;break}default:e=m;break}}if(x&&v){let Z=V.canvas.width/g,u=V.canvas.height/g;V.drawImage(v.getCanvas(),0,0,Z,u),v.invalidate()}I&&I.flush()}var qe=new Int32Array(0),je=new Uint8Array(0),Ke=new Int32Array(0);function cn(t){return qe.length<t&&(qe=new Int32Array(t)),qe}function un(t){return je.length<t&&(je=new Uint8Array(t)),je}function fn(t){return Ke.length<t&&(Ke=new Int32Array(t)),Ke}function Eo(t,i,c,m,v,o,d){let _=0,w=0;for(let x=1;x<i;x++){let q=t[x*2+1];q<t[_*2+1]&&(_=x),q>t[w*2+1]&&(w=x)}if(_===w)return!1;let n=(w-_+i)%i,r=i-n;if(n<1||r<1)return!1;let e=t[_*2+1];for(let x=1;x<=n;x++){let q=t[(_+x)%i*2+1];if(q<e-1e-4)return!1;e=q}e=t[_*2+1];for(let x=1;x<=r;x++){let q=t[(_-x+i*2)%i*2+1];if(q<e-1e-4)return!1;e=q}let F=0;for(let x=0,q=i-1;x<i;q=x++)F+=t[q*2]*t[x*2+1]-t[x*2]*t[q*2+1];if(F===0)return!1;let W=F>0?1:-1,D=cn(i),j=un(i),g=0,et=0,it=1;for(;et<=n||it<=r-1;){let x=et<=n,q=it<=r-1,Z=x?(_+et)%i:-1,u=q?(_-it+i*2)%i:-1,a=x&&(!q||t[Z*2+1]<=t[u*2+1]);D[g]=a?Z:u,j[g]=a?0:1,g++,a?et++:it++}let I=fn(i),V=0;I[V++]=D[0],I[V++]=D[1];for(let x=2;x<g;x++){let q=D[x],Z=t[q*2],u=t[q*2+1];if(j[x]!==j[x-1]){for(;V>1;){let a=I[--V],s=I[V-1];c(Z,u,t[a*2],t[a*2+1],t[s*2],t[s*2+1],m,v,o,d)}V=0,I[V++]=D[x-1],I[V++]=q}else{let a=j[x]===0?W:-W;for(;V>1;){let s=I[V-1],l=I[V-2];if(((t[s*2]-t[l*2])*(u-t[s*2+1])-(t[s*2+1]-t[l*2+1])*(Z-t[s*2]))*a<=0)break;V--,c(Z,u,t[s*2],t[s*2+1],t[l*2],t[l*2+1],m,v,o,d)}I[V++]=q}}return!0}var wo=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),Wt=32,Vt=32,Bt=32,Ot=12,hn=`#version 300 es
|
|
17
|
+
in vec2 aCorner;
|
|
18
|
+
in vec4 aRect; // x, y, w, h \u2014 CSS px
|
|
19
|
+
in vec4 aFill;
|
|
20
|
+
in vec4 aBorder;
|
|
21
|
+
in vec2 aShape; // corner radius, border width \u2014 CSS px
|
|
22
|
+
uniform vec2 uInvSize;
|
|
23
|
+
uniform float uPad;
|
|
24
|
+
out vec4 vFill;
|
|
25
|
+
out vec4 vBorder;
|
|
26
|
+
out vec2 vLocal;
|
|
27
|
+
out vec2 vHalf;
|
|
28
|
+
out float vRadius;
|
|
29
|
+
out float vBorderW;
|
|
30
|
+
void main() {
|
|
31
|
+
vec2 hf = abs(aRect.zw) * 0.5;
|
|
32
|
+
vec2 center = aRect.xy + aRect.zw * 0.5;
|
|
33
|
+
vec2 local = (aCorner - 0.5) * 2.0 * (hf + uPad);
|
|
34
|
+
gl_Position = vec4((center + local) * uInvSize + vec2(-1.0, 1.0), 0.0, 1.0);
|
|
35
|
+
vLocal = local;
|
|
36
|
+
vHalf = hf;
|
|
37
|
+
// Negative radius is the ellipse sentinel \u2014 keep it through to the frag.
|
|
38
|
+
vRadius = aShape.x < 0.0 ? -1.0 : clamp(aShape.x, 0.0, min(hf.x, hf.y));
|
|
39
|
+
vBorderW = aShape.y;
|
|
40
|
+
vFill = aFill;
|
|
41
|
+
vBorder = aBorder;
|
|
42
|
+
}`,dn=`#version 300 es
|
|
43
|
+
precision highp float;
|
|
44
|
+
in vec4 vFill;
|
|
45
|
+
in vec4 vBorder;
|
|
46
|
+
in vec2 vLocal;
|
|
47
|
+
in vec2 vHalf;
|
|
48
|
+
in float vRadius;
|
|
49
|
+
in float vBorderW;
|
|
50
|
+
out vec4 outColor;
|
|
51
|
+
float sdRoundBox(vec2 p, vec2 b, float r) {
|
|
52
|
+
vec2 q = abs(p) - b + r;
|
|
53
|
+
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r;
|
|
54
|
+
}
|
|
55
|
+
// Cheap signed distance to an axis-aligned ellipse. The exact form needs a
|
|
56
|
+
// quartic solve; this gradient-normalised approximation is well inside the
|
|
57
|
+
// ~1 device-px feather the AA below applies, and costs two length() calls.
|
|
58
|
+
float sdEllipse(vec2 p, vec2 r) {
|
|
59
|
+
vec2 rr = max(r, vec2(1e-4));
|
|
60
|
+
float k1 = length(p / rr);
|
|
61
|
+
float k2 = length(p / (rr * rr));
|
|
62
|
+
return (k1 - 1.0) * k1 / max(k2, 1e-6);
|
|
63
|
+
}
|
|
64
|
+
void main() {
|
|
65
|
+
float d = vRadius < 0.0 ? sdEllipse(vLocal, vHalf) : sdRoundBox(vLocal, vHalf, vRadius);
|
|
66
|
+
// fwidth gives a ~1 device-px feather; callers snap rects to the device grid
|
|
67
|
+
// so axis-aligned edges still resolve crisp.
|
|
68
|
+
float aa = max(fwidth(d), 1e-5);
|
|
69
|
+
float inside = 1.0 - smoothstep(-aa, aa, d);
|
|
70
|
+
if (inside <= 0.0) discard;
|
|
71
|
+
vec4 col = vFill;
|
|
72
|
+
if (vBorderW > 0.0) {
|
|
73
|
+
float core = 1.0 - smoothstep(-aa, aa, d + vBorderW);
|
|
74
|
+
col = mix(vBorder, vFill, core);
|
|
75
|
+
}
|
|
76
|
+
outColor = vec4(col.rgb, col.a * inside);
|
|
77
|
+
}`,mn=`#version 300 es
|
|
78
|
+
in vec2 aCorner;
|
|
79
|
+
in vec4 aSeg; // x1, y1, x2, y2 \u2014 CSS px
|
|
80
|
+
in vec4 aColor;
|
|
81
|
+
in vec3 aStyle; // width, dash, gap \u2014 CSS px
|
|
82
|
+
uniform vec2 uInvSize;
|
|
83
|
+
uniform float uMinW;
|
|
84
|
+
uniform float uPad;
|
|
85
|
+
out vec4 vColor;
|
|
86
|
+
out float vAlong;
|
|
87
|
+
out float vOff;
|
|
88
|
+
out float vHalfW;
|
|
89
|
+
out vec2 vDash;
|
|
90
|
+
void main() {
|
|
91
|
+
vec2 d = aSeg.zw - aSeg.xy;
|
|
92
|
+
float len = length(d);
|
|
93
|
+
vec2 dir = len > 1e-6 ? d / len : vec2(1.0, 0.0);
|
|
94
|
+
vec2 nrm = vec2(-dir.y, dir.x);
|
|
95
|
+
float w = max(aStyle.x, uMinW);
|
|
96
|
+
// Feather headroom on the CROSS axis only. Along the length the cap is butt,
|
|
97
|
+
// exactly like Canvas2D \u2014 padding there would overhang the endpoint by a px.
|
|
98
|
+
float ext = w * 0.5 + uPad;
|
|
99
|
+
float off = (aCorner.y - 0.5) * 2.0 * ext;
|
|
100
|
+
float along = aCorner.x * len;
|
|
101
|
+
vec2 pos = aSeg.xy + dir * along + nrm * off;
|
|
102
|
+
gl_Position = vec4(pos * uInvSize + vec2(-1.0, 1.0), 0.0, 1.0);
|
|
103
|
+
vColor = aColor;
|
|
104
|
+
vAlong = along;
|
|
105
|
+
vOff = off;
|
|
106
|
+
vHalfW = w * 0.5;
|
|
107
|
+
vDash = aStyle.yz;
|
|
108
|
+
}`,gn=`#version 300 es
|
|
109
|
+
precision highp float;
|
|
110
|
+
in vec4 vColor;
|
|
111
|
+
in float vAlong;
|
|
112
|
+
in float vOff;
|
|
113
|
+
in float vHalfW;
|
|
114
|
+
in vec2 vDash;
|
|
115
|
+
out vec4 outColor;
|
|
116
|
+
void main() {
|
|
117
|
+
if (vDash.x > 0.0) {
|
|
118
|
+
float cycle = vDash.x + vDash.y;
|
|
119
|
+
if (cycle > 0.0 && mod(vAlong, cycle) > vDash.x) discard;
|
|
120
|
+
}
|
|
121
|
+
float aa = max(fwidth(vOff), 1e-5);
|
|
122
|
+
float a = 1.0 - smoothstep(vHalfW - aa, vHalfW + aa, abs(vOff));
|
|
123
|
+
if (a <= 0.0) discard;
|
|
124
|
+
outColor = vec4(vColor.rgb, vColor.a * a);
|
|
125
|
+
}`,bn=`#version 300 es
|
|
126
|
+
in vec2 aCorner;
|
|
127
|
+
in vec4 aGeom; // cx, cy, radius, lineWidth \u2014 CSS px
|
|
128
|
+
in vec4 aFill;
|
|
129
|
+
in vec4 aStroke;
|
|
130
|
+
in vec4 aHi;
|
|
131
|
+
in float aMode; // 0 = flat disc, 1 = shaded bubble
|
|
132
|
+
uniform vec2 uInvSize;
|
|
133
|
+
uniform float uPad;
|
|
134
|
+
out vec4 vFill;
|
|
135
|
+
out vec4 vStroke;
|
|
136
|
+
out vec4 vHi;
|
|
137
|
+
out vec2 vLocal;
|
|
138
|
+
out float vRadius;
|
|
139
|
+
out float vLineW;
|
|
140
|
+
out float vMode;
|
|
141
|
+
void main() {
|
|
142
|
+
float ext = aGeom.z + max(aGeom.w, 0.0) + uPad;
|
|
143
|
+
vec2 local = (aCorner - 0.5) * 2.0 * ext;
|
|
144
|
+
gl_Position = vec4((aGeom.xy + local) * uInvSize + vec2(-1.0, 1.0), 0.0, 1.0);
|
|
145
|
+
vLocal = local;
|
|
146
|
+
vRadius = aGeom.z;
|
|
147
|
+
vLineW = aGeom.w;
|
|
148
|
+
vFill = aFill;
|
|
149
|
+
vStroke = aStroke;
|
|
150
|
+
vHi = aHi;
|
|
151
|
+
vMode = aMode;
|
|
152
|
+
}`,vn=`#version 300 es
|
|
153
|
+
precision highp float;
|
|
154
|
+
in vec4 vFill;
|
|
155
|
+
in vec4 vStroke;
|
|
156
|
+
in vec4 vHi;
|
|
157
|
+
in vec2 vLocal;
|
|
158
|
+
in float vRadius;
|
|
159
|
+
in float vLineW;
|
|
160
|
+
in float vMode;
|
|
161
|
+
out vec4 outColor;
|
|
162
|
+
void main() {
|
|
163
|
+
float d = length(vLocal) - vRadius;
|
|
164
|
+
float aa = max(fwidth(d), 1e-5);
|
|
165
|
+
float inside = 1.0 - smoothstep(-aa, aa, d);
|
|
166
|
+
if (inside <= 0.0) discard;
|
|
167
|
+
vec4 col = vFill;
|
|
168
|
+
if (vMode > 0.5) {
|
|
169
|
+
// Lambert-ish sheen from the upper-left, so a large print reads as a
|
|
170
|
+
// sphere rather than a flat dot (mirrors the Canvas2D Bubble3D gradient).
|
|
171
|
+
vec2 n = vLocal / max(vRadius, 1e-4);
|
|
172
|
+
float h = clamp(dot(normalize(vec2(-0.45, -0.55)), n) * 0.5 + 0.5, 0.0, 1.0);
|
|
173
|
+
col.rgb = mix(col.rgb, vHi.rgb, pow(h, 2.2) * vHi.a);
|
|
174
|
+
}
|
|
175
|
+
if (vLineW > 0.0) {
|
|
176
|
+
float core = 1.0 - smoothstep(-aa, aa, d + vLineW);
|
|
177
|
+
col = mix(vStroke, col, core);
|
|
178
|
+
}
|
|
179
|
+
outColor = vec4(col.rgb, col.a * inside);
|
|
180
|
+
}`,yn=`#version 300 es
|
|
181
|
+
in vec2 aPos;
|
|
182
|
+
in vec4 aColor;
|
|
183
|
+
uniform vec2 uInvSize;
|
|
184
|
+
out vec4 vColor;
|
|
185
|
+
void main() {
|
|
186
|
+
gl_Position = vec4(aPos * uInvSize + vec2(-1.0, 1.0), 0.0, 1.0);
|
|
187
|
+
vColor = aColor;
|
|
188
|
+
}`,An=`#version 300 es
|
|
189
|
+
precision highp float;
|
|
190
|
+
in vec4 vColor;
|
|
191
|
+
out vec4 outColor;
|
|
192
|
+
void main() { outColor = vColor; }`;function Ro(t,i,c){let m=t.createShader(i);if(t.shaderSource(m,c),t.compileShader(m),!t.getShaderParameter(m,t.COMPILE_STATUS)){let v=t.getShaderInfoLog(m);throw t.deleteShader(m),new Error(`shader compile failed: ${v}`)}return m}function we(t,i,c){let m=Ro(t,t.VERTEX_SHADER,i),v=Ro(t,t.FRAGMENT_SHADER,c),o=t.createProgram();if(t.attachShader(o,m),t.attachShader(o,v),t.linkProgram(o),t.deleteShader(m),t.deleteShader(v),!t.getProgramParameter(o,t.LINK_STATUS)){let d=t.getProgramInfoLog(o);throw t.deleteProgram(o),new Error(`program link failed: ${d}`)}return o}function yt(t,i,c,m,v,o=t.FLOAT,d=!1){i<0||(t.enableVertexAttribArray(i),t.vertexAttribPointer(i,c,o,d,m,v),t.vertexAttribDivisor(i,1))}function Fo(t,i){let c=(()=>{let d=we(t,hn,dn),_=t.createBuffer(),w=t.createVertexArray();t.bindVertexArray(w);let n=t.getAttribLocation(d,"aCorner");return t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,8,0),t.bindBuffer(t.ARRAY_BUFFER,_),yt(t,t.getAttribLocation(d,"aRect"),4,Wt,0),yt(t,t.getAttribLocation(d,"aFill"),4,Wt,16,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aBorder"),4,Wt,20,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aShape"),2,Wt,24),t.bindVertexArray(null),{prog:d,vbo:_,vao:w,uInvSize:t.getUniformLocation(d,"uInvSize"),uPad:t.getUniformLocation(d,"uPad")}})(),m=(()=>{let d=we(t,mn,gn),_=t.createBuffer(),w=t.createVertexArray();t.bindVertexArray(w);let n=t.getAttribLocation(d,"aCorner");return t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,8,0),t.bindBuffer(t.ARRAY_BUFFER,_),yt(t,t.getAttribLocation(d,"aSeg"),4,Vt,0),yt(t,t.getAttribLocation(d,"aColor"),4,Vt,16,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aStyle"),3,Vt,20),t.bindVertexArray(null),{prog:d,vbo:_,vao:w,uInvSize:t.getUniformLocation(d,"uInvSize"),uMinW:t.getUniformLocation(d,"uMinW"),uPad:t.getUniformLocation(d,"uPad")}})(),v=(()=>{let d=we(t,bn,vn),_=t.createBuffer(),w=t.createVertexArray();t.bindVertexArray(w);let n=t.getAttribLocation(d,"aCorner");return t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,8,0),t.bindBuffer(t.ARRAY_BUFFER,_),yt(t,t.getAttribLocation(d,"aGeom"),4,Bt,0),yt(t,t.getAttribLocation(d,"aFill"),4,Bt,16,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aStroke"),4,Bt,20,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aHi"),4,Bt,24,t.UNSIGNED_BYTE,!0),yt(t,t.getAttribLocation(d,"aMode"),1,Bt,28),t.bindVertexArray(null),{prog:d,vbo:_,vao:w,uInvSize:t.getUniformLocation(d,"uInvSize"),uPad:t.getUniformLocation(d,"uPad")}})(),o=(()=>{let d=we(t,yn,An),_=t.createBuffer(),w=t.createVertexArray();t.bindVertexArray(w),t.bindBuffer(t.ARRAY_BUFFER,_);let n=t.getAttribLocation(d,"aPos");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,Ot,0);let r=t.getAttribLocation(d,"aColor");return t.enableVertexAttribArray(r),t.vertexAttribPointer(r,4,t.UNSIGNED_BYTE,!0,Ot,8),t.bindVertexArray(null),{prog:d,vbo:_,vao:w,uInvSize:t.getUniformLocation(d,"uInvSize")}})();return{rect:c,seg:m,disc:v,tri:o}}function Mo(t,i){if(i){for(let c of[i.rect,i.seg,i.disc,i.tri])if(c){try{t.deleteBuffer(c.vbo)}catch{}try{t.deleteVertexArray(c.vao)}catch{}try{t.deleteProgram(c.prog)}catch{}}}}var Fe=0,So=1,xo=2,Lo=3,Do=4,pn=1024,Qe=65536;function Me(t){return{stride:t,cap:0,n:0,ab:null,f32:null,u8:null}}function Po(t,i){let c=t.n+i;if(c<=t.cap)return!0;if(t.n>0&&c>Qe)return!1;let m=t.cap||pn;for(;m<c;)m*=2;if(m>Qe&&(m=Qe),c>m)return!1;let v=new ArrayBuffer(m*t.stride),o=new Uint8Array(v);return t.u8&&t.n>0&&o.set(t.u8.subarray(0,t.n*t.stride)),t.ab=v,t.u8=o,t.f32=new Float32Array(v),t.cap=m,!0}function Io(t){let i=null,c=null;try{i=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,i),t.bufferData(t.ARRAY_BUFFER,wo,t.STATIC_DRAW),c=Fo(t,i)}catch(a){console.warn("[glVector] program init failed, staying on Canvas2D:",a?.message||a);try{i&&t.deleteBuffer(i)}catch{}return null}let m=Me(Wt),v=Me(Vt),o=Me(Bt),d=Me(Ot),_=Fe,w=null,n=1,r=1,e=1,F=!1,W=0,D=0,j=1;function g(a,s,l){n=a>0?a:1,r=s>0?s:1,e=l>0?l:1,j=1/e+.5}function et(){let a=t.drawingBufferHeight;if(w&&w.w>0&&w.h>0){let s=Math.round(w.x*e),l=Math.round(w.y*e),f=Math.max(1,Math.round(w.w*e)),h=Math.max(1,Math.round(w.h*e));t.enable(t.SCISSOR_TEST),t.scissor(s,a-(l+h),f,h)}else t.disable(t.SCISSOR_TEST)}function it(){t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.disable(t.DEPTH_TEST),t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),et()}function I(a,s){t.bindVertexArray(a.vao),t.bindBuffer(t.ARRAY_BUFFER,a.vbo),t.bufferData(t.ARRAY_BUFFER,s.u8.subarray(0,s.n*s.stride),t.DYNAMIC_DRAW),W++,D+=s.n}function V(){if(F||_===Fe)return;let a=2/n,s=-2/r;_===So&&m.n>0?(it(),t.useProgram(c.rect.prog),t.uniform2f(c.rect.uInvSize,a,s),t.uniform1f(c.rect.uPad,j),I(c.rect,m),t.drawArraysInstanced(t.TRIANGLES,0,6,m.n),m.n=0):_===xo&&v.n>0?(it(),t.useProgram(c.seg.prog),t.uniform2f(c.seg.uInvSize,a,s),t.uniform1f(c.seg.uPad,j),t.uniform1f(c.seg.uMinW,1/e),I(c.seg,v),t.drawArraysInstanced(t.TRIANGLES,0,6,v.n),v.n=0):_===Lo&&o.n>0?(it(),t.useProgram(c.disc.prog),t.uniform2f(c.disc.uInvSize,a,s),t.uniform1f(c.disc.uPad,j),I(c.disc,o),t.drawArraysInstanced(t.TRIANGLES,0,6,o.n),o.n=0):_===Do&&d.n>0&&(it(),t.useProgram(c.tri.prog),t.uniform2f(c.tri.uInvSize,a,s),I(c.tri,d),t.drawArrays(t.TRIANGLES,0,d.n),d.n=0),_=Fe,t.bindVertexArray(null),t.disable(t.SCISSOR_TEST)}function x(a,s,l){return!(F||(_!==a&&(V(),_=a),!Po(s,l)&&(V(),_=a,!Po(s,l))))}function q(a){let s=w;!s&&!a||s&&a&&s.x===a.x&&s.y===a.y&&s.w===a.w&&s.h===a.h||(V(),w=a||null)}function Z(a,s,l,f,h,b){return Eo(a,s,u,l,f,h,b)}function u(a,s,l,f,h,b,y,p,R,T){if(!x(Do,d,3))return;let E=d,S=E.n*3,M=E.n*Ot;E.f32[S]=a,E.f32[S+1]=s,E.u8[M+8]=y,E.u8[M+9]=p,E.u8[M+10]=R,E.u8[M+11]=T,S+=3,M+=Ot,E.f32[S]=l,E.f32[S+1]=f,E.u8[M+8]=y,E.u8[M+9]=p,E.u8[M+10]=R,E.u8[M+11]=T,S+=3,M+=Ot,E.f32[S]=h,E.f32[S+1]=b,E.u8[M+8]=y,E.u8[M+9]=p,E.u8[M+10]=R,E.u8[M+11]=T,E.n+=3}return{available:!0,setSize:g,setClip:q,flush:V,beginFrame(){W=0,D=0},get drawCalls(){return W},get instances(){return D},rect(a,s,l,f,h,b,y,p,R,T,E,S,M,O,N){if(!x(So,m,1))return;let H=N===1?$e(a,s,l,f,e):N===2?{x:a,y:s,w:l,h:f}:xt(a,s,l,f,e),U=m,L=U.n*8,B=U.n*Wt;U.f32[L]=H.x,U.f32[L+1]=H.y,U.f32[L+2]=H.w,U.f32[L+3]=H.h,U.u8[B+16]=h,U.u8[B+17]=b,U.u8[B+18]=y,U.u8[B+19]=p,U.u8[B+20]=E,U.u8[B+21]=S,U.u8[B+22]=M,U.u8[B+23]=O,U.f32[L+6]=R<0?-1:R>0?R:0,U.f32[L+7]=T>0?T:0,U.n++},seg(a,s,l,f,h,b,y,p,R,T,E){if(!x(xo,v,1))return;let S=v,M=S.n*8,O=S.n*Vt,N=a===l,H=s===f;S.f32[M]=N?at(a,R,e):a,S.f32[M+1]=H?at(s,R,e):s,S.f32[M+2]=N?at(l,R,e):l,S.f32[M+3]=H?at(f,R,e):f,S.u8[O+16]=h,S.u8[O+17]=b,S.u8[O+18]=y,S.u8[O+19]=p,S.f32[M+5]=R>0?R:1,S.f32[M+6]=T>0?T:0,S.f32[M+7]=E>0?E:0,S.n++},disc(a,s,l,f,h,b,y,p,R,T,E,S,M,O,N,H,U){if(!(l>0)||!x(Lo,o,1))return;let L=o,B=L.n*8,k=L.n*Bt;L.f32[B]=a,L.f32[B+1]=s,L.f32[B+2]=l,L.f32[B+3]=H>0?H:0,L.u8[k+16]=f,L.u8[k+17]=h,L.u8[k+18]=b,L.u8[k+19]=y,L.u8[k+20]=p,L.u8[k+21]=R,L.u8[k+22]=T,L.u8[k+23]=E,L.u8[k+24]=S,L.u8[k+25]=M,L.u8[k+26]=O,L.u8[k+27]=N,L.f32[B+7]=U===1?1:0,L.n++},tri:u,poly(a,s,l,f,h,b){if(!(s<3)){if(s===3){u(a[0],a[1],a[2],a[3],a[4],a[5],l,f,h,b);return}if(!Z(a,s,l,f,h,b))for(let y=1;y+1<s;y++)u(a[0],a[1],a[y*2],a[y*2+1],a[(y+1)*2],a[(y+1)*2+1],l,f,h,b)}},destroy(){if(!F){F=!0,_=Fe;try{Mo(t,c)}catch{}try{i&&t.deleteBuffer(i)}catch{}c=null,i=null;for(let a of[m,v,o,d])a.ab=null,a.f32=null,a.u8=null,a.cap=0,a.n=0}}}}var Tn=`#version 300 es
|
|
193
|
+
in vec2 aPos;
|
|
194
|
+
void main() { gl_Position = vec4(aPos, 0.0, 1.0); }`,_n=`#version 300 es
|
|
195
|
+
precision highp float;
|
|
196
|
+
uniform vec4 uTop; // colour at the top of the canvas (0..1, straight alpha)
|
|
197
|
+
uniform vec4 uBot; // colour at the bottom of the canvas
|
|
198
|
+
uniform float uH; // canvas height in device px
|
|
199
|
+
uniform float uDither;
|
|
200
|
+
out vec4 frag;
|
|
201
|
+
// Break 8-bit vertical-gradient banding ("s\u1ECDc ngang" on Windows). Two culprits:
|
|
202
|
+
// 1. ANGLE/D3D interpolates a vertex-colour "varying" at REDUCED precision,
|
|
203
|
+
// so the ramp is already stepped BEFORE any dither \u2014 a \xB11 LSB jitter then
|
|
204
|
+
// only wiggles the existing steps. So we compute the ramp HERE at highp
|
|
205
|
+
// from gl_FragCoord.y (1 = top of canvas, 0 = bottom), giving a full-
|
|
206
|
+
// precision gradient the driver can't pre-quantise.
|
|
207
|
+
// 2. The 8-bit backbuffer write itself bands; macOS/Metal dithers natively,
|
|
208
|
+
// D3D does not. We add per-pixel triangular-PDF noise of \xB11 LSB (1/255)
|
|
209
|
+
// to randomise the rounding. Gated by uDither (0 for a solid bg \u2192 no
|
|
210
|
+
// grain on flat fills). gl_FragCoord.xy makes it screen-stable (no shimmer).
|
|
211
|
+
float _h(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
|
|
212
|
+
void main() {
|
|
213
|
+
float f = clamp(gl_FragCoord.y / uH, 0.0, 1.0);
|
|
214
|
+
vec3 c = mix(uBot.rgb, uTop.rgb, f);
|
|
215
|
+
float a = mix(uBot.a, uTop.a, f);
|
|
216
|
+
float d = (_h(gl_FragCoord.xy) + _h(gl_FragCoord.xy + 0.5) - 1.0) / 255.0;
|
|
217
|
+
frag = vec4(c + d * uDither, a);
|
|
218
|
+
}`,En=`#version 300 es
|
|
219
|
+
in vec2 aPos;
|
|
220
|
+
in vec2 aTex;
|
|
221
|
+
out vec2 vTex;
|
|
222
|
+
void main() { vTex = aTex; gl_Position = vec4(aPos, 0.0, 1.0); }`,Rn=`#version 300 es
|
|
223
|
+
precision highp float;
|
|
224
|
+
in vec2 vTex;
|
|
225
|
+
uniform sampler2D uIntensity;
|
|
226
|
+
uniform sampler2D uLut;
|
|
227
|
+
out vec4 frag;
|
|
228
|
+
void main() {
|
|
229
|
+
// R8 intensity \u2192 0..1 (= baked byte / 255). LUT is 256 wide; pick the exact
|
|
230
|
+
// texel the Canvas2D path used: idx = (byte + 0.5) / 256 with NEAREST. Empty
|
|
231
|
+
// cells bake to 0 and LUT[0].a == 0 (every scheme), so they read transparent
|
|
232
|
+
// \u2014 identical to the Canvas2D (0,0,0,0) path.
|
|
233
|
+
float i = texture(uIntensity, vTex).r;
|
|
234
|
+
float idx = (i * 255.0 + 0.5) / 256.0;
|
|
235
|
+
frag = texture(uLut, vec2(idx, 0.5)); // straight (non-premultiplied) alpha
|
|
236
|
+
}`,wn=`#version 300 es
|
|
237
|
+
precision highp float;
|
|
238
|
+
in vec2 vTex;
|
|
239
|
+
uniform sampler2D uIntensity;
|
|
240
|
+
uniform sampler2D uLut;
|
|
241
|
+
uniform float uShiftX;
|
|
242
|
+
out vec4 frag;
|
|
243
|
+
// texelFetch ignores the sampler filter, so the texture stays NEAREST.
|
|
244
|
+
vec4 _col(int x, int y, ivec2 sz) {
|
|
245
|
+
float i = texelFetch(uIntensity, ivec2(clamp(x, 0, sz.x - 1), y), 0).r;
|
|
246
|
+
vec4 c = texture(uLut, vec2((i * 255.0 + 0.5) / 256.0, 0.5));
|
|
247
|
+
return vec4(c.rgb * c.a, c.a);
|
|
248
|
+
}
|
|
249
|
+
void main() {
|
|
250
|
+
ivec2 sz = textureSize(uIntensity, 0);
|
|
251
|
+
int x = int(floor(vTex.x * float(sz.x)));
|
|
252
|
+
int y = clamp(int(floor(vTex.y * float(sz.y))), 0, sz.y - 1);
|
|
253
|
+
vec4 m = _col(x, y, sz);
|
|
254
|
+
// Uniform branch \u2014 free, and it keeps the zoomed-in path at one fetch.
|
|
255
|
+
if (uShiftX > 0.0) {
|
|
256
|
+
m = mix(m, _col(x + 1, y, sz), uShiftX);
|
|
257
|
+
}
|
|
258
|
+
frag = m.a > 0.002 ? vec4(m.rgb / m.a, m.a) : vec4(0.0);
|
|
259
|
+
}`,Fn=`#version 300 es
|
|
260
|
+
in vec3 aPos; // cell-local: x,z \u2208 [0,1]; y = 0 base / 1 top
|
|
261
|
+
in vec3 aNormal; // object-space face normal
|
|
262
|
+
uniform sampler2D uIntensity;
|
|
263
|
+
uniform mat4 uMvp;
|
|
264
|
+
uniform vec4 uSrc; // sx, sy, sw, sh (texels)
|
|
265
|
+
uniform vec2 uTexSize;
|
|
266
|
+
uniform vec2 uGrid; // cells across, cells deep
|
|
267
|
+
uniform vec2 uExtent; // half-size in x (time) and z (price) \u2014 pane aspect
|
|
268
|
+
uniform float uDepth; // world height at full intensity
|
|
269
|
+
uniform vec3 uEye; // camera position, world space
|
|
270
|
+
out float vI;
|
|
271
|
+
out vec3 vN;
|
|
272
|
+
out vec3 vView; // surface \u2192 eye
|
|
273
|
+
void main() {
|
|
274
|
+
float nx = uGrid.x;
|
|
275
|
+
float ny = uGrid.y;
|
|
276
|
+
float cx = mod(float(gl_InstanceID), nx);
|
|
277
|
+
float cy = floor(float(gl_InstanceID) / nx);
|
|
278
|
+
// One sample per CELL (its centre) so the whole box is one flat colour \u2014
|
|
279
|
+
// that is what keeps the edges hard.
|
|
280
|
+
vec2 texel = uSrc.xy + (vec2(cx, cy) + 0.5) / vec2(nx, ny) * uSrc.zw;
|
|
281
|
+
ivec2 ip = ivec2(clamp(texel, vec2(0.0), uTexSize - 1.0));
|
|
282
|
+
float i = texelFetch(uIntensity, ip, 0).r;
|
|
283
|
+
if (i <= 0.0) {
|
|
284
|
+
gl_Position = vec4(2.0, 2.0, 2.0, 1.0); // off-clip \u21D2 culled, no fragments
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
vI = i;
|
|
288
|
+
// Same layout as 2-D: x = time across the pane, z = price down the pane.
|
|
289
|
+
// Extent matches the pane's aspect so the field IS the chart, not a square
|
|
290
|
+
// floating in it (that square is what got cropped on the sides).
|
|
291
|
+
float h = max(i * uDepth, uDepth * 0.02);
|
|
292
|
+
vec3 w = vec3(
|
|
293
|
+
((cx + aPos.x) / nx * 2.0 - 1.0) * uExtent.x,
|
|
294
|
+
aPos.y * h,
|
|
295
|
+
((cy + aPos.z) / ny * 2.0 - 1.0) * uExtent.y
|
|
296
|
+
);
|
|
297
|
+
vN = aNormal;
|
|
298
|
+
vView = uEye - w;
|
|
299
|
+
gl_Position = uMvp * vec4(w, 1.0);
|
|
300
|
+
}`,Mn=`#version 300 es
|
|
301
|
+
precision highp float;
|
|
302
|
+
in float vI;
|
|
303
|
+
in vec3 vN;
|
|
304
|
+
in vec3 vView;
|
|
305
|
+
uniform sampler2D uLut;
|
|
306
|
+
uniform vec3 uLightDir; // TOWARD the light, world space, normalised
|
|
307
|
+
uniform float uRough; // 0 = mirror, 1 = fully diffuse
|
|
308
|
+
uniform float uMetal; // 0 = dielectric, 1 = metal
|
|
309
|
+
uniform float uAmbient;
|
|
310
|
+
out vec4 frag;
|
|
311
|
+
void main() {
|
|
312
|
+
vec4 c = texture(uLut, vec2((vI * 255.0 + 0.5) / 256.0, 0.5));
|
|
313
|
+
if (c.a <= 0.002) discard; // empty cells stay empty
|
|
314
|
+
vec3 albedo = c.rgb;
|
|
315
|
+
vec3 N = normalize(vN);
|
|
316
|
+
vec3 V = normalize(vView);
|
|
317
|
+
vec3 L = normalize(uLightDir);
|
|
318
|
+
vec3 H = normalize(L + V);
|
|
319
|
+
float ndl = max(dot(N, L), 0.0);
|
|
320
|
+
// Blinn-Phong standing in for a GGX lobe: roughness \u2192 exponent. Cheap, and
|
|
321
|
+
// at this geometry density the difference is not visible.
|
|
322
|
+
float shine = mix(180.0, 4.0, clamp(uRough, 0.0, 1.0));
|
|
323
|
+
float spec = pow(max(dot(N, H), 0.0), shine) * (1.0 - clamp(uRough, 0.0, 1.0));
|
|
324
|
+
// A metal tints its highlight with its own colour and kills the diffuse; a
|
|
325
|
+
// dielectric keeps a white highlight over full diffuse.
|
|
326
|
+
vec3 specTint = mix(vec3(1.0), albedo, clamp(uMetal, 0.0, 1.0));
|
|
327
|
+
vec3 diffuse = albedo * (uAmbient + ndl * (1.0 - 0.65 * clamp(uMetal, 0.0, 1.0)));
|
|
328
|
+
// Rim: a Fresnel-ish edge light so a box reads against the box behind it
|
|
329
|
+
// even when both faces point away from the lamp.
|
|
330
|
+
float rim = pow(1.0 - max(dot(N, V), 0.0), 3.0) * 0.35;
|
|
331
|
+
vec3 col = diffuse + specTint * spec + albedo * rim;
|
|
332
|
+
frag = vec4(clamp(col, 0.0, 1.0), 1.0);
|
|
333
|
+
}`,Sn=224,xn=168,Ln=.14,Dn=`#version 300 es
|
|
334
|
+
in vec2 aQuad; // unit quad, \u22121..1
|
|
335
|
+
in vec4 aPrint; // world x, world y, world z, radius (world)
|
|
336
|
+
in float aSide; // +1 buy, \u22121 sell
|
|
337
|
+
uniform mat4 uView;
|
|
338
|
+
uniform mat4 uProj;
|
|
339
|
+
out vec2 vUv;
|
|
340
|
+
out float vSide;
|
|
341
|
+
void main() {
|
|
342
|
+
vec4 eye = uView * vec4(aPrint.xyz, 1.0);
|
|
343
|
+
eye.xy += aQuad * aPrint.w;
|
|
344
|
+
vUv = aQuad;
|
|
345
|
+
vSide = aSide;
|
|
346
|
+
gl_Position = uProj * eye;
|
|
347
|
+
}`,Pn=`#version 300 es
|
|
348
|
+
precision highp float;
|
|
349
|
+
in vec2 vUv;
|
|
350
|
+
in float vSide;
|
|
351
|
+
uniform vec3 uBuy;
|
|
352
|
+
uniform vec3 uSell;
|
|
353
|
+
out vec4 frag;
|
|
354
|
+
void main() {
|
|
355
|
+
float r2 = dot(vUv, vUv);
|
|
356
|
+
if (r2 > 1.0) discard; // round, not a square
|
|
357
|
+
// Shade the disc like a sphere: the normal falls out of the quad coords, so
|
|
358
|
+
// a print reads as a bead sitting in the scene rather than a flat dot.
|
|
359
|
+
vec3 n = vec3(vUv, sqrt(max(1.0 - r2, 0.0)));
|
|
360
|
+
vec3 base = vSide >= 0.0 ? uBuy : uSell;
|
|
361
|
+
float ndl = clamp(dot(n, normalize(vec3(-0.4, 0.5, 0.75))), 0.0, 1.0);
|
|
362
|
+
float spec = pow(ndl, 24.0) * 0.5;
|
|
363
|
+
frag = vec4(clamp(base * (0.45 + 0.75 * ndl) + spec, 0.0, 1.0), 1.0);
|
|
364
|
+
}`,In=`#version 300 es
|
|
365
|
+
in vec3 aPos;
|
|
366
|
+
uniform mat4 uMvp;
|
|
367
|
+
void main() { gl_Position = uMvp * vec4(aPos, 1.0); }`,Cn=`#version 300 es
|
|
368
|
+
precision highp float;
|
|
369
|
+
uniform vec4 uColor;
|
|
370
|
+
out vec4 frag;
|
|
371
|
+
void main() { frag = uColor; }`,Je=8,Bn=`#version 300 es
|
|
372
|
+
precision highp float;
|
|
373
|
+
in vec2 vTex;
|
|
374
|
+
uniform sampler2D uIntensity;
|
|
375
|
+
uniform sampler2D uLut;
|
|
376
|
+
uniform vec2 uTexel; // 1 / texture size
|
|
377
|
+
uniform ivec2 uTaps; // texels collapsing into one pixel, per axis (>= 1)
|
|
378
|
+
out vec4 frag;
|
|
379
|
+
const int MAX_TAPS = ${Je};
|
|
380
|
+
void main() {
|
|
381
|
+
vec2 half0 = 0.5 * (vec2(uTaps) - 1.0);
|
|
382
|
+
float m = 0.0;
|
|
383
|
+
// Constant loop bounds + break: a uniform-bounded loop is legal in GLSL ES
|
|
384
|
+
// 3.0 but some drivers handle it badly.
|
|
385
|
+
for (int j = 0; j < MAX_TAPS; ++j) {
|
|
386
|
+
if (j >= uTaps.y) break;
|
|
387
|
+
for (int i = 0; i < MAX_TAPS; ++i) {
|
|
388
|
+
if (i >= uTaps.x) break;
|
|
389
|
+
vec2 o = (vec2(float(i), float(j)) - half0) * uTexel;
|
|
390
|
+
m = max(m, texture(uIntensity, vTex + o).r);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
frag = texture(uLut, vec2((m * 255.0 + 0.5) / 256.0, 0.5));
|
|
394
|
+
}`;function Co(t,i,c){let m=t.createShader(i);if(t.shaderSource(m,c),t.compileShader(m),!t.getShaderParameter(m,t.COMPILE_STATUS)){let v=t.getShaderInfoLog(m);throw t.deleteShader(m),new Error("shader compile failed: "+v)}return m}function ce(t,i,c){let m=Co(t,t.VERTEX_SHADER,i),v=Co(t,t.FRAGMENT_SHADER,c),o=t.createProgram();if(t.attachShader(o,m),t.attachShader(o,v),t.linkProgram(o),t.deleteShader(m),t.deleteShader(v),!t.getProgramParameter(o,t.LINK_STATUS)){let d=t.getProgramInfoLog(o);throw t.deleteProgram(o),new Error("program link failed: "+d)}return o}function Un(t,i){let c=new Float32Array(16);for(let m=0;m<4;m++)for(let v=0;v<4;v++)c[m*4+v]=t[v]*i[m*4]+t[4+v]*i[m*4+1]+t[8+v]*i[m*4+2]+t[12+v]*i[m*4+3];return c}function kn(t,i,c,m){let v=1/Math.tan(t/2),o=1/(c-m),d=new Float32Array(16);return d[0]=v/i,d[5]=v,d[10]=(m+c)*o,d[11]=-1,d[14]=2*m*c*o,d}function Hn(t,i,c){let m=t[0]-i[0],v=t[1]-i[1],o=t[2]-i[2],d=Math.hypot(m,v,o)||1;m/=d,v/=d,o/=d;let _=c[1]*o-c[2]*v,w=c[2]*m-c[0]*o,n=c[0]*v-c[1]*m,r=Math.hypot(_,w,n)||1;_/=r,w/=r,n/=r;let e=v*n-o*w,F=o*_-m*n,W=m*w-v*_,D=new Float32Array(16);return D[0]=_,D[1]=e,D[2]=m,D[3]=0,D[4]=w,D[5]=F,D[6]=v,D[7]=0,D[8]=n,D[9]=W,D[10]=o,D[11]=0,D[12]=-(_*t[0]+w*t[1]+n*t[2]),D[13]=-(e*t[0]+F*t[1]+W*t[2]),D[14]=-(m*t[0]+v*t[1]+o*t[2]),D[15]=1,D}function Nn(t,i,c,m,v,o,d,_){let w=Math.cos(i),n=Math.sin(i),r=Math.sin(t),e=Math.cos(t),F=r*w,W=n,D=e*w,j=D,g=-F,et=Math.hypot(j,g)||1;j/=et,g/=et;let it=W*g,I=D*j-F*g,V=-W*j,x=1/Math.tan(Math.max(.05,c)/2),q=x/Math.max(m,1e-6),Z=Math.max(.5,Math.min(.92,_)),u=.05,a=1/0,s=-1/0;for(let l=0;l<8;l++){let f=(l&1?1:-1)*v,h=(l&2?1:-1)*o,b=(l&4?1:-1)*d,y=f*F+h*W+b*D,p=f*j+b*g,R=f*it+h*I+b*V;y<a&&(a=y),y>s&&(s=y),u=Math.max(u,y+Math.abs(q*p)/Z,y+Math.abs(x*R)/Z)}return{d:u,alongMin:a,alongMax:s}}function Bo(t,i={}){let c=typeof i.fetchLut=="function"?i.fetchLut:()=>new Uint8Array(1024),m=typeof i.onContextLost=="function"?i.onContextLost:null,v=i.desynchronized===!0,o=null;try{o=t.getContext("webgl2",{alpha:!0,premultipliedAlpha:!1,antialias:!1,depth:!0,stencil:!1,preserveDrawingBuffer:!1,desynchronized:v})}catch{o=null}if(!o)return{available:!1,dispatch(){},resize(){},destroy(){},ensureHd:()=>!1};let d=!0,_=null,w=Math.max(1,Re()),n=(()=>{try{return o.getParameter(o.MAX_TEXTURE_SIZE)||4096}catch{return 4096}})(),r=null,e=-1,F=null,W=null,D=null,j=null,g=null,et=null,it=!1,I=null,V=!1,x=null,q=!1,Z=null,u=null,a=0,s=null,l=null,f=null,h=null,b=null,y=!1,p=null,R=1,T=1,E={on:!1,depth:.5,yaw:-.18,pitch:1.22,zoom:1,fov:42,rough:.55,metal:.15,ambient:.28,lightYaw:-.9,lightPitch:.85};function S(A){let C=ce(o,En,A);return{prog:C,aPos:o.getAttribLocation(C,"aPos"),aTex:o.getAttribLocation(C,"aTex"),uInt:o.getUniformLocation(C,"uIntensity"),uLut:o.getUniformLocation(C,"uLut"),uTexel:o.getUniformLocation(C,"uTexel"),uTaps:o.getUniformLocation(C,"uTaps"),uShiftX:o.getUniformLocation(C,"uShiftX")}}try{r=ce(o,Tn,_n),g=S(Rn),e=o.getAttribLocation(r,"aPos"),F=o.getUniformLocation(r,"uTop"),W=o.getUniformLocation(r,"uBot"),D=o.getUniformLocation(r,"uH"),j=o.getUniformLocation(r,"uDither")}catch(A){return console.warn("[webglHeatmap] program init failed, falling back:",A?.message||A),{available:!1,dispatch(){},resize(){},destroy(){},ensureHd:()=>!1}}function M(){if(!d||q)return!1;if(x)return!0;try{let A=ce(o,Fn,Mn);return x={prog:A,aPos:o.getAttribLocation(A,"aPos"),aNormal:o.getAttribLocation(A,"aNormal"),uInt:o.getUniformLocation(A,"uIntensity"),uLut:o.getUniformLocation(A,"uLut"),uMvp:o.getUniformLocation(A,"uMvp"),uSrc:o.getUniformLocation(A,"uSrc"),uTexSize:o.getUniformLocation(A,"uTexSize"),uGrid:o.getUniformLocation(A,"uGrid"),uExtent:o.getUniformLocation(A,"uExtent"),uDepth:o.getUniformLocation(A,"uDepth"),uEye:o.getUniformLocation(A,"uEye"),uLightDir:o.getUniformLocation(A,"uLightDir"),uRough:o.getUniformLocation(A,"uRough"),uMetal:o.getUniformLocation(A,"uMetal"),uAmbient:o.getUniformLocation(A,"uAmbient")},!0}catch(A){return q=!0,console.warn("[webglHeatmap] 3D program unavailable, staying 2D:",A?.message||A),!1}}function O(){if(Z)return!0;let A=[[[0,1,0],[0,1,1],[1,1,1],[1,1,0]],[0,1,0],[[0,0,0],[1,0,0],[1,0,1],[0,0,1]],[0,-1,0],[[1,0,0],[1,1,0],[1,1,1],[1,0,1]],[1,0,0],[[0,0,0],[0,0,1],[0,1,1],[0,1,0]],[-1,0,0],[[0,0,1],[1,0,1],[1,1,1],[0,1,1]],[0,0,1],[[0,0,0],[0,1,0],[1,1,0],[1,0,0]],[0,0,-1]],C=new Float32Array(6*4*6),X=new Uint16Array(6*6),Y=0,lt=0;for(let ht=0;ht<6;ht++){let Et=A[ht*2],ct=A[ht*2+1],K=ht*4;for(let ot of Et)C[Y++]=ot[0],C[Y++]=ot[1],C[Y++]=ot[2],C[Y++]=ct[0],C[Y++]=ct[1],C[Y++]=ct[2];X[lt++]=K,X[lt++]=K+1,X[lt++]=K+2,X[lt++]=K,X[lt++]=K+2,X[lt++]=K+3}return Z=o.createBuffer(),u=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,Z),o.bufferData(o.ARRAY_BUFFER,C,o.STATIC_DRAW),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.bufferData(o.ELEMENT_ARRAY_BUFFER,X,o.STATIC_DRAW),a=X.length,!0}function N(){if(!d||it)return!1;if(et)return!0;try{return et=S(Bn),!0}catch(A){return it=!0,console.warn("[webglHeatmap] HD program unavailable, staying on SD:",A?.message||A),!1}}function H(){if(V)return!1;if(I)return!0;try{return I=S(wn),!0}catch(A){return V=!0,console.warn("[webglHeatmap] sub-pixel program unavailable, staying on SD:",A?.message||A),!1}}let U=o.createBuffer(),L=o.createBuffer(),B=new Float32Array(6*4);o.bindBuffer(o.ARRAY_BUFFER,U),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,1,-1,-1,1,1,1,1,-1,-1,1,-1]),o.STATIC_DRAW);let k=[];function Q(A){let C=k[A];return C||(C={tex:o.createTexture(),cols:0,rows:0},o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,C.tex),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),k[A]=C,C)}let P=o.createTexture(),J=-1;o.bindTexture(o.TEXTURE_2D,P),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.pixelStorei(o.UNPACK_ALIGNMENT,1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),o.disable(o.DEPTH_TEST),o.enable(o.BLEND),o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);function Nt(A){if(A.preventDefault(),d=!1,_=null,m)try{m()}catch{}}t.addEventListener("webglcontextlost",Nt,!1);function Zt(A){let C;try{C=c(A)}catch{C=null}!C||C.length<256*4||(o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,P),o.texImage2D(o.TEXTURE_2D,0,o.RGBA8,256,1,0,o.RGBA,o.UNSIGNED_BYTE,C.length===256*4?C:C.subarray(0,256*4)),o.activeTexture(o.TEXTURE0))}function te(A,C,X){d&&(w=X>0?X:Math.max(1,Re()),o.drawingBufferWidth>0&&o.viewport(0,0,A,C),_&&_.setSize(A/w,C/w,w))}function rt(A,C,X,Y,lt,ht,Et,ct,K){if(!d)return;_&&(_.flush(),_.beginFrame());let ot=t.width,Rt=t.height;o.viewport(0,0,ot,Rt),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT);let nt=A/255,ut=C/255,dt=X/255,gt=Y/255,bt=K?lt/255:nt,St=K?ht/255:ut,wt=K?Et/255:dt,Dt=K?ct/255:gt;o.useProgram(r),o.uniform4f(F,nt,ut,dt,gt),o.uniform4f(W,bt,St,wt,Dt),o.uniform1f(D,Rt),o.uniform1f(j,K?1:0),o.bindBuffer(o.ARRAY_BUFFER,U),o.enableVertexAttribArray(e),o.vertexAttribPointer(e,2,o.FLOAT,!1,8,0),o.drawArrays(o.TRIANGLES,0,6)}function ft(A,C){if(!d)return;_&&_.flush();let X=A.worldCols,Y=A.worldRows;if(X===0||Y===0||X>n||Y>n)return;let lt=1,ht=1;A.hd&&A.destW>0&&A.destH>0&&A.srcW>0&&A.srcH>0&&(lt=Math.min(Je,Math.max(1,Math.ceil(A.srcW/(A.destW*w)))),ht=Math.min(Je,Math.max(1,Math.ceil(A.srcH/(A.destH*w)))));let Et=lt>1||ht>1;if(Et&&!N())return;let ct=!Et&&A.subpx===!0&&H(),K=Et?et:ct?I:g;A.lutSeq!==J&&(Zt(A.lutSeq),J=A.lutSeq);let ot=Q(A.layer===1?1:0);if(o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,P),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,ot.tex),(A.fullRebuild||X!==ot.cols||Y!==ot.rows)&&(o.texImage2D(o.TEXTURE_2D,0,o.R8,X,Y,0,o.RED,o.UNSIGNED_BYTE,null),ot.cols=X,ot.rows=Y),A.patchW>0&&A.patchH>0&&C&&C.length>=A.patchW*A.patchH&&o.texSubImage2D(o.TEXTURE_2D,0,A.patchX,A.patchY,A.patchW,A.patchH,o.RED,o.UNSIGNED_BYTE,C),!(A.srcW>0&&A.srcH>0&&A.destW>0&&A.destH>0))return;let Rt=t.width,nt=t.height,ut=A.destX*w,dt=A.destY*w,gt=ut+Math.max(1,A.destW*w),bt=dt+Math.max(1,A.destH*w),St=ut/Rt*2-1,wt=gt/Rt*2-1,Dt=1-dt/nt*2,ne=1-bt/nt*2,Yt=A.srcX/X,Be=(A.srcX+A.srcW)/X,Ue=A.srcY/Y,ke=(A.srcY+A.srcH)/Y,Pt=A.clip;if(E.on&&M()&&O()){let It=Math.max(2,Math.min(Sn,Math.round(A.srcW))),ge=Math.max(2,Math.min(xn,Math.round(A.srcH))),be=Math.round((Pt?Pt.x:A.destX)*w),re=Math.round((Pt?Pt.y:A.destY)*w),He=Math.max(1,Math.round((Pt?Pt.w:A.destW)*w)),ae=Math.max(1,Math.round((Pt?Pt.h:A.destH)*w));o.viewport(be,nt-(re+ae),He,ae),o.enable(o.SCISSOR_TEST),o.scissor(be,nt-(re+ae),He,ae);let ve=Math.max(.08,Math.min(1.5,E.pitch)),fo=Math.max(.02,E.depth)+Ln,ye=[0,fo*.5,0],ho=E.fov*Math.PI/180,Ne=He/ae;R=Math.max(.2,Ne),T=1;let We=Nn(E.yaw,ve,ho,Ne,R,fo*.5,T,.92),ie=We.d*Math.max(.35,Math.min(3,E.zoom)),Ae=[ye[0]+Math.sin(E.yaw)*Math.cos(ve)*ie,ye[1]+Math.sin(ve)*ie,ye[2]+Math.cos(E.yaw)*Math.cos(ve)*ie],mo=Math.max(.02,(ie-We.alongMax)*.45),$o=Math.max(mo+1,(ie-We.alongMin)*1.8),go=kn(ho,Ne,mo,$o),bo=Hn(Ae,ye,[0,1,0]),vo=Un(go,bo),Oe=E.lightPitch,Ge=[Math.sin(E.lightYaw)*Math.cos(Oe),Math.sin(Oe),Math.cos(E.lightYaw)*Math.cos(Oe)];o.enable(o.DEPTH_TEST),o.depthFunc(o.LEQUAL),o.depthMask(!0),o.clear(o.DEPTH_BUFFER_BIT),o.enable(o.CULL_FACE),o.cullFace(o.BACK),o.frontFace(o.CCW),o.useProgram(x.prog),o.uniform1i(x.uInt,0),o.uniform1i(x.uLut,1),o.uniformMatrix4fv(x.uMvp,!1,vo),o.uniform4f(x.uSrc,A.srcX,A.srcY,A.srcW,A.srcH),o.uniform2f(x.uTexSize,X,Y),o.uniform2f(x.uGrid,It,ge),o.uniform2f(x.uExtent,R,T),o.uniform1f(x.uDepth,Math.max(.02,E.depth)),o.uniform3f(x.uEye,Ae[0],Ae[1],Ae[2]),o.uniform3f(x.uLightDir,Ge[0],Ge[1],Ge[2]),o.uniform1f(x.uRough,E.rough),o.uniform1f(x.uMetal,E.metal),o.uniform1f(x.uAmbient,E.ambient),o.bindBuffer(o.ARRAY_BUFFER,Z),o.enableVertexAttribArray(x.aPos),o.vertexAttribPointer(x.aPos,3,o.FLOAT,!1,24,0),o.enableVertexAttribArray(x.aNormal),o.vertexAttribPointer(x.aNormal,3,o.FLOAT,!1,24,12),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,u),o.drawElementsInstanced(o.TRIANGLES,a,o.UNSIGNED_SHORT,0,It*ge),o.disable(o.CULL_FACE),Xo(bo,go,vo),o.disable(o.CULL_FACE),o.disable(o.DEPTH_TEST),o.disable(o.SCISSOR_TEST),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,null),o.viewport(0,0,Rt,nt);return}let tt=B;if(tt[0]=St,tt[1]=Dt,tt[2]=Yt,tt[3]=Ue,tt[4]=St,tt[5]=ne,tt[6]=Yt,tt[7]=ke,tt[8]=wt,tt[9]=Dt,tt[10]=Be,tt[11]=Ue,tt[12]=wt,tt[13]=Dt,tt[14]=Be,tt[15]=Ue,tt[16]=St,tt[17]=ne,tt[18]=Yt,tt[19]=ke,tt[20]=wt,tt[21]=ne,tt[22]=Be,tt[23]=ke,o.useProgram(K.prog),o.uniform1i(K.uInt,0),o.uniform1i(K.uLut,1),Et&&(o.uniform2f(K.uTexel,1/X,1/Y),o.uniform2i(K.uTaps,lt,ht)),K.uShiftX){let It=A.subTexelX;o.uniform1f(K.uShiftX,It>0&&It<1?It:0)}o.bindBuffer(o.ARRAY_BUFFER,L),o.bufferData(o.ARRAY_BUFFER,tt,o.DYNAMIC_DRAW),o.enableVertexAttribArray(K.aPos),o.vertexAttribPointer(K.aPos,2,o.FLOAT,!1,16,0),o.enableVertexAttribArray(K.aTex),o.vertexAttribPointer(K.aTex,2,o.FLOAT,!1,16,8);let Ft=A.clip;if(Ft&&Ft.w>0&&Ft.h>0){let It=Math.round(Ft.x*w),ge=Math.round(Ft.y*w),be=Math.max(1,Math.round(Ft.w*w)),re=Math.max(1,Math.round(Ft.h*w));o.enable(o.SCISSOR_TEST),o.scissor(It,nt-(ge+re),be,re)}o.drawArrays(o.TRIANGLES,0,6),Ft&&Ft.w>0&&Ft.h>0&&o.disable(o.SCISSOR_TEST)}function st(){d=!1;try{t.removeEventListener("webglcontextlost",Nt,!1)}catch{}try{_?.destroy()}catch{}_=null;try{o.deleteBuffer(U),o.deleteBuffer(L),Z&&o.deleteBuffer(Z),u&&o.deleteBuffer(u);for(let C of k)C&&o.deleteTexture(C.tex);k.length=0,o.deleteTexture(P),o.deleteProgram(r),g&&o.deleteProgram(g.prog),et&&o.deleteProgram(et.prog),I&&o.deleteProgram(I.prog),x&&o.deleteProgram(x.prog);let A=o.getExtension("WEBGL_lose_context");A&&A.loseContext()}catch{}g=null,et=null,I=null,x=null,Z=null,u=null,a=0,o=null}function ee(A){if(!A)return;let C=(Y,lt)=>Number.isFinite(+Y)?+Y:lt,X={...E,...A};E={on:X.on===!0,depth:Math.max(.02,Math.min(4,C(X.depth,.5))),yaw:C(X.yaw,-.18),pitch:Math.max(.08,Math.min(1.5,C(X.pitch,1.22))),zoom:Math.max(.35,Math.min(3,C(X.zoom,1))),fov:Math.max(15,Math.min(80,C(X.fov,42))),rough:Math.max(0,Math.min(1,C(X.rough,.55))),metal:Math.max(0,Math.min(1,C(X.metal,.15))),ambient:Math.max(0,Math.min(1,C(X.ambient,.28))),lightYaw:C(X.lightYaw,-.9),lightPitch:Math.max(-1.4,Math.min(1.4,C(X.lightPitch,.85)))}}function oe(){return{...E}}function zo(A){p=A||null}function Yo(){if(y)return!1;if(s&&h)return!0;try{if(!s){let A=ce(o,Dn,Pn);s={prog:A,aQuad:o.getAttribLocation(A,"aQuad"),aPrint:o.getAttribLocation(A,"aPrint"),aSide:o.getAttribLocation(A,"aSide"),uView:o.getUniformLocation(A,"uView"),uProj:o.getUniformLocation(A,"uProj"),uBuy:o.getUniformLocation(A,"uBuy"),uSell:o.getUniformLocation(A,"uSell")},l=o.createBuffer(),o.bindBuffer(o.ARRAY_BUFFER,l),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,-1,1,1,-1,1]),o.STATIC_DRAW),f=o.createBuffer()}if(!h){let A=ce(o,In,Cn);h={prog:A,aPos:o.getAttribLocation(A,"aPos"),uMvp:o.getUniformLocation(A,"uMvp"),uColor:o.getUniformLocation(A,"uColor")},b=o.createBuffer()}return!0}catch(A){return y=!0,console.warn("[webglHeatmap] 3D overlay programs unavailable:",A?.message||A),!1}}function Xo(A,C,X){let Y=p;if(!Y||!Yo())return;let lt=Math.max(.02,E.depth);o.disable(o.DEPTH_TEST);let ht=ot=>(ot*2-1)*R,Et=ot=>(ot*2-1)*T,ct=Y.bubbles;if(ct&&ct.length>5){let ot=ct[0]>0?ct[0]:1,Rt=Math.floor((ct.length-1)/4),nt=new Float32Array(Rt*5),ut=0,dt=0;for(let gt=0;gt<Rt;gt++){let bt=1+gt*4,St=ct[bt],wt=ct[bt+1],Dt=ct[bt+2],ne=ct[bt+3];if(!(Dt>0)||wt<0)continue;let Yt=Math.sqrt(Math.min(1,Dt/ot));nt[ut++]=ht(St),nt[ut++]=lt+Y.bubLift*(1+Yt),nt[ut++]=Et(wt),nt[ut++]=Y.bubMin+Yt*(Y.bubMax-Y.bubMin),nt[ut++]=ne,dt++}dt>0&&(o.useProgram(s.prog),o.uniformMatrix4fv(s.uView,!1,A),o.uniformMatrix4fv(s.uProj,!1,C),o.uniform3f(s.uBuy,Y.buy[0],Y.buy[1],Y.buy[2]),o.uniform3f(s.uSell,Y.sell[0],Y.sell[1],Y.sell[2]),o.bindBuffer(o.ARRAY_BUFFER,l),o.enableVertexAttribArray(s.aQuad),o.vertexAttribPointer(s.aQuad,2,o.FLOAT,!1,8,0),o.vertexAttribDivisor(s.aQuad,0),o.bindBuffer(o.ARRAY_BUFFER,f),o.bufferData(o.ARRAY_BUFFER,nt.subarray(0,dt*5),o.DYNAMIC_DRAW),o.enableVertexAttribArray(s.aPrint),o.vertexAttribPointer(s.aPrint,4,o.FLOAT,!1,20,0),o.vertexAttribDivisor(s.aPrint,1),o.enableVertexAttribArray(s.aSide),o.vertexAttribPointer(s.aSide,1,o.FLOAT,!1,20,16),o.vertexAttribDivisor(s.aSide,1),o.drawArraysInstanced(o.TRIANGLES,0,6,dt),o.vertexAttribDivisor(s.aPrint,0),o.vertexAttribDivisor(s.aSide,0))}let K=Y.bbo;if(K&&K.length>=6){let ot=Math.floor(K.length/3);o.useProgram(h.prog),o.uniformMatrix4fv(h.uMvp,!1,X),o.bindBuffer(o.ARRAY_BUFFER,b),o.enableVertexAttribArray(h.aPos),o.vertexAttribPointer(h.aPos,3,o.FLOAT,!1,12,0),o.vertexAttribDivisor(h.aPos,0);for(let[Rt,nt]of[[1,Y.buy],[2,Y.sell]]){let ut=new Float32Array(ot*3),dt=0,gt=0;for(let bt=0;bt<ot;bt++){let St=K[bt*3],wt=K[bt*3+Rt];wt<0||(ut[dt++]=ht(St),ut[dt++]=lt+Y.bubLift*.6,ut[dt++]=Et(wt),gt++)}gt<2||(o.uniform4f(h.uColor,nt[0],nt[1],nt[2],1),o.bufferData(o.ARRAY_BUFFER,ut.subarray(0,gt*3),o.DYNAMIC_DRAW),o.drawArrays(o.LINE_STRIP,0,gt))}}}function Vo(){return d?_?!0:(_=Io(o),_?(_.setSize(t.width/w,t.height/w,w),!0):!1):!1}return{get available(){return d},get geom(){return _},enableVectorLayer:Vo,bg:rt,heatmap:ft,ensureHd:N,set3d:ee,get3d:oe,setScene3d:zo,resize:te,destroy:st}}var Ze=null,to=null,$t=null;async function Wn(){let t=typeof globalThis>"u"?null:globalThis,i=t&&t.__mrdWasmResp;if(!i)return null;t.__mrdWasmResp=null;try{let c=await i;return c&&c.ok?c:null}catch{return null}}function On(){if(typeof WorkerGlobalScope>"u"||!self.location?.search)return null;let t=i=>new URL(i+self.location.search,self.location.href).href;return{glue:t("./chart_engine.js"),wasm:t("./chart_engine_bg.wasm")}}async function Uo(){return Ze?{module:Ze,memory:to}:$t||($t=(async()=>{let t=On(),i=t?await import(t.glue):await import("./chart_engine.js"),c=t?null:await Wn(),m=t?t.wasm:c;try{await(m?i.default({module_or_path:m}):i.default())}catch(v){console.warn("[mrd-chart] WebAssembly streaming init failed, retrying with arrayBuffer fallback:",v);let o=t?t.wasm:new URL("../wasm/chart_engine_bg.wasm",import.meta.url),d=await fetch(o);if(!d.ok)throw new Error(`WASM fetch failed (${d.status} ${d.statusText}) at ${o}`);let _=await d.arrayBuffer();await i.default(_)}return to=i.wasm_memory(),Ze=i,{module:i,memory:to}})(),$t.catch(()=>{$t=null}),$t)}var z=null,lo=null,pt=null,_t=null,Tt=null,mt=null,co=1,jt=!1,Ut=!1,Kt=!1,vt=!1,no=!1,kt=!0,Ht=null,ro=!1,De=0,Qt=0,fe=0,Lt=0,ao=0,Pe=16,Gn=66,ko=3e4,eo=0,io=15,Se=0,qt=0,Go=0,he=null,Ie=null,xe=0,de=[],so=!1,At={on:!1,depth:.5,yaw:-.18,pitch:1.22,zoom:1,fov:42,rough:.55,metal:.15,ambient:.28,lightYaw:-.9,lightPitch:.85},me=!1,oo=0,Ho=1;function zt(t,i,c){try{self.postMessage({t,...i},c||[])}catch{}}function Mt(t){vt||(vt=!0,Le(),zt("dead",{err:String(t&&t.message?t.message:t)}))}var zn=typeof self.requestAnimationFrame=="function";function Gt(){Kt||!jt||Ut||vt||Ht!==null||(zn?(ro=!0,Ht=self.requestAnimationFrame(No)):(ro=!1,Ht=self.setTimeout(()=>No(performance.now()),Pe)))}function Le(){Ht!==null&&(ro?self.cancelAnimationFrame(Ht):self.clearTimeout(Ht),Ht=null)}function Yn(){if(Ut||!jt)return Number.POSITIVE_INFINITY;let t=performance.now();return(t-Qt>ko&&t-fe>ko?Gn:Pe)+qt}function No(t){if(Ht=null,Kt||!jt||Ut||vt)return;let i=Yn();if(!Number.isFinite(i))return;if(t-De<i){Gt();return}De=t,Xn();try{z.set_wall_now(Date.now())}catch(m){Mt(m);return}Vn();let c=kt;if(!c){try{c=z.is_dirty()}catch(m){Mt(m);return}c&&Lt===0&&(Lt=t)}if(c&&no)kt=!0;else if(c){kt=!1;let m=performance.now();if(uo()){let o=performance.now();ao=o;let d=Lt>0?Math.min(200,Math.max(0,o-Lt)):0;Lt=0,Qn(d,Math.min(200,Math.max(0,o-m)))}else{if(vt)return;kt=!0}let v=performance.now()-m;eo=eo*.85+v*.15,v>io?(Se+=1,Se>=8&&(qt=Math.min(100,qt+16),Se=0)):(Se=0,qt>0&&eo<io*.5&&(qt=Math.max(0,qt-8)))}Gt()}function Xn(){if(he&&xe>0){try{z.push_book(Go,he,Ie,xe)}catch(t){if(t instanceof WebAssembly.RuntimeError){Mt(t);return}}he=null,Ie=null,xe=0}if(de.length){let t=new Float64Array(de);de.length=0;try{z.push_trades_batch(t),so=!0}catch(i){if(i instanceof WebAssembly.RuntimeError){Mt(i);return}}}}function Vn(){if(!so)return;so=!1;let t;try{t=z.drain_orderflow_events()}catch(c){c instanceof WebAssembly.RuntimeError&&Mt(c);return}if(!t||t.length<5)return;let i=t instanceof Float64Array?t:new Float64Array(t);zt("of",{flat:i},[i.buffer])}function $n(){if(!(!At.on||!mt?.setScene3d))try{mt.setScene3d({view:z.tick_view_window?.()||null,bubbles:z.tick_bubbles_3d?.()||null,bbo:z.tick_bbo_3d?.()||null,buy:me?[.149,.651,.604]:[.055,.796,.506],sell:me?[.937,.325,.314]:[.965,.275,.365],bubLift:.02,bubMin:.006,bubMax:.055})}catch{}}function uo(){if(vt||!pt)return!1;try{if($n(),z.render()>0){let i=z.get_command_buffer_ptr(),c=z.get_command_buffer_len();pt.save(),pt.setTransform(1,0,0,1,0,0),pt.clearRect(0,0,_t.width,_t.height),pt.restore(),_o(pt,lo,i,c,null,null,null,mt)}return!0}catch(t){return t instanceof WebAssembly.RuntimeError&&Mt(t),!1}}var Wo=null;function qn(){let t="";try{t=z.pane_layout_sig?.()||""}catch{return null}if(t===Wo)return null;Wo=t,Ce=!0;let i="";try{i=z.pane_rects_json?.()||""}catch{i=""}let c={};try{for(let m of Object.keys(i?JSON.parse(i):{}))m.startsWith("__")||(c[m]=z.pane_height_frac?.(m)||0)}catch{}return{sig:t,rects:i,fracs:c}}var Oo=0,ue=null,jn=2e3;function Kn(t){if(t-Oo<jn)return null;Oo=t;let i=lo?.buffer?.byteLength||0,c=0;try{c=performance.memory?.usedJSHeapSize||0}catch{}return ue&&ue.wasm===i&&ue.js===c?null:(ue={wasm:i,js:c},ue)}var Ce=!0;function Qn(t,i){let c=qn(),m=Kn(performance.now()),v=null;if(Ce){let d=null;try{d=z.tick_input_map?.()}catch{}d&&d.length&&(Ce=!1,v=d instanceof Float64Array?d:new Float64Array(d),oo=v[3],Ho=v[5])}let o=null;try{o=[z.price_at_y(oo),z.price_at_y(oo+Ho),z.is_follow_live?.()?1:0,z.is_auto_scale_y?.()?1:0,z.get_last_mid(),z.cvd_height_frac?.()||0]}catch{}v?zt("frame",{geom:v,st:o,panes:c,mem:m,latMs:t,paintMs:i},[v.buffer]):zt("frame",{geom:null,st:o,panes:c,mem:m,latMs:t,paintMs:i})}var Jt=()=>{!kt&&Lt===0&&(Lt=performance.now()),kt=!0,Gt()};function Jn(t){let i=At.on;At={...At,...t};try{mt?.set3d?.(At)}catch{}if(At.on!==i){try{z.set_heatmap_3d?.(At.on)}catch{}if(At.on){At={...At,yaw:-.18,pitch:1.22,zoom:1};try{mt?.set3d?.(At)}catch{}}}Jt()}function Zn(){if(!Tt)return!1;if(mt=Bo(Tt,{fetchLut:()=>z.heatmap_lut_rgba(),onContextLost:()=>{try{z.set_render_backend(0)}catch{}mt=null,Jt()}}),!mt.available){mt=null;try{z.set_render_backend(0)}catch{}return!1}try{mt.resize(Tt.width,Tt.height,Tt.width/Math.max(1,co))}catch{}try{mt.set3d?.(At)}catch{}try{z.set_render_backend(1)}catch{}return!0}function tr(t){if(Kt||vt||!(t.cssW>=1)||!(t.cssH>=1))return;co=t.cssW;try{z.resize(t.cssW,t.cssH)}catch(c){Mt(c);return}let i=t.bufW/Math.max(1,t.cssW);try{z.set_dpr?.(i)}catch{}if((_t.width!==t.bufW||_t.height!==t.bufH)&&(_t.width=t.bufW,_t.height=t.bufH,pt.setTransform(1,0,0,1,0,0),pt.scale(i,t.bufH/Math.max(1,t.cssH)),Tt)){Tt.width=t.bufW,Tt.height=t.bufH;try{mt?.resize(t.bufW,t.bufH,i)}catch{}}Ce=!0,uo(),Jt()}async function er(t){_t=t.canvas2d,Tt=t.glCanvas||null,co=t.cssW,Pe=t.options?.frameMs||16,io=Math.max(4,Pe-1),me=t.options?.theme==="light";let{module:i,memory:c}=await Uo();lo=c,z=new i.TickEngine(t.cssW,t.cssH),pt=_t.getContext("2d");let m=t.bufW/Math.max(1,t.cssW);pt.setTransform(1,0,0,1,0,0),pt.scale(m,t.bufH/Math.max(1,t.cssH));try{z.set_license_token(t.options?.licenseToken||"",Date.now(),t.options?.host||"")}catch{}try{z.set_dpr?.(m)}catch{}if(me)try{z.set_theme(1)}catch{}let v=t.options?.renderer==="canvas2d"?!1:Zn();Qt=performance.now(),fe=Qt,zt("ready",{gl:v})}self.onmessage=t=>{let i=t.data;if(!(!i||Kt))switch(i.t){case"init":er(i).catch(c=>Mt(c));return;case"call":if(vt||!z)return;try{z[i.m]?.(...i.a||[])}catch(c){if(c instanceof WebAssembly.RuntimeError){Mt(c);return}}Jt();return;case"calls":{if(vt||!z)return;let c=i.batch||[];for(let m=0;m<c.length;m++)try{z[c[m][0]]?.(...c[m][1]||[])}catch(v){if(v instanceof WebAssembly.RuntimeError){Mt(v);return}}Jt();return}case"query":{let c=null;if(!vt&&z)try{c=z[i.m]?.(...i.a||[])}catch{c=null}c&&typeof c=="object"&&"length"in c&&!Array.isArray(c)&&(c=Array.from(c)),zt("reply",{id:i.id,v:c});return}case"book":if(vt||Ut)return;fe=performance.now(),Go=i.tMs,he=i.bids,Ie=i.asks,xe=i.mid,Gt();return;case"trades":{if(vt||Ut)return;fe=performance.now();let c=i.flat;for(let m=0;m<c.length;m++)de.push(c[m]);Gt();return}case"resize":tr(i);return;case"busy":no=!!i.v,no||Jt();return;case"cfg3d":Jn(i.patch||{});return;case"input":Qt=performance.now();return;case"theme":me=!!i.light;return;case"capture":{let c=null;try{uo();let m=new OffscreenCanvas(_t.width,_t.height),v=m.getContext("2d");Tt&&v.drawImage(Tt,0,0),v.drawImage(_t,0,0),c=m.transferToImageBitmap()}catch{c=null}zt("reply",{id:i.id,v:c},c?[c]:[]);return}case"life":switch(i.v){case"start":jt=!0,Ut=!1,kt=!0,De=0,Qt=performance.now(),fe=Qt,Gt();return;case"pause":Ut=!0,Le(),ao=0,Lt=0;return;case"resume":if(Kt||vt)return;Ut=!1,jt=!0,kt=!0,De=0,ao=0,Lt=0,Gt();return;case"stop":jt=!1,Le();return;case"destroy":Kt=!0,Le();try{mt?.destroy?.()}catch{}try{z?.free?.()}catch{}mt=null,z=null,pt=null,_t=null,Tt=null,de=[],he=null,Ie=null;return;default:return}default:return}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kline-orderbook-chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Candlestick chart with built-in GPU-accelerated (WebGL2) orderbook heatmap, footprint chart, volume profile, and liquidation heatmap. Native WebAssembly engine — 60 fps, zero dependencies. Same engine also ships as a native Rust crate (GPUI / wgpu / skia) for desktop apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/chart-engine.mjs",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"homepage": "https://github.com/tapedelta/kline-orderbook-chart",
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
62
|
-
"url": "https://github.com/tapedelta/kline-orderbook-chart.git"
|
|
62
|
+
"url": "git+https://github.com/tapedelta/kline-orderbook-chart.git"
|
|
63
63
|
},
|
|
64
64
|
"bugs": {
|
|
65
65
|
"url": "https://github.com/tapedelta/kline-orderbook-chart/issues"
|