@oliasoft-open-source/charts-library 5.0.3 → 5.0.4

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.
@@ -0,0 +1 @@
1
+ import{j as p}from"./jsx-runtime-Y5Ju2SGo.js";import{r as O}from"./index-eCxJ45ll.js";import{$ as Ht,a0 as Ze,a1 as J,x as V,a2 as qt,v as P,A as F,P as le,C as Q,a3 as Re,a4 as Wt,g as Ne,N as $t,S as Zt,y as Kt,O as Jt,a5 as ie,a6 as ae,Q as ee,a7 as ge,E as Me,R as Qt,T as en,L as Ke,a as tn,U as be,V as nn,W as Z,d as sn,r as rn,B as Je,a8 as on,f as ln,a9 as an,I as un,aa as k,ab as Ue,ac as oe,D as cn,ad as K,b as dn,s as fn,F as gn,ae as mn,h as bn,i as pn,J as hn,Y as yn,j as xn,k as _n,p as Tn,m as En,n as An,o as Ln,q as On,t as Cn}from"./legend-context-vqtlaWwg.js";import{r as Se,M as Ve,p as pe,B as X,s as Sn,v as Pn,w as Qe,x as Dn,y as wn,z as Nn,A as Mn,E as In,N as et,G as vn,S as jn,g as Fn,e as kn,F as Gn,T as ht,J as zn,K as Bn,D as Rn,O as Un,Q as Vn,k as Xn,q as Yn,U as Hn,u as qn,j as Wn,Z as $n,t as Zn,R as Kn,m as Jn,H as Qn,L as es,n as ts,o as ns}from"./legend-CD8XU7nW.js";import{c as ss,C as rs,f as tt,a as os,b as ls}from"./get-draggableData-DS0HhINp.js";import{e as yt}from"./index-B-BONL6g.js";const is="_chart_e3qdd_1",as="_canvas_e3qdd_11",us="_fixedHeight_e3qdd_20",cs="_stretchHeight_e3qdd_26",ds="_squareAspectRatio_e3qdd_32",fs="_table_e3qdd_62",Pe={chart:is,canvas:as,fixedHeight:us,stretchHeight:cs,squareAspectRatio:ds,table:fs};var xt=Symbol.for("immer-nothing"),nt=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 q(e){var t;return e?_t(e)||Array.isArray(e)||!!e[nt]||!!((t=e.constructor)!=null&&t[nt])||Le(e)||Oe(e):!1}var gs=Object.prototype.constructor.toString();function _t(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)===gs}function he(e,t){Ae(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,s)=>t(s,n,e))}function Ae(e){const t=e[M];return t?t.type_:Array.isArray(e)?1:Le(e)?2:Oe(e)?3:0}function Ie(e,t){return Ae(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tt(e,t,n){const s=Ae(e);s===2?e.set(t,n):s===3?e.add(n):e[t]=n}function ms(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Le(e){return e instanceof Map}function Oe(e){return e instanceof Set}function H(e){return e.copy_||e.base_}function ve(e,t){if(Le(e))return new Map(e);if(Oe(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=_t(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 l=r[o],i=s[l];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(s[l]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[l]})}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 Xe(e,t=!1){return Ce(e)||ne(e)||!q(e)||(Ae(e)>1&&(e.set=e.add=e.clear=e.delete=bs),Object.freeze(e),t&&Object.entries(e).forEach(([n,s])=>Xe(s,!0))),e}function bs(){v(2)}function Ce(e){return Object.isFrozen(e)}var ps={};function W(e){const t=ps[e];return t||v(0,e),t}var ue;function Et(){return ue}function hs(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function st(e,t){t&&(W("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function je(e){Fe(e),e.drafts_.forEach(ys),e.drafts_=null}function Fe(e){e===ue&&(ue=e.parent_)}function rt(e){return ue=hs(ue,e)}function ys(e){const t=e[M];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ot(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[M].modified_&&(je(t),v(4)),q(e)&&(e=ye(t,e),t.parent_||xe(t,e)),t.patches_&&W("Patches").generateReplacementPatches_(n[M].base_,e,t.patches_,t.inversePatches_)):e=ye(t,n,[]),je(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==xt?e:void 0}function ye(e,t,n){if(Ce(t))return t;const s=t[M];if(!s)return he(t,(r,o)=>lt(e,s,t,r,o,n)),t;if(s.scope_!==e)return t;if(!s.modified_)return xe(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let o=r,l=!1;s.type_===3&&(o=new Set(r),r.clear(),l=!0),he(o,(i,a)=>lt(e,s,r,i,a,n,l)),xe(e,r,!1),n&&e.patches_&&W("Patches").generatePatches_(s,n,e.patches_,e.inversePatches_)}return s.copy_}function lt(e,t,n,s,r,o,l){if(ne(r)){const i=o&&t&&t.type_!==3&&!Ie(t.assigned_,s)?o.concat(s):void 0,a=ye(e,r,i);if(Tt(n,s,a),ne(a))e.canAutoFreeze_=!1;else return}else l&&n.add(r);if(q(r)&&!Ce(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ye(e,r),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&xe(e,r)}}function xe(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xe(t,n)}function xs(e,t){const n=Array.isArray(e),s={type_:n?1:0,scope_:t?t.scope_:Et(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,o=Ye;n&&(r=[s],o=ce);const{revoke:l,proxy:i}=Proxy.revocable(r,o);return s.draft_=i,s.revoke_=l,i}var Ye={get(e,t){if(t===M)return e;const n=H(e);if(!Ie(n,t))return _s(e,n,t);const s=n[t];return e.finalized_||!q(s)?s:s===De(e.base_,t)?(we(e),e.copy_[t]=Ge(s,e)):s},has(e,t){return t in H(e)},ownKeys(e){return Reflect.ownKeys(H(e))},set(e,t,n){const s=At(H(e),t);if(s!=null&&s.set)return s.set.call(e.draft_,n),!0;if(!e.modified_){const r=De(H(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(ms(n,r)&&(n!==void 0||Ie(e.base_,t)))return!0;we(e),ke(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 De(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,we(e),ke(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=H(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)}},ce={};he(Ye,(e,t)=>{ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});ce.deleteProperty=function(e,t){return ce.set.call(this,e,t,void 0)};ce.set=function(e,t,n){return Ye.set.call(this,e[0],t,n,e[0])};function De(e,t){const n=e[M];return(n?H(n):e)[t]}function _s(e,t,n){var r;const s=At(t,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(e.draft_):void 0}function At(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 ke(e){e.modified_||(e.modified_=!0,e.parent_&&ke(e.parent_))}function we(e){e.copy_||(e.copy_=ve(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ts=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 l=this;return function(a=o,...c){return l.produce(a,u=>n.call(this,u,...c))}}typeof n!="function"&&v(6),s!==void 0&&typeof s!="function"&&v(7);let r;if(q(t)){const o=rt(this),l=Ge(t,void 0);let i=!0;try{r=n(l),i=!1}finally{i?je(o):Fe(o)}return st(o,s),ot(r,o)}else if(!t||typeof t!="object"){if(r=n(t),r===void 0&&(r=t),r===xt&&(r=void 0),this.autoFreeze_&&Xe(r,!0),s){const o=[],l=[];W("Patches").generateReplacementPatches_(t,r,o,l),s(o,l)}return r}else v(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(l,...i)=>this.produceWithPatches(l,a=>t(a,...i));let s,r;return[this.produce(t,n,(l,i)=>{s=l,r=i}),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){q(e)||v(8),ne(e)&&(e=Es(e));const t=rt(this),n=Ge(e,void 0);return n[M].isManual_=!0,Fe(t),n}finishDraft(e,t){const n=e&&e[M];(!n||!n.isManual_)&&v(9);const{scope_:s}=n;return st(s,t),ot(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=W("Patches").applyPatches_;return ne(e)?s(e,t):this.produce(e,r=>s(r,t))}};function Ge(e,t){const n=Le(e)?W("MapSet").proxyMap_(e,t):Oe(e)?W("MapSet").proxySet_(e,t):xs(e,t);return(t?t.scope_:Et()).drafts_.push(n),n}function Es(e){return ne(e)||v(10,e),Lt(e)}function Lt(e){if(!q(e)||Ce(e))return e;const t=e[M];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ve(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ve(e,!0);return he(n,(s,r)=>{Tt(n,s,Lt(r))}),t&&(t.finalized_=!1),n}var I=new Ts,As=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 Ot="TOGGLE_ZOOM",Ct="TOGGLE_PAN",St="TOGGLE_POINTS",Pt="TOGGLE_LINE",Dt="TOGGLE_LEGEND",wt="TOGGLE_TABLE",ze="RESET_AXES_RANGES",_e="UPDATE_AXES_RANGES",Nt="TOGGLE_DRAG_POINTS",Mt="TOGGLE_DRAG_ANNOTATION",It="DISABLE_DRAG_OPTIONS",me="UPDATE_EDITED",Ls=(e,t)=>As(e,n=>{switch(t.type){case Ot:{n.zoomEnabled=!n.zoomEnabled,n.panEnabled&&(n.panEnabled=!1),n.enableDragPoints&&(n.enableDragPoints=!1),n.enableDragAnnotation&&(n.enableDragAnnotation=!1);break}case Ct:{n.panEnabled=!n.panEnabled,n.zoomEnabled&&(n.zoomEnabled=!1),n.enableDragPoints&&(n.enableDragPoints=!1),n.enableDragAnnotation&&(n.enableDragAnnotation=!1);break}case St:{n.pointsEnabled=!n.pointsEnabled;break}case Pt:{n.lineEnabled=!n.lineEnabled;break}case Dt:{n.legendEnabled=!n.legendEnabled;break}case wt:{n.showTable=!n.showTable;break}case _e:{const{axes:s}=t.payload;n.axes=s;break}case ze:{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 Mt:{n.enableDragAnnotation=!n.enableDragAnnotation,n.panEnabled&&(n.panEnabled=!1),n.zoomEnabled&&(n.zoomEnabled=!1);break}case It:{(n.enableDragAnnotation||n.enableDragPoints||n.panEnabled||n.zoomEnabled)&&(n.enableDragAnnotation=!1,n.enableDragPoints=!1,n.panEnabled=!1,n.zoomEnabled=!1);break}case me:{n.edited=t.payload;break}}}),Os=e=>{if(!e)return null;const t=`line-chart-state-${e}`,n=localStorage.getItem(t);return n?JSON.parse(n).state:null},Cs=(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 i=JSON.parse(o).timestamp;i&&t-i>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)),Cs()},Ps=({options:e,persistenceId:t})=>{const{chartOptions:{enableZoom:n,enablePan:s,showPoints:r,showLine:o,enableDragAnnotation:l},legend:{display:i},dragData:a}=e,{zoomEnabled:c,panEnabled:u,pointsEnabled:g,lineEnabled:h,legendEnabled:m,enableDragPoints:x,enableDragAnnotation:b}=Os(t)||{};return{zoomEnabled:l??b?!1:c??n,panEnabled:u??s,pointsEnabled:g??r,lineEnabled:h??o,legendEnabled:m??i,axes:[],showTable:!1,enableDragPoints:(a==null?void 0:a.enableDragData)&&x,enableDragAnnotation:l??b,edited:!1}},Ds=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"}))),ws=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 Ms({lineEnabled:e,onToggleLine:t,onTogglePoints:n,pointsEnabled:s,translations:r}){return[{type:"Option",label:r.pointsLines,icon:p.jsx(Se,{icon:p.jsx(Ns,{})}),selected:s&&e,onClick:()=>{s||n(),e||t()}},{type:"Option",label:r.linesOnly,icon:p.jsx(Se,{icon:p.jsx(Ds,{})}),selected:!s&&e,onClick:()=>{s&&n(),e||t()}},{type:"Option",label:r.pointsOnly,icon:p.jsx(Se,{icon:p.jsx(ws,{})}),selected:s&&!e,onClick:()=>{s||n(),e&&t()}}]}const vt=({options:e})=>{const[t,n]=O.useState(!1),s=e.find(r=>r.selected);return p.jsx(Ve,{open:t,setOpen:n,menu:{sections:e,trigger:"Component",component:p.jsx(pe,{display:"inline-flex",text:s==null?void 0:s.label,placement:"bottom-start",enabled:!t,children:p.jsx(X,{colored:"muted",basic:!0,small:!0,round:!0,icon:s==null?void 0:s.icon})})}})};vt.__docgenInfo={description:"",methods:[],displayName:"LineOptions",props:{options:{required:!0,tsType:{name:"Array",elements:[{name:"IMenuSection"}],raw:"IMenuSection[]"},description:""}}};function Is({onTogglePan:e,onToggleZoom:t,panEnabled:n,zoomEnabled:s,enableDragPoints:r,enableDragAnnotation:o,isDragDataAllowed:l,isDragAnnotationAllowed:i,onToggleDragAnnotation:a,onToggleDragPoints:c,onDisableDragOptions:u,translations:{dragToZoom:g,doubleClickToReset:h,dragToPan:m,dragToMovePoints:x,dragDisabled:b,dragToMoveAnnotation:_}}){return[{label:g,description:h,icon:p.jsx(Sn,{}),selected:s,type:"Option",onClick:()=>{s||t()}},{label:m,description:h,icon:p.jsx(Pn,{}),selected:n,type:"Option",onClick:()=>{n||e()}},...l?[{label:x,icon:p.jsx(Qe,{}),selected:r,type:"Option",onClick:()=>{r||c()}}]:[],...i?[{label:_,icon:p.jsx(Qe,{}),selected:o,type:"Option",onClick:()=>{o||a()}}]:[],{label:b,icon:p.jsx(Dn,{}),selected:!s&&!n&&!r&&!o,type:"Option",onClick:u}]}const jt=({options:e})=>{const t=e.find(n=>n.selected);return p.jsx(Ve,{menu:{sections:e,trigger:"Component",component:p.jsx(X,{colored:"muted",basic:!0,small:!0,label:t==null?void 0:t.label,icon:t==null?void 0:t.icon})}})};jt.__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 vs="_controls_1edjs_1",js="_buttons_1edjs_6",it={controls:vs,buttons:js},Fs=e=>{const t=O.useCallback(n=>()=>{e({type:n})},[e]);return{onToggleLegend:t(Dt),onToggleLine:t(Pt),onTogglePan:t(Ct),onTogglePoints:t(St),onToggleTable:t(wt),onToggleZoom:t(Ot),onToggleDragPoints:t(Nt),onToggleDragAnnotation:t(Mt),onDisableDragOptions:t(It)}},ks=(e,t)=>e===void 0||t===void 0||Number(e)<Number(t),Gs=(e,t)=>e===void 0||t===void 0||Number(e)>Number(t),Ft=(e,t=0,n=!1)=>{const s=n&&t!==0?t+1:"";return`${e}${s}`},zs=e=>{var t;return((t=e==null?void 0:e.match(/[^0-9/]+/gi))==null?void 0:t[0])??""},Bs=e=>e.join(""),Hr=e=>typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null,Rs=e=>e?Object.values(e).some(t=>!Ht(t)):!1,He=({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r})=>{const{interactions:{onHover:o,onUnhover:l},axes:i}=n,a=O.useCallback(()=>{var T,f;const d=e==null?void 0:e.current;d&&(t!=null&&t.edited)&&((T=d==null?void 0:d.resetZoom)==null||T.call(d),(f=d==null?void 0:d.reset)==null||f.call(d),s({type:ze,payload:{axes:[]}}),s({type:me,payload:!1}))},[e==null?void 0:e.current,s,t]),c=O.useCallback((d,T,f)=>(y,L)=>{var A,C;if(!(L!=null&&L.length)&&l&&d&&(T(null),l(y),(A=e==null?void 0:e.current)==null||A.update()),L!=null&&L.length&&o){const{index:S,datasetIndex:D}=L[0],N=f[D],w=N==null?void 0:N.data[S];w&&!yt(d,w)&&(T(w),o(y,D,S,f),(C=e==null?void 0:e.current)==null||C.update())}},[o,l,r]),u=O.useCallback(()=>ss(e,t),[e==null?void 0:e.current,t.axes]),g=O.useCallback(d=>{var T,f,y,L,A;if(d.key===Ze.Shift){const C=e.current,S=(y=(f=(T=C==null?void 0:C.config)==null?void 0:T.options)==null?void 0:f.plugins)==null?void 0:y.zoom;(L=S==null?void 0:S.zoom)!=null&&L.mode&&((A=S==null?void 0:S.pan)!=null&&A.mode)&&(S.zoom.mode=J.Y,S.pan.mode=J.Y,C==null||C.update())}},[e==null?void 0:e.current]),h=O.useCallback(d=>{var T,f,y,L,A;if(d.key===Ze.Shift){const C=e.current,S=(y=(f=(T=C==null?void 0:C.config)==null?void 0:T.options)==null?void 0:f.plugins)==null?void 0:y.zoom;(L=S==null?void 0:S.zoom)!=null&&L.mode&&((A=S==null?void 0:S.pan)!=null&&A.mode)&&(S.zoom.mode=J.XY,S.pan.mode=J.XY,C==null||C.update())}},[e==null?void 0:e.current]),m=O.useCallback(d=>{var f;if(!((f=Object.keys(d))!=null&&f.length))return[];const T=(y,L)=>{var A;return!y[L]||!((A=y[L])!=null&&A.length)?[]:y[L].map((C,S)=>({id:Ft(L,S,y[L].length>1),label:(C==null?void 0:C.label)||""}))};return[...T(d,V.X),...T(d,V.Y)]},[i]),x=O.useCallback(()=>{var f;const{scales:d={}}=(e==null?void 0:e.current)||{},T=(f=Object.entries(d))==null?void 0:f.map(([y,{min:L,max:A}])=>({id:y,min:L??0,max:A??0}));s({type:_e,payload:{axes:T}})},[i]),b=O.useCallback(()=>{var T,f;const d=e==null?void 0:e.current;d&&t.edited&&((T=d==null?void 0:d.resetZoom)==null||T.call(d),(f=d==null?void 0:d.reset)==null||f.call(d),s({type:ze,payload:{axes:[]}}),s({type:me,payload:!1}))},[e==null?void 0:e.current]),_=O.useCallback(({axes:d})=>{s({type:_e,payload:{axes:d}})},[]),E=O.useCallback(d=>{s({type:me,payload:d})},[t]);return{resetZoom:a,onHover:c,handleDownload:u,handleKeyDown:g,handleKeyUp:h,controlsAxesLabels:m(i),updateAxesRangesFromChart:x,onResetAxes:b,onUpdateAxes:_,onUpdateEdited:E}},at=(e,t,n)=>{const s=[];return qt(e)&&s.push("mustHaveAValue"),n==="min"&&!ks(e,t)?s.push("mustBeLessThanMax"):n==="max"&&!Gs(e,t)&&s.push("mustBeGreaterThanMin"),s},Us=e=>{const t=e.map(({id:s,min:r,max:o})=>({id:s,min:at(String(r),String(o),"min"),max:at(String(o),String(r),"max")})),n=t.every(s=>s.min.length===0&&s.max.length===0);return{errors:t,valid:n}},ut=1,ct=({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:l=""}])=>{var u;let i=Number(o),a=Number(l);isNaN(i)&&(i=0),isNaN(a)&&(a=i+ut),i===a&&(a+=ut);const{unit:c}=((u=t==null?void 0:t.axes)==null?void 0:u.find(g=>g.id===r))??{};return{id:r,min:i,max:a,unit:c}})},Vs=e=>{var T;const{state:t,controlsAxesLabels:n,onUpdateAxes:s,onResetAxes:r,onUpdateEdited:o,depthType:l,translations:i,close:a,chartRef:c}=e??{},[u,g]=O.useState({localAxes:ct({chartRef:c,state:t}),depthType:l==null?void 0:l.selectedDepthType,edited:t.edited}),{errors:h,valid:m}=Us(u.localAxes),x=({name:f,value:y,id:L})=>{g(A=>({...A,localAxes:A.localAxes.map(C=>C.id===L?{...C,[f]:y}:C),edited:!0}))},b=({name:f,value:y,id:L})=>{g(A=>({...A,localAxes:A.localAxes.map(C=>C.id===L&&typeof C.unit=="object"?{...C,unit:{...C.unit,[f]:y}}:C),edited:!0}))},_=f=>{f.preventDefault(),m&&(s({axes:u.localAxes}),a==null||a()),l&&(l!=null&&l.setSelectedDepthType)&&(l==null||l.setSelectedDepthType(u.depthType)),o(u.edited)},E=()=>{g({localAxes:ct({chartRef:c,state:t}),depthType:l==null?void 0:l.selectedDepthType,edited:!1}),r(),o(!1),a==null||a()},d=f=>f.target.select();return p.jsxs("form",{onSubmit:_,children:[u.localAxes.map(f=>{var C,S;const y=n.find(D=>D.id===f.id),L=(y==null?void 0:y.label)||P.startCase(f.id),A=h.find(D=>D.id===f.id);return p.jsx(Mn,{label:L,children:p.jsxs(In,{small:!0,width:"300px",children:[p.jsx(et,{name:"min",value:f.min,error:(C=A==null?void 0:A.min)!=null&&C[0]?i[A.min[0]]:null,width:"100%",onChange:D=>x({name:D.target.name,value:D.target.value,id:f.id}),onFocus:d}),p.jsx(vn,{children:"to"}),p.jsx(et,{name:"max",value:f.max,error:(S=A==null?void 0:A.max)!=null&&S[0]?i[A.max[0]]:null,width:"100%",onChange:D=>x({name:D.target.name,value:D.target.value,id:f.id}),onFocus:d}),f.unit?p.jsx(jn,{name:"selectedUnit",options:typeof f.unit!="string"?f.unit.options:[],value:typeof f.unit!="string"?f.unit.selectedUnit:void 0,onChange:D=>b({name:D.target.name,value:D.target.value,id:f.id}),autoLayerWidth:!0,width:"15%"}):null]})},f.id)}),((T=l==null?void 0:l.options)==null?void 0:T.length)>0&&p.jsxs(p.Fragment,{children:[p.jsx(Fn,{items:l.options.map((f,y)=>({key:y,label:f})),onSelected:f=>{g(y=>({...y,depthType:l.options[f],edited:!0}))},small:!0,value:l.options.indexOf(u.depthType)}),p.jsx(kn,{})]}),p.jsxs(Gn,{gap:"8px",alignItems:"center",children:[p.jsx(X,{type:"submit",small:!0,colored:!0,label:i.done,disabled:!m||!u.edited}),p.jsx(X,{small:!0,name:"resetAxes",label:i.resetAxes,onClick:E}),p.jsx(ht,{small:!0,muted:!0,children:i.orDoubleClickToCanvas})]})]})},kt=e=>p.jsx(wn,{placement:"bottom-start",overflowContainer:!0,content:p.jsx(Vs,{...e}),children:p.jsx(pe,{text:e.translations.axesOptions,placement:"bottom-start",display:"inline-flex",children:p.jsx(X,{small:!0,basic:!0,colored:"muted",round:!0,icon:p.jsx(Nn,{})})})});kt.__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:""},onUpdateEdited:{required:!0,tsType:{name:"signature",type:"function",raw:"(edited: boolean) => void",signature:{arguments:[{type:{name:"boolean"},name:"edited"}],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 Gt=({table:e,headerComponent:t,subheaderComponent:n,chartRef:s,state:r,options:o,dispatch:l,generatedDatasets:i,translations:a,controlsPortalId:c})=>{const{enableDragPoints:u,lineEnabled:g,panEnabled:h,pointsEnabled:m,showTable:x,zoomEnabled:b,enableDragAnnotation:_}=r,{dragData:E,depthType:d,annotations:T}=o,{onToggleLine:f,onTogglePan:y,onTogglePoints:L,onToggleTable:A,onToggleZoom:C,onToggleDragPoints:S,onToggleDragAnnotation:D,onDisableDragOptions:N}=Fs(l),{handleDownload:w,controlsAxesLabels:$,onResetAxes:G,onUpdateAxes:se,onUpdateEdited:z}=He({chartRef:s,state:r,options:o,dispatch:l,generatedDatasets:i}),[B,{width:re}]=zn(),Y=re<200,R=O.useMemo(()=>Ms({lineEnabled:g,onToggleLine:f,onTogglePoints:L,pointsEnabled:m,translations:a}),[g,m]),U=O.useMemo(()=>Is({onTogglePan:y,onToggleZoom:C,panEnabled:h,zoomEnabled:b,enableDragPoints:u,enableDragAnnotation:_,isDragDataAllowed:E==null?void 0:E.enableDragData,isDragAnnotationAllowed:T==null?void 0:T.enableDragAnnotation,onToggleDragAnnotation:D,onToggleDragPoints:S,onDisableDragOptions:N,translations:a}),[b,h,u,E==null?void 0:E.enableDragData,T==null?void 0:T.enableDragAnnotation]);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:it.controls,children:[!!o.title&&p.jsx(ht,{bold:!0,children:o.title}),t,p.jsx(rs,{controlsPortalId:c??"",children:p.jsxs("div",{className:it.buttons,ref:B,children:[!x&&p.jsxs(p.Fragment,{children:[p.jsx(kt,{chartRef:s,state:r,controlsAxesLabels:$,onUpdateAxes:se,onResetAxes:G,onUpdateEdited:z,depthType:d,translations:a}),Y?p.jsx(Ve,{menu:{placement:"bottom-end",sections:[...R,{type:"Divider"},...U,{type:"Divider"},{icon:"download",label:a.downloadAsPNG,type:"Option",onClick:w}],trigger:"Component",component:p.jsx(X,{colored:"muted",basic:!0,small:!0,round:!0,icon:"menu"})}}):p.jsxs(p.Fragment,{children:[p.jsx(vt,{options:R}),p.jsx(pe,{display:"inline-flex",text:a.downloadAsPNG,placement:"bottom-end",children:p.jsx(X,{small:!0,basic:!0,colored:"muted",round:!0,icon:"download",onClick:w})}),p.jsx(jt,{options:U})]})]}),e?p.jsx(pe,{display:"inline-flex",text:x?a.showChart:a.showTable,placement:"bottom-end",children:p.jsx(X,{small:!0,basic:!0,colored:"muted",round:!0,icon:x?"chart":"table",onClick:A})}):null]})})]}),n]})};Gt.__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"},dt=e=>({label:"",position:e,color:"",unit:{options:[],selectedUnit:"",setSelectedUnit:()=>{}}}),Xs=e=>({x:(e==null?void 0:e.x)||[dt("bottom")],y:(e==null?void 0:e.y)||[dt("left")]}),Ys=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}),Hs=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}}),qs=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}),Ws=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}),$s=e=>e?e.map(t=>({...t,display:(t==null?void 0:t.display)??!0})):[],Zs=e=>{var t,n,s,r,o,l,i,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:((l=e==null?void 0:e.labelAnnotation)==null?void 0:l.yOffset)??5,maxWidth:((i=e==null?void 0:e.labelAnnotation)==null?void 0:i.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:$s(e==null?void 0:e.annotationsData)}},Ks=e=>({display:(e==null?void 0:e.display)??!0,position:(e==null?void 0:e.position)??le.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}),Js=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}),Qs=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}),er=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}),zt=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:Ys(n==null?void 0:n.additionalAxesOptions),chartStyling:Hs(n==null?void 0:n.chartStyling),tooltip:qs(n==null?void 0:n.tooltip),graph:Ws(n==null?void 0:n.graph),annotations:Zs(n==null?void 0:n.annotations),legend:Ks(n==null?void 0:n.legend),chartOptions:Js(n==null?void 0:n.chartOptions),interactions:Qs(n==null?void 0:n.interactions),dragData:er(n==null?void 0:n.dragData),depthType:(n==null?void 0:n.depthType)??{}}}},tr=(e,t)=>{if(P.isEmpty(e)||P.isEmpty(t))return!1;const n=s=>typeof t=="string"?s&&P.has(s,t):P.isArray(t)?s&&P.some(t,r=>s&&P.has(s,r)):s&&P.some(Object.values(t),r=>s&&P.has(s,r));return P.isArray(e)?P.some(e,n):n(e)};var Bt=(e=>(e.showLine="showLine",e.showPoints="showPoints",e))(Bt||{});const nr=(e,t,n,{label:s})=>{const r=[...e??[]],{annotations:o,graph:l}=n??{},{controlAnnotation:i,showAnnotations:a,annotationsData:c=[]}=o??{};if(i&&a){const u=c.map((g,h)=>{const{type:m,...x}=g,b=x.color??Q[h],_=Wt,E=Re.INITIAL;return{...x,isAnnotation:!0,annotationType:m,label:x.label,annotationIndex:h,backgroundColor:b,pointBackgroundColor:b,borderColor:b,borderDash:_,borderWidth:E,data:[{}]}});r.push(...u)}return r==null?void 0:r.map((u,g)=>{var U,qe;const{formation:h,data:m=[],pointRadius:x,pointHoverRadius:b,borderWidth:_,borderColor:E,backgroundColor:d,pointBackgroundColor:T,borderDash:f,showPoints:y,showLine:L}=u??{},{lineEnabled:A,pointsEnabled:C,axes:S=[]}=t??{},{lineTension:D,spanGaps:N}=l??{},w=Array.isArray(m)?m:[];if(h&&(w!=null&&w.length)){const We=Number((U=S[0])==null?void 0:U.min),$e=Number((qe=S[0])==null?void 0:qe.max),[de,fe]=w;We&&(de!=null&&de.x)&&(w[0].x=Math.max(We,de.x)),$e&&(fe!=null&&fe.x)&&(w[2].x=Math.min($e,fe.x))}const $=tr(u,Bt),G=(w==null?void 0:w.filter(Boolean))||[],se=(G==null?void 0:G.length)===1;let z,B;y!==void 0?z=y:L===!1?z=!0:z=C||se,L!==void 0?B=L:y===!1?B=!0:B=A;const re=parseFloat(x)||Rn,Y=parseFloat(b)||Bn,R=Q[g];return{...u,label:(u==null?void 0:u.label)??`${s} ${g+1}`,data:G,showLine:B,lineTension:(u==null?void 0:u.lineTension)??D,spanGaps:N,borderWidth:parseFloat(_)||Xn,borderDash:f||[],borderJoinStyle:Vn,borderColor:E??R??Ne(Q),backgroundColor:d??Un,pointBackgroundColor:T??R??Ne(Q),pointRadius:z?re:0,pointHoverRadius:Y,pointHitRadius:(u==null?void 0:u.pointHitRadius)??Y,...$?{hasCustomOpt:$}:{}}})},Rt=e=>e==null?void 0:e.reduce((t,n)=>({...t,[n.annotationAxis]:[...t[n.annotationAxis]||[],+n.value]}),{}),Ut=(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 l=Math.min(...o),i=Math.max(...o);return{min:l,max:i}},Be=(e,t,n,s,r=0)=>{var u,g,h,m,x,b,_;const o=s||e.axes[t][0]||{},l=n==null?void 0:n.axes.filter(E=>{var d;return(d=E==null?void 0:E.id)==null?void 0:d.startsWith(t)})[r],i=(g=(u=e==null?void 0:e.scales)==null?void 0:u[`${r===0?t:t+r}`])==null?void 0:g.ticks,{additionalAxesOptions:a}=e,c=()=>{const E=(a==null?void 0:a.chartScaleType)===Zt.Logarithmic,d=(y,L,A)=>E?Jt.includes(y)?tt(y,A):"":tt(y,A);return{...E?{}:{stepSize:o.stepSize??(t===V.Y?a.stepSize:null)},callback:d,includeBounds:!1,...i,font:{size:Kt}}};return{display:!0,type:a.chartScaleType,position:o.position,beginAtZero:a.beginAtZero,reverse:t===V.Y?a.reverse:!1,suggestedMax:a.suggestedMax,suggestedMin:a.suggestedMin,min:(l==null?void 0:l.min)??((m=(h=a==null?void 0:a.range)==null?void 0:h[t])==null?void 0:m.min),max:(l==null?void 0:l.max)??((b=(x=a==null?void 0:a.range)==null?void 0:x[t])==null?void 0:b.max),title:{display:(_=o.label)==null?void 0:_.length,text:o.label,padding:0},ticks:c(),grid:{...o.gridLines}}},ft=(e,t,n)=>e.axes[t].reduce((o,l,i)=>{const a=l;a.color=l.color||Q[i]||Ne(Q),a.position=l.position||$t(t,i);const c=Be(e,t,n,a,i),u=Ft(t,i,!0);return{...o,[u]:c}},{}),sr=(e,t)=>{var l,i;const n=((l=e.axes.x)==null?void 0:l.length)>1,s=((i=e.axes.y)==null?void 0:i.length)>1,r=n?ft(e,V.X,t):{x:Be(e,V.X,t)},o=s?ft(e,V.Y,t):{y:Be(e,V.Y,t)};return{...r,...o}},rr=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,g;const o=(r==null?void 0:r.xAxisID)??"defaultX",l=(r==null?void 0:r.yAxisID)??"defaultY",i=(r==null?void 0:r.data)??[];if(i&&(i!=null&&i.length)){const{x:h,y:m}=(i==null?void 0:i[0])??{},{x=0,y:b=0}=(i==null?void 0:i.at(-1))??{},_=((a=s==null?void 0:s[o])==null?void 0:a.xFirst)??h,E=((c=s==null?void 0:s[o])==null?void 0:c.xLast)??x,d=((u=s==null?void 0:s[l])==null?void 0:u.yFirst)??m,T=((g=s==null?void 0:s[l])==null?void 0:g.yLast)??b,f=Math.min(h,_),y=Math.max(x,E),L=Math.min(m,d),A=Math.max(b,T);s={...s,[o]:{...s[o],xFirst:f,xLast:y},[l]:{yFirst:L,yLast:A}}}return s},{});return(n=Object.values(t))==null?void 0:n.some(({xFirst:s,xLast:r,yFirst:o,yLast:l})=>ie(s,r,{absoluteDiff:ae})||ie(o,l,{absoluteDiff:ae}))},gt=.05,or={min:-1,max:1},lr=({data:e,beginAtZero:t=!1,autoAxisPadding:n=!1})=>{const s=Math.min(...e.filter(m=>m!=null&&!isNaN(m))),r=Math.max(...e.filter(m=>m!=null&&!isNaN(m))),o=Math.sign(s)===-1||Math.sign(r)===-1,l=ie(s,0,{absoluteDiff:ae})&&ie(r,0,{absoluteDiff:ae});if(!(e!=null&&e.length)||l)return or;if(ie(s,r,{absoluteDiff:ae})){const m=r,x=m*gt,b=t&&!o?0:m-x,_=t&&o?0:m+x,E=ee(_,ge),d=ee(b,ge);return{min:E<0?E:d,max:d<0?d:E}}if(!n)return{min:void 0,max:void 0};const i=s===0||r===0||t,a=Math.sign(s)===-1&&Math.sign(r)===1,c=Math.abs(r-s),u=n?c*gt:0,g=!a&&i&&t&&!o?0:s-u,h=!a&&i&&t&&o?0:r+u;return{min:ee(g,ge),max:ee(h,ge)}},ir=(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((l,i)=>{const a=s.filter(c=>Object.values(c).includes(i)).flatMap(c=>c._parsed).map(c=>c[zs(i)]).concat((r==null?void 0:r[i])??[]);return{...l,[i]:[...new Set(a)]}},{}))},mt=(e,t)=>!P.isNil(e)||!P.isNil(t),ar=(e,t,n,s)=>{const{additionalAxesOptions:r,annotations:{annotationsData:o=[],controlAnnotation:l=!1}={}}=e||{},i=sr(e,t)||{},a=l?n.filter(({isAnnotation:h})=>!h):n;if(!(r!=null&&r.autoAxisPadding)&&!rr(a))return i;const c=Object.keys(i)??[],u=ir(s,c,o);return(u&&(c==null?void 0:c.reduce((h,m)=>{const x=i[m],{min:b=void 0,max:_=void 0}=x,{min:E,max:d}=Ut(s,m,o)??{},{min:T,max:f}=lr({data:u[m],beginAtZero:r==null?void 0:r.beginAtZero,autoAxisPadding:r==null?void 0:r.autoAxisPadding}),y={[m]:{...x,min:b??(mt(b,_)?E:T),max:_??(mt(b,_)?d:f)}};return{...h,...y}},{})))??i},ur=(e,t,n,s,r)=>{const l=e??0,i=t??0,a=n??0,c=s??0,u=r??0,g=l-100<=a,h=l+100>=c,m=l+100>=a&&l+100<c&&i+100>=u;return{overLeftSide:g,overRightSide:h,overBottomSide:m}},cr=e=>{var g;const{chart:t,dataIndex:n=0,datasetIndex:s=0}=e,{chartArea:r}=t,{left:o=null,right:l=null,bottom:i=null}=r,a=t==null?void 0:t.getDatasetMeta(s),{x:c=null,y:u=null}=((g=a==null?void 0:a.data)==null?void 0:g[n])||{};return{x:c,y:u,left:o,right:l,bottom:i}},dr=()=>e=>{const{x:t,y:n,left:s,right:r,bottom:o}=cr(e),{overLeftSide:l=!1,overRightSide:i=!1,overBottomSide:a=!1}=ur(t,n,s,r,o);return l&&F.Right||i&&F.Left||a&&F.End||F.Start},fr=e=>e.graph.showDataLabels?{display:Me,align:dr(),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},gr=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]:""},bt=(e,t)=>{let n={};return t?(Math.abs(e)<Yn||Math.abs(e)>Hn)&&(n={roundScientificCoefficient:3}):n={scientific:!1},sn(rn(e),n)},mr=e=>{const{scientificNotation:t}=e.tooltip,n=({xAxisID:o="",yAxisID:l=""})=>{var g,h,m;const i=(o==null?void 0:o.length)>1?Number(o[1])-1:0,a=(l==null?void 0:l.length)>1?Number(l[1])-1:0,c=e.axes.x[i],u=e.axes.y[a];return((m=(h=(g=e==null?void 0:e.axes)==null?void 0:g.x)==null?void 0:h[0])==null?void 0:m.position)===le.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 l=n(o[0].dataset),{titleLabel:i,titleAxisLabel:a}=l??{},c=i===Z.Y?o[0].parsed.y:o[0].parsed.x;return`${bt(c,t)} ${a}`},r=o=>{const{showLabelsInTooltips:l}=e.tooltip;let i=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 bt(b,t)})(),m=gr(u),x=nn(o,l);return`${i}: ${h} ${m} ${x}`};return{enabled:e.tooltip.tooltips,mode:be.Nearest,intersect:!0,padding:tn,usePointStyle:!0,boxWidth:Ke,boxHeight:Ke,boxPadding:en,callbacks:{title:s,label:r,afterLabel:Qt}}},br=({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r})=>{const{interactions:{onAnimationComplete:o},annotations:{labelAnnotation:{showLabel:l,text:i,position:a,fontSize:c,xOffset:u,yOffset:g,maxWidth:h,lineHeight:m}={}},chartStyling:{layoutPadding:x}}=n,{enableDragPoints:b,zoomEnabled:_,panEnabled:E,lineEnabled:d}=t,[T,f]=O.useState(null),{updateAxesRangesFromChart:y,onHover:L,onUpdateEdited:A}=He({chartRef:e,state:t,options:n,dispatch:s,generatedDatasets:r}),{legend:C,customLegendPlugin:S}=qn({chartRef:e,options:n})??{},{state:D}=Wn()??{},{annotation:N}=D??{},w=fr(n),$=mr(n),G=O.useMemo(()=>ar(n,t,r,e),[n,t,r,e]),se=O.useMemo(()=>b&&os(n),[b,n]),z=O.useMemo(()=>({enabled:E,mode:J.XY,onPanComplete(){y(),A(!0)}}),[E]),B=O.useMemo(()=>({mode:J.XY,drag:{enabled:_,threshold:3,backgroundColor:$n,borderColor:Je,borderWidth:1},onZoomComplete(){y(),A(!0)}}),[_]),re={datalabels:w,annotationDraggerPlugin:{enabled:t==null?void 0:t.enableDragAnnotation},annotation:Zn(N),zoom:{pan:z,zoom:B},tooltip:$,legend:{...C,display:!1,events:[]},customLegendPlugin:S,chartAreaBorder:{borderColor:Je},chartAreaText:{showLabel:l,text:i,position:a,fontSize:c,xOffset:u,yOffset:g,maxWidth:h,lineHeight:m},...se};return O.useMemo(()=>{var Y,R,U;return{layout:{padding:x},onHover:L(T,f,r),maintainAspectRatio:(Y=n==null?void 0:n.chartStyling)==null?void 0:Y.maintainAspectRatio,aspectRatio:(R=n==null?void 0:n.chartStyling)!=null&&R.squareAspectRatio?1:0,animation:(U=n==null?void 0:n.chartStyling)!=null&&U.performanceMode?!1:{duration:ln.FAST,onComplete:o},hover:{mode:be.Nearest,intersect:!0},elements:{line:{pointStyle:on.Circle,showLine:d,tension:0}},scales:G,plugins:re,events:Object.values(an)}},[t,n,e,r])},pr=({options:e,resetZoom:t})=>{const{graph:n,legend:s}=e,r=O.useCallback((o,l)=>{const{event:i}=l;if(i.type===Kn)return t(),!1},[t]);return O.useMemo(()=>[...un(n,s),{id:"customEventCatcher",beforeEvent:r}],[r])},hr=1,yr=(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 l=document.getElementById(t.legend.customLegend.customLegendContainerID);l!==null&&(l.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])},xr=(e,t)=>{O.useEffect(()=>{Ss(e,t)},[e.panEnabled,e.lineEnabled,e.pointsEnabled,e.legendEnabled,e.enableDragPoints,e.zoomEnabled])},_r=({chartRef:e,range:t,state:n,dispatch:s,annotationsData:r})=>{const o=O.useRef(n.axes);O.useEffect(()=>{if(t&&Rs(t)){const l=Object.entries(t).map(([a,{min:c,max:u}])=>{const{min:g=void 0,max:h=void 0}=Ut(e,a,r)??{};let m=c??g,x=u??h;return m===x&&(x+=hr),{id:a,min:m,max:x}}),i=[...o.current??[]].map(a=>{const c=l.find(u=>u.id===a.id);return c?{...a,...c}:a});yt(i,o.current)||(s({type:_e,payload:{axes:i}}),o.current=i)}},[t])},Tr=({chartRef:e,options:t,state:n,dispatch:s,persistenceId:r})=>{const o=O.useMemo(()=>n,[n]),l=O.useMemo(()=>t,[t]),{additionalAxesOptions:{range:i=void 0},annotations:{annotationsData:a=[]}={}}=l;xr(o,r),yr(o,l),_r({range:i,state:o,dispatch:s,chartRef:e,annotationsData:a})},Te=" ",Er="rgba(0, 0, 0, 0.5)",Ar=e=>(Array.isArray(e)?e.join(Te):e).split(Te),Lr=({ctx:e,lines:t,lineHeight:n,x:s,y:r,position:o})=>{t.forEach((l,i)=>{const a=o.includes("top")?r+n*(i+1)-5:r-(t.length-1-i)*n;e.fillText(l,s,a)})},Or=(e,t)=>{const r=t<500?.5:t<700?.7:1;return e*r},Cr=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,l=o-8,{legendWidth:i,legendHeight:a}=Cr(t);switch(e){case j.TOP_LEFT:return[r.left+n+i,r.top+s+a];case j.TOP_CENTER:return[r.left+r.width/2,r.top+s+a];case j.TOP_RIGHT:return[l-n,r.top+s+a];case j.MIDDLE_LEFT:return[r.left+n+i,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[l-n-i,r.top+r.height/2];case j.BOTTOM_LEFT:return[r.left+n+i,r.bottom-s-a];case j.BOTTOM_CENTER:return[r.left+r.width/2,r.bottom-s-a];case j.BOTTOM_RIGHT:default:return[l-n-i,r.bottom-s-a]}},Pr=e=>e.includes(F.Center)?F.Center:e.includes(F.Left)?F.Left:F.Right,Dr=(e,t,n)=>{let s="",r=[];for(let o=0;o<e.length;o++){const l=`${s}${e[o]}${Te}`,{width:i}=n.measureText(l);i>t?(r.push(s.trim()),s=`${e[o]}${Te}`):s=l}return r.push(s.trim()),r},wr=(e,t)=>{const{text:n,maxWidth:s,fontSize:r,lineHeight:o,x:l,y:i,position:a}=t,c=Ar(n),u=Dr(c,s,e);e.save(),e.font=`${r}px Arial`,e.fillStyle=Er,e.textAlign=Pr(a),Lr({ctx:e,lines:u,lineHeight:o,x:l,y:i,position:a}),e.restore()},Nr={id:"chartAreaText",beforeDraw:(e,t,n)=>{const{showLabel:s,text:r,fontSize:o,xOffset:l,yOffset:i,lineHeight:a,maxWidth:c,position:u}=n;if(!s||!r)return;const{ctx:g,chartArea:h}=e,m=Or(c,h.width),[x,b]=Sr(u,e,l,i);wr(g,{text:r,maxWidth:m,fontSize:o,lineHeight:a,x,y:b,position:u})}},Vt=(e,t,n,s,r)=>{const o=t.getBoundingClientRect(),l=e.clientX-o.left,i=e.clientY-o.top,a=n[s],c=n[r],u=(a==null?void 0:a.getValueForPixel(l))??-1,g=(c==null?void 0:c.getValueForPixel(i))??-1;return{x:u,y:g}},Ee=e=>{const{xMin:t,xMax:n,yMin:s,yMax:r,xValue:o,yValue:l,type:i}=e??{};let a,c,u,g;return!P.isNil(t)&&!P.isNil(n)&&!P.isNil(s)&&!P.isNil(r)&&i===k.BOX?(a=(t+n)/2,c=(s+r)/2,u=n-t,g=r-s):!P.isNil(o)&&!P.isNil(l)&&i===k.POINT&&(a=o,c=l,u=0,g=0),{centerX:a,centerY:c,width:u,height:g}},Xt=(e,t,n,s)=>{const{xMin:r,xMax:o,yMin:l,yMax:i,xValue:a,yValue:c,type:u}=e??{};let g,h,m,x;const b=t[n],_=t[s];if(!P.isNil(r)&&!P.isNil(o)&&!P.isNil(l)&&!P.isNil(i)&&u===k.BOX){const E=(r+o)/2,d=(l+i)/2,T=(b==null?void 0:b.getPixelForValue(r))??0,f=(b==null?void 0:b.getPixelForValue(o))??0,y=(_==null?void 0:_.getPixelForValue(l))??0,L=(_==null?void 0:_.getPixelForValue(i))??0;m=T-f,x=y-L,g=(b==null?void 0:b.getPixelForValue(E))??-1,h=(_==null?void 0:_.getPixelForValue(d))??-1}else!P.isNil(a)&&!P.isNil(c)&&u===k.POINT&&(m=0,x=0,g=(b==null?void 0:b.getPixelForValue(a))??-1,h=(_==null?void 0:_.getPixelForValue(c))??-1);return{centerX:g,centerY:h,width:m,height:x}},Mr=({x:e,y:t,chartArea:n,scales:s,metrics:r,resizable:o=!1,dragRange:l,annotationType:i,xScaleID:a,yScaleID:c})=>{if(o&&!l)return!0;if(l){const _=e!==void 0&&l.x?e>=l.x[0]&&e<=l.x[1]:!0,E=t!==void 0&&l.y?t>=l.y[0]&&t<=l.y[1]:!0;return _&&E}const u=s[a],g=s[c],h=(u==null?void 0:u.getValueForPixel(n.left))??Number.NEGATIVE_INFINITY,m=(u==null?void 0:u.getValueForPixel(n.right))??Number.POSITIVE_INFINITY,x=(g==null?void 0:g.getValueForPixel(n.bottom))??Number.NEGATIVE_INFINITY,b=(g==null?void 0:g.getValueForPixel(n.top))??Number.POSITIVE_INFINITY;if(i===k.POINT){const _=e!==void 0?e>=h&&e<=m:!0,E=t!==void 0?t>=x&&t<=b:!0;return _&&E}if(i===k.BOX&&r.width!==void 0&&r.height!==void 0){const _=e!==void 0?e-r.width/2:void 0,E=e!==void 0?e+r.width/2:void 0,d=t!==void 0?t-r.height/2:void 0,T=t!==void 0?t+r.height/2:void 0,f=_!==void 0&&E!==void 0?_>=h&&E<=m:!0,y=d!==void 0&&T!==void 0?d>=x&&T<=b:!0;return f&&y}return!0},pt=(e,t,n,s,r,o,l,i)=>{const{resizable:a,dragRange:c=null}=n??{};Mr({[e]:t,chartArea:s.chartArea,scales:r,resizable:a,dragRange:c,metrics:i||{},annotationType:n.type,xScaleID:o,yScaleID:l})&&(n.type===k.POINT?e==="x"?n.xValue=t:e==="y"&&(n.yValue=t):n.type===k.BOX&&i&&(e==="x"&&i.width&&(n.xMin=t-i.width/2,n.xMax=t+i.width/2),e==="y"&&i.height&&(n.yMin=t-i.height/2,n.yMax=t+i.height/2)))},Yt=(e,t,n)=>{var r,o,l;if(!t)return;const s=(l=(o=(r=e==null?void 0:e.options)==null?void 0:r.plugins)==null?void 0:o.annotation)==null?void 0:l.annotations;s&&t&&s[t]&&(s[t].borderWidth=n)},Ir=(e,t,n,s,r,o)=>{const l=o?s==null?void 0:s[o]:null;if(!l)return;const{xScaleID:i="x",yScaleID:a="y"}=l,{x:c,y:u}=Vt(e,t,n,i,a),g=Ee(l);if(l&&l.enableDrag&&!P.isNil(g.centerY)&&!P.isNil(g.centerX)){!P.isNil(t)&&!P.isNil(t.style)&&(t.style.cursor=Ue.Move);const h=c-g.centerX,m=u-g.centerY;r(!0,l,h,m),l!=null&&l.onDragStart&&l.onDragStart({x:c,y:u},l)}},vr=(e,t,n,s,r,o,l,i)=>{if(s&&r){!P.isNil(t)&&!P.isNil(t.style)&&(t.style.cursor=Ue.Move);const a=r==null?void 0:r.id;Yt(i,a,Re.HOVERED);const c=(r==null?void 0:r.dragAxis)??oe.Both,{xScaleID:u="x",yScaleID:g="y"}=r,{x:h,y:m}=Vt(e,t,n,u,g),x=Ee(r);let b=h-o,_=m-l;c!==oe.Y&&pt(oe.X,b,r,i,n,u,g,x),c!==oe.X&&pt(oe.Y,_,r,i,n,u,g,x),i.update(),r!=null&&r.onDrag&&r.onDrag({x:h,y:m},r);const{ctx:E,width:d,height:T}=i,{centerX:f,centerY:y}=Ee(r)??{},{centerX:L,centerY:A}=Xt(r,n,u,g);if(!P.isNil(f)&&!P.isNil(y)&&!P.isNil(L)&&!P.isNil(A)&&(E.save(),E.clearRect(0,0,d,T),i.draw(),E.font=cn,E.fillStyle="black",r!=null&&r.displayDragCoordinates)){let C=L-45,S=A-20;const D=`X: ${ee(f,2)}, Y: ${ee(y,2)}`,N=14;S-N<0&&(S=A+N+15),S>T&&(S=T-7),E.fillText(D,C,S),E.restore()}}},jr=(e,t,n,s,r)=>{if(e&&t){const o=t==null?void 0:t.id;Yt(n,o,Re.ZERO);const{centerX:l=-1,centerY:i=-1}=Ee(t)??{};P.isNil(t==null?void 0:t.onDragEnd)||t==null||t.onDragEnd({x:l,y:i},t),!P.isNil(s)&&!P.isNil(s.style)&&(s.style.cursor=Ue.Pointer),r(!1,null)}},Fr=(e,t,n)=>{Object.values(t).forEach(s=>{var r;if(s.type===k.POINT&&!P.isNil(s==null?void 0:s.label)&&((r=s==null?void 0:s.label)!=null&&r.display)){const{content:o,font:l,color:i,position:a,padding:c}=(s==null?void 0:s.label)??{},{xScaleID:u="x",yScaleID:g="y"}=s;e.save(),e.font=l,e.fillStyle=i;const{centerX:h=-1,centerY:m=-1}=Xt(s,n,u,g),x=e.measureText(o).width;let b=h-x/2,_=m+20;switch(a){case le.Top:_=m-20;break;case le.Left:b=h-x-c,_=m;break;case le.Right:b=h+c,_=m;break}e.fillText(o,b,_),e.restore()}})},kr={id:"annotationDraggerPlugin",beforeDraw(e){var s,r,o,l,i,a,c,u;let t=((r=(s=e.options.plugins)==null?void 0:s.annotation)==null?void 0:r.annotations)??{};if(!t)return;Fr(e.ctx,t,e.scales),(((l=(o=e==null?void 0:e.options)==null?void 0:o.plugins)==null?void 0:l.annotationDraggerPlugin)||{enabled:!1}).enabled?((a=(i=e==null?void 0:e.options)==null?void 0:i.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:be.Nearest,intersect:!0})},afterUpdate(e){var h,m,x,b,_,E,d,T;const{canvas:t,scales:n,hoveredAnnotationId:s}=e??{},r=((m=(h=e==null?void 0:e.options)==null?void 0:h.plugins)==null?void 0:m.annotationDraggerPlugin)||{enabled:!1},o={...n,x:n.x,y:n.y};let l=((b=(x=e.options.plugins)==null?void 0:x.annotation)==null?void 0:b.annotations)??{};if(!e&&!l)return;r.enabled?((E=(_=e==null?void 0:e.options)==null?void 0:_.plugins)!=null&&E.tooltip&&(e.options.plugins.tooltip.enabled=!1),e.options.hover={mode:void 0,intersect:!1}):((T=(d=e==null?void 0:e.options)==null?void 0:d.plugins)!=null&&T.tooltip&&(e.options.plugins.tooltip.enabled=!0),e.options.hover={mode:be.Nearest,intersect:!0});let i=!1,a,c,u=null;const g=(f,y,L,A)=>{i=f,u=y,L!==void 0&&A!==void 0&&(a=L,c=A)};!t.dataset.annotationDraggerInitialized&&r.enabled&&s&&(t.addEventListener(K.MOUSEDOWN,f=>{var y,L,A;Ir(f,t,o,(A=(L=(y=e==null?void 0:e.options)==null?void 0:y.plugins)==null?void 0:L.annotation)==null?void 0:A.annotations,g,e.hoveredAnnotationId)}),t.addEventListener(K.MOUSEMOVE,f=>{P.debounce(()=>vr(f,t,o,i,u,a,c,e),5)()}),t.addEventListener(K.MOUSEUP,f=>{const y=f.currentTarget;jr(i,u,e,y,g)}),t.dataset.annotationDraggerInitialized="true"),r.enabled||(t.removeEventListener(K.MOUSEDOWN,()=>{}),t.removeEventListener(K.MOUSEMOVE,()=>{}),t.removeEventListener(K.MOUSEUP,()=>{}),t.dataset.annotationDraggerInitialized="")}};bn.register(pn,hn,yn,xn,_n,Tn,En,An,Ln,On,Cn,ns,Nr,kr);const Gr=e=>{var D,N;fn();const t=O.useRef(null),{table:n,headerComponent:s,subheaderComponent:r}=e??{},{translations:o,languageKey:l}=ls(),i=zt(e),{data:{datasets:a}={datasets:[]},options:c,testId:u,persistenceId:g,controlsPortalId:h}=i,{annotations:m,axes:x,chartStyling:b,graph:_}=c??{},E=!((N=(D=c==null?void 0:c.legend)==null?void 0:D.customLegend)!=null&&N.customLegendContainerID),[d,T]=O.useReducer(Ls,{options:c,persistenceId:g,chartRef:t},Ps),f=O.useMemo(()=>nr(a,d,c,o),[d.lineEnabled,d.pointsEnabled,a,x,m,_]);Tr({chartRef:t,options:c,state:d,dispatch:T,persistenceId:g});const{resetZoom:y,handleKeyDown:L,handleKeyUp:A}=He({chartRef:t,state:d,options:c,dispatch:T,generatedDatasets:f}),C=br({chartRef:t,state:d,options:c,dispatch:T,generatedDatasets:f}),S=pr({options:c,resetZoom:y});return p.jsxs("div",{className:gn(b,Pe),style:{width:b.width||Me,height:b.height||Me},tabIndex:0,onKeyDown:L,onKeyUp:A,"data-testid":u,children:[p.jsx(Gt,{table:n,headerComponent:s,subheaderComponent:r,chartRef:t,state:d,options:c,dispatch:T,generatedDatasets:f,translations:o,controlsPortalId:h}),n&&d.showTable?p.jsx("div",{className:Pe.table,children:n}):p.jsx(Jn,{backend:Qn,context:window,children:p.jsxs("div",{className:Pe.canvas,id:"canvas",children:[p.jsx(mn,{ref:t,data:{datasets:f},options:C,plugins:S}),E&&!!f.length&&p.jsx(es,{chartRef:t,legendConfig:{options:c,generatedDatasets:f,chartType:ts.LINE}})]})})]},Bs([...Object.values(d),l]))},zr=e=>{const{options:t}=zt(e);return p.jsx(dn,{options:t,children:p.jsx(Gr,{...e})})};zr.__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{zr as L,Hr as i};