1import{Ct as e,H as t,J as n,Nt as r,Pt as i,Q as a,S as o,U as s,V as c,Vt as l,W as u,Y as d,bt as f,ct as p,f as m,ft as h,mt as g,o as _,pt as v,q as y,r as b,st as x,tt as S,x as ee,y as C,yt as w,z as T,zt as E}from"./CcSe0FZx.js";import{c as D,h as O,i as k,l as te,o as A,r as ne,s as re,t as ie,u as j}from"./I5BI9OJH.js";function M(e){return e<0?-1:1}function N(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(M(a)+M(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function P(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function F(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function I(e){this._context=e}I.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:F(this,this._t0,P(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,F(this,P(this,n=N(this,e,t)),n);break;default:F(this,this._t0,n=N(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function L(e){this._context=new R(e)}(L.prototype=Object.create(I.prototype)).point=function(e,t){I.prototype.point.call(this,t,e)};function R(e){this._context=e}R.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function z(e){return new I(e)}function B(e){let{principal:t,monthlyDeposit:n,annualRate:r,years:i}=e,a=t*Math.exp(r*i),o=n*(Math.exp(r*i)-1)/(Math.exp(r/12)-1);return{lumpSum:a,annuity:o,total:a+o}}function V(e,t,n,r){return B({principal:e,monthlyDeposit:t,annualRate:n,years:r}).total}var ae=u(`<g opacity="0.3" class="svelte-1alivg9"><!></g>`),oe=u(`<path fill="none" stroke-width="2" stroke-dasharray="6 4" style="vector-effect: non-scaling-stroke;"></path>`),se=u(`<g opacity="0.3" class="svelte-1alivg9"><path fill="none" stroke-width="2" stroke-dasharray="6 4" style="vector-effect: non-scaling-stroke;"></path></g>`),ce=u(`<!><!>`,1),le=u(`<g class="svelte-1alivg9"><circle r="5" class="fill-accent pulse-dot svelte-1alivg9"></circle><circle r="5" class="fill-accent svelte-1alivg9"></circle></g>`),ue=u(`<line class="stroke-text/20 svelte-1alivg9" stroke-width="1"></line><circle r="6" class="fill-accent svelte-1alivg9"></circle>`,1),de=u(`<!><defs class="svelte-1alivg9"><linearGradient id="simpleProjectionGradient" x1="0" y1="0" x2="0" gradientUnits="userSpaceOnUse" class="svelte-1alivg9"><stop offset="0%" class="[stop-color:var(--color-accent)] svelte-1alivg9" stop-opacity="0.5"></stop><stop offset="100%" class="[stop-color:var(--color-accent)] svelte-1alivg9" stop-opacity="0"></stop></linearGradient></defs><!><!><!><!><!>`,1),fe=s(`<div class="relative h-full flex flex-col svelte-1alivg9" role="img" aria-label="Projection chart" style="touch-action: none;"><div class="flex-1 w-full svelte-1alivg9"><!></div></div>`);function H(s,u){i(u,!0);let y=_(u,`initialPrincipal`,3,0),M=_(u,`monthlyDeposit`,3,500),N=_(u,`timelineYears`,3,40),P=_(u,`annualRate`,3,.06),F=_(u,`numVerticalLines`,3,8),I=_(u,`numHorizontalLines`,3,5),L=_(u,`gridStrokeClass`,3,`stroke-white/40`),R=f(!1);b(()=>(w(R,!0),()=>{w(R,!1)}));let B=new D(0,{duration:1200,easing:O}),H=new D(1,{duration:600,easing:O}),U=f(1),W=f(!1),G=f(!1),K=f(null),q=null,J=null;p(()=>{a(R)&&S(()=>{B.set(0,{duration:0}),B.set(1)})});let Y=Date.now(),pe=e(()=>Y+1e3*3600*24*365*N()),X=e(()=>Array.from({length:N()+1},(e,t)=>({x:Y+t/N()*(a(pe)-Y),y:V(y(),M(),P(),t)}))),Z=e(()=>u.compareAnnualRate===void 0?null:Array.from({length:N()+1},(e,t)=>({x:Y+t/N()*(a(pe)-Y),y:V(y(),M(),u.compareAnnualRate,t)}))),me=e(()=>[...a(X).map(e=>e.y),...a(Z)?a(Z).map(e=>e.y):[]]),he=e(()=>Math.min(...a(me))),ge=e(()=>Math.max(...a(me))),Q=e(()=>(a(ge)-a(he))*.1||1e3),_e=e(()=>
1{let e=a(he)-a(Q),t=a(ge)+a(Q),n=I();return Array.from({length:n},(r,i)=>e+(t-e)*(i+1)/(n+1))});function ve(){w(G,!0),w(W,!1),u.onInteractionStart?.()}function ye(e){if(!a(K))return;let t=a(K).getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=Math.max(0,Math.min(1,n/t.width));w(U,i,!0);let o=Math.max(.1,Math.round(i*N()*10)/10);q={years:o,balance:V(y(),M(),P(),o),x:n,y:r},J===null&&(J=requestAnimationFrame(()=>{q&&u.onInteractionMove?.(q.years,q.balance,q.x,q.y),J=null}))}function be(){w(G,!1),q=null,J!==null&&(cancelAnimationFrame(J),J=null),u.onInteractionEnd?.(),a(U)<1&&(w(W,!0),H.set(a(U),{duration:0}),H.set(1).then(()=>{w(W,!1)}))}function xe(e,t,n,r){if(t.length===0)return null;let i=te().x(e=>n(e.x)).y(e=>r(e.y)).curve(z)(t);if(!i)return null;let a=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);a.setAttribute(`d`,i);let o=e*a.getTotalLength(),s=a.getPointAtLength(o);return{x:s.x,y:s.y}}var $=fe(),Se=h($),Ce=h(Se),we=n=>{{let r=e(j),i=e(()=>[a(he)-a(Q),a(ge)+a(Q)]);k(n,{get data(){return a(X)},x:`x`,get xScale(){return a(r)},y:`y`,get yDomain(){return a(i)},children:l,$$slots:{default:(n,r)=>{let i=e(()=>r.width),s=e(()=>r.height),l=e(()=>r.xScale),u=e(()=>r.yScale),d=e(()=>a(G)||a(W)),f=e(()=>a(G)?a(U):H.current),p=e(()=>a(d)?a(f)*a(i):B.current*a(i));re(n,{children:(n,r)=>{let m=e(()=>a(W)?H.current:B.current),_=e(()=>xe(a(m),a(X),a(l),a(u)));var b=de(),S=v(b);{let t=e(()=>F()-1);ie(S,{x:!0,y:!0,get xTicks(){return a(t)},get yTicks(){return a(_e)},classes:{line:`stroke-text/10`}})}var w=g(S),D=h(w);E(w);var O=g(w);A(O,{x:0,y:0,get width(){return a(p)},get height(){return a(s)},children:(e,t)=>{ne(e,{fill:`url(#simpleProjectionGradient)`,get curve(){return z},line:{class:`stroke-accent`,style:`stroke-width: 2.5px; vector-effect: non-scaling-stroke; fill: none;`}})},$$slots:{default:!0}});var k=g(O),re=t=>{{let n=e(()=>a(f)*a(i)),r=e(()=>a(i)-a(f)*a(i));A(t,{get x(){return a(n)},y:0,get width(){return a(r)},get height(){return a(s)},children:(e,t)=>{var n=ae();ne(h(n),{fill:`url(#simpleProjectionGradient)`,get curve(){return z},line:{class:`stroke-accent`,style:`stroke-width: 2.5px; vector-effect: non-scaling-stroke; fill: none;`}}),E(n),c(e,n)},$$slots:{default:!0}})}};T(k,e=>{a(d)&&a(f)<1&&e(re)});var j=g(k),I=n=>{let r=e(()=>te().x(e=>a(l)(e.x)).y(e=>a(u)(e.y)).curve(z)),m=e(()=>a(r)(a(Z)));var _=t(),y=v(_),b=t=>{var n=ce(),r=v(n);A(r,{x:0,y:0,get width(){return a(p)},get height(){return a(s)},children:(e,t)=>{var n=oe();x(()=>{C(n,`d`,a(m)),ee(n,0,o(L()),`svelte-1alivg9`)}),c(e,n)},$$slots:{default:!0}});var l=g(r),u=t=>{{let n=e(()=>a(f)*a(i)),r=e(()=>a(i)-a(f)*a(i));A(t,{get x(){return a(n)},y:0,get width(){return a(r)},get height(){return a(s)},children:(e,t)=>{var n=se(),r=h(n);E(n),x(()=>{C(r,`d`,a(m)),ee(r,0,o(L()),`svelte-1alivg9`)}),c(e,n)},$$slots:{default:!0}})}};T(l,e=>{a(d)&&a(f)<1&&e(u)}),c(t,n)};T(y,e=>{a(m)&&e(b)}),c(n,_)};T(j,e=>{a(Z)&&e(I)});var R=g(j),fe=e=>{var t=le(),n=h(t),r=g(n);E(t),x(()=>{C(n,`cx`,a(_).x),C(n,`cy`,a(_).y),C(r,`cx`,a(_).x),C(r,`cy`,a(_).y)}),c(e,t)};T(R,e=>{a(_)&&!a(G)&&e(fe)});var K=g(R),q=t=>{let n=e(()=>a(U)*a(i)),r=e(()=>Math.max(.1,Math.round(a(U)*N()*10)/10)),o=e(()=>a(u)(V(y(),M(),P(),a(r))));var l=ue(),d=v(l);C(d,`y1`,0);var f=g(d);x(()=>{C(d,`x1`,a(n)),C(d,`x2`,a(n)),C(d,`y2`,a(s)),C(f,`cx`,a(n)),C(f,`cy`,a(o))}),c(t,l)};T(K,e=>{a(G)&&e(q)}),x(()=>C(D,`y2`,a(s))),c(n,b)},$$slots:{default:!0}})}}})}};T(Ce,e=>{a(X).length>0&&e(we)}),E(Se),E($),m($,e=>w(K,e),()=>a(K)),d(`pointerenter`,$,ve),n(`pointermove`,$,ye),d(`pointerleave`,$,be),c(s,$),r()}y([`pointermove`]);export{z as i,B as n,V as r,H as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.