blockcharts 0.0.1 → 0.0.2

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.
Files changed (73) hide show
  1. package/README.md +171 -169
  2. package/package.json +1 -1
  3. package/release/blocks/guide.axis.js +2 -2
  4. package/release/blocks/guide.grid.js +2 -2
  5. package/release/blocks/guide.kpi.js +2 -2
  6. package/release/blocks/guide.legend.js +2 -2
  7. package/release/blocks/interaction.animate.js +2 -2
  8. package/release/blocks/interaction.brush.js +2 -2
  9. package/release/blocks/interaction.crosshair.js +2 -2
  10. package/release/blocks/interaction.legend-filter.js +2 -2
  11. package/release/blocks/interaction.tooltip.js +2 -2
  12. package/release/blocks/interaction.zoom-controls.js +2 -2
  13. package/release/blocks/interaction.zoom.js +2 -2
  14. package/release/blocks/lib.columns.js +2 -2
  15. package/release/blocks/lib.curve.js +2 -2
  16. package/release/blocks/lib.pointer.js +2 -2
  17. package/release/blocks/lib.stats.js +2 -2
  18. package/release/blocks/lib.ticks.js +2 -2
  19. package/release/blocks/lib.view.js +2 -2
  20. package/release/blocks/mark.arc.js +2 -2
  21. package/release/blocks/mark.area.js +2 -2
  22. package/release/blocks/mark.boxplot.js +2 -2
  23. package/release/blocks/mark.candlestick.js +2 -2
  24. package/release/blocks/mark.line.js +2 -2
  25. package/release/blocks/mark.point.js +2 -2
  26. package/release/blocks/mark.polygon.js +2 -2
  27. package/release/blocks/mark.rect.js +2 -2
  28. package/release/blocks/mark.rule.js +2 -2
  29. package/release/blocks/mark.sankey.js +2 -2
  30. package/release/blocks/mark.text.js +2 -2
  31. package/release/blocks/mark.violin.js +2 -2
  32. package/release/blocks/renderer.canvas.js +2 -2
  33. package/release/blocks/renderer.svg.js +2 -2
  34. package/release/blocks/scale.band.js +2 -2
  35. package/release/blocks/scale.color.js +2 -2
  36. package/release/blocks/scale.linear.js +2 -2
  37. package/release/blocks/scale.log.js +2 -2
  38. package/release/blocks/scale.sequential.js +2 -2
  39. package/release/blocks/scale.size.js +2 -2
  40. package/release/blocks/scale.time.js +2 -2
  41. package/release/blocks/transform.aggregate.js +2 -2
  42. package/release/blocks/transform.bin.js +2 -2
  43. package/release/blocks/transform.calculate.js +2 -2
  44. package/release/blocks/transform.calendar.js +2 -2
  45. package/release/blocks/transform.contour.js +2 -2
  46. package/release/blocks/transform.decimate.js +2 -2
  47. package/release/blocks/transform.density.js +2 -2
  48. package/release/blocks/transform.filter.js +2 -2
  49. package/release/blocks/transform.fold.js +2 -2
  50. package/release/blocks/transform.funnel.js +2 -2
  51. package/release/blocks/transform.hexbin.js +2 -2
  52. package/release/blocks/transform.highlight.js +2 -2
  53. package/release/blocks/transform.marimekko.js +2 -2
  54. package/release/blocks/transform.quartiles.js +2 -2
  55. package/release/blocks/transform.sankey.js +2 -2
  56. package/release/blocks/transform.sort.js +2 -2
  57. package/release/blocks/transform.stack.js +2 -2
  58. package/release/blocks/transform.treemap.js +2 -2
  59. package/release/blocks/transform.waterfall.js +2 -2
  60. package/release/blocks/transform.window.js +2 -2
  61. package/release/core.js +3 -3
  62. package/release/kits/basic.js +22 -22
  63. package/release/kits/basic.mjs +22 -22
  64. package/release/kits/composition.js +36 -36
  65. package/release/kits/composition.mjs +36 -36
  66. package/release/kits/dashboard.js +34 -34
  67. package/release/kits/dashboard.mjs +34 -34
  68. package/release/kits/full.js +61 -61
  69. package/release/kits/full.mjs +61 -61
  70. package/release/kits/timeseries.js +32 -32
  71. package/release/kits/timeseries.mjs +32 -32
  72. package/release/loader.js +2 -2
  73. package/release/manifest.json +212 -212
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const Y="var(--bc-text, #444)",j=["x0","x1","y0","y1","thickness","waypoints"],b=n=>Math.round(n*100)/100,q=n=>n!=null&&n!=="",T=(n,e)=>typeof n.nodeWidth=="number"&&n.nodeWidth>0?Math.min(n.nodeWidth,e.plot.w/4):12;function V(n,e){const a=n.layout;if(a!==void 0&&!(Array.isArray(a)&&(a.length===5||a.length===6)&&a.every(i=>typeof i=="string"&&i)))throw new Error('mark.sankey: "layout" must be six column names: [x0, x1, y0, y1, thickness, waypoints] (five keep "waypoints")');const l=a===void 0?j:a.concat(a.length===5?[j[5]]:[]),c=l.map(i=>e.table.columns[i]),r=l.slice(0,5).find((i,t)=>!c[t]);if(r!==void 0)throw new Error(`mark.sankey: there is no column "${r}" with the layout of the flows: put a sankey transform before it`);const[m,u,h,o,d,w]=c,k=e.channel(n,"source").raw,x=e.channel(n,"target").raw,p=e.channel(n,"value").raw,{x:g,y:f,w:M,h:v}=e.plot,W=T(n,e),{from:$,to:P}=e.rows(n),B=new Map,H=[],O=i=>typeof i=="number"&&isFinite(i)?i:NaN;for(let i=$;i<P;i++){const t=p[i],[s,y,A,E,L]=[O(m[i]),O(u[i]),O(h[i]),O(o[i]),O(d[i])];if(typeof t!="number"||!(t>0)||!q(k[i])||!q(x[i])||!(isFinite(s)&&isFinite(y)&&isFinite(A)&&isFinite(E)&&L>=0))continue;const G=(_,R)=>{let F=B.get(_);return F||(F={name:_,order:B.size,value:0,x:g+R*(M-W),y:0,h:0,color:"",ins:[],outs:[],top:1/0,inH:0,outH:0,inV:0,outV:0},B.set(_,F)),F},I=G(String(k[i]),s),N=G(String(x[i]),y);if(I===N)continue;const S=w?w[i]:null,X=[];if(Array.isArray(S)&&S.length%2===0&&S.every(_=>typeof _=="number"&&isFinite(_)))for(let _=0;_<S.length;_+=2)X.push({x:g+S[_]*(M-W),y:f+(S[_+1]+L/2)*v});const Z={row:i,from:I,to:N,value:t,thick:L*v,y0:f+(A+L/2)*v,y1:f+(E+L/2)*v,via:X};H.push(Z),I.outs.push(Z),N.ins.push(Z),I.top=Math.min(I.top,A),N.top=Math.min(N.top,E),I.outH+=L,N.inH+=L,I.outV+=t,N.inV+=t}if(!H.length)return null;const D=Array.from(B.values());for(const i of D)i.y=f+i.top*v,i.h=Math.max(i.inH,i.outH)*v,i.value=Math.max(i.inV,i.outV),i.color=e.color(i.order);return{nodes:D,links:H}}function U(n,e){const a=[];let l=n.from.x+e,c=n.y0;for(const r of n.via)a.push({xa:l,ya:c,xb:r.x,yb:r.y}),l=r.x+e,c=r.y;return a.push({xa:l,ya:c,xb:n.to.x,yb:n.y1}),a}function z(n,e){const a=n.thick/2,l=U(n,e),c=(u,h,o,d)=>{const w=b((u+o)/2);return`C${w} ${b(h)} ${w} ${b(d)} ${b(o)} ${b(d)}`};let r=`M${b(l[0].xa)} ${b(l[0].ya-a)}`;l.forEach((u,h)=>{h&&(r+=`L${b(u.xa)} ${b(u.ya-a)}`),r+=c(u.xa,u.ya-a,u.xb,u.yb-a)});const m=l[l.length-1];r+=`L${b(m.xb)} ${b(m.yb+a)}`;for(let u=l.length-1;u>=0;u--){const h=l[u];u<l.length-1&&(r+=`L${b(h.xb)} ${b(h.yb+a)}`),r+=c(h.xb,h.yb+a,h.xa,h.ya+a)}return r+"Z"}function J(n,e,a){const l=U(n,e);for(let c=0;c<l.length;c++){const{xa:r,ya:m,xb:u,yb:h}=l[c];if(c&&a<r)return m;if(a<r||a>u)continue;const o=(r+u)/2,d=g=>{const f=1-g;return f*f*f*r+3*f*g*(f+g)*o+g*g*g*u};let w=0,k=1;for(let g=0;g<20;g++){const f=(w+k)/2;d(f)<a?w=f:k=f}const x=(w+k)/2,p=1-x;return(p*p*p+3*p*p*x)*m+(3*p*x*x+x*x*x)*h}return NaN}function C(n,e,a,l,c){const r=o=>n.measure(o,12).w,m=[[e]],u=e.split(/\s+/).filter(Boolean);let h=null;for(let o=1;o<u.length;o++){const d=[u.slice(0,o).join(" "),u.slice(o).join(" ")];(!h||Math.max(...d.map(r))<Math.max(...h.map(r)))&&(h=d)}h&&m.push(h);for(const o of m){const d=o[o.length-1],w=a===null?[o]:[o.slice(0,-1).concat(`${d} ${a}`),o.concat(a)];for(const k of w)if(k.length<=c&&k.every(x=>r(x)<=l))return k}return null}function K(n,e,a){const l=r=>n.measure(r,12).w<=a;if(l(e))return e;const c=Array.from(e);for(let r=c.length-1;r>0;r--){const m=c.slice(0,r).join("").trimEnd()+"\u2026";if(l(m))return m}return""}const Q={role:"mark",type:"sankey",version:7,params:{nodeWidth:{kind:"number",default:12},format:{kind:"format"},linkOpacity:{kind:"number",default:.35},nodeLabels:{kind:"list"},layout:{kind:"list"},labelMin:{kind:"number",default:11}},channels:{source:{required:!0,unscaled:!0},target:{required:!0,unscaled:!0},value:{required:!0,unscaled:!0}},render(n,e,a){const l=V(n,e);if(!l)return[];const c=T(n,e),r=typeof n.linkOpacity=="number"?n.linkOpacity:.35,m=typeof n.labelMin=="number"?n.labelMin:11,u=n.format!==void 0?e.format(n.format):null,h=[];for(const t of l.links.slice().sort((s,y)=>y.thick-s.thick||s.row-y.row))h.push({type:"path",d:z(t,c),style:{fill:t.from.color,opacity:r},ref:{mark:a,row:t.row}});const o=e.plot.x+e.plot.w,d=Array.from(new Set(l.nodes.map(t=>t.x))).sort((t,s)=>t-s),w=(d.length>1?d[1]-d[0]:e.plot.w)-c-12,k=t=>t.x+c>=o-.5&&l.nodes.some(s=>s.x<t.x),x=t=>u?u(t.value):null,p=t=>Math.max(1,Math.floor(t.h/15)),g=l.nodes.filter(t=>t.h>=m),f=new Map(g.map(t=>[t,w])),M=new Map,v=()=>{const t=g.every(s=>C(e,s.name,x(s),f.get(s),p(s))!==null);for(const s of g){const y=f.get(s);M.set(s,C(e,s.name,t?x(s):null,y,p(s))||[K(e,s.name,y)].filter(Boolean))}};v();const W=d[d.length-2],$=new Map,P=t=>M.get(t).length*15,B=t=>t.y+t.h/2+($.get(t)||0),H=(t,s)=>Math.max(0,(t.h-P(t))/2)*s-($.get(t)||0),O=t=>({w:M.get(t).reduce((s,y)=>Math.max(s,e.measure(y,12).w),0),top:B(t)-P(t)/2,bottom:B(t)+P(t)/2}),D=t=>{for(const s of g.filter(y=>y.x===W&&!k(y)))for(const y of g.filter(k)){const A=O(s),E=O(y),L=Math.min(A.bottom,E.bottom)-Math.max(A.top,E.top);L>0&&A.w+E.w+6>w&&t(s,y,L)}};D((t,s,y)=>{const[A,E]=B(t)<=B(s)?[t,s]:[s,t],L=y+2,G=-H(A,-1),I=H(E,1);if(G+I<L)return;const N=Math.min(G,Math.max(L/2,L-I));$.set(A,($.get(A)||0)-N),$.set(E,($.get(E)||0)+(L-N))});let i=!1;D((t,s)=>{f.set(t,(w-6)/2),f.set(s,(w-6)/2),$.delete(t),$.delete(s),i=!0}),i&&v();for(const t of l.nodes){h.push({type:"rect",x:b(t.x),y:b(t.y),w:c,h:b(Math.max(1,t.h)),style:{fill:t.color}});const s=M.get(t);if(!s)continue;const y=k(t);s.forEach((A,E)=>h.push({type:"text",x:b(y?t.x-6:t.x+c+6),y:b(B(t)+(E-(s.length-1)/2)*15),text:A,size:12,anchor:y?"end":"start",baseline:"middle",style:{fill:Y}}))}return h},pick(n,e,a,l,c){const r=V(n,e);if(!r)return null;const m=T(n,e);for(const o of r.nodes){if(l<o.x||l>o.x+m||c<o.y||c>o.y+Math.max(1,o.h))continue;const d=Array.isArray(n.nodeLabels)?n.nodeLabels:[],w=(f,M)=>typeof d[f]=="string"?d[f]:M,k=n.format!==void 0?e.format(n.format):f=>String(+f.toPrecision(6)),x=f=>f.reduce((M,v)=>M+v.value,0),p=[];return o.ins.length&&p.push([w(0,"In"),k(x(o.ins))]),o.outs.length&&p.push([w(1,"Out"),k(x(o.outs))]),{row:(o.outs[0]||o.ins[0]).row,x:o.x+m/2,y:o.y+o.h/2,dist:0,box:{x:o.x,y:o.y,w:m,h:Math.max(1,o.h)},card:{title:o.name,color:o.color,lines:p},flows:o.ins.concat(o.outs).map(f=>({d:z(f,m),fill:f.from.color}))}}let u=null,h=0;for(const o of r.links){const d=J(o,m,l);isNaN(d)||Math.abs(c-d)<=Math.max(o.thick,2)/2&&(!u||o.thick<u.thick)&&(u=o,h=d)}return u?{row:u.row,x:l,y:h,dist:0}:null},color(n,e,a,l){const c=V(n,e),r=c?c.links.find(m=>m.row===l):void 0;return r?r.from.color:""}};BC.define(Q)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(Y){const J="var(--bc-text, #444)",j=["x0","x1","y0","y1","thickness","waypoints"],b=n=>Math.round(n*100)/100,q=n=>n!=null&&n!=="",F=(n,e)=>typeof n.nodeWidth=="number"&&n.nodeWidth>0?Math.min(n.nodeWidth,e.plot.w/4):12;function V(n,e){const a=n.layout;if(a!==void 0&&!(Array.isArray(a)&&(a.length===5||a.length===6)&&a.every(i=>typeof i=="string"&&i)))throw new Error('mark.sankey: "layout" must be six column names: [x0, x1, y0, y1, thickness, waypoints] (five keep "waypoints")');const l=a===void 0?j:a.concat(a.length===5?[j[5]]:[]),c=l.map(i=>e.table.columns[i]),r=l.slice(0,5).find((i,t)=>!c[t]);if(r!==void 0)throw new Error(`mark.sankey: there is no column "${r}" with the layout of the flows: put a sankey transform before it`);const[m,u,h,o,d,w]=c,k=e.channel(n,"source").raw,x=e.channel(n,"target").raw,p=e.channel(n,"value").raw,{x:g,y:f,w:M,h:v}=e.plot,T=F(n,e),{from:$,to:P}=e.rows(n),B=new Map,H=[],O=i=>typeof i=="number"&&isFinite(i)?i:NaN;for(let i=$;i<P;i++){const t=p[i],[s,y,A,E,L]=[O(m[i]),O(u[i]),O(h[i]),O(o[i]),O(d[i])];if(typeof t!="number"||!(t>0)||!q(k[i])||!q(x[i])||!(isFinite(s)&&isFinite(y)&&isFinite(A)&&isFinite(E)&&L>=0))continue;const G=(_,tt)=>{let W=B.get(_);return W||(W={name:_,order:B.size,value:0,x:g+tt*(M-T),y:0,h:0,color:"",ins:[],outs:[],top:1/0,inH:0,outH:0,inV:0,outV:0},B.set(_,W)),W},I=G(String(k[i]),s),N=G(String(x[i]),y);if(I===N)continue;const S=w?w[i]:null,X=[];if(Array.isArray(S)&&S.length%2===0&&S.every(_=>typeof _=="number"&&isFinite(_)))for(let _=0;_<S.length;_+=2)X.push({x:g+S[_]*(M-T),y:f+(S[_+1]+L/2)*v});const Z={row:i,from:I,to:N,value:t,thick:L*v,y0:f+(A+L/2)*v,y1:f+(E+L/2)*v,via:X};H.push(Z),I.outs.push(Z),N.ins.push(Z),I.top=Math.min(I.top,A),N.top=Math.min(N.top,E),I.outH+=L,N.inH+=L,I.outV+=t,N.inV+=t}if(!H.length)return null;const D=Array.from(B.values());for(const i of D)i.y=f+i.top*v,i.h=Math.max(i.inH,i.outH)*v,i.value=Math.max(i.inV,i.outV),i.color=e.color(i.order);return{nodes:D,links:H}}function U(n,e){const a=[];let l=n.from.x+e,c=n.y0;for(const r of n.via)a.push({xa:l,ya:c,xb:r.x,yb:r.y}),l=r.x+e,c=r.y;return a.push({xa:l,ya:c,xb:n.to.x,yb:n.y1}),a}function z(n,e){const a=n.thick/2,l=U(n,e),c=(u,h,o,d)=>{const w=b((u+o)/2);return`C${w} ${b(h)} ${w} ${b(d)} ${b(o)} ${b(d)}`};let r=`M${b(l[0].xa)} ${b(l[0].ya-a)}`;l.forEach((u,h)=>{h&&(r+=`L${b(u.xa)} ${b(u.ya-a)}`),r+=c(u.xa,u.ya-a,u.xb,u.yb-a)});const m=l[l.length-1];r+=`L${b(m.xb)} ${b(m.yb+a)}`;for(let u=l.length-1;u>=0;u--){const h=l[u];u<l.length-1&&(r+=`L${b(h.xb)} ${b(h.yb+a)}`),r+=c(h.xb,h.yb+a,h.xa,h.ya+a)}return r+"Z"}function K(n,e,a){const l=U(n,e);for(let c=0;c<l.length;c++){const{xa:r,ya:m,xb:u,yb:h}=l[c];if(c&&a<r)return m;if(a<r||a>u)continue;const o=(r+u)/2,d=g=>{const f=1-g;return f*f*f*r+3*f*g*(f+g)*o+g*g*g*u};let w=0,k=1;for(let g=0;g<20;g++){const f=(w+k)/2;d(f)<a?w=f:k=f}const x=(w+k)/2,p=1-x;return(p*p*p+3*p*p*x)*m+(3*p*x*x+x*x*x)*h}return NaN}function C(n,e,a,l,c){const r=o=>n.measure(o,12).w,m=[[e]],u=e.split(/\s+/).filter(Boolean);let h=null;for(let o=1;o<u.length;o++){const d=[u.slice(0,o).join(" "),u.slice(o).join(" ")];(!h||Math.max(...d.map(r))<Math.max(...h.map(r)))&&(h=d)}h&&m.push(h);for(const o of m){const d=o[o.length-1],w=a===null?[o]:[o.slice(0,-1).concat(`${d} ${a}`),o.concat(a)];for(const k of w)if(k.length<=c&&k.every(x=>r(x)<=l))return k}return null}function Q(n,e,a){const l=r=>n.measure(r,12).w<=a;if(l(e))return e;const c=Array.from(e);for(let r=c.length-1;r>0;r--){const m=c.slice(0,r).join("").trimEnd()+"\u2026";if(l(m))return m}return""}const R={role:"mark",type:"sankey",version:7,params:{nodeWidth:{kind:"number",default:12},format:{kind:"format"},linkOpacity:{kind:"number",default:.35},nodeLabels:{kind:"list"},layout:{kind:"list"},labelMin:{kind:"number",default:11}},channels:{source:{required:!0,unscaled:!0},target:{required:!0,unscaled:!0},value:{required:!0,unscaled:!0}},render(n,e,a){const l=V(n,e);if(!l)return[];const c=F(n,e),r=typeof n.linkOpacity=="number"?n.linkOpacity:.35,m=typeof n.labelMin=="number"?n.labelMin:11,u=n.format!==void 0?e.format(n.format):null,h=[];for(const t of l.links.slice().sort((s,y)=>y.thick-s.thick||s.row-y.row))h.push({type:"path",d:z(t,c),style:{fill:t.from.color,opacity:r},ref:{mark:a,row:t.row}});const o=e.plot.x+e.plot.w,d=Array.from(new Set(l.nodes.map(t=>t.x))).sort((t,s)=>t-s),w=(d.length>1?d[1]-d[0]:e.plot.w)-c-12,k=t=>t.x+c>=o-.5&&l.nodes.some(s=>s.x<t.x),x=t=>u?u(t.value):null,p=t=>Math.max(1,Math.floor(t.h/15)),g=l.nodes.filter(t=>t.h>=m),f=new Map(g.map(t=>[t,w])),M=new Map,v=()=>{const t=g.every(s=>C(e,s.name,x(s),f.get(s),p(s))!==null);for(const s of g){const y=f.get(s);M.set(s,C(e,s.name,t?x(s):null,y,p(s))||[Q(e,s.name,y)].filter(Boolean))}};v();const T=d[d.length-2],$=new Map,P=t=>M.get(t).length*15,B=t=>t.y+t.h/2+($.get(t)||0),H=(t,s)=>Math.max(0,(t.h-P(t))/2)*s-($.get(t)||0),O=t=>({w:M.get(t).reduce((s,y)=>Math.max(s,e.measure(y,12).w),0),top:B(t)-P(t)/2,bottom:B(t)+P(t)/2}),D=t=>{for(const s of g.filter(y=>y.x===T&&!k(y)))for(const y of g.filter(k)){const A=O(s),E=O(y),L=Math.min(A.bottom,E.bottom)-Math.max(A.top,E.top);L>0&&A.w+E.w+6>w&&t(s,y,L)}};D((t,s,y)=>{const[A,E]=B(t)<=B(s)?[t,s]:[s,t],L=y+2,G=-H(A,-1),I=H(E,1);if(G+I<L)return;const N=Math.min(G,Math.max(L/2,L-I));$.set(A,($.get(A)||0)-N),$.set(E,($.get(E)||0)+(L-N))});let i=!1;D((t,s)=>{f.set(t,(w-6)/2),f.set(s,(w-6)/2),$.delete(t),$.delete(s),i=!0}),i&&v();for(const t of l.nodes){h.push({type:"rect",x:b(t.x),y:b(t.y),w:c,h:b(Math.max(1,t.h)),style:{fill:t.color}});const s=M.get(t);if(!s)continue;const y=k(t);s.forEach((A,E)=>h.push({type:"text",x:b(y?t.x-6:t.x+c+6),y:b(B(t)+(E-(s.length-1)/2)*15),text:A,size:12,anchor:y?"end":"start",baseline:"middle",style:{fill:J}}))}return h},pick(n,e,a,l,c){const r=V(n,e);if(!r)return null;const m=F(n,e);for(const o of r.nodes){if(l<o.x||l>o.x+m||c<o.y||c>o.y+Math.max(1,o.h))continue;const d=Array.isArray(n.nodeLabels)?n.nodeLabels:[],w=(f,M)=>typeof d[f]=="string"?d[f]:M,k=n.format!==void 0?e.format(n.format):f=>String(+f.toPrecision(6)),x=f=>f.reduce((M,v)=>M+v.value,0),p=[];return o.ins.length&&p.push([w(0,"In"),k(x(o.ins))]),o.outs.length&&p.push([w(1,"Out"),k(x(o.outs))]),{row:(o.outs[0]||o.ins[0]).row,x:o.x+m/2,y:o.y+o.h/2,dist:0,box:{x:o.x,y:o.y,w:m,h:Math.max(1,o.h)},card:{title:o.name,color:o.color,lines:p},flows:o.ins.concat(o.outs).map(f=>({d:z(f,m),fill:f.from.color}))}}let u=null,h=0;for(const o of r.links){const d=K(o,m,l);isNaN(d)||Math.abs(c-d)<=Math.max(o.thick,2)/2&&(!u||o.thick<u.thick)&&(u=o,h=d)}return u?{row:u.row,x:l,y:h,dist:0}:null},color(n,e,a,l){const c=V(n,e),r=c?c.links.find(m=>m.row===l):void 0;return r?r.from.color:""}};Y.define(R)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const rn="var(--bc-text, #444)",sn="#111",dn="#fff";function un(n){const l=fn(n),u=typeof n=="string"?/^var\(--bc-c(\d+),/.exec(n):null;return l&&u?`var(--bc-on-c${u[1]}, ${l})`:l}function fn(n){const l=typeof n=="string"?/#([0-9a-f]{6}|[0-9a-f]{3})\b/i.exec(n):null;if(!l)return null;let u=l[1];u.length===3&&(u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]);const d=D=>{const A=parseInt(u.slice(D,D+2),16)/255;return A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4)},y=.2126*d(0)+.7152*d(2)+.0722*d(4);return(y+.05)/(.0056+.05)>=1.05/(y+.05)?sn:dn}function cn(n,l){return n==null?"":typeof n=="number"?isFinite(n)?l!==void 0?n.toFixed(l):Number.isInteger(n)?String(n):String(+n.toPrecision(6)):"":String(n)}const T=4,mn={role:"mark",type:"text",version:14,params:{size:{kind:"number",default:11},weight:{kind:"any"},anchor:{kind:"enum",values:["start","middle","end"],default:"middle"},baseline:{kind:"enum",values:["auto","middle","hanging"],default:"middle"},dx:{kind:"number",default:0},dy:{kind:"number",default:0},rotate:{kind:"number",default:0},decimals:{kind:"number"},format:{kind:"format"},fill:{kind:"color"},negative:{kind:"enum",values:["same","flip"],default:"same"},collide:{kind:"enum",values:["show","hide"],default:"show"},minSize:{kind:"number",default:8}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},text:{required:!0,unscaled:!0},sign:{unscaled:!0},color:{accepts:{output:"color"}},on:{accepts:{output:"color"},sharesScale:"color"}},render(n,l,u){const d=l.channel(n,"x"),y=l.channel(n,"y"),D=l.channel(n,"text").raw,A=n.sign!==void 0?l.channel(n,"sign").raw:null,H=n.color!==void 0?l.channel(n,"color").mapped:null,X=n.on!==void 0?l.channel(n,"on").mapped:null,W=n.format!==void 0?BC.formatter(n.format):null,C=d.half,j=y.half,f=typeof n.size=="number"?n.size:11,c=n.anchor==="start"||n.anchor==="end"?n.anchor:"middle",k=n.baseline==="auto"||n.baseline==="hanging"?n.baseline:"middle",E=typeof n.dx=="number"?n.dx:0,R=typeof n.dy=="number"?n.dy:0,I=typeof n.rotate=="number"&&n.rotate!==0?n.rotate:void 0,hn=typeof n.decimals=="number"&&n.decimals>=0?Math.min(20,Math.floor(n.decimals)):void 0,J=typeof n.weight=="number"||typeof n.weight=="string"?n.weight:void 0,Q=typeof n.fill=="string"?n.fill:rn,O=typeof n.minSize=="number"&&n.minSize>0?Math.min(n.minSize,f):Math.min(8,f),g=n.x2!==void 0?l.channel(n,"x2").mapped:null,b=n.y2!==void 0?l.channel(n,"y2").mapped:null,G=(t,e)=>l.textWidth(t,e,J);let z=0,$=1/0,P=1/0;if(C&&!g&&c==="middle"&&I===void 0&&d.scale){const t=d.scale.domain();z=t.length>1?Math.abs(d.scale(t[1])-d.scale(t[0])):l.plot.w,isFinite(z)&&z>0&&($=z-T,P=b?$:Math.max($,2*(z-C)-T))}const yn=(t,e,s)=>{let m=P,o=1/0;if(g&&I===void 0&&isFinite(g[t])){const a=Math.min(d.mapped[t],g[t]),i=Math.max(d.mapped[t],g[t]),r=Math.abs(E);m=c==="start"?i-e-r:c==="end"?e-a-r:2*Math.min(e-a,i-e)-2*r,m>=0||(m=0)}if(b&&I===void 0&&isFinite(b[t])){const a=Math.min(y.mapped[t],b[t]),i=Math.max(y.mapped[t],b[t]),r=Math.abs(R);o=k==="hanging"?i-s-r:k==="auto"?s-a-r:2*Math.min(s-a,i-s)-2*r,o>=0||(o=0)}return[m,o]},V=n.negative==="flip",F=V&&!!y.half&&!d.half,U=V?A||(F?d:y).raw:null,bn=n.collide==="hide"&&I===void 0,Z=[],v=(t,e,s,m,o,a=c)=>{const i=G(t,o),r=a==="start"?e:a==="end"?e-i:e-i/2,x=m==="hanging"?s:m==="auto"?s-o:s-o/2;return{x0:r,x1:r+i,y0:x,y1:x+o}},nn=t=>!Z.some(e=>t.x0<e.x1&&e.x0<t.x1&&t.y0<e.y1&&e.y0<t.y1),B=t=>t==="auto"?"hanging":t==="hanging"?"auto":t,{from:xn,to:gn}=l.rows(n);let _=[];const K=[],tn=new Set,N=l.plot;for(let t=xn;t<gn;t++){const e=W?W(D[t]):cn(D[t],hn),s=X?X[t]?un(X[t])||Q:"":H?H[t]:Q;if(!e||!s)continue;const m=g&&!C&&c==="middle"&&I===void 0&&isFinite(g[t]),o=b&&!j&&k==="middle"&&I===void 0&&isFinite(b[t]),a=m?(d.mapped[t]+g[t])/2:d.mapped[t]+C,i=o?(y.mapped[t]+b[t])/2:y.mapped[t]+j;let r=U!==null&&typeof U[t]=="number"&&U[t]<0;if(r){const M=F?v(e,a-E,i,k,f,c==="start"?"end":c==="end"?"start":c):v(e,a,i-R,B(k),f);(F?M.x0<N.x-.5||M.x1>N.x+N.w+.5:M.y0<N.y-.5||M.y1>N.y+N.h+.5)&&(r=!1)}const x=r&&F?c==="start"?"end":c==="end"?"start":c:c,p=r&&F?-E:E;let h=r&&!F?B(k):k,L=r&&!F?-R:R;const q=a+p;let S=i+L;if(!isFinite(q)||!isFinite(S))continue;const en=`${q},${S},${x},${h},${s}|${e}`;if(tn.has(en))continue;tn.add(en);let w=f;const[on,an]=yn(t,q,S);if(on<1/0||an<1/0){if(w=Math.min(f,f*on/G(e,f),an),!(w>=O))continue;w=Math.floor(w*2)/2}if(bn){let M=v(e,q,S,h,w);if(!nn(M)){const Y=S-2*L,ln=v(e,q,Y,B(h),w);if(h==="middle"||!nn(ln))continue;S=Y,h=B(h),L=-L,M=ln}Z.push(M)}K.push(P>$?Math.floor(Math.min(f,f*$/G(e,f))*2)/2:w),_.push({type:"text",x:q,y:S,text:e,size:w,weight:J,anchor:x,baseline:h,rotate:I,style:{fill:s},ref:{mark:u,row:t}})}if($<1/0&&!b){const t=_;let e=f;for(const o of t)e=Math.min(e,o.size);const s=t.map((o,a)=>a).sort((o,a)=>t[o].x-t[a].x),m=o=>{for(let a=0;a<s.length;a++){const i=t[s[a]],r=v(i.text,i.x,i.y,i.baseline,o);for(let x=a+1;x<s.length;x++){const p=t[s[x]];if(p.x-i.x>=2*z)break;if(p.x-i.x<z/2)continue;const h=v(p.text,p.x,p.y,p.baseline,o);if(r.x1+T>h.x0&&r.y0<h.y1&&h.y0<r.y1)return!0}}return!1};for(;e>=O&&m(e);)e-=.5;if(e<O){const o=t.filter((a,i)=>K[i]>=O);e=f,t.forEach((a,i)=>K[i]>=O&&(e=Math.min(e,K[i]))),_=o}for(const o of _)o.size=e}return _}};BC.define(mn)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(H){const sn="var(--bc-text, #444)",dn="#111",un="#fff";function fn(n){const l=cn(n),u=typeof n=="string"?/^var\(--bc-c(\d+),/.exec(n):null;return l&&u?`var(--bc-on-c${u[1]}, ${l})`:l}function cn(n){const l=typeof n=="string"?/#([0-9a-f]{6}|[0-9a-f]{3})\b/i.exec(n):null;if(!l)return null;let u=l[1];u.length===3&&(u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]);const d=D=>{const A=parseInt(u.slice(D,D+2),16)/255;return A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4)},y=.2126*d(0)+.7152*d(2)+.0722*d(4);return(y+.05)/(.0056+.05)>=1.05/(y+.05)?dn:un}function mn(n,l){return n==null?"":typeof n=="number"?isFinite(n)?l!==void 0?n.toFixed(l):Number.isInteger(n)?String(n):String(+n.toPrecision(6)):"":String(n)}const C=4,hn={role:"mark",type:"text",version:14,params:{size:{kind:"number",default:11},weight:{kind:"any"},anchor:{kind:"enum",values:["start","middle","end"],default:"middle"},baseline:{kind:"enum",values:["auto","middle","hanging"],default:"middle"},dx:{kind:"number",default:0},dy:{kind:"number",default:0},rotate:{kind:"number",default:0},decimals:{kind:"number"},format:{kind:"format"},fill:{kind:"color"},negative:{kind:"enum",values:["same","flip"],default:"same"},collide:{kind:"enum",values:["show","hide"],default:"show"},minSize:{kind:"number",default:8}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},x2:{accepts:{output:"position",input:["number","date"]},sharesScale:"x"},y2:{accepts:{output:"position",input:["number","date"]},sharesScale:"y"},text:{required:!0,unscaled:!0},sign:{unscaled:!0},color:{accepts:{output:"color"}},on:{accepts:{output:"color"},sharesScale:"color"}},render(n,l,u){const d=l.channel(n,"x"),y=l.channel(n,"y"),D=l.channel(n,"text").raw,A=n.sign!==void 0?l.channel(n,"sign").raw:null,W=n.color!==void 0?l.channel(n,"color").mapped:null,G=n.on!==void 0?l.channel(n,"on").mapped:null,j=n.format!==void 0?H.formatter(n.format):null,E=d.half,J=y.half,f=typeof n.size=="number"?n.size:11,c=n.anchor==="start"||n.anchor==="end"?n.anchor:"middle",k=n.baseline==="auto"||n.baseline==="hanging"?n.baseline:"middle",R=typeof n.dx=="number"?n.dx:0,T=typeof n.dy=="number"?n.dy:0,I=typeof n.rotate=="number"&&n.rotate!==0?n.rotate:void 0,yn=typeof n.decimals=="number"&&n.decimals>=0?Math.min(20,Math.floor(n.decimals)):void 0,Q=typeof n.weight=="number"||typeof n.weight=="string"?n.weight:void 0,V=typeof n.fill=="string"?n.fill:sn,O=typeof n.minSize=="number"&&n.minSize>0?Math.min(n.minSize,f):Math.min(8,f),g=n.x2!==void 0?l.channel(n,"x2").mapped:null,b=n.y2!==void 0?l.channel(n,"y2").mapped:null,P=(t,e)=>l.textWidth(t,e,Q);let z=0,$=1/0,U=1/0;if(E&&!g&&c==="middle"&&I===void 0&&d.scale){const t=d.scale.domain();z=t.length>1?Math.abs(d.scale(t[1])-d.scale(t[0])):l.plot.w,isFinite(z)&&z>0&&($=z-C,U=b?$:Math.max($,2*(z-E)-C))}const bn=(t,e,s)=>{let m=U,o=1/0;if(g&&I===void 0&&isFinite(g[t])){const a=Math.min(d.mapped[t],g[t]),i=Math.max(d.mapped[t],g[t]),r=Math.abs(R);m=c==="start"?i-e-r:c==="end"?e-a-r:2*Math.min(e-a,i-e)-2*r,m>=0||(m=0)}if(b&&I===void 0&&isFinite(b[t])){const a=Math.min(y.mapped[t],b[t]),i=Math.max(y.mapped[t],b[t]),r=Math.abs(T);o=k==="hanging"?i-s-r:k==="auto"?s-a-r:2*Math.min(s-a,i-s)-2*r,o>=0||(o=0)}return[m,o]},Z=n.negative==="flip",F=Z&&!!y.half&&!d.half,Y=Z?A||(F?d:y).raw:null,xn=n.collide==="hide"&&I===void 0,nn=[],v=(t,e,s,m,o,a=c)=>{const i=P(t,o),r=a==="start"?e:a==="end"?e-i:e-i/2,x=m==="hanging"?s:m==="auto"?s-o:s-o/2;return{x0:r,x1:r+i,y0:x,y1:x+o}},tn=t=>!nn.some(e=>t.x0<e.x1&&e.x0<t.x1&&t.y0<e.y1&&e.y0<t.y1),K=t=>t==="auto"?"hanging":t==="hanging"?"auto":t,{from:gn,to:pn}=l.rows(n);let _=[];const L=[],en=new Set,N=l.plot;for(let t=gn;t<pn;t++){const e=j?j(D[t]):mn(D[t],yn),s=G?G[t]?fn(G[t])||V:"":W?W[t]:V;if(!e||!s)continue;const m=g&&!E&&c==="middle"&&I===void 0&&isFinite(g[t]),o=b&&!J&&k==="middle"&&I===void 0&&isFinite(b[t]),a=m?(d.mapped[t]+g[t])/2:d.mapped[t]+E,i=o?(y.mapped[t]+b[t])/2:y.mapped[t]+J;let r=Y!==null&&typeof Y[t]=="number"&&Y[t]<0;if(r){const M=F?v(e,a-R,i,k,f,c==="start"?"end":c==="end"?"start":c):v(e,a,i-T,K(k),f);(F?M.x0<N.x-.5||M.x1>N.x+N.w+.5:M.y0<N.y-.5||M.y1>N.y+N.h+.5)&&(r=!1)}const x=r&&F?c==="start"?"end":c==="end"?"start":c:c,p=r&&F?-R:R;let h=r&&!F?K(k):k,X=r&&!F?-T:T;const q=a+p;let S=i+X;if(!isFinite(q)||!isFinite(S))continue;const on=`${q},${S},${x},${h},${s}|${e}`;if(en.has(on))continue;en.add(on);let w=f;const[an,ln]=bn(t,q,S);if(an<1/0||ln<1/0){if(w=Math.min(f,f*an/P(e,f),ln),!(w>=O))continue;w=Math.floor(w*2)/2}if(xn){let M=v(e,q,S,h,w);if(!tn(M)){const B=S-2*X,rn=v(e,q,B,K(h),w);if(h==="middle"||!tn(rn))continue;S=B,h=K(h),X=-X,M=rn}nn.push(M)}L.push(U>$?Math.floor(Math.min(f,f*$/P(e,f))*2)/2:w),_.push({type:"text",x:q,y:S,text:e,size:w,weight:Q,anchor:x,baseline:h,rotate:I,style:{fill:s},ref:{mark:u,row:t}})}if($<1/0&&!b){const t=_;let e=f;for(const o of t)e=Math.min(e,o.size);const s=t.map((o,a)=>a).sort((o,a)=>t[o].x-t[a].x),m=o=>{for(let a=0;a<s.length;a++){const i=t[s[a]],r=v(i.text,i.x,i.y,i.baseline,o);for(let x=a+1;x<s.length;x++){const p=t[s[x]];if(p.x-i.x>=2*z)break;if(p.x-i.x<z/2)continue;const h=v(p.text,p.x,p.y,p.baseline,o);if(r.x1+C>h.x0&&r.y0<h.y1&&h.y0<r.y1)return!0}}return!1};for(;e>=O&&m(e);)e-=.5;if(e<O){const o=t.filter((a,i)=>L[i]>=O);e=f,t.forEach((a,i)=>L[i]>=O&&(e=Math.min(e,L[i]))),_=o}for(const o of _)o.size=e}return _}};H.define(hn)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const L=t=>Math.round(t*100)/100,z="var(--bc-tooltip-bg, #fff)";function F(t,n,i){const r=n.channel(t,"x"),a=n.channel(t,"y"),o=!!(r.scale&&r.scale.bandwidth!==void 0);if(!o&&!(a.scale&&a.scale.bandwidth!==void 0))throw new Error("mark.violin: put the categories on a band scale, x for violins standing up or y for ridges lying down");const u=o?r:a,c=o?a:r,d=n.channel(t,"density").raw,e=t.color!==void 0?n.channel(t,"color").mapped:null,f=u.scale.bandwidth,p=t.side!=="one",w=typeof t.extent=="number"&&t.extent>0?t.extent:p?.9:1.6,b=typeof t.fill=="string"?t.fill:"",{from:j,to:v}=n.rows(t),y=c.mapped.length,h=new Float64Array(y),k=new Map;for(let s=j;s<v;s++){const l=u.mapped[s],m=d[s];if(h[s]=c.mapped[s],!isFinite(l)||!isFinite(h[s])||typeof m!="number"||!isFinite(m)||m<0||e&&!e[s])continue;const M=k.get(l);M?M.push(s):k.set(l,[s])}let W=0;k.forEach(s=>s.forEach(l=>W=Math.max(W,d[l])));const q=[];return[...k.keys()].sort((s,l)=>s-l).forEach(s=>{const l=k.get(s).sort((g,x)=>h[g]-h[x]||g-x),m=t.normalize==="each"?l.reduce((g,x)=>Math.max(g,d[x]),0):W,M=(p?f/2:f)*w,A=new Float64Array(y);for(const g of l)A[g]=m>0?d[g]/m*M:0;q.push({rows:l,at:p?s+f/2:o?s:s+f,w:A,color:e?e[l[0]]:b||n.color(i)})}),{upright:o,v:h,both:p,shapes:q}}function E(t,n,i,r){const a=t.both?n.at+r*n.w[i]:t.upright?n.at+(r>0?n.w[i]:0):n.at-(r>0?n.w[i]:0);return t.upright?[a,t.v[i]]:[t.v[i],a]}function C(t,n){const i=(o,u)=>u.map(c=>E(t,n,c,o).map(L).join(" ")),r=i(1,n.rows),a=i(-1,n.rows.slice().reverse());return"M"+r.join("L")+"L"+a.join("L")+"Z"}const B={role:"mark",type:"violin",version:4,params:{side:{kind:"enum",values:["both","one"],default:"both"},extent:{kind:"number"},normalize:{kind:"enum",values:["all","each"],default:"all"},fill:{kind:"color"},opacity:{kind:"number",default:.85},stroke:{kind:"string"},strokeWidth:{kind:"number",default:1.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},density:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,n,i){const r=F(t,n,i),a=typeof t.opacity=="number"?t.opacity:.85,o=typeof t.stroke=="string"?t.stroke:r.both?void 0:z,u=typeof t.strokeWidth=="number"?t.strokeWidth:1.5;return r.shapes.filter(c=>c.rows.length>1).map(c=>({type:"path",d:C(r,c),style:{fill:c.color,fillOpacity:a,stroke:o,strokeWidth:o?u:void 0},ref:{mark:i,row:c.rows[0]}}))},pick(t,n,i,r,a){const o=F(t,n,i),u=o.upright?a:r,c=o.upright?r:a;for(let d=o.shapes.length-1;d>=0;d--){const e=o.shapes[d];if(e.rows.length<2)continue;const f=o.v[e.rows[0]],p=o.v[e.rows[e.rows.length-1]];if(u<Math.min(f,p)||u>Math.max(f,p))continue;let w=e.rows[0];for(const h of e.rows)Math.abs(o.v[h]-u)<Math.abs(o.v[w]-u)&&(w=h);const b=e.w[w]+3;if(!(o.both?Math.abs(c-e.at)<=b:o.upright?c>=e.at-3&&c<=e.at+b:c<=e.at+3&&c>=e.at-b))continue;const[v,y]=E(o,e,w,1);return{row:w,x:o.both&&o.upright?e.at:v,y:o.both?o.upright?y:e.at:y,dist:0}}return null},color(t,n,i,r){const a=F(t,n,i).shapes.find(o=>o.rows.length>1&&o.rows.includes(r));return a?a.color:""}};BC.define(B)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(L){const z=t=>Math.round(t*100)/100,C="var(--bc-tooltip-bg, #fff)";function F(t,n,i){const r=n.channel(t,"x"),a=n.channel(t,"y"),o=!!(r.scale&&r.scale.bandwidth!==void 0);if(!o&&!(a.scale&&a.scale.bandwidth!==void 0))throw new Error("mark.violin: put the categories on a band scale, x for violins standing up or y for ridges lying down");const u=o?r:a,c=o?a:r,h=n.channel(t,"density").raw,e=t.color!==void 0?n.channel(t,"color").mapped:null,f=u.scale.bandwidth,p=t.side!=="one",w=typeof t.extent=="number"&&t.extent>0?t.extent:p?.9:1.6,m=typeof t.fill=="string"?t.fill:"",{from:j,to:v}=n.rows(t),y=c.mapped.length,d=new Float64Array(y),k=new Map;for(let s=j;s<v;s++){const l=u.mapped[s],b=h[s];if(d[s]=c.mapped[s],!isFinite(l)||!isFinite(d[s])||typeof b!="number"||!isFinite(b)||b<0||e&&!e[s])continue;const M=k.get(l);M?M.push(s):k.set(l,[s])}let W=0;k.forEach(s=>s.forEach(l=>W=Math.max(W,h[l])));const q=[];return[...k.keys()].sort((s,l)=>s-l).forEach(s=>{const l=k.get(s).sort((g,x)=>d[g]-d[x]||g-x),b=t.normalize==="each"?l.reduce((g,x)=>Math.max(g,h[x]),0):W,M=(p?f/2:f)*w,A=new Float64Array(y);for(const g of l)A[g]=b>0?h[g]/b*M:0;q.push({rows:l,at:p?s+f/2:o?s:s+f,w:A,color:e?e[l[0]]:m||n.color(i)})}),{upright:o,v:d,both:p,shapes:q}}function E(t,n,i,r){const a=t.both?n.at+r*n.w[i]:t.upright?n.at+(r>0?n.w[i]:0):n.at-(r>0?n.w[i]:0);return t.upright?[a,t.v[i]]:[t.v[i],a]}function B(t,n){const i=(o,u)=>u.map(c=>E(t,n,c,o).map(z).join(" ")),r=i(1,n.rows),a=i(-1,n.rows.slice().reverse());return"M"+r.join("L")+"L"+a.join("L")+"Z"}const D={role:"mark",type:"violin",version:4,params:{side:{kind:"enum",values:["both","one"],default:"both"},extent:{kind:"number"},normalize:{kind:"enum",values:["all","each"],default:"all"},fill:{kind:"color"},opacity:{kind:"number",default:.85},stroke:{kind:"string"},strokeWidth:{kind:"number",default:1.5}},channels:{x:{required:!0,accepts:{output:"position"}},y:{required:!0,accepts:{output:"position"}},density:{required:!0,unscaled:!0},color:{accepts:{output:"color"}}},render(t,n,i){const r=F(t,n,i),a=typeof t.opacity=="number"?t.opacity:.85,o=typeof t.stroke=="string"?t.stroke:r.both?void 0:C,u=typeof t.strokeWidth=="number"?t.strokeWidth:1.5;return r.shapes.filter(c=>c.rows.length>1).map(c=>({type:"path",d:B(r,c),style:{fill:c.color,fillOpacity:a,stroke:o,strokeWidth:o?u:void 0},ref:{mark:i,row:c.rows[0]}}))},pick(t,n,i,r,a){const o=F(t,n,i),u=o.upright?a:r,c=o.upright?r:a;for(let h=o.shapes.length-1;h>=0;h--){const e=o.shapes[h];if(e.rows.length<2)continue;const f=o.v[e.rows[0]],p=o.v[e.rows[e.rows.length-1]];if(u<Math.min(f,p)||u>Math.max(f,p))continue;let w=e.rows[0];for(const d of e.rows)Math.abs(o.v[d]-u)<Math.abs(o.v[w]-u)&&(w=d);const m=e.w[w]+3;if(!(o.both?Math.abs(c-e.at)<=m:o.upright?c>=e.at-3&&c<=e.at+m:c<=e.at+3&&c>=e.at-m))continue;const[v,y]=E(o,e,w,1);return{row:w,x:o.both&&o.upright?e.at:v,y:o.both?o.upright?y:e.at:y,dist:0}}return null},color(t,n,i,r){const a=F(t,n,i).shapes.find(o=>o.rows.length>1&&o.rows.includes(r));return a?a.color:""}};L.define(D)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const S='system-ui, -apple-system, "Segoe UI", sans-serif',W=Math.PI*2,z={role:"renderer",type:"canvas",version:4,render(v,d){const b=d.ownerDocument||document,a=b.createElement("canvas");a.setAttribute("role","img"),a.setAttribute("style","display:block;width:100%;height:auto");const O=a.getContext("2d");if(!O)throw new Error("renderer.canvas: this environment has no 2D canvas context");const t=O;let h=v,k=new Map,A=S,u=null,L=!1;const C=e=>{t.fillStyle="#010203",t.fillStyle=e;const n=t.fillStyle;return t.fillStyle="#040506",t.fillStyle=e,n===t.fillStyle},$=e=>u&&typeof u.getPropertyValue=="function"?u.getPropertyValue(e).trim():"",T=e=>{const n=k.get(e);if(n!==void 0)return n;let r=e.trim();for(let o=0;o<8;o++){const s=/^var\(\s*(--[^\s,)]+)\s*(?:,([\s\S]*))?\)$/.exec(r);if(!s)break;r=$(s[1])||(s[2]!==void 0?s[2].trim():"")}let i=null;return r&&r!=="none"&&(r.toLowerCase()==="currentcolor"&&(r=u&&u.color||"#000"),C(r)&&(i=r)),k.set(e,i),i},R=e=>{t.fillStyle=e;const n=String(t.fillStyle),r=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(n);if(r)return`rgba(${parseInt(r[1],16)}, ${parseInt(r[2],16)}, ${parseInt(r[3],16)}, 0)`;const i=/^rgba?\(([^,]+),([^,]+),([^,)]+)/.exec(n);return i?`rgba(${i[1].trim()}, ${i[2].trim()}, ${i[3].trim()}, 0)`:"rgba(0, 0, 0, 0)"},_=e=>{const n=h.plot,r=t.createLinearGradient(0,n.y,0,n.y+n.h);return r.addColorStop(0,e),r.addColorStop(1,R(e)),r},j=e=>`${e.weight===void 0?"normal":String(e.weight)} ${e.size===void 0?12:e.size}px ${A}`,D=e=>{t.font=j(e),t.textAlign=e.anchor==="middle"?"center":e.anchor==="end"?"right":"left",t.textBaseline=e.baseline==="middle"?"middle":e.baseline==="hanging"?"hanging":"alphabetic"},F=(e,n,r,i,o)=>{const s=Math.max(0,Math.min(o,r/2,i/2));if(t.beginPath(),typeof t.roundRect=="function"){t.roundRect(e,n,r,i,s);return}t.moveTo(e+s,n),t.arcTo(e+r,n,e+r,n+i,s),t.arcTo(e+r,n+i,e,n+i,s),t.arcTo(e,n+i,e,n,s),t.arcTo(e,n,e+r,n,s),t.closePath()},E=(e,n,r)=>{const i=e.style||{},o={fill:i.fill!==void 0?i.fill:r.fill,stroke:i.stroke!==void 0?i.stroke:r.stroke,strokeWidth:i.strokeWidth!==void 0?i.strokeWidth:r.strokeWidth,strokeDash:i.strokeDash!==void 0?i.strokeDash:r.strokeDash,fillOpacity:i.fillOpacity!==void 0?i.fillOpacity:r.fillOpacity,strokeLinejoin:i.strokeLinejoin!==void 0?i.strokeLinejoin:r.strokeLinejoin,strokeLinecap:i.strokeLinecap!==void 0?i.strokeLinecap:r.strokeLinecap,paintOrder:i.paintOrder!==void 0?i.paintOrder:r.paintOrder},s=n*(i.opacity===void 0?1:i.opacity);if(e.type==="g"){t.save(),e.translate&&t.translate(e.translate[0],e.translate[1]),e.clip&&(t.beginPath(),t.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),t.clip());for(const f of e.children)E(f,s,o);t.restore();return}const l=o.fill===void 0?"#000":T(o.fill),c=o.stroke===void 0?null:T(o.stroke);t.lineWidth=o.strokeWidth===void 0?1:o.strokeWidth,t.setLineDash(o.strokeDash||[]),t.lineJoin=o.strokeLinejoin||"miter",t.lineCap=o.strokeLinecap||"butt";const w=o.paintOrder==="stroke",M=f=>{const X=()=>{l&&(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=i.fade?_(l):l,f?t.fill(f):t.fill())},I=()=>{c&&(t.globalAlpha=s,t.strokeStyle=c,f?t.stroke(f):t.stroke())};w&&I(),X(),w||I()};switch(e.type){case"path":M(new Path2D(e.d));break;case"rect":e.r?F(e.x,e.y,e.w,e.h,e.r):(t.beginPath(),t.rect(e.x,e.y,e.w,e.h)),M();break;case"circle":t.beginPath(),t.arc(e.cx,e.cy,e.r,0,W),M();break;case"text":D(e),t.save(),t.translate(e.x,e.y),e.rotate&&t.rotate(e.rotate*Math.PI/180);for(const f of w?["stroke","fill"]:["fill","stroke"])f==="fill"&&l?(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=l,t.fillText(e.text,0,0)):f==="stroke"&&c&&(t.globalAlpha=s,t.strokeStyle=c,t.strokeText(e.text,0,0));t.restore();break}t.globalAlpha=1},x=e=>{if(L)return;h=e,e.label?a.setAttribute("aria-label",e.label):a.removeAttribute("aria-label"),k=new Map,u=typeof getComputedStyle=="function"?getComputedStyle(d):null,A=u&&u.fontFamily||S;const n=d.clientWidth||e.size.w,r=Math.min(3,Math.max(1,globalThis.devicePixelRatio||1)),i=Math.max(1,Math.min(16384,Math.round(n*r))),o=i/e.size.w,s=Math.max(1,Math.min(16384,Math.round(e.size.h*o)));a.width=i,a.height=s,t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i,s),t.setTransform(o,0,0,o,0,0);for(const l of e.layers){t.save(),l.clip&&(t.beginPath(),t.rect(l.clip.x,l.clip.y,l.clip.w,l.clip.h),t.clip());for(const c of l.prims)E(c,1,{});t.restore()}},P=e=>{switch(e.type){case"rect":return[e.x,e.y,e.x+e.w,e.y+e.h];case"circle":return[e.cx-e.r,e.cy-e.r,e.cx+e.r,e.cy+e.r];case"text":{D(e);const n=t.measureText(e.text).width,r=e.size===void 0?12:e.size,i=e.anchor==="middle"?e.x-n/2:e.anchor==="end"?e.x-n:e.x,o=e.baseline==="middle"?e.y-r/2:e.baseline==="hanging"?e.y:e.y-r;return[i,o,i+n,o+r]}case"g":{let n=null;for(const i of e.children){const o=P(i);o&&(n=n?[Math.min(n[0],o[0]),Math.min(n[1],o[1]),Math.max(n[2],o[2]),Math.max(n[3],o[3])]:o)}const r=e.translate||[0,0];return n?[n[0]+r[0],n[1]+r[1],n[2]+r[0],n[3]+r[1]]:null}default:return null}},p=(e,n,r)=>{if(e.type==="g"){const o=e.translate||[0,0];for(let s=e.children.length-1;s>=0;s--){const l=p(e.children[s],n-o[0],r-o[1]);if(l)return l}}if(!e.data)return null;const i=P(e);return i&&n>=i[0]&&n<=i[2]&&r>=i[1]&&r<=i[3]?Object.assign({},e.data):null},U=e=>{const n=a.getBoundingClientRect();if(!n.width||!n.height)return null;const r=(e.clientX-n.left)*h.size.w/n.width,i=(e.clientY-n.top)*h.size.h/n.height;for(let o=h.layers.length-1;o>=0;o--){const s=h.layers[o].prims;for(let l=s.length-1;l>=0;l--){const c=p(s[l],r,i);if(c)return c}}return null},g=[],m=()=>x(h),y=globalThis;if(typeof y.ResizeObserver=="function"){let e=d.clientWidth;const n=new y.ResizeObserver(()=>{d.clientWidth!==e&&(e=d.clientWidth,m())});n.observe(d),g.push(()=>n.disconnect())}if(typeof y.matchMedia=="function"){const e=y.matchMedia("(prefers-color-scheme: dark)");e&&typeof e.addEventListener=="function"&&(e.addEventListener("change",m),g.push(()=>e.removeEventListener("change",m)))}if(typeof y.MutationObserver=="function"&&b.documentElement){const e=new y.MutationObserver(m);e.observe(b.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}),g.push(()=>e.disconnect())}return x(v),d.appendChild(a),{root:a,update:x,dataAt:U,destroy(){L=!0;for(const e of g)e();a.parentNode&&a.parentNode.removeChild(a)}}}};BC.define(z)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(W){const S='system-ui, -apple-system, "Segoe UI", sans-serif',z=Math.PI*2,C={role:"renderer",type:"canvas",version:4,render(v,d){const b=d.ownerDocument||document,a=b.createElement("canvas");a.setAttribute("role","img"),a.setAttribute("style","display:block;width:100%;height:auto");const O=a.getContext("2d");if(!O)throw new Error("renderer.canvas: this environment has no 2D canvas context");const t=O;let h=v,k=new Map,A=S,u=null,L=!1;const $=e=>{t.fillStyle="#010203",t.fillStyle=e;const n=t.fillStyle;return t.fillStyle="#040506",t.fillStyle=e,n===t.fillStyle},R=e=>u&&typeof u.getPropertyValue=="function"?u.getPropertyValue(e).trim():"",T=e=>{const n=k.get(e);if(n!==void 0)return n;let r=e.trim();for(let o=0;o<8;o++){const s=/^var\(\s*(--[^\s,)]+)\s*(?:,([\s\S]*))?\)$/.exec(r);if(!s)break;r=R(s[1])||(s[2]!==void 0?s[2].trim():"")}let i=null;return r&&r!=="none"&&(r.toLowerCase()==="currentcolor"&&(r=u&&u.color||"#000"),$(r)&&(i=r)),k.set(e,i),i},_=e=>{t.fillStyle=e;const n=String(t.fillStyle),r=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(n);if(r)return`rgba(${parseInt(r[1],16)}, ${parseInt(r[2],16)}, ${parseInt(r[3],16)}, 0)`;const i=/^rgba?\(([^,]+),([^,]+),([^,)]+)/.exec(n);return i?`rgba(${i[1].trim()}, ${i[2].trim()}, ${i[3].trim()}, 0)`:"rgba(0, 0, 0, 0)"},j=e=>{const n=h.plot,r=t.createLinearGradient(0,n.y,0,n.y+n.h);return r.addColorStop(0,e),r.addColorStop(1,_(e)),r},F=e=>`${e.weight===void 0?"normal":String(e.weight)} ${e.size===void 0?12:e.size}px ${A}`,D=e=>{t.font=F(e),t.textAlign=e.anchor==="middle"?"center":e.anchor==="end"?"right":"left",t.textBaseline=e.baseline==="middle"?"middle":e.baseline==="hanging"?"hanging":"alphabetic"},U=(e,n,r,i,o)=>{const s=Math.max(0,Math.min(o,r/2,i/2));if(t.beginPath(),typeof t.roundRect=="function"){t.roundRect(e,n,r,i,s);return}t.moveTo(e+s,n),t.arcTo(e+r,n,e+r,n+i,s),t.arcTo(e+r,n+i,e,n+i,s),t.arcTo(e,n+i,e,n,s),t.arcTo(e,n,e+r,n,s),t.closePath()},E=(e,n,r)=>{const i=e.style||{},o={fill:i.fill!==void 0?i.fill:r.fill,stroke:i.stroke!==void 0?i.stroke:r.stroke,strokeWidth:i.strokeWidth!==void 0?i.strokeWidth:r.strokeWidth,strokeDash:i.strokeDash!==void 0?i.strokeDash:r.strokeDash,fillOpacity:i.fillOpacity!==void 0?i.fillOpacity:r.fillOpacity,strokeLinejoin:i.strokeLinejoin!==void 0?i.strokeLinejoin:r.strokeLinejoin,strokeLinecap:i.strokeLinecap!==void 0?i.strokeLinecap:r.strokeLinecap,paintOrder:i.paintOrder!==void 0?i.paintOrder:r.paintOrder},s=n*(i.opacity===void 0?1:i.opacity);if(e.type==="g"){t.save(),e.translate&&t.translate(e.translate[0],e.translate[1]),e.clip&&(t.beginPath(),t.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),t.clip());for(const f of e.children)E(f,s,o);t.restore();return}const l=o.fill===void 0?"#000":T(o.fill),c=o.stroke===void 0?null:T(o.stroke);t.lineWidth=o.strokeWidth===void 0?1:o.strokeWidth,t.setLineDash(o.strokeDash||[]),t.lineJoin=o.strokeLinejoin||"miter",t.lineCap=o.strokeLinecap||"butt";const w=o.paintOrder==="stroke",M=f=>{const B=()=>{l&&(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=i.fade?j(l):l,f?t.fill(f):t.fill())},I=()=>{c&&(t.globalAlpha=s,t.strokeStyle=c,f?t.stroke(f):t.stroke())};w&&I(),B(),w||I()};switch(e.type){case"path":M(new Path2D(e.d));break;case"rect":e.r?U(e.x,e.y,e.w,e.h,e.r):(t.beginPath(),t.rect(e.x,e.y,e.w,e.h)),M();break;case"circle":t.beginPath(),t.arc(e.cx,e.cy,e.r,0,z),M();break;case"text":D(e),t.save(),t.translate(e.x,e.y),e.rotate&&t.rotate(e.rotate*Math.PI/180);for(const f of w?["stroke","fill"]:["fill","stroke"])f==="fill"&&l?(t.globalAlpha=s*(o.fillOpacity===void 0?1:o.fillOpacity),t.fillStyle=l,t.fillText(e.text,0,0)):f==="stroke"&&c&&(t.globalAlpha=s,t.strokeStyle=c,t.strokeText(e.text,0,0));t.restore();break}t.globalAlpha=1},x=e=>{if(L)return;h=e,e.label?a.setAttribute("aria-label",e.label):a.removeAttribute("aria-label"),k=new Map,u=typeof getComputedStyle=="function"?getComputedStyle(d):null,A=u&&u.fontFamily||S;const n=d.clientWidth||e.size.w,r=Math.min(3,Math.max(1,globalThis.devicePixelRatio||1)),i=Math.max(1,Math.min(16384,Math.round(n*r))),o=i/e.size.w,s=Math.max(1,Math.min(16384,Math.round(e.size.h*o)));a.width=i,a.height=s,t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i,s),t.setTransform(o,0,0,o,0,0);for(const l of e.layers){t.save(),l.clip&&(t.beginPath(),t.rect(l.clip.x,l.clip.y,l.clip.w,l.clip.h),t.clip());for(const c of l.prims)E(c,1,{});t.restore()}},P=e=>{switch(e.type){case"rect":return[e.x,e.y,e.x+e.w,e.y+e.h];case"circle":return[e.cx-e.r,e.cy-e.r,e.cx+e.r,e.cy+e.r];case"text":{D(e);const n=t.measureText(e.text).width,r=e.size===void 0?12:e.size,i=e.anchor==="middle"?e.x-n/2:e.anchor==="end"?e.x-n:e.x,o=e.baseline==="middle"?e.y-r/2:e.baseline==="hanging"?e.y:e.y-r;return[i,o,i+n,o+r]}case"g":{let n=null;for(const i of e.children){const o=P(i);o&&(n=n?[Math.min(n[0],o[0]),Math.min(n[1],o[1]),Math.max(n[2],o[2]),Math.max(n[3],o[3])]:o)}const r=e.translate||[0,0];return n?[n[0]+r[0],n[1]+r[1],n[2]+r[0],n[3]+r[1]]:null}default:return null}},p=(e,n,r)=>{if(e.type==="g"){const o=e.translate||[0,0];for(let s=e.children.length-1;s>=0;s--){const l=p(e.children[s],n-o[0],r-o[1]);if(l)return l}}if(!e.data)return null;const i=P(e);return i&&n>=i[0]&&n<=i[2]&&r>=i[1]&&r<=i[3]?Object.assign({},e.data):null},X=e=>{const n=a.getBoundingClientRect();if(!n.width||!n.height)return null;const r=(e.clientX-n.left)*h.size.w/n.width,i=(e.clientY-n.top)*h.size.h/n.height;for(let o=h.layers.length-1;o>=0;o--){const s=h.layers[o].prims;for(let l=s.length-1;l>=0;l--){const c=p(s[l],r,i);if(c)return c}}return null},g=[],m=()=>x(h),y=globalThis;if(typeof y.ResizeObserver=="function"){let e=d.clientWidth;const n=new y.ResizeObserver(()=>{d.clientWidth!==e&&(e=d.clientWidth,m())});n.observe(d),g.push(()=>n.disconnect())}if(typeof y.matchMedia=="function"){const e=y.matchMedia("(prefers-color-scheme: dark)");e&&typeof e.addEventListener=="function"&&(e.addEventListener("change",m),g.push(()=>e.removeEventListener("change",m)))}if(typeof y.MutationObserver=="function"&&b.documentElement){const e=new y.MutationObserver(m);e.observe(b.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}),g.push(()=>e.disconnect())}return x(v),d.appendChild(a),{root:a,update:x,dataAt:X,destroy(){L=!0;for(const e of g)e();a.parentNode&&a.parentNode.removeChild(a)}}}};W.define(C)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const k="http://www.w3.org/2000/svg";let x=0,w=0;function s(e){return document.createElementNS(k,e)}function r(e,i,t){t!==void 0&&e.setAttribute(i,String(t))}function m(e,i,t){const n=e+"|"+i,l=t.fades.get(n);if(l)return l;const o=`bc-fade-${++w}`,a=s("linearGradient");a.setAttribute("id",o),a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("x1","0"),a.setAttribute("x2","0"),r(a,"y1",t.plot.y),r(a,"y2",t.plot.y+t.plot.h);for(const[b,c]of[[0,i],[1,0]]){const f=s("stop");f.setAttribute("offset",String(b)),f.setAttribute("style",`stop-color:${e.replace(/[;{}<>]/g,"")};stop-opacity:${c}`),a.appendChild(f)}t.defs.appendChild(a);const u=`url(#${o})`;return t.fades.set(n,u),u}function C(e,i,t){i&&(i.fill!==void 0&&i.fade&&i.fill!=="none"?e.setAttribute("fill",m(i.fill,i.fillOpacity===void 0?1:i.fillOpacity,t)):i.fill!==void 0&&e.setAttribute("fill",i.fill),i.stroke!==void 0&&e.setAttribute("stroke",i.stroke),r(e,"stroke-width",i.strokeWidth),i.strokeDash&&e.setAttribute("stroke-dasharray",i.strokeDash.join(" ")),r(e,"opacity",i.opacity),i.fade||r(e,"fill-opacity",i.fillOpacity),i.strokeLinejoin&&e.setAttribute("stroke-linejoin",i.strokeLinejoin),i.strokeLinecap&&e.setAttribute("stroke-linecap",i.strokeLinecap),i.paintOrder&&e.setAttribute("paint-order",i.paintOrder))}function y(e,i,t){const n=`bc-clip-${++x}`,l=s("clipPath");l.setAttribute("id",n);const o=s("rect");r(o,"x",i.x),r(o,"y",i.y),r(o,"width",i.w),r(o,"height",i.h),l.appendChild(o),t.appendChild(l),e.setAttribute("clip-path",`url(#${n})`)}function g(e,i){let t;switch(e.type){case"path":t=s("path"),t.setAttribute("d",e.d);break;case"rect":t=s("rect"),r(t,"x",e.x),r(t,"y",e.y),r(t,"width",e.w),r(t,"height",e.h),r(t,"rx",e.r);break;case"circle":t=s("circle"),r(t,"cx",e.cx),r(t,"cy",e.cy),r(t,"r",e.r);break;case"text":t=s("text"),r(t,"x",e.x),r(t,"y",e.y),r(t,"font-size",e.size),e.weight!==void 0&&t.setAttribute("font-weight",String(e.weight)),e.anchor&&t.setAttribute("text-anchor",e.anchor),e.baseline&&t.setAttribute("dominant-baseline",e.baseline),e.rotate&&t.setAttribute("transform",`rotate(${e.rotate} ${e.x} ${e.y})`),t.textContent=e.text;break;case"g":t=s("g"),e.translate&&t.setAttribute("transform",`translate(${e.translate[0]} ${e.translate[1]})`),e.clip&&y(t,e.clip,i.defs);for(const n of e.children)t.appendChild(g(n,i));break}if(C(t,e.style,i),e.cls&&t.setAttribute("class",e.cls),e.data)for(const n of Object.keys(e.data))t.setAttribute("data-"+n,e.data[n]);if(e.ref&&(t.setAttribute("data-bc-mark",String(e.ref.mark)),t.setAttribute("data-bc-row",String(e.ref.row))),e.pressed!==void 0&&(t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-pressed",e.pressed?"true":"false"),i.controls.push(t)),e.title){const n=s("title");n.textContent=e.title,t.appendChild(n)}return t}const $={role:"renderer",type:"svg",version:6,render(e,i){const t=s("svg");t.setAttribute("width","100%"),t.setAttribute("role","img"),t.setAttribute("style","display:block;height:auto");let n=[];const l=o=>{const a=t.ownerDocument||(typeof document>"u"?null:document),u=a&&a.activeElement?n.indexOf(a.activeElement):-1;t.textContent="",t.setAttribute("viewBox",`0 0 ${o.size.w} ${o.size.h}`);const b=s("defs");t.appendChild(b);const c={defs:b,plot:o.plot,fades:new Map,controls:[]},f=[];for(const d of o.layers){const h=s("g");h.setAttribute("data-bc-layer",d.name),d.clip&&y(h,d.clip,b);for(const S of d.prims){const v=c.controls.length,p=g(S,c);c.controls.length===v&&f.push(p),h.appendChild(p)}t.appendChild(h)}if(n=c.controls,t.setAttribute("role",n.length?"group":"img"),n.length)for(const d of f)d.setAttribute("aria-hidden","true");o.label?t.setAttribute("aria-label",o.label):t.removeAttribute("aria-label");const A=u>=0?n[u]:void 0;A&&typeof A.focus=="function"&&A.focus({preventScroll:!0})};return l(e),i.appendChild(t),{root:t,update:l,destroy(){t.parentNode&&t.parentNode.removeChild(t)}}}};BC.define($)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(k){const x="http://www.w3.org/2000/svg";let w=0,m=0;function s(e){return document.createElementNS(x,e)}function r(e,i,t){t!==void 0&&e.setAttribute(i,String(t))}function C(e,i,t){const n=e+"|"+i,l=t.fades.get(n);if(l)return l;const o=`bc-fade-${++m}`,a=s("linearGradient");a.setAttribute("id",o),a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("x1","0"),a.setAttribute("x2","0"),r(a,"y1",t.plot.y),r(a,"y2",t.plot.y+t.plot.h);for(const[b,c]of[[0,i],[1,0]]){const f=s("stop");f.setAttribute("offset",String(b)),f.setAttribute("style",`stop-color:${e.replace(/[;{}<>]/g,"")};stop-opacity:${c}`),a.appendChild(f)}t.defs.appendChild(a);const u=`url(#${o})`;return t.fades.set(n,u),u}function $(e,i,t){i&&(i.fill!==void 0&&i.fade&&i.fill!=="none"?e.setAttribute("fill",C(i.fill,i.fillOpacity===void 0?1:i.fillOpacity,t)):i.fill!==void 0&&e.setAttribute("fill",i.fill),i.stroke!==void 0&&e.setAttribute("stroke",i.stroke),r(e,"stroke-width",i.strokeWidth),i.strokeDash&&e.setAttribute("stroke-dasharray",i.strokeDash.join(" ")),r(e,"opacity",i.opacity),i.fade||r(e,"fill-opacity",i.fillOpacity),i.strokeLinejoin&&e.setAttribute("stroke-linejoin",i.strokeLinejoin),i.strokeLinecap&&e.setAttribute("stroke-linecap",i.strokeLinecap),i.paintOrder&&e.setAttribute("paint-order",i.paintOrder))}function y(e,i,t){const n=`bc-clip-${++w}`,l=s("clipPath");l.setAttribute("id",n);const o=s("rect");r(o,"x",i.x),r(o,"y",i.y),r(o,"width",i.w),r(o,"height",i.h),l.appendChild(o),t.appendChild(l),e.setAttribute("clip-path",`url(#${n})`)}function g(e,i){let t;switch(e.type){case"path":t=s("path"),t.setAttribute("d",e.d);break;case"rect":t=s("rect"),r(t,"x",e.x),r(t,"y",e.y),r(t,"width",e.w),r(t,"height",e.h),r(t,"rx",e.r);break;case"circle":t=s("circle"),r(t,"cx",e.cx),r(t,"cy",e.cy),r(t,"r",e.r);break;case"text":t=s("text"),r(t,"x",e.x),r(t,"y",e.y),r(t,"font-size",e.size),e.weight!==void 0&&t.setAttribute("font-weight",String(e.weight)),e.anchor&&t.setAttribute("text-anchor",e.anchor),e.baseline&&t.setAttribute("dominant-baseline",e.baseline),e.rotate&&t.setAttribute("transform",`rotate(${e.rotate} ${e.x} ${e.y})`),t.textContent=e.text;break;case"g":t=s("g"),e.translate&&t.setAttribute("transform",`translate(${e.translate[0]} ${e.translate[1]})`),e.clip&&y(t,e.clip,i.defs);for(const n of e.children)t.appendChild(g(n,i));break}if($(t,e.style,i),e.cls&&t.setAttribute("class",e.cls),e.data)for(const n of Object.keys(e.data))t.setAttribute("data-"+n,e.data[n]);if(e.ref&&(t.setAttribute("data-bc-mark",String(e.ref.mark)),t.setAttribute("data-bc-row",String(e.ref.row))),e.pressed!==void 0&&(t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-pressed",e.pressed?"true":"false"),i.controls.push(t)),e.title){const n=s("title");n.textContent=e.title,t.appendChild(n)}return t}const S={role:"renderer",type:"svg",version:6,render(e,i){const t=s("svg");t.setAttribute("width","100%"),t.setAttribute("role","img"),t.setAttribute("style","display:block;height:auto");let n=[];const l=o=>{const a=t.ownerDocument||(typeof document>"u"?null:document),u=a&&a.activeElement?n.indexOf(a.activeElement):-1;t.textContent="",t.setAttribute("viewBox",`0 0 ${o.size.w} ${o.size.h}`);const b=s("defs");t.appendChild(b);const c={defs:b,plot:o.plot,fades:new Map,controls:[]},f=[];for(const d of o.layers){const h=s("g");h.setAttribute("data-bc-layer",d.name),d.clip&&y(h,d.clip,b);for(const v of d.prims){const O=c.controls.length,p=g(v,c);c.controls.length===O&&f.push(p),h.appendChild(p)}t.appendChild(h)}if(n=c.controls,t.setAttribute("role",n.length?"group":"img"),n.length)for(const d of f)d.setAttribute("aria-hidden","true");o.label?t.setAttribute("aria-label",o.label):t.removeAttribute("aria-label");const A=u>=0?n[u]:void 0;A&&typeof A.focus=="function"&&A.focus({preventScroll:!0})};return l(e),i.appendChild(t),{root:t,update:l,destroy(){t.parentNode&&t.parentNode.removeChild(t)}}}};k.define(S)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function y(t){const i=new Set,r=[];for(const u of t)for(let a=0;a<u.length;a++){const e=u[a];e==null||typeof e=="number"&&isNaN(e)||i.has(e)||(i.add(e),r.push(e))}return r}const M={role:"scale",type:"band",version:5,output:"position",input:"category",merge:"union",fieldsOnly:!0,params:{paddingInner:{kind:"number",default:.2},paddingOuter:{kind:"number",default:.1}},create(t,i){const r=typeof t.paddingInner=="number"?t.paddingInner:.2,u=typeof t.paddingOuter=="number"?t.paddingOuter:.1,a=t.domain?t.domain.slice():y(i.sources);let e=a,g=new Map,l=Number(i.range[0]),d=Number(i.range[1]),c=0,f=0;const p=()=>{g=new Map,e.forEach((n,o)=>g.set(n,o))},m=()=>{c=Math.abs(d-l)/Math.max(1,e.length-r+2*u),f=c*(1-r)},b=n=>Math.min(l,d)+u*c+n*c;p(),m();const h=(n=>{const o=g.get(n);return o===void 0?NaN:b(o)});return Object.defineProperties(h,{bandwidth:{get:()=>f},domain:{value:()=>e.slice()},baseDomain:{value:()=>a.slice()},setDomain:{value:n=>{e=n?n.slice():a,p(),m()}},range:{value:()=>[l,d]},setRange:{value:n=>{l=n[0],d=n[1],m()}},ticks:{value:(n=10)=>{const o=Math.max(1,Math.ceil(e.length/Math.max(1,n))),v=[];for(let s=0;s<e.length;s+=o)v.push({value:e[s],pos:b(s)+f/2,label:String(e[s])});return v}}}),h}};BC.define(M)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(y){function M(t){const i=new Set,r=[];for(const u of t)for(let a=0;a<u.length;a++){const e=u[a];e==null||typeof e=="number"&&isNaN(e)||i.has(e)||(i.add(e),r.push(e))}return r}const w={role:"scale",type:"band",version:5,output:"position",input:"category",merge:"union",fieldsOnly:!0,params:{paddingInner:{kind:"number",default:.2},paddingOuter:{kind:"number",default:.1}},create(t,i){const r=typeof t.paddingInner=="number"?t.paddingInner:.2,u=typeof t.paddingOuter=="number"?t.paddingOuter:.1,a=t.domain?t.domain.slice():M(i.sources);let e=a,g=new Map,l=Number(i.range[0]),d=Number(i.range[1]),c=0,f=0;const b=()=>{g=new Map,e.forEach((n,o)=>g.set(n,o))},m=()=>{c=Math.abs(d-l)/Math.max(1,e.length-r+2*u),f=c*(1-r)},h=n=>Math.min(l,d)+u*c+n*c;b(),m();const p=(n=>{const o=g.get(n);return o===void 0?NaN:h(o)});return Object.defineProperties(p,{bandwidth:{get:()=>f},domain:{value:()=>e.slice()},baseDomain:{value:()=>a.slice()},setDomain:{value:n=>{e=n?n.slice():a,b(),m()}},range:{value:()=>[l,d]},setRange:{value:n=>{l=n[0],d=n[1],m()}},ticks:{value:(n=10)=>{const o=Math.max(1,Math.ceil(e.length/Math.max(1,n))),v=[];for(let s=0;s<e.length;s+=o)v.push({value:e[s],pos:h(s)+f/2,label:String(e[s])});return v}}}),p}};y.define(w)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function f(o){const i=new Set,t=[];for(const a of o)for(let r=0;r<a.length;r++){const n=a[r];n==null||typeof n=="number"&&isNaN(n)||i.has(n)||(i.add(n),t.push(n))}return t}const g={role:"scale",type:"color",version:4,output:"color",input:"category",merge:"union",create(o,i){const t=o.domain?o.domain.slice():f(i.sources);let a=t,r=null;const n=Array.isArray(o.range)&&o.range.length?o.range.map(String):null,l=e=>n?n[e%n.length]:i.color(e),u=new Map;t.forEach((e,s)=>u.set(e,s));const c=(e=>{const s=u.get(e);return s===void 0?"var(--bc-axis, #999)":r&&!r.has(e)?"":l(s)});return Object.defineProperties(c,{domain:{value:()=>a.slice()},baseDomain:{value:()=>t.slice()},setDomain:{value:e=>{a=e?e.slice():t,r=e?new Set(a):null}},range:{value:()=>t.map((e,s)=>l(s))},setRange:{value:()=>{}}}),c}};BC.define(g)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(f){function g(o){const s=new Set,t=[];for(const r of o)for(let a=0;a<r.length;a++){const n=r[a];n==null||typeof n=="number"&&isNaN(n)||s.has(n)||(s.add(n),t.push(n))}return t}const d={role:"scale",type:"color",version:4,output:"color",input:"category",merge:"union",create(o,s){const t=o.domain?o.domain.slice():g(s.sources);let r=t,a=null;const n=Array.isArray(o.range)&&o.range.length?o.range.map(String):null,i=e=>n?n[e%n.length]:s.color(e),u=new Map;t.forEach((e,l)=>u.set(e,l));const c=(e=>{const l=u.get(e);return l===void 0?"var(--bc-axis, #999)":a&&!a.has(e)?"":i(l)});return Object.defineProperties(c,{domain:{value:()=>r.slice()},baseDomain:{value:()=>t.slice()},setDomain:{value:e=>{r=e?e.slice():t,a=e?new Set(r):null}},range:{value:()=>t.map((e,l)=>i(l))},setRange:{value:()=>{}}}),c}};f.define(d)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const m=()=>BC.get("lib.ticks").exports,b=(i,o)=>m().niceStep(i,o),c=(i,o,e)=>m().roundTicks(i,o,e);function g(i){let o=1/0,e=-1/0;for(const t of i)for(let r=0;r<t.length;r++){const a=t[r];typeof a!="number"||!isFinite(a)||(a<o&&(o=a),a>e&&(e=a))}return o<=e?[o,e]:[0,1]}const h={role:"scale",type:"linear",version:9,output:"position",input:"number",merge:"extent",even:!0,requires:["lib.ticks"],params:{nice:{kind:"boolean",default:!0},zero:{kind:"boolean",default:!1},padding:{kind:"number",default:0}},create(i,o){let e,t;if(i.domain!==void 0&&i.domain!==null){const n=s=>typeof s=="number"?s:typeof s=="string"&&s.trim()?Number(s):NaN,u=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[];if(e=n(u[0]),t=n(u[1]),!isFinite(e)||!isFinite(t)||e===t)throw new Error(`scale.linear: the domain must be two different numbers, not ${JSON.stringify(i.domain)}`)}else{if([e,t]=g(o.sources),i.zero&&(e=Math.min(e,0),t=Math.max(t,0)),t-e<=1e-12*Math.max(Math.abs(e),Math.abs(t))&&(e-=1,t+=1),typeof i.padding=="number"&&i.padding>0){const n=(t-e)*i.padding;e=i.zero&&e===0?0:e-n,t=i.zero&&t===0?0:t+n}if(i.nice!==!1){const n=b(t-e,6);e=Math.floor(e/n+1e-9)*n,t=Math.ceil(t/n-1e-9)*n}}let r=e,a=t,l=Number(o.range[0]),f=Number(o.range[1]);const d=(n=>l+(n-r)/(a-r)*(f-l));return Object.defineProperties(d,{domain:{value:()=>[r,a]},baseDomain:{value:()=>[e,t]},setDomain:{value:n=>{r=n?n[0]:e,a=n?n[1]:t}},range:{value:()=>[l,f]},setRange:{value:n=>{l=n[0],f=n[1]}},invert:{value:n=>r+(n-l)/(f-l)*(a-r)},ticks:{value:(n=6)=>c(r,a,n).map(u=>({...u,pos:d(u.value)}))}}),d}};BC.define(h)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(m){const b=()=>m.get("lib.ticks").exports,c=(i,o)=>b().niceStep(i,o),g=(i,o,e)=>b().roundTicks(i,o,e);function h(i){let o=1/0,e=-1/0;for(const t of i)for(let r=0;r<t.length;r++){const a=t[r];typeof a!="number"||!isFinite(a)||(a<o&&(o=a),a>e&&(e=a))}return o<=e?[o,e]:[0,1]}const N={role:"scale",type:"linear",version:9,output:"position",input:"number",merge:"extent",even:!0,requires:["lib.ticks"],params:{nice:{kind:"boolean",default:!0},zero:{kind:"boolean",default:!1},padding:{kind:"number",default:0}},create(i,o){let e,t;if(i.domain!==void 0&&i.domain!==null){const n=s=>typeof s=="number"?s:typeof s=="string"&&s.trim()?Number(s):NaN,u=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[];if(e=n(u[0]),t=n(u[1]),!isFinite(e)||!isFinite(t)||e===t)throw new Error(`scale.linear: the domain must be two different numbers, not ${JSON.stringify(i.domain)}`)}else{if([e,t]=h(o.sources),i.zero&&(e=Math.min(e,0),t=Math.max(t,0)),t-e<=1e-12*Math.max(Math.abs(e),Math.abs(t))&&(e-=1,t+=1),typeof i.padding=="number"&&i.padding>0){const n=(t-e)*i.padding;e=i.zero&&e===0?0:e-n,t=i.zero&&t===0?0:t+n}if(i.nice!==!1){const n=c(t-e,6);e=Math.floor(e/n+1e-9)*n,t=Math.ceil(t/n-1e-9)*n}}let r=e,a=t,l=Number(o.range[0]),f=Number(o.range[1]);const d=(n=>l+(n-r)/(a-r)*(f-l));return Object.defineProperties(d,{domain:{value:()=>[r,a]},baseDomain:{value:()=>[e,t]},setDomain:{value:n=>{r=n?n[0]:e,a=n?n[1]:t}},range:{value:()=>[l,f]},setRange:{value:n=>{l=n[0],f=n[1]}},invert:{value:n=>r+(n-l)/(f-l)*(a-r)},ticks:{value:(n=6)=>g(r,a,n).map(u=>({...u,pos:d(u.value)}))}}),d}};m.define(N)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const s=Math.log10;function C(i){throw new Error("scale.log: "+i)}function F(i){let r=1/0,t=-1/0;for(const n of i)for(let a=0;a<n.length;a++){const o=n[a];typeof o!="number"||!(o>0)||o===1/0||(o<r&&(r=o),o>t&&(t=o))}return r<=t?[r,t]:null}const w=i=>i>=1?BC.formatter({notation:"compact",maximumSignificantDigits:3})(i):String(+i.toPrecision(3)),E=2,y=(i,r)=>{const t=Math.pow(10,Math.floor(s(i)+1e-9)),n=i/t,a=[1,2,5,10];return t*(r?a.find(o=>o>=n-1e-9):a.slice().reverse().find(o=>o<=n+1e-9))},x={role:"scale",type:"log",version:6,output:"position",input:"number",merge:"extent",params:{nice:{kind:"boolean",default:!0}},create(i,r){let t,n;if(i.domain!==void 0&&i.domain!==null){const e=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[NaN,NaN];t=Number(e[0]),n=Number(e[1]),t>0&&n>0&&isFinite(t)&&isFinite(n)&&t!==n||C(`the domain must be two different positive numbers, not ${JSON.stringify(i.domain)}`)}else{[t,n]=F(r.sources)||[1,10];const c=l=>l>0&&isFinite(l);if(t===n&&(c(t/10)&&(t/=10),c(n*10)&&(n*=10)),i.nice!==!1){const l=s(n)-s(t)<E,m=l?y(t,!1):Math.pow(10,Math.floor(s(t)+1e-9)),d=l?y(n,!0):Math.pow(10,Math.ceil(s(n)-1e-9));c(m)&&(t=m),c(d)&&(n=d)}}let a=t,o=n,u=Number(r.range[0]),p=Number(r.range[1]);const g=(e=>e>0?u+(s(e)-s(a))/(s(o)-s(a))*(p-u):NaN);return Object.defineProperties(g,{domain:{value:()=>[a,o]},baseDomain:{value:()=>[t,n]},setDomain:{value:e=>{a=e&&e[0]>0&&isFinite(e[0])?e[0]:t,o=e&&e[1]>0&&isFinite(e[1])?e[1]:n}},range:{value:()=>[u,p]},setRange:{value:e=>{u=e[0],p=e[1]}},invert:{value:e=>Math.pow(10,s(a)+(e-u)/(p-u)*(s(o)-s(a)))},ticks:{value:(e=6)=>{const c=Math.min(a,o),l=Math.max(a,o),m=Math.floor(s(c)+1e-9),d=Math.ceil(s(l)-1e-9),M=Math.max(1,d-m),b=Math.max(1,e),v=M*3<=b?[1,2,5]:M*2<=b?[1,3]:[1],D=v.length===1?Math.max(1,Math.ceil(M/b)):1,N=[];for(let f=m;f<=d;f++)if(!((f-m)%D))for(const I of v){const h=+(I*Math.pow(10,f)).toPrecision(12);!isFinite(h)||h<c*(1-1e-9)||h>l*(1+1e-9)||N.push({value:h,pos:g(h),label:w(h)})}return N.length<2?[c,l].map(f=>({value:f,pos:g(f),label:w(f)})):N}}}),g}};BC.define(x)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(w){const s=Math.log10;function E(i){throw new Error("scale.log: "+i)}function x(i){let r=1/0,t=-1/0;for(const n of i)for(let a=0;a<n.length;a++){const o=n[a];typeof o!="number"||!(o>0)||o===1/0||(o<r&&(r=o),o>t&&(t=o))}return r<=t?[r,t]:null}const y=i=>i>=1?w.formatter({notation:"compact",maximumSignificantDigits:3})(i):String(+i.toPrecision(3)),C=2,v=(i,r)=>{const t=Math.pow(10,Math.floor(s(i)+1e-9)),n=i/t,a=[1,2,5,10];return t*(r?a.find(o=>o>=n-1e-9):a.slice().reverse().find(o=>o<=n+1e-9))},D={role:"scale",type:"log",version:6,output:"position",input:"number",merge:"extent",params:{nice:{kind:"boolean",default:!0}},create(i,r){let t,n;if(i.domain!==void 0&&i.domain!==null){const e=Array.isArray(i.domain)&&i.domain.length===2?i.domain:[NaN,NaN];t=Number(e[0]),n=Number(e[1]),t>0&&n>0&&isFinite(t)&&isFinite(n)&&t!==n||E(`the domain must be two different positive numbers, not ${JSON.stringify(i.domain)}`)}else{[t,n]=x(r.sources)||[1,10];const c=l=>l>0&&isFinite(l);if(t===n&&(c(t/10)&&(t/=10),c(n*10)&&(n*=10)),i.nice!==!1){const l=s(n)-s(t)<C,m=l?v(t,!1):Math.pow(10,Math.floor(s(t)+1e-9)),d=l?v(n,!0):Math.pow(10,Math.ceil(s(n)-1e-9));c(m)&&(t=m),c(d)&&(n=d)}}let a=t,o=n,u=Number(r.range[0]),g=Number(r.range[1]);const p=(e=>e>0?u+(s(e)-s(a))/(s(o)-s(a))*(g-u):NaN);return Object.defineProperties(p,{domain:{value:()=>[a,o]},baseDomain:{value:()=>[t,n]},setDomain:{value:e=>{a=e&&e[0]>0&&isFinite(e[0])?e[0]:t,o=e&&e[1]>0&&isFinite(e[1])?e[1]:n}},range:{value:()=>[u,g]},setRange:{value:e=>{u=e[0],g=e[1]}},invert:{value:e=>Math.pow(10,s(a)+(e-u)/(g-u)*(s(o)-s(a)))},ticks:{value:(e=6)=>{const c=Math.min(a,o),l=Math.max(a,o),m=Math.floor(s(c)+1e-9),d=Math.ceil(s(l)-1e-9),b=Math.max(1,d-m),M=Math.max(1,e),F=b*3<=M?[1,2,5]:b*2<=M?[1,3]:[1],I=F.length===1?Math.max(1,Math.ceil(b/M)):1,N=[];for(let f=m;f<=d;f++)if(!((f-m)%I))for(const O of F){const h=+(O*Math.pow(10,f)).toPrecision(12);!isFinite(h)||h<c*(1-1e-9)||h>l*(1+1e-9)||N.push({value:h,pos:p(h),label:y(h)})}return N.length<2?[c,l].map(f=>({value:f,pos:p(f),label:y(f)})):N}}}),p}};w.define(D)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const p=["#440154","#3b528b","#21908d","#5dc863","#fde725"];function x(n){const a=typeof n=="string"?/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n.trim()):null;if(!a)throw new Error(`scale.sequential: range colors must be #rgb or #rrggbb, got ${JSON.stringify(n)} (mixing needs real numbers, so CSS variables and names cannot be used)`);let t=a[1];return t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const u=n=>{const a=Math.max(0,Math.min(255,Math.round(n)));return(a<16?"0":"")+a.toString(16)},y=()=>BC.get("lib.ticks").exports,N=(n,a,t)=>y().roundTicks(n,a,t),w={role:"scale",type:"sequential",version:7,output:"color",input:"number",merge:"extent",requires:["lib.ticks"],params:{exponent:{kind:"number",default:1}},create(n,a){const t=(Array.isArray(n.range)&&n.range.length?n.range:p).map(x);if(t.length<2)throw new Error("scale.sequential: range needs at least two colors");let i,o;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),o=Number(e[1]),!isFinite(i)||!isFinite(o)||i===o)throw new Error(`scale.sequential: domain must be two different numbers, [min, max], not ${JSON.stringify(n.domain)}; a diverging scale is three colors in "range" and a domain even around the middle, such as [-10, 10]`)}else{i=1/0,o=-1/0;for(const e of a.sources)for(let s=0;s<e.length;s++){const r=e[s];typeof r!="number"||!isFinite(r)||(r<i&&(i=r),r>o&&(o=r))}i>o&&(i=0,o=1),i===o&&(i-=.5,o+=.5)}let l=i,m=o;const d=typeof n.exponent=="number"&&n.exponent>0&&isFinite(n.exponent)?n.exponent:1,f=e=>d===1?e:e<0?-Math.pow(-e,d):Math.pow(e,d),M=e=>{const s=Math.max(0,Math.min(1,e))*(t.length-1),r=Math.min(t.length-2,Math.floor(s)),g=s-r,c=t[r],b=t[r+1];return"#"+u(c[0]+(b[0]-c[0])*g)+u(c[1]+(b[1]-c[1])*g)+u(c[2]+(b[2]-c[2])*g)},h=(e=>typeof e=="number"&&isFinite(e)?M((f(e)-f(l))/(f(m)-f(l))):"");return Object.defineProperties(h,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,o]},setDomain:{value:e=>{l=e?e[0]:i,m=e?e[1]:o}},range:{value:()=>t.map(e=>"#"+u(e[0])+u(e[1])+u(e[2]))},setRange:{value:()=>{}},ticks:{value:(e=5)=>N(l,m,e).map(s=>({...s,pos:(s.value-l)/(m-l)}))}}),h}};BC.define(w)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(h){const x=["#440154","#3b528b","#21908d","#5dc863","#fde725"];function y(n){const a=typeof n=="string"?/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n.trim()):null;if(!a)throw new Error(`scale.sequential: range colors must be #rgb or #rrggbb, got ${JSON.stringify(n)} (mixing needs real numbers, so CSS variables and names cannot be used)`);let t=a[1];return t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const u=n=>{const a=Math.max(0,Math.min(255,Math.round(n)));return(a<16?"0":"")+a.toString(16)},N=()=>h.get("lib.ticks").exports,w=(n,a,t)=>N().roundTicks(n,a,t),M={role:"scale",type:"sequential",version:7,output:"color",input:"number",merge:"extent",requires:["lib.ticks"],params:{exponent:{kind:"number",default:1}},create(n,a){const t=(Array.isArray(n.range)&&n.range.length?n.range:x).map(y);if(t.length<2)throw new Error("scale.sequential: range needs at least two colors");let i,o;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),o=Number(e[1]),!isFinite(i)||!isFinite(o)||i===o)throw new Error(`scale.sequential: domain must be two different numbers, [min, max], not ${JSON.stringify(n.domain)}; a diverging scale is three colors in "range" and a domain even around the middle, such as [-10, 10]`)}else{i=1/0,o=-1/0;for(const e of a.sources)for(let s=0;s<e.length;s++){const r=e[s];typeof r!="number"||!isFinite(r)||(r<i&&(i=r),r>o&&(o=r))}i>o&&(i=0,o=1),i===o&&(i-=.5,o+=.5)}let l=i,m=o;const d=typeof n.exponent=="number"&&n.exponent>0&&isFinite(n.exponent)?n.exponent:1,f=e=>d===1?e:e<0?-Math.pow(-e,d):Math.pow(e,d),v=e=>{const s=Math.max(0,Math.min(1,e))*(t.length-1),r=Math.min(t.length-2,Math.floor(s)),g=s-r,c=t[r],b=t[r+1];return"#"+u(c[0]+(b[0]-c[0])*g)+u(c[1]+(b[1]-c[1])*g)+u(c[2]+(b[2]-c[2])*g)},p=(e=>typeof e=="number"&&isFinite(e)?v((f(e)-f(l))/(f(m)-f(l))):"");return Object.defineProperties(p,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,o]},setDomain:{value:e=>{l=e?e[0]:i,m=e?e[1]:o}},range:{value:()=>t.map(e=>"#"+u(e[0])+u(e[1])+u(e[2]))},setRange:{value:()=>{}},ticks:{value:(e=5)=>w(l,m,e).map(s=>({...s,pos:(s.value-l)/(m-l)}))}}),p}};h.define(M)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const c=[2,24],d=()=>BC.get("lib.ticks").exports,g=(n,f,a)=>d().roundTicks(n,f,a),y={role:"scale",type:"size",version:6,output:"size",input:"number",merge:"extent",requires:["lib.ticks"],params:{zero:{kind:"boolean",default:!0}},create(n,f){const a=Array.isArray(n.range)&&n.range.length===2?n.range.map(Number):c;if(!a.every(e=>isFinite(e)&&e>=0)||a[0]>a[1])throw new Error(`scale.size: range must be [smallest, largest] radius in px, got ${JSON.stringify(n.range)}`);let s=a[0],u=a[1],i,r;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),r=Number(e[1]),!isFinite(i)||!isFinite(r)||i>=r||i<0)throw new Error(`scale.size: domain must be [min, max] with 0 <= min < max, not ${JSON.stringify(n.domain)}`)}else{i=1/0,r=-1/0;for(const e of f.sources)for(let t=0;t<e.length;t++){const o=e[t];typeof o!="number"||!isFinite(o)||o<0||(o<i&&(i=o),o>r&&(r=o))}i>r&&(i=0,r=1),n.zero!==!1&&(i=0),i===r&&(i=i>0?0:i,r=r>0?r*2:1)}let l=i,m=r;const b=(e=>{if(typeof e!="number"||!isFinite(e)||e<0)return NaN;const t=Math.max(0,Math.min(1,(e-l)/(m-l)));return Math.sqrt(s*s+t*(u*u-s*s))});return Object.defineProperties(b,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,r]},setDomain:{value:e=>{l=e?Number(e[0]):i,m=e?Number(e[1]):r}},range:{value:()=>[s,u]},setRange:{value:e=>{Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"&&isFinite(t))&&(s=e[0],u=e[1])}},ticks:{value:(e=3)=>g(l,m,e).filter(t=>t.value>0).slice(0,50).map(t=>({...t,pos:b(t.value)}))}}),b}};BC.define(y)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(c){const d=[2,24],g=()=>c.get("lib.ticks").exports,y=(n,f,a)=>g().roundTicks(n,f,a),N={role:"scale",type:"size",version:6,output:"size",input:"number",merge:"extent",requires:["lib.ticks"],params:{zero:{kind:"boolean",default:!0}},create(n,f){const a=Array.isArray(n.range)&&n.range.length===2?n.range.map(Number):d;if(!a.every(e=>isFinite(e)&&e>=0)||a[0]>a[1])throw new Error(`scale.size: range must be [smallest, largest] radius in px, got ${JSON.stringify(n.range)}`);let s=a[0],u=a[1],i,r;if(n.domain!==void 0&&n.domain!==null){const e=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(i=Number(e[0]),r=Number(e[1]),!isFinite(i)||!isFinite(r)||i>=r||i<0)throw new Error(`scale.size: domain must be [min, max] with 0 <= min < max, not ${JSON.stringify(n.domain)}`)}else{i=1/0,r=-1/0;for(const e of f.sources)for(let t=0;t<e.length;t++){const o=e[t];typeof o!="number"||!isFinite(o)||o<0||(o<i&&(i=o),o>r&&(r=o))}i>r&&(i=0,r=1),n.zero!==!1&&(i=0),i===r&&(i=i>0?0:i,r=r>0?r*2:1)}let l=i,m=r;const b=(e=>{if(typeof e!="number"||!isFinite(e)||e<0)return NaN;const t=Math.max(0,Math.min(1,(e-l)/(m-l)));return Math.sqrt(s*s+t*(u*u-s*s))});return Object.defineProperties(b,{domain:{value:()=>[l,m]},baseDomain:{value:()=>[i,r]},setDomain:{value:e=>{l=e?Number(e[0]):i,m=e?Number(e[1]):r}},range:{value:()=>[s,u]},setRange:{value:e=>{Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"&&isFinite(t))&&(s=e[0],u=e[1])}},ticks:{value:(e=3)=>y(l,m,e).filter(t=>t.value>0).slice(0,50).map(t=>({...t,pos:b(t.value)}))}}),b}};c.define(N)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const y=[1,2,5,10,20,50,100,200,500,1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5],D=[1,3,6],T=4*864e5,F=864e13,b=1e3,g=n=>(n<10?"0":"")+n;function M(n){return typeof n=="number"?Math.abs(n)<=F?n:NaN:BC.time(n)}function C(n,a){const t=n/315576e5/Math.max(1,a),e=Math.pow(10,Math.floor(Math.log10(Math.max(t,1)))),i=t/e;return Math.max(1,(i<1.5?1:i<3?2:i<7?5:10)*e)}function w(n,a){const t=new Date(n);if(a>=864e5)return BC.formatter({month:"short",day:"numeric"},"date")(n);const e=`${g(t.getUTCHours())}:${g(t.getUTCMinutes())}`;if(a<1e3){const i=t.getUTCMilliseconds();return`${e}:${g(t.getUTCSeconds())}.${i<10?"00":i<100?"0":""}${i}`}return a<6e4?`${e}:${g(t.getUTCSeconds())}`:e}function p(n,a,t){const e=Date.UTC(n,a,t);if(n<0||n>99||!isFinite(e))return e;const i=new Date(e);return i.setUTCFullYear(n),i.getTime()}function S(n,a,t){const e=[];if(!isFinite(n)||!isFinite(a))return e;const i=Math.min(n,a),f=Math.max(n,a),s=f-i,u=y.find(r=>s/r<=t);if(u!==void 0){const r=u===6048e5?T:0;for(let c=Math.ceil((i-r)/u)*u+r;c<=f&&e.length<b;c+=u)e.push({t:c,label:w(c,u)});return e}const d=D.find(r=>s/(r*26298e5)<=t);if(d!==void 0){const r=new Date(i);let c=Math.ceil((r.getUTCFullYear()*12+r.getUTCMonth())/d)*d;for(;e.length<b;c+=d){const l=p(Math.floor(c/12),c%12,1);if(!isFinite(l)||l>f)break;l<i||e.push({t:l,label:BC.formatter({month:"short",year:"numeric"},"date")(l)})}return e}const o=C(s,t);for(let r=Math.ceil(new Date(i).getUTCFullYear()/o)*o;e.length<b;r+=o){const c=p(r,0,1);if(!isFinite(c)||c>f)break;c<i||e.push({t:c,label:String(r)})}return e}function N(n,a){const t=a-n,e=10;let i;const f=y.find(s=>t/s<=e);if(f!==void 0){const s=f===6048e5?T:0;i=[Math.floor((n-s)/f)*f+s,Math.ceil((a-s)/f)*f+s]}else{const s=D.find(l=>t/(l*26298e5)<=e),u=s!==void 0?s:C(t,e)*12,d=l=>p(Math.floor(l/12),(l%12+12)%12,1),o=l=>{const h=new Date(l);return h.getUTCFullYear()*12+h.getUTCMonth()},r=Math.floor(o(n)/u)*u;let c=Math.floor(o(a)/u)*u;d(c)<a&&(c+=u),i=[d(r),d(c)]}return i.every(s=>isFinite(s)&&Math.abs(s)<=F)&&i[0]<i[1]?i:[n,a]}function U(n,a,t){let e=S(n,a,t);for(let i=t*2;e.length<2&&i<=t*16;i*=2){const f=S(n,a,i);f.length>e.length&&(e=f)}return e}const k={role:"scale",type:"time",version:10,output:"position",input:"date",merge:"extent",even:!0,params:{padding:{kind:"number",default:0},nice:{kind:"boolean",default:!1}},create(n,a){let t,e;if(n.domain!==void 0&&n.domain!==null){const o=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(t=M(o[0]),e=M(o[1]),!isFinite(t)||!isFinite(e)||t===e)throw new Error(`scale.time: domain must be two different dates (ISO strings such as "2024-01-01", or epoch milliseconds), got ${JSON.stringify(n.domain)}`)}else{t=1/0,e=-1/0;let o=0,r=0,c=0;for(const l of a.sources)for(let h=0;h<l.length;h++){const m=M(l[h]);if(!isFinite(m)){typeof l[h]=="number"&&isFinite(l[h])&&o++;continue}typeof l[h]=="number"&&m>=1e3&&m<=2999&&m===Math.floor(m)?r++:c++,m<t&&(t=m),m>e&&(e=m)}if(r&&!c)throw new Error(`scale.time: the numbers look like years (${t} to ${e}), and a time scale reads a number as milliseconds since 1970, so all of them fall in its first three seconds. Give the years as text ("2019" is 1 January) or as dates ("2019-01-01"); from a CSV, "types": { "year": "string" } keeps the column text. Or draw them on a linear scale`);if(t>e){if(o)throw new Error("scale.time: the numbers are outside the range of dates; a time scale reads epoch milliseconds (from nanoseconds divide by 1e6, from seconds multiply by 1000)");t=0,e=864e5}if(t===e&&(t-=864e5/2,e+=864e5/2),typeof n.padding=="number"&&n.padding>0){const l=(e-t)*n.padding;t-=l,e+=l}n.nice===!0&&([t,e]=N(t,e))}let i=t,f=e,s=Number(a.range[0]),u=Number(a.range[1]);const d=(o=>s+(M(o)-i)/(f-i)*(u-s));return Object.defineProperties(d,{domain:{value:()=>[i,f]},baseDomain:{value:()=>[t,e]},setDomain:{value:o=>{i=o?M(o[0]):t,f=o?M(o[1]):e}},range:{value:()=>[s,u]},setRange:{value:o=>{s=o[0],u=o[1]}},invert:{value:o=>i+(o-s)/(u-s)*(f-i)},ticks:{value:(o=6)=>U(i,f,Math.max(1,o)).map(r=>({value:r.t,pos:d(r.t),label:r.label}))}}),d}};BC.define(k)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(g){const D=[1,2,5,10,20,50,100,200,500,1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5],T=[1,3,6],F=4*864e5,S=864e13,p=1e3,b=n=>(n<10?"0":"")+n;function M(n){return typeof n=="number"?Math.abs(n)<=S?n:NaN:g.time(n)}function w(n,a){const t=n/315576e5/Math.max(1,a),e=Math.pow(10,Math.floor(Math.log10(Math.max(t,1)))),i=t/e;return Math.max(1,(i<1.5?1:i<3?2:i<7?5:10)*e)}function C(n,a){const t=new Date(n);if(a>=864e5)return g.formatter({month:"short",day:"numeric"},"date")(n);const e=`${b(t.getUTCHours())}:${b(t.getUTCMinutes())}`;if(a<1e3){const i=t.getUTCMilliseconds();return`${e}:${b(t.getUTCSeconds())}.${i<10?"00":i<100?"0":""}${i}`}return a<6e4?`${e}:${b(t.getUTCSeconds())}`:e}function y(n,a,t){const e=Date.UTC(n,a,t);if(n<0||n>99||!isFinite(e))return e;const i=new Date(e);return i.setUTCFullYear(n),i.getTime()}function N(n,a,t){const e=[];if(!isFinite(n)||!isFinite(a))return e;const i=Math.min(n,a),f=Math.max(n,a),s=f-i,u=D.find(r=>s/r<=t);if(u!==void 0){const r=u===6048e5?F:0;for(let c=Math.ceil((i-r)/u)*u+r;c<=f&&e.length<p;c+=u)e.push({t:c,label:C(c,u)});return e}const d=T.find(r=>s/(r*26298e5)<=t);if(d!==void 0){const r=new Date(i);let c=Math.ceil((r.getUTCFullYear()*12+r.getUTCMonth())/d)*d;for(;e.length<p;c+=d){const l=y(Math.floor(c/12),c%12,1);if(!isFinite(l)||l>f)break;l<i||e.push({t:l,label:g.formatter({month:"short",year:"numeric"},"date")(l)})}return e}const o=w(s,t);for(let r=Math.ceil(new Date(i).getUTCFullYear()/o)*o;e.length<p;r+=o){const c=y(r,0,1);if(!isFinite(c)||c>f)break;c<i||e.push({t:c,label:String(r)})}return e}function U(n,a){const t=a-n,e=10;let i;const f=D.find(s=>t/s<=e);if(f!==void 0){const s=f===6048e5?F:0;i=[Math.floor((n-s)/f)*f+s,Math.ceil((a-s)/f)*f+s]}else{const s=T.find(l=>t/(l*26298e5)<=e),u=s!==void 0?s:w(t,e)*12,d=l=>y(Math.floor(l/12),(l%12+12)%12,1),o=l=>{const h=new Date(l);return h.getUTCFullYear()*12+h.getUTCMonth()},r=Math.floor(o(n)/u)*u;let c=Math.floor(o(a)/u)*u;d(c)<a&&(c+=u),i=[d(r),d(c)]}return i.every(s=>isFinite(s)&&Math.abs(s)<=S)&&i[0]<i[1]?i:[n,a]}function k(n,a,t){let e=N(n,a,t);for(let i=t*2;e.length<2&&i<=t*16;i*=2){const f=N(n,a,i);f.length>e.length&&(e=f)}return e}const v={role:"scale",type:"time",version:10,output:"position",input:"date",merge:"extent",even:!0,params:{padding:{kind:"number",default:0},nice:{kind:"boolean",default:!1}},create(n,a){let t,e;if(n.domain!==void 0&&n.domain!==null){const o=Array.isArray(n.domain)&&n.domain.length===2?n.domain:[NaN,NaN];if(t=M(o[0]),e=M(o[1]),!isFinite(t)||!isFinite(e)||t===e)throw new Error(`scale.time: domain must be two different dates (ISO strings such as "2024-01-01", or epoch milliseconds), got ${JSON.stringify(n.domain)}`)}else{t=1/0,e=-1/0;let o=0,r=0,c=0;for(const l of a.sources)for(let h=0;h<l.length;h++){const m=M(l[h]);if(!isFinite(m)){typeof l[h]=="number"&&isFinite(l[h])&&o++;continue}typeof l[h]=="number"&&m>=1e3&&m<=2999&&m===Math.floor(m)?r++:c++,m<t&&(t=m),m>e&&(e=m)}if(r&&!c)throw new Error(`scale.time: the numbers look like years (${t} to ${e}), and a time scale reads a number as milliseconds since 1970, so all of them fall in its first three seconds. Give the years as text ("2019" is 1 January) or as dates ("2019-01-01"); from a CSV, "types": { "year": "string" } keeps the column text. Or draw them on a linear scale`);if(t>e){if(o)throw new Error("scale.time: the numbers are outside the range of dates; a time scale reads epoch milliseconds (from nanoseconds divide by 1e6, from seconds multiply by 1000)");t=0,e=864e5}if(t===e&&(t-=864e5/2,e+=864e5/2),typeof n.padding=="number"&&n.padding>0){const l=(e-t)*n.padding;t-=l,e+=l}n.nice===!0&&([t,e]=U(t,e))}let i=t,f=e,s=Number(a.range[0]),u=Number(a.range[1]);const d=(o=>s+(M(o)-i)/(f-i)*(u-s));return Object.defineProperties(d,{domain:{value:()=>[i,f]},baseDomain:{value:()=>[t,e]},setDomain:{value:o=>{i=o?M(o[0]):t,f=o?M(o[1]):e}},range:{value:()=>[s,u]},setRange:{value:o=>{s=o[0],u=o[1]}},invert:{value:o=>i+(o-s)/(u-s)*(f-i)},ticks:{value:(o=6)=>k(i,f,Math.max(1,o)).map(r=>({value:r.t,pos:d(r.t),label:r.label}))}}),d}};g.define(v)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const N=["count","sum","mean","min","max","median","distinct"],w=["year","quarter","month","week","day","hour"],E=["sum","mean","min","max","median","distinct"],D=["sum","mean","min","max","median"],d=(o,s=2)=>{let r=String(o);for(;r.length<s;)r="0"+r;return r};function m(o){throw new Error("transform.aggregate: "+o)}function O(o){const s=o.groupby===void 0?[]:o.groupby;return Array.isArray(s)||m('"groupby" must be a list of field names'),s.map((r,i)=>{if(typeof r=="string")return{field:r,as:r};const e=r;(!e||typeof e!="object"||typeof e.field!="string")&&m(`groupby[${i}] must be a field name or { field, unit }`),e.unit!==void 0&&(typeof e.unit!="string"||w.indexOf(e.unit)<0)&&m(`groupby[${i}].unit must be one of: ${w.join(", ")}`);const n=e.unit;return{field:e.field,unit:n,as:typeof e.as=="string"&&e.as?e.as:e.field}})}function k(o){const s=o.measures===void 0?[{op:"count"}]:o.measures;return(!Array.isArray(s)||!s.length)&&m('"measures" must be a non-empty list like [{ "op": "sum", "field": "revenue" }]'),s.map((r,i)=>{const e=r;(!e||typeof e!="object"||typeof e.op!="string"||N.indexOf(e.op)<0)&&m(`measures[${i}].op must be one of: ${N.join(", ")}`);const n=e.op;E.indexOf(n)>=0&&typeof e.field!="string"&&m(`measures[${i}]: "${n}" needs a "field"`),e.field!==void 0&&typeof e.field!="string"&&m(`measures[${i}].field must be a field name`);const u=e.field;return{op:n,field:u,as:typeof e.as=="string"&&e.as?e.as:u?`${n}_${u}`:n}})}function x(o){const s=[...O(o).map(i=>i.as),...k(o).map(i=>i.as)],r=s.find((i,e)=>s.indexOf(i)!==e);return r!==void 0&&m(`two output columns are called "${r}"; give one of them another "as"`),s}function A(o,s){const r=BC.time(o);if(!isFinite(r))return null;const i=new Date(r),e=i.getUTCFullYear(),n=i.getUTCMonth();switch(s){case"year":return`${d(e,4)}-01-01`;case"quarter":return`${d(e,4)}-${d(Math.floor(n/3)*3+1)}-01`;case"month":return`${d(e,4)}-${d(n+1)}-01`;case"week":{const u=(i.getUTCDay()+6)%7,c=new Date(Date.UTC(e,n,i.getUTCDate()-u));return`${d(c.getUTCFullYear(),4)}-${d(c.getUTCMonth()+1)}-${d(c.getUTCDate())}`}case"day":return`${d(e,4)}-${d(n+1)}-${d(i.getUTCDate())}`;default:return`${d(e,4)}-${d(n+1)}-${d(i.getUTCDate())}T${d(i.getUTCHours())}:00:00Z`}}const C=o=>typeof o=="number"&&isFinite(o);function S(o,s,r){if(o==="count"){if(!r)return s.length;let n=0;for(const u of s)r[u]!=null&&!(typeof r[u]=="number"&&isNaN(r[u]))&&n++;return n}const i=r;if(o==="distinct"){const n=new Set;for(const u of s)i[u]!=null&&!(typeof i[u]=="number"&&isNaN(i[u]))&&n.add(i[u]);return n.size}const e=[];for(const n of s)C(i[n])&&e.push(i[n]);if(!e.length)return NaN;switch(o){case"sum":return e.reduce((n,u)=>n+u,0);case"mean":return e.reduce((n,u)=>n+u,0)/e.length;case"min":return e.reduce((n,u)=>u<n?u:n);case"max":return e.reduce((n,u)=>u>n?u:n);default:{e.sort((u,c)=>u-c);const n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}}}const j={role:"transform",type:"aggregate",version:3,replacesColumns:!0,params:{groupby:{kind:"list"},measures:{kind:"list",default:[{op:"count"}]},sort:{kind:"string"},order:{kind:"enum",values:["asc","desc"],default:"asc"},limit:{kind:"number"}},outputs:o=>x(o),apply(o,s){const r=O(s),i=k(s),e=x(s);r.forEach((t,f)=>{Object.prototype.hasOwnProperty.call(o.columns,t.field)||m(`unknown field "${t.field}" in "groupby[${f}]"`)}),i.forEach((t,f)=>{t.field&&!Object.prototype.hasOwnProperty.call(o.columns,t.field)&&m(`unknown field "${t.field}" in "measures[${f}].field"`)}),i.forEach((t,f)=>{if(!t.field||D.indexOf(t.op)<0)return;const y=o.columns[t.field];let a;for(let g=0;g<o.length;g++){const l=y[g];if(C(l))return;a===void 0&&l!=null&&l!==""&&typeof l!="number"&&(a=l)}a!==void 0&&m(`measures[${f}]: "${t.op}" needs numbers, and "${t.field}" has none: its values are like ${JSON.stringify(a)}. A number is written as a number: 1750.5, not "1750.5", "1,750.50" or "$1,750"`)}),s.sort!==void 0&&(typeof s.sort!="string"||e.indexOf(s.sort)<0)&&m(`"sort" must be one of the output columns: ${e.join(", ")}`),s.limit!==void 0&&!(typeof s.limit=="number"&&s.limit>=0&&isFinite(s.limit))&&m('"limit" must be a number of at least 0');const n=new Map,u=r.map(t=>o.columns[t.field]);for(let t=0;t<o.length;t++){const f=[];let y=!1;for(let l=0;l<r.length;l++){let p=u[l][t];if(r[l].unit){if(p=A(p,r[l].unit),p===null){y=!0;break}}else typeof p=="number"&&isNaN(p)&&(p=null);f.push(p)}if(y)continue;const a=f.map(l=>typeof l+":"+String(l)).join("\u241F"),g=n.get(a);g?g.rows.push(t):n.set(a,{values:f,rows:[t]})}!r.length&&!n.size&&n.set("",{values:[],rows:[]});let c=Array.from(n.values());const T=c.map(t=>i.map(f=>S(f.op,t.rows,f.field?o.columns[f.field]:void 0)));let h=c.map((t,f)=>f);const U=typeof s.sort=="string"?s.sort:r.some(t=>t.unit)?r.find(t=>t.unit).as:void 0;if(U!==void 0){const t=e.indexOf(U),f=a=>t<r.length?c[a].values[t]:T[a][t-r.length],y=s.order==="desc"?-1:1;h.sort((a,g)=>{const l=f(a),p=f(g),b=l==null||typeof l=="number"&&isNaN(l),v=p==null||typeof p=="number"&&isNaN(p);return b||v?b===v?a-g:b?1:-1:(l<p?-1:l>p?1:0)*y||a-g})}typeof s.limit=="number"&&(h=h.slice(0,Math.floor(s.limit))),c=h.map(t=>c[t]);const F=h.map(t=>T[t]),$={};return r.forEach((t,f)=>{const y=c.map(a=>a.values[f]);$[t.as]=y.every(a=>a===null||typeof a=="number")?Float64Array.from(y.map(a=>a===null?NaN:a)):y}),i.forEach((t,f)=>{$[t.as]=Float64Array.from(F.map(y=>y[f]))}),{length:c.length,columns:$}}};BC.define(j)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(N){const w=["count","sum","mean","min","max","median","distinct"],O=["year","quarter","month","week","day","hour"],D=["sum","mean","min","max","median","distinct"],A=["sum","mean","min","max","median"],d=(o,s=2)=>{let i=String(o);for(;i.length<s;)i="0"+i;return i};function m(o){throw new Error("transform.aggregate: "+o)}function k(o){const s=o.groupby===void 0?[]:o.groupby;return Array.isArray(s)||m('"groupby" must be a list of field names'),s.map((i,r)=>{if(typeof i=="string")return{field:i,as:i};const e=i;(!e||typeof e!="object"||typeof e.field!="string")&&m(`groupby[${r}] must be a field name or { field, unit }`),e.unit!==void 0&&(typeof e.unit!="string"||O.indexOf(e.unit)<0)&&m(`groupby[${r}].unit must be one of: ${O.join(", ")}`);const n=e.unit;return{field:e.field,unit:n,as:typeof e.as=="string"&&e.as?e.as:e.field}})}function x(o){const s=o.measures===void 0?[{op:"count"}]:o.measures;return(!Array.isArray(s)||!s.length)&&m('"measures" must be a non-empty list like [{ "op": "sum", "field": "revenue" }]'),s.map((i,r)=>{const e=i;(!e||typeof e!="object"||typeof e.op!="string"||w.indexOf(e.op)<0)&&m(`measures[${r}].op must be one of: ${w.join(", ")}`);const n=e.op;D.indexOf(n)>=0&&typeof e.field!="string"&&m(`measures[${r}]: "${n}" needs a "field"`),e.field!==void 0&&typeof e.field!="string"&&m(`measures[${r}].field must be a field name`);const u=e.field;return{op:n,field:u,as:typeof e.as=="string"&&e.as?e.as:u?`${n}_${u}`:n}})}function T(o){const s=[...k(o).map(r=>r.as),...x(o).map(r=>r.as)],i=s.find((r,e)=>s.indexOf(r)!==e);return i!==void 0&&m(`two output columns are called "${i}"; give one of them another "as"`),s}function S(o,s){const i=N.time(o);if(!isFinite(i))return null;const r=new Date(i),e=r.getUTCFullYear(),n=r.getUTCMonth();switch(s){case"year":return`${d(e,4)}-01-01`;case"quarter":return`${d(e,4)}-${d(Math.floor(n/3)*3+1)}-01`;case"month":return`${d(e,4)}-${d(n+1)}-01`;case"week":{const u=(r.getUTCDay()+6)%7,c=new Date(Date.UTC(e,n,r.getUTCDate()-u));return`${d(c.getUTCFullYear(),4)}-${d(c.getUTCMonth()+1)}-${d(c.getUTCDate())}`}case"day":return`${d(e,4)}-${d(n+1)}-${d(r.getUTCDate())}`;default:return`${d(e,4)}-${d(n+1)}-${d(r.getUTCDate())}T${d(r.getUTCHours())}:00:00Z`}}const U=o=>typeof o=="number"&&isFinite(o);function j(o,s,i){if(o==="count"){if(!i)return s.length;let n=0;for(const u of s)i[u]!=null&&!(typeof i[u]=="number"&&isNaN(i[u]))&&n++;return n}const r=i;if(o==="distinct"){const n=new Set;for(const u of s)r[u]!=null&&!(typeof r[u]=="number"&&isNaN(r[u]))&&n.add(r[u]);return n.size}const e=[];for(const n of s)U(r[n])&&e.push(r[n]);if(!e.length)return NaN;switch(o){case"sum":return e.reduce((n,u)=>n+u,0);case"mean":return e.reduce((n,u)=>n+u,0)/e.length;case"min":return e.reduce((n,u)=>u<n?u:n);case"max":return e.reduce((n,u)=>u>n?u:n);default:{e.sort((u,c)=>u-c);const n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}}}const F={role:"transform",type:"aggregate",version:3,replacesColumns:!0,params:{groupby:{kind:"list"},measures:{kind:"list",default:[{op:"count"}]},sort:{kind:"string"},order:{kind:"enum",values:["asc","desc"],default:"asc"},limit:{kind:"number"}},outputs:o=>T(o),apply(o,s){const i=k(s),r=x(s),e=T(s);i.forEach((t,f)=>{Object.prototype.hasOwnProperty.call(o.columns,t.field)||m(`unknown field "${t.field}" in "groupby[${f}]"`)}),r.forEach((t,f)=>{t.field&&!Object.prototype.hasOwnProperty.call(o.columns,t.field)&&m(`unknown field "${t.field}" in "measures[${f}].field"`)}),r.forEach((t,f)=>{if(!t.field||A.indexOf(t.op)<0)return;const g=o.columns[t.field];let a;for(let y=0;y<o.length;y++){const l=g[y];if(U(l))return;a===void 0&&l!=null&&l!==""&&typeof l!="number"&&(a=l)}a!==void 0&&m(`measures[${f}]: "${t.op}" needs numbers, and "${t.field}" has none: its values are like ${JSON.stringify(a)}. A number is written as a number: 1750.5, not "1750.5", "1,750.50" or "$1,750"`)}),s.sort!==void 0&&(typeof s.sort!="string"||e.indexOf(s.sort)<0)&&m(`"sort" must be one of the output columns: ${e.join(", ")}`),s.limit!==void 0&&!(typeof s.limit=="number"&&s.limit>=0&&isFinite(s.limit))&&m('"limit" must be a number of at least 0');const n=new Map,u=i.map(t=>o.columns[t.field]);for(let t=0;t<o.length;t++){const f=[];let g=!1;for(let l=0;l<i.length;l++){let p=u[l][t];if(i[l].unit){if(p=S(p,i[l].unit),p===null){g=!0;break}}else typeof p=="number"&&isNaN(p)&&(p=null);f.push(p)}if(g)continue;const a=f.map(l=>typeof l+":"+String(l)).join("\u241F"),y=n.get(a);y?y.rows.push(t):n.set(a,{values:f,rows:[t]})}!i.length&&!n.size&&n.set("",{values:[],rows:[]});let c=Array.from(n.values());const v=c.map(t=>r.map(f=>j(f.op,t.rows,f.field?o.columns[f.field]:void 0)));let h=c.map((t,f)=>f);const C=typeof s.sort=="string"?s.sort:i.some(t=>t.unit)?i.find(t=>t.unit).as:void 0;if(C!==void 0){const t=e.indexOf(C),f=a=>t<i.length?c[a].values[t]:v[a][t-i.length],g=s.order==="desc"?-1:1;h.sort((a,y)=>{const l=f(a),p=f(y),b=l==null||typeof l=="number"&&isNaN(l),E=p==null||typeof p=="number"&&isNaN(p);return b||E?b===E?a-y:b?1:-1:(l<p?-1:l>p?1:0)*g||a-y})}typeof s.limit=="number"&&(h=h.slice(0,Math.floor(s.limit))),c=h.map(t=>c[t]);const M=h.map(t=>v[t]),$={};return i.forEach((t,f)=>{const g=c.map(a=>a.values[f]);$[t.as]=g.every(a=>a===null||typeof a=="number")?Float64Array.from(g.map(a=>a===null?NaN:a)):g}),r.forEach((t,f)=>{$[t.as]=Float64Array.from(M.map(g=>g[f]))}),{length:c.length,columns:$}}};N.define(F)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const _=()=>BC.get("lib.ticks").exports,q=(o,t)=>_().niceStep(o,t);function p(o){const t=o.as;if(t===void 0)return["bin0","bin1","count"];if(Array.isArray(t)&&t.length===3&&t.every(i=>typeof i=="string"&&i)&&new Set(t).size===3)return[t[0],t[1],t[2]];throw new Error('transform.bin: "as" must be three different column names, e.g. ["bin0", "bin1", "count"]')}const O={role:"transform",type:"bin",version:7,requires:["lib.ticks"],replacesColumns:!0,params:{field:{kind:"field",reads:"number",required:!0},bins:{kind:"number",default:10},width:{kind:"number"},log:{kind:"boolean",default:!1},extent:{kind:"list"},group:{kind:"field"},as:{kind:"list"}},outputs(o){const[t,i,a]=p(o);return typeof o.group=="string"?[t,i,a,o.group]:[t,i,a]},labels(o){const[t,i,a]=p(o);return{[t]:"From",[i]:"To",[a]:"Count"}},apply(o,t){const i=t.field,a=Object.prototype.hasOwnProperty.call(o.columns,i)?o.columns[i]:void 0;if(!a)throw new Error(`transform.bin: unknown field "${i}" in "field"`);const u=typeof t.group=="string"?t.group:void 0,l=u?o.columns[u]:void 0;if(u&&!l)throw new Error(`transform.bin: unknown field "${u}" in "group"`);const[M,k,F]=p(t),w=t.log===!0,g=n=>w?n>0?Math.log10(n):NaN:n,P=n=>w?Math.pow(10,n):n;let c=1/0,h=-1/0,x=!1,N=!1;for(let n=0;n<o.length;n++){const e=a[n];if(typeof e!="number"){e!=null&&(N=!0);continue}const r=g(e);isFinite(r)&&(x=!0,r<c&&(c=r),r>h&&(h=r))}if(Array.isArray(t.extent)){const[n,e]=t.extent.map(Number);if(!isFinite(n)||!isFinite(e)||n>=e)throw new Error('transform.bin: "extent" must be [min, max] with min < max');if(w&&n<=0)throw new Error('transform.bin: with "log" the "extent" must be positive');c=g(n),h=g(e)}else if(!x){if(N)throw new Error(`transform.bin: field "${i}" has no numeric values`);if(w&&Array.prototype.some.call(a,n=>typeof n=="number"&&isFinite(n)))throw new Error(`transform.bin: field "${i}" has no positive values, and "log" needs them`);return{length:0,columns:{[M]:new Float64Array(0),[k]:new Float64Array(0),[F]:new Float64Array(0),...u?{[u]:[]}:{}}}}c===h&&(c-=.5,h+=.5);let s;if(t.width!==void 0){if(s=Number(t.width),!isFinite(s)||s<=0)throw new Error('transform.bin: "width" must be a positive number')}else{const n=t.bins===void 0?10:Number(t.bins);if(!isFinite(n)||n<1)throw new Error('transform.bin: "bins" must be a number of at least 1');s=q(h-c,n)}const E=Array.isArray(t.extent),d=E?c:Math.floor(c/s+1e-9)*s,m=Math.max(1,Math.ceil((h-d)/s-1e-9));if(m>5e3)throw new Error(`transform.bin: ${m} bins is too many (at most 5000); use a larger width`);const j=E?h:d+m*s,f=[],A=new Map;if(l)for(let n=0;n<o.length;n++)A.has(l[n])||(A.set(l[n],f.length),f.push(l[n]));else f.push(void 0);const v=new Float64Array(m*f.length);for(let n=0;n<o.length;n++){const e=a[n];if(typeof e!="number")continue;const r=g(e);if(!isFinite(r)||r<d||r>j+1e-9*s)continue;let y=Math.floor((r-d)/s+1e-9);y>=m&&(y=m-1),!(y<0)&&v[y*f.length+(l?A.get(l[n]):0)]++}const b=m*f.length,I=new Float64Array(b),S=new Float64Array(b),$=new Float64Array(b),B=new Array(l?b:0),z=Math.floor(Math.log10(s)),C=n=>{const e=d+n*s,r=Math.floor(Math.log10(Math.max(Math.abs(e),s)))-z+4;return+P(e).toPrecision(Math.min(17,Math.max(12,r)))};for(let n=0;n<m;n++)for(let e=0;e<f.length;e++){const r=n*f.length+e;I[r]=C(n),S[r]=C(n+1),$[r]=v[r],l&&(B[r]=f[e])}const X={[M]:I,[k]:S,[F]:$};return u&&(X[u]=B),{length:b,columns:X}}};BC.define(O)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(M){const C=()=>M.get("lib.ticks").exports,O=(o,t)=>C().niceStep(o,t);function p(o){const t=o.as;if(t===void 0)return["bin0","bin1","count"];if(Array.isArray(t)&&t.length===3&&t.every(i=>typeof i=="string"&&i)&&new Set(t).size===3)return[t[0],t[1],t[2]];throw new Error('transform.bin: "as" must be three different column names, e.g. ["bin0", "bin1", "count"]')}const P={role:"transform",type:"bin",version:7,requires:["lib.ticks"],replacesColumns:!0,params:{field:{kind:"field",reads:"number",required:!0},bins:{kind:"number",default:10},width:{kind:"number"},log:{kind:"boolean",default:!1},extent:{kind:"list"},group:{kind:"field"},as:{kind:"list"}},outputs(o){const[t,i,a]=p(o);return typeof o.group=="string"?[t,i,a,o.group]:[t,i,a]},labels(o){const[t,i,a]=p(o);return{[t]:"From",[i]:"To",[a]:"Count"}},apply(o,t){const i=t.field,a=Object.prototype.hasOwnProperty.call(o.columns,i)?o.columns[i]:void 0;if(!a)throw new Error(`transform.bin: unknown field "${i}" in "field"`);const u=typeof t.group=="string"?t.group:void 0,l=u?o.columns[u]:void 0;if(u&&!l)throw new Error(`transform.bin: unknown field "${u}" in "group"`);const[k,F,x]=p(t),w=t.log===!0,g=n=>w?n>0?Math.log10(n):NaN:n,T=n=>w?Math.pow(10,n):n;let c=1/0,h=-1/0,N=!1,E=!1;for(let n=0;n<o.length;n++){const e=a[n];if(typeof e!="number"){e!=null&&(E=!0);continue}const r=g(e);isFinite(r)&&(N=!0,r<c&&(c=r),r>h&&(h=r))}if(Array.isArray(t.extent)){const[n,e]=t.extent.map(Number);if(!isFinite(n)||!isFinite(e)||n>=e)throw new Error('transform.bin: "extent" must be [min, max] with min < max');if(w&&n<=0)throw new Error('transform.bin: with "log" the "extent" must be positive');c=g(n),h=g(e)}else if(!N){if(E)throw new Error(`transform.bin: field "${i}" has no numeric values`);if(w&&Array.prototype.some.call(a,n=>typeof n=="number"&&isFinite(n)))throw new Error(`transform.bin: field "${i}" has no positive values, and "log" needs them`);return{length:0,columns:{[k]:new Float64Array(0),[F]:new Float64Array(0),[x]:new Float64Array(0),...u?{[u]:[]}:{}}}}c===h&&(c-=.5,h+=.5);let s;if(t.width!==void 0){if(s=Number(t.width),!isFinite(s)||s<=0)throw new Error('transform.bin: "width" must be a positive number')}else{const n=t.bins===void 0?10:Number(t.bins);if(!isFinite(n)||n<1)throw new Error('transform.bin: "bins" must be a number of at least 1');s=O(h-c,n)}const v=Array.isArray(t.extent),d=v?c:Math.floor(c/s+1e-9)*s,m=Math.max(1,Math.ceil((h-d)/s-1e-9));if(m>5e3)throw new Error(`transform.bin: ${m} bins is too many (at most 5000); use a larger width`);const j=v?h:d+m*s,f=[],A=new Map;if(l)for(let n=0;n<o.length;n++)A.has(l[n])||(A.set(l[n],f.length),f.push(l[n]));else f.push(void 0);const I=new Float64Array(m*f.length);for(let n=0;n<o.length;n++){const e=a[n];if(typeof e!="number")continue;const r=g(e);if(!isFinite(r)||r<d||r>j+1e-9*s)continue;let y=Math.floor((r-d)/s+1e-9);y>=m&&(y=m-1),!(y<0)&&I[y*f.length+(l?A.get(l[n]):0)]++}const b=m*f.length,S=new Float64Array(b),$=new Float64Array(b),B=new Float64Array(b),X=new Array(l?b:0),z=Math.floor(Math.log10(s)),_=n=>{const e=d+n*s,r=Math.floor(Math.log10(Math.max(Math.abs(e),s)))-z+4;return+T(e).toPrecision(Math.min(17,Math.max(12,r)))};for(let n=0;n<m;n++)for(let e=0;e<f.length;e++){const r=n*f.length+e;S[r]=_(n),$[r]=_(n+1),B[r]=I[r],l&&(X[r]=f[e])}const q={[k]:S,[F]:$,[x]:B};return u&&(q[u]=X),{length:b,columns:q}}};M.define(P)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const a=["+","-","*","/"];function t(e){throw new Error("transform.calculate: "+e)}function d(e){return(typeof e.as!="string"||!e.as)&&t('"as" must name the new column'),e.as}const m=e=>typeof e=="number"&&isFinite(e)?e:NaN,y={role:"transform",type:"calculate",version:3,params:{a:{kind:"field",reads:"number",required:!0},op:{kind:"enum",values:a,required:!0},b:{kind:"field",reads:"number"},value:{kind:"number"},as:{kind:"string",required:!0}},outputs:e=>[d(e)],apply(e,n){const o=d(n),f=i=>typeof i=="string"&&Object.prototype.hasOwnProperty.call(e.columns,i);(typeof n.a!="string"||!n.a)&&t('"a" must be the name of a numeric field'),f(n.a)||t(`unknown field "${n.a}" in "a"`),(typeof n.op!="string"||a.indexOf(n.op)<0)&&t(`"op" must be one of: ${a.join(" ")}`),n.b===void 0==(n.value===void 0)&&t('give either "b" (a field) or "value" (a number), not both or neither'),n.b!==void 0&&!f(n.b)&&t(`unknown field "${n.b}" in "b"`),n.value!==void 0&&!(typeof n.value=="number"&&isFinite(n.value))&&t('"value" must be a finite number'),f(o)&&o!==n.a&&o!==n.b&&t(`"${o}" is already a column: name the new one differently`);const g=e.columns[n.a],s=n.b!==void 0?e.columns[n.b]:void 0,c=n.value,l=n.op,b=new Float64Array(e.length);for(let i=0;i<e.length;i++){const u=m(g[i]),r=s?m(s[i]):c,h=l==="+"?u+r:l==="-"?u-r:l==="*"?u*r:u/r;b[i]=isFinite(h)?h:NaN}return{length:e.length,columns:{...e.columns,[o]:b}}}};BC.define(y)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(y){const a=["+","-","*","/"];function t(e){throw new Error("transform.calculate: "+e)}function d(e){return(typeof e.as!="string"||!e.as)&&t('"as" must name the new column'),e.as}const m=e=>typeof e=="number"&&isFinite(e)?e:NaN,g={role:"transform",type:"calculate",version:3,params:{a:{kind:"field",reads:"number",required:!0},op:{kind:"enum",values:a,required:!0},b:{kind:"field",reads:"number"},value:{kind:"number"},as:{kind:"string",required:!0}},outputs:e=>[d(e)],apply(e,n){const o=d(n),f=i=>typeof i=="string"&&Object.prototype.hasOwnProperty.call(e.columns,i);(typeof n.a!="string"||!n.a)&&t('"a" must be the name of a numeric field'),f(n.a)||t(`unknown field "${n.a}" in "a"`),(typeof n.op!="string"||a.indexOf(n.op)<0)&&t(`"op" must be one of: ${a.join(" ")}`),n.b===void 0==(n.value===void 0)&&t('give either "b" (a field) or "value" (a number), not both or neither'),n.b!==void 0&&!f(n.b)&&t(`unknown field "${n.b}" in "b"`),n.value!==void 0&&!(typeof n.value=="number"&&isFinite(n.value))&&t('"value" must be a finite number'),f(o)&&o!==n.a&&o!==n.b&&t(`"${o}" is already a column: name the new one differently`);const c=e.columns[n.a],s=n.b!==void 0?e.columns[n.b]:void 0,v=n.value,l=n.op,b=new Float64Array(e.length);for(let i=0;i<e.length;i++){const u=m(c[i]),r=s?m(s[i]):v,h=l==="+"?u+r:l==="-"?u-r:l==="*"?u*r:u/r;b[i]=isFinite(h)?h:NaN}return{length:e.length,columns:{...e.columns,[o]:b}}}};y.define(g)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function f(t){throw new Error("transform.calendar: "+t)}function l(t){const e=Array.isArray(t.as)?t.as:[],o=(s,w)=>typeof e[s]=="string"?e[s]:w;return{week:o(0,"week"),weekEnd:o(1,"weekEnd"),day:o(2,"day")}}const u=t=>new Date(t).toISOString().slice(0,10),y={role:"transform",type:"calendar",version:3,params:{field:{kind:"field",reads:"date",required:!0},weekStart:{kind:"enum",values:["monday","sunday"],default:"monday"},as:{kind:"list"}},outputs(t){const e=l(t);return[e.week,e.weekEnd,e.day]},apply(t,e){const o=l(e),s=n=>Object.prototype.hasOwnProperty.call(t.columns,n);(typeof e.field!="string"||!s(e.field))&&f(`unknown field "${String(e.field)}" in "field"`),e.weekStart!==void 0&&e.weekStart!=="monday"&&e.weekStart!=="sunday"&&f('"weekStart" must be "monday" or "sunday"');for(const n of[o.week,o.weekEnd,o.day])s(n)&&f(`"${n}" is already a column of the data: give the new one another name with "as"`);new Set([o.week,o.weekEnd,o.day]).size<3&&f('"as" must name three different columns');const w=e.weekStart==="sunday"?0:1,m=t.columns[e.field],c=BC.formatter({weekday:"short"},"date"),r=[];for(let n=0;n<t.length;n++){const a=BC.time(m[n]);if(typeof a!="number"||!isFinite(a))continue;const d=Math.floor(a/864e5)*864e5,k=((d/864e5+4-w)%7+7)%7;r.push({row:n,day:d,into:k})}if(r.length)for(let n=0;n<7;n++)r.some(a=>a.into===n)||r.push({row:-1,day:(n+w+3)*864e5,into:n});r.sort((n,a)=>n.into-a.into||n.day-a.day||n.row-a.row);const i={};for(const n of Object.keys(t.columns)){const a=t.columns[n];i[n]=r.map(d=>d.row<0?null:a[d.row])}return i[o.week]=r.map(n=>n.row<0?null:u(n.day-n.into*864e5)),i[o.weekEnd]=r.map(n=>n.row<0?null:u(n.day+(7-n.into)*864e5)),i[o.day]=r.map(n=>c(n.day)),{length:r.length,columns:i}}};BC.define(y)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(w){function f(t){throw new Error("transform.calendar: "+t)}function u(t){const e=Array.isArray(t.as)?t.as:[],o=(s,l)=>typeof e[s]=="string"?e[s]:l;return{week:o(0,"week"),weekEnd:o(1,"weekEnd"),day:o(2,"day")}}const y=t=>new Date(t).toISOString().slice(0,10),m={role:"transform",type:"calendar",version:3,params:{field:{kind:"field",reads:"date",required:!0},weekStart:{kind:"enum",values:["monday","sunday"],default:"monday"},as:{kind:"list"}},outputs(t){const e=u(t);return[e.week,e.weekEnd,e.day]},apply(t,e){const o=u(e),s=n=>Object.prototype.hasOwnProperty.call(t.columns,n);(typeof e.field!="string"||!s(e.field))&&f(`unknown field "${String(e.field)}" in "field"`),e.weekStart!==void 0&&e.weekStart!=="monday"&&e.weekStart!=="sunday"&&f('"weekStart" must be "monday" or "sunday"');for(const n of[o.week,o.weekEnd,o.day])s(n)&&f(`"${n}" is already a column of the data: give the new one another name with "as"`);new Set([o.week,o.weekEnd,o.day]).size<3&&f('"as" must name three different columns');const l=e.weekStart==="sunday"?0:1,c=t.columns[e.field],k=w.formatter({weekday:"short"},"date"),r=[];for(let n=0;n<t.length;n++){const a=w.time(c[n]);if(typeof a!="number"||!isFinite(a))continue;const d=Math.floor(a/864e5)*864e5,h=((d/864e5+4-l)%7+7)%7;r.push({row:n,day:d,into:h})}if(r.length)for(let n=0;n<7;n++)r.some(a=>a.into===n)||r.push({row:-1,day:(n+l+3)*864e5,into:n});r.sort((n,a)=>n.into-a.into||n.day-a.day||n.row-a.row);const i={};for(const n of Object.keys(t.columns)){const a=t.columns[n];i[n]=r.map(d=>d.row<0?null:a[d.row])}return i[o.week]=r.map(n=>n.row<0?null:y(n.day-n.into*864e5)),i[o.weekEnd]=r.map(n=>n.row<0?null:y(n.day+(7-n.into)*864e5)),i[o.day]=r.map(n=>k(n.day)),{length:r.length,columns:i}}};w.define(m)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const z=(a,e,u,d)=>BC.get("lib.columns").exports.check("transform.contour",a,e,u,d);function L(a){throw new Error("transform.contour: "+a)}const H=a=>BC.get("lib.stats").exports.spread(a);function B(a){const e=Float64Array.from(a).sort(),u=H(e);return u>0?u*Math.pow(e.length,-1/6):Math.abs(e[0])*.05||1}function O(a){const e=Math.max(1,Math.ceil(4*a)),u=new Float64Array(2*e+1);let d=0;for(let n=-e;n<=e;n++)d+=u[n+e]=Math.exp(-(n*n)/(2*a*a));for(let n=0;n<u.length;n++)u[n]/=d;return u}function J(a,e,u,d,n){const M=new Float64Array(a.length),k=(d.length-1)/2;for(let y=0;y<u;y++)for(let o=0;o<e;o++){let l=0;for(let s=Math.max(-k,-o);s<=Math.min(k,e-1-o);s++)l+=a[y*e+o+s]*d[s+k];M[y*e+o]=l}const w=new Float64Array(a.length),g=(n.length-1)/2;for(let y=0;y<u;y++)for(let o=0;o<e;o++){let l=0;for(let s=Math.max(-g,-y);s<=Math.min(g,u-1-y);s++)l+=M[(y+s)*e+o]*n[s+g];w[y*e+o]=l}return w}function K(a,e,u,d){const n=(o,l)=>o<0||l<0||o>=e||l>=u?0:a[l*e+o],M=e+2,k=(o,l)=>(l+1)*M+(o+1),w=o=>{const l=o>>1,s=l%M-1,f=Math.floor(l/M)-1,b=o&1,m=n(s,f),E=b?n(s,f+1):n(s+1,f),h=E===m?.5:(d-m)/(E-m);return b?[s,f+h]:[s+h,f]},g=new Map;for(let o=-1;o<u;o++)for(let l=-1;l<e;l++){const s=[n(l,o),n(l+1,o),n(l+1,o+1),n(l,o+1)],f=s.map(h=>h>=d);if(f[0]===f[1]&&f[1]===f[2]&&f[2]===f[3])continue;const b=[2*k(l,o),2*k(l+1,o)+1,2*k(l,o+1),2*k(l,o)+1],m=[];for(let h=0;h<4;h++)f[h]!==f[(h+1)%4]&&m.push({edge:b[h],out:f[h]});const E=m.length===4&&(s[0]+s[1]+s[2]+s[3])/4<d?3:1;m.forEach((h,v)=>{h.out&&g.set(h.edge,m[(v+E)%m.length].edge)})}const y=[];for(const o of g.keys()){if(!g.has(o))continue;const l=[];let s=o;for(;g.has(s);){l.push(w(s));const f=g.get(s);g.delete(s),s=f}l.length>2&&y.push(l)}return y}const P={role:"transform",type:"contour",version:2,requires:["lib.columns","lib.stats"],replacesColumns:!0,params:{x:{kind:"field",reads:"number",required:!0},y:{kind:"field",reads:"number",required:!0},shares:{kind:"list"},levels:{kind:"number",default:6},bandwidth:{kind:"list"},extent:{kind:"list"},grid:{kind:"number",default:80}},outputs(a){const e=["level","share","density","ring"];for(const u of[a.x,a.y])typeof u=="string"&&e.push(u);return e},apply(a,e){const u=e.x,d=e.y;z(a,[["x",u],["y",d]],[["x",u],["y",d],["level","level"],["share","share"],["density","density"],["ring","ring"]],Object.keys(a.columns));const n=e.grid===void 0?80:e.grid;typeof n=="number"&&Math.floor(n)===n&&n>=8&&n<=400||L('"grid" must be a whole number from 8 to 400');const M=e.levels===void 0?6:e.levels;typeof M=="number"&&Math.floor(M)===M&&M>=1&&M<=50||L('"levels" must be a whole number from 1 to 50');let k;if(e.shares!==void 0){const t=e.shares;(!Array.isArray(t)||!t.length||t.length>50||!t.every(r=>typeof r=="number"&&r>0&&r<1))&&L('"shares" must be a list of up to 50 numbers above 0 and below 1, like [0.25, 0.5, 0.75]'),k=t.slice()}let w=[null,null];if(e.bandwidth!==void 0){const t=e.bandwidth;(!Array.isArray(t)||t.length!==2||!t.every(r=>r===null||typeof r=="number"&&r>0&&isFinite(r)))&&L('"bandwidth" must be [along x, along y]: two positive numbers, or null to keep one to the rule'),w=t}let g=[[null,null],[null,null]];if(e.extent!==void 0){const t=e.extent,r=i=>i===null||Array.isArray(i)&&i.length===2&&i.every(c=>c===null||typeof c=="number"&&isFinite(c))&&!(typeof i[0]=="number"&&typeof i[1]=="number"&&i[0]>=i[1]);(!Array.isArray(t)||t.length!==2||!t.every(r))&&L('"extent" must be [[x low, x high], [y low, y high]], each end a number or null, the low below the high, like [[0, null], [0, null]]'),g=t.map(i=>i||[null,null])}const y=t=>typeof t=="number"?t:t instanceof Date?t.getTime():NaN,o=a.columns[u],l=a.columns[d],s=[],f=[];for(let t=0;t<a.length;t++){const r=y(o[t]),i=y(l[t]);isFinite(r)&&isFinite(i)&&(s.push(r),f.push(i))}const b={level:[],share:[],density:[],ring:[],[u]:[],[d]:[]},m=s.length;if(!m)return{length:0,columns:b};const E=s.map((t,r)=>r).sort((t,r)=>s[t]-s[r]||f[t]-f[r]),h=Float64Array.from(E,t=>s[t]),v=Float64Array.from(E,t=>f[t]),V=w[0]??B(h),X=w[1]??B(v);let j=1/0,D=-1/0,G=1/0,R=-1/0;for(let t=0;t<m;t++)j=Math.min(j,h[t]),D=Math.max(D,h[t]),G=Math.min(G,v[t]),R=Math.max(R,v[t]);const I=g[0][0]??j-3*V,F=g[1][0]??G-3*X,$=g[0][1]??D+3*V,N=g[1][1]??R+3*X;$>I&&N>F||L('"extent" leaves no room for the points');const _=($-I)/(n-1),S=(N-F)/(n-1),T=(t,r)=>{const i=(t-I)/_,c=(r-F)/S;if(!(i>=0&&c>=0&&i<=n-1&&c<=n-1))return null;const x=Math.min(n-2,Math.floor(i)),A=Math.min(n-2,Math.floor(c));return{i:x,j:A,u:i-x,v:c-A}};let p=new Float64Array(n*n);for(let t=0;t<m;t++){const r=T(h[t],v[t]);if(!r)continue;const{i,j:c,u:x,v:A}=r;p[c*n+i]+=(1-x)*(1-A),p[c*n+i+1]+=x*(1-A),p[(c+1)*n+i]+=(1-x)*A,p[(c+1)*n+i+1]+=x*A}p=J(p,n,n,O(V/_),O(X/S));const Q=1/(m*_*S);for(let t=0;t<p.length;t++)p[t]*=Q;const C=new Float64Array(m);for(let t=0;t<m;t++){const r=T(h[t],v[t]);if(!r)continue;const{i,j:c,u:x,v:A}=r;C[t]=p[c*n+i]*(1-x)*(1-A)+p[c*n+i+1]*x*(1-A)+p[(c+1)*n+i]*(1-x)*A+p[(c+1)*n+i+1]*x*A}const U=Array.from(C).sort((t,r)=>r-t);let q=0;for(let t=0;t<p.length;t++)q=Math.max(q,p[t]);const Y=k?k.map(t=>U[Math.max(0,Math.ceil(t*m)-1)]):Array.from({length:M},(t,r)=>q*(r+1)/(M+1)),Z=Array.from(new Set(Y.filter(t=>t>0))).sort((t,r)=>t-r);let W=0;return Z.forEach((t,r)=>{let i=0;for(let c=0;c<m;c++)C[c]>=t&&i++;for(const c of K(p,n,n,t)){for(const[x,A]of c)b.level.push(r+1),b.share.push(i/m),b.density.push(t),b.ring.push(W),b[u].push(I+Math.min(n-1,Math.max(0,x))*_),b[d].push(F+Math.min(n-1,Math.max(0,A))*S);W++}}),{length:b.level.length,columns:b}}};BC.define(P)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(V){const J=(a,e,u,d)=>V.get("lib.columns").exports.check("transform.contour",a,e,u,d);function L(a){throw new Error("transform.contour: "+a)}const K=a=>V.get("lib.stats").exports.spread(a);function $(a){const e=Float64Array.from(a).sort(),u=K(e);return u>0?u*Math.pow(e.length,-1/6):Math.abs(e[0])*.05||1}function N(a){const e=Math.max(1,Math.ceil(4*a)),u=new Float64Array(2*e+1);let d=0;for(let n=-e;n<=e;n++)d+=u[n+e]=Math.exp(-(n*n)/(2*a*a));for(let n=0;n<u.length;n++)u[n]/=d;return u}function P(a,e,u,d,n){const b=new Float64Array(a.length),k=(d.length-1)/2;for(let y=0;y<u;y++)for(let o=0;o<e;o++){let l=0;for(let s=Math.max(-k,-o);s<=Math.min(k,e-1-o);s++)l+=a[y*e+o+s]*d[s+k];b[y*e+o]=l}const w=new Float64Array(a.length),g=(n.length-1)/2;for(let y=0;y<u;y++)for(let o=0;o<e;o++){let l=0;for(let s=Math.max(-g,-y);s<=Math.min(g,u-1-y);s++)l+=b[(y+s)*e+o]*n[s+g];w[y*e+o]=l}return w}function Q(a,e,u,d){const n=(o,l)=>o<0||l<0||o>=e||l>=u?0:a[l*e+o],b=e+2,k=(o,l)=>(l+1)*b+(o+1),w=o=>{const l=o>>1,s=l%b-1,f=Math.floor(l/b)-1,M=o&1,m=n(s,f),E=M?n(s,f+1):n(s+1,f),h=E===m?.5:(d-m)/(E-m);return M?[s,f+h]:[s+h,f]},g=new Map;for(let o=-1;o<u;o++)for(let l=-1;l<e;l++){const s=[n(l,o),n(l+1,o),n(l+1,o+1),n(l,o+1)],f=s.map(h=>h>=d);if(f[0]===f[1]&&f[1]===f[2]&&f[2]===f[3])continue;const M=[2*k(l,o),2*k(l+1,o)+1,2*k(l,o+1),2*k(l,o)+1],m=[];for(let h=0;h<4;h++)f[h]!==f[(h+1)%4]&&m.push({edge:M[h],out:f[h]});const E=m.length===4&&(s[0]+s[1]+s[2]+s[3])/4<d?3:1;m.forEach((h,v)=>{h.out&&g.set(h.edge,m[(v+E)%m.length].edge)})}const y=[];for(const o of g.keys()){if(!g.has(o))continue;const l=[];let s=o;for(;g.has(s);){l.push(w(s));const f=g.get(s);g.delete(s),s=f}l.length>2&&y.push(l)}return y}const U={role:"transform",type:"contour",version:2,requires:["lib.columns","lib.stats"],replacesColumns:!0,params:{x:{kind:"field",reads:"number",required:!0},y:{kind:"field",reads:"number",required:!0},shares:{kind:"list"},levels:{kind:"number",default:6},bandwidth:{kind:"list"},extent:{kind:"list"},grid:{kind:"number",default:80}},outputs(a){const e=["level","share","density","ring"];for(const u of[a.x,a.y])typeof u=="string"&&e.push(u);return e},apply(a,e){const u=e.x,d=e.y;J(a,[["x",u],["y",d]],[["x",u],["y",d],["level","level"],["share","share"],["density","density"],["ring","ring"]],Object.keys(a.columns));const n=e.grid===void 0?80:e.grid;typeof n=="number"&&Math.floor(n)===n&&n>=8&&n<=400||L('"grid" must be a whole number from 8 to 400');const b=e.levels===void 0?6:e.levels;typeof b=="number"&&Math.floor(b)===b&&b>=1&&b<=50||L('"levels" must be a whole number from 1 to 50');let k;if(e.shares!==void 0){const t=e.shares;(!Array.isArray(t)||!t.length||t.length>50||!t.every(r=>typeof r=="number"&&r>0&&r<1))&&L('"shares" must be a list of up to 50 numbers above 0 and below 1, like [0.25, 0.5, 0.75]'),k=t.slice()}let w=[null,null];if(e.bandwidth!==void 0){const t=e.bandwidth;(!Array.isArray(t)||t.length!==2||!t.every(r=>r===null||typeof r=="number"&&r>0&&isFinite(r)))&&L('"bandwidth" must be [along x, along y]: two positive numbers, or null to keep one to the rule'),w=t}let g=[[null,null],[null,null]];if(e.extent!==void 0){const t=e.extent,r=i=>i===null||Array.isArray(i)&&i.length===2&&i.every(c=>c===null||typeof c=="number"&&isFinite(c))&&!(typeof i[0]=="number"&&typeof i[1]=="number"&&i[0]>=i[1]);(!Array.isArray(t)||t.length!==2||!t.every(r))&&L('"extent" must be [[x low, x high], [y low, y high]], each end a number or null, the low below the high, like [[0, null], [0, null]]'),g=t.map(i=>i||[null,null])}const y=t=>typeof t=="number"?t:t instanceof Date?t.getTime():NaN,o=a.columns[u],l=a.columns[d],s=[],f=[];for(let t=0;t<a.length;t++){const r=y(o[t]),i=y(l[t]);isFinite(r)&&isFinite(i)&&(s.push(r),f.push(i))}const M={level:[],share:[],density:[],ring:[],[u]:[],[d]:[]},m=s.length;if(!m)return{length:0,columns:M};const E=s.map((t,r)=>r).sort((t,r)=>s[t]-s[r]||f[t]-f[r]),h=Float64Array.from(E,t=>s[t]),v=Float64Array.from(E,t=>f[t]),X=w[0]??$(h),j=w[1]??$(v);let D=1/0,G=-1/0,R=1/0,q=-1/0;for(let t=0;t<m;t++)D=Math.min(D,h[t]),G=Math.max(G,h[t]),R=Math.min(R,v[t]),q=Math.max(q,v[t]);const I=g[0][0]??D-3*X,F=g[1][0]??R-3*j,C=g[0][1]??G+3*X,W=g[1][1]??q+3*j;C>I&&W>F||L('"extent" leaves no room for the points');const _=(C-I)/(n-1),S=(W-F)/(n-1),z=(t,r)=>{const i=(t-I)/_,c=(r-F)/S;if(!(i>=0&&c>=0&&i<=n-1&&c<=n-1))return null;const x=Math.min(n-2,Math.floor(i)),A=Math.min(n-2,Math.floor(c));return{i:x,j:A,u:i-x,v:c-A}};let p=new Float64Array(n*n);for(let t=0;t<m;t++){const r=z(h[t],v[t]);if(!r)continue;const{i,j:c,u:x,v:A}=r;p[c*n+i]+=(1-x)*(1-A),p[c*n+i+1]+=x*(1-A),p[(c+1)*n+i]+=(1-x)*A,p[(c+1)*n+i+1]+=x*A}p=P(p,n,n,N(X/_),N(j/S));const Y=1/(m*_*S);for(let t=0;t<p.length;t++)p[t]*=Y;const O=new Float64Array(m);for(let t=0;t<m;t++){const r=z(h[t],v[t]);if(!r)continue;const{i,j:c,u:x,v:A}=r;O[t]=p[c*n+i]*(1-x)*(1-A)+p[c*n+i+1]*x*(1-A)+p[(c+1)*n+i]*(1-x)*A+p[(c+1)*n+i+1]*x*A}const Z=Array.from(O).sort((t,r)=>r-t);let T=0;for(let t=0;t<p.length;t++)T=Math.max(T,p[t]);const B=k?k.map(t=>Z[Math.max(0,Math.ceil(t*m)-1)]):Array.from({length:b},(t,r)=>T*(r+1)/(b+1)),tt=Array.from(new Set(B.filter(t=>t>0))).sort((t,r)=>t-r);let H=0;return tt.forEach((t,r)=>{let i=0;for(let c=0;c<m;c++)O[c]>=t&&i++;for(const c of Q(p,n,n,t)){for(const[x,A]of c)M.level.push(r+1),M.share.push(i/m),M.density.push(t),M.ring.push(H),M[u].push(I+Math.min(n-1,Math.max(0,x))*_),M[d].push(F+Math.min(n-1,Math.max(0,A))*S);H++}}),{length:M.level.length,columns:M}}};V.define(U)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const B=new WeakMap,C=new WeakMap;function j(n,e,o){const i=B.get(n);if(i&&i.length&&(e||i[0].rows.length===o))return i;const s=new Map;if(e)for(let r=0;r<o;r++){const f=s.get(e[r]);f?f.push(r):s.set(e[r],[r])}else{const r=new Int32Array(o);for(let a=0;a<o;a++)r[a]=a;const f=[{key:void 0,rows:r}];return B.set(n,f),f}const m=[];return s.forEach((r,f)=>m.push({key:f,rows:Int32Array.from(r)})),B.set(n,m),m}function q(n,e,o){const i=C.get(n);if(i&&i.scale===o)return i.dir;const s=n.length;if(e instanceof Float64Array&&o.invert&&s>=2){let u=!0,c=!0;for(let d=1;d<s&&(u||c);d++){const g=e[n[d]],w=e[n[d-1]];g!==g||w!==w?(u=!1,c=!1):(g<w&&(u=!1),g>w&&(c=!1))}const b=o(e[n[0]]),l=o(e[n[s-1]]);let $=0;if(isFinite(b)&&isFinite(l)&&b!==l){const d=l>b?1:-1;$=u?d:c?-d:0}return C.set(n,{scale:o,dir:$}),$}let m=!0,r=!0,f=0;for(let u=0;u<s&&(m||r);u++){const c=o(e[n[u]]);if(typeof c!="number"||c!==c){m=!1,r=!1;break}u>0&&(c<f&&(m=!1),c>f&&(r=!1)),f=c}const a=s<2?0:m?1:r?-1:0;return C.set(n,{scale:o,dir:a}),a}const F=(n,e)=>{let o=0,i=n;for(;o<i;){const s=o+i>>1;e(s)?i=s:o=s+1}return o},D={role:"transform",type:"decimate",version:4,viewDependent:!0,params:{x:{kind:"field",required:!0},y:{kind:"field",required:!0},scale:{kind:"scale",default:"x"},group:{kind:"field"},buckets:{kind:"number"},threshold:{kind:"number",default:4}},outputs:()=>[],apply(n,e,o){const i=p=>Object.prototype.hasOwnProperty.call(n.columns,p)?n.columns[p]:void 0,s=e.x,m=e.y,r=i(s),f=i(m);if(!r)throw new Error(`transform.decimate: unknown field "${s}" in "x"`);if(!f)throw new Error(`transform.decimate: unknown field "${m}" in "y"`);const a=typeof e.group=="string"?e.group:void 0,u=a?i(a):void 0;if(a&&!u)throw new Error(`transform.decimate: unknown field "${a}" in "group"`);if(!o)return n;const c=typeof e.scale=="string"?e.scale:"x",b=o.scales[c];if(!b)throw new Error(`transform.decimate: there is no scale named "${c}"`);const l=b.range();if(typeof l[0]!="number"||typeof l[1]!="number")return n;if(e.buckets!==void 0&&!(typeof e.buckets=="number"&&e.buckets>=1&&e.buckets<=2e4))throw new Error('transform.decimate: "buckets" must be a number from 1 to 20000');const $=typeof e.threshold=="number"&&e.threshold>0?e.threshold:4,d=Math.min(l[0],l[1])-12,g=Math.max(l[0],l[1])+12,w=Math.max(1,Math.floor(typeof e.buckets=="number"?e.buckets:Math.abs(l[1]-l[0]))),Y=(g-d)/w,x=[];let S=!1;for(const p of j(u||r,u,n.length)){const k=p.rows,h=k.length,M=q(k,r,b);if(!M){for(let t=0;t<h;t++)x.push(k[t]);if(h>$*w){const t=p.key===void 0?"the rows":`series ${JSON.stringify(p.key)}`;o.warn(`${t} are not sorted by "${s}" (or have a missing "${s}"), so decimate left ${h} rows as they are; sort the data by "${s}" first`)}continue}const E=t=>b(r[k[t]]),J=M===1?F(h,t=>E(t)>=d):F(h,t=>E(t)<=g),P=M===1?F(h,t=>E(t)>g):F(h,t=>E(t)<d),v=Math.max(0,J-1),I=Math.min(h,P+1);if((v>0||I<h)&&(S=!0),I-v<=$*w){for(let t=v;t<I;t++)x.push(k[t]);continue}S=!0;let N=-1,_=0,U=0,G=0,K=0,R=0,T=0;const W=()=>{if(N<0)return;const t=[_,G,K,U].sort((A,z)=>A-z);let y=-1;for(const A of t)A!==y&&x.push(k[A]),y=A;N=-1};for(let t=v;t<I;t++){const y=f[k[t]];if(typeof y!="number"||y!==y){W(),x.push(k[t]);continue}const A=Math.max(0,Math.min(w-1,Math.floor((E(t)-d)/Y)));if(A!==N){W(),N=A,_=U=G=K=t,R=T=y;continue}U=t,y<R&&(R=y,G=t),y>T&&(T=y,K=t)}W()}if(!S)return n;const O=x.length,X={};for(const p of Object.keys(n.columns)){const k=n.columns[p],h=k instanceof Float64Array?new Float64Array(O):new Array(O);for(let M=0;M<O;M++)h[M]=k[x[M]];X[p]=h}return{length:O,columns:X}}};BC.define(D)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(j){const B=new WeakMap,C=new WeakMap;function q(n,e,o){const i=B.get(n);if(i&&i.length&&(e||i[0].rows.length===o))return i;const s=new Map;if(e)for(let r=0;r<o;r++){const f=s.get(e[r]);f?f.push(r):s.set(e[r],[r])}else{const r=new Int32Array(o);for(let a=0;a<o;a++)r[a]=a;const f=[{key:void 0,rows:r}];return B.set(n,f),f}const m=[];return s.forEach((r,f)=>m.push({key:f,rows:Int32Array.from(r)})),B.set(n,m),m}function D(n,e,o){const i=C.get(n);if(i&&i.scale===o)return i.dir;const s=n.length;if(e instanceof Float64Array&&o.invert&&s>=2){let u=!0,c=!0;for(let d=1;d<s&&(u||c);d++){const g=e[n[d]],w=e[n[d-1]];g!==g||w!==w?(u=!1,c=!1):(g<w&&(u=!1),g>w&&(c=!1))}const b=o(e[n[0]]),l=o(e[n[s-1]]);let $=0;if(isFinite(b)&&isFinite(l)&&b!==l){const d=l>b?1:-1;$=u?d:c?-d:0}return C.set(n,{scale:o,dir:$}),$}let m=!0,r=!0,f=0;for(let u=0;u<s&&(m||r);u++){const c=o(e[n[u]]);if(typeof c!="number"||c!==c){m=!1,r=!1;break}u>0&&(c<f&&(m=!1),c>f&&(r=!1)),f=c}const a=s<2?0:m?1:r?-1:0;return C.set(n,{scale:o,dir:a}),a}const F=(n,e)=>{let o=0,i=n;for(;o<i;){const s=o+i>>1;e(s)?i=s:o=s+1}return o},Y={role:"transform",type:"decimate",version:4,viewDependent:!0,params:{x:{kind:"field",required:!0},y:{kind:"field",required:!0},scale:{kind:"scale",default:"x"},group:{kind:"field"},buckets:{kind:"number"},threshold:{kind:"number",default:4}},outputs:()=>[],apply(n,e,o){const i=p=>Object.prototype.hasOwnProperty.call(n.columns,p)?n.columns[p]:void 0,s=e.x,m=e.y,r=i(s),f=i(m);if(!r)throw new Error(`transform.decimate: unknown field "${s}" in "x"`);if(!f)throw new Error(`transform.decimate: unknown field "${m}" in "y"`);const a=typeof e.group=="string"?e.group:void 0,u=a?i(a):void 0;if(a&&!u)throw new Error(`transform.decimate: unknown field "${a}" in "group"`);if(!o)return n;const c=typeof e.scale=="string"?e.scale:"x",b=o.scales[c];if(!b)throw new Error(`transform.decimate: there is no scale named "${c}"`);const l=b.range();if(typeof l[0]!="number"||typeof l[1]!="number")return n;if(e.buckets!==void 0&&!(typeof e.buckets=="number"&&e.buckets>=1&&e.buckets<=2e4))throw new Error('transform.decimate: "buckets" must be a number from 1 to 20000');const $=typeof e.threshold=="number"&&e.threshold>0?e.threshold:4,d=Math.min(l[0],l[1])-12,g=Math.max(l[0],l[1])+12,w=Math.max(1,Math.floor(typeof e.buckets=="number"?e.buckets:Math.abs(l[1]-l[0]))),J=(g-d)/w,x=[];let S=!1;for(const p of q(u||r,u,n.length)){const k=p.rows,h=k.length,M=D(k,r,b);if(!M){for(let t=0;t<h;t++)x.push(k[t]);if(h>$*w){const t=p.key===void 0?"the rows":`series ${JSON.stringify(p.key)}`;o.warn(`${t} are not sorted by "${s}" (or have a missing "${s}"), so decimate left ${h} rows as they are; sort the data by "${s}" first`)}continue}const E=t=>b(r[k[t]]),P=M===1?F(h,t=>E(t)>=d):F(h,t=>E(t)<=g),z=M===1?F(h,t=>E(t)>g):F(h,t=>E(t)<d),v=Math.max(0,P-1),I=Math.min(h,z+1);if((v>0||I<h)&&(S=!0),I-v<=$*w){for(let t=v;t<I;t++)x.push(k[t]);continue}S=!0;let N=-1,_=0,T=0,U=0,G=0,K=0,R=0;const W=()=>{if(N<0)return;const t=[_,U,G,T].sort((A,H)=>A-H);let y=-1;for(const A of t)A!==y&&x.push(k[A]),y=A;N=-1};for(let t=v;t<I;t++){const y=f[k[t]];if(typeof y!="number"||y!==y){W(),x.push(k[t]);continue}const A=Math.max(0,Math.min(w-1,Math.floor((E(t)-d)/J)));if(A!==N){W(),N=A,_=T=U=G=t,K=R=y;continue}T=t,y<K&&(K=y,U=t),y>R&&(R=y,G=t)}W()}if(!S)return n;const O=x.length,X={};for(const p of Object.keys(n.columns)){const k=n.columns[p],h=k instanceof Float64Array?new Float64Array(O):new Array(O);for(let M=0;M<O;M++)h[M]=k[x[M]];X[p]=h}return{length:O,columns:X}}};j.define(Y)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const q=Math.sqrt(2*Math.PI);function s(e){throw new Error("transform.density: "+e)}function x(e){const t=e.as;return t===void 0?["value","density"]:Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&typeof t[1]=="string"&&t[0]&&t[1]&&t[0]!==t[1]?[t[0],t[1]]:s('"as" must be two different column names: [value, density]')}const X=e=>BC.get("lib.stats").exports.spread(e);function _(e){const t=X(e);return t>0?.9*t*Math.pow(e.length,-.2):Math.abs(e[0])*.05||1}const B={role:"transform",type:"density",version:4,requires:["lib.stats"],replacesColumns:!0,params:{field:{kind:"field",reads:"number",required:!0},group:{kind:"field"},bandwidth:{kind:"number"},steps:{kind:"number",default:80},extent:{kind:"list"},counts:{kind:"boolean",default:!1},as:{kind:"list"}},outputs(e){const[t,c]=x(e);return typeof e.group=="string"?[e.group,t,c,"count"]:[t,c,"count"]},apply(e,t){(typeof t.field!="string"||!t.field)&&s('"field" must be the name of a numeric field');const c=Object.prototype.hasOwnProperty.call(e.columns,t.field)?e.columns[t.field]:void 0;c||s(`unknown field "${t.field}" in "field"`);const u=typeof t.group=="string"?t.group:void 0,g=u&&Object.prototype.hasOwnProperty.call(e.columns,u)?e.columns[u]:void 0;u&&!g&&s(`unknown field "${u}" in "group"`);const[A,P]=x(t);for(const[n,o]of[[A,"as[0]"],[P,"as[1]"]])n==="count"&&s(`"count" is the column of the number of samples: give "${o}" another name`),n===u&&s(`"${n}" is the group: give "${o}" another name`);const f=t.steps===void 0?80:t.steps;typeof f=="number"&&Math.floor(f)===f&&f>=2&&f<=1e3||s('"steps" must be a whole number from 2 to 1000');const a=t.bandwidth;a!==void 0&&!(typeof a=="number"&&isFinite(a)&&a>0)&&s('"bandwidth" must be a positive number');let b=-1/0,w=1/0;if(t.extent!==void 0){const n=t.extent,o=i=>i===null||typeof i=="number"&&isFinite(i);(!Array.isArray(n)||n.length!==2||!o(n[0])||!o(n[1]))&&s('"extent" must be [low, high]: two numbers, or null for an end the data decides'),typeof n[0]=="number"&&(b=n[0]),typeof n[1]=="number"&&(w=n[1]),b<w||s('"extent" must run from low to high')}const v=new Map,h=[],k=[];for(let n=0;n<e.length;n++){const o=g?g[n]:void 0,i=o==null||typeof o=="number"&&isNaN(o)?null:o;let r=v.get(i);r===void 0&&(r=h.length,v.set(i,r),h.push(o),k.push([]));const l=c[n];typeof l=="number"&&isFinite(l)&&k[r].push(l)}const E=[],S=[],F=[],T=[];for(let n=0;n<h.length;n++){const o=k[n].sort((m,d)=>m-d),i=o.length;if(!i)continue;const r=typeof a=="number"?a:_(o),l=Math.max(b,o[0]-3*r),$=Math.min(w,o[i-1]+3*r);if(!($>l))continue;const D=(t.counts===!0?i:1)/(i*r*q);let p=0,y=0;const C=6*r;for(let m=0;m<f;m++){const d=l+($-l)*m/(f-1);for(;p<i&&o[p]<d-C;)p++;for(;y<i&&o[y]<=d+C;)y++;let I=0;for(let M=p;M<y;M++){const j=(d-o[M])/r;I+=Math.exp(-.5*j*j)}E.push(h[n]),S.push(d),F.push(I*D),T.push(i)}}const O={[A]:Float64Array.from(S),[P]:Float64Array.from(F),count:Float64Array.from(T)};return u&&(O[u]=E),{length:S.length,columns:O}}};BC.define(B)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(x){const X=Math.sqrt(2*Math.PI);function s(e){throw new Error("transform.density: "+e)}function A(e){const t=e.as;return t===void 0?["value","density"]:Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&typeof t[1]=="string"&&t[0]&&t[1]&&t[0]!==t[1]?[t[0],t[1]]:s('"as" must be two different column names: [value, density]')}const _=e=>x.get("lib.stats").exports.spread(e);function D(e){const t=_(e);return t>0?.9*t*Math.pow(e.length,-.2):Math.abs(e[0])*.05||1}const N={role:"transform",type:"density",version:4,requires:["lib.stats"],replacesColumns:!0,params:{field:{kind:"field",reads:"number",required:!0},group:{kind:"field"},bandwidth:{kind:"number"},steps:{kind:"number",default:80},extent:{kind:"list"},counts:{kind:"boolean",default:!1},as:{kind:"list"}},outputs(e){const[t,c]=A(e);return typeof e.group=="string"?[e.group,t,c,"count"]:[t,c,"count"]},apply(e,t){(typeof t.field!="string"||!t.field)&&s('"field" must be the name of a numeric field');const c=Object.prototype.hasOwnProperty.call(e.columns,t.field)?e.columns[t.field]:void 0;c||s(`unknown field "${t.field}" in "field"`);const u=typeof t.group=="string"?t.group:void 0,g=u&&Object.prototype.hasOwnProperty.call(e.columns,u)?e.columns[u]:void 0;u&&!g&&s(`unknown field "${u}" in "group"`);const[P,v]=A(t);for(const[n,o]of[[P,"as[0]"],[v,"as[1]"]])n==="count"&&s(`"count" is the column of the number of samples: give "${o}" another name`),n===u&&s(`"${n}" is the group: give "${o}" another name`);const f=t.steps===void 0?80:t.steps;typeof f=="number"&&Math.floor(f)===f&&f>=2&&f<=1e3||s('"steps" must be a whole number from 2 to 1000');const a=t.bandwidth;a!==void 0&&!(typeof a=="number"&&isFinite(a)&&a>0)&&s('"bandwidth" must be a positive number');let b=-1/0,w=1/0;if(t.extent!==void 0){const n=t.extent,o=i=>i===null||typeof i=="number"&&isFinite(i);(!Array.isArray(n)||n.length!==2||!o(n[0])||!o(n[1]))&&s('"extent" must be [low, high]: two numbers, or null for an end the data decides'),typeof n[0]=="number"&&(b=n[0]),typeof n[1]=="number"&&(w=n[1]),b<w||s('"extent" must run from low to high')}const T=new Map,h=[],k=[];for(let n=0;n<e.length;n++){const o=g?g[n]:void 0,i=o==null||typeof o=="number"&&isNaN(o)?null:o;let r=T.get(i);r===void 0&&(r=h.length,T.set(i,r),h.push(o),k.push([]));const l=c[n];typeof l=="number"&&isFinite(l)&&k[r].push(l)}const E=[],S=[],F=[],O=[];for(let n=0;n<h.length;n++){const o=k[n].sort((m,d)=>m-d),i=o.length;if(!i)continue;const r=typeof a=="number"?a:D(o),l=Math.max(b,o[0]-3*r),I=Math.min(w,o[i-1]+3*r);if(!(I>l))continue;const V=(t.counts===!0?i:1)/(i*r*X);let p=0,y=0;const j=6*r;for(let m=0;m<f;m++){const d=l+(I-l)*m/(f-1);for(;p<i&&o[p]<d-j;)p++;for(;y<i&&o[y]<=d+j;)y++;let q=0;for(let M=p;M<y;M++){const C=(d-o[M])/r;q+=Math.exp(-.5*C*C)}E.push(h[n]),S.push(d),F.push(q*V),O.push(i)}}const $={[P]:Float64Array.from(S),[v]:Float64Array.from(F),count:Float64Array.from(O)};return u&&($[u]=E),{length:S.length,columns:$}}};x.define(N)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const l=["==","!=","<","<=",">",">=","in","notIn","valid"],p=/^\d{4}-\d{2}(-\d{2})?([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function r(t){throw new Error("transform.filter: "+t)}const f=t=>t==null||t===""||typeof t=="number"&&isNaN(t)||t instanceof Date&&isNaN(t.getTime());function d(t){if(f(t))return null;if(typeof t=="number")return{kind:"number",at:t};if(t instanceof Date)return{kind:"date",at:t.getTime()};if(typeof t=="string"&&p.test(t)){const e=BC.time(t.length===7?t+"-01":t);if(isFinite(e))return{kind:"date",at:e}}return typeof t=="string"?{kind:"text",at:t}:null}function s(t){const e=d(t);return e?e.kind+":"+e.at:typeof t+":"+String(t)}function y(t){const e=t.op===void 0?"==":t.op;if((typeof e!="string"||l.indexOf(e)<0)&&r(`"op" must be one of: ${l.join(", ")}`),e==="valid")return t.value!==void 0&&r('"valid" keeps the rows that have a value: it takes no "value"'),i=>!f(i);if(e==="in"||e==="notIn"){Array.isArray(t.value)||r(`"${e}" needs "value": a list of values`);const i=new Set(t.value.map(s));return e==="in"?n=>!f(n)&&i.has(s(n)):n=>!f(n)&&!i.has(s(n))}const o=t.value;if(typeof o!="number"&&typeof o!="string"&&typeof o!="boolean"&&r(`"${e}" needs "value": a number, a string or a date`),typeof o=="number"&&!isFinite(o)&&r('"value" must be a finite number'),o===""&&r('"value" is empty: to keep the rows that have a value, use "op": "valid"'),e==="=="||e==="!="){const i=s(o);return e==="=="?n=>!f(n)&&s(n)===i:n=>!f(n)&&s(n)!==i}typeof o=="boolean"&&r(`"${e}" compares numbers, dates or text, not true / false`);const a=d(o),u=e==="<"?i=>i<a.at:e==="<="?i=>i<=a.at:e===">"?i=>i>a.at:i=>i>=a.at;return i=>{const n=d(i);return n!==null&&n.kind===a.kind&&u(n.at)}}const h={role:"transform",type:"filter",version:3,params:{field:{kind:"field",required:!0},op:{kind:"enum",values:l,default:"=="},value:{kind:"any"}},outputs:()=>[],apply(t,e){(typeof e.field!="string"||!e.field)&&r('"field" must be the name of a field'),Object.prototype.hasOwnProperty.call(t.columns,e.field)||r(`unknown field "${e.field}" in "field"`);const o=y(e),a=t.columns[e.field],u=[];for(let n=0;n<t.length;n++)o(a[n])&&u.push(n);const i={};for(const n of Object.keys(t.columns)){const m=t.columns[n];i[n]=ArrayBuffer.isView(m)?Float64Array.from(u,c=>m[c]):u.map(c=>m[c])}return{length:u.length,columns:i}}};BC.define(h)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(p){const l=["==","!=","<","<=",">",">=","in","notIn","valid"],y=/^\d{4}-\d{2}(-\d{2})?([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;function r(t){throw new Error("transform.filter: "+t)}const f=t=>t==null||t===""||typeof t=="number"&&isNaN(t)||t instanceof Date&&isNaN(t.getTime());function d(t){if(f(t))return null;if(typeof t=="number")return{kind:"number",at:t};if(t instanceof Date)return{kind:"date",at:t.getTime()};if(typeof t=="string"&&y.test(t)){const e=p.time(t.length===7?t+"-01":t);if(isFinite(e))return{kind:"date",at:e}}return typeof t=="string"?{kind:"text",at:t}:null}function s(t){const e=d(t);return e?e.kind+":"+e.at:typeof t+":"+String(t)}function h(t){const e=t.op===void 0?"==":t.op;if((typeof e!="string"||l.indexOf(e)<0)&&r(`"op" must be one of: ${l.join(", ")}`),e==="valid")return t.value!==void 0&&r('"valid" keeps the rows that have a value: it takes no "value"'),i=>!f(i);if(e==="in"||e==="notIn"){Array.isArray(t.value)||r(`"${e}" needs "value": a list of values`);const i=new Set(t.value.map(s));return e==="in"?n=>!f(n)&&i.has(s(n)):n=>!f(n)&&!i.has(s(n))}const o=t.value;if(typeof o!="number"&&typeof o!="string"&&typeof o!="boolean"&&r(`"${e}" needs "value": a number, a string or a date`),typeof o=="number"&&!isFinite(o)&&r('"value" must be a finite number'),o===""&&r('"value" is empty: to keep the rows that have a value, use "op": "valid"'),e==="=="||e==="!="){const i=s(o);return e==="=="?n=>!f(n)&&s(n)===i:n=>!f(n)&&s(n)!==i}typeof o=="boolean"&&r(`"${e}" compares numbers, dates or text, not true / false`);const a=d(o),u=e==="<"?i=>i<a.at:e==="<="?i=>i<=a.at:e===">"?i=>i>a.at:i=>i>=a.at;return i=>{const n=d(i);return n!==null&&n.kind===a.kind&&u(n.at)}}const g={role:"transform",type:"filter",version:3,params:{field:{kind:"field",required:!0},op:{kind:"enum",values:l,default:"=="},value:{kind:"any"}},outputs:()=>[],apply(t,e){(typeof e.field!="string"||!e.field)&&r('"field" must be the name of a field'),Object.prototype.hasOwnProperty.call(t.columns,e.field)||r(`unknown field "${e.field}" in "field"`);const o=h(e),a=t.columns[e.field],u=[];for(let n=0;n<t.length;n++)o(a[n])&&u.push(n);const i={};for(const n of Object.keys(t.columns)){const m=t.columns[n];i[n]=ArrayBuffer.isView(m)?Float64Array.from(u,c=>m[c]):u.map(c=>m[c])}return{length:u.length,columns:i}}};p.define(g)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){function r(e){throw new Error("transform.fold: "+e)}const y=e=>ArrayBuffer.isView(e);function d(e){for(const s of["key","value"])e[s]!==void 0&&(typeof e[s]!="string"||!e[s])&&r(`"${s}" must be a column name`);const t=e.key||"key",o=e.value||"value";return t===o&&r(`"key" and "value" are both "${t}": give them different names`),{key:t,value:o}}const A={role:"transform",type:"fold",version:3,params:{fields:{kind:"fields",required:!0},key:{kind:"string",default:"key"},value:{kind:"string",default:"value"}},outputs:e=>{const{key:t,value:o}=d(e);return[t,o]},apply(e,t){const o=t.fields;(!Array.isArray(o)||!o.length)&&r('"fields" must be a list of the columns to fold');const{key:s,value:m}=d(t),k={};for(const n of o)(typeof n!="string"||!n)&&r('"fields" must be a list of column names'),Object.prototype.hasOwnProperty.call(e.columns,n)||r(`unknown field "${n}" in "fields"`),k[n]&&r(`"${n}" is listed twice in "fields"`),k[n]=!0;for(const n of[s,m])Object.prototype.hasOwnProperty.call(e.columns,n)&&r(`"${n}" is already a column: name the new one differently`);const a=o.length,l=e.length*a,v=o.map(n=>e.columns[n]),h=v.every(y)?new Float64Array(l):new Array(l),w=new Array(l);for(let n=0,i=0;n<e.length;n++)for(let f=0;f<a;f++,i++)w[i]=o[f],h[i]=v[f][n];const u={};for(const n of Object.keys(e.columns)){const i=e.columns[n],f=y(i)?new Float64Array(l):new Array(l);for(let c=0,g=0;c<e.length;c++){const O=i[c];for(let p=0;p<a;p++,g++)f[g]=O}u[n]=f}return u[s]=w,u[m]=h,{length:l,columns:u}}};BC.define(A)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(A){function r(e){throw new Error("transform.fold: "+e)}const y=e=>ArrayBuffer.isView(e);function d(e){for(const s of["key","value"])e[s]!==void 0&&(typeof e[s]!="string"||!e[s])&&r(`"${s}" must be a column name`);const t=e.key||"key",o=e.value||"value";return t===o&&r(`"key" and "value" are both "${t}": give them different names`),{key:t,value:o}}const O={role:"transform",type:"fold",version:3,params:{fields:{kind:"fields",required:!0},key:{kind:"string",default:"key"},value:{kind:"string",default:"value"}},outputs:e=>{const{key:t,value:o}=d(e);return[t,o]},apply(e,t){const o=t.fields;(!Array.isArray(o)||!o.length)&&r('"fields" must be a list of the columns to fold');const{key:s,value:m}=d(t),k={};for(const n of o)(typeof n!="string"||!n)&&r('"fields" must be a list of column names'),Object.prototype.hasOwnProperty.call(e.columns,n)||r(`unknown field "${n}" in "fields"`),k[n]&&r(`"${n}" is listed twice in "fields"`),k[n]=!0;for(const n of[s,m])Object.prototype.hasOwnProperty.call(e.columns,n)&&r(`"${n}" is already a column: name the new one differently`);const a=o.length,l=e.length*a,h=o.map(n=>e.columns[n]),v=h.every(y)?new Float64Array(l):new Array(l),w=new Array(l);for(let n=0,i=0;n<e.length;n++)for(let f=0;f<a;f++,i++)w[i]=o[f],v[i]=h[f][n];const u={};for(const n of Object.keys(e.columns)){const i=e.columns[n],f=y(i)?new Float64Array(l):new Array(l);for(let c=0,g=0;c<e.length;c++){const j=i[c];for(let p=0;p<a;p++,g++)f[g]=j}u[n]=f}return u[s]=w,u[m]=v,{length:l,columns:u}}};A.define(O)})(globalThis.BC);
3
3
 
@@ -1,3 +1,3 @@
1
- /*! blockcharts 0.0.1 | MIT License */
2
- "use strict";(function(){const g=(t,e,n,l)=>BC.get("lib.columns").exports.check("transform.funnel",t,e,n,l);function f(t){const e=String(t.field),n=Array.isArray(t.as)?t.as:[];return{from:typeof n[0]=="string"?n[0]:e+"0",to:typeof n[1]=="string"?n[1]:e+"1",rate:typeof t.rateAs=="string"?t.rateAs:"rate",step:typeof t.stepAs=="string"?t.stepAs:"stepRate"}}const p={role:"transform",type:"funnel",version:5,requires:["lib.columns"],params:{field:{kind:"field",reads:"number",required:!0},as:{kind:"list"},rateAs:{kind:"string",default:"rate"},stepAs:{kind:"string",default:"stepRate"}},outputs(t){const e=f(t);return[e.from,e.to,e.rate,e.step]},labels(t){const e=f(t);return{[e.from]:"From",[e.to]:"To",[e.rate]:"Of the first stage",[e.step]:"Of the stage before"}},apply(t,e){const n=f(e);g(t,[["field",e.field]],[["as[0]",n.from],["as[1]",n.to],["rateAs",n.rate],["stepAs",n.step]],[e.field]);const l=t.columns[String(e.field)]||[],u=new Float64Array(t.length),m=new Float64Array(t.length),c=new Float64Array(t.length),d=new Float64Array(t.length);let i=NaN,a=NaN;for(let r=0;r<t.length;r++){const s=l[r];if(typeof s!="number"||!isFinite(s)||s<0){u[r]=m[r]=c[r]=d[r]=NaN;continue}u[r]=-s/2,m[r]=s/2,isFinite(i)||(i=s),c[r]=i>0?s/i:NaN,d[r]=isFinite(a)&&a>0?s/a:NaN,a=s}const o={...t.columns};return o[n.from]=u,o[n.to]=m,o[n.rate]=c,o[n.step]=d,{length:t.length,columns:o}}};BC.define(p)})();
1
+ /*! blockcharts 0.0.2 | MIT License */
2
+ "use strict";(function(d){const p=(t,e,n,l)=>d.get("lib.columns").exports.check("transform.funnel",t,e,n,l);function f(t){const e=String(t.field),n=Array.isArray(t.as)?t.as:[];return{from:typeof n[0]=="string"?n[0]:e+"0",to:typeof n[1]=="string"?n[1]:e+"1",rate:typeof t.rateAs=="string"?t.rateAs:"rate",step:typeof t.stepAs=="string"?t.stepAs:"stepRate"}}const A={role:"transform",type:"funnel",version:5,requires:["lib.columns"],params:{field:{kind:"field",reads:"number",required:!0},as:{kind:"list"},rateAs:{kind:"string",default:"rate"},stepAs:{kind:"string",default:"stepRate"}},outputs(t){const e=f(t);return[e.from,e.to,e.rate,e.step]},labels(t){const e=f(t);return{[e.from]:"From",[e.to]:"To",[e.rate]:"Of the first stage",[e.step]:"Of the stage before"}},apply(t,e){const n=f(e);p(t,[["field",e.field]],[["as[0]",n.from],["as[1]",n.to],["rateAs",n.rate],["stepAs",n.step]],[e.field]);const l=t.columns[String(e.field)]||[],u=new Float64Array(t.length),g=new Float64Array(t.length),m=new Float64Array(t.length),c=new Float64Array(t.length);let i=NaN,a=NaN;for(let r=0;r<t.length;r++){const s=l[r];if(typeof s!="number"||!isFinite(s)||s<0){u[r]=g[r]=m[r]=c[r]=NaN;continue}u[r]=-s/2,g[r]=s/2,isFinite(i)||(i=s),m[r]=i>0?s/i:NaN,c[r]=isFinite(a)&&a>0?s/a:NaN,a=s}const o={...t.columns};return o[n.from]=u,o[n.to]=g,o[n.rate]=m,o[n.step]=c,{length:t.length,columns:o}}};d.define(A)})(globalThis.BC);
3
3