(this["webpackJsonpetf-vis"]=this["webpackJsonpetf-vis"]||[]).push([[0],{160:function(t,e,i){},166:function(t,e,i){"use strict";i.r(e);var a=i(14),n=i.n(a),s=i(51),r=i.n(s),o=(i(160),i(11)),l=i.n(o),d=i(3),h=i(17),c=i(1),u=i(4),f=i(5),v=i(15),p=i(7),x=i(8),y=i(9),b=i(2),g=i(35),m=i.n(g),S=i(6),j=864e5,O=12;function T(t){return Number.isNaN(t)?0:t/100}function I(t){return!Number.isNaN(t)&&t>=0&&t<=100}function C(t){return 0===t.getMonth()}function w(t,e){return P.apply(this,arguments)}function P(){return(P=Object(h.a)(l.a.mark((function t(e,i){var a;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,S.d("https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY_ADJUSTED&symbol=".concat(e,"&apikey=").concat(i,"&datatype=csv"),(function(t){if(void 0===t.timestamp||void 0===t["dividend amount"]||void 0===t["adjusted close"])throw new Error("The history of ".concat(e," contained an undefined field."));return{date:new Date(t.timestamp.toString()),dividend:parseFloat(t["dividend amount"]),course:parseFloat(t["adjusted close"])}}));case 2:return(a=t.sent).sort((function(t,e){return t.date.valueOf()-e.date.valueOf()})),t.abrupt("return",a);case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function D(t){return t.map((function(t){return[F(t.date),t.course]}))}function A(t){var e=t[0].date.getFullYear(),i=[[e,0]];return t.forEach((function(t){t.date.getFullYear()===e?i[i.length-1][1]+=t.dividend:(e=t.date.getFullYear(),i.push([e,t.dividend]))})),i.sort((function(t,e){return t[0]-e[0]})),i}function F(t){return Math.floor(t.getTime()/j)}function k(t){return new Error("First call loadHistoricalDataIfNotPresent() before predicting: ".concat(t))}function M(t){var e,i,a=t.getDate(),n=(e=t.getMonth(),i=t.getFullYear(),new Date(i,e+1,0).getDate()),s=Math.round(a/n);return new Date(t.getFullYear(),t.getMonth()+s)}var V=function(){function t(){Object(u.a)(this,t),this.historicalData={},this.coursePredictors={},this.dividendPredictors={}}return Object(f.a)(t,[{key:"_loadAndCacheHistoricalETFData",value:function(){var e=Object(h.a)(l.a.mark((function e(i){var a,n,s,r,o;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i in this.historicalData)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,w(i,t.apiKey);case 4:a=e.sent,n=D(a),s=t._calculateTimestampForPredictorRepetition(n),r=A(a),o=t._calculateTimestampForPredictorRepetition(r),this.historicalData[i]={history:a,courseForecastArray:n,dividendForecastArray:r},this.coursePredictors[i]={maxTimestampBeforeCoursePredictorRepetition:s,predictors:{}},this.dividendPredictors[i]={maxYearBeforeDividendPredictorRepetition:o,predictors:{}};case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_createCoursePredictorIfNotPresent",value:function(e,i){if(!(i in this.coursePredictors[e])){var a=this.historicalData[e].courseForecastArray,n=a[a.length-1][0]-Math.abs(a[a.length-1][0]-i)*t.backCastTimeFactor-t.backCastTimestampConstant,s=a.filter((function(t){return t[0]>=n}));this.coursePredictors[e].predictors[i]=m.a.linear(s,{order:2,precision:20})}}},{key:"_courseDateToPredictorTimestampAndDateTimestamp",value:function(t,e){var i=F(t);return[i>this.coursePredictors[e].maxTimestampBeforeCoursePredictorRepetition?this.coursePredictors[e].maxTimestampBeforeCoursePredictorRepetition:i,i]}},{key:"_createDividendPredictorIfNotPresent",value:function(e,i){if(!(i in this.dividendPredictors[e])){var a=this.historicalData[e].dividendForecastArray,n=a[a.length-1][0]-Math.abs(a[a.length-1][0]-i)*t.backCastTimeFactor-t.backCastTimestampConstant,s=a.filter((function(t){return t[0]>=n}));this.dividendPredictors[e].predictors[i]=m.a.linear(s,{order:2,precision:20})}}},{key:"_dividendYearToPredictorYear",value:function(t,e){return this.dividendPredictors[t].maxYearBeforeDividendPredictorRepetition1&&void 0!==arguments[1]?arguments[1]:2,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:7;t.apiKey=e,t.backCastTimeFactor=i;var n=new Date(0);if(n.setMonth(a),t.backCastTimestampConstant=F(n),null!=t.instance){var s=t.getInstance();for(var r in s.coursePredictors)s.coursePredictors[r].maxTimestampBeforeCoursePredictorRepetition=t._calculateTimestampForPredictorRepetition(s.historicalData[r].courseForecastArray);for(var o in s.dividendPredictors)s.dividendPredictors[o].maxYearBeforeDividendPredictorRepetition=t._calculateTimestampForPredictorRepetition(s.historicalData[o].dividendForecastArray)}}},{key:"loadHistoricData",value:function(){var e=Object(h.a)(l.a.mark((function e(i,a){var n,s;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.configure(i),n=t.getInstance(),e.t0=l.a.keys(a);case 3:if((e.t1=e.t0()).done){e.next=9;break}return s=e.t1.value,e.next=7,n._loadAndCacheHistoricalETFData(a[s].symbol);case 7:e.next=3;break;case 9:console.log("Finished loading the historic data.");case 10:case"end":return e.stop()}}),e)})));return function(t,i){return e.apply(this,arguments)}}()},{key:"getInstance",value:function(){return null==t.instance&&(t.instance=new t),t.instance}},{key:"_calculateTimestampForPredictorRepetition",value:function(e){var i=e[0][0],a=e[e.length-1][0];return a+(a-i)/t.backCastTimeFactor}}]),t}();V.instance=null,V.apiKey="",V.backCastTimestampConstant=7,V.backCastTimeFactor=2;var E=i(25),_=i.n(E),N=.7,L=.26375;function z(t,e){return e.totalShares[t]*e.sharePrices[t]}function Y(t,e){return e.dividendTotalShares[t]*e.sharePrices[t]}function R(t,e){return e.newShares[t]*e.sharePrices[t]}function G(t){var e,i=0,a=Object(b.a)(Object.keys(t.newPayout));try{for(a.s();!(e=a.n()).done;){var n=e.value;i+=t.newPayout[n]}}catch(s){a.e(s)}finally{a.f()}return i}function W(t){var e=new Date(t);return e.setMonth(t.getMonth()+1),e}function B(t,e,i,a){if(function(t){return 11===t.getMonth()}(e)){var n=V.getInstance().predictDividend(t,e.getFullYear()),s=V.getInstance().predictCourse(t,e,i,a);return n>0?n:.025*s}return 0}function U(t,e){var i=t*e.percentageCosts+e.fixedCosts,a=Math.max(t-i,0);return[a,i=t-a]}function H(t,e){return[Math.max(0,t-e),Math.max(0,e-t)]}function K(t){var e,i=0,a=Object(b.a)(Object.keys(t.totalShares));try{for(a.s();!(e=a.n()).done;){i+=z(e.value,t)}}catch(n){a.e(n)}finally{a.f()}return i}function q(t,e){var i=K(t),a=t.date,n=a.getFullYear()-e.getFullYear()+(a.getMonth()-e.getMonth())/O;t.inflation=i-i*Math.pow(.99,n)}function J(t,e,i){var a=Math.floor(i/O);return t*Math.pow(1+e,a)}function Z(t,e,i,a){if(!C(e)||t.length<2)return[0,i];var n,s,r,o,l=0,d=t[t.length-1],h=t.length-O>1?t[t.length-O]:t[1],c=Object(b.a)(Object.keys(a));try{for(c.s();!(n=c.n()).done;){for(var u=n.value,f=d.distributingNewAmount[u],v=z(u,h)*(O-h.date.getMonth())/O,p=1;p0;p++){v+=R(u,t[t.length-p])*p/O}if(!(f>=(v*=.0049))){var x=z(u,d)-d.totalInvestedMoney[u],g=0;t.length>O&&(g=Math.max(0,z(u,t[t.length-1-O])-t[t.length-1-O].totalInvestedMoney[u]));var m=(s=x-g,r=0,o=v,Math.max(r,Math.min(s,o))),S=H(m,i),j=Object(y.a)(S,2);m=j[0],i=j[1],l+=m*N*L}}}catch(T){c.e(T)}finally{c.f()}return[l,i]}function $(t,e,i,a,n,s,r,o){C(i)&&(r=s.taxFreeAmount);var l=0,d=t[t.length-1],h=_()(d);h.date=i,h.newInvestment=0;var c,u=Object(b.a)(Object.keys(n));try{for(u.s();!(c=u.n()).done;){var f=c.value,v=n[f]*e;h.newInvestment+=v;var p=U(v,s.costConfig),x=Object(y.a)(p,2),g=x[0];l+=x[1],h.newInvestedMoney[f]=g,h.totalInvestedMoney[f]+=g;var m=V.getInstance().predictCourse(f,i,s.confidence,a),S=g/m;h.sharePrices[f]=m,h.newShares[f]=S;var j=B(f,i,s.confidence,a),O=h.totalShares[f]*j;if(o){h.distributingNewAmount[f]=O;var T,I=O,w=H(I,r),P=Object(y.a)(w,2);T=P[0],r=P[1];var D=T*N*L;h.totalTaxes+=D,O=I-D}var A=O/m;h.newShares[f]+=A,o||(h.dividendNewShares[f]=A,h.dividendTotalShares[f]+=A),h.totalShares[f]+=h.newShares[f],h.newPayout[f]=0}}catch(M){u.e(M)}finally{u.f()}h.totalCosts+=l;var F=Z(t,i,s.taxFreeAmount,n),k=Object(y.a)(F,1)[0];return h.totalTaxes+=k,q(h,a),t.push(h),r}function Q(t,e,i,a,n,s,r,o,l,d){C(a)&&(o=s.taxFreeAmount);var h=0,c=0,u=t[t.length-1],f=_()(u);f.date=a,f.newInvestment=0;var v,p=Object(b.a)(Object.keys(i));try{for(p.s();!(v=p.n()).done;){var x=v.value,g=V.getInstance().predictCourse(x,a,s.confidence,n),m=i[x]*e;f.sharePrices[x]=g,f.newPayout[x]=0,f.newInvestedMoney[x]=0;var S=B(x,a,s.confidence,n),j=f.totalShares[x]*S;if(d){f.distributingNewAmount[x]=j;var O,T=j,I=H(T,o),w=Object(y.a)(I,2);O=w[0],o=w[1];var P=O*N*L,D=H(P,r),A=Object(y.a)(D,2);P=A[0],r=A[1],f.totalTaxes+=P;var F=T-P;f.distributingAmountUsableForPayout[x]=F,f.newShares[x]=0}else{var k=j/g;f.newShares[x]=k,f.totalShares[x]+=k,f.dividendNewShares[x]=k,f.dividendTotalShares[x]+=k}var M=Math.min(m,f.distributingAmountUsableForPayout[x]);m-=M,f.distributingAmountUsableForPayout[x]-=M,f.newPayout[x]+=M;var E=0;if(l[x].investmentStepsIdx0){for(var z=U(m,s.costConfig)[1],Y=0,R=l[x].investmentStepsIdx,G=t[R].newShares[x]-l[x].alreadySoldShares;R=m)break}h+=Y,l[x].investmentStepsIdx=R,l[x].alreadySoldShares=R3&&void 0!==arguments[3]?arguments[3]:10,n=e-t,s=new Date,r=new Date(s.getFullYear(),s.getMonth()+1),o=new Date(r);o.setFullYear(r.getFullYear()+i);var l=new Date(r);return l.setFullYear(r.getFullYear()+n+a),[r,o,l]}(this.age,this.expectationOfLife,this.savingPhaseLength),e=Object(y.a)(t,3),i=e[0],a=e[1],n=e[2],s=[],r=i;r6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1100,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:300,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:250,c=arguments.length>10&&void 0!==arguments[10]?arguments[10]:40;if(Object(u.a)(this,t),this.tooltipDate=void 0,this.yExtent=void 0,this.textProperties={},this.lineStrokeWidth=3,this.contentOpacity=.65,this.valueTextOffset=200,this.standardFontSize=18,this.labelValueIdentifier="value",this.deltaIdentifier="delta",this.monospaceFont="monospace",this.standardFont=null,this.startTextAnchor="start",this.endTextAnchor="end",this.boldText="bold",this.normalText="normal",this.totalColor="#b59554",this.totalIdentifier="total",this.investmentSteps=void 0,this.dateExtent=[new Date,new Date],this.marginW=void 0,this.marginH=void 0,this.width=void 0,this.height=void 0,this.maxIndex=0,this.minIndex=0,this.xTextOffset=void 0,this.yScale=S.k(),this.xScale=S.l(),this.dataArray=[],this.payoutPhaseStartDate=void 0,this.svg=void 0,this.fadeOutGradientID="fadeOutGradient",this.fadeOutYearsLength=10,this.gridOpacity=.2,this.gridColor="grey",this.gridStrokeWidth=2,this.labelDivisionFactor=1,this.numberIndicator="K",this.hoverLine=void 0,this.interaction=void 0,this.textGroup=void 0,this.xAxis=void 0,this.yAxis=void 0,this.constructor===t)throw new Error("Abstract classes can't be instantiated.");t.activeStrategies.push(this),this.investmentSteps=e,this.payoutPhaseStartDate=a,this.tooltipDate=null!=s?s:new Date(0),this.yExtent=null!=r?r:[0,0],this.marginW=h,this.marginH=c,this.width=l,this.height=d,this.xTextOffset=1.02*this.width,i.innerHTML="",this.svg=S.m(i).append("svg").attr("class","img-fluid").attr("id",n).attr("viewBox","0 0 ".concat(this.width+2*this.marginW," ").concat(this.height+2*this.marginH+o)).append("g").attr("transform","translate(".concat([this.marginW/2,this.marginH],")")),this.textGroup=this.svg,this.interaction=this.svg,this.hoverLine=this.svg.append("line"),this.yAxis=S.c(this.yScale),this.xAxis=S.b(this.xScale)}return Object(f.a)(t,[{key:"render",value:function(){this._prepareData(),this._calculateExtents(),this._createScales(),this._createAxis(),this._drawGrid(),this._drawContent(),this._drawFadeOut(),this._prepareText(),this._drawText(),this._drawAxis(),this._addInteraction(),this.tooltipDate>=this.dateExtent[0]&&this.tooltipDate<=this.dateExtent[1]&&this._updateAllDiagrams()}},{key:"valueToDisplayNumber",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e&&null!=t&&(t=Math.abs(t)),t/this.labelDivisionFactor}},{key:"valueToDisplayText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=i?0:2;return"".concat(null!=t?this.valueToDisplayNumber(t,e).toLocaleString(void 0,{maximumFractionDigits:a,minimumFractionDigits:a}):" - ").concat(this.numberIndicator," \u20ac")}},{key:"addTextProperty",value:function(t,e){this.textProperties[t]={text:e.text,x:e.x,y:e.y,fontSize:e.fontSize?e.fontSize:this.standardFontSize,fontFamily:e.fontFamily?e.fontFamily:this.standardFont,textAnchor:e.textAnchor?e.textAnchor:this.startTextAnchor,fontWeight:e.fontWeight?e.fontWeight:this.boldText,color:e.color}}},{key:"_calculateExtents",value:function(){var t=this;this.dateExtent=S.f(this.dataArray[0],(function(t){return t.date}));var e=new Date(this.payoutPhaseStartDate);if(e.setMonth(e.getMonth()+O),0===this.yExtent[0]&&0===this.yExtent[1]){var i=this.dataArray[this.maxIndex].filter((function(i){return i.date<=e&&i.date>t.dateExtent[0]})),a=this.dataArray[this.minIndex].filter((function(t){return t.date<=e})),n=S.h(i.map((function(t){return t.yStart}))),s=S.i(a.map((function(t){return t.yEnd})));this.yExtent=[s,n]}this.labelDivisionFactor=Math.max(-this.yExtent[0],this.yExtent[1])>=5e6?at:1e3,this.numberIndicator=this.labelDivisionFactor===at?"M":"K"}},{key:"_createScales",value:function(){this.yScale=S.k().domain(this.yExtent).range([this.height,0]),this.xScale=S.l().domain(this.dateExtent).range([0,this.width])}},{key:"_createAxis",value:function(){var t=this,e=this.yScale.ticks(6).every((function(e){return Number.isInteger(t.valueToDisplayNumber(e,!1))}));this.yAxis=S.c(this.yScale).tickFormat((function(i){return t.valueToDisplayText(i,!1,e)})).ticks(6),this.xAxis=S.b(this.xScale)}},{key:"_drawGrid",value:function(){var t=this,e=this.svg.append("g").attr("class","grid"),i=e.append("g").attr("class","yGrid"),a=e.append("g").attr("class","xGrid");i.selectAll("line").data(this.yScale.ticks(6)).enter().append("line").attr("x1",this.xScale(this.dateExtent[0])).attr("y1",(function(e){return t.yScale(e)})).attr("x2",this.xScale(this.dateExtent[1])).attr("y2",(function(e){return t.yScale(e)})).style("stroke-width",this.gridStrokeWidth).style("stroke",this.gridColor).style("opacity",this.gridOpacity),a.selectAll("line").data(this.xScale.ticks()).enter().append("line").attr("x1",(function(e){return t.xScale(e)})).attr("y1",this.yScale(this.yExtent[0])).attr("x2",(function(e){return t.xScale(e)})).attr("y2",this.yScale(this.yExtent[1])).style("stroke-width",this.gridStrokeWidth).style("stroke",this.gridColor).style("opacity",this.gridOpacity)}},{key:"_drawAxis",value:function(){this.svg.append("g").style("font-size","20px").call(this.yAxis),this.svg.append("g").style("font-size","20px").attr("transform","translate(0, ".concat(this.height,")")).call(this.xAxis),this.svg.append("g").append("line").attr("x1",this.xScale(this.dateExtent[0])).attr("y1",this.yScale(0)).attr("x2",this.xScale(this.dateExtent[1])).attr("y2",this.yScale(0)).style("stroke-width",this.lineStrokeWidth).style("stroke","black"),this.svg.append("g").append("line").attr("x1",this.xScale(this.payoutPhaseStartDate)-this.lineStrokeWidth/2).attr("y1",this.yScale(this.yExtent[0])).attr("x2",this.xScale(this.payoutPhaseStartDate)-this.lineStrokeWidth/2).attr("y2",this.yScale(this.yExtent[1])).style("stroke-width",this.lineStrokeWidth).style("stroke","black")}},{key:"_addInteraction",value:function(){var e=this;this.interaction=this.svg.append("g").attr("class","interaction").style("visibility","hidden").attr("transform","translate(".concat([0,-this.marginH],")")),this.hoverLine=this.interaction.append("line").attr("class","tooltipLine").style("stroke","blue").style("stroke-dasharray","3,3").style("stroke-width",this.lineStrokeWidth).style("opacity",.5).attr("y1",this.height+2*this.marginH).attr("y2",0),this.svg.append("rect").attr("class","mouseEvent").attr("transform","translate(".concat([0,-this.marginH],")")).attr("height",this.height+2*this.marginH).attr("width",this.width).attr("fill","none").style("pointer-events","all").on("mouseover",(function(){return t._setInteractionVisibilityForActiveDiagrams("visible")})).on("mousemove",(function(t){return e._handleTooltipEvent(t)}))}},{key:"_handleTooltipEvent",value:function(t){var e=S.j(t)[0],i=this.xScale.invert(e);this.tooltipDate=M(i),this._updateAllDiagrams()}},{key:"_updateAllDiagrams",value:function(){var e=function(t,e){var i=e[0].date,a=e[1].date,n=(t.getFullYear()-i.getFullYear())*O+(t.getMonth()-i.getMonth()),s=(a.getFullYear()-i.getFullYear())*O+(a.getMonth()-i.getMonth());return Math.floor(n/s)}(this.tooltipDate,this.investmentSteps);t._setInteractionVisibilityForActiveDiagrams("visible");var i,a=Object(b.a)(t.activeStrategies);try{for(a.s();!(i=a.n()).done;){var n=i.value;n.hoverLine.attr("x1",this.xScale(this.tooltipDate)).attr("x2",this.xScale(this.tooltipDate)),n._updateTooltip(e),n._updateDiagram()}}catch(s){a.e(s)}finally{a.f()}}},{key:"_drawText",value:function(){this.textGroup=this.svg.append("g").attr("class","textGroup"),this.textGroup.selectAll("text").data(Object.values(this.textProperties)).enter().append("text").text((function(t){return t.text})).attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y})).style("font-size",(function(t){return t.fontSize})).style("font-family",(function(t){return t.fontFamily})).style("font-weight",(function(t){return t.fontWeight})).style("text-anchor",(function(t){return t.textAnchor})).style("fill",(function(t){return t.color}))}},{key:"_updateDiagram",value:function(){this.textGroup.selectAll("text").text((function(t){return t.text}))}},{key:"_prepareText",value:function(){var t=this.xScale(this.dateExtent[0])+(this.xScale(this.payoutPhaseStartDate)-this.xScale(this.dateExtent[0]))/2,e=this.xScale(this.payoutPhaseStartDate)+(this.xScale(this.dateExtent[1])-this.xScale(this.payoutPhaseStartDate))/2,i=-10;this.addTextProperty("savingBold",{x:t,y:i,text:"SAVING",textAnchor:this.endTextAnchor,color:"black",fontSize:1.5*this.standardFontSize}),this.addTextProperty("savingPhase",{x:t,y:i,text:"Phase",textAnchor:this.startTextAnchor,fontWeight:this.normalText,color:"black",fontSize:1.5*this.standardFontSize}),this.addTextProperty("payoutBold",{x:e,y:i,text:"PAYOUT",textAnchor:this.endTextAnchor,color:"black",fontSize:1.5*this.standardFontSize}),this.addTextProperty("payoutPhase",{x:e,y:i,text:"Phase",textAnchor:this.startTextAnchor,fontWeight:this.normalText,color:"black",fontSize:1.5*this.standardFontSize})}},{key:"_drawFadeOut",value:function(){var t=this.svg.append("g").attr("class","fadeOut"),e=new Date(this.dateExtent[1]);e.setFullYear(e.getFullYear()-this.fadeOutYearsLength);var i=t.append("linearGradient").attr("id",this.fadeOutGradientID);i.append("stop").attr("class","gradientStart").attr("offset","0%").attr("stop-color","white").attr("stop-opacity",0),i.append("stop").attr("class","gradientEnd").attr("offset","100%").attr("stop-color","white").attr("stop-opacity",1),t.append("rect").attr("x",this.xScale(e)).attr("y",-this.marginH).attr("width",this.xScale(this.dateExtent[1])-this.xScale(e)+1).attr("height",this.yScale(this.yExtent[0])-this.yScale(this.yExtent[1])+2*this.marginH).style("fill","url(#".concat(this.fadeOutGradientID,")"))}}],[{key:"reset",value:function(){t.activeStrategies=[]}},{key:"_setInteractionVisibilityForActiveDiagrams",value:function(e){var i,a=Object(b.a)(t.activeStrategies);try{for(a.s();!(i=a.n()).done;){i.value.interaction.style("visibility",e)}}catch(n){a.e(n)}finally{a.f()}}}]),t}();st.activeStrategies=[];var rt="payout",ot="invested",lt={payout:{first:"#3acc5c",second:"#2d9e45"},invested:{first:"#ff3e58",second:"#c32f46"}},dt=function(t){Object(p.a)(i,t);var e=Object(x.a)(i);function i(t,a,n,s,r){var o;return Object(u.a)(this,i),(o=e.call(this,t,a,n,"secondSVG",s,r)).barPaddingPercentage=.9,o.rectWidth=0,o}return Object(f.a)(i,[{key:"_prepareData",value:function(){var t=0,e=1;this.minIndex=t,this.maxIndex=e,this.dataArray=[[],[]];var i,a=this.investmentSteps[0].date.getFullYear(),n=Object(b.a)(this.investmentSteps);try{for(n.s();!(i=n.n()).done;){var s=i.value,r=G(s),o=(s.date.getFullYear()-a)%2===0?"first":"second";this.dataArray[t].push({yStart:0,yEnd:-s.newInvestment,date:s.date,color:lt.invested[o]}),this.dataArray[e].push({yStart:r,yEnd:0,date:s.date,color:lt.payout[o]})}}catch(l){n.e(l)}finally{n.f()}this.rectWidth=this.width/this.dataArray[t].length*this.barPaddingPercentage}},{key:"_prepareText",value:function(){Object(et.a)(Object(it.a)(i.prototype),"_prepareText",this).call(this),this.textProperties.payout={text:nt(rt),x:this.xTextOffset,y:.25*this.height-.5*this.standardFontSize,fontSize:this.standardFontSize,fontFamily:this.standardFont,textAnchor:this.startTextAnchor,fontWeight:this.boldText,color:lt.payout.second},this.textProperties[rt+this.labelValueIdentifier]={text:this.valueToDisplayText(void 0),x:this.xTextOffset+this.valueTextOffset,y:.25*this.height-.5*this.standardFontSize,fontSize:this.standardFontSize,fontFamily:this.monospaceFont,textAnchor:this.endTextAnchor,fontWeight:this.boldText,color:lt.payout.second},this.textProperties.invested={text:nt(ot),x:this.xTextOffset,y:.75*this.height-.5*this.standardFontSize,fontSize:this.standardFontSize,fontFamily:this.standardFont,textAnchor:this.startTextAnchor,fontWeight:this.boldText,color:lt.invested.second},this.textProperties[ot+this.labelValueIdentifier]={text:this.valueToDisplayText(void 0),x:this.xTextOffset+this.valueTextOffset,y:.75*this.height-.5*this.standardFontSize,fontSize:this.standardFontSize,fontFamily:this.monospaceFont,textAnchor:this.endTextAnchor,fontWeight:this.boldText,color:lt.invested.second}}},{key:"_updateTooltip",value:function(t){var e=G(this.investmentSteps[t]),i=this.investmentSteps[t].newInvestment;this.textProperties[rt+this.labelValueIdentifier].text=this.valueToDisplayText(e),this.textProperties[ot+this.labelValueIdentifier].text=this.valueToDisplayText(i)}},{key:"_drawContent",value:function(){var t,e=this,i=this.dataArray[0][this.dataArray[0].length-1].date===this.dateExtent[1],a=Object(b.a)(this.dataArray);try{for(a.s();!(t=a.n()).done;){var n=t.value;i&&(n=n.slice(0,-1)),this.svg.append("g").attr("class","bars").selectAll("rect.none").data(n).enter().append("rect").style("fill",(function(t){return t.color})).attr("x",(function(t){return e.xScale(t.date)})).attr("width",this.rectWidth).attr("y",(function(t){return e.yScale(t.yStart)})).attr("height",(function(t){return e.yScale(t.yEnd)-e.yScale(t.yStart)})).style("opacity",this.contentOpacity)}}catch(s){a.e(s)}finally{a.f()}}}]),i}(st),ht=function(t){Object(p.a)(i,t);var e=Object(x.a)(i);function i(t,a,n,s,r,o,l,d){var h;Object(u.a)(this,i),(h=e.call(this,t,a,n,"firstSVG",s,r,180)).etfLineColors={"SP5C.PAR":{total:"#1f78b4",invested:"#a6cee3"},ESGE:{total:"#33a02c",invested:"#b2df8a"},SUSA:{total:"#ff7f00",invested:"#fdbf6f"}},h.totalValueIndex=-1,h.negativeColors={inflation:"#f7528e",totalCosts:"#6a3d9a",totalTaxes:"#e31a1c"},h.negativeLabels=["totalCosts","totalTaxes","inflation"],h.investedIdentifier="invested",h.capitalIdentifier="capital",h.etfIdentifiers=void 0,h.previousInvestmentSteps=void 0,h.dataToIndex={},h.subtractInflationFromTotal=void 0,h.previousInvestmentSteps=d,h.subtractInflationFromTotal=l,h.etfIdentifiers=[];var c,f=Object(b.a)(Object.keys(o));try{for(f.s();!(c=f.n()).done;){var v=c.value,p=o[v];null!=p&&p>0&&h.etfIdentifiers.push(v)}}catch(x){f.e(x)}finally{f.f()}return h}return Object(f.a)(i,[{key:"_prepareData",value:function(){this.dataToIndex={totalCosts:0,totalTaxes:1,inflation:2};var t,e=3,i=Object(b.a)(this.etfIdentifiers);try{for(i.s();!(t=i.n()).done;){var a=t.value;this.dataToIndex[a+this.investedIdentifier]=e++,this.dataToIndex[a+this.capitalIdentifier]=e++}}catch(v){i.e(v)}finally{i.f()}this.minIndex=this.dataToIndex.inflation,this.maxIndex=e-1,this.totalValueIndex=this.maxIndex,this.dataArray=[];for(var n=0;nt){var f,v=Object(b.a)(this.negativeLabels);try{for(v.s();!(f=v.n()).done;){var p=f.value,x=this.investmentSteps[t][p]-this.previousInvestmentSteps[t][p];this.textProperties[p+this.deltaIdentifier+this.labelValueIdentifier].text=this.valueToDisplayText(x,!0)}}catch(V){v.e(V)}finally{v.f()}var y,g=Object(b.a)(this.etfIdentifiers);try{for(g.s();!(y=g.n()).done;){var m=y.value,S=z(m,this.investmentSteps[t]),j=S-Y(m,this.investmentSteps[t]),O=z(m,this.previousInvestmentSteps[t]),T=j-(O-Y(m,this.previousInvestmentSteps[t])),I=S-O;this.textProperties[m+this.deltaIdentifier+this.labelValueIdentifier+this.investedIdentifier].text=this.valueToDisplayText(T),this.textProperties[m+this.deltaIdentifier+this.labelValueIdentifier+this.totalIdentifier].text=this.valueToDisplayText(I)}}catch(V){g.e(V)}finally{g.f()}var C,w=0,P=Object(b.a)(this.etfIdentifiers);try{for(P.s();!(C=P.n()).done;){w+=z(C.value,this.previousInvestmentSteps[t])}}catch(V){P.e(V)}finally{P.f()}w-=this.subtractInflationFromTotal?this.previousInvestmentSteps[t].inflation:0,this.textProperties[this.totalIdentifier+this.deltaIdentifier+this.labelValueIdentifier].text=this.valueToDisplayText(c-w);var D=G(this.previousInvestmentSteps[t]),A=G(this.investmentSteps[t]);this.textProperties[rt+this.deltaIdentifier+this.labelValueIdentifier].text=this.valueToDisplayText(A-D);var F=this.previousInvestmentSteps[t].newInvestment,k=this.investmentSteps[t].newInvestment;this.textProperties[ot+this.deltaIdentifier+this.labelValueIdentifier].text=this.valueToDisplayText(k-F)}else if(null!=this.previousInvestmentSteps&&this.previousInvestmentSteps.length<=t)for(var M in this.textProperties)M.includes(this.deltaIdentifier)&&M.includes(this.labelValueIdentifier)&&(this.textProperties[M].text=this.valueToDisplayText(void 0))}}]),i}(st),ct=i(13),ut=function(t){Object(p.a)(i,t);var e=Object(x.a)(i);function i(t,a,n,s,r,o,l,d,h,c){var f;return Object(u.a)(this,i),(f=e.call(this,t,s,r,o,l,d,h,c)).contentOpacity=.325,f.confidenceAreaOpacity=.65,f.confidenceColors={minimumLine:"#ff3e58",maximumLine:"#00e396",middleLine:f.totalColor,area:"#a6d8fe"},f.minInvestmentSteps=void 0,f.maxInvestmentSteps=void 0,f.minInvestmentSteps=a,f.maxInvestmentSteps=n,f.subtractInflationFromTotal=h,f}return Object(f.a)(i,[{key:"_prepareData",value:function(){Object(et.a)(Object(it.a)(i.prototype),"_prepareData",this).call(this);var t=Math.max.apply(Math,Object(ct.a)(Object.values(this.dataToIndex)));this.dataToIndex={areaConfidence:++t},this.maxIndex=this.dataToIndex.areaConfidence,this.dataArray.push([]);for(var e=0;e0?Object(ft.jsxs)("label",{className:"form-label",htmlFor:t.identifier,children:[t.label," in ",Object(ft.jsx)("span",{className:"inputUnit",children:t.textAppending})]}):Object(ft.jsx)("label",{className:"form-label",htmlFor:t.identifier,children:t.label})}function yt(t){var e="number"===typeof t.value;return Object(ft.jsxs)("div",{className:"position-relative",children:[Object(ft.jsx)(xt,Object(c.a)({},t)),Object(ft.jsx)("input",{className:"form-control "+(t.isValid?"":"is-invalid"),id:t.identifier,type:e?"number":"text",value:t.value,onChange:function(i){return t.onValueChange(i.target.value,t.identifier,e)},disabled:t.disabled}),Object(ft.jsx)(pt,Object(c.a)({},t))]})}function bt(t){return Object(ft.jsxs)("div",{className:"position-relative",children:[Object(ft.jsx)(xt,Object(c.a)({},t)),Object(ft.jsx)("input",{className:"form-control "+(t.isValid?"":"is-invalid"),id:t.identifier,type:"number",value:t.value,onChange:function(e){return t.onValueChange(e.target.value,t.identifier)},disabled:t.disabled}),Object(ft.jsx)(pt,Object(c.a)({},t))]})}function gt(t){return Object(ft.jsxs)("div",{className:"checkbox-element",children:[Object(ft.jsx)("input",{className:"form-check-input",id:t.identifier,type:"checkbox",value:t.value.toString(),onChange:function(){return t.onValueChange(t.identifier)}}),Object(ft.jsx)("label",{className:"form-check-label",htmlFor:t.identifier,children:t.label})]})}function mt(t){return Object(ft.jsx)("div",{className:"row",children:Object(ft.jsx)("div",{className:"col-12 p-0",children:Object(ft.jsx)("div",{className:"d-grid gap-0",children:Object(ft.jsxs)("div",{className:"overlay min-vh-100 text-center m-0 d-flex flex-column justify-content-center",style:{visibility:t.displayOverlay?"visible":"hidden"},children:[Object(ft.jsxs)("h1",{className:"p-5",children:["Enter your personal"," ",Object(ft.jsxs)("a",{href:"https://www.alphavantage.co/support/#api-key",target:"_blank",rel:"noopener noreferrer",children:[" ","Alphavantage API Key"]})," "]}),Object(ft.jsx)("h4",{children:"No changing of the key is required. Simply press Confirm and the visualization is starting."}),Object(ft.jsx)(yt,Object(c.a)(Object(c.a)({},t),{},{disabled:!t.displayOverlay})),Object(ft.jsx)("button",{type:"button",className:"btn btn-primary my-5",onClick:t.handleAPIKeyConfirm,children:"Confirm"})]})})})})}function St(t){var e=t.title.replace(/\W/g,"_");return Object(ft.jsxs)("div",{className:"position-relative my-4 mb-1",children:[Object(ft.jsxs)("div",{className:"d-flex my-3",children:[Object(ft.jsx)("button",{className:"btn btn-secondary hamburgerButton mt-0 mb-0 pt-0 pb-0 me-4",type:"button","data-bs-toggle":"collapse","data-bs-target":"#".concat(e),"aria-expanded":t.initiallyCollapsed?"false":"true","aria-controls":e,children:"\u2630"}),Object(ft.jsx)("h6",{className:"sidebar-heading m-0 my-auto",children:t.title})]}),Object(ft.jsx)("div",{className:"collapse "+(t.initiallyCollapsed?"":"show"),id:e,children:t.children})]})}function jt(t,e){return e.fixedCosts===t.fixedCosts&&e.percentageCosts===t.percentageCosts}function Ot(t){return Object(ft.jsxs)("div",{className:"dropdown",children:[Object(ft.jsx)("button",{className:"btn btn-secondary dropdown-toggle",type:"button",id:"BrokerDropDown","data-bs-toggle":"dropdown","aria-expanded":"false",children:t.label}),Object(ft.jsx)("ul",{className:"dropdown-menu","aria-labelledby":"BrokerDropDown",children:t.elements.map((function(e){return Object(ft.jsx)("li",{children:Object(ft.jsx)("button",{className:jt(t,e)?"dropdown-item active":"dropdown-item",type:"button",onClick:function(i){return t.handleChange(e)},children:e.label})},e.identifier)}))})]})}function Tt(t){return Object(ft.jsxs)("div",{className:"dropdown",children:[Object(ft.jsx)("button",{className:"btn btn-secondary dropdown-toggle",type:"button",id:"GraphDetailDropDown","data-bs-toggle":"dropdown","aria-expanded":"false",children:t.label}),Object(ft.jsx)("ul",{className:"dropdown-menu","aria-labelledby":"GraphDetailDropDown",children:t.elements.map((function(e){return Object(ft.jsx)("li",{children:Object(ft.jsx)("button",{className:t.value===e.value?"dropdown-item active":"dropdown-item",type:"button",onClick:function(i){return t.handleChange(e)},children:e.label})},e.identifier)}))})]})}function It(t){return Object(ft.jsxs)("div",{className:"dropdown position-relative mb-1",children:[Object(ft.jsx)("button",{className:"btn btn-secondary dropdown-toggle is-invalid",type:"button",id:"ETFSelectionDropDown","data-bs-toggle":"dropdown","aria-expanded":"false",children:t.label}),Object(ft.jsx)(pt,Object(c.a)({},t)),Object(ft.jsx)("ul",{className:"dropdown-menu","aria-labelledby":"ETFSelectionDropDown",children:Object.keys(t.elements).map((function(e){return Object(ft.jsx)("li",{children:Object(ft.jsx)("button",{className:t.elements[e].selected?"dropdown-item active":"dropdown-item",type:"button",onClick:function(i){i.target instanceof HTMLInputElement||t.handleSelectionChange(t.elements[e])},children:Object(ft.jsx)(bt,Object(c.a)(Object(c.a)({},t.elements[e]),{},{value:t.elements[e].value,textAppending:"%",onValueChange:t.handleShareChange,disabled:t.autoPercentage,isValid:!0,errorMessage:""}))})},e)}))})]})}function Ct(t){return Object(ft.jsxs)("div",{className:"confidence",children:[Object(ft.jsx)(xt,Object(c.a)({},t.minConfidence)),Object(ft.jsxs)("div",{className:"row",children:[Object(ft.jsx)("div",{className:"col",children:Object(ft.jsx)(yt,Object(c.a)(Object(c.a)({},t.minConfidence),{},{noLabel:!0}))}),Object(ft.jsx)("div",{className:"col-1",children:"-"}),Object(ft.jsx)("div",{className:"col",children:Object(ft.jsx)(yt,Object(c.a)(Object(c.a)({},t.maxConfidence),{},{noLabel:!0}))})]}),Object(ft.jsx)(xt,Object(c.a)({},t.middleConfidence)),Object(ft.jsxs)("div",{className:"row",children:[Object(ft.jsx)("div",{className:"col align-self-center",children:Object(ft.jsx)("input",{type:"range",className:"form-range position-relative",min:t.minConfidence.value,max:t.maxConfidence.value,step:.1,value:t.middleConfidence.value,onChange:function(e){return t.middleConfidence.onValueChange(e.target.value,t.middleConfidence.identifier,!0)}})}),Object(ft.jsx)("div",{className:"col-5 align-self-center",children:Object(ft.jsx)(yt,Object(c.a)(Object(c.a)({},t.middleConfidence),{},{noLabel:!0}))})]})]})}var wt="startingCapital",Pt="monthlyInvestment",Dt="yearlyInvestmentIncrease",At="transactionPercentageCosts",Ft="transactionFixedCosts",kt="savingPhase",Mt="age",Vt="taxFreeAmount",Et="monthlyPayout",_t="yearlyPayoutIncrease",Nt="lifeExpectation",Lt="detailedGraph",zt="etfDropdownSelection",Yt="apiKey",Rt="yAxisLock",Gt="inflationUsedForTotal",Wt="minConfidence",Bt="maxConfidence",Ut="middleConfidence",Ht="useDistributionModel",Kt="useConfidenceVisualization",qt="brokerDropdown",Jt="etfAutomaticPercentage",Zt={"SP5C.PAR":"S & P 500",ESGE:"MSCI EM",SUSA:"MSCI USA ESG"};function $t(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{percentageCosts:e?T(t.transactionPercentageCosts.value):t.transactionPercentageCosts.value,fixedCosts:t.transactionFixedCosts.value}}function Qt(t){var e=0;for(var i in t.etfDropdownSelection.elements)t.etfDropdownSelection.elements[i].selected&&e++;var a=100/Math.max(1,e);for(var n in t.etfDropdownSelection.elements)t.etfDropdownSelection.elements[n].selected&&(t.etfDropdownSelection.elements[n].value=a);return t}var Xt=function(t){Object(p.a)(i,t);var e=Object(x.a)(i);function i(t){var a;return Object(u.a)(this,i),(a=e.call(this,t)).handleTextChange=a.handleTextChange.bind(Object(v.a)(a)),a.handleCheckBoxChange=a.handleCheckBoxChange.bind(Object(v.a)(a)),a.handleBrokerChange=a.handleBrokerChange.bind(Object(v.a)(a)),a.handleGraphDetailChange=a.handleGraphDetailChange.bind(Object(v.a)(a)),a.handleETFSelectionChange=a.handleETFSelectionChange.bind(Object(v.a)(a)),a.handleETFShareChange=a.handleETFShareChange.bind(Object(v.a)(a)),a.handleAPIKeyConfirm=a.handleAPIKeyConfirm.bind(Object(v.a)(a)),a.state=function(t){var e;return e={isValid:!0},Object(d.a)(e,wt,{value:1e3,label:"Starting Capital",errorMessage:"",textAppending:"\u20ac",isValid:!0,identifier:wt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Pt,{value:100,label:"Monthly Investment",errorMessage:"Please enter a positive Money amount.",textAppending:"\u20ac",isValid:!0,identifier:Pt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Dt,{value:0,label:"Yearly Investment Increase",errorMessage:"",textAppending:"%",isValid:!0,identifier:Dt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Et,{value:1e3,label:"Monthly Payout",errorMessage:"",textAppending:"\u20ac",isValid:!0,identifier:Et,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,_t,{value:0,label:"Yearly Payout Increase",errorMessage:"",textAppending:"%",isValid:!0,identifier:_t,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,At,{value:1.5,label:"Percentage Transaction Costs",errorMessage:"",textAppending:"%",isValid:!0,identifier:At,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Ft,{value:0,label:"Fixed Transaction Costs",errorMessage:"",textAppending:"\u20ac",isValid:!0,identifier:Ft,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,kt,{value:40,label:"Saving Phase",errorMessage:"",textAppending:"Years",isValid:!0,identifier:kt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Mt,{value:30,label:"Your Age",textAppending:"Years",errorMessage:"",isValid:!0,identifier:Mt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Nt,{value:80,label:"Life Expectation",errorMessage:"",isValid:!0,textAppending:"Years",identifier:Nt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Vt,{value:801,label:"Tax Free Amount",errorMessage:"",isValid:!0,textAppending:"\u20ac",identifier:Vt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Wt,{value:70,label:"Confidence Interval",errorMessage:"",isValid:!0,textAppending:"%",identifier:Wt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Bt,{value:100,label:"",errorMessage:"",isValid:!0,textAppending:"",identifier:Bt,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Ut,{value:90,label:"Confidence for the Calculation",errorMessage:"",isValid:!0,textAppending:"%",identifier:Ut,onValueChange:t.handleTextChange,disabled:!1}),Object(d.a)(e,Jt,{value:!1,label:"Automatic ETF Ratio",identifier:Jt,onValueChange:t.handleCheckBoxChange}),Object(d.a)(e,Gt,{value:!1,label:"Subtract Inflation of Total",identifier:Gt,onValueChange:t.handleCheckBoxChange}),Object(d.a)(e,Kt,{value:!1,label:"Show Confidence",identifier:Kt,onValueChange:t.handleCheckBoxChange}),Object(d.a)(e,Ht,{value:!1,label:"Use Distribution Model",identifier:Ht,onValueChange:t.handleCheckBoxChange}),Object(d.a)(e,Rt,{value:!1,label:"Lock Y Axis Extent",identifier:Rt,onValueChange:t.handleCheckBoxChange}),Object(d.a)(e,Yt,{displayOverlay:!0,error:!1,value:"defaultPaperKey",label:"",errorMessage:"",isValid:!0,textAppending:"",identifier:Yt,onValueChange:t.handleTextChange,handleAPIKeyConfirm:t.handleAPIKeyConfirm}),Object(d.a)(e,Lt,{value:1,label:"Graph Detail Level",isValid:!0,handleChange:t.handleGraphDetailChange,elements:[{identifier:"12",value:12,label:"All Months a Year (high detail)"},{identifier:"4",value:4,label:"Every 4th Month (middle detail)"},{identifier:"1",value:1,label:"One Month a Year (low detail)"}]}),Object(d.a)(e,qt,{label:"Broker",isValid:!0,handleChange:t.handleBrokerChange,elements:[{identifier:"comdirect",label:"comdirect",fixedCosts:0,percentageCosts:1.5},{identifier:"tradeRepublic",label:"Trade Republic",fixedCosts:0,percentageCosts:1},{identifier:"ing",label:"ing",fixedCosts:4.99,percentageCosts:.25}]}),Object(d.a)(e,zt,{label:"ETF Selection",isValid:!0,identifier:zt,errorMessage:"",handleSelectionChange:t.handleETFSelectionChange,handleShareChange:t.handleETFShareChange,elements:{S_and_P_500:{identifier:"S_and_P_500",symbol:"SP5C.PAR",label:Zt["SP5C.PAR"],value:100,selected:!0},iShare:{identifier:"iShare",symbol:"ESGE",label:Zt.ESGE,value:100,selected:!1},msciUSA:{identifier:"msciUSA",symbol:"SUSA",label:Zt.SUSA,value:100,selected:!1}}}),e}(Object(v.a)(a)),a}return Object(f.a)(i,[{key:"componentDidMount",value:function(){!function(t){var e=new URLSearchParams(window.location.search);!e.has(Yt)||""===e.get(Yt)&&null==e.get(Yt)||(t.state.apiKey.value=e.get(Yt),t.handleAPIKeyConfirm())}(this)}},{key:"handleTextChange",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=Object(c.a)({},this.state);a[e].value=i?Number(t):t,this._validateAndSetState(a)}},{key:"handleCheckBoxChange",value:function(t){var e=Object(c.a)({},this.state);e[t].value=!e[t].value,t===Jt&&e[t].value&&Qt(e),this._validateAndSetState(e)}},{key:"handleBrokerChange",value:function(t){var e=Object(c.a)({},this.state);e.transactionPercentageCosts.value=t.percentageCosts,e.transactionFixedCosts.value=t.fixedCosts,this._validateAndSetState(e)}},{key:"handleGraphDetailChange",value:function(t){var e=Object(c.a)({},this.state);e[Lt].value=t.value,this._validateAndSetState(e)}},{key:"handleETFSelectionChange",value:function(t){var e=Object(c.a)({},this.state);e.etfDropdownSelection.elements[t.identifier].selected=!e.etfDropdownSelection.elements[t.identifier].selected,e.etfAutomaticPercentage.value&&Qt(e),this._validateAndSetState(e)}},{key:"handleETFShareChange",value:function(t,e){var i=Object(c.a)({},this.state);i.etfDropdownSelection.elements[e].value=Number(t),this._validateAndSetState(i)}},{key:"handleAPIKeyConfirm",value:function(){var t=Object(h.a)(l.a.mark((function t(){var e,i,a,n;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.state.apiKey.value,i=Object(c.a)({},this.state.apiKey),t.prev=2,t.next=5,V.loadHistoricData(e,this.state.etfDropdownSelection.elements);case 5:i.error=!1,i.displayOverlay=!1,t.next=12;break;case 9:t.prev=9,t.t0=t.catch(2),i.error=!0;case 12:a=new URLSearchParams(window.location.search),n=window.location.href.split("?")[0],a.set(Yt,e),window.history.replaceState(null,"","".concat(n,"?").concat(a.toString())),this.setState(Object(d.a)({},Yt,i)),this.forceUpdate();case 18:case"end":return t.stop()}}),t,this,[[2,9]])})));return function(){return t.apply(this,arguments)}}()},{key:"_validateAndSetState",value:function(t){var e,i=[Pt,Et,wt,Mt,Nt,kt,Vt],a=[Dt,_t,Ft,At,Wt,Bt,Ut];t.isValid=!0;for(var n=0,s=i;n=0),t[r].errorMessage="Please enter a positive number.",t.isValid=t[r].isValid&&t.isValid}for(var o=0,l=a;ot[Bt].value&&(t[Wt].isValid=!1,t.isValid=!1,t[Wt].errorMessage="The minimum confidence cannot be higher than the maximum confidence.");var c=0,u=!1;for(var f in t.etfDropdownSelection.elements)t.etfDropdownSelection.elements[f].selected&&(c+=T(t.etfDropdownSelection.elements[f].value),u=!0);u?1!==c?(t.etfDropdownSelection.isValid=!1,t.etfDropdownSelection.errorMessage="The sum of all selected ETFs need to be 100%.",t.isValid=!1):t.etfDropdownSelection.isValid=!0:(t.etfDropdownSelection.isValid=!1,t.etfDropdownSelection.errorMessage="Please select at least one ETF.",t.isValid=!1),this.setState(t)}},{key:"render",value:function(){var t=$t(this.state);return Object(ft.jsxs)("div",{className:"container-fluid",children:[Object(ft.jsx)(mt,Object(c.a)({},this.state.apiKey)),Object(ft.jsxs)("div",{className:"row row-cols-3",children:[Object(ft.jsx)("nav",{id:"sidebarMenu",className:"col-md-3 col-lg-2 bg-light sidebar",children:Object(ft.jsxs)("form",{className:"position-sticky needs-validation",noValidate:!0,children:[Object(ft.jsxs)(St,{title:"Money Options",initiallyCollapsed:!1,children:[Object(ft.jsx)(yt,Object(c.a)({},this.state[wt])),Object(ft.jsx)(yt,Object(c.a)({},this.state[Pt])),Object(ft.jsx)(yt,Object(c.a)({},this.state[Dt])),Object(ft.jsx)(yt,Object(c.a)({},this.state[Et])),Object(ft.jsx)(yt,Object(c.a)({},this.state[_t])),Object(ft.jsx)(yt,Object(c.a)({},this.state[Vt])),Object(ft.jsx)(gt,Object(c.a)({},this.state[Ht]))]}),Object(ft.jsxs)(St,{title:"Time Options",initiallyCollapsed:!1,children:[Object(ft.jsx)(yt,Object(c.a)({},this.state[Mt])),Object(ft.jsx)(yt,Object(c.a)({},this.state[Nt])),Object(ft.jsx)(yt,Object(c.a)({},this.state[kt]))]}),Object(ft.jsxs)(St,{title:"Cost Options",initiallyCollapsed:!0,children:[Object(ft.jsx)(Ot,Object(c.a)(Object(c.a)({},t),this.state.brokerDropdown)),Object(ft.jsx)(yt,Object(c.a)({},this.state.transactionPercentageCosts)),Object(ft.jsx)(yt,Object(c.a)({},this.state.transactionFixedCosts))]}),Object(ft.jsxs)(St,{title:"Visualization Options",initiallyCollapsed:!0,children:[Object(ft.jsx)(Tt,Object(c.a)({},this.state[Lt])),Object(ft.jsx)(gt,Object(c.a)({},this.state[Rt])),Object(ft.jsx)(gt,Object(c.a)({},this.state[Gt])),Object(ft.jsx)(gt,Object(c.a)({},this.state.etfAutomaticPercentage)),Object(ft.jsx)(It,Object(c.a)({autoPercentage:this.state.etfAutomaticPercentage.value},this.state.etfDropdownSelection)),Object(ft.jsx)(gt,Object(c.a)({},this.state[Kt])),Object(ft.jsx)(Ct,{minConfidence:this.state[Wt],maxConfidence:this.state[Bt],middleConfidence:this.state[Ut]})]})]})}),Object(ft.jsx)("div",{id:"sidebarMenu",className:"col-md-3 col-lg-2",children:Object(ft.jsx)("h1",{children:"Padding"})}),Object(ft.jsxs)("main",{className:"col-md-9 col-lg-10",children:[Object(ft.jsx)("h1",{children:"Etf Pension Plan Visualization"}),Object(ft.jsx)(vt,Object(c.a)({},this.state))]})]})]})}}]),i}(n.a.Component);var te=function(t){t&&t instanceof Function&&i.e(3).then(i.bind(null,169)).then((function(e){var i=e.getCLS,a=e.getFID,n=e.getFCP,s=e.getLCP,r=e.getTTFB;i(t),a(t),n(t),s(t),r(t)}))};i(165);r.a.render(Object(ft.jsx)(n.a.StrictMode,{children:Object(ft.jsx)(Xt,{})}),document.getElementById("root")),te()}},[[166,1,2]]]); //# sourceMappingURL=main.de957dd7.chunk.js.map