@perspective-dev/viewer-charts 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer-charts.js +1 -2
- package/dist/cdn/perspective-viewer-charts.js.map +4 -4
- package/dist/esm/axis/legend.d.ts +53 -5
- package/dist/esm/axis/map-ticks.d.ts +15 -0
- package/dist/esm/charts/candlestick/candlestick-interact.d.ts +2 -6
- package/dist/esm/charts/cartesian/cartesian.d.ts +6 -0
- package/dist/esm/charts/cartesian/glyph.d.ts +2 -1
- package/dist/esm/charts/cartesian/glyphs/density.d.ts +2 -1
- package/dist/esm/charts/cartesian/glyphs/lines.d.ts +2 -1
- package/dist/esm/charts/cartesian/glyphs/points.d.ts +2 -1
- package/dist/esm/charts/cartesian/tooltip-lines.d.ts +1 -1
- package/dist/esm/charts/chart-base.d.ts +2 -0
- package/dist/esm/charts/chart.d.ts +77 -6
- package/dist/esm/charts/common/draw-tooltip-box.d.ts +2 -1
- package/dist/esm/charts/common/tree-interact.d.ts +1 -1
- package/dist/esm/charts/series/series-build.d.ts +7 -0
- package/dist/esm/charts/series/series-interact.d.ts +1 -1
- package/dist/esm/charts/series/series.d.ts +6 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/interaction/axis-indicators.d.ts +11 -0
- package/dist/esm/interaction/host-sink-dom.d.ts +3 -2
- package/dist/esm/interaction/host-sink-message.d.ts +3 -2
- package/dist/esm/interaction/lazy-tooltip.d.ts +2 -2
- package/dist/esm/interaction/legend-controller.d.ts +246 -0
- package/dist/esm/interaction/tooltip-controller.d.ts +20 -95
- package/dist/esm/interaction/tooltip-grid.d.ts +33 -0
- package/dist/esm/layout/facet-grid.d.ts +6 -0
- package/dist/esm/layout/ticks.d.ts +1 -0
- package/dist/esm/map/tile-source.d.ts +77 -8
- package/dist/esm/perspective-viewer-charts.js +1 -2
- package/dist/esm/perspective-viewer-charts.js.map +4 -4
- package/dist/esm/plugin/charts.d.ts +2 -0
- package/dist/esm/plugin/format-defaults.d.ts +9 -0
- package/dist/esm/plugin/plugin.d.ts +20 -0
- package/dist/esm/theme/gradient.d.ts +1 -0
- package/dist/esm/transport/protocol.d.ts +45 -3
- package/dist/esm/transport/renderer-transport.d.ts +3 -0
- package/dist/esm/worker/renderer.worker.d.ts +19 -1
- package/package.json +6 -6
- package/src/css/perspective-viewer-charts.css +0 -1
- package/src/ts/axis/bar-axis.ts +2 -7
- package/src/ts/axis/legend.ts +351 -24
- package/src/ts/axis/map-ticks.ts +94 -0
- package/src/ts/axis/numeric-axis.ts +2 -9
- package/src/ts/charts/candlestick/candlestick-interact.ts +46 -40
- package/src/ts/charts/candlestick/candlestick-render.ts +73 -10
- package/src/ts/charts/cartesian/cartesian-interact.ts +9 -3
- package/src/ts/charts/cartesian/cartesian-render.ts +369 -75
- package/src/ts/charts/cartesian/cartesian.ts +9 -0
- package/src/ts/charts/cartesian/glyph.ts +6 -2
- package/src/ts/charts/cartesian/glyphs/density.ts +2 -2
- package/src/ts/charts/cartesian/glyphs/lines.ts +15 -11
- package/src/ts/charts/cartesian/glyphs/points.ts +9 -5
- package/src/ts/charts/cartesian/tooltip-lines.ts +8 -8
- package/src/ts/charts/chart-base.ts +34 -32
- package/src/ts/charts/chart.ts +106 -7
- package/src/ts/charts/common/draw-tooltip-box.ts +13 -30
- package/src/ts/charts/common/tree-chrome.ts +102 -23
- package/src/ts/charts/common/tree-interact.ts +18 -17
- package/src/ts/charts/heatmap/heatmap-interact.ts +65 -7
- package/src/ts/charts/heatmap/heatmap-render.ts +100 -24
- package/src/ts/charts/map/map.ts +3 -5
- package/src/ts/charts/series/series-build.ts +14 -2
- package/src/ts/charts/series/series-interact.ts +12 -11
- package/src/ts/charts/series/series-render.ts +305 -132
- package/src/ts/charts/series/series.ts +10 -0
- package/src/ts/charts/sunburst/sunburst-render.ts +7 -1
- package/src/ts/charts/treemap/treemap-render.ts +7 -1
- package/src/ts/data/view-reader.ts +1 -4
- package/src/ts/index.ts +2 -0
- package/src/ts/interaction/axis-indicators.ts +137 -0
- package/src/ts/interaction/host-sink-dom.ts +66 -2
- package/src/ts/interaction/host-sink-message.ts +8 -2
- package/src/ts/interaction/lazy-tooltip.ts +5 -5
- package/src/ts/interaction/legend-controller.ts +1084 -0
- package/src/ts/interaction/tooltip-controller.ts +43 -131
- package/src/ts/interaction/tooltip-grid.ts +187 -0
- package/src/ts/layout/facet-grid.ts +8 -1
- package/src/ts/layout/ticks.ts +12 -0
- package/src/ts/map/tile-loader.ts +16 -1
- package/src/ts/map/tile-source.ts +199 -53
- package/src/ts/map/tile-sources.json +18 -0
- package/src/ts/plugin/charts.ts +40 -6
- package/src/ts/plugin/format-defaults.ts +37 -0
- package/src/ts/plugin/plugin.ts +236 -67
- package/src/ts/shaders/line.vert.glsl +5 -2
- package/src/ts/shaders/scatter.vert.glsl +0 -7
- package/src/ts/theme/gradient.ts +24 -0
- package/src/ts/transport/protocol.ts +46 -2
- package/src/ts/transport/renderer-transport.ts +83 -4
- package/src/ts/worker/dispatch.ts +6 -2
- package/src/ts/worker/renderer.worker.ts +78 -2
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
var A="Series Charts",W="Cartesian Charts",O="Hierarchical Charts",Z="Financial Charts",V="Map Charts",_e=["X Axis"],F=["Y Axis"],p="select",g="toggle";var T=["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"],R={facet_mode:"overlay"},H={...R,include_zero:!0},K=["facet_mode","facet_zoom_mode","domain_mode","line_width_px","point_size_px"],J=["facet_mode","series_zoom_mode","domain_mode","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px"],Q=[],xe=["facet_zoom_mode"],G=["facet_mode","facet_zoom_mode","domain_mode","map_tile_provider","map_tile_alpha"],ye=[...G,"point_size_px"],ve=[...G,"line_width_px"],be=[...G,"gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"],Ce=["facet_mode","facet_zoom_mode","domain_mode","gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"];function d(r,e,t,i,n,l,o,s){return{name:r,tag:e,category:t,selectMode:i,initial:{count:n,names:l},max_cells:s?.max_cells??2e6,max_columns:s?.max_columns??1e4,applicable_plugin_fields:o,...s?.default_chart_type?{default_chart_type:s.default_chart_type}:{},...s?.plugin_field_defaults?{plugin_field_defaults:s.plugin_field_defaults}:{},...s?.group_by_role?{group_by_role:s.group_by_role}:{},...s?.split_by_role?{split_by_role:s.split_by_role}:{},...s?.connects_row_order?{connects_row_order:s.connects_row_order}:{}}}var ee=["Open","Close","High","Low","Tooltip"],te=["Size","Color","Tooltip"],S={group_by_role:"X Axis",split_by_role:"Series"},we={group_by_role:"Y Axis",split_by_role:"Series"},z={},ie={group_by_role:"Hierarchy",split_by_role:"Facets"},Ae={group_by_role:"X Axis",split_by_role:"Y Axis"},ne={group_by_role:"X Axis",split_by_role:"Series"},Y={},Te=[d("X Bar","x-bar",A,p,1,_e,T,{...we,default_chart_type:"bar",plugin_field_defaults:H}),d("Y Bar","y-bar",A,p,1,F,T,{...S,default_chart_type:"bar",plugin_field_defaults:H}),d("Y Line","y-line",A,p,1,F,T,{...S,default_chart_type:"line",plugin_field_defaults:R}),d("Y Scatter","y-scatter",A,p,1,F,T,{...S,default_chart_type:"scatter",plugin_field_defaults:R}),d("Y Area","y-area",A,p,1,F,T,{...S,default_chart_type:"area",plugin_field_defaults:H}),d("X/Y Scatter","scatter",W,g,2,["X Axis","Y Axis","Color","Size","Label","Tooltip"],K,{...z}),d("X/Y Line","line",W,p,2,["X Axis","Y Axis","Tooltip"],K,{...z,connects_row_order:!0}),d("Density","density",W,g,2,["X Axis","Y Axis","Color","Tooltip"],Ce,{...z}),d("Treemap","treemap",O,g,1,te,Q,{...ie}),d("Sunburst","sunburst",O,g,1,te,Q,{...ie}),d("Heatmap","heatmap",O,p,1,["Color"],xe,{...Ae}),d("Candlestick","candlestick",Z,g,1,ee,J,{...ne,default_chart_type:"candlestick",plugin_field_defaults:R}),d("OHLC","ohlc",Z,g,1,ee,J,{...ne,default_chart_type:"ohlc",plugin_field_defaults:R}),d("Map Scatter","map-scatter",V,g,2,["Longitude","Latitude","Color","Size","Label","Tooltip"],ye,{...Y}),d("Map Line","map-line",V,p,2,["Longitude","Latitude","Tooltip"],ve,{...Y,connects_row_order:!0}),d("Map Density","map-density",V,g,2,["Longitude","Latitude","Color","Tooltip"],be,{...Y})],$=Te;function I(r){let e=r.trim();if(e.startsWith("#")){let i=e.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 t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1]/255,+t[2]/255,+t[3]/255]:[.5,.5,.5]}function M(r){let e=t=>Math.round(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0");return`#${e(r[0])}${e(r[1])}${e(r[2])}`}var C=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}];function re(r){if(!r)return C.slice();let e=r.trim();if(!e)return C.slice();let t=e.indexOf("(");if(t<0||!/^linear-gradient\s*\(/i.test(e))return C.slice();let i=e.lastIndexOf(")");if(i<=t)return C.slice();let n=e.substring(t+1,i),l=[],o=0,s=0;for(let u=0;u<n.length;u++){let h=n[u];h==="("?o++:h===")"?o--:h===","&&o===0&&(l.push(n.substring(s,u)),s=u+1)}l.push(n.substring(s));let a=[],f=0;if(l.length>0){let u=l[0].trim().toLowerCase();(u.startsWith("to ")||/^[-\d.]+(deg|rad|grad|turn)/.test(u))&&(f=1)}for(let u=f;u<l.length;u++){let h=l[u].trim();if(!h)continue;let c=h.match(/\s([\-\d.]+)%\s*$/),v=c?h.substring(0,c.index).trim():h,U=c?parseFloat(c[1])/100:null;try{let b=I(v);a.push({color:b,offset:U})}catch{}}if(a.length===0)return C.slice();if(a.length===1){let[u,h,c]=a[0].color;return[{offset:0,color:[u,h,c,1]},{offset:1,color:[u,h,c,1]}]}a[0].offset===null&&(a[0].offset=0),a[a.length-1].offset===null&&(a[a.length-1].offset=1);for(let u=1;u<a.length-1;u++){if(a[u].offset!==null)continue;let h=u+1;for(;h<a.length&&a[h].offset===null;)h++;let c=a[u-1].offset,v=a[h].offset,U=h-(u-1);for(let b=u;b<h;b++)a[b].offset=c+(b-(u-1))/U*(v-c);u=h-1}let m=0;return a.map(u=>{let h=Math.max(m,Math.min(1,u.offset));return m=h,{offset:h,color:[u.color[0],u.color[1],u.color[2],1]}})}function Re(r){return`${Math.round(Math.max(0,Math.min(1,r))*1e3)/10}%`}function le(r){return`linear-gradient(to right, ${[...r].sort((t,i)=>t.offset-i.offset).map(t=>`${M([t.color[0],t.color[1],t.color[2]])} ${Re(t.offset)}`).join(", ")})`}function oe(r){return`linear-gradient(to right, ${r.map(M).join(", ")})`}function se(r,e){if(r.length===0)return[0,0,0,1];if(e<=r[0].offset)return r[0].color.slice();let t=r[r.length-1];if(e>=t.offset)return t.color.slice();let i=0,n=r.length-1;for(;n-i>1;){let f=i+n>>1;r[f].offset<=e?i=f:n=f}let l=r[i],o=r[n],s=o.offset-l.offset,a=s>0?(e-l.offset)/s:0;return[l.color[0]+(o.color[0]-l.color[0])*a,l.color[1]+(o.color[1]-l.color[1])*a,l.color[2]+(o.color[2]-l.color[2])*a,l.color[3]+(o.color[3]-l.color[3])*a]}var ae=":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 ue={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},he={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 L=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(),l=i.clientX-n.left,o=i.clientY-n.top;i.preventDefault(),t({type:"wheel",mx:l,my:o,deltaY:i.deltaY})},this._onPointerDown=i=>{if(i.button!==0)return;let n=e.getBoundingClientRect(),l=i.clientX-n.left,o=i.clientY-n.top;e.setPointerCapture(i.pointerId),this._pointerId=i.pointerId,t({type:"pointerdown",mx:l,my:o,pointerId:i.pointerId})},this._onPointerMove=i=>{let n=e.getBoundingClientRect(),l=i.clientX-n.left,o=i.clientY-n.top;t({type:"pointermove",mx:l,my:o})},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}};var w=class{selected;row;column_names;removeConfigs;insertConfigs;panel;constructor(e,t,i,n,l,o){this.selected=e,this.row=t,this.column_names=i,this.removeConfigs=n,this.insertConfigs=l,this.panel=o}get removeFilters(){return this.removeConfigs.flatMap(e=>e.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(e=>e.filter??[])}};var Ee=["--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 E(r){let e=getComputedStyle(r),t={};for(let i of Ee){let n=e.getPropertyValue(i).trim();n&&(t[i]=n)}for(let i=1;;i++){let n=`--psp-charts--series-${i}--color`,l=e.getPropertyValue(n).trim();if(!l)break;t[n]=l}return t}function ce(){let r=[];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 l=n.style,o=l.getPropertyValue("font-family").trim(),s=l.getPropertyValue("src").trim();!o||!s||r.push({family:Fe(o),src:Se(s,i),style:x(l,"font-style"),weight:x(l,"font-weight"),stretch:x(l,"font-stretch"),unicodeRange:x(l,"unicode-range"),variant:x(l,"font-variant"),featureSettings:x(l,"font-feature-settings"),display:x(l,"font-display")})}}return r}function x(r,e){return r.getPropertyValue(e).trim()||void 0}function Fe(r){if(r.length>=2){let e=r.charCodeAt(0),t=r.charCodeAt(r.length-1);if(e===t&&(e===34||e===39))return r.slice(1,-1)}return r}function Se(r,e){return r.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,(t,i,n)=>{try{return`url(${new URL(n,e).href})`}catch{return t}})}var P=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 l=n.getBoundingClientRect().width,o=n.getBoundingClientRect().height,s=t.px+12,a=t.py-o-8;s+l>i.cssWidth&&(s=t.px-l-12),s<0&&(s=4),a<0&&(a=t.py+12),a+o>i.cssHeight&&(a=i.cssHeight-o-4),n.style.left=`${s}px`,n.style.top=`${a}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};var _="worker",fe="blit";var de='var Jr=Object.defineProperty;var Jl=(e,t,n)=>t in e?Jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ql=(e,t)=>{for(var n in t)Jr(e,n,{get:t[n],enumerable:!0})};var d=(e,t,n)=>Jl(e,typeof t!="symbol"?t+"":t,n);var Dn,Ro=G(()=>{Dn="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 Bn,Mo=G(()=>{Bn="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 Pn,Fo=G(()=>{Pn="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 En,So=G(()=>{En="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 yt,Io=G(()=>{yt="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 jn,Do=G(()=>{jn="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 Zn,Bo=G(()=>{Zn="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 es,Qr=G(()=>{es=`#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 ns,ts=G(()=>{ns=`#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 qn,Po=G(()=>{qn="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 Kn,Eo=G(()=>{Kn="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 Jn,Go=G(()=>{Jn="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 Qn,Wo=G(()=>{Qn="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 Iu(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 xt,ti=G(()=>{"use strict";xt=class{constructor(){d(this,"ce",1);d(this,"de",1);d(this,"Ie",0);d(this,"De",0);d(this,"wt",0);d(this,"Rt",1);d(this,"Mt",0);d(this,"Ft",1);d(this,"je",null);d(this,"Mo",!1);d(this,"ki",!1);d(this,"Ni",!1);d(this,"St",null);d(this,"It",null);d(this,"jn",null);d(this,"Oi",!1);d(this,"Ui",0);d(this,"Vi",0);d(this,"Zn",null);d(this,"qn",null);d(this,"Kn",null);d(this,"Jn",null)}get lockedAxis(){return this.je}get scaleX(){return this.ce}get scaleY(){return this.de}set scaleX(t){this.ce=t}set scaleY(t){this.de=t}get normTranslateX(){return this.Ie}get normTranslateY(){return this.De}set normTranslateX(t){this.Ie=t}set normTranslateY(t){this.De=t}get baseXRange(){return this.Rt-this.wt}get baseYRange(){return this.Ft-this.Mt}setBaseDomain(t,n,i,o){let r=n-t;if(this.isXDefault()||!this.ki)this.wt=t,this.Rt=n;else{let a=this.Rt-this.wt,l=(this.wt+this.Rt)/2+this.Ie*a;this.wt=t,this.Rt=n,this.Ie=r>0?(l-(t+n)/2)/r:0}let s=o-i;if(this.isYDefault()||!this.Ni)this.Mt=i,this.Ft=o;else{let a=this.Ft-this.Mt,l=(this.Mt+this.Ft)/2+this.De*a;this.Mt=i,this.Ft=o,this.De=s>0?(l-(i+o)/2)/s:0}}pinAxis(t){t==="x"?this.ki=!0:this.Ni=!0}unpinAxis(t){t==="x"?this.ki=!1:this.Ni=!1}configure(t){this.je=t.lockAxis??null,this.Mo=t.lockAspect??!1,this.je==="x"?(this.ce=1,this.Ie=0):this.je==="y"&&(this.de=1,this.De=0)}isXDefault(){return this.ce===1&&this.Ie===0}isYDefault(){return this.de===1&&this.De===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.Rt-this.wt,n=this.Ft-this.Mt,i=t/this.ce,o=n/this.de,r=(this.wt+this.Rt)/2+this.Ie*t,s=(this.Mt+this.Ft)/2+this.De*n,a={xMin:r-i/2,xMax:r+i/2,yMin:s-o/2,yMax:s+o/2};return this.Mo&&this.It?Iu(a,this.It.e):a}attach(t,n,i){this.detach(),this.St=t,this.It=n,this.jn=i,this.Zn=o=>{o.preventDefault();let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.It.e;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.ce,p=this.de,c=Math.pow(1.1,-o.deltaY/100);this.je!=="x"&&(this.ce=Math.max(1,Math.min(1e5,this.ce*c))),this.je!=="y"&&(this.de=Math.max(1,Math.min(1e5,this.de*c))),this.je!=="x"&&f!==this.ce&&(this.Ie+=(u-.5)*(1/f-1/this.ce)),this.je!=="y"&&p!==this.de&&(this.De+=(.5-m)*(1/p-1/this.de)),this.jn()},this.qn=o=>{if(o.button!==0)return;let r=t.getBoundingClientRect(),s=o.clientX-r.left,a=o.clientY-r.top,l=this.It.e;s>=l.x&&s<=l.x+l.width&&a>=l.y&&a<=l.y+l.height&&(this.Oi=!0,this.Ui=o.clientX,this.Vi=o.clientY,t.setPointerCapture(o.pointerId))},this.Kn=o=>{if(!this.Oi)return;let r=o.clientX-this.Ui,s=o.clientY-this.Vi;this.Ui=o.clientX,this.Vi=o.clientY;let a=this.It.e;this.je!=="x"&&a.width>0&&(this.Ie-=r/(a.width*this.ce)),this.je!=="y"&&a.height>0&&(this.De+=s/(a.height*this.de)),this.jn()},this.Jn=()=>{this.Oi=!1},t.addEventListener("wheel",this.Zn,{passive:!1}),t.addEventListener("pointerdown",this.qn),t.addEventListener("pointermove",this.Kn),t.addEventListener("pointerup",this.Jn)}updateLayout(t){this.It=t}detach(){this.St&&(this.Zn&&this.St.removeEventListener("wheel",this.Zn),this.qn&&this.St.removeEventListener("pointerdown",this.qn),this.Kn&&this.St.removeEventListener("pointermove",this.Kn),this.Jn&&this.St.removeEventListener("pointerup",this.Jn)),this.St=null,this.jn=null}reset(){this.ce=1,this.de=1,this.Ie=0,this.De=0}serialize(){return{scaleX:this.ce,scaleY:this.de,normTranslateX:this.Ie,normTranslateY:this.De}}restore(t){this.ce=t.scaleX,this.de=t.scaleY,this.Ie=t.normTranslateX,this.De=t.normTranslateY}}});function ls(e){return e&&!("format"in e)?e:void 0}function No(e,t){let n=t??Du[e]??{};return new Intl.NumberFormat(navigator.languages,n)}function Oo(e){if(!e||!("format"in e)){let n=ls(e),i={timeZone:n?.timeZone??void 0,dateStyle:n?.dateStyle==="disabled"?void 0:n?.dateStyle??as.dateStyle,timeStyle:n?.timeStyle==="disabled"?void 0:n?.timeStyle??as.timeStyle};return new Intl.DateTimeFormat(navigator.languages,i)}let t={timeZone:e.timeZone??void 0,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 us(e){let t=ls(e),n={timeZone:"utc",dateStyle:t?.dateStyle==="disabled"?void 0:t?.dateStyle??Bu.dateStyle};return new Intl.DateTimeFormat(navigator.languages,n)}function Uo(e){return e.split("|").at(-1)??e}var Du,as,Bu,ms=G(()=>{"use strict";Du={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},as={dateStyle:"short",timeStyle:"medium"},Bu={dateStyle:"short"}});var ii,fs=G(()=>{"use strict";ii=class{constructor(t,n=128){d(this,"qt");d(this,"d",new Map);d(this,"Le",new Map);d(this,"Fo");this.qt=t,this.Fo=n}async fetchRow(t){if(!this.qt)throw new Error("LazyRowFetcher disposed");let n=this.d.get(t);if(n)return this.d.delete(t),this.d.set(t,n),n;let i=this.Le.get(t);if(i)return i;let o=this.ur(t);this.Le.set(t,o);try{let r=await o;if(!this.qt)return r;if(this.d.set(t,r),this.d.size>this.Fo){let s=this.d.keys().next().value;s!==void 0&&this.d.delete(s)}return r}finally{this.Le.delete(t)}}async ur(t){let n=this.qt;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],p=a[l];(f?!(f[0]>>0&1):!1)?i.set(u,null):p?i.set(u,p[m[0]]):i.set(u,m[0])}}),i}dispose(){this.qt=null,this.d.clear(),this.Le.clear()}get isDisposed(){return this.qt===null}}});function cs(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 oe(e,t,n){n<1&&(n=1);let i=cs(t-e,!1),o=cs(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 me(e){if(!Number.isFinite(e))return"-";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 Ct(e,t){let n=ds.get(e);return n||(n=new Intl.DateTimeFormat(void 0,t),ds.set(e,n)),n}function xe(e,t){let n=new Date(e);return isNaN(n.getTime())?me(e):t!==void 0&&t>0?t>=864e5*28?Ct("ym",{year:"numeric",month:"short"}).format(n):t>=864e5?Ct("md",{month:"short",day:"numeric"}).format(n):t>=36e5?Ct("mdh",{month:"short",day:"numeric",hour:"numeric"}).format(n):t>=6e4?Ct("hm",{hour:"numeric",minute:"2-digit"}).format(n):Ct("hms",{hour:"numeric",minute:"2-digit",second:"2-digit"}).format(n):Ct("ymd",{year:"numeric",month:"short",day:"numeric"}).format(n)}var ds,Le=G(()=>{"use strict";ds=new Map});var ps,bs,hs=G(()=>{"use strict";ps={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},bs={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 Ee(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 y of n){let g=a.measureText(y).width;g>m&&(m=g)}let f=m+u*2,p=n.length*l+u*2-4,c=t.px+12,b=t.py-p-8;c+f>i.cssWidth&&(c=t.px-f-12),b<0&&(b=t.py+12),b+p>i.cssHeight&&(b=i.cssHeight-p-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.e.y),a.lineTo(t.px,i.e.y+i.e.height),a.moveTo(i.e.x,t.py),a.lineTo(i.e.x+i.e.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.Qn,a.strokeStyle=o.So,a.lineWidth=1,a.beginPath(),a.roundRect(c,b,f,p,4),a.fill(),a.stroke(),a.fillStyle=o.Io,a.textAlign="left",a.textBaseline="top";for(let y=0;y<n.length;y++)a.fillText(n[y],c+u,b+u+y*l)}a.restore()}var oi,_t=G(()=>{"use strict";oi=class{constructor(){d(this,"Oe",null);d(this,"Kt",0);d(this,"Jt",null);d(this,"cn",null);d(this,"ht",!1)}get isPinned(){return this.ht}setHost(t){this.ht&&(this.cn?.dismiss(),this.ht=!1),this.cn=t}setCursor(t){this.cn?.setCursor(t)}attach(t){this.detach(),this.Oe=t}detach(){this.Kt&&(cancelAnimationFrame(this.Kt),this.Kt=0),this.Jt!==null&&(clearTimeout(this.Jt),this.Jt=null),this.Oe=null}dispatchHover(t,n){if(this.ht||!this.Oe||this.Kt||this.Jt!==null)return;let i=()=>{this.Kt=0,this.Jt=null,this.Oe?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.Kt=requestAnimationFrame(i):this.Jt=setTimeout(i,16)}dispatchLeave(){this.ht||!this.Oe||this.Oe.onLeave()}dispatchClick(t,n){if(this.Oe&&!this.Oe.onClickPre?.(t,n)){if(this.ht){let i=this.Oe;this.dismiss(),i.onUnpin?.();return}this.Oe.onPin?.(t,n)}}dispatchDblClick(t,n){this.Oe?.onDblClick?.(t,n)}pin(t,n,i){t.length!==0&&(this.cn?.pin(t,n,i),this.ht=!0)}dismiss(){this.cn?.dismiss(),this.ht=!1}}});function ri(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 Vo=G(()=>{"use strict"});function gs(e){if(!e)return ot.slice();let t=e.trim();if(!t)return ot.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return ot.slice();let i=t.lastIndexOf(")");if(i<=n)return ot.slice();let o=t.substring(n+1,i),r=[],s=0,a=0;for(let p=0;p<o.length;p++){let c=o[p];c==="("?s++:c===")"?s--:c===","&&s===0&&(r.push(o.substring(a,p)),a=p+1)}r.push(o.substring(a));let l=[],u=0;if(r.length>0){let p=r[0].trim().toLowerCase();(p.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(p))&&(u=1)}for(let p=u;p<r.length;p++){let c=r[p].trim();if(!c)continue;let b=c.match(/\\s([\\-\\d.]+)%\\s*$/),h=b?c.substring(0,b.index).trim():c,y=b?parseFloat(b[1])/100:null;try{let g=ri(h);l.push({color:g,offset:y})}catch{}}if(l.length===0)return ot.slice();if(l.length===1){let[p,c,b]=l[0].color;return[{offset:0,color:[p,c,b,1]},{offset:1,color:[p,c,b,1]}]}l[0].offset===null&&(l[0].offset=0),l[l.length-1].offset===null&&(l[l.length-1].offset=1);for(let p=1;p<l.length-1;p++){if(l[p].offset!==null)continue;let c=p+1;for(;c<l.length&&l[c].offset===null;)c++;let b=l[p-1].offset,h=l[c].offset,y=c-(p-1);for(let g=p;g<c;g++)l[g].offset=b+(g-(p-1))/y*(h-b);p=c-1}let m=0;return l.map(p=>{let c=Math.max(m,Math.min(1,p.offset));return m=c,{offset:c,color:[p.color[0],p.color[1],p.color[2],1]}})}function Ho(e){let t=e.trim();if(t.startsWith("#")){let l=t.slice(1);return/^[0-9a-f]+$/i.test(l)?l.length===3||l.length===4?[parseInt(l[0]+l[0],16)/255,parseInt(l[1]+l[1],16)/255,parseInt(l[2]+l[2],16)/255]:l.length===6||l.length===8?[parseInt(l.slice(0,2),16)/255,parseInt(l.slice(2,4),16)/255,parseInt(l.slice(4,6),16)/255]:null:null}let n=t.match(/^rgba?\\(([^)]*)\\)$/i);if(!n)return null;let i=n[1].split("/")[0].split(/[\\s,]+/).filter(l=>l.length>0);if(i.length<3||i.length>4)return null;let o=l=>{let u=l.endsWith("%"),m=parseFloat(u?l.slice(0,-1):l);if(!isFinite(m))return null;let f=u?m/100*255:m;return Math.max(0,Math.min(255,Math.round(f)))/255},r=o(i[0]),s=o(i[1]),a=o(i[2]);return r===null||s===null||a===null?null:[r,s,a]}function ys(e){let t=e.trim().match(/^linear-gradient\\s*\\((.*)\\)$/is);if(!t)return null;let n=t[1],i=[],o=0,r=0;for(let a=0;a<n.length;a++){let l=n[a];l==="("?o++:l===")"?o--:l===","&&o===0&&(i.push(n.substring(r,a)),r=a+1)}i.push(n.substring(r));let s=[];for(let a=0;a<i.length;a++){let l=i[a].trim();if(!l)return null;let u=l.toLowerCase();if(a===0&&(u.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)$/.test(u)))continue;let m=l.match(/\\s([^\\s)]+)$/),f=l,p=null;if(m){let b=m[1];if(b.endsWith("%")){let h=parseFloat(b.slice(0,-1));if(!isFinite(h))return null;f=l.substring(0,m.index).trim(),p=h/100}else if(/^[-\\d.]/.test(b))return null}let c=Ho(f);if(!c)return null;s.push([c,p])}return s}function xs(e){let t=ys(e);if(!t||t.length<2)return null;let n=t.map(([,r])=>r),i=n.length-1;n[0]===null&&(n[0]=0),n[i]===null&&(n[i]=1);for(let r=1;r<i;r++){if(n[r]!==null)continue;let s=r+1;for(;n[s]===null;)s++;let a=n[r-1],l=n[s],u=s-(r-1);for(let m=r;m<s;m++)n[m]=a+(m-(r-1))/u*(l-a);r=s-1}let o=t.map(([r],s)=>({offset:Math.max(0,Math.min(1,n[s])),color:[r[0],r[1],r[2],1]}));return o.sort((r,s)=>r.offset-s.offset),o}function si(e){let t=ys(e);if(!t||t.length===0)return null;let n=[];for(let[i,o]of t){if(o!==null)return null;n.push(i)}return n}function Te(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 rt(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 Cs(e){if(e.length===0)return ot.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 _s(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=Te(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 ot,Ce=G(()=>{"use strict";Vo();ot=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function Pu(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function vs(e){return!isFinite(e)||e<0?1:e}function As(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=gs(n),o=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;o.push(ri(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)"),Te:t("--psp--color","rgba(180, 0, 0, 0.9)"),ei:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),dn:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),O:i,pn:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),mr:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),Qn:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),Io:t("--psp-charts--tooltip--color","#161616"),So:t("--psp-charts--tooltip--border-color","#fff"),ti:Pu(parseFloat(t("--psp-charts--area--opacity","0.85"))),Do:vs(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),Bo:vs(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),Be:o}}var Ls=G(()=>{"use strict";Vo();Ce()});function Ts(e,t,n){if(!n)return e;let i=t?.[n];if(!i)return e;let o=e,r=Gu(i.gradient);r&&(o={...o,O:r});let s=Eu(i.palette);return s&&(o={...o,Be:s}),o}function Eu(e){return typeof e!="string"?null:si(e)}function Gu(e){return typeof e!="string"?null:xs(e)}var ws=G(()=>{"use strict";Ce()});function Ms(e,t,n){let i=st.get(e);i?(i.fullRender=t,i.render2D=n):(i={glManager:e,fullRender:t,render2D:n,waiters:[]},st.set(e,i));let o=Promise.withResolvers();return i.waiters.push(o),ai||(ai=Ds(Is)),o.promise}function Fs(e,t){if(!li.has(e)){t();return}let n=Jt.get(e);n||(n=[],Jt.set(e,n)),n.push(t)}function Ss(e){let t=st.get(e);if(t){st.delete(e);for(let n of t.waiters)n.resolve()}Jt.delete(e),li.delete(e)}async function Is(){let e=Array.from(st.values());st.clear();let t=new Map;for(let n of e){if(n.glManager.isContextLost()){for(let r of n.waiters)r.resolve();continue}let i=n.glManager.backendId,o=t.get(i);o?o.push(n):t.set(i,[n])}await Promise.all(Array.from(t.values()).map(Wu)),ai=0,st.size>0&&(ai=Ds(Is))}async function Wu(e){for(let t of e)await ku(t)}async function ku(e){li.add(e.glManager);try{e.glManager.beginFrame(),e.fullRender()}catch(t){console.error("scheduler: fullRender threw",t);for(let n of e.waiters)n.reject(t);Rs(e.glManager);return}try{await e.glManager.awaitGpuFence(),e.render2D(),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{Rs(e.glManager)}}function Rs(e){li.delete(e);let t=Jt.get(e);if(t){Jt.delete(e);for(let n of t)try{n()}catch(i){console.error("scheduler: deferred op threw",i)}}}function Ds(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var st,ai,li,Jt,Yo=G(()=>{"use strict";st=new Map,ai=0,li=new Set,Jt=new Map});var Bs,Nu,Ou,we,Qt=G(()=>{"use strict";ms();fs();Le();ti();hs();_t();Ls();ws();Yo();Bs=!0,Nu=(()=>{if(Bs)return me;{let e=No("float");return t=>e.format(t)}})(),Ou=(()=>{if(Bs)return xe;{let e=Oo();return t=>e.format(t)}})(),we=class{constructor(){d(this,"t",null);d(this,"j",null);d(this,"c",null);d(this,"Po",null);d(this,"bn",[]);d(this,"Eo",{});d(this,"h",null);d(this,"hn",[]);d(this,"R",[]);d(this,"g",[]);d(this,"D",[]);d(this,"Ue",{});d(this,"ni",!1);d(this,"ii",!1);d(this,"gt",{});d(this,"gn",{});d(this,"Hi",new Map);d(this,"oi");d(this,"G",{...ps});d(this,"C",{...bs});d(this,"T",new oi);d(this,"Yi",null);d(this,"ri",Promise.resolve());d(this,"Qt",null);d(this,"Go",null);d(this,"Pe",null)}setGridlineCanvas(t){this.j=t}setChromeCanvas(t){this.c=t}setOverlayPresenter(t){this.Po=t}presentOverlay(){this.Po?.()}setTheme(t){this.Eo=t,this.Qt=null}setZoomController(t){this.h=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.G.zoom_mode==="shared")return this.h;if(!this.h)return null;let n=this.hn[t];return n||(n=new xt,n.configure(this.getZoomConfig()),this.hn[t]=n),n}computeEffectiveFacetFlags(){let t=this.G.zoom_mode==="independent",n=!t&&this.G.shared_x_axis,i=!t&&this.G.shared_y_axis;return this.ni=n,this.ii=i,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:i}}syncFacetZoomLayouts(t){let n=this.G.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.hn)r&&r.setBaseDomain(t,n,i,o)}getZoomConfig(){return{}}setColumnSlots(t){this.R=t}setViewPivots(t,n){this.g=t,this.D=n}setColumnTypes(t){this.Ue=t,this.Wo()}resetExpandedDomain(){}setGroupByTypes(t){this.gt=t}setColumnsConfig(t){this.gn=t??{},this.Wo(),this.Qt=null}Wo(){this.Hi=new Map;for(let[t,n]of Object.entries(this.gn)){let i=this.Ue[t]??this.gt[t],o=this.fr(i,n);o&&this.Hi.set(t,o)}}fr(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let i=n.number_format;if(!i)return;let o=No(t,i);return r=>o.format(r)}if(t==="datetime"){let i=n.date_format;if(!i)return;let o=Oo(i);return r=>o.format(r)}if(t==="date"){let i=n.date_format;if(!i)return;let o=us(i);return r=>o.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.Hi.get(Uo(t));if(r)return r}if(n==="tick")return;let i=t?Uo(t):void 0,o=i?this.Ue[i]??this.gt[i]:void 0;return o==="date"||o==="datetime"?Ou:Nu}setDefaultChartType(t){this.oi=t}setFacetConfig(t){this.G={...t}}setPluginConfig(t){this.C={...t},this.G={...this.G,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.si=t.series_zoom_mode==="dynamic"}colorScaleColumn(){return null}A(){let t=this.colorScaleColumn();return(!this.Qt||this.Go!==t)&&(this.Go=t,this.Qt=Ts(As(this.Eo),this.gn,t)),this.Qt}invalidateTheme(){this.Qt=null}setView(t){this.Pe&&this.Pe.dispose(),this.Pe=new ii(t);let n=this.T.isPinned;this.T.dismiss(),n&&this.emitUnselect()}deselect(){this.T.dismiss()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this.T.attach(this.tooltipCallbacks()),this.T.setHost(t),this.Yi=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.Pe)try{let o=await this.Pe.fetchRow(t.rowIdx);n=Object.fromEntries(o)}catch{n={}}let i=[];for(let o=0;o<this.g.length;o++){let r=t.groupByValues[o];r!=null&&r!==""&&i.push([this.g[o],"==",r])}for(let o=0;o<this.D.length;o++){let r=t.splitByValues[o];r!=null&&r!==""&&i.push([this.D[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.Yi?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.Yi?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this.ri.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.ri=n.catch(i=>{console.error("emitClickAndSelect failed",i)}),n}emitUnselect(t={}){let n=this.ri.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this.ri=n.catch(i=>{console.error("emitUnselect failed",i)})}requestRender(t){return Ms(t,()=>{this.bn=[],this.Bt(t)},()=>this.ko())}pe(t){this.bn.push(t)}ko(){let t=this.bn;this.bn=[];for(let n of t)n()}renderFrameSync(t){this.bn=[],this.Bt(t),this.ko()}destroy(){this.T.detach(),this.T.dismiss(),this.Pe&&(this.Pe.dispose(),this.Pe=null),this.destroyInternal()}}});var ui,Ps=G(()=>{"use strict";ui=class{constructor(t,n,i,o,r){d(this,"Qe",new Map);d(this,"be");d(this,"we");d(this,"Pt");d(this,"No");this.be=t,this.we=i,this.Pt=r,this.No=Math.max(1,Math.ceil((n-t)/r))}Oo(t,n){return n*this.No+t}insert(t,n,i){let o=Math.floor((n-this.be)/this.Pt),r=Math.floor((i-this.we)/this.Pt),s=this.Oo(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.Pt),u=Math.ceil(i/r/this.Pt),m=Math.floor((t-this.be)/this.Pt),f=Math.floor((n-this.we)/this.Pt),p=-1,c=i*i;for(let b=f-u;b<=f+u;b++)for(let h=m-l;h<=m+l;h++){let y=this.Qe.get(this.Oo(h,b));if(y)for(let g of y){let x=(s[g]-t)*o,_=(a[g]-n)*r,C=x*x+_*_;C<c&&(c=C,p=g)}}return p}}});var mi,Es=G(()=>{"use strict";Ps();mi=class{constructor(){d(this,"yn",null);d(this,"xn",!0)}markDirty(){this.xn=!0}get isDirty(){return this.xn}rebuild(t,n,i){if(n===0){this.yn=null,this.xn=!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 ui(t.xMin,t.xMax,t.yMin,t.yMax,a);i((u,m,f)=>l.insert(u,m,f)),this.yn=l,this.xn=!1}query(t,n,i,o,r,s,a){return!this.yn||!s||!a?-1:this.yn.query(t,n,i,o,r,s,a)}clear(){this.yn=null,this.xn=!0}}});function He(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 en=G(()=>{"use strict"});var fi,Gs=G(()=>{"use strict";fi=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 Ws(e,t,n,i){let o;if(!e)o="(null)";else{let s=e.valid;if(!(s?!!(s[t>>3]>>(t&7)&1):!0))o="(null)";else if(e.indices&&e.dictionary)o=e.dictionary[e.indices[t]]??"(null)";else if(e.values){let l=e.values[t];o=l==null?"(null)":String(l)}else o="(null)"}let r=i.get(o);return r===void 0&&(r=n.length,n.push(o),i.set(o,r)),r}function Uu(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),He(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 ks(e,t,n,i){e.glyph.ensureProgram(e,t);let o=e.s,r=e.Z;e.C.domain_mode==="expand"?(e.be=e.Cn,e.et=e._n,e.we=e.vn,e.tt=e.An,e.b=e.ai,e.p=e.li,e.nt=e.ui,e.it=e.mi):(e.be=1/0,e.et=-1/0,e.we=1/0,e.tt=-1/0,e.b=1/0,e.p=-1/0,e.nt=1/0,e.it=-1/0,e.Cn=1/0,e._n=-1/0,e.vn=1/0,e.An=-1/0,e.ai=1/0,e.li=-1/0,e.ui=1/0,e.mi=-1/0),e.M=NaN,e.F=NaN,e.yt=0,e.en.clear(),e.zi=0;let a=e.R,l=a[0]||"",u=a[1]||"",m=a[2]||"",f=a[3]||"",p=a[4]||"";e.Ve=l,e.Ee=u,e.Uo=!l,e.Ge=!!l&&e.Ue[l]==="string",e.he=!!u&&e.Ue[u]==="string",e.tn=[],e.nn=[],e.Vo=new Map,e.Ho=new Map,e.ot=null,e.rt=null,e.Ge&&(e.M=0,e.be=0,e.et=0,e.Cn=1/0,e._n=-1/0),e.he&&(e.F=0,e.we=0,e.tt=0,e.vn=1/0,e.An=-1/0);let c=t.v.totalCapacity||i;if(e.D.length>0){if(e.L=Uu(n,l,u,m,f,p),e.L.length===0){e.w=0,e.U=[];return}if(e.Ze=e.L[0].xColName,e.He=e.L[0].yColName,e.s=m,e.ne=f,e.fi=p,e.Z=!1,m){let y=n.get(e.L[0].colorColName);e.Z=y?.type==="string"}t.ensureBufferCapacity(c*e.L.length)}else if(e.L=[],e.Ze=l,e.He=u,e.s=m,e.ne=f,e.fi=p,e.Z=!1,e.s){let y=n.get(e.s);e.Z=y?.type==="string"}(e.s!==o||e.Z!==r)&&(e.f=new Map);let b=Math.max(1,e.L.length);e.w=c,e.U=new Array(b).fill(0);let h=b*c;e.V=new Float32Array(h),e.H=new Float32Array(h),e.xt=new Float32Array(h),e.Et=new Int32Array(h),e.Gt=p?new fi(h):null}function Ns(e,t,n,i,o,r){if(!e.He)return;let s=o;if(s===0||e.w===0)return;let a=e.L.length>0,l=[];if(a)for(let b of e.L){let h=b.xColName?n.get(b.xColName):null,y=n.get(b.yColName);if(!y||!e.he&&!y.values)continue;let g=b.sizeColName?n.get(b.sizeColName):null,x=b.colorColName?n.get(b.colorColName)??null:null,_=b.labelColName?n.get(b.labelColName)??null:null;l.push({xCol:h?.values??null,yCol:y.values??null,xColData:h??null,yColData:y,xValid:h?.valid,yValid:y.valid,colorCol:x,sizeCol:g?.values??null,labelCol:_})}else{let b=e.Ze?n.get(e.Ze):null,h=e.He?n.get(e.He):null;if(!h||!e.he&&!h.values)return;let y=e.s?n.get(e.s)??null:null,g=e.fi?n.get(e.fi)??null:null;l.push({xCol:b?.values??null,yCol:h.values??null,xColData:b??null,yColData:h,xValid:b?.valid,yValid:h?.valid,colorCol:y,sizeCol:null,labelCol:g})}if(l.length===0)return;e.Yo<s&&(e.Xi=new Float32Array(s*2),e.$i=new Float32Array(s),e.ji=new Float32Array(s),e.Yo=s);let u=e.Xi,m=e.$i,f=e.ji,p=!a&&e.ne?n.get(e.ne)?.values??null:null;if(e.Z&&e.s){for(let b of l){let h=b.colorCol?.dictionary;if(h)for(let y=0;y<h.length;y++){let g=h[y];e.f.has(g)||e.f.set(g,e.f.size)}}e.f.size>0&&(e.b=0,e.p=e.f.size-1)}!e.s&&e.L.length>1&&(e.b=0,e.p=e.L.length-1);for(let b=0;b<l.length;b++){let h=l[b],y=e.U[b]??0,g=b*e.w,x=e.w-y;if(x<=0)continue;let _=h.colorCol?.valid,C=0;for(let T=0;T<s&&C<x;T++){let L=T;if(!e.he&&h.yValid&&!(h.yValid[L>>3]>>(L&7)&1)||!e.Ge&&h.xCol&&h.xValid&&!(h.xValid[L>>3]>>(L&7)&1))continue;let w=_!==void 0&&!(_[L>>3]>>(L&7)&1),F;if(e.he)F=Ws(h.yColData,L,e.nn,e.Ho);else if(h.yCol){if(F=h.yCol[L],isNaN(F))continue}else continue;let I;if(e.Ge)I=Ws(h.xColData,L,e.tn,e.Vo);else if(h.xCol){if(I=h.xCol[L],isNaN(I))continue}else I=i+L;let[S,D]=e.projectPoint(I,F);if(isNaN(S)||isNaN(D))continue;S<e.be&&(e.be=S),S>e.et&&(e.et=S),D<e.we&&(e.we=D),D>e.tt&&(e.tt=D),isNaN(e.M)&&(e.M=S),isNaN(e.F)&&(e.F=D);let B=S-e.M,N=D-e.F,k=g+y+C;e.V[k]=B,e.H[k]=N,e.Et[k]=i+L,u[C*2]=B,u[C*2+1]=N;let Y=h.colorCol;if(w)m[C]=.5,e.xt[k]=.5;else if(Y&&!e.Z&&Y.values){let W=Y.values[L];m[C]=W,e.xt[k]=W,W<e.b&&(e.b=W),W>e.p&&(e.p=W)}else if(Y&&e.Z&&Y.indices&&Y.dictionary){let W=Y.dictionary[Y.indices[L]];e.f.has(W)||(e.f.set(W,e.f.size),e.p=e.f.size-1);let V=e.f.get(W);m[C]=V,e.xt[k]=V}else m[C]=b,e.xt[k]=b;if(e.Gt&&h.labelCol){let W=h.labelCol,V=W.valid;!(V!==void 0&&!(V[L>>3]>>(L&7)&1))&&W.indices&&W.dictionary&&e.Gt.set(k,W.dictionary[W.indices[L]])}if(h.sizeCol){let W=h.sizeCol[L];f[C]=W,W<e.nt&&(e.nt=W),W>e.it&&(e.it=W)}else if(p){let W=p[L];f[C]=W,W<e.nt&&(e.nt=W),W>e.it&&(e.it=W)}else f[C]=0;C++}if(C===0)continue;let v=(g+y)*2*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_position",u.subarray(0,C*2),v,2);let A=(g+y)*Float32Array.BYTES_PER_ELEMENT;t.v.upload("a_color_value",m.subarray(0,C),A),t.v.upload("a_size_value",f.subarray(0,C),A),e.U[b]=y+C,e.U[b]>e.zi&&(e.zi=e.U[b])}let c=0;for(let b of e.U)c+=b;e.yt=c,t.uploadedCount=c,e.en.markDirty(),isFinite(e.be)&&e.setZoomBaseDomain(e.be,e.et,e.we,e.tt)}var Os=G(()=>{"use strict";en();Gs()});function vt(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.Te,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var ci=G(()=>{"use strict"});var ne,Ye=G(()=>{"use strict";ne=class{constructor(t,n,i){d(this,"margins");d(this,"e");d(this,"cssWidth");d(this,"cssHeight");d(this,"Y",0);d(this,"J",1);d(this,"q",0);d(this,"Q",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,p=i.cellWidth??t,c=i.cellHeight??n,b=m+r,h=f+l,y=Math.max(1,p-r-u),g=Math.max(1,c-l-a),x=t-(b+y),_=n-(h+g);this.margins={top:h,right:x,bottom:_,left:b},this.e={x:b,y:h,width:y,height:g}}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 p=m*a,c=f*a,b=s&&r==="y"&&i>=0,h=s&&r==="y"&&o<=0,y=s&&r==="x"&&t>=0,g=s&&r==="x"&&n<=0;t-=p,n+=p,i-=c,o+=c,b?(i=0,o+=c):h&&(o=0,i-=c),y?(t=0,n+=p):g&&(n=0,t-=p),this.Y=t,this.J=n,this.q=i,this.Q=o;let x=2*this.margins.left/this.cssWidth-1,_=1-2*this.margins.right/this.cssWidth,C=2*this.margins.bottom/this.cssHeight-1,v=1-2*this.margins.top/this.cssHeight,A=(_-x)/(n-t),T=(v-C)/(o-i),L=x-A*(t-l),w=C-T*(i-u);return new Float32Array([A,0,0,0,0,T,0,0,0,0,-1,0,L,w,0,1])}B(t,n){let{x:i,y:o,width:r,height:s}=this.e,a=(t-this.Y)/(this.J-this.Y),l=(n-this.q)/(this.Q-this.q);return{px:i+a*r,py:o+(1-l)*s}}}});function tn(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function nn(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function ju(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),p=m/f,c=Math.max(p,1/p),b=l*u;(c<s||c===s&&b<a)&&(o=l,r=u,s=c,a=b)}return{cols:o,rows:r}}function Re(e,t){let n=e.length,{cssWidth:i,cssHeight:o}=t;if(n<=0||i<=0||o<=0)return{cells:[]};let r=t.titleBand??Xu,s=t.hasLegend?$u:0,a=t.xAxis??"cell",l=t.yAxis??"cell",u=a==="none"&&l==="none",m=l==="outer"?Vu+(t.hasYLabel?Yu:0):0,f=a==="outer"?Hu+(t.hasXLabel?zu:0):0,p=0,c=s,b=m,h=p,y=Math.max(1,i-m-c),g=Math.max(1,o-p-f),x=Math.max(0,t.gap??0),{cols:_,rows:C}=ju(n,y,g,x),v=Math.max(0,_-1)*x,A=Math.max(0,C-1)*x,T=Math.max(1,(y-v)/_),L=Math.max(1,(g-A)/C),w=[];for(let D=0;D<n;D++){let B=Math.floor(D/_),N=D-B*_,k=B===C-1||D+_>=n,Y=N===0,W=b+N*(T+x),V=h+B*(L+x),U=V+r,X=W,q=T,le=Math.max(1,L-r),Se=new ne(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:X,originY:U,cellWidth:q,cellHeight:le}),ve=r>0?{x:X,y:V,width:q,height:r}:void 0;w.push({index:D,label:e[D],layout:Se,titleRect:ve,isLeftEdge:Y,isBottomEdge:k})}let F=t.hasLegend?{x:b+y,y:p,width:s,height:g}:void 0,I=a==="outer"?{x:b,y:h+g,width:y,height:f}:void 0;return{cells:w,legendRect:F,outerXAxisRect:I,outerYAxisRect:l==="outer"?{x:0,y:h,width:m,height:g}:void 0}}var Vu,Hu,Yu,zu,Xu,$u,At=G(()=>{"use strict";Ye();Vu=55,Hu=24,Yu=16,zu=18,Xu=18,$u=96});function Zu(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=Te(e,o);n[i]=[r[0],r[1],r[2]]}return n}function de(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 Zu(t,n)}var on=G(()=>{"use strict";Ce()});function at(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 lt(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.e.width*n),Math.round(t.e.height*n));try{i()}finally{e.disable(e.SCISSOR_TEST)}}function ze(e,t,n,i){at(e),lt(e,t,n,i)}var rn=G(()=>{"use strict"});function sn(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=_s(n,Us);return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,Us,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 Ge(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 Us,Lt=G(()=>{"use strict";Ce();Us=256});function ue(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 re(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var ut=G(()=>{"use strict"});function di(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 pi(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 Tt(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 wt(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 bi=G(()=>{"use strict"});function Rt(e,t,n){let{e:i}=n,o=Math.max(2,Math.floor(i.width/90)),r=Math.max(2,Math.floor(i.height/60));return{xTicks:oe(e.min,e.max,o),yTicks:oe(t.min,t.max,r)}}function zo(e,t,n,i,o,r){let s=re(e,r);if(!s)return;let{e:a}=t;s.strokeStyle=o.dn,s.lineWidth=1,Tt(s,a,n,l=>t.B(l,0).px),wt(s,a,i,l=>t.B(0,l).py)}function Vs(e,t,n){if(n)return n;let i=t.length>1?t[1]-t[0]:0;return e.isDate?o=>xe(o,i):me}function Hs(e,t,n,i,o,r,s,a,l){let{Dt:u,Te:m,ei:f,fontFamily:p}=s,c=Vs(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 ${p}`;for(let b of i)di(e,b.e,n,o,"bottom",h=>b.B(h,0).px,c);a&&t.label&&(e.fillStyle=m,e.font=`13px ${p}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,a.cx,a.baselineY))}function Ys(e,t,n,i,o,r,s,a,l){let{Dt:u,Te:m,ei:f,fontFamily:p}=s,c=Vs(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 ${p}`;for(let b of i)pi(e,b.e,n,o,"left",h=>b.B(0,h).py,c);a&&t.label&&(e.fillStyle=m,e.font=`13px ${p}`,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 Xo(e,t,n,i,o,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Hs(l,t,i,[n],u.y+u.height,u,o,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,a)}function $o(e,t,n,i,o,r,s,a){let l=re(e,s);if(!l)return;let{e:u}=n;Ys(l,t,i,[n],u.x,u,o,r?{pivotY:u.y+u.height/2}:null,a)}function an(e,t,n,i,o,r,s,a,l){let u=re(e,a);u&&Hs(u,n,i,o,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,l)}function ln(e,t,n,i,o,r,s,a,l){let u=re(e,a);u&&Ys(u,n,i,o,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,l)}var jo=G(()=>{"use strict";Le();ut();bi()});function Zo(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 qo(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 zs(e,t){return e.x+e.width+14>t.x+t.width}function Ko(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 mt(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 Xs(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(mt(e,r,n));break}o.push(r.slice(0,l)),r=r.slice(l).trimStart()}return o.length===1&&o[0].length<=2?[]:o}var hi=G(()=>{"use strict"});function gi(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 un(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}var mn=G(()=>{"use strict"});function Jo(e,t){return e.B(t,0).px}function Qo(e,t){return e.B(0,t).py}function tm(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:qu,rotation:0}}function $s(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(tm(e.numRows,r.maxLabelChars,t)):i.push({size:Ku,rotation:0})}return i}function js(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+em))}else n.push(Qu);return n}function Zs(e){let t=0;for(let n of e)t+=n;return t}function We(e,t){return e.numRows===0||e.levels.length===0?24:Zs($s(e,t).map(n=>n.size))}function Ft(e){return e.numRows===0||e.levels.length===0?55:Zs(js(e))}function nm(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 qs(e,t){return e.labels[t]??""}function Ks(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 Js(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 pe(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Dt:o,Te:r,fontFamily:s}=i,{e:a}=t,l=a.y+a.height;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${Mt}px ${s}`;let u=$s(n,a.width),m=Ks(n.numRows,t.Y,t.J,!1);if(!m)return;let[f,p]=m,c=n.levels.length,b=l;for(let y=c-1;y>=0;y--){let g=n.levels[y],x=u[y],_=b;b+=x.size,y===c-1?im(e,t,g,f,p,_,x,s,o):om(e,t,g,f,p,_,s,o)}let h=n.levelLabels.filter(y=>!!y).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 im(e,t,n,i,o,r,s,a,l){let{e:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),p=s.rotation===0?nm(i,o,u.width,f):rm(i,o);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let y of p){let g=Jo(t,y);g<u.x-1||g>u.x+u.width+1||(e.moveTo(g,r),e.lineTo(g,r+yi))}e.stroke(),e.font=`${Mt}px ${a}`;let c=r+yi+3,b={x:u.x,width:u.width,y:r,height:9999},h=[];for(let y of p){let g=Jo(t,y);if(g<u.x-1||g>u.x+u.width+1)continue;let x=qs(n,y);if(!x)continue;let _=e.measureText(x).width,C=Zo(g,c,_,er,s.rotation);if(Ko(C,b)){if(s.rotation===0){if(h.some(v=>qo(v,C)))continue}else if(h.some(v=>zs(v,C)))continue;h.push(C),Qs(e,x,g,c,s.rotation,"center")}}}function om(e,t,n,i,o,r,s,a){let{e:l}=t,u=un(n.runs,i,o);if(u.length===0)return;let m=Js(u,b=>Jo(t,b),l.x,l.x+l.width);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let b of m)e.moveTo(b.nearClip,r+3),e.lineTo(b.farClip,r+3),e.moveTo(b.nearEdge,r),e.lineTo(b.nearEdge,r+3),e.moveTo(b.farEdge,r),e.lineTo(b.farEdge,r+3);e.stroke(),e.font=`${Mt}px ${s}`;let f=r+3+4,p=[],c={x:l.x,width:l.width,y:r,height:9999};for(let b of m){let h=(b.nearClip+b.farClip)/2,y=b.run.label;if(!y)continue;let g=b.farClip-b.nearClip-4,x=mt(e,y,g);if(!x)continue;let _=e.measureText(x).width,C=Zo(h,f,_,er,0);Ko(C,c)&&(p.some(v=>qo(v,C))||(p.push(C),Qs(e,x,h,f,0,"center")))}}function rm(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n}function Me(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Dt:o,Te:r,fontFamily:s}=i,{e:a}=t,l=a.x;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${Mt}px ${s}`;let u=js(n),m=Ks(n.numRows,t.q,t.Q,!0);if(!m)return;let[f,p]=m,c=n.levels.length,b=l;for(let y=c-1;y>=0;y--){let g=n.levels[y],x=u[y],_=b;b-=x,y===c-1?sm(e,t,g,f,p,_,s,o):am(e,t,g,f,p,_,x,s,o)}let h=n.levelLabels.filter(y=>!!y).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 sm(e,t,n,i,o,r,s,a){let{e:l}=t,u=er+4,m=o-i+1,f=Math.max(1,Math.floor(l.height/u)),p=m<=f?1:Math.ceil(m/f);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let c=i;c<=o;c+=p){let b=Qo(t,c);b<l.y-1||b>l.y+l.height+1||(e.moveTo(r-yi,b),e.lineTo(r,b))}e.stroke(),e.font=`${Mt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let c=i;c<=o;c+=p){let b=Qo(t,c);if(b<l.y-1||b>l.y+l.height+1)continue;let h=qs(n,c);h&&e.fillText(h,r-yi-3,b)}}function am(e,t,n,i,o,r,s,a,l){let{e:u}=t,m=un(n.runs,i,o);if(m.length===0)return;let f=Js(m,c=>Qo(t,c),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=l,e.fillStyle=l;let p=r-3;e.beginPath();for(let c of f)e.moveTo(p,c.nearClip),e.lineTo(p,c.farClip),e.moveTo(p,c.nearEdge),e.lineTo(r,c.nearEdge),e.moveTo(p,c.farEdge),e.lineTo(r,c.farEdge);e.stroke(),e.font=`${Mt}px ${a}`,e.textAlign="right",e.textBaseline="middle";for(let c of f){let b=(c.nearClip+c.farClip)/2,h=c.run.label;if(!h)continue;let y=s-6,g=mt(e,h,y);g&&e.fillText(g,p-3,b)}}function Qs(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()}var qu,Ku,yi,Mt,er,Ju,Qu,em,St=G(()=>{"use strict";hi();mn();qu=25,Ku=22,yi=5,Mt=11,er=14,Ju=55,Qu=60,em=10});function lm(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function It(e,t,n,i,o,r){let s={x:t.e.x+t.e.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};fn(e,s,n,i,o,r)}function fn(e,t,n,i,o,r=me){let s=e.getContext("2d");if(!s)return;let a=o.pn,l=o.mr,u=o.fontFamily,m=16,f=Math.min(120,t.height*.4),p=t.x,c=t.y;s.fillStyle=a,s.font=`9px ${u}`,s.textAlign="left",s.textBaseline="bottom",s.fillText(n.label,p,c-4);let b=n.max,h=n.min,y=s.createLinearGradient(0,c,0,c+f),g=16;for(let _=0;_<=g;_++){let C=_/g,v=b+C*(h-b),A=rt(v,n.min,n.max),T=Te(i,A);y.addColorStop(C,lm(T))}s.fillStyle=y,s.fillRect(p,c,m,f),s.strokeStyle=l,s.lineWidth=1,s.strokeRect(p,c,m,f),s.fillStyle=a,s.font=`10px ${u}`,s.textAlign="left",s.textBaseline="middle";let x=p+m+5;if(s.fillText(r(n.max),x,c+2),s.fillText(r((n.min+n.max)/2),x,c+f/2),s.fillText(r(n.min),x,c+f-2),n.min<0&&n.max>0){let _=(n.max-0)/(n.max-n.min),C=c+_*f;s.strokeStyle=a,s.lineWidth=1,s.beginPath(),s.moveTo(p+m,C),s.lineTo(p+m+4,C),s.stroke(),s.fillStyle=a,s.fillText("0",x,C)}}function xi(e,t,n,i,o){let r={x:t.e.x+t.e.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};cn(e,r,n,i,o)}function cn(e,t,n,i,o){let r=e.getContext("2d");if(!r||n.size===0)return;let s=o.pn,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[p,c]of n){if(f+l/2>t.y+t.height)break;let b=i[c]??i[c%i.length]??[0,0,0];r.fillStyle=`rgb(${Math.round(b[0]*255)},${Math.round(b[1]*255)},${Math.round(b[2]*255)})`,r.fillRect(m,f-l/2,l,l),r.fillStyle=s,r.fillText(p,m+l+6,f),f+=u}}var Ci=G(()=>{"use strict";Le();Ce()});function Xe(e){return isNaN(e)?0:e}function ea(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.L.length>0,a=e.G.facet_mode,l=s&&a==="grid";e.computeEffectiveFacetFlags();let u=e.s!==""&&e.b<e.p,m=l&&e.G.zoom_mode==="independent",f;if(e.h&&!m?f=e.h.getVisibleDomain():f={xMin:e.be,xMax:e.et,yMin:e.we,yMax:e.tt},!isFinite(f.xMin)||!isFinite(f.yMin))return;let p=e.A(),c=p.Be,b=e.Ue[e.Ve]||"",h=e.Ue[e.Ee]||"",y=b==="date"||b==="datetime",g=h==="date"||h==="datetime",x=e.Z,_=!x&&!e.s,C=p.O;if(x||_){let v=_?Math.max(1,e.L.length):Math.max(1,e.f.size);if(e.ci&&e.Zi===c&&e.qi===v)C=e.ci;else{let A=de(c,p.O,v);C=Cs(A),e.ci=C,e.Zi=c,e.qi=v}}else e.ci=null,e.Zi=null,e.qi=-1;e.ie=sn(t,e.ie,C),l?fm(e,t,f,p,{xIsDate:y,yIsDate:g,cssWidth:o,cssHeight:r}):(e.m=null,mm(e,t,f,p,{xIsDate:y,yIsDate:g,cssWidth:o,cssHeight:r,hasColorCol:u})),e.pe(()=>$e(e))}function _i(e,t,n,i){return{min:t,max:n,label:e.Ve||(e.Uo?"Row":e.Ze||""),isDate:i}}function vi(e,t,n,i){return{min:t,max:n,label:e.Ee||e.He,isDate:i}}function Ai(e,t){let n=0;for(let o of e)o.length>n&&(n=o.length);return{levels:[{labels:e.slice(),runs:[],maxLabelChars:n}],numRows:e.length,levelLabels:[t]}}function um(e,t,n,i,o,r,s,a,l){if(e.Ge&&e.ot){let u=re(t,l);u&&pe(u,n,e.ot,a)}else Xo(t,i,n,r,a,!0,l,e.getColumnFormatter(e.Ze,"tick"));if(e.he&&e.rt){let u=re(t,l);u&&Me(u,n,e.rt,a)}else $o(t,o,n,s,a,!0,l,e.getColumnFormatter(e.He,"tick"))}function mm(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u,hasColorCol:m}=o;e.ot=e.Ge&&e.tn.length>0?Ai(e.tn,e.Ve||e.Ze||""):null,e.rt=e.he&&e.nn.length>0?Ai(e.nn,e.Ee||e.He||""):null;let f=m?80:16,p=55+(e.Ee?16:0),c=Math.max(1,s-p-f),b=e.rt?Ft(e.rt):void 0,h=e.ot?We(e.ot,c):void 0,y=new ne(s,a,{hasXLabel:!!e.Ve,hasYLabel:!!e.Ee,hasLegend:m,leftExtra:b,bottomExtra:h});e.l=y,e.h&&e.h.updateLayout(y);let g=y.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,Xe(e.M),Xe(e.F)),x=_i(e,n.xMin,n.xMax,l),_=vi(e,n.yMin,n.yMax,u),C=Rt(x,_,y),v=e.Ge?[]:C.xTicks,A=e.he?[]:C.yTicks,T=e.Ln==="map",L=t.dpr,w=e.j;w&&!T?e.pe(()=>{ue(w,y,L),zo(w,y,v,A,i,L)}):w&&T&&e.pe(()=>ue(w,y,L)),ze(r,y,t.dpr,()=>{T&&e.renderBackground(t,y,g,n,Xe(e.M),Xe(e.F)),e.glyph.draw(e,t,g)}),e.ge=x,e.ye=_,e.di=v,e.Re=A,e.pi=i.O,e.bi=m}function fm(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:a,xIsDate:l,yIsDate:u}=o;e.ot=e.Ge&&e.tn.length>0?Ai(e.tn,e.Ve||e.Ze||""):null,e.rt=e.he&&e.nn.length>0?Ai(e.nn,e.Ee||e.He||""):null;let m=e.L.map(L=>L.prefix),f=e.Z&&e.f.size>1,p=!!e.s&&!e.Z&&e.b<e.p,c=f||p,b=Re(m,{cssWidth:s,cssHeight:a,xAxis:e.ni?"outer":"cell",yAxis:e.ii?"outer":"cell",hasLegend:c,hasXLabel:!!e.Ve,hasYLabel:!!e.Ee,gap:e.G.facet_padding});if(e.m=b,b.cells.length>1){let L=b.cells[0].layout.e;for(let w=1;w<b.cells.length;w++){let F=b.cells[w].layout.e;if(F.width!==L.width||F.height!==L.height){console.warn(`facet-grid: cell ${w} size (${F.width}\\xD7${F.height}) differs from cell 0 (${L.width}\\xD7${L.height})`);break}}}e.l=b.cells[0]?.layout??null,e.syncFacetZoomLayouts(b.cells);let h=e.G.zoom_mode==="independent",y=_i(e,n.xMin,n.xMax,l),g=vi(e,n.yMin,n.yMax,u),x=b.cells[0]?.layout,_=x?Rt(y,g,x):{xTicks:[],yTicks:[]},C=e.Ge?[]:_.xTicks,v=e.he?[]:_.yTicks,A=t.dpr,T=e.j;T&&x&&e.pe(()=>ue(T,x,A)),at(r);for(let L=0;L<b.cells.length;L++){let w=b.cells[L],F=e.getZoomControllerForFacet(L),I=h&&F?F.getVisibleDomain():n,S=w.layout.buildProjectionMatrix(I.xMin,I.xMax,I.yMin,I.yMax,void 0,void 0,void 0,Xe(e.M),Xe(e.F)),D=e.Ln==="map";T&&!D&&e.pe(()=>{let B=h?Rt(_i(e,I.xMin,I.xMax,l),vi(e,I.yMin,I.yMax,u),w.layout).xTicks:C,N=h?Rt(_i(e,I.xMin,I.xMax,l),vi(e,I.yMin,I.yMax,u),w.layout).yTicks:v;zo(T,w.layout,B,N,i,A)}),lt(r,w.layout,t.dpr,()=>{D&&e.renderBackground(t,w.layout,S,I,Xe(e.M),Xe(e.F)),e.glyph.drawSeries(e,t,S,L)})}e.ge=y,e.ye=g,e.di=C,e.Re=v,e.pi=i.O,e.bi=c}function $e(e){cm(e),e.presentOverlay()}function cm(e){!e.c||!e.l||!e.ge||!e.ye||!e.t||(ue(e.c,e.l,e.t.dpr),e.m?pm(e):dm(e))}function dm(e){let t=e.l,n=e.A(),i=e.t?.dpr??1;if(e.Ln==="map"?e.renderMapChrome(e.c,t,n,i):um(e,e.c,t,e.ge,e.ye,e.di,e.Re,n,i),e.bi){let r=e.pi??n.O;if(e.Z&&e.f.size>0){let s=de(n.Be,r,e.f.size);xi(e.c,t,e.f,s,n)}else e.s&&It(e.c,t,{min:e.b,max:e.p,label:e.s},r,n,e.getColumnFormatter(e.s,"value"))}ta(e,e.c,t,0,1),e.le>=0&&e.V&&e.H&&gm(e,e.c,t)}function pm(e){let t=e.m,n=e.c,i=e.A(),o=e.t?.dpr??1,r=e.di,s=e.Re,a=e.ge,l=e.ye,u=e.Ln==="map",m=e.ni&&!e.Ge,f=e.ii&&!e.he,p=e.G.zoom_mode==="independent";u&&e.renderMapChrome(n,e.l,i,o),!u&&m&&t.outerXAxisRect&&an(n,t.outerXAxisRect,a,r,tn(t),i,!!e.Ve,o,e.getColumnFormatter(e.Ze,"tick")),!u&&f&&t.outerYAxisRect&&ln(n,t.outerYAxisRect,l,s,nn(t),i,!!e.Ee,o,e.getColumnFormatter(e.He,"tick"));for(let c=0;c<t.cells.length;c++){let b=t.cells[c],h=p?e.getZoomControllerForFacet(c):null,y=h?h.getVisibleDomain():null,g=y?{...a,min:y.xMin,max:y.xMax}:a,x=y?{...l,min:y.yMin,max:y.yMax}:l,_=p?Rt(g,x,b.layout):{xTicks:r,yTicks:s};if(!u&&!m)if(e.Ge&&e.ot){let C=re(n,o);C&&pe(C,b.layout,e.ot,i)}else Xo(n,g,b.layout,_.xTicks,i,!!e.Ve,o,e.getColumnFormatter(e.Ze,"tick"));if(!u&&!f)if(e.he&&e.rt){let C=re(n,o);C&&Me(C,b.layout,e.rt,i)}else $o(n,x,b.layout,_.yTicks,i,!!e.Ee,o,e.getColumnFormatter(e.He,"tick"));b.titleRect&&vt(n,b.label,b.titleRect,i,o),ta(e,n,b.layout,c,c+1)}if(e.bi&&t.legendRect){let c=e.pi??i.O;if(e.Z&&e.f.size>0){let b=de(i.Be,c,Math.max(1,e.f.size));cn(n,t.legendRect,e.f,b,i)}else e.s&&fn(n,{x:t.legendRect.x,y:t.legendRect.y+20,width:t.legendRect.width,height:t.legendRect.height-20},{min:e.b,max:e.p,label:e.s},c,i,e.getColumnFormatter(e.s,"value"))}if(e.le>=0&&e.V&&e.H){let c=isNaN(e.M)?0:e.M,b=isNaN(e.F)?0:e.F,h=e.V[e.le]+c,y=e.H[e.le]+b,g=bm(e,e.le),x=e.glyph.tooltipOptions(),_=e.W.lines??[];for(let C=0;C<t.cells.length;C++){let v=t.cells[C],A=C===g,T=v.layout.B(h,y),L=v.layout.e;if(T.px<L.x||T.px>L.x+L.width||T.py<L.y||T.py>L.y+L.height)continue;let w=e.G.coordinated_tooltip;Ee(n,T,A||w?_:[],v.layout,i,o,{crosshair:x.crosshair,highlightRadius:A?x.highlightRadius:0})}}}function bm(e,t){return e.w<=0?0:Math.floor(t/e.w)}function ta(e,t,n,i,o){if(!e.Gt||!e.V||!e.H)return;let r=e.Gt.dictionary,s=e.Gt.data,a=e.V,l=e.H,u=isNaN(e.M)?0:e.M,m=isNaN(e.F)?0:e.F,f=e.w;if(f<=0)return;let p=0;for(let x=i;x<o;x++)p+=e.U[x]??0;if(p===0)return;let c=e.t?.dpr??1,b=re(t,c);if(!b)return;let h=e.A(),y=n.e,g=Math.max(1,Math.ceil(p/hm));b.save(),b.font=`11px ${h.fontFamily}`,b.fillStyle=h.Te,b.textAlign="left",b.textBaseline="middle";for(let x=i;x<o;x++){let _=e.U[x]??0,C=x*f;for(let v=0;v<_;v+=g){let A=C+v,T=s[A];if(T<0)continue;let{px:L,py:w}=n.B(a[A]+u,l[A]+m);L<y.x||L>y.x+y.width||w<y.y||w>y.y+y.height||b.fillText(r[T],L+8,w-4)}}b.restore()}function gm(e,t,n){let i=e.le;if(i<0||!e.V||!e.H)return;let o=isNaN(e.M)?0:e.M,r=isNaN(e.F)?0:e.F,s=n.B(e.V[i]+o,e.H[i]+r),a=e.W.lines??[],l=e.A();Ee(t,s,a,n,l,e.t?.dpr??1,e.glyph.tooltipOptions())}var hm,tr=G(()=>{"use strict";ci();Ye();At();on();Ce();rn();Lt();_t();jo();ut();St();Ci();hm=5e3});function ym(e){if(!e.en.isDirty||!e.V||!e.H)return;let t=e.V,n=e.H,i=Math.max(1,e.L.length),o=e.w,r=isNaN(e.M)?0:e.M,s=isNaN(e.F)?0:e.F;e.en.rebuild({xMin:e.be-r,xMax:e.et-r,yMin:e.we-s,yMax:e.tt-s},e.yt,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 nr(e,t,n){if(!e.V||!e.H)return;let{layout:i,facetIdx:o}=xm(e,t,n);if(!i){na(e);return}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){na(e);return}let s=i.Y,a=i.J,l=i.q,u=i.Q,m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),c=r.height/(u-l),b=isNaN(e.M)?0:e.M,h=isNaN(e.F)?0:e.F,y=m-b,g=f-h,x=o<0?Cm(e,y,g,p,c):_m(e,o,y,g,p,c);if(x!==e.le||o!==e.Tn){if(e.le=x,e.Tn=o,x>=0){let _=e.W.beginHover(x);e.glyph.buildTooltipLines(e,x).then(C=>{e.W.commitHover(_,C)&&$e(e)})}else e.W.clearHover();$e(e)}}function na(e){(e.le!==-1||e.Tn!==-1)&&(e.le=-1,e.Tn=-1,$e(e))}function xm(e,t,n){if(e.m){let i=e.m.cells;for(let o=0;o<i.length;o++){let r=i[o].layout.e;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.l,facetIdx:-1}}function Cm(e,t,n,i,o){ym(e);let r=e.en.query(t,n,dn,i,o,e.V,e.H);if(r>=0)return r;let s=dn*dn,a=Math.max(1,e.L.length),l=e.w,u=e.V,m=e.H;for(let f=0;f<a;f++){let p=e.U[f]??0,c=f*l;for(let b=0;b<p;b++){let h=c+b,y=(u[h]-t)*i,g=(m[h]-n)*o,x=y*y+g*g;x<s&&(s=x,r=h)}}return r}function _m(e,t,n,i,o,r){let s=e.U[t]??0;if(s===0)return-1;let a=e.w,l=t*a,u=e.V,m=e.H,f=dn*dn,p=-1;for(let c=0;c<s;c++){let b=l+c,h=(u[b]-n)*o,y=(m[b]-i)*r,g=h*h+y*y;g<f&&(f=g,p=b)}return p}function ia(e,t){if(e.T.dismiss(),e.Ki=t,t<0||!e.V||!e.H)return;let n=vm(e,t);if(!n)return;let i=isNaN(e.M)?0:e.M,o=isNaN(e.F)?0:e.F,r=n.B(e.V[t]+i,e.H[t]+o),s=e.W.beginPin();e.glyph.buildTooltipLines(e,t).then(a=>{e.W.isPinFresh(s)&&e.Ki===t&&a.length!==0&&e.T.pin(a,r,n)}),e.le=-1,e.Tn=-1,$e(e)}function vm(e,t){if(e.m&&e.w>0){let n=Math.floor(t/e.w),i=e.m.cells[n];if(i)return i.layout}return e.l}function oa(e){e.T.dismiss(),e.Ki=-1}var dn,ra=G(()=>{"use strict";tr();dn=24});var Dt,ir=G(()=>{"use strict";Dt=class{constructor(){d(this,"lines",null);d(this,"hoveredTarget",null);d(this,"Ji",0);d(this,"Qi",0)}beginHover(t){return this.lines=null,this.hoveredTarget=t,++this.Ji}commitHover(t,n){return t!==this.Ji?!1:(this.lines=n,!0)}clearHover(){this.lines=null,this.hoveredTarget=null,this.Ji++}beginPin(){return++this.Qi}isPinFresh(t){return t===this.Qi}invalidatePin(){this.Qi++}}});function j(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 fe=G(()=>{"use strict"});async function Li(e,t){let n=[];if(!e.Et||!e.Pe)return n;let i=e.Et[t];if(i<0)return n;if(e.L.length>0&&e.w>0){let s=Math.floor(t/e.w),a=e.L[s];a?.prefix&&n.push(a.prefix)}let o=await e.Pe.fetchRow(i),r=e.L.length>0&&e.w>0?e.L[Math.floor(t/e.w)]?.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 or=G(()=>{"use strict"});function Am(e,t,n,i,o){t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,i.C.point_size_px*o),i.b<i.p?t.uniform2f(e.u_color_range,i.b,i.p):t.uniform2f(e.u_color_range,0,0),i.nt<i.it?t.uniform2f(e.u_size_range,i.nt,i.it):t.uniform2f(e.u_size_range,0,0);let r=Math.min(i.C.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*o,i.C.point_size_px/r*o),i.C.point_size_px*r*o)}function sa(e,t,n,i){let o=n.gl;if(!t.ie)return!1;o.useProgram(e.program),Am(e,o,i,t,n.dpr),Ge(n,t.ie.texture,e.u_gradient_lut,0);let r=n.v.peek("a_position"),s=n.v.peek("a_color_value"),a=n.v.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 Bt,rr=G(()=>{"use strict";Lt();fe();or();Fo();So();Bt=class{constructor(){d(this,"name","point");d(this,"d",null)}ensureProgram(t,n){this.d||(this.d=j(n,"scatter",Pn,En,["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,i){let o=this.d;if(!o||!sa(o,t,n,i))return;let r=n.gl,s=Math.max(1,t.L.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,i,o){let r=this.d;if(!r||!sa(r,t,n,i))return;let s=t.U[o]??0;if(s<=0)return;let a=n.gl,l=t.w;a.drawArrays(a.POINTS,o*l,s)}buildTooltipLines(t,n){return Li(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6}}destroy(t){this.d=null}}});function J(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 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 Ti(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,i,o,r=0){if(n<0)return!0;let s=e.v.peek(i);if(!s)return!1;let a=e.gl;return a.bindBuffer(a.ARRAY_BUFFER,s.buffer),a.enableVertexAttribArray(n),a.vertexAttribPointer(n,o,a.FLOAT,!1,0,r*o*Float32Array.BYTES_PER_ELEMENT),t.setDivisor(n,1),!0}var Fe=G(()=>{"use strict"});function aa(e,t,n,i){let o=n.gl;if(!t.ie)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.C.line_width_px*r),t.b<t.p?o.uniform2f(e.u_color_range,t.b,t.p):o.uniform2f(e.u_color_range,0,0),Ge(n,t.ie.texture,e.u_gradient_lut,0);let s=J(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 la(e,t,n,i){let o=t.U[i]??0;if(o<2)return;let r=n.gl,s=t.w,a=2*Float32Array.BYTES_PER_ELEMENT,l=Float32Array.BYTES_PER_ELEMENT,u=n.v.peek("a_position"),m=n.v.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 p=i*s*l;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,l,p),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,l,p+l),J(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,o-1)}function ua(e,t){let{setDivisor:n}=J(t);n(e.a_start,0),n(e.a_end,0),n(e.a_color_start,0),n(e.a_color_end,0)}var Pt,sr=G(()=>{"use strict";Lt();Fe();fe();Le();Ro();Mo();Pt=class{constructor(){d(this,"name","line");d(this,"d",null)}ensureProgram(t,n){if(this.d)return;let i=j(n,"line",Dn,Bn,["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.d={...i,cornerBuffer:je(n.gl)}}draw(t,n,i){let o=this.d;if(!o||!aa(o,t,n,i))return;let s=Math.max(1,t.L.length);for(let a=0;a<s;a++)la(o,t,n,a);ua(o,n)}drawSeries(t,n,i,o){let r=this.d;r&&aa(r,t,n,i)&&(la(r,t,n,o),ua(r,n))}async buildTooltipLines(t,n){let i=[];if(!t.V||!t.H)return i;if(t.L.length>0&&t.w>0){let p=Math.floor(n/t.w),c=t.L[p];c&&i.push(c.prefix)}let o=t.V[n],r=t.H[n],s=t.Ue[t.Ve]||"",l=s==="date"||s==="datetime"?xe(o):me(o);i.push(`${t.Ve||"Row"}: ${l}`);let u=t.Ue[t.Ee]||"",f=u==="date"||u==="datetime"?xe(r):me(r);return i.push(`${t.Ee}: ${f}`),i}tooltipOptions(){return{crosshair:!0,highlightRadius:5}}destroy(t){let n=this.d;n?.cornerBuffer&&t.t&&t.t.gl.deleteBuffer(n.cornerBuffer),this.d=null}}});function Mm(e){switch(e){case"density":return Lm;case"extreme":return wm;case"signed":return Rm;case"mean":default:return Tm}}function ma(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 ar(e,t,n,i){return j(e,t,n,i,["u_projection","u_radius_ndc","u_intensity","u_color_range"],["a_corner","a_position","a_color_value"])}function Fm(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 fa(e){let t=e.v.peek("a_position"),n=e.v.peek("a_color_value");return!!t&&!!n}function Im(e,t){if(!e.s||e.Z)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.yt&&n.colorName===e.s&&n.colorIsString===e.Z)return{lo:n.lo,hi:n.hi};let i=Dm(e);return i?(t.robustBounds={lo:i.lo,hi:i.hi,dataCount:e.yt,colorName:e.s,colorIsString:e.Z},i):(t.robustBounds=null,null)}function Dm(e){if(!e.xt||e.yt<2)return null;let t=e.w,n=Math.max(1,e.L.length),i=Math.max(1,Math.ceil(e.yt/Sm)),o=[],r=e.xt;for(let m=0;m<n;m++){let f=e.U[m]??0,p=m*t;for(let c=0;c<f;c+=i){let b=r[p+c];Number.isFinite(b)&&o.push(b)}}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.p>e.b?{lo:e.b,hi:e.p}:null}var Lm,Tm,wm,Rm,Et,Sm,lr=G(()=>{"use strict";Lt();Fe();fe();or();Io();Do();Bo();Qr();ts();Po();Eo();Lm=0,Tm=1,wm=2,Rm=3,Et=class{constructor(){d(this,"name","density");d(this,"d",null)}ensureProgram(t,n){if(this.d){this.ensureHeatTarget(t,n);return}let i=n.gl,o=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let r=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,r),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),i.STATIC_DRAW);let{internalFormat:s,format:a,type:l,isFloat:u}=Fm(n),m=ma(i),f=i.createFramebuffer();this.d={splat:ar(n,"density-splat",yt,jn),extremeSplat:null,mrtSplat:null,resolve:j(n,"density-resolve",qn,Kn,["u_heat","u_extreme","u_gradient_lut","u_heat_max","u_color_mode"],["a_corner"]),quadCornerBuffer:o,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,i){let o=this.d;if(!o||!fa(n))return;let r=Math.max(1,t.L.length),s=t.w,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.d;if(!r||!fa(n))return;let s=t.U[o]??0;if(s<=0)return;let a=t.w;this.runSplatAndResolve(t,n,r,i,l=>l(o*a,s))}buildTooltipLines(t,n){return Li(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0}}destroy(t){let n=this.d;if(!n||!t.t){this.d=null;return}let i=t.t.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.d=null}ensureHeatTarget(t,n){let i=this.d;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=ma(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){return n.extremeSplat||(n.extremeSplat=ar(t,"density-extreme",yt,Zn)),n.extremeSplat}ensureMrtSplatProgram(t,n){return n.mrtSplat||(n.mrtSplat=ar(t,"density-mrt",es,ns)),n.mrtSplat}activeMode(t,n,i){let o=n.C.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.ie)return;let s=this.activeMode(n,t,i),a=t.b<t.p&&(!!t.s||t.L.length>1),l=0,u=0;if(s!=="density"&&a&&(l=t.b,u=t.p,!t.Z&&(s==="mean"||s==="extreme"))){let f=Im(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.C.gradient_intensity,n.dpr*t.C.gradient_radius_px,l,u,r):(this.runHeatPass(n,i,o,t.C.gradient_intensity,n.dpr*t.C.gradient_radius_px,l,u,r),s==="extreme"&&this.runExtremePass(n,i,o,t.C.gradient_intensity,n.dpr*t.C.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 p=u;p.blendEquation(p.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),p=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,p,i,o,r,n.heatWidth,n.heatHeight,s,a),this.bindAndDispatchInstanced(t,n,p,l),this.unbindSplatInstancing(t,p),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=J(t);s.setDivisor(i.a_corner,0),s.setDivisor(i.a_position,1),s.setDivisor(i.a_color_value,1);let a=t.v.peek("a_position"),l=t.v.peek("a_color_value");o((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,p=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,p,u*p),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let i=J(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.C.gradient_heat_max),r.uniform1i(s.u_color_mode,Mm(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),Ge(t,i.ie.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)}};Sm=5e4});var ft,wi,Ri,Mi,ur=G(()=>{"use strict";Qt();Es();Os();tr();ra();ir();rr();sr();lr();ft=class extends we{constructor(n){super();d(this,"glyph");d(this,"Ln","cartesian");d(this,"ie",null);d(this,"Ze","");d(this,"He","");d(this,"Ve","");d(this,"Ee","");d(this,"Uo",!1);d(this,"s","");d(this,"ne","");d(this,"fi","");d(this,"Z",!1);d(this,"Ge",!1);d(this,"he",!1);d(this,"tn",[]);d(this,"nn",[]);d(this,"Vo",new Map);d(this,"Ho",new Map);d(this,"ot",null);d(this,"rt",null);d(this,"L",[]);d(this,"be",1/0);d(this,"et",-1/0);d(this,"we",1/0);d(this,"tt",-1/0);d(this,"M",NaN);d(this,"F",NaN);d(this,"b",1/0);d(this,"p",-1/0);d(this,"nt",1/0);d(this,"it",-1/0);d(this,"Cn",1/0);d(this,"_n",-1/0);d(this,"vn",1/0);d(this,"An",-1/0);d(this,"ai",1/0);d(this,"li",-1/0);d(this,"ui",1/0);d(this,"mi",-1/0);d(this,"w",0);d(this,"U",[]);d(this,"zi",0);d(this,"V",null);d(this,"H",null);d(this,"xt",null);d(this,"Et",null);d(this,"Gt",null);d(this,"yt",0);d(this,"f",new Map);d(this,"W",new Dt);d(this,"Xi",null);d(this,"$i",null);d(this,"ji",null);d(this,"Yo",0);d(this,"en",new mi);d(this,"l",null);d(this,"le",-1);d(this,"Ki",-1);d(this,"Tn",-1);d(this,"m",null);d(this,"ge",null);d(this,"ye",null);d(this,"di",null);d(this,"Re",null);d(this,"pi",null);d(this,"bi",!1);d(this,"ci",null);d(this,"Zi",null);d(this,"qi",-1);this.glyph=n}colorScaleColumn(){return this.s||null}projectPoint(n,i){return[n,i]}renderBackground(n,i,o,r,s,a){}renderMapChrome(n,i,o,r){}tooltipCallbacks(){return{onHover:(n,i)=>nr(this,n,i),onLeave:()=>{this.le!==-1&&(this.le=-1,$e(this))},onPin:(n,i)=>{if(nr(this,n,i),this.le>=0){let o=this.le;ia(this,o),this.cr(o)}},onUnpin:()=>{this.emitUnselect()}}}async cr(n){if(!this.Et)return;let i=this.Et[n],o=this.R[1]||this.R[0]||"",r=[];if(this.L.length>0&&this.w>0){let s=Math.floor(n/this.w),a=this.L[s];a?.prefix&&this.D.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.t=n,o===0&&ks(this,n,i,r),s!==0&&(Ns(this,n,i,o,s,r),this.C.domain_mode==="expand"&&(this.Ge||(this.Cn=this.be,this._n=this.et),this.he||(this.vn=this.we,this.An=this.tt),this.ai=this.b,this.li=this.p,this.ui=this.nt,this.mi=this.it),await this.requestRender(n))}resetExpandedDomain(){this.Cn=1/0,this._n=-1/0,this.vn=1/0,this.An=-1/0,this.ai=1/0,this.li=-1/0,this.ui=1/0,this.mi=-1/0}Bt(n){n.uploadedCount===0&&this.yt===0||(this.t=n,ea(this,n))}destroyInternal(){this.glyph.destroy(this),this.ie=null,this.V=null,this.H=null,this.xt=null,this.Et=null,this.Gt=null,this.W.clearHover(),this.f.clear(),this.en.clear(),this.Xi=null,this.$i=null,this.ji=null,this.L=[],this.U=[],oa(this)}},wi=class extends ft{constructor(){super(new Bt)}},Ri=class extends ft{constructor(){super(new Pt)}},Mi=class extends ft{constructor(){super(new Et)}}});function Fl(e,t){if(t>Ml||t<-Ml)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 Sl(e,t,n){let i=1<<e,o=2*Oe/i,r=-Oe+t*o,s=r+o,a=Oe-n*o,l=a-o;return{xMin:r,yMin:l,xMax:s,yMax:a}}function Il(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let i=Math.log2(2*Oe/(t*e));return Math.max(0,Math.min(n,Math.floor(i)))}function Dl(e,t){let n=1<<t,i=2*Oe/n,o=Math.floor((e.xMin+Oe)/i),r=Math.floor((e.xMax+Oe)/i),s=Math.floor((Oe-e.yMax)/i),a=Math.floor((Oe-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 Oe,Ml,Vr=G(()=>{"use strict";Oe=Math.PI*6378137,Ml=85.0511287798066});var xo,Bl=G(()=>{"use strict";xo=class{constructor(t=256){d(this,"Ae",new Map);d(this,"er");this.er=t}get(t){let n=this.Ae.get(t);return n!==void 0&&(this.Ae.delete(t),this.Ae.set(t,n)),n}set(t,n,i){if(this.Ae.has(n)){let o=this.Ae.get(n);t.deleteTexture(o),this.Ae.delete(n)}for(this.Ae.set(n,i);this.Ae.size>this.er;){let o=this.Ae.keys().next().value;if(o===void 0)break;let r=this.Ae.get(o);t.deleteTexture(r),this.Ae.delete(o)}}has(t){return this.Ae.has(t)}dispose(t){for(let n of this.Ae.values())t.deleteTexture(n);this.Ae.clear()}}});function Ht(e,t,n,i){return`${e}/${t}/${n}/${i}`}var Co,Pl=G(()=>{"use strict";Co=class{constructor(){d(this,"Le",new Map);d(this,"tr",()=>{})}setOnLoad(t){this.tr=t}load(t,n,i,o){let r=Ht(t.id,n,i,o),s=this.Le.get(r);if(s)return s.promise;let a=new AbortController,l=t.urlFor(n,i,o),u=this.br(l,a.signal).then(m=>(this.Le.delete(r),m&&this.tr(),m)).catch(()=>(this.Le.delete(r),null));return this.Le.set(r,{promise:u,abort:a}),u}cancelAll(){for(let t of this.Le.values())t.abort.abort();this.Le.clear()}cancelExcept(t){for(let[n,i]of this.Le)t.has(n)||(i.abort.abort(),this.Le.delete(n))}async br(t,n){let i=await fetch(t,{signal:n});if(!i.ok)return null;let o=await i.blob();return await createImageBitmap(o)}}});var _o,El=G(()=>{"use strict";Vr();Bl();Pl();Go();Wo();fe();_o=class{constructor(){d(this,"i",null);d(this,"k",null);d(this,"d",new xo);d(this,"On",new Co);d(this,"Un",null);d(this,"nr",1);d(this,"ir",()=>{})}setOnTileLoad(t){this.ir=t,this.On.setOnLoad(t)}setSource(t,n){this.Un?.id!==n.id&&(this.d.dispose(t),this.On.cancelAll(),this.Un=n)}setAlpha(t){this.nr=Math.max(0,Math.min(1,t))}get source(){return this.Un}render(t,n,i,o,r,s){let a=this.Un;if(!a)return;this.hr(t);let l=this.i,u=this.k;if(!l||!u)return;let m=t.gl,f=t.dpr,p=Math.max(1,n.e.width*f),c=o.xMax-o.xMin;if(!isFinite(c)||c<=0)return;let b=c/p,h=Il(b,a.tileSize,a.maxZoom),y=Dl(o,h),g=new Set;for(let _ of y)g.add(Ht(a.id,_.z,_.x,_.y));this.On.cancelExcept(g),m.useProgram(l.program),m.uniformMatrix4fv(l.u_projection,!1,i),m.uniform1f(l.u_alpha,this.nr),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 _ of y)this.gr(m,l,a,_,r,s);x||m.disable(m.BLEND)}destroy(t){this.On.cancelAll(),this.d.dispose(t),this.k&&(t.deleteBuffer(this.k),this.k=null),this.i=null}gr(t,n,i,o,r,s){let a=Sl(o.z,o.x,o.y),l={xMin:a.xMin-r,xMax:a.xMax-r,yMin:a.yMin-s,yMax:a.yMax-s},u=Ht(i.id,o.z,o.x,o.y),m=this.d.get(u);if(m){this.or(t,n,m,l,[0,0],[1,1]);return}this.yr(t,i,o);for(let f=1;f<=6;f++){let p=o.z-f;if(p<0)return;let c=o.x>>f,b=o.y>>f,h=Ht(i.id,p,c,b),y=this.d.get(h);if(!y)continue;let g=1<<f,x=o.x-c*g,_=o.y-b*g,C=1/g,v=[x*C,_*C],A=[v[0]+C,v[1]+C];this.or(t,n,y,l,v,A);return}}or(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)}yr(t,n,i){let o=Ht(n.id,i.z,i.x,i.y);this.d.has(o)||this.On.load(n,i.z,i.x,i.y).then(r=>{if(!r)return;if(this.Un?.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.d.set(t,o,s),this.ir()})}hr(t){if(this.i&&this.k)return;let n=t.gl;this.i=j(t,"map-tile",Jn,Qn,["u_projection","u_extent_min","u_extent_max","u_uv_min","u_uv_max","u_tile","u_alpha"],["a_corner"]);let i=n.createBuffer();i&&(n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.k=i)}}});function Qf(){return new Mn("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 ec(){return new Mn("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 tc(){return new Mn("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 Hr(e){switch(e){case"carto-dark-matter":return ec();case"carto-voyager":return tc();case"carto-positron":default:return Qf()}}var Mn,Gl=G(()=>{"use strict";Mn=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 vo={};Ql(vo,{MapChart:()=>Yt,MapDensityChart:()=>Xr,MapLineChart:()=>zr,MapScatterChart:()=>Yr});var Yt,Yr,zr,Xr,Ao=G(()=>{"use strict";ur();rr();sr();lr();El();Gl();Vr();ut();Yt=class extends ft{constructor(n){super(n);d(this,"Ln","map");d(this,"Je");this.Je=new _o,this.Je.setOnTileLoad(()=>{this.t&&this.requestRender(this.t)})}projectPoint(n,i){return Fl(n,i)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.t&&this.Je.setSource(this.t.gl,Hr(n.map_tile_provider)),this.Je.setAlpha(n.map_tile_alpha)}renderBackground(n,i,o,r,s,a){this.Je.source||(this.Je.setSource(n.gl,Hr(this.C.map_tile_provider)),this.Je.setAlpha(this.C.map_tile_alpha)),this.Je.render(n,i,o,r,s,a)}renderMapChrome(n,i,o,r){if(!n)return;let s=re(n,r);if(!s)return;let a=this.Je.source?.attribution??"";if(!a)return;let l=i.e;s.save(),s.font=`10px ${o.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(a).width,p=12,c=l.x+l.width-4,b=l.y+l.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(c-f-u*2,b-p-u,f+u*2,p+u),s.fillStyle=o.Te,s.fillText(a,c-u,b-u/2),s.restore()}destroyInternal(){this.t&&this.Je.destroy(this.t.gl),super.destroyInternal()}},Yr=class extends Yt{constructor(){super(new Bt)}},zr=class extends Yt{constructor(){super(new Pt)}},Xr=class extends Yt{constructor(){super(new Et)}}});typeof window>"u"&&(globalThis.window={});var Zt=class{constructor(t){d(this,"dt");d(this,"o",new Map);d(this,"mn",0);d(this,"Vn",0);this.dt=t}get totalCapacity(){return this.mn}get maxCapacity(){return this.Vn}set maxCapacity(t){this.Vn=t}ensureCapacity(t){this.mn=this.Vn>0?Math.min(t,this.Vn):t}peek(t){return this.o.get(t)}getOrCreate(t,n,i){let o=this.mn*n*i,r=this.o.get(t);if(r&&r.byteCapacity>=o)return r;let s=this.dt;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.dt,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.mn}, 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.dt.deleteBuffer(t.buffer);this.o.clear(),this.mn=0}};var qt=class{constructor(t){d(this,"dt");d(this,"Hn",new Map);this.dt=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,i){let o=this.Hn.get(t);if(o)return o;let r=this.dt,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.Hn.set(t,o),o}releaseAll(){for(let t of this.Hn.values())this.dt.deleteProgram(t);this.Hn.clear()}};var Sn="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 In="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.);}";Ro();Mo();Fo();So();var Gn="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var Wn="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 Ve="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 kn="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 Nn="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 On="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 Un="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var Vn="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 Hn="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 Yn="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 zn="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var Xn="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 $n="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";Io();Do();Bo();Po();Eo();Go();Wo();var ko=[{name:"bar",vert:Sn,frag:In},{name:"line",vert:Dn,frag:Bn},{name:"scatter",vert:Pn,frag:En},{name:"bar-area",vert:Gn,frag:Wn},{name:"bar-scatter",vert:kn,frag:Nn},{name:"line-uniform",vert:Ue,frag:Ve},{name:"candlestick-body",vert:On,frag:Un},{name:"heatmap",vert:Vn,frag:Hn},{name:"sunburst-arc",vert:Yn,frag:zn},{name:"treemap",vert:Xn,frag:$n},{name:"density-splat",vert:yt,frag:jn},{name:"density-extreme",vert:yt,frag:Zn},{name:"density-resolve",vert:qn,frag:Kn},{name:"map-tile",vert:Jn,frag:Qn}];var Su=1,it=class{constructor(t,n={}){d(this,"id");d(this,"canvas");d(this,"gl");d(this,"isWebGL2");d(this,"shaders");d(this,"vo");d(this,"Ao",null);d(this,"Xt");d(this,"pt",!1);d(this,"Yn",new Set);this.id=Su++,this.canvas=t,this.Xt=n.precompile??!1;let i=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(i)this.gl=i,this.isWebGL2=!0;else{let o=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!o)throw new Error("WebGL is not supported");this.gl=o,this.isWebGL2=!1}this.shaders=new qt(this.gl),this.Xt&&this.shaders.precompile(ko),this.vo=this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),this.isWebGL2||(this.Ao=this.gl.getExtension("ANGLE_instanced_arrays")),t.addEventListener("webglcontextlost",o=>{this.pt||o.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this.shaders.releaseAll(),this.shaders=new qt(this.gl),this.Xt&&this.shaders.precompile(ko);for(let o of this.Yn)o()})}resetVertexArrayState(){let t=this.gl;for(let n=0;n<this.vo;n++)t.disableVertexAttribArray(n),this.isWebGL2?t.vertexAttribDivisor(n,0):this.Ao?.vertexAttribDivisorANGLE(n,0)}onRestore(t){return this.Yn.add(t),()=>this.Yn.delete(t)}isContextLost(){return this.pt||this.gl.isContextLost()}get destroyed(){return this.pt}destroy(){this.pt=!0,this.Yn.clear(),this.shaders.releaseAll();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext()}};var Kt=class{constructor(t,n={}){d(this,"I");d(this,"zn");d(this,"Lo");d(this,"o");d(this,"Xn",0);d(this,"Ei",0);d(this,"Gi",0);d(this,"Wi",1);d(this,"pt",!1);d(this,"$n",null);d(this,"bt",null);d(this,"fn",null);d(this,"$t",null);t instanceof it?(this.I=t,this.zn=!1):(this.I=new it(t,{precompile:n.precompile??!1}),this.zn=!0),this.o=new Zt(this.I.gl),this.Lo=this.I.onRestore(()=>{this.o.releaseAll(),this.o=new Zt(this.I.gl),this.Xn=0})}get gl(){return this.I.gl}get backendId(){return this.I.id}isContextLost(){return this.pt||this.I.isContextLost()}get isWebGL2(){return this.I.isWebGL2}get shaders(){return this.I.shaders}get v(){return this.o}get uploadedCount(){return this.Xn}set uploadedCount(t){this.Xn=t}resize(t,n,i){this.Ei=t,this.Gi=n,this.Wi=i;let o=Math.round(t*i),r=Math.round(n*i),s=this.I.canvas;(s.width!==o||s.height!==r)&&(s.width=o,s.height=r,this.I.gl.viewport(0,0,o,r))}requestResize(t,n,i){this.$t={cssWidth:t,cssHeight:n,dpr:i}}applyPendingResize(){if(!this.$t)return!1;let{cssWidth:t,cssHeight:n,dpr:i}=this.$t;return this.$t=null,this.resize(t,n,i),!0}beginFrame(){if(this.zn){this.applyPendingResize();return}let t=this.$t;this.$t=null,t?this.resize(t.cssWidth,t.cssHeight,t.dpr):this.resize(this.Ei,this.Gi,this.Wi);let n=this.I.gl,i=this.I.canvas;n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,i.width,i.height),n.disable(n.SCISSOR_TEST),n.disable(n.DEPTH_TEST),this.I.resetVertexArrayState()}get cssWidth(){return this.Ei}get cssHeight(){return this.Gi}get dpr(){return this.Wi}clear(){this.I.gl.clearColor(0,0,0,0),this.I.gl.clear(this.I.gl.COLOR_BUFFER_BIT|this.I.gl.DEPTH_BUFFER_BIT),this.Xn=0}setFrameCallback(t){this.$n=t}endFrame(){if(!this.$n||this.isContextLost())return;let t=this.I.canvas;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.$n(n)}async awaitGpuFence(){if(!this.I.isWebGL2){this.I.gl.finish();return}let t=this.I.gl,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}if(i=0,await this.lr(),this.pt)return}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.o.ensureCapacity(t)}lr(){return this.bt||(this.bt=new MessageChannel,this.bt.port1.start()),new Promise(t=>{let n=this.bt;this.fn=t,n.port1.addEventListener("message",()=>{this.fn=null,t()},{once:!0}),n.port2.postMessage(null)})}destroy(){if(this.pt=!0,this.$n=null,this.Lo(),this.o.releaseAll(),this.fn){let t=this.fn;this.fn=null,t()}this.bt&&(this.bt.port1.close(),this.bt.port2.close(),this.bt=null),this.zn&&this.I.destroy()}};var ei=class{constructor(t,n={}){d(this,"To");d(this,"Xt");d(this,"jt",[]);d(this,"wo",0);this.To=Math.max(1,t),this.Xt=n.precompile??!1}acquire(){let t;if(this.jt.length<this.To)t=this.Ro(),this.jt.push(t);else{let n=this.wo%this.jt.length;this.wo++,this.jt[n].isContextLost()&&(this.jt[n]=this.Ro()),t=this.jt[n]}return t}Ro(){let t=new OffscreenCanvas(1,1);return new it(t,{precompile:this.Xt})}};ti();ti();function rs(e,t,n,i){let{controller:o,layout:r}=e,s=r.e,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 p=o.getVisibleDomain(),c=p.xMin+(t-s.x)/s.width*(p.xMax-p.xMin),b=p.yMax-(n-s.y)/s.height*(p.yMax-p.yMin),h=o.baseXRange,y=o.baseYRange;f!=="x"&&h>0&&(o.normTranslateX+=(l-c)/h),f!=="y"&&y>0&&(o.normTranslateY+=(u-b)/y)}function ss(e,t,n){let{controller:i,layout:o}=e,r=i.getVisibleDomain(),s=o.e,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 ni=class{constructor(t){d(this,"Zt");this.Zt=t}pin(t,n,i){this.Zt({kind:"pinTooltip",lines:t,pos:n,bounds:i})}dismiss(){this.Zt({kind:"dismissTooltip"})}setCursor(t){this.Zt({kind:"setCursor",cursor:t})}emitUserClick(t){this.Zt({kind:"userClick",detail:t})}emitUserSelect(t){this.Zt({kind:"userSelect",selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig})}};ur();Qt();var Fi=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.zo(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.zo(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}zo(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 ca(e,t){let n=[],i=t;for(;e.parent[i]!==-1;)n.push(e.name[i]),i=e.parent[i];return n.reverse()}ir();function Si(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var Gt=class extends we{constructor(){super(...arguments);d(this,"ne","");d(this,"s","");d(this,"xe","empty");d(this,"r",new Fi);d(this,"X",-1);d(this,"_",-1);d(this,"ue",[]);d(this,"Wt",new Map);d(this,"gi",0);d(this,"b",1/0);d(this,"p",-1/0);d(this,"f",new Map);d(this,"$",null);d(this,"oe",0);d(this,"W",new Dt)}colorScaleColumn(){return this.R[1]||null}};en();mn();Le();function ct(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 Wt(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 Bm(e,t,n){return!t||e==null||Number.isNaN(e)?"":n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?xe(e):n==="integer"?String(e|0):n==="float"?me(e):String(e)}function mr(e,t,n){let i=e.values,o=e.valid,r=new Int32Array(t),s=[""],a=new Map;a.set("",0);let l=new Map;for(let u=0;u<t;u++){if(!(o?!!(o[u>>3]>>(u&7)&1):!0)){r[u]=0;continue}let f=i[u],p=l.get(f);if(p===void 0){let c=Bm(f,!0,n);p=a.get(c),p===void 0&&(p=s.length,s.push(c),a.set(c,p)),l.set(f,p)}r[u]=p}return{indices:r,dictionary:s}}function kt(e,t,n,i=[],o){if(o?.mode==="numeric"){let m=e.get("__ROW_PATH_0__");if(m&&m.type!=="string"&&m.values){let f=0,p=m.values,c=m.valid;for(;f<t;){let b=c?!!(c[f>>3]>>(f&7)&1):!0,h=p[f];if(b&&h!=null&&!Number.isNaN(h))break;f++}return{rowPaths:[],numCategories:Math.max(0,t-f),rowOffset:f}}}let r=[];for(let m=0;;m++){let f=e.get(`__ROW_PATH_${m}__`);if(!f)break;if(f.type==="string"&&f.indices&&f.dictionary)r.push({indices:f.indices,dictionary:f.dictionary});else if(f.values){let p=i[m]??"string";r.push(mr(f,t,p))}else break}let s=0;if(n>0&&r.length>0)for(;s<t;){let m=!1;for(let f of r){let p=f.dictionary[f.indices[s]];if(p!=null&&p!==""){m=!0;break}}if(m)break;s++}let a=Math.max(0,t-s),l=r.length;return{rowPaths:n>0&&l>0?r.map((m,f)=>{let p=new Array(a),c=0;for(let h=0;h<a;h++){let y=m.dictionary[m.indices[h+s]]??"";p[h]=y,y.length>c&&(c=y.length)}let b=f===l-1?[]:gi(m.indices,m.dictionary,s,s+a).map(h=>({startIdx:h.startIdx-s,endIdx:h.endIdx-s,label:h.label}));return{labels:p,runs:b,maxLabelChars:c}}):[],numCategories:a,rowOffset:s}}function fr(e,t,n,i){if(e.length===0)return null;for(let p of e)if(p.type!=="string")return null;let o=Math.max(0,t-n),r=[],s=new Map,a=e.map(()=>new Int32Array(o)),l=p=>{let c=s.get(p);return c===void 0&&(c=r.length,r.push(p),s.set(p,c)),c};for(let p=0;p<e.length;p++){let c=e[p].data,b=a[p];for(let h=0;h<o;h++){let y=h+n,g;if(!c)g="(null)";else{let x=c.valid;if(!(x?!!(x[y>>3]>>(y&7)&1):!0))g="(null)";else if(c.indices&&c.dictionary)g=c.dictionary[c.indices[y]]??"(null)";else if(c.values){let C=c.values[y];g=C==null?"(null)":String(C)}else g="(null)"}b[h]=l(g)}}let u=0;for(let p of r)p.length>u&&(u=p.length);return{domain:{levels:[{labels:r.slice(),runs:[],maxLabelChars:u}],numRows:r.length,levelLabels:[i]},perColumnSlots:a}}function pn(e){e.r.reset(),e.Wt.clear();let t=e.r.allocate();e.r.name[t]="Total",e.r.depth[t]=0,e.r.parent[t]=-1,e.Wt.set(t,new Map),e.X=t,e._=t,e.ue=[t],e.gi=0,e.b=1/0,e.p=-1/0,e.f.clear(),e.$=null,e.oe=0}function Pm(e,t,n){let i=e.Wt.get(t);i||(i=new Map,e.Wt.set(t,i));let o=i.get(n);if(o!==void 0)return o;let r=e.r.allocate();return e.r.name[r]=n,e.r.appendChild(t,r),i.set(n,r),r}function Ii(e,t,n,i,o,r,s){let a=e.X,l=t.length;for(let u=0;u<l;u++){let m=Pm(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(i)||(e.r.colorValue[m]=i,i<e.b&&(e.b=i),i>e.p&&(e.p=i)),o&&(e.r.colorLabel[m]=o,e.f.has(o)||e.f.set(o,e.f.size))),a=m}}function pa(e,t){let n=e.valid;return!n||!!(n[t>>3]>>(t&7)&1)}function Di(e,t){return e?.values?pa(e,t)?e.values[t]:0:1}function Bi(e,t,n){let i=NaN,o="";return!t||!pa(t,n)?{colorValue:i,colorLabel:o}:(e.xe==="numeric"&&t.values?i=t.values[n]:e.xe==="series"&&t.indices&&t.dictionary&&(o=t.dictionary[t.indices[n]]),{colorValue:i,colorLabel:o})}function da(e,t){if(e.xe!=="series"||!t?.dictionary)return;let n=t.dictionary;for(let i=0;i<n.length;i++){let o=n[i];e.f.has(o)||e.f.set(o,e.f.size)}}function Em(e,t){if(e.D.length===0)return null;let n=e.ne?[e.ne]:[],i=e.s?[e.s]:[],o=He(t,n,i);return o.length===0?null:o.map(r=>({prefix:r.prefix,sizeCol:e.ne?t.get(`${r.prefix}|${e.ne}`)??null:null,colorCol:e.s?t.get(`${r.prefix}|${e.s}`)??null:null}))}function bn(e,t){let n=[];for(let h=0;;h++){let y=t.get(`__ROW_PATH_${h}__`);if(!y)break;if(y.type==="string"&&y.indices&&y.dictionary)n.push({indices:y.indices,dictionary:y.dictionary,valid:y.valid});else if(y.values){let g=e.g[h],x=e.gt[g]??"string";n.push(mr(y,y.values.length,x))}else break}let i=n.length>0,o=e.g.length,r=Em(e,t),s=r!==null,a=e.ne?t.get(e.ne):null,l=e.s?t.get(e.s):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)da(e,h.colorCol);else da(e,l);let f=e.gi,p=s&&i?o+1:o;if(!i){let h;for(let[g,x]of t){if(g.startsWith("__")||s&&g.includes("|"))continue;let _=g.lastIndexOf("|"),C=_===-1?g:g.substring(_+1);if(!(C===e.ne||C===e.s)&&x.type==="string"&&x.indices&&x.dictionary){h=x;break}}let y=s?r:null;for(let g=0;g<m;g++){let x=h?.indices&&h?.dictionary?h.dictionary[h.indices[g]]:`Row ${f+g}`;if(y)for(let _ of y){let C=Di(_.sizeCol,g),{colorValue:v,colorLabel:A}=Bi(e,_.colorCol,g);Ii(e,[_.prefix,x],C,v,A,f+g,p)}else{let _=Di(a,g),{colorValue:C,colorLabel:v}=Bi(e,l,g);Ii(e,[x],_,C,v,f+g,p)}}e.gi=f+m;return}let c=s?1:0,b=new Array(n.length+c);for(let h=0;h<m;h++){let y=0;for(let g=0;g<n.length;g++){let x=n[g];if(x.valid&&!(x.valid[h>>3]>>(h&7)&1))break;let _=x.dictionary[x.indices[h]];if(!_&&_!=="0")break;b[c+y++]=_}if(y!==0)if(s)for(let g of r){b[0]=g.prefix;let x=b.slice(0,y+1),_=Di(g.sizeCol,h),{colorValue:C,colorLabel:v}=Bi(e,g.colorCol,h);Ii(e,x,_,C,v,f+h,p)}else{let g=b.slice(0,y),x=Di(a,h),{colorValue:_,colorLabel:C}=Bi(e,l,h);Ii(e,g,x,_,C,f+h,p)}}e.gi=f+m}function hn(e){let t=e.r,n=t.value,i=t.size,o=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.X,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){let m=i[l];n[l]=m>0?m:0}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.X,m=!0;for(let f of l){let c=e.Wt.get(u)?.get(f);if(c===void 0){m=!1;break}u=c}if(m&&t.firstChild[u]!==-1){e._=u,Pi(e,u);return}}e._=e.X,e.ue=[e.X]}function Pi(e,t){let n=[],i=t;for(;i!==-1;)n.unshift(i),i=e.r.parent[i];e.ue=n}var Gm=1,cr=14,ba=1,ha=4;function Ei(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)<ha)return;let m=e.depth[t]-s,f=l&&m===1&&e.firstChild[t]!==-1,p=f?cr:ba,c=f?Gm:ba,b=e.x0[t]+c,h=e.y0[t]+p,y=e.x1[t]-c,g=e.y1[t]-c;if(y<=b||g<=h)return;let x=0;for(let _=e.firstChild[t];_!==-1;_=e.nextSibling[_])e.value[_]>0&&(a[x++]=_);x!==0&&gn(e,a,0,x,b,h,y,g,s,a.subarray(x),l)}function gn(e,t,n,i,o,r,s,a,l,u,m){let f=i-n;if(f===0)return;if(f===1){Ei(e,t[n],o,r,s,a,l,u,m);return}let p=0;for(let v=n;v<i;v++)p+=e.value[t[v]];let c=p/2,b=0,h=n+1,y=1/0;for(let v=n;v<i-1;v++){b+=e.value[t[v]];let A=Math.abs(b-c);A<y&&(y=A,h=v+1)}let g=0;for(let v=n;v<h;v++)g+=e.value[t[v]];let x=g/p,_=s-o,C=a-r;if(_>=C){let v=Math.round(o+_*x);gn(e,t,n,h,o,r,v,a,l,u,m),gn(e,t,h,i,v,r,s,a,l,u,m)}else{let v=Math.round(r+C*x);gn(e,t,n,h,o,r,s,v,l,u,m),gn(e,t,h,i,o,v,s,a,l,u,m)}}function ga(e,t,n,i){e.oe=dr(e,t,n,i,0)}function dr(e,t,n,i,o){let r=e.r,s=r.x0,a=r.y0,l=r.x1,u=r.y1,m=r.depth,f=r.firstChild,p=r.nextSibling,c=r.value;(!e.$||e.$.length<r.count)&&(e.$=new Int32Array(r.count));let b=e.$,h=o,y=new Int32Array(128);y[0]=t;let g=1;for(;g>0;){g--;let x=y[g];if(c[x]<=0||(m[x]>=i&&(b[h++]=x),m[x]-i>=n))continue;let _=l[x]-s[x],C=u[x]-a[x];if(!(_*C<ha))for(let v=f[x];v!==-1;v=p[v]){if(g>=y.length){let A=new Int32Array(y.length*2);A.set(y),y=A}y[g++]=v}}return h}on();At();Ce();function Gi(e,t,n){return .299*e+.587*t+.114*n}function Wm(e,t){let n=Te(e,t);return[n[0],n[1],n[2]]}function yn(e,t,n,i){let o=e.r,r=o.colorValue[t];if(e.xe==="numeric"&&!isNaN(r)&&e.p>e.b)return Wm(n,rt(r,e.b,e.p));let s=e.f.get(o.colorLabel[t])??0;return i[s%i.length]??[0,0,0]}function Wi(e,t,n,i,o){let r=yn(e,t,n,i),s=e.r.sizeSign[t]<0?o:1;return[r[0],r[1],r[2],s]}fe();function ki(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.Ct=!0);let u=t.getContext("2d");if(u){if(e.Ct){e.me?.close(),e.me=null,e.Ct=!1;let m=++e.wn;r(u),createImageBitmap(t).then(f=>{e.wn===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())}}hi();Ye();Ci();function ya(e,t,n,i,o,r,s,a){if(n.length===0)return;let{Qn:l,Io:u,So:m}=t;e.font=`11px ${a}`;let f=16,p=8,c=0;for(let x of n){let _=e.measureText(x).width;_>c&&(c=_)}let b=c+p*2,h=n.length*f+p*2-4,y=i+12,g=o-h-8;y+b>r&&(y=i-b-12),y<0&&(y=4),g<0&&(g=o+12),g+h>s&&(g=s-h-4),e.fillStyle=l,e.strokeStyle=m,e.lineWidth=1,e.beginPath(),e.roundRect(y,g,b,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],y+p,g+p+x*f)}var xa=24,km=8,Ca=12,_a=2,va=" \\u203A ";function Ni(e,t,n,i,o){e.Ye=[];let r=e.A().Qn;t.fillStyle=r,t.fillRect(0,0,n,xa),t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let s=km,a=e.r;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 p=t.measureText(f).width;t.fillText(f,s,Ca),e.Ye.push({nodeId:u,x0:s-_a,y0:0,x1:s+p+_a,y1:xa}),s+=p,m||(t.fillText(va,s,Ca),s+=t.measureText(va).width)}}function Oi(e,t,n,i,o,r,s,a){let l=e.W.hoveredTarget===n?e.W.lines??[]:[];l.length!==0&&ya(t,e.A(),l,i,o,r,s,a)}function Ui(e,t,n,i,o,r,s,a=null){e.xe==="series"&&e.f.size>1?a?cn(t,a,e.f,n,o):xi(t,Aa(r,s),e.f,n,o):e.xe==="numeric"&&e.b<e.p&&It(t,Aa(r,s),{min:e.b,max:e.p,label:e.s},i,o,e.getColumnFormatter(e.s,"value"))}function Aa(e,t){return new ne(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0})}function La(e,t){if(e._===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.r,s=e.D.length>0&&e.G.facet_mode==="grid",a=e.ue.length>1?28:0,u=(e.xe==="series"?e.f.size>1:e.xe==="numeric"&&e.b<e.p)?90:0,m=new Int32Array(Math.max(r.count,64));if(s)Nm(e,m,i,o,a,u);else{e.m=null;let b=r.depth[e._];Ei(r,e._,0,a,i-u,o,b,m,e.yi),ga(e,e._,100,b),br(e);let h=e.We,y=e.ze;for(let g=0;g<e.oe;g++)h[g]=b,y[g]=e._}if(!e.i){let b=j(t,"treemap",Xn,$n,["u_resolution"],["a_position","a_color"]);e.i=b.program,e.S=b}let f=e.A(),p=f.O,c=de(f.Be,p,Math.max(1,e.f.size));if(e.j){let b=e.j.getContext("2d");b&&b.clearRect(0,0,e.j.width,e.j.height)}e.Ct=!0,Om(e,n,p,c,f.ti),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.S.u_resolution,i,o),n.bindBuffer(n.ARRAY_BUFFER,e.kt),n.enableVertexAttribArray(e.S.a_position),n.vertexAttribPointer(e.S.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Nt),n.enableVertexAttribArray(e.S.a_color),n.vertexAttribPointer(e.S.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.eo),e.pe(()=>Nt(e))}function Nm(e,t,n,i,o,r){let s=e.r,a=[],l=[];for(let b=s.firstChild[e.X];b!==-1;b=s.nextSibling[b])s.value[b]<=0||(a.push(b),l.push(s.name[b]));let u=Math.max(1,i-o),m=Math.max(1,n-r),f=Re(l,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.G.facet_padding});e.m=f,br(e);let p=e.We,c=0;for(let b=0;b<a.length;b++){let h=a[b],y=f.cells[b];if(!y)continue;let g=s.name[h],x=e.st.get(g)??h,_=s.depth[x],C=y.layout.e;Ei(s,x,C.x,C.y+o,C.x+C.width,C.y+o+C.height,_,t,e.yi);let v=dr(e,x,100,_,c);p.length<v&&br(e);let A=e.We,T=e.ze;for(let L=c;L<v;L++)A[L]=_,T[L]=x;c=v}e.oe=c}function br(e){let t=e.$?.length??e.r.count;(!e.We||e.We.length<t)&&(e.We=new Int32Array(t)),(!e.ze||e.ze.length<t)&&(e.ze=new Int32Array(t))}function Om(e,t,n,i,o){let r=e.r,s=e.$,a=e.oe,l=e.We,u=e.ze,m=y=>l?l[y]:r.depth[e._],f=y=>u?u[y]:e._,p=0;for(let y=0;y<a;y++){let g=s[y];if(g===f(y))continue;let x=r.x1[g]-r.x0[g],_=r.y1[g]-r.y0[g];x<1||_<1||(r.firstChild[g]===-1?p++:r.depth[g]-m(y)===1&&(p+=2))}let c=new Float32Array(p*6*2),b=new Float32Array(p*6*4),h=0;for(let y=0;y<a;y++){let g=s[y];if(g===f(y))continue;let x=r.x0[g],_=r.y0[g],C=r.x1[g],v=r.y1[g],A=C-x,T=v-_;if(!(A<1||T<1)){if(r.firstChild[g]===-1){let L=Wi(e,g,n,i,o);h=pr(c,b,h,x,_,C-1,v-1,L)}else if(r.depth[g]-m(y)===1){let w=[.25,.25,.25,1];h=pr(c,b,h,x,v-1,C,v,w),h=pr(c,b,h,C-1,_,C,v,w)}}}e.eo=h,e.kt||(e.kt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.kt),t.bufferData(t.ARRAY_BUFFER,c.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,b.subarray(0,h*4),t.DYNAMIC_DRAW)}function pr(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 Nt(e){Um(e),e.presentOverlay()}function Um(e){if(!e.c||e._===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t,r=e.re!==-1?e.re:e.P;ki(e,e.c,n,i,o,s=>Vm(e,s,n,i,o),r!==-1?s=>{let a=e.A(),{fontFamily:l}=a,u=e.r;Hm(s,u,r);let m=e.$,f=e.oe,p=e.We,c=e.ze;for(let b=0;b<f;b++){let h=m[b],y=c?c[b]:e._;if(h===y||u.firstChild[h]===-1)continue;let g=u.x1[h]-u.x0[h],x=u.y1[h]-u.y0[h],_=p?p[b]:u.depth[e._],C=u.depth[h]-_;C===1?Vi(s,u,h,g,x,a,!e.yi):C===2&&Vi(s,u,h,g,x,a,!0)}if(u.firstChild[r]===-1){let b=a.O,h=de(a.Be,b,Math.max(1,e.f.size)),y=u.x1[r]-u.x0[r],g=u.y1[r]-u.y0[r];Ta(e,s,r,y,g,l,b,h,!0)}e.re===-1&&e.P!==-1&&Ym(e,s,e.P,i,o,l)}:null)}function Vm(e,t,n,i,o){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Te:l}=s,u=s.O,m=de(s.Be,u,Math.max(1,e.f.size)),f=e.r,p=e.$,c=e.oe,b=e.We,h=e.ze;for(let y=0;y<c;y++){let g=p[y],x=h?h[y]:e._;if(g===x||f.firstChild[g]!==-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g];Ta(e,t,g,_,C,a,u,m)}for(let y=0;y<c;y++){let g=p[y],x=h?h[y]:e._;if(g===x||f.firstChild[g]===-1)continue;let _=f.x1[g]-f.x0[g],C=f.y1[g]-f.y0[g],v=b?b[y]:f.depth[e._],A=f.depth[g]-v;A===1?Vi(t,f,g,_,C,s,!e.yi):A===2&&Vi(t,f,g,_,C,s,!0)}if(e.ue.length>1&&Ni(e,t,i,a,l),Ui(e,r,m,u,s,i,o),e.m){t.font=`11px ${a}`,t.fillStyle=l,t.textAlign="center",t.textBaseline="top";for(let y of e.m.cells){let g=y.layout.e;t.fillText(y.label,g.x+g.width/2,g.y-14)}}t.restore()}function Ta(e,t,n,i,o,r,s,a,l=!1){if(i<30||o<14)return;let p=e.r,c=yn(e,n,s,a),b=Gi(c[0],c[1],c[2]),h=l?b>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":b>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",y=Math.min(11,Math.floor(o/2));if(y<7)return;t.font=`${y}px ${r}`;let g=i-8,x=y*1.3,_=Math.max(1,Math.floor((o-8)/x)),C=Xs(t,p.name[n],g,_);if(C.length===0)return;let v=C.length*x,A=p.y0[n]+(o-v)/2+x/2;t.fillStyle=h,t.textAlign="center",t.textBaseline="middle";let T=p.x0[n]+i/2;for(let L=0;L<C.length;L++)t.fillText(C[L],T,A+L*x)}function Vi(e,t,n,i,o,{fontFamily:r,Te: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 p=12;e.font=`${p}px ${r}`;let c=f,b=i-16;if(e.measureText(c).width>b){for(;c.length>1;)if(c=c.slice(0,-1),e.measureText(c+"\\u2026").width<=b){c+="\\u2026";break}}if(c.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,i,o),e.clip();let y=u+i/2,g=m+o/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(c,y,g),e.fillStyle=a,e.fillText(c,y,g),e.restore()}else{if(i<40||o<22)return;let p=11;e.font=`${p}px ${r}`;let c=f,b=i-10;if(e.measureText(c).width>b){for(;c.length>1;)if(c=c.slice(0,-1),e.measureText(c+"\\u2026").width<=b){c+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(c,u+5,m+4),e.globalAlpha=1}}function Hm(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 Ym(e,t,n,i,o,r){let s=e.r,a=(s.x0[n]+s.x1[n])/2,l=(s.y0[n]+s.y1[n])/2;Oi(e,t,n,a,l,i,o,r)}async function ke(e,t,n){let i=e.r,o=ca(i,t),r=e.D.length>0&&e.G.facet_mode==="grid",s=r?o.slice(0,e.D.length):[],a=r?o.slice(e.D.length,e.D.length+e.g.length):o.slice(0,e.g.length),l=n==="leaf"?i.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:l!=null&&l>=0?l:null,columnName:e.ne,groupByValues:a,splitByValues:s})}async function dt(e,t){let n=e.r,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.ne,"value");if(i.push(`Value: ${s(n.value[t])}`),e.s&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.s,"value");i.push(`${e.s}: ${u(n.colorValue[t])}`)}let a=n.leafRowIdx[t];if(n.firstChild[t]===-1&&a!==-1&&e.Pe){let u=await e.Pe.fetchRow(a);for(let[m,f]of u)f!=null&&(m===e.s&&!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 Hi(e,t,n,i){e.T.dismiss(),e.re=t;let o=e.t?.cssWidth??0,r=e.t?.cssHeight??0;dt(e,t).then(s=>{e.re===t&&s.length!==0&&e.T.pin(s,{px:n.cx,py:n.cy},{cssWidth:o,cssHeight:r})}),e.P=-1,i()}function Yi(e){e.T.dismiss(),e.re=-1}function zi(e,t,n){let i=e.r;if(e.D.length>0&&e.G.facet_mode==="grid"){let o=t;for(;o!==-1&&i.parent[o]!==e.X;)o=i.parent[o];o!==-1&&e.st.set(i.name[o],t),e.P=-1,n();return}e._=t,Pi(e,t),e.P=-1,n()}function hr(e,t,n){let i=e.r,o=i.x0,r=i.y0,s=i.x1,a=i.y1,l=i.depth,u=i.firstChild,m=e.$,f=e.oe,p=e.We,c=e.ze,b=-1,h=1/0,y=-1,g=1/0,x=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let _=0;_<f;_++){let C=m[_],v=c?c[_]:e._;if(C===v||!(t>=o[C]&&t<=s[C]&&n>=r[C]&&n<=a[C]))continue;let A=(s[C]-o[C])*(a[C]-r[C]);if(u[C]!==-1){A<g&&(g=A,y=C);let T=p?p[_]:l[e._],L=l[C]-T;if(L===1&&n<=r[C]+cr&&(x=C),L===2){let w=s[C]-o[C],F=a[C]-r[C];if(w>=60&&F>=30){let I=r[C]+F/2,S=o[C]+w/2;Math.abs(n-I)<10&&Math.abs(t-S)<w*.4&&(x=C)}}}else A<h&&(h=A,b=C)}return x!==-1?{leafId:-1,branchId:x,inHeader:!0}:{leafId:b,branchId:y,inHeader:!1}}function wa(e,t,n){if(e.re!==-1)return;for(let a of e.Ye)if(t>=a.x0&&t<=a.x1&&n>=a.y0&&n<=a.y1){e.T.setCursor("pointer"),e.P=-1,Nt(e);return}let{leafId:i,branchId:o,inHeader:r}=hr(e,t,n),s=r?o:i!==-1?i:o;if(s!==e.P){if(e.P=s,e.T.setCursor(o!==-1?"pointer":"default"),s!==-1){let a=e.W.beginHover(s);dt(e,s).then(l=>{e.W.commitHover(a,l)&&Nt(e)})}else e.W.clearHover();Nt(e)}}function Ra(e,t,n){if(e.re!==-1){xn(e),e.emitUnselect();return}for(let s of e.Ye)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e._&&(Xi(e,s.nodeId),e.emitUnselect());return}let{leafId:i,branchId:o,inHeader:r}=hr(e,t,n);o!==-1&&r?(Xi(e,o),ke(e,o,"branch")):i!==-1?(Fa(e,i),ke(e,i,"leaf")):o!==-1&&(Xi(e,o),ke(e,o,"branch"))}function Ma(e,t,n){let i=e.re!==-1;xn(e),i&&e.emitUnselect();let{leafId:o,branchId:r}=hr(e,t,n),s=e.r,a=r;if(a===-1&&o!==-1){let l=s.parent[o];l!==e._&&l!==-1&&(a=l)}a!==-1&&a!==e._&&s.firstChild[a]!==-1&&(Xi(e,a),ke(e,a,"branch"),o!==-1&&s.firstChild[o]===-1&&(Fa(e,o),ke(e,o,"leaf")))}function Xi(e,t){zi(e,t,()=>{e.t&&e.requestRender(e.t)})}function Fa(e,t){let n=e.r,i=(n.x0[t]+n.x1[t])/2,o=(n.y0[t]+n.y1[t])/2;Hi(e,t,{cx:i,cy:o},()=>Nt(e))}function xn(e){Yi(e)}var $i=class extends Gt{constructor(){super(...arguments);d(this,"i",null);d(this,"S",null);d(this,"kt",null);d(this,"Nt",null);d(this,"eo",0);d(this,"P",-1);d(this,"re",-1);d(this,"Ye",[]);d(this,"me",null);d(this,"Ct",!0);d(this,"wn",0);d(this,"st",new Map);d(this,"m",null);d(this,"yi",!1);d(this,"We",null);d(this,"ze",null)}tooltipCallbacks(){return{onHover:(n,i)=>wa(this,n,i),onLeave:()=>{this.P!==-1&&this.re===-1&&(this.P=-1,this.t&&this.requestRender(this.t))},onClickPre:(n,i)=>(Ra(this,n,i),!0),onDblClick:(n,i)=>Ma(this,n,i)}}async uploadAndRender(n,i,o,r){if(this.t=n,o===0){let s=this.R;if(this.ne=s[0]||Si(i)||"",this.s=s[1]||"",!this.s)this.xe="empty";else{let a=this.Ue[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.xe=l?"numeric":"series"}this.P=-1,this.re=-1,this.Ye=[],this.st.clear(),this.m=null,this.We=null,this.ze=null,this.eo=0,this.W.clearHover(),this.W.invalidatePin(),xn(this),this.me?.close(),this.me=null,this.Ct=!0,this.wn++,pn(this)}bn(this,i),hn(this),this.X!==-1&&await this.requestRender(n)}Bt(n){this.X!==-1&&(this.t=n,La(this,n))}destroyInternal(){xn(this),this.me?.close(),this.me=null;let n=this.t?.gl;n&&(this.kt&&n.deleteBuffer(this.kt),this.Nt&&n.deleteBuffer(this.Nt)),this.kt=null,this.Nt=null,this.i=null,this.S=null,this.X=-1,this._=-1,this.ue=[],this.Wt.clear(),this.$=null,this.oe=0,this.Ye=[],this.st.clear(),this.m=null,this.We=null,this.ze=null}};on();Fe();fe();var Sa=4,Cn=30;function zm(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 gr(e,t,n){let i=e.depth[t],o=Math.max(1,zm(e,t)),s=Math.max(0,n-Cn)/o;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=Cn,Ia(e,t,0,2*Math.PI,Cn,s,i)}function Ia(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 p=f/a,c=u,b=u+l*p;u=b;let h=o,y=o+r;e.a0[m]=c,e.a1[m]=b,e.r0[m]=h,e.r1[m]=y;let g=b-c,x=(h+y)/2;g*x*r<Sa||e.firstChild[m]!==-1&&Ia(e,m,c,b,y,r,s)}}function Da(e,t){e.oe=yr(e,t,0)}function yr(e,t,n){let i=e.r,o=i.a0,r=i.a1,s=i.r0,a=i.r1,l=i.firstChild,u=i.nextSibling,m=i.value;(!e.$||e.$.length<i.count)&&(e.$=new Int32Array(i.count));let f=e.$,p=n,c=new Int32Array(128);c[0]=t;let b=1;for(;b>0;){b--;let h=c[b];if(m[h]<=0)continue;f[p++]=h;let y=r[h]-o[h],g=(s[h]+a[h])/2,x=y*g,_=a[h]-s[h];if(!(x*_<Sa))for(let C=l[h];C!==-1;C=u[C]){if(b>=c.length){let v=new Int32Array(c.length*2);v.set(c),c=v}c[b++]=C}}return p}At();var ji=32,Xm=28,$m=90;function Zi(e,t){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut};let n=e.r;for(let i of e.u){let o=t;for(;o!==-1;){if(o===i.drillRoot)return{centerX:i.centerX,centerY:i.centerY};o=n.parent[o]}}return{centerX:e.lt,centerY:e.ut}}function Ea(e,t){if(e._===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.D.length>0&&e.G.facet_mode==="grid",s=e.xe==="series"?e.f.size>1:e.xe==="numeric"&&e.b<e.p,a=!r&&e.ue.length>1?Xm:0,l=s?$m:0;if(r)jm(e,i,o,l);else{e.m=null,e.u=[];let b=i-l,h=o-a;e.lt=b/2,e.ut=a+h/2,e.to=Math.max(0,Math.min(b,h)/2-4),gr(e.r,e._,e.to),Da(e,e._)}Zm(e,t);let u=e.A(),m=u.O,f=de(u.Be,m,Math.max(1,e.f.size));if(e.j){let b=e.j.getContext("2d");b&&b.clearRect(0,0,e.j.width,e.j.height)}let p=t.dpr;e.Ct=!0,qm(e,n,m,f,u.ti,p),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 c=e.S;if(n.uniform2f(c.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(c.u_border_px,u.Bo*p),e.u.length>0)for(let b of e.u)b.instanceCount!==0&&(n.uniform2f(c.u_center,b.centerX*p,b.centerY*p),Ba(e,n,t,b.instanceStart,b.instanceCount));else n.uniform2f(c.u_center,e.lt*p,e.ut*p),Ba(e,n,t,0,e.no);e.pe(()=>qe(e))}function jm(e,t,n,i){let o=e.r,r=[],s=[];for(let f=o.firstChild[e.X];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=Re(s,{cssWidth:a,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.G.facet_padding});e.m=l;let u=[],m=0;for(let f=0;f<r.length;f++){let p=r[f],c=l.cells[f];if(!c)continue;let b=o.name[p],h=e.st.get(b)??p,y=c.layout.e,g=y.x+y.width/2,x=y.y+y.height/2,_=Math.max(0,Math.min(y.width,y.height)/2-4);gr(o,h,_);let C=yr(e,h,m),v=m,A=C-m;u.push({label:b,centerX:g,centerY:x,maxRadius:_,drillRoot:h,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=C}e.oe=m,e.u=u,u.length>0&&(e.lt=u[0].centerX,e.ut=u[0].centerY,e.to=u[0].maxRadius)}function Zm(e,t){if(e.i)return;let n=t.gl,i=j(t,"sunburst-arc",Yn,zn,["u_center","u_resolution","u_border_px"],["a_strip_t","a_side","a_angles","a_radii","a_color"]);e.i=i.program,e.S=i;let o=new Float32Array((ji+1)*2*2);for(let r=0;r<=ji;r++){let s=r/ji,a=r*4;o[a+0]=s,o[a+1]=0,o[a+2]=s,o[a+3]=1}e.on=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.on),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),e.rn=n.createBuffer()}function qm(e,t,n,i,o,r){let s=e.r,a=e.$,l=e.u.length>0,u=l?e.u.reduce((c,b)=>c+b.instanceCount,0):e.oe,m=new Float32Array(u*8),f=0,p=(c,b,h)=>{let y=f;for(let g=c;g<b;g++){let x=a[g];if(x===h)continue;let _=s.a0[x],C=s.a1[x],v=s.r0[x],A=s.r1[x];if(C<=_||A<=v)continue;let T=Wi(e,x,n,i,o),L=f*8;m[L+0]=_,m[L+1]=C,m[L+2]=v*r,m[L+3]=A*r,m[L+4]=T[0],m[L+5]=T[1],m[L+6]=T[2],m[L+7]=T[3],f++}return{rangeStart:y,rangeCount:f-y}};if(l)for(let c of e.u){let b=c.instanceStart,h=b+c.instanceCount,{rangeStart:y,rangeCount:g}=p(b,h,c.drillRoot);c.instanceStart=y,c.instanceCount=g}else p(0,e.oe,e._);e.no=f,t.bindBuffer(t.ARRAY_BUFFER,e.rn),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function Ba(e,t,n,i,o){if(o===0)return;let r=e.S;t.bindBuffer(t.ARRAY_BUFFER,e.on);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=J(n),{setDivisor:l}=a;l(r.a_strip_t,0),l(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.rn);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*(ji+1),o),l(r.a_angles,0),l(r.a_radii,0),l(r.a_color,0)}function qe(e){Km(e),e.presentOverlay()}function Km(e){if(!e.c||e._===-1)return;let t=e.t;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t;ki(e,e.c,n,i,o,r=>Jm(e,r,n,i,o),e.P!==-1?r=>{Qm(r,e,e.P),ef(e,r,e.P,i,o,e.A().fontFamily)}:null)}function Jm(e,t,n,i,o){let r=e.c;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.A(),{fontFamily:a,Te:l,Qn:u}=s,m=s.O,f=de(s.Be,m,Math.max(1,e.f.size)),p=e.r,c=e.$,b=e.oe,h=e.u.length>0;if(h)for(let g of e.u){let x=g.nodeStart+g.nodeCount;for(let _=g.nodeStart;_<x;_++){let C=c[_];C!==g.drillRoot&&Pa(e,t,C,a,m,f,g.centerX,g.centerY)}}else for(let g=0;g<b;g++){let x=c[g];x!==e._&&Pa(e,t,x,a,m,f,e.lt,e.ut)}let y=Math.max(0,Cn-s.Bo*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",h){for(let g of e.u)if(t.beginPath(),t.fillStyle=u,t.arc(g.centerX,g.centerY,y,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(p.name[g.drillRoot],g.centerX,g.centerY),e.m){let x=e.m.cells.find(_=>_.label===g.label);x?.titleRect&&(t.fillStyle=l,t.font=`11px ${a}`,t.textBaseline="middle",t.fillText(g.label,x.titleRect.x+x.titleRect.width/2,x.titleRect.y+x.titleRect.height/2))}}else t.beginPath(),t.arc(e.lt,e.ut,y,0,2*Math.PI),t.fill(),t.fillStyle=l,t.font=`11px ${a}`,t.fillText(p.name[e._],e.lt,e.ut);!h&&e.ue.length>1&&Ni(e,t,i,a,l),Ui(e,r,f,m,s,i,o,h?e.m?.legendRect??null:null),t.restore()}function Pa(e,t,n,i,o,r,s,a){let l=e.r,u=l.a0[n],m=l.a1[n],f=l.r0[n],p=l.r1[n],c=p-f,b=(f+p)/2,y=(m-u)*b;if(c<16||y<8)return;let g=Math.min(11,Math.floor(y*.7));if(g<7)return;t.font=`${g}px ${i}`;let x=l.name[n],_=c-4,C=x;if(t.measureText(C).width>_){for(;C.length>1;)if(C=C.slice(0,-1),t.measureText(C+"\\u2026").width<=_){C+="\\u2026";break}}if(C.length<2)return;let v=(u+m)/2;t.save(),t.translate(s,a);let A=v,T=v>Math.PI/2&&v<3*Math.PI/2;e.Xo==="upright"&&T&&(A+=Math.PI),t.rotate(A);let L=yn(e,n,o,r),w=Gi(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.Xo==="upright"&&T?-b:b;t.fillText(C,F,0),t.restore()}function Qm(e,t,n){let i=t.r,o=i.a0[n],r=i.a1[n],s=i.r0[n],a=i.r1[n],{centerX:l,centerY:u}=Zi(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 ef(e,t,n,i,o,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}=Zi(e,n),f=u+Math.cos(a)*l,p=m+Math.sin(a)*l;Oi(e,t,n,f,p,i,o,r)}function Ga(e,t,n){if(e.u.length===0)return{centerX:e.lt,centerY:e.ut,drillRoot:e._};for(let i of e.u){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 tf(e,t,n){let i=e.r,o=t;for(;o!==-1;){if(o===n)return!0;o=i.parent[o]}return!1}function Wa(e,t,n){let i=Ga(e,t,n);if(!i)return-1;let o=e.r,r=e.$,s=e.oe;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.X]+.001&&i.drillRoot!==e.X)return i.drillRoot;let f=e.u.length>0;for(let p=0;p<s;p++){let c=r[p];if(c===i.drillRoot||f&&!tf(e,c,i.drillRoot))continue;let b=o.a0[c],h=o.a1[c],y=o.r0[c],g=o.r1[c];if(!(u<y||u>g)&&!(m<b||m>h))return c}return-1}function ka(e,t,n){if(e.re!==-1)return;for(let r of e.Ye)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.T.setCursor("pointer"),e.P!==-1&&(e.P=-1,qe(e));return}let i=Wa(e,t,n),o=e.r;if(e.T.setCursor(i!==-1&&o.firstChild[i]!==-1?"pointer":"default"),i!==e.P){if(e.P=i,i!==-1){let r=e.W.beginHover(i);dt(e,i).then(s=>{e.W.commitHover(r,s)&&qe(e)})}else e.W.clearHover();qe(e)}}function Na(e,t,n){if(e.re!==-1){qi(e),e.emitUnselect();return}for(let s of e.Ye)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e._&&(xr(e,s.nodeId),e.emitUnselect());return}let i=e.r,o=Ga(e,t,n);if(o){let s=t-o.centerX,a=n-o.centerY;if(Math.sqrt(s*s+a*a)<i.r1[e.X]+.001){let u=i.parent[o.drillRoot];if(u!==-1&&u!==e.X)xr(e,u),e.emitUnselect();else if(e.u.length>0){let m=e.u.find(f=>f.drillRoot===o.drillRoot);m&&(e.st.delete(m.label),e.emitUnselect()),e.t&&e.requestRender(e.t)}return}}let r=Wa(e,t,n);r!==-1&&(i.firstChild[r]!==-1?(xr(e,r),ke(e,r,"branch")):(nf(e,r),ke(e,r,"leaf")))}function xr(e,t){zi(e,t,()=>{e.t&&e.requestRender(e.t)})}function nf(e,t){let n=e.r,i=(n.a0[t]+n.a1[t])/2,o=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=Zi(e,t),a=r+Math.cos(i)*o,l=s+Math.sin(i)*o;Hi(e,t,{cx:a,cy:l},()=>qe(e))}function qi(e){Yi(e)}var Ki=class extends Gt{constructor(){super(...arguments);d(this,"i",null);d(this,"S",null);d(this,"on",null);d(this,"rn",null);d(this,"no",0);d(this,"Xo","upright");d(this,"lt",0);d(this,"ut",0);d(this,"to",0);d(this,"P",-1);d(this,"re",-1);d(this,"Ye",[]);d(this,"me",null);d(this,"Ct",!0);d(this,"wn",0);d(this,"m",null);d(this,"st",new Map);d(this,"u",[])}tooltipCallbacks(){return{onHover:(n,i)=>ka(this,n,i),onLeave:()=>{this.P!==-1&&this.re===-1&&(this.P=-1,qe(this))},onClickPre:(n,i)=>(Na(this,n,i),!0)}}async uploadAndRender(n,i,o,r){if(this.t=n,o===0){let s=this.R;if(this.ne=s[0]||Si(i)||"",this.s=s[1]||"",!this.s)this.xe="empty";else{let a=this.Ue[this.s],l=a==="float"||a==="integer"||a==="date"||a==="datetime";this.xe=l?"numeric":"series"}this.P=-1,this.re=-1,this.Ye=[],this.st.clear(),this.m=null,this.u=[],this.no=0,this.W.clearHover(),this.W.invalidatePin(),qi(this),this.me?.close(),this.me=null,this.Ct=!0,this.wn++,pn(this)}bn(this,i),hn(this),this.X!==-1&&await this.requestRender(n)}Bt(n){this.X!==-1&&(this.t=n,Ea(this,n))}destroyInternal(){qi(this),this.me?.close(),this.me=null;let n=this.t?.gl;n&&(this.on&&n.deleteBuffer(this.on),this.rn&&n.deleteBuffer(this.rn)),this.on=null,this.rn=null,this.i=null,this.S=null,this.X=-1,this._=-1,this.ue=[],this.Wt.clear(),this.$=null,this.oe=0,this.Ye=[],this.m=null,this.st.clear(),this.u=[]}};Qt();var Ot=class extends we{constructor(){super(...arguments);d(this,"Me",[]);d(this,"ee",0);d(this,"mt",0);d(this,"i",null);d(this,"k",null);d(this,"l",null);d(this,"ge",null);d(this,"ye",null);d(this,"Re",null);d(this,"si",!0)}getZoomConfig(){return{lockAxis:"y"}}};en();function Ji(e,t=.5,n=.1){let i=t/Math.max(1,e),o=i*(1-n)/2;return{slotWidth:i,halfWidth:o}}Ce();function Oa(e,t,n="bar"){let i=t?.[e]?.chart_type?.toLowerCase?.();return i==="bar"||i==="line"||i==="scatter"||i==="area"?i:n}function Ua(e,t,n){let i=n?.[e]?.stack;return typeof i=="boolean"?i:t==="bar"||t==="area"}function Cr(e,t){return t?.[e]?.alt_axis===!0}function Va(e,t,n){let i=n?.[e.aggName];if(!i)return null;let o=typeof i.palette=="string"?of(i.palette):null;if(o&&o.length>0){let r=t?0:e.splitIdx%o.length;return o[r]}return typeof i.color=="string"?Ho(i.color)??null:null}var Qi=new Map;function of(e){let t=Qi.get(e);return t===void 0&&(t=si(e),Qi.size>256&&Qi.clear(),Qi.set(e,t)),t}function Ha(e,t,n){if(t!=="line"&&t!=="area")return"skip";let i=n?.[e]?.interpolate;return i===void 0||t==="area"?"solid":i}var Ya=50,pt=0,eo=1;function to(){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 rf(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 _n(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]===pt?"bar":"area"}}function za(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function Xa(e,t){e[t>>3]|=1<<(t&7)}function $a(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:p,facetSplits:c,scratchBars:b,scratchPosStack:h,scratchNegStack:y}=e,g=Wt(o,s),x={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:g,numericCategoryDomain:null,categoryPositions:null,series:[],bars:to(),posStack:h??null,negStack:y??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},_=i.filter(R=>!!R);if(_.length===0)return x;let C=[];if(r.length>0){for(let R of He(t,[],_))R.colNames.size>0&&C.push(R.prefix);C.length===0&&C.push("")}else C.push("");let v=o.map(R=>s[R]??"string"),{rowPaths:A,numCategories:T,rowOffset:L}=kt(t,n,o.length,v,g);if(T===0)return{...x,aggregates:_,splitPrefixes:C,rowPaths:A,rowOffset:L};let w=[],F=_.length,I=C.length;for(let R=0;R<F;R++)for(let P=0;P<I;P++){let E=_[R],O=C[P],z=O===""?E:`${O}${F>1?` | ${E}`:""}`,H=Oa(E,a,l),Z=Ua(E,H,a),be=Ha(E,H,a);w.push({seriesId:R*I+P,aggIdx:R,splitIdx:P,aggName:E,splitKey:O,label:z,color:[.5,.5,.5],axis:0,chartType:H,stack:Z,start:-1,end:-1,interpolateMode:be})}let S=[];for(let R=0;R<F;R++)S.push(p?{min:0,max:0}:{min:1/0,max:-1/0});let D=T,B=w.length,N=c?D*F*I:D*F,k=za(h??null,N),Y=za(y??null,N);k.fill(0,0,N),Y.fill(0,0,N);let W=new Float32Array(D*B),V=new Uint8Array(D*B+7>>3),U=null,X=null,q=1;if(g.mode==="numeric"&&D>0){let R=t.get("__ROW_PATH_0__"),P=ct(R?.values,D,L,o[0]??"",g.numericType==="date"||g.numericType==="datetime");P&&(U=P.categoryPositions,X=P.numericCategoryDomain,q=P.numericCategoryDomain.bandWidth)}let le=Ji(F,m,f),Se=le.slotWidth*q,ve=le.halfWidth*q,Ae=new Float64Array(F),et=(F-1)/2;for(let R=0;R<F;R++)Ae[R]=(R-et)*Se;let Xt=new Array(F*I),$t=new Array(F*I);for(let R=0;R<F;R++){let P=_[R];for(let E=0;E<I;E++){let O=C[E],z=O===""?P:`${O}|${P}`,H=t.get(z),Z=R*I+E;Xt[Z]=H?.values??null,$t[Z]=H?.valid??null}}let jt=new Array(F),he=new Array(F),se=!1;for(let R=0;R<F;R++){let P=_[R],E=C[0],O=E===""?P:`${E}|${P}`;jt[R]=t.get(O)?.type==="string",he[R]=Cr(P,a)?1:0,jt[R]&&(se=!0)}let Q=[],ie=[],Ie=[],De=[];for(let R=0;R<F;R++){let P=_[R];for(let E=0;E<I;E++){let O=C[E],z=O===""?P:`${O}|${P}`,H=R*I+E,Z={name:z,type:jt[R]?"string":"numeric",data:t.get(z)};he[R]===0?(Q.push(Z),Ie.push(H)):(ie.push(Z),De.push(H))}}let qr=Q.map(R=>R.name).filter((R,P,E)=>E.indexOf(R)===P).join(", "),wo=ie.map(R=>R.name).filter((R,P,E)=>E.indexOf(R)===P).join(", "),Be=Q.length>0?fr(Q,n,L,qr):null,K=ie.length>0?fr(ie,n,L,wo):null,bt=new Array(F*I).fill(null);if(Be)for(let R=0;R<Ie.length;R++)bt[Ie[R]]=Be.perColumnSlots[R];if(K)for(let R=0;R<De.length;R++)bt[De[R]]=K.perColumnSlots[R];let Yl=D*F*I,$=rf(b??null,Yl),ee=0;for(let R=0;R<D;R++){let P=R+L;for(let E=0;E<F;E++)for(let O=0;O<I;O++){let z=E*I+O,H=bt[z];if(H){let ae=E*I+O,ge=R*B+ae;W[ge]=H[R],Xa(V,ge);continue}let Z=Xt[z];if(!Z)continue;let be=$t[z];if(be&&!(be[P>>3]>>(P&7)&1))continue;let te=Z[P];if(!isFinite(te))continue;let gt=E*I+O,nt=R*B+gt;W[nt]=te,Xa(V,nt)}}for(let R=0;R<B;R++){let P=-1,E=-1;for(let O=0;O<D;O++){let z=O*B+R;V[z>>3]>>(z&7)&1&&(P===-1&&(P=O),E=O)}w[R].start=P,w[R].end=E}for(let R=0;R<B;R++){let P=w[R];if(!(P.start<0)&&P.interpolateMode!=="skip"){if(P.chartType==="line"){let E=P.start;for(let O=P.start+1;O<=P.end;O++){let z=O*B+R;if(V[z>>3]>>(z&7)&1){if(O-E>1){let Z=E*B+R,be=W[Z],te=W[z],gt=U?U[E]:E,ae=(U?U[O]:O)-gt;for(let ge=1;ge<O-E;ge++){let ce=E+ge,ye=U?U[ce]:ce,Kl=ae===0?0:(ye-gt)/ae;W[ce*B+R]=be+(te-be)*Kl}}E=O}}}else if(P.chartType==="area"){for(let E=0;E<P.start;E++)W[E*B+R]=0;for(let E=P.end+1;E<D;E++)W[E*B+R]=0;P.start=0,P.end=D-1}}}for(let R=0;R<D;R++){let P=U?U[R]:R;for(let E=0;E<F;E++){let O=Ae[E],z=P+O,H=S[E];for(let Z=0;Z<I;Z++){let be=E*I+Z,te=w[be];if(R<te.start||R>te.end)continue;let gt=te.chartType==="line"||te.chartType==="area"&&te.interpolateMode!=="skip",nt=R*B+be;if(!gt&&!(V[nt>>3]>>(nt&7)&1))continue;let ae=W[nt];if((te.chartType==="bar"||te.chartType==="area")&&te.stack){if(ae===0&&(te.chartType!=="area"||te.interpolateMode==="skip"))continue;let ge=c?(R*F+E)*I+Z:R*F+E,ce,ye;ae>=0?(ce=k[ge],ye=ce+ae,k[ge]=ye):(ce=Y[ge],ye=ce+ae,Y[ge]=ye),ce<H.min&&(H.min=ce),ye<H.min&&(H.min=ye),ce>H.max&&(H.max=ce),ye>H.max&&(H.max=ye),$.catIdx[ee]=R,$.seriesId[ee]=be,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:eo,$.xCenter[ee]=z,$.halfWidth[ee]=ve,$.y0[ee]=ce,$.y1[ee]=ye,ee++}else if(ae<H.min&&(H.min=ae),ae>H.max&&(H.max=ae),p&&(0<H.min&&(H.min=0),0>H.max&&(H.max=0)),te.chartType==="bar"||te.chartType==="area"){if(ae===0)continue;$.catIdx[ee]=R,$.seriesId[ee]=be,$.axis[ee]=0,$.chartType[ee]=te.chartType==="bar"?pt:eo,$.xCenter[ee]=z,$.halfWidth[ee]=ve,$.y0[ee]=0,$.y1[ee]=ae,ee++}}}}$.count=ee;let ht=!1;if(u&&F>=2&&!se){let R=new Array(F),P=0,E=1/0;for(let O=0;O<F;O++){let z=S[O],H=Math.max(Math.abs(z.min),Math.abs(z.max),1e-12);R[O]=H,H>P&&(P=H),H<E&&(E=H)}if(P/E>Ya){let O=P/Math.sqrt(Ya);for(let z=0;z<F;z++)if(R[z]<O)for(let Z of w)Z.aggIdx===z&&(Z.axis=1);for(let z=0;z<$.count;z++)$.axis[z]=w[$.seriesId[z]].axis;ht=w.some(z=>z.axis===1)}}let Kr=!1;for(let R=0;R<F;R++)if(Cr(_[R],a))for(let P of w)P.aggIdx===R&&(P.axis=1,Kr=!0);if(Kr){for(let R=0;R<$.count;R++)$.axis[R]=w[$.seriesId[R]].axis;ht=!0}let Pe=p?{min:0,max:0}:{min:1/0,max:-1/0},tt=p?{min:0,max:0}:{min:1/0,max:-1/0};for(let R=0;R<$.count;R++){let P=$.axis[R]===0?Pe:tt,E=$.y0[R],O=$.y1[R];E<P.min&&(P.min=E),O<P.min&&(P.min=O),E>P.max&&(P.max=E),O>P.max&&(P.max=O)}for(let R=0;R<B;R++){let P=w[R];if(P.stack&&(P.chartType==="bar"||P.chartType==="area")||P.start<0)continue;let E=P.chartType==="line"||P.chartType==="area"&&P.interpolateMode!=="skip",O=P.axis===0?Pe:tt;for(let z=P.start;z<=P.end;z++){let H=z*B+R;if(!E&&!(V[H>>3]>>(H&7)&1))continue;let Z=W[H];Z<O.min&&(O.min=Z),Z>O.max&&(O.max=Z)}}(!isFinite(Pe.min)||!isFinite(Pe.max)||Pe.min===0&&Pe.max===0)&&(Pe.min=0,Pe.max=1);let zl=!isFinite(tt.min)||!isFinite(tt.max)||tt.min===0&&tt.max===0,Xl=ht?zl?{min:0,max:1}:tt:null,$l=Be?"category":"numeric",jl=ht?K?"category":"numeric":null,Zl=Be&&Be.domain.numRows>0?{min:0,max:Math.max(0,Be.domain.numRows-1)}:Pe,ql=K&&K.domain.numRows>0&&ht?{min:0,max:Math.max(0,K.domain.numRows-1)}:Xl;return{aggregates:_,splitPrefixes:C,rowPaths:A,numCategories:T,rowOffset:L,axisMode:g,numericCategoryDomain:X,categoryPositions:U,series:w,bars:$,posStack:k,negStack:Y,samples:W,sampleValid:V,leftDomain:Zl,rightDomain:ql,hasRightAxis:ht,leftValueAxisMode:$l,rightValueAxisMode:jl,leftValueCategoryDomain:Be?.domain??null,rightValueCategoryDomain:K?.domain??null}}Ye();rn();_t();Fe();var _r=pt;function ja(e,t,n,i){let o=i?.start??0,r=i?.count??e.Rn;if(e.Rn===0||r===0)return;let s=e.S,a=J(n),{setDivisor:l}=a;t.bindBuffer(t.ARRAY_BUFFER,e.k),t.enableVertexAttribArray(s.a_corner),t.vertexAttribPointer(s.a_corner,2,t.FLOAT,!1,0,0),l(s.a_corner,0),Ze(n,a,s.a_x_center,"bar_x",1,o)&&Ze(n,a,s.a_half_width,"bar_hw",1,o)&&Ze(n,a,s.a_y0,"bar_y0",1,o)&&Ze(n,a,s.a_y1,"bar_y1",1,o)&&Ze(n,a,s.a_color,"bar_color",3,o)&&Ze(n,a,s.a_series_id,"bar_sid",1,o)&&Ze(n,a,s.a_axis,"bar_axis",1,o)&&a.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,r),l(s.a_x_center,0),l(s.a_half_width,0),l(s.a_y0,0),l(s.a_y1,0),l(s.a_color,0),l(s.a_series_id,0),l(s.a_axis,0)}var no=10;function Ut(e){return e.Fe>=0?_n(e.Ce,e.Fe,e.fe.length,e.qe,e.a.length):e.Se}function vr(e,t,n){if(!e.l)return;let i=e.l,o;if(e.m){let C=e.m.cells,v=-1;for(let A=0;A<C.length;A++){let T=C[A].layout.e;if(t>=T.x&&t<=T.x+T.width&&n>=T.y&&n<=T.y+T.height){v=A;break}}if(v<0){Za(e);return}i=C[v].layout,o=v}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){Za(e);return}let s=i.Y,a=i.J,l=i.q,u=i.Q,m,f,p,c;if(e.Ke){let C=s,v=a,A=Math.min(l,u),T=Math.max(l,u),L=C+(t-r.x)/r.width*(v-C);m=A+(n-r.y)/r.height*(T-A),f=L,p=r.height/(T-A),c=r.width/(v-C)}else m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),c=r.height/(u-l);let b=e.sn&&e.te&&!e.Ke?e.te.max-(n-r.y)/r.height*(e.te.max-e.te.min):f,h=e.sn&&e.te&&!e.Ke?r.height/(e.te.max-e.te.min):c,y=-1,g=null,x=e.Ot,_=x.length<=1;for(let C=x.length-1;C>=0;C--){let v=x[C],A=_?void 0:{start:v.aggStart,end:v.aggEnd};switch(v.chartType){case"scatter":case"line":g=af(e,v.chartType,m,f,b,p,c,h,o,A);break;case"bar":y=sf(e,m,f,b,o,A);break;case"area":{let T=lf(e,m,f,b,o,A);T&&(T.idx>=0?y=T.idx:g=T.bar);break}}if(y>=0||g)break}uf(e,y,g)}function sf(e,t,n,i,o,r){let s=e.Ce,a=s.chartType,l=s.seriesId,u=s.xCenter,m=s.halfWidth,f=s.y0,p=s.y1,c=s.axis,b=e.K,h=Math.max(1,e.fe.length);for(let y=0;y<s.count;y++){if(a[y]!==pt||b.has(l[y])||o!==void 0&&l[y]%h!==o)continue;if(r!==void 0){let L=Math.floor(l[y]/h);if(L<r.start||L>r.end)continue}let g=u[y],x=m[y];if(t<g-x||t>g+x)continue;let _=c[y]===0?n:i,C=f[y],v=p[y],A=C<v?C:v,T=C<v?v:C;if(_>=A&&_<=T)return y}return-1}function af(e,t,n,i,o,r,s,a,l,u){let m=e.ee,f=e.a.length;if(m===0||f===0)return null;let p=e.qe,c=e.Ut,h=no*no,y=null,g=e.se;for(let x of e.a){if(x.chartType!==t||e.K.has(x.seriesId)||l!==void 0&&x.splitIdx!==l||u!==void 0&&(x.aggIdx<u.start||x.aggIdx>u.end))continue;let _=x.axis===1?o:i,C=x.axis===1?a:s,v=g?0:Math.max(0,Math.floor(n-no/r)),A=g?m-1:Math.min(m-1,Math.ceil(n+no/r));for(let T=v;T<=A;T++){let L=T*f+x.seriesId;if(!(c[L>>3]>>(L&7)&1))continue;let w=p[L],F=g?g[T]:T,I=(F-n)*r,S=(w-_)*C,D=I*I+S*S;D<h&&(h=D,y={catIdx:T,aggIdx:x.aggIdx,splitIdx:x.splitIdx,seriesId:x.seriesId,xCenter:F,halfWidth:0,y0:0,y1:w,value:w,axis:x.axis,chartType:"bar"})}}return y}function lf(e,t,n,i,o,r){let s=Math.round(t);if(s<0||s>=e.ee||Math.abs(t-s)>.5)return null;let a=e.a.length,l=e.qe,u=e.Ut,m=e.Ce,f=m.chartType,p=m.catIdx,c=m.seriesId,b=m.axis,h=m.y0,y=m.y1,g=e.fe.length;for(let x=0;x<m.count;x++){if(f[x]!==eo||p[x]!==s||e.K.has(c[x])||o!==void 0&&c[x]%g!==o)continue;if(r!==void 0){let L=Math.floor(c[x]/Math.max(1,g));if(L<r.start||L>r.end)continue}let _=b[x]===0?n:i,C=h[x],v=y[x],A=C<v?C:v,T=C<v?v:C;if(_>=A&&_<=T)return{idx:x,bar:null}}for(let x of e.a){if(x.chartType!=="area"||x.stack||e.K.has(x.seriesId)||o!==void 0&&x.splitIdx!==o||r!==void 0&&(x.aggIdx<r.start||x.aggIdx>r.end))continue;let _=s*a+x.seriesId;if(!(u[_>>3]>>(_&7)&1))continue;let C=l[_],v=x.axis===1?i:n,A=Math.min(0,C),T=Math.max(0,C);if(v>=A&&v<=T)return{idx:-1,bar:{catIdx:s,aggIdx:x.aggIdx,splitIdx:x.splitIdx,seriesId:x.seriesId,xCenter:s,halfWidth:.5,y0:0,y1:C,value:C,axis:x.axis,chartType:"area"}}}return null}function Za(e){(e.Fe!==-1||e.Se!==null)&&(e.Fe=-1,e.Se=null,e.t&&e.requestRender(e.t))}function uf(e,t,n){let i=e.Fe===t,o=(e.Se?.seriesId??-1)===(n?.seriesId??-1)&&(e.Se?.catIdx??-1)===(n?.catIdx??-1);i&&o||(e.Fe=t,e.Se=n,e.t&&e.requestRender(e.t))}function qa(e,t,n){if(e.an.length===0)return!1;for(let i of e.an){let o=i.rect;if(t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height){let r=i.seriesIds.some(s=>!e.K.has(s));for(let s of i.seriesIds)r?e.K.add(s):e.K.delete(s);return e._t=null,e.xi=!1,e.Ci=null,e.t&&(io(e,e.t),oo(e,e.t),e.requestRender(e.t)),!0}}return!1}function Ar(e,t){let n=[],i=e.a[t.seriesId],o=mf(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 mf(e,t){if(e.ke==="numeric"&&e.se){let i=e.se[t];if(i==null)return"";let o=e.g[0];return e.getColumnFormatter(o,"value")(i)}if(e.Me.length===0)return"";let n=[];for(let i of e.Me){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Ka(e,t){t<0||t>=e.Ce.count||(e.io=t,Qa(e,_n(e.Ce,t,e.fe.length,e.qe,e.a.length)))}function Ja(e,t){e.io=-1,Qa(e,t)}function Qa(e,t){if(e.T.dismiss(),!e.l)return;let n=Lr(e,t);if(!n)return;let o=(e.a[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ke?n.B(o,t.xCenter):n.B(t.xCenter,o):Tr(e,t.xCenter,o,n),s=Ar(e,t);s.length!==0&&(e.T.pin(s,r,n),e.Fe=-1,e.Se=null,e.t&&e.requestRender(e.t))}Le();jo();Le();ut();St();bi();function el(e,t,n){if(n)return n;if(!e.isDate)return me;let i=t.length>1?t[1]-t[0]:0;return o=>xe(o,i)}function wr(e,t,n,i,o,r,s){let{Te:a,fontFamily:l}=r,{e:u}=t,m=o==="bottom"?u.y+u.height:u.y;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,di(e,u,i,m,o,f=>t.B(f,0).px,el(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 Rr(e,t,n,i,o,r,s){let{Te:a,fontFamily:l}=r,{e:u}=t,m=o==="left"?u.x:u.x+u.width;e.fillStyle=a,e.font=`11px ${l}`,e.lineWidth=1,pi(e,u,i,m,o,f=>t.B(0,f).py,el(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 ro(e,t,n,i,o,r){wr(e,t,n,i,"bottom",o,r)}function so(e,t,n,i,o,r){Rr(e,t,n,i,"left",o,r)}function ao(e,t,n,i,o,r,s,a=!1,l={}){let u=ue(e,i,r);if(!u)return;let{e:m}=i;if(u.strokeStyle=o.ei,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"?Me(u,i,t.domain,o):so(u,i,t.domain,t.ticks,o,l.category),n.mode==="category"?pe(u,i,n.domain,o):wr(u,i,n.domain,n.ticks,"bottom",o,l.value),s)if(s.mode==="category")pe(u,i,s.domain,o);else{let f=i.Y,p=i.J;i.Y=s.domain.min,i.J=s.domain.max,wr(u,i,s.domain,s.ticks,"top",o,l.alt),i.Y=f,i.J=p}}else if(t.mode==="category"?pe(u,i,t.domain,o):ro(u,i,t.domain,t.ticks,o,l.category),n.mode==="category"?Me(u,i,n.domain,o):Rr(u,i,n.domain,n.ticks,"left",o,l.value),s)if(s.mode==="category")Me(u,i,s.domain,o);else{let f=i.q,p=i.Q;i.q=s.domain.min,i.Q=s.domain.max,Rr(u,i,s.domain,s.ticks,"right",o,l.alt),i.q=f,i.Q=p}}function lo(e,t,n,i,o,r=!1){let s=ue(e,t,o);s&&(s.strokeStyle=i.dn,s.lineWidth=1,r?Tt(s,t.e,n,a=>t.B(a,0).px):wt(s,t.e,n,a=>t.B(0,a).py))}St();At();ci();ut();bi();var Ke=null;function tl(e){if(Ke&&Ke.xCenters.length>=e&&Ke.colors.length>=e*3)return Ke;let t=Math.max(e,Ke?.xCenters.length??0);return Ke={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)},Ke}function io(e,t){let n=e.Ce,i=n.count,o=e.fe.length,r=e.Vt&&o>0,s=0;if(e._i=null,e.Mn=null,e.Fn=null,i>0){let l=tl(i);(!e.Sn||e.Sn.length<i)&&(e.Sn=new Int32Array(i));let u=e.Sn,m=e.ae,f=e.a,p=e.K,c=n.chartType,b=n.seriesId,h=n.xCenter,y=n.halfWidth,g=n.y0,x=n.y1,_=n.axis,C=Math.max(1,e.vt.length),v=r?S=>S%o*C+Math.floor(S/o):S=>o>0?Math.floor(S/o):S,A=r?o*C:C,T=new Array(A).fill(0);for(let S=0;S<i;S++)c[S]!==_r||p.has(b[S])||T[v(b[S])]++;let L=[],w=new Int32Array(A),F=0;for(let S=0;S<A;S++)L.push({start:F,count:T[S]}),w[S]=F,F+=T[S];r?(e.Fn=null,e.Mn=Array.from({length:o},(S,D)=>L.slice(D*C,(D+1)*C)),e._i=Array.from({length:o},(S,D)=>{let B=L[D*C],N=L[(D+1)*C-1];return{start:B.start,count:N.start+N.count-B.start}})):(e.Fn=L,e.Mn=null);let I=S=>w[v(S)]++;for(let S=0;S<i;S++){if(c[S]!==_r)continue;let D=b[S];if(p.has(D))continue;let B=I(D);l.xCenters[B]=h[S]-m,l.halfWidths[B]=y[S],l.y0s[B]=g[S],l.y1s[B]=x[S],l.seriesIds[B]=D,l.axes[B]=_[S];let N=f[D].color;l.colors[B*3]=N[0],l.colors[B*3+1]=N[1],l.colors[B*3+2]=N[2],u[B]=S,s++}}else r&&(e._i=Array.from({length:o},()=>({start:0,count:0})));if(e.Rn=s,s===0){e.Xe=null;return}let a=Ke;t.v.ensureCapacity(s),t.v.upload("bar_x",a.xCenters.subarray(0,s),0,1),t.v.upload("bar_hw",a.halfWidths.subarray(0,s),0,1),t.v.upload("bar_y0",a.y0s.subarray(0,s),0,1),t.v.upload("bar_y1",a.y1s.subarray(0,s),0,1),t.v.upload("bar_sid",a.seriesIds.subarray(0,s),0,1),t.v.upload("bar_axis",a.axes.subarray(0,s),0,1),t.v.upload("bar_color",a.colors.subarray(0,s*3),0,3),(!e.Xe||e.Xe.length<s*3)&&(e.Xe=new Float32Array(Math.max(s*3,e.Xe?.length??0))),e.Xe.set(a.colors.subarray(0,s*3))}function ff(e,t){let n=e.Rn;if(n===0)return;let i=e.Sn,o=e.a,r=e.Ce.seriesId,s=tl(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.Xe;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.v.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!a||a.length<n*3)&&(e.Xe=new Float32Array(n*3)),e.Xe.set(s.colors.subarray(0,n*3))}function nl(e){e.N.lines.invalidateBuffers(e),e.N.scatter.invalidateBuffers(e),e.N.areas.invalidateBuffers(e)}function oo(e,t){e.N.lines.rebuildBuffers(e,t),e.N.scatter.rebuildBuffers(e,t),e.N.areas.rebuildBuffers(e,t)}function il(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.ee===0)return;let s=e.A();Mr(e)&&e.Rn>0&&ff(e,t);let a=e.Ke,l=e.ke==="numeric",u=l?e.E.min:-.5,m=l?e.E.max:e.ee-.5,f=e.oo.min,p=e.oo.max;e.h&&(a?e.h.setBaseDomain(f,p,u,m):e.h.setBaseDomain(u,m,f,p));let c=u,b=m,h=f,y=p,g=e.te?.min??0,x=e.te?.max??1;if(e.h){let V=e.h.getVisibleDomain();a?(h=V.xMin,y=V.xMax,c=V.yMin,b=V.yMax):(c=V.xMin,b=V.xMax,h=V.yMin,y=V.yMax)}let _=a?!e.h?.isYDefault():!e.h?.isXDefault();if(e.si&&e.h&&_){let V=Cf(e,c,b);V.hasLeft&&(h=V.leftMin,y=V.leftMax),e.te&&V.hasRight&&(g=V.rightMin,x=V.rightMax)}if(e.C.include_zero&&(h>0&&(h=0),y<0&&(y=0),e.te&&(g>0&&(g=0),x<0&&(x=0))),e.Vt&&e.fe.length>1){df(e,t,{horizontal:a,numericCat:l,cssWidth:o,cssHeight:r,visCatMin:c,visCatMax:b,visValMin:h,visValMax:y,visRightMin:g,visRightMax:x});return}e.m=null;let C=e.a.length>1,v=e.g.length>0,A={levels:e.Me,numRows:e.ee,levelLabels:e.g.slice()},T=e.ln,L=e.In==="category"&&T!==null&&T.numRows>0,w;if(a){let V=l?55:Ft(A),U=V+(v?16:0),X=C?80:16,q=Math.max(1,o-U-X),le=L?We(T,q):void 0;w=new ne(o,r,{hasXLabel:!0,hasYLabel:v,hasLegend:C,leftExtra:V,bottomExtra:le})}else if(l){let V=L?Ft(T):void 0;w=new ne(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:24,leftExtra:V})}else{let V=L?Ft(T):55,U=V+16,X=C?80:16,q=Math.max(1,o-U-X),le=We(A,q);w=new ne(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:C,bottomExtra:le,leftExtra:L?V:void 0})}e.l=w,e.h&&e.h.updateLayout(w);let F=e.C.include_zero,I=a?w.buildProjectionMatrix(h,y,b,c,"x",F,void 0,0,e.ae):w.buildProjectionMatrix(c,b,h,y,"y",F,void 0,e.ae,0),S;if(e.sn&&e.te&&!a){let V=w.Y,U=w.J,X=w.q,q=w.Q;S=w.buildProjectionMatrix(c,b,g,x,"y",F,void 0,e.ae,0),w.Y=V,w.J=U,w.q=X,w.Q=q}else S=I;let D=oe(h,y,6),B=e.sn&&e.te&&!a?oe(g,x,6):null,N=A,k={min:h,max:y,label:e.ro},Y=e.te&&!a?{min:g,max:x,label:e.$o}:null;e.j&&lo(e.j,w,D,s,t.dpr,a);let W=e.a.length>1?Ut(e):null;ze(n,w,t.dpr,()=>{ol(e,n,t,I,S,s.ti,a,W?W.seriesId:-1)}),e.ge=N,e.ye=k,e.Re=D,e.vi=Y,e.Ai=B,e.$e=l?oe(c,b,6):null,e.pe(()=>rl(e))}function ol(e,t,n,i,o,r,s,a,l){let u=e.Ot,m=u.length<=1;for(let f of u){let p=m?void 0:{start:f.aggStart,end:f.aggEnd};switch(f.chartType){case"area":s||e.N.areas.draw(e,t,n,i,o,r,l,p);break;case"bar":{t.useProgram(e.i);let c=e.S;t.uniformMatrix4fv(c.u_proj_left,!1,i),t.uniformMatrix4fv(c.u_proj_right,!1,o),t.uniform1f(c.u_horizontal,s?1:0),t.uniform1f(c.u_hover_series,a),ja(e,t,n,cf(e,f,l));break}case"line":s||e.N.lines.draw(e,t,n,i,o,l,p);break;case"scatter":s||e.N.scatter.draw(e,t,n,i,o,l,p);break}}}function cf(e,t,n){let i=n!==void 0?e.Mn?.[n]:e.Fn;if(!i)return n!==void 0?{start:0,count:0}:void 0;let o=i[t.aggStart],r=i[t.aggEnd];return{start:o.start,count:r.start+r.count-o.start}}function df(e,t,n){let i=t.gl,o=t.dpr,r=e.A(),{horizontal:s,numericCat:a,cssWidth:l,cssHeight:u,visCatMin:m,visCatMax:f,visValMin:p,visValMax:c,visRightMin:b,visRightMax:h}=n,y=e.g.length>0,g=e.ln,x=e.In==="category"&&g!==null&&g.numRows>0,_=e.vt.length>1,C=a?"outer":"cell",v=x?"cell":"outer",A=Re(e.fe,{cssWidth:l,cssHeight:u,xAxis:s?v:C,yAxis:s?C:v,hasLegend:_,hasXLabel:s?!0:y,hasYLabel:s?y:!0,gap:e.G.facet_padding});if(e.m=A,e.l=A.cells[0]?.layout??null,A.cells.length===0||!e.l)return;e.syncFacetZoomLayouts(A.cells);let T=oe(p,c,6),L=a?oe(m,f,6):null,w=A.cells[0].layout,F=e.j;F&&e.pe(()=>ue(F,w,o));let I=e.C.include_zero,S=e.a.length>1?Ut(e):null,D=e.sn&&e.te!==null&&!s;at(i);for(let B=0;B<A.cells.length;B++){let k=A.cells[B].layout,Y=s?k.buildProjectionMatrix(p,c,f,m,"x",I,void 0,0,e.ae):k.buildProjectionMatrix(m,f,p,c,"y",I,void 0,e.ae,0),W=Y;if(D){let V=k.Y,U=k.J,X=k.q,q=k.Q;W=k.buildProjectionMatrix(m,f,b,h,"y",I,void 0,e.ae,0),k.Y=V,k.J=U,k.q=X,k.Q=q}F&&e.pe(()=>pf(F,k,T,r,o,s)),lt(i,k,o,()=>{ol(e,i,t,Y,W,r.ti,s,S&&S.splitIdx===B?S.seriesId:-1,B)})}e.ge={levels:e.Me,numRows:e.ee,levelLabels:e.g.slice()},e.ye={min:p,max:c,label:e.ro},e.Re=T,e.vi=null,e.Ai=null,e.$e=L,e.pe(()=>rl(e))}function pf(e,t,n,i,o,r){let s=re(e,o);s&&(s.strokeStyle=i.dn,s.lineWidth=1,r?Tt(s,t.e,n,a=>t.B(a,0).px):wt(s,t.e,n,a=>t.B(0,a).py))}function Lr(e,t){return e.m?e.m.cells[t.splitIdx]?.layout??null:e.l}function rl(e){bf(e),e.presentOverlay()}function bf(e){if(!e.c||!e.l||!e.ye||!e.Re)return;if(e.m){hf(e);return}let t=e.A(),n;if(e.ke==="numeric"&&e.E&&e.$e)n={mode:"numeric",domain:{min:e.E.min,max:e.E.max,isDate:e.E.isDate,label:e.E.label},ticks:e.$e};else if(e.ge)n={mode:"category",domain:e.ge};else return;let i=e.a.find(l=>l.axis===0),o=e.a.find(l=>l.axis===1),r=e.g[0],s=e.In==="category"&&e.ln?{mode:"category",domain:e.ln}:{mode:"numeric",domain:e.ye,ticks:e.Re},a;e.vi&&e.Ai&&(a=e.jo==="category"&&e.so?{mode:"category",domain:e.so}:{mode:"numeric",domain:e.vi,ticks:e.Ai}),ao(e.c,n,s,e.l,t,e.t?.dpr??1,a,e.Ke,{value:e.getColumnFormatter(i?.aggName??null,"tick"),alt:e.getColumnFormatter(o?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),xf(e),Ut(e)&&sl(e)}function hf(e){let t=e.m,n=e.c,i=e.A(),o=e.t?.dpr??1,r=e.Ke,s=e.g.length>0,a=e.ke==="numeric"&&e.E!==null&&e.$e!==null;if(!ue(n,e.l,o))return;let l=e.ge,u=e.ye,m=e.Re,f=e.ln,p=e.In==="category"&&f!==null&&f.numRows>0,c=e.a.find(g=>g.axis===0),b=e.getColumnFormatter(c?.aggName??null,"tick"),h=e.getColumnFormatter(e.g[0],"tick");for(let g of t.cells){let x=g.layout,_=x.e,C=re(n,o);C&&(C.strokeStyle=i.ei,C.lineWidth=1,C.beginPath(),C.moveTo(_.x,_.y),C.lineTo(_.x,_.y+_.height),C.lineTo(_.x+_.width,_.y+_.height),C.stroke(),r?(!a&&l&&Me(C,x,l,i),p&&pe(C,x,f,i)):(!a&&l&&pe(C,x,l,i),p&&Me(C,x,f,i)),g.titleRect&&vt(n,g.label,g.titleRect,i,o))}let y=a?{min:e.E.min,max:e.E.max,isDate:e.E.isDate,label:e.E.label}:null;r?(y&&t.outerYAxisRect&&ln(n,t.outerYAxisRect,y,e.$e,nn(t),i,s,o,h),!p&&t.outerXAxisRect&&an(n,t.outerXAxisRect,u,m,tn(t),i,!0,o,b)):(y&&t.outerXAxisRect&&an(n,t.outerXAxisRect,y,e.$e,tn(t),i,s,o,h),!p&&t.outerYAxisRect&&ln(n,t.outerYAxisRect,u,m,nn(t),i,!0,o,b)),gf(e,t),Ut(e)&&sl(e)}function gf(e,t){if(e.an=[],!e.c||!t.legendRect)return;let n=e.vt.length;if(n<=1)return;let i=e.c.getContext("2d");if(!i)return;i.save();let o=e.A(),r=10,s=18,a=t.legendRect.x+12,l=t.legendRect.y+10;i.font=`11px ${o.fontFamily}`,i.textAlign="left",i.textBaseline="middle";for(let u=0;u<n;u++){let m=[],f=[.5,.5,.5];for(let x of e.a)x.aggIdx===u&&(m.push(x.seriesId),f=x.color);let p=e.vt[u],c=m.every(x=>e.K.has(x)),b=Math.round(f[0]*255),h=Math.round(f[1]*255),y=Math.round(f[2]*255);i.globalAlpha=c?.3:1,i.fillStyle=`rgb(${b},${h},${y})`,i.fillRect(a,l-r/2,r,r),i.fillStyle=o.pn,i.fillText(p,a+r+6,l);let g=i.measureText(p).width;c&&(i.strokeStyle=o.pn,i.lineWidth=1,i.beginPath(),i.moveTo(a+r+6,l),i.lineTo(a+r+6+g,l),i.stroke()),i.globalAlpha=1,e.an.push({seriesIds:m,rect:{x:a-2,y:l-s/2,width:r+6+g+4,height:s}}),l+=s}i.restore()}var uo=new Float64Array(0);function yf(e,t,n){if(e.xi)return;let i=e.a;uo.length<i.length&&(uo=new Float64Array(i.length)),t.save(),t.font=`11px ${n}`;for(let o=0;o<i.length;o++)uo[o]=t.measureText(i[o].label).width;t.restore(),e.xi=!0}function xf(e){if(e.an=[],!e.c||!e.l||e.a.length<=1)return;let t=e.c.getContext("2d");if(!t)return;t.save();let n=e.A(),i=n.pn,o=n.fontFamily;yf(e,t,o);let r=e.l,s=10,a=18,l=r.e.x+r.e.width+12,u=r.margins.top+10;t.font=`11px ${o}`,t.textAlign="left",t.textBaseline="middle";let m=e.a,f=uo;for(let p=0;p<m.length;p++){let c=m[p],b=e.K.has(c.seriesId),h=Math.round(c.color[0]*255),y=Math.round(c.color[1]*255),g=Math.round(c.color[2]*255);t.globalAlpha=b?.3:1,t.fillStyle=`rgb(${h},${y},${g})`,t.fillRect(l,u-s/2,s,s),t.fillStyle=i,t.fillText(c.label,l+s+6,u);let x=f[p];b&&(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 _={x:l-2,y:u-a/2,width:s+6+x+4,height:a};e.an.push({seriesIds:[c.seriesId],rect:_}),u+=a}t.restore()}function sl(e){if(!e.c||!e.l)return;let t=Ut(e);if(!t)return;let n=Lr(e,t);if(!n)return;let o=(e.a[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Ke?n.B(o,t.xCenter):n.B(t.xCenter,o):Tr(e,t.xCenter,o,n),s=Ar(e,t),a=e.A();Ee(e.c,r,s,n,a,e.t?.dpr??1)}function Tr(e,t,n,i){let o=i??e.l,{x:r,y:s,width:a,height:l}=o.e,u=(t-o.Y)/(o.J-o.Y),m=e.te,f=(n-m.min)/(m.max-m.min);return{px:r+u*a,py:s+(1-f)*l}}function Cf(e,t,n){let i=e._t;if(i&&i.catMin===t&&i.catMax===n&&i.hidden===e.K)return i;let o=Af(e),r=1/0,s=-1/0,a=!1,l=1/0,u=-1/0,m=!1;if(o.n>0){let p=e.se,c,b;if(p){let v=_f(p,o.n,t,n);c=v.lo,b=v.hi}else c=Math.max(0,Math.floor(t)),b=Math.min(o.n-1,Math.ceil(n));let h=o.leftMin,y=o.leftMax,g=o.rightMin,x=o.rightMax,_=o.hasLeft,C=o.hasRight;for(let v=c;v<=b;v++)_[v]&&(h[v]<r&&(r=h[v]),y[v]>s&&(s=y[v]),a=!0),C[v]&&(g[v]<l&&(l=g[v]),x[v]>u&&(u=x[v]),m=!0)}let f=i??vf();return f.catMin=t,f.catMax=n,f.hidden=e.K,f.leftMin=r,f.leftMax=s,f.hasLeft=a,f.rightMin=l,f.rightMax=u,f.hasRight=m,e._t=f,f}function _f(e,t,n,i){if(t===0||n>i)return{lo:0,hi:-1};let o=0,r=t;for(;o<r;){let l=o+r>>>1;e[l]<n?o=l+1:r=l}let s=Math.max(0,o-1);for(o=0,r=t;o<r;){let l=o+r>>>1;e[l]<=i?o=l+1:r=l}let a=Math.min(t-1,o);return{lo:s,hi:a}}function vf(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function Af(e){let t=e.ee,n=e.Zo,i=n&&n.leftMin.length>=t;if(n&&i&&e.Ci===e.K)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.Zo=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.Ce,r=e.K,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 y=s[h];if(y<0||y>=t)continue;let g=l[h],x=u[h],_=g<x?g:x,C=g<x?x:g;m[h]===1?(_<n.rightMin[y]&&(n.rightMin[y]=_),C>n.rightMax[y]&&(n.rightMax[y]=C),n.hasRight[y]=1):(_<n.leftMin[y]&&(n.leftMin[y]=_),C>n.leftMax[y]&&(n.leftMax[y]=C),n.hasLeft[y]=1)}let f=[e.Dn,e.Bn],p=e.qe,c=e.Ut,b=e.a.length;for(let h of f)for(let y of h){if(r.has(y.seriesId))continue;let g=y.axis===1,x=y.seriesId;for(let _=0;_<t;_++){let C=_*b+x;if(!(c[C>>3]>>(C&7)&1))continue;let v=p[C];g?(v<n.rightMin[_]&&(n.rightMin[_]=v),v>n.rightMax[_]&&(n.rightMax[_]=v),n.hasRight[_]=1):(v<n.leftMin[_]&&(n.leftMin[_]=v),v>n.leftMax[_]&&(n.leftMax[_]=v),n.hasLeft[_]=1)}}return e.Ci=r,n}on();Fe();fe();var vn=new Float32Array(0),An=new Uint8Array(0);function Lf(e){return vn.length>=e||(vn=new Float32Array(Math.max(e,vn.length*2))),vn}function Tf(e){return An.length>=e||(An=new Uint8Array(Math.max(e,An.length*2))),An}function wf(e){return e==="solid"?1:e==="transparent"?.5:0}var mo=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=je(t.gl),i=j(t,"bar-line",Ue,Ve,["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.i={...i,cornerBuffer:n},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer),i.deleteBuffer(o.gpuRealBuffer);this.o=null}rebuildBuffers(t,n){let i=t.Dn;if(i.length===0){this.o=null;return}if(t.ee===0){this.o=null;return}this.ensureProgram(n);let r=n.gl,s=t.qe,a=t.Ut,l=t.ae,u=t.se,m=t.a.length,f=[];for(let p of i){let c=t.a[p.seriesId],b=c.start,h=c.end;if(b<0||h<b)continue;let y=h-b+1;if(y<2)continue;let g=Lf(y*2),x=Tf(y),_=0;for(let A=b;A<=h;A++){let T=u?u[A]-l:A,L=A*m+p.seriesId;g[_*2]=T,g[_*2+1]=s[L],x[_]=a[L>>3]>>(L&7)&1,_++}let C=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,C),r.bufferData(r.ARRAY_BUFFER,g.subarray(0,_*2),r.STATIC_DRAW);let v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,x.subarray(0,_),r.STATIC_DRAW),f.push({seriesId:p.seriesId,axis:p.axis,color:[p.color[0],p.color[1],p.color[2]],gpuBuffer:C,gpuRealBuffer:v,count:y,interpolateMode:c.interpolateMode})}this.o={series:f}}draw(t,n,i,o,r,s,a){let l=this.o,u=this.i;if(!l||!u||l.series.length===0)return;let m=i.dpr;n.useProgram(u.program),n.uniform2f(u.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(u.u_line_width,t.C.line_width_px*m);let f=J(i),{setDivisor:p,drawArraysInstanced:c}=f;n.bindBuffer(n.ARRAY_BUFFER,u.cornerBuffer),n.enableVertexAttribArray(u.a_corner),n.vertexAttribPointer(u.a_corner,1,n.FLOAT,!1,0,0),p(u.a_corner,0);let b=2*Float32Array.BYTES_PER_ELEMENT,h=Uint8Array.BYTES_PER_ELEMENT,y=t.K;for(let g of l.series){if(y.has(g.seriesId)||s!==void 0&&t.a[g.seriesId].splitIdx!==s)continue;let x=t.a[g.seriesId].aggIdx;if(a!==void 0&&(x<a.start||x>a.end))continue;n.uniformMatrix4fv(u.u_projection,!1,g.axis===1?r:o);let _=t.a[g.seriesId].color;n.uniform4f(u.u_color,_[0],_[1],_[2],1),n.uniform1f(u.u_interp_alpha,wf(g.interpolateMode)),n.enableVertexAttribArray(u.a_start),p(u.a_start,1),n.enableVertexAttribArray(u.a_end),p(u.a_end,1),n.enableVertexAttribArray(u.a_real_start),p(u.a_real_start,1),n.enableVertexAttribArray(u.a_real_end),p(u.a_real_end,1),n.bindBuffer(n.ARRAY_BUFFER,g.gpuBuffer),n.vertexAttribPointer(u.a_start,2,n.FLOAT,!1,b,0),n.vertexAttribPointer(u.a_end,2,n.FLOAT,!1,b,b),n.bindBuffer(n.ARRAY_BUFFER,g.gpuRealBuffer),n.vertexAttribPointer(u.a_real_start,1,n.UNSIGNED_BYTE,!1,h,0),n.vertexAttribPointer(u.a_real_end,1,n.UNSIGNED_BYTE,!1,h,h),c(n.TRIANGLE_STRIP,0,4,g.count-1)}p(u.a_start,0),p(u.a_end,0),p(u.a_real_start,0),p(u.a_real_end,0)}destroy(t){let n=t.t?.gl;if(n){this.invalidateBuffers(t);let i=this.i;i&&n.deleteBuffer(i.cornerBuffer)}this.i=null,this.o=null}};fe();var Ne=new Float32Array(0),_e=new Float32Array(0);function Rf(e){Ne.length<e*2&&(Ne=new Float32Array(Math.max(e*2,Ne.length*2))),_e.length<e*3&&(_e=new Float32Array(Math.max(e*3,_e.length*2)))}var fo=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=j(t,"bar-scatter",kn,Nn,["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.Bn;if(i.length===0){this.o=null;return}let o=t.ee,r=t.a.length;if(o===0||r===0){this.o=null;return}let s=this.ensureProgram(n),a=n.gl,l=t.qe,u=t.Ut,m=t.se,f=t.ae,p=t.K,c=0,b=0;for(let _ of i)if(!p.has(_.seriesId))for(let C=0;C<o;C++){let v=C*r+_.seriesId;u[v>>3]>>(v&7)&1&&(_.axis===1?b++:c++)}let h=c+b;if(h===0){this.o=null;return}Rf(h);let y=[],g=0,x=c;for(let _ of i){if(p.has(_.seriesId))continue;let C=_.axis===1?x-c:g,v=_.color[0],A=_.color[1],T=_.color[2];for(let w=0;w<o;w++){let F=w*r+_.seriesId;if(!(u[F>>3]>>(F&7)&1))continue;let I=m?m[w]-f:w,S=l[F];_.axis===1?(Ne[x*2]=I,Ne[x*2+1]=S,_e[x*3]=v,_e[x*3+1]=A,_e[x*3+2]=T,x++):(Ne[g*2]=I,Ne[g*2+1]=S,_e[g*3]=v,_e[g*3+1]=A,_e[g*3+2]=T,g++)}let L=_.axis===1?x-c:g;L>C&&y.push({seriesId:_.seriesId,axis:_.axis,first:C,count:L-C})}c>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posLeftBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(0,c*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorLeftBuffer),a.bufferData(a.ARRAY_BUFFER,_e.subarray(0,c*3),a.STATIC_DRAW)),b>0&&(a.bindBuffer(a.ARRAY_BUFFER,s.posRightBuffer),a.bufferData(a.ARRAY_BUFFER,Ne.subarray(c*2,h*2),a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,s.colorRightBuffer),a.bufferData(a.ARRAY_BUFFER,_e.subarray(c*3,h*3),a.STATIC_DRAW)),this.o={leftCount:c,rightCount:b,seriesRanges:y}}draw(t,n,i,o,r,s,a){let l=this.o,u=this.i;if(!l||!u||l.leftCount===0&&l.rightCount===0)return;let m=i.dpr;if(n.useProgram(u.program),n.uniform1f(u.u_point_size,t.C.point_size_px*m),s!==void 0||a!==void 0){for(let f of l.seriesRanges){if(s!==void 0&&t.a[f.seriesId].splitIdx!==s)continue;let p=t.a[f.seriesId].aggIdx;a!==void 0&&(p<a.start||p>a.end)||Fr(n,u,f.axis===1?u.posRightBuffer:u.posLeftBuffer,f.axis===1?u.colorRightBuffer:u.colorLeftBuffer,f.count,f.axis===1?r:o,f.first)}return}Fr(n,u,u.posLeftBuffer,u.colorLeftBuffer,l.leftCount,o),Fr(n,u,u.posRightBuffer,u.colorRightBuffer,l.rightCount,r)}destroy(t){let n=t.t?.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 Fr(e,t,n,i,o,r,s=0){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,s,o))}fe();var Ln=new Float32Array(0);function Mf(e){return Ln.length>=e||(Ln=new Float32Array(Math.max(e,Ln.length*2))),Ln}var co=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){return this.i?this.i:(this.i=j(t,"bar-area",Gn,Wn,["u_projection","u_color","u_opacity"],["a_position"]),this.i)}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer);this.o=null}rebuildBuffers(t,n){let i=t.Li;if(i.length===0){this.o=null;return}let o=t.ee,r=t.a.length;if(o===0||r===0){this.o=null;return}this.ensureProgram(n);let s=n.gl,a=t.qe,l=t.Ut,u=t.se,m=t.ae,f=t.ao,p=t.Ce,c=[];for(let b of i){let h=t.a[b.seriesId],y=Ff(b,o,r,a,l,f,p.y0,p.y1,u,m,h.start,h.end,h.interpolateMode);if(y.totalVertices===0)continue;let g=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,g),s.bufferData(s.ARRAY_BUFFER,y.scratch.subarray(0,y.totalVertices*2),s.STATIC_DRAW),c.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:g,strips:y.descriptors})}this.o={series:c}}draw(t,n,i,o,r,s,a,l){let u=this.o,m=this.i;if(!u||!m||u.series.length===0)return;n.useProgram(m.program),n.uniform1f(m.u_opacity,s);let f=t.K;for(let p of u.series){if(f.has(p.seriesId)||a!==void 0&&t.a[p.seriesId].splitIdx!==a)continue;let c=t.a[p.seriesId].aggIdx;if(l!==void 0&&(c<l.start||c>l.end))continue;n.uniformMatrix4fv(m.u_projection,!1,p.axis===1?r:o);let b=t.a[p.seriesId].color;n.uniform3f(m.u_color,b[0],b[1],b[2]),n.bindBuffer(n.ARRAY_BUFFER,p.gpuBuffer),n.enableVertexAttribArray(m.a_position),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,0);for(let h of p.strips)n.bindBuffer(n.ARRAY_BUFFER,p.gpuBuffer),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,h.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,h.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.i=null}};function Ff(e,t,n,i,o,r,s,a,l,u,m,f,p){let c=Mf(t*4),b=[],h=e.seriesId*1e9,y=p!=="skip",g=0,x=0;for(let _=0;_<t;_++){let C=0,v=0,A=!1;if(e.stack){let T=r?.get(h+_);T!==void 0&&(C=s[T],v=a[T],A=!0)}else{let T=_*n+e.seriesId;y?_>=m&&_<=f&&(v=i[T],A=!0):o[T>>3]>>(T&7)&1&&(v=i[T],A=!0)}if(A){let T=l?l[_]-u:_;c[g++]=T,c[g++]=C,c[g++]=T,c[g++]=v}else if(g>x){let T=(g-x)/2;T>=4&&b.push({offsetBytes:x*4,vertexCount:T}),x=g}}if(g>x){let _=(g-x)/2;_>=4&&b.push({offsetBytes:x*4,vertexCount:_})}return{descriptors:b,totalVertices:g/2,scratch:c}}Fe();fe();function Tn(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 Je=class extends Ot{constructor(n="vertical"){super();d(this,"Ke");d(this,"S",null);d(this,"vt",[]);d(this,"fe",[]);d(this,"a",[]);d(this,"Vt",!1);d(this,"m",null);d(this,"_i",null);d(this,"Ot",[]);d(this,"Fn",null);d(this,"Mn",null);d(this,"Ce",to());d(this,"uo",[]);d(this,"Dn",[]);d(this,"Bn",[]);d(this,"Li",[]);d(this,"ro","");d(this,"$o","");d(this,"In","numeric");d(this,"jo",null);d(this,"ln",null);d(this,"so",null);d(this,"ao",null);d(this,"Xe",null);d(this,"Ti",null);d(this,"wi",null);d(this,"mo",null);d(this,"fo",null);d(this,"oo",{min:0,max:1});d(this,"te",null);d(this,"sn",!1);d(this,"Pn",null);d(this,"En",null);d(this,"Ri",null);d(this,"ke","category");d(this,"E",null);d(this,"ae",0);d(this,"$e",null);d(this,"se",null);d(this,"K",new Set);d(this,"Fe",-1);d(this,"io",-1);d(this,"Se",null);d(this,"qe",new Float32Array(0));d(this,"Ut",new Uint8Array(0));d(this,"N",{lines:new mo,scatter:new fo,areas:new co});d(this,"vi",null);d(this,"Ai",null);d(this,"Rn",0);d(this,"Sn",new Int32Array(0));d(this,"an",[]);d(this,"xi",!1);d(this,"_t",null);d(this,"Zo",null);d(this,"Ci",null);this.Ke=n==="horizontal"}getZoomConfig(){return{lockAxis:this.Ke?"x":"y"}}tooltipCallbacks(){return{onHover:(n,i)=>vr(this,n,i),onLeave:()=>{(this.Fe!==-1||this.Se)&&(this.Fe=-1,this.Se=null,this.t&&this.requestRender(this.t))},onClickPre:(n,i)=>qa(this,n,i),onPin:(n,i)=>{if(vr(this,n,i),this.Fe>=0){let o=this.Fe;Ka(this,o);let r=_n(this.Ce,o,this.fe.length,this.qe,this.a.length);this.qo(r)}else if(this.Se){let o=this.Se;Ja(this,o),this.qo(o)}},onUnpin:()=>{this.emitUnselect()}}}async qo(n){if(!this.vt[n.aggIdx])return;let i=this.ke==="numeric"&&this.se?[this.se[n.catIdx]??null]:this.Me.map(s=>s.labels[n.catIdx]??null),o=this.fe[n.splitIdx]??"",r=this.D.length>0&&o!==""?o.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.mt,columnName:this.vt[n.aggIdx],groupByValues:i,splitByValues:r})}async uploadAndRender(n,i,o,r){this.t=n;let s=n.gl;if(o!==0)return;if(!this.i){let u=j(n,"bar",Sn,In,["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.i=u.program,this.S=u,this.k=Ti(s)}let a=this.D.length>0&&this.G.facet_mode==="grid",l=$a({columns:i,numRows:r,columnSlots:this.R,groupBy:this.g,splitBy:this.D,groupByTypes:this.gt,columnsConfig:this.gn,defaultChartType:this.oi,autoAltYAxis:this.C.auto_alt_y_axis,bandInnerFrac:this.C.band_inner_frac,barInnerPad:this.C.bar_inner_pad,includeZero:this.C.include_zero,facetSplits:a,scratchBars:this.Ce,scratchPosStack:this.mo,scratchNegStack:this.fo});if(this.C.domain_mode==="expand"){let u=If(l);this.Ri!==u&&(this.Pn=null,this.En=null,this.Ri=u),this.Pn=Tn(this.Pn,l.leftDomain),l.rightDomain&&(this.En=Tn(this.En,l.rightDomain))}else this.Pn=null,this.En=null,this.Ri=null;this.vt=l.aggregates,this.fe=l.splitPrefixes,this.Vt=a&&l.splitPrefixes.length>1,this.Me=l.rowPaths,this.ee=l.numCategories,this.mt=l.rowOffset,this.ke=l.axisMode.mode,this.E=l.numericCategoryDomain,this.se=l.categoryPositions,this.ae=l.numericCategoryDomain?.min??0,this.a=l.series,this.Ce=l.bars,this.mo=l.posStack,this.fo=l.negStack,this.qe=l.samples,this.uo.length=0,this.Dn.length=0,this.Bn.length=0,this.Li.length=0;for(let u of l.series)switch(u.chartType){case"bar":this.uo.push(u);break;case"line":this.Dn.push(u);break;case"scatter":this.Bn.push(u);break;case"area":this.Li.push(u);break}this.ro=al(l.series,0),this.$o=al(l.series,1),this.Ot.length=0;{let u=Math.max(1,l.splitPrefixes.length);for(let m=0;m<l.aggregates.length;m++){let f=l.series[m*u].chartType,p=this.Ot[this.Ot.length-1];p&&p.chartType===f?p.aggEnd=m:this.Ot.push({chartType:f,aggStart:m,aggEnd:m})}}this.ao=Sf(this.Ce),this._t=null,this.xi=!1,this.Ti=null,this.wi=null,this.Ci=null,this.Xe=null,this.Fe=-1,this.Se=null,this.Ut=l.sampleValid,this.oo=l.leftDomain,this.te=l.rightDomain,this.sn=l.hasRightAxis,this.In=l.leftValueAxisMode,this.jo=l.rightValueAxisMode,this.ln=l.leftValueCategoryDomain,this.so=l.rightValueCategoryDomain,Mr(this),io(this,n),nl(this),oo(this,n),await this.requestRender(n)}Bt(n){this.i&&(this.t=n,il(this,n))}resetExpandedDomain(){this.Pn=null,this.En=null,this.Ri=null}destroyInternal(){if(this.t){let n=this.t.gl;this.k&&n.deleteBuffer(this.k),Bf(this)}this.i=null,this.S=null,this.k=null,this.Vt=!1,this.m=null,this._i=null,this.Mn=null,this.Fn=null,this.Ot.length=0,this.Ce=to(),this.a=[],this.uo=[],this.Dn=[],this.Bn=[],this.Li=[],this.ao=null,this.Ti=null,this.wi=null,this.Xe=null,this.mo=null,this.fo=null,this.Me=[],this.ee=0,this.K.clear(),this.Fe=-1,this.Se=null}};function Sf(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 al(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 If(e){let t=Math.max(1,e.splitPrefixes.length),n=[];for(let i=0;i<e.aggregates.length;i++)n.push(`${e.aggregates[i]}:${e.series[i*t].axis}`);return n.join("\\0")}function Mr(e){let t=e.A(),n=t.Be,i=t.O,o=e.gn,r=e.Vt?Math.max(1,e.vt.length):e.a.length,s=e.wi;if(e.Ti&&s&&s.Be===n&&s.O===i&&s.seriesLength===r&&s.columnsConfig===o)return!1;let a=Df(n,i,r);e.Ti=a,e.wi={Be:n,O:i,seriesLength:r,columnsConfig:o};for(let l=0;l<e.a.length;l++){let u=e.a[l],m=e.Vt?a[u.aggIdx]:a[l];u.color=Va(u,e.Vt,o)??m}return!0}function Df(e,t,n){return de(e,t,n)}function Bf(e){e.N.lines.destroy(e),e.N.scatter.destroy(e),e.N.areas.destroy(e)}var po=class extends Je{constructor(){super("horizontal")}};Qt();Ye();mn();function Sr(e){let{columns:t,numRows:n,groupBy:i,splitBy:o,groupByTypes:r}=e,s=Wt(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}=kt(t,n,i.length,l,s),p=null,c=null;if(s.mode==="numeric"&&m>0){let w=t.get("__ROW_PATH_0__"),F=ct(w?.values,m,f,i[0]??"",s.numericType==="date"||s.numericType==="datetime");F&&(p=F.categoryPositions,c=F.numericCategoryDomain)}let b=[];for(let w of t.keys())w.startsWith("__")||!t.get(w)?.values||b.push(w);let h=b.length;if(m===0||h===0)return{...a,xLevels:u,rowOffset:f};let y=Gf(b),g=Pf(o,r),x={mode:"category"},_=null,C=null;if(g.mode==="numeric"){let w=Ef(b,g.numericType);if(w){let F=ct(w,h,0,o[0]??"",g.numericType==="date"||g.numericType==="datetime");F&&(x=g,_=F.categoryPositions,C=F.numericCategoryDomain)}}let v=[],A=new Array(m*h).fill(null),T=1/0,L=-1/0;for(let w=0;w<h;w++){let F=t.get(b[w]),I=F.values,S=F.valid;for(let D=0;D<m;D++){let B=D+f;if(S&&!(S[B>>3]>>(B&7)&1))continue;let N=I[B];if(!isFinite(N))continue;let k={xIdx:D,yIdx:w,value:N};v.push(k),A[w*m+D]=k,N<T&&(T=N),N>L&&(L=N)}}return!isFinite(T)||!isFinite(L)?(T=0,L=1):T===L&&(L=T+1),{xLevels:u,yColumnNames:b,yLevels:y,numX:m,numY:h,rowOffset:f,cells:v,cells2D:A,colorMin:T,colorMax:L,xAxisMode:s,yAxisMode:x,xPositions:p,yPositions:_,xNumericDomain:c,yNumericDomain:C}}function Pf(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 Ef(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 ll(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 Gf(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 p=0;p<e.length;p++){let c=n[p][o]??"",b=s.get(c);b===void 0&&(b=r.length,r.push(c),s.set(c,b)),a[p]=b,l[p]=c,c.length>u&&(u=c.length)}let f=o===t-1?[]:gi(a,r,0,e.length);i.push({labels:l,runs:f,maxLabelChars:u})}return i}Ye();ci();rn();Fe();fe();ut();At();St();mn();hi();function Dr(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var Wf=80,kf=20,Ir=5,Br=11;function Vt(e,t){return e.B(0,t).py}function ul(e,t){let n=Dr(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(Wf,s*6.5+16);o.push({size:a})}else{let a=Math.max(kf,s*6.5+16);o.push({size:a})}}return o}function ml(e,t){let n=Dr(e.levels,t);if(e.numRows===0||n.length===0)return 55;let i=ul(e,t),o=0;for(let r of i)o+=r.size;return o}function Nf(e,t){return e.labels[t]??""}function Pr(e,t,n,i,o){let r=Dr(n.levels,o);if(n.numRows===0||r.length===0)return;let{Dt:s,Te:a,fontFamily:l}=i,{e:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${Br}px ${l}`;let m=ul(n,o),f=Math.max(0,Math.ceil(t.q)),p=Math.min(n.numRows-1,Math.floor(t.Q));if(p<f)return;let c=r.length,b=u.x;for(let y=c-1;y>=0;y--){let g=r[y],x=m[y],_=b,C=b-x.size;b=C,y===c-1?Of(e,t,g,f,p,_,C,l,s):Uf(e,t,g,f,p,C,_,l,s)}let h=n.levelLabels.filter(y=>!!y).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 Of(e,t,n,i,o,r,s,a,l){let u=t.e;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let f=i;f<=o;f++){let p=Vt(t,f);p<u.y-1||p>u.y+u.height+1||(e.moveTo(r,p),e.lineTo(r-Ir,p))}e.stroke(),e.font=`${Br}px ${a}`,e.textAlign="right",e.textBaseline="middle";let m=r-Ir-4-s-4;for(let f=i;f<=o;f++){let p=Vt(t,f);if(p<u.y-1||p>u.y+u.height+1)continue;let c=Nf(n,f);if(!c)continue;let b=mt(e,c,m);b&&e.fillText(b,r-Ir-4,p)}}function Uf(e,t,n,i,o,r,s,a,l){let u=t.e,m=un(n.runs,i,o);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l;let f=s-3;e.beginPath();for(let p of m){let c=Vt(t,p.endIdx+.5),b=Vt(t,p.startIdx-.5),h=Math.min(c,b),y=Math.max(c,b),g=Math.max(u.y,h),x=Math.min(u.y+u.height,y);x<=g||(e.moveTo(f,g),e.lineTo(f,x),e.moveTo(f,g),e.lineTo(f+3,g),e.moveTo(f,x),e.lineTo(f+3,x))}e.stroke(),e.font=`${Br}px ${a}`;for(let p of m){let c=Vt(t,p.endIdx+.5),b=Vt(t,p.startIdx-.5),h=Math.min(c,b),y=Math.max(c,b),g=Math.max(u.y,h),x=Math.min(u.y+u.height,y);if(x<=g)continue;let _=(g+x)/2,C=r+(s-r-3)/2,v=p.label;if(!v)continue;let A=x-g-4,T=mt(e,v,Math.max(0,A));T&&(e.save(),e.translate(C,_),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(T,0,0),e.restore())}}Le();Ci();Ce();Lt();_t();function Gr(e,t,n){if(e.Ko=t,e.Jo=n,e.u.length>0){for(let o=0;o<e.u.length;o++){let r=e.u[o],s=r.layout.e;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let a=cl(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);Er(e,a,o);return}Er(e,null,-1);return}if(!e.l)return;let i=cl(e.l,e.At,e.Lt,e.Mi,e.Tt,e.Gn,e.ft?.bandWidth??1,e.ct?.bandWidth??1,t,n);Er(e,i,-1)}function fl(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 cl(e,t,n,i,o,r,s,a,l,u){let m=e.e;if(l<m.x||l>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.Y,p=e.J,c=e.q,b=e.Q,h=f+(l-m.x)/m.width*(p-f),y=b-(u-m.y)/m.height*(b-c),g=o?fl(o,h,s):Math.round(h),x=r?fl(r,y,a):Math.round(y);return g<0||g>=t||x<0||x>=n?null:i[x*t+g]??null}function Er(e,t,n){let i=e.Ne;(i?.xIdx??-1)===(t?.xIdx??-1)&&(i?.yIdx??-1)===(t?.yIdx??-1)&&e.Wn===n||(e.Ne=t,e.Wn=n,e.t&&e.co&&e.co())}function dl(e,t){let n=[];for(let i of e){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Wr(e){if(!e.c||!e.Ne)return;let t,n,i,o,r=null;if(e.Wn>=0){let c=e.u[e.Wn];if(!c)return;t=c.layout,n=c.pipeline.xLevels,i=c.pipeline.yLevels,o=c.pipeline.xPositions,r=c.label}else{if(!e.l)return;t=e.l,n=e.Ht,i=e.Yt,o=e.Tt}let s=e.Ne,a={px:e.Ko,py:e.Jo},l=[];r&&l.push(r);let u=e.zt.mode==="numeric"&&o?e.getColumnFormatter(e.g[0],"value")(o[s.xIdx]):dl(n,s.xIdx),m=dl(i,s.yIdx);u&&l.push(u),m&&l.push(m);let f=e.getColumnFormatter(e.R[0],"value");l.push(`Value: ${f(s.value)}`);let p=e.A();Ee(e.c,a,l,t,p,e.t?.dpr??1)}var kr={skipLeafLevel:!0};function pl(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.u.length>0){Hf(e,t,o,r);return}if(e.At===0||e.Lt===0)return;let s=e.A(),a={levels:e.Ht,numRows:e.At,levelLabels:e.g.slice()},l={levels:e.Yt,numRows:e.Lt,levelLabels:[]},u=e.zt.mode==="numeric",m=e.kn.mode==="numeric",f=m?55:ml(l,kr),p=u?24:We(a,Math.max(1,o-f-110)),c=new ne(o,r,{hasXLabel:e.g.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:p,leftExtra:f});e.l=c,e.h&&e.h.updateLayout(c);let b=u?e.ft.min:-.5,h=u?e.ft.max:e.At-.5,y=m?e.ct.min:-.5,g=m?e.ct.max:e.Lt-.5;e.h&&e.h.setBaseDomain(b,h,y,g);let x=e.h?e.h.getVisibleDomain():{xMin:b,xMax:h,yMin:y,yMax:g},_=c.buildProjectionMatrix(x.xMin,x.xMax,x.yMin,x.yMax,void 0,void 0,0,e.M,e.F),C=c.e,v=C.width/(x.xMax-x.xMin),A=C.height/(x.yMax-x.yMin),T=s.Do*.5,L=u?e.ft.bandWidth:1,w=m?e.ct.bandWidth:1,F=Math.min(L*.5,v>0?T/v:0),I=Math.min(w*.5,A>0?T/A:0);if(e.j){let S=ue(e.j,c,t.dpr)}bl(e,t),hl(e,t),e.ie=sn(t,e.ie,s.O),ze(n,c,t.dpr,()=>{n.useProgram(e.i);let S=e.S;n.uniformMatrix4fv(S.u_projection,!1,_),n.uniform2f(S.u_cell_inset,F,I),n.uniform2f(S.u_cell_size,L,w),Ge(t,e.ie.texture,S.u_gradient_lut,0),gl(e,n,t,0,e.Qo)}),e.pe(()=>bo(e))}function bl(e,t){if(e.i)return;let n=t.gl,i=j(t,"heatmap",Vn,Hn,["u_projection","u_cell_inset","u_cell_size","u_gradient_lut"],["a_corner","a_cell","a_color_t"]);e.i=i.program,e.S=i;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.k=o}function hl(e,t){let n=e.Qe.length;if(e.Qo=n,n===0)return;let i=new Float32Array(n*2),o=new Float32Array(n);if(e.u.length>0){let r=0;for(let s of e.u){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]=rt(f.value,e.b,e.p),r++}}else{let r=e.Tt,s=e.Gn,a=e.M,l=e.F;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]=rt(m.value,e.b,e.p)}}t.v.ensureCapacity(n),t.v.upload("heatmap_cell",i,0,2),t.v.upload("heatmap_t",o,0,1)}function gl(e,t,n,i,o){if(o===0)return;let r=e.S,s=J(n),{setDivisor:a}=s,l=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.k),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),a(r.a_corner,0);let u=n.v.peek("heatmap_cell"),m=n.v.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 bo(e){Vf(e),e.presentOverlay()}function Vf(e){if(!e.c)return;if(e.u.length>0){Yf(e);return}if(!e.l)return;let t=e.l,n=e.A(),i=e.t?.dpr??1,o=ue(e.c,t,i);if(!o)return;o.strokeStyle=n.dn,o.lineWidth=1,o.beginPath(),o.moveTo(t.e.x,t.e.y),o.lineTo(t.e.x,t.e.y+t.e.height),o.lineTo(t.e.x+t.e.width,t.e.y+t.e.height),o.stroke();let r={levels:e.Ht,numRows:e.At,levelLabels:e.g.slice()},s={levels:e.Yt,numRows:e.Lt,levelLabels:[]},a=e.g[0],l=e.g[1]??e.D[0];if(e.zt.mode==="numeric"&&e.ft){let u=oe(t.Y,t.J,6);ro(o,t,e.ft,u,n,e.getColumnFormatter(a,"tick"))}else pe(o,t,r,n);if(e.kn.mode==="numeric"&&e.ct){let u=oe(t.q,t.Q,6);so(o,t,e.ct,u,n,e.getColumnFormatter(l,"tick"))}else Pr(o,t,s,n,kr);It(e.c,t,{min:e.b,max:e.p,label:e.po},n.O,n,e.getColumnFormatter(e.R[0],"value")),e.Ne&&Wr(e)}function Hf(e,t,n,i){let o=t.gl,r=e.A(),{effectiveSharedX:s,effectiveSharedY:a}=e.computeEffectiveFacetFlags(),l=Re(e.u.map(m=>m.label),{cssWidth:n,cssHeight:i,xAxis:s?"outer":"cell",yAxis:a?"outer":"cell",hasLegend:!0,hasXLabel:e.g.length>0,hasYLabel:!1,gap:8});e.m=l;for(let m=0;m<e.u.length;m++){let f=l.cells[m];f&&(e.u[m].layout=f.layout)}e.syncFacetZoomLayouts(l.cells),bl(e,t),hl(e,t),e.ie=sn(t,e.ie,r.O),o.useProgram(e.i);let u=e.S;Ge(t,e.ie.texture,u.u_gradient_lut,0),at(o);for(let m=0;m<e.u.length;m++){let f=e.u[m];if(f.instanceCount===0)continue;let{numX:p,numY:c}=f.pipeline;if(p===0||c===0)continue;let b=f.layout,h=f.pipeline.xAxisMode.mode==="numeric",y=f.pipeline.yAxisMode.mode==="numeric",g=h?f.pipeline.xNumericDomain.min:-.5,x=h?f.pipeline.xNumericDomain.max:p-.5,_=y?f.pipeline.yNumericDomain.min:-.5,C=y?f.pipeline.yNumericDomain.max:c-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(g,x,_,C);let A=v?v.getVisibleDomain():{xMin:g,xMax:x,yMin:_,yMax:C},T=b.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),L=b.e,w=L.width/(A.xMax-A.xMin),F=L.height/(A.yMax-A.yMin),I=r.Do*.5,S=h?f.pipeline.xNumericDomain.bandWidth:1,D=y?f.pipeline.yNumericDomain.bandWidth:1,B=Math.min(S*.5,w>0?I/w:0),N=Math.min(D*.5,F>0?I/F:0);lt(o,b,t.dpr,()=>{o.uniformMatrix4fv(u.u_projection,!1,T),o.uniform2f(u.u_cell_inset,B,N),o.uniform2f(u.u_cell_size,S,D),gl(e,o,t,f.instanceStart,f.instanceCount)})}e.pe(()=>bo(e))}function Yf(e){if(!e.c||!e.m)return;let t=e.A(),n=e.t?.dpr??1,i=ue(e.c,e.u[0].layout,n);if(!i)return;let o=e.ni,r=e.ii,s=e.m;for(let a=0;a<e.u.length;a++){let l=e.u[a],u=s.cells[a],m=l.layout,f=m.e;i.strokeStyle=t.dn,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 p={levels:l.pipeline.xLevels,numRows:l.pipeline.numX,levelLabels:e.g.slice()},c={levels:l.pipeline.yLevels,numRows:l.pipeline.numY,levelLabels:[]},b=e.g[0],h=e.g[1]??e.D[0];if(!o||u.isBottomEdge)if(l.pipeline.xAxisMode.mode==="numeric"&&l.pipeline.xNumericDomain){let y=oe(m.Y,m.J,6);ro(i,m,l.pipeline.xNumericDomain,y,t,e.getColumnFormatter(b,"tick"))}else pe(i,m,p,t);if(!r||u.isLeftEdge)if(l.pipeline.yAxisMode.mode==="numeric"&&l.pipeline.yNumericDomain){let y=oe(m.q,m.Q,6);so(i,m,l.pipeline.yNumericDomain,y,t,e.getColumnFormatter(h,"tick"))}else Pr(i,m,c,t,kr)}for(let a=0;a<s.cells.length;a++){let l=s.cells[a],u=e.u[a];!u||!l.titleRect||vt(e.c,u.label,l.titleRect,t,n)}s.legendRect&&fn(e.c,{x:s.legendRect.x,y:s.legendRect.y+20,width:s.legendRect.width,height:Math.max(1,s.legendRect.height-20)},{min:e.b,max:e.p,label:""},t.O,t,e.getColumnFormatter(e.R[0],"value")),e.Ne&&Wr(e)}var ho=class extends we{constructor(){super(...arguments);d(this,"i",null);d(this,"S",null);d(this,"k",null);d(this,"ie",null);d(this,"Ht",[]);d(this,"Yt",[]);d(this,"bo",[]);d(this,"At",0);d(this,"Lt",0);d(this,"mt",0);d(this,"zt",{mode:"category"});d(this,"kn",{mode:"category"});d(this,"Tt",null);d(this,"Gn",null);d(this,"ft",null);d(this,"ct",null);d(this,"M",0);d(this,"F",0);d(this,"Qe",[]);d(this,"Mi",[]);d(this,"Qo",0);d(this,"b",0);d(this,"p",1);d(this,"po","");d(this,"Ne",null);d(this,"l",null);d(this,"Ko",0);d(this,"Jo",0);d(this,"u",[]);d(this,"m",null);d(this,"Wn",-1);d(this,"co",()=>bo(this))}colorScaleColumn(){return this.R[0]||null}tooltipCallbacks(){return{onHover:(n,i)=>Gr(this,n,i),onLeave:()=>{this.Ne&&(this.Ne=null,this.co())},onPin:(n,i)=>{Gr(this,n,i),this.Ne&&this.dr(this.Ne.xIdx,this.Ne.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async dr(n,i){let o=this.zt.mode==="numeric"&&this.Tt?[this.Tt[n]??null]:this.Ht.map(a=>a.labels[n]??null),r=this.Yt.slice(0,this.D.length).map(a=>a.labels[i]??null),s=this.R[0]??"";await this.emitClickAndSelect({rowIdx:n+this.mt,columnName:s,groupByValues:o,splitByValues:r})}async uploadAndRender(n,i,o,r){if(this.t=n,o!==0)return;let s=this.R.filter(a=>!!a);if(s.length>1){let a=ll(i,s),l=[],u=[],m=1/0,f=-1/0;for(let p of a){let c=Sr({columns:p.columns,numRows:r,groupBy:this.g,splitBy:this.D,groupByTypes:this.gt}),b=u.length;for(let h of c.cells)u.push({xIdx:h.xIdx,yIdx:h.yIdx,value:h.value});l.push({label:p.label,pipeline:c,layout:new ne(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:b,instanceCount:c.cells.length,xOrigin:c.xNumericDomain?.min??0,yOrigin:c.yNumericDomain?.min??0}),isFinite(c.colorMin)&&c.colorMin<m&&(m=c.colorMin),isFinite(c.colorMax)&&c.colorMax>f&&(f=c.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.Ht=[],this.Yt=[],this.bo=[],this.At=0,this.Lt=0,this.mt=0,this.Mi=[],this.l=null,this.zt={mode:"category"},this.kn={mode:"category"},this.Tt=null,this.Gn=null,this.ft=null,this.ct=null,this.M=0,this.F=0,this.u=l,this.Qe=u,this.b=m,this.p=f,this.po=s.join(", ")}else{let a=Sr({columns:i,numRows:r,groupBy:this.g,splitBy:this.D,groupByTypes:this.gt});this.u=[],this.m=null,this.Ht=a.xLevels,this.Yt=a.yLevels,this.bo=a.yColumnNames,this.At=a.numX,this.Lt=a.numY,this.mt=a.rowOffset,this.Qe=a.cells,this.Mi=a.cells2D,this.b=a.colorMin,this.p=a.colorMax,this.po=s[0]??"Color",this.zt=a.xAxisMode,this.kn=a.yAxisMode,this.Tt=a.xPositions,this.Gn=a.yPositions,this.ft=a.xNumericDomain,this.ct=a.yNumericDomain,this.M=a.xNumericDomain?.min??0,this.F=a.yNumericDomain?.min??0}await this.requestRender(n)}Bt(n){this.t=n;let i=this.At>0&&this.Lt>0,o=this.u.length>0;!i&&!o||pl(this,n)}destroyInternal(){this.k&&this.t&&this.t.gl.deleteBuffer(this.k),this.i=null,this.S=null,this.k=null,this.Ht=[],this.Yt=[],this.bo=[],this.Qe=[],this.Mi=[],this.Ne=null,this.u=[],this.m=null,this.Wn=-1,this.zt={mode:"category"},this.kn={mode:"category"},this.Tt=null,this.Gn=null,this.ft=null,this.ct=null}};en();function wn(){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 zf(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 yl={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function xl(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,bandInnerFrac:a,barInnerPad:l,scratchCandles:u}=e,m=Wt(o,s),f=i[0]||"";if(!f)return{...yl,candles:wn()};let p=i[1]||"",c=i[2]||"",b=i[3]||"",h=[];if(r.length>0){let U=[f];p&&U.push(p),c&&U.push(c),b&&U.push(b);for(let X of He(t,[f],U))X.colNames.has(f)&&h.push(X.prefix);h.length===0&&h.push("")}else h.push("");let y=o.map(U=>s[U]??"string"),{rowPaths:g,numCategories:x,rowOffset:_}=kt(t,n,o.length,y,m);if(x===0)return{...yl,axisMode:m,splitPrefixes:h,rowPaths:g,rowOffset:_,candles:wn()};let C=h.length,v=[];for(let U=0;U<C;U++){let X=h[U];v.push({seriesId:U,splitIdx:U,splitKey:X,label:X===""?f:X})}let A=null,T=null,L=1;if(m.mode==="numeric"&&x>0){let U=t.get("__ROW_PATH_0__"),X=ct(U?.values,x,_,o[0]??"",m.numericType==="date"||m.numericType==="datetime");X&&(A=X.categoryPositions,T=X.numericCategoryDomain,L=X.numericCategoryDomain.bandWidth)}let w=Ji(C,a,l),F=w.slotWidth*L,I=w.halfWidth*L,S=(C-1)/2,D=[];for(let U=0;U<C;U++){let X=h[U],q=et=>X===""?et:`${X}|${et}`,le=t.get(q(f));if(!le?.values){D.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let Se=p?t.get(q(p)):null,ve=c?t.get(q(c)):null,Ae=b?t.get(q(b)):null;D.push({openCol:le.values,closeCol:Se?.values??null,highCol:ve?.values??null,lowCol:Ae?.values??null,openValid:le.valid??null,closeValid:Se?.valid??null,highValid:ve?.valid??null,lowValid:Ae?.valid??null})}let B=x*C,N=zf(u??null,B),k=0,Y=1/0,W=-1/0,V=x;for(let U=0;U<C;U++){let X=D[U],q=X.openCol;if(!q)continue;let le=X.closeCol,Se=X.highCol,ve=X.lowCol,Ae=X.openValid,et=X.closeValid,Xt=X.highValid,$t=X.lowValid,jt=(U-S)*F;for(let he=0;he<V;he++){let se=he+_;if(Ae&&!(Ae[se>>3]>>(se&7)&1))continue;let Q=q[se];if(!isFinite(Q))continue;let ie;if(le&&(!et||(et[se>>3]>>(se&7)&1)!==0)){let K=le[se];ie=isFinite(K)?K:Q}else{let K=he<V-1?he+1+_:se;if(!Ae||(Ae[K>>3]>>(K&7)&1)!==0){let bt=q[K];ie=isFinite(bt)?bt:Q}else ie=Q}let Ie;if(Se&&(!Xt||(Xt[se>>3]>>(se&7)&1)!==0)){let K=Se[se];Ie=isFinite(K)?K:Q>ie?Q:ie}else Ie=Q>ie?Q:ie;let De;if(ve&&(!$t||($t[se>>3]>>(se&7)&1)!==0)){let K=ve[se];De=isFinite(K)?K:Q<ie?Q:ie}else De=Q<ie?Q:ie;let wo=(A?A[he]:he)+jt,Be=ie>=Q?1:0;N.catIdx[k]=he,N.splitIdx[k]=U,N.seriesId[k]=U,N.xCenter[k]=wo,N.halfWidth[k]=I,N.open[k]=Q,N.close[k]=ie,N.high[k]=Ie,N.low[k]=De,N.isUp[k]=Be,k++,De<Y&&(Y=De),Ie>W&&(W=Ie)}}if(N.count=k,!isFinite(Y)||!isFinite(W))Y=0,W=1;else if(Y===W){let U=Math.max(Math.abs(Y),1)*.05;Y-=U,W+=U}return{splitPrefixes:h,rowPaths:g,numCategories:x,rowOffset:_,axisMode:m,numericCategoryDomain:T,categoryPositions:A,series:v,candles:N,yDomain:{min:Y,max:W}}}Ye();Ce();rn();_t();Le();St();var Xf=3;function Cl(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 Nr(e,t,n){if(e.ho!==-1)return;let i=e.l;if(!i)return;let o=e._e;if(o.count===0){e.ve!==-1&&(e.ve=-1,Qe(e));return}let r=i.e,s=i.Y,a=i.J,l=i.q,u=i.Q;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e.ve!==-1&&(e.ve=-1,Qe(e));return}let m=s+(t-r.x)/r.width*(a-s),f=u-(n-r.y)/r.height*(u-l),p=r.width/(a-s),c=Xf/p,b=o.xCenter,h=o.halfWidth,y=o.open,g=o.close,x=o.high,_=o.low,C=o.count>0?h[0]:0,v=Math.max(C,c),A=Cl(b,o.count,m-v),T=Cl(b,o.count,m+v+1e-12),L=-1;for(let w=T-1;w>=A;w--){let F=b[w],I=h[w],S=m>=F-I&&m<=F+I,D=Math.abs(m-F)<=c;if(!S&&!D)continue;let B=y[w],N=g[w],k=B<N?B:N,Y=B<N?N:B,W=S&&f>=k&&f<=Y,V=f>=_[w]&&f<=x[w];if(W||V){L=w;break}}L!==e.ve&&(e.ve=L,Qe(e))}function _l(e,t){e.T.dismiss(),e.ho=t;let n=e._e;if(t<0||t>=n.count||!e.l)return;let i=Or(e,t);if(i.length===0)return;let o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.l.B(o,r),a=e.l.cssWidth,l=e.l.cssHeight;e.T.pin(i,s,{cssWidth:a,cssHeight:l}),e.ve=-1,Qe(e)}function Or(e,t){let n=[],i=e._e;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.ke==="numeric"&&e.E&&e.se){let b=e.se[o],h=e.g[0];n.push(e.getColumnFormatter(h,"value")(b))}else if(e.Me.length>0){let b=[];for(let h of e.Me){let y=h.labels[o]??"";y&&b.push(y)}b.length>0&&n.push(b.join(" \\u203A "))}else n.push(`Row ${o+e.mt}`);if(r>=0&&e.fe.length>1){let b=e.fe[r];b&&n.push(b)}let m=e.getColumnFormatter(e.R[0],"value"),f=e.getColumnFormatter(e.R[1],"value"),p=e.getColumnFormatter(e.R[2],"value"),c=e.getColumnFormatter(e.R[3],"value");return n.push(`Open: ${m(s)}`),n.push(`Close: ${f(a)}`),n.push(`High: ${p(l)}`),n.push(`Low: ${c(u)}`),n}function vl(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 Ur(e){let n=e.A().O;if(e.Fi===n)return;let i=Te(n,1),o=Te(n,0);e.Si=[i[0],i[1],i[2]],e.Ii=[o[0],o[1],o[2]],e.Fi=n}function Al(e){e.N.bodyWick.invalidateBuffers(e),e.N.ohlc.invalidateBuffers(e)}function Ll(e,t){e.N.bodyWick.rebuildBuffers(e,t),e.N.ohlc.rebuildBuffers(e,t)}function Tl(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.ee===0)return;let s=e.A();Ur(e);let a=e.ke==="numeric",l=a?e.E.min:-.5,u=a?e.E.max:e.ee-.5;e.h&&e.h.setBaseDomain(l,u,e.Nn.min,e.Nn.max);let m=e.h?e.h.getVisibleDomain():{xMin:l,xMax:u,yMin:e.Nn.min,yMax:e.Nn.max};if(e.si&&e.h&&!e.h.isXDefault()){let _=Zf(e,m.xMin,m.xMax);_.hasFit&&(m.yMin=_.min,m.yMax=_.max)}let f=e.g.length>0,p={levels:e.Me,numRows:e.ee,levelLabels:e.g.slice()},c;if(a)c=new ne(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,o-71-16),A=We(p,v);c=new ne(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.l=c,e.h&&e.h.updateLayout(c);let b=c.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e.ae,0),h=oe(m.yMin,m.yMax,6),y=e.R[0]||"",g=p,x={min:m.yMin,max:m.yMax,label:y};e.j&&lo(e.j,c,h,s,t.dpr),ze(n,c,t.dpr,()=>{e.oi==="ohlc"?e.N.ohlc.draw(e,n,t,b):e.N.bodyWick.draw(e,n,t,b)}),e.ge=g,e.ye=x,e.Re=h,e.$e=a?oe(m.xMin,m.xMax,6):null,e.pe(()=>Qe(e))}function Qe(e){$f(e),e.presentOverlay()}function $f(e){if(!e.c||!e.l||!e.ye||!e.Re)return;let t=e.A(),n;if(e.ke==="numeric"&&e.E&&e.$e)n={mode:"numeric",domain:{min:e.E.min,max:e.E.max,isDate:e.E.isDate,label:e.E.label},ticks:e.$e};else if(e.ge)n={mode:"category",domain:e.ge};else return;let i=e.R[0]??e.R[1]??e.R[2]??e.R[3],o=e.g[0];ao(e.c,n,{mode:"numeric",domain:e.ye,ticks:e.Re},e.l,t,e.t?.dpr??1,void 0,!1,{value:e.getColumnFormatter(i,"tick"),category:e.getColumnFormatter(o,"tick")}),e.ve>=0&&e.ve<e._e.count&&jf(e)}function jf(e){if(!e.c||!e.l)return;let t=e.ve,n=e._e;if(t<0||t>=n.count)return;let i=e.l,o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=i.B(o,r),a=Or(e,t),l=e.A();Ee(e.c,s,a,i,l,e.t?.dpr??1,{crosshair:!1,highlightRadius:0})}function Zf(e,t,n){let i=e._t;if(i&&i.xMin===t&&i.xMax===n)return i;let o=i??qf();o.xMin=t,o.xMax=n;let r=e._e,s=1/0,a=-1/0,l=!1,u=r.xCenter,m=r.low,f=r.high;for(let p=0;p<r.count;p++){let c=u[p];c<t||c>n||(m[p]<s&&(s=m[p]),f[p]>a&&(a=f[p]),l=!0)}return o.min=l?s:0,o.max=l?a:1,o.hasFit=l,e._t=o,o}function qf(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}Fe();fe();var go=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=Ti(n),r={...j(t,"candlestick-body",On,Un,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:i,instanceBuffer:n.createBuffer()},s=je(n),l={...j(t,"line-uniform",Ue,Ve,["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.i={body:r,wick:l},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;i.deleteBuffer(n.upWickBuffer),i.deleteBuffer(n.downWickBuffer),this.o=null}rebuildBuffers(t,n){let i=t._e,o=this.ensureProgram(n),r=n.gl,s=t.ae;if(i.count===0){let F=r.createBuffer(),I=r.createBuffer();this.o={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:F,downWickBuffer:I};return}let a=new Float32Array(i.count*7),l=0,u=0,m=i.xCenter,f=i.halfWidth,p=i.open,c=i.close,b=i.isUp,h=t.Si,y=t.Ii;for(let F=0;F<i.count;F++){let I=p[F],S=c[F],D=I<S?I:S,B=I<S?S:I,N=b[F]!==0,k=N?h:y,Y=F*7;a[Y+0]=m[F]-s,a[Y+1]=f[F]*.7,a[Y+2]=D,a[Y+3]=B,a[Y+4]=k[0],a[Y+5]=k[1],a[Y+6]=k[2],N?l++:u++}r.bindBuffer(r.ARRAY_BUFFER,o.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,a,r.STATIC_DRAW);let g=new Float32Array(l*4),x=new Float32Array(u*4),_=0,C=0,v=i.low,A=i.high;for(let F=0;F<i.count;F++){let I=m[F]-s,S=v[F],D=A[F];b[F]!==0?(g[_+0]=I,g[_+1]=S,g[_+2]=I,g[_+3]=D,_+=4):(x[C+0]=I,x[C+1]=S,x[C+2]=I,x[C+3]=D,C+=4)}let T=this.o,L=T?.upWickBuffer??r.createBuffer(),w=T?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,L),r.bufferData(r.ARRAY_BUFFER,g,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);Kf(n,i,s.body,r.bodyCount,o),Jf(t,n,i,s.wick,r,o)}destroy(t){let n=t.t?.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 Kf(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=J(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,p)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,p),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 Jf(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.C.wick_width_px*s),t.disableVertexAttribArray(i.a_real_start),t.disableVertexAttribArray(i.a_real_end),t.vertexAttrib1f(i.a_real_start,1),t.vertexAttrib1f(i.a_real_end,1),t.uniform1f(i.u_interp_alpha,1);let a=J(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),wl(t,a,i,o.upWickBuffer,o.upWickCount,e.Si),wl(t,a,i,o.downWickBuffer,o.downWickCount,e.Ii),l(i.a_start,0),l(i.a_end,0)}function wl(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)}Fe();fe();var yo=class{constructor(){d(this,"i",null);d(this,"o",null)}ensureProgram(t){if(this.i)return this.i;let n=t.gl,i=je(n),o=j(t,"line-uniform",Ue,Ve,["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.i={...o,cornerBuffer:i,segmentBuffer:n.createBuffer()},this.i}invalidateBuffers(t){let n=this.o;if(!n||!t.t){this.o=null;return}let i=t.t.gl;i.deleteBuffer(n.upBuffer),i.deleteBuffer(n.downBuffer),this.o=null}rebuildBuffers(t,n){if(t.oi!=="ohlc")return;let i=t._e,o=n.gl;this.ensureProgram(n);let r=t.ae,s=i.xCenter,a=i.halfWidth,l=i.open,u=i.close,m=i.high,f=i.low,p=i.isUp,c=0,b=0;for(let A=0;A<i.count;A++)p[A]!==0?c++:b++;let h=new Float32Array(c*3*4),y=new Float32Array(b*3*4),g=0,x=0;for(let A=0;A<i.count;A++){let T=s[A]-r,L=l[A],w=u[A],F=f[A],I=m[A],S=a[A],D=p[A]!==0?h:y,B=p[A]!==0?g:x;D[B++]=T,D[B++]=F,D[B++]=T,D[B++]=I,D[B++]=T-S,D[B++]=L,D[B++]=T,D[B++]=L,D[B++]=T,D[B++]=w,D[B++]=T+S,D[B++]=w,p[A]!==0?g=B:x=B}let _=this.o,C=_?.upBuffer??o.createBuffer(),v=_?.downBuffer??o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,C),o.bufferData(o.ARRAY_BUFFER,h,o.STATIC_DRAW),o.bindBuffer(o.ARRAY_BUFFER,v),o.bufferData(o.ARRAY_BUFFER,y,o.STATIC_DRAW),this.o={upBuffer:C,downBuffer:v,upInstanceCount:c*3,downInstanceCount:b*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.C.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=J(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),Rl(n,l,s,r.upBuffer,r.upInstanceCount,t.Si),Rl(n,l,s,r.downBuffer,r.downInstanceCount,t.Ii),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.t?.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 Rl(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 Rn=class extends Ot{constructor(){super(...arguments);d(this,"S",null);d(this,"fe",[]);d(this,"a",[]);d(this,"_e",wn());d(this,"Nn",{min:0,max:1});d(this,"Di",null);d(this,"ke","category");d(this,"E",null);d(this,"se",null);d(this,"$e",null);d(this,"ae",0);d(this,"Si",[0,.8,.4]);d(this,"Ii",[.8,.2,.2]);d(this,"Fi",null);d(this,"ve",-1);d(this,"ho",-1);d(this,"N",{bodyWick:new go,ohlc:new yo});d(this,"si",!0);d(this,"_t",null)}tooltipCallbacks(){return{onHover:(n,i)=>Nr(this,n,i),onLeave:()=>{this.ve!==-1&&(this.ve=-1,Qe(this))},onPin:(n,i)=>{if(Nr(this,n,i),this.ve>=0){let o=this.ve;_l(this,o),this.pr(o)}},onUnpin:()=>{this.emitUnselect()}}}async pr(n){if(n<0||n>=this._e.count)return;let i=this._e.catIdx[n],o=this._e.splitIdx[n],r=this.ke==="numeric"&&this.se?[this.se[i]??null]:this.Me.map(u=>u.labels[i]??null),s=this.fe[o]??"",a=this.D.length>0&&s!==""?s.split("|"):[],l=this.R[1]||this.R.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:i+this.mt,columnName:l,groupByValues:r,splitByValues:a})}invalidateTheme(){super.invalidateTheme(),this.Fi=null}async uploadAndRender(n,i,o,r){if(this.t=n,o!==0)return;let s=xl({columns:i,numRows:r,columnSlots:this.R,groupBy:this.g,splitBy:this.D,groupByTypes:this.gt,bandInnerFrac:this.C.band_inner_frac,barInnerPad:this.C.bar_inner_pad,scratchCandles:this._e});this.C.domain_mode==="expand"?this.Di=Tn(this.Di,s.yDomain):this.Di=null,this.Me=s.rowPaths,this.ee=s.numCategories,this.mt=s.rowOffset,this.fe=s.splitPrefixes,this.a=s.series,this._e=s.candles,this.Nn=s.yDomain,this.ke=s.axisMode.mode,this.E=s.numericCategoryDomain,this.se=s.categoryPositions,this.ae=s.numericCategoryDomain?.min??0,this._t=null,Ur(this),Al(this),Ll(this,n),await this.requestRender(n)}Bt(n){this.t=n,Tl(this,n)}resetExpandedDomain(){this.Di=null}destroyInternal(){if(this.t){let n=this.t.gl;this.k&&n.deleteBuffer(this.k),this.N.bodyWick.destroy(this),this.N.ohlc.destroy(this)}this.i=null,this.S=null,this.k=null,this._e=wn(),this.a=[],this.Me=[],this.ee=0,this.Fi=null}};var Wl={scatter:async()=>wi,line:async()=>Ri,density:async()=>Mi,treemap:async()=>$i,sunburst:async()=>Ki,heatmap:async()=>ho,"y-bar":async()=>Je,"y-line":async()=>Je,"y-scatter":async()=>Je,"y-area":async()=>Je,"x-bar":async()=>po,candlestick:async()=>Rn,ohlc:async()=>Rn,"map-scatter":async()=>(await Promise.resolve().then(()=>(Ao(),vo))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(Ao(),vo))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(Ao(),vo))).MapDensityChart};async function kl(e,t,n){let i=new Map;await e.with_typed_arrays(n??{},async(o,r,s,a)=>{for(let u=0;u<o.length;u++){let m=o[u],f=r[u],p=s[u]??void 0,c=a[u];c!==null?i.set(m,{type:"string",indices:f,dictionary:c,valid:p}):f instanceof Float32Array?i.set(m,{type:"float32",values:f,valid:p}):f instanceof Int32Array?i.set(m,{type:"int32",values:f,valid:p}):f instanceof Float64Array?i.set(m,{type:"float64",values:f,valid:p}):i.set(m,{type:"float32",values:new Float32Array(f),valid:p})}let l=0;if(i.size>0){l=1/0;for(let u of i.values()){let m=u.indices?.length??u.values?.length??0;m<l&&(l=m)}}await t(i,l)})}var Nl=new Map;async function Ol(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=Nl.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)}})(),Nl.set(t,n),await n}function zt(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.v.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"deselect":e.chartImpl.deselect?.();break;case"resize":e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redrawAck(t.msgId);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 Fn=new Map,$r=new Set;function jr(e,t,n){let i={sessionId:e,msg:t};n&&n.length>0?self.postMessage(i,n):self.postMessage(i)}function nc(e){return{postMessage:(t,n)=>jr(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function Ul(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:i,msg:o}=n;if(o.kind==="init"){if(Fn.has(i)){jr(i,{kind:"error",message:`sessionId ${i} already initialized`});return}e(o,nc(i)).then(s=>{if($r.delete(i)){zt(s,{kind:"destroy"});return}Fn.set(i,s)}).catch(s=>{$r.delete(i),jr(i,{kind:"error",message:String(s)})});return}if(o.kind==="destroy"){let s=Fn.get(i);s?(zt(s,o),Fn.delete(i)):$r.add(i);return}let r=Fn.get(i);r&&zt(r,o)})}Yo();var Lo=class extends Error{constructor(){super("StaleGenerationError")}};async function Hl(e){let t=Wl[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var Zr=null;function ic(e){return Zr||(Zr=new ei(4,{precompile:e})),Zr}var To=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,"Bi",null);d(this,"rr",null);d(this,"un",null);d(this,"go",0);d(this,"yo",!1);d(this,"client");d(this,"view");d(this,"table");d(this,"controlPort");d(this,"xo",0);d(this,"Pi",null);d(this,"Co",0);d(this,"_o",0);if(this.client=n,this.view=i,this.table=o,this.controlPort=r,this.chartImpl=new s,t.renderMode==="blit"&&!t.glCanvas&&!0)this.glManager=new Kt(ic(t.precompileShaders??!1).acquire());else{let m=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 Kt(m,{precompile:t.precompileShaders??!1})}let l=Math.max(1,Math.round(t.cssWidth*t.dpr)),u=Math.max(1,Math.round(t.cssHeight*t.dpr));this.gridlines=t.gridlinesCanvas??new OffscreenCanvas(l,u),this.chrome=t.chromeCanvas??new OffscreenCanvas(l,u),t.renderMode==="blit"&&(this.glManager.setFrameCallback(m=>{this.go+=1;let f=this.sr(m);this.post({kind:"frameBitmap",bitmap:f},[f])}),this.chartImpl.setOverlayPresenter?.(()=>this.xr())),this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(this.gridlines),this.chartImpl.setChromeCanvas?.(this.chrome),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),t.columnsConfig&&this.chartImpl.setColumnsConfig?.(t.columnsConfig),this.chartImpl.setZoomController&&(this.zoomController=new xt,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(i),this.glManager.v.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr),this.chartImpl.attachTooltip?.(new ni(m=>this.post(m)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}async loadAndRender(t){let n=++this.xo;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.xo!==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.v.maxCapacity/a),u=Math.min(i,l);this.glManager.ensureBufferCapacity(u);try{await kl(this.view,async(m,f)=>{if(this.xo!==n)throw new Lo;await this.chartImpl.uploadAndRender(this.glManager,m,0,Math.min(u,f))},{end_row:u,float32:t.options.float32})}catch(m){if(!(m instanceof Lo))throw m}}catch(i){(i+"").indexOf("View not found")===-1&&console.error("loadAndRender failed",i)}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId})}}redraw(){this.chartImpl.requestRender(this.glManager)}redrawAck(t){this.chartImpl.requestRender(this.glManager).catch(()=>{}).finally(()=>this.post({kind:"resizeAck",msgId:t}))}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(){Fs(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?.hn;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.hn;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}ar(t,n){let i=this.chartImpl,o=i?.m;if(o){for(let a=0;a<o.cells.length;a++){let l=o.cells[a],u=l.layout.e;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?.l;if(!r)return null;let s=r.e;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.ar(t.mx,t.my);if(!n)return;rs(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.ar(t.mx,t.my);if(!n)return;this.Pi=n,this.Co=t.mx,this._o=t.my;break}case"pointermove":{if(this.Pi){let n=t.mx-this.Co,i=t.my-this._o;this.Co=t.mx,this._o=t.my,ss(this.Pi,n,i),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.T()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.Pi=null;break}case"pointerleave":{this.T()?.dispatchLeave();break}case"click":{this.T()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this.T()?.dispatchDblClick(t.mx,t.my);break}}}T(){return this.chartImpl?.T??null}sr(t){let n=t.width,i=t.height;this.Bi||(this.Bi=new OffscreenCanvas(n,i),this.rr=this.Bi.getContext("2d"));let o=this.Bi,r=this.rr;return r?(o.width!==n||o.height!==i?(o.width=n,o.height=i):r.clearRect(0,0,n,i),this.gridlines.width===n&&this.gridlines.height===i&&r.drawImage(this.gridlines,0,0),r.drawImage(t,0,0),this.un!==t&&(this.un?.close(),this.un=t),this.chrome.width===n&&this.chrome.height===i&&r.drawImage(this.chrome,0,0),o.transferToImageBitmap()):t}xr(){if(this.yo)return;this.yo=!0;let t=this.go;queueMicrotask(()=>{this.yo=!1;let n=this.un;if(this.go!==t||!n)return;let i=Math.max(1,Math.round(this.cssWidth*this.dpr)),o=Math.max(1,Math.round(this.cssHeight*this.dpr));if(n.width!==i||n.height!==o)return;let r=this.sr(n);r!==n&&this.post({kind:"frameBitmap",bitmap:r},[r])})}async snapshotPng(){this.glManager.beginFrame(),this.chartImpl.renderFrameSync(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.A?.()?.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(){Ss(this.glManager),this.un?.close(),this.un=null,this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},oc=typeof globalThis.importScripts=="function";async function rc(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(Ol));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 Hl(e.chartTag),l=new To(e,o,r,s,t,a);return l.post({kind:"ready"}),l}async function qC(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 Hl(e.msg.chartTag),o=new To(e.msg,e.client,t,n,e.controlPort,i);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&zt(o,s)}),e.controlPort.start(),o.post({kind:"ready"}),o}oc&&Ul(rc);export{To as WorkerRenderer,qC as bootstrapInProcess};\n';var B=null;async function Le(){if(B)return B;let r=new Blob([de],{type:"application/javascript"});return B=URL.createObjectURL(r),B}var X=Le;var k=null,j=new Map,Pe=0;async function Be(){return k||(k=(async()=>{let r=await X(),e=new Worker(r,{type:"module",name:"viewer-charts"});return e.addEventListener("message",t=>{let i=t.data;j.get(i.sessionId)?.(i.msg)}),e})(),k)}var D=class{_handle=null;_destroyed=!1;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_panel;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_lastPostedSize=null;_holdPresent=!1;_stagedFrame=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._panel=e.panel,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 X();_==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(c=>{let v=c.slice().buffer;this._proxyChannel.port1.postMessage(v,[v])}),this._proxyChannel.port1.addEventListener("message",c=>{this._proxySession.handle_request(new Uint8Array(c.data))}),this._proxyChannel.port1.start());let i,n,l;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):(i=e.gl.transferControlToOffscreen(),n=e.gridlines.transferControlToOffscreen(),l=e.chrome.transferControlToOffscreen());let o=e.gl.getBoundingClientRect(),s=window.devicePixelRatio||1,a=E(e.gl),f=_==="worker"?ce():[],m=_==="worker"?this._clientWasm:void 0,y=_==="worker"?this._clientWorkerURL:void 0,u=_==="worker"?this._proxyChannel.port2:void 0,h={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:l,proxyPort:u,clientWorkerURL:y,clientWasm:m,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,columnsConfig:e.columnsConfig,defaultChartType:e.defaultChartType,themeVars:a,fontFaces:f,cssWidth:o.width,cssHeight:o.height,dpr:s,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._lastPostedSize={cssWidth:o.width,cssHeight:o.height,dpr:s},this._handle=await this._createHandle(t,h),this._handle.addMessageListener(c=>this._handleRendererMsg(c)),_==="worker"){let c=[this._proxyChannel.port2];l&&c.unshift(l),n&&c.unshift(n),i&&c.unshift(i),this._handle.post(h,c)}await this._ready}async _createHandle(e,t){if(_==="worker"){let l=await Be(),o=++Pe;return{post:(s,a)=>l.postMessage({sessionId:o,msg:s},a),addMessageListener:s=>{j.set(o,s)},terminate:()=>{j.delete(o)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(l,o)=>n.port1.postMessage(l,o),addMessageListener:l=>{n.port1.addEventListener("message",o=>l(o.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"})}deselect(){this._post({kind:"deselect"})}resize(){if(!this._hostGlCanvas)return Promise.resolve();let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1,i=this._lastPostedSize;return i&&Math.abs(i.cssWidth-e.width)<=.5&&Math.abs(i.cssHeight-e.height)<=.5&&i.dpr===t?Promise.resolve():this._postResize(e.width,e.height)}presize(e,t){if(!this._hostGlCanvas)return Promise.resolve();let i=window.devicePixelRatio||1,n=this._lastPostedSize;return n&&Math.abs(n.cssWidth-e)<=.5&&Math.abs(n.cssHeight-t)<=.5&&n.dpr===i?Promise.resolve():(this._holdPresent=!0,this._postResize(e,t).then(()=>()=>this._presentStaged(),l=>{throw this._presentStaged(),l}))}_postResize(e,t){let i=window.devicePixelRatio||1,{id:n,promise:l}=this._allocPending("resize");return this._lastPostedSize={cssWidth:e,cssHeight:t,dpr:i},this._post({kind:"resize",msgId:n,cssWidth:e,cssHeight:t,dpr:i}),l}_presentStaged(){this._holdPresent=!1;let e=this._stagedFrame;this._stagedFrame=null,e&&this._drawFrameBitmap(e)}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=E(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){if(this._destroyed){if(e==="loadAndRender")return{id:-1,promise:Promise.resolve(void 0)};let n=Promise.reject(new Error("RendererTransport destroyed"));return n.catch(()=>{}),{id:-1,promise:n}}let t=++this._pendingCounter,i=new Promise((n,l)=>{this._pending.set(t,{kind:e,resolve:n,reject:l})});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._destroyed=!0,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,this._holdPresent=!1,this._stagedFrame?.close(),this._stagedFrame=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,panel:this._panel}}));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 w(e.selected,e.row,e.column_names,t,i);n.panel=this._panel,this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._holdPresent?(this._stagedFrame?.close(),this._stagedFrame=e.bitmap):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"resizeAck":this._resolvePending(e.msgId,"resize",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 P(this._hostGlCanvas,e),this._hostSink)}};function ke(r){return isFinite(r)?r<0?0:r>1?1:r:.5}function me(r){return!isFinite(r)||r<0?1:r}function pe(r){let e=(l,o)=>r[l]||o,t=r["--psp-charts--gradient--background"]||r["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",i=re(t),n=[];for(let l=1;;l++){let o=r[`--psp-charts--series-${l}--color`];if(!o)break;n.push(I(o))}return{fontFamily:e("--psp-charts--font-family",e("font-family","monospace")),backgroundColor:e("--psp--background-color","rgba(255, 255, 255, 1)"),tickColor:e("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),labelColor:e("--psp--color","rgba(180, 0, 0, 0.9)"),axisLineColor:e("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),gridlineColor:e("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),gradientStops:i,legendText:e("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),legendBorder:e("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),tooltipBg:e("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),tooltipText:e("--psp-charts--tooltip--color","#161616"),tooltipBorder:e("--psp-charts--tooltip--border-color","#fff"),areaOpacity:ke(parseFloat(e("--psp-charts--area--opacity","0.85"))),heatmapGapPx:me(parseFloat(e("--psp-charts--heatmap-gap--px","0"))),sunburstGapPx:me(parseFloat(e("--psp-charts--sunburst-gap--px","1"))),seriesPalette:n}}function De(r,e){if(e<=0)return[];let t=new Array(e);for(let i=0;i<e;i++){let n=e===1?.5:i/(e-1),l=se(r,n);t[i]=[l[0],l[1],l[2]]}return t}function q(r,e,t){if(r.length>0){if(r.length>=t)return r.slice(0,t);let i=new Array(t);for(let n=0;n<t;n++)i[n]=r[n%r.length];return i}return De(e,t)}var Ne={...ue},Ue={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 We(r,e){return{...Ue[r],key:r,default:e[r]}}var Oe=(()=>{let r=new CSSStyleSheet;return r.replaceSync(ae),[r]})(),ge=fe,N=class r extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_resetClickAbort=null;_pluginConfigStore=null;_columnsConfig={};get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{...he,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of Oe)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){if(this._initialized||this.connectedCallback(),this._rendererPromise)return this._rendererPromise;let t=this._buildRenderer(e).then(i=>{if(this._rendererPromise!==t)throw i.destroy(),new Error("renderer disposed during init");return this._renderer=i,this._setupInteraction(i),i});return t.catch(()=>{}),this._rendererPromise=t,t}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new L,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=this.getAttribute("slot")??void 0,n=await t.getClient({panel:i}),l=customElements.get("perspective-viewer"),o=l.get_wasm_module(),s=l.get_worker_url(),a=await t?.getTable?.({panel:i}),f=a?await a.get_name():void 0,m=this.shadowRoot.querySelector(".zoom-controls"),y=new D({client:n,view:e,tableName:f,panel:i,clientWorkerURL:s,clientWasm:o,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:u=>{m&&m.classList.toggle("visible",!u)}});return await y.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...Ne,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,columnsConfig:this._columnsConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:ge}),y}static setBlitMode(e){ge=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"],split_rollup_modes:["flat"],group_by_role:this._chartType.group_by_role,split_by_role:this._chartType.split_by_role,connects_row_order:!!this._chartType.connects_row_order,priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"||this._chartType.category==="Hierarchical Charts"||this._chartType.category==="Map Charts"}}column_config_schema(e,t,i,n,l){let o=[];t==="Color"&&((this._chartType.category==="Hierarchical Charts"?e==="integer"||e==="float"||e==="date"||e==="datetime":e!=="string")?o.push({kind:"GradientStops",key:"gradient",default:this._themeGradientStopsSpec()}):o.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()}));let s=this._chartType.default_chart_type;if(s&&(e==="integer"||e==="float")){let a=s==="bar"||s==="line"||s==="scatter"||s==="area";if(a)if((l?.split_by?.length??0)>0)o.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()});else{let h=(l?.columns??[]).filter(c=>!!c).indexOf(i);o.push({kind:"Color",key:"color",default:this._themeSeriesColorHex(Math.max(0,h))})}o.push({kind:"Enum",key:"chart_type",default:s,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let f=n?.chart_type??s,m=f==="bar"||f==="area";if(m&&o.push({kind:"Bool",key:"stack",default:m}),a&&o.push({kind:"Bool",key:"alt_axis",default:!1}),f==="line"||f==="area"){let u=f==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];o.push({kind:"Enum",key:"interpolate",default:"solid",variants:u})}}return e==="integer"||e==="float"?o.push({kind:"NumberFormat"}):(e==="date"||e==="datetime")&&o.push({kind:"DatetimeFormat"}),{fields:o}}plugin_config_schema(e){let t=this._effectiveDefaults();return{fields:this._chartType.applicable_plugin_fields.map(n=>We(n,t))}}_resolvedTheme(){return pe(E(this))}static GRADIENT_PALETTE_FALLBACK_COUNT=6;_themeSeriesPaletteHex(){let e=this._resolvedTheme(),t=e.seriesPalette.length||r.GRADIENT_PALETTE_FALLBACK_COUNT;return oe(q(e.seriesPalette,e.gradientStops,t))}_themeSeriesColorHex(e){let t=this._resolvedTheme(),i=Math.max(t.seriesPalette.length,e+1);return M(q(t.seriesPalette,t.gradientStops,i)[e])}_themeGradientStopsSpec(){return le(this._resolvedTheme().gradientStops)}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;try{t=await this._ensureRenderer(e)}catch{return}t.setView(e),t.setBufferMaxCapacity(this._chartType.max_cells);let i=this.getAttribute("slot")??void 0,n=this.parentElement;if(n===null)return;let l=await n.getViewConfig({panel:i});await t.loadAndRender({viewerConfig:{group_by:l?.group_by??[],split_by:l?.split_by??[],columns:l?.columns??[]},options:{float32:!0}})}async clear(){this._renderer?.clear()}async resize(){!this.isConnected||this.offsetParent==null||await this._renderer?.resize()}async presize(e,t){if(!this.isConnected||this.offsetParent==null||!this._renderer||!this._glCanvas)return;let i=this.getBoundingClientRect(),n=this._glCanvas.getBoundingClientRect();return await this._renderer.presize(Math.max(0,n.width+(e-i.width)),Math.max(0,n.height+(t-i.height)))}restyle(){this._renderer?.invalidateTheme()}async deselect(){this._renderer?.deselect()}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._columnsConfig=t??{},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(this._columnsConfig)}delete(){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 Ve(...r){let e=new Set(r.length>0?r:$.map(i=>i.name)),t=[];$.forEach(i=>{if(e.has(i.name)){let n=`perspective-viewer-charts-${i.tag}`;if(customElements.get(n)){t.push(n);return}customElements.define(n,class extends N{_chartType=i;static _chartType=i}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(n)})}}),t.length>0&&console.warn(`viewer-charts plugins already registered (${t.length}); skipping duplicate registration (Perspective was loaded more than once on this page).`)}Ve();export{w as PerspectiveSelectDetail,Ve as register};
|
|
1
|
+
var R="Series Charts",V="Cartesian Charts",Y="Hierarchical Charts",te="Financial Charts",G="Map Charts",Le=["X Axis"],P=["Y Axis"],x="select",y="toggle";var b=["legend_mode","legend_size_mode","legend_width_px","legend_height_px","legend_anchor","legend_x","legend_y","legend_opacity"],_=["tooltip_max_column_px","tooltip_opacity"],E=["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",...b,..._],S={facet_mode:"overlay"},$={...S,include_zero:!0},ie=["facet_mode","facet_zoom_mode","domain_mode","line_width_px","point_size_px",...b,..._],ne=["facet_mode","series_zoom_mode","domain_mode","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px",..._],re=[...b,..._],Pe=["facet_zoom_mode",...b,..._],q=["facet_mode","facet_zoom_mode","domain_mode","map_tile_provider","map_tile_alpha","numeric_axes",...b,..._],Be=[...q,"point_size_px"],ke=[...q,"line_width_px"],De=[...q,"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",...b,..._];function m(l,e,t,i,n,r,o,a){return{name:l,tag:e,category:t,selectMode:i,initial:{count:n,names:r},max_cells:a?.max_cells??1e7,max_columns:a?.max_columns??1e4,applicable_plugin_fields:o,...a?.default_chart_type?{default_chart_type:a.default_chart_type}:{},...a?.plugin_field_defaults?{plugin_field_defaults:a.plugin_field_defaults}:{},...a?.group_by_role?{group_by_role:a.group_by_role}:{},...a?.split_by_role?{split_by_role:a.split_by_role}:{},...a?.connects_row_order?{connects_row_order:a.connects_row_order}:{}}}var le=["Open","Close","High","Low","Tooltip"],oe=["Size","Color","Tooltip"],B={group_by_role:"X Axis",split_by_role:"Series"},We={group_by_role:"Y Axis",split_by_role:"Series"},X={},se={group_by_role:"Hierarchy",split_by_role:"Facets"},ze={group_by_role:"X Axis",split_by_role:"Y Axis"},ae={group_by_role:"X Axis",split_by_role:"Series"},j={},Oe=[m("X Bar","x-bar",R,x,1,Le,E,{...We,default_chart_type:"bar",plugin_field_defaults:$}),m("Y Bar","y-bar",R,x,1,P,E,{...B,default_chart_type:"bar",plugin_field_defaults:$}),m("Y Line","y-line",R,x,1,P,E,{...B,default_chart_type:"line",plugin_field_defaults:S}),m("Y Scatter","y-scatter",R,x,1,P,E,{...B,default_chart_type:"scatter",plugin_field_defaults:S}),m("Y Area","y-area",R,x,1,P,E,{...B,default_chart_type:"area",plugin_field_defaults:$}),m("X/Y Scatter","scatter",V,y,2,["X Axis","Y Axis","Color","Size","Label","Tooltip"],ie,{...X}),m("X/Y Line","line",V,x,2,["X Axis","Y Axis","Tooltip"],ie,{...X,connects_row_order:!0}),m("Density","density",V,y,2,["X Axis","Y Axis","Color","Tooltip"],Ne,{...X}),m("Treemap","treemap",Y,y,1,oe,re,{...se,plugin_field_defaults:{legend_mode:"sidebar"}}),m("Sunburst","sunburst",Y,y,1,oe,re,{...se}),m("Heatmap","heatmap",Y,x,1,["Color"],Pe,{...ze,plugin_field_defaults:{legend_mode:"sidebar"}}),m("Candlestick","candlestick",te,y,1,le,ne,{...ae,default_chart_type:"candlestick",plugin_field_defaults:S}),m("OHLC","ohlc",te,y,1,le,ne,{...ae,default_chart_type:"ohlc",plugin_field_defaults:S}),m("Map Scatter","map-scatter",G,y,2,["Longitude","Latitude","Color","Size","Label","Tooltip"],Be,{...j}),m("Map Line","map-line",G,x,2,["Longitude","Latitude","Tooltip"],ke,{...j,connects_row_order:!0}),m("Map Density","map-density",G,y,2,["Longitude","Latitude","Color","Tooltip"],De,{...j})],Z=Oe;function k(l){let e=l.trim();if(e.startsWith("#")){let i=e.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 t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1]/255,+t[2]/255,+t[3]/255]:[.5,.5,.5]}function F(l){let e=t=>Math.round(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0");return`#${e(l[0])}${e(l[1])}${e(l[2])}`}var M=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}];function ue(l){if(!l)return M.slice();let e=l.trim();if(!e)return M.slice();let t=e.indexOf("(");if(t<0||!/^linear-gradient\s*\(/i.test(e))return M.slice();let i=e.lastIndexOf(")");if(i<=t)return M.slice();let n=e.substring(t+1,i),r=[],o=0,a=0;for(let u=0;u<n.length;u++){let f=n[u];f==="("?o++:f===")"?o--:f===","&&o===0&&(r.push(n.substring(a,u)),a=u+1)}r.push(n.substring(a));let s=[],h=0;if(r.length>0){let u=r[0].trim().toLowerCase();(u.startsWith("to ")||/^[-\d.]+(deg|rad|grad|turn)/.test(u))&&(h=1)}for(let u=h;u<r.length;u++){let f=r[u].trim();if(!f)continue;let d=f.match(/\s([\-\d.]+)%\s*$/),w=d?f.substring(0,d.index).trim():f,H=d?parseFloat(d[1])/100:null;try{let A=k(w);s.push({color:A,offset:H})}catch{}}if(s.length===0)return M.slice();if(s.length===1){let[u,f,d]=s[0].color;return[{offset:0,color:[u,f,d,1]},{offset:1,color:[u,f,d,1]}]}s[0].offset===null&&(s[0].offset=0),s[s.length-1].offset===null&&(s[s.length-1].offset=1);for(let u=1;u<s.length-1;u++){if(s[u].offset!==null)continue;let f=u+1;for(;f<s.length&&s[f].offset===null;)f++;let d=s[u-1].offset,w=s[f].offset,H=f-(u-1);for(let A=u;A<f;A++)s[A].offset=d+(A-(u-1))/H*(w-d);u=f-1}let c=0;return s.map(u=>{let f=Math.max(c,Math.min(1,u.offset));return c=f,{offset:f,color:[u.color[0],u.color[1],u.color[2],1]}})}function Ue(l){return`${Math.round(Math.max(0,Math.min(1,l))*1e3)/10}%`}function he(l){return`linear-gradient(to right, ${[...l].sort((t,i)=>t.offset-i.offset).map(t=>`${F([t.color[0],t.color[1],t.color[2]])} ${Ue(t.offset)}`).join(", ")})`}function ce(l){return`linear-gradient(to right, ${l.map(F).join(", ")})`}function fe(l,e){if(l.length===0)return[0,0,0,1];if(e<=l[0].offset)return l[0].color.slice();let t=l[l.length-1];if(e>=t.offset)return t.color.slice();let i=0,n=l.length-1;for(;n-i>1;){let h=i+n>>1;l[h].offset<=e?i=h:n=h}let r=l[i],o=l[n],a=o.offset-r.offset,s=a>0?(e-r.offset)/a:0;return[r.color[0]+(o.color[0]-r.color[0])*s,r.color[1]+(o.color[1]-r.color[1])*s,r.color[2]+(o.color[2]-r.color[2])*s,r.color[3]+(o.color[3]-r.color[3])*s]}var de=":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);z-index:10;border-radius:3px;padding:3px;line-height:16px;position:absolute;overflow-y:auto}";var me=[{id:"osm",label:"OpenStreetMap",template:"https://tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"\xA9 OpenStreetMap contributors",tile_size:256,max_zoom:19},{id:"versatiles-satellite",label:"Satellite (VersaTiles)",template:"https://tiles.versatiles.org/tiles/satellite/{z}/{x}/{y}",attribution:"\xA9 VersaTiles (versatiles.org/sources)",tile_size:256,max_zoom:12}];var K=class{constructor(e,t,i,n=256,r=19,o=[]){this.id=e;this.template=t;this.attribution=i;this.tileSize=n;this.maxZoom=r;this.subdomains=o}urlFor(e,t,i){let n=this.template.replace("{z}",String(e)).replace("{x}",String(t)).replace("{y}",String(i));if(this.subdomains.length>0){let r=(t+i)%this.subdomains.length;n=n.replace("{s}",this.subdomains[r])}return n}};function ge(l){if(typeof l!="object"||l===null)throw new TypeError("TileSourceSpec must be an object");let e=l,t=c=>{let g=e[c];if(typeof g!="string"||g.length===0)throw new TypeError(`TileSourceSpec.${c} must be a non-empty string`);return g},i=t("id"),n=t("label"),r=t("template"),o=t("attribution");for(let c of["{z}","{x}","{y}"])if(!r.includes(c))throw new TypeError(`TileSourceSpec.template must contain "${c}"`);let a=e.subdomains??[];if(!Array.isArray(a)||a.some(c=>typeof c!="string"||c.length===0))throw new TypeError("TileSourceSpec.subdomains must be an array of non-empty strings");let s=Object.freeze([...a]);if(r.includes("{s}")&&s.length===0)throw new TypeError('TileSourceSpec.template uses "{s}" but no subdomains were given');let h=(c,g)=>{let u=e[c];if(u===void 0)return g;if(typeof u!="number"||!Number.isFinite(u)||u<=0)throw new TypeError(`TileSourceSpec.${c} must be a positive number`);return u};return Object.freeze({id:i,label:n,template:r,subdomains:s,attribution:o,tile_size:h("tile_size",256),max_zoom:h("max_zoom",19)})}function Ye(l){let e=2166136261;for(let t=0;t<l.length;t++)e^=l.charCodeAt(t),e=Math.imul(e,16777619);return(e>>>0).toString(16)}var J=class{_specs=new Map;constructor(e){for(let t of e){let i=ge(t);this._specs.set(i.id,i)}}register(e){let t=ge(e);return this._specs.set(t.id,t),t}list(){return[...this._specs.values()]}specFor(e){return this._specs.get(e)}sourceFor(e){let t=this._specs.get(e)??this._specs.values().next().value,i=Ye(`${t.template}\0${t.subdomains.join(",")}`);return new K(`${t.id}@${i}`,t.template,t.attribution,t.tile_size,t.max_zoom,t.subdomains)}},p=new J(me);function Ge(){return p.list()}var pe={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},_e={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:p.list()[0].id,map_tile_alpha:1,numeric_axes:!0,legend_mode:"auto",legend_size_mode:"auto",legend_width_px:0,legend_height_px:160,legend_anchor:"top-right",legend_x:0,legend_y:0,legend_opacity:.8,tooltip_max_column_px:160,tooltip_opacity:.8};var xe={notation:"compact",compactDisplay:"short",minimumFractionDigits:0,maximumFractionDigits:1},ye={dateStyle:"medium",timeStyle:"disabled"},be={dateStyle:"medium"};var D=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,o=i.clientY-n.top;i.preventDefault(),t({type:"wheel",mx:r,my:o,deltaY:i.deltaY})},this._onPointerDown=i=>{if(i.button!==0)return;let n=e.getBoundingClientRect(),r=i.clientX-n.left,o=i.clientY-n.top;e.setPointerCapture(i.pointerId),this._pointerId=i.pointerId,t({type:"pointerdown",mx:r,my:o,pointerId:i.pointerId})},this._onPointerMove=i=>{let n=e.getBoundingClientRect(),r=i.clientX-n.left,o=i.clientY-n.top;t({type:"pointermove",mx:r,my:o})},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}};var T=class{selected;row;column_names;removeConfigs;insertConfigs;panel;constructor(e,t,i,n,r,o){this.selected=e,this.row=t,this.column_names=i,this.removeConfigs=n,this.insertConfigs=r,this.panel=o}get removeFilters(){return this.removeConfigs.flatMap(e=>e.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(e=>e.filter??[])}};var $e=["--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 I(l){let e=getComputedStyle(l),t={};for(let i of $e){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 ve(){let l=[];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,o=r.getPropertyValue("font-family").trim(),a=r.getPropertyValue("src").trim();!o||!a||l.push({family:Xe(o),src:je(a,i),style:C(r,"font-style"),weight:C(r,"font-weight"),stretch:C(r,"font-stretch"),unicodeRange:C(r,"unicode-range"),variant:C(r,"font-variant"),featureSettings:C(r,"font-feature-settings"),display:C(r,"font-display")})}}return l}function C(l,e){return l.getPropertyValue(e).trim()||void 0}function Xe(l){if(l.length>=2){let e=l.charCodeAt(0),t=l.charCodeAt(l.length-1);if(e===t&&(e===34||e===39))return l.slice(1,-1)}return l}function je(l,e){return l.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,(t,i,n)=>{try{return`url(${new URL(n,e).href})`}catch{return t}})}var Ce={opacity:1,maxColumnPx:160};var we=/^[-+−]?[$€£¥]?\s?\d[\d., \s]*(?:[eE][-+]?\d+|[KMB%])?$/;var Ae=8;var N=class{_glCanvas;_parent;_div=null;constructor(e,t){this._glCanvas=e,this._parent=t}pin(e,t,i,n=Ce){this.dismiss();let r=document.createElement("div");r.className="webgl-tooltip",r.style.maxHeight=`${Math.round(i.cssHeight*.6)}px`,qe(r,e,n),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),r.style.left="-9999px",r.style.top="0px",this._parent.appendChild(r),this._div=r;let o=r.getBoundingClientRect().width,a=r.getBoundingClientRect().height,s=t.px+12,h=t.py-a-8;s+o>i.cssWidth&&(s=t.px-o-12),s<0&&(s=4),h<0&&(h=t.py+12),h+a>i.cssHeight&&(h=i.cssHeight-a-4),r.style.left=`${s}px`,r.style.top=`${h}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};function qe(l,e,t){let i=e.reduce((r,o)=>Math.max(r,o.length),0);if(l.style.display="grid",l.style.gridTemplateColumns=`repeat(${Math.max(1,i)}, minmax(0, max-content))`,l.style.columnGap=`${Ae}px`,t.opacity<1){let r=Math.max(0,Math.round(t.opacity*100));l.style.background=`color-mix(in srgb, var(--psp-charts--tooltip--background) ${r}%, transparent)`}let n=[];for(let r of e)if(!(r.length<=1))for(let o=1;o<r.length;o++){if(r[o]==="")continue;let a=we.test(r[o]);n[o]=(n[o]===void 0||n[o])&&a}for(let r of e){let o=r.length<=1;for(let a=0;a<Math.max(1,r.length);a++){let s=document.createElement("div");if(s.textContent=r[a]??"",s.style.maxWidth=`${t.maxColumnPx*(o?2:1)}px`,s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.style.whiteSpace="nowrap",o?s.style.gridColumn="1 / -1":n[a]&&(s.style.textAlign="right"),l.appendChild(s),o)break}}}var v="worker",Me="blit";var Te='var $s=Object.defineProperty;var mm=(e,t,n)=>t in e?$s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var fm=(e,t)=>{for(var n in t)$s(e,n,{get:t[n],enumerable:!0})};var p=(e,t,n)=>mm(e,typeof t!="symbol"?t+"":t,n);var ri,pr=G(()=>{ri="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 si,br=G(()=>{si="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 li,gr=G(()=>{li="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 ai,hr=G(()=>{ai="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 Wt,xr=G(()=>{Wt="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 Ci,yr=G(()=>{Ci="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 vi,_r=G(()=>{vi="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 Zs,js=G(()=>{Zs=`#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 Ks,qs=G(()=>{Ks=`#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 Ai,Cr=G(()=>{Ai="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 Li,vr=G(()=>{Li="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 Ti,Ar=G(()=>{Ti="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 wi,Lr=G(()=>{wi="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 Vm(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,l=i*o/2;return{xMin:s-l,xMax:s+l,yMin:e.yMin,yMax:e.yMax}}else{let s=(e.yMin+e.yMax)/2,l=n/o/2;return{xMin:e.xMin,xMax:e.xMax,yMin:s-l,yMax:s+l}}}var kt,Ri=G(()=>{"use strict";kt=class{constructor(){p(this,"he",1);p(this,"xe",1);p(this,"We",0);p(this,"ke",0);p(this,"Dt",0);p(this,"It",1);p(this,"Et",0);p(this,"Pt",1);p(this,"Qe",null);p(this,"ko",!1);p(this,"$i",!1);p(this,"ji",!1);p(this,"Bt",null);p(this,"Gt",null);p(this,"ui",null);p(this,"Zi",!1);p(this,"qi",0);p(this,"Ki",0);p(this,"tn",null);p(this,"nn",null);p(this,"on",null);p(this,"rn",null)}get lockedAxis(){return this.Qe}get scaleX(){return this.he}get scaleY(){return this.xe}set scaleX(t){this.he=t}set scaleY(t){this.xe=t}get normTranslateX(){return this.We}get normTranslateY(){return this.ke}set normTranslateX(t){this.We=t}set normTranslateY(t){this.ke=t}get baseXRange(){return this.It-this.Dt}get baseYRange(){return this.Pt-this.Et}setBaseDomain(t,n,i,o){let r=n-t;if(this.isXDefault()||!this.$i)this.Dt=t,this.It=n;else{let l=this.It-this.Dt,a=(this.Dt+this.It)/2+this.We*l;this.Dt=t,this.It=n,this.We=r>0?(a-(t+n)/2)/r:0}let s=o-i;if(this.isYDefault()||!this.ji)this.Et=i,this.Pt=o;else{let l=this.Pt-this.Et,a=(this.Et+this.Pt)/2+this.ke*l;this.Et=i,this.Pt=o,this.ke=s>0?(a-(i+o)/2)/s:0}}pinAxis(t){t==="x"?this.$i=!0:this.ji=!0}unpinAxis(t){t==="x"?this.$i=!1:this.ji=!1}configure(t){this.Qe=t.lockAxis??null,this.ko=t.lockAspect??!1,this.Qe==="x"?(this.he=1,this.We=0):this.Qe==="y"&&(this.xe=1,this.ke=0)}isXDefault(){return this.he===1&&this.We===0}isYDefault(){return this.xe===1&&this.ke===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.It-this.Dt,n=this.Pt-this.Et,i=t/this.he,o=n/this.xe,r=(this.Dt+this.It)/2+this.We*t,s=(this.Et+this.Pt)/2+this.ke*n,l={xMin:r-i/2,xMax:r+i/2,yMin:s-o/2,yMax:s+o/2};return this.ko&&this.Gt?Vm(l,this.Gt.e):l}attach(t,n,i){this.detach(),this.Bt=t,this.Gt=n,this.ui=i,this.tn=o=>{o.preventDefault();let r=t.getBoundingClientRect(),s=o.clientX-r.left,l=o.clientY-r.top,a=this.Gt.e;if(s<a.x||s>a.x+a.width||l<a.y||l>a.y+a.height)return;let u=(s-a.x)/a.width,m=(l-a.y)/a.height,f=this.he,c=this.xe,d=Math.pow(1.1,-o.deltaY/100);this.Qe!=="x"&&(this.he=Math.max(1,Math.min(1e5,this.he*d))),this.Qe!=="y"&&(this.xe=Math.max(1,Math.min(1e5,this.xe*d))),this.Qe!=="x"&&f!==this.he&&(this.We+=(u-.5)*(1/f-1/this.he)),this.Qe!=="y"&&c!==this.xe&&(this.ke+=(.5-m)*(1/c-1/this.xe)),this.ui()},this.nn=o=>{if(o.button!==0)return;let r=t.getBoundingClientRect(),s=o.clientX-r.left,l=o.clientY-r.top,a=this.Gt.e;s>=a.x&&s<=a.x+a.width&&l>=a.y&&l<=a.y+a.height&&(this.Zi=!0,this.qi=o.clientX,this.Ki=o.clientY,t.setPointerCapture(o.pointerId))},this.on=o=>{if(!this.Zi)return;let r=o.clientX-this.qi,s=o.clientY-this.Ki;this.qi=o.clientX,this.Ki=o.clientY;let l=this.Gt.e;this.Qe!=="x"&&l.width>0&&(this.We-=r/(l.width*this.he)),this.Qe!=="y"&&l.height>0&&(this.ke+=s/(l.height*this.xe)),this.ui()},this.rn=()=>{this.Zi=!1},t.addEventListener("wheel",this.tn,{passive:!1}),t.addEventListener("pointerdown",this.nn),t.addEventListener("pointermove",this.on),t.addEventListener("pointerup",this.rn)}updateLayout(t){this.Gt=t}detach(){this.Bt&&(this.tn&&this.Bt.removeEventListener("wheel",this.tn),this.nn&&this.Bt.removeEventListener("pointerdown",this.nn),this.on&&this.Bt.removeEventListener("pointermove",this.on),this.rn&&this.Bt.removeEventListener("pointerup",this.rn)),this.Bt=null,this.ui=null}reset(){this.he=1,this.xe=1,this.We=0,this.ke=0}serialize(){return{scaleX:this.he,scaleY:this.xe,normTranslateX:this.We,normTranslateY:this.ke}}restore(t){this.he=t.scaleX,this.xe=t.scaleY,this.We=t.normTranslateX,this.ke=t.normTranslateY}}});function ie(e){return{opacity:e.tooltip_opacity,maxColumnPx:e.tooltip_max_column_px}}function Fi(e,t,n){let i=n*2+wr,o=[],r=[],s=[],l=0;for(let m of t){if(m.length<=1){let c=nl(e,m[0]??"",i);s.push([c]),l=Math.max(l,e.measureText(c).width);continue}let f=[];for(let c=0;c<m.length;c++){let d=m[c]??"",b=nl(e,d,n);if(f.push(b),o[c]=Math.max(o[c]??0,e.measureText(b).width),c>=1&&d!==""){let g=zm.test(d);r[c]=(r[c]===void 0||r[c])&&g}}s.push(f)}let a=0;for(let m=0;m<o.length;m++)a+=o[m]+(m>0?wr:0);let u=Math.max(l,a);return{rows:s,colWidths:o,colRightAlign:o.map((m,f)=>(r[f]??!1)&&f>=1),boxW:u+Cn*2,boxH:t.length*il+Cn*2-4}}function Si(e,t,n,i,o,r){let{rows:s,colWidths:l,colRightAlign:a,boxW:u,boxH:m}=t;e.globalAlpha=Math.min(1,Math.max(0,r)),e.fillStyle=o.mi,e.strokeStyle=o.No,e.lineWidth=1,e.beginPath(),e.rect(n,i,u,m),e.fill(),e.stroke(),e.globalAlpha=1,e.fillStyle=o.Oo,e.textBaseline="top";for(let f=0;f<s.length;f++){let c=s[f],d=i+Cn+f*il;if(c.length<=1){e.textAlign="left",e.fillText(c[0],n+Cn,d);continue}let b=n+Cn;for(let g=0;g<c.length;g++){let h=l[g]??0;a[g]?(e.textAlign="right",e.fillText(c[g],b+h,d)):(e.textAlign="left",e.fillText(c[g],b,d)),b+=h+wr}}e.textAlign="left"}function nl(e,t,n){if(e.measureText(t).width<=n)return t;let i=0,o=t.length;for(;i<o;){let r=i+o+1>>1;e.measureText(t.slice(0,r)+"\\u2026").width<=n?i=r:o=r-1}return t.slice(0,i)+"\\u2026"}var Qe,zm,il,Cn,wr,be=G(()=>{"use strict";Qe={opacity:1,maxColumnPx:160};zm=/^[-+\u2212]?[$\u20AC\xA3\xA5]?\\s?\\d[\\d.,\xA0\u202F\\s]*(?:[eE][-+]?\\d+|[KMB%])?$/,il=16,Cn=8,wr=8});function rl(e){return e&&!("format"in e)?e:void 0}function $m(e,t){let n={};for(let[o,r]of Object.entries(t??{}))r!=null&&(n[o]=r);let i={...e};return("minimumFractionDigits"in n||"maximumFractionDigits"in n)&&(delete i.minimumFractionDigits,delete i.maximumFractionDigits),("minimumSignificantDigits"in n||"maximumSignificantDigits"in n)&&(delete i.minimumSignificantDigits,delete i.maximumSignificantDigits),Object.assign(i,n)}function Mr(e,t,n){let i=n??Ym[e]??{},o=t?$m(i,t):i;return new Intl.NumberFormat(navigator.languages,o)}function Rr(e,t){if(e=e??t,!e||!("format"in e)){let i=rl(e),o={timeZone:i?.timeZone??void 0,dateStyle:i?.dateStyle==="disabled"?void 0:i?.dateStyle??ol.dateStyle,timeStyle:i?.timeStyle==="disabled"?void 0:i?.timeStyle??ol.timeStyle};return new Intl.DateTimeFormat(navigator.languages,o)}let n={timeZone:e.timeZone??void 0,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(n.year=e.year??"2-digit"),e.month!=="disabled"&&(n.month=e.month??"numeric"),e.day!=="disabled"&&(n.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(n.weekday=e.weekday),e.hour!=="disabled"&&(n.hour=e.hour??"numeric"),e.minute!=="disabled"&&(n.minute=e.minute??"numeric"),e.second!=="disabled"&&(n.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,n)}function sl(e,t){let n=rl(e??t),i={timeZone:"utc",dateStyle:n?.dateStyle==="disabled"?void 0:n?.dateStyle??Xm.dateStyle};return new Intl.DateTimeFormat(navigator.languages,i)}function Fr(e){return e.split("|").at(-1)??e}var Ym,ol,Xm,ll=G(()=>{"use strict";Ym={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},ol={dateStyle:"short",timeStyle:"medium"},Xm={dateStyle:"short"}});var Ii,al=G(()=>{"use strict";Ii=class{constructor(t,n=128){p(this,"ln");p(this,"g",new Map);p(this,"Re",new Map);p(this,"Uo");this.ln=t,this.Uo=n}async fetchRow(t){if(!this.ln)throw new Error("LazyRowFetcher disposed");let n=this.g.get(t);if(n)return this.g.delete(t),this.g.set(t,n),n;let i=this.Re.get(t);if(i)return i;let o=this.Tr(t);this.Re.set(t,o);try{let r=await o;if(!this.ln)return r;if(this.g.set(t,r),this.g.size>this.Uo){let s=this.g.keys().next().value;s!==void 0&&this.g.delete(s)}return r}finally{this.Re.delete(t)}}async Tr(t){let n=this.ln;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,l)=>{for(let a=0;a<o.length;a++){let u=o[a];if(u.startsWith("__"))continue;let m=r[a],f=s[a],c=l[a];(f?!(f[0]>>0&1):!1)?i.set(u,null):c?i.set(u,c[m[0]]):i.set(u,m[0])}}),i}dispose(){this.ln=null,this.g.clear(),this.Re.clear()}get isDisposed(){return this.ln===null}}});var Sr,Dr,ul,ml=G(()=>{"use strict";Sr={notation:"compact",compactDisplay:"short",minimumFractionDigits:0,maximumFractionDigits:1},Dr={dateStyle:"medium",timeStyle:"disabled"},ul={dateStyle:"medium"}});var cl,fl=G(()=>{cl=[{id:"osm",label:"OpenStreetMap",template:"https://tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"\\xA9 OpenStreetMap contributors",tile_size:256,max_zoom:19},{id:"versatiles-satellite",label:"Satellite (VersaTiles)",template:"https://tiles.versatiles.org/tiles/satellite/{z}/{x}/{y}",attribution:"\\xA9 VersaTiles (versatiles.org/sources)",tile_size:256,max_zoom:12}]});function dl(e){if(typeof e!="object"||e===null)throw new TypeError("TileSourceSpec must be an object");let t=e,n=m=>{let f=t[m];if(typeof f!="string"||f.length===0)throw new TypeError(`TileSourceSpec.${m} must be a non-empty string`);return f},i=n("id"),o=n("label"),r=n("template"),s=n("attribution");for(let m of["{z}","{x}","{y}"])if(!r.includes(m))throw new TypeError(`TileSourceSpec.template must contain "${m}"`);let l=t.subdomains??[];if(!Array.isArray(l)||l.some(m=>typeof m!="string"||m.length===0))throw new TypeError("TileSourceSpec.subdomains must be an array of non-empty strings");let a=Object.freeze([...l]);if(r.includes("{s}")&&a.length===0)throw new TypeError(\'TileSourceSpec.template uses "{s}" but no subdomains were given\');let u=(m,f)=>{let c=t[m];if(c===void 0)return f;if(typeof c!="number"||!Number.isFinite(c)||c<=0)throw new TypeError(`TileSourceSpec.${m} must be a positive number`);return c};return Object.freeze({id:i,label:o,template:r,subdomains:a,attribution:s,tile_size:u("tile_size",256),max_zoom:u("max_zoom",19)})}function Zm(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16)}var Ir,Er,et,Ei=G(()=>{"use strict";fl();Ir=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}};Er=class{constructor(t){p(this,"an",new Map);for(let n of t){let i=dl(n);this.an.set(i.id,i)}}register(t){let n=dl(t);return this.an.set(n.id,n),n}list(){return[...this.an.values()]}specFor(t){return this.an.get(t)}sourceFor(t){let n=this.an.get(t)??this.an.values().next().value,i=Zm(`${n.template}\\0${n.subdomains.join(",")}`);return new Ir(`${n.id}@${i}`,n.template,n.attribution,n.tile_size,n.max_zoom,n.subdomains)}},et=new Er(cl)});var pl,Ue,Pr=G(()=>{"use strict";Ei();pl={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},Ue={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:et.list()[0].id,map_tile_alpha:1,numeric_axes:!0,legend_mode:"auto",legend_size_mode:"auto",legend_width_px:0,legend_height_px:160,legend_anchor:"top-right",legend_x:0,legend_y:0,legend_opacity:.8,tooltip_max_column_px:160,tooltip_opacity:.8}});function He(e,t,n,i,o,r,s={}){if(!e)return;let l=e.getContext("2d");if(!l)return;l.save(),l.setTransform(1,0,0,1,0,0),l.scale(r,r),l.font=`11px ${o.fontFamily}`;let a=Fi(l,n,s.maxColumnPx??Qe.maxColumnPx),{boxW:u,boxH:m}=a,f=t.px+12,c=t.py-m-8;f+u>i.cssWidth&&(f=t.px-u-12),c<0&&(c=t.py+12),c+m>i.cssHeight&&(c=i.cssHeight-m-4),s.crosshair&&(l.strokeStyle=o.Ct,l.globalAlpha=.3,l.lineWidth=1,l.setLineDash([4,4]),l.beginPath(),l.moveTo(t.px,i.e.y),l.lineTo(t.px,i.e.y+i.e.height),l.moveTo(i.e.x,t.py),l.lineTo(i.e.x+i.e.width,t.py),l.stroke(),l.setLineDash([]),l.globalAlpha=1),s.highlightRadius&&s.highlightRadius>0&&(l.strokeStyle=o.Ct,l.globalAlpha=.8,l.lineWidth=2,l.beginPath(),l.arc(t.px,t.py,s.highlightRadius,0,Math.PI*2),l.stroke(),l.globalAlpha=1),n.length>0&&Si(l,a,f,c,o,s.opacity??Qe.opacity),l.restore()}var Pi,Nt=G(()=>{"use strict";be();Pi=class{constructor(){p(this,"Xe",null);p(this,"un",0);p(this,"mn",null);p(this,"Mn",null);p(this,"_t",!1)}get isPinned(){return this._t}setHost(t){this._t&&(this.Mn?.dismiss(),this._t=!1),this.Mn=t}setCursor(t){this.Mn?.setCursor(t)}attach(t){this.detach(),this.Xe=t}detach(){this.un&&(cancelAnimationFrame(this.un),this.un=0),this.mn!==null&&(clearTimeout(this.mn),this.mn=null),this.Xe=null}dispatchHover(t,n){if(this._t||!this.Xe||this.un||this.mn!==null)return;let i=()=>{this.un=0,this.mn=null,this.Xe?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.un=requestAnimationFrame(i):this.mn=setTimeout(i,16)}dispatchLeave(){this._t||!this.Xe||this.Xe.onLeave()}dispatchClick(t,n){if(this.Xe&&!this.Xe.onClickPre?.(t,n)){if(this._t){let i=this.Xe;this.dismiss(),i.onUnpin?.();return}this.Xe.onPin?.(t,n)}}dispatchDblClick(t,n){this.Xe?.onDblClick?.(t,n)}pin(t,n,i,o=Qe){t.length!==0&&(this.Mn?.pin(t,n,i,o),this._t=!0)}dismiss(){this.Mn?.dismiss(),this._t=!1}}});function _e(e,t,n){return Math.min(n,Math.max(t,e))}function Br(e){return Number.isFinite(e)?_e(e,0,1):0}function gl(e,t){if(t<=0)return 0;let n=Math.round(e);return n<=0?0:n>=Math.round(t)?1:Br(n/t)}function hl(e){return e==="top-right"||e==="bottom-right"}function xl(e){return e==="bottom-left"||e==="bottom-right"}function we(e,t){return e.legend_width_px>0?_e(e.legend_width_px,yt,Gi):t}function se(e,t){return e.legend_mode!=="auto"?e.legend_mode:t<=tf?"floating":"sidebar"}function nt(e,t,n=80,i=0){return!t||se(e,i)!=="sidebar"?16:we(e,n)}function Ni(e,t,n,i=0){return!t||se(e,i)!=="sidebar"?0:we(e,n)}function Ot(e){return Math.round(e*1e4)/1e4}var yt,Gi,Bi,qm,Km,tt,vn,yl,Gr,ki,Wr,_l,Jm,xt,bl,Qm,ef,tf,nf,Wi,Ve=G(()=>{"use strict";Pr();yt=48,Gi=512,Bi=48,qm=160,Km=160,tt=18,vn=18,yl=8,Gr=12,ki=8,Wr=16,_l=16,Jm=10,xt=5,bl=12,Qm=10,ef=3;tf=7;nf=["legend_mode","legend_size_mode","legend_width_px","legend_height_px","legend_anchor","legend_x","legend_y","legend_opacity"],Wi=class e{constructor(){p(this,"ye",null);p(this,"Wt",0);p(this,"$e",null);p(this,"fn",!1);p(this,"Ji",!1);p(this,"Ho","")}clampScroll(t,n){return this.Wt=_e(this.Wt,0,Math.max(0,n-t)),this.Wt}setPainted(t){this.ye=t}clearPainted(){this.ye=null}floatingBox(t,n,i,o){let r=t.legend_size_mode!=="fixed",s=r?o?.boxWidth?.()??0:0,l=r?o?.entryCount??0:0,a=s>0?s:t.legend_width_px>0&&!r?t.legend_width_px:qm,u=l>0?tt+ki+l*vn:t.legend_height_px>0&&!r?t.legend_height_px:Km,m=_e(u,Bi,Math.max(Bi,i-8)),f=m<u,c=_e(a+(f&&s>0?Jm:0),yt,Math.max(yt,Math.floor(n/2))),d=Math.max(0,n-c),b=Math.max(0,i-m),g=Br(t.legend_x)*d,h=Br(t.legend_y)*b;return{x:Math.round(hl(t.legend_anchor)?d-g:g),y:Math.round(xl(t.legend_anchor)?b-h:h),width:c,height:m}}reconcileConfig(t,n){if(this.$e){for(let i of nf)if(t[i]!==n[i]){this.$e=null;return}}}cancelGesture(){this.$e=null,this.fn=!1}handleEvent(t,n){switch(t.type){case"wheel":return this.tn(t.mx,t.my,t.deltaY,n);case"pointerdown":return this.nn(t.mx,t.my,n);case"pointermove":return this.on(t.mx,t.my,n);case"pointerup":return this.rn(n);case"click":return this.wr(t.mx,t.my,n);case"dblclick":return this.Mr(t.mx,t.my,n);case"pointerleave":return this.Ji=!1,this.fi("",n),!1}}hitTest(t,n){let i=this.ye;if(!i)return"none";let o=i.box;if(i.mode==="floating"){let s=t>=o.x-xt&&t<=o.x+o.width+xt,l=n>=o.y-xt&&n<=o.y+o.height+xt;if(!s||!l)return"none";let a=Math.abs(t-o.x)<=xt,u=Math.abs(t-(o.x+o.width))<=xt,m=Math.abs(n-(o.y+o.height))<=xt;return u&&n>=o.y+o.height-bl||m&&t>=o.x+o.width-bl?"resize-se":u?"resize-e":a?"resize-w":m?"resize-s":this.Vo(t,n)?"scrollbar":n<=o.y+tt?"move":"body"}let r=n>=o.y&&n<=o.y+o.height;return r&&t>=o.x-14&&t<=o.x+2?"resize-w":r&&t>=o.x&&t<=o.x+o.width?this.Vo(t,n)?"scrollbar":"body":"none"}zo(){let t=this.ye;return!!t&&t.contentHeight>t.content.height+.5}Vo(t,n){let i=this.ye;if(!i||!this.zo())return!1;let o=i.content;return t>=o.x+o.width-Qm&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height}tn(t,n,i,o){return this.$e?!0:this.hitTest(t,n)==="none"?!1:(this.zo()&&this.Yo(this.Wt+i,o),!0)}nn(t,n,i){let o=this.hitTest(t,n);if(o==="none")return!1;let r=this.ye;if(this.fn=!1,o==="scrollbar")return this.$e={kind:"scrollbar",startMy:n,startScroll:this.Wt},!0;let s={legend_size_mode:i.cfg.legend_size_mode,legend_width_px:i.cfg.legend_width_px,legend_height_px:i.cfg.legend_height_px,legend_x:i.cfg.legend_x,legend_y:i.cfg.legend_y};return o==="resize-w"||o==="resize-e"||o==="resize-s"||o==="resize-se"?(this.$e={kind:o,startMx:t,startMy:n,startBox:{...r.box},startGutter:r.sidebarGutter??r.box.width,snapshot:s},this.fi(o==="resize-s"?"ns-resize":o==="resize-se"?"nwse-resize":"ew-resize",i),!0):(r.mode==="floating"&&(this.$e={kind:"move",startMx:t,startMy:n,startBox:{...r.box},moved:!1,snapshot:s}),!0)}on(t,n,i){if(this.$e)return this.Rr(t,n,i),!0;let o=this.hitTest(t,n),r=o!=="none";return r&&!this.Ji&&i.dispatchLeave(),this.Ji=r,this.fi(e.Fr(o),i),r&&this.ye.mode==="floating"}rn(t){let n=this.$e;if(!n)return!1;if(this.$e=null,n.kind==="scrollbar")return this.fn=!0,!0;if(n.kind==="move"&&!n.moved)return!0;this.fn=!0;let i={},o=t.cfg;return o.legend_size_mode!==n.snapshot.legend_size_mode&&(i.legend_size_mode=o.legend_size_mode),o.legend_width_px!==n.snapshot.legend_width_px&&(i.legend_width_px=Math.round(o.legend_width_px)),o.legend_height_px!==n.snapshot.legend_height_px&&(i.legend_height_px=Math.round(o.legend_height_px)),Ot(o.legend_x)!==Ot(n.snapshot.legend_x)&&(i.legend_x=Ot(o.legend_x)),Ot(o.legend_y)!==Ot(n.snapshot.legend_y)&&(i.legend_y=Ot(o.legend_y)),Object.keys(i).length>0&&t.postDelta(i),!0}Mr(t,n,i){let o=this.hitTest(t,n);if(o==="none")return!1;let r=o==="resize-w"||o==="resize-e"||o==="resize-se",s=o==="resize-s"||o==="resize-se";if(!r&&!s)return this.ye.mode==="floating";let l=i.cfg,a={};return this.ye.mode==="floating"&&l.legend_size_mode!==Ue.legend_size_mode&&(l.legend_size_mode=Ue.legend_size_mode,a.legend_size_mode=l.legend_size_mode),r&&l.legend_width_px!==Ue.legend_width_px&&(l.legend_width_px=Ue.legend_width_px,a.legend_width_px=l.legend_width_px),s&&l.legend_height_px!==Ue.legend_height_px&&(l.legend_height_px=Ue.legend_height_px,a.legend_height_px=l.legend_height_px),Object.keys(a).length>0&&(i.repaint(this.ye.mode==="sidebar"),i.postDelta(a)),!0}wr(t,n,i){if(this.fn)return this.fn=!1,!0;let o=this.hitTest(t,n);if(o==="none")return!1;if(o==="scrollbar")return!0;if(this.ye.mode==="floating"){for(let r of i.legendRects){let s=r.rect;if(t>=s.x&&t<=s.x+s.width&&n>=s.y&&n<=s.y+s.height)return!1}return!0}return!1}Rr(t,n,i){let o=this.$e,r=i.cfg,{cssWidth:s,cssHeight:l}=i,a=Math.max(yt,Math.floor(s/2));switch(o.kind){case"scrollbar":{let u=this.ye;if(!u||u.content.height<=0)return;let m=u.contentHeight/u.content.height;this.Yo(o.startScroll+(n-o.startMy)*m,i);return}case"move":{if(!o.moved){if(Math.hypot(t-o.startMx,n-o.startMy)<ef)return;o.moved=!0,this.fi("grabbing",i)}let u=o.startBox.width,m=o.startBox.height,f=_e(o.startBox.x+(t-o.startMx),0,Math.max(0,s-u)),c=_e(o.startBox.y+(n-o.startMy),0,Math.max(0,l-m));this.ci(i,f,c,u,m),i.repaint(!1);return}case"resize-w":{if(this.ye?.mode==="sidebar"){r.legend_width_px=_e(Math.round(o.startGutter+(o.startMx-t)),yt,Math.min(Gi,a)),i.repaint(!0);return}this.Qi(i,o.startBox);let u=o.startBox.x+o.startBox.width,m=_e(Math.round(o.startBox.width+(o.startMx-t)),yt,Math.min(Gi,a));r.legend_width_px=m,this.ci(i,u-m,o.startBox.y,m,o.startBox.height),i.repaint(!1);return}case"resize-e":case"resize-se":{this.Qi(i,o.startBox);let u=_e(Math.round(o.startBox.width+(t-o.startMx)),yt,Math.min(Gi,a));r.legend_width_px=u;let m=o.kind==="resize-se"?this.Xo(o.startBox,o.startMy,n,i):o.startBox.height;this.ci(i,o.startBox.x,o.startBox.y,u,m),i.repaint(!1);return}case"resize-s":{this.Qi(i,o.startBox);let u=this.Xo(o.startBox,o.startMy,n,i);this.ci(i,o.startBox.x,o.startBox.y,o.startBox.width,u),i.repaint(!1);return}}}Qi(t,n){t.cfg.legend_size_mode!=="fixed"&&(t.cfg.legend_size_mode="fixed",t.cfg.legend_width_px=Math.round(n.width),t.cfg.legend_height_px=Math.round(n.height))}Xo(t,n,i,o){let r=_e(Math.round(t.height+(i-n)),Bi,Math.max(Bi,o.cssHeight-8));return o.cfg.legend_height_px=r,r}ci(t,n,i,o,r){let s=Math.max(0,t.cssWidth-o),l=Math.max(0,t.cssHeight-r),a=t.cfg.legend_anchor;t.cfg.legend_x=gl(hl(a)?s-n:n,s),t.cfg.legend_y=gl(xl(a)?l-i:i,l)}Yo(t,n){let i=this.ye;if(!i)return;let o=_e(t,0,Math.max(0,i.contentHeight-i.content.height));o!==this.Wt&&(this.Wt=o,n.repaint(!1))}static Fr(t){switch(t){case"resize-w":case"resize-e":return"ew-resize";case"resize-s":return"ns-resize";case"resize-se":return"nwse-resize";case"move":return"grab";default:return""}}fi(t,n){t!==this.Ho&&(this.Ho=t,n.setCursor(t))}}});function Oi(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 kr=G(()=>{"use strict"});function Cl(e){if(!e)return _t.slice();let t=e.trim();if(!t)return _t.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return _t.slice();let i=t.lastIndexOf(")");if(i<=n)return _t.slice();let o=t.substring(n+1,i),r=[],s=0,l=0;for(let c=0;c<o.length;c++){let d=o[c];d==="("?s++:d===")"?s--:d===","&&s===0&&(r.push(o.substring(l,c)),l=c+1)}r.push(o.substring(l));let a=[],u=0;if(r.length>0){let c=r[0].trim().toLowerCase();(c.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)/.test(c))&&(u=1)}for(let c=u;c<r.length;c++){let d=r[c].trim();if(!d)continue;let b=d.match(/\\s([\\-\\d.]+)%\\s*$/),g=b?d.substring(0,b.index).trim():d,h=b?parseFloat(b[1])/100:null;try{let x=Oi(g);a.push({color:x,offset:h})}catch{}}if(a.length===0)return _t.slice();if(a.length===1){let[c,d,b]=a[0].color;return[{offset:0,color:[c,d,b,1]},{offset:1,color:[c,d,b,1]}]}a[0].offset===null&&(a[0].offset=0),a[a.length-1].offset===null&&(a[a.length-1].offset=1);for(let c=1;c<a.length-1;c++){if(a[c].offset!==null)continue;let d=c+1;for(;d<a.length&&a[d].offset===null;)d++;let b=a[c-1].offset,g=a[d].offset,h=d-(c-1);for(let x=c;x<d;x++)a[x].offset=b+(x-(c-1))/h*(g-b);c=d-1}let m=0;return a.map(c=>{let d=Math.max(m,Math.min(1,c.offset));return m=d,{offset:d,color:[c.color[0],c.color[1],c.color[2],1]}})}function Nr(e){let t=e.trim();if(t.startsWith("#")){let a=t.slice(1);return/^[0-9a-f]+$/i.test(a)?a.length===3||a.length===4?[parseInt(a[0]+a[0],16)/255,parseInt(a[1]+a[1],16)/255,parseInt(a[2]+a[2],16)/255]:a.length===6||a.length===8?[parseInt(a.slice(0,2),16)/255,parseInt(a.slice(2,4),16)/255,parseInt(a.slice(4,6),16)/255]:null:null}let n=t.match(/^rgba?\\(([^)]*)\\)$/i);if(!n)return null;let i=n[1].split("/")[0].split(/[\\s,]+/).filter(a=>a.length>0);if(i.length<3||i.length>4)return null;let o=a=>{let u=a.endsWith("%"),m=parseFloat(u?a.slice(0,-1):a);if(!isFinite(m))return null;let f=u?m/100*255:m;return Math.max(0,Math.min(255,Math.round(f)))/255},r=o(i[0]),s=o(i[1]),l=o(i[2]);return r===null||s===null||l===null?null:[r,s,l]}function vl(e){let t=e.trim().match(/^linear-gradient\\s*\\((.*)\\)$/is);if(!t)return null;let n=t[1],i=[],o=0,r=0;for(let l=0;l<n.length;l++){let a=n[l];a==="("?o++:a===")"?o--:a===","&&o===0&&(i.push(n.substring(r,l)),r=l+1)}i.push(n.substring(r));let s=[];for(let l=0;l<i.length;l++){let a=i[l].trim();if(!a)return null;let u=a.toLowerCase();if(l===0&&(u.startsWith("to ")||/^[-\\d.]+(deg|rad|grad|turn)$/.test(u)))continue;let m=a.match(/\\s([^\\s)]+)$/),f=a,c=null;if(m){let b=m[1];if(b.endsWith("%")){let g=parseFloat(b.slice(0,-1));if(!isFinite(g))return null;f=a.substring(0,m.index).trim(),c=g/100}else if(/^[-\\d.]/.test(b))return null}let d=Nr(f);if(!d)return null;s.push([d,c])}return s}function Al(e){let t=vl(e);if(!t||t.length<2)return null;let n=t.map(([,r])=>r),i=n.length-1;n[0]===null&&(n[0]=0),n[i]===null&&(n[i]=1);for(let r=1;r<i;r++){if(n[r]!==null)continue;let s=r+1;for(;n[s]===null;)s++;let l=n[r-1],a=n[s],u=s-(r-1);for(let m=r;m<s;m++)n[m]=l+(m-(r-1))/u*(a-l);r=s-1}let o=t.map(([r],s)=>({offset:Math.max(0,Math.min(1,n[s])),color:[r[0],r[1],r[2],1]}));return o.sort((r,s)=>r.offset-s.offset),o}function Ui(e){let t=vl(e);if(!t||t.length===0)return null;let n=[];for(let[i,o]of t){if(o!==null)return null;n.push(i)}return n}function Se(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],l=s.offset-r.offset,a=l>0?(t-r.offset)/l:0;return[r.color[0]+(s.color[0]-r.color[0])*a,r.color[1]+(s.color[1]-r.color[1])*a,r.color[2]+(s.color[2]-r.color[2])*a,r.color[3]+(s.color[3]-r.color[3])*a]}function Ct(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 Hi(e,t){if(!isFinite(e)||!isFinite(t)||e>=t)return[0,0];let n;return e>=0?n=t:t<=0?n=-e:n=Math.max(-e,t),n<=0?[0,0]:[-n,n]}function Ll(e){if(e.length===0)return _t.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 Tl(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=Se(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 _t,ge=G(()=>{"use strict";kr();_t=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}]});function of(e){return isFinite(e)?e<0?0:e>1?1:e:.5}function wl(e){return!isFinite(e)||e<0?1:e}function Ml(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=Cl(n),o=[];for(let r=1;;r++){let s=e[`--psp-charts--series-${r}--color`];if(!s)break;o.push(Oi(s))}return{fontFamily:t("--psp-charts--font-family",t("font-family","monospace")),backgroundColor:t("--psp--background-color","rgba(255, 255, 255, 1)"),Ct:t("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),Fe:t("--psp--color","rgba(180, 0, 0, 0.9)"),di:t("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),Rn:t("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),N:i,cn:t("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),eo:t("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),mi:t("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),Oo:t("--psp-charts--tooltip--color","#161616"),No:t("--psp-charts--tooltip--border-color","#fff"),pi:of(parseFloat(t("--psp-charts--area--opacity","0.85"))),$o:wl(parseFloat(t("--psp-charts--heatmap-gap--px","0"))),jo:wl(parseFloat(t("--psp-charts--sunburst-gap--px","1"))),Ne:o}}var Rl=G(()=>{"use strict";kr();ge()});function Fl(e,t,n){if(!n)return e;let i=t?.[n];if(!i)return e;let o=e,r=sf(i.gradient);r&&(o={...o,N:r});let s=rf(i.palette);return s&&(o={...o,Ne:s}),o}function rf(e){return typeof e!="string"?null:Ui(e)}function sf(e){return typeof e!="string"?null:Al(e)}var Sl=G(()=>{"use strict";ge()});function Il(e,t,n){let i=vt.get(e);i?(i.fullRender=t,i.render2D=n):(i={glManager:e,fullRender:t,render2D:n,waiters:[]},vt.set(e,i));let o=Promise.withResolvers();return i.waiters.push(o),Vi||(Vi=Gl(Bl)),o.promise}function El(e,t){if(!zi.has(e)){t();return}let n=An.get(e);n||(n=[],An.set(e,n)),n.push(t)}function Pl(e){let t=vt.get(e);if(t){vt.delete(e);for(let n of t.waiters)n.resolve()}An.delete(e),zi.delete(e)}async function Bl(){let e=Array.from(vt.values());vt.clear();let t=new Map;for(let n of e){if(n.glManager.isContextLost()){for(let r of n.waiters)r.resolve();continue}let i=n.glManager.backendId,o=t.get(i);o?o.push(n):t.set(i,[n])}await Promise.all(Array.from(t.values()).map(lf)),Vi=0,vt.size>0&&(Vi=Gl(Bl))}async function lf(e){for(let t of e)await af(t)}async function af(e){zi.add(e.glManager);try{e.glManager.beginFrame(),e.fullRender()}catch(t){console.error("scheduler: fullRender threw",t);for(let n of e.waiters)n.reject(t);Dl(e.glManager);return}try{await e.glManager.awaitGpuFence(),e.render2D(),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{Dl(e.glManager)}}function Dl(e){zi.delete(e);let t=An.get(e);if(t){An.delete(e);for(let n of t)try{n()}catch(i){console.error("scheduler: deferred op threw",i)}}}function Gl(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}var vt,Vi,zi,An,Or=G(()=>{"use strict";vt=new Map,Vi=0,zi=new Set,An=new Map});var uf,mf,De,Ln=G(()=>{"use strict";ll();al();ml();Ri();Pr();Nt();Ve();Rl();Sl();Or();uf=(()=>{let e=Mr("float",void 0,Sr);return t=>e.format(t)})(),mf=(()=>{let e=Rr(void 0,Dr);return t=>e.format(t)})(),De=class{constructor(){p(this,"i",null);p(this,"Q",null);p(this,"l",null);p(this,"Zo",null);p(this,"Fn",[]);p(this,"qo",{});p(this,"_",null);p(this,"Sn",[]);p(this,"L",[]);p(this,"h",[]);p(this,"B",[]);p(this,"je",{});p(this,"bi",!1);p(this,"gi",!1);p(this,"vt",{});p(this,"Dn",{});p(this,"to",new Map);p(this,"xi");p(this,"W",{...pl});p(this,"t",{...Ue});p(this,"F",new Wi);p(this,"w",new Pi);p(this,"yi",null);p(this,"_i",Promise.resolve());p(this,"dn",null);p(this,"Ko",null);p(this,"Oe",null)}setGridlineCanvas(t){this.Q=t}setChromeCanvas(t){this.l=t}setOverlayPresenter(t){this.Zo=t}presentOverlay(){this.Zo?.()}setTheme(t){this.qo=t,this.dn=null}setZoomController(t){this._=t,t.configure(this.getZoomConfig())}getZoomControllerForFacet(t){if(this.W.zoom_mode==="shared")return this._;if(!this._)return null;let n=this.Sn[t];return n||(n=new kt,n.configure(this.getZoomConfig()),this.Sn[t]=n),n}computeEffectiveFacetFlags(){let t=this.W.zoom_mode==="independent",n=!t&&this.W.shared_x_axis,i=!t&&this.W.shared_y_axis;return this.bi=n,this.gi=i,{independentZoom:t,effectiveSharedX:n,effectiveSharedY:i}}syncFacetZoomLayouts(t){let n=this.W.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._&&this._.setBaseDomain(t,n,i,o);for(let r of this.Sn)r&&r.setBaseDomain(t,n,i,o)}getZoomConfig(){return{}}setColumnSlots(t){this.L=t}setViewPivots(t,n){this.h=t,this.B=n}setColumnTypes(t){this.je=t,this.Jo()}resetExpandedDomain(){}setGroupByTypes(t){this.vt=t}setColumnsConfig(t){this.Dn=t??{},this.Jo(),this.dn=null}Jo(){this.to=new Map;for(let[t,n]of Object.entries(this.Dn)){let i=this.je[t]??this.vt[t],o=this.Sr(i,n);o&&this.to.set(t,o)}}Sr(t,n){if(!(!t||!n)){if(t==="integer"||t==="float"){let i=n.number_format;if(!i)return;let o=Mr(t,i,Sr);return r=>o.format(r)}if(t==="datetime"){let i=n.date_format;if(!i)return;let o=Rr(i,Dr);return r=>o.format(r)}if(t==="date"){let i=n.date_format;if(!i)return;let o=sl(i,ul);return r=>o.format(r)}}}getColumnFormatter(t,n="value"){if(t){let r=this.to.get(Fr(t));if(r)return r}if(n==="tick")return;let i=t?Fr(t):void 0,o=i?this.je[i]??this.vt[i]:void 0;return o==="date"||o==="datetime"?mf:uf}setDefaultChartType(t){this.xi=t}setFacetConfig(t){this.W={...t}}setPluginConfig(t){this.F.reconcileConfig(this.t,t),this.t={...t},this.W={...this.W,facet_mode:t.facet_mode,zoom_mode:t.facet_zoom_mode},this.Ci=t.series_zoom_mode==="dynamic"}colorScaleColumn(){return null}v(){let t=this.colorScaleColumn();return(!this.dn||this.Ko!==t)&&(this.Ko=t,this.dn=Fl(Ml(this.qo),this.Dn,t)),this.dn}invalidateTheme(){this.dn=null}setView(t){this.Oe&&this.Oe.dispose(),this.Oe=new Ii(t);let n=this.w.isPinned;this.w.dismiss(),n&&this.emitUnselect()}deselect(){this.w.dismiss()}tooltipCallbacks(){return{onHover:()=>{},onLeave:()=>{}}}attachTooltip(t){this.w.attach(this.tooltipCallbacks()),this.w.setHost(t),this.yi=t}async buildClickDetail(t){let n={};if(t.rowIdx!=null&&t.rowIdx>=0&&this.Oe)try{let o=await this.Oe.fetchRow(t.rowIdx);n=Object.fromEntries(o)}catch{n={}}let i=[];for(let o=0;o<this.h.length;o++){let r=t.groupByValues[o];r!=null&&r!==""&&i.push([this.h[o],"==",r])}for(let o=0;o<this.B.length;o++){let r=t.splitByValues[o];r!=null&&r!==""&&i.push([this.B[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.yi?.emitUserClick?.(n)}emitUserSelect(t){let n={selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig};this.yi?.emitUserSelect?.(n)}emitClickAndSelect(t){let n=this._i.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._i=n.catch(i=>{console.error("emitClickAndSelect failed",i)}),n}emitUnselect(t={}){let n=this._i.then(()=>{this.emitUserSelect({selected:!1,row:t.row??{},column_names:t.column_names??[],insertConfig:{filter:[]}})});this._i=n.catch(i=>{console.error("emitUnselect failed",i)})}requestRender(t){return Il(t,()=>{this.Fn=[],this.kt(t)},()=>this.Qo())}_e(t){this.Fn.push(t)}Qo(){let t=this.Fn;this.Fn=[];for(let n of t)n()}renderFrameSync(t){this.Fn=[],this.kt(t),this.Qo()}destroy(){this.w.detach(),this.w.dismiss(),this.Oe&&(this.Oe.dispose(),this.Oe=null),this.destroyInternal()}}});var Yi,Wl=G(()=>{"use strict";Yi=class{constructor(t,n,i,o,r){p(this,"ot",new Map);p(this,"Ce");p(this,"Se");p(this,"Nt");p(this,"er");this.Ce=t,this.Se=i,this.Nt=r,this.er=Math.max(1,Math.ceil((n-t)/r))}tr(t,n){return n*this.er+t}insert(t,n,i){let o=Math.floor((n-this.Ce)/this.Nt),r=Math.floor((i-this.Se)/this.Nt),s=this.tr(o,r),l=this.ot.get(s);l||(l=[],this.ot.set(s,l)),l.push(t)}query(t,n,i,o,r,s,l){let a=Math.ceil(i/o/this.Nt),u=Math.ceil(i/r/this.Nt),m=Math.floor((t-this.Ce)/this.Nt),f=Math.floor((n-this.Se)/this.Nt),c=-1,d=i*i;for(let b=f-u;b<=f+u;b++)for(let g=m-a;g<=m+a;g++){let h=this.ot.get(this.tr(g,b));if(h)for(let x of h){let y=(s[x]-t)*o,C=(l[x]-n)*r,_=y*y+C*C;_<d&&(d=_,c=x)}}return c}}});var Xi,kl=G(()=>{"use strict";Wl();Xi=class{constructor(){p(this,"In",null);p(this,"En",!0)}markDirty(){this.En=!0}get isDirty(){return this.En}rebuild(t,n,i){if(n===0){this.In=null,this.En=!1;return}let o=t.xMax-t.xMin||1,r=t.yMax-t.yMin||1,l=(o+r)/2/Math.max(1,Math.sqrt(n)),a=new Yi(t.xMin,t.xMax,t.yMin,t.yMax,l);i((u,m,f)=>a.insert(u,m,f)),this.In=a,this.En=!1}query(t,n,i,o,r,s,l){return!this.In||!s||!l?-1:this.In.query(t,n,i,o,r,s,l)}clear(){this.In=null,this.En=!0}}});function it(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 l=r.substring(0,s);i.has(l)||i.set(l,new Set),i.get(l).add(r)}let o=[];for(let[r,s]of i){let l=new Map,a=!0;for(let u of t){if(!u)continue;let m=`${r}|${u}`,f=e.get(m);if(!s.has(m)||!f?.values){a=!1;break}l.set(u,m)}if(a){for(let u of n){if(!u)continue;let m=`${r}|${u}`;s.has(m)&&e.get(m)?.values&&l.set(u,m)}o.push({prefix:r,colNames:l})}}return o}var Tn=G(()=>{"use strict"});var $i,Nl=G(()=>{"use strict";$i=class{constructor(t){p(this,"data");p(this,"dictionary",[]);p(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 Ol(e,t,n,i){let o;if(!e)o="(null)";else{let s=e.valid;if(!(s?!!(s[t>>3]>>(t&7)&1):!0))o="(null)";else if(e.indices&&e.dictionary)o=e.dictionary[e.indices[t]]??"(null)";else if(e.values){let a=e.values[t];o=a==null?"(null)":String(a)}else o="(null)"}let r=i.get(o);return r===void 0&&(r=n.length,n.push(o),i.set(o,r)),r}function ff(e,t,n,i,o,r){let s=t?[t,n]:[n],l=[];return i&&l.push(i),o&&l.push(o),r&&l.push(r),it(e,s,l).map(a=>({prefix:a.prefix,xColName:t?a.colNames.get(t):"",yColName:a.colNames.get(n),colorColName:i?`${a.prefix}|${i}`:"",sizeColName:o?`${a.prefix}|${o}`:"",labelColName:r?`${a.prefix}|${r}`:""}))}function Ul(e,t,n,i){e.glyph.ensureProgram(e,t);let o=e.s,r=e.k;e.t.domain_mode==="expand"?(e.Ce=e.Pn,e.rt=e.Bn,e.Se=e.Gn,e.st=e.Wn,e.p=e.vi,e.c=e.Ai,e.lt=e.Li,e.ut=e.Ti):(e.Ce=1/0,e.rt=-1/0,e.Se=1/0,e.st=-1/0,e.p=1/0,e.c=-1/0,e.lt=1/0,e.ut=-1/0,e.Pn=1/0,e.Bn=-1/0,e.Gn=1/0,e.Wn=-1/0,e.vi=1/0,e.Ai=-1/0,e.Li=1/0,e.Ti=-1/0),e.S=NaN,e.D=NaN,e.At=0,e.pn.clear(),e.no=0;let l=e.L,a=l[0]||"",u=l[1]||"",m=l[2]||"",f=l[3]||"",c=l[4]||"";e.Ue=a,e.De=u,e.nr=!a,e.He=!!a&&e.je[a]==="string",e.ve=!!u&&e.je[u]==="string",e.bn=[],e.gn=[],e.ir=new Map,e.or=new Map,e.mt=null,e.ft=null,e.He&&(e.S=0,e.Ce=0,e.rt=0,e.Pn=1/0,e.Bn=-1/0),e.ve&&(e.D=0,e.Se=0,e.st=0,e.Gn=1/0,e.Wn=-1/0);let d=t.A.totalCapacity||i;if(e.B.length>0){if(e.T=ff(n,a,u,m,f,c),e.T.length===0){e.M=0,e.X=[];return}if(e.Ze=e.T[0].xColName,e.Ve=e.T[0].yColName,e.s=m,e.re=f,e.wi=c,e.k=!1,m){let h=n.get(e.T[0].colorColName);e.k=h?.type==="string"}t.ensureBufferCapacity(d*e.T.length)}else if(e.T=[],e.Ze=a,e.Ve=u,e.s=m,e.re=f,e.wi=c,e.k=!1,e.s){let h=n.get(e.s);e.k=h?.type==="string"}(e.s!==o||e.k!==r)&&(e.a=new Map);let b=Math.max(1,e.T.length);e.M=d,e.X=new Array(b).fill(0);let g=b*d;e.$=new Float32Array(g),e.j=new Float32Array(g),e.Lt=new Float32Array(g),e.Ot=new Int32Array(g),e.Ut=c?new $i(g):null}function Hl(e,t,n,i,o,r){if(!e.Ve)return;let s=o;if(s===0||e.M===0)return;let l=e.T.length>0,a=[];if(l)for(let b of e.T){let g=b.xColName?n.get(b.xColName):null,h=n.get(b.yColName);if(!h||!e.ve&&!h.values)continue;let x=b.sizeColName?n.get(b.sizeColName):null,y=b.colorColName?n.get(b.colorColName)??null:null,C=b.labelColName?n.get(b.labelColName)??null:null;a.push({xCol:g?.values??null,yCol:h.values??null,xColData:g??null,yColData:h,xValid:g?.valid,yValid:h.valid,colorCol:y,sizeCol:x?.values??null,labelCol:C})}else{let b=e.Ze?n.get(e.Ze):null,g=e.Ve?n.get(e.Ve):null;if(!g||!e.ve&&!g.values)return;let h=e.s?n.get(e.s)??null:null,x=e.wi?n.get(e.wi)??null:null;a.push({xCol:b?.values??null,yCol:g.values??null,xColData:b??null,yColData:g,xValid:b?.valid,yValid:g?.valid,colorCol:h,sizeCol:null,labelCol:x})}if(a.length===0)return;e.rr<s&&(e.io=new Float32Array(s*2),e.oo=new Float32Array(s),e.ro=new Float32Array(s),e.rr=s);let u=e.io,m=e.oo,f=e.ro,c=!l&&e.re?n.get(e.re)?.values??null:null;if(e.k&&e.s){for(let b of a){let g=b.colorCol?.dictionary;if(g)for(let h=0;h<g.length;h++){let x=g[h];e.a.has(x)||e.a.set(x,e.a.size)}}e.a.size>0&&(e.p=0,e.c=e.a.size-1)}!e.s&&e.T.length>1&&(e.p=0,e.c=e.T.length-1);for(let b=0;b<a.length;b++){let g=a[b],h=e.X[b]??0,x=b*e.M,y=e.M-h;if(y<=0)continue;let C=g.colorCol?.valid,_=0;for(let L=0;L<s&&_<y;L++){let T=L;if(!e.ve&&g.yValid&&!(g.yValid[T>>3]>>(T&7)&1)||!e.He&&g.xCol&&g.xValid&&!(g.xValid[T>>3]>>(T&7)&1))continue;let w=C!==void 0&&!(C[T>>3]>>(T&7)&1),M;if(e.ve)M=Ol(g.yColData,T,e.gn,e.or);else if(g.yCol){if(M=g.yCol[T],isNaN(M))continue}else continue;let I;if(e.He)I=Ol(g.xColData,T,e.bn,e.ir);else if(g.xCol){if(I=g.xCol[T],isNaN(I))continue}else I=i+T;let[D,S]=e.projectPoint(I,M);if(isNaN(D)||isNaN(S))continue;D<e.Ce&&(e.Ce=D),D>e.rt&&(e.rt=D),S<e.Se&&(e.Se=S),S>e.st&&(e.st=S),isNaN(e.S)&&(e.S=D),isNaN(e.D)&&(e.D=S);let E=D-e.S,k=S-e.D,W=x+h+_;e.$[W]=E,e.j[W]=k,e.Ot[W]=i+T,u[_*2]=E,u[_*2+1]=k;let V=g.colorCol;if(w)m[_]=.5,e.Lt[W]=.5;else if(V&&!e.k&&V.values){let N=V.values[T];m[_]=N,e.Lt[W]=N,N<e.p&&(e.p=N),N>e.c&&(e.c=N)}else if(V&&e.k&&V.indices&&V.dictionary){let N=V.dictionary[V.indices[T]];e.a.has(N)||(e.a.set(N,e.a.size),e.c=e.a.size-1);let H=e.a.get(N);m[_]=H,e.Lt[W]=H}else m[_]=b,e.Lt[W]=b;if(e.Ut&&g.labelCol){let N=g.labelCol,H=N.valid;!(H!==void 0&&!(H[T>>3]>>(T&7)&1))&&N.indices&&N.dictionary&&e.Ut.set(W,N.dictionary[N.indices[T]])}if(g.sizeCol){let N=g.sizeCol[T];f[_]=N,N<e.lt&&(e.lt=N),N>e.ut&&(e.ut=N)}else if(c){let N=c[T];f[_]=N,N<e.lt&&(e.lt=N),N>e.ut&&(e.ut=N)}else f[_]=0;_++}if(_===0)continue;let v=(x+h)*2*Float32Array.BYTES_PER_ELEMENT;t.A.upload("a_position",u.subarray(0,_*2),v,2);let A=(x+h)*Float32Array.BYTES_PER_ELEMENT;t.A.upload("a_color_value",m.subarray(0,_),A),t.A.upload("a_size_value",f.subarray(0,_),A),e.X[b]=h+_,e.X[b]>e.no&&(e.no=e.X[b])}let d=0;for(let b of e.X)d+=b;e.At=d,t.uploadedCount=d,e.pn.markDirty(),isFinite(e.Ce)&&e.setZoomBaseDomain(e.Ce,e.rt,e.Se,e.st)}var Vl=G(()=>{"use strict";Tn();Nl()});function Ut(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.Fe,r.textAlign="center",r.textBaseline="middle",r.fillText(t,n.x+n.width/2,n.y+n.height/2),r.restore())}var ji=G(()=>{"use strict"});var oe,ot=G(()=>{"use strict";oe=class{constructor(t,n,i){p(this,"margins");p(this,"e");p(this,"cssWidth");p(this,"cssHeight");p(this,"O",0);p(this,"Z",1);p(this,"q",0);p(this,"ee",1);this.cssWidth=t,this.cssHeight=n;let r=(i.leftExtra??55)+(i.hasYLabel?16:0),l=(i.bottomExtra??24)+(i.hasXLabel?18:0),a=0,u=i.rightExtra??(i.hasLegend?80:16),m=i.originX??0,f=i.originY??0,c=i.cellWidth??t,d=i.cellHeight??n,b=m+r,g=f+a,h=Math.max(1,c-r-u),x=Math.max(1,d-a-l),y=t-(b+h),C=n-(g+x);this.margins={top:g,right:y,bottom:C,left:b},this.e={x:b,y:g,width:h,height:x}}buildProjectionMatrix(t,n,i,o,r,s,l=.02,a=0,u=0){let m=n-t,f=o-i;m===0&&(m=1),f===0&&(f=1);let c=m*l,d=f*l,b=s&&r==="y"&&i>=0,g=s&&r==="y"&&o<=0,h=s&&r==="x"&&t>=0,x=s&&r==="x"&&n<=0;t-=c,n+=c,i-=d,o+=d,b?(i=0,o+=d):g&&(o=0,i-=d),h?(t=0,n+=c):x&&(n=0,t-=c),this.O=t,this.Z=n,this.q=i,this.ee=o;let y=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-y)/(n-t),L=(v-_)/(o-i),T=y-A*(t-a),w=_-L*(i-u);return new Float32Array([A,0,0,0,0,L,0,0,0,0,-1,0,T,w,0,1])}R(t,n){let{x:i,y:o,width:r,height:s}=this.e,l=(t-this.O)/(this.Z-this.O),a=(n-this.q)/(this.ee-this.q);return{px:i+l*r,py:o+(1-a)*s}}}});function wn(e){return e.cells.filter(t=>t.isBottomEdge).map(t=>t.layout)}function Mn(e){return e.cells.filter(t=>t.isLeftEdge).map(t=>t.layout)}function xf(e,t,n,i){if(e<=1)return{cols:1,rows:1};let o=1,r=e,s=1/0,l=e;for(let a=1;a<=e;a++){let u=Math.ceil(e/a),m=Math.max(1,(t-(a-1)*i)/a),f=Math.max(1,(n-(u-1)*i)/u),c=m/f,d=Math.max(c,1/c),b=a*u;(d<s||d===s&&b<l)&&(o=a,r=u,s=d,l=b)}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??gf,s=t.hasLegend?t.legendWidth??hf:0,l=t.xAxis??"cell",a=t.yAxis??"cell",u=l==="none"&&a==="none",m=a==="outer"?cf+(t.hasYLabel?pf:0):0,f=l==="outer"?df+(t.hasXLabel?bf:0):0,c=0,d=s,b=m,g=c,h=Math.max(1,i-m-d),x=Math.max(1,o-c-f),y=Math.max(0,t.gap??0),{cols:C,rows:_}=xf(n,h,x,y),v=Math.max(0,C-1)*y,A=Math.max(0,_-1)*y,L=Math.max(1,(h-v)/C),T=Math.max(1,(x-A)/_),w=[];for(let S=0;S<n;S++){let E=Math.floor(S/C),k=S-E*C,W=E===_-1||S+C>=n,V=k===0,N=b+k*(L+y),H=g+E*(T+y),U=H+r,Y=N,q=L,me=Math.max(1,T-r),Ge=new oe(i,o,{hasXLabel:l==="cell"&&t.hasXLabel===!0,hasYLabel:a==="cell"&&t.hasYLabel===!0,hasLegend:!1,leftExtra:a==="cell"?void 0:0,bottomExtra:l==="cell"?void 0:0,rightExtra:u?0:void 0,originX:Y,originY:U,cellWidth:q,cellHeight:me}),Re=r>0?{x:Y,y:H,width:q,height:r}:void 0;w.push({index:S,label:e[S],layout:Ge,titleRect:Re,isLeftEdge:V,isBottomEdge:W})}let M=t.hasLegend?{x:b+h,y:c,width:s,height:x}:void 0,I=l==="outer"?{x:b,y:g+x,width:h,height:f}:void 0;return{cells:w,legendRect:M,outerXAxisRect:I,outerYAxisRect:a==="outer"?{x:0,y:g,width:m,height:x}:void 0}}var cf,df,pf,bf,gf,hf,Ht=G(()=>{"use strict";ot();cf=55,df=24,pf=16,bf=18,gf=18,hf=96});function yf(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=Se(e,o);n[i]=[r[0],r[1],r[2]]}return n}function he(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 yf(t,n)}var Rn=G(()=>{"use strict";ge()});function At(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 Lt(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.e.width*n),Math.round(t.e.height*n));try{i()}finally{e.disable(e.SCISSOR_TEST)}}function rt(e,t,n,i){At(e),Lt(e,t,n,i)}var Fn=G(()=>{"use strict"});function Sn(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=Tl(n,zl);return i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,zl,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 ze(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 zl,Vt=G(()=>{"use strict";ge();zl=256});function Ye(e,t,n,i,o,r=1){if(!e||o.length===0)return;let s=e.getContext("2d");if(!s)return;let l=t.e;s.save(),s.setTransform(1,0,0,1,0,0),s.scale(i,i),s.font=`11px ${n.fontFamily}`;for(let a of o)a.px<l.x||a.px>l.x+l.width||a.py<l.y||a.py>l.y+l.height||(_f(s,a,l,n),Cf(s,a,t,n,r));s.restore()}function _f(e,t,n,i){e.strokeStyle=i.Ct,e.lineWidth=1,e.setLineDash([4,4]),e.beginPath(),e.moveTo(t.px,t.py),t.side==="bottom"?e.lineTo(t.px,n.y+n.height):t.side==="left"?e.lineTo(n.x,t.py):e.lineTo(n.x+n.width,t.py),e.stroke(),e.setLineDash([])}function Cf(e,t,n,i,o){let r=n.e,s=e.measureText(t.text).width+8,l=17,a,u;t.side==="bottom"?(a=t.px-s/2,u=r.y+r.height+4):t.side==="left"?(a=r.x-4-s,u=t.py-l/2):(a=r.x+r.width+4,u=t.py-l/2),a=Math.min(Math.max(a,0),Math.max(0,n.cssWidth-s)),u=Math.min(Math.max(u,0),Math.max(0,n.cssHeight-l)),e.globalAlpha=Math.min(1,Math.max(0,o)),e.fillStyle=i.mi,e.strokeStyle=i.No,e.lineWidth=1,e.beginPath(),e.rect(a,u,s,l),e.fill(),e.stroke(),e.globalAlpha=1,e.fillStyle=i.Oo,e.textAlign="left",e.textBaseline="middle",e.fillText(t.text,a+4,u+l/2+1)}var Dn=G(()=>{"use strict"});function Yl(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 K(e,t,n){n<1&&(n=1);let i=Yl(t-e,!1),o=Yl(i/n,!0),r=Math.ceil(e/o)*o,s=Math.floor(t/o)*o,l=[];for(let a=r;a<=s+o*.001;a+=o)l.push(a);return l}function fe(e,t){if(!e)return Ee;let n=t&&t.length>1?t[1]-t[0]:0;return i=>Yt(i,n)}function Ee(e){if(!Number.isFinite(e))return"-";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 zt(e,t){let n=Xl.get(e);return n||(n=new Intl.DateTimeFormat(void 0,t),Xl.set(e,n)),n}function Yt(e,t){let n=new Date(e);return isNaN(n.getTime())?Ee(e):t!==void 0&&t>0?t>=864e5*28?zt("ym",{year:"numeric",month:"short"}).format(n):t>=864e5?zt("md",{month:"short",day:"numeric"}).format(n):t>=36e5?zt("mdh",{month:"short",day:"numeric",hour:"numeric"}).format(n):t>=6e4?zt("hm",{hour:"numeric",minute:"2-digit"}).format(n):zt("hms",{hour:"numeric",minute:"2-digit",second:"2-digit"}).format(n):zt("ymd",{year:"numeric",month:"short",day:"numeric"}).format(n)}var Xl,Ce=G(()=>{"use strict";Xl=new Map});function ce(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 le(e,t){let n=e.getContext("2d");return n?(n.setTransform(t,0,0,t,0,0),n):null}var Tt=G(()=>{"use strict"});function Zi(e,t,n,i,o,r,s){let l=o==="bottom"?1:-1;e.textAlign="center",e.textBaseline=o==="bottom"?"top":"bottom";let a=l*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+l*5),e.stroke(),e.fillText(s(u),m,i+a))}}function qi(e,t,n,i,o,r,s){let l=o==="left"?-1:1;e.textAlign=o==="left"?"right":"left",e.textBaseline="middle";let a=l*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+l*5,m),e.stroke(),e.fillText(s(u),i+a,m))}}function Xt(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 $t(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 Ki=G(()=>{"use strict"});function jt(e,t,n){let{e:i}=n,o=Math.max(2,Math.floor(i.width/90)),r=Math.max(2,Math.floor(i.height/60));return{xTicks:K(e.min,e.max,o),yTicks:K(t.min,t.max,r)}}function Ur(e,t,n,i,o,r){let s=le(e,r);if(!s)return;let{e:l}=t;s.strokeStyle=o.Rn,s.lineWidth=1,Xt(s,l,n,a=>t.R(a,0).px),$t(s,l,i,a=>t.R(0,a).py)}function $l(e,t,n){return n||fe(e.isDate,t)}function jl(e,t,n,i,o,r,s,l,a){let{Ct:u,Fe:m,di:f,fontFamily:c}=s,d=$l(t,n,a);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 ${c}`;for(let b of i)Zi(e,b.e,n,o,"bottom",g=>b.R(g,0).px,d);l&&t.label&&(e.fillStyle=m,e.font=`13px ${c}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,l.cx,l.baselineY))}function Zl(e,t,n,i,o,r,s,l,a){let{Ct:u,Fe:m,di:f,fontFamily:c}=s,d=$l(t,n,a);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 ${c}`;for(let b of i)qi(e,b.e,n,o,"left",g=>b.R(0,g).py,d);l&&t.label&&(e.fillStyle=m,e.font=`13px ${c}`,e.save(),e.translate(14,l.pivotY),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(t.label,0,0),e.restore())}function Ji(e,t,n,i,o,r,s,l){let a=le(e,s);if(!a)return;let{e:u}=n;jl(a,t,i,[n],u.y+u.height,u,o,r?{cx:u.x+u.width/2,baselineY:n.cssHeight-2}:null,l)}function Qi(e,t,n,i,o,r,s,l){let a=le(e,s);if(!a)return;let{e:u}=n;Zl(a,t,i,[n],u.x,u,o,r?{pivotY:u.y+u.height/2}:null,l)}function In(e,t,n,i,o,r,s,l,a){let u=le(e,l);u&&jl(u,n,i,o,t.y,t,r,s?{cx:t.x+t.width/2,baselineY:t.y+t.height-2}:null,a)}function En(e,t,n,i,o,r,s,l,a){let u=le(e,l);u&&Zl(u,n,i,o,t.x+t.width,t,r,s?{pivotY:t.y+t.height/2}:null,a)}var Hr=G(()=>{"use strict";Ce();Tt();Ki()});function eo(e,t){if(t>Pn||t<-Pn)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 Zt(e,t){let n=e*180/(Math.PI*6378137),i=Math.atan(Math.exp(t/6378137))*360/Math.PI-90;return[n,i]}function ql(e,t,n){let i=1<<e,o=2*ve/i,r=-ve+t*o,s=r+o,l=ve-n*o,a=l-o;return{xMin:r,yMin:a,xMax:s,yMax:l}}function Kl(e,t=256,n=19){if(!isFinite(e)||e<=0)return 0;let i=Math.log2(2*ve/(t*e));return Math.max(0,Math.min(n,Math.floor(i)))}function Jl(e,t){let n=1<<t,i=2*ve/n,o=Math.floor((e.xMin+ve)/i),r=Math.floor((e.xMax+ve)/i),s=Math.floor((ve-e.yMax)/i),l=Math.floor((ve-e.yMin)/i),a=[];for(let u=s;u<=l;u++)if(!(u<0||u>=n))for(let m=o;m<=r;m++)m<0||m>=n||a.push({z:t,x:m,y:u});return a}var ve,Pn,Bn=G(()=>{"use strict";ve=Math.PI*6378137,Pn=85.0511287798066});function Gn(e){let t=e.e,n=Math.max(2,Math.floor(t.width/90)),i=Math.max(2,Math.floor(t.height/60)),o=Vr(e.O),r=Vr(e.Z),s=Ql(Zt(0,e.q)[1]),l=Ql(Zt(0,e.ee)[1]),a=ea(o,r,n),u=ea(s,l,i),m=ta(a),f=ta(u);return{xTicks:a.map(c=>c/180*ve),yTicks:u.map(c=>eo(0,c)[1]),formatX:c=>na(Vr(c),m,"E","W"),formatY:c=>na(Zt(0,c)[1],f,"N","S")}}function Vr(e){return e/ve*180}function Ql(e){return Math.max(-Pn,Math.min(Pn,e))}function ea(e,t,n){return!isFinite(e)||!isFinite(t)||t<=e?[]:K(e,t,n)}function ta(e){return e.length>1?Math.abs(e[1]-e[0]):1}function na(e,t,n,i){let o=t>=1?0:Math.min(6,Math.ceil(-Math.log10(t)+1e-9)),r=String(parseFloat(Math.abs(e).toFixed(o)));return parseFloat(r)===0?"0\\xB0":`${r}\\xB0${e>0?n:i}`}var ia=G(()=>{"use strict";Ce();Bn()});function zr(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 Yr(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 oa(e,t){return e.x+e.width+14>t.x+t.width}function Xr(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 wt(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 ra(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,l=r.length;for(;l>0&&e.measureText(r.slice(0,l)).width>n;)l--;if(l===0&&(l=1),l===r.length){o.push(r);break}let a=l,u=r.lastIndexOf(" ",l);if(u>0&&(a=u),s){o.push(wt(e,r,n));break}o.push(r.slice(0,a)),r=r.slice(a).trimStart()}return o.length===1&&o[0].length<=2?[]:o}var to=G(()=>{"use strict"});function no(e,t,n,i){let o=[];if(i<=n)return o;let r=n,s=e[n];for(let l=n+1;l<i;l++){let a=e[l];a!==s&&(o.push({startIdx:r,endIdx:l-1,label:t[s]??""}),r=l,s=a)}return o.push({startIdx:r,endIdx:i-1,label:t[s]??""}),o}function Wn(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}var kn=G(()=>{"use strict"});function $r(e,t){return e.R(t,0).px}function jr(e,t){return e.R(0,t).py}function Mf(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:vf,rotation:0}}function sa(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(Mf(e.numRows,r.maxLabelChars,t)):i.push({size:Af,rotation:0})}return i}function la(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(Lf,r*i+wf))}else n.push(Tf);return n}function aa(e){let t=0;for(let n of e)t+=n;return t}function Xe(e,t){return e.numRows===0||e.levels.length===0?24:aa(sa(e,t).map(n=>n.size))}function Kt(e){return e.numRows===0||e.levels.length===0?55:aa(la(e))}function Rf(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 a=[];for(let u=e;u<=t;u++)a.push(u);return a}let s=Math.ceil(o/r),l=[];for(let a=e;a<=t;a+=s)l.push(a);return l}function ua(e,t){return e.labels[t]??""}function ma(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)),l=Math.min(e-1,Math.floor(r));return l<s?null:[s,l]}function fa(e,t,n,i){let o=[];for(let r of e){let s=t(r.startIdx-.5),l=t(r.endIdx+.5),a=Math.max(n,Math.min(s,l)),u=Math.min(i,Math.max(s,l));u>a&&o.push({run:r,nearEdge:s,farEdge:l,nearClip:a,farClip:u})}return o}function xe(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Ct:o,Fe:r,fontFamily:s}=i,{e:l}=t,a=l.y+l.height;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${qt}px ${s}`;let u=sa(n,l.width),m=ma(n.numRows,t.O,t.Z,!1);if(!m)return;let[f,c]=m,d=n.levels.length,b=a;for(let h=d-1;h>=0;h--){let x=n.levels[h],y=u[h],C=b;b+=y.size,h===d-1?Ff(e,t,x,f,c,C,y,s,o):Sf(e,t,x,f,c,C,s,o)}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,l.x+l.width/2,t.cssHeight-2))}function Ff(e,t,n,i,o,r,s,l,a){let{e:u}=t,f=Math.max(40,Math.min(n.maxLabelChars*6.2+8,u.width/2)),c=s.rotation===0?Rf(i,o,u.width,f):Df(i,o);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let h of c){let x=$r(t,h);x<u.x-1||x>u.x+u.width+1||(e.moveTo(x,r),e.lineTo(x,r+io))}e.stroke(),e.font=`${qt}px ${l}`;let d=r+io+3,b={x:u.x,width:u.width,y:r,height:9999},g=[];for(let h of c){let x=$r(t,h);if(x<u.x-1||x>u.x+u.width+1)continue;let y=ua(n,h);if(!y)continue;let C=e.measureText(y).width,_=zr(x,d,C,Zr,s.rotation);if(Xr(_,b)){if(s.rotation===0){if(g.some(v=>Yr(v,_)))continue}else if(g.some(v=>oa(v,_)))continue;g.push(_),ca(e,y,x,d,s.rotation,"center")}}}function Sf(e,t,n,i,o,r,s,l){let{e:a}=t,u=Wn(n.runs,i,o);if(u.length===0)return;let m=fa(u,b=>$r(t,b),a.x,a.x+a.width);if(m.length===0)return;e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let b of m)e.moveTo(b.nearClip,r+3),e.lineTo(b.farClip,r+3),e.moveTo(b.nearEdge,r),e.lineTo(b.nearEdge,r+3),e.moveTo(b.farEdge,r),e.lineTo(b.farEdge,r+3);e.stroke(),e.font=`${qt}px ${s}`;let f=r+3+4,c=[],d={x:a.x,width:a.width,y:r,height:9999};for(let b of m){let g=(b.nearClip+b.farClip)/2,h=b.run.label;if(!h)continue;let x=b.farClip-b.nearClip-4,y=wt(e,h,x);if(!y)continue;let C=e.measureText(y).width,_=zr(g,f,C,Zr,0);Xr(_,d)&&(c.some(v=>Yr(v,_))||(c.push(_),ca(e,y,g,f,0,"center")))}}function Df(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n}function Pe(e,t,n,i){if(n.numRows===0||n.levels.length===0)return;let{Ct:o,Fe:r,fontFamily:s}=i,{e:l}=t,a=l.x;e.strokeStyle=o,e.fillStyle=o,e.lineWidth=1,e.font=`${qt}px ${s}`;let u=la(n),m=ma(n.numRows,t.q,t.ee,!0);if(!m)return;let[f,c]=m,d=n.levels.length,b=a;for(let h=d-1;h>=0;h--){let x=n.levels[h],y=u[h],C=b;b-=y,h===d-1?If(e,t,x,f,c,C,s,o):Ef(e,t,x,f,c,C,y,s,o)}let g=n.levelLabels.filter(h=>!!h).join(" / ");g&&(e.fillStyle=r,e.font=`13px ${s}`,e.save(),e.translate(14,l.y+l.height/2),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="bottom",e.fillText(g,0,0),e.restore())}function If(e,t,n,i,o,r,s,l){let{e:a}=t,u=Zr+4,m=o-i+1,f=Math.max(1,Math.floor(a.height/u)),c=m<=f?1:Math.ceil(m/f);e.strokeStyle=l,e.fillStyle=l,e.beginPath();for(let d=i;d<=o;d+=c){let b=jr(t,d);b<a.y-1||b>a.y+a.height+1||(e.moveTo(r-io,b),e.lineTo(r,b))}e.stroke(),e.font=`${qt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let d=i;d<=o;d+=c){let b=jr(t,d);if(b<a.y-1||b>a.y+a.height+1)continue;let g=ua(n,d);g&&e.fillText(g,r-io-3,b)}}function Ef(e,t,n,i,o,r,s,l,a){let{e:u}=t,m=Wn(n.runs,i,o);if(m.length===0)return;let f=fa(m,d=>jr(t,d),u.y,u.y+u.height);if(f.length===0)return;e.strokeStyle=a,e.fillStyle=a;let c=r-3;e.beginPath();for(let d of f)e.moveTo(c,d.nearClip),e.lineTo(c,d.farClip),e.moveTo(c,d.nearEdge),e.lineTo(r,d.nearEdge),e.moveTo(c,d.farEdge),e.lineTo(r,d.farEdge);e.stroke(),e.font=`${qt}px ${l}`,e.textAlign="right",e.textBaseline="middle";for(let d of f){let b=(d.nearClip+d.farClip)/2,g=d.run.label;if(!g)continue;let h=s-6,x=wt(e,g,h);x&&e.fillText(x,c-3,b)}}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()}var vf,Af,io,qt,Zr,Lf,Tf,wf,Jt=G(()=>{"use strict";to();kn();vf=25,Af=22,io=5,qt=11,Zr=14,Lf=55,Tf=60,wf=10});function Pf(e){return`rgb(${Math.round(e[0]*255)},${Math.round(e[1]*255)},${Math.round(e[2]*255)})`}function st(e,t,n,i,o={}){return{entryCount:n,boxWidth:()=>{let r=e?.getContext("2d");if(!r)return 0;r.save();let s=0,l=0;r.font=`${o.fontPx??11}px ${t.fontFamily}`;for(let m of i())if(s=Math.max(s,r.measureText(m).width),++l>=Bf)break;let a=0;o.title&&(r.font=`bold 10px ${t.fontFamily}`,a=r.measureText(o.title).width+Wr),r.restore();let u=o.leading??_l;return Math.ceil(Math.max(a,u+s+Gr))}}}function Rt(e,t,n,i=Ee,o){return st(e,t,0,()=>[i(n.max),i((n.min+n.max)/2),i(n.min)],{title:o,leading:da+pa,fontPx:10})}function ro(e,t,n,i,o=1){return e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.eo,e.lineWidth=1,e.beginPath(),e.rect(t.x+.5,t.y+.5,t.width-1,t.height-1),e.globalAlpha=Math.min(1,Math.max(0,o)),e.fill(),e.globalAlpha=1,e.stroke(),e.beginPath(),e.moveTo(t.x+.5,t.y+tt+.5),e.lineTo(t.x+t.width-.5,t.y+tt+.5),e.stroke(),i&&(e.fillStyle=n.cn,e.font=`bold 10px ${n.fontFamily}`,e.textAlign="left",e.textBaseline="middle",e.fillText(Mt(e,i,Math.max(0,t.width-Wr)),t.x+8,t.y+tt/2+.5)),e.restore(),{x:t.x+yl,y:t.y+tt+ki/2,width:Math.max(0,t.width-Gr),height:Math.max(0,t.height-tt-ki)}}function qr(e,t,n,i,o){if(i<=t.height)return;let r=t.x+t.width-oo,s=Math.max(20,t.height/i*t.height),l=t.height-s,a=i-t.height,u=t.y+(a>0?n/a*l:0);e.save(),e.fillStyle=o.eo,e.fillRect(r,t.y,oo,t.height),e.fillStyle=o.cn,e.fillRect(r,u,oo,s),e.restore()}function Mt(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=Math.ceil((i+o)/2);e.measureText(t.slice(0,r)+"\\u2026").width<=n?i=r:o=r-1}return i>0?t.slice(0,i)+"\\u2026":"\\u2026"}function Qt(e,t,n,i,o,r,s){let l={x:t.e.x+t.e.width+12,y:t.margins.top+20,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};$e(e,l,n,i,o,r,s&&{...s,sidebarGutter:t.margins.right})}function $e(e,t,n,i,o,r=Ee,s){let l=e.getContext("2d");if(!l)return;let a=o.cn,u=o.eo,m=o.fontFamily,f=s?.mode==="floating",c,d,b,g=t,h=da;f?(g=ro(l,t,o,n.label,s?.opacity),c=g.x,d=g.y+4,b=Math.max(8,g.height-12)):(c=t.x,d=t.y,b=Math.min(120,t.height*.4),l.fillStyle=a,l.font=`9px ${m}`,l.textAlign="left",l.textBaseline="bottom",l.fillText(n.label,c,d-4));let x=n.max,y=n.min,C=l.createLinearGradient(0,d,0,d+b),_=16;for(let L=0;L<=_;L++){let T=L/_,w=x+T*(y-x),M=Ct(w,n.min,n.max),I=Se(i,M);C.addColorStop(T,Pf(I))}l.fillStyle=C,l.fillRect(c,d,h,b),l.strokeStyle=u,l.lineWidth=1,l.strokeRect(c,d,h,b),l.fillStyle=a,l.font=`10px ${m}`,l.textAlign="left",l.textBaseline="middle";let v=c+h+pa,A=Math.max(0,g.x+g.width-v);if(l.fillText(Mt(l,r(n.max),A),v,d+2),l.fillText(Mt(l,r((n.min+n.max)/2),A),v,d+b/2),l.fillText(Mt(l,r(n.min),A),v,d+b-2),n.min<0&&n.max>0){let L=(n.max-0)/(n.max-n.min),T=d+L*b;l.strokeStyle=a,l.lineWidth=1,l.beginPath(),l.moveTo(c+h,T),l.lineTo(c+h+4,T),l.stroke(),l.fillStyle=a,l.fillText("0",v,T)}s&&s.legend.setPainted({mode:s.mode,box:t,content:g,contentHeight:Math.min(g.height,b+8),sidebarGutter:s.sidebarGutter})}function so(e,t,n,i,o,r){let s={x:t.e.x+t.e.width+12,y:t.margins.top+10,width:Math.max(1,t.cssWidth-t.e.x-t.e.width-12),height:Math.max(1,t.e.height)};Ft(e,s,n,i,o,r&&{...r,sidebarGutter:t.margins.right})}function Ft(e,t,n,i,o,r){let s=e.getContext("2d");if(!s)return;if(n.size===0){r?.legend.clearPainted();return}let l=o.cn,a=o.fontFamily,u=r?.mode==="floating",m=t;u&&(m=ro(s,t,o,r?.title??"Legend",r?.opacity));let f=10,c=vn,d=n.size*c,b=r?r.legend.clampScroll(m.height,d):0,g=d>m.height,h=Math.max(0,m.width-f-6-(g?oo+4:0));s.save(),s.beginPath(),s.rect(m.x,m.y,m.width,m.height),s.clip(),s.font=`11px ${a}`,s.textAlign="left",s.textBaseline="middle";let x=Math.floor(b/c),y=m.x,C=0,_=m.y+c/2+x*c-b;for(let[v,A]of n){if(C<x){C++;continue}if(_-c/2>=m.y+m.height)break;let L=i[A]??i[A%i.length]??[0,0,0];s.fillStyle=`rgb(${Math.round(L[0]*255)},${Math.round(L[1]*255)},${Math.round(L[2]*255)})`,s.fillRect(y,_-f/2,f,f),s.fillStyle=l,s.fillText(Mt(s,v,h),y+f+6,_),_+=c,C++}s.restore(),qr(s,m,b,d,o),r&&r.legend.setPainted({mode:r.mode,box:t,content:m,contentHeight:d,sidebarGutter:r.sidebarGutter})}var oo,da,pa,Bf,Nn=G(()=>{"use strict";Ce();Ve();ge();oo=4,da=16,pa=5;Bf=64});function lt(e){return isNaN(e)?0:e}function On(e){return e.k?e.a.size:0}function ba(e,t){let n=e.s??void 0;return e.k?st(e.l,t,e.a.size,()=>e.a.keys(),{title:n}):Rt(e.l,t,{min:e.p,max:e.c},e.s?e.getColumnFormatter(e.s,"value"):void 0,n)}function ga(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.T.length>0,l=e.W.facet_mode,a=s&&l==="grid";e.computeEffectiveFacetFlags();let u=e.s!==""&&e.p<e.c,m=a&&e.W.zoom_mode==="independent",f;if(e._&&!m?f=e._.getVisibleDomain():f={xMin:e.Ce,xMax:e.rt,yMin:e.Se,yMax:e.st},!isFinite(f.xMin)||!isFinite(f.yMin))return;let c=e.v(),d=c.Ne,b=e.je[e.Ue]||"",g=e.je[e.De]||"",h=b==="date"||b==="datetime",x=g==="date"||g==="datetime",y=e.k,C=!y&&!e.s,_=c.N;if(y||C){let v=C?Math.max(1,e.T.length):Math.max(1,e.a.size);if(e.Mi&&e.so===d&&e.ao===v)_=e.Mi;else{let A=he(d,c.N,v);_=Ll(A),e.Mi=_,e.so=d,e.ao=v}}else e.Mi=null,e.so=null,e.ao=-1;e.se=Sn(t,e.se,_),a?kf(e,t,f,c,{xIsDate:h,yIsDate:x,cssWidth:o,cssHeight:r}):(e.b=null,Wf(e,t,f,c,{xIsDate:h,yIsDate:x,cssWidth:o,cssHeight:r,hasColorCol:u})),e._e(()=>je(e))}function lo(e,t,n,i){return{min:t,max:n,label:e.Ue||(e.nr?"Row":e.Ze||""),isDate:i}}function ao(e,t,n,i){return{min:t,max:n,label:e.De||e.Ve,isDate:i}}function uo(e,t){let n=0;for(let o of e)o.length>n&&(n=o.length);return{levels:[{labels:e.slice(),runs:[],maxLabelChars:n}],numRows:e.length,levelLabels:[t]}}function Gf(e,t,n,i,o,r,s,l,a){if(e.He&&e.mt){let u=le(t,a);u&&xe(u,n,e.mt,l)}else Ji(t,i,n,r,l,!0,a,e.getColumnFormatter(e.Ze,"tick"));if(e.ve&&e.ft){let u=le(t,a);u&&Pe(u,n,e.ft,l)}else Qi(t,o,n,s,l,!0,a,e.getColumnFormatter(e.Ve,"tick"))}function Wf(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:l,xIsDate:a,yIsDate:u,hasColorCol:m}=o;e.mt=e.He&&e.bn.length>0?uo(e.bn,e.Ue||e.Ze||""):null,e.ft=e.ve&&e.gn.length>0?uo(e.gn,e.De||e.Ve||""):null;let f=nt(e.t,m,80,On(e)),c=55+(e.De?16:0),d=Math.max(1,s-c-f),b=e.ft?Kt(e.ft):void 0,g=e.mt?Xe(e.mt,d):void 0,h=e.Ht==="map",x=h&&!e.t.numeric_axes,y=new oe(s,l,x?{hasXLabel:!1,hasYLabel:!1,hasLegend:m,leftExtra:0,bottomExtra:0,rightExtra:m&&se(e.t,On(e))==="sidebar"?we(e.t,80):0}:{hasXLabel:!!e.Ue,hasYLabel:!!e.De,hasLegend:m,leftExtra:b,bottomExtra:g,rightExtra:f});e.u=y,e._&&e._.updateLayout(y);let C=y.buildProjectionMatrix(n.xMin,n.xMax,n.yMin,n.yMax,void 0,void 0,void 0,lt(e.S),lt(e.D)),_=lo(e,n.xMin,n.xMax,a),v=ao(e,n.yMin,n.yMax,u),A=jt(_,v,y),L=e.He?[]:A.xTicks,T=e.ve?[]:A.yTicks,w=t.dpr,M=e.Q;M&&!h?e._e(()=>{ce(M,y,w),Ur(M,y,L,T,i,w)}):M&&h&&e._e(()=>ce(M,y,w)),rt(r,y,t.dpr,()=>{h&&e.renderBackground(t,y,C,n,lt(e.S),lt(e.D)),e.glyph.draw(e,t,C)}),e.le=_,e.te=v,e.kn=L,e.ae=T,e.Ri=i.N,e.Fi=m}function kf(e,t,n,i,o){let r=t.gl,{cssWidth:s,cssHeight:l,xIsDate:a,yIsDate:u}=o;e.mt=e.He&&e.bn.length>0?uo(e.bn,e.Ue||e.Ze||""):null,e.ft=e.ve&&e.gn.length>0?uo(e.gn,e.De||e.Ve||""):null;let m=e.T.map(M=>M.prefix),f=e.k&&e.a.size>1,c=!!e.s&&!e.k&&e.p<e.c,d=f||c,b=e.Ht==="map",g=b&&!e.t.numeric_axes,h=Ie(m,{cssWidth:s,cssHeight:l,xAxis:g?"none":e.bi?"outer":"cell",yAxis:g?"none":e.gi?"outer":"cell",hasLegend:d&&se(e.t,On(e))==="sidebar",legendWidth:we(e.t,96),hasXLabel:!g&&!!e.Ue,hasYLabel:!g&&!!e.De,gap:e.W.facet_padding});if(e.b=h,h.cells.length>1){let M=h.cells[0].layout.e;for(let I=1;I<h.cells.length;I++){let D=h.cells[I].layout.e;if(D.width!==M.width||D.height!==M.height){console.warn(`facet-grid: cell ${I} size (${D.width}\\xD7${D.height}) differs from cell 0 (${M.width}\\xD7${M.height})`);break}}}e.u=h.cells[0]?.layout??null,e.syncFacetZoomLayouts(h.cells);let x=e.W.zoom_mode==="independent",y=lo(e,n.xMin,n.xMax,a),C=ao(e,n.yMin,n.yMax,u),_=h.cells[0]?.layout,v=_?jt(y,C,_):{xTicks:[],yTicks:[]},A=e.He?[]:v.xTicks,L=e.ve?[]:v.yTicks,T=t.dpr,w=e.Q;w&&_&&e._e(()=>ce(w,_,T)),At(r);for(let M=0;M<h.cells.length;M++){let I=h.cells[M],D=e.getZoomControllerForFacet(M),S=x&&D?D.getVisibleDomain():n,E=I.layout.buildProjectionMatrix(S.xMin,S.xMax,S.yMin,S.yMax,void 0,void 0,void 0,lt(e.S),lt(e.D));w&&!b&&e._e(()=>{let k=x?jt(lo(e,S.xMin,S.xMax,a),ao(e,S.yMin,S.yMax,u),I.layout).xTicks:A,W=x?jt(lo(e,S.xMin,S.xMax,a),ao(e,S.yMin,S.yMax,u),I.layout).yTicks:L;Ur(w,I.layout,k,W,i,T)}),Lt(r,I.layout,t.dpr,()=>{b&&e.renderBackground(t,I.layout,E,S,lt(e.S),lt(e.D)),e.glyph.drawSeries(e,t,E,M)})}e.le=y,e.te=C,e.kn=A,e.ae=L,e.Ri=i.N,e.Fi=d}function je(e){Nf(e),e.presentOverlay()}function Nf(e){!e.l||!e.u||!e.le||!e.te||!e.i||(ce(e.l,e.u,e.i.dpr),e.b?Uf(e):Of(e))}function Of(e){let t=e.u,n=e.v(),i=e.i?.dpr??1;if(e.Ht==="map"){if(e.t.numeric_axes){let l=Gn(t);Ji(e.l,e.le,t,l.xTicks,n,!!e.Ue,i,l.formatX),Qi(e.l,e.te,t,l.yTicks,n,!!e.De,i,l.formatY)}e.renderMapChrome(e.l,t,n,i)}else Gf(e,e.l,t,e.le,e.te,e.kn,e.ae,n,i);let r=se(e.t,On(e)),s=!1;if(e.Fi&&r!=="none"){let l=e.Ri??n.N,a=r==="floating",u={mode:a?"floating":"sidebar",legend:e.F,title:e.s??void 0,opacity:e.t.legend_opacity},m=a?e.F.floatingBox(e.t,t.cssWidth,t.cssHeight,ba(e,n)):null;if(e.k&&e.a.size>0){let f=he(n.Ne,l,e.a.size);m?Ft(e.l,m,e.a,f,n,u):so(e.l,t,e.a,f,n,u),s=!0}else if(e.s){let f={min:e.p,max:e.c,label:e.s},c=e.getColumnFormatter(e.s,"value");m?$e(e.l,m,f,l,n,c,u):Qt(e.l,t,f,l,n,c,u),s=!0}}s||e.F.clearPainted(),ha(e,e.l,t,0,1),e.de>=0&&e.$&&e.j&&zf(e,e.l,t)}function Uf(e){let t=e.b,n=e.l,i=e.v(),o=e.i?.dpr??1,r=e.kn,s=e.ae,l=e.le,a=e.te,u=e.Ht==="map",m=e.bi&&!e.He,f=e.gi&&!e.ve,c=e.W.zoom_mode==="independent",d=u&&e.t.numeric_axes,b=d&&t.cells.length>0?Gn(t.cells[0].layout):null;u&&e.renderMapChrome(n,e.u,i,o),(!u||b)&&m&&t.outerXAxisRect&&In(n,t.outerXAxisRect,l,b?b.xTicks:r,wn(t),i,!!e.Ue,o,b?b.formatX:e.getColumnFormatter(e.Ze,"tick")),(!u||b)&&f&&t.outerYAxisRect&&En(n,t.outerYAxisRect,a,b?b.yTicks:s,Mn(t),i,!!e.De,o,b?b.formatY:e.getColumnFormatter(e.Ve,"tick"));for(let C=0;C<t.cells.length;C++){let _=t.cells[C],v=c?e.getZoomControllerForFacet(C):null,A=v?v.getVisibleDomain():null,L=A?{...l,min:A.xMin,max:A.xMax}:l,T=A?{...a,min:A.yMin,max:A.yMax}:a,w=d?Gn(_.layout):null,M=w||(c?jt(L,T,_.layout):{xTicks:r,yTicks:s});if((!u||w)&&!m)if(e.He&&e.mt){let I=le(n,o);I&&xe(I,_.layout,e.mt,i)}else Ji(n,L,_.layout,M.xTicks,i,!!e.Ue,o,w?w.formatX:e.getColumnFormatter(e.Ze,"tick"));if((!u||w)&&!f)if(e.ve&&e.ft){let I=le(n,o);I&&Pe(I,_.layout,e.ft,i)}else Qi(n,T,_.layout,M.yTicks,i,!!e.De,o,w?w.formatY:e.getColumnFormatter(e.Ve,"tick"));_.titleRect&&Ut(n,_.label,_.titleRect,i,o),ha(e,n,_.layout,C,C+1)}let g=se(e.t,On(e)),h=g==="floating",x=h?e.F.floatingBox(e.t,e.u.cssWidth,e.u.cssHeight,ba(e,i)):t.legendRect,y=!1;if(e.Fi&&g!=="none"&&x){let C=e.Ri??i.N,_={mode:h?"floating":"sidebar",legend:e.F,title:e.s??void 0,sidebarGutter:h?void 0:t.legendRect?.width,opacity:e.t.legend_opacity};if(e.k&&e.a.size>0){let v=he(i.Ne,C,Math.max(1,e.a.size));Ft(n,x,e.a,v,i,_),y=!0}else e.s&&($e(n,h?x:{x:x.x,y:x.y+20,width:x.width,height:x.height-20},{min:e.p,max:e.c,label:e.s},C,i,e.getColumnFormatter(e.s,"value"),_),y=!0)}if(y||e.F.clearPainted(),e.de>=0&&e.$&&e.j){let C=isNaN(e.S)?0:e.S,_=isNaN(e.D)?0:e.D,v=e.$[e.de]+C,A=e.j[e.de]+_,L=Hf(e,e.de),T=e.glyph.tooltipOptions(),w=xa(e,T),M=ie(e.t),I=e.U.grid??[];for(let D=0;D<t.cells.length;D++){let S=t.cells[D],E=D===L,k=S.layout.R(v,A),W=S.layout.e;if(k.px<W.x||k.px>W.x+W.width||k.py<W.y||k.py>W.y+W.height)continue;E&&w&&Ye(n,S.layout,i,o,ya(e,S.layout,k,v,A),M.opacity);let V=e.W.coordinated_tooltip;He(n,k,E||V?I:[],S.layout,i,o,{...M,crosshair:T.crosshair&&(!E||!w),highlightRadius:E?T.highlightRadius:0})}}}function Hf(e,t){return e.M<=0?0:Math.floor(t/e.M)}function ha(e,t,n,i,o){if(!e.Ut||!e.$||!e.j)return;let r=e.Ut.dictionary,s=e.Ut.data,l=e.$,a=e.j,u=isNaN(e.S)?0:e.S,m=isNaN(e.D)?0:e.D,f=e.M;if(f<=0)return;let c=0;for(let y=i;y<o;y++)c+=e.X[y]??0;if(c===0)return;let d=e.i?.dpr??1,b=le(t,d);if(!b)return;let g=e.v(),h=n.e,x=Math.max(1,Math.ceil(c/Vf));b.save(),b.font=`11px ${g.fontFamily}`,b.fillStyle=g.Fe,b.textAlign="left",b.textBaseline="middle";for(let y=i;y<o;y++){let C=e.X[y]??0,_=y*f;for(let v=0;v<C;v+=x){let A=_+v,L=s[A];if(L<0)continue;let{px:T,py:w}=n.R(l[A]+u,a[A]+m);T<h.x||T>h.x+h.width||w<h.y||w>h.y+h.height||b.fillText(r[L],T+8,w-4)}}b.restore()}function zf(e,t,n){let i=e.de;if(i<0||!e.$||!e.j)return;let o=isNaN(e.S)?0:e.S,r=isNaN(e.D)?0:e.D,s=e.$[i]+o,l=e.j[i]+r,a=n.R(s,l),u=e.U.grid??[],m=e.v(),f=e.i?.dpr??1,c=e.glyph.tooltipOptions(),d=xa(e,c);d&&Ye(t,n,m,f,ya(e,n,a,s,l),e.t.tooltip_opacity),He(t,a,u,n,m,f,{...ie(e.t),crosshair:c.crosshair&&!d,highlightRadius:c.highlightRadius})}function xa(e,t){return t.axisIndicators&&(e.Ht!=="map"||!!e.t.numeric_axes)}function ya(e,t,n,i,o){let r,s,l=e.getColumnFormatter(e.Ze,"tick"),a=e.getColumnFormatter(e.Ve,"tick");if(e.Ht==="map"){let u=Gn(t),[m,f]=Zt(i,o);r=l?l(m):u.formatX(i),s=a?a(f):u.formatY(o)}else{let u=l??fe(e.le?.isDate,e.kn),m=a??fe(e.te?.isDate,e.ae);r=u(i),s=m(o)}return[{side:"bottom",px:n.px,py:n.py,text:r},{side:"left",px:n.px,py:n.py,text:s}]}var Vf,Kr=G(()=>{"use strict";ji();ot();Ht();Rn();ge();Fn();Vt();Nt();be();Dn();Hr();Tt();ia();Bn();Ce();Jt();Nn();Ve();Vf=5e3});function Yf(e){if(!e.pn.isDirty||!e.$||!e.j)return;let t=e.$,n=e.j,i=Math.max(1,e.T.length),o=e.M,r=isNaN(e.S)?0:e.S,s=isNaN(e.D)?0:e.D;e.pn.rebuild({xMin:e.Ce-r,xMax:e.rt-r,yMin:e.Se-s,yMax:e.st-s},e.At,l=>{for(let a=0;a<i;a++){let u=e.X[a]??0,m=a*o;for(let f=0;f<u;f++)l(m+f,t[m+f],n[m+f])}})}function Jr(e,t,n){if(!e.$||!e.j)return;let{layout:i,facetIdx:o}=Xf(e,t,n);if(!i){_a(e);return}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){_a(e);return}let s=i.O,l=i.Z,a=i.q,u=i.ee,m=s+(t-r.x)/r.width*(l-s),f=u-(n-r.y)/r.height*(u-a),c=r.width/(l-s),d=r.height/(u-a),b=isNaN(e.S)?0:e.S,g=isNaN(e.D)?0:e.D,h=m-b,x=f-g,y=o<0?$f(e,h,x,c,d):jf(e,o,h,x,c,d);if(y!==e.de||o!==e.Nn){if(e.de=y,e.Nn=o,y>=0){let C=e.U.beginHover(y);e.glyph.buildTooltipLines(e,y).then(_=>{e.U.commitHover(C,_)&&je(e)})}else e.U.clearHover();je(e)}}function _a(e){(e.de!==-1||e.Nn!==-1)&&(e.de=-1,e.Nn=-1,je(e))}function Xf(e,t,n){if(e.b){let i=e.b.cells;for(let o=0;o<i.length;o++){let r=i[o].layout.e;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 $f(e,t,n,i,o){Yf(e);let r=e.pn.query(t,n,Un,i,o,e.$,e.j);if(r>=0)return r;let s=Un*Un,l=Math.max(1,e.T.length),a=e.M,u=e.$,m=e.j;for(let f=0;f<l;f++){let c=e.X[f]??0,d=f*a;for(let b=0;b<c;b++){let g=d+b,h=(u[g]-t)*i,x=(m[g]-n)*o,y=h*h+x*x;y<s&&(s=y,r=g)}}return r}function jf(e,t,n,i,o,r){let s=e.X[t]??0;if(s===0)return-1;let l=e.M,a=t*l,u=e.$,m=e.j,f=Un*Un,c=-1;for(let d=0;d<s;d++){let b=a+d,g=(u[b]-n)*o,h=(m[b]-i)*r,x=g*g+h*h;x<f&&(f=x,c=b)}return c}function Ca(e,t){if(e.w.dismiss(),e.uo=t,t<0||!e.$||!e.j)return;let n=Zf(e,t);if(!n)return;let i=isNaN(e.S)?0:e.S,o=isNaN(e.D)?0:e.D,r=n.R(e.$[t]+i,e.j[t]+o),s=e.U.beginPin();e.glyph.buildTooltipLines(e,t).then(l=>{e.U.isPinFresh(s)&&e.uo===t&&l.length!==0&&e.w.pin(l,r,n,ie(e.t))}),e.de=-1,e.Nn=-1,je(e)}function Zf(e,t){if(e.b&&e.M>0){let n=Math.floor(t/e.M),i=e.b.cells[n];if(i)return i.layout}return e.u}function va(e){e.w.dismiss(),e.uo=-1}var Un,Aa=G(()=>{"use strict";Kr();be();Un=24});var en,Qr=G(()=>{"use strict";en=class{constructor(){p(this,"grid",null);p(this,"hoveredTarget",null);p(this,"mo",0);p(this,"fo",0)}beginHover(t){return this.grid=null,this.hoveredTarget=t,++this.mo}commitHover(t,n){return t!==this.mo?!1:(this.grid=n,!0)}clearHover(){this.grid=null,this.hoveredTarget=null,this.mo++}beginPin(){return++this.fo}isPinFresh(t){return t===this.fo}invalidatePin(){this.fo++}}});function j(e,t,n,i,o,r){let s=e.shaders.getOrCreate(t,n,i),l=e.gl,a={program:s};for(let u of o)a[u]=l.getUniformLocation(s,u);for(let u of r)a[u]=l.getAttribLocation(s,u);return a}var de=G(()=>{"use strict"});async function mo(e,t){let n=[];if(!e.Ot||!e.Oe)return n;let i=e.Ot[t];if(i<0)return n;if(e.T.length>0&&e.M>0){let s=Math.floor(t/e.M),l=e.T[s];l?.prefix&&n.push([l.prefix])}let o=await e.Oe.fetchRow(i),r=e.T.length>0&&e.M>0?e.T[Math.floor(t/e.M)]?.prefix??null:null;for(let[s,l]of o){if(l==null)continue;let a=s;if(r!==null){let u=`${r}|`;if(!s.startsWith(u))continue;a=s.substring(u.length)}else if(s.includes("|"))continue;if(typeof l=="number"){let u=e.getColumnFormatter(s,"value")(l);n.push([a,u])}else n.push([a,String(l)])}return n}var es=G(()=>{"use strict"});function qf(e,t,n,i,o){if(t.uniformMatrix4fv(e.u_projection,!1,n),t.uniform1f(e.u_point_size,i.t.point_size_px*o),i.p>=i.c)t.uniform2f(e.u_color_range,0,0);else if(i.s&&!i.k){let[s,l]=Hi(i.p,i.c);t.uniform2f(e.u_color_range,s,l)}else t.uniform2f(e.u_color_range,i.p,i.c);i.lt<i.ut?t.uniform2f(e.u_size_range,i.lt,i.ut):t.uniform2f(e.u_size_range,0,0);let r=Math.min(i.t.point_size_px,3);t.uniform2f(e.u_point_size_range,Math.max(2*o,i.t.point_size_px/r*o),i.t.point_size_px*r*o)}function La(e,t,n,i){let o=n.gl;if(!t.se)return!1;o.useProgram(e.program),qf(e,o,i,t,n.dpr),ze(n,t.se.texture,e.u_gradient_lut,0);let r=n.A.peek("a_position"),s=n.A.peek("a_color_value"),l=n.A.peek("a_size_value");return!r||!s||!l?!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,l.buffer),o.enableVertexAttribArray(e.a_size_value),o.vertexAttribPointer(e.a_size_value,1,o.FLOAT,!1,0,0),!0)}var tn,ts=G(()=>{"use strict";Vt();ge();de();es();gr();hr();tn=class{constructor(){p(this,"name","point");p(this,"g",null)}ensureProgram(t,n){this.g||(this.g=j(n,"scatter",li,ai,["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,i){let o=this.g;if(!o||!La(o,t,n,i))return;let r=n.gl,s=Math.max(1,t.T.length),l=t.M;for(let a=0;a<s;a++){let u=t.X[a]??0;u<=0||r.drawArrays(r.POINTS,a*l,u)}}drawSeries(t,n,i,o){let r=this.g;if(!r||!La(r,t,n,i))return;let s=t.X[o]??0;if(s<=0)return;let l=n.gl,a=t.M;l.drawArrays(l.POINTS,o*a,s)}buildTooltipLines(t,n){return mo(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:6,axisIndicators:!0}}destroy(t){this.g=null}}});function Q(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,l){i.drawArraysInstanced(o,r,s,l)}}}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 at(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 fo(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 ut(e,t,n,i,o,r=0){if(n<0)return!0;let s=e.A.peek(i);if(!s)return!1;let l=e.gl;return l.bindBuffer(l.ARRAY_BUFFER,s.buffer),l.enableVertexAttribArray(n),l.vertexAttribPointer(n,o,l.FLOAT,!1,0,r*o*Float32Array.BYTES_PER_ELEMENT),t.setDivisor(n,1),!0}var Be=G(()=>{"use strict"});function Ta(e,t,n,i){let o=n.gl;if(!t.se)return!1;let r=n.dpr;if(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.t.line_width_px*r),t.p>=t.c)o.uniform2f(e.u_color_range,0,0);else if(t.s&&!t.k){let[a,u]=Hi(t.p,t.c);o.uniform2f(e.u_color_range,a,u)}else o.uniform2f(e.u_color_range,t.p,t.c);ze(n,t.se.texture,e.u_gradient_lut,0);let s=Q(n),{setDivisor:l}=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),l(e.a_corner,0),o.enableVertexAttribArray(e.a_start),l(e.a_start,1),o.enableVertexAttribArray(e.a_end),l(e.a_end,1),o.enableVertexAttribArray(e.a_color_start),l(e.a_color_start,1),o.enableVertexAttribArray(e.a_color_end),l(e.a_color_end,1),!0}function wa(e,t,n,i){let o=t.X[i]??0;if(o<2)return;let r=n.gl,s=t.M,l=2*Float32Array.BYTES_PER_ELEMENT,a=Float32Array.BYTES_PER_ELEMENT,u=n.A.peek("a_position"),m=n.A.peek("a_color_value");if(!u||!m)return;let f=i*s*l;r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(e.a_start,2,r.FLOAT,!1,l,f),r.vertexAttribPointer(e.a_end,2,r.FLOAT,!1,l,f+l);let c=i*s*a;r.bindBuffer(r.ARRAY_BUFFER,m.buffer),r.vertexAttribPointer(e.a_color_start,1,r.FLOAT,!1,a,c),r.vertexAttribPointer(e.a_color_end,1,r.FLOAT,!1,a,c+a),Q(n).drawArraysInstanced(r.TRIANGLE_STRIP,0,4,o-1)}function Ma(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 nn,ns=G(()=>{"use strict";Vt();Be();de();ge();Ce();pr();br();nn=class{constructor(){p(this,"name","line");p(this,"g",null)}ensureProgram(t,n){if(this.g)return;let i=j(n,"line",ri,si,["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.g={...i,cornerBuffer:at(n.gl)}}draw(t,n,i){let o=this.g;if(!o||!Ta(o,t,n,i))return;let s=Math.max(1,t.T.length);for(let l=0;l<s;l++)wa(o,t,n,l);Ma(o,n)}drawSeries(t,n,i,o){let r=this.g;r&&Ta(r,t,n,i)&&(wa(r,t,n,o),Ma(r,n))}async buildTooltipLines(t,n){let i=[];if(!t.$||!t.j)return i;if(t.T.length>0&&t.M>0){let c=Math.floor(n/t.M),d=t.T[c];d&&i.push([d.prefix])}let o=t.$[n],r=t.j[n],s=t.je[t.Ue]||"",a=s==="date"||s==="datetime"?Yt(o):Ee(o);i.push([t.Ue||"Row",a]);let u=t.je[t.De]||"",f=u==="date"||u==="datetime"?Yt(r):Ee(r);return i.push([t.De,f]),i}tooltipOptions(){return{crosshair:!0,highlightRadius:5,axisIndicators:!0}}destroy(t){let n=this.g;n?.cornerBuffer&&t.i&&t.i.gl.deleteBuffer(n.cornerBuffer),this.g=null}}});function tc(e){switch(e){case"density":return Kf;case"extreme":return Qf;case"signed":return ec;case"mean":default:return Jf}}function Ra(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 is(e,t,n,i){return j(e,t,n,i,["u_projection","u_radius_ndc","u_intensity","u_color_range"],["a_corner","a_position","a_color_value"])}function nc(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 Fa(e){let t=e.A.peek("a_position"),n=e.A.peek("a_color_value");return!!t&&!!n}function oc(e,t){if(!e.s||e.k)return t.robustBounds=null,null;let n=t.robustBounds;if(n&&n.dataCount===e.At&&n.colorName===e.s&&n.colorIsString===e.k)return{lo:n.lo,hi:n.hi};let i=rc(e);return i?(t.robustBounds={lo:i.lo,hi:i.hi,dataCount:e.At,colorName:e.s,colorIsString:e.k},i):(t.robustBounds=null,null)}function rc(e){if(!e.Lt||e.At<2)return null;let t=e.M,n=Math.max(1,e.T.length),i=Math.max(1,Math.ceil(e.At/ic)),o=[],r=e.Lt;for(let m=0;m<n;m++){let f=e.X[m]??0,c=m*t;for(let d=0;d<f;d+=i){let b=r[c+d];Number.isFinite(b)&&o.push(b)}}if(o.length<2)return null;o.sort((m,f)=>m-f);let s=Math.floor(o.length*.05),l=Math.min(o.length-1,Math.ceil(o.length*.95)),a=o[s],u=o[l];return u>a?{lo:a,hi:u}:e.c>e.p?{lo:e.p,hi:e.c}:null}var Kf,Jf,Qf,ec,on,ic,os=G(()=>{"use strict";Vt();Be();de();es();xr();yr();_r();js();qs();Cr();vr();Kf=0,Jf=1,Qf=2,ec=3,on=class{constructor(){p(this,"name","density");p(this,"g",null)}ensureProgram(t,n){if(this.g){this.ensureHeatTarget(t,n);return}let i=n.gl,o=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),i.STATIC_DRAW);let r=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,r),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),i.STATIC_DRAW);let{internalFormat:s,format:l,type:a,isFloat:u}=nc(n),m=Ra(i),f=i.createFramebuffer();this.g={splat:is(n,"density-splat",Wt,Ci),extremeSplat:null,mrtSplat:null,resolve:j(n,"density-resolve",Ai,Li,["u_heat","u_extreme","u_gradient_lut","u_heat_max","u_color_mode"],["a_corner"]),quadCornerBuffer:o,tripleCornerBuffer:r,heatTexture:m,heatFramebuffer:f,extremeTexture:null,extremeFramebuffer:null,mrtFramebuffer:null,heatWidth:0,heatHeight:0,heatType:a,heatInternalFormat:s,heatFormat:l,floatFbo:u,indexedBlend:null,signedDowngradeWarned:!1,robustBounds:null},this.ensureHeatTarget(t,n)}draw(t,n,i){let o=this.g;if(!o||!Fa(n))return;let r=Math.max(1,t.T.length),s=t.M,l=0;for(let a=0;a<r;a++)l+=t.X[a]??0;l!==0&&this.runSplatAndResolve(t,n,o,i,a=>{for(let u=0;u<r;u++){let m=t.X[u]??0;m<=0||a(u*s,m)}})}drawSeries(t,n,i,o){let r=this.g;if(!r||!Fa(n))return;let s=t.X[o]??0;if(s<=0)return;let l=t.M;this.runSplatAndResolve(t,n,r,i,a=>a(o*l,s))}buildTooltipLines(t,n){return mo(t,n)}tooltipOptions(){return{crosshair:!0,highlightRadius:0,axisIndicators:!0}}destroy(t){let n=this.g;if(!n||!t.i){this.g=null;return}let i=t.i.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.g=null}ensureHeatTarget(t,n){let i=this.g;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 l=o;l.bindFramebuffer(l.FRAMEBUFFER,i.mrtFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,i.heatTexture,0),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT1,l.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=Ra(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){return n.extremeSplat||(n.extremeSplat=is(t,"density-extreme",Wt,vi)),n.extremeSplat}ensureMrtSplatProgram(t,n){return n.mrtSplat||(n.mrtSplat=is(t,"density-mrt",Zs,Ks)),n.mrtSplat}activeMode(t,n,i){let o=n.t.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.se)return;let s=this.activeMode(n,t,i),l=t.p<t.c&&(!!t.s||t.T.length>1),a=0,u=0;if(s!=="density"&&l&&(a=t.p,u=t.c,!t.k&&(s==="mean"||s==="extreme"))){let f=oc(t,i);f&&(a=f.lo,u=f.hi)}s==="extreme"&&this.ensureExtremeTarget(n,i),s==="extreme"&&i.indexedBlend?this.runMrtExtremePass(n,i,o,t.t.gradient_intensity,n.dpr*t.t.gradient_radius_px,a,u,r):(this.runHeatPass(n,i,o,t.t.gradient_intensity,n.dpr*t.t.gradient_radius_px,a,u,r),s==="extreme"&&this.runExtremePass(n,i,o,t.t.gradient_intensity,n.dpr*t.t.gradient_radius_px,a,u,r)),this.runResolvePass(n,i,t,s)}runHeatPass(t,n,i,o,r,s,l,a){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,l),this.bindAndDispatchInstanced(t,n,n.splat,a),this.unbindSplatInstancing(t,n.splat)}runExtremePass(t,n,i,o,r,s,l,a){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 c=u;c.blendEquation(c.MAX),this.bindSplatProgram(u,f,i,o,r,n.heatWidth,n.heatHeight,s,l),this.bindAndDispatchInstanced(t,n,f,a),this.unbindSplatInstancing(t,f),u.blendEquation(u.FUNC_ADD)}runMrtExtremePass(t,n,i,o,r,s,l,a){let u=t.gl,m=n.indexedBlend,f=!!u.getParameter(u.SCISSOR_TEST),c=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,c,i,o,r,n.heatWidth,n.heatHeight,s,l),this.bindAndDispatchInstanced(t,n,c,a),this.unbindSplatInstancing(t,c),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,l,a,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,l);t.uniform2f(n.u_radius_ndc,m,f),t.uniform2f(n.u_color_range,a,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=Q(t);s.setDivisor(i.a_corner,0),s.setDivisor(i.a_position,1),s.setDivisor(i.a_color_value,1);let l=t.A.peek("a_position"),a=t.A.peek("a_color_value");o((u,m)=>{let f=2*Float32Array.BYTES_PER_ELEMENT,c=Float32Array.BYTES_PER_ELEMENT;r.bindBuffer(r.ARRAY_BUFFER,l.buffer),r.enableVertexAttribArray(i.a_position),r.vertexAttribPointer(i.a_position,2,r.FLOAT,!1,f,u*f),r.bindBuffer(r.ARRAY_BUFFER,a.buffer),r.enableVertexAttribArray(i.a_color_value),r.vertexAttribPointer(i.a_color_value,1,r.FLOAT,!1,c,u*c),s.drawArraysInstanced(r.TRIANGLE_STRIP,0,4,m)})}unbindSplatInstancing(t,n){let i=Q(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.t.gradient_heat_max),r.uniform1i(s.u_color_mode,tc(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),ze(t,i.se.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)}};ic=5e4});var St,co,po,bo,rs=G(()=>{"use strict";Ln();kl();Vl();Kr();Aa();Qr();ts();ns();os();St=class extends De{constructor(n){super();p(this,"glyph");p(this,"Ht","cartesian");p(this,"se",null);p(this,"Ze","");p(this,"Ve","");p(this,"Ue","");p(this,"De","");p(this,"nr",!1);p(this,"s","");p(this,"re","");p(this,"wi","");p(this,"k",!1);p(this,"He",!1);p(this,"ve",!1);p(this,"bn",[]);p(this,"gn",[]);p(this,"ir",new Map);p(this,"or",new Map);p(this,"mt",null);p(this,"ft",null);p(this,"T",[]);p(this,"Ce",1/0);p(this,"rt",-1/0);p(this,"Se",1/0);p(this,"st",-1/0);p(this,"S",NaN);p(this,"D",NaN);p(this,"p",1/0);p(this,"c",-1/0);p(this,"lt",1/0);p(this,"ut",-1/0);p(this,"Pn",1/0);p(this,"Bn",-1/0);p(this,"Gn",1/0);p(this,"Wn",-1/0);p(this,"vi",1/0);p(this,"Ai",-1/0);p(this,"Li",1/0);p(this,"Ti",-1/0);p(this,"M",0);p(this,"X",[]);p(this,"no",0);p(this,"$",null);p(this,"j",null);p(this,"Lt",null);p(this,"Ot",null);p(this,"Ut",null);p(this,"At",0);p(this,"a",new Map);p(this,"U",new en);p(this,"io",null);p(this,"oo",null);p(this,"ro",null);p(this,"rr",0);p(this,"pn",new Xi);p(this,"u",null);p(this,"de",-1);p(this,"uo",-1);p(this,"Nn",-1);p(this,"b",null);p(this,"le",null);p(this,"te",null);p(this,"kn",null);p(this,"ae",null);p(this,"Ri",null);p(this,"Fi",!1);p(this,"Mi",null);p(this,"so",null);p(this,"ao",-1);this.glyph=n}colorScaleColumn(){return this.s||null}repaintChrome(){je(this)}projectPoint(n,i){return[n,i]}renderBackground(n,i,o,r,s,l){}renderMapChrome(n,i,o,r){}tooltipCallbacks(){return{onHover:(n,i)=>Jr(this,n,i),onLeave:()=>{this.de!==-1&&(this.de=-1,je(this))},onPin:(n,i)=>{if(Jr(this,n,i),this.de>=0){let o=this.de;Ca(this,o),this.Dr(o)}},onUnpin:()=>{this.emitUnselect()}}}async Dr(n){if(!this.Ot)return;let i=this.Ot[n],o=this.L[1]||this.L[0]||"",r=[];if(this.T.length>0&&this.M>0){let s=Math.floor(n/this.M),l=this.T[s];l?.prefix&&this.B.length>0&&(r=l.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.i=n,o===0&&Ul(this,n,i,r),s!==0&&(Hl(this,n,i,o,s,r),this.t.domain_mode==="expand"&&(this.He||(this.Pn=this.Ce,this.Bn=this.rt),this.ve||(this.Gn=this.Se,this.Wn=this.st),this.vi=this.p,this.Ai=this.c,this.Li=this.lt,this.Ti=this.ut),await this.requestRender(n))}resetExpandedDomain(){this.Pn=1/0,this.Bn=-1/0,this.Gn=1/0,this.Wn=-1/0,this.vi=1/0,this.Ai=-1/0,this.Li=1/0,this.Ti=-1/0}kt(n){n.uploadedCount===0&&this.At===0||(this.i=n,ga(this,n))}destroyInternal(){this.glyph.destroy(this),this.se=null,this.$=null,this.j=null,this.Lt=null,this.Ot=null,this.Ut=null,this.U.clearHover(),this.a.clear(),this.pn.clear(),this.io=null,this.oo=null,this.ro=null,this.T=[],this.X=[],va(this)}},co=class extends St{constructor(){super(new tn)}},po=class extends St{constructor(){super(new nn)}},bo=class extends St{constructor(){super(new on)}}});var sr,Xu=G(()=>{"use strict";sr=class{constructor(t=256){p(this,"Me",new Map);p(this,"gr");this.gr=t}get(t){let n=this.Me.get(t);return n!==void 0&&(this.Me.delete(t),this.Me.set(t,n)),n}set(t,n,i){if(this.Me.has(n)){let o=this.Me.get(n);t.deleteTexture(o),this.Me.delete(n)}for(this.Me.set(n,i);this.Me.size>this.gr;){let o=this.Me.keys().next().value;if(o===void 0)break;let r=this.Me.get(o);t.deleteTexture(r),this.Me.delete(o)}}has(t){return this.Me.has(t)}dispose(t){for(let n of this.Me.values())t.deleteTexture(n);this.Me.clear()}}});function cn(e,t,n,i){return`${e}/${t}/${n}/${i}`}var lr,$u=G(()=>{"use strict";lr=class{constructor(){p(this,"Re",new Map);p(this,"hr",()=>{})}setOnLoad(t){this.hr=t}load(t,n,i,o){let r=cn(t.id,n,i,o),s=this.Re.get(r);if(s)return s.promise;let l=new AbortController,a=t.urlFor(n,i,o),u=this.Pr(a,l.signal).then(m=>(this.Re.delete(r),m&&this.hr(),m)).catch(()=>(this.Re.delete(r),null));return this.Re.set(r,{promise:u,abort:l}),u}cancelAll(){for(let t of this.Re.values())t.abort.abort();this.Re.clear()}cancelExcept(t){for(let[n,i]of this.Re)t.has(n)||(i.abort.abort(),this.Re.delete(n))}async Pr(t,n){let i=self.origin?.startsWith("http")?`${self.origin}/`:void 0,o=await fetch(t,{signal:n,referrer:i});if(!o.ok)return null;let r=await o.blob();return await createImageBitmap(r)}}});var ar,ju=G(()=>{"use strict";Bn();Xu();$u();Ar();Lr();de();ar=class{constructor(){p(this,"o",null);p(this,"H",null);p(this,"g",new sr);p(this,"ti",new lr);p(this,"ni",null);p(this,"xr",1);p(this,"yr",()=>{})}setOnTileLoad(t){this.yr=t,this.ti.setOnLoad(t)}setSource(t,n){this.ni?.id!==n.id&&(this.g.dispose(t),this.ti.cancelAll(),this.ni=n)}setAlpha(t){this.xr=Math.max(0,Math.min(1,t))}get source(){return this.ni}render(t,n,i,o,r,s){let l=this.ni;if(!l)return;this.Br(t);let a=this.o,u=this.H;if(!a||!u)return;let m=t.gl,f=t.dpr,c=Math.max(1,n.e.width*f),d=o.xMax-o.xMin;if(!isFinite(d)||d<=0)return;let b=d/c,g=Kl(b,l.tileSize,l.maxZoom),h=Jl(o,g),x=new Set;for(let C of h)x.add(cn(l.id,C.z,C.x,C.y));this.ti.cancelExcept(x),m.useProgram(a.program),m.uniformMatrix4fv(a.u_projection,!1,i),m.uniform1f(a.u_alpha,this.xr),m.bindBuffer(m.ARRAY_BUFFER,u),m.enableVertexAttribArray(a.a_corner),m.vertexAttribPointer(a.a_corner,2,m.FLOAT,!1,0,0),m.activeTexture(m.TEXTURE0),m.uniform1i(a.u_tile,0);let y=m.isEnabled(m.BLEND);m.enable(m.BLEND),m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);for(let C of h)this.Gr(m,a,l,C,r,s);y||m.disable(m.BLEND)}destroy(t){this.ti.cancelAll(),this.g.dispose(t),this.H&&(t.deleteBuffer(this.H),this.H=null),this.o=null}Gr(t,n,i,o,r,s){let l=ql(o.z,o.x,o.y),a={xMin:l.xMin-r,xMax:l.xMax-r,yMin:l.yMin-s,yMax:l.yMax-s},u=cn(i.id,o.z,o.x,o.y),m=this.g.get(u);if(m){this._r(t,n,m,a,[0,0],[1,1]);return}this.Wr(t,i,o);for(let f=1;f<=6;f++){let c=o.z-f;if(c<0)return;let d=o.x>>f,b=o.y>>f,g=cn(i.id,c,d,b),h=this.g.get(g);if(!h)continue;let x=1<<f,y=o.x-d*x,C=o.y-b*x,_=1/x,v=[y*_,C*_],A=[v[0]+_,v[1]+_];this._r(t,n,h,a,v,A);return}}_r(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)}Wr(t,n,i){let o=cn(n.id,i.z,i.x,i.y);this.g.has(o)||this.ti.load(n,i.z,i.x,i.y).then(r=>{if(!r)return;if(this.ni?.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.g.set(t,o,s),this.yr()})}Br(t){if(this.o&&this.H)return;let n=t.gl;this.o=j(t,"map-tile",Ti,wi,["u_projection","u_extent_min","u_extent_max","u_uv_min","u_uv_max","u_tile","u_alpha"],["a_corner"]);let i=n.createBuffer();i&&(n.bindBuffer(n.ARRAY_BUFFER,i),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),n.STATIC_DRAW),this.H=i)}}});var ur={};fm(ur,{MapChart:()=>dn,MapDensityChart:()=>Us,MapLineChart:()=>Os,MapScatterChart:()=>Ns});var dn,Ns,Os,Us,mr=G(()=>{"use strict";rs();ts();ns();os();ju();Ei();Bn();Tt();dn=class extends St{constructor(n){super(n);p(this,"Ht","map");p(this,"it");this.it=new ar,this.it.setOnTileLoad(()=>{this.i&&this.requestRender(this.i)})}projectPoint(n,i){return eo(n,i)}getZoomConfig(){return{lockAspect:!0}}setPluginConfig(n){super.setPluginConfig(n),this.i&&this.it.setSource(this.i.gl,et.sourceFor(n.map_tile_provider)),this.it.setAlpha(n.map_tile_alpha)}renderBackground(n,i,o,r,s,l){this.it.source||(this.it.setSource(n.gl,et.sourceFor(this.t.map_tile_provider)),this.it.setAlpha(this.t.map_tile_alpha)),this.it.render(n,i,o,r,s,l)}renderMapChrome(n,i,o,r){if(!n)return;let s=le(n,r);if(!s)return;let l=this.it.source?.attribution??"";if(!l)return;let a=i.e;s.save(),s.font=`10px ${o.fontFamily}`,s.textAlign="right",s.textBaseline="bottom";let u=4,f=s.measureText(l).width,c=12,d=a.x+a.width-4,b=a.y+a.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(d-f-u*2,b-c-u,f+u*2,c+u),s.fillStyle=o.Fe,s.fillText(l,d-u,b-u/2),s.restore()}destroyInternal(){this.i&&this.it.destroy(this.i.gl),super.destroyInternal()}},Ns=class extends dn{constructor(){super(new tn)}},Os=class extends dn{constructor(){super(new nn)}},Us=class extends dn{constructor(){super(new on)}}});typeof window>"u"&&(globalThis.window={});var xn=class{constructor(t){p(this,"ht");p(this,"r",new Map);p(this,"Tn",0);p(this,"ii",0);this.ht=t}get totalCapacity(){return this.Tn}get maxCapacity(){return this.ii}set maxCapacity(t){this.ii=t}ensureCapacity(t){this.Tn=this.ii>0?Math.min(t,this.ii):t}peek(t){return this.r.get(t)}getOrCreate(t,n,i){let o=this.Tn*n*i,r=this.r.get(t);if(r&&r.byteCapacity>=o)return r;let s=this.ht;r&&s.deleteBuffer(r.buffer);let l=s.createBuffer();return s.bindBuffer(s.ARRAY_BUFFER,l),s.bufferData(s.ARRAY_BUFFER,o,s.DYNAMIC_DRAW),r={buffer:l,byteCapacity:o},this.r.set(t,r),r}upload(t,n,i,o=1){let r=this.ht,s=this.getOrCreate(t,o,n.BYTES_PER_ELEMENT);if(!1){let l=i+n.byteLength;if(l>s.byteCapacity)throw new Error(`BufferPool.upload("${t}"): write ${i}..${l} 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.r.values())this.ht.deleteBuffer(t.buffer);this.r.clear(),this.Tn=0}};var yn=class{constructor(t){p(this,"ht");p(this,"oi",new Map);this.ht=t}precompile(t){for(let n of t)this.getOrCreate(n.name,n.vert,n.frag)}getOrCreate(t,n,i){let o=this.oi.get(t);if(o)return o;let r=this.ht,s=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(s,n),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){let a=r.getShaderInfoLog(s);throw r.deleteShader(s),new Error(`Vertex shader compile error [${t}]: ${a}`)}let l=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(l,i),r.compileShader(l),!r.getShaderParameter(l,r.COMPILE_STATUS)){let a=r.getShaderInfoLog(l);throw r.deleteShader(s),r.deleteShader(l),new Error(`Fragment shader compile error [${t}]: ${a}`)}if(o=r.createProgram(),r.attachShader(o,s),r.attachShader(o,l),r.linkProgram(o),!r.getProgramParameter(o,r.LINK_STATUS)){let a=r.getProgramInfoLog(o);throw r.deleteProgram(o),r.deleteShader(s),r.deleteShader(l),new Error(`Shader link error [${t}]: ${a}`)}return r.deleteShader(s),r.deleteShader(l),this.oi.set(t,o),o}releaseAll(){for(let t of this.oi.values())this.ht.deleteProgram(t);this.oi.clear()}};var ii="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 oi="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.);}";pr();br();gr();hr();var ui="attribute vec2 a_position;uniform mat4 u_projection;void main(){gl_Position=u_projection*vec4(a_position,0.,1.);}";var mi="precision highp float;uniform vec3 u_color;uniform float u_opacity;void main(){gl_FragColor=vec4(u_color,u_opacity);}";var Ke="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 Je="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 fi="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 ci="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 di="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 pi="precision highp float;varying vec3 v_color;void main(){gl_FragColor=vec4(v_color,1.);}";var bi="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 gi="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 hi="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 xi="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";var yi="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 _i="precision highp float;varying vec4 v_color;void main(){gl_FragColor=v_color;}";xr();yr();_r();Cr();vr();Ar();Lr();var Tr=[{name:"bar",vert:ii,frag:oi},{name:"line",vert:ri,frag:si},{name:"scatter",vert:li,frag:ai},{name:"bar-area",vert:ui,frag:mi},{name:"bar-scatter",vert:fi,frag:ci},{name:"line-uniform",vert:Ke,frag:Je},{name:"candlestick-body",vert:di,frag:pi},{name:"heatmap",vert:bi,frag:gi},{name:"sunburst-arc",vert:hi,frag:xi},{name:"treemap",vert:yi,frag:_i},{name:"density-splat",vert:Wt,frag:Ci},{name:"density-extreme",vert:Wt,frag:vi},{name:"density-resolve",vert:Ai,frag:Li},{name:"map-tile",vert:Ti,frag:wi}];var Hm=1,ht=class{constructor(t,n={}){p(this,"id");p(this,"canvas");p(this,"gl");p(this,"isWebGL2");p(this,"shaders");p(this,"Io");p(this,"Eo",null);p(this,"Jt");p(this,"xt",!1);p(this,"ri",new Set);this.id=Hm++,this.canvas=t,this.Jt=n.precompile??!1;let i=t.getContext("webgl2",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(i)this.gl=i,this.isWebGL2=!0;else{let o=t.getContext("webgl",{antialias:!0,alpha:!0,premultipliedAlpha:!1});if(!o)throw new Error("WebGL is not supported");this.gl=o,this.isWebGL2=!1}this.shaders=new yn(this.gl),this.Jt&&this.shaders.precompile(Tr),this.Io=this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),this.isWebGL2||(this.Eo=this.gl.getExtension("ANGLE_instanced_arrays")),t.addEventListener("webglcontextlost",o=>{this.xt||o.preventDefault()}),t.addEventListener("webglcontextrestored",()=>{this.shaders.releaseAll(),this.shaders=new yn(this.gl),this.Jt&&this.shaders.precompile(Tr);for(let o of this.ri)o()})}resetVertexArrayState(){let t=this.gl;for(let n=0;n<this.Io;n++)t.disableVertexAttribArray(n),this.isWebGL2?t.vertexAttribDivisor(n,0):this.Eo?.vertexAttribDivisorANGLE(n,0)}onRestore(t){return this.ri.add(t),()=>this.ri.delete(t)}isContextLost(){return this.xt||this.gl.isContextLost()}get destroyed(){return this.xt}destroy(){this.xt=!0,this.ri.clear(),this.shaders.releaseAll();let t=this.gl.getExtension("WEBGL_lose_context");t&&t.loseContext()}};var _n=class{constructor(t,n={}){p(this,"P");p(this,"si");p(this,"Po");p(this,"r");p(this,"li",0);p(this,"zi",0);p(this,"Yi",0);p(this,"Xi",1);p(this,"xt",!1);p(this,"ai",null);p(this,"yt",null);p(this,"wn",null);p(this,"Qt",null);t instanceof ht?(this.P=t,this.si=!1):(this.P=new ht(t,{precompile:n.precompile??!1}),this.si=!0),this.r=new xn(this.P.gl),this.Po=this.P.onRestore(()=>{this.r.releaseAll(),this.r=new xn(this.P.gl),this.li=0})}get gl(){return this.P.gl}get backendId(){return this.P.id}isContextLost(){return this.xt||this.P.isContextLost()}get isWebGL2(){return this.P.isWebGL2}get shaders(){return this.P.shaders}get A(){return this.r}get uploadedCount(){return this.li}set uploadedCount(t){this.li=t}resize(t,n,i){this.zi=t,this.Yi=n,this.Xi=i;let o=Math.round(t*i),r=Math.round(n*i),s=this.P.canvas;(s.width!==o||s.height!==r)&&(s.width=o,s.height=r,this.P.gl.viewport(0,0,o,r))}requestResize(t,n,i){this.Qt={cssWidth:t,cssHeight:n,dpr:i}}applyPendingResize(){if(!this.Qt)return!1;let{cssWidth:t,cssHeight:n,dpr:i}=this.Qt;return this.Qt=null,this.resize(t,n,i),!0}beginFrame(){if(this.si){this.applyPendingResize();return}let t=this.Qt;this.Qt=null,t?this.resize(t.cssWidth,t.cssHeight,t.dpr):this.resize(this.zi,this.Yi,this.Xi);let n=this.P.gl,i=this.P.canvas;n.bindFramebuffer(n.FRAMEBUFFER,null),n.viewport(0,0,i.width,i.height),n.disable(n.SCISSOR_TEST),n.disable(n.DEPTH_TEST),this.P.resetVertexArrayState()}get cssWidth(){return this.zi}get cssHeight(){return this.Yi}get dpr(){return this.Xi}clear(){this.P.gl.clearColor(0,0,0,0),this.P.gl.clear(this.P.gl.COLOR_BUFFER_BIT|this.P.gl.DEPTH_BUFFER_BIT),this.li=0}setFrameCallback(t){this.ai=t}endFrame(){if(!this.ai||this.isContextLost())return;let t=this.P.canvas;if(typeof t.transferToImageBitmap!="function")return;let n=t.transferToImageBitmap();this.ai(n)}async awaitGpuFence(){if(!this.P.isWebGL2){this.P.gl.finish();return}let t=this.P.gl,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}if(i=0,await this.Lr(),this.xt)return}}finally{t.deleteSync(n)}}ensureBufferCapacity(t){this.r.ensureCapacity(t)}Lr(){return this.yt||(this.yt=new MessageChannel,this.yt.port1.start()),new Promise(t=>{let n=this.yt;this.wn=t,n.port1.addEventListener("message",()=>{this.wn=null,t()},{once:!0}),n.port2.postMessage(null)})}destroy(){if(this.xt=!0,this.ai=null,this.Po(),this.r.releaseAll(),this.wn){let t=this.wn;this.wn=null,t()}this.yt&&(this.yt.port1.close(),this.yt.port2.close(),this.yt=null),this.si&&this.P.destroy()}};var Mi=class{constructor(t,n={}){p(this,"Bo");p(this,"Jt");p(this,"en",[]);p(this,"Go",0);this.Bo=Math.max(1,t),this.Jt=n.precompile??!1}acquire(){let t;if(this.en.length<this.Bo)t=this.Wo(),this.en.push(t);else{let n=this.Go%this.en.length;this.Go++,this.en[n].isContextLost()&&(this.en[n]=this.Wo()),t=this.en[n]}return t}Wo(){let t=new OffscreenCanvas(1,1);return new ht(t,{precompile:this.Jt})}};Ri();Ri();function el(e,t,n,i){let{controller:o,layout:r}=e,s=r.e,l=o.getVisibleDomain(),a=l.xMin+(t-s.x)/s.width*(l.xMax-l.xMin),u=l.yMax-(n-s.y)/s.height*(l.yMax-l.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 c=o.getVisibleDomain(),d=c.xMin+(t-s.x)/s.width*(c.xMax-c.xMin),b=c.yMax-(n-s.y)/s.height*(c.yMax-c.yMin),g=o.baseXRange,h=o.baseYRange;f!=="x"&&g>0&&(o.normTranslateX+=(a-d)/g),f!=="y"&&h>0&&(o.normTranslateY+=(u-b)/h)}function tl(e,t,n){let{controller:i,layout:o}=e,r=i.getVisibleDomain(),s=o.e,l=(r.xMax-r.xMin)/s.width,a=(r.yMax-r.yMin)/s.height,u=i.lockedAxis,m=i.baseXRange,f=i.baseYRange;u!=="x"&&m>0&&(i.normTranslateX-=t*l/m),u!=="y"&&f>0&&(i.normTranslateY+=n*a/f)}be();var Di=class{constructor(t){p(this,"sn");this.sn=t}pin(t,n,i,o=Qe){this.sn({kind:"pinTooltip",grid:t,style:o,pos:n,bounds:i})}dismiss(){this.sn({kind:"dismissTooltip"})}setCursor(t){this.sn({kind:"setCursor",cursor:t})}emitUserClick(t){this.sn({kind:"userClick",detail:t})}emitUserSelect(t){this.sn({kind:"userSelect",selected:t.selected,row:t.row,column_names:t.column_names,insertConfig:t.insertConfig})}};rs();Ln();var go=class{constructor(t=1024){p(this,"size");p(this,"value");p(this,"colorValue");p(this,"sizeSign");p(this,"x0");p(this,"y0");p(this,"x1");p(this,"y1");p(this,"a0");p(this,"a1");p(this,"r0");p(this,"r1");p(this,"depth");p(this,"parent");p(this,"firstChild");p(this,"nextSibling");p(this,"lastChild");p(this,"childCount");p(this,"leafRowIdx");p(this,"name");p(this,"colorLabel");p(this,"count",0);p(this,"capacity",0);this.sr(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.sr(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}sr(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 Sa(e,t){let n=[],i=t;for(;e.parent[i]!==-1;)n.push(e.name[i]),i=e.parent[i];return n.reverse()}Qr();function ho(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var rn=class extends De{constructor(){super(...arguments);p(this,"re","");p(this,"s","");p(this,"ue","empty");p(this,"m",new go);p(this,"K",-1);p(this,"C",-1);p(this,"pe",[]);p(this,"Vt",new Map);p(this,"Si",0);p(this,"p",1/0);p(this,"c",-1/0);p(this,"a",new Map);p(this,"J",null);p(this,"me",0);p(this,"U",new en)}colorScaleColumn(){return this.L[1]||null}};Tn();kn();Ce();function Dt(e,t,n,i,o){if(!e||t<=0)return null;let r=new Float64Array(t),s=1/0,l=-1/0;for(let u=0;u<t;u++){let m=e[u+n];r[u]=m,m<s&&(s=m),m>l&&(l=m)}let a=1/0;for(let u=1;u<t;u++){let m=Math.abs(r[u]-r[u-1]);m>0&&m<a&&(a=m)}return(!isFinite(a)||a===0)&&(a=Math.max(1,l-s)),{categoryPositions:r,numericCategoryDomain:{min:s-a/2,max:l+a/2,isDate:o,label:i,bandWidth:a}}}function sn(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 sc(e,t,n){return!t||e==null||Number.isNaN(e)?"":n==="boolean"?e?"true":"false":n==="date"||n==="datetime"?Yt(e):n==="integer"?String(e|0):n==="float"?Ee(e):String(e)}function ss(e,t,n){let i=e.values,o=e.valid,r=new Int32Array(t),s=[""],l=new Map;l.set("",0);let a=new Map;for(let u=0;u<t;u++){if(!(o?!!(o[u>>3]>>(u&7)&1):!0)){r[u]=0;continue}let f=i[u],c=a.get(f);if(c===void 0){let d=sc(f,!0,n);c=l.get(d),c===void 0&&(c=s.length,s.push(d),l.set(d,c)),a.set(f,c)}r[u]=c}return{indices:r,dictionary:s}}function ln(e,t,n,i=[],o){if(o?.mode==="numeric"){let m=e.get("__ROW_PATH_0__");if(m&&m.type!=="string"&&m.values){let f=0,c=m.values,d=m.valid;for(;f<t;){let b=d?!!(d[f>>3]>>(f&7)&1):!0,g=c[f];if(b&&g!=null&&!Number.isNaN(g))break;f++}return{rowPaths:[],numCategories:Math.max(0,t-f),rowOffset:f}}}let r=[];for(let m=0;;m++){let f=e.get(`__ROW_PATH_${m}__`);if(!f)break;if(f.type==="string"&&f.indices&&f.dictionary)r.push({indices:f.indices,dictionary:f.dictionary});else if(f.values){let c=i[m]??"string";r.push(ss(f,t,c))}else break}let s=0;if(n>0&&r.length>0)for(;s<t;){let m=!1;for(let f of r){let c=f.dictionary[f.indices[s]];if(c!=null&&c!==""){m=!0;break}}if(m)break;s++}let l=Math.max(0,t-s),a=r.length;return{rowPaths:n>0&&a>0?r.map((m,f)=>{let c=new Array(l),d=0;for(let g=0;g<l;g++){let h=m.dictionary[m.indices[g+s]]??"";c[g]=h,h.length>d&&(d=h.length)}let b=f===a-1?[]:no(m.indices,m.dictionary,s,s+l).map(g=>({startIdx:g.startIdx-s,endIdx:g.endIdx-s,label:g.label}));return{labels:c,runs:b,maxLabelChars:d}}):[],numCategories:l,rowOffset:s}}function ls(e,t,n,i){if(e.length===0)return null;for(let c of e)if(c.type!=="string")return null;let o=Math.max(0,t-n),r=[],s=new Map,l=e.map(()=>new Int32Array(o)),a=c=>{let d=s.get(c);return d===void 0&&(d=r.length,r.push(c),s.set(c,d)),d};for(let c=0;c<e.length;c++){let d=e[c].data,b=l[c];for(let g=0;g<o;g++){let h=g+n,x;if(!d)x="(null)";else{let y=d.valid;if(!(y?!!(y[h>>3]>>(h&7)&1):!0))x="(null)";else if(d.indices&&d.dictionary)x=d.dictionary[d.indices[h]]??"(null)";else if(d.values){let _=d.values[h];x=_==null?"(null)":String(_)}else x="(null)"}b[g]=a(x)}}let u=0;for(let c of r)c.length>u&&(u=c.length);return{domain:{levels:[{labels:r.slice(),runs:[],maxLabelChars:u}],numRows:r.length,levelLabels:[i]},perColumnSlots:l}}function Hn(e){e.m.reset(),e.Vt.clear();let t=e.m.allocate();e.m.name[t]="Total",e.m.depth[t]=0,e.m.parent[t]=-1,e.Vt.set(t,new Map),e.K=t,e.C=t,e.pe=[t],e.Si=0,e.p=1/0,e.c=-1/0,e.a.clear(),e.J=null,e.me=0}function lc(e,t,n){let i=e.Vt.get(t);i||(i=new Map,e.Vt.set(t,i));let o=i.get(n);if(o!==void 0)return o;let r=e.m.allocate();return e.m.name[r]=n,e.m.appendChild(t,r),i.set(n,r),r}function xo(e,t,n,i,o,r,s){let l=e.K,a=t.length;for(let u=0;u<a;u++){let m=lc(e,l,t[u]);u===a-1&&((s===0||a===s)&&(e.m.size[m]=Math.abs(n),e.m.sizeSign[m]=n<0?-1:1,e.m.leafRowIdx[m]=r),isNaN(i)||(e.m.colorValue[m]=i,i<e.p&&(e.p=i),i>e.c&&(e.c=i)),o&&(e.m.colorLabel[m]=o,e.a.has(o)||e.a.set(o,e.a.size))),l=m}}function Ia(e,t){let n=e.valid;return!n||!!(n[t>>3]>>(t&7)&1)}function yo(e,t){return e?.values?Ia(e,t)?e.values[t]:0:1}function _o(e,t,n){let i=NaN,o="";return!t||!Ia(t,n)?{colorValue:i,colorLabel:o}:(e.ue==="numeric"&&t.values?i=t.values[n]:e.ue==="series"&&t.indices&&t.dictionary&&(o=t.dictionary[t.indices[n]]),{colorValue:i,colorLabel:o})}function Da(e,t){if(e.ue!=="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 ac(e,t){if(e.B.length===0)return null;let n=e.re?[e.re]:[],i=e.s?[e.s]:[],o=it(t,n,i);return o.length===0?null:o.map(r=>({prefix:r.prefix,sizeCol:e.re?t.get(`${r.prefix}|${e.re}`)??null:null,colorCol:e.s?t.get(`${r.prefix}|${e.s}`)??null:null}))}function Vn(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,valid:h.valid});else if(h.values){let x=e.h[g],y=e.vt[x]??"string";n.push(ss(h,h.values.length,y))}else break}let i=n.length>0,o=e.h.length,r=ac(e,t),s=r!==null,l=e.re?t.get(e.re):null,a=e.s?t.get(e.s):null,u=s?r[0].sizeCol:l,m=i?n[0].indices.length:u?.values?.length??0;if(m===0)return;if(s)for(let g of r)Da(e,g.colorCol);else Da(e,a);let f=e.Si,c=s&&i?o+1:o;if(!i){let g;for(let[x,y]of t){if(x.startsWith("__")||s&&x.includes("|"))continue;let C=x.lastIndexOf("|"),_=C===-1?x:x.substring(C+1);if(!(_===e.re||_===e.s)&&y.type==="string"&&y.indices&&y.dictionary){g=y;break}}let h=s?r:null;for(let x=0;x<m;x++){let y=g?.indices&&g?.dictionary?g.dictionary[g.indices[x]]:`Row ${f+x}`;if(h)for(let C of h){let _=yo(C.sizeCol,x),{colorValue:v,colorLabel:A}=_o(e,C.colorCol,x);xo(e,[C.prefix,y],_,v,A,f+x,c)}else{let C=yo(l,x),{colorValue:_,colorLabel:v}=_o(e,a,x);xo(e,[y],C,_,v,f+x,c)}}e.Si=f+m;return}let d=s?1:0,b=new Array(n.length+d);for(let g=0;g<m;g++){let h=0;for(let x=0;x<n.length;x++){let y=n[x];if(y.valid&&!(y.valid[g>>3]>>(g&7)&1))break;let C=y.dictionary[y.indices[g]];if(!C&&C!=="0")break;b[d+h++]=C}if(h!==0)if(s)for(let x of r){b[0]=x.prefix;let y=b.slice(0,h+1),C=yo(x.sizeCol,g),{colorValue:_,colorLabel:v}=_o(e,x.colorCol,g);xo(e,y,C,_,v,f+g,c)}else{let x=b.slice(0,h),y=yo(l,g),{colorValue:C,colorLabel:_}=_o(e,a,g);xo(e,x,y,C,_,f+g,c)}}e.Si=f+m}function zn(e){let t=e.m,n=t.value,i=t.size,o=t.firstChild,r=t.nextSibling,s=new Int32Array(128);s[0]=e.K,s[1]=0;let l=1;for(let a=0;a<t.count;a++)n[a]=0;for(;l>0;){l--;let a=s[l*2];if(s[l*2+1]===0){s[l*2+1]=1,l++;for(let m=o[a];m!==-1;m=r[m]){if((l+1)*2>s.length){let f=new Int32Array(s.length*2);f.set(s),s=f}s[l*2]=m,s[l*2+1]=0,l++}}else if(o[a]===-1){let m=i[a];n[a]=m>0?m:0}else{let m=0;for(let f=o[a];f!==-1;f=r[f])m+=n[f];n[a]=m}}if(e.pe.length>1){let a=[];for(let f=1;f<e.pe.length;f++)a.push(t.name[e.pe[f]]);let u=e.K,m=!0;for(let f of a){let d=e.Vt.get(u)?.get(f);if(d===void 0){m=!1;break}u=d}if(m&&t.firstChild[u]!==-1){e.C=u,Co(e,u);return}}e.C=e.K,e.pe=[e.K]}function Co(e,t){let n=[],i=t;for(;i!==-1;)n.unshift(i),i=e.m.parent[i];e.pe=n}var uc=1,as=14,Ea=1,Pa=4;function vo(e,t,n,i,o,r,s,l,a){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)<Pa)return;let m=e.depth[t]-s,f=a&&m===1&&e.firstChild[t]!==-1,c=f?as:Ea,d=f?uc:Ea,b=e.x0[t]+d,g=e.y0[t]+c,h=e.x1[t]-d,x=e.y1[t]-d;if(h<=b||x<=g)return;let y=0;for(let C=e.firstChild[t];C!==-1;C=e.nextSibling[C])e.value[C]>0&&(l[y++]=C);y!==0&&Yn(e,l,0,y,b,g,h,x,s,l.subarray(y),a)}function Yn(e,t,n,i,o,r,s,l,a,u,m){let f=i-n;if(f===0)return;if(f===1){vo(e,t[n],o,r,s,l,a,u,m);return}let c=0;for(let v=n;v<i;v++)c+=e.value[t[v]];let d=c/2,b=0,g=n+1,h=1/0;for(let v=n;v<i-1;v++){b+=e.value[t[v]];let A=Math.abs(b-d);A<h&&(h=A,g=v+1)}let x=0;for(let v=n;v<g;v++)x+=e.value[t[v]];let y=x/c,C=s-o,_=l-r;if(C>=_){let v=Math.round(o+C*y);Yn(e,t,n,g,o,r,v,l,a,u,m),Yn(e,t,g,i,v,r,s,l,a,u,m)}else{let v=Math.round(r+_*y);Yn(e,t,n,g,o,r,s,v,a,u,m),Yn(e,t,g,i,o,v,s,l,a,u,m)}}function Ba(e,t,n,i){e.me=us(e,t,n,i,0)}function us(e,t,n,i,o){let r=e.m,s=r.x0,l=r.y0,a=r.x1,u=r.y1,m=r.depth,f=r.firstChild,c=r.nextSibling,d=r.value;(!e.J||e.J.length<r.count)&&(e.J=new Int32Array(r.count));let b=e.J,g=o,h=new Int32Array(128);h[0]=t;let x=1;for(;x>0;){x--;let y=h[x];if(d[y]<=0||(m[y]>=i&&(b[g++]=y),m[y]-i>=n))continue;let C=a[y]-s[y],_=u[y]-l[y];if(!(C*_<Pa))for(let v=f[y];v!==-1;v=c[v]){if(x>=h.length){let A=new Int32Array(h.length*2);A.set(h),h=A}h[x++]=v}}return g}Rn();Ht();Ve();ge();function Ao(e,t,n){return .299*e+.587*t+.114*n}function mc(e,t){let n=Se(e,t);return[n[0],n[1],n[2]]}function Xn(e,t,n,i){let o=e.m,r=o.colorValue[t];if(e.ue==="numeric"&&!isNaN(r)&&e.c>e.p)return mc(n,Ct(r,e.p,e.c));let s=e.a.get(o.colorLabel[t])??0;return i[s%i.length]??[0,0,0]}function Lo(e,t,n,i,o){let r=Xn(e,t,n,i),s=e.m.sizeSign[t]<0?o:1;return[r[0],r[1],r[2],s]}de();function To(e,t,n,i,o,r,s){let l=Math.round(i*n),a=Math.round(o*n);(t.width!==l||t.height!==a)&&(t.width=l,t.height=a,e.Tt=!0);let u=t.getContext("2d");if(u){if(e.Tt){e.be?.close(),e.be=null,e.Tt=!1;let m=++e.On;r(u),createImageBitmap(t).then(f=>{e.On===m?(e.be?.close(),e.be=f):f.close()})}else e.be&&(u.clearRect(0,0,t.width,t.height),u.drawImage(e.be,0,0));s&&(u.save(),u.scale(n,n),s(u),u.restore())}}to();ot();Nn();Ve();be();function Ga(e,t,n,i,o,r,s,l,a=Qe){if(n.length===0)return;e.font=`11px ${l}`;let u=Fi(e,n,a.maxColumnPx),{boxW:m,boxH:f}=u,c=i+12,d=o-f-8;c+m>r&&(c=i-m-12),c<0&&(c=4),d<0&&(d=o+12),d+f>s&&(d=s-f-4),Si(e,u,c,d,t,a.opacity)}be();var Wa=24,fc=8,ka=12,Na=2,Oa=" \\u203A ";function wo(e,t,n,i,o){e.qe=[];let r=e.v().mi;t.fillStyle=r,t.fillRect(0,0,n,Wa),t.font=`11px ${i}`,t.textAlign="left",t.textBaseline="middle";let s=fc,l=e.m;for(let a=0;a<e.pe.length;a++){let u=e.pe[a],m=a===e.pe.length-1,f=l.name[u];t.fillStyle=o;let c=t.measureText(f).width;t.fillText(f,s,ka),e.qe.push({nodeId:u,x0:s-Na,y0:0,x1:s+c+Na,y1:Wa}),s+=c,m||(t.fillText(Oa,s,ka),s+=t.measureText(Oa).width)}}function Mo(e,t,n,i,o,r,s,l){let a=e.U.hoveredTarget===n?e.U.grid??[]:[];a.length!==0&&Ga(t,e.v(),a,i,o,r,s,l,ie(e.t))}function Ro(e,t,n,i,o,r,s,l=null){let a=e.t,u=e.ue==="series"&&e.a.size>1,m=e.ue==="numeric"&&e.p<e.c,f=se(a,u?e.a.size:0);if(f==="none"||!u&&!m){e.F.clearPainted();return}let c=f==="floating",d={mode:c?"floating":"sidebar",legend:e.F,title:e.s||"Legend",opacity:a.legend_opacity},b=c?e.F.floatingBox(a,r,s,u?st(t,o,e.a.size,()=>e.a.keys(),{title:d.title}):Rt(t,o,{min:e.p,max:e.c},void 0,d.title)):null;if(u)b?Ft(t,b,e.a,n,o,d):l?Ft(t,l,e.a,n,o,{...d,sidebarGutter:l.width}):so(t,Ua(r,s,a),e.a,n,o,d);else{let g={min:e.p,max:e.c,label:e.s},h=e.getColumnFormatter(e.s,"value");b?$e(t,b,g,i,o,h,d):Qt(t,Ua(r,s,a),g,i,o,h,d)}}function Ua(e,t,n){return new oe(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0,rightExtra:we(n,80)})}function Ha(e,t){if(e.C===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.m,s=e.B.length>0&&e.W.facet_mode==="grid",l=e.pe.length>1?28:0,a=e.ue==="series"?e.a.size>1:e.ue==="numeric"&&e.p<e.c,u=Ni(e.t,a,90,e.ue==="series"?e.a.size:0),m=new Int32Array(Math.max(r.count,64));if(s)cc(e,m,i,o,l,u);else{e.b=null;let b=r.depth[e.C];vo(r,e.C,0,l,i-u,o,b,m,e.Di),Ba(e,e.C,100,b),fs(e);let g=e.ze,h=e.Ke;for(let x=0;x<e.me;x++)g[x]=b,h[x]=e.C}if(!e.o){let b=j(t,"treemap",yi,_i,["u_resolution"],["a_position","a_color"]);e.o=b.program,e.E=b}let f=e.v(),c=f.N,d=he(f.Ne,c,Math.max(1,e.a.size));if(e.Q){let b=e.Q.getContext("2d");b&&b.clearRect(0,0,e.Q.width,e.Q.height)}e.Tt=!0,dc(e,n,c,d,f.pi),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.E.u_resolution,i,o),n.bindBuffer(n.ARRAY_BUFFER,e.zt),n.enableVertexAttribArray(e.E.a_position),n.vertexAttribPointer(e.E.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Yt),n.enableVertexAttribArray(e.E.a_color),n.vertexAttribPointer(e.E.a_color,4,n.FLOAT,!1,0,0),n.drawArrays(n.TRIANGLES,0,e.co),e._e(()=>an(e))}function cc(e,t,n,i,o,r){let s=e.m,l=[],a=[];for(let b=s.firstChild[e.K];b!==-1;b=s.nextSibling[b])s.value[b]<=0||(l.push(b),a.push(s.name[b]));let u=Math.max(1,i-o),m=Math.max(1,n-r),f=Ie(a,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.W.facet_padding});e.b=f,fs(e);let c=e.ze,d=0;for(let b=0;b<l.length;b++){let g=l[b],h=f.cells[b];if(!h)continue;let x=s.name[g],y=e.ct.get(x)??g,C=s.depth[y],_=h.layout.e;vo(s,y,_.x,_.y+o,_.x+_.width,_.y+o+_.height,C,t,e.Di);let v=us(e,y,100,C,d);c.length<v&&fs(e);let A=e.ze,L=e.Ke;for(let T=d;T<v;T++)A[T]=C,L[T]=y;d=v}e.me=d}function fs(e){let t=e.J?.length??e.m.count;(!e.ze||e.ze.length<t)&&(e.ze=new Int32Array(t)),(!e.Ke||e.Ke.length<t)&&(e.Ke=new Int32Array(t))}function dc(e,t,n,i,o){let r=e.m,s=e.J,l=e.me,a=e.ze,u=e.Ke,m=h=>a?a[h]:r.depth[e.C],f=h=>u?u[h]:e.C,c=0;for(let h=0;h<l;h++){let x=s[h];if(x===f(h))continue;let y=r.x1[x]-r.x0[x],C=r.y1[x]-r.y0[x];y<1||C<1||(r.firstChild[x]===-1?c++:r.depth[x]-m(h)===1&&(c+=2))}let d=new Float32Array(c*6*2),b=new Float32Array(c*6*4),g=0;for(let h=0;h<l;h++){let x=s[h];if(x===f(h))continue;let y=r.x0[x],C=r.y0[x],_=r.x1[x],v=r.y1[x],A=_-y,L=v-C;if(!(A<1||L<1)){if(r.firstChild[x]===-1){let T=Lo(e,x,n,i,o);g=ms(d,b,g,y,C,_-1,v-1,T)}else if(r.depth[x]-m(h)===1){let w=[.25,.25,.25,1];g=ms(d,b,g,y,v-1,_,v,w),g=ms(d,b,g,_-1,C,_,v,w)}}}e.co=g,e.zt||(e.zt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.zt),t.bufferData(t.ARRAY_BUFFER,d.subarray(0,g*2),t.DYNAMIC_DRAW),e.Yt||(e.Yt=t.createBuffer()),t.bindBuffer(t.ARRAY_BUFFER,e.Yt),t.bufferData(t.ARRAY_BUFFER,b.subarray(0,g*4),t.DYNAMIC_DRAW)}function ms(e,t,n,i,o,r,s,l){let a=n*2,u=n*4;e[a+0]=i,e[a+1]=o,e[a+2]=r,e[a+3]=o,e[a+4]=i,e[a+5]=s,e[a+6]=r,e[a+7]=o,e[a+8]=r,e[a+9]=s,e[a+10]=i,e[a+11]=s;for(let m=0;m<6;m++)t[u+m*4+0]=l[0],t[u+m*4+1]=l[1],t[u+m*4+2]=l[2],t[u+m*4+3]=l[3];return n+6}function an(e){pc(e),e.presentOverlay()}function pc(e){if(!e.l||e.C===-1)return;let t=e.i;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t,r=e.fe!==-1?e.fe:e.G;To(e,e.l,n,i,o,s=>bc(e,s,n,i,o),r!==-1?s=>{let l=e.v(),{fontFamily:a}=l,u=e.m;gc(s,u,r);let m=e.J,f=e.me,c=e.ze,d=e.Ke;for(let b=0;b<f;b++){let g=m[b],h=d?d[b]:e.C;if(g===h||u.firstChild[g]===-1)continue;let x=u.x1[g]-u.x0[g],y=u.y1[g]-u.y0[g],C=c?c[b]:u.depth[e.C],_=u.depth[g]-C;_===1?Fo(s,u,g,x,y,l,!e.Di):_===2&&Fo(s,u,g,x,y,l,!0)}if(u.firstChild[r]===-1){let b=l.N,g=he(l.Ne,b,Math.max(1,e.a.size)),h=u.x1[r]-u.x0[r],x=u.y1[r]-u.y0[r];Va(e,s,r,h,x,a,b,g,!0)}e.fe===-1&&e.G!==-1&&hc(e,s,e.G,i,o,a)}:null)}function bc(e,t,n,i,o){let r=e.l;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.v(),{fontFamily:l,Fe:a}=s,u=s.N,m=he(s.Ne,u,Math.max(1,e.a.size)),f=e.m,c=e.J,d=e.me,b=e.ze,g=e.Ke;for(let h=0;h<d;h++){let x=c[h],y=g?g[h]:e.C;if(x===y||f.firstChild[x]!==-1)continue;let C=f.x1[x]-f.x0[x],_=f.y1[x]-f.y0[x];Va(e,t,x,C,_,l,u,m)}for(let h=0;h<d;h++){let x=c[h],y=g?g[h]:e.C;if(x===y||f.firstChild[x]===-1)continue;let C=f.x1[x]-f.x0[x],_=f.y1[x]-f.y0[x],v=b?b[h]:f.depth[e.C],A=f.depth[x]-v;A===1?Fo(t,f,x,C,_,s,!e.Di):A===2&&Fo(t,f,x,C,_,s,!0)}if(e.pe.length>1&&wo(e,t,i,l,a),Ro(e,r,m,u,s,i,o),e.b){t.font=`11px ${l}`,t.fillStyle=a,t.textAlign="center",t.textBaseline="top";for(let h of e.b.cells){let x=h.layout.e;t.fillText(h.label,x.x+x.width/2,x.y-14)}}t.restore()}function Va(e,t,n,i,o,r,s,l,a=!1){if(i<30||o<14)return;let c=e.m,d=Xn(e,n,s,l),b=Ao(d[0],d[1],d[2]),g=a?b>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)":b>.5?"rgba(0,0,0,0.5)":"rgba(255,255,255,0.55)",h=Math.min(11,Math.floor(o/2));if(h<7)return;t.font=`${h}px ${r}`;let x=i-8,y=h*1.3,C=Math.max(1,Math.floor((o-8)/y)),_=ra(t,c.name[n],x,C);if(_.length===0)return;let v=_.length*y,A=c.y0[n]+(o-v)/2+y/2;t.fillStyle=g,t.textAlign="center",t.textBaseline="middle";let L=c.x0[n]+i/2;for(let T=0;T<_.length;T++)t.fillText(_[T],L,A+T*y)}function Fo(e,t,n,i,o,{fontFamily:r,Fe:s,backgroundColor:l},a){let u=t.x0[n],m=t.y0[n],f=t.name[n];if(a){if(i<60||o<30)return;let c=12;e.font=`${c}px ${r}`;let d=f,b=i-16;if(e.measureText(d).width>b){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=b){d+="\\u2026";break}}if(d.length<=3)return;e.save(),e.beginPath(),e.rect(u,m,i,o),e.clip();let h=u+i/2,x=m+o/2;e.textAlign="center",e.textBaseline="middle",e.lineWidth=2,e.strokeStyle=s,e.lineJoin="round",e.strokeText(d,h,x),e.fillStyle=l,e.fillText(d,h,x),e.restore()}else{if(i<40||o<22)return;let c=11;e.font=`${c}px ${r}`;let d=f,b=i-10;if(e.measureText(d).width>b){for(;d.length>1;)if(d=d.slice(0,-1),e.measureText(d+"\\u2026").width<=b){d+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(d,u+5,m+4),e.globalAlpha=1}}function gc(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 hc(e,t,n,i,o,r){let s=e.m,l=(s.x0[n]+s.x1[n])/2,a=(s.y0[n]+s.y1[n])/2;Mo(e,t,n,l,a,i,o,r)}be();async function Ze(e,t,n){let i=e.m,o=Sa(i,t),r=e.B.length>0&&e.W.facet_mode==="grid",s=r?o.slice(0,e.B.length):[],l=r?o.slice(e.B.length,e.B.length+e.h.length):o.slice(0,e.h.length),a=n==="leaf"?i.leafRowIdx[t]??null:null;await e.emitClickAndSelect({rowIdx:a!=null&&a>=0?a:null,columnName:e.re,groupByValues:l,splitByValues:s})}async function It(e,t){let n=e.m,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.re,"value");if(i.push(["Value",s(n.value[t])]),e.s&&!isNaN(n.colorValue[t])){let u=e.getColumnFormatter(e.s,"value");i.push([e.s,u(n.colorValue[t])])}let l=n.leafRowIdx[t];if(n.firstChild[t]===-1&&l!==-1&&e.Oe){let u=await e.Oe.fetchRow(l);for(let[m,f]of u)f!=null&&(m===e.s&&!isNaN(n.colorValue[t])||(typeof f=="number"?i.push([m,e.getColumnFormatter(m,"value")(f)]):i.push([m,String(f)])))}return n.firstChild[t]!==-1&&i.push(["Children",String(n.childCount[t])]),i}function So(e,t,n,i){e.w.dismiss(),e.fe=t;let o=e.i?.cssWidth??0,r=e.i?.cssHeight??0;It(e,t).then(s=>{e.fe===t&&s.length!==0&&e.w.pin(s,{px:n.cx,py:n.cy},{cssWidth:o,cssHeight:r},ie(e.t))}),e.G=-1,i()}function Do(e){e.w.dismiss(),e.fe=-1}function Io(e,t,n){let i=e.m;if(e.B.length>0&&e.W.facet_mode==="grid"){let o=t;for(;o!==-1&&i.parent[o]!==e.K;)o=i.parent[o];o!==-1&&e.ct.set(i.name[o],t),e.G=-1,n();return}e.C=t,Co(e,t),e.G=-1,n()}function cs(e,t,n){let i=e.m,o=i.x0,r=i.y0,s=i.x1,l=i.y1,a=i.depth,u=i.firstChild,m=e.J,f=e.me,c=e.ze,d=e.Ke,b=-1,g=1/0,h=-1,x=1/0,y=-1;if(!m)return{leafId:-1,branchId:-1,inHeader:!1};for(let C=0;C<f;C++){let _=m[C],v=d?d[C]:e.C;if(_===v||!(t>=o[_]&&t<=s[_]&&n>=r[_]&&n<=l[_]))continue;let A=(s[_]-o[_])*(l[_]-r[_]);if(u[_]!==-1){A<x&&(x=A,h=_);let L=c?c[C]:a[e.C],T=a[_]-L;if(T===1&&n<=r[_]+as&&(y=_),T===2){let w=s[_]-o[_],M=l[_]-r[_];if(w>=60&&M>=30){let I=r[_]+M/2,D=o[_]+w/2;Math.abs(n-I)<10&&Math.abs(t-D)<w*.4&&(y=_)}}}else A<g&&(g=A,b=_)}return y!==-1?{leafId:-1,branchId:y,inHeader:!0}:{leafId:b,branchId:h,inHeader:!1}}function za(e,t,n){if(e.fe!==-1)return;for(let l of e.qe)if(t>=l.x0&&t<=l.x1&&n>=l.y0&&n<=l.y1){e.w.setCursor("pointer"),e.G=-1,an(e);return}let{leafId:i,branchId:o,inHeader:r}=cs(e,t,n),s=r?o:i!==-1?i:o;if(s!==e.G){if(e.G=s,e.w.setCursor(o!==-1?"pointer":"default"),s!==-1){let l=e.U.beginHover(s);It(e,s).then(a=>{e.U.commitHover(l,a)&&an(e)})}else e.U.clearHover();an(e)}}function Ya(e,t,n){if(e.fe!==-1){$n(e),e.emitUnselect();return}for(let s of e.qe)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(Eo(e,s.nodeId),e.emitUnselect());return}let{leafId:i,branchId:o,inHeader:r}=cs(e,t,n);o!==-1&&r?(Eo(e,o),Ze(e,o,"branch")):i!==-1?($a(e,i),Ze(e,i,"leaf")):o!==-1&&(Eo(e,o),Ze(e,o,"branch"))}function Xa(e,t,n){let i=e.fe!==-1;$n(e),i&&e.emitUnselect();let{leafId:o,branchId:r}=cs(e,t,n),s=e.m,l=r;if(l===-1&&o!==-1){let a=s.parent[o];a!==e.C&&a!==-1&&(l=a)}l!==-1&&l!==e.C&&s.firstChild[l]!==-1&&(Eo(e,l),Ze(e,l,"branch"),o!==-1&&s.firstChild[o]===-1&&($a(e,o),Ze(e,o,"leaf")))}function Eo(e,t){Io(e,t,()=>{e.i&&e.requestRender(e.i)})}function $a(e,t){let n=e.m,i=(n.x0[t]+n.x1[t])/2,o=(n.y0[t]+n.y1[t])/2;So(e,t,{cx:i,cy:o},()=>an(e))}function $n(e){Do(e)}var Po=class extends rn{constructor(){super(...arguments);p(this,"o",null);p(this,"E",null);p(this,"zt",null);p(this,"Yt",null);p(this,"co",0);p(this,"G",-1);p(this,"fe",-1);p(this,"qe",[]);p(this,"be",null);p(this,"Tt",!0);p(this,"On",0);p(this,"ct",new Map);p(this,"b",null);p(this,"Di",!1);p(this,"ze",null);p(this,"Ke",null)}tooltipCallbacks(){return{onHover:(n,i)=>za(this,n,i),onLeave:()=>{this.G!==-1&&this.fe===-1&&(this.G=-1,this.i&&this.requestRender(this.i))},onClickPre:(n,i)=>(Ya(this,n,i),!0),onDblClick:(n,i)=>Xa(this,n,i)}}async uploadAndRender(n,i,o,r){if(this.i=n,o===0){let s=this.L;if(this.re=s[0]||ho(i)||"",this.s=s[1]||"",!this.s)this.ue="empty";else{let l=this.je[this.s],a=l==="float"||l==="integer"||l==="date"||l==="datetime";this.ue=a?"numeric":"series"}this.G=-1,this.fe=-1,this.qe=[],this.ct.clear(),this.b=null,this.ze=null,this.Ke=null,this.co=0,this.U.clearHover(),this.U.invalidatePin(),$n(this),this.be?.close(),this.be=null,this.Tt=!0,this.On++,Hn(this)}Vn(this,i),zn(this),this.K!==-1&&await this.requestRender(n)}kt(n){this.K!==-1&&(this.i=n,Ha(this,n))}destroyInternal(){$n(this),this.be?.close(),this.be=null;let n=this.i?.gl;n&&(this.zt&&n.deleteBuffer(this.zt),this.Yt&&n.deleteBuffer(this.Yt)),this.zt=null,this.Yt=null,this.o=null,this.E=null,this.K=-1,this.C=-1,this.pe=[],this.Vt.clear(),this.J=null,this.me=0,this.qe=[],this.ct.clear(),this.b=null,this.ze=null,this.Ke=null}};Rn();Be();de();var ja=4,jn=30;function xc(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],l=e.depth[s]-i;l>n&&(n=l);for(let a=e.firstChild[s];a!==-1;a=e.nextSibling[a]){if(r>=o.length){let u=new Int32Array(o.length*2);u.set(o),o=u}o[r++]=a}}return n}function ds(e,t,n){let i=e.depth[t],o=Math.max(1,xc(e,t)),s=Math.max(0,n-jn)/o;e.a0[t]=0,e.a1[t]=2*Math.PI,e.r0[t]=0,e.r1[t]=jn,Za(e,t,0,2*Math.PI,jn,s,i)}function Za(e,t,n,i,o,r,s){let l=e.value[t];if(l<=0)return;let a=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 c=f/l,d=u,b=u+a*c;u=b;let g=o,h=o+r;e.a0[m]=d,e.a1[m]=b,e.r0[m]=g,e.r1[m]=h;let x=b-d,y=(g+h)/2;x*y*r<ja||e.firstChild[m]!==-1&&Za(e,m,d,b,h,r,s)}}function qa(e,t){e.me=ps(e,t,0)}function ps(e,t,n){let i=e.m,o=i.a0,r=i.a1,s=i.r0,l=i.r1,a=i.firstChild,u=i.nextSibling,m=i.value;(!e.J||e.J.length<i.count)&&(e.J=new Int32Array(i.count));let f=e.J,c=n,d=new Int32Array(128);d[0]=t;let b=1;for(;b>0;){b--;let g=d[b];if(m[g]<=0)continue;f[c++]=g;let h=r[g]-o[g],x=(s[g]+l[g])/2,y=h*x,C=l[g]-s[g];if(!(y*C<ja))for(let _=a[g];_!==-1;_=u[_]){if(b>=d.length){let v=new Int32Array(d.length*2);v.set(d),d=v}d[b++]=_}}return c}Ht();Ve();var Bo=32,yc=28,_c=90;function Go(e,t){if(e.d.length===0)return{centerX:e.dt,centerY:e.pt};let n=e.m;for(let i of e.d){let o=t;for(;o!==-1;){if(o===i.drillRoot)return{centerX:i.centerX,centerY:i.centerY};o=n.parent[o]}}return{centerX:e.dt,centerY:e.pt}}function Qa(e,t){if(e.C===-1)return;let n=t.gl,i=t.cssWidth,o=t.cssHeight;if(i<=0||o<=0)return;let r=e.B.length>0&&e.W.facet_mode==="grid",s=e.ue==="series"?e.a.size>1:e.ue==="numeric"&&e.p<e.c,l=!r&&e.pe.length>1?yc:0,a=Ni(e.t,s,_c,e.ue==="series"?e.a.size:0);if(r)Cc(e,i,o,a);else{e.b=null,e.d=[];let b=i-a,g=o-l;e.dt=b/2,e.pt=l+g/2,e.po=Math.max(0,Math.min(b,g)/2-4),ds(e.m,e.C,e.po),qa(e,e.C)}vc(e,t);let u=e.v(),m=u.N,f=he(u.Ne,m,Math.max(1,e.a.size));if(e.Q){let b=e.Q.getContext("2d");b&&b.clearRect(0,0,e.Q.width,e.Q.height)}let c=t.dpr;e.Tt=!0,Ac(e,n,m,f,u.pi,c),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 d=e.E;if(n.uniform2f(d.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(d.u_border_px,u.jo*c),e.d.length>0)for(let b of e.d)b.instanceCount!==0&&(n.uniform2f(d.u_center,b.centerX*c,b.centerY*c),Ka(e,n,t,b.instanceStart,b.instanceCount));else n.uniform2f(d.u_center,e.dt*c,e.pt*c),Ka(e,n,t,0,e.bo);e._e(()=>mt(e))}function Cc(e,t,n,i){let o=e.m,r=[],s=[];for(let f=o.firstChild[e.K];f!==-1;f=o.nextSibling[f])o.value[f]<=0||(r.push(f),s.push(o.name[f]));let l=Math.max(1,t-i),a=Ie(s,{cssWidth:l,cssHeight:n,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.W.facet_padding});e.b=a;let u=[],m=0;for(let f=0;f<r.length;f++){let c=r[f],d=a.cells[f];if(!d)continue;let b=o.name[c],g=e.ct.get(b)??c,h=d.layout.e,x=h.x+h.width/2,y=h.y+h.height/2,C=Math.max(0,Math.min(h.width,h.height)/2-4);ds(o,g,C);let _=ps(e,g,m),v=m,A=_-m;u.push({label:b,centerX:x,centerY:y,maxRadius:C,drillRoot:g,instanceStart:v,instanceCount:A,nodeStart:v,nodeCount:A}),m=_}e.me=m,e.d=u,u.length>0&&(e.dt=u[0].centerX,e.pt=u[0].centerY,e.po=u[0].maxRadius)}function vc(e,t){if(e.o)return;let n=t.gl,i=j(t,"sunburst-arc",hi,xi,["u_center","u_resolution","u_border_px"],["a_strip_t","a_side","a_angles","a_radii","a_color"]);e.o=i.program,e.E=i;let o=new Float32Array((Bo+1)*2*2);for(let r=0;r<=Bo;r++){let s=r/Bo,l=r*4;o[l+0]=s,o[l+1]=0,o[l+2]=s,o[l+3]=1}e.hn=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,e.hn),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),e.xn=n.createBuffer()}function Ac(e,t,n,i,o,r){let s=e.m,l=e.J,a=e.d.length>0,u=a?e.d.reduce((d,b)=>d+b.instanceCount,0):e.me,m=new Float32Array(u*8),f=0,c=(d,b,g)=>{let h=f;for(let x=d;x<b;x++){let y=l[x];if(y===g)continue;let C=s.a0[y],_=s.a1[y],v=s.r0[y],A=s.r1[y];if(_<=C||A<=v)continue;let L=Lo(e,y,n,i,o),T=f*8;m[T+0]=C,m[T+1]=_,m[T+2]=v*r,m[T+3]=A*r,m[T+4]=L[0],m[T+5]=L[1],m[T+6]=L[2],m[T+7]=L[3],f++}return{rangeStart:h,rangeCount:f-h}};if(a)for(let d of e.d){let b=d.instanceStart,g=b+d.instanceCount,{rangeStart:h,rangeCount:x}=c(b,g,d.drillRoot);d.instanceStart=h,d.instanceCount=x}else c(0,e.me,e.C);e.bo=f,t.bindBuffer(t.ARRAY_BUFFER,e.xn),t.bufferData(t.ARRAY_BUFFER,m.subarray(0,f*8),t.DYNAMIC_DRAW)}function Ka(e,t,n,i,o){if(o===0)return;let r=e.E;t.bindBuffer(t.ARRAY_BUFFER,e.hn);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 l=Q(n),{setDivisor:a}=l;a(r.a_strip_t,0),a(r.a_side,0),t.bindBuffer(t.ARRAY_BUFFER,e.xn);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),a(r.a_angles,1),t.enableVertexAttribArray(r.a_radii),t.vertexAttribPointer(r.a_radii,2,t.FLOAT,!1,u,f+2*m),a(r.a_radii,1),t.enableVertexAttribArray(r.a_color),t.vertexAttribPointer(r.a_color,4,t.FLOAT,!1,u,f+4*m),a(r.a_color,1),l.drawArraysInstanced(t.TRIANGLE_STRIP,0,2*(Bo+1),o),a(r.a_angles,0),a(r.a_radii,0),a(r.a_color,0)}function mt(e){Lc(e),e.presentOverlay()}function Lc(e){if(!e.l||e.C===-1)return;let t=e.i;if(!t)return;let{dpr:n,cssWidth:i,cssHeight:o}=t;To(e,e.l,n,i,o,r=>Tc(e,r,n,i,o),e.G!==-1?r=>{wc(r,e,e.G),Mc(e,r,e.G,i,o,e.v().fontFamily)}:null)}function Tc(e,t,n,i,o){let r=e.l;t.clearRect(0,0,r.width,r.height),t.save(),t.scale(n,n);let s=e.v(),{fontFamily:l,Fe:a,mi:u}=s,m=s.N,f=he(s.Ne,m,Math.max(1,e.a.size)),c=e.m,d=e.J,b=e.me,g=e.d.length>0;if(g)for(let x of e.d){let y=x.nodeStart+x.nodeCount;for(let C=x.nodeStart;C<y;C++){let _=d[C];_!==x.drillRoot&&Ja(e,t,_,l,m,f,x.centerX,x.centerY)}}else for(let x=0;x<b;x++){let y=d[x];y!==e.C&&Ja(e,t,y,l,m,f,e.dt,e.pt)}let h=Math.max(0,jn-s.jo*.5);if(t.fillStyle=u,t.textAlign="center",t.textBaseline="middle",g){for(let x of e.d)if(t.beginPath(),t.fillStyle=u,t.arc(x.centerX,x.centerY,h,0,2*Math.PI),t.fill(),t.fillStyle=a,t.font=`11px ${l}`,t.fillText(c.name[x.drillRoot],x.centerX,x.centerY),e.b){let y=e.b.cells.find(C=>C.label===x.label);y?.titleRect&&(t.fillStyle=a,t.font=`11px ${l}`,t.textBaseline="middle",t.fillText(x.label,y.titleRect.x+y.titleRect.width/2,y.titleRect.y+y.titleRect.height/2))}}else t.beginPath(),t.arc(e.dt,e.pt,h,0,2*Math.PI),t.fill(),t.fillStyle=a,t.font=`11px ${l}`,t.fillText(c.name[e.C],e.dt,e.pt);!g&&e.pe.length>1&&wo(e,t,i,l,a),Ro(e,r,f,m,s,i,o,g?e.b?.legendRect??null:null),t.restore()}function Ja(e,t,n,i,o,r,s,l){let a=e.m,u=a.a0[n],m=a.a1[n],f=a.r0[n],c=a.r1[n],d=c-f,b=(f+c)/2,h=(m-u)*b;if(d<16||h<8)return;let x=Math.min(11,Math.floor(h*.7));if(x<7)return;t.font=`${x}px ${i}`;let y=a.name[n],C=d-4,_=y;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,l);let A=v,L=v>Math.PI/2&&v<3*Math.PI/2;e.lr==="upright"&&L&&(A+=Math.PI),t.rotate(A);let T=Xn(e,n,o,r),w=Ao(T[0],T[1],T[2]);t.fillStyle=w>.5?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.9)",t.textAlign="center",t.textBaseline="middle";let M=e.lr==="upright"&&L?-b:b;t.fillText(_,M,0),t.restore()}function wc(e,t,n){let i=t.m,o=i.a0[n],r=i.a1[n],s=i.r0[n],l=i.r1[n],{centerX:a,centerY:u}=Go(t,n);e.strokeStyle="rgba(255,255,255,0.9)",e.lineWidth=2,e.beginPath(),e.arc(a,u,l,o,r),e.arc(a,u,s,r,o,!0),e.closePath(),e.stroke()}function Mc(e,t,n,i,o,r){let s=e.m,l=(s.a0[n]+s.a1[n])/2,a=(s.r0[n]+s.r1[n])/2,{centerX:u,centerY:m}=Go(e,n),f=u+Math.cos(l)*a,c=m+Math.sin(l)*a;Mo(e,t,n,f,c,i,o,r)}function eu(e,t,n){if(e.d.length===0)return{centerX:e.dt,centerY:e.pt,drillRoot:e.C};for(let i of e.d){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 Rc(e,t,n){let i=e.m,o=t;for(;o!==-1;){if(o===n)return!0;o=i.parent[o]}return!1}function tu(e,t,n){let i=eu(e,t,n);if(!i)return-1;let o=e.m,r=e.J,s=e.me;if(!r)return-1;let l=t-i.centerX,a=n-i.centerY,u=Math.sqrt(l*l+a*a),m=Math.atan2(a,l);if(m<0&&(m+=2*Math.PI),u<o.r1[e.K]+.001&&i.drillRoot!==e.K)return i.drillRoot;let f=e.d.length>0;for(let c=0;c<s;c++){let d=r[c];if(d===i.drillRoot||f&&!Rc(e,d,i.drillRoot))continue;let b=o.a0[d],g=o.a1[d],h=o.r0[d],x=o.r1[d];if(!(u<h||u>x)&&!(m<b||m>g))return d}return-1}function nu(e,t,n){if(e.fe!==-1)return;for(let r of e.qe)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.w.setCursor("pointer"),e.G!==-1&&(e.G=-1,mt(e));return}let i=tu(e,t,n),o=e.m;if(e.w.setCursor(i!==-1&&o.firstChild[i]!==-1?"pointer":"default"),i!==e.G){if(e.G=i,i!==-1){let r=e.U.beginHover(i);It(e,i).then(s=>{e.U.commitHover(r,s)&&mt(e)})}else e.U.clearHover();mt(e)}}function iu(e,t,n){if(e.fe!==-1){Wo(e),e.emitUnselect();return}for(let s of e.qe)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(bs(e,s.nodeId),e.emitUnselect());return}let i=e.m,o=eu(e,t,n);if(o){let s=t-o.centerX,l=n-o.centerY;if(Math.sqrt(s*s+l*l)<i.r1[e.K]+.001){let u=i.parent[o.drillRoot];if(u!==-1&&u!==e.K)bs(e,u),e.emitUnselect();else if(e.d.length>0){let m=e.d.find(f=>f.drillRoot===o.drillRoot);m&&(e.ct.delete(m.label),e.emitUnselect()),e.i&&e.requestRender(e.i)}return}}let r=tu(e,t,n);r!==-1&&(i.firstChild[r]!==-1?(bs(e,r),Ze(e,r,"branch")):(Fc(e,r),Ze(e,r,"leaf")))}function bs(e,t){Io(e,t,()=>{e.i&&e.requestRender(e.i)})}function Fc(e,t){let n=e.m,i=(n.a0[t]+n.a1[t])/2,o=(n.r0[t]+n.r1[t])/2,{centerX:r,centerY:s}=Go(e,t),l=r+Math.cos(i)*o,a=s+Math.sin(i)*o;So(e,t,{cx:l,cy:a},()=>mt(e))}function Wo(e){Do(e)}var ko=class extends rn{constructor(){super(...arguments);p(this,"o",null);p(this,"E",null);p(this,"hn",null);p(this,"xn",null);p(this,"bo",0);p(this,"lr","upright");p(this,"dt",0);p(this,"pt",0);p(this,"po",0);p(this,"G",-1);p(this,"fe",-1);p(this,"qe",[]);p(this,"be",null);p(this,"Tt",!0);p(this,"On",0);p(this,"b",null);p(this,"ct",new Map);p(this,"d",[])}tooltipCallbacks(){return{onHover:(n,i)=>nu(this,n,i),onLeave:()=>{this.G!==-1&&this.fe===-1&&(this.G=-1,mt(this))},onClickPre:(n,i)=>(iu(this,n,i),!0)}}async uploadAndRender(n,i,o,r){if(this.i=n,o===0){let s=this.L;if(this.re=s[0]||ho(i)||"",this.s=s[1]||"",!this.s)this.ue="empty";else{let l=this.je[this.s],a=l==="float"||l==="integer"||l==="date"||l==="datetime";this.ue=a?"numeric":"series"}this.G=-1,this.fe=-1,this.qe=[],this.ct.clear(),this.b=null,this.d=[],this.bo=0,this.U.clearHover(),this.U.invalidatePin(),Wo(this),this.be?.close(),this.be=null,this.Tt=!0,this.On++,Hn(this)}Vn(this,i),zn(this),this.K!==-1&&await this.requestRender(n)}kt(n){this.K!==-1&&(this.i=n,Qa(this,n))}destroyInternal(){Wo(this),this.be?.close(),this.be=null;let n=this.i?.gl;n&&(this.hn&&n.deleteBuffer(this.hn),this.xn&&n.deleteBuffer(this.xn)),this.hn=null,this.xn=null,this.o=null,this.E=null,this.K=-1,this.C=-1,this.pe=[],this.Vt.clear(),this.J=null,this.me=0,this.qe=[],this.b=null,this.ct.clear(),this.d=[]}};Ln();var un=class extends De{constructor(){super(...arguments);p(this,"Ie",[]);p(this,"ie",0);p(this,"bt",0);p(this,"o",null);p(this,"H",null);p(this,"u",null);p(this,"le",null);p(this,"te",null);p(this,"ae",null);p(this,"Ci",!0)}getZoomConfig(){return{lockAxis:"y"}}};Tn();function No(e,t=.5,n=.1){let i=t/Math.max(1,e),o=i*(1-n)/2;return{slotWidth:i,halfWidth:o}}ge();function ou(e,t,n="bar"){let i=t?.[e]?.chart_type?.toLowerCase?.();return i==="bar"||i==="line"||i==="scatter"||i==="area"?i:n}function ru(e,t,n){let i=n?.[e]?.stack;return typeof i=="boolean"?i:t==="bar"||t==="area"}function gs(e,t){return t?.[e]?.alt_axis===!0}function su(e,t,n){let i=n?.[e.aggName];if(!i)return null;let o=typeof i.palette=="string"?Sc(i.palette):null;if(o&&o.length>0){let r=t?0:e.splitIdx%o.length;return o[r]}return typeof i.color=="string"?Nr(i.color)??null:null}var Oo=new Map;function Sc(e){let t=Oo.get(e);return t===void 0&&(t=Ui(e),Oo.size>256&&Oo.clear(),Oo.set(e,t)),t}function lu(e,t,n){if(t!=="line"&&t!=="area")return"skip";let i=n?.[e]?.interpolate;return i===void 0||t==="area"?"solid":i}var au=50,Et=0,Uo=1;function Ho(){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 Dc(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 Zn(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]===Et?"bar":"area"}}function uu(e,t){return e&&e.length>=t?e:new Float64Array(Math.max(t,e?.length??0))}function mu(e,t){e[t>>3]|=1<<(t&7)}function fu(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,columnsConfig:l,defaultChartType:a,autoAltYAxis:u,bandInnerFrac:m,barInnerPad:f,includeZero:c,facetSplits:d,scratchBars:b,scratchPosStack:g,scratchNegStack:h}=e,x=sn(o,s),y={aggregates:[],splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:x,numericCategoryDomain:null,categoryPositions:null,series:[],bars:Ho(),posStack:g??null,negStack:h??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},C=i.filter(R=>!!R);if(C.length===0)return y;let _=[];if(r.length>0){for(let R of it(t,[],C))R.colNames.size>0&&_.push(R.prefix);_.length===0&&_.push("")}else _.push("");let v=o.map(R=>s[R]??"string"),{rowPaths:A,numCategories:L,rowOffset:T}=ln(t,n,o.length,v,x);if(L===0)return{...y,rowPaths:A,rowOffset:T};let w=[],M=C.length,I=_.length;for(let R=0;R<M;R++)for(let P=0;P<I;P++){let B=C[R],O=_[P],X=O===""?B:`${O}${M>1?` | ${B}`:""}`,z=ou(B,l,a),Z=ru(B,z,l),ye=lu(B,z,l);w.push({seriesId:R*I+P,aggIdx:R,splitIdx:P,aggName:B,splitKey:O,label:X,color:[.5,.5,.5],axis:0,chartType:z,stack:Z,start:-1,end:-1,interpolateMode:ye})}let D=[];for(let R=0;R<M;R++)D.push(c?{min:0,max:0}:{min:1/0,max:-1/0});let S=L,E=w.length,k=d?S*M*I:S*M,W=uu(g??null,k),V=uu(h??null,k);W.fill(0,0,k),V.fill(0,0,k);let N=new Float32Array(S*E),H=new Uint8Array(S*E+7>>3),U=null,Y=null,q=1;if(x.mode==="numeric"&&S>0){let R=t.get("__ROW_PATH_0__"),P=Dt(R?.values,S,T,o[0]??"",x.numericType==="date"||x.numericType==="datetime");P&&(U=P.categoryPositions,Y=P.numericCategoryDomain,q=P.numericCategoryDomain.bandWidth)}let me=No(M,m,f),Ge=me.slotWidth*q,Re=me.halfWidth*q,Fe=new Float64Array(M),pt=(M-1)/2;for(let R=0;R<M;R++)Fe[R]=(R-pt)*Ge;let bn=new Array(M*I),gn=new Array(M*I);for(let R=0;R<M;R++){let P=C[R];for(let B=0;B<I;B++){let O=_[B],X=O===""?P:`${O}|${P}`,z=t.get(X),Z=R*I+B;bn[Z]=z?.values??null,gn[Z]=z?.valid??null}}let hn=new Array(M),Ae=new Array(M),ae=!1;for(let R=0;R<M;R++){let P=C[R],B=_[0],O=B===""?P:`${B}|${P}`;hn[R]=t.get(O)?.type==="string",Ae[R]=gs(P,l)?1:0,hn[R]&&(ae=!0)}let ee=[],re=[],We=[],ke=[];for(let R=0;R<M;R++){let P=C[R];for(let B=0;B<I;B++){let O=_[B],X=O===""?P:`${O}|${P}`,z=R*I+B,Z={name:X,type:hn[R]?"string":"numeric",data:t.get(X)};Ae[R]===0?(ee.push(Z),We.push(z)):(re.push(Z),ke.push(z))}}let Ys=ee.map(R=>R.name).filter((R,P,B)=>B.indexOf(R)===P).join(", "),dr=re.map(R=>R.name).filter((R,P,B)=>B.indexOf(R)===P).join(", "),Ne=ee.length>0?ls(ee,n,T,Ys):null,J=re.length>0?ls(re,n,T,dr):null,Pt=new Array(M*I).fill(null);if(Ne)for(let R=0;R<We.length;R++)Pt[We[R]]=Ne.perColumnSlots[R];if(J)for(let R=0;R<ke.length;R++)Pt[ke[R]]=J.perColumnSlots[R];let nm=S*M*I,$=Dc(b??null,nm),te=0;for(let R=0;R<S;R++){let P=R+T;for(let B=0;B<M;B++)for(let O=0;O<I;O++){let X=B*I+O,z=Pt[X];if(z){let ue=B*I+O,Le=R*E+ue;N[Le]=z[R],mu(H,Le);continue}let Z=bn[X];if(!Z)continue;let ye=gn[X];if(ye&&!(ye[P>>3]>>(P&7)&1))continue;let ne=Z[P];if(!isFinite(ne))continue;let Gt=B*I+O,gt=R*E+Gt;N[gt]=ne,mu(H,gt)}}for(let R=0;R<E;R++){let P=-1,B=-1;for(let O=0;O<S;O++){let X=O*E+R;H[X>>3]>>(X&7)&1&&(P===-1&&(P=O),B=O)}w[R].start=P,w[R].end=B}for(let R=0;R<E;R++){let P=w[R];if(!(P.start<0)&&P.interpolateMode!=="skip"){if(P.chartType==="line"){let B=P.start;for(let O=P.start+1;O<=P.end;O++){let X=O*E+R;if(H[X>>3]>>(X&7)&1){if(O-B>1){let Z=B*E+R,ye=N[Z],ne=N[X],Gt=U?U[B]:B,ue=(U?U[O]:O)-Gt;for(let Le=1;Le<O-B;Le++){let pe=B+Le,Te=U?U[pe]:pe,um=ue===0?0:(Te-Gt)/ue;N[pe*E+R]=ye+(ne-ye)*um}}B=O}}}else if(P.chartType==="area"){for(let B=0;B<P.start;B++)N[B*E+R]=0;for(let B=P.end+1;B<S;B++)N[B*E+R]=0;P.start=0,P.end=S-1}}}for(let R=0;R<S;R++){let P=U?U[R]:R;for(let B=0;B<M;B++){let O=Fe[B],X=P+O,z=D[B];for(let Z=0;Z<I;Z++){let ye=B*I+Z,ne=w[ye];if(R<ne.start||R>ne.end)continue;let Gt=ne.chartType==="line"||ne.chartType==="area"&&ne.interpolateMode!=="skip",gt=R*E+ye;if(!Gt&&!(H[gt>>3]>>(gt&7)&1))continue;let ue=N[gt];if((ne.chartType==="bar"||ne.chartType==="area")&&ne.stack){if(ue===0&&(ne.chartType!=="area"||ne.interpolateMode==="skip"))continue;let Le=d?(R*M+B)*I+Z:R*M+B,pe,Te;ue>=0?(pe=W[Le],Te=pe+ue,W[Le]=Te):(pe=V[Le],Te=pe+ue,V[Le]=Te),pe<z.min&&(z.min=pe),Te<z.min&&(z.min=Te),pe>z.max&&(z.max=pe),Te>z.max&&(z.max=Te),$.catIdx[te]=R,$.seriesId[te]=ye,$.axis[te]=0,$.chartType[te]=ne.chartType==="bar"?Et:Uo,$.xCenter[te]=X,$.halfWidth[te]=Re,$.y0[te]=pe,$.y1[te]=Te,te++}else if(ue<z.min&&(z.min=ue),ue>z.max&&(z.max=ue),c&&(0<z.min&&(z.min=0),0>z.max&&(z.max=0)),ne.chartType==="bar"||ne.chartType==="area"){if(ue===0)continue;$.catIdx[te]=R,$.seriesId[te]=ye,$.axis[te]=0,$.chartType[te]=ne.chartType==="bar"?Et:Uo,$.xCenter[te]=X,$.halfWidth[te]=Re,$.y0[te]=0,$.y1[te]=ue,te++}}}}$.count=te;let Bt=!1;if(u&&M>=2&&!ae){let R=new Array(M),P=0,B=1/0;for(let O=0;O<M;O++){let X=D[O],z=Math.max(Math.abs(X.min),Math.abs(X.max),1e-12);R[O]=z,z>P&&(P=z),z<B&&(B=z)}if(P/B>au){let O=P/Math.sqrt(au);for(let X=0;X<M;X++)if(R[X]<O)for(let Z of w)Z.aggIdx===X&&(Z.axis=1);for(let X=0;X<$.count;X++)$.axis[X]=w[$.seriesId[X]].axis;Bt=w.some(X=>X.axis===1)}}let Xs=!1;for(let R=0;R<M;R++)if(gs(C[R],l))for(let P of w)P.aggIdx===R&&(P.axis=1,Xs=!0);if(Xs){for(let R=0;R<$.count;R++)$.axis[R]=w[$.seriesId[R]].axis;Bt=!0}let Oe=c?{min:0,max:0}:{min:1/0,max:-1/0},bt=c?{min:0,max:0}:{min:1/0,max:-1/0};for(let R=0;R<$.count;R++){let P=$.axis[R]===0?Oe:bt,B=$.y0[R],O=$.y1[R];B<P.min&&(P.min=B),O<P.min&&(P.min=O),B>P.max&&(P.max=B),O>P.max&&(P.max=O)}for(let R=0;R<E;R++){let P=w[R];if(P.stack&&(P.chartType==="bar"||P.chartType==="area")||P.start<0)continue;let B=P.chartType==="line"||P.chartType==="area"&&P.interpolateMode!=="skip",O=P.axis===0?Oe:bt;for(let X=P.start;X<=P.end;X++){let z=X*E+R;if(!B&&!(H[z>>3]>>(z&7)&1))continue;let Z=N[z];Z<O.min&&(O.min=Z),Z>O.max&&(O.max=Z)}}(!isFinite(Oe.min)||!isFinite(Oe.max)||Oe.min===0&&Oe.max===0)&&(Oe.min=0,Oe.max=1);let im=!isFinite(bt.min)||!isFinite(bt.max)||bt.min===0&&bt.max===0,om=Bt?im?{min:0,max:1}:bt:null,rm=Ne?"category":"numeric",sm=Bt?J?"category":"numeric":null,lm=Ne&&Ne.domain.numRows>0?{min:0,max:Math.max(0,Ne.domain.numRows-1)}:Oe,am=J&&J.domain.numRows>0&&Bt?{min:0,max:Math.max(0,J.domain.numRows-1)}:om;return{aggregates:C,splitPrefixes:_,rowPaths:A,numCategories:L,rowOffset:T,axisMode:x,numericCategoryDomain:Y,categoryPositions:U,series:w,bars:$,posStack:W,negStack:V,samples:N,sampleValid:H,leftDomain:lm,rightDomain:am,hasRightAxis:Bt,leftValueAxisMode:rm,rightValueAxisMode:sm,leftValueCategoryDomain:Ne?.domain??null,rightValueCategoryDomain:J?.domain??null}}ot();Fn();Nt();be();Dn();Be();var hs=Et;function cu(e,t,n,i){let o=i?.start??0,r=i?.count??e.Un;if(e.Un===0||r===0)return;let s=e.E,l=Q(n),{setDivisor:a}=l;t.bindBuffer(t.ARRAY_BUFFER,e.H),t.enableVertexAttribArray(s.a_corner),t.vertexAttribPointer(s.a_corner,2,t.FLOAT,!1,0,0),a(s.a_corner,0),ut(n,l,s.a_x_center,"bar_x",1,o)&&ut(n,l,s.a_half_width,"bar_hw",1,o)&&ut(n,l,s.a_y0,"bar_y0",1,o)&&ut(n,l,s.a_y1,"bar_y1",1,o)&&ut(n,l,s.a_color,"bar_color",3,o)&&ut(n,l,s.a_series_id,"bar_sid",1,o)&&ut(n,l,s.a_axis,"bar_axis",1,o)&&l.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,r),a(s.a_x_center,0),a(s.a_half_width,0),a(s.a_y0,0),a(s.a_y1,0),a(s.a_color,0),a(s.a_series_id,0),a(s.a_axis,0)}be();var Vo=10;function mn(e){return e.Ee>=0?Zn(e.Ae,e.Ee,e.ge.length,e.et,e.f.length):e.Pe}function xs(e,t,n){if(!e.u)return;let i=e.u,o;if(e.b){let _=e.b.cells,v=-1;for(let A=0;A<_.length;A++){let L=_[A].layout.e;if(t>=L.x&&t<=L.x+L.width&&n>=L.y&&n<=L.y+L.height){v=A;break}}if(v<0){du(e);return}i=_[v].layout,o=v}let r=i.e;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){du(e);return}let s=i.O,l=i.Z,a=i.q,u=i.ee,m,f,c,d;if(e.Be){let _=s,v=l,A=Math.min(a,u),L=Math.max(a,u),T=_+(t-r.x)/r.width*(v-_);m=A+(n-r.y)/r.height*(L-A),f=T,c=r.height/(L-A),d=r.width/(v-_)}else m=s+(t-r.x)/r.width*(l-s),f=u-(n-r.y)/r.height*(u-a),c=r.width/(l-s),d=r.height/(u-a);let b=e.yn&&e.oe&&!e.Be?e.oe.max-(n-r.y)/r.height*(e.oe.max-e.oe.min):f,g=e.yn&&e.oe&&!e.Be?r.height/(e.oe.max-e.oe.min):d,h=-1,x=null,y=e.Xt,C=y.length<=1;for(let _=y.length-1;_>=0;_--){let v=y[_],A=C?void 0:{start:v.aggStart,end:v.aggEnd};switch(v.chartType){case"scatter":case"line":x=Ec(e,v.chartType,m,f,b,c,d,g,o,A);break;case"bar":h=Ic(e,m,f,b,o,A);break;case"area":{let L=Pc(e,m,f,b,o,A);L&&(L.idx>=0?h=L.idx:x=L.bar);break}}if(h>=0||x)break}Bc(e,h,x)}function Ic(e,t,n,i,o,r){let s=e.Ae,l=s.chartType,a=s.seriesId,u=s.xCenter,m=s.halfWidth,f=s.y0,c=s.y1,d=s.axis,b=e.ne,g=Math.max(1,e.ge.length);for(let h=0;h<s.count;h++){if(l[h]!==Et||b.has(a[h])||o!==void 0&&a[h]%g!==o)continue;if(r!==void 0){let T=Math.floor(a[h]/g);if(T<r.start||T>r.end)continue}let x=u[h],y=m[h];if(t<x-y||t>x+y)continue;let C=d[h]===0?n:i,_=f[h],v=c[h],A=_<v?_:v,L=_<v?v:_;if(C>=A&&C<=L)return h}return-1}function Ec(e,t,n,i,o,r,s,l,a,u){let m=e.ie,f=e.f.length;if(m===0||f===0)return null;let c=e.et,d=e.$t,g=Vo*Vo,h=null,x=e.V;for(let y of e.f){if(y.chartType!==t||e.ne.has(y.seriesId)||a!==void 0&&y.splitIdx!==a||u!==void 0&&(y.aggIdx<u.start||y.aggIdx>u.end))continue;let C=y.axis===1?o:i,_=y.axis===1?l:s,v=x?0:Math.max(0,Math.floor(n-Vo/r)),A=x?m-1:Math.min(m-1,Math.ceil(n+Vo/r));for(let L=v;L<=A;L++){let T=L*f+y.seriesId;if(!(d[T>>3]>>(T&7)&1))continue;let w=c[T],M=x?x[L]:L,I=(M-n)*r,D=(w-C)*_,S=I*I+D*D;S<g&&(g=S,h={catIdx:L,aggIdx:y.aggIdx,splitIdx:y.splitIdx,seriesId:y.seriesId,xCenter:M,halfWidth:0,y0:0,y1:w,value:w,axis:y.axis,chartType:"bar"})}}return h}function Pc(e,t,n,i,o,r){let s=Math.round(t);if(s<0||s>=e.ie||Math.abs(t-s)>.5)return null;let l=e.f.length,a=e.et,u=e.$t,m=e.Ae,f=m.chartType,c=m.catIdx,d=m.seriesId,b=m.axis,g=m.y0,h=m.y1,x=e.ge.length;for(let y=0;y<m.count;y++){if(f[y]!==Uo||c[y]!==s||e.ne.has(d[y])||o!==void 0&&d[y]%x!==o)continue;if(r!==void 0){let T=Math.floor(d[y]/Math.max(1,x));if(T<r.start||T>r.end)continue}let C=b[y]===0?n:i,_=g[y],v=h[y],A=_<v?_:v,L=_<v?v:_;if(C>=A&&C<=L)return{idx:y,bar:null}}for(let y of e.f){if(y.chartType!=="area"||y.stack||e.ne.has(y.seriesId)||o!==void 0&&y.splitIdx!==o||r!==void 0&&(y.aggIdx<r.start||y.aggIdx>r.end))continue;let C=s*l+y.seriesId;if(!(u[C>>3]>>(C&7)&1))continue;let _=a[C],v=y.axis===1?i:n,A=Math.min(0,_),L=Math.max(0,_);if(v>=A&&v<=L)return{idx:-1,bar:{catIdx:s,aggIdx:y.aggIdx,splitIdx:y.splitIdx,seriesId:y.seriesId,xCenter:s,halfWidth:.5,y0:0,y1:_,value:_,axis:y.axis,chartType:"area"}}}return null}function du(e){(e.Ee!==-1||e.Pe!==null)&&(e.Ee=-1,e.Pe=null,e.i&&e.requestRender(e.i))}function Bc(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.i&&e.requestRender(e.i))}function pu(e,t,n){if(e._n.length===0)return!1;for(let i of e._n){let o=i.rect;if(t>=o.x&&t<=o.x+o.width&&n>=o.y&&n<=o.y+o.height){let r=i.seriesIds.some(s=>!e.ne.has(s));for(let s of i.seriesIds)r?e.ne.add(s):e.ne.delete(s);return e.wt=null,e.ar=!1,e.Ii=null,e.i&&(zo(e,e.i),Yo(e,e.i),e.requestRender(e.i)),!0}}return!1}function ys(e,t){let n=[],i=e.f[t.seriesId],o=_s(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 _s(e,t){if(e.Le==="numeric"&&e.V){let i=e.V[t];if(i==null)return"";let o=e.h[0];return e.getColumnFormatter(o,"value")(i)}if(e.Ie.length===0)return"";let n=[];for(let i of e.Ie){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function bu(e,t){t<0||t>=e.Ae.count||(e.go=t,hu(e,Zn(e.Ae,t,e.ge.length,e.et,e.f.length)))}function gu(e,t){e.go=-1,hu(e,t)}function hu(e,t){if(e.w.dismiss(),!e.u)return;let n=Cs(e,t);if(!n)return;let o=(e.f[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Be?n.R(o,t.xCenter):n.R(t.xCenter,o):Xo(e,t.xCenter,o,n),s=ys(e,t);s.length!==0&&(e.w.pin(s,r,n,ie(e.t)),e.Ee=-1,e.Pe=null,e.i&&e.requestRender(e.i))}Ce();Hr();Ce();Tt();Jt();Ki();function xu(e,t,n){return n||fe(e.isDate,t)}function vs(e,t,n,i,o,r,s){let{Fe:l,fontFamily:a}=r,{e:u}=t,m=o==="bottom"?u.y+u.height:u.y;e.fillStyle=l,e.font=`11px ${a}`,e.lineWidth=1,Zi(e,u,i,m,o,f=>t.R(f,0).px,xu(n,i,s)),e.font=`13px ${a}`,e.textAlign="center",e.textBaseline="bottom",e.fillText(n.label,u.x+u.width/2,o==="bottom"?t.cssHeight-2:10)}function As(e,t,n,i,o,r,s){let{Fe:l,fontFamily:a}=r,{e:u}=t,m=o==="left"?u.x:u.x+u.width;e.fillStyle=l,e.font=`11px ${a}`,e.lineWidth=1,qi(e,u,i,m,o,f=>t.R(0,f).py,xu(n,i,s)),e.font=`13px ${a}`,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 $o(e,t,n,i,o,r){vs(e,t,n,i,"bottom",o,r)}function jo(e,t,n,i,o,r){As(e,t,n,i,"left",o,r)}function Zo(e,t,n,i,o,r,s,l=!1,a={}){let u=ce(e,i,r);if(!u)return;let{e:m}=i;if(u.strokeStyle=o.di,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&&(l?(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(),l){if(t.mode==="category"?Pe(u,i,t.domain,o):jo(u,i,t.domain,t.ticks,o,a.category),n.mode==="category"?xe(u,i,n.domain,o):vs(u,i,n.domain,n.ticks,"bottom",o,a.value),s)if(s.mode==="category")xe(u,i,s.domain,o);else{let f=i.O,c=i.Z;i.O=s.domain.min,i.Z=s.domain.max,vs(u,i,s.domain,s.ticks,"top",o,a.alt),i.O=f,i.Z=c}}else if(t.mode==="category"?xe(u,i,t.domain,o):$o(u,i,t.domain,t.ticks,o,a.category),n.mode==="category"?Pe(u,i,n.domain,o):As(u,i,n.domain,n.ticks,"left",o,a.value),s)if(s.mode==="category")Pe(u,i,s.domain,o);else{let f=i.q,c=i.ee;i.q=s.domain.min,i.ee=s.domain.max,As(u,i,s.domain,s.ticks,"right",o,a.alt),i.q=f,i.ee=c}}function qo(e,t,n,i,o,r=!1){let s=ce(e,t,o);s&&(s.strokeStyle=i.Rn,s.lineWidth=1,r?Xt(s,t.e,n,l=>t.R(l,0).px):$t(s,t.e,n,l=>t.R(0,l).py))}Jt();Ht();ji();Tt();Ki();Nn();Ve();var ft=null;function yu(e){if(ft&&ft.xCenters.length>=e&&ft.colors.length>=e*3)return ft;let t=Math.max(e,ft?.xCenters.length??0);return ft={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)},ft}function zo(e,t){let n=e.Ae,i=n.count,o=e.ge.length,r=e.jt&&o>0,s=0;if(e.Ei=null,e.Hn=null,e.Vn=null,i>0){let a=yu(i);(!e.zn||e.zn.length<i)&&(e.zn=new Int32Array(i));let u=e.zn,m=e.ce,f=e.f,c=e.ne,d=n.chartType,b=n.seriesId,g=n.xCenter,h=n.halfWidth,x=n.y0,y=n.y1,C=n.axis,_=Math.max(1,e.tt.length),v=r?D=>D%o*_+Math.floor(D/o):D=>o>0?Math.floor(D/o):D,A=r?o*_:_,L=new Array(A).fill(0);for(let D=0;D<i;D++)d[D]!==hs||c.has(b[D])||L[v(b[D])]++;let T=[],w=new Int32Array(A),M=0;for(let D=0;D<A;D++)T.push({start:M,count:L[D]}),w[D]=M,M+=L[D];r?(e.Vn=null,e.Hn=Array.from({length:o},(D,S)=>T.slice(S*_,(S+1)*_)),e.Ei=Array.from({length:o},(D,S)=>{let E=T[S*_],k=T[(S+1)*_-1];return{start:E.start,count:k.start+k.count-E.start}})):(e.Vn=T,e.Hn=null);let I=D=>w[v(D)]++;for(let D=0;D<i;D++){if(d[D]!==hs)continue;let S=b[D];if(c.has(S))continue;let E=I(S);a.xCenters[E]=g[D]-m,a.halfWidths[E]=h[D],a.y0s[E]=x[D],a.y1s[E]=y[D],a.seriesIds[E]=S,a.axes[E]=C[D];let k=f[S].color;a.colors[E*3]=k[0],a.colors[E*3+1]=k[1],a.colors[E*3+2]=k[2],u[E]=D,s++}}else r&&(e.Ei=Array.from({length:o},()=>({start:0,count:0})));if(e.Un=s,s===0){e.Je=null;return}let l=ft;t.A.ensureCapacity(s),t.A.upload("bar_x",l.xCenters.subarray(0,s),0,1),t.A.upload("bar_hw",l.halfWidths.subarray(0,s),0,1),t.A.upload("bar_y0",l.y0s.subarray(0,s),0,1),t.A.upload("bar_y1",l.y1s.subarray(0,s),0,1),t.A.upload("bar_sid",l.seriesIds.subarray(0,s),0,1),t.A.upload("bar_axis",l.axes.subarray(0,s),0,1),t.A.upload("bar_color",l.colors.subarray(0,s*3),0,3),(!e.Je||e.Je.length<s*3)&&(e.Je=new Float32Array(Math.max(s*3,e.Je?.length??0))),e.Je.set(l.colors.subarray(0,s*3))}function Gc(e,t){let n=e.Un;if(n===0)return;let i=e.zn,o=e.f,r=e.Ae.seriesId,s=yu(n);for(let a=0;a<n;a++){let u=o[r[i[a]]].color;s.colors[a*3]=u[0],s.colors[a*3+1]=u[1],s.colors[a*3+2]=u[2]}let l=e.Je;if(l&&l.length>=n*3){let a=!0;for(let u=0;u<n*3;u++)if(l[u]!==s.colors[u]){a=!1;break}if(a)return}t.A.upload("bar_color",s.colors.subarray(0,n*3),0,3),(!l||l.length<n*3)&&(e.Je=new Float32Array(n*3)),e.Je.set(s.colors.subarray(0,n*3))}function _u(e){e.Y.lines.invalidateBuffers(e),e.Y.scatter.invalidateBuffers(e),e.Y.areas.invalidateBuffers(e)}function Yo(e,t){e.Y.lines.rebuildBuffers(e,t),e.Y.scatter.rebuildBuffers(e,t),e.Y.areas.rebuildBuffers(e,t)}function Cu(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.v();Ls(e)&&e.Un>0&&Gc(e,t);let l=e.Be,a=e.Le==="numeric",u=a?e.I.min:-.5,m=a?e.I.max:e.ie-.5,f=e.ho.min,c=e.ho.max;e._&&(l?e._.setBaseDomain(f,c,u,m):e._.setBaseDomain(u,m,f,c));let d=u,b=m,g=f,h=c,x=e.oe?.min??0,y=e.oe?.max??1;if(e._){let H=e._.getVisibleDomain();l?(g=H.xMin,h=H.xMax,d=H.yMin,b=H.yMax):(d=H.xMin,b=H.xMax,g=H.yMin,h=H.yMax)}let C=l?!e._?.isYDefault():!e._?.isXDefault();if(e.Ci&&e._&&C){let H=zc(e,d,b);H.hasLeft&&(g=H.leftMin,h=H.leftMax),e.oe&&H.hasRight&&(x=H.rightMin,y=H.rightMax)}if(e.t.include_zero&&(g>0&&(g=0),h<0&&(h=0),e.oe&&(x>0&&(x=0),y<0&&(y=0))),e.jt&&e.ge.length>1){kc(e,t,{horizontal:l,numericCat:a,cssWidth:o,cssHeight:r,visCatMin:d,visCatMax:b,visValMin:g,visValMax:h,visRightMin:x,visRightMax:y});return}e.b=null;let _=e.f.length>1,v=e.h.length>0,A={levels:e.Ie,numRows:e.ie,levelLabels:e.h.slice()},L=e.Cn,T=e.Yn==="category"&&L!==null&&L.numRows>0,w;if(l){let H=a?55:Kt(A),U=H+(v?16:0),Y=nt(e.t,_,80,e.f.length),q=Math.max(1,o-U-Y),me=T?Xe(L,q):void 0;w=new oe(o,r,{hasXLabel:!0,hasYLabel:v,hasLegend:_,leftExtra:H,bottomExtra:me,rightExtra:Y})}else if(a){let H=T?Kt(L):void 0;w=new oe(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:_,bottomExtra:24,leftExtra:H,rightExtra:nt(e.t,_,80,e.f.length)})}else{let H=T?Kt(L):55,U=H+16,Y=nt(e.t,_,80,e.f.length),q=Math.max(1,o-U-Y),me=Xe(A,q);w=new oe(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:_,bottomExtra:me,leftExtra:T?H:void 0,rightExtra:Y})}e.u=w,e._&&e._.updateLayout(w);let M=e.t.include_zero,I=l?w.buildProjectionMatrix(g,h,b,d,"x",M,void 0,0,e.ce):w.buildProjectionMatrix(d,b,g,h,"y",M,void 0,e.ce,0),D;if(e.yn&&e.oe&&!l){let H=w.O,U=w.Z,Y=w.q,q=w.ee;D=w.buildProjectionMatrix(d,b,x,y,"y",M,void 0,e.ce,0),w.O=H,w.Z=U,w.q=Y,w.ee=q}else D=I;let S=K(g,h,6),E=e.yn&&e.oe&&!l?K(x,y,6):null,k=A,W={min:g,max:h,label:e.xo},V=e.oe&&!l?{min:x,max:y,label:e.ur}:null;e.Q&&qo(e.Q,w,S,s,t.dpr,l);let N=e.f.length>1?mn(e):null;rt(n,w,t.dpr,()=>{vu(e,n,t,I,D,s.pi,l,N?N.seriesId:-1)}),e.le=k,e.te=W,e.ae=S,e.Xn=V,e.$n=E,e.Ge=a?K(d,b,6):null,e._e(()=>Ko(e))}function vu(e,t,n,i,o,r,s,l,a){let u=e.Xt,m=u.length<=1;for(let f of u){let c=m?void 0:{start:f.aggStart,end:f.aggEnd};switch(f.chartType){case"area":s||e.Y.areas.draw(e,t,n,i,o,r,a,c);break;case"bar":{t.useProgram(e.o);let d=e.E;t.uniformMatrix4fv(d.u_proj_left,!1,i),t.uniformMatrix4fv(d.u_proj_right,!1,o),t.uniform1f(d.u_horizontal,s?1:0),t.uniform1f(d.u_hover_series,l),cu(e,t,n,Wc(e,f,a));break}case"line":s||e.Y.lines.draw(e,t,n,i,o,a,c);break;case"scatter":s||e.Y.scatter.draw(e,t,n,i,o,a,c);break}}}function Wc(e,t,n){let i=n!==void 0?e.Hn?.[n]:e.Vn;if(!i)return n!==void 0?{start:0,count:0}:void 0;let o=i[t.aggStart],r=i[t.aggEnd];return{start:o.start,count:r.start+r.count-o.start}}function kc(e,t,n){let i=t.gl,o=t.dpr,r=e.v(),{horizontal:s,numericCat:l,cssWidth:a,cssHeight:u,visCatMin:m,visCatMax:f,visValMin:c,visValMax:d,visRightMin:b,visRightMax:g}=n,h=e.h.length>0,x=e.Cn,y=e.Yn==="category"&&x!==null&&x.numRows>0,C=e.tt.length>1,_=l?"outer":"cell",v=y?"cell":"outer",A=Ie(e.ge,{cssWidth:a,cssHeight:u,xAxis:s?v:_,yAxis:s?_:v,hasLegend:C&&se(e.t,e.tt.length)==="sidebar",legendWidth:we(e.t,96),hasXLabel:s?!0:h,hasYLabel:s?h:!0,gap:e.W.facet_padding});if(e.b=A,e.u=A.cells[0]?.layout??null,A.cells.length===0||!e.u)return;e.syncFacetZoomLayouts(A.cells);let L=K(c,d,6),T=l?K(m,f,6):null,w=A.cells[0].layout,M=e.Q;M&&e._e(()=>ce(M,w,o));let I=e.t.include_zero,D=e.f.length>1?mn(e):null,S=e.yn&&e.oe!==null&&!s;At(i);for(let E=0;E<A.cells.length;E++){let W=A.cells[E].layout,V=s?W.buildProjectionMatrix(c,d,f,m,"x",I,void 0,0,e.ce):W.buildProjectionMatrix(m,f,c,d,"y",I,void 0,e.ce,0),N=V;if(S){let H=W.O,U=W.Z,Y=W.q,q=W.ee;N=W.buildProjectionMatrix(m,f,b,g,"y",I,void 0,e.ce,0),W.O=H,W.Z=U,W.q=Y,W.ee=q}M&&e._e(()=>Nc(M,W,L,r,o,s)),Lt(i,W,o,()=>{vu(e,i,t,V,N,r.pi,s,D&&D.splitIdx===E?D.seriesId:-1,E)})}e.le={levels:e.Ie,numRows:e.ie,levelLabels:e.h.slice()},e.te={min:c,max:d,label:e.xo},e.ae=L,e.Xn=null,e.$n=null,e.Ge=T,e._e(()=>Ko(e))}function Nc(e,t,n,i,o,r){let s=le(e,o);s&&(s.strokeStyle=i.Rn,s.lineWidth=1,r?Xt(s,t.e,n,l=>t.R(l,0).px):$t(s,t.e,n,l=>t.R(0,l).py))}function Cs(e,t){return e.b?e.b.cells[t.splitIdx]?.layout??null:e.u}function Ko(e){Oc(e),e.presentOverlay()}function Oc(e){if(!e.l||!e.u||!e.te||!e.ae)return;if(e.b){Uc(e);return}let t=e.v(),n;if(e.Le==="numeric"&&e.I&&e.Ge)n={mode:"numeric",domain:{min:e.I.min,max:e.I.max,isDate:e.I.isDate,label:e.I.label},ticks:e.Ge};else if(e.le)n={mode:"category",domain:e.le};else return;let i=e.f.find(a=>a.axis===0),o=e.f.find(a=>a.axis===1),r=e.h[0],s=e.Yn==="category"&&e.Cn?{mode:"category",domain:e.Cn}:{mode:"numeric",domain:e.te,ticks:e.ae},l;e.Xn&&e.$n&&(l=e.mr==="category"&&e.yo?{mode:"category",domain:e.yo}:{mode:"numeric",domain:e.Xn,ticks:e.$n}),Zo(e.l,n,s,e.u,t,e.i?.dpr??1,l,e.Be,{value:e.getColumnFormatter(i?.aggName??null,"tick"),alt:e.getColumnFormatter(o?.aggName??null,"tick"),category:e.getColumnFormatter(r,"tick")}),Vc(e),mn(e)&&Lu(e)}function Uc(e){let t=e.b,n=e.l,i=e.v(),o=e.i?.dpr??1,r=e.Be,s=e.h.length>0,l=e.Le==="numeric"&&e.I!==null&&e.Ge!==null;if(!ce(n,e.u,o))return;let a=e.le,u=e.te,m=e.ae,f=e.Cn,c=e.Yn==="category"&&f!==null&&f.numRows>0,d=e.f.find(x=>x.axis===0),b=e.getColumnFormatter(d?.aggName??null,"tick"),g=e.getColumnFormatter(e.h[0],"tick");for(let x of t.cells){let y=x.layout,C=y.e,_=le(n,o);_&&(_.strokeStyle=i.di,_.lineWidth=1,_.beginPath(),_.moveTo(C.x,C.y),_.lineTo(C.x,C.y+C.height),_.lineTo(C.x+C.width,C.y+C.height),_.stroke(),r?(!l&&a&&Pe(_,y,a,i),c&&xe(_,y,f,i)):(!l&&a&&xe(_,y,a,i),c&&Pe(_,y,f,i)),x.titleRect&&Ut(n,x.label,x.titleRect,i,o))}let h=l?{min:e.I.min,max:e.I.max,isDate:e.I.isDate,label:e.I.label}:null;r?(h&&t.outerYAxisRect&&En(n,t.outerYAxisRect,h,e.Ge,Mn(t),i,s,o,g),!c&&t.outerXAxisRect&&In(n,t.outerXAxisRect,u,m,wn(t),i,!0,o,b)):(h&&t.outerXAxisRect&&In(n,t.outerXAxisRect,h,e.Ge,wn(t),i,s,o,g),!c&&t.outerYAxisRect&&En(n,t.outerYAxisRect,u,m,Mn(t),i,!0,o,b)),Hc(e,t),mn(e)&&Lu(e)}function Au(e,t,n,i,o){let r=e.l.getContext("2d");if(!r)return;r.save();let s=e.v(),l=t;n.mode==="floating"&&(l=ro(r,t,s,n.title,n.opacity));let a=10,u=vn,m=i*u,f=e.F.clampScroll(l.height,m),c=m>l.height,d=Math.max(0,l.width-a-6-(c?10:0));r.beginPath(),r.rect(l.x,l.y,l.width,l.height),r.clip(),r.font=`11px ${s.fontFamily}`,r.textAlign="left",r.textBaseline="middle";let b=l.x,g=Math.floor(f/u),h=l.y+u/2+g*u-f;for(let x=g;x<i&&h-u/2<l.y+l.height;x++){let y=o(x),C=Math.round(y.color[0]*255),_=Math.round(y.color[1]*255),v=Math.round(y.color[2]*255);r.globalAlpha=y.hidden?.3:1,r.fillStyle=`rgb(${C},${_},${v})`,r.fillRect(b,h-a/2,a,a);let A=Mt(r,y.label,d),L=r.measureText(A).width;r.fillStyle=s.cn,r.fillText(A,b+a+6,h),y.hidden&&(r.strokeStyle=s.cn,r.lineWidth=1,r.beginPath(),r.moveTo(b+a+6,h),r.lineTo(b+a+6+L,h),r.stroke()),r.globalAlpha=1,e._n.push({seriesIds:y.seriesIds,rect:{x:b-2,y:h-u/2,width:Math.min(a+6+L+4,Math.max(1,l.width)),height:u}}),h+=u}r.restore(),qr(r,l,f,m,s),e.F.setPainted({mode:n.mode,box:t,content:l,contentHeight:m,sidebarGutter:n.sidebarGutter})}function Hc(e,t){if(e._n=[],!e.l||!e.u)return;let n=e.t,i=e.tt.length,o=se(n,i),r=o==="floating";if(i<=1||o==="none"||!r&&!t.legendRect){e.F.clearPainted();return}let s=Array.from({length:i},()=>[]),l=Array.from({length:i},()=>[.5,.5,.5]);for(let m of e.f)m.aggIdx>=0&&m.aggIdx<i&&(s[m.aggIdx].push(m.seriesId),l[m.aggIdx]=m.color);let a=e.u,u=r?e.F.floatingBox(n,a.cssWidth,a.cssHeight,st(e.l,e.v(),i,()=>e.tt.slice(0,i),{title:"Legend"})):{x:t.legendRect.x+12,y:t.legendRect.y+10,width:Math.max(1,t.legendRect.width-16),height:Math.max(1,t.legendRect.height-20)};Au(e,u,{mode:r?"floating":"sidebar",legend:e.F,title:"Legend",sidebarGutter:r?void 0:t.legendRect.width,opacity:n.legend_opacity},i,m=>({label:e.tt[m],color:l[m],seriesIds:s[m],hidden:s[m].every(f=>e.ne.has(f))}))}function Vc(e){if(e._n=[],!e.l||!e.u)return;let t=e.t,n=e.f,i=se(t,n.length);if(n.length<=1||i==="none"){e.F.clearPainted();return}let o=e.u,r=i==="floating",s=e.B.join(" / ")||"Legend",l=r?e.F.floatingBox(t,o.cssWidth,o.cssHeight,st(e.l,e.v(),n.length,function*(){for(let a of n)yield a.label},{title:s})):{x:o.e.x+o.e.width+12,y:o.margins.top+10,width:Math.max(1,o.cssWidth-o.e.x-o.e.width-16),height:Math.max(1,o.e.height-10)};Au(e,l,{mode:r?"floating":"sidebar",legend:e.F,title:s,sidebarGutter:r?void 0:o.margins.right,opacity:t.legend_opacity},n.length,a=>({label:n[a].label,color:n[a].color,seriesIds:[n[a].seriesId],hidden:e.ne.has(n[a].seriesId)}))}function Lu(e){if(!e.l||!e.u)return;let t=mn(e);if(!t)return;let n=Cs(e,t);if(!n)return;let o=(e.f[t.seriesId]?.chartType??"bar")==="bar"?(t.y0+t.y1)/2:t.y1,r=t.axis===0?e.Be?n.R(o,t.xCenter):n.R(t.xCenter,o):Xo(e,t.xCenter,o,n),s=ys(e,t),l=e.v(),a=e.i?.dpr??1,u=t.axis===0?e.Be?n.R(t.y1,t.xCenter):n.R(t.xCenter,t.y1):Xo(e,t.xCenter,t.y1,n),m=[],f;e.Le==="numeric"&&e.V&&e.V[t.catIdx]!=null?f=(e.getColumnFormatter(e.h[0],"tick")??fe(e.I?.isDate,e.Ge))(e.V[t.catIdx]):f=_s(e,t.catIdx),f!==""&&m.push({side:e.Be?"left":"bottom",px:u.px,py:u.py,text:f});let c=t.axis===1?e.Xn:e.te,d=t.axis===1?e.$n:e.ae,b=e.getColumnFormatter(e.f[t.seriesId]?.aggName,"tick")??fe(c?.isDate,d);m.push({side:e.Be?"bottom":t.axis===1?"right":"left",px:u.px,py:u.py,text:b(t.y1)}),Ye(e.l,n,l,a,m,e.t.tooltip_opacity),He(e.l,r,s,n,l,a,ie(e.t))}function Xo(e,t,n,i){let o=i??e.u,{x:r,y:s,width:l,height:a}=o.e,u=(t-o.O)/(o.Z-o.O),m=e.oe,f=(n-m.min)/(m.max-m.min);return{px:r+u*l,py:s+(1-f)*a}}function zc(e,t,n){let i=e.wt;if(i&&i.catMin===t&&i.catMax===n&&i.hidden===e.ne)return i;let o=$c(e),r=1/0,s=-1/0,l=!1,a=1/0,u=-1/0,m=!1;if(o.n>0){let c=e.V,d,b;if(c){let v=Yc(c,o.n,t,n);d=v.lo,b=v.hi}else d=Math.max(0,Math.floor(t)),b=Math.min(o.n-1,Math.ceil(n));let g=o.leftMin,h=o.leftMax,x=o.rightMin,y=o.rightMax,C=o.hasLeft,_=o.hasRight;for(let v=d;v<=b;v++)C[v]&&(g[v]<r&&(r=g[v]),h[v]>s&&(s=h[v]),l=!0),_[v]&&(x[v]<a&&(a=x[v]),y[v]>u&&(u=y[v]),m=!0)}let f=i??Xc();return f.catMin=t,f.catMax=n,f.hidden=e.ne,f.leftMin=r,f.leftMax=s,f.hasLeft=l,f.rightMin=a,f.rightMax=u,f.hasRight=m,e.wt=f,f}function Yc(e,t,n,i){if(t===0||n>i)return{lo:0,hi:-1};let o=0,r=t;for(;o<r;){let a=o+r>>>1;e[a]<n?o=a+1:r=a}let s=Math.max(0,o-1);for(o=0,r=t;o<r;){let a=o+r>>>1;e[a]<=i?o=a+1:r=a}let l=Math.min(t-1,o);return{lo:s,hi:l}}function Xc(){return{catMin:0,catMax:0,hidden:new Set,leftMin:0,leftMax:0,hasLeft:!1,rightMin:0,rightMax:0,hasRight:!1}}function $c(e){let t=e.ie,n=e.fr,i=n&&n.leftMin.length>=t;if(n&&i&&e.Ii===e.ne)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.fr=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 o=e.Ae,r=e.ne,s=o.catIdx,l=o.seriesId,a=o.y0,u=o.y1,m=o.axis;for(let g=0;g<o.count;g++){if(r.has(l[g]))continue;let h=s[g];if(h<0||h>=t)continue;let x=a[g],y=u[g],C=x<y?x:y,_=x<y?y:x;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.jn,e.Zn],c=e.et,d=e.$t,b=e.f.length;for(let g of f)for(let h of g){if(r.has(h.seriesId))continue;let x=h.axis===1,y=h.seriesId;for(let C=0;C<t;C++){let _=C*b+y;if(!(d[_>>3]>>(_&7)&1))continue;let v=c[_];x?(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.Ii=r,n}Rn();Be();de();var qn=new Float32Array(0),Kn=new Uint8Array(0);function jc(e){return qn.length>=e||(qn=new Float32Array(Math.max(e,qn.length*2))),qn}function Zc(e){return Kn.length>=e||(Kn=new Uint8Array(Math.max(e,Kn.length*2))),Kn}function qc(e){return e==="solid"?1:e==="transparent"?.5:0}var Jo=class{constructor(){p(this,"o",null);p(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=at(t.gl),i=j(t,"bar-line",Ke,Je,["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={...i,cornerBuffer:n},this.o}invalidateBuffers(t){let n=this.r;if(!n||!t.i){this.r=null;return}let i=t.i.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer),i.deleteBuffer(o.gpuRealBuffer);this.r=null}rebuildBuffers(t,n){let i=t.jn;if(i.length===0){this.r=null;return}if(t.ie===0){this.r=null;return}this.ensureProgram(n);let r=n.gl,s=t.et,l=t.$t,a=t.ce,u=t.V,m=t.f.length,f=[];for(let c of i){let d=t.f[c.seriesId],b=d.start,g=d.end;if(b<0||g<b)continue;let h=g-b+1;if(h<2)continue;let x=jc(h*2),y=Zc(h),C=0;for(let A=b;A<=g;A++){let L=u?u[A]-a:A,T=A*m+c.seriesId;x[C*2]=L,x[C*2+1]=s[T],y[C]=l[T>>3]>>(T&7)&1,C++}let _=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,_),r.bufferData(r.ARRAY_BUFFER,x.subarray(0,C*2),r.STATIC_DRAW);let v=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,v),r.bufferData(r.ARRAY_BUFFER,y.subarray(0,C),r.STATIC_DRAW),f.push({seriesId:c.seriesId,axis:c.axis,color:[c.color[0],c.color[1],c.color[2]],gpuBuffer:_,gpuRealBuffer:v,count:h,interpolateMode:d.interpolateMode})}this.r={series:f}}draw(t,n,i,o,r,s,l){let a=this.r,u=this.o;if(!a||!u||a.series.length===0)return;let m=i.dpr;n.useProgram(u.program),n.uniform2f(u.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(u.u_line_width,t.t.line_width_px*m);let f=Q(i),{setDivisor:c,drawArraysInstanced:d}=f;n.bindBuffer(n.ARRAY_BUFFER,u.cornerBuffer),n.enableVertexAttribArray(u.a_corner),n.vertexAttribPointer(u.a_corner,1,n.FLOAT,!1,0,0),c(u.a_corner,0);let b=2*Float32Array.BYTES_PER_ELEMENT,g=Uint8Array.BYTES_PER_ELEMENT,h=t.ne;for(let x of a.series){if(h.has(x.seriesId)||s!==void 0&&t.f[x.seriesId].splitIdx!==s)continue;let y=t.f[x.seriesId].aggIdx;if(l!==void 0&&(y<l.start||y>l.end))continue;n.uniformMatrix4fv(u.u_projection,!1,x.axis===1?r:o);let C=t.f[x.seriesId].color;n.uniform4f(u.u_color,C[0],C[1],C[2],1),n.uniform1f(u.u_interp_alpha,qc(x.interpolateMode)),n.enableVertexAttribArray(u.a_start),c(u.a_start,1),n.enableVertexAttribArray(u.a_end),c(u.a_end,1),n.enableVertexAttribArray(u.a_real_start),c(u.a_real_start,1),n.enableVertexAttribArray(u.a_real_end),c(u.a_real_end,1),n.bindBuffer(n.ARRAY_BUFFER,x.gpuBuffer),n.vertexAttribPointer(u.a_start,2,n.FLOAT,!1,b,0),n.vertexAttribPointer(u.a_end,2,n.FLOAT,!1,b,b),n.bindBuffer(n.ARRAY_BUFFER,x.gpuRealBuffer),n.vertexAttribPointer(u.a_real_start,1,n.UNSIGNED_BYTE,!1,g,0),n.vertexAttribPointer(u.a_real_end,1,n.UNSIGNED_BYTE,!1,g,g),d(n.TRIANGLE_STRIP,0,4,x.count-1)}c(u.a_start,0),c(u.a_end,0),c(u.a_real_start,0),c(u.a_real_end,0)}destroy(t){let n=t.i?.gl;if(n){this.invalidateBuffers(t);let i=this.o;i&&n.deleteBuffer(i.cornerBuffer)}this.o=null,this.r=null}};de();var qe=new Float32Array(0),Me=new Float32Array(0);function Kc(e){qe.length<e*2&&(qe=new Float32Array(Math.max(e*2,qe.length*2))),Me.length<e*3&&(Me=new Float32Array(Math.max(e*3,Me.length*2)))}var Qo=class{constructor(){p(this,"o",null);p(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,i=j(t,"bar-scatter",fi,ci,["u_projection","u_point_size"],["a_position","a_color"]);return this.o={...i,posLeftBuffer:n.createBuffer(),posRightBuffer:n.createBuffer(),colorLeftBuffer:n.createBuffer(),colorRightBuffer:n.createBuffer()},this.o}invalidateBuffers(t){this.r=null}rebuildBuffers(t,n){let i=t.Zn;if(i.length===0){this.r=null;return}let o=t.ie,r=t.f.length;if(o===0||r===0){this.r=null;return}let s=this.ensureProgram(n),l=n.gl,a=t.et,u=t.$t,m=t.V,f=t.ce,c=t.ne,d=0,b=0;for(let C of i)if(!c.has(C.seriesId))for(let _=0;_<o;_++){let v=_*r+C.seriesId;u[v>>3]>>(v&7)&1&&(C.axis===1?b++:d++)}let g=d+b;if(g===0){this.r=null;return}Kc(g);let h=[],x=0,y=d;for(let C of i){if(c.has(C.seriesId))continue;let _=C.axis===1?y-d:x,v=C.color[0],A=C.color[1],L=C.color[2];for(let w=0;w<o;w++){let M=w*r+C.seriesId;if(!(u[M>>3]>>(M&7)&1))continue;let I=m?m[w]-f:w,D=a[M];C.axis===1?(qe[y*2]=I,qe[y*2+1]=D,Me[y*3]=v,Me[y*3+1]=A,Me[y*3+2]=L,y++):(qe[x*2]=I,qe[x*2+1]=D,Me[x*3]=v,Me[x*3+1]=A,Me[x*3+2]=L,x++)}let T=C.axis===1?y-d:x;T>_&&h.push({seriesId:C.seriesId,axis:C.axis,first:_,count:T-_})}d>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.posLeftBuffer),l.bufferData(l.ARRAY_BUFFER,qe.subarray(0,d*2),l.STATIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,s.colorLeftBuffer),l.bufferData(l.ARRAY_BUFFER,Me.subarray(0,d*3),l.STATIC_DRAW)),b>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.posRightBuffer),l.bufferData(l.ARRAY_BUFFER,qe.subarray(d*2,g*2),l.STATIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,s.colorRightBuffer),l.bufferData(l.ARRAY_BUFFER,Me.subarray(d*3,g*3),l.STATIC_DRAW)),this.r={leftCount:d,rightCount:b,seriesRanges:h}}draw(t,n,i,o,r,s,l){let a=this.r,u=this.o;if(!a||!u||a.leftCount===0&&a.rightCount===0)return;let m=i.dpr;if(n.useProgram(u.program),n.uniform1f(u.u_point_size,t.t.point_size_px*m),s!==void 0||l!==void 0){for(let f of a.seriesRanges){if(s!==void 0&&t.f[f.seriesId].splitIdx!==s)continue;let c=t.f[f.seriesId].aggIdx;l!==void 0&&(c<l.start||c>l.end)||Ts(n,u,f.axis===1?u.posRightBuffer:u.posLeftBuffer,f.axis===1?u.colorRightBuffer:u.colorLeftBuffer,f.count,f.axis===1?r:o,f.first)}return}Ts(n,u,u.posLeftBuffer,u.colorLeftBuffer,a.leftCount,o),Ts(n,u,u.posRightBuffer,u.colorRightBuffer,a.rightCount,r)}destroy(t){let n=t.i?.gl;if(n){let i=this.o;i&&(n.deleteBuffer(i.posLeftBuffer),n.deleteBuffer(i.posRightBuffer),n.deleteBuffer(i.colorLeftBuffer),n.deleteBuffer(i.colorRightBuffer))}this.o=null,this.r=null}};function Ts(e,t,n,i,o,r,s=0){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,s,o))}de();var Jn=new Float32Array(0);function Jc(e){return Jn.length>=e||(Jn=new Float32Array(Math.max(e,Jn.length*2))),Jn}var er=class{constructor(){p(this,"o",null);p(this,"r",null)}ensureProgram(t){return this.o?this.o:(this.o=j(t,"bar-area",ui,mi,["u_projection","u_color","u_opacity"],["a_position"]),this.o)}invalidateBuffers(t){let n=this.r;if(!n||!t.i){this.r=null;return}let i=t.i.gl;for(let o of n.series)i.deleteBuffer(o.gpuBuffer);this.r=null}rebuildBuffers(t,n){let i=t.Pi;if(i.length===0){this.r=null;return}let o=t.ie,r=t.f.length;if(o===0||r===0){this.r=null;return}this.ensureProgram(n);let s=n.gl,l=t.et,a=t.$t,u=t.V,m=t.ce,f=t._o,c=t.Ae,d=[];for(let b of i){let g=t.f[b.seriesId],h=Qc(b,o,r,l,a,f,c.y0,c.y1,u,m,g.start,g.end,g.interpolateMode);if(h.totalVertices===0)continue;let x=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,x),s.bufferData(s.ARRAY_BUFFER,h.scratch.subarray(0,h.totalVertices*2),s.STATIC_DRAW),d.push({seriesId:b.seriesId,axis:b.axis,color:[b.color[0],b.color[1],b.color[2]],gpuBuffer:x,strips:h.descriptors})}this.r={series:d}}draw(t,n,i,o,r,s,l,a){let u=this.r,m=this.o;if(!u||!m||u.series.length===0)return;n.useProgram(m.program),n.uniform1f(m.u_opacity,s);let f=t.ne;for(let c of u.series){if(f.has(c.seriesId)||l!==void 0&&t.f[c.seriesId].splitIdx!==l)continue;let d=t.f[c.seriesId].aggIdx;if(a!==void 0&&(d<a.start||d>a.end))continue;n.uniformMatrix4fv(m.u_projection,!1,c.axis===1?r:o);let b=t.f[c.seriesId].color;n.uniform3f(m.u_color,b[0],b[1],b[2]),n.bindBuffer(n.ARRAY_BUFFER,c.gpuBuffer),n.enableVertexAttribArray(m.a_position),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,0);for(let g of c.strips)n.bindBuffer(n.ARRAY_BUFFER,c.gpuBuffer),n.vertexAttribPointer(m.a_position,2,n.FLOAT,!1,0,g.offsetBytes),n.drawArrays(n.TRIANGLE_STRIP,0,g.vertexCount)}}destroy(t){this.invalidateBuffers(t),this.o=null}};function Qc(e,t,n,i,o,r,s,l,a,u,m,f,c){let d=Jc(t*4),b=[],g=e.seriesId*1e9,h=c!=="skip",x=0,y=0;for(let C=0;C<t;C++){let _=0,v=0,A=!1;if(e.stack){let L=r?.get(g+C);L!==void 0&&(_=s[L],v=l[L],A=!0)}else{let L=C*n+e.seriesId;h?C>=m&&C<=f&&(v=i[L],A=!0):o[L>>3]>>(L&7)&1&&(v=i[L],A=!0)}if(A){let L=a?a[C]-u:C;d[x++]=L,d[x++]=_,d[x++]=L,d[x++]=v}else if(x>y){let L=(x-y)/2;L>=4&&b.push({offsetBytes:y*4,vertexCount:L}),y=x}}if(x>y){let C=(x-y)/2;C>=4&&b.push({offsetBytes:y*4,vertexCount:C})}return{descriptors:b,totalVertices:x/2,scratch:d}}Be();de();function Qn(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 ct=class extends un{constructor(n="vertical"){super();p(this,"Be");p(this,"E",null);p(this,"tt",[]);p(this,"ge",[]);p(this,"f",[]);p(this,"jt",!1);p(this,"b",null);p(this,"Ei",null);p(this,"Xt",[]);p(this,"Vn",null);p(this,"Hn",null);p(this,"Ae",Ho());p(this,"Co",[]);p(this,"jn",[]);p(this,"Zn",[]);p(this,"Pi",[]);p(this,"xo","");p(this,"ur","");p(this,"Yn","numeric");p(this,"mr",null);p(this,"Cn",null);p(this,"yo",null);p(this,"_o",null);p(this,"Je",null);p(this,"Bi",null);p(this,"Gi",null);p(this,"vo",null);p(this,"Ao",null);p(this,"ho",{min:0,max:1});p(this,"oe",null);p(this,"yn",!1);p(this,"qn",null);p(this,"Kn",null);p(this,"Wi",null);p(this,"Le","category");p(this,"I",null);p(this,"ce",0);p(this,"Ge",null);p(this,"V",null);p(this,"ne",new Set);p(this,"Ee",-1);p(this,"go",-1);p(this,"Pe",null);p(this,"et",new Float32Array(0));p(this,"$t",new Uint8Array(0));p(this,"Y",{lines:new Jo,scatter:new Qo,areas:new er});p(this,"Xn",null);p(this,"$n",null);p(this,"Un",0);p(this,"zn",new Int32Array(0));p(this,"_n",[]);p(this,"ar",!1);p(this,"wt",null);p(this,"fr",null);p(this,"Ii",null);this.Be=n==="horizontal"}getZoomConfig(){return{lockAxis:this.Be?"x":"y"}}repaintChrome(){Ko(this)}tooltipCallbacks(){return{onHover:(n,i)=>xs(this,n,i),onLeave:()=>{(this.Ee!==-1||this.Pe)&&(this.Ee=-1,this.Pe=null,this.i&&this.requestRender(this.i))},onClickPre:(n,i)=>pu(this,n,i),onPin:(n,i)=>{if(xs(this,n,i),this.Ee>=0){let o=this.Ee;bu(this,o);let r=Zn(this.Ae,o,this.ge.length,this.et,this.f.length);this.cr(r)}else if(this.Pe){let o=this.Pe;gu(this,o),this.cr(o)}},onUnpin:()=>{this.emitUnselect()}}}async cr(n){if(!this.tt[n.aggIdx])return;let i=this.Le==="numeric"&&this.V?[this.V[n.catIdx]??null]:this.Ie.map(s=>s.labels[n.catIdx]??null),o=this.ge[n.splitIdx]??"",r=this.B.length>0&&o!==""?o.split("|"):[];await this.emitClickAndSelect({rowIdx:n.catIdx+this.bt,columnName:this.tt[n.aggIdx],groupByValues:i,splitByValues:r})}async uploadAndRender(n,i,o,r){this.i=n;let s=n.gl;if(o!==0)return;if(!this.o){let u=j(n,"bar",ii,oi,["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=u.program,this.E=u,this.H=fo(s)}let l=this.B.length>0&&this.W.facet_mode==="grid",a=fu({columns:i,numRows:r,columnSlots:this.L,groupBy:this.h,splitBy:this.B,groupByTypes:this.vt,columnsConfig:this.Dn,defaultChartType:this.xi,autoAltYAxis:this.t.auto_alt_y_axis,bandInnerFrac:this.t.band_inner_frac,barInnerPad:this.t.bar_inner_pad,includeZero:this.t.include_zero,facetSplits:l,scratchBars:this.Ae,scratchPosStack:this.vo,scratchNegStack:this.Ao});if(this.t.domain_mode==="expand"){let u=td(a);this.Wi!==u&&(this.qn=null,this.Kn=null,this.Wi=u),this.qn=Qn(this.qn,a.leftDomain),a.rightDomain&&(this.Kn=Qn(this.Kn,a.rightDomain))}else this.qn=null,this.Kn=null,this.Wi=null;this.tt=a.aggregates,this.ge=a.splitPrefixes,this.jt=l&&a.splitPrefixes.length>1,this.Ie=a.rowPaths,this.ie=a.numCategories,this.bt=a.rowOffset,this.Le=a.axisMode.mode,this.I=a.numericCategoryDomain,this.V=a.categoryPositions,this.ce=a.numericCategoryDomain?.min??0,this.f=a.series,this.Ae=a.bars,this.vo=a.posStack,this.Ao=a.negStack,this.et=a.samples,this.Co.length=0,this.jn.length=0,this.Zn.length=0,this.Pi.length=0;for(let u of a.series)switch(u.chartType){case"bar":this.Co.push(u);break;case"line":this.jn.push(u);break;case"scatter":this.Zn.push(u);break;case"area":this.Pi.push(u);break}this.xo=Tu(a.series,0),this.ur=Tu(a.series,1),this.Xt.length=0;{let u=Math.max(1,a.splitPrefixes.length);for(let m=0;m<a.aggregates.length;m++){let f=a.series[m*u].chartType,c=this.Xt[this.Xt.length-1];c&&c.chartType===f?c.aggEnd=m:this.Xt.push({chartType:f,aggStart:m,aggEnd:m})}}this._o=ed(this.Ae),this.wt=null,this.ar=!1,this.Bi=null,this.Gi=null,this.Ii=null,this.Je=null,this.Ee=-1,this.Pe=null,this.$t=a.sampleValid,this.ho=a.leftDomain,this.oe=a.rightDomain,this.yn=a.hasRightAxis,this.Yn=a.leftValueAxisMode,this.mr=a.rightValueAxisMode,this.Cn=a.leftValueCategoryDomain,this.yo=a.rightValueCategoryDomain,Ls(this),zo(this,n),_u(this),Yo(this,n),await this.requestRender(n)}kt(n){this.o&&(this.i=n,Cu(this,n))}resetExpandedDomain(){this.qn=null,this.Kn=null,this.Wi=null}destroyInternal(){if(this.i){let n=this.i.gl;this.H&&n.deleteBuffer(this.H),id(this)}this.o=null,this.E=null,this.H=null,this.jt=!1,this.b=null,this.Ei=null,this.Hn=null,this.Vn=null,this.Xt.length=0,this.Ae=Ho(),this.f=[],this.Co=[],this.jn=[],this.Zn=[],this.Pi=[],this._o=null,this.Bi=null,this.Gi=null,this.Je=null,this.vo=null,this.Ao=null,this.Ie=[],this.ie=0,this.ne.clear(),this.Ee=-1,this.Pe=null}};function ed(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 Tu(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 td(e){let t=Math.max(1,e.splitPrefixes.length),n=[];for(let i=0;i<e.aggregates.length;i++)n.push(`${e.aggregates[i]}:${e.series[i*t].axis}`);return n.join("\\0")}function Ls(e){let t=e.v(),n=t.Ne,i=t.N,o=e.Dn,r=e.jt?Math.max(1,e.tt.length):e.f.length,s=e.Gi;if(e.Bi&&s&&s.Ne===n&&s.N===i&&s.seriesLength===r&&s.columnsConfig===o)return!1;let l=nd(n,i,r);e.Bi=l,e.Gi={Ne:n,N:i,seriesLength:r,columnsConfig:o};for(let a=0;a<e.f.length;a++){let u=e.f[a],m=e.jt?l[u.aggIdx]:l[a];u.color=su(u,e.jt,o)??m}return!0}function nd(e,t,n){return he(e,t,n)}function id(e){e.Y.lines.destroy(e),e.Y.scatter.destroy(e),e.Y.areas.destroy(e)}var tr=class extends ct{constructor(){super("horizontal")}};Ln();ot();kn();function ws(e){let{columns:t,numRows:n,groupBy:i,splitBy:o,groupByTypes:r}=e,s=sn(i,r),l={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},a=i.map(w=>r[w]??"string"),{rowPaths:u,numCategories:m,rowOffset:f}=ln(t,n,i.length,a,s),c=null,d=null;if(s.mode==="numeric"&&m>0){let w=t.get("__ROW_PATH_0__"),M=Dt(w?.values,m,f,i[0]??"",s.numericType==="date"||s.numericType==="datetime");M&&(c=M.categoryPositions,d=M.numericCategoryDomain)}let b=[];for(let w of t.keys())w.startsWith("__")||!t.get(w)?.values||b.push(w);let g=b.length;if(m===0||g===0)return{...l,xLevels:u,rowOffset:f};let h=sd(b),x=od(o,r),y={mode:"category"},C=null,_=null;if(x.mode==="numeric"){let w=rd(b,x.numericType);if(w){let M=Dt(w,g,0,o[0]??"",x.numericType==="date"||x.numericType==="datetime");M&&(y=x,C=M.categoryPositions,_=M.numericCategoryDomain)}}let v=[],A=new Array(m*g).fill(null),L=1/0,T=-1/0;for(let w=0;w<g;w++){let M=t.get(b[w]),I=M.values,D=M.valid;for(let S=0;S<m;S++){let E=S+f;if(D&&!(D[E>>3]>>(E&7)&1))continue;let k=I[E];if(!isFinite(k))continue;let W={xIdx:S,yIdx:w,value:k};v.push(W),A[w*m+S]=W,k<L&&(L=k),k>T&&(T=k)}}return!isFinite(L)||!isFinite(T)?(L=0,T=1):L===T&&(T=L+1),{xLevels:u,yColumnNames:b,yLevels:h,numX:m,numY:g,rowOffset:f,cells:v,cells2D:A,colorMin:L,colorMax:T,xAxisMode:s,yAxisMode:y,xPositions:c,yPositions:C,xNumericDomain:d,yNumericDomain:_}}function od(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 rd(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),l;if(t==="date"||t==="datetime"?(l=Date.parse(s),isFinite(l)||(l=Date.parse(s.replace(" ","T")))):l=Number(s),!isFinite(l))return null;n[i]=l}return n}function wu(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 sd(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,l=new Int32Array(e.length),a=new Array(e.length),u=0;for(let c=0;c<e.length;c++){let d=n[c][o]??"",b=s.get(d);b===void 0&&(b=r.length,r.push(d),s.set(d,b)),l[c]=b,a[c]=d,d.length>u&&(u=d.length)}let f=o===t-1?[]:no(l,r,0,e.length);i.push({labels:a,runs:f,maxLabelChars:u})}return i}ot();ji();Fn();Be();de();Tt();Ht();Jt();kn();to();function Rs(e,t){return t?.skipLeafLevel&&e.length>0?e.slice(0,-1):e}var ld=80,ad=20,Ms=5,Fs=11;function fn(e,t){return e.R(0,t).py}function Mu(e,t){let n=Rs(e.levels,t),i=n.length,o=[];for(let r=0;r<i;r++){let s=n[r].maxLabelChars;if(r===i-1){let l=Math.max(ld,s*6.5+16);o.push({size:l})}else{let l=Math.max(ad,s*6.5+16);o.push({size:l})}}return o}function Ru(e,t){let n=Rs(e.levels,t);if(e.numRows===0||n.length===0)return 55;let i=Mu(e,t),o=0;for(let r of i)o+=r.size;return o}function ud(e,t){return e.labels[t]??""}function Ss(e,t,n,i,o){let r=Rs(n.levels,o);if(n.numRows===0||r.length===0)return;let{Ct:s,Fe:l,fontFamily:a}=i,{e:u}=t;e.strokeStyle=s,e.fillStyle=s,e.lineWidth=1,e.font=`${Fs}px ${a}`;let m=Mu(n,o),f=Math.max(0,Math.ceil(t.q)),c=Math.min(n.numRows-1,Math.floor(t.ee));if(c<f)return;let d=r.length,b=u.x;for(let h=d-1;h>=0;h--){let x=r[h],y=m[h],C=b,_=b-y.size;b=_,h===d-1?md(e,t,x,f,c,C,_,a,s):fd(e,t,x,f,c,_,C,a,s)}let g=n.levelLabels.filter(h=>!!h).join(" / ");g&&(e.fillStyle=l,e.font=`13px ${a}`,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 md(e,t,n,i,o,r,s,l,a){let u=t.e;e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let f=i;f<=o;f++){let c=fn(t,f);c<u.y-1||c>u.y+u.height+1||(e.moveTo(r,c),e.lineTo(r-Ms,c))}e.stroke(),e.font=`${Fs}px ${l}`,e.textAlign="right",e.textBaseline="middle";let m=r-Ms-4-s-4;for(let f=i;f<=o;f++){let c=fn(t,f);if(c<u.y-1||c>u.y+u.height+1)continue;let d=ud(n,f);if(!d)continue;let b=wt(e,d,m);b&&e.fillText(b,r-Ms-4,c)}}function fd(e,t,n,i,o,r,s,l,a){let u=t.e,m=Wn(n.runs,i,o);if(m.length===0)return;e.strokeStyle=a,e.fillStyle=a;let f=s-3;e.beginPath();for(let c of m){let d=fn(t,c.endIdx+.5),b=fn(t,c.startIdx-.5),g=Math.min(d,b),h=Math.max(d,b),x=Math.max(u.y,g),y=Math.min(u.y+u.height,h);y<=x||(e.moveTo(f,x),e.lineTo(f,y),e.moveTo(f,x),e.lineTo(f+3,x),e.moveTo(f,y),e.lineTo(f+3,y))}e.stroke(),e.font=`${Fs}px ${l}`;for(let c of m){let d=fn(t,c.endIdx+.5),b=fn(t,c.startIdx-.5),g=Math.min(d,b),h=Math.max(d,b),x=Math.max(u.y,g),y=Math.min(u.y+u.height,h);if(y<=x)continue;let C=(x+y)/2,_=r+(s-r-3)/2,v=c.label;if(!v)continue;let A=y-x-4,L=wt(e,v,Math.max(0,A));L&&(e.save(),e.translate(_,C),e.rotate(-Math.PI/2),e.textAlign="center",e.textBaseline="middle",e.fillText(L,0,0),e.restore())}}Ce();Nn();Ve();ge();Vt();Nt();Dn();Ce();be();function Is(e,t,n){if(e.dr=t,e.pr=n,e.d.length>0){for(let o=0;o<e.d.length;o++){let r=e.d[o],s=r.layout.e;if(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height)continue;let l=Su(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);Ds(e,l,o);return}Ds(e,null,-1);return}if(!e.u)return;let i=Su(e.u,e.Mt,e.Rt,e.ki,e.Ft,e.vn,e.nt?.bandWidth??1,e.gt?.bandWidth??1,t,n);Ds(e,i,-1)}function Fu(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 Su(e,t,n,i,o,r,s,l,a,u){let m=e.e;if(a<m.x||a>m.x+m.width||u<m.y||u>m.y+m.height)return null;let f=e.O,c=e.Z,d=e.q,b=e.ee,g=f+(a-m.x)/m.width*(c-f),h=b-(u-m.y)/m.height*(b-d),x=o?Fu(o,g,s):Math.round(g),y=r?Fu(r,h,l):Math.round(h);return x<0||x>=t||y<0||y>=n?null:i[y*t+x]??null}function Ds(e,t,n){let i=e.Ye;(i?.xIdx??-1)===(t?.xIdx??-1)&&(i?.yIdx??-1)===(t?.yIdx??-1)&&e.Jn===n||(e.Ye=t,e.Jn=n,e.i&&e.Lo&&e.Lo())}function Du(e,t){let n=[];for(let i of e){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Es(e){if(!e.l||!e.Ye)return;let t,n,i,o,r,s,l=null;if(e.Jn>=0){let C=e.d[e.Jn];if(!C)return;t=C.layout,n=C.pipeline.xLevels,i=C.pipeline.yLevels,o=C.pipeline.xPositions,r=C.pipeline.yPositions,s=C.pipeline.xNumericDomain,l=C.label}else{if(!e.u)return;t=e.u,n=e.Zt,i=e.qt,o=e.Ft,r=e.vn,s=e.nt}let a=e.Ye,u={px:e.dr,py:e.pr},m=[];l&&m.push([l]);let f=e.St.mode==="numeric"&&o?e.getColumnFormatter(e.h[0],"value")(o[a.xIdx]):Du(n,a.xIdx),c=Du(i,a.yIdx);f&&m.push([f]),c&&m.push([c]);let d=e.getColumnFormatter(e.L[0],"value");m.push(["Value",d(a.value)]);let b=e.v(),g=e.i?.dpr??1,h=t.R(o?o[a.xIdx]:a.xIdx,r?r[a.yIdx]:a.yIdx),x=e.St.mode==="numeric"&&o?(e.getColumnFormatter(e.h[0],"tick")??fe(s?.isDate,K(t.O,t.Z,6)))(o[a.xIdx]):f,y=[];x&&y.push({side:"bottom",px:h.px,py:h.py,text:x}),c&&y.push({side:"left",px:h.px,py:h.py,text:c}),Ye(e.l,t,b,g,y,e.t.tooltip_opacity),He(e.l,u,m,t,b,g,ie(e.t))}var Ps={skipLeafLevel:!0};function Iu(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.d.length>0){dd(e,t,o,r);return}if(e.Mt===0||e.Rt===0)return;let s=e.v(),l={levels:e.Zt,numRows:e.Mt,levelLabels:e.h.slice()},a={levels:e.qt,numRows:e.Rt,levelLabels:[]},u=e.St.mode==="numeric",m=e.Qn.mode==="numeric",f=nt(e.t,!0,80,0),c=m?55:Ru(a,Ps),d=u?24:Xe(l,Math.max(1,o-c-30-f)),b=new oe(o,r,{hasXLabel:e.h.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:d,leftExtra:c,rightExtra:f});e.u=b,e._&&e._.updateLayout(b);let g=u?e.nt.min:-.5,h=u?e.nt.max:e.Mt-.5,x=m?e.gt.min:-.5,y=m?e.gt.max:e.Rt-.5;e._&&e._.setBaseDomain(g,h,x,y);let C=e._?e._.getVisibleDomain():{xMin:g,xMax:h,yMin:x,yMax:y},_=b.buildProjectionMatrix(C.xMin,C.xMax,C.yMin,C.yMax,void 0,void 0,0,e.S,e.D),v=b.e,A=v.width/(C.xMax-C.xMin),L=v.height/(C.yMax-C.yMin),T=s.$o*.5,w=u?e.nt.bandWidth:1,M=m?e.gt.bandWidth:1,I=Math.min(w*.5,A>0?T/A:0),D=Math.min(M*.5,L>0?T/L:0);if(e.Q){let S=ce(e.Q,b,t.dpr)}Eu(e,t),Pu(e,t),e.se=Sn(t,e.se,s.N),rt(n,b,t.dpr,()=>{n.useProgram(e.o);let S=e.E;n.uniformMatrix4fv(S.u_projection,!1,_),n.uniform2f(S.u_cell_inset,I,D),n.uniform2f(S.u_cell_size,w,M),ze(t,e.se.texture,S.u_gradient_lut,0),Bu(e,n,t,0,e.br)}),e._e(()=>nr(e))}function Eu(e,t){if(e.o)return;let n=t.gl,i=j(t,"heatmap",bi,gi,["u_projection","u_cell_inset","u_cell_size","u_gradient_lut"],["a_corner","a_cell","a_color_t"]);e.o=i.program,e.E=i;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.H=o}function Pu(e,t){let n=e.ot.length;if(e.br=n,n===0)return;let i=new Float32Array(n*2),o=new Float32Array(n);if(e.d.length>0){let r=0;for(let s of e.d){let l=s.pipeline.xPositions,a=s.pipeline.yPositions,u=s.xOrigin,m=s.yOrigin;for(let f of s.pipeline.cells)i[r*2]=l?l[f.xIdx]-u:f.xIdx,i[r*2+1]=a?a[f.yIdx]-m:f.yIdx,o[r]=Ct(f.value,e.p,e.c),r++}}else{let r=e.Ft,s=e.vn,l=e.S,a=e.D;for(let u=0;u<n;u++){let m=e.ot[u];i[u*2]=r?r[m.xIdx]-l:m.xIdx,i[u*2+1]=s?s[m.yIdx]-a:m.yIdx,o[u]=Ct(m.value,e.p,e.c)}}t.A.ensureCapacity(n),t.A.upload("heatmap_cell",i,0,2),t.A.upload("heatmap_t",o,0,1)}function Bu(e,t,n,i,o){if(o===0)return;let r=e.E,s=Q(n),{setDivisor:l}=s,a=Float32Array.BYTES_PER_ELEMENT;t.bindBuffer(t.ARRAY_BUFFER,e.H),t.enableVertexAttribArray(r.a_corner),t.vertexAttribPointer(r.a_corner,2,t.FLOAT,!1,0,0),l(r.a_corner,0);let u=n.A.peek("heatmap_cell"),m=n.A.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*a),l(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*a),l(r.a_color_t,1),s.drawArraysInstanced(t.TRIANGLE_STRIP,0,4,o),l(r.a_cell,0),l(r.a_color_t,0))}function nr(e){cd(e),e.presentOverlay()}function cd(e){if(!e.l)return;if(e.d.length>0){pd(e);return}if(!e.u)return;let t=e.u,n=e.v(),i=e.i?.dpr??1,o=ce(e.l,t,i);if(!o)return;o.strokeStyle=n.Rn,o.lineWidth=1,o.beginPath(),o.moveTo(t.e.x,t.e.y),o.lineTo(t.e.x,t.e.y+t.e.height),o.lineTo(t.e.x+t.e.width,t.e.y+t.e.height),o.stroke();let r={levels:e.Zt,numRows:e.Mt,levelLabels:e.h.slice()},s={levels:e.qt,numRows:e.Rt,levelLabels:[]},l=e.h[0],a=e.h[1]??e.B[0];if(e.St.mode==="numeric"&&e.nt){let m=K(t.O,t.Z,6);$o(o,t,e.nt,m,n,e.getColumnFormatter(l,"tick"))}else xe(o,t,r,n);if(e.Qn.mode==="numeric"&&e.gt){let m=K(t.q,t.ee,6);jo(o,t,e.gt,m,n,e.getColumnFormatter(a,"tick"))}else Ss(o,t,s,n,Ps);let u=se(e.t,0);if(u==="none")e.F.clearPainted();else{let m={min:e.p,max:e.c,label:e.Kt},f=e.getColumnFormatter(e.L[0],"value"),c={mode:u==="floating"?"floating":"sidebar",legend:e.F,title:e.Kt,opacity:e.t.legend_opacity};u==="floating"?$e(e.l,e.F.floatingBox(e.t,t.cssWidth,t.cssHeight,Rt(e.l,n,m,f,e.Kt)),m,n.N,n,f,c):Qt(e.l,t,m,n.N,n,f,c)}e.Ye&&Es(e)}function dd(e,t,n,i){let o=t.gl,r=e.v(),{effectiveSharedX:s,effectiveSharedY:l}=e.computeEffectiveFacetFlags(),a=Ie(e.d.map(m=>m.label),{cssWidth:n,cssHeight:i,xAxis:s?"outer":"cell",yAxis:l?"outer":"cell",hasLegend:se(e.t,0)==="sidebar",legendWidth:we(e.t,96),hasXLabel:e.h.length>0,hasYLabel:!1,gap:8});e.b=a;for(let m=0;m<e.d.length;m++){let f=a.cells[m];f&&(e.d[m].layout=f.layout)}e.syncFacetZoomLayouts(a.cells),Eu(e,t),Pu(e,t),e.se=Sn(t,e.se,r.N),o.useProgram(e.o);let u=e.E;ze(t,e.se.texture,u.u_gradient_lut,0),At(o);for(let m=0;m<e.d.length;m++){let f=e.d[m];if(f.instanceCount===0)continue;let{numX:c,numY:d}=f.pipeline;if(c===0||d===0)continue;let b=f.layout,g=f.pipeline.xAxisMode.mode==="numeric",h=f.pipeline.yAxisMode.mode==="numeric",x=g?f.pipeline.xNumericDomain.min:-.5,y=g?f.pipeline.xNumericDomain.max:c-.5,C=h?f.pipeline.yNumericDomain.min:-.5,_=h?f.pipeline.yNumericDomain.max:d-.5,v=e.getZoomControllerForFacet(m);v&&v.setBaseDomain(x,y,C,_);let A=v?v.getVisibleDomain():{xMin:x,xMax:y,yMin:C,yMax:_},L=b.buildProjectionMatrix(A.xMin,A.xMax,A.yMin,A.yMax,void 0,void 0,0,f.xOrigin,f.yOrigin),T=b.e,w=T.width/(A.xMax-A.xMin),M=T.height/(A.yMax-A.yMin),I=r.$o*.5,D=g?f.pipeline.xNumericDomain.bandWidth:1,S=h?f.pipeline.yNumericDomain.bandWidth:1,E=Math.min(D*.5,w>0?I/w:0),k=Math.min(S*.5,M>0?I/M:0);Lt(o,b,t.dpr,()=>{o.uniformMatrix4fv(u.u_projection,!1,L),o.uniform2f(u.u_cell_inset,E,k),o.uniform2f(u.u_cell_size,D,S),Bu(e,o,t,f.instanceStart,f.instanceCount)})}e._e(()=>nr(e))}function pd(e){if(!e.l||!e.b)return;let t=e.v(),n=e.i?.dpr??1,i=ce(e.l,e.d[0].layout,n);if(!i)return;let o=e.bi,r=e.gi,s=e.b;for(let f=0;f<e.d.length;f++){let c=e.d[f],d=s.cells[f],b=c.layout,g=b.e;i.strokeStyle=t.Rn,i.lineWidth=1,i.beginPath(),i.moveTo(g.x,g.y),i.lineTo(g.x,g.y+g.height),i.lineTo(g.x+g.width,g.y+g.height),i.stroke();let h={levels:c.pipeline.xLevels,numRows:c.pipeline.numX,levelLabels:e.h.slice()},x={levels:c.pipeline.yLevels,numRows:c.pipeline.numY,levelLabels:[]},y=e.h[0],C=e.h[1]??e.B[0];if(!o||d.isBottomEdge)if(c.pipeline.xAxisMode.mode==="numeric"&&c.pipeline.xNumericDomain){let _=K(b.O,b.Z,6);$o(i,b,c.pipeline.xNumericDomain,_,t,e.getColumnFormatter(y,"tick"))}else xe(i,b,h,t);if(!r||d.isLeftEdge)if(c.pipeline.yAxisMode.mode==="numeric"&&c.pipeline.yNumericDomain){let _=K(b.q,b.ee,6);jo(i,b,c.pipeline.yNumericDomain,_,t,e.getColumnFormatter(C,"tick"))}else Ss(i,b,x,t,Ps)}for(let f=0;f<s.cells.length;f++){let c=s.cells[f],d=e.d[f];!d||!c.titleRect||Ut(e.l,d.label,c.titleRect,t,n)}let l=se(e.t,0),a=l==="floating",u=e.d[0].layout,m=a?e.F.floatingBox(e.t,u.cssWidth,u.cssHeight,Rt(e.l,t,{min:e.p,max:e.c},e.getColumnFormatter(e.L[0],"value"),e.Kt)):s.legendRect;l!=="none"&&m?$e(e.l,a?m:{x:m.x,y:m.y+20,width:m.width,height:Math.max(1,m.height-20)},{min:e.p,max:e.c,label:""},t.N,t,e.getColumnFormatter(e.L[0],"value"),{mode:a?"floating":"sidebar",legend:e.F,title:e.Kt,sidebarGutter:a?void 0:s.legendRect?.width,opacity:e.t.legend_opacity}):e.F.clearPainted(),e.Ye&&Es(e)}var ir=class extends De{constructor(){super(...arguments);p(this,"o",null);p(this,"E",null);p(this,"H",null);p(this,"se",null);p(this,"Zt",[]);p(this,"qt",[]);p(this,"To",[]);p(this,"Mt",0);p(this,"Rt",0);p(this,"bt",0);p(this,"St",{mode:"category"});p(this,"Qn",{mode:"category"});p(this,"Ft",null);p(this,"vn",null);p(this,"nt",null);p(this,"gt",null);p(this,"S",0);p(this,"D",0);p(this,"ot",[]);p(this,"ki",[]);p(this,"br",0);p(this,"p",0);p(this,"c",1);p(this,"Kt","");p(this,"Ye",null);p(this,"u",null);p(this,"dr",0);p(this,"pr",0);p(this,"d",[]);p(this,"b",null);p(this,"Jn",-1);p(this,"Lo",()=>nr(this))}colorScaleColumn(){return this.L[0]||null}tooltipCallbacks(){return{onHover:(n,i)=>Is(this,n,i),onLeave:()=>{this.Ye&&(this.Ye=null,this.Lo())},onPin:(n,i)=>{Is(this,n,i),this.Ye&&this.Ir(this.Ye.xIdx,this.Ye.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async Ir(n,i){let o=this.St.mode==="numeric"&&this.Ft?[this.Ft[n]??null]:this.Zt.map(l=>l.labels[n]??null),r=this.qt.slice(0,this.B.length).map(l=>l.labels[i]??null),s=this.L[0]??"";await this.emitClickAndSelect({rowIdx:n+this.bt,columnName:s,groupByValues:o,splitByValues:r})}async uploadAndRender(n,i,o,r){if(this.i=n,o!==0)return;let s=this.L.filter(l=>!!l);if(s.length>1){let l=wu(i,s),a=[],u=[],m=1/0,f=-1/0;for(let c of l){let d=ws({columns:c.columns,numRows:r,groupBy:this.h,splitBy:this.B,groupByTypes:this.vt}),b=u.length;for(let g of d.cells)u.push({xIdx:g.xIdx,yIdx:g.yIdx,value:g.value});a.push({label:c.label,pipeline:d,layout:new oe(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:b,instanceCount:d.cells.length,xOrigin:d.xNumericDomain?.min??0,yOrigin:d.yNumericDomain?.min??0}),isFinite(d.colorMin)&&d.colorMin<m&&(m=d.colorMin),isFinite(d.colorMax)&&d.colorMax>f&&(f=d.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.Zt=[],this.qt=[],this.To=[],this.Mt=0,this.Rt=0,this.bt=0,this.ki=[],this.u=null,this.St={mode:"category"},this.Qn={mode:"category"},this.Ft=null,this.vn=null,this.nt=null,this.gt=null,this.S=0,this.D=0,this.d=a,this.ot=u,this.p=m,this.c=f,this.Kt=s.join(", ")}else{let l=ws({columns:i,numRows:r,groupBy:this.h,splitBy:this.B,groupByTypes:this.vt});this.d=[],this.b=null,this.Zt=l.xLevels,this.qt=l.yLevels,this.To=l.yColumnNames,this.Mt=l.numX,this.Rt=l.numY,this.bt=l.rowOffset,this.ot=l.cells,this.ki=l.cells2D,this.p=l.colorMin,this.c=l.colorMax,this.Kt=s[0]??"Color",this.St=l.xAxisMode,this.Qn=l.yAxisMode,this.Ft=l.xPositions,this.vn=l.yPositions,this.nt=l.xNumericDomain,this.gt=l.yNumericDomain,this.S=l.xNumericDomain?.min??0,this.D=l.yNumericDomain?.min??0}await this.requestRender(n)}kt(n){this.i=n;let i=this.Mt>0&&this.Rt>0,o=this.d.length>0;!i&&!o||Iu(this,n)}destroyInternal(){this.H&&this.i&&this.i.gl.deleteBuffer(this.H),this.o=null,this.E=null,this.H=null,this.Zt=[],this.qt=[],this.To=[],this.ot=[],this.ki=[],this.Ye=null,this.d=[],this.b=null,this.Jn=-1,this.St={mode:"category"},this.Qn={mode:"category"},this.Ft=null,this.vn=null,this.nt=null,this.gt=null}};Tn();function ei(){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 bd(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 Gu={splitPrefixes:[],rowPaths:[],numCategories:0,rowOffset:0,axisMode:{mode:"category"},numericCategoryDomain:null,categoryPositions:null,series:[],yDomain:{min:0,max:1}};function Wu(e){let{columns:t,numRows:n,columnSlots:i,groupBy:o,splitBy:r,groupByTypes:s,bandInnerFrac:l,barInnerPad:a,scratchCandles:u}=e,m=sn(o,s),f=i[0]||"";if(!f)return{...Gu,candles:ei()};let c=i[1]||"",d=i[2]||"",b=i[3]||"",g=[];if(r.length>0){let U=[f];c&&U.push(c),d&&U.push(d),b&&U.push(b);for(let Y of it(t,[f],U))Y.colNames.has(f)&&g.push(Y.prefix);g.length===0&&g.push("")}else g.push("");let h=o.map(U=>s[U]??"string"),{rowPaths:x,numCategories:y,rowOffset:C}=ln(t,n,o.length,h,m);if(y===0)return{...Gu,axisMode:m,splitPrefixes:g,rowPaths:x,rowOffset:C,candles:ei()};let _=g.length,v=[];for(let U=0;U<_;U++){let Y=g[U];v.push({seriesId:U,splitIdx:U,splitKey:Y,label:Y===""?f:Y})}let A=null,L=null,T=1;if(m.mode==="numeric"&&y>0){let U=t.get("__ROW_PATH_0__"),Y=Dt(U?.values,y,C,o[0]??"",m.numericType==="date"||m.numericType==="datetime");Y&&(A=Y.categoryPositions,L=Y.numericCategoryDomain,T=Y.numericCategoryDomain.bandWidth)}let w=No(_,l,a),M=w.slotWidth*T,I=w.halfWidth*T,D=(_-1)/2,S=[];for(let U=0;U<_;U++){let Y=g[U],q=pt=>Y===""?pt:`${Y}|${pt}`,me=t.get(q(f));if(!me?.values){S.push({openCol:null,closeCol:null,highCol:null,lowCol:null,openValid:null,closeValid:null,highValid:null,lowValid:null});continue}let Ge=c?t.get(q(c)):null,Re=d?t.get(q(d)):null,Fe=b?t.get(q(b)):null;S.push({openCol:me.values,closeCol:Ge?.values??null,highCol:Re?.values??null,lowCol:Fe?.values??null,openValid:me.valid??null,closeValid:Ge?.valid??null,highValid:Re?.valid??null,lowValid:Fe?.valid??null})}let E=y*_,k=bd(u??null,E),W=0,V=1/0,N=-1/0,H=y;for(let U=0;U<_;U++){let Y=S[U],q=Y.openCol;if(!q)continue;let me=Y.closeCol,Ge=Y.highCol,Re=Y.lowCol,Fe=Y.openValid,pt=Y.closeValid,bn=Y.highValid,gn=Y.lowValid,hn=(U-D)*M;for(let Ae=0;Ae<H;Ae++){let ae=Ae+C;if(Fe&&!(Fe[ae>>3]>>(ae&7)&1))continue;let ee=q[ae];if(!isFinite(ee))continue;let re;if(me&&(!pt||(pt[ae>>3]>>(ae&7)&1)!==0)){let J=me[ae];re=isFinite(J)?J:ee}else{let J=Ae<H-1?Ae+1+C:ae;if(!Fe||(Fe[J>>3]>>(J&7)&1)!==0){let Pt=q[J];re=isFinite(Pt)?Pt:ee}else re=ee}let We;if(Ge&&(!bn||(bn[ae>>3]>>(ae&7)&1)!==0)){let J=Ge[ae];We=isFinite(J)?J:ee>re?ee:re}else We=ee>re?ee:re;let ke;if(Re&&(!gn||(gn[ae>>3]>>(ae&7)&1)!==0)){let J=Re[ae];ke=isFinite(J)?J:ee<re?ee:re}else ke=ee<re?ee:re;let dr=(A?A[Ae]:Ae)+hn,Ne=re>=ee?1:0;k.catIdx[W]=Ae,k.splitIdx[W]=U,k.seriesId[W]=U,k.xCenter[W]=dr,k.halfWidth[W]=I,k.open[W]=ee,k.close[W]=re,k.high[W]=We,k.low[W]=ke,k.isUp[W]=Ne,W++,ke<V&&(V=ke),We>N&&(N=We)}}if(k.count=W,!isFinite(V)||!isFinite(N))V=0,N=1;else if(V===N){let U=Math.max(Math.abs(V),1)*.05;V-=U,N+=U}return{splitPrefixes:g,rowPaths:x,numCategories:y,rowOffset:C,axisMode:m,numericCategoryDomain:L,categoryPositions:A,series:v,candles:k,yDomain:{min:V,max:N}}}ot();ge();Fn();Nt();be();Dn();Ce();Jt();be();var gd=3;function ku(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 Bs(e,t,n){if(e.wo!==-1)return;let i=e.u;if(!i)return;let o=e.Te;if(o.count===0){e.we!==-1&&(e.we=-1,dt(e));return}let r=i.e,s=i.O,l=i.Z,a=i.q,u=i.ee;if(t<r.x||t>r.x+r.width||n<r.y||n>r.y+r.height){e.we!==-1&&(e.we=-1,dt(e));return}let m=s+(t-r.x)/r.width*(l-s),f=u-(n-r.y)/r.height*(u-a),c=r.width/(l-s),d=gd/c,b=o.xCenter,g=o.halfWidth,h=o.open,x=o.close,y=o.high,C=o.low,_=o.count>0?g[0]:0,v=Math.max(_,d),A=ku(b,o.count,m-v),L=ku(b,o.count,m+v+1e-12),T=-1;for(let w=L-1;w>=A;w--){let M=b[w],I=g[w],D=m>=M-I&&m<=M+I,S=Math.abs(m-M)<=d;if(!D&&!S)continue;let E=h[w],k=x[w],W=E<k?E:k,V=E<k?k:E,N=D&&f>=W&&f<=V,H=f>=C[w]&&f<=y[w];if(N||H){T=w;break}}T!==e.we&&(e.we=T,dt(e))}function Nu(e,t){e.w.dismiss(),e.wo=t;let n=e.Te;if(t<0||t>=n.count||!e.u)return;let i=Gs(e,t);if(i.length===0)return;let o=n.xCenter[t],r=(n.high[t]+n.low[t])/2,s=e.u.R(o,r),l=e.u.cssWidth,a=e.u.cssHeight;e.w.pin(i,s,{cssWidth:l,cssHeight:a},ie(e.t)),e.we=-1,dt(e)}function Gs(e,t){let n=[],i=e.Te;if(t<0||t>=i.count)return n;let o=i.catIdx[t],r=i.splitIdx[t],s=i.open[t],l=i.close[t],a=i.high[t],u=i.low[t],m=Ws(e,o);if(m!==""&&n.push([m]),r>=0&&e.ge.length>1){let g=e.ge[r];g&&n.push([g])}let f=e.getColumnFormatter(e.L[0],"value"),c=e.getColumnFormatter(e.L[1],"value"),d=e.getColumnFormatter(e.L[2],"value"),b=e.getColumnFormatter(e.L[3],"value");return n.push(["Open",f(s)]),n.push(["Close",c(l)]),n.push(["High",d(a)]),n.push(["Low",b(u)]),n}function Ws(e,t){if(e.Le==="numeric"&&e.I&&e.V){let n=e.V[t],i=e.h[0];return e.getColumnFormatter(i,"value")(n)}if(e.Ie.length>0){let n=[];for(let i of e.Ie){let o=i.labels[t]??"";o&&n.push(o)}return n.join(" \\u203A ")}return`Row ${t+e.bt}`}function Ou(e,t,n,i,o){let r=1/0,s=-1/0,l={cat:0,lo:0,hi:0,skip:!1};for(let u=0;u<e.length;u++)l.skip=!1,i(e[u],l),!l.skip&&(l.cat<t||l.cat>n||(l.lo<r&&(r=l.lo),l.hi>s&&(s=l.hi)));let a=isFinite(r)&&isFinite(s);if(a&&r===s){let u=Math.abs(r)||1;r-=u,s+=u}return o.min=r,o.max=s,o.hasFit=a,o}function ks(e){let n=e.v().N;if(e.Ni===n)return;let i=Se(n,1),o=Se(n,0);e.Oi=[i[0],i[1],i[2]],e.Ui=[o[0],o[1],o[2]],e.Ni=n}function Uu(e){e.Y.bodyWick.invalidateBuffers(e),e.Y.ohlc.invalidateBuffers(e)}function Hu(e,t){e.Y.bodyWick.rebuildBuffers(e,t),e.Y.ohlc.rebuildBuffers(e,t)}function Vu(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.v();ks(e);let l=e.Le==="numeric",a=l?e.I.min:-.5,u=l?e.I.max:e.ie-.5;e._&&e._.setBaseDomain(a,u,e.ei.min,e.ei.max);let m=e._?e._.getVisibleDomain():{xMin:a,xMax:u,yMin:e.ei.min,yMax:e.ei.max};if(e.Ci&&e._&&!e._.isXDefault()){let C=yd(e,m.xMin,m.xMax);C.hasFit&&(m.yMin=C.min,m.yMax=C.max)}let f=e.h.length>0,c={levels:e.Ie,numRows:e.ie,levelLabels:e.h.slice()},d;if(l)d=new oe(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,o-71-16),A=Xe(c,v);d=new oe(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.u=d,e._&&e._.updateLayout(d);let b=d.buildProjectionMatrix(m.xMin,m.xMax,m.yMin,m.yMax,"y",void 0,void 0,e.ce,0),g=K(m.yMin,m.yMax,6),h=e.L[0]||"",x=c,y={min:m.yMin,max:m.yMax,label:h};e.Q&&qo(e.Q,d,g,s,t.dpr),rt(n,d,t.dpr,()=>{e.xi==="ohlc"?e.Y.ohlc.draw(e,n,t,b):e.Y.bodyWick.draw(e,n,t,b)}),e.le=x,e.te=y,e.ae=g,e.Ge=l?K(m.xMin,m.xMax,6):null,e._e(()=>dt(e))}function dt(e){hd(e),e.presentOverlay()}function hd(e){if(!e.l||!e.u||!e.te||!e.ae)return;let t=e.v(),n;if(e.Le==="numeric"&&e.I&&e.Ge)n={mode:"numeric",domain:{min:e.I.min,max:e.I.max,isDate:e.I.isDate,label:e.I.label},ticks:e.Ge};else if(e.le)n={mode:"category",domain:e.le};else return;let i=e.L[0]??e.L[1]??e.L[2]??e.L[3],o=e.h[0];Zo(e.l,n,{mode:"numeric",domain:e.te,ticks:e.ae},e.u,t,e.i?.dpr??1,void 0,!1,{value:e.getColumnFormatter(i,"tick"),category:e.getColumnFormatter(o,"tick")}),e.we>=0&&e.we<e.Te.count&&xd(e)}function xd(e){if(!e.l||!e.u)return;let t=e.we,n=e.Te;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.R(o,r),l=Gs(e,t),a=e.v(),u=e.i?.dpr??1,m=e.L[1],f=n.close[t];(m==null||!Number.isFinite(f))&&(m=e.L[0]??e.L[2]??e.L[3],f=n.open[t]);let c=i.R(o,f),d=[],b;if(e.Le==="numeric"&&e.I&&e.V?b=(e.getColumnFormatter(e.h[0],"tick")??fe(e.I.isDate,e.Ge))(e.V[n.catIdx[t]]):b=Ws(e,n.catIdx[t]),b!==""&&d.push({side:"bottom",px:c.px,py:c.py,text:b}),Number.isFinite(f)){let g=e.getColumnFormatter(m,"tick")??fe(e.te?.isDate,e.ae);d.push({side:"left",px:c.px,py:c.py,text:g(f)})}Ye(e.l,i,a,u,d,e.t.tooltip_opacity),He(e.l,s,l,i,a,u,{...ie(e.t),crosshair:!1,highlightRadius:0})}function yd(e,t,n){let i=e.wt;if(i&&i.xMin===t&&i.xMax===n)return i;let o=i??_d();o.xMin=t,o.xMax=n;let r=e.Te,s=1/0,l=-1/0,a=!1,u=r.xCenter,m=r.low,f=r.high;for(let c=0;c<r.count;c++){let d=u[c];d<t||d>n||(m[c]<s&&(s=m[c]),f[c]>l&&(l=f[c]),a=!0)}return o.min=a?s:0,o.max=a?l:1,o.hasFit=a,e.wt=o,o}function _d(){return{xMin:0,xMax:0,min:0,max:1,hasFit:!1}}Be();de();var or=class{constructor(){p(this,"o",null);p(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,i=fo(n),r={...j(t,"candlestick-body",di,pi,["u_projection"],["a_corner","a_x_center","a_half_width","a_y0","a_y1","a_color"]),quadBuffer:i,instanceBuffer:n.createBuffer()},s=at(n),a={...j(t,"line-uniform",Ke,Je,["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:a},this.o}invalidateBuffers(t){let n=this.r;if(!n||!t.i){this.r=null;return}let i=t.i.gl;i.deleteBuffer(n.upWickBuffer),i.deleteBuffer(n.downWickBuffer),this.r=null}rebuildBuffers(t,n){let i=t.Te,o=this.ensureProgram(n),r=n.gl,s=t.ce;if(i.count===0){let M=r.createBuffer(),I=r.createBuffer();this.r={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:M,downWickBuffer:I};return}let l=new Float32Array(i.count*7),a=0,u=0,m=i.xCenter,f=i.halfWidth,c=i.open,d=i.close,b=i.isUp,g=t.Oi,h=t.Ui;for(let M=0;M<i.count;M++){let I=c[M],D=d[M],S=I<D?I:D,E=I<D?D:I,k=b[M]!==0,W=k?g:h,V=M*7;l[V+0]=m[M]-s,l[V+1]=f[M]*.7,l[V+2]=S,l[V+3]=E,l[V+4]=W[0],l[V+5]=W[1],l[V+6]=W[2],k?a++:u++}r.bindBuffer(r.ARRAY_BUFFER,o.body.instanceBuffer),r.bufferData(r.ARRAY_BUFFER,l,r.STATIC_DRAW);let x=new Float32Array(a*4),y=new Float32Array(u*4),C=0,_=0,v=i.low,A=i.high;for(let M=0;M<i.count;M++){let I=m[M]-s,D=v[M],S=A[M];b[M]!==0?(x[C+0]=I,x[C+1]=D,x[C+2]=I,x[C+3]=S,C+=4):(y[_+0]=I,y[_+1]=D,y[_+2]=I,y[_+3]=S,_+=4)}let L=this.r,T=L?.upWickBuffer??r.createBuffer(),w=L?.downWickBuffer??r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,T),r.bufferData(r.ARRAY_BUFFER,x,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,w),r.bufferData(r.ARRAY_BUFFER,y,r.STATIC_DRAW),this.r={bodyCount:i.count,upWickCount:a,downWickCount:u,upWickBuffer:T,downWickBuffer:w}}draw(t,n,i,o){let r=this.r;if(!r||r.bodyCount===0)return;let s=this.ensureProgram(i);Cd(n,i,s.body,r.bodyCount,o),vd(t,n,i,s.wick,r,o)}destroy(t){let n=t.i?.gl;if(n){this.invalidateBuffers(t);let i=this.o;i&&(n.deleteBuffer(i.body.quadBuffer),n.deleteBuffer(i.body.instanceBuffer),n.deleteBuffer(i.wick.cornerBuffer),n.deleteBuffer(i.wick.segmentBuffer))}this.o=null,this.r=null}};function Cd(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=Q(t),{setDivisor:l}=s;e.bindBuffer(e.ARRAY_BUFFER,n.quadBuffer),e.enableVertexAttribArray(n.a_corner),e.vertexAttribPointer(n.a_corner,2,e.FLOAT,!1,0,0),l(n.a_corner,0),e.bindBuffer(e.ARRAY_BUFFER,n.instanceBuffer);let a=Float32Array.BYTES_PER_ELEMENT,u=(m,f,c)=>{e.enableVertexAttribArray(m),e.vertexAttribPointer(m,f,e.FLOAT,!1,r,c),l(m,1)};u(n.a_x_center,1,0),u(n.a_half_width,1,1*a),u(n.a_y0,1,2*a),u(n.a_y1,1,3*a),u(n.a_color,3,4*a),s.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,i),l(n.a_x_center,0),l(n.a_half_width,0),l(n.a_y0,0),l(n.a_y1,0),l(n.a_color,0)}function vd(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.t.wick_width_px*s),t.disableVertexAttribArray(i.a_real_start),t.disableVertexAttribArray(i.a_real_end),t.vertexAttrib1f(i.a_real_start,1),t.vertexAttrib1f(i.a_real_end,1),t.uniform1f(i.u_interp_alpha,1);let l=Q(n),{setDivisor:a}=l;t.bindBuffer(t.ARRAY_BUFFER,i.cornerBuffer),t.enableVertexAttribArray(i.a_corner),t.vertexAttribPointer(i.a_corner,1,t.FLOAT,!1,0,0),a(i.a_corner,0),zu(t,l,i,o.upWickBuffer,o.upWickCount,e.Oi),zu(t,l,i,o.downWickBuffer,o.downWickCount,e.Ui),a(i.a_start,0),a(i.a_end,0)}function zu(e,t,n,i,o,r){if(o===0)return;let s=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,2*s,0),l(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,2*s,s),l(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}Be();de();var rr=class{constructor(){p(this,"o",null);p(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,i=at(n),o=j(t,"line-uniform",Ke,Je,["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={...o,cornerBuffer:i,segmentBuffer:n.createBuffer()},this.o}invalidateBuffers(t){let n=this.r;if(!n||!t.i){this.r=null;return}let i=t.i.gl;i.deleteBuffer(n.upBuffer),i.deleteBuffer(n.downBuffer),this.r=null}rebuildBuffers(t,n){if(t.xi!=="ohlc")return;let i=t.Te,o=n.gl;this.ensureProgram(n);let r=t.ce,s=i.xCenter,l=i.halfWidth,a=i.open,u=i.close,m=i.high,f=i.low,c=i.isUp,d=0,b=0;for(let A=0;A<i.count;A++)c[A]!==0?d++:b++;let g=new Float32Array(d*3*4),h=new Float32Array(b*3*4),x=0,y=0;for(let A=0;A<i.count;A++){let L=s[A]-r,T=a[A],w=u[A],M=f[A],I=m[A],D=l[A],S=c[A]!==0?g:h,E=c[A]!==0?x:y;S[E++]=L,S[E++]=M,S[E++]=L,S[E++]=I,S[E++]=L-D,S[E++]=T,S[E++]=L,S[E++]=T,S[E++]=L,S[E++]=w,S[E++]=L+D,S[E++]=w,c[A]!==0?x=E:y=E}let C=this.r,_=C?.upBuffer??o.createBuffer(),v=C?.downBuffer??o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,_),o.bufferData(o.ARRAY_BUFFER,g,o.STATIC_DRAW),o.bindBuffer(o.ARRAY_BUFFER,v),o.bufferData(o.ARRAY_BUFFER,h,o.STATIC_DRAW),this.r={upBuffer:_,downBuffer:v,upInstanceCount:d*3,downInstanceCount:b*3}}draw(t,n,i,o){let r=this.r;if(!r||r.upInstanceCount===0&&r.downInstanceCount===0)return;let s=this.ensureProgram(i),l=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.t.ohlc_line_width_px*l),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 a=Q(i),{setDivisor:u}=a;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),Yu(n,a,s,r.upBuffer,r.upInstanceCount,t.Oi),Yu(n,a,s,r.downBuffer,r.downInstanceCount,t.Ui),u(s.a_start,0),u(s.a_end,0)}destroy(t){let n=t.i?.gl;if(n){this.invalidateBuffers(t);let i=this.o;i&&(n.deleteBuffer(i.cornerBuffer),n.deleteBuffer(i.segmentBuffer))}this.o=null,this.r=null}};function Yu(e,t,n,i,o,r){if(o===0)return;let s=4*Float32Array.BYTES_PER_ELEMENT,l=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,s,0),a(n.a_start,1),e.enableVertexAttribArray(n.a_end),e.vertexAttribPointer(n.a_end,2,e.FLOAT,!1,s,l),a(n.a_end,1),t.drawArraysInstanced(e.TRIANGLE_STRIP,0,4,o)}var ti=class extends un{constructor(){super(...arguments);p(this,"E",null);p(this,"ge",[]);p(this,"f",[]);p(this,"Te",ei());p(this,"ei",{min:0,max:1});p(this,"Hi",null);p(this,"Le","category");p(this,"I",null);p(this,"V",null);p(this,"Ge",null);p(this,"ce",0);p(this,"Oi",[0,.8,.4]);p(this,"Ui",[.8,.2,.2]);p(this,"Ni",null);p(this,"we",-1);p(this,"wo",-1);p(this,"Y",{bodyWick:new or,ohlc:new rr});p(this,"Ci",!0);p(this,"wt",null)}tooltipCallbacks(){return{onHover:(n,i)=>Bs(this,n,i),onLeave:()=>{this.we!==-1&&(this.we=-1,dt(this))},onPin:(n,i)=>{if(Bs(this,n,i),this.we>=0){let o=this.we;Nu(this,o),this.Er(o)}},onUnpin:()=>{this.emitUnselect()}}}async Er(n){if(n<0||n>=this.Te.count)return;let i=this.Te.catIdx[n],o=this.Te.splitIdx[n],r=this.Le==="numeric"&&this.V?[this.V[i]??null]:this.Ie.map(u=>u.labels[i]??null),s=this.ge[o]??"",l=this.B.length>0&&s!==""?s.split("|"):[],a=this.L[1]||this.L.find(u=>!!u)||"";await this.emitClickAndSelect({rowIdx:i+this.bt,columnName:a,groupByValues:r,splitByValues:l})}invalidateTheme(){super.invalidateTheme(),this.Ni=null}async uploadAndRender(n,i,o,r){if(this.i=n,o!==0)return;let s=Wu({columns:i,numRows:r,columnSlots:this.L,groupBy:this.h,splitBy:this.B,groupByTypes:this.vt,bandInnerFrac:this.t.band_inner_frac,barInnerPad:this.t.bar_inner_pad,scratchCandles:this.Te});this.t.domain_mode==="expand"?this.Hi=Qn(this.Hi,s.yDomain):this.Hi=null,this.Ie=s.rowPaths,this.ie=s.numCategories,this.bt=s.rowOffset,this.ge=s.splitPrefixes,this.f=s.series,this.Te=s.candles,this.ei=s.yDomain,this.Le=s.axisMode.mode,this.I=s.numericCategoryDomain,this.V=s.categoryPositions,this.ce=s.numericCategoryDomain?.min??0,this.wt=null,ks(this),Uu(this),Hu(this,n),await this.requestRender(n)}kt(n){this.i=n,Vu(this,n)}resetExpandedDomain(){this.Hi=null}destroyInternal(){if(this.i){let n=this.i.gl;this.H&&n.deleteBuffer(this.H),this.Y.bodyWick.destroy(this),this.Y.ohlc.destroy(this)}this.o=null,this.E=null,this.H=null,this.Te=ei(),this.f=[],this.Ie=[],this.ie=0,this.Ni=null}};var Zu={scatter:async()=>co,line:async()=>po,density:async()=>bo,treemap:async()=>Po,sunburst:async()=>ko,heatmap:async()=>ir,"y-bar":async()=>ct,"y-line":async()=>ct,"y-scatter":async()=>ct,"y-area":async()=>ct,"x-bar":async()=>tr,candlestick:async()=>ti,ohlc:async()=>ti,"map-scatter":async()=>(await Promise.resolve().then(()=>(mr(),ur))).MapScatterChart,"map-line":async()=>(await Promise.resolve().then(()=>(mr(),ur))).MapLineChart,"map-density":async()=>(await Promise.resolve().then(()=>(mr(),ur))).MapDensityChart};async function qu(e,t,n){let i=new Map;await e.with_typed_arrays(n??{},async(o,r,s,l)=>{for(let u=0;u<o.length;u++){let m=o[u],f=r[u],c=s[u]??void 0,d=l[u];d!==null?i.set(m,{type:"string",indices:f,dictionary:d,valid:c}):f instanceof Float32Array?i.set(m,{type:"float32",values:f,valid:c}):f instanceof Int32Array?i.set(m,{type:"int32",values:f,valid:c}):f instanceof Float64Array?i.set(m,{type:"float64",values:f,valid:c}):i.set(m,{type:"float32",values:new Float32Array(f),valid:c})}let a=0;if(i.size>0){a=1/0;for(let u of i.values()){let m=u.indices?.length??u.values?.length??0;m<a&&(a=m)}}await t(i,a)})}Ei();var Ku=new Map;async function Ju(e){let t=[e.family,e.src,e.weight??"",e.style??""].join("|"),n=Ku.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)}})(),Ku.set(t,n),await n}function pn(e,t){switch(t.kind){case"setViewByName":e.setViewByName(t.name);break;case"setColumnsConfig":e.chartImpl.setColumnsConfig?.(t.cfg);break;case"setPluginConfig":e.setPluginConfig(t.cfg,t.tileSource),e.redraw();break;case"setBufferMaxCapacity":e.glManager.A.maxCapacity=t.n;break;case"loadAndRender":e.loadAndRender(t);break;case"redraw":e.redraw();break;case"deselect":e.chartImpl.deselect?.();break;case"resize":e.resize(t.cssWidth,t.cssHeight,t.dpr),e.redrawAck(t.msgId);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:"snapshotPngReply",requestId:n,error:String(i)})});break}}}var ni=new Map,Hs=new Set;function Vs(e,t,n){let i={sessionId:e,msg:t};n&&n.length>0?self.postMessage(i,n):self.postMessage(i)}function Ad(e){return{postMessage:(t,n)=>Vs(e,t,n),addEventListener:()=>{},removeEventListener:()=>{},start:()=>{},close:()=>{},dispatchEvent:()=>!1,onmessage:null,onmessageerror:null}}function Qu(e){self.addEventListener("message",function(t){let n=t.data,{sessionId:i,msg:o}=n;if(o.kind==="init"){if(ni.has(i)){Vs(i,{kind:"error",message:`sessionId ${i} already initialized`});return}e(o,Ad(i)).then(s=>{if(Hs.delete(i)){pn(s,{kind:"destroy"});return}ni.set(i,s)}).catch(s=>{Hs.delete(i),Vs(i,{kind:"error",message:String(s)})});return}if(o.kind==="destroy"){let s=ni.get(i);s?(pn(s,o),ni.delete(i)):Hs.add(i);return}let r=ni.get(i);r&&pn(r,o)})}Or();var fr=class extends Error{constructor(){super("StaleGenerationError")}};async function tm(e){let t=Zu[e];if(!t)throw new Error(`Unknown chart tag: ${e}`);return await t()}var zs=null;function Ld(e){return zs||(zs=new Mi(4,{precompile:e})),zs}var cr=class{constructor(t,n,i,o,r,s){p(this,"chartImpl");p(this,"glManager");p(this,"zoomController",null);p(this,"gridlines");p(this,"chrome");p(this,"cssWidth");p(this,"cssHeight");p(this,"dpr");p(this,"Vi",null);p(this,"Cr",null);p(this,"An",null);p(this,"Mo",0);p(this,"Ro",!1);p(this,"client");p(this,"view");p(this,"table");p(this,"controlPort");p(this,"Fo",0);p(this,"Ln",null);p(this,"So",0);p(this,"Do",0);if(this.client=n,this.view=i,this.table=o,this.controlPort=r,this.chartImpl=new s,t.tileSource&&et.register(t.tileSource),t.renderMode==="blit"&&!t.glCanvas&&!0)this.glManager=new _n(Ld(t.precompileShaders??!1).acquire());else{let m=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 _n(m,{precompile:t.precompileShaders??!1})}let a=Math.max(1,Math.round(t.cssWidth*t.dpr)),u=Math.max(1,Math.round(t.cssHeight*t.dpr));this.gridlines=t.gridlinesCanvas??new OffscreenCanvas(a,u),this.chrome=t.chromeCanvas??new OffscreenCanvas(a,u),t.renderMode==="blit"&&(this.glManager.setFrameCallback(m=>{this.Mo+=1;let f=this.vr(m);this.post({kind:"frameBitmap",bitmap:f},[f])}),this.chartImpl.setOverlayPresenter?.(()=>this.kr())),this.cssWidth=t.cssWidth,this.cssHeight=t.cssHeight,this.dpr=t.dpr,this.chartImpl.setGridlineCanvas?.(this.gridlines),this.chartImpl.setChromeCanvas?.(this.chrome),this.chartImpl.setTheme?.(t.themeVars),t.defaultChartType&&this.chartImpl.setDefaultChartType?.(t.defaultChartType),this.chartImpl.setFacetConfig?.(t.facetConfig),this.chartImpl.setPluginConfig?.(t.pluginConfig),t.columnsConfig&&this.chartImpl.setColumnsConfig?.(t.columnsConfig),this.chartImpl.setZoomController&&(this.zoomController=new kt,this.chartImpl.setZoomController(this.zoomController)),this.chartImpl.setView?.(i),this.glManager.A.maxCapacity=t.bufferMaxCapacity,this.glManager.resize(t.cssWidth,t.cssHeight,t.dpr),this.chartImpl.attachTooltip?.(new Di(m=>this.post(m)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}setPluginConfig(t,n){n&&et.register(n),this.chartImpl.setPluginConfig?.(t)}async loadAndRender(t){let n=++this.Fo,i;try{let[o,r,s,l]=await Promise.all([this.view.num_rows(),this.view.schema(),this.view.expression_schema(),this.table?.schema()??Promise.resolve({})]);if(this.Fo!==n)return;this.chartImpl.setViewPivots?.(t.viewerConfig.group_by,t.viewerConfig.split_by),this.chartImpl.setColumnTypes?.(r),this.chartImpl.setGroupByTypes?.({...l,...s}),this.chartImpl.setColumnSlots?.(t.viewerConfig.columns);let a=Object.keys(r).length||1,u=Math.floor(this.glManager.A.maxCapacity/a),m=Math.min(o,u);this.glManager.ensureBufferCapacity(m);try{await qu(this.view,async(f,c)=>{if(this.Fo!==n)throw new fr;await this.chartImpl.uploadAndRender(this.glManager,f,0,Math.min(m,c))},{end_row:m,float32:t.options.float32})}catch(f){if(!(f instanceof fr))throw f}}catch(o){(o+"").indexOf("View not found")===-1&&(console.error("loadAndRender failed",o),i=String(o))}finally{this.post({kind:"loadAndRenderAck",msgId:t.msgId,error:i})}}redraw(){this.chartImpl.requestRender(this.glManager)}redrawAck(t){this.chartImpl.requestRender(this.glManager).catch(()=>{}).finally(()=>this.post({kind:"resizeAck",msgId:t}))}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(){El(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?.Sn;if(t){for(let n of t)if(n&&!n.isDefault())return!1}return!0}resetAllZooms(){this.zoomController?.reset();let t=this.chartImpl?.Sn;if(t)for(let n of t)n?.reset();this.resetExpandedDomain()}resetExpandedDomain(){this.chartImpl.resetExpandedDomain?.()}Ar(t,n){let i=this.chartImpl,o=i?.b;if(o){for(let l=0;l<o.cells.length;l++){let a=o.cells[l],u=a.layout.e;if(t>=u.x&&t<=u.x+u.width&&n>=u.y&&n<=u.y+u.height){let m=i.getZoomControllerForFacet?.(l)??this.zoomController;return m?{controller:m,layout:a.layout}:null}}return null}if(!this.zoomController)return null;let r=i?.u;if(!r)return null;let s=r.e;return t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height?null:{controller:this.zoomController,layout:r}}Nr(t){let n=this.chartImpl,i=n?.F,o=n?.t;return!i||!o?!1:i.handleEvent(t,{cfg:o,cssWidth:this.cssWidth,cssHeight:this.cssHeight,legendRects:n._n??[],repaint:r=>{!r&&typeof n.repaintChrome=="function"?n.repaintChrome():this.chartImpl.requestRender(this.glManager)},postDelta:r=>this.post({kind:"pluginConfigDelta",fields:r}),setCursor:r=>n.yi?.setCursor?.(r),dispatchLeave:()=>this.w()?.dispatchLeave()})}onInteraction(t){try{this.Or(t)}catch(n){this.Ln=null,this.chartImpl?.F?.cancelGesture?.(),console.error("interaction dispatch failed",n)}}Or(t){if(!(!(this.Ln!==null&&(t.type==="pointermove"||t.type==="pointerup"))&&this.Nr(t)))switch(t.type){case"wheel":{let i=this.Ar(t.mx,t.my);if(!i)return;el(i,t.mx,t.my,t.deltaY),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()});break}case"pointerdown":{let i=this.Ar(t.mx,t.my);if(!i)return;this.Ln=i,this.So=t.mx,this.Do=t.my;break}case"pointermove":{if(this.Ln){let i=t.mx-this.So,o=t.my-this.Do;this.So=t.mx,this.Do=t.my,tl(this.Ln,i,o),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.w()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.Ln=null;break}case"pointerleave":{this.w()?.dispatchLeave();break}case"click":{this.w()?.dispatchClick(t.mx,t.my);break}case"dblclick":{this.w()?.dispatchDblClick(t.mx,t.my);break}}}w(){return this.chartImpl?.w??null}vr(t){let n=t.width,i=t.height;this.Vi||(this.Vi=new OffscreenCanvas(n,i),this.Cr=this.Vi.getContext("2d"));let o=this.Vi,r=this.Cr;return r?(o.width!==n||o.height!==i?(o.width=n,o.height=i):r.clearRect(0,0,n,i),this.gridlines.width===n&&this.gridlines.height===i&&r.drawImage(this.gridlines,0,0),r.drawImage(t,0,0),this.An!==t&&(this.An?.close(),this.An=t),this.chrome.width===n&&this.chrome.height===i&&r.drawImage(this.chrome,0,0),o.transferToImageBitmap()):t}kr(){if(this.Ro)return;this.Ro=!0;let t=this.Mo;queueMicrotask(()=>{this.Ro=!1;let n=this.An;if(this.Mo!==t||!n)return;let i=Math.max(1,Math.round(this.cssWidth*this.dpr)),o=Math.max(1,Math.round(this.cssHeight*this.dpr));if(n.width!==i||n.height!==o)return;let r=this.vr(n);r!==n&&this.post({kind:"frameBitmap",bitmap:r},[r])})}async snapshotPng(){this.glManager.beginFrame(),this.chartImpl.renderFrameSync(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),l=s.getContext("2d");if(!l)throw new Error("snapshotPng: 2D context unavailable");let u=this.chartImpl.v?.()?.backgroundColor??"transparent";u!=="transparent"&&(l.fillStyle=u,l.fillRect(0,0,i,o)),l.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),l.save(),l.scale(1,-1),l.drawImage(m,0,-o),l.restore(),l.drawImage(this.chrome,0,0),await s.convertToBlob({type:"image/png"})}destroy(){Pl(this.glManager),this.An?.close(),this.An=null,this.chartImpl.destroy(),this.glManager.destroy()}post(t,n){n&&n.length>0?this.controlPort.postMessage(t,n):this.controlPort.postMessage(t)}},Td=typeof globalThis.importScripts=="function";async function wd(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(Ju));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,l=await tm(e.chartTag),a=new cr(e,o,r,s,t,l);return a.post({kind:"ready"}),a}async function av(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 tm(e.msg.chartTag),o=new cr(e.msg,e.client,t,n,e.controlPort,i);return e.controlPort.addEventListener("message",r=>{let s=r.data;s?.kind!=="init"&&pn(o,s)}),e.controlPort.start(),o.post({kind:"ready"}),o}Td&&Qu(wd);export{cr as WorkerRenderer,av as bootstrapInProcess};\n';var W=null;async function Ke(){if(W)return W;let l=new Blob([Te],{type:"application/javascript"});return W=URL.createObjectURL(l),W}var Q=Ke;var L=null,z=new Map,Je=0;async function Qe(){return L||(L=(async()=>{let l=await Q(),e=new Worker(l,{type:"module",name:"viewer-charts"});e.addEventListener("message",i=>{let n=i.data;z.get(n.sessionId)?.(n.msg)});let t=!1;return e.addEventListener("error",i=>{if(t)return;t=!0,L=null;let r=`perspective-viewer-charts renderer worker error: ${i.message||`failed to load ${l}`}`;console.error(r,i.error??"");let o={kind:"error",message:r};for(let a of z.values())a(o)}),e})(),L)}var O=class{_handle=null;_destroyed=!1;_proxyChannel=null;_proxySession=null;_client;_view;_tableName;_panel;_clientWorkerURL;_clientWasm;_chartTag;_maxCells;_precompileShaders;_ready;_resolveReady;_rejectReady;_pending=new Map;_pendingCounter=0;_onZoomChanged=null;_onPluginConfigDelta=null;_allZoomsDefault=!0;_hostGlCanvas=null;_displayCtx=null;_lastPostedSize=null;_holdPresent=!1;_stagedFrame=null;_hostSink=null;_lastInsertConfig=void 0;constructor(e){this._client=e.client,this._view=e.view,this._tableName=e.tableName,this._panel=e.panel,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._onPluginConfigDelta=e.onPluginConfigDelta??null,this._ready=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i})}async init(e){this._hostGlCanvas=e.gl;let t=await Q();v==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(d=>{let w=d.slice().buffer;this._proxyChannel.port1.postMessage(w,[w])}),this._proxyChannel.port1.addEventListener("message",d=>{this._proxySession.handle_request(new Uint8Array(d.data))}),this._proxyChannel.port1.start());let i,n,r;e.renderBlitMode==="blit"?this._displayCtx=e.gl.getContext("2d"):(i=e.gl.transferControlToOffscreen(),n=e.gridlines.transferControlToOffscreen(),r=e.chrome.transferControlToOffscreen());let o=e.gl.getBoundingClientRect(),a=window.devicePixelRatio||1,s=I(e.gl),h=v==="worker"?ve():[],c=v==="worker"?this._clientWasm:void 0,g=v==="worker"?this._clientWorkerURL:void 0,u=v==="worker"?this._proxyChannel.port2:void 0,f={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:r,proxyPort:u,clientWorkerURL:g,clientWasm:c,chartTag:this._chartTag,viewName:this._view.__unsafe_get_name(),tableName:this._tableName,facetConfig:e.facetConfig,pluginConfig:e.pluginConfig,columnsConfig:e.columnsConfig,defaultChartType:e.defaultChartType,tileSource:p.specFor(e.pluginConfig.map_tile_provider),themeVars:s,fontFaces:h,cssWidth:o.width,cssHeight:o.height,dpr:a,bufferMaxCapacity:0,precompileShaders:this._precompileShaders};if(this._lastPostedSize={cssWidth:o.width,cssHeight:o.height,dpr:a},this._handle=await this._createHandle(t,f),this._handle.addMessageListener(d=>this._handleRendererMsg(d)),v==="worker"){let d=[this._proxyChannel.port2];r&&d.unshift(r),n&&d.unshift(n),i&&d.unshift(i),this._handle.post(f,d)}await this._ready}async _createHandle(e,t){if(v==="worker"){let r=await Qe(),o=++Je;return{post:(a,s)=>r.postMessage({sessionId:o,msg:a},s),addMessageListener:a=>{z.set(o,a)},terminate:()=>{z.delete(o)}}}let i=await import(e),n=new MessageChannel;return await i.bootstrapInProcess({msg:t,client:this._client,controlPort:n.port2}),{post:(r,o)=>n.port1.postMessage(r,o),addMessageListener:r=>{n.port1.addEventListener("message",o=>r(o.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,tileSource:p.specFor(e.map_tile_provider)})}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"})}deselect(){this._post({kind:"deselect"})}resize(){if(!this._hostGlCanvas)return Promise.resolve();let e=this._hostGlCanvas.getBoundingClientRect(),t=window.devicePixelRatio||1,i=this._lastPostedSize;return i&&Math.abs(i.cssWidth-e.width)<=.5&&Math.abs(i.cssHeight-e.height)<=.5&&i.dpr===t?Promise.resolve():this._postResize(e.width,e.height)}presize(e,t){if(!this._hostGlCanvas)return Promise.resolve();let i=window.devicePixelRatio||1,n=this._lastPostedSize;return n&&Math.abs(n.cssWidth-e)<=.5&&Math.abs(n.cssHeight-t)<=.5&&n.dpr===i?Promise.resolve():(this._holdPresent=!0,this._postResize(e,t).then(()=>()=>this._presentStaged(),r=>{throw this._presentStaged(),r}))}_postResize(e,t){let i=window.devicePixelRatio||1,{id:n,promise:r}=this._allocPending("resize");return this._lastPostedSize={cssWidth:e,cssHeight:t,dpr:i},this._post({kind:"resize",msgId:n,cssWidth:e,cssHeight:t,dpr:i}),r}_presentStaged(){this._holdPresent=!1;let e=this._stagedFrame;this._stagedFrame=null,e&&this._drawFrameBitmap(e)}clear(){this._post({kind:"clear"})}invalidateTheme(){if(!this._hostGlCanvas)return;let e=I(this._hostGlCanvas);this._post({kind:"invalidateTheme",themeVars:e})}async saveZoom(){let{id:e}=this._allocPending("saveZoom");this._post({kind:"saveZoom",requestId:e})}_allocPending(e){if(this._destroyed){if(e==="loadAndRender")return{id:-1,promise:Promise.resolve(void 0)};let n=Promise.reject(new Error("RendererTransport destroyed"));return n.catch(()=>{}),{id:-1,promise:n}}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._destroyed=!0,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,this._holdPresent=!1,this._stagedFrame?.close(),this._stagedFrame=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.grid,e.pos,e.bounds,e.style);break;case"dismissTooltip":this._hostSink?.dismiss();break;case"setCursor":this._ensureHostSink()?.setCursor(e.cursor);break;case"pluginConfigDelta":this._onPluginConfigDelta?.(e.fields);break;case"userClick":this._dispatchOnViewer(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:{...e.detail,panel:this._panel}}));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 T(e.selected,e.row,e.column_names,t,i);n.panel=this._panel,this._dispatchOnViewer(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:n}));break}case"frameBitmap":this._holdPresent?(this._stagedFrame?.close(),this._stagedFrame=e.bitmap):this._drawFrameBitmap(e.bitmap);break;case"error":this._rejectReady(new Error(e.message));break;case"loadAndRenderAck":e.error!==void 0?this._rejectPending(e.msgId,"loadAndRender",new Error(e.error)):this._resolvePending(e.msgId,"loadAndRender",void 0);break;case"resizeAck":this._resolvePending(e.msgId,"resize",void 0);break;case"snapshotPngReply":e.error!==void 0?this._rejectPending(e.requestId,"snapshotPng",new Error(e.error)):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))}_rejectPending(e,t,i){let n=this._pending.get(e);!n||n.kind!==t||(this._pending.delete(e),n.reject(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 N(this._hostGlCanvas,e),this._hostSink)}};function et(l){return isFinite(l)?l<0?0:l>1?1:l:.5}function Re(l){return!isFinite(l)||l<0?1:l}function Ee(l){let e=(r,o)=>l[r]||o,t=l["--psp-charts--gradient--background"]||l["--psp-charts--full-gradient--background"]||"linear-gradient(#0366d6 0%, #ff7f0e 100%)",i=ue(t),n=[];for(let r=1;;r++){let o=l[`--psp-charts--series-${r}--color`];if(!o)break;n.push(k(o))}return{fontFamily:e("--psp-charts--font-family",e("font-family","monospace")),backgroundColor:e("--psp--background-color","rgba(255, 255, 255, 1)"),tickColor:e("--psp-charts--axis-ticks--color","rgba(160, 0, 0, 0.8)"),labelColor:e("--psp--color","rgba(180, 0, 0, 0.9)"),axisLineColor:e("--psp-charts--axis-lines--color","rgba(160, 0, 0, 0.4)"),gridlineColor:e("--psp-charts--gridline--color","rgba(255, 0, 0, 1)"),gradientStops:i,legendText:e("--psp-charts--legend--color","rgba(180, 180, 180, 0.9)"),legendBorder:e("--psp-charts--legend-border--color","rgba(128,128,128,0.3)"),tooltipBg:e("--psp-charts--tooltip--background","rgba(155,155,155,0.8)"),tooltipText:e("--psp-charts--tooltip--color","#161616"),tooltipBorder:e("--psp-charts--tooltip--border-color","#fff"),areaOpacity:et(parseFloat(e("--psp-charts--area--opacity","0.85"))),heatmapGapPx:Re(parseFloat(e("--psp-charts--heatmap-gap--px","0"))),sunburstGapPx:Re(parseFloat(e("--psp-charts--sunburst-gap--px","1"))),seriesPalette:n}}function tt(l,e){if(e<=0)return[];let t=new Array(e);for(let i=0;i<e;i++){let n=e===1?.5:i/(e-1),r=fe(l,n);t[i]=[r[0],r[1],r[2]]}return t}function ee(l,e,t){if(l.length>0){if(l.length>=t)return l.slice(0,t);let i=new Array(t);for(let n=0;n<t;n++)i[n]=l[n%l.length];return i}return tt(e,t)}var it={...pe};function Ie(l){return p.register(l)}var nt={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:p.list().map(l=>({value:l.id,label:l.label}))}),map_tile_alpha:{kind:"Number",min:0,max:1,step:.05},numeric_axes:{kind:"Bool"},legend_mode:{kind:"Enum",variants:[{value:"auto",label:"Auto"},{value:"sidebar",label:"Sidebar"},{value:"none",label:"None"},{value:"floating",label:"Floating"}]},legend_size_mode:{kind:"Enum",variants:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}]},legend_width_px:{kind:"Number",min:0,max:512,step:1},legend_height_px:{kind:"Number",min:48,max:1024,step:1},legend_anchor:{kind:"Enum",variants:[{value:"top-right",label:"Top Right"},{value:"top-left",label:"Top Left"},{value:"bottom-right",label:"Bottom Right"},{value:"bottom-left",label:"Bottom Left"}]},legend_x:{kind:"Number",min:0,max:1,step:.01},legend_y:{kind:"Number",min:0,max:1,step:.01},legend_opacity:{kind:"Number",min:0,max:1,step:.05},tooltip_max_column_px:{kind:"Number",min:40,max:512,step:1},tooltip_opacity:{kind:"Number",min:0,max:1,step:.05}};function Se(l,e){let t=nt[l];return{...typeof t=="function"?t():t,key:l,default:e[l]}}var rt=[{key:"axes",fields:["auto_alt_y_axis","include_zero","domain_mode","numeric_axes"]},{key:"facets",fields:["facet_mode","facet_zoom_mode","series_zoom_mode"]},{key:"glyph",fields:["line_width_px","point_size_px","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px"]},{key:"density",fields:["gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"]},{key:"basemap",fields:["map_tile_provider","map_tile_alpha"]},{key:"legend",fields:b},{key:"tooltip",fields:_}],lt=(()=>{let l=new CSSStyleSheet;return l.replaceSync(de),[l]})(),Fe=Me,U=class l extends HTMLElement{_initialized=!1;_glCanvas;_gridlineCanvas;_chromeCanvas;_renderer=null;_rendererPromise=null;_rawEventForwarder=null;_resetClickAbort=null;_pluginConfigStore=null;_columnsConfig={};get _pluginConfig(){return this._pluginConfigStore||(this._pluginConfigStore=this._effectiveDefaults()),this._pluginConfigStore}set _pluginConfig(e){this._pluginConfigStore=e}_effectiveDefaults(){return{..._e,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of lt)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){if(this._initialized||this.connectedCallback(),this._rendererPromise)return this._rendererPromise;let t=this._buildRenderer(e).then(i=>{if(this._rendererPromise!==t)throw i.destroy(),new Error("renderer disposed during init");return this._renderer=i,this._setupInteraction(i),i});return t.catch(()=>{}),this._rendererPromise=t,t}_setupInteraction(e){if(this._rawEventForwarder)return;let t=this.shadowRoot.querySelector(".zoom-controls");this._rawEventForwarder=new D,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=this.getAttribute("slot")??void 0,n=await t.getClient({panel:i}),r=customElements.get("perspective-viewer"),o=r.get_wasm_module(),a=r.get_worker_url(),s=await t?.getTable?.({panel:i}),h=s?await s.get_name():void 0,c=this.shadowRoot.querySelector(".zoom-controls"),g=new O({client:n,view:e,tableName:h,panel:i,clientWorkerURL:a,clientWasm:o,chartTag:this._chartType.tag,maxCells:this._chartType.max_cells,precompileShaders:!0,onZoomChanged:u=>{c&&c.classList.toggle("visible",!u)},onPluginConfigDelta:u=>{this._pluginConfig={...this._pluginConfig,...u},this.parentElement?.restore({plugin_config:u},i?{panel:i}:void 0)?.catch(d=>{console.error("legend config persistence failed",d)})}});return await g.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...it,facet_mode:this._pluginConfig.facet_mode,zoom_mode:this._pluginConfig.facet_zoom_mode},pluginConfig:this._pluginConfig,columnsConfig:this._columnsConfig,defaultChartType:this._chartType.default_chart_type,renderBlitMode:Fe}),g}static setBlitMode(e){Fe=e}static registerTileSource(e){return Ie(e)}static tileSources(){return p.list()}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"],split_rollup_modes:["flat"],group_by_role:this._chartType.group_by_role,split_by_role:this._chartType.split_by_role,connects_row_order:!!this._chartType.connects_row_order,priority:0,can_render_column_styles:!!this._chartType.default_chart_type||this._chartType.category==="Cartesian Charts"||this._chartType.category==="Hierarchical Charts"||this._chartType.category==="Map Charts"}}column_config_schema(e,t,i,n,r){let o=[];t==="Color"&&((this._chartType.category==="Hierarchical Charts"?e==="integer"||e==="float"||e==="date"||e==="datetime":e!=="string")?o.push({kind:"GradientStops",key:"gradient",default:this._themeGradientStopsSpec()}):o.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()}));let a=this._chartType.default_chart_type;if(a&&(e==="integer"||e==="float")){let s=a==="bar"||a==="line"||a==="scatter"||a==="area";if(s)if((r?.split_by?.length??0)>0)o.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()});else{let f=(r?.columns??[]).filter(d=>!!d).indexOf(i);o.push({kind:"Color",key:"color",default:this._themeSeriesColorHex(Math.max(0,f))})}o.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 h=n?.chart_type??a,c=h==="bar"||h==="area";if(c&&o.push({kind:"Bool",key:"stack",default:c}),s&&o.push({kind:"Bool",key:"alt_axis",default:!1}),h==="line"||h==="area"){let u=h==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];o.push({kind:"Enum",key:"interpolate",default:"solid",variants:u})}}return e==="integer"||e==="float"?o.push({kind:"NumberFormat",default:xe}):e==="datetime"?o.push({kind:"DatetimeFormat",default:ye}):e==="date"&&o.push({kind:"DatetimeFormat",default:be}),{fields:o}}plugin_config_schema(e){let t=this._effectiveDefaults(),i=this._chartType.applicable_plugin_fields,n=new Set(i),r=new Set,o=[];for(let s of rt){let h=s.fields.filter(c=>n.has(c));if(h.length>=1){for(let c of h)r.add(c);o.push({kind:"Group",key:s.key,fields:h.map(c=>Se(c,t))})}}return{fields:[...i.filter(s=>!r.has(s)).map(s=>Se(s,t)),...o]}}_resolvedTheme(){return Ee(I(this))}static GRADIENT_PALETTE_FALLBACK_COUNT=6;_themeSeriesPaletteHex(){let e=this._resolvedTheme(),t=e.seriesPalette.length||l.GRADIENT_PALETTE_FALLBACK_COUNT;return ce(ee(e.seriesPalette,e.gradientStops,t))}_themeSeriesColorHex(e){let t=this._resolvedTheme(),i=Math.max(t.seriesPalette.length,e+1);return F(ee(t.seriesPalette,t.gradientStops,i)[e])}_themeGradientStopsSpec(){return he(this._resolvedTheme().gradientStops)}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;try{t=await this._ensureRenderer(e)}catch{return}t.setView(e),t.setBufferMaxCapacity(this._chartType.max_cells);let i=this.getAttribute("slot")??void 0,n=this.parentElement;if(n===null)return;let r=await n.getViewConfig({panel:i});await t.loadAndRender({viewerConfig:{group_by:r?.group_by??[],split_by:r?.split_by??[],columns:r?.columns??[]},options:{float32:!0}})}async clear(){this._renderer?.clear()}async resize(){!this.isConnected||this.offsetParent==null||await this._renderer?.resize()}async presize(e,t){if(!this.isConnected||this.offsetParent==null||!this._renderer||!this._glCanvas)return;let i=this.getBoundingClientRect(),n=this._glCanvas.getBoundingClientRect();return await this._renderer.presize(Math.max(0,n.width+(e-i.width)),Math.max(0,n.height+(t-i.height)))}restyle(){this._renderer?.invalidateTheme()}async deselect(){this._renderer?.deselect()}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._columnsConfig=t??{},this._renderer?.setPluginConfig(this._pluginConfig),this._renderer?.setColumnsConfig(this._columnsConfig)}delete(){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 ot(...l){let e=new Set(l.length>0?l:Z.map(i=>i.name)),t=[];Z.forEach(i=>{if(e.has(i.name)){let n=`perspective-viewer-charts-${i.tag}`;if(customElements.get(n)){t.push(n);return}customElements.define(n,class extends U{_chartType=i;static _chartType=i}),customElements.whenDefined("perspective-viewer").then(async()=>{await customElements.get("perspective-viewer").registerPlugin(n)})}}),t.length>0&&console.warn(`viewer-charts plugins already registered (${t.length}); skipping duplicate registration (Perspective was loaded more than once on this page).`)}ot();export{T as PerspectiveSelectDetail,ot as register,Ie as registerTileSource,Ge as tileSources};
|
|
3
2
|
//# sourceMappingURL=perspective-viewer-charts.js.map
|