@perspective-dev/viewer-charts 5.5.1 → 5.6.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/README.md +59 -0
- package/dist/cdn/perspective-viewer-charts.js +1 -1
- package/dist/cdn/perspective-viewer-charts.js.map +4 -4
- package/dist/esm/event-detail.d.ts +1 -1
- package/dist/esm/perspective-viewer-charts.js +1 -1
- package/dist/esm/perspective-viewer-charts.js.map +3 -3
- package/dist/esm/plugin/format-defaults.d.ts +1 -1
- package/dist/esm/plugin/plugin.d.ts +1 -1
- package/dist/esm/webgl/context-manager.d.ts +6 -6
- package/package.json +32 -7
- package/src/ts/charts/cartesian/glyphs/lines.ts +3 -33
- package/src/ts/charts/chart-base.ts +1 -1
- package/src/ts/event-detail.ts +1 -1
- package/src/ts/plugin/format-defaults.ts +1 -1
- package/src/ts/plugin/plugin.ts +25 -17
- package/src/ts/render/scheduler.ts +4 -6
- package/src/ts/webgl/context-manager.ts +16 -14
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var R="Series Charts",V="Cartesian Charts",Y="Hierarchical Charts",te="Financial Charts",G="Map Charts",Pe=["X Axis"],L=["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,..._],Le=["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={},Ue=[m("X Bar","x-bar",R,x,1,Pe,E,{...We,default_chart_type:"bar",plugin_field_defaults:$}),m("Y Bar","y-bar",R,x,1,L,E,{...B,default_chart_type:"bar",plugin_field_defaults:$}),m("Y Line","y-line",R,x,1,L,E,{...B,default_chart_type:"line",plugin_field_defaults:S}),m("Y Scatter","y-scatter",R,x,1,L,E,{...B,default_chart_type:"scatter",plugin_field_defaults:S}),m("Y Area","y-area",R,x,1,L,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"],Le,{...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=Ue;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 Oe(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]])} ${Oe(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 P=null,z=new Map,Je=0;async function Qe(){return P||(P=(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,P=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})(),P)}var U=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:"Alignment",corners:!0},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,O=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 U({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 O{_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};
|
|
1
|
+
var R="Series Charts",Y="Cartesian Charts",G="Hierarchical Charts",te="Financial Charts",V="Map Charts",Le=["X Axis"],L=["Y Axis"],y="select",b="toggle";var v=["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",...v,..._],S={facet_mode:"overlay"},$={...S,include_zero:!0},ie=["facet_mode","facet_zoom_mode","domain_mode","line_width_px","point_size_px",...v,..._],ne=["facet_mode","series_zoom_mode","domain_mode","band_inner_frac","bar_inner_pad","wick_width_px","ohlc_line_width_px",..._],re=[...v,..._],Be=["facet_zoom_mode",...v,..._],Z=["facet_mode","facet_zoom_mode","domain_mode","map_tile_provider","map_tile_alpha","numeric_axes",...v,..._],ke=[...Z,"point_size_px"],De=[...Z,"line_width_px"],Ne=[...Z,"gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max"],We=["facet_mode","facet_zoom_mode","domain_mode","gradient_color_mode","gradient_radius_px","gradient_intensity","gradient_heat_max",...v,..._];function g(r,e,t,i,n,l,o,a){return{name:r,tag:e,category:t,selectMode:i,initial:{count:n,names:l},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"},ze={group_by_role:"Y Axis",split_by_role:"Series"},X={},se={group_by_role:"Hierarchy",split_by_role:"Facets"},Oe={group_by_role:"X Axis",split_by_role:"Y Axis"},ae={group_by_role:"X Axis",split_by_role:"Series"},j={},Ue=[g("X Bar","x-bar",R,y,1,Le,E,{...ze,default_chart_type:"bar",plugin_field_defaults:$}),g("Y Bar","y-bar",R,y,1,L,E,{...B,default_chart_type:"bar",plugin_field_defaults:$}),g("Y Line","y-line",R,y,1,L,E,{...B,default_chart_type:"line",plugin_field_defaults:S}),g("Y Scatter","y-scatter",R,y,1,L,E,{...B,default_chart_type:"scatter",plugin_field_defaults:S}),g("Y Area","y-area",R,y,1,L,E,{...B,default_chart_type:"area",plugin_field_defaults:$}),g("X/Y Scatter","scatter",Y,b,2,["X Axis","Y Axis","Color","Size","Label","Tooltip"],ie,{...X}),g("X/Y Line","line",Y,y,2,["X Axis","Y Axis","Tooltip"],ie,{...X,connects_row_order:!0}),g("Density","density",Y,b,2,["X Axis","Y Axis","Color","Tooltip"],We,{...X}),g("Treemap","treemap",G,b,1,oe,re,{...se,plugin_field_defaults:{legend_mode:"sidebar"}}),g("Sunburst","sunburst",G,b,1,oe,re,{...se}),g("Heatmap","heatmap",G,y,1,["Color"],Be,{...Oe,plugin_field_defaults:{legend_mode:"sidebar"}}),g("Candlestick","candlestick",te,b,1,le,ne,{...ae,default_chart_type:"candlestick",plugin_field_defaults:S}),g("OHLC","ohlc",te,b,1,le,ne,{...ae,default_chart_type:"ohlc",plugin_field_defaults:S}),g("Map Scatter","map-scatter",V,b,2,["Longitude","Latitude","Color","Size","Label","Tooltip"],ke,{...j}),g("Map Line","map-line",V,y,2,["Longitude","Latitude","Tooltip"],De,{...j,connects_row_order:!0}),g("Map Density","map-density",V,b,2,["Longitude","Latitude","Color","Tooltip"],Ne,{...j})],q=Ue;function k(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 F(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 M=[{offset:0,color:[3/255,102/255,214/255,1]},{offset:1,color:[255/255,127/255,14/255,1]}];function ue(r){if(!r)return M.slice();let e=r.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),l=[],o=0,a=0;for(let u=0;u<n.length;u++){let f=n[u];f==="("?o++:f===")"?o--:f===","&&o===0&&(l.push(n.substring(a,u)),a=u+1)}l.push(n.substring(a));let s=[],h=0;if(l.length>0){let u=l[0].trim().toLowerCase();(u.startsWith("to ")||/^[-\d.]+(deg|rad|grad|turn)/.test(u))&&(h=1)}for(let u=h;u<l.length;u++){let f=l[u].trim();if(!f)continue;let d=f.match(/\s([\-\d.]+)%\s*$/),x=d?f.substring(0,d.index).trim():f,T=d?parseFloat(d[1])/100:null;try{let A=k(x);s.push({color:A,offset:T})}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,x=s[f].offset,T=f-(u-1);for(let A=u;A<f;A++)s[A].offset=d+(A-(u-1))/T*(x-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 He(r){return`${Math.round(Math.max(0,Math.min(1,r))*1e3)/10}%`}function he(r){return`linear-gradient(to right, ${[...r].sort((t,i)=>t.offset-i.offset).map(t=>`${F([t.color[0],t.color[1],t.color[2]])} ${He(t.offset)}`).join(", ")})`}function ce(r){return`linear-gradient(to right, ${r.map(F).join(", ")})`}function fe(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 h=i+n>>1;r[h].offset<=e?i=h:n=h}let l=r[i],o=r[n],a=o.offset-l.offset,s=a>0?(e-l.offset)/a:0;return[l.color[0]+(o.color[0]-l.color[0])*s,l.color[1]+(o.color[1]-l.color[1])*s,l.color[2]+(o.color[2]-l.color[2])*s,l.color[3]+(o.color[3]-l.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,l=19,o=[]){this.id=e;this.template=t;this.attribution=i;this.tileSize=n;this.maxZoom=l;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 l=(t+i)%this.subdomains.length;n=n.replace("{s}",this.subdomains[l])}return n}};function ge(r){if(typeof r!="object"||r===null)throw new TypeError("TileSourceSpec must be an object");let e=r,t=c=>{let m=e[c];if(typeof m!="string"||m.length===0)throw new TypeError(`TileSourceSpec.${c} must be a non-empty string`);return m},i=t("id"),n=t("label"),l=t("template"),o=t("attribution");for(let c of["{z}","{x}","{y}"])if(!l.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(l.includes("{s}")&&s.length===0)throw new TypeError('TileSourceSpec.template uses "{s}" but no subdomains were given');let h=(c,m)=>{let u=e[c];if(u===void 0)return m;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:l,subdomains:s,attribution:o,tile_size:h("tile_size",256),max_zoom:h("max_zoom",19)})}function Ve(r){let e=2166136261;for(let t=0;t<r.length;t++)e^=r.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=Ve(`${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 $e(){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(),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 N=class{selected;row;column_names;removeConfigs;insertConfigs;panel;constructor(r,e,t,i,n,l){this.selected=r,this.row=e,this.column_names=t,this.removeConfigs=i,this.insertConfigs=n,this.panel=l}get removeFilters(){return this.removeConfigs.flatMap(r=>r.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(r=>r.filter??[])}};var Xe=["--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(r){let e=getComputedStyle(r),t={};for(let i of Xe){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 ve(){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(),a=l.getPropertyValue("src").trim();!o||!a||r.push({family:je(o),src:Ze(a,i),style:w(l,"font-style"),weight:w(l,"font-weight"),stretch:w(l,"font-stretch"),unicodeRange:w(l,"unicode-range"),variant:w(l,"font-variant"),featureSettings:w(l,"font-feature-settings"),display:w(l,"font-display")})}}return r}function w(r,e){return r.getPropertyValue(e).trim()||void 0}function je(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 Ze(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 Ce={opacity:1,maxColumnPx:160};var we=/^[-+−]?[$€£¥]?\s?\d[\d., \s]*(?:[eE][-+]?\d+|[KMB%])?$/;var Ae=8;var W=class{_glCanvas;_parent;_div=null;constructor(e,t){this._glCanvas=e,this._parent=t}pin(e,t,i,n=Ce){this.dismiss();let l=document.createElement("div");l.className="webgl-tooltip",l.style.maxHeight=`${Math.round(i.cssHeight*.6)}px`,qe(l,e,n),getComputedStyle(this._parent).position==="static"&&(this._parent.style.position="relative"),l.style.left="-9999px",l.style.top="0px",this._parent.appendChild(l),this._div=l;let o=l.getBoundingClientRect().width,a=l.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),l.style.left=`${s}px`,l.style.top=`${h}px`}dismiss(){this._div&&(this._div.remove(),this._div=null)}setCursor(e){this._glCanvas.style.cursor=e}};function qe(r,e,t){let i=e.reduce((l,o)=>Math.max(l,o.length),0);if(r.style.display="grid",r.style.gridTemplateColumns=`repeat(${Math.max(1,i)}, minmax(0, max-content))`,r.style.columnGap=`${Ae}px`,t.opacity<1){let l=Math.max(0,Math.round(t.opacity*100));r.style.background=`color-mix(in srgb, var(--psp-charts--tooltip--background) ${l}%, transparent)`}let n=[];for(let l of e)if(!(l.length<=1))for(let o=1;o<l.length;o++){if(l[o]==="")continue;let a=we.test(l[o]);n[o]=(n[o]===void 0||n[o])&&a}for(let l of e){let o=l.length<=1;for(let a=0;a<Math.max(1,l.length);a++){let s=document.createElement("div");if(s.textContent=l[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"),r.appendChild(s),o)break}}}var C="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 d=(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(){d(this,"he",1);d(this,"xe",1);d(this,"Ge",0);d(this,"We",0);d(this,"It",0);d(this,"Et",1);d(this,"Dt",0);d(this,"Pt",1);d(this,"Ke",null);d(this,"ko",!1);d(this,"$i",!1);d(this,"ji",!1);d(this,"Bt",null);d(this,"Gt",null);d(this,"ui",null);d(this,"Zi",!1);d(this,"qi",0);d(this,"Ki",0);d(this,"tn",null);d(this,"nn",null);d(this,"on",null);d(this,"rn",null)}get lockedAxis(){return this.Ke}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.Ge}get normTranslateY(){return this.We}set normTranslateX(t){this.Ge=t}set normTranslateY(t){this.We=t}get baseXRange(){return this.Et-this.It}get baseYRange(){return this.Pt-this.Dt}setBaseDomain(t,n,i,o){let r=n-t;if(this.isXDefault()||!this.$i)this.It=t,this.Et=n;else{let l=this.Et-this.It,a=(this.It+this.Et)/2+this.Ge*l;this.It=t,this.Et=n,this.Ge=r>0?(a-(t+n)/2)/r:0}let s=o-i;if(this.isYDefault()||!this.ji)this.Dt=i,this.Pt=o;else{let l=this.Pt-this.Dt,a=(this.Dt+this.Pt)/2+this.We*l;this.Dt=i,this.Pt=o,this.We=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.Ke=t.lockAxis??null,this.ko=t.lockAspect??!1,this.Ke==="x"?(this.he=1,this.Ge=0):this.Ke==="y"&&(this.xe=1,this.We=0)}isXDefault(){return this.he===1&&this.Ge===0}isYDefault(){return this.xe===1&&this.We===0}isDefault(){return this.isXDefault()&&this.isYDefault()}getVisibleDomain(){let t=this.Et-this.It,n=this.Pt-this.Dt,i=t/this.he,o=n/this.xe,r=(this.It+this.Et)/2+this.Ge*t,s=(this.Dt+this.Pt)/2+this.We*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,p=Math.pow(1.1,-o.deltaY/100);this.Ke!=="x"&&(this.he=Math.max(1,Math.min(1e5,this.he*p))),this.Ke!=="y"&&(this.xe=Math.max(1,Math.min(1e5,this.xe*p))),this.Ke!=="x"&&f!==this.he&&(this.Ge+=(u-.5)*(1/f-1/this.he)),this.Ke!=="y"&&c!==this.xe&&(this.We+=(.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.Ke!=="x"&&l.width>0&&(this.Ge-=r/(l.width*this.he)),this.Ke!=="y"&&l.height>0&&(this.We+=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.Ge=0,this.We=0}serialize(){return{scaleX:this.he,scaleY:this.xe,normTranslateX:this.Ge,normTranslateY:this.We}}restore(t){this.he=t.scaleX,this.xe=t.scaleY,this.Ge=t.normTranslateX,this.We=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 p=m[c]??"",b=nl(e,p,n);if(f.push(b),o[c]=Math.max(o[c]??0,e.measureText(b).width),c>=1&&p!==""){let g=zm.test(p);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],p=i+Cn+f*il;if(c.length<=1){e.textAlign="left",e.fillText(c[0],n+Cn,p);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,p)):(e.textAlign="left",e.fillText(c[g],b,p)),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 Je,zm,il,Cn,wr,be=G(()=>{"use strict";Je={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 Ei,al=G(()=>{"use strict";Ei=class{constructor(t,n=128){d(this,"ln");d(this,"g",new Map);d(this,"Re",new Map);d(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,Ir,ul,ml=G(()=>{"use strict";Sr={notation:"compact",compactDisplay:"short",minimumFractionDigits:0,maximumFractionDigits:1},Ir={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 Er,Dr,Qe,Di=G(()=>{"use strict";fl();Er=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}};Dr=class{constructor(t){d(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 Er(`${n.id}@${i}`,n.template,n.attribution,n.tile_size,n.max_zoom,n.subdomains)}},Qe=new Dr(cl)});var pl,Oe,Pr=G(()=>{"use strict";Di();pl={facet_mode:"grid",shared_x_axis:!0,shared_y_axis:!0,coordinated_tooltip:!1,zoom_mode:"shared",facet_padding:6},Oe={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:Qe.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 Ue(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??Je.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??Je.opacity),l.restore()}var Pi,Nt=G(()=>{"use strict";be();Pi=class{constructor(){d(this,"ze",null);d(this,"un",0);d(this,"mn",null);d(this,"Mn",null);d(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.ze=t}detach(){this.un&&(cancelAnimationFrame(this.un),this.un=0),this.mn!==null&&(clearTimeout(this.mn),this.mn=null),this.ze=null}dispatchHover(t,n){if(this._t||!this.ze||this.un||this.mn!==null)return;let i=()=>{this.un=0,this.mn=null,this.ze?.onHover(t,n)};typeof requestAnimationFrame=="function"?this.un=requestAnimationFrame(i):this.mn=setTimeout(i,16)}dispatchLeave(){this._t||!this.ze||this.ze.onLeave()}dispatchClick(t,n){if(this.ze&&!this.ze.onClickPre?.(t,n)){if(this._t){let i=this.ze;this.dismiss(),i.onUnpin?.();return}this.ze.onPin?.(t,n)}}dispatchDblClick(t,n){this.ze?.onDblClick?.(t,n)}pin(t,n,i,o=Je){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 Te(e,t){return e.legend_width_px>0?_e(e.legend_width_px,xt,Gi):t}function se(e,t){return e.legend_mode!=="auto"?e.legend_mode:t<=tf?"floating":"sidebar"}function tt(e,t,n=80,i=0){return!t||se(e,i)!=="sidebar"?16:Te(e,n)}function Ni(e,t,n,i=0){return!t||se(e,i)!=="sidebar"?0:Te(e,n)}function Ot(e){return Math.round(e*1e4)/1e4}var xt,Gi,Bi,qm,Km,et,vn,yl,Gr,ki,Wr,_l,Jm,ht,bl,Qm,ef,tf,nf,Wi,He=G(()=>{"use strict";Pr();xt=48,Gi=512,Bi=48,qm=160,Km=160,et=18,vn=18,yl=8,Gr=12,ki=8,Wr=16,_l=16,Jm=10,ht=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(){d(this,"ye",null);d(this,"Wt",0);d(this,"Ye",null);d(this,"fn",!1);d(this,"Ji",!1);d(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?et+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),xt,Math.max(xt,Math.floor(n/2))),p=Math.max(0,n-c),b=Math.max(0,i-m),g=Br(t.legend_x)*p,h=Br(t.legend_y)*b;return{x:Math.round(hl(t.legend_anchor)?p-g:g),y:Math.round(xl(t.legend_anchor)?b-h:h),width:c,height:m}}reconcileConfig(t,n){if(this.Ye){for(let i of nf)if(t[i]!==n[i]){this.Ye=null;return}}}cancelGesture(){this.Ye=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-ht&&t<=o.x+o.width+ht,l=n>=o.y-ht&&n<=o.y+o.height+ht;if(!s||!l)return"none";let a=Math.abs(t-o.x)<=ht,u=Math.abs(t-(o.x+o.width))<=ht,m=Math.abs(n-(o.y+o.height))<=ht;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+et?"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.Ye?!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.Ye={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.Ye={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.Ye={kind:"move",startMx:t,startMy:n,startBox:{...r.box},moved:!1,snapshot:s}),!0)}on(t,n,i){if(this.Ye)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.Ye;if(!n)return!1;if(this.Ye=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!==Oe.legend_size_mode&&(l.legend_size_mode=Oe.legend_size_mode,a.legend_size_mode=l.legend_size_mode),r&&l.legend_width_px!==Oe.legend_width_px&&(l.legend_width_px=Oe.legend_width_px,a.legend_width_px=l.legend_width_px),s&&l.legend_height_px!==Oe.legend_height_px&&(l.legend_height_px=Oe.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.Ye,r=i.cfg,{cssWidth:s,cssHeight:l}=i,a=Math.max(xt,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)),xt,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)),xt,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)),xt,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 yt.slice();let t=e.trim();if(!t)return yt.slice();let n=t.indexOf("(");if(n<0||!/^linear-gradient\\s*\\(/i.test(t))return yt.slice();let i=t.lastIndexOf(")");if(i<=n)return yt.slice();let o=t.substring(n+1,i),r=[],s=0,l=0;for(let c=0;c<o.length;c++){let p=o[c];p==="("?s++:p===")"?s--:p===","&&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 p=r[c].trim();if(!p)continue;let b=p.match(/\\s([\\-\\d.]+)%\\s*$/),g=b?p.substring(0,b.index).trim():p,h=b?parseFloat(b[1])/100:null;try{let x=Oi(g);a.push({color:x,offset:h})}catch{}}if(a.length===0)return yt.slice();if(a.length===1){let[c,p,b]=a[0].color;return[{offset:0,color:[c,p,b,1]},{offset:1,color:[c,p,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 p=c+1;for(;p<a.length&&a[p].offset===null;)p++;let b=a[c-1].offset,g=a[p].offset,h=p-(c-1);for(let x=c;x<p;x++)a[x].offset=b+(x-(c-1))/h*(g-b);c=p-1}let m=0;return a.map(c=>{let p=Math.max(m,Math.min(1,c.offset));return m=p,{offset:p,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 p=Nr(f);if(!p)return null;s.push([p,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 _t(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 yt.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 yt,ge=G(()=>{"use strict";kr();yt=[{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"))),ke: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,ke: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 El(e,t,n){let i=Ct.get(e);i?(i.fullRender=t,i.render2D=n):(i={glManager:e,fullRender:t,render2D:n,waiters:[]},Ct.set(e,i));let o=Promise.withResolvers();return i.waiters.push(o),Vi||(Vi=Gl(Bl)),o.promise}function Dl(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=Ct.get(e);if(t){Ct.delete(e);for(let n of t.waiters)n.resolve()}An.delete(e),zi.delete(e)}async function Bl(){let e=Array.from(Ct.values());Ct.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,Ct.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);Il(e.glManager);return}try{await e.glManager.awaitGpuFence(),e.render2D(),await e.glManager.endFrame();for(let t of e.waiters)t.resolve()}catch(t){console.error("scheduler: present failed",t);try{await e.glManager.endFrame()}catch{}for(let n of e.waiters)n.reject(t)}finally{Il(e.glManager)}}function Il(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 Ct,Vi,zi,An,Or=G(()=>{"use strict";Ct=new Map,Vi=0,zi=new Set,An=new Map});var uf,mf,Ie,Ln=G(()=>{"use strict";ll();al();ml();Ri();Pr();Nt();He();Rl();Sl();Or();uf=(()=>{let e=Mr("float",void 0,Sr);return t=>e.format(t)})(),mf=(()=>{let e=Rr(void 0,Ir);return t=>e.format(t)})(),Ie=class{constructor(){d(this,"i",null);d(this,"K",null);d(this,"l",null);d(this,"Zo",null);d(this,"Fn",[]);d(this,"qo",{});d(this,"_",null);d(this,"Sn",[]);d(this,"L",[]);d(this,"h",[]);d(this,"B",[]);d(this,"it",{});d(this,"bi",!1);d(this,"gi",!1);d(this,"vt",{});d(this,"In",{});d(this,"to",new Map);d(this,"xi");d(this,"W",{...pl});d(this,"t",{...Oe});d(this,"R",new Wi);d(this,"T",new Pi);d(this,"yi",null);d(this,"_i",Promise.resolve());d(this,"dn",null);d(this,"Ko",null);d(this,"Ne",null)}setGridlineCanvas(t){this.K=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.it=t,this.Jo()}resetExpandedDomain(){}setGroupByTypes(t){this.vt=t}setColumnsConfig(t){this.In=t??{},this.Jo(),this.dn=null}Jo(){this.to=new Map;for(let[t,n]of Object.entries(this.In)){let i=this.it[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,Ir);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.it[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.R.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.In,t)),this.dn}invalidateTheme(){this.dn=null}setView(t){this.Ne&&this.Ne.dispose(),this.Ne=new Ei(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.Ne)try{let o=await this.Ne.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 El(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.T.detach(),this.T.dismiss(),this.Ne&&(this.Ne.dispose(),this.Ne=null),this.destroyInternal()}}});var Yi,Wl=G(()=>{"use strict";Yi=class{constructor(t,n,i,o,r){d(this,"ot",new Map);d(this,"Ce");d(this,"Se");d(this,"Nt");d(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,p=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;_<p&&(p=_,c=x)}}return c}}});var Xi,kl=G(()=>{"use strict";Wl();Xi=class{constructor(){d(this,"En",null);d(this,"Dn",!0)}markDirty(){this.Dn=!0}get isDirty(){return this.Dn}rebuild(t,n,i){if(n===0){this.En=null,this.Dn=!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.En=a,this.Dn=!1}query(t,n,i,o,r,s,l){return!this.En||!s||!l?-1:this.En.query(t,n,i,o,r,s,l)}clear(){this.En=null,this.Dn=!0}}});function nt(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){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 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),nt(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.F=NaN,e.S=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.Je=a,e.Xe=u,e.nr=!a,e.Oe=!!a&&e.it[a]==="string",e.ve=!!u&&e.it[u]==="string",e.bn=[],e.gn=[],e.ir=new Map,e.or=new Map,e.mt=null,e.ft=null,e.Oe&&(e.F=0,e.Ce=0,e.rt=0,e.Pn=1/0,e.Bn=-1/0),e.ve&&(e.S=0,e.Se=0,e.st=0,e.Gn=1/0,e.Wn=-1/0);let p=t.A.totalCapacity||i;if(e.B.length>0){if(e.w=ff(n,a,u,m,f,c),e.w.length===0){e.E=0,e.X=[];return}if(e.$e=e.w[0].xColName,e.Ue=e.w[0].yColName,e.s=m,e.re=f,e.wi=c,e.k=!1,m){let h=n.get(e.w[0].colorColName);e.k=h?.type==="string"}t.ensureBufferCapacity(p*e.w.length)}else if(e.w=[],e.$e=a,e.Ue=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.w.length);e.E=p,e.X=new Array(b).fill(0);let g=b*p;e.J=new Float32Array(g),e.Q=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.Ue)return;let s=o;if(s===0||e.E===0)return;let l=e.w.length>0,a=[];if(l)for(let b of e.w){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.$e?n.get(e.$e):null,g=e.Ue?n.get(e.Ue):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.w.length>1&&(e.p=0,e.c=e.w.length-1);for(let b=0;b<a.length;b++){let g=a[b],h=e.X[b]??0,x=b*e.E,y=e.E-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.Oe&&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 E;if(e.Oe)E=Ol(g.xColData,T,e.bn,e.ir);else if(g.xCol){if(E=g.xCol[T],isNaN(E))continue}else E=i+T;let[I,S]=e.projectPoint(E,M);if(isNaN(I)||isNaN(S))continue;I<e.Ce&&(e.Ce=I),I>e.rt&&(e.rt=I),S<e.Se&&(e.Se=S),S>e.st&&(e.st=S),isNaN(e.F)&&(e.F=I),isNaN(e.S)&&(e.S=S);let D=I-e.F,k=S-e.S,W=x+h+_;e.J[W]=D,e.Q[W]=k,e.Ot[W]=i+T,u[_*2]=D,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 p=0;for(let b of e.X)p+=b;e.At=p,t.uploadedCount=p,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,it=G(()=>{"use strict";oe=class{constructor(t,n,i){d(this,"margins");d(this,"e");d(this,"cssWidth");d(this,"cssHeight");d(this,"O",0);d(this,"$",1);d(this,"j",0);d(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,p=i.cellHeight??n,b=m+r,g=f+a,h=Math.max(1,c-r-u),x=Math.max(1,p-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,p=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-=p,o+=p,b?(i=0,o+=p):g&&(o=0,i-=p),h?(t=0,n+=c):x&&(n=0,t-=c),this.O=t,this.$=n,this.j=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])}M(t,n){let{x:i,y:o,width:r,height:s}=this.e,l=(t-this.O)/(this.$-this.O),a=(n-this.j)/(this.ee-this.j);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,p=Math.max(c,1/c),b=a*u;(p<s||p===s&&b<l)&&(o=a,r=u,s=p,l=b)}return{cols:o,rows:r}}function Ee(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,p=s,b=m,g=c,h=Math.max(1,i-m-p),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 D=Math.floor(S/C),k=S-D*C,W=D===_-1||S+C>=n,V=k===0,N=b+k*(L+y),H=g+D*(T+y),U=H+r,Y=N,q=L,me=Math.max(1,T-r),Be=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:Be,titleRect:Re,isLeftEdge:V,isBottomEdge:W})}let M=t.hasLegend?{x:b+h,y:c,width:s,height:x}:void 0,E=l==="outer"?{x:b,y:g+x,width:h,height:f}:void 0;return{cells:w,legendRect:M,outerXAxisRect:E,outerYAxisRect:a==="outer"?{x:0,y:g,width:m,height:x}:void 0}}var cf,df,pf,bf,gf,hf,Ht=G(()=>{"use strict";it();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 vt(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 At(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 ot(e,t,n,i){vt(e),At(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 Ve(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 ze(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 In=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 Lt;let n=t&&t.length>1?t[1]-t[0]:0;return i=>Ur(i,n)}function Lt(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 Ur(e,t){let n=new Date(e);return isNaN(n.getTime())?Lt(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,we=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 Yt(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 Xt(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 $t(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 Hr(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,Yt(s,l,n,a=>t.M(a,0).px),Xt(s,l,i,a=>t.M(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,p=$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.M(g,0).px,p);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,p=$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.M(0,g).py,p);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 En(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 Dn(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 Vr=G(()=>{"use strict";we();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 jt(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*Ce/i,r=-Ce+t*o,s=r+o,l=Ce-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*Ce/(t*e));return Math.max(0,Math.min(n,Math.floor(i)))}function Jl(e,t){let n=1<<t,i=2*Ce/n,o=Math.floor((e.xMin+Ce)/i),r=Math.floor((e.xMax+Ce)/i),s=Math.floor((Ce-e.yMax)/i),l=Math.floor((Ce-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 Ce,Pn,Bn=G(()=>{"use strict";Ce=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=zr(e.O),r=zr(e.$),s=Ql(jt(0,e.j)[1]),l=Ql(jt(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*Ce),yTicks:u.map(c=>eo(0,c)[1]),formatX:c=>na(zr(c),m,"E","W"),formatY:c=>na(jt(0,c)[1],f,"N","S")}}function zr(e){return e/Ce*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";we();Bn()});function Yr(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 Xr(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 $r(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 jr(e,t){return e.M(t,0).px}function Zr(e,t){return e.M(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 Ye(e,t){return e.numRows===0||e.levels.length===0?24:aa(sa(e,t).map(n=>n.size))}function qt(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=`${Zt}px ${s}`;let u=sa(n,l.width),m=ma(n.numRows,t.O,t.$,!1);if(!m)return;let[f,c]=m,p=n.levels.length,b=a;for(let h=p-1;h>=0;h--){let x=n.levels[h],y=u[h],C=b;b+=y.size,h===p-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):If(i,o);e.strokeStyle=a,e.fillStyle=a,e.beginPath();for(let h of c){let x=jr(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=`${Zt}px ${l}`;let p=r+io+3,b={x:u.x,width:u.width,y:r,height:9999},g=[];for(let h of c){let x=jr(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,_=Yr(x,p,C,qr,s.rotation);if($r(_,b)){if(s.rotation===0){if(g.some(v=>Xr(v,_)))continue}else if(g.some(v=>oa(v,_)))continue;g.push(_),ca(e,y,x,p,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=>jr(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=`${Zt}px ${s}`;let f=r+3+4,c=[],p={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,_=Yr(g,f,C,qr,0);$r(_,p)&&(c.some(v=>Xr(v,_))||(c.push(_),ca(e,y,g,f,0,"center")))}}function If(e,t){let n=[];for(let i=e;i<=t;i++)n.push(i);return n}function De(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=`${Zt}px ${s}`;let u=la(n),m=ma(n.numRows,t.j,t.ee,!0);if(!m)return;let[f,c]=m,p=n.levels.length,b=a;for(let h=p-1;h>=0;h--){let x=n.levels[h],y=u[h],C=b;b-=y,h===p-1?Ef(e,t,x,f,c,C,s,o):Df(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 Ef(e,t,n,i,o,r,s,l){let{e:a}=t,u=qr+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 p=i;p<=o;p+=c){let b=Zr(t,p);b<a.y-1||b>a.y+a.height+1||(e.moveTo(r-io,b),e.lineTo(r,b))}e.stroke(),e.font=`${Zt}px ${s}`,e.textAlign="right",e.textBaseline="middle";for(let p=i;p<=o;p+=c){let b=Zr(t,p);if(b<a.y-1||b>a.y+a.height+1)continue;let g=ua(n,p);g&&e.fillText(g,r-io-3,b)}}function Df(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,p=>Zr(t,p),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 p of f)e.moveTo(c,p.nearClip),e.lineTo(c,p.farClip),e.moveTo(c,p.nearEdge),e.lineTo(r,p.nearEdge),e.moveTo(c,p.farEdge),e.lineTo(r,p.farEdge);e.stroke(),e.font=`${Zt}px ${l}`,e.textAlign="right",e.textBaseline="middle";for(let p of f){let b=(p.nearClip+p.farClip)/2,g=p.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,Zt,qr,Lf,Tf,wf,Kt=G(()=>{"use strict";to();kn();vf=25,Af=22,io=5,Zt=11,qr=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 rt(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=Lt,o){return rt(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+et+.5),e.lineTo(t.x+t.width-.5,t.y+et+.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+et/2+.5)),e.restore(),{x:t.x+yl,y:t.y+et+ki/2,width:Math.max(0,t.width-Gr),height:Math.max(0,t.height-et-ki)}}function Kr(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 Jt(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)};Xe(e,l,n,i,o,r,s&&{...s,sidebarGutter:t.margins.right})}function Xe(e,t,n,i,o,r=Lt,s){let l=e.getContext("2d");if(!l)return;let a=o.cn,u=o.eo,m=o.fontFamily,f=s?.mode==="floating",c,p,b,g=t,h=da;f?(g=ro(l,t,o,n.label,s?.opacity),c=g.x,p=g.y+4,b=Math.max(8,g.height-12)):(c=t.x,p=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,p-4));let x=n.max,y=n.min,C=l.createLinearGradient(0,p,0,p+b),_=16;for(let L=0;L<=_;L++){let T=L/_,w=x+T*(y-x),M=_t(w,n.min,n.max),E=Se(i,M);C.addColorStop(T,Pf(E))}l.fillStyle=C,l.fillRect(c,p,h,b),l.strokeStyle=u,l.lineWidth=1,l.strokeRect(c,p,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,p+2),l.fillText(Mt(l,r((n.min+n.max)/2),A),v,p+b/2),l.fillText(Mt(l,r(n.min),A),v,p+b-2),n.min<0&&n.max>0){let L=(n.max-0)/(n.max-n.min),T=p+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,p=n.size*c,b=r?r.legend.clampScroll(m.height,p):0,g=p>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(),Kr(s,m,b,p,o),r&&r.legend.setPainted({mode:r.mode,box:t,content:m,contentHeight:p,sidebarGutter:r.sidebarGutter})}var oo,da,pa,Bf,Nn=G(()=>{"use strict";we();He();ge();oo=4,da=16,pa=5;Bf=64});function st(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?rt(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.w.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(),p=c.ke,b=e.it[e.Je]||"",g=e.it[e.Xe]||"",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.w.length):Math.max(1,e.a.size);if(e.Mi&&e.so===p&&e.ao===v)_=e.Mi;else{let A=he(p,c.N,v);_=Ll(A),e.Mi=_,e.so=p,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(()=>$e(e))}function lo(e,t,n,i){return{min:t,max:n,label:e.Je||(e.nr?"Row":e.$e||""),isDate:i}}function ao(e,t,n,i){return{min:t,max:n,label:e.Xe||e.Ue,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.Oe&&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.$e,"tick"));if(e.ve&&e.ft){let u=le(t,a);u&&De(u,n,e.ft,l)}else Qi(t,o,n,s,l,!0,a,e.getColumnFormatter(e.Ue,"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.Oe&&e.bn.length>0?uo(e.bn,e.Je||e.$e||""):null,e.ft=e.ve&&e.gn.length>0?uo(e.gn,e.Xe||e.Ue||""):null;let f=tt(e.t,m,80,On(e)),c=55+(e.Xe?16:0),p=Math.max(1,s-c-f),b=e.ft?qt(e.ft):void 0,g=e.mt?Ye(e.mt,p):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"?Te(e.t,80):0}:{hasXLabel:!!e.Je,hasYLabel:!!e.Xe,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,st(e.F),st(e.S)),_=lo(e,n.xMin,n.xMax,a),v=ao(e,n.yMin,n.yMax,u),A=$t(_,v,y),L=e.Oe?[]:A.xTicks,T=e.ve?[]:A.yTicks,w=t.dpr,M=e.K;M&&!h?e._e(()=>{ce(M,y,w),Hr(M,y,L,T,i,w)}):M&&h&&e._e(()=>ce(M,y,w)),ot(r,y,t.dpr,()=>{h&&e.renderBackground(t,y,C,n,st(e.F),st(e.S)),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.Oe&&e.bn.length>0?uo(e.bn,e.Je||e.$e||""):null,e.ft=e.ve&&e.gn.length>0?uo(e.gn,e.Xe||e.Ue||""):null;let m=e.w.map(M=>M.prefix),f=e.k&&e.a.size>1,c=!!e.s&&!e.k&&e.p<e.c,p=f||c,b=e.Ht==="map",g=b&&!e.t.numeric_axes,h=Ee(m,{cssWidth:s,cssHeight:l,xAxis:g?"none":e.bi?"outer":"cell",yAxis:g?"none":e.gi?"outer":"cell",hasLegend:p&&se(e.t,On(e))==="sidebar",legendWidth:Te(e.t,96),hasXLabel:!g&&!!e.Je,hasYLabel:!g&&!!e.Xe,gap:e.W.facet_padding});if(e.b=h,h.cells.length>1){let M=h.cells[0].layout.e;for(let E=1;E<h.cells.length;E++){let I=h.cells[E].layout.e;if(I.width!==M.width||I.height!==M.height){console.warn(`facet-grid: cell ${E} size (${I.width}\\xD7${I.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=_?$t(y,C,_):{xTicks:[],yTicks:[]},A=e.Oe?[]:v.xTicks,L=e.ve?[]:v.yTicks,T=t.dpr,w=e.K;w&&_&&e._e(()=>ce(w,_,T)),vt(r);for(let M=0;M<h.cells.length;M++){let E=h.cells[M],I=e.getZoomControllerForFacet(M),S=x&&I?I.getVisibleDomain():n,D=E.layout.buildProjectionMatrix(S.xMin,S.xMax,S.yMin,S.yMax,void 0,void 0,void 0,st(e.F),st(e.S));w&&!b&&e._e(()=>{let k=x?$t(lo(e,S.xMin,S.xMax,a),ao(e,S.yMin,S.yMax,u),E.layout).xTicks:A,W=x?$t(lo(e,S.xMin,S.xMax,a),ao(e,S.yMin,S.yMax,u),E.layout).yTicks:L;Hr(w,E.layout,k,W,i,T)}),At(r,E.layout,t.dpr,()=>{b&&e.renderBackground(t,E.layout,D,S,st(e.F),st(e.S)),e.glyph.drawSeries(e,t,D,M)})}e.le=y,e.te=C,e.kn=A,e.ae=L,e.Ri=i.N,e.Fi=p}function $e(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.Je,i,l.formatX),Qi(e.l,e.te,t,l.yTicks,n,!!e.Xe,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.R,title:e.s??void 0,opacity:e.t.legend_opacity},m=a?e.R.floatingBox(e.t,t.cssWidth,t.cssHeight,ba(e,n)):null;if(e.k&&e.a.size>0){let f=he(n.ke,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?Xe(e.l,m,f,l,n,c,u):Jt(e.l,t,f,l,n,c,u),s=!0}}s||e.R.clearPainted(),ha(e,e.l,t,0,1),e.de>=0&&e.J&&e.Q&&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.Oe,f=e.gi&&!e.ve,c=e.W.zoom_mode==="independent",p=u&&e.t.numeric_axes,b=p&&t.cells.length>0?Gn(t.cells[0].layout):null;u&&e.renderMapChrome(n,e.u,i,o),(!u||b)&&m&&t.outerXAxisRect&&En(n,t.outerXAxisRect,l,b?b.xTicks:r,wn(t),i,!!e.Je,o,b?b.formatX:e.getColumnFormatter(e.$e,"tick")),(!u||b)&&f&&t.outerYAxisRect&&Dn(n,t.outerYAxisRect,a,b?b.yTicks:s,Mn(t),i,!!e.Xe,o,b?b.formatY:e.getColumnFormatter(e.Ue,"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=p?Gn(_.layout):null,M=w||(c?$t(L,T,_.layout):{xTicks:r,yTicks:s});if((!u||w)&&!m)if(e.Oe&&e.mt){let E=le(n,o);E&&xe(E,_.layout,e.mt,i)}else Ji(n,L,_.layout,M.xTicks,i,!!e.Je,o,w?w.formatX:e.getColumnFormatter(e.$e,"tick"));if((!u||w)&&!f)if(e.ve&&e.ft){let E=le(n,o);E&&De(E,_.layout,e.ft,i)}else Qi(n,T,_.layout,M.yTicks,i,!!e.Xe,o,w?w.formatY:e.getColumnFormatter(e.Ue,"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.R.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.R,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.ke,C,Math.max(1,e.a.size));Ft(n,x,e.a,v,i,_),y=!0}else e.s&&(Xe(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.R.clearPainted(),e.de>=0&&e.J&&e.Q){let C=isNaN(e.F)?0:e.F,_=isNaN(e.S)?0:e.S,v=e.J[e.de]+C,A=e.Q[e.de]+_,L=Hf(e,e.de),T=e.glyph.tooltipOptions(),w=xa(e,T),M=ie(e.t),E=e.U.grid??[];for(let I=0;I<t.cells.length;I++){let S=t.cells[I],D=I===L,k=S.layout.M(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;D&&w&&ze(n,S.layout,i,o,ya(e,S.layout,k,v,A),M.opacity);let V=e.W.coordinated_tooltip;Ue(n,k,D||V?E:[],S.layout,i,o,{...M,crosshair:T.crosshair&&(!D||!w),highlightRadius:D?T.highlightRadius:0})}}}function Hf(e,t){return e.E<=0?0:Math.floor(t/e.E)}function ha(e,t,n,i,o){if(!e.Ut||!e.J||!e.Q)return;let r=e.Ut.dictionary,s=e.Ut.data,l=e.J,a=e.Q,u=isNaN(e.F)?0:e.F,m=isNaN(e.S)?0:e.S,f=e.E;if(f<=0)return;let c=0;for(let y=i;y<o;y++)c+=e.X[y]??0;if(c===0)return;let p=e.i?.dpr??1,b=le(t,p);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.M(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.J||!e.Q)return;let o=isNaN(e.F)?0:e.F,r=isNaN(e.S)?0:e.S,s=e.J[i]+o,l=e.Q[i]+r,a=n.M(s,l),u=e.U.grid??[],m=e.v(),f=e.i?.dpr??1,c=e.glyph.tooltipOptions(),p=xa(e,c);p&&ze(t,n,m,f,ya(e,n,a,s,l),e.t.tooltip_opacity),Ue(t,a,u,n,m,f,{...ie(e.t),crosshair:c.crosshair&&!p,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.$e,"tick"),a=e.getColumnFormatter(e.Ue,"tick");if(e.Ht==="map"){let u=Gn(t),[m,f]=jt(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,Jr=G(()=>{"use strict";ji();it();Ht();Rn();ge();Fn();Vt();Nt();be();In();Vr();Tt();ia();Bn();we();Kt();Nn();He();Vf=5e3});function Yf(e){if(!e.pn.isDirty||!e.J||!e.Q)return;let t=e.J,n=e.Q,i=Math.max(1,e.w.length),o=e.E,r=isNaN(e.F)?0:e.F,s=isNaN(e.S)?0:e.S;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 Qr(e,t,n){if(!e.J||!e.Q)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.$,a=i.j,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),p=r.height/(u-a),b=isNaN(e.F)?0:e.F,g=isNaN(e.S)?0:e.S,h=m-b,x=f-g,y=o<0?$f(e,h,x,c,p):jf(e,o,h,x,c,p);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,_)&&$e(e)})}else e.U.clearHover();$e(e)}}function _a(e){(e.de!==-1||e.Nn!==-1)&&(e.de=-1,e.Nn=-1,$e(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.J,e.Q);if(r>=0)return r;let s=Un*Un,l=Math.max(1,e.w.length),a=e.E,u=e.J,m=e.Q;for(let f=0;f<l;f++){let c=e.X[f]??0,p=f*a;for(let b=0;b<c;b++){let g=p+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.E,a=t*l,u=e.J,m=e.Q,f=Un*Un,c=-1;for(let p=0;p<s;p++){let b=a+p,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.T.dismiss(),e.uo=t,t<0||!e.J||!e.Q)return;let n=Zf(e,t);if(!n)return;let i=isNaN(e.F)?0:e.F,o=isNaN(e.S)?0:e.S,r=n.M(e.J[t]+i,e.Q[t]+o),s=e.U.beginPin();e.glyph.buildTooltipLines(e,t).then(l=>{e.U.isPinFresh(s)&&e.uo===t&&l.length!==0&&e.T.pin(l,r,n,ie(e.t))}),e.de=-1,e.Nn=-1,$e(e)}function Zf(e,t){if(e.b&&e.E>0){let n=Math.floor(t/e.E),i=e.b.cells[n];if(i)return i.layout}return e.u}function va(e){e.T.dismiss(),e.uo=-1}var Un,Aa=G(()=>{"use strict";Jr();be();Un=24});var Qt,es=G(()=>{"use strict";Qt=class{constructor(){d(this,"grid",null);d(this,"hoveredTarget",null);d(this,"mo",0);d(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 en(e,t){let n=[];if(!e.Ot||!e.Ne)return n;let i=e.Ot[t];if(i<0)return n;if(e.w.length>0&&e.E>0){let s=Math.floor(t/e.E),l=e.w[s];l?.prefix&&n.push([l.prefix])}let o=await e.Ne.fetchRow(i),r=e.w.length>0&&e.E>0?e.w[Math.floor(t/e.E)]?.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 mo=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),Ve(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();mo();gr();hr();tn=class{constructor(){d(this,"name","point");d(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.w.length),l=t.E;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.E;l.drawArrays(l.POINTS,o*a,s)}buildTooltipLines(t,n){return en(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 lt(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 at(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 Pe=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);Ve(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.E,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();Pe();de();ge();mo();pr();br();nn=class{constructor(){d(this,"name","line");d(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:lt(n.gl)}}draw(t,n,i){let o=this.g;if(!o||!Ta(o,t,n,i))return;let s=Math.max(1,t.w.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))}buildTooltipLines(t,n){return en(t,n)}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.E,n=Math.max(1,e.w.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 p=0;p<f;p+=i){let b=r[c+p];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();Pe();de();mo();xr();yr();_r();js();qs();Cr();vr();Kf=0,Jf=1,Qf=2,ec=3,on=class{constructor(){d(this,"name","density");d(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.w.length),s=t.E,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.E;this.runSplatAndResolve(t,n,r,i,a=>a(o*l,s))}buildTooltipLines(t,n){return en(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.w.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),Ve(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();Jr();Aa();es();ts();ns();os();St=class extends Ie{constructor(n){super();d(this,"glyph");d(this,"Ht","cartesian");d(this,"se",null);d(this,"$e","");d(this,"Ue","");d(this,"Je","");d(this,"Xe","");d(this,"nr",!1);d(this,"s","");d(this,"re","");d(this,"wi","");d(this,"k",!1);d(this,"Oe",!1);d(this,"ve",!1);d(this,"bn",[]);d(this,"gn",[]);d(this,"ir",new Map);d(this,"or",new Map);d(this,"mt",null);d(this,"ft",null);d(this,"w",[]);d(this,"Ce",1/0);d(this,"rt",-1/0);d(this,"Se",1/0);d(this,"st",-1/0);d(this,"F",NaN);d(this,"S",NaN);d(this,"p",1/0);d(this,"c",-1/0);d(this,"lt",1/0);d(this,"ut",-1/0);d(this,"Pn",1/0);d(this,"Bn",-1/0);d(this,"Gn",1/0);d(this,"Wn",-1/0);d(this,"vi",1/0);d(this,"Ai",-1/0);d(this,"Li",1/0);d(this,"Ti",-1/0);d(this,"E",0);d(this,"X",[]);d(this,"no",0);d(this,"J",null);d(this,"Q",null);d(this,"Lt",null);d(this,"Ot",null);d(this,"Ut",null);d(this,"At",0);d(this,"a",new Map);d(this,"U",new Qt);d(this,"io",null);d(this,"oo",null);d(this,"ro",null);d(this,"rr",0);d(this,"pn",new Xi);d(this,"u",null);d(this,"de",-1);d(this,"uo",-1);d(this,"Nn",-1);d(this,"b",null);d(this,"le",null);d(this,"te",null);d(this,"kn",null);d(this,"ae",null);d(this,"Ri",null);d(this,"Fi",!1);d(this,"Mi",null);d(this,"so",null);d(this,"ao",-1);this.glyph=n}colorScaleColumn(){return this.s||null}repaintChrome(){$e(this)}projectPoint(n,i){return[n,i]}renderBackground(n,i,o,r,s,l){}renderMapChrome(n,i,o,r){}tooltipCallbacks(){return{onHover:(n,i)=>Qr(this,n,i),onLeave:()=>{this.de!==-1&&(this.de=-1,$e(this))},onPin:(n,i)=>{if(Qr(this,n,i),this.de>=0){let o=this.de;Ca(this,o),this.Ir(o)}},onUnpin:()=>{this.emitUnselect()}}}async Ir(n){if(!this.Ot)return;let i=this.Ot[n],o=this.L[1]||this.L[0]||"",r=[];if(this.w.length>0&&this.E>0){let s=Math.floor(n/this.E),l=this.w[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.Oe||(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.J=null,this.Q=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.w=[],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){d(this,"Me",new Map);d(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(){d(this,"Re",new Map);d(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(){d(this,"o",null);d(this,"H",null);d(this,"g",new sr);d(this,"ti",new lr);d(this,"ni",null);d(this,"xr",1);d(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),p=o.xMax-o.xMin;if(!isFinite(p)||p<=0)return;let b=p/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 p=o.x>>f,b=o.y>>f,g=cn(i.id,c,p,b),h=this.g.get(g);if(!h)continue;let x=1<<f,y=o.x-p*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();Di();Bn();Tt();dn=class extends St{constructor(n){super(n);d(this,"Ht","map");d(this,"nt");this.nt=new ar,this.nt.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.nt.setSource(this.i.gl,Qe.sourceFor(n.map_tile_provider)),this.nt.setAlpha(n.map_tile_alpha)}renderBackground(n,i,o,r,s,l){this.nt.source||(this.nt.setSource(n.gl,Qe.sourceFor(this.t.map_tile_provider)),this.nt.setAlpha(this.t.map_tile_alpha)),this.nt.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.nt.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,p=a.x+a.width-4,b=a.y+a.height-4;s.fillStyle="rgba(255, 255, 255, 0.75)",s.fillRect(p-f-u*2,b-c-u,f+u*2,c+u),s.fillStyle=o.Fe,s.fillText(l,p-u,b-u/2),s.restore()}destroyInternal(){this.i&&this.nt.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){d(this,"ht");d(this,"r",new Map);d(this,"Tn",0);d(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){d(this,"ht");d(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 qe="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 Ke="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:qe,frag:Ke},{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,gt=class{constructor(t,n={}){d(this,"id");d(this,"canvas");d(this,"gl");d(this,"isWebGL2");d(this,"shaders");d(this,"Eo");d(this,"Do",null);d(this,"Jt");d(this,"xt",!1);d(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.Eo=this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS),this.isWebGL2||(this.Do=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.Eo;n++)t.disableVertexAttribArray(n),this.isWebGL2?t.vertexAttribDivisor(n,0):this.Do?.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={}){d(this,"P");d(this,"si");d(this,"Po");d(this,"r");d(this,"li",0);d(this,"zi",0);d(this,"Yi",0);d(this,"Xi",1);d(this,"xt",!1);d(this,"ai",null);d(this,"yt",null);d(this,"wn",null);d(this,"Qt",null);t instanceof gt?(this.P=t,this.si=!1):(this.P=new gt(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.max(1,Math.round(t*i)),r=Math.max(1,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}async endFrame(){if(!this.ai||this.isContextLost())return;let t=this.P.canvas;if(typeof t.transferToImageBitmap!="function")return;let n=await createImageBitmap(t);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{for(;;){let i=t.clientWaitSync(n,t.SYNC_FLUSH_COMMANDS_BIT,0);if(i===t.ALREADY_SIGNALED||i===t.CONDITION_SATISFIED)return;if(i===t.WAIT_FAILED){t.finish();return}if(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={}){d(this,"Bo");d(this,"Jt");d(this,"en",[]);d(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 gt(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(),p=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-p)/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 Ii=class{constructor(t){d(this,"sn");this.sn=t}pin(t,n,i,o=Je){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){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.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()}es();function ho(e){for(let t of e.keys())if(!t.startsWith("__"))return t;return""}var rn=class extends Ie{constructor(){super(...arguments);d(this,"re","");d(this,"s","");d(this,"ue","empty");d(this,"m",new go);d(this,"Z",-1);d(this,"C",-1);d(this,"pe",[]);d(this,"Vt",new Map);d(this,"Si",0);d(this,"p",1/0);d(this,"c",-1/0);d(this,"a",new Map);d(this,"q",null);d(this,"me",0);d(this,"U",new Qt)}colorScaleColumn(){return this.L[1]||null}};Tn();kn();we();function It(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"?Ur(e):n==="integer"?String(e|0):n==="float"?Lt(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 p=sc(f,!0,n);c=l.get(p),c===void 0&&(c=s.length,s.push(p),l.set(p,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,p=m.valid;for(;f<t;){let b=p?!!(p[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),p=0;for(let g=0;g<l;g++){let h=m.dictionary[m.indices[g+s]]??"";c[g]=h,h.length>p&&(p=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:p}}):[],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 p=s.get(c);return p===void 0&&(p=r.length,r.push(c),s.set(c,p)),p};for(let c=0;c<e.length;c++){let p=e[c].data,b=l[c];for(let g=0;g<o;g++){let h=g+n,x;if(!p)x="(null)";else{let y=p.valid;if(!(y?!!(y[h>>3]>>(h&7)&1):!0))x="(null)";else if(p.indices&&p.dictionary)x=p.dictionary[p.indices[h]]??"(null)";else if(p.values){let _=p.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.Z=t,e.C=t,e.pe=[t],e.Si=0,e.p=1/0,e.c=-1/0,e.a.clear(),e.q=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.Z,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 Ea(e,t){let n=e.valid;return!n||!!(n[t>>3]>>(t&7)&1)}function yo(e,t){return e?.values?Ea(e,t)?e.values[t]:0:1}function _o(e,t,n){let i=NaN,o="";return!t||!Ea(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 Ia(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=nt(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)Ia(e,g.colorCol);else Ia(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 p=s?1:0,b=new Array(n.length+p);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[p+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.Z,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.Z,m=!0;for(let f of a){let p=e.Vt.get(u)?.get(f);if(p===void 0){m=!1;break}u=p}if(m&&t.firstChild[u]!==-1){e.C=u,Co(e,u);return}}e.C=e.Z,e.pe=[e.Z]}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,Da=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:Da,p=f?uc:Da,b=e.x0[t]+p,g=e.y0[t]+c,h=e.x1[t]-p,x=e.y1[t]-p;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 p=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-p);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,p=r.value;(!e.q||e.q.length<r.count)&&(e.q=new Int32Array(r.count));let b=e.q,g=o,h=new Int32Array(128);h[0]=t;let x=1;for(;x>0;){x--;let y=h[x];if(p[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();He();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,_t(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();it();Nn();He();be();function Ga(e,t,n,i,o,r,s,l,a=Je){if(n.length===0)return;e.font=`11px ${l}`;let u=Fi(e,n,a.maxColumnPx),{boxW:m,boxH:f}=u,c=i+12,p=o-f-8;c+m>r&&(c=i-m-12),c<0&&(c=4),p<0&&(p=o+12),p+f>s&&(p=s-f-4),Si(e,u,c,p,t,a.opacity)}be();var Wa=24,fc=8,ka=12,Na=2,Oa=" \\u203A ";function wo(e,t,n,i,o){e.je=[];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.je.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.R.clearPainted();return}let c=f==="floating",p={mode:c?"floating":"sidebar",legend:e.R,title:e.s||"Legend",opacity:a.legend_opacity},b=c?e.R.floatingBox(a,r,s,u?rt(t,o,e.a.size,()=>e.a.keys(),{title:p.title}):Rt(t,o,{min:e.p,max:e.c},void 0,p.title)):null;if(u)b?Ft(t,b,e.a,n,o,p):l?Ft(t,l,e.a,n,o,{...p,sidebarGutter:l.width}):so(t,Ua(r,s,a),e.a,n,o,p);else{let g={min:e.p,max:e.c,label:e.s},h=e.getColumnFormatter(e.s,"value");b?Xe(t,b,g,i,o,h,p):Jt(t,Ua(r,s,a),g,i,o,h,p)}}function Ua(e,t,n){return new oe(e,t,{hasXLabel:!1,hasYLabel:!1,hasLegend:!0,rightExtra:Te(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.Ii),Ba(e,e.C,100,b),fs(e);let g=e.He,h=e.Ze;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.D=b}let f=e.v(),c=f.N,p=he(f.ke,c,Math.max(1,e.a.size));if(e.K){let b=e.K.getContext("2d");b&&b.clearRect(0,0,e.K.width,e.K.height)}e.Tt=!0,dc(e,n,c,p,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.D.u_resolution,i,o),n.bindBuffer(n.ARRAY_BUFFER,e.zt),n.enableVertexAttribArray(e.D.a_position),n.vertexAttribPointer(e.D.a_position,2,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,e.Yt),n.enableVertexAttribArray(e.D.a_color),n.vertexAttribPointer(e.D.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.Z];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=Ee(a,{cssWidth:m,cssHeight:u,hasLegend:!1,xAxis:"none",yAxis:"none",gap:e.W.facet_padding});e.b=f,fs(e);let c=e.He,p=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.Ii);let v=us(e,y,100,C,p);c.length<v&&fs(e);let A=e.He,L=e.Ze;for(let T=p;T<v;T++)A[T]=C,L[T]=y;p=v}e.me=p}function fs(e){let t=e.q?.length??e.m.count;(!e.He||e.He.length<t)&&(e.He=new Int32Array(t)),(!e.Ze||e.Ze.length<t)&&(e.Ze=new Int32Array(t))}function dc(e,t,n,i,o){let r=e.m,s=e.q,l=e.me,a=e.He,u=e.Ze,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 p=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(p,b,g,y,C,_-1,v-1,T)}else if(r.depth[x]-m(h)===1){let w=[.25,.25,.25,1];g=ms(p,b,g,y,v-1,_,v,w),g=ms(p,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,p.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.q,f=e.me,c=e.He,p=e.Ze;for(let b=0;b<f;b++){let g=m[b],h=p?p[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.Ii):_===2&&Fo(s,u,g,x,y,l,!0)}if(u.firstChild[r]===-1){let b=l.N,g=he(l.ke,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.ke,u,Math.max(1,e.a.size)),f=e.m,c=e.q,p=e.me,b=e.He,g=e.Ze;for(let h=0;h<p;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<p;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.Ii):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,p=Xn(e,n,s,l),b=Ao(p[0],p[1],p[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 p=f,b=i-16;if(e.measureText(p).width>b){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=b){p+="\\u2026";break}}if(p.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(p,h,x),e.fillStyle=l,e.fillText(p,h,x),e.restore()}else{if(i<40||o<22)return;let c=11;e.font=`${c}px ${r}`;let p=f,b=i-10;if(e.measureText(p).width>b){for(;p.length>1;)if(p=p.slice(0,-1),e.measureText(p+"\\u2026").width<=b){p+="\\u2026";break}}e.fillStyle=s,e.globalAlpha=.85,e.textAlign="left",e.textBaseline="top",e.fillText(p,u+5,m+4),e.globalAlpha=1}}function 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 je(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 Et(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.Ne){let u=await e.Ne.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.T.dismiss(),e.fe=t;let o=e.i?.cssWidth??0,r=e.i?.cssHeight??0;Et(e,t).then(s=>{e.fe===t&&s.length!==0&&e.T.pin(s,{px:n.cx,py:n.cy},{cssWidth:o,cssHeight:r},ie(e.t))}),e.G=-1,i()}function Io(e){e.T.dismiss(),e.fe=-1}function Eo(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.Z;)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.q,f=e.me,c=e.He,p=e.Ze,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=p?p[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 E=r[_]+M/2,I=o[_]+w/2;Math.abs(n-E)<10&&Math.abs(t-I)<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.je)if(t>=l.x0&&t<=l.x1&&n>=l.y0&&n<=l.y1){e.T.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.T.setCursor(o!==-1?"pointer":"default"),s!==-1){let l=e.U.beginHover(s);Et(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.je)if(t>=s.x0&&t<=s.x1&&n>=s.y0&&n<=s.y1){s.nodeId!==e.C&&(Do(e,s.nodeId),e.emitUnselect());return}let{leafId:i,branchId:o,inHeader:r}=cs(e,t,n);o!==-1&&r?(Do(e,o),je(e,o,"branch")):i!==-1?($a(e,i),je(e,i,"leaf")):o!==-1&&(Do(e,o),je(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&&(Do(e,l),je(e,l,"branch"),o!==-1&&s.firstChild[o]===-1&&($a(e,o),je(e,o,"leaf")))}function Do(e,t){Eo(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){Io(e)}var Po=class extends rn{constructor(){super(...arguments);d(this,"o",null);d(this,"D",null);d(this,"zt",null);d(this,"Yt",null);d(this,"co",0);d(this,"G",-1);d(this,"fe",-1);d(this,"je",[]);d(this,"be",null);d(this,"Tt",!0);d(this,"On",0);d(this,"ct",new Map);d(this,"b",null);d(this,"Ii",!1);d(this,"He",null);d(this,"Ze",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.it[this.s],a=l==="float"||l==="integer"||l==="date"||l==="datetime";this.ue=a?"numeric":"series"}this.G=-1,this.fe=-1,this.je=[],this.ct.clear(),this.b=null,this.He=null,this.Ze=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.Z!==-1&&await this.requestRender(n)}kt(n){this.Z!==-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.D=null,this.Z=-1,this.C=-1,this.pe=[],this.Vt.clear(),this.q=null,this.me=0,this.je=[],this.ct.clear(),this.b=null,this.He=null,this.Ze=null}};Rn();Pe();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,p=u,b=u+a*c;u=b;let g=o,h=o+r;e.a0[m]=p,e.a1[m]=b,e.r0[m]=g,e.r1[m]=h;let x=b-p,y=(g+h)/2;x*y*r<ja||e.firstChild[m]!==-1&&Za(e,m,p,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.q||e.q.length<i.count)&&(e.q=new Int32Array(i.count));let f=e.q,c=n,p=new Int32Array(128);p[0]=t;let b=1;for(;b>0;){b--;let g=p[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>=p.length){let v=new Int32Array(p.length*2);v.set(p),p=v}p[b++]=_}}return c}Ht();He();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.ke,m,Math.max(1,e.a.size));if(e.K){let b=e.K.getContext("2d");b&&b.clearRect(0,0,e.K.width,e.K.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 p=e.D;if(n.uniform2f(p.u_resolution,n.canvas.width,n.canvas.height),n.uniform1f(p.u_border_px,u.jo*c),e.d.length>0)for(let b of e.d)b.instanceCount!==0&&(n.uniform2f(p.u_center,b.centerX*c,b.centerY*c),Ka(e,n,t,b.instanceStart,b.instanceCount));else n.uniform2f(p.u_center,e.dt*c,e.pt*c),Ka(e,n,t,0,e.bo);e._e(()=>ut(e))}function Cc(e,t,n,i){let o=e.m,r=[],s=[];for(let f=o.firstChild[e.Z];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=Ee(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],p=a.cells[f];if(!p)continue;let b=o.name[c],g=e.ct.get(b)??c,h=p.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.D=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.q,a=e.d.length>0,u=a?e.d.reduce((p,b)=>p+b.instanceCount,0):e.me,m=new Float32Array(u*8),f=0,c=(p,b,g)=>{let h=f;for(let x=p;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 p of e.d){let b=p.instanceStart,g=b+p.instanceCount,{rangeStart:h,rangeCount:x}=c(b,g,p.drillRoot);p.instanceStart=h,p.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.D;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 ut(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.ke,m,Math.max(1,e.a.size)),c=e.m,p=e.q,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 _=p[C];_!==x.drillRoot&&Ja(e,t,_,l,m,f,x.centerX,x.centerY)}}else for(let x=0;x<b;x++){let y=p[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],p=c-f,b=(f+c)/2,h=(m-u)*b;if(p<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=p-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.q,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.Z]+.001&&i.drillRoot!==e.Z)return i.drillRoot;let f=e.d.length>0;for(let c=0;c<s;c++){let p=r[c];if(p===i.drillRoot||f&&!Rc(e,p,i.drillRoot))continue;let b=o.a0[p],g=o.a1[p],h=o.r0[p],x=o.r1[p];if(!(u<h||u>x)&&!(m<b||m>g))return p}return-1}function nu(e,t,n){if(e.fe!==-1)return;for(let r of e.je)if(t>=r.x0&&t<=r.x1&&n>=r.y0&&n<=r.y1){e.T.setCursor("pointer"),e.G!==-1&&(e.G=-1,ut(e));return}let i=tu(e,t,n),o=e.m;if(e.T.setCursor(i!==-1&&o.firstChild[i]!==-1?"pointer":"default"),i!==e.G){if(e.G=i,i!==-1){let r=e.U.beginHover(i);Et(e,i).then(s=>{e.U.commitHover(r,s)&&ut(e)})}else e.U.clearHover();ut(e)}}function iu(e,t,n){if(e.fe!==-1){Wo(e),e.emitUnselect();return}for(let s of e.je)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.Z]+.001){let u=i.parent[o.drillRoot];if(u!==-1&&u!==e.Z)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),je(e,r,"branch")):(Fc(e,r),je(e,r,"leaf")))}function bs(e,t){Eo(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},()=>ut(e))}function Wo(e){Io(e)}var ko=class extends rn{constructor(){super(...arguments);d(this,"o",null);d(this,"D",null);d(this,"hn",null);d(this,"xn",null);d(this,"bo",0);d(this,"lr","upright");d(this,"dt",0);d(this,"pt",0);d(this,"po",0);d(this,"G",-1);d(this,"fe",-1);d(this,"je",[]);d(this,"be",null);d(this,"Tt",!0);d(this,"On",0);d(this,"b",null);d(this,"ct",new Map);d(this,"d",[])}tooltipCallbacks(){return{onHover:(n,i)=>nu(this,n,i),onLeave:()=>{this.G!==-1&&this.fe===-1&&(this.G=-1,ut(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.it[this.s],a=l==="float"||l==="integer"||l==="date"||l==="datetime";this.ue=a?"numeric":"series"}this.G=-1,this.fe=-1,this.je=[],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.Z!==-1&&await this.requestRender(n)}kt(n){this.Z!==-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.D=null,this.Z=-1,this.C=-1,this.pe=[],this.Vt.clear(),this.q=null,this.me=0,this.je=[],this.b=null,this.ct.clear(),this.d=[]}};Ln();var un=class extends Ie{constructor(){super(...arguments);d(this,"Ie",[]);d(this,"ie",0);d(this,"bt",0);d(this,"o",null);d(this,"H",null);d(this,"u",null);d(this,"le",null);d(this,"te",null);d(this,"ae",null);d(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,Dt=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 Ic(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]===Dt?"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:p,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 nt(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,E=_.length;for(let R=0;R<M;R++)for(let P=0;P<E;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*E+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 I=[];for(let R=0;R<M;R++)I.push(c?{min:0,max:0}:{min:1/0,max:-1/0});let S=L,D=w.length,k=p?S*M*E: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*D),H=new Uint8Array(S*D+7>>3),U=null,Y=null,q=1;if(x.mode==="numeric"&&S>0){let R=t.get("__ROW_PATH_0__"),P=It(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),Be=me.slotWidth*q,Re=me.halfWidth*q,Fe=new Float64Array(M),dt=(M-1)/2;for(let R=0;R<M;R++)Fe[R]=(R-dt)*Be;let bn=new Array(M*E),gn=new Array(M*E);for(let R=0;R<M;R++){let P=C[R];for(let B=0;B<E;B++){let O=_[B],X=O===""?P:`${O}|${P}`,z=t.get(X),Z=R*E+B;bn[Z]=z?.values??null,gn[Z]=z?.valid??null}}let hn=new Array(M),ve=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",ve[R]=gs(P,l)?1:0,hn[R]&&(ae=!0)}let ee=[],re=[],Ge=[],We=[];for(let R=0;R<M;R++){let P=C[R];for(let B=0;B<E;B++){let O=_[B],X=O===""?P:`${O}|${P}`,z=R*E+B,Z={name:X,type:hn[R]?"string":"numeric",data:t.get(X)};ve[R]===0?(ee.push(Z),Ge.push(z)):(re.push(Z),We.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(", "),ke=ee.length>0?ls(ee,n,T,Ys):null,J=re.length>0?ls(re,n,T,dr):null,Pt=new Array(M*E).fill(null);if(ke)for(let R=0;R<Ge.length;R++)Pt[Ge[R]]=ke.perColumnSlots[R];if(J)for(let R=0;R<We.length;R++)Pt[We[R]]=J.perColumnSlots[R];let nm=S*M*E,$=Ic(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<E;O++){let X=B*E+O,z=Pt[X];if(z){let ue=B*E+O,Ae=R*D+ue;N[Ae]=z[R],mu(H,Ae);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*E+O,bt=R*D+Gt;N[bt]=ne,mu(H,bt)}}for(let R=0;R<D;R++){let P=-1,B=-1;for(let O=0;O<S;O++){let X=O*D+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<D;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*D+R;if(H[X>>3]>>(X&7)&1){if(O-B>1){let Z=B*D+R,ye=N[Z],ne=N[X],Gt=U?U[B]:B,ue=(U?U[O]:O)-Gt;for(let Ae=1;Ae<O-B;Ae++){let pe=B+Ae,Le=U?U[pe]:pe,um=ue===0?0:(Le-Gt)/ue;N[pe*D+R]=ye+(ne-ye)*um}}B=O}}}else if(P.chartType==="area"){for(let B=0;B<P.start;B++)N[B*D+R]=0;for(let B=P.end+1;B<S;B++)N[B*D+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=I[B];for(let Z=0;Z<E;Z++){let ye=B*E+Z,ne=w[ye];if(R<ne.start||R>ne.end)continue;let Gt=ne.chartType==="line"||ne.chartType==="area"&&ne.interpolateMode!=="skip",bt=R*D+ye;if(!Gt&&!(H[bt>>3]>>(bt&7)&1))continue;let ue=N[bt];if((ne.chartType==="bar"||ne.chartType==="area")&&ne.stack){if(ue===0&&(ne.chartType!=="area"||ne.interpolateMode==="skip"))continue;let Ae=p?(R*M+B)*E+Z:R*M+B,pe,Le;ue>=0?(pe=W[Ae],Le=pe+ue,W[Ae]=Le):(pe=V[Ae],Le=pe+ue,V[Ae]=Le),pe<z.min&&(z.min=pe),Le<z.min&&(z.min=Le),pe>z.max&&(z.max=pe),Le>z.max&&(z.max=Le),$.catIdx[te]=R,$.seriesId[te]=ye,$.axis[te]=0,$.chartType[te]=ne.chartType==="bar"?Dt:Uo,$.xCenter[te]=X,$.halfWidth[te]=Re,$.y0[te]=pe,$.y1[te]=Le,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"?Dt: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=I[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 Ne=c?{min:0,max:0}:{min:1/0,max:-1/0},pt=c?{min:0,max:0}:{min:1/0,max:-1/0};for(let R=0;R<$.count;R++){let P=$.axis[R]===0?Ne:pt,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<D;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?Ne:pt;for(let X=P.start;X<=P.end;X++){let z=X*D+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(Ne.min)||!isFinite(Ne.max)||Ne.min===0&&Ne.max===0)&&(Ne.min=0,Ne.max=1);let im=!isFinite(pt.min)||!isFinite(pt.max)||pt.min===0&&pt.max===0,om=Bt?im?{min:0,max:1}:pt:null,rm=ke?"category":"numeric",sm=Bt?J?"category":"numeric":null,lm=ke&&ke.domain.numRows>0?{min:0,max:Math.max(0,ke.domain.numRows-1)}:Ne,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:ke?.domain??null,rightValueCategoryDomain:J?.domain??null}}it();Fn();Nt();be();In();Pe();var hs=Dt;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.D,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),at(n,l,s.a_x_center,"bar_x",1,o)&&at(n,l,s.a_half_width,"bar_hw",1,o)&&at(n,l,s.a_y0,"bar_y0",1,o)&&at(n,l,s.a_y1,"bar_y1",1,o)&&at(n,l,s.a_color,"bar_color",3,o)&&at(n,l,s.a_series_id,"bar_sid",1,o)&&at(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.Qe,e.f.length):e.De}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.$,a=i.j,u=i.ee,m,f,c,p;if(e.Pe){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),p=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),p=r.height/(u-a);let b=e.yn&&e.oe&&!e.Pe?e.oe.max-(n-r.y)/r.height*(e.oe.max-e.oe.min):f,g=e.yn&&e.oe&&!e.Pe?r.height/(e.oe.max-e.oe.min):p,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=Dc(e,v.chartType,m,f,b,c,p,g,o,A);break;case"bar":h=Ec(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 Ec(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,p=s.axis,b=e.ne,g=Math.max(1,e.ge.length);for(let h=0;h<s.count;h++){if(l[h]!==Dt||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=p[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 Dc(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.Qe,p=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(!(p[T>>3]>>(T&7)&1))continue;let w=c[T],M=x?x[L]:L,E=(M-n)*r,I=(w-C)*_,S=E*E+I*I;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.Qe,u=e.$t,m=e.Ae,f=m.chartType,c=m.catIdx,p=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(p[y])||o!==void 0&&p[y]%x!==o)continue;if(r!==void 0){let T=Math.floor(p[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.De!==null)&&(e.Ee=-1,e.De=null,e.i&&e.requestRender(e.i))}function Bc(e,t,n){let i=e.Ee===t,o=(e.De?.seriesId??-1)===(n?.seriesId??-1)&&(e.De?.catIdx??-1)===(n?.catIdx??-1);i&&o||(e.Ee=t,e.De=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.Ei=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.Qe,e.f.length)))}function gu(e,t){e.go=-1,hu(e,t)}function hu(e,t){if(e.T.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.Pe?n.M(o,t.xCenter):n.M(t.xCenter,o):Xo(e,t.xCenter,o,n),s=ys(e,t);s.length!==0&&(e.T.pin(s,r,n,ie(e.t)),e.Ee=-1,e.De=null,e.i&&e.requestRender(e.i))}we();Vr();we();Tt();Kt();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.M(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.M(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"?De(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.$;i.O=s.domain.min,i.$=s.domain.max,vs(u,i,s.domain,s.ticks,"top",o,a.alt),i.O=f,i.$=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"?De(u,i,n.domain,o):As(u,i,n.domain,n.ticks,"left",o,a.value),s)if(s.mode==="category")De(u,i,s.domain,o);else{let f=i.j,c=i.ee;i.j=s.domain.min,i.ee=s.domain.max,As(u,i,s.domain,s.ticks,"right",o,a.alt),i.j=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?Yt(s,t.e,n,l=>t.M(l,0).px):Xt(s,t.e,n,l=>t.M(0,l).py))}Kt();Ht();ji();Tt();Ki();Nn();He();var mt=null;function yu(e){if(mt&&mt.xCenters.length>=e&&mt.colors.length>=e*3)return mt;let t=Math.max(e,mt?.xCenters.length??0);return mt={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)},mt}function zo(e,t){let n=e.Ae,i=n.count,o=e.ge.length,r=e.jt&&o>0,s=0;if(e.Di=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,p=n.chartType,b=n.seriesId,g=n.xCenter,h=n.halfWidth,x=n.y0,y=n.y1,C=n.axis,_=Math.max(1,e.et.length),v=r?I=>I%o*_+Math.floor(I/o):I=>o>0?Math.floor(I/o):I,A=r?o*_:_,L=new Array(A).fill(0);for(let I=0;I<i;I++)p[I]!==hs||c.has(b[I])||L[v(b[I])]++;let T=[],w=new Int32Array(A),M=0;for(let I=0;I<A;I++)T.push({start:M,count:L[I]}),w[I]=M,M+=L[I];r?(e.Vn=null,e.Hn=Array.from({length:o},(I,S)=>T.slice(S*_,(S+1)*_)),e.Di=Array.from({length:o},(I,S)=>{let D=T[S*_],k=T[(S+1)*_-1];return{start:D.start,count:k.start+k.count-D.start}})):(e.Vn=T,e.Hn=null);let E=I=>w[v(I)]++;for(let I=0;I<i;I++){if(p[I]!==hs)continue;let S=b[I];if(c.has(S))continue;let D=E(S);a.xCenters[D]=g[I]-m,a.halfWidths[D]=h[I],a.y0s[D]=x[I],a.y1s[D]=y[I],a.seriesIds[D]=S,a.axes[D]=C[I];let k=f[S].color;a.colors[D*3]=k[0],a.colors[D*3+1]=k[1],a.colors[D*3+2]=k[2],u[D]=I,s++}}else r&&(e.Di=Array.from({length:o},()=>({start:0,count:0})));if(e.Un=s,s===0){e.qe=null;return}let l=mt;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.qe||e.qe.length<s*3)&&(e.qe=new Float32Array(Math.max(s*3,e.qe?.length??0))),e.qe.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.qe;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.qe=new Float32Array(n*3)),e.qe.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.Pe,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 p=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,p=H.yMin,b=H.yMax):(p=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,p,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:p,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:qt(A),U=H+(v?16:0),Y=tt(e.t,_,80,e.f.length),q=Math.max(1,o-U-Y),me=T?Ye(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?qt(L):void 0;w=new oe(o,r,{hasXLabel:v,hasYLabel:!0,hasLegend:_,bottomExtra:24,leftExtra:H,rightExtra:tt(e.t,_,80,e.f.length)})}else{let H=T?qt(L):55,U=H+16,Y=tt(e.t,_,80,e.f.length),q=Math.max(1,o-U-Y),me=Ye(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,E=l?w.buildProjectionMatrix(g,h,b,p,"x",M,void 0,0,e.ce):w.buildProjectionMatrix(p,b,g,h,"y",M,void 0,e.ce,0),I;if(e.yn&&e.oe&&!l){let H=w.O,U=w.$,Y=w.j,q=w.ee;I=w.buildProjectionMatrix(p,b,x,y,"y",M,void 0,e.ce,0),w.O=H,w.$=U,w.j=Y,w.ee=q}else I=E;let S=K(g,h,6),D=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.K&&qo(e.K,w,S,s,t.dpr,l);let N=e.f.length>1?mn(e):null;ot(n,w,t.dpr,()=>{vu(e,n,t,E,I,s.pi,l,N?N.seriesId:-1)}),e.le=k,e.te=W,e.ae=S,e.Xn=V,e.$n=D,e.Be=a?K(p,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 p=e.D;t.uniformMatrix4fv(p.u_proj_left,!1,i),t.uniformMatrix4fv(p.u_proj_right,!1,o),t.uniform1f(p.u_horizontal,s?1:0),t.uniform1f(p.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:p,visRightMin:b,visRightMax:g}=n,h=e.h.length>0,x=e.Cn,y=e.Yn==="category"&&x!==null&&x.numRows>0,C=e.et.length>1,_=l?"outer":"cell",v=y?"cell":"outer",A=Ee(e.ge,{cssWidth:a,cssHeight:u,xAxis:s?v:_,yAxis:s?_:v,hasLegend:C&&se(e.t,e.et.length)==="sidebar",legendWidth:Te(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,p,6),T=l?K(m,f,6):null,w=A.cells[0].layout,M=e.K;M&&e._e(()=>ce(M,w,o));let E=e.t.include_zero,I=e.f.length>1?mn(e):null,S=e.yn&&e.oe!==null&&!s;vt(i);for(let D=0;D<A.cells.length;D++){let W=A.cells[D].layout,V=s?W.buildProjectionMatrix(c,p,f,m,"x",E,void 0,0,e.ce):W.buildProjectionMatrix(m,f,c,p,"y",E,void 0,e.ce,0),N=V;if(S){let H=W.O,U=W.$,Y=W.j,q=W.ee;N=W.buildProjectionMatrix(m,f,b,g,"y",E,void 0,e.ce,0),W.O=H,W.$=U,W.j=Y,W.ee=q}M&&e._e(()=>Nc(M,W,L,r,o,s)),At(i,W,o,()=>{vu(e,i,t,V,N,r.pi,s,I&&I.splitIdx===D?I.seriesId:-1,D)})}e.le={levels:e.Ie,numRows:e.ie,levelLabels:e.h.slice()},e.te={min:c,max:p,label:e.xo},e.ae=L,e.Xn=null,e.$n=null,e.Be=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?Yt(s,t.e,n,l=>t.M(l,0).px):Xt(s,t.e,n,l=>t.M(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.Be)n={mode:"numeric",domain:{min:e.I.min,max:e.I.max,isDate:e.I.isDate,label:e.I.label},ticks:e.Be};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.Pe,{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.Pe,s=e.h.length>0,l=e.Le==="numeric"&&e.I!==null&&e.Be!==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,p=e.f.find(x=>x.axis===0),b=e.getColumnFormatter(p?.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&&De(_,y,a,i),c&&xe(_,y,f,i)):(!l&&a&&xe(_,y,a,i),c&&De(_,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&&Dn(n,t.outerYAxisRect,h,e.Be,Mn(t),i,s,o,g),!c&&t.outerXAxisRect&&En(n,t.outerXAxisRect,u,m,wn(t),i,!0,o,b)):(h&&t.outerXAxisRect&&En(n,t.outerXAxisRect,h,e.Be,wn(t),i,s,o,g),!c&&t.outerYAxisRect&&Dn(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.R.clampScroll(l.height,m),c=m>l.height,p=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,p),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(),Kr(r,l,f,m,s),e.R.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.et.length,o=se(n,i),r=o==="floating";if(i<=1||o==="none"||!r&&!t.legendRect){e.R.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.R.floatingBox(n,a.cssWidth,a.cssHeight,rt(e.l,e.v(),i,()=>e.et.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.R,title:"Legend",sidebarGutter:r?void 0:t.legendRect.width,opacity:n.legend_opacity},i,m=>({label:e.et[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.R.clearPainted();return}let o=e.u,r=i==="floating",s=e.B.join(" / ")||"Legend",l=r?e.R.floatingBox(t,o.cssWidth,o.cssHeight,rt(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.R,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.Pe?n.M(o,t.xCenter):n.M(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.Pe?n.M(t.y1,t.xCenter):n.M(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.Be))(e.V[t.catIdx]):f=_s(e,t.catIdx),f!==""&&m.push({side:e.Pe?"left":"bottom",px:u.px,py:u.py,text:f});let c=t.axis===1?e.Xn:e.te,p=t.axis===1?e.$n:e.ae,b=e.getColumnFormatter(e.f[t.seriesId]?.aggName,"tick")??fe(c?.isDate,p);m.push({side:e.Pe?"bottom":t.axis===1?"right":"left",px:u.px,py:u.py,text:b(t.y1)}),ze(e.l,n,l,a,m,e.t.tooltip_opacity),Ue(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.$-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,p,b;if(c){let v=Yc(c,o.n,t,n);p=v.lo,b=v.hi}else p=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=p;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.Ei===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.Qe,p=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(!(p[_>>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.Ei=r,n}Rn();Pe();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(){d(this,"o",null);d(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=lt(t.gl),i=j(t,"bar-line",qe,Ke,["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.Qe,l=t.$t,a=t.ce,u=t.V,m=t.f.length,f=[];for(let c of i){let p=t.f[c.seriesId],b=p.start,g=p.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:p.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:p}=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),p(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 Ze=new Float32Array(0),Me=new Float32Array(0);function Kc(e){Ze.length<e*2&&(Ze=new Float32Array(Math.max(e*2,Ze.length*2))),Me.length<e*3&&(Me=new Float32Array(Math.max(e*3,Me.length*2)))}var Qo=class{constructor(){d(this,"o",null);d(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.Qe,u=t.$t,m=t.V,f=t.ce,c=t.ne,p=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++:p++)}let g=p+b;if(g===0){this.r=null;return}Kc(g);let h=[],x=0,y=p;for(let C of i){if(c.has(C.seriesId))continue;let _=C.axis===1?y-p: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 E=m?m[w]-f:w,I=a[M];C.axis===1?(Ze[y*2]=E,Ze[y*2+1]=I,Me[y*3]=v,Me[y*3+1]=A,Me[y*3+2]=L,y++):(Ze[x*2]=E,Ze[x*2+1]=I,Me[x*3]=v,Me[x*3+1]=A,Me[x*3+2]=L,x++)}let T=C.axis===1?y-p:x;T>_&&h.push({seriesId:C.seriesId,axis:C.axis,first:_,count:T-_})}p>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.posLeftBuffer),l.bufferData(l.ARRAY_BUFFER,Ze.subarray(0,p*2),l.STATIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,s.colorLeftBuffer),l.bufferData(l.ARRAY_BUFFER,Me.subarray(0,p*3),l.STATIC_DRAW)),b>0&&(l.bindBuffer(l.ARRAY_BUFFER,s.posRightBuffer),l.bufferData(l.ARRAY_BUFFER,Ze.subarray(p*2,g*2),l.STATIC_DRAW),l.bindBuffer(l.ARRAY_BUFFER,s.colorRightBuffer),l.bufferData(l.ARRAY_BUFFER,Me.subarray(p*3,g*3),l.STATIC_DRAW)),this.r={leftCount:p,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(){d(this,"o",null);d(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.Qe,a=t.$t,u=t.V,m=t.ce,f=t._o,c=t.Ae,p=[];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),p.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:p}}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 p=t.f[c.seriesId].aggIdx;if(a!==void 0&&(p<a.start||p>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 p=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;p[x++]=L,p[x++]=_,p[x++]=L,p[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:p}}Pe();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 ft=class extends un{constructor(n="vertical"){super();d(this,"Pe");d(this,"D",null);d(this,"et",[]);d(this,"ge",[]);d(this,"f",[]);d(this,"jt",!1);d(this,"b",null);d(this,"Di",null);d(this,"Xt",[]);d(this,"Vn",null);d(this,"Hn",null);d(this,"Ae",Ho());d(this,"Co",[]);d(this,"jn",[]);d(this,"Zn",[]);d(this,"Pi",[]);d(this,"xo","");d(this,"ur","");d(this,"Yn","numeric");d(this,"mr",null);d(this,"Cn",null);d(this,"yo",null);d(this,"_o",null);d(this,"qe",null);d(this,"Bi",null);d(this,"Gi",null);d(this,"vo",null);d(this,"Ao",null);d(this,"ho",{min:0,max:1});d(this,"oe",null);d(this,"yn",!1);d(this,"qn",null);d(this,"Kn",null);d(this,"Wi",null);d(this,"Le","category");d(this,"I",null);d(this,"ce",0);d(this,"Be",null);d(this,"V",null);d(this,"ne",new Set);d(this,"Ee",-1);d(this,"go",-1);d(this,"De",null);d(this,"Qe",new Float32Array(0));d(this,"$t",new Uint8Array(0));d(this,"Y",{lines:new Jo,scatter:new Qo,areas:new er});d(this,"Xn",null);d(this,"$n",null);d(this,"Un",0);d(this,"zn",new Int32Array(0));d(this,"_n",[]);d(this,"ar",!1);d(this,"wt",null);d(this,"fr",null);d(this,"Ei",null);this.Pe=n==="horizontal"}getZoomConfig(){return{lockAxis:this.Pe?"x":"y"}}repaintChrome(){Ko(this)}tooltipCallbacks(){return{onHover:(n,i)=>xs(this,n,i),onLeave:()=>{(this.Ee!==-1||this.De)&&(this.Ee=-1,this.De=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.Qe,this.f.length);this.cr(r)}else if(this.De){let o=this.De;gu(this,o),this.cr(o)}},onUnpin:()=>{this.emitUnselect()}}}async cr(n){if(!this.et[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.et[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.D=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.In,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.et=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.Qe=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.Ei=null,this.qe=null,this.Ee=-1,this.De=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.D=null,this.H=null,this.jt=!1,this.b=null,this.Di=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.qe=null,this.vo=null,this.Ao=null,this.Ie=[],this.ie=0,this.ne.clear(),this.Ee=-1,this.De=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.ke,i=t.N,o=e.In,r=e.jt?Math.max(1,e.et.length):e.f.length,s=e.Gi;if(e.Bi&&s&&s.ke===n&&s.N===i&&s.seriesLength===r&&s.columnsConfig===o)return!1;let l=nd(n,i,r);e.Bi=l,e.Gi={ke: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 ft{constructor(){super("horizontal")}};Ln();it();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,p=null;if(s.mode==="numeric"&&m>0){let w=t.get("__ROW_PATH_0__"),M=It(w?.values,m,f,i[0]??"",s.numericType==="date"||s.numericType==="datetime");M&&(c=M.categoryPositions,p=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=It(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]),E=M.values,I=M.valid;for(let S=0;S<m;S++){let D=S+f;if(I&&!(I[D>>3]>>(D&7)&1))continue;let k=E[D];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:p,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 p=n[c][o]??"",b=s.get(p);b===void 0&&(b=r.length,r.push(p),s.set(p,b)),l[c]=b,a[c]=p,p.length>u&&(u=p.length)}let f=o===t-1?[]:no(l,r,0,e.length);i.push({labels:a,runs:f,maxLabelChars:u})}return i}it();ji();Fn();Pe();de();Tt();Ht();Kt();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.M(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.j)),c=Math.min(n.numRows-1,Math.floor(t.ee));if(c<f)return;let p=r.length,b=u.x;for(let h=p-1;h>=0;h--){let x=r[h],y=m[h],C=b,_=b-y.size;b=_,h===p-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 p=ud(n,f);if(!p)continue;let b=wt(e,p,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 p=fn(t,c.endIdx+.5),b=fn(t,c.startIdx-.5),g=Math.min(p,b),h=Math.max(p,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 p=fn(t,c.endIdx+.5),b=fn(t,c.startIdx-.5),g=Math.min(p,b),h=Math.max(p,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())}}we();Nn();He();ge();Vt();Nt();In();we();be();function Es(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);Is(e,l,o);return}Is(e,null,-1);return}if(!e.u)return;let i=Su(e.u,e.Mt,e.Rt,e.ki,e.Ft,e.vn,e.tt?.bandWidth??1,e.gt?.bandWidth??1,t,n);Is(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.$,p=e.j,b=e.ee,g=f+(a-m.x)/m.width*(c-f),h=b-(u-m.y)/m.height*(b-p),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 Is(e,t,n){let i=e.Ve;(i?.xIdx??-1)===(t?.xIdx??-1)&&(i?.yIdx??-1)===(t?.yIdx??-1)&&e.Jn===n||(e.Ve=t,e.Jn=n,e.i&&e.Lo&&e.Lo())}function Iu(e,t){let n=[];for(let i of e){let o=i.labels[t];o!=null&&o!==""&&n.push(o)}return n.join(" / ")}function Ds(e){if(!e.l||!e.Ve)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.tt}let a=e.Ve,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]):Iu(n,a.xIdx),c=Iu(i,a.yIdx);f&&m.push([f]),c&&m.push([c]);let p=e.getColumnFormatter(e.L[0],"value");m.push(["Value",p(a.value)]);let b=e.v(),g=e.i?.dpr??1,h=t.M(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.$,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}),ze(e.l,t,b,g,y,e.t.tooltip_opacity),Ue(e.l,u,m,t,b,g,ie(e.t))}var Ps={skipLeafLevel:!0};function Eu(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=tt(e.t,!0,80,0),c=m?55:Ru(a,Ps),p=u?24:Ye(l,Math.max(1,o-c-30-f)),b=new oe(o,r,{hasXLabel:e.h.length>0,hasYLabel:!1,hasLegend:!0,bottomExtra:p,leftExtra:c,rightExtra:f});e.u=b,e._&&e._.updateLayout(b);let g=u?e.tt.min:-.5,h=u?e.tt.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.F,e.S),v=b.e,A=v.width/(C.xMax-C.xMin),L=v.height/(C.yMax-C.yMin),T=s.$o*.5,w=u?e.tt.bandWidth:1,M=m?e.gt.bandWidth:1,E=Math.min(w*.5,A>0?T/A:0),I=Math.min(M*.5,L>0?T/L:0);if(e.K){let S=ce(e.K,b,t.dpr)}Du(e,t),Pu(e,t),e.se=Sn(t,e.se,s.N),ot(n,b,t.dpr,()=>{n.useProgram(e.o);let S=e.D;n.uniformMatrix4fv(S.u_projection,!1,_),n.uniform2f(S.u_cell_inset,E,I),n.uniform2f(S.u_cell_size,w,M),Ve(t,e.se.texture,S.u_gradient_lut,0),Bu(e,n,t,0,e.br)}),e._e(()=>nr(e))}function Du(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.D=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]=_t(f.value,e.p,e.c),r++}}else{let r=e.Ft,s=e.vn,l=e.F,a=e.S;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]=_t(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.D,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.tt){let m=K(t.O,t.$,6);$o(o,t,e.tt,m,n,e.getColumnFormatter(l,"tick"))}else xe(o,t,r,n);if(e.Qn.mode==="numeric"&&e.gt){let m=K(t.j,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.R.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.R,title:e.Kt,opacity:e.t.legend_opacity};u==="floating"?Xe(e.l,e.R.floatingBox(e.t,t.cssWidth,t.cssHeight,Rt(e.l,n,m,f,e.Kt)),m,n.N,n,f,c):Jt(e.l,t,m,n.N,n,f,c)}e.Ve&&Ds(e)}function dd(e,t,n,i){let o=t.gl,r=e.v(),{effectiveSharedX:s,effectiveSharedY:l}=e.computeEffectiveFacetFlags(),a=Ee(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:Te(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),Du(e,t),Pu(e,t),e.se=Sn(t,e.se,r.N),o.useProgram(e.o);let u=e.D;Ve(t,e.se.texture,u.u_gradient_lut,0),vt(o);for(let m=0;m<e.d.length;m++){let f=e.d[m];if(f.instanceCount===0)continue;let{numX:c,numY:p}=f.pipeline;if(c===0||p===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:p-.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),E=r.$o*.5,I=g?f.pipeline.xNumericDomain.bandWidth:1,S=h?f.pipeline.yNumericDomain.bandWidth:1,D=Math.min(I*.5,w>0?E/w:0),k=Math.min(S*.5,M>0?E/M:0);At(o,b,t.dpr,()=>{o.uniformMatrix4fv(u.u_projection,!1,L),o.uniform2f(u.u_cell_inset,D,k),o.uniform2f(u.u_cell_size,I,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],p=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||p.isBottomEdge)if(c.pipeline.xAxisMode.mode==="numeric"&&c.pipeline.xNumericDomain){let _=K(b.O,b.$,6);$o(i,b,c.pipeline.xNumericDomain,_,t,e.getColumnFormatter(y,"tick"))}else xe(i,b,h,t);if(!r||p.isLeftEdge)if(c.pipeline.yAxisMode.mode==="numeric"&&c.pipeline.yNumericDomain){let _=K(b.j,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],p=e.d[f];!p||!c.titleRect||Ut(e.l,p.label,c.titleRect,t,n)}let l=se(e.t,0),a=l==="floating",u=e.d[0].layout,m=a?e.R.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?Xe(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.R,title:e.Kt,sidebarGutter:a?void 0:s.legendRect?.width,opacity:e.t.legend_opacity}):e.R.clearPainted(),e.Ve&&Ds(e)}var ir=class extends Ie{constructor(){super(...arguments);d(this,"o",null);d(this,"D",null);d(this,"H",null);d(this,"se",null);d(this,"Zt",[]);d(this,"qt",[]);d(this,"To",[]);d(this,"Mt",0);d(this,"Rt",0);d(this,"bt",0);d(this,"St",{mode:"category"});d(this,"Qn",{mode:"category"});d(this,"Ft",null);d(this,"vn",null);d(this,"tt",null);d(this,"gt",null);d(this,"F",0);d(this,"S",0);d(this,"ot",[]);d(this,"ki",[]);d(this,"br",0);d(this,"p",0);d(this,"c",1);d(this,"Kt","");d(this,"Ve",null);d(this,"u",null);d(this,"dr",0);d(this,"pr",0);d(this,"d",[]);d(this,"b",null);d(this,"Jn",-1);d(this,"Lo",()=>nr(this))}colorScaleColumn(){return this.L[0]||null}tooltipCallbacks(){return{onHover:(n,i)=>Es(this,n,i),onLeave:()=>{this.Ve&&(this.Ve=null,this.Lo())},onPin:(n,i)=>{Es(this,n,i),this.Ve&&this.Er(this.Ve.xIdx,this.Ve.yIdx)},onUnpin:()=>{this.emitUnselect()}}}async Er(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 p=ws({columns:c.columns,numRows:r,groupBy:this.h,splitBy:this.B,groupByTypes:this.vt}),b=u.length;for(let g of p.cells)u.push({xIdx:g.xIdx,yIdx:g.yIdx,value:g.value});a.push({label:c.label,pipeline:p,layout:new oe(1,1,{hasXLabel:!1,hasYLabel:!1,hasLegend:!1}),instanceStart:b,instanceCount:p.cells.length,xOrigin:p.xNumericDomain?.min??0,yOrigin:p.yNumericDomain?.min??0}),isFinite(p.colorMin)&&p.colorMin<m&&(m=p.colorMin),isFinite(p.colorMax)&&p.colorMax>f&&(f=p.colorMax)}!isFinite(m)||!isFinite(f)?(m=0,f=1):m===f&&(f=m+1),this.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.tt=null,this.gt=null,this.F=0,this.S=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.tt=l.xNumericDomain,this.gt=l.yNumericDomain,this.F=l.xNumericDomain?.min??0,this.S=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||Eu(this,n)}destroyInternal(){this.H&&this.i&&this.i.gl.deleteBuffer(this.H),this.o=null,this.D=null,this.H=null,this.Zt=[],this.qt=[],this.To=[],this.ot=[],this.ki=[],this.Ve=null,this.d=[],this.b=null,this.Jn=-1,this.St={mode:"category"},this.Qn={mode:"category"},this.Ft=null,this.vn=null,this.tt=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]||"",p=i[2]||"",b=i[3]||"",g=[];if(r.length>0){let U=[f];c&&U.push(c),p&&U.push(p),b&&U.push(b);for(let Y of nt(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=It(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,E=w.halfWidth*T,I=(_-1)/2,S=[];for(let U=0;U<_;U++){let Y=g[U],q=dt=>Y===""?dt:`${Y}|${dt}`,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 Be=c?t.get(q(c)):null,Re=p?t.get(q(p)):null,Fe=b?t.get(q(b)):null;S.push({openCol:me.values,closeCol:Be?.values??null,highCol:Re?.values??null,lowCol:Fe?.values??null,openValid:me.valid??null,closeValid:Be?.valid??null,highValid:Re?.valid??null,lowValid:Fe?.valid??null})}let D=y*_,k=bd(u??null,D),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,Be=Y.highCol,Re=Y.lowCol,Fe=Y.openValid,dt=Y.closeValid,bn=Y.highValid,gn=Y.lowValid,hn=(U-I)*M;for(let ve=0;ve<H;ve++){let ae=ve+C;if(Fe&&!(Fe[ae>>3]>>(ae&7)&1))continue;let ee=q[ae];if(!isFinite(ee))continue;let re;if(me&&(!dt||(dt[ae>>3]>>(ae&7)&1)!==0)){let J=me[ae];re=isFinite(J)?J:ee}else{let J=ve<H-1?ve+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 Ge;if(Be&&(!bn||(bn[ae>>3]>>(ae&7)&1)!==0)){let J=Be[ae];Ge=isFinite(J)?J:ee>re?ee:re}else Ge=ee>re?ee:re;let We;if(Re&&(!gn||(gn[ae>>3]>>(ae&7)&1)!==0)){let J=Re[ae];We=isFinite(J)?J:ee<re?ee:re}else We=ee<re?ee:re;let dr=(A?A[ve]:ve)+hn,ke=re>=ee?1:0;k.catIdx[W]=ve,k.splitIdx[W]=U,k.seriesId[W]=U,k.xCenter[W]=dr,k.halfWidth[W]=E,k.open[W]=ee,k.close[W]=re,k.high[W]=Ge,k.low[W]=We,k.isUp[W]=ke,W++,We<V&&(V=We),Ge>N&&(N=Ge)}}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}}}it();ge();Fn();Nt();be();In();we();Kt();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,ct(e));return}let r=i.e,s=i.O,l=i.$,a=i.j,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,ct(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),p=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(_,p),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],E=g[w],I=m>=M-E&&m<=M+E,S=Math.abs(m-M)<=p;if(!I&&!S)continue;let D=h[w],k=x[w],W=D<k?D:k,V=D<k?k:D,N=I&&f>=W&&f<=V,H=f>=C[w]&&f<=y[w];if(N||H){T=w;break}}T!==e.we&&(e.we=T,ct(e))}function Nu(e,t){e.T.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.M(o,r),l=e.u.cssWidth,a=e.u.cssHeight;e.T.pin(i,s,{cssWidth:l,cssHeight:a},ie(e.t)),e.we=-1,ct(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"),p=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",p(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()},p;if(l)p=new oe(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:24});else{let v=Math.max(1,o-71-16),A=Ye(c,v);p=new oe(o,r,{hasXLabel:f,hasYLabel:!0,hasLegend:!1,bottomExtra:A})}e.u=p,e._&&e._.updateLayout(p);let b=p.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.K&&qo(e.K,p,g,s,t.dpr),ot(n,p,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.Be=l?K(m.xMin,m.xMax,6):null,e._e(()=>ct(e))}function ct(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.Be)n={mode:"numeric",domain:{min:e.I.min,max:e.I.max,isDate:e.I.isDate,label:e.I.label},ticks:e.Be};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.M(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.M(o,f),p=[],b;if(e.Le==="numeric"&&e.I&&e.V?b=(e.getColumnFormatter(e.h[0],"tick")??fe(e.I.isDate,e.Be))(e.V[n.catIdx[t]]):b=Ws(e,n.catIdx[t]),b!==""&&p.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);p.push({side:"left",px:c.px,py:c.py,text:g(f)})}ze(e.l,i,a,u,p,e.t.tooltip_opacity),Ue(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 p=u[c];p<t||p>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}}Pe();de();var or=class{constructor(){d(this,"o",null);d(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=lt(n),a={...j(t,"line-uniform",qe,Ke,["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(),E=r.createBuffer();this.r={bodyCount:0,upWickCount:0,downWickCount:0,upWickBuffer:M,downWickBuffer:E};return}let l=new Float32Array(i.count*7),a=0,u=0,m=i.xCenter,f=i.halfWidth,c=i.open,p=i.close,b=i.isUp,g=t.Oi,h=t.Ui;for(let M=0;M<i.count;M++){let E=c[M],I=p[M],S=E<I?E:I,D=E<I?I:E,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]=D,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 E=m[M]-s,I=v[M],S=A[M];b[M]!==0?(x[C+0]=E,x[C+1]=I,x[C+2]=E,x[C+3]=S,C+=4):(y[_+0]=E,y[_+1]=I,y[_+2]=E,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)}Pe();de();var rr=class{constructor(){d(this,"o",null);d(this,"r",null)}ensureProgram(t){if(this.o)return this.o;let n=t.gl,i=lt(n),o=j(t,"line-uniform",qe,Ke,["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,p=0,b=0;for(let A=0;A<i.count;A++)c[A]!==0?p++:b++;let g=new Float32Array(p*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],E=m[A],I=l[A],S=c[A]!==0?g:h,D=c[A]!==0?x:y;S[D++]=L,S[D++]=M,S[D++]=L,S[D++]=E,S[D++]=L-I,S[D++]=T,S[D++]=L,S[D++]=T,S[D++]=L,S[D++]=w,S[D++]=L+I,S[D++]=w,c[A]!==0?x=D:y=D}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:p*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);d(this,"D",null);d(this,"ge",[]);d(this,"f",[]);d(this,"Te",ei());d(this,"ei",{min:0,max:1});d(this,"Hi",null);d(this,"Le","category");d(this,"I",null);d(this,"V",null);d(this,"Be",null);d(this,"ce",0);d(this,"Oi",[0,.8,.4]);d(this,"Ui",[.8,.2,.2]);d(this,"Ni",null);d(this,"we",-1);d(this,"wo",-1);d(this,"Y",{bodyWick:new or,ohlc:new rr});d(this,"Ci",!0);d(this,"wt",null)}tooltipCallbacks(){return{onHover:(n,i)=>Bs(this,n,i),onLeave:()=>{this.we!==-1&&(this.we=-1,ct(this))},onPin:(n,i)=>{if(Bs(this,n,i),this.we>=0){let o=this.we;Nu(this,o),this.Dr(o)}},onUnpin:()=>{this.emitUnselect()}}}async Dr(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.D=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()=>ft,"y-line":async()=>ft,"y-scatter":async()=>ft,"y-area":async()=>ft,"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,p=l[u];p!==null?i.set(m,{type:"string",indices:f,dictionary:p,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)})}Di();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){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,"Vi",null);d(this,"Cr",null);d(this,"An",null);d(this,"Mo",0);d(this,"Ro",!1);d(this,"client");d(this,"view");d(this,"table");d(this,"controlPort");d(this,"Fo",0);d(this,"Ln",null);d(this,"So",0);d(this,"Io",0);if(this.client=n,this.view=i,this.table=o,this.controlPort=r,this.chartImpl=new s,t.tileSource&&Qe.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 Ii(m=>this.post(m)))}setViewByName(t){this.view=this.client.__unsafe_open_view(t),this.chartImpl.setView?.(this.view)}setPluginConfig(t,n){n&&Qe.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(){Dl(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?.R,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.T()?.dispatchLeave()})}onInteraction(t){try{this.Or(t)}catch(n){this.Ln=null,this.chartImpl?.R?.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.Io=t.my;break}case"pointermove":{if(this.Ln){let i=t.mx-this.So,o=t.my-this.Io;this.So=t.mx,this.Io=t.my,tl(this.Ln,i,o),this.chartImpl.requestRender(this.glManager),this.post({kind:"zoomChanged",isDefault:this.allZoomsDefault()})}else this.T()?.dispatchHover(t.mx,t.my);break}case"pointerup":{this.Ln=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}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 z=null;async function Je(){if(z)return z;let r=new Blob([Te],{type:"application/javascript"});return z=URL.createObjectURL(r),z}var Q=Je;var P=null,O=new Map,Qe=0;async function et(){return P||(P=(async()=>{let r=await Q(),e=new Worker(r,{type:"module",name:"viewer-charts"});e.addEventListener("message",i=>{let n=i.data;O.get(n.sessionId)?.(n.msg)});let t=!1;return e.addEventListener("error",i=>{if(t)return;t=!0,P=null;let l=`perspective-viewer-charts renderer worker error: ${i.message||`failed to load ${r}`}`;console.error(l,i.error??"");let o={kind:"error",message:l};for(let a of O.values())a(o)}),e})(),P)}var U=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();C==="worker"&&(this._proxyChannel=new MessageChannel,this._proxySession=this._client.new_proxy_session(d=>{let x=d.slice().buffer;this._proxyChannel.port1.postMessage(x,[x])}),this._proxyChannel.port1.addEventListener("message",d=>{this._proxySession.handle_request(new Uint8Array(d.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(),a=window.devicePixelRatio||1,s=I(e.gl),h=C==="worker"?ve():[],c=C==="worker"?this._clientWasm:void 0,m=C==="worker"?this._clientWorkerURL:void 0,u=C==="worker"?this._proxyChannel.port2:void 0,f={kind:"init",renderMode:e.renderBlitMode,glCanvas:i,gridlinesCanvas:n,chromeCanvas:l,proxyPort:u,clientWorkerURL:m,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)),C==="worker"){let d=[this._proxyChannel.port2];l&&d.unshift(l),n&&d.unshift(n),i&&d.unshift(i),this._handle.post(f,d)}await this._ready}async _createHandle(e,t){if(C==="worker"){let l=await et(),o=++Qe;return{post:(a,s)=>l.postMessage({sessionId:o,msg:a},s),addMessageListener:a=>{O.set(o,a)},terminate:()=>{O.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,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(),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=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,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.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 N(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 W(this._hostGlCanvas,e),this._hostSink)}};function tt(r){return isFinite(r)?r<0?0:r>1?1:r:.5}function Re(r){return!isFinite(r)||r<0?1:r}function Ee(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=ue(t),n=[];for(let l=1;;l++){let o=r[`--psp-charts--series-${l}--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:tt(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 it(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=fe(r,n);t[i]=[l[0],l[1],l[2]]}return t}function ee(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 it(e,t)}var nt={...pe};function Pe(r){return p.register(r)}var rt={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(r=>({value:r.id,label:r.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:"Alignment",corners:!0},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(r,e){let t=rt[r];return{...typeof t=="function"?t():t,key:r,default:e[r]}}var lt=[{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:v},{key:"tooltip",fields:_}],ot=(()=>{let r=new CSSStyleSheet;return r.replaceSync(de),[r]})(),Fe=Me;function Ie(r){return r==="integer"||r==="float"?[{kind:"NumberFormat",default:xe}]:r==="datetime"?[{kind:"DatetimeFormat",default:ye}]:r==="date"?[{kind:"DatetimeFormat",default:be}]:[]}var H=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{..._e,...this._chartType.plugin_field_defaults??{}}}connectedCallback(){if(!this._initialized){this.attachShadow({mode:"open"});for(let e of ot)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}),l=customElements.get("perspective-viewer"),o=l.get_wasm_module(),a=l.get_worker_url(),s=await t?.getTable?.({panel:i}),h=s?await s.get_name():void 0,c=this.shadowRoot.querySelector(".zoom-controls"),m=new U({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 m.init({gl:this._glCanvas,gridlines:this._gridlineCanvas,chrome:this._chromeCanvas,facetConfig:{...nt,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}),m}static setBlitMode(e){Fe=e}static registerTileSource(e){return Pe(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,l,o,a){let s=[];if(a==="group_by"||a==="split_by")return{fields:Ie(e)};t==="Color"&&((this._chartType.category==="Hierarchical Charts"?e==="integer"||e==="float"||e==="date"||e==="datetime":e!=="string")?s.push({kind:"GradientStops",key:"gradient",default:this._themeGradientStopsSpec()}):s.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()}));let h=this._chartType.default_chart_type;if(h&&(e==="integer"||e==="float")){let c=h==="bar"||h==="line"||h==="scatter"||h==="area";if(c)if((l?.split_by?.length??0)>0)s.push({kind:"Palette",key:"palette",default:this._themeSeriesPaletteHex()});else{let x=(l?.columns??[]).filter(T=>!!T).indexOf(i);s.push({kind:"Color",key:"color",default:this._themeSeriesColorHex(Math.max(0,x))})}s.push({kind:"Enum",key:"chart_type",default:h,variants:[{value:"bar",label:"Bar"},{value:"line",label:"Line"},{value:"scatter",label:"Scatter"},{value:"area",label:"Area"}]});let m=n?.chart_type??h,u=m==="bar"||m==="area";if(u&&s.push({kind:"Bool",key:"stack",default:u}),c&&s.push({kind:"Bool",key:"alt_axis",default:!1}),m==="line"||m==="area"){let d=m==="area"?[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"}]:[{value:"skip",label:"Skip"},{value:"solid",label:"Solid"},{value:"transparent",label:"Transparent"}];s.push({kind:"Enum",key:"interpolate",default:"solid",variants:d})}}return s.push(...Ie(e)),{fields:s}}plugin_config_schema(e){let t=this._effectiveDefaults(),i=this._chartType.applicable_plugin_fields,n=new Set(i),l=new Set,o=[];for(let s of lt){let h=s.fields.filter(c=>n.has(c));if(h.length>=1){for(let c of h)l.add(c);o.push({kind:"Group",key:s.key,fields:h.map(c=>Se(c,t))})}}return{fields:[...i.filter(s=>!l.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||r.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 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 st(...r){let e=new Set(r.length>0?r:q.map(i=>i.name)),t=[];q.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 H{_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).`)}st();export{N as PerspectiveSelectDetail,st as register,Pe as registerTileSource,$e as tileSources};
|
|
2
2
|
//# sourceMappingURL=perspective-viewer-charts.js.map
|