ownledger 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/assets/index.html +10 -10
  3. package/assets/static/{Account-sw3qGLbB.js → Account-CYrXDU9Z.js} +1 -1
  4. package/assets/static/{Accounts-DWyzX3qB.js → Accounts-BXleOwUO.js} +1 -1
  5. package/assets/static/{Attention-DxV-4qdY.js → Attention-Ci3luOdE.js} +1 -1
  6. package/assets/static/{ByCategory-B4P3ikmE.js → ByCategory-cLVOyjwd.js} +1 -1
  7. package/assets/static/{CardDetail-CayBXBm-.js → CardDetail-BxXfAcMp.js} +1 -1
  8. package/assets/static/{Cards-CVuOP8Bt.js → Cards-DNtITMnA.js} +1 -1
  9. package/assets/static/{Cards-XUBdWxyo.js → Cards-DnIsAWPD.js} +1 -1
  10. package/assets/static/{CardsValue-EoW2jG_0.js → CardsValue-V1-fYMLf.js} +1 -1
  11. package/assets/static/{Cashback-BibVYHf_.js → Cashback-B8lqwRnb.js} +1 -1
  12. package/assets/static/{CategoryIcon-HfjYhH1l.js → CategoryIcon-D4Cdb_ZP.js} +1 -1
  13. package/assets/static/{CategoryPicker-BkmvzX2I.js → CategoryPicker-54vkuxVh.js} +1 -1
  14. package/assets/static/{ChartWidget-u09-whUU.js → ChartWidget-S5F4Ze91.js} +1 -1
  15. package/assets/static/{Combobox-xXeyjGgK.js → Combobox-BvX68J3o.js} +1 -1
  16. package/assets/static/{Deposits-CLAda4dj.js → Deposits-Ct5HhCEc.js} +1 -1
  17. package/assets/static/{DrillLink-Bvfam9FA.js → DrillLink-CZyI-y0-.js} +1 -1
  18. package/assets/static/{Field-tKFmKDEF.js → Field-DYmqEAlI.js} +1 -1
  19. package/assets/static/{HomeEditor-4vxj5LMD.js → HomeEditor-Dv-h_ql-.js} +1 -1
  20. package/assets/static/{Import-DwaaFpRJ.js → Import-B2uhVnEm.js} +1 -1
  21. package/assets/static/{IncomeSpending-RVDSxAK4.js → IncomeSpending-DNT2CWH9.js} +1 -1
  22. package/assets/static/{KV-DMA1AlP-.js → KV-CKWaJkRK.js} +1 -1
  23. package/assets/static/{Left-C_4gTGSX.js → Left-BefXZztB.js} +1 -1
  24. package/assets/static/{Money-PfFNNDOw.js → Money-BwLucm7P.js} +1 -1
  25. package/assets/static/{NetWorth-BSoseczC.js → NetWorth-DeLSapZ2.js} +1 -1
  26. package/assets/static/{Pace-B8p-9174.js → Pace-D6gilOBZ.js} +1 -1
  27. package/assets/static/{Panel-BnfWrw9R.js → Panel-CSe25x0N.js} +1 -1
  28. package/assets/static/{PinDialog-BqAU9Vh4.js → PinDialog-CHiLIKEs.js} +1 -1
  29. package/assets/static/{Plans-2KuQH2_I.js → Plans-D7rJ1yHU.js} +1 -1
  30. package/assets/static/{Recent-Ccmb34bq.js → Recent-Dcqb2yko.js} +1 -1
  31. package/assets/static/{Reports-Dd-dhclr.js → Reports--PDAEnQM.js} +1 -1
  32. package/assets/static/{Settings-BR8WBlen.js → Settings-Bd0oglWl.js} +1 -1
  33. package/assets/static/{Transactions-BAuQ-6Eb.js → Transactions-CQ1yQ1UU.js} +1 -1
  34. package/assets/static/{TxRow-EKIIMQKa.js → TxRow-BGfpKo2m.js} +1 -1
  35. package/assets/static/{Unusual-CwFp8aA5.js → Unusual-DGB4ZOA2.js} +1 -1
  36. package/assets/static/{Upcoming-B28roT9r.js → Upcoming-B0HwBqmG.js} +1 -1
  37. package/assets/static/{WhichCard-B3kLc842.js → WhichCard-BefFKS2q.js} +1 -1
  38. package/assets/static/{arrow-up-D3gxUKLo.js → arrow-up-CRgLRKET.js} +1 -1
  39. package/assets/static/{bits-Dr2E0ObC.js → bits-D34d9IBm.js} +1 -1
  40. package/assets/static/{button-rfwMVz0i.js → button-BKhMn8jX.js} +1 -1
  41. package/assets/static/{cards-Bb5zjzRG.js → cards-Ct0jh73r.js} +1 -1
  42. package/assets/static/{charts-BqP7HKwP.js → charts-D-1glV8L.js} +1 -1
  43. package/assets/static/chevron-down-BWoQwA6m.js +1 -0
  44. package/assets/static/chevron-right-D7Sgw1v1.js +1 -0
  45. package/assets/static/{createLucideIcon-flJrJK2p.js → createLucideIcon-XZ28znwT.js} +1 -1
  46. package/assets/static/{dialog-BuRqO4sc.js → dialog-Bx-cd-2e.js} +1 -1
  47. package/assets/static/{dist-B4_eGtNj.js → dist--HKr0kfV.js} +1 -1
  48. package/assets/static/{dist-B7PR2b0C.js → dist-BFPyD74_.js} +1 -1
  49. package/assets/static/{dist-BDn7ydjn.js → dist-CmbuesVk.js} +1 -1
  50. package/assets/static/{dist-Dl-m8cc2.js → dist-vgyaCpaL.js} +1 -1
  51. package/assets/static/{es2015-DJh4h8NX.js → es2015-DqY4UvQc.js} +1 -1
  52. package/assets/static/{index-eR1GkdC_.js → index-DBHFdsYB.js} +4 -4
  53. package/assets/static/{queries-DZIMMe4i.js → queries-BcMmmb36.js} +1 -1
  54. package/assets/static/{react-dom-wK_7mEjs.js → react-dom-5dgiSOdd.js} +1 -1
  55. package/assets/static/{select-eaSi9K-d.js → select-B5P2TaPX.js} +1 -1
  56. package/assets/static/{shared-Box7on3B.js → shared-BgU6fc7z.js} +1 -1
  57. package/assets/static/{triangle-exclamation-point-CuL0XSJl.js → triangle-exclamation-point-CMy18kC0.js} +1 -1
  58. package/assets/static/{useMutation-_Lw8xXWa.js → useMutation-aC3Z1p9y.js} +1 -1
  59. package/dist/modules/cards/files.d.ts +1 -1
  60. package/dist/modules/cards/files.js +1 -1
  61. package/dist/worker/api.js +12 -5
  62. package/dist/worker/github.d.ts +18 -1
  63. package/dist/worker/github.js +53 -6
  64. package/dist/worker/store.js +1 -1
  65. package/dist/worker/version.d.ts +1 -1
  66. package/dist/worker/version.js +1 -1
  67. package/package.json +1 -1
  68. package/assets/static/chevron-down-Co1w7ApZ.js +0 -1
  69. package/assets/static/chevron-right-Dqh3vs9Y.js +0 -1
  70. package/dist/worker/tar.d.ts +0 -3
  71. package/dist/worker/tar.js +0 -65
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.1 (2026-11-23)
4
+
5
+ - **Fix: the dashboard failed to load ("Could not load data:" with no reason) once statement PDFs were filed.** The
6
+ Worker read each new commit from the repo's whole tarball, PDFs included, and ran past Cloudflare's CPU limit. It now
7
+ lists the repo's files (one call) and reads only `data/` and `imports/*.mapping.yaml` (one GraphQL call per 100
8
+ files); statement PDFs and raw exports are never downloaded. Same GitHub App permissions.
9
+ - **Clear errors:** when the data repo can't be loaded, `/api/*` answers JSON with the reason (502) instead of a bare
10
+ 500, and the dashboard shows the HTTP status when an answer isn't JSON (e.g. Cloudflare's own 503 page).
11
+
3
12
  ## 2.1.0 (2026-11-23)
4
13
 
5
14
  Bank statements, optional. Data format stays 1: a repo without statements works as it does now.
package/assets/index.html CHANGED
@@ -9,16 +9,16 @@
9
9
  <link rel="icon" href="/icon.svg" type="image/svg+xml">
10
10
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">
11
11
  <meta name="apple-mobile-web-app-title" content="ownledger">
12
- <script type="module" crossorigin src="/static/index-eR1GkdC_.js"></script>
13
- <link rel="modulepreload" crossorigin href="/static/queries-DZIMMe4i.js">
14
- <link rel="modulepreload" crossorigin href="/static/react-dom-wK_7mEjs.js">
15
- <link rel="modulepreload" crossorigin href="/static/button-rfwMVz0i.js">
16
- <link rel="modulepreload" crossorigin href="/static/dist-BDn7ydjn.js">
17
- <link rel="modulepreload" crossorigin href="/static/es2015-DJh4h8NX.js">
18
- <link rel="modulepreload" crossorigin href="/static/dist-B7PR2b0C.js">
19
- <link rel="modulepreload" crossorigin href="/static/createLucideIcon-flJrJK2p.js">
20
- <link rel="modulepreload" crossorigin href="/static/dist-Dl-m8cc2.js">
21
- <link rel="modulepreload" crossorigin href="/static/dist-B4_eGtNj.js">
12
+ <script type="module" crossorigin src="/static/index-DBHFdsYB.js"></script>
13
+ <link rel="modulepreload" crossorigin href="/static/queries-BcMmmb36.js">
14
+ <link rel="modulepreload" crossorigin href="/static/react-dom-5dgiSOdd.js">
15
+ <link rel="modulepreload" crossorigin href="/static/button-BKhMn8jX.js">
16
+ <link rel="modulepreload" crossorigin href="/static/dist-CmbuesVk.js">
17
+ <link rel="modulepreload" crossorigin href="/static/es2015-DqY4UvQc.js">
18
+ <link rel="modulepreload" crossorigin href="/static/dist-BFPyD74_.js">
19
+ <link rel="modulepreload" crossorigin href="/static/createLucideIcon-XZ28znwT.js">
20
+ <link rel="modulepreload" crossorigin href="/static/dist-vgyaCpaL.js">
21
+ <link rel="modulepreload" crossorigin href="/static/dist--HKr0kfV.js">
22
22
  <link rel="stylesheet" crossorigin href="/static/index-iYMxgw-7.css">
23
23
  </head>
24
24
  <body>
@@ -1 +1 @@
1
- import{B as e,I as t,L as n,d as r,m as i,u as a,w as o}from"./queries-DZIMMe4i.js";import{a as s,i as c,t as l}from"./charts-BqP7HKwP.js";import{t as u}from"./DrillLink-Bvfam9FA.js";import{t as d}from"./Money-PfFNNDOw.js";import{M as f,a as p,l as m}from"./index-eR1GkdC_.js";var h=e(t(),1),g=n();function _({widget:e,menu:t}){let{t:n,lang:_}=o(),v=r().data,y=e.account,b=a().data,x=y===`pool`?b?.pool?.name||n(`pool.name`):v?.accounts.find(e=>e.id===y)?.name,S=e.title?.trim()||x||n(`widget.account`),{data:C,error:w,isLoading:T}=i({metric:`balance`,account:y??``,by:`month`,period:`last-12-months`},!!y),E=(0,h.useMemo)(()=>(C?.points??[]).map(e=>({ym:e.key,v:e.value})),[C]),D=E[E.length-1];return(0,g.jsx)(f,{title:S,titleHref:y?`#/transactions?account=${encodeURIComponent(y)}`:void 0,menu:t,loading:!!y&&T,error:y?w?.message:void 0,empty:y?C&&E.length===0?n(`account.empty`):void 0:n(`account.pick`),children:D&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(u,{filter:{account:y},className:`text-2xl font-semibold tracking-tight`,children:(0,g.jsx)(d,{amount:D.v})}),(0,g.jsx)(l,{table:{head:[n(`chart.month`),n(`account.balance`)],rows:E.map(e=>[p(e.ym),m(e.v,_)])},children:(0,g.jsx)(c,{data:E,xKey:`ym`,formatX:e=>p(String(e)),specs:[{key:`v`,label:n(`account.balance`),kind:`line`,color:s.accent}]})})]})})}export{_ as default};
1
+ import{B as e,I as t,L as n,d as r,m as i,u as a,w as o}from"./queries-BcMmmb36.js";import{a as s,i as c,t as l}from"./charts-D-1glV8L.js";import{t as u}from"./DrillLink-CZyI-y0-.js";import{t as d}from"./Money-BwLucm7P.js";import{M as f,a as p,l as m}from"./index-DBHFdsYB.js";var h=e(t(),1),g=n();function _({widget:e,menu:t}){let{t:n,lang:_}=o(),v=r().data,y=e.account,b=a().data,x=y===`pool`?b?.pool?.name||n(`pool.name`):v?.accounts.find(e=>e.id===y)?.name,S=e.title?.trim()||x||n(`widget.account`),{data:C,error:w,isLoading:T}=i({metric:`balance`,account:y??``,by:`month`,period:`last-12-months`},!!y),E=(0,h.useMemo)(()=>(C?.points??[]).map(e=>({ym:e.key,v:e.value})),[C]),D=E[E.length-1];return(0,g.jsx)(f,{title:S,titleHref:y?`#/transactions?account=${encodeURIComponent(y)}`:void 0,menu:t,loading:!!y&&T,error:y?w?.message:void 0,empty:y?C&&E.length===0?n(`account.empty`):void 0:n(`account.pick`),children:D&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(u,{filter:{account:y},className:`text-2xl font-semibold tracking-tight`,children:(0,g.jsx)(d,{amount:D.v})}),(0,g.jsx)(l,{table:{head:[n(`chart.month`),n(`account.balance`)],rows:E.map(e=>[p(e.ym),m(e.v,_)])},children:(0,g.jsx)(c,{data:E,xKey:`ym`,formatX:e=>p(String(e)),specs:[{key:`v`,label:n(`account.balance`),kind:`line`,color:s.accent}]})})]})})}export{_ as default};
@@ -1 +1 @@
1
- import{t as e}from"./chevron-down-Co1w7ApZ.js";import{t}from"./chevron-right-Dqh3vs9Y.js";import{B as n,I as r,L as i,T as a,a as o,d as s,o as c,t as l,u,w as d}from"./queries-DZIMMe4i.js";import{A as f,W as p,l as m,n as h,r as g,s as _,u as v}from"./index-eR1GkdC_.js";import{t as y}from"./Money-PfFNNDOw.js";import{o as b,r as x}from"./bits-Dr2E0ObC.js";import{a as S,i as C,n as w,o as T,r as E,s as D}from"./dist-BDn7ydjn.js";import{n as O,s as k}from"./button-rfwMVz0i.js";import{t as A}from"./dist-B7PR2b0C.js";import{n as j,r as M,t as N}from"./dist-B4_eGtNj.js";import{t as P}from"./dist-Dl-m8cc2.js";import{t as F}from"./cards-Bb5zjzRG.js";import{t as ee}from"./drill-t1zr57xi.js";var I=n(r(),1),L=i(),R=Object.defineProperty,z=(e,t)=>R(e,`name`,{value:t,configurable:!0}),B=`Collapsible`,[te,ne]=T(B),[re,V]=te(B),ie=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=E({prop:r,defaultProp:i??!1,onChange:o,caller:B});return(0,L.jsx)(re,{scope:n,disabled:a,contentId:w(),open:c,onOpenToggle:I.useCallback(()=>l(e=>!e),[l]),children:(0,L.jsx)(D.div,{"data-state":U(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ae=`CollapsibleTrigger`,oe=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,...r}=e,i=V(ae,n);return(0,L.jsx)(D.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":U(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:C(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),H=`CollapsibleContent`,se=I.forwardRef(z(function(e,t){let{forceMount:n,...r}=e,i=V(H,e.__scopeCollapsible);return(0,L.jsx)(A,{present:n||i.open,children:({present:e})=>(0,L.jsx)(ce,{...r,ref:t,present:e})})},`CollapsibleContent`)),ce=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=V(H,n),[s,c]=I.useState(r),l=I.useRef(null),u=k(t,l),d=I.useRef(0),f=d.current,p=I.useRef(0),m=p.current,h=o.open||s,g=I.useRef(h),_=I.useRef(void 0);return I.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),S(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,L.jsx)(D.div,{"data-state":U(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function U(e){return e?`open`:`closed`}z(U,`getState`);var le=Object.defineProperty,W=(e,t)=>le(e,`name`,{value:t,configurable:!0}),G={Automatic:`automatic`,Manual:`manual`},K=`Tabs`,[ue,de]=T(K,[M]),fe=M(),[pe,q]=ue(K),me=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=G.Automatic,...l}=e,u=P(s),[d,f]=E({prop:r,onChange:i,defaultProp:a??``,caller:K});return(0,L.jsx)(pe,{scope:n,baseId:w(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,L.jsx)(D.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),he=`TabsList`,ge=I.forwardRef(W(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=q(he,n),o=fe(n);return(0,L.jsx)(N,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,L.jsx)(D.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),_e=`TabsTrigger`,ve=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=q(_e,n),s=fe(n),c=J(o.baseId,r),l=Y(o.baseId,r),u=r===o.value;return(0,L.jsx)(j,{asChild:!0,...s,focusable:!i,active:u,children:(0,L.jsx)(D.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:C(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:C(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:C(e.onFocus,()=>{let e=o.activationMode!==G.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),ye=`TabsContent`,be=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=q(ye,n),c=J(s.baseId,r),l=Y(s.baseId,r),u=r===s.value,d=I.useRef(u);return I.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,L.jsx)(A,{present:i||u,children:({present:n})=>(0,L.jsx)(D.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function J(e,t){return`${e}-trigger-${t}`}W(J,`makeTriggerId`);function Y(e,t){return`${e}-content-${t}`}W(Y,`makeContentId`);function xe({...e}){return(0,L.jsx)(ie,{"data-slot":`collapsible`,...e})}function Se({...e}){return(0,L.jsx)(oe,{"data-slot":`collapsible-trigger`,...e})}function Ce({...e}){return(0,L.jsx)(se,{"data-slot":`collapsible-content`,...e})}function we({className:e,orientation:t=`horizontal`,...n}){return(0,L.jsx)(me,{"data-slot":`tabs`,"data-orientation":t,className:a(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Te=O(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Ee({className:e,variant:t=`default`,...n}){return(0,L.jsx)(ge,{"data-slot":`tabs-list`,"data-variant":t,className:a(Te({variant:t}),e),...n})}function X({className:e,...t}){return(0,L.jsx)(ve,{"data-slot":`tabs-trigger`,className:a(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Z({className:e,...t}){return(0,L.jsx)(be,{"data-slot":`tabs-content`,className:a(`flex-1 text-sm outline-none`,e),...t})}var De=90,Oe=[`var(--chart-1)`,`var(--chart-2)`,`var(--chart-3)`,`var(--chart-4)`,`var(--chart-5)`],Q=e=>Math.abs(e.value);function ke({children:e,tone:t}){return(0,L.jsx)(`span`,{className:a(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,t===`warn`?`bg-warning/10 text-warning`:`bg-secondary text-secondary-foreground`),children:e})}function Ae({a:e,holdings:t,card:n,deposit:r,nested:i}){let{t:o,lang:s}=d();return(0,L.jsxs)(`li`,{className:a(`relative flex flex-col gap-1 rounded-md py-1.5 hover:bg-muted/40 focus-within:ring-3 focus-within:ring-ring/50`,i?`pl-4`:`px-2`),children:[(0,L.jsxs)(`div`,{className:`flex min-h-11 items-center justify-between gap-3`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`a`,{href:ee({account:e.id}),className:`truncate rounded-md text-sm font-medium outline-none after:absolute after:inset-0 focus-visible:underline`,children:e.name}),e.closed&&(0,L.jsx)(ke,{children:o(`accounts.closedOn`,{date:_(e.closed,s)})}),t&&!e.priced&&(0,L.jsx)(ke,{tone:`warn`,children:o(`accounts.noPrice`)})]}),(0,L.jsx)(y,{amount:e.value,mode:`short`,className:`shrink-0 text-sm font-medium`})]}),t&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[e.qty!==null&&(0,L.jsx)(L.Fragment,{children:o(`accounts.qty`,{n:m(e.qty,s,4)})}),e.price&&(0,L.jsxs)(L.Fragment,{children:[` · `,o(`accounts.price`,{price:v(e.price.price,s),date:h(e.price.date)})]}),` · `,o(`accounts.cost`),` `,(0,L.jsx)(y,{amount:e.cost,mode:`short`})]}),n&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(b,{owed:n.owed,limit:n.limit,atLeast:n.limitAtLeast}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground`,children:[n.toPay>0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[o(`cards.toPay`),` `,(0,L.jsx)(y,{amount:n.toPay,mode:`short`,className:`font-medium text-foreground`})]}),n.due&&(0,L.jsx)(`span`,{children:h(n.due)}),(0,L.jsx)(x,{days:n.daysToDue})]}):(0,L.jsx)(`span`,{children:o(`cards.nothingToPay`)}),(0,L.jsx)(`a`,{href:F(n.account),className:`relative z-10 ml-auto inline-flex min-h-11 items-center rounded-md px-1 underline outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:o(`accounts.cardPage`)})]})]}),r&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r.maturity?`${r.daysToMaturity<0?o(`deposits.matured`):o(`deposits.inDays`,{n:r.daysToMaturity})} · ${h(r.maturity)}`:o(`deposits.noMaturity`),r.rate!==null&&` · ${m(r.rate,s,2)}%`,r.interestAtMaturity?(0,L.jsxs)(L.Fragment,{children:[` · `,o(`deposits.interest`),` `,(0,L.jsx)(y,{amount:r.interestAtMaturity,mode:`short`})]}):null]})]})}function je({open:n,onToggle:r,label:i,count:o,children:s,nested:c}){return(0,L.jsxs)(`div`,{className:a(`flex flex-col`,c&&`pl-4`),children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-11 items-center gap-1 rounded-md px-2 text-left text-sm text-muted-foreground outline-none hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[n?(0,L.jsx)(e,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(t,{className:`size-4`,"aria-hidden":!0}),i,` (`,o,`)`]}),n&&s]})}function Me(){let{t:n,lang:r}=d(),i=u().data,a=s().data,{data:h,error:_,isLoading:v}=l(),b=!!i?.features?.cards,x=o(b).data,S=c(!!i?.features?.deposits).data,C=i?.today??new Date().toISOString().slice(0,10),w=i?.pool,T=w?.name??n(`pool.name`),[E,D]=(0,I.useState)(!1),O=e=>a?.types[e]?.[r]??e,k=e=>!!a?.types[e]?.holdings,A=(0,I.useMemo)(()=>new Map((x?.cards??[]).map(e=>[e.account,e])),[x]),j=(0,I.useMemo)(()=>new Map((S??[]).map(e=>[e.account,e])),[S]),M=(0,I.useMemo)(()=>{let e=h??[],t=e=>!!a?.types[e.type]?.liability,n=e=>(t(e)||e.value<0)&&e.value<0,r=0,i=0,o=0;for(let t of e)(t.value!==0||t.qty)&&(n(t)?i+=t.value:r+=t.value,t.priced||o++);let s=e=>e.value===0&&!e.qty&&(e.lastActivity===null||g(e.lastActivity,C)>De),c=e.filter(e=>e.closed),l=e.filter(e=>!e.closed),u=w?.on?l.filter(e=>e.pool):[],d=l.filter(e=>!u.includes(e)),f=d.filter(s),p=d.filter(e=>!s(e)),m=p.filter(e=>t(e)||e.value<0),_=e=>A.get(e.id)?.daysToDue??1/0;m.sort((e,t)=>_(e)-_(t)||e.value-t.value);let v=new Map;for(let e of p.filter(e=>!m.includes(e))){let t=v.get(e.type)??{id:e.type,label:O(e.type),value:0,items:[]};t.items.push(e),t.value+=e.value,v.set(e.type,t)}let y=[...v.values()];for(let e of y)e.items.sort((e,t)=>Q(t)-Q(e));let b=u.filter(e=>!s(e)).sort((e,t)=>Q(t)-Q(e)),x=u.filter(s);u.length&&y.push({id:`pool`,label:T,value:u.reduce((e,t)=>e+t.value,0),items:b,pool:!0}),y.sort((e,t)=>t.value-e.value),y.forEach((e,t)=>e.color=e.value>0&&t<Oe.length?Oe[t]:`var(--chart-muted)`);let S=y.reduce((e,t)=>e+(t.pool?u.length:t.items.length),0);return{assets:r,liabilities:i,net:r+i,groups:y,debt:m,poolIdle:x,poolCount:u.length,assetCount:S,inactiveRest:f.sort((e,t)=>e.name.localeCompare(t.name)),closed:c.sort((e,t)=>(t.closed??``).localeCompare(e.closed??``)),unpriced:o,any:e.length>0}},[h,a,w?.on,T,C,r,A]);if(_)return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`common.error`,{message:_.message})});if(v||!h||!a)return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":`true`,children:[(0,L.jsx)(p,{className:`h-8 w-48`}),(0,L.jsx)(p,{className:`h-24 w-full`}),(0,L.jsx)(p,{className:`h-48 w-full`})]});if(!M.any)return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n(`accounts.title`)}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`accounts.empty`)}),(0,L.jsx)(f,{className:`self-start`,prompt:n(`start.s2.prompt`)})]});let N=(e,t)=>(0,L.jsx)(Ae,{a:e,nested:t,holdings:k(e.type),card:A.get(e.id),deposit:j.get(e.id)},e.id),P=M.groups.filter(e=>e.value>0),F=P.reduce((e,t)=>e+t.value,0),R=e=>F>0&&e>0?`${m(e/F*100,r)}%`:``,z=M.inactiveRest.length+M.closed.length;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n(`accounts.title`)}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`accounts.netWorth`)}),(0,L.jsx)(y,{amount:M.net,className:`text-3xl font-semibold tracking-tight md:text-4xl`}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n(`accounts.assets`),` `,(0,L.jsx)(y,{amount:M.assets,mode:`short`,className:`font-medium text-foreground`}),` · `,n(`accounts.liabilities`),` `,(0,L.jsx)(y,{amount:M.liabilities,mode:`short`,className:`font-medium text-foreground`})]}),M.unpriced>0&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`nw.unpriced`,{n:M.unpriced})})]}),P.length>0&&(0,L.jsx)(`div`,{className:`flex h-2.5 w-full gap-0.5 overflow-hidden rounded-full`,role:`img`,"aria-label":`${n(`accounts.byType`)}: ${P.map(e=>`${e.label} ${R(e.value)}`).join(`, `)}`,children:P.map(e=>(0,L.jsx)(`span`,{className:`h-full first:rounded-l-full last:rounded-r-full`,style:{width:`${e.value/F*100}%`,background:e.color},title:`${e.label} ${R(e.value)}`},e.id))}),(0,L.jsxs)(we,{defaultValue:`assets`,className:`gap-4`,children:[(0,L.jsxs)(Ee,{className:`h-10! w-full sm:w-fit`,children:[(0,L.jsxs)(X,{value:`assets`,className:`px-3`,children:[n(`accounts.assets`),(0,L.jsx)($,{n:M.assetCount})]}),M.debt.length>0&&(0,L.jsxs)(X,{value:`debt`,className:`px-3`,children:[n(`accounts.liabilities`),(0,L.jsx)($,{n:M.debt.length})]}),z>0&&(0,L.jsxs)(X,{value:`idle`,className:`px-3`,children:[n(`accounts.tabIdle`),(0,L.jsx)($,{n:z})]})]}),(0,L.jsx)(Z,{value:`assets`,children:(0,L.jsx)(`div`,{className:`grid items-start gap-3 md:grid-cols-2`,children:M.groups.map(r=>(0,L.jsxs)(xe,{className:`group/acc overflow-hidden rounded-xl bg-card ring-1 ring-foreground/[0.07] shadow-[0_1px_2px_oklch(0_0_0/0.04)]`,children:[(0,L.jsxs)(Se,{className:`flex min-h-14 w-full items-center gap-3 px-4 text-left outline-none hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-full`,style:{background:r.color}}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:[r.label,(0,L.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground tabular-nums`,children:r.pool?M.poolCount:r.items.length})]}),(0,L.jsx)(y,{amount:r.value,mode:`short`,className:`shrink-0 text-sm font-semibold`}),(0,L.jsx)(`span`,{className:`w-9 shrink-0 text-right text-xs text-muted-foreground tabular-nums`,children:R(r.value)}),(0,L.jsx)(e,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/acc:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,L.jsxs)(Ce,{className:`border-t px-2 py-1`,children:[r.pool&&(0,L.jsxs)(`a`,{href:ee({account:`pool`}),className:`flex min-h-11 items-center justify-between gap-2 rounded-md px-2 text-sm text-muted-foreground outline-none hover:bg-muted/40 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[n(`accounts.poolTx`,{name:T}),(0,L.jsx)(t,{className:`size-4`,"aria-hidden":!0})]}),(0,L.jsx)(`ul`,{className:`flex flex-col`,children:r.items.map(e=>N(e))}),r.pool&&M.poolIdle.length>0&&(0,L.jsx)(je,{open:E,onToggle:()=>D(e=>!e),label:n(`accounts.inactive`),count:M.poolIdle.length,children:(0,L.jsx)(`ul`,{className:`flex flex-col`,children:M.poolIdle.map(e=>N(e,!0))})})]})]},r.id))})}),M.debt.length>0&&(0,L.jsx)(Z,{value:`debt`,children:(0,L.jsx)(`ul`,{className:`grid items-start gap-3 md:grid-cols-2`,children:M.debt.map(e=>(0,L.jsx)(`li`,{className:`list-none rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] shadow-[0_1px_2px_oklch(0_0_0/0.04)]`,children:(0,L.jsx)(`ul`,{children:N(e)})},e.id))})}),z>0&&(0,L.jsxs)(Z,{value:`idle`,className:`flex flex-col gap-5`,children:[M.inactiveRest.length>0&&(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`px-2 text-sm font-medium text-muted-foreground`,children:[n(`accounts.inactive`),` `,(0,L.jsx)(`span`,{className:`tabular-nums`,children:M.inactiveRest.length})]}),(0,L.jsx)(`ul`,{className:`grid gap-x-6 rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] md:grid-cols-2`,children:M.inactiveRest.map(e=>N(e))})]}),M.closed.length>0&&(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`px-2 text-sm font-medium text-muted-foreground`,children:[n(`accounts.closed`),` `,(0,L.jsx)(`span`,{className:`tabular-nums`,children:M.closed.length})]}),(0,L.jsx)(`ul`,{className:`grid gap-x-6 rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] md:grid-cols-2`,children:M.closed.map(e=>N(e))})]})]})]})]})}function $({n:e}){return(0,L.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-xs font-normal text-muted-foreground tabular-nums group-data-active:bg-secondary`,children:e})}export{Me as default};
1
+ import{t as e}from"./chevron-down-BWoQwA6m.js";import{t}from"./chevron-right-D7Sgw1v1.js";import{B as n,I as r,L as i,T as a,a as o,d as s,o as c,t as l,u,w as d}from"./queries-BcMmmb36.js";import{A as f,W as p,l as m,n as h,r as g,s as _,u as v}from"./index-DBHFdsYB.js";import{t as y}from"./Money-BwLucm7P.js";import{o as b,r as x}from"./bits-D34d9IBm.js";import{a as S,i as C,n as w,o as T,r as E,s as D}from"./dist-CmbuesVk.js";import{n as O,s as k}from"./button-BKhMn8jX.js";import{t as A}from"./dist-BFPyD74_.js";import{n as j,r as M,t as N}from"./dist--HKr0kfV.js";import{t as P}from"./dist-vgyaCpaL.js";import{t as F}from"./cards-Ct0jh73r.js";import{t as ee}from"./drill-t1zr57xi.js";var I=n(r(),1),L=i(),R=Object.defineProperty,z=(e,t)=>R(e,`name`,{value:t,configurable:!0}),B=`Collapsible`,[te,ne]=T(B),[re,V]=te(B),ie=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=E({prop:r,defaultProp:i??!1,onChange:o,caller:B});return(0,L.jsx)(re,{scope:n,disabled:a,contentId:w(),open:c,onOpenToggle:I.useCallback(()=>l(e=>!e),[l]),children:(0,L.jsx)(D.div,{"data-state":U(c),"data-disabled":a?``:void 0,...s,ref:t})})},`Collapsible`)),ae=`CollapsibleTrigger`,oe=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,...r}=e,i=V(ae,n);return(0,L.jsx)(D.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":U(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:C(e.onClick,i.onOpenToggle)})},`CollapsibleTrigger`)),H=`CollapsibleContent`,se=I.forwardRef(z(function(e,t){let{forceMount:n,...r}=e,i=V(H,e.__scopeCollapsible);return(0,L.jsx)(A,{present:n||i.open,children:({present:e})=>(0,L.jsx)(ce,{...r,ref:t,present:e})})},`CollapsibleContent`)),ce=I.forwardRef(z(function(e,t){let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=V(H,n),[s,c]=I.useState(r),l=I.useRef(null),u=k(t,l),d=I.useRef(0),f=d.current,p=I.useRef(0),m=p.current,h=o.open||s,g=I.useRef(h),_=I.useRef(void 0);return I.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),S(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,L.jsx)(D.div,{"data-state":U(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})},`CollapsibleContentImpl`));function U(e){return e?`open`:`closed`}z(U,`getState`);var le=Object.defineProperty,W=(e,t)=>le(e,`name`,{value:t,configurable:!0}),G={Automatic:`automatic`,Manual:`manual`},K=`Tabs`,[ue,de]=T(K,[M]),fe=M(),[pe,q]=ue(K),me=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=G.Automatic,...l}=e,u=P(s),[d,f]=E({prop:r,onChange:i,defaultProp:a??``,caller:K});return(0,L.jsx)(pe,{scope:n,baseId:w(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,L.jsx)(D.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),he=`TabsList`,ge=I.forwardRef(W(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=q(he,n),o=fe(n);return(0,L.jsx)(N,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,L.jsx)(D.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),_e=`TabsTrigger`,ve=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=q(_e,n),s=fe(n),c=J(o.baseId,r),l=Y(o.baseId,r),u=r===o.value;return(0,L.jsx)(j,{asChild:!0,...s,focusable:!i,active:u,children:(0,L.jsx)(D.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:C(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?(e.currentTarget.focus(),o.onValueChange(r)):e.preventDefault()}),onKeyDown:C(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:C(e.onFocus,()=>{let e=o.activationMode!==G.Manual;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),ye=`TabsContent`,be=I.forwardRef(W(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=q(ye,n),c=J(s.baseId,r),l=Y(s.baseId,r),u=r===s.value,d=I.useRef(u);return I.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,L.jsx)(A,{present:i||u,children:({present:n})=>(0,L.jsx)(D.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function J(e,t){return`${e}-trigger-${t}`}W(J,`makeTriggerId`);function Y(e,t){return`${e}-content-${t}`}W(Y,`makeContentId`);function xe({...e}){return(0,L.jsx)(ie,{"data-slot":`collapsible`,...e})}function Se({...e}){return(0,L.jsx)(oe,{"data-slot":`collapsible-trigger`,...e})}function Ce({...e}){return(0,L.jsx)(se,{"data-slot":`collapsible-content`,...e})}function we({className:e,orientation:t=`horizontal`,...n}){return(0,L.jsx)(me,{"data-slot":`tabs`,"data-orientation":t,className:a(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Te=O(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Ee({className:e,variant:t=`default`,...n}){return(0,L.jsx)(ge,{"data-slot":`tabs-list`,"data-variant":t,className:a(Te({variant:t}),e),...n})}function X({className:e,...t}){return(0,L.jsx)(ve,{"data-slot":`tabs-trigger`,className:a(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Z({className:e,...t}){return(0,L.jsx)(be,{"data-slot":`tabs-content`,className:a(`flex-1 text-sm outline-none`,e),...t})}var De=90,Oe=[`var(--chart-1)`,`var(--chart-2)`,`var(--chart-3)`,`var(--chart-4)`,`var(--chart-5)`],Q=e=>Math.abs(e.value);function ke({children:e,tone:t}){return(0,L.jsx)(`span`,{className:a(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,t===`warn`?`bg-warning/10 text-warning`:`bg-secondary text-secondary-foreground`),children:e})}function Ae({a:e,holdings:t,card:n,deposit:r,nested:i}){let{t:o,lang:s}=d();return(0,L.jsxs)(`li`,{className:a(`relative flex flex-col gap-1 rounded-md py-1.5 hover:bg-muted/40 focus-within:ring-3 focus-within:ring-ring/50`,i?`pl-4`:`px-2`),children:[(0,L.jsxs)(`div`,{className:`flex min-h-11 items-center justify-between gap-3`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`a`,{href:ee({account:e.id}),className:`truncate rounded-md text-sm font-medium outline-none after:absolute after:inset-0 focus-visible:underline`,children:e.name}),e.closed&&(0,L.jsx)(ke,{children:o(`accounts.closedOn`,{date:_(e.closed,s)})}),t&&!e.priced&&(0,L.jsx)(ke,{tone:`warn`,children:o(`accounts.noPrice`)})]}),(0,L.jsx)(y,{amount:e.value,mode:`short`,className:`shrink-0 text-sm font-medium`})]}),t&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground tabular-nums`,children:[e.qty!==null&&(0,L.jsx)(L.Fragment,{children:o(`accounts.qty`,{n:m(e.qty,s,4)})}),e.price&&(0,L.jsxs)(L.Fragment,{children:[` · `,o(`accounts.price`,{price:v(e.price.price,s),date:h(e.price.date)})]}),` · `,o(`accounts.cost`),` `,(0,L.jsx)(y,{amount:e.cost,mode:`short`})]}),n&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(b,{owed:n.owed,limit:n.limit,atLeast:n.limitAtLeast}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground`,children:[n.toPay>0?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{children:[o(`cards.toPay`),` `,(0,L.jsx)(y,{amount:n.toPay,mode:`short`,className:`font-medium text-foreground`})]}),n.due&&(0,L.jsx)(`span`,{children:h(n.due)}),(0,L.jsx)(x,{days:n.daysToDue})]}):(0,L.jsx)(`span`,{children:o(`cards.nothingToPay`)}),(0,L.jsx)(`a`,{href:F(n.account),className:`relative z-10 ml-auto inline-flex min-h-11 items-center rounded-md px-1 underline outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:o(`accounts.cardPage`)})]})]}),r&&(0,L.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r.maturity?`${r.daysToMaturity<0?o(`deposits.matured`):o(`deposits.inDays`,{n:r.daysToMaturity})} · ${h(r.maturity)}`:o(`deposits.noMaturity`),r.rate!==null&&` · ${m(r.rate,s,2)}%`,r.interestAtMaturity?(0,L.jsxs)(L.Fragment,{children:[` · `,o(`deposits.interest`),` `,(0,L.jsx)(y,{amount:r.interestAtMaturity,mode:`short`})]}):null]})]})}function je({open:n,onToggle:r,label:i,count:o,children:s,nested:c}){return(0,L.jsxs)(`div`,{className:a(`flex flex-col`,c&&`pl-4`),children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-11 items-center gap-1 rounded-md px-2 text-left text-sm text-muted-foreground outline-none hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[n?(0,L.jsx)(e,{className:`size-4`,"aria-hidden":!0}):(0,L.jsx)(t,{className:`size-4`,"aria-hidden":!0}),i,` (`,o,`)`]}),n&&s]})}function Me(){let{t:n,lang:r}=d(),i=u().data,a=s().data,{data:h,error:_,isLoading:v}=l(),b=!!i?.features?.cards,x=o(b).data,S=c(!!i?.features?.deposits).data,C=i?.today??new Date().toISOString().slice(0,10),w=i?.pool,T=w?.name??n(`pool.name`),[E,D]=(0,I.useState)(!1),O=e=>a?.types[e]?.[r]??e,k=e=>!!a?.types[e]?.holdings,A=(0,I.useMemo)(()=>new Map((x?.cards??[]).map(e=>[e.account,e])),[x]),j=(0,I.useMemo)(()=>new Map((S??[]).map(e=>[e.account,e])),[S]),M=(0,I.useMemo)(()=>{let e=h??[],t=e=>!!a?.types[e.type]?.liability,n=e=>(t(e)||e.value<0)&&e.value<0,r=0,i=0,o=0;for(let t of e)(t.value!==0||t.qty)&&(n(t)?i+=t.value:r+=t.value,t.priced||o++);let s=e=>e.value===0&&!e.qty&&(e.lastActivity===null||g(e.lastActivity,C)>De),c=e.filter(e=>e.closed),l=e.filter(e=>!e.closed),u=w?.on?l.filter(e=>e.pool):[],d=l.filter(e=>!u.includes(e)),f=d.filter(s),p=d.filter(e=>!s(e)),m=p.filter(e=>t(e)||e.value<0),_=e=>A.get(e.id)?.daysToDue??1/0;m.sort((e,t)=>_(e)-_(t)||e.value-t.value);let v=new Map;for(let e of p.filter(e=>!m.includes(e))){let t=v.get(e.type)??{id:e.type,label:O(e.type),value:0,items:[]};t.items.push(e),t.value+=e.value,v.set(e.type,t)}let y=[...v.values()];for(let e of y)e.items.sort((e,t)=>Q(t)-Q(e));let b=u.filter(e=>!s(e)).sort((e,t)=>Q(t)-Q(e)),x=u.filter(s);u.length&&y.push({id:`pool`,label:T,value:u.reduce((e,t)=>e+t.value,0),items:b,pool:!0}),y.sort((e,t)=>t.value-e.value),y.forEach((e,t)=>e.color=e.value>0&&t<Oe.length?Oe[t]:`var(--chart-muted)`);let S=y.reduce((e,t)=>e+(t.pool?u.length:t.items.length),0);return{assets:r,liabilities:i,net:r+i,groups:y,debt:m,poolIdle:x,poolCount:u.length,assetCount:S,inactiveRest:f.sort((e,t)=>e.name.localeCompare(t.name)),closed:c.sort((e,t)=>(t.closed??``).localeCompare(e.closed??``)),unpriced:o,any:e.length>0}},[h,a,w?.on,T,C,r,A]);if(_)return(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`common.error`,{message:_.message})});if(v||!h||!a)return(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":`true`,children:[(0,L.jsx)(p,{className:`h-8 w-48`}),(0,L.jsx)(p,{className:`h-24 w-full`}),(0,L.jsx)(p,{className:`h-48 w-full`})]});if(!M.any)return(0,L.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n(`accounts.title`)}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`accounts.empty`)}),(0,L.jsx)(f,{className:`self-start`,prompt:n(`start.s2.prompt`)})]});let N=(e,t)=>(0,L.jsx)(Ae,{a:e,nested:t,holdings:k(e.type),card:A.get(e.id),deposit:j.get(e.id)},e.id),P=M.groups.filter(e=>e.value>0),F=P.reduce((e,t)=>e+t.value,0),R=e=>F>0&&e>0?`${m(e/F*100,r)}%`:``,z=M.inactiveRest.length+M.closed.length;return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,L.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n(`accounts.title`)}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`accounts.netWorth`)}),(0,L.jsx)(y,{amount:M.net,className:`text-3xl font-semibold tracking-tight md:text-4xl`}),(0,L.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n(`accounts.assets`),` `,(0,L.jsx)(y,{amount:M.assets,mode:`short`,className:`font-medium text-foreground`}),` · `,n(`accounts.liabilities`),` `,(0,L.jsx)(y,{amount:M.liabilities,mode:`short`,className:`font-medium text-foreground`})]}),M.unpriced>0&&(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`nw.unpriced`,{n:M.unpriced})})]}),P.length>0&&(0,L.jsx)(`div`,{className:`flex h-2.5 w-full gap-0.5 overflow-hidden rounded-full`,role:`img`,"aria-label":`${n(`accounts.byType`)}: ${P.map(e=>`${e.label} ${R(e.value)}`).join(`, `)}`,children:P.map(e=>(0,L.jsx)(`span`,{className:`h-full first:rounded-l-full last:rounded-r-full`,style:{width:`${e.value/F*100}%`,background:e.color},title:`${e.label} ${R(e.value)}`},e.id))}),(0,L.jsxs)(we,{defaultValue:`assets`,className:`gap-4`,children:[(0,L.jsxs)(Ee,{className:`h-10! w-full sm:w-fit`,children:[(0,L.jsxs)(X,{value:`assets`,className:`px-3`,children:[n(`accounts.assets`),(0,L.jsx)($,{n:M.assetCount})]}),M.debt.length>0&&(0,L.jsxs)(X,{value:`debt`,className:`px-3`,children:[n(`accounts.liabilities`),(0,L.jsx)($,{n:M.debt.length})]}),z>0&&(0,L.jsxs)(X,{value:`idle`,className:`px-3`,children:[n(`accounts.tabIdle`),(0,L.jsx)($,{n:z})]})]}),(0,L.jsx)(Z,{value:`assets`,children:(0,L.jsx)(`div`,{className:`grid items-start gap-3 md:grid-cols-2`,children:M.groups.map(r=>(0,L.jsxs)(xe,{className:`group/acc overflow-hidden rounded-xl bg-card ring-1 ring-foreground/[0.07] shadow-[0_1px_2px_oklch(0_0_0/0.04)]`,children:[(0,L.jsxs)(Se,{className:`flex min-h-14 w-full items-center gap-3 px-4 text-left outline-none hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`size-2.5 shrink-0 rounded-full`,style:{background:r.color}}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:[r.label,(0,L.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground tabular-nums`,children:r.pool?M.poolCount:r.items.length})]}),(0,L.jsx)(y,{amount:r.value,mode:`short`,className:`shrink-0 text-sm font-semibold`}),(0,L.jsx)(`span`,{className:`w-9 shrink-0 text-right text-xs text-muted-foreground tabular-nums`,children:R(r.value)}),(0,L.jsx)(e,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/acc:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,L.jsxs)(Ce,{className:`border-t px-2 py-1`,children:[r.pool&&(0,L.jsxs)(`a`,{href:ee({account:`pool`}),className:`flex min-h-11 items-center justify-between gap-2 rounded-md px-2 text-sm text-muted-foreground outline-none hover:bg-muted/40 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[n(`accounts.poolTx`,{name:T}),(0,L.jsx)(t,{className:`size-4`,"aria-hidden":!0})]}),(0,L.jsx)(`ul`,{className:`flex flex-col`,children:r.items.map(e=>N(e))}),r.pool&&M.poolIdle.length>0&&(0,L.jsx)(je,{open:E,onToggle:()=>D(e=>!e),label:n(`accounts.inactive`),count:M.poolIdle.length,children:(0,L.jsx)(`ul`,{className:`flex flex-col`,children:M.poolIdle.map(e=>N(e,!0))})})]})]},r.id))})}),M.debt.length>0&&(0,L.jsx)(Z,{value:`debt`,children:(0,L.jsx)(`ul`,{className:`grid items-start gap-3 md:grid-cols-2`,children:M.debt.map(e=>(0,L.jsx)(`li`,{className:`list-none rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] shadow-[0_1px_2px_oklch(0_0_0/0.04)]`,children:(0,L.jsx)(`ul`,{children:N(e)})},e.id))})}),z>0&&(0,L.jsxs)(Z,{value:`idle`,className:`flex flex-col gap-5`,children:[M.inactiveRest.length>0&&(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`px-2 text-sm font-medium text-muted-foreground`,children:[n(`accounts.inactive`),` `,(0,L.jsx)(`span`,{className:`tabular-nums`,children:M.inactiveRest.length})]}),(0,L.jsx)(`ul`,{className:`grid gap-x-6 rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] md:grid-cols-2`,children:M.inactiveRest.map(e=>N(e))})]}),M.closed.length>0&&(0,L.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,L.jsxs)(`h2`,{className:`px-2 text-sm font-medium text-muted-foreground`,children:[n(`accounts.closed`),` `,(0,L.jsx)(`span`,{className:`tabular-nums`,children:M.closed.length})]}),(0,L.jsx)(`ul`,{className:`grid gap-x-6 rounded-xl bg-card px-2 py-1 ring-1 ring-foreground/[0.07] md:grid-cols-2`,children:M.closed.map(e=>N(e))})]})]})]})]})}function $({n:e}){return(0,L.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-xs font-normal text-muted-foreground tabular-nums group-data-active:bg-secondary`,children:e})}export{Me as default};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";import{B as t,C as n,I as r,L as i,T as a,c as o,w as s}from"./queries-DZIMMe4i.js";import{A as c,M as l,n as u}from"./index-eR1GkdC_.js";import{t as d}from"./Money-PfFNNDOw.js";import{t as f}from"./button-rfwMVz0i.js";import{t as p}from"./drill-t1zr57xi.js";import{n as m}from"./shared-Box7on3B.js";var h={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};h.node;var g=e(h),_={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};_.node;var v=e(_),y={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};y.node;var b=e(y),x=t(r(),1),S=i(),C=5,w={red:{icon:g,cls:`text-critical`,row:`bg-critical/5`},amber:{icon:v,cls:`text-warning`},info:{icon:b,cls:`text-muted-foreground`}};function T(e,t){let r={name:e.name??``,count:e.count??0,n:e.count??0,...e.params??{}},i=`attention.${e.kind}`,a=n(t,i,r);return a===i?e.title:a}function E(e,t){return e.days===void 0?null:e.days<0?t(`attention.overdueDays`,{n:-e.days}):e.days===0?t(`attention.today`):t(`attention.inDays`,{n:e.days})}function D(e,t){let n=e.name??``;switch(e.kind){case`uncategorised`:return t(`ask.uncategorised`,{n:e.count??0,from:String(e.params?.from??``)});case`plan_due`:case`plan_overdue`:return t(`ask.plan`,{name:n});case`unmatched`:return t(`ask.unmatched`,{name:n});case`negative`:return t(`ask.negative`,{name:n});default:return t(`ask.generic`,{title:e.title})}}function O({widget:e,menu:t}){let{t:n,lang:r}=s(),i=m(e,`widget.attention`),{data:h,error:g,isLoading:_}=o(),[v,y]=(0,x.useState)(!1),b=h?.attention??[],O=v?b:b.slice(0,C);return(0,S.jsxs)(l,{title:(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[i,b.length>0&&(0,S.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-xs font-medium tabular-nums`,b.some(e=>e.severity===`red`)?`bg-critical/10 text-critical`:`bg-secondary text-secondary-foreground`),children:b.length})]}),menu:t,loading:_,error:g?.message,empty:h&&b.length===0?n(`attention.empty`):void 0,children:[(0,S.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:O.map((e,t)=>{let i=E(e,n),o=T(e,r),s=w[e.severity],l=s.icon,f=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center`,children:[(0,S.jsx)(l,{className:a(`size-4`,s.cls),"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`sr-only`,children:n(`attention.sev.${e.severity}`)})]}),(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,S.jsx)(`span`,{className:`text-sm`,children:o}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[i,!i||e.days===void 0?null:u(e.date)].filter(Boolean).join(` · `)})]}),e.amount!==void 0&&(0,S.jsx)(d,{amount:Math.abs(e.amount),mode:`short`,className:`shrink-0 text-sm font-medium`})]});return(0,S.jsxs)(`li`,{className:a(`-mx-2 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg px-2 py-1.5`,s.row),children:[e.link?(0,S.jsx)(`a`,{href:e.link.startsWith(`#`)?e.link:p(),className:`flex min-h-11 min-w-0 flex-1 items-start gap-2 rounded-md py-1 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:f}):(0,S.jsx)(`div`,{className:`flex min-h-11 min-w-0 flex-1 items-start gap-2 py-1`,children:f}),e.ask&&(0,S.jsx)(c,{prompt:D(e,n)})]},`${e.kind}-${t}`)})}),b.length>C&&(0,S.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 self-start md:min-h-8`,onClick:()=>y(e=>!e),children:v?n(`common.showLess`):n(`attention.seeAll`,{n:b.length})})]})}export{T as attentionLabel,O as default,E as whenText};
1
+ import{t as e}from"./createLucideIcon-XZ28znwT.js";import{B as t,C as n,I as r,L as i,T as a,c as o,w as s}from"./queries-BcMmmb36.js";import{A as c,M as l,n as u}from"./index-DBHFdsYB.js";import{t as d}from"./Money-BwLucm7P.js";import{t as f}from"./button-BKhMn8jX.js";import{t as p}from"./drill-t1zr57xi.js";import{n as m}from"./shared-BgU6fc7z.js";var h={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};h.node;var g=e(h),_={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};_.node;var v=e(_),y={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};y.node;var b=e(y),x=t(r(),1),S=i(),C=5,w={red:{icon:g,cls:`text-critical`,row:`bg-critical/5`},amber:{icon:v,cls:`text-warning`},info:{icon:b,cls:`text-muted-foreground`}};function T(e,t){let r={name:e.name??``,count:e.count??0,n:e.count??0,...e.params??{}},i=`attention.${e.kind}`,a=n(t,i,r);return a===i?e.title:a}function E(e,t){return e.days===void 0?null:e.days<0?t(`attention.overdueDays`,{n:-e.days}):e.days===0?t(`attention.today`):t(`attention.inDays`,{n:e.days})}function D(e,t){let n=e.name??``;switch(e.kind){case`uncategorised`:return t(`ask.uncategorised`,{n:e.count??0,from:String(e.params?.from??``)});case`plan_due`:case`plan_overdue`:return t(`ask.plan`,{name:n});case`unmatched`:return t(`ask.unmatched`,{name:n});case`negative`:return t(`ask.negative`,{name:n});default:return t(`ask.generic`,{title:e.title})}}function O({widget:e,menu:t}){let{t:n,lang:r}=s(),i=m(e,`widget.attention`),{data:h,error:g,isLoading:_}=o(),[v,y]=(0,x.useState)(!1),b=h?.attention??[],O=v?b:b.slice(0,C);return(0,S.jsxs)(l,{title:(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[i,b.length>0&&(0,S.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-xs font-medium tabular-nums`,b.some(e=>e.severity===`red`)?`bg-critical/10 text-critical`:`bg-secondary text-secondary-foreground`),children:b.length})]}),menu:t,loading:_,error:g?.message,empty:h&&b.length===0?n(`attention.empty`):void 0,children:[(0,S.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:O.map((e,t)=>{let i=E(e,n),o=T(e,r),s=w[e.severity],l=s.icon,f=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center`,children:[(0,S.jsx)(l,{className:a(`size-4`,s.cls),"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`sr-only`,children:n(`attention.sev.${e.severity}`)})]}),(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,S.jsx)(`span`,{className:`text-sm`,children:o}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[i,!i||e.days===void 0?null:u(e.date)].filter(Boolean).join(` · `)})]}),e.amount!==void 0&&(0,S.jsx)(d,{amount:Math.abs(e.amount),mode:`short`,className:`shrink-0 text-sm font-medium`})]});return(0,S.jsxs)(`li`,{className:a(`-mx-2 flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg px-2 py-1.5`,s.row),children:[e.link?(0,S.jsx)(`a`,{href:e.link.startsWith(`#`)?e.link:p(),className:`flex min-h-11 min-w-0 flex-1 items-start gap-2 rounded-md py-1 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:f}):(0,S.jsx)(`div`,{className:`flex min-h-11 min-w-0 flex-1 items-start gap-2 py-1`,children:f}),e.ask&&(0,S.jsx)(c,{prompt:D(e,n)})]},`${e.kind}-${t}`)})}),b.length>C&&(0,S.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 self-start md:min-h-8`,onClick:()=>y(e=>!e),children:v?n(`common.showLess`):n(`attention.seeAll`,{n:b.length})})]})}export{T as attentionLabel,O as default,E as whenText};
@@ -1 +1 @@
1
- import{r as e}from"./charts-BqP7HKwP.js";import{t}from"./CategoryIcon-HfjYhH1l.js";import{t as n}from"./Money-PfFNNDOw.js";import{M as r,l as i,o as a}from"./index-eR1GkdC_.js";import{L as o,_ as s,u as c,w as l}from"./queries-DZIMMe4i.js";import{t as u}from"./drill-t1zr57xi.js";import{n as d,t as f}from"./shared-Box7on3B.js";var p=o();function m(e,t){let n=t.slice(0,7);switch(e){case`last-month`:return a(n,-1);case`this-year`:return t.slice(0,4);case`last-year`:return String(Number(t.slice(0,4))-1);default:return e&&/^\d{4}(-\d{2})?$/.test(e)?e:n}}function h({widget:a,menu:o}){let{t:h,lang:g}=l(),_=d(a,`widget.byCategory`),v=c().data,y=m(a.period,v?.today??new Date().toISOString().slice(0,10)),{data:b,error:x,isLoading:S}=s(y,`top`),C=(b?.rows??[]).filter(e=>e.current>0).sort((e,t)=>t.current-e.current).slice(0,8),w=b?.current??0;return(0,p.jsx)(r,{title:_,titleHref:`#/reports`,menu:o,loading:S,error:x?.message,empty:b&&C.length===0?h(`bycat.empty`):void 0,children:b&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[h(`bycat.total`),` `,(0,p.jsx)(n,{amount:w,mode:`short`,className:`font-medium text-foreground`})]}),(0,p.jsx)(e,{rows:C.map(e=>({key:e.key,name:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(t,{category:e.key,name:e.name,className:`size-6 [&_svg]:size-3`}),(0,p.jsx)(`span`,{className:`truncate`,children:e.name})]}),value:e.current,label:(0,p.jsx)(n,{amount:e.current,mode:`short`,className:`font-medium`}),meta:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsxs)(`span`,{children:[i(e.current/(w||1)*100,g),`%`]}),e.changePct!==null&&b.months>=1&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f,{pct:e.changePct,className:`text-xs`}),(0,p.jsx)(`span`,{children:h(`pace.vsUsual`)})]})]}),href:u({category:e.key,from:b.period.from,to:b.period.to})}))})]})})}export{h as default,m as reportPeriod};
1
+ import{r as e}from"./charts-D-1glV8L.js";import{t}from"./CategoryIcon-D4Cdb_ZP.js";import{t as n}from"./Money-BwLucm7P.js";import{M as r,l as i,o as a}from"./index-DBHFdsYB.js";import{L as o,_ as s,u as c,w as l}from"./queries-BcMmmb36.js";import{t as u}from"./drill-t1zr57xi.js";import{n as d,t as f}from"./shared-BgU6fc7z.js";var p=o();function m(e,t){let n=t.slice(0,7);switch(e){case`last-month`:return a(n,-1);case`this-year`:return t.slice(0,4);case`last-year`:return String(Number(t.slice(0,4))-1);default:return e&&/^\d{4}(-\d{2})?$/.test(e)?e:n}}function h({widget:a,menu:o}){let{t:h,lang:g}=l(),_=d(a,`widget.byCategory`),v=c().data,y=m(a.period,v?.today??new Date().toISOString().slice(0,10)),{data:b,error:x,isLoading:S}=s(y,`top`),C=(b?.rows??[]).filter(e=>e.current>0).sort((e,t)=>t.current-e.current).slice(0,8),w=b?.current??0;return(0,p.jsx)(r,{title:_,titleHref:`#/reports`,menu:o,loading:S,error:x?.message,empty:b&&C.length===0?h(`bycat.empty`):void 0,children:b&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[h(`bycat.total`),` `,(0,p.jsx)(n,{amount:w,mode:`short`,className:`font-medium text-foreground`})]}),(0,p.jsx)(e,{rows:C.map(e=>({key:e.key,name:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(t,{category:e.key,name:e.name,className:`size-6 [&_svg]:size-3`}),(0,p.jsx)(`span`,{className:`truncate`,children:e.name})]}),value:e.current,label:(0,p.jsx)(n,{amount:e.current,mode:`short`,className:`font-medium`}),meta:(0,p.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,p.jsxs)(`span`,{children:[i(e.current/(w||1)*100,g),`%`]}),e.changePct!==null&&b.months>=1&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(f,{pct:e.changePct,className:`text-xs`}),(0,p.jsx)(`span`,{children:h(`pace.vsUsual`)})]})]}),href:u({category:e.key,from:b.period.from,to:b.period.to})}))})]})})}export{h as default,m as reportPeriod};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";import{t}from"./chevron-right-Dqh3vs9Y.js";import{B as n,I as r,L as i,T as a,d as o,h as s,r as c,w as l,y as u}from"./queries-DZIMMe4i.js";import{A as d,G as f,J as p,K as m,W as h,Y as g,a as _,k as v,l as y,q as b,r as x,s as S,t as C}from"./index-eR1GkdC_.js";import{t as w}from"./DrillLink-Bvfam9FA.js";import{t as T}from"./KV-DMA1AlP-.js";import{t as E}from"./Money-PfFNNDOw.js";import{t as D}from"./Panel-BnfWrw9R.js";import{a as O,i as k,n as A,o as j,r as M}from"./bits-Dr2E0ObC.js";import{n as N,t as P}from"./TxRow-EKIIMQKa.js";import{a as F,n as I,t as L}from"./charts-BqP7HKwP.js";import{n as R,r as z}from"./cards-Bb5zjzRG.js";var B={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};B.node;var V=e(B),H=n(r(),1),U=i();function W({account:e,close:t,onClose:n}){let{t:r,lang:i}=l(),a=v(`(max-width: 767px)`),{data:c,error:u,isLoading:d}=s(e,t),_=N(o().data),y=c?.statement;return(0,U.jsx)(f,{open:t!==null,onOpenChange:e=>!e&&n(),children:(0,U.jsxs)(m,{side:a?`bottom`:`right`,className:a?`max-h-[85svh] overflow-auto rounded-t-xl`:`overflow-auto sm:max-w-md`,children:[(0,U.jsxs)(p,{children:[(0,U.jsx)(g,{children:y?.open?r(`cards.currentPeriod`):r(`cards.statementOf`,{date:t?S(t,i):``})}),(0,U.jsxs)(b,{children:[y?`${S(y.from,i)} – ${S(y.close,i)}`:r(`common.loading`),y?.pdf&&(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`a`,{href:`/api/m/cards/statement-pdf?account=${encodeURIComponent(e)}&close=${y.close}`,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:r(`cards.statementPdf`)})]})]})]}),(0,U.jsx)(`div`,{className:`flex flex-col gap-3 px-4 pb-4`,children:u?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`common.error`,{message:u.message})}):d||!c||!y?(0,U.jsx)(h,{className:`h-40 w-full`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`divide-y rounded-lg border px-3`,children:[(0,U.jsx)(T,{label:r(`cards.opening`),children:(0,U.jsx)(E,{amount:y.opening})}),(0,U.jsx)(T,{label:r(`cards.k.purchase`),children:(0,U.jsx)(E,{amount:y.purchases})}),y.fees>0&&(0,U.jsx)(T,{label:r(`cards.k.fee`),children:(0,U.jsx)(E,{amount:y.fees})}),y.refunds>0&&(0,U.jsx)(T,{label:r(`cards.k.refund`),children:(0,U.jsx)(E,{amount:-y.refunds})}),y.cashback>0&&(0,U.jsx)(T,{label:r(`cards.k.cashback`),children:(0,U.jsx)(E,{amount:-y.cashback})}),y.payments>0&&(0,U.jsx)(T,{label:r(`cards.k.payment`),children:(0,U.jsx)(E,{amount:-y.payments})}),(0,U.jsx)(T,{label:r(`cards.closing`),className:`font-medium`,children:(0,U.jsx)(E,{amount:y.closing})})]}),(0,U.jsx)(`ul`,{children:c.transactions.map(t=>(0,U.jsxs)(`li`,{className:`flex flex-col`,children:[t.kind&&(0,U.jsx)(`span`,{className:`px-2 pt-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase`,children:r(`cards.k.${t.kind}`)}),(0,U.jsx)(P,{tx:t,names:_,account:e})]},t.id))}),c.transactions.length===0&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`tx.emptyFiltered`)})]})})]})})}function G({value:e,max:t,label:n}){let r=t>0?Math.min(1,e/t):0;return(0,U.jsx)(`div`,{role:`progressbar`,"aria-label":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r*100),className:`h-2 w-full rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-2 rounded-full bg-[var(--chart-1)]`,style:{width:`${Math.max(r?2:0,r*100)}%`}})})}function K({d:e,asOf:t}){let{t:n,lang:r}=l(),i=e.summary?.current,a=e.terms.statementDay,o=e.account.id;return(0,U.jsx)(D,{title:n(`cards.currentPeriod`),children:i?(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:n(`cards.purchasesSoFar`),children:(0,U.jsx)(w,{filter:{account:o,from:i.from,to:t},className:`font-medium`,children:(0,U.jsx)(E,{amount:i.purchases})})}),a&&(0,U.jsxs)(T,{label:n(`cards.closesOn`),children:[S(z(t,a),r),` · `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n(`cards.daysLeft`,{n:R(t,a)})})]}),e.payByToday&&(0,U.jsxs)(T,{label:n(`cards.payByToday`),children:[(0,U.jsx)(`span`,{className:`font-medium`,children:S(e.payByToday,r)}),` · `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n(`cards.daysLeft`,{n:x(t,e.payByToday)})})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(a?`cards.noActivity`:`cards.noStatementDay`)})})}function q({s:e,id:t,asOf:n}){let{t:r,lang:i}=l();return(0,U.jsx)(D,{title:e?r(`cards.statementOf`,{date:S(e.close,i)}):r(`cards.lastStatement`),action:e?(0,U.jsx)(O,{status:e.status}):void 0,children:e?(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:r(`cards.amountDue`),children:(0,U.jsx)(w,{filter:{account:t,from:e.from,to:e.close},className:`text-lg font-semibold`,children:(0,U.jsx)(E,{amount:e.amountDue})})}),e.due&&(0,U.jsxs)(T,{label:r(`cards.dueDate`),children:[S(e.due,i),` `,e.toPay>0&&(0,U.jsx)(M,{days:x(n,e.due),className:`ml-1`})]}),(0,U.jsx)(T,{label:r(`cards.paid`),children:(0,U.jsx)(w,{filter:{account:t,from:C(e.close,1),to:n},children:(0,U.jsx)(E,{amount:e.paid})})}),(0,U.jsx)(T,{label:r(`cards.toPay`),className:`font-medium`,children:(0,U.jsx)(E,{amount:e.toPay})}),e.deferred>0&&(0,U.jsx)(T,{label:r(`cards.deferred`),children:(0,U.jsx)(E,{amount:e.deferred})}),e.bank!==null&&(0,U.jsxs)(T,{label:r(`cards.bankAmount`),children:[(0,U.jsx)(E,{amount:e.bank}),e.bankDiff!==null&&e.bankDiff!==0&&(0,U.jsx)(`span`,{className:`block text-xs text-warning`,children:r(`cards.bankDiff`,{amount:`${e.bankDiff>0?`+`:`−`}${y(Math.abs(e.bankDiff),i)}`})})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`cards.noClosed`)})})}function J({list:e,onOpen:n}){let{t:r,lang:i}=l();return(0,U.jsx)(D,{title:r(`cards.history`),children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`cards.noHistory`)}):(0,U.jsx)(`ul`,{className:`-mx-2 flex flex-col divide-y`,children:e.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.close),className:`flex min-h-12 w-full items-center gap-3 rounded-md px-2 py-1.5 text-left outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.open?r(`cards.currentPeriod`):S(e.close,i)}),(0,U.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[S(e.from,i,{day:`2-digit`,month:`2-digit`}),` – `,S(e.close,i,{day:`2-digit`,month:`2-digit`}),` · `,r(`cards.purchasesShort`),` `,(0,U.jsx)(E,{amount:e.purchases,mode:`short`})]})]}),(0,U.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end`,children:[(0,U.jsx)(E,{amount:e.open?e.closing:e.amountDue,mode:`short`,className:`text-sm font-medium`}),!e.open&&(0,U.jsx)(O,{status:e.status})]}),(0,U.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})},e.close))})})}function Y({d:e}){let{t,lang:n}=l(),r=e.summary?.cashback??null,i=(0,H.useMemo)(()=>[...e.cashback].filter(e=>!e.open).reverse().slice(-12),[e.cashback]).map(e=>({ym:e.close,label:_(e.close.slice(0,7)),expected:e.expected,received:e.received}));return!e.terms.cashback&&!e.cashback.some(e=>e.expected>0||e.received>0)?(0,U.jsxs)(D,{title:t(`cards.cashback`),children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noCashback`)}),(0,U.jsx)(d,{prompt:t(`ask.cardTerms`,{name:e.account.name,list:t(`cards.missing.cashback_rates`)})})]}):(0,U.jsxs)(D,{title:t(`cards.cashback`),children:[r&&(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:t(`cards.spendThisPeriod`),children:(0,U.jsx)(w,{filter:{account:e.account.id,from:r.from,to:r.close},children:(0,U.jsx)(E,{amount:r.spend})})}),(0,U.jsx)(T,{label:t(`cards.expected`),children:r.incomplete?(0,U.jsx)(`span`,{className:`text-warning`,children:t(`cards.rateNotSet`)}):(0,U.jsx)(E,{amount:r.expected,className:`font-medium`})}),r.cap!==null&&r.capLeft!==null&&(0,U.jsxs)(T,{label:t(`cards.capLeftLabel`),children:[(0,U.jsx)(E,{amount:r.capLeft}),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/ `,(0,U.jsx)(E,{amount:r.cap,mode:`short`})]})]})]}),r&&r.minSpend!==null&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(G,{value:r.spend,max:r.minSpend,label:t(`cards.minSpend`)}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.minMet?t(`cards.minMet`,{amount:y(r.minSpend,n)}):t(`cards.minNeed`,{amount:y(r.needForMin,n),min:y(r.minSpend,n)})})]}),i.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:t(`cards.last12`)}),(0,U.jsx)(`div`,{className:`flex h-40 flex-col`,children:(0,U.jsx)(L,{legend:[{label:t(`cards.earned`),color:F.accent},{label:t(`cards.expected`),color:F.second}],table:{head:[t(`chart.month`),t(`cards.earned`),t(`cards.expected`)],rows:i.map(e=>[e.label,y(e.received,n),y(e.expected,n)])},children:(0,U.jsx)(I,{data:i,xKey:`label`,series:[{key:`received`,label:t(`cards.earned`),color:F.accent},{key:`expected`,label:t(`cards.expected`),color:F.second}]})})})]})]})}function X({d:e,asOf:t}){let{t:n,lang:r}=l(),i=e.feeWaiver;return!i&&!e.terms.annualFee?null:(0,U.jsx)(D,{title:n(`cards.feeWaiver`),children:i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G,{value:i.spent,max:i.target,label:n(`cards.feeWaiver`)}),(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsxs)(T,{label:n(`cards.spent`),children:[(0,U.jsx)(w,{filter:{account:e.account.id,from:i.yearFrom,to:t},children:(0,U.jsx)(E,{amount:i.spent})}),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/ `,(0,U.jsx)(E,{amount:i.target,mode:`short`})]})]}),(0,U.jsxs)(T,{label:n(`cards.deadline`),children:[S(i.deadline,r),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,n(`cards.daysLeft`,{n:i.daysLeft})]})]}),!i.met&&(0,U.jsx)(T,{label:n(`cards.perMonth`),children:(0,U.jsx)(E,{amount:i.perMonth})}),e.terms.annualFee?(0,U.jsx)(T,{label:n(`cards.annualFee`),children:(0,U.jsx)(E,{amount:e.terms.annualFee})}):null]}),(0,U.jsx)(`p`,{className:a(`text-sm font-medium`,i.met||i.onTrack?`text-foreground`:`text-critical`),children:i.met?n(`cards.feeMet`):i.onTrack?n(`cards.onTrack`):n(`cards.behind`)})]}):(0,U.jsxs)(`dl`,{children:[(0,U.jsx)(T,{label:n(`cards.annualFee`),children:(0,U.jsx)(E,{amount:e.terms.annualFee})}),(0,U.jsx)(`p`,{className:`py-1 text-sm text-muted-foreground`,children:n(`cards.noWaiver`)})]})})}function Z({d:e}){let{t}=l();return e.instalments.length===0?null:(0,U.jsx)(D,{title:t(`cards.instalments`),children:(0,U.jsx)(`ul`,{className:`flex flex-col gap-3`,children:e.instalments.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-sm`,children:[(0,U.jsx)(w,{filter:{plan:e.plan},className:`min-w-0 truncate font-medium`,children:e.name}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[e.paidCount,`/`,e.count??`–`]})]}),(0,U.jsx)(G,{value:e.paidCount,max:e.count??0,label:e.name}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t(`cards.perMonthPay`),` `,(0,U.jsx)(E,{amount:e.perPayment,mode:`short`}),e.leftAmount!==null&&(0,U.jsxs)(U.Fragment,{children:[` · `,t(`cards.left`),` `,(0,U.jsx)(E,{amount:e.leftAmount,mode:`short`})]})]})]},e.plan))})})}function Q({d:e}){let{t,lang:n}=l(),r=e.record;if(!r)return(0,U.jsxs)(D,{title:t(`cards.lifecycle`),children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noRecord`)}),(0,U.jsx)(d,{prompt:t(`ask.cardRecord`,{name:e.account.name})})]});let i=e=>e?S(e,n):null,a=[[t(`cards.issued`),i(r.issued)],[t(`cards.activated`),i(r.activated)],[t(`cards.lockedOn`),i(r.locked)],[t(`cards.cancelledOn`),i(r.cancelled)],[t(`cards.network`),r.network?r.network.toUpperCase():null],[t(`cards.form`),r.physical?t(`cards.physical.${r.physical}`):null]];return(0,U.jsxs)(D,{title:t(`cards.lifecycle`),action:(0,U.jsx)(A,{status:r.status??`active`}),children:[(0,U.jsxs)(`dl`,{className:`divide-y`,children:[a.filter(([,e])=>e).map(([e,t])=>(0,U.jsx)(T,{label:e,children:t},e)),r.annual_fee?(0,U.jsx)(T,{label:t(`cards.annualFee`),children:(0,U.jsx)(E,{amount:r.annual_fee})}):null,r.close_fee?(0,U.jsx)(T,{label:t(`cards.closeFee`),children:(0,U.jsx)(E,{amount:r.close_fee})}):null,r.keep_for_limit&&(0,U.jsx)(T,{label:t(`cards.keepForLimit`),children:t(`cards.yes`)})]}),r.cancel_plan&&(0,U.jsxs)(`div`,{className:`rounded-md bg-muted/60 p-3 text-sm`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:t(`cards.cancelPlan`,{by:r.cancel_plan.by??``})}),r.cancel_plan.note&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r.cancel_plan.note})]}),r.note&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.note})]})}function $({d:e}){let{t}=l(),n=e.value;return n?(0,U.jsx)(D,{title:t(`cards.netValue`),children:(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:t(`cards.value.benefits`),children:(0,U.jsx)(E,{amount:n.benefits})}),(0,U.jsx)(T,{label:t(`cards.cashback`),children:(0,U.jsx)(E,{amount:n.cashback})}),(0,U.jsx)(T,{label:n.feesFrom===`record`?`${t(`cards.value.fees`)} (${t(`cards.value.estimated`)})`:t(`cards.value.fees`),children:(0,U.jsx)(E,{amount:-n.fees})}),n.closeFee>0&&(0,U.jsx)(T,{label:t(`cards.closeFee`),children:(0,U.jsx)(E,{amount:-n.closeFee})}),(0,U.jsx)(T,{label:t(`cards.value.sinceIssued`),className:`font-medium`,children:(0,U.jsx)(E,{amount:n.net,tone:`auto`})}),(0,U.jsx)(T,{label:t(`cards.value.last12`),className:`font-medium`,children:(0,U.jsx)(E,{amount:n.last12.net,tone:`auto`})})]})}):null}function ee({params:e}){let{t}=l(),n=decodeURIComponent(e.account),{data:r,error:i,isLoading:a}=c(n),[o,s]=(0,H.useState)(null),d=(0,U.jsxs)(`a`,{href:`#/cards`,className:`inline-flex min-h-11 items-center gap-1 self-start rounded-md text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,U.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t(`cards.back`)]});if(i)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i instanceof u&&i.status===404?t(`cards.notFound`):t(`common.error`,{message:i.message})})]});if(a||!r)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[d,(0,U.jsx)(h,{className:`h-8 w-56`}),(0,U.jsx)(h,{className:`h-40 w-full`})]});let f=r.summary,p=r.record?.status??(r.account.closed?`cancelled`:`active`),m=r.terms.last4,g=[r.terms.bank,m?t(`cards.last4`,{n:m}):null].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,(0,U.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:r.account.name}),(0,U.jsx)(A,{status:p})]}),g&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),f&&(0,U.jsx)(j,{owed:f.owed,limit:f.limit,atLeast:f.limitAtLeast,className:`max-w-md`}),f&&(0,U.jsx)(k,{card:f,className:`max-w-md`})]}),(0,U.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{d:r,asOf:r.asOf}),(0,U.jsx)(q,{s:f.last,id:r.account.id,asOf:r.asOf}),(0,U.jsx)(J,{list:r.statements,onOpen:s})]}):(0,U.jsx)(D,{title:t(`cards.statements`),children:(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noStatements`)})})}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,U.jsx)(Y,{d:r}),(0,U.jsx)(X,{d:r,asOf:r.asOf}),(0,U.jsx)(Z,{d:r}),(0,U.jsx)(Q,{d:r}),(0,U.jsx)($,{d:r})]})]}),(0,U.jsx)(W,{account:r.account.id,close:o,onClose:()=>s(null)})]})}export{ee as default};
1
+ import{t as e}from"./createLucideIcon-XZ28znwT.js";import{t}from"./chevron-right-D7Sgw1v1.js";import{B as n,I as r,L as i,T as a,d as o,h as s,r as c,w as l,y as u}from"./queries-BcMmmb36.js";import{A as d,G as f,J as p,K as m,W as h,Y as g,a as _,k as v,l as y,q as b,r as x,s as S,t as C}from"./index-DBHFdsYB.js";import{t as w}from"./DrillLink-CZyI-y0-.js";import{t as T}from"./KV-CKWaJkRK.js";import{t as E}from"./Money-BwLucm7P.js";import{t as D}from"./Panel-CSe25x0N.js";import{a as O,i as k,n as A,o as j,r as M}from"./bits-D34d9IBm.js";import{n as N,t as P}from"./TxRow-BGfpKo2m.js";import{a as F,n as I,t as L}from"./charts-D-1glV8L.js";import{n as R,r as z}from"./cards-Ct0jh73r.js";var B={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};B.node;var V=e(B),H=n(r(),1),U=i();function W({account:e,close:t,onClose:n}){let{t:r,lang:i}=l(),a=v(`(max-width: 767px)`),{data:c,error:u,isLoading:d}=s(e,t),_=N(o().data),y=c?.statement;return(0,U.jsx)(f,{open:t!==null,onOpenChange:e=>!e&&n(),children:(0,U.jsxs)(m,{side:a?`bottom`:`right`,className:a?`max-h-[85svh] overflow-auto rounded-t-xl`:`overflow-auto sm:max-w-md`,children:[(0,U.jsxs)(p,{children:[(0,U.jsx)(g,{children:y?.open?r(`cards.currentPeriod`):r(`cards.statementOf`,{date:t?S(t,i):``})}),(0,U.jsxs)(b,{children:[y?`${S(y.from,i)} – ${S(y.close,i)}`:r(`common.loading`),y?.pdf&&(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`a`,{href:`/api/m/cards/statement-pdf?account=${encodeURIComponent(e)}&close=${y.close}`,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:r(`cards.statementPdf`)})]})]})]}),(0,U.jsx)(`div`,{className:`flex flex-col gap-3 px-4 pb-4`,children:u?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`common.error`,{message:u.message})}):d||!c||!y?(0,U.jsx)(h,{className:`h-40 w-full`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`dl`,{className:`divide-y rounded-lg border px-3`,children:[(0,U.jsx)(T,{label:r(`cards.opening`),children:(0,U.jsx)(E,{amount:y.opening})}),(0,U.jsx)(T,{label:r(`cards.k.purchase`),children:(0,U.jsx)(E,{amount:y.purchases})}),y.fees>0&&(0,U.jsx)(T,{label:r(`cards.k.fee`),children:(0,U.jsx)(E,{amount:y.fees})}),y.refunds>0&&(0,U.jsx)(T,{label:r(`cards.k.refund`),children:(0,U.jsx)(E,{amount:-y.refunds})}),y.cashback>0&&(0,U.jsx)(T,{label:r(`cards.k.cashback`),children:(0,U.jsx)(E,{amount:-y.cashback})}),y.payments>0&&(0,U.jsx)(T,{label:r(`cards.k.payment`),children:(0,U.jsx)(E,{amount:-y.payments})}),(0,U.jsx)(T,{label:r(`cards.closing`),className:`font-medium`,children:(0,U.jsx)(E,{amount:y.closing})})]}),(0,U.jsx)(`ul`,{children:c.transactions.map(t=>(0,U.jsxs)(`li`,{className:`flex flex-col`,children:[t.kind&&(0,U.jsx)(`span`,{className:`px-2 pt-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase`,children:r(`cards.k.${t.kind}`)}),(0,U.jsx)(P,{tx:t,names:_,account:e})]},t.id))}),c.transactions.length===0&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`tx.emptyFiltered`)})]})})]})})}function G({value:e,max:t,label:n}){let r=t>0?Math.min(1,e/t):0;return(0,U.jsx)(`div`,{role:`progressbar`,"aria-label":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r*100),className:`h-2 w-full rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-2 rounded-full bg-[var(--chart-1)]`,style:{width:`${Math.max(r?2:0,r*100)}%`}})})}function K({d:e,asOf:t}){let{t:n,lang:r}=l(),i=e.summary?.current,a=e.terms.statementDay,o=e.account.id;return(0,U.jsx)(D,{title:n(`cards.currentPeriod`),children:i?(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:n(`cards.purchasesSoFar`),children:(0,U.jsx)(w,{filter:{account:o,from:i.from,to:t},className:`font-medium`,children:(0,U.jsx)(E,{amount:i.purchases})})}),a&&(0,U.jsxs)(T,{label:n(`cards.closesOn`),children:[S(z(t,a),r),` · `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n(`cards.daysLeft`,{n:R(t,a)})})]}),e.payByToday&&(0,U.jsxs)(T,{label:n(`cards.payByToday`),children:[(0,U.jsx)(`span`,{className:`font-medium`,children:S(e.payByToday,r)}),` · `,(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n(`cards.daysLeft`,{n:x(t,e.payByToday)})})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(a?`cards.noActivity`:`cards.noStatementDay`)})})}function q({s:e,id:t,asOf:n}){let{t:r,lang:i}=l();return(0,U.jsx)(D,{title:e?r(`cards.statementOf`,{date:S(e.close,i)}):r(`cards.lastStatement`),action:e?(0,U.jsx)(O,{status:e.status}):void 0,children:e?(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:r(`cards.amountDue`),children:(0,U.jsx)(w,{filter:{account:t,from:e.from,to:e.close},className:`text-lg font-semibold`,children:(0,U.jsx)(E,{amount:e.amountDue})})}),e.due&&(0,U.jsxs)(T,{label:r(`cards.dueDate`),children:[S(e.due,i),` `,e.toPay>0&&(0,U.jsx)(M,{days:x(n,e.due),className:`ml-1`})]}),(0,U.jsx)(T,{label:r(`cards.paid`),children:(0,U.jsx)(w,{filter:{account:t,from:C(e.close,1),to:n},children:(0,U.jsx)(E,{amount:e.paid})})}),(0,U.jsx)(T,{label:r(`cards.toPay`),className:`font-medium`,children:(0,U.jsx)(E,{amount:e.toPay})}),e.deferred>0&&(0,U.jsx)(T,{label:r(`cards.deferred`),children:(0,U.jsx)(E,{amount:e.deferred})}),e.bank!==null&&(0,U.jsxs)(T,{label:r(`cards.bankAmount`),children:[(0,U.jsx)(E,{amount:e.bank}),e.bankDiff!==null&&e.bankDiff!==0&&(0,U.jsx)(`span`,{className:`block text-xs text-warning`,children:r(`cards.bankDiff`,{amount:`${e.bankDiff>0?`+`:`−`}${y(Math.abs(e.bankDiff),i)}`})})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`cards.noClosed`)})})}function J({list:e,onOpen:n}){let{t:r,lang:i}=l();return(0,U.jsx)(D,{title:r(`cards.history`),children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`cards.noHistory`)}):(0,U.jsx)(`ul`,{className:`-mx-2 flex flex-col divide-y`,children:e.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.close),className:`flex min-h-12 w-full items-center gap-3 rounded-md px-2 py-1.5 text-left outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.open?r(`cards.currentPeriod`):S(e.close,i)}),(0,U.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[S(e.from,i,{day:`2-digit`,month:`2-digit`}),` – `,S(e.close,i,{day:`2-digit`,month:`2-digit`}),` · `,r(`cards.purchasesShort`),` `,(0,U.jsx)(E,{amount:e.purchases,mode:`short`})]})]}),(0,U.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end`,children:[(0,U.jsx)(E,{amount:e.open?e.closing:e.amountDue,mode:`short`,className:`text-sm font-medium`}),!e.open&&(0,U.jsx)(O,{status:e.status})]}),(0,U.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})},e.close))})})}function Y({d:e}){let{t,lang:n}=l(),r=e.summary?.cashback??null,i=(0,H.useMemo)(()=>[...e.cashback].filter(e=>!e.open).reverse().slice(-12),[e.cashback]).map(e=>({ym:e.close,label:_(e.close.slice(0,7)),expected:e.expected,received:e.received}));return!e.terms.cashback&&!e.cashback.some(e=>e.expected>0||e.received>0)?(0,U.jsxs)(D,{title:t(`cards.cashback`),children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noCashback`)}),(0,U.jsx)(d,{prompt:t(`ask.cardTerms`,{name:e.account.name,list:t(`cards.missing.cashback_rates`)})})]}):(0,U.jsxs)(D,{title:t(`cards.cashback`),children:[r&&(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:t(`cards.spendThisPeriod`),children:(0,U.jsx)(w,{filter:{account:e.account.id,from:r.from,to:r.close},children:(0,U.jsx)(E,{amount:r.spend})})}),(0,U.jsx)(T,{label:t(`cards.expected`),children:r.incomplete?(0,U.jsx)(`span`,{className:`text-warning`,children:t(`cards.rateNotSet`)}):(0,U.jsx)(E,{amount:r.expected,className:`font-medium`})}),r.cap!==null&&r.capLeft!==null&&(0,U.jsxs)(T,{label:t(`cards.capLeftLabel`),children:[(0,U.jsx)(E,{amount:r.capLeft}),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/ `,(0,U.jsx)(E,{amount:r.cap,mode:`short`})]})]})]}),r&&r.minSpend!==null&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(G,{value:r.spend,max:r.minSpend,label:t(`cards.minSpend`)}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.minMet?t(`cards.minMet`,{amount:y(r.minSpend,n)}):t(`cards.minNeed`,{amount:y(r.needForMin,n),min:y(r.minSpend,n)})})]}),i.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:t(`cards.last12`)}),(0,U.jsx)(`div`,{className:`flex h-40 flex-col`,children:(0,U.jsx)(L,{legend:[{label:t(`cards.earned`),color:F.accent},{label:t(`cards.expected`),color:F.second}],table:{head:[t(`chart.month`),t(`cards.earned`),t(`cards.expected`)],rows:i.map(e=>[e.label,y(e.received,n),y(e.expected,n)])},children:(0,U.jsx)(I,{data:i,xKey:`label`,series:[{key:`received`,label:t(`cards.earned`),color:F.accent},{key:`expected`,label:t(`cards.expected`),color:F.second}]})})})]})]})}function X({d:e,asOf:t}){let{t:n,lang:r}=l(),i=e.feeWaiver;return!i&&!e.terms.annualFee?null:(0,U.jsx)(D,{title:n(`cards.feeWaiver`),children:i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G,{value:i.spent,max:i.target,label:n(`cards.feeWaiver`)}),(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsxs)(T,{label:n(`cards.spent`),children:[(0,U.jsx)(w,{filter:{account:e.account.id,from:i.yearFrom,to:t},children:(0,U.jsx)(E,{amount:i.spent})}),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`/ `,(0,U.jsx)(E,{amount:i.target,mode:`short`})]})]}),(0,U.jsxs)(T,{label:n(`cards.deadline`),children:[S(i.deadline,r),` `,(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,n(`cards.daysLeft`,{n:i.daysLeft})]})]}),!i.met&&(0,U.jsx)(T,{label:n(`cards.perMonth`),children:(0,U.jsx)(E,{amount:i.perMonth})}),e.terms.annualFee?(0,U.jsx)(T,{label:n(`cards.annualFee`),children:(0,U.jsx)(E,{amount:e.terms.annualFee})}):null]}),(0,U.jsx)(`p`,{className:a(`text-sm font-medium`,i.met||i.onTrack?`text-foreground`:`text-critical`),children:i.met?n(`cards.feeMet`):i.onTrack?n(`cards.onTrack`):n(`cards.behind`)})]}):(0,U.jsxs)(`dl`,{children:[(0,U.jsx)(T,{label:n(`cards.annualFee`),children:(0,U.jsx)(E,{amount:e.terms.annualFee})}),(0,U.jsx)(`p`,{className:`py-1 text-sm text-muted-foreground`,children:n(`cards.noWaiver`)})]})})}function Z({d:e}){let{t}=l();return e.instalments.length===0?null:(0,U.jsx)(D,{title:t(`cards.instalments`),children:(0,U.jsx)(`ul`,{className:`flex flex-col gap-3`,children:e.instalments.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-sm`,children:[(0,U.jsx)(w,{filter:{plan:e.plan},className:`min-w-0 truncate font-medium`,children:e.name}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[e.paidCount,`/`,e.count??`–`]})]}),(0,U.jsx)(G,{value:e.paidCount,max:e.count??0,label:e.name}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t(`cards.perMonthPay`),` `,(0,U.jsx)(E,{amount:e.perPayment,mode:`short`}),e.leftAmount!==null&&(0,U.jsxs)(U.Fragment,{children:[` · `,t(`cards.left`),` `,(0,U.jsx)(E,{amount:e.leftAmount,mode:`short`})]})]})]},e.plan))})})}function Q({d:e}){let{t,lang:n}=l(),r=e.record;if(!r)return(0,U.jsxs)(D,{title:t(`cards.lifecycle`),children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noRecord`)}),(0,U.jsx)(d,{prompt:t(`ask.cardRecord`,{name:e.account.name})})]});let i=e=>e?S(e,n):null,a=[[t(`cards.issued`),i(r.issued)],[t(`cards.activated`),i(r.activated)],[t(`cards.lockedOn`),i(r.locked)],[t(`cards.cancelledOn`),i(r.cancelled)],[t(`cards.network`),r.network?r.network.toUpperCase():null],[t(`cards.form`),r.physical?t(`cards.physical.${r.physical}`):null]];return(0,U.jsxs)(D,{title:t(`cards.lifecycle`),action:(0,U.jsx)(A,{status:r.status??`active`}),children:[(0,U.jsxs)(`dl`,{className:`divide-y`,children:[a.filter(([,e])=>e).map(([e,t])=>(0,U.jsx)(T,{label:e,children:t},e)),r.annual_fee?(0,U.jsx)(T,{label:t(`cards.annualFee`),children:(0,U.jsx)(E,{amount:r.annual_fee})}):null,r.close_fee?(0,U.jsx)(T,{label:t(`cards.closeFee`),children:(0,U.jsx)(E,{amount:r.close_fee})}):null,r.keep_for_limit&&(0,U.jsx)(T,{label:t(`cards.keepForLimit`),children:t(`cards.yes`)})]}),r.cancel_plan&&(0,U.jsxs)(`div`,{className:`rounded-md bg-muted/60 p-3 text-sm`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:t(`cards.cancelPlan`,{by:r.cancel_plan.by??``})}),r.cancel_plan.note&&(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:r.cancel_plan.note})]}),r.note&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r.note})]})}function $({d:e}){let{t}=l(),n=e.value;return n?(0,U.jsx)(D,{title:t(`cards.netValue`),children:(0,U.jsxs)(`dl`,{className:`divide-y`,children:[(0,U.jsx)(T,{label:t(`cards.value.benefits`),children:(0,U.jsx)(E,{amount:n.benefits})}),(0,U.jsx)(T,{label:t(`cards.cashback`),children:(0,U.jsx)(E,{amount:n.cashback})}),(0,U.jsx)(T,{label:n.feesFrom===`record`?`${t(`cards.value.fees`)} (${t(`cards.value.estimated`)})`:t(`cards.value.fees`),children:(0,U.jsx)(E,{amount:-n.fees})}),n.closeFee>0&&(0,U.jsx)(T,{label:t(`cards.closeFee`),children:(0,U.jsx)(E,{amount:-n.closeFee})}),(0,U.jsx)(T,{label:t(`cards.value.sinceIssued`),className:`font-medium`,children:(0,U.jsx)(E,{amount:n.net,tone:`auto`})}),(0,U.jsx)(T,{label:t(`cards.value.last12`),className:`font-medium`,children:(0,U.jsx)(E,{amount:n.last12.net,tone:`auto`})})]})}):null}function ee({params:e}){let{t}=l(),n=decodeURIComponent(e.account),{data:r,error:i,isLoading:a}=c(n),[o,s]=(0,H.useState)(null),d=(0,U.jsxs)(`a`,{href:`#/cards`,className:`inline-flex min-h-11 items-center gap-1 self-start rounded-md text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,U.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t(`cards.back`)]});if(i)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i instanceof u&&i.status===404?t(`cards.notFound`):t(`common.error`,{message:i.message})})]});if(a||!r)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[d,(0,U.jsx)(h,{className:`h-8 w-56`}),(0,U.jsx)(h,{className:`h-40 w-full`})]});let f=r.summary,p=r.record?.status??(r.account.closed?`cancelled`:`active`),m=r.terms.last4,g=[r.terms.bank,m?t(`cards.last4`,{n:m}):null].filter(Boolean).join(` · `);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d,(0,U.jsxs)(`header`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:r.account.name}),(0,U.jsx)(A,{status:p})]}),g&&(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:g}),f&&(0,U.jsx)(j,{owed:f.owed,limit:f.limit,atLeast:f.limitAtLeast,className:`max-w-md`}),f&&(0,U.jsx)(k,{card:f,className:`max-w-md`})]}),(0,U.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{d:r,asOf:r.asOf}),(0,U.jsx)(q,{s:f.last,id:r.account.id,asOf:r.asOf}),(0,U.jsx)(J,{list:r.statements,onOpen:s})]}):(0,U.jsx)(D,{title:t(`cards.statements`),children:(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`cards.noStatements`)})})}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,U.jsx)(Y,{d:r}),(0,U.jsx)(X,{d:r,asOf:r.asOf}),(0,U.jsx)(Z,{d:r}),(0,U.jsx)(Q,{d:r}),(0,U.jsx)($,{d:r})]})]}),(0,U.jsx)(W,{account:r.account.id,close:o,onClose:()=>s(null)})]})}export{ee as default};
@@ -1 +1 @@
1
- import{B as e,I as t,L as n,a as r,u as i,w as a}from"./queries-DZIMMe4i.js";import{t as o}from"./Money-PfFNNDOw.js";import{a as s,i as c,n as l,o as u,r as d,s as f}from"./bits-Dr2E0ObC.js";import{H as p,U as m,W as h,n as g,u as _}from"./index-eR1GkdC_.js";import{i as v,t as y}from"./cards-Bb5zjzRG.js";import{t as b}from"./drill-t1zr57xi.js";var x=e(t(),1),S=n();function C({label:e,amount:t,sub:n}){return(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 rounded-xl border bg-card p-3`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,S.jsx)(o,{amount:t,mode:`short`,className:`text-xl font-semibold tracking-tight`}),n&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n})]})}function w({c:e}){let{t,lang:n}=a(),r=e.cashback,i=r&&(r.expected>0||r.spend>0||r.cap!==null);return(0,S.jsxs)(`li`,{className:`relative flex flex-col gap-2 rounded-xl border bg-card p-3 focus-within:ring-3 focus-within:ring-ring/50 hover:bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`a`,{href:y(e.account),className:`min-h-6 truncate rounded-md text-sm font-medium outline-none after:absolute after:inset-0 after:rounded-xl focus-visible:underline`,children:e.name}),(0,S.jsx)(l,{status:e.status})]}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[e.bank,e.last4?t(`cards.last4`,{n:e.last4}):null].filter(Boolean).join(` · `)})]}),(0,S.jsx)(`div`,{className:`flex shrink-0 flex-col items-end`,children:e.toPay>0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{amount:e.toPay,mode:`short`,className:`text-base font-semibold`}),(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.due&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g(e.due)}),(0,S.jsx)(d,{days:e.daysToDue})]})]}):(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`cards.nothingToPay`)})})]}),(0,S.jsx)(u,{owed:e.owed,limit:e.limit,atLeast:e.limitAtLeast}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[e.last?(0,S.jsx)(s,{status:e.last.status}):(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`cards.noStatement`)}),i&&(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[t(`cards.cashbackShort`),` `,r.incomplete?t(`cards.rateNotSet`):(0,S.jsx)(o,{amount:r.expected,mode:`short`,className:`font-medium text-foreground`}),r.capLeft!==null&&(0,S.jsxs)(S.Fragment,{children:[` · `,t(`cards.capLeft`,{amount:_(r.capLeft,n)})]})]})]}),(0,S.jsx)(c,{card:e})]})}function T({r:e}){let{t}=a(),n=e.name??([e.bank,e.last4].filter(Boolean).join(` `)||e.id),r=[e.bank,e.network?.toUpperCase(),e.last4?t(`cards.last4`,{n:e.last4}):null,t(`cards.kind.${e.kind}`)].filter(Boolean).join(` · `),i=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n}),(0,S.jsx)(l,{status:e.status??`active`})]}),(0,S.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r})]}),(0,S.jsx)(`span`,{className:`shrink-0 text-right text-xs text-muted-foreground`,children:e.annual_fee?(0,S.jsxs)(S.Fragment,{children:[t(`cards.annualFee`),` `,(0,S.jsx)(o,{amount:e.annual_fee,mode:`short`,className:`text-foreground`})]}):t(`cards.noFee`)})]});return(0,S.jsx)(`li`,{children:e.account?(0,S.jsx)(`a`,{href:b({account:e.account}),className:`flex min-h-11 items-center gap-3 rounded-md px-1 py-1.5 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:i}):(0,S.jsx)(`div`,{className:`flex min-h-11 items-center gap-3 px-1 py-1.5`,children:i})})}function E(){let{t:e,lang:t}=a(),n=i().data,o=!!n?.features?.cards,[s,c]=(0,x.useState)(`active`),l=r(o,!1),u=r(o&&s===`cancelled`,!0),d=s===`cancelled`?u.data??l.data:l.data,g=l.error??(s===`cancelled`?u.error:null),y=(0,x.useMemo)(()=>(d?.cards??[]).filter(e=>v(e.status)===s),[d,s]),b=(0,x.useMemo)(()=>(d?.records??[]).filter(e=>e.kind!==`credit`&&v(e.status??`active`)===s),[d,s]),E=(l.data?.cards??[]).filter(e=>e.owed>0).length;if(!o&&n)return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e(`cards.title`)}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`cards.off`)})]});let D=l.data?.totals;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,S.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e(`cards.title`)}),D?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`cards.headline`,{owed:_(D.owed,t),n:E})}):(0,S.jsx)(h,{className:`h-5 w-64`})]}),g?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`common.error`,{message:g.message})}):d?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`section`,{"aria-label":e(`cards.totals`),className:`grid grid-cols-3 gap-2`,children:[(0,S.jsx)(C,{label:e(`cards.owedAll`),amount:d.totals.owed}),(0,S.jsx)(C,{label:e(`cards.dueWeek`),amount:d.totals.dueWeek}),(0,S.jsx)(C,{label:e(`cards.dueMonth`),amount:d.totals.dueMonth})]}),(0,S.jsx)(p,{type:`single`,variant:`outline`,value:s,onValueChange:e=>e&&c(e),"aria-label":e(`cards.filter`),className:`self-start`,children:[`active`,`locked`,`cancelled`].map(t=>(0,S.jsx)(m,{value:t,className:`min-h-11 px-3 md:min-h-8`,children:e(`cards.group.${t}`)},t))}),(0,S.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-labelledby":`cards-credit`,children:[(0,S.jsx)(`h2`,{id:`cards-credit`,className:`text-base font-semibold`,children:e(`cards.credit`)}),y.length===0?(0,S.jsx)(`p`,{className:`rounded-lg border border-dashed p-4 text-sm text-muted-foreground`,children:e(`cards.emptyCredit`)}):(0,S.jsx)(`ul`,{className:`grid gap-3 lg:grid-cols-2 2xl:grid-cols-3`,children:y.map(e=>(0,S.jsx)(w,{c:e},e.account))})]}),b.length>0&&(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-labelledby":`cards-debit`,children:[(0,S.jsx)(`h2`,{id:`cards-debit`,className:`text-base font-semibold`,children:e(`cards.debit`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`cards.debitHint`)}),(0,S.jsx)(`ul`,{className:`flex flex-col divide-y rounded-xl border bg-card px-2`,children:b.map(e=>(0,S.jsx)(T,{r:e},e.id))})]}),d.values.length>0&&(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-labelledby":`cards-value`,children:[(0,S.jsx)(`h2`,{id:`cards-value`,className:`text-base font-semibold`,children:e(`widget.cards_value`)}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`cards.value.hint`),` `,(0,S.jsx)(`span`,{children:e(`cards.value.total`,{amount:_(d.values.reduce((e,t)=>e+t.last12.net,0),t)})})]}),(0,S.jsx)(`div`,{className:`rounded-xl border bg-card px-3`,children:(0,S.jsx)(f,{values:d.values})})]})]}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[(0,S.jsx)(h,{className:`h-16 w-full`}),(0,S.jsx)(h,{className:`h-32 w-full`}),(0,S.jsx)(h,{className:`h-32 w-full`})]})]})}export{E as default};
1
+ import{B as e,I as t,L as n,a as r,u as i,w as a}from"./queries-BcMmmb36.js";import{t as o}from"./Money-BwLucm7P.js";import{a as s,i as c,n as l,o as u,r as d,s as f}from"./bits-D34d9IBm.js";import{H as p,U as m,W as h,n as g,u as _}from"./index-DBHFdsYB.js";import{i as v,t as y}from"./cards-Ct0jh73r.js";import{t as b}from"./drill-t1zr57xi.js";var x=e(t(),1),S=n();function C({label:e,amount:t,sub:n}){return(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 rounded-xl border bg-card p-3`,children:[(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,S.jsx)(o,{amount:t,mode:`short`,className:`text-xl font-semibold tracking-tight`}),n&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n})]})}function w({c:e}){let{t,lang:n}=a(),r=e.cashback,i=r&&(r.expected>0||r.spend>0||r.cap!==null);return(0,S.jsxs)(`li`,{className:`relative flex flex-col gap-2 rounded-xl border bg-card p-3 focus-within:ring-3 focus-within:ring-ring/50 hover:bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,S.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`a`,{href:y(e.account),className:`min-h-6 truncate rounded-md text-sm font-medium outline-none after:absolute after:inset-0 after:rounded-xl focus-visible:underline`,children:e.name}),(0,S.jsx)(l,{status:e.status})]}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:[e.bank,e.last4?t(`cards.last4`,{n:e.last4}):null].filter(Boolean).join(` · `)})]}),(0,S.jsx)(`div`,{className:`flex shrink-0 flex-col items-end`,children:e.toPay>0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{amount:e.toPay,mode:`short`,className:`text-base font-semibold`}),(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.due&&(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g(e.due)}),(0,S.jsx)(d,{days:e.daysToDue})]})]}):(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`cards.nothingToPay`)})})]}),(0,S.jsx)(u,{owed:e.owed,limit:e.limit,atLeast:e.limitAtLeast}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[e.last?(0,S.jsx)(s,{status:e.last.status}):(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`cards.noStatement`)}),i&&(0,S.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[t(`cards.cashbackShort`),` `,r.incomplete?t(`cards.rateNotSet`):(0,S.jsx)(o,{amount:r.expected,mode:`short`,className:`font-medium text-foreground`}),r.capLeft!==null&&(0,S.jsxs)(S.Fragment,{children:[` · `,t(`cards.capLeft`,{amount:_(r.capLeft,n)})]})]})]}),(0,S.jsx)(c,{card:e})]})}function T({r:e}){let{t}=a(),n=e.name??([e.bank,e.last4].filter(Boolean).join(` `)||e.id),r=[e.bank,e.network?.toUpperCase(),e.last4?t(`cards.last4`,{n:e.last4}):null,t(`cards.kind.${e.kind}`)].filter(Boolean).join(` · `),i=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n}),(0,S.jsx)(l,{status:e.status??`active`})]}),(0,S.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r})]}),(0,S.jsx)(`span`,{className:`shrink-0 text-right text-xs text-muted-foreground`,children:e.annual_fee?(0,S.jsxs)(S.Fragment,{children:[t(`cards.annualFee`),` `,(0,S.jsx)(o,{amount:e.annual_fee,mode:`short`,className:`text-foreground`})]}):t(`cards.noFee`)})]});return(0,S.jsx)(`li`,{children:e.account?(0,S.jsx)(`a`,{href:b({account:e.account}),className:`flex min-h-11 items-center gap-3 rounded-md px-1 py-1.5 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:i}):(0,S.jsx)(`div`,{className:`flex min-h-11 items-center gap-3 px-1 py-1.5`,children:i})})}function E(){let{t:e,lang:t}=a(),n=i().data,o=!!n?.features?.cards,[s,c]=(0,x.useState)(`active`),l=r(o,!1),u=r(o&&s===`cancelled`,!0),d=s===`cancelled`?u.data??l.data:l.data,g=l.error??(s===`cancelled`?u.error:null),y=(0,x.useMemo)(()=>(d?.cards??[]).filter(e=>v(e.status)===s),[d,s]),b=(0,x.useMemo)(()=>(d?.records??[]).filter(e=>e.kind!==`credit`&&v(e.status??`active`)===s),[d,s]),E=(l.data?.cards??[]).filter(e=>e.owed>0).length;if(!o&&n)return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e(`cards.title`)}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`cards.off`)})]});let D=l.data?.totals;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,S.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e(`cards.title`)}),D?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`cards.headline`,{owed:_(D.owed,t),n:E})}):(0,S.jsx)(h,{className:`h-5 w-64`})]}),g?(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`common.error`,{message:g.message})}):d?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`section`,{"aria-label":e(`cards.totals`),className:`grid grid-cols-3 gap-2`,children:[(0,S.jsx)(C,{label:e(`cards.owedAll`),amount:d.totals.owed}),(0,S.jsx)(C,{label:e(`cards.dueWeek`),amount:d.totals.dueWeek}),(0,S.jsx)(C,{label:e(`cards.dueMonth`),amount:d.totals.dueMonth})]}),(0,S.jsx)(p,{type:`single`,variant:`outline`,value:s,onValueChange:e=>e&&c(e),"aria-label":e(`cards.filter`),className:`self-start`,children:[`active`,`locked`,`cancelled`].map(t=>(0,S.jsx)(m,{value:t,className:`min-h-11 px-3 md:min-h-8`,children:e(`cards.group.${t}`)},t))}),(0,S.jsxs)(`section`,{className:`flex flex-col gap-3`,"aria-labelledby":`cards-credit`,children:[(0,S.jsx)(`h2`,{id:`cards-credit`,className:`text-base font-semibold`,children:e(`cards.credit`)}),y.length===0?(0,S.jsx)(`p`,{className:`rounded-lg border border-dashed p-4 text-sm text-muted-foreground`,children:e(`cards.emptyCredit`)}):(0,S.jsx)(`ul`,{className:`grid gap-3 lg:grid-cols-2 2xl:grid-cols-3`,children:y.map(e=>(0,S.jsx)(w,{c:e},e.account))})]}),b.length>0&&(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-labelledby":`cards-debit`,children:[(0,S.jsx)(`h2`,{id:`cards-debit`,className:`text-base font-semibold`,children:e(`cards.debit`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`cards.debitHint`)}),(0,S.jsx)(`ul`,{className:`flex flex-col divide-y rounded-xl border bg-card px-2`,children:b.map(e=>(0,S.jsx)(T,{r:e},e.id))})]}),d.values.length>0&&(0,S.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-labelledby":`cards-value`,children:[(0,S.jsx)(`h2`,{id:`cards-value`,className:`text-base font-semibold`,children:e(`widget.cards_value`)}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`cards.value.hint`),` `,(0,S.jsx)(`span`,{children:e(`cards.value.total`,{amount:_(d.values.reduce((e,t)=>e+t.last12.net,0),t)})})]}),(0,S.jsx)(`div`,{className:`rounded-xl border bg-card px-3`,children:(0,S.jsx)(f,{values:d.values})})]})]}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,children:[(0,S.jsx)(h,{className:`h-16 w-full`}),(0,S.jsx)(h,{className:`h-32 w-full`}),(0,S.jsx)(h,{className:`h-32 w-full`})]})]})}export{E as default};
@@ -1 +1 @@
1
- import{t as e}from"./Money-PfFNNDOw.js";import{o as t,r as n}from"./bits-Dr2E0ObC.js";import{M as r,n as i}from"./index-eR1GkdC_.js";import{L as a,a as o,u as s,w as c}from"./queries-DZIMMe4i.js";import{t as l}from"./cards-Bb5zjzRG.js";import{n as u}from"./shared-Box7on3B.js";var d=a(),f=8;function p({widget:a,menu:p}){let{t:m}=c(),h=u(a,`widget.cards`),g=!!s().data?.features?.cards,{data:_,error:v,isLoading:y}=o(g),b=(_?.cards??[]).filter(e=>e.status!==`cancelled`);return(0,d.jsxs)(r,{title:h,titleHref:`#/cards`,menu:p,loading:g&&y,error:g?v?.message:void 0,empty:!g||_&&b.length===0?m(`cards.emptyCredit`):void 0,children:[(0,d.jsx)(`ul`,{className:`flex flex-col divide-y`,children:b.slice(0,f).map(r=>(0,d.jsxs)(`li`,{className:`flex flex-col gap-1.5 py-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,d.jsx)(`a`,{href:l(r.account),className:`min-w-0 truncate rounded-md text-sm font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:r.name}),r.toPay>0?(0,d.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2`,children:[(0,d.jsx)(e,{amount:r.toPay,mode:`short`,className:`text-sm font-medium`}),r.due&&(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(r.due)}),(0,d.jsx)(n,{days:r.daysToDue})]}):(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m(`cards.nothingToPay`)})]}),(0,d.jsx)(t,{owed:r.owed,limit:r.limit,atLeast:r.limitAtLeast})]},r.account))}),b.length>f&&(0,d.jsx)(`a`,{href:`#/cards`,className:`min-h-11 self-start py-2 text-sm underline`,children:m(`attention.seeAll`,{n:b.length})})]})}export{p as default};
1
+ import{t as e}from"./Money-BwLucm7P.js";import{o as t,r as n}from"./bits-D34d9IBm.js";import{M as r,n as i}from"./index-DBHFdsYB.js";import{L as a,a as o,u as s,w as c}from"./queries-BcMmmb36.js";import{t as l}from"./cards-Ct0jh73r.js";import{n as u}from"./shared-BgU6fc7z.js";var d=a(),f=8;function p({widget:a,menu:p}){let{t:m}=c(),h=u(a,`widget.cards`),g=!!s().data?.features?.cards,{data:_,error:v,isLoading:y}=o(g),b=(_?.cards??[]).filter(e=>e.status!==`cancelled`);return(0,d.jsxs)(r,{title:h,titleHref:`#/cards`,menu:p,loading:g&&y,error:g?v?.message:void 0,empty:!g||_&&b.length===0?m(`cards.emptyCredit`):void 0,children:[(0,d.jsx)(`ul`,{className:`flex flex-col divide-y`,children:b.slice(0,f).map(r=>(0,d.jsxs)(`li`,{className:`flex flex-col gap-1.5 py-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,d.jsx)(`a`,{href:l(r.account),className:`min-w-0 truncate rounded-md text-sm font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:r.name}),r.toPay>0?(0,d.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2`,children:[(0,d.jsx)(e,{amount:r.toPay,mode:`short`,className:`text-sm font-medium`}),r.due&&(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(r.due)}),(0,d.jsx)(n,{days:r.daysToDue})]}):(0,d.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m(`cards.nothingToPay`)})]}),(0,d.jsx)(t,{owed:r.owed,limit:r.limit,atLeast:r.limitAtLeast})]},r.account))}),b.length>f&&(0,d.jsx)(`a`,{href:`#/cards`,className:`min-h-11 self-start py-2 text-sm underline`,children:m(`attention.seeAll`,{n:b.length})})]})}export{p as default};
@@ -1 +1 @@
1
- import{s as e}from"./bits-Dr2E0ObC.js";import{M as t}from"./index-eR1GkdC_.js";import{L as n,a as r,u as i,w as a}from"./queries-DZIMMe4i.js";import{n as o}from"./shared-Box7on3B.js";var s=n();function c({widget:n,menu:c}){let{t:l}=a(),u=o(n,`widget.cards_value`),d=!!i().data?.features?.cards,{data:f,error:p,isLoading:m}=r(d),h=f?.values??[];return(0,s.jsxs)(t,{title:u,titleHref:`#/cards`,menu:c,loading:d&&m,error:d?p?.message:void 0,empty:!d||f&&h.length===0?l(`cards.value.empty`):void 0,children:[(0,s.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`cards.value.hint`)}),(0,s.jsx)(e,{values:h,limit:8,compact:!0})]})}export{c as default};
1
+ import{s as e}from"./bits-D34d9IBm.js";import{M as t}from"./index-DBHFdsYB.js";import{L as n,a as r,u as i,w as a}from"./queries-BcMmmb36.js";import{n as o}from"./shared-BgU6fc7z.js";var s=n();function c({widget:n,menu:c}){let{t:l}=a(),u=o(n,`widget.cards_value`),d=!!i().data?.features?.cards,{data:f,error:p,isLoading:m}=r(d),h=f?.values??[];return(0,s.jsxs)(t,{title:u,titleHref:`#/cards`,menu:c,loading:d&&m,error:d?p?.message:void 0,empty:!d||f&&h.length===0?l(`cards.value.empty`):void 0,children:[(0,s.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`cards.value.hint`)}),(0,s.jsx)(e,{values:h,limit:8,compact:!0})]})}export{c as default};
@@ -1 +1 @@
1
- import{t as e}from"./Money-PfFNNDOw.js";import{M as t,u as n}from"./index-eR1GkdC_.js";import{L as r,a as i,u as a,w as o}from"./queries-DZIMMe4i.js";import{t as s}from"./cards-Bb5zjzRG.js";import{n as c}from"./shared-Box7on3B.js";var l=r();function u({widget:r,menu:u}){let{t:d,lang:f}=o(),p=c(r,`widget.cashback`),m=!!a().data?.features?.cards,{data:h,error:g,isLoading:_}=i(m),v=(h?.cards??[]).filter(e=>e.status!==`cancelled`&&e.cashback&&(e.cashback.cap!==null||e.cashback.expected>0||e.cashback.spend>0||e.cashback.incomplete)),y=v.reduce((e,t)=>e+(t.cashback?.expected??0),0);return(0,l.jsxs)(t,{title:p,titleHref:`#/cards`,menu:u,loading:m&&_,error:m?g?.message:void 0,empty:!m||h&&v.length===0?d(`cashback.empty`):void 0,children:[(0,l.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[d(`cashback.total`),` `,(0,l.jsx)(e,{amount:y,mode:`short`,className:`font-medium text-foreground`})]}),(0,l.jsx)(`ul`,{className:`flex flex-col divide-y`,children:v.map(t=>{let r=t.cashback,i=r.cap?Math.min(1,(r.cap-(r.capLeft??r.cap))/r.cap):0;return(0,l.jsxs)(`li`,{className:`flex flex-col gap-1 py-2`,children:[(0,l.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,l.jsx)(`a`,{href:s(t.account),className:`min-w-0 truncate rounded-md text-sm font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:t.name}),r.incomplete?(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-warning`,children:d(`cards.rateNotSet`)}):(0,l.jsx)(e,{amount:r.expected,mode:`short`,className:`shrink-0 text-sm font-medium`})]}),r.cap!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{role:`progressbar`,"aria-label":d(`cards.capLeftLabel`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),className:`h-1.5 w-full rounded-full bg-muted`,children:(0,l.jsx)(`div`,{className:`h-1.5 rounded-full bg-[var(--chart-1)]`,style:{width:`${Math.max(i?2:0,i*100)}%`}})}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`cards.capLeft`,{amount:n(r.capLeft??r.cap,f)})})]})]},t.account)})})]})}export{u as default};
1
+ import{t as e}from"./Money-BwLucm7P.js";import{M as t,u as n}from"./index-DBHFdsYB.js";import{L as r,a as i,u as a,w as o}from"./queries-BcMmmb36.js";import{t as s}from"./cards-Ct0jh73r.js";import{n as c}from"./shared-BgU6fc7z.js";var l=r();function u({widget:r,menu:u}){let{t:d,lang:f}=o(),p=c(r,`widget.cashback`),m=!!a().data?.features?.cards,{data:h,error:g,isLoading:_}=i(m),v=(h?.cards??[]).filter(e=>e.status!==`cancelled`&&e.cashback&&(e.cashback.cap!==null||e.cashback.expected>0||e.cashback.spend>0||e.cashback.incomplete)),y=v.reduce((e,t)=>e+(t.cashback?.expected??0),0);return(0,l.jsxs)(t,{title:p,titleHref:`#/cards`,menu:u,loading:m&&_,error:m?g?.message:void 0,empty:!m||h&&v.length===0?d(`cashback.empty`):void 0,children:[(0,l.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[d(`cashback.total`),` `,(0,l.jsx)(e,{amount:y,mode:`short`,className:`font-medium text-foreground`})]}),(0,l.jsx)(`ul`,{className:`flex flex-col divide-y`,children:v.map(t=>{let r=t.cashback,i=r.cap?Math.min(1,(r.cap-(r.capLeft??r.cap))/r.cap):0;return(0,l.jsxs)(`li`,{className:`flex flex-col gap-1 py-2`,children:[(0,l.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,l.jsx)(`a`,{href:s(t.account),className:`min-w-0 truncate rounded-md text-sm font-medium outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:t.name}),r.incomplete?(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-warning`,children:d(`cards.rateNotSet`)}):(0,l.jsx)(e,{amount:r.expected,mode:`short`,className:`shrink-0 text-sm font-medium`})]}),r.cap!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{role:`progressbar`,"aria-label":d(`cards.capLeftLabel`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i*100),className:`h-1.5 w-full rounded-full bg-muted`,children:(0,l.jsx)(`div`,{className:`h-1.5 rounded-full bg-[var(--chart-1)]`,style:{width:`${Math.max(i?2:0,i*100)}%`}})}),(0,l.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`cards.capLeft`,{amount:n(r.capLeft??r.cap,f)})})]})]},t.account)})})]})}export{u as default};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";import{$ as t,Q as n,rt as r}from"./index-eR1GkdC_.js";import{L as i,T as a}from"./queries-DZIMMe4i.js";var o={name:`banknote`,size:24,node:[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`,key:`9lu3g6`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M6 12h.01M18 12h.01`,key:`113zkx`}]]};o.node;var s=e(o),c={name:`car`,size:24,node:[[`path`,{d:`M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2`,key:`5owen`}],[`circle`,{cx:`7`,cy:`17`,r:`2`,key:`u2ysq9`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}],[`circle`,{cx:`17`,cy:`17`,r:`2`,key:`axvx0g`}]]};c.node;var l=e(c),u={name:`circle-ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]};u.node;var d=e(u),f={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};f.node;var p=e(f),m={name:`gamepad-2`,size:24,node:[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]};m.node;var h=e(m),g={name:`gift`,size:24,node:[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]};g.node;var _=e(g),v={name:`graduation-cap`,size:24,node:[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]};v.node;var y=e(v),b={name:`hand-coins`,size:24,node:[[`path`,{d:`M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17`,key:`geh8rc`}],[`path`,{d:`m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9`,key:`1fto5m`}],[`path`,{d:`m2 16 6 6`,key:`1pfhp9`}],[`circle`,{cx:`16`,cy:`9`,r:`2.9`,key:`1n0dlu`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]};b.node;var x=e(b),S={name:`heart-pulse`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]};S.node;var C=e(S),w={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};w.node;var T=e(w),E={name:`percent`,size:24,node:[[`line`,{x1:`19`,x2:`5`,y1:`5`,y2:`19`,key:`1x9vlm`}],[`circle`,{cx:`6.5`,cy:`6.5`,r:`2.5`,key:`4mh3h7`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`2.5`,key:`1mdrzq`}]]};E.node;var D=e(E),O={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};O.node;var k=e(O),A={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};A.node;var j=e(A),M={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};M.node;var N=e(M),P={name:`utensils`,size:24,node:[[`path`,{d:`M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2`,key:`cjf0a3`}],[`path`,{d:`M7 2v20`,key:`1473qp`}],[`path`,{d:`M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7`,key:`j28e5`}]],aliases:[`fork-knife`]};P.node;var F=e(P),I={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};I.node;var L=e(I),R=i(),z={food:F,transport:l,home:t,family:N,health:C,shopping:j,fun:h,learning:y,"work-tools":L,subscriptions:k,"bank-fees":n,other:d,salary:s,freelance:T,interest:D,cashback:x,"gifts-received":_,"other-income":p},B=[`bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200`,`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`,`bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200`,`bg-violet-100 text-violet-800 dark:bg-violet-950 dark:text-violet-200`,`bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-200`,`bg-teal-100 text-teal-800 dark:bg-teal-950 dark:text-teal-200`];function V(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t}function H({category:e,name:t,transfer:n,className:r}){let i=`flex size-9 shrink-0 items-center justify-center rounded-full`;if(n)return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`bg-muted text-muted-foreground`,r),children:(0,R.jsx)(U,{})});let o=(e??`other`).split(`/`)[0],s=z[o];if(s)return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`bg-muted text-foreground`,r),children:(0,R.jsx)(s,{className:`size-4`})});let c=([...t??o][0]??`?`).toUpperCase();return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`text-sm font-medium`,B[V(o)%B.length],r),children:c})}var U=()=>(0,R.jsx)(r,{className:`size-4`});export{H as t};
1
+ import{t as e}from"./createLucideIcon-XZ28znwT.js";import{$ as t,Q as n,rt as r}from"./index-DBHFdsYB.js";import{L as i,T as a}from"./queries-BcMmmb36.js";var o={name:`banknote`,size:24,node:[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`2`,key:`9lu3g6`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`M6 12h.01M18 12h.01`,key:`113zkx`}]]};o.node;var s=e(o),c={name:`car`,size:24,node:[[`path`,{d:`M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2`,key:`5owen`}],[`circle`,{cx:`7`,cy:`17`,r:`2`,key:`u2ysq9`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}],[`circle`,{cx:`17`,cy:`17`,r:`2`,key:`axvx0g`}]]};c.node;var l=e(c),u={name:`circle-ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]};u.node;var d=e(u),f={name:`circle-plus`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-circle`]};f.node;var p=e(f),m={name:`gamepad-2`,size:24,node:[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]};m.node;var h=e(m),g={name:`gift`,size:24,node:[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]};g.node;var _=e(g),v={name:`graduation-cap`,size:24,node:[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]};v.node;var y=e(v),b={name:`hand-coins`,size:24,node:[[`path`,{d:`M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17`,key:`geh8rc`}],[`path`,{d:`m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9`,key:`1fto5m`}],[`path`,{d:`m2 16 6 6`,key:`1pfhp9`}],[`circle`,{cx:`16`,cy:`9`,r:`2.9`,key:`1n0dlu`}],[`circle`,{cx:`6`,cy:`5`,r:`3`,key:`151irh`}]]};b.node;var x=e(b),S={name:`heart-pulse`,size:24,node:[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]};S.node;var C=e(S),w={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};w.node;var T=e(w),E={name:`percent`,size:24,node:[[`line`,{x1:`19`,x2:`5`,y1:`5`,y2:`19`,key:`1x9vlm`}],[`circle`,{cx:`6.5`,cy:`6.5`,r:`2.5`,key:`4mh3h7`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`2.5`,key:`1mdrzq`}]]};E.node;var D=e(E),O={name:`repeat`,size:24,node:[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]};O.node;var k=e(O),A={name:`shopping-bag`,size:24,node:[[`path`,{d:`M16 10a4 4 0 0 1-8 0`,key:`1ltviw`}],[`path`,{d:`M3.103 6.034h17.794`,key:`awc11p`}],[`path`,{d:`M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z`,key:`o988cm`}]]};A.node;var j=e(A),M={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};M.node;var N=e(M),P={name:`utensils`,size:24,node:[[`path`,{d:`M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2`,key:`cjf0a3`}],[`path`,{d:`M7 2v20`,key:`1473qp`}],[`path`,{d:`M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7`,key:`j28e5`}]],aliases:[`fork-knife`]};P.node;var F=e(P),I={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};I.node;var L=e(I),R=i(),z={food:F,transport:l,home:t,family:N,health:C,shopping:j,fun:h,learning:y,"work-tools":L,subscriptions:k,"bank-fees":n,other:d,salary:s,freelance:T,interest:D,cashback:x,"gifts-received":_,"other-income":p},B=[`bg-sky-100 text-sky-800 dark:bg-sky-950 dark:text-sky-200`,`bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-200`,`bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-200`,`bg-violet-100 text-violet-800 dark:bg-violet-950 dark:text-violet-200`,`bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-200`,`bg-teal-100 text-teal-800 dark:bg-teal-950 dark:text-teal-200`];function V(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return t}function H({category:e,name:t,transfer:n,className:r}){let i=`flex size-9 shrink-0 items-center justify-center rounded-full`;if(n)return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`bg-muted text-muted-foreground`,r),children:(0,R.jsx)(U,{})});let o=(e??`other`).split(`/`)[0],s=z[o];if(s)return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`bg-muted text-foreground`,r),children:(0,R.jsx)(s,{className:`size-4`})});let c=([...t??o][0]??`?`).toUpperCase();return(0,R.jsx)(`span`,{"aria-hidden":!0,className:a(i,`text-sm font-medium`,B[V(o)%B.length],r),children:c})}var U=()=>(0,R.jsx)(r,{className:`size-4`});export{H as t};
@@ -1 +1 @@
1
- import{B as e,I as t,L as n,d as r,w as i}from"./queries-DZIMMe4i.js";import{t as a}from"./Combobox-xXeyjGgK.js";var o=e(t(),1),s=n();function c(e,t){let n=(e?.categories??[]).filter(e=>!e.path.startsWith(`_`)&&(!t||e.kind===t)),r=e=>e.split(`/`).map((e,t,n)=>n.slice(0,t+1).join(`/`)),i=new Map(n.map((e,t)=>[e.path,t]));return[{options:[...n].sort((e,t)=>{let n=r(e.path).map(e=>i.get(e)??1e9),a=r(t.path).map(e=>i.get(e)??1e9);for(let e=0;e<Math.max(n.length,a.length);e++)if((n[e]??-1)!==(a[e]??-1))return(n[e]??-1)-(a[e]??-1);return 0}).map(e=>({value:e.path,label:e.name,depth:e.path.split(`/`).length-1,keywords:[e.path]}))}]}function l({value:e,onSelect:t,className:n}){let{t:l}=i(),u=r().data,d=(0,o.useMemo)(()=>c(u,`expense`),[u]);return(0,s.jsx)(a,{label:l(`filter.category`),groups:d,value:e,onSelect:t,className:n??`w-full`})}export{c as n,l as t};
1
+ import{B as e,I as t,L as n,d as r,w as i}from"./queries-BcMmmb36.js";import{t as a}from"./Combobox-BvX68J3o.js";var o=e(t(),1),s=n();function c(e,t){let n=(e?.categories??[]).filter(e=>!e.path.startsWith(`_`)&&(!t||e.kind===t)),r=e=>e.split(`/`).map((e,t,n)=>n.slice(0,t+1).join(`/`)),i=new Map(n.map((e,t)=>[e.path,t]));return[{options:[...n].sort((e,t)=>{let n=r(e.path).map(e=>i.get(e)??1e9),a=r(t.path).map(e=>i.get(e)??1e9);for(let e=0;e<Math.max(n.length,a.length);e++)if((n[e]??-1)!==(a[e]??-1))return(n[e]??-1)-(a[e]??-1);return 0}).map(e=>({value:e.path,label:e.name,depth:e.path.split(`/`).length-1,keywords:[e.path]}))}]}function l({value:e,onSelect:t,className:n}){let{t:l}=i(),u=r().data,d=(0,o.useMemo)(()=>c(u,`expense`),[u]);return(0,s.jsx)(a,{label:l(`filter.category`),groups:d,value:e,onSelect:t,className:n??`w-full`})}export{c as n,l as t};
@@ -1 +1 @@
1
- import{B as e,I as t,L as n,m as r,w as i}from"./queries-DZIMMe4i.js";import{a,i as o,n as s,r as c,t as l}from"./charts-BqP7HKwP.js";import{t as u}from"./Money-PfFNNDOw.js";import{M as d,a as f,l as p,n as m}from"./index-eR1GkdC_.js";import{t as h}from"./drill-t1zr57xi.js";import{t as g}from"./shared-Box7on3B.js";var _=e(t(),1),v=n(),y=new Set([`day`,`week`,`month`]);function b(e,t,n,r){let i={from:r.from,to:r.to,category:e.category,account:Array.isArray(e.account)?void 0:e.account,who:e.who,event:e.event,tag:e.tag,text:e.text};switch(t){case`category`:case`top`:return h({...i,category:n});case`account`:return h({...i,account:n});case`who`:return h({...i,who:n});case`event`:return h({...i,event:n});case`tag`:return h({...i,tag:n});case`month`:{let[e,t]=n.split(`-`).map(Number);return h({...i,from:`${n}-01`,to:`${n}-${String(new Date(e,t,0).getDate()).padStart(2,`0`)}`})}case`day`:return h({...i,from:n,to:n});default:return}}function x({widget:e,menu:t}){let{t:n,lang:a}=i(),o=e.query,{data:s,error:c,isLoading:l}=r(o??{metric:`spending`},!!o),u=e.chart??`bar`,f=e.title?.trim()||n(`widget.chart`);return(0,v.jsx)(d,{title:f,menu:t,byAi:e.by_ai,loading:!!o&&l,error:o?c?.message:void 0,empty:o?s&&s.points.length===0&&u!==`stat`?n(`chart.empty`):void 0:n(`chart.noQuery`),children:s&&o&&(0,v.jsx)(S,{data:s,q:o,kind:u,lang:a})})}function S({data:e,q:t,kind:n,lang:r}){let{t:d}=i(),x=y.has(e.by),S=t.metric===`count`,w=t=>e.by===`month`?f(String(t)):m(String(t)),T=(0,_.useMemo)(()=>e.points.map(e=>({key:e.key,name:e.name,value:e.value,compare:e.compare??null})),[e]),E=T.some(e=>e.compare!==null),D={head:[d(`chart.item`),d(`chart.value`),...E?[d(`chart.compare`)]:[]],rows:T.map(e=>[x?w(e.key):e.name,p(e.value,r),...E?[p(e.compare??0,r)]:[]])},O=e=>S?(0,v.jsx)(`span`,{className:`tabular-nums`,children:p(e,r)}):(0,v.jsx)(u,{amount:e,mode:`short`});if(n===`stat`){let n=e.compareTotal?(e.total-e.compareTotal)/Math.abs(e.compareTotal)*100:null;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`a`,{href:h({from:e.period.from,to:e.period.to,category:t.category,account:Array.isArray(t.account)?void 0:t.account,who:t.who,event:t.event,tag:t.tag,text:t.text}),className:`text-2xl font-semibold tracking-tight outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:S?p(e.total,r):(0,v.jsx)(u,{amount:e.total})}),n!==null&&(0,v.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-muted-foreground`,children:[(0,v.jsx)(g,{pct:n,goodWhenDown:t.metric===`spending`}),t.compare===`usual`?d(`pace.vsUsual`):d(`chart.vsPrevious`)]})]})}if(n===`table`)return(0,v.jsxs)(`table`,{className:`w-full text-sm tabular-nums`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsx)(`tr`,{className:`text-left text-xs text-muted-foreground`,children:D.head.map((e,t)=>(0,v.jsx)(`th`,{className:`py-1 font-medium ${t>0?`text-right`:``}`,children:e},e))})}),(0,v.jsx)(`tbody`,{children:T.map((n,r)=>(0,v.jsxs)(`tr`,{className:`border-t`,children:[(0,v.jsx)(`td`,{className:`py-1.5`,children:(0,v.jsx)(`a`,{className:`hover:underline`,href:b(t,e.by,n.key,e.period),children:D.rows[r][0]})}),(0,v.jsx)(`td`,{className:`py-1.5 text-right`,children:O(n.value)}),E&&(0,v.jsx)(`td`,{className:`py-1.5 text-right text-muted-foreground`,children:O(n.compare??0)})]},n.key))})]});if(n===`hbar`)return(0,v.jsx)(c,{rows:T.map(n=>({key:n.key,name:x?w(n.key):n.name,value:n.value,label:O(n.value),href:b(t,e.by,n.key,e.period)}))});let k=[{key:`value`,label:C(t,d),color:a.accent},...E?[{key:`compare`,label:t.compare===`usual`?d(`pace.usual`):d(`chart.previous`),color:a.muted}]:[]];return(0,v.jsx)(l,{table:D,legend:k.map(e=>({label:e.label,color:e.color})),children:n===`line`?(0,v.jsx)(o,{data:T,xKey:`key`,formatX:x?w:e=>T.find(t=>t.key===e)?.name??String(e),specs:k.map(e=>({key:e.key,label:e.label,kind:`line`,color:e.color,width:e.key===`value`?2:1,dashed:e.key!==`value`}))}):(0,v.jsx)(s,{data:T.map(e=>({key:e.key,value:e.value,...E?{compare:e.compare??0}:{}})),xKey:`key`,formatX:x?w:e=>T.find(t=>t.key===e)?.name??String(e),series:k})})}function C(e,t){return t(`chart.metric.${e.metric}`)}export{x as default};
1
+ import{B as e,I as t,L as n,m as r,w as i}from"./queries-BcMmmb36.js";import{a,i as o,n as s,r as c,t as l}from"./charts-D-1glV8L.js";import{t as u}from"./Money-BwLucm7P.js";import{M as d,a as f,l as p,n as m}from"./index-DBHFdsYB.js";import{t as h}from"./drill-t1zr57xi.js";import{t as g}from"./shared-BgU6fc7z.js";var _=e(t(),1),v=n(),y=new Set([`day`,`week`,`month`]);function b(e,t,n,r){let i={from:r.from,to:r.to,category:e.category,account:Array.isArray(e.account)?void 0:e.account,who:e.who,event:e.event,tag:e.tag,text:e.text};switch(t){case`category`:case`top`:return h({...i,category:n});case`account`:return h({...i,account:n});case`who`:return h({...i,who:n});case`event`:return h({...i,event:n});case`tag`:return h({...i,tag:n});case`month`:{let[e,t]=n.split(`-`).map(Number);return h({...i,from:`${n}-01`,to:`${n}-${String(new Date(e,t,0).getDate()).padStart(2,`0`)}`})}case`day`:return h({...i,from:n,to:n});default:return}}function x({widget:e,menu:t}){let{t:n,lang:a}=i(),o=e.query,{data:s,error:c,isLoading:l}=r(o??{metric:`spending`},!!o),u=e.chart??`bar`,f=e.title?.trim()||n(`widget.chart`);return(0,v.jsx)(d,{title:f,menu:t,byAi:e.by_ai,loading:!!o&&l,error:o?c?.message:void 0,empty:o?s&&s.points.length===0&&u!==`stat`?n(`chart.empty`):void 0:n(`chart.noQuery`),children:s&&o&&(0,v.jsx)(S,{data:s,q:o,kind:u,lang:a})})}function S({data:e,q:t,kind:n,lang:r}){let{t:d}=i(),x=y.has(e.by),S=t.metric===`count`,w=t=>e.by===`month`?f(String(t)):m(String(t)),T=(0,_.useMemo)(()=>e.points.map(e=>({key:e.key,name:e.name,value:e.value,compare:e.compare??null})),[e]),E=T.some(e=>e.compare!==null),D={head:[d(`chart.item`),d(`chart.value`),...E?[d(`chart.compare`)]:[]],rows:T.map(e=>[x?w(e.key):e.name,p(e.value,r),...E?[p(e.compare??0,r)]:[]])},O=e=>S?(0,v.jsx)(`span`,{className:`tabular-nums`,children:p(e,r)}):(0,v.jsx)(u,{amount:e,mode:`short`});if(n===`stat`){let n=e.compareTotal?(e.total-e.compareTotal)/Math.abs(e.compareTotal)*100:null;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`a`,{href:h({from:e.period.from,to:e.period.to,category:t.category,account:Array.isArray(t.account)?void 0:t.account,who:t.who,event:t.event,tag:t.tag,text:t.text}),className:`text-2xl font-semibold tracking-tight outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,children:S?p(e.total,r):(0,v.jsx)(u,{amount:e.total})}),n!==null&&(0,v.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-muted-foreground`,children:[(0,v.jsx)(g,{pct:n,goodWhenDown:t.metric===`spending`}),t.compare===`usual`?d(`pace.vsUsual`):d(`chart.vsPrevious`)]})]})}if(n===`table`)return(0,v.jsxs)(`table`,{className:`w-full text-sm tabular-nums`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsx)(`tr`,{className:`text-left text-xs text-muted-foreground`,children:D.head.map((e,t)=>(0,v.jsx)(`th`,{className:`py-1 font-medium ${t>0?`text-right`:``}`,children:e},e))})}),(0,v.jsx)(`tbody`,{children:T.map((n,r)=>(0,v.jsxs)(`tr`,{className:`border-t`,children:[(0,v.jsx)(`td`,{className:`py-1.5`,children:(0,v.jsx)(`a`,{className:`hover:underline`,href:b(t,e.by,n.key,e.period),children:D.rows[r][0]})}),(0,v.jsx)(`td`,{className:`py-1.5 text-right`,children:O(n.value)}),E&&(0,v.jsx)(`td`,{className:`py-1.5 text-right text-muted-foreground`,children:O(n.compare??0)})]},n.key))})]});if(n===`hbar`)return(0,v.jsx)(c,{rows:T.map(n=>({key:n.key,name:x?w(n.key):n.name,value:n.value,label:O(n.value),href:b(t,e.by,n.key,e.period)}))});let k=[{key:`value`,label:C(t,d),color:a.accent},...E?[{key:`compare`,label:t.compare===`usual`?d(`pace.usual`):d(`chart.previous`),color:a.muted}]:[]];return(0,v.jsx)(l,{table:D,legend:k.map(e=>({label:e.label,color:e.color})),children:n===`line`?(0,v.jsx)(o,{data:T,xKey:`key`,formatX:x?w:e=>T.find(t=>t.key===e)?.name??String(e),specs:k.map(e=>({key:e.key,label:e.label,kind:`line`,color:e.color,width:e.key===`value`?2:1,dashed:e.key!==`value`}))}):(0,v.jsx)(s,{data:T.map(e=>({key:e.key,value:e.value,...E?{compare:e.compare??0}:{}})),xKey:`key`,formatX:x?w:e=>T.find(t=>t.key===e)?.name??String(e),series:k})})}function C(e,t){return t(`chart.metric.${e.metric}`)}export{x as default};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-flJrJK2p.js";import{B as t,I as n,L as r,T as i,w as a}from"./queries-DZIMMe4i.js";import{i as o,n as s,o as c,s as l,t as u}from"./button-rfwMVz0i.js";import{at as d,ct as f,ft as p,ht as m,mt as h,ot as g,st as _,tt as v,ut as ee}from"./index-eR1GkdC_.js";import{i as y,n as b,o as x,r as S,s as C}from"./dist-BDn7ydjn.js";import"./dialog-BuRqO4sc.js";import{a as w,c as T,i as E,l as D,n as O,o as k,r as te,s as A,t as j}from"./es2015-DJh4h8NX.js";import{t as M}from"./dist-B7PR2b0C.js";import{t as N}from"./fold-CGWYt9Iu.js";var P=t(n(),1),F=r(),ne=Object.defineProperty,I=(e,t)=>ne(e,`name`,{value:t,configurable:!0}),L=`Popover`,[re,ie]=x(L,[f]),ae=f(),[oe,R]=re(L),se=I(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=ae(t),c=P.useRef(null),[l,u]=P.useState(!1),[f,p]=P.useState(0),[m,h]=P.useState(0),[g,_]=S({prop:r,defaultProp:i??!1,onChange:a,caller:L});return(0,F.jsx)(d,{...s,children:(0,F.jsx)(oe,{scope:t,contentId:b(),titleId:b(),descriptionId:b(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:P.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ce=`PopoverTrigger`,le=P.forwardRef(I(function(e,t){let{__scopePopover:n,...r}=e,i=R(ce,n),a=ae(n),o=l(t,i.triggerRef),s=(0,F.jsx)(C.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":B(i.open),...r,ref:o,onClick:y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(g,{asChild:!0,...a,children:s})},`PopoverTrigger`)),ue=`PopoverPortal`,[de,fe]=re(ue,{forceMount:void 0}),pe=I(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=R(ue,t);return(0,F.jsx)(de,{scope:t,forceMount:n,children:(0,F.jsx)(M,{present:n||a.open,children:(0,F.jsx)(E,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),z=`PopoverContent`,me=P.forwardRef(I(function(e,t){let n=fe(z,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=R(z,e.__scopePopover);return(0,F.jsx)(M,{present:r||a.open,children:a.modal?(0,F.jsx)(ge,{...i,ref:t}):(0,F.jsx)(_e,{...i,ref:t})})},`PopoverContent`)),he=o(`PopoverContent.RemoveScroll`),ge=P.forwardRef(I(function(e,t){let n=R(z,e.__scopePopover),r=P.useRef(null),i=l(t,r),a=P.useRef(!1),{nodes:o,registry:s}=T();return P.useEffect(()=>{let e=r.current;if(e)return j(e)},[]),(0,F.jsx)(O,{as:he,allowPinchZoom:!0,shards:P.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,F.jsx)(ve,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_e=P.forwardRef(I(function(e,t){let n=R(z,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(ve,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ve=P.forwardRef(I(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=R(z,n),v=ae(n),[ee,y]=P.useState(null),b=l(t,y);return A(ee),te(),(0,F.jsx)(k,{registry:m,children:(0,F.jsx)(w,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(D,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,F.jsx)(_,{"data-state":B(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?ye(f,g.descriptionId):f,...v,...h,ref:b,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function B(e){return e?`open`:`closed`}I(B,`getState`);function ye(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}I(ye,`concatAriaDescribedby`);var be={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};be.node;var xe=e(be),Se={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Se.node;var Ce=e(Se),we=1,Te=.9,Ee=.8,De=.17,V=.1,H=.999,Oe=.9999,ke=.99,Ae=/[\\\/_+.#"@\[\(\{&]/,je=/[\\\/_+.#"@\[\(\{&]/g,Me=/[\s-]/,Ne=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?we:ke;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=we:Ae.test(e.charAt(l-1))?(d*=Ee,p=e.slice(i,l-1).match(je),p&&i>0&&(d*=H**+p.length)):Me.test(e.charAt(l-1))?(d*=Te,m=e.slice(i,l-1).match(Ne),m&&i>0&&(d*=H**+m.length)):(d*=De,i>0&&(d*=H**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Oe)),(d<V&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*V>d&&(d=f*V)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Pe(e){return e.toLowerCase().replace(Ne,` `)}function Fe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,Pe(e),Pe(t),0,0,{})}var W=`[cmdk-group=""]`,G=`[cmdk-group-items=""]`,Ie=`[cmdk-group-heading=""]`,Le=`[cmdk-item=""]`,Re=`${Le}:not([aria-disabled="true"])`,K=`cmdk-item-select`,q=`data-value`,ze=(e,t,n)=>Fe(e,t,n),Be=P.createContext(void 0),J=()=>P.useContext(Be),Ve=P.createContext(void 0),He=()=>P.useContext(Ve),Ue=P.createContext(void 0),We=P.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),o=Z(()=>new Set),s=tt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=b(),ee=b(),y=b(),x=P.useRef(null),S=rt();X(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),X(()=>{S(6,te)},[]);let w=P.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),S(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||S(5,te),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=P.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),S(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:y,labelId:ee,listInnerRef:x}),[]);function E(e,t){let r=s.current?.filter??ze;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(G);t?t.appendChild(e.parentElement===t?e:e.closest(`${G} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${G} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${W}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function te(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector(Ie))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Le}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Re)||[])}function M(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(q))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(q))}function F(e){let t=A()?.closest(W),n;for(;t&&!n;)t=e>0?$e(t,W):et(t,W),n=t?.querySelector(Re);n?w.setState(`value`,n.getAttribute(q)):N(e)}let ne=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?ne():e.altKey?F(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?F(-1):N(-1)};return P.createElement(C.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ne();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(K);t.dispatchEvent(e)}}}}},P.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:at},c),$(e,e=>P.createElement(Ve.Provider,{value:w},P.createElement(Be.Provider,{value:T},e))))}),Ge=P.forwardRef((e,t)=>{let n=b(),r=P.useRef(null),i=P.useContext(Ue),a=J(),o=tt(e),s=o.current?.forceMount??i?.forceMount;X(()=>{if(!s)return a.item(n,i?.id)},[s]);let l=nt(n,r,[e.value,e.children,r],e.keywords),u=He(),d=Q(e=>e.value&&e.value===l.current),f=Q(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);P.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(K,p),()=>t.removeEventListener(K,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,l.current)}function m(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:ee,...y}=e;return P.createElement(C.div,{ref:c(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),Ke=P.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=b(),s=P.useRef(null),l=P.useRef(null),u=b(),d=J(),f=Q(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(o));X(()=>d.group(o),[]),nt(o,s,[e.value,e.heading,l]);let p=P.useMemo(()=>({id:o,forceMount:i}),[i]);return P.createElement(C.div,{ref:c(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&P.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),$(e,e=>P.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},P.createElement(Ue.Provider,{value:p},e))))}),qe=P.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=P.useRef(null),a=Q(e=>!e.search);return!n&&!a?null:P.createElement(C.div,{ref:c(i,t),...r,"cmdk-separator":``,role:`separator`})}),Je=P.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=He(),o=Q(e=>e.search),s=Q(e=>e.selectedItemId),c=J();return P.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),P.createElement(C.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ye=P.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=P.useRef(null),o=P.useRef(null),s=Q(e=>e.selectedItemId),l=J();return P.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),P.createElement(C.div,{ref:c(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:l.listId},$(e,e=>P.createElement(`div`,{ref:c(o,l.listInnerRef),"cmdk-list-sizer":``},e)))}),Xe=P.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return P.createElement(ee,{open:n,onOpenChange:r},P.createElement(m,{container:o},P.createElement(h,{"cmdk-overlay":``,className:i}),P.createElement(p,{"aria-label":e.label,"cmdk-dialog":``,className:a},P.createElement(We,{ref:t,...s}))))}),Ze=P.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?P.createElement(C.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Qe=P.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return P.createElement(C.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>P.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(We,{List:Ye,Item:Ge,Input:Je,Group:Ke,Separator:qe,Dialog:Xe,Empty:Ze,Loading:Qe});function $e(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function et(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function tt(e){let t=P.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?P.useEffect:P.useLayoutEffect;function Z(e){let t=P.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=He(),n=()=>e(t.snapshot());return P.useSyncExternalStore(t.subscribe,n,n)}function nt(e,t,n,r=[]){let i=P.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var rt=()=>{let[e,t]=P.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function it(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&P.isValidElement(t)?P.cloneElement(it(t),{ref:t.ref},n(t.props.children)):n(t)}var at={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function ot({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:i(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var st=s(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function ct({className:e,align:t=`inline-start`,...n}){return(0,F.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:i(st({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}s(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function lt({className:e,...t}){return(0,F.jsx)(Y,{"data-slot":`command`,className:i(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function ut({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,F.jsxs)(ot,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,F.jsx)(Y.Input,{"data-slot":`command-input`,className:i(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,F.jsx)(ct,{children:(0,F.jsx)(Ce,{className:`size-4 shrink-0 opacity-50`})})]})})}function dt({className:e,...t}){return(0,F.jsx)(Y.List,{"data-slot":`command-list`,className:i(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function ft({className:e,...t}){return(0,F.jsx)(Y.Empty,{"data-slot":`command-empty`,className:i(`py-6 text-center text-sm`,e),...t})}function pt({className:e,...t}){return(0,F.jsx)(Y.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function mt({className:e,children:t,...n}){return(0,F.jsxs)(Y.Item,{"data-slot":`command-item`,className:i(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,F.jsx)(v,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function ht({...e}){return(0,F.jsx)(se,{"data-slot":`popover`,...e})}function gt({...e}){return(0,F.jsx)(le,{"data-slot":`popover-trigger`,...e})}function _t({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,F.jsx)(pe,{children:(0,F.jsx)(me,{"data-slot":`popover-content`,align:t,sideOffset:n,className:i(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function vt({label:e,groups:t,value:n,onSelect:r,className:i,ariaLabel:o}){let{t:s}=a(),[c,l]=(0,P.useState)(!1),d=t.flatMap(e=>e.options).find(e=>e.value===n);return(0,F.jsxs)(ht,{open:c,onOpenChange:l,children:[(0,F.jsx)(gt,{asChild:!0,children:(0,F.jsxs)(u,{type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":c,"aria-label":o?`${o}: ${d?d.label:e}`:void 0,className:`min-h-11 justify-between gap-2 md:min-h-8 ${i??``}`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:d?d.label:e}),(0,F.jsx)(xe,{className:`opacity-50`})]})}),(0,F.jsx)(_t,{align:`start`,className:`w-[min(20rem,calc(100vw-2rem))] p-0`,children:(0,F.jsxs)(lt,{filter:(e,t,n)=>+!!N([e,...n??[]].join(` `)).includes(N(t)),children:[(0,F.jsx)(ut,{placeholder:s(`filter.search`)}),(0,F.jsxs)(dt,{className:`max-h-72`,children:[(0,F.jsx)(ft,{children:s(`filter.noMatch`)}),t.map((e,t)=>(0,F.jsx)(pt,{heading:e.heading,children:e.options.map(e=>(0,F.jsx)(mt,{value:e.value,keywords:[e.label,...e.keywords??[]],"data-checked":e.value===n,className:`min-h-11 md:min-h-8`,style:e.depth?{paddingLeft:`${.5+e.depth*1}rem`}:void 0,onSelect:()=>{r(e.value),l(!1)},children:(0,F.jsx)(`span`,{className:`truncate`,children:e.label})},e.value))},e.heading??t))]})]})})]})}export{Ce as n,vt as t};
1
+ import{t as e}from"./createLucideIcon-XZ28znwT.js";import{B as t,I as n,L as r,T as i,w as a}from"./queries-BcMmmb36.js";import{i as o,n as s,o as c,s as l,t as u}from"./button-BKhMn8jX.js";import{at as d,ct as f,ft as p,ht as m,mt as h,ot as g,st as _,tt as v,ut as ee}from"./index-DBHFdsYB.js";import{i as y,n as b,o as x,r as S,s as C}from"./dist-CmbuesVk.js";import"./dialog-Bx-cd-2e.js";import{a as w,c as T,i as E,l as D,n as O,o as k,r as te,s as A,t as j}from"./es2015-DqY4UvQc.js";import{t as M}from"./dist-BFPyD74_.js";import{t as N}from"./fold-CGWYt9Iu.js";var P=t(n(),1),F=r(),ne=Object.defineProperty,I=(e,t)=>ne(e,`name`,{value:t,configurable:!0}),L=`Popover`,[re,ie]=x(L,[f]),ae=f(),[oe,R]=re(L),se=I(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=ae(t),c=P.useRef(null),[l,u]=P.useState(!1),[f,p]=P.useState(0),[m,h]=P.useState(0),[g,_]=S({prop:r,defaultProp:i??!1,onChange:a,caller:L});return(0,F.jsx)(d,{...s,children:(0,F.jsx)(oe,{scope:t,contentId:b(),titleId:b(),descriptionId:b(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,triggerRef:c,open:g,onOpenChange:_,onOpenToggle:P.useCallback(()=>_(e=>!e),[_]),hasCustomAnchor:l,onCustomAnchorAdd:P.useCallback(()=>u(!0),[]),onCustomAnchorRemove:P.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ce=`PopoverTrigger`,le=P.forwardRef(I(function(e,t){let{__scopePopover:n,...r}=e,i=R(ce,n),a=ae(n),o=l(t,i.triggerRef),s=(0,F.jsx)(C.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":B(i.open),...r,ref:o,onClick:y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,F.jsx)(g,{asChild:!0,...a,children:s})},`PopoverTrigger`)),ue=`PopoverPortal`,[de,fe]=re(ue,{forceMount:void 0}),pe=I(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=R(ue,t);return(0,F.jsx)(de,{scope:t,forceMount:n,children:(0,F.jsx)(M,{present:n||a.open,children:(0,F.jsx)(E,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),z=`PopoverContent`,me=P.forwardRef(I(function(e,t){let n=fe(z,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=R(z,e.__scopePopover);return(0,F.jsx)(M,{present:r||a.open,children:a.modal?(0,F.jsx)(ge,{...i,ref:t}):(0,F.jsx)(_e,{...i,ref:t})})},`PopoverContent`)),he=o(`PopoverContent.RemoveScroll`),ge=P.forwardRef(I(function(e,t){let n=R(z,e.__scopePopover),r=P.useRef(null),i=l(t,r),a=P.useRef(!1),{nodes:o,registry:s}=T();return P.useEffect(()=>{let e=r.current;if(e)return j(e)},[]),(0,F.jsx)(O,{as:he,allowPinchZoom:!0,shards:P.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,F.jsx)(ve,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_e=P.forwardRef(I(function(e,t){let n=R(z,e.__scopePopover),r=P.useRef(!1),i=P.useRef(!1);return(0,F.jsx)(ve,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ve=P.forwardRef(I(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=R(z,n),v=ae(n),[ee,y]=P.useState(null),b=l(t,y);return A(ee),te(),(0,F.jsx)(k,{registry:m,children:(0,F.jsx)(w,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,F.jsx)(D,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,F.jsx)(_,{"data-state":B(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?ye(f,g.descriptionId):f,...v,...h,ref:b,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function B(e){return e?`open`:`closed`}I(B,`getState`);function ye(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}I(ye,`concatAriaDescribedby`);var be={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};be.node;var xe=e(be),Se={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Se.node;var Ce=e(Se),we=1,Te=.9,Ee=.8,De=.17,V=.1,H=.999,Oe=.9999,ke=.99,Ae=/[\\\/_+.#"@\[\(\{&]/,je=/[\\\/_+.#"@\[\(\{&]/g,Me=/[\s-]/,Ne=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?we:ke;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=we:Ae.test(e.charAt(l-1))?(d*=Ee,p=e.slice(i,l-1).match(je),p&&i>0&&(d*=H**+p.length)):Me.test(e.charAt(l-1))?(d*=Te,m=e.slice(i,l-1).match(Ne),m&&i>0&&(d*=H**+m.length)):(d*=De,i>0&&(d*=H**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Oe)),(d<V&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*V>d&&(d=f*V)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Pe(e){return e.toLowerCase().replace(Ne,` `)}function Fe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,Pe(e),Pe(t),0,0,{})}var W=`[cmdk-group=""]`,G=`[cmdk-group-items=""]`,Ie=`[cmdk-group-heading=""]`,Le=`[cmdk-item=""]`,Re=`${Le}:not([aria-disabled="true"])`,K=`cmdk-item-select`,q=`data-value`,ze=(e,t,n)=>Fe(e,t,n),Be=P.createContext(void 0),J=()=>P.useContext(Be),Ve=P.createContext(void 0),He=()=>P.useContext(Ve),Ue=P.createContext(void 0),We=P.forwardRef((e,t)=>{let n=Z(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Z(()=>new Set),i=Z(()=>new Map),a=Z(()=>new Map),o=Z(()=>new Set),s=tt(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=b(),ee=b(),y=b(),x=P.useRef(null),S=rt();X(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),X(()=>{S(6,te)},[]);let w=P.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),S(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(y);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||S(5,te),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=P.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),S(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:y,labelId:ee,listInnerRef:x}),[]);function E(e,t){let r=s.current?.filter??ze;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(G);t?t.appendChild(e.parentElement===t?e:e.closest(`${G} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${G} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${W}[${q}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(q);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function te(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector(Ie))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Le}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Re)||[])}function M(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(q))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(q))}function F(e){let t=A()?.closest(W),n;for(;t&&!n;)t=e>0?$e(t,W):et(t,W),n=t?.querySelector(Re);n?w.setState(`value`,n.getAttribute(q)):N(e)}let ne=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?ne():e.altKey?F(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?F(-1):N(-1)};return P.createElement(C.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ne();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(K);t.dispatchEvent(e)}}}}},P.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:at},c),$(e,e=>P.createElement(Ve.Provider,{value:w},P.createElement(Be.Provider,{value:T},e))))}),Ge=P.forwardRef((e,t)=>{let n=b(),r=P.useRef(null),i=P.useContext(Ue),a=J(),o=tt(e),s=o.current?.forceMount??i?.forceMount;X(()=>{if(!s)return a.item(n,i?.id)},[s]);let l=nt(n,r,[e.value,e.children,r],e.keywords),u=He(),d=Q(e=>e.value&&e.value===l.current),f=Q(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);P.useEffect(()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(K,p),()=>t.removeEventListener(K,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,l.current)}function m(){u.setState(`value`,l.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:ee,...y}=e;return P.createElement(C.div,{ref:c(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!d,"data-disabled":!!h,"data-selected":!!d,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),Ke=P.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=b(),s=P.useRef(null),l=P.useRef(null),u=b(),d=J(),f=Q(e=>i||d.filter()===!1?!0:!e.search||e.filtered.groups.has(o));X(()=>d.group(o),[]),nt(o,s,[e.value,e.heading,l]);let p=P.useMemo(()=>({id:o,forceMount:i}),[i]);return P.createElement(C.div,{ref:c(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&P.createElement(`div`,{ref:l,"cmdk-group-heading":``,"aria-hidden":!0,id:u},n),$(e,e=>P.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?u:void 0},P.createElement(Ue.Provider,{value:p},e))))}),qe=P.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=P.useRef(null),a=Q(e=>!e.search);return!n&&!a?null:P.createElement(C.div,{ref:c(i,t),...r,"cmdk-separator":``,role:`separator`})}),Je=P.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=He(),o=Q(e=>e.search),s=Q(e=>e.selectedItemId),c=J();return P.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),P.createElement(C.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Ye=P.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=P.useRef(null),o=P.useRef(null),s=Q(e=>e.selectedItemId),l=J();return P.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),P.createElement(C.div,{ref:c(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:l.listId},$(e,e=>P.createElement(`div`,{ref:c(o,l.listInnerRef),"cmdk-list-sizer":``},e)))}),Xe=P.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return P.createElement(ee,{open:n,onOpenChange:r},P.createElement(m,{container:o},P.createElement(h,{"cmdk-overlay":``,className:i}),P.createElement(p,{"aria-label":e.label,"cmdk-dialog":``,className:a},P.createElement(We,{ref:t,...s}))))}),Ze=P.forwardRef((e,t)=>Q(e=>e.filtered.count===0)?P.createElement(C.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Qe=P.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return P.createElement(C.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>P.createElement(`div`,{"aria-hidden":!0},e)))}),Y=Object.assign(We,{List:Ye,Item:Ge,Input:Je,Group:Ke,Separator:qe,Dialog:Xe,Empty:Ze,Loading:Qe});function $e(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function et(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function tt(e){let t=P.useRef(e);return X(()=>{t.current=e}),t}var X=typeof window>`u`?P.useEffect:P.useLayoutEffect;function Z(e){let t=P.useRef();return t.current===void 0&&(t.current=e()),t}function Q(e){let t=He(),n=()=>e(t.snapshot());return P.useSyncExternalStore(t.subscribe,n,n)}function nt(e,t,n,r=[]){let i=P.useRef(),a=J();return X(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(q,s),i.current=s}),i}var rt=()=>{let[e,t]=P.useState(),n=Z(()=>new Map);return X(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function it(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&P.isValidElement(t)?P.cloneElement(it(t),{ref:t.ref},n(t.props.children)):n(t)}var at={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function ot({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:i(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var st=s(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function ct({className:e,align:t=`inline-start`,...n}){return(0,F.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:i(st({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}s(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function lt({className:e,...t}){return(0,F.jsx)(Y,{"data-slot":`command`,className:i(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...t})}function ut({className:e,...t}){return(0,F.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`p-1 pb-0`,children:(0,F.jsxs)(ot,{className:`h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[(0,F.jsx)(Y.Input,{"data-slot":`command-input`,className:i(`w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...t}),(0,F.jsx)(ct,{children:(0,F.jsx)(Ce,{className:`size-4 shrink-0 opacity-50`})})]})})}function dt({className:e,...t}){return(0,F.jsx)(Y.List,{"data-slot":`command-list`,className:i(`no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none`,e),...t})}function ft({className:e,...t}){return(0,F.jsx)(Y.Empty,{"data-slot":`command-empty`,className:i(`py-6 text-center text-sm`,e),...t})}function pt({className:e,...t}){return(0,F.jsx)(Y.Group,{"data-slot":`command-group`,className:i(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function mt({className:e,children:t,...n}){return(0,F.jsxs)(Y.Item,{"data-slot":`command-item`,className:i(`group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground`,e),...n,children:[t,(0,F.jsx)(v,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`})]})}function ht({...e}){return(0,F.jsx)(se,{"data-slot":`popover`,...e})}function gt({...e}){return(0,F.jsx)(le,{"data-slot":`popover-trigger`,...e})}function _t({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,F.jsx)(pe,{children:(0,F.jsx)(me,{"data-slot":`popover-content`,align:t,sideOffset:n,className:i(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function vt({label:e,groups:t,value:n,onSelect:r,className:i,ariaLabel:o}){let{t:s}=a(),[c,l]=(0,P.useState)(!1),d=t.flatMap(e=>e.options).find(e=>e.value===n);return(0,F.jsxs)(ht,{open:c,onOpenChange:l,children:[(0,F.jsx)(gt,{asChild:!0,children:(0,F.jsxs)(u,{type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":c,"aria-label":o?`${o}: ${d?d.label:e}`:void 0,className:`min-h-11 justify-between gap-2 md:min-h-8 ${i??``}`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:d?d.label:e}),(0,F.jsx)(xe,{className:`opacity-50`})]})}),(0,F.jsx)(_t,{align:`start`,className:`w-[min(20rem,calc(100vw-2rem))] p-0`,children:(0,F.jsxs)(lt,{filter:(e,t,n)=>+!!N([e,...n??[]].join(` `)).includes(N(t)),children:[(0,F.jsx)(ut,{placeholder:s(`filter.search`)}),(0,F.jsxs)(dt,{className:`max-h-72`,children:[(0,F.jsx)(ft,{children:s(`filter.noMatch`)}),t.map((e,t)=>(0,F.jsx)(pt,{heading:e.heading,children:e.options.map(e=>(0,F.jsx)(mt,{value:e.value,keywords:[e.label,...e.keywords??[]],"data-checked":e.value===n,className:`min-h-11 md:min-h-8`,style:e.depth?{paddingLeft:`${.5+e.depth*1}rem`}:void 0,onSelect:()=>{r(e.value),l(!1)},children:(0,F.jsx)(`span`,{className:`truncate`,children:e.label})},e.value))},e.heading??t))]})]})})]})}export{Ce as n,vt as t};
@@ -1 +1 @@
1
- import{t as e}from"./Money-PfFNNDOw.js";import{M as t,l as n,n as r}from"./index-eR1GkdC_.js";import{L as i,o as a,u as o,w as s}from"./queries-DZIMMe4i.js";import{n as c}from"./shared-Box7on3B.js";var l=i();function u({widget:i,menu:u}){let{t:d,lang:f}=s(),p=c(i,`widget.deposits`),m=!!o().data?.features?.deposits,{data:h,error:g,isLoading:_}=a(m),v=[...h??[]].sort((e,t)=>(e.daysToMaturity??1e9)-(t.daysToMaturity??1e9));return(0,l.jsx)(t,{title:p,menu:u,loading:m&&_,error:m?g?.message:void 0,empty:!m||h&&v.length===0?d(`deposits.empty`):void 0,children:(0,l.jsx)(`ul`,{className:`flex flex-col divide-y`,children:v.map(t=>(0,l.jsx)(`li`,{children:(0,l.jsxs)(`a`,{href:`#/transactions?account=${encodeURIComponent(t.account)}`,className:`flex min-h-11 items-center gap-2 rounded-md py-1.5 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,l.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,l.jsx)(`span`,{className:`truncate text-sm`,children:t.name}),(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t.maturity?`${t.daysToMaturity<0?d(`deposits.matured`):d(`deposits.inDays`,{n:t.daysToMaturity})} · ${r(t.maturity)}`:d(`deposits.noMaturity`),t.rate!==null&&` · ${n(t.rate,f,2)}%`]}),t.interestAtMaturity?(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d(`deposits.interest`),` `,(0,l.jsx)(e,{amount:t.interestAtMaturity,mode:`short`})]}):null]}),(0,l.jsx)(e,{amount:t.balance,mode:`short`,className:`shrink-0 text-sm font-medium`})]})},t.account))})})}export{u as default};
1
+ import{t as e}from"./Money-BwLucm7P.js";import{M as t,l as n,n as r}from"./index-DBHFdsYB.js";import{L as i,o as a,u as o,w as s}from"./queries-BcMmmb36.js";import{n as c}from"./shared-BgU6fc7z.js";var l=i();function u({widget:i,menu:u}){let{t:d,lang:f}=s(),p=c(i,`widget.deposits`),m=!!o().data?.features?.deposits,{data:h,error:g,isLoading:_}=a(m),v=[...h??[]].sort((e,t)=>(e.daysToMaturity??1e9)-(t.daysToMaturity??1e9));return(0,l.jsx)(t,{title:p,menu:u,loading:m&&_,error:m?g?.message:void 0,empty:!m||h&&v.length===0?d(`deposits.empty`):void 0,children:(0,l.jsx)(`ul`,{className:`flex flex-col divide-y`,children:v.map(t=>(0,l.jsx)(`li`,{children:(0,l.jsxs)(`a`,{href:`#/transactions?account=${encodeURIComponent(t.account)}`,className:`flex min-h-11 items-center gap-2 rounded-md py-1.5 outline-none hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,l.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,l.jsx)(`span`,{className:`truncate text-sm`,children:t.name}),(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[t.maturity?`${t.daysToMaturity<0?d(`deposits.matured`):d(`deposits.inDays`,{n:t.daysToMaturity})} · ${r(t.maturity)}`:d(`deposits.noMaturity`),t.rate!==null&&` · ${n(t.rate,f,2)}%`]}),t.interestAtMaturity?(0,l.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d(`deposits.interest`),` `,(0,l.jsx)(e,{amount:t.interestAtMaturity,mode:`short`})]}):null]}),(0,l.jsx)(e,{amount:t.balance,mode:`short`,className:`shrink-0 text-sm font-medium`})]})},t.account))})})}export{u as default};
@@ -1 +1 @@
1
- import{t as e}from"./drill-t1zr57xi.js";import{L as t,T as n}from"./queries-DZIMMe4i.js";var r=t();function i({filter:t,href:i,className:a,children:o,...s}){return(0,r.jsx)(`a`,{href:i??e(t),className:n(`rounded-md outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,a),...s,children:o})}export{i as t};
1
+ import{t as e}from"./drill-t1zr57xi.js";import{L as t,T as n}from"./queries-BcMmmb36.js";var r=t();function i({filter:t,href:i,className:a,children:o,...s}){return(0,r.jsx)(`a`,{href:i??e(t),className:n(`rounded-md outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50`,a),...s,children:o})}export{i as t};
@@ -1 +1 @@
1
- import{B as e,I as t,L as n}from"./queries-DZIMMe4i.js";import{a as r,i,n as a,r as o,t as s}from"./select-eaSi9K-d.js";var c=e(t(),1),l=n();function u({label:e,hint:t,children:n,className:r}){let i=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 ${r??``}`,children:[(0,l.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),n(i),t&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]})}function d({id:e,value:t,options:n,onChange:c}){return(0,l.jsxs)(s,{value:t,onValueChange:c,children:[(0,l.jsx)(i,{id:e,className:`min-h-11 w-full md:min-h-8`,children:(0,l.jsx)(r,{})}),(0,l.jsx)(a,{children:n.map(e=>(0,l.jsx)(o,{value:e.value,className:`min-h-11 md:min-h-8`,children:e.label},e.value))})]})}export{d as n,u as t};
1
+ import{B as e,I as t,L as n}from"./queries-BcMmmb36.js";import{a as r,i,n as a,r as o,t as s}from"./select-B5P2TaPX.js";var c=e(t(),1),l=n();function u({label:e,hint:t,children:n,className:r}){let i=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 ${r??``}`,children:[(0,l.jsx)(`label`,{htmlFor:i,className:`text-sm font-medium`,children:e}),n(i),t&&(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t})]})}function d({id:e,value:t,options:n,onChange:c}){return(0,l.jsxs)(s,{value:t,onValueChange:c,children:[(0,l.jsx)(i,{id:e,className:`min-h-11 w-full md:min-h-8`,children:(0,l.jsx)(r,{})}),(0,l.jsx)(a,{children:n.map(e=>(0,l.jsx)(o,{value:e.value,className:`min-h-11 md:min-h-8`,children:e.label},e.value))})]})}export{d as n,u as t};