@oliasoft-open-source/charts-library 5.0.3 → 5.0.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/assets/{Color-YHDXOIA2-CFxGLTGo.js → Color-YHDXOIA2-DaZ5GlCD.js} +1 -1
- package/dist/assets/{DocsRenderer-CFRXHY34-DYq9QVnm.js → DocsRenderer-CFRXHY34-DbyTe21S.js} +3 -3
- package/dist/assets/{entry-preview-GMzx4jbx.js → entry-preview-CxR4D0ux.js} +1 -1
- package/dist/assets/{iframe-B0eL311-.js → iframe-CmX32U4s.js} +2 -2
- package/dist/assets/line-chart-Cc8V451r.js +1 -0
- package/dist/assets/{line-chart.stories-DQN9HSid.js → line-chart.stories-B-9Z3SfS.js} +1 -1
- package/dist/assets/{line-chart.test-case.stories-MVHnFE6p.js → line-chart.test-case.stories-BkKJokEu.js} +1 -1
- package/dist/assets/{preview-DmyQH9tE.js → preview-B_uyO-N3.js} +1 -1
- package/dist/assets/{preview-BDcEpQCt.js → preview-DPso9RAR.js} +2 -2
- package/dist/assets/{scatter-chart.stories-sl5FPoGH.js → scatter-chart.stories-Cuu-Wd2A.js} +1 -1
- package/dist/iframe.html +1 -1
- package/dist/index.js.js +17 -8
- package/dist/index.js.js.map +1 -1
- package/dist/line-chart/controls/axes-options/axes-options-interfaces.d.ts +1 -0
- package/dist/line-chart/hooks/use-chart-functions.d.ts +1 -0
- package/dist/line-chart/state/action-types.d.ts +1 -0
- package/dist/line-chart/state/state.interfaces.d.ts +1 -0
- package/dist/project.json +1 -1
- package/package.json +1 -1
- package/dist/assets/line-chart-lsxhDZkS.js +0 -1
|
@@ -9,3 +9,4 @@ export declare const UPDATE_AXES_RANGES = "UPDATE_AXES_RANGES";
|
|
|
9
9
|
export declare const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
|
|
10
10
|
export declare const TOGGLE_DRAG_ANNOTATION = "TOGGLE_DRAG_ANNOTATION";
|
|
11
11
|
export declare const DISABLE_DRAG_OPTIONS = "DISABLE_DRAG_OPTIONS";
|
|
12
|
+
export declare const UPDATE_EDITED = "UPDATE_EDITED";
|
package/dist/project.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1744115715936,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@storybook/testing-library":"0.2.2","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"3.0.9"},"hasRouterPackage":false,"packageManager":{"type":"yarn","version":"1.22.22"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","portableStoriesFileCount":0,"applicationFileCount":0,"storybookVersion":"8.6.7","storybookVersionSpecifier":"^8.6.7","language":"javascript","storybookPackages":{"@storybook/blocks":{"version":"8.6.7"},"@storybook/react":{"version":"8.6.7"},"@storybook/react-vite":{"version":"8.6.7"},"@storybook/testing-library":{"version":"0.2.2"},"eslint-plugin-storybook":{"version":"0.11.6"},"storybook":{"version":"8.6.7"}},"addons":{"@storybook/addon-actions":{"version":"8.6.7"},"@storybook/addon-docs":{"version":"8.6.7"},"storybook-dark-mode":{"version":"4.0.2"},"@storybook/addon-mdx-gfm":{"version":"8.6.7"}}}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as p}from"./jsx-runtime-Y5Ju2SGo.js";import{r as O}from"./index-eCxJ45ll.js";import{$ as Ut,a0 as We,a1 as J,x as X,a2 as Yt,v as S,A as F,P as oe,C as Q,a3 as Ge,a4 as qt,g as De,N as Wt,S as $t,y as Zt,O as Kt,a5 as le,a6 as ie,Q as ee,a7 as fe,E as Ne,R as Jt,T as Qt,L as $e,a as en,U as ge,V as tn,W as Z,d as nn,r as sn,B as Ze,a8 as rn,f as on,a9 as ln,I as an,aa as k,ab as ze,ac as re,D as un,ad as K,b as cn,s as dn,F as fn,ae as gn,h as mn,i as bn,J as pn,Y as hn,j as yn,k as xn,p as _n,m as Tn,n as En,o as An,q as Ln,t as On}from"./legend-context-vqtlaWwg.js";import{r as Oe,M as Re,p as me,B as H,s as Sn,v as Cn,w as Ke,x as Pn,y as Dn,z as Nn,A as wn,E as Mn,N as Je,G as In,S as vn,g as jn,e as Fn,F as kn,T as bt,J as Gn,K as zn,D as Rn,O as Bn,Q as Vn,k as Xn,q as Hn,U as Un,u as Yn,j as qn,Z as Wn,t as $n,R as Zn,m as Kn,H as Jn,L as Qn,n as es,o as ts}from"./legend-CD8XU7nW.js";import{c as ns,C as ss,f as Qe,a as rs,b as os}from"./get-draggableData-DS0HhINp.js";import{e as pt}from"./index-B-BONL6g.js";const ls="_chart_e3qdd_1",is="_canvas_e3qdd_11",as="_fixedHeight_e3qdd_20",us="_stretchHeight_e3qdd_26",cs="_squareAspectRatio_e3qdd_32",ds="_table_e3qdd_62",Se={chart:ls,canvas:is,fixedHeight:as,stretchHeight:us,squareAspectRatio:cs,table:ds};var ht=Symbol.for("immer-nothing"),et=Symbol.for("immer-draftable"),M=Symbol.for("immer-state");function v(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var te=Object.getPrototypeOf;function ne(e){return!!e&&!!e[M]}function Y(e){var t;return e?yt(e)||Array.isArray(e)||!!e[et]||!!((t=e.constructor)!=null&&t[et])||Ee(e)||Ae(e):!1}var fs=Object.prototype.constructor.toString();function yt(e){if(!e||typeof e!="object")return!1;const t=te(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===fs}function be(e,t){Te(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,s)=>t(s,n,e))}function Te(e){const t=e[M];return t?t.type_:Array.isArray(e)?1:Ee(e)?2:Ae(e)?3:0}function we(e,t){return Te(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function xt(e,t,n){const s=Te(e);s===2?e.set(t,n):s===3?e.add(n):e[t]=n}function gs(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ee(e){return e instanceof Map}function Ae(e){return e instanceof Set}function U(e){return e.copy_||e.base_}function Me(e,t){if(Ee(e))return new Map(e);if(Ae(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yt(e);if(t===!0||t==="class_only"&&!n){const s=Object.getOwnPropertyDescriptors(e);delete s[M];let r=Reflect.ownKeys(s);for(let o=0;o<r.length;o++){const i=r[o],l=s[i];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[i]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[i]})}return Object.create(te(e),s)}else{const s=te(e);if(s!==null&&n)return{...e};const r=Object.create(s);return Object.assign(r,e)}}function Be(e,t=!1){return Le(e)||ne(e)||!Y(e)||(Te(e)>1&&(e.set=e.add=e.clear=e.delete=ms),Object.freeze(e),t&&Object.entries(e).forEach(([n,s])=>Be(s,!0))),e}function ms(){v(2)}function Le(e){return Object.isFrozen(e)}var bs={};function q(e){const t=bs[e];return t||v(0,e),t}var ae;function _t(){return ae}function ps(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tt(e,t){t&&(q("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ie(e){ve(e),e.drafts_.forEach(hs),e.drafts_=null}function ve(e){e===ae&&(ae=e.parent_)}function nt(e){return ae=ps(ae,e)}function hs(e){const t=e[M];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function st(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[M].modified_&&(Ie(t),v(4)),Y(e)&&(e=pe(t,e),t.parent_||he(t,e)),t.patches_&&q("Patches").generateReplacementPatches_(n[M].base_,e,t.patches_,t.inversePatches_)):e=pe(t,n,[]),Ie(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ht?e:void 0}function pe(e,t,n){if(Le(t))return t;const s=t[M];if(!s)return be(t,(r,o)=>rt(e,s,t,r,o,n)),t;if(s.scope_!==e)return t;if(!s.modified_)return he(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let o=r,i=!1;s.type_===3&&(o=new Set(r),r.clear(),i=!0),be(o,(l,a)=>rt(e,s,r,l,a,n,i)),he(e,r,!1),n&&e.patches_&&q("Patches").generatePatches_(s,n,e.patches_,e.inversePatches_)}return s.copy_}function rt(e,t,n,s,r,o,i){if(ne(r)){const l=o&&t&&t.type_!==3&&!we(t.assigned_,s)?o.concat(s):void 0,a=pe(e,r,l);if(xt(n,s,a),ne(a))e.canAutoFreeze_=!1;else return}else i&&n.add(r);if(Y(r)&&!Le(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;pe(e,r),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&he(e,r)}}function he(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Be(t,n)}function ys(e,t){const n=Array.isArray(e),s={type_:n?1:0,scope_:t?t.scope_:_t(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,o=Ve;n&&(r=[s],o=ue);const{revoke:i,proxy:l}=Proxy.revocable(r,o);return s.draft_=l,s.revoke_=i,l}var Ve={get(e,t){if(t===M)return e;const n=U(e);if(!we(n,t))return xs(e,n,t);const s=n[t];return e.finalized_||!Y(s)?s:s===Ce(e.base_,t)?(Pe(e),e.copy_[t]=Fe(s,e)):s},has(e,t){return t in U(e)},ownKeys(e){return Reflect.ownKeys(U(e))},set(e,t,n){const s=Tt(U(e),t);if(s!=null&&s.set)return s.set.call(e.draft_,n),!0;if(!e.modified_){const r=Ce(U(e),t),o=r==null?void 0:r[M];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(gs(n,r)&&(n!==void 0||we(e.base_,t)))return!0;Pe(e),je(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Ce(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Pe(e),je(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=U(e),s=Reflect.getOwnPropertyDescriptor(n,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:n[t]}},defineProperty(){v(11)},getPrototypeOf(e){return te(e.base_)},setPrototypeOf(){v(12)}},ue={};be(Ve,(e,t)=>{ue[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ue.deleteProperty=function(e,t){return ue.set.call(this,e,t,void 0)};ue.set=function(e,t,n){return Ve.set.call(this,e[0],t,n,e[0])};function Ce(e,t){const n=e[M];return(n?U(n):e)[t]}function xs(e,t,n){var r;const s=Tt(t,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(e.draft_):void 0}function Tt(e,t){if(!(t in e))return;let n=te(e);for(;n;){const s=Object.getOwnPropertyDescriptor(n,t);if(s)return s;n=te(n)}}function je(e){e.modified_||(e.modified_=!0,e.parent_&&je(e.parent_))}function Pe(e){e.copy_||(e.copy_=Me(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var _s=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,s)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const i=this;return function(a=o,...c){return i.produce(a,u=>n.call(this,u,...c))}}typeof n!="function"&&v(6),s!==void 0&&typeof s!="function"&&v(7);let r;if(Y(t)){const o=nt(this),i=Fe(t,void 0);let l=!0;try{r=n(i),l=!1}finally{l?Ie(o):ve(o)}return tt(o,s),st(r,o)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===ht&&(r=void 0),this.autoFreeze_&&Be(r,!0),s){const o=[],i=[];q("Patches").generateReplacementPatches_(t,r,o,i),s(o,i)}return r}else v(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(i,...l)=>this.produceWithPatches(i,a=>t(a,...l));let s,r;return[this.produce(t,n,(i,l)=>{s=i,r=l}),s,r]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Y(e)||v(8),ne(e)&&(e=Ts(e));const t=nt(this),n=Fe(e,void 0);return n[M].isManual_=!0,ve(t),n}finishDraft(e,t){const n=e&&e[M];(!n||!n.isManual_)&&v(9);const{scope_:s}=n;return tt(s,t),st(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(r.path.length===0&&r.op==="replace"){e=r.value;break}}n>-1&&(t=t.slice(n+1));const s=q("Patches").applyPatches_;return ne(e)?s(e,t):this.produce(e,r=>s(r,t))}};function Fe(e,t){const n=Ee(e)?q("MapSet").proxyMap_(e,t):Ae(e)?q("MapSet").proxySet_(e,t):ys(e,t);return(t?t.scope_:_t()).drafts_.push(n),n}function Ts(e){return ne(e)||v(10,e),Et(e)}function Et(e){if(!Y(e)||Le(e))return e;const t=e[M];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Me(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Me(e,!0);return be(n,(s,r)=>{xt(n,s,Et(r))}),t&&(t.finalized_=!1),n}var I=new _s,Es=I.produce;I.produceWithPatches.bind(I);I.setAutoFreeze.bind(I);I.setUseStrictShallowCopy.bind(I);I.applyPatches.bind(I);I.createDraft.bind(I);I.finishDraft.bind(I);const At="TOGGLE_ZOOM",Lt="TOGGLE_PAN",Ot="TOGGLE_POINTS",St="TOGGLE_LINE",Ct="TOGGLE_LEGEND",Pt="TOGGLE_TABLE",Dt="RESET_AXES_RANGES",ye="UPDATE_AXES_RANGES",Nt="TOGGLE_DRAG_POINTS",wt="TOGGLE_DRAG_ANNOTATION",Mt="DISABLE_DRAG_OPTIONS",As=(e,t)=>Es(e,n=>{switch(t.type){case At:{n.zoomEnabled=!n.zoomEnabled,n.panEnabled&&(n.panEnabled=!1),n.enableDragPoints&&(n.enableDragPoints=!1),n.enableDragAnnotation&&(n.enableDragAnnotation=!1);break}case Lt:{n.panEnabled=!n.panEnabled,n.zoomEnabled&&(n.zoomEnabled=!1),n.enableDragPoints&&(n.enableDragPoints=!1),n.enableDragAnnotation&&(n.enableDragAnnotation=!1);break}case Ot:{n.pointsEnabled=!n.pointsEnabled;break}case St:{n.lineEnabled=!n.lineEnabled;break}case Ct:{n.legendEnabled=!n.legendEnabled;break}case Pt:{n.showTable=!n.showTable;break}case ye:{const{axes:s}=t.payload;n.axes=s;break}case Dt:{const{axes:s}=t.payload;n.axes=s;break}case Nt:{n.enableDragPoints=!n.enableDragPoints,n.panEnabled&&(n.panEnabled=!1),n.zoomEnabled&&(n.zoomEnabled=!1),n.enableDragAnnotation&&(n.enableDragAnnotation=!1);break}case wt:{n.enableDragAnnotation=!n.enableDragAnnotation,n.panEnabled&&(n.panEnabled=!1),n.zoomEnabled&&(n.zoomEnabled=!1);break}case Mt:{(n.enableDragAnnotation||n.enableDragPoints||n.panEnabled||n.zoomEnabled)&&(n.enableDragAnnotation=!1,n.enableDragPoints=!1,n.panEnabled=!1,n.zoomEnabled=!1);break}}}),Ls=e=>{if(!e)return null;const t=`line-chart-state-${e}`,n=localStorage.getItem(t);return n?JSON.parse(n).state:null},Os=(e=72)=>{const t=new Date().getTime(),n=e*60*60*1e3;for(let s=0;s<localStorage.length;s++){const r=localStorage.key(s);if(r!=null&&r.includes("line-chart-state-")){const o=localStorage.getItem(r);if(o){const l=JSON.parse(o).timestamp;l&&t-l>n&&localStorage.removeItem(r)}}}},Ss=(e,t)=>{if(!t)return;const n=new Date().getTime(),s=`line-chart-state-${t}`,r={state:e,timestamp:n};localStorage.setItem(s,JSON.stringify(r)),Os()},Cs=({options:e,persistenceId:t})=>{const{chartOptions:{enableZoom:n,enablePan:s,showPoints:r,showLine:o,enableDragAnnotation:i},legend:{display:l},dragData:a}=e,{zoomEnabled:c,panEnabled:u,pointsEnabled:f,lineEnabled:h,legendEnabled:g,enableDragPoints:_,enableDragAnnotation:b}=Ls(t)||{};return{zoomEnabled:i??b?!1:c??n,panEnabled:u??s,pointsEnabled:f??r,lineEnabled:h??o,legendEnabled:g??l,axes:[],showTable:!1,enableDragPoints:(a==null?void 0:a.enableDragData)&&_,enableDragAnnotation:i??b}},Ps=e=>O.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},O.createElement("clipPath",{id:"a"},O.createElement("path",{d:"m0 0h12v12h-12z"})),O.createElement("g",{clipPath:"url(#a)"},O.createElement("path",{d:"m.5 6.5v-1h11v1c-4.16104 0-6.63549 0-11 0z"}))),Ds=e=>O.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e},O.createElement("circle",{cx:6,cy:6,r:2})),Ns=e=>O.createElement("svg",{fill:"currentColor",height:"1em",viewBox:"0 0 12 12",width:"1em",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",...e},O.createElement("clipPath",{id:"a"},O.createElement("path",{d:"m0 0h12v12h-12z"})),O.createElement("g",{clipPath:"url(#a)"},O.createElement("path",{d:"m7.937 6.5c-.11122.42912-.36179.80916-.71237 1.08047-.35058.2713-.78133.4185-1.22463.4185s-.87405-.1472-1.22463-.4185c-.35058-.27131-.60115-.65135-.71237-1.08047h-3.563v-1h3.563c.11122-.42912.36179-.80916.71237-1.08046s.78133-.41851 1.22463-.41851.87405.14721 1.22463.41851.60115.65134.71237 1.08046h3.563v1z"})));function ws({lineEnabled:e,onToggleLine:t,onTogglePoints:n,pointsEnabled:s,translations:r}){return[{type:"Option",label:r.pointsLines,icon:p.jsx(Oe,{icon:p.jsx(Ns,{})}),selected:s&&e,onClick:()=>{s||n(),e||t()}},{type:"Option",label:r.linesOnly,icon:p.jsx(Oe,{icon:p.jsx(Ps,{})}),selected:!s&&e,onClick:()=>{s&&n(),e||t()}},{type:"Option",label:r.pointsOnly,icon:p.jsx(Oe,{icon:p.jsx(Ds,{})}),selected:s&&!e,onClick:()=>{s||n(),e&&t()}}]}const It=({options:e})=>{const[t,n]=O.useState(!1),s=e.find(r=>r.selected);return p.jsx(Re,{open:t,setOpen:n,menu:{sections:e,trigger:"Component",component:p.jsx(me,{display:"inline-flex",text:s==null?void 0:s.label,placement:"bottom-start",enabled:!t,children:p.jsx(H,{colored:"muted",basic:!0,small:!0,round:!0,icon:s==null?void 0:s.icon})})}})};It.__docgenInfo={description:"",methods:[],displayName:"LineOptions",props:{options:{required:!0,tsType:{name:"Array",elements:[{name:"IMenuSection"}],raw:"IMenuSection[]"},description:""}}};function Ms({onTogglePan:e,onToggleZoom:t,panEnabled:n,zoomEnabled:s,enableDragPoints:r,enableDragAnnotation:o,isDragDataAllowed:i,isDragAnnotationAllowed:l,onToggleDragAnnotation:a,onToggleDragPoints:c,onDisableDragOptions:u,translations:{dragToZoom:f,doubleClickToReset:h,dragToPan:g,dragToMovePoints:_,dragDisabled:b,dragToMoveAnnotation:T}}){return[{label:f,description:h,icon:p.jsx(Sn,{}),selected:s,type:"Option",onClick:()=>{s||t()}},{label:g,description:h,icon:p.jsx(Cn,{}),selected:n,type:"Option",onClick:()=>{n||e()}},...i?[{label:_,icon:p.jsx(Ke,{}),selected:r,type:"Option",onClick:()=>{r||c()}}]:[],...l?[{label:T,icon:p.jsx(Ke,{}),selected:o,type:"Option",onClick:()=>{o||a()}}]:[],{label:b,icon:p.jsx(Pn,{}),selected:!s&&!n&&!r&&!o,type:"Option",onClick:u}]}const vt=({options:e})=>{const t=e.find(n=>n.selected);return p.jsx(Re,{menu:{sections:e,trigger:"Component",component:p.jsx(H,{colored:"muted",basic:!0,small:!0,label:t==null?void 0:t.label,icon:t==null?void 0:t.icon})}})};vt.__docgenInfo={description:"@param {import('./drag-options-interfaces').IDragOptions} obj",methods:[],displayName:"DragOptions",props:{options:{required:!0,tsType:{name:"Array",elements:[{name:"IMenuSection"}],raw:"IMenuSection[]"},description:""}}};const Is="_controls_1edjs_1",vs="_buttons_1edjs_6",ot={controls:Is,buttons:vs},js=e=>{const t=O.useCallback(s=>()=>{e({type:s})},[e]);return{onToggleLegend:t(Ct),onToggleLine:t(St),onTogglePan:t(Lt),onTogglePoints:t(Ot),onToggleTable:t(Pt),onToggleZoom:t(At),onToggleDragPoints:t(Nt),onToggleDragAnnotation:t(wt),onDisableDragOptions:t(Mt)}},Fs=(e,t)=>e===void 0||t===void 0||Number(e)<Number(t),ks=(e,t)=>e===void 0||t===void 0||Number(e)>Number(t),jt=(e,t=0,n=!1)=>{const s=n&&t!==0?t+1:"";return`${e}${s}`},Gs=e=>{var t;return((t=e==null?void 0:e.match(/[^0-9/]+/gi))==null?void 0:t[0])??""},zs=e=>e.join(""),Ur=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null,Rs=e=>e?Object.values(e).some(t=>!Ut(t)):!1,Xe=({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r})=>{const{interactions:{onHover:o,onUnhover:i},axes:l}=n,a=O.useCallback(()=>{const d=e==null?void 0:e.current;d==null||d.resetZoom(),d==null||d.reset(),s({type:"RESET_AXES_RANGES",payload:{axes:[]}})},[e==null?void 0:e.current,s]),c=O.useCallback((d,A,m)=>(x,y)=>{var L,E;if(!(y!=null&&y.length)&&i&&d&&(A(null),i(x),(L=e==null?void 0:e.current)==null||L.update()),y!=null&&y.length&&o){const{index:C,datasetIndex:P}=y[0],N=m[P],D=N==null?void 0:N.data[C];D&&!pt(d,D)&&(A(D),o(x,P,C,m),(E=e==null?void 0:e.current)==null||E.update())}},[o,i,r]),u=O.useCallback(()=>ns(e,t),[e==null?void 0:e.current,t.axes]),f=O.useCallback(d=>{var A,m,x,y,L;if(d.key===We.Shift){const E=e.current,C=(x=(m=(A=E==null?void 0:E.config)==null?void 0:A.options)==null?void 0:m.plugins)==null?void 0:x.zoom;(y=C==null?void 0:C.zoom)!=null&&y.mode&&((L=C==null?void 0:C.pan)!=null&&L.mode)&&(C.zoom.mode=J.Y,C.pan.mode=J.Y,E==null||E.update())}},[e==null?void 0:e.current]),h=O.useCallback(d=>{var A,m,x,y,L;if(d.key===We.Shift){const E=e.current,C=(x=(m=(A=E==null?void 0:E.config)==null?void 0:A.options)==null?void 0:m.plugins)==null?void 0:x.zoom;(y=C==null?void 0:C.zoom)!=null&&y.mode&&((L=C==null?void 0:C.pan)!=null&&L.mode)&&(C.zoom.mode=J.XY,C.pan.mode=J.XY,E==null||E.update())}},[e==null?void 0:e.current]),g=O.useCallback(d=>{var m;if(!((m=Object.keys(d))!=null&&m.length))return[];const A=(x,y)=>{var L;return!x[y]||!((L=x[y])!=null&&L.length)?[]:x[y].map((E,C)=>({id:jt(y,C,x[y].length>1),label:(E==null?void 0:E.label)||""}))};return[...A(d,X.X),...A(d,X.Y)]},[l]),_=O.useCallback(()=>{var m;const{scales:d={}}=(e==null?void 0:e.current)||{},A=(m=Object.entries(d))==null?void 0:m.map(([x,{min:y,max:L}])=>({id:x,min:y??0,max:L??0}));s({type:ye,payload:{axes:A}})},[l]),b=O.useCallback(()=>{const d=e==null?void 0:e.current;d==null||d.resetZoom(),d==null||d.reset(),s({type:Dt,payload:{axes:[]}})},[e==null?void 0:e.current]),T=O.useCallback(({axes:d})=>{s({type:ye,payload:{axes:d}})},[]);return{resetZoom:a,onHover:c,handleDownload:u,handleKeyDown:f,handleKeyUp:h,controlsAxesLabels:g(l),updateAxesRangesFromChart:_,onResetAxes:b,onUpdateAxes:T}},lt=(e,t,n)=>{const s=[];return Yt(e)&&s.push("mustHaveAValue"),n==="min"&&!Fs(e,t)?s.push("mustBeLessThanMax"):n==="max"&&!ks(e,t)&&s.push("mustBeGreaterThanMin"),s},Bs=e=>{const t=e.map(({id:s,min:r,max:o})=>({id:s,min:lt(String(r),String(o),"min"),max:lt(String(o),String(r),"max")})),n=t.every(s=>s.min.length===0&&s.max.length===0);return{errors:t,valid:n}},it=1,at=({chartRef:e,state:t})=>{const n=e==null?void 0:e.current;if(!n)return[];const s=(n==null?void 0:n.getInitialScaleBounds())??{};return Object.entries(s).map(([r,{min:o="",max:i=""}])=>{var u;let l=Number(o),a=Number(i);isNaN(l)&&(l=0),isNaN(a)&&(a=l+it),l===a&&(a+=it);const{unit:c}=((u=t==null?void 0:t.axes)==null?void 0:u.find(f=>f.id===r))??{};return{id:r,min:l,max:a,unit:c}})},Vs=e=>{var A;const{state:t,controlsAxesLabels:n,onUpdateAxes:s,onResetAxes:r,depthType:o,translations:i,close:l,chartRef:a}=e??{},[c,u]=O.useState({localAxes:at({chartRef:a,state:t}),depthType:o==null?void 0:o.selectedDepthType,edited:!1}),{errors:f,valid:h}=Bs(c.localAxes),g=({name:m,value:x,id:y})=>{u(L=>({...L,localAxes:L.localAxes.map(E=>E.id===y?{...E,[m]:x}:E),edited:!0}))},_=({name:m,value:x,id:y})=>{u(L=>({...L,localAxes:L.localAxes.map(E=>E.id===y&&typeof E.unit=="object"?{...E,unit:{...E.unit,[m]:x}}:E),edited:!0}))},b=m=>{m.preventDefault(),h&&(s({axes:c.localAxes}),l==null||l()),o&&(o!=null&&o.setSelectedDepthType)&&(o==null||o.setSelectedDepthType(c.depthType))},T=()=>{u({localAxes:at({chartRef:a,state:t}),depthType:o==null?void 0:o.selectedDepthType,edited:!1}),r(),l==null||l()},d=m=>m.target.select();return p.jsxs("form",{onSubmit:b,children:[c.localAxes.map(m=>{var E,C;const x=n.find(P=>P.id===m.id),y=(x==null?void 0:x.label)||S.startCase(m.id),L=f.find(P=>P.id===m.id);return p.jsx(wn,{label:y,children:p.jsxs(Mn,{small:!0,width:"300px",children:[p.jsx(Je,{name:"min",value:m.min,error:(E=L==null?void 0:L.min)!=null&&E[0]?i[L.min[0]]:null,width:"100%",onChange:P=>g({name:P.target.name,value:P.target.value,id:m.id}),onFocus:d}),p.jsx(In,{children:"to"}),p.jsx(Je,{name:"max",value:m.max,error:(C=L==null?void 0:L.max)!=null&&C[0]?i[L.max[0]]:null,width:"100%",onChange:P=>g({name:P.target.name,value:P.target.value,id:m.id}),onFocus:d}),m.unit?p.jsx(vn,{name:"selectedUnit",options:typeof m.unit!="string"?m.unit.options:[],value:typeof m.unit!="string"?m.unit.selectedUnit:void 0,onChange:P=>_({name:P.target.name,value:P.target.value,id:m.id}),autoLayerWidth:!0,width:"15%"}):null]})},m.id)}),((A=o==null?void 0:o.options)==null?void 0:A.length)>0&&p.jsxs(p.Fragment,{children:[p.jsx(jn,{items:o.options.map((m,x)=>({key:x,label:m})),onSelected:m=>u(x=>({...x,depthType:o.options[m],edited:!0})),small:!0,value:o.options.indexOf(c.depthType)}),p.jsx(Fn,{})]}),p.jsxs(kn,{gap:"8px",alignItems:"center",children:[p.jsx(H,{type:"submit",small:!0,colored:!0,label:i.done,disabled:!h||!c.edited}),p.jsx(H,{small:!0,name:"resetAxes",label:i.resetAxes,onClick:T}),p.jsx(bt,{small:!0,muted:!0,children:i.orDoubleClickToCanvas})]})]})},Ft=e=>p.jsx(Dn,{placement:"bottom-start",overflowContainer:!0,content:p.jsx(Vs,{...e}),children:p.jsx(me,{text:e.translations.axesOptions,placement:"bottom-start",display:"inline-flex",children:p.jsx(H,{small:!0,basic:!0,colored:"muted",round:!0,icon:p.jsx(Nn,{})})})});Ft.__docgenInfo={description:"",methods:[],displayName:"AxesOptions",props:{chartRef:{required:!0,tsType:{name:"RefObject",elements:[{name:"Chart"}],raw:"RefObject<Chart>"},description:""},state:{required:!0,tsType:{name:"IState"},description:""},controlsAxesLabels:{required:!0,tsType:{name:"Array",elements:[{name:"IAxisControlLabel"}],raw:"IAxisControlLabel[]"},description:""},onUpdateAxes:{required:!0,tsType:{name:"signature",type:"function",raw:"({ axes }: { axes: IAxisState }) => void",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ axes: IAxisState }",signature:{properties:[{key:"axes",value:{name:"IAxisState",required:!0}}]}},name:""}],return:{name:"void"}}},description:""},onResetAxes:{required:!0,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},depthType:{required:!1,tsType:{name:"union",raw:"IDepthType | object",elements:[{name:"IDepthType"},{name:"object"}]},description:""},close:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},translations:{required:!0,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record<string, string>"},description:""}}};const kt=({table:e,headerComponent:t,subheaderComponent:n,chartRef:s,state:r,options:o,dispatch:i,generatedDatasets:l,translations:a,controlsPortalId:c})=>{const{enableDragPoints:u,lineEnabled:f,panEnabled:h,pointsEnabled:g,showTable:_,zoomEnabled:b,enableDragAnnotation:T}=r,{dragData:d,depthType:A,annotations:m}=o,{onToggleLine:x,onTogglePan:y,onTogglePoints:L,onToggleTable:E,onToggleZoom:C,onToggleDragPoints:P,onToggleDragAnnotation:N,onDisableDragOptions:D}=js(i),{handleDownload:w,controlsAxesLabels:W,onResetAxes:G,onUpdateAxes:se}=Xe({chartRef:s,state:r,options:o,dispatch:i,generatedDatasets:l}),[z,{width:R}]=Gn(),$=R<200,B=O.useMemo(()=>ws({lineEnabled:f,onToggleLine:x,onTogglePoints:L,pointsEnabled:g,translations:a}),[f,g]),V=O.useMemo(()=>Ms({onTogglePan:y,onToggleZoom:C,panEnabled:h,zoomEnabled:b,enableDragPoints:u,enableDragAnnotation:T,isDragDataAllowed:d==null?void 0:d.enableDragData,isDragAnnotationAllowed:m==null?void 0:m.enableDragAnnotation,onToggleDragAnnotation:N,onToggleDragPoints:P,onDisableDragOptions:D,translations:a}),[b,h,u,d==null?void 0:d.enableDragData,m==null?void 0:m.enableDragAnnotation]);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:ot.controls,children:[!!o.title&&p.jsx(bt,{bold:!0,children:o.title}),t,p.jsx(ss,{controlsPortalId:c??"",children:p.jsxs("div",{className:ot.buttons,ref:z,children:[!_&&p.jsxs(p.Fragment,{children:[p.jsx(Ft,{chartRef:s,state:r,controlsAxesLabels:W,onUpdateAxes:se,onResetAxes:G,depthType:A,translations:a}),$?p.jsx(Re,{menu:{placement:"bottom-end",sections:[...B,{type:"Divider"},...V,{type:"Divider"},{icon:"download",label:a.downloadAsPNG,type:"Option",onClick:w}],trigger:"Component",component:p.jsx(H,{colored:"muted",basic:!0,small:!0,round:!0,icon:"menu"})}}):p.jsxs(p.Fragment,{children:[p.jsx(It,{options:B}),p.jsx(me,{display:"inline-flex",text:a.downloadAsPNG,placement:"bottom-end",children:p.jsx(H,{small:!0,basic:!0,colored:"muted",round:!0,icon:"download",onClick:w})}),p.jsx(vt,{options:V})]})]}),e?p.jsx(me,{display:"inline-flex",text:_?a.showChart:a.showTable,placement:"bottom-end",children:p.jsx(H,{small:!0,basic:!0,colored:"muted",round:!0,icon:_?"chart":"table",onClick:E})}):null]})})]}),n]})};kt.__docgenInfo={description:"",methods:[],displayName:"Controls",props:{headerComponent:{required:!1,tsType:{name:"ReactNode"},description:""},subheaderComponent:{required:!1,tsType:{name:"ReactNode"},description:""},table:{required:!1,tsType:{name:"ReactNode"},description:""},chartRef:{required:!0,tsType:{name:"RefObject",elements:[{name:"Chart"}],raw:"RefObject<Chart>"},description:""},state:{required:!0,tsType:{name:"IState"},description:""},options:{required:!0,tsType:{name:"ILineChartOptions"},description:""},dispatch:{required:!0,tsType:{name:"Dispatch",elements:[{name:"any"}],raw:"Dispatch<any>"},description:""},generatedDatasets:{required:!0,tsType:{name:"Array",elements:[{name:"IGeneratedLineChartDataset"}],raw:"IGeneratedLineChartDataset[]"},description:""},translations:{required:!0,tsType:{name:"Record",elements:[{name:"string"},{name:"string"}],raw:"Record<string, string>"},description:""},controlsPortalId:{required:!1,tsType:{name:"string"},description:""}}};const j={TOP_LEFT:"top-left",TOP_CENTER:"top-center",TOP_RIGHT:"top-right",MIDDLE_LEFT:"middle-left",MIDDLE_CENTER:"middle-center",MIDDLE_RIGHT:"middle-right",BOTTOM_LEFT:"bottom-left",BOTTOM_CENTER:"bottom-center",BOTTOM_RIGHT:"bottom-right"},ut=e=>({label:"",position:e,color:"",unit:{options:[],selectedUnit:"",setSelectedUnit:()=>{}}}),Xs=e=>({x:(e==null?void 0:e.x)||[ut("bottom")],y:(e==null?void 0:e.y)||[ut("left")]}),Hs=e=>({chartScaleType:(e==null?void 0:e.chartScaleType)||"linear",reverse:(e==null?void 0:e.reverse)||!1,beginAtZero:(e==null?void 0:e.beginAtZero)??!1,stepSize:e==null?void 0:e.stepSize,suggestedMin:e==null?void 0:e.suggestedMin,suggestedMax:e==null?void 0:e.suggestedMax,range:e==null?void 0:e.range,autoAxisPadding:(e==null?void 0:e.autoAxisPadding)??!1}),Us=e=>({width:e==null?void 0:e.width,height:e==null?void 0:e.height,maintainAspectRatio:(e==null?void 0:e.maintainAspectRatio)??!1,staticChartHeight:(e==null?void 0:e.staticChartHeight)??!1,performanceMode:(e==null?void 0:e.performanceMode)??!0,squareAspectRatio:(e==null?void 0:e.squareAspectRatio)??!1,layoutPadding:(e==null?void 0:e.layoutPadding)||{top:0,bottom:20,left:0,right:0}}),Ys=e=>({tooltips:(e==null?void 0:e.tooltips)??!0,showLabelsInTooltips:(e==null?void 0:e.showLabelsInTooltips)??!1,hideSimulationName:(e==null?void 0:e.hideSimulationName)??!1,scientificNotation:(e==null?void 0:e.scientificNotation)??!0}),qs=e=>({lineTension:(e==null?void 0:e.lineTension)??.01,spanGaps:(e==null?void 0:e.spanGaps)??!1,showDataLabels:(e==null?void 0:e.showDataLabels)??!1,showMinorGridlines:(e==null?void 0:e.showMinorGridlines)??!1}),Ws=e=>e?e.map(t=>({...t,display:(t==null?void 0:t.display)??!0})):[],$s=e=>{var t,n,s,r,o,i,l,a;return{labelAnnotation:{showLabel:((t=e==null?void 0:e.labelAnnotation)==null?void 0:t.showLabel)??!1,text:((n=e==null?void 0:e.labelAnnotation)==null?void 0:n.text)??"",position:((s=e==null?void 0:e.labelAnnotation)==null?void 0:s.position)??j.BOTTOM_RIGHT,fontSize:((r=e==null?void 0:e.labelAnnotation)==null?void 0:r.fontSize)??12,xOffset:((o=e==null?void 0:e.labelAnnotation)==null?void 0:o.xOffset)??5,yOffset:((i=e==null?void 0:e.labelAnnotation)==null?void 0:i.yOffset)??5,maxWidth:((l=e==null?void 0:e.labelAnnotation)==null?void 0:l.maxWidth)??300,lineHeight:((a=e==null?void 0:e.labelAnnotation)==null?void 0:a.lineHeight)??12},showAnnotations:(e==null?void 0:e.showAnnotations)??!1,controlAnnotation:(e==null?void 0:e.controlAnnotation)??!1,enableDragAnnotation:(e==null?void 0:e.enableDragAnnotation)??!1,annotationsData:Ws(e==null?void 0:e.annotationsData)}},Zs=e=>({display:(e==null?void 0:e.display)??!0,position:(e==null?void 0:e.position)??oe.BottomLeft,align:(e==null?void 0:e.align)??F.Center,customLegend:(e==null?void 0:e.customLegend)??{customLegendPlugin:null,customLegendContainerID:""},usePointStyle:(e==null?void 0:e.usePointStyle)??!0}),Ks=e=>({showPoints:(e==null?void 0:e.showPoints)??!0,showLine:(e==null?void 0:e.showLine)??!0,enableZoom:(e==null?void 0:e.enableZoom)??!0,enablePan:(e==null?void 0:e.enablePan)??!1,enableDragAnnotation:(e==null?void 0:e.enableDragAnnotation)??!1,closeOnOutsideClick:(e==null?void 0:e.closeOnOutsideClick)??!1}),Js=e=>({onLegendClick:e==null?void 0:e.onLegendClick,onHover:e==null?void 0:e.onHover,onUnhover:e==null?void 0:e.onUnhover,onAnimationComplete:e==null?void 0:e.onAnimationComplete}),Qs=e=>({enableDragData:(e==null?void 0:e.enableDragData)??!1,showTooltip:(e==null?void 0:e.showTooltip)??!0,roundPoints:(e==null?void 0:e.roundPoints)??!0,dragX:(e==null?void 0:e.dragX)??!0,dragY:(e==null?void 0:e.dragY)??!0,onDragStart:e==null?void 0:e.onDragStart,onDrag:e==null?void 0:e.onDrag,onDragEnd:e==null?void 0:e.onDragEnd}),Gt=e=>{const t=(e==null?void 0:e.chart)||{},n=(t==null?void 0:t.options)||{};return{persistenceId:(t==null?void 0:t.persistenceId)??"",controlsPortalId:(t==null?void 0:t.controlsPortalId)??"",testId:(t==null?void 0:t.testId)??void 0,data:t==null?void 0:t.data,options:{title:(n==null?void 0:n.title)??"",scales:(n==null?void 0:n.scales)??{},axes:Xs(n==null?void 0:n.axes),additionalAxesOptions:Hs(n==null?void 0:n.additionalAxesOptions),chartStyling:Us(n==null?void 0:n.chartStyling),tooltip:Ys(n==null?void 0:n.tooltip),graph:qs(n==null?void 0:n.graph),annotations:$s(n==null?void 0:n.annotations),legend:Zs(n==null?void 0:n.legend),chartOptions:Ks(n==null?void 0:n.chartOptions),interactions:Js(n==null?void 0:n.interactions),dragData:Qs(n==null?void 0:n.dragData),depthType:(n==null?void 0:n.depthType)??{}}}},er=(e,t)=>{if(S.isEmpty(e)||S.isEmpty(t))return!1;const n=s=>typeof t=="string"?s&&S.has(s,t):S.isArray(t)?s&&S.some(t,r=>s&&S.has(s,r)):s&&S.some(Object.values(t),r=>s&&S.has(s,r));return S.isArray(e)?S.some(e,n):n(e)};var zt=(e=>(e.showLine="showLine",e.showPoints="showPoints",e))(zt||{});const tr=(e,t,n,{label:s})=>{const r=[...e??[]],{annotations:o,graph:i}=n??{},{controlAnnotation:l,showAnnotations:a,annotationsData:c=[]}=o??{};if(l&&a){const u=c.map((f,h)=>{const{type:g,..._}=f,b=_.color??Q[h],T=qt,d=Ge.INITIAL;return{..._,isAnnotation:!0,annotationType:g,label:_.label,annotationIndex:h,backgroundColor:b,pointBackgroundColor:b,borderColor:b,borderDash:T,borderWidth:d,data:[{}]}});r.push(...u)}return r==null?void 0:r.map((u,f)=>{var He,Ue;const{formation:h,data:g=[],pointRadius:_,pointHoverRadius:b,borderWidth:T,borderColor:d,backgroundColor:A,pointBackgroundColor:m,borderDash:x,showPoints:y,showLine:L}=u??{},{lineEnabled:E,pointsEnabled:C,axes:P=[]}=t??{},{lineTension:N,spanGaps:D}=i??{},w=Array.isArray(g)?g:[];if(h&&(w!=null&&w.length)){const Ye=Number((He=P[0])==null?void 0:He.min),qe=Number((Ue=P[0])==null?void 0:Ue.max),[ce,de]=w;Ye&&(ce!=null&&ce.x)&&(w[0].x=Math.max(Ye,ce.x)),qe&&(de!=null&&de.x)&&(w[2].x=Math.min(qe,de.x))}const W=er(u,zt),G=(w==null?void 0:w.filter(Boolean))||[],se=(G==null?void 0:G.length)===1;let z,R;y!==void 0?z=y:L===!1?z=!0:z=C||se,L!==void 0?R=L:y===!1?R=!0:R=E;const $=parseFloat(_)||Rn,B=parseFloat(b)||zn,V=Q[f];return{...u,label:(u==null?void 0:u.label)??`${s} ${f+1}`,data:G,showLine:R,lineTension:(u==null?void 0:u.lineTension)??N,spanGaps:D,borderWidth:parseFloat(T)||Xn,borderDash:x||[],borderJoinStyle:Vn,borderColor:d??V??De(Q),backgroundColor:A??Bn,pointBackgroundColor:m??V??De(Q),pointRadius:z?$:0,pointHoverRadius:B,pointHitRadius:(u==null?void 0:u.pointHitRadius)??B,...W?{hasCustomOpt:W}:{}}})},Rt=e=>e==null?void 0:e.reduce((t,n)=>({...t,[n.annotationAxis]:[...t[n.annotationAxis]||[],+n.value]}),{}),Bt=(e,t,n)=>{if(!e||!e.current)return null;const s=e.current.getSortedVisibleDatasetMetas(),r=Rt(n)[t]??[];let o=[];if(s.forEach(a=>{const c=a._parsed.map(u=>u[t]).filter(u=>u!=null&&!isNaN(u));o=o.concat(c)}),o=o.concat(r),o.length===0)return null;const i=Math.min(...o),l=Math.max(...o);return{min:i,max:l}},ke=(e,t,n,s,r=0)=>{var u,f,h,g,_,b,T;const o=s||e.axes[t][0]||{},i=n==null?void 0:n.axes.filter(d=>{var A;return(A=d==null?void 0:d.id)==null?void 0:A.startsWith(t)})[r],l=(f=(u=e==null?void 0:e.scales)==null?void 0:u[`${r===0?t:t+r}`])==null?void 0:f.ticks,{additionalAxesOptions:a}=e,c=()=>{const d=(a==null?void 0:a.chartScaleType)===$t.Logarithmic,A=(y,L,E)=>d?Kt.includes(y)?Qe(y,E):"":Qe(y,E);return{...d?{}:{stepSize:o.stepSize??(t===X.Y?a.stepSize:null)},callback:A,includeBounds:!1,...l,font:{size:Zt}}};return{display:!0,type:a.chartScaleType,position:o.position,beginAtZero:a.beginAtZero,reverse:t===X.Y?a.reverse:!1,suggestedMax:a.suggestedMax,suggestedMin:a.suggestedMin,min:(i==null?void 0:i.min)??((g=(h=a==null?void 0:a.range)==null?void 0:h[t])==null?void 0:g.min),max:(i==null?void 0:i.max)??((b=(_=a==null?void 0:a.range)==null?void 0:_[t])==null?void 0:b.max),title:{display:(T=o.label)==null?void 0:T.length,text:o.label,padding:0},ticks:c(),grid:{...o.gridLines}}},ct=(e,t,n)=>e.axes[t].reduce((o,i,l)=>{const a=i;a.color=i.color||Q[l]||De(Q),a.position=i.position||Wt(t,l);const c=ke(e,t,n,a,l),u=jt(t,l,!0);return{...o,[u]:c}},{}),nr=(e,t)=>{var i,l;const n=((i=e.axes.x)==null?void 0:i.length)>1,s=((l=e.axes.y)==null?void 0:l.length)>1,r=n?ct(e,X.X,t):{x:ke(e,X.X,t)},o=s?ct(e,X.Y,t):{y:ke(e,X.Y,t)};return{...r,...o}},sr=e=>{var n;if(!Array.isArray(e)||!(e!=null&&e.length))return!1;const t=e==null?void 0:e.reduce((s,r)=>{var a,c,u,f;const o=(r==null?void 0:r.xAxisID)??"defaultX",i=(r==null?void 0:r.yAxisID)??"defaultY",l=(r==null?void 0:r.data)??[];if(l&&(l!=null&&l.length)){const{x:h,y:g}=(l==null?void 0:l[0])??{},{x:_=0,y:b=0}=(l==null?void 0:l.at(-1))??{},T=((a=s==null?void 0:s[o])==null?void 0:a.xFirst)??h,d=((c=s==null?void 0:s[o])==null?void 0:c.xLast)??_,A=((u=s==null?void 0:s[i])==null?void 0:u.yFirst)??g,m=((f=s==null?void 0:s[i])==null?void 0:f.yLast)??b,x=Math.min(h,T),y=Math.max(_,d),L=Math.min(g,A),E=Math.max(b,m);s={...s,[o]:{...s[o],xFirst:x,xLast:y},[i]:{yFirst:L,yLast:E}}}return s},{});return(n=Object.values(t))==null?void 0:n.some(({xFirst:s,xLast:r,yFirst:o,yLast:i})=>le(s,r,{absoluteDiff:ie})||le(o,i,{absoluteDiff:ie}))},dt=.05,rr={min:-1,max:1},or=({data:e,beginAtZero:t=!1,autoAxisPadding:n=!1})=>{const s=Math.min(...e.filter(g=>g!=null&&!isNaN(g))),r=Math.max(...e.filter(g=>g!=null&&!isNaN(g))),o=Math.sign(s)===-1||Math.sign(r)===-1,i=le(s,0,{absoluteDiff:ie})&&le(r,0,{absoluteDiff:ie});if(!(e!=null&&e.length)||i)return rr;if(le(s,r,{absoluteDiff:ie})){const g=r,_=g*dt,b=t&&!o?0:g-_,T=t&&o?0:g+_,d=ee(T,fe),A=ee(b,fe);return{min:d<0?d:A,max:A<0?A:d}}if(!n)return{min:void 0,max:void 0};const l=s===0||r===0||t,a=Math.sign(s)===-1&&Math.sign(r)===1,c=Math.abs(r-s),u=n?c*dt:0,f=!a&&l&&t&&!o?0:s-u,h=!a&&l&&t&&o?0:r+u;return{min:ee(f,fe),max:ee(h,fe)}},lr=(e,t,n)=>{var o;if(!e||!t)return{};const s=((o=e==null?void 0:e.current)==null?void 0:o.getSortedVisibleDatasetMetas())??[],r=Rt(n);return s&&(t==null?void 0:t.reduce((i,l)=>{const a=s.filter(c=>Object.values(c).includes(l)).flatMap(c=>c._parsed).map(c=>c[Gs(l)]).concat((r==null?void 0:r[l])??[]);return{...i,[l]:[...new Set(a)]}},{}))},ft=(e,t)=>!S.isNil(e)||!S.isNil(t),ir=(e,t,n,s)=>{const{additionalAxesOptions:r,annotations:{annotationsData:o=[],controlAnnotation:i=!1}={}}=e||{},l=nr(e,t)||{},a=i?n.filter(({isAnnotation:h})=>!h):n;if(!(r!=null&&r.autoAxisPadding)&&!sr(a))return l;const c=Object.keys(l)??[],u=lr(s,c,o);return(u&&(c==null?void 0:c.reduce((h,g)=>{const _=l[g],{min:b=void 0,max:T=void 0}=_,{min:d,max:A}=Bt(s,g,o)??{},{min:m,max:x}=or({data:u[g],beginAtZero:r==null?void 0:r.beginAtZero,autoAxisPadding:r==null?void 0:r.autoAxisPadding}),y={[g]:{..._,min:b??(ft(b,T)?d:m),max:T??(ft(b,T)?A:x)}};return{...h,...y}},{})))??l},ar=(e,t,n,s,r)=>{const i=e??0,l=t??0,a=n??0,c=s??0,u=r??0,f=i-100<=a,h=i+100>=c,g=i+100>=a&&i+100<c&&l+100>=u;return{overLeftSide:f,overRightSide:h,overBottomSide:g}},ur=e=>{var f;const{chart:t,dataIndex:n=0,datasetIndex:s=0}=e,{chartArea:r}=t,{left:o=null,right:i=null,bottom:l=null}=r,a=t==null?void 0:t.getDatasetMeta(s),{x:c=null,y:u=null}=((f=a==null?void 0:a.data)==null?void 0:f[n])||{};return{x:c,y:u,left:o,right:i,bottom:l}},cr=()=>e=>{const{x:t,y:n,left:s,right:r,bottom:o}=ur(e),{overLeftSide:i=!1,overRightSide:l=!1,overBottomSide:a=!1}=ar(t,n,s,r,o);return i&&F.Right||l&&F.Left||a&&F.End||F.Start},dr=e=>e.graph.showDataLabels?{display:Ne,align:cr(),formatter:(t,n)=>{var r,o;const s=(o=(r=n==null?void 0:n.dataset)==null?void 0:r.data)==null?void 0:o[n==null?void 0:n.dataIndex];return s&&typeof(s==null?void 0:s.label)=="string"?s==null?void 0:s.label:""}}:{display:!1},fr=e=>{const t=e==null?void 0:e.match(/\[(.*)\]/g);return t&&(t==null?void 0:t.length)>0?t==null?void 0:t[0]:""},gt=(e,t)=>{let n={};return t?(Math.abs(e)<Hn||Math.abs(e)>Un)&&(n={roundScientificCoefficient:3}):n={scientific:!1},nn(sn(e),n)},gr=e=>{const{scientificNotation:t}=e.tooltip,n=({xAxisID:o="",yAxisID:i=""})=>{var f,h,g;const l=(o==null?void 0:o.length)>1?Number(o[1])-1:0,a=(i==null?void 0:i.length)>1?Number(i[1])-1:0,c=e.axes.x[l],u=e.axes.y[a];return((g=(h=(f=e==null?void 0:e.axes)==null?void 0:f.x)==null?void 0:h[0])==null?void 0:g.position)===oe.Top?{titleAxisLabel:(u==null?void 0:u.label)||"",valueAxisLabel:(c==null?void 0:c.label)||"",titleLabel:Z.Y,valueLabel:Z.X}:{titleAxisLabel:(c==null?void 0:c.label)||"",valueAxisLabel:(u==null?void 0:u.label)||"",titleLabel:Z.X,valueLabel:Z.Y}},s=o=>{const i=n(o[0].dataset),{titleLabel:l,titleAxisLabel:a}=i??{},c=l===Z.Y?o[0].parsed.y:o[0].parsed.x;return`${gt(c,t)} ${a}`},r=o=>{const{showLabelsInTooltips:i}=e.tooltip;let l=o.dataset.label||"";const a=n(o.dataset),{valueLabel:c="",valueAxisLabel:u=""}=a??{},h=(()=>{const b=c===Z.X?o.parsed.x:o.parsed.y;return gt(b,t)})(),g=fr(u),_=tn(o,i);return`${l}: ${h} ${g} ${_}`};return{enabled:e.tooltip.tooltips,mode:ge.Nearest,intersect:!0,padding:en,usePointStyle:!0,boxWidth:$e,boxHeight:$e,boxPadding:Qt,callbacks:{title:s,label:r,afterLabel:Jt}}},mr=({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r})=>{const{interactions:{onAnimationComplete:o},annotations:{labelAnnotation:{showLabel:i,text:l,position:a,fontSize:c,xOffset:u,yOffset:f,maxWidth:h,lineHeight:g}={}},chartStyling:{layoutPadding:_}}=n,{enableDragPoints:b,zoomEnabled:T,panEnabled:d,lineEnabled:A}=t,[m,x]=O.useState(null),{updateAxesRangesFromChart:y,onHover:L}=Xe({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r}),{legend:E,customLegendPlugin:C}=Yn({chartRef:e,options:n})??{},{state:P}=qn()??{},{annotation:N}=P??{},D=dr(n),w=gr(n),W=O.useMemo(()=>ir(n,t,r,e),[n,t,r,e]),G=O.useMemo(()=>b&&rs(n),[b,n]),se=O.useMemo(()=>({enabled:d,mode:J.XY,onPanComplete(){y()}}),[d]),z=O.useMemo(()=>({mode:J.XY,drag:{enabled:T,threshold:3,backgroundColor:Wn,borderColor:Ze,borderWidth:1},onZoomComplete(){y()}}),[T]),R={datalabels:D,annotationDraggerPlugin:{enabled:t==null?void 0:t.enableDragAnnotation},annotation:$n(N),zoom:{pan:se,zoom:z},tooltip:w,legend:{...E,display:!1,events:[]},customLegendPlugin:C,chartAreaBorder:{borderColor:Ze},chartAreaText:{showLabel:i,text:l,position:a,fontSize:c,xOffset:u,yOffset:f,maxWidth:h,lineHeight:g},...G};return O.useMemo(()=>{var $,B,V;return{layout:{padding:_},onHover:L(m,x,r),maintainAspectRatio:($=n==null?void 0:n.chartStyling)==null?void 0:$.maintainAspectRatio,aspectRatio:(B=n==null?void 0:n.chartStyling)!=null&&B.squareAspectRatio?1:0,animation:(V=n==null?void 0:n.chartStyling)!=null&&V.performanceMode?!1:{duration:on.FAST,onComplete:o},hover:{mode:ge.Nearest,intersect:!0},elements:{line:{pointStyle:rn.Circle,showLine:A,tension:0}},scales:W,plugins:R,events:Object.values(ln)}},[t,n,e,r])},br=({options:e,resetZoom:t})=>{const{graph:n,legend:s}=e,r=O.useCallback(S.debounce(()=>{t()},100),[t]),o=O.useCallback((i,l)=>{const{event:a}=l;a.type===Zn&&r()},[r]);return O.useMemo(()=>[...an(n,s),{id:"customEventCatcher",beforeEvent:o}],[o])},pr=1,hr=(e,t)=>{var n,s;O.useEffect(()=>{var r,o;if((o=(r=t==null?void 0:t.legend)==null?void 0:r.customLegend)!=null&&o.customLegendPlugin){const i=document.getElementById(t.legend.customLegend.customLegendContainerID);i!==null&&(i.style.visibility=e.legendEnabled?"visible":"hidden")}},[(s=(n=t==null?void 0:t.legend)==null?void 0:n.customLegend)==null?void 0:s.customLegendPlugin,e.legendEnabled])},yr=(e,t)=>{O.useEffect(()=>{Ss(e,t)},[e.panEnabled,e.lineEnabled,e.pointsEnabled,e.legendEnabled,e.enableDragPoints,e.zoomEnabled])},xr=({chartRef:e,range:t,state:n,dispatch:s,annotationsData:r})=>{const o=O.useRef(n.axes);O.useEffect(()=>{if(t&&Rs(t)){const i=Object.entries(t).map(([a,{min:c,max:u}])=>{const{min:f=void 0,max:h=void 0}=Bt(e,a,r)??{};let g=c??f,_=u??h;return g===_&&(_+=pr),{id:a,min:g,max:_}}),l=[...o.current??[]].map(a=>{const c=i.find(u=>u.id===a.id);return c?{...a,...c}:a});pt(l,o.current)||(s({type:ye,payload:{axes:l}}),o.current=l)}},[t])},_r=({chartRef:e,options:t,state:n,dispatch:s,persistenceId:r})=>{const o=O.useMemo(()=>n,[n]),i=O.useMemo(()=>t,[t]),{additionalAxesOptions:{range:l=void 0},annotations:{annotationsData:a=[]}={}}=i;yr(o,r),hr(o,i),xr({range:l,state:o,dispatch:s,chartRef:e,annotationsData:a})},xe=" ",Tr="rgba(0, 0, 0, 0.5)",Er=e=>(Array.isArray(e)?e.join(xe):e).split(xe),Ar=({ctx:e,lines:t,lineHeight:n,x:s,y:r,position:o})=>{t.forEach((i,l)=>{const a=o.includes("top")?r+n*(l+1)-5:r-(t.length-1-l)*n;e.fillText(i,s,a)})},Lr=(e,t)=>{const r=t<500?.5:t<700?.7:1;return e*r},Or=e=>{const{legend:t}=e,n=t&&t.display&&t.options.position==="left"?t.width+t.options.labels.padding*2:0,s=t&&t.display&&(t.options.position==="top"||t.options.position==="bottom")?t.height+t.options.labels.padding*2:0;return{legendWidth:n,legendHeight:s}},Sr=(e,t,n,s)=>{const{chartArea:r,width:o}=t,i=o-8,{legendWidth:l,legendHeight:a}=Or(t);switch(e){case j.TOP_LEFT:return[r.left+n+l,r.top+s+a];case j.TOP_CENTER:return[r.left+r.width/2,r.top+s+a];case j.TOP_RIGHT:return[i-n,r.top+s+a];case j.MIDDLE_LEFT:return[r.left+n+l,r.top+r.height/2];case j.MIDDLE_CENTER:return[r.left+r.width/2,r.top+r.height/2];case j.MIDDLE_RIGHT:return[i-n-l,r.top+r.height/2];case j.BOTTOM_LEFT:return[r.left+n+l,r.bottom-s-a];case j.BOTTOM_CENTER:return[r.left+r.width/2,r.bottom-s-a];case j.BOTTOM_RIGHT:default:return[i-n-l,r.bottom-s-a]}},Cr=e=>e.includes(F.Center)?F.Center:e.includes(F.Left)?F.Left:F.Right,Pr=(e,t,n)=>{let s="",r=[];for(let o=0;o<e.length;o++){const i=`${s}${e[o]}${xe}`,{width:l}=n.measureText(i);l>t?(r.push(s.trim()),s=`${e[o]}${xe}`):s=i}return r.push(s.trim()),r},Dr=(e,t)=>{const{text:n,maxWidth:s,fontSize:r,lineHeight:o,x:i,y:l,position:a}=t,c=Er(n),u=Pr(c,s,e);e.save(),e.font=`${r}px Arial`,e.fillStyle=Tr,e.textAlign=Cr(a),Ar({ctx:e,lines:u,lineHeight:o,x:i,y:l,position:a}),e.restore()},Nr={id:"chartAreaText",beforeDraw:(e,t,n)=>{const{showLabel:s,text:r,fontSize:o,xOffset:i,yOffset:l,lineHeight:a,maxWidth:c,position:u}=n;if(!s||!r)return;const{ctx:f,chartArea:h}=e,g=Lr(c,h.width),[_,b]=Sr(u,e,i,l);Dr(f,{text:r,maxWidth:g,fontSize:o,lineHeight:a,x:_,y:b,position:u})}},Vt=(e,t,n,s,r)=>{const o=t.getBoundingClientRect(),i=e.clientX-o.left,l=e.clientY-o.top,a=n[s],c=n[r],u=(a==null?void 0:a.getValueForPixel(i))??-1,f=(c==null?void 0:c.getValueForPixel(l))??-1;return{x:u,y:f}},_e=e=>{const{xMin:t,xMax:n,yMin:s,yMax:r,xValue:o,yValue:i,type:l}=e??{};let a,c,u,f;return!S.isNil(t)&&!S.isNil(n)&&!S.isNil(s)&&!S.isNil(r)&&l===k.BOX?(a=(t+n)/2,c=(s+r)/2,u=n-t,f=r-s):!S.isNil(o)&&!S.isNil(i)&&l===k.POINT&&(a=o,c=i,u=0,f=0),{centerX:a,centerY:c,width:u,height:f}},Xt=(e,t,n,s)=>{const{xMin:r,xMax:o,yMin:i,yMax:l,xValue:a,yValue:c,type:u}=e??{};let f,h,g,_;const b=t[n],T=t[s];if(!S.isNil(r)&&!S.isNil(o)&&!S.isNil(i)&&!S.isNil(l)&&u===k.BOX){const d=(r+o)/2,A=(i+l)/2,m=(b==null?void 0:b.getPixelForValue(r))??0,x=(b==null?void 0:b.getPixelForValue(o))??0,y=(T==null?void 0:T.getPixelForValue(i))??0,L=(T==null?void 0:T.getPixelForValue(l))??0;g=m-x,_=y-L,f=(b==null?void 0:b.getPixelForValue(d))??-1,h=(T==null?void 0:T.getPixelForValue(A))??-1}else!S.isNil(a)&&!S.isNil(c)&&u===k.POINT&&(g=0,_=0,f=(b==null?void 0:b.getPixelForValue(a))??-1,h=(T==null?void 0:T.getPixelForValue(c))??-1);return{centerX:f,centerY:h,width:g,height:_}},wr=({x:e,y:t,chartArea:n,scales:s,metrics:r,resizable:o=!1,dragRange:i,annotationType:l,xScaleID:a,yScaleID:c})=>{if(o&&!i)return!0;if(i){const T=e!==void 0&&i.x?e>=i.x[0]&&e<=i.x[1]:!0,d=t!==void 0&&i.y?t>=i.y[0]&&t<=i.y[1]:!0;return T&&d}const u=s[a],f=s[c],h=(u==null?void 0:u.getValueForPixel(n.left))??Number.NEGATIVE_INFINITY,g=(u==null?void 0:u.getValueForPixel(n.right))??Number.POSITIVE_INFINITY,_=(f==null?void 0:f.getValueForPixel(n.bottom))??Number.NEGATIVE_INFINITY,b=(f==null?void 0:f.getValueForPixel(n.top))??Number.POSITIVE_INFINITY;if(l===k.POINT){const T=e!==void 0?e>=h&&e<=g:!0,d=t!==void 0?t>=_&&t<=b:!0;return T&&d}if(l===k.BOX&&r.width!==void 0&&r.height!==void 0){const T=e!==void 0?e-r.width/2:void 0,d=e!==void 0?e+r.width/2:void 0,A=t!==void 0?t-r.height/2:void 0,m=t!==void 0?t+r.height/2:void 0,x=T!==void 0&&d!==void 0?T>=h&&d<=g:!0,y=A!==void 0&&m!==void 0?A>=_&&m<=b:!0;return x&&y}return!0},mt=(e,t,n,s,r,o,i,l)=>{const{resizable:a,dragRange:c=null}=n??{};wr({[e]:t,chartArea:s.chartArea,scales:r,resizable:a,dragRange:c,metrics:l||{},annotationType:n.type,xScaleID:o,yScaleID:i})&&(n.type===k.POINT?e==="x"?n.xValue=t:e==="y"&&(n.yValue=t):n.type===k.BOX&&l&&(e==="x"&&l.width&&(n.xMin=t-l.width/2,n.xMax=t+l.width/2),e==="y"&&l.height&&(n.yMin=t-l.height/2,n.yMax=t+l.height/2)))},Ht=(e,t,n)=>{var r,o,i;if(!t)return;const s=(i=(o=(r=e==null?void 0:e.options)==null?void 0:r.plugins)==null?void 0:o.annotation)==null?void 0:i.annotations;s&&t&&s[t]&&(s[t].borderWidth=n)},Mr=(e,t,n,s,r,o)=>{const i=o?s==null?void 0:s[o]:null;if(!i)return;const{xScaleID:l="x",yScaleID:a="y"}=i,{x:c,y:u}=Vt(e,t,n,l,a),f=_e(i);if(i&&i.enableDrag&&!S.isNil(f.centerY)&&!S.isNil(f.centerX)){!S.isNil(t)&&!S.isNil(t.style)&&(t.style.cursor=ze.Move);const h=c-f.centerX,g=u-f.centerY;r(!0,i,h,g),i!=null&&i.onDragStart&&i.onDragStart({x:c,y:u},i)}},Ir=(e,t,n,s,r,o,i,l)=>{if(s&&r){!S.isNil(t)&&!S.isNil(t.style)&&(t.style.cursor=ze.Move);const a=r==null?void 0:r.id;Ht(l,a,Ge.HOVERED);const c=(r==null?void 0:r.dragAxis)??re.Both,{xScaleID:u="x",yScaleID:f="y"}=r,{x:h,y:g}=Vt(e,t,n,u,f),_=_e(r);let b=h-o,T=g-i;c!==re.Y&&mt(re.X,b,r,l,n,u,f,_),c!==re.X&&mt(re.Y,T,r,l,n,u,f,_),l.update(),r!=null&&r.onDrag&&r.onDrag({x:h,y:g},r);const{ctx:d,width:A,height:m}=l,{centerX:x,centerY:y}=_e(r)??{},{centerX:L,centerY:E}=Xt(r,n,u,f);if(!S.isNil(x)&&!S.isNil(y)&&!S.isNil(L)&&!S.isNil(E)&&(d.save(),d.clearRect(0,0,A,m),l.draw(),d.font=un,d.fillStyle="black",r!=null&&r.displayDragCoordinates)){let C=L-45,P=E-20;const N=`X: ${ee(x,2)}, Y: ${ee(y,2)}`,D=14;P-D<0&&(P=E+D+15),P>m&&(P=m-7),d.fillText(N,C,P),d.restore()}}},vr=(e,t,n,s,r)=>{if(e&&t){const o=t==null?void 0:t.id;Ht(n,o,Ge.ZERO);const{centerX:i=-1,centerY:l=-1}=_e(t)??{};S.isNil(t==null?void 0:t.onDragEnd)||t==null||t.onDragEnd({x:i,y:l},t),!S.isNil(s)&&!S.isNil(s.style)&&(s.style.cursor=ze.Pointer),r(!1,null)}},jr=(e,t,n)=>{Object.values(t).forEach(s=>{var r;if(s.type===k.POINT&&!S.isNil(s==null?void 0:s.label)&&((r=s==null?void 0:s.label)!=null&&r.display)){const{content:o,font:i,color:l,position:a,padding:c}=(s==null?void 0:s.label)??{},{xScaleID:u="x",yScaleID:f="y"}=s;e.save(),e.font=i,e.fillStyle=l;const{centerX:h=-1,centerY:g=-1}=Xt(s,n,u,f),_=e.measureText(o).width;let b=h-_/2,T=g+20;switch(a){case oe.Top:T=g-20;break;case oe.Left:b=h-_-c,T=g;break;case oe.Right:b=h+c,T=g;break}e.fillText(o,b,T),e.restore()}})},Fr={id:"annotationDraggerPlugin",beforeDraw(e){var s,r,o,i,l,a,c,u;let t=((r=(s=e.options.plugins)==null?void 0:s.annotation)==null?void 0:r.annotations)??{};if(!t)return;jr(e.ctx,t,e.scales),(((i=(o=e==null?void 0:e.options)==null?void 0:o.plugins)==null?void 0:i.annotationDraggerPlugin)||{enabled:!1}).enabled?((a=(l=e==null?void 0:e.options)==null?void 0:l.plugins)!=null&&a.tooltip&&(e.options.plugins.tooltip.enabled=!1),e.options.hover={mode:void 0,intersect:!1}):((u=(c=e==null?void 0:e.options)==null?void 0:c.plugins)!=null&&u.tooltip&&(e.options.plugins.tooltip.enabled=!0),e.options.hover={mode:ge.Nearest,intersect:!0})},afterUpdate(e){var h,g,_,b,T,d,A,m;const{canvas:t,scales:n,hoveredAnnotationId:s}=e??{},r=((g=(h=e==null?void 0:e.options)==null?void 0:h.plugins)==null?void 0:g.annotationDraggerPlugin)||{enabled:!1},o={...n,x:n.x,y:n.y};let i=((b=(_=e.options.plugins)==null?void 0:_.annotation)==null?void 0:b.annotations)??{};if(!e&&!i)return;r.enabled?((d=(T=e==null?void 0:e.options)==null?void 0:T.plugins)!=null&&d.tooltip&&(e.options.plugins.tooltip.enabled=!1),e.options.hover={mode:void 0,intersect:!1}):((m=(A=e==null?void 0:e.options)==null?void 0:A.plugins)!=null&&m.tooltip&&(e.options.plugins.tooltip.enabled=!0),e.options.hover={mode:ge.Nearest,intersect:!0});let l=!1,a,c,u=null;const f=(x,y,L,E)=>{l=x,u=y,L!==void 0&&E!==void 0&&(a=L,c=E)};!t.dataset.annotationDraggerInitialized&&r.enabled&&s&&(t.addEventListener(K.MOUSEDOWN,x=>{var y,L,E;Mr(x,t,o,(E=(L=(y=e==null?void 0:e.options)==null?void 0:y.plugins)==null?void 0:L.annotation)==null?void 0:E.annotations,f,e.hoveredAnnotationId)}),t.addEventListener(K.MOUSEMOVE,x=>{S.debounce(()=>Ir(x,t,o,l,u,a,c,e),5)()}),t.addEventListener(K.MOUSEUP,x=>{const y=x.currentTarget;vr(l,u,e,y,f)}),t.dataset.annotationDraggerInitialized="true"),r.enabled||(t.removeEventListener(K.MOUSEDOWN,()=>{}),t.removeEventListener(K.MOUSEMOVE,()=>{}),t.removeEventListener(K.MOUSEUP,()=>{}),t.dataset.annotationDraggerInitialized="")}};mn.register(bn,pn,hn,yn,xn,_n,Tn,En,An,Ln,On,ts,Nr,Fr);const kr=e=>{var N,D;dn();const t=O.useRef(null),{table:n,headerComponent:s,subheaderComponent:r}=e??{},{translations:o,languageKey:i}=os(),l=Gt(e),{data:{datasets:a}={datasets:[]},options:c,testId:u,persistenceId:f,controlsPortalId:h}=l,{annotations:g,axes:_,chartStyling:b,graph:T}=c??{},d=!((D=(N=c==null?void 0:c.legend)==null?void 0:N.customLegend)!=null&&D.customLegendContainerID),[A,m]=O.useReducer(As,{options:c,persistenceId:f,chartRef:t},Cs),x=O.useMemo(()=>tr(a,A,c,o),[A.lineEnabled,A.pointsEnabled,a,_,g,T]);_r({chartRef:t,options:c,state:A,dispatch:m,persistenceId:f});const{resetZoom:y,handleKeyDown:L,handleKeyUp:E}=Xe({chartRef:t,state:A,options:c,dispatch:m,generatedDatasets:x}),C=mr({chartRef:t,state:A,options:c,dispatch:m,generatedDatasets:x}),P=br({options:c,resetZoom:y});return p.jsxs("div",{className:fn(b,Se),style:{width:b.width||Ne,height:b.height||Ne},tabIndex:0,onKeyDown:L,onKeyUp:E,"data-testid":u,children:[p.jsx(kt,{table:n,headerComponent:s,subheaderComponent:r,chartRef:t,state:A,options:c,dispatch:m,generatedDatasets:x,translations:o,controlsPortalId:h}),n&&A.showTable?p.jsx("div",{className:Se.table,children:n}):p.jsx(Kn,{backend:Jn,context:window,children:p.jsxs("div",{className:Se.canvas,id:"canvas",children:[p.jsx(gn,{ref:t,data:{datasets:x},options:C,plugins:P}),d&&!!x.length&&p.jsx(Qn,{chartRef:t,legendConfig:{options:c,generatedDatasets:x,chartType:es.LINE}})]})})]},zs([...Object.values(A),i]))},Gr=e=>{const{options:t}=Gt(e);return p.jsx(cn,{options:t,children:p.jsx(kr,{...e})})};Gr.__docgenInfo={description:"",methods:[],displayName:"LineChartWithLegend",props:{chart:{required:!0,tsType:{name:"ILineChartData"},description:""},table:{required:!1,tsType:{name:"ReactNode"},description:""},headerComponent:{required:!1,tsType:{name:"ReactNode"},description:""},subheaderComponent:{required:!1,tsType:{name:"ReactNode"},description:""}}};export{Gr as L,Ur as i};
|