@perspective-dev/viewer-charts 4.5.0 → 4.5.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/LICENSE.md +193 -0
- package/dist/cdn/perspective-viewer-charts.js +2 -2
- package/dist/cdn/perspective-viewer-charts.js.map +3 -3
- package/dist/esm/axis/bar-axis.d.ts +9 -1
- package/dist/esm/axis/categorical-axis.d.ts +0 -2
- package/dist/esm/charts/cartesian/cartesian.d.ts +26 -0
- package/dist/esm/charts/common/category-axis-resolver.d.ts +43 -1
- package/dist/esm/charts/common/expand-domain.d.ts +20 -0
- package/dist/esm/charts/common/tree-chart.d.ts +7 -0
- package/dist/esm/charts/common/tree-chrome.d.ts +23 -1
- package/dist/esm/charts/common/tree-interact.d.ts +46 -0
- package/dist/esm/charts/series/glyphs/draw-lines.d.ts +11 -4
- package/dist/esm/charts/series/series-build.d.ts +38 -2
- package/dist/esm/charts/series/series-render.d.ts +1 -4
- package/dist/esm/charts/series/series-type.d.ts +19 -17
- package/dist/esm/charts/series/series.d.ts +16 -0
- package/dist/esm/charts/sunburst/sunburst-interact.d.ts +1 -1
- package/dist/esm/charts/treemap/treemap-interact.d.ts +1 -6
- package/dist/esm/interaction/host-sink-message.d.ts +10 -28
- package/dist/esm/interaction/raw-event-forwarder.d.ts +6 -7
- package/dist/esm/interaction/zoom-controller.d.ts +31 -20
- package/dist/esm/interaction/zoom-router.d.ts +3 -26
- package/dist/esm/perspective-viewer-charts.js +2 -2
- package/dist/esm/perspective-viewer-charts.js.map +3 -3
- package/dist/esm/plugin/plugin.d.ts +0 -1
- package/dist/esm/theme/palette.d.ts +0 -5
- package/dist/esm/transport/protocol.d.ts +2 -7
- package/dist/esm/worker/renderer.worker.d.ts +2 -4
- package/package.json +45 -45
- package/src/ts/axis/bar-axis.ts +74 -45
- package/src/ts/axis/categorical-axis.ts +0 -2
- package/src/ts/charts/candlestick/candlestick-render.ts +10 -7
- package/src/ts/charts/candlestick/candlestick.ts +10 -29
- package/src/ts/charts/candlestick/glyphs/draw-candlesticks.ts +36 -2
- package/src/ts/charts/candlestick/glyphs/draw-ohlc.ts +36 -2
- package/src/ts/charts/cartesian/cartesian-build.ts +143 -9
- package/src/ts/charts/cartesian/cartesian-render.ts +205 -30
- package/src/ts/charts/cartesian/cartesian.ts +43 -4
- package/src/ts/charts/cartesian/glyphs/density.ts +36 -41
- package/src/ts/charts/cartesian/glyphs/lines.ts +13 -15
- package/src/ts/charts/cartesian/glyphs/points.ts +12 -17
- package/src/ts/charts/chart-base.ts +20 -6
- package/src/ts/charts/chart.ts +1 -1
- package/src/ts/charts/common/category-axis-resolver.ts +135 -1
- package/src/ts/charts/common/expand-domain.ts +40 -0
- package/src/ts/charts/common/tree-chart.ts +16 -0
- package/src/ts/charts/common/tree-chrome.ts +86 -1
- package/src/ts/charts/common/tree-interact.ts +209 -0
- package/src/ts/charts/heatmap/heatmap-render.ts +9 -11
- package/src/ts/charts/series/glyphs/draw-areas.ts +30 -1
- package/src/ts/charts/series/glyphs/draw-lines.ts +151 -76
- package/src/ts/charts/series/series-build.ts +394 -21
- package/src/ts/charts/series/series-render.ts +159 -38
- package/src/ts/charts/series/series-type.ts +37 -17
- package/src/ts/charts/series/series.ts +63 -68
- package/src/ts/charts/sunburst/sunburst-interact.ts +18 -162
- package/src/ts/charts/sunburst/sunburst-render.ts +24 -89
- package/src/ts/charts/sunburst/sunburst.ts +1 -15
- package/src/ts/charts/treemap/treemap-interact.ts +22 -189
- package/src/ts/charts/treemap/treemap-render.ts +19 -46
- package/src/ts/charts/treemap/treemap.ts +1 -16
- package/src/ts/interaction/host-sink-message.ts +33 -22
- package/src/ts/interaction/raw-event-forwarder.ts +10 -12
- package/src/ts/interaction/zoom-controller.ts +120 -83
- package/src/ts/interaction/zoom-router.ts +3 -126
- package/src/ts/map/tile-layer.ts +13 -13
- package/src/ts/plugin/plugin.ts +100 -184
- package/src/ts/shaders/line-uniform.frag.glsl +2 -1
- package/src/ts/shaders/line-uniform.vert.glsl +19 -0
- package/src/ts/theme/palette.ts +1 -4
- package/src/ts/transport/protocol.ts +3 -8
- package/src/ts/worker/dispatch.ts +0 -1
- package/src/ts/worker/renderer.worker.ts +10 -46
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),n.style.left="-9999px",n.style.top="0px",this._parent.appendChild(n),this._div=n;let o=n.getBoundingClientRect().width,a=n.getBoundingClientRect().height,l=t.px+12,h=t.py-a-8;l+o>i.cssWidth&&(l=t.px-o-12),l<0&&(l=4),h<0&&(h=t.py+12),h+a>i.cssHeight&&(h=i.cssHeight-a-4),n.style.left=`${l}px`,n.style.top=`${h}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};var m="worker",Z="direct";var q='var dr=Object.defineProperty;var Qa=(e,t,n)=>t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var I=(e,t)=>()=>(e&&(t=e(e=0)),t);var el=(e,t)=>{for(var n in t)dr(e,n,{get:t[n],enumerable:!0})};var d=(e,t,n)=>Qa(e,typeof t!="symbol"?t+"":t,n);var un,zi=I(()=>{un="attribute vec2 a_start;attribute vec2 a_end;attribute float a_color_start;attribute float a_color_end;attribute float a_corner;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform vec2 u_color_range;uniform sampler2D u_gradient_lut;varying float v_edge_dist;varying vec3 v_color;float A(float B,float C,float D){if(D<=C){return 0.5;}else if(C<0.&&D>0.){float E=max(-C,D);return clamp(0.5+0.5*(B/E),0.,1.);}return clamp((B-C)/(D-C),0.,1.);}void main(){float C=u_color_range.x;float D=u_color_range.y;float F=0.5*(a_color_start+a_color_end);float G=A(F,C,D);v_color=texture2D(u_gradient_lut,vec2(G,0.5)).rgb;vec4 H=u_projection*vec4(a_start,0.,1.);vec4 I=u_projection*vec4(a_end,0.,1.);vec2 J=H.xy*u_resolution*0.5;vec2 K=I.xy*u_resolution*0.5;vec2 L=K-J;float M=length(L);L=M>0.001?L/M:vec2(1.,0.);vec2 N=vec2(-L.y,L.x);float O=step(1.5,a_corner);float P=1.-mod(a_corner,2.)*2.;vec4 Q=mix(H,I,O);float R=(u_line_width+1.5)*0.5;vec2 S=(N*P*R)/(u_resolution*0.5);gl_Position=Q+vec4(S,0.,0.);v_edge_dist=P;}"});var mn,Xi=I(()=>{mn="precision highp float;uniform float u_line_width;varying float v_edge_dist;varying vec3 v_color;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(v_color,C);}"});var fn,$i=I(()=>{fn="attribute vec2 a_position;attribute float a_color_value;attribute float a_size_value;uniform mat4 u_projection;uniform float u_point_size;uniform vec2 u_color_range;uniform vec2 u_size_range;uniform vec2 u_point_size_range;varying float v_color_t;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);float A=u_size_range.y-u_size_range.x;if(A>0.){float B=clamp((a_size_value-u_size_range.x)/A,0.,1.);gl_PointSize=mix(u_point_size_range.x,u_point_size_range.y,B);}else{gl_PointSize=u_point_size;}v_point_size=gl_PointSize;float C=u_color_range.x;float D=u_color_range.y;if(D<=C){v_color_t=0.5;}else if(C<0.&&D>0.){float E=max(-C,D);v_color_t=clamp(0.5+0.5*(a_color_value/E),0.,1.);}else{v_color_t=clamp((a_color_value-C)/(D-C),0.,1.);}}"});var cn,ji=I(()=>{cn="precision highp float;varying float v_color_t;varying float v_point_size;uniform sampler2D u_gradient_lut;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5){discard;}float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);vec4 E=texture2D(u_gradient_lut,vec2(clamp(v_color_t,0.,1.),0.5));gl_FragColor=vec4(E.rgb,E.a*D);}"});var Je,Zi=I(()=>{Je="attribute vec2 a_corner;attribute vec2 a_position;attribute float a_color_value;uniform vec2 u_radius_ndc;uniform mat4 u_projection;uniform vec2 u_color_range;varying vec2 v_uv;varying float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}"});var Tn,qi=I(()=>{Tn="precision highp float;uniform float u_intensity;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);float B=max(0.,1.-A);B=B*B*u_intensity;if(B<=0.){discard;}gl_FragColor=vec4(B,B*v_color_t,0.,0.);}"});var wn,Ki=I(()=>{wn="precision highp float;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);if(A>=1.){discard;}float B=(v_color_t-0.5)*2.;gl_FragColor=vec4(max(0.,B),max(0.,-B),0.,0.);}"});var br,pr=I(()=>{br=`#version 300 es\nin vec2 a_corner;in vec2 a_position;in float a_color_value;uniform mat4 u_projection;uniform vec2 u_radius_ndc;uniform vec2 u_color_range;out vec2 v_uv;out float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}`});var gr,hr=I(()=>{gr=`#version 300 es\nprecision highp float;uniform float u_intensity;in vec2 v_uv;in float v_color_t;layout(location=0)out vec4 A;layout(location=1)out vec4 B;void main(){float C=length(v_uv);float D=max(0.0f,1.0f-C);D=D*D*u_intensity;if(D<=0.0f){discard;}A=vec4(D,D*v_color_t,0.0f,0.0f);float E=(v_color_t-0.5f)*2.0f;B=vec4(max(0.0f,E),max(0.0f,-E),0.0f,0.0f);}`});var Rn,Ji=I(()=>{Rn="attribute vec2 a_corner;varying vec2 v_uv;void main(){v_uv=a_corner*0.5+0.5;gl_Position=vec4(a_corner,0.,1.);}"});var Fn,Qi=I(()=>{Fn="precision highp float;uniform sampler2D u_heat;uniform sampler2D u_extreme;uniform sampler2D u_gradient_lut;uniform float u_heat_max;uniform int u_color_mode;varying vec2 v_uv;void main(){vec4 A=texture2D(u_heat,v_uv);float B=A.r;float C=A.g;if(B<=0.){discard;}float D;float E;float F=clamp(B/max(u_heat_max,1e-4),0.,1.);if(u_color_mode==0){D=pow(F,0.6);E=clamp(B,0.,1.);}else if(u_color_mode==2){vec4 G=texture2D(u_extreme,v_uv);float H=G.r;float I=G.g;float J=max(H,I);if(J<=0.){D=0.5;}else if(H>=I){D=clamp(0.5+H*0.5,0.5,1.);}else{D=clamp(0.5-I*0.5,0.,0.5);}E=F;}else if(u_color_mode==3){float K=C-0.5*B;float L=clamp(abs(K)/max(u_heat_max,1e-4),0.,1.);float M=K>=0.?1.:-1.;D=clamp(0.5+0.5*M*L,0.,1.);E=L;}else{D=clamp(C/B,0.,1.);E=F;}vec4 N=texture2D(u_gradient_lut,vec2(D,0.5));gl_FragColor=vec4(N.rgb,N.a*E);}"});var Mn,eo=I(()=>{Mn="attribute vec2 a_corner;uniform mat4 u_projection;uniform vec2 u_extent_min;uniform vec2 u_extent_max;uniform vec2 u_uv_min;uniform vec2 u_uv_max;varying vec2 v_uv;void main(){vec2 A=mix(u_extent_min,u_extent_max,a_corner);vec2 B=mix(u_uv_min,u_uv_max,vec2(a_corner.x,1.-a_corner.y));v_uv=B;gl_Position=u_projection*vec4(A,0.,1.);}"});var Sn,to=I(()=>{Sn="precision highp float;varying vec2 v_uv;uniform sampler2D u_tile;uniform float u_alpha;void main(){vec4 A=texture2D(u_tile,v_uv);gl_FragColor=vec4(A.rgb,A.a*u_alpha);}"});function Bl(e,t){if(t.width<=0||t.height<=0)return e;let n=e.xMax-e.xMin,i=e.yMax-e.yMin;if(n<=0||i<=0)return e;let o=t.width/t.height;if(n/i<o){let s=(e.xMin+e.xMax)/2,a=i*o/2;return{xMin:s-a,xMax:s+a,yMin:e.yMin,yMax:e.yMax}}else{let s=(e.yMin+e.yMax)/2,a=n/o/2;return{xMin:e.xMin,xMax:e.xMax,yMin:s-a,yMax:s+a}}}var Qe,Dn=I(()=>{"use strict";Qe=class{constructor(){d(this,"Ge",1);d(this,"ke",1);d(this,"_e",0);d(this,"ve",0);d(this,"Ve",0);d(this,"ze",1);d(this,"Xe",0);d(this,"$e",1);d(this,"Ne",null);d(this,"$i",!1);d(this,"re",null);d(this,"Ft",null);d(this,"Mt",null);d(this,"bt",!1);d(this,"St",0);d(this,"Bt",0);d(this,"je",null);d(this,"Ze",null);d(this,"qe",null);d(this,"Ke",null)}get lockedAxis(){return this.Ne}get scaleX(){return this.Ge}get scaleY(){return this.ke}set scaleX(t){this.Ge=t}set scaleY(t){this.ke=t}get normTranslateX(){return this._e}get normTranslateY(){return this.ve}set normTranslateX(t){this._e=t}set normTranslateY(t){this.ve=t}get baseXRange(){return this.ze-this.Ve}get baseYRange(){return this.$e-this.Xe}setBaseDomain(t,n,i,o){if(this.isDefault()){this.Ve=t,this.ze=n,this.Xe=i,this.$e=o;return}let r=this.ze-this.Ve,s=this.$e-this.Xe,a=(this.Ve+this.ze)/2+this._e*r,l=(this.Xe+this.$e)/2+this.ve*s;this.Ve=t,this.ze=n,this.Xe=i,this.$e=o;let u=n-t,m=o-i;this._e=u>0?(a-(t+n)/2)/u:0,this.ve=m>0?(l-(i+o)/2)/m:0}configure(t){this.Ne=t.lockAxis??null,this.$i=t.lockAspect??!1,this.Ne==="x"?(this.Ge=1,this._e=0):this.Ne==="y"&&(this.ke=1,this.ve=0)}isDefault(){return this.Ge===1&&this.ke===1&&this._e===0&&this.ve===0}getVisibleDomain(){let t=this.ze-this.Ve,n=this.$e-this.Xe,i=t/this.Ge,o=n/this.ke,r=(this.Ve+this.ze)/2+this._e*t,s=(this.Xe+this.$e)/2+this.ve*n,a={xMin:r-i/2,xMax:r+i/2,yMin:s-o/2,yMax:s+o/2};return this.$i&&this.Ft?Bl(a,this.Ft.t):a}attach(t,n,i){this.detach(),this.re=t,this.Ft=n,this.Mt=i,this.je=o=>{o.preventDefault();let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.Ft.t;if(s<l.x||s>l.x+l.width||a<l.y||a>l.y+l.height)return;let u=this.getVisibleDomain(),m=u.xMin+(s-l.x)/l.width*(u.xMax-u.xMin),f=u.yMax-(a-l.y)/l.height*(u.yMax-u.yMin),b=Math.pow(1.1,-o.deltaY/100);this.Ne!=="x"&&(this.Ge=Math.max(1,Math.min(1e5,this.Ge*b))),this.Ne!=="y"&&(this.ke=Math.max(1,Math.min(1e5,this.ke*b)));let p=this.getVisibleDomain(),c=p.xMin+(s-l.x)/l.width*(p.xMax-p.xMin),h=p.yMax-(a-l.y)/l.height*(p.yMax-p.yMin),g=this.ze-this.Ve,y=this.$e-this.Xe;this.Ne!=="x"&&g>0&&(this._e+=(m-c)/g),this.Ne!=="y"&&y>0&&(this.ve+=(f-h)/y),this.Mt()},this.Ze=o=>{let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.Ft.t;s>=l.x&&s<=l.x+l.width&&a>=l.y&&a<=l.y+l.height&&(this.bt=!0,this.St=o.clientX,this.Bt=o.clientY,t.setPointerCapture(o.pointerId))},this.qe=o=>{if(!this.bt)return;let r=o.clientX-this.St,s=o.clientY-this.Bt;this.St=o.clientX,this.Bt=o.clientY;let a=this.getVisibleDomain(),l=this.Ft.t,u=(a.xMax-a.xMin)/l.width,m=(a.yMax-a.yMin)/l.height,f=this.ze-this.Ve,b=this.$e-this.Xe;this.Ne!=="x"&&f>0&&(this._e-=r*u/f),this.Ne!=="y"&&b>0&&(this.ve+=s*m/b),this.Mt()},this.Ke=()=>{this.bt=!1},t.addEventListener("wheel",this.je,{passive:!1}),t.addEventListener("pointerdown",this.Ze),t.addEventListener("pointermove",this.qe),t.addEventListener("pointerup",this.Ke)}updateLayout(t){this.Ft=t}detach(){this.re&&(this.je&&this.re.removeEventListener("wheel",this.je),this.Ze&&this.re.removeEventListener("pointerdown",this.Ze),this.qe&&this.re.removeEventListener("pointermove",this.qe),this.Ke&&this.re.removeEventListener("pointerup",this.Ke)),this.re=null,this.Mt=null}reset(){this.Ge=1,this.ke=1,this._e=0,this.ve=0}serialize(){return{scaleX:this.Ge,scaleY:this.ke,normTranslateX:this._e,normTranslateY:this.ve}}restore(t){this.Ge=t.scaleX,this.ke=t.scaleY,this._e=t.normTranslateX,this.ve=t.normTranslateY}}});function Ar(e,t){let n=t??Dl[e]??{};return new Intl.NumberFormat(navigator.languages,n)}function Lr(e){if(!e||e.format!=="custom"){let n={timeZone:e?.timeZone,dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??vr.dateStyle,timeStyle:e?.timeStyle==="disabled"?void 0:e?.timeStyle??vr.timeStyle};return new Intl.DateTimeFormat(navigator.languages,n)}let t={timeZone:e.timeZone,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(t.year=e.year??"2-digit"),e.month!=="disabled"&&(t.month=e.month??"numeric"),e.day!=="disabled"&&(t.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(t.weekday=e.weekday),e.hour!=="disabled"&&(t.hour=e.hour??"numeric"),e.minute!=="disabled"&&(t.minute=e.minute??"numeric"),e.second!=="disabled"&&(t.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,t)}function Tr(e){let t={timeZone:"utc",dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??Il.dateStyle};return new Intl.DateTimeFormat(navigator.languages,t)}function io(e){return e.split("|").at(-1)??e}var Dl,vr,Il,wr=I(()=>{"use strict";Dl={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},vr={dateStyle:"short",timeStyle:"medium"},Il={dateStyle:"short"}});var En,Rr=I(()=>{"use strict";En=class{constructor(t,n=128){d(this,"Xt");d(this,"c",new Map);d(this,"he",new Map);d(this,"Zi");this.Xt=t,this.Zi=n}async fetchRow(t){if(!this.Xt)throw new Error("LazyRowFetcher disposed");let n=this.c.get(t);if(n)return this.c.delete(t),this.c.set(t,n),n;let i=this.he.get(t);if(i)return i;let o=this.wo(t);this.he.set(t,o);try{let r=await o;if(!this.Xt)return r;if(this.c.set(t,r),this.c.size>this.Zi){let s=this.c.keys().next().value;s!==void 0&&this.c.delete(s)}return r}finally{this.he.delete(t)}}async wo(t){let n=this.Xt;if(!n)throw new Error("LazyRowFetcher disposed");let i=new Map;return await n.with_typed_arrays({start_row:t,end_row:t+1,float32:!0},(o,r,s,a)=>{for(let l=0;l<o.length;l++){let u=o[l];if(u.startsWith("__"))continue;let m=r[l],f=s[l],b=a[l];(f?!(f[0]>>0&1):!1)?i.set(u,null):b?i.set(u,b[m[0]]):i.set(u,m[0])}}),i}dispose(){this.Xt=null,this.c.clear(),this.he.clear()}get isDisposed(){return this.Xt===null}}});function Fr(e,t){let n=Math.floor(Math.log10(e)),i=e/Math.pow(10,n),o;return t?i<1.5?o=1:i<3?o=2:i<7?o=5:o=10:i<=1?o=1:i<=2?o=2:i<=5?o=5:o=10,o*Math.pow(10,n)}function te(e,t,n){n<1&&(n=1);let i=Fr(t-e,!1),o=Fr(i/n,!0),r=Math.ceil(e/o)*o,s=Math.floor(t/o)*o,a=[];for(let l=r;l<=s+o*.001;l+=o)a.push(l);return a}function ie(e){let t=Math.abs(e);return t===0?"0":t>=1e9?(e/1e9).toFixed(1)+"B":t>=1e6?(e/1e6).toFixed(1)+"M":t>=1e3?(e/1e3).toFixed(1)+"K":Number.isInteger(e)?e.toString():t>=1?e.toFixed(1):e.toFixed(2)}function le(e,t){let n=new Date(e);return isNaN(n.getTime())?ie(e):t!==void 0&&t>0?t>=864e5*28?n.toLocaleDateString(void 0,{year:"numeric",month:"short"}):t>=864e5?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t>=36e5?n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric"}):t>=6e4?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var pe=I(()=>{"use strict"});var Mr,Sr,Br=I(()=>{"use strict";Mr={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},Sr={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"fit",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1}});function _e(e,t,n,i,o,r,s={}){if(!e)return;let a=e.getContext("2d");if(!a)return;a.save(),a.setTransform(1,0,0,1,0,0),a.scale(r,r),a.font=`11px ${o.fontFamily}`;let l=16,u=8,m=0;for(let g of n){let y=a.measureText(g).width;y>m&&(m=y)}let f=m+u*2,b=n.length*l+u*2-4,p=t.px+12,c=t.py-b-8;p+f>i.cssWidth&&(p=t.px-f-12),c<0&&(c=t.py+12),c+b>i.cssHeight&&(c=i.cssHeight-b-4);let h=n.length>0;if(s.crosshair&&(a.strokeStyle=o.Dt,a.globalAlpha=.3,a.lineWidth=1,a.setLineDash([4,4]),a.beginPath(),a.moveTo(t.px,i.t.y),a.lineTo(t.px,i.t.y+i.t.height),a.moveTo(i.t.x,t.py),a.lineTo(i.t.x+i.t.width,t.py),a.stroke(),a.setLineDash([]),a.globalAlpha=1),s.highlightRadius&&s.highlightRadius>0&&(a.strokeStyle=o.Dt,a.globalAlpha=.8,a.lineWidth=2,a.beginPath(),a.arc(t.px,t.py,s.highlightRadius,0,Math.PI*2),a.stroke(),a.globalAlpha=1),h){a.fillStyle=o.Sn,a.strokeStyle=o.qi,a.lineWidth=1,a.beginPath(),a.roundRect(p,c,f,b,4),a.fill(),a.stroke(),a.fillStyle=o.Ki,a.textAlign="left",a.textBaseline="top";for(let g=0;g<n.length;g++)a.fillText(n[g],p+u,c+u+g*l)}a.restore()}var Pn,et=I(()=>{"use strict";Pn=class{constructor(){d(this,"Me",null);d(this,"$t",0);d(this,"jt",null);d(this,"on",null);d(this,"ht",!1)}get isPinned(){return this.ht}setHost(t){this.ht&&(this.on?.dismiss(),this.ht=!1),this.on=t}setCursor(t){this.on?.setCursor(t)}attach(t){this.detach(),this.Me=t}detach(){this.$t&&(cancelAnimationFrame(this.$t),this.$t=0),this.jt!==null&&(clearTimeout(this.jt),this.jt=null),this.Me=null}dispatchHover(t,n){if(this.ht||!this.Me||this.$t||this.jt!==null)return;let i=()=>{this.$t=0,this.jt=null,this.Me?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.$t=requestAnimationFrame(i):this.jt=setTimeout(i,16)}dispatchLeave(){this.ht||!this.Me||this.Me.onLeave()}dispatchClick(t,n){if(this.Me&&!this.Me.onClickPre?.(t,n)){if(this.ht){let i=this.Me;this.dismiss(),i.onUnpin?.();return}this.Me.onPin?.(t,n)}}dispatchDblClick(t,n){this.Me?.onDblClick?.(t,n)}pin(t,n,i){t.length!==0&&(this.on?.pin(t,n,i),this.ht=!0)}dismiss(){this.on?.dismiss(),this.ht=!1}}});function Wn(e){let t=e.trim();if(t.startsWith("#")){let i=t.slice(1);return i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let n=t.match(/rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)/);return n?[+n[1]/255,+n[2]/255,+n[3]/255]:[.5,.5,.5]}var oo=I(()=>{"use strict"});function Dr(e){if(!e)return ze.slice();let t=e.trim();if(!t)return ze.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return ze.slice();let i=t.lastIndexOf(")");if(i<=n)return ze.slice();let o=t.substring(n+1,i),r=[],s=0,a=0;for(let b=0;b<o.length;b++){let p=o[b];p==="("?s++:p===")"?s--:p===","&&s===0&&(r.push(o.substring(a,b)),a=b+1)}r.push(o.substring(a));let l=[],u=0;if(r.length>0){let b=r[0].trim().toLowerCase();(b.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(b))&&(u=1)}for(let b=u;b<r.length;b++){let p=r[b].trim();if(!p)continue;let c=p.match(/\\s([\\-\\d.]+)%\\s*$/),h=c?p.substring(0,c.index).trim():p,g=c?parseFloat(c[1])/100:null;try{let y=Wn(h);l.push({color:y,offset:g})}catch{}}if(l.length===0)return ze.slice();if(l.length===1){let[b,p,c]=l[0].color;return[{offset:0,color:[b,p,c,1]},{offset:1,color:[b,p,c,1]}]}l[0].offset===null&&(l[0].offset=0),l[l.length-1].offset===null&&(l[l.length-1].offset=1);for(let b=1;b<l.length-1;b++){if(l[b].offset!==null)continue;let p=b+1;for(;p<l.length&&l[p].offset===null;)p++;let c=l[b-1].offset,h=l[p].offset,g=p-(b-1);for(let y=b;y<p;y++)l[y].offset=c+(y-(b-1))/g*(h-c);b=p-1}let m=0;return l.map(b=>{let p=Math.max(m,Math.min(1,b.offset));return m=p,{offset:p,color:[b.color[0],b.color[1],b.color[2],1]}})}function be(e,t){if(e.length===0)return[0,0,0,1];if(t<=e[0].offset)return e[0].color.slice();let n=e[e.length-1];if(t>=n.offset)return n.color.slice();let i=0,o=e.length-1;for(;o-i>1;){let u=i+o>>1;e[u].offset<=t?i=u:o=u}let r=e[i],s=e[o],a=s.offset-r.offset,l=a>0?(t-r.offset)/a:0;return[r.color[0]+(s.color[0]-r.color[0])*l,r.color[1]+(s.color[1]-r.color[1])*l,r.color[2]+(s.color[2]-r.color[2])*l,r.color[3]+(s.color[3]-r.color[3])*l]}function Xe(e,t,n){if(!isFinite(e)||t===n)return .5;let i;if(t>=0?i=n:n<=0?i=-t:i=Math.max(-t,n),i<=0)return .5;let o=.5+.5*(e/i);return o<0?0:o>1?1:o}function Ir(e){if(e.length===0)return ze.slice();if(e.length===1){let[n,i,o]=e[0];return[{offset:0,color:[n,i,o,1]},{offset:1,color:[n,i,o,1]}]}let t=e.length-1;return e.map(([n,i,o],r)=>({offset:r/t,color:[n,i,o,1]}))}function Er(e,t=256){let n=new Uint8Array(t*4);for(let i=0;i<t;i++){let o=t===1?0:i/(t-1),r=be(e,o);n[i*4]=Math.round(r[0]*255),n[i*4+1]=Math.round(r[1]*255),n[i*4+2]=Math.round(r[2]*255),n[i*4+3]=Math.round(r[3]*255)}return n}var ze,ve=I(()=>{"use strict";oo();ze=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function El(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function Pr(e){return!isFinite(e)||e<0?1:e}function Wr(e){let t=(r,s)=>e[r]||s,n=e["--psp-charts--gradient--background"]||e["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",i=Dr(n),o=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;o.push(Wn(s))}return{fontFamily:t("--psp-charts--font-family",t("font-family","monospace")),backgroundColor:t("--psp--background-color","rgba(255, 255, 255, 1)"),Dt:t("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),ge:t("--psp--color","rgba(180, 0, 0, 0.9)"),fi:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),Bn:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),V:i,ci:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),Ro:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),Sn:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),Ki:t("--psp-charts--tooltip--color","#161616"),qi:t("--psp-charts--tooltip--border-color","#fff"),di:El(parseFloat(t("--psp-charts--area--opacity","0.85"))),Ji:Pr(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),Qi:Pr(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),Se:o}}var Gr=I(()=>{"use strict";oo();ve()});function kr(e,t){let n=Rt.get(e);n?n.fullRender=t:(n={glManager:e,fullRender:t,waiters:[]},Rt.set(e,n));let i=Promise.withResolvers();return n.waiters.push(i),Gn||(Gn=Or(Ur)),i.promise}function Nr(e,t){if(!ro.has(e)){t();return}let n=kn.get(e);n||(n=[],kn.set(e,n)),n.push(t)}async function Ur(){let e=Array.from(Rt.values());Rt.clear();let t=[];for(let n of e)try{n.glManager.applyPendingResize(),n.fullRender(),t.push(n)}catch(i){console.error("scheduler: fullRender threw",i);for(let o of n.waiters)o.reject(i)}await Promise.all(t.map(Pl)),Gn=0,Rt.size>0&&(Gn=Or(Ur))}async function Pl(e){ro.add(e.glManager);try{await e.glManager.awaitGpuFence(),e.glManager.endFrame();for(let t of e.waiters)t.resolve()}catch(t){console.error("scheduler: present failed",t);try{e.glManager.endFrame()}catch{}for(let n of e.waiters)n.reject(t)}finally{ro.delete(e.glManager);let t=kn.get(e.glManager);if(t){kn.delete(e.glManager);for(let n of t)try{n()}catch(i){console.error("scheduler: deferred op threw",i)}}}}function Or(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var Rt,Gn,ro,kn,so=I(()=>{"use strict";Rt=new Map,Gn=0,ro=new Set,kn=new Map});var Wl,Gl,he,Ft=I(()=>{"use strict";wr();Rr();pe();Dn();Br();et();Gr();so();Wl=ie,Gl=le,he=class{constructor(){d(this,"e",null);d(this,"I",null);d(this,"d",null);d(this,"eo",{});d(this,"h",null);d(this,"rn",[]);d(this,"E",[]);d(this,"L",[]);d(this,"w",[]);d(this,"Je",{});d(this,"Dn",!1);d(this,"In",!1);d(this,"gt",{});d(this,"pi",{});d(this,"bi",new Map);d(this,"En");d(this,"P",{...Mr});d(this,"g",{...Sr});d(this,"_",new Pn);d(this,"gi",null);d(this,"Pn",Promise.resolve());d(this,"sn",null);d(this,"ce",null)}setGridlineCanvas(t){this.I=t}setChromeCanvas(t){this.d=t}setTheme(t){this.eo=t,this.sn=null}setZoomController(t){this.h=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.P.zoom_mode==="shared")return this.h;if(!this.h)return null;let n=this.rn[t];return n||(n=new Qe,n.configure(this.getZoomConfig()),this.rn[t]=n),n}computeEffectiveFacetFlags(){let t=this.P.zoom_mode==="independent",n=!t&&this.P.shared_x_axis,i=!t&&this.P.shared_y_axis;return this.Dn=n,this.In=i,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:i}}syncFacetZoomLayouts(t){let n=this.P.zoom_mode==="independent";for(let i=0;i<t.length;i++)if(this.getZoomControllerForFacet(i)?.updateLayout(t[i].layout),!n)return}setZoomBaseDomain(t,n,i,o){this.h&&this.h.setBaseDomain(t,n,i,o);for(let r of this.rn)r&&r.setBaseDomain(t,n,i,o)}getZoomConfig(){return{}}setColumnSlots(t){this.E=t}setViewPivots(t,n){this.L=t,this.w=n}setColumnTypes(t){this.Je=t,this.to()}resetExpandedDomain(){}setGroupByTypes(t){this.gt=t}setColumnsConfig(t){this.pi=t??{},this.to()}to(){this.bi=new Map;for(let[t,n]of Object.entries(this.pi)){let i=this.Je[t]??this.gt[t],o=this.Fo(i,n);o&&this.bi.set(t,o)}}Fo(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let i=n.number_format;if(!i)return;let o=Ar(t,i);return r=>o.format(r)}if(t==="datetime"){let i=n.date_format;if(!i)return;let o=Lr(i);return r=>o.format(r)}if(t==="date"){let i=n.date_format;if(!i)return;let o=Tr(i);return r=>o.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.bi.get(io(t));if(r)return r}if(n==="tick")return;let i=t?io(t):void 0,o=i?this.Je[i]??this.gt[i]:void 0;return o==="date"||o==="datetime"?Gl:Wl}setDefaultChartType(t){this.En=t}setFacetConfig(t){this.P={...t}}setPluginConfig(t){this.g={...t},this.P={...this.P,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.Wn=t.series_zoom_mode==="dynamic"}T(){return this.sn||(this.sn=Wr(this.eo)),this.sn}invalidateTheme(){this.sn=null}setView(t){this.ce&&this.ce.dispose(),this.ce=new En(t);let n=this._.isPinned;this._.dismiss(),n&&this.emitUnselect()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this._.attach(this.tooltipCallbacks()),this._.setHost(t),this.gi=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.ce)try{let o=await this.ce.fetchRow(t.rowIdx);n=Object.fromEntries(o)}catch{n={}}let i=[];for(let o=0;o<this.L.length;o++){let r=t.groupByValues[o];r!=null&&r!==""&&i.push([this.L[o],"==",r])}for(let o=0;o<this.w.length;o++){let r=t.splitByValues[o];r!=null&&r!==""&&i.push([this.w[o],"==",r])}return{row:n,column_names:[t.columnName],config:{filter:i}}}emitUserClick(t){let n={row:t.row,column_names:t.column_names,config:t.config};this.gi?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.gi?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this.Pn.then(async()=>{let i=await this.buildClickDetail(t);this.emitUserClick(i),this.emitUserSelect({selected:!0,row:i.row,column_names:i.column_names,insertConfig:i.config})});return this.Pn=n.catch(i=>{console.error("emitClickAndSelect failed",i)}),n}emitUnselect(t={}){let n=this.Pn.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this.Pn=n.catch(i=>{console.error("emitUnselect failed",i)})}requestRender(t){return kr(t,()=>this.It(t))}destroy(){this._.detach(),this._.dismiss(),this.ce&&(this.ce.dispose(),this.ce=null),this.destroyInternal()}}});var Nn,Hr=I(()=>{"use strict";Nn=class{constructor(t,n,i,o,r){d(this,"Qe",new Map);d(this,"ye");d(this,"Ae");d(this,"Et");d(this,"no");this.ye=t,this.Ae=i,this.Et=r,this.no=Math.max(1,Math.ceil((n-t)/r))}io(t,n){return n*this.no+t}insert(t,n,i){let o=Math.floor((n-this.ye)/this.Et),r=Math.floor((i-this.Ae)/this.Et),s=this.io(o,r),a=this.Qe.get(s);a||(a=[],this.Qe.set(s,a)),a.push(t)}query(t,n,i,o,r,s,a){let l=Math.ceil(i/o/this.Et),u=Math.ceil(i/r/this.Et),m=Math.floor((t-this.ye)/this.Et),f=Math.floor((n-this.Ae)/this.Et),b=-1,p=i*i;for(let c=f-u;c<=f+u;c++)for(let h=m-l;h<=m+l;h++){let g=this.Qe.get(this.io(h,c));if(g)for(let y of g){let x=(s[y]-t)*o,C=(a[y]-n)*r,_=x*x+C*C;_<p&&(p=_,b=y)}}return b}}});var Un,Yr=I(()=>{"use strict";Hr();Un=class{constructor(){d(this,"an",null);d(this,"ln",!0)}markDirty(){this.ln=!0}get isDirty(){return this.ln}rebuild(t,n,i){if(n===0){this.an=null,this.ln=!1;return}let o=t.xMax-t.xMin||1,r=t.yMax-t.yMin||1,a=(o+r)/2/Math.max(1,Math.sqrt(n)),l=new Nn(t.xMin,t.xMax,t.yMin,t.yMax,a);i((u,m,f)=>l.insert(u,m,f)),this.an=l,this.ln=!1}query(t,n,i,o,r,s,a){return!this.an||!s||!a?-1:this.an.query(t,n,i,o,r,s,a)}clear(){this.an=null,this.ln=!0}}});function De(e,t,n=[]){let i=new Map;for(let r of e.keys()){if(r.startsWith("__"))continue;let s=r.lastIndexOf("|");if(s===-1)continue;let a=r.substring(0,s);i.has(a)||i.set(a,new Set),i.get(a).add(r)}let o=[];for(let[r,s]of i){let a=new Map,l=!0;for(let u of t){if(!u)continue;let m=`${r}|${u}`,f=e.get(m);if(!s.has(m)||!f?.values){l=!1;break}a.set(u,m)}if(l){for(let u of n){if(!u)continue;let m=`${r}|${u}`;s.has(m)&&e.get(m)?.values&&a.set(u,m)}o.push({prefix:r,colNames:a})}}return o}var Mt=I(()=>{"use strict"});var On,Vr=I(()=>{"use strict";On=class{constructor(t){d(this,"data");d(this,"dictionary",[]);d(this,"dictMap",new Map);this.data=new Int32Array(t),this.data.fill(-1)}set(t,n){let i=this.dictMap.get(n);return i===void 0&&(i=this.dictionary.length,this.dictionary.push(n),this.dictMap.set(n,i)),this.data[t]=i,i}get(t){let n=this.data[t];return n<0?null:this.dictionary[n]}}});function kl(e,t,n,i,o,r){let s=t?[t,n]:[n],a=[];return i&&a.push(i),o&&a.push(o),r&&a.push(r),De(e,s,a).map(l=>({prefix:l.prefix,xColName:t?l.colNames.get(t):"",yColName:l.colNames.get(n),colorColName:i?`${l.prefix}|${i}`:"",sizeColName:o?`${l.prefix}|${o}`:"",labelColName:r?`${l.prefix}|${r}`:""}))}function zr(e,t,n,i){e.glyph.ensureProgram(e,t);let o=e.r,r=e.Z;e.g.domain_mode==="expand"?(e.ye=e.Gn,e.yt=e.kn,e.Ae=e.Nn,e.xt=e.Un,e.f=e.On,e.l=e.Hn,e.et=e.Yn,e.tt=e.Vn):(e.ye=1/0,e.yt=-1/0,e.Ae=1/0,e.xt=-1/0,e.f=1/0,e.l=-1/0,e.et=1/0,e.tt=-1/0,e.Gn=1/0,e.kn=-1/0,e.Nn=1/0,e.Un=-1/0,e.On=1/0,e.Hn=-1/0,e.Yn=1/0,e.Vn=-1/0),e.M=NaN,e.S=NaN,e.Ct=0,e.Zt.clear(),e.yi=0;let a=e.E,l=a[0]||"",u=a[1]||"",m=a[2]||"",f=a[3]||"",b=a[4]||"";e.nt=l,e.it=u,e.oo=!l;let p=t.C.totalCapacity||i;if(e.w.length>0){if(e.v=kl(n,l,u,m,f,b),e.v.length===0){e.R=0,e.U=[];return}if(e._t=e.v[0].xColName,e.ot=e.v[0].yColName,e.r=m,e.q=f,e.zn=b,e.Z=!1,m){let g=n.get(e.v[0].colorColName);e.Z=g?.type==="string"}t.ensureBufferCapacity(p*e.v.length)}else if(e.v=[],e._t=l,e.ot=u,e.r=m,e.q=f,e.zn=b,e.Z=!1,e.r){let g=n.get(e.r);e.Z=g?.type==="string"}(e.r!==o||e.Z!==r)&&(e.a=new Map);let c=Math.max(1,e.v.length);e.R=p,e.U=new Array(c).fill(0);let h=c*p;e.O=new Float32Array(h),e.H=new Float32Array(h),e.vt=new Float32Array(h),e.Pt=new Int32Array(h),e.Wt=b?new On(h):null}function Xr(e,t,n,i,o,r){if(!e.ot)return;let s=o;if(s===0||e.R===0)return;let a=e.v.length>0,l=[];if(a)for(let c of e.v){let h=c.xColName?n.get(c.xColName):null,g=n.get(c.yColName);if(!g?.values)continue;let y=c.sizeColName?n.get(c.sizeColName):null,x=c.colorColName?n.get(c.colorColName)??null:null,C=c.labelColName?n.get(c.labelColName)??null:null;l.push({xCol:h?.values??null,yCol:g.values,xValid:h?.valid,yValid:g.valid,colorCol:x,sizeCol:y?.values??null,labelCol:C})}else{let c=e._t?n.get(e._t):null,h=e.ot?n.get(e.ot):null;if(!h?.values)return;let g=e.r?n.get(e.r)??null:null,y=e.zn?n.get(e.zn)??null:null;l.push({xCol:c?.values??null,yCol:h.values,xValid:c?.valid,yValid:h?.valid,colorCol:g,sizeCol:null,labelCol:y})}if(l.length===0)return;e.ro<s&&(e.xi=new Float32Array(s*2),e.Ci=new Float32Array(s),e._i=new Float32Array(s),e.ro=s);let u=e.xi,m=e.Ci,f=e._i,b=!a&&e.q?n.get(e.q)?.values??null:null;if(e.Z&&e.r){for(let c of l){let h=c.colorCol?.dictionary;if(h)for(let g=0;g<h.length;g++){let y=h[g];e.a.has(y)||e.a.set(y,e.a.size)}}e.a.size>0&&(e.f=0,e.l=e.a.size-1)}!e.r&&e.v.length>1&&(e.f=0,e.l=e.v.length-1);for(let c=0;c<l.length;c++){let h=l[c],g=e.U[c]??0,y=c*e.R,x=e.R-g;if(x<=0)continue;let C=h.colorCol?.valid,_=0;for(let R=0;R<s&&_<x;R++){let L=R;if(h.yValid&&!(h.yValid[L>>3]>>(L&7)&1)||h.xCol&&h.xValid&&!(h.xValid[L>>3]>>(L&7)&1))continue;let w=C!==void 0&&!(C[L>>3]>>(L&7)&1),F=h.yCol[L],G=h.xCol?h.xCol[L]:i+L;if(isNaN(G)||isNaN(F))continue;let[D,B]=e.projectPoint(G,F);if(isNaN(D)||isNaN(B))continue;D<e.ye&&(e.ye=D),D>e.yt&&(e.yt=D),B<e.Ae&&(e.Ae=B),B>e.xt&&(e.xt=B),isNaN(e.M)&&(e.M=D),isNaN(e.S)&&(e.S=B);let P=D-e.M,M=B-e.S,k=y+g+_;e.O[k]=P,e.H[k]=M,e.Pt[k]=i+L,u[_*2]=P,u[_*2+1]=M;let N=h.colorCol;if(w)m[_]=.5,e.vt[k]=.5;else if(N&&!e.Z&&N.values){let W=N.values[L];m[_]=W,e.vt[k]=W,W<e.f&&(e.f=W),W>e.l&&(e.l=W)}else if(N&&e.Z&&N.indices&&N.dictionary){let W=N.dictionary[N.indices[L]];e.a.has(W)||(e.a.set(W,e.a.size),e.l=e.a.size-1);let J=e.a.get(W);m[_]=J,e.vt[k]=J}else m[_]=c,e.vt[k]=c;if(e.Wt&&h.labelCol){let W=h.labelCol,J=W.valid;!(J!==void 0&&!(J[L>>3]>>(L&7)&1))&&W.indices&&W.dictionary&&e.Wt.set(k,W.dictionary[W.indices[L]])}if(h.sizeCol){let W=h.sizeCol[L];f[_]=W,W<e.et&&(e.et=W),W>e.tt&&(e.tt=W)}else if(b){let W=b[L];f[_]=W,W<e.et&&(e.et=W),W>e.tt&&(e.tt=W)}else f[_]=0;_++}if(_===0)continue;let v=(y+g)*2*Float32Array.BYTES_PER_ELEMENT;t.C.upload("a_position",u.subarray(0,_*2),v,2);let A=(y+g)*Float32Array.BYTES_PER_ELEMENT;t.C.upload("a_color_value",m.subarray(0,_),A),t.C.upload("a_size_value",f.subarray(0,_),A),e.U[c]=g+_,e.U[c]>e.yi&&(e.yi=e.U[c])}let p=0;for(let c of e.U)p+=c;e.Ct=p,t.uploadedCount=p,e.Zt.markDirty(),isFinite(e.ye)&&e.setZoomBaseDomain(e.ye,e.yt,e.Ae,e.xt)}var $r=I(()=>{"use strict";Mt();Vr()});function Hn(e,t,n,i,o){let r=e.getContext("2d");r&&(r.save(),r.setTransform(1,0,0,1,0,0),r.scale(o,o),r.font=`11px ${i.fontFamily}`,r.fillStyle=i.ge,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var ao=I(()=>{"use strict"});var j,Ae=I(()=>{"use strict";j=class{constructor(t,n,i){d(this,"margins");d(this,"t");d(this,"cssWidth");d(this,"cssHeight");d(this,"J",0);d(this,"se",1);d(this,"ee",0);d(this,"ae",1);this.cssWidth=t,this.cssHeight=n;let r=(i.leftExtra??55)+(i.hasYLabel?16:0),a=(i.bottomExtra??24)+(i.hasXLabel?18:0),l=0,u=i.rightExtra??(i.hasLegend?80:16),m=i.originX??0,f=i.originY??0,b=i.cellWidth??t,p=i.cellHeight??n,c=m+r,h=f+l,g=Math.max(1,b-r-u),y=Math.max(1,p-l-a),x=t-(c+g),C=n-(h+y);this.margins={top:h,right:x,bottom:C,left:c},this.t={x:c,y:h,width:g,height:y}}buildProjectionMatrix(t,n,i,o,r,s,a=.02,l=0,u=0){let m=n-t,f=o-i;m===0&&(m=1),f===0&&(f=1);let b=m*a,p=f*a,c=s&&r==="y"&&i>=0,h=s&&r==="y"&&o<=0,g=s&&r==="x"&&t>=0,y=s&&r==="x"&&n<=0;t-=b,n+=b,i-=p,o+=p,c?(i=0,o+=p):h&&(o=0,i-=p),g?(t=0,n+=b):y&&(n=0,t-=b),this.J=t,this.se=n,this.ee=i,this.ae=o;let x=2*this.margins.left/this.cssWidth-1,C=1-2*this.margins.right/this.cssWidth,_=2*this.margins.bottom/this.cssHeight-1,v=1-2*this.margins.top/this.cssHeight,A=(C-x)/(n-t),R=(v-_)/(o-i),L=x-A*(t-l),w=_-R*(i-u);return new Float32Array([A,0,0,0,0,R,0,0,0,0,-1,0,L,w,0,1])}G(t,n){let{x:i,y:o,width:r,height:s}=this.t,a=(t-this.J)/(this.se-this.J),l=(n-this.ee)/(this.ae-this.ee);return{px:i+a*r,py:o+(1-l)*s}}}});function jr(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function Zr(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function zl(e,t,n,i){if(e<=1)return{cols:1,rows:1};let o=1,r=e,s=1/0,a=e;for(let l=1;l<=e;l++){let u=Math.ceil(e/l),m=Math.max(1,(t-(l-1)*i)/l),f=Math.max(1,(n-(u-1)*i)/u),b=m/f,p=Math.max(b,1/b),c=l*u;(p<s||p===s&&c<a)&&(o=l,r=u,s=p,a=c)}return{cols:o,rows:r}}function Ie(e,t){let n=e.length,{cssWidth:i,cssHeight:o}=t;if(n<=0||i<=0||o<=0)return{cells:[]};let r=t.titleBand??Yl,s=t.hasLegend?Vl:0,a=t.xAxis??"cell",l=t.yAxis??"cell",u=a==="none"&&l==="none",m=l==="outer"?Nl+(t.hasYLabel?Ol:0):0,f=a==="outer"?Ul+(t.hasXLabel?Hl:0):0,b=0,p=s,c=m,h=b,g=Math.max(1,i-m-p),y=Math.max(1,o-b-f),x=Math.max(0,t.gap??0),{cols:C,rows:_}=zl(n,g,y,x),v=Math.max(0,C-1)*x,A=Math.max(0,_-1)*x,R=Math.max(1,(g-v)/C),L=Math.max(1,(y-A)/_),w=[];for(let B=0;B<n;B++){let P=Math.floor(B/C),M=B-P*C,k=P===_-1||B+C>=n,N=M===0,W=c+M*(R+x),J=h+P*(L+x),U=J+r,O=W,ne=R,fe=Math.max(1,L-r),ce=new j(i,o,{hasXLabel:a==="cell"&&t.hasXLabel===!0,hasYLabel:l==="cell"&&t.hasYLabel===!0,hasLegend:!1,leftExtra:l==="cell"?void 0:0,bottomExtra:a==="cell"?void 0:0,rightExtra:u?0:void 0,originX:O,originY:U,cellWidth:ne,cellHeight:fe}),de=r>0?{x:O,y:J,width:ne,height:r}:void 0;w.push({index:B,label:e[B],layout:ce,titleRect:de,isLeftEdge:N,isBottomEdge:k})}let F=t.hasLegend?{x:c+g,y:b,width:s,height:y}:void 0,G=a==="outer"?{x:c,y:h+y,width:g,height:f}:void 0;return{cells:w,legendRect:F,outerXAxisRect:G,outerYAxisRect:l==="outer"?{x:0,y:h,width:m,height:y}:void 0}}var Nl,Ul,Ol,Hl,Yl,Vl,St=I(()=>{"use strict";Ae();Nl=55,Ul=24,Ol=16,Hl=18,Yl=18,Vl=96});function Xl(e,t){if(t<=0)return[];let n=new Array(t);for(let i=0;i<t;i++){let o=t===1?.5:i/(t-1),r=be(e,o);n[i]=[r[0],r[1],r[2]]}return n}function re(e,t,n){if(e.length>0){if(e.length>=n)return e.slice(0,n);let i=new Array(n);for(let o=0;o<n;o++)i[o]=e[o%e.length];return i}return Xl(t,n)}var Bt=I(()=>{"use strict";ve()});function Dt(e){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}function It(e,t,n,i){e.enable(e.SCISSOR_TEST),e.scissor(Math.round(t.margins.left*n),Math.round(t.margins.bottom*n),Math.round(t.t.width*n),Math.round(t.t.height*n));try{i()}finally{e.disable(e.SCISSOR_TEST)}}function Ee(e,t,n,i){Dt(e),It(e,t,n,i)}var Et=I(()=>{"use strict"});function Pt(e,t,n){let i=e.gl,o;if(t?.texture){if(o=t.texture,t.lastStops===n)return t}else o=i.createTexture();let r=Er(n,qr);return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,qr,1,0,i.RGBA,i.UNSIGNED_BYTE,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),{texture:o,lastStops:n}}function Le(e,t,n,i=0){let o=e.gl;o.activeTexture(o.TEXTURE0+i),o.bindTexture(o.TEXTURE_2D,t),o.uniform1i(n,i)}var qr,tt=I(()=>{"use strict";ve();qr=256});function ae(e,t,n){e.width=Math.round(t.cssWidth*n),e.height=Math.round(t.cssHeight*n);let i=e.getContext("2d");return i?(i.scale(n,n),i.clearRect(0,0,t.cssWidth,t.cssHeight),i):null}function ge(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var nt=I(()=>{"use strict"});function Yn(e,t,n,i,o,r,s){let a=o==="bottom"?1:-1;e.textAlign="center",e.textBaseline=o==="bottom"?"top":"bottom";let l=a*8;for(let u of n){let m=r(u);m<t.x-1||m>t.x+t.width+1||(e.beginPath(),e.moveTo(m,i),e.lineTo(m,i+a*5),e.stroke(),e.fillText(s(u),m,i+l))}}function Vn(e,t,n,i,o,r,s){let a=o==="left"?-1:1;e.textAlign=o==="left"?"right":"left",e.textBaseline="middle";let l=a*8;for(let u of n){let m=r(u);m<t.y-1||m>t.y+t.height+1||(e.beginPath(),e.moveTo(i,m),e.lineTo(i+a*5,m),e.stroke(),e.fillText(s(u),i+l,m))}}function zn(e,t,n,i){for(let o of n){let r=Math.round(i(o))+.5;r<t.x||r>t.x+t.width||(e.beginPath(),e.moveTo(r,t.y),e.lineTo(r,t.y+t.height),e.stroke())}}function Xn(e,t,n,i){for(let o of n){let r=Math.round(i(o))+.5;r<t.y||r>t.y+t.height||(e.beginPath(),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke())}}var lo=I(()=>{"use strict"});function it(e,t,n){let{t:i}=n,o=Math.max(2,Math.floor(i.width/90)),r=Math.max(2,Math.floor(i.height/60));return{xTicks:te(e.min,e.max,o),yTicks:te(t.min,t.max,r)}}function uo(e,t,n,i,o,r){let s=ge(e,r);if(!s)return;let{t:a}=t;s.strokeStyle=o.Bn,s.lineWidth=1,zn(s,a,n,l=>t.G(l,0).px),Xn(s,a,i,l=>t.G(0,l).py)}function Kr(e,t,n){if(n)return n;let i=t.length>1?t[1]-t[0]:0;return e.isDate?o=>le(o,i):ie}function Jr(e,t,n,i,o,r,s,a,l){let{Dt:u,ge:m,fi:f,fontFamily:b}=s,p=Kr(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(r.x,o),e.lineTo(r.x+r.width,o),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let c of i)Yn(e,c.t,n,o,"bottom",h=>c.G(h,0).px,p);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,a.cx,a.baselineY))}function Qr(e,t,n,i,o,r,s,a,l){let{Dt:u,ge:m,fi:f,fontFamily:b}=s,p=Kr(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(o,r.y),e.lineTo(o,r.y+r.height),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let c of i)Vn(e,c.t,n,o,"left",h=>c.G(0,h).py,p);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.save(),e.translate(14,a.pivotY),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,0,0),e.restore())}function mo(e,t,n,i,o,r,s,a){let l=ge(e,s);if(!l)return;let{t:u}=n;Jr(l,t,i,[n],u.y+u.height,u,o,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,a)}function fo(e,t,n,i,o,r,s,a){let l=ge(e,s);if(!l)return;let{t:u}=n;Qr(l,t,i,[n],u.x,u,o,r?{pivotY:u.y+u.height/2}:null,a)}function es(e,t,n,i,o,r,s,a,l,u){fo(e,n,i,r,s,!0,a,u),mo(e,t,i,o,s,!0,a,l)}function ts(e,t,n,i,o,r,s,a,l){let u=ge(e,a);u&&Jr(u,n,i,o,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,l)}function ns(e,t,n,i,o,r,s,a,l){let u=ge(e,a);u&&Qr(u,n,i,o,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,l)}var is=I(()=>{"use strict";pe();nt();lo()});function $l(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function Te(e,t,n,i,o,r){let s={x:t.t.x+t.t.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.t.x-t.t.width-12),height:Math.max(1,t.t.height)};Wt(e,s,n,i,o,r)}function Wt(e,t,n,i,o,r=ie){let s=e.getContext("2d");if(!s)return;let a=o.ci,l=o.Ro,u=o.fontFamily,m=16,f=Math.min(120,t.height*.4),b=t.x,p=t.y;s.fillStyle=a,s.font=`9px ${u}`,s.textAlign="left",s.textBaseline="bottom",s.fillText(n.label,b,p-4);let c=n.max,h=n.min,g=s.createLinearGradient(0,p,0,p+f),y=16;for(let C=0;C<=y;C++){let _=C/y,v=c+_*(h-c),A=Xe(v,n.min,n.max),R=be(i,A);g.addColorStop(_,$l(R))}s.fillStyle=g,s.fillRect(b,p,m,f),s.strokeStyle=l,s.lineWidth=1,s.strokeRect(b,p,m,f),s.fillStyle=a,s.font=`10px ${u}`,s.textAlign="left",s.textBaseline="middle";let x=b+m+5;if(s.fillText(r(n.max),x,p+2),s.fillText(r((n.min+n.max)/2),x,p+f/2),s.fillText(r(n.min),x,p+f-2),n.min<0&&n.max>0){let C=(n.max-0)/(n.max-n.min),_=p+C*f;s.strokeStyle=a,s.lineWidth=1,s.beginPath(),s.moveTo(b+m,_),s.lineTo(b+m+4,_),s.stroke(),s.fillStyle=a,s.fillText("0",x,_)}}function ot(e,t,n,i,o){let r={x:t.t.x+t.t.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.t.x-t.t.width-12),height:Math.max(1,t.t.height)};Gt(e,r,n,i,o)}function Gt(e,t,n,i,o){let r=e.getContext("2d");if(!r||n.size===0)return;let s=o.ci,a=o.fontFamily,l=10,u=18,m=t.x,f=t.y+u/2;r.font=`11px ${a}`,r.textAlign="left",r.textBaseline="middle";for(let[b,p]of n){if(f+l/2>t.y+t.height)break;let c=i[p]??i[p%i.length]??[0,0,0];r.fillStyle=`rgb(${Math.round(c[0]*255)},${Math.round(c[1]*255)},${Math.round(c[2]*255)})`,r.fillRect(m,f-l/2,l,l),r.fillStyle=s,r.fillText(b,m+l+6,f),f+=u}}var rt=I(()=>{"use strict";pe();ve()});function Pe(e){return isNaN(e)?0:e}function os(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0)return;let s=e.v.length>0,a=e.P.facet_mode,l=s&&a==="grid";e.computeEffectiveFacetFlags();let u=e.r!==""&&e.f<e.l,m=l&&e.P.zoom_mode==="independent",f;if(e.h&&!m?f=e.h.getVisibleDomain():f={xMin:e.ye,xMax:e.yt,yMin:e.Ae,yMax:e.xt},!isFinite(f.xMin)||!isFinite(f.yMin))return;let b=e.T(),p=b.Se,c=e.Je[e.nt]||"",h=e.Je[e.it]||"",g=c==="date"||c==="datetime",y=h==="date"||h==="datetime",x=e.Z,C=!x&&!e.r,_=b.V;if(x||C){let v=C?Math.max(1,e.v.length):Math.max(1,e.a.size);if(e.Xn&&e.vi===p&&e.Ai===v)_=e.Xn;else{let A=re(p,b.V,v);_=Ir(A),e.Xn=_,e.vi=p,e.Ai=v}}else e.Xn=null,e.vi=null,e.Ai=-1;e.te=Pt(t,e.te,_),l?Zl(e,t,f,b,{xIsDate:g,yIsDate:y,cssWidth:o,cssHeight:r}):(e.A=null,jl(e,t,f,b,{xIsDate:g,yIsDate:y,cssWidth:o,cssHeight:r,hasColorCol:u})),We(e)}function $n(e,t,n,i){return{min:t,max:n,label:e.nt||(e.oo?"Row":e._t||""),isDate:i}}function jn(e,t,n,i){return{min:t,max:n,label:e.it||e.ot,isDate:i}}function jl(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u,hasColorCol:m}=o,f=new j(s,a,{hasXLabel:!!e.nt,hasYLabel:!!e.it,hasLegend:m});e.u=f,e.h&&e.h.updateLayout(f);let b=f.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,Pe(e.M),Pe(e.S)),p=$n(e,n.xMin,n.xMax,l),c=jn(e,n.yMin,n.yMax,u),{xTicks:h,yTicks:g}=it(p,c,f),y=e.un==="map";if(e.I&&!y){let x=t.dpr;ae(e.I,f,x),uo(e.I,f,h,g,i,x)}else e.I&&y&&ae(e.I,f,t.dpr);Ee(r,f,t.dpr,()=>{y&&e.renderBackground(t,f,b,n,Pe(e.M),Pe(e.S)),e.glyph.draw(e,t,b)}),e.Le=p,e.Te=c,e.$n=h,e.Be=g,e.jn=i.V,e.Zn=m}function Zl(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u}=o,m=e.v.map(v=>v.prefix),f=e.Z&&e.a.size>1,b=!!e.r&&!e.Z&&e.f<e.l,p=f||b,c=Ie(m,{cssWidth:s,cssHeight:a,xAxis:e.Dn?"outer":"cell",yAxis:e.In?"outer":"cell",hasLegend:p,hasXLabel:!!e.nt,hasYLabel:!!e.it,gap:e.P.facet_padding});if(e.A=c,c.cells.length>1){let v=c.cells[0].layout.t;for(let A=1;A<c.cells.length;A++){let R=c.cells[A].layout.t;if(R.width!==v.width||R.height!==v.height){console.warn(`facet-grid: cell ${A} size (${R.width}\\xD7${R.height}) differs from cell 0 (${v.width}\\xD7${v.height})`);break}}}e.u=c.cells[0]?.layout??null,e.syncFacetZoomLayouts(c.cells);let h=e.P.zoom_mode==="independent",g=$n(e,n.xMin,n.xMax,l),y=jn(e,n.yMin,n.yMax,u),x=c.cells[0]?.layout,{xTicks:C,yTicks:_}=x?it(g,y,x):{xTicks:[],yTicks:[]};e.I&&x&&ae(e.I,x,t.dpr),Dt(r);for(let v=0;v<c.cells.length;v++){let A=c.cells[v],R=e.getZoomControllerForFacet(v),L=h&&R?R.getVisibleDomain():n,w=A.layout.buildProjectionMatrix(L.xMin,L.xMax,L.yMin,L.yMax,void 0,void 0,void 0,Pe(e.M),Pe(e.S)),F=e.un==="map";if(e.I&&!F){let G=h?it($n(e,L.xMin,L.xMax,l),jn(e,L.yMin,L.yMax,u),A.layout).xTicks:C,D=h?it($n(e,L.xMin,L.xMax,l),jn(e,L.yMin,L.yMax,u),A.layout).yTicks:_;uo(e.I,A.layout,G,D,i,t.dpr)}It(r,A.layout,t.dpr,()=>{F&&e.renderBackground(t,A.layout,w,L,Pe(e.M),Pe(e.S)),e.glyph.drawSeries(e,t,w,v)})}e.Le=g,e.Te=y,e.$n=C,e.Be=_,e.jn=i.V,e.Zn=p}function We(e){!e.d||!e.u||!e.Le||!e.Te||!e.e||(ae(e.d,e.u,e.e.dpr),e.A?Kl(e):ql(e))}function ql(e){let t=e.u,n=e.T(),i=e.e?.dpr??1;if(e.un==="map"?e.renderMapChrome(e.d,t,n,i):es(e.d,e.Le,e.Te,t,e.$n,e.Be,n,i,e.getColumnFormatter(e._t,"tick"),e.getColumnFormatter(e.ot,"tick")),e.Zn){let r=e.jn??n.V;if(e.Z&&e.a.size>0){let s=re(n.Se,r,e.a.size);ot(e.d,t,e.a,s,n)}else e.r&&Te(e.d,t,{min:e.f,max:e.l,label:e.r},r,n,e.getColumnFormatter(e.r,"value"))}rs(e,e.d,t,0,1),e.le>=0&&e.O&&e.H&&eu(e,e.d,t)}function Kl(e){let t=e.A,n=e.d,i=e.T(),o=e.e?.dpr??1,r=e.$n,s=e.Be,a=e.Le,l=e.Te,u=e.un==="map",m=e.Dn,f=e.In,b=e.P.zoom_mode==="independent";u&&e.renderMapChrome(n,e.u,i,o),!u&&m&&t.outerXAxisRect&&ts(n,t.outerXAxisRect,a,r,jr(t),i,!!e.nt,o,e.getColumnFormatter(e._t,"tick")),!u&&f&&t.outerYAxisRect&&ns(n,t.outerYAxisRect,l,s,Zr(t),i,!!e.it,o,e.getColumnFormatter(e.ot,"tick"));for(let p=0;p<t.cells.length;p++){let c=t.cells[p],h=b?e.getZoomControllerForFacet(p):null,g=h?h.getVisibleDomain():null,y=g?{...a,min:g.xMin,max:g.xMax}:a,x=g?{...l,min:g.yMin,max:g.yMax}:l,C=b?it(y,x,c.layout):{xTicks:r,yTicks:s};!u&&!m&&mo(n,y,c.layout,C.xTicks,i,!!e.nt,o,e.getColumnFormatter(e._t,"tick")),!u&&!f&&fo(n,x,c.layout,C.yTicks,i,!!e.it,o,e.getColumnFormatter(e.ot,"tick")),c.titleRect&&Hn(n,c.label,c.titleRect,i,o),rs(e,n,c.layout,p,p+1)}if(e.Zn&&t.legendRect){let p=e.jn??i.V;if(e.Z&&e.a.size>0){let c=re(i.Se,p,Math.max(1,e.a.size));Gt(n,t.legendRect,e.a,c,i)}else e.r&&Wt(n,{x:t.legendRect.x,y:t.legendRect.y+20,width:t.legendRect.width,height:t.legendRect.height-20},{min:e.f,max:e.l,label:e.r},p,i,e.getColumnFormatter(e.r,"value"))}if(e.le>=0&&e.O&&e.H){let p=isNaN(e.M)?0:e.M,c=isNaN(e.S)?0:e.S,h=e.O[e.le]+p,g=e.H[e.le]+c,y=Jl(e,e.le),x=e.glyph.tooltipOptions(),C=e.k.lines??[];for(let _=0;_<t.cells.length;_++){let v=t.cells[_],A=_===y,R=v.layout.G(h,g),L=v.layout.t;if(R.px<L.x||R.px>L.x+L.width||R.py<L.y||R.py>L.y+L.height)continue;let w=e.P.coordinated_tooltip;_e(n,R,A||w?C:[],v.layout,i,o,{crosshair:x.crosshair,highlightRadius:A?x.highlightRadius:0})}}}function Jl(e,t){return e.R<=0?0:Math.floor(t/e.R)}function rs(e,t,n,i,o){if(!e.Wt||!e.O||!e.H)return;let r=e.Wt.dictionary,s=e.Wt.data,a=e.O,l=e.H,u=isNaN(e.M)?0:e.M,m=isNaN(e.S)?0:e.S,f=e.R;if(f<=0)return;let b=0;for(let x=i;x<o;x++)b+=e.U[x]??0;if(b===0)return;let p=e.e?.dpr??1,c=ge(t,p);if(!c)return;let h=e.T(),g=n.t,y=Math.max(1,Math.ceil(b/Ql));c.save(),c.font=`11px ${h.fontFamily}`,c.fillStyle=h.ge,c.textAlign="left",c.textBaseline="middle";for(let x=i;x<o;x++){let C=e.U[x]??0,_=x*f;for(let v=0;v<C;v+=y){let A=_+v,R=s[A];if(R<0)continue;let{px:L,py:w}=n.G(a[A]+u,l[A]+m);L<g.x||L>g.x+g.width||w<g.y||w>g.y+g.height||c.fillText(r[R],L+8,w-4)}}c.restore()}function eu(e,t,n){let i=e.le;if(i<0||!e.O||!e.H)return;let o=isNaN(e.M)?0:e.M,r=isNaN(e.S)?0:e.S,s=n.G(e.O[i]+o,e.H[i]+r),a=e.k.lines??[],l=e.T();_e(t,s,a,n,l,e.e?.dpr??1,e.glyph.tooltipOptions())}var Ql,co=I(()=>{"use strict";ao();Ae();St();Bt();ve();Et();tt();et();is();nt();rt();Ql=5e3});function tu(e){if(!e.Zt.isDirty||!e.O||!e.H)return;let t=e.O,n=e.H,i=Math.max(1,e.v.length),o=e.R,r=isNaN(e.M)?0:e.M,s=isNaN(e.S)?0:e.S;e.Zt.rebuild({xMin:e.ye-r,xMax:e.yt-r,yMin:e.Ae-s,yMax:e.xt-s},e.Ct,a=>{for(let l=0;l<i;l++){let u=e.U[l]??0,m=l*o;for(let f=0;f<u;f++)a(m+f,t[m+f],n[m+f])}})}function po(e,t,n){if(!e.O||!e.H)return;let{layout:i,facetIdx:o}=nu(e,t,n);if(!i){ss(e);return}let r=i.t;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){ss(e);return}let s=i.J,a=i.se,l=i.ee,u=i.ae,m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),p=r.height/(u-l),c=isNaN(e.M)?0:e.M,h=isNaN(e.S)?0:e.S,g=m-c,y=f-h,x=o<0?iu(e,g,y,b,p):ou(e,o,g,y,b,p);if(x!==e.le||o!==e.mn){if(e.le=x,e.mn=o,x>=0){let C=e.k.beginHover(x);e.glyph.buildTooltipLines(e,x).then(_=>{e.k.commitHover(C,_)&&We(e)})}else e.k.clearHover();We(e)}}function ss(e){(e.le!==-1||e.mn!==-1)&&(e.le=-1,e.mn=-1,We(e))}function nu(e,t,n){if(e.A){let i=e.A.cells;for(let o=0;o<i.length;o++){let r=i[o].layout.t;if(t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)return{layout:i[o].layout,facetIdx:o}}return{layout:null,facetIdx:-1}}return{layout:e.u,facetIdx:-1}}function iu(e,t,n,i,o){tu(e);let r=e.Zt.query(t,n,kt,i,o,e.O,e.H);if(r>=0)return r;let s=kt*kt,a=Math.max(1,e.v.length),l=e.R,u=e.O,m=e.H;for(let f=0;f<a;f++){let b=e.U[f]??0,p=f*l;for(let c=0;c<b;c++){let h=p+c,g=(u[h]-t)*i,y=(m[h]-n)*o,x=g*g+y*y;x<s&&(s=x,r=h)}}return r}function ou(e,t,n,i,o,r){let s=e.U[t]??0;if(s===0)return-1;let a=e.R,l=t*a,u=e.O,m=e.H,f=kt*kt,b=-1;for(let p=0;p<s;p++){let c=l+p,h=(u[c]-n)*o,g=(m[c]-i)*r,y=h*h+g*g;y<f&&(f=y,b=c)}return b}function as(e,t){if(e._.dismiss(),e.Li=t,t<0||!e.O||!e.H)return;let n=ru(e,t);if(!n)return;let i=isNaN(e.M)?0:e.M,o=isNaN(e.S)?0:e.S,r=n.G(e.O[t]+i,e.H[t]+o),s=e.k.beginPin();e.glyph.buildTooltipLines(e,t).then(a=>{e.k.isPinFresh(s)&&e.Li===t&&a.length!==0&&e._.pin(a,r,n)}),e.le=-1,e.mn=-1,We(e)}function ru(e,t){if(e.A&&e.R>0){let n=Math.floor(t/e.R),i=e.A.cells[n];if(i)return i.layout}return e.u}function ls(e){e._.dismiss(),e.Li=-1}var kt,us=I(()=>{"use strict";co();kt=24});var st,bo=I(()=>{"use strict";st=class{constructor(){d(this,"lines",null);d(this,"hoveredTarget",null);d(this,"Ti",0);d(this,"wi",0)}beginHover(t){return this.lines=null,this.hoveredTarget=t,++this.Ti}commitHover(t,n){return t!==this.Ti?!1:(this.lines=n,!0)}clearHover(){this.lines=null,this.hoveredTarget=null,this.Ti++}beginPin(){return++this.wi}isPinFresh(t){return t===this.wi}invalidatePin(){this.wi++}}});async function Zn(e,t){let n=[];if(!e.Pt||!e.ce)return n;let i=e.Pt[t];if(i<0)return n;if(e.v.length>0&&e.R>0){let s=Math.floor(t/e.R),a=e.v[s];a?.prefix&&n.push(a.prefix)}let o=await e.ce.fetchRow(i),r=e.v.length>0&&e.R>0?e.v[Math.floor(t/e.R)]?.prefix??null:null;for(let[s,a]of o){if(a==null)continue;let l=s;if(r!==null){let u=`${r}|`;if(!s.startsWith(u))continue;l=s.substring(u.length)}else if(s.includes("|"))continue;if(typeof a=="number"){let u=e.getColumnFormatter(s,"value")(a);n.push(`${l}: ${u}`)}else n.push(`${l}: ${a}`)}return n}var ho=I(()=>{"use strict"});function su(e,t,n,i,o){t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,i.g.point_size_px*o),i.f<i.l?t.uniform2f(e.u_color_range,i.f,i.l):t.uniform2f(e.u_color_range,0,0),i.et<i.tt?t.uniform2f(e.u_size_range,i.et,i.tt):t.uniform2f(e.u_size_range,0,0);let r=Math.min(i.g.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*o,i.g.point_size_px/r*o),i.g.point_size_px*r*o)}function ms(e,t,n,i){let o=n.gl;if(!t.te)return!1;o.useProgram(e.program),su(e,o,i,t,n.dpr),Le(n,t.te.texture,e.u_gradient_lut,0);let r=n.C.peek("a_position"),s=n.C.peek("a_color_value"),a=n.C.peek("a_size_value");return!r||!s||!a?!1:(o.bindBuffer(o.ARRAY_BUFFER,r.buffer),o.enableVertexAttribArray(e.a_position),o.vertexAttribPointer(e.a_position,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,s.buffer),o.enableVertexAttribArray(e.a_color_value),o.vertexAttribPointer(e.a_color_value,1,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,a.buffer),o.enableVertexAttribArray(e.a_size_value),o.vertexAttribPointer(e.a_size_value,1,o.FLOAT,!1,0,0),!0)}var at,go=I(()=>{"use strict";tt();ho();$i();ji();at=class{constructor(){d(this,"name","point");d(this,"c",null)}ensureProgram(t,n){if(this.c)return;let i=n.gl,o=n.shaders.getOrCreate("scatter",fn,cn);this.c={program:o,u_projection:i.getUniformLocation(o,"u_projection"),u_point_size:i.getUniformLocation(o,"u_point_size"),u_color_range:i.getUniformLocation(o,"u_color_range"),u_gradient_lut:i.getUniformLocation(o,"u_gradient_lut"),u_size_range:i.getUniformLocation(o,"u_size_range"),u_point_size_range:i.getUniformLocation(o,"u_point_size_range"),a_position:i.getAttribLocation(o,"a_position"),a_color_value:i.getAttribLocation(o,"a_color_value"),a_size_value:i.getAttribLocation(o,"a_size_value")}}draw(t,n,i){let o=this.c;if(!o||!ms(o,t,n,i))return;let r=n.gl,s=Math.max(1,t.v.length),a=t.R;for(let l=0;l<s;l++){let u=t.U[l]??0;u<=0||r.drawArrays(r.POINTS,l*a,u)}}drawSeries(t,n,i,o){let r=this.c;if(!r||!ms(r,t,n,i))return;let s=t.U[o]??0;if(s<=0)return;let a=n.gl,l=t.R;a.drawArrays(a.POINTS,o*l,s)}buildTooltipLines(t,n){return Zn(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6}}destroy(t){this.c=null}}});function K(e){let t=e.gl;if(e.isWebGL2){let i=t;return{setDivisor(o,r){o<0||i.vertexAttribDivisor(o,r)},drawArraysInstanced(o,r,s,a){i.drawArraysInstanced(o,r,s,a)}}}let n=t.getExtension("ANGLE_instanced_arrays");return{setDivisor(i,o){i<0||n?.vertexAttribDivisorANGLE(i,o)},drawArraysInstanced(i,o,r,s){n?.drawArraysInstancedANGLE(i,o,r,s)}}}function Ge(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,1,2,3]),e.STATIC_DRAW),t}function fs(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW),t}function ke(e,t,n,i,o){if(n<0)return!0;let r=e.C.peek(i);if(!r)return!1;let s=e.gl;return s.bindBuffer(s.ARRAY_BUFFER,r.buffer),s.enableVertexAttribArray(n),s.vertexAttribPointer(n,o,s.FLOAT,!1,0,0),t.setDivisor(n,1),!0}var we=I(()=>{"use strict"});function cs(e,t,n,i){let o=n.gl;if(!t.te)return!1;let r=n.dpr;o.useProgram(e.program),o.uniformMatrix4fv(e.u_projection,!1,i),o.uniform2f(e.u_resolution,o.canvas.width,o.canvas.height),o.uniform1f(e.u_line_width,t.g.line_width_px*r),t.f<t.l?o.uniform2f(e.u_color_range,t.f,t.l):o.uniform2f(e.u_color_range,0,0),Le(n,t.te.texture,e.u_gradient_lut,0);let s=K(n),{setDivisor:a}=s;return o.bindBuffer(o.ARRAY_BUFFER,e.cornerBuffer),o.enableVertexAttribArray(e.a_corner),o.vertexAttribPointer(e.a_corner,1,o.FLOAT,!1,0,0),a(e.a_corner,0),o.enableVertexAttribArray(e.a_start),a(e.a_start,1),o.enableVertexAttribArray(e.a_end),a(e.a_end,1),o.enableVertexAttribArray(e.a_color_start),a(e.a_color_start,1),o.enableVertexAttribArray(e.a_color_end),a(e.a_color_end,1),!0}function ds(e,t,n,i){let o=t.U[i]??0;if(o<2)return;let r=n.gl,s=t.R,a=2*Float32Array.BYTES_PER_ELEMENT,l=Float32Array.BYTES_PER_ELEMENT,u=n.C.peek("a_position"),m=n.C.peek("a_color_value");if(!u||!m)return;let f=i*s*a;r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(e.a_start,2,r.FLOAT,!1,a,f),r.vertexAttribPointer(e.a_end,2,r.FLOAT,!1,a,f+a);let b=i*s*l;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,l,b),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,l,b+l),K(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,o-1)}function ps(e,t){let{setDivisor:n}=K(t);n(e.a_start,0),n(e.a_end,0),n(e.a_color_start,0),n(e.a_color_end,0)}var lt,yo=I(()=>{"use strict";tt();we();pe();zi();Xi();lt=class{constructor(){d(this,"name","line");d(this,"c",null)}ensureProgram(t,n){if(this.c)return;let i=n.gl,o=n.shaders.getOrCreate("line",un,mn),r=Ge(i);this.c={program:o,cornerBuffer:r,u_projection:i.getUniformLocation(o,"u_projection"),u_resolution:i.getUniformLocation(o,"u_resolution"),u_line_width:i.getUniformLocation(o,"u_line_width"),u_color_range:i.getUniformLocation(o,"u_color_range"),u_gradient_lut:i.getUniformLocation(o,"u_gradient_lut"),a_start:i.getAttribLocation(o,"a_start"),a_end:i.getAttribLocation(o,"a_end"),a_color_start:i.getAttribLocation(o,"a_color_start"),a_color_end:i.getAttribLocation(o,"a_color_end"),a_corner:i.getAttribLocation(o,"a_corner")}}draw(t,n,i){let o=this.c;if(!o||!cs(o,t,n,i))return;let s=Math.max(1,t.v.length);for(let a=0;a<s;a++)ds(o,t,n,a);ps(o,n)}drawSeries(t,n,i,o){let r=this.c;r&&cs(r,t,n,i)&&(ds(r,t,n,o),ps(r,n))}async buildTooltipLines(t,n){let i=[];if(!t.O||!t.H)return i;if(t.v.length>0&&t.R>0){let b=Math.floor(n/t.R),p=t.v[b];p&&i.push(p.prefix)}let o=t.O[n],r=t.H[n],s=t.Je[t.nt]||"",l=s==="date"||s==="datetime"?le(o):ie(o);i.push(`${t.nt||"Row"}: ${l}`);let u=t.Je[t.it]||"",f=u==="date"||u==="datetime"?le(r):ie(r);return i.push(`${t.it}: ${f}`),i}tooltipOptions(){return{crosshair:!0,highlightRadius:5}}destroy(t){let n=this.c;n?.cornerBuffer&&t.e&&t.e.gl.deleteBuffer(n.cornerBuffer),this.c=null}}});function fu(e){switch(e){case"density":return au;case"extreme":return uu;case"signed":return mu;case"mean":default:return lu}}function bs(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function xo(e,t){return{program:t,u_projection:e.getUniformLocation(t,"u_projection"),u_radius_ndc:e.getUniformLocation(t,"u_radius_ndc"),u_intensity:e.getUniformLocation(t,"u_intensity"),u_color_range:e.getUniformLocation(t,"u_color_range"),a_corner:e.getAttribLocation(t,"a_corner"),a_position:e.getAttribLocation(t,"a_position"),a_color_value:e.getAttribLocation(t,"a_color_value")}}function cu(e){let t=e.gl;if(e.isWebGL2){let n=t;if(n.getExtension("EXT_color_buffer_float"))return{internalFormat:n.RGBA16F,format:n.RGBA,type:n.HALF_FLOAT,isFloat:!0}}return{internalFormat:t.RGBA,format:t.RGBA,type:t.UNSIGNED_BYTE,isFloat:!1}}function hs(e){let t=e.C.peek("a_position"),n=e.C.peek("a_color_value");return!!t&&!!n}function pu(e,t){if(!e.r||e.Z)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.Ct&&n.colorName===e.r&&n.colorIsString===e.Z)return{lo:n.lo,hi:n.hi};let i=bu(e);return i?(t.robustBounds={lo:i.lo,hi:i.hi,dataCount:e.Ct,colorName:e.r,colorIsString:e.Z},i):(t.robustBounds=null,null)}function bu(e){if(!e.vt||e.Ct<2)return null;let t=e.R,n=Math.max(1,e.v.length),i=Math.max(1,Math.ceil(e.Ct/du)),o=[],r=e.vt;for(let m=0;m<n;m++){let f=e.U[m]??0,b=m*t;for(let p=0;p<f;p+=i){let c=r[b+p];Number.isFinite(c)&&o.push(c)}}if(o.length<2)return null;o.sort((m,f)=>m-f);let s=Math.floor(o.length*.05),a=Math.min(o.length-1,Math.ceil(o.length*.95)),l=o[s],u=o[a];return u>l?{lo:l,hi:u}:e.l>e.f?{lo:e.f,hi:e.l}:null}var au,lu,uu,mu,ut,du,Co=I(()=>{"use strict";tt();we();ho();Zi();qi();Ki();pr();hr();Ji();Qi();au=0,lu=1,uu=2,mu=3,ut=class{constructor(){d(this,"name","density");d(this,"c",null)}ensureProgram(t,n){if(this.c){this.ensureHeatTarget(t,n);return}let i=n.gl,o=n.shaders.getOrCreate("density-splat",Je,Tn),r=n.shaders.getOrCreate("density-resolve",Rn,Fn),s=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,s),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let a=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,a),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),i.STATIC_DRAW);let{internalFormat:l,format:u,type:m,isFloat:f}=cu(n),b=bs(i),p=i.createFramebuffer();this.c={splat:xo(i,o),extremeSplat:null,mrtSplat:null,resolve:{program:r,u_heat:i.getUniformLocation(r,"u_heat"),u_extreme:i.getUniformLocation(r,"u_extreme"),u_gradient_lut:i.getUniformLocation(r,"u_gradient_lut"),u_heat_max:i.getUniformLocation(r,"u_heat_max"),u_color_mode:i.getUniformLocation(r,"u_color_mode"),a_corner:i.getAttribLocation(r,"a_corner")},quadCornerBuffer:s,tripleCornerBuffer:a,heatTexture:b,heatFramebuffer:p,extremeTexture:null,extremeFramebuffer:null,mrtFramebuffer:null,heatWidth:0,heatHeight:0,heatType:m,heatInternalFormat:l,heatFormat:u,floatFbo:f,indexedBlend:null,signedDowngradeWarned:!1,robustBounds:null},this.ensureHeatTarget(t,n)}draw(t,n,i){let o=this.c;if(!o||!hs(n))return;let r=Math.max(1,t.v.length),s=t.R,a=0;for(let l=0;l<r;l++)a+=t.U[l]??0;a!==0&&this.runSplatAndResolve(t,n,o,i,l=>{for(let u=0;u<r;u++){let m=t.U[u]??0;m<=0||l(u*s,m)}})}drawSeries(t,n,i,o){let r=this.c;if(!r||!hs(n))return;let s=t.U[o]??0;if(s<=0)return;let a=t.R;this.runSplatAndResolve(t,n,r,i,l=>l(o*a,s))}buildTooltipLines(t,n){return Zn(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0}}destroy(t){let n=this.c;if(!n||!t.e){this.c=null;return}let i=t.e.gl;i.deleteBuffer(n.quadCornerBuffer),i.deleteBuffer(n.tripleCornerBuffer),i.deleteTexture(n.heatTexture),i.deleteFramebuffer(n.heatFramebuffer),n.extremeTexture&&i.deleteTexture(n.extremeTexture),n.extremeFramebuffer&&i.deleteFramebuffer(n.extremeFramebuffer),n.mrtFramebuffer&&i.deleteFramebuffer(n.mrtFramebuffer),this.c=null}ensureHeatTarget(t,n){let i=this.c;if(!i)return;let o=n.gl,r=o.canvas.width,s=o.canvas.height;if(!(r===i.heatWidth&&s===i.heatHeight)&&!(r<=0||s<=0)){if(this.allocAccumTexture(o,i,i.heatTexture,r,s),o.bindFramebuffer(o.FRAMEBUFFER,i.heatFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.heatTexture,0),i.extremeTexture&&(this.allocAccumTexture(o,i,i.extremeTexture,r,s),i.extremeFramebuffer&&(o.bindFramebuffer(o.FRAMEBUFFER,i.extremeFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i.extremeTexture,0)),i.mrtFramebuffer)){let a=o;a.bindFramebuffer(a.FRAMEBUFFER,i.mrtFramebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i.heatTexture,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.TEXTURE_2D,i.extremeTexture,0)}o.bindFramebuffer(o.FRAMEBUFFER,null),i.heatWidth=r,i.heatHeight=s}}allocAccumTexture(t,n,i,o,r){t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,n.heatInternalFormat,o,r,0,n.heatFormat,n.heatType,null)}ensureExtremeTarget(t,n){let i=t.gl;if(n.extremeTexture)return;let o=bs(i);if(n.extremeTexture=o,n.extremeFramebuffer=i.createFramebuffer(),this.allocAccumTexture(i,n,o,n.heatWidth,n.heatHeight),i.bindFramebuffer(i.FRAMEBUFFER,n.extremeFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o,0),n.indexedBlend===null){let r=t.isWebGL2?i.getExtension("OES_draw_buffers_indexed"):null;n.indexedBlend=r??!1}if(n.indexedBlend){let r=i;n.mrtFramebuffer=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,n.mrtFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n.heatTexture,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT1,r.TEXTURE_2D,o,0)}i.bindFramebuffer(i.FRAMEBUFFER,null)}ensureExtremeSplatProgram(t,n){if(n.extremeSplat)return n.extremeSplat;let i=t.shaders.getOrCreate("density-extreme",Je,wn);return n.extremeSplat=xo(t.gl,i),n.extremeSplat}ensureMrtSplatProgram(t,n){if(n.mrtSplat)return n.mrtSplat;let i=t.shaders.getOrCreate("density-mrt",br,gr);return n.mrtSplat=xo(t.gl,i),n.mrtSplat}activeMode(t,n,i){let o=n.g.gradient_color_mode;return o==="signed"&&!i.floatFbo?(this.warnDowngradeOnce(i,"signed mode requires a float framebuffer (EXT_color_buffer_float); falling back to mean."),"mean"):o==="extreme"&&!t.isWebGL2?(this.warnDowngradeOnce(i,"extreme mode requires WebGL2 (for MAX blend and a second color attachment); falling back to mean."),"mean"):o}warnDowngradeOnce(t,n){t.signedDowngradeWarned||(t.signedDowngradeWarned=!0,console.warn(`Density: ${n}`))}runSplatAndResolve(t,n,i,o,r){if(this.ensureHeatTarget(t,n),i.heatWidth===0||i.heatHeight===0||!t.te)return;let s=this.activeMode(n,t,i),a=t.f<t.l&&(!!t.r||t.v.length>1),l=0,u=0;if(s!=="density"&&a&&(l=t.f,u=t.l,!t.Z&&(s==="mean"||s==="extreme"))){let f=pu(t,i);f&&(l=f.lo,u=f.hi)}s==="extreme"&&this.ensureExtremeTarget(n,i),s==="extreme"&&i.indexedBlend?this.runMrtExtremePass(n,i,o,t.g.gradient_intensity,n.dpr*t.g.gradient_radius_px,l,u,r):(this.runHeatPass(n,i,o,t.g.gradient_intensity,n.dpr*t.g.gradient_radius_px,l,u,r),s==="extreme"&&this.runExtremePass(n,i,o,t.g.gradient_intensity,n.dpr*t.g.gradient_radius_px,l,u,r)),this.runResolvePass(n,i,t,s)}runHeatPass(t,n,i,o,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST);u.bindFramebuffer(u.FRAMEBUFFER,n.heatFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE),u.blendEquation(u.FUNC_ADD),this.bindSplatProgram(u,n.splat,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,n.splat,l),this.unbindSplatInstancing(t,n.splat)}runExtremePass(t,n,i,o,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST),f=this.ensureExtremeSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.extremeFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE);let b=u;b.blendEquation(b.MAX),this.bindSplatProgram(u,f,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,f,l),this.unbindSplatInstancing(t,f),u.blendEquation(u.FUNC_ADD)}runMrtExtremePass(t,n,i,o,r,s,a,l){let u=t.gl,m=n.indexedBlend,f=!!u.getParameter(u.SCISSOR_TEST),b=this.ensureMrtSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.mrtFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),u.drawBuffers([u.COLOR_ATTACHMENT0,u.COLOR_ATTACHMENT1]),this.clearTarget(u,f),m.enableiOES(u.BLEND,0),m.enableiOES(u.BLEND,1),m.blendEquationiOES(0,u.FUNC_ADD),m.blendFunciOES(0,u.ONE,u.ONE),m.blendEquationiOES(1,u.MAX),m.blendFunciOES(1,u.ONE,u.ONE),this.bindSplatProgram(u,b,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,b,l),this.unbindSplatInstancing(t,b),m.blendEquationiOES(0,u.FUNC_ADD),m.blendEquationiOES(1,u.FUNC_ADD),m.blendFunciOES(0,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),m.blendFunciOES(1,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),u.drawBuffers([u.COLOR_ATTACHMENT0])}clearTarget(t,n){n&&t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),n&&t.enable(t.SCISSOR_TEST)}bindSplatProgram(t,n,i,o,r,s,a,l,u){t.useProgram(n.program),t.uniformMatrix4fv(n.u_projection,!1,i),t.uniform1f(n.u_intensity,o);let m=2*r/Math.max(1,s),f=2*r/Math.max(1,a);t.uniform2f(n.u_radius_ndc,m,f),t.uniform2f(n.u_color_range,l,u)}bindAndDispatchInstanced(t,n,i,o){let r=t.gl;r.bindBuffer(r.ARRAY_BUFFER,n.quadCornerBuffer),r.enableVertexAttribArray(i.a_corner),r.vertexAttribPointer(i.a_corner,2,r.FLOAT,!1,0,0);let s=K(t);s.setDivisor(i.a_corner,0),s.setDivisor(i.a_position,1),s.setDivisor(i.a_color_value,1);let a=t.C.peek("a_position"),l=t.C.peek("a_color_value");o((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,b=Float32Array.BYTES_PER_ELEMENT;r.bindBuffer(r.ARRAY_BUFFER,a.buffer),r.enableVertexAttribArray(i.a_position),r.vertexAttribPointer(i.a_position,2,r.FLOAT,!1,f,u*f),r.bindBuffer(r.ARRAY_BUFFER,l.buffer),r.enableVertexAttribArray(i.a_color_value),r.vertexAttribPointer(i.a_color_value,1,r.FLOAT,!1,b,u*b),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let i=K(t);i.setDivisor(n.a_position,0),i.setDivisor(n.a_color_value,0)}runResolvePass(t,n,i,o){let r=t.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,r.canvas.width,r.canvas.height),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA);let s=n.resolve;r.useProgram(s.program),r.uniform1f(s.u_heat_max,i.g.gradient_heat_max),r.uniform1i(s.u_color_mode,fu(o)),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.heatTexture),r.uniform1i(s.u_heat,0),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,n.extremeTexture??n.heatTexture),r.uniform1i(s.u_extreme,1),Le(t,i.te.texture,s.u_gradient_lut,2),r.bindBuffer(r.ARRAY_BUFFER,n.tripleCornerBuffer),r.enableVertexAttribArray(s.a_corner),r.vertexAttribPointer(s.a_corner,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,3)}};du=5e4});var $e,qn,Kn,Jn,_o=I(()=>{"use strict";Ft();Yr();$r();co();us();bo();go();yo();Co();$e=class extends he{constructor(n){super();d(this,"glyph");d(this,"un","cartesian");d(this,"te",null);d(this,"_t","");d(this,"ot","");d(this,"nt","");d(this,"it","");d(this,"oo",!1);d(this,"r","");d(this,"q","");d(this,"zn","");d(this,"Z",!1);d(this,"v",[]);d(this,"ye",1/0);d(this,"yt",-1/0);d(this,"Ae",1/0);d(this,"xt",-1/0);d(this,"M",NaN);d(this,"S",NaN);d(this,"f",1/0);d(this,"l",-1/0);d(this,"et",1/0);d(this,"tt",-1/0);d(this,"Gn",1/0);d(this,"kn",-1/0);d(this,"Nn",1/0);d(this,"Un",-1/0);d(this,"On",1/0);d(this,"Hn",-1/0);d(this,"Yn",1/0);d(this,"Vn",-1/0);d(this,"R",0);d(this,"U",[]);d(this,"yi",0);d(this,"O",null);d(this,"H",null);d(this,"vt",null);d(this,"Pt",null);d(this,"Wt",null);d(this,"Ct",0);d(this,"a",new Map);d(this,"k",new st);d(this,"xi",null);d(this,"Ci",null);d(this,"_i",null);d(this,"ro",0);d(this,"Zt",new Un);d(this,"u",null);d(this,"le",-1);d(this,"Li",-1);d(this,"mn",-1);d(this,"A",null);d(this,"Le",null);d(this,"Te",null);d(this,"$n",null);d(this,"Be",null);d(this,"jn",null);d(this,"Zn",!1);d(this,"Xn",null);d(this,"vi",null);d(this,"Ai",-1);this.glyph=n}projectPoint(n,i){return[n,i]}renderBackground(n,i,o,r,s,a){}renderMapChrome(n,i,o,r){}tooltipCallbacks(){return{onHover:(n,i)=>po(this,n,i),onLeave:()=>{this.le!==-1&&(this.le=-1,We(this))},onPin:(n,i)=>{if(po(this,n,i),this.le>=0){let o=this.le;as(this,o),this.Mo(o)}},onUnpin:()=>{this.emitUnselect()}}}async Mo(n){if(!this.Pt)return;let i=this.Pt[n],o=this.E[1]||this.E[0]||"",r=[];if(this.v.length>0&&this.R>0){let s=Math.floor(n/this.R),a=this.v[s];a?.prefix&&this.w.length>0&&(r=a.prefix.split("|"))}await this.emitClickAndSelect({rowIdx:i!=null&&i>=0?i:null,columnName:o,groupByValues:[],splitByValues:r})}async uploadAndRender(n,i,o,r){let s=r-o;this.e=n,o===0&&zr(this,n,i,r),s!==0&&(Xr(this,n,i,o,s,r),this.g.domain_mode==="expand"&&(this.Gn=this.ye,this.kn=this.yt,this.Nn=this.Ae,this.Un=this.xt,this.On=this.f,this.Hn=this.l,this.Yn=this.et,this.Vn=this.tt),await this.requestRender(n))}resetExpandedDomain(){this.Gn=1/0,this.kn=-1/0,this.Nn=1/0,this.Un=-1/0,this.On=1/0,this.Hn=-1/0,this.Yn=1/0,this.Vn=-1/0}It(n){n.uploadedCount===0&&this.Ct===0||(this.e=n,os(this,n))}destroyInternal(){this.glyph.destroy(this),this.te=null,this.O=null,this.H=null,this.vt=null,this.Pt=null,this.Wt=null,this.k.clearHover(),this.a.clear(),this.Zt.clear(),this.xi=null,this.Ci=null,this._i=null,this.v=[],this.U=[],ls(this)}},qn=class extends $e{constructor(){super(new at)}},Kn=class extends $e{constructor(){super(new lt)}},Jn=class extends $e{constructor(){super(new ut)}}});function Na(e,t){if(t>ka||t<-ka)return[NaN,NaN];let n=e*Math.PI*6378137/180,i=t*Math.PI/180,o=6378137*Math.log(Math.tan(Math.PI/4+i/2));return[n,o]}function Ua(e,t,n){let i=1<<e,o=2*Fe/i,r=-Fe+t*o,s=r+o,a=Fe-n*o,l=a-o;return{xMin:r,yMin:l,xMax:s,yMax:a}}function Oa(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let i=Math.log2(2*Fe/(t*e));return Math.max(0,Math.min(n,Math.floor(i)))}function Ha(e,t){let n=1<<t,i=2*Fe/n,o=Math.floor((e.xMin+Fe)/i),r=Math.floor((e.xMax+Fe)/i),s=Math.floor((Fe-e.yMax)/i),a=Math.floor((Fe-e.yMin)/i),l=[];for(let u=s;u<=a;u++)if(!(u<0||u>=n))for(let m=o;m<=r;m++)m<0||m>=n||l.push({z:t,x:m,y:u});return l}var Fe,ka,tr=I(()=>{"use strict";Fe=Math.PI*6378137,ka=85.0511287798066});var ki,Ya=I(()=>{"use strict";ki=class{constructor(t=256){d(this,"be",new Map);d(this,"xo");this.xo=t}get(t){let n=this.be.get(t);return n!==void 0&&(this.be.delete(t),this.be.set(t,n)),n}set(t,n,i){if(this.be.has(n)){let o=this.be.get(n);t.deleteTexture(o),this.be.delete(n)}for(this.be.set(n,i);this.be.size>this.xo;){let o=this.be.keys().next().value;if(o===void 0)break;let r=this.be.get(o);t.deleteTexture(r),this.be.delete(o)}}has(t){return this.be.has(t)}dispose(t){for(let n of this.be.values())t.deleteTexture(n);this.be.clear()}}});function _t(e,t,n,i){return`${e}/${t}/${n}/${i}`}var Ni,Va=I(()=>{"use strict";Ni=class{constructor(){d(this,"he",new Map);d(this,"Co",()=>{})}setOnLoad(t){this.Co=t}load(t,n,i,o){let r=_t(t.id,n,i,o),s=this.he.get(r);if(s)return s.promise;let a=new AbortController,l=t.urlFor(n,i,o),u=this.Do(l,a.signal).then(m=>(this.he.delete(r),m&&this.Co(),m)).catch(()=>(this.he.delete(r),null));return this.he.set(r,{promise:u,abort:a}),u}cancelAll(){for(let t of this.he.values())t.abort.abort();this.he.clear()}cancelExcept(t){for(let[n,i]of this.he)t.has(n)||(i.abort.abort(),this.he.delete(n))}async Do(t,n){let i=await fetch(t,{signal:n});if(!i.ok)return null;let o=await i.blob();return await createImageBitmap(o)}}});var Ui,za=I(()=>{"use strict";tr();Ya();Va();eo();to();Ui=class{constructor(){d(this,"i",null);d(this,"W",null);d(this,"c",new ki);d(this,"An",new Ni);d(this,"Ln",null);d(this,"_o",1);d(this,"vo",()=>{})}setOnTileLoad(t){this.vo=t,this.An.setOnLoad(t)}setSource(t,n){this.Ln?.id!==n.id&&(this.c.dispose(t),this.An.cancelAll(),this.Ln=n)}setAlpha(t){this._o=Math.max(0,Math.min(1,t))}get source(){return this.Ln}render(t,n,i,o,r,s){let a=this.Ln;if(!a)return;this.Io(t);let l=this.i,u=this.W;if(!l||!u)return;let m=t.gl,f=t.dpr,b=Math.max(1,n.t.width*f),p=o.xMax-o.xMin;if(!isFinite(p)||p<=0)return;let c=p/b,h=Oa(c,a.tileSize,a.maxZoom),g=Ha(o,h),y=new Set;for(let C of g)y.add(_t(a.id,C.z,C.x,C.y));this.An.cancelExcept(y),m.useProgram(l.program),m.uniformMatrix4fv(l.u_projection,!1,i),m.uniform1f(l.u_alpha,this._o),m.bindBuffer(m.ARRAY_BUFFER,u),m.enableVertexAttribArray(l.a_corner),m.vertexAttribPointer(l.a_corner,2,m.FLOAT,!1,0,0),m.activeTexture(m.TEXTURE0),m.uniform1i(l.u_tile,0);let x=m.isEnabled(m.BLEND);m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);for(let C of g)this.Eo(m,l,a,C,r,s);x||m.disable(m.BLEND)}destroy(t){this.An.cancelAll(),this.c.dispose(t),this.W&&(t.deleteBuffer(this.W),this.W=null),this.i=null}Eo(t,n,i,o,r,s){let a=Ua(o.z,o.x,o.y),l={xMin:a.xMin-r,xMax:a.xMax-r,yMin:a.yMin-s,yMax:a.yMax-s},u=_t(i.id,o.z,o.x,o.y),m=this.c.get(u);if(m){this.Ao(t,n,m,l,[0,0],[1,1]);return}this.Po(t,i,o);for(let f=1;f<=6;f++){let b=o.z-f;if(b<0)return;let p=o.x>>f,c=o.y>>f,h=_t(i.id,b,p,c),g=this.c.get(h);if(!g)continue;let y=1<<f,x=o.x-p*y,C=o.y-c*y,_=1/y,v=[x*_,C*_],A=[v[0]+_,v[1]+_];this.Ao(t,n,g,l,v,A);return}}Ao(t,n,i,o,r,s){t.bindTexture(t.TEXTURE_2D,i),t.uniform2f(n.u_extent_min,o.xMin,o.yMin),t.uniform2f(n.u_extent_max,o.xMax,o.yMax),t.uniform2f(n.u_uv_min,r[0],r[1]),t.uniform2f(n.u_uv_max,s[0],s[1]),t.drawArrays(t.TRIANGLE_STRIP,0,4)}Po(t,n,i){let o=_t(n.id,i.z,i.x,i.y);this.c.has(o)||this.An.load(n,i.z,i.x,i.y).then(r=>{if(!r)return;if(this.Ln?.id!==n.id){r.close();return}let s=t.createTexture();if(!s){r.close();return}t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.c.set(t,o,s),this.vo()})}Io(t){if(this.i&&this.W)return;let n=t.gl,i=t.shaders.getOrCreate("map-tile",Mn,Sn);this.i={program:i,u_projection:n.getUniformLocation(i,"u_projection"),u_extent_min:n.getUniformLocation(i,"u_extent_min"),u_extent_max:n.getUniformLocation(i,"u_extent_max"),u_uv_min:n.getUniformLocation(i,"u_uv_min"),u_uv_max:n.getUniformLocation(i,"u_uv_max"),u_tile:n.getUniformLocation(i,"u_tile"),u_alpha:n.getUniformLocation(i,"u_alpha"),a_corner:n.getAttribLocation(i,"a_corner")};let o=n.createBuffer();o&&(n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.W=o)}}});function Wm(){return new en("carto-positron","https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Gm(){return new en("carto-dark-matter","https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function km(){return new en("carto-voyager","https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function nr(e){switch(e){case"carto-dark-matter":return Gm();case"carto-voyager":return km();case"carto-positron":default:return Wm()}}var en,Xa=I(()=>{"use strict";en=class{constructor(t,n,i,o=256,r=19,s=[]){this.id=t;this.template=n;this.attribution=i;this.tileSize=o;this.maxZoom=r;this.subdomains=s}urlFor(t,n,i){let o=this.template.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(i));if(this.subdomains.length>0){let r=(n+i)%this.subdomains.length;o=o.replace("{s}",this.subdomains[r])}return o}}});var Oi={};el(Oi,{MapChart:()=>vt,MapDensityChart:()=>rr,MapLineChart:()=>or,MapScatterChart:()=>ir});var vt,ir,or,rr,Hi=I(()=>{"use strict";_o();go();yo();Co();za();Xa();tr();nt();vt=class extends $e{constructor(n){super(n);d(this,"un","map");d(this,"Ye");this.Ye=new Ui,this.Ye.setOnTileLoad(()=>{this.e&&this.requestRender(this.e)})}projectPoint(n,i){return Na(n,i)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.e&&this.Ye.setSource(this.e.gl,nr(n.map_tile_provider)),this.Ye.setAlpha(n.map_tile_alpha)}renderBackground(n,i,o,r,s,a){this.Ye.source||(this.Ye.setSource(n.gl,nr(this.g.map_tile_provider)),this.Ye.setAlpha(this.g.map_tile_alpha)),this.Ye.render(n,i,o,r,s,a)}renderMapChrome(n,i,o,r){if(!n)return;let s=ge(n,r);if(!s)return;let a=this.Ye.source?.attribution??"";if(!a)return;let l=i.t;s.save(),s.font=`10px ${o.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(a).width,b=12,p=l.x+l.width-4,c=l.y+l.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(p-f-u*2,c-b-u,f+u*2,b+u),s.fillStyle=o.ge,s.fillText(a,p-u,c-u/2),s.restore()}destroyInternal(){this.e&&this.Ye.destroy(this.e.gl),super.destroyInternal()}},ir=class extends vt{constructor(){super(new at)}},or=class extends vt{constructor(){super(new lt)}},rr=class extends vt{constructor(){super(new ut)}}});typeof window>"u"&&(globalThis.window={});var Tt=class{constructor(t){d(this,"D");d(this,"Tn",new Map);this.D=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,i){let o=this.Tn.get(t);if(o)return o;let r=this.D,s=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(s,n),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(s);throw r.deleteShader(s),new Error(`Vertex shader compile error [${t}]: ${l}`)}let a=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(a,i),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(a);throw r.deleteShader(s),r.deleteShader(a),new Error(`Fragment shader compile error [${t}]: ${l}`)}if(o=r.createProgram(),r.attachShader(o,s),r.attachShader(o,a),r.linkProgram(o),!r.getProgramParameter(o,r.LINK_STATUS)){let l=r.getProgramInfoLog(o);throw r.deleteProgram(o),r.deleteShader(s),r.deleteShader(a),new Error(`Shader link error [${t}]: ${l}`)}return r.deleteShader(s),r.deleteShader(a),this.Tn.set(t,o),o}releaseAll(){for(let t of this.Tn.values())this.D.deleteProgram(t);this.Tn.clear()}};var an="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;attribute float a_series_id;attribute float a_axis;uniform mat4 u_proj_left;uniform mat4 u_proj_right;uniform float u_hover_series;uniform float u_horizontal;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec2 A;if(u_horizontal>0.5){A=vec2(mix(a_y0,a_y1,a_corner.x),a_x_center+(a_corner.y-0.5)*2.*a_half_width);}else{A=vec2(a_x_center+(a_corner.x-0.5)*2.*a_half_width,mix(a_y0,a_y1,a_corner.y));}mat4 B=a_axis<0.5?u_proj_left:u_proj_right;gl_Position=B*vec4(A,0.,1.);v_color=a_color;v_hover=abs(a_series_id-u_hover_series)<0.5?1.:0.;v_local=a_corner;}";var ln="precision highp float;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec3 A=v_color;if(v_hover>0.5){A=mix(A,vec3(1.),0.25);}gl_FragColor=vec4(A,1.);}";zi();Xi();$i();ji();var dn="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var pn="precision highp float;uniform vec3 u_color;uniform float u_opacity;void main(){gl_FragColor=vec4(u_color,u_opacity);}";var Se="attribute vec2 a_start;attribute vec2 a_end;attribute float a_corner;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;varying float v_edge_dist;void main(){vec4 A=u_projection*vec4(a_start,0.,1.);vec4 B=u_projection*vec4(a_end,0.,1.);vec2 C=A.xy*u_resolution*0.5;vec2 D=B.xy*u_resolution*0.5;vec2 E=D-C;float F=length(E);E=F>0.001?E/F:vec2(1.,0.);vec2 G=vec2(-E.y,E.x);float H=step(1.5,a_corner);float I=1.-mod(a_corner,2.)*2.;vec4 J=mix(A,B,H);float K=(u_line_width+1.5)*0.5;vec2 L=(G*I*K)/(u_resolution*0.5);gl_Position=J+vec4(L,0.,0.);v_edge_dist=I;}";var Be="precision highp float;uniform vec4 u_color;uniform float u_line_width;varying float v_edge_dist;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(u_color.rgb,u_color.a*C);}";var bn="attribute vec2 a_position;attribute vec3 a_color;uniform mat4 u_projection;uniform float u_point_size;varying vec3 v_color;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);gl_PointSize=u_point_size;v_point_size=u_point_size;v_color=a_color;}";var hn="precision highp float;varying vec3 v_color;varying float v_point_size;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5)discard;float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);gl_FragColor=vec4(v_color,D);}";var gn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;uniform mat4 u_projection;varying vec3 v_color;void main(){float A=a_x_center+(a_corner.x-0.5)*2.*a_half_width;float B=mix(a_y0,a_y1,a_corner.y);gl_Position=u_projection*vec4(A,B,0.,1.);v_color=a_color;}";var yn="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var xn="attribute vec2 a_corner;attribute vec2 a_cell;attribute float a_color_t;uniform mat4 u_projection;uniform vec2 u_cell_inset;uniform vec2 u_cell_size;varying float v_color_t;void main(){vec2 A=0.5*u_cell_size;vec2 B=u_cell_size-2.*u_cell_inset;float C=a_cell.x-A.x+u_cell_inset.x+a_corner.x*B.x;float D=a_cell.y-A.y+u_cell_inset.y+a_corner.y*B.y;gl_Position=u_projection*vec4(C,D,0.,1.);v_color_t=a_color_t;}";var Cn="precision highp float;uniform sampler2D u_gradient_lut;varying float v_color_t;void main(){float A=clamp(v_color_t,0.,1.);vec4 B=texture2D(u_gradient_lut,vec2(A,0.5));gl_FragColor=vec4(B.rgb,1.);}";var _n="attribute float a_strip_t;attribute float a_side;attribute vec2 a_angles;attribute vec2 a_radii;attribute vec4 a_color;uniform vec2 u_center;uniform vec2 u_resolution;uniform float u_border_px;varying vec4 v_color;varying vec2 v_edge;void main(){float A=u_border_px*0.5;float B=a_radii.x+A;float C=a_radii.y-A;if(C<=B){gl_Position=vec4(2.,2.,2.,1.);v_color=vec4(0.);v_edge=vec2(0.);return;}float D=mix(B,C,a_side);float E=A/max(D,1.);float F=a_angles.y-a_angles.x;E=min(E,F*0.5);float G=mix(a_angles.x+E,a_angles.y-E,a_strip_t);vec2 H=u_center+vec2(cos(G),sin(G))*D;vec2 I=(H/u_resolution)*2.-1.;gl_Position=vec4(I.x,-I.y,0.,1.);v_color=a_color;v_edge=vec2(a_strip_t,a_side);}";var vn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var An="attribute vec2 a_position;attribute vec4 a_color;uniform vec2 u_resolution;varying vec4 v_color;void main(){vec2 A=(a_position/u_resolution)*2.-1.;A.y=-A.y;gl_Position=vec4(A,0.,1.);v_color=a_color;}";var Ln="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";Zi();qi();Ki();Ji();Qi();eo();to();var no=[{name:"bar",vert:an,frag:ln},{name:"line",vert:un,frag:mn},{name:"scatter",vert:fn,frag:cn},{name:"bar-area",vert:dn,frag:pn},{name:"bar-scatter",vert:bn,frag:hn},{name:"line-uniform",vert:Se,frag:Be},{name:"candlestick-body",vert:gn,frag:yn},{name:"heatmap",vert:xn,frag:Cn},{name:"sunburst-arc",vert:_n,frag:vn},{name:"treemap",vert:An,frag:Ln},{name:"density-splat",vert:Je,frag:Tn},{name:"density-extreme",vert:Je,frag:wn},{name:"density-resolve",vert:Rn,frag:Fn},{name:"map-tile",vert:Mn,frag:Sn}];var wt=class{constructor(t){d(this,"D");d(this,"o",new Map);d(this,"tn",0);d(this,"wn",0);this.D=t}get totalCapacity(){return this.tn}get maxCapacity(){return this.wn}set maxCapacity(t){this.wn=t}ensureCapacity(t){this.tn=this.wn>0?Math.min(t,this.wn):t}peek(t){return this.o.get(t)}getOrCreate(t,n,i){let o=this.tn*n*i,r=this.o.get(t);if(r&&r.byteCapacity>=o)return r;let s=this.D;r&&s.deleteBuffer(r.buffer);let a=s.createBuffer();return s.bindBuffer(s.ARRAY_BUFFER,a),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW),r={buffer:a,byteCapacity:o},this.o.set(t,r),r}upload(t,n,i,o=1){let r=this.D,s=this.getOrCreate(t,o,n.BYTES_PER_ELEMENT);if(!1){let a=i+n.byteLength;if(a>s.byteCapacity)throw new Error(`BufferPool.upload("${t}"): write ${i}..${a} exceeds capacity ${s.byteCapacity} (_totalCapacity=${this.tn}, components=${o}, bytes=${n.BYTES_PER_ELEMENT}). Did you pass the full scratch buffer instead of a subarray(0, n)?`)}return r.bindBuffer(r.ARRAY_BUFFER,s.buffer),r.bufferSubData(r.ARRAY_BUFFER,i,n),s.buffer}releaseAll(){for(let t of this.o.values())this.D.deleteBuffer(t.buffer);this.o.clear(),this.tn=0}};var Bn=class{constructor(t,n={}){d(this,"Vt");d(this,"D");d(this,"Rn");d(this,"Rt");d(this,"o");d(this,"Fn",0);d(this,"Vi",0);d(this,"zi",0);d(this,"Xi",1);d(this,"ui");d(this,"mi",null);d(this,"pt",null);d(this,"Mn",null);this.Vt=t,this.ui=n.precompile??!1;let i=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(i)this.D=i,this.Rn=!0;else{let o=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!o)throw new Error("WebGL is not supported");this.D=o,this.Rn=!1}this.Rt=new Tt(this.D),this.o=new wt(this.D),this.ui&&this.Rt.precompile(no),t.addEventListener("webglcontextlost",o=>{o.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this.Rt.releaseAll(),this.o.releaseAll(),this.Rt=new Tt(this.D),this.o=new wt(this.D),this.Fn=0,this.ui&&this.Rt.precompile(no)})}get gl(){return this.D}get isWebGL2(){return this.Rn}get shaders(){return this.Rt}get C(){return this.o}get uploadedCount(){return this.Fn}set uploadedCount(t){this.Fn=t}resize(t,n,i){this.Vi=t,this.zi=n,this.Xi=i;let o=Math.round(t*i),r=Math.round(n*i);(this.Vt.width!==o||this.Vt.height!==r)&&(this.Vt.width=o,this.Vt.height=r,this.D.viewport(0,0,o,r))}requestResize(t,n,i){this.Mn={cssWidth:t,cssHeight:n,dpr:i}}applyPendingResize(){if(!this.Mn)return!1;let{cssWidth:t,cssHeight:n,dpr:i}=this.Mn;return this.Mn=null,this.resize(t,n,i),!0}get cssWidth(){return this.Vi}get cssHeight(){return this.zi}get dpr(){return this.Xi}clear(){this.D.clearColor(0,0,0,0),this.D.clear(this.D.COLOR_BUFFER_BIT|this.D.DEPTH_BUFFER_BIT),this.Fn=0}setFrameCallback(t){this.mi=t}endFrame(){if(!this.mi)return;let t=this.Vt;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.mi(n)}async awaitGpuFence(){if(!this.Rn){this.D.finish();return}let t=this.D,n=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0);if(!n){t.finish();return}try{let i=t.SYNC_FLUSH_COMMANDS_BIT;for(;;){let o=t.clientWaitSync(n,i,0);if(o===t.ALREADY_SIGNALED||o===t.CONDITION_SATISFIED)return;if(o===t.WAIT_FAILED){t.finish();return}i=0,await this.To()}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.o.ensureCapacity(t)}To(){return this.pt||(this.pt=new MessageChannel,this.pt.port1.start()),new Promise(t=>{let n=this.pt;n.port1.addEventListener("message",()=>t(),{once:!0}),n.port2.postMessage(null)})}destroy(){this.o.releaseAll(),this.Rt.releaseAll(),this.pt&&(this.pt.port1.close(),this.pt.port2.close(),this.pt=null);let t=this.D.getExtension("WEBGL_lose_context");t&&t.loseContext()}};Dn();Dn();function Cr(e,t,n,i){let{controller:o,layout:r}=e,s=r.t,a=o.getVisibleDomain(),l=a.xMin+(t-s.x)/s.width*(a.xMax-a.xMin),u=a.yMax-(n-s.y)/s.height*(a.yMax-a.yMin),m=Math.pow(1.1,-i/100),f=o.lockedAxis;f!=="x"&&(o.scaleX=Math.max(1,Math.min(1e5,o.scaleX*m))),f!=="y"&&(o.scaleY=Math.max(1,Math.min(1e5,o.scaleY*m)));let b=o.getVisibleDomain(),p=b.xMin+(t-s.x)/s.width*(b.xMax-b.xMin),c=b.yMax-(n-s.y)/s.height*(b.yMax-b.yMin),h=o.baseXRange,g=o.baseYRange;f!=="x"&&h>0&&(o.normTranslateX+=(l-p)/h),f!=="y"&&g>0&&(o.normTranslateY+=(u-c)/g)}function _r(e,t,n){let{controller:i,layout:o}=e,r=i.getVisibleDomain(),s=o.t,a=(r.xMax-r.xMin)/s.width,l=(r.yMax-r.yMin)/s.height,u=i.lockedAxis,m=i.baseXRange,f=i.baseYRange;u!=="x"&&m>0&&(i.normTranslateX-=t*a/m),u!=="y"&&f>0&&(i.normTranslateY+=n*l/f)}var In=class{constructor(t){d(this,"zt");this.zt=t}pin(t,n,i){this.zt({kind:"pin",payload:{lines:t,pos:n,bounds:i}})}dismiss(){this.zt({kind:"dismiss"})}setCursor(t){this.zt({kind:"setCursor",cursor:t})}emitUserClick(t){this.zt({kind:"userClick",payload:t})}emitUserSelect(t){this.zt({kind:"userSelect",payload:t})}};_o();Ft();var Qn=class{constructor(t=1024){d(this,"size");d(this,"value");d(this,"colorValue");d(this,"sizeSign");d(this,"x0");d(this,"y0");d(this,"x1");d(this,"y1");d(this,"a0");d(this,"a1");d(this,"r0");d(this,"r1");d(this,"depth");d(this,"parent");d(this,"firstChild");d(this,"nextSibling");d(this,"lastChild");d(this,"childCount");d(this,"leafRowIdx");d(this,"name");d(this,"colorLabel");d(this,"count",0);d(this,"capacity",0);this.so(t)}reset(){this.count>0&&(this.x0.fill(0,0,this.count),this.y0.fill(0,0,this.count),this.x1.fill(0,0,this.count),this.y1.fill(0,0,this.count),this.a0.fill(0,0,this.count),this.a1.fill(0,0,this.count),this.r0.fill(0,0,this.count),this.r1.fill(0,0,this.count)),this.count=0}allocate(){this.count===this.capacity&&this.so(this.capacity*2);let t=this.count++;return this.firstChild[t]=-1,this.nextSibling[t]=-1,this.lastChild[t]=-1,this.childCount[t]=0,this.leafRowIdx[t]=-1,this.size[t]=0,this.value[t]=0,this.colorValue[t]=NaN,this.sizeSign[t]=1,this.name[t]="",this.colorLabel[t]="",t}appendChild(t,n){this.parent[n]=t,this.depth[n]=this.depth[t]+1,this.nextSibling[n]=-1;let i=this.lastChild[t];i===-1?this.firstChild[t]=n:this.nextSibling[i]=n,this.lastChild[t]=n,this.childCount[t]++}isLeaf(t){return this.firstChild[t]===-1}so(t){let n=Math.max(t,1024),i=(o,r)=>{let s=new r(n);return o&&o.length>0&&s.set(o),s};this.size=i(this.size,Float32Array),this.value=i(this.value,Float32Array),this.colorValue=i(this.colorValue,Float32Array),this.sizeSign=i(this.sizeSign,Int8Array),this.x0=i(this.x0,Float32Array),this.y0=i(this.y0,Float32Array),this.x1=i(this.x1,Float32Array),this.y1=i(this.y1,Float32Array),this.a0=i(this.a0,Float32Array),this.a1=i(this.a1,Float32Array),this.r0=i(this.r0,Float32Array),this.r1=i(this.r1,Float32Array),this.depth=i(this.depth,Int32Array),this.parent=i(this.parent,Int32Array),this.firstChild=i(this.firstChild,Int32Array),this.nextSibling=i(this.nextSibling,Int32Array),this.lastChild=i(this.lastChild,Int32Array),this.childCount=i(this.childCount,Int32Array),this.leafRowIdx=i(this.leafRowIdx,Int32Array),this.name?this.name.length=n:this.name=new Array(n),this.colorLabel?this.colorLabel.length=n:this.colorLabel=new Array(n),this.capacity=n}};function ei(e,t){let n=[],i=t;for(;e.parent[i]!==-1;)n.push(e.name[i]),i=e.parent[i];return n.reverse()}bo();var mt=class extends he{constructor(){super(...arguments);d(this,"q","");d(this,"r","");d(this,"K","empty");d(this,"s",new Qn);d(this,"Y",-1);d(this,"p",-1);d(this,"ue",[]);d(this,"Gt",new Map);d(this,"qn",0);d(this,"f",1/0);d(this,"l",-1/0);d(this,"a",new Map);d(this,"X",null);d(this,"ne",0);d(this,"k",new st)}};Mt();function ti(e,t,n,i){let o=[];if(i<=n)return o;let r=n,s=e[n];for(let a=n+1;a<i;a++){let l=e[a];l!==s&&(o.push({startIdx:r,endIdx:a-1,label:t[s]??""}),r=a,s=l)}return o.push({startIdx:r,endIdx:i-1,label:t[s]??""}),o}function Nt(e,t,n){if(n<t)return[];let i=[];for(let o of e){if(o.endIdx<t||o.startIdx>n)continue;let r=o.startIdx<t?t:o.startIdx,s=o.endIdx>n?n:o.endIdx;r===o.startIdx&&s===o.endIdx?i.push(o):i.push({startIdx:r,endIdx:s,label:o.label})}return i}pe();function je(e,t,n,i,o){if(!e||t<=0)return null;let r=new Float64Array(t),s=1/0,a=-1/0;for(let u=0;u<t;u++){let m=e[u+n];r[u]=m,m<s&&(s=m),m>a&&(a=m)}let l=1/0;for(let u=1;u<t;u++){let m=Math.abs(r[u]-r[u-1]);m>0&&m<l&&(l=m)}return(!isFinite(l)||l===0)&&(l=Math.max(1,a-s)),{categoryPositions:r,numericCategoryDomain:{min:s-l/2,max:a+l/2,isDate:o,label:i,bandWidth:l}}}function ft(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function hu(e,t,n){return t?n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?le(e):n==="integer"?String(e|0):n==="float"?ie(e):String(e):""}function vo(e,t,n){let i=e.values,o=e.valid,r=new Int32Array(t),s=[""],a=new Map;a.set("",0);for(let l=0;l<t;l++){let u=o?!!(o[l>>3]>>(l&7)&1):!0,m=i[l],f=hu(m,u,n),b=a.get(f);b===void 0&&(b=s.length,s.push(f),a.set(f,b)),r[l]=b}return{indices:r,dictionary:s}}function ct(e,t,n,i=[]){let o=[];for(let u=0;;u++){let m=e.get(`__ROW_PATH_${u}__`);if(!m)break;if(m.type==="string"&&m.indices&&m.dictionary)o.push({indices:m.indices,dictionary:m.dictionary});else if(m.values){let f=i[u]??"string";o.push(vo(m,t,f))}else break}let r=0;if(n>0&&o.length>0)for(;r<t;){let u=!1;for(let m of o){let f=m.dictionary[m.indices[r]];if(f!=null&&f!==""){u=!0;break}}if(u)break;r++}let s=Math.max(0,t-r),a=o.length;return{rowPaths:n>0&&a>0?o.map((u,m)=>{let f=new Array(s),b=0;for(let c=0;c<s;c++){let h=u.dictionary[u.indices[c+r]]??"";f[c]=h,h.length>b&&(b=h.length)}let p=m===a-1?[]:ti(u.indices,u.dictionary,r,r+s).map(c=>({startIdx:c.startIdx-r,endIdx:c.endIdx-r,label:c.label}));return{labels:f,runs:p,maxLabelChars:b}}):[],numCategories:s,rowOffset:r}}function Ut(e){e.s.reset(),e.Gt.clear();let t=e.s.allocate();e.s.name[t]="Total",e.s.depth[t]=0,e.s.parent[t]=-1,e.Gt.set(t,new Map),e.Y=t,e.p=t,e.ue=[t],e.qn=0,e.f=1/0,e.l=-1/0,e.a.clear(),e.X=null,e.ne=0}function gu(e,t,n){let i=e.Gt.get(t);i||(i=new Map,e.Gt.set(t,i));let o=i.get(n);if(o!==void 0)return o;let r=e.s.allocate();return e.s.name[r]=n,e.s.appendChild(t,r),i.set(n,r),r}function ni(e,t,n,i,o,r,s){let a=e.Y,l=t.length;for(let u=0;u<l;u++){let m=gu(e,a,t[u]);u===l-1&&((s===0||l===s)&&(e.s.size[m]=Math.abs(n),e.s.sizeSign[m]=n<0?-1:1,e.s.leafRowIdx[m]=r),isNaN(i)||(e.s.colorValue[m]=i,i<e.f&&(e.f=i),i>e.l&&(e.l=i)),o&&(e.s.colorLabel[m]=o,e.a.has(o)||e.a.set(o,e.a.size))),a=m}}function ii(e,t,n){let i=NaN,o="";return t?(e.K==="numeric"&&t.values?i=t.values[n]:e.K==="series"&&t.indices&&t.dictionary&&(o=t.dictionary[t.indices[n]]),{colorValue:i,colorLabel:o}):{colorValue:i,colorLabel:o}}function gs(e,t){if(e.K!=="series"||!t?.dictionary)return;let n=t.dictionary;for(let i=0;i<n.length;i++){let o=n[i];e.a.has(o)||e.a.set(o,e.a.size)}}function yu(e,t){if(e.w.length===0)return null;let n=e.q?[e.q]:[],i=e.r?[e.r]:[],o=De(t,n,i);return o.length===0?null:o.map(r=>({prefix:r.prefix,sizeCol:e.q?t.get(`${r.prefix}|${e.q}`)??null:null,colorCol:e.r?t.get(`${r.prefix}|${e.r}`)??null:null}))}function Ot(e,t){let n=[];for(let h=0;;h++){let g=t.get(`__ROW_PATH_${h}__`);if(!g)break;if(g.type==="string"&&g.indices&&g.dictionary)n.push({indices:g.indices,dictionary:g.dictionary});else if(g.values){let y=e.L[h],x=e.gt[y]??"string";n.push(vo(g,g.values.length,x))}else break}let i=n.length>0,o=e.L.length,r=yu(e,t),s=r!==null,a=e.q?t.get(e.q):null,l=e.r?t.get(e.r):null,u=s?r[0].sizeCol:a,m=i?n[0].indices.length:u?.values?.length??0;if(m===0)return;if(s)for(let h of r)gs(e,h.colorCol);else gs(e,l);let f=e.qn,b=s&&i?o+1:o;if(!i){let h;for(let[y,x]of t){if(y.startsWith("__")||s&&y.includes("|"))continue;let C=y.lastIndexOf("|"),_=C===-1?y:y.substring(C+1);if(!(_===e.q||_===e.r)&&x.type==="string"&&x.indices&&x.dictionary){h=x;break}}let g=s?r:null;for(let y=0;y<m;y++){let x=h?.indices&&h?.dictionary?h.dictionary[h.indices[y]]:`Row ${f+y}`;if(g)for(let C of g){let _=C.sizeCol?.values?C.sizeCol.values[y]:1,{colorValue:v,colorLabel:A}=ii(e,C.colorCol,y);ni(e,[C.prefix,x],_,v,A,f+y,b)}else{let C=a?.values?a.values[y]:1,{colorValue:_,colorLabel:v}=ii(e,l,y);ni(e,[x],C,_,v,f+y,b)}}e.qn=f+m;return}let p=s?1:0,c=new Array(n.length+p);for(let h=0;h<m;h++){let g=0;for(let y=0;y<n.length;y++){let x=n[y],C=x.dictionary[x.indices[h]];if(!C&&C!=="0")break;c[p+g++]=C}if(g!==0)if(s)for(let y of r){c[0]=y.prefix;let x=c.slice(0,g+1),C=y.sizeCol?.values?y.sizeCol.values[h]:1,{colorValue:_,colorLabel:v}=ii(e,y.colorCol,h);ni(e,x,C,_,v,f+h,b)}else{let y=c.slice(0,g),x=a?.values?a.values[h]:1,{colorValue:C,colorLabel:_}=ii(e,l,h);ni(e,y,x,C,_,f+h,b)}}e.qn=f+m}function Ht(e){let t=e.s,n=t.value,i=t.size,o=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.Y,s[1]=0;let a=1;for(let l=0;l<t.count;l++)n[l]=0;for(;a>0;){a--;let l=s[a*2];if(s[a*2+1]===0){s[a*2+1]=1,a++;for(let m=o[l];m!==-1;m=r[m]){if((a+1)*2>s.length){let f=new Int32Array(s.length*2);f.set(s),s=f}s[a*2]=m,s[a*2+1]=0,a++}}else if(o[l]===-1)n[l]=Math.max(0,i[l]);else{let m=0;for(let f=o[l];f!==-1;f=r[f])m+=n[f];n[l]=m}}if(e.ue.length>1){let l=[];for(let f=1;f<e.ue.length;f++)l.push(t.name[e.ue[f]]);let u=e.Y,m=!0;for(let f of l){let p=e.Gt.get(u)?.get(f);if(p===void 0){m=!1;break}u=p}if(m&&t.firstChild[u]!==-1){e.p=u,dt(e,u);return}}e.p=e.Y,e.ue=[e.Y]}function dt(e,t){let n=[],i=t;for(;i!==-1;)n.unshift(i),i=e.s.parent[i];e.ue=n}var xu=1,Ao=14,ys=1,xs=4;function oi(e,t,n,i,o,r,s,a,l){if(e.x0[t]=Math.round(n),e.y0[t]=Math.round(i),e.x1[t]=Math.round(o),e.y1[t]=Math.round(r),e.firstChild[t]===-1||(o-n)*(r-i)<xs)return;let m=e.depth[t]-s,f=l&&m===1&&e.firstChild[t]!==-1,b=f?Ao:ys,p=f?xu:ys,c=e.x0[t]+p,h=e.y0[t]+b,g=e.x1[t]-p,y=e.y1[t]-p;if(g<=c||y<=h)return;let x=0;for(let C=e.firstChild[t];C!==-1;C=e.nextSibling[C])e.value[C]>0&&(a[x++]=C);x!==0&&Yt(e,a,0,x,c,h,g,y,s,a.subarray(x),l)}function Yt(e,t,n,i,o,r,s,a,l,u,m){let f=i-n;if(f===0)return;if(f===1){oi(e,t[n],o,r,s,a,l,u,m);return}let b=0;for(let v=n;v<i;v++)b+=e.value[t[v]];let p=b/2,c=0,h=n+1,g=1/0;for(let v=n;v<i-1;v++){c+=e.value[t[v]];let A=Math.abs(c-p);A<g&&(g=A,h=v+1)}let y=0;for(let v=n;v<h;v++)y+=e.value[t[v]];let x=y/b,C=s-o,_=a-r;if(C>=_){let v=Math.round(o+C*x);Yt(e,t,n,h,o,r,v,a,l,u,m),Yt(e,t,h,i,v,r,s,a,l,u,m)}else{let v=Math.round(r+_*x);Yt(e,t,n,h,o,r,s,v,l,u,m),Yt(e,t,h,i,o,v,s,a,l,u,m)}}function Cs(e,t,n,i){e.ne=Lo(e,t,n,i,0)}function Lo(e,t,n,i,o){let r=e.s,s=r.x0,a=r.y0,l=r.x1,u=r.y1,m=r.depth,f=r.firstChild,b=r.nextSibling,p=r.value;(!e.X||e.X.length<r.count)&&(e.X=new Int32Array(r.count));let c=e.X,h=o,g=new Int32Array(128);g[0]=t;let y=1;for(;y>0;){y--;let x=g[y];if(p[x]<=0||(m[x]>=i&&(c[h++]=x),m[x]-i>=n))continue;let C=l[x]-s[x],_=u[x]-a[x];if(!(C*_<xs))for(let v=f[x];v!==-1;v=b[v]){if(y>=g.length){let A=new Int32Array(g.length*2);A.set(g),g=A}g[y++]=v}}return h}Bt();rt();Ae();St();ve();function ri(e,t,n){return .299*e+.587*t+.114*n}function Cu(e,t){let n=be(e,t);return[n[0],n[1],n[2]]}function Vt(e,t,n,i){let o=e.s,r=o.colorValue[t];if(e.K==="numeric"&&!isNaN(r)&&e.l>e.f)return Cu(n,Xe(r,e.f,e.l));let s=e.a.get(o.colorLabel[t])??0;return i[s%i.length]??[0,0,0]}function si(e,t,n,i,o){let r=Vt(e,t,n,i),s=e.s.sizeSign[t]<0?o:1;return[r[0],r[1],r[2],s]}function ai(e,t,n,i,o,r,s){let a=Math.round(i*n),l=Math.round(o*n);(t.width!==a||t.height!==l)&&(t.width=a,t.height=l,e.At=!0);let u=t.getContext("2d");if(u){if(e.At){e.me?.close(),e.me=null,e.At=!1;let m=++e.fn;r(u),createImageBitmap(t).then(f=>{e.fn===m?(e.me?.close(),e.me=f):f.close()})}else e.me&&(u.clearRect(0,0,t.width,t.height),u.drawImage(e.me,0,0));s&&(u.save(),u.scale(n,n),s(u),u.restore())}}function To(e,t,n,i,o){if(o===0)return{x:e-n/2,y:t,width:n,height:i};if(o===90)return{x:e-i/2,y:t,width:i,height:n};let r=(n+i)/Math.SQRT2;return{x:e-r,y:t,width:r,height:r}}function wo(e,t){return e.x<=t.x+t.width&&t.x<=e.x+e.width&&e.y<=t.y+t.height&&t.y<=e.y+e.height}function _s(e,t){return e.x+e.width+14>t.x+t.width}function Ro(e,t){return e.x>=t.x&&e.x+e.width<=t.x+t.width&&e.y>=t.y&&e.y+e.height<=t.y+t.height}function Ze(e,t,n){if(n<=0)return"";if(e.measureText(t).width<=n)return t;let i=0,o=t.length;for(;i<o;){let r=i+o+1>>1,s=t.slice(0,r)+"\\u2026";e.measureText(s).width<=n?i=r:o=r-1}return i===0?"":t.slice(0,i)+"\\u2026"}function vs(e,t,n,i){if(i<=0||n<=0)return[];if(e.measureText(t).width<=n)return[t];let o=[],r=t;for(;r.length>0&&o.length<i;){let s=o.length===i-1,a=r.length;for(;a>0&&e.measureText(r.slice(0,a)).width>n;)a--;if(a===0&&(a=1),a===r.length){o.push(r);break}let l=a,u=r.lastIndexOf(" ",a);if(u>0&&(l=u),s){o.push(Ze(e,r,n));break}o.push(r.slice(0,l)),r=r.slice(l).trimStart()}return o.length===1&&o[0].length<=2?[]:o}function As(e,t,n,i,o,r,s,a){if(n.length===0)return;let{Sn:l,Ki:u,qi:m}=t;e.font=`11px ${a}`;let f=16,b=8,p=0;for(let x of n){let C=e.measureText(x).width;C>p&&(p=C)}let c=p+b*2,h=n.length*f+b*2-4,g=i+12,y=o-h-8;g+c>r&&(g=i-c-12),g<0&&(g=4),y<0&&(y=o+12),y+h>s&&(y=s-h-4),e.fillStyle=l,e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.roundRect(g,y,c,h,4),e.fill(),e.stroke(),e.fillStyle=u,e.textAlign="left",e.textBaseline="top";for(let x=0;x<n.length;x++)e.fillText(n[x],g+b,y+b+x*f)}var Ls=24,_u=8,Ts=12,ws=2,Rs=" \\u203A ";function li(e,t,n,i,o){e.De=[];let r=e.T().Sn;t.fillStyle=r,t.fillRect(0,0,n,Ls),t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let s=_u,a=e.s;for(let l=0;l<e.ue.length;l++){let u=e.ue[l],m=l===e.ue.length-1,f=a.name[u];t.fillStyle=o;let b=t.measureText(f).width;t.fillText(f,s,Ts),e.De.push({nodeId:u,x0:s-ws,y0:0,x1:s+b+ws,y1:Ls}),s+=b,m||(t.fillText(Rs,s,Ts),s+=t.measureText(Rs).width)}}function ui(e,t,n,i,o,r,s,a){let l=e.k.hoveredTarget===n?e.k.lines??[]:[];l.length!==0&&As(t,e.T(),l,i,o,r,s,a)}function pt(e,t){if(e.p===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.s,s=e.w.length>0&&e.P.facet_mode==="grid",a=e.ue.length>1?28:0,u=(e.K==="series"?e.a.size>1:e.K==="numeric"&&e.f<e.l)?90:0,m=new Int32Array(Math.max(r.count,64));if(s)vu(e,m,i,o,a,u);else{e.A=null;let c=r.depth[e.p];oi(r,e.p,0,a,i-u,o,c,m,e.Kn),Cs(e,e.p,100,c),Mo(e);let h=e.we,g=e.Ie;for(let y=0;y<e.ne;y++)h[y]=c,g[y]=e.p}e.i||(e.i=t.shaders.getOrCreate("treemap",An,Ln),e.B={u_resolution:n.getUniformLocation(e.i,"u_resolution"),a_position:n.getAttribLocation(e.i,"a_position"),a_color:n.getAttribLocation(e.i,"a_color")});let f=e.T(),b=f.V,p=re(f.Se,b,Math.max(1,e.a.size));if(e.I){let c=e.I.getContext("2d");c&&c.clearRect(0,0,e.I.width,e.I.height)}e.At=!0,Au(e,n,b,p,f.di),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.i),n.uniform2f(e.B.u_resolution,i,o),n.bindBuffer(n.ARRAY_BUFFER,e.kt),n.enableVertexAttribArray(e.B.a_position),n.vertexAttribPointer(e.B.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Nt),n.enableVertexAttribArray(e.B.a_color),n.vertexAttribPointer(e.B.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.Ri),bt(e)}function vu(e,t,n,i,o,r){let s=e.s,a=[],l=[];for(let c=s.firstChild[e.Y];c!==-1;c=s.nextSibling[c])s.value[c]<=0||(a.push(c),l.push(s.name[c]));let u=Math.max(1,i-o),m=Math.max(1,n-r),f=Ie(l,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.P.facet_padding});e.A=f,Mo(e);let b=e.we,p=0;for(let c=0;c<a.length;c++){let h=a[c],g=f.cells[c];if(!g)continue;let y=s.name[h],x=e.Ue.get(y)??h,C=s.depth[x],_=g.layout.t;oi(s,x,_.x,_.y+o,_.x+_.width,_.y+o+_.height,C,t,e.Kn);let v=Lo(e,x,100,C,p);b.length<v&&Mo(e);let A=e.we,R=e.Ie;for(let L=p;L<v;L++)A[L]=C,R[L]=x;p=v}e.ne=p}function Mo(e){let t=e.X?.length??e.s.count;(!e.we||e.we.length<t)&&(e.we=new Int32Array(t)),(!e.Ie||e.Ie.length<t)&&(e.Ie=new Int32Array(t))}function Au(e,t,n,i,o){let r=e.s,s=e.X,a=e.ne,l=e.we,u=e.Ie,m=g=>l?l[g]:r.depth[e.p],f=g=>u?u[g]:e.p,b=0;for(let g=0;g<a;g++){let y=s[g];if(y===f(g))continue;let x=r.x1[y]-r.x0[y],C=r.y1[y]-r.y0[y];x<1||C<1||(r.firstChild[y]===-1?b++:r.depth[y]-m(g)===1&&(b+=2))}let p=new Float32Array(b*6*2),c=new Float32Array(b*6*4),h=0;for(let g=0;g<a;g++){let y=s[g];if(y===f(g))continue;let x=r.x0[y],C=r.y0[y],_=r.x1[y],v=r.y1[y],A=_-x,R=v-C;if(!(A<1||R<1)){if(r.firstChild[y]===-1){let L=si(e,y,n,i,o);h=Fo(p,c,h,x,C,_-1,v-1,L)}else if(r.depth[y]-m(g)===1){let w=[.25,.25,.25,1];h=Fo(p,c,h,x,v-1,_,v,w),h=Fo(p,c,h,_-1,C,_,v,w)}}}e.Ri=h,e.kt||(e.kt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.kt),t.bufferData(t.ARRAY_BUFFER,p.subarray(0,h*2),t.DYNAMIC_DRAW),e.Nt||(e.Nt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Nt),t.bufferData(t.ARRAY_BUFFER,c.subarray(0,h*4),t.DYNAMIC_DRAW)}function Fo(e,t,n,i,o,r,s,a){let l=n*2,u=n*4;e[l+0]=i,e[l+1]=o,e[l+2]=r,e[l+3]=o,e[l+4]=i,e[l+5]=s,e[l+6]=r,e[l+7]=o,e[l+8]=r,e[l+9]=s,e[l+10]=i,e[l+11]=s;for(let m=0;m<6;m++)t[u+m*4+0]=a[0],t[u+m*4+1]=a[1],t[u+m*4+2]=a[2],t[u+m*4+3]=a[3];return n+6}function bt(e){if(!e.d||e.p===-1)return;let t=e.e;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t,r=e.$!==-1?e.$:e.F;ai(e,e.d,n,i,o,s=>Lu(e,s,n,i,o),r!==-1?s=>{let a=e.T(),{fontFamily:l}=a,u=e.s;Tu(s,u,r);let m=e.X,f=e.ne,b=e.we,p=e.Ie;for(let c=0;c<f;c++){let h=m[c],g=p?p[c]:e.p;if(h===g||u.firstChild[h]===-1)continue;let y=u.x1[h]-u.x0[h],x=u.y1[h]-u.y0[h],C=b?b[c]:u.depth[e.p],_=u.depth[h]-C;_===1?mi(s,u,h,y,x,a,!e.Kn):_===2&&mi(s,u,h,y,x,a,!0)}if(u.firstChild[r]===-1){let c=a.V,h=re(a.Se,c,Math.max(1,e.a.size)),g=u.x1[r]-u.x0[r],y=u.y1[r]-u.y0[r];Fs(e,s,r,g,y,l,c,h,!0)}e.$===-1&&e.F!==-1&&wu(e,s,e.F,i,o,l)}:null)}function Lu(e,t,n,i,o){let r=e.d;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.T(),{fontFamily:a,ge:l}=s,u=s.V,m=re(s.Se,u,Math.max(1,e.a.size)),f=e.s,b=e.X,p=e.ne,c=e.we,h=e.Ie;for(let g=0;g<p;g++){let y=b[g],x=h?h[g]:e.p;if(y===x||f.firstChild[y]!==-1)continue;let C=f.x1[y]-f.x0[y],_=f.y1[y]-f.y0[y];Fs(e,t,y,C,_,a,u,m)}for(let g=0;g<p;g++){let y=b[g],x=h?h[g]:e.p;if(y===x||f.firstChild[y]===-1)continue;let C=f.x1[y]-f.x0[y],_=f.y1[y]-f.y0[y],v=c?c[g]:f.depth[e.p],A=f.depth[y]-v;A===1?mi(t,f,y,C,_,s,!e.Kn):A===2&&mi(t,f,y,C,_,s,!0)}if(e.ue.length>1&&li(e,t,i,a,l),e.K==="series"&&e.a.size>1){let g=new j(i,o,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0});ot(r,g,e.a,m,s)}else if(e.K==="numeric"&&e.f<e.l){let g=new j(i,o,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0});Te(r,g,{min:e.f,max:e.l,label:e.r},u,s,e.getColumnFormatter(e.r,"value"))}if(e.A){t.font=`11px ${a}`,t.fillStyle=l,t.textAlign="center",t.textBaseline="top";for(let g of e.A.cells){let y=g.layout.t;t.fillText(g.label,y.x+y.width/2,y.y-14)}}t.restore()}function Fs(e,t,n,i,o,r,s,a,l=!1){if(i<30||o<14)return;let b=e.s,p=Vt(e,n,s,a),c=ri(p[0],p[1],p[2]),h=l?c>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":c>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",g=Math.min(11,Math.floor(o/2));if(g<7)return;t.font=`${g}px ${r}`;let y=i-8,x=g*1.3,C=Math.max(1,Math.floor((o-8)/x)),_=vs(t,b.name[n],y,C);if(_.length===0)return;let v=_.length*x,A=b.y0[n]+(o-v)/2+x/2;t.fillStyle=h,t.textAlign="center",t.textBaseline="middle";let R=b.x0[n]+i/2;for(let L=0;L<_.length;L++)t.fillText(_[L],R,A+L*x)}function mi(e,t,n,i,o,{fontFamily:r,ge:s,backgroundColor:a},l){let u=t.x0[n],m=t.y0[n],f=t.name[n];if(l){if(i<60||o<30)return;let b=12;e.font=`${b}px ${r}`;let p=f,c=i-16;if(e.measureText(p).width>c){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=c){p+="\\u2026";break}}if(p.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,i,o),e.clip();let g=u+i/2,y=m+o/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(p,g,y),e.fillStyle=a,e.fillText(p,g,y),e.restore()}else{if(i<40||o<22)return;let b=11;e.font=`${b}px ${r}`;let p=f,c=i-10;if(e.measureText(p).width>c){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=c){p+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(p,u+5,m+4),e.globalAlpha=1}}function Tu(e,t,n){e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.strokeRect(t.x0[n],t.y0[n],t.x1[n]-t.x0[n],t.y1[n]-t.y0[n])}function wu(e,t,n,i,o,r){let s=e.s,a=(s.x0[n]+s.x1[n])/2,l=(s.y0[n]+s.y1[n])/2;ui(e,t,n,a,l,i,o,r)}function So(e,t,n){let i=e.s,o=i.x0,r=i.y0,s=i.x1,a=i.y1,l=i.depth,u=i.firstChild,m=e.X,f=e.ne,b=e.we,p=e.Ie,c=-1,h=1/0,g=-1,y=1/0,x=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let C=0;C<f;C++){let _=m[C],v=p?p[C]:e.p;if(_===v||!(t>=o[_]&&t<=s[_]&&n>=r[_]&&n<=a[_]))continue;let A=(s[_]-o[_])*(a[_]-r[_]);if(u[_]!==-1){A<y&&(y=A,g=_);let R=b?b[C]:l[e.p],L=l[_]-R;if(L===1&&n<=r[_]+Ao&&(x=_),L===2){let w=s[_]-o[_],F=a[_]-r[_];if(w>=60&&F>=30){let G=r[_]+F/2,D=o[_]+w/2;Math.abs(n-G)<10&&Math.abs(t-D)<w*.4&&(x=_)}}}else A<h&&(h=A,c=_)}return x!==-1?{leafId:-1,branchId:x,inHeader:!0}:{leafId:c,branchId:g,inHeader:!1}}function Ms(e,t,n){if(e.$!==-1)return;for(let a of e.De)if(t>=a.x0&&t<=a.x1&&n>=a.y0&&n<=a.y1){e._.setCursor("pointer"),e.F=-1,bt(e);return}let{leafId:i,branchId:o,inHeader:r}=So(e,t,n),s=r?o:i!==-1?i:o;if(s!==e.F){if(e.F=s,e._.setCursor(o!==-1?"pointer":"default"),s!==-1){let a=e.k.beginHover(s);Is(e,s).then(l=>{e.k.commitHover(a,l)&&bt(e)})}else e.k.clearHover();bt(e)}}function Ss(e,t,n){if(e.$!==-1){Xt(e),e.emitUnselect();return}for(let s of e.De)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.p&&(fi(e,s.nodeId),e.emitUnselect());return}let{leafId:i,branchId:o,inHeader:r}=So(e,t,n);o!==-1&&r?(fi(e,o),zt(e,o,"branch")):i!==-1?(Ds(e,i),zt(e,i,"leaf")):o!==-1&&(fi(e,o),zt(e,o,"branch"))}async function zt(e,t,n){let i=e.s,o=ei(i,t),r=e.w.length>0&&e.P.facet_mode==="grid",s=r?o.slice(0,e.w.length):[],a=r?o.slice(e.w.length,e.w.length+e.L.length):o.slice(0,e.L.length),l=n==="leaf"?i.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.q,groupByValues:a,splitByValues:s})}function Bs(e,t,n){let i=e.$!==-1;Xt(e),i&&e.emitUnselect();let{leafId:o,branchId:r}=So(e,t,n),s=e.s,a=r;if(a===-1&&o!==-1){let l=s.parent[o];l!==e.p&&l!==-1&&(a=l)}a!==-1&&a!==e.p&&s.firstChild[a]!==-1&&(fi(e,a),zt(e,a,"branch"),o!==-1&&s.firstChild[o]===-1&&(Ds(e,o),zt(e,o,"leaf")))}function fi(e,t){let n=e.s;if(e.w.length>0&&e.P.facet_mode==="grid"){let i=t;for(;i!==-1&&n.parent[i]!==e.Y;)i=n.parent[i];if(i!==-1){let o=n.name[i];e.Ue.set(o,t)}e.F=-1,e.e&&pt(e,e.e);return}e.p=t,dt(e,t),e.F=-1,e.e&&pt(e,e.e)}function Ds(e,t){e._.dismiss(),e.$=t;let n=e.s,i=(n.x0[t]+n.x1[t])/2,o=(n.y0[t]+n.y1[t])/2,r=e.e?.cssWidth??0,s=e.e?.cssHeight??0;Is(e,t).then(a=>{e.$===t&&a.length!==0&&e._.pin(a,{px:i,py:o},{cssWidth:r,cssHeight:s})}),e.F=-1,bt(e)}function Xt(e){e._.dismiss(),e.$=-1}async function Is(e,t){let n=e.s,i=[],o=[],r=t;for(;n.parent[r]!==-1;)o.push(n.name[r]),r=n.parent[r];o.reverse(),o.length>0?i.push(o.join(" \\u203A ")):i.push(n.name[t]);let s=e.getColumnFormatter(e.q,"value");if(i.push(`Value: ${s(n.value[t])}`),e.r&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.r,"value");i.push(`${e.r}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.ce){let u=await e.ce.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.r&&!isNaN(n.colorValue[t])||(typeof f=="number"?i.push(`${m}: ${e.getColumnFormatter(m,"value")(f)}`):i.push(`${m}: ${f}`)))}return n.firstChild[t]!==-1&&i.push(`Children: ${n.childCount[t]}`),i}function Ru(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var ci=class extends mt{constructor(){super(...arguments);d(this,"i",null);d(this,"B",null);d(this,"kt",null);d(this,"Nt",null);d(this,"Ri",0);d(this,"F",-1);d(this,"$",-1);d(this,"De",[]);d(this,"me",null);d(this,"At",!0);d(this,"fn",0);d(this,"Ue",new Map);d(this,"A",null);d(this,"Kn",!1);d(this,"we",null);d(this,"Ie",null)}tooltipCallbacks(){return{onHover:(n,i)=>Ms(this,n,i),onLeave:()=>{this.F!==-1&&this.$===-1&&(this.F=-1,this.e&&pt(this,this.e))},onClickPre:(n,i)=>(Ss(this,n,i),!0),onDblClick:(n,i)=>Bs(this,n,i)}}async uploadAndRender(n,i,o,r){if(this.e=n,o===0){let s=this.E;if(this.q=s[0]||Ru(i)||"",this.r=s[1]||"",!this.r)this.K="empty";else{let a=this.Je[this.r],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.K=l?"numeric":"series"}this.F=-1,this.$=-1,this.De=[],this.Ue.clear(),this.A=null,this.we=null,this.Ie=null,this.Ri=0,this.k.clearHover(),this.k.invalidatePin(),Xt(this),this.me?.close(),this.me=null,this.At=!0,this.fn++,Ut(this)}Ot(this,i),Ht(this),this.Y!==-1&&await this.requestRender(n)}It(n){this.Y!==-1&&(this.e=n,pt(this,n))}destroyInternal(){Xt(this),this.me?.close(),this.me=null;let n=this.e?.gl;n&&(this.kt&&n.deleteBuffer(this.kt),this.Nt&&n.deleteBuffer(this.Nt)),this.kt=null,this.Nt=null,this.i=null,this.B=null,this.Y=-1,this.p=-1,this.ue=[],this.Gt.clear(),this.X=null,this.ne=0,this.De=[],this.Ue.clear(),this.A=null,this.we=null,this.Ie=null}};Bt();rt();Ae();we();var Es=4,$t=30;function Fu(e,t){let n=0,i=e.depth[t],o=new Int32Array(128);o[0]=t;let r=1;for(;r>0;){r--;let s=o[r],a=e.depth[s]-i;a>n&&(n=a);for(let l=e.firstChild[s];l!==-1;l=e.nextSibling[l]){if(r>=o.length){let u=new Int32Array(o.length*2);u.set(o),o=u}o[r++]=l}}return n}function Bo(e,t,n){let i=e.depth[t],o=Math.max(1,Fu(e,t)),s=Math.max(0,n-$t)/o;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=$t,Ps(e,t,0,2*Math.PI,$t,s,i)}function Ps(e,t,n,i,o,r,s){let a=e.value[t];if(a<=0)return;let l=i-n,u=n;for(let m=e.firstChild[t];m!==-1;m=e.nextSibling[m]){let f=e.value[m];if(f<=0)continue;let b=f/a,p=u,c=u+l*b;u=c;let h=o,g=o+r;e.a0[m]=p,e.a1[m]=c,e.r0[m]=h,e.r1[m]=g;let y=c-p,x=(h+g)/2;y*x*r<Es||e.firstChild[m]!==-1&&Ps(e,m,p,c,g,r,s)}}function Ws(e,t){e.ne=Do(e,t,0)}function Do(e,t,n){let i=e.s,o=i.a0,r=i.a1,s=i.r0,a=i.r1,l=i.firstChild,u=i.nextSibling,m=i.value;(!e.X||e.X.length<i.count)&&(e.X=new Int32Array(i.count));let f=e.X,b=n,p=new Int32Array(128);p[0]=t;let c=1;for(;c>0;){c--;let h=p[c];if(m[h]<=0)continue;f[b++]=h;let g=r[h]-o[h],y=(s[h]+a[h])/2,x=g*y,C=a[h]-s[h];if(!(x*C<Es))for(let _=l[h];_!==-1;_=u[_]){if(c>=p.length){let v=new Int32Array(p.length*2);v.set(p),p=v}p[c++]=_}}return b}St();rt();var di=32,Mu=28,Su=90;function pi(e,t){if(e.m.length===0)return{centerX:e.rt,centerY:e.st};let n=e.s;for(let i of e.m){let o=t;for(;o!==-1;){if(o===i.drillRoot)return{centerX:i.centerX,centerY:i.centerY};o=n.parent[o]}}return{centerX:e.rt,centerY:e.st}}function ht(e,t){if(e.p===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.w.length>0&&e.P.facet_mode==="grid",s=e.K==="series"?e.a.size>1:e.K==="numeric"&&e.f<e.l,a=!r&&e.ue.length>1?Mu:0,l=s?Su:0;if(r)Bu(e,i,o,l);else{e.A=null,e.m=[];let c=i-l,h=o-a;e.rt=c/2,e.st=a+h/2,e.Fi=Math.max(0,Math.min(c,h)/2-4),Bo(e.s,e.p,e.Fi),Ws(e,e.p)}Du(e,t);let u=e.T(),m=u.V,f=re(u.Se,m,Math.max(1,e.a.size));if(e.I){let c=e.I.getContext("2d");c&&c.clearRect(0,0,e.I.width,e.I.height)}let b=t.dpr;e.At=!0,Iu(e,n,m,f,u.di,b),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.i);let p=e.B;if(n.uniform2f(p.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(p.u_border_px,u.Qi*b),e.m.length>0)for(let c of e.m)c.instanceCount!==0&&(n.uniform2f(p.u_center,c.centerX*b,c.centerY*b),Gs(e,n,t,c.instanceStart,c.instanceCount));else n.uniform2f(p.u_center,e.rt*b,e.st*b),Gs(e,n,t,0,e.Mi);Ne(e)}function Bu(e,t,n,i){let o=e.s,r=[],s=[];for(let f=o.firstChild[e.Y];f!==-1;f=o.nextSibling[f])o.value[f]<=0||(r.push(f),s.push(o.name[f]));let a=Math.max(1,t-i),l=Ie(s,{cssWidth:a,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.P.facet_padding});e.A=l;let u=[],m=0;for(let f=0;f<r.length;f++){let b=r[f],p=l.cells[f];if(!p)continue;let c=o.name[b],h=e.Ue.get(c)??b,g=p.layout.t,y=g.x+g.width/2,x=g.y+g.height/2,C=Math.max(0,Math.min(g.width,g.height)/2-4);Bo(o,h,C);let _=Do(e,h,m),v=m,A=_-m;u.push({label:c,centerX:y,centerY:x,maxRadius:C,drillRoot:h,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=_}e.ne=m,e.m=u,u.length>0&&(e.rt=u[0].centerX,e.st=u[0].centerY,e.Fi=u[0].maxRadius)}function Du(e,t){if(e.i)return;let n=t.gl,i=t.shaders.getOrCreate("sunburst-arc",_n,vn);e.i=i,e.B={u_center:n.getUniformLocation(i,"u_center"),u_resolution:n.getUniformLocation(i,"u_resolution"),u_border_px:n.getUniformLocation(i,"u_border_px"),a_strip_t:n.getAttribLocation(i,"a_strip_t"),a_side:n.getAttribLocation(i,"a_side"),a_angles:n.getAttribLocation(i,"a_angles"),a_radii:n.getAttribLocation(i,"a_radii"),a_color:n.getAttribLocation(i,"a_color")};let o=new Float32Array((di+1)*2*2);for(let r=0;r<=di;r++){let s=r/di,a=r*4;o[a+0]=s,o[a+1]=0,o[a+2]=s,o[a+3]=1}e.qt=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.qt),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),e.Kt=n.createBuffer()}function Iu(e,t,n,i,o,r){let s=e.s,a=e.X,l=e.m.length>0,u=l?e.m.reduce((p,c)=>p+c.instanceCount,0):e.ne,m=new Float32Array(u*8),f=0,b=(p,c,h)=>{let g=f;for(let y=p;y<c;y++){let x=a[y];if(x===h)continue;let C=s.a0[x],_=s.a1[x],v=s.r0[x],A=s.r1[x];if(_<=C||A<=v)continue;let R=si(e,x,n,i,o),L=f*8;m[L+0]=C,m[L+1]=_,m[L+2]=v*r,m[L+3]=A*r,m[L+4]=R[0],m[L+5]=R[1],m[L+6]=R[2],m[L+7]=R[3],f++}return{rangeStart:g,rangeCount:f-g}};if(l)for(let p of e.m){let c=p.instanceStart,h=c+p.instanceCount,{rangeStart:g,rangeCount:y}=b(c,h,p.drillRoot);p.instanceStart=g,p.instanceCount=y}else b(0,e.ne,e.p);e.Mi=f,t.bindBuffer(t.ARRAY_BUFFER,e.Kt),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function Gs(e,t,n,i,o){if(o===0)return;let r=e.B;t.bindBuffer(t.ARRAY_BUFFER,e.qt);let s=2*Float32Array.BYTES_PER_ELEMENT;t.enableVertexAttribArray(r.a_strip_t),t.vertexAttribPointer(r.a_strip_t,1,t.FLOAT,!1,s,0),t.enableVertexAttribArray(r.a_side),t.vertexAttribPointer(r.a_side,1,t.FLOAT,!1,s,Float32Array.BYTES_PER_ELEMENT);let a=K(n),{setDivisor:l}=a;l(r.a_strip_t,0),l(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.Kt);let u=8*Float32Array.BYTES_PER_ELEMENT,m=Float32Array.BYTES_PER_ELEMENT,f=i*u;t.enableVertexAttribArray(r.a_angles),t.vertexAttribPointer(r.a_angles,2,t.FLOAT,!1,u,f),l(r.a_angles,1),t.enableVertexAttribArray(r.a_radii),t.vertexAttribPointer(r.a_radii,2,t.FLOAT,!1,u,f+2*m),l(r.a_radii,1),t.enableVertexAttribArray(r.a_color),t.vertexAttribPointer(r.a_color,4,t.FLOAT,!1,u,f+4*m),l(r.a_color,1),a.drawArraysInstanced(t.TRIANGLE_STRIP,0,2*(di+1),o),l(r.a_angles,0),l(r.a_radii,0),l(r.a_color,0)}function Ne(e){if(!e.d||e.p===-1)return;let t=e.e;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t;ai(e,e.d,n,i,o,r=>Eu(e,r,n,i,o),e.F!==-1?r=>{Pu(r,e,e.F),Wu(e,r,e.F,i,o,e.T().fontFamily)}:null)}function Eu(e,t,n,i,o){let r=e.d;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.T(),{fontFamily:a,ge:l,Sn:u}=s,m=s.V,f=re(s.Se,m,Math.max(1,e.a.size)),b=e.s,p=e.X,c=e.ne,h=e.m.length>0;if(h)for(let y of e.m){let x=y.nodeStart+y.nodeCount;for(let C=y.nodeStart;C<x;C++){let _=p[C];_!==y.drillRoot&&ks(e,t,_,a,m,f,y.centerX,y.centerY)}}else for(let y=0;y<c;y++){let x=p[y];x!==e.p&&ks(e,t,x,a,m,f,e.rt,e.st)}let g=Math.max(0,$t-s.Qi*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",h){for(let y of e.m)if(t.beginPath(),t.fillStyle=u,t.arc(y.centerX,y.centerY,g,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[y.drillRoot],y.centerX,y.centerY),e.A){let x=e.A.cells.find(C=>C.label===y.label);x?.titleRect&&(t.fillStyle=l,t.font=`11px ${a}`,t.textBaseline="middle",t.fillText(y.label,x.titleRect.x+x.titleRect.width/2,x.titleRect.y+x.titleRect.height/2))}}else t.beginPath(),t.arc(e.rt,e.st,g,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[e.p],e.rt,e.st);if(!h&&e.ue.length>1&&li(e,t,i,a,l),h&&e.A?.legendRect){if(e.K==="series"&&e.a.size>1)Gt(r,e.A.legendRect,e.a,f,s);else if(e.K==="numeric"&&e.f<e.l){let y=new j(i,o,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0});Te(r,y,{min:e.f,max:e.l,label:e.r},m,s,e.getColumnFormatter(e.r,"value"))}}else if(e.K==="series"&&e.a.size>1){let y=new j(i,o,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0});ot(r,y,e.a,f,s)}else if(e.K==="numeric"&&e.f<e.l){let y=new j(i,o,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0});Te(r,y,{min:e.f,max:e.l,label:e.r},m,s,e.getColumnFormatter(e.r,"value"))}t.restore()}function ks(e,t,n,i,o,r,s,a){let l=e.s,u=l.a0[n],m=l.a1[n],f=l.r0[n],b=l.r1[n],p=b-f,c=(f+b)/2,g=(m-u)*c;if(p<16||g<8)return;let y=Math.min(11,Math.floor(g*.7));if(y<7)return;t.font=`${y}px ${i}`;let x=l.name[n],C=p-4,_=x;if(t.measureText(_).width>C){for(;_.length>1;)if(_=_.slice(0,-1),t.measureText(_+"\\u2026").width<=C){_+="\\u2026";break}}if(_.length<2)return;let v=(u+m)/2;t.save(),t.translate(s,a);let A=v,R=v>Math.PI/2&&v<3*Math.PI/2;e.ao==="upright"&&R&&(A+=Math.PI),t.rotate(A);let L=Vt(e,n,o,r),w=ri(L[0],L[1],L[2]);t.fillStyle=w>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)",t.textAlign="center",t.textBaseline="middle";let F=e.ao==="upright"&&R?-c:c;t.fillText(_,F,0),t.restore()}function Pu(e,t,n){let i=t.s,o=i.a0[n],r=i.a1[n],s=i.r0[n],a=i.r1[n],{centerX:l,centerY:u}=pi(t,n);e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.beginPath(),e.arc(l,u,a,o,r),e.arc(l,u,s,r,o,!0),e.closePath(),e.stroke()}function Wu(e,t,n,i,o,r){let s=e.s,a=(s.a0[n]+s.a1[n])/2,l=(s.r0[n]+s.r1[n])/2,{centerX:u,centerY:m}=pi(e,n),f=u+Math.cos(a)*l,b=m+Math.sin(a)*l;ui(e,t,n,f,b,i,o,r)}function Us(e,t,n){if(e.m.length===0)return{centerX:e.rt,centerY:e.st,drillRoot:e.p};for(let i of e.m){let o=t-i.centerX,r=n-i.centerY;if(!(Math.sqrt(o*o+r*r)>i.maxRadius+4))return{centerX:i.centerX,centerY:i.centerY,drillRoot:i.drillRoot}}return null}function Gu(e,t,n){let i=e.s,o=t;for(;o!==-1;){if(o===n)return!0;o=i.parent[o]}return!1}function Os(e,t,n){let i=Us(e,t,n);if(!i)return-1;let o=e.s,r=e.X,s=e.ne;if(!r)return-1;let a=t-i.centerX,l=n-i.centerY,u=Math.sqrt(a*a+l*l),m=Math.atan2(l,a);if(m<0&&(m+=2*Math.PI),u<o.r1[e.Y]+.001&&i.drillRoot!==e.Y)return i.drillRoot;let f=e.m.length>0;for(let b=0;b<s;b++){let p=r[b];if(p===i.drillRoot||f&&!Gu(e,p,i.drillRoot))continue;let c=o.a0[p],h=o.a1[p],g=o.r0[p],y=o.r1[p];if(!(u<g||u>y)&&!(m<c||m>h))return p}return-1}function Hs(e,t,n){if(e.$!==-1)return;for(let r of e.De)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e._.setCursor("pointer"),e.F!==-1&&(e.F=-1,Ne(e));return}let i=Os(e,t,n),o=e.s;if(e._.setCursor(i!==-1&&o.firstChild[i]!==-1?"pointer":"default"),i!==e.F){if(e.F=i,i!==-1){let r=e.k.beginHover(i);Vs(e,i).then(s=>{e.k.commitHover(r,s)&&Ne(e)})}else e.k.clearHover();Ne(e)}}function Ys(e,t,n){if(e.$!==-1){bi(e),e.emitUnselect();return}for(let s of e.De)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.p&&(Io(e,s.nodeId),e.emitUnselect());return}let i=e.s,o=Us(e,t,n);if(o){let s=t-o.centerX,a=n-o.centerY;if(Math.sqrt(s*s+a*a)<i.r1[e.Y]+.001){let u=i.parent[o.drillRoot];if(u!==-1&&u!==e.Y)Io(e,u),e.emitUnselect();else if(e.m.length>0){let m=e.m.find(f=>f.drillRoot===o.drillRoot);m&&(e.Ue.delete(m.label),e.emitUnselect()),e.e&&ht(e,e.e)}return}}let r=Os(e,t,n);r!==-1&&(i.firstChild[r]!==-1?(Io(e,r),Ns(e,r,"branch")):(ku(e,r),Ns(e,r,"leaf")))}async function Ns(e,t,n){let i=e.s,o=ei(i,t),r=e.w.length>0&&e.P.facet_mode==="grid",s=r?o.slice(0,e.w.length):[],a=r?o.slice(e.w.length,e.w.length+e.L.length):o.slice(0,e.L.length),l=n==="leaf"?i.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.q,groupByValues:a,splitByValues:s})}function Io(e,t){let n=e.s;if(e.w.length>0&&e.P.facet_mode==="grid"){let i=t;for(;i!==-1&&n.parent[i]!==e.Y;)i=n.parent[i];i!==-1&&e.Ue.set(n.name[i],t),e.F=-1,e.e&&ht(e,e.e);return}e.p=t,dt(e,t),e.F=-1,e.e&&ht(e,e.e)}function ku(e,t){e._.dismiss(),e.$=t;let n=e.s,i=(n.a0[t]+n.a1[t])/2,o=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=pi(e,t),a=r+Math.cos(i)*o,l=s+Math.sin(i)*o,u=e.e?.cssWidth??0,m=e.e?.cssHeight??0;Vs(e,t).then(f=>{e.$===t&&f.length!==0&&e._.pin(f,{px:a,py:l},{cssWidth:u,cssHeight:m})}),e.F=-1,Ne(e)}function bi(e){e._.dismiss(),e.$=-1}async function Vs(e,t){let n=e.s,i=[],o=[],r=t;for(;n.parent[r]!==-1;)o.push(n.name[r]),r=n.parent[r];o.reverse(),o.length>0?i.push(o.join(" \\u203A ")):i.push(n.name[t]);let s=e.getColumnFormatter(e.q,"value");if(i.push(`Value: ${s(n.value[t])}`),e.r&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.r,"value");i.push(`${e.r}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.ce){let u=await e.ce.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.r&&!isNaN(n.colorValue[t])||(typeof f=="number"?i.push(`${m}: ${e.getColumnFormatter(m,"value")(f)}`):i.push(`${m}: ${f}`)))}return n.firstChild[t]!==-1&&i.push(`Children: ${n.childCount[t]}`),i}function Nu(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var hi=class extends mt{constructor(){super(...arguments);d(this,"i",null);d(this,"B",null);d(this,"qt",null);d(this,"Kt",null);d(this,"Mi",0);d(this,"ao","upright");d(this,"rt",0);d(this,"st",0);d(this,"Fi",0);d(this,"F",-1);d(this,"$",-1);d(this,"De",[]);d(this,"me",null);d(this,"At",!0);d(this,"fn",0);d(this,"A",null);d(this,"Ue",new Map);d(this,"m",[])}tooltipCallbacks(){return{onHover:(n,i)=>Hs(this,n,i),onLeave:()=>{this.F!==-1&&this.$===-1&&(this.F=-1,Ne(this))},onClickPre:(n,i)=>(Ys(this,n,i),!0)}}async uploadAndRender(n,i,o,r){if(this.e=n,o===0){let s=this.E;if(this.q=s[0]||Nu(i)||"",this.r=s[1]||"",!this.r)this.K="empty";else{let a=this.Je[this.r],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.K=l?"numeric":"series"}this.F=-1,this.$=-1,this.De=[],this.Ue.clear(),this.A=null,this.m=[],this.Mi=0,this.k.clearHover(),this.k.invalidatePin(),bi(this),this.me?.close(),this.me=null,this.At=!0,this.fn++,Ut(this)}Ot(this,i),Ht(this),this.Y!==-1&&await this.requestRender(n)}It(n){this.Y!==-1&&(this.e=n,ht(this,n))}destroyInternal(){bi(this),this.me?.close(),this.me=null;let n=this.e?.gl;n&&(this.qt&&n.deleteBuffer(this.qt),this.Kt&&n.deleteBuffer(this.Kt)),this.qt=null,this.Kt=null,this.i=null,this.B=null,this.Y=-1,this.p=-1,this.ue=[],this.Gt.clear(),this.X=null,this.ne=0,this.De=[],this.A=null,this.Ue.clear(),this.m=[]}};Ft();var gt=class extends he{constructor(){super(...arguments);d(this,"Re",[]);d(this,"ie",0);d(this,"lt",0);d(this,"i",null);d(this,"W",null);d(this,"u",null);d(this,"Le",null);d(this,"Te",null);d(this,"Be",null);d(this,"Wn",!0)}getZoomConfig(){return{lockAxis:"y"}}};Mt();function gi(e,t=.5,n=.1){let i=t/Math.max(1,e),o=i*(1-n)/2;return{slotWidth:i,halfWidth:o}}function zs(e,t,n="bar"){let i=t?.[e]?.chart_type?.toLowerCase?.();return i==="bar"||i==="line"||i==="scatter"||i==="area"?i:n}function Xs(e,t,n){let i=n?.[e]?.stack;return typeof i=="boolean"?i:t==="bar"||t==="area"}function $s(e,t){return t?.[e]?.alt_axis===!0}var js=50,qe=0,yi=1;function xi(){return{count:0,catIdx:new Int32Array(0),seriesId:new Int32Array(0),axis:new Uint8Array(0),chartType:new Uint8Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),y0:new Float64Array(0),y1:new Float64Array(0)}}function Uu(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),seriesId:new Int32Array(t),axis:new Uint8Array(t),chartType:new Uint8Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),y0:new Float64Array(t),y1:new Float64Array(t)}}function jt(e,t,n,i,o){let r=e.seriesId[t],s=e.catIdx[t];return{catIdx:s,aggIdx:Math.floor(r/n),splitIdx:r%n,seriesId:r,xCenter:e.xCenter[t],halfWidth:e.halfWidth[t],y0:e.y0[t],y1:e.y1[t],value:i[s*o+r],axis:e.axis[t],chartType:e.chartType[t]===qe?"bar":"area"}}function Zs(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function Ou(e,t){e[t>>3]|=1<<(t&7)}function qs(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,columnsConfig:a,defaultChartType:l,autoAltYAxis:u,bandInnerFrac:m,barInnerPad:f,includeZero:b,scratchBars:p,scratchPosStack:c,scratchNegStack:h}=e,g=ft(o,s),y={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:g,numericCategoryDomain:null,categoryPositions:null,series:[],bars:xi(),posStack:c??null,negStack:h??null,samples:new Float32Array(0),sampleValid:new Uint8Array(0),leftDomain:{min:0,max:0},rightDomain:null,hasRightAxis:!1},x=i.filter(S=>!!S);if(x.length===0)return y;let C=[];if(r.length>0){for(let S of De(t,[],x))S.colNames.size>0&&C.push(S.prefix);C.length===0&&C.push("")}else C.push("");let _=o.map(S=>s[S]??"string"),{rowPaths:v,numCategories:A,rowOffset:R}=ct(t,n,o.length,_);if(A===0)return{...y,aggregates:x,splitPrefixes:C,rowPaths:v,rowOffset:R};let L=[],w=x.length,F=C.length;for(let S=0;S<w;S++)for(let E=0;E<F;E++){let V=x[S],Y=C[E],X=Y===""?V:`${Y}${w>1?` | ${V}`:""}`,q=zs(V,a,l),$=Xs(V,q,a);L.push({seriesId:S*F+E,aggIdx:S,splitIdx:E,aggName:V,splitKey:Y,label:X,color:[.5,.5,.5],axis:0,chartType:q,stack:$})}let G=[];for(let S=0;S<w;S++)G.push(b?{min:0,max:0}:{min:1/0,max:-1/0});let D=A,B=L.length,P=D*w,M=Zs(c??null,P),k=Zs(h??null,P);M.fill(0,0,P),k.fill(0,0,P);let N=new Float32Array(D*B),W=new Uint8Array(D*B+7>>3),J=null,U=null,O=1;if(g.mode==="numeric"&&D>0){let S=t.get("__ROW_PATH_0__"),E=je(S?.values,D,R,o[0]??"",g.numericType==="date"||g.numericType==="datetime");E&&(J=E.categoryPositions,U=E.numericCategoryDomain,O=E.numericCategoryDomain.bandWidth)}let ne=gi(w,m,f),fe=ne.slotWidth*O,ce=ne.halfWidth*O,de=new Float64Array(w),ye=(w-1)/2;for(let S=0;S<w;S++)de[S]=(S-ye)*fe;let Me=new Array(w*F),At=new Array(w*F);for(let S=0;S<w;S++){let E=x[S];for(let V=0;V<F;V++){let Y=C[V],X=Y===""?E:`${Y}|${E}`,q=t.get(X),$=S*F+V;Me[$]=q?.values??null,At[$]=q?.valid??null}}let on=D*w*F,H=Uu(p??null,on),z=0;for(let S=0;S<D;S++){let E=S+R,V=J?J[S]:S;for(let Y=0;Y<w;Y++){let X=de[Y],q=V+X,$=G[Y];for(let rn=0;rn<F;rn++){let sn=Y*F+rn,Ve=L[sn],ur=Y*F+rn,mr=Me[ur];if(!mr)continue;let fr=At[ur];if(fr&&!(fr[E>>3]>>(E&7)&1))continue;let se=mr[E];if(!isFinite(se))continue;let cr=S*B+sn;if(N[cr]=se,Ou(W,cr),(Ve.chartType==="bar"||Ve.chartType==="area")&&Ve.stack){if(se===0)continue;let Lt=S*w+Y,xe,Ce;se>=0?(xe=M[Lt],Ce=xe+se,M[Lt]=Ce):(xe=k[Lt],Ce=xe+se,k[Lt]=Ce),xe<$.min&&($.min=xe),Ce<$.min&&($.min=Ce),xe>$.max&&($.max=xe),Ce>$.max&&($.max=Ce),H.catIdx[z]=S,H.seriesId[z]=sn,H.axis[z]=0,H.chartType[z]=Ve.chartType==="bar"?qe:yi,H.xCenter[z]=q,H.halfWidth[z]=ce,H.y0[z]=xe,H.y1[z]=Ce,z++}else if(se<$.min&&($.min=se),se>$.max&&($.max=se),b&&(0<$.min&&($.min=0),0>$.max&&($.max=0)),Ve.chartType==="bar"||Ve.chartType==="area"){if(se===0)continue;H.catIdx[z]=S,H.seriesId[z]=sn,H.axis[z]=0,H.chartType[z]=Ve.chartType==="bar"?qe:yi,H.xCenter[z]=q,H.halfWidth[z]=ce,H.y0[z]=0,H.y1[z]=se,z++}}}}H.count=z;let Q=!1;if(u&&w>=2){let S=new Array(w),E=0,V=1/0;for(let Y=0;Y<w;Y++){let X=G[Y],q=Math.max(Math.abs(X.min),Math.abs(X.max),1e-12);S[Y]=q,q>E&&(E=q),q<V&&(V=q)}if(E/V>js){let Y=E/Math.sqrt(js);for(let X=0;X<w;X++)if(S[X]<Y)for(let $ of L)$.aggIdx===X&&($.axis=1);for(let X=0;X<H.count;X++)H.axis[X]=L[H.seriesId[X]].axis;Q=L.some(X=>X.axis===1)}}let ee=!1;for(let S=0;S<w;S++)if($s(x[S],a))for(let E of L)E.aggIdx===S&&(E.axis=1,ee=!0);if(ee){for(let S=0;S<H.count;S++)H.axis[S]=L[H.seriesId[S]].axis;Q=!0}let Z=b?{min:0,max:0}:{min:1/0,max:-1/0},oe=b?{min:0,max:0}:{min:1/0,max:-1/0};for(let S=0;S<H.count;S++){let E=H.axis[S]===0?Z:oe,V=H.y0[S],Y=H.y1[S];V<E.min&&(E.min=V),Y<E.min&&(E.min=Y),V>E.max&&(E.max=V),Y>E.max&&(E.max=Y)}for(let S=0;S<B;S++){let E=L[S];if(E.stack&&(E.chartType==="bar"||E.chartType==="area"))continue;let V=E.axis===0?Z:oe;for(let Y=0;Y<D;Y++){let X=Y*B+S;if(!(W[X>>3]>>(X&7)&1))continue;let q=N[X];q<V.min&&(V.min=q),q>V.max&&(V.max=q)}}(!isFinite(Z.min)||!isFinite(Z.max)||Z.min===0&&Z.max===0)&&(Z.min=0,Z.max=1);let ar=!isFinite(oe.min)||!isFinite(oe.max)||oe.min===0&&oe.max===0;return{aggregates:x,splitPrefixes:C,rowPaths:v,numCategories:A,rowOffset:R,axisMode:g,numericCategoryDomain:U,categoryPositions:J,series:L,bars:H,posStack:M,negStack:k,samples:N,sampleValid:W,leftDomain:Z,rightDomain:Q?ar?{min:0,max:1}:oe:null,hasRightAxis:Q}}Ae();Et();et();we();var Ks=qe;function Js(e,t,n){if(e.cn===0)return;let i=e.B,o=K(n),{setDivisor:r}=o;t.bindBuffer(t.ARRAY_BUFFER,e.W),t.enableVertexAttribArray(i.a_corner),t.vertexAttribPointer(i.a_corner,2,t.FLOAT,!1,0,0),r(i.a_corner,0),ke(n,o,i.a_x_center,"bar_x",1)&&ke(n,o,i.a_half_width,"bar_hw",1)&&ke(n,o,i.a_y0,"bar_y0",1)&&ke(n,o,i.a_y1,"bar_y1",1)&&ke(n,o,i.a_color,"bar_color",3)&&ke(n,o,i.a_series_id,"bar_sid",1)&&ke(n,o,i.a_axis,"bar_axis",1)&&o.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,e.cn),r(i.a_x_center,0),r(i.a_half_width,0),r(i.a_y0,0),r(i.a_y1,0),r(i.a_color,0),r(i.a_series_id,0),r(i.a_axis,0)}var Ci=10;function _i(e){return e.Ee>=0?jt(e.fe,e.Ee,e.Oe.length,e.He,e.b.length):e.Pe}function Eo(e,t,n){if(!e.u)return;let i=e.u,o=i.t;if(t<o.x||t>o.x+o.width||n<o.y||n>o.y+o.height){Yu(e);return}let r=i.J,s=i.se,a=i.ee,l=i.ae,u,m,f,b;if(e.ut){let y=r,x=s,C=Math.min(a,l),_=Math.max(a,l),v=y+(t-o.x)/o.width*(x-y);u=C+(n-o.y)/o.height*(_-C),m=v,f=o.height/(_-C),b=o.width/(x-y)}else u=r+(t-o.x)/o.width*(s-r),m=l-(n-o.y)/o.height*(l-a),f=o.width/(s-r),b=o.height/(l-a);let p=e.dn&&e.oe&&!e.ut?e.oe.max-(n-o.y)/o.height*(e.oe.max-e.oe.min):m,c=e.dn&&e.oe&&!e.ut?o.height/(e.oe.max-e.oe.min):b,h=-1,g=null;if(g=Qs(e,"scatter",u,m,p,f,b,c),g||(g=Qs(e,"line",u,m,p,f,b,c)),!g){let y=e.fe,x=y.chartType,C=y.seriesId,_=y.xCenter,v=y.halfWidth,A=y.y0,R=y.y1,L=y.axis,w=e.Q;for(let F=0;F<y.count;F++){if(x[F]!==qe||w.has(C[F]))continue;let G=_[F],D=v[F];if(u<G-D||u>G+D)continue;let B=L[F]===0?m:p,P=A[F],M=R[F],k=P<M?P:M,N=P<M?M:P;if(B>=k&&B<=N){h=F;break}}}if(h<0&&!g){let y=Hu(e,u,m,p);y&&(y.idx>=0?h=y.idx:g=y.bar)}Vu(e,h,g)}function Qs(e,t,n,i,o,r,s,a){let l=e.ie,u=e.b.length;if(l===0||u===0)return null;let m=e.He,f=e.Ut,p=Ci*Ci,c=null,h=e.mt;for(let g of e.b){if(g.chartType!==t||e.Q.has(g.seriesId))continue;let y=g.axis===1?o:i,x=g.axis===1?a:s,C=h?0:Math.max(0,Math.floor(n-Ci/r)),_=h?l-1:Math.min(l-1,Math.ceil(n+Ci/r));for(let v=C;v<=_;v++){let A=v*u+g.seriesId;if(!(f[A>>3]>>(A&7)&1))continue;let R=m[A],L=h?h[v]:v,w=(L-n)*r,F=(R-y)*x,G=w*w+F*F;G<p&&(p=G,c={catIdx:v,aggIdx:g.aggIdx,splitIdx:g.splitIdx,seriesId:g.seriesId,xCenter:L,halfWidth:0,y0:0,y1:R,value:R,axis:g.axis,chartType:"bar"})}}return c}function Hu(e,t,n,i){let o=Math.round(t);if(o<0||o>=e.ie||Math.abs(t-o)>.5)return null;let r=e.b.length,s=e.He,a=e.Ut,l=e.fe,u=l.chartType,m=l.catIdx,f=l.seriesId,b=l.axis,p=l.y0,c=l.y1;for(let h=0;h<l.count;h++){if(u[h]!==yi||m[h]!==o||e.Q.has(f[h]))continue;let g=b[h]===0?n:i,y=p[h],x=c[h],C=y<x?y:x,_=y<x?x:y;if(g>=C&&g<=_)return{idx:h,bar:null}}for(let h of e.b){if(h.chartType!=="area"||h.stack||e.Q.has(h.seriesId))continue;let g=o*r+h.seriesId;if(!(a[g>>3]>>(g&7)&1))continue;let y=s[g],x=h.axis===1?i:n,C=Math.min(0,y),_=Math.max(0,y);if(x>=C&&x<=_)return{idx:-1,bar:{catIdx:o,aggIdx:h.aggIdx,splitIdx:h.splitIdx,seriesId:h.seriesId,xCenter:o,halfWidth:.5,y0:0,y1:y,value:y,axis:h.axis,chartType:"area"}}}return null}function Yu(e){(e.Ee!==-1||e.Pe!==null)&&(e.Ee=-1,e.Pe=null,e.e&&Ue(e,e.e))}function Vu(e,t,n){let i=e.Ee===t,o=(e.Pe?.seriesId??-1)===(n?.seriesId??-1)&&(e.Pe?.catIdx??-1)===(n?.catIdx??-1);i&&o||(e.Ee=t,e.Pe=n,e.e&&Ue(e,e.e))}function ea(e,t,n){if(e.Jn.length===0)return!1;for(let i of e.Jn){let o=i.rect;if(t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height)return e.Q.has(i.seriesId)?e.Q.delete(i.seriesId):e.Q.add(i.seriesId),e.Lt=null,e.Qn=!1,e.ei=null,e.e&&(vi(e,e.e),Ai(e,e.e),Ue(e,e.e)),!0}return!1}function Po(e,t){let n=[],i=e.b[t.seriesId],o=zu(e,t.catIdx);o&&n.push(o);let r=e.getColumnFormatter(i.aggName,"value");return n.push(`${i.aggName}: ${r(t.value)}`),i.splitKey&&n.push(`Split: ${i.splitKey}`),t.y0!==0&&(n.push(`Base: ${r(t.y0)}`),n.push(`Top: ${r(t.y1)}`)),n}function zu(e,t){if(e.ft==="numeric"&&e.j){let i=e.fe,o=null;for(let s=0;s<i.count;s++)if(i.catIdx[s]===t){o=i.xCenter[s];break}if(o==null)return"";let r=e.L[0];return e.getColumnFormatter(r,"value")(o)}if(e.Re.length===0)return"";let n=[];for(let i of e.Re){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function ta(e,t){t<0||t>=e.fe.count||(e.Si=t,ia(e,jt(e.fe,t,e.Oe.length,e.He,e.b.length)))}function na(e,t){e.Si=-1,ia(e,t)}function ia(e,t){if(e._.dismiss(),!e.u)return;let n=e.u,o=(e.b[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.ut?n.G(o,t.xCenter):n.G(t.xCenter,o):Wo(e,t.xCenter,o),s=Po(e,t);s.length!==0&&(e._.pin(s,r,n),e.Ee=-1,e.Pe=null,e.e&&Ue(e,e.e))}pe();pe();nt();var Xu=25,$u=22,Li=5,yt=11,No=14,ju=55,Zu=60,qu=10;function Go(e,t){return e.G(t,0).px}function ko(e,t){return e.G(0,t).py}function Ku(e,t,n){let i=Math.max(0,n-100);return e*16>i?{size:t*6.62+10,rotation:90}:e*(t*6+10)>i?{size:t*4+20,rotation:45}:{size:Xu,rotation:0}}function oa(e,t){let n=e.levels.length,i=[];for(let o=0;o<n;o++){let r=e.levels[o];o===n-1?i.push(Ku(e.numRows,r.maxLabelChars,t)):i.push({size:$u,rotation:0})}return i}function ra(e){let t=e.levels.length,n=[],i=6.2;for(let o=0;o<t;o++)if(o===t-1){let r=e.levels[o].maxLabelChars;n.push(Math.max(ju,r*i+qu))}else n.push(Zu);return n}function sa(e){let t=0;for(let n of e)t+=n;return t}function xt(e,t){return e.numRows===0||e.levels.length===0?24:sa(oa(e,t).map(n=>n.size))}function aa(e){return e.numRows===0||e.levels.length===0?55:sa(ra(e))}function Ju(e,t,n,i){let o=t-e+1;if(o<=0)return[];let r=Math.max(1,Math.floor(n/i));if(o<=r){let l=[];for(let u=e;u<=t;u++)l.push(u);return l}let s=Math.ceil(o/r),a=[];for(let l=e;l<=t;l+=s)a.push(l);return a}function la(e,t){return e.labels[t]??""}function ua(e,t,n,i){let o=i?Math.min(t,n):t,r=i?Math.max(t,n):n,s=Math.max(0,Math.ceil(o)),a=Math.min(e-1,Math.floor(r));return a<s?null:[s,a]}function ma(e,t,n,i){let o=[];for(let r of e){let s=t(r.startIdx-.5),a=t(r.endIdx+.5),l=Math.max(n,Math.min(s,a)),u=Math.min(i,Math.max(s,a));u>l&&o.push({run:r,nearEdge:s,farEdge:a,nearClip:l,farClip:u})}return o}function Zt(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Dt:o,ge:r,fontFamily:s}=i,{t:a}=t,l=a.y+a.height;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${yt}px ${s}`;let u=oa(n,a.width),m=ua(n.numRows,t.J,t.se,!1);if(!m)return;let[f,b]=m,p=n.levels.length,c=l;for(let g=p-1;g>=0;g--){let y=n.levels[g],x=u[g],C=c;c+=x.size,g===p-1?Qu(e,t,y,f,b,C,x,s,o):em(e,t,y,f,b,C,s,o)}let h=n.levelLabels.filter(g=>!!g).join(" / ");h&&(e.fillStyle=r,e.font=`13px ${s}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(h,a.x+a.width/2,t.cssHeight-2))}function Qu(e,t,n,i,o,r,s,a,l){let{t:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),b=s.rotation===0?Ju(i,o,u.width,f):tm(i,o);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let g of b){let y=Go(t,g);y<u.x-1||y>u.x+u.width+1||(e.moveTo(y,r),e.lineTo(y,r+Li))}e.stroke(),e.font=`${yt}px ${a}`;let p=r+Li+3,c={x:u.x,width:u.width,y:r,height:9999},h=[];for(let g of b){let y=Go(t,g);if(y<u.x-1||y>u.x+u.width+1)continue;let x=la(n,g);if(!x)continue;let C=e.measureText(x).width,_=To(y,p,C,No,s.rotation);if(Ro(_,c)){if(s.rotation===0){if(h.some(v=>wo(v,_)))continue}else if(h.some(v=>_s(v,_)))continue;h.push(_),ca(e,x,y,p,s.rotation,"center")}}}function em(e,t,n,i,o,r,s,a){let{t:l}=t,u=Nt(n.runs,i,o);if(u.length===0)return;let m=ma(u,c=>Go(t,c),l.x,l.x+l.width);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let c of m)e.moveTo(c.nearClip,r+3),e.lineTo(c.farClip,r+3),e.moveTo(c.nearEdge,r),e.lineTo(c.nearEdge,r+3),e.moveTo(c.farEdge,r),e.lineTo(c.farEdge,r+3);e.stroke(),e.font=`${yt}px ${s}`;let f=r+3+4,b=[],p={x:l.x,width:l.width,y:r,height:9999};for(let c of m){let h=(c.nearClip+c.farClip)/2,g=c.run.label;if(!g)continue;let y=c.farClip-c.nearClip-4,x=Ze(e,g,y);if(!x)continue;let C=e.measureText(x).width,_=To(h,f,C,No,0);Ro(_,p)&&(b.some(v=>wo(v,_))||(b.push(_),ca(e,x,h,f,0,"center")))}}function tm(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n}function fa(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Dt:o,ge:r,fontFamily:s}=i,{t:a}=t,l=a.x;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${yt}px ${s}`;let u=ra(n),m=ua(n.numRows,t.ee,t.ae,!0);if(!m)return;let[f,b]=m,p=n.levels.length,c=l;for(let g=p-1;g>=0;g--){let y=n.levels[g],x=u[g],C=c;c-=x,g===p-1?nm(e,t,y,f,b,C,s,o):im(e,t,y,f,b,C,x,s,o)}let h=n.levelLabels.filter(g=>!!g).join(" / ");h&&(e.fillStyle=r,e.font=`13px ${s}`,e.save(),e.translate(14,a.y+a.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(h,0,0),e.restore())}function nm(e,t,n,i,o,r,s,a){let{t:l}=t,u=No+4,m=o-i+1,f=Math.max(1,Math.floor(l.height/u)),b=m<=f?1:Math.ceil(m/f);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let p=i;p<=o;p+=b){let c=ko(t,p);c<l.y-1||c>l.y+l.height+1||(e.moveTo(r-Li,c),e.lineTo(r,c))}e.stroke(),e.font=`${yt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let p=i;p<=o;p+=b){let c=ko(t,p);if(c<l.y-1||c>l.y+l.height+1)continue;let h=la(n,p);h&&e.fillText(h,r-Li-3,c)}}function im(e,t,n,i,o,r,s,a,l){let{t:u}=t,m=Nt(n.runs,i,o);if(m.length===0)return;let f=ma(m,p=>ko(t,p),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=l,e.fillStyle=l;let b=r-3;e.beginPath();for(let p of f)e.moveTo(b,p.nearClip),e.lineTo(b,p.farClip),e.moveTo(b,p.nearEdge),e.lineTo(r,p.nearEdge),e.moveTo(b,p.farEdge),e.lineTo(r,p.farEdge);e.stroke(),e.font=`${yt}px ${a}`,e.textAlign="right",e.textBaseline="middle";for(let p of f){let c=(p.nearClip+p.farClip)/2,h=p.run.label;if(!h)continue;let g=s-6,y=Ze(e,h,g);y&&e.fillText(y,b-3,c)}}function ca(e,t,n,i,o,r){if(o===0){e.textAlign=r==="end"?"right":"center",e.textBaseline="top",e.fillText(t,n,i);return}e.save(),e.translate(n,i),e.rotate(-o*Math.PI/180),e.textAlign="right",e.textBaseline="middle",e.fillText(t,-2,0),e.restore()}lo();function da(e,t,n){if(n)return n;if(!e.isDate)return ie;let i=t.length>1?t[1]-t[0]:0;return o=>le(o,i)}function Uo(e,t,n,i,o,r,s){let{ge:a,fontFamily:l}=r,{t:u}=t,m=o==="bottom"?u.y+u.height:u.y;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,Yn(e,u,i,m,o,f=>t.G(f,0).px,da(n,i,s)),e.font=`13px ${l}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,u.x+u.width/2,o==="bottom"?t.cssHeight-2:10)}function Oo(e,t,n,i,o,r,s){let{ge:a,fontFamily:l}=r,{t:u}=t,m=o==="left"?u.x:u.x+u.width;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,Vn(e,u,i,m,o,f=>t.G(0,f).py,da(n,i,s)),e.font=`13px ${l}`,e.save(),o==="left"?(e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2)):(e.translate(t.cssWidth-10,u.y+u.height/2),e.rotate(Math.PI/2)),e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,0,0),e.restore()}function Ti(e,t,n,i,o,r){Uo(e,t,n,i,"bottom",o,r)}function wi(e,t,n,i,o,r){Oo(e,t,n,i,"left",o,r)}function Ri(e,t,n,i,o,r,s,a,l,u=!1,m={}){let f=ae(e,o,s);if(!f)return;let{t:b}=o;if(f.strokeStyle=r.fi,f.lineWidth=1,f.beginPath(),f.moveTo(b.x,b.y),f.lineTo(b.x,b.y+b.height),f.lineTo(b.x+b.width,b.y+b.height),a&&(u?(f.moveTo(b.x,b.y),f.lineTo(b.x+b.width,b.y)):(f.moveTo(b.x+b.width,b.y),f.lineTo(b.x+b.width,b.y+b.height))),f.stroke(),u){if(t.mode==="category"?fa(f,o,t.domain,r):wi(f,o,t.domain,t.ticks,r,m.category),Uo(f,o,n,i,"bottom",r,m.value),a&&l){let p=o.J,c=o.se;o.J=a.min,o.se=a.max,Uo(f,o,a,l,"top",r,m.alt),o.J=p,o.se=c}}else if(t.mode==="category"?Zt(f,o,t.domain,r):Ti(f,o,t.domain,t.ticks,r,m.category),Oo(f,o,n,i,"left",r,m.value),a&&l){let p=o.ee,c=o.ae;o.ee=a.min,o.ae=a.max,Oo(f,o,a,l,"right",r,m.alt),o.ee=p,o.ae=c}}function Fi(e,t,n,i,o,r=!1){let s=ae(e,t,o);s&&(s.strokeStyle=i.Bn,s.lineWidth=1,r?zn(s,t.t,n,a=>t.G(a,0).px):Xn(s,t.t,n,a=>t.G(0,a).py))}var Oe=null;function pa(e){if(Oe&&Oe.xCenters.length>=e&&Oe.colors.length>=e*3)return Oe;let t=Math.max(e,Oe?.xCenters.length??0);return Oe={xCenters:new Float32Array(t),halfWidths:new Float32Array(t),y0s:new Float32Array(t),y1s:new Float32Array(t),seriesIds:new Float32Array(t),axes:new Float32Array(t),colors:new Float32Array(t*3)},Oe}function vi(e,t){let n=e.fe,i=n.count,o=0;if(i>0){let s=pa(i);(!e.pn||e.pn.length<i)&&(e.pn=new Int32Array(i));let a=e.pn,l=e.xe,u=e.b,m=e.Q,f=n.chartType,b=n.seriesId,p=n.xCenter,c=n.halfWidth,h=n.y0,g=n.y1,y=n.axis;for(let x=0;x<i;x++){if(f[x]!==Ks)continue;let C=b[x];if(m.has(C))continue;s.xCenters[o]=p[x]-l,s.halfWidths[o]=c[x],s.y0s[o]=h[x],s.y1s[o]=g[x],s.seriesIds[o]=C,s.axes[o]=y[x];let _=u[C].color;s.colors[o*3]=_[0],s.colors[o*3+1]=_[1],s.colors[o*3+2]=_[2],a[o]=x,o++}}if(e.cn=o,o===0){e.We=null;return}let r=Oe;t.C.ensureCapacity(o),t.C.upload("bar_x",r.xCenters.subarray(0,o),0,1),t.C.upload("bar_hw",r.halfWidths.subarray(0,o),0,1),t.C.upload("bar_y0",r.y0s.subarray(0,o),0,1),t.C.upload("bar_y1",r.y1s.subarray(0,o),0,1),t.C.upload("bar_sid",r.seriesIds.subarray(0,o),0,1),t.C.upload("bar_axis",r.axes.subarray(0,o),0,1),t.C.upload("bar_color",r.colors.subarray(0,o*3),0,3),(!e.We||e.We.length<o*3)&&(e.We=new Float32Array(Math.max(o*3,e.We?.length??0))),e.We.set(r.colors.subarray(0,o*3))}function om(e,t){let n=e.cn;if(n===0)return;let i=e.pn,o=e.b,r=e.fe.seriesId,s=pa(n);for(let l=0;l<n;l++){let u=o[r[i[l]]].color;s.colors[l*3]=u[0],s.colors[l*3+1]=u[1],s.colors[l*3+2]=u[2]}let a=e.We;if(a&&a.length>=n*3){let l=!0;for(let u=0;u<n*3;u++)if(a[u]!==s.colors[u]){l=!1;break}if(l)return}t.C.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!a||a.length<n*3)&&(e.We=new Float32Array(n*3)),e.We.set(s.colors.subarray(0,n*3))}function ba(e){e.N.lines.invalidateBuffers(e),e.N.scatter.invalidateBuffers(e),e.N.areas.invalidateBuffers(e)}function Ai(e,t){e.N.lines.rebuildBuffers(e,t),e.N.scatter.rebuildBuffers(e,t),e.N.areas.rebuildBuffers(e,t)}function Ue(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0||e.ie===0)return;let s=e.T();Ho(e)&&e.cn>0&&om(e,t);let a=e.ut,l=e.ft==="numeric",u=l?e.j.min:-.5,m=l?e.j.max:e.ie-.5,f=e.Bi.min,b=e.Bi.max;e.h&&(a?e.h.setBaseDomain(f,b,u,m):e.h.setBaseDomain(u,m,f,b));let p=u,c=m,h=f,g=b,y=e.oe?.min??0,x=e.oe?.max??1;if(e.h){let M=e.h.getVisibleDomain();a?(h=M.xMin,g=M.xMax,p=M.yMin,c=M.yMax):(p=M.xMin,c=M.xMax,h=M.yMin,g=M.yMax)}if(e.Wn&&e.h&&!e.h.isDefault()){let M=um(e,p,c);M.hasLeft&&(h=M.leftMin,g=M.leftMax),e.oe&&M.hasRight&&(y=M.rightMin,x=M.rightMax)}e.g.include_zero&&(h>0&&(h=0),g<0&&(g=0),e.oe&&(y>0&&(y=0),x<0&&(x=0)));let C=e.b.length>1,_=e.L.length>0,v={levels:e.Re,numRows:e.ie,levelLabels:e.L.slice()},A;if(a){let M=l?55:aa(v);A=new j(o,r,{hasXLabel:!0,hasYLabel:_,hasLegend:C,leftExtra:M})}else if(l)A=new j(o,r,{hasXLabel:_,hasYLabel:!0,hasLegend:C,bottomExtra:24});else{let k=C?80:16,N=Math.max(1,o-71-k),W=xt(v,N);A=new j(o,r,{hasXLabel:_,hasYLabel:!0,hasLegend:C,bottomExtra:W})}e.u=A,e.h&&e.h.updateLayout(A);let R=e.g.include_zero,L=a?A.buildProjectionMatrix(h,g,c,p,"x",R,void 0,0,e.xe):A.buildProjectionMatrix(p,c,h,g,"y",R,void 0,e.xe,0),w;if(e.dn&&e.oe&&!a){let M=A.J,k=A.se,N=A.ee,W=A.ae;w=A.buildProjectionMatrix(p,c,y,x,"y",R,void 0,e.xe,0),A.J=M,A.se=k,A.ee=N,A.ae=W}else w=L;let F=te(h,g,6),G=e.dn&&e.oe&&!a?te(y,x,6):null,D=v,B={min:h,max:g,label:e.uo},P=e.oe&&!a?{min:y,max:x,label:e.mo}:null;e.I&&Fi(e.I,A,F,s,t.dpr,a),Ee(n,A,t.dpr,()=>{a||e.N.areas.draw(e,n,t,L,w,s.di),n.useProgram(e.i);let M=e.B;n.uniformMatrix4fv(M.u_proj_left,!1,L),n.uniformMatrix4fv(M.u_proj_right,!1,w),n.uniform1f(M.u_horizontal,a?1:0);let k=e.b.length>1?_i(e):null;n.uniform1f(M.u_hover_series,k?k.seriesId:-1),Js(e,n,t),a||(e.N.lines.draw(e,n,t,L,w),e.N.scatter.draw(e,n,t,L,w))}),e.Le=D,e.Te=B,e.Be=F,e.fo=P,e.co=G,e.Ot=l?te(p,c,6):null,rm(e)}function rm(e){if(!e.d||!e.u||!e.Te||!e.Be)return;let t=e.T(),n;if(e.ft==="numeric"&&e.j&&e.Ot)n={mode:"numeric",domain:{min:e.j.min,max:e.j.max,isDate:e.j.isDate,label:e.j.label},ticks:e.Ot};else if(e.Le)n={mode:"category",domain:e.Le};else return;let i=e.b.find(s=>s.axis===0),o=e.b.find(s=>s.axis===1),r=e.L[0];Ri(e.d,n,e.Te,e.Be,e.u,t,e.e?.dpr??1,e.fo??void 0,e.co??void 0,e.ut,{value:e.getColumnFormatter(i?.aggName??null,"tick"),alt:e.getColumnFormatter(o?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),am(e),_i(e)&&lm(e)}var Mi=new Float64Array(0);function sm(e,t,n){if(e.Qn)return;let i=e.b;Mi.length<i.length&&(Mi=new Float64Array(i.length)),t.save(),t.font=`11px ${n}`;for(let o=0;o<i.length;o++)Mi[o]=t.measureText(i[o].label).width;t.restore(),e.Qn=!0}function am(e){if(e.Jn=[],!e.d||!e.u||e.b.length<=1)return;let t=e.d.getContext("2d");if(!t)return;t.save();let n=e.T(),i=n.ci,o=n.fontFamily;sm(e,t,o);let r=e.u,s=10,a=18,l=r.t.x+r.t.width+12,u=r.margins.top+10;t.font=`11px ${o}`,t.textAlign="left",t.textBaseline="middle";let m=e.b,f=Mi;for(let b=0;b<m.length;b++){let p=m[b],c=e.Q.has(p.seriesId),h=Math.round(p.color[0]*255),g=Math.round(p.color[1]*255),y=Math.round(p.color[2]*255);t.globalAlpha=c?.3:1,t.fillStyle=`rgb(${h},${g},${y})`,t.fillRect(l,u-s/2,s,s),t.fillStyle=i,t.fillText(p.label,l+s+6,u);let x=f[b];c&&(t.strokeStyle=i,t.lineWidth=1,t.beginPath(),t.moveTo(l+s+6,u),t.lineTo(l+s+6+x,u),t.stroke()),t.globalAlpha=1;let C={x:l-2,y:u-a/2,width:s+6+x+4,height:a};e.Jn.push({seriesId:p.seriesId,rect:C}),u+=a}t.restore()}function lm(e){if(!e.d||!e.u)return;let t=_i(e);if(!t)return;let n=e.u,o=(e.b[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.ut?n.G(o,t.xCenter):n.G(t.xCenter,o):Wo(e,t.xCenter,o),s=Po(e,t),a=e.T();_e(e.d,r,s,n,a,e.e?.dpr??1)}function Wo(e,t,n){let i=e.u,{x:o,y:r,width:s,height:a}=i.t,l=(t-i.J)/(i.se-i.J),u=e.oe,m=(n-u.min)/(u.max-u.min);return{px:o+l*s,py:r+(1-m)*a}}function um(e,t,n){let i=e.Lt;if(i&&i.catMin===t&&i.catMax===n&&i.hidden===e.Q)return i;let o=fm(e),r=1/0,s=-1/0,a=!1,l=1/0,u=-1/0,m=!1;if(o.n>0){let b=Math.max(0,Math.floor(t)),p=Math.min(o.n-1,Math.ceil(n)),c=o.leftMin,h=o.leftMax,g=o.rightMin,y=o.rightMax,x=o.hasLeft,C=o.hasRight;for(let _=b;_<=p;_++)x[_]&&(c[_]<r&&(r=c[_]),h[_]>s&&(s=h[_]),a=!0),C[_]&&(g[_]<l&&(l=g[_]),y[_]>u&&(u=y[_]),m=!0)}let f=i??mm();return f.catMin=t,f.catMax=n,f.hidden=e.Q,f.leftMin=r,f.leftMax=s,f.hasLeft=a,f.rightMin=l,f.rightMax=u,f.hasRight=m,e.Lt=f,f}function mm(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function fm(e){let t=e.ie,n=e.po,i=n&&n.leftMin.length>=t;if(n&&i&&e.ei===e.Q)return n;!n||!i?(n={leftMin:new Float64Array(t),leftMax:new Float64Array(t),rightMin:new Float64Array(t),rightMax:new Float64Array(t),hasLeft:new Uint8Array(t),hasRight:new Uint8Array(t),n:t},e.po=n):n.n=t;for(let h=0;h<t;h++)n.leftMin[h]=1/0,n.leftMax[h]=-1/0,n.rightMin[h]=1/0,n.rightMax[h]=-1/0,n.hasLeft[h]=0,n.hasRight[h]=0;let o=e.fe,r=e.Q,s=o.catIdx,a=o.seriesId,l=o.y0,u=o.y1,m=o.axis;for(let h=0;h<o.count;h++){if(r.has(a[h]))continue;let g=s[h];if(g<0||g>=t)continue;let y=l[h],x=u[h],C=y<x?y:x,_=y<x?x:y;m[h]===1?(C<n.rightMin[g]&&(n.rightMin[g]=C),_>n.rightMax[g]&&(n.rightMax[g]=_),n.hasRight[g]=1):(C<n.leftMin[g]&&(n.leftMin[g]=C),_>n.leftMax[g]&&(n.leftMax[g]=_),n.hasLeft[g]=1)}let f=[e.bn,e.hn],b=e.He,p=e.Ut,c=e.b.length;for(let h of f)for(let g of h){if(r.has(g.seriesId))continue;let y=g.axis===1,x=g.seriesId;for(let C=0;C<t;C++){let _=C*c+x;if(!(p[_>>3]>>(_&7)&1))continue;let v=b[_];y?(v<n.rightMin[C]&&(n.rightMin[C]=v),v>n.rightMax[C]&&(n.rightMax[C]=v),n.hasRight[C]=1):(v<n.leftMin[C]&&(n.leftMin[C]=v),v>n.leftMax[C]&&(n.leftMax[C]=v),n.hasLeft[C]=1)}}return e.ei=r,n}Bt();we();function ue(e,t,n,i,o,r){let s=e.shaders.getOrCreate(t,n,i),a=e.gl,l={program:s};for(let u of o)l[u]=a.getUniformLocation(s,u);for(let u of r)l[u]=a.getAttribLocation(s,u);return l}var qt=new Float32Array(0);function cm(e){return qt.length>=e||(qt=new Float32Array(Math.max(e,qt.length*2))),qt}var Si=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=Ge(t.gl),i=ue(t,"bar-line",Se,Be,["u_projection","u_color","u_resolution","u_line_width"],["a_start","a_end","a_corner"]);return this.i={...i,cornerBuffer:n},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.e){this.o=null;return}let i=t.e.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer);this.o=null}rebuildBuffers(t,n){let i=t.bn;if(i.length===0){this.o=null;return}let o=t.ie;if(o===0){this.o=null;return}this.ensureProgram(n);let r=n.gl,s=t.He,a=t.Ut,l=t.xe,u=t.mt,m=t.b.length,f=[];for(let b of i){let p=cm(o*2),c=[],h=0,g=0;for(let x=0;x<o;x++){let C=x*m+b.seriesId;if(a[C>>3]>>(C&7)&1){let v=u?u[x]-l:x;p[h++]=v,p[h++]=s[C]}else if(h>g){let v=(h-g)/2;v>=2&&c.push({offsetBytes:g*4,count:v}),g=h}}if(h>g){let x=(h-g)/2;x>=2&&c.push({offsetBytes:g*4,count:x})}if(c.length===0)continue;let y=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,y),r.bufferData(r.ARRAY_BUFFER,p.subarray(0,h),r.STATIC_DRAW),f.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:y,runs:c})}this.o={series:f}}draw(t,n,i,o,r){let s=this.o,a=this.i;if(!s||!a||s.series.length===0)return;let l=i.dpr;n.useProgram(a.program),n.uniform2f(a.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(a.u_line_width,t.g.line_width_px*l);let u=K(i),{setDivisor:m,drawArraysInstanced:f}=u;n.bindBuffer(n.ARRAY_BUFFER,a.cornerBuffer),n.enableVertexAttribArray(a.a_corner),n.vertexAttribPointer(a.a_corner,1,n.FLOAT,!1,0,0),m(a.a_corner,0);let b=2*Float32Array.BYTES_PER_ELEMENT,p=t.Q;for(let c of s.series){if(p.has(c.seriesId))continue;n.bindBuffer(n.ARRAY_BUFFER,c.gpuBuffer),n.uniformMatrix4fv(a.u_projection,!1,c.axis===1?r:o);let h=t.b[c.seriesId].color;n.uniform4f(a.u_color,h[0],h[1],h[2],1),n.enableVertexAttribArray(a.a_start),m(a.a_start,1),n.enableVertexAttribArray(a.a_end),m(a.a_end,1);for(let g of c.runs)n.vertexAttribPointer(a.a_start,2,n.FLOAT,!1,b,g.offsetBytes),n.vertexAttribPointer(a.a_end,2,n.FLOAT,!1,b,g.offsetBytes+b),f(n.TRIANGLE_STRIP,0,4,g.count-1)}m(a.a_start,0),m(a.a_end,0)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&n.deleteBuffer(i.cornerBuffer)}this.i=null,this.o=null}};var Re=new Float32Array(0),me=new Float32Array(0);function dm(e){Re.length<e*2&&(Re=new Float32Array(Math.max(e*2,Re.length*2))),me.length<e*3&&(me=new Float32Array(Math.max(e*3,me.length*2)))}var Bi=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=ue(t,"bar-scatter",bn,hn,["u_projection","u_point_size"],["a_position","a_color"]);return this.i={...i,posLeftBuffer:n.createBuffer(),posRightBuffer:n.createBuffer(),colorLeftBuffer:n.createBuffer(),colorRightBuffer:n.createBuffer()},this.i}invalidateBuffers(t){this.o=null}rebuildBuffers(t,n){let i=t.hn;if(i.length===0){this.o=null;return}let o=t.ie,r=t.b.length;if(o===0||r===0){this.o=null;return}let s=this.ensureProgram(n),a=n.gl,l=t.He,u=t.Ut,m=t.mt,f=t.xe,b=t.Q,p=0,c=0;for(let x of i)if(!b.has(x.seriesId))for(let C=0;C<o;C++){let _=C*r+x.seriesId;u[_>>3]>>(_&7)&1&&(x.axis===1?c++:p++)}let h=p+c;if(h===0){this.o=null;return}dm(h);let g=0,y=p;for(let x of i){if(b.has(x.seriesId))continue;let C=x.color[0],_=x.color[1],v=x.color[2];for(let A=0;A<o;A++){let R=A*r+x.seriesId;if(!(u[R>>3]>>(R&7)&1))continue;let L=m?m[A]-f:A,w=l[R];x.axis===1?(Re[y*2]=L,Re[y*2+1]=w,me[y*3]=C,me[y*3+1]=_,me[y*3+2]=v,y++):(Re[g*2]=L,Re[g*2+1]=w,me[g*3]=C,me[g*3+1]=_,me[g*3+2]=v,g++)}}p>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Re.subarray(0,p*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorLeftBuffer),a.bufferData(a.ARRAY_BUFFER,me.subarray(0,p*3),a.STATIC_DRAW)),c>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posRightBuffer),a.bufferData(a.ARRAY_BUFFER,Re.subarray(p*2,h*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorRightBuffer),a.bufferData(a.ARRAY_BUFFER,me.subarray(p*3,h*3),a.STATIC_DRAW)),this.o={leftCount:p,rightCount:c}}draw(t,n,i,o,r){let s=this.o,a=this.i;if(!s||!a||s.leftCount===0&&s.rightCount===0)return;let l=i.dpr;n.useProgram(a.program),n.uniform1f(a.u_point_size,t.g.point_size_px*l),ha(n,a,a.posLeftBuffer,a.colorLeftBuffer,s.leftCount,o),ha(n,a,a.posRightBuffer,a.colorRightBuffer,s.rightCount,r)}destroy(t){let n=t.e?.gl;if(n){let i=this.i;i&&(n.deleteBuffer(i.posLeftBuffer),n.deleteBuffer(i.posRightBuffer),n.deleteBuffer(i.colorLeftBuffer),n.deleteBuffer(i.colorRightBuffer))}this.i=null,this.o=null}};function ha(e,t,n,i,o,r){o!==0&&(e.uniformMatrix4fv(t.u_projection,!1,r),e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(t.a_position),e.vertexAttribPointer(t.a_position,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(t.a_color),e.vertexAttribPointer(t.a_color,3,e.FLOAT,!1,0,0),e.drawArrays(e.POINTS,0,o))}var Kt=new Float32Array(0);function pm(e){return Kt.length>=e||(Kt=new Float32Array(Math.max(e,Kt.length*2))),Kt}var Di=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){return this.i?this.i:(this.i=ue(t,"bar-area",dn,pn,["u_projection","u_color","u_opacity"],["a_position"]),this.i)}invalidateBuffers(t){let n=this.o;if(!n||!t.e){this.o=null;return}let i=t.e.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer);this.o=null}rebuildBuffers(t,n){let i=t.ti;if(i.length===0){this.o=null;return}let o=t.ie,r=t.b.length;if(o===0||r===0){this.o=null;return}this.ensureProgram(n);let s=n.gl,a=t.He,l=t.Ut,u=t.mt,m=t.xe,f=t.Di,b=t.fe,p=[];for(let c of i){let h=bm(c,o,r,a,l,f,b.y0,b.y1,u,m);if(h.totalVertices===0)continue;let g=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,g),s.bufferData(s.ARRAY_BUFFER,h.scratch.subarray(0,h.totalVertices*2),s.STATIC_DRAW),p.push({seriesId:c.seriesId,axis:c.axis,color:[c.color[0],c.color[1],c.color[2]],gpuBuffer:g,strips:h.descriptors})}this.o={series:p}}draw(t,n,i,o,r,s){let a=this.o,l=this.i;if(!a||!l||a.series.length===0)return;n.useProgram(l.program),n.uniform1f(l.u_opacity,s);let u=t.Q;for(let m of a.series){if(u.has(m.seriesId))continue;n.uniformMatrix4fv(l.u_projection,!1,m.axis===1?r:o);let f=t.b[m.seriesId].color;n.uniform3f(l.u_color,f[0],f[1],f[2]),n.bindBuffer(n.ARRAY_BUFFER,m.gpuBuffer),n.enableVertexAttribArray(l.a_position),n.vertexAttribPointer(l.a_position,2,n.FLOAT,!1,0,0);for(let b of m.strips)n.bindBuffer(n.ARRAY_BUFFER,m.gpuBuffer),n.vertexAttribPointer(l.a_position,2,n.FLOAT,!1,0,b.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,b.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.i=null}};function bm(e,t,n,i,o,r,s,a,l,u){let m=pm(t*4),f=[],b=e.seriesId*1e9,p=0,c=0;for(let h=0;h<t;h++){let g=0,y=0,x=!1;if(e.stack){let C=r?.get(b+h);C!==void 0&&(g=s[C],y=a[C],x=!0)}else{let C=h*n+e.seriesId;o[C>>3]>>(C&7)&1&&(y=i[C],x=!0)}if(x){let C=l?l[h]-u:h;m[p++]=C,m[p++]=g,m[p++]=C,m[p++]=y}else if(p>c){let C=(p-c)/2;C>=4&&f.push({offsetBytes:c*4,vertexCount:C}),c=p}}if(p>c){let h=(p-c)/2;h>=4&&f.push({offsetBytes:c*4,vertexCount:h})}return{descriptors:f,totalVertices:p/2,scratch:m}}var He=class extends gt{constructor(n="vertical"){super();d(this,"ut");d(this,"B",null);d(this,"Ii",[]);d(this,"Oe",[]);d(this,"b",[]);d(this,"fe",xi());d(this,"Ei",[]);d(this,"bn",[]);d(this,"hn",[]);d(this,"ti",[]);d(this,"uo","");d(this,"mo","");d(this,"Di",null);d(this,"We",null);d(this,"ni",null);d(this,"ii",null);d(this,"Pi",null);d(this,"Wi",null);d(this,"Bi",{min:0,max:1});d(this,"oe",null);d(this,"dn",!1);d(this,"Jt",null);d(this,"Qt",null);d(this,"Ce",null);d(this,"ft","category");d(this,"j",null);d(this,"xe",0);d(this,"Ot",null);d(this,"mt",null);d(this,"Q",new Set);d(this,"Ee",-1);d(this,"Si",-1);d(this,"Pe",null);d(this,"He",new Float32Array(0));d(this,"Ut",new Uint8Array(0));d(this,"N",{lines:new Si,scatter:new Bi,areas:new Di});d(this,"fo",null);d(this,"co",null);d(this,"cn",0);d(this,"pn",new Int32Array(0));d(this,"Jn",[]);d(this,"Qn",!1);d(this,"Lt",null);d(this,"po",null);d(this,"ei",null);this.ut=n==="horizontal"}getZoomConfig(){return{lockAxis:this.ut?"x":"y"}}tooltipCallbacks(){return{onHover:(n,i)=>Eo(this,n,i),onLeave:()=>{(this.Ee!==-1||this.Pe)&&(this.Ee=-1,this.Pe=null,this.e&&Ue(this,this.e))},onClickPre:(n,i)=>ea(this,n,i),onPin:(n,i)=>{if(Eo(this,n,i),this.Ee>=0){let o=this.Ee;ta(this,o);let r=jt(this.fe,o,this.Oe.length,this.He,this.b.length);this.bo(r)}else if(this.Pe){let o=this.Pe;na(this,o),this.bo(o)}},onUnpin:()=>{this.emitUnselect()}}}async bo(n){if(!this.Ii[n.aggIdx])return;let i=this.Re.map(s=>s.labels[n.catIdx]??null),o=this.Oe[n.splitIdx]??"",r=this.w.length>0&&o!==""?o.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.lt,columnName:this.Ii[n.aggIdx],groupByValues:i,splitByValues:r})}async uploadAndRender(n,i,o,r){this.e=n;let s=n.gl;if(o!==0)return;if(!this.i){this.i=n.shaders.getOrCreate("bar",an,ln);let l=this.i;this.B={u_proj_left:s.getUniformLocation(l,"u_proj_left"),u_proj_right:s.getUniformLocation(l,"u_proj_right"),u_hover_series:s.getUniformLocation(l,"u_hover_series"),u_horizontal:s.getUniformLocation(l,"u_horizontal"),a_corner:s.getAttribLocation(l,"a_corner"),a_x_center:s.getAttribLocation(l,"a_x_center"),a_half_width:s.getAttribLocation(l,"a_half_width"),a_y0:s.getAttribLocation(l,"a_y0"),a_y1:s.getAttribLocation(l,"a_y1"),a_color:s.getAttribLocation(l,"a_color"),a_series_id:s.getAttribLocation(l,"a_series_id"),a_axis:s.getAttribLocation(l,"a_axis")},this.W=s.createBuffer(),s.bindBuffer(s.ARRAY_BUFFER,this.W),s.bufferData(s.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),s.STATIC_DRAW)}let a=qs({columns:i,numRows:r,columnSlots:this.E,groupBy:this.L,splitBy:this.w,groupByTypes:this.gt,columnsConfig:this.pi,defaultChartType:this.En,autoAltYAxis:this.g.auto_alt_y_axis,bandInnerFrac:this.g.band_inner_frac,barInnerPad:this.g.bar_inner_pad,includeZero:this.g.include_zero,scratchBars:this.fe,scratchPosStack:this.Pi,scratchNegStack:this.Wi});this.g.domain_mode==="expand"?(this.Jt&&(a.leftDomain.min=Math.min(this.Jt.min,a.leftDomain.min),a.leftDomain.max=Math.max(this.Jt.max,a.leftDomain.max)),this.Jt={...a.leftDomain},a.rightDomain&&(this.Qt&&(a.rightDomain.min=Math.min(this.Qt.min,a.rightDomain.min),a.rightDomain.max=Math.max(this.Qt.max,a.rightDomain.max)),this.Qt={...a.rightDomain}),a.numericCategoryDomain&&(this.Ce&&(a.numericCategoryDomain.min=Math.min(this.Ce.min,a.numericCategoryDomain.min),a.numericCategoryDomain.max=Math.max(this.Ce.max,a.numericCategoryDomain.max)),this.Ce={min:a.numericCategoryDomain.min,max:a.numericCategoryDomain.max})):(this.Jt=null,this.Qt=null,this.Ce=null),this.Ii=a.aggregates,this.Oe=a.splitPrefixes,this.Re=a.rowPaths,this.ie=a.numCategories,this.lt=a.rowOffset,this.ft=a.axisMode.mode,this.j=a.numericCategoryDomain,this.mt=a.categoryPositions,this.xe=a.numericCategoryDomain?.min??0,this.b=a.series,this.fe=a.bars,this.Pi=a.posStack,this.Wi=a.negStack,this.He=a.samples,this.Ei.length=0,this.bn.length=0,this.hn.length=0,this.ti.length=0;for(let l of a.series)switch(l.chartType){case"bar":this.Ei.push(l);break;case"line":this.bn.push(l);break;case"scatter":this.hn.push(l);break;case"area":this.ti.push(l);break}this.uo=ga(a.series,0),this.mo=ga(a.series,1),this.Di=hm(this.fe),this.Lt=null,this.Qn=!1,this.ni=null,this.ii=null,this.ei=null,this.We=null,this.Ut=a.sampleValid,this.Bi=a.leftDomain,this.oe=a.rightDomain,this.dn=a.hasRightAxis,Ho(this),vi(this,n),ba(this),Ai(this,n),await this.requestRender(n)}It(n){this.i&&(this.e=n,Ue(this,n))}resetExpandedDomain(){this.Jt=null,this.Qt=null,this.Ce=null}destroyInternal(){if(this.e){let n=this.e.gl;this.W&&n.deleteBuffer(this.W),ym(this)}this.i=null,this.B=null,this.W=null,this.fe=xi(),this.b=[],this.Ei=[],this.bn=[],this.hn=[],this.ti=[],this.Di=null,this.ni=null,this.ii=null,this.We=null,this.Pi=null,this.Wi=null,this.Re=[],this.ie=0,this.Q.clear()}};function hm(e){let t=new Map;for(let n=0;n<e.count;n++)e.chartType[n]===1&&t.set(e.seriesId[n]*1e9+e.catIdx[n],n);return t}function ga(e,t){let n=new Set,i=[];for(let o of e)o.axis===t&&(n.has(o.aggName)||(n.add(o.aggName),i.push(o.aggName)));return i.join(", ")}function Ho(e){let t=e.T(),n=t.Se,i=t.V,o=e.b.length,r=e.ii;if(e.ni&&r&&r.Se===n&&r.V===i&&r.seriesLength===o)return!1;let s=gm(n,i,o);e.ni=s,e.ii={Se:n,V:i,seriesLength:o};for(let a=0;a<e.b.length;a++)e.b[a].color=s[a];return!0}function gm(e,t,n){return re(e,t,n)}function ym(e){e.N.lines.destroy(e),e.N.scatter.destroy(e),e.N.areas.destroy(e)}var Ii=class extends He{constructor(){super("horizontal")}};Ft();Ae();function Yo(e){let{columns:t,numRows:n,groupBy:i,splitBy:o,groupByTypes:r}=e,s=ft(i,r),a={xLevels:[],yColumnNames:[],yLevels:[],numX:0,numY:0,rowOffset:0,cells:[],cells2D:[],colorMin:0,colorMax:1,xAxisMode:s,yAxisMode:{mode:"category"},xPositions:null,yPositions:null,xNumericDomain:null,yNumericDomain:null},l=i.map(w=>r[w]??"string"),{rowPaths:u,numCategories:m,rowOffset:f}=ct(t,n,i.length,l),b=null,p=null;if(s.mode==="numeric"&&m>0){let w=t.get("__ROW_PATH_0__"),F=je(w?.values,m,f,i[0]??"",s.numericType==="date"||s.numericType==="datetime");F&&(b=F.categoryPositions,p=F.numericCategoryDomain)}let c=[];for(let w of t.keys())w.startsWith("__")||!t.get(w)?.values||c.push(w);let h=c.length;if(m===0||h===0)return{...a,xLevels:u,rowOffset:f};let g=_m(c),y=xm(o,r),x={mode:"category"},C=null,_=null;if(y.mode==="numeric"){let w=Cm(c,y.numericType);if(w){let F=je(w,h,0,o[0]??"",y.numericType==="date"||y.numericType==="datetime");F&&(x=y,C=F.categoryPositions,_=F.numericCategoryDomain)}}let v=[],A=new Array(m*h).fill(null),R=1/0,L=-1/0;for(let w=0;w<h;w++){let F=t.get(c[w]),G=F.values,D=F.valid;for(let B=0;B<m;B++){let P=B+f;if(D&&!(D[P>>3]>>(P&7)&1))continue;let M=G[P];if(!isFinite(M))continue;let k={xIdx:B,yIdx:w,value:M};v.push(k),A[w*m+B]=k,M<R&&(R=M),M>L&&(L=M)}}return!isFinite(R)||!isFinite(L)?(R=0,L=1):R===L&&(L=R+1),{xLevels:u,yColumnNames:c,yLevels:g,numX:m,numY:h,rowOffset:f,cells:v,cells2D:A,colorMin:R,colorMax:L,xAxisMode:s,yAxisMode:x,xPositions:b,yPositions:C,xNumericDomain:p,yNumericDomain:_}}function xm(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function Cm(e,t){let n=new Float64Array(e.length);for(let i=0;i<e.length;i++){let o=e[i],r=o.indexOf("|"),s=r===-1?o:o.slice(0,r),a;if(t==="date"||t==="datetime"?(a=Date.parse(s),isFinite(a)||(a=Date.parse(s.replace(" ","T")))):a=Number(s),!isFinite(a))return null;n[i]=a}return n}function ya(e,t){return t.map(n=>{let i=new Map;for(let[o,r]of e){if(o.startsWith("__ROW_PATH_")||o==="__GROUPING_ID__"){i.set(o,r);continue}let s=o.lastIndexOf("|");(s===-1?o:o.slice(s+1))===n&&i.set(o,r)}return{label:n,columns:i}})}function _m(e){if(e.length===0)return[];let t=0,n=e.map(o=>o.split("|"));for(let o of n)o.length>t&&(t=o.length);if(t===0)return[];let i=[];for(let o=0;o<t;o++){let r=[],s=new Map,a=new Int32Array(e.length),l=new Array(e.length),u=0;for(let b=0;b<e.length;b++){let p=n[b][o]??"",c=s.get(p);c===void 0&&(c=r.length,r.push(p),s.set(p,c)),a[b]=c,l[b]=p,p.length>u&&(u=p.length)}let f=o===t-1?[]:ti(a,r,0,e.length);i.push({labels:l,runs:f,maxLabelChars:u})}return i}Ae();ao();Et();we();nt();St();function zo(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var vm=80,Am=20,Vo=5,Xo=11;function Ct(e,t){return e.G(0,t).py}function xa(e,t){let n=zo(e.levels,t),i=n.length,o=[];for(let r=0;r<i;r++){let s=n[r].maxLabelChars;if(r===i-1){let a=Math.max(vm,s*6.5+16);o.push({size:a})}else{let a=Math.max(Am,s*6.5+16);o.push({size:a})}}return o}function Ca(e,t){let n=zo(e.levels,t);if(e.numRows===0||n.length===0)return 55;let i=xa(e,t),o=0;for(let r of i)o+=r.size;return o}function Lm(e,t){return e.labels[t]??""}function $o(e,t,n,i,o){let r=zo(n.levels,o);if(n.numRows===0||r.length===0)return;let{Dt:s,ge:a,fontFamily:l}=i,{t:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${Xo}px ${l}`;let m=xa(n,o),f=Math.max(0,Math.ceil(t.ee)),b=Math.min(n.numRows-1,Math.floor(t.ae));if(b<f)return;let p=r.length,c=u.x;for(let g=p-1;g>=0;g--){let y=r[g],x=m[g],C=c,_=c-x.size;c=_,g===p-1?Tm(e,t,y,f,b,C,_,l,s):wm(e,t,y,f,b,_,C,l,s)}let h=n.levelLabels.filter(g=>!!g).join(" / ");h&&(e.fillStyle=a,e.font=`13px ${l}`,e.save(),e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="top",e.fillText(h,0,0),e.restore())}function Tm(e,t,n,i,o,r,s,a,l){let u=t.t;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let f=i;f<=o;f++){let b=Ct(t,f);b<u.y-1||b>u.y+u.height+1||(e.moveTo(r,b),e.lineTo(r-Vo,b))}e.stroke(),e.font=`${Xo}px ${a}`,e.textAlign="right",e.textBaseline="middle";let m=r-Vo-4-s-4;for(let f=i;f<=o;f++){let b=Ct(t,f);if(b<u.y-1||b>u.y+u.height+1)continue;let p=Lm(n,f);if(!p)continue;let c=Ze(e,p,m);c&&e.fillText(c,r-Vo-4,b)}}function wm(e,t,n,i,o,r,s,a,l){let u=t.t,m=Nt(n.runs,i,o);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l;let f=s-3;e.beginPath();for(let b of m){let p=Ct(t,b.endIdx+.5),c=Ct(t,b.startIdx-.5),h=Math.min(p,c),g=Math.max(p,c),y=Math.max(u.y,h),x=Math.min(u.y+u.height,g);x<=y||(e.moveTo(f,y),e.lineTo(f,x),e.moveTo(f,y),e.lineTo(f+3,y),e.moveTo(f,x),e.lineTo(f+3,x))}e.stroke(),e.font=`${Xo}px ${a}`;for(let b of m){let p=Ct(t,b.endIdx+.5),c=Ct(t,b.startIdx-.5),h=Math.min(p,c),g=Math.max(p,c),y=Math.max(u.y,h),x=Math.min(u.y+u.height,g);if(x<=y)continue;let C=(y+x)/2,_=r+(s-r-3)/2,v=b.label;if(!v)continue;let A=x-y-4,R=Ze(e,v,Math.max(0,A));R&&(e.save(),e.translate(_,C),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(R,0,0),e.restore())}}pe();rt();ve();tt();et();function Zo(e,t,n){if(e.ho=t,e.go=n,e.m.length>0){for(let o=0;o<e.m.length;o++){let r=e.m[o],s=r.layout.t;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let a=va(r.layout,r.pipeline.numX,r.pipeline.numY,r.pipeline.cells2D,r.pipeline.xPositions,r.pipeline.yPositions,r.pipeline.xNumericDomain?.bandWidth??1,r.pipeline.yNumericDomain?.bandWidth??1,t,n);jo(e,a,o);return}jo(e,null,-1);return}if(!e.u)return;let i=va(e.u,e.Tt,e.wt,e.oi,e.gn,e.yn,e.ct?.bandWidth??1,e.dt?.bandWidth??1,t,n);jo(e,i,-1)}function _a(e,t,n){if(e.length===0)return-1;let i=0,o=e.length-1;for(;i<o;){let s=i+o>>1;e[s]<t?i=s+1:o=s}let r=i;return r>0&&Math.abs(e[r-1]-t)<Math.abs(e[r]-t)&&(r-=1),Math.abs(e[r]-t)>n*.5?-1:r}function va(e,t,n,i,o,r,s,a,l,u){let m=e.t;if(l<m.x||l>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.J,b=e.se,p=e.ee,c=e.ae,h=f+(l-m.x)/m.width*(b-f),g=c-(u-m.y)/m.height*(c-p),y=o?_a(o,h,s):Math.round(h),x=r?_a(r,g,a):Math.round(g);return y<0||y>=t||x<0||x>=n?null:i[x*t+y]??null}function jo(e,t,n){let i=e.Fe;(i?.xIdx??-1)===(t?.xIdx??-1)&&(i?.yIdx??-1)===(t?.yIdx??-1)&&e.xn===n||(e.Fe=t,e.xn=n,e.e&&e.Gi&&e.Gi())}function Aa(e,t){let n=[];for(let i of e){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function qo(e){if(!e.d||!e.Fe)return;let t,n,i,o=null;if(e.xn>=0){let b=e.m[e.xn];if(!b)return;t=b.layout,n=b.pipeline.xLevels,i=b.pipeline.yLevels,o=b.label}else{if(!e.u)return;t=e.u,n=e.Ht,i=e.Yt}let r=e.Fe,s={px:e.ho,py:e.go},a=[];o&&a.push(o);let l=Aa(n,r.xIdx),u=Aa(i,r.yIdx);l&&a.push(l),u&&a.push(u);let m=e.getColumnFormatter(e.E[0],"value");a.push(`Value: ${m(r.value)}`);let f=e.T();_e(e.d,s,a,t,f,e.e?.dpr??1)}var Ko={skipLeafLevel:!0};function La(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0)return;if(e.m.length>0){Rm(e,t,o,r);return}if(e.Tt===0||e.wt===0)return;let s=e.T(),a={levels:e.Ht,numRows:e.Tt,levelLabels:e.L.slice()},l={levels:e.Yt,numRows:e.wt,levelLabels:[]},u=e.Cn.mode==="numeric",m=e._n.mode==="numeric",f=m?55:Ca(l,Ko),b=u?24:xt(a,Math.max(1,o-f-110)),p=new j(o,r,{hasXLabel:e.L.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:b,leftExtra:f});e.u=p,e.h&&e.h.updateLayout(p);let c=u?e.ct.min:-.5,h=u?e.ct.max:e.Tt-.5,g=m?e.dt.min:-.5,y=m?e.dt.max:e.wt-.5;e.h&&e.h.setBaseDomain(c,h,g,y);let x=e.h?e.h.getVisibleDomain():{xMin:c,xMax:h,yMin:g,yMax:y},C=p.buildProjectionMatrix(x.xMin,x.xMax,x.yMin,x.yMax,void 0,void 0,0,e.M,e.S),_=p.t,v=_.width/(x.xMax-x.xMin),A=_.height/(x.yMax-x.yMin),R=s.Ji*.5,L=u?e.ct.bandWidth:1,w=m?e.dt.bandWidth:1,F=Math.min(L*.5,v>0?R/v:0),G=Math.min(w*.5,A>0?R/A:0);if(e.I){let D=ae(e.I,p,t.dpr)}Ta(e,t),wa(e,t),e.te=Pt(t,e.te,s.V),Ee(n,p,t.dpr,()=>{n.useProgram(e.i);let D=e.B;n.uniformMatrix4fv(D.u_projection,!1,C),n.uniform2f(D.u_cell_inset,F,G),n.uniform2f(D.u_cell_size,L,w),Le(t,e.te.texture,D.u_gradient_lut,0),Ra(e,n,t,0,e.yo)}),Ei(e)}function Ta(e,t){if(e.i)return;let n=t.gl,i=t.shaders.getOrCreate("heatmap",xn,Cn);e.i=i,e.B={u_projection:n.getUniformLocation(i,"u_projection"),u_cell_inset:n.getUniformLocation(i,"u_cell_inset"),u_cell_size:n.getUniformLocation(i,"u_cell_size"),u_gradient_lut:n.getUniformLocation(i,"u_gradient_lut"),a_corner:n.getAttribLocation(i,"a_corner"),a_cell:n.getAttribLocation(i,"a_cell"),a_color_t:n.getAttribLocation(i,"a_color_t")};let o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),e.W=o}function wa(e,t){let n=e.Qe.length;if(e.yo=n,n===0)return;let i=new Float32Array(n*2),o=new Float32Array(n);if(e.m.length>0){let r=0;for(let s of e.m){let a=s.pipeline.xPositions,l=s.pipeline.yPositions,u=s.xOrigin,m=s.yOrigin;for(let f of s.pipeline.cells)i[r*2]=a?a[f.xIdx]-u:f.xIdx,i[r*2+1]=l?l[f.yIdx]-m:f.yIdx,o[r]=Xe(f.value,e.f,e.l),r++}}else{let r=e.gn,s=e.yn,a=e.M,l=e.S;for(let u=0;u<n;u++){let m=e.Qe[u];i[u*2]=r?r[m.xIdx]-a:m.xIdx,i[u*2+1]=s?s[m.yIdx]-l:m.yIdx,o[u]=Xe(m.value,e.f,e.l)}}t.C.ensureCapacity(n),t.C.upload("heatmap_cell",i,0,2),t.C.upload("heatmap_t",o,0,1)}function Ra(e,t,n,i,o){if(o===0)return;let r=e.B,s=K(n),{setDivisor:a}=s,l=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.W),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),a(r.a_corner,0);let u=n.C.peek("heatmap_cell"),m=n.C.peek("heatmap_t");!u||!m||(t.bindBuffer(t.ARRAY_BUFFER,u.buffer),t.enableVertexAttribArray(r.a_cell),t.vertexAttribPointer(r.a_cell,2,t.FLOAT,!1,0,i*2*l),a(r.a_cell,1),t.bindBuffer(t.ARRAY_BUFFER,m.buffer),t.enableVertexAttribArray(r.a_color_t),t.vertexAttribPointer(r.a_color_t,1,t.FLOAT,!1,0,i*l),a(r.a_color_t,1),s.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,o),a(r.a_cell,0),a(r.a_color_t,0))}function Ei(e){if(!e.d)return;if(e.m.length>0){Fm(e);return}if(!e.u)return;let t=e.u,n=e.T(),i=e.e?.dpr??1,o=ae(e.d,t,i);if(!o)return;o.strokeStyle=n.Bn,o.lineWidth=1,o.beginPath(),o.moveTo(t.t.x,t.t.y),o.lineTo(t.t.x,t.t.y+t.t.height),o.lineTo(t.t.x+t.t.width,t.t.y+t.t.height),o.stroke();let r={levels:e.Ht,numRows:e.Tt,levelLabels:e.L.slice()},s={levels:e.Yt,numRows:e.wt,levelLabels:[]},a=e.L[0],l=e.L[1]??e.w[0];if(e.Cn.mode==="numeric"&&e.ct){let u=te(t.J,t.se,6);Ti(o,t,e.ct,u,n,e.getColumnFormatter(a,"tick"))}else Zt(o,t,r,n);if(e._n.mode==="numeric"&&e.dt){let u=te(t.ee,t.ae,6);wi(o,t,e.dt,u,n,e.getColumnFormatter(l,"tick"))}else $o(o,t,s,n,Ko);Te(e.d,t,{min:e.f,max:e.l,label:e.ki},n.V,n,e.getColumnFormatter(e.E[0],"value")),e.Fe&&qo(e)}function Rm(e,t,n,i){let o=t.gl,r=e.T(),{effectiveSharedX:s,effectiveSharedY:a}=e.computeEffectiveFacetFlags(),l=Ie(e.m.map(m=>m.label),{cssWidth:n,cssHeight:i,xAxis:s?"outer":"cell",yAxis:a?"outer":"cell",hasLegend:!0,hasXLabel:e.L.length>0,hasYLabel:!1,gap:8});e.A=l;for(let m=0;m<e.m.length;m++){let f=l.cells[m];f&&(e.m[m].layout=f.layout)}e.syncFacetZoomLayouts(l.cells),Ta(e,t),wa(e,t),e.te=Pt(t,e.te,r.V),o.useProgram(e.i);let u=e.B;Le(t,e.te.texture,u.u_gradient_lut,0),Dt(o);for(let m=0;m<e.m.length;m++){let f=e.m[m];if(f.instanceCount===0)continue;let{numX:b,numY:p}=f.pipeline;if(b===0||p===0)continue;let c=f.layout,h=f.pipeline.xAxisMode.mode==="numeric",g=f.pipeline.yAxisMode.mode==="numeric",y=h?f.pipeline.xNumericDomain.min:-.5,x=h?f.pipeline.xNumericDomain.max:b-.5,C=g?f.pipeline.yNumericDomain.min:-.5,_=g?f.pipeline.yNumericDomain.max:p-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(y,x,C,_);let A=v?v.getVisibleDomain():{xMin:y,xMax:x,yMin:C,yMax:_},R=c.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),L=c.t,w=L.width/(A.xMax-A.xMin),F=L.height/(A.yMax-A.yMin),G=r.Ji*.5,D=h?f.pipeline.xNumericDomain.bandWidth:1,B=g?f.pipeline.yNumericDomain.bandWidth:1,P=Math.min(D*.5,w>0?G/w:0),M=Math.min(B*.5,F>0?G/F:0);It(o,c,t.dpr,()=>{o.uniformMatrix4fv(u.u_projection,!1,R),o.uniform2f(u.u_cell_inset,P,M),o.uniform2f(u.u_cell_size,D,B),Ra(e,o,t,f.instanceStart,f.instanceCount)})}Ei(e)}function Fm(e){if(!e.d||!e.A)return;let t=e.T(),n=e.e?.dpr??1,i=ae(e.d,e.m[0].layout,n);if(!i)return;let o=e.Dn,r=e.In,s=e.A;for(let a=0;a<e.m.length;a++){let l=e.m[a],u=s.cells[a],m=l.layout,f=m.t;i.strokeStyle=t.Bn,i.lineWidth=1,i.beginPath(),i.moveTo(f.x,f.y),i.lineTo(f.x,f.y+f.height),i.lineTo(f.x+f.width,f.y+f.height),i.stroke();let b={levels:l.pipeline.xLevels,numRows:l.pipeline.numX,levelLabels:e.L.slice()},p={levels:l.pipeline.yLevels,numRows:l.pipeline.numY,levelLabels:[]},c=e.L[0],h=e.L[1]??e.w[0];if(!o||u.isBottomEdge)if(l.pipeline.xAxisMode.mode==="numeric"&&l.pipeline.xNumericDomain){let g=te(m.J,m.se,6);Ti(i,m,l.pipeline.xNumericDomain,g,t,e.getColumnFormatter(c,"tick"))}else Zt(i,m,b,t);if(!r||u.isLeftEdge)if(l.pipeline.yAxisMode.mode==="numeric"&&l.pipeline.yNumericDomain){let g=te(m.ee,m.ae,6);wi(i,m,l.pipeline.yNumericDomain,g,t,e.getColumnFormatter(h,"tick"))}else $o(i,m,p,t,Ko)}for(let a=0;a<s.cells.length;a++){let l=s.cells[a],u=e.m[a];!u||!l.titleRect||Hn(e.d,u.label,l.titleRect,t,n)}s.legendRect&&Wt(e.d,{x:s.legendRect.x,y:s.legendRect.y+20,width:s.legendRect.width,height:Math.max(1,s.legendRect.height-20)},{min:e.f,max:e.l,label:""},t.V,t,e.getColumnFormatter(e.E[0],"value")),e.Fe&&qo(e)}var Pi=class extends he{constructor(){super(...arguments);d(this,"i",null);d(this,"B",null);d(this,"W",null);d(this,"te",null);d(this,"Ht",[]);d(this,"Yt",[]);d(this,"Ni",[]);d(this,"Tt",0);d(this,"wt",0);d(this,"lt",0);d(this,"Cn",{mode:"category"});d(this,"_n",{mode:"category"});d(this,"gn",null);d(this,"yn",null);d(this,"ct",null);d(this,"dt",null);d(this,"M",0);d(this,"S",0);d(this,"Qe",[]);d(this,"oi",[]);d(this,"yo",0);d(this,"f",0);d(this,"l",1);d(this,"ki","");d(this,"Fe",null);d(this,"u",null);d(this,"ho",0);d(this,"go",0);d(this,"m",[]);d(this,"A",null);d(this,"xn",-1);d(this,"Gi",()=>Ei(this))}tooltipCallbacks(){return{onHover:(n,i)=>Zo(this,n,i),onLeave:()=>{this.Fe&&(this.Fe=null,this.Gi())},onPin:(n,i)=>{Zo(this,n,i),this.Fe&&this.So(this.Fe.xIdx,this.Fe.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async So(n,i){let o=this.Ht.map(a=>a.labels[n]??null),r=this.Yt.slice(0,this.w.length).map(a=>a.labels[i]??null),s=this.E[0]??"";await this.emitClickAndSelect({rowIdx:n+this.lt,columnName:s,groupByValues:o,splitByValues:r})}async uploadAndRender(n,i,o,r){if(this.e=n,o!==0)return;let s=this.E.filter(a=>!!a);if(s.length>1){let a=ya(i,s),l=[],u=[],m=1/0,f=-1/0;for(let b of a){let p=Yo({columns:b.columns,numRows:r,groupBy:this.L,splitBy:this.w,groupByTypes:this.gt}),c=u.length;for(let h of p.cells)u.push({xIdx:h.xIdx,yIdx:h.yIdx,value:h.value});l.push({label:b.label,pipeline:p,layout:new j(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:c,instanceCount:p.cells.length,xOrigin:p.xNumericDomain?.min??0,yOrigin:p.yNumericDomain?.min??0}),isFinite(p.colorMin)&&p.colorMin<m&&(m=p.colorMin),isFinite(p.colorMax)&&p.colorMax>f&&(f=p.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.Ht=[],this.Yt=[],this.Ni=[],this.Tt=0,this.wt=0,this.lt=0,this.oi=[],this.u=null,this.Cn={mode:"category"},this._n={mode:"category"},this.gn=null,this.yn=null,this.ct=null,this.dt=null,this.M=0,this.S=0,this.m=l,this.Qe=u,this.f=m,this.l=f,this.ki=s.join(", ")}else{let a=Yo({columns:i,numRows:r,groupBy:this.L,splitBy:this.w,groupByTypes:this.gt});this.m=[],this.A=null,this.Ht=a.xLevels,this.Yt=a.yLevels,this.Ni=a.yColumnNames,this.Tt=a.numX,this.wt=a.numY,this.lt=a.rowOffset,this.Qe=a.cells,this.oi=a.cells2D,this.f=a.colorMin,this.l=a.colorMax,this.ki=s[0]??"Color",this.Cn=a.xAxisMode,this._n=a.yAxisMode,this.gn=a.xPositions,this.yn=a.yPositions,this.ct=a.xNumericDomain,this.dt=a.yNumericDomain,this.M=a.xNumericDomain?.min??0,this.S=a.yNumericDomain?.min??0}await this.requestRender(n)}It(n){this.e=n;let i=this.Tt>0&&this.wt>0,o=this.m.length>0;!i&&!o||La(this,n)}destroyInternal(){this.W&&this.e&&this.e.gl.deleteBuffer(this.W),this.i=null,this.B=null,this.W=null,this.Ht=[],this.Yt=[],this.Ni=[],this.Qe=[],this.oi=[],this.Fe=null,this.m=[],this.A=null,this.xn=-1,this.Cn={mode:"category"},this._n={mode:"category"},this.gn=null,this.yn=null,this.ct=null,this.dt=null}};Mt();function Jt(){return{count:0,catIdx:new Int32Array(0),splitIdx:new Int32Array(0),seriesId:new Int32Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),open:new Float64Array(0),close:new Float64Array(0),high:new Float64Array(0),low:new Float64Array(0),isUp:new Uint8Array(0)}}function Mm(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),splitIdx:new Int32Array(t),seriesId:new Int32Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),open:new Float64Array(t),close:new Float64Array(t),high:new Float64Array(t),low:new Float64Array(t),isUp:new Uint8Array(t)}}var Fa={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function Ma(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,bandInnerFrac:a,barInnerPad:l,scratchCandles:u}=e,m=ft(o,s),f=i[0]||"";if(!f)return{...Fa,candles:Jt()};let b=i[1]||"",p=i[2]||"",c=i[3]||"",h=[];if(r.length>0){let U=[f];b&&U.push(b),p&&U.push(p),c&&U.push(c);for(let O of De(t,[f],U))O.colNames.has(f)&&h.push(O.prefix);h.length===0&&h.push("")}else h.push("");let g=o.map(U=>s[U]??"string"),{rowPaths:y,numCategories:x,rowOffset:C}=ct(t,n,o.length,g);if(x===0)return{...Fa,axisMode:m,splitPrefixes:h,rowPaths:y,rowOffset:C,candles:Jt()};let _=h.length,v=[];for(let U=0;U<_;U++){let O=h[U];v.push({seriesId:U,splitIdx:U,splitKey:O,label:O===""?f:O})}let A=null,R=null,L=1;if(m.mode==="numeric"&&x>0){let U=t.get("__ROW_PATH_0__"),O=je(U?.values,x,C,o[0]??"",m.numericType==="date"||m.numericType==="datetime");O&&(A=O.categoryPositions,R=O.numericCategoryDomain,L=O.numericCategoryDomain.bandWidth)}let w=gi(_,a,l),F=w.slotWidth*L,G=w.halfWidth*L,D=(_-1)/2,B=[];for(let U=0;U<_;U++){let O=h[U],ne=Me=>O===""?Me:`${O}|${Me}`,fe=t.get(ne(f));if(!fe?.values){B.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let ce=b?t.get(ne(b)):null,de=p?t.get(ne(p)):null,ye=c?t.get(ne(c)):null;B.push({openCol:fe.values,closeCol:ce?.values??null,highCol:de?.values??null,lowCol:ye?.values??null,openValid:fe.valid??null,closeValid:ce?.valid??null,highValid:de?.valid??null,lowValid:ye?.valid??null})}let P=x*_,M=Mm(u??null,P),k=0,N=1/0,W=-1/0,J=x;for(let U=0;U<_;U++){let O=B[U],ne=O.openCol;if(!ne)continue;let fe=O.closeCol,ce=O.highCol,de=O.lowCol,ye=O.openValid,Me=O.closeValid,At=O.highValid,on=O.lowValid,H=(U-D)*F;for(let z=0;z<J;z++){let Q=z+C;if(ye&&!(ye[Q>>3]>>(Q&7)&1))continue;let ee=ne[Q];if(!isFinite(ee))continue;let Z;if(fe&&(!Me||(Me[Q>>3]>>(Q&7)&1)!==0)){let E=fe[Q];Z=isFinite(E)?E:ee}else{let E=z<J-1?z+1+C:Q;if(!ye||(ye[E>>3]>>(E&7)&1)!==0){let V=ne[E];Z=isFinite(V)?V:ee}else Z=ee}let oe;if(ce&&(!At||(At[Q>>3]>>(Q&7)&1)!==0)){let E=ce[Q];oe=isFinite(E)?E:ee>Z?ee:Z}else oe=ee>Z?ee:Z;let Ke;if(de&&(!on||(on[Q>>3]>>(Q&7)&1)!==0)){let E=de[Q];Ke=isFinite(E)?E:ee<Z?ee:Z}else Ke=ee<Z?ee:Z;let lr=(A?A[z]:z)+H,S=Z>=ee?1:0;M.catIdx[k]=z,M.splitIdx[k]=U,M.seriesId[k]=U,M.xCenter[k]=lr,M.halfWidth[k]=G,M.open[k]=ee,M.close[k]=Z,M.high[k]=oe,M.low[k]=Ke,M.isUp[k]=S,k++,Ke<N&&(N=Ke),oe>W&&(W=oe)}}if(M.count=k,!isFinite(N)||!isFinite(W))N=0,W=1;else if(N===W){let U=Math.max(Math.abs(N),1)*.05;N-=U,W+=U}return{splitPrefixes:h,rowPaths:y,numCategories:x,rowOffset:C,axisMode:m,numericCategoryDomain:R,categoryPositions:A,series:v,candles:M,yDomain:{min:N,max:W}}}Ae();ve();Et();et();pe();var Sm=3;function Sa(e,t,n){let i=0,o=t;for(;i<o;){let r=i+o>>>1;e[r]<n?i=r+1:o=r}return i}function Jo(e,t,n){if(e.Ui!==-1)return;let i=e.u;if(!i)return;let o=e.de;if(o.count===0){e.pe!==-1&&(e.pe=-1,Ye(e));return}let r=i.t,s=i.J,a=i.se,l=i.ee,u=i.ae;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e.pe!==-1&&(e.pe=-1,Ye(e));return}let m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),p=Sm/b,c=o.xCenter,h=o.halfWidth,g=o.open,y=o.close,x=o.high,C=o.low,_=o.count>0?h[0]:0,v=Math.max(_,p),A=Sa(c,o.count,m-v),R=Sa(c,o.count,m+v+1e-12),L=-1;for(let w=R-1;w>=A;w--){let F=c[w],G=h[w],D=m>=F-G&&m<=F+G,B=Math.abs(m-F)<=p;if(!D&&!B)continue;let P=g[w],M=y[w],k=P<M?P:M,N=P<M?M:P,W=D&&f>=k&&f<=N,J=f>=C[w]&&f<=x[w];if(W||J){L=w;break}}L!==e.pe&&(e.pe=L,Ye(e))}function Ba(e,t){e._.dismiss(),e.Ui=t;let n=e.de;if(t<0||t>=n.count||!e.u)return;let i=Qo(e,t);if(i.length===0)return;let o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.u.G(o,r),a=e.u.cssWidth,l=e.u.cssHeight;e._.pin(i,s,{cssWidth:a,cssHeight:l}),e.pe=-1,Ye(e)}function Qo(e,t){let n=[],i=e.de;if(t<0||t>=i.count)return n;let o=i.catIdx[t],r=i.splitIdx[t],s=i.open[t],a=i.close[t],l=i.high[t],u=i.low[t];if(e.ft==="numeric"&&e.j&&e.mt){let c=e.mt[o],h=e.L[0];n.push(e.getColumnFormatter(h,"value")(c))}else if(e.Re.length>0){let c=[];for(let h of e.Re){let g=h.labels[o]??"";g&&c.push(g)}c.length>0&&n.push(c.join(" \\u203A "))}else n.push(`Row ${o+e.lt}`);if(r>=0&&e.Oe.length>1){let c=e.Oe[r];c&&n.push(c)}let m=e.getColumnFormatter(e.E[0],"value"),f=e.getColumnFormatter(e.E[1],"value"),b=e.getColumnFormatter(e.E[2],"value"),p=e.getColumnFormatter(e.E[3],"value");return n.push(`Open: ${m(s)}`),n.push(`Close: ${f(a)}`),n.push(`High: ${b(l)}`),n.push(`Low: ${p(u)}`),n}function Da(e,t,n,i,o){let r=1/0,s=-1/0,a={cat:0,lo:0,hi:0,skip:!1};for(let u=0;u<e.length;u++)a.skip=!1,i(e[u],a),!a.skip&&(a.cat<t||a.cat>n||(a.lo<r&&(r=a.lo),a.hi>s&&(s=a.hi)));let l=isFinite(r)&&isFinite(s);if(l&&r===s){let u=Math.abs(r)||1;r-=u,s+=u}return o.min=r,o.max=s,o.hasFit=l,o}function er(e){let n=e.T().V;if(e.ri===n)return;let i=be(n,1),o=be(n,0);e.si=[i[0],i[1],i[2]],e.ai=[o[0],o[1],o[2]],e.ri=n}function Ia(e){e.N.bodyWick.invalidateBuffers(e),e.N.ohlc.invalidateBuffers(e)}function Ea(e,t){e.N.bodyWick.rebuildBuffers(e,t),e.N.ohlc.rebuildBuffers(e,t)}function Pa(e,t){let n=t.gl,i=t.dpr,o=n.canvas.width/i,r=n.canvas.height/i;if(o<=0||r<=0||e.ie===0)return;let s=e.T();er(e);let a=e.ft==="numeric",l=a?e.j.min:-.5,u=a?e.j.max:e.ie-.5;e.h&&e.h.setBaseDomain(l,u,e.vn.min,e.vn.max);let m=e.h?e.h.getVisibleDomain():{xMin:l,xMax:u,yMin:e.vn.min,yMax:e.vn.max};if(e.Wn&&e.h&&!e.h.isDefault()){let C=Dm(e,m.xMin,m.xMax);C.hasFit&&(m.yMin=C.min,m.yMax=C.max)}let f=e.L.length>0,b={levels:e.Re,numRows:e.ie,levelLabels:e.L.slice()},p;if(a)p=new j(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,o-71-16),A=xt(b,v);p=new j(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.u=p,e.h&&e.h.updateLayout(p);let c=p.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e.xe,0),h=te(m.yMin,m.yMax,6),g=e.E[0]||"",y=b,x={min:m.yMin,max:m.yMax,label:g};e.I&&Fi(e.I,p,h,s,t.dpr),Ee(n,p,t.dpr,()=>{e.En==="ohlc"?e.N.ohlc.draw(e,n,t,c):e.N.bodyWick.draw(e,n,t,c)}),e.Le=y,e.Te=x,e.Be=h,e.Ot=a?te(m.xMin,m.xMax,6):null,Ye(e)}function Ye(e){if(!e.d||!e.u||!e.Te||!e.Be)return;let t=e.T(),n;if(e.ft==="numeric"&&e.j&&e.Ot)n={mode:"numeric",domain:{min:e.j.min,max:e.j.max,isDate:e.j.isDate,label:e.j.label},ticks:e.Ot};else if(e.Le)n={mode:"category",domain:e.Le};else return;let i=e.E[0]??e.E[1]??e.E[2]??e.E[3],o=e.L[0];Ri(e.d,n,e.Te,e.Be,e.u,t,e.e?.dpr??1,void 0,void 0,!1,{value:e.getColumnFormatter(i,"tick"),category:e.getColumnFormatter(o,"tick")}),e.pe>=0&&e.pe<e.de.count&&Bm(e)}function Bm(e){if(!e.d||!e.u)return;let t=e.pe,n=e.de;if(t<0||t>=n.count)return;let i=e.u,o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=i.G(o,r),a=Qo(e,t),l=e.T();_e(e.d,s,a,i,l,e.e?.dpr??1,{crosshair:!1,highlightRadius:0})}function Dm(e,t,n){let i=e.Lt;if(i&&i.xMin===t&&i.xMax===n)return i;let o=i??Im();o.xMin=t,o.xMax=n;let r=e.de,s=1/0,a=-1/0,l=!1,u=r.xCenter,m=r.low,f=r.high;for(let b=0;b<r.count;b++){let p=u[b];p<t||p>n||(m[b]<s&&(s=m[b]),f[b]>a&&(a=f[b]),l=!0)}return o.min=l?s:0,o.max=l?a:1,o.hasFit=l,e.Lt=o,o}function Im(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}we();var Wi=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=fs(n),r={...ue(t,"candlestick-body",gn,yn,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:i,instanceBuffer:n.createBuffer()},s=Ge(n),l={...ue(t,"line-uniform",Se,Be,["u_projection","u_color","u_resolution","u_line_width"],["a_corner","a_start","a_end"]),cornerBuffer:s,segmentBuffer:n.createBuffer()};return this.i={body:r,wick:l},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.e){this.o=null;return}let i=t.e.gl;i.deleteBuffer(n.upWickBuffer),i.deleteBuffer(n.downWickBuffer),this.o=null}rebuildBuffers(t,n){let i=t.de,o=this.ensureProgram(n),r=n.gl,s=t.xe;if(i.count===0){let F=r.createBuffer(),G=r.createBuffer();this.o={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:F,downWickBuffer:G};return}let a=new Float32Array(i.count*7),l=0,u=0,m=i.xCenter,f=i.halfWidth,b=i.open,p=i.close,c=i.isUp,h=t.si,g=t.ai;for(let F=0;F<i.count;F++){let G=b[F],D=p[F],B=G<D?G:D,P=G<D?D:G,M=c[F]!==0,k=M?h:g,N=F*7;a[N+0]=m[F]-s,a[N+1]=f[F]*.7,a[N+2]=B,a[N+3]=P,a[N+4]=k[0],a[N+5]=k[1],a[N+6]=k[2],M?l++:u++}r.bindBuffer(r.ARRAY_BUFFER,o.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);let y=new Float32Array(l*4),x=new Float32Array(u*4),C=0,_=0,v=i.low,A=i.high;for(let F=0;F<i.count;F++){let G=m[F]-s,D=v[F],B=A[F];c[F]!==0?(y[C+0]=G,y[C+1]=D,y[C+2]=G,y[C+3]=B,C+=4):(x[_+0]=G,x[_+1]=D,x[_+2]=G,x[_+3]=B,_+=4)}let R=this.o,L=R?.upWickBuffer??r.createBuffer(),w=R?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,L),r.bufferData(r.ARRAY_BUFFER,y,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,w),r.bufferData(r.ARRAY_BUFFER,x,r.STATIC_DRAW),this.o={bodyCount:i.count,upWickCount:l,downWickCount:u,upWickBuffer:L,downWickBuffer:w}}draw(t,n,i,o){let r=this.o;if(!r||r.bodyCount===0)return;let s=this.ensureProgram(i);Em(n,i,s.body,r.bodyCount,o),Pm(t,n,i,s.wick,r,o)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&(n.deleteBuffer(i.body.quadBuffer),n.deleteBuffer(i.body.instanceBuffer),n.deleteBuffer(i.wick.cornerBuffer),n.deleteBuffer(i.wick.segmentBuffer))}this.i=null,this.o=null}};function Em(e,t,n,i,o){if(i===0)return;let r=7*Float32Array.BYTES_PER_ELEMENT;e.useProgram(n.program),e.uniformMatrix4fv(n.u_projection,!1,o);let s=K(t),{setDivisor:a}=s;e.bindBuffer(e.ARRAY_BUFFER,n.quadBuffer),e.enableVertexAttribArray(n.a_corner),e.vertexAttribPointer(n.a_corner,2,e.FLOAT,!1,0,0),a(n.a_corner,0),e.bindBuffer(e.ARRAY_BUFFER,n.instanceBuffer);let l=Float32Array.BYTES_PER_ELEMENT,u=(m,f,b)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,b),a(m,1)};u(n.a_x_center,1,0),u(n.a_half_width,1,1*l),u(n.a_y0,1,2*l),u(n.a_y1,1,3*l),u(n.a_color,3,4*l),s.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i),a(n.a_x_center,0),a(n.a_half_width,0),a(n.a_y0,0),a(n.a_y1,0),a(n.a_color,0)}function Pm(e,t,n,i,o,r){if(o.upWickCount===0&&o.downWickCount===0)return;let s=n.dpr;t.useProgram(i.program),t.uniformMatrix4fv(i.u_projection,!1,r),t.uniform2f(i.u_resolution,t.canvas.width,t.canvas.height),t.uniform1f(i.u_line_width,e.g.wick_width_px*s);let a=K(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,i.cornerBuffer),t.enableVertexAttribArray(i.a_corner),t.vertexAttribPointer(i.a_corner,1,t.FLOAT,!1,0,0),l(i.a_corner,0),Wa(t,a,i,o.upWickBuffer,o.upWickCount,e.si),Wa(t,a,i,o.downWickBuffer,o.downWickCount,e.ai),l(i.a_start,0),l(i.a_end,0)}function Wa(e,t,n,i,o,r){if(o===0)return;let s=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:a}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,2*s,0),a(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,2*s,s),a(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}we();var Gi=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=Ge(n),o=ue(t,"line-uniform",Se,Be,["u_projection","u_color","u_resolution","u_line_width"],["a_corner","a_start","a_end"]);return this.i={...o,cornerBuffer:i,segmentBuffer:n.createBuffer()},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.e){this.o=null;return}let i=t.e.gl;i.deleteBuffer(n.upBuffer),i.deleteBuffer(n.downBuffer),this.o=null}rebuildBuffers(t,n){if(t.En!=="ohlc")return;let i=t.de,o=n.gl;this.ensureProgram(n);let r=t.xe,s=i.xCenter,a=i.halfWidth,l=i.open,u=i.close,m=i.high,f=i.low,b=i.isUp,p=0,c=0;for(let A=0;A<i.count;A++)b[A]!==0?p++:c++;let h=new Float32Array(p*3*4),g=new Float32Array(c*3*4),y=0,x=0;for(let A=0;A<i.count;A++){let R=s[A]-r,L=l[A],w=u[A],F=f[A],G=m[A],D=a[A],B=b[A]!==0?h:g,P=b[A]!==0?y:x;B[P++]=R,B[P++]=F,B[P++]=R,B[P++]=G,B[P++]=R-D,B[P++]=L,B[P++]=R,B[P++]=L,B[P++]=R,B[P++]=w,B[P++]=R+D,B[P++]=w,b[A]!==0?y=P:x=P}let C=this.o,_=C?.upBuffer??o.createBuffer(),v=C?.downBuffer??o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,_),o.bufferData(o.ARRAY_BUFFER,h,o.STATIC_DRAW),o.bindBuffer(o.ARRAY_BUFFER,v),o.bufferData(o.ARRAY_BUFFER,g,o.STATIC_DRAW),this.o={upBuffer:_,downBuffer:v,upInstanceCount:p*3,downInstanceCount:c*3}}draw(t,n,i,o){let r=this.o;if(!r||r.upInstanceCount===0&&r.downInstanceCount===0)return;let s=this.ensureProgram(i),a=i.dpr;n.useProgram(s.program),n.uniformMatrix4fv(s.u_projection,!1,o),n.uniform2f(s.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(s.u_line_width,t.g.ohlc_line_width_px*a);let l=K(i),{setDivisor:u}=l;n.bindBuffer(n.ARRAY_BUFFER,s.cornerBuffer),n.enableVertexAttribArray(s.a_corner),n.vertexAttribPointer(s.a_corner,1,n.FLOAT,!1,0,0),u(s.a_corner,0),Ga(n,l,s,r.upBuffer,r.upInstanceCount,t.si),Ga(n,l,s,r.downBuffer,r.downInstanceCount,t.ai),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&(n.deleteBuffer(i.cornerBuffer),n.deleteBuffer(i.segmentBuffer))}this.i=null,this.o=null}};function Ga(e,t,n,i,o,r){if(o===0)return;let s=4*Float32Array.BYTES_PER_ELEMENT,a=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:l}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,s,0),l(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,s,a),l(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}var Qt=class extends gt{constructor(){super(...arguments);d(this,"B",null);d(this,"Oe",[]);d(this,"b",[]);d(this,"de",Jt());d(this,"vn",{min:0,max:1});d(this,"en",null);d(this,"Ce",null);d(this,"ft","category");d(this,"j",null);d(this,"mt",null);d(this,"Ot",null);d(this,"xe",0);d(this,"si",[0,.8,.4]);d(this,"ai",[.8,.2,.2]);d(this,"ri",null);d(this,"pe",-1);d(this,"Ui",-1);d(this,"N",{bodyWick:new Wi,ohlc:new Gi});d(this,"Wn",!0);d(this,"Lt",null)}tooltipCallbacks(){return{onHover:(n,i)=>Jo(this,n,i),onLeave:()=>{this.pe!==-1&&(this.pe=-1,Ye(this))},onPin:(n,i)=>{if(Jo(this,n,i),this.pe>=0){let o=this.pe;Ba(this,o),this.Bo(o)}},onUnpin:()=>{this.emitUnselect()}}}async Bo(n){if(n<0||n>=this.de.count)return;let i=this.de.catIdx[n],o=this.de.splitIdx[n],r=this.Re.map(u=>u.labels[i]??null),s=this.Oe[o]??"",a=this.w.length>0&&s!==""?s.split("|"):[],l=this.E[1]||this.E.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:i+this.lt,columnName:l,groupByValues:r,splitByValues:a})}invalidateTheme(){super.invalidateTheme(),this.ri=null}async uploadAndRender(n,i,o,r){if(this.e=n,o!==0)return;let s=Ma({columns:i,numRows:r,columnSlots:this.E,groupBy:this.L,splitBy:this.w,groupByTypes:this.gt,bandInnerFrac:this.g.band_inner_frac,barInnerPad:this.g.bar_inner_pad,scratchCandles:this.de});this.g.domain_mode==="expand"?(this.en&&(s.yDomain.min=Math.min(this.en.min,s.yDomain.min),s.yDomain.max=Math.max(this.en.max,s.yDomain.max)),this.en={...s.yDomain},s.numericCategoryDomain&&(this.Ce&&(s.numericCategoryDomain.min=Math.min(this.Ce.min,s.numericCategoryDomain.min),s.numericCategoryDomain.max=Math.max(this.Ce.max,s.numericCategoryDomain.max)),this.Ce={min:s.numericCategoryDomain.min,max:s.numericCategoryDomain.max})):(this.en=null,this.Ce=null),this.Re=s.rowPaths,this.ie=s.numCategories,this.lt=s.rowOffset,this.Oe=s.splitPrefixes,this.b=s.series,this.de=s.candles,this.vn=s.yDomain,this.ft=s.axisMode.mode,this.j=s.numericCategoryDomain,this.mt=s.categoryPositions,this.xe=s.numericCategoryDomain?.min??0,this.Lt=null,er(this),Ia(this),Ea(this,n),await this.requestRender(n)}It(n){this.e=n,Pa(this,n)}resetExpandedDomain(){this.en=null,this.Ce=null}destroyInternal(){if(this.e){let n=this.e.gl;this.W&&n.deleteBuffer(this.W),this.N.bodyWick.destroy(this),this.N.ohlc.destroy(this)}this.i=null,this.B=null,this.W=null,this.de=Jt(),this.b=[],this.Re=[],this.ie=0,this.ri=null}};var $a={scatter:async()=>qn,line:async()=>Kn,density:async()=>Jn,treemap:async()=>ci,sunburst:async()=>hi,heatmap:async()=>Pi,"y-bar":async()=>He,"y-line":async()=>He,"y-scatter":async()=>He,"y-area":async()=>He,"x-bar":async()=>Ii,candlestick:async()=>Qt,ohlc:async()=>Qt,"map-scatter":async()=>(await Promise.resolve().then(()=>(Hi(),Oi))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(Hi(),Oi))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(Hi(),Oi))).MapDensityChart};async function ja(e,t,n){let i=new Map;await e.with_typed_arrays(n??{},async(o,r,s,a)=>{for(let l=0;l<o.length;l++){let u=o[l],m=r[l],f=s[l]??void 0,b=a[l];b!==null?i.set(u,{type:"string",indices:m,dictionary:b,valid:f}):m instanceof Float32Array?i.set(u,{type:"float32",values:m,valid:f}):m instanceof Int32Array?i.set(u,{type:"int32",values:m,valid:f}):m instanceof Float64Array?i.set(u,{type:"float64",values:m,valid:f}):i.set(u,{type:"float32",values:new Float32Array(m),valid:f})}await t(i)})}var Za=new Map;async function qa(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=Za.get(t);if(n){await n;return}n=(async()=>{try{let i={};e.style&&(i.style=e.style),e.weight&&(i.weight=e.weight),e.stretch&&(i.stretch=e.stretch);let o=new FontFace(e.family,e.src,i);await o.load(),self.fonts.add(o)}catch(i){console.warn(`Failed to load font ${e.family}:`,i)}})(),Za.set(t,n),await n}function tn(e,t){switch(t.kind){case"setViewByName":e.setViewByName(t.name);break;case"setColumnsConfig":e.chartImpl.setColumnsConfig?.(t.cfg);break;case"setPluginConfig":e.chartImpl.setPluginConfig?.(t.cfg),e.redraw();break;case"setBufferMaxCapacity":e.glManager.C.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"resize":console.log("resize"),e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redraw();break;case"clear":e.clear();break;case"invalidateTheme":e.chartImpl.setTheme?.(t.themeVars),e.chartImpl.invalidateTheme?.(),e.resize(e.cssWidth,e.cssHeight,e.dpr);break;case"restoreZoom":e.restoreZoom(t.state);break;case"resetAllZooms":e.resetAllZooms(),e.redraw(),e.post({kind:"zoomChanged",isDefault:e.allZoomsDefault()});break;case"resetExpandedDomain":e.resetExpandedDomain();break;case"interaction":e.onInteraction(t.event);break;case"saveZoom":e.post({kind:"saveZoomReply",requestId:t.requestId,state:e.saveZoom()});break;case"destroy":e.destroy();break;case"init":break;case"snapshotPng":{let n=t.requestId;e.snapshotPng().then(i=>{e.post({kind:"snapshotPngReply",requestId:n,blob:i})}).catch(i=>{e.post({kind:"error",message:String(i)})});break}}}var nn=new Map;function sr(e,t,n){let i={sessionId:e,msg:t};n&&n.length>0?self.postMessage(i,n):self.postMessage(i)}function Nm(e){return{postMessage:(t,n)=>sr(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function Ka(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:i,msg:o}=n;if(o.kind==="init"){if(nn.has(i)){sr(i,{kind:"error",message:`sessionId ${i} already initialized`});return}e(o,Nm(i)).then(s=>{nn.set(i,s)}).catch(s=>{sr(i,{kind:"error",message:String(s)})});return}if(o.kind==="destroy"){let s=nn.get(i);s&&(tn(s,o),nn.delete(i));return}let r=nn.get(i);r&&tn(r,o)})}so();var Yi=class extends Error{constructor(){super("StaleGenerationError")}};async function Ja(e){let t=$a[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var Vi=class{constructor(t,n,i,o,r,s){d(this,"chartImpl");d(this,"glManager");d(this,"zoomController",null);d(this,"gridlines");d(this,"chrome");d(this,"cssWidth");d(this,"cssHeight");d(this,"dpr");d(this,"client");d(this,"view");d(this,"table");d(this,"controlPort");d(this,"Oi",0);d(this,"li",null);d(this,"Hi",0);d(this,"Yi",0);this.client=n,this.view=i,this.table=o,this.controlPort=r,this.chartImpl=new s;let a=t.glCanvas??new OffscreenCanvas(Math.max(1,Math.round(t.cssWidth*t.dpr)),Math.max(1,Math.round(t.cssHeight*t.dpr)));this.glManager=new Bn(a,{precompile:t.precompileShaders??!1}),t.renderMode==="blit"&&this.glManager.setFrameCallback(u=>{this.post({kind:"frameBitmap",bitmap:u},[u])}),this.gridlines=t.gridlinesCanvas,this.chrome=t.chromeCanvas,this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(t.gridlinesCanvas),this.chartImpl.setChromeCanvas?.(t.chromeCanvas),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),this.chartImpl.setZoomController&&(this.zoomController=new Qe,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(i),this.glManager.C.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr);let l=new In(u=>{switch(u.kind){case"pin":this.post({kind:"pinTooltip",lines:u.payload.lines,pos:u.payload.pos,bounds:u.payload.bounds});break;case"dismiss":this.post({kind:"dismissTooltip"});break;case"setCursor":this.post({kind:"setCursor",cursor:u.cursor});break;case"userClick":this.post({kind:"userClick",detail:u.payload});break;case"userSelect":this.post({kind:"userSelect",selected:u.payload.selected,row:u.payload.row,column_names:u.payload.column_names,insertConfig:u.payload.insertConfig});break}});this.chartImpl.attachTooltip?.(l)}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}async loadAndRender(t){let n=++this.Oi;try{let[i,o,r,s]=await Promise.all([this.view.num_rows(),this.view.schema(),this.view.expression_schema(),this.table?.schema()??Promise.resolve({})]);if(this.Oi!==n)return;this.chartImpl.setViewPivots?.(t.viewerConfig.group_by,t.viewerConfig.split_by),this.chartImpl.setColumnTypes?.(o),this.chartImpl.setGroupByTypes?.({...s,...r}),this.chartImpl.setColumnSlots?.(t.viewerConfig.columns);let a=Object.keys(o).length||1,l=Math.floor(this.glManager.C.maxCapacity/a),u=Math.min(i,l);this.glManager.ensureBufferCapacity(u);try{await ja(this.view,async m=>{if(this.Oi!==n)throw new Yi;await this.chartImpl.uploadAndRender(this.glManager,m,0,u)},{end_row:u,float32:t.options.float32})}catch(m){if(!(m instanceof Yi))throw m}}catch(i){console.error("loadAndRender failed",i)}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId})}}redraw(){this.chartImpl.requestRender(this.glManager)}resize(t,n,i){this.cssWidth=t,this.cssHeight=n,this.dpr=i,this.glManager.requestResize(t,n,i),this.chartImpl.requestRender(this.glManager)}clear(){Nr(this.glManager,()=>{this.glManager.clear(),this.gridlines.getContext("2d")?.clearRect(0,0,this.gridlines.width,this.gridlines.height)})}saveZoom(){return this.zoomController?.serialize()}restoreZoom(t){t&&this.zoomController?.restore(t)}allZoomsDefault(){if(this.zoomController&&!this.zoomController.isDefault())return!1;let t=this.chartImpl?.rn;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.rn;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}Lo(t,n){let i=this.chartImpl,o=i?.A;if(o){for(let a=0;a<o.cells.length;a++){let l=o.cells[a],u=l.layout.t;if(t>=u.x&&t<=u.x+u.width&&n>=u.y&&n<=u.y+u.height){let m=i.getZoomControllerForFacet?.(a)??this.zoomController;return m?{controller:m,layout:l.layout}:null}}return null}if(!this.zoomController)return null;let r=i?.u;if(!r)return null;let s=r.t;return t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height?null:{controller:this.zoomController,layout:r}}onInteraction(t){switch(t.type){case"wheel":{let n=this.Lo(t.mx,t.my);if(!n)return;Cr(n,t.mx,t.my,t.deltaY),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()});break}case"pointerdown":{let n=this.Lo(t.mx,t.my);if(!n)return;this.li=n,this.Hi=t.mx,this.Yi=t.my;break}case"pointermove":{if(this.li){let n=t.mx-this.Hi,i=t.my-this.Yi;this.Hi=t.mx,this.Yi=t.my,_r(this.li,n,i),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this._()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.li=null;break}case"pointerleave":{this._()?.dispatchLeave();break}case"click":{this._()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this._()?.dispatchDblClick(t.mx,t.my);break}}}_(){return this.chartImpl?._??null}async snapshotPng(){this.glManager.applyPendingResize(),this.chartImpl.It(this.glManager);let t=this.glManager.gl,n=t.canvas,i=n.width,o=n.height,r=new Uint8ClampedArray(i*o*4);t.readPixels(0,0,i,o,t.RGBA,t.UNSIGNED_BYTE,r);let s=new OffscreenCanvas(i,o),a=s.getContext("2d");if(!a)throw new Error("snapshotPng: 2D context unavailable");let u=this.chartImpl.T?.()?.backgroundColor??"transparent";u!=="transparent"&&(a.fillStyle=u,a.fillRect(0,0,i,o)),a.drawImage(this.gridlines,0,0);let m=new OffscreenCanvas(i,o),f=m.getContext("2d");if(!f)throw new Error("snapshotPng: 2D context unavailable for GL blit");return f.putImageData(new ImageData(r,i,o),0,0),a.save(),a.scale(1,-1),a.drawImage(m,0,-o),a.restore(),a.drawImage(this.chrome,0,0),await s.convertToBlob({type:"image/png"})}destroy(){this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},Um=typeof globalThis.importScripts=="function";async function Om(e,t){if(!e.clientWorkerURL||!e.clientWasm||!e.proxyPort)throw new Error("Init error");let n=await import(e.clientWorkerURL.toString());await n.initSync({module:e.clientWasm}),e.fontFaces?.length&&await Promise.all(e.fontFaces.map(qa));let i=e.proxyPort,o=new n.Client(async u=>{let m=u.slice().buffer;i.postMessage(m,[m])},async()=>i.close());i.addEventListener("message",u=>{o.handle_response(new Uint8Array(u.data))}),i.start();let r=o.__unsafe_open_view(e.viewName),s=e.tableName?await o.open_table(e.tableName):null,a=await Ja(e.chartTag),l=new Vi(e,o,r,s,t,a);return l.post({kind:"ready"}),l}async function Jy(e){let t=e.client.__unsafe_open_view(e.msg.viewName),n=e.msg.tableName?await e.client.open_table(e.msg.tableName):null,i=await Ja(e.msg.chartTag),o=new Vi(e.msg,e.client,t,n,e.controlPort,i);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&tn(o,s)}),e.controlPort.start(),o.post({kind:"ready"}),o}Um&&Ka(Om);export{Vi as WorkerRenderer,Jy as bootstrapInProcess};\n';var A=null;async function he(){if(A)return A;let r=new Blob([q],{type:"application/javascript"});return A=URL.createObjectURL(r),A}var D=he;var w=null,N=new Map,ce=0;async function fe(){return w||(w=(async()=>{let r=await D(),e=new Worker(r,{type:"module",name:"viewer-charts"});return e.addEventListener("message",t=>{let i=t.data;N.get(i.sessionId)?.(i.msg)}),e})(),w)}var M=class{_handle=null;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._clientWorkerURL=e.clientWorkerURL,this._clientWasm=e.clientWasm,this._chartTag=e.chartTag,this._maxCells=e.maxCells,this._precompileShaders=e.precompileShaders??!1,this._onZoomChanged=e.onZoomChanged??null,this._ready=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i})}async init(e){this._hostGlCanvas=e.gl;let t=await D();m==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(c=>{let W=c.slice().buffer;this._proxyChannel.port1.postMessage(W,[W])}),this._proxyChannel.port1.addEventListener("message",c=>{this._proxySession.handle_request(new Uint8Array(c.data))}),this._proxyChannel.port1.start());let i;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):i=e.gl.transferControlToOffscreen();let n=e.gridlines.transferControlToOffscreen(),o=e.chrome.transferControlToOffscreen(),a=e.gl.getBoundingClientRect(),l=window.devicePixelRatio||1,h=k(e.gl),g=m==="worker"?j():[],_=m==="worker"?this._clientWasm:void 0,F=m==="worker"?this._clientWorkerURL:void 0,J=m==="worker"?this._proxyChannel.port2:void 0,U={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:o,proxyPort:J,clientWorkerURL:F,clientWasm:_,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,defaultChartType:e.defaultChartType,themeVars:h,fontFaces:g,cssWidth:a.width,cssHeight:a.height,dpr:l,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._handle=await this._createHandle(t,U),this._handle.addMessageListener(c=>this._handleRendererMsg(c)),m==="worker"){let c=[n,o,this._proxyChannel.port2];i&&c.unshift(i),this._handle.post(U,c)}await this._ready}async _createHandle(e,t){if(m==="worker"){let o=await fe(),a=++ce;return{post:(l,h)=>o.postMessage({sessionId:a,msg:l},h),addMessageListener:l=>{N.set(a,l)},terminate:()=>{N.delete(a)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(o,a)=>n.port1.postMessage(o,a),addMessageListener:o=>{n.port1.addEventListener("message",a=>o(a.data)),n.port1.start()},terminate:()=>{n.port1.close(),n.port2.close()}}}setView(e){this._view=e,this._post({kind:"setViewByName",name:this._view.__unsafe_get_name()})}setColumnsConfig(e){this._post({kind:"setColumnsConfig",cfg:e})}setPluginConfig(e){this._post({kind:"setPluginConfig",cfg:e})}setBufferMaxCapacity(e){this._post({kind:"setBufferMaxCapacity",n:e})}loadAndRender(e){let{id:t,promise:i}=this._allocPending("loadAndRender"),n={kind:"loadAndRender",msgId:t,viewerConfig:e.viewerConfig,options:{float32:e.options?.float32??!0}};return this._post(n),i}redraw(){this._post({kind:"redraw"})}resize(){if(!this._hostGlCanvas)return;let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1;this._post({kind:"resize",cssWidth:e.width,cssHeight:e.height,dpr:t})}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=k(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){let t=++this._pendingCounter,i=new Promise((n,o)=>{this._pending.set(t,{kind:e,resolve:n,reject:o})});return{id:t,promise:i}}restoreZoom(e){this._post({kind:"restoreZoom",state:e})}allZoomsDefault(){return this._allZoomsDefault}resetAllZooms(){this._post({kind:"resetAllZooms"})}resetExpandedDomain(){this._post({kind:"resetExpandedDomain"})}snapshotPng(){let{id:e,promise:t}=this._allocPending("snapshotPng");return this._post({kind:"snapshotPng",requestId:e}),t}forwardInteraction(e){this._post({kind:"interaction",event:e})}destroy(){this._post({kind:"destroy"}),this._proxySession&&this._proxySession.close().catch(()=>{}),this._proxyChannel&&(this._proxyChannel.port1.close(),this._proxyChannel=null),this._handle&&(this._handle.terminate(),this._handle=null),this._hostSink?.dismiss(),this._hostSink=null,this._hostGlCanvas=null,this._displayCtx=null;let e=new Error("RendererTransport destroyed");for(let t of this._pending.values())t.kind==="loadAndRender"?t.resolve(void 0):t.reject(e);this._pending.clear()}_post(e){this._postRaw(e,[])}_postRaw(e,t){this._handle&&this._handle.post(e,t)}_handleRendererMsg(e){switch(e.kind){case"ready":this._resolveReady();break;case"zoomChanged":this._allZoomsDefault=e.isDefault,this._onZoomChanged?.(e.isDefault);break;case"saveZoomReply":this._resolvePending(e.requestId,"saveZoom",e.state);break;case"pinTooltip":this._ensureHostSink()?.pin(e.lines,e.pos,e.bounds);break;case"dismissTooltip":this._hostSink?.dismiss();break;case"setCursor":this._ensureHostSink()?.setCursor(e.cursor);break;case"userClick":this._dispatchOnViewer(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:e.detail}));break;case"userSelect":{let t=this._lastInsertConfig?[this._lastInsertConfig]:[],i=e.selected?[e.insertConfig]:[];this._lastInsertConfig=e.selected?e.insertConfig:void 0;let n=new P(e.selected,e.row,e.column_names,t,i);this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._drawFrameBitmap(e.bitmap);break;case"error":this._rejectReady(new Error(e.message));break;case"loadAndRenderAck":this._resolvePending(e.msgId,"loadAndRender",void 0);break;case"snapshotPngReply":this._resolvePending(e.requestId,"snapshotPng",e.blob);break}}_resolvePending(e,t,i){let n=this._pending.get(e);!n||n.kind!==t||(this._pending.delete(e),n.resolve(i))}_drawFrameBitmap(e){if(this._displayCtx&&this._hostGlCanvas){let t=e.width,i=e.height;this._hostGlCanvas.width!==t&&(this._hostGlCanvas.width=t),this._hostGlCanvas.height!==i&&(this._hostGlCanvas.height=i),this._displayCtx.globalCompositeOperation="copy",this._displayCtx.drawImage(e,0,0)}e.close()}_dispatchOnViewer(e){if(!this._hostGlCanvas)return;let t=this._hostGlCanvas;for(;t;){if(t instanceof HTMLElement&&t.tagName==="PERSPECTIVE-VIEWER"){t.dispatchEvent(e);return}t=t.host??t.parentNode??null}}_ensureHostSink(){if(this._hostSink)return this._hostSink;let e=this._hostGlCanvas?.parentElement;return!e||!this._hostGlCanvas?null:(this._hostSink=new C(this._hostGlCanvas,e),this._hostSink)}};var de={...G};function me(r,e){switch(r){case"auto_alt_y_axis":return{kind:"Bool",key:r,default:e.auto_alt_y_axis};case"include_zero":return{kind:"Bool",key:r,default:e.include_zero};case"domain_mode":return{kind:"Enum",key:r,default:e.domain_mode,variants:[{value:"fit",label:"Fit"},{value:"expand",label:"Expand"}]};case"facet_mode":return{kind:"Enum",key:r,default:s.facet_mode,variants:[{value:"grid",label:"Grid"},{value:"overlay",label:"Overlay"}]};case"facet_zoom_mode":return{kind:"Enum",key:r,default:s.facet_zoom_mode,variants:[{value:"shared",label:"Shared"},{value:"independent",label:"Independent"}]};case"series_zoom_mode":return{kind:"Enum",key:r,default:s.series_zoom_mode,variants:[{value:"dynamic",label:"Dynamic"},{value:"fixed",label:"Fixed"}]};case"line_width_px":return{kind:"Number",key:r,default:s.line_width_px,min:.5,step:.5,max:16};case"point_size_px":return{kind:"Number",key:r,default:s.point_size_px,min:1,max:32};case"band_inner_frac":return{kind:"Number",key:r,default:s.band_inner_frac,min:.1,max:1,step:.01};case"bar_inner_pad":return{kind:"Number",key:r,default:s.bar_inner_pad,min:0,max:.9,step:.01};case"wick_width_px":return{kind:"Number",key:r,default:s.wick_width_px,min:.5,step:.5,max:8};case"ohlc_line_width_px":return{kind:"Number",key:r,default:s.ohlc_line_width_px,min:.5,step:.5,max:8};case"gradient_radius_px":return{kind:"Number",key:r,default:s.gradient_radius_px,min:2,step:1,max:256};case"gradient_intensity":return{kind:"Number",key:r,default:s.gradient_intensity,min:.05,step:.05,max:4};case"gradient_heat_max":return{kind:"Number",key:r,default:s.gradient_heat_max,min:.1,step:.1,max:64};case"gradient_color_mode":return{kind:"Enum",key:r,default:s.gradient_color_mode,variants:[{value:"mean",label:"Mean (density-weighted)"},{value:"density",label:"Density only"},{value:"extreme",label:"Extremes"},{value:"signed",label:"Signed sum"}]};case"map_tile_provider":return{kind:"Enum",key:r,default:s.map_tile_provider,variants:[{value:"carto-positron",label:"Light (Positron)"},{value:"carto-dark-matter",label:"Dark Matter"},{value:"carto-voyager",label:"Voyager"}]};case"map_tile_alpha":return{kind:"Number",key:r,default:s.map_tile_alpha,min:0,max:1,step:.05}}}var ge=(()=>{let r=new CSSStyleSheet;return r.replaceSync(X),[r]})(),R=class extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_generation=0;_renderBlitMode=Z;_resetClickAbort=null;_pluginConfigStore=null;get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{...s,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of ge)this.shadowRoot.adoptedStyleSheets.push(e);this.shadowRoot.innerHTML='<div class="webgl-container"><div class="zoom-controls"><button class="zoom-reset">Reset Zoom</button></div></div>',this._initialized=!0}this._glCanvas?.isConnected||this._buildCanvasStack()}_buildCanvasStack(){let e=this.shadowRoot.querySelector(".webgl-container");e.insertAdjacentHTML("afterbegin",'<canvas class="webgl-gridlines"></canvas><canvas class="webgl-canvas"></canvas><canvas class="webgl-chrome"></canvas>'),this._glCanvas=e.querySelector(".webgl-canvas"),this._gridlineCanvas=e.querySelector(".webgl-gridlines"),this._chromeCanvas=e.querySelector(".webgl-chrome")}_clearCanvasStack(){let e=this.shadowRoot?.querySelector(".webgl-container");if(e)for(let t of Array.from(e.querySelectorAll("canvas")))t.remove();this._glCanvas=null,this._gridlineCanvas=null,this._chromeCanvas=null}disconnectedCallback(){this.delete(),this._clearCanvasStack()}_ensureRenderer(e){return this._initialized||this.connectedCallback(),this._rendererPromise?this._rendererPromise:(this._rendererPromise=this._buildRenderer(e).then(t=>(this._renderer=t,this._setupInteraction(t),t)),this._rendererPromise)}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new b,this._rawEventForwarder.attach(this._glCanvas,n=>{e.forwardInteraction(n)});let i=this.shadowRoot.querySelector(".zoom-reset");i&&(this._resetClickAbort=new AbortController,i.addEventListener("click",()=>{e.resetAllZooms(),t&&t.classList.remove("visible")},{signal:this._resetClickAbort.signal}))}async _buildRenderer(e){let t=this.parentElement,i=await t.getClient(),n=customElements.get("perspective-viewer"),o=n.get_wasm_module(),a=n.get_worker_url(),l=await t?.getTable?.(),h=l?await l.get_name():void 0,g=this.shadowRoot.querySelector(".zoom-controls"),_=new M({client:i,view:e,tableName:h,clientWorkerURL:a,clientWasm:o,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:F=>{g&&g.classList.toggle("visible",!F)}});return await _.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...de,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:this._renderBlitMode}),_}setBlitMode(e){console.assert(this._initialized,"Already initialized"),this._renderBlitMode=e}get_static_config(){return{name:this._chartType.name,category:this._chartType.category,select_mode:this._chartType.selectMode,min_config_columns:this._chartType.initial.count,config_column_names:this._chartType.initial.names,max_cells:this._chartType.max_cells,max_columns:this._chartType.max_columns,group_rollup_modes:["flat"],priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"}}column_config_schema(e,t,i,n,o){let a=[],l=this._chartType.default_chart_type;if(l&&(e==="integer"||e==="float")){a.push({kind:"Enum",key:"chart_type",default:l,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let h=n?.chart_type??l,g=h==="bar"||h==="area";g&&a.push({kind:"Bool",key:"stack",default:g}),(l==="bar"||l==="line"||l==="scatter"||l==="area")&&a.push({kind:"Bool",key:"alt_axis",default:!1})}return e==="integer"||e==="float"?a.push({kind:"NumberFormat"}):(e==="date"||e==="datetime")&&a.push({kind:"DatetimeFormat"}),{fields:a}}plugin_config_schema(e){let t=this._effectiveDefaults();return{fields:this._chartType.applicable_plugin_fields.map(n=>me(n,t))}}async draw(e){return this._renderer?.resetExpandedDomain(),this._renderer?.resetAllZooms(),this._drawImpl(e)}async update(e){return this._drawImpl(e)}async _drawImpl(e){let t=++this._generation,i=await this._ensureRenderer(e);if(this._generation!==t)return;i.setView(e),i.setBufferMaxCapacity(this._chartType.max_cells);let o=await this.parentElement?.getViewConfig?.()??{};this._generation===t&&await i.loadAndRender({viewerConfig:{group_by:o?.group_by??[],split_by:o?.split_by??[],columns:o?.columns??[]},options:{float32:!0}})}async clear(){this._generation++,this._renderer?.clear()}async resize(){this._renderer?.resize()}restyle(){return this._renderer?.invalidateTheme(),5}save(){let e={},t=this._renderer?.saveZoom();t&&(e.zoom=t);let i={};for(let n of this._chartType.applicable_plugin_fields)i[n]=this._pluginConfig[n];return Object.keys(i).length>0&&(e.plugin_config=i),e}async render(e){return await this._ensureRenderer(e),await this.draw(e),this._renderer.snapshotPng()}restore(e,t){e?.zoom&&this._renderer?.restoreZoom(e.zoom),this._pluginConfig={...this._effectiveDefaults(),...e},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(t??{})}delete(){this._generation++,this._rawEventForwarder&&(this._rawEventForwarder.detach(),this._rawEventForwarder=null),this._resetClickAbort&&(this._resetClickAbort.abort(),this._resetClickAbort=null),this._renderer&&(this._renderer.destroy(),this._renderer=null),this._rendererPromise=null}};function pe(...r){let e=new Set(r.length>0?r:S.map(t=>t.name));S.forEach(t=>{if(e.has(t.name)){let i=`perspective-viewer-charts-${t.tag}`;customElements.define(i,class extends R{_chartType=t;static _chartType=t}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(i)})}})}pe();export{P as PerspectiveSelectDetail,pe as register};
|
|
1
|
+
var _="Series Charts",F="Cartesian Charts",E="Hierarchical Charts",O="Financial Charts",B="Map Charts",J=["X Axis"],v=["Y Axis"],c="select",f="toggle";var x=["auto_alt_y_axis","facet_mode","series_zoom_mode","include_zero","domain_mode","line_width_px","point_size_px","band_inner_frac","bar_inner_pad"],I={include_zero:!0},z=["facet_mode","facet_zoom_mode","domain_mode","line_width_px","point_size_px"],Y=["facet_mode","series_zoom_mode","domain_mode","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px"],H=[],Q=["facet_zoom_mode"],L=["facet_mode","facet_zoom_mode","domain_mode","map_tile_provider","map_tile_alpha"],ee=[...L,"point_size_px"],te=[...L,"line_width_px"],ie=[...L,"gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"],ne=["facet_mode","facet_zoom_mode","domain_mode","gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"];function u(o,e,t,i,n,r,l,a){return{name:o,tag:e,category:t,selectMode:i,initial:{count:n,names:r},max_cells:a?.max_cells??2e6,max_columns:a?.max_columns??1e4,applicable_plugin_fields:l,...a?.default_chart_type?{default_chart_type:a.default_chart_type}:{},...a?.plugin_field_defaults?{plugin_field_defaults:a.plugin_field_defaults}:{}}}var V=["Open","Close","High","Low","Tooltip"],$=["Size","Color","Tooltip"],re=[u("X Bar","x-bar",_,c,1,J,x,{default_chart_type:"bar",plugin_field_defaults:I}),u("Y Bar","y-bar",_,c,1,v,x,{default_chart_type:"bar",plugin_field_defaults:I}),u("Y Line","y-line",_,c,1,v,x,{default_chart_type:"line"}),u("Y Scatter","y-scatter",_,c,1,v,x,{default_chart_type:"scatter"}),u("Y Area","y-area",_,c,1,v,x,{default_chart_type:"area",plugin_field_defaults:I}),u("X/Y Scatter","scatter",F,f,2,["X Axis","Y Axis","Color","Size","Label","Tooltip"],z),u("X/Y Line","line",F,c,2,["X Axis","Y Axis","Tooltip"],z),u("Density","density",F,f,2,["X Axis","Y Axis","Color","Tooltip"],ne),u("Treemap","treemap",E,f,1,$,H),u("Sunburst","sunburst",E,f,1,$,H),u("Heatmap","heatmap",E,c,1,["Color"],Q),u("Candlestick","candlestick",O,f,1,V,Y,{default_chart_type:"candlestick"}),u("OHLC","ohlc",O,f,1,V,Y,{default_chart_type:"ohlc"}),u("Map Scatter","map-scatter",B,f,2,["Longitude","Latitude","Color","Size","Label","Tooltip"],ee),u("Map Line","map-line",B,c,2,["Longitude","Latitude","Tooltip"],te),u("Map Density","map-density",B,f,2,["Longitude","Latitude","Color","Tooltip"],ie)],S=re;var X=":host{--psp-charts--tooltip--color:var(--psp--color);--psp-charts--tooltip--background:var(--psp--background-color);--psp-charts--tooltip--border-color:var(--psp-inactive--border-color);width:100%;height:100%;font-family:inherit;display:block;position:relative;overflow:hidden}.webgl-container{position:absolute;inset:6px}.webgl-canvas{width:100%;height:100%;position:absolute;top:0;left:0}.webgl-gridlines,.webgl-chrome{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.zoom-controls{z-index:2;pointer-events:auto;display:none;position:absolute;top:8px;left:50%;transform:translate(-50%)}.zoom-controls.visible{gap:6px;display:flex}.zoom-reset{background:var(--psp-charts--tooltip--background);color:var(--psp-charts--tooltip--color);border:1px solid var(--psp-charts--tooltip--border-color);font:11px var(--psp-charts--font-family);cursor:pointer;opacity:.7;border-radius:4px;padding:4px 12px;transition:opacity .15s}.zoom-reset:hover{opacity:1}.webgl-tooltip{pointer-events:auto;font:11px var(--psp-charts--font-family);background:var(--psp-charts--tooltip--background);color:var(--psp-charts--tooltip--color);border:1px solid var(--psp-charts--tooltip--border-color);white-space:pre;z-index:10;border-radius:3px;padding:3px;line-height:16px;position:absolute;overflow-y:auto}";var G={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},j={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"expand",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1};var b=class{_element=null;_emit=null;_pointerId=null;_onWheel=null;_onPointerDown=null;_onPointerMove=null;_onPointerUp=null;_onPointerLeave=null;_onClick=null;_onDblClick=null;attach(e,t){this.detach(),this._element=e,this._emit=t,this._onWheel=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;i.preventDefault(),t({type:"wheel",mx:r,my:l,deltaY:i.deltaY})},this._onPointerDown=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;e.setPointerCapture(i.pointerId),this._pointerId=i.pointerId,t({type:"pointerdown",mx:r,my:l,pointerId:i.pointerId})},this._onPointerMove=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,l=i.clientY-n.top;t({type:"pointermove",mx:r,my:l})},this._onPointerUp=i=>{if(this._pointerId!==null){try{e.releasePointerCapture(this._pointerId)}catch{}this._pointerId=null}t({type:"pointerup"})},this._onPointerLeave=()=>{t({type:"pointerleave"})},this._onClick=i=>{let n=e.getBoundingClientRect();t({type:"click",mx:i.clientX-n.left,my:i.clientY-n.top})},this._onDblClick=i=>{let n=e.getBoundingClientRect();t({type:"dblclick",mx:i.clientX-n.left,my:i.clientY-n.top})},e.addEventListener("wheel",this._onWheel,{passive:!1}),e.addEventListener("pointerdown",this._onPointerDown),e.addEventListener("pointermove",this._onPointerMove),e.addEventListener("pointerup",this._onPointerUp),e.addEventListener("pointerleave",this._onPointerLeave),e.addEventListener("click",this._onClick),e.addEventListener("dblclick",this._onDblClick)}detach(){this._element&&(this._onWheel&&this._element.removeEventListener("wheel",this._onWheel),this._onPointerDown&&this._element.removeEventListener("pointerdown",this._onPointerDown),this._onPointerMove&&this._element.removeEventListener("pointermove",this._onPointerMove),this._onPointerUp&&this._element.removeEventListener("pointerup",this._onPointerUp),this._onPointerLeave&&this._element.removeEventListener("pointerleave",this._onPointerLeave),this._onClick&&this._element.removeEventListener("click",this._onClick),this._onDblClick&&this._element.removeEventListener("dblclick",this._onDblClick)),this._element=null,this._emit=null,this._pointerId=null,this._onPointerLeave=null,this._onClick=null,this._onDblClick=null}};import{PerspectiveSelectDetail as P}from"@perspective-dev/viewer/src/ts/extensions.js";var le=["--psp-charts--font-family","font-family","--psp--background-color","--psp-charts--axis-ticks--color","--psp--color","--psp-charts--axis-lines--color","--psp-charts--gridline--color","--psp-charts--gradient--background","--psp-charts--full-gradient--background","--psp-charts--legend--color","--psp-charts--legend-border--color","--psp-charts--tooltip--background","--psp-charts--tooltip--color","--psp-charts--tooltip--border-color","--psp-charts--area--opacity","--psp-charts--heatmap-gap--px","--psp-charts--sunburst-gap--px"];function k(o){let e=getComputedStyle(o),t={};for(let i of le){let n=e.getPropertyValue(i).trim();n&&(t[i]=n)}for(let i=1;;i++){let n=`--psp-charts--series-${i}--color`,r=e.getPropertyValue(n).trim();if(!r)break;t[n]=r}return t}function Z(){let o=[];for(let e of Array.from(document.styleSheets)){let t;try{t=e.cssRules}catch{continue}let i=e.href??document.baseURI;for(let n of Array.from(t)){if(!(n instanceof CSSFontFaceRule))continue;let r=n.style,l=r.getPropertyValue("font-family").trim(),a=r.getPropertyValue("src").trim();!l||!a||o.push({family:ae(l),src:se(a,i),style:g(r,"font-style"),weight:g(r,"font-weight"),stretch:g(r,"font-stretch"),unicodeRange:g(r,"unicode-range"),variant:g(r,"font-variant"),featureSettings:g(r,"font-feature-settings"),display:g(r,"font-display")})}}return o}function g(o,e){return o.getPropertyValue(e).trim()||void 0}function ae(o){if(o.length>=2){let e=o.charCodeAt(0),t=o.charCodeAt(o.length-1);if(e===t&&(e===34||e===39))return o.slice(1,-1)}return o}function se(o,e){return o.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,(t,i,n)=>{try{return`url(${new URL(n,e).href})`}catch{return t}})}var C=class{_glCanvas;_parent;_div=null;constructor(e,t){this._glCanvas=e,this._parent=t}pin(e,t,i){this.dismiss();let n=document.createElement("div");n.className="webgl-tooltip",n.style.maxHeight=`${Math.round(i.cssHeight*.6)}px`,n.textContent=e.join(`
|
|
2
|
+
`),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),n.style.left="-9999px",n.style.top="0px",this._parent.appendChild(n),this._div=n;let r=n.getBoundingClientRect().width,l=n.getBoundingClientRect().height,a=t.px+12,s=t.py-l-8;a+r>i.cssWidth&&(a=t.px-r-12),a<0&&(a=4),s<0&&(s=t.py+12),s+l>i.cssHeight&&(s=i.cssHeight-l-4),n.style.left=`${a}px`,n.style.top=`${s}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};var d="worker",q="direct";var K='var kr=Object.defineProperty;var Rl=(e,t,n)=>t in e?kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var E=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ml=(e,t)=>{for(var n in t)kr(e,n,{get:t[n],enumerable:!0})};var c=(e,t,n)=>Rl(e,typeof t!="symbol"?t+"":t,n);var Ln,hi=E(()=>{Ln="attribute vec2 a_start;attribute vec2 a_end;attribute float a_color_start;attribute float a_color_end;attribute float a_corner;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform vec2 u_color_range;uniform sampler2D u_gradient_lut;varying float v_edge_dist;varying vec3 v_color;float A(float B,float C,float D){if(D<=C){return 0.5;}else if(C<0.&&D>0.){float E=max(-C,D);return clamp(0.5+0.5*(B/E),0.,1.);}return clamp((B-C)/(D-C),0.,1.);}void main(){float C=u_color_range.x;float D=u_color_range.y;float F=0.5*(a_color_start+a_color_end);float G=A(F,C,D);v_color=texture2D(u_gradient_lut,vec2(G,0.5)).rgb;vec4 H=u_projection*vec4(a_start,0.,1.);vec4 I=u_projection*vec4(a_end,0.,1.);vec2 J=H.xy*u_resolution*0.5;vec2 K=I.xy*u_resolution*0.5;vec2 L=K-J;float M=length(L);L=M>0.001?L/M:vec2(1.,0.);vec2 N=vec2(-L.y,L.x);float O=step(1.5,a_corner);float P=1.-mod(a_corner,2.)*2.;vec4 Q=mix(H,I,O);float R=(u_line_width+1.5)*0.5;vec2 S=(N*P*R)/(u_resolution*0.5);gl_Position=Q+vec4(S,0.,0.);v_edge_dist=P;}"});var Tn,yi=E(()=>{Tn="precision highp float;uniform float u_line_width;varying float v_edge_dist;varying vec3 v_color;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(v_color,C);}"});var wn,xi=E(()=>{wn="attribute vec2 a_position;attribute float a_color_value;attribute float a_size_value;uniform mat4 u_projection;uniform float u_point_size;uniform vec2 u_color_range;uniform vec2 u_size_range;uniform vec2 u_point_size_range;varying float v_color_t;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);float A=u_size_range.y-u_size_range.x;if(A>0.){float B=clamp((a_size_value-u_size_range.x)/A,0.,1.);gl_PointSize=mix(u_point_size_range.x,u_point_size_range.y,B);}else{gl_PointSize=u_point_size;}v_point_size=gl_PointSize;float C=u_color_range.x;float D=u_color_range.y;if(D<=C){v_color_t=0.5;}else if(C<0.&&D>0.){float E=max(-C,D);v_color_t=clamp(0.5+0.5*(a_color_value/E),0.,1.);}else{v_color_t=clamp((a_color_value-C)/(D-C),0.,1.);}}"});var Rn,Ci=E(()=>{Rn="precision highp float;varying float v_color_t;varying float v_point_size;uniform sampler2D u_gradient_lut;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5){discard;}float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);vec4 E=texture2D(u_gradient_lut,vec2(clamp(v_color_t,0.,1.),0.5));gl_FragColor=vec4(E.rgb,E.a*D);}"});var gt,_i=E(()=>{gt="attribute vec2 a_corner;attribute vec2 a_position;attribute float a_color_value;uniform vec2 u_radius_ndc;uniform mat4 u_projection;uniform vec2 u_color_range;varying vec2 v_uv;varying float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}"});var Un,vi=E(()=>{Un="precision highp float;uniform float u_intensity;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);float B=max(0.,1.-A);B=B*B*u_intensity;if(B<=0.){discard;}gl_FragColor=vec4(B,B*v_color_t,0.,0.);}"});var On,Ai=E(()=>{On="precision highp float;varying vec2 v_uv;varying float v_color_t;void main(){float A=length(v_uv);if(A>=1.){discard;}float B=(v_color_t-0.5)*2.;gl_FragColor=vec4(max(0.,B),max(0.,-B),0.,0.);}"});var Ur,Nr=E(()=>{Ur=`#version 300 es\nin vec2 a_corner;in vec2 a_position;in float a_color_value;uniform mat4 u_projection;uniform vec2 u_radius_ndc;uniform vec2 u_color_range;out vec2 v_uv;out float v_color_t;void main(){vec4 A=u_projection*vec4(a_position,0.,1.);gl_Position=A+vec4(a_corner*u_radius_ndc*A.w,0.,0.);v_uv=a_corner;float B=u_color_range.x;float C=u_color_range.y;if(C<=B){v_color_t=0.5;}else if(B<0.&&C>0.){float D=max(-B,C);v_color_t=clamp(0.5+0.5*(a_color_value/D),0.,1.);}else{v_color_t=clamp((a_color_value-B)/(C-B),0.,1.);}}`});var Vr,Or=E(()=>{Vr=`#version 300 es\nprecision highp float;uniform float u_intensity;in vec2 v_uv;in float v_color_t;layout(location=0)out vec4 A;layout(location=1)out vec4 B;void main(){float C=length(v_uv);float D=max(0.0f,1.0f-C);D=D*D*u_intensity;if(D<=0.0f){discard;}A=vec4(D,D*v_color_t,0.0f,0.0f);float E=(v_color_t-0.5f)*2.0f;B=vec4(max(0.0f,E),max(0.0f,-E),0.0f,0.0f);}`});var Vn,Li=E(()=>{Vn="attribute vec2 a_corner;varying vec2 v_uv;void main(){v_uv=a_corner*0.5+0.5;gl_Position=vec4(a_corner,0.,1.);}"});var Hn,Ti=E(()=>{Hn="precision highp float;uniform sampler2D u_heat;uniform sampler2D u_extreme;uniform sampler2D u_gradient_lut;uniform float u_heat_max;uniform int u_color_mode;varying vec2 v_uv;void main(){vec4 A=texture2D(u_heat,v_uv);float B=A.r;float C=A.g;if(B<=0.){discard;}float D;float E;float F=clamp(B/max(u_heat_max,1e-4),0.,1.);if(u_color_mode==0){D=pow(F,0.6);E=clamp(B,0.,1.);}else if(u_color_mode==2){vec4 G=texture2D(u_extreme,v_uv);float H=G.r;float I=G.g;float J=max(H,I);if(J<=0.){D=0.5;}else if(H>=I){D=clamp(0.5+H*0.5,0.5,1.);}else{D=clamp(0.5-I*0.5,0.,0.5);}E=F;}else if(u_color_mode==3){float K=C-0.5*B;float L=clamp(abs(K)/max(u_heat_max,1e-4),0.,1.);float M=K>=0.?1.:-1.;D=clamp(0.5+0.5*M*L,0.,1.);E=L;}else{D=clamp(C/B,0.,1.);E=F;}vec4 N=texture2D(u_gradient_lut,vec2(D,0.5));gl_FragColor=vec4(N.rgb,N.a*E);}"});var Yn,wi=E(()=>{Yn="attribute vec2 a_corner;uniform mat4 u_projection;uniform vec2 u_extent_min;uniform vec2 u_extent_max;uniform vec2 u_uv_min;uniform vec2 u_uv_max;varying vec2 v_uv;void main(){vec2 A=mix(u_extent_min,u_extent_max,a_corner);vec2 B=mix(u_uv_min,u_uv_max,vec2(a_corner.x,1.-a_corner.y));v_uv=B;gl_Position=u_projection*vec4(A,0.,1.);}"});var zn,Ri=E(()=>{zn="precision highp float;varying vec2 v_uv;uniform sampler2D u_tile;uniform float u_alpha;void main(){vec4 A=texture2D(u_tile,v_uv);gl_FragColor=vec4(A.rgb,A.a*u_alpha);}"});function ru(e,t){if(t.width<=0||t.height<=0)return e;let n=e.xMax-e.xMin,o=e.yMax-e.yMin;if(n<=0||o<=0)return e;let i=t.width/t.height;if(n/o<i){let s=(e.xMin+e.xMax)/2,a=o*i/2;return{xMin:s-a,xMax:s+a,yMin:e.yMin,yMax:e.yMax}}else{let s=(e.yMin+e.yMax)/2,a=n/i/2;return{xMin:e.xMin,xMax:e.xMax,yMin:s-a,yMax:s+a}}}var ht,$n=E(()=>{"use strict";ht=class{constructor(){c(this,"me",1);c(this,"fe",1);c(this,"ve",0);c(this,"Ae",0);c(this,"vt",0);c(this,"At",1);c(this,"Lt",0);c(this,"Tt",1);c(this,"He",null);c(this,"si",!1);c(this,"go",!1);c(this,"ho",!1);c(this,"wt",null);c(this,"Rt",null);c(this,"Mn",null);c(this,"yo",!1);c(this,"xo",0);c(this,"Co",0);c(this,"Fn",null);c(this,"Sn",null);c(this,"Dn",null);c(this,"Bn",null)}get lockedAxis(){return this.He}get scaleX(){return this.me}get scaleY(){return this.fe}set scaleX(t){this.me=t}set scaleY(t){this.fe=t}get normTranslateX(){return this.ve}get normTranslateY(){return this.Ae}set normTranslateX(t){this.ve=t}set normTranslateY(t){this.Ae=t}get baseXRange(){return this.At-this.vt}get baseYRange(){return this.Tt-this.Lt}setBaseDomain(t,n,o,i){let r=n-t;if(this.isXDefault()||!this.go)this.vt=t,this.At=n;else{let a=this.At-this.vt,l=(this.vt+this.At)/2+this.ve*a;this.vt=t,this.At=n,this.ve=r>0?(l-(t+n)/2)/r:0}let s=i-o;if(this.isYDefault()||!this.ho)this.Lt=o,this.Tt=i;else{let a=this.Tt-this.Lt,l=(this.Lt+this.Tt)/2+this.Ae*a;this.Lt=o,this.Tt=i,this.Ae=s>0?(l-(o+i)/2)/s:0}}pinAxis(t){t==="x"?this.go=!0:this.ho=!0}unpinAxis(t){t==="x"?this.go=!1:this.ho=!1}configure(t){this.He=t.lockAxis??null,this.si=t.lockAspect??!1,this.He==="x"?(this.me=1,this.ve=0):this.He==="y"&&(this.fe=1,this.Ae=0)}isXDefault(){return this.me===1&&this.ve===0}isYDefault(){return this.fe===1&&this.Ae===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.At-this.vt,n=this.Tt-this.Lt,o=t/this.me,i=n/this.fe,r=(this.vt+this.At)/2+this.ve*t,s=(this.Lt+this.Tt)/2+this.Ae*n,a={xMin:r-o/2,xMax:r+o/2,yMin:s-i/2,yMax:s+i/2};return this.si&&this.Rt?ru(a,this.Rt.t):a}attach(t,n,o){this.detach(),this.wt=t,this.Rt=n,this.Mn=o,this.Fn=i=>{i.preventDefault();let r=t.getBoundingClientRect(),s=i.clientX-r.left,a=i.clientY-r.top,l=this.Rt.t;if(s<l.x||s>l.x+l.width||a<l.y||a>l.y+l.height)return;let u=(s-l.x)/l.width,m=(a-l.y)/l.height,f=this.me,b=this.fe,p=Math.pow(1.1,-i.deltaY/100);this.He!=="x"&&(this.me=Math.max(1,Math.min(1e5,this.me*p))),this.He!=="y"&&(this.fe=Math.max(1,Math.min(1e5,this.fe*p))),this.He!=="x"&&f!==this.me&&(this.ve+=(u-.5)*(1/f-1/this.me)),this.He!=="y"&&b!==this.fe&&(this.Ae+=(.5-m)*(1/b-1/this.fe)),this.Mn()},this.Sn=i=>{let r=t.getBoundingClientRect(),s=i.clientX-r.left,a=i.clientY-r.top,l=this.Rt.t;s>=l.x&&s<=l.x+l.width&&a>=l.y&&a<=l.y+l.height&&(this.yo=!0,this.xo=i.clientX,this.Co=i.clientY,t.setPointerCapture(i.pointerId))},this.Dn=i=>{if(!this.yo)return;let r=i.clientX-this.xo,s=i.clientY-this.Co;this.xo=i.clientX,this.Co=i.clientY;let a=this.Rt.t;this.He!=="x"&&a.width>0&&(this.ve-=r/(a.width*this.me)),this.He!=="y"&&a.height>0&&(this.Ae+=s/(a.height*this.fe)),this.Mn()},this.Bn=()=>{this.yo=!1},t.addEventListener("wheel",this.Fn,{passive:!1}),t.addEventListener("pointerdown",this.Sn),t.addEventListener("pointermove",this.Dn),t.addEventListener("pointerup",this.Bn)}updateLayout(t){this.Rt=t}detach(){this.wt&&(this.Fn&&this.wt.removeEventListener("wheel",this.Fn),this.Sn&&this.wt.removeEventListener("pointerdown",this.Sn),this.Dn&&this.wt.removeEventListener("pointermove",this.Dn),this.Bn&&this.wt.removeEventListener("pointerup",this.Bn)),this.wt=null,this.Mn=null}reset(){this.me=1,this.fe=1,this.ve=0,this.Ae=0}serialize(){return{scaleX:this.me,scaleY:this.fe,normTranslateX:this.ve,normTranslateY:this.Ae}}restore(t){this.me=t.scaleX,this.fe=t.scaleY,this.ve=t.normTranslateX,this.Ae=t.normTranslateY}}});function Fi(e,t){let n=t??su[e]??{};return new Intl.NumberFormat(navigator.languages,n)}function Si(e){if(!e||e.format!=="custom"){let n={timeZone:e?.timeZone,dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??$r.dateStyle,timeStyle:e?.timeStyle==="disabled"?void 0:e?.timeStyle??$r.timeStyle};return new Intl.DateTimeFormat(navigator.languages,n)}let t={timeZone:e.timeZone,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(t.year=e.year??"2-digit"),e.month!=="disabled"&&(t.month=e.month??"numeric"),e.day!=="disabled"&&(t.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(t.weekday=e.weekday),e.hour!=="disabled"&&(t.hour=e.hour??"numeric"),e.minute!=="disabled"&&(t.minute=e.minute??"numeric"),e.second!=="disabled"&&(t.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,t)}function jr(e){let t={timeZone:"utc",dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??au.dateStyle};return new Intl.DateTimeFormat(navigator.languages,t)}function Di(e){return e.split("|").at(-1)??e}var su,$r,au,Zr=E(()=>{"use strict";su={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},$r={dateStyle:"short",timeStyle:"medium"},au={dateStyle:"short"}});var Zn,qr=E(()=>{"use strict";Zn=class{constructor(t,n=128){c(this,"Vt");c(this,"m",new Map);c(this,"ye",new Map);c(this,"ai");this.Vt=t,this.ai=n}async fetchRow(t){if(!this.Vt)throw new Error("LazyRowFetcher disposed");let n=this.m.get(t);if(n)return this.m.delete(t),this.m.set(t,n),n;let o=this.ye.get(t);if(o)return o;let i=this.ki(t);this.ye.set(t,i);try{let r=await i;if(!this.Vt)return r;if(this.m.set(t,r),this.m.size>this.ai){let s=this.m.keys().next().value;s!==void 0&&this.m.delete(s)}return r}finally{this.ye.delete(t)}}async ki(t){let n=this.Vt;if(!n)throw new Error("LazyRowFetcher disposed");let o=new Map;return await n.with_typed_arrays({start_row:t,end_row:t+1,float32:!0},(i,r,s,a)=>{for(let l=0;l<i.length;l++){let u=i[l];if(u.startsWith("__"))continue;let m=r[l],f=s[l],b=a[l];(f?!(f[0]>>0&1):!1)?o.set(u,null):b?o.set(u,b[m[0]]):o.set(u,m[0])}}),o}dispose(){this.Vt=null,this.m.clear(),this.ye.clear()}get isDisposed(){return this.Vt===null}}});function Kr(e,t){let n=Math.floor(Math.log10(e)),o=e/Math.pow(10,n),i;return t?o<1.5?i=1:o<3?i=2:o<7?i=5:i=10:o<=1?i=1:o<=2?i=2:o<=5?i=5:i=10,i*Math.pow(10,n)}function se(e,t,n){n<1&&(n=1);let o=Kr(t-e,!1),i=Kr(o/n,!0),r=Math.ceil(e/i)*i,s=Math.floor(t/i)*i,a=[];for(let l=r;l<=s+i*.001;l+=i)a.push(l);return a}function ae(e){let t=Math.abs(e);return t===0?"0":t>=1e9?(e/1e9).toFixed(1)+"B":t>=1e6?(e/1e6).toFixed(1)+"M":t>=1e3?(e/1e3).toFixed(1)+"K":Number.isInteger(e)?e.toString():t>=1?e.toFixed(1):e.toFixed(2)}function he(e,t){let n=new Date(e);return isNaN(n.getTime())?ae(e):t!==void 0&&t>0?t>=864e5*28?n.toLocaleDateString(void 0,{year:"numeric",month:"short"}):t>=864e5?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):t>=36e5?n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric"}):t>=6e4?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}):n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var ve=E(()=>{"use strict"});var Jr,Qr,es=E(()=>{"use strict";Jr={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},Qr={auto_alt_y_axis:!1,facet_mode:"grid",facet_zoom_mode:"shared",series_zoom_mode:"dynamic",include_zero:!1,domain_mode:"expand",line_width_px:2,point_size_px:8,band_inner_frac:.5,bar_inner_pad:.1,wick_width_px:1,ohlc_line_width_px:1,gradient_radius_px:32,gradient_intensity:.6,gradient_heat_max:4,gradient_color_mode:"mean",map_tile_provider:"carto-positron",map_tile_alpha:1}});function Be(e,t,n,o,i,r,s={}){if(!e)return;let a=e.getContext("2d");if(!a)return;a.save(),a.setTransform(1,0,0,1,0,0),a.scale(r,r),a.font=`11px ${i.fontFamily}`;let l=16,u=8,m=0;for(let h of n){let y=a.measureText(h).width;y>m&&(m=y)}let f=m+u*2,b=n.length*l+u*2-4,p=t.px+12,d=t.py-b-8;p+f>o.cssWidth&&(p=t.px-f-12),d<0&&(d=t.py+12),d+b>o.cssHeight&&(d=o.cssHeight-b-4);let g=n.length>0;if(s.crosshair&&(a.strokeStyle=i.Mt,a.globalAlpha=.3,a.lineWidth=1,a.setLineDash([4,4]),a.beginPath(),a.moveTo(t.px,o.t.y),a.lineTo(t.px,o.t.y+o.t.height),a.moveTo(o.t.x,t.py),a.lineTo(o.t.x+o.t.width,t.py),a.stroke(),a.setLineDash([]),a.globalAlpha=1),s.highlightRadius&&s.highlightRadius>0&&(a.strokeStyle=i.Mt,a.globalAlpha=.8,a.lineWidth=2,a.beginPath(),a.arc(t.px,t.py,s.highlightRadius,0,Math.PI*2),a.stroke(),a.globalAlpha=1),g){a.fillStyle=i.In,a.strokeStyle=i.li,a.lineWidth=1,a.beginPath(),a.roundRect(p,d,f,b,4),a.fill(),a.stroke(),a.fillStyle=i.ui,a.textAlign="left",a.textBaseline="top";for(let h=0;h<n.length;h++)a.fillText(n[h],p+u,d+u+h*l)}a.restore()}var qn,yt=E(()=>{"use strict";qn=class{constructor(){c(this,"Be",null);c(this,"Ht",0);c(this,"Yt",null);c(this,"Kt",null);c(this,"dt",!1)}get isPinned(){return this.dt}setHost(t){this.dt&&(this.Kt?.dismiss(),this.dt=!1),this.Kt=t}setCursor(t){this.Kt?.setCursor(t)}attach(t){this.detach(),this.Be=t}detach(){this.Ht&&(cancelAnimationFrame(this.Ht),this.Ht=0),this.Yt!==null&&(clearTimeout(this.Yt),this.Yt=null),this.Be=null}dispatchHover(t,n){if(this.dt||!this.Be||this.Ht||this.Yt!==null)return;let o=()=>{this.Ht=0,this.Yt=null,this.Be?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.Ht=requestAnimationFrame(o):this.Yt=setTimeout(o,16)}dispatchLeave(){this.dt||!this.Be||this.Be.onLeave()}dispatchClick(t,n){if(this.Be&&!this.Be.onClickPre?.(t,n)){if(this.dt){let o=this.Be;this.dismiss(),o.onUnpin?.();return}this.Be.onPin?.(t,n)}}dispatchDblClick(t,n){this.Be?.onDblClick?.(t,n)}pin(t,n,o){t.length!==0&&(this.Kt?.pin(t,n,o),this.dt=!0)}dismiss(){this.Kt?.dismiss(),this.dt=!1}}});function Kn(e){let t=e.trim();if(t.startsWith("#")){let o=t.slice(1);return o.length===3&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]),[parseInt(o.slice(0,2),16)/255,parseInt(o.slice(2,4),16)/255,parseInt(o.slice(4,6),16)/255]}let n=t.match(/rgba?\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)/);return n?[+n[1]/255,+n[2]/255,+n[3]/255]:[.5,.5,.5]}var Bi=E(()=>{"use strict"});function ts(e){if(!e)return it.slice();let t=e.trim();if(!t)return it.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return it.slice();let o=t.lastIndexOf(")");if(o<=n)return it.slice();let i=t.substring(n+1,o),r=[],s=0,a=0;for(let b=0;b<i.length;b++){let p=i[b];p==="("?s++:p===")"?s--:p===","&&s===0&&(r.push(i.substring(a,b)),a=b+1)}r.push(i.substring(a));let l=[],u=0;if(r.length>0){let b=r[0].trim().toLowerCase();(b.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(b))&&(u=1)}for(let b=u;b<r.length;b++){let p=r[b].trim();if(!p)continue;let d=p.match(/\\s([\\-\\d.]+)%\\s*$/),g=d?p.substring(0,d.index).trim():p,h=d?parseFloat(d[1])/100:null;try{let y=Kn(g);l.push({color:y,offset:h})}catch{}}if(l.length===0)return it.slice();if(l.length===1){let[b,p,d]=l[0].color;return[{offset:0,color:[b,p,d,1]},{offset:1,color:[b,p,d,1]}]}l[0].offset===null&&(l[0].offset=0),l[l.length-1].offset===null&&(l[l.length-1].offset=1);for(let b=1;b<l.length-1;b++){if(l[b].offset!==null)continue;let p=b+1;for(;p<l.length&&l[p].offset===null;)p++;let d=l[b-1].offset,g=l[p].offset,h=p-(b-1);for(let y=b;y<p;y++)l[y].offset=d+(y-(b-1))/h*(g-d);b=p-1}let m=0;return l.map(b=>{let p=Math.max(m,Math.min(1,b.offset));return m=p,{offset:p,color:[b.color[0],b.color[1],b.color[2],1]}})}function Ae(e,t){if(e.length===0)return[0,0,0,1];if(t<=e[0].offset)return e[0].color.slice();let n=e[e.length-1];if(t>=n.offset)return n.color.slice();let o=0,i=e.length-1;for(;i-o>1;){let u=o+i>>1;e[u].offset<=t?o=u:i=u}let r=e[o],s=e[i],a=s.offset-r.offset,l=a>0?(t-r.offset)/a:0;return[r.color[0]+(s.color[0]-r.color[0])*l,r.color[1]+(s.color[1]-r.color[1])*l,r.color[2]+(s.color[2]-r.color[2])*l,r.color[3]+(s.color[3]-r.color[3])*l]}function rt(e,t,n){if(!isFinite(e)||t===n)return .5;let o;if(t>=0?o=n:n<=0?o=-t:o=Math.max(-t,n),o<=0)return .5;let i=.5+.5*(e/o);return i<0?0:i>1?1:i}function ns(e){if(e.length===0)return it.slice();if(e.length===1){let[n,o,i]=e[0];return[{offset:0,color:[n,o,i,1]},{offset:1,color:[n,o,i,1]}]}let t=e.length-1;return e.map(([n,o,i],r)=>({offset:r/t,color:[n,o,i,1]}))}function os(e,t=256){let n=new Uint8Array(t*4);for(let o=0;o<t;o++){let i=t===1?0:o/(t-1),r=Ae(e,i);n[o*4]=Math.round(r[0]*255),n[o*4+1]=Math.round(r[1]*255),n[o*4+2]=Math.round(r[2]*255),n[o*4+3]=Math.round(r[3]*255)}return n}var it,Ie=E(()=>{"use strict";Bi();it=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function lu(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function is(e){return!isFinite(e)||e<0?1:e}function rs(e){let t=(r,s)=>e[r]||s,n=e["--psp-charts--gradient--background"]||e["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",o=ts(n),i=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;i.push(Kn(s))}return{fontFamily:t("--psp-charts--font-family",t("font-family","monospace")),backgroundColor:t("--psp--background-color","rgba(255, 255, 255, 1)"),Mt:t("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),xe:t("--psp--color","rgba(180, 0, 0, 0.9)"),_o:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),Pn:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),H:o,vo:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),Ni:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),In:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),ui:t("--psp-charts--tooltip--color","#161616"),li:t("--psp-charts--tooltip--border-color","#fff"),Ao:lu(parseFloat(t("--psp-charts--area--opacity","0.85"))),mi:is(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),fi:is(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),Ie:i}}var ss=E(()=>{"use strict";Bi();Ie()});function as(e,t){let n=Ot.get(e);n?n.fullRender=t:(n={glManager:e,fullRender:t,waiters:[]},Ot.set(e,n));let o=Promise.withResolvers();return n.waiters.push(o),Jn||(Jn=ms(us)),o.promise}function ls(e,t){if(!Ii.has(e)){t();return}let n=Qn.get(e);n||(n=[],Qn.set(e,n)),n.push(t)}async function us(){let e=Array.from(Ot.values());Ot.clear();let t=[];for(let n of e)try{n.glManager.applyPendingResize(),n.fullRender(),t.push(n)}catch(o){console.error("scheduler: fullRender threw",o);for(let i of n.waiters)i.reject(o)}await Promise.all(t.map(uu)),Jn=0,Ot.size>0&&(Jn=ms(us))}async function uu(e){Ii.add(e.glManager);try{await e.glManager.awaitGpuFence(),e.glManager.endFrame();for(let t of e.waiters)t.resolve()}catch(t){console.error("scheduler: present failed",t);try{e.glManager.endFrame()}catch{}for(let n of e.waiters)n.reject(t)}finally{Ii.delete(e.glManager);let t=Qn.get(e.glManager);if(t){Qn.delete(e.glManager);for(let n of t)try{n()}catch(o){console.error("scheduler: deferred op threw",o)}}}}function ms(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var Ot,Jn,Ii,Qn,Pi=E(()=>{"use strict";Ot=new Map,Jn=0,Ii=new Set,Qn=new Map});var fs,mu,fu,Le,Vt=E(()=>{"use strict";Zr();qr();ve();$n();es();yt();ss();Pi();fs=!0,mu=(()=>{if(fs)return ae;{let e=Fi("float");return t=>e.format(t)}})(),fu=(()=>{if(fs)return he;{let e=Si();return t=>e.format(t)}})(),Le=class{constructor(){c(this,"e",null);c(this,"D",null);c(this,"d",null);c(this,"ci",{});c(this,"b",null);c(this,"Jt",[]);c(this,"B",[]);c(this,"A",[]);c(this,"P",[]);c(this,"Pe",{});c(this,"En",!1);c(this,"Wn",!1);c(this,"pt",{});c(this,"Lo",{});c(this,"To",new Map);c(this,"Gn");c(this,"N",{...Jr});c(this,"h",{...Qr});c(this,"L",new qn);c(this,"wo",null);c(this,"kn",Promise.resolve());c(this,"Qt",null);c(this,"Le",null)}setGridlineCanvas(t){this.D=t}setChromeCanvas(t){this.d=t}setTheme(t){this.ci=t,this.Qt=null}setZoomController(t){this.b=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.N.zoom_mode==="shared")return this.b;if(!this.b)return null;let n=this.Jt[t];return n||(n=new ht,n.configure(this.getZoomConfig()),this.Jt[t]=n),n}computeEffectiveFacetFlags(){let t=this.N.zoom_mode==="independent",n=!t&&this.N.shared_x_axis,o=!t&&this.N.shared_y_axis;return this.En=n,this.Wn=o,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:o}}syncFacetZoomLayouts(t){let n=this.N.zoom_mode==="independent";for(let o=0;o<t.length;o++)if(this.getZoomControllerForFacet(o)?.updateLayout(t[o].layout),!n)return}setZoomBaseDomain(t,n,o,i){this.b&&this.b.setBaseDomain(t,n,o,i);for(let r of this.Jt)r&&r.setBaseDomain(t,n,o,i)}getZoomConfig(){return{}}setColumnSlots(t){this.B=t}setViewPivots(t,n){this.A=t,this.P=n}setColumnTypes(t){this.Pe=t,this.di()}resetExpandedDomain(){}setGroupByTypes(t){this.pt=t}setColumnsConfig(t){this.Lo=t??{},this.di()}di(){this.To=new Map;for(let[t,n]of Object.entries(this.Lo)){let o=this.Pe[t]??this.pt[t],i=this.Ui(o,n);i&&this.To.set(t,i)}}Ui(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let o=n.number_format;if(!o)return;let i=Fi(t,o);return r=>i.format(r)}if(t==="datetime"){let o=n.date_format;if(!o)return;let i=Si(o);return r=>i.format(r)}if(t==="date"){let o=n.date_format;if(!o)return;let i=jr(o);return r=>i.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.To.get(Di(t));if(r)return r}if(n==="tick")return;let o=t?Di(t):void 0,i=o?this.Pe[o]??this.pt[o]:void 0;return i==="date"||i==="datetime"?fu:mu}setDefaultChartType(t){this.Gn=t}setFacetConfig(t){this.N={...t}}setPluginConfig(t){this.h={...t},this.N={...this.N,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.Nn=t.series_zoom_mode==="dynamic"}T(){return this.Qt||(this.Qt=rs(this.ci)),this.Qt}invalidateTheme(){this.Qt=null}setView(t){this.Le&&this.Le.dispose(),this.Le=new Zn(t);let n=this.L.isPinned;this.L.dismiss(),n&&this.emitUnselect()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this.L.attach(this.tooltipCallbacks()),this.L.setHost(t),this.wo=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.Le)try{let i=await this.Le.fetchRow(t.rowIdx);n=Object.fromEntries(i)}catch{n={}}let o=[];for(let i=0;i<this.A.length;i++){let r=t.groupByValues[i];r!=null&&r!==""&&o.push([this.A[i],"==",r])}for(let i=0;i<this.P.length;i++){let r=t.splitByValues[i];r!=null&&r!==""&&o.push([this.P[i],"==",r])}return{row:n,column_names:[t.columnName],config:{filter:o}}}emitUserClick(t){let n={row:t.row,column_names:t.column_names,config:t.config};this.wo?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.wo?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this.kn.then(async()=>{let o=await this.buildClickDetail(t);this.emitUserClick(o),this.emitUserSelect({selected:!0,row:o.row,column_names:o.column_names,insertConfig:o.config})});return this.kn=n.catch(o=>{console.error("emitClickAndSelect failed",o)}),n}emitUnselect(t={}){let n=this.kn.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this.kn=n.catch(o=>{console.error("emitUnselect failed",o)})}requestRender(t){return as(t,()=>this.Ft(t))}destroy(){this.L.detach(),this.L.dismiss(),this.Le&&(this.Le.dispose(),this.Le=null),this.destroyInternal()}}});var eo,cs=E(()=>{"use strict";eo=class{constructor(t,n,o,i,r){c(this,"Ze",new Map);c(this,"ce");c(this,"Ce");c(this,"St");c(this,"pi");this.ce=t,this.Ce=o,this.St=r,this.pi=Math.max(1,Math.ceil((n-t)/r))}bi(t,n){return n*this.pi+t}insert(t,n,o){let i=Math.floor((n-this.ce)/this.St),r=Math.floor((o-this.Ce)/this.St),s=this.bi(i,r),a=this.Ze.get(s);a||(a=[],this.Ze.set(s,a)),a.push(t)}query(t,n,o,i,r,s,a){let l=Math.ceil(o/i/this.St),u=Math.ceil(o/r/this.St),m=Math.floor((t-this.ce)/this.St),f=Math.floor((n-this.Ce)/this.St),b=-1,p=o*o;for(let d=f-u;d<=f+u;d++)for(let g=m-l;g<=m+l;g++){let h=this.Ze.get(this.bi(g,d));if(h)for(let y of h){let x=(s[y]-t)*i,C=(a[y]-n)*r,_=x*x+C*C;_<p&&(p=_,b=y)}}return b}}});var to,ds=E(()=>{"use strict";cs();to=class{constructor(){c(this,"en",null);c(this,"tn",!0)}markDirty(){this.tn=!0}get isDirty(){return this.tn}rebuild(t,n,o){if(n===0){this.en=null,this.tn=!1;return}let i=t.xMax-t.xMin||1,r=t.yMax-t.yMin||1,a=(i+r)/2/Math.max(1,Math.sqrt(n)),l=new eo(t.xMin,t.xMax,t.yMin,t.yMax,a);o((u,m,f)=>l.insert(u,m,f)),this.en=l,this.tn=!1}query(t,n,o,i,r,s,a){return!this.en||!s||!a?-1:this.en.query(t,n,o,i,r,s,a)}clear(){this.en=null,this.tn=!0}}});function Ve(e,t,n=[]){let o=new Map;for(let r of e.keys()){if(r.startsWith("__"))continue;let s=r.lastIndexOf("|");if(s===-1)continue;let a=r.substring(0,s);o.has(a)||o.set(a,new Set),o.get(a).add(r)}let i=[];for(let[r,s]of o){let a=new Map,l=!0;for(let u of t){if(!u)continue;let m=`${r}|${u}`,f=e.get(m);if(!s.has(m)||!f?.values){l=!1;break}a.set(u,m)}if(l){for(let u of n){if(!u)continue;let m=`${r}|${u}`;s.has(m)&&e.get(m)?.values&&a.set(u,m)}i.push({prefix:r,colNames:a})}}return i}var Ht=E(()=>{"use strict"});var no,ps=E(()=>{"use strict";no=class{constructor(t){c(this,"data");c(this,"dictionary",[]);c(this,"dictMap",new Map);this.data=new Int32Array(t),this.data.fill(-1)}set(t,n){let o=this.dictMap.get(n);return o===void 0&&(o=this.dictionary.length,this.dictionary.push(n),this.dictMap.set(n,o)),this.data[t]=o,o}get(t){let n=this.data[t];return n<0?null:this.dictionary[n]}}});function bs(e,t,n,o){let i;if(!e)i="(null)";else{let s=e.valid;if(!(s?!!(s[t>>3]>>(t&7)&1):!0))i="(null)";else if(e.indices&&e.dictionary)i=e.dictionary[e.indices[t]]??"(null)";else if(e.values){let l=e.values[t];i=l==null?"(null)":String(l)}else i="(null)"}let r=o.get(i);return r===void 0&&(r=n.length,n.push(i),o.set(i,r)),r}function cu(e,t,n,o,i,r){let s=t?[t,n]:[n],a=[];return o&&a.push(o),i&&a.push(i),r&&a.push(r),Ve(e,s,a).map(l=>({prefix:l.prefix,xColName:t?l.colNames.get(t):"",yColName:l.colNames.get(n),colorColName:o?`${l.prefix}|${o}`:"",sizeColName:i?`${l.prefix}|${i}`:"",labelColName:r?`${l.prefix}|${r}`:""}))}function gs(e,t,n,o){e.glyph.ensureProgram(e,t);let i=e.s,r=e.j;e.h.domain_mode==="expand"?(e.ce=e.nn,e.qe=e.on,e.Ce=e.rn,e.Ke=e.sn,e.c=e.Un,e.f=e.On,e.Je=e.Vn,e.Qe=e.Hn):(e.ce=1/0,e.qe=-1/0,e.Ce=1/0,e.Ke=-1/0,e.c=1/0,e.f=-1/0,e.Je=1/0,e.Qe=-1/0,e.nn=1/0,e.on=-1/0,e.rn=1/0,e.sn=-1/0,e.Un=1/0,e.On=-1/0,e.Vn=1/0,e.Hn=-1/0),e.R=NaN,e.M=NaN,e.bt=0,e.zt.clear(),e.Ro=0;let a=e.B,l=a[0]||"",u=a[1]||"",m=a[2]||"",f=a[3]||"",b=a[4]||"";e.Ee=l,e.Te=u,e.gi=!l,e.we=!!l&&e.Pe[l]==="string",e.de=!!u&&e.Pe[u]==="string",e.Xt=[],e.$t=[],e.yi=new Map,e.xi=new Map,e.et=null,e.tt=null,e.we&&(e.R=0,e.ce=0,e.qe=0,e.nn=1/0,e.on=-1/0),e.de&&(e.M=0,e.Ce=0,e.Ke=0,e.rn=1/0,e.sn=-1/0);let p=t.C.totalCapacity||o;if(e.P.length>0){if(e._=cu(n,l,u,m,f,b),e._.length===0){e.w=0,e.U=[];return}if(e.Ye=e._[0].xColName,e.We=e._[0].yColName,e.s=m,e.K=f,e.Yn=b,e.j=!1,m){let h=n.get(e._[0].colorColName);e.j=h?.type==="string"}t.ensureBufferCapacity(p*e._.length)}else if(e._=[],e.Ye=l,e.We=u,e.s=m,e.K=f,e.Yn=b,e.j=!1,e.s){let h=n.get(e.s);e.j=h?.type==="string"}(e.s!==i||e.j!==r)&&(e.u=new Map);let d=Math.max(1,e._.length);e.w=p,e.U=new Array(d).fill(0);let g=d*p;e.O=new Float32Array(g),e.V=new Float32Array(g),e.gt=new Float32Array(g),e.Dt=new Int32Array(g),e.Bt=b?new no(g):null}function hs(e,t,n,o,i,r){if(!e.We)return;let s=i;if(s===0||e.w===0)return;let a=e._.length>0,l=[];if(a)for(let d of e._){let g=d.xColName?n.get(d.xColName):null,h=n.get(d.yColName);if(!h||!e.de&&!h.values)continue;let y=d.sizeColName?n.get(d.sizeColName):null,x=d.colorColName?n.get(d.colorColName)??null:null,C=d.labelColName?n.get(d.labelColName)??null:null;l.push({xCol:g?.values??null,yCol:h.values??null,xColData:g??null,yColData:h,xValid:g?.valid,yValid:h.valid,colorCol:x,sizeCol:y?.values??null,labelCol:C})}else{let d=e.Ye?n.get(e.Ye):null,g=e.We?n.get(e.We):null;if(!g||!e.de&&!g.values)return;let h=e.s?n.get(e.s)??null:null,y=e.Yn?n.get(e.Yn)??null:null;l.push({xCol:d?.values??null,yCol:g.values??null,xColData:d??null,yColData:g,xValid:d?.valid,yValid:g?.valid,colorCol:h,sizeCol:null,labelCol:y})}if(l.length===0)return;e.Ci<s&&(e.Mo=new Float32Array(s*2),e.Fo=new Float32Array(s),e.So=new Float32Array(s),e.Ci=s);let u=e.Mo,m=e.Fo,f=e.So,b=!a&&e.K?n.get(e.K)?.values??null:null;if(e.j&&e.s){for(let d of l){let g=d.colorCol?.dictionary;if(g)for(let h=0;h<g.length;h++){let y=g[h];e.u.has(y)||e.u.set(y,e.u.size)}}e.u.size>0&&(e.c=0,e.f=e.u.size-1)}!e.s&&e._.length>1&&(e.c=0,e.f=e._.length-1);for(let d=0;d<l.length;d++){let g=l[d],h=e.U[d]??0,y=d*e.w,x=e.w-h;if(x<=0)continue;let C=g.colorCol?.valid,_=0;for(let w=0;w<s&&_<x;w++){let L=w;if(!e.de&&g.yValid&&!(g.yValid[L>>3]>>(L&7)&1)||!e.we&&g.xCol&&g.xValid&&!(g.xValid[L>>3]>>(L&7)&1))continue;let T=C!==void 0&&!(C[L>>3]>>(L&7)&1),F;if(e.de)F=bs(g.yColData,L,e.$t,e.xi);else if(g.yCol){if(F=g.yCol[L],isNaN(F))continue}else continue;let W;if(e.we)W=bs(g.xColData,L,e.Xt,e.yi);else if(g.xCol){if(W=g.xCol[L],isNaN(W))continue}else W=o+L;let[P,B]=e.projectPoint(W,F);if(isNaN(P)||isNaN(B))continue;P<e.ce&&(e.ce=P),P>e.qe&&(e.qe=P),B<e.Ce&&(e.Ce=B),B>e.Ke&&(e.Ke=B),isNaN(e.R)&&(e.R=P),isNaN(e.M)&&(e.M=B);let k=P-e.R,N=B-e.M,O=y+h+_;e.O[O]=k,e.V[O]=N,e.Dt[O]=o+L,u[_*2]=k,u[_*2+1]=N;let U=g.colorCol;if(T)m[_]=.5,e.gt[O]=.5;else if(U&&!e.j&&U.values){let S=U.values[L];m[_]=S,e.gt[O]=S,S<e.c&&(e.c=S),S>e.f&&(e.f=S)}else if(U&&e.j&&U.indices&&U.dictionary){let S=U.dictionary[U.indices[L]];e.u.has(S)||(e.u.set(S,e.u.size),e.f=e.u.size-1);let X=e.u.get(S);m[_]=X,e.gt[O]=X}else m[_]=d,e.gt[O]=d;if(e.Bt&&g.labelCol){let S=g.labelCol,X=S.valid;!(X!==void 0&&!(X[L>>3]>>(L&7)&1))&&S.indices&&S.dictionary&&e.Bt.set(O,S.dictionary[S.indices[L]])}if(g.sizeCol){let S=g.sizeCol[L];f[_]=S,S<e.Je&&(e.Je=S),S>e.Qe&&(e.Qe=S)}else if(b){let S=b[L];f[_]=S,S<e.Je&&(e.Je=S),S>e.Qe&&(e.Qe=S)}else f[_]=0;_++}if(_===0)continue;let v=(y+h)*2*Float32Array.BYTES_PER_ELEMENT;t.C.upload("a_position",u.subarray(0,_*2),v,2);let A=(y+h)*Float32Array.BYTES_PER_ELEMENT;t.C.upload("a_color_value",m.subarray(0,_),A),t.C.upload("a_size_value",f.subarray(0,_),A),e.U[d]=h+_,e.U[d]>e.Ro&&(e.Ro=e.U[d])}let p=0;for(let d of e.U)p+=d;e.bt=p,t.uploadedCount=p,e.zt.markDirty(),isFinite(e.ce)&&e.setZoomBaseDomain(e.ce,e.qe,e.Ce,e.Ke)}var ys=E(()=>{"use strict";Ht();ps()});function oo(e,t,n,o,i){let r=e.getContext("2d");r&&(r.save(),r.setTransform(1,0,0,1,0,0),r.scale(i,i),r.font=`11px ${o.fontFamily}`,r.fillStyle=o.xe,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var Ei=E(()=>{"use strict"});var ee,He=E(()=>{"use strict";ee=class{constructor(t,n,o){c(this,"margins");c(this,"t");c(this,"cssWidth");c(this,"cssHeight");c(this,"Z",0);c(this,"ie",1);c(this,"J",0);c(this,"re",1);this.cssWidth=t,this.cssHeight=n;let r=(o.leftExtra??55)+(o.hasYLabel?16:0),a=(o.bottomExtra??24)+(o.hasXLabel?18:0),l=0,u=o.rightExtra??(o.hasLegend?80:16),m=o.originX??0,f=o.originY??0,b=o.cellWidth??t,p=o.cellHeight??n,d=m+r,g=f+l,h=Math.max(1,b-r-u),y=Math.max(1,p-l-a),x=t-(d+h),C=n-(g+y);this.margins={top:g,right:x,bottom:C,left:d},this.t={x:d,y:g,width:h,height:y}}buildProjectionMatrix(t,n,o,i,r,s,a=.02,l=0,u=0){let m=n-t,f=i-o;m===0&&(m=1),f===0&&(f=1);let b=m*a,p=f*a,d=s&&r==="y"&&o>=0,g=s&&r==="y"&&i<=0,h=s&&r==="x"&&t>=0,y=s&&r==="x"&&n<=0;t-=b,n+=b,o-=p,i+=p,d?(o=0,i+=p):g&&(i=0,o-=p),h?(t=0,n+=b):y&&(n=0,t-=b),this.Z=t,this.ie=n,this.J=o,this.re=i;let x=2*this.margins.left/this.cssWidth-1,C=1-2*this.margins.right/this.cssWidth,_=2*this.margins.bottom/this.cssHeight-1,v=1-2*this.margins.top/this.cssHeight,A=(C-x)/(n-t),w=(v-_)/(i-o),L=x-A*(t-l),T=_-w*(o-u);return new Float32Array([A,0,0,0,0,w,0,0,0,0,-1,0,L,T,0,1])}E(t,n){let{x:o,y:i,width:r,height:s}=this.t,a=(t-this.Z)/(this.ie-this.Z),l=(n-this.J)/(this.re-this.J);return{px:o+a*r,py:i+(1-l)*s}}}});function xs(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function Cs(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function xu(e,t,n,o){if(e<=1)return{cols:1,rows:1};let i=1,r=e,s=1/0,a=e;for(let l=1;l<=e;l++){let u=Math.ceil(e/l),m=Math.max(1,(t-(l-1)*o)/l),f=Math.max(1,(n-(u-1)*o)/u),b=m/f,p=Math.max(b,1/b),d=l*u;(p<s||p===s&&d<a)&&(i=l,r=u,s=p,a=d)}return{cols:i,rows:r}}function Ye(e,t){let n=e.length,{cssWidth:o,cssHeight:i}=t;if(n<=0||o<=0||i<=0)return{cells:[]};let r=t.titleBand??hu,s=t.hasLegend?yu:0,a=t.xAxis??"cell",l=t.yAxis??"cell",u=a==="none"&&l==="none",m=l==="outer"?du+(t.hasYLabel?bu:0):0,f=a==="outer"?pu+(t.hasXLabel?gu:0):0,b=0,p=s,d=m,g=b,h=Math.max(1,o-m-p),y=Math.max(1,i-b-f),x=Math.max(0,t.gap??0),{cols:C,rows:_}=xu(n,h,y,x),v=Math.max(0,C-1)*x,A=Math.max(0,_-1)*x,w=Math.max(1,(h-v)/C),L=Math.max(1,(y-A)/_),T=[];for(let B=0;B<n;B++){let k=Math.floor(B/C),N=B-k*C,O=k===_-1||B+C>=n,U=N===0,S=d+N*(w+x),X=g+k*(L+x),H=X+r,z=S,te=w,xe=Math.max(1,L-r),Ce=new ee(o,i,{hasXLabel:a==="cell"&&t.hasXLabel===!0,hasYLabel:l==="cell"&&t.hasYLabel===!0,hasLegend:!1,leftExtra:l==="cell"?void 0:0,bottomExtra:a==="cell"?void 0:0,rightExtra:u?0:void 0,originX:z,originY:H,cellWidth:te,cellHeight:xe}),_e=r>0?{x:z,y:X,width:te,height:r}:void 0;T.push({index:B,label:e[B],layout:Ce,titleRect:_e,isLeftEdge:U,isBottomEdge:O})}let F=t.hasLegend?{x:d+h,y:b,width:s,height:y}:void 0,W=a==="outer"?{x:d,y:g+y,width:h,height:f}:void 0;return{cells:T,legendRect:F,outerXAxisRect:W,outerYAxisRect:l==="outer"?{x:0,y:g,width:m,height:y}:void 0}}var du,pu,bu,gu,hu,yu,Yt=E(()=>{"use strict";He();du=55,pu=24,bu=16,gu=18,hu=18,yu=96});function Cu(e,t){if(t<=0)return[];let n=new Array(t);for(let o=0;o<t;o++){let i=t===1?.5:o/(t-1),r=Ae(e,i);n[o]=[r[0],r[1],r[2]]}return n}function fe(e,t,n){if(e.length>0){if(e.length>=n)return e.slice(0,n);let o=new Array(n);for(let i=0;i<n;i++)o[i]=e[i%e.length];return o}return Cu(t,n)}var zt=E(()=>{"use strict";Ie()});function Xt(e){e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}function $t(e,t,n,o){e.enable(e.SCISSOR_TEST),e.scissor(Math.round(t.margins.left*n),Math.round(t.margins.bottom*n),Math.round(t.t.width*n),Math.round(t.t.height*n));try{o()}finally{e.disable(e.SCISSOR_TEST)}}function ze(e,t,n,o){Xt(e),$t(e,t,n,o)}var jt=E(()=>{"use strict"});function Zt(e,t,n){let o=e.gl,i;if(t?.texture){if(i=t.texture,t.lastStops===n)return t}else i=o.createTexture();let r=os(n,_s);return o.bindTexture(o.TEXTURE_2D,i),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,_s,1,0,o.RGBA,o.UNSIGNED_BYTE,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),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),{texture:i,lastStops:n}}function Pe(e,t,n,o=0){let i=e.gl;i.activeTexture(i.TEXTURE0+o),i.bindTexture(i.TEXTURE_2D,t),i.uniform1i(n,o)}var _s,xt=E(()=>{"use strict";Ie();_s=256});function de(e,t,n){e.width=Math.round(t.cssWidth*n),e.height=Math.round(t.cssHeight*n);let o=e.getContext("2d");return o?(o.scale(n,n),o.clearRect(0,0,t.cssWidth,t.cssHeight),o):null}function le(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var Ct=E(()=>{"use strict"});function io(e,t,n,o,i,r,s){let a=i==="bottom"?1:-1;e.textAlign="center",e.textBaseline=i==="bottom"?"top":"bottom";let l=a*8;for(let u of n){let m=r(u);m<t.x-1||m>t.x+t.width+1||(e.beginPath(),e.moveTo(m,o),e.lineTo(m,o+a*5),e.stroke(),e.fillText(s(u),m,o+l))}}function ro(e,t,n,o,i,r,s){let a=i==="left"?-1:1;e.textAlign=i==="left"?"right":"left",e.textBaseline="middle";let l=a*8;for(let u of n){let m=r(u);m<t.y-1||m>t.y+t.height+1||(e.beginPath(),e.moveTo(o,m),e.lineTo(o+a*5,m),e.stroke(),e.fillText(s(u),o+l,m))}}function so(e,t,n,o){for(let i of n){let r=Math.round(o(i))+.5;r<t.x||r>t.x+t.width||(e.beginPath(),e.moveTo(r,t.y),e.lineTo(r,t.y+t.height),e.stroke())}}function ao(e,t,n,o){for(let i of n){let r=Math.round(o(i))+.5;r<t.y||r>t.y+t.height||(e.beginPath(),e.moveTo(t.x,r),e.lineTo(t.x+t.width,r),e.stroke())}}var Wi=E(()=>{"use strict"});function _t(e,t,n){let{t:o}=n,i=Math.max(2,Math.floor(o.width/90)),r=Math.max(2,Math.floor(o.height/60));return{xTicks:se(e.min,e.max,i),yTicks:se(t.min,t.max,r)}}function Gi(e,t,n,o,i,r){let s=le(e,r);if(!s)return;let{t:a}=t;s.strokeStyle=i.Pn,s.lineWidth=1,so(s,a,n,l=>t.E(l,0).px),ao(s,a,o,l=>t.E(0,l).py)}function vs(e,t,n){if(n)return n;let o=t.length>1?t[1]-t[0]:0;return e.isDate?i=>he(i,o):ae}function As(e,t,n,o,i,r,s,a,l){let{Mt:u,xe:m,_o:f,fontFamily:b}=s,p=vs(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(r.x,i),e.lineTo(r.x+r.width,i),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let d of o)io(e,d.t,n,i,"bottom",g=>d.E(g,0).px,p);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,a.cx,a.baselineY))}function Ls(e,t,n,o,i,r,s,a,l){let{Mt:u,xe:m,_o:f,fontFamily:b}=s,p=vs(t,n,l);e.strokeStyle=f,e.lineWidth=1,e.beginPath(),e.moveTo(i,r.y),e.lineTo(i,r.y+r.height),e.stroke(),e.fillStyle=u,e.strokeStyle=u,e.font=`11px ${b}`;for(let d of o)ro(e,d.t,n,i,"left",g=>d.E(0,g).py,p);a&&t.label&&(e.fillStyle=m,e.font=`13px ${b}`,e.save(),e.translate(14,a.pivotY),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,0,0),e.restore())}function ki(e,t,n,o,i,r,s,a){let l=le(e,s);if(!l)return;let{t:u}=n;As(l,t,o,[n],u.y+u.height,u,i,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,a)}function Ni(e,t,n,o,i,r,s,a){let l=le(e,s);if(!l)return;let{t:u}=n;Ls(l,t,o,[n],u.x,u,i,r?{pivotY:u.y+u.height/2}:null,a)}function Ts(e,t,n,o,i,r,s,a,l){let u=le(e,a);u&&As(u,n,o,i,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,l)}function ws(e,t,n,o,i,r,s,a,l){let u=le(e,a);u&&Ls(u,n,o,i,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,l)}var Rs=E(()=>{"use strict";ve();Ct();Wi()});function Ui(e,t,n,o,i){if(i===0)return{x:e-n/2,y:t,width:n,height:o};if(i===90)return{x:e-o/2,y:t,width:o,height:n};let r=(n+o)/Math.SQRT2;return{x:e-r,y:t,width:r,height:r}}function Oi(e,t){return e.x<=t.x+t.width&&t.x<=e.x+e.width&&e.y<=t.y+t.height&&t.y<=e.y+e.height}function Ms(e,t){return e.x+e.width+14>t.x+t.width}function Vi(e,t){return e.x>=t.x&&e.x+e.width<=t.x+t.width&&e.y>=t.y&&e.y+e.height<=t.y+t.height}function st(e,t,n){if(n<=0)return"";if(e.measureText(t).width<=n)return t;let o=0,i=t.length;for(;o<i;){let r=o+i+1>>1,s=t.slice(0,r)+"\\u2026";e.measureText(s).width<=n?o=r:i=r-1}return o===0?"":t.slice(0,o)+"\\u2026"}function Fs(e,t,n,o){if(o<=0||n<=0)return[];if(e.measureText(t).width<=n)return[t];let i=[],r=t;for(;r.length>0&&i.length<o;){let s=i.length===o-1,a=r.length;for(;a>0&&e.measureText(r.slice(0,a)).width>n;)a--;if(a===0&&(a=1),a===r.length){i.push(r);break}let l=a,u=r.lastIndexOf(" ",a);if(u>0&&(l=u),s){i.push(st(e,r,n));break}i.push(r.slice(0,l)),r=r.slice(l).trimStart()}return i.length===1&&i[0].length<=2?[]:i}var lo=E(()=>{"use strict"});function uo(e,t,n,o){let i=[];if(o<=n)return i;let r=n,s=e[n];for(let a=n+1;a<o;a++){let l=e[a];l!==s&&(i.push({startIdx:r,endIdx:a-1,label:t[s]??""}),r=a,s=l)}return i.push({startIdx:r,endIdx:o-1,label:t[s]??""}),i}function qt(e,t,n){if(n<t)return[];let o=[];for(let i of e){if(i.endIdx<t||i.startIdx>n)continue;let r=i.startIdx<t?t:i.startIdx,s=i.endIdx>n?n:i.endIdx;r===i.startIdx&&s===i.endIdx?o.push(i):o.push({startIdx:r,endIdx:s,label:i.label})}return o}var Kt=E(()=>{"use strict"});function Hi(e,t){return e.E(t,0).px}function Yi(e,t){return e.E(0,t).py}function wu(e,t,n){let o=Math.max(0,n-100);return e*16>o?{size:t*6.62+10,rotation:90}:e*(t*6+10)>o?{size:t*4+20,rotation:45}:{size:_u,rotation:0}}function Ss(e,t){let n=e.levels.length,o=[];for(let i=0;i<n;i++){let r=e.levels[i];i===n-1?o.push(wu(e.numRows,r.maxLabelChars,t)):o.push({size:vu,rotation:0})}return o}function Ds(e){let t=e.levels.length,n=[],o=6.2;for(let i=0;i<t;i++)if(i===t-1){let r=e.levels[i].maxLabelChars;n.push(Math.max(Au,r*o+Tu))}else n.push(Lu);return n}function Bs(e){let t=0;for(let n of e)t+=n;return t}function Ee(e,t){return e.numRows===0||e.levels.length===0?24:Bs(Ss(e,t).map(n=>n.size))}function At(e){return e.numRows===0||e.levels.length===0?55:Bs(Ds(e))}function Ru(e,t,n,o){let i=t-e+1;if(i<=0)return[];let r=Math.max(1,Math.floor(n/o));if(i<=r){let l=[];for(let u=e;u<=t;u++)l.push(u);return l}let s=Math.ceil(i/r),a=[];for(let l=e;l<=t;l+=s)a.push(l);return a}function Is(e,t){return e.labels[t]??""}function Ps(e,t,n,o){let i=o?Math.min(t,n):t,r=o?Math.max(t,n):n,s=Math.max(0,Math.ceil(i)),a=Math.min(e-1,Math.floor(r));return a<s?null:[s,a]}function Es(e,t,n,o){let i=[];for(let r of e){let s=t(r.startIdx-.5),a=t(r.endIdx+.5),l=Math.max(n,Math.min(s,a)),u=Math.min(o,Math.max(s,a));u>l&&i.push({run:r,nearEdge:s,farEdge:a,nearClip:l,farClip:u})}return i}function Te(e,t,n,o){if(n.numRows===0||n.levels.length===0)return;let{Mt:i,xe:r,fontFamily:s}=o,{t:a}=t,l=a.y+a.height;e.strokeStyle=i,e.fillStyle=i,e.lineWidth=1,e.font=`${vt}px ${s}`;let u=Ss(n,a.width),m=Ps(n.numRows,t.Z,t.ie,!1);if(!m)return;let[f,b]=m,p=n.levels.length,d=l;for(let h=p-1;h>=0;h--){let y=n.levels[h],x=u[h],C=d;d+=x.size,h===p-1?Mu(e,t,y,f,b,C,x,s,i):Fu(e,t,y,f,b,C,s,i)}let g=n.levelLabels.filter(h=>!!h).join(" / ");g&&(e.fillStyle=r,e.font=`13px ${s}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(g,a.x+a.width/2,t.cssHeight-2))}function Mu(e,t,n,o,i,r,s,a,l){let{t:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),b=s.rotation===0?Ru(o,i,u.width,f):Su(o,i);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let h of b){let y=Hi(t,h);y<u.x-1||y>u.x+u.width+1||(e.moveTo(y,r),e.lineTo(y,r+mo))}e.stroke(),e.font=`${vt}px ${a}`;let p=r+mo+3,d={x:u.x,width:u.width,y:r,height:9999},g=[];for(let h of b){let y=Hi(t,h);if(y<u.x-1||y>u.x+u.width+1)continue;let x=Is(n,h);if(!x)continue;let C=e.measureText(x).width,_=Ui(y,p,C,zi,s.rotation);if(Vi(_,d)){if(s.rotation===0){if(g.some(v=>Oi(v,_)))continue}else if(g.some(v=>Ms(v,_)))continue;g.push(_),Ws(e,x,y,p,s.rotation,"center")}}}function Fu(e,t,n,o,i,r,s,a){let{t:l}=t,u=qt(n.runs,o,i);if(u.length===0)return;let m=Es(u,d=>Hi(t,d),l.x,l.x+l.width);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let d of m)e.moveTo(d.nearClip,r+3),e.lineTo(d.farClip,r+3),e.moveTo(d.nearEdge,r),e.lineTo(d.nearEdge,r+3),e.moveTo(d.farEdge,r),e.lineTo(d.farEdge,r+3);e.stroke(),e.font=`${vt}px ${s}`;let f=r+3+4,b=[],p={x:l.x,width:l.width,y:r,height:9999};for(let d of m){let g=(d.nearClip+d.farClip)/2,h=d.run.label;if(!h)continue;let y=d.farClip-d.nearClip-4,x=st(e,h,y);if(!x)continue;let C=e.measureText(x).width,_=Ui(g,f,C,zi,0);Vi(_,p)&&(b.some(v=>Oi(v,_))||(b.push(_),Ws(e,x,g,f,0,"center")))}}function Su(e,t){let n=[];for(let o=e;o<=t;o++)n.push(o);return n}function at(e,t,n,o){if(n.numRows===0||n.levels.length===0)return;let{Mt:i,xe:r,fontFamily:s}=o,{t:a}=t,l=a.x;e.strokeStyle=i,e.fillStyle=i,e.lineWidth=1,e.font=`${vt}px ${s}`;let u=Ds(n),m=Ps(n.numRows,t.J,t.re,!0);if(!m)return;let[f,b]=m,p=n.levels.length,d=l;for(let h=p-1;h>=0;h--){let y=n.levels[h],x=u[h],C=d;d-=x,h===p-1?Du(e,t,y,f,b,C,s,i):Bu(e,t,y,f,b,C,x,s,i)}let g=n.levelLabels.filter(h=>!!h).join(" / ");g&&(e.fillStyle=r,e.font=`13px ${s}`,e.save(),e.translate(14,a.y+a.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(g,0,0),e.restore())}function Du(e,t,n,o,i,r,s,a){let{t:l}=t,u=zi+4,m=i-o+1,f=Math.max(1,Math.floor(l.height/u)),b=m<=f?1:Math.ceil(m/f);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let p=o;p<=i;p+=b){let d=Yi(t,p);d<l.y-1||d>l.y+l.height+1||(e.moveTo(r-mo,d),e.lineTo(r,d))}e.stroke(),e.font=`${vt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let p=o;p<=i;p+=b){let d=Yi(t,p);if(d<l.y-1||d>l.y+l.height+1)continue;let g=Is(n,p);g&&e.fillText(g,r-mo-3,d)}}function Bu(e,t,n,o,i,r,s,a,l){let{t:u}=t,m=qt(n.runs,o,i);if(m.length===0)return;let f=Es(m,p=>Yi(t,p),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=l,e.fillStyle=l;let b=r-3;e.beginPath();for(let p of f)e.moveTo(b,p.nearClip),e.lineTo(b,p.farClip),e.moveTo(b,p.nearEdge),e.lineTo(r,p.nearEdge),e.moveTo(b,p.farEdge),e.lineTo(r,p.farEdge);e.stroke(),e.font=`${vt}px ${a}`,e.textAlign="right",e.textBaseline="middle";for(let p of f){let d=(p.nearClip+p.farClip)/2,g=p.run.label;if(!g)continue;let h=s-6,y=st(e,g,h);y&&e.fillText(y,b-3,d)}}function Ws(e,t,n,o,i,r){if(i===0){e.textAlign=r==="end"?"right":"center",e.textBaseline="top",e.fillText(t,n,o);return}e.save(),e.translate(n,o),e.rotate(-i*Math.PI/180),e.textAlign="right",e.textBaseline="middle",e.fillText(t,-2,0),e.restore()}var _u,vu,mo,vt,zi,Au,Lu,Tu,Lt=E(()=>{"use strict";lo();Kt();_u=25,vu=22,mo=5,vt=11,zi=14,Au=55,Lu=60,Tu=10});function Iu(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function Tt(e,t,n,o,i,r){let s={x:t.t.x+t.t.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.t.x-t.t.width-12),height:Math.max(1,t.t.height)};Jt(e,s,n,o,i,r)}function Jt(e,t,n,o,i,r=ae){let s=e.getContext("2d");if(!s)return;let a=i.vo,l=i.Ni,u=i.fontFamily,m=16,f=Math.min(120,t.height*.4),b=t.x,p=t.y;s.fillStyle=a,s.font=`9px ${u}`,s.textAlign="left",s.textBaseline="bottom",s.fillText(n.label,b,p-4);let d=n.max,g=n.min,h=s.createLinearGradient(0,p,0,p+f),y=16;for(let C=0;C<=y;C++){let _=C/y,v=d+_*(g-d),A=rt(v,n.min,n.max),w=Ae(o,A);h.addColorStop(_,Iu(w))}s.fillStyle=h,s.fillRect(b,p,m,f),s.strokeStyle=l,s.lineWidth=1,s.strokeRect(b,p,m,f),s.fillStyle=a,s.font=`10px ${u}`,s.textAlign="left",s.textBaseline="middle";let x=b+m+5;if(s.fillText(r(n.max),x,p+2),s.fillText(r((n.min+n.max)/2),x,p+f/2),s.fillText(r(n.min),x,p+f-2),n.min<0&&n.max>0){let C=(n.max-0)/(n.max-n.min),_=p+C*f;s.strokeStyle=a,s.lineWidth=1,s.beginPath(),s.moveTo(b+m,_),s.lineTo(b+m+4,_),s.stroke(),s.fillStyle=a,s.fillText("0",x,_)}}function fo(e,t,n,o,i){let r={x:t.t.x+t.t.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.t.x-t.t.width-12),height:Math.max(1,t.t.height)};Qt(e,r,n,o,i)}function Qt(e,t,n,o,i){let r=e.getContext("2d");if(!r||n.size===0)return;let s=i.vo,a=i.fontFamily,l=10,u=18,m=t.x,f=t.y+u/2;r.font=`11px ${a}`,r.textAlign="left",r.textBaseline="middle";for(let[b,p]of n){if(f+l/2>t.y+t.height)break;let d=o[p]??o[p%o.length]??[0,0,0];r.fillStyle=`rgb(${Math.round(d[0]*255)},${Math.round(d[1]*255)},${Math.round(d[2]*255)})`,r.fillRect(m,f-l/2,l,l),r.fillStyle=s,r.fillText(b,m+l+6,f),f+=u}}var co=E(()=>{"use strict";ve();Ie()});function Xe(e){return isNaN(e)?0:e}function Gs(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0)return;let s=e._.length>0,a=e.N.facet_mode,l=s&&a==="grid";e.computeEffectiveFacetFlags();let u=e.s!==""&&e.c<e.f,m=l&&e.N.zoom_mode==="independent",f;if(e.b&&!m?f=e.b.getVisibleDomain():f={xMin:e.ce,xMax:e.qe,yMin:e.Ce,yMax:e.Ke},!isFinite(f.xMin)||!isFinite(f.yMin))return;let b=e.T(),p=b.Ie,d=e.Pe[e.Ee]||"",g=e.Pe[e.Te]||"",h=d==="date"||d==="datetime",y=g==="date"||g==="datetime",x=e.j,C=!x&&!e.s,_=b.H;if(x||C){let v=C?Math.max(1,e._.length):Math.max(1,e.u.size);if(e.zn&&e.Do===p&&e.Bo===v)_=e.zn;else{let A=fe(p,b.H,v);_=ns(A),e.zn=_,e.Do=p,e.Bo=v}}else e.zn=null,e.Do=null,e.Bo=-1;e.Q=Zt(t,e.Q,_),l?Wu(e,t,f,b,{xIsDate:h,yIsDate:y,cssWidth:i,cssHeight:r}):(e.v=null,Eu(e,t,f,b,{xIsDate:h,yIsDate:y,cssWidth:i,cssHeight:r,hasColorCol:u})),$e(e)}function po(e,t,n,o){return{min:t,max:n,label:e.Ee||(e.gi?"Row":e.Ye||""),isDate:o}}function bo(e,t,n,o){return{min:t,max:n,label:e.Te||e.We,isDate:o}}function go(e,t){let n=0;for(let i of e)i.length>n&&(n=i.length);return{levels:[{labels:e.slice(),runs:[],maxLabelChars:n}],numRows:e.length,levelLabels:[t]}}function Pu(e,t,n,o,i,r,s,a,l){if(e.we&&e.et){let u=le(t,l);u&&Te(u,n,e.et,a)}else ki(t,o,n,r,a,!0,l,e.getColumnFormatter(e.Ye,"tick"));if(e.de&&e.tt){let u=le(t,l);u&&at(u,n,e.tt,a)}else Ni(t,i,n,s,a,!0,l,e.getColumnFormatter(e.We,"tick"))}function Eu(e,t,n,o,i){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u,hasColorCol:m}=i;e.et=e.we&&e.Xt.length>0?go(e.Xt,e.Ee||e.Ye||""):null,e.tt=e.de&&e.$t.length>0?go(e.$t,e.Te||e.We||""):null;let f=m?80:16,b=55+(e.Te?16:0),p=Math.max(1,s-b-f),d=e.tt?At(e.tt):void 0,g=e.et?Ee(e.et,p):void 0,h=new ee(s,a,{hasXLabel:!!e.Ee,hasYLabel:!!e.Te,hasLegend:m,leftExtra:d,bottomExtra:g});e.a=h,e.b&&e.b.updateLayout(h);let y=h.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,Xe(e.R),Xe(e.M)),x=po(e,n.xMin,n.xMax,l),C=bo(e,n.yMin,n.yMax,u),_=_t(x,C,h),v=e.we?[]:_.xTicks,A=e.de?[]:_.yTicks,w=e.an==="map";if(e.D&&!w){let L=t.dpr;de(e.D,h,L),Gi(e.D,h,v,A,o,L)}else e.D&&w&&de(e.D,h,t.dpr);ze(r,h,t.dpr,()=>{w&&e.renderBackground(t,h,y,n,Xe(e.R),Xe(e.M)),e.glyph.draw(e,t,y)}),e.Re=x,e.Me=C,e.Xn=v,e.Ge=A,e.$n=o.H,e.jn=m}function Wu(e,t,n,o,i){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u}=i;e.et=e.we&&e.Xt.length>0?go(e.Xt,e.Ee||e.Ye||""):null,e.tt=e.de&&e.$t.length>0?go(e.$t,e.Te||e.We||""):null;let m=e._.map(A=>A.prefix),f=e.j&&e.u.size>1,b=!!e.s&&!e.j&&e.c<e.f,p=f||b,d=Ye(m,{cssWidth:s,cssHeight:a,xAxis:e.En?"outer":"cell",yAxis:e.Wn?"outer":"cell",hasLegend:p,hasXLabel:!!e.Ee,hasYLabel:!!e.Te,gap:e.N.facet_padding});if(e.v=d,d.cells.length>1){let A=d.cells[0].layout.t;for(let w=1;w<d.cells.length;w++){let L=d.cells[w].layout.t;if(L.width!==A.width||L.height!==A.height){console.warn(`facet-grid: cell ${w} size (${L.width}\\xD7${L.height}) differs from cell 0 (${A.width}\\xD7${A.height})`);break}}}e.a=d.cells[0]?.layout??null,e.syncFacetZoomLayouts(d.cells);let g=e.N.zoom_mode==="independent",h=po(e,n.xMin,n.xMax,l),y=bo(e,n.yMin,n.yMax,u),x=d.cells[0]?.layout,C=x?_t(h,y,x):{xTicks:[],yTicks:[]},_=e.we?[]:C.xTicks,v=e.de?[]:C.yTicks;e.D&&x&&de(e.D,x,t.dpr),Xt(r);for(let A=0;A<d.cells.length;A++){let w=d.cells[A],L=e.getZoomControllerForFacet(A),T=g&&L?L.getVisibleDomain():n,F=w.layout.buildProjectionMatrix(T.xMin,T.xMax,T.yMin,T.yMax,void 0,void 0,void 0,Xe(e.R),Xe(e.M)),W=e.an==="map";if(e.D&&!W){let P=g?_t(po(e,T.xMin,T.xMax,l),bo(e,T.yMin,T.yMax,u),w.layout).xTicks:_,B=g?_t(po(e,T.xMin,T.xMax,l),bo(e,T.yMin,T.yMax,u),w.layout).yTicks:v;Gi(e.D,w.layout,P,B,o,t.dpr)}$t(r,w.layout,t.dpr,()=>{W&&e.renderBackground(t,w.layout,F,T,Xe(e.R),Xe(e.M)),e.glyph.drawSeries(e,t,F,A)})}e.Re=h,e.Me=y,e.Xn=_,e.Ge=v,e.$n=o.H,e.jn=p}function $e(e){!e.d||!e.a||!e.Re||!e.Me||!e.e||(de(e.d,e.a,e.e.dpr),e.v?ku(e):Gu(e))}function Gu(e){let t=e.a,n=e.T(),o=e.e?.dpr??1;if(e.an==="map"?e.renderMapChrome(e.d,t,n,o):Pu(e,e.d,t,e.Re,e.Me,e.Xn,e.Ge,n,o),e.jn){let r=e.$n??n.H;if(e.j&&e.u.size>0){let s=fe(n.Ie,r,e.u.size);fo(e.d,t,e.u,s,n)}else e.s&&Tt(e.d,t,{min:e.c,max:e.f,label:e.s},r,n,e.getColumnFormatter(e.s,"value"))}ks(e,e.d,t,0,1),e.se>=0&&e.O&&e.V&&Ou(e,e.d,t)}function ku(e){let t=e.v,n=e.d,o=e.T(),i=e.e?.dpr??1,r=e.Xn,s=e.Ge,a=e.Re,l=e.Me,u=e.an==="map",m=e.En&&!e.we,f=e.Wn&&!e.de,b=e.N.zoom_mode==="independent";u&&e.renderMapChrome(n,e.a,o,i),!u&&m&&t.outerXAxisRect&&Ts(n,t.outerXAxisRect,a,r,xs(t),o,!!e.Ee,i,e.getColumnFormatter(e.Ye,"tick")),!u&&f&&t.outerYAxisRect&&ws(n,t.outerYAxisRect,l,s,Cs(t),o,!!e.Te,i,e.getColumnFormatter(e.We,"tick"));for(let p=0;p<t.cells.length;p++){let d=t.cells[p],g=b?e.getZoomControllerForFacet(p):null,h=g?g.getVisibleDomain():null,y=h?{...a,min:h.xMin,max:h.xMax}:a,x=h?{...l,min:h.yMin,max:h.yMax}:l,C=b?_t(y,x,d.layout):{xTicks:r,yTicks:s};if(!u&&!m)if(e.we&&e.et){let _=le(n,i);_&&Te(_,d.layout,e.et,o)}else ki(n,y,d.layout,C.xTicks,o,!!e.Ee,i,e.getColumnFormatter(e.Ye,"tick"));if(!u&&!f)if(e.de&&e.tt){let _=le(n,i);_&&at(_,d.layout,e.tt,o)}else Ni(n,x,d.layout,C.yTicks,o,!!e.Te,i,e.getColumnFormatter(e.We,"tick"));d.titleRect&&oo(n,d.label,d.titleRect,o,i),ks(e,n,d.layout,p,p+1)}if(e.jn&&t.legendRect){let p=e.$n??o.H;if(e.j&&e.u.size>0){let d=fe(o.Ie,p,Math.max(1,e.u.size));Qt(n,t.legendRect,e.u,d,o)}else e.s&&Jt(n,{x:t.legendRect.x,y:t.legendRect.y+20,width:t.legendRect.width,height:t.legendRect.height-20},{min:e.c,max:e.f,label:e.s},p,o,e.getColumnFormatter(e.s,"value"))}if(e.se>=0&&e.O&&e.V){let p=isNaN(e.R)?0:e.R,d=isNaN(e.M)?0:e.M,g=e.O[e.se]+p,h=e.V[e.se]+d,y=Nu(e,e.se),x=e.glyph.tooltipOptions(),C=e.W.lines??[];for(let _=0;_<t.cells.length;_++){let v=t.cells[_],A=_===y,w=v.layout.E(g,h),L=v.layout.t;if(w.px<L.x||w.px>L.x+L.width||w.py<L.y||w.py>L.y+L.height)continue;let T=e.N.coordinated_tooltip;Be(n,w,A||T?C:[],v.layout,o,i,{crosshair:x.crosshair,highlightRadius:A?x.highlightRadius:0})}}}function Nu(e,t){return e.w<=0?0:Math.floor(t/e.w)}function ks(e,t,n,o,i){if(!e.Bt||!e.O||!e.V)return;let r=e.Bt.dictionary,s=e.Bt.data,a=e.O,l=e.V,u=isNaN(e.R)?0:e.R,m=isNaN(e.M)?0:e.M,f=e.w;if(f<=0)return;let b=0;for(let x=o;x<i;x++)b+=e.U[x]??0;if(b===0)return;let p=e.e?.dpr??1,d=le(t,p);if(!d)return;let g=e.T(),h=n.t,y=Math.max(1,Math.ceil(b/Uu));d.save(),d.font=`11px ${g.fontFamily}`,d.fillStyle=g.xe,d.textAlign="left",d.textBaseline="middle";for(let x=o;x<i;x++){let C=e.U[x]??0,_=x*f;for(let v=0;v<C;v+=y){let A=_+v,w=s[A];if(w<0)continue;let{px:L,py:T}=n.E(a[A]+u,l[A]+m);L<h.x||L>h.x+h.width||T<h.y||T>h.y+h.height||d.fillText(r[w],L+8,T-4)}}d.restore()}function Ou(e,t,n){let o=e.se;if(o<0||!e.O||!e.V)return;let i=isNaN(e.R)?0:e.R,r=isNaN(e.M)?0:e.M,s=n.E(e.O[o]+i,e.V[o]+r),a=e.W.lines??[],l=e.T();Be(t,s,a,n,l,e.e?.dpr??1,e.glyph.tooltipOptions())}var Uu,Xi=E(()=>{"use strict";Ei();He();Yt();zt();Ie();jt();xt();yt();Rs();Ct();Lt();co();Uu=5e3});function Vu(e){if(!e.zt.isDirty||!e.O||!e.V)return;let t=e.O,n=e.V,o=Math.max(1,e._.length),i=e.w,r=isNaN(e.R)?0:e.R,s=isNaN(e.M)?0:e.M;e.zt.rebuild({xMin:e.ce-r,xMax:e.qe-r,yMin:e.Ce-s,yMax:e.Ke-s},e.bt,a=>{for(let l=0;l<o;l++){let u=e.U[l]??0,m=l*i;for(let f=0;f<u;f++)a(m+f,t[m+f],n[m+f])}})}function $i(e,t,n){if(!e.O||!e.V)return;let{layout:o,facetIdx:i}=Hu(e,t,n);if(!o){Ns(e);return}let r=o.t;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){Ns(e);return}let s=o.Z,a=o.ie,l=o.J,u=o.re,m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),p=r.height/(u-l),d=isNaN(e.R)?0:e.R,g=isNaN(e.M)?0:e.M,h=m-d,y=f-g,x=i<0?Yu(e,h,y,b,p):zu(e,i,h,y,b,p);if(x!==e.se||i!==e.ln){if(e.se=x,e.ln=i,x>=0){let C=e.W.beginHover(x);e.glyph.buildTooltipLines(e,x).then(_=>{e.W.commitHover(C,_)&&$e(e)})}else e.W.clearHover();$e(e)}}function Ns(e){(e.se!==-1||e.ln!==-1)&&(e.se=-1,e.ln=-1,$e(e))}function Hu(e,t,n){if(e.v){let o=e.v.cells;for(let i=0;i<o.length;i++){let r=o[i].layout.t;if(t>=r.x&&t<=r.x+r.width&&n>=r.y&&n<=r.y+r.height)return{layout:o[i].layout,facetIdx:i}}return{layout:null,facetIdx:-1}}return{layout:e.a,facetIdx:-1}}function Yu(e,t,n,o,i){Vu(e);let r=e.zt.query(t,n,en,o,i,e.O,e.V);if(r>=0)return r;let s=en*en,a=Math.max(1,e._.length),l=e.w,u=e.O,m=e.V;for(let f=0;f<a;f++){let b=e.U[f]??0,p=f*l;for(let d=0;d<b;d++){let g=p+d,h=(u[g]-t)*o,y=(m[g]-n)*i,x=h*h+y*y;x<s&&(s=x,r=g)}}return r}function zu(e,t,n,o,i,r){let s=e.U[t]??0;if(s===0)return-1;let a=e.w,l=t*a,u=e.O,m=e.V,f=en*en,b=-1;for(let p=0;p<s;p++){let d=l+p,g=(u[d]-n)*i,h=(m[d]-o)*r,y=g*g+h*h;y<f&&(f=y,b=d)}return b}function Us(e,t){if(e.L.dismiss(),e.Io=t,t<0||!e.O||!e.V)return;let n=Xu(e,t);if(!n)return;let o=isNaN(e.R)?0:e.R,i=isNaN(e.M)?0:e.M,r=n.E(e.O[t]+o,e.V[t]+i),s=e.W.beginPin();e.glyph.buildTooltipLines(e,t).then(a=>{e.W.isPinFresh(s)&&e.Io===t&&a.length!==0&&e.L.pin(a,r,n)}),e.se=-1,e.ln=-1,$e(e)}function Xu(e,t){if(e.v&&e.w>0){let n=Math.floor(t/e.w),o=e.v.cells[n];if(o)return o.layout}return e.a}function Os(e){e.L.dismiss(),e.Io=-1}var en,Vs=E(()=>{"use strict";Xi();en=24});var wt,ji=E(()=>{"use strict";wt=class{constructor(){c(this,"lines",null);c(this,"hoveredTarget",null);c(this,"Po",0);c(this,"Eo",0)}beginHover(t){return this.lines=null,this.hoveredTarget=t,++this.Po}commitHover(t,n){return t!==this.Po?!1:(this.lines=n,!0)}clearHover(){this.lines=null,this.hoveredTarget=null,this.Po++}beginPin(){return++this.Eo}isPinFresh(t){return t===this.Eo}invalidatePin(){this.Eo++}}});function j(e,t,n,o,i,r){let s=e.shaders.getOrCreate(t,n,o),a=e.gl,l={program:s};for(let u of i)l[u]=a.getUniformLocation(s,u);for(let u of r)l[u]=a.getAttribLocation(s,u);return l}var ue=E(()=>{"use strict"});async function ho(e,t){let n=[];if(!e.Dt||!e.Le)return n;let o=e.Dt[t];if(o<0)return n;if(e._.length>0&&e.w>0){let s=Math.floor(t/e.w),a=e._[s];a?.prefix&&n.push(a.prefix)}let i=await e.Le.fetchRow(o),r=e._.length>0&&e.w>0?e._[Math.floor(t/e.w)]?.prefix??null:null;for(let[s,a]of i){if(a==null)continue;let l=s;if(r!==null){let u=`${r}|`;if(!s.startsWith(u))continue;l=s.substring(u.length)}else if(s.includes("|"))continue;if(typeof a=="number"){let u=e.getColumnFormatter(s,"value")(a);n.push(`${l}: ${u}`)}else n.push(`${l}: ${a}`)}return n}var Zi=E(()=>{"use strict"});function $u(e,t,n,o,i){t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,o.h.point_size_px*i),o.c<o.f?t.uniform2f(e.u_color_range,o.c,o.f):t.uniform2f(e.u_color_range,0,0),o.Je<o.Qe?t.uniform2f(e.u_size_range,o.Je,o.Qe):t.uniform2f(e.u_size_range,0,0);let r=Math.min(o.h.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*i,o.h.point_size_px/r*i),o.h.point_size_px*r*i)}function Hs(e,t,n,o){let i=n.gl;if(!t.Q)return!1;i.useProgram(e.program),$u(e,i,o,t,n.dpr),Pe(n,t.Q.texture,e.u_gradient_lut,0);let r=n.C.peek("a_position"),s=n.C.peek("a_color_value"),a=n.C.peek("a_size_value");return!r||!s||!a?!1:(i.bindBuffer(i.ARRAY_BUFFER,r.buffer),i.enableVertexAttribArray(e.a_position),i.vertexAttribPointer(e.a_position,2,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,s.buffer),i.enableVertexAttribArray(e.a_color_value),i.vertexAttribPointer(e.a_color_value,1,i.FLOAT,!1,0,0),i.bindBuffer(i.ARRAY_BUFFER,a.buffer),i.enableVertexAttribArray(e.a_size_value),i.vertexAttribPointer(e.a_size_value,1,i.FLOAT,!1,0,0),!0)}var Rt,qi=E(()=>{"use strict";xt();ue();Zi();xi();Ci();Rt=class{constructor(){c(this,"name","point");c(this,"m",null)}ensureProgram(t,n){this.m||(this.m=j(n,"scatter",wn,Rn,["u_projection","u_point_size","u_color_range","u_gradient_lut","u_size_range","u_point_size_range"],["a_position","a_color_value","a_size_value"]))}draw(t,n,o){let i=this.m;if(!i||!Hs(i,t,n,o))return;let r=n.gl,s=Math.max(1,t._.length),a=t.w;for(let l=0;l<s;l++){let u=t.U[l]??0;u<=0||r.drawArrays(r.POINTS,l*a,u)}}drawSeries(t,n,o,i){let r=this.m;if(!r||!Hs(r,t,n,o))return;let s=t.U[i]??0;if(s<=0)return;let a=n.gl,l=t.w;a.drawArrays(a.POINTS,i*l,s)}buildTooltipLines(t,n){return ho(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6}}destroy(t){this.m=null}}});function q(e){let t=e.gl;if(e.isWebGL2){let o=t;return{setDivisor(i,r){i<0||o.vertexAttribDivisor(i,r)},drawArraysInstanced(i,r,s,a){o.drawArraysInstanced(i,r,s,a)}}}let n=t.getExtension("ANGLE_instanced_arrays");return{setDivisor(o,i){o<0||n?.vertexAttribDivisorANGLE(o,i)},drawArraysInstanced(o,i,r,s){n?.drawArraysInstancedANGLE(o,i,r,s)}}}function je(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,1,2,3]),e.STATIC_DRAW),t}function yo(e){let t=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW),t}function Ze(e,t,n,o,i){if(n<0)return!0;let r=e.C.peek(o);if(!r)return!1;let s=e.gl;return s.bindBuffer(s.ARRAY_BUFFER,r.buffer),s.enableVertexAttribArray(n),s.vertexAttribPointer(n,i,s.FLOAT,!1,0,0),t.setDivisor(n,1),!0}var we=E(()=>{"use strict"});function Ys(e,t,n,o){let i=n.gl;if(!t.Q)return!1;let r=n.dpr;i.useProgram(e.program),i.uniformMatrix4fv(e.u_projection,!1,o),i.uniform2f(e.u_resolution,i.canvas.width,i.canvas.height),i.uniform1f(e.u_line_width,t.h.line_width_px*r),t.c<t.f?i.uniform2f(e.u_color_range,t.c,t.f):i.uniform2f(e.u_color_range,0,0),Pe(n,t.Q.texture,e.u_gradient_lut,0);let s=q(n),{setDivisor:a}=s;return i.bindBuffer(i.ARRAY_BUFFER,e.cornerBuffer),i.enableVertexAttribArray(e.a_corner),i.vertexAttribPointer(e.a_corner,1,i.FLOAT,!1,0,0),a(e.a_corner,0),i.enableVertexAttribArray(e.a_start),a(e.a_start,1),i.enableVertexAttribArray(e.a_end),a(e.a_end,1),i.enableVertexAttribArray(e.a_color_start),a(e.a_color_start,1),i.enableVertexAttribArray(e.a_color_end),a(e.a_color_end,1),!0}function zs(e,t,n,o){let i=t.U[o]??0;if(i<2)return;let r=n.gl,s=t.w,a=2*Float32Array.BYTES_PER_ELEMENT,l=Float32Array.BYTES_PER_ELEMENT,u=n.C.peek("a_position"),m=n.C.peek("a_color_value");if(!u||!m)return;let f=o*s*a;r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(e.a_start,2,r.FLOAT,!1,a,f),r.vertexAttribPointer(e.a_end,2,r.FLOAT,!1,a,f+a);let b=o*s*l;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,l,b),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,l,b+l),q(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,i-1)}function Xs(e,t){let{setDivisor:n}=q(t);n(e.a_start,0),n(e.a_end,0),n(e.a_color_start,0),n(e.a_color_end,0)}var Mt,Ki=E(()=>{"use strict";xt();we();ue();ve();hi();yi();Mt=class{constructor(){c(this,"name","line");c(this,"m",null)}ensureProgram(t,n){if(this.m)return;let o=j(n,"line",Ln,Tn,["u_projection","u_resolution","u_line_width","u_color_range","u_gradient_lut"],["a_start","a_end","a_color_start","a_color_end","a_corner"]);this.m={...o,cornerBuffer:je(n.gl)}}draw(t,n,o){let i=this.m;if(!i||!Ys(i,t,n,o))return;let s=Math.max(1,t._.length);for(let a=0;a<s;a++)zs(i,t,n,a);Xs(i,n)}drawSeries(t,n,o,i){let r=this.m;r&&Ys(r,t,n,o)&&(zs(r,t,n,i),Xs(r,n))}async buildTooltipLines(t,n){let o=[];if(!t.O||!t.V)return o;if(t._.length>0&&t.w>0){let b=Math.floor(n/t.w),p=t._[b];p&&o.push(p.prefix)}let i=t.O[n],r=t.V[n],s=t.Pe[t.Ee]||"",l=s==="date"||s==="datetime"?he(i):ae(i);o.push(`${t.Ee||"Row"}: ${l}`);let u=t.Pe[t.Te]||"",f=u==="date"||u==="datetime"?he(r):ae(r);return o.push(`${t.Te}: ${f}`),o}tooltipOptions(){return{crosshair:!0,highlightRadius:5}}destroy(t){let n=this.m;n?.cornerBuffer&&t.e&&t.e.gl.deleteBuffer(n.cornerBuffer),this.m=null}}});function Ju(e){switch(e){case"density":return ju;case"extreme":return qu;case"signed":return Ku;case"mean":default:return Zu}}function $s(e){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function Ji(e,t,n,o){return j(e,t,n,o,["u_projection","u_radius_ndc","u_intensity","u_color_range"],["a_corner","a_position","a_color_value"])}function Qu(e){let t=e.gl;if(e.isWebGL2){let n=t;if(n.getExtension("EXT_color_buffer_float"))return{internalFormat:n.RGBA16F,format:n.RGBA,type:n.HALF_FLOAT,isFloat:!0}}return{internalFormat:t.RGBA,format:t.RGBA,type:t.UNSIGNED_BYTE,isFloat:!1}}function js(e){let t=e.C.peek("a_position"),n=e.C.peek("a_color_value");return!!t&&!!n}function tm(e,t){if(!e.s||e.j)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.bt&&n.colorName===e.s&&n.colorIsString===e.j)return{lo:n.lo,hi:n.hi};let o=nm(e);return o?(t.robustBounds={lo:o.lo,hi:o.hi,dataCount:e.bt,colorName:e.s,colorIsString:e.j},o):(t.robustBounds=null,null)}function nm(e){if(!e.gt||e.bt<2)return null;let t=e.w,n=Math.max(1,e._.length),o=Math.max(1,Math.ceil(e.bt/em)),i=[],r=e.gt;for(let m=0;m<n;m++){let f=e.U[m]??0,b=m*t;for(let p=0;p<f;p+=o){let d=r[b+p];Number.isFinite(d)&&i.push(d)}}if(i.length<2)return null;i.sort((m,f)=>m-f);let s=Math.floor(i.length*.05),a=Math.min(i.length-1,Math.ceil(i.length*.95)),l=i[s],u=i[a];return u>l?{lo:l,hi:u}:e.f>e.c?{lo:e.c,hi:e.f}:null}var ju,Zu,qu,Ku,Ft,em,Qi=E(()=>{"use strict";xt();we();ue();Zi();_i();vi();Ai();Nr();Or();Li();Ti();ju=0,Zu=1,qu=2,Ku=3,Ft=class{constructor(){c(this,"name","density");c(this,"m",null)}ensureProgram(t,n){if(this.m){this.ensureHeatTarget(t,n);return}let o=n.gl,i=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,i),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),o.STATIC_DRAW);let r=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,r),o.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),o.STATIC_DRAW);let{internalFormat:s,format:a,type:l,isFloat:u}=Qu(n),m=$s(o),f=o.createFramebuffer();this.m={splat:Ji(n,"density-splat",gt,Un),extremeSplat:null,mrtSplat:null,resolve:j(n,"density-resolve",Vn,Hn,["u_heat","u_extreme","u_gradient_lut","u_heat_max","u_color_mode"],["a_corner"]),quadCornerBuffer:i,tripleCornerBuffer:r,heatTexture:m,heatFramebuffer:f,extremeTexture:null,extremeFramebuffer:null,mrtFramebuffer:null,heatWidth:0,heatHeight:0,heatType:l,heatInternalFormat:s,heatFormat:a,floatFbo:u,indexedBlend:null,signedDowngradeWarned:!1,robustBounds:null},this.ensureHeatTarget(t,n)}draw(t,n,o){let i=this.m;if(!i||!js(n))return;let r=Math.max(1,t._.length),s=t.w,a=0;for(let l=0;l<r;l++)a+=t.U[l]??0;a!==0&&this.runSplatAndResolve(t,n,i,o,l=>{for(let u=0;u<r;u++){let m=t.U[u]??0;m<=0||l(u*s,m)}})}drawSeries(t,n,o,i){let r=this.m;if(!r||!js(n))return;let s=t.U[i]??0;if(s<=0)return;let a=t.w;this.runSplatAndResolve(t,n,r,o,l=>l(i*a,s))}buildTooltipLines(t,n){return ho(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0}}destroy(t){let n=this.m;if(!n||!t.e){this.m=null;return}let o=t.e.gl;o.deleteBuffer(n.quadCornerBuffer),o.deleteBuffer(n.tripleCornerBuffer),o.deleteTexture(n.heatTexture),o.deleteFramebuffer(n.heatFramebuffer),n.extremeTexture&&o.deleteTexture(n.extremeTexture),n.extremeFramebuffer&&o.deleteFramebuffer(n.extremeFramebuffer),n.mrtFramebuffer&&o.deleteFramebuffer(n.mrtFramebuffer),this.m=null}ensureHeatTarget(t,n){let o=this.m;if(!o)return;let i=n.gl,r=i.canvas.width,s=i.canvas.height;if(!(r===o.heatWidth&&s===o.heatHeight)&&!(r<=0||s<=0)){if(this.allocAccumTexture(i,o,o.heatTexture,r,s),i.bindFramebuffer(i.FRAMEBUFFER,o.heatFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o.heatTexture,0),o.extremeTexture&&(this.allocAccumTexture(i,o,o.extremeTexture,r,s),o.extremeFramebuffer&&(i.bindFramebuffer(i.FRAMEBUFFER,o.extremeFramebuffer),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o.extremeTexture,0)),o.mrtFramebuffer)){let a=i;a.bindFramebuffer(a.FRAMEBUFFER,o.mrtFramebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,o.heatTexture,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT1,a.TEXTURE_2D,o.extremeTexture,0)}i.bindFramebuffer(i.FRAMEBUFFER,null),o.heatWidth=r,o.heatHeight=s}}allocAccumTexture(t,n,o,i,r){t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,n.heatInternalFormat,i,r,0,n.heatFormat,n.heatType,null)}ensureExtremeTarget(t,n){let o=t.gl;if(n.extremeTexture)return;let i=$s(o);if(n.extremeTexture=i,n.extremeFramebuffer=o.createFramebuffer(),this.allocAccumTexture(o,n,i,n.heatWidth,n.heatHeight),o.bindFramebuffer(o.FRAMEBUFFER,n.extremeFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,i,0),n.indexedBlend===null){let r=t.isWebGL2?o.getExtension("OES_draw_buffers_indexed"):null;n.indexedBlend=r??!1}if(n.indexedBlend){let r=o;n.mrtFramebuffer=r.createFramebuffer(),r.bindFramebuffer(r.FRAMEBUFFER,n.mrtFramebuffer),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n.heatTexture,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT1,r.TEXTURE_2D,i,0)}o.bindFramebuffer(o.FRAMEBUFFER,null)}ensureExtremeSplatProgram(t,n){return n.extremeSplat||(n.extremeSplat=Ji(t,"density-extreme",gt,On)),n.extremeSplat}ensureMrtSplatProgram(t,n){return n.mrtSplat||(n.mrtSplat=Ji(t,"density-mrt",Ur,Vr)),n.mrtSplat}activeMode(t,n,o){let i=n.h.gradient_color_mode;return i==="signed"&&!o.floatFbo?(this.warnDowngradeOnce(o,"signed mode requires a float framebuffer (EXT_color_buffer_float); falling back to mean."),"mean"):i==="extreme"&&!t.isWebGL2?(this.warnDowngradeOnce(o,"extreme mode requires WebGL2 (for MAX blend and a second color attachment); falling back to mean."),"mean"):i}warnDowngradeOnce(t,n){t.signedDowngradeWarned||(t.signedDowngradeWarned=!0,console.warn(`Density: ${n}`))}runSplatAndResolve(t,n,o,i,r){if(this.ensureHeatTarget(t,n),o.heatWidth===0||o.heatHeight===0||!t.Q)return;let s=this.activeMode(n,t,o),a=t.c<t.f&&(!!t.s||t._.length>1),l=0,u=0;if(s!=="density"&&a&&(l=t.c,u=t.f,!t.j&&(s==="mean"||s==="extreme"))){let f=tm(t,o);f&&(l=f.lo,u=f.hi)}s==="extreme"&&this.ensureExtremeTarget(n,o),s==="extreme"&&o.indexedBlend?this.runMrtExtremePass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r):(this.runHeatPass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r),s==="extreme"&&this.runExtremePass(n,o,i,t.h.gradient_intensity,n.dpr*t.h.gradient_radius_px,l,u,r)),this.runResolvePass(n,o,t,s)}runHeatPass(t,n,o,i,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST);u.bindFramebuffer(u.FRAMEBUFFER,n.heatFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE),u.blendEquation(u.FUNC_ADD),this.bindSplatProgram(u,n.splat,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,n.splat,l),this.unbindSplatInstancing(t,n.splat)}runExtremePass(t,n,o,i,r,s,a,l){let u=t.gl,m=!!u.getParameter(u.SCISSOR_TEST),f=this.ensureExtremeSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.extremeFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),this.clearTarget(u,m),u.blendFunc(u.ONE,u.ONE);let b=u;b.blendEquation(b.MAX),this.bindSplatProgram(u,f,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,f,l),this.unbindSplatInstancing(t,f),u.blendEquation(u.FUNC_ADD)}runMrtExtremePass(t,n,o,i,r,s,a,l){let u=t.gl,m=n.indexedBlend,f=!!u.getParameter(u.SCISSOR_TEST),b=this.ensureMrtSplatProgram(t,n);u.bindFramebuffer(u.FRAMEBUFFER,n.mrtFramebuffer),u.viewport(0,0,n.heatWidth,n.heatHeight),u.drawBuffers([u.COLOR_ATTACHMENT0,u.COLOR_ATTACHMENT1]),this.clearTarget(u,f),m.enableiOES(u.BLEND,0),m.enableiOES(u.BLEND,1),m.blendEquationiOES(0,u.FUNC_ADD),m.blendFunciOES(0,u.ONE,u.ONE),m.blendEquationiOES(1,u.MAX),m.blendFunciOES(1,u.ONE,u.ONE),this.bindSplatProgram(u,b,o,i,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,b,l),this.unbindSplatInstancing(t,b),m.blendEquationiOES(0,u.FUNC_ADD),m.blendEquationiOES(1,u.FUNC_ADD),m.blendFunciOES(0,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),m.blendFunciOES(1,u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),u.drawBuffers([u.COLOR_ATTACHMENT0])}clearTarget(t,n){n&&t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),n&&t.enable(t.SCISSOR_TEST)}bindSplatProgram(t,n,o,i,r,s,a,l,u){t.useProgram(n.program),t.uniformMatrix4fv(n.u_projection,!1,o),t.uniform1f(n.u_intensity,i);let m=2*r/Math.max(1,s),f=2*r/Math.max(1,a);t.uniform2f(n.u_radius_ndc,m,f),t.uniform2f(n.u_color_range,l,u)}bindAndDispatchInstanced(t,n,o,i){let r=t.gl;r.bindBuffer(r.ARRAY_BUFFER,n.quadCornerBuffer),r.enableVertexAttribArray(o.a_corner),r.vertexAttribPointer(o.a_corner,2,r.FLOAT,!1,0,0);let s=q(t);s.setDivisor(o.a_corner,0),s.setDivisor(o.a_position,1),s.setDivisor(o.a_color_value,1);let a=t.C.peek("a_position"),l=t.C.peek("a_color_value");i((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,b=Float32Array.BYTES_PER_ELEMENT;r.bindBuffer(r.ARRAY_BUFFER,a.buffer),r.enableVertexAttribArray(o.a_position),r.vertexAttribPointer(o.a_position,2,r.FLOAT,!1,f,u*f),r.bindBuffer(r.ARRAY_BUFFER,l.buffer),r.enableVertexAttribArray(o.a_color_value),r.vertexAttribPointer(o.a_color_value,1,r.FLOAT,!1,b,u*b),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let o=q(t);o.setDivisor(n.a_position,0),o.setDivisor(n.a_color_value,0)}runResolvePass(t,n,o,i){let r=t.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),r.viewport(0,0,r.canvas.width,r.canvas.height),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA);let s=n.resolve;r.useProgram(s.program),r.uniform1f(s.u_heat_max,o.h.gradient_heat_max),r.uniform1i(s.u_color_mode,Ju(i)),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,n.heatTexture),r.uniform1i(s.u_heat,0),r.activeTexture(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,n.extremeTexture??n.heatTexture),r.uniform1i(s.u_extreme,1),Pe(t,o.Q.texture,s.u_gradient_lut,2),r.bindBuffer(r.ARRAY_BUFFER,n.tripleCornerBuffer),r.enableVertexAttribArray(s.a_corner),r.vertexAttribPointer(s.a_corner,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,3)}};em=5e4});var lt,xo,Co,_o,er=E(()=>{"use strict";Vt();ds();ys();Xi();Vs();ji();qi();Ki();Qi();lt=class extends Le{constructor(n){super();c(this,"glyph");c(this,"an","cartesian");c(this,"Q",null);c(this,"Ye","");c(this,"We","");c(this,"Ee","");c(this,"Te","");c(this,"gi",!1);c(this,"s","");c(this,"K","");c(this,"Yn","");c(this,"j",!1);c(this,"we",!1);c(this,"de",!1);c(this,"Xt",[]);c(this,"$t",[]);c(this,"yi",new Map);c(this,"xi",new Map);c(this,"et",null);c(this,"tt",null);c(this,"_",[]);c(this,"ce",1/0);c(this,"qe",-1/0);c(this,"Ce",1/0);c(this,"Ke",-1/0);c(this,"R",NaN);c(this,"M",NaN);c(this,"c",1/0);c(this,"f",-1/0);c(this,"Je",1/0);c(this,"Qe",-1/0);c(this,"nn",1/0);c(this,"on",-1/0);c(this,"rn",1/0);c(this,"sn",-1/0);c(this,"Un",1/0);c(this,"On",-1/0);c(this,"Vn",1/0);c(this,"Hn",-1/0);c(this,"w",0);c(this,"U",[]);c(this,"Ro",0);c(this,"O",null);c(this,"V",null);c(this,"gt",null);c(this,"Dt",null);c(this,"Bt",null);c(this,"bt",0);c(this,"u",new Map);c(this,"W",new wt);c(this,"Mo",null);c(this,"Fo",null);c(this,"So",null);c(this,"Ci",0);c(this,"zt",new to);c(this,"a",null);c(this,"se",-1);c(this,"Io",-1);c(this,"ln",-1);c(this,"v",null);c(this,"Re",null);c(this,"Me",null);c(this,"Xn",null);c(this,"Ge",null);c(this,"$n",null);c(this,"jn",!1);c(this,"zn",null);c(this,"Do",null);c(this,"Bo",-1);this.glyph=n}projectPoint(n,o){return[n,o]}renderBackground(n,o,i,r,s,a){}renderMapChrome(n,o,i,r){}tooltipCallbacks(){return{onHover:(n,o)=>$i(this,n,o),onLeave:()=>{this.se!==-1&&(this.se=-1,$e(this))},onPin:(n,o)=>{if($i(this,n,o),this.se>=0){let i=this.se;Us(this,i),this.Oi(i)}},onUnpin:()=>{this.emitUnselect()}}}async Oi(n){if(!this.Dt)return;let o=this.Dt[n],i=this.B[1]||this.B[0]||"",r=[];if(this._.length>0&&this.w>0){let s=Math.floor(n/this.w),a=this._[s];a?.prefix&&this.P.length>0&&(r=a.prefix.split("|"))}await this.emitClickAndSelect({rowIdx:o!=null&&o>=0?o:null,columnName:i,groupByValues:[],splitByValues:r})}async uploadAndRender(n,o,i,r){let s=r-i;this.e=n,i===0&&gs(this,n,o,r),s!==0&&(hs(this,n,o,i,s,r),this.h.domain_mode==="expand"&&(this.we||(this.nn=this.ce,this.on=this.qe),this.de||(this.rn=this.Ce,this.sn=this.Ke),this.Un=this.c,this.On=this.f,this.Vn=this.Je,this.Hn=this.Qe),await this.requestRender(n))}resetExpandedDomain(){this.nn=1/0,this.on=-1/0,this.rn=1/0,this.sn=-1/0,this.Un=1/0,this.On=-1/0,this.Vn=1/0,this.Hn=-1/0}Ft(n){n.uploadedCount===0&&this.bt===0||(this.e=n,Gs(this,n))}destroyInternal(){this.glyph.destroy(this),this.Q=null,this.O=null,this.V=null,this.gt=null,this.Dt=null,this.Bt=null,this.W.clearHover(),this.u.clear(),this.zt.clear(),this.Mo=null,this.Fo=null,this.So=null,this._=[],this.U=[],Os(this)}},xo=class extends lt{constructor(){super(new Rt)}},Co=class extends lt{constructor(){super(new Mt)}},_o=class extends lt{constructor(){super(new Ft)}}});function sl(e,t){if(t>rl||t<-rl)return[NaN,NaN];let n=e*Math.PI*6378137/180,o=t*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+o/2));return[n,i]}function al(e,t,n){let o=1<<e,i=2*ke/o,r=-ke+t*i,s=r+i,a=ke-n*i,l=a-i;return{xMin:r,yMin:l,xMax:s,yMax:a}}function ll(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let o=Math.log2(2*ke/(t*e));return Math.max(0,Math.min(n,Math.floor(o)))}function ul(e,t){let n=1<<t,o=2*ke/n,i=Math.floor((e.xMin+ke)/o),r=Math.floor((e.xMax+ke)/o),s=Math.floor((ke-e.yMax)/o),a=Math.floor((ke-e.yMin)/o),l=[];for(let u=s;u<=a;u++)if(!(u<0||u>=n))for(let m=i;m<=r;m++)m<0||m>=n||l.push({z:t,x:m,y:u});return l}var ke,rl,Sr=E(()=>{"use strict";ke=Math.PI*6378137,rl=85.0511287798066});var mi,ml=E(()=>{"use strict";mi=class{constructor(t=256){c(this,"he",new Map);c(this,"Di");this.Di=t}get(t){let n=this.he.get(t);return n!==void 0&&(this.he.delete(t),this.he.set(t,n)),n}set(t,n,o){if(this.he.has(n)){let i=this.he.get(n);t.deleteTexture(i),this.he.delete(n)}for(this.he.set(n,o);this.he.size>this.Di;){let i=this.he.keys().next().value;if(i===void 0)break;let r=this.he.get(i);t.deleteTexture(r),this.he.delete(i)}}has(t){return this.he.has(t)}dispose(t){for(let n of this.he.values())t.deleteTexture(n);this.he.clear()}}});function Wt(e,t,n,o){return`${e}/${t}/${n}/${o}`}var fi,fl=E(()=>{"use strict";fi=class{constructor(){c(this,"ye",new Map);c(this,"Bi",()=>{})}setOnLoad(t){this.Bi=t}load(t,n,o,i){let r=Wt(t.id,n,o,i),s=this.ye.get(r);if(s)return s.promise;let a=new AbortController,l=t.urlFor(n,o,i),u=this.Yi(l,a.signal).then(m=>(this.ye.delete(r),m&&this.Bi(),m)).catch(()=>(this.ye.delete(r),null));return this.ye.set(r,{promise:u,abort:a}),u}cancelAll(){for(let t of this.ye.values())t.abort.abort();this.ye.clear()}cancelExcept(t){for(let[n,o]of this.ye)t.has(n)||(o.abort.abort(),this.ye.delete(n))}async Yi(t,n){let o=await fetch(t,{signal:n});if(!o.ok)return null;let i=await o.blob();return await createImageBitmap(i)}}});var ci,cl=E(()=>{"use strict";Sr();ml();fl();wi();Ri();ue();ci=class{constructor(){c(this,"o",null);c(this,"G",null);c(this,"m",new mi);c(this,"_n",new fi);c(this,"vn",null);c(this,"Ii",1);c(this,"Pi",()=>{})}setOnTileLoad(t){this.Pi=t,this._n.setOnLoad(t)}setSource(t,n){this.vn?.id!==n.id&&(this.m.dispose(t),this._n.cancelAll(),this.vn=n)}setAlpha(t){this.Ii=Math.max(0,Math.min(1,t))}get source(){return this.vn}render(t,n,o,i,r,s){let a=this.vn;if(!a)return;this.zi(t);let l=this.o,u=this.G;if(!l||!u)return;let m=t.gl,f=t.dpr,b=Math.max(1,n.t.width*f),p=i.xMax-i.xMin;if(!isFinite(p)||p<=0)return;let d=p/b,g=ll(d,a.tileSize,a.maxZoom),h=ul(i,g),y=new Set;for(let C of h)y.add(Wt(a.id,C.z,C.x,C.y));this._n.cancelExcept(y),m.useProgram(l.program),m.uniformMatrix4fv(l.u_projection,!1,o),m.uniform1f(l.u_alpha,this.Ii),m.bindBuffer(m.ARRAY_BUFFER,u),m.enableVertexAttribArray(l.a_corner),m.vertexAttribPointer(l.a_corner,2,m.FLOAT,!1,0,0),m.activeTexture(m.TEXTURE0),m.uniform1i(l.u_tile,0);let x=m.isEnabled(m.BLEND);m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);for(let C of h)this.Xi(m,l,a,C,r,s);x||m.disable(m.BLEND)}destroy(t){this._n.cancelAll(),this.m.dispose(t),this.G&&(t.deleteBuffer(this.G),this.G=null),this.o=null}Xi(t,n,o,i,r,s){let a=al(i.z,i.x,i.y),l={xMin:a.xMin-r,xMax:a.xMax-r,yMin:a.yMin-s,yMax:a.yMax-s},u=Wt(o.id,i.z,i.x,i.y),m=this.m.get(u);if(m){this.Ei(t,n,m,l,[0,0],[1,1]);return}this.$i(t,o,i);for(let f=1;f<=6;f++){let b=i.z-f;if(b<0)return;let p=i.x>>f,d=i.y>>f,g=Wt(o.id,b,p,d),h=this.m.get(g);if(!h)continue;let y=1<<f,x=i.x-p*y,C=i.y-d*y,_=1/y,v=[x*_,C*_],A=[v[0]+_,v[1]+_];this.Ei(t,n,h,l,v,A);return}}Ei(t,n,o,i,r,s){t.bindTexture(t.TEXTURE_2D,o),t.uniform2f(n.u_extent_min,i.xMin,i.yMin),t.uniform2f(n.u_extent_max,i.xMax,i.yMax),t.uniform2f(n.u_uv_min,r[0],r[1]),t.uniform2f(n.u_uv_max,s[0],s[1]),t.drawArrays(t.TRIANGLE_STRIP,0,4)}$i(t,n,o){let i=Wt(n.id,o.z,o.x,o.y);this.m.has(i)||this._n.load(n,o.z,o.x,o.y).then(r=>{if(!r)return;if(this.vn?.id!==n.id){r.close();return}let s=t.createTexture();if(!s){r.close();return}t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),this.m.set(t,i,s),this.Pi()})}zi(t){if(this.o&&this.G)return;let n=t.gl;this.o=j(t,"map-tile",Yn,zn,["u_projection","u_extent_min","u_extent_max","u_uv_min","u_uv_max","u_tile","u_alpha"],["a_corner"]);let o=n.createBuffer();o&&(n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.G=o)}}});function cf(){return new hn("carto-positron","https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function df(){return new hn("carto-dark-matter","https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function pf(){return new hn("carto-voyager","https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png","\\xA9 OpenStreetMap contributors \\xA9 CARTO",256,19,["a","b","c","d"])}function Dr(e){switch(e){case"carto-dark-matter":return df();case"carto-voyager":return pf();case"carto-positron":default:return cf()}}var hn,dl=E(()=>{"use strict";hn=class{constructor(t,n,o,i=256,r=19,s=[]){this.id=t;this.template=n;this.attribution=o;this.tileSize=i;this.maxZoom=r;this.subdomains=s}urlFor(t,n,o){let i=this.template.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(o));if(this.subdomains.length>0){let r=(n+o)%this.subdomains.length;i=i.replace("{s}",this.subdomains[r])}return i}}});var di={};Ml(di,{MapChart:()=>Gt,MapDensityChart:()=>Pr,MapLineChart:()=>Ir,MapScatterChart:()=>Br});var Gt,Br,Ir,Pr,pi=E(()=>{"use strict";er();qi();Ki();Qi();cl();dl();Sr();Ct();Gt=class extends lt{constructor(n){super(n);c(this,"an","map");c(this,"je");this.je=new ci,this.je.setOnTileLoad(()=>{this.e&&this.requestRender(this.e)})}projectPoint(n,o){return sl(n,o)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.e&&this.je.setSource(this.e.gl,Dr(n.map_tile_provider)),this.je.setAlpha(n.map_tile_alpha)}renderBackground(n,o,i,r,s,a){this.je.source||(this.je.setSource(n.gl,Dr(this.h.map_tile_provider)),this.je.setAlpha(this.h.map_tile_alpha)),this.je.render(n,o,i,r,s,a)}renderMapChrome(n,o,i,r){if(!n)return;let s=le(n,r);if(!s)return;let a=this.je.source?.attribution??"";if(!a)return;let l=o.t;s.save(),s.font=`10px ${i.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(a).width,b=12,p=l.x+l.width-4,d=l.y+l.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(p-f-u*2,d-b-u,f+u*2,b+u),s.fillStyle=i.xe,s.fillText(a,p-u,d-u/2),s.restore()}destroyInternal(){this.e&&this.je.destroy(this.e.gl),super.destroyInternal()}},Br=class extends Gt{constructor(){super(new Rt)}},Ir=class extends Gt{constructor(){super(new Mt)}},Pr=class extends Gt{constructor(){super(new Ft)}}});typeof window>"u"&&(globalThis.window={});var Nt=class{constructor(t){c(this,"S");c(this,"An",new Map);this.S=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,o){let i=this.An.get(t);if(i)return i;let r=this.S,s=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(s,n),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(s);throw r.deleteShader(s),new Error(`Vertex shader compile error [${t}]: ${l}`)}let a=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(a,o),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS)){let l=r.getShaderInfoLog(a);throw r.deleteShader(s),r.deleteShader(a),new Error(`Fragment shader compile error [${t}]: ${l}`)}if(i=r.createProgram(),r.attachShader(i,s),r.attachShader(i,a),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS)){let l=r.getProgramInfoLog(i);throw r.deleteProgram(i),r.deleteShader(s),r.deleteShader(a),new Error(`Shader link error [${t}]: ${l}`)}return r.deleteShader(s),r.deleteShader(a),this.An.set(t,i),i}releaseAll(){for(let t of this.An.values())this.S.deleteProgram(t);this.An.clear()}};var vn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;attribute float a_series_id;attribute float a_axis;uniform mat4 u_proj_left;uniform mat4 u_proj_right;uniform float u_hover_series;uniform float u_horizontal;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec2 A;if(u_horizontal>0.5){A=vec2(mix(a_y0,a_y1,a_corner.x),a_x_center+(a_corner.y-0.5)*2.*a_half_width);}else{A=vec2(a_x_center+(a_corner.x-0.5)*2.*a_half_width,mix(a_y0,a_y1,a_corner.y));}mat4 B=a_axis<0.5?u_proj_left:u_proj_right;gl_Position=B*vec4(A,0.,1.);v_color=a_color;v_hover=abs(a_series_id-u_hover_series)<0.5?1.:0.;v_local=a_corner;}";var An="precision highp float;varying vec3 v_color;varying float v_hover;varying vec2 v_local;void main(){vec3 A=v_color;if(v_hover>0.5){A=mix(A,vec3(1.),0.25);}gl_FragColor=vec4(A,1.);}";hi();yi();xi();Ci();var Mn="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var Fn="precision highp float;uniform vec3 u_color;uniform float u_opacity;void main(){gl_FragColor=vec4(u_color,u_opacity);}";var Ue="attribute vec2 a_start;attribute vec2 a_end;attribute float a_corner;attribute float a_real_start;attribute float a_real_end;uniform mat4 u_projection;uniform vec2 u_resolution;uniform float u_line_width;uniform float u_interp_alpha;varying float v_edge_dist;varying float v_seg_alpha;void main(){vec4 A=u_projection*vec4(a_start,0.,1.);vec4 B=u_projection*vec4(a_end,0.,1.);vec2 C=A.xy*u_resolution*0.5;vec2 D=B.xy*u_resolution*0.5;vec2 E=D-C;float F=length(E);E=F>0.001?E/F:vec2(1.,0.);vec2 G=vec2(-E.y,E.x);float H=step(1.5,a_corner);float I=1.-mod(a_corner,2.)*2.;vec4 J=mix(A,B,H);float K=(u_line_width+1.5)*0.5;vec2 L=(G*I*K)/(u_resolution*0.5);gl_Position=J+vec4(L,0.,0.);v_edge_dist=I;float M=a_real_start*a_real_end;v_seg_alpha=mix(u_interp_alpha,1.,step(0.5,M));}";var Oe="precision highp float;uniform vec4 u_color;uniform float u_line_width;varying float v_edge_dist;varying float v_seg_alpha;void main(){float A=abs(v_edge_dist);float B=u_line_width/(u_line_width+1.5);float C=1.-smoothstep(B,1.,A);gl_FragColor=vec4(u_color.rgb,u_color.a*C*v_seg_alpha);}";var Sn="attribute vec2 a_position;attribute vec3 a_color;uniform mat4 u_projection;uniform float u_point_size;varying vec3 v_color;varying float v_point_size;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);gl_PointSize=u_point_size;v_point_size=u_point_size;v_color=a_color;}";var Dn="precision highp float;varying vec3 v_color;varying float v_point_size;void main(){vec2 A=gl_PointCoord-vec2(0.5);float B=length(A);if(B>0.5)discard;float C=1.5/max(v_point_size,1.);float D=1.-smoothstep(0.5-C,0.5,B);gl_FragColor=vec4(v_color,D);}";var Bn="attribute vec2 a_corner;attribute float a_x_center;attribute float a_half_width;attribute float a_y0;attribute float a_y1;attribute vec3 a_color;uniform mat4 u_projection;varying vec3 v_color;void main(){float A=a_x_center+(a_corner.x-0.5)*2.*a_half_width;float B=mix(a_y0,a_y1,a_corner.y);gl_Position=u_projection*vec4(A,B,0.,1.);v_color=a_color;}";var In="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var Pn="attribute vec2 a_corner;attribute vec2 a_cell;attribute float a_color_t;uniform mat4 u_projection;uniform vec2 u_cell_inset;uniform vec2 u_cell_size;varying float v_color_t;void main(){vec2 A=0.5*u_cell_size;vec2 B=u_cell_size-2.*u_cell_inset;float C=a_cell.x-A.x+u_cell_inset.x+a_corner.x*B.x;float D=a_cell.y-A.y+u_cell_inset.y+a_corner.y*B.y;gl_Position=u_projection*vec4(C,D,0.,1.);v_color_t=a_color_t;}";var En="precision highp float;uniform sampler2D u_gradient_lut;varying float v_color_t;void main(){float A=clamp(v_color_t,0.,1.);vec4 B=texture2D(u_gradient_lut,vec2(A,0.5));gl_FragColor=vec4(B.rgb,1.);}";var Wn="attribute float a_strip_t;attribute float a_side;attribute vec2 a_angles;attribute vec2 a_radii;attribute vec4 a_color;uniform vec2 u_center;uniform vec2 u_resolution;uniform float u_border_px;varying vec4 v_color;varying vec2 v_edge;void main(){float A=u_border_px*0.5;float B=a_radii.x+A;float C=a_radii.y-A;if(C<=B){gl_Position=vec4(2.,2.,2.,1.);v_color=vec4(0.);v_edge=vec2(0.);return;}float D=mix(B,C,a_side);float E=A/max(D,1.);float F=a_angles.y-a_angles.x;E=min(E,F*0.5);float G=mix(a_angles.x+E,a_angles.y-E,a_strip_t);vec2 H=u_center+vec2(cos(G),sin(G))*D;vec2 I=(H/u_resolution)*2.-1.;gl_Position=vec4(I.x,-I.y,0.,1.);v_color=a_color;v_edge=vec2(a_strip_t,a_side);}";var Gn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var kn="attribute vec2 a_position;attribute vec4 a_color;uniform vec2 u_resolution;varying vec4 v_color;void main(){vec2 A=(a_position/u_resolution)*2.-1.;A.y=-A.y;gl_Position=vec4(A,0.,1.);v_color=a_color;}";var Nn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";_i();vi();Ai();Li();Ti();wi();Ri();var Mi=[{name:"bar",vert:vn,frag:An},{name:"line",vert:Ln,frag:Tn},{name:"scatter",vert:wn,frag:Rn},{name:"bar-area",vert:Mn,frag:Fn},{name:"bar-scatter",vert:Sn,frag:Dn},{name:"line-uniform",vert:Ue,frag:Oe},{name:"candlestick-body",vert:Bn,frag:In},{name:"heatmap",vert:Pn,frag:En},{name:"sunburst-arc",vert:Wn,frag:Gn},{name:"treemap",vert:kn,frag:Nn},{name:"density-splat",vert:gt,frag:Un},{name:"density-extreme",vert:gt,frag:On},{name:"density-resolve",vert:Vn,frag:Hn},{name:"map-tile",vert:Yn,frag:zn}];var Ut=class{constructor(t){c(this,"S");c(this,"i",new Map);c(this,"qt",0);c(this,"Ln",0);this.S=t}get totalCapacity(){return this.qt}get maxCapacity(){return this.Ln}set maxCapacity(t){this.Ln=t}ensureCapacity(t){this.qt=this.Ln>0?Math.min(t,this.Ln):t}peek(t){return this.i.get(t)}getOrCreate(t,n,o){let i=this.qt*n*o,r=this.i.get(t);if(r&&r.byteCapacity>=i)return r;let s=this.S;r&&s.deleteBuffer(r.buffer);let a=s.createBuffer();return s.bindBuffer(s.ARRAY_BUFFER,a),s.bufferData(s.ARRAY_BUFFER,i,s.DYNAMIC_DRAW),r={buffer:a,byteCapacity:i},this.i.set(t,r),r}upload(t,n,o,i=1){let r=this.S,s=this.getOrCreate(t,i,n.BYTES_PER_ELEMENT);if(!1){let a=o+n.byteLength;if(a>s.byteCapacity)throw new Error(`BufferPool.upload("${t}"): write ${o}..${a} exceeds capacity ${s.byteCapacity} (_totalCapacity=${this.qt}, components=${i}, bytes=${n.BYTES_PER_ELEMENT}). Did you pass the full scratch buffer instead of a subarray(0, n)?`)}return r.bindBuffer(r.ARRAY_BUFFER,s.buffer),r.bufferSubData(r.ARRAY_BUFFER,o,n),s.buffer}releaseAll(){for(let t of this.i.values())this.S.deleteBuffer(t.buffer);this.i.clear(),this.qt=0}};var Xn=class{constructor(t,n={}){c(this,"Ut");c(this,"S");c(this,"Tn");c(this,"_t");c(this,"i");c(this,"wn",0);c(this,"oi",0);c(this,"ii",0);c(this,"ri",1);c(this,"po");c(this,"bo",null);c(this,"ct",null);c(this,"Rn",null);this.Ut=t,this.po=n.precompile??!1;let o=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(o)this.S=o,this.Tn=!0;else{let i=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!i)throw new Error("WebGL is not supported");this.S=i,this.Tn=!1}this._t=new Nt(this.S),this.i=new Ut(this.S),this.po&&this._t.precompile(Mi),t.addEventListener("webglcontextlost",i=>{i.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this._t.releaseAll(),this.i.releaseAll(),this._t=new Nt(this.S),this.i=new Ut(this.S),this.wn=0,this.po&&this._t.precompile(Mi)})}get gl(){return this.S}get isWebGL2(){return this.Tn}get shaders(){return this._t}get C(){return this.i}get uploadedCount(){return this.wn}set uploadedCount(t){this.wn=t}resize(t,n,o){this.oi=t,this.ii=n,this.ri=o;let i=Math.round(t*o),r=Math.round(n*o);(this.Ut.width!==i||this.Ut.height!==r)&&(this.Ut.width=i,this.Ut.height=r,this.S.viewport(0,0,i,r))}requestResize(t,n,o){this.Rn={cssWidth:t,cssHeight:n,dpr:o}}applyPendingResize(){if(!this.Rn)return!1;let{cssWidth:t,cssHeight:n,dpr:o}=this.Rn;return this.Rn=null,this.resize(t,n,o),!0}get cssWidth(){return this.oi}get cssHeight(){return this.ii}get dpr(){return this.ri}clear(){this.S.clearColor(0,0,0,0),this.S.clear(this.S.COLOR_BUFFER_BIT|this.S.DEPTH_BUFFER_BIT),this.wn=0}setFrameCallback(t){this.bo=t}endFrame(){if(!this.bo)return;let t=this.Ut;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.bo(n)}async awaitGpuFence(){if(!this.Tn){this.S.finish();return}let t=this.S,n=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0);if(!n){t.finish();return}try{let o=t.SYNC_FLUSH_COMMANDS_BIT;for(;;){let i=t.clientWaitSync(n,o,0);if(i===t.ALREADY_SIGNALED||i===t.CONDITION_SATISFIED)return;if(i===t.WAIT_FAILED){t.finish();return}o=0,await this.Gi()}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.i.ensureCapacity(t)}Gi(){return this.ct||(this.ct=new MessageChannel,this.ct.port1.start()),new Promise(t=>{let n=this.ct;n.port1.addEventListener("message",()=>t(),{once:!0}),n.port2.postMessage(null)})}destroy(){this.i.releaseAll(),this._t.releaseAll(),this.ct&&(this.ct.port1.close(),this.ct.port2.close(),this.ct=null);let t=this.S.getExtension("WEBGL_lose_context");t&&t.loseContext()}};$n();$n();function zr(e,t,n,o){let{controller:i,layout:r}=e,s=r.t,a=i.getVisibleDomain(),l=a.xMin+(t-s.x)/s.width*(a.xMax-a.xMin),u=a.yMax-(n-s.y)/s.height*(a.yMax-a.yMin),m=Math.pow(1.1,-o/100),f=i.lockedAxis;f!=="x"&&(i.scaleX=Math.max(1,Math.min(1e5,i.scaleX*m))),f!=="y"&&(i.scaleY=Math.max(1,Math.min(1e5,i.scaleY*m)));let b=i.getVisibleDomain(),p=b.xMin+(t-s.x)/s.width*(b.xMax-b.xMin),d=b.yMax-(n-s.y)/s.height*(b.yMax-b.yMin),g=i.baseXRange,h=i.baseYRange;f!=="x"&&g>0&&(i.normTranslateX+=(l-p)/g),f!=="y"&&h>0&&(i.normTranslateY+=(u-d)/h)}function Xr(e,t,n){let{controller:o,layout:i}=e,r=o.getVisibleDomain(),s=i.t,a=(r.xMax-r.xMin)/s.width,l=(r.yMax-r.yMin)/s.height,u=o.lockedAxis,m=o.baseXRange,f=o.baseYRange;u!=="x"&&m>0&&(o.normTranslateX-=t*a/m),u!=="y"&&f>0&&(o.normTranslateY+=n*l/f)}var jn=class{constructor(t){c(this,"Ot");this.Ot=t}pin(t,n,o){this.Ot({kind:"pinTooltip",lines:t,pos:n,bounds:o})}dismiss(){this.Ot({kind:"dismissTooltip"})}setCursor(t){this.Ot({kind:"setCursor",cursor:t})}emitUserClick(t){this.Ot({kind:"userClick",detail:t})}emitUserSelect(t){this.Ot({kind:"userSelect",selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig})}};er();Vt();var vo=class{constructor(t=1024){c(this,"size");c(this,"value");c(this,"colorValue");c(this,"sizeSign");c(this,"x0");c(this,"y0");c(this,"x1");c(this,"y1");c(this,"a0");c(this,"a1");c(this,"r0");c(this,"r1");c(this,"depth");c(this,"parent");c(this,"firstChild");c(this,"nextSibling");c(this,"lastChild");c(this,"childCount");c(this,"leafRowIdx");c(this,"name");c(this,"colorLabel");c(this,"count",0);c(this,"capacity",0);this._i(t)}reset(){this.count>0&&(this.x0.fill(0,0,this.count),this.y0.fill(0,0,this.count),this.x1.fill(0,0,this.count),this.y1.fill(0,0,this.count),this.a0.fill(0,0,this.count),this.a1.fill(0,0,this.count),this.r0.fill(0,0,this.count),this.r1.fill(0,0,this.count)),this.count=0}allocate(){this.count===this.capacity&&this._i(this.capacity*2);let t=this.count++;return this.firstChild[t]=-1,this.nextSibling[t]=-1,this.lastChild[t]=-1,this.childCount[t]=0,this.leafRowIdx[t]=-1,this.size[t]=0,this.value[t]=0,this.colorValue[t]=NaN,this.sizeSign[t]=1,this.name[t]="",this.colorLabel[t]="",t}appendChild(t,n){this.parent[n]=t,this.depth[n]=this.depth[t]+1,this.nextSibling[n]=-1;let o=this.lastChild[t];o===-1?this.firstChild[t]=n:this.nextSibling[o]=n,this.lastChild[t]=n,this.childCount[t]++}isLeaf(t){return this.firstChild[t]===-1}_i(t){let n=Math.max(t,1024),o=(i,r)=>{let s=new r(n);return i&&i.length>0&&s.set(i),s};this.size=o(this.size,Float32Array),this.value=o(this.value,Float32Array),this.colorValue=o(this.colorValue,Float32Array),this.sizeSign=o(this.sizeSign,Int8Array),this.x0=o(this.x0,Float32Array),this.y0=o(this.y0,Float32Array),this.x1=o(this.x1,Float32Array),this.y1=o(this.y1,Float32Array),this.a0=o(this.a0,Float32Array),this.a1=o(this.a1,Float32Array),this.r0=o(this.r0,Float32Array),this.r1=o(this.r1,Float32Array),this.depth=o(this.depth,Int32Array),this.parent=o(this.parent,Int32Array),this.firstChild=o(this.firstChild,Int32Array),this.nextSibling=o(this.nextSibling,Int32Array),this.lastChild=o(this.lastChild,Int32Array),this.childCount=o(this.childCount,Int32Array),this.leafRowIdx=o(this.leafRowIdx,Int32Array),this.name?this.name.length=n:this.name=new Array(n),this.colorLabel?this.colorLabel.length=n:this.colorLabel=new Array(n),this.capacity=n}};function Zs(e,t){let n=[],o=t;for(;e.parent[o]!==-1;)n.push(e.name[o]),o=e.parent[o];return n.reverse()}ji();function Ao(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var St=class extends Le{constructor(){super(...arguments);c(this,"K","");c(this,"s","");c(this,"pe","empty");c(this,"r",new vo);c(this,"Y",-1);c(this,"g",-1);c(this,"ae",[]);c(this,"It",new Map);c(this,"Zn",0);c(this,"c",1/0);c(this,"f",-1/0);c(this,"u",new Map);c(this,"X",null);c(this,"ee",0);c(this,"W",new wt)}};Ht();Kt();ve();function ut(e,t,n,o,i){if(!e||t<=0)return null;let r=new Float64Array(t),s=1/0,a=-1/0;for(let u=0;u<t;u++){let m=e[u+n];r[u]=m,m<s&&(s=m),m>a&&(a=m)}let l=1/0;for(let u=1;u<t;u++){let m=Math.abs(r[u]-r[u-1]);m>0&&m<l&&(l=m)}return(!isFinite(l)||l===0)&&(l=Math.max(1,a-s)),{categoryPositions:r,numericCategoryDomain:{min:s-l/2,max:a+l/2,isDate:i,label:o,bandWidth:l}}}function Dt(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function om(e,t,n){return t?n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?he(e):n==="integer"?String(e|0):n==="float"?ae(e):String(e):""}function tr(e,t,n){let o=e.values,i=e.valid,r=new Int32Array(t),s=[""],a=new Map;a.set("",0);for(let l=0;l<t;l++){let u=i?!!(i[l>>3]>>(l&7)&1):!0,m=o[l],f=om(m,u,n),b=a.get(f);b===void 0&&(b=s.length,s.push(f),a.set(f,b)),r[l]=b}return{indices:r,dictionary:s}}function Bt(e,t,n,o=[]){let i=[];for(let u=0;;u++){let m=e.get(`__ROW_PATH_${u}__`);if(!m)break;if(m.type==="string"&&m.indices&&m.dictionary)i.push({indices:m.indices,dictionary:m.dictionary});else if(m.values){let f=o[u]??"string";i.push(tr(m,t,f))}else break}let r=0;if(n>0&&i.length>0)for(;r<t;){let u=!1;for(let m of i){let f=m.dictionary[m.indices[r]];if(f!=null&&f!==""){u=!0;break}}if(u)break;r++}let s=Math.max(0,t-r),a=i.length;return{rowPaths:n>0&&a>0?i.map((u,m)=>{let f=new Array(s),b=0;for(let d=0;d<s;d++){let g=u.dictionary[u.indices[d+r]]??"";f[d]=g,g.length>b&&(b=g.length)}let p=m===a-1?[]:uo(u.indices,u.dictionary,r,r+s).map(d=>({startIdx:d.startIdx-r,endIdx:d.endIdx-r,label:d.label}));return{labels:f,runs:p,maxLabelChars:b}}):[],numCategories:s,rowOffset:r}}function nr(e,t,n,o){if(e.length===0)return null;for(let b of e)if(b.type!=="string")return null;let i=Math.max(0,t-n),r=[],s=new Map,a=e.map(()=>new Int32Array(i)),l=b=>{let p=s.get(b);return p===void 0&&(p=r.length,r.push(b),s.set(b,p)),p};for(let b=0;b<e.length;b++){let p=e[b].data,d=a[b];for(let g=0;g<i;g++){let h=g+n,y;if(!p)y="(null)";else{let x=p.valid;if(!(x?!!(x[h>>3]>>(h&7)&1):!0))y="(null)";else if(p.indices&&p.dictionary)y=p.dictionary[p.indices[h]]??"(null)";else if(p.values){let _=p.values[h];y=_==null?"(null)":String(_)}else y="(null)"}d[g]=l(y)}}let u=0;for(let b of r)b.length>u&&(u=b.length);return{domain:{levels:[{labels:r.slice(),runs:[],maxLabelChars:u}],numRows:r.length,levelLabels:[o]},perColumnSlots:a}}function tn(e){e.r.reset(),e.It.clear();let t=e.r.allocate();e.r.name[t]="Total",e.r.depth[t]=0,e.r.parent[t]=-1,e.It.set(t,new Map),e.Y=t,e.g=t,e.ae=[t],e.Zn=0,e.c=1/0,e.f=-1/0,e.u.clear(),e.X=null,e.ee=0}function im(e,t,n){let o=e.It.get(t);o||(o=new Map,e.It.set(t,o));let i=o.get(n);if(i!==void 0)return i;let r=e.r.allocate();return e.r.name[r]=n,e.r.appendChild(t,r),o.set(n,r),r}function Lo(e,t,n,o,i,r,s){let a=e.Y,l=t.length;for(let u=0;u<l;u++){let m=im(e,a,t[u]);u===l-1&&((s===0||l===s)&&(e.r.size[m]=Math.abs(n),e.r.sizeSign[m]=n<0?-1:1,e.r.leafRowIdx[m]=r),isNaN(o)||(e.r.colorValue[m]=o,o<e.c&&(e.c=o),o>e.f&&(e.f=o)),i&&(e.r.colorLabel[m]=i,e.u.has(i)||e.u.set(i,e.u.size))),a=m}}function To(e,t,n){let o=NaN,i="";return t?(e.pe==="numeric"&&t.values?o=t.values[n]:e.pe==="series"&&t.indices&&t.dictionary&&(i=t.dictionary[t.indices[n]]),{colorValue:o,colorLabel:i}):{colorValue:o,colorLabel:i}}function qs(e,t){if(e.pe!=="series"||!t?.dictionary)return;let n=t.dictionary;for(let o=0;o<n.length;o++){let i=n[o];e.u.has(i)||e.u.set(i,e.u.size)}}function rm(e,t){if(e.P.length===0)return null;let n=e.K?[e.K]:[],o=e.s?[e.s]:[],i=Ve(t,n,o);return i.length===0?null:i.map(r=>({prefix:r.prefix,sizeCol:e.K?t.get(`${r.prefix}|${e.K}`)??null:null,colorCol:e.s?t.get(`${r.prefix}|${e.s}`)??null:null}))}function nn(e,t){let n=[];for(let g=0;;g++){let h=t.get(`__ROW_PATH_${g}__`);if(!h)break;if(h.type==="string"&&h.indices&&h.dictionary)n.push({indices:h.indices,dictionary:h.dictionary});else if(h.values){let y=e.A[g],x=e.pt[y]??"string";n.push(tr(h,h.values.length,x))}else break}let o=n.length>0,i=e.A.length,r=rm(e,t),s=r!==null,a=e.K?t.get(e.K):null,l=e.s?t.get(e.s):null,u=s?r[0].sizeCol:a,m=o?n[0].indices.length:u?.values?.length??0;if(m===0)return;if(s)for(let g of r)qs(e,g.colorCol);else qs(e,l);let f=e.Zn,b=s&&o?i+1:i;if(!o){let g;for(let[y,x]of t){if(y.startsWith("__")||s&&y.includes("|"))continue;let C=y.lastIndexOf("|"),_=C===-1?y:y.substring(C+1);if(!(_===e.K||_===e.s)&&x.type==="string"&&x.indices&&x.dictionary){g=x;break}}let h=s?r:null;for(let y=0;y<m;y++){let x=g?.indices&&g?.dictionary?g.dictionary[g.indices[y]]:`Row ${f+y}`;if(h)for(let C of h){let _=C.sizeCol?.values?C.sizeCol.values[y]:1,{colorValue:v,colorLabel:A}=To(e,C.colorCol,y);Lo(e,[C.prefix,x],_,v,A,f+y,b)}else{let C=a?.values?a.values[y]:1,{colorValue:_,colorLabel:v}=To(e,l,y);Lo(e,[x],C,_,v,f+y,b)}}e.Zn=f+m;return}let p=s?1:0,d=new Array(n.length+p);for(let g=0;g<m;g++){let h=0;for(let y=0;y<n.length;y++){let x=n[y],C=x.dictionary[x.indices[g]];if(!C&&C!=="0")break;d[p+h++]=C}if(h!==0)if(s)for(let y of r){d[0]=y.prefix;let x=d.slice(0,h+1),C=y.sizeCol?.values?y.sizeCol.values[g]:1,{colorValue:_,colorLabel:v}=To(e,y.colorCol,g);Lo(e,x,C,_,v,f+g,b)}else{let y=d.slice(0,h),x=a?.values?a.values[g]:1,{colorValue:C,colorLabel:_}=To(e,l,g);Lo(e,y,x,C,_,f+g,b)}}e.Zn=f+m}function on(e){let t=e.r,n=t.value,o=t.size,i=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.Y,s[1]=0;let a=1;for(let l=0;l<t.count;l++)n[l]=0;for(;a>0;){a--;let l=s[a*2];if(s[a*2+1]===0){s[a*2+1]=1,a++;for(let m=i[l];m!==-1;m=r[m]){if((a+1)*2>s.length){let f=new Int32Array(s.length*2);f.set(s),s=f}s[a*2]=m,s[a*2+1]=0,a++}}else if(i[l]===-1)n[l]=Math.max(0,o[l]);else{let m=0;for(let f=i[l];f!==-1;f=r[f])m+=n[f];n[l]=m}}if(e.ae.length>1){let l=[];for(let f=1;f<e.ae.length;f++)l.push(t.name[e.ae[f]]);let u=e.Y,m=!0;for(let f of l){let p=e.It.get(u)?.get(f);if(p===void 0){m=!1;break}u=p}if(m&&t.firstChild[u]!==-1){e.g=u,wo(e,u);return}}e.g=e.Y,e.ae=[e.Y]}function wo(e,t){let n=[],o=t;for(;o!==-1;)n.unshift(o),o=e.r.parent[o];e.ae=n}var sm=1,or=14,Ks=1,Js=4;function Ro(e,t,n,o,i,r,s,a,l){if(e.x0[t]=Math.round(n),e.y0[t]=Math.round(o),e.x1[t]=Math.round(i),e.y1[t]=Math.round(r),e.firstChild[t]===-1||(i-n)*(r-o)<Js)return;let m=e.depth[t]-s,f=l&&m===1&&e.firstChild[t]!==-1,b=f?or:Ks,p=f?sm:Ks,d=e.x0[t]+p,g=e.y0[t]+b,h=e.x1[t]-p,y=e.y1[t]-p;if(h<=d||y<=g)return;let x=0;for(let C=e.firstChild[t];C!==-1;C=e.nextSibling[C])e.value[C]>0&&(a[x++]=C);x!==0&&rn(e,a,0,x,d,g,h,y,s,a.subarray(x),l)}function rn(e,t,n,o,i,r,s,a,l,u,m){let f=o-n;if(f===0)return;if(f===1){Ro(e,t[n],i,r,s,a,l,u,m);return}let b=0;for(let v=n;v<o;v++)b+=e.value[t[v]];let p=b/2,d=0,g=n+1,h=1/0;for(let v=n;v<o-1;v++){d+=e.value[t[v]];let A=Math.abs(d-p);A<h&&(h=A,g=v+1)}let y=0;for(let v=n;v<g;v++)y+=e.value[t[v]];let x=y/b,C=s-i,_=a-r;if(C>=_){let v=Math.round(i+C*x);rn(e,t,n,g,i,r,v,a,l,u,m),rn(e,t,g,o,v,r,s,a,l,u,m)}else{let v=Math.round(r+_*x);rn(e,t,n,g,i,r,s,v,l,u,m),rn(e,t,g,o,i,v,s,a,l,u,m)}}function Qs(e,t,n,o){e.ee=ir(e,t,n,o,0)}function ir(e,t,n,o,i){let r=e.r,s=r.x0,a=r.y0,l=r.x1,u=r.y1,m=r.depth,f=r.firstChild,b=r.nextSibling,p=r.value;(!e.X||e.X.length<r.count)&&(e.X=new Int32Array(r.count));let d=e.X,g=i,h=new Int32Array(128);h[0]=t;let y=1;for(;y>0;){y--;let x=h[y];if(p[x]<=0||(m[x]>=o&&(d[g++]=x),m[x]-o>=n))continue;let C=l[x]-s[x],_=u[x]-a[x];if(!(C*_<Js))for(let v=f[x];v!==-1;v=b[v]){if(y>=h.length){let A=new Int32Array(h.length*2);A.set(h),h=A}h[y++]=v}}return g}zt();Yt();Ie();function Mo(e,t,n){return .299*e+.587*t+.114*n}function am(e,t){let n=Ae(e,t);return[n[0],n[1],n[2]]}function sn(e,t,n,o){let i=e.r,r=i.colorValue[t];if(e.pe==="numeric"&&!isNaN(r)&&e.f>e.c)return am(n,rt(r,e.c,e.f));let s=e.u.get(i.colorLabel[t])??0;return o[s%o.length]??[0,0,0]}function Fo(e,t,n,o,i){let r=sn(e,t,n,o),s=e.r.sizeSign[t]<0?i:1;return[r[0],r[1],r[2],s]}ue();function So(e,t,n,o,i,r,s){let a=Math.round(o*n),l=Math.round(i*n);(t.width!==a||t.height!==l)&&(t.width=a,t.height=l,e.ht=!0);let u=t.getContext("2d");if(u){if(e.ht){e.le?.close(),e.le=null,e.ht=!1;let m=++e.un;r(u),createImageBitmap(t).then(f=>{e.un===m?(e.le?.close(),e.le=f):f.close()})}else e.le&&(u.clearRect(0,0,t.width,t.height),u.drawImage(e.le,0,0));s&&(u.save(),u.scale(n,n),s(u),u.restore())}}lo();He();co();function ea(e,t,n,o,i,r,s,a){if(n.length===0)return;let{In:l,ui:u,li:m}=t;e.font=`11px ${a}`;let f=16,b=8,p=0;for(let x of n){let C=e.measureText(x).width;C>p&&(p=C)}let d=p+b*2,g=n.length*f+b*2-4,h=o+12,y=i-g-8;h+d>r&&(h=o-d-12),h<0&&(h=4),y<0&&(y=i+12),y+g>s&&(y=s-g-4),e.fillStyle=l,e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.roundRect(h,y,d,g,4),e.fill(),e.stroke(),e.fillStyle=u,e.textAlign="left",e.textBaseline="top";for(let x=0;x<n.length;x++)e.fillText(n[x],h+b,y+b+x*f)}var ta=24,lm=8,na=12,oa=2,ia=" \\u203A ";function Do(e,t,n,o,i){e.ke=[];let r=e.T().In;t.fillStyle=r,t.fillRect(0,0,n,ta),t.font=`11px ${o}`,t.textAlign="left",t.textBaseline="middle";let s=lm,a=e.r;for(let l=0;l<e.ae.length;l++){let u=e.ae[l],m=l===e.ae.length-1,f=a.name[u];t.fillStyle=i;let b=t.measureText(f).width;t.fillText(f,s,na),e.ke.push({nodeId:u,x0:s-oa,y0:0,x1:s+b+oa,y1:ta}),s+=b,m||(t.fillText(ia,s,na),s+=t.measureText(ia).width)}}function Bo(e,t,n,o,i,r,s,a){let l=e.W.hoveredTarget===n?e.W.lines??[]:[];l.length!==0&&ea(t,e.T(),l,o,i,r,s,a)}function Io(e,t,n,o,i,r,s,a=null){e.pe==="series"&&e.u.size>1?a?Qt(t,a,e.u,n,i):fo(t,ra(r,s),e.u,n,i):e.pe==="numeric"&&e.c<e.f&&Tt(t,ra(r,s),{min:e.c,max:e.f,label:e.s},o,i,e.getColumnFormatter(e.s,"value"))}function ra(e,t){return new ee(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0})}function an(e,t){if(e.g===-1)return;let n=t.gl,o=t.cssWidth,i=t.cssHeight;if(o<=0||i<=0)return;let r=e.r,s=e.P.length>0&&e.N.facet_mode==="grid",a=e.ae.length>1?28:0,u=(e.pe==="series"?e.u.size>1:e.pe==="numeric"&&e.c<e.f)?90:0,m=new Int32Array(Math.max(r.count,64));if(s)um(e,m,o,i,a,u);else{e.v=null;let d=r.depth[e.g];Ro(r,e.g,0,a,o-u,i,d,m,e.qn),Qs(e,e.g,100,d),sr(e);let g=e.Fe,h=e.Ne;for(let y=0;y<e.ee;y++)g[y]=d,h[y]=e.g}if(!e.o){let d=j(t,"treemap",kn,Nn,["u_resolution"],["a_position","a_color"]);e.o=d.program,e.F=d}let f=e.T(),b=f.H,p=fe(f.Ie,b,Math.max(1,e.u.size));if(e.D){let d=e.D.getContext("2d");d&&d.clearRect(0,0,e.D.width,e.D.height)}e.ht=!0,mm(e,n,b,p,f.Ao),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.o),n.uniform2f(e.F.u_resolution,o,i),n.bindBuffer(n.ARRAY_BUFFER,e.Pt),n.enableVertexAttribArray(e.F.a_position),n.vertexAttribPointer(e.F.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Et),n.enableVertexAttribArray(e.F.a_color),n.vertexAttribPointer(e.F.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.Wo),It(e)}function um(e,t,n,o,i,r){let s=e.r,a=[],l=[];for(let d=s.firstChild[e.Y];d!==-1;d=s.nextSibling[d])s.value[d]<=0||(a.push(d),l.push(s.name[d]));let u=Math.max(1,o-i),m=Math.max(1,n-r),f=Ye(l,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.N.facet_padding});e.v=f,sr(e);let b=e.Fe,p=0;for(let d=0;d<a.length;d++){let g=a[d],h=f.cells[d];if(!h)continue;let y=s.name[g],x=e.nt.get(y)??g,C=s.depth[x],_=h.layout.t;Ro(s,x,_.x,_.y+i,_.x+_.width,_.y+i+_.height,C,t,e.qn);let v=ir(e,x,100,C,p);b.length<v&&sr(e);let A=e.Fe,w=e.Ne;for(let L=p;L<v;L++)A[L]=C,w[L]=x;p=v}e.ee=p}function sr(e){let t=e.X?.length??e.r.count;(!e.Fe||e.Fe.length<t)&&(e.Fe=new Int32Array(t)),(!e.Ne||e.Ne.length<t)&&(e.Ne=new Int32Array(t))}function mm(e,t,n,o,i){let r=e.r,s=e.X,a=e.ee,l=e.Fe,u=e.Ne,m=h=>l?l[h]:r.depth[e.g],f=h=>u?u[h]:e.g,b=0;for(let h=0;h<a;h++){let y=s[h];if(y===f(h))continue;let x=r.x1[y]-r.x0[y],C=r.y1[y]-r.y0[y];x<1||C<1||(r.firstChild[y]===-1?b++:r.depth[y]-m(h)===1&&(b+=2))}let p=new Float32Array(b*6*2),d=new Float32Array(b*6*4),g=0;for(let h=0;h<a;h++){let y=s[h];if(y===f(h))continue;let x=r.x0[y],C=r.y0[y],_=r.x1[y],v=r.y1[y],A=_-x,w=v-C;if(!(A<1||w<1)){if(r.firstChild[y]===-1){let L=Fo(e,y,n,o,i);g=rr(p,d,g,x,C,_-1,v-1,L)}else if(r.depth[y]-m(h)===1){let T=[.25,.25,.25,1];g=rr(p,d,g,x,v-1,_,v,T),g=rr(p,d,g,_-1,C,_,v,T)}}}e.Wo=g,e.Pt||(e.Pt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Pt),t.bufferData(t.ARRAY_BUFFER,p.subarray(0,g*2),t.DYNAMIC_DRAW),e.Et||(e.Et=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Et),t.bufferData(t.ARRAY_BUFFER,d.subarray(0,g*4),t.DYNAMIC_DRAW)}function rr(e,t,n,o,i,r,s,a){let l=n*2,u=n*4;e[l+0]=o,e[l+1]=i,e[l+2]=r,e[l+3]=i,e[l+4]=o,e[l+5]=s,e[l+6]=r,e[l+7]=i,e[l+8]=r,e[l+9]=s,e[l+10]=o,e[l+11]=s;for(let m=0;m<6;m++)t[u+m*4+0]=a[0],t[u+m*4+1]=a[1],t[u+m*4+2]=a[2],t[u+m*4+3]=a[3];return n+6}function It(e){if(!e.d||e.g===-1)return;let t=e.e;if(!t)return;let{dpr:n,cssWidth:o,cssHeight:i}=t,r=e.te!==-1?e.te:e.I;So(e,e.d,n,o,i,s=>fm(e,s,n,o,i),r!==-1?s=>{let a=e.T(),{fontFamily:l}=a,u=e.r;cm(s,u,r);let m=e.X,f=e.ee,b=e.Fe,p=e.Ne;for(let d=0;d<f;d++){let g=m[d],h=p?p[d]:e.g;if(g===h||u.firstChild[g]===-1)continue;let y=u.x1[g]-u.x0[g],x=u.y1[g]-u.y0[g],C=b?b[d]:u.depth[e.g],_=u.depth[g]-C;_===1?Po(s,u,g,y,x,a,!e.qn):_===2&&Po(s,u,g,y,x,a,!0)}if(u.firstChild[r]===-1){let d=a.H,g=fe(a.Ie,d,Math.max(1,e.u.size)),h=u.x1[r]-u.x0[r],y=u.y1[r]-u.y0[r];sa(e,s,r,h,y,l,d,g,!0)}e.te===-1&&e.I!==-1&&dm(e,s,e.I,o,i,l)}:null)}function fm(e,t,n,o,i){let r=e.d;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.T(),{fontFamily:a,xe:l}=s,u=s.H,m=fe(s.Ie,u,Math.max(1,e.u.size)),f=e.r,b=e.X,p=e.ee,d=e.Fe,g=e.Ne;for(let h=0;h<p;h++){let y=b[h],x=g?g[h]:e.g;if(y===x||f.firstChild[y]!==-1)continue;let C=f.x1[y]-f.x0[y],_=f.y1[y]-f.y0[y];sa(e,t,y,C,_,a,u,m)}for(let h=0;h<p;h++){let y=b[h],x=g?g[h]:e.g;if(y===x||f.firstChild[y]===-1)continue;let C=f.x1[y]-f.x0[y],_=f.y1[y]-f.y0[y],v=d?d[h]:f.depth[e.g],A=f.depth[y]-v;A===1?Po(t,f,y,C,_,s,!e.qn):A===2&&Po(t,f,y,C,_,s,!0)}if(e.ae.length>1&&Do(e,t,o,a,l),Io(e,r,m,u,s,o,i),e.v){t.font=`11px ${a}`,t.fillStyle=l,t.textAlign="center",t.textBaseline="top";for(let h of e.v.cells){let y=h.layout.t;t.fillText(h.label,y.x+y.width/2,y.y-14)}}t.restore()}function sa(e,t,n,o,i,r,s,a,l=!1){if(o<30||i<14)return;let b=e.r,p=sn(e,n,s,a),d=Mo(p[0],p[1],p[2]),g=l?d>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":d>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",h=Math.min(11,Math.floor(i/2));if(h<7)return;t.font=`${h}px ${r}`;let y=o-8,x=h*1.3,C=Math.max(1,Math.floor((i-8)/x)),_=Fs(t,b.name[n],y,C);if(_.length===0)return;let v=_.length*x,A=b.y0[n]+(i-v)/2+x/2;t.fillStyle=g,t.textAlign="center",t.textBaseline="middle";let w=b.x0[n]+o/2;for(let L=0;L<_.length;L++)t.fillText(_[L],w,A+L*x)}function Po(e,t,n,o,i,{fontFamily:r,xe:s,backgroundColor:a},l){let u=t.x0[n],m=t.y0[n],f=t.name[n];if(l){if(o<60||i<30)return;let b=12;e.font=`${b}px ${r}`;let p=f,d=o-16;if(e.measureText(p).width>d){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=d){p+="\\u2026";break}}if(p.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,o,i),e.clip();let h=u+o/2,y=m+i/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(p,h,y),e.fillStyle=a,e.fillText(p,h,y),e.restore()}else{if(o<40||i<22)return;let b=11;e.font=`${b}px ${r}`;let p=f,d=o-10;if(e.measureText(p).width>d){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=d){p+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(p,u+5,m+4),e.globalAlpha=1}}function cm(e,t,n){e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.strokeRect(t.x0[n],t.y0[n],t.x1[n]-t.x0[n],t.y1[n]-t.y0[n])}function dm(e,t,n,o,i,r){let s=e.r,a=(s.x0[n]+s.x1[n])/2,l=(s.y0[n]+s.y1[n])/2;Bo(e,t,n,a,l,o,i,r)}async function We(e,t,n){let o=e.r,i=Zs(o,t),r=e.P.length>0&&e.N.facet_mode==="grid",s=r?i.slice(0,e.P.length):[],a=r?i.slice(e.P.length,e.P.length+e.A.length):i.slice(0,e.A.length),l=n==="leaf"?o.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.K,groupByValues:a,splitByValues:s})}async function mt(e,t){let n=e.r,o=[],i=[],r=t;for(;n.parent[r]!==-1;)i.push(n.name[r]),r=n.parent[r];i.reverse(),i.length>0?o.push(i.join(" \\u203A ")):o.push(n.name[t]);let s=e.getColumnFormatter(e.K,"value");if(o.push(`Value: ${s(n.value[t])}`),e.s&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.s,"value");o.push(`${e.s}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.Le){let u=await e.Le.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.s&&!isNaN(n.colorValue[t])||(typeof f=="number"?o.push(`${m}: ${e.getColumnFormatter(m,"value")(f)}`):o.push(`${m}: ${f}`)))}return n.firstChild[t]!==-1&&o.push(`Children: ${n.childCount[t]}`),o}function Eo(e,t,n,o){e.L.dismiss(),e.te=t;let i=e.e?.cssWidth??0,r=e.e?.cssHeight??0;mt(e,t).then(s=>{e.te===t&&s.length!==0&&e.L.pin(s,{px:n.cx,py:n.cy},{cssWidth:i,cssHeight:r})}),e.I=-1,o()}function Wo(e){e.L.dismiss(),e.te=-1}function Go(e,t,n){let o=e.r;if(e.P.length>0&&e.N.facet_mode==="grid"){let i=t;for(;i!==-1&&o.parent[i]!==e.Y;)i=o.parent[i];i!==-1&&e.nt.set(o.name[i],t),e.I=-1,n();return}e.g=t,wo(e,t),e.I=-1,n()}function ar(e,t,n){let o=e.r,i=o.x0,r=o.y0,s=o.x1,a=o.y1,l=o.depth,u=o.firstChild,m=e.X,f=e.ee,b=e.Fe,p=e.Ne,d=-1,g=1/0,h=-1,y=1/0,x=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let C=0;C<f;C++){let _=m[C],v=p?p[C]:e.g;if(_===v||!(t>=i[_]&&t<=s[_]&&n>=r[_]&&n<=a[_]))continue;let A=(s[_]-i[_])*(a[_]-r[_]);if(u[_]!==-1){A<y&&(y=A,h=_);let w=b?b[C]:l[e.g],L=l[_]-w;if(L===1&&n<=r[_]+or&&(x=_),L===2){let T=s[_]-i[_],F=a[_]-r[_];if(T>=60&&F>=30){let W=r[_]+F/2,P=i[_]+T/2;Math.abs(n-W)<10&&Math.abs(t-P)<T*.4&&(x=_)}}}else A<g&&(g=A,d=_)}return x!==-1?{leafId:-1,branchId:x,inHeader:!0}:{leafId:d,branchId:h,inHeader:!1}}function aa(e,t,n){if(e.te!==-1)return;for(let a of e.ke)if(t>=a.x0&&t<=a.x1&&n>=a.y0&&n<=a.y1){e.L.setCursor("pointer"),e.I=-1,It(e);return}let{leafId:o,branchId:i,inHeader:r}=ar(e,t,n),s=r?i:o!==-1?o:i;if(s!==e.I){if(e.I=s,e.L.setCursor(i!==-1?"pointer":"default"),s!==-1){let a=e.W.beginHover(s);mt(e,s).then(l=>{e.W.commitHover(a,l)&&It(e)})}else e.W.clearHover();It(e)}}function la(e,t,n){if(e.te!==-1){ln(e),e.emitUnselect();return}for(let s of e.ke)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.g&&(ko(e,s.nodeId),e.emitUnselect());return}let{leafId:o,branchId:i,inHeader:r}=ar(e,t,n);i!==-1&&r?(ko(e,i),We(e,i,"branch")):o!==-1?(ma(e,o),We(e,o,"leaf")):i!==-1&&(ko(e,i),We(e,i,"branch"))}function ua(e,t,n){let o=e.te!==-1;ln(e),o&&e.emitUnselect();let{leafId:i,branchId:r}=ar(e,t,n),s=e.r,a=r;if(a===-1&&i!==-1){let l=s.parent[i];l!==e.g&&l!==-1&&(a=l)}a!==-1&&a!==e.g&&s.firstChild[a]!==-1&&(ko(e,a),We(e,a,"branch"),i!==-1&&s.firstChild[i]===-1&&(ma(e,i),We(e,i,"leaf")))}function ko(e,t){Go(e,t,()=>{e.e&&an(e,e.e)})}function ma(e,t){let n=e.r,o=(n.x0[t]+n.x1[t])/2,i=(n.y0[t]+n.y1[t])/2;Eo(e,t,{cx:o,cy:i},()=>It(e))}function ln(e){Wo(e)}var No=class extends St{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"Pt",null);c(this,"Et",null);c(this,"Wo",0);c(this,"I",-1);c(this,"te",-1);c(this,"ke",[]);c(this,"le",null);c(this,"ht",!0);c(this,"un",0);c(this,"nt",new Map);c(this,"v",null);c(this,"qn",!1);c(this,"Fe",null);c(this,"Ne",null)}tooltipCallbacks(){return{onHover:(n,o)=>aa(this,n,o),onLeave:()=>{this.I!==-1&&this.te===-1&&(this.I=-1,this.e&&an(this,this.e))},onClickPre:(n,o)=>(la(this,n,o),!0),onDblClick:(n,o)=>ua(this,n,o)}}async uploadAndRender(n,o,i,r){if(this.e=n,i===0){let s=this.B;if(this.K=s[0]||Ao(o)||"",this.s=s[1]||"",!this.s)this.pe="empty";else{let a=this.Pe[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.pe=l?"numeric":"series"}this.I=-1,this.te=-1,this.ke=[],this.nt.clear(),this.v=null,this.Fe=null,this.Ne=null,this.Wo=0,this.W.clearHover(),this.W.invalidatePin(),ln(this),this.le?.close(),this.le=null,this.ht=!0,this.un++,tn(this)}nn(this,o),on(this),this.Y!==-1&&await this.requestRender(n)}Ft(n){this.Y!==-1&&(this.e=n,an(this,n))}destroyInternal(){ln(this),this.le?.close(),this.le=null;let n=this.e?.gl;n&&(this.Pt&&n.deleteBuffer(this.Pt),this.Et&&n.deleteBuffer(this.Et)),this.Pt=null,this.Et=null,this.o=null,this.F=null,this.Y=-1,this.g=-1,this.ae=[],this.It.clear(),this.X=null,this.ee=0,this.ke=[],this.nt.clear(),this.v=null,this.Fe=null,this.Ne=null}};zt();we();ue();var fa=4,un=30;function pm(e,t){let n=0,o=e.depth[t],i=new Int32Array(128);i[0]=t;let r=1;for(;r>0;){r--;let s=i[r],a=e.depth[s]-o;a>n&&(n=a);for(let l=e.firstChild[s];l!==-1;l=e.nextSibling[l]){if(r>=i.length){let u=new Int32Array(i.length*2);u.set(i),i=u}i[r++]=l}}return n}function lr(e,t,n){let o=e.depth[t],i=Math.max(1,pm(e,t)),s=Math.max(0,n-un)/i;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=un,ca(e,t,0,2*Math.PI,un,s,o)}function ca(e,t,n,o,i,r,s){let a=e.value[t];if(a<=0)return;let l=o-n,u=n;for(let m=e.firstChild[t];m!==-1;m=e.nextSibling[m]){let f=e.value[m];if(f<=0)continue;let b=f/a,p=u,d=u+l*b;u=d;let g=i,h=i+r;e.a0[m]=p,e.a1[m]=d,e.r0[m]=g,e.r1[m]=h;let y=d-p,x=(g+h)/2;y*x*r<fa||e.firstChild[m]!==-1&&ca(e,m,p,d,h,r,s)}}function da(e,t){e.ee=ur(e,t,0)}function ur(e,t,n){let o=e.r,i=o.a0,r=o.a1,s=o.r0,a=o.r1,l=o.firstChild,u=o.nextSibling,m=o.value;(!e.X||e.X.length<o.count)&&(e.X=new Int32Array(o.count));let f=e.X,b=n,p=new Int32Array(128);p[0]=t;let d=1;for(;d>0;){d--;let g=p[d];if(m[g]<=0)continue;f[b++]=g;let h=r[g]-i[g],y=(s[g]+a[g])/2,x=h*y,C=a[g]-s[g];if(!(x*C<fa))for(let _=l[g];_!==-1;_=u[_]){if(d>=p.length){let v=new Int32Array(p.length*2);v.set(p),p=v}p[d++]=_}}return b}Yt();var Uo=32,bm=28,gm=90;function Oo(e,t){if(e.l.length===0)return{centerX:e.ot,centerY:e.it};let n=e.r;for(let o of e.l){let i=t;for(;i!==-1;){if(i===o.drillRoot)return{centerX:o.centerX,centerY:o.centerY};i=n.parent[i]}}return{centerX:e.ot,centerY:e.it}}function mn(e,t){if(e.g===-1)return;let n=t.gl,o=t.cssWidth,i=t.cssHeight;if(o<=0||i<=0)return;let r=e.P.length>0&&e.N.facet_mode==="grid",s=e.pe==="series"?e.u.size>1:e.pe==="numeric"&&e.c<e.f,a=!r&&e.ae.length>1?bm:0,l=s?gm:0;if(r)hm(e,o,i,l);else{e.v=null,e.l=[];let d=o-l,g=i-a;e.ot=d/2,e.it=a+g/2,e.Go=Math.max(0,Math.min(d,g)/2-4),lr(e.r,e.g,e.Go),da(e,e.g)}ym(e,t);let u=e.T(),m=u.H,f=fe(u.Ie,m,Math.max(1,e.u.size));if(e.D){let d=e.D.getContext("2d");d&&d.clearRect(0,0,e.D.width,e.D.height)}let b=t.dpr;e.ht=!0,xm(e,n,m,f,u.Ao,b),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),n.useProgram(e.o);let p=e.F;if(n.uniform2f(p.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(p.u_border_px,u.fi*b),e.l.length>0)for(let d of e.l)d.instanceCount!==0&&(n.uniform2f(p.u_center,d.centerX*b,d.centerY*b),pa(e,n,t,d.instanceStart,d.instanceCount));else n.uniform2f(p.u_center,e.ot*b,e.it*b),pa(e,n,t,0,e.ko);qe(e)}function hm(e,t,n,o){let i=e.r,r=[],s=[];for(let f=i.firstChild[e.Y];f!==-1;f=i.nextSibling[f])i.value[f]<=0||(r.push(f),s.push(i.name[f]));let a=Math.max(1,t-o),l=Ye(s,{cssWidth:a,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.N.facet_padding});e.v=l;let u=[],m=0;for(let f=0;f<r.length;f++){let b=r[f],p=l.cells[f];if(!p)continue;let d=i.name[b],g=e.nt.get(d)??b,h=p.layout.t,y=h.x+h.width/2,x=h.y+h.height/2,C=Math.max(0,Math.min(h.width,h.height)/2-4);lr(i,g,C);let _=ur(e,g,m),v=m,A=_-m;u.push({label:d,centerX:y,centerY:x,maxRadius:C,drillRoot:g,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=_}e.ee=m,e.l=u,u.length>0&&(e.ot=u[0].centerX,e.it=u[0].centerY,e.Go=u[0].maxRadius)}function ym(e,t){if(e.o)return;let n=t.gl,o=j(t,"sunburst-arc",Wn,Gn,["u_center","u_resolution","u_border_px"],["a_strip_t","a_side","a_angles","a_radii","a_color"]);e.o=o.program,e.F=o;let i=new Float32Array((Uo+1)*2*2);for(let r=0;r<=Uo;r++){let s=r/Uo,a=r*4;i[a+0]=s,i[a+1]=0,i[a+2]=s,i[a+3]=1}e.jt=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.jt),n.bufferData(n.ARRAY_BUFFER,i,n.STATIC_DRAW),e.Zt=n.createBuffer()}function xm(e,t,n,o,i,r){let s=e.r,a=e.X,l=e.l.length>0,u=l?e.l.reduce((p,d)=>p+d.instanceCount,0):e.ee,m=new Float32Array(u*8),f=0,b=(p,d,g)=>{let h=f;for(let y=p;y<d;y++){let x=a[y];if(x===g)continue;let C=s.a0[x],_=s.a1[x],v=s.r0[x],A=s.r1[x];if(_<=C||A<=v)continue;let w=Fo(e,x,n,o,i),L=f*8;m[L+0]=C,m[L+1]=_,m[L+2]=v*r,m[L+3]=A*r,m[L+4]=w[0],m[L+5]=w[1],m[L+6]=w[2],m[L+7]=w[3],f++}return{rangeStart:h,rangeCount:f-h}};if(l)for(let p of e.l){let d=p.instanceStart,g=d+p.instanceCount,{rangeStart:h,rangeCount:y}=b(d,g,p.drillRoot);p.instanceStart=h,p.instanceCount=y}else b(0,e.ee,e.g);e.ko=f,t.bindBuffer(t.ARRAY_BUFFER,e.Zt),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function pa(e,t,n,o,i){if(i===0)return;let r=e.F;t.bindBuffer(t.ARRAY_BUFFER,e.jt);let s=2*Float32Array.BYTES_PER_ELEMENT;t.enableVertexAttribArray(r.a_strip_t),t.vertexAttribPointer(r.a_strip_t,1,t.FLOAT,!1,s,0),t.enableVertexAttribArray(r.a_side),t.vertexAttribPointer(r.a_side,1,t.FLOAT,!1,s,Float32Array.BYTES_PER_ELEMENT);let a=q(n),{setDivisor:l}=a;l(r.a_strip_t,0),l(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.Zt);let u=8*Float32Array.BYTES_PER_ELEMENT,m=Float32Array.BYTES_PER_ELEMENT,f=o*u;t.enableVertexAttribArray(r.a_angles),t.vertexAttribPointer(r.a_angles,2,t.FLOAT,!1,u,f),l(r.a_angles,1),t.enableVertexAttribArray(r.a_radii),t.vertexAttribPointer(r.a_radii,2,t.FLOAT,!1,u,f+2*m),l(r.a_radii,1),t.enableVertexAttribArray(r.a_color),t.vertexAttribPointer(r.a_color,4,t.FLOAT,!1,u,f+4*m),l(r.a_color,1),a.drawArraysInstanced(t.TRIANGLE_STRIP,0,2*(Uo+1),i),l(r.a_angles,0),l(r.a_radii,0),l(r.a_color,0)}function qe(e){if(!e.d||e.g===-1)return;let t=e.e;if(!t)return;let{dpr:n,cssWidth:o,cssHeight:i}=t;So(e,e.d,n,o,i,r=>Cm(e,r,n,o,i),e.I!==-1?r=>{_m(r,e,e.I),vm(e,r,e.I,o,i,e.T().fontFamily)}:null)}function Cm(e,t,n,o,i){let r=e.d;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.T(),{fontFamily:a,xe:l,In:u}=s,m=s.H,f=fe(s.Ie,m,Math.max(1,e.u.size)),b=e.r,p=e.X,d=e.ee,g=e.l.length>0;if(g)for(let y of e.l){let x=y.nodeStart+y.nodeCount;for(let C=y.nodeStart;C<x;C++){let _=p[C];_!==y.drillRoot&&ba(e,t,_,a,m,f,y.centerX,y.centerY)}}else for(let y=0;y<d;y++){let x=p[y];x!==e.g&&ba(e,t,x,a,m,f,e.ot,e.it)}let h=Math.max(0,un-s.fi*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",g){for(let y of e.l)if(t.beginPath(),t.fillStyle=u,t.arc(y.centerX,y.centerY,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[y.drillRoot],y.centerX,y.centerY),e.v){let x=e.v.cells.find(C=>C.label===y.label);x?.titleRect&&(t.fillStyle=l,t.font=`11px ${a}`,t.textBaseline="middle",t.fillText(y.label,x.titleRect.x+x.titleRect.width/2,x.titleRect.y+x.titleRect.height/2))}}else t.beginPath(),t.arc(e.ot,e.it,h,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(b.name[e.g],e.ot,e.it);!g&&e.ae.length>1&&Do(e,t,o,a,l),Io(e,r,f,m,s,o,i,g?e.v?.legendRect??null:null),t.restore()}function ba(e,t,n,o,i,r,s,a){let l=e.r,u=l.a0[n],m=l.a1[n],f=l.r0[n],b=l.r1[n],p=b-f,d=(f+b)/2,h=(m-u)*d;if(p<16||h<8)return;let y=Math.min(11,Math.floor(h*.7));if(y<7)return;t.font=`${y}px ${o}`;let x=l.name[n],C=p-4,_=x;if(t.measureText(_).width>C){for(;_.length>1;)if(_=_.slice(0,-1),t.measureText(_+"\\u2026").width<=C){_+="\\u2026";break}}if(_.length<2)return;let v=(u+m)/2;t.save(),t.translate(s,a);let A=v,w=v>Math.PI/2&&v<3*Math.PI/2;e.vi==="upright"&&w&&(A+=Math.PI),t.rotate(A);let L=sn(e,n,i,r),T=Mo(L[0],L[1],L[2]);t.fillStyle=T>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)",t.textAlign="center",t.textBaseline="middle";let F=e.vi==="upright"&&w?-d:d;t.fillText(_,F,0),t.restore()}function _m(e,t,n){let o=t.r,i=o.a0[n],r=o.a1[n],s=o.r0[n],a=o.r1[n],{centerX:l,centerY:u}=Oo(t,n);e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.beginPath(),e.arc(l,u,a,i,r),e.arc(l,u,s,r,i,!0),e.closePath(),e.stroke()}function vm(e,t,n,o,i,r){let s=e.r,a=(s.a0[n]+s.a1[n])/2,l=(s.r0[n]+s.r1[n])/2,{centerX:u,centerY:m}=Oo(e,n),f=u+Math.cos(a)*l,b=m+Math.sin(a)*l;Bo(e,t,n,f,b,o,i,r)}function ga(e,t,n){if(e.l.length===0)return{centerX:e.ot,centerY:e.it,drillRoot:e.g};for(let o of e.l){let i=t-o.centerX,r=n-o.centerY;if(!(Math.sqrt(i*i+r*r)>o.maxRadius+4))return{centerX:o.centerX,centerY:o.centerY,drillRoot:o.drillRoot}}return null}function Am(e,t,n){let o=e.r,i=t;for(;i!==-1;){if(i===n)return!0;i=o.parent[i]}return!1}function ha(e,t,n){let o=ga(e,t,n);if(!o)return-1;let i=e.r,r=e.X,s=e.ee;if(!r)return-1;let a=t-o.centerX,l=n-o.centerY,u=Math.sqrt(a*a+l*l),m=Math.atan2(l,a);if(m<0&&(m+=2*Math.PI),u<i.r1[e.Y]+.001&&o.drillRoot!==e.Y)return o.drillRoot;let f=e.l.length>0;for(let b=0;b<s;b++){let p=r[b];if(p===o.drillRoot||f&&!Am(e,p,o.drillRoot))continue;let d=i.a0[p],g=i.a1[p],h=i.r0[p],y=i.r1[p];if(!(u<h||u>y)&&!(m<d||m>g))return p}return-1}function ya(e,t,n){if(e.te!==-1)return;for(let r of e.ke)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.L.setCursor("pointer"),e.I!==-1&&(e.I=-1,qe(e));return}let o=ha(e,t,n),i=e.r;if(e.L.setCursor(o!==-1&&i.firstChild[o]!==-1?"pointer":"default"),o!==e.I){if(e.I=o,o!==-1){let r=e.W.beginHover(o);mt(e,o).then(s=>{e.W.commitHover(r,s)&&qe(e)})}else e.W.clearHover();qe(e)}}function xa(e,t,n){if(e.te!==-1){Vo(e),e.emitUnselect();return}for(let s of e.ke)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.g&&(mr(e,s.nodeId),e.emitUnselect());return}let o=e.r,i=ga(e,t,n);if(i){let s=t-i.centerX,a=n-i.centerY;if(Math.sqrt(s*s+a*a)<o.r1[e.Y]+.001){let u=o.parent[i.drillRoot];if(u!==-1&&u!==e.Y)mr(e,u),e.emitUnselect();else if(e.l.length>0){let m=e.l.find(f=>f.drillRoot===i.drillRoot);m&&(e.nt.delete(m.label),e.emitUnselect()),e.e&&mn(e,e.e)}return}}let r=ha(e,t,n);r!==-1&&(o.firstChild[r]!==-1?(mr(e,r),We(e,r,"branch")):(Lm(e,r),We(e,r,"leaf")))}function mr(e,t){Go(e,t,()=>{e.e&&mn(e,e.e)})}function Lm(e,t){let n=e.r,o=(n.a0[t]+n.a1[t])/2,i=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=Oo(e,t),a=r+Math.cos(o)*i,l=s+Math.sin(o)*i;Eo(e,t,{cx:a,cy:l},()=>qe(e))}function Vo(e){Wo(e)}var Ho=class extends St{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"jt",null);c(this,"Zt",null);c(this,"ko",0);c(this,"vi","upright");c(this,"ot",0);c(this,"it",0);c(this,"Go",0);c(this,"I",-1);c(this,"te",-1);c(this,"ke",[]);c(this,"le",null);c(this,"ht",!0);c(this,"un",0);c(this,"v",null);c(this,"nt",new Map);c(this,"l",[])}tooltipCallbacks(){return{onHover:(n,o)=>ya(this,n,o),onLeave:()=>{this.I!==-1&&this.te===-1&&(this.I=-1,qe(this))},onClickPre:(n,o)=>(xa(this,n,o),!0)}}async uploadAndRender(n,o,i,r){if(this.e=n,i===0){let s=this.B;if(this.K=s[0]||Ao(o)||"",this.s=s[1]||"",!this.s)this.pe="empty";else{let a=this.Pe[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.pe=l?"numeric":"series"}this.I=-1,this.te=-1,this.ke=[],this.nt.clear(),this.v=null,this.l=[],this.ko=0,this.W.clearHover(),this.W.invalidatePin(),Vo(this),this.le?.close(),this.le=null,this.ht=!0,this.un++,tn(this)}nn(this,o),on(this),this.Y!==-1&&await this.requestRender(n)}Ft(n){this.Y!==-1&&(this.e=n,mn(this,n))}destroyInternal(){Vo(this),this.le?.close(),this.le=null;let n=this.e?.gl;n&&(this.jt&&n.deleteBuffer(this.jt),this.Zt&&n.deleteBuffer(this.Zt)),this.jt=null,this.Zt=null,this.o=null,this.F=null,this.Y=-1,this.g=-1,this.ae=[],this.It.clear(),this.X=null,this.ee=0,this.ke=[],this.v=null,this.nt.clear(),this.l=[]}};Vt();var Pt=class extends Le{constructor(){super(...arguments);c(this,"Se",[]);c(this,"ne",0);c(this,"rt",0);c(this,"o",null);c(this,"G",null);c(this,"a",null);c(this,"Re",null);c(this,"Me",null);c(this,"Ge",null);c(this,"Nn",!0)}getZoomConfig(){return{lockAxis:"y"}}};Ht();function Yo(e,t=.5,n=.1){let o=t/Math.max(1,e),i=o*(1-n)/2;return{slotWidth:o,halfWidth:i}}function Ca(e,t,n="bar"){let o=t?.[e]?.chart_type?.toLowerCase?.();return o==="bar"||o==="line"||o==="scatter"||o==="area"?o:n}function _a(e,t,n){let o=n?.[e]?.stack;return typeof o=="boolean"?o:t==="bar"||t==="area"}function fr(e,t){return t?.[e]?.alt_axis===!0}function va(e,t,n){if(t!=="line"&&t!=="area")return"skip";let o=n?.[e]?.interpolate;return o===void 0||t==="area"?"solid":o}var Aa=50,ft=0,zo=1;function Xo(){return{count:0,catIdx:new Int32Array(0),seriesId:new Int32Array(0),axis:new Uint8Array(0),chartType:new Uint8Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),y0:new Float64Array(0),y1:new Float64Array(0)}}function Tm(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),seriesId:new Int32Array(t),axis:new Uint8Array(t),chartType:new Uint8Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),y0:new Float64Array(t),y1:new Float64Array(t)}}function fn(e,t,n,o,i){let r=e.seriesId[t],s=e.catIdx[t];return{catIdx:s,aggIdx:Math.floor(r/n),splitIdx:r%n,seriesId:r,xCenter:e.xCenter[t],halfWidth:e.halfWidth[t],y0:e.y0[t],y1:e.y1[t],value:o[s*i+r],axis:e.axis[t],chartType:e.chartType[t]===ft?"bar":"area"}}function La(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function Ta(e,t){e[t>>3]|=1<<(t&7)}function wa(e){let{columns:t,numRows:n,columnSlots:o,groupBy:i,splitBy:r,groupByTypes:s,columnsConfig:a,defaultChartType:l,autoAltYAxis:u,bandInnerFrac:m,barInnerPad:f,includeZero:b,scratchBars:p,scratchPosStack:d,scratchNegStack:g}=e,h=Dt(i,s),y={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:h,numericCategoryDomain:null,categoryPositions:null,series:[],bars:Xo(),posStack:d??null,negStack:g??null,samples:new Float32Array(0),sampleValid:new Uint8Array(0),leftDomain:{min:0,max:0},rightDomain:null,hasRightAxis:!1,leftValueAxisMode:"numeric",rightValueAxisMode:null,leftValueCategoryDomain:null,rightValueCategoryDomain:null},x=o.filter(R=>!!R);if(x.length===0)return y;let C=[];if(r.length>0){for(let R of Ve(t,[],x))R.colNames.size>0&&C.push(R.prefix);C.length===0&&C.push("")}else C.push("");let _=i.map(R=>s[R]??"string"),{rowPaths:v,numCategories:A,rowOffset:w}=Bt(t,n,i.length,_);if(A===0)return{...y,aggregates:x,splitPrefixes:C,rowPaths:v,rowOffset:w};let L=[],T=x.length,F=C.length;for(let R=0;R<T;R++)for(let D=0;D<F;D++){let I=x[R],G=C[D],Y=G===""?I:`${G}${T>1?` | ${I}`:""}`,V=Ca(I,a,l),Z=_a(I,V,a),ce=va(I,V,a);L.push({seriesId:R*F+D,aggIdx:R,splitIdx:D,aggName:I,splitKey:G,label:Y,color:[.5,.5,.5],axis:0,chartType:V,stack:Z,start:-1,end:-1,interpolateMode:ce})}let W=[];for(let R=0;R<T;R++)W.push(b?{min:0,max:0}:{min:1/0,max:-1/0});let P=A,B=L.length,k=P*T,N=La(d??null,k),O=La(g??null,k);N.fill(0,0,k),O.fill(0,0,k);let U=new Float32Array(P*B),S=new Uint8Array(P*B+7>>3),X=null,H=null,z=1;if(h.mode==="numeric"&&P>0){let R=t.get("__ROW_PATH_0__"),D=ut(R?.values,P,w,i[0]??"",h.numericType==="date"||h.numericType==="datetime");D&&(X=D.categoryPositions,H=D.numericCategoryDomain,z=D.numericCategoryDomain.bandWidth)}let te=Yo(T,m,f),xe=te.slotWidth*z,Ce=te.halfWidth*z,_e=new Float64Array(T),Re=(T-1)/2;for(let R=0;R<T;R++)_e[R]=(R-Re)*xe;let Ne=new Array(T*F),kt=new Array(T*F);for(let R=0;R<T;R++){let D=x[R];for(let I=0;I<F;I++){let G=C[I],Y=G===""?D:`${G}|${D}`,V=t.get(Y),Z=R*F+I;Ne[Z]=V?.values??null,kt[Z]=V?.valid??null}}let dt=new Array(T),Cn=new Array(T),pe=!1;for(let R=0;R<T;R++){let D=x[R],I=C[0],G=I===""?D:`${I}|${D}`;dt[R]=t.get(G)?.type==="string",Cn[R]=fr(D,a)?1:0,dt[R]&&(pe=!0)}let ne=[],K=[],oe=[],Me=[];for(let R=0;R<T;R++){let D=x[R];for(let I=0;I<F;I++){let G=C[I],Y=G===""?D:`${G}|${D}`,V=R*F+I,Z={name:Y,type:dt[R]?"string":"numeric",data:t.get(Y)};Cn[R]===0?(ne.push(Z),oe.push(V)):(K.push(Z),Me.push(V))}}let tt=ne.map(R=>R.name).filter((R,D,I)=>I.indexOf(R)===D).join(", "),Wr=K.map(R=>R.name).filter((R,D,I)=>I.indexOf(R)===D).join(", "),Fe=ne.length>0?nr(ne,n,w,tt):null,Se=K.length>0?nr(K,n,w,Wr):null,ie=new Array(T*F).fill(null);if(Fe)for(let R=0;R<oe.length;R++)ie[oe[R]]=Fe.perColumnSlots[R];if(Se)for(let R=0;R<Me.length;R++)ie[Me[R]]=Se.perColumnSlots[R];let _n=P*T*F,$=Tm(p??null,_n),J=0;for(let R=0;R<P;R++){let D=R+w;for(let I=0;I<T;I++)for(let G=0;G<F;G++){let Y=I*F+G,V=ie[Y];if(V){let re=I*F+G,be=R*B+re;U[be]=V[R],Ta(S,be);continue}let Z=Ne[Y];if(!Z)continue;let ce=kt[Y];if(ce&&!(ce[D>>3]>>(D&7)&1))continue;let Q=Z[D];if(!isFinite(Q))continue;let bt=I*F+G,ot=R*B+bt;U[ot]=Q,Ta(S,ot)}}for(let R=0;R<B;R++){let D=-1,I=-1;for(let G=0;G<P;G++){let Y=G*B+R;S[Y>>3]>>(Y&7)&1&&(D===-1&&(D=G),I=G)}L[R].start=D,L[R].end=I}for(let R=0;R<B;R++){let D=L[R];if(!(D.start<0)&&D.interpolateMode!=="skip"){if(D.chartType==="line"){let I=D.start;for(let G=D.start+1;G<=D.end;G++){let Y=G*B+R;if(S[Y>>3]>>(Y&7)&1){if(G-I>1){let Z=I*B+R,ce=U[Z],Q=U[Y],bt=X?X[I]:I,re=(X?X[G]:G)-bt;for(let be=1;be<G-I;be++){let me=I+be,ge=X?X[me]:me,wl=re===0?0:(ge-bt)/re;U[me*B+R]=ce+(Q-ce)*wl}}I=G}}}else if(D.chartType==="area"){for(let I=0;I<D.start;I++)U[I*B+R]=0;for(let I=D.end+1;I<P;I++)U[I*B+R]=0;D.start=0,D.end=P-1}}}for(let R=0;R<P;R++){let D=X?X[R]:R;for(let I=0;I<T;I++){let G=_e[I],Y=D+G,V=W[I];for(let Z=0;Z<F;Z++){let ce=I*F+Z,Q=L[ce];if(R<Q.start||R>Q.end)continue;let bt=Q.chartType==="line"||Q.chartType==="area"&&Q.interpolateMode!=="skip",ot=R*B+ce;if(!bt&&!(S[ot>>3]>>(ot&7)&1))continue;let re=U[ot];if((Q.chartType==="bar"||Q.chartType==="area")&&Q.stack){if(re===0&&(Q.chartType!=="area"||Q.interpolateMode==="skip"))continue;let be=R*T+I,me,ge;re>=0?(me=N[be],ge=me+re,N[be]=ge):(me=O[be],ge=me+re,O[be]=ge),me<V.min&&(V.min=me),ge<V.min&&(V.min=ge),me>V.max&&(V.max=me),ge>V.max&&(V.max=ge),$.catIdx[J]=R,$.seriesId[J]=ce,$.axis[J]=0,$.chartType[J]=Q.chartType==="bar"?ft:zo,$.xCenter[J]=Y,$.halfWidth[J]=Ce,$.y0[J]=me,$.y1[J]=ge,J++}else if(re<V.min&&(V.min=re),re>V.max&&(V.max=re),b&&(0<V.min&&(V.min=0),0>V.max&&(V.max=0)),Q.chartType==="bar"||Q.chartType==="area"){if(re===0)continue;$.catIdx[J]=R,$.seriesId[J]=ce,$.axis[J]=0,$.chartType[J]=Q.chartType==="bar"?ft:zo,$.xCenter[J]=Y,$.halfWidth[J]=Ce,$.y0[J]=0,$.y1[J]=re,J++}}}}$.count=J;let pt=!1;if(u&&T>=2&&!pe){let R=new Array(T),D=0,I=1/0;for(let G=0;G<T;G++){let Y=W[G],V=Math.max(Math.abs(Y.min),Math.abs(Y.max),1e-12);R[G]=V,V>D&&(D=V),V<I&&(I=V)}if(D/I>Aa){let G=D/Math.sqrt(Aa);for(let Y=0;Y<T;Y++)if(R[Y]<G)for(let Z of L)Z.aggIdx===Y&&(Z.axis=1);for(let Y=0;Y<$.count;Y++)$.axis[Y]=L[$.seriesId[Y]].axis;pt=L.some(Y=>Y.axis===1)}}let Gr=!1;for(let R=0;R<T;R++)if(fr(x[R],a))for(let D of L)D.aggIdx===R&&(D.axis=1,Gr=!0);if(Gr){for(let R=0;R<$.count;R++)$.axis[R]=L[$.seriesId[R]].axis;pt=!0}let De=b?{min:0,max:0}:{min:1/0,max:-1/0},nt=b?{min:0,max:0}:{min:1/0,max:-1/0};for(let R=0;R<$.count;R++){let D=$.axis[R]===0?De:nt,I=$.y0[R],G=$.y1[R];I<D.min&&(D.min=I),G<D.min&&(D.min=G),I>D.max&&(D.max=I),G>D.max&&(D.max=G)}for(let R=0;R<B;R++){let D=L[R];if(D.stack&&(D.chartType==="bar"||D.chartType==="area")||D.start<0)continue;let I=D.chartType==="line"||D.chartType==="area"&&D.interpolateMode!=="skip",G=D.axis===0?De:nt;for(let Y=D.start;Y<=D.end;Y++){let V=Y*B+R;if(!I&&!(S[V>>3]>>(V&7)&1))continue;let Z=U[V];Z<G.min&&(G.min=Z),Z>G.max&&(G.max=Z)}}(!isFinite(De.min)||!isFinite(De.max)||De.min===0&&De.max===0)&&(De.min=0,De.max=1);let Cl=!isFinite(nt.min)||!isFinite(nt.max)||nt.min===0&&nt.max===0,_l=pt?Cl?{min:0,max:1}:nt:null,vl=Fe?"category":"numeric",Al=pt?Se?"category":"numeric":null,Ll=Fe&&Fe.domain.numRows>0?{min:0,max:Math.max(0,Fe.domain.numRows-1)}:De,Tl=Se&&Se.domain.numRows>0&&pt?{min:0,max:Math.max(0,Se.domain.numRows-1)}:_l;return{aggregates:x,splitPrefixes:C,rowPaths:v,numCategories:A,rowOffset:w,axisMode:h,numericCategoryDomain:H,categoryPositions:X,series:L,bars:$,posStack:N,negStack:O,samples:U,sampleValid:S,leftDomain:Ll,rightDomain:Tl,hasRightAxis:pt,leftValueAxisMode:vl,rightValueAxisMode:Al,leftValueCategoryDomain:Fe?.domain??null,rightValueCategoryDomain:Se?.domain??null}}He();jt();yt();we();var Ra=ft;function Ma(e,t,n){if(e.mn===0)return;let o=e.F,i=q(n),{setDivisor:r}=i;t.bindBuffer(t.ARRAY_BUFFER,e.G),t.enableVertexAttribArray(o.a_corner),t.vertexAttribPointer(o.a_corner,2,t.FLOAT,!1,0,0),r(o.a_corner,0),Ze(n,i,o.a_x_center,"bar_x",1)&&Ze(n,i,o.a_half_width,"bar_hw",1)&&Ze(n,i,o.a_y0,"bar_y0",1)&&Ze(n,i,o.a_y1,"bar_y1",1)&&Ze(n,i,o.a_color,"bar_color",3)&&Ze(n,i,o.a_series_id,"bar_sid",1)&&Ze(n,i,o.a_axis,"bar_axis",1)&&i.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,e.mn),r(o.a_x_center,0),r(o.a_half_width,0),r(o.a_y0,0),r(o.a_y1,0),r(o.a_color,0),r(o.a_series_id,0),r(o.a_axis,0)}var $o=10;function jo(e){return e.Ue>=0?fn(e.ue,e.Ue,e.ze.length,e.Xe,e.p.length):e.Oe}function cr(e,t,n){if(!e.a)return;let o=e.a,i=o.t;if(t<i.x||t>i.x+i.width||n<i.y||n>i.y+i.height){Rm(e);return}let r=o.Z,s=o.ie,a=o.J,l=o.re,u,m,f,b;if(e.st){let y=r,x=s,C=Math.min(a,l),_=Math.max(a,l),v=y+(t-i.x)/i.width*(x-y);u=C+(n-i.y)/i.height*(_-C),m=v,f=i.height/(_-C),b=i.width/(x-y)}else u=r+(t-i.x)/i.width*(s-r),m=l-(n-i.y)/i.height*(l-a),f=i.width/(s-r),b=i.height/(l-a);let p=e.fn&&e.oe&&!e.st?e.oe.max-(n-i.y)/i.height*(e.oe.max-e.oe.min):m,d=e.fn&&e.oe&&!e.st?i.height/(e.oe.max-e.oe.min):b,g=-1,h=null;if(h=Fa(e,"scatter",u,m,p,f,b,d),h||(h=Fa(e,"line",u,m,p,f,b,d)),!h){let y=e.ue,x=y.chartType,C=y.seriesId,_=y.xCenter,v=y.halfWidth,A=y.y0,w=y.y1,L=y.axis,T=e.q;for(let F=0;F<y.count;F++){if(x[F]!==ft||T.has(C[F]))continue;let W=_[F],P=v[F];if(u<W-P||u>W+P)continue;let B=L[F]===0?m:p,k=A[F],N=w[F],O=k<N?k:N,U=k<N?N:k;if(B>=O&&B<=U){g=F;break}}}if(g<0&&!h){let y=wm(e,u,m,p);y&&(y.idx>=0?g=y.idx:h=y.bar)}Mm(e,g,h)}function Fa(e,t,n,o,i,r,s,a){let l=e.ne,u=e.p.length;if(l===0||u===0)return null;let m=e.Xe,f=e.Wt,p=$o*$o,d=null,g=e.$e;for(let h of e.p){if(h.chartType!==t||e.q.has(h.seriesId))continue;let y=h.axis===1?i:o,x=h.axis===1?a:s,C=g?0:Math.max(0,Math.floor(n-$o/r)),_=g?l-1:Math.min(l-1,Math.ceil(n+$o/r));for(let v=C;v<=_;v++){let A=v*u+h.seriesId;if(!(f[A>>3]>>(A&7)&1))continue;let w=m[A],L=g?g[v]:v,T=(L-n)*r,F=(w-y)*x,W=T*T+F*F;W<p&&(p=W,d={catIdx:v,aggIdx:h.aggIdx,splitIdx:h.splitIdx,seriesId:h.seriesId,xCenter:L,halfWidth:0,y0:0,y1:w,value:w,axis:h.axis,chartType:"bar"})}}return d}function wm(e,t,n,o){let i=Math.round(t);if(i<0||i>=e.ne||Math.abs(t-i)>.5)return null;let r=e.p.length,s=e.Xe,a=e.Wt,l=e.ue,u=l.chartType,m=l.catIdx,f=l.seriesId,b=l.axis,p=l.y0,d=l.y1;for(let g=0;g<l.count;g++){if(u[g]!==zo||m[g]!==i||e.q.has(f[g]))continue;let h=b[g]===0?n:o,y=p[g],x=d[g],C=y<x?y:x,_=y<x?x:y;if(h>=C&&h<=_)return{idx:g,bar:null}}for(let g of e.p){if(g.chartType!=="area"||g.stack||e.q.has(g.seriesId))continue;let h=i*r+g.seriesId;if(!(a[h>>3]>>(h&7)&1))continue;let y=s[h],x=g.axis===1?o:n,C=Math.min(0,y),_=Math.max(0,y);if(x>=C&&x<=_)return{idx:-1,bar:{catIdx:i,aggIdx:g.aggIdx,splitIdx:g.splitIdx,seriesId:g.seriesId,xCenter:i,halfWidth:.5,y0:0,y1:y,value:y,axis:g.axis,chartType:"area"}}}return null}function Rm(e){(e.Ue!==-1||e.Oe!==null)&&(e.Ue=-1,e.Oe=null,e.e&&Ke(e,e.e))}function Mm(e,t,n){let o=e.Ue===t,i=(e.Oe?.seriesId??-1)===(n?.seriesId??-1)&&(e.Oe?.catIdx??-1)===(n?.catIdx??-1);o&&i||(e.Ue=t,e.Oe=n,e.e&&Ke(e,e.e))}function Sa(e,t,n){if(e.Kn.length===0)return!1;for(let o of e.Kn){let i=o.rect;if(t>=i.x&&t<=i.x+i.width&&n>=i.y&&n<=i.y+i.height)return e.q.has(o.seriesId)?e.q.delete(o.seriesId):e.q.add(o.seriesId),e.yt=null,e.Jn=!1,e.Qn=null,e.e&&(Zo(e,e.e),qo(e,e.e),Ke(e,e.e)),!0}return!1}function dr(e,t){let n=[],o=e.p[t.seriesId],i=Fm(e,t.catIdx);i&&n.push(i);let r=e.getColumnFormatter(o.aggName,"value");return n.push(`${o.aggName}: ${r(t.value)}`),o.splitKey&&n.push(`Split: ${o.splitKey}`),t.y0!==0&&(n.push(`Base: ${r(t.y0)}`),n.push(`Top: ${r(t.y1)}`)),n}function Fm(e,t){if(e.lt==="numeric"&&e.$){let o=e.ue,i=null;for(let s=0;s<o.count;s++)if(o.catIdx[s]===t){i=o.xCenter[s];break}if(i==null)return"";let r=e.A[0];return e.getColumnFormatter(r,"value")(i)}if(e.Se.length===0)return"";let n=[];for(let o of e.Se){let i=o.labels[t];i!=null&&i!==""&&n.push(i)}return n.join(" / ")}function Da(e,t){t<0||t>=e.ue.count||(e.No=t,Ia(e,fn(e.ue,t,e.ze.length,e.Xe,e.p.length)))}function Ba(e,t){e.No=-1,Ia(e,t)}function Ia(e,t){if(e.L.dismiss(),!e.a)return;let n=e.a,i=(e.p[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.st?n.E(i,t.xCenter):n.E(t.xCenter,i):pr(e,t.xCenter,i),s=dr(e,t);s.length!==0&&(e.L.pin(s,r,n),e.Ue=-1,e.Oe=null,e.e&&Ke(e,e.e))}ve();ve();Ct();Lt();Wi();function Pa(e,t,n){if(n)return n;if(!e.isDate)return ae;let o=t.length>1?t[1]-t[0]:0;return i=>he(i,o)}function br(e,t,n,o,i,r,s){let{xe:a,fontFamily:l}=r,{t:u}=t,m=i==="bottom"?u.y+u.height:u.y;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,io(e,u,o,m,i,f=>t.E(f,0).px,Pa(n,o,s)),e.font=`13px ${l}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,u.x+u.width/2,i==="bottom"?t.cssHeight-2:10)}function gr(e,t,n,o,i,r,s){let{xe:a,fontFamily:l}=r,{t:u}=t,m=i==="left"?u.x:u.x+u.width;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,ro(e,u,o,m,i,f=>t.E(0,f).py,Pa(n,o,s)),e.font=`13px ${l}`,e.save(),i==="left"?(e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2)):(e.translate(t.cssWidth-10,u.y+u.height/2),e.rotate(Math.PI/2)),e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,0,0),e.restore()}function Ko(e,t,n,o,i,r){br(e,t,n,o,"bottom",i,r)}function Jo(e,t,n,o,i,r){gr(e,t,n,o,"left",i,r)}function Qo(e,t,n,o,i,r,s,a=!1,l={}){let u=de(e,o,r);if(!u)return;let{t:m}=o;if(u.strokeStyle=i._o,u.lineWidth=1,u.beginPath(),u.moveTo(m.x,m.y),u.lineTo(m.x,m.y+m.height),u.lineTo(m.x+m.width,m.y+m.height),s&&(a?(u.moveTo(m.x,m.y),u.lineTo(m.x+m.width,m.y)):(u.moveTo(m.x+m.width,m.y),u.lineTo(m.x+m.width,m.y+m.height))),u.stroke(),a){if(t.mode==="category"?at(u,o,t.domain,i):Jo(u,o,t.domain,t.ticks,i,l.category),n.mode==="category"?Te(u,o,n.domain,i):br(u,o,n.domain,n.ticks,"bottom",i,l.value),s)if(s.mode==="category")Te(u,o,s.domain,i);else{let f=o.Z,b=o.ie;o.Z=s.domain.min,o.ie=s.domain.max,br(u,o,s.domain,s.ticks,"top",i,l.alt),o.Z=f,o.ie=b}}else if(t.mode==="category"?Te(u,o,t.domain,i):Ko(u,o,t.domain,t.ticks,i,l.category),n.mode==="category"?at(u,o,n.domain,i):gr(u,o,n.domain,n.ticks,"left",i,l.value),s)if(s.mode==="category")at(u,o,s.domain,i);else{let f=o.J,b=o.re;o.J=s.domain.min,o.re=s.domain.max,gr(u,o,s.domain,s.ticks,"right",i,l.alt),o.J=f,o.re=b}}function ei(e,t,n,o,i,r=!1){let s=de(e,t,i);s&&(s.strokeStyle=o.Pn,s.lineWidth=1,r?so(s,t.t,n,a=>t.E(a,0).px):ao(s,t.t,n,a=>t.E(0,a).py))}Lt();var Je=null;function Ea(e){if(Je&&Je.xCenters.length>=e&&Je.colors.length>=e*3)return Je;let t=Math.max(e,Je?.xCenters.length??0);return Je={xCenters:new Float32Array(t),halfWidths:new Float32Array(t),y0s:new Float32Array(t),y1s:new Float32Array(t),seriesIds:new Float32Array(t),axes:new Float32Array(t),colors:new Float32Array(t*3)},Je}function Zo(e,t){let n=e.ue,o=n.count,i=0;if(o>0){let s=Ea(o);(!e.cn||e.cn.length<o)&&(e.cn=new Int32Array(o));let a=e.cn,l=e._e,u=e.p,m=e.q,f=n.chartType,b=n.seriesId,p=n.xCenter,d=n.halfWidth,g=n.y0,h=n.y1,y=n.axis;for(let x=0;x<o;x++){if(f[x]!==Ra)continue;let C=b[x];if(m.has(C))continue;s.xCenters[i]=p[x]-l,s.halfWidths[i]=d[x],s.y0s[i]=g[x],s.y1s[i]=h[x],s.seriesIds[i]=C,s.axes[i]=y[x];let _=u[C].color;s.colors[i*3]=_[0],s.colors[i*3+1]=_[1],s.colors[i*3+2]=_[2],a[i]=x,i++}}if(e.mn=i,i===0){e.Ve=null;return}let r=Je;t.C.ensureCapacity(i),t.C.upload("bar_x",r.xCenters.subarray(0,i),0,1),t.C.upload("bar_hw",r.halfWidths.subarray(0,i),0,1),t.C.upload("bar_y0",r.y0s.subarray(0,i),0,1),t.C.upload("bar_y1",r.y1s.subarray(0,i),0,1),t.C.upload("bar_sid",r.seriesIds.subarray(0,i),0,1),t.C.upload("bar_axis",r.axes.subarray(0,i),0,1),t.C.upload("bar_color",r.colors.subarray(0,i*3),0,3),(!e.Ve||e.Ve.length<i*3)&&(e.Ve=new Float32Array(Math.max(i*3,e.Ve?.length??0))),e.Ve.set(r.colors.subarray(0,i*3))}function Sm(e,t){let n=e.mn;if(n===0)return;let o=e.cn,i=e.p,r=e.ue.seriesId,s=Ea(n);for(let l=0;l<n;l++){let u=i[r[o[l]]].color;s.colors[l*3]=u[0],s.colors[l*3+1]=u[1],s.colors[l*3+2]=u[2]}let a=e.Ve;if(a&&a.length>=n*3){let l=!0;for(let u=0;u<n*3;u++)if(a[u]!==s.colors[u]){l=!1;break}if(l)return}t.C.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!a||a.length<n*3)&&(e.Ve=new Float32Array(n*3)),e.Ve.set(s.colors.subarray(0,n*3))}function Wa(e){e.k.lines.invalidateBuffers(e),e.k.scatter.invalidateBuffers(e),e.k.areas.invalidateBuffers(e)}function qo(e,t){e.k.lines.rebuildBuffers(e,t),e.k.scatter.rebuildBuffers(e,t),e.k.areas.rebuildBuffers(e,t)}function Ke(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0||e.ne===0)return;let s=e.T();hr(e)&&e.mn>0&&Sm(e,t);let a=e.st,l=e.lt==="numeric",u=l?e.$.min:-.5,m=l?e.$.max:e.ne-.5,f=e.Uo.min,b=e.Uo.max;e.b&&(a?e.b.setBaseDomain(f,b,u,m):e.b.setBaseDomain(u,m,f,b));let p=u,d=m,g=f,h=b,y=e.oe?.min??0,x=e.oe?.max??1;if(e.b){let S=e.b.getVisibleDomain();a?(g=S.xMin,h=S.xMax,p=S.yMin,d=S.yMax):(p=S.xMin,d=S.xMax,g=S.yMin,h=S.yMax)}let C=a?!e.b?.isYDefault():!e.b?.isXDefault();if(e.Nn&&e.b&&C){let S=Em(e,p,d);S.hasLeft&&(g=S.leftMin,h=S.leftMax),e.oe&&S.hasRight&&(y=S.rightMin,x=S.rightMax)}e.h.include_zero&&(g>0&&(g=0),h<0&&(h=0),e.oe&&(y>0&&(y=0),x<0&&(x=0)));let _=e.p.length>1,v=e.A.length>0,A={levels:e.Se,numRows:e.ne,levelLabels:e.A.slice()},w=e.eo,L=e.Oo==="category"&&w!==null&&w.numRows>0,T;if(a){let S=l?55:At(A),X=S+(v?16:0),H=_?80:16,z=Math.max(1,i-X-H),te=L?Ee(w,z):void 0;T=new ee(i,r,{hasXLabel:!0,hasYLabel:v,hasLegend:_,leftExtra:S,bottomExtra:te})}else if(l){let S=L?At(w):void 0;T=new ee(i,r,{hasXLabel:v,hasYLabel:!0,hasLegend:_,bottomExtra:24,leftExtra:S})}else{let S=L?At(w):55,X=S+16,H=_?80:16,z=Math.max(1,i-X-H),te=Ee(A,z);T=new ee(i,r,{hasXLabel:v,hasYLabel:!0,hasLegend:_,bottomExtra:te,leftExtra:L?S:void 0})}e.a=T,e.b&&e.b.updateLayout(T);let F=e.h.include_zero,W=a?T.buildProjectionMatrix(g,h,d,p,"x",F,void 0,0,e._e):T.buildProjectionMatrix(p,d,g,h,"y",F,void 0,e._e,0),P;if(e.fn&&e.oe&&!a){let S=T.Z,X=T.ie,H=T.J,z=T.re;P=T.buildProjectionMatrix(p,d,y,x,"y",F,void 0,e._e,0),T.Z=S,T.ie=X,T.J=H,T.re=z}else P=W;let B=se(g,h,6),k=e.fn&&e.oe&&!a?se(y,x,6):null,N=A,O={min:g,max:h,label:e.Ai},U=e.oe&&!a?{min:y,max:x,label:e.Li}:null;e.D&&ei(e.D,T,B,s,t.dpr,a),ze(n,T,t.dpr,()=>{a||e.k.areas.draw(e,n,t,W,P,s.Ao),n.useProgram(e.o);let S=e.F;n.uniformMatrix4fv(S.u_proj_left,!1,W),n.uniformMatrix4fv(S.u_proj_right,!1,P),n.uniform1f(S.u_horizontal,a?1:0);let X=e.p.length>1?jo(e):null;n.uniform1f(S.u_hover_series,X?X.seriesId:-1),Ma(e,n,t),a||(e.k.lines.draw(e,n,t,W,P),e.k.scatter.draw(e,n,t,W,P))}),e.Re=N,e.Me=O,e.Ge=B,e.Vo=U,e.Ho=k,e.Gt=l?se(p,d,6):null,Dm(e)}function Dm(e){if(!e.d||!e.a||!e.Me||!e.Ge)return;let t=e.T(),n;if(e.lt==="numeric"&&e.$&&e.Gt)n={mode:"numeric",domain:{min:e.$.min,max:e.$.max,isDate:e.$.isDate,label:e.$.label},ticks:e.Gt};else if(e.Re)n={mode:"category",domain:e.Re};else return;let o=e.p.find(l=>l.axis===0),i=e.p.find(l=>l.axis===1),r=e.A[0],s=e.Oo==="category"&&e.eo?{mode:"category",domain:e.eo}:{mode:"numeric",domain:e.Me,ticks:e.Ge},a;e.Vo&&e.Ho&&(a=e.Ti==="category"&&e.Yo?{mode:"category",domain:e.Yo}:{mode:"numeric",domain:e.Vo,ticks:e.Ho}),Qo(e.d,n,s,e.a,t,e.e?.dpr??1,a,e.st,{value:e.getColumnFormatter(o?.aggName??null,"tick"),alt:e.getColumnFormatter(i?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),Im(e),jo(e)&&Pm(e)}var ti=new Float64Array(0);function Bm(e,t,n){if(e.Jn)return;let o=e.p;ti.length<o.length&&(ti=new Float64Array(o.length)),t.save(),t.font=`11px ${n}`;for(let i=0;i<o.length;i++)ti[i]=t.measureText(o[i].label).width;t.restore(),e.Jn=!0}function Im(e){if(e.Kn=[],!e.d||!e.a||e.p.length<=1)return;let t=e.d.getContext("2d");if(!t)return;t.save();let n=e.T(),o=n.vo,i=n.fontFamily;Bm(e,t,i);let r=e.a,s=10,a=18,l=r.t.x+r.t.width+12,u=r.margins.top+10;t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let m=e.p,f=ti;for(let b=0;b<m.length;b++){let p=m[b],d=e.q.has(p.seriesId),g=Math.round(p.color[0]*255),h=Math.round(p.color[1]*255),y=Math.round(p.color[2]*255);t.globalAlpha=d?.3:1,t.fillStyle=`rgb(${g},${h},${y})`,t.fillRect(l,u-s/2,s,s),t.fillStyle=o,t.fillText(p.label,l+s+6,u);let x=f[b];d&&(t.strokeStyle=o,t.lineWidth=1,t.beginPath(),t.moveTo(l+s+6,u),t.lineTo(l+s+6+x,u),t.stroke()),t.globalAlpha=1;let C={x:l-2,y:u-a/2,width:s+6+x+4,height:a};e.Kn.push({seriesId:p.seriesId,rect:C}),u+=a}t.restore()}function Pm(e){if(!e.d||!e.a)return;let t=jo(e);if(!t)return;let n=e.a,i=(e.p[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.st?n.E(i,t.xCenter):n.E(t.xCenter,i):pr(e,t.xCenter,i),s=dr(e,t),a=e.T();Be(e.d,r,s,n,a,e.e?.dpr??1)}function pr(e,t,n){let o=e.a,{x:i,y:r,width:s,height:a}=o.t,l=(t-o.Z)/(o.ie-o.Z),u=e.oe,m=(n-u.min)/(u.max-u.min);return{px:i+l*s,py:r+(1-m)*a}}function Em(e,t,n){let o=e.yt;if(o&&o.catMin===t&&o.catMax===n&&o.hidden===e.q)return o;let i=km(e),r=1/0,s=-1/0,a=!1,l=1/0,u=-1/0,m=!1;if(i.n>0){let b=e.$e,p,d;if(b){let v=Wm(b,i.n,t,n);p=v.lo,d=v.hi}else p=Math.max(0,Math.floor(t)),d=Math.min(i.n-1,Math.ceil(n));let g=i.leftMin,h=i.leftMax,y=i.rightMin,x=i.rightMax,C=i.hasLeft,_=i.hasRight;for(let v=p;v<=d;v++)C[v]&&(g[v]<r&&(r=g[v]),h[v]>s&&(s=h[v]),a=!0),_[v]&&(y[v]<l&&(l=y[v]),x[v]>u&&(u=x[v]),m=!0)}let f=o??Gm();return f.catMin=t,f.catMax=n,f.hidden=e.q,f.leftMin=r,f.leftMax=s,f.hasLeft=a,f.rightMin=l,f.rightMax=u,f.hasRight=m,e.yt=f,f}function Wm(e,t,n,o){if(t===0||n>o)return{lo:0,hi:-1};let i=0,r=t;for(;i<r;){let l=i+r>>>1;e[l]<n?i=l+1:r=l}let s=Math.max(0,i-1);for(i=0,r=t;i<r;){let l=i+r>>>1;e[l]<=o?i=l+1:r=l}let a=Math.min(t-1,i);return{lo:s,hi:a}}function Gm(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function km(e){let t=e.ne,n=e.wi,o=n&&n.leftMin.length>=t;if(n&&o&&e.Qn===e.q)return n;!n||!o?(n={leftMin:new Float64Array(t),leftMax:new Float64Array(t),rightMin:new Float64Array(t),rightMax:new Float64Array(t),hasLeft:new Uint8Array(t),hasRight:new Uint8Array(t),n:t},e.wi=n):n.n=t;for(let g=0;g<t;g++)n.leftMin[g]=1/0,n.leftMax[g]=-1/0,n.rightMin[g]=1/0,n.rightMax[g]=-1/0,n.hasLeft[g]=0,n.hasRight[g]=0;let i=e.ue,r=e.q,s=i.catIdx,a=i.seriesId,l=i.y0,u=i.y1,m=i.axis;for(let g=0;g<i.count;g++){if(r.has(a[g]))continue;let h=s[g];if(h<0||h>=t)continue;let y=l[g],x=u[g],C=y<x?y:x,_=y<x?x:y;m[g]===1?(C<n.rightMin[h]&&(n.rightMin[h]=C),_>n.rightMax[h]&&(n.rightMax[h]=_),n.hasRight[h]=1):(C<n.leftMin[h]&&(n.leftMin[h]=C),_>n.leftMax[h]&&(n.leftMax[h]=_),n.hasLeft[h]=1)}let f=[e.dn,e.pn],b=e.Xe,p=e.Wt,d=e.p.length;for(let g of f)for(let h of g){if(r.has(h.seriesId))continue;let y=h.axis===1,x=h.seriesId;for(let C=0;C<t;C++){let _=C*d+x;if(!(p[_>>3]>>(_&7)&1))continue;let v=b[_];y?(v<n.rightMin[C]&&(n.rightMin[C]=v),v>n.rightMax[C]&&(n.rightMax[C]=v),n.hasRight[C]=1):(v<n.leftMin[C]&&(n.leftMin[C]=v),v>n.leftMax[C]&&(n.leftMax[C]=v),n.hasLeft[C]=1)}}return e.Qn=r,n}zt();we();ue();var cn=new Float32Array(0),dn=new Uint8Array(0);function Nm(e){return cn.length>=e||(cn=new Float32Array(Math.max(e,cn.length*2))),cn}function Um(e){return dn.length>=e||(dn=new Uint8Array(Math.max(e,dn.length*2))),dn}function Om(e){return e==="solid"?1:e==="transparent"?.5:0}var ni=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=je(t.gl),o=j(t,"bar-line",Ue,Oe,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_start","a_end","a_corner","a_real_start","a_real_end"]);return this.o={...o,cornerBuffer:n},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.e){this.i=null;return}let o=t.e.gl;for(let i of n.series)o.deleteBuffer(i.gpuBuffer),o.deleteBuffer(i.gpuRealBuffer);this.i=null}rebuildBuffers(t,n){let o=t.dn;if(o.length===0){this.i=null;return}if(t.ne===0){this.i=null;return}this.ensureProgram(n);let r=n.gl,s=t.Xe,a=t.Wt,l=t._e,u=t.$e,m=t.p.length,f=[];for(let b of o){let p=t.p[b.seriesId],d=p.start,g=p.end;if(d<0||g<d)continue;let h=g-d+1;if(h<2)continue;let y=Nm(h*2),x=Um(h),C=0;for(let A=d;A<=g;A++){let w=u?u[A]-l:A,L=A*m+b.seriesId;y[C*2]=w,y[C*2+1]=s[L],x[C]=a[L>>3]>>(L&7)&1,C++}let _=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,_),r.bufferData(r.ARRAY_BUFFER,y.subarray(0,C*2),r.STATIC_DRAW);let v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,x.subarray(0,C),r.STATIC_DRAW),f.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:_,gpuRealBuffer:v,count:h,interpolateMode:p.interpolateMode})}this.i={series:f}}draw(t,n,o,i,r){let s=this.i,a=this.o;if(!s||!a||s.series.length===0)return;let l=o.dpr;n.useProgram(a.program),n.uniform2f(a.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(a.u_line_width,t.h.line_width_px*l);let u=q(o),{setDivisor:m,drawArraysInstanced:f}=u;n.bindBuffer(n.ARRAY_BUFFER,a.cornerBuffer),n.enableVertexAttribArray(a.a_corner),n.vertexAttribPointer(a.a_corner,1,n.FLOAT,!1,0,0),m(a.a_corner,0);let b=2*Float32Array.BYTES_PER_ELEMENT,p=Uint8Array.BYTES_PER_ELEMENT,d=t.q;for(let g of s.series){if(d.has(g.seriesId))continue;n.uniformMatrix4fv(a.u_projection,!1,g.axis===1?r:i);let h=t.p[g.seriesId].color;n.uniform4f(a.u_color,h[0],h[1],h[2],1),n.uniform1f(a.u_interp_alpha,Om(g.interpolateMode)),n.enableVertexAttribArray(a.a_start),m(a.a_start,1),n.enableVertexAttribArray(a.a_end),m(a.a_end,1),n.enableVertexAttribArray(a.a_real_start),m(a.a_real_start,1),n.enableVertexAttribArray(a.a_real_end),m(a.a_real_end,1),n.bindBuffer(n.ARRAY_BUFFER,g.gpuBuffer),n.vertexAttribPointer(a.a_start,2,n.FLOAT,!1,b,0),n.vertexAttribPointer(a.a_end,2,n.FLOAT,!1,b,b),n.bindBuffer(n.ARRAY_BUFFER,g.gpuRealBuffer),n.vertexAttribPointer(a.a_real_start,1,n.UNSIGNED_BYTE,!1,p,0),n.vertexAttribPointer(a.a_real_end,1,n.UNSIGNED_BYTE,!1,p,p),f(n.TRIANGLE_STRIP,0,4,g.count-1)}m(a.a_start,0),m(a.a_end,0),m(a.a_real_start,0),m(a.a_real_end,0)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&n.deleteBuffer(o.cornerBuffer)}this.o=null,this.i=null}};ue();var Ge=new Float32Array(0),ye=new Float32Array(0);function Vm(e){Ge.length<e*2&&(Ge=new Float32Array(Math.max(e*2,Ge.length*2))),ye.length<e*3&&(ye=new Float32Array(Math.max(e*3,ye.length*2)))}var oi=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=j(t,"bar-scatter",Sn,Dn,["u_projection","u_point_size"],["a_position","a_color"]);return this.o={...o,posLeftBuffer:n.createBuffer(),posRightBuffer:n.createBuffer(),colorLeftBuffer:n.createBuffer(),colorRightBuffer:n.createBuffer()},this.o}invalidateBuffers(t){this.i=null}rebuildBuffers(t,n){let o=t.pn;if(o.length===0){this.i=null;return}let i=t.ne,r=t.p.length;if(i===0||r===0){this.i=null;return}let s=this.ensureProgram(n),a=n.gl,l=t.Xe,u=t.Wt,m=t.$e,f=t._e,b=t.q,p=0,d=0;for(let x of o)if(!b.has(x.seriesId))for(let C=0;C<i;C++){let _=C*r+x.seriesId;u[_>>3]>>(_&7)&1&&(x.axis===1?d++:p++)}let g=p+d;if(g===0){this.i=null;return}Vm(g);let h=0,y=p;for(let x of o){if(b.has(x.seriesId))continue;let C=x.color[0],_=x.color[1],v=x.color[2];for(let A=0;A<i;A++){let w=A*r+x.seriesId;if(!(u[w>>3]>>(w&7)&1))continue;let L=m?m[A]-f:A,T=l[w];x.axis===1?(Ge[y*2]=L,Ge[y*2+1]=T,ye[y*3]=C,ye[y*3+1]=_,ye[y*3+2]=v,y++):(Ge[h*2]=L,Ge[h*2+1]=T,ye[h*3]=C,ye[h*3+1]=_,ye[h*3+2]=v,h++)}}p>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ge.subarray(0,p*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorLeftBuffer),a.bufferData(a.ARRAY_BUFFER,ye.subarray(0,p*3),a.STATIC_DRAW)),d>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ge.subarray(p*2,g*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorRightBuffer),a.bufferData(a.ARRAY_BUFFER,ye.subarray(p*3,g*3),a.STATIC_DRAW)),this.i={leftCount:p,rightCount:d}}draw(t,n,o,i,r){let s=this.i,a=this.o;if(!s||!a||s.leftCount===0&&s.rightCount===0)return;let l=o.dpr;n.useProgram(a.program),n.uniform1f(a.u_point_size,t.h.point_size_px*l),Ga(n,a,a.posLeftBuffer,a.colorLeftBuffer,s.leftCount,i),Ga(n,a,a.posRightBuffer,a.colorRightBuffer,s.rightCount,r)}destroy(t){let n=t.e?.gl;if(n){let o=this.o;o&&(n.deleteBuffer(o.posLeftBuffer),n.deleteBuffer(o.posRightBuffer),n.deleteBuffer(o.colorLeftBuffer),n.deleteBuffer(o.colorRightBuffer))}this.o=null,this.i=null}};function Ga(e,t,n,o,i,r){i!==0&&(e.uniformMatrix4fv(t.u_projection,!1,r),e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(t.a_position),e.vertexAttribPointer(t.a_position,2,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(t.a_color),e.vertexAttribPointer(t.a_color,3,e.FLOAT,!1,0,0),e.drawArrays(e.POINTS,0,i))}ue();var pn=new Float32Array(0);function Hm(e){return pn.length>=e||(pn=new Float32Array(Math.max(e,pn.length*2))),pn}var ii=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){return this.o?this.o:(this.o=j(t,"bar-area",Mn,Fn,["u_projection","u_color","u_opacity"],["a_position"]),this.o)}invalidateBuffers(t){let n=this.i;if(!n||!t.e){this.i=null;return}let o=t.e.gl;for(let i of n.series)o.deleteBuffer(i.gpuBuffer);this.i=null}rebuildBuffers(t,n){let o=t.to;if(o.length===0){this.i=null;return}let i=t.ne,r=t.p.length;if(i===0||r===0){this.i=null;return}this.ensureProgram(n);let s=n.gl,a=t.Xe,l=t.Wt,u=t.$e,m=t._e,f=t.zo,b=t.ue,p=[];for(let d of o){let g=t.p[d.seriesId],h=Ym(d,i,r,a,l,f,b.y0,b.y1,u,m,g.start,g.end,g.interpolateMode);if(h.totalVertices===0)continue;let y=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,y),s.bufferData(s.ARRAY_BUFFER,h.scratch.subarray(0,h.totalVertices*2),s.STATIC_DRAW),p.push({seriesId:d.seriesId,axis:d.axis,color:[d.color[0],d.color[1],d.color[2]],gpuBuffer:y,strips:h.descriptors})}this.i={series:p}}draw(t,n,o,i,r,s){let a=this.i,l=this.o;if(!a||!l||a.series.length===0)return;n.useProgram(l.program),n.uniform1f(l.u_opacity,s);let u=t.q;for(let m of a.series){if(u.has(m.seriesId))continue;n.uniformMatrix4fv(l.u_projection,!1,m.axis===1?r:i);let f=t.p[m.seriesId].color;n.uniform3f(l.u_color,f[0],f[1],f[2]),n.bindBuffer(n.ARRAY_BUFFER,m.gpuBuffer),n.enableVertexAttribArray(l.a_position),n.vertexAttribPointer(l.a_position,2,n.FLOAT,!1,0,0);for(let b of m.strips)n.bindBuffer(n.ARRAY_BUFFER,m.gpuBuffer),n.vertexAttribPointer(l.a_position,2,n.FLOAT,!1,0,b.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,b.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.o=null}};function Ym(e,t,n,o,i,r,s,a,l,u,m,f,b){let p=Hm(t*4),d=[],g=e.seriesId*1e9,h=b!=="skip",y=0,x=0;for(let C=0;C<t;C++){let _=0,v=0,A=!1;if(e.stack){let w=r?.get(g+C);w!==void 0&&(_=s[w],v=a[w],A=!0)}else{let w=C*n+e.seriesId;h?C>=m&&C<=f&&(v=o[w],A=!0):i[w>>3]>>(w&7)&1&&(v=o[w],A=!0)}if(A){let w=l?l[C]-u:C;p[y++]=w,p[y++]=_,p[y++]=w,p[y++]=v}else if(y>x){let w=(y-x)/2;w>=4&&d.push({offsetBytes:x*4,vertexCount:w}),x=y}}if(y>x){let C=(y-x)/2;C>=4&&d.push({offsetBytes:x*4,vertexCount:C})}return{descriptors:d,totalVertices:y/2,scratch:p}}we();ue();function ct(e,t){return e&&(t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max)),{min:t.min,max:t.max}}var Qe=class extends Pt{constructor(n="vertical"){super();c(this,"st");c(this,"F",null);c(this,"Xo",[]);c(this,"ze",[]);c(this,"p",[]);c(this,"ue",Xo());c(this,"$o",[]);c(this,"dn",[]);c(this,"pn",[]);c(this,"to",[]);c(this,"Ai","");c(this,"Li","");c(this,"Oo","numeric");c(this,"Ti",null);c(this,"eo",null);c(this,"Yo",null);c(this,"zo",null);c(this,"Ve",null);c(this,"no",null);c(this,"oo",null);c(this,"jo",null);c(this,"Zo",null);c(this,"Uo",{min:0,max:1});c(this,"oe",null);c(this,"fn",!1);c(this,"io",null);c(this,"ro",null);c(this,"ut",null);c(this,"lt","category");c(this,"$",null);c(this,"_e",0);c(this,"Gt",null);c(this,"$e",null);c(this,"q",new Set);c(this,"Ue",-1);c(this,"No",-1);c(this,"Oe",null);c(this,"Xe",new Float32Array(0));c(this,"Wt",new Uint8Array(0));c(this,"k",{lines:new ni,scatter:new oi,areas:new ii});c(this,"Vo",null);c(this,"Ho",null);c(this,"mn",0);c(this,"cn",new Int32Array(0));c(this,"Kn",[]);c(this,"Jn",!1);c(this,"yt",null);c(this,"wi",null);c(this,"Qn",null);this.st=n==="horizontal"}getZoomConfig(){return{lockAxis:this.st?"x":"y"}}tooltipCallbacks(){return{onHover:(n,o)=>cr(this,n,o),onLeave:()=>{(this.Ue!==-1||this.Oe)&&(this.Ue=-1,this.Oe=null,this.e&&Ke(this,this.e))},onClickPre:(n,o)=>Sa(this,n,o),onPin:(n,o)=>{if(cr(this,n,o),this.Ue>=0){let i=this.Ue;Da(this,i);let r=fn(this.ue,i,this.ze.length,this.Xe,this.p.length);this.Ri(r)}else if(this.Oe){let i=this.Oe;Ba(this,i),this.Ri(i)}},onUnpin:()=>{this.emitUnselect()}}}async Ri(n){if(!this.Xo[n.aggIdx])return;let o=this.Se.map(s=>s.labels[n.catIdx]??null),i=this.ze[n.splitIdx]??"",r=this.P.length>0&&i!==""?i.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.rt,columnName:this.Xo[n.aggIdx],groupByValues:o,splitByValues:r})}async uploadAndRender(n,o,i,r){this.e=n;let s=n.gl;if(i!==0)return;if(!this.o){let l=j(n,"bar",vn,An,["u_proj_left","u_proj_right","u_hover_series","u_horizontal"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color","a_series_id","a_axis"]);this.o=l.program,this.F=l,this.G=yo(s)}let a=wa({columns:o,numRows:r,columnSlots:this.B,groupBy:this.A,splitBy:this.P,groupByTypes:this.pt,columnsConfig:this.Lo,defaultChartType:this.Gn,autoAltYAxis:this.h.auto_alt_y_axis,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,includeZero:this.h.include_zero,scratchBars:this.ue,scratchPosStack:this.jo,scratchNegStack:this.Zo});this.h.domain_mode==="expand"?(this.io=ct(this.io,a.leftDomain),a.rightDomain&&(this.ro=ct(this.ro,a.rightDomain)),a.numericCategoryDomain&&(this.ut=ct(this.ut,a.numericCategoryDomain))):(this.io=null,this.ro=null,this.ut=null),this.Xo=a.aggregates,this.ze=a.splitPrefixes,this.Se=a.rowPaths,this.ne=a.numCategories,this.rt=a.rowOffset,this.lt=a.axisMode.mode,this.$=a.numericCategoryDomain,this.$e=a.categoryPositions,this._e=a.numericCategoryDomain?.min??0,this.p=a.series,this.ue=a.bars,this.jo=a.posStack,this.Zo=a.negStack,this.Xe=a.samples,this.$o.length=0,this.dn.length=0,this.pn.length=0,this.to.length=0;for(let l of a.series)switch(l.chartType){case"bar":this.$o.push(l);break;case"line":this.dn.push(l);break;case"scatter":this.pn.push(l);break;case"area":this.to.push(l);break}this.Ai=ka(a.series,0),this.Li=ka(a.series,1),this.zo=zm(this.ue),this.yt=null,this.Jn=!1,this.no=null,this.oo=null,this.Qn=null,this.Ve=null,this.Wt=a.sampleValid,this.Uo=a.leftDomain,this.oe=a.rightDomain,this.fn=a.hasRightAxis,this.Oo=a.leftValueAxisMode,this.Ti=a.rightValueAxisMode,this.eo=a.leftValueCategoryDomain,this.Yo=a.rightValueCategoryDomain,hr(this),Zo(this,n),Wa(this),qo(this,n),await this.requestRender(n)}Ft(n){this.o&&(this.e=n,Ke(this,n))}resetExpandedDomain(){this.io=null,this.ro=null,this.ut=null}destroyInternal(){if(this.e){let n=this.e.gl;this.G&&n.deleteBuffer(this.G),$m(this)}this.o=null,this.F=null,this.G=null,this.ue=Xo(),this.p=[],this.$o=[],this.dn=[],this.pn=[],this.to=[],this.zo=null,this.no=null,this.oo=null,this.Ve=null,this.jo=null,this.Zo=null,this.Se=[],this.ne=0,this.q.clear()}};function zm(e){let t=new Map;for(let n=0;n<e.count;n++)e.chartType[n]===1&&t.set(e.seriesId[n]*1e9+e.catIdx[n],n);return t}function ka(e,t){let n=new Set,o=[];for(let i of e)i.axis===t&&(n.has(i.aggName)||(n.add(i.aggName),o.push(i.aggName)));return o.join(", ")}function hr(e){let t=e.T(),n=t.Ie,o=t.H,i=e.p.length,r=e.oo;if(e.no&&r&&r.Ie===n&&r.H===o&&r.seriesLength===i)return!1;let s=Xm(n,o,i);e.no=s,e.oo={Ie:n,H:o,seriesLength:i};for(let a=0;a<e.p.length;a++)e.p[a].color=s[a];return!0}function Xm(e,t,n){return fe(e,t,n)}function $m(e){e.k.lines.destroy(e),e.k.scatter.destroy(e),e.k.areas.destroy(e)}var ri=class extends Qe{constructor(){super("horizontal")}};Vt();He();Kt();function yr(e){let{columns:t,numRows:n,groupBy:o,splitBy:i,groupByTypes:r}=e,s=Dt(o,r),a={xLevels:[],yColumnNames:[],yLevels:[],numX:0,numY:0,rowOffset:0,cells:[],cells2D:[],colorMin:0,colorMax:1,xAxisMode:s,yAxisMode:{mode:"category"},xPositions:null,yPositions:null,xNumericDomain:null,yNumericDomain:null},l=o.map(T=>r[T]??"string"),{rowPaths:u,numCategories:m,rowOffset:f}=Bt(t,n,o.length,l),b=null,p=null;if(s.mode==="numeric"&&m>0){let T=t.get("__ROW_PATH_0__"),F=ut(T?.values,m,f,o[0]??"",s.numericType==="date"||s.numericType==="datetime");F&&(b=F.categoryPositions,p=F.numericCategoryDomain)}let d=[];for(let T of t.keys())T.startsWith("__")||!t.get(T)?.values||d.push(T);let g=d.length;if(m===0||g===0)return{...a,xLevels:u,rowOffset:f};let h=qm(d),y=jm(i,r),x={mode:"category"},C=null,_=null;if(y.mode==="numeric"){let T=Zm(d,y.numericType);if(T){let F=ut(T,g,0,i[0]??"",y.numericType==="date"||y.numericType==="datetime");F&&(x=y,C=F.categoryPositions,_=F.numericCategoryDomain)}}let v=[],A=new Array(m*g).fill(null),w=1/0,L=-1/0;for(let T=0;T<g;T++){let F=t.get(d[T]),W=F.values,P=F.valid;for(let B=0;B<m;B++){let k=B+f;if(P&&!(P[k>>3]>>(k&7)&1))continue;let N=W[k];if(!isFinite(N))continue;let O={xIdx:B,yIdx:T,value:N};v.push(O),A[T*m+B]=O,N<w&&(w=N),N>L&&(L=N)}}return!isFinite(w)||!isFinite(L)?(w=0,L=1):w===L&&(L=w+1),{xLevels:u,yColumnNames:d,yLevels:h,numX:m,numY:g,rowOffset:f,cells:v,cells2D:A,colorMin:w,colorMax:L,xAxisMode:s,yAxisMode:x,xPositions:b,yPositions:C,xNumericDomain:p,yNumericDomain:_}}function jm(e,t){if(e.length!==1)return{mode:"category"};let n=t[e[0]];return n==="date"||n==="datetime"||n==="integer"||n==="float"?{mode:"numeric",numericType:n}:{mode:"category"}}function Zm(e,t){let n=new Float64Array(e.length);for(let o=0;o<e.length;o++){let i=e[o],r=i.indexOf("|"),s=r===-1?i:i.slice(0,r),a;if(t==="date"||t==="datetime"?(a=Date.parse(s),isFinite(a)||(a=Date.parse(s.replace(" ","T")))):a=Number(s),!isFinite(a))return null;n[o]=a}return n}function Na(e,t){return t.map(n=>{let o=new Map;for(let[i,r]of e){if(i.startsWith("__ROW_PATH_")||i==="__GROUPING_ID__"){o.set(i,r);continue}let s=i.lastIndexOf("|");(s===-1?i:i.slice(s+1))===n&&o.set(i,r)}return{label:n,columns:o}})}function qm(e){if(e.length===0)return[];let t=0,n=e.map(i=>i.split("|"));for(let i of n)i.length>t&&(t=i.length);if(t===0)return[];let o=[];for(let i=0;i<t;i++){let r=[],s=new Map,a=new Int32Array(e.length),l=new Array(e.length),u=0;for(let b=0;b<e.length;b++){let p=n[b][i]??"",d=s.get(p);d===void 0&&(d=r.length,r.push(p),s.set(p,d)),a[b]=d,l[b]=p,p.length>u&&(u=p.length)}let f=i===t-1?[]:uo(a,r,0,e.length);o.push({labels:l,runs:f,maxLabelChars:u})}return o}He();Ei();jt();we();ue();Ct();Yt();Lt();Kt();lo();function Cr(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var Km=80,Jm=20,xr=5,_r=11;function Et(e,t){return e.E(0,t).py}function Ua(e,t){let n=Cr(e.levels,t),o=n.length,i=[];for(let r=0;r<o;r++){let s=n[r].maxLabelChars;if(r===o-1){let a=Math.max(Km,s*6.5+16);i.push({size:a})}else{let a=Math.max(Jm,s*6.5+16);i.push({size:a})}}return i}function Oa(e,t){let n=Cr(e.levels,t);if(e.numRows===0||n.length===0)return 55;let o=Ua(e,t),i=0;for(let r of o)i+=r.size;return i}function Qm(e,t){return e.labels[t]??""}function vr(e,t,n,o,i){let r=Cr(n.levels,i);if(n.numRows===0||r.length===0)return;let{Mt:s,xe:a,fontFamily:l}=o,{t:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${_r}px ${l}`;let m=Ua(n,i),f=Math.max(0,Math.ceil(t.J)),b=Math.min(n.numRows-1,Math.floor(t.re));if(b<f)return;let p=r.length,d=u.x;for(let h=p-1;h>=0;h--){let y=r[h],x=m[h],C=d,_=d-x.size;d=_,h===p-1?ef(e,t,y,f,b,C,_,l,s):tf(e,t,y,f,b,_,C,l,s)}let g=n.levelLabels.filter(h=>!!h).join(" / ");g&&(e.fillStyle=a,e.font=`13px ${l}`,e.save(),e.translate(14,u.y+u.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="top",e.fillText(g,0,0),e.restore())}function ef(e,t,n,o,i,r,s,a,l){let u=t.t;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let f=o;f<=i;f++){let b=Et(t,f);b<u.y-1||b>u.y+u.height+1||(e.moveTo(r,b),e.lineTo(r-xr,b))}e.stroke(),e.font=`${_r}px ${a}`,e.textAlign="right",e.textBaseline="middle";let m=r-xr-4-s-4;for(let f=o;f<=i;f++){let b=Et(t,f);if(b<u.y-1||b>u.y+u.height+1)continue;let p=Qm(n,f);if(!p)continue;let d=st(e,p,m);d&&e.fillText(d,r-xr-4,b)}}function tf(e,t,n,o,i,r,s,a,l){let u=t.t,m=qt(n.runs,o,i);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l;let f=s-3;e.beginPath();for(let b of m){let p=Et(t,b.endIdx+.5),d=Et(t,b.startIdx-.5),g=Math.min(p,d),h=Math.max(p,d),y=Math.max(u.y,g),x=Math.min(u.y+u.height,h);x<=y||(e.moveTo(f,y),e.lineTo(f,x),e.moveTo(f,y),e.lineTo(f+3,y),e.moveTo(f,x),e.lineTo(f+3,x))}e.stroke(),e.font=`${_r}px ${a}`;for(let b of m){let p=Et(t,b.endIdx+.5),d=Et(t,b.startIdx-.5),g=Math.min(p,d),h=Math.max(p,d),y=Math.max(u.y,g),x=Math.min(u.y+u.height,h);if(x<=y)continue;let C=(y+x)/2,_=r+(s-r-3)/2,v=b.label;if(!v)continue;let A=x-y-4,w=st(e,v,Math.max(0,A));w&&(e.save(),e.translate(_,C),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(w,0,0),e.restore())}}ve();co();Ie();xt();yt();function Lr(e,t,n){if(e.Mi=t,e.Fi=n,e.l.length>0){for(let i=0;i<e.l.length;i++){let r=e.l[i],s=r.layout.t;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let a=Ha(r.layout,r.pipeline.numX,r.pipeline.numY,r.pipeline.cells2D,r.pipeline.xPositions,r.pipeline.yPositions,r.pipeline.xNumericDomain?.bandWidth??1,r.pipeline.yNumericDomain?.bandWidth??1,t,n);Ar(e,a,i);return}Ar(e,null,-1);return}if(!e.a)return;let o=Ha(e.a,e.xt,e.Ct,e.so,e.bn,e.gn,e.mt?.bandWidth??1,e.ft?.bandWidth??1,t,n);Ar(e,o,-1)}function Va(e,t,n){if(e.length===0)return-1;let o=0,i=e.length-1;for(;o<i;){let s=o+i>>1;e[s]<t?o=s+1:i=s}let r=o;return r>0&&Math.abs(e[r-1]-t)<Math.abs(e[r]-t)&&(r-=1),Math.abs(e[r]-t)>n*.5?-1:r}function Ha(e,t,n,o,i,r,s,a,l,u){let m=e.t;if(l<m.x||l>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.Z,b=e.ie,p=e.J,d=e.re,g=f+(l-m.x)/m.width*(b-f),h=d-(u-m.y)/m.height*(d-p),y=i?Va(i,g,s):Math.round(g),x=r?Va(r,h,a):Math.round(h);return y<0||y>=t||x<0||x>=n?null:o[x*t+y]??null}function Ar(e,t,n){let o=e.De;(o?.xIdx??-1)===(t?.xIdx??-1)&&(o?.yIdx??-1)===(t?.yIdx??-1)&&e.hn===n||(e.De=t,e.hn=n,e.e&&e.qo&&e.qo())}function Ya(e,t){let n=[];for(let o of e){let i=o.labels[t];i!=null&&i!==""&&n.push(i)}return n.join(" / ")}function Tr(e){if(!e.d||!e.De)return;let t,n,o,i=null;if(e.hn>=0){let b=e.l[e.hn];if(!b)return;t=b.layout,n=b.pipeline.xLevels,o=b.pipeline.yLevels,i=b.label}else{if(!e.a)return;t=e.a,n=e.kt,o=e.Nt}let r=e.De,s={px:e.Mi,py:e.Fi},a=[];i&&a.push(i);let l=Ya(n,r.xIdx),u=Ya(o,r.yIdx);l&&a.push(l),u&&a.push(u);let m=e.getColumnFormatter(e.B[0],"value");a.push(`Value: ${m(r.value)}`);let f=e.T();Be(e.d,s,a,t,f,e.e?.dpr??1)}var wr={skipLeafLevel:!0};function za(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0)return;if(e.l.length>0){nf(e,t,i,r);return}if(e.xt===0||e.Ct===0)return;let s=e.T(),a={levels:e.kt,numRows:e.xt,levelLabels:e.A.slice()},l={levels:e.Nt,numRows:e.Ct,levelLabels:[]},u=e.yn.mode==="numeric",m=e.xn.mode==="numeric",f=m?55:Oa(l,wr),b=u?24:Ee(a,Math.max(1,i-f-110)),p=new ee(i,r,{hasXLabel:e.A.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:b,leftExtra:f});e.a=p,e.b&&e.b.updateLayout(p);let d=u?e.mt.min:-.5,g=u?e.mt.max:e.xt-.5,h=m?e.ft.min:-.5,y=m?e.ft.max:e.Ct-.5;e.b&&e.b.setBaseDomain(d,g,h,y);let x=e.b?e.b.getVisibleDomain():{xMin:d,xMax:g,yMin:h,yMax:y},C=p.buildProjectionMatrix(x.xMin,x.xMax,x.yMin,x.yMax,void 0,void 0,0,e.R,e.M),_=p.t,v=_.width/(x.xMax-x.xMin),A=_.height/(x.yMax-x.yMin),w=s.mi*.5,L=u?e.mt.bandWidth:1,T=m?e.ft.bandWidth:1,F=Math.min(L*.5,v>0?w/v:0),W=Math.min(T*.5,A>0?w/A:0);if(e.D){let P=de(e.D,p,t.dpr)}Xa(e,t),$a(e,t),e.Q=Zt(t,e.Q,s.H),ze(n,p,t.dpr,()=>{n.useProgram(e.o);let P=e.F;n.uniformMatrix4fv(P.u_projection,!1,C),n.uniform2f(P.u_cell_inset,F,W),n.uniform2f(P.u_cell_size,L,T),Pe(t,e.Q.texture,P.u_gradient_lut,0),ja(e,n,t,0,e.Si)}),si(e)}function Xa(e,t){if(e.o)return;let n=t.gl,o=j(t,"heatmap",Pn,En,["u_projection","u_cell_inset","u_cell_size","u_gradient_lut"],["a_corner","a_cell","a_color_t"]);e.o=o.program,e.F=o;let i=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),e.G=i}function $a(e,t){let n=e.Ze.length;if(e.Si=n,n===0)return;let o=new Float32Array(n*2),i=new Float32Array(n);if(e.l.length>0){let r=0;for(let s of e.l){let a=s.pipeline.xPositions,l=s.pipeline.yPositions,u=s.xOrigin,m=s.yOrigin;for(let f of s.pipeline.cells)o[r*2]=a?a[f.xIdx]-u:f.xIdx,o[r*2+1]=l?l[f.yIdx]-m:f.yIdx,i[r]=rt(f.value,e.c,e.f),r++}}else{let r=e.bn,s=e.gn,a=e.R,l=e.M;for(let u=0;u<n;u++){let m=e.Ze[u];o[u*2]=r?r[m.xIdx]-a:m.xIdx,o[u*2+1]=s?s[m.yIdx]-l:m.yIdx,i[u]=rt(m.value,e.c,e.f)}}t.C.ensureCapacity(n),t.C.upload("heatmap_cell",o,0,2),t.C.upload("heatmap_t",i,0,1)}function ja(e,t,n,o,i){if(i===0)return;let r=e.F,s=q(n),{setDivisor:a}=s,l=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.G),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),a(r.a_corner,0);let u=n.C.peek("heatmap_cell"),m=n.C.peek("heatmap_t");!u||!m||(t.bindBuffer(t.ARRAY_BUFFER,u.buffer),t.enableVertexAttribArray(r.a_cell),t.vertexAttribPointer(r.a_cell,2,t.FLOAT,!1,0,o*2*l),a(r.a_cell,1),t.bindBuffer(t.ARRAY_BUFFER,m.buffer),t.enableVertexAttribArray(r.a_color_t),t.vertexAttribPointer(r.a_color_t,1,t.FLOAT,!1,0,o*l),a(r.a_color_t,1),s.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,i),a(r.a_cell,0),a(r.a_color_t,0))}function si(e){if(!e.d)return;if(e.l.length>0){of(e);return}if(!e.a)return;let t=e.a,n=e.T(),o=e.e?.dpr??1,i=de(e.d,t,o);if(!i)return;i.strokeStyle=n.Pn,i.lineWidth=1,i.beginPath(),i.moveTo(t.t.x,t.t.y),i.lineTo(t.t.x,t.t.y+t.t.height),i.lineTo(t.t.x+t.t.width,t.t.y+t.t.height),i.stroke();let r={levels:e.kt,numRows:e.xt,levelLabels:e.A.slice()},s={levels:e.Nt,numRows:e.Ct,levelLabels:[]},a=e.A[0],l=e.A[1]??e.P[0];if(e.yn.mode==="numeric"&&e.mt){let u=se(t.Z,t.ie,6);Ko(i,t,e.mt,u,n,e.getColumnFormatter(a,"tick"))}else Te(i,t,r,n);if(e.xn.mode==="numeric"&&e.ft){let u=se(t.J,t.re,6);Jo(i,t,e.ft,u,n,e.getColumnFormatter(l,"tick"))}else vr(i,t,s,n,wr);Tt(e.d,t,{min:e.c,max:e.f,label:e.Ko},n.H,n,e.getColumnFormatter(e.B[0],"value")),e.De&&Tr(e)}function nf(e,t,n,o){let i=t.gl,r=e.T(),{effectiveSharedX:s,effectiveSharedY:a}=e.computeEffectiveFacetFlags(),l=Ye(e.l.map(m=>m.label),{cssWidth:n,cssHeight:o,xAxis:s?"outer":"cell",yAxis:a?"outer":"cell",hasLegend:!0,hasXLabel:e.A.length>0,hasYLabel:!1,gap:8});e.v=l;for(let m=0;m<e.l.length;m++){let f=l.cells[m];f&&(e.l[m].layout=f.layout)}e.syncFacetZoomLayouts(l.cells),Xa(e,t),$a(e,t),e.Q=Zt(t,e.Q,r.H),i.useProgram(e.o);let u=e.F;Pe(t,e.Q.texture,u.u_gradient_lut,0),Xt(i);for(let m=0;m<e.l.length;m++){let f=e.l[m];if(f.instanceCount===0)continue;let{numX:b,numY:p}=f.pipeline;if(b===0||p===0)continue;let d=f.layout,g=f.pipeline.xAxisMode.mode==="numeric",h=f.pipeline.yAxisMode.mode==="numeric",y=g?f.pipeline.xNumericDomain.min:-.5,x=g?f.pipeline.xNumericDomain.max:b-.5,C=h?f.pipeline.yNumericDomain.min:-.5,_=h?f.pipeline.yNumericDomain.max:p-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(y,x,C,_);let A=v?v.getVisibleDomain():{xMin:y,xMax:x,yMin:C,yMax:_},w=d.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),L=d.t,T=L.width/(A.xMax-A.xMin),F=L.height/(A.yMax-A.yMin),W=r.mi*.5,P=g?f.pipeline.xNumericDomain.bandWidth:1,B=h?f.pipeline.yNumericDomain.bandWidth:1,k=Math.min(P*.5,T>0?W/T:0),N=Math.min(B*.5,F>0?W/F:0);$t(i,d,t.dpr,()=>{i.uniformMatrix4fv(u.u_projection,!1,w),i.uniform2f(u.u_cell_inset,k,N),i.uniform2f(u.u_cell_size,P,B),ja(e,i,t,f.instanceStart,f.instanceCount)})}si(e)}function of(e){if(!e.d||!e.v)return;let t=e.T(),n=e.e?.dpr??1,o=de(e.d,e.l[0].layout,n);if(!o)return;let i=e.En,r=e.Wn,s=e.v;for(let a=0;a<e.l.length;a++){let l=e.l[a],u=s.cells[a],m=l.layout,f=m.t;o.strokeStyle=t.Pn,o.lineWidth=1,o.beginPath(),o.moveTo(f.x,f.y),o.lineTo(f.x,f.y+f.height),o.lineTo(f.x+f.width,f.y+f.height),o.stroke();let b={levels:l.pipeline.xLevels,numRows:l.pipeline.numX,levelLabels:e.A.slice()},p={levels:l.pipeline.yLevels,numRows:l.pipeline.numY,levelLabels:[]},d=e.A[0],g=e.A[1]??e.P[0];if(!i||u.isBottomEdge)if(l.pipeline.xAxisMode.mode==="numeric"&&l.pipeline.xNumericDomain){let h=se(m.Z,m.ie,6);Ko(o,m,l.pipeline.xNumericDomain,h,t,e.getColumnFormatter(d,"tick"))}else Te(o,m,b,t);if(!r||u.isLeftEdge)if(l.pipeline.yAxisMode.mode==="numeric"&&l.pipeline.yNumericDomain){let h=se(m.J,m.re,6);Jo(o,m,l.pipeline.yNumericDomain,h,t,e.getColumnFormatter(g,"tick"))}else vr(o,m,p,t,wr)}for(let a=0;a<s.cells.length;a++){let l=s.cells[a],u=e.l[a];!u||!l.titleRect||oo(e.d,u.label,l.titleRect,t,n)}s.legendRect&&Jt(e.d,{x:s.legendRect.x,y:s.legendRect.y+20,width:s.legendRect.width,height:Math.max(1,s.legendRect.height-20)},{min:e.c,max:e.f,label:""},t.H,t,e.getColumnFormatter(e.B[0],"value")),e.De&&Tr(e)}var ai=class extends Le{constructor(){super(...arguments);c(this,"o",null);c(this,"F",null);c(this,"G",null);c(this,"Q",null);c(this,"kt",[]);c(this,"Nt",[]);c(this,"Jo",[]);c(this,"xt",0);c(this,"Ct",0);c(this,"rt",0);c(this,"yn",{mode:"category"});c(this,"xn",{mode:"category"});c(this,"bn",null);c(this,"gn",null);c(this,"mt",null);c(this,"ft",null);c(this,"R",0);c(this,"M",0);c(this,"Ze",[]);c(this,"so",[]);c(this,"Si",0);c(this,"c",0);c(this,"f",1);c(this,"Ko","");c(this,"De",null);c(this,"a",null);c(this,"Mi",0);c(this,"Fi",0);c(this,"l",[]);c(this,"v",null);c(this,"hn",-1);c(this,"qo",()=>si(this))}tooltipCallbacks(){return{onHover:(n,o)=>Lr(this,n,o),onLeave:()=>{this.De&&(this.De=null,this.qo())},onPin:(n,o)=>{Lr(this,n,o),this.De&&this.Vi(this.De.xIdx,this.De.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async Vi(n,o){let i=this.kt.map(a=>a.labels[n]??null),r=this.Nt.slice(0,this.P.length).map(a=>a.labels[o]??null),s=this.B[0]??"";await this.emitClickAndSelect({rowIdx:n+this.rt,columnName:s,groupByValues:i,splitByValues:r})}async uploadAndRender(n,o,i,r){if(this.e=n,i!==0)return;let s=this.B.filter(a=>!!a);if(s.length>1){let a=Na(o,s),l=[],u=[],m=1/0,f=-1/0;for(let b of a){let p=yr({columns:b.columns,numRows:r,groupBy:this.A,splitBy:this.P,groupByTypes:this.pt}),d=u.length;for(let g of p.cells)u.push({xIdx:g.xIdx,yIdx:g.yIdx,value:g.value});l.push({label:b.label,pipeline:p,layout:new ee(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:d,instanceCount:p.cells.length,xOrigin:p.xNumericDomain?.min??0,yOrigin:p.yNumericDomain?.min??0}),isFinite(p.colorMin)&&p.colorMin<m&&(m=p.colorMin),isFinite(p.colorMax)&&p.colorMax>f&&(f=p.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.kt=[],this.Nt=[],this.Jo=[],this.xt=0,this.Ct=0,this.rt=0,this.so=[],this.a=null,this.yn={mode:"category"},this.xn={mode:"category"},this.bn=null,this.gn=null,this.mt=null,this.ft=null,this.R=0,this.M=0,this.l=l,this.Ze=u,this.c=m,this.f=f,this.Ko=s.join(", ")}else{let a=yr({columns:o,numRows:r,groupBy:this.A,splitBy:this.P,groupByTypes:this.pt});this.l=[],this.v=null,this.kt=a.xLevels,this.Nt=a.yLevels,this.Jo=a.yColumnNames,this.xt=a.numX,this.Ct=a.numY,this.rt=a.rowOffset,this.Ze=a.cells,this.so=a.cells2D,this.c=a.colorMin,this.f=a.colorMax,this.Ko=s[0]??"Color",this.yn=a.xAxisMode,this.xn=a.yAxisMode,this.bn=a.xPositions,this.gn=a.yPositions,this.mt=a.xNumericDomain,this.ft=a.yNumericDomain,this.R=a.xNumericDomain?.min??0,this.M=a.yNumericDomain?.min??0}await this.requestRender(n)}Ft(n){this.e=n;let o=this.xt>0&&this.Ct>0,i=this.l.length>0;!o&&!i||za(this,n)}destroyInternal(){this.G&&this.e&&this.e.gl.deleteBuffer(this.G),this.o=null,this.F=null,this.G=null,this.kt=[],this.Nt=[],this.Jo=[],this.Ze=[],this.so=[],this.De=null,this.l=[],this.v=null,this.hn=-1,this.yn={mode:"category"},this.xn={mode:"category"},this.bn=null,this.gn=null,this.mt=null,this.ft=null}};Ht();function bn(){return{count:0,catIdx:new Int32Array(0),splitIdx:new Int32Array(0),seriesId:new Int32Array(0),xCenter:new Float64Array(0),halfWidth:new Float64Array(0),open:new Float64Array(0),close:new Float64Array(0),high:new Float64Array(0),low:new Float64Array(0),isUp:new Uint8Array(0)}}function rf(e,t){return e&&e.catIdx.length>=t?(e.count=0,e):{count:0,catIdx:new Int32Array(t),splitIdx:new Int32Array(t),seriesId:new Int32Array(t),xCenter:new Float64Array(t),halfWidth:new Float64Array(t),open:new Float64Array(t),close:new Float64Array(t),high:new Float64Array(t),low:new Float64Array(t),isUp:new Uint8Array(t)}}var Za={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function qa(e){let{columns:t,numRows:n,columnSlots:o,groupBy:i,splitBy:r,groupByTypes:s,bandInnerFrac:a,barInnerPad:l,scratchCandles:u}=e,m=Dt(i,s),f=o[0]||"";if(!f)return{...Za,candles:bn()};let b=o[1]||"",p=o[2]||"",d=o[3]||"",g=[];if(r.length>0){let H=[f];b&&H.push(b),p&&H.push(p),d&&H.push(d);for(let z of Ve(t,[f],H))z.colNames.has(f)&&g.push(z.prefix);g.length===0&&g.push("")}else g.push("");let h=i.map(H=>s[H]??"string"),{rowPaths:y,numCategories:x,rowOffset:C}=Bt(t,n,i.length,h);if(x===0)return{...Za,axisMode:m,splitPrefixes:g,rowPaths:y,rowOffset:C,candles:bn()};let _=g.length,v=[];for(let H=0;H<_;H++){let z=g[H];v.push({seriesId:H,splitIdx:H,splitKey:z,label:z===""?f:z})}let A=null,w=null,L=1;if(m.mode==="numeric"&&x>0){let H=t.get("__ROW_PATH_0__"),z=ut(H?.values,x,C,i[0]??"",m.numericType==="date"||m.numericType==="datetime");z&&(A=z.categoryPositions,w=z.numericCategoryDomain,L=z.numericCategoryDomain.bandWidth)}let T=Yo(_,a,l),F=T.slotWidth*L,W=T.halfWidth*L,P=(_-1)/2,B=[];for(let H=0;H<_;H++){let z=g[H],te=Ne=>z===""?Ne:`${z}|${Ne}`,xe=t.get(te(f));if(!xe?.values){B.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let Ce=b?t.get(te(b)):null,_e=p?t.get(te(p)):null,Re=d?t.get(te(d)):null;B.push({openCol:xe.values,closeCol:Ce?.values??null,highCol:_e?.values??null,lowCol:Re?.values??null,openValid:xe.valid??null,closeValid:Ce?.valid??null,highValid:_e?.valid??null,lowValid:Re?.valid??null})}let k=x*_,N=rf(u??null,k),O=0,U=1/0,S=-1/0,X=x;for(let H=0;H<_;H++){let z=B[H],te=z.openCol;if(!te)continue;let xe=z.closeCol,Ce=z.highCol,_e=z.lowCol,Re=z.openValid,Ne=z.closeValid,kt=z.highValid,dt=z.lowValid,Cn=(H-P)*F;for(let pe=0;pe<X;pe++){let ne=pe+C;if(Re&&!(Re[ne>>3]>>(ne&7)&1))continue;let K=te[ne];if(!isFinite(K))continue;let oe;if(xe&&(!Ne||(Ne[ne>>3]>>(ne&7)&1)!==0)){let ie=xe[ne];oe=isFinite(ie)?ie:K}else{let ie=pe<X-1?pe+1+C:ne;if(!Re||(Re[ie>>3]>>(ie&7)&1)!==0){let _n=te[ie];oe=isFinite(_n)?_n:K}else oe=K}let Me;if(Ce&&(!kt||(kt[ne>>3]>>(ne&7)&1)!==0)){let ie=Ce[ne];Me=isFinite(ie)?ie:K>oe?K:oe}else Me=K>oe?K:oe;let tt;if(_e&&(!dt||(dt[ne>>3]>>(ne&7)&1)!==0)){let ie=_e[ne];tt=isFinite(ie)?ie:K<oe?K:oe}else tt=K<oe?K:oe;let Fe=(A?A[pe]:pe)+Cn,Se=oe>=K?1:0;N.catIdx[O]=pe,N.splitIdx[O]=H,N.seriesId[O]=H,N.xCenter[O]=Fe,N.halfWidth[O]=W,N.open[O]=K,N.close[O]=oe,N.high[O]=Me,N.low[O]=tt,N.isUp[O]=Se,O++,tt<U&&(U=tt),Me>S&&(S=Me)}}if(N.count=O,!isFinite(U)||!isFinite(S))U=0,S=1;else if(U===S){let H=Math.max(Math.abs(U),1)*.05;U-=H,S+=H}return{splitPrefixes:g,rowPaths:y,numCategories:x,rowOffset:C,axisMode:m,numericCategoryDomain:w,categoryPositions:A,series:v,candles:N,yDomain:{min:U,max:S}}}He();Ie();jt();yt();ve();Lt();var sf=3;function Ka(e,t,n){let o=0,i=t;for(;o<i;){let r=o+i>>>1;e[r]<n?o=r+1:i=r}return o}function Rr(e,t,n){if(e.Qo!==-1)return;let o=e.a;if(!o)return;let i=e.be;if(i.count===0){e.ge!==-1&&(e.ge=-1,et(e));return}let r=o.t,s=o.Z,a=o.ie,l=o.J,u=o.re;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e.ge!==-1&&(e.ge=-1,et(e));return}let m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),b=r.width/(a-s),p=sf/b,d=i.xCenter,g=i.halfWidth,h=i.open,y=i.close,x=i.high,C=i.low,_=i.count>0?g[0]:0,v=Math.max(_,p),A=Ka(d,i.count,m-v),w=Ka(d,i.count,m+v+1e-12),L=-1;for(let T=w-1;T>=A;T--){let F=d[T],W=g[T],P=m>=F-W&&m<=F+W,B=Math.abs(m-F)<=p;if(!P&&!B)continue;let k=h[T],N=y[T],O=k<N?k:N,U=k<N?N:k,S=P&&f>=O&&f<=U,X=f>=C[T]&&f<=x[T];if(S||X){L=T;break}}L!==e.ge&&(e.ge=L,et(e))}function Ja(e,t){e.L.dismiss(),e.Qo=t;let n=e.be;if(t<0||t>=n.count||!e.a)return;let o=Mr(e,t);if(o.length===0)return;let i=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.a.E(i,r),a=e.a.cssWidth,l=e.a.cssHeight;e.L.pin(o,s,{cssWidth:a,cssHeight:l}),e.ge=-1,et(e)}function Mr(e,t){let n=[],o=e.be;if(t<0||t>=o.count)return n;let i=o.catIdx[t],r=o.splitIdx[t],s=o.open[t],a=o.close[t],l=o.high[t],u=o.low[t];if(e.lt==="numeric"&&e.$&&e.$e){let d=e.$e[i],g=e.A[0];n.push(e.getColumnFormatter(g,"value")(d))}else if(e.Se.length>0){let d=[];for(let g of e.Se){let h=g.labels[i]??"";h&&d.push(h)}d.length>0&&n.push(d.join(" \\u203A "))}else n.push(`Row ${i+e.rt}`);if(r>=0&&e.ze.length>1){let d=e.ze[r];d&&n.push(d)}let m=e.getColumnFormatter(e.B[0],"value"),f=e.getColumnFormatter(e.B[1],"value"),b=e.getColumnFormatter(e.B[2],"value"),p=e.getColumnFormatter(e.B[3],"value");return n.push(`Open: ${m(s)}`),n.push(`Close: ${f(a)}`),n.push(`High: ${b(l)}`),n.push(`Low: ${p(u)}`),n}function Qa(e,t,n,o,i){let r=1/0,s=-1/0,a={cat:0,lo:0,hi:0,skip:!1};for(let u=0;u<e.length;u++)a.skip=!1,o(e[u],a),!a.skip&&(a.cat<t||a.cat>n||(a.lo<r&&(r=a.lo),a.hi>s&&(s=a.hi)));let l=isFinite(r)&&isFinite(s);if(l&&r===s){let u=Math.abs(r)||1;r-=u,s+=u}return i.min=r,i.max=s,i.hasFit=l,i}function Fr(e){let n=e.T().H;if(e.ao===n)return;let o=Ae(n,1),i=Ae(n,0);e.uo=[o[0],o[1],o[2]],e.mo=[i[0],i[1],i[2]],e.ao=n}function el(e){e.k.bodyWick.invalidateBuffers(e),e.k.ohlc.invalidateBuffers(e)}function tl(e,t){e.k.bodyWick.rebuildBuffers(e,t),e.k.ohlc.rebuildBuffers(e,t)}function nl(e,t){let n=t.gl,o=t.dpr,i=n.canvas.width/o,r=n.canvas.height/o;if(i<=0||r<=0||e.ne===0)return;let s=e.T();Fr(e);let a=e.lt==="numeric",l=a?e.$.min:-.5,u=a?e.$.max:e.ne-.5;e.b&&e.b.setBaseDomain(l,u,e.Cn.min,e.Cn.max);let m=e.b?e.b.getVisibleDomain():{xMin:l,xMax:u,yMin:e.Cn.min,yMax:e.Cn.max};if(e.Nn&&e.b&&!e.b.isXDefault()){let C=lf(e,m.xMin,m.xMax);C.hasFit&&(m.yMin=C.min,m.yMax=C.max)}let f=e.A.length>0,b={levels:e.Se,numRows:e.ne,levelLabels:e.A.slice()},p;if(a)p=new ee(i,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,i-71-16),A=Ee(b,v);p=new ee(i,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.a=p,e.b&&e.b.updateLayout(p);let d=p.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e._e,0),g=se(m.yMin,m.yMax,6),h=e.B[0]||"",y=b,x={min:m.yMin,max:m.yMax,label:h};e.D&&ei(e.D,p,g,s,t.dpr),ze(n,p,t.dpr,()=>{e.Gn==="ohlc"?e.k.ohlc.draw(e,n,t,d):e.k.bodyWick.draw(e,n,t,d)}),e.Re=y,e.Me=x,e.Ge=g,e.Gt=a?se(m.xMin,m.xMax,6):null,et(e)}function et(e){if(!e.d||!e.a||!e.Me||!e.Ge)return;let t=e.T(),n;if(e.lt==="numeric"&&e.$&&e.Gt)n={mode:"numeric",domain:{min:e.$.min,max:e.$.max,isDate:e.$.isDate,label:e.$.label},ticks:e.Gt};else if(e.Re)n={mode:"category",domain:e.Re};else return;let o=e.B[0]??e.B[1]??e.B[2]??e.B[3],i=e.A[0];Qo(e.d,n,{mode:"numeric",domain:e.Me,ticks:e.Ge},e.a,t,e.e?.dpr??1,void 0,!1,{value:e.getColumnFormatter(o,"tick"),category:e.getColumnFormatter(i,"tick")}),e.ge>=0&&e.ge<e.be.count&&af(e)}function af(e){if(!e.d||!e.a)return;let t=e.ge,n=e.be;if(t<0||t>=n.count)return;let o=e.a,i=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=o.E(i,r),a=Mr(e,t),l=e.T();Be(e.d,s,a,o,l,e.e?.dpr??1,{crosshair:!1,highlightRadius:0})}function lf(e,t,n){let o=e.yt;if(o&&o.xMin===t&&o.xMax===n)return o;let i=o??uf();i.xMin=t,i.xMax=n;let r=e.be,s=1/0,a=-1/0,l=!1,u=r.xCenter,m=r.low,f=r.high;for(let b=0;b<r.count;b++){let p=u[b];p<t||p>n||(m[b]<s&&(s=m[b]),f[b]>a&&(a=f[b]),l=!0)}return i.min=l?s:0,i.max=l?a:1,i.hasFit=l,e.yt=i,i}function uf(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}we();ue();var li=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=yo(n),r={...j(t,"candlestick-body",Bn,In,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:o,instanceBuffer:n.createBuffer()},s=je(n),l={...j(t,"line-uniform",Ue,Oe,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]),cornerBuffer:s,segmentBuffer:n.createBuffer()};return this.o={body:r,wick:l},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.e){this.i=null;return}let o=t.e.gl;o.deleteBuffer(n.upWickBuffer),o.deleteBuffer(n.downWickBuffer),this.i=null}rebuildBuffers(t,n){let o=t.be,i=this.ensureProgram(n),r=n.gl,s=t._e;if(o.count===0){let F=r.createBuffer(),W=r.createBuffer();this.i={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:F,downWickBuffer:W};return}let a=new Float32Array(o.count*7),l=0,u=0,m=o.xCenter,f=o.halfWidth,b=o.open,p=o.close,d=o.isUp,g=t.uo,h=t.mo;for(let F=0;F<o.count;F++){let W=b[F],P=p[F],B=W<P?W:P,k=W<P?P:W,N=d[F]!==0,O=N?g:h,U=F*7;a[U+0]=m[F]-s,a[U+1]=f[F]*.7,a[U+2]=B,a[U+3]=k,a[U+4]=O[0],a[U+5]=O[1],a[U+6]=O[2],N?l++:u++}r.bindBuffer(r.ARRAY_BUFFER,i.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);let y=new Float32Array(l*4),x=new Float32Array(u*4),C=0,_=0,v=o.low,A=o.high;for(let F=0;F<o.count;F++){let W=m[F]-s,P=v[F],B=A[F];d[F]!==0?(y[C+0]=W,y[C+1]=P,y[C+2]=W,y[C+3]=B,C+=4):(x[_+0]=W,x[_+1]=P,x[_+2]=W,x[_+3]=B,_+=4)}let w=this.i,L=w?.upWickBuffer??r.createBuffer(),T=w?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,L),r.bufferData(r.ARRAY_BUFFER,y,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,T),r.bufferData(r.ARRAY_BUFFER,x,r.STATIC_DRAW),this.i={bodyCount:o.count,upWickCount:l,downWickCount:u,upWickBuffer:L,downWickBuffer:T}}draw(t,n,o,i){let r=this.i;if(!r||r.bodyCount===0)return;let s=this.ensureProgram(o);mf(n,o,s.body,r.bodyCount,i),ff(t,n,o,s.wick,r,i)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&(n.deleteBuffer(o.body.quadBuffer),n.deleteBuffer(o.body.instanceBuffer),n.deleteBuffer(o.wick.cornerBuffer),n.deleteBuffer(o.wick.segmentBuffer))}this.o=null,this.i=null}};function mf(e,t,n,o,i){if(o===0)return;let r=7*Float32Array.BYTES_PER_ELEMENT;e.useProgram(n.program),e.uniformMatrix4fv(n.u_projection,!1,i);let s=q(t),{setDivisor:a}=s;e.bindBuffer(e.ARRAY_BUFFER,n.quadBuffer),e.enableVertexAttribArray(n.a_corner),e.vertexAttribPointer(n.a_corner,2,e.FLOAT,!1,0,0),a(n.a_corner,0),e.bindBuffer(e.ARRAY_BUFFER,n.instanceBuffer);let l=Float32Array.BYTES_PER_ELEMENT,u=(m,f,b)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,b),a(m,1)};u(n.a_x_center,1,0),u(n.a_half_width,1,1*l),u(n.a_y0,1,2*l),u(n.a_y1,1,3*l),u(n.a_color,3,4*l),s.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o),a(n.a_x_center,0),a(n.a_half_width,0),a(n.a_y0,0),a(n.a_y1,0),a(n.a_color,0)}function ff(e,t,n,o,i,r){if(i.upWickCount===0&&i.downWickCount===0)return;let s=n.dpr;t.useProgram(o.program),t.uniformMatrix4fv(o.u_projection,!1,r),t.uniform2f(o.u_resolution,t.canvas.width,t.canvas.height),t.uniform1f(o.u_line_width,e.h.wick_width_px*s),t.disableVertexAttribArray(o.a_real_start),t.disableVertexAttribArray(o.a_real_end),t.vertexAttrib1f(o.a_real_start,1),t.vertexAttrib1f(o.a_real_end,1),t.uniform1f(o.u_interp_alpha,1);let a=q(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,o.cornerBuffer),t.enableVertexAttribArray(o.a_corner),t.vertexAttribPointer(o.a_corner,1,t.FLOAT,!1,0,0),l(o.a_corner,0),ol(t,a,o,i.upWickBuffer,i.upWickCount,e.uo),ol(t,a,o,i.downWickBuffer,i.downWickCount,e.mo),l(o.a_start,0),l(o.a_end,0)}function ol(e,t,n,o,i,r){if(i===0)return;let s=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:a}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,2*s,0),a(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,2*s,s),a(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i)}we();ue();var ui=class{constructor(){c(this,"o",null);c(this,"i",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,o=je(n),i=j(t,"line-uniform",Ue,Oe,["u_projection","u_color","u_resolution","u_line_width","u_interp_alpha"],["a_corner","a_start","a_end","a_real_start","a_real_end"]);return this.o={...i,cornerBuffer:o,segmentBuffer:n.createBuffer()},this.o}invalidateBuffers(t){let n=this.i;if(!n||!t.e){this.i=null;return}let o=t.e.gl;o.deleteBuffer(n.upBuffer),o.deleteBuffer(n.downBuffer),this.i=null}rebuildBuffers(t,n){if(t.Gn!=="ohlc")return;let o=t.be,i=n.gl;this.ensureProgram(n);let r=t._e,s=o.xCenter,a=o.halfWidth,l=o.open,u=o.close,m=o.high,f=o.low,b=o.isUp,p=0,d=0;for(let A=0;A<o.count;A++)b[A]!==0?p++:d++;let g=new Float32Array(p*3*4),h=new Float32Array(d*3*4),y=0,x=0;for(let A=0;A<o.count;A++){let w=s[A]-r,L=l[A],T=u[A],F=f[A],W=m[A],P=a[A],B=b[A]!==0?g:h,k=b[A]!==0?y:x;B[k++]=w,B[k++]=F,B[k++]=w,B[k++]=W,B[k++]=w-P,B[k++]=L,B[k++]=w,B[k++]=L,B[k++]=w,B[k++]=T,B[k++]=w+P,B[k++]=T,b[A]!==0?y=k:x=k}let C=this.i,_=C?.upBuffer??i.createBuffer(),v=C?.downBuffer??i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,_),i.bufferData(i.ARRAY_BUFFER,g,i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,v),i.bufferData(i.ARRAY_BUFFER,h,i.STATIC_DRAW),this.i={upBuffer:_,downBuffer:v,upInstanceCount:p*3,downInstanceCount:d*3}}draw(t,n,o,i){let r=this.i;if(!r||r.upInstanceCount===0&&r.downInstanceCount===0)return;let s=this.ensureProgram(o),a=o.dpr;n.useProgram(s.program),n.uniformMatrix4fv(s.u_projection,!1,i),n.uniform2f(s.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(s.u_line_width,t.h.ohlc_line_width_px*a),n.disableVertexAttribArray(s.a_real_start),n.disableVertexAttribArray(s.a_real_end),n.vertexAttrib1f(s.a_real_start,1),n.vertexAttrib1f(s.a_real_end,1),n.uniform1f(s.u_interp_alpha,1);let l=q(o),{setDivisor:u}=l;n.bindBuffer(n.ARRAY_BUFFER,s.cornerBuffer),n.enableVertexAttribArray(s.a_corner),n.vertexAttribPointer(s.a_corner,1,n.FLOAT,!1,0,0),u(s.a_corner,0),il(n,l,s,r.upBuffer,r.upInstanceCount,t.uo),il(n,l,s,r.downBuffer,r.downInstanceCount,t.mo),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.e?.gl;if(n){this.invalidateBuffers(t);let o=this.o;o&&(n.deleteBuffer(o.cornerBuffer),n.deleteBuffer(o.segmentBuffer))}this.o=null,this.i=null}};function il(e,t,n,o,i,r){if(i===0)return;let s=4*Float32Array.BYTES_PER_ELEMENT,a=2*Float32Array.BYTES_PER_ELEMENT,{setDivisor:l}=t;e.uniform4f(n.u_color,r[0],r[1],r[2],1),e.bindBuffer(e.ARRAY_BUFFER,o),e.enableVertexAttribArray(n.a_start),e.vertexAttribPointer(n.a_start,2,e.FLOAT,!1,s,0),l(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,s,a),l(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i)}var gn=class extends Pt{constructor(){super(...arguments);c(this,"F",null);c(this,"ze",[]);c(this,"p",[]);c(this,"be",bn());c(this,"Cn",{min:0,max:1});c(this,"fo",null);c(this,"ut",null);c(this,"lt","category");c(this,"$",null);c(this,"$e",null);c(this,"Gt",null);c(this,"_e",0);c(this,"uo",[0,.8,.4]);c(this,"mo",[.8,.2,.2]);c(this,"ao",null);c(this,"ge",-1);c(this,"Qo",-1);c(this,"k",{bodyWick:new li,ohlc:new ui});c(this,"Nn",!0);c(this,"yt",null)}tooltipCallbacks(){return{onHover:(n,o)=>Rr(this,n,o),onLeave:()=>{this.ge!==-1&&(this.ge=-1,et(this))},onPin:(n,o)=>{if(Rr(this,n,o),this.ge>=0){let i=this.ge;Ja(this,i),this.Hi(i)}},onUnpin:()=>{this.emitUnselect()}}}async Hi(n){if(n<0||n>=this.be.count)return;let o=this.be.catIdx[n],i=this.be.splitIdx[n],r=this.Se.map(u=>u.labels[o]??null),s=this.ze[i]??"",a=this.P.length>0&&s!==""?s.split("|"):[],l=this.B[1]||this.B.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:o+this.rt,columnName:l,groupByValues:r,splitByValues:a})}invalidateTheme(){super.invalidateTheme(),this.ao=null}async uploadAndRender(n,o,i,r){if(this.e=n,i!==0)return;let s=qa({columns:o,numRows:r,columnSlots:this.B,groupBy:this.A,splitBy:this.P,groupByTypes:this.pt,bandInnerFrac:this.h.band_inner_frac,barInnerPad:this.h.bar_inner_pad,scratchCandles:this.be});this.h.domain_mode==="expand"?(this.fo=ct(this.fo,s.yDomain),s.numericCategoryDomain&&(this.ut=ct(this.ut,s.numericCategoryDomain))):(this.fo=null,this.ut=null),this.Se=s.rowPaths,this.ne=s.numCategories,this.rt=s.rowOffset,this.ze=s.splitPrefixes,this.p=s.series,this.be=s.candles,this.Cn=s.yDomain,this.lt=s.axisMode.mode,this.$=s.numericCategoryDomain,this.$e=s.categoryPositions,this._e=s.numericCategoryDomain?.min??0,this.yt=null,Fr(this),el(this),tl(this,n),await this.requestRender(n)}Ft(n){this.e=n,nl(this,n)}resetExpandedDomain(){this.fo=null,this.ut=null}destroyInternal(){if(this.e){let n=this.e.gl;this.G&&n.deleteBuffer(this.G),this.k.bodyWick.destroy(this),this.k.ohlc.destroy(this)}this.o=null,this.F=null,this.G=null,this.be=bn(),this.p=[],this.Se=[],this.ne=0,this.ao=null}};var pl={scatter:async()=>xo,line:async()=>Co,density:async()=>_o,treemap:async()=>No,sunburst:async()=>Ho,heatmap:async()=>ai,"y-bar":async()=>Qe,"y-line":async()=>Qe,"y-scatter":async()=>Qe,"y-area":async()=>Qe,"x-bar":async()=>ri,candlestick:async()=>gn,ohlc:async()=>gn,"map-scatter":async()=>(await Promise.resolve().then(()=>(pi(),di))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(pi(),di))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(pi(),di))).MapDensityChart};async function bl(e,t,n){let o=new Map;await e.with_typed_arrays(n??{},async(i,r,s,a)=>{for(let l=0;l<i.length;l++){let u=i[l],m=r[l],f=s[l]??void 0,b=a[l];b!==null?o.set(u,{type:"string",indices:m,dictionary:b,valid:f}):m instanceof Float32Array?o.set(u,{type:"float32",values:m,valid:f}):m instanceof Int32Array?o.set(u,{type:"int32",values:m,valid:f}):m instanceof Float64Array?o.set(u,{type:"float64",values:m,valid:f}):o.set(u,{type:"float32",values:new Float32Array(m),valid:f})}await t(o)})}var gl=new Map;async function hl(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=gl.get(t);if(n){await n;return}n=(async()=>{try{let o={};e.style&&(o.style=e.style),e.weight&&(o.weight=e.weight),e.stretch&&(o.stretch=e.stretch);let i=new FontFace(e.family,e.src,o);await i.load(),self.fonts.add(i)}catch(o){console.warn(`Failed to load font ${e.family}:`,o)}})(),gl.set(t,n),await n}function yn(e,t){switch(t.kind){case"setViewByName":e.setViewByName(t.name);break;case"setColumnsConfig":e.chartImpl.setColumnsConfig?.(t.cfg);break;case"setPluginConfig":e.chartImpl.setPluginConfig?.(t.cfg),e.redraw();break;case"setBufferMaxCapacity":e.glManager.C.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"resize":e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redraw();break;case"clear":e.clear();break;case"invalidateTheme":e.chartImpl.setTheme?.(t.themeVars),e.chartImpl.invalidateTheme?.(),e.resize(e.cssWidth,e.cssHeight,e.dpr);break;case"restoreZoom":e.restoreZoom(t.state);break;case"resetAllZooms":e.resetAllZooms(),e.redraw(),e.post({kind:"zoomChanged",isDefault:e.allZoomsDefault()});break;case"resetExpandedDomain":e.resetExpandedDomain();break;case"interaction":e.onInteraction(t.event);break;case"saveZoom":e.post({kind:"saveZoomReply",requestId:t.requestId,state:e.saveZoom()});break;case"destroy":e.destroy();break;case"init":break;case"snapshotPng":{let n=t.requestId;e.snapshotPng().then(o=>{e.post({kind:"snapshotPngReply",requestId:n,blob:o})}).catch(o=>{e.post({kind:"error",message:String(o)})});break}}}var xn=new Map;function Er(e,t,n){let o={sessionId:e,msg:t};n&&n.length>0?self.postMessage(o,n):self.postMessage(o)}function bf(e){return{postMessage:(t,n)=>Er(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function yl(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:o,msg:i}=n;if(i.kind==="init"){if(xn.has(o)){Er(o,{kind:"error",message:`sessionId ${o} already initialized`});return}e(i,bf(o)).then(s=>{xn.set(o,s)}).catch(s=>{Er(o,{kind:"error",message:String(s)})});return}if(i.kind==="destroy"){let s=xn.get(o);s&&(yn(s,i),xn.delete(o));return}let r=xn.get(o);r&&yn(r,i)})}Pi();var bi=class extends Error{constructor(){super("StaleGenerationError")}};async function xl(e){let t=pl[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var gi=class{constructor(t,n,o,i,r,s){c(this,"chartImpl");c(this,"glManager");c(this,"zoomController",null);c(this,"gridlines");c(this,"chrome");c(this,"cssWidth");c(this,"cssHeight");c(this,"dpr");c(this,"client");c(this,"view");c(this,"table");c(this,"controlPort");c(this,"ei",0);c(this,"co",null);c(this,"ti",0);c(this,"ni",0);this.client=n,this.view=o,this.table=i,this.controlPort=r,this.chartImpl=new s;let a=t.glCanvas??new OffscreenCanvas(Math.max(1,Math.round(t.cssWidth*t.dpr)),Math.max(1,Math.round(t.cssHeight*t.dpr)));this.glManager=new Xn(a,{precompile:t.precompileShaders??!1}),t.renderMode==="blit"&&this.glManager.setFrameCallback(l=>{this.post({kind:"frameBitmap",bitmap:l},[l])}),this.gridlines=t.gridlinesCanvas,this.chrome=t.chromeCanvas,this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(t.gridlinesCanvas),this.chartImpl.setChromeCanvas?.(t.chromeCanvas),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),this.chartImpl.setZoomController&&(this.zoomController=new ht,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(o),this.glManager.C.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr),this.chartImpl.attachTooltip?.(new jn(l=>this.post(l)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}async loadAndRender(t){let n=++this.ei;try{let[o,i,r,s]=await Promise.all([this.view.num_rows(),this.view.schema(),this.view.expression_schema(),this.table?.schema()??Promise.resolve({})]);if(this.ei!==n)return;this.chartImpl.setViewPivots?.(t.viewerConfig.group_by,t.viewerConfig.split_by),this.chartImpl.setColumnTypes?.(i),this.chartImpl.setGroupByTypes?.({...s,...r}),this.chartImpl.setColumnSlots?.(t.viewerConfig.columns);let a=Object.keys(i).length||1,l=Math.floor(this.glManager.C.maxCapacity/a),u=Math.min(o,l);this.glManager.ensureBufferCapacity(u);try{await bl(this.view,async m=>{if(this.ei!==n)throw new bi;await this.chartImpl.uploadAndRender(this.glManager,m,0,u)},{end_row:u,float32:t.options.float32})}catch(m){if(!(m instanceof bi))throw m}}catch(o){(o+"").indexOf("View not found")===-1&&console.error("loadAndRender failed",o)}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId})}}redraw(){this.chartImpl.requestRender(this.glManager)}resize(t,n,o){this.cssWidth=t,this.cssHeight=n,this.dpr=o,this.glManager.requestResize(t,n,o),this.chartImpl.requestRender(this.glManager)}clear(){ls(this.glManager,()=>{this.glManager.clear(),this.gridlines.getContext("2d")?.clearRect(0,0,this.gridlines.width,this.gridlines.height)})}saveZoom(){return this.zoomController?.serialize()}restoreZoom(t){t&&this.zoomController?.restore(t)}allZoomsDefault(){if(this.zoomController&&!this.zoomController.isDefault())return!1;let t=this.chartImpl?.Jt;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.Jt;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}Wi(t,n){let o=this.chartImpl,i=o?.v;if(i){for(let a=0;a<i.cells.length;a++){let l=i.cells[a],u=l.layout.t;if(t>=u.x&&t<=u.x+u.width&&n>=u.y&&n<=u.y+u.height){let m=o.getZoomControllerForFacet?.(a)??this.zoomController;return m?{controller:m,layout:l.layout}:null}}return null}if(!this.zoomController)return null;let r=o?.a;if(!r)return null;let s=r.t;return t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height?null:{controller:this.zoomController,layout:r}}onInteraction(t){switch(t.type){case"wheel":{let n=this.Wi(t.mx,t.my);if(!n)return;zr(n,t.mx,t.my,t.deltaY),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()});break}case"pointerdown":{let n=this.Wi(t.mx,t.my);if(!n)return;this.co=n,this.ti=t.mx,this.ni=t.my;break}case"pointermove":{if(this.co){let n=t.mx-this.ti,o=t.my-this.ni;this.ti=t.mx,this.ni=t.my,Xr(this.co,n,o),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.L()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.co=null;break}case"pointerleave":{this.L()?.dispatchLeave();break}case"click":{this.L()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this.L()?.dispatchDblClick(t.mx,t.my);break}}}L(){return this.chartImpl?.L??null}async snapshotPng(){this.glManager.applyPendingResize(),this.chartImpl.Ft(this.glManager);let t=this.glManager.gl,n=t.canvas,o=n.width,i=n.height,r=new Uint8ClampedArray(o*i*4);t.readPixels(0,0,o,i,t.RGBA,t.UNSIGNED_BYTE,r);let s=new OffscreenCanvas(o,i),a=s.getContext("2d");if(!a)throw new Error("snapshotPng: 2D context unavailable");let u=this.chartImpl.T?.()?.backgroundColor??"transparent";u!=="transparent"&&(a.fillStyle=u,a.fillRect(0,0,o,i)),a.drawImage(this.gridlines,0,0);let m=new OffscreenCanvas(o,i),f=m.getContext("2d");if(!f)throw new Error("snapshotPng: 2D context unavailable for GL blit");return f.putImageData(new ImageData(r,o,i),0,0),a.save(),a.scale(1,-1),a.drawImage(m,0,-i),a.restore(),a.drawImage(this.chrome,0,0),await s.convertToBlob({type:"image/png"})}destroy(){this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},gf=typeof globalThis.importScripts=="function";async function hf(e,t){if(!e.clientWorkerURL||!e.clientWasm||!e.proxyPort)throw new Error("Init error");let n=await import(e.clientWorkerURL.toString());await n.initSync({module:e.clientWasm}),e.fontFaces?.length&&await Promise.all(e.fontFaces.map(hl));let o=e.proxyPort,i=new n.Client(async u=>{let m=u.slice().buffer;o.postMessage(m,[m])},async()=>o.close());o.addEventListener("message",u=>{i.handle_response(new Uint8Array(u.data))}),o.start();let r=i.__unsafe_open_view(e.viewName),s=e.tableName?await i.open_table(e.tableName):null,a=await xl(e.chartTag),l=new gi(e,i,r,s,t,a);return l.post({kind:"ready"}),l}async function Hx(e){let t=e.client.__unsafe_open_view(e.msg.viewName),n=e.msg.tableName?await e.client.open_table(e.msg.tableName):null,o=await xl(e.msg.chartTag),i=new gi(e.msg,e.client,t,n,e.controlPort,o);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&yn(i,s)}),e.controlPort.start(),i.post({kind:"ready"}),i}gf&&yl(hf);export{gi as WorkerRenderer,Hx as bootstrapInProcess};\n';var A=null;async function he(){if(A)return A;let o=new Blob([K],{type:"application/javascript"});return A=URL.createObjectURL(o),A}var D=he;var w=null,N=new Map,ce=0;async function fe(){return w||(w=(async()=>{let o=await D(),e=new Worker(o,{type:"module",name:"viewer-charts"});return e.addEventListener("message",t=>{let i=t.data;N.get(i.sessionId)?.(i.msg)}),e})(),w)}var T=class{_handle=null;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._clientWorkerURL=e.clientWorkerURL,this._clientWasm=e.clientWasm,this._chartTag=e.chartTag,this._maxCells=e.maxCells,this._precompileShaders=e.precompileShaders??!1,this._onZoomChanged=e.onZoomChanged??null,this._ready=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i})}async init(e){this._hostGlCanvas=e.gl;let t=await D();d==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(h=>{let W=h.slice().buffer;this._proxyChannel.port1.postMessage(W,[W])}),this._proxyChannel.port1.addEventListener("message",h=>{this._proxySession.handle_request(new Uint8Array(h.data))}),this._proxyChannel.port1.start());let i;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):i=e.gl.transferControlToOffscreen();let n=e.gridlines.transferControlToOffscreen(),r=e.chrome.transferControlToOffscreen(),l=e.gl.getBoundingClientRect(),a=window.devicePixelRatio||1,s=k(e.gl),m=d==="worker"?Z():[],p=d==="worker"?this._clientWasm:void 0,y=d==="worker"?this._clientWorkerURL:void 0,M=d==="worker"?this._proxyChannel.port2:void 0,U={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:r,proxyPort:M,clientWorkerURL:y,clientWasm:p,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,defaultChartType:e.defaultChartType,themeVars:s,fontFaces:m,cssWidth:l.width,cssHeight:l.height,dpr:a,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._handle=await this._createHandle(t,U),this._handle.addMessageListener(h=>this._handleRendererMsg(h)),d==="worker"){let h=[n,r,this._proxyChannel.port2];i&&h.unshift(i),this._handle.post(U,h)}await this._ready}async _createHandle(e,t){if(d==="worker"){let r=await fe(),l=++ce;return{post:(a,s)=>r.postMessage({sessionId:l,msg:a},s),addMessageListener:a=>{N.set(l,a)},terminate:()=>{N.delete(l)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(r,l)=>n.port1.postMessage(r,l),addMessageListener:r=>{n.port1.addEventListener("message",l=>r(l.data)),n.port1.start()},terminate:()=>{n.port1.close(),n.port2.close()}}}setView(e){this._view=e,this._post({kind:"setViewByName",name:this._view.__unsafe_get_name()})}setColumnsConfig(e){this._post({kind:"setColumnsConfig",cfg:e})}setPluginConfig(e){this._post({kind:"setPluginConfig",cfg:e})}setBufferMaxCapacity(e){this._post({kind:"setBufferMaxCapacity",n:e})}loadAndRender(e){let{id:t,promise:i}=this._allocPending("loadAndRender"),n={kind:"loadAndRender",msgId:t,viewerConfig:e.viewerConfig,options:{float32:e.options?.float32??!0}};return this._post(n),i}redraw(){this._post({kind:"redraw"})}resize(){if(!this._hostGlCanvas)return;let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1;this._post({kind:"resize",cssWidth:e.width,cssHeight:e.height,dpr:t})}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=k(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){let t=++this._pendingCounter,i=new Promise((n,r)=>{this._pending.set(t,{kind:e,resolve:n,reject:r})});return{id:t,promise:i}}restoreZoom(e){this._post({kind:"restoreZoom",state:e})}allZoomsDefault(){return this._allZoomsDefault}resetAllZooms(){this._post({kind:"resetAllZooms"})}resetExpandedDomain(){this._post({kind:"resetExpandedDomain"})}snapshotPng(){let{id:e,promise:t}=this._allocPending("snapshotPng");return this._post({kind:"snapshotPng",requestId:e}),t}forwardInteraction(e){this._post({kind:"interaction",event:e})}destroy(){this._post({kind:"destroy"}),this._proxySession&&this._proxySession.close().catch(()=>{}),this._proxyChannel&&(this._proxyChannel.port1.close(),this._proxyChannel=null),this._handle&&(this._handle.terminate(),this._handle=null),this._hostSink?.dismiss(),this._hostSink=null,this._hostGlCanvas=null,this._displayCtx=null;let e=new Error("RendererTransport destroyed");for(let t of this._pending.values())t.kind==="loadAndRender"?t.resolve(void 0):t.reject(e);this._pending.clear()}_post(e){this._postRaw(e,[])}_postRaw(e,t){this._handle&&this._handle.post(e,t)}_handleRendererMsg(e){switch(e.kind){case"ready":this._resolveReady();break;case"zoomChanged":this._allZoomsDefault=e.isDefault,this._onZoomChanged?.(e.isDefault);break;case"saveZoomReply":this._resolvePending(e.requestId,"saveZoom",e.state);break;case"pinTooltip":this._ensureHostSink()?.pin(e.lines,e.pos,e.bounds);break;case"dismissTooltip":this._hostSink?.dismiss();break;case"setCursor":this._ensureHostSink()?.setCursor(e.cursor);break;case"userClick":this._dispatchOnViewer(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:e.detail}));break;case"userSelect":{let t=this._lastInsertConfig?[this._lastInsertConfig]:[],i=e.selected?[e.insertConfig]:[];this._lastInsertConfig=e.selected?e.insertConfig:void 0;let n=new P(e.selected,e.row,e.column_names,t,i);this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._drawFrameBitmap(e.bitmap);break;case"error":this._rejectReady(new Error(e.message));break;case"loadAndRenderAck":this._resolvePending(e.msgId,"loadAndRender",void 0);break;case"snapshotPngReply":this._resolvePending(e.requestId,"snapshotPng",e.blob);break}}_resolvePending(e,t,i){let n=this._pending.get(e);!n||n.kind!==t||(this._pending.delete(e),n.resolve(i))}_drawFrameBitmap(e){if(this._displayCtx&&this._hostGlCanvas){let t=e.width,i=e.height;this._hostGlCanvas.width!==t&&(this._hostGlCanvas.width=t),this._hostGlCanvas.height!==i&&(this._hostGlCanvas.height=i),this._displayCtx.globalCompositeOperation="copy",this._displayCtx.drawImage(e,0,0)}e.close()}_dispatchOnViewer(e){if(!this._hostGlCanvas)return;let t=this._hostGlCanvas;for(;t;){if(t instanceof HTMLElement&&t.tagName==="PERSPECTIVE-VIEWER"){t.dispatchEvent(e);return}t=t.host??t.parentNode??null}}_ensureHostSink(){if(this._hostSink)return this._hostSink;let e=this._hostGlCanvas?.parentElement;return!e||!this._hostGlCanvas?null:(this._hostSink=new C(this._hostGlCanvas,e),this._hostSink)}};var de={...G},me={auto_alt_y_axis:{kind:"Bool"},include_zero:{kind:"Bool"},domain_mode:{kind:"Enum",variants:[{value:"fit",label:"Fit"},{value:"expand",label:"Expand"}]},facet_mode:{kind:"Enum",variants:[{value:"grid",label:"Grid"},{value:"overlay",label:"Overlay"}]},facet_zoom_mode:{kind:"Enum",variants:[{value:"shared",label:"Shared"},{value:"independent",label:"Independent"}]},series_zoom_mode:{kind:"Enum",variants:[{value:"dynamic",label:"Dynamic"},{value:"fixed",label:"Fixed"}]},line_width_px:{kind:"Number",min:.5,step:.5,max:16},point_size_px:{kind:"Number",min:1,max:32},band_inner_frac:{kind:"Number",min:.1,max:1,step:.01},bar_inner_pad:{kind:"Number",min:0,max:.9,step:.01},wick_width_px:{kind:"Number",min:.5,step:.5,max:8},ohlc_line_width_px:{kind:"Number",min:.5,step:.5,max:8},gradient_radius_px:{kind:"Number",min:2,step:1,max:256},gradient_intensity:{kind:"Number",min:.05,step:.05,max:4},gradient_heat_max:{kind:"Number",min:.1,step:.1,max:64},gradient_color_mode:{kind:"Enum",variants:[{value:"mean",label:"Mean (density-weighted)"},{value:"density",label:"Density only"},{value:"extreme",label:"Extremes"},{value:"signed",label:"Signed sum"}]},map_tile_provider:{kind:"Enum",variants:[{value:"carto-positron",label:"Light (Positron)"},{value:"carto-dark-matter",label:"Dark Matter"},{value:"carto-voyager",label:"Voyager"}]},map_tile_alpha:{kind:"Number",min:0,max:1,step:.05}};function ge(o,e){return{...me[o],key:o,default:e[o]}}var pe=(()=>{let o=new CSSStyleSheet;return o.replaceSync(X),[o]})(),R=class extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_generation=0;_renderBlitMode=q;_resetClickAbort=null;_pluginConfigStore=null;get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{...j,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of pe)this.shadowRoot.adoptedStyleSheets.push(e);this.shadowRoot.innerHTML='<div class="webgl-container"><div class="zoom-controls"><button class="zoom-reset">Reset Zoom</button></div></div>',this._initialized=!0}this._glCanvas?.isConnected||this._buildCanvasStack()}_buildCanvasStack(){let e=this.shadowRoot.querySelector(".webgl-container");e.insertAdjacentHTML("afterbegin",'<canvas class="webgl-gridlines"></canvas><canvas class="webgl-canvas"></canvas><canvas class="webgl-chrome"></canvas>'),this._glCanvas=e.querySelector(".webgl-canvas"),this._gridlineCanvas=e.querySelector(".webgl-gridlines"),this._chromeCanvas=e.querySelector(".webgl-chrome")}_clearCanvasStack(){let e=this.shadowRoot?.querySelector(".webgl-container");if(e)for(let t of Array.from(e.querySelectorAll("canvas")))t.remove();this._glCanvas=null,this._gridlineCanvas=null,this._chromeCanvas=null}disconnectedCallback(){this.delete(),this._clearCanvasStack()}_ensureRenderer(e){return this._initialized||this.connectedCallback(),this._rendererPromise?this._rendererPromise:(this._rendererPromise=this._buildRenderer(e).then(t=>(this._renderer=t,this._setupInteraction(t),t)),this._rendererPromise)}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new b,this._rawEventForwarder.attach(this._glCanvas,n=>{e.forwardInteraction(n)});let i=this.shadowRoot.querySelector(".zoom-reset");i&&(this._resetClickAbort=new AbortController,i.addEventListener("click",()=>{e.resetAllZooms(),t&&t.classList.remove("visible")},{signal:this._resetClickAbort.signal}))}async _buildRenderer(e){let t=this.parentElement,i=await t.getClient(),n=customElements.get("perspective-viewer"),r=n.get_wasm_module(),l=n.get_worker_url(),a=await t?.getTable?.(),s=a?await a.get_name():void 0,m=this.shadowRoot.querySelector(".zoom-controls"),p=new T({client:i,view:e,tableName:s,clientWorkerURL:l,clientWasm:r,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:y=>{m&&m.classList.toggle("visible",!y)}});return await p.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...de,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:this._renderBlitMode}),p}setBlitMode(e){console.assert(this._initialized,"Already initialized"),this._renderBlitMode=e}get_static_config(){return{name:this._chartType.name,category:this._chartType.category,select_mode:this._chartType.selectMode,min_config_columns:this._chartType.initial.count,config_column_names:this._chartType.initial.names,max_cells:this._chartType.max_cells,max_columns:this._chartType.max_columns,group_rollup_modes:["flat"],priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"}}column_config_schema(e,t,i,n,r){let l=[],a=this._chartType.default_chart_type;if(a&&(e==="integer"||e==="float")){l.push({kind:"Enum",key:"chart_type",default:a,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let s=n?.chart_type??a,m=s==="bar"||s==="area";if(m&&l.push({kind:"Bool",key:"stack",default:m}),(a==="bar"||a==="line"||a==="scatter"||a==="area")&&l.push({kind:"Bool",key:"alt_axis",default:!1}),s==="line"||s==="area"){let M=s==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];l.push({kind:"Enum",key:"interpolate",default:"solid",variants:M})}}return e==="integer"||e==="float"?l.push({kind:"NumberFormat"}):(e==="date"||e==="datetime")&&l.push({kind:"DatetimeFormat"}),{fields:l}}plugin_config_schema(e){let t=this._effectiveDefaults();return{fields:this._chartType.applicable_plugin_fields.map(n=>ge(n,t))}}async draw(e){return this._renderer?.resetExpandedDomain(),this._renderer?.resetAllZooms(),this._drawImpl(e)}async update(e){return this._drawImpl(e)}async _drawImpl(e){let t=++this._generation,i=await this._ensureRenderer(e);if(this._generation!==t)return;i.setView(e),i.setBufferMaxCapacity(this._chartType.max_cells);let r=await this.parentElement?.getViewConfig?.()??{};this._generation===t&&await i.loadAndRender({viewerConfig:{group_by:r?.group_by??[],split_by:r?.split_by??[],columns:r?.columns??[]},options:{float32:!0}})}async clear(){this._generation++,this._renderer?.clear()}async resize(){this._renderer?.resize()}restyle(){return this._renderer?.invalidateTheme(),5}async render(e){return await this._ensureRenderer(e),await this.draw(e),this._renderer.snapshotPng()}restore(e,t){e?.zoom&&this._renderer?.restoreZoom(e.zoom),this._pluginConfig={...this._effectiveDefaults(),...e},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(t??{})}delete(){this._generation++,this._rawEventForwarder&&(this._rawEventForwarder.detach(),this._rawEventForwarder=null),this._resetClickAbort&&(this._resetClickAbort.abort(),this._resetClickAbort=null),this._renderer&&(this._renderer.destroy(),this._renderer=null),this._rendererPromise=null}};function _e(...o){let e=new Set(o.length>0?o:S.map(t=>t.name));S.forEach(t=>{if(e.has(t.name)){let i=`perspective-viewer-charts-${t.tag}`;customElements.define(i,class extends R{_chartType=t;static _chartType=t}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(i)})}})}_e();export{P as PerspectiveSelectDetail,_e as register};
|
|
3
3
|
//# sourceMappingURL=perspective-viewer-charts.js.map
|