@canplot/react 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/axes.d.ts CHANGED
@@ -1,18 +1,3 @@
1
1
  import type { PlotDrawFrame } from "./types";
2
2
  export declare const drawAxes: (plotDrawFrame: PlotDrawFrame) => void;
3
- export type PlotAxisGenTicksOpts = {
4
- frame: PlotDrawFrame;
5
- scaleId: string;
6
- };
7
- export type PlotAxisTickFormatOpts = {
8
- frame: PlotDrawFrame;
9
- scaleId: string;
10
- ticks: number[];
11
- };
12
- export type PlotAxisGenTicks = (opts: PlotAxisGenTicksOpts) => number[];
13
- export type PlotAxisTickFormat = (opts: PlotAxisTickFormatOpts) => string[];
14
- export declare const makeGenTicksDefault: ({ space, }?: {
15
- space?: number;
16
- }) => PlotAxisGenTicks;
17
- export declare const formatTicksDefault: PlotAxisTickFormat;
18
3
  //# sourceMappingURL=axes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"axes.d.ts","sourceRoot":"","sources":["../src/lib/axes.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS7C,eAAO,MAAM,QAAQ,GAAI,eAAe,aAAa,SA8DpD,CAAC;AA8GF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,oBAAoB,KAAK,MAAM,EAAE,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,MAAM,EAAE,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,aAEjC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,KAAG,gBA4B5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,kBAGhC,CAAC"}
1
+ {"version":3,"file":"axes.d.ts","sourceRoot":"","sources":["../src/lib/axes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,QAAQ,GAAI,eAAe,aAAa,SA0CpD,CAAC"}
package/dist/canplot.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react/jsx-runtime"),S=require("react"),ct=require("zustand"),xt=5,St=10,gt=60,kt=30,vt="UTC",Et="en-GB",W=(t,s,e)=>Math.min(Math.max(t,s),e),wt=(t,s,e,o)=>{const{min:i,max:n}=R(t,e),r=o==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,a=(B(t,e)?r.width:r.height)/(n-i);return s/a},R=(t,s)=>{const e=t.scales.find(o=>o.id===s);if(!e)throw new Error(`Scale ${s} not found`);return e},B=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="x",Pt=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="y",U=(t,s)=>{const e=window.devicePixelRatio||1;t.lineCap=s?.lineCap??"butt",t.lineDashOffset=e*(s?.lineDashOffset??0),t.lineJoin=s?.lineJoin??"miter",t.lineWidth=e*(s?.lineWidth??1),t.miterLimit=e*(s?.miterLimit??10),t.strokeStyle=s?.strokeStyle??"black",t.fillStyle=s?.fillStyle??t.strokeStyle,t.font=s?.font??`${10*e}px sans-serif`,t.textAlign=s?.textAlign??"start",t.direction=s?.direction??"inherit",t.textBaseline=s?.textBaseline??"alphabetic",t.fontKerning=s?.fontKerning??"auto"},J=(t,s,e,o)=>{const i=o==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,{min:n,max:r}=R(t,e),a=(B(t,e)?i.width:i.height)/(r-n);return s*a},D=(t,s,e,o)=>{const{min:i}=R(t,e),n=o==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,r=J(t,s-i,e,o);return B(t,e)?W(n.x+r,n.x-10*n.width,n.x+11*n.width):W(n.y+n.height-r,n.y-10*n.height,n.y+11*n.height)},Y=(t,s,e)=>{const o=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return W(s,o.x,o.x+o.width)},j=(t,s,e)=>{const o=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return W(s,o.y,o.y+o.height)},G=(t,s,e)=>{const{min:o,max:i}=R(t,e);return s>=o&&s<=i},L=(t,s,e,o)=>{const{min:i,max:n}=R(t,e),r=o==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,a=B(t,e)?(s-r.x)/r.width:(r.height-s+r.y)/r.height;return i+a*(n-i)},Mt=1,Ct=1e3*Mt,rt=60*Ct,q=60*rt,Q=24*q,At=30*Q,Rt=365*Q,_t=[[1,"milliseconds"],[2,"milliseconds"],[5,"milliseconds"],[10,"milliseconds"],[20,"milliseconds"],[50,"milliseconds"],[100,"milliseconds"],[200,"milliseconds"],[500,"milliseconds"],[1,"seconds"],[5,"seconds"],[10,"seconds"],[15,"seconds"],[30,"seconds"],[1,"minutes"],[5,"minutes"],[10,"minutes"],[15,"minutes"],[30,"minutes"],[1,"hours"],[2,"hours"],[3,"hours"],[4,"hours"],[6,"hours"],[8,"hours"],[12,"hours"],[1,"days"],[3,"days"],[5,"days"],[7,"days"],[10,"days"],[15,"days"],[1,"months"],[2,"months"],[3,"months"],[4,"months"],[6,"months"],[1,"years"],[2,"years"],[5,"years"],[10,"years"],[25,"years"],[50,"years"],[100,"years"]],V=t=>{const[s,e]=t;switch(e){case"milliseconds":return s;case"seconds":return s*Ct;case"minutes":return s*rt;case"hours":return s*q;case"days":return s*Q;case"months":return s*At;case"years":return s*Rt}},Lt=(t,s)=>{const e=new Date(t);return e.setUTCMilliseconds(e.getUTCMilliseconds()+s),e.getTime()},Ut=(t,s)=>{const e=new Date(t);return e.setUTCSeconds(e.getUTCSeconds()+s),e.getTime()},Dt=(t,s)=>{const e=new Date(t);return e.setUTCMinutes(e.getUTCMinutes()+s),e.getTime()},Xt=(t,s)=>{const e=new Date(t);return e.setUTCHours(e.getUTCHours()+s),e.getTime()},Kt=(t,s)=>{const e=new Date(t);return e.setUTCDate(e.getUTCDate()+s),e.getTime()},ft=(t,s)=>{const e=new Date(t);return e.setUTCMonth(e.getUTCMonth()+s),e.getTime()},z=(t,s)=>{const[e,o]=s;switch(o){case"milliseconds":return Lt(t,e);case"seconds":return Ut(t,e);case"minutes":return Dt(t,e);case"hours":return Xt(t,e);case"days":return Kt(t,e);case"months":return ft(t,e);case"years":return ft(t,e*12)}};function H(t,s){const e=new Date(t),o=new Date(e.toLocaleString("en-US",{timeZone:s})),i=new Date(e.toLocaleString("en-US",{timeZone:"UTC"}));return(o.getTime()-i.getTime())/(3600*1e3)}const It=(t,s,e="UTC")=>{const[o,i]=s;let n=new Date(t);const r=()=>{n.setUTCHours(-H(n,e),0,0,0)};switch(i){case"milliseconds":n.setUTCMilliseconds(Math.ceil(n.getUTCMilliseconds()/o)*o);break;case"seconds":n.setUTCSeconds(Math.ceil(n.getUTCSeconds()/o)*o,0);break;case"minutes":n.setUTCMinutes(Math.ceil(n.getTime()%q/rt/o)*o,0,0);break;case"hours":n.setUTCHours(Math.ceil(n.getTime()%Q/q/o)*o,0,0,0);break;case"days":case"months":case"years":i==="months"?n.setUTCDate(1):i==="years"&&n.setUTCMonth(0,1),r(),n.getTime()<t&&(n=new Date(z(n,[1,i])));break}return n.getTime()},zt=({timeZone:t=vt,space:s=gt})=>({frame:e,scaleId:o})=>{const{min:i,max:n}=R(e,o),r=Math.floor(e.chartAreaCanvasPX.width/s)+1,u=(n-i)/r,[l,d]=_t.find(f=>V(f)>=u)??[1,"milliseconds"],m=It(i,[l,d],t),p=H(m,t),h=[m];let c;for(;;){switch(d){case"milliseconds":case"seconds":case"minutes":case"hours":{c=z(m,[h.length*l,d]);break}case"days":{const f=z(m,[h.length*l,d]);c=z(f,[p-H(f,t),"hours"]);break}case"months":case"years":{const f=z(z(z(m,[p,"hours"]),[h.length*l,d]),[-p,"hours"]);c=z(f,[p-H(f,t),"hours"]);break}}if(c>n)break;h.push(c)}return h},I=(t,s,e)=>t.find(o=>o.type===e)?.value!==s.find(o=>o.type===e)?.value,Ft=({timeZone:t=vt,locale:s=Et,showTimezone:e=!0})=>{const o=new Intl.DateTimeFormat(s,{year:"numeric",day:"numeric",month:"short",hour:"numeric",hourCycle:"h23",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short",timeZone:t});return({ticks:i})=>{const n=i[1]-i[0],r=n<V([1,"days"]),a=n<V([1,"minutes"]),u=n<V([1,"seconds"]);return i.map(l=>o.formatToParts(new Date(l))).map((l,d,m)=>{const p=m[d-1],h=d===0||I(l,p,"year"),c=d===0||I(l,p,"day"),f=d===0||I(l,p,"month"),y=d===0||I(l,p,"hour"),x=d===0||I(l,p,"timeZoneName"),T=d===0||I(l,p,"minute"),g=d===0||I(l,p,"second"),v=d===0||I(l,p,"fractionalSecond"),E=[];if(r&&(y||T||x||g||v)){const C=l.find(_=>_.type==="hour")?.value,P=l.find(_=>_.type==="minute")?.value,M=l.find(_=>_.type==="timeZoneName")?.value;let X="";if(a){const _=l.find(F=>F.type==="second")?.value,$=l.find(F=>F.type==="fractionalSecond")?.value;X=`:${_}`+(u?`.${$}`:"")}E.push(`${C}:${P}${X}`+(e&&x?` ${M}`:""))}return(c||f)&&E.push([l.find(C=>C.type==="month")?.value,c&&l.find(C=>C.type==="day")?.value].filter(Boolean).join(" ")),h&&E.push(l.find(C=>C.type==="year")?.value),E.filter(C=>C).join(`
2
- `)})}},Z=[];for(let t=-12;t<=12;t++)Z.push(1*10**t),Z.push(2*10**t),Z.push(5*10**t);const Yt=t=>{const{ctx:s,scales:e}=t;s.save(),s.strokeStyle="black",s.fillStyle="black",s.lineWidth=1,s.font="12px Arial",s.textAlign="center",s.textBaseline="middle";for(const o of e){if(!o.axis)continue;const i=o.type==="time"?zt({space:o.axis.tickSpace,timeZone:o.timeZone}):jt({space:o.axis.tickSpace}),n=o.type==="time"?Ft({timeZone:o.timeZone,showTimezone:o.axis.showTimezone,locale:o.locale}):Ot,r=o.axis.canvasRect;if(o.origin==="x"){if(o.axis.position==="bottom")s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(r.x+r.width,r.y),s.stroke(),mt(t,o.id,r.y,i,n);else if(o.axis.position==="top"){const a=r.y+r.height;s.beginPath(),s.moveTo(r.x,a),s.lineTo(r.x+r.width,a),s.stroke(),mt(t,o.id,a,i,n)}}else if(o.axis.position==="left"){const a=r.x+r.width;s.beginPath(),s.moveTo(a,r.y),s.lineTo(a,r.y+r.height),s.stroke(),pt(t,o.id,a,i,n)}else o.axis.position==="right"&&(s.beginPath(),s.moveTo(r.x,r.y),s.lineTo(r.x,r.y+r.height),s.stroke(),pt(t,o.id,r.x,i,n))}s.restore()},pt=(t,s,e,o,i)=>{const{ctx:n}=t,r=t.scales.find(c=>c.id===s)?.axis;if(!r)return;const a=window.devicePixelRatio||1,u=xt,l=e,d=r.position==="left"?e-u:e+u,m=St*a,p=o({frame:t,scaleId:s})??[],h=i({frame:t,scaleId:s,ticks:p});n.save(),n.fontKerning="auto",U(n,{}),n.beginPath();for(let c=0;c<p.length;c++){const f=D(t,p[c],s,"canvas");n.moveTo(l,f),n.lineTo(d,f)}n.stroke(),n.restore(),n.save(),U(n,{textBaseline:"middle",textAlign:r.position==="left"?"right":"left"});for(let c=0;c<p.length;c++){const f=D(t,p[c],s,"canvas"),y=h[c].split(`
3
- `);for(let x=0;x<y.length;x++)n.fillText(` ${y[x]} `,d,f+x*m)}n.restore()},mt=(t,s,e,o,i)=>{const{ctx:n}=t,r=t.scales.find(c=>c.id===s)?.axis;if(!r)return;const a=window.devicePixelRatio||1,u=xt,l=e,d=r.position==="top"?e-u:e+u,m=St*a,p=o({frame:t,scaleId:s})??[],h=i({frame:t,scaleId:s,ticks:p});n.save(),n.fontKerning="auto",U(n,{}),n.beginPath();for(let c=0;c<p.length;c++){const f=D(t,p[c],s,"canvas");n.moveTo(f,l),n.lineTo(f,d)}n.stroke(),n.restore(),n.save(),U(n,{textBaseline:r.position==="top"?"bottom":"top",textAlign:"center"});for(let c=0;c<p.length;c++){const f=D(t,p[c],s,"canvas"),y=h[c].split(`
4
- `);for(let x=0;x<y.length;x++)n.fillText(y[x],f,d+a*2+x*m)}n.restore()},jt=({space:t}={})=>({frame:s,scaleId:e})=>{const{min:o,max:i}=R(s,e),n=[],r=window.devicePixelRatio||1,a=(t??(B(s,e)?gt:kt))*r,u=wt(s,a,e,"canvas"),l=Z.find(m=>m>u)??1;let d=o%l<Number.EPSILON?o:o+l-o%l;for(;d<=i;)n.push(d),d+=l;return n},Ot=({ticks:t})=>{const s=Math.max(0,Math.ceil(-Math.log10(t[1]-t[0])));return t.map(e=>e.toFixed(s))},Bt=()=>ct.createStore((t,s)=>{const e=()=>{const o=s()._frame;if(!o)throw new Error("No frame set in frame store");return o};return{_frame:null,getFrame:e,getCtx:()=>e().ctx,clampXPosToChartArea:(o,i)=>Y(e(),o,i??"canvas"),clampYPosToChartArea:(o,i)=>j(e(),o,i??"canvas"),valToPos:(o,i,n)=>D(e(),o,i,n??"canvas"),valToPxDistance:(o,i,n)=>J(e(),o,i,n??"canvas"),valFits:(o,i)=>G(e(),o,i),getScale:o=>R(e(),o)}}),at=S.createContext(null),N=(t,s)=>{const e=S.useContext(at);if(!e)throw new Error("useFrame must be used within a CanPlot component");const o=S.useRef(t);o.current=t,S.useLayoutEffect(()=>{o.current(e.getState()),e.subscribe(i=>{i._frame&&o.current(i)})},[e,...s])},lt=t=>{const s=S.useContext(at);if(!s)throw new Error("useFrame must be used within a CanPlot component");return ct.useStore(s,t??(e=>e.getFrame()))};function $t(t){return s=>{for(const e of t)it(e,s)}}function Nt(t){return s=>{const e=[];for(const o of t){const i=it(o,s),n=typeof i=="function";e.push(n?i:()=>it(o,null))}return()=>{for(const o of e)o()}}}function it(t,s){if(typeof t=="function")return t(s);t&&(t.current=s)}var Vt=parseInt(S.version.split(".")[0],10)>=19?Nt:$t;const Ht=S.forwardRef(({configuration:t,children:s,style:e,className:o},i)=>{const n=S.useRef(null),r=S.useRef(null),a=Wt(r),u=S.useMemo(Bt,[]);S.useLayoutEffect(()=>{u.setState({_frame:Gt(t,a,n.current)})},[t,a,n,u]),S.useLayoutEffect(()=>u.subscribe(d=>{d._frame&&qt(d._frame)}),[u]);const l=window.devicePixelRatio||1;return A.jsxs("div",{ref:Vt([i,r]),className:o,style:{position:"relative",overflow:"hidden",...e},"data-canplotroot":!0,children:[A.jsx("canvas",{ref:n,width:a.width*l,height:a.height*l,style:{inset:0,position:"absolute",width:`${a.width}px`,height:`${a.height}px`}}),A.jsx(Zt,{frameStore:u,children:s})]})}),Zt=({frameStore:t,children:s})=>ct.useStore(t,o=>!!o._frame)?A.jsx(at.Provider,{value:t,children:s}):null,Wt=t=>{const[s,e]=S.useState({width:0,height:0}),[o]=S.useState(()=>new ResizeObserver(i=>{for(const n of i){const r=Math.round(n.contentRect.width),a=Math.round(n.contentRect.height);e(u=>u.width!==r||u.height!==a?{...u,width:r,height:a}:u)}}));return S.useLayoutEffect(()=>{if(!t.current)return;const i=t.current.clientWidth,n=t.current.clientHeight;return e(r=>r.width!==i||r.height!==n?{...r,width:i,height:n}:r),o.observe(t.current,{box:"border-box"}),()=>o.disconnect()},[o,t]),s},Gt=(t,s,e)=>{const o=e?.getContext("2d");if(!o)return null;const i=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const n={x:t.padding.left,y:t.padding.top,width:s.width-t.padding.left-t.padding.right,height:s.height-t.padding.top-t.padding.bottom};for(const h of t.scales)h.axis&&(h.origin==="x"?(h.axis.position==="bottom"||h.axis.position==="top")&&(n.height=Math.max(0,n.height-h.axis.size),h.axis.position==="top"&&(n.y+=h.axis.size)):(h.axis.position==="left"||h.axis.position==="right")&&(n.width=Math.max(0,n.width-h.axis.size),h.axis.position==="left"&&(n.x+=h.axis.size)));const r={x:n.x*i,y:n.y*i,width:n.width*i,height:n.height*i},a=[];let u=t.padding.left*i,l=o.canvas.width-t.padding.right*i,d=o.canvas.height-t.padding.bottom*i,m=t.padding.top*i;for(const h of t.scales){if(!h.axis){a.push({...h,axis:null});continue}let c;if(h.origin==="x")switch(h.axis.position){case"bottom":d-=h.axis.size*i,c={x:n.x,y:d/i,width:n.width,height:h.axis.size};break;case"top":m+=h.axis.size*i,c={x:n.x,y:m/i-h.axis.size,width:n.width,height:h.axis.size};break;case"left":case"right":throw new Error("Invalid axis position for x origin")}else switch(h.axis.position){case"left":u+=h.axis.size*i,c={x:u/i-h.axis.size,y:n.y,width:h.axis.size,height:n.height};break;case"right":l-=h.axis.size*i,c={x:l/i,y:n.y,width:h.axis.size,height:n.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const f={x:c.x*i,y:c.y*i,width:c.width*i,height:c.height*i};a.push({...h,axis:{...h.axis,cssRect:c,canvasRect:f}})}return{ctx:o,dpr:i,padding:t.padding,scales:a,chartAreaCSS:n,chartAreaCanvasPX:r}},qt=t=>{t.ctx.clearRect(0,0,t.ctx.canvas.width,t.ctx.canvas.height),Yt(t)},Jt=({data:t,xScaleId:s,yScaleId:e,style:o})=>(N(({getCtx:i,clampXPosToChartArea:n,clampYPosToChartArea:r,valToPos:a})=>{const u=i();u.save(),u.beginPath(),U(u,o);for(const l of t){const d=n(a(l.x,s)),m=r(a(l.y,e));u.lineTo(d,m)}u.stroke(),u.restore()},[t,s,e,o]),null),Qt=({data:t,xScaleId:s,yScaleId:e,radius:o=5,style:i})=>(N(({getCtx:n,valToPos:r,valFits:a})=>{const u=n();u.save(),u.beginPath(),U(u,i);for(const l of t){if(!a(l.x,s)||!a(l.y,e))continue;const d=r(l.x,s),m=r(l.y,e);u.moveTo(d+o,m),u.arc(d,m,o,0,Math.PI*2)}u.stroke(),u.fill(),u.restore()},[t,s,e,o,i]),null),te=({data:t,xScaleId:s,yScaleId:e,style:o,barWidth:i,xPositionOffset:n,radius:r})=>(N(({getCtx:a,valToPxDistance:u,valToPos:l,clampXPosToChartArea:d,clampYPosToChartArea:m})=>{if(t.length===0)return;const p=a();p.save(),U(p,o);const h=u(i,s);p.beginPath();for(const c of t){const y=l(c.x,s)-h/2+n*h,x=m(l(0,e)),T=m(l(c.y,e)),g=x-T,v=d(y),E=d(y+h)-v;r?p.roundRect(v,T,E,g,r):p.rect(v,T,E,g)}p.closePath(),p.fill(),o?.strokeStyle&&p.stroke(),p.restore()},[t,s,e,o,i,n,r]),null),ee=({data:t,xScaleId:s,yScaleId:e,style:o})=>(N(({getCtx:i,clampXPosToChartArea:n,clampYPosToChartArea:r,valToPos:a})=>{const u=[];for(const d of t){const m=n(a(d.x,s)),p=r(a(d.y[0],e)),h=r(a(d.y[1],e));u.push({x:m,y:p}),u.unshift({x:m,y:h})}const l=i();if(u.length>0){l.save(),l.beginPath(),U(l,o),l.moveTo(u[0].x,u[0].y);for(const d of u)l.lineTo(d.x,d.y);l.closePath(),l.fill(),l.restore()}},[t,s,e,o]),null),se=({data:t,stroked:s,xScaleId:e,yScaleId:o,style:i})=>(N(({getCtx:n,clampXPosToChartArea:r,clampYPosToChartArea:a,valToPos:u})=>{const l=[],d=n();for(const c of t){const f=r(u(c.x,e)),y=a(u(c.y,o));l.push({x:f,y})}const m=l.at(0),p=l.at(-1);if(!m||!p)return;const h=a(u(0,o));d.save(),d.beginPath(),U(d,i),d.moveTo(m.x,h);for(const c of l)d.lineTo(c.x,c.y);if(d.lineTo(p.x,h),d.closePath(),d.fill(),s){d.beginPath(),d.moveTo(m.x,m.y);for(const c of l)d.lineTo(c.x,c.y);d.stroke()}d.restore()},[t,s,e,o,i]),null),ne=(t,s)=>lt(({clampXPosToChartArea:e,clampYPosToChartArea:o,getScale:i,valToPos:n,valFits:r})=>{const a={};for(const u in t){const l=t[u];switch(l.exceeding){case"discard":{if(r(l.value,l.scaleId)){const d=n(l.value,l.scaleId,s);a[u]=d}break}case"clamp":{const d=n(l.value,l.scaleId,s);a[u]=i(l.scaleId)?.origin==="x"?e(d,s):o(d,s);break}}}return a}),b=()=>{const t=[];return{addEventListener:(s,e)=>(t.push({syncKey:s,callback:e}),()=>{const o=t.findIndex(i=>i.callback===e);o!==-1&&t.splice(o,1)}),dispatchEvent:(s,e)=>{for(const o of t)o.syncKey===s&&o.callback(s,e)}}},w={dblclick:b(),click:b(),move:b(),mousedown:b(),mouseup:b(),spanselect:b(),documentmouseup:b(),pressandwheel:b(),sync_dblclick:b(),sync_click:b(),sync_move:b(),sync_mousedown:b(),sync_mouseup:b(),sync_spanselect:b(),sync_pressandwheel:b()},k=(t,s,e)=>{const o=S.useRef(e);o.current=e,S.useEffect(()=>w[t].addEventListener(s,(n,r)=>{o.current(r,n)}),[s,t,o])},ut=S.createContext(""),dt=(t,s)=>{const e=S.useContext(ut);return k(t,e,s)},oe=(t,s,e,o,i)=>{if(!s)return;const n=o??e.scales.find(m=>m.origin==="x")?.id,r=i??e.scales.find(m=>m.origin==="y")?.id;if(!n||!r)return;const a=t.clientX-s.left,u={scaleId:n,value:L(e,a,n,"css")},l=t.clientY-s.top,d={scaleId:r,value:L(e,l,r,"css")};return{pointerSyncPosition:{x:u,y:d},cssX:a,cssY:l}},O=(t,s)=>{const e=t.x?D(s,t.x.value,t.x.scaleId,"css"):0,o=t.y?D(s,t.y.value,t.y.scaleId,"css"):0;return{cssX:e,cssY:o,scaled:Object.fromEntries(s.scales.map(i=>{const n=i.origin==="y"?o:e;return[i.id,L(s,n,i.id,"css")]}))}},yt=(t,s,e)=>{if(!s){const r=t==="x"?e.chartAreaCSS.x:e.chartAreaCSS.y,a=t==="x"?e.chartAreaCSS.x+e.chartAreaCSS.width:e.chartAreaCSS.y+e.chartAreaCSS.height;return{fromCSS:r,toCSS:a,scaled:e.scales.flatMap(u=>{if(u.origin!==t)return[];const{min:l,max:d}=R(e,u.id);return[{scaleId:u.id,from:l,to:d}]})}}const o=D(e,s.from,s.scaleId,"css"),i=D(e,s.to,s.scaleId,"css"),n=e.scales.flatMap(r=>{if(r.origin!==t)return[];const a=L(e,o,r.id,"css"),u=L(e,i,r.id,"css");return[{scaleId:r.id,from:a,to:u}]});return{fromCSS:o,toCSS:i,scaled:n}},ie=({id:t,onClick:s,onDblClick:e,onMouseMove:o,onMouseDown:i,onMouseUp:n,onDocumentMouseUp:r,onSpanSelect:a,className:u,style:l,sync:d,children:m})=>{const p=S.useId(),h=t||p;return k("dblclick",h,c=>{e?.(c)}),k("click",h,c=>{s?.(c)}),k("move",h,c=>{o?.(c)}),k("mousedown",h,c=>{i?.(c)}),k("mouseup",h,c=>{n?.(c)}),k("documentmouseup",h,c=>{r?.(c)}),k("spanselect",h,c=>{a?.(c)}),A.jsxs(ut.Provider,{value:h,children:[A.jsx(ce,{className:u,style:l,sync:d}),m]})},ce=({className:t,style:s,sync:e})=>{const o=S.useRef(null),i=lt(),n=S.useRef(i);n.current=i;const r=S.useContext(ut),a=e?.key||r,u=S.useRef(null),l=S.useRef(null),d=S.useRef(null),m=()=>{const c=o.current?.parentElement;if(c){if(c.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return c.getBoundingClientRect()}},p=(c,f)=>{const y=oe(c,m(),n.current,e?.xViaScaleId,e?.yViaScaleId);y&&f(y.pointerSyncPosition,{cssX:y.cssX,cssY:y.cssY},{ctrlKey:c.ctrlKey,altKey:c.altKey,shiftKey:c.shiftKey,metaKey:c.metaKey})},h=S.useRef(p);return h.current=p,S.useEffect(()=>{const c=g=>{const v=l.current;v&&w.sync_spanselect.dispatchEvent(a,{...v,completed:!0}),w.documentmouseup.dispatchEvent(a,{frame:n.current,keys:{ctrlKey:g.ctrlKey,altKey:g.altKey,shiftKey:g.shiftKey,metaKey:g.metaKey}})},f=g=>{const v={ctrlKey:g.ctrlKey,altKey:g.altKey,shiftKey:g.shiftKey,metaKey:g.metaKey},E=d.current;if(E&&Object.entries(v).some(([P,M])=>E.keys[P]!==M)){const P={...E,keys:v};d.current=P,w.sync_move.dispatchEvent(a,P)}const C=l.current;if(C&&Object.entries(v).some(([P,M])=>C.keys[P]!==M)){g.stopPropagation(),g.preventDefault();const P={...C,keys:v};l.current=P,w.sync_spanselect.dispatchEvent(a,P)}},y=g=>{h.current(g,(v,{cssX:E,cssY:C},P)=>{const M=u.current;if(!M||!v.x||!v.y)return;const X=n.current,_=M.xRangeCss.start,$=E,F=M.yRangeCss.start,tt=C,et=R(X,v.x.scaleId),st=R(X,v.y.scaleId);u.current={xRangeCss:{start:_,end:$},yRangeCss:{start:F,end:tt}};let K="none";const nt=Math.abs(F-tt),ot=Math.abs(_-$);nt<10&&ot<10?K="none":nt>30&&ot>30?K="box":nt>ot?K="y":K="x";const Tt=K==="x"||K==="box"?{scaleId:et.id,from:L(X,Y(n.current,_,"css"),et.id,"css"),to:L(X,Y(n.current,$,"css"),et.id,"css")}:void 0,bt=K==="y"||K==="box"?{scaleId:st.id,from:L(X,j(n.current,F,"css"),st.id,"css"),to:L(X,j(n.current,tt,"css"),st.id,"css")}:void 0,ht={mode:K,xRange:Tt,yRange:bt,completed:!1,keys:P};l.current=ht,w.sync_spanselect.dispatchEvent(a,ht)})},x=g=>{h.current(g,(v,E,C)=>{if(Object.values(C).some(M=>M)){g.preventDefault();const M=Math.abs(g.deltaY)>Math.abs(g.deltaX)?g.deltaY:g.deltaX;w.sync_pressandwheel.dispatchEvent(a,{positions:v,keys:C,deltaX:g.deltaX,deltaY:g.deltaY,deltaAbs:M})}})};document.addEventListener("mouseup",c),document.addEventListener("keydown",f),document.addEventListener("keyup",f),document.addEventListener("mousemove",y);const T=o.current;return T?.addEventListener("wheel",x,{passive:!1}),()=>{document.removeEventListener("mouseup",c),document.removeEventListener("keydown",f),document.removeEventListener("keyup",f),document.removeEventListener("mousemove",y),T?.removeEventListener("wheel",x)}},[n,a,h]),k("sync_dblclick",a,c=>{const f=O(c.positions,n.current);f&&w.dblclick.dispatchEvent(r,{frame:n.current,pointer:f,keys:c.keys})}),k("sync_click",a,c=>{const f=O(c.positions,n.current);f&&w.click.dispatchEvent(r,{frame:n.current,pointer:f,keys:c.keys})}),k("sync_move",a,c=>{const f=c.positions?O(c.positions,n.current):null;d.current=c,w.move.dispatchEvent(r,{frame:n.current,pointer:f??null,keys:c.keys})}),k("sync_mousedown",a,c=>{const f=O(c.positions,n.current);f&&w.mousedown.dispatchEvent(r,{frame:n.current,pointer:f,keys:c.keys})}),k("sync_mouseup",a,c=>{const f=O(c.positions,n.current);f&&w.mouseup.dispatchEvent(r,{frame:n.current,pointer:f,keys:c.keys})}),k("sync_pressandwheel",a,c=>{const f=O(c.positions,n.current);f&&w.pressandwheel.dispatchEvent(r,{frame:n.current,pointer:f,keys:c.keys,deltaX:c.deltaX,deltaY:c.deltaY,deltaAbs:c.deltaAbs})}),k("sync_spanselect",a,c=>{const f=yt("x",c.xRange,n.current),y=yt("y",c.yRange,n.current),x=f.scaled,T=y.scaled;c.completed&&(u.current=null),w.spanselect.dispatchEvent(r,{mode:c.mode,frame:n.current,xRanges:x,yRanges:T,completed:c.completed,x:{fromCSS:f.fromCSS,toCSS:f.toCSS},y:{fromCSS:y.fromCSS,toCSS:y.toCSS},keys:c.keys})}),A.jsx("div",{ref:o,id:"interactions",className:t,style:{position:"absolute",left:i.chartAreaCSS.x,top:i.chartAreaCSS.y,width:i.chartAreaCSS.width,height:i.chartAreaCSS.height,zIndex:25,...s},onClick:c=>{p(c,(f,y,x)=>{w.sync_click.dispatchEvent(a,{positions:f,keys:x})})},onMouseLeave:c=>{p(c,(f,y,x)=>{w.sync_move.dispatchEvent(a,{positions:null,keys:x})})},onMouseMove:c=>{p(c,(f,y,x)=>{w.sync_move.dispatchEvent(a,{positions:f,keys:x})})},onMouseDown:c=>{p(c,(f,{cssX:y,cssY:x},T)=>{w.sync_mousedown.dispatchEvent(a,{positions:f,keys:T}),l.current=null,u.current={xRangeCss:{start:y,end:y},yRangeCss:{start:x,end:x}}})},onMouseUp:c=>{p(c,(f,y,x)=>{w.sync_mouseup.dispatchEvent(a,{positions:f,keys:x});const T=l.current;l.current=null;const g=u.current;if(u.current=null,g&&T){const v={...T,keys:x,completed:!0};w.sync_spanselect.dispatchEvent(a,v)}})},onDoubleClick:c=>{p(c,(f,y,x)=>{w.sync_dblclick.dispatchEvent(a,{positions:f,keys:x})})}})},re=({data:t,renderTooltip:s,xScaleId:e})=>{const[o,i]=S.useState(null);dt("move",r=>{i(r)});const n=S.useMemo(()=>{if(!o)return null;const{frame:r,pointer:a}=o,u=a?.scaled[e];if(u===void 0)return null;const l=[];let d=u;for(const m of t){let p=null,h=1/0;for(const[f,y]of m.points.entries()){if(!G(r,y.x,e)||!G(r,y.y,m.yScaleId))continue;const x=Math.abs(y.x-u);x<h&&(h=x,p=f)}const c=m.points[p??-1];if(!c||J(r,h,e,"css")>30){l.push({seriesId:m.seriesId,y:null});continue}d=c.x,l.push({seriesId:m.seriesId,y:c.y})}return{frame:r,x:d,points:l}},[t,o,e]);return s(n)},ae=({makeXStyle:t,makeXClassName:s,makeYStyle:e,makeYClassName:o})=>{const[i,n]=S.useState(null);if(dt("move",d=>{n(d)}),!i)return null;const{frame:r,pointer:a}=i,u=Y(r,a?.cssX??0,"css"),l=j(r,a?.cssY??0,"css");return A.jsxs(A.Fragment,{children:[A.jsx("div",{"data-show":!!a,className:s?.(i),style:{position:"absolute",left:0,top:r.chartAreaCSS.y,height:r.chartAreaCSS.height,borderColor:"red",borderLeftWidth:"1px",borderLeftStyle:"solid",pointerEvents:"none",opacity:a?1:0,transform:`translateX(${u}px)`,...t?.(i)}}),A.jsx("div",{className:o?.(i),"data-show":!!a,style:{position:"absolute",top:0,height:0,borderTop:"solid 1px red",left:r.chartAreaCSS.x,width:r.chartAreaCSS.width,pointerEvents:"none",opacity:a?1:0,transform:`translateY(${l}px)`,...e?.(i)}})]})},le=({makeClassName:t,makeStyle:s})=>{const[e,o]=S.useState(null);if(dt("spanselect",p=>{o(p.mode==="none"||p.completed?null:p)}),!e)return null;const i=Y(e.frame,e.x.fromCSS,"css"),n=Y(e.frame,e.x.toCSS,"css"),r=j(e.frame,e.y.fromCSS,"css"),a=j(e.frame,e.y.toCSS,"css"),u=Math.min(i,n),l=Math.min(r,a),d=Math.abs(n-i),m=Math.abs(a-r);return A.jsx("div",{className:t?.(e),style:{position:"absolute",backgroundColor:"#0000ff22",left:`${u}px`,top:`${l}px`,width:`${d}px`,height:`${m}px`,pointerEvents:"none",...s?.(e)}})},ue=({style:t,children:s,scaleId:e,...o})=>{const i=lt(n=>n.getScale(e)?.axis);return i?A.jsx("div",{style:{position:"absolute",backgroundColor:"#0000ff11",left:i.cssRect.x,top:i.cssRect.y,height:i.cssRect.height,width:i.cssRect.width,...t},...o,children:s}):null};exports.AreaPlot=ee;exports.AxisOverlay=ue;exports.BarPlot=te;exports.CanPlot=Ht;exports.ChartAreaInteractions=ie;exports.Crosshair=ae;exports.LinePlot=Jt;exports.ScatterPlot=Qt;exports.SelectBox=le;exports.SparklinePlot=se;exports.TooltipsX=re;exports.applyStyles=U;exports.clampXPosToChartArea=Y;exports.clampYPosToChartArea=j;exports.getScale=R;exports.isXScale=B;exports.isYScale=Pt;exports.posToVal=L;exports.pxToValDistance=wt;exports.usePositioned=ne;exports.valFits=G;exports.valToPos=D;exports.valToPxDistance=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),g=require("react"),rt=require("zustand"),N=(t,s,e)=>Math.min(Math.max(t,s),e),pt=(t,s,e,c)=>{const{min:n,max:o}=_(t,e),a=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,l=(V(t,e)?a.width:a.height)/(o-n);return s/l},_=(t,s)=>{const e=t.scales.find(c=>c.id===s);if(!e)throw new Error(`Scale ${s} not found`);return e},V=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="x",bt=(t,s)=>t.scales.find(e=>e.id===s)?.origin==="y",L=(t,s)=>{const e=window.devicePixelRatio||1;t.lineCap=s?.lineCap??"butt",t.lineDashOffset=e*(s?.lineDashOffset??0),t.lineJoin=s?.lineJoin??"miter",t.lineWidth=e*(s?.lineWidth??1),t.miterLimit=e*(s?.miterLimit??10),t.strokeStyle=s?.strokeStyle??"black",t.fillStyle=s?.fillStyle??t.strokeStyle,t.font=s?.font??`${10*e}px sans-serif`,t.textAlign=s?.textAlign??"start",t.direction=s?.direction??"inherit",t.textBaseline=s?.textBaseline??"alphabetic",t.fontKerning=s?.fontKerning??"auto"},J=(t,s,e,c)=>{const n=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,{min:o,max:a}=_(t,e),l=(V(t,e)?n.width:n.height)/(a-o);return s*l},B=(t,s,e,c)=>{const{min:n}=_(t,e),o=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,a=J(t,s-n,e,c);return V(t,e)?N(o.x+a,o.x-10*o.width,o.x+11*o.width):N(o.y+o.height-a,o.y-10*o.height,o.y+11*o.height)},Tt=(t,s,e)=>{const{min:c,max:n}=_(t,e);return N(s,c,n)},z=(t,s,e)=>{const c=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return N(s,c.x,c.x+c.width)},j=(t,s,e)=>{const c=e==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS;return N(s,c.y,c.y+c.height)},q=(t,s,e)=>{const{min:c,max:n}=_(t,e);return s>=c&&s<=n},U=(t,s,e,c)=>{const{min:n,max:o}=_(t,e),a=c==="canvas"?t.chartAreaCanvasPX:t.chartAreaCSS,l=V(t,e)?(s-a.x)/a.width:(a.height-s+a.y)/a.height;return n+l*(o-n)},kt=t=>{const{ctx:s,scales:e}=t;for(const c of e){if(!c.axis)continue;s.save(),L(s,{strokeStyle:"black",fillStyle:"black",lineWidth:1,...c.axis.style});const n=c.axis.canvasRect;if(c.origin==="x"){if(c.axis.position==="bottom")s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x+n.width,n.y),s.stroke();else if(c.axis.position==="top"){const o=n.y+n.height;s.beginPath(),s.moveTo(n.x,o),s.lineTo(n.x+n.width,o),s.stroke()}}else if(c.axis.position==="left"){const o=n.x+n.width;s.beginPath(),s.moveTo(o,n.y),s.lineTo(o,n.y+n.height),s.stroke()}else c.axis.position==="right"&&(s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x,n.y+n.height),s.stroke());s.restore()}},Et=()=>rt.createStore((t,s)=>{const e=()=>{const c=s()._frame;if(!c)throw new Error("No frame set in frame store");return c};return{_frame:null,getFrame:e,getCtx:()=>e().ctx,clampXPosToChartArea:(c,n)=>z(e(),c,n??"canvas"),clampYPosToChartArea:(c,n)=>j(e(),c,n??"canvas"),valToPos:(c,n,o)=>B(e(),c,n,o??"canvas"),valToPxDistance:(c,n,o)=>J(e(),c,n,o??"canvas"),valFits:(c,n)=>q(e(),c,n),getScale:c=>_(e(),c)}}),at=g.createContext(null),K=(t,s)=>{const e=g.useContext(at);if(!e)throw new Error("useFrame must be used within a CanPlot component");const c=g.useRef(t);c.current=t,g.useLayoutEffect(()=>{c.current(e.getState()),e.subscribe(n=>{n._frame&&c.current(n)})},[e,...s])},Q=t=>{const s=g.useContext(at);if(!s)throw new Error("useFrame must be used within a CanPlot component");return rt.useStore(s,t??(e=>e.getFrame()))};function Pt(t){return s=>{for(const e of t)it(e,s)}}function At(t){return s=>{const e=[];for(const c of t){const n=it(c,s),o=typeof n=="function";e.push(o?n:()=>it(c,null))}return()=>{for(const c of e)c()}}}function it(t,s){if(typeof t=="function")return t(s);t&&(t.current=s)}var Mt=parseInt(g.version.split(".")[0],10)>=19?At:Pt;const Rt=g.forwardRef(({configuration:t,children:s,style:e,className:c},n)=>{const o=g.useRef(null),a=g.useRef(null),l=Lt(a),d=g.useMemo(Et,[]);g.useLayoutEffect(()=>{d.setState({_frame:Ut(t,l,o.current)})},[t,l,o,d]),g.useLayoutEffect(()=>d.subscribe(r=>{r._frame&&Dt(r._frame)}),[d]);const u=window.devicePixelRatio||1;return M.jsxs("div",{ref:Mt([n,a]),className:c,style:{position:"relative",overflow:"hidden",...e},"data-canplotroot":!0,children:[M.jsx("canvas",{ref:o,width:l.width*u,height:l.height*u,style:{inset:0,position:"absolute",width:`${l.width}px`,height:`${l.height}px`}}),M.jsx(_t,{frameStore:d,children:s})]})}),_t=({frameStore:t,children:s})=>rt.useStore(t,c=>!!c._frame)?M.jsx(at.Provider,{value:t,children:s}):null,Lt=t=>{const[s,e]=g.useState({width:0,height:0}),[c]=g.useState(()=>new ResizeObserver(n=>{for(const o of n){const a=Math.round(o.contentRect.width),l=Math.round(o.contentRect.height);e(d=>d.width!==a||d.height!==l?{...d,width:a,height:l}:d)}}));return g.useLayoutEffect(()=>{if(!t.current)return;const n=t.current.clientWidth,o=t.current.clientHeight;return e(a=>a.width!==n||a.height!==o?{...a,width:n,height:o}:a),c.observe(t.current,{box:"border-box"}),()=>c.disconnect()},[c,t]),s},Ut=(t,s,e)=>{const c=e?.getContext("2d");if(!c)return null;const n=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const o={x:t.padding.left,y:t.padding.top,width:s.width-t.padding.left-t.padding.right,height:s.height-t.padding.top-t.padding.bottom};for(const h of t.scales)h.axis&&(h.origin==="x"?(h.axis.position==="bottom"||h.axis.position==="top")&&(o.height=Math.max(0,o.height-h.axis.size),h.axis.position==="top"&&(o.y+=h.axis.size)):(h.axis.position==="left"||h.axis.position==="right")&&(o.width=Math.max(0,o.width-h.axis.size),h.axis.position==="left"&&(o.x+=h.axis.size)));const a={x:o.x*n,y:o.y*n,width:o.width*n,height:o.height*n},l=[];let d=t.padding.left*n,u=c.canvas.width-t.padding.right*n,r=c.canvas.height-t.padding.bottom*n,p=t.padding.top*n;for(const h of t.scales){if(!h.axis){l.push({...h,axis:null});continue}let i;if(h.origin==="x")switch(h.axis.position){case"bottom":r-=h.axis.size*n,i={x:o.x,y:r/n,width:o.width,height:h.axis.size};break;case"top":p+=h.axis.size*n,i={x:o.x,y:p/n-h.axis.size,width:o.width,height:h.axis.size};break;case"left":case"right":throw new Error("Invalid axis position for x origin")}else switch(h.axis.position){case"left":d+=h.axis.size*n,i={x:d/n-h.axis.size,y:o.y,width:h.axis.size,height:o.height};break;case"right":u-=h.axis.size*n,i={x:u/n,y:o.y,width:h.axis.size,height:o.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const m={x:i.x*n,y:i.y*n,width:i.width*n,height:i.height*n};l.push({...h,axis:{...h.axis,cssRect:i,canvasRect:m}})}return{ctx:c,dpr:n,padding:t.padding,scales:l,chartAreaCSS:o,chartAreaCanvasPX:a}},Dt=t=>{t.ctx.clearRect(0,0,t.ctx.canvas.width,t.ctx.canvas.height),kt(t)},Xt=({data:t,xScaleId:s,yScaleId:e,style:c})=>(K(({getCtx:n,clampXPosToChartArea:o,clampYPosToChartArea:a,valToPos:l})=>{const d=n();d.save(),d.beginPath(),L(d,c);for(const u of t){const r=o(l(u.x,s)),p=a(l(u.y,e));d.lineTo(r,p)}d.stroke(),d.restore()},[t,s,e,c]),null),Ft=({data:t,xScaleId:s,yScaleId:e,radius:c=5,style:n})=>(K(({getCtx:o,valToPos:a,valFits:l})=>{const d=o();d.save(),d.beginPath(),L(d,n);for(const u of t){if(!l(u.x,s)||!l(u.y,e))continue;const r=a(u.x,s),p=a(u.y,e);d.moveTo(r+c,p),d.arc(r,p,c,0,Math.PI*2)}d.stroke(),d.fill(),d.restore()},[t,s,e,c,n]),null),It=({data:t,xScaleId:s,yScaleId:e,style:c,barWidth:n,xPositionOffset:o,radius:a})=>(K(({getCtx:l,valToPxDistance:d,valToPos:u,clampXPosToChartArea:r,clampYPosToChartArea:p})=>{if(t.length===0)return;const f=l();f.save(),L(f,c);const h=d(n,s);f.beginPath();for(const i of t){const y=u(i.x,s)-h/2+o*h,x=p(u(0,e)),w=p(u(i.y,e)),S=x-w,v=r(y),C=r(y+h)-v;a?f.roundRect(v,w,C,S,a):f.rect(v,w,C,S)}f.closePath(),f.fill(),c?.strokeStyle&&f.stroke(),f.restore()},[t,s,e,c,n,o,a]),null),Kt=({data:t,xScaleId:s,yScaleId:e,style:c})=>(K(({getCtx:n,clampXPosToChartArea:o,clampYPosToChartArea:a,valToPos:l})=>{const d=[];for(const r of t){const p=o(l(r.x,s)),f=a(l(r.y[0],e)),h=a(l(r.y[1],e));d.push({x:p,y:f}),d.unshift({x:p,y:h})}const u=n();if(d.length>0){u.save(),u.beginPath(),L(u,c),u.moveTo(d[0].x,d[0].y);for(const r of d)u.lineTo(r.x,r.y);u.closePath(),u.fill(),u.restore()}},[t,s,e,c]),null),Yt=({data:t,stroked:s,xScaleId:e,yScaleId:c,style:n})=>(K(({getCtx:o,clampXPosToChartArea:a,clampYPosToChartArea:l,valToPos:d})=>{const u=[],r=o();for(const i of t){const m=a(d(i.x,e)),y=l(d(i.y,c));u.push({x:m,y})}const p=u.at(0),f=u.at(-1);if(!p||!f)return;const h=l(d(0,c));r.save(),r.beginPath(),L(r,n),r.moveTo(p.x,h);for(const i of u)r.lineTo(i.x,i.y);if(r.lineTo(f.x,h),r.closePath(),r.fill(),s){r.beginPath(),r.moveTo(p.x,p.y);for(const i of u)r.lineTo(i.x,i.y);r.stroke()}r.restore()},[t,s,e,c,n]),null),zt=(t,s)=>Q(({clampXPosToChartArea:e,clampYPosToChartArea:c,getScale:n,valToPos:o,valFits:a})=>{const l={};for(const d in t){const u=t[d];switch(u.exceeding){case"discard":{if(a(u.value,u.scaleId)){const r=o(u.value,u.scaleId,s);l[d]=r}break}case"clamp":{const r=o(u.value,u.scaleId,s);l[d]=n(u.scaleId)?.origin==="x"?e(r,s):c(r,s);break}}}return l}),jt=({scaleId:t,tickStyle:s,labelStyle:e,labelGap:c,tickSize:n,ticks:o})=>(K(({getCtx:a,valToPos:l,getScale:d,getFrame:u})=>{const r=a(),p=d(t);if(!p||!p.axis||p.origin!=="x")return;const f=p.axis,h=f.position==="top"?f.canvasRect.y+f.canvasRect.height:f.canvasRect.y,i=window.devicePixelRatio||1,m=h,y=(n??6)*i,x=f.position==="top"?h-y:h+y,w=(c??12)*i;r.save(),r.fontKerning="auto",L(r,{...s}),r.beginPath();const S=Array.isArray(o)?o:o({...p,axis:f},u());for(const{value:v}of S){const C=l(v,t,"canvas");r.moveTo(C,m),r.lineTo(C,x)}r.stroke(),r.restore(),r.save(),L(r,{textBaseline:f.position==="top"?"bottom":"top",textAlign:"center",...s,...e});for(const{value:v,label:C}of S){const T=l(v,t,"canvas"),E=C.split(`
2
+ `);for(let b=0;b<E.length;b++)r.fillText(E[b],T,x+i*2+b*w)}r.restore()},[o,t,s,e]),null),Ot=({scaleId:t,tickStyle:s,labelStyle:e,labelGap:c,tickSize:n,ticks:o})=>(K(({getCtx:a,valToPos:l,getScale:d,getFrame:u})=>{const r=a(),p=d(t);if(!p||!p.axis||p.origin!=="y")return;const f=p.axis,h=f.position==="left"?f.canvasRect.x+f.canvasRect.width:f.canvasRect.x,i=window.devicePixelRatio||1,m=h,y=(n??6)*i,x=f.position==="left"?h-y:h+y,w=(c??12)*i,S=Array.isArray(o)?o:o({...p,axis:f},u());r.save(),r.fontKerning="auto",L(r,{...s}),r.beginPath();for(const{value:v}of S){const C=l(v,t,"canvas");r.moveTo(m,C),r.lineTo(x,C)}r.stroke(),r.restore(),r.save(),L(r,{textBaseline:"middle",textAlign:f.position==="left"?"right":"left",...s,...e});for(const{value:v,label:C}of S){const T=l(v,t,"canvas"),E=C.split(`
3
+ `);for(let b=0;b<E.length;b++)r.fillText(` ${E[b]} `,x,T+b*w)}r.restore()},[o,t,s,e]),null),P=()=>{const t=[];return{addEventListener:(s,e)=>(t.push({syncKey:s,callback:e}),()=>{const c=t.findIndex(n=>n.callback===e);c!==-1&&t.splice(c,1)}),dispatchEvent:(s,e)=>{for(const c of t)c.syncKey===s&&c.callback(s,e)}}},k={dblclick:P(),click:P(),move:P(),mousedown:P(),mouseup:P(),spanselect:P(),documentmouseup:P(),pressandwheel:P(),sync_dblclick:P(),sync_click:P(),sync_move:P(),sync_mousedown:P(),sync_mouseup:P(),sync_spanselect:P(),sync_pressandwheel:P()},A=(t,s,e)=>{const c=g.useRef(e);c.current=e,g.useEffect(()=>k[t].addEventListener(s,(o,a)=>{c.current(a,o)}),[s,t,c])},lt=g.createContext(""),ut=(t,s)=>{const e=g.useContext(lt);return A(t,e,s)},Bt=(t,s,e,c,n)=>{if(!s)return;const o=c??e.scales.find(p=>p.origin==="x")?.id,a=n??e.scales.find(p=>p.origin==="y")?.id;if(!o||!a)return;const l=t.clientX-s.left,d={scaleId:o,value:U(e,l,o,"css")},u=t.clientY-s.top,r={scaleId:a,value:U(e,u,a,"css")};return{pointerSyncPosition:{x:d,y:r},cssX:l,cssY:u}},O=(t,s)=>{const e=t.x?B(s,t.x.value,t.x.scaleId,"css"):0,c=t.y?B(s,t.y.value,t.y.scaleId,"css"):0;return{cssX:e,cssY:c,scaled:Object.fromEntries(s.scales.map(n=>{const o=n.origin==="y"?c:e;return[n.id,U(s,o,n.id,"css")]}))}},ft=(t,s,e)=>{if(!s){const a=t==="x"?e.chartAreaCSS.x:e.chartAreaCSS.y,l=t==="x"?e.chartAreaCSS.x+e.chartAreaCSS.width:e.chartAreaCSS.y+e.chartAreaCSS.height;return{fromCSS:a,toCSS:l,scaled:e.scales.flatMap(d=>{if(d.origin!==t)return[];const{min:u,max:r}=_(e,d.id);return[{scaleId:d.id,from:u,to:r}]})}}const c=B(e,s.from,s.scaleId,"css"),n=B(e,s.to,s.scaleId,"css"),o=e.scales.flatMap(a=>{if(a.origin!==t)return[];const l=U(e,c,a.id,"css"),d=U(e,n,a.id,"css");return[{scaleId:a.id,from:l,to:d}]});return{fromCSS:c,toCSS:n,scaled:o}},$t=({id:t,onClick:s,onDblClick:e,onMouseMove:c,onMouseDown:n,onMouseUp:o,onDocumentMouseUp:a,onSpanSelect:l,className:d,style:u,sync:r,children:p})=>{const f=g.useId(),h=t||f;return A("dblclick",h,i=>{e?.(i)}),A("click",h,i=>{s?.(i)}),A("move",h,i=>{c?.(i)}),A("mousedown",h,i=>{n?.(i)}),A("mouseup",h,i=>{o?.(i)}),A("documentmouseup",h,i=>{a?.(i)}),A("spanselect",h,i=>{l?.(i)}),M.jsxs(lt.Provider,{value:h,children:[M.jsx(Nt,{className:d,style:u,sync:r}),p]})},Nt=({className:t,style:s,sync:e})=>{const c=g.useRef(null),n=Q(),o=g.useRef(n);o.current=n;const a=g.useContext(lt),l=e?.key||a,d=g.useRef(null),u=g.useRef(null),r=g.useRef(null),p=()=>{const i=c.current?.parentElement;if(i){if(i.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return i.getBoundingClientRect()}},f=(i,m)=>{const y=Bt(i,p(),o.current,e?.xViaScaleId,e?.yViaScaleId);y&&m(y.pointerSyncPosition,{cssX:y.cssX,cssY:y.cssY},{ctrlKey:i.ctrlKey,altKey:i.altKey,shiftKey:i.shiftKey,metaKey:i.metaKey})},h=g.useRef(f);return h.current=f,g.useEffect(()=>{const i=S=>{const v=u.current;v&&k.sync_spanselect.dispatchEvent(l,{...v,completed:!0}),k.documentmouseup.dispatchEvent(l,{frame:o.current,keys:{ctrlKey:S.ctrlKey,altKey:S.altKey,shiftKey:S.shiftKey,metaKey:S.metaKey}})},m=S=>{const v={ctrlKey:S.ctrlKey,altKey:S.altKey,shiftKey:S.shiftKey,metaKey:S.metaKey},C=r.current;if(C&&Object.entries(v).some(([E,b])=>C.keys[E]!==b)){const E={...C,keys:v};r.current=E,k.sync_move.dispatchEvent(l,E)}const T=u.current;if(T&&Object.entries(v).some(([E,b])=>T.keys[E]!==b)){S.stopPropagation(),S.preventDefault();const E={...T,keys:v};u.current=E,k.sync_spanselect.dispatchEvent(l,E)}},y=S=>{h.current(S,(v,{cssX:C,cssY:T},E)=>{const b=d.current;if(!b||!v.x||!v.y)return;const D=o.current,R=b.xRangeCss.start,$=C,Y=b.yRangeCss.start,et=T,st=_(D,v.x.scaleId),nt=_(D,v.y.scaleId);d.current={xRangeCss:{start:R,end:$},yRangeCss:{start:Y,end:et}};let X="none";const ot=Math.abs(Y-et),ct=Math.abs(R-$);ot<10&&ct<10?X="none":ot>30&&ct>30?X="box":ot>ct?X="y":X="x";const wt=X==="x"||X==="box"?{scaleId:st.id,from:U(D,z(o.current,R,"css"),st.id,"css"),to:U(D,z(o.current,$,"css"),st.id,"css")}:void 0,Ct=X==="y"||X==="box"?{scaleId:nt.id,from:U(D,j(o.current,Y,"css"),nt.id,"css"),to:U(D,j(o.current,et,"css"),nt.id,"css")}:void 0,ht={mode:X,xRange:wt,yRange:Ct,completed:!1,keys:E};u.current=ht,k.sync_spanselect.dispatchEvent(l,ht)})},x=S=>{h.current(S,(v,C,T)=>{if(Object.values(T).some(b=>b)){S.preventDefault();const b=Math.abs(S.deltaY)>Math.abs(S.deltaX)?S.deltaY:S.deltaX;k.sync_pressandwheel.dispatchEvent(l,{positions:v,keys:T,deltaX:S.deltaX,deltaY:S.deltaY,deltaAbs:b})}})};document.addEventListener("mouseup",i),document.addEventListener("keydown",m),document.addEventListener("keyup",m),document.addEventListener("mousemove",y);const w=c.current;return w?.addEventListener("wheel",x,{passive:!1}),()=>{document.removeEventListener("mouseup",i),document.removeEventListener("keydown",m),document.removeEventListener("keyup",m),document.removeEventListener("mousemove",y),w?.removeEventListener("wheel",x)}},[o,l,h]),A("sync_dblclick",l,i=>{const m=O(i.positions,o.current);m&&k.dblclick.dispatchEvent(a,{frame:o.current,pointer:m,keys:i.keys})}),A("sync_click",l,i=>{const m=O(i.positions,o.current);m&&k.click.dispatchEvent(a,{frame:o.current,pointer:m,keys:i.keys})}),A("sync_move",l,i=>{const m=i.positions?O(i.positions,o.current):null;r.current=i,k.move.dispatchEvent(a,{frame:o.current,pointer:m??null,keys:i.keys})}),A("sync_mousedown",l,i=>{const m=O(i.positions,o.current);m&&k.mousedown.dispatchEvent(a,{frame:o.current,pointer:m,keys:i.keys})}),A("sync_mouseup",l,i=>{const m=O(i.positions,o.current);m&&k.mouseup.dispatchEvent(a,{frame:o.current,pointer:m,keys:i.keys})}),A("sync_pressandwheel",l,i=>{const m=O(i.positions,o.current);m&&k.pressandwheel.dispatchEvent(a,{frame:o.current,pointer:m,keys:i.keys,deltaX:i.deltaX,deltaY:i.deltaY,deltaAbs:i.deltaAbs})}),A("sync_spanselect",l,i=>{const m=ft("x",i.xRange,o.current),y=ft("y",i.yRange,o.current),x=m.scaled,w=y.scaled;i.completed&&(d.current=null),k.spanselect.dispatchEvent(a,{mode:i.mode,frame:o.current,xRanges:x,yRanges:w,completed:i.completed,x:{fromCSS:m.fromCSS,toCSS:m.toCSS},y:{fromCSS:y.fromCSS,toCSS:y.toCSS},keys:i.keys})}),M.jsx("div",{ref:c,id:"interactions",className:t,style:{position:"absolute",left:n.chartAreaCSS.x,top:n.chartAreaCSS.y,width:n.chartAreaCSS.width,height:n.chartAreaCSS.height,zIndex:25,...s},onClick:i=>{f(i,(m,y,x)=>{k.sync_click.dispatchEvent(l,{positions:m,keys:x})})},onMouseLeave:i=>{f(i,(m,y,x)=>{k.sync_move.dispatchEvent(l,{positions:null,keys:x})})},onMouseMove:i=>{f(i,(m,y,x)=>{k.sync_move.dispatchEvent(l,{positions:m,keys:x})})},onMouseDown:i=>{f(i,(m,{cssX:y,cssY:x},w)=>{k.sync_mousedown.dispatchEvent(l,{positions:m,keys:w}),u.current=null,d.current={xRangeCss:{start:y,end:y},yRangeCss:{start:x,end:x}}})},onMouseUp:i=>{f(i,(m,y,x)=>{k.sync_mouseup.dispatchEvent(l,{positions:m,keys:x});const w=u.current;u.current=null;const S=d.current;if(d.current=null,S&&w){const v={...w,keys:x,completed:!0};k.sync_spanselect.dispatchEvent(l,v)}})},onDoubleClick:i=>{f(i,(m,y,x)=>{k.sync_dblclick.dispatchEvent(l,{positions:m,keys:x})})}})},Vt=({data:t,renderTooltip:s,xScaleId:e})=>{const[c,n]=g.useState(null);ut("move",a=>{n(a)});const o=g.useMemo(()=>{if(!c)return null;const{frame:a,pointer:l}=c,d=l?.scaled[e];if(d===void 0)return null;const u=[];let r=d;for(const p of t){let f=null,h=1/0;for(const[m,y]of p.points.entries()){if(!q(a,y.x,e)||!q(a,y.y,p.yScaleId))continue;const x=Math.abs(y.x-d);x<h&&(h=x,f=m)}const i=p.points[f??-1];if(!i||J(a,h,e,"css")>30){u.push({seriesId:p.seriesId,y:null});continue}r=i.x,u.push({seriesId:p.seriesId,y:i.y})}return{frame:a,x:r,points:u}},[t,c,e]);return s(o)},Ht=({makeXStyle:t,makeXClassName:s,makeYStyle:e,makeYClassName:c})=>{const[n,o]=g.useState(null);if(ut("move",r=>{o(r)}),!n)return null;const{frame:a,pointer:l}=n,d=z(a,l?.cssX??0,"css"),u=j(a,l?.cssY??0,"css");return M.jsxs(M.Fragment,{children:[M.jsx("div",{"data-show":!!l,className:s?.(n),style:{position:"absolute",left:0,top:a.chartAreaCSS.y,height:a.chartAreaCSS.height,borderColor:"red",borderLeftWidth:"1px",borderLeftStyle:"solid",pointerEvents:"none",opacity:l?1:0,transform:`translateX(${d}px)`,...t?.(n)}}),M.jsx("div",{className:c?.(n),"data-show":!!l,style:{position:"absolute",top:0,height:0,borderTop:"solid 1px red",left:a.chartAreaCSS.x,width:a.chartAreaCSS.width,pointerEvents:"none",opacity:l?1:0,transform:`translateY(${u}px)`,...e?.(n)}})]})},Wt=({makeClassName:t,makeStyle:s})=>{const[e,c]=g.useState(null);if(ut("spanselect",f=>{c(f.mode==="none"||f.completed?null:f)}),!e)return null;const n=z(e.frame,e.x.fromCSS,"css"),o=z(e.frame,e.x.toCSS,"css"),a=j(e.frame,e.y.fromCSS,"css"),l=j(e.frame,e.y.toCSS,"css"),d=Math.min(n,o),u=Math.min(a,l),r=Math.abs(o-n),p=Math.abs(l-a);return M.jsx("div",{className:t?.(e),style:{position:"absolute",backgroundColor:"#0000ff22",left:`${d}px`,top:`${u}px`,width:`${r}px`,height:`${p}px`,pointerEvents:"none",...s?.(e)}})},Gt=({style:t,children:s,scaleId:e,...c})=>{const n=Q(o=>o.getScale(e)?.axis);return n?M.jsx("div",{style:{position:"absolute",backgroundColor:"#0000ff11",left:n.cssRect.x,top:n.cssRect.y,height:n.cssRect.height,width:n.cssRect.width,...t},...c,children:s}):null},yt=60,qt=30,xt="UTC",Zt="en-GB",Jt=({space:t,formatter:s}={})=>(e,c)=>{const{min:n,max:o}=e,a=[],l=window.devicePixelRatio||1,d=(t??(e.origin==="x"?yt:qt))*l,u=pt(c,d,e.id,"canvas"),r=H.find(f=>f>u)??1;let p=n%r<Number.EPSILON?n:n+r-n%r;for(;p<=o;)a.push(p),p+=r;return(s??St)(a)},St=t=>{const s=Math.max(0,Math.ceil(-Math.log10(t[1]-t[0])));return t.map(e=>({value:e,label:e.toFixed(s)}))},H=[];for(let t=-12;t<=12;t++)H.push(1*10**t),H.push(2*10**t),H.push(5*10**t);const Qt=1,gt=1e3*Qt,dt=60*gt,Z=60*dt,tt=24*Z,te=30*tt,ee=365*tt,se=[[1,"milliseconds"],[2,"milliseconds"],[5,"milliseconds"],[10,"milliseconds"],[20,"milliseconds"],[50,"milliseconds"],[100,"milliseconds"],[200,"milliseconds"],[500,"milliseconds"],[1,"seconds"],[5,"seconds"],[10,"seconds"],[15,"seconds"],[30,"seconds"],[1,"minutes"],[5,"minutes"],[10,"minutes"],[15,"minutes"],[30,"minutes"],[1,"hours"],[2,"hours"],[3,"hours"],[4,"hours"],[6,"hours"],[8,"hours"],[12,"hours"],[1,"days"],[3,"days"],[5,"days"],[7,"days"],[10,"days"],[15,"days"],[1,"months"],[2,"months"],[3,"months"],[4,"months"],[6,"months"],[1,"years"],[2,"years"],[5,"years"],[10,"years"],[25,"years"],[50,"years"],[100,"years"]],W=t=>{const[s,e]=t;switch(e){case"milliseconds":return s;case"seconds":return s*gt;case"minutes":return s*dt;case"hours":return s*Z;case"days":return s*tt;case"months":return s*te;case"years":return s*ee}},ne=(t,s)=>{const e=new Date(t);return e.setUTCMilliseconds(e.getUTCMilliseconds()+s),e.getTime()},oe=(t,s)=>{const e=new Date(t);return e.setUTCSeconds(e.getUTCSeconds()+s),e.getTime()},ce=(t,s)=>{const e=new Date(t);return e.setUTCMinutes(e.getUTCMinutes()+s),e.getTime()},ie=(t,s)=>{const e=new Date(t);return e.setUTCHours(e.getUTCHours()+s),e.getTime()},re=(t,s)=>{const e=new Date(t);return e.setUTCDate(e.getUTCDate()+s),e.getTime()},mt=(t,s)=>{const e=new Date(t);return e.setUTCMonth(e.getUTCMonth()+s),e.getTime()},I=(t,s)=>{const[e,c]=s;switch(c){case"milliseconds":return ne(t,e);case"seconds":return oe(t,e);case"minutes":return ce(t,e);case"hours":return ie(t,e);case"days":return re(t,e);case"months":return mt(t,e);case"years":return mt(t,e*12)}};function G(t,s){const e=new Date(t),c=new Date(e.toLocaleString("en-US",{timeZone:s})),n=new Date(e.toLocaleString("en-US",{timeZone:"UTC"}));return(c.getTime()-n.getTime())/(3600*1e3)}const ae=(t,s,e="UTC")=>{const[c,n]=s;let o=new Date(t);const a=()=>{o.setUTCHours(-G(o,e),0,0,0)};switch(n){case"milliseconds":o.setUTCMilliseconds(Math.ceil(o.getUTCMilliseconds()/c)*c);break;case"seconds":o.setUTCSeconds(Math.ceil(o.getUTCSeconds()/c)*c,0);break;case"minutes":o.setUTCMinutes(Math.ceil(o.getTime()%Z/dt/c)*c,0,0);break;case"hours":o.setUTCHours(Math.ceil(o.getTime()%tt/Z/c)*c,0,0,0);break;case"days":case"months":case"years":n==="months"?o.setUTCDate(1):n==="years"&&o.setUTCMonth(0,1),a(),o.getTime()<t&&(o=new Date(I(o,[1,n])));break}return o.getTime()},le=({timeZone:t=xt,space:s=yt,formatter:e,locale:c,showTimezone:n}={})=>(o,a)=>{const{min:l,max:d}=o,u=Math.floor(a.chartAreaCanvasPX.width/s)+1,p=(d-l)/u,[f,h]=se.find(w=>W(w)>=p)??[1,"milliseconds"],i=ae(l,[f,h],t),m=G(i,t),y=[i];let x;for(;;){switch(h){case"milliseconds":case"seconds":case"minutes":case"hours":{x=I(i,[y.length*f,h]);break}case"days":{const w=I(i,[y.length*f,h]);x=I(w,[m-G(w,t),"hours"]);break}case"months":case"years":{const w=I(I(I(i,[m,"hours"]),[y.length*f,h]),[-m,"hours"]);x=I(w,[m-G(w,t),"hours"]);break}}if(x>d)break;y.push(x)}return(e??vt({locale:c,showTimezone:n,timeZone:t}))(y)},F=(t,s,e)=>t.find(c=>c.type===e)?.value!==s.find(c=>c.type===e)?.value,vt=({timeZone:t=xt,locale:s=Zt,showTimezone:e=!0})=>{const c=new Intl.DateTimeFormat(s,{year:"numeric",day:"numeric",month:"short",hour:"numeric",hourCycle:"h23",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short",timeZone:t});return n=>{const o=n[1]-n[0],a=o<W([1,"days"]),l=o<W([1,"minutes"]),d=o<W([1,"seconds"]);return n.map(u=>({value:u,label:c.formatToParts(new Date(u))})).map((u,r,p)=>{const f=p[r-1],h=r===0||F(u.label,f.label,"year"),i=r===0||F(u.label,f.label,"day"),m=r===0||F(u.label,f.label,"month"),y=r===0||F(u.label,f.label,"hour"),x=r===0||F(u.label,f.label,"timeZoneName"),w=r===0||F(u.label,f.label,"minute"),S=r===0||F(u.label,f.label,"second"),v=r===0||F(u.label,f.label,"fractionalSecond"),C=[];if(a&&(y||w||x||S||v)){const T=u.label.find(R=>R.type==="hour")?.value,E=u.label.find(R=>R.type==="minute")?.value,b=u.label.find(R=>R.type==="timeZoneName")?.value;let D="";if(l){const R=u.label.find(Y=>Y.type==="second")?.value,$=u.label.find(Y=>Y.type==="fractionalSecond")?.value;D=`:${R}`+(d?`.${$}`:"")}C.push(`${T}:${E}${D}`+(e&&x?` ${b}`:""))}return(i||m)&&C.push([u.label.find(T=>T.type==="month")?.value,i&&u.label.find(T=>T.type==="day")?.value].filter(Boolean).join(" ")),h&&C.push(u.label.find(T=>T.type==="year")?.value),{value:u.value,label:C.filter(T=>T).join(`
4
+ `)}})}};exports.AreaPlot=Kt;exports.AxisOverlay=Gt;exports.BarPlot=It;exports.CanPlot=Rt;exports.ChartAreaInteractions=$t;exports.Crosshair=Ht;exports.LinePlot=Xt;exports.ScatterPlot=Ft;exports.SelectBox=Wt;exports.SparklinePlot=Yt;exports.TooltipsX=Vt;exports.XTicks=jt;exports.YTicks=Ot;exports.applyStyles=L;exports.clampUnfit=Tt;exports.clampXPosToChartArea=z;exports.clampYPosToChartArea=j;exports.defaultNumericalTicksFormatter=St;exports.getScale=_;exports.isXScale=V;exports.isYScale=bt;exports.makeLinearTicks=Jt;exports.makeTimeTickFormat=vt;exports.makeTimeTicks=le;exports.posToVal=U;exports.pxToValDistance=pt;exports.useDrawEffect=K;exports.useFrameState=Q;exports.useXPositioned=zt;exports.valFits=q;exports.valToPos=B;exports.valToPxDistance=J;
5
5
  //# sourceMappingURL=canplot.cjs.map