PageSourceSearch

https://freecalculators.ai/_next/static/chunks/1970.0ff42d81b3c47573.js

js freecalculators.ai collected 2026-10-05 12:04:03 UTC 15,720 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1970],{1970:(e,a,s)=>{s.r(a),s.d(a,{default:()=>v});var t=s(95155),l=s(12115),r=s(33789),i=s(90235),n=s(83209),d=s(57918),c=s(47507),o=s(26991),u=s(80019),m=s(68425),h=s(47734),p=s(73697),f=s(7620),x=s(47643),b=s(51089),g=s(87060),j=s(68269);function v(){let[e,a]=(0,l.useState)(5e4),[s,v]=(0,l.useState)(5e3),[N,y]=(0,l.useState)(5),[w,k]=(0,l.useState)("straight-line"),[C,S]=(0,l.useState)([]),[A,D]=(0,l.useState)(0),[V,R]=(0,l.useState)(!0);(0,l.useEffect)(()=>{T()},[e,s,N,w]);let T=()=>{let a=e-s,t=[];if("straight-line"===w){let l=a/N;D(l);let r=e;for(let e=1;e<=N;e++)r-=l,t.push({year:e,depreciation:l,accumulatedDepreciation:e*l,bookValue:Math.max(r,s)})}else if("double-declining"===w){let a=1/N*2;D(e*a);let l=e,r=0;for(let e=1;e<=N;e++){let i=l*a,n=(l-s)/(N-e+1);if(n>i&&(i=n),l-i<s&&(i=l-s),l-=i,r+=i,t.push({year:e,depreciation:i,accumulatedDepreciation:r,bookValue:l}),l<=s)break}}else if("sum-of-years"===w){let s=N*(N+1)/2;D(N/s*a);let l=e,r=0;for(let e=1;e<=N;e++){let i=(N-e+1)/s*a;
1l-=i,r+=i,t.push({year:e,depreciation:i,accumulatedDepreciation:r,bookValue:l})}}S(t)},F=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e);return(0,t.jsx)("div",{className:"w-full",children:(0,t.jsxs)(d.Tabs,{defaultValue:"calculator",children:[(0,t.jsxs)(d.TabsList,{className:"grid w-full grid-cols-3",children:[(0,t.jsx)(d.TabsTrigger,{value:"calculator",children:"Calculator"}),(0,t.jsx)(d.TabsTrigger,{value:"schedule",children:"Schedule"}),(0,t.jsx)(d.TabsTrigger,{value:"chart",children:"Chart"})]}),(0,t.jsxs)(d.TabsContent,{value:"calculator",className:"space-y-4",children:[(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(j.Y,{useSliders:V,onToggle:R})}),(0,t.jsxs)("div",{className:"grid gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.J,{htmlFor:"asset-cost",children:"Asset Cost ($)"}),V?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.A,{id:"asset-cost-slider",min:1e3,max:1e6,step:1e3,value:[e],onValueChange:e=>a(e[0]),className:"flex-1"}),(0,t.jsx)("span",{className:"w-32 text-right",children:F(e)})]}):(0,t.jsx)(r.p,{id:"asset-cost",type:"number",min:"0",value:e,onChange:e=>a(Number.parseFloat(e.target.value)||0)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.J,{htmlFor:"salvage-value",children:"Salvage Value ($)"}),V?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.A,{id:"salvage-value-slider",min:0,max:e,step:100,value:[s],onValueChange:e=>v(e[0]),className:"flex-1"}),(0,t.jsx)("span",{className:"w-32 text-right",children:F(s)})]}):(0,t.jsx)(r.p,{id:"salvage-value",type:"number",min:"0",max:e,value:s,onChange:e=>v(Number.parseFloat(e.target.value)||0)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.J,{htmlFor:"useful-life",children:"Useful Life (years)"}),V?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.A,{id:"useful-life-slider",min:1,max:50,step:1,value:[N],onValueChange:e=>y(e[0]),className:"flex-1"}),(0,t.jsx)("span",{className:"w-16 text-right",children:N})]}):(0,t.jsx)(r.p,{id:"useful-life",type:"number",min:"1",max:"50",value:N,onChange:e=>y(Number.parseInt(e.target.value)||1)})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.J,{htmlFor:"method",children:"Depreciation Method"}),(0,t.jsxs)(c.l6,{value:w,onValueChange:k,children:[(0,t.jsx)(c.bq,{id:"method",children:(0,t.jsx)(c.yv,{placeholder:"Select depreciation method"})}),(0,t.jsxs)(c.gC,{children:[(0,t.jsx)(c.eb,{value:"straight-line",children:"Straight-Line"}),(0,t.jsx)(c.eb,{value:"double-declining",children:"Double-Declining Balance"}),(0,t.jsx)(c.eb,{value:"sum-of-years",children:"Sum-of-Years-Digits"})]})]})]})]}),(0,t.jsxs)(n.Zp,{children:[(0,t.jsxs)(n.aR,{className:"pb-2",children:[(0,t.jsx)(n.ZB,{children:"Depreciation Summary"}),(0,t.jsxs)(n.BT,{children:["Depreciable Amount: ",F(e-s)]})]}),(0,t.jsx)(n.Wu,{children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Annual Depreciation"}),(0,t.jsx)("p",{className:"text-xl font-bold",children:F(A)})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Book Value After ",N," Years"]}),(0,t.jsx)("p",{className:"text-xl font-bold",children:F(s)})]})]})})]})]}),(0,t.jsx)(d.TabsContent,{value:"schedule",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full border-collapse",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b",children:[(0,t.jsx)("th",{className:"text-left p-2",children:"Year"}),(0,t.jsx)("th",{className:"text-right p-2",children:"Depreciation"}),(0,t.jsx)("th",{className:"text-right p-2",children:"Accumulated"}),(0,t.jsx)("th",{className:"text-right p-2",children:"Book Value"})]})}),(0,t.jsxs)("tbody",{children:[(0,t.jsxs)("tr",{className:"border-b",children:[(0,t.jsx)("td",{className:"p-2",children:"0"}),(0,t.jsx)("td",{className:"text-right p-2",children:"-"}),(0,t.jsx)("td",{className:"text-right p-2",children:"-"}),(0,t.jsx)("td",{className:"text-right p-2",children:F(e)})]}),C.map((e,a)=>(0,t.jsxs)("tr",{className:"border-b",children:[(0,t.jsx)("td",{className:"p-2",children:e.year}),(0,t.jsx)("td",{className:"text-right p-2",children:F(e.depreciation)}),(0,t.jsx)("td",{className:"text-right p-2",children:F(e.accumulatedDepreciation)}),(0,t.jsx)("td",{className:"text-right p-2",children:F(e.bookValue)})]},a))]})]})})}),(0,t.jsx)(d.TabsContent,{value:"chart",children:(0,t.jsx)("div",{className:"h-[300px] w-full",children:(0,t.jsx)(b.at,{config:{bookValue:{label:"Book Value",color:"hsl(var(--chart-1))"},depreciation:{label:"Annual Depreciation",color:"hsl(var(--chart-2))"}},className:"h-full",children:(0,t.jsx)(o.u,{width:"100%",height:"100%",children:(0,t.jsxs)(u.b,{data:[{year:0,bookValue:e,depreciation:0}
1,...C],margin:{top:5,right:30,left:20,bottom:5},children:[(0,t.jsx)(m.d,{strokeDasharray:"3 3"}),(0,t.jsx)(h.W,{dataKey:"year"}),(0,t.jsx)(p.h,{tickFormatter:e=>"$".concat(e)}),(0,t.jsx)(b.II,{content:(0,t.jsx)(b.Nt,{})}),(0,t.jsx)(f.s,{}),(0,t.jsx)(x.N,{type:"monotone",dataKey:"bookValue",stroke:"#8884d8",name:"Book Value"}),(0,t.jsx)(x.N,{type:"monotone",dataKey:"depreciation",stroke:"#ffa500",name:"Annual Depreciation"})]})})})})})]})})}},7235:(e,a,s)=>{s.d(a,{Switch:()=>n});var t=s(95155),l=s(12115),r=s(27599),i=s(25016);let n=l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.bL,{className:(0,i.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",s),...l,ref:a,children:(0,t.jsx)(r.zi,{className:(0,i.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});n.displayName=r.bL.displayName},10489:(e,a,s)=>{s.d(a,{b:()=>n});var t=s(12115),l=s(97602),r=s(95155),i=t.forwardRef((e,a)=>(0,r.jsx)(l.sG.label,{...e,ref:a,onMouseDown:a=>{var s;a.target.closest("button, input, select, textarea")||(null==(s=e.onMouseDown)||s.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));i.displayName="Label";var n=i},27599:(e,a,s)=>{s.d(a,{bL:()=>y,zi:()=>w});var t=s(12115),l=s(92556),r=s(94446),i=s(3468),n=s(23558),d=s(78108),c=s(84288),o=s(97602),u=s(95155),m="Switch",[h,p]=(0,i.A)(m),[f,x]=h(m),b=t.forwardRef((e,a)=>{let{__scopeSwitch:s,name:i,checked:d,defaultChecked:c,required:h,disabled:p,value:x="on",onCheckedChange:b,form:g,...j}=e,[y,w]=t.useState(null),k=(0,r.s)(a,e=>w(e)),C=t.useRef(!1),S=!y||g||!!y.closest("form"),[A,D]=(0,n.i)({prop:d,defaultProp:null!=c&&c,onChange:b,caller:m});return(0,u.jsxs)(f,{scope:s,checked:A,disabled:p,children:[(0,u.jsx)(o.sG.button,{type:"button",role:"switch","aria-checked":A,"aria-required":h,"data-state":N(A),"data-disabled":p?"":void 0,disabled:p,value:x,...j,ref:k,onClick:(0,l.m)(e.onClick,e=>{D(e=>!e),S&&(C.current=e.isPropagationStopped(),C.current||e.stopPropagation())})}),S&&(0,u.jsx)(v,{control:y,bubbles:!C.current,name:i,value:x,checked:A,required:h,disabled:p,form:g,style:{transform:"translateX(-100%)"}})]})});b.displayName=m;var g="SwitchThumb",j=t.forwardRef((e,a)=>{let{__scopeSwitch:s,...t}=e,l=x(g,s);return(0,u.jsx)(o.sG.span,{"data-state":N(l.checked),"data-disabled":l.disabled?"":void 0,...t,ref:a})});j.displayName=g;var v=t.forwardRef((e,a)=>{let{__scopeSwitch:s,control:l,checked:i,bubbles:n=!0,...o}=e,m=t.useRef(null),h=(0,r.s)(m,a),p=(0,d.Z)(i),f=(0,c.X)(l);return t.useEffect(()=>{let e=m.current;if(!e)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(p!==i&&a){let s=new Event("click",{bubbles:n});a.call(e,i),e.dispatchEvent(s)}},[p,i,n]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...o,tabIndex:-1,ref:h,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function N(e){return e?"checked":"unchecked"}v.displayName="SwitchBubbleInput";var y=b,w=j},33789:(e,a,s)=>{s.d(a,{p:()=>i});var t=s(95155),l=s(12115),r=s(25016);let i=l.forwardRef((e,a)=>{let{className:s,type:l,...i}=e;return(0,t.jsx)("input",{type:l,className:(0,r.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:a,...i})});i.displayName="Input"},47507:(e,a,s)=>{s.d(a,{bq:()=>m,eb:()=>x,gC:()=>f,l6:()=>o,yv:()=>u});var t=s(95155),l=s(12115),r=s(47887),i=s(24033),n=s(12108),d=s(5917),c=s(25016);let o=r.bL;r.YJ;let u=r.WT,m=l.forwardRef((e,a)=>{let{className:s,children:l,...n}=e;
1return(0,t.jsxs)(r.l9,{ref:a,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...n,children:[l,(0,t.jsx)(r.In,{asChild:!0,children:(0,t.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.l9.displayName;let h=l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.PP,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,t.jsx)(n.A,{className:"h-4 w-4"})})});h.displayName=r.PP.displayName;let p=l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.wn,{ref:a,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",s),...l,children:(0,t.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=r.wn.displayName;let f=l.forwardRef((e,a)=>{let{className:s,children:l,position:i="popper",...n}=e;return(0,t.jsx)(r.ZL,{children:(0,t.jsxs)(r.UC,{ref:a,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:i,...n,children:[(0,t.jsx)(h,{}),(0,t.jsx)(r.LM,{className:(0,c.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l}),(0,t.jsx)(p,{})]})})});f.displayName=r.UC.displayName,l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.JU,{ref:a,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...l})}).displayName=r.JU.displayName;let x=l.forwardRef((e,a)=>{let{className:s,children:l,...i}=e;return(0,t.jsxs)(r.q7,{ref:a,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...i,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(r.VF,{children:(0,t.jsx)(d.A,{className:"h-4 w-4"})})}),(0,t.jsx)(r.p4,{children:l})]})});x.displayName=r.q7.displayName,l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.wv,{ref:a,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",s),...l})}).displayName=r.wv.displayName},68269:(e,a,s)=>{s.d(a,{Y:()=>i});var t=s(95155),l=s(90235),r=s(7235);function i(e){let{useSliders:a,onToggle:s,className:i=""}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2 ".concat(i),children:[(0,t.jsx)(l.J,{htmlFor:"use-sliders",className:"cursor-pointer",children:"Use Sliders"}),(0,t.jsx)(r.Switch,{id:"use-sliders",checked:a,onCheckedChange:s})]})}},80019:(e,a,s)=>{s.d(a,{b:()=>d});var t=s(30390),l=s(47643),r=s(47734),i=s(73697),n=s(36164),d=(0,t.gu)({chartName:"LineChart",GraphicalChild:l.N,axisComponents:[{axisType:"xAxis",AxisComp:r.W},{axisType:"yAxis",AxisComp:i.h}],formatAxisMap:n.pr})},83101:(e,a,s)=>{s.d(a,{F:()=>i});var t=s(2821);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,r=t.$,i=(e,a)=>s=>{var t;if((null==a?void 0:a.variants)==null)return r(e,null==s?void 0:s.class,null==s?void 0:s.className);let{variants:i,defaultVariants:n}=a,d=Object.keys(i).map(e=>{let a=null==s?void 0:s[e],t=null==n?void 0:n[e];if(null===a)return null;let r=l(a)||l(t);return i[e][r]}),c=s&&Object.entries(s).reduce((e,a)=>{let[s,t]=a;return void 0===t||(e[s]=t),e},{});return r(e,d,null==a||null==(t=a.compoundVariants)?void 0:t.reduce((e,a)=>{let{class:s,className:t,...l}=a;return Object.entries(l).every(e=>{let[a,s]=e;return Array.isArray(s)?s.includes({...n,...c}[a]):({...n,...c})[a]===s})?[...e,s,t]:e},[]),null==s?void 0:s.class,null==s?void 0:s.className)}},87060:(e,a,s)=>{s.d(a,{A:()=>n});var t=s(95155),l=s(12115),r=s(83026),i=s(25016);let n=l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsxs)(r.bL,{ref:a,className:(0,i.cn)("relative flex w-full touch-none select-none items-center",s
1),...l,children:[(0,t.jsx)(r.CC,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,t.jsx)(r.Q6,{className:"absolute h-full bg-primary"})}),(0,t.jsx)(r.zi,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]})});n.displayName=r.bL.displayName},90235:(e,a,s)=>{s.d(a,{J:()=>c});var t=s(95155),l=s(12115),r=s(10489),i=s(83101),n=s(25016);let d=(0,i.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=l.forwardRef((e,a)=>{let{className:s,...l}=e;return(0,t.jsx)(r.b,{ref:a,className:(0,n.cn)(d(),s),...l})});c.displayName=r.b.displayName}}]);

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.