PageSourceSearch

https://expensasaurus.vercel.app/_next/static/chunks/7567-43c7e6a1b57bc4c0.js

js expensasaurus.vercel.app collected 2026-10-03 06:56:28 UTC 7,477 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7567],{33254:function(e,t,n){n.d(t,{l:function(){return p},Z:function(){return v}});var r=n(85893),a=n(12879),o=n(86010),u=n(7069),l=n(38148),s=n(54943),c=n(66891);let i=[{date:"",amount:100},{date:"",amount:150},{date:"",amount:20},{date:"",amount:50},{date:"",amount:80},{date:"",amount:60},{date:"",amount:20},{date:"",amount:100},{date:"",amount:45},{date:"",amount:78},{date:"",amount:29},{date:"",amount:40},{date:"",amount:28},{date:"",amount:49},{date:"",amount:56},{date:"",amount:23},{date:"",amount:19},{date:"",amount:89},{date:"",amount:43},{date:"",amount:67}];var d=n(85137),m=n(98516),f=n(26459),h=n(34663),g=n(67294),x=n(76248);let b=()=>{let{activeMonth:e}=(0,f.s)(),[t,n]=(0,g.useState)("Max"),{user:o,userInfo:s}=(0,m.t)(e=>({user:e.user,userInfo:e.userInfo}),x.X),{data:i,isSuccess:b}=(0,d.Tr)(["Expenses","Stats this month",e,null==o?void 0:o.userId],[c.CG.DB_ID,c.CG.COLLECTIONS.EXPENSES,[]],{enabled:!1}),p=(0,g.useMemo)(()=>(null==i?void 0:i.documents.map(e=>{let t=new Date(e.date),n=t.getDate()+"."+(t.getMonth()+1)+"."+t.getFullYear();return{date:n,amount:e.amount,category:e.category}}))||[],[null==i?void 0:i.documents]),v=e=>{if(!e)return new Date;let[t,n,r]=e.split(".").map(Number);return new Date(r,n-1,t)},y=(e,t)=>p.filter(n=>{let r=v(n.date);return r>=e&&r<=t}),w=e=>{var t;return(0,h.Y)(null==s?void 0:null===(t=s.prefs)||void 0===t?void 0:t.currency,e)};return(0,r.jsxs)(a.Zb,{className:"box-shadow-card",children:[(0,r.jsx)(a.Dx,{children:"Expense"}),(0,r.jsx)(a.xv,{children:"This Month"}),b&&(0,r.jsx)(a.wW,{className:"h-80 mt-8",data:(e=>{var t;let n=v(null===(t=p[p.length-1])||void 0===t?void 0:t.date);if(n)switch(e){case"1M":{let e=(0,u.Z)(n,30);return y(e,n)}case"2M":{let e=(0,u.Z)(n,60);return y(e,n)}case"6M":{let e=(0,u.Z)(n,180);return y(e,n)}case"YTD":{let e=(0,l.Z)(n);return y(e,n)}default:return p}})(t)||[],index:"date",curveType:"natural",categories:["amount"],colors:["blue"],valueFormatter:w,showLegend:!1,yAxisWidth:80,showXAxis:!0})]})},p=e=>{let{animate:t=!0}=e;return(0,r.jsxs)("div",{className:(0,o.Z)(t&&"before:animate-[shimmer_2s_infinite]","relative mb-5 w-full overflow-hidden rounded-2xl bg-white/10 p-6 shadow-xl shadow-black/5 dark:bg-slate-900/70 before:absolute before:inset-0 before:-translate-x-full before:border-t before:border-slate-100 before:bg-gradient-to-r before:from-transparent before:via-slate-50/50 before:to-transparent dark:before:border-white/10 dark:before:via-slate-300/10"),children:[(0,r.jsx)("div",{className:(0,o.Z)("mb-2 h-[20px] w-[100px] rounded-full bg-slate-500/20 dark:bg-slate-700/70",t?"opacity-40":"opacity-5"),children:"\xa0"}),(0,r.jsx)("div",{className:(0,o.Z)("h-[12px] w-[100px] rounded-full bg-slate-500/20 dark:bg-slate-700/55",t?"opacity-40":"opacity-5"),children:"\xa0"}),!t&&(0,r.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center flex-col",children:[(0,r.jsx)(a.Dx,{className:"mb-5 mt-[-100px]",children:"Select a Category"}),(0,r.jsx)(a.QE,{className:"w-[80%] sm:w-[40%] text-center",children:"No category selected. Please choose a category from the dropdown to view the corresponding chart."})]}),(0,r.jsx)(a.wW,{className:(0,o.Z)("h-80 mt-8 z-[-1] relative",t?"opacity-40":"opacity-5"),data:i,curveType:"natural",index:"date",categories:["amount"],colors:["slate"],valueFormatter:s.mH,showLegend:!1,yAxisWidth:60,showXAxis:!0})]})};var v=b},54943:function(e,t,n){n.d(t,{GG:function(){return c},ZN:function(){return u},dK:function(){return s},mH:function(){return l}});var r=n(32912),a=n(66891);let o=()=>{let e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).toISOString(),n=new Date(e.getFullYear(),e.getMonth()+1,1).toISOString(),r=new Date(e.getFullYear(),e.getMonth()-1,1).toISOString(),a=new Date(e.getFullYear(),e.getMonth(),1).toISOString();return{startOfThisMonth:t,endOfThisMonth:n,startOfEarlierMonth:r,endOfEarlierMonth:a}},u=e=>{let t=a.e7.findIndex(t=>t===e),n=new Date,r=new Date(n.getFullYear(),t,1).toISOString(),o=new Date(n.getFullYear(),t+1,1).toISOString(),u=new Date(n.getFullYear(),t-1,1).toISOString(),l=new Date(n.getFullYear(),t,1).toISOString();return{startOfTheMonth:r,endOfTheMonth:o,startOfEarlierMonth:u,endOfEarlierMonth:l}},l=e=>"$ ".concat(Intl.NumberFormat("us").format(e).toString()),s=(0,r.Z)(new Date,"MMMM"),c=new Date().getMonth().toString();t.ZP=o},85137:function(e,t,n){n.d(t,{QT:function(){return c},Tr:function(){return s},oe:function(){return i}});var r=n(88767),a=n(58533);let o=(e,t,n)=>(0,r.useQuery)(e,async()=>a.Fs.listDocuments(...t).then(e=>e),{refetchOnWindowFocus:!1,retry:!1,...n}
1),u=(e,t,n)=>(0,r.useQuery)(e,async()=>a.Fs.getDocument(...t).then(e=>e),{refetchOnWindowFocus:!1,retry:!1,...n}),l=(e,t,n)=>(0,r.useMutation)(e,async()=>a.Fs.deleteDocument(...t).then(e=>e),n),s=(e,t,n)=>o(e,t,n),c=(e,t,n)=>u(e,t,n),i=(e,t,n)=>l(e,t,n)},26459:function(e,t,n){n.d(t,{s:function(){return u}});var r=n(54943),a=n(64529),o=n(66891);let u=(0,a.Ue)((e,t)=>({activeMonth:o.lQ[r.GG],setActiveMonth:t=>e({activeMonth:t})}))},17766:function(e,t,n){n.d(t,{ND:function(){return o},Q_:function(){return l},i:function(){return s},nb:function(){return u},yT:function(){return a}});var r=n(5730);let a=e=>{let t={min:1/0,max:0,avg:0,sum:0};return e.forEach(e=>{t.min=Math.min(t.min,e.amount),t.max=Math.max(t.max,e.amount),t.sum+=e.amount}),t.avg=t.sum/e.length,t.min===1/0&&(t.min=0),t};function o(e,t,n){let r=n-t,a=r/Math.abs(t)*100,o=r>0?"moderateIncrease":r<0?"moderateDecrease":"unchanged";return"expense"===e&&(o=r>0?"moderateDecrease":"moderateIncrease"),(isNaN(a)||!isFinite(a))&&(a=0),{percentage:a,transactionChange:o,change:r}}function u(e){let t={},n=e.reduce((e,t)=>e+t.amount,0);for(let n of e){let{amount:r,category:a}=n;t[a]||(t[a]={amount:0,transactionsCount:0,percentage:0,currency:e[0].currency}),t[a].amount+=r,t[a].transactionsCount+=1}for(let r in t){let{amount:a}=t[r];t[r].percentage=a/n*100,t[r].currency=e[0].currency}return t}function l(e){let t={},n=e.reduce((e,t)=>e+t.amount,0);for(let n of(e.length&&r.bd.forEach(n=>{t[n.key]={amount:0,transactionsCount:0,percentage:0,currency:e[0].currency}}),e)){let{amount:r,category:a}=n;t[a]||(t[a]={amount:0,transactionsCount:0,percentage:0,currency:e[0].currency}),t[a].amount+=r,t[a].transactionsCount+=1}for(let r in t){let{amount:a}=t[r];t[r].percentage=a/n*100,t[r].currency=e[0].currency}return t}function s(e,t){let n={};for(let r of e){let{amount:e,category:a}=r;if(n[a]||(n[a]={totalExpenses:0,percentageChange:0,absolutePrevValue:0,absoluteCurrValue:0,eitherMonthHasNoExpenses:!1}),n[a].totalExpenses+=e,n[a].absoluteCurrValue=n[a].totalExpenses,t[a]){let e=t[a].amount,r=n[a].totalExpenses,o=r-e,u=o/e*100;n[a].percentageChange=u,n[a].absolutePrevValue=e}}return n}},34663:function(e,t,n){n.d(t,{Y:function(){return r},x:function(){return a}});let r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"INR",t=arguments.length>1?arguments[1]:void 0,n=new Intl.NumberFormat("en-US",{style:"currency",currency:e});return n.format(t)},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"INR",t=arguments.length>1?arguments[1]:void 0;if(!Number.isFinite(t))return r(e,0);if(1e3>Math.abs(t))return r(e,t);let n=new Intl.NumberFormat("en-US",{style:"currency",currency:e,notation:"compact",compactDisplay:"short",maximumFractionDigits:1});return n.format(t).replace(/([A-Z])$/,e=>e.toLowerCase())}}}]);

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.