gf-components 0.1.138 → 0.1.140
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/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -494,7 +494,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
494
494
|
font: var(--gf-label-md-default);
|
|
495
495
|
color: var(--gf-color-text-secondary);
|
|
496
496
|
font-size: 10px;
|
|
497
|
-
`,vle=({pieChartData:e,title:t,isEmpty:n,sortByValue:r=!0,arcLabel:i=null,tooltip:o=null,customStyle:a={},customMargin:s={},height:l=600,legendWidth:c="50%"})=>{const[u,d]=S.useState([]),f=({centerX:m,centerY:g,dataWithArc:v})=>(u.length||d(v),p.jsx("text",{x:m,y:g,textAnchor:"middle",dominantBaseline:"central",style:{fontSize:"16px",font:"var(--gf-label-md-default)",fontWeight:400},children:n?"Data niet openbaar beschikbaar":""})),h=({data:m})=>p.jsx(mn,{gap:16,className:"gf-full",justify:"center",wrap:!0,style:{width:c},children:m==null?void 0:m.map((g,v)=>p.jsxs(mn,{gap:8,align:"center",children:[p.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:g.color}}),p.jsx(gle,{children:g.label})]},`legend-${v}`))});return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsxs(mn,{vertical:!0,gap:8,align:"center",style:{width:"100%"},children:[p.jsx(hle,{children:t}),p.jsx("div",{style:{width:"100%",height:l},children:p.jsx(fle,{colors:n?{scheme:"greys"}:{datum:"data.color"},data:e,sortByValue:r,enableArcLabels:!n,arcLabel:m=>(i==null?void 0:i(m))||m.formattedValue,enableArcLinkLabels:!1,margin:{top:50,right:80,bottom:50,left:80,...s},innerRadius:.5,padAngle:.7,cornerRadius:3,activeOuterRadiusOffset:8,borderWidth:1,borderColor:{from:"color",modifiers:[["darker",.2]]},arcLabelsSkipAngle:10,arcLabelsTextColor:{from:"color",modifiers:[["darker",2]]},isInteractive:!n,layers:["arcs","arcLabels","arcLinkLabels","legends",f],tooltip:({datum:{id:m,value:g,unit:v}})=>p.jsx(er,{body:(o==null?void 0:o({id:m,value:g,unit:v}))||p.jsx("span",{children:"Pie chart tooltip"})})})}),!n&&p.jsx(h,{data:u})]})]})};var mle=cf,ple=bh,ble=1,yle=2;function Cle(e,t,n,r){var i=n.length,o=i,a=!r;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var l=s[0],c=e[l],u=s[1];if(a&&s[2]){if(c===void 0&&!(l in e))return!1}else{var d=new mle;if(r)var f=r(c,u,l,e,t,d);if(!(f===void 0?ple(u,c,ble|yle,r,d):f))return!1}}return!0}var xle=Cle,wle=Mi;function Sle(e){return e===e&&!wle(e)}var M$=Sle,$le=M$,Mle=S1;function _le(e){for(var t=Mle(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,$le(i)]}return t}var Ele=_le;function Ole(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var _$=Ole,Hle=xle,Vle=Ele,Tle=_$;function Rle(e){var t=Vle(e);return t.length==1&&t[0][2]?Tle(t[0][0],t[0][1]):function(n){return n===e||Hle(n,e,t)}}var kle=Rle,Lle=bh,jle=Hw,Ple=OS,Ile=I6,Ale=M$,Nle=_$,Fle=ul,Dle=1,zle=2;function Ble(e,t){return Ile(e)&&Ale(t)?Nle(Fle(e),t):function(n){var r=jle(n,e);return r===void 0&&r===t?Ple(n,e):Lle(t,r,Dle|zle)}}var Wle=Ble;function Zle(e){return function(t){return t==null?void 0:t[e]}}var Ule=Zle,qle=b1;function Gle(e){return function(t){return qle(t,e)}}var Yle=Gle,Kle=Ule,Xle=Yle,Qle=I6,Jle=ul;function ece(e){return Qle(e)?Kle(Jle(e)):Xle(e)}var tce=ece,nce=kle,rce=Wle,ice=gf,oce=Cr,ace=tce;function sce(e){return typeof e=="function"?e:e==null?ice:typeof e=="object"?oce(e)?rce(e[0],e[1]):nce(e):ace(e)}var $h=sce,lce=$h,cce=xx;function uce(e,t){return e&&e.length?cce(e,lce(t)):[]}var dce=uce;const k4=xn(dce);var fce=dw,hce=S1;function gce(e,t){return e&&fce(e,t,hce)}var vce=gce,mce=al;function pce(e,t){return function(n,r){if(n==null)return n;if(!mce(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Object(n);(t?o--:++o<i)&&r(a[o],o,a)!==!1;);return n}}var bce=pce,yce=vce,Cce=bce,xce=Cce(yce),E$=xce,wce=E$,Sce=al;function $ce(e,t){var n=-1,r=Sce(e)?Array(e.length):[];return wce(e,function(i,o,a){r[++n]=t(i,o,a)}),r}var Mce=$ce;function _ce(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var Ece=_ce,Ym=vf;function Oce(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,o=Ym(e),a=t!==void 0,s=t===null,l=t===t,c=Ym(t);if(!s&&!c&&!o&&e>t||o&&a&&l&&!s&&!c||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!c&&e<t||c&&n&&i&&!r&&!o||s&&n&&i||!a&&i||!l)return-1}return 0}var Hce=Oce,Vce=Hce;function Tce(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=Vce(i[r],o[r]);if(l){if(r>=s)return l;var c=n[r];return l*(c=="desc"?-1:1)}}return e.index-t.index}var Rce=Tce,w2=mf,kce=b1,Lce=$h,jce=Mce,Pce=Ece,Ice=sl,Ace=Rce,Nce=gf,Fce=Cr;function Dce(e,t,n){t.length?t=w2(t,function(o){return Fce(o)?function(a){return kce(a,o.length===1?o[0]:o)}:o}):t=[Nce];var r=-1;t=w2(t,Ice(Lce));var i=jce(e,function(o,a,s){var l=w2(t,function(c){return c(o)});return{criteria:l,index:++r,value:o}});return Pce(i,function(o,a){return Ace(o,a,n)})}var zce=Dce,Bce=VS,Wce=zce,Zce=j6,Km=_w,Uce=Zce(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Km(e,t[0],t[1])?t=[]:n>2&&Km(t[0],t[1],t[2])&&(t=[t[0]]),Wce(e,Bce(t,1),[])}),qce=Uce;const Gce=xn(qce);var Yce=po,Kce=Gr,Xce="[object Date]";function Qce(e){return Kce(e)&&Yce(e)==Xce}var Jce=Qce,e1e=Jce,t1e=sl,Xm=ff,Qm=Xm&&Xm.isDate,n1e=Qm?t1e(Qm):e1e,r1e=n1e;const i1e=xn(r1e);var S2=new Date,$2=new Date;function Mn(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=function(o){return e(o=new Date(+o)),o},i.ceil=function(o){return e(o=new Date(o-1)),t(o,1),e(o),o},i.round=function(o){var a=i(o),s=i.ceil(o);return o-a<s-o?a:s},i.offset=function(o,a){return t(o=new Date(+o),a==null?1:Math.floor(a)),o},i.range=function(o,a,s){var l=[],c;if(o=i.ceil(o),s=s==null?1:Math.floor(s),!(o<a)||!(s>0))return l;do l.push(c=new Date(+o)),t(o,s),e(o);while(c<o&&o<a);return l},i.filter=function(o){return Mn(function(a){if(a>=a)for(;e(a),!o(a);)a.setTime(a-1)},function(a,s){if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!o(a););else for(;--s>=0;)for(;t(a,1),!o(a););})},n&&(i.count=function(o,a){return S2.setTime(+o),$2.setTime(+a),e(S2),e($2),Math.floor(n(S2,$2))},i.every=function(o){return o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?function(a){return r(a)%o===0}:function(a){return i.count(0,a)%o===0}):i}),i}var vo=Mn(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});vo.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Mn(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):vo};vo.range;var pd=1e3,Zs=6e4,bd=36e5,O$=6048e5,_a=Mn(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*pd)},function(e,t){return(t-e)/pd},function(e){return e.getUTCSeconds()});_a.range;var Pf=Mn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*pd)},function(e,t){e.setTime(+e+t*Zs)},function(e,t){return(t-e)/Zs},function(e){return e.getMinutes()});Pf.range;var If=Mn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*pd-e.getMinutes()*Zs)},function(e,t){e.setTime(+e+t*bd)},function(e,t){return(t-e)/bd},function(e){return e.getHours()});If.range;function qa(e){return Mn(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n*7)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Zs)/O$})}var Ea=qa(0),Af=qa(1),Nf=qa(2),Ff=qa(3),Df=qa(4),zf=qa(5),Bf=qa(6);Ea.range;Af.range;Nf.range;Ff.range;Df.range;zf.range;Bf.range;var Wf=Mn(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});Wf.range;var M1=Mn(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});M1.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Mn(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)})};M1.range;var Zf=Mn(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Zs)},function(e,t){return(t-e)/Zs},function(e){return e.getUTCMinutes()});Zf.range;var Uf=Mn(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*bd)},function(e,t){return(t-e)/bd},function(e){return e.getUTCHours()});Uf.range;function Ga(e){return Mn(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n*7)},function(t,n){return(n-t)/O$})}var Oa=Ga(0),qf=Ga(1),Gf=Ga(2),Yf=Ga(3),Kf=Ga(4),Xf=Ga(5),Qf=Ga(6);Oa.range;qf.range;Gf.range;Yf.range;Kf.range;Xf.range;Qf.range;var Jf=Mn(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()});Jf.range;var _1=Mn(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});_1.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Mn(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})};_1.range;function ia(){return ia=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ia.apply(this,arguments)}var us=[function(e){return e.setMilliseconds(0)},function(e){return e.setSeconds(0)},function(e){return e.setMinutes(0)},function(e){return e.setHours(0)},function(e){return e.setDate(1)},function(e){return e.setMonth(0)}],o1e={millisecond:[],second:us.slice(0,1),minute:us.slice(0,2),hour:us.slice(0,3),day:us.slice(0,4),month:us.slice(0,5),year:us.slice(0,6)},a1e=function(e){return function(t){return o1e[e].forEach(function(n){n(t)}),t}},H$=function(e){var t=e.format,n=t===void 0?"native":t,r=e.precision,i=r===void 0?"millisecond":r,o=e.useUTC,a=o===void 0||o,s=a1e(i);return function(l){if(l===void 0)return l;if(n==="native"||l instanceof Date)return s(l);var c=a?vh(n):gh(n);return s(c(l))}},s1e=function(e,t,n,r){var i,o,a,s,l=e.min,c=l===void 0?0:l,u=e.max,d=u===void 0?"auto":u,f=e.stacked,h=f!==void 0&&f,m=e.reverse,g=m!==void 0&&m,v=e.clamp,b=v!==void 0&&v,y=e.nice,x=y!==void 0&&y;c==="auto"?i=h===!0?(o=t.minStacked)!=null?o:0:t.min:i=c,d==="auto"?a=h===!0?(s=t.maxStacked)!=null?s:0:t.max:a=d;var $=Uo().rangeRound(r==="x"?[0,n]:[n,0]).domain(g?[a,i]:[i,a]).clamp(b);return x===!0?$.nice():typeof x=="number"&&$.nice(x),l1e($,h)},l1e=function(e,t){t===void 0&&(t=!1);var n=e;return n.type="linear",n.stacked=t,n},c1e=function(e,t,n){var r=Fw().range([0,n]).domain(t.all);return r.type="point",r},u1e=function(e,t,n,r){var i=e.round,o=i===void 0||i,a=Ns().range(r==="x"?[0,n]:[n,0]).domain(t.all).round(o);return d1e(a)},d1e=function(e){var t=e;return t.type="band",t},f1e=function(e,t,n){var r,i,o=e.format,a=o===void 0?"native":o,s=e.precision,l=s===void 0?"millisecond":s,c=e.min,u=c===void 0?"auto":c,d=e.max,f=d===void 0?"auto":d,h=e.useUTC,m=h===void 0||h,g=e.nice,v=g!==void 0&&g,b=H$({format:a,precision:l,useUTC:m});r=u==="auto"?b(t.min):a!=="native"?b(u):u,i=f==="auto"?b(t.max):a!=="native"?b(f):f;var y=m?tS():eS();y.range([0,n]),r&&i&&y.domain([r,i]),v===!0?y.nice():typeof v!="object"&&typeof v!="number"||y.nice(v);var x=y;return x.type="time",x.useUTC=m,x},h1e=function(e,t,n,r){var i,o=e.base,a=o===void 0?10:o,s=e.min,l=s===void 0?"auto":s,c=e.max,u=c===void 0?"auto":c;if(t.all.some(function(g){return g===0}))throw new Error("a log scale domain must not include or cross zero");var d,f,h=!1;if(t.all.filter(function(g){return g!=null}).forEach(function(g){h||(i===void 0?i=Math.sign(g):Math.sign(g)!==i&&(h=!0))}),h)throw new Error("a log scale domain must be strictly-positive or strictly-negative");d=l==="auto"?t.min:l,f=u==="auto"?t.max:u;var m=G6().domain([d,f]).rangeRound(r==="x"?[0,n]:[n,0]).base(a).nice();return m.type="log",m},g1e=function(e,t,n,r){var i,o,a=e.constant,s=a===void 0?1:a,l=e.min,c=l===void 0?"auto":l,u=e.max,d=u===void 0?"auto":u,f=e.reverse,h=f!==void 0&&f;i=c==="auto"?t.min:c,o=d==="auto"?t.max:d;var m=Y6().constant(s).rangeRound(r==="x"?[0,n]:[n,0]).nice();h===!0?m.domain([o,i]):m.domain([i,o]);var g=m;return g.type="symlog",g},v1e=function(e){return e==="x"?"y":"x"},m1e=function(e,t){return e===t},p1e=function(e,t){return e.getTime()===t.getTime()};function Jm(e,t,n,r){switch(e.type){case"linear":return s1e(e,t,n,r);case"point":return c1e(e,t,n);case"band":return u1e(e,t,n,r);case"time":return f1e(e,t,n);case"log":return h1e(e,t,n,r);case"symlog":return g1e(e,t,n,r);default:throw new Error("invalid scale spec")}}var ep=function(e,t,n){var r;if("stacked"in n&&n.stacked){var i=e.data[t==="x"?"xStacked":"yStacked"];return i==null?null:n(i)}return(r=n(e.data[t]))!=null?r:null},V$=function(e,t,n,r,i){var o=e.map(function(u){return function(d){return ia({},d,{data:d.data.map(function(f){return{data:ia({},f)}})})}(u)}),a=b1e(o,t,n);"stacked"in t&&t.stacked===!0&&y1e(a,o),"stacked"in n&&n.stacked===!0&&C1e(a,o);var s=Jm(t,a.x,r,"x"),l=Jm(n,a.y,i,"y"),c=o.map(function(u){return ia({},u,{data:u.data.map(function(d){return ia({},d,{position:{x:ep(d,"x",s),y:ep(d,"y",l)}})})})});return ia({},a,{series:c,xScale:s,yScale:l})},b1e=function(e,t,n){return{x:tp(e,"x",t),y:tp(e,"y",n)}},tp=function(e,t,n,r){var i={},o=i.getValue,a=o===void 0?function(m){return m.data[t]}:o,s=i.setValue,l=s===void 0?function(m,g){m.data[t]=g}:s;if(n.type==="linear")e.forEach(function(m){m.data.forEach(function(g){var v=a(g);v&&l(g,parseFloat(String(v)))})});else if(n.type==="time"&&n.format!=="native"){var c=H$(n);e.forEach(function(m){m.data.forEach(function(g){var v=a(g);v&&l(g,c(v))})})}var u=[];switch(e.forEach(function(m){m.data.forEach(function(g){u.push(a(g))})}),n.type){case"linear":var d=Gce(Y3(u).filter(function(m){return m!==null}),function(m){return m});return{all:d,min:Math.min.apply(Math,d),max:Math.max.apply(Math,d)};case"time":var f=k4(u,function(m){return m.getTime()}).slice(0).sort(function(m,g){return g.getTime()-m.getTime()}).reverse();return{all:f,min:f[0],max:ue(f)};default:var h=Y3(u);return{all:h,min:h[0],max:ue(h)}}},T$=function(e,t,n){var r=v1e(e),i=[];t[r].all.forEach(function(o){var a=i1e(o)?p1e:m1e,s=[];n.forEach(function(l){var c=l.data.find(function(h){return a(h.data[r],o)}),u=null,d=null;if(c!==void 0){if((u=c.data[e])!==null){var f=ue(s);f===void 0?d=u:f!==null&&(d=f+u)}c.data[e==="x"?"xStacked":"yStacked"]=d}s.push(d),d!==null&&i.push(d)})}),t[e].minStacked=Math.min.apply(Math,i),t[e].maxStacked=Math.max.apply(Math,i)},y1e=function(e,t){return T$("x",e,t)},C1e=function(e,t){return T$("y",e,t)},R$=function(e){var t=e.bandwidth();if(t===0)return e;var n=t/2;return e.round()&&(n=Math.round(n)),function(r){var i;return((i=e(r))!=null?i:0)+n}},k$={millisecond:[vo,vo],second:[_a,_a],minute:[Pf,Zf],hour:[If,Uf],day:[Mn(function(e){return e.setHours(0,0,0,0)},function(e,t){return e.setDate(e.getDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)}),Mn(function(e){return e.setUTCHours(0,0,0,0)},function(e,t){return e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)})],week:[Ea,Oa],sunday:[Ea,Oa],monday:[Af,qf],tuesday:[Nf,Gf],wednesday:[Ff,Yf],thursday:[Df,Kf],friday:[zf,Xf],saturday:[Bf,Qf],month:[Wf,Jf],year:[M1,_1]},x1e=Object.keys(k$),w1e=new RegExp("^every\\s*(\\d+)?\\s*("+x1e.join("|")+")s?$","i"),L$=function(e,t){if(Array.isArray(t))return t;if(typeof t=="string"&&"useUTC"in e){var n=t.match(w1e);if(n){var r=n[1],i=n[2],o=k$[i][e.useUTC?1:0];if(i==="day"){var a,s,l=e.domain(),c=l[0],u=l[1],d=new Date(u);return d.setDate(d.getDate()+1),(a=(s=o.every(Number(r??1)))==null?void 0:s.range(c,d))!=null?a:[]}if(r===void 0)return e.ticks(o);var f=o.every(Number(r));if(f)return e.ticks(f)}throw new Error("Invalid tickValues: "+t)}if("ticks"in e){if(t===void 0)return e.ticks();if(typeof(h=t)=="number"&&isFinite(h)&&Math.floor(h)===h)return e.ticks(t)}var h;return e.domain()};function zr(){return zr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zr.apply(this,arguments)}var j$=function(e){var t,n=e.axis,r=e.scale,i=e.ticksPosition,o=e.tickValues,a=e.tickSize,s=e.tickPadding,l=e.tickRotation,c=e.truncateTickAt,u=e.engine,d=u===void 0?"svg":u,f=L$(r,o),h=tie[d],m="bandwidth"in r?R$(r):r,g={lineX:0,lineY:0},v={textX:0,textY:0},b=typeof document=="object"&&document.dir==="rtl",y=h.align.center,x=h.baseline.center;return n==="x"?(t=function($){var w;return{x:(w=m($))!=null?w:0,y:0}},g.lineY=a*(i==="after"?1:-1),v.textY=(a+s)*(i==="after"?1:-1),x=i==="after"?h.baseline.top:h.baseline.bottom,l===0?y=h.align.center:i==="after"&&l<0||i==="before"&&l>0?(y=h.align[b?"left":"right"],x=h.baseline.center):(i==="after"&&l>0||i==="before"&&l<0)&&(y=h.align[b?"right":"left"],x=h.baseline.center)):(t=function($){var w;return{x:0,y:(w=m($))!=null?w:0}},g.lineX=a*(i==="after"?1:-1),v.textX=(a+s)*(i==="after"?1:-1),y=i==="after"?h.align.left:h.align.right),{ticks:f.map(function($){var w=typeof $=="string"?function(M){var V=String(M).length;return c&&c>0&&V>c?""+String(M).slice(0,c).concat("..."):""+M}($):$;return zr({key:$ instanceof Date?""+$.valueOf():""+$,value:w},t($),g,v)}),textAlign:y,textBaseline:x}},P$=function(e,t){if(e===void 0||typeof e=="function")return e;if(t.type==="time"){var n=Wa(e);return function(r){return n(r instanceof Date?r:new Date(r))}}return Da(e)},L4=function(e){var t,n=e.width,r=e.height,i=e.scale,o=e.axis,a=e.values,s=(t=a,(Array.isArray(t)?a:void 0)||L$(i,a)),l="bandwidth"in i?R$(i):i,c=o==="x"?s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:(d=l(u))!=null?d:0,x2:(f=l(u))!=null?f:0,y1:0,y2:r}}):s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:0,x2:n,y1:(d=l(u))!=null?d:0,y2:(f=l(u))!=null?f:0}});return c},S1e=S.memo(function(e){var t,n=e.value,r=e.format,i=e.lineX,o=e.lineY,a=e.onClick,s=e.textBaseline,l=e.textAnchor,c=e.animatedProps,u=Wt(),d=u.axis.ticks.line,f=u.axis.ticks.text,h=(t=r==null?void 0:r(n))!=null?t:n,m=S.useMemo(function(){var g={opacity:c.opacity};return a?{style:zr({},g,{cursor:"pointer"}),onClick:function(v){return a(v,h)}}:{style:g}},[c.opacity,a,h]);return p.jsxs(et.g,zr({transform:c.transform},m,{children:[p.jsx("line",{x1:0,x2:i,y1:0,y2:o,style:d}),f.outlineWidth>0&&p.jsx(et.text,{dominantBaseline:s,textAnchor:l,transform:c.textTransform,style:f,strokeWidth:2*f.outlineWidth,stroke:f.outlineColor,strokeLinejoin:"round",children:""+h}),p.jsx(et.text,{dominantBaseline:s,textAnchor:l,transform:c.textTransform,style:Ch(f),children:""+h})]}))}),$1e=function(e){var t=e.axis,n=e.scale,r=e.x,i=r===void 0?0:r,o=e.y,a=o===void 0?0:o,s=e.length,l=e.ticksPosition,c=e.tickValues,u=e.tickSize,d=u===void 0?5:u,f=e.tickPadding,h=f===void 0?5:f,m=e.tickRotation,g=m===void 0?0:m,v=e.format,b=e.renderTick,y=b===void 0?S1e:b,x=e.truncateTickAt,$=e.legend,w=e.legendPosition,M=w===void 0?"end":w,V=e.legendOffset,E=V===void 0?0:V,_=e.onClick,O=e.ariaHidden,k=Wt(),A=k.axis.legend.text,H=S.useMemo(function(){return P$(v,n)},[v,n]),R=j$({axis:t,scale:n,ticksPosition:l,tickValues:c,tickSize:d,tickPadding:h,tickRotation:g,truncateTickAt:x}),j=R.ticks,L=R.textAlign,T=R.textBaseline,I=null;if($!==void 0){var P,N=0,z=0,U=0;t==="y"?(U=-90,N=E,M==="start"?(P="start",z=s):M==="middle"?(P="middle",z=s/2):M==="end"&&(P="end")):(z=E,M==="start"?P="start":M==="middle"?(P="middle",N=s/2):M==="end"&&(P="end",N=s)),I=p.jsxs(p.Fragment,{children:[A.outlineWidth>0&&p.jsx("text",{transform:"translate("+N+", "+z+") rotate("+U+")",textAnchor:P,style:zr({dominantBaseline:"central"},A),strokeWidth:2*A.outlineWidth,stroke:A.outlineColor,strokeLinejoin:"round",children:$}),p.jsx("text",{transform:"translate("+N+", "+z+") rotate("+U+")",textAnchor:P,style:zr({dominantBaseline:"central"},A),children:$})]})}var q=Fn(),Y=q.animate,ee=q.config,Q=Xt({transform:"translate("+i+","+a+")",lineX2:t==="x"?s:0,lineY2:t==="x"?0:s,config:ee,immediate:!Y}),K=S.useCallback(function(Z){return{opacity:1,transform:"translate("+Z.x+","+Z.y+")",textTransform:"translate("+Z.textX+","+Z.textY+") rotate("+g+")"}},[g]),J=S.useCallback(function(Z){return{opacity:0,transform:"translate("+Z.x+","+Z.y+")",textTransform:"translate("+Z.textX+","+Z.textY+") rotate("+g+")"}},[g]),W=yr(j,{keys:function(Z){return Z.key},initial:K,from:J,enter:K,update:K,leave:{opacity:0},config:ee,immediate:!Y});return p.jsxs(et.g,{transform:Q.transform,"aria-hidden":O,children:[W(function(Z,G,F,re){return C.createElement(y,zr({tickIndex:re,format:H,rotate:g,textBaseline:T,textAnchor:L,truncateTickAt:x,animatedProps:Z},G,_?{onClick:_}:{}))}),p.jsx(et.line,{style:k.axis.domain.line,x1:0,x2:Q.lineX2,y1:0,y2:Q.lineY2}),I]})},M1e=S.memo($1e),I$=["top","right","bottom","left"],A$=S.memo(function(e){var t=e.xScale,n=e.yScale,r=e.width,i=e.height,o={top:e.top,right:e.right,bottom:e.bottom,left:e.left};return p.jsx(p.Fragment,{children:I$.map(function(a){var s=o[a];if(!s)return null;var l=a==="top"||a==="bottom";return p.jsx(M1e,zr({},s,{axis:l?"x":"y",x:a==="right"?r:0,y:a==="bottom"?i:0,scale:l?t:n,length:l?r:i,ticksPosition:a==="top"||a==="left"?"before":"after",truncateTickAt:s.truncateTickAt}),a)})})}),_1e=S.memo(function(e){var t=e.animatedProps,n=Wt();return p.jsx(et.line,zr({},t,n.grid.line))}),np=S.memo(function(e){var t=e.lines,n=Fn(),r=n.animate,i=n.config,o=yr(t,{keys:function(a){return a.key},initial:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},from:function(a){return{opacity:0,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},enter:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},update:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},leave:{opacity:0},config:i,immediate:!r});return p.jsx("g",{children:o(function(a,s){return S.createElement(_1e,zr({},s,{key:s.key,animatedProps:a}))})})}),N$=S.memo(function(e){var t=e.width,n=e.height,r=e.xScale,i=e.yScale,o=e.xValues,a=e.yValues,s=S.useMemo(function(){return!!r&&L4({width:t,height:n,scale:r,axis:"x",values:o})},[r,o,t,n]),l=S.useMemo(function(){return!!i&&L4({width:t,height:n,scale:i,axis:"y",values:a})},[n,t,i,a]);return p.jsxs(p.Fragment,{children:[s&&p.jsx(np,{lines:s}),l&&p.jsx(np,{lines:l})]})}),E1e=function(e,t){var n,r=t.axis,i=t.scale,o=t.x,a=o===void 0?0:o,s=t.y,l=s===void 0?0:s,c=t.length,u=t.ticksPosition,d=t.tickValues,f=t.tickSize,h=f===void 0?5:f,m=t.tickPadding,g=m===void 0?5:m,v=t.tickRotation,b=v===void 0?0:v,y=t.format,x=t.legend,$=t.legendPosition,w=$===void 0?"end":$,M=t.legendOffset,V=M===void 0?0:M,E=t.theme,_=j$({axis:r,scale:i,ticksPosition:u,tickValues:d,tickSize:h,tickPadding:g,tickRotation:b,engine:"canvas"}),O=_.ticks,k=_.textAlign,A=_.textBaseline;e.save(),e.translate(a,l),e.textAlign=k,e.textBaseline=A;var H=E.axis.ticks.text;e.font=(H.fontWeight?H.fontWeight+" ":"")+H.fontSize+"px "+H.fontFamily,((n=E.axis.domain.line.strokeWidth)!=null?n:0)>0&&(e.lineWidth=Number(E.axis.domain.line.strokeWidth),e.lineCap="square",E.axis.domain.line.stroke&&(e.strokeStyle=E.axis.domain.line.stroke),e.beginPath(),e.moveTo(0,0),e.lineTo(r==="x"?c:0,r==="x"?0:c),e.stroke());var R=typeof y=="function"?y:function(P){return""+P};if(O.forEach(function(P){var N;((N=E.axis.ticks.line.strokeWidth)!=null?N:0)>0&&(e.lineWidth=Number(E.axis.ticks.line.strokeWidth),e.lineCap="square",E.axis.ticks.line.stroke&&(e.strokeStyle=E.axis.ticks.line.stroke),e.beginPath(),e.moveTo(P.x,P.y),e.lineTo(P.x+P.lineX,P.y+P.lineY),e.stroke());var z=R(P.value);e.save(),e.translate(P.x+P.textX,P.y+P.textY),e.rotate(Dr(b)),H.outlineWidth>0&&(e.strokeStyle=H.outlineColor,e.lineWidth=2*H.outlineWidth,e.lineJoin="round",e.strokeText(""+z,0,0)),E.axis.ticks.text.fill&&(e.fillStyle=H.fill),e.fillText(""+z,0,0),e.restore()}),x!==void 0){var j=0,L=0,T=0,I="center";r==="y"?(T=-90,j=V,w==="start"?(I="start",L=c):w==="middle"?(I="center",L=c/2):w==="end"&&(I="end")):(L=V,w==="start"?I="start":w==="middle"?(I="center",j=c/2):w==="end"&&(I="end",j=c)),e.translate(j,L),e.rotate(Dr(T)),e.font=(E.axis.legend.text.fontWeight?E.axis.legend.text.fontWeight+" ":"")+E.axis.legend.text.fontSize+"px "+E.axis.legend.text.fontFamily,E.axis.legend.text.fill&&(e.fillStyle=E.axis.legend.text.fill),e.textAlign=I,e.textBaseline="middle",e.fillText(x,0,0)}e.restore()},F$=function(e,t){var n=t.xScale,r=t.yScale,i=t.width,o=t.height,a=t.top,s=t.right,l=t.bottom,c=t.left,u=t.theme,d={top:a,right:s,bottom:l,left:c};I$.forEach(function(f){var h=d[f];if(!h)return null;var m=f==="top"||f==="bottom",g=f==="top"||f==="left"?"before":"after",v=m?n:r,b=P$(h.format,v);E1e(e,zr({},h,{axis:m?"x":"y",x:f==="right"?i:0,y:f==="bottom"?o:0,scale:v,format:b,length:m?i:o,ticksPosition:g,theme:u}))})},yd=function(e,t){var n=t.width,r=t.height,i=t.scale,o=t.axis,a=t.values;L4({width:n,height:r,scale:i,axis:o,values:a}).forEach(function(s){e.beginPath(),e.moveTo(s.x1,s.y1),e.lineTo(s.x2,s.y2),e.stroke()})},O1e=E$;function H1e(e,t){var n=[];return O1e(e,function(r,i,o){t(r,i,o)&&n.push(r)}),n}var V1e=H1e,T1e=jS,R1e=V1e,k1e=$h,L1e=Cr;function j1e(e,t){var n=L1e(e)?T1e:R1e;return n(e,k1e(t))}var P1e=j1e;const Mh=xn(P1e);var I1e=po,A1e=Gr,N1e="[object Number]";function F1e(e){return typeof e=="number"||A1e(e)&&I1e(e)==N1e}var D1e=F1e;const Ha=xn(D1e);function z1e(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}var D$=z1e,B1e=b1,W1e=D$;function Z1e(e,t){return t.length<2?e:B1e(e,W1e(t,0,-1))}var U1e=Z1e,q1e=cl,G1e=Pw,Y1e=U1e,K1e=ul;function X1e(e,t){return t=q1e(t,e),e=Y1e(e,t),e==null||delete e[K1e(G1e(t))]}var Q1e=X1e,J1e=R6;function eue(e){return J1e(e)?void 0:e}var tue=eue,nue=mf,rue=b$,iue=Q1e,oue=cl,aue=ll,sue=tue,lue=TS,cue=g$,uue=1,due=2,fue=4,hue=lue(function(e,t){var n={};if(e==null)return n;var r=!1;t=nue(t,function(o){return o=oue(o,e),r||(r=o.length>1),o}),aue(e,cue(e),n),r&&(n=rue(n,uue|due|fue,sue));for(var i=t.length;i--;)iue(n,t[i]);return n}),gue=hue;const Ya=xn(gue);function Io(){return Io=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Io.apply(this,arguments)}var j4={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},vue=function(e){var t=typeof e;return S.isValidElement(e)||t==="string"||t==="function"||t==="object"},mue=function(e){var t=typeof e;return t==="string"||t==="function"},Yc=function(e){return e.type==="circle"},P4=function(e){return e.type==="dot"},Kc=function(e){return e.type==="rect"},pue=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return n.reduce(function(o,a){var s=a.offset||0;return[].concat(o,Mh(t,a.match).map(function(l){var c=r(l),u=i(l);return(Yc(a)||Kc(a))&&(u.size=u.size+2*s,u.width=u.width+2*s,u.height=u.height+2*s),Io({},Ya(a,["match","offset"]),c,u,{size:a.size||u.size,datum:l})}))},[])},bue=function(e,t,n,r){var i=Math.atan2(r-t,n-e);return eie(Lf(i))},yue=function(e){var t,n,r=e.x,i=e.y,o=e.noteX,a=e.noteY,s=e.noteWidth,l=s===void 0?j4.noteWidth:s,c=e.noteTextOffset,u=c===void 0?j4.noteTextOffset:c;if(Ha(o))t=r+o;else{if(o.abs===void 0)throw new Error("noteX should be either a number or an object containing an 'abs' property");t=o.abs}if(Ha(a))n=i+a;else{if(a.abs===void 0)throw new Error("noteY should be either a number or an object containing an 'abs' property");n=a.abs}var d=r,f=i,h=bue(r,i,t,n);if(Yc(e)){var m=ma(Dr(h),e.size/2);d+=m.x,f+=m.y}if(Kc(e)){var g=Math.round((h+90)/45)%8;g===0&&(f-=e.height/2),g===1&&(d+=e.width/2,f-=e.height/2),g===2&&(d+=e.width/2),g===3&&(d+=e.width/2,f+=e.height/2),g===4&&(f+=e.height/2),g===5&&(d-=e.width/2,f+=e.height/2),g===6&&(d-=e.width/2),g===7&&(d-=e.width/2,f-=e.height/2)}var v=t,b=t;return(h+90)%360>180?(v-=l,b-=l):b+=l,{points:[[d,f],[t,n],[b,n]],text:[v,n-u],angle:h+90}},Cue=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return S.useMemo(function(){return pue({data:t,annotations:n,getPosition:r,getDimensions:i})},[t,n,r,i])},xue=function(e){return S.useMemo(function(){return yue(e)},[e])},wue=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,o=Wt(),a=Fn(),s=a.animate,l=a.config,c=Xt({x:n,y:r,config:l,immediate:!s});return typeof i=="function"?S.createElement(i,{x:n,y:r,datum:t}):p.jsxs(p.Fragment,{children:[o.annotations.text.outlineWidth>0&&p.jsx(et.text,{x:c.x,y:c.y,style:Io({},o.annotations.text,{strokeLinejoin:"round",strokeWidth:2*o.annotations.text.outlineWidth,stroke:o.annotations.text.outlineColor}),children:i}),p.jsx(et.text,{x:c.x,y:c.y,style:Ya(o.annotations.text,["outlineWidth","outlineColor"]),children:i})]})},rp=function(e){var t=e.points,n=e.isOutline,r=n!==void 0&&n,i=Wt(),o=S.useMemo(function(){var l=t[0];return t.slice(1).reduce(function(c,u){return c+" L"+u[0]+","+u[1]},"M"+l[0]+","+l[1])},[t]),a=kf(o);if(r&&i.annotations.link.outlineWidth<=0)return null;var s=Io({},i.annotations.link);return r&&(s.strokeLinecap="square",s.strokeWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,s.stroke=i.annotations.link.outlineColor,s.opacity=i.annotations.link.outlineOpacity),p.jsx(et.path,{fill:"none",d:a,style:s})},Sue=function(e){var t=e.x,n=e.y,r=e.size,i=Wt(),o=Fn(),a=o.animate,s=o.config,l=Xt({x:t,y:n,radius:r/2,config:s,immediate:!a});return p.jsxs(p.Fragment,{children:[i.annotations.outline.outlineWidth>0&&p.jsx(et.circle,{cx:l.x,cy:l.y,r:l.radius,style:Io({},i.annotations.outline,{fill:"none",strokeWidth:i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,stroke:i.annotations.outline.outlineColor,opacity:i.annotations.outline.outlineOpacity})}),p.jsx(et.circle,{cx:l.x,cy:l.y,r:l.radius,style:i.annotations.outline})]})},$ue=function(e){var t=e.x,n=e.y,r=e.size,i=r===void 0?j4.dotSize:r,o=Wt(),a=Fn(),s=a.animate,l=a.config,c=Xt({x:t,y:n,radius:i/2,config:l,immediate:!s});return p.jsxs(p.Fragment,{children:[o.annotations.outline.outlineWidth>0&&p.jsx(et.circle,{cx:c.x,cy:c.y,r:c.radius,style:Io({},o.annotations.outline,{fill:"none",strokeWidth:2*o.annotations.outline.outlineWidth,stroke:o.annotations.outline.outlineColor,opacity:o.annotations.outline.outlineOpacity})}),p.jsx(et.circle,{cx:c.x,cy:c.y,r:c.radius,style:o.annotations.symbol})]})},Mue=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,o=e.borderRadius,a=o===void 0?6:o,s=Wt(),l=Fn(),c=l.animate,u=l.config,d=Xt({x:t-r/2,y:n-i/2,width:r,height:i,config:u,immediate:!c});return p.jsxs(p.Fragment,{children:[s.annotations.outline.outlineWidth>0&&p.jsx(et.rect,{x:d.x,y:d.y,rx:a,ry:a,width:d.width,height:d.height,style:Io({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),p.jsx(et.rect,{x:d.x,y:d.y,rx:a,ry:a,width:d.width,height:d.height,style:s.annotations.outline})]})},_ue=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,o=xue(e);if(!vue(i))throw new Error("note should be a valid react element");return p.jsxs(p.Fragment,{children:[p.jsx(rp,{points:o.points,isOutline:!0}),Yc(e)&&p.jsx(Sue,{x:n,y:r,size:e.size}),P4(e)&&p.jsx($ue,{x:n,y:r,size:e.size}),Kc(e)&&p.jsx(Mue,{x:n,y:r,width:e.width,height:e.height,borderRadius:e.borderRadius}),p.jsx(rp,{points:o.points}),p.jsx(wue,{datum:t,x:o.text[0],y:o.text[1],note:i})]})},ip=function(e,t){t.forEach(function(n,r){var i=n[0],o=n[1];r===0?e.moveTo(i,o):e.lineTo(i,o)})},Eue=function(e,t){var n=t.annotations,r=t.theme;n.length!==0&&(e.save(),n.forEach(function(i){if(!mue(i.note))throw new Error("note is invalid for canvas implementation");r.annotations.link.outlineWidth>0&&(e.lineCap="square",e.strokeStyle=r.annotations.link.outlineColor,e.lineWidth=r.annotations.link.strokeWidth+2*r.annotations.link.outlineWidth,e.beginPath(),ip(e,i.computed.points),e.stroke(),e.lineCap="butt"),Yc(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),P4(i)&&r.annotations.symbol.outlineWidth>0&&(e.strokeStyle=r.annotations.symbol.outlineColor,e.lineWidth=2*r.annotations.symbol.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Kc(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),e.strokeStyle=r.annotations.link.stroke,e.lineWidth=r.annotations.link.strokeWidth,e.beginPath(),ip(e,i.computed.points),e.stroke(),Yc(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),P4(i)&&(e.fillStyle=r.annotations.symbol.fill,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.fill()),Kc(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),typeof i.note=="function"?i.note(e,{datum:i.datum,x:i.computed.text[0],y:i.computed.text[1],theme:r}):(e.font=r.annotations.text.fontSize+"px "+r.annotations.text.fontFamily,e.textAlign="left",e.textBaseline="alphabetic",e.fillStyle=r.annotations.text.fill,e.strokeStyle=r.annotations.text.outlineColor,e.lineWidth=2*r.annotations.text.outlineWidth,r.annotations.text.outlineWidth>0&&(e.lineJoin="round",e.strokeText(i.note,i.computed.text[0],i.computed.text[1]),e.lineJoin="miter"),e.fillText(i.note,i.computed.text[0],i.computed.text[1]))}),e.restore())};const lo=11102230246251565e-32,nr=134217729,Oue=(3+8*lo)*lo;function M2(e,t,n,r,i){let o,a,s,l,c=t[0],u=r[0],d=0,f=0;u>c==u>-c?(o=c,c=t[++d]):(o=u,u=r[++f]);let h=0;if(d<e&&f<n)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=t[++d]):(a=u+o,s=o-(a-u),u=r[++f]),o=a,s!==0&&(i[h++]=s);d<e&&f<n;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++d]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f]),o=a,s!==0&&(i[h++]=s);for(;d<e;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++d],o=a,s!==0&&(i[h++]=s);for(;f<n;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f],o=a,s!==0&&(i[h++]=s);return(o!==0||h===0)&&(i[h++]=o),h}function Hue(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function E1(e){return new Float64Array(e)}const Vue=(3+16*lo)*lo,Tue=(2+12*lo)*lo,Rue=(9+64*lo)*lo*lo,ds=E1(4),op=E1(8),ap=E1(12),sp=E1(16),dr=E1(4);function kue(e,t,n,r,i,o,a){let s,l,c,u,d,f,h,m,g,v,b,y,x,$,w,M,V,E;const _=e-i,O=n-i,k=t-o,A=r-o;$=_*A,f=nr*_,h=f-(f-_),m=_-h,f=nr*A,g=f-(f-A),v=A-g,w=m*v-($-h*g-m*g-h*v),M=k*O,f=nr*k,h=f-(f-k),m=k-h,f=nr*O,g=f-(f-O),v=O-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,ds[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,ds[1]=x-(b+d)+(d-M),E=y+b,d=E-y,ds[2]=y-(E-d)+(b-d),ds[3]=E;let H=Hue(4,ds),R=Tue*a;if(H>=R||-H>=R||(d=e-_,s=e-(_+d)+(d-i),d=n-O,c=n-(O+d)+(d-i),d=t-k,l=t-(k+d)+(d-o),d=r-A,u=r-(A+d)+(d-o),s===0&&l===0&&c===0&&u===0)||(R=Rue*a+Oue*Math.abs(H),H+=_*u+A*s-(k*c+O*l),H>=R||-H>=R))return H;$=s*A,f=nr*s,h=f-(f-s),m=s-h,f=nr*A,g=f-(f-A),v=A-g,w=m*v-($-h*g-m*g-h*v),M=l*O,f=nr*l,h=f-(f-l),m=l-h,f=nr*O,g=f-(f-O),v=O-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const j=M2(4,ds,4,dr,op);$=_*u,f=nr*_,h=f-(f-_),m=_-h,f=nr*u,g=f-(f-u),v=u-g,w=m*v-($-h*g-m*g-h*v),M=k*c,f=nr*k,h=f-(f-k),m=k-h,f=nr*c,g=f-(f-c),v=c-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const L=M2(j,op,4,dr,ap);$=s*u,f=nr*s,h=f-(f-s),m=s-h,f=nr*u,g=f-(f-u),v=u-g,w=m*v-($-h*g-m*g-h*v),M=l*c,f=nr*l,h=f-(f-l),m=l-h,f=nr*c,g=f-(f-c),v=c-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const T=M2(L,ap,4,dr,sp);return sp[T-1]}function uu(e,t,n,r,i,o){const a=(t-o)*(n-i),s=(e-i)*(r-o),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=Vue*c?l:-kue(e,t,n,r,i,o,c)}const lp=Math.pow(2,-52),du=new Uint32Array(512);class Cd{static from(t,n=Aue,r=Nue){const i=t.length,o=new Float64Array(i*2);for(let a=0;a<i;a++){const s=t[a];o[2*a]=n(s),o[2*a+1]=r(s)}return new Cd(o)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,a=t.length>>1;let s=1/0,l=1/0,c=-1/0,u=-1/0;for(let _=0;_<a;_++){const O=t[2*_],k=t[2*_+1];O<s&&(s=O),k<l&&(l=k),O>c&&(c=O),k>u&&(u=k),this._ids[_]=_}const d=(s+c)/2,f=(l+u)/2;let h,m,g;for(let _=0,O=1/0;_<a;_++){const k=_2(d,f,t[2*_],t[2*_+1]);k<O&&(h=_,O=k)}const v=t[2*h],b=t[2*h+1];for(let _=0,O=1/0;_<a;_++){if(_===h)continue;const k=_2(v,b,t[2*_],t[2*_+1]);k<O&&k>0&&(m=_,O=k)}let y=t[2*m],x=t[2*m+1],$=1/0;for(let _=0;_<a;_++){if(_===h||_===m)continue;const O=Pue(v,b,y,x,t[2*_],t[2*_+1]);O<$&&(g=_,$=O)}let w=t[2*g],M=t[2*g+1];if($===1/0){for(let k=0;k<a;k++)this._dists[k]=t[2*k]-t[0]||t[2*k+1]-t[1];xs(this._ids,this._dists,0,a-1);const _=new Uint32Array(a);let O=0;for(let k=0,A=-1/0;k<a;k++){const H=this._ids[k],R=this._dists[H];R>A&&(_[O++]=H,A=R)}this.hull=_.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(uu(v,b,y,x,w,M)<0){const _=m,O=y,k=x;m=g,y=w,x=M,g=_,w=O,M=k}const V=Iue(v,b,y,x,w,M);this._cx=V.x,this._cy=V.y;for(let _=0;_<a;_++)this._dists[_]=_2(t[2*_],t[2*_+1],V.x,V.y);xs(this._ids,this._dists,0,a-1),this._hullStart=h;let E=3;r[h]=n[g]=m,r[m]=n[h]=g,r[g]=n[m]=h,i[h]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(v,b)]=h,o[this._hashKey(y,x)]=m,o[this._hashKey(w,M)]=g,this.trianglesLen=0,this._addTriangle(h,m,g,-1,-1,-1);for(let _=0,O,k;_<this._ids.length;_++){const A=this._ids[_],H=t[2*A],R=t[2*A+1];if(_>0&&Math.abs(H-O)<=lp&&Math.abs(R-k)<=lp||(O=H,k=R,A===h||A===m||A===g))continue;let j=0;for(let N=0,z=this._hashKey(H,R);N<this._hashSize&&(j=o[(z+N)%this._hashSize],!(j!==-1&&j!==r[j]));N++);j=n[j];let L=j,T;for(;T=r[L],uu(H,R,t[2*L],t[2*L+1],t[2*T],t[2*T+1])>=0;)if(L=T,L===j){L=-1;break}if(L===-1)continue;let I=this._addTriangle(L,A,r[L],-1,-1,i[L]);i[A]=this._legalize(I+2),i[L]=I,E++;let P=r[L];for(;T=r[P],uu(H,R,t[2*P],t[2*P+1],t[2*T],t[2*T+1])<0;)I=this._addTriangle(P,A,T,i[A],-1,i[P]),i[A]=this._legalize(I+2),r[P]=P,E--,P=T;if(L===j)for(;T=n[L],uu(H,R,t[2*T],t[2*T+1],t[2*L],t[2*L+1])<0;)I=this._addTriangle(T,A,L,-1,i[L],i[T]),this._legalize(I+2),i[T]=I,r[L]=L,E--,L=T;this._hullStart=n[A]=L,r[L]=n[P]=A,r[A]=P,o[this._hashKey(H,R)]=A,o[this._hashKey(t[2*L],t[2*L+1])]=L}this.hull=new Uint32Array(E);for(let _=0,O=this._hullStart;_<E;_++)this.hull[_]=O,O=r[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(Lue(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:i}=this;let o=0,a=0;for(;;){const s=r[t],l=t-t%3;if(a=l+(t+2)%3,s===-1){if(o===0)break;t=du[--o];continue}const c=s-s%3,u=l+(t+1)%3,d=c+(s+2)%3,f=n[a],h=n[t],m=n[u],g=n[d];if(jue(i[2*f],i[2*f+1],i[2*h],i[2*h+1],i[2*m],i[2*m+1],i[2*g],i[2*g+1])){n[t]=g,n[s]=f;const b=r[d];if(b===-1){let x=this._hullStart;do{if(this._hullTri[x]===d){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,b),this._link(s,r[a]),this._link(a,d);const y=c+(s+1)%3;o<du.length&&(du[o++]=y)}else{if(o===0)break;t=du[--o]}}return a}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,a){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=n,this._triangles[s+2]=r,this._link(s,i),this._link(s+1,o),this._link(s+2,a),this.trianglesLen+=3,s}}function Lue(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function _2(e,t,n,r){const i=e-n,o=t-r;return i*i+o*o}function jue(e,t,n,r,i,o,a,s){const l=e-a,c=t-s,u=n-a,d=r-s,f=i-a,h=o-s,m=l*l+c*c,g=u*u+d*d,v=f*f+h*h;return l*(d*v-g*h)-c*(u*v-g*f)+m*(u*h-d*f)<0}function Pue(e,t,n,r,i,o){const a=n-e,s=r-t,l=i-e,c=o-t,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l),h=(c*u-s*d)*f,m=(a*d-l*u)*f;return h*h+m*m}function Iue(e,t,n,r,i,o){const a=n-e,s=r-t,l=i-e,c=o-t,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l),h=e+(c*u-s*d)*f,m=t+(a*d-l*u)*f;return{x:h,y:m}}function xs(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const o=e[i],a=t[o];let s=i-1;for(;s>=n&&t[e[s]]>a;)e[s+1]=e[s--];e[s+1]=o}else{const i=n+r>>1;let o=n+1,a=r;ql(e,i,o),t[e[n]]>t[e[r]]&&ql(e,n,r),t[e[o]]>t[e[r]]&&ql(e,o,r),t[e[n]]>t[e[o]]&&ql(e,n,o);const s=e[o],l=t[s];for(;;){do o++;while(t[e[o]]<l);do a--;while(t[e[a]]>l);if(a<o)break;ql(e,o,a)}e[n+1]=e[a],e[a]=s,r-o+1>=a-n?(xs(e,t,o,r),xs(e,t,n,a-1)):(xs(e,t,n,a-1),xs(e,t,o,r))}}function ql(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Aue(e){return e[0]}function Nue(e){return e[1]}const cp=1e-6;class da{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>cp||Math.abs(this._y1-o)>cp)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class I4{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class Fue{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let o,a;const s=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let g=0,v=0,b=r.length,y,x;g<b;g+=3,v+=2){const $=r[g]*2,w=r[g+1]*2,M=r[g+2]*2,V=t[$],E=t[$+1],_=t[w],O=t[w+1],k=t[M],A=t[M+1],H=_-V,R=O-E,j=k-V,L=A-E,T=(H*L-R*j)*2;if(Math.abs(T)<1e-9){if(o===void 0){o=a=0;for(const P of n)o+=t[P*2],a+=t[P*2+1];o/=n.length,a/=n.length}const I=1e9*Math.sign((o-V)*L-(a-E)*j);y=(V+k)/2-I*L,x=(E+A)/2+I*j}else{const I=1/T,P=H*H+R*R,N=j*j+L*L;y=V+(L*P-R*N)*I,x=E+(H*N-j*P)*I}s[v]=y,s[v+1]=x}let l=n[n.length-1],c,u=l*4,d,f=t[2*l],h,m=t[2*l+1];i.fill(0);for(let g=0;g<n.length;++g)l=n[g],c=u,d=f,h=m,u=l*4,f=t[2*l],m=t[2*l+1],i[c+2]=i[u]=h-m,i[c+3]=i[u+1]=f-d}render(t){const n=t==null?t=new da:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:a,vectors:s}=this;if(o.length<=1)return null;for(let u=0,d=r.length;u<d;++u){const f=r[u];if(f<u)continue;const h=Math.floor(u/3)*2,m=Math.floor(f/3)*2,g=a[h],v=a[h+1],b=a[m],y=a[m+1];this._renderSegment(g,v,b,y,t)}let l,c=o[o.length-1];for(let u=0;u<o.length;++u){l=c,c=o[u];const d=Math.floor(i[c]/3)*2,f=a[d],h=a[d+1],m=l*4,g=this._project(f,h,s[m+2],s[m+3]);g&&this._renderSegment(f,h,g[0],g[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new da:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new da:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let a=2;a<o;a+=2)(i[a]!==i[a-2]||i[a+1]!==i[a-1])&&n.lineTo(i[a],i[a+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new I4;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let a;const s=this._regioncode(t,n),l=this._regioncode(r,i);s===0&&l===0?(o.moveTo(t,n),o.lineTo(r,i)):(a=this._clipSegment(t,n,r,i,s,l))&&(o.moveTo(a[0],a[1]),o.lineTo(a[2],a[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const i=this._clip(r);if(i){e:for(let o=0,a=n.length;o<a;o+=2)for(let s=0,l=i.length;s<l;s+=2)if(n[o]===i[s]&&n[o+1]===i[s+1]&&n[(o+2)%a]===i[(s+l-2)%l]&&n[(o+3)%a]===i[(s+l-1)%l]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,a=r[t];if(a===-1)return null;const s=[];let l=a;do{const c=Math.floor(l/3);if(s.push(n[c*2],n[c*2+1]),l=l%3===2?l-2:l+1,o[l]!==t)break;l=i[l]}while(l!==a&&l!==-1);return s}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let i=null,o,a,s=n[r-2],l=n[r-1],c,u=this._regioncode(s,l),d,f=0;for(let h=0;h<r;h+=2)if(o=s,a=l,s=n[h],l=n[h+1],c=u,u=this._regioncode(s,l),c===0&&u===0)d=f,f=0,i?i.push(s,l):i=[s,l];else{let m,g,v,b,y;if(c===0){if((m=this._clipSegment(o,a,s,l,c,u))===null)continue;[g,v,b,y]=m}else{if((m=this._clipSegment(s,l,o,a,u,c))===null)continue;[b,y,g,v]=m,d=f,f=this._edgecode(g,v),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(g,v):i=[g,v]}d=f,f=this._edgecode(b,y),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(b,y):i=[b,y]}if(i)d=f,f=this._edgecode(i[0],i[1]),d&&f&&this._edge(t,d,f,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,a){const s=o<a;for(s&&([t,n,r,i,o,a]=[r,i,t,n,a,o]);;){if(o===0&&a===0)return s?[r,i,t,n]:[t,n,r,i];if(o&a)return null;let l,c,u=o||a;u&8?(l=t+(r-t)*(this.ymax-n)/(i-n),c=this.ymax):u&4?(l=t+(r-t)*(this.ymin-n)/(i-n),c=this.ymin):u&2?(c=n+(i-n)*(this.xmax-t)/(r-t),l=this.xmax):(c=n+(i-n)*(this.xmin-t)/(r-t),l=this.xmin),o?(t=l,n=c,o=this._regioncode(t,n)):(r=l,i=c,a=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,a){let s=Array.from(n),l;if((l=this._project(s[0],s[1],r,i))&&s.unshift(l[0],l[1]),(l=this._project(s[s.length-2],s[s.length-1],o,a))&&s.push(l[0],l[1]),s=this._clipFinite(t,s))for(let c=0,u=s.length,d,f=this._edgecode(s[u-2],s[u-1]);c<u;c+=2)d=f,f=this._edgecode(s[c],s[c+1]),d&&f&&(c=this._edge(t,d,f,s,c),u=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,n,r,i,o){for(;n!==r;){let a,s;switch(n){case 5:n=4;continue;case 4:n=6,a=this.xmax,s=this.ymin;break;case 6:n=2;continue;case 2:n=10,a=this.xmax,s=this.ymax;break;case 10:n=8;continue;case 8:n=9,a=this.xmin,s=this.ymax;break;case 9:n=1;continue;case 1:n=5,a=this.xmin,s=this.ymin;break}(i[o]!==a||i[o+1]!==s)&&this.contains(t,a,s)&&(i.splice(o,0,a,s),o+=2)}return o}_project(t,n,r,i){let o=1/0,a,s,l;if(i<0){if(n<=this.ymin)return null;(a=(this.ymin-n)/i)<o&&(l=this.ymin,s=t+(o=a)*r)}else if(i>0){if(n>=this.ymax)return null;(a=(this.ymax-n)/i)<o&&(l=this.ymax,s=t+(o=a)*r)}if(r>0){if(t>=this.xmax)return null;(a=(this.xmax-t)/r)<o&&(s=this.xmax,l=n+(o=a)*i)}else if(r<0){if(t<=this.xmin)return null;(a=(this.xmin-t)/r)<o&&(s=this.xmin,l=n+(o=a)*i)}return[s,l]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}}const Due=2*Math.PI,fs=Math.pow;function zue(e){return e[0]}function Bue(e){return e[1]}function Wue(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const i=2*t[r],o=2*t[r+1],a=2*t[r+2];if((n[a]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[a+1]-n[i+1])>1e-10)return!1}return!0}function Zue(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class _h{static from(t,n=zue,r=Bue,i){return new _h("length"in t?Uue(t,n,r,i):Float64Array.from(que(t,n,r,i)))}constructor(t){this._delaunator=new Cd(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&Wue(t)){this.collinear=Int32Array.from({length:n.length/2},(f,h)=>h).sort((f,h)=>n[2*f]-n[2*h]||n[2*f+1]-n[2*h+1]);const l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[n[2*l],n[2*l+1],n[2*c],n[2*c+1]],d=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let f=0,h=n.length/2;f<h;++f){const m=Zue(n[2*f],n[2*f+1],d);n[2*f]=m[0],n[2*f+1]=m[1]}this._delaunator=new Cd(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),s=this._hullIndex.fill(-1);for(let l=0,c=r.length;l<c;++l){const u=o[l%3===2?l-2:l+1];(r[l]===-1||a[u]===-1)&&(a[u]=l)}for(let l=0,c=i.length;l<c;++l)s[i[l]]=l;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],a[i[0]]=1,i.length===2&&(a[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Fue(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:a,collinear:s}=this;if(s){const d=s.indexOf(t);d>0&&(yield s[d-1]),d<s.length-1&&(yield s[d+1]);return}const l=n[t];if(l===-1)return;let c=l,u=-1;do{if(yield u=a[c],c=c%3===2?c-2:c+1,a[c]!==t)return;if(c=o[c],c===-1){const d=r[(i[t]+1)%r.length];d!==u&&(yield d);return}}while(c!==l)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=r;let o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){const{inedges:i,hull:o,_hullIndex:a,halfedges:s,triangles:l,points:c}=this;if(i[t]===-1||!c.length)return(t+1)%(c.length>>1);let u=t,d=fs(n-c[t*2],2)+fs(r-c[t*2+1],2);const f=i[t];let h=f;do{let m=l[h];const g=fs(n-c[m*2],2)+fs(r-c[m*2+1],2);if(g<d&&(d=g,u=m),h=h%3===2?h-2:h+1,l[h]!==t)break;if(h=s[h],h===-1){if(h=o[(a[t]+1)%o.length],h!==m&&fs(n-c[h*2],2)+fs(r-c[h*2+1],2)<d)return h;break}}while(h!==f);return u}render(t){const n=t==null?t=new da:void 0,{points:r,halfedges:i,triangles:o}=this;for(let a=0,s=i.length;a<s;++a){const l=i[a];if(l<a)continue;const c=o[a]*2,u=o[l]*2;t.moveTo(r[c],r[c+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new da:void 0,{points:i}=this;for(let o=0,a=i.length;o<a;o+=2){const s=i[o],l=i[o+1];t.moveTo(s+n,l),t.arc(s,l,n,0,Due)}return r&&r.value()}renderHull(t){const n=t==null?t=new da:void 0,{hull:r,points:i}=this,o=r[0]*2,a=r.length;t.moveTo(i[o],i[o+1]);for(let s=1;s<a;++s){const l=2*r[s];t.lineTo(i[l],i[l+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new I4;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new da:void 0,{points:i,triangles:o}=this,a=o[t*=3]*2,s=o[t+1]*2,l=o[t+2]*2;return n.moveTo(i[a],i[a+1]),n.lineTo(i[s],i[s+1]),n.lineTo(i[l],i[l+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new I4;return this.renderTriangle(t,n),n.value()}}function Uue(e,t,n,r){const i=e.length,o=new Float64Array(i*2);for(let a=0;a<i;++a){const s=e[a];o[a*2]=t.call(r,s,a,e),o[a*2+1]=n.call(r,s,a,e)}return o}function*que(e,t,n,r){let i=0;for(const o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}var Eh=function(e){return[e.x,e.y]},O1=WS,z$="cursor",B$="top",Gue=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?Eh:n,i=e.margin,o=i===void 0?O1:i;return t.map(function(a){var s=r(a),l=s[0],c=s[1];return[l+o.left,c+o.top]})},Yue=function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,o=i===void 0?O1:i,a=e.debug,s=_h.from(t),l=a?s.voronoi([0,0,o.left+n+o.right,o.top+r+o.bottom]):void 0;return{points:t,delaunay:s,voronoi:l}},Oh=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?Eh:n,i=e.width,o=e.height,a=e.margin,s=a===void 0?O1:a,l=e.debug;return S.useMemo(function(){return Yue({points:Gue({points:t,margin:s,getNodePosition:r}),width:i,height:o,margin:s,debug:l})},[t,i,o,s,l])},Kue=function(e){var t=e.elementRef,n=e.nodes,r=e.getNodePosition,i=r===void 0?Eh:r,o=e.delaunay,a=e.setCurrent,s=e.margin,l=s===void 0?O1:s,c=e.detectionRadius,u=c===void 0?1/0:c,d=e.isInteractive,f=d===void 0||d,h=e.onMouseEnter,m=e.onMouseMove,g=e.onMouseLeave,v=e.onClick,b=e.onTouchStart,y=e.onTouchMove,x=e.onTouchEnd,$=e.enableTouchCrosshair,w=$!==void 0&&$,M=e.tooltip,V=e.tooltipPosition,E=V===void 0?z$:V,_=e.tooltipAnchor,O=_===void 0?B$:_,k=S.useState(null),A=k[0],H=k[1],R=S.useRef(null);S.useEffect(function(){R.current=A},[R,A]);var j=S.useCallback(function(J){if(!t.current)return null;var W=xh(t.current,J),Z=W[0],G=W[1],F=o.find(Z,G),re=F!==void 0?n[F]:null;if(re&&u!==1/0){var B=i(re),ie=B[0],oe=B[1];uie(Z,G,ie+l.left,oe+l.top)>u&&(F=null,re=null)}return F===null||re===null?null:[F,re]},[t,o,n,i,l,u]),L=ci(),T=L.showTooltipAt,I=L.showTooltipFromEvent,P=L.hideTooltip,N=S.useMemo(function(){if(M)return E==="cursor"?function(J,W){I(M(J),W,O)}:function(J){var W=i(J),Z=W[0],G=W[1];T(M(J),[Z+l.left,G+l.top],O)}},[T,I,M,E,O,i,l]),z=S.useCallback(function(J){var W=j(J);if(H(W),a==null||a(W?W[1]:null),W){var Z=W[1];N==null||N(Z,J),h==null||h(W[1],J)}},[j,H,a,N,h]),U=S.useCallback(function(J){var W=j(J);if(H(W),W){var Z=W[0],G=W[1];if(a==null||a(G),N==null||N(G,J),R.current){var F=R.current,re=F[0],B=F[1];Z!==re?g==null||g(B,J):m==null||m(G,J)}else h==null||h(G,J)}else a==null||a(null),P==null||P(),R.current&&(g==null||g(R.current[1],J))},[j,H,R,h,m,g,N,P]),q=S.useCallback(function(J){H(null),a==null||a(null),P(),g&&R.current&&g(R.current[1],J)},[H,a,R,P,g]),Y=S.useCallback(function(J){var W=j(J);H(W),W&&(v==null||v(W[1],J))},[j,H,v]),ee=S.useCallback(function(J){var W=j(J);w&&(H(W),a==null||a(W?W[1]:null)),W&&(b==null||b(W[1],J))},[j,H,a,w,b]),Q=S.useCallback(function(J){var W=j(J);w&&(H(W),a==null||a(W?W[1]:null)),W&&(y==null||y(W[1],J))},[j,H,a,w,y]),K=S.useCallback(function(J){w&&(H(null),a==null||a(null)),x&&R.current&&x(R.current[1],J)},[w,H,a,x,R]);return{current:A,handleMouseEnter:f?z:void 0,handleMouseMove:f?U:void 0,handleMouseLeave:f?q:void 0,handleClick:f?Y:void 0,handleTouchStart:f?ee:void 0,handleTouchMove:f?Q:void 0,handleTouchEnd:f?K:void 0}},W$=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.margin,o=i===void 0?O1:i,a=e.getNodePosition,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd,g=e.enableTouchCrosshair,v=g!==void 0&&g,b=e.detectionRadius,y=b===void 0?1/0:b,x=e.tooltip,$=e.tooltipPosition,w=$===void 0?z$:$,M=e.tooltipAnchor,V=M===void 0?B$:M,E=e.debug,_=S.useRef(null),O=Oh({points:t,getNodePosition:a,width:n,height:r,margin:o,debug:E}),k=O.delaunay,A=O.voronoi,H=Kue({elementRef:_,nodes:t,delaunay:k,margin:o,detectionRadius:y,setCurrent:s,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:m,enableTouchCrosshair:v,tooltip:x,tooltipPosition:w,tooltipAnchor:V}),R=H.current,j=H.handleMouseEnter,L=H.handleMouseMove,T=H.handleMouseLeave,I=H.handleClick,P=H.handleTouchStart,N=H.handleTouchMove,z=H.handleTouchEnd,U=S.useMemo(function(){if(E&&A)return A.render()},[E,A]);return p.jsxs("g",{ref:_,transform:"translate("+-o.left+","+-o.top+")",children:[E&&A&&p.jsxs(p.Fragment,{children:[p.jsx("path",{d:U,stroke:"red",strokeWidth:1,opacity:.75}),y<1/0&&p.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:k.renderPoints(void 0,y)}),R&&p.jsx("path",{fill:"pink",opacity:.35,d:A.renderCell(R[0])})]}),p.jsx("rect",{"data-ref":"mesh-interceptor",width:o.left+n+o.right,height:o.top+r+o.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:j,onMouseMove:L,onMouseLeave:T,onTouchStart:P,onTouchMove:N,onTouchEnd:z,onClick:I})]})},Z$=function(e,t){e.save(),e.globalAlpha=.75,e.beginPath(),t.render(e),e.strokeStyle="red",e.lineWidth=1,e.stroke(),e.restore()},U$=function(e,t,n){e.save(),e.globalAlpha=.35,e.beginPath(),t.renderCell(n,e),e.fillStyle="pink",e.fill(),e.restore()};function Hr(){return Hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hr.apply(this,arguments)}function q$(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Xue=function(e){if(typeof e=="function")return e;if(Ha(e))return function(){return e};if(function(n){return Wo(n)}(e)){if(!xf(e.key))throw new Error("symbolSize is invalid, key should be a string pointing to the property to use to determine node size");if(!Array.isArray(e.values)||e.values.length!==2)throw new Error("symbolSize is invalid, values spec should be an array containing two values, min and max");if(!Array.isArray(e.sizes)||e.sizes.length!==2)throw new Error("symbolSize is invalid, sizes spec should be an array containing two values, min and max");var t=Uo().domain([e.values[0],e.values[1]]).range([e.sizes[0],e.sizes[1]]);return function(n){return t(bn(n,e.key))}}throw new Error("nodeSize is invalid, it should be either a function, a number or an object")},G$=function(e){var t,n=e.data,r=e.xScaleSpec,i=e.xFormat,o=e.yScaleSpec,a=e.yFormat,s=e.width,l=e.height,c=e.nodeId,u=e.nodeSize,d=e.colors,f=S.useMemo(function(){return V$(n,r,o,s,l)},[n,r,o,s,l]),h=f.series,m=f.xScale,g=f.yScale,v=jo(i),b=jo(a),y=bi(c),x=S.useMemo(function(){return function(M){var V=M.series,E=M.formatX,_=M.formatY,O=M.getNodeId,k=[];return V.forEach(function(A){A.data.forEach(function(H,R){var j={index:k.length,serieIndex:R,serieId:A.id,x:H.position.x,xValue:H.data.x,formattedX:E(H.data.x),y:H.position.y,yValue:H.data.y,formattedY:_(H.data.y),data:H.data};k.push(Hr({},j,{id:O(j)}))})}),k}({series:h,formatX:v,formatY:b,getNodeId:y})},[h,v,b,y]),$=S.useMemo(function(){return Xue(t)},[t=u]),w=$1(d,"serieId");return{xScale:m,yScale:g,nodes:S.useMemo(function(){return x.map(function(M){return Hr({},M,{size:$(M),color:w({serieId:M.serieId})})})},[x,$,w]),legendData:S.useMemo(function(){return h.map(function(M){return{id:M.id,label:M.id,color:w({serieId:M.id})}})},[h,w])}},Y$=function(e,t){return Cue({data:e,annotations:t,getPosition:function(n){return{x:n.x,y:n.y}},getDimensions:function(n){return{size:n.size,width:n.size,height:n.size}}})},Que=function(e){return e/2},K$={xScale:{type:"linear",min:0,max:"auto"},yScale:{type:"linear",min:0,max:"auto"},enableGridX:!0,enableGridY:!0,axisBottom:{},axisLeft:{},nodeId:function(e){return e.serieId+"."+e.index},nodeSize:9,nodeComponent:function(e){var t=e.node,n=e.style,r=e.blendMode,i=e.isInteractive,o=e.onMouseEnter,a=e.onMouseMove,s=e.onMouseLeave,l=e.onClick,c=S.useCallback(function(h){return o==null?void 0:o(t,h)},[t,o]),u=S.useCallback(function(h){return a==null?void 0:a(t,h)},[t,a]),d=S.useCallback(function(h){return s==null?void 0:s(t,h)},[t,s]),f=S.useCallback(function(h){return l==null?void 0:l(t,h)},[t,l]);return p.jsx(et.circle,{cx:n.x,cy:n.y,r:n.size.to(Que),fill:n.color,style:{mixBlendMode:r},onMouseEnter:i?c:void 0,onMouseMove:i?u:void 0,onMouseLeave:i?d:void 0,onClick:i?f:void 0})},colors:{scheme:"nivo"},isInteractive:!0,debugMesh:!1,tooltip:function(e){var t=e.node;return p.jsx(Is,{id:t.serieId,value:"x: "+t.formattedX+", y: "+t.formattedY,enableChip:!0,color:t.color})},markers:[],legends:[],annotations:[]},vn=Hr({},K$,{blendMode:"normal",layers:["grid","axes","nodes","markers","mesh","legends","annotations"],role:"img",useMesh:!0,animate:!0,motionConfig:"default"}),rr=Hr({},K$,{layers:["grid","axes","nodes","mesh","legends","annotations"],pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,renderNode:function(e,t){e.beginPath(),e.arc(t.x,t.y,t.size/2,0,2*Math.PI),e.fillStyle=t.color,e.fill()}}),Jue=function(e){var t=e.nodes,n=e.annotations,r=Y$(t,n);return p.jsx(p.Fragment,{children:r.map(function(i,o){return p.jsx(_ue,Hr({},i),o)})})},ede=function(e){return e.id},E2=function(e){return{x:e.x,y:e.y,size:e.size,color:e.color}},tde=function(e){return{x:e.x,y:e.y,size:0,color:e.color}},nde=function(e){var t=e.nodes,n=e.nodeComponent,r=e.isInteractive,i=e.onMouseEnter,o=e.onMouseMove,a=e.onMouseLeave,s=e.onClick,l=e.tooltip,c=e.blendMode,u=Fn(),d=u.animate,f=u.config,h=yr(t,{keys:ede,from:E2,enter:E2,update:E2,leave:tde,config:f,immediate:!d}),m=ci(),g=m.showTooltipFromEvent,v=m.hideTooltip,b=S.useCallback(function(w,M){g(S.createElement(l,{node:w}),M),i==null||i(w,M)},[l,g,i]),y=S.useCallback(function(w,M){g(S.createElement(l,{node:w}),M),o==null||o(w,M)},[l,g,o]),x=S.useCallback(function(w,M){v(),a==null||a(w,M)},[v,a]),$=S.useCallback(function(w,M){return s==null?void 0:s(w,M)},[s]);return p.jsx(p.Fragment,{children:h(function(w,M){return S.createElement(n,{node:M,style:w,blendMode:c,isInteractive:r,onMouseEnter:r?b:void 0,onMouseMove:r?y:void 0,onMouseLeave:r?x:void 0,onClick:r?$:void 0})})})},rde=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.onMouseEnter,o=e.onMouseMove,a=e.onMouseLeave,s=e.onClick,l=e.tooltip,c=e.debug,u=ci(),d=u.showTooltipFromEvent,f=u.hideTooltip,h=S.useCallback(function(b,y){d(S.createElement(l,{node:b}),y),i&&i(b,y)},[d,l,i]),m=S.useCallback(function(b,y){d(S.createElement(l,{node:b}),y),o&&o(b,y)},[d,l,o]),g=S.useCallback(function(b,y){f(),a&&a(b,y)},[f,a]),v=S.useCallback(function(b,y){s&&s(b,y)},[s]);return p.jsx(W$,{nodes:t,width:n,height:r,onMouseEnter:h,onMouseMove:m,onMouseLeave:g,onClick:v,debug:c})},ide=["isInteractive","animate","motionConfig","theme","renderWrapper"],ode=function(e){var t=e.data,n=e.xScale,r=n===void 0?vn.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?vn.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.margin,d=e.layers,f=d===void 0?vn.layers:d,h=e.colors,m=h===void 0?vn.colors:h,g=e.blendMode,v=g===void 0?vn.blendMode:g,b=e.nodeId,y=b===void 0?vn.nodeId:b,x=e.nodeSize,$=x===void 0?vn.nodeSize:x,w=e.nodeComponent,M=w===void 0?vn.nodeComponent:w,V=e.enableGridX,E=V===void 0?vn.enableGridX:V,_=e.enableGridY,O=_===void 0?vn.enableGridY:_,k=e.gridXValues,A=e.gridYValues,H=e.axisTop,R=e.axisRight,j=e.axisBottom,L=j===void 0?vn.axisBottom:j,T=e.axisLeft,I=T===void 0?vn.axisLeft:T,P=e.annotations,N=P===void 0?vn.annotations:P,z=e.isInteractive,U=z===void 0?vn.isInteractive:z,q=e.useMesh,Y=q===void 0?vn.useMesh:q,ee=e.debugMesh,Q=ee===void 0?vn.debugMesh:ee,K=e.onMouseEnter,J=e.onMouseMove,W=e.onMouseLeave,Z=e.onClick,G=e.tooltip,F=G===void 0?vn.tooltip:G,re=e.markers,B=re===void 0?vn.markers:re,ie=e.legends,oe=ie===void 0?vn.legends:ie,ve=e.role,Ce=ve===void 0?vn.role:ve,pe=e.ariaLabel,ye=e.ariaLabelledBy,Se=e.ariaDescribedBy,me=Za(l,c,u),ge=me.margin,ce=me.innerWidth,$e=me.innerHeight,he=me.outerWidth,Ae=me.outerHeight,Ie=G$({data:t,xScaleSpec:r,xFormat:i,yScaleSpec:a,yFormat:s,width:ce,height:$e,nodeId:y,nodeSize:$,colors:m}),Te=Ie.xScale,ke=Ie.yScale,Ye=Ie.nodes,Xe=Ie.legendData,Fe=S.useMemo(function(){return{xScale:Te,yScale:ke,nodes:Ye,margin:ge,innerWidth:ce,innerHeight:$e,outerWidth:he,outerHeight:Ae}},[Te,ke,Ye,ge,ce,$e,he,Ae]),Le={grid:null,axes:null,nodes:null,markers:null,mesh:null,annotations:null,legends:null};return f.includes("grid")&&(Le.grid=p.jsx(N$,{width:ce,height:$e,xScale:E?Te:null,yScale:O?ke:null,xValues:k,yValues:A},"grid")),f.includes("axes")&&(Le.axes=p.jsx(A$,{xScale:Te,yScale:ke,width:ce,height:$e,top:H,right:R,bottom:L,left:I},"axes")),f.includes("nodes")&&(Le.nodes=p.jsx(nde,{nodes:Ye,nodeComponent:M,isInteractive:U,tooltip:F,blendMode:v,onMouseEnter:K,onMouseMove:J,onMouseLeave:W,onClick:Z},"nodes")),f.includes("markers")&&(Le.markers=p.jsx(r$,{markers:B,width:ce,height:$e,xScale:Te,yScale:ke},"markers")),f.includes("mesh")&&U&&Y&&(Le.mesh=p.jsx(rde,{nodes:Ye,width:ce,height:$e,onMouseEnter:K,onMouseMove:J,onMouseLeave:W,onClick:Z,tooltip:F,debug:Q},"mesh")),f.includes("annotations")&&(Le.annotations=p.jsx(Jue,{nodes:Ye,annotations:N},"annotations")),f.includes("legends")&&(Le.legends=oe.map(function(Qe,Ze){return p.jsx(jf,Hr({},Qe,{containerWidth:ce,containerHeight:$e,data:Xe}),Ze)})),p.jsx(Sl,{width:he,height:Ae,margin:ge,role:Ce,ariaLabel:pe,ariaLabelledBy:ye,ariaDescribedBy:Se,children:f.map(function(Qe,Ze){if(typeof Qe=="string"&&Le[Qe]!==void 0)return Le[Qe];if(typeof Qe=="function")return p.jsx(S.Fragment,{children:S.createElement(Qe,Fe)},Ze);throw new Error("Unknown layer ("+Qe+")")})})},ade=function(e){var t=e.isInteractive,n=t===void 0?vn.isInteractive:t,r=e.animate,i=r===void 0?vn.animate:r,o=e.motionConfig,a=o===void 0?vn.motionConfig:o,s=e.theme,l=e.renderWrapper,c=q$(e,ide);return p.jsx(Ua,{animate:i,isInteractive:n,motionConfig:a,renderWrapper:l,theme:s,children:p.jsx(ode,Hr({isInteractive:n},c))})},X$=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(ade,Hr({width:n,height:r},e))}})},sde=["isInteractive","renderWrapper","theme"],lde=function(e){var t=e.data,n=e.xScale,r=n===void 0?rr.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?rr.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.margin,d=e.pixelRatio,f=d===void 0?rr.pixelRatio:d,h=e.layers,m=h===void 0?rr.layers:h,g=e.colors,v=g===void 0?rr.colors:g,b=e.nodeId,y=b===void 0?vn.nodeId:b,x=e.nodeSize,$=x===void 0?rr.nodeSize:x,w=e.renderNode,M=w===void 0?rr.renderNode:w,V=e.enableGridX,E=V===void 0?rr.enableGridX:V,_=e.gridXValues,O=e.enableGridY,k=O===void 0?rr.enableGridY:O,A=e.gridYValues,H=e.axisTop,R=e.axisRight,j=e.axisBottom,L=j===void 0?rr.axisBottom:j,T=e.axisLeft,I=T===void 0?rr.axisLeft:T,P=e.annotations,N=P===void 0?rr.annotations:P,z=e.isInteractive,U=z===void 0?rr.isInteractive:z,q=e.debugMesh,Y=q===void 0?rr.debugMesh:q,ee=e.onMouseEnter,Q=e.onMouseMove,K=e.onMouseLeave,J=e.onClick,W=e.tooltip,Z=W===void 0?rr.tooltip:W,G=e.legends,F=G===void 0?rr.legends:G,re=e.canvasRef,B=S.useRef(null),ie=Wt(),oe=S.useState(null),ve=oe[0],Ce=oe[1],pe=Za(l,c,u),ye=pe.margin,Se=pe.innerWidth,me=pe.innerHeight,ge=pe.outerWidth,ce=pe.outerHeight,$e=G$({data:t,xScaleSpec:r,xFormat:i,yScaleSpec:a,yFormat:s,width:Se,height:me,nodeId:y,nodeSize:$,colors:v}),he=$e.xScale,Ae=$e.yScale,Ie=$e.nodes,Te=$e.legendData,ke=Y$(Ie,N),Ye=Oh({points:Ie,width:Se,height:me,debug:Y}),Xe=Ye.delaunay,Fe=Ye.voronoi,Le=S.useMemo(function(){return{xScale:he,yScale:Ae,nodes:Ie,margin:ye,innerWidth:Se,innerHeight:me,outerWidth:ge,outerHeight:ce}},[he,Ae,Ie,ye,Se,me,ge,ce]);S.useEffect(function(){if(B.current){B.current.width=ge*f,B.current.height=ce*f;var Ne=B.current.getContext("2d");Ne.scale(f,f),Ne.fillStyle=ie.background,Ne.fillRect(0,0,ge,ce),Ne.translate(ye.left,ye.top),m.forEach(function(ze){if(ze==="grid")Ne.lineWidth=ie.grid.line.strokeWidth,Ne.strokeStyle=ie.grid.line.stroke,E&&yd(Ne,{width:Se,height:me,scale:he,axis:"x",values:_}),k&&yd(Ne,{width:Se,height:me,scale:Ae,axis:"y",values:A});else if(ze==="annotations")Eue(Ne,{annotations:ke,theme:ie});else if(ze==="axes")F$(Ne,{xScale:he,yScale:Ae,width:Se,height:me,top:H,right:R,bottom:L,left:I,theme:ie});else if(ze==="nodes")Ie.forEach(function(De){M(Ne,De)});else if(ze==="mesh")Y&&(Z$(Ne,Fe),ve&&U$(Ne,Fe,ve.index));else if(ze==="legends")F.forEach(function(De){d$(Ne,Hr({},De,{data:Te,containerWidth:Se,containerHeight:me,theme:ie}))});else{if(typeof ze!="function")throw new Error("Invalid layer: "+ze);ze(Ne,Le)}})}},[B,Se,me,ge,ce,ye.top,ye.left,f,M,m,Le,ie,he,Ae,Ie,E,k,H,R,L,I,F,Te,Y,Fe,ve,ke]);var Qe=ci(),Ze=Qe.showTooltipFromEvent,qe=Qe.hideTooltip,de=S.useCallback(function(Ne){var ze=xh(B.current,Ne),De=ze[0],Je=ze[1];if(!o$(ye.left,ye.top,Se,me,De,Je))return null;var tt=Xe.find(De-ye.left,Je-ye.top);return Ie[tt]},[B,ye,Se,me,Xe]),Ee=S.useCallback(function(Ne){var ze=de(Ne);Ce(ze),ze?(Ze(S.createElement(Z,{node:ze}),Ne),ve&&ve.id!==ze.id&&(K&&K(ve,Ne),ee&&ee(ze,Ne)),ve||ee&&ee(ze,Ne),Q&&Q(ze,Ne)):(qe(),ve&&K&&K(ve,Ne))},[de,ve,Ce,Ze,qe,Z,ee,Q,K]),Ke=S.useCallback(function(Ne){qe(),Ce(null),ve&&K&&K(ve,Ne)},[qe,ve,Ce,K]),nt=S.useCallback(function(Ne){if(J){var ze=de(Ne);ze&&J(ze,Ne)}},[de,J]);return p.jsx("canvas",{ref:function(Ne){B.current=Ne,re&&"current"in re&&(re.current=Ne)},width:ge*f,height:ce*f,style:{width:ge,height:ce,cursor:U?"auto":"normal"},onMouseEnter:U?Ee:void 0,onMouseMove:U?Ee:void 0,onMouseLeave:U?Ke:void 0,onClick:U?nt:void 0})},cde=S.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,i=e.theme,o=q$(e,sde);return p.jsx(Ua,{isInteractive:n,renderWrapper:r,theme:i,animate:!1,children:p.jsx(lde,Hr({},o,{canvasRef:t}))})});S.forwardRef(function(e,t){return p.jsx(qo,{children:function(n){var r=n.width,i=n.height;return p.jsx(cde,Hr({width:r,height:i},e,{ref:t}))}})});const ude=({x1:e,x2:t,y1:n,y2:r})=>p.jsx("g",{children:p.jsx("line",{x1:e,y1:n,x2:t,y2:r,stroke:"red",strokeWidth:"3"})}),dde=({scatterPlotData:e,style:t={},margin:n={},axisBottom:r={},axisLeft:i={},tooltip:o=null})=>{var h,m;const a=e==null?void 0:e.line,s=a==null?void 0:a.x1,l=a==null?void 0:a.y1,c=a==null?void 0:a.x2,u=a==null?void 0:a.y2,d=(m=(h=e==null?void 0:e.points)==null?void 0:h.data)==null?void 0:m.map(g=>g.y);Math.min(l,u,...d);const f=Math.max(l,u,...d);return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{style:{width:"100%",height:600,...t},children:p.jsx(X$,{data:[e==null?void 0:e.points],margin:{top:20,right:120,bottom:100,left:120,...n},xScale:{type:"point"},yScale:{type:"linear",min:0,max:f,reverse:!1},axisBottom:{orient:"bottom",tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:46,truncateTickAt:0,legend:"axisBottom",...r},axisLeft:{orient:"left",tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:-60,truncateTickAt:0,legend:"axisLeft",...i},layers:["grid","markers","axes","nodes","legends",g=>p.jsx(ude,{x1:g.xScale(s),y1:g.yScale(l),x2:g.xScale(c),y2:g.yScale(u)})],tooltip:({node:g})=>p.jsx(er,{body:(o==null?void 0:o({node:g}))||p.jsx("span",{children:"Scatterplot tooltip"})})})})]})};function fde(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}var hde=fde;function gde(e){return function(t){return e==null?void 0:e[t]}}var vde=gde,mde=vde,pde={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},bde=mde(pde),yde=bde,Cde=yde,xde=p1,wde=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Sde="\\u0300-\\u036f",$de="\\ufe20-\\ufe2f",Mde="\\u20d0-\\u20ff",_de=Sde+$de+Mde,Ede="["+_de+"]",Ode=RegExp(Ede,"g");function Hde(e){return e=xde(e),e&&e.replace(wde,Cde).replace(Ode,"")}var Vde=Hde,Tde=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Rde(e){return e.match(Tde)||[]}var kde=Rde,Lde=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function jde(e){return Lde.test(e)}var Pde=jde,Q$="\\ud800-\\udfff",Ide="\\u0300-\\u036f",Ade="\\ufe20-\\ufe2f",Nde="\\u20d0-\\u20ff",Fde=Ide+Ade+Nde,J$="\\u2700-\\u27bf",eM="a-z\\xdf-\\xf6\\xf8-\\xff",Dde="\\xac\\xb1\\xd7\\xf7",zde="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bde="\\u2000-\\u206f",Wde=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tM="A-Z\\xc0-\\xd6\\xd8-\\xde",Zde="\\ufe0e\\ufe0f",nM=Dde+zde+Bde+Wde,rM="['’]",up="["+nM+"]",Ude="["+Fde+"]",iM="\\d+",qde="["+J$+"]",oM="["+eM+"]",aM="[^"+Q$+nM+iM+J$+eM+tM+"]",Gde="\\ud83c[\\udffb-\\udfff]",Yde="(?:"+Ude+"|"+Gde+")",Kde="[^"+Q$+"]",sM="(?:\\ud83c[\\udde6-\\uddff]){2}",lM="[\\ud800-\\udbff][\\udc00-\\udfff]",ms="["+tM+"]",Xde="\\u200d",dp="(?:"+oM+"|"+aM+")",Qde="(?:"+ms+"|"+aM+")",fp="(?:"+rM+"(?:d|ll|m|re|s|t|ve))?",hp="(?:"+rM+"(?:D|LL|M|RE|S|T|VE))?",cM=Yde+"?",uM="["+Zde+"]?",Jde="(?:"+Xde+"(?:"+[Kde,sM,lM].join("|")+")"+uM+cM+")*",efe="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tfe="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",nfe=uM+cM+Jde,rfe="(?:"+[qde,sM,lM].join("|")+")"+nfe,ife=RegExp([ms+"?"+oM+"+"+fp+"(?="+[up,ms,"$"].join("|")+")",Qde+"+"+hp+"(?="+[up,ms+dp,"$"].join("|")+")",ms+"?"+dp+"+"+fp,ms+"+"+hp,tfe,efe,iM,rfe].join("|"),"g");function ofe(e){return e.match(ife)||[]}var afe=ofe,sfe=kde,lfe=Pde,cfe=p1,ufe=afe;function dfe(e,t,n){return e=cfe(e),t=n?void 0:t,t===void 0?lfe(e)?ufe(e):sfe(e):e.match(t)||[]}var ffe=dfe,hfe=hde,gfe=Vde,vfe=ffe,mfe="['’]",pfe=RegExp(mfe,"g");function bfe(e){return function(t){return hfe(vfe(gfe(t).replace(pfe,"")),e,"")}}var yfe=bfe,Cfe=D$;function xfe(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Cfe(e,t,n)}var wfe=xfe,Sfe="\\ud800-\\udfff",$fe="\\u0300-\\u036f",Mfe="\\ufe20-\\ufe2f",_fe="\\u20d0-\\u20ff",Efe=$fe+Mfe+_fe,Ofe="\\ufe0e\\ufe0f",Hfe="\\u200d",Vfe=RegExp("["+Hfe+Sfe+Efe+Ofe+"]");function Tfe(e){return Vfe.test(e)}var dM=Tfe;function Rfe(e){return e.split("")}var kfe=Rfe,fM="\\ud800-\\udfff",Lfe="\\u0300-\\u036f",jfe="\\ufe20-\\ufe2f",Pfe="\\u20d0-\\u20ff",Ife=Lfe+jfe+Pfe,Afe="\\ufe0e\\ufe0f",Nfe="["+fM+"]",A4="["+Ife+"]",N4="\\ud83c[\\udffb-\\udfff]",Ffe="(?:"+A4+"|"+N4+")",hM="[^"+fM+"]",gM="(?:\\ud83c[\\udde6-\\uddff]){2}",vM="[\\ud800-\\udbff][\\udc00-\\udfff]",Dfe="\\u200d",mM=Ffe+"?",pM="["+Afe+"]?",zfe="(?:"+Dfe+"(?:"+[hM,gM,vM].join("|")+")"+pM+mM+")*",Bfe=pM+mM+zfe,Wfe="(?:"+[hM+A4+"?",A4,gM,vM,Nfe].join("|")+")",Zfe=RegExp(N4+"(?="+N4+")|"+Wfe+Bfe,"g");function Ufe(e){return e.match(Zfe)||[]}var qfe=Ufe,Gfe=kfe,Yfe=dM,Kfe=qfe;function Xfe(e){return Yfe(e)?Kfe(e):Gfe(e)}var Qfe=Xfe,Jfe=wfe,e0e=dM,t0e=Qfe,n0e=p1;function r0e(e){return function(t){t=n0e(t);var n=e0e(t)?t0e(t):void 0,r=n?n[0]:t.charAt(0),i=n?Jfe(n,1).join(""):t.slice(1);return r[e]()+i}}var i0e=r0e,o0e=i0e,a0e=o0e("toUpperCase"),s0e=a0e,l0e=yfe,c0e=s0e,u0e=l0e(function(e,t,n){return e+(n?" ":"")+c0e(t)}),d0e=u0e;const f0e=xn(d0e);function h0e(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function g0e(){return this.eachAfter(h0e)}function v0e(e){var t=this,n,r=[t],i,o,a;do for(n=r.reverse(),r=[];t=n.pop();)if(e(t),i=t.children,i)for(o=0,a=i.length;o<a;++o)r.push(i[o]);while(r.length);return this}function m0e(e){for(var t=this,n=[t],r,i;t=n.pop();)if(e(t),r=t.children,r)for(i=r.length-1;i>=0;--i)n.push(r[i]);return this}function p0e(e){for(var t=this,n=[t],r=[],i,o,a;t=n.pop();)if(r.push(t),i=t.children,i)for(o=0,a=i.length;o<a;++o)n.push(i[o]);for(;t=r.pop();)e(t);return this}function b0e(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function y0e(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function C0e(e){for(var t=this,n=x0e(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function x0e(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function w0e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function S0e(){var e=[];return this.each(function(t){e.push(t)}),e}function $0e(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function M0e(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function Hh(e,t){var n=new xd(e),r=+e.value&&(n.value=e.value),i,o=[n],a,s,l,c;for(t==null&&(t=E0e);i=o.pop();)if(r&&(i.value=+i.data.value),(s=t(i.data))&&(c=s.length))for(i.children=new Array(c),l=c-1;l>=0;--l)o.push(a=i.children[l]=new xd(s[l])),a.parent=i,a.depth=i.depth+1;return n.eachBefore(H0e)}function _0e(){return Hh(this).eachBefore(O0e)}function E0e(e){return e.children}function O0e(e){e.data=e.data.data}function H0e(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function xd(e){this.data=e,this.depth=this.height=0,this.parent=null}xd.prototype=Hh.prototype={constructor:xd,count:g0e,each:v0e,eachAfter:p0e,eachBefore:m0e,sum:b0e,sort:y0e,path:C0e,ancestors:w0e,descendants:S0e,leaves:$0e,links:M0e,copy:_0e};function V0e(e){if(typeof e!="function")throw new Error;return e}function Gl(){return 0}function Yl(e){return function(){return e}}function T0e(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Vh(e,t,n,r,i){for(var o=e.children,a,s=-1,l=o.length,c=e.value&&(r-t)/e.value;++s<l;)a=o[s],a.y0=n,a.y1=i,a.x0=t,a.x1=t+=a.value*c}function Th(e,t,n,r,i){for(var o=e.children,a,s=-1,l=o.length,c=e.value&&(i-n)/e.value;++s<l;)a=o[s],a.x0=t,a.x1=r,a.y0=n,a.y1=n+=a.value*c}var R0e=(1+Math.sqrt(5))/2;function k0e(e,t,n,r,i,o){for(var a=[],s=t.children,l,c,u=0,d=0,f=s.length,h,m,g=t.value,v,b,y,x,$,w,M;u<f;){h=i-n,m=o-r;do v=s[d++].value;while(!v&&d<f);for(b=y=v,w=Math.max(m/h,h/m)/(g*e),M=v*v*w,$=Math.max(y/M,M/b);d<f;++d){if(v+=c=s[d].value,c<b&&(b=c),c>y&&(y=c),M=v*v*w,x=Math.max(y/M,M/b),x>$){v-=c;break}$=x}a.push(l={value:v,dice:h<m,children:s.slice(u,d)}),l.dice?Vh(l,n,r,i,g?r+=m*v/g:o):Th(l,n,r,g?n+=h*v/g:i,o),g-=v,u=d}return a}const bM=function e(t){function n(r,i,o,a,s){k0e(t,r,i,o,a,s)}return n.ratio=function(r){return e((r=+r)>1?r:1)},n}(R0e);function L0e(){var e=bM,t=!1,n=1,r=1,i=[0],o=Gl,a=Gl,s=Gl,l=Gl,c=Gl;function u(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(d),i=[0],t&&f.eachBefore(T0e),f}function d(f){var h=i[f.depth],m=f.x0+h,g=f.y0+h,v=f.x1-h,b=f.y1-h;v<m&&(m=v=(m+v)/2),b<g&&(g=b=(g+b)/2),f.x0=m,f.y0=g,f.x1=v,f.y1=b,f.children&&(h=i[f.depth+1]=o(f)/2,m+=c(f)-h,g+=a(f)-h,v-=s(f)-h,b-=l(f)-h,v<m&&(m=v=(m+v)/2),b<g&&(g=b=(g+b)/2),e(f,m,g,v,b))}return u.round=function(f){return arguments.length?(t=!!f,u):t},u.size=function(f){return arguments.length?(n=+f[0],r=+f[1],u):[n,r]},u.tile=function(f){return arguments.length?(e=V0e(f),u):e},u.padding=function(f){return arguments.length?u.paddingInner(f).paddingOuter(f):u.paddingInner()},u.paddingInner=function(f){return arguments.length?(o=typeof f=="function"?f:Yl(+f),u):o},u.paddingOuter=function(f){return arguments.length?u.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):u.paddingTop()},u.paddingTop=function(f){return arguments.length?(a=typeof f=="function"?f:Yl(+f),u):a},u.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:Yl(+f),u):s},u.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:Yl(+f),u):l},u.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:Yl(+f),u):c},u}function j0e(e,t,n,r,i){var o=e.children,a,s=o.length,l,c=new Array(s+1);for(c[0]=l=a=0;a<s;++a)c[a+1]=l+=o[a].value;u(0,s,e.value,t,n,r,i);function u(d,f,h,m,g,v,b){if(d>=f-1){var y=o[d];y.x0=m,y.y0=g,y.x1=v,y.y1=b;return}for(var x=c[d],$=h/2+x,w=d+1,M=f-1;w<M;){var V=w+M>>>1;c[V]<$?w=V+1:M=V}$-c[w-1]<c[w]-$&&d+1<w&&--w;var E=c[w]-x,_=h-E;if(v-m>b-g){var O=(m*_+v*E)/h;u(d,w,E,m,g,O,b),u(w,f,_,O,g,v,b)}else{var k=(g*_+b*E)/h;u(d,w,E,m,g,v,k),u(w,f,_,m,k,v,b)}}}function P0e(e,t,n,r,i){(e.depth&1?Th:Vh)(e,t,n,r,i)}function Vr(){return Vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vr.apply(this,arguments)}function I0e(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var A0e=function(e,t){return Vn([e,t],function(n,r){return"translate("+n+","+r+")"})},N0e=function(e,t){return Vn([e,t],function(n,r){return"translate("+n+"px, "+r+"px)"})},gp=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+r+","+i+") rotate("+o+")"})},F0e=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+r+"px,"+i+"px) rotate("+o+"deg)"})},D0e=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+(r-(o===0?0:5))+"px,"+(i-(o===0?5:0))+"px) rotate("+o+"deg)"})},z0e=S.memo(function(e){var t=e.node,n=e.animatedProps,r=e.borderWidth,i=e.enableLabel,o=e.enableParentLabel,a=e.labelSkipSize,s=Wt(),l=i&&t.isLeaf&&(a===0||Math.min(t.width,t.height)>a),c=o&&t.isParent;return p.jsxs(et.g,{transform:A0e(n.x,n.y),children:[p.jsx(et.rect,{"data-testid":"node."+t.id,width:Vn(n.width,function(u){return Math.max(u,0)}),height:Vn(n.height,function(u){return Math.max(u,0)}),fill:t.fill?t.fill:n.color,strokeWidth:r,stroke:t.borderColor,fillOpacity:t.opacity,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseLeave:t.onMouseLeave,onClick:t.onClick}),l&&p.jsx(et.text,{"data-testid":"label."+t.id,textAnchor:"middle",dominantBaseline:"central",style:Vr({},s.labels.text,{fill:t.labelTextColor,pointerEvents:"none"}),fillOpacity:n.labelOpacity,transform:gp(n.labelX,n.labelY,n.labelRotation),children:t.label}),c&&p.jsx(et.text,{"data-testid":"parentLabel."+t.id,dominantBaseline:"central",style:Vr({},s.labels.text,{fill:t.parentLabelTextColor,pointerEvents:"none"}),fillOpacity:n.parentLabelOpacity,transform:gp(n.parentLabelX,n.parentLabelY,n.parentLabelRotation),children:t.parentLabel})]})}),B0e=S.memo(function(e){var t=e.node;return p.jsx(Is,{id:t.id,value:t.formattedValue,enableChip:!0,color:t.color})}),W0e=S.memo(function(e){var t=e.node,n=e.animatedProps,r=e.borderWidth,i=e.enableLabel,o=e.enableParentLabel,a=e.labelSkipSize,s=Wt(),l=i&&t.isLeaf&&(a===0||Math.min(t.width,t.height)>a),c=o&&t.isParent;return p.jsxs(et.div,{"data-testid":"node."+t.id,id:t.path.replace(/[^\w]/gi,"-"),style:{boxSizing:"border-box",position:"absolute",top:0,left:0,transform:N0e(n.x,n.y),width:n.width,height:n.height,borderWidth:r,borderStyle:"solid",borderColor:t.borderColor,overflow:"hidden"},children:[p.jsx(et.div,{style:{boxSizing:"border-box",position:"absolute",top:0,left:0,opacity:t.opacity,width:n.width,height:n.height,background:n.color},onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseLeave:t.onMouseLeave,onClick:t.onClick}),l&&p.jsx(et.span,{"data-testid":"label."+t.id,style:Vr({},s.labels.text,{position:"absolute",display:"flex",top:-5,left:-5,width:10,height:10,justifyContent:"center",alignItems:"center",whiteSpace:"nowrap",color:t.labelTextColor,transformOrigin:"center center",transform:F0e(n.labelX,n.labelY,n.labelRotation),opacity:n.labelOpacity,pointerEvents:"none"}),children:t.label}),c&&p.jsx(et.span,{"data-testid":"parentLabel."+t.id,style:Vr({},s.labels.text,{position:"absolute",display:"flex",justifyContent:"flex-start",alignItems:"center",whiteSpace:"nowrap",width:10,height:10,color:t.parentLabelTextColor,transformOrigin:"top left",transform:D0e(n.parentLabelX,n.parentLabelY,n.parentLabelRotation),opacity:n.parentLabelOpacity,pointerEvents:"none"}),children:t.parentLabel})]})}),$n={layers:["nodes"],identity:"id",value:"value",tile:"squarify",leavesOnly:!1,innerPadding:0,outerPadding:0,colors:{scheme:"nivo"},colorBy:"pathComponents.1",nodeOpacity:.33,enableLabel:!0,label:"formattedValue",labelSkipSize:0,labelTextColor:{from:"color",modifiers:[["darker",1]]},orientLabel:!0,enableParentLabel:!0,parentLabel:"id",parentLabelSize:20,parentLabelPosition:"top",parentLabelPadding:6,parentLabelTextColor:{from:"color",modifiers:[["darker",1]]},borderWidth:1,borderColor:{from:"color",modifiers:[["darker",1]]},isInteractive:!0,tooltip:B0e,role:"img",animate:!0,motionConfig:"gentle"},Zt=Vr({},$n,{nodeComponent:z0e,defs:[],fill:[]});Vr({},$n,{nodeComponent:W0e});Vr({},$n,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var Z0e={binary:j0e,dice:Vh,slice:Th,sliceDice:P0e,squarify:bM},U0e=function(e){var t=e.root,n=e.getValue;return S.useMemo(function(){return Hh(t).sum(n)},[t,n])},q0e=function(e){var t=e.data,n=e.width,r=e.height,i=e.identity,o=i===void 0?$n.identity:i,a=e.value,s=a===void 0?$n.value:a,l=e.valueFormat,c=e.leavesOnly,u=c===void 0?$n.leavesOnly:c,d=e.tile,f=d===void 0?$n.tile:d,h=e.innerPadding,m=h===void 0?$n.innerPadding:h,g=e.outerPadding,v=g===void 0?$n.outerPadding:g,b=e.label,y=b===void 0?$n.label:b,x=e.orientLabel,$=x===void 0?$n.orientLabel:x,w=e.enableParentLabel,M=w===void 0?$n.enableParentLabel:w,V=e.parentLabel,E=V===void 0?$n.parentLabel:V,_=e.parentLabelSize,O=_===void 0?$n.parentLabelSize:_,k=e.parentLabelPosition,A=k===void 0?$n.parentLabelPosition:k,H=e.parentLabelPadding,R=H===void 0?$n.parentLabelPadding:H,j=e.colors,L=j===void 0?$n.colors:j,T=e.colorBy,I=T===void 0?$n.colorBy:T,P=e.nodeOpacity,N=P===void 0?$n.nodeOpacity:P,z=e.borderColor,U=z===void 0?$n.borderColor:z,q=e.labelTextColor,Y=q===void 0?$n.labelTextColor:q,ee=e.parentLabelTextColor,Q=ee===void 0?$n.parentLabelTextColor:ee,K=bi(o),J=bi(s),W=jo(l),Z=bi(y),G=bi(E),F=function(me){var ge=me.width,ce=me.height,$e=me.tile,he=me.innerPadding,Ae=me.outerPadding,Ie=me.enableParentLabel,Te=me.parentLabelSize,ke=me.parentLabelPosition,Ye=me.leavesOnly;return S.useMemo(function(){var Xe=L0e().size([ge,ce]).tile(Z0e[$e]).round(!0).paddingInner(he).paddingOuter(Ae);if(Ie&&!Ye){var Fe=Te+2*Ae;Xe["padding"+f0e(ke)](Fe)}return Xe},[ge,ce,$e,he,Ae,Ie,Te,ke,Ye])}({width:n,height:r,tile:f,innerPadding:m,outerPadding:v,enableParentLabel:M,parentLabelSize:O,parentLabelPosition:A,leavesOnly:u}),re=U0e({root:t,getValue:J}),B=S.useMemo(function(){var me=y$(re);return F(me),u?me.leaves():me.descendants()},[re,F,u]),ie=S.useMemo(function(){return B.map(function(me){var ge=function(Ae,Ie){var Te=Ae.ancestors().map(function(ke){return Ie(ke.data)}).reverse();return{path:Te.join("."),pathComponents:Te}}(me,K),ce=ge.path,$e=ge.pathComponents,he={id:K(me.data),path:ce,pathComponents:$e,data:Ya(me.data,"children"),x:me.x0,y:me.y0,width:me.x1-me.x0,height:me.y1-me.y0,value:me.value,formattedValue:W(me.value),treeDepth:me.depth,treeHeight:me.height,isParent:me.height>0,isLeaf:me.height===0,parentLabelX:0,parentLabelY:0,parentLabelRotation:0};return he.labelRotation=$&&he.height>he.width?-90:0,A==="top"&&(he.parentLabelX=v+R,he.parentLabelY=v+O/2),A==="right"&&(he.parentLabelX=he.width-v-O/2,he.parentLabelY=he.height-v-R,he.parentLabelRotation=-90),A==="bottom"&&(he.parentLabelX=v+R,he.parentLabelY=he.height-v-O/2),A==="left"&&(he.parentLabelX=v+O/2,he.parentLabelY=he.height-v-R,he.parentLabelRotation=-90),he.label=Z(he),he.parentLabel=G(he),he})},[B,K,W,Z,$,G,O,A,R,v]),oe=Wt(),ve=$1(L,I),Ce=Er(U,oe),pe=Er(Y,oe),ye=Er(Q,oe),Se=S.useMemo(function(){return ie.map(function(me){var ge=Vr({},me,{color:ve(me),opacity:N});return ge.borderColor=Ce(ge),ge.labelTextColor=pe(ge),ge.parentLabelTextColor=ye(ge),ge})},[ie,ve,N,Ce,pe,ye]);return{hierarchy:re,nodes:Se,layout:F}},G0e=function(e){var t=e.nodes;return S.useMemo(function(){return{nodes:t}},[t])},O2=function(e){return{x:e.x,y:e.y,width:e.width,height:e.height,color:e.color,labelX:e.width/2,labelY:e.height/2,labelRotation:e.labelRotation,labelOpacity:1,parentLabelX:e.parentLabelX,parentLabelY:e.parentLabelY,parentLabelRotation:e.parentLabelRotation,parentLabelOpacity:1}},vp=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2,width:0,height:0,color:e.color,labelX:0,labelY:0,labelRotation:e.labelRotation,labelOpacity:0,parentLabelX:0,parentLabelY:0,parentLabelRotation:e.parentLabelRotation,parentLabelOpacity:0}},Y0e=S.memo(function(e){var t=e.nodes,n=e.nodeComponent,r=e.borderWidth,i=e.enableLabel,o=e.labelSkipSize,a=e.enableParentLabel,s=function(f,h){var m=h.isInteractive,g=h.onMouseEnter,v=h.onMouseMove,b=h.onMouseLeave,y=h.onClick,x=h.tooltip,$=ci(),w=$.showTooltipFromEvent,M=$.hideTooltip,V=S.useCallback(function(A,H){w(S.createElement(x,{node:A}),H,"left")},[w,x]),E=S.useCallback(function(A,H){V(A,H),g==null||g(A,H)},[g,V]),_=S.useCallback(function(A,H){V(A,H),v==null||v(A,H)},[v,V]),O=S.useCallback(function(A,H){M(),b==null||b(A,H)},[b,M]),k=S.useCallback(function(A,H){y==null||y(A,H)},[y]);return S.useMemo(function(){return f.map(function(A){return m?Vr({},A,{onMouseEnter:function(H){return E(A,H)},onMouseMove:function(H){return _(A,H)},onMouseLeave:function(H){return O(A,H)},onClick:function(H){return k(A,H)}}):A})},[m,f,E,_,O,k])}(t,{isInteractive:e.isInteractive,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseLeave:e.onMouseLeave,onClick:e.onClick,tooltip:e.tooltip}),l=Fn(),c=l.animate,u=l.config,d=yr(s,{keys:function(f){return f.path},initial:O2,from:vp,enter:O2,update:O2,leave:vp,config:u,immediate:!c});return p.jsx(p.Fragment,{children:d(function(f,h){return S.createElement(n,{key:h.path,node:h,animatedProps:f,borderWidth:r,enableLabel:i,labelSkipSize:o,enableParentLabel:a})})})}),K0e=["isInteractive","animate","motionConfig","theme","renderWrapper"],X0e=function(e){var t=e.data,n=e.identity,r=n===void 0?Zt.identity:n,i=e.value,o=i===void 0?Zt.value:i,a=e.valueFormat,s=e.tile,l=s===void 0?Zt.tile:s,c=e.nodeComponent,u=c===void 0?Zt.nodeComponent:c,d=e.innerPadding,f=d===void 0?Zt.innerPadding:d,h=e.outerPadding,m=h===void 0?Zt.outerPadding:h,g=e.leavesOnly,v=g===void 0?Zt.leavesOnly:g,b=e.width,y=e.height,x=e.margin,$=e.layers,w=$===void 0?Zt.layers:$,M=e.colors,V=M===void 0?Zt.colors:M,E=e.colorBy,_=E===void 0?Zt.colorBy:E,O=e.nodeOpacity,k=O===void 0?Zt.nodeOpacity:O,A=e.borderWidth,H=A===void 0?Zt.borderWidth:A,R=e.borderColor,j=R===void 0?Zt.borderColor:R,L=e.defs,T=L===void 0?Zt.defs:L,I=e.fill,P=I===void 0?Zt.fill:I,N=e.enableLabel,z=N===void 0?Zt.enableLabel:N,U=e.label,q=U===void 0?Zt.label:U,Y=e.labelTextColor,ee=Y===void 0?Zt.labelTextColor:Y,Q=e.orientLabel,K=Q===void 0?Zt.orientLabel:Q,J=e.labelSkipSize,W=J===void 0?Zt.labelSkipSize:J,Z=e.enableParentLabel,G=Z===void 0?Zt.enableParentLabel:Z,F=e.parentLabel,re=F===void 0?Zt.parentLabel:F,B=e.parentLabelSize,ie=B===void 0?Zt.parentLabelSize:B,oe=e.parentLabelPosition,ve=oe===void 0?Zt.parentLabelPosition:oe,Ce=e.parentLabelPadding,pe=Ce===void 0?Zt.parentLabelPadding:Ce,ye=e.parentLabelTextColor,Se=ye===void 0?Zt.parentLabelTextColor:ye,me=e.isInteractive,ge=me===void 0?Zt.isInteractive:me,ce=e.onMouseEnter,$e=e.onMouseMove,he=e.onMouseLeave,Ae=e.onClick,Ie=e.tooltip,Te=Ie===void 0?Zt.tooltip:Ie,ke=e.role,Ye=e.ariaLabel,Xe=e.ariaLabelledBy,Fe=e.ariaDescribedBy,Le=Za(b,y,x),Qe=Le.margin,Ze=Le.innerWidth,qe=Le.innerHeight,de=Le.outerWidth,Ee=Le.outerHeight,Ke=q0e({data:t,identity:r,value:o,valueFormat:a,leavesOnly:v,width:Ze,height:qe,tile:l,innerPadding:f,outerPadding:m,colors:V,colorBy:_,nodeOpacity:k,borderColor:j,label:q,labelTextColor:ee,orientLabel:K,enableParentLabel:G,parentLabel:re,parentLabelSize:ie,parentLabelPosition:ve,parentLabelPadding:pe,parentLabelTextColor:Se}).nodes,nt={nodes:null};w.includes("nodes")&&(nt.nodes=p.jsx(Y0e,{nodes:Ke,nodeComponent:u,borderWidth:H,enableLabel:z,labelSkipSize:W,enableParentLabel:G,isInteractive:ge,onMouseEnter:ce,onMouseMove:$e,onMouseLeave:he,onClick:Ae,tooltip:Te},"nodes"));var Ne=G0e({nodes:Ke}),ze=wh(T,Ke,P);return p.jsx(Sl,{width:de,height:Ee,margin:Qe,defs:ze,role:ke,ariaLabel:Ye,ariaLabelledBy:Xe,ariaDescribedBy:Fe,children:w.map(function(De,Je){var tt;return typeof De=="function"?p.jsx(S.Fragment,{children:S.createElement(De,Ne)},Je):(tt=nt==null?void 0:nt[De])!=null?tt:null})})},Q0e=function(e){var t=e.isInteractive,n=t===void 0?Zt.isInteractive:t,r=e.animate,i=r===void 0?Zt.animate:r,o=e.motionConfig,a=o===void 0?Zt.motionConfig:o,s=e.theme,l=e.renderWrapper,c=I0e(e,K0e);return p.jsx(Ua,{animate:i,isInteractive:n,motionConfig:a,renderWrapper:l,theme:s,children:p.jsx(X0e,Vr({isInteractive:n},c))})},J0e=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(Q0e,Vr({width:n,height:r},e))}})};function e2e(e,t){if(e.startsWith("rgba"))return e.replace(/rgba?\((\d+), (\d+), (\d+),? ([\d.]+)?\)/,(n,r,i,o,a)=>`rgba(${r}, ${i}, ${o}, ${t})`);if(e.startsWith("rgb"))return e.replace(/rgb\((\d+), (\d+), (\d+)\)/,(n,r,i,o)=>`rgba(${r}, ${i}, ${o}, ${t})`);if(e.startsWith("hsl"))return e.replace(/hsl\((\d+), (\d+)%?, (\d+)%?\)/,(n,r,i,o)=>`hsla(${r}, ${i}%, ${o}%, ${t})`);if(e.startsWith("hsla"))return e.replace(/hsla?\((\d+), (\d+)%?, (\d+)%?,? ([\d.]+)?\)/,(n,r,i,o,a)=>`hsla(${r}, ${i}%, ${o}%, ${t})`);if(e.startsWith("#")){const n=t2e(e);return`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`}throw new Error("Unsupported color format")}function t2e(e){const t=e.startsWith("#")?e.slice(1):e,n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return{r:n,g:r,b:i}}const n2e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},r2e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;n2e(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},i2e=({treeMapData:e,style:t={},colors:n={scheme:"nivo"},identity:r="name",value:i="loc",margin:o={},nodeOpacity:a=.67,labelTextColor:s="black",borderColor:l="white",labelTitle:c="name",labelTitleSize:u=16,labelText:d="name",labelTextSize:f=12,labelPadding:h=10,labelGap:m=10,labelLineHeight:g=14,tooltip:v=null})=>{const b=S.useRef(null),[y,x]=S.useState({width:0,height:0});S.useEffect(()=>{if(!(b!=null&&b.current))return;const M=()=>{const E=b.current.getBoundingClientRect();x({width:E.width,height:E.height})},V=new ResizeObserver(M);return V.observe(b==null?void 0:b.current),M(),()=>{V.disconnect()}},[]);const $=({node:M})=>{var L,T;const V=S.useRef(null),E=S.useRef(null),[_,O]=S.useState(!1),[k,A]=S.useState(!1),H=()=>{if(!(V!=null&&V.current)||!(E!=null&&E.current))return;const I=V.current.getBoundingClientRect(),P=E.current.getBoundingClientRect(),N=Math.max([P,I]);O(I.height>M.height-h*2||I.width>M.width-h*2),A(P.height+I.height+g>M.height-h*2||N>M.width-h*2)};S.useEffect(()=>{H()},[]);const R=((L=M==null?void 0:M.data)==null?void 0:L[d])||"Text",j=r2e(R,M.width-h*2,f);return M.isParent?p.jsx(p.Fragment,{}):p.jsxs("g",{transform:`translate(${M.x}, ${M.y})`,children:[p.jsx("rect",{width:M.width,height:M.height,style:{fill:e2e(M.color,a),stroke:l,strokeWidth:1}}),!_&&p.jsx("text",{ref:V,dominantBaseline:"hanging",x:h,y:h,style:{fill:s,font:"var(--gf-label-lg-default)",fontWeight:"bold",fontSize:u},children:((T=M==null?void 0:M.data)==null?void 0:T[c])||"Title"}),!_&&!k&&p.jsx("text",{ref:E,dominantBaseline:"hanging",children:j.map((I,P)=>p.jsx("tspan",{x:h,y:h+u+m+g*P,style:{fill:s,font:"var(--gf-label-lg-default)",fontSize:f},children:I},P))})]})},w=({nodes:M})=>M.map(V=>p.jsx($,{node:V},V.id));return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{ref:b,style:{width:"100%",height:600,...t},children:p.jsx(J0e,{data:e,colors:n,identity:r,value:i,margin:{top:10,right:10,bottom:10,left:10,...o},enableParentLabel:!1,enableLabel:!1,nodeOpacity:0,borderWidth:0,tooltip:({node:M})=>p.jsx(er,{body:(v==null?void 0:v({node:M}))||p.jsx("span",{children:"Treemap tooltip"})}),layers:[w,"nodes"]})})]})};var o2e=p1,a2e=0;function s2e(e){var t=++a2e;return o2e(e)+t}var l2e=s2e;const c2e=xn(l2e);function hr(){return hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hr.apply(this,arguments)}var Rh=S.memo(function(e){var t=e.point;return p.jsx(Is,{id:p.jsxs("span",{children:["x: ",p.jsx("strong",{children:t.data.xFormatted}),", y:"," ",p.jsx("strong",{children:t.data.yFormatted})]}),enableChip:!0,color:t.serieColor})}),yM=S.memo(function(e){var t=e.slice,n=e.axis,r=Wt(),i=n==="x"?"y":"x";return p.jsx(aw,{rows:t.points.map(function(o){return[p.jsx(Xu,{color:o.serieColor,style:r.tooltip.chip},"chip"),o.serieId,p.jsx("span",{style:r.tooltip.tableCellValue,children:o.data[i+"Formatted"]},"value")]})})}),CM={curve:"linear",xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],axisBottom:{},axisLeft:{},enableGridX:!0,enableGridY:!0,enablePoints:!0,pointSize:6,pointColor:{from:"color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enablePointLabel:!1,pointLabel:"yFormatted",colors:{scheme:"nivo"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,areaBlendMode:"normal",lineWidth:2,legends:[],isInteractive:!0,tooltip:Rh,enableSlices:!1,debugSlices:!1,sliceTooltip:yM,debugMesh:!1,enableCrosshair:!0,crosshairType:"bottom-left"},So=hr({},CM,{enablePointLabel:!1,useMesh:!1,enableTouchCrosshair:!1,animate:!0,motionConfig:"gentle",defs:[],fill:[],role:"img"});hr({},CM,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var u2e=function(e){var t=e.curve;return S.useMemo(function(){return Gc().defined(function(n){return n.x!==null&&n.y!==null}).x(function(n){return n.x}).y(function(n){return n.y}).curve(BS(t))},[t])},d2e=function(e){var t=e.curve,n=e.yScale,r=e.areaBaselineValue;return S.useMemo(function(){return lS().defined(function(i){return i.x!==null&&i.y!==null}).x(function(i){return i.x}).y1(function(i){return i.y}).curve(BS(t)).y0(n(r))},[t,n,r])},f2e=function(e){var t=e.componentId,n=e.enableSlices,r=e.points,i=e.width,o=e.height;return S.useMemo(function(){if(n===!1)return[];if(n==="x"){var a=new Map;return r.forEach(function(l){l.data.x!==null&&l.data.y!==null&&(a.has(l.x)?a.get(l.x).push(l):a.set(l.x,[l]))}),Array.from(a.entries()).sort(function(l,c){return l[0]-c[0]}).map(function(l,c,u){var d,f,h=l[0],m=l[1],g=u[c-1],v=u[c+1];return d=g?h-(h-g[0])/2:h,f=v?h-d+(v[0]-h)/2:i-d,{id:"slice:"+t+":"+h,x0:d,x:h,y0:0,y:0,width:f,height:o,points:m.reverse()}})}if(n==="y"){var s=new Map;return r.forEach(function(l){l.data.x!==null&&l.data.y!==null&&(s.has(l.y)?s.get(l.y).push(l):s.set(l.y,[l]))}),Array.from(s.entries()).sort(function(l,c){return l[0]-c[0]}).map(function(l,c,u){var d,f,h=l[0],m=l[1],g=u[c-1],v=u[c+1];return d=g?h-(h-g[0])/2:h,f=v?h-d+(v[0]-h)/2:o-d,{id:h,x0:0,x:0,y0:d,y:h,width:i,height:f,points:m.reverse()}})}},[t,n,o,r,i])},h2e="line",xM=function(e){var t=e.data,n=e.xScale,r=n===void 0?So.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?So.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.colors,d=u===void 0?So.colors:u,f=e.curve,h=f===void 0?So.curve:f,m=e.areaBaselineValue,g=m===void 0?So.areaBaselineValue:m,v=e.pointColor,b=v===void 0?So.pointColor:v,y=e.pointBorderColor,x=y===void 0?So.pointBorderColor:y,$=e.enableSlices,w=$===void 0?So.enableSlicesTooltip:$,M=S.useState(c2e(h2e))[0],V=jo(i),E=jo(s),_=$1(d,"id"),O=Wt(),k=Er(b,O),A=Er(x,O),H=S.useState([]),R=H[0],j=H[1],L=S.useMemo(function(){return V$(t.filter(function(Q){return R.indexOf(Q.id)===-1}),r,a,l,c)},[t,R,r,a,l,c]),T=L.xScale,I=L.yScale,P=L.series,N=S.useMemo(function(){var Q=t.map(function(J){return{id:J.id,label:J.id,color:_(J)}}),K=Q.map(function(J){return hr({},P.find(function(W){return W.id===J.id}),{color:J.color})}).filter(function(J){return!!J.id});return{legendData:Q.map(function(J){return hr({},J,{hidden:!K.find(function(W){return W.id===J.id})})}).reverse(),series:K}},[t,P,_]),z=N.legendData,U=N.series,q=S.useCallback(function(Q){j(function(K){return K.indexOf(Q)>-1?K.filter(function(J){return J!==Q}):[].concat(K,[Q])})},[]),Y=function(Q){var K=Q.series,J=Q.getPointColor,W=Q.getPointBorderColor,Z=Q.formatX,G=Q.formatY;return S.useMemo(function(){return K.reduce(function(F,re){return[].concat(F,re.data.filter(function(B){return B.position.x!==null&&B.position.y!==null}).map(function(B,ie){var oe={id:re.id+"."+ie,index:F.length+ie,serieId:re.id,serieColor:re.color,x:B.position.x,y:B.position.y};return oe.color=J(re),oe.borderColor=W(oe),oe.data=hr({},B.data,{xFormatted:Z(B.data.x),yFormatted:G(B.data.y)}),oe}))},[])},[K,J,W,Z,G])}({series:U,getPointColor:k,getPointBorderColor:A,formatX:V,formatY:E}),ee=f2e({componentId:M,enableSlices:w,points:Y,width:l,height:c});return{legendData:z,toggleSerie:q,lineGenerator:u2e({curve:h}),areaGenerator:d2e({curve:h,yScale:I,areaBaselineValue:g}),getColor:_,series:U,xScale:T,yScale:I,slices:ee,points:Y}},g2e=function(e){var t=e.areaBlendMode,n=e.areaOpacity,r=e.color,i=e.fill,o=e.path,a=Fn(),s=a.animate,l=a.config,c=kf(o),u=Xt({color:r,config:l,immediate:!s});return p.jsx(et.path,{d:c,fill:i||u.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:t}})},v2e=S.memo(function(e){var t=e.areaGenerator,n=e.areaOpacity,r=e.areaBlendMode,i=e.lines.slice(0).reverse();return p.jsx("g",{children:i.map(function(o){return p.jsx(g2e,hr({path:t(o.data.map(function(a){return a.position}))},hr({areaOpacity:n,areaBlendMode:r},o)),o.id)})})}),m2e=S.memo(function(e){var t=e.lineGenerator,n=e.points,r=e.color,i=e.thickness,o=S.useMemo(function(){return t(n)},[t,n]),a=kf(o);return p.jsx(et.path,{d:a,fill:"none",strokeWidth:i,stroke:r})}),p2e=S.memo(function(e){var t=e.lines,n=e.lineGenerator,r=e.lineWidth;return t.slice(0).reverse().map(function(i){var o=i.id,a=i.data,s=i.color;return p.jsx(m2e,{id:o,points:a.map(function(l){return l.position}),lineGenerator:n,color:s,thickness:r},o)})}),b2e=S.memo(function(e){var t=e.slice,n=e.slices,r=e.axis,i=e.debug,o=e.tooltip,a=e.isCurrent,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd,g=ci(),v=g.showTooltipFromEvent,b=g.hideTooltip,y=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),s(t),l&&l(t,_)},[v,o,t,r,s,l]),x=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),c&&c(t,_)},[v,o,t,r,c]),$=S.useCallback(function(_){b(),s(null),u&&u(t,_)},[b,s,u,t]),w=S.useCallback(function(_){d&&d(t,_)},[t,d]),M=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),s(t),f&&f(t,_)},[r,f,s,v,t,o]),V=S.useCallback(function(_){var O=_.touches[0],k=document.elementFromPoint(O.clientX,O.clientY),A=k==null?void 0:k.getAttribute("data-ref");if(A){var H=n.find(function(R){return R.id===A});H&&(v(S.createElement(o,{slice:H,axis:r}),_,"right"),s(H))}h&&h(t,_)},[r,h,s,v,t,n,o]),E=S.useCallback(function(_){b(),s(null),m&&m(t,_)},[b,s,m,t]);return p.jsx("rect",{x:t.x0,y:t.y0,width:t.width,height:t.height,stroke:"red",strokeWidth:i?1:0,strokeOpacity:.75,fill:"red",fillOpacity:a&&i?.35:0,onMouseEnter:y,onMouseMove:x,onMouseLeave:$,onClick:w,onTouchStart:M,onTouchMove:V,onTouchEnd:E,"data-ref":t.id})}),y2e=S.memo(function(e){var t=e.slices,n=e.axis,r=e.debug,i=e.height,o=e.tooltip,a=e.current,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd;return t.map(function(g){return p.jsx(b2e,{slice:g,slices:t,axis:n,debug:r,height:i,tooltip:o,setCurrent:s,isCurrent:a!==null&&a.id===g.id,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:m},g.id)})}),C2e=S.memo(function(e){var t=e.points,n=e.symbol,r=e.size,i=e.borderWidth,o=e.enableLabel,a=e.label,s=e.labelYOffset,l=Wt(),c=lie(a),u=t.slice(0).reverse().map(function(d){return{id:d.id,x:d.x,y:d.y,datum:d.data,fill:d.color,stroke:d.borderColor,label:o?c(d):null}});return p.jsx("g",{children:u.map(function(d){return p.jsx(oie,{x:d.x,y:d.y,datum:d.datum,symbol:n,size:r,color:d.fill,borderWidth:i,borderColor:d.stroke,label:d.label,labelYOffset:s,theme:l},d.id)})})}),x2e=S.memo(function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,o=e.setCurrent,a=e.onMouseEnter,s=e.onMouseMove,l=e.onMouseLeave,c=e.onClick,u=e.onTouchStart,d=e.onTouchMove,f=e.onTouchEnd,h=e.tooltip,m=e.debug,g=e.enableTouchCrosshair,v=ci(),b=v.showTooltipAt,y=v.hideTooltip,x=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),a&&a(O,k)},[b,h,a,i]),$=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),s&&s(O,k)},[b,h,i.left,i.top,s]),w=S.useCallback(function(O,k){y(),l&&l(O,k)},[y,l]),M=S.useCallback(function(O,k){c&&c(O,k)},[c]),V=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),u&&u(O,k)},[i.left,i.top,u,b,h]),E=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),d&&d(O,k)},[i.left,i.top,d,b,h]),_=S.useCallback(function(O,k){y(),f&&f(O,k)},[f,y]);return p.jsx(W$,{nodes:t,width:n,height:r,setCurrent:o,onMouseEnter:x,onMouseMove:$,onMouseLeave:w,onClick:M,onTouchStart:V,onTouchMove:E,onTouchEnd:_,enableTouchCrosshair:g,debug:m})}),w2e=i$(function(e){var t=e.data,n=e.xScale,r=n===void 0?{type:"point"}:n,i=e.xFormat,o=e.yScale,a=o===void 0?{type:"linear",min:0,max:"auto"}:o,s=e.yFormat,l=e.layers,c=l===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:l,u=e.curve,d=u===void 0?"linear":u,f=e.areaBaselineValue,h=f===void 0?0:f,m=e.colors,g=m===void 0?{scheme:"nivo"}:m,v=e.margin,b=e.width,y=e.height,x=e.axisTop,$=e.axisRight,w=e.axisBottom,M=w===void 0?{}:w,V=e.axisLeft,E=V===void 0?{}:V,_=e.enableGridX,O=_===void 0||_,k=e.enableGridY,A=k===void 0||k,H=e.gridXValues,R=e.gridYValues,j=e.lineWidth,L=j===void 0?2:j,T=e.enableArea,I=T!==void 0&&T,P=e.areaOpacity,N=P===void 0?.2:P,z=e.areaBlendMode,U=z===void 0?"normal":z,q=e.enablePoints,Y=q===void 0||q,ee=e.pointSymbol,Q=e.pointSize,K=Q===void 0?6:Q,J=e.pointColor,W=J===void 0?{from:"color"}:J,Z=e.pointBorderWidth,G=Z===void 0?0:Z,F=e.pointBorderColor,re=F===void 0?{theme:"background"}:F,B=e.enablePointLabel,ie=B!==void 0&&B,oe=e.pointLabel,ve=oe===void 0?"data.yFormatted":oe,Ce=e.pointLabelYOffset,pe=e.defs,ye=pe===void 0?[]:pe,Se=e.fill,me=Se===void 0?[]:Se,ge=e.markers,ce=e.legends,$e=ce===void 0?[]:ce,he=e.isInteractive,Ae=he===void 0||he,Ie=e.useMesh,Te=Ie!==void 0&&Ie,ke=e.debugMesh,Ye=ke!==void 0&&ke,Xe=e.onMouseEnter,Fe=e.onMouseMove,Le=e.onMouseLeave,Qe=e.onClick,Ze=e.onTouchStart,qe=e.onTouchMove,de=e.onTouchEnd,Ee=e.tooltip,Ke=Ee===void 0?Rh:Ee,nt=e.enableSlices,Ne=nt!==void 0&&nt,ze=e.debugSlices,De=ze!==void 0&&ze,Je=e.sliceTooltip,tt=Je===void 0?yM:Je,Be=e.enableCrosshair,je=Be===void 0||Be,ct=e.crosshairType,pt=ct===void 0?"bottom-left":ct,Oe=e.enableTouchCrosshair,fe=Oe!==void 0&&Oe,we=e.role,He=we===void 0?"img":we,Ge=Za(b,y,v),We=Ge.margin,rt=Ge.innerWidth,X=Ge.innerHeight,ae=Ge.outerWidth,se=Ge.outerHeight,Ve=xM({data:t,xScale:r,xFormat:i,yScale:a,yFormat:s,width:rt,height:X,colors:g,curve:d,areaBaselineValue:h,pointColor:W,pointBorderColor:re,enableSlices:Ne}),it=Ve.legendData,at=Ve.toggleSerie,st=Ve.lineGenerator,ft=Ve.areaGenerator,be=Ve.series,xe=Ve.xScale,Re=Ve.yScale,ot=Ve.slices,vt=Ve.points,xt=Wt(),ht=Er(W,xt),Ht=Er(re,xt),nn=S.useState(null),It=nn[0],dn=nn[1],lr=S.useState(null),Nt=lr[0],Tn=lr[1],lt={grid:p.jsx(N$,{theme:xt,width:rt,height:X,xScale:O?xe:null,yScale:A?Re:null,xValues:H,yValues:R},"grid"),markers:p.jsx(r$,{markers:ge,width:rt,height:X,xScale:xe,yScale:Re,theme:xt},"markers"),axes:p.jsx(A$,{xScale:xe,yScale:Re,width:rt,height:X,theme:xt,top:x,right:$,bottom:M,left:E},"axes"),areas:null,lines:p.jsx(p2e,{lines:be,lineGenerator:st,lineWidth:L},"lines"),slices:null,points:null,crosshair:null,mesh:null,legends:$e.map(function(ln,fn){return p.jsx(jf,hr({},ln,{containerWidth:rt,containerHeight:X,data:ln.data||it,theme:xt,toggleSerie:ln.toggleSerie?at:void 0}),"legend."+fn)})},_n=wh(ye,be,me);return I&&(lt.areas=p.jsx(v2e,{areaGenerator:ft,areaOpacity:N,areaBlendMode:U,lines:be},"areas")),Ae&&Ne!==!1&&(lt.slices=p.jsx(y2e,{slices:ot,axis:Ne,debug:De,height:X,tooltip:tt,current:Nt,setCurrent:Tn,onMouseEnter:Xe,onMouseMove:Fe,onMouseLeave:Le,onClick:Qe,onTouchStart:Ze,onTouchMove:qe,onTouchEnd:de},"slices")),Y&&(lt.points=p.jsx(C2e,{points:vt,symbol:ee,size:K,color:ht,borderWidth:G,borderColor:Ht,enableLabel:ie,label:ve,labelYOffset:Ce},"points")),Ae&&je&&(It!==null&&(lt.crosshair=p.jsx(d4,{width:rt,height:X,x:It.x,y:It.y,type:pt},"crosshair")),Nt!==null&&(lt.crosshair=p.jsx(d4,{width:rt,height:X,x:Nt.x,y:Nt.y,type:Ne},"crosshair"))),Ae&&Te&&Ne===!1&&(lt.mesh=p.jsx(x2e,{points:vt,width:rt,height:X,margin:We,current:It,setCurrent:dn,onMouseEnter:Xe,onMouseMove:Fe,onMouseLeave:Le,onClick:Qe,onTouchStart:Ze,onTouchMove:qe,onTouchEnd:de,tooltip:Ke,enableTouchCrosshair:fe,debug:Ye},"mesh")),p.jsx(Sl,{defs:_n,width:ae,height:se,margin:We,role:He,children:c.map(function(ln,fn){return typeof ln=="function"?p.jsx(S.Fragment,{children:ln(hr({},e,{innerWidth:rt,innerHeight:X,series:be,slices:ot,points:vt,xScale:xe,yScale:Re,lineGenerator:st,areaGenerator:ft,currentPoint:It,setCurrentPoint:dn,currentSlice:Nt,setCurrentSlice:Tn}))},fn):lt[ln]})})}),S2e=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(w2e,hr({width:n,height:r},e))}})},$2e=i$(function(e){var t=S.useRef(null),n=e.width,r=e.height,i=e.margin,o=e.pixelRatio,a=o===void 0?typeof window<"u"&&window.devicePixelRatio||1:o,s=e.data,l=e.xScale,c=l===void 0?{type:"point"}:l,u=e.xFormat,d=e.yScale,f=d===void 0?{type:"linear",min:0,max:"auto"}:d,h=e.yFormat,m=e.curve,g=m===void 0?"linear":m,v=e.layers,b=v===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:v,y=e.colors,x=y===void 0?{scheme:"nivo"}:y,$=e.lineWidth,w=$===void 0?2:$,M=e.enableArea,V=M!==void 0&&M,E=e.areaBaselineValue,_=E===void 0?0:E,O=e.areaOpacity,k=O===void 0?.2:O,A=e.enablePoints,H=A===void 0||A,R=e.pointSize,j=R===void 0?6:R,L=e.pointColor,T=L===void 0?{from:"color"}:L,I=e.pointBorderWidth,P=I===void 0?0:I,N=e.pointBorderColor,z=N===void 0?{theme:"background"}:N,U=e.enableGridX,q=U===void 0||U,Y=e.gridXValues,ee=e.enableGridY,Q=ee===void 0||ee,K=e.gridYValues,J=e.axisTop,W=e.axisRight,Z=e.axisBottom,G=Z===void 0?{}:Z,F=e.axisLeft,re=F===void 0?{}:F,B=e.legends,ie=B===void 0?[]:B,oe=e.isInteractive,ve=oe===void 0||oe,Ce=e.debugMesh,pe=Ce!==void 0&&Ce,ye=e.onMouseLeave,Se=e.onClick,me=e.tooltip,ge=me===void 0?Rh:me,ce=e.canvasRef,$e=Za(n,r,i),he=$e.margin,Ae=$e.innerWidth,Ie=$e.innerHeight,Te=$e.outerWidth,ke=$e.outerHeight,Ye=Wt(),Xe=S.useState(null),Fe=Xe[0],Le=Xe[1],Qe=xM({data:s,xScale:c,xFormat:u,yScale:f,yFormat:h,width:Ae,height:Ie,colors:x,curve:g,areaBaselineValue:_,pointColor:T,pointBorderColor:z}),Ze=Qe.lineGenerator,qe=Qe.areaGenerator,de=Qe.series,Ee=Qe.xScale,Ke=Qe.yScale,nt=Qe.points,Ne=Oh({points:nt,width:Ae,height:Ie,debug:pe}),ze=Ne.delaunay,De=Ne.voronoi;S.useEffect(function(){ce&&(ce.current=t.current),t.current.width=Te*a,t.current.height=ke*a;var fe=t.current.getContext("2d");fe.scale(a,a),fe.fillStyle=Ye.background,fe.fillRect(0,0,Te,ke),fe.translate(he.left,he.top),b.forEach(function(we){if(typeof we=="function"&&we({ctx:fe,innerWidth:Ae,innerHeight:Ie,series:de,points:nt,xScale:Ee,yScale:Ke,lineWidth:w,lineGenerator:Ze,areaGenerator:qe,currentPoint:Fe,setCurrentPoint:Le}),we==="grid"&&Ye.grid.line.strokeWidth>0&&(fe.lineWidth=Ye.grid.line.strokeWidth,fe.strokeStyle=Ye.grid.line.stroke,q&&yd(fe,{width:Ae,height:Ie,scale:Ee,axis:"x",values:Y}),Q&&yd(fe,{width:Ae,height:Ie,scale:Ke,axis:"y",values:K})),we==="axes"&&F$(fe,{xScale:Ee,yScale:Ke,width:Ae,height:Ie,top:J,right:W,bottom:G,left:re,theme:Ye}),we==="areas"&&V===!0){fe.save(),fe.globalAlpha=k,qe.context(fe);for(var He=de.length-1;He>=0;He--)fe.fillStyle=de[He].color,fe.beginPath(),qe(de[He].data.map(function(We){return We.position})),fe.fill();fe.restore()}if(we==="lines"&&(Ze.context(fe),de.forEach(function(We){fe.strokeStyle=We.color,fe.lineWidth=w,fe.beginPath(),Ze(We.data.map(function(rt){return rt.position})),fe.stroke()})),we==="points"&&H===!0&&j>0&&nt.forEach(function(We){fe.fillStyle=We.color,fe.beginPath(),fe.arc(We.x,We.y,j/2,0,2*Math.PI),fe.fill(),P>0&&(fe.strokeStyle=We.borderColor,fe.lineWidth=P,fe.stroke())}),we==="mesh"&&pe===!0&&(Z$(fe,De),Fe&&U$(fe,De,Fe.index)),we==="legends"){var Ge=de.map(function(We){return{id:We.id,label:We.id,color:We.color}}).reverse();ie.forEach(function(We){d$(fe,hr({},We,{data:We.data||Ge,containerWidth:Ae,containerHeight:Ie,theme:Ye}))})}})},[t,Te,ke,b,Ye,Ze,de,Ee,Ke,q,Y,Q,K,J,W,G,re,ie,nt,H,j,Fe]);var Je=S.useCallback(function(fe){var we=xh(t.current,fe),He=we[0],Ge=we[1];if(!o$(he.left,he.top,Ae,Ie,He,Ge))return null;var We=ze.find(He-he.left,Ge-he.top);return nt[We]},[t,he,Ae,Ie,ze]),tt=ci(),Be=tt.showTooltipFromEvent,je=tt.hideTooltip,ct=S.useCallback(function(fe){var we=Je(fe);Le(we),we?Be(S.createElement(ge,{point:we}),fe):je()},[Je,Le,Be,je,ge]),pt=S.useCallback(function(fe){je(),Le(null),Fe&&ye&&ye(Fe,fe)},[je,Le,ye]),Oe=S.useCallback(function(fe){if(Se){var we=Je(fe);we&&Se(we,fe)}},[Je,Se]);return p.jsx("canvas",{ref:t,width:Te*a,height:ke*a,style:{width:Te,height:ke,cursor:ve?"auto":"normal"},onMouseEnter:ve?ct:void 0,onMouseMove:ve?ct:void 0,onMouseLeave:ve?pt:void 0,onClick:ve?Oe:void 0})}),M2e=S.forwardRef(function(e,t){return p.jsx($2e,hr({},e,{canvasRef:t}))});S.forwardRef(function(e,t){return p.jsx(qo,{children:function(n){var r=n.width,i=n.height;return p.jsx(M2e,hr({width:r,height:i},e,{ref:t}))}})});const _2e=({trendsData:e,height:t=null,margin:n={},colors:r=null,xLeg:i,yLeg:o,tooltip:a=null})=>p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{style:{width:"100%",height:t||600},children:p.jsx(S2e,{data:e,margin:{top:50,right:90,bottom:50,left:90,...n},colors:r||{scheme:"nivo"},xScale:{type:"point"},yScale:{type:"linear",min:"auto",max:"auto",reverse:!1},axisTop:null,axisRight:null,axisBottom:{tickSize:5,tickPadding:5,tickRotation:0,legend:i,legendOffset:36,legendPosition:"middle"},axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,legend:o,legendOffset:-70,legendPosition:"middle"},pointSize:10,pointColor:{theme:"background"},pointBorderWidth:2,pointBorderColor:{from:"serieColor"},pointLabelYOffset:-12,useMesh:!0,legends:[{anchor:"top-right",direction:"column",justify:!1,translateX:210,translateY:-40,itemsSpacing:0,itemDirection:"left-to-right",itemWidth:200,itemHeight:20,itemOpacity:.9,symbolSize:8,symbolShape:"circle",symbolBorderColor:"rgba(0, 0, 0, .5)",effects:[{on:"hover",style:{itemBackground:"rgba(0, 0, 0, .03)",itemOpacity:1}}]}],tooltip:s=>p.jsx(er,{body:(a==null?void 0:a(s))||p.jsx("span",{children:"Line tooltip"})})})})]}),E2e=Ct.h3`
|
|
497
|
+
`,vle=({pieChartData:e,title:t,isEmpty:n,sortByValue:r=!0,arcLabel:i=null,tooltip:o=null,customStyle:a={},customMargin:s={},height:l=600,legendWidth:c="50%"})=>{const[u,d]=S.useState([]),f=({centerX:m,centerY:g,dataWithArc:v})=>(u.length||d(v),p.jsx("text",{x:m,y:g,textAnchor:"middle",dominantBaseline:"central",style:{fontSize:"16px",font:"var(--gf-label-md-default)",fontWeight:400},children:n?"Data niet openbaar beschikbaar":""})),h=({data:m})=>p.jsx(mn,{gap:16,className:"gf-full",justify:"center",wrap:!0,style:{width:c},children:m==null?void 0:m.map((g,v)=>p.jsxs(mn,{gap:8,align:"center",children:[p.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:g.color}}),p.jsx(gle,{children:g.label})]},`legend-${v}`))});return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsxs(mn,{vertical:!0,gap:8,align:"center",style:{width:"100%"},children:[p.jsx(hle,{children:t}),p.jsx("div",{style:{width:"100%",height:l},children:p.jsx(fle,{colors:n?{scheme:"greys"}:{datum:"data.color"},data:e,sortByValue:r,enableArcLabels:!n,arcLabel:m=>(i==null?void 0:i(m))||m.formattedValue,enableArcLinkLabels:!1,margin:{top:50,right:80,bottom:50,left:80,...s},innerRadius:.5,padAngle:.7,cornerRadius:3,activeOuterRadiusOffset:8,borderWidth:1,borderColor:{from:"color",modifiers:[["darker",.2]]},arcLabelsSkipAngle:10,arcLabelsTextColor:{from:"color",modifiers:[["darker",2]]},isInteractive:!n,layers:["arcs","arcLabels","arcLinkLabels","legends",f],tooltip:m=>p.jsx(er,{body:(o==null?void 0:o(m))||p.jsx("span",{children:"Pie chart tooltip"})})})}),!n&&p.jsx(h,{data:u})]})]})};var mle=cf,ple=bh,ble=1,yle=2;function Cle(e,t,n,r){var i=n.length,o=i,a=!r;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var l=s[0],c=e[l],u=s[1];if(a&&s[2]){if(c===void 0&&!(l in e))return!1}else{var d=new mle;if(r)var f=r(c,u,l,e,t,d);if(!(f===void 0?ple(u,c,ble|yle,r,d):f))return!1}}return!0}var xle=Cle,wle=Mi;function Sle(e){return e===e&&!wle(e)}var M$=Sle,$le=M$,Mle=S1;function _le(e){for(var t=Mle(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,$le(i)]}return t}var Ele=_le;function Ole(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var _$=Ole,Hle=xle,Vle=Ele,Tle=_$;function Rle(e){var t=Vle(e);return t.length==1&&t[0][2]?Tle(t[0][0],t[0][1]):function(n){return n===e||Hle(n,e,t)}}var kle=Rle,Lle=bh,jle=Hw,Ple=OS,Ile=I6,Ale=M$,Nle=_$,Fle=ul,Dle=1,zle=2;function Ble(e,t){return Ile(e)&&Ale(t)?Nle(Fle(e),t):function(n){var r=jle(n,e);return r===void 0&&r===t?Ple(n,e):Lle(t,r,Dle|zle)}}var Wle=Ble;function Zle(e){return function(t){return t==null?void 0:t[e]}}var Ule=Zle,qle=b1;function Gle(e){return function(t){return qle(t,e)}}var Yle=Gle,Kle=Ule,Xle=Yle,Qle=I6,Jle=ul;function ece(e){return Qle(e)?Kle(Jle(e)):Xle(e)}var tce=ece,nce=kle,rce=Wle,ice=gf,oce=Cr,ace=tce;function sce(e){return typeof e=="function"?e:e==null?ice:typeof e=="object"?oce(e)?rce(e[0],e[1]):nce(e):ace(e)}var $h=sce,lce=$h,cce=xx;function uce(e,t){return e&&e.length?cce(e,lce(t)):[]}var dce=uce;const k4=xn(dce);var fce=dw,hce=S1;function gce(e,t){return e&&fce(e,t,hce)}var vce=gce,mce=al;function pce(e,t){return function(n,r){if(n==null)return n;if(!mce(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Object(n);(t?o--:++o<i)&&r(a[o],o,a)!==!1;);return n}}var bce=pce,yce=vce,Cce=bce,xce=Cce(yce),E$=xce,wce=E$,Sce=al;function $ce(e,t){var n=-1,r=Sce(e)?Array(e.length):[];return wce(e,function(i,o,a){r[++n]=t(i,o,a)}),r}var Mce=$ce;function _ce(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}var Ece=_ce,Ym=vf;function Oce(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,o=Ym(e),a=t!==void 0,s=t===null,l=t===t,c=Ym(t);if(!s&&!c&&!o&&e>t||o&&a&&l&&!s&&!c||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!c&&e<t||c&&n&&i&&!r&&!o||s&&n&&i||!a&&i||!l)return-1}return 0}var Hce=Oce,Vce=Hce;function Tce(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var l=Vce(i[r],o[r]);if(l){if(r>=s)return l;var c=n[r];return l*(c=="desc"?-1:1)}}return e.index-t.index}var Rce=Tce,w2=mf,kce=b1,Lce=$h,jce=Mce,Pce=Ece,Ice=sl,Ace=Rce,Nce=gf,Fce=Cr;function Dce(e,t,n){t.length?t=w2(t,function(o){return Fce(o)?function(a){return kce(a,o.length===1?o[0]:o)}:o}):t=[Nce];var r=-1;t=w2(t,Ice(Lce));var i=jce(e,function(o,a,s){var l=w2(t,function(c){return c(o)});return{criteria:l,index:++r,value:o}});return Pce(i,function(o,a){return Ace(o,a,n)})}var zce=Dce,Bce=VS,Wce=zce,Zce=j6,Km=_w,Uce=Zce(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Km(e,t[0],t[1])?t=[]:n>2&&Km(t[0],t[1],t[2])&&(t=[t[0]]),Wce(e,Bce(t,1),[])}),qce=Uce;const Gce=xn(qce);var Yce=po,Kce=Gr,Xce="[object Date]";function Qce(e){return Kce(e)&&Yce(e)==Xce}var Jce=Qce,e1e=Jce,t1e=sl,Xm=ff,Qm=Xm&&Xm.isDate,n1e=Qm?t1e(Qm):e1e,r1e=n1e;const i1e=xn(r1e);var S2=new Date,$2=new Date;function Mn(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=function(o){return e(o=new Date(+o)),o},i.ceil=function(o){return e(o=new Date(o-1)),t(o,1),e(o),o},i.round=function(o){var a=i(o),s=i.ceil(o);return o-a<s-o?a:s},i.offset=function(o,a){return t(o=new Date(+o),a==null?1:Math.floor(a)),o},i.range=function(o,a,s){var l=[],c;if(o=i.ceil(o),s=s==null?1:Math.floor(s),!(o<a)||!(s>0))return l;do l.push(c=new Date(+o)),t(o,s),e(o);while(c<o&&o<a);return l},i.filter=function(o){return Mn(function(a){if(a>=a)for(;e(a),!o(a);)a.setTime(a-1)},function(a,s){if(a>=a)if(s<0)for(;++s<=0;)for(;t(a,-1),!o(a););else for(;--s>=0;)for(;t(a,1),!o(a););})},n&&(i.count=function(o,a){return S2.setTime(+o),$2.setTime(+a),e(S2),e($2),Math.floor(n(S2,$2))},i.every=function(o){return o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?function(a){return r(a)%o===0}:function(a){return i.count(0,a)%o===0}):i}),i}var vo=Mn(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});vo.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Mn(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):vo};vo.range;var pd=1e3,Zs=6e4,bd=36e5,O$=6048e5,_a=Mn(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*pd)},function(e,t){return(t-e)/pd},function(e){return e.getUTCSeconds()});_a.range;var Pf=Mn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*pd)},function(e,t){e.setTime(+e+t*Zs)},function(e,t){return(t-e)/Zs},function(e){return e.getMinutes()});Pf.range;var If=Mn(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*pd-e.getMinutes()*Zs)},function(e,t){e.setTime(+e+t*bd)},function(e,t){return(t-e)/bd},function(e){return e.getHours()});If.range;function qa(e){return Mn(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n*7)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Zs)/O$})}var Ea=qa(0),Af=qa(1),Nf=qa(2),Ff=qa(3),Df=qa(4),zf=qa(5),Bf=qa(6);Ea.range;Af.range;Nf.range;Ff.range;Df.range;zf.range;Bf.range;var Wf=Mn(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});Wf.range;var M1=Mn(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});M1.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Mn(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)})};M1.range;var Zf=Mn(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Zs)},function(e,t){return(t-e)/Zs},function(e){return e.getUTCMinutes()});Zf.range;var Uf=Mn(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*bd)},function(e,t){return(t-e)/bd},function(e){return e.getUTCHours()});Uf.range;function Ga(e){return Mn(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n*7)},function(t,n){return(n-t)/O$})}var Oa=Ga(0),qf=Ga(1),Gf=Ga(2),Yf=Ga(3),Kf=Ga(4),Xf=Ga(5),Qf=Ga(6);Oa.range;qf.range;Gf.range;Yf.range;Kf.range;Xf.range;Qf.range;var Jf=Mn(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()});Jf.range;var _1=Mn(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});_1.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Mn(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})};_1.range;function ia(){return ia=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ia.apply(this,arguments)}var us=[function(e){return e.setMilliseconds(0)},function(e){return e.setSeconds(0)},function(e){return e.setMinutes(0)},function(e){return e.setHours(0)},function(e){return e.setDate(1)},function(e){return e.setMonth(0)}],o1e={millisecond:[],second:us.slice(0,1),minute:us.slice(0,2),hour:us.slice(0,3),day:us.slice(0,4),month:us.slice(0,5),year:us.slice(0,6)},a1e=function(e){return function(t){return o1e[e].forEach(function(n){n(t)}),t}},H$=function(e){var t=e.format,n=t===void 0?"native":t,r=e.precision,i=r===void 0?"millisecond":r,o=e.useUTC,a=o===void 0||o,s=a1e(i);return function(l){if(l===void 0)return l;if(n==="native"||l instanceof Date)return s(l);var c=a?vh(n):gh(n);return s(c(l))}},s1e=function(e,t,n,r){var i,o,a,s,l=e.min,c=l===void 0?0:l,u=e.max,d=u===void 0?"auto":u,f=e.stacked,h=f!==void 0&&f,m=e.reverse,g=m!==void 0&&m,v=e.clamp,b=v!==void 0&&v,y=e.nice,x=y!==void 0&&y;c==="auto"?i=h===!0?(o=t.minStacked)!=null?o:0:t.min:i=c,d==="auto"?a=h===!0?(s=t.maxStacked)!=null?s:0:t.max:a=d;var $=Uo().rangeRound(r==="x"?[0,n]:[n,0]).domain(g?[a,i]:[i,a]).clamp(b);return x===!0?$.nice():typeof x=="number"&&$.nice(x),l1e($,h)},l1e=function(e,t){t===void 0&&(t=!1);var n=e;return n.type="linear",n.stacked=t,n},c1e=function(e,t,n){var r=Fw().range([0,n]).domain(t.all);return r.type="point",r},u1e=function(e,t,n,r){var i=e.round,o=i===void 0||i,a=Ns().range(r==="x"?[0,n]:[n,0]).domain(t.all).round(o);return d1e(a)},d1e=function(e){var t=e;return t.type="band",t},f1e=function(e,t,n){var r,i,o=e.format,a=o===void 0?"native":o,s=e.precision,l=s===void 0?"millisecond":s,c=e.min,u=c===void 0?"auto":c,d=e.max,f=d===void 0?"auto":d,h=e.useUTC,m=h===void 0||h,g=e.nice,v=g!==void 0&&g,b=H$({format:a,precision:l,useUTC:m});r=u==="auto"?b(t.min):a!=="native"?b(u):u,i=f==="auto"?b(t.max):a!=="native"?b(f):f;var y=m?tS():eS();y.range([0,n]),r&&i&&y.domain([r,i]),v===!0?y.nice():typeof v!="object"&&typeof v!="number"||y.nice(v);var x=y;return x.type="time",x.useUTC=m,x},h1e=function(e,t,n,r){var i,o=e.base,a=o===void 0?10:o,s=e.min,l=s===void 0?"auto":s,c=e.max,u=c===void 0?"auto":c;if(t.all.some(function(g){return g===0}))throw new Error("a log scale domain must not include or cross zero");var d,f,h=!1;if(t.all.filter(function(g){return g!=null}).forEach(function(g){h||(i===void 0?i=Math.sign(g):Math.sign(g)!==i&&(h=!0))}),h)throw new Error("a log scale domain must be strictly-positive or strictly-negative");d=l==="auto"?t.min:l,f=u==="auto"?t.max:u;var m=G6().domain([d,f]).rangeRound(r==="x"?[0,n]:[n,0]).base(a).nice();return m.type="log",m},g1e=function(e,t,n,r){var i,o,a=e.constant,s=a===void 0?1:a,l=e.min,c=l===void 0?"auto":l,u=e.max,d=u===void 0?"auto":u,f=e.reverse,h=f!==void 0&&f;i=c==="auto"?t.min:c,o=d==="auto"?t.max:d;var m=Y6().constant(s).rangeRound(r==="x"?[0,n]:[n,0]).nice();h===!0?m.domain([o,i]):m.domain([i,o]);var g=m;return g.type="symlog",g},v1e=function(e){return e==="x"?"y":"x"},m1e=function(e,t){return e===t},p1e=function(e,t){return e.getTime()===t.getTime()};function Jm(e,t,n,r){switch(e.type){case"linear":return s1e(e,t,n,r);case"point":return c1e(e,t,n);case"band":return u1e(e,t,n,r);case"time":return f1e(e,t,n);case"log":return h1e(e,t,n,r);case"symlog":return g1e(e,t,n,r);default:throw new Error("invalid scale spec")}}var ep=function(e,t,n){var r;if("stacked"in n&&n.stacked){var i=e.data[t==="x"?"xStacked":"yStacked"];return i==null?null:n(i)}return(r=n(e.data[t]))!=null?r:null},V$=function(e,t,n,r,i){var o=e.map(function(u){return function(d){return ia({},d,{data:d.data.map(function(f){return{data:ia({},f)}})})}(u)}),a=b1e(o,t,n);"stacked"in t&&t.stacked===!0&&y1e(a,o),"stacked"in n&&n.stacked===!0&&C1e(a,o);var s=Jm(t,a.x,r,"x"),l=Jm(n,a.y,i,"y"),c=o.map(function(u){return ia({},u,{data:u.data.map(function(d){return ia({},d,{position:{x:ep(d,"x",s),y:ep(d,"y",l)}})})})});return ia({},a,{series:c,xScale:s,yScale:l})},b1e=function(e,t,n){return{x:tp(e,"x",t),y:tp(e,"y",n)}},tp=function(e,t,n,r){var i={},o=i.getValue,a=o===void 0?function(m){return m.data[t]}:o,s=i.setValue,l=s===void 0?function(m,g){m.data[t]=g}:s;if(n.type==="linear")e.forEach(function(m){m.data.forEach(function(g){var v=a(g);v&&l(g,parseFloat(String(v)))})});else if(n.type==="time"&&n.format!=="native"){var c=H$(n);e.forEach(function(m){m.data.forEach(function(g){var v=a(g);v&&l(g,c(v))})})}var u=[];switch(e.forEach(function(m){m.data.forEach(function(g){u.push(a(g))})}),n.type){case"linear":var d=Gce(Y3(u).filter(function(m){return m!==null}),function(m){return m});return{all:d,min:Math.min.apply(Math,d),max:Math.max.apply(Math,d)};case"time":var f=k4(u,function(m){return m.getTime()}).slice(0).sort(function(m,g){return g.getTime()-m.getTime()}).reverse();return{all:f,min:f[0],max:ue(f)};default:var h=Y3(u);return{all:h,min:h[0],max:ue(h)}}},T$=function(e,t,n){var r=v1e(e),i=[];t[r].all.forEach(function(o){var a=i1e(o)?p1e:m1e,s=[];n.forEach(function(l){var c=l.data.find(function(h){return a(h.data[r],o)}),u=null,d=null;if(c!==void 0){if((u=c.data[e])!==null){var f=ue(s);f===void 0?d=u:f!==null&&(d=f+u)}c.data[e==="x"?"xStacked":"yStacked"]=d}s.push(d),d!==null&&i.push(d)})}),t[e].minStacked=Math.min.apply(Math,i),t[e].maxStacked=Math.max.apply(Math,i)},y1e=function(e,t){return T$("x",e,t)},C1e=function(e,t){return T$("y",e,t)},R$=function(e){var t=e.bandwidth();if(t===0)return e;var n=t/2;return e.round()&&(n=Math.round(n)),function(r){var i;return((i=e(r))!=null?i:0)+n}},k$={millisecond:[vo,vo],second:[_a,_a],minute:[Pf,Zf],hour:[If,Uf],day:[Mn(function(e){return e.setHours(0,0,0,0)},function(e,t){return e.setDate(e.getDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)}),Mn(function(e){return e.setUTCHours(0,0,0,0)},function(e,t){return e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)})],week:[Ea,Oa],sunday:[Ea,Oa],monday:[Af,qf],tuesday:[Nf,Gf],wednesday:[Ff,Yf],thursday:[Df,Kf],friday:[zf,Xf],saturday:[Bf,Qf],month:[Wf,Jf],year:[M1,_1]},x1e=Object.keys(k$),w1e=new RegExp("^every\\s*(\\d+)?\\s*("+x1e.join("|")+")s?$","i"),L$=function(e,t){if(Array.isArray(t))return t;if(typeof t=="string"&&"useUTC"in e){var n=t.match(w1e);if(n){var r=n[1],i=n[2],o=k$[i][e.useUTC?1:0];if(i==="day"){var a,s,l=e.domain(),c=l[0],u=l[1],d=new Date(u);return d.setDate(d.getDate()+1),(a=(s=o.every(Number(r??1)))==null?void 0:s.range(c,d))!=null?a:[]}if(r===void 0)return e.ticks(o);var f=o.every(Number(r));if(f)return e.ticks(f)}throw new Error("Invalid tickValues: "+t)}if("ticks"in e){if(t===void 0)return e.ticks();if(typeof(h=t)=="number"&&isFinite(h)&&Math.floor(h)===h)return e.ticks(t)}var h;return e.domain()};function zr(){return zr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zr.apply(this,arguments)}var j$=function(e){var t,n=e.axis,r=e.scale,i=e.ticksPosition,o=e.tickValues,a=e.tickSize,s=e.tickPadding,l=e.tickRotation,c=e.truncateTickAt,u=e.engine,d=u===void 0?"svg":u,f=L$(r,o),h=tie[d],m="bandwidth"in r?R$(r):r,g={lineX:0,lineY:0},v={textX:0,textY:0},b=typeof document=="object"&&document.dir==="rtl",y=h.align.center,x=h.baseline.center;return n==="x"?(t=function($){var w;return{x:(w=m($))!=null?w:0,y:0}},g.lineY=a*(i==="after"?1:-1),v.textY=(a+s)*(i==="after"?1:-1),x=i==="after"?h.baseline.top:h.baseline.bottom,l===0?y=h.align.center:i==="after"&&l<0||i==="before"&&l>0?(y=h.align[b?"left":"right"],x=h.baseline.center):(i==="after"&&l>0||i==="before"&&l<0)&&(y=h.align[b?"right":"left"],x=h.baseline.center)):(t=function($){var w;return{x:0,y:(w=m($))!=null?w:0}},g.lineX=a*(i==="after"?1:-1),v.textX=(a+s)*(i==="after"?1:-1),y=i==="after"?h.align.left:h.align.right),{ticks:f.map(function($){var w=typeof $=="string"?function(M){var V=String(M).length;return c&&c>0&&V>c?""+String(M).slice(0,c).concat("..."):""+M}($):$;return zr({key:$ instanceof Date?""+$.valueOf():""+$,value:w},t($),g,v)}),textAlign:y,textBaseline:x}},P$=function(e,t){if(e===void 0||typeof e=="function")return e;if(t.type==="time"){var n=Wa(e);return function(r){return n(r instanceof Date?r:new Date(r))}}return Da(e)},L4=function(e){var t,n=e.width,r=e.height,i=e.scale,o=e.axis,a=e.values,s=(t=a,(Array.isArray(t)?a:void 0)||L$(i,a)),l="bandwidth"in i?R$(i):i,c=o==="x"?s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:(d=l(u))!=null?d:0,x2:(f=l(u))!=null?f:0,y1:0,y2:r}}):s.map(function(u){var d,f;return{key:u instanceof Date?""+u.valueOf():""+u,x1:0,x2:n,y1:(d=l(u))!=null?d:0,y2:(f=l(u))!=null?f:0}});return c},S1e=S.memo(function(e){var t,n=e.value,r=e.format,i=e.lineX,o=e.lineY,a=e.onClick,s=e.textBaseline,l=e.textAnchor,c=e.animatedProps,u=Wt(),d=u.axis.ticks.line,f=u.axis.ticks.text,h=(t=r==null?void 0:r(n))!=null?t:n,m=S.useMemo(function(){var g={opacity:c.opacity};return a?{style:zr({},g,{cursor:"pointer"}),onClick:function(v){return a(v,h)}}:{style:g}},[c.opacity,a,h]);return p.jsxs(et.g,zr({transform:c.transform},m,{children:[p.jsx("line",{x1:0,x2:i,y1:0,y2:o,style:d}),f.outlineWidth>0&&p.jsx(et.text,{dominantBaseline:s,textAnchor:l,transform:c.textTransform,style:f,strokeWidth:2*f.outlineWidth,stroke:f.outlineColor,strokeLinejoin:"round",children:""+h}),p.jsx(et.text,{dominantBaseline:s,textAnchor:l,transform:c.textTransform,style:Ch(f),children:""+h})]}))}),$1e=function(e){var t=e.axis,n=e.scale,r=e.x,i=r===void 0?0:r,o=e.y,a=o===void 0?0:o,s=e.length,l=e.ticksPosition,c=e.tickValues,u=e.tickSize,d=u===void 0?5:u,f=e.tickPadding,h=f===void 0?5:f,m=e.tickRotation,g=m===void 0?0:m,v=e.format,b=e.renderTick,y=b===void 0?S1e:b,x=e.truncateTickAt,$=e.legend,w=e.legendPosition,M=w===void 0?"end":w,V=e.legendOffset,E=V===void 0?0:V,_=e.onClick,O=e.ariaHidden,k=Wt(),A=k.axis.legend.text,H=S.useMemo(function(){return P$(v,n)},[v,n]),R=j$({axis:t,scale:n,ticksPosition:l,tickValues:c,tickSize:d,tickPadding:h,tickRotation:g,truncateTickAt:x}),j=R.ticks,L=R.textAlign,T=R.textBaseline,I=null;if($!==void 0){var P,N=0,z=0,U=0;t==="y"?(U=-90,N=E,M==="start"?(P="start",z=s):M==="middle"?(P="middle",z=s/2):M==="end"&&(P="end")):(z=E,M==="start"?P="start":M==="middle"?(P="middle",N=s/2):M==="end"&&(P="end",N=s)),I=p.jsxs(p.Fragment,{children:[A.outlineWidth>0&&p.jsx("text",{transform:"translate("+N+", "+z+") rotate("+U+")",textAnchor:P,style:zr({dominantBaseline:"central"},A),strokeWidth:2*A.outlineWidth,stroke:A.outlineColor,strokeLinejoin:"round",children:$}),p.jsx("text",{transform:"translate("+N+", "+z+") rotate("+U+")",textAnchor:P,style:zr({dominantBaseline:"central"},A),children:$})]})}var q=Fn(),Y=q.animate,ee=q.config,Q=Xt({transform:"translate("+i+","+a+")",lineX2:t==="x"?s:0,lineY2:t==="x"?0:s,config:ee,immediate:!Y}),K=S.useCallback(function(Z){return{opacity:1,transform:"translate("+Z.x+","+Z.y+")",textTransform:"translate("+Z.textX+","+Z.textY+") rotate("+g+")"}},[g]),J=S.useCallback(function(Z){return{opacity:0,transform:"translate("+Z.x+","+Z.y+")",textTransform:"translate("+Z.textX+","+Z.textY+") rotate("+g+")"}},[g]),W=yr(j,{keys:function(Z){return Z.key},initial:K,from:J,enter:K,update:K,leave:{opacity:0},config:ee,immediate:!Y});return p.jsxs(et.g,{transform:Q.transform,"aria-hidden":O,children:[W(function(Z,G,F,re){return C.createElement(y,zr({tickIndex:re,format:H,rotate:g,textBaseline:T,textAnchor:L,truncateTickAt:x,animatedProps:Z},G,_?{onClick:_}:{}))}),p.jsx(et.line,{style:k.axis.domain.line,x1:0,x2:Q.lineX2,y1:0,y2:Q.lineY2}),I]})},M1e=S.memo($1e),I$=["top","right","bottom","left"],A$=S.memo(function(e){var t=e.xScale,n=e.yScale,r=e.width,i=e.height,o={top:e.top,right:e.right,bottom:e.bottom,left:e.left};return p.jsx(p.Fragment,{children:I$.map(function(a){var s=o[a];if(!s)return null;var l=a==="top"||a==="bottom";return p.jsx(M1e,zr({},s,{axis:l?"x":"y",x:a==="right"?r:0,y:a==="bottom"?i:0,scale:l?t:n,length:l?r:i,ticksPosition:a==="top"||a==="left"?"before":"after",truncateTickAt:s.truncateTickAt}),a)})})}),_1e=S.memo(function(e){var t=e.animatedProps,n=Wt();return p.jsx(et.line,zr({},t,n.grid.line))}),np=S.memo(function(e){var t=e.lines,n=Fn(),r=n.animate,i=n.config,o=yr(t,{keys:function(a){return a.key},initial:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},from:function(a){return{opacity:0,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},enter:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},update:function(a){return{opacity:1,x1:a.x1,x2:a.x2,y1:a.y1,y2:a.y2}},leave:{opacity:0},config:i,immediate:!r});return p.jsx("g",{children:o(function(a,s){return S.createElement(_1e,zr({},s,{key:s.key,animatedProps:a}))})})}),N$=S.memo(function(e){var t=e.width,n=e.height,r=e.xScale,i=e.yScale,o=e.xValues,a=e.yValues,s=S.useMemo(function(){return!!r&&L4({width:t,height:n,scale:r,axis:"x",values:o})},[r,o,t,n]),l=S.useMemo(function(){return!!i&&L4({width:t,height:n,scale:i,axis:"y",values:a})},[n,t,i,a]);return p.jsxs(p.Fragment,{children:[s&&p.jsx(np,{lines:s}),l&&p.jsx(np,{lines:l})]})}),E1e=function(e,t){var n,r=t.axis,i=t.scale,o=t.x,a=o===void 0?0:o,s=t.y,l=s===void 0?0:s,c=t.length,u=t.ticksPosition,d=t.tickValues,f=t.tickSize,h=f===void 0?5:f,m=t.tickPadding,g=m===void 0?5:m,v=t.tickRotation,b=v===void 0?0:v,y=t.format,x=t.legend,$=t.legendPosition,w=$===void 0?"end":$,M=t.legendOffset,V=M===void 0?0:M,E=t.theme,_=j$({axis:r,scale:i,ticksPosition:u,tickValues:d,tickSize:h,tickPadding:g,tickRotation:b,engine:"canvas"}),O=_.ticks,k=_.textAlign,A=_.textBaseline;e.save(),e.translate(a,l),e.textAlign=k,e.textBaseline=A;var H=E.axis.ticks.text;e.font=(H.fontWeight?H.fontWeight+" ":"")+H.fontSize+"px "+H.fontFamily,((n=E.axis.domain.line.strokeWidth)!=null?n:0)>0&&(e.lineWidth=Number(E.axis.domain.line.strokeWidth),e.lineCap="square",E.axis.domain.line.stroke&&(e.strokeStyle=E.axis.domain.line.stroke),e.beginPath(),e.moveTo(0,0),e.lineTo(r==="x"?c:0,r==="x"?0:c),e.stroke());var R=typeof y=="function"?y:function(P){return""+P};if(O.forEach(function(P){var N;((N=E.axis.ticks.line.strokeWidth)!=null?N:0)>0&&(e.lineWidth=Number(E.axis.ticks.line.strokeWidth),e.lineCap="square",E.axis.ticks.line.stroke&&(e.strokeStyle=E.axis.ticks.line.stroke),e.beginPath(),e.moveTo(P.x,P.y),e.lineTo(P.x+P.lineX,P.y+P.lineY),e.stroke());var z=R(P.value);e.save(),e.translate(P.x+P.textX,P.y+P.textY),e.rotate(Dr(b)),H.outlineWidth>0&&(e.strokeStyle=H.outlineColor,e.lineWidth=2*H.outlineWidth,e.lineJoin="round",e.strokeText(""+z,0,0)),E.axis.ticks.text.fill&&(e.fillStyle=H.fill),e.fillText(""+z,0,0),e.restore()}),x!==void 0){var j=0,L=0,T=0,I="center";r==="y"?(T=-90,j=V,w==="start"?(I="start",L=c):w==="middle"?(I="center",L=c/2):w==="end"&&(I="end")):(L=V,w==="start"?I="start":w==="middle"?(I="center",j=c/2):w==="end"&&(I="end",j=c)),e.translate(j,L),e.rotate(Dr(T)),e.font=(E.axis.legend.text.fontWeight?E.axis.legend.text.fontWeight+" ":"")+E.axis.legend.text.fontSize+"px "+E.axis.legend.text.fontFamily,E.axis.legend.text.fill&&(e.fillStyle=E.axis.legend.text.fill),e.textAlign=I,e.textBaseline="middle",e.fillText(x,0,0)}e.restore()},F$=function(e,t){var n=t.xScale,r=t.yScale,i=t.width,o=t.height,a=t.top,s=t.right,l=t.bottom,c=t.left,u=t.theme,d={top:a,right:s,bottom:l,left:c};I$.forEach(function(f){var h=d[f];if(!h)return null;var m=f==="top"||f==="bottom",g=f==="top"||f==="left"?"before":"after",v=m?n:r,b=P$(h.format,v);E1e(e,zr({},h,{axis:m?"x":"y",x:f==="right"?i:0,y:f==="bottom"?o:0,scale:v,format:b,length:m?i:o,ticksPosition:g,theme:u}))})},yd=function(e,t){var n=t.width,r=t.height,i=t.scale,o=t.axis,a=t.values;L4({width:n,height:r,scale:i,axis:o,values:a}).forEach(function(s){e.beginPath(),e.moveTo(s.x1,s.y1),e.lineTo(s.x2,s.y2),e.stroke()})},O1e=E$;function H1e(e,t){var n=[];return O1e(e,function(r,i,o){t(r,i,o)&&n.push(r)}),n}var V1e=H1e,T1e=jS,R1e=V1e,k1e=$h,L1e=Cr;function j1e(e,t){var n=L1e(e)?T1e:R1e;return n(e,k1e(t))}var P1e=j1e;const Mh=xn(P1e);var I1e=po,A1e=Gr,N1e="[object Number]";function F1e(e){return typeof e=="number"||A1e(e)&&I1e(e)==N1e}var D1e=F1e;const Ha=xn(D1e);function z1e(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}var D$=z1e,B1e=b1,W1e=D$;function Z1e(e,t){return t.length<2?e:B1e(e,W1e(t,0,-1))}var U1e=Z1e,q1e=cl,G1e=Pw,Y1e=U1e,K1e=ul;function X1e(e,t){return t=q1e(t,e),e=Y1e(e,t),e==null||delete e[K1e(G1e(t))]}var Q1e=X1e,J1e=R6;function eue(e){return J1e(e)?void 0:e}var tue=eue,nue=mf,rue=b$,iue=Q1e,oue=cl,aue=ll,sue=tue,lue=TS,cue=g$,uue=1,due=2,fue=4,hue=lue(function(e,t){var n={};if(e==null)return n;var r=!1;t=nue(t,function(o){return o=oue(o,e),r||(r=o.length>1),o}),aue(e,cue(e),n),r&&(n=rue(n,uue|due|fue,sue));for(var i=t.length;i--;)iue(n,t[i]);return n}),gue=hue;const Ya=xn(gue);function Io(){return Io=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Io.apply(this,arguments)}var j4={dotSize:4,noteWidth:120,noteTextOffset:8,animate:!0},vue=function(e){var t=typeof e;return S.isValidElement(e)||t==="string"||t==="function"||t==="object"},mue=function(e){var t=typeof e;return t==="string"||t==="function"},Yc=function(e){return e.type==="circle"},P4=function(e){return e.type==="dot"},Kc=function(e){return e.type==="rect"},pue=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return n.reduce(function(o,a){var s=a.offset||0;return[].concat(o,Mh(t,a.match).map(function(l){var c=r(l),u=i(l);return(Yc(a)||Kc(a))&&(u.size=u.size+2*s,u.width=u.width+2*s,u.height=u.height+2*s),Io({},Ya(a,["match","offset"]),c,u,{size:a.size||u.size,datum:l})}))},[])},bue=function(e,t,n,r){var i=Math.atan2(r-t,n-e);return eie(Lf(i))},yue=function(e){var t,n,r=e.x,i=e.y,o=e.noteX,a=e.noteY,s=e.noteWidth,l=s===void 0?j4.noteWidth:s,c=e.noteTextOffset,u=c===void 0?j4.noteTextOffset:c;if(Ha(o))t=r+o;else{if(o.abs===void 0)throw new Error("noteX should be either a number or an object containing an 'abs' property");t=o.abs}if(Ha(a))n=i+a;else{if(a.abs===void 0)throw new Error("noteY should be either a number or an object containing an 'abs' property");n=a.abs}var d=r,f=i,h=bue(r,i,t,n);if(Yc(e)){var m=ma(Dr(h),e.size/2);d+=m.x,f+=m.y}if(Kc(e)){var g=Math.round((h+90)/45)%8;g===0&&(f-=e.height/2),g===1&&(d+=e.width/2,f-=e.height/2),g===2&&(d+=e.width/2),g===3&&(d+=e.width/2,f+=e.height/2),g===4&&(f+=e.height/2),g===5&&(d-=e.width/2,f+=e.height/2),g===6&&(d-=e.width/2),g===7&&(d-=e.width/2,f-=e.height/2)}var v=t,b=t;return(h+90)%360>180?(v-=l,b-=l):b+=l,{points:[[d,f],[t,n],[b,n]],text:[v,n-u],angle:h+90}},Cue=function(e){var t=e.data,n=e.annotations,r=e.getPosition,i=e.getDimensions;return S.useMemo(function(){return pue({data:t,annotations:n,getPosition:r,getDimensions:i})},[t,n,r,i])},xue=function(e){return S.useMemo(function(){return yue(e)},[e])},wue=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,o=Wt(),a=Fn(),s=a.animate,l=a.config,c=Xt({x:n,y:r,config:l,immediate:!s});return typeof i=="function"?S.createElement(i,{x:n,y:r,datum:t}):p.jsxs(p.Fragment,{children:[o.annotations.text.outlineWidth>0&&p.jsx(et.text,{x:c.x,y:c.y,style:Io({},o.annotations.text,{strokeLinejoin:"round",strokeWidth:2*o.annotations.text.outlineWidth,stroke:o.annotations.text.outlineColor}),children:i}),p.jsx(et.text,{x:c.x,y:c.y,style:Ya(o.annotations.text,["outlineWidth","outlineColor"]),children:i})]})},rp=function(e){var t=e.points,n=e.isOutline,r=n!==void 0&&n,i=Wt(),o=S.useMemo(function(){var l=t[0];return t.slice(1).reduce(function(c,u){return c+" L"+u[0]+","+u[1]},"M"+l[0]+","+l[1])},[t]),a=kf(o);if(r&&i.annotations.link.outlineWidth<=0)return null;var s=Io({},i.annotations.link);return r&&(s.strokeLinecap="square",s.strokeWidth=i.annotations.link.strokeWidth+2*i.annotations.link.outlineWidth,s.stroke=i.annotations.link.outlineColor,s.opacity=i.annotations.link.outlineOpacity),p.jsx(et.path,{fill:"none",d:a,style:s})},Sue=function(e){var t=e.x,n=e.y,r=e.size,i=Wt(),o=Fn(),a=o.animate,s=o.config,l=Xt({x:t,y:n,radius:r/2,config:s,immediate:!a});return p.jsxs(p.Fragment,{children:[i.annotations.outline.outlineWidth>0&&p.jsx(et.circle,{cx:l.x,cy:l.y,r:l.radius,style:Io({},i.annotations.outline,{fill:"none",strokeWidth:i.annotations.outline.strokeWidth+2*i.annotations.outline.outlineWidth,stroke:i.annotations.outline.outlineColor,opacity:i.annotations.outline.outlineOpacity})}),p.jsx(et.circle,{cx:l.x,cy:l.y,r:l.radius,style:i.annotations.outline})]})},$ue=function(e){var t=e.x,n=e.y,r=e.size,i=r===void 0?j4.dotSize:r,o=Wt(),a=Fn(),s=a.animate,l=a.config,c=Xt({x:t,y:n,radius:i/2,config:l,immediate:!s});return p.jsxs(p.Fragment,{children:[o.annotations.outline.outlineWidth>0&&p.jsx(et.circle,{cx:c.x,cy:c.y,r:c.radius,style:Io({},o.annotations.outline,{fill:"none",strokeWidth:2*o.annotations.outline.outlineWidth,stroke:o.annotations.outline.outlineColor,opacity:o.annotations.outline.outlineOpacity})}),p.jsx(et.circle,{cx:c.x,cy:c.y,r:c.radius,style:o.annotations.symbol})]})},Mue=function(e){var t=e.x,n=e.y,r=e.width,i=e.height,o=e.borderRadius,a=o===void 0?6:o,s=Wt(),l=Fn(),c=l.animate,u=l.config,d=Xt({x:t-r/2,y:n-i/2,width:r,height:i,config:u,immediate:!c});return p.jsxs(p.Fragment,{children:[s.annotations.outline.outlineWidth>0&&p.jsx(et.rect,{x:d.x,y:d.y,rx:a,ry:a,width:d.width,height:d.height,style:Io({},s.annotations.outline,{fill:"none",strokeWidth:s.annotations.outline.strokeWidth+2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),p.jsx(et.rect,{x:d.x,y:d.y,rx:a,ry:a,width:d.width,height:d.height,style:s.annotations.outline})]})},_ue=function(e){var t=e.datum,n=e.x,r=e.y,i=e.note,o=xue(e);if(!vue(i))throw new Error("note should be a valid react element");return p.jsxs(p.Fragment,{children:[p.jsx(rp,{points:o.points,isOutline:!0}),Yc(e)&&p.jsx(Sue,{x:n,y:r,size:e.size}),P4(e)&&p.jsx($ue,{x:n,y:r,size:e.size}),Kc(e)&&p.jsx(Mue,{x:n,y:r,width:e.width,height:e.height,borderRadius:e.borderRadius}),p.jsx(rp,{points:o.points}),p.jsx(wue,{datum:t,x:o.text[0],y:o.text[1],note:i})]})},ip=function(e,t){t.forEach(function(n,r){var i=n[0],o=n[1];r===0?e.moveTo(i,o):e.lineTo(i,o)})},Eue=function(e,t){var n=t.annotations,r=t.theme;n.length!==0&&(e.save(),n.forEach(function(i){if(!mue(i.note))throw new Error("note is invalid for canvas implementation");r.annotations.link.outlineWidth>0&&(e.lineCap="square",e.strokeStyle=r.annotations.link.outlineColor,e.lineWidth=r.annotations.link.strokeWidth+2*r.annotations.link.outlineWidth,e.beginPath(),ip(e,i.computed.points),e.stroke(),e.lineCap="butt"),Yc(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),P4(i)&&r.annotations.symbol.outlineWidth>0&&(e.strokeStyle=r.annotations.symbol.outlineColor,e.lineWidth=2*r.annotations.symbol.outlineWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),Kc(i)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),e.strokeStyle=r.annotations.link.stroke,e.lineWidth=r.annotations.link.strokeWidth,e.beginPath(),ip(e,i.computed.points),e.stroke(),Yc(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.stroke()),P4(i)&&(e.fillStyle=r.annotations.symbol.fill,e.beginPath(),e.arc(i.x,i.y,i.size/2,0,2*Math.PI),e.fill()),Kc(i)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.rect(i.x-i.width/2,i.y-i.height/2,i.width,i.height),e.stroke()),typeof i.note=="function"?i.note(e,{datum:i.datum,x:i.computed.text[0],y:i.computed.text[1],theme:r}):(e.font=r.annotations.text.fontSize+"px "+r.annotations.text.fontFamily,e.textAlign="left",e.textBaseline="alphabetic",e.fillStyle=r.annotations.text.fill,e.strokeStyle=r.annotations.text.outlineColor,e.lineWidth=2*r.annotations.text.outlineWidth,r.annotations.text.outlineWidth>0&&(e.lineJoin="round",e.strokeText(i.note,i.computed.text[0],i.computed.text[1]),e.lineJoin="miter"),e.fillText(i.note,i.computed.text[0],i.computed.text[1]))}),e.restore())};const lo=11102230246251565e-32,nr=134217729,Oue=(3+8*lo)*lo;function M2(e,t,n,r,i){let o,a,s,l,c=t[0],u=r[0],d=0,f=0;u>c==u>-c?(o=c,c=t[++d]):(o=u,u=r[++f]);let h=0;if(d<e&&f<n)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=t[++d]):(a=u+o,s=o-(a-u),u=r[++f]),o=a,s!==0&&(i[h++]=s);d<e&&f<n;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++d]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f]),o=a,s!==0&&(i[h++]=s);for(;d<e;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=t[++d],o=a,s!==0&&(i[h++]=s);for(;f<n;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f],o=a,s!==0&&(i[h++]=s);return(o!==0||h===0)&&(i[h++]=o),h}function Hue(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function E1(e){return new Float64Array(e)}const Vue=(3+16*lo)*lo,Tue=(2+12*lo)*lo,Rue=(9+64*lo)*lo*lo,ds=E1(4),op=E1(8),ap=E1(12),sp=E1(16),dr=E1(4);function kue(e,t,n,r,i,o,a){let s,l,c,u,d,f,h,m,g,v,b,y,x,$,w,M,V,E;const _=e-i,O=n-i,k=t-o,A=r-o;$=_*A,f=nr*_,h=f-(f-_),m=_-h,f=nr*A,g=f-(f-A),v=A-g,w=m*v-($-h*g-m*g-h*v),M=k*O,f=nr*k,h=f-(f-k),m=k-h,f=nr*O,g=f-(f-O),v=O-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,ds[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,ds[1]=x-(b+d)+(d-M),E=y+b,d=E-y,ds[2]=y-(E-d)+(b-d),ds[3]=E;let H=Hue(4,ds),R=Tue*a;if(H>=R||-H>=R||(d=e-_,s=e-(_+d)+(d-i),d=n-O,c=n-(O+d)+(d-i),d=t-k,l=t-(k+d)+(d-o),d=r-A,u=r-(A+d)+(d-o),s===0&&l===0&&c===0&&u===0)||(R=Rue*a+Oue*Math.abs(H),H+=_*u+A*s-(k*c+O*l),H>=R||-H>=R))return H;$=s*A,f=nr*s,h=f-(f-s),m=s-h,f=nr*A,g=f-(f-A),v=A-g,w=m*v-($-h*g-m*g-h*v),M=l*O,f=nr*l,h=f-(f-l),m=l-h,f=nr*O,g=f-(f-O),v=O-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const j=M2(4,ds,4,dr,op);$=_*u,f=nr*_,h=f-(f-_),m=_-h,f=nr*u,g=f-(f-u),v=u-g,w=m*v-($-h*g-m*g-h*v),M=k*c,f=nr*k,h=f-(f-k),m=k-h,f=nr*c,g=f-(f-c),v=c-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const L=M2(j,op,4,dr,ap);$=s*u,f=nr*s,h=f-(f-s),m=s-h,f=nr*u,g=f-(f-u),v=u-g,w=m*v-($-h*g-m*g-h*v),M=l*c,f=nr*l,h=f-(f-l),m=l-h,f=nr*c,g=f-(f-c),v=c-g,V=m*v-(M-h*g-m*g-h*v),b=w-V,d=w-b,dr[0]=w-(b+d)+(d-V),y=$+b,d=y-$,x=$-(y-d)+(b-d),b=x-M,d=x-b,dr[1]=x-(b+d)+(d-M),E=y+b,d=E-y,dr[2]=y-(E-d)+(b-d),dr[3]=E;const T=M2(L,ap,4,dr,sp);return sp[T-1]}function uu(e,t,n,r,i,o){const a=(t-o)*(n-i),s=(e-i)*(r-o),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=Vue*c?l:-kue(e,t,n,r,i,o,c)}const lp=Math.pow(2,-52),du=new Uint32Array(512);class Cd{static from(t,n=Aue,r=Nue){const i=t.length,o=new Float64Array(i*2);for(let a=0;a<i;a++){const s=t[a];o[2*a]=n(s),o[2*a+1]=r(s)}return new Cd(o)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,a=t.length>>1;let s=1/0,l=1/0,c=-1/0,u=-1/0;for(let _=0;_<a;_++){const O=t[2*_],k=t[2*_+1];O<s&&(s=O),k<l&&(l=k),O>c&&(c=O),k>u&&(u=k),this._ids[_]=_}const d=(s+c)/2,f=(l+u)/2;let h,m,g;for(let _=0,O=1/0;_<a;_++){const k=_2(d,f,t[2*_],t[2*_+1]);k<O&&(h=_,O=k)}const v=t[2*h],b=t[2*h+1];for(let _=0,O=1/0;_<a;_++){if(_===h)continue;const k=_2(v,b,t[2*_],t[2*_+1]);k<O&&k>0&&(m=_,O=k)}let y=t[2*m],x=t[2*m+1],$=1/0;for(let _=0;_<a;_++){if(_===h||_===m)continue;const O=Pue(v,b,y,x,t[2*_],t[2*_+1]);O<$&&(g=_,$=O)}let w=t[2*g],M=t[2*g+1];if($===1/0){for(let k=0;k<a;k++)this._dists[k]=t[2*k]-t[0]||t[2*k+1]-t[1];xs(this._ids,this._dists,0,a-1);const _=new Uint32Array(a);let O=0;for(let k=0,A=-1/0;k<a;k++){const H=this._ids[k],R=this._dists[H];R>A&&(_[O++]=H,A=R)}this.hull=_.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(uu(v,b,y,x,w,M)<0){const _=m,O=y,k=x;m=g,y=w,x=M,g=_,w=O,M=k}const V=Iue(v,b,y,x,w,M);this._cx=V.x,this._cy=V.y;for(let _=0;_<a;_++)this._dists[_]=_2(t[2*_],t[2*_+1],V.x,V.y);xs(this._ids,this._dists,0,a-1),this._hullStart=h;let E=3;r[h]=n[g]=m,r[m]=n[h]=g,r[g]=n[m]=h,i[h]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(v,b)]=h,o[this._hashKey(y,x)]=m,o[this._hashKey(w,M)]=g,this.trianglesLen=0,this._addTriangle(h,m,g,-1,-1,-1);for(let _=0,O,k;_<this._ids.length;_++){const A=this._ids[_],H=t[2*A],R=t[2*A+1];if(_>0&&Math.abs(H-O)<=lp&&Math.abs(R-k)<=lp||(O=H,k=R,A===h||A===m||A===g))continue;let j=0;for(let N=0,z=this._hashKey(H,R);N<this._hashSize&&(j=o[(z+N)%this._hashSize],!(j!==-1&&j!==r[j]));N++);j=n[j];let L=j,T;for(;T=r[L],uu(H,R,t[2*L],t[2*L+1],t[2*T],t[2*T+1])>=0;)if(L=T,L===j){L=-1;break}if(L===-1)continue;let I=this._addTriangle(L,A,r[L],-1,-1,i[L]);i[A]=this._legalize(I+2),i[L]=I,E++;let P=r[L];for(;T=r[P],uu(H,R,t[2*P],t[2*P+1],t[2*T],t[2*T+1])<0;)I=this._addTriangle(P,A,T,i[A],-1,i[P]),i[A]=this._legalize(I+2),r[P]=P,E--,P=T;if(L===j)for(;T=n[L],uu(H,R,t[2*T],t[2*T+1],t[2*L],t[2*L+1])<0;)I=this._addTriangle(T,A,L,-1,i[L],i[T]),this._legalize(I+2),i[T]=I,r[L]=L,E--,L=T;this._hullStart=n[A]=L,r[L]=n[P]=A,r[A]=P,o[this._hashKey(H,R)]=A,o[this._hashKey(t[2*L],t[2*L+1])]=L}this.hull=new Uint32Array(E);for(let _=0,O=this._hullStart;_<E;_++)this.hull[_]=O,O=r[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(Lue(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:i}=this;let o=0,a=0;for(;;){const s=r[t],l=t-t%3;if(a=l+(t+2)%3,s===-1){if(o===0)break;t=du[--o];continue}const c=s-s%3,u=l+(t+1)%3,d=c+(s+2)%3,f=n[a],h=n[t],m=n[u],g=n[d];if(jue(i[2*f],i[2*f+1],i[2*h],i[2*h+1],i[2*m],i[2*m+1],i[2*g],i[2*g+1])){n[t]=g,n[s]=f;const b=r[d];if(b===-1){let x=this._hullStart;do{if(this._hullTri[x]===d){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,b),this._link(s,r[a]),this._link(a,d);const y=c+(s+1)%3;o<du.length&&(du[o++]=y)}else{if(o===0)break;t=du[--o]}}return a}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,a){const s=this.trianglesLen;return this._triangles[s]=t,this._triangles[s+1]=n,this._triangles[s+2]=r,this._link(s,i),this._link(s+1,o),this._link(s+2,a),this.trianglesLen+=3,s}}function Lue(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function _2(e,t,n,r){const i=e-n,o=t-r;return i*i+o*o}function jue(e,t,n,r,i,o,a,s){const l=e-a,c=t-s,u=n-a,d=r-s,f=i-a,h=o-s,m=l*l+c*c,g=u*u+d*d,v=f*f+h*h;return l*(d*v-g*h)-c*(u*v-g*f)+m*(u*h-d*f)<0}function Pue(e,t,n,r,i,o){const a=n-e,s=r-t,l=i-e,c=o-t,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l),h=(c*u-s*d)*f,m=(a*d-l*u)*f;return h*h+m*m}function Iue(e,t,n,r,i,o){const a=n-e,s=r-t,l=i-e,c=o-t,u=a*a+s*s,d=l*l+c*c,f=.5/(a*c-s*l),h=e+(c*u-s*d)*f,m=t+(a*d-l*u)*f;return{x:h,y:m}}function xs(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const o=e[i],a=t[o];let s=i-1;for(;s>=n&&t[e[s]]>a;)e[s+1]=e[s--];e[s+1]=o}else{const i=n+r>>1;let o=n+1,a=r;ql(e,i,o),t[e[n]]>t[e[r]]&&ql(e,n,r),t[e[o]]>t[e[r]]&&ql(e,o,r),t[e[n]]>t[e[o]]&&ql(e,n,o);const s=e[o],l=t[s];for(;;){do o++;while(t[e[o]]<l);do a--;while(t[e[a]]>l);if(a<o)break;ql(e,o,a)}e[n+1]=e[a],e[a]=s,r-o+1>=a-n?(xs(e,t,o,r),xs(e,t,n,a-1)):(xs(e,t,n,a-1),xs(e,t,o,r))}}function ql(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Aue(e){return e[0]}function Nue(e){return e[1]}const cp=1e-6;class da{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>cp||Math.abs(this._y1-o)>cp)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class I4{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class Fue{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let o,a;const s=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let g=0,v=0,b=r.length,y,x;g<b;g+=3,v+=2){const $=r[g]*2,w=r[g+1]*2,M=r[g+2]*2,V=t[$],E=t[$+1],_=t[w],O=t[w+1],k=t[M],A=t[M+1],H=_-V,R=O-E,j=k-V,L=A-E,T=(H*L-R*j)*2;if(Math.abs(T)<1e-9){if(o===void 0){o=a=0;for(const P of n)o+=t[P*2],a+=t[P*2+1];o/=n.length,a/=n.length}const I=1e9*Math.sign((o-V)*L-(a-E)*j);y=(V+k)/2-I*L,x=(E+A)/2+I*j}else{const I=1/T,P=H*H+R*R,N=j*j+L*L;y=V+(L*P-R*N)*I,x=E+(H*N-j*P)*I}s[v]=y,s[v+1]=x}let l=n[n.length-1],c,u=l*4,d,f=t[2*l],h,m=t[2*l+1];i.fill(0);for(let g=0;g<n.length;++g)l=n[g],c=u,d=f,h=m,u=l*4,f=t[2*l],m=t[2*l+1],i[c+2]=i[u]=h-m,i[c+3]=i[u+1]=f-d}render(t){const n=t==null?t=new da:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:a,vectors:s}=this;if(o.length<=1)return null;for(let u=0,d=r.length;u<d;++u){const f=r[u];if(f<u)continue;const h=Math.floor(u/3)*2,m=Math.floor(f/3)*2,g=a[h],v=a[h+1],b=a[m],y=a[m+1];this._renderSegment(g,v,b,y,t)}let l,c=o[o.length-1];for(let u=0;u<o.length;++u){l=c,c=o[u];const d=Math.floor(i[c]/3)*2,f=a[d],h=a[d+1],m=l*4,g=this._project(f,h,s[m+2],s[m+3]);g&&this._renderSegment(f,h,g[0],g[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new da:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new da:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let a=2;a<o;a+=2)(i[a]!==i[a-2]||i[a+1]!==i[a-1])&&n.lineTo(i[a],i[a+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new I4;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let a;const s=this._regioncode(t,n),l=this._regioncode(r,i);s===0&&l===0?(o.moveTo(t,n),o.lineTo(r,i)):(a=this._clipSegment(t,n,r,i,s,l))&&(o.moveTo(a[0],a[1]),o.lineTo(a[2],a[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const i=this._clip(r);if(i){e:for(let o=0,a=n.length;o<a;o+=2)for(let s=0,l=i.length;s<l;s+=2)if(n[o]===i[s]&&n[o+1]===i[s+1]&&n[(o+2)%a]===i[(s+l-2)%l]&&n[(o+3)%a]===i[(s+l-1)%l]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,a=r[t];if(a===-1)return null;const s=[];let l=a;do{const c=Math.floor(l/3);if(s.push(n[c*2],n[c*2+1]),l=l%3===2?l-2:l+1,o[l]!==t)break;l=i[l]}while(l!==a&&l!==-1);return s}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let i=null,o,a,s=n[r-2],l=n[r-1],c,u=this._regioncode(s,l),d,f=0;for(let h=0;h<r;h+=2)if(o=s,a=l,s=n[h],l=n[h+1],c=u,u=this._regioncode(s,l),c===0&&u===0)d=f,f=0,i?i.push(s,l):i=[s,l];else{let m,g,v,b,y;if(c===0){if((m=this._clipSegment(o,a,s,l,c,u))===null)continue;[g,v,b,y]=m}else{if((m=this._clipSegment(s,l,o,a,u,c))===null)continue;[b,y,g,v]=m,d=f,f=this._edgecode(g,v),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(g,v):i=[g,v]}d=f,f=this._edgecode(b,y),d&&f&&this._edge(t,d,f,i,i.length),i?i.push(b,y):i=[b,y]}if(i)d=f,f=this._edgecode(i[0],i[1]),d&&f&&this._edge(t,d,f,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,a){const s=o<a;for(s&&([t,n,r,i,o,a]=[r,i,t,n,a,o]);;){if(o===0&&a===0)return s?[r,i,t,n]:[t,n,r,i];if(o&a)return null;let l,c,u=o||a;u&8?(l=t+(r-t)*(this.ymax-n)/(i-n),c=this.ymax):u&4?(l=t+(r-t)*(this.ymin-n)/(i-n),c=this.ymin):u&2?(c=n+(i-n)*(this.xmax-t)/(r-t),l=this.xmax):(c=n+(i-n)*(this.xmin-t)/(r-t),l=this.xmin),o?(t=l,n=c,o=this._regioncode(t,n)):(r=l,i=c,a=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,a){let s=Array.from(n),l;if((l=this._project(s[0],s[1],r,i))&&s.unshift(l[0],l[1]),(l=this._project(s[s.length-2],s[s.length-1],o,a))&&s.push(l[0],l[1]),s=this._clipFinite(t,s))for(let c=0,u=s.length,d,f=this._edgecode(s[u-2],s[u-1]);c<u;c+=2)d=f,f=this._edgecode(s[c],s[c+1]),d&&f&&(c=this._edge(t,d,f,s,c),u=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,n,r,i,o){for(;n!==r;){let a,s;switch(n){case 5:n=4;continue;case 4:n=6,a=this.xmax,s=this.ymin;break;case 6:n=2;continue;case 2:n=10,a=this.xmax,s=this.ymax;break;case 10:n=8;continue;case 8:n=9,a=this.xmin,s=this.ymax;break;case 9:n=1;continue;case 1:n=5,a=this.xmin,s=this.ymin;break}(i[o]!==a||i[o+1]!==s)&&this.contains(t,a,s)&&(i.splice(o,0,a,s),o+=2)}return o}_project(t,n,r,i){let o=1/0,a,s,l;if(i<0){if(n<=this.ymin)return null;(a=(this.ymin-n)/i)<o&&(l=this.ymin,s=t+(o=a)*r)}else if(i>0){if(n>=this.ymax)return null;(a=(this.ymax-n)/i)<o&&(l=this.ymax,s=t+(o=a)*r)}if(r>0){if(t>=this.xmax)return null;(a=(this.xmax-t)/r)<o&&(s=this.xmax,l=n+(o=a)*i)}else if(r<0){if(t<=this.xmin)return null;(a=(this.xmin-t)/r)<o&&(s=this.xmin,l=n+(o=a)*i)}return[s,l]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}}const Due=2*Math.PI,fs=Math.pow;function zue(e){return e[0]}function Bue(e){return e[1]}function Wue(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const i=2*t[r],o=2*t[r+1],a=2*t[r+2];if((n[a]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[a+1]-n[i+1])>1e-10)return!1}return!0}function Zue(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class _h{static from(t,n=zue,r=Bue,i){return new _h("length"in t?Uue(t,n,r,i):Float64Array.from(que(t,n,r,i)))}constructor(t){this._delaunator=new Cd(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&Wue(t)){this.collinear=Int32Array.from({length:n.length/2},(f,h)=>h).sort((f,h)=>n[2*f]-n[2*h]||n[2*f+1]-n[2*h+1]);const l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[n[2*l],n[2*l+1],n[2*c],n[2*c+1]],d=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let f=0,h=n.length/2;f<h;++f){const m=Zue(n[2*f],n[2*f+1],d);n[2*f]=m[0],n[2*f+1]=m[1]}this._delaunator=new Cd(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),s=this._hullIndex.fill(-1);for(let l=0,c=r.length;l<c;++l){const u=o[l%3===2?l-2:l+1];(r[l]===-1||a[u]===-1)&&(a[u]=l)}for(let l=0,c=i.length;l<c;++l)s[i[l]]=l;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],a[i[0]]=1,i.length===2&&(a[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Fue(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:a,collinear:s}=this;if(s){const d=s.indexOf(t);d>0&&(yield s[d-1]),d<s.length-1&&(yield s[d+1]);return}const l=n[t];if(l===-1)return;let c=l,u=-1;do{if(yield u=a[c],c=c%3===2?c-2:c+1,a[c]!==t)return;if(c=o[c],c===-1){const d=r[(i[t]+1)%r.length];d!==u&&(yield d);return}}while(c!==l)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=r;let o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){const{inedges:i,hull:o,_hullIndex:a,halfedges:s,triangles:l,points:c}=this;if(i[t]===-1||!c.length)return(t+1)%(c.length>>1);let u=t,d=fs(n-c[t*2],2)+fs(r-c[t*2+1],2);const f=i[t];let h=f;do{let m=l[h];const g=fs(n-c[m*2],2)+fs(r-c[m*2+1],2);if(g<d&&(d=g,u=m),h=h%3===2?h-2:h+1,l[h]!==t)break;if(h=s[h],h===-1){if(h=o[(a[t]+1)%o.length],h!==m&&fs(n-c[h*2],2)+fs(r-c[h*2+1],2)<d)return h;break}}while(h!==f);return u}render(t){const n=t==null?t=new da:void 0,{points:r,halfedges:i,triangles:o}=this;for(let a=0,s=i.length;a<s;++a){const l=i[a];if(l<a)continue;const c=o[a]*2,u=o[l]*2;t.moveTo(r[c],r[c+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new da:void 0,{points:i}=this;for(let o=0,a=i.length;o<a;o+=2){const s=i[o],l=i[o+1];t.moveTo(s+n,l),t.arc(s,l,n,0,Due)}return r&&r.value()}renderHull(t){const n=t==null?t=new da:void 0,{hull:r,points:i}=this,o=r[0]*2,a=r.length;t.moveTo(i[o],i[o+1]);for(let s=1;s<a;++s){const l=2*r[s];t.lineTo(i[l],i[l+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new I4;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new da:void 0,{points:i,triangles:o}=this,a=o[t*=3]*2,s=o[t+1]*2,l=o[t+2]*2;return n.moveTo(i[a],i[a+1]),n.lineTo(i[s],i[s+1]),n.lineTo(i[l],i[l+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new I4;return this.renderTriangle(t,n),n.value()}}function Uue(e,t,n,r){const i=e.length,o=new Float64Array(i*2);for(let a=0;a<i;++a){const s=e[a];o[a*2]=t.call(r,s,a,e),o[a*2+1]=n.call(r,s,a,e)}return o}function*que(e,t,n,r){let i=0;for(const o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}var Eh=function(e){return[e.x,e.y]},O1=WS,z$="cursor",B$="top",Gue=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?Eh:n,i=e.margin,o=i===void 0?O1:i;return t.map(function(a){var s=r(a),l=s[0],c=s[1];return[l+o.left,c+o.top]})},Yue=function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,o=i===void 0?O1:i,a=e.debug,s=_h.from(t),l=a?s.voronoi([0,0,o.left+n+o.right,o.top+r+o.bottom]):void 0;return{points:t,delaunay:s,voronoi:l}},Oh=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?Eh:n,i=e.width,o=e.height,a=e.margin,s=a===void 0?O1:a,l=e.debug;return S.useMemo(function(){return Yue({points:Gue({points:t,margin:s,getNodePosition:r}),width:i,height:o,margin:s,debug:l})},[t,i,o,s,l])},Kue=function(e){var t=e.elementRef,n=e.nodes,r=e.getNodePosition,i=r===void 0?Eh:r,o=e.delaunay,a=e.setCurrent,s=e.margin,l=s===void 0?O1:s,c=e.detectionRadius,u=c===void 0?1/0:c,d=e.isInteractive,f=d===void 0||d,h=e.onMouseEnter,m=e.onMouseMove,g=e.onMouseLeave,v=e.onClick,b=e.onTouchStart,y=e.onTouchMove,x=e.onTouchEnd,$=e.enableTouchCrosshair,w=$!==void 0&&$,M=e.tooltip,V=e.tooltipPosition,E=V===void 0?z$:V,_=e.tooltipAnchor,O=_===void 0?B$:_,k=S.useState(null),A=k[0],H=k[1],R=S.useRef(null);S.useEffect(function(){R.current=A},[R,A]);var j=S.useCallback(function(J){if(!t.current)return null;var W=xh(t.current,J),Z=W[0],G=W[1],F=o.find(Z,G),re=F!==void 0?n[F]:null;if(re&&u!==1/0){var B=i(re),ie=B[0],oe=B[1];uie(Z,G,ie+l.left,oe+l.top)>u&&(F=null,re=null)}return F===null||re===null?null:[F,re]},[t,o,n,i,l,u]),L=ci(),T=L.showTooltipAt,I=L.showTooltipFromEvent,P=L.hideTooltip,N=S.useMemo(function(){if(M)return E==="cursor"?function(J,W){I(M(J),W,O)}:function(J){var W=i(J),Z=W[0],G=W[1];T(M(J),[Z+l.left,G+l.top],O)}},[T,I,M,E,O,i,l]),z=S.useCallback(function(J){var W=j(J);if(H(W),a==null||a(W?W[1]:null),W){var Z=W[1];N==null||N(Z,J),h==null||h(W[1],J)}},[j,H,a,N,h]),U=S.useCallback(function(J){var W=j(J);if(H(W),W){var Z=W[0],G=W[1];if(a==null||a(G),N==null||N(G,J),R.current){var F=R.current,re=F[0],B=F[1];Z!==re?g==null||g(B,J):m==null||m(G,J)}else h==null||h(G,J)}else a==null||a(null),P==null||P(),R.current&&(g==null||g(R.current[1],J))},[j,H,R,h,m,g,N,P]),q=S.useCallback(function(J){H(null),a==null||a(null),P(),g&&R.current&&g(R.current[1],J)},[H,a,R,P,g]),Y=S.useCallback(function(J){var W=j(J);H(W),W&&(v==null||v(W[1],J))},[j,H,v]),ee=S.useCallback(function(J){var W=j(J);w&&(H(W),a==null||a(W?W[1]:null)),W&&(b==null||b(W[1],J))},[j,H,a,w,b]),Q=S.useCallback(function(J){var W=j(J);w&&(H(W),a==null||a(W?W[1]:null)),W&&(y==null||y(W[1],J))},[j,H,a,w,y]),K=S.useCallback(function(J){w&&(H(null),a==null||a(null)),x&&R.current&&x(R.current[1],J)},[w,H,a,x,R]);return{current:A,handleMouseEnter:f?z:void 0,handleMouseMove:f?U:void 0,handleMouseLeave:f?q:void 0,handleClick:f?Y:void 0,handleTouchStart:f?ee:void 0,handleTouchMove:f?Q:void 0,handleTouchEnd:f?K:void 0}},W$=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.margin,o=i===void 0?O1:i,a=e.getNodePosition,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd,g=e.enableTouchCrosshair,v=g!==void 0&&g,b=e.detectionRadius,y=b===void 0?1/0:b,x=e.tooltip,$=e.tooltipPosition,w=$===void 0?z$:$,M=e.tooltipAnchor,V=M===void 0?B$:M,E=e.debug,_=S.useRef(null),O=Oh({points:t,getNodePosition:a,width:n,height:r,margin:o,debug:E}),k=O.delaunay,A=O.voronoi,H=Kue({elementRef:_,nodes:t,delaunay:k,margin:o,detectionRadius:y,setCurrent:s,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:m,enableTouchCrosshair:v,tooltip:x,tooltipPosition:w,tooltipAnchor:V}),R=H.current,j=H.handleMouseEnter,L=H.handleMouseMove,T=H.handleMouseLeave,I=H.handleClick,P=H.handleTouchStart,N=H.handleTouchMove,z=H.handleTouchEnd,U=S.useMemo(function(){if(E&&A)return A.render()},[E,A]);return p.jsxs("g",{ref:_,transform:"translate("+-o.left+","+-o.top+")",children:[E&&A&&p.jsxs(p.Fragment,{children:[p.jsx("path",{d:U,stroke:"red",strokeWidth:1,opacity:.75}),y<1/0&&p.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:k.renderPoints(void 0,y)}),R&&p.jsx("path",{fill:"pink",opacity:.35,d:A.renderCell(R[0])})]}),p.jsx("rect",{"data-ref":"mesh-interceptor",width:o.left+n+o.right,height:o.top+r+o.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:j,onMouseMove:L,onMouseLeave:T,onTouchStart:P,onTouchMove:N,onTouchEnd:z,onClick:I})]})},Z$=function(e,t){e.save(),e.globalAlpha=.75,e.beginPath(),t.render(e),e.strokeStyle="red",e.lineWidth=1,e.stroke(),e.restore()},U$=function(e,t,n){e.save(),e.globalAlpha=.35,e.beginPath(),t.renderCell(n,e),e.fillStyle="pink",e.fill(),e.restore()};function Hr(){return Hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hr.apply(this,arguments)}function q$(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Xue=function(e){if(typeof e=="function")return e;if(Ha(e))return function(){return e};if(function(n){return Wo(n)}(e)){if(!xf(e.key))throw new Error("symbolSize is invalid, key should be a string pointing to the property to use to determine node size");if(!Array.isArray(e.values)||e.values.length!==2)throw new Error("symbolSize is invalid, values spec should be an array containing two values, min and max");if(!Array.isArray(e.sizes)||e.sizes.length!==2)throw new Error("symbolSize is invalid, sizes spec should be an array containing two values, min and max");var t=Uo().domain([e.values[0],e.values[1]]).range([e.sizes[0],e.sizes[1]]);return function(n){return t(bn(n,e.key))}}throw new Error("nodeSize is invalid, it should be either a function, a number or an object")},G$=function(e){var t,n=e.data,r=e.xScaleSpec,i=e.xFormat,o=e.yScaleSpec,a=e.yFormat,s=e.width,l=e.height,c=e.nodeId,u=e.nodeSize,d=e.colors,f=S.useMemo(function(){return V$(n,r,o,s,l)},[n,r,o,s,l]),h=f.series,m=f.xScale,g=f.yScale,v=jo(i),b=jo(a),y=bi(c),x=S.useMemo(function(){return function(M){var V=M.series,E=M.formatX,_=M.formatY,O=M.getNodeId,k=[];return V.forEach(function(A){A.data.forEach(function(H,R){var j={index:k.length,serieIndex:R,serieId:A.id,x:H.position.x,xValue:H.data.x,formattedX:E(H.data.x),y:H.position.y,yValue:H.data.y,formattedY:_(H.data.y),data:H.data};k.push(Hr({},j,{id:O(j)}))})}),k}({series:h,formatX:v,formatY:b,getNodeId:y})},[h,v,b,y]),$=S.useMemo(function(){return Xue(t)},[t=u]),w=$1(d,"serieId");return{xScale:m,yScale:g,nodes:S.useMemo(function(){return x.map(function(M){return Hr({},M,{size:$(M),color:w({serieId:M.serieId})})})},[x,$,w]),legendData:S.useMemo(function(){return h.map(function(M){return{id:M.id,label:M.id,color:w({serieId:M.id})}})},[h,w])}},Y$=function(e,t){return Cue({data:e,annotations:t,getPosition:function(n){return{x:n.x,y:n.y}},getDimensions:function(n){return{size:n.size,width:n.size,height:n.size}}})},Que=function(e){return e/2},K$={xScale:{type:"linear",min:0,max:"auto"},yScale:{type:"linear",min:0,max:"auto"},enableGridX:!0,enableGridY:!0,axisBottom:{},axisLeft:{},nodeId:function(e){return e.serieId+"."+e.index},nodeSize:9,nodeComponent:function(e){var t=e.node,n=e.style,r=e.blendMode,i=e.isInteractive,o=e.onMouseEnter,a=e.onMouseMove,s=e.onMouseLeave,l=e.onClick,c=S.useCallback(function(h){return o==null?void 0:o(t,h)},[t,o]),u=S.useCallback(function(h){return a==null?void 0:a(t,h)},[t,a]),d=S.useCallback(function(h){return s==null?void 0:s(t,h)},[t,s]),f=S.useCallback(function(h){return l==null?void 0:l(t,h)},[t,l]);return p.jsx(et.circle,{cx:n.x,cy:n.y,r:n.size.to(Que),fill:n.color,style:{mixBlendMode:r},onMouseEnter:i?c:void 0,onMouseMove:i?u:void 0,onMouseLeave:i?d:void 0,onClick:i?f:void 0})},colors:{scheme:"nivo"},isInteractive:!0,debugMesh:!1,tooltip:function(e){var t=e.node;return p.jsx(Is,{id:t.serieId,value:"x: "+t.formattedX+", y: "+t.formattedY,enableChip:!0,color:t.color})},markers:[],legends:[],annotations:[]},vn=Hr({},K$,{blendMode:"normal",layers:["grid","axes","nodes","markers","mesh","legends","annotations"],role:"img",useMesh:!0,animate:!0,motionConfig:"default"}),rr=Hr({},K$,{layers:["grid","axes","nodes","mesh","legends","annotations"],pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,renderNode:function(e,t){e.beginPath(),e.arc(t.x,t.y,t.size/2,0,2*Math.PI),e.fillStyle=t.color,e.fill()}}),Jue=function(e){var t=e.nodes,n=e.annotations,r=Y$(t,n);return p.jsx(p.Fragment,{children:r.map(function(i,o){return p.jsx(_ue,Hr({},i),o)})})},ede=function(e){return e.id},E2=function(e){return{x:e.x,y:e.y,size:e.size,color:e.color}},tde=function(e){return{x:e.x,y:e.y,size:0,color:e.color}},nde=function(e){var t=e.nodes,n=e.nodeComponent,r=e.isInteractive,i=e.onMouseEnter,o=e.onMouseMove,a=e.onMouseLeave,s=e.onClick,l=e.tooltip,c=e.blendMode,u=Fn(),d=u.animate,f=u.config,h=yr(t,{keys:ede,from:E2,enter:E2,update:E2,leave:tde,config:f,immediate:!d}),m=ci(),g=m.showTooltipFromEvent,v=m.hideTooltip,b=S.useCallback(function(w,M){g(S.createElement(l,{node:w}),M),i==null||i(w,M)},[l,g,i]),y=S.useCallback(function(w,M){g(S.createElement(l,{node:w}),M),o==null||o(w,M)},[l,g,o]),x=S.useCallback(function(w,M){v(),a==null||a(w,M)},[v,a]),$=S.useCallback(function(w,M){return s==null?void 0:s(w,M)},[s]);return p.jsx(p.Fragment,{children:h(function(w,M){return S.createElement(n,{node:M,style:w,blendMode:c,isInteractive:r,onMouseEnter:r?b:void 0,onMouseMove:r?y:void 0,onMouseLeave:r?x:void 0,onClick:r?$:void 0})})})},rde=function(e){var t=e.nodes,n=e.width,r=e.height,i=e.onMouseEnter,o=e.onMouseMove,a=e.onMouseLeave,s=e.onClick,l=e.tooltip,c=e.debug,u=ci(),d=u.showTooltipFromEvent,f=u.hideTooltip,h=S.useCallback(function(b,y){d(S.createElement(l,{node:b}),y),i&&i(b,y)},[d,l,i]),m=S.useCallback(function(b,y){d(S.createElement(l,{node:b}),y),o&&o(b,y)},[d,l,o]),g=S.useCallback(function(b,y){f(),a&&a(b,y)},[f,a]),v=S.useCallback(function(b,y){s&&s(b,y)},[s]);return p.jsx(W$,{nodes:t,width:n,height:r,onMouseEnter:h,onMouseMove:m,onMouseLeave:g,onClick:v,debug:c})},ide=["isInteractive","animate","motionConfig","theme","renderWrapper"],ode=function(e){var t=e.data,n=e.xScale,r=n===void 0?vn.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?vn.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.margin,d=e.layers,f=d===void 0?vn.layers:d,h=e.colors,m=h===void 0?vn.colors:h,g=e.blendMode,v=g===void 0?vn.blendMode:g,b=e.nodeId,y=b===void 0?vn.nodeId:b,x=e.nodeSize,$=x===void 0?vn.nodeSize:x,w=e.nodeComponent,M=w===void 0?vn.nodeComponent:w,V=e.enableGridX,E=V===void 0?vn.enableGridX:V,_=e.enableGridY,O=_===void 0?vn.enableGridY:_,k=e.gridXValues,A=e.gridYValues,H=e.axisTop,R=e.axisRight,j=e.axisBottom,L=j===void 0?vn.axisBottom:j,T=e.axisLeft,I=T===void 0?vn.axisLeft:T,P=e.annotations,N=P===void 0?vn.annotations:P,z=e.isInteractive,U=z===void 0?vn.isInteractive:z,q=e.useMesh,Y=q===void 0?vn.useMesh:q,ee=e.debugMesh,Q=ee===void 0?vn.debugMesh:ee,K=e.onMouseEnter,J=e.onMouseMove,W=e.onMouseLeave,Z=e.onClick,G=e.tooltip,F=G===void 0?vn.tooltip:G,re=e.markers,B=re===void 0?vn.markers:re,ie=e.legends,oe=ie===void 0?vn.legends:ie,ve=e.role,Ce=ve===void 0?vn.role:ve,pe=e.ariaLabel,ye=e.ariaLabelledBy,Se=e.ariaDescribedBy,me=Za(l,c,u),ge=me.margin,ce=me.innerWidth,$e=me.innerHeight,he=me.outerWidth,Ae=me.outerHeight,Ie=G$({data:t,xScaleSpec:r,xFormat:i,yScaleSpec:a,yFormat:s,width:ce,height:$e,nodeId:y,nodeSize:$,colors:m}),Te=Ie.xScale,ke=Ie.yScale,Ye=Ie.nodes,Xe=Ie.legendData,Fe=S.useMemo(function(){return{xScale:Te,yScale:ke,nodes:Ye,margin:ge,innerWidth:ce,innerHeight:$e,outerWidth:he,outerHeight:Ae}},[Te,ke,Ye,ge,ce,$e,he,Ae]),Le={grid:null,axes:null,nodes:null,markers:null,mesh:null,annotations:null,legends:null};return f.includes("grid")&&(Le.grid=p.jsx(N$,{width:ce,height:$e,xScale:E?Te:null,yScale:O?ke:null,xValues:k,yValues:A},"grid")),f.includes("axes")&&(Le.axes=p.jsx(A$,{xScale:Te,yScale:ke,width:ce,height:$e,top:H,right:R,bottom:L,left:I},"axes")),f.includes("nodes")&&(Le.nodes=p.jsx(nde,{nodes:Ye,nodeComponent:M,isInteractive:U,tooltip:F,blendMode:v,onMouseEnter:K,onMouseMove:J,onMouseLeave:W,onClick:Z},"nodes")),f.includes("markers")&&(Le.markers=p.jsx(r$,{markers:B,width:ce,height:$e,xScale:Te,yScale:ke},"markers")),f.includes("mesh")&&U&&Y&&(Le.mesh=p.jsx(rde,{nodes:Ye,width:ce,height:$e,onMouseEnter:K,onMouseMove:J,onMouseLeave:W,onClick:Z,tooltip:F,debug:Q},"mesh")),f.includes("annotations")&&(Le.annotations=p.jsx(Jue,{nodes:Ye,annotations:N},"annotations")),f.includes("legends")&&(Le.legends=oe.map(function(Qe,Ze){return p.jsx(jf,Hr({},Qe,{containerWidth:ce,containerHeight:$e,data:Xe}),Ze)})),p.jsx(Sl,{width:he,height:Ae,margin:ge,role:Ce,ariaLabel:pe,ariaLabelledBy:ye,ariaDescribedBy:Se,children:f.map(function(Qe,Ze){if(typeof Qe=="string"&&Le[Qe]!==void 0)return Le[Qe];if(typeof Qe=="function")return p.jsx(S.Fragment,{children:S.createElement(Qe,Fe)},Ze);throw new Error("Unknown layer ("+Qe+")")})})},ade=function(e){var t=e.isInteractive,n=t===void 0?vn.isInteractive:t,r=e.animate,i=r===void 0?vn.animate:r,o=e.motionConfig,a=o===void 0?vn.motionConfig:o,s=e.theme,l=e.renderWrapper,c=q$(e,ide);return p.jsx(Ua,{animate:i,isInteractive:n,motionConfig:a,renderWrapper:l,theme:s,children:p.jsx(ode,Hr({isInteractive:n},c))})},X$=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(ade,Hr({width:n,height:r},e))}})},sde=["isInteractive","renderWrapper","theme"],lde=function(e){var t=e.data,n=e.xScale,r=n===void 0?rr.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?rr.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.margin,d=e.pixelRatio,f=d===void 0?rr.pixelRatio:d,h=e.layers,m=h===void 0?rr.layers:h,g=e.colors,v=g===void 0?rr.colors:g,b=e.nodeId,y=b===void 0?vn.nodeId:b,x=e.nodeSize,$=x===void 0?rr.nodeSize:x,w=e.renderNode,M=w===void 0?rr.renderNode:w,V=e.enableGridX,E=V===void 0?rr.enableGridX:V,_=e.gridXValues,O=e.enableGridY,k=O===void 0?rr.enableGridY:O,A=e.gridYValues,H=e.axisTop,R=e.axisRight,j=e.axisBottom,L=j===void 0?rr.axisBottom:j,T=e.axisLeft,I=T===void 0?rr.axisLeft:T,P=e.annotations,N=P===void 0?rr.annotations:P,z=e.isInteractive,U=z===void 0?rr.isInteractive:z,q=e.debugMesh,Y=q===void 0?rr.debugMesh:q,ee=e.onMouseEnter,Q=e.onMouseMove,K=e.onMouseLeave,J=e.onClick,W=e.tooltip,Z=W===void 0?rr.tooltip:W,G=e.legends,F=G===void 0?rr.legends:G,re=e.canvasRef,B=S.useRef(null),ie=Wt(),oe=S.useState(null),ve=oe[0],Ce=oe[1],pe=Za(l,c,u),ye=pe.margin,Se=pe.innerWidth,me=pe.innerHeight,ge=pe.outerWidth,ce=pe.outerHeight,$e=G$({data:t,xScaleSpec:r,xFormat:i,yScaleSpec:a,yFormat:s,width:Se,height:me,nodeId:y,nodeSize:$,colors:v}),he=$e.xScale,Ae=$e.yScale,Ie=$e.nodes,Te=$e.legendData,ke=Y$(Ie,N),Ye=Oh({points:Ie,width:Se,height:me,debug:Y}),Xe=Ye.delaunay,Fe=Ye.voronoi,Le=S.useMemo(function(){return{xScale:he,yScale:Ae,nodes:Ie,margin:ye,innerWidth:Se,innerHeight:me,outerWidth:ge,outerHeight:ce}},[he,Ae,Ie,ye,Se,me,ge,ce]);S.useEffect(function(){if(B.current){B.current.width=ge*f,B.current.height=ce*f;var Ne=B.current.getContext("2d");Ne.scale(f,f),Ne.fillStyle=ie.background,Ne.fillRect(0,0,ge,ce),Ne.translate(ye.left,ye.top),m.forEach(function(ze){if(ze==="grid")Ne.lineWidth=ie.grid.line.strokeWidth,Ne.strokeStyle=ie.grid.line.stroke,E&&yd(Ne,{width:Se,height:me,scale:he,axis:"x",values:_}),k&&yd(Ne,{width:Se,height:me,scale:Ae,axis:"y",values:A});else if(ze==="annotations")Eue(Ne,{annotations:ke,theme:ie});else if(ze==="axes")F$(Ne,{xScale:he,yScale:Ae,width:Se,height:me,top:H,right:R,bottom:L,left:I,theme:ie});else if(ze==="nodes")Ie.forEach(function(De){M(Ne,De)});else if(ze==="mesh")Y&&(Z$(Ne,Fe),ve&&U$(Ne,Fe,ve.index));else if(ze==="legends")F.forEach(function(De){d$(Ne,Hr({},De,{data:Te,containerWidth:Se,containerHeight:me,theme:ie}))});else{if(typeof ze!="function")throw new Error("Invalid layer: "+ze);ze(Ne,Le)}})}},[B,Se,me,ge,ce,ye.top,ye.left,f,M,m,Le,ie,he,Ae,Ie,E,k,H,R,L,I,F,Te,Y,Fe,ve,ke]);var Qe=ci(),Ze=Qe.showTooltipFromEvent,qe=Qe.hideTooltip,de=S.useCallback(function(Ne){var ze=xh(B.current,Ne),De=ze[0],Je=ze[1];if(!o$(ye.left,ye.top,Se,me,De,Je))return null;var tt=Xe.find(De-ye.left,Je-ye.top);return Ie[tt]},[B,ye,Se,me,Xe]),Ee=S.useCallback(function(Ne){var ze=de(Ne);Ce(ze),ze?(Ze(S.createElement(Z,{node:ze}),Ne),ve&&ve.id!==ze.id&&(K&&K(ve,Ne),ee&&ee(ze,Ne)),ve||ee&&ee(ze,Ne),Q&&Q(ze,Ne)):(qe(),ve&&K&&K(ve,Ne))},[de,ve,Ce,Ze,qe,Z,ee,Q,K]),Ke=S.useCallback(function(Ne){qe(),Ce(null),ve&&K&&K(ve,Ne)},[qe,ve,Ce,K]),nt=S.useCallback(function(Ne){if(J){var ze=de(Ne);ze&&J(ze,Ne)}},[de,J]);return p.jsx("canvas",{ref:function(Ne){B.current=Ne,re&&"current"in re&&(re.current=Ne)},width:ge*f,height:ce*f,style:{width:ge,height:ce,cursor:U?"auto":"normal"},onMouseEnter:U?Ee:void 0,onMouseMove:U?Ee:void 0,onMouseLeave:U?Ke:void 0,onClick:U?nt:void 0})},cde=S.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,i=e.theme,o=q$(e,sde);return p.jsx(Ua,{isInteractive:n,renderWrapper:r,theme:i,animate:!1,children:p.jsx(lde,Hr({},o,{canvasRef:t}))})});S.forwardRef(function(e,t){return p.jsx(qo,{children:function(n){var r=n.width,i=n.height;return p.jsx(cde,Hr({width:r,height:i},e,{ref:t}))}})});const ude=({x1:e,x2:t,y1:n,y2:r})=>p.jsx("g",{children:p.jsx("line",{x1:e,y1:n,x2:t,y2:r,stroke:"red",strokeWidth:"3"})}),dde=({scatterPlotData:e,style:t={},margin:n={},axisBottom:r={},axisLeft:i={},tooltip:o=null})=>{var h,m;const a=e==null?void 0:e.line,s=a==null?void 0:a.x1,l=a==null?void 0:a.y1,c=a==null?void 0:a.x2,u=a==null?void 0:a.y2,d=(m=(h=e==null?void 0:e.points)==null?void 0:h.data)==null?void 0:m.map(g=>g.y);Math.min(l,u,...d);const f=Math.max(l,u,...d);return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{style:{width:"100%",height:600,...t},children:p.jsx(X$,{data:[e==null?void 0:e.points],margin:{top:20,right:120,bottom:100,left:120,...n},xScale:{type:"point"},yScale:{type:"linear",min:0,max:f,reverse:!1},axisBottom:{orient:"bottom",tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:46,truncateTickAt:0,legend:"axisBottom",...r},axisLeft:{orient:"left",tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:-60,truncateTickAt:0,legend:"axisLeft",...i},layers:["grid","markers","axes","nodes","legends",g=>p.jsx(ude,{x1:g.xScale(s),y1:g.yScale(l),x2:g.xScale(c),y2:g.yScale(u)})],tooltip:({node:g})=>p.jsx(er,{body:(o==null?void 0:o({node:g}))||p.jsx("span",{children:"Scatterplot tooltip"})})})})]})};function fde(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}var hde=fde;function gde(e){return function(t){return e==null?void 0:e[t]}}var vde=gde,mde=vde,pde={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},bde=mde(pde),yde=bde,Cde=yde,xde=p1,wde=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Sde="\\u0300-\\u036f",$de="\\ufe20-\\ufe2f",Mde="\\u20d0-\\u20ff",_de=Sde+$de+Mde,Ede="["+_de+"]",Ode=RegExp(Ede,"g");function Hde(e){return e=xde(e),e&&e.replace(wde,Cde).replace(Ode,"")}var Vde=Hde,Tde=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Rde(e){return e.match(Tde)||[]}var kde=Rde,Lde=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function jde(e){return Lde.test(e)}var Pde=jde,Q$="\\ud800-\\udfff",Ide="\\u0300-\\u036f",Ade="\\ufe20-\\ufe2f",Nde="\\u20d0-\\u20ff",Fde=Ide+Ade+Nde,J$="\\u2700-\\u27bf",eM="a-z\\xdf-\\xf6\\xf8-\\xff",Dde="\\xac\\xb1\\xd7\\xf7",zde="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Bde="\\u2000-\\u206f",Wde=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",tM="A-Z\\xc0-\\xd6\\xd8-\\xde",Zde="\\ufe0e\\ufe0f",nM=Dde+zde+Bde+Wde,rM="['’]",up="["+nM+"]",Ude="["+Fde+"]",iM="\\d+",qde="["+J$+"]",oM="["+eM+"]",aM="[^"+Q$+nM+iM+J$+eM+tM+"]",Gde="\\ud83c[\\udffb-\\udfff]",Yde="(?:"+Ude+"|"+Gde+")",Kde="[^"+Q$+"]",sM="(?:\\ud83c[\\udde6-\\uddff]){2}",lM="[\\ud800-\\udbff][\\udc00-\\udfff]",ms="["+tM+"]",Xde="\\u200d",dp="(?:"+oM+"|"+aM+")",Qde="(?:"+ms+"|"+aM+")",fp="(?:"+rM+"(?:d|ll|m|re|s|t|ve))?",hp="(?:"+rM+"(?:D|LL|M|RE|S|T|VE))?",cM=Yde+"?",uM="["+Zde+"]?",Jde="(?:"+Xde+"(?:"+[Kde,sM,lM].join("|")+")"+uM+cM+")*",efe="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tfe="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",nfe=uM+cM+Jde,rfe="(?:"+[qde,sM,lM].join("|")+")"+nfe,ife=RegExp([ms+"?"+oM+"+"+fp+"(?="+[up,ms,"$"].join("|")+")",Qde+"+"+hp+"(?="+[up,ms+dp,"$"].join("|")+")",ms+"?"+dp+"+"+fp,ms+"+"+hp,tfe,efe,iM,rfe].join("|"),"g");function ofe(e){return e.match(ife)||[]}var afe=ofe,sfe=kde,lfe=Pde,cfe=p1,ufe=afe;function dfe(e,t,n){return e=cfe(e),t=n?void 0:t,t===void 0?lfe(e)?ufe(e):sfe(e):e.match(t)||[]}var ffe=dfe,hfe=hde,gfe=Vde,vfe=ffe,mfe="['’]",pfe=RegExp(mfe,"g");function bfe(e){return function(t){return hfe(vfe(gfe(t).replace(pfe,"")),e,"")}}var yfe=bfe,Cfe=D$;function xfe(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:Cfe(e,t,n)}var wfe=xfe,Sfe="\\ud800-\\udfff",$fe="\\u0300-\\u036f",Mfe="\\ufe20-\\ufe2f",_fe="\\u20d0-\\u20ff",Efe=$fe+Mfe+_fe,Ofe="\\ufe0e\\ufe0f",Hfe="\\u200d",Vfe=RegExp("["+Hfe+Sfe+Efe+Ofe+"]");function Tfe(e){return Vfe.test(e)}var dM=Tfe;function Rfe(e){return e.split("")}var kfe=Rfe,fM="\\ud800-\\udfff",Lfe="\\u0300-\\u036f",jfe="\\ufe20-\\ufe2f",Pfe="\\u20d0-\\u20ff",Ife=Lfe+jfe+Pfe,Afe="\\ufe0e\\ufe0f",Nfe="["+fM+"]",A4="["+Ife+"]",N4="\\ud83c[\\udffb-\\udfff]",Ffe="(?:"+A4+"|"+N4+")",hM="[^"+fM+"]",gM="(?:\\ud83c[\\udde6-\\uddff]){2}",vM="[\\ud800-\\udbff][\\udc00-\\udfff]",Dfe="\\u200d",mM=Ffe+"?",pM="["+Afe+"]?",zfe="(?:"+Dfe+"(?:"+[hM,gM,vM].join("|")+")"+pM+mM+")*",Bfe=pM+mM+zfe,Wfe="(?:"+[hM+A4+"?",A4,gM,vM,Nfe].join("|")+")",Zfe=RegExp(N4+"(?="+N4+")|"+Wfe+Bfe,"g");function Ufe(e){return e.match(Zfe)||[]}var qfe=Ufe,Gfe=kfe,Yfe=dM,Kfe=qfe;function Xfe(e){return Yfe(e)?Kfe(e):Gfe(e)}var Qfe=Xfe,Jfe=wfe,e0e=dM,t0e=Qfe,n0e=p1;function r0e(e){return function(t){t=n0e(t);var n=e0e(t)?t0e(t):void 0,r=n?n[0]:t.charAt(0),i=n?Jfe(n,1).join(""):t.slice(1);return r[e]()+i}}var i0e=r0e,o0e=i0e,a0e=o0e("toUpperCase"),s0e=a0e,l0e=yfe,c0e=s0e,u0e=l0e(function(e,t,n){return e+(n?" ":"")+c0e(t)}),d0e=u0e;const f0e=xn(d0e);function h0e(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function g0e(){return this.eachAfter(h0e)}function v0e(e){var t=this,n,r=[t],i,o,a;do for(n=r.reverse(),r=[];t=n.pop();)if(e(t),i=t.children,i)for(o=0,a=i.length;o<a;++o)r.push(i[o]);while(r.length);return this}function m0e(e){for(var t=this,n=[t],r,i;t=n.pop();)if(e(t),r=t.children,r)for(i=r.length-1;i>=0;--i)n.push(r[i]);return this}function p0e(e){for(var t=this,n=[t],r=[],i,o,a;t=n.pop();)if(r.push(t),i=t.children,i)for(o=0,a=i.length;o<a;++o)n.push(i[o]);for(;t=r.pop();)e(t);return this}function b0e(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function y0e(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function C0e(e){for(var t=this,n=x0e(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function x0e(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function w0e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function S0e(){var e=[];return this.each(function(t){e.push(t)}),e}function $0e(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function M0e(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function Hh(e,t){var n=new xd(e),r=+e.value&&(n.value=e.value),i,o=[n],a,s,l,c;for(t==null&&(t=E0e);i=o.pop();)if(r&&(i.value=+i.data.value),(s=t(i.data))&&(c=s.length))for(i.children=new Array(c),l=c-1;l>=0;--l)o.push(a=i.children[l]=new xd(s[l])),a.parent=i,a.depth=i.depth+1;return n.eachBefore(H0e)}function _0e(){return Hh(this).eachBefore(O0e)}function E0e(e){return e.children}function O0e(e){e.data=e.data.data}function H0e(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function xd(e){this.data=e,this.depth=this.height=0,this.parent=null}xd.prototype=Hh.prototype={constructor:xd,count:g0e,each:v0e,eachAfter:p0e,eachBefore:m0e,sum:b0e,sort:y0e,path:C0e,ancestors:w0e,descendants:S0e,leaves:$0e,links:M0e,copy:_0e};function V0e(e){if(typeof e!="function")throw new Error;return e}function Gl(){return 0}function Yl(e){return function(){return e}}function T0e(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Vh(e,t,n,r,i){for(var o=e.children,a,s=-1,l=o.length,c=e.value&&(r-t)/e.value;++s<l;)a=o[s],a.y0=n,a.y1=i,a.x0=t,a.x1=t+=a.value*c}function Th(e,t,n,r,i){for(var o=e.children,a,s=-1,l=o.length,c=e.value&&(i-n)/e.value;++s<l;)a=o[s],a.x0=t,a.x1=r,a.y0=n,a.y1=n+=a.value*c}var R0e=(1+Math.sqrt(5))/2;function k0e(e,t,n,r,i,o){for(var a=[],s=t.children,l,c,u=0,d=0,f=s.length,h,m,g=t.value,v,b,y,x,$,w,M;u<f;){h=i-n,m=o-r;do v=s[d++].value;while(!v&&d<f);for(b=y=v,w=Math.max(m/h,h/m)/(g*e),M=v*v*w,$=Math.max(y/M,M/b);d<f;++d){if(v+=c=s[d].value,c<b&&(b=c),c>y&&(y=c),M=v*v*w,x=Math.max(y/M,M/b),x>$){v-=c;break}$=x}a.push(l={value:v,dice:h<m,children:s.slice(u,d)}),l.dice?Vh(l,n,r,i,g?r+=m*v/g:o):Th(l,n,r,g?n+=h*v/g:i,o),g-=v,u=d}return a}const bM=function e(t){function n(r,i,o,a,s){k0e(t,r,i,o,a,s)}return n.ratio=function(r){return e((r=+r)>1?r:1)},n}(R0e);function L0e(){var e=bM,t=!1,n=1,r=1,i=[0],o=Gl,a=Gl,s=Gl,l=Gl,c=Gl;function u(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(d),i=[0],t&&f.eachBefore(T0e),f}function d(f){var h=i[f.depth],m=f.x0+h,g=f.y0+h,v=f.x1-h,b=f.y1-h;v<m&&(m=v=(m+v)/2),b<g&&(g=b=(g+b)/2),f.x0=m,f.y0=g,f.x1=v,f.y1=b,f.children&&(h=i[f.depth+1]=o(f)/2,m+=c(f)-h,g+=a(f)-h,v-=s(f)-h,b-=l(f)-h,v<m&&(m=v=(m+v)/2),b<g&&(g=b=(g+b)/2),e(f,m,g,v,b))}return u.round=function(f){return arguments.length?(t=!!f,u):t},u.size=function(f){return arguments.length?(n=+f[0],r=+f[1],u):[n,r]},u.tile=function(f){return arguments.length?(e=V0e(f),u):e},u.padding=function(f){return arguments.length?u.paddingInner(f).paddingOuter(f):u.paddingInner()},u.paddingInner=function(f){return arguments.length?(o=typeof f=="function"?f:Yl(+f),u):o},u.paddingOuter=function(f){return arguments.length?u.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):u.paddingTop()},u.paddingTop=function(f){return arguments.length?(a=typeof f=="function"?f:Yl(+f),u):a},u.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:Yl(+f),u):s},u.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:Yl(+f),u):l},u.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:Yl(+f),u):c},u}function j0e(e,t,n,r,i){var o=e.children,a,s=o.length,l,c=new Array(s+1);for(c[0]=l=a=0;a<s;++a)c[a+1]=l+=o[a].value;u(0,s,e.value,t,n,r,i);function u(d,f,h,m,g,v,b){if(d>=f-1){var y=o[d];y.x0=m,y.y0=g,y.x1=v,y.y1=b;return}for(var x=c[d],$=h/2+x,w=d+1,M=f-1;w<M;){var V=w+M>>>1;c[V]<$?w=V+1:M=V}$-c[w-1]<c[w]-$&&d+1<w&&--w;var E=c[w]-x,_=h-E;if(v-m>b-g){var O=(m*_+v*E)/h;u(d,w,E,m,g,O,b),u(w,f,_,O,g,v,b)}else{var k=(g*_+b*E)/h;u(d,w,E,m,g,v,k),u(w,f,_,m,k,v,b)}}}function P0e(e,t,n,r,i){(e.depth&1?Th:Vh)(e,t,n,r,i)}function Vr(){return Vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vr.apply(this,arguments)}function I0e(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var A0e=function(e,t){return Vn([e,t],function(n,r){return"translate("+n+","+r+")"})},N0e=function(e,t){return Vn([e,t],function(n,r){return"translate("+n+"px, "+r+"px)"})},gp=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+r+","+i+") rotate("+o+")"})},F0e=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+r+"px,"+i+"px) rotate("+o+"deg)"})},D0e=function(e,t,n){return Vn([e,t,n],function(r,i,o){return"translate("+(r-(o===0?0:5))+"px,"+(i-(o===0?5:0))+"px) rotate("+o+"deg)"})},z0e=S.memo(function(e){var t=e.node,n=e.animatedProps,r=e.borderWidth,i=e.enableLabel,o=e.enableParentLabel,a=e.labelSkipSize,s=Wt(),l=i&&t.isLeaf&&(a===0||Math.min(t.width,t.height)>a),c=o&&t.isParent;return p.jsxs(et.g,{transform:A0e(n.x,n.y),children:[p.jsx(et.rect,{"data-testid":"node."+t.id,width:Vn(n.width,function(u){return Math.max(u,0)}),height:Vn(n.height,function(u){return Math.max(u,0)}),fill:t.fill?t.fill:n.color,strokeWidth:r,stroke:t.borderColor,fillOpacity:t.opacity,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseLeave:t.onMouseLeave,onClick:t.onClick}),l&&p.jsx(et.text,{"data-testid":"label."+t.id,textAnchor:"middle",dominantBaseline:"central",style:Vr({},s.labels.text,{fill:t.labelTextColor,pointerEvents:"none"}),fillOpacity:n.labelOpacity,transform:gp(n.labelX,n.labelY,n.labelRotation),children:t.label}),c&&p.jsx(et.text,{"data-testid":"parentLabel."+t.id,dominantBaseline:"central",style:Vr({},s.labels.text,{fill:t.parentLabelTextColor,pointerEvents:"none"}),fillOpacity:n.parentLabelOpacity,transform:gp(n.parentLabelX,n.parentLabelY,n.parentLabelRotation),children:t.parentLabel})]})}),B0e=S.memo(function(e){var t=e.node;return p.jsx(Is,{id:t.id,value:t.formattedValue,enableChip:!0,color:t.color})}),W0e=S.memo(function(e){var t=e.node,n=e.animatedProps,r=e.borderWidth,i=e.enableLabel,o=e.enableParentLabel,a=e.labelSkipSize,s=Wt(),l=i&&t.isLeaf&&(a===0||Math.min(t.width,t.height)>a),c=o&&t.isParent;return p.jsxs(et.div,{"data-testid":"node."+t.id,id:t.path.replace(/[^\w]/gi,"-"),style:{boxSizing:"border-box",position:"absolute",top:0,left:0,transform:N0e(n.x,n.y),width:n.width,height:n.height,borderWidth:r,borderStyle:"solid",borderColor:t.borderColor,overflow:"hidden"},children:[p.jsx(et.div,{style:{boxSizing:"border-box",position:"absolute",top:0,left:0,opacity:t.opacity,width:n.width,height:n.height,background:n.color},onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseLeave:t.onMouseLeave,onClick:t.onClick}),l&&p.jsx(et.span,{"data-testid":"label."+t.id,style:Vr({},s.labels.text,{position:"absolute",display:"flex",top:-5,left:-5,width:10,height:10,justifyContent:"center",alignItems:"center",whiteSpace:"nowrap",color:t.labelTextColor,transformOrigin:"center center",transform:F0e(n.labelX,n.labelY,n.labelRotation),opacity:n.labelOpacity,pointerEvents:"none"}),children:t.label}),c&&p.jsx(et.span,{"data-testid":"parentLabel."+t.id,style:Vr({},s.labels.text,{position:"absolute",display:"flex",justifyContent:"flex-start",alignItems:"center",whiteSpace:"nowrap",width:10,height:10,color:t.parentLabelTextColor,transformOrigin:"top left",transform:D0e(n.parentLabelX,n.parentLabelY,n.parentLabelRotation),opacity:n.parentLabelOpacity,pointerEvents:"none"}),children:t.parentLabel})]})}),$n={layers:["nodes"],identity:"id",value:"value",tile:"squarify",leavesOnly:!1,innerPadding:0,outerPadding:0,colors:{scheme:"nivo"},colorBy:"pathComponents.1",nodeOpacity:.33,enableLabel:!0,label:"formattedValue",labelSkipSize:0,labelTextColor:{from:"color",modifiers:[["darker",1]]},orientLabel:!0,enableParentLabel:!0,parentLabel:"id",parentLabelSize:20,parentLabelPosition:"top",parentLabelPadding:6,parentLabelTextColor:{from:"color",modifiers:[["darker",1]]},borderWidth:1,borderColor:{from:"color",modifiers:[["darker",1]]},isInteractive:!0,tooltip:B0e,role:"img",animate:!0,motionConfig:"gentle"},Zt=Vr({},$n,{nodeComponent:z0e,defs:[],fill:[]});Vr({},$n,{nodeComponent:W0e});Vr({},$n,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var Z0e={binary:j0e,dice:Vh,slice:Th,sliceDice:P0e,squarify:bM},U0e=function(e){var t=e.root,n=e.getValue;return S.useMemo(function(){return Hh(t).sum(n)},[t,n])},q0e=function(e){var t=e.data,n=e.width,r=e.height,i=e.identity,o=i===void 0?$n.identity:i,a=e.value,s=a===void 0?$n.value:a,l=e.valueFormat,c=e.leavesOnly,u=c===void 0?$n.leavesOnly:c,d=e.tile,f=d===void 0?$n.tile:d,h=e.innerPadding,m=h===void 0?$n.innerPadding:h,g=e.outerPadding,v=g===void 0?$n.outerPadding:g,b=e.label,y=b===void 0?$n.label:b,x=e.orientLabel,$=x===void 0?$n.orientLabel:x,w=e.enableParentLabel,M=w===void 0?$n.enableParentLabel:w,V=e.parentLabel,E=V===void 0?$n.parentLabel:V,_=e.parentLabelSize,O=_===void 0?$n.parentLabelSize:_,k=e.parentLabelPosition,A=k===void 0?$n.parentLabelPosition:k,H=e.parentLabelPadding,R=H===void 0?$n.parentLabelPadding:H,j=e.colors,L=j===void 0?$n.colors:j,T=e.colorBy,I=T===void 0?$n.colorBy:T,P=e.nodeOpacity,N=P===void 0?$n.nodeOpacity:P,z=e.borderColor,U=z===void 0?$n.borderColor:z,q=e.labelTextColor,Y=q===void 0?$n.labelTextColor:q,ee=e.parentLabelTextColor,Q=ee===void 0?$n.parentLabelTextColor:ee,K=bi(o),J=bi(s),W=jo(l),Z=bi(y),G=bi(E),F=function(me){var ge=me.width,ce=me.height,$e=me.tile,he=me.innerPadding,Ae=me.outerPadding,Ie=me.enableParentLabel,Te=me.parentLabelSize,ke=me.parentLabelPosition,Ye=me.leavesOnly;return S.useMemo(function(){var Xe=L0e().size([ge,ce]).tile(Z0e[$e]).round(!0).paddingInner(he).paddingOuter(Ae);if(Ie&&!Ye){var Fe=Te+2*Ae;Xe["padding"+f0e(ke)](Fe)}return Xe},[ge,ce,$e,he,Ae,Ie,Te,ke,Ye])}({width:n,height:r,tile:f,innerPadding:m,outerPadding:v,enableParentLabel:M,parentLabelSize:O,parentLabelPosition:A,leavesOnly:u}),re=U0e({root:t,getValue:J}),B=S.useMemo(function(){var me=y$(re);return F(me),u?me.leaves():me.descendants()},[re,F,u]),ie=S.useMemo(function(){return B.map(function(me){var ge=function(Ae,Ie){var Te=Ae.ancestors().map(function(ke){return Ie(ke.data)}).reverse();return{path:Te.join("."),pathComponents:Te}}(me,K),ce=ge.path,$e=ge.pathComponents,he={id:K(me.data),path:ce,pathComponents:$e,data:Ya(me.data,"children"),x:me.x0,y:me.y0,width:me.x1-me.x0,height:me.y1-me.y0,value:me.value,formattedValue:W(me.value),treeDepth:me.depth,treeHeight:me.height,isParent:me.height>0,isLeaf:me.height===0,parentLabelX:0,parentLabelY:0,parentLabelRotation:0};return he.labelRotation=$&&he.height>he.width?-90:0,A==="top"&&(he.parentLabelX=v+R,he.parentLabelY=v+O/2),A==="right"&&(he.parentLabelX=he.width-v-O/2,he.parentLabelY=he.height-v-R,he.parentLabelRotation=-90),A==="bottom"&&(he.parentLabelX=v+R,he.parentLabelY=he.height-v-O/2),A==="left"&&(he.parentLabelX=v+O/2,he.parentLabelY=he.height-v-R,he.parentLabelRotation=-90),he.label=Z(he),he.parentLabel=G(he),he})},[B,K,W,Z,$,G,O,A,R,v]),oe=Wt(),ve=$1(L,I),Ce=Er(U,oe),pe=Er(Y,oe),ye=Er(Q,oe),Se=S.useMemo(function(){return ie.map(function(me){var ge=Vr({},me,{color:ve(me),opacity:N});return ge.borderColor=Ce(ge),ge.labelTextColor=pe(ge),ge.parentLabelTextColor=ye(ge),ge})},[ie,ve,N,Ce,pe,ye]);return{hierarchy:re,nodes:Se,layout:F}},G0e=function(e){var t=e.nodes;return S.useMemo(function(){return{nodes:t}},[t])},O2=function(e){return{x:e.x,y:e.y,width:e.width,height:e.height,color:e.color,labelX:e.width/2,labelY:e.height/2,labelRotation:e.labelRotation,labelOpacity:1,parentLabelX:e.parentLabelX,parentLabelY:e.parentLabelY,parentLabelRotation:e.parentLabelRotation,parentLabelOpacity:1}},vp=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2,width:0,height:0,color:e.color,labelX:0,labelY:0,labelRotation:e.labelRotation,labelOpacity:0,parentLabelX:0,parentLabelY:0,parentLabelRotation:e.parentLabelRotation,parentLabelOpacity:0}},Y0e=S.memo(function(e){var t=e.nodes,n=e.nodeComponent,r=e.borderWidth,i=e.enableLabel,o=e.labelSkipSize,a=e.enableParentLabel,s=function(f,h){var m=h.isInteractive,g=h.onMouseEnter,v=h.onMouseMove,b=h.onMouseLeave,y=h.onClick,x=h.tooltip,$=ci(),w=$.showTooltipFromEvent,M=$.hideTooltip,V=S.useCallback(function(A,H){w(S.createElement(x,{node:A}),H,"left")},[w,x]),E=S.useCallback(function(A,H){V(A,H),g==null||g(A,H)},[g,V]),_=S.useCallback(function(A,H){V(A,H),v==null||v(A,H)},[v,V]),O=S.useCallback(function(A,H){M(),b==null||b(A,H)},[b,M]),k=S.useCallback(function(A,H){y==null||y(A,H)},[y]);return S.useMemo(function(){return f.map(function(A){return m?Vr({},A,{onMouseEnter:function(H){return E(A,H)},onMouseMove:function(H){return _(A,H)},onMouseLeave:function(H){return O(A,H)},onClick:function(H){return k(A,H)}}):A})},[m,f,E,_,O,k])}(t,{isInteractive:e.isInteractive,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseLeave:e.onMouseLeave,onClick:e.onClick,tooltip:e.tooltip}),l=Fn(),c=l.animate,u=l.config,d=yr(s,{keys:function(f){return f.path},initial:O2,from:vp,enter:O2,update:O2,leave:vp,config:u,immediate:!c});return p.jsx(p.Fragment,{children:d(function(f,h){return S.createElement(n,{key:h.path,node:h,animatedProps:f,borderWidth:r,enableLabel:i,labelSkipSize:o,enableParentLabel:a})})})}),K0e=["isInteractive","animate","motionConfig","theme","renderWrapper"],X0e=function(e){var t=e.data,n=e.identity,r=n===void 0?Zt.identity:n,i=e.value,o=i===void 0?Zt.value:i,a=e.valueFormat,s=e.tile,l=s===void 0?Zt.tile:s,c=e.nodeComponent,u=c===void 0?Zt.nodeComponent:c,d=e.innerPadding,f=d===void 0?Zt.innerPadding:d,h=e.outerPadding,m=h===void 0?Zt.outerPadding:h,g=e.leavesOnly,v=g===void 0?Zt.leavesOnly:g,b=e.width,y=e.height,x=e.margin,$=e.layers,w=$===void 0?Zt.layers:$,M=e.colors,V=M===void 0?Zt.colors:M,E=e.colorBy,_=E===void 0?Zt.colorBy:E,O=e.nodeOpacity,k=O===void 0?Zt.nodeOpacity:O,A=e.borderWidth,H=A===void 0?Zt.borderWidth:A,R=e.borderColor,j=R===void 0?Zt.borderColor:R,L=e.defs,T=L===void 0?Zt.defs:L,I=e.fill,P=I===void 0?Zt.fill:I,N=e.enableLabel,z=N===void 0?Zt.enableLabel:N,U=e.label,q=U===void 0?Zt.label:U,Y=e.labelTextColor,ee=Y===void 0?Zt.labelTextColor:Y,Q=e.orientLabel,K=Q===void 0?Zt.orientLabel:Q,J=e.labelSkipSize,W=J===void 0?Zt.labelSkipSize:J,Z=e.enableParentLabel,G=Z===void 0?Zt.enableParentLabel:Z,F=e.parentLabel,re=F===void 0?Zt.parentLabel:F,B=e.parentLabelSize,ie=B===void 0?Zt.parentLabelSize:B,oe=e.parentLabelPosition,ve=oe===void 0?Zt.parentLabelPosition:oe,Ce=e.parentLabelPadding,pe=Ce===void 0?Zt.parentLabelPadding:Ce,ye=e.parentLabelTextColor,Se=ye===void 0?Zt.parentLabelTextColor:ye,me=e.isInteractive,ge=me===void 0?Zt.isInteractive:me,ce=e.onMouseEnter,$e=e.onMouseMove,he=e.onMouseLeave,Ae=e.onClick,Ie=e.tooltip,Te=Ie===void 0?Zt.tooltip:Ie,ke=e.role,Ye=e.ariaLabel,Xe=e.ariaLabelledBy,Fe=e.ariaDescribedBy,Le=Za(b,y,x),Qe=Le.margin,Ze=Le.innerWidth,qe=Le.innerHeight,de=Le.outerWidth,Ee=Le.outerHeight,Ke=q0e({data:t,identity:r,value:o,valueFormat:a,leavesOnly:v,width:Ze,height:qe,tile:l,innerPadding:f,outerPadding:m,colors:V,colorBy:_,nodeOpacity:k,borderColor:j,label:q,labelTextColor:ee,orientLabel:K,enableParentLabel:G,parentLabel:re,parentLabelSize:ie,parentLabelPosition:ve,parentLabelPadding:pe,parentLabelTextColor:Se}).nodes,nt={nodes:null};w.includes("nodes")&&(nt.nodes=p.jsx(Y0e,{nodes:Ke,nodeComponent:u,borderWidth:H,enableLabel:z,labelSkipSize:W,enableParentLabel:G,isInteractive:ge,onMouseEnter:ce,onMouseMove:$e,onMouseLeave:he,onClick:Ae,tooltip:Te},"nodes"));var Ne=G0e({nodes:Ke}),ze=wh(T,Ke,P);return p.jsx(Sl,{width:de,height:Ee,margin:Qe,defs:ze,role:ke,ariaLabel:Ye,ariaLabelledBy:Xe,ariaDescribedBy:Fe,children:w.map(function(De,Je){var tt;return typeof De=="function"?p.jsx(S.Fragment,{children:S.createElement(De,Ne)},Je):(tt=nt==null?void 0:nt[De])!=null?tt:null})})},Q0e=function(e){var t=e.isInteractive,n=t===void 0?Zt.isInteractive:t,r=e.animate,i=r===void 0?Zt.animate:r,o=e.motionConfig,a=o===void 0?Zt.motionConfig:o,s=e.theme,l=e.renderWrapper,c=I0e(e,K0e);return p.jsx(Ua,{animate:i,isInteractive:n,motionConfig:a,renderWrapper:l,theme:s,children:p.jsx(X0e,Vr({isInteractive:n},c))})},J0e=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(Q0e,Vr({width:n,height:r},e))}})};function e2e(e,t){if(e.startsWith("rgba"))return e.replace(/rgba?\((\d+), (\d+), (\d+),? ([\d.]+)?\)/,(n,r,i,o,a)=>`rgba(${r}, ${i}, ${o}, ${t})`);if(e.startsWith("rgb"))return e.replace(/rgb\((\d+), (\d+), (\d+)\)/,(n,r,i,o)=>`rgba(${r}, ${i}, ${o}, ${t})`);if(e.startsWith("hsl"))return e.replace(/hsl\((\d+), (\d+)%?, (\d+)%?\)/,(n,r,i,o)=>`hsla(${r}, ${i}%, ${o}%, ${t})`);if(e.startsWith("hsla"))return e.replace(/hsla?\((\d+), (\d+)%?, (\d+)%?,? ([\d.]+)?\)/,(n,r,i,o,a)=>`hsla(${r}, ${i}%, ${o}%, ${t})`);if(e.startsWith("#")){const n=t2e(e);return`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`}throw new Error("Unsupported color format")}function t2e(e){const t=e.startsWith("#")?e.slice(1):e,n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);return{r:n,g:r,b:i}}const n2e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},r2e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;n2e(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},i2e=({treeMapData:e,style:t={},colors:n={scheme:"nivo"},identity:r="name",value:i="loc",margin:o={},nodeOpacity:a=.67,labelTextColor:s="black",borderColor:l="white",labelTitle:c="name",labelTitleSize:u=16,labelText:d="name",labelTextSize:f=12,labelPadding:h=10,labelGap:m=10,labelLineHeight:g=14,tooltip:v=null})=>{const b=S.useRef(null),[y,x]=S.useState({width:0,height:0});S.useEffect(()=>{if(!(b!=null&&b.current))return;const M=()=>{const E=b.current.getBoundingClientRect();x({width:E.width,height:E.height})},V=new ResizeObserver(M);return V.observe(b==null?void 0:b.current),M(),()=>{V.disconnect()}},[]);const $=({node:M})=>{var L,T;const V=S.useRef(null),E=S.useRef(null),[_,O]=S.useState(!1),[k,A]=S.useState(!1),H=()=>{if(!(V!=null&&V.current)||!(E!=null&&E.current))return;const I=V.current.getBoundingClientRect(),P=E.current.getBoundingClientRect(),N=Math.max([P,I]);O(I.height>M.height-h*2||I.width>M.width-h*2),A(P.height+I.height+g>M.height-h*2||N>M.width-h*2)};S.useEffect(()=>{H()},[]);const R=((L=M==null?void 0:M.data)==null?void 0:L[d])||"Text",j=r2e(R,M.width-h*2,f);return M.isParent?p.jsx(p.Fragment,{}):p.jsxs("g",{transform:`translate(${M.x}, ${M.y})`,children:[p.jsx("rect",{width:M.width,height:M.height,style:{fill:e2e(M.color,a),stroke:l,strokeWidth:1}}),!_&&p.jsx("text",{ref:V,dominantBaseline:"hanging",x:h,y:h,style:{fill:s,font:"var(--gf-label-lg-default)",fontWeight:"bold",fontSize:u},children:((T=M==null?void 0:M.data)==null?void 0:T[c])||"Title"}),!_&&!k&&p.jsx("text",{ref:E,dominantBaseline:"hanging",children:j.map((I,P)=>p.jsx("tspan",{x:h,y:h+u+m+g*P,style:{fill:s,font:"var(--gf-label-lg-default)",fontSize:f},children:I},P))})]})},w=({nodes:M})=>M.map(V=>p.jsx($,{node:V},V.id));return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{ref:b,style:{width:"100%",height:600,...t},children:p.jsx(J0e,{data:e,colors:n,identity:r,value:i,margin:{top:10,right:10,bottom:10,left:10,...o},enableParentLabel:!1,enableLabel:!1,nodeOpacity:0,borderWidth:0,tooltip:({node:M})=>p.jsx(er,{body:(v==null?void 0:v({node:M}))||p.jsx("span",{children:"Treemap tooltip"})}),layers:[w,"nodes"]})})]})};var o2e=p1,a2e=0;function s2e(e){var t=++a2e;return o2e(e)+t}var l2e=s2e;const c2e=xn(l2e);function hr(){return hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hr.apply(this,arguments)}var Rh=S.memo(function(e){var t=e.point;return p.jsx(Is,{id:p.jsxs("span",{children:["x: ",p.jsx("strong",{children:t.data.xFormatted}),", y:"," ",p.jsx("strong",{children:t.data.yFormatted})]}),enableChip:!0,color:t.serieColor})}),yM=S.memo(function(e){var t=e.slice,n=e.axis,r=Wt(),i=n==="x"?"y":"x";return p.jsx(aw,{rows:t.points.map(function(o){return[p.jsx(Xu,{color:o.serieColor,style:r.tooltip.chip},"chip"),o.serieId,p.jsx("span",{style:r.tooltip.tableCellValue,children:o.data[i+"Formatted"]},"value")]})})}),CM={curve:"linear",xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],axisBottom:{},axisLeft:{},enableGridX:!0,enableGridY:!0,enablePoints:!0,pointSize:6,pointColor:{from:"color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enablePointLabel:!1,pointLabel:"yFormatted",colors:{scheme:"nivo"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,areaBlendMode:"normal",lineWidth:2,legends:[],isInteractive:!0,tooltip:Rh,enableSlices:!1,debugSlices:!1,sliceTooltip:yM,debugMesh:!1,enableCrosshair:!0,crosshairType:"bottom-left"},So=hr({},CM,{enablePointLabel:!1,useMesh:!1,enableTouchCrosshair:!1,animate:!0,motionConfig:"gentle",defs:[],fill:[],role:"img"});hr({},CM,{pixelRatio:typeof window<"u"&&window.devicePixelRatio||1});var u2e=function(e){var t=e.curve;return S.useMemo(function(){return Gc().defined(function(n){return n.x!==null&&n.y!==null}).x(function(n){return n.x}).y(function(n){return n.y}).curve(BS(t))},[t])},d2e=function(e){var t=e.curve,n=e.yScale,r=e.areaBaselineValue;return S.useMemo(function(){return lS().defined(function(i){return i.x!==null&&i.y!==null}).x(function(i){return i.x}).y1(function(i){return i.y}).curve(BS(t)).y0(n(r))},[t,n,r])},f2e=function(e){var t=e.componentId,n=e.enableSlices,r=e.points,i=e.width,o=e.height;return S.useMemo(function(){if(n===!1)return[];if(n==="x"){var a=new Map;return r.forEach(function(l){l.data.x!==null&&l.data.y!==null&&(a.has(l.x)?a.get(l.x).push(l):a.set(l.x,[l]))}),Array.from(a.entries()).sort(function(l,c){return l[0]-c[0]}).map(function(l,c,u){var d,f,h=l[0],m=l[1],g=u[c-1],v=u[c+1];return d=g?h-(h-g[0])/2:h,f=v?h-d+(v[0]-h)/2:i-d,{id:"slice:"+t+":"+h,x0:d,x:h,y0:0,y:0,width:f,height:o,points:m.reverse()}})}if(n==="y"){var s=new Map;return r.forEach(function(l){l.data.x!==null&&l.data.y!==null&&(s.has(l.y)?s.get(l.y).push(l):s.set(l.y,[l]))}),Array.from(s.entries()).sort(function(l,c){return l[0]-c[0]}).map(function(l,c,u){var d,f,h=l[0],m=l[1],g=u[c-1],v=u[c+1];return d=g?h-(h-g[0])/2:h,f=v?h-d+(v[0]-h)/2:o-d,{id:h,x0:0,x:0,y0:d,y:h,width:i,height:f,points:m.reverse()}})}},[t,n,o,r,i])},h2e="line",xM=function(e){var t=e.data,n=e.xScale,r=n===void 0?So.xScale:n,i=e.xFormat,o=e.yScale,a=o===void 0?So.yScale:o,s=e.yFormat,l=e.width,c=e.height,u=e.colors,d=u===void 0?So.colors:u,f=e.curve,h=f===void 0?So.curve:f,m=e.areaBaselineValue,g=m===void 0?So.areaBaselineValue:m,v=e.pointColor,b=v===void 0?So.pointColor:v,y=e.pointBorderColor,x=y===void 0?So.pointBorderColor:y,$=e.enableSlices,w=$===void 0?So.enableSlicesTooltip:$,M=S.useState(c2e(h2e))[0],V=jo(i),E=jo(s),_=$1(d,"id"),O=Wt(),k=Er(b,O),A=Er(x,O),H=S.useState([]),R=H[0],j=H[1],L=S.useMemo(function(){return V$(t.filter(function(Q){return R.indexOf(Q.id)===-1}),r,a,l,c)},[t,R,r,a,l,c]),T=L.xScale,I=L.yScale,P=L.series,N=S.useMemo(function(){var Q=t.map(function(J){return{id:J.id,label:J.id,color:_(J)}}),K=Q.map(function(J){return hr({},P.find(function(W){return W.id===J.id}),{color:J.color})}).filter(function(J){return!!J.id});return{legendData:Q.map(function(J){return hr({},J,{hidden:!K.find(function(W){return W.id===J.id})})}).reverse(),series:K}},[t,P,_]),z=N.legendData,U=N.series,q=S.useCallback(function(Q){j(function(K){return K.indexOf(Q)>-1?K.filter(function(J){return J!==Q}):[].concat(K,[Q])})},[]),Y=function(Q){var K=Q.series,J=Q.getPointColor,W=Q.getPointBorderColor,Z=Q.formatX,G=Q.formatY;return S.useMemo(function(){return K.reduce(function(F,re){return[].concat(F,re.data.filter(function(B){return B.position.x!==null&&B.position.y!==null}).map(function(B,ie){var oe={id:re.id+"."+ie,index:F.length+ie,serieId:re.id,serieColor:re.color,x:B.position.x,y:B.position.y};return oe.color=J(re),oe.borderColor=W(oe),oe.data=hr({},B.data,{xFormatted:Z(B.data.x),yFormatted:G(B.data.y)}),oe}))},[])},[K,J,W,Z,G])}({series:U,getPointColor:k,getPointBorderColor:A,formatX:V,formatY:E}),ee=f2e({componentId:M,enableSlices:w,points:Y,width:l,height:c});return{legendData:z,toggleSerie:q,lineGenerator:u2e({curve:h}),areaGenerator:d2e({curve:h,yScale:I,areaBaselineValue:g}),getColor:_,series:U,xScale:T,yScale:I,slices:ee,points:Y}},g2e=function(e){var t=e.areaBlendMode,n=e.areaOpacity,r=e.color,i=e.fill,o=e.path,a=Fn(),s=a.animate,l=a.config,c=kf(o),u=Xt({color:r,config:l,immediate:!s});return p.jsx(et.path,{d:c,fill:i||u.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:t}})},v2e=S.memo(function(e){var t=e.areaGenerator,n=e.areaOpacity,r=e.areaBlendMode,i=e.lines.slice(0).reverse();return p.jsx("g",{children:i.map(function(o){return p.jsx(g2e,hr({path:t(o.data.map(function(a){return a.position}))},hr({areaOpacity:n,areaBlendMode:r},o)),o.id)})})}),m2e=S.memo(function(e){var t=e.lineGenerator,n=e.points,r=e.color,i=e.thickness,o=S.useMemo(function(){return t(n)},[t,n]),a=kf(o);return p.jsx(et.path,{d:a,fill:"none",strokeWidth:i,stroke:r})}),p2e=S.memo(function(e){var t=e.lines,n=e.lineGenerator,r=e.lineWidth;return t.slice(0).reverse().map(function(i){var o=i.id,a=i.data,s=i.color;return p.jsx(m2e,{id:o,points:a.map(function(l){return l.position}),lineGenerator:n,color:s,thickness:r},o)})}),b2e=S.memo(function(e){var t=e.slice,n=e.slices,r=e.axis,i=e.debug,o=e.tooltip,a=e.isCurrent,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd,g=ci(),v=g.showTooltipFromEvent,b=g.hideTooltip,y=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),s(t),l&&l(t,_)},[v,o,t,r,s,l]),x=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),c&&c(t,_)},[v,o,t,r,c]),$=S.useCallback(function(_){b(),s(null),u&&u(t,_)},[b,s,u,t]),w=S.useCallback(function(_){d&&d(t,_)},[t,d]),M=S.useCallback(function(_){v(S.createElement(o,{slice:t,axis:r}),_,"right"),s(t),f&&f(t,_)},[r,f,s,v,t,o]),V=S.useCallback(function(_){var O=_.touches[0],k=document.elementFromPoint(O.clientX,O.clientY),A=k==null?void 0:k.getAttribute("data-ref");if(A){var H=n.find(function(R){return R.id===A});H&&(v(S.createElement(o,{slice:H,axis:r}),_,"right"),s(H))}h&&h(t,_)},[r,h,s,v,t,n,o]),E=S.useCallback(function(_){b(),s(null),m&&m(t,_)},[b,s,m,t]);return p.jsx("rect",{x:t.x0,y:t.y0,width:t.width,height:t.height,stroke:"red",strokeWidth:i?1:0,strokeOpacity:.75,fill:"red",fillOpacity:a&&i?.35:0,onMouseEnter:y,onMouseMove:x,onMouseLeave:$,onClick:w,onTouchStart:M,onTouchMove:V,onTouchEnd:E,"data-ref":t.id})}),y2e=S.memo(function(e){var t=e.slices,n=e.axis,r=e.debug,i=e.height,o=e.tooltip,a=e.current,s=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,d=e.onClick,f=e.onTouchStart,h=e.onTouchMove,m=e.onTouchEnd;return t.map(function(g){return p.jsx(b2e,{slice:g,slices:t,axis:n,debug:r,height:i,tooltip:o,setCurrent:s,isCurrent:a!==null&&a.id===g.id,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,onTouchStart:f,onTouchMove:h,onTouchEnd:m},g.id)})}),C2e=S.memo(function(e){var t=e.points,n=e.symbol,r=e.size,i=e.borderWidth,o=e.enableLabel,a=e.label,s=e.labelYOffset,l=Wt(),c=lie(a),u=t.slice(0).reverse().map(function(d){return{id:d.id,x:d.x,y:d.y,datum:d.data,fill:d.color,stroke:d.borderColor,label:o?c(d):null}});return p.jsx("g",{children:u.map(function(d){return p.jsx(oie,{x:d.x,y:d.y,datum:d.datum,symbol:n,size:r,color:d.fill,borderWidth:i,borderColor:d.stroke,label:d.label,labelYOffset:s,theme:l},d.id)})})}),x2e=S.memo(function(e){var t=e.points,n=e.width,r=e.height,i=e.margin,o=e.setCurrent,a=e.onMouseEnter,s=e.onMouseMove,l=e.onMouseLeave,c=e.onClick,u=e.onTouchStart,d=e.onTouchMove,f=e.onTouchEnd,h=e.tooltip,m=e.debug,g=e.enableTouchCrosshair,v=ci(),b=v.showTooltipAt,y=v.hideTooltip,x=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),a&&a(O,k)},[b,h,a,i]),$=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),s&&s(O,k)},[b,h,i.left,i.top,s]),w=S.useCallback(function(O,k){y(),l&&l(O,k)},[y,l]),M=S.useCallback(function(O,k){c&&c(O,k)},[c]),V=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),u&&u(O,k)},[i.left,i.top,u,b,h]),E=S.useCallback(function(O,k){b(S.createElement(h,{point:O}),[O.x+i.left,O.y+i.top],"top"),d&&d(O,k)},[i.left,i.top,d,b,h]),_=S.useCallback(function(O,k){y(),f&&f(O,k)},[f,y]);return p.jsx(W$,{nodes:t,width:n,height:r,setCurrent:o,onMouseEnter:x,onMouseMove:$,onMouseLeave:w,onClick:M,onTouchStart:V,onTouchMove:E,onTouchEnd:_,enableTouchCrosshair:g,debug:m})}),w2e=i$(function(e){var t=e.data,n=e.xScale,r=n===void 0?{type:"point"}:n,i=e.xFormat,o=e.yScale,a=o===void 0?{type:"linear",min:0,max:"auto"}:o,s=e.yFormat,l=e.layers,c=l===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:l,u=e.curve,d=u===void 0?"linear":u,f=e.areaBaselineValue,h=f===void 0?0:f,m=e.colors,g=m===void 0?{scheme:"nivo"}:m,v=e.margin,b=e.width,y=e.height,x=e.axisTop,$=e.axisRight,w=e.axisBottom,M=w===void 0?{}:w,V=e.axisLeft,E=V===void 0?{}:V,_=e.enableGridX,O=_===void 0||_,k=e.enableGridY,A=k===void 0||k,H=e.gridXValues,R=e.gridYValues,j=e.lineWidth,L=j===void 0?2:j,T=e.enableArea,I=T!==void 0&&T,P=e.areaOpacity,N=P===void 0?.2:P,z=e.areaBlendMode,U=z===void 0?"normal":z,q=e.enablePoints,Y=q===void 0||q,ee=e.pointSymbol,Q=e.pointSize,K=Q===void 0?6:Q,J=e.pointColor,W=J===void 0?{from:"color"}:J,Z=e.pointBorderWidth,G=Z===void 0?0:Z,F=e.pointBorderColor,re=F===void 0?{theme:"background"}:F,B=e.enablePointLabel,ie=B!==void 0&&B,oe=e.pointLabel,ve=oe===void 0?"data.yFormatted":oe,Ce=e.pointLabelYOffset,pe=e.defs,ye=pe===void 0?[]:pe,Se=e.fill,me=Se===void 0?[]:Se,ge=e.markers,ce=e.legends,$e=ce===void 0?[]:ce,he=e.isInteractive,Ae=he===void 0||he,Ie=e.useMesh,Te=Ie!==void 0&&Ie,ke=e.debugMesh,Ye=ke!==void 0&&ke,Xe=e.onMouseEnter,Fe=e.onMouseMove,Le=e.onMouseLeave,Qe=e.onClick,Ze=e.onTouchStart,qe=e.onTouchMove,de=e.onTouchEnd,Ee=e.tooltip,Ke=Ee===void 0?Rh:Ee,nt=e.enableSlices,Ne=nt!==void 0&&nt,ze=e.debugSlices,De=ze!==void 0&&ze,Je=e.sliceTooltip,tt=Je===void 0?yM:Je,Be=e.enableCrosshair,je=Be===void 0||Be,ct=e.crosshairType,pt=ct===void 0?"bottom-left":ct,Oe=e.enableTouchCrosshair,fe=Oe!==void 0&&Oe,we=e.role,He=we===void 0?"img":we,Ge=Za(b,y,v),We=Ge.margin,rt=Ge.innerWidth,X=Ge.innerHeight,ae=Ge.outerWidth,se=Ge.outerHeight,Ve=xM({data:t,xScale:r,xFormat:i,yScale:a,yFormat:s,width:rt,height:X,colors:g,curve:d,areaBaselineValue:h,pointColor:W,pointBorderColor:re,enableSlices:Ne}),it=Ve.legendData,at=Ve.toggleSerie,st=Ve.lineGenerator,ft=Ve.areaGenerator,be=Ve.series,xe=Ve.xScale,Re=Ve.yScale,ot=Ve.slices,vt=Ve.points,xt=Wt(),ht=Er(W,xt),Ht=Er(re,xt),nn=S.useState(null),It=nn[0],dn=nn[1],lr=S.useState(null),Nt=lr[0],Tn=lr[1],lt={grid:p.jsx(N$,{theme:xt,width:rt,height:X,xScale:O?xe:null,yScale:A?Re:null,xValues:H,yValues:R},"grid"),markers:p.jsx(r$,{markers:ge,width:rt,height:X,xScale:xe,yScale:Re,theme:xt},"markers"),axes:p.jsx(A$,{xScale:xe,yScale:Re,width:rt,height:X,theme:xt,top:x,right:$,bottom:M,left:E},"axes"),areas:null,lines:p.jsx(p2e,{lines:be,lineGenerator:st,lineWidth:L},"lines"),slices:null,points:null,crosshair:null,mesh:null,legends:$e.map(function(ln,fn){return p.jsx(jf,hr({},ln,{containerWidth:rt,containerHeight:X,data:ln.data||it,theme:xt,toggleSerie:ln.toggleSerie?at:void 0}),"legend."+fn)})},_n=wh(ye,be,me);return I&&(lt.areas=p.jsx(v2e,{areaGenerator:ft,areaOpacity:N,areaBlendMode:U,lines:be},"areas")),Ae&&Ne!==!1&&(lt.slices=p.jsx(y2e,{slices:ot,axis:Ne,debug:De,height:X,tooltip:tt,current:Nt,setCurrent:Tn,onMouseEnter:Xe,onMouseMove:Fe,onMouseLeave:Le,onClick:Qe,onTouchStart:Ze,onTouchMove:qe,onTouchEnd:de},"slices")),Y&&(lt.points=p.jsx(C2e,{points:vt,symbol:ee,size:K,color:ht,borderWidth:G,borderColor:Ht,enableLabel:ie,label:ve,labelYOffset:Ce},"points")),Ae&&je&&(It!==null&&(lt.crosshair=p.jsx(d4,{width:rt,height:X,x:It.x,y:It.y,type:pt},"crosshair")),Nt!==null&&(lt.crosshair=p.jsx(d4,{width:rt,height:X,x:Nt.x,y:Nt.y,type:Ne},"crosshair"))),Ae&&Te&&Ne===!1&&(lt.mesh=p.jsx(x2e,{points:vt,width:rt,height:X,margin:We,current:It,setCurrent:dn,onMouseEnter:Xe,onMouseMove:Fe,onMouseLeave:Le,onClick:Qe,onTouchStart:Ze,onTouchMove:qe,onTouchEnd:de,tooltip:Ke,enableTouchCrosshair:fe,debug:Ye},"mesh")),p.jsx(Sl,{defs:_n,width:ae,height:se,margin:We,role:He,children:c.map(function(ln,fn){return typeof ln=="function"?p.jsx(S.Fragment,{children:ln(hr({},e,{innerWidth:rt,innerHeight:X,series:be,slices:ot,points:vt,xScale:xe,yScale:Re,lineGenerator:st,areaGenerator:ft,currentPoint:It,setCurrentPoint:dn,currentSlice:Nt,setCurrentSlice:Tn}))},fn):lt[ln]})})}),S2e=function(e){return p.jsx(qo,{children:function(t){var n=t.width,r=t.height;return p.jsx(w2e,hr({width:n,height:r},e))}})},$2e=i$(function(e){var t=S.useRef(null),n=e.width,r=e.height,i=e.margin,o=e.pixelRatio,a=o===void 0?typeof window<"u"&&window.devicePixelRatio||1:o,s=e.data,l=e.xScale,c=l===void 0?{type:"point"}:l,u=e.xFormat,d=e.yScale,f=d===void 0?{type:"linear",min:0,max:"auto"}:d,h=e.yFormat,m=e.curve,g=m===void 0?"linear":m,v=e.layers,b=v===void 0?["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"]:v,y=e.colors,x=y===void 0?{scheme:"nivo"}:y,$=e.lineWidth,w=$===void 0?2:$,M=e.enableArea,V=M!==void 0&&M,E=e.areaBaselineValue,_=E===void 0?0:E,O=e.areaOpacity,k=O===void 0?.2:O,A=e.enablePoints,H=A===void 0||A,R=e.pointSize,j=R===void 0?6:R,L=e.pointColor,T=L===void 0?{from:"color"}:L,I=e.pointBorderWidth,P=I===void 0?0:I,N=e.pointBorderColor,z=N===void 0?{theme:"background"}:N,U=e.enableGridX,q=U===void 0||U,Y=e.gridXValues,ee=e.enableGridY,Q=ee===void 0||ee,K=e.gridYValues,J=e.axisTop,W=e.axisRight,Z=e.axisBottom,G=Z===void 0?{}:Z,F=e.axisLeft,re=F===void 0?{}:F,B=e.legends,ie=B===void 0?[]:B,oe=e.isInteractive,ve=oe===void 0||oe,Ce=e.debugMesh,pe=Ce!==void 0&&Ce,ye=e.onMouseLeave,Se=e.onClick,me=e.tooltip,ge=me===void 0?Rh:me,ce=e.canvasRef,$e=Za(n,r,i),he=$e.margin,Ae=$e.innerWidth,Ie=$e.innerHeight,Te=$e.outerWidth,ke=$e.outerHeight,Ye=Wt(),Xe=S.useState(null),Fe=Xe[0],Le=Xe[1],Qe=xM({data:s,xScale:c,xFormat:u,yScale:f,yFormat:h,width:Ae,height:Ie,colors:x,curve:g,areaBaselineValue:_,pointColor:T,pointBorderColor:z}),Ze=Qe.lineGenerator,qe=Qe.areaGenerator,de=Qe.series,Ee=Qe.xScale,Ke=Qe.yScale,nt=Qe.points,Ne=Oh({points:nt,width:Ae,height:Ie,debug:pe}),ze=Ne.delaunay,De=Ne.voronoi;S.useEffect(function(){ce&&(ce.current=t.current),t.current.width=Te*a,t.current.height=ke*a;var fe=t.current.getContext("2d");fe.scale(a,a),fe.fillStyle=Ye.background,fe.fillRect(0,0,Te,ke),fe.translate(he.left,he.top),b.forEach(function(we){if(typeof we=="function"&&we({ctx:fe,innerWidth:Ae,innerHeight:Ie,series:de,points:nt,xScale:Ee,yScale:Ke,lineWidth:w,lineGenerator:Ze,areaGenerator:qe,currentPoint:Fe,setCurrentPoint:Le}),we==="grid"&&Ye.grid.line.strokeWidth>0&&(fe.lineWidth=Ye.grid.line.strokeWidth,fe.strokeStyle=Ye.grid.line.stroke,q&&yd(fe,{width:Ae,height:Ie,scale:Ee,axis:"x",values:Y}),Q&&yd(fe,{width:Ae,height:Ie,scale:Ke,axis:"y",values:K})),we==="axes"&&F$(fe,{xScale:Ee,yScale:Ke,width:Ae,height:Ie,top:J,right:W,bottom:G,left:re,theme:Ye}),we==="areas"&&V===!0){fe.save(),fe.globalAlpha=k,qe.context(fe);for(var He=de.length-1;He>=0;He--)fe.fillStyle=de[He].color,fe.beginPath(),qe(de[He].data.map(function(We){return We.position})),fe.fill();fe.restore()}if(we==="lines"&&(Ze.context(fe),de.forEach(function(We){fe.strokeStyle=We.color,fe.lineWidth=w,fe.beginPath(),Ze(We.data.map(function(rt){return rt.position})),fe.stroke()})),we==="points"&&H===!0&&j>0&&nt.forEach(function(We){fe.fillStyle=We.color,fe.beginPath(),fe.arc(We.x,We.y,j/2,0,2*Math.PI),fe.fill(),P>0&&(fe.strokeStyle=We.borderColor,fe.lineWidth=P,fe.stroke())}),we==="mesh"&&pe===!0&&(Z$(fe,De),Fe&&U$(fe,De,Fe.index)),we==="legends"){var Ge=de.map(function(We){return{id:We.id,label:We.id,color:We.color}}).reverse();ie.forEach(function(We){d$(fe,hr({},We,{data:We.data||Ge,containerWidth:Ae,containerHeight:Ie,theme:Ye}))})}})},[t,Te,ke,b,Ye,Ze,de,Ee,Ke,q,Y,Q,K,J,W,G,re,ie,nt,H,j,Fe]);var Je=S.useCallback(function(fe){var we=xh(t.current,fe),He=we[0],Ge=we[1];if(!o$(he.left,he.top,Ae,Ie,He,Ge))return null;var We=ze.find(He-he.left,Ge-he.top);return nt[We]},[t,he,Ae,Ie,ze]),tt=ci(),Be=tt.showTooltipFromEvent,je=tt.hideTooltip,ct=S.useCallback(function(fe){var we=Je(fe);Le(we),we?Be(S.createElement(ge,{point:we}),fe):je()},[Je,Le,Be,je,ge]),pt=S.useCallback(function(fe){je(),Le(null),Fe&&ye&&ye(Fe,fe)},[je,Le,ye]),Oe=S.useCallback(function(fe){if(Se){var we=Je(fe);we&&Se(we,fe)}},[Je,Se]);return p.jsx("canvas",{ref:t,width:Te*a,height:ke*a,style:{width:Te,height:ke,cursor:ve?"auto":"normal"},onMouseEnter:ve?ct:void 0,onMouseMove:ve?ct:void 0,onMouseLeave:ve?pt:void 0,onClick:ve?Oe:void 0})}),M2e=S.forwardRef(function(e,t){return p.jsx($2e,hr({},e,{canvasRef:t}))});S.forwardRef(function(e,t){return p.jsx(qo,{children:function(n){var r=n.width,i=n.height;return p.jsx(M2e,hr({width:r,height:i},e,{ref:t}))}})});const _2e=({trendsData:e,height:t=null,margin:n={},colors:r=null,xLeg:i,yLeg:o,tooltip:a=null})=>p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx("div",{style:{width:"100%",height:t||600},children:p.jsx(S2e,{data:e,margin:{top:50,right:90,bottom:50,left:90,...n},colors:r||{scheme:"nivo"},xScale:{type:"point"},yScale:{type:"linear",min:"auto",max:"auto",reverse:!1},axisTop:null,axisRight:null,axisBottom:{tickSize:5,tickPadding:5,tickRotation:0,legend:i,legendOffset:36,legendPosition:"middle"},axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,legend:o,legendOffset:-70,legendPosition:"middle"},pointSize:10,pointColor:{theme:"background"},pointBorderWidth:2,pointBorderColor:{from:"serieColor"},pointLabelYOffset:-12,useMesh:!0,legends:[{anchor:"top-right",direction:"column",justify:!1,translateX:210,translateY:-40,itemsSpacing:0,itemDirection:"left-to-right",itemWidth:200,itemHeight:20,itemOpacity:.9,symbolSize:8,symbolShape:"circle",symbolBorderColor:"rgba(0, 0, 0, .5)",effects:[{on:"hover",style:{itemBackground:"rgba(0, 0, 0, .03)",itemOpacity:1}}]}],tooltip:s=>p.jsx(er,{body:(a==null?void 0:a(s))||p.jsx("span",{children:"Line tooltip"})})})})]}),E2e=Ct.h3`
|
|
498
498
|
color: var(--gf-color-button-primary);
|
|
499
499
|
`,O2e=({selectors:e,setter:t})=>{const n=24/e.length;return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsx(Qs,{cardtype:"default",style:{width:"100%"},children:p.jsx(ya,{gutter:20,children:e.map((r,i)=>p.jsxs(Ar,{span:n,children:[p.jsx(E2e,{children:r.title}),p.jsx(Pa,{defaultValue:r.defaultValue,style:{width:"100%"},onChange:o=>{t(r.key,o)},options:r.options})]},`col-${i}`))})})]})},H2=Ct.span`
|
|
500
500
|
font: var(--gf-label-md-default);
|
|
@@ -600,7 +600,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
600
600
|
color: var(--gf-color-text-secondary);
|
|
601
601
|
font-size: 10px;
|
|
602
602
|
line-height: ${Gh}px;
|
|
603
|
-
`,C7e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},x7e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;C7e(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},rc={crm:{color:"hsl(36, 100%, 50%)",name:"Kritikaliteit index",legend:"Kritikaliteit index"},value:{color:"hsl(197, 100%, 19%)",name:"Aantal kritieke grondstoffen",legend:"Aantal"}},w7e=({data:e=[],height:t=1300,margin:n={},padding:r=.3,innerPadding:i=3,keys:o=Object.keys(rc),indexBy:a="material",tooltip:s=null,enableLabel:l=!1,label:c=null,keyLabelWidth:u=200,keyLabelPadding:d=20,graphGap:f=40,axisBottom:h={},layers:m=["grid","axes","bars","markers"],defs:g=[],fill:v=[],leftSpan:b=14,rightSpan:y=10})=>{const x=({bar:R})=>{var U;const j=S.useRef(null),[L,T]=S.useState(0),I=((U=R==null?void 0:R.data)==null?void 0:U.indexValue)||"label",P=x7e(I,u,a5);S.useEffect(()=>{if(j.current){const q=j.current.getBoundingClientRect();T(q.height)}},[]);const N=d,z=R.y+R.height/2-L/2;return p.jsx("g",{ref:j,transform:`translate(-${N}, ${z})`,children:p.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:P.map((q,Y)=>p.jsx(b7e,{x:0,dy:Y>0?Gh:a5,textAnchor:"end",children:q},Y))})})};let $=null;const w=({bars:R})=>R.map((j,L)=>{var T;if(name=(T=j==null?void 0:j.data)==null?void 0:T.id,!(name!==$&&$!==null))return $=name,p.jsx(x,{bar:j},`bar-label-${L}`)}),M=({bar:R})=>{var N;const j=((N=R==null?void 0:R.data)==null?void 0:N.id)===o[0],L=j?0:-f/2,T=k*(j?b:y)/24,I=j?T-u-f/2:T-f/2,P=(R==null?void 0:R.y)+(R==null?void 0:R.height)/2;return p.jsx("g",{children:p.jsx("line",{x1:L,y1:P,x2:I,y2:P,stroke:"#e1e1e1",strokeWidth:"1"})})},V=({bars:R})=>R.map((j,L)=>p.jsx(M,{bar:j},`bar-grid-${L}`)),E=({data:R,keys:j})=>{g.reduce((T,I)=>(T[I.id]={...I},delete T[I.id].id,T),{}),v.reduce((T,I)=>(I.match&&I.match.id&&(T[I.match.id]=I.id),T),{});const L=j==null?void 0:j.map(T=>{var I,P;return{name:(I=rc[T])==null?void 0:I.name,color:(P=rc[T])==null?void 0:P.color,defs:g}});return p.jsx(mn,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:L.map((T,I)=>p.jsxs(mn,{gap:8,align:"center",children:[p.jsx("div",{style:{minWidth:8,minHeight:8,backgroundColor:T.color}}),p.jsx(y7e,{children:T.name})]},`legend-${I}`))})},_=({value:R,labels:j})=>{var L;return p.jsx("div",{style:{height:t},children:p.jsx(H1,{data:H,colors:({id:T,data:I})=>{var P;return(P=rc[T])==null?void 0:P.color},defs:g,fill:v,keys:[R],indexBy:a,groupMode:"grouped",margin:{right:f/2,bottom:50,left:j?u+d:f/2,...n},layout:"horizontal",enableGridY:!1,enableGridX:!0,padding:r,innerPadding:i,enableLabel:!1,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,legend:(L=rc[R])==null?void 0:L.legend},axisLeft:null,layers:[V,...m,...j?[w]:[]],tooltip:T=>p.jsx(er,{body:(s==null?void 0:s(T))||p.jsx("span",{children:"Tooltip"})}),markers:[{axis:"x",value:0,lineStyle:{stroke:"#000000",strokeWidth:1}}]})})},O=S.useRef(null),[k,A]=S.useState(0);S.useEffect(()=>{const R=new ResizeObserver(j=>{for(let L of j)A(L.contentRect.width)});return O.current&&R.observe(O.current),()=>R.disconnect()},[]);const H=e.slice().reverse();return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsxs(mn,{vertical:!0,gap:8,style:{width:"100%"},ref:O,children:[p.jsx(E,{data:e,keys:o}),p.jsxs(ya,{gutter:[0,0],children:[p.jsx(Ar,{span:b,children:p.jsx(_,{value:o[0],labels:!0})}),p.jsx(Ar,{span:y,children:p.jsx(_,{value:o[1]})})]})]})]})},S7e=12,L_=14,$7e=Ct.tspan`
|
|
603
|
+
`,C7e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},x7e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;C7e(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},rc={crm:{color:"hsl(36, 100%, 50%)",name:"Kritikaliteit index",legend:"Kritikaliteit index"},value:{color:"hsl(197, 100%, 19%)",name:"Aantal kritieke grondstoffen",legend:"Aantal kritieke grondstoffen"}},w7e=({data:e=[],height:t=1300,margin:n={},padding:r=.3,innerPadding:i=3,keys:o=Object.keys(rc),indexBy:a="material",tooltip:s=null,enableLabel:l=!1,label:c=null,keyLabelWidth:u=200,keyLabelPadding:d=20,graphGap:f=40,axisBottom:h={},layers:m=["grid","axes","bars","markers"],defs:g=[],fill:v=[],leftSpan:b=14,rightSpan:y=10})=>{const x=({bar:R})=>{var U;const j=S.useRef(null),[L,T]=S.useState(0),I=((U=R==null?void 0:R.data)==null?void 0:U.indexValue)||"label",P=x7e(I,u,a5);S.useEffect(()=>{if(j.current){const q=j.current.getBoundingClientRect();T(q.height)}},[]);const N=d,z=R.y+R.height/2-L/2;return p.jsx("g",{ref:j,transform:`translate(-${N}, ${z})`,children:p.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:P.map((q,Y)=>p.jsx(b7e,{x:0,dy:Y>0?Gh:a5,textAnchor:"end",children:q},Y))})})};let $=null;const w=({bars:R})=>R.map((j,L)=>{var T;if(name=(T=j==null?void 0:j.data)==null?void 0:T.id,!(name!==$&&$!==null))return $=name,p.jsx(x,{bar:j},`bar-label-${L}`)}),M=({bar:R})=>{var N;const j=((N=R==null?void 0:R.data)==null?void 0:N.id)===o[0],L=j?0:-f/2,T=k*(j?b:y)/24,I=j?T-u-f/2:T-f/2,P=(R==null?void 0:R.y)+(R==null?void 0:R.height)/2;return p.jsx("g",{children:p.jsx("line",{x1:L,y1:P,x2:I,y2:P,stroke:"#e1e1e1",strokeWidth:"1"})})},V=({bars:R})=>R.map((j,L)=>p.jsx(M,{bar:j},`bar-grid-${L}`)),E=({data:R,keys:j})=>{g.reduce((T,I)=>(T[I.id]={...I},delete T[I.id].id,T),{}),v.reduce((T,I)=>(I.match&&I.match.id&&(T[I.match.id]=I.id),T),{});const L=j==null?void 0:j.map(T=>{var I,P;return{name:(I=rc[T])==null?void 0:I.name,color:(P=rc[T])==null?void 0:P.color,defs:g}});return p.jsx(mn,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:L.map((T,I)=>p.jsxs(mn,{gap:8,align:"center",children:[p.jsx("div",{style:{minWidth:8,minHeight:8,backgroundColor:T.color}}),p.jsx(y7e,{children:T.name})]},`legend-${I}`))})},_=({value:R,labels:j})=>{var L;return p.jsx("div",{style:{height:t},children:p.jsx(H1,{data:H,colors:({id:T,data:I})=>{var P;return(P=rc[T])==null?void 0:P.color},defs:g,fill:v,keys:[R],indexBy:a,groupMode:"grouped",margin:{right:f/2,bottom:50,left:j?u+d:f/2,...n},layout:"horizontal",enableGridY:!1,enableGridX:!0,padding:r,innerPadding:i,enableLabel:!1,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,legend:(L=rc[R])==null?void 0:L.legend},axisLeft:null,layers:[V,...m,...j?[w]:[]],tooltip:T=>p.jsx(er,{body:(s==null?void 0:s(T))||p.jsx("span",{children:"Tooltip"})}),markers:[{axis:"x",value:0,lineStyle:{stroke:"#000000",strokeWidth:1}}]})})},O=S.useRef(null),[k,A]=S.useState(0);S.useEffect(()=>{const R=new ResizeObserver(j=>{for(let L of j)A(L.contentRect.width)});return O.current&&R.observe(O.current),()=>R.disconnect()},[]);const H=e.slice().reverse();return p.jsxs(p.Fragment,{children:[p.jsx(yn,{}),p.jsxs(mn,{vertical:!0,gap:8,style:{width:"100%"},ref:O,children:[p.jsx(E,{data:e,keys:o}),p.jsxs(ya,{gutter:[0,0],children:[p.jsx(Ar,{span:b,children:p.jsx(_,{value:o[0],labels:!0})}),p.jsx(Ar,{span:y,children:p.jsx(_,{value:o[1]})})]})]})]})},S7e=12,L_=14,$7e=Ct.tspan`
|
|
604
604
|
font: var(--gf-label-md-default);
|
|
605
605
|
color: var(--gf-color-text-secondary);
|
|
606
606
|
font-size: ${S7e}px;
|