@canplot/react 0.1.15 → 0.1.16

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/canplot.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),g=require("react"),Z=require("zustand"),O=(e,s,t)=>Math.min(Math.max(e,s),t),Te=e=>e.reduce((s,t)=>s+(t??0),0),Ce=(e,s)=>{let t=0;for(let o=0;o<e.length;o++)Math.abs(e[o]-s)<Math.abs(e[t]-s)&&(t=o);return t},me=(e,s,t,o)=>{const{min:n,max:c,origin:a}=U(e,t),r=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=(a==="x"?r.width:r.height)/(c-n);return s/d},U=(e,s)=>{const t=e.scales.find(o=>o.id===s);if(!t)throw new Error(`Scale ${s} not found`);return t},A=(e,s)=>{const t=window.devicePixelRatio||1;e.lineCap=s?.lineCap??"butt",e.lineDashOffset=t*(s?.lineDashOffset??0),e.lineJoin=s?.lineJoin??"miter",e.lineWidth=t*(s?.lineWidth??1),e.miterLimit=t*(s?.miterLimit??10),e.strokeStyle=s?.strokeStyle??"black",e.fillStyle=s?.fillStyle??e.strokeStyle,e.font=s?.font??`${10*t}px sans-serif`,e.textAlign=s?.textAlign??"start",e.direction=s?.direction??"inherit",e.textBaseline=s?.textBaseline??"alphabetic",e.fontKerning=s?.fontKerning??"auto"},J=(e,s,t,o)=>{const n=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,{min:c,max:a,origin:r}=U(e,t),d=(r==="x"?n.width:n.height)/(a-c);return s*d},B=(e,s,t,o)=>{const{min:n,origin:c}=U(e,t),a=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,r=J(e,s-n,t,o);return c==="x"?O(a.x+r,a.x-10*a.width,a.x+11*a.width):O(a.y+a.height-r,a.y-10*a.height,a.y+11*a.height)},ke=(e,s,t)=>{const{min:o,max:n}=U(e,t);return O(s,o,n)},z=(e,s,t)=>{const o=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return O(s,o.x,o.x+o.width)},j=(e,s,t)=>{const o=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return O(s,o.y,o.y+o.height)},W=(e,s,t)=>{const{min:o,max:n}=U(e,t);return s>=o&&s<=n},L=(e,s,t,o)=>{const{min:n,max:c,origin:a}=U(e,t),r=o==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=a==="x"?(s-r.x)/r.width:(r.height-s+r.y)/r.height;return n+d*(c-n)},Ee=e=>{const{ctx:s,scales:t}=e;for(const o of t){if(!o.axis)continue;s.save(),A(s,{strokeStyle:"black",fillStyle:"black",lineWidth:1,...o.axis.style});const n=o.axis.canvasRect;if(o.origin==="x"){if(o.axis.position==="bottom")s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x+n.width,n.y),s.stroke();else if(o.axis.position==="top"){const c=n.y+n.height;s.beginPath(),s.moveTo(n.x,c),s.lineTo(n.x+n.width,c),s.stroke()}}else if(o.axis.position==="left"){const c=n.x+n.width;s.beginPath(),s.moveTo(c,n.y),s.lineTo(c,n.y+n.height),s.stroke()}else o.axis.position==="right"&&(s.beginPath(),s.moveTo(n.x,n.y),s.lineTo(n.x,n.y+n.height),s.stroke());s.restore()}},Pe=()=>Z.createStore((e,s)=>{const t=()=>{const o=s()._frame;if(!o)throw new Error("No frame set in frame store");return o};return{_frame:null,getFrame:t,getCtx:()=>t().ctx,clampXPosToChartArea:(o,n)=>z(t(),o,n??"canvas"),clampYPosToChartArea:(o,n)=>j(t(),o,n??"canvas"),valToPos:(o,n,c)=>B(t(),o,n,c??"canvas"),valToPxDistance:(o,n,c)=>J(t(),o,n,c??"canvas"),valFits:(o,n)=>W(t(),o,n),getScale:o=>U(t(),o)}}),Re=()=>Z.createStore(e=>({notify:()=>{e(s=>({version:s.version+1}))},version:0})),ae=g.createContext(null),pe=g.createContext(null),F=(e,s)=>{const t=g.useContext(ae),o=g.useContext(pe);if(!t||!o)throw new Error("useFrame must be used within a CanPlot component");const n=g.useRef(e);n.current=e,g.useLayoutEffect(()=>{n.current(t.getState()),t.subscribe(c=>{c._frame&&n.current(c)})},[t]),g.useEffect(()=>{o.getState().notify()},[o,...s])},Q=e=>{const s=g.useContext(ae);if(!s)throw new Error("useFrame must be used within a CanPlot component");return Z.useStore(s,e??(t=>t.getFrame()))};function Me(e){return s=>{for(const t of e)re(t,s)}}function _e(e){return s=>{const t=[];for(const o of e){const n=re(o,s),c=typeof n=="function";t.push(c?n:()=>re(o,null))}return()=>{for(const o of t)o()}}}function re(e,s){if(typeof e=="function")return e(s);e&&(e.current=s)}var Ae=parseInt(g.version.split(".")[0],10)>=19?_e:Me;const Le=g.forwardRef(({configuration:e,children:s,style:t,className:o},n)=>{const c=g.useRef(null),a=g.useRef(null),r=De(a),d=g.useMemo(Pe,[]),u=g.useMemo(Re,[]);g.useLayoutEffect(()=>{d.setState({_frame:Ie(e,r,c.current)})},[e,r,c,d]),g.useLayoutEffect(()=>d.subscribe(p=>{p._frame&&Xe(p._frame)}),[d]),g.useLayoutEffect(()=>{let p=!1;return u.subscribe(()=>{p||(p=!0,window.requestAnimationFrame(()=>{p=!1,d.setState(m=>({_frame:m._frame?{...m._frame}:null}))}))})},[u,d]);const l=window.devicePixelRatio||1;return M.jsxs("div",{ref:Ae([n,a]),className:o,style:{position:"relative",overflow:"hidden",...t},"data-canplotroot":!0,children:[M.jsx("canvas",{ref:c,width:r.width*l,height:r.height*l,style:{inset:0,position:"absolute",width:`${r.width}px`,height:`${r.height}px`}}),M.jsx(Ue,{frameStore:d,updateRequestStore:u,children:s})]})}),Ue=({frameStore:e,updateRequestStore:s,children:t})=>Z.useStore(e,n=>!!n._frame)?M.jsx(pe.Provider,{value:s,children:M.jsx(ae.Provider,{value:e,children:t})}):null,De=e=>{const[s,t]=g.useState({width:0,height:0}),[o]=g.useState(()=>new ResizeObserver(n=>{for(const c of n){const a=Math.round(c.contentRect.width),r=Math.round(c.contentRect.height);t(d=>d.width!==a||d.height!==r?{...d,width:a,height:r}:d)}}));return g.useLayoutEffect(()=>{if(!e.current)return;const n=e.current.clientWidth,c=e.current.clientHeight;return t(a=>a.width!==n||a.height!==c?{...a,width:n,height:c}:a),o.observe(e.current,{box:"border-box"}),()=>o.disconnect()},[o,e]),s},Ie=(e,s,t)=>{const o=t?.getContext("2d");if(!o)return null;const n=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const c={x:e.padding.left,y:e.padding.top,width:s.width-e.padding.left-e.padding.right,height:s.height-e.padding.top-e.padding.bottom};for(const f of e.scales)f.axis&&(f.origin==="x"?(f.axis.position==="bottom"||f.axis.position==="top")&&(c.height=Math.max(0,c.height-f.axis.size),f.axis.position==="top"&&(c.y+=f.axis.size)):(f.axis.position==="left"||f.axis.position==="right")&&(c.width=Math.max(0,c.width-f.axis.size),f.axis.position==="left"&&(c.x+=f.axis.size)));const a={x:c.x*n,y:c.y*n,width:c.width*n,height:c.height*n},r=[];let d=e.padding.left*n,u=o.canvas.width-e.padding.right*n,l=o.canvas.height-e.padding.bottom*n,p=e.padding.top*n;for(const f of e.scales){if(!f.axis){r.push({...f,axis:null});continue}let i;if(f.origin==="x")switch(f.axis.position){case"bottom":l-=f.axis.size*n,i={x:c.x,y:l/n,width:c.width,height:f.axis.size};break;case"top":p+=f.axis.size*n,i={x:c.x,y:p/n-f.axis.size,width:c.width,height:f.axis.size};break;case"left":case"right":throw new Error("Invalid axis position for x origin")}else switch(f.axis.position){case"left":d+=f.axis.size*n,i={x:d/n-f.axis.size,y:c.y,width:f.axis.size,height:c.height};break;case"right":u-=f.axis.size*n,i={x:u/n,y:c.y,width:f.axis.size,height:c.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const h={x:i.x*n,y:i.y*n,width:i.width*n,height:i.height*n};r.push({...f,axis:{...f.axis,cssRect:i,canvasRect:h}})}return{ctx:o,dpr:n,padding:e.padding,scales:r,chartAreaCSS:c,chartAreaCanvasPX:a}},Xe=e=>{e.ctx.clearRect(0,0,e.ctx.canvas.width,e.ctx.canvas.height),Ee(e)},Fe=({data:e,xScaleId:s,yScaleId:t,style:o})=>(F(({getCtx:n,clampXPosToChartArea:c,clampYPosToChartArea:a,valToPos:r})=>{const d=n();d.save(),d.beginPath(),A(d,o);for(const u of e){const l=c(r(u.x,s)),p=a(r(u.y,t));d.lineTo(l,p)}d.stroke(),d.restore()},[e,s,t,o]),null),Ke=({data:e,xScaleId:s,yScaleId:t,radius:o=5,style:n})=>(F(({getCtx:c,valToPos:a,valFits:r})=>{const d=c();d.save(),d.beginPath(),A(d,n);for(const u of e){if(!r(u.x,s)||!r(u.y,t))continue;const l=a(u.x,s),p=a(u.y,t);d.moveTo(l+o,p),d.arc(l,p,o,0,Math.PI*2)}d.stroke(),d.fill(),d.restore()},[e,s,t,o,n]),null),Ye=({data:e,xScaleId:s,yScaleId:t,style:o,barWidth:n,xPositionOffset:c,radius:a})=>(F(({getCtx:r,valToPxDistance:d,valToPos:u,clampXPosToChartArea:l,clampYPosToChartArea:p})=>{if(e.length===0)return;const m=r();m.save(),A(m,o);const f=d(n,s);m.beginPath();for(const i of e){const y=u(i.x,s)-f/2+c*f,x=p(u(0,t)),S=p(u(i.y,t)),v=x-S,w=l(y),k=l(y+f)-w;a?m.roundRect(w,S,k,v,a):m.rect(w,S,k,v)}m.closePath(),m.fill(),o?.strokeStyle&&m.stroke(),m.restore()},[e,s,t,o,n,c,a]),null),ze=({data:e,xScaleId:s,yScaleId:t,style:o})=>(F(({getCtx:n,clampXPosToChartArea:c,clampYPosToChartArea:a,valToPos:r})=>{const d=[];for(const l of e){const p=c(r(l.x,s)),m=a(r(l.y[0],t)),f=a(r(l.y[1],t));d.push({x:p,y:m}),d.unshift({x:p,y:f})}const u=n();if(d.length>0){u.save(),u.beginPath(),A(u,o),u.moveTo(d[0].x,d[0].y);for(const l of d)u.lineTo(l.x,l.y);u.closePath(),u.fill(),u.restore()}},[e,s,t,o]),null),je=({data:e,stroked:s,xScaleId:t,yScaleId:o,style:n})=>(F(({getCtx:c,clampXPosToChartArea:a,clampYPosToChartArea:r,valToPos:d})=>{const u=[],l=c();for(const i of e){const h=a(d(i.x,t)),y=r(d(i.y,o));u.push({x:h,y})}const p=u.at(0),m=u.at(-1);if(!p||!m)return;const f=r(d(0,o));l.save(),l.beginPath(),A(l,n),l.moveTo(p.x,f);for(const i of u)l.lineTo(i.x,i.y);if(l.lineTo(m.x,f),l.closePath(),l.fill(),s){l.beginPath(),l.moveTo(p.x,p.y);for(const i of u)l.lineTo(i.x,i.y);l.stroke()}l.restore()},[e,s,t,o,n]),null),Oe=(e,s)=>Q(({clampXPosToChartArea:t,clampYPosToChartArea:o,getScale:n,valToPos:c,valFits:a})=>{const r={};for(const d in e){const u=e[d];switch(u.exceeding){case"discard":{if(a(u.value,u.scaleId)){const l=c(u.value,u.scaleId,s);r[d]=l}break}case"clamp":{const l=c(u.value,u.scaleId,s);r[d]=n(u.scaleId)?.origin==="x"?t(l,s):o(l,s);break}}}return r}),Be=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:o,tickSize:n,ticks:c})=>(F(({getCtx:a,valToPos:r,getScale:d,getFrame:u})=>{const l=a(),p=d(e);if(!p||!p.axis||p.origin!=="x")return;const m=p.axis,f=m.position==="top"?m.canvasRect.y+m.canvasRect.height:m.canvasRect.y,i=window.devicePixelRatio||1,h=f,y=(n??6)*i,x=m.position==="top"?f-y:f+y,S=(o??12)*i;l.save(),l.fontKerning="auto",A(l,{...s}),l.beginPath();const v=Array.isArray(c)?c:c({...p,axis:m},u());for(const{value:w}of v){const k=r(w,e,"canvas");l.moveTo(k,h),l.lineTo(k,x)}l.stroke(),l.restore(),l.save(),A(l,{textBaseline:m.position==="top"?"bottom":"top",textAlign:"center",...s,...t});for(const{value:w,label:k}of v){const b=r(w,e,"canvas"),C=k.split(`
2
- `);for(let E=0;E<C.length;E++)l.fillText(C[E],b,x+i*2+E*S)}l.restore()},[c,e,s,t]),null),Ne=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:o,tickSize:n,ticks:c})=>(F(({getCtx:a,valToPos:r,getScale:d,getFrame:u})=>{const l=a(),p=d(e);if(!p||!p.axis||p.origin!=="y")return;const m=p.axis,f=m.position==="left"?m.canvasRect.x+m.canvasRect.width:m.canvasRect.x,i=f,h=n??6,y=m.position==="left"?f-h:f+h,x=o??12,S=Array.isArray(c)?c:c({...p,axis:m},u());l.save(),l.fontKerning="auto",A(l,{...s}),l.beginPath();for(const{value:v}of S){const w=r(v,e,"canvas");l.moveTo(i,w),l.lineTo(y,w)}l.stroke(),l.restore(),l.save(),A(l,{textBaseline:"middle",textAlign:m.position==="left"?"right":"left",...s,...t});for(const{value:v,label:w}of S){const k=r(v,e,"canvas"),b=w.split(`
3
- `);for(let C=0;C<b.length;C++)l.fillText(` ${b[C]} `,y,k+C*x)}l.restore()},[c,e,s,t]),null),P=()=>{const e=[];return{addEventListener:(s,t)=>(e.push({syncKey:s,callback:t}),()=>{const o=e.findIndex(n=>n.callback===t);o!==-1&&e.splice(o,1)}),dispatchEvent:(s,t)=>{for(const o of e)o.syncKey===s&&o.callback(s,t)}}},T={dblclick:P(),click:P(),contextmenu: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(),sync_contextmenu:P()},R=(e,s,t)=>{const o=g.useRef(t);o.current=t,g.useEffect(()=>T[e].addEventListener(s,(c,a)=>{o.current(a,c)}),[s,e,o])},le=g.createContext(""),ee=(e,s)=>{const t=g.useContext(le);return R(e,t,s)},$e=(e,s,t,o,n)=>{if(!s)return;const c=o??t.scales.find(p=>p.origin==="x")?.id,a=n??t.scales.find(p=>p.origin==="y")?.id;if(!c||!a)return;const r=e.clientX-s.left,d={scaleId:c,value:L(t,r,c,"css")},u=e.clientY-s.top,l={scaleId:a,value:L(t,u,a,"css")};return{pointerSyncPosition:{x:d,y:l},cssX:r,cssY:u}},Y=(e,s)=>{const t=e.x?B(s,e.x.value,e.x.scaleId,"css"):0,o=e.y?B(s,e.y.value,e.y.scaleId,"css"):0;return{cssX:t,cssY:o,scaled:Object.fromEntries(s.scales.map(n=>{const c=n.origin==="y"?o:t;return[n.id,L(s,c,n.id,"css")]}))}},he=(e,s,t)=>{const o=B(t,s.from,s.scaleId,"css"),n=B(t,s.to,s.scaleId,"css"),c=t.scales.flatMap(a=>{if(a.origin!==e)return[];const r=L(t,o,a.id,"css"),d=L(t,n,a.id,"css");return[{scaleId:a.id,from:r,to:d}]});return{fromCSS:o,toCSS:n,scaled:c}},Ve=({id:e,onClick:s,onDblClick:t,onMouseMove:o,onMouseDown:n,onMouseUp:c,onDocumentMouseUp:a,onSpanSelect:r,onContextMenu:d,className:u,style:l,sync:p,children:m})=>{const f=g.useId(),i=e||f;return R("dblclick",i,h=>{t?.(h)}),R("click",i,h=>{s?.(h)}),R("move",i,h=>{o?.(h)}),R("mousedown",i,h=>{n?.(h)}),R("mouseup",i,h=>{c?.(h)}),R("documentmouseup",i,h=>{a?.(h)}),R("spanselect",i,h=>{r?.(h)}),R("contextmenu",i,h=>{d?.(h)}),M.jsxs(le.Provider,{value:i,children:[M.jsx(He,{className:u,style:l,sync:p}),m]})},He=({className:e,style:s,sync:t})=>{const o=g.useRef(null),n=Q(),c=g.useRef(n);c.current=n;const a=g.useContext(le),r=t?.key||a,d=g.useRef(null),u=g.useRef(null),l=g.useRef(null),p=()=>{const i=o.current?.parentElement;if(i){if(i.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return i.getBoundingClientRect()}},m=(i,h)=>{const y=$e(i,p(),c.current,t?.xViaScaleId,t?.yViaScaleId);y&&h(y.pointerSyncPosition,{cssX:y.cssX,cssY:y.cssY},{ctrlKey:i.ctrlKey,altKey:i.altKey,shiftKey:i.shiftKey,metaKey:i.metaKey})},f=g.useRef(m);return f.current=m,g.useEffect(()=>{const i=v=>{const w=u.current;w&&T.sync_spanselect.dispatchEvent(r,{...w,completed:!0}),T.documentmouseup.dispatchEvent(r,{frame:c.current,keys:{ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey}})},h=v=>{const w={ctrlKey:v.ctrlKey,altKey:v.altKey,shiftKey:v.shiftKey,metaKey:v.metaKey},k=l.current;if(k&&Object.entries(w).some(([C,E])=>k.keys[C]!==E)){const C={...k,keys:w};l.current=C,T.sync_move.dispatchEvent(r,C)}const b=u.current;if(b&&Object.entries(w).some(([C,E])=>b.keys[C]!==E)){v.stopPropagation(),v.preventDefault();const C={...b,keys:w};u.current=C,T.sync_spanselect.dispatchEvent(r,C)}},y=v=>{f.current(v,(w,{cssX:k,cssY:b},C)=>{const E=d.current;if(!E||!w.x||!w.y)return;const D=c.current,_=E.xRangeCss.start,N=k,K=E.yRangeCss.start,se=b,ne=U(D,w.x.scaleId),oe=U(D,w.y.scaleId);d.current={xRangeCss:{start:_,end:N},yRangeCss:{start:K,end:se}};let $="below_threshold";const ce=Math.abs(K-se),ie=Math.abs(_-N);ce<10&&ie<10?$="below_threshold":ce>30&&ie>30?$="box":ce>ie?$="y":$="x";const Se={scaleId:ne.id,from:L(D,z(c.current,_,"css"),ne.id,"css"),to:L(D,z(c.current,N,"css"),ne.id,"css")},be={scaleId:oe.id,from:L(D,j(c.current,K,"css"),oe.id,"css"),to:L(D,j(c.current,se,"css"),oe.id,"css")},de={mode:$,xRange:Se,yRange:be,completed:!1,keys:C};u.current=de,T.sync_spanselect.dispatchEvent(r,de)})},x=v=>{f.current(v,(w,k,b)=>{if(Object.values(b).some(E=>E)){v.preventDefault();const E=Math.abs(v.deltaY)>Math.abs(v.deltaX)?v.deltaY:v.deltaX;T.sync_pressandwheel.dispatchEvent(r,{positions:w,keys:b,deltaX:v.deltaX,deltaY:v.deltaY,deltaAbs:E})}})};document.addEventListener("mouseup",i),document.addEventListener("keydown",h),document.addEventListener("keyup",h),document.addEventListener("mousemove",y);const S=o.current;return S?.addEventListener("wheel",x,{passive:!1}),()=>{document.removeEventListener("mouseup",i),document.removeEventListener("keydown",h),document.removeEventListener("keyup",h),document.removeEventListener("mousemove",y),S?.removeEventListener("wheel",x)}},[c,r,f]),R("sync_dblclick",r,i=>{const h=Y(i.positions,c.current);h&&T.dblclick.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_click",r,i=>{const h=Y(i.positions,c.current);h&&T.click.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_contextmenu",r,i=>{const h=Y(i.positions,c.current);h&&T.contextmenu.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_move",r,i=>{const h=i.positions?Y(i.positions,c.current):null;l.current=i,T.move.dispatchEvent(a,{frame:c.current,pointer:h??null,keys:i.keys})}),R("sync_mousedown",r,i=>{const h=Y(i.positions,c.current);h&&T.mousedown.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_mouseup",r,i=>{const h=Y(i.positions,c.current);h&&T.mouseup.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys})}),R("sync_pressandwheel",r,i=>{const h=Y(i.positions,c.current);h&&T.pressandwheel.dispatchEvent(a,{frame:c.current,pointer:h,keys:i.keys,deltaX:i.deltaX,deltaY:i.deltaY,deltaAbs:i.deltaAbs})}),R("sync_spanselect",r,i=>{const h=i.xRange&&he("x",i.xRange,c.current),y=i.yRange&&he("y",i.yRange,c.current),x=h?.scaled,S=y?.scaled;i.completed&&(d.current=null),T.spanselect.dispatchEvent(a,{mode:i.mode,frame:c.current,completed:i.completed,x:{css:h&&{from:h.fromCSS,to:h.toCSS},scaled:x??[]},y:{css:y&&{from:y.fromCSS,to:y.toCSS},scaled:S??[]},keys:i.keys})}),M.jsx("div",{ref:o,id:"interactions",className:e,style:{position:"absolute",left:n.chartAreaCSS.x,top:n.chartAreaCSS.y,width:n.chartAreaCSS.width,height:n.chartAreaCSS.height,zIndex:25,...s},onDragStart:i=>{i.preventDefault()},onClick:i=>{m(i,(h,y,x)=>{T.sync_click.dispatchEvent(r,{positions:h,keys:x})})},onMouseLeave:i=>{m(i,(h,y,x)=>{T.sync_move.dispatchEvent(r,{positions:null,keys:x})})},onMouseMove:i=>{m(i,(h,y,x)=>{T.sync_move.dispatchEvent(r,{positions:h,keys:x})})},onMouseDown:i=>{m(i,(h,{cssX:y,cssY:x},S)=>{T.sync_mousedown.dispatchEvent(r,{positions:h,keys:S}),u.current=null,d.current={xRangeCss:{start:y,end:y},yRangeCss:{start:x,end:x}}})},onMouseUp:i=>{m(i,(h,y,x)=>{T.sync_mouseup.dispatchEvent(r,{positions:h,keys:x});const S=u.current;u.current=null;const v=d.current;if(d.current=null,v&&S){const w={...S,keys:x,completed:!0};T.sync_spanselect.dispatchEvent(r,w)}})},onContextMenu:i=>{i.preventDefault(),m(i,(h,y,x)=>{T.sync_contextmenu.dispatchEvent(r,{positions:h,keys:x})})},onDoubleClick:i=>{m(i,(h,y,x)=>{T.sync_dblclick.dispatchEvent(r,{positions:h,keys:x})})}})},qe=({data:e,renderTooltip:s,xScaleId:t})=>{const[o,n]=g.useState(null);ee("move",a=>{n(a)});const c=g.useMemo(()=>{if(!o)return null;const{frame:a,pointer:r}=o,d=r?.scaled[t];if(d===void 0)return null;const u=[];let l=d;for(const p of e){let m=null,f=1/0;for(const[h,y]of p.points.entries()){if(!W(a,y.x,t)||!W(a,y.y,p.yScaleId))continue;const x=Math.abs(y.x-d);x<f&&(f=x,m=h)}const i=p.points[m??-1];if(!i||J(a,f,t,"css")>30){u.push({seriesId:p.seriesId,y:null});continue}l=i.x,u.push({seriesId:p.seriesId,y:i.y})}return{frame:a,x:l,points:u}},[e,o,t]);return s(c)},We=({makeXStyle:e,makeXClassName:s,makeYStyle:t,makeYClassName:o})=>{const[n,c]=g.useState(null);if(ee("move",l=>{c(l)}),!n)return null;const{frame:a,pointer:r}=n,d=z(a,r?.cssX??0,"css"),u=j(a,r?.cssY??0,"css");return M.jsxs(M.Fragment,{children:[M.jsx("div",{"data-show":!!r,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:r?1:0,transform:`translateX(${d}px)`,...e?.(n)}}),M.jsx("div",{className:o?.(n),"data-show":!!r,style:{position:"absolute",top:0,height:0,borderTop:"solid 1px red",left:a.chartAreaCSS.x,width:a.chartAreaCSS.width,pointerEvents:"none",opacity:r?1:0,transform:`translateY(${u}px)`,...t?.(n)}})]})},Ge=({makeClassName:e,makeStyle:s})=>{const[t,o]=g.useState(null);ee("spanselect",c=>{o(c.mode==="below_threshold"||c.completed?null:c)});const n=g.useMemo(()=>{if(!t||t.mode==="below_threshold")return null;const c=t.mode==="y"?-1/0:t.x.css?.from??-1/0,a=t.mode==="y"?1/0:t.x.css?.to??1/0,r=t.mode==="x"?-1/0:t.y.css?.from??-1/0,d=t.mode==="x"?1/0:t.y.css?.to??1/0,u=z(t.frame,c,"css"),l=z(t.frame,a,"css"),p=j(t.frame,r,"css"),m=j(t.frame,d,"css"),f=Math.min(u,l),i=Math.min(p,m),h=Math.abs(l-u),y=Math.abs(m-p);return{leftPx:f,topPx:i,widthPx:h,heightPx:y}},[t]);return M.jsx("div",{className:t?e?.(t):void 0,style:{position:"absolute",visibility:t?"visible":"hidden",left:`${n?.leftPx??0}px`,top:`${n?.topPx??0}px`,width:`${n?.widthPx??0}px`,height:`${n?.heightPx??0}px`,pointerEvents:"none",...t?s?.(t):void 0}})},Ze=({style:e,children:s,scaleId:t,...o})=>{const n=Q(c=>c.getScale(t)?.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,...e},...o,children:s}):null},ye=60,Je=30,xe="UTC",Qe="en-GB",et=({space:e,formatter:s,acceptableIncrements:t}={})=>(o,n)=>{const{min:c,max:a}=o,r=[],d=window.devicePixelRatio||1,u=(e??(o.origin==="x"?ye:Je))*d,l=me(n,u,o.id,"canvas"),p=t??V,m=p.find(i=>i>l)??p.at(-1)??1;let f=c;if(Math.abs(f%m)>Number.EPSILON){const i=(m-f%m)%m;f+=i}for(;f<=a&&r.length<1e3;)r.push(f),f+=m;return(s??ge)(r)},ge=e=>{const s=Math.max(0,Math.ceil(-Math.log10(e[1]-e[0])));return e.map(t=>({value:t,label:t.toFixed(s)}))},V=[];for(let e=-12;e<=12;e++)V.push(1*10**e),V.push(2*10**e),V.push(5*10**e);const tt=1,ve=1e3*tt,ue=60*ve,G=60*ue,te=24*G,st=30*te,nt=365*te,ot=[[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"]],H=e=>{const[s,t]=e;switch(t){case"milliseconds":return s;case"seconds":return s*ve;case"minutes":return s*ue;case"hours":return s*G;case"days":return s*te;case"months":return s*st;case"years":return s*nt}},ct=(e,s)=>{const t=new Date(e);return t.setUTCMilliseconds(t.getUTCMilliseconds()+s),t.getTime()},it=(e,s)=>{const t=new Date(e);return t.setUTCSeconds(t.getUTCSeconds()+s),t.getTime()},rt=(e,s)=>{const t=new Date(e);return t.setUTCMinutes(t.getUTCMinutes()+s),t.getTime()},at=(e,s)=>{const t=new Date(e);return t.setUTCHours(t.getUTCHours()+s),t.getTime()},lt=(e,s)=>{const t=new Date(e);return t.setUTCDate(t.getUTCDate()+s),t.getTime()},fe=(e,s)=>{const t=new Date(e);return t.setUTCMonth(t.getUTCMonth()+s),t.getTime()},X=(e,s)=>{const[t,o]=s;switch(o){case"milliseconds":return ct(e,t);case"seconds":return it(e,t);case"minutes":return rt(e,t);case"hours":return at(e,t);case"days":return lt(e,t);case"months":return fe(e,t);case"years":return fe(e,t*12)}};function q(e,s){const t=new Date(e),o=new Date(t.toLocaleString("en-US",{timeZone:s})),n=new Date(t.toLocaleString("en-US",{timeZone:"UTC"}));return(o.getTime()-n.getTime())/(3600*1e3)}const ut=(e,s,t="UTC")=>{const[o,n]=s;let c=new Date(e);const a=()=>{c.setUTCHours(-q(c,t),0,0,0)};switch(n){case"milliseconds":c.setUTCMilliseconds(Math.ceil(c.getUTCMilliseconds()/o)*o);break;case"seconds":c.setUTCSeconds(Math.ceil(c.getUTCSeconds()/o)*o,0);break;case"minutes":c.setUTCMinutes(Math.ceil(c.getTime()%G/ue/o)*o,0,0);break;case"hours":c.setUTCHours(Math.ceil(c.getTime()%te/G/o)*o,0,0,0);break;case"days":case"months":case"years":n==="months"?c.setUTCDate(1):n==="years"&&c.setUTCMonth(0,1),a(),c.getTime()<e&&(c=new Date(X(c,[1,n])));break}return c.getTime()},dt=({timeZone:e=xe,space:s=ye,formatter:t,locale:o,showTimezone:n}={})=>(c,a)=>{const{min:r,max:d}=c,u=Math.floor(a.chartAreaCanvasPX.width/s)+1,p=(d-r)/u,[m,f]=ot.find(S=>H(S)>=p)??[1,"milliseconds"],i=ut(r,[m,f],e),h=q(i,e),y=[i];let x;for(;;){switch(f){case"milliseconds":case"seconds":case"minutes":case"hours":{x=X(i,[y.length*m,f]);break}case"days":{const S=X(i,[y.length*m,f]);x=X(S,[h-q(S,e),"hours"]);break}case"months":case"years":{const S=X(X(X(i,[h,"hours"]),[y.length*m,f]),[-h,"hours"]);x=X(S,[h-q(S,e),"hours"]);break}}if(x>d)break;y.push(x)}return(t??we({locale:o,showTimezone:n,timeZone:e}))(y)},I=(e,s,t)=>e.find(o=>o.type===t)?.value!==s.find(o=>o.type===t)?.value,we=({timeZone:e=xe,locale:s=Qe,showTimezone:t=!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:e});return n=>{const c=n[1]-n[0],a=c<H([1,"days"]),r=c<H([1,"minutes"]),d=c<H([1,"seconds"]);return n.map(u=>({value:u,label:o.formatToParts(new Date(u))})).map((u,l,p)=>{const m=p[l-1],f=l===0||I(u.label,m.label,"year"),i=l===0||I(u.label,m.label,"day"),h=l===0||I(u.label,m.label,"month"),y=l===0||I(u.label,m.label,"hour"),x=l===0||I(u.label,m.label,"timeZoneName"),S=l===0||I(u.label,m.label,"minute"),v=l===0||I(u.label,m.label,"second"),w=l===0||I(u.label,m.label,"fractionalSecond"),k=[];if(a&&(y||S||x||v||w)){const b=u.label.find(_=>_.type==="hour")?.value,C=u.label.find(_=>_.type==="minute")?.value,E=u.label.find(_=>_.type==="timeZoneName")?.value;let D="";if(r){const _=u.label.find(K=>K.type==="second")?.value,N=u.label.find(K=>K.type==="fractionalSecond")?.value;D=`:${_}`+(d?`.${N}`:"")}k.push(`${b}:${C}${D}`+(t&&x?` ${E}`:""))}return(i||h)&&k.push([u.label.find(b=>b.type==="month")?.value,i&&u.label.find(b=>b.type==="day")?.value].filter(Boolean).join(" ")),f&&k.push(u.label.find(b=>b.type==="year")?.value),{value:u.value,label:k.filter(b=>b).join(`
4
- `)}})}};exports.AreaPlot=ze;exports.AxisOverlay=Ze;exports.BarPlot=Ye;exports.CanPlot=Le;exports.ChartAreaInteractions=Ve;exports.Crosshair=We;exports.LinePlot=Fe;exports.ScatterPlot=Ke;exports.SelectBox=Ge;exports.SparklinePlot=je;exports.TooltipsX=qe;exports.XTicks=Be;exports.YTicks=Ne;exports.applyStyles=A;exports.clamp=O;exports.clampUnfit=ke;exports.clampXPosToChartArea=z;exports.clampYPosToChartArea=j;exports.defaultNumericalTicksFormatter=ge;exports.findClosestIndex=Ce;exports.getScale=U;exports.makeLinearTicks=et;exports.makeTimeTickFormat=we;exports.makeTimeTicks=dt;exports.posToVal=L;exports.pxToValDistance=me;exports.sum=Te;exports.useDrawEffect=F;exports.useFrameState=Q;exports.useInteractionsEvent=ee;exports.useXPositioned=Oe;exports.valFits=W;exports.valToPos=B;exports.valToPxDistance=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react/jsx-runtime"),v=require("react"),Q=require("zustand"),O=(e,s,t)=>Math.min(Math.max(e,s),t),ke=e=>e.reduce((s,t)=>s+(t??0),0),Me=(e,s)=>{let t=0;for(let n=0;n<e.length;n++)Math.abs(e[n]-s)<Math.abs(e[t]-s)&&(t=n);return t},ve=(e,s,t,n)=>{const{min:o,max:i,origin:r}=D(e,t),u=n==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=(r==="x"?u.width:u.height)/(i-o);return s/d},D=(e,s)=>{const t=e.scales.find(n=>n.id===s);if(!t)throw new Error(`Scale ${s} not found`);return t},A=(e,s)=>{const t=window.devicePixelRatio||1;e.lineCap=s?.lineCap??"butt",e.lineDashOffset=t*(s?.lineDashOffset??0),e.lineJoin=s?.lineJoin??"miter",e.lineWidth=t*(s?.lineWidth??1),e.miterLimit=t*(s?.miterLimit??10),e.strokeStyle=s?.strokeStyle??"black",e.fillStyle=s?.fillStyle??e.strokeStyle,e.font=s?.font??`${10*t}px sans-serif`,e.textAlign=s?.textAlign??"start",e.direction=s?.direction??"inherit",e.textBaseline=s?.textBaseline??"alphabetic",e.fontKerning=s?.fontKerning??"auto"},ee=(e,s,t,n)=>{const o=n==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,{min:i,max:r,origin:u}=D(e,t),d=(u==="x"?o.width:o.height)/(r-i);return s*d},B=(e,s,t,n)=>{const{min:o,origin:i}=D(e,t),r=n==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,u=ee(e,s-o,t,n);return i==="x"?O(r.x+u,r.x-10*r.width,r.x+11*r.width):O(r.y+r.height-u,r.y-10*r.height,r.y+11*r.height)},Re=(e,s,t)=>{const{min:n,max:o}=D(e,t);return O(s,n,o)},Y=(e,s,t)=>{const n=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return O(s,n.x,n.x+n.width)},j=(e,s,t)=>{const n=t==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS;return O(s,n.y,n.y+n.height)},Z=(e,s,t)=>{const{min:n,max:o}=D(e,t);return s>=n&&s<=o},U=(e,s,t,n)=>{const{min:o,max:i,origin:r}=D(e,t),u=n==="canvas"?e.chartAreaCanvasPX:e.chartAreaCSS,d=r==="x"?(s-u.x)/u.width:(u.height-s+u.y)/u.height;return o+d*(i-o)},Ae=e=>{const{ctx:s,scales:t}=e;for(const n of t){if(!n.axis)continue;s.save(),A(s,{strokeStyle:"black",fillStyle:"black",lineWidth:1,...n.axis.style});const o=n.axis.canvasRect;if(n.origin==="x"){if(n.axis.position==="bottom")s.beginPath(),s.moveTo(o.x,o.y),s.lineTo(o.x+o.width,o.y),s.stroke();else if(n.axis.position==="top"){const i=o.y+o.height;s.beginPath(),s.moveTo(o.x,i),s.lineTo(o.x+o.width,i),s.stroke()}}else if(n.axis.position==="left"){const i=o.x+o.width;s.beginPath(),s.moveTo(i,o.y),s.lineTo(i,o.y+o.height),s.stroke()}else n.axis.position==="right"&&(s.beginPath(),s.moveTo(o.x,o.y),s.lineTo(o.x,o.y+o.height),s.stroke());s.restore()}},Ie=()=>Q.createStore((e,s)=>{const t=()=>{const n=s()._frame;if(!n)throw new Error("No frame set in frame store");return n};return{_frame:null,getFrame:t,getCtx:()=>t().ctx,clampXPosToChartArea:(n,o)=>Y(t(),n,o??"canvas"),clampYPosToChartArea:(n,o)=>j(t(),n,o??"canvas"),valToPos:(n,o,i)=>B(t(),n,o,i??"canvas"),valToPxDistance:(n,o,i)=>ee(t(),n,o,i??"canvas"),valFits:(n,o)=>Z(t(),n,o),getScale:n=>D(t(),n)}}),Le=()=>Q.createStore(e=>({notify:()=>{e(s=>({version:s.version+1}))},version:0})),ue=v.createContext(null),ge=v.createContext(null),F=(e,s)=>{const t=v.useContext(ue),n=v.useContext(ge);if(!t||!n)throw new Error("useFrame must be used within a CanPlot component");const o=v.useRef(e);o.current=e,v.useLayoutEffect(()=>{o.current(t.getState()),t.subscribe(i=>{i._frame&&o.current(i)})},[t]),v.useEffect(()=>{n.getState().notify()},[n,...s])},te=e=>{const s=v.useContext(ue);if(!s)throw new Error("useFrame must be used within a CanPlot component");return Q.useStore(s,e??(t=>t.getFrame()))};function Ue(e){return s=>{for(const t of e)le(t,s)}}function De(e){return s=>{const t=[];for(const n of e){const o=le(n,s),i=typeof o=="function";t.push(i?o:()=>le(n,null))}return()=>{for(const n of t)n()}}}function le(e,s){if(typeof e=="function")return e(s);e&&(e.current=s)}var _e=parseInt(v.version.split(".")[0],10)>=19?De:Ue;const Xe=v.forwardRef(({configuration:e,children:s,style:t,className:n},o)=>{const i=v.useRef(null),r=v.useRef(null),u=Ke(r),d=v.useMemo(Ie,[]),c=v.useMemo(Le,[]);v.useLayoutEffect(()=>{d.setState({_frame:ze(e,u,i.current)})},[e,u,i,d]),v.useLayoutEffect(()=>d.subscribe(m=>{m._frame&&Ye(m._frame)}),[d]),v.useLayoutEffect(()=>{let m=!1;return c.subscribe(()=>{m||(m=!0,window.requestAnimationFrame(()=>{m=!1,d.setState(f=>({_frame:f._frame?{...f._frame}:null}))}))})},[c,d]);const a=window.devicePixelRatio||1;return k.jsxs("div",{ref:_e([o,r]),className:n,style:{position:"relative",overflow:"hidden",...t},"data-canplotroot":!0,children:[k.jsx("canvas",{ref:i,width:u.width*a,height:u.height*a,style:{inset:0,position:"absolute",width:`${u.width}px`,height:`${u.height}px`}}),k.jsx(Fe,{frameStore:d,updateRequestStore:c,children:s})]})}),Fe=({frameStore:e,updateRequestStore:s,children:t})=>Q.useStore(e,o=>!!o._frame)?k.jsx(ge.Provider,{value:s,children:k.jsx(ue.Provider,{value:e,children:t})}):null,Ke=e=>{const[s,t]=v.useState({width:0,height:0}),[n]=v.useState(()=>new ResizeObserver(o=>{for(const i of o){const r=Math.round(i.contentRect.width),u=Math.round(i.contentRect.height);t(d=>d.width!==r||d.height!==u?{...d,width:r,height:u}:d)}}));return v.useLayoutEffect(()=>{if(!e.current)return;const o=e.current.clientWidth,i=e.current.clientHeight;return t(r=>r.width!==o||r.height!==i?{...r,width:o,height:i}:r),n.observe(e.current,{box:"border-box"}),()=>n.disconnect()},[n,e]),s},ze=(e,s,t)=>{const n=t?.getContext("2d");if(!n)return null;const o=window.devicePixelRatio||1;if(s.width===0||s.height===0)return null;const i={x:e.padding.left,y:e.padding.top,width:s.width-e.padding.left-e.padding.right,height:s.height-e.padding.top-e.padding.bottom};for(const h of e.scales)h.axis&&(h.origin==="x"?(h.axis.position==="bottom"||h.axis.position==="top")&&(i.height=Math.max(0,i.height-h.axis.size),h.axis.position==="top"&&(i.y+=h.axis.size)):(h.axis.position==="left"||h.axis.position==="right")&&(i.width=Math.max(0,i.width-h.axis.size),h.axis.position==="left"&&(i.x+=h.axis.size)));const r={x:i.x*o,y:i.y*o,width:i.width*o,height:i.height*o},u=[];let d=e.padding.left*o,c=n.canvas.width-e.padding.right*o,a=n.canvas.height-e.padding.bottom*o,m=e.padding.top*o;for(const h of e.scales){if(!h.axis){u.push({...h,axis:null});continue}let l;if(h.origin==="x")switch(h.axis.position){case"bottom":a-=h.axis.size*o,l={x:i.x,y:a/o,width:i.width,height:h.axis.size};break;case"top":m+=h.axis.size*o,l={x:i.x,y:m/o-h.axis.size,width:i.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*o,l={x:d/o-h.axis.size,y:i.y,width:h.axis.size,height:i.height};break;case"right":c-=h.axis.size*o,l={x:c/o,y:i.y,width:h.axis.size,height:i.height};break;case"top":case"bottom":throw new Error("Invalid axis position for y origin")}const p={x:l.x*o,y:l.y*o,width:l.width*o,height:l.height*o};u.push({...h,axis:{...h.axis,cssRect:l,canvasRect:p}})}return{ctx:n,dpr:o,padding:e.padding,scales:u,chartAreaCSS:i,chartAreaCanvasPX:r}},Ye=e=>{e.ctx.clearRect(0,0,e.ctx.canvas.width,e.ctx.canvas.height),Ae(e)},je=({data:e,xScaleId:s,yScaleId:t,style:n})=>(F(({getCtx:o,clampXPosToChartArea:i,clampYPosToChartArea:r,valToPos:u})=>{const d=o();d.save(),d.beginPath(),A(d,n);for(const c of e){const a=i(u(c.x,s)),m=r(u(c.y,t));d.lineTo(a,m)}d.stroke(),d.restore()},[e,s,t,n]),null),Oe=({data:e,xScaleId:s,yScaleId:t,radius:n=5,style:o})=>(F(({getCtx:i,valToPos:r,valFits:u})=>{const d=i();d.save(),d.beginPath(),A(d,o);for(const c of e){if(!u(c.x,s)||!u(c.y,t))continue;const a=r(c.x,s),m=r(c.y,t);d.moveTo(a+n,m),d.arc(a,m,n,0,Math.PI*2)}d.stroke(),d.fill(),d.restore()},[e,s,t,n,o]),null),Be=({data:e,xScaleId:s,yScaleId:t,style:n,barWidth:o,xPositionOffset:i,radius:r})=>(F(({getCtx:u,valToPxDistance:d,valToPos:c,clampXPosToChartArea:a,clampYPosToChartArea:m})=>{if(e.length===0)return;const f=u();f.save(),A(f,n);const h=d(o,s);f.beginPath();for(const l of e){const x=c(l.x,s)-h/2+i*h,g=m(c(0,t)),S=m(c(l.y,t)),y=g-S,w=a(x),T=a(x+h)-w;r?f.roundRect(w,S,T,y,r):f.rect(w,S,T,y)}f.closePath(),f.fill(),n?.strokeStyle&&f.stroke(),f.restore()},[e,s,t,n,o,i,r]),null),Ne=({data:e,xScaleId:s,yScaleId:t,style:n})=>(F(({getCtx:o,clampXPosToChartArea:i,clampYPosToChartArea:r,valToPos:u})=>{const d=[];for(const a of e){const m=i(u(a.x,s)),f=r(u(a.y[0],t)),h=r(u(a.y[1],t));d.push({x:m,y:f}),d.unshift({x:m,y:h})}const c=o();if(d.length>0){c.save(),c.beginPath(),A(c,n),c.moveTo(d[0].x,d[0].y);for(const a of d)c.lineTo(a.x,a.y);c.closePath(),c.fill(),c.restore()}},[e,s,t,n]),null),$e=({data:e,stroked:s,xScaleId:t,yScaleId:n,style:o})=>(F(({getCtx:i,clampXPosToChartArea:r,clampYPosToChartArea:u,valToPos:d})=>{const c=[],a=i();for(const l of e){const p=r(d(l.x,t)),x=u(d(l.y,n));c.push({x:p,y:x})}const m=c.at(0),f=c.at(-1);if(!m||!f)return;const h=u(d(0,n));a.save(),a.beginPath(),A(a,o),a.moveTo(m.x,h);for(const l of c)a.lineTo(l.x,l.y);if(a.lineTo(f.x,h),a.closePath(),a.fill(),s){a.beginPath(),a.moveTo(m.x,m.y);for(const l of c)a.lineTo(l.x,l.y);a.stroke()}a.restore()},[e,s,t,n,o]),null),Ve=(e,s)=>te(({clampXPosToChartArea:t,clampYPosToChartArea:n,getScale:o,valToPos:i,valFits:r})=>{const u={};for(const d in e){const c=e[d];switch(c.exceeding){case"discard":{if(r(c.value,c.scaleId)){const a=i(c.value,c.scaleId,s);u[d]=a}break}case"clamp":{const a=i(c.value,c.scaleId,s);u[d]=o(c.scaleId)?.origin==="x"?t(a,s):n(a,s);break}}}return u}),He=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:n,tickSize:o,ticks:i})=>(F(({getCtx:r,valToPos:u,getScale:d,getFrame:c})=>{const a=r(),m=d(e);if(!m||!m.axis||m.origin!=="x")return;const f=m.axis,h=f.position==="top"?f.canvasRect.y+f.canvasRect.height:f.canvasRect.y,l=window.devicePixelRatio||1,p=h,x=(o??6)*l,g=f.position==="top"?h-x:h+x,S=(n??12)*l;a.save(),a.fontKerning="auto",A(a,{...s}),a.beginPath();const y=Array.isArray(i)?i:i({...m,axis:f},c());for(const{value:w}of y){const T=u(w,e,"canvas");a.moveTo(T,p),a.lineTo(T,g)}a.stroke(),a.restore(),a.save(),A(a,{textBaseline:f.position==="top"?"bottom":"top",textAlign:"center",...s,...t});for(const{value:w,label:T}of y){const C=u(w,e,"canvas"),b=T.split(`
2
+ `);for(let E=0;E<b.length;E++)a.fillText(b[E],C,g+l*2+E*S)}a.restore()},[i,e,s,t]),null),qe=({scaleId:e,tickStyle:s,labelStyle:t,labelGap:n,tickSize:o,ticks:i})=>(F(({getCtx:r,valToPos:u,getScale:d,getFrame:c})=>{const a=r(),m=d(e);if(!m||!m.axis||m.origin!=="y")return;const f=m.axis,h=f.position==="left"?f.canvasRect.x+f.canvasRect.width:f.canvasRect.x,l=h,p=o??6,x=f.position==="left"?h-p:h+p,g=n??12,S=Array.isArray(i)?i:i({...m,axis:f},c());a.save(),a.fontKerning="auto",A(a,{...s}),a.beginPath();for(const{value:y}of S){const w=u(y,e,"canvas");a.moveTo(l,w),a.lineTo(x,w)}a.stroke(),a.restore(),a.save(),A(a,{textBaseline:"middle",textAlign:f.position==="left"?"right":"left",...s,...t});for(const{value:y,label:w}of S){const T=u(y,e,"canvas"),C=w.split(`
3
+ `);for(let b=0;b<C.length;b++)a.fillText(` ${C[b]} `,x,T+b*g)}a.restore()},[i,e,s,t]),null),I=()=>{const e=[];return{addEventListener:(s,t)=>(e.push({syncKey:s,callback:t}),()=>{const n=e.findIndex(o=>o.callback===t);n!==-1&&e.splice(n,1)}),dispatchEvent:(s,t)=>{for(const n of e)n.syncKey===s&&n.callback(s,t)}}},P={dblclick:I(),click:I(),contextmenu:I(),move:I(),mousedown:I(),mouseup:I(),spanselect:I(),documentmouseup:I(),pressandwheel:I(),sync_move:I()},L=(e,s,t)=>{const n=v.useRef(t);n.current=t,v.useEffect(()=>P[e].addEventListener(s,(i,r)=>{n.current(r,i)}),[s,e,n])},de=v.createContext(""),se=(e,s)=>{const t=v.useContext(de);return L(e,t,s)},We=(e,s,t,n,o)=>{if(!s)return;const i=n??t.scales.find(m=>m.origin==="x")?.id,r=o??t.scales.find(m=>m.origin==="y")?.id;if(!i||!r)return;const u=e.clientX-s.left,d={scaleId:i,value:U(t,u,i,"css")},c=e.clientY-s.top,a={scaleId:r,value:U(t,c,r,"css")};return{pointerSyncPosition:{x:d,y:a},cssX:u,cssY:c}},z=(e,s)=>{const{x:t,y:n}=e,o=t&&s.scales.some(r=>r.id===t.scaleId)?B(s,t.value,t.scaleId,"css"):null,i=n&&s.scales.some(r=>r.id===n.scaleId)?B(s,n.value,n.scaleId,"css"):null;return{cssX:o,cssY:i,scaled:Object.fromEntries(s.scales.flatMap(r=>{const u=r.origin==="y"?i:o;return u===null?[]:[[r.id,U(s,u,r.id,"css")]]}))}},xe=(e,s,t)=>{const n=B(t,s.from,s.scaleId,"css"),o=B(t,s.to,s.scaleId,"css"),i=t.scales.flatMap(r=>{if(r.origin!==e)return[];const u=U(t,n,r.id,"css"),d=U(t,o,r.id,"css");return[{scaleId:r.id,from:u,to:d}]});return{fromCSS:n,toCSS:o,scaled:i}},Ge=({id:e,onClick:s,onDblClick:t,onMouseMove:n,onMouseDown:o,onMouseUp:i,onDocumentMouseUp:r,onSpanSelect:u,onContextMenu:d,className:c,style:a,sync:m,children:f})=>{const h=v.useId(),l=e||h;return L("dblclick",l,p=>{t?.(p)}),L("click",l,p=>{s?.(p)}),L("move",l,p=>{n?.(p)}),L("mousedown",l,p=>{o?.(p)}),L("mouseup",l,p=>{i?.(p)}),L("documentmouseup",l,p=>{r?.(p)}),L("spanselect",l,p=>{u?.(p)}),L("contextmenu",l,p=>{d?.(p)}),k.jsxs(de.Provider,{value:l,children:[k.jsx(Ze,{className:c,style:a,sync:m}),f]})},Ze=({className:e,style:s,sync:t})=>{const n=v.useRef(null),o=te(),i=v.useRef(o);i.current=o;const r=v.useContext(de),u=t?.key||r,d=v.useRef(null),c=v.useRef(null),a=v.useRef(null),m=()=>{const l=n.current?.parentElement;if(l){if(l.dataset.canplotroot===void 0)throw new Error("ChartAreaInteractions must be used within a CanPlot component");return l.getBoundingClientRect()}},f=(l,p)=>{const x=We(l,m(),i.current,t?.xViaScaleId,t?.yViaScaleId);x&&p(x.pointerSyncPosition,{cssX:x.cssX,cssY:x.cssY},{ctrlKey:l.ctrlKey,altKey:l.altKey,shiftKey:l.shiftKey,metaKey:l.metaKey})},h=v.useRef(f);return h.current=f,v.useEffect(()=>{const l=y=>{const w=c.current;w&&P.spanselect.dispatchEvent(r,{...w,completed:!0}),P.documentmouseup.dispatchEvent(r,{frame:i.current,keys:{ctrlKey:y.ctrlKey,altKey:y.altKey,shiftKey:y.shiftKey,metaKey:y.metaKey}})},p=y=>{const w={ctrlKey:y.ctrlKey,altKey:y.altKey,shiftKey:y.shiftKey,metaKey:y.metaKey},T=a.current;if(T&&Object.entries(w).some(([b,E])=>T.keys[b]!==E)){const b={...T,keys:w};a.current=b,P.sync_move.dispatchEvent(u,b)}const C=c.current;if(C&&Object.entries(w).some(([b,E])=>C.keys[b]!==E)){y.stopPropagation(),y.preventDefault();const b={...C,keys:w};c.current=b,P.spanselect.dispatchEvent(r,b)}},x=y=>{h.current(y,(w,{cssX:T,cssY:C},b)=>{const E=d.current;if(!E||!w.x||!w.y)return;const M=i.current,R=E.xRangeCss.start,N=T,K=E.yRangeCss.start,oe=C,ie=D(M,w.x.scaleId),re=D(M,w.y.scaleId);d.current={xRangeCss:{start:R,end:N},yRangeCss:{start:K,end:oe}};let $="below_threshold";const ce=Math.abs(K-oe),ae=Math.abs(R-N);ce<10&&ae<10?$="below_threshold":ce>30&&ae>30?$="box":ce>ae?$="y":$="x";const fe={scaleId:ie.id,from:U(M,Y(i.current,R,"css"),ie.id,"css"),to:U(M,Y(i.current,N,"css"),ie.id,"css")},me={scaleId:re.id,from:U(M,j(i.current,K,"css"),re.id,"css"),to:U(M,j(i.current,oe,"css"),re.id,"css")},V=fe&&xe("x",fe,i.current),H=me&&xe("y",me,i.current),Pe=V?.scaled,Ee=H?.scaled,pe={mode:$,frame:i.current,completed:!1,x:{css:V&&{from:V.fromCSS,to:V.toCSS},scaled:Pe??[]},y:{css:H&&{from:H.fromCSS,to:H.toCSS},scaled:Ee??[]},keys:b};c.current=pe,P.spanselect.dispatchEvent(r,pe)})},g=y=>{h.current(y,(w,T,C)=>{const b=z(w,i.current);if(!b)return;if(Object.values(C).some(M=>M)){y.preventDefault();const M=Math.abs(y.deltaY)>Math.abs(y.deltaX)?y.deltaY:y.deltaX;P.pressandwheel.dispatchEvent(r,{pointer:b,frame:i.current,keys:C,deltaX:y.deltaX,deltaY:y.deltaY,deltaAbs:M})}})};document.addEventListener("mouseup",l),document.addEventListener("keydown",p),document.addEventListener("keyup",p),document.addEventListener("mousemove",x);const S=n.current;return S?.addEventListener("wheel",g,{passive:!1}),()=>{document.removeEventListener("mouseup",l),document.removeEventListener("keydown",p),document.removeEventListener("keyup",p),document.removeEventListener("mousemove",x),S?.removeEventListener("wheel",g)}},[i,r,u,h]),L("sync_move",u,l=>{const p=l.positions?z(l.positions,i.current):null;a.current=l,P.move.dispatchEvent(r,{frame:i.current,pointer:p??null,keys:l.keys})}),k.jsx("div",{ref:n,id:"interactions",className:e,style:{position:"absolute",left:o.chartAreaCSS.x,top:o.chartAreaCSS.y,width:o.chartAreaCSS.width,height:o.chartAreaCSS.height,zIndex:25,...s},onDragStart:l=>{l.preventDefault()},onClick:l=>{f(l,(p,x,g)=>{const S=z(p,i.current);S&&P.click.dispatchEvent(r,{pointer:S,frame:i.current,keys:g})})},onMouseLeave:l=>{f(l,(p,x,g)=>{P.sync_move.dispatchEvent(r,{positions:null,keys:g})})},onMouseMove:l=>{f(l,(p,x,g)=>{P.sync_move.dispatchEvent(u,{positions:p,keys:g})})},onMouseDown:l=>{f(l,(p,{cssX:x,cssY:g},S)=>{const y=z(p,i.current);y&&(P.mousedown.dispatchEvent(r,{pointer:y,frame:i.current,keys:S}),d.current={xRangeCss:{start:x,end:x},yRangeCss:{start:g,end:g}})})},onMouseUp:l=>{f(l,(p,x,g)=>{const S=z(p,i.current);if(!S)return;P.mouseup.dispatchEvent(r,{frame:i.current,pointer:S,keys:g});const y=c.current;c.current=null;const w=d.current;if(d.current=null,w&&y){const T={...y,keys:g,completed:!0};c.current=null,P.spanselect.dispatchEvent(r,T)}})},onContextMenu:l=>{l.preventDefault(),f(l,(p,x,g)=>{const S=z(p,i.current);S&&P.contextmenu.dispatchEvent(r,{frame:i.current,pointer:S,keys:g})})},onDoubleClick:l=>{f(l,(p,x,g)=>{const S=z(p,i.current);S&&P.dblclick.dispatchEvent(r,{frame:i.current,pointer:S,keys:g})})}})},Je=({data:e,renderTooltip:s,xScaleId:t})=>{const[n,o]=v.useState(null);se("move",r=>{o(r)});const i=v.useMemo(()=>{if(!n)return null;const{frame:r,pointer:u}=n,d=u?.scaled[t];if(d===void 0)return null;const c=[];let a=d;for(const m of e){let f=null,h=1/0;for(const[p,x]of m.points.entries()){if(!Z(r,x.x,t)||!Z(r,x.y,m.yScaleId))continue;const g=Math.abs(x.x-d);g<h&&(h=g,f=p)}const l=m.points[f??-1];if(!l||ee(r,h,t,"css")>30){c.push({seriesId:m.seriesId,y:null});continue}a=l.x,c.push({seriesId:m.seriesId,y:l.y})}return{frame:r,x:a,points:c}},[e,n,t]);return s(i)},Qe=({makeXStyle:e,makeXClassName:s,makeYStyle:t,makeYClassName:n})=>{const[o,i]=v.useState(null);if(se("move",f=>{i(f)}),!o)return null;const{frame:r,pointer:u}=o,d=u?.cssX??null,c=u?.cssY??null,a=d?Y(r,d,"css"):0,m=c?j(r,c,"css"):0;return k.jsxs(k.Fragment,{children:[k.jsx("div",{"data-show":!!u,className:s?.(o),style:{position:"absolute",left:0,visibility:d===null?"hidden":"visible",top:r.chartAreaCSS.y,height:r.chartAreaCSS.height,borderColor:"red",borderLeftWidth:"1px",borderLeftStyle:"solid",pointerEvents:"none",opacity:u?1:0,transform:`translateX(${a}px)`,...e?.(o)}}),k.jsx("div",{className:n?.(o),"data-show":!!u,style:{position:"absolute",visibility:c===null?"hidden":"visible",top:0,height:0,borderTop:"solid 1px red",left:r.chartAreaCSS.x,width:r.chartAreaCSS.width,pointerEvents:"none",opacity:u?1:0,transform:`translateY(${m}px)`,...t?.(o)}})]})},et=({makeClassName:e,makeStyle:s})=>{const[t,n]=v.useState(null);se("spanselect",i=>{n(i.mode==="below_threshold"||i.completed?null:i)});const o=v.useMemo(()=>{if(!t||t.mode==="below_threshold")return null;const i=t.mode==="y"?-1/0:t.x.css?.from??-1/0,r=t.mode==="y"?1/0:t.x.css?.to??1/0,u=t.mode==="x"?-1/0:t.y.css?.from??-1/0,d=t.mode==="x"?1/0:t.y.css?.to??1/0,c=Y(t.frame,i,"css"),a=Y(t.frame,r,"css"),m=j(t.frame,u,"css"),f=j(t.frame,d,"css"),h=Math.min(c,a),l=Math.min(m,f),p=Math.abs(a-c),x=Math.abs(f-m);return{leftPx:h,topPx:l,widthPx:p,heightPx:x}},[t]);return k.jsx("div",{className:t?e?.(t):void 0,style:{position:"absolute",visibility:t?"visible":"hidden",left:`${o?.leftPx??0}px`,top:`${o?.topPx??0}px`,width:`${o?.widthPx??0}px`,height:`${o?.heightPx??0}px`,pointerEvents:"none",...t?s?.(t):void 0}})},tt=({style:e,children:s,scaleId:t,...n})=>{const o=te(i=>i.getScale(t)?.axis);return o?k.jsx("div",{style:{position:"absolute",backgroundColor:"#0000ff11",left:o.cssRect.x,top:o.cssRect.y,height:o.cssRect.height,width:o.cssRect.width,...e},...n,children:s}):null},Se=60,st=30,we="UTC",nt="en-GB",ot=({space:e,formatter:s,acceptableIncrements:t}={})=>(n,o)=>{const{min:i,max:r}=n,u=[],d=window.devicePixelRatio||1,c=(e??(n.origin==="x"?Se:st))*d,a=ve(o,c,n.id,"canvas"),m=t??q,f=m.find(l=>l>a)??m.at(-1)??1;let h=i;if(Math.abs(h%f)>Number.EPSILON){const l=(f-h%f)%f;h+=l}for(;h<=r&&u.length<1e3;)u.push(h),h+=f;return(s??be)(u)},be=e=>{const s=Math.max(0,Math.ceil(-Math.log10(e[1]-e[0])));return e.map(t=>({value:t,label:t.toFixed(s)}))},q=[];for(let e=-12;e<=12;e++)q.push(1*10**e),q.push(2*10**e),q.push(5*10**e);const it=1,Te=1e3*it,he=60*Te,J=60*he,ne=24*J,rt=30*ne,ct=365*ne,at=[[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=e=>{const[s,t]=e;switch(t){case"milliseconds":return s;case"seconds":return s*Te;case"minutes":return s*he;case"hours":return s*J;case"days":return s*ne;case"months":return s*rt;case"years":return s*ct}},lt=(e,s)=>{const t=new Date(e);return t.setUTCMilliseconds(t.getUTCMilliseconds()+s),t.getTime()},ut=(e,s)=>{const t=new Date(e);return t.setUTCSeconds(t.getUTCSeconds()+s),t.getTime()},dt=(e,s)=>{const t=new Date(e);return t.setUTCMinutes(t.getUTCMinutes()+s),t.getTime()},ht=(e,s)=>{const t=new Date(e);return t.setUTCHours(t.getUTCHours()+s),t.getTime()},ft=(e,s)=>{const t=new Date(e);return t.setUTCDate(t.getUTCDate()+s),t.getTime()},ye=(e,s)=>{const t=new Date(e);return t.setUTCMonth(t.getUTCMonth()+s),t.getTime()},X=(e,s)=>{const[t,n]=s;switch(n){case"milliseconds":return lt(e,t);case"seconds":return ut(e,t);case"minutes":return dt(e,t);case"hours":return ht(e,t);case"days":return ft(e,t);case"months":return ye(e,t);case"years":return ye(e,t*12)}};function G(e,s){const t=new Date(e),n=new Date(t.toLocaleString("en-US",{timeZone:s})),o=new Date(t.toLocaleString("en-US",{timeZone:"UTC"}));return(n.getTime()-o.getTime())/(3600*1e3)}const mt=(e,s,t="UTC")=>{const[n,o]=s;let i=new Date(e);const r=()=>{i.setUTCHours(-G(i,t),0,0,0)};switch(o){case"milliseconds":i.setUTCMilliseconds(Math.ceil(i.getUTCMilliseconds()/n)*n);break;case"seconds":i.setUTCSeconds(Math.ceil(i.getUTCSeconds()/n)*n,0);break;case"minutes":i.setUTCMinutes(Math.ceil(i.getTime()%J/he/n)*n,0,0);break;case"hours":i.setUTCHours(Math.ceil(i.getTime()%ne/J/n)*n,0,0,0);break;case"days":case"months":case"years":o==="months"?i.setUTCDate(1):o==="years"&&i.setUTCMonth(0,1),r(),i.getTime()<e&&(i=new Date(X(i,[1,o])));break}return i.getTime()},pt=({timeZone:e=we,space:s=Se,formatter:t,locale:n,showTimezone:o}={})=>(i,r)=>{const{min:u,max:d}=i,c=Math.floor(r.chartAreaCanvasPX.width/s)+1,m=(d-u)/c,[f,h]=at.find(S=>W(S)>=m)??[1,"milliseconds"],l=mt(u,[f,h],e),p=G(l,e),x=[l];let g;for(;;){switch(h){case"milliseconds":case"seconds":case"minutes":case"hours":{g=X(l,[x.length*f,h]);break}case"days":{const S=X(l,[x.length*f,h]);g=X(S,[p-G(S,e),"hours"]);break}case"months":case"years":{const S=X(X(X(l,[p,"hours"]),[x.length*f,h]),[-p,"hours"]);g=X(S,[p-G(S,e),"hours"]);break}}if(g>d)break;x.push(g)}return(t??Ce({locale:n,showTimezone:o,timeZone:e}))(x)},_=(e,s,t)=>e.find(n=>n.type===t)?.value!==s.find(n=>n.type===t)?.value,Ce=({timeZone:e=we,locale:s=nt,showTimezone:t=!0})=>{const n=new Intl.DateTimeFormat(s,{year:"numeric",day:"numeric",month:"short",hour:"numeric",hourCycle:"h23",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZoneName:"short",timeZone:e});return o=>{const i=o[1]-o[0],r=i<W([1,"days"]),u=i<W([1,"minutes"]),d=i<W([1,"seconds"]);return o.map(c=>({value:c,label:n.formatToParts(new Date(c))})).map((c,a,m)=>{const f=m[a-1],h=a===0||_(c.label,f.label,"year"),l=a===0||_(c.label,f.label,"day"),p=a===0||_(c.label,f.label,"month"),x=a===0||_(c.label,f.label,"hour"),g=a===0||_(c.label,f.label,"timeZoneName"),S=a===0||_(c.label,f.label,"minute"),y=a===0||_(c.label,f.label,"second"),w=a===0||_(c.label,f.label,"fractionalSecond"),T=[];if(r&&(x||S||g||y||w)){const C=c.label.find(R=>R.type==="hour")?.value,b=c.label.find(R=>R.type==="minute")?.value,E=c.label.find(R=>R.type==="timeZoneName")?.value;let M="";if(u){const R=c.label.find(K=>K.type==="second")?.value,N=c.label.find(K=>K.type==="fractionalSecond")?.value;M=`:${R}`+(d?`.${N}`:"")}T.push(`${C}:${b}${M}`+(t&&g?` ${E}`:""))}return(l||p)&&T.push([c.label.find(C=>C.type==="month")?.value,l&&c.label.find(C=>C.type==="day")?.value].filter(Boolean).join(" ")),h&&T.push(c.label.find(C=>C.type==="year")?.value),{value:c.value,label:T.filter(C=>C).join(`
4
+ `)}})}};exports.AreaPlot=Ne;exports.AxisOverlay=tt;exports.BarPlot=Be;exports.CanPlot=Xe;exports.ChartAreaInteractions=Ge;exports.Crosshair=Qe;exports.LinePlot=je;exports.ScatterPlot=Oe;exports.SelectBox=et;exports.SparklinePlot=$e;exports.TooltipsX=Je;exports.XTicks=He;exports.YTicks=qe;exports.applyStyles=A;exports.clamp=O;exports.clampUnfit=Re;exports.clampXPosToChartArea=Y;exports.clampYPosToChartArea=j;exports.defaultNumericalTicksFormatter=be;exports.findClosestIndex=Me;exports.getScale=D;exports.makeLinearTicks=ot;exports.makeTimeTickFormat=Ce;exports.makeTimeTicks=pt;exports.posToVal=U;exports.pxToValDistance=ve;exports.sum=ke;exports.useDrawEffect=F;exports.useFrameState=te;exports.useInteractionsEvent=se;exports.useXPositioned=Ve;exports.valFits=Z;exports.valToPos=B;exports.valToPxDistance=ee;
5
5
  //# sourceMappingURL=canplot.cjs.map