From 83399cb1b44023a17e42f7cc75362804944da0ed Mon Sep 17 00:00:00 2001 From: sentisso <38100632+sentisso@users.noreply.github.com> Date: Tue, 24 Sep 2024 23:27:36 +0200 Subject: [PATCH] Updates --- assets/{index-Ci2MTPZI.js => index-Duahnm7L.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-Ci2MTPZI.js => index-Duahnm7L.js} (99%) diff --git a/assets/index-Ci2MTPZI.js b/assets/index-Duahnm7L.js similarity index 99% rename from assets/index-Ci2MTPZI.js rename to assets/index-Duahnm7L.js index 5efd409..1ce75be 100644 --- a/assets/index-Ci2MTPZI.js +++ b/assets/index-Duahnm7L.js @@ -254,7 +254,7 @@ html body { * Released under the MIT License */class t3{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,i){const o=n.listeners[i],a=n.duration;o.forEach(s=>s({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(r-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=E$.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const o=r.items;let a=o.length-1,s=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),s=!0):(o[a]=o[o.length-1],o.pop());s&&(i.draw(),this._notify(i,r,t,"progress")),o.length||(r.running=!1,this._notify(i,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const r=n.items;let i=r.length-1;for(;i>=0;--i)r[i].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var _i=new t3;const fx="transparent",n3={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=tx(e||fx),i=r.valid&&tx(t||fx);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class r3{constructor(t,n,r,i){const o=n[r];i=wu([t.to,i,o,t.from]);const a=wu([t.from,o,i]);this._active=!0,this._fn=t.fn||n3[t.type||typeof a],this._easing=Rl[t.easing]||Rl.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],o=r-this._start,a=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=wu([t.to,n,i,t.from]),this._from=wu([t.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,i=this._prop,o=this._from,a=this._loop,s=this._to;let l;if(this._active=o!==s&&(a||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,s,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let i=0;i{const o=t[i];if(!wt(o))return;const a={};for(const s of n)a[s]=o[s];(Rn(o.properties)&&o.properties||[i]).forEach(s=>{(s===i||!r.has(s))&&r.set(s,a)})})}_animateOptions(t,n){const r=n.options,i=o3(t,r);if(!i)return[];const o=this._createAnimations(i,r);return r.$shared&&i3(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,i=[],o=t.$animations||(t.$animations={}),a=Object.keys(n),s=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,n));continue}const u=n[c];let f=o[c];const h=r.get(c);if(f)if(h&&f.active()){f.update(h,u,s);continue}else f.cancel();if(!h||!h.duration){t[c]=u;continue}o[c]=f=new r3(h,t,c,u),i.push(f)}return i}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return _i.add(this._chart,r),!0}}function i3(e,t){const n=[],r=Object.keys(t);for(let i=0;i0||!n&&o<0)return i.index}return null}function vx(e,t){const{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:o,vScale:a,index:s}=r,l=o.axis,c=a.axis,u=c3(o,a,r),f=t.length;let h;for(let m=0;mn[r].axis===t).shift()}function f3(e,t){return ya(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function h3(e,t,n){return ya(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function Zs(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const i of t){const o=i._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const ng=e=>e==="reset"||e==="none",yx=(e,t)=>t?e:Object.assign({},e),g3=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:j$(n,!0),values:null};class Nl{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=mx(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Zs(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(f,h,m,y)=>f==="x"?h:f==="r"?y:m,o=n.xAxisID=it(r.xAxisID,tg(t,"x")),a=n.yAxisID=it(r.yAxisID,tg(t,"y")),s=n.rAxisID=it(r.rAxisID,tg(t,"r")),l=n.indexAxis,c=n.iAxisID=i(l,o,a,s),u=n.vAxisID=i(l,a,o,s);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(s),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Z1(this._data,this),t._stacked&&Zs(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(wt(n)){const i=this._cachedMeta;this._data=l3(n,i)}else if(r!==n){if(r){Z1(r,this);const i=this._cachedMeta;Zs(i),i._parsed=[]}n&&Object.isExtensible(n)&&qz(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const o=n._stacked;n._stacked=mx(n.vScale,n),n.stack!==r.stack&&(i=!0,Zs(n),n.stack=r.stack),this._resyncElements(t),(i||o!==n._stacked)&&vx(this,n._parsed)}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:i}=this,{iScale:o,_stacked:a}=r,s=o.axis;let l=t===0&&n===i.length?!0:r._sorted,c=t>0&&r._parsed[t-1],u,f,h;if(this._parsing===!1)r._parsed=i,r._sorted=!0,h=i;else{Rn(i[t])?h=this.parseArrayData(r,i,t,n):wt(i[t])?h=this.parseObjectData(r,i,t,n):h=this.parsePrimitiveData(r,i,t,n);const m=()=>f[s]===null||c&&f[s]v||f=0;--h)if(!y()){this.updateRangeFromParsed(c,t,m,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let i,o,a;for(i=0,o=n.length;i=0&&tthis.getContext(r,i,n),v=c.resolveNamedOptions(h,m,y,f);return v.$shared&&(v.$shared=l,o[a]=Object.freeze(yx(v,l))),v}_resolveAnimations(t,n,r){const i=this.chart,o=this._cachedDataOpts,a=`animation-${n}`,s=o[a];if(s)return s;let l;if(i.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(h,this.getContext(t,r,n))}const c=new z$(i,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ng(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),i=this._sharedOptions,o=this.getSharedOptions(r),a=this.includeOptions(n,o)||o!==i;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:a}}updateElement(t,n,r,i){ng(i)?Object.assign(t,r):this._resolveAnimations(n,i).update(t,r)}updateSharedOptions(t,n,r){t&&!ng(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,i){t.active=i;const o=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[s,l,c]of this._syncList)this[s](l,c);this._syncList=[];const i=r.length,o=n.length,a=Math.min(o,i);a&&this.parse(0,a),o>i?this._insertElements(i,o-i,t):o{for(c.length+=n,s=c.length-1;s>=a;s--)c[s]=c[s-n]};for(l(o),s=t;s0&&this.getParsed(n-1);for(let C=0;C=g){E.skip=!0;continue}const _=this.getParsed(C),O=on(_[m]),M=E[h]=a.getPixelForValue(_[h],C),I=E[m]=o||O?s.getBasePixel():s.getPixelForValue(l?this.applyStack(s,_,l):_[m],C);E.skip=isNaN(M)||isNaN(I)||O,E.stop=C>0&&Math.abs(_[h]-S[h])>b,v&&(E.parsed=_,E.raw=c.data[C]),f&&(E.options=u||this.resolveDataElementOptions(C,w.active?"active":i)),p||this.updateElement(w,C,E,i),S=_}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,i=t.data||[];if(!i.length)return r;const o=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(r,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}tt(od,"id","line"),tt(od,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),tt(od,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Lo(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class x0{constructor(t){tt(this,"options");this.options=t||{}}static override(t){Object.assign(x0.prototype,t)}init(){}formats(){return Lo()}parse(){return Lo()}format(){return Lo()}add(){return Lo()}diff(){return Lo()}startOf(){return Lo()}endOf(){return Lo()}}var m3={_date:x0};function p3(e,t,n,r){const{controller:i,data:o,_sorted:a}=e,s=i._cachedMeta.iScale;if(s&&t===s.axis&&t!=="r"&&a&&o.length){const l=s._reversePixels?Gz:Yo;if(r){if(i._sharedOptions){const c=o[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const f=l(o,t,n-u),h=l(o,t,n+u);return{lo:f.lo,hi:h.hi}}}}else return l(o,t,n)}return{lo:0,hi:o.length-1}}function Dc(e,t,n,r,i){const o=e.getSortedVisibleDatasetMetas(),a=n[t];for(let s=0,l=o.length;s{l[a]&&l[a](t[n],i)&&(o.push({element:l,datasetIndex:c,index:u}),s=s||l.inRange(t.x,t.y,i))}),r&&!s?[]:o}var x3={evaluateInteractionItems:Dc,modes:{index(e,t,n,r){const i=mi(t,e),o=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?rg(e,i,o,r,a):ig(e,i,o,!1,r,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=s[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,r){const i=mi(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?rg(e,i,o,r,a):ig(e,i,o,!1,r,a);if(s.length>0){const l=s[0].datasetIndex,c=e.getDatasetMeta(l).data;s=[];for(let u=0;un.pos===t)}function xx(e,t){return e.filter(n=>B$.indexOf(n.pos)===-1&&n.box.axis===t)}function el(e,t){return e.sort((n,r)=>{const i=t?r:n,o=t?n:r;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function S3(e){const t=[];let n,r,i,o,a,s;for(n=0,r=(e||[]).length;nc.box.fullSize),!0),r=el(Js(t,"left"),!0),i=el(Js(t,"right")),o=el(Js(t,"top"),!0),a=el(Js(t,"bottom")),s=xx(t,"x"),l=xx(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:i.concat(l).concat(a).concat(s),chartArea:Js(t,"chartArea"),vertical:r.concat(i).concat(l),horizontal:o.concat(a).concat(s)}}function Sx(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function H$(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function _3(e,t,n,r){const{pos:i,box:o}=n,a=e.maxPadding;if(!wt(i)){n.size&&(e[i]-=n.size);const f=r[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?o.height:o.width),n.size=f.size/f.count,e[i]+=n.size}o.getPadding&&H$(a,o.getPadding());const s=Math.max(0,t.outerWidth-Sx(a,e,"left","right")),l=Math.max(0,t.outerHeight-Sx(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function $3(e){const t=e.maxPadding;function n(r){const i=Math.max(t[r]-e[r],0);return e[r]+=i,i}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function O3(e,t){const n=t.maxPadding;function r(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(a=>{o[a]=Math.max(t[a],n[a])}),o}return r(e?["left","right"]:["top","bottom"])}function dl(e,t,n,r){const i=[];let o,a,s,l,c,u;for(o=0,a=e.length,c=0;o{typeof v.beforeLayout=="function"&&v.beforeLayout()});const u=l.reduce((v,b)=>b.box.options&&b.box.options.display===!1?v:v+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},i);H$(h,Hr(r));const m=Object.assign({maxPadding:h,w:o,h:a,x:i.left,y:i.top},i),y=w3(l.concat(c),f);dl(s.fullSize,m,f,y),dl(l,m,f,y),dl(c,m,f,y)&&dl(l,m,f,y),$3(m),Cx(s.leftAndTop,m,f,y),m.x+=m.w,m.y+=m.h,Cx(s.rightAndBottom,m,f,y),e.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},at(s.chartArea,v=>{const b=v.box;Object.assign(b,e.chartArea),b.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class V${acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,i){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(t){return!0}updateConfig(t){}}class P3 extends V${acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ad="$chartjs",M3={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},wx=e=>e===null||e==="";function T3(e,t){const n=e.style,r=e.getAttribute("height"),i=e.getAttribute("width");if(e[ad]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",wx(i)){const o=lx(e,"width");o!==void 0&&(e.width=o)}if(wx(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=lx(e,"height");o!==void 0&&(e.height=o)}return e}const W$=Hj?{passive:!0}:!1;function R3(e,t,n){e&&e.addEventListener(t,n,W$)}function I3(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,W$)}function k3(e,t){const n=M3[e.type]||e.type,{x:r,y:i}=mi(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:i!==void 0?i:null}}function Xd(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function N3(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let a=!1;for(const s of o)a=a||Xd(s.addedNodes,r),a=a&&!Xd(s.removedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function F3(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let a=!1;for(const s of o)a=a||Xd(s.removedNodes,r),a=a&&!Xd(s.addedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const Sc=new Map;let Ex=0;function U$(){const e=window.devicePixelRatio;e!==Ex&&(Ex=e,Sc.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function A3(e,t){Sc.size||window.addEventListener("resize",U$),Sc.set(e,t)}function L3(e){Sc.delete(e),Sc.size||window.removeEventListener("resize",U$)}function D3(e,t,n){const r=e.canvas,i=r&&b0(r);if(!i)return;const o=_$((s,l)=>{const c=i.clientWidth;n(s,l),c{const l=s[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return a.observe(i),A3(e,o),a}function og(e,t,n){n&&n.disconnect(),t==="resize"&&L3(e)}function z3(e,t,n){const r=e.canvas,i=_$(o=>{e.ctx!==null&&n(k3(o,e))},e);return R3(r,t,i),i}class j3 extends V${acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(T3(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[ad])return!1;const r=n[ad].initial;["height","width"].forEach(o=>{const a=r[o];on(a)?n.removeAttribute(o):n.setAttribute(o,a)});const i=r.style||{};return Object.keys(i).forEach(o=>{n.style[o]=i[o]}),n.width=n.width,delete n[ad],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const i=t.$proxies||(t.$proxies={}),a={attach:N3,detach:F3,resize:D3}[n]||z3;i[n]=a(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),i=r[n];if(!i)return;({attach:og,detach:og,resize:og}[n]||I3)(t,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,i){return Bj(t,n,r,i)}isAttached(t){const n=t&&b0(t);return!!(n&&n.isConnected)}}function B3(e){return!y0()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?P3:j3}var Nu;let ba=(Nu=class{constructor(){tt(this,"x");tt(this,"y");tt(this,"active",!1);tt(this,"options");tt(this,"$animations")}tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return yc(this.x)&&yc(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const i={};return t.forEach(o=>{i[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),i}},tt(Nu,"defaults",{}),tt(Nu,"defaultRoutes"),Nu);function H3(e,t){const n=e.options.ticks,r=V3(e),i=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?U3(t):[],a=o.length,s=o[0],l=o[a-1],c=[];if(a>i)return G3(t,c,o,a/i),c;const u=W3(o,t,i);if(a>0){let f,h;const m=a>1?Math.round((l-s)/(a-1)):null;for(Ou(t,c,u,on(m)?0:s-m,s),f=0,h=a-1;fi)return l}return Math.max(i,1)}function U3(e){const t=[];let n,r;for(n=0,r=e.length;ne==="left"?"right":e==="right"?"left":e,_x=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,$x=(e,t)=>Math.min(t||e,e);function Ox(e,t){const n=[],r=e.length/t,i=e.length;let o=0;for(;oa+s)))return l}function Y3(e,t){at(e,n=>{const r=n.gc,i=r.length/2;let o;if(i>t){for(o=0;or?r:n,r=i&&n>r?n:r,{min:ui(n,ui(r,n)),max:ui(r,ui(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Xe(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:i,grace:o,ticks:a}=this.options,s=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=bj(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=s=o||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),f=u.widest.width,h=u.highest.height,m=Nr(this.chart.width-f,0,this.maxWidth);s=t.offset?this.maxWidth/r:m/(r-1),f+6>s&&(s=m/(r-(t.offset?.5:1)),l=this.maxHeight-tl(t.grid)-n.padding-Px(t.title,this.chart.options.font),c=Math.sqrt(f*f+h*h),a=Hz(Math.min(Math.asin(Nr((u.highest.height+6)/s,-1,1)),Math.asin(Nr(l/c,-1,1))-Math.asin(Nr(h/c,-1,1)))),a=Math.max(i,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){Xe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Xe(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:o}}=this,a=this._isVisible(),s=this.isHorizontal();if(a){const l=Px(i,n.options.font);if(s?(t.width=this.maxWidth,t.height=tl(o)+l):(t.height=this.maxHeight,t.width=tl(o)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:h}=this._getLabelSizes(),m=r.padding*2,y=Xo(this.labelRotation),v=Math.cos(y),b=Math.sin(y);if(s){const p=r.mirror?0:b*f.width+v*h.height;t.height=Math.min(this.maxHeight,t.height+p+m)}else{const p=r.mirror?0:v*f.width+b*h.height;t.width=Math.min(this.maxWidth,t.width+p+m)}this._calculatePadding(c,u,b,v)}}this._handleMargins(),s?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,i){const{ticks:{align:o,padding:a},position:s}=this.options,l=this.labelRotation!==0,c=s!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,m=0;l?c?(h=i*t.width,m=r*n.height):(h=r*t.height,m=i*n.width):o==="start"?m=n.width:o==="end"?h=t.width:o!=="inner"&&(h=t.width/2,m=n.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-f+a)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;o==="start"?(u=0,f=t.height):o==="end"&&(u=n.height,f=0),this.paddingTop=u+a,this.paddingBottom=f+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){Xe(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n({width:a[O]||0,height:s[O]||0});return{first:_(0),last:_(n-1),widest:_(w),highest:_(E),widths:a,heights:s}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return Uz(this._alignToPixels?Ao(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ts*i?s/r:l/i:l*i0}_computeGridLineItems(t){const n=this.axis,r=this.chart,i=this.options,{grid:o,position:a,border:s}=i,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),h=tl(o),m=[],y=s.setContext(this.getContext()),v=y.display?y.width:0,b=v/2,p=function(A){return Ao(r,A,v)};let g,x,S,C,w,E,_,O,M,I,k,F;if(a==="top")g=p(this.bottom),E=this.bottom-h,O=g-b,I=p(t.top)+b,F=t.bottom;else if(a==="bottom")g=p(this.top),I=t.top,F=p(t.bottom)-b,E=g+b,O=this.top+h;else if(a==="left")g=p(this.right),w=this.right-h,_=g-b,M=p(t.left)+b,k=t.right;else if(a==="right")g=p(this.left),M=t.left,k=p(t.right)-b,w=g+b,_=this.left+h;else if(n==="x"){if(a==="center")g=p((t.top+t.bottom)/2+.5);else if(wt(a)){const A=Object.keys(a)[0],P=a[A];g=p(this.chart.scales[A].getPixelForValue(P))}I=t.top,F=t.bottom,E=g+b,O=E+h}else if(n==="y"){if(a==="center")g=p((t.left+t.right)/2);else if(wt(a)){const A=Object.keys(a)[0],P=a[A];g=p(this.chart.scales[A].getPixelForValue(P))}w=g-b,_=w-h,M=t.left,k=t.right}const j=it(i.ticks.maxTicksLimit,f),B=Math.max(1,Math.ceil(f/j));for(x=0;x0&&(ee-=W/2);break}H={left:ee,top:K,width:W+G.width,height:X+G.height,color:B.backdropColor}}b.push({label:S,font:O,textOffset:k,options:{rotation:v,color:P,strokeColor:R,strokeWidth:N,textAlign:D,textBaseline:F,translation:[C,w],backdrop:H}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Xo(this.labelRotation))return t==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:i,padding:o}}=this.options,a=this._getLabelSizes(),s=t+o,l=a.widest.width;let c,u;return n==="left"?i?(u=this.right+o,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-s,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+o,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+s,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:i,width:o,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,i,o,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(o=>o.value===t);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const s=(l,c,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,a=i.length;o{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let o,a;for(o=0,a=n.length;o{const r=n.split("."),i=r.pop(),o=[e].concat(r).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");dn.route(o,i,l,s)})}function r6(e){return"id"in e&&"defaults"in e}class i6{constructor(){this.controllers=new Pu(Nl,"datasets",!0),this.elements=new Pu(ba,"elements"),this.plugins=new Pu(Object,"plugins"),this.scales=new Pu(Ns,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(i=>{const o=r||this._getRegistryForType(i);r||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):at(i,a=>{const s=r||this._getRegistryForType(a);this._exec(t,s,a)})})}_exec(t,n,r){const i=c0(t);Xe(r["before"+i],[],r),n[t](r),Xe(r["after"+i],[],r)}_getRegistryForType(t){for(let n=0;no.filter(s=>!a.some(l=>s.plugin.id===l.plugin.id));this._notify(i(n,r),t,"stop"),this._notify(i(r,n),t,"start")}}function a6(e){const t={},n=[],r=Object.keys(hi.plugins.items);for(let o=0;o1&&Mx(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Tx(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function h6(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return Tx(e,"x",n[0])||Tx(e,"y",n[0])}return{}}function g6(e,t){const n=fa[e.type]||{scales:{}},r=t.scales||{},i=cp(e.type,t),o=Object.create(null);return Object.keys(r).forEach(a=>{const s=r[a];if(!wt(s))return console.error(`Invalid scale configuration for scale: ${a}`);if(s._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=up(a,s,h6(a,e),dn.scales[s.type]),c=d6(l,i),u=n.scales||{};o[a]=Ml(Object.create(null),[{axis:l},s,u[l],u[c]])}),e.data.datasets.forEach(a=>{const s=a.type||e.type,l=a.indexAxis||cp(s,t),u=(fa[s]||{}).scales||{};Object.keys(u).forEach(f=>{const h=u6(f,l),m=a[h+"AxisID"]||h;o[m]=o[m]||Object.create(null),Ml(o[m],[{axis:h},r[m],u[f]])})}),Object.keys(o).forEach(a=>{const s=o[a];Ml(s,[dn.scales[s.type],dn.scale])}),o}function G$(e){const t=e.options||(e.options={});t.plugins=it(t.plugins,{}),t.scales=g6(e,t)}function K$(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function m6(e){return e=e||{},e.data=K$(e.data),G$(e),e}const Rx=new Map,q$=new Set;function Mu(e,t){let n=Rx.get(e);return n||(n=t(),Rx.set(e,n),q$.add(n)),n}const nl=(e,t,n)=>{const r=Ud(t,n);r!==void 0&&e.add(r)};class p6{constructor(t){this._config=m6(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=K$(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),G$(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Mu(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Mu(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Mu(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Mu(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let i=r.get(t);return(!i||n)&&(i=new Map,r.set(t,i)),i}getOptionScopes(t,n,r){const{options:i,type:o}=this,a=this._cachedScopes(t,r),s=a.get(n);if(s)return s;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(f=>nl(l,t,f))),u.forEach(f=>nl(l,i,f)),u.forEach(f=>nl(l,fa[o]||{},f)),u.forEach(f=>nl(l,dn,f)),u.forEach(f=>nl(l,ap,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),q$.has(n)&&a.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,fa[n]||{},dn.datasets[n]||{},{type:n},dn,ap]}resolveNamedOptions(t,n,r,i=[""]){const o={$shared:!0},{resolver:a,subPrefixes:s}=Ix(this._resolverCache,t,i);let l=a;if(y6(a,n)){o.$shared=!1,r=wo(r)?r():r;const c=this.createResolver(t,r,s);l=ws(a,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],i){const{resolver:o}=Ix(this._resolverCache,t,r);return wt(n)?ws(o,n,void 0,i):o}}function Ix(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const i=n.join();let o=r.get(i);return o||(o={resolver:m0(t,n),subPrefixes:n.filter(s=>!s.toLowerCase().includes("hover"))},r.set(i,o)),o}const v6=e=>wt(e)&&Object.getOwnPropertyNames(e).some(t=>wo(e[t]));function y6(e,t){const{isScriptable:n,isIndexable:r}=R$(e);for(const i of t){const o=n(i),a=r(i),s=(a||o)&&e[i];if(o&&(wo(s)||v6(s))||a&&Rn(s))return!0}return!1}var b6="4.4.4";const x6=["top","bottom","left","right","chartArea"];function kx(e,t){return e==="top"||e==="bottom"||x6.indexOf(e)===-1&&t==="x"}function Nx(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function Fx(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),Xe(n&&n.onComplete,[e],t)}function S6(e){const t=e.chart,n=t.options.animation;Xe(n&&n.onProgress,[e],t)}function X$(e){return y0()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const sd={},Ax=e=>{const t=X$(e);return Object.values(sd).filter(n=>n.canvas===t).pop()};function C6(e,t,n){const r=Object.keys(e);for(const i of r){const o=+i;if(o>=t){const a=e[i];delete e[i],(n>0||o>t)&&(e[o+n]=a)}}}function w6(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}function Tu(e,t,n){return e.options.clip?e[n]:t[n]}function E6(e,t){const{xScale:n,yScale:r}=e;return n&&r?{left:Tu(n,t,"left"),right:Tu(n,t,"right"),top:Tu(r,t,"top"),bottom:Tu(r,t,"bottom")}:t}var Ki;let Gf=(Ki=class{static register(...t){hi.add(...t),Lx()}static unregister(...t){hi.remove(...t),Lx()}constructor(t,n){const r=this.config=new p6(n),i=X$(t),o=Ax(i);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||B3(i)),this.platform.updateConfig(r);const s=this.platform.acquireContext(i,a.aspectRatio),l=s&&s.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Tz(),this.ctx=s,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new o6,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Yz(f=>this.update(f),a.resizeDelay||0),this._dataChanges=[],sd[this.id]=this,!s||!l){console.error("Failed to create chart: can't acquire context from the given item");return}_i.listen(this,"complete",Fx),_i.listen(this,"progress",S6),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:i,_aspectRatio:o}=this;return on(t)?n&&o?o:i?r/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return hi}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():sx(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ix(this.canvas,this.ctx),this}stop(){return _i.stop(this),this}resize(t,n){_i.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,i=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,t,n,o),s=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,sx(this,s,!0)&&(this.notifyPlugins("resize",{size:a}),Xe(r.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};at(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,i=Object.keys(r).reduce((a,s)=>(a[s]=!1,a),{});let o=[];n&&(o=o.concat(Object.keys(n).map(a=>{const s=n[a],l=up(a,s),c=l==="r",u=l==="x";return{options:s,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),at(o,a=>{const s=a.options,l=s.id,c=up(l,s),u=it(s.type,a.dtype);(s.position===void 0||kx(s.position,c)!==kx(a.dposition))&&(s.position=a.dposition),i[l]=!0;let f=null;if(l in r&&r[l].type===u)f=r[l];else{const h=hi.getScale(u);f=new h({id:l,type:u,ctx:this.ctx,chart:this}),r[f.id]=f}f.init(s,t)}),at(i,(a,s)=>{a||delete r[s]}),at(r,a=>{Fr.configure(this,a,a.options),Fr.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((i,o)=>i.index-o.index),r>n){for(let i=n;in.length&&delete this._stacks,t.forEach((r,i)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Nx("z","_idx"));const{_active:s,_lastEvent:l}=this;l?this._eventHandler(l,!0):s.length&&this._updateHoverStyles(s,s,!0),this.render()}_updateScales(){at(this.scales,t=>{Fr.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!q1(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:o}of n){const a=r==="_removeElements"?-o:o;C6(t,i,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(a=>a[0]===o).map((a,s)=>s+","+a.splice(1).join(","))),i=r(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Fr.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],at(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r=t._clip,i=!r.disabled,o=E6(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(i&&h0(n,{left:r.left===!1?0:o.left-r.left,right:r.right===!1?this.width:o.right+r.right,top:r.top===!1?0:o.top-r.top,bottom:r.bottom===!1?this.height:o.bottom+r.bottom}),t.controller.draw(),i&&g0(n),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return bc(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,i){const o=x3.modes[n];return typeof o=="function"?o(this,t,r,i):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let i=r.filter(o=>o&&o._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=ya(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const i=r?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,i);Gd(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),a.update(o,{visible:r}),this.update(s=>s.datasetIndex===t?i:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),_i.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,o,a),t[o]=a},i=(o,a,s)=>{o.offsetX=a,o.offsetY=s,this._eventHandler(o)};at(this.options.events,o=>r(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const s=()=>{i("attach",s),this.attached=!0,this.resize(),r("resize",o),r("detach",a)};a=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),r("attach",s)},n.isAttached(this.canvas)?s():a()}unbindEvents(){at(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},at(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const i=r?"set":"remove";let o,a,s,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),s=0,l=t.length;s{const s=this.getDatasetMeta(o);if(!s)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:s.data[a],index:a}});!Vd(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),a=o(n,t),s=r?t:o(t,n);a.length&&this.updateHoverStyle(a,i.mode,!1),s.length&&i.mode&&this.updateHoverStyle(s,i.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},i=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:i=[],options:o}=this,a=n,s=this._getActiveElements(t,i,r,a),l=Az(t),c=w6(t,this._lastEvent,r,l);r&&(this._lastEvent=null,Xe(o.onHover,[t,s,this],this),l&&Xe(o.onClick,[t,s,this],this));const u=!Vd(s,i);return(u||n)&&(this._active=s,this._updateHoverStyles(s,i,n)),this._lastEvent=c,u}_getActiveElements(t,n,r,i){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}},tt(Ki,"defaults",dn),tt(Ki,"instances",sd),tt(Ki,"overrides",fa),tt(Ki,"registry",hi),tt(Ki,"version",b6),tt(Ki,"getChart",Ax),Ki);function Lx(){return at(Gf.instances,e=>e._plugins.invalidate())}function Y$(e,t,n=t){e.lineCap=it(n.borderCapStyle,t.borderCapStyle),e.setLineDash(it(n.borderDash,t.borderDash)),e.lineDashOffset=it(n.borderDashOffset,t.borderDashOffset),e.lineJoin=it(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=it(n.borderWidth,t.borderWidth),e.strokeStyle=it(n.borderColor,t.borderColor)}function _6(e,t,n){e.lineTo(n.x,n.y)}function $6(e){return e.stepped?cj:e.tension||e.cubicInterpolationMode==="monotone"?uj:_6}function Q$(e,t,n={}){const r=e.length,{start:i=0,end:o=r-1}=n,{start:a,end:s}=t,l=Math.max(i,a),c=Math.min(o,s),u=is&&o>s;return{count:r,start:l,loop:t.loop,ilen:c(a+(c?s-S:S))%o,x=()=>{v!==b&&(e.lineTo(u,b),e.lineTo(u,v),e.lineTo(u,p))};for(l&&(m=i[g(0)],e.moveTo(m.x,m.y)),h=0;h<=s;++h){if(m=i[g(h)],m.skip)continue;const S=m.x,C=m.y,w=S|0;w===y?(Cb&&(b=C),u=(f*u+S)/++f):(x(),e.lineTo(S,C),y=w,f=0,v=b=C),p=C}x()}function dp(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?P6:O6}function M6(e){return e.stepped?Vj:e.tension||e.cubicInterpolationMode==="monotone"?Wj:jo}function T6(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),Y$(e,t.options),e.stroke(i)}function R6(e,t,n,r){const{segments:i,options:o}=t,a=dp(t);for(const s of i)Y$(e,o,s.style),e.beginPath(),a(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const I6=typeof Path2D=="function";function k6(e,t,n,r){I6&&!t.options.segment?T6(e,t,n,r):R6(e,t,n,r)}class fl extends ba{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const i=r.spanGaps?this._loop:this._fullLoop;Fj(this._points,r,t,i,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Zj(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,i=t[n],o=this.points,a=Xj(this,{property:n,start:i,end:i});if(!a.length)return;const s=[],l=M6(r);let c,u;for(c=0,u=a.length;ct!=="borderDash"&&t!=="fill"});function Dx(e,t,n,r){const i=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o){let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},N6=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class jx extends ba{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=Xe(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,i)=>t.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,i=Kn(r.font),o=i.size,a=this._computeTitleHeight(),{boxWidth:s,itemHeight:l}=zx(r,o);let c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,o,s,l)+10):(u=this.maxHeight,c=this._fitCols(a,i,s,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,i){const{ctx:o,maxWidth:a,options:{labels:{padding:s}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+s;let f=t;o.textAlign="left",o.textBaseline="middle";let h=-1,m=-u;return this.legendItems.forEach((y,v)=>{const b=r+n/2+o.measureText(y.text).width;(v===0||c[c.length-1]+b+2*s>a)&&(f+=u,c[c.length-(v>0?0:1)]=0,m+=u,h++),l[v]={left:0,top:m,row:h,width:b,height:i},c[c.length-1]+=b+s}),f}_fitCols(t,n,r,i){const{ctx:o,maxHeight:a,options:{labels:{padding:s}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t;let f=s,h=0,m=0,y=0,v=0;return this.legendItems.forEach((b,p)=>{const{itemWidth:g,itemHeight:x}=F6(r,n,o,b,i);p>0&&m+x+2*s>u&&(f+=h+s,c.push({width:h,height:m}),y+=h+s,v++,h=m=0),l[p]={left:y,top:m,col:v,width:g,height:x},h=Math.max(h,g),m+=x+s}),f+=h,c.push({width:h,height:m}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:o}}=this,a=ls(o,this.left,this.width);if(this.isHorizontal()){let s=0,l=Wn(r,this.left+i,this.right-this.lineWidths[s]);for(const c of n)s!==c.row&&(s=c.row,l=Wn(r,this.left+i,this.right-this.lineWidths[s])),c.top+=this.top+t+i,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+i}else{let s=0,l=Wn(r,this.top+t+i,this.bottom-this.columnSizes[s].height);for(const c of n)c.col!==s&&(s=c.col,l=Wn(r,this.top+t+i,this.bottom-this.columnSizes[s].height)),c.top=l,c.left+=this.left+i,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;h0(t,this),this._draw(),g0(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:i}=this,{align:o,labels:a}=t,s=dn.color,l=ls(t.rtl,this.left,this.width),c=Kn(a.font),{padding:u}=a,f=c.size,h=f/2;let m;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:y,boxHeight:v,itemHeight:b}=zx(a,f),p=function(w,E,_){if(isNaN(y)||y<=0||isNaN(v)||v<0)return;i.save();const O=it(_.lineWidth,1);if(i.fillStyle=it(_.fillStyle,s),i.lineCap=it(_.lineCap,"butt"),i.lineDashOffset=it(_.lineDashOffset,0),i.lineJoin=it(_.lineJoin,"miter"),i.lineWidth=O,i.strokeStyle=it(_.strokeStyle,s),i.setLineDash(it(_.lineDash,[])),a.usePointStyle){const M={radius:v*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:O},I=l.xPlus(w,y/2),k=E+h;M$(i,M,I,k,a.pointStyleWidth&&y)}else{const M=E+Math.max((f-v)/2,0),I=l.leftForLtr(w,y),k=kl(_.borderRadius);i.beginPath(),Object.values(k).some(F=>F!==0)?lp(i,{x:I,y:M,w:y,h:v,radius:k}):i.rect(I,M,y,v),i.fill(),O!==0&&i.stroke()}i.restore()},g=function(w,E,_){xc(i,_.text,w,E+b/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},x=this.isHorizontal(),S=this._computeTitleHeight();x?m={x:Wn(o,this.left+u,this.right-r[0]),y:this.top+u+S,line:0}:m={x:this.left+u,y:Wn(o,this.top+S+u,this.bottom-n[0].height),line:0},A$(this.ctx,t.textDirection);const C=b+u;this.legendItems.forEach((w,E)=>{i.strokeStyle=w.fontColor,i.fillStyle=w.fontColor;const _=i.measureText(w.text).width,O=l.textAlign(w.textAlign||(w.textAlign=a.textAlign)),M=y+h+_;let I=m.x,k=m.y;l.setWidth(this.width),x?E>0&&I+M+u>this.right&&(k=m.y+=C,m.line++,I=m.x=Wn(o,this.left+u,this.right-r[m.line])):E>0&&k+C>this.bottom&&(I=m.x=I+n[m.line].width+u,m.line++,k=m.y=Wn(o,this.top+S+u,this.bottom-n[m.line].height));const F=l.x(I);if(p(F,k,w),I=Qz(O,I+y+h,x?I+M:this.right,t.rtl),g(l.x(I),k,w),x)m.x+=M+u;else if(typeof w.text!="string"){const j=c.lineHeight;m.y+=Z$(w,j)+u}else m.y+=C}),L$(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=Kn(n.font),i=Hr(n.padding);if(!n.display)return;const o=ls(t.rtl,this.left,this.width),a=this.ctx,s=n.position,l=r.size/2,c=i.top+l;let u,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,f=Wn(t.align,f,this.right-h);else{const y=this.columnSizes.reduce((v,b)=>Math.max(v,b.height),0);u=c+Wn(t.align,this.top,this.bottom-y-t.labels.padding-this._computeTitleHeight())}const m=Wn(s,f,f+h);a.textAlign=o.textAlign(d0(s)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=r.string,xc(a,n.text,m,u,r)}_computeTitleHeight(){const t=this.options.title,n=Kn(t.font),r=Hr(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,i,o;if(ul(t,this.left,this.right)&&ul(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;ro.length>a.length?o:a)),t+n.size/2+r.measureText(i).width}function L6(e,t,n){let r=e;return typeof t.text!="string"&&(r=Z$(t,n)),r}function Z$(e,t){const n=e.text?e.text.length:0;return t*n}function D6(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var z6={id:"legend",_element:jx,start(e,t,n){const r=e.legend=new jx({ctx:e.ctx,options:n,chart:e});Fr.configure(e,r,n),Fr.addBox(e,r)},stop(e){Fr.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;Fr.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:o,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Hr(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:a&&(s||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class J$ extends ba{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const i=Rn(r.text)?r.text.length:1;this._padding=Hr(r.padding);const o=i*Kn(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:r,bottom:i,right:o,options:a}=this,s=a.align;let l=0,c,u,f;return this.isHorizontal()?(u=Wn(s,r,o),f=n+t,c=o-r):(a.position==="left"?(u=r+t,f=Wn(s,i,n),l=Fn*-.5):(u=o-t,f=Wn(s,n,i),l=Fn*.5),c=i-n),{titleX:u,titleY:f,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const r=Kn(n.font),o=r.lineHeight/2+this._padding.top,{titleX:a,titleY:s,maxWidth:l,rotation:c}=this._drawArgs(o);xc(t,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:d0(n.align),textBaseline:"middle",translation:[a,s]})}}function j6(e,t){const n=new J$({ctx:e.ctx,options:t,chart:e});Fr.configure(e,n,t),Fr.addBox(e,n),e.titleBlock=n}var B6={id:"title",_element:J$,start(e,t,n){j6(e,n)},stop(e){const t=e.titleBlock;Fr.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const r=e.titleBlock;Fr.configure(e,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const hl={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,o=0;for(t=0,n=e.length;ts+l)/r.size,y:i/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=Number.POSITIVE_INFINITY,o,a,s;for(o=0,a=e.length;o-1?e.split(` -`):e}function H6(e,t){const{element:n,datasetIndex:r,index:i}=t,o=e.getDatasetMeta(r).controller,{label:a,value:s}=o.getLabelAndValue(i);return{chart:e,label:a,parsed:o.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:o.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Bx(e,t){const n=e.chart.ctx,{body:r,footer:i,title:o}=e,{boxWidth:a,boxHeight:s}=t,l=Kn(t.bodyFont),c=Kn(t.titleFont),u=Kn(t.footerFont),f=o.length,h=i.length,m=r.length,y=Hr(t.padding);let v=y.height,b=0,p=r.reduce((S,C)=>S+C.before.length+C.lines.length+C.after.length,0);if(p+=e.beforeBody.length+e.afterBody.length,f&&(v+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),p){const S=t.displayColors?Math.max(s,l.lineHeight):l.lineHeight;v+=m*S+(p-m)*l.lineHeight+(p-1)*t.bodySpacing}h&&(v+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let g=0;const x=function(S){b=Math.max(b,n.measureText(S).width+g)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),g=t.displayColors?a+2+t.boxPadding:0,at(r,S=>{at(S.before,x),at(S.lines,x),at(S.after,x)}),g=0,n.font=u.string,at(e.footer,x),n.restore(),b+=y.width,{width:b,height:v}}function V6(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function W6(e,t,n,r){const{x:i,width:o}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&i+o+a>t.width||e==="right"&&i-o-a<0)return!0}function U6(e,t,n,r){const{x:i,width:o}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return r==="center"?c=i<=(s+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),W6(c,e,t,n)&&(c="center"),c}function Hx(e,t,n){const r=n.yAlign||t.yAlign||V6(e,n);return{xAlign:n.xAlign||t.xAlign||U6(e,t,n,r),yAlign:r}}function G6(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function K6(e,t,n){let{y:r,height:i}=e;return t==="top"?r+=n:t==="bottom"?r-=i+n:r-=i/2,r}function Vx(e,t,n,r){const{caretSize:i,caretPadding:o,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=i+o,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:m}=kl(a);let y=G6(t,s);const v=K6(t,l,c);return l==="center"?s==="left"?y+=c:s==="right"&&(y-=c):s==="left"?y-=Math.max(u,h)+i:s==="right"&&(y+=Math.max(f,m)+i),{x:Nr(y,0,r.width-t.width),y:Nr(v,0,r.height-t.height)}}function Ru(e,t,n){const r=Hr(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Wx(e){return di([],$i(e))}function q6(e,t,n){return ya(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Ux(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const e2={beforeTitle:Ei,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?e2[t].call(n,r):i}class fp extends ba{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,o=new z$(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=q6(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,i=ir(r,"beforeTitle",this,t),o=ir(r,"title",this,t),a=ir(r,"afterTitle",this,t);let s=[];return s=di(s,$i(i)),s=di(s,$i(o)),s=di(s,$i(a)),s}getBeforeBody(t,n){return Wx(ir(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,i=[];return at(t,o=>{const a={before:[],lines:[],after:[]},s=Ux(r,o);di(a.before,$i(ir(s,"beforeLabel",this,o))),di(a.lines,ir(s,"label",this,o)),di(a.after,$i(ir(s,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(t,n){return Wx(ir(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,i=ir(r,"beforeFooter",this,t),o=ir(r,"footer",this,t),a=ir(r,"afterFooter",this,t);let s=[];return s=di(s,$i(i)),s=di(s,$i(o)),s=di(s,$i(a)),s}_createItems(t){const n=this._active,r=this.chart.data,i=[],o=[],a=[];let s=[],l,c;for(l=0,c=n.length;lt.filter(u,f,h,r))),t.itemSort&&(s=s.sort((u,f)=>t.itemSort(u,f,r))),at(s,u=>{const f=Ux(t.callbacks,u);i.push(ir(f,"labelColor",this,u)),o.push(ir(f,"labelPointStyle",this,u)),a.push(ir(f,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const s=hl[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=Bx(this,r),c=Object.assign({},s,l),u=Hx(this.chart,r,c),f=Vx(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,i){const o=this.getCaretPosition(t,r,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=kl(s),{x:h,y:m}=t,{width:y,height:v}=n;let b,p,g,x,S,C;return o==="center"?(S=m+v/2,i==="left"?(b=h,p=b-a,x=S+a,C=S-a):(b=h+y,p=b+a,x=S-a,C=S+a),g=b):(i==="left"?p=h+Math.max(l,u)+a:i==="right"?p=h+y-Math.max(c,f)-a:p=this.caretX,o==="top"?(x=m,S=x-a,b=p-a,g=p+a):(x=m+v,S=x+a,b=p+a,g=p-a),C=x),{x1:b,x2:p,x3:g,y1:x,y2:S,y3:C}}drawTitle(t,n,r){const i=this.title,o=i.length;let a,s,l;if(o){const c=ls(r.rtl,this.x,this.width);for(t.x=Ru(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",a=Kn(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;lg!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,lp(t,{x:v,y,w:c,h:l,radius:p}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),lp(t,{x:b,y:y+1,w:c-2,h:l-2,radius:p}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(v,y,c,l),t.strokeRect(v,y,c,l),t.fillStyle=a.backgroundColor,t.fillRect(b,y+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:s,boxHeight:l,boxWidth:c,boxPadding:u}=r,f=Kn(r.bodyFont);let h=f.lineHeight,m=0;const y=ls(r.rtl,this.x,this.width),v=function(_){n.fillText(_,y.x(t.x+m),t.y+h/2),t.y+=h+o},b=y.textAlign(a);let p,g,x,S,C,w,E;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,t.x=Ru(this,b,r),n.fillStyle=r.bodyColor,at(this.beforeBody,v),m=s&&b!=="right"?a==="center"?c/2+u:c+2+u:0,S=0,w=i.length;S0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,i=r&&r.x,o=r&&r.y;if(i||o){const a=hl[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=Bx(this,t),l=Object.assign({},a,this._size),c=Hx(n,t,l),u=Vx(t,l,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=Hr(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,i,n),A$(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),L$(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,i=t.map(({datasetIndex:s,index:l})=>{const c=this.chart.getDatasetMeta(s);if(!c)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:c.data[l],index:l}}),o=!Vd(r,i),a=this._positionChanged(i,n);(o||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,r),s=this._positionChanged(a,t),l=n||!Vd(a,o)||s;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:i,options:o}=this,a=hl[o.position].call(this,t,n);return a!==!1&&(r!==a.x||i!==a.y)}}tt(fp,"positioners",hl);var X6={id:"tooltip",_element:fp,positioners:hl,afterInit(e,t,n){n&&(e.tooltip=new fp({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:e2},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Y6=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Q6(e,t,n,r){const i=e.indexOf(t);if(i===-1)return Y6(e,t,n,r);const o=e.lastIndexOf(t);return i!==o?n:i}const Z6=(e,t)=>e===null?null:Nr(Math.round(e),0,t);function Gx(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}tt(hp,"id","category"),tt(hp,"defaults",{ticks:{callback:Gx}});function J6(e,t){const n=[],{bounds:i,step:o,min:a,max:s,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:h}=e,m=o||1,y=u-1,{min:v,max:b}=t,p=!on(a),g=!on(s),x=!on(c),S=(b-v)/(f+1);let C=Y1((b-v)/y/m)*m,w,E,_,O;if(C<1e-14&&!p&&!g)return[{value:v},{value:b}];O=Math.ceil(b/C)-Math.floor(v/C),O>y&&(C=Y1(O*C/y/m)*m),on(l)||(w=Math.pow(10,l),C=Math.ceil(C*w)/w),i==="ticks"?(E=Math.floor(v/C)*C,_=Math.ceil(b/C)*C):(E=v,_=b),p&&g&&o&&jz((s-a)/o,C/1e3)?(O=Math.round(Math.min((s-a)/C,u)),C=(s-a)/O,E=a,_=s):x?(E=p?a:E,_=g?s:_,O=c-1,C=(_-E)/O):(O=(_-E)/C,Tl(O,Math.round(O),C/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Q1(C),Q1(E));w=Math.pow(10,on(l)?M:l),E=Math.round(E*w)/w,_=Math.round(_*w)/w;let I=0;for(p&&(h&&E!==a?(n.push({value:a}),Es)break;n.push({value:k})}return g&&h&&_!==s?n.length&&Tl(n[n.length-1].value,s,Kx(s,S,e))?n[n.length-1].value=s:n.push({value:s}):(!g||_===s)&&n.push({value:_}),n}function Kx(e,t,{horizontal:n,minRotation:r}){const i=Xo(r),o=(n?Math.sin(i):Math.cos(i))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class eB extends Ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return on(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=n?i:l,s=l=>o=r?o:l;if(t){const l=Eo(i),c=Eo(o);l<0&&c<0?s(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);s(o+l),t||a(i-l)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=J6(i,o);return t.bounds==="ticks"&&Bz(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const i=(r-n)/Math.max(t.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return $$(t,this.chart.options.locale,this.options.ticks.format)}}class gp extends eB{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Br(t)?t:0,this.max=Br(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Xo(this.options.ticks.minRotation),i=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}tt(gp,"id","linear"),tt(gp,"defaults",{ticks:{callback:P$.formatters.numeric}});const Kf={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},lr=Object.keys(Kf);function qx(e,t){return e-t}function Xx(e,t){if(on(t))return null;const n=e._adapter,{parser:r,round:i,isoWeekday:o}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),Br(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(yc(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,i)),+a)}function Yx(e,t,n,r){const i=lr.length;for(let o=lr.indexOf(e);o=lr.indexOf(n);o--){const a=lr[o];if(Kf[a].common&&e._adapter.diff(i,r,a)>=t-1)return a}return lr[n?lr.indexOf(n):0]}function nB(e){for(let t=lr.indexOf(e)+1,n=lr.length;t=t?n[r]:n[i];e[o]=!0}}function rB(e,t,n,r){const i=e._adapter,o=+i.startOf(t[0].value,r),a=t[t.length-1].value;let s,l;for(s=o;s<=a;s=+i.add(s,1,r))l=n[s],l>=0&&(t[l].major=!0);return t}function Zx(e,t,n){const r=[],i={},o=t.length;let a,s;for(a=0;a+t.value))}initOffsets(t=[]){let n=0,r=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Nr(n,0,a),r=Nr(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,i=this.options,o=i.time,a=o.unit||Yx(o.minUnit,n,r,this._getLabelCapacity(n)),s=it(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=yc(l)||l===!0,u={};let f=n,h,m;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const y=i.ticks.source==="data"&&this.getDataTimestamps();for(h=f,m=0;h+v)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,a=n||i[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,i){const o=this.options,a=o.ticks.callback;if(a)return Xe(a,[t,n,r],this);const s=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&s[l],f=c&&s[c],h=r[n],m=c&&f&&h&&h.major;return this._adapter.format(t,i||(m?f:u))}generateTickLabels(t){let n,r,i;for(n=0,r=t.length;n0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=Yo(e,"pos",t)),{pos:o,time:s}=e[r],{pos:a,time:l}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=Yo(e,"time",t)),{time:o,pos:s}=e[r],{time:a,pos:l}=e[i]);const c=a-o;return c?s+(l-s)*(t-o)/c:s}class Jx extends Yd{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Iu(n,this.min),this._tableRange=Iu(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,i=[],o=[];let a,s,l,c,u;for(a=0,s=t.length;a=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=i.length;ai-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(Iu(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Iu(this._table,r*this._tableRange+this._minPos,!0)}}tt(Jx,"id","timeseries"),tt(Jx,"defaults",Yd.defaults);const t2="label";function eS(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function iB(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function n2(e,t){e.labels=t}function r2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t2;const r=[];e.datasets=t.map(i=>{const o=e.datasets.find(a=>a[n]===i[n]);return!o||!i.data||r.includes(o)?{...i}:(r.push(o),Object.assign(o,i),o)})}function oB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t2;const n={labels:[],datasets:[]};return n2(n,e.labels),r2(n,e.datasets,t),n}function aB(e,t){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:o,type:a,data:s,options:l,plugins:c=[],fallbackContent:u,updateMode:f,...h}=e,m=d.useRef(null),y=d.useRef(),v=()=>{m.current&&(y.current=new Gf(m.current,{type:a,data:oB(s,o),options:l&&{...l},plugins:c}),eS(t,y.current))},b=()=>{eS(t,null),y.current&&(y.current.destroy(),y.current=null)};return d.useEffect(()=>{!i&&y.current&&l&&iB(y.current,l)},[i,l]),d.useEffect(()=>{!i&&y.current&&n2(y.current.config.data,s.labels)},[i,s.labels]),d.useEffect(()=>{!i&&y.current&&s.datasets&&r2(y.current.config.data,s.datasets,o)},[i,s.datasets]),d.useEffect(()=>{y.current&&(i?(b(),setTimeout(v)):y.current.update(f))},[i,l,s.labels,s.datasets,f]),d.useEffect(()=>{y.current&&(b(),setTimeout(v))},[a]),d.useEffect(()=>(v(),()=>b()),[]),me.createElement("canvas",Object.assign({ref:m,role:"img",height:n,width:r},h),u)}const sB=d.forwardRef(aB);function lB(e,t){return Gf.register(t),d.forwardRef((n,r)=>me.createElement(sB,Object.assign({},n,{ref:r,type:e})))}const cB=lB("line",od);function uB({currency:e,data:t}){if(!t.length)return null;const n=["Today",...Array.from({length:t[0].plan.years*12},(i,o)=>`Year ${Math.floor(o/12)} Month ${o%12+1}`)],r=t.map(i=>({label:i.platform.name,data:i.portfolioValues,borderColor:i.platform.color,backgroundColor:`${i.platform.color}70`}));return xe.jsx("div",{style:{width:"100%",height:"40rem"},children:xe.jsx(cB,{data:{labels:n,datasets:[...r,{label:"Invested Amount",data:t[0].investedValues,borderColor:"#d0d0d0",backgroundColor:"#d0d0d070",borderDash:[5,5]}]},options:{maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},elements:{point:{radius:0}},scales:{x:{ticks:{callback:(i,o)=>o%12===0?`Year ${o/12}`:""}},y:{ticks:{callback:i=>`${i.toLocaleString()} ${e}`}}},plugins:{legend:{position:"bottom"},tooltip:{itemSort:(i,o)=>o.parsed.y-i.parsed.y,callbacks:{label:i=>{const o=i.dataset.label,a=i.parsed.y;return`${o}: ${a.toLocaleString()} ${e}`}}},zoom:{zoom:{drag:{enabled:!0},wheel:{enabled:!0},pinch:{enabled:!0},mode:"x"}}}}})})}const dB=(e,t)=>{const n=(l,c,u)=>typeof l=="function"?l(e,c,u):l,r=(l,c,u)=>{const f=n(t.fees.fixedFee,c,u),h=n(t.fees.percentageFee,c,u)/100;return l*(1-h)-f},i=(l,c)=>{const f=n(t.fees.annualPercentageFee,l,c)/100/12;return l*(1-f)},o=(1+e.averageAnnualReturn/100)**.08333333333333333,a=[n(e.baseInvestment,0,0)],s=[r(e.baseInvestment,0,0)];for(let l=0;l{let n=0;e.years>=15?n=.4:e.years>=10?n=.3:e.years>=7?n=.25:e.years>=5&&(n=.2);let r=1;return t>5e6?r=.4:t>1e6?r=.6:t>5e5&&(r=.8),r*(1-n)}}},partners:{name:"Partners",color:"#5fc3d1",logo:"/platforms/partners.png",fees:{fixedFee:(e,t,n)=>{const i=(e.baseInvestment+e.monthlyInvestment*e.years*12)*.045,o=n*.4,a=i-o;return a<=0?0:n>0?Math.min(a,e.monthlyInvestment*.4):Math.min(a,e.baseInvestment*.4)},percentageFee:0,annualPercentageFee:0}},patria:{name:"Patria",color:"#f59100",logo:"/platforms/patria.png",fees:{fixedFee:0,percentageFee:.8,annualPercentageFee:0}},xtb:{name:"xtb",color:"#f73e4a",logo:"/platforms/xtb.svg",fees:{fixedFee:0,percentageFee:.5,annualPercentageFee:0}},t212:{name:"T212",color:"#00a7e1",logo:"/platforms/t212.png",fees:{fixedFee:0,percentageFee:.15,annualPercentageFee:0}},ibkr:{name:"IBKR",color:"#d91222",logo:"/platforms/ibkr.svg",fees:{fixedFee:e=>e.numberOfProducts*fB,percentageFee:.03,annualPercentageFee:0}},etoro:{name:"eToro",color:"#13c636",logo:"/platforms/etoro.svg",fees:{fixedFee:0,percentageFee:.75,annualPercentageFee:0}},nofees:{name:"0% fees",color:"#d0d0d0",fees:{fixedFee:0,percentageFee:0,annualPercentageFee:0}}};function hB(){return xe.jsxs(ji.Footer,{className:"bg-white",children:[xe.jsx("p",{className:"text-center text-sm text-gray-500 mb-3",children:"Disclaimer: This tool is for illustrative purposes only. The actual returns may vary. The tool does not take into account taxes, inflation, or other factors that may affect the investment. The tool is not investment advice."}),xe.jsxs("p",{className:"text-center text-sm text-gray-500",children:["Built with"," ",xe.jsxs("a",{href:"https://react.dev/",target:"_blank",rel:"noopener noreferrer",children:["React ",xe.jsx(sz,{})]})," ","and"," ",xe.jsxs("a",{href:"https://ant.design/",target:"_blank",rel:"noopener noreferrer",children:["Ant Design ",xe.jsx(tz,{})]}),"."]})]})}function gB(){return xe.jsx(ji.Header,{className:"flex bg-white items-center",children:xe.jsx(jv,{iconPosition:"end",icon:xe.jsx(iz,{}),href:"https://github.com/sentisso/investment-plan",target:"_blank",className:"ml-auto",children:"See this on GitHub"})})}function mB({currency:e}){const t=(n,r)=>typeof n=="function"?"Dynamic":`${n}${r}`;return xe.jsxs("div",{className:"mt-14",children:[xe.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Platform Fees"}),xe.jsx(mc,{gutter:16,className:"mb-2",children:Object.values(mp).map(n=>xe.jsx(Ko,{xs:24,sm:12,lg:8,xl:6,children:xe.jsxs(e0,{className:"mb-4",children:[n.logo?xe.jsx("img",{src:`/investment-plan${n.logo}`,draggable:"false",className:"max-w-40 max-h-8 mb-4"}):xe.jsx("h3",{className:"text-lg font-bold mb-4",children:n.name}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Fixed fee:"})," ",t(n.fees.fixedFee,e)]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Percentage fee:"})," ",t(n.fees.percentageFee,"%")]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Annual percentage fee:"})," ",t(n.fees.annualPercentageFee,"% p.a.")]})]})}))}),xe.jsxs(mc,{children:[xe.jsxs("p",{children:[xe.jsx("strong",{children:"Fixed fee:"})," Fee that is charged as a fixed amount for each investment, regardless of the amount invested."]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Percentage fee:"})," Fee that is calculated as a percentage of the investment amount. Usually a currency conversion fee.",xe.jsx("br",{}),"Example: investing $100 with a 0.75% fee will result in an actual investment of $99.25 after the fee is deducted."]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Annual percentage fee:"})," Fee that is calculated as a percentage of the total portfolio value. Fee is paid monthly as 1/12 of the annual fee.",xe.jsx("br",{}),"Example: 1.5% p.a. fee will be charged as 0.125% (1.5/12) of the total portfolio value each month."]})]})]})}function pB(){const[e,t]=d.useState({years:14,baseInvestment:3e4,monthlyInvestment:8e3,averageAnnualReturn:9.5,numberOfProducts:8}),[n]=d.useState("Kč"),r=d.useMemo(()=>{const o=[];for(const a in mp){const s=dB(e,mp[a]);o.push(s)}return o},[e]),i=(o,a)=>{t(s=>({...s,[o]:a}))};return xe.jsxs(ji,{className:"max-w-screen-xl mx-auto bg-white px-3",children:[xe.jsx(gB,{}),xe.jsxs(ji.Content,{children:[xe.jsxs("h1",{className:"text-3xl mb-10 font-bold text-center",children:["Investment Growth Over ",e.years," Years"]}),xe.jsx(uB,{data:r,currency:n}),xe.jsx(ar,{layout:"vertical",className:"mt-8",children:xe.jsxs(mc,{children:[xe.jsxs(Ko,{xs:24,md:12,children:[xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Base Investment"," ",xe.jsx(eo,{title:"The one-time investment you plan to make.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,step:1e3,value:e.baseInvestment,onChange:o=>o!=null&&i("baseInvestment",o),addonAfter:n})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Monthly Investment"," ",xe.jsx(eo,{title:"The amount of money you plan to invest each month.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,step:100,value:e.monthlyInvestment,onChange:o=>o!=null&&i("monthlyInvestment",o),addonAfter:n})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Average Annual Return"," ",xe.jsx(eo,{title:"The expected average annual return rate.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,max:100,step:.1,value:e.averageAnnualReturn,onChange:o=>o!=null&&i("averageAnnualReturn",o),addonAfter:"%"})})]}),xe.jsxs(Ko,{xs:24,lg:12,children:[xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Years investing"," ",xe.jsx(eo,{title:"The number of years you plan to invest. This also affects Portu fees.",children:xe.jsx(Aa,{})})]}),children:xe.jsxs(mc,{children:[xe.jsx(Ko,{span:12,children:xe.jsx(d4,{min:1,max:50,onChange:o=>o!=null&&i("years",o),value:e.years})}),xe.jsx(Ko,{span:4,children:xe.jsx(Fa,{min:1,max:50,value:e.years,onChange:o=>o!=null&&i("years",o)})})]})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Number of investment products"," ",xe.jsx(eo,{title:"The number of investment products you plan to have in your portfolio (e.g. number of ETFs). This affects the IBKR fee.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:1,step:1,value:e.numberOfProducts,onChange:o=>o!=null&&i("numberOfProducts",o)})})]})]})}),xe.jsx(mB,{currency:n})]}),xe.jsx(hB,{})]})}var i2={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 +`):e}function H6(e,t){const{element:n,datasetIndex:r,index:i}=t,o=e.getDatasetMeta(r).controller,{label:a,value:s}=o.getLabelAndValue(i);return{chart:e,label:a,parsed:o.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:o.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function Bx(e,t){const n=e.chart.ctx,{body:r,footer:i,title:o}=e,{boxWidth:a,boxHeight:s}=t,l=Kn(t.bodyFont),c=Kn(t.titleFont),u=Kn(t.footerFont),f=o.length,h=i.length,m=r.length,y=Hr(t.padding);let v=y.height,b=0,p=r.reduce((S,C)=>S+C.before.length+C.lines.length+C.after.length,0);if(p+=e.beforeBody.length+e.afterBody.length,f&&(v+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),p){const S=t.displayColors?Math.max(s,l.lineHeight):l.lineHeight;v+=m*S+(p-m)*l.lineHeight+(p-1)*t.bodySpacing}h&&(v+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let g=0;const x=function(S){b=Math.max(b,n.measureText(S).width+g)};return n.save(),n.font=c.string,at(e.title,x),n.font=l.string,at(e.beforeBody.concat(e.afterBody),x),g=t.displayColors?a+2+t.boxPadding:0,at(r,S=>{at(S.before,x),at(S.lines,x),at(S.after,x)}),g=0,n.font=u.string,at(e.footer,x),n.restore(),b+=y.width,{width:b,height:v}}function V6(e,t){const{y:n,height:r}=t;return ne.height-r/2?"bottom":"center"}function W6(e,t,n,r){const{x:i,width:o}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&i+o+a>t.width||e==="right"&&i-o-a<0)return!0}function U6(e,t,n,r){const{x:i,width:o}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return r==="center"?c=i<=(s+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),W6(c,e,t,n)&&(c="center"),c}function Hx(e,t,n){const r=n.yAlign||t.yAlign||V6(e,n);return{xAlign:n.xAlign||t.xAlign||U6(e,t,n,r),yAlign:r}}function G6(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function K6(e,t,n){let{y:r,height:i}=e;return t==="top"?r+=n:t==="bottom"?r-=i+n:r-=i/2,r}function Vx(e,t,n,r){const{caretSize:i,caretPadding:o,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=i+o,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:m}=kl(a);let y=G6(t,s);const v=K6(t,l,c);return l==="center"?s==="left"?y+=c:s==="right"&&(y-=c):s==="left"?y-=Math.max(u,h)+i:s==="right"&&(y+=Math.max(f,m)+i),{x:Nr(y,0,r.width-t.width),y:Nr(v,0,r.height-t.height)}}function Ru(e,t,n){const r=Hr(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function Wx(e){return di([],$i(e))}function q6(e,t,n){return ya(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Ux(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const e2={beforeTitle:Ei,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex"u"?e2[t].call(n,r):i}class fp extends ba{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,o=new z$(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=q6(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,i=ir(r,"beforeTitle",this,t),o=ir(r,"title",this,t),a=ir(r,"afterTitle",this,t);let s=[];return s=di(s,$i(i)),s=di(s,$i(o)),s=di(s,$i(a)),s}getBeforeBody(t,n){return Wx(ir(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,i=[];return at(t,o=>{const a={before:[],lines:[],after:[]},s=Ux(r,o);di(a.before,$i(ir(s,"beforeLabel",this,o))),di(a.lines,ir(s,"label",this,o)),di(a.after,$i(ir(s,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(t,n){return Wx(ir(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,i=ir(r,"beforeFooter",this,t),o=ir(r,"footer",this,t),a=ir(r,"afterFooter",this,t);let s=[];return s=di(s,$i(i)),s=di(s,$i(o)),s=di(s,$i(a)),s}_createItems(t){const n=this._active,r=this.chart.data,i=[],o=[],a=[];let s=[],l,c;for(l=0,c=n.length;lt.filter(u,f,h,r))),t.itemSort&&(s=s.sort((u,f)=>t.itemSort(u,f,r))),at(s,u=>{const f=Ux(t.callbacks,u);i.push(ir(f,"labelColor",this,u)),o.push(ir(f,"labelPointStyle",this,u)),a.push(ir(f,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const s=hl[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=Bx(this,r),c=Object.assign({},s,l),u=Hx(this.chart,r,c),f=Vx(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,i){const o=this.getCaretPosition(t,r,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=kl(s),{x:h,y:m}=t,{width:y,height:v}=n;let b,p,g,x,S,C;return o==="center"?(S=m+v/2,i==="left"?(b=h,p=b-a,x=S+a,C=S-a):(b=h+y,p=b+a,x=S-a,C=S+a),g=b):(i==="left"?p=h+Math.max(l,u)+a:i==="right"?p=h+y-Math.max(c,f)-a:p=this.caretX,o==="top"?(x=m,S=x-a,b=p-a,g=p+a):(x=m+v,S=x+a,b=p+a,g=p-a),C=x),{x1:b,x2:p,x3:g,y1:x,y2:S,y3:C}}drawTitle(t,n,r){const i=this.title,o=i.length;let a,s,l;if(o){const c=ls(r.rtl,this.x,this.width);for(t.x=Ru(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",a=Kn(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;lg!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,lp(t,{x:v,y,w:c,h:l,radius:p}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),lp(t,{x:b,y:y+1,w:c-2,h:l-2,radius:p}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(v,y,c,l),t.strokeRect(v,y,c,l),t.fillStyle=a.backgroundColor,t.fillRect(b,y+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:s,boxHeight:l,boxWidth:c,boxPadding:u}=r,f=Kn(r.bodyFont);let h=f.lineHeight,m=0;const y=ls(r.rtl,this.x,this.width),v=function(_){n.fillText(_,y.x(t.x+m),t.y+h/2),t.y+=h+o},b=y.textAlign(a);let p,g,x,S,C,w,E;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,t.x=Ru(this,b,r),n.fillStyle=r.bodyColor,at(this.beforeBody,v),m=s&&b!=="right"?a==="center"?c/2+u:c+2+u:0,S=0,w=i.length;S0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,i=r&&r.x,o=r&&r.y;if(i||o){const a=hl[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=Bx(this,t),l=Object.assign({},a,this._size),c=Hx(n,t,l),u=Vx(t,l,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=Hr(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,i,n),A$(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),L$(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,i=t.map(({datasetIndex:s,index:l})=>{const c=this.chart.getDatasetMeta(s);if(!c)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:c.data[l],index:l}}),o=!Vd(r,i),a=this._positionChanged(i,n);(o||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,r),s=this._positionChanged(a,t),l=n||!Vd(a,o)||s;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:i,options:o}=this,a=hl[o.position].call(this,t,n);return a!==!1&&(r!==a.x||i!==a.y)}}tt(fp,"positioners",hl);var X6={id:"tooltip",_element:fp,positioners:hl,afterInit(e,t,n){n&&(e.tooltip=new fp({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:e2},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Y6=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function Q6(e,t,n,r){const i=e.indexOf(t);if(i===-1)return Y6(e,t,n,r);const o=e.lastIndexOf(t);return i!==o?n:i}const Z6=(e,t)=>e===null?null:Nr(Math.round(e),0,t);function Gx(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}tt(hp,"id","category"),tt(hp,"defaults",{ticks:{callback:Gx}});function J6(e,t){const n=[],{bounds:i,step:o,min:a,max:s,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:h}=e,m=o||1,y=u-1,{min:v,max:b}=t,p=!on(a),g=!on(s),x=!on(c),S=(b-v)/(f+1);let C=Y1((b-v)/y/m)*m,w,E,_,O;if(C<1e-14&&!p&&!g)return[{value:v},{value:b}];O=Math.ceil(b/C)-Math.floor(v/C),O>y&&(C=Y1(O*C/y/m)*m),on(l)||(w=Math.pow(10,l),C=Math.ceil(C*w)/w),i==="ticks"?(E=Math.floor(v/C)*C,_=Math.ceil(b/C)*C):(E=v,_=b),p&&g&&o&&jz((s-a)/o,C/1e3)?(O=Math.round(Math.min((s-a)/C,u)),C=(s-a)/O,E=a,_=s):x?(E=p?a:E,_=g?s:_,O=c-1,C=(_-E)/O):(O=(_-E)/C,Tl(O,Math.round(O),C/1e3)?O=Math.round(O):O=Math.ceil(O));const M=Math.max(Q1(C),Q1(E));w=Math.pow(10,on(l)?M:l),E=Math.round(E*w)/w,_=Math.round(_*w)/w;let I=0;for(p&&(h&&E!==a?(n.push({value:a}),Es)break;n.push({value:k})}return g&&h&&_!==s?n.length&&Tl(n[n.length-1].value,s,Kx(s,S,e))?n[n.length-1].value=s:n.push({value:s}):(!g||_===s)&&n.push({value:_}),n}function Kx(e,t,{horizontal:n,minRotation:r}){const i=Xo(r),o=(n?Math.sin(i):Math.cos(i))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class eB extends Ns{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return on(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=n?i:l,s=l=>o=r?o:l;if(t){const l=Eo(i),c=Eo(o);l<0&&c<0?s(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);s(o+l),t||a(i-l)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=J6(i,o);return t.bounds==="ticks"&&Bz(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const i=(r-n)/Math.max(t.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return $$(t,this.chart.options.locale,this.options.ticks.format)}}class gp extends eB{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Br(t)?t:0,this.max=Br(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=Xo(this.options.ticks.minRotation),i=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}tt(gp,"id","linear"),tt(gp,"defaults",{ticks:{callback:P$.formatters.numeric}});const Kf={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},lr=Object.keys(Kf);function qx(e,t){return e-t}function Xx(e,t){if(on(t))return null;const n=e._adapter,{parser:r,round:i,isoWeekday:o}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),Br(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(yc(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,i)),+a)}function Yx(e,t,n,r){const i=lr.length;for(let o=lr.indexOf(e);o=lr.indexOf(n);o--){const a=lr[o];if(Kf[a].common&&e._adapter.diff(i,r,a)>=t-1)return a}return lr[n?lr.indexOf(n):0]}function nB(e){for(let t=lr.indexOf(e)+1,n=lr.length;t=t?n[r]:n[i];e[o]=!0}}function rB(e,t,n,r){const i=e._adapter,o=+i.startOf(t[0].value,r),a=t[t.length-1].value;let s,l;for(s=o;s<=a;s=+i.add(s,1,r))l=n[s],l>=0&&(t[l].major=!0);return t}function Zx(e,t,n){const r=[],i={},o=t.length;let a,s;for(a=0;a+t.value))}initOffsets(t=[]){let n=0,r=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Nr(n,0,a),r=Nr(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,i=this.options,o=i.time,a=o.unit||Yx(o.minUnit,n,r,this._getLabelCapacity(n)),s=it(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=yc(l)||l===!0,u={};let f=n,h,m;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,c?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const y=i.ticks.source==="data"&&this.getDataTimestamps();for(h=f,m=0;h+v)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,a=n||i[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,i){const o=this.options,a=o.ticks.callback;if(a)return Xe(a,[t,n,r],this);const s=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&s[l],f=c&&s[c],h=r[n],m=c&&f&&h&&h.major;return this._adapter.format(t,i||(m?f:u))}generateTickLabels(t){let n,r,i;for(n=0,r=t.length;n0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=Yo(e,"pos",t)),{pos:o,time:s}=e[r],{pos:a,time:l}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=Yo(e,"time",t)),{time:o,pos:s}=e[r],{time:a,pos:l}=e[i]);const c=a-o;return c?s+(l-s)*(t-o)/c:s}class Jx extends Yd{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Iu(n,this.min),this._tableRange=Iu(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,i=[],o=[];let a,s,l,c,u;for(a=0,s=t.length;a=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=i.length;ai-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(Iu(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return Iu(this._table,r*this._tableRange+this._minPos,!0)}}tt(Jx,"id","timeseries"),tt(Jx,"defaults",Yd.defaults);const t2="label";function eS(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function iB(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function n2(e,t){e.labels=t}function r2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t2;const r=[];e.datasets=t.map(i=>{const o=e.datasets.find(a=>a[n]===i[n]);return!o||!i.data||r.includes(o)?{...i}:(r.push(o),Object.assign(o,i),o)})}function oB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t2;const n={labels:[],datasets:[]};return n2(n,e.labels),r2(n,e.datasets,t),n}function aB(e,t){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:o,type:a,data:s,options:l,plugins:c=[],fallbackContent:u,updateMode:f,...h}=e,m=d.useRef(null),y=d.useRef(),v=()=>{m.current&&(y.current=new Gf(m.current,{type:a,data:oB(s,o),options:l&&{...l},plugins:c}),eS(t,y.current))},b=()=>{eS(t,null),y.current&&(y.current.destroy(),y.current=null)};return d.useEffect(()=>{!i&&y.current&&l&&iB(y.current,l)},[i,l]),d.useEffect(()=>{!i&&y.current&&n2(y.current.config.data,s.labels)},[i,s.labels]),d.useEffect(()=>{!i&&y.current&&s.datasets&&r2(y.current.config.data,s.datasets,o)},[i,s.datasets]),d.useEffect(()=>{y.current&&(i?(b(),setTimeout(v)):y.current.update(f))},[i,l,s.labels,s.datasets,f]),d.useEffect(()=>{y.current&&(b(),setTimeout(v))},[a]),d.useEffect(()=>(v(),()=>b()),[]),me.createElement("canvas",Object.assign({ref:m,role:"img",height:n,width:r},h),u)}const sB=d.forwardRef(aB);function lB(e,t){return Gf.register(t),d.forwardRef((n,r)=>me.createElement(sB,Object.assign({},n,{ref:r,type:e})))}const cB=lB("line",od);function uB({currency:e,data:t}){if(!t.length)return null;const n=["Today",...Array.from({length:t[0].plan.years*12},(i,o)=>`Year ${Math.floor(o/12)} Month ${o%12+1}`)],r=t.map(i=>({label:i.platform.name,data:i.portfolioValues,borderColor:i.platform.color,backgroundColor:`${i.platform.color}70`}));return xe.jsx("div",{style:{width:"100%",height:"40rem"},children:xe.jsx(cB,{data:{labels:n,datasets:[...r,{label:"Invested Amount",data:t[0].investedValues,borderColor:"#d0d0d0",backgroundColor:"#d0d0d070",borderDash:[5,5]}]},options:{maintainAspectRatio:!1,animation:!1,interaction:{intersect:!1,mode:"index"},elements:{point:{radius:0}},scales:{x:{ticks:{callback:(i,o)=>o%12===0?`Year ${o/12}`:""}},y:{ticks:{callback:i=>`${i.toLocaleString()} ${e}`}}},plugins:{legend:{position:"bottom"},tooltip:{itemSort:(i,o)=>o.parsed.y-i.parsed.y,callbacks:{label:i=>{const o=i.dataset.label,a=i.parsed.y;return`${o}: ${a.toLocaleString()} ${e}`}}},zoom:{zoom:{drag:{enabled:!0},wheel:{enabled:!0},pinch:{enabled:!0},mode:"x"}}}}})})}const dB=(e,t)=>{const n=(l,c,u)=>typeof l=="function"?l(e,c,u):l,r=(l,c,u)=>{const f=n(t.fees.fixedFee,c,u),h=n(t.fees.percentageFee,c,u)/100;return l*(1-h)-f},i=(l,c)=>{const f=n(t.fees.annualPercentageFee,l,c)/100/12;return l*(1-f)},o=(1+e.averageAnnualReturn/100)**.08333333333333333,a=[n(e.baseInvestment,0,0)],s=[r(e.baseInvestment,0,0)];for(let l=0;l{let n=0;e.years>=15?n=.4:e.years>=10?n=.3:e.years>=7?n=.25:e.years>=5&&(n=.2);let r=1;return t>5e6?r=.4:t>1e6?r=.6:t>5e5&&(r=.8),r*(1-n)}}},partners:{name:"Partners",color:"#5fc3d1",logo:"/platforms/partners.png",fees:{fixedFee:(e,t,n)=>{const i=(e.baseInvestment+e.monthlyInvestment*e.years*12)*.045,o=n*.4,a=i-o;return a<=0?0:n>0?Math.min(a,e.monthlyInvestment*.4):Math.min(a,e.baseInvestment*.4)},percentageFee:0,annualPercentageFee:0}},patria:{name:"Patria",color:"#f59100",logo:"/platforms/patria.png",fees:{fixedFee:0,percentageFee:.8,annualPercentageFee:0}},xtb:{name:"xtb",color:"#f73e4a",logo:"/platforms/xtb.svg",fees:{fixedFee:0,percentageFee:.5,annualPercentageFee:0}},t212:{name:"T212",color:"#00a7e1",logo:"/platforms/t212.png",fees:{fixedFee:0,percentageFee:.15,annualPercentageFee:0}},ibkr:{name:"IBKR",color:"#d91222",logo:"/platforms/ibkr.svg",fees:{fixedFee:e=>e.numberOfProducts*fB,percentageFee:.03,annualPercentageFee:0}},etoro:{name:"eToro",color:"#13c636",logo:"/platforms/etoro.svg",fees:{fixedFee:0,percentageFee:.75,annualPercentageFee:0}},nofees:{name:"0% fees",color:"#d0d0d0",fees:{fixedFee:0,percentageFee:0,annualPercentageFee:0}}};function hB(){return xe.jsxs(ji.Footer,{className:"bg-white",children:[xe.jsx("p",{className:"text-center text-sm text-gray-500 mb-3",children:"Disclaimer: This tool is for illustrative purposes only. The actual returns may vary. The tool does not take into account taxes, inflation, or other factors that may affect the investment. The tool is not investment advice."}),xe.jsxs("p",{className:"text-center text-sm text-gray-500",children:["Built with"," ",xe.jsxs("a",{href:"https://react.dev/",target:"_blank",rel:"noopener noreferrer",children:["React ",xe.jsx(sz,{})]})," ","and"," ",xe.jsxs("a",{href:"https://ant.design/",target:"_blank",rel:"noopener noreferrer",children:["Ant Design ",xe.jsx(tz,{})]}),"."]})]})}function gB(){return xe.jsx(ji.Header,{className:"flex bg-white items-center",children:xe.jsx(jv,{iconPosition:"end",icon:xe.jsx(iz,{}),href:"https://github.com/sentisso/investment-plan",target:"_blank",className:"ml-auto",children:"See this on GitHub"})})}function mB({currency:e}){const t=(n,r)=>typeof n=="function"?"Dynamic":`${n}${r}`;return xe.jsxs("div",{className:"mt-14",children:[xe.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Platform Fees"}),xe.jsx(mc,{gutter:16,className:"mb-2",children:Object.values(mp).map(n=>xe.jsx(Ko,{xs:24,sm:12,lg:8,xl:6,children:xe.jsxs(e0,{className:"mb-4",children:[n.logo?xe.jsx("img",{src:`/investment-plan${n.logo}`,draggable:"false",className:"max-w-40 max-h-8 mb-4"}):xe.jsx("h3",{className:"text-lg font-bold mb-4",children:n.name}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Fixed fee:"})," ",t(n.fees.fixedFee,e)]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Percentage fee:"})," ",t(n.fees.percentageFee,"%")]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Annual percentage fee:"})," ",t(n.fees.annualPercentageFee,"% p.a.")]})]})}))}),xe.jsxs(mc,{children:[xe.jsxs("p",{children:[xe.jsx("strong",{children:"Fixed fee:"})," Fee that is charged as a fixed amount for each investment, regardless of the amount invested."]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Percentage fee:"})," Fee that is calculated as a percentage of the investment amount. Usually a currency conversion fee.",xe.jsx("br",{}),"Example: investing $100 with a 0.75% fee will result in an actual investment of $99.25 after the fee is deducted."]}),xe.jsxs("p",{children:[xe.jsx("strong",{children:"Annual percentage fee:"})," Fee that is calculated as a percentage of the total portfolio value. Fee is paid monthly as 1/12 of the annual fee.",xe.jsx("br",{}),"Example: 1.5% p.a. fee will be charged as 0.125% (1.5/12) of the total portfolio value each month."]})]})]})}function pB(){const[e,t]=d.useState({years:14,baseInvestment:3e4,monthlyInvestment:8e3,averageAnnualReturn:9.5,numberOfProducts:8}),[n]=d.useState("Kč"),r=d.useMemo(()=>{const o=[];for(const a in mp){const s=dB(e,mp[a]);o.push(s)}return o},[e]),i=(o,a)=>{t(s=>({...s,[o]:a}))};return xe.jsxs(ji,{className:"max-w-screen-xl mx-auto bg-white px-3",children:[xe.jsx(gB,{}),xe.jsxs(ji.Content,{children:[xe.jsxs("h1",{className:"text-3xl mb-10 font-bold text-center",children:["Investment Growth Over ",e.years," Years"]}),xe.jsx(uB,{data:r,currency:n}),xe.jsx(ar,{layout:"vertical",className:"mt-8",children:xe.jsxs(mc,{children:[xe.jsxs(Ko,{xs:24,md:12,children:[xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Base Investment"," ",xe.jsx(eo,{title:"The one-time investment you plan to make.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,step:1e3,value:e.baseInvestment,onChange:o=>o!=null&&i("baseInvestment",o),addonAfter:n})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Monthly Investment"," ",xe.jsx(eo,{title:"The amount of money you plan to invest each month.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,step:100,value:e.monthlyInvestment,onChange:o=>o!=null&&i("monthlyInvestment",o),addonAfter:n})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Average Annual Return"," ",xe.jsx(eo,{title:"Portfolio value is calculated each month based on the annual return.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:0,max:100,step:.1,value:e.averageAnnualReturn,onChange:o=>o!=null&&i("averageAnnualReturn",o),addonAfter:"%"})})]}),xe.jsxs(Ko,{xs:24,lg:12,children:[xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Years investing"," ",xe.jsx(eo,{title:"The number of years you plan to invest. This also affects Portu fees.",children:xe.jsx(Aa,{})})]}),children:xe.jsxs(mc,{children:[xe.jsx(Ko,{span:12,children:xe.jsx(d4,{min:1,max:50,onChange:o=>o!=null&&i("years",o),value:e.years})}),xe.jsx(Ko,{span:4,children:xe.jsx(Fa,{min:1,max:50,value:e.years,onChange:o=>o!=null&&i("years",o)})})]})}),xe.jsx(ar.Item,{label:xe.jsxs("span",{children:["Number of investment products"," ",xe.jsx(eo,{title:"The number of investment products you plan to have in your portfolio (e.g. number of ETFs). This affects the IBKR fee.",children:xe.jsx(Aa,{})})]}),children:xe.jsx(Fa,{min:1,step:1,value:e.numberOfProducts,onChange:o=>o!=null&&i("numberOfProducts",o)})})]})]})}),xe.jsx(mB,{currency:n})]}),xe.jsx(hB,{})]})}var i2={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; diff --git a/index.html b/index.html index e1b41ef..1ad9913 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Investment Plan - +