dragon-ui-claude
Version:
🐲 Ultra-fast, cross-platform Claude Code Max usage dashboard with dragon-inspired design, advanced background services, and multi-currency support
4 lines • 180 kB
JavaScript
var lt=Object.defineProperty;var ct=(s,r,a)=>r in s?lt(s,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[r]=a;var xe=(s,r,a)=>(ct(s,typeof r!="symbol"?r+"":r,a),a);import{r as dt,j as e,L as rs,T as ns,C as Es,R as zs,S as mt,a as os,I as Ms}from"./ui-cdd11aae.js";import{r as N,R as ce,C as Is,b as Fs,L as Ls,B as ht,p as $s,c as Os,d as _s,e as gt,P as xt,f as ut,i as pt,h as ft}from"./chart-dc926258.js";import{c as vt}from"./vendor-d3812fbe.js";import{S as Ae,M as Oe,D as pe,Z as _,A as Bs,X as jt,a as ie,b as Ce,T as Se,c as Ys,C as V,B as _e,F as le,d as fe,e as bt,R as q,P as yt,f as ws,g as Nt,h as Hs,G as Ye,i as wt,j as Ct,k as Le,l as Cs,N as Ss,U as St,K as Dt,m as He,I as kt,n as Pt,o as Rt}from"./icons-adfec60b.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))t(o);new MutationObserver(o=>{for(const n of o)if(n.type==="childList")for(const i of n.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&t(i)}).observe(document,{childList:!0,subtree:!0});function a(o){const n={};return o.integrity&&(n.integrity=o.integrity),o.referrerPolicy&&(n.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?n.credentials="include":o.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function t(o){if(o.ep)return;o.ep=!0;const n=a(o);fetch(o.href,n)}})();var We={},Ds=dt;We.createRoot=Ds.createRoot,We.hydrateRoot=Ds.hydrateRoot;function Gs(s){var r,a,t="";if(typeof s=="string"||typeof s=="number")t+=s;else if(typeof s=="object")if(Array.isArray(s)){var o=s.length;for(r=0;r<o;r++)s[r]&&(a=Gs(s[r]))&&(t&&(t+=" "),t+=a)}else for(a in s)s[a]&&(t&&(t+=" "),t+=a);return t}function Vs(){for(var s,r,a=0,t="",o=arguments.length;a<o;a++)(s=arguments[a])&&(r=Gs(s))&&(t&&(t+=" "),t+=r);return t}const is="-",Ut=s=>{const r=At(s),{conflictingClassGroups:a,conflictingClassGroupModifiers:t}=s;return{getClassGroupId:i=>{const d=i.split(is);return d[0]===""&&d.length!==1&&d.shift(),Ws(d,r)||Tt(i)},getConflictingClassGroupIds:(i,d)=>{const u=a[i]||[];return d&&t[i]?[...u,...t[i]]:u}}},Ws=(s,r)=>{var i;if(s.length===0)return r.classGroupId;const a=s[0],t=r.nextPart.get(a),o=t?Ws(s.slice(1),t):void 0;if(o)return o;if(r.validators.length===0)return;const n=s.join(is);return(i=r.validators.find(({validator:d})=>d(n)))==null?void 0:i.classGroupId},ks=/^\[(.+)\]$/,Tt=s=>{if(ks.test(s)){const r=ks.exec(s)[1],a=r==null?void 0:r.substring(0,r.indexOf(":"));if(a)return"arbitrary.."+a}},At=s=>{const{theme:r,prefix:a}=s,t={nextPart:new Map,validators:[]};return zt(Object.entries(s.classGroups),a).forEach(([n,i])=>{Ke(i,t,n,r)}),t},Ke=(s,r,a,t)=>{s.forEach(o=>{if(typeof o=="string"){const n=o===""?r:Ps(r,o);n.classGroupId=a;return}if(typeof o=="function"){if(Et(o)){Ke(o(t),r,a,t);return}r.validators.push({validator:o,classGroupId:a});return}Object.entries(o).forEach(([n,i])=>{Ke(i,Ps(r,n),a,t)})})},Ps=(s,r)=>{let a=s;return r.split(is).forEach(t=>{a.nextPart.has(t)||a.nextPart.set(t,{nextPart:new Map,validators:[]}),a=a.nextPart.get(t)}),a},Et=s=>s.isThemeGetter,zt=(s,r)=>r?s.map(([a,t])=>{const o=t.map(n=>typeof n=="string"?r+n:typeof n=="object"?Object.fromEntries(Object.entries(n).map(([i,d])=>[r+i,d])):n);return[a,o]}):s,Mt=s=>{if(s<1)return{get:()=>{},set:()=>{}};let r=0,a=new Map,t=new Map;const o=(n,i)=>{a.set(n,i),r++,r>s&&(r=0,t=a,a=new Map)};return{get(n){let i=a.get(n);if(i!==void 0)return i;if((i=t.get(n))!==void 0)return o(n,i),i},set(n,i){a.has(n)?a.set(n,i):o(n,i)}}},Ks="!",It=s=>{const{separator:r,experimentalParseClassName:a}=s,t=r.length===1,o=r[0],n=r.length,i=d=>{const u=[];let c=0,x=0,p;for(let h=0;h<d.length;h++){let f=d[h];if(c===0){if(f===o&&(t||d.slice(h,h+n)===r)){u.push(d.slice(x,h)),x=h+n;continue}if(f==="/"){p=h;continue}}f==="["?c++:f==="]"&&c--}const l=u.length===0?d:d.substring(x),C=l.startsWith(Ks),j=C?l.substring(1):l,m=p&&p>x?p-x:void 0;return{modifiers:u,hasImportantModifier:C,baseClassName:j,maybePostfixModifierPosition:m}};return a?d=>a({className:d,parseClassName:i}):i},Ft=s=>{if(s.length<=1)return s;const r=[];let a=[];return s.forEach(t=>{t[0]==="["?(r.push(...a.sort(),t),a=[]):a.push(t)}),r.push(...a.sort()),r},Lt=s=>({cache:Mt(s.cacheSize),parseClassName:It(s),...Ut(s)}),$t=/\s+/,Ot=(s,r)=>{const{parseClassName:a,getClassGroupId:t,getConflictingClassGroupIds:o}=r,n=[],i=s.trim().split($t);let d="";for(let u=i.length-1;u>=0;u-=1){const c=i[u],{modifiers:x,hasImportantModifier:p,baseClassName:l,maybePostfixModifierPosition:C}=a(c);let j=!!C,m=t(j?l.substring(0,C):l);if(!m){if(!j){d=c+(d.length>0?" "+d:d);continue}if(m=t(l),!m){d=c+(d.length>0?" "+d:d);continue}j=!1}const h=Ft(x).join(":"),f=p?h+Ks:h,v=f+m;if(n.includes(v))continue;n.push(v);const U=o(m,j);for(let A=0;A<U.length;++A){const T=U[A];n.push(f+T)}d=c+(d.length>0?" "+d:d)}return d};function _t(){let s=0,r,a,t="";for(;s<arguments.length;)(r=arguments[s++])&&(a=qs(r))&&(t&&(t+=" "),t+=a);return t}const qs=s=>{if(typeof s=="string")return s;let r,a="";for(let t=0;t<s.length;t++)s[t]&&(r=qs(s[t]))&&(a&&(a+=" "),a+=r);return a};function Bt(s,...r){let a,t,o,n=i;function i(u){const c=r.reduce((x,p)=>p(x),s());return a=Lt(c),t=a.cache.get,o=a.cache.set,n=d,d(u)}function d(u){const c=t(u);if(c)return c;const x=Ot(u,a);return o(u,x),x}return function(){return n(_t.apply(null,arguments))}}const E=s=>{const r=a=>a[s]||[];return r.isThemeGetter=!0,r},Js=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yt=/^\d+\/\d+$/,Ht=new Set(["px","full","screen"]),Gt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Kt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Q=s=>Ne(s)||Ht.has(s)||Yt.test(s),ae=s=>ke(s,"length",aa),Ne=s=>!!s&&!Number.isNaN(Number(s)),Ge=s=>ke(s,"number",Ne),Ue=s=>!!s&&Number.isInteger(Number(s)),Jt=s=>s.endsWith("%")&&Ne(s.slice(0,-1)),S=s=>Js.test(s),re=s=>Gt.test(s),Xt=new Set(["length","size","percentage"]),Zt=s=>ke(s,Xt,Xs),Qt=s=>ke(s,"position",Xs),ea=new Set(["image","url"]),sa=s=>ke(s,ea,na),ta=s=>ke(s,"",ra),Te=()=>!0,ke=(s,r,a)=>{const t=Js.exec(s);return t?t[1]?typeof r=="string"?t[1]===r:r.has(t[1]):a(t[2]):!1},aa=s=>Vt.test(s)&&!Wt.test(s),Xs=()=>!1,ra=s=>Kt.test(s),na=s=>qt.test(s),oa=()=>{const s=E("colors"),r=E("spacing"),a=E("blur"),t=E("brightness"),o=E("borderColor"),n=E("borderRadius"),i=E("borderSpacing"),d=E("borderWidth"),u=E("contrast"),c=E("grayscale"),x=E("hueRotate"),p=E("invert"),l=E("gap"),C=E("gradientColorStops"),j=E("gradientColorStopPositions"),m=E("inset"),h=E("margin"),f=E("opacity"),v=E("padding"),U=E("saturate"),A=E("scale"),T=E("sepia"),F=E("skew"),H=E("space"),G=E("translate"),W=()=>["auto","contain","none"],me=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",S,r],R=()=>[S,r],B=()=>["",Q,ae],J=()=>["auto",Ne,S],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",S],Fe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[Ne,S];return{cacheSize:500,separator:":",theme:{colors:[Te],spacing:[Q,ae],blur:["none","",re,S],brightness:Y(),borderColor:[s],borderRadius:["none","","full",re,S],borderSpacing:R(),borderWidth:B(),contrast:Y(),grayscale:K(),hueRotate:Y(),invert:K(),gap:R(),gradientColorStops:[s],gradientColorStopPositions:[Jt,ae],inset:z(),margin:z(),opacity:Y(),padding:R(),saturate:Y(),scale:Y(),sepia:K(),skew:Y(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",S]}],container:["container"],columns:[{columns:[re]}],"break-after":[{"break-after":Fe()}],"break-before":[{"break-before":Fe()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),S]}],overflow:[{overflow:me()}],"overflow-x":[{"overflow-x":me()}],"overflow-y":[{"overflow-y":me()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ue,S]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",S]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",Ue,S]}],"grid-cols":[{"grid-cols":[Te]}],"col-start-end":[{col:["auto",{span:["full",Ue,S]},S]}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":[Te]}],"row-start-end":[{row:["auto",{span:[Ue,S]},S]}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",S]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",S]}],gap:[{gap:[l]}],"gap-x":[{"gap-x":[l]}],"gap-y":[{"gap-y":[l]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",S,r]}],"min-w":[{"min-w":[S,r,"min","max","fit"]}],"max-w":[{"max-w":[S,r,"none","full","min","max","fit","prose",{screen:[re]},re]}],h:[{h:[S,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[S,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[S,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[S,r,"auto","min","max","fit"]}],"font-size":[{text:["base",re,ae]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ge]}],"font-family":[{font:[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",S]}],"line-clamp":[{"line-clamp":["none",Ne,Ge]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Q,S]}],"list-image":[{"list-image":["none",S]}],"list-style-type":[{list:["none","disc","decimal",S]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[s]}],"placeholder-opacity":[{"placeholder-opacity":[f]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[s]}],"text-opacity":[{"text-opacity":[f]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Q,ae]}],"underline-offset":[{"underline-offset":["auto",Q,S]}],"text-decoration-color":[{decoration:[s]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",S]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[f]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),Qt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Zt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sa]}],"bg-color":[{bg:[s]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[C]}],"gradient-via":[{via:[C]}],"gradient-to":[{to:[C]}],rounded:[{rounded:[n]}],"rounded-s":[{"rounded-s":[n]}],"rounded-e":[{"rounded-e":[n]}],"rounded-t":[{"rounded-t":[n]}],"rounded-r":[{"rounded-r":[n]}],"rounded-b":[{"rounded-b":[n]}],"rounded-l":[{"rounded-l":[n]}],"rounded-ss":[{"rounded-ss":[n]}],"rounded-se":[{"rounded-se":[n]}],"rounded-ee":[{"rounded-ee":[n]}],"rounded-es":[{"rounded-es":[n]}],"rounded-tl":[{"rounded-tl":[n]}],"rounded-tr":[{"rounded-tr":[n]}],"rounded-br":[{"rounded-br":[n]}],"rounded-bl":[{"rounded-bl":[n]}],"border-w":[{border:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[f]}],"border-style":[{border:[...X(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[f]}],"divide-style":[{divide:X()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...X()]}],"outline-offset":[{"outline-offset":[Q,S]}],"outline-w":[{outline:[Q,ae]}],"outline-color":[{outline:[s]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[s]}],"ring-opacity":[{"ring-opacity":[f]}],"ring-offset-w":[{"ring-offset":[Q,ae]}],"ring-offset-color":[{"ring-offset":[s]}],shadow:[{shadow:["","inner","none",re,ta]}],"shadow-color":[{shadow:[Te]}],opacity:[{opacity:[f]}],"mix-blend":[{"mix-blend":[...ge(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ge()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[t]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",re,S]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[p]}],saturate:[{saturate:[U]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[t]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[f]}],"backdrop-saturate":[{"backdrop-saturate":[U]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",S]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",S]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",S]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[A]}],"scale-x":[{"scale-x":[A]}],"scale-y":[{"scale-y":[A]}],rotate:[{rotate:[Ue,S]}],"translate-x":[{"translate-x":[G]}],"translate-y":[{"translate-y":[G]}],"skew-x":[{"skew-x":[F]}],"skew-y":[{"skew-y":[F]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",S]}],accent:[{accent:["auto",s]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",S]}],"caret-color":[{caret:[s]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",S]}],fill:[{fill:[s,"none"]}],"stroke-w":[{stroke:[Q,ae,Ge]}],stroke:[{stroke:[s,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ia=Bt(oa);function k(...s){return ia(Vs(s))}function Ee(){return"1.2.1"}async function la(){try{const s=await fetch("https://registry.npmjs.org/dragon-ui-claude/latest");if(!s.ok)throw new Error("Failed to fetch version");return(await s.json()).version||null}catch(s){return console.error("Failed to fetch latest version:",s),null}}function ca(s,r){const a=s.replace("v","").split(".").map(Number),t=r.replace("v","").split(".").map(Number);for(let o=0;o<Math.max(a.length,t.length);o++){const n=a[o]||0,i=t[o]||0;if(i>n)return!0;if(n>i)return!1}return!1}function b(s,r="USD"){(!s||typeof s!="number"||isNaN(s)||!isFinite(s))&&(s=0);try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:r==="JPY"||r==="KRW"?0:2,maximumFractionDigits:r==="JPY"||r==="KRW"?0:2}).format(s)}catch{return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(s)}}function M(s){return!s||typeof s!="number"||isNaN(s)||!isFinite(s)?"0":s>=1e9?(s/1e9).toFixed(1)+"B":s>=1e6?(s/1e6).toFixed(1)+"M":s>=1e3?(s/1e3).toFixed(1)+"K":s.toLocaleString()}function Zs(s,r="auto",a){const t=typeof s=="string"?new Date(s):s,o=r==="auto"?void 0:r;return t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",timeZone:o,...a})}function da(s){return(typeof s=="string"?new Date(s):s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function qe(s){return(typeof s=="string"?new Date(s):s).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function de(s){const r=typeof s=="string"?new Date(s):s,t=new Date().getTime()-r.getTime(),o=Math.floor(t/6e4),n=Math.floor(o/60),i=Math.floor(n/24);return o<1?"Just now":o<60?`${o}m ago`:n<24?`${n}h ago`:i<7?`${i}d ago`:Zs(r)}function ma(s,r){return r===0?s>0?100:0:(s-r)/r*100}function ha(s,r,a="application/json"){const t=new Blob([JSON.stringify(s,null,2)],{type:a}),o=URL.createObjectURL(t),n=document.createElement("a");n.href=o,n.download=r,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}const ga=zs,Qs=N.forwardRef(({className:s,...r},a)=>e.jsx(rs,{ref:a,className:k("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground glass-effect",s),...r}));Qs.displayName=rs.displayName;const et=N.forwardRef(({className:s,...r},a)=>e.jsx(ns,{ref:a,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm","data-[state=active]:bg-gradient-to-r data-[state=active]:from-dragon-primary data-[state=active]:to-dragon-secondary data-[state=active]:text-white","hover:bg-accent hover:text-accent-foreground",s),...r}));et.displayName=ns.displayName;const ne=N.forwardRef(({className:s,...r},a)=>e.jsx(Es,{ref:a,className:k("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...r}));ne.displayName=Es.displayName;const xa=N.forwardRef(({className:s,...r},a)=>e.jsx(zs,{ref:a,className:k("w-full",s),...r}));xa.displayName="DragonTabs";const ua=N.forwardRef(({className:s,...r},a)=>e.jsx(rs,{ref:a,className:k("inline-flex h-12 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground glass-effect dragon-scales border border-dragon-primary/20",s),...r}));ua.displayName="DragonTabsList";const pa=N.forwardRef(({className:s,...r},a)=>e.jsx(ns,{ref:a,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-gradient-to-r data-[state=active]:from-dragon-primary data-[state=active]:to-dragon-secondary data-[state=active]:text-white data-[state=active]:shadow-lg data-[state=active]:scale-105","hover:bg-accent hover:text-accent-foreground hover:scale-102 hover:shadow-md","relative overflow-hidden group",s),...r}));pa.displayName="DragonTabsTrigger";const Rs=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Us=Vs,st=(s,r)=>a=>{var t;if((r==null?void 0:r.variants)==null)return Us(s,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:o,defaultVariants:n}=r,i=Object.keys(o).map(c=>{const x=a==null?void 0:a[c],p=n==null?void 0:n[c];if(x===null)return null;const l=Rs(x)||Rs(p);return o[c][l]}),d=a&&Object.entries(a).reduce((c,x)=>{let[p,l]=x;return l===void 0||(c[p]=l),c},{}),u=r==null||(t=r.compoundVariants)===null||t===void 0?void 0:t.reduce((c,x)=>{let{class:p,className:l,...C}=x;return Object.entries(C).every(j=>{let[m,h]=j;return Array.isArray(h)?h.includes({...n,...d}[m]):{...n,...d}[m]===h})?[...c,p,l]:c},[]);return Us(s,i,u,a==null?void 0:a.class,a==null?void 0:a.className)},fa=st("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",dragon:"bg-gradient-to-r from-dragon-primary to-dragon-secondary text-white hover:from-dragon-primary/90 hover:to-dragon-secondary/90 shadow-lg hover:shadow-xl transition-all duration-300",flame:"bg-gradient-to-r from-dragon-flame to-dragon-accent text-white hover:shadow-lg hover:shadow-dragon-flame/25 transition-all duration-300",scale:"bg-dragon-scale text-white hover:bg-dragon-scale/90 border border-dragon-primary/20"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),P=N.forwardRef(({className:s,variant:r,size:a,asChild:t=!1,...o},n)=>{const i=t?mt:"button";return e.jsx(i,{className:k(fa({variant:r,size:a,className:s})),ref:n,...o})});P.displayName="Button";const va=s=>(r,a,t)=>{const o=t.subscribe;return t.subscribe=(i,d,u)=>{let c=i;if(d){const x=(u==null?void 0:u.equalityFn)||Object.is;let p=i(t.getState());c=l=>{const C=i(l);if(!x(p,C)){const j=p;d(p=C,j)}},u!=null&&u.fireImmediately&&d(p,p)}return o(c)},s(r,a,t)},ja=va;function ba(s,r){let a;try{a=s()}catch{return}return{getItem:o=>{var n;const i=u=>u===null?null:JSON.parse(u,r==null?void 0:r.reviver),d=(n=a.getItem(o))!=null?n:null;return d instanceof Promise?d.then(i):i(d)},setItem:(o,n)=>a.setItem(o,JSON.stringify(n,r==null?void 0:r.replacer)),removeItem:o=>a.removeItem(o)}}const Ie=s=>r=>{try{const a=s(r);return a instanceof Promise?a:{then(t){return Ie(t)(a)},catch(t){return this}}}catch(a){return{then(t){return this},catch(t){return Ie(t)(a)}}}},ya=(s,r)=>(a,t,o)=>{let n={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:h=>h,version:0,merge:(h,f)=>({...f,...h}),...r},i=!1;const d=new Set,u=new Set;let c;try{c=n.getStorage()}catch{}if(!c)return s((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...h)},t,o);const x=Ie(n.serialize),p=()=>{const h=n.partialize({...t()});let f;const v=x({state:h,version:n.version}).then(U=>c.setItem(n.name,U)).catch(U=>{f=U});if(f)throw f;return v},l=o.setState;o.setState=(h,f)=>{l(h,f),p()};const C=s((...h)=>{a(...h),p()},t,o);let j;const m=()=>{var h;if(!c)return;i=!1,d.forEach(v=>v(t()));const f=((h=n.onRehydrateStorage)==null?void 0:h.call(n,t()))||void 0;return Ie(c.getItem.bind(c))(n.name).then(v=>{if(v)return n.deserialize(v)}).then(v=>{if(v)if(typeof v.version=="number"&&v.version!==n.version){if(n.migrate)return n.migrate(v.state,v.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return v.state}).then(v=>{var U;return j=n.merge(v,(U=t())!=null?U:C),a(j,!0),p()}).then(()=>{f==null||f(j,void 0),i=!0,u.forEach(v=>v(j))}).catch(v=>{f==null||f(void 0,v)})};return o.persist={setOptions:h=>{n={...n,...h},h.getStorage&&(c=h.getStorage())},clearStorage:()=>{c==null||c.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>m(),hasHydrated:()=>i,onHydrate:h=>(d.add(h),()=>{d.delete(h)}),onFinishHydration:h=>(u.add(h),()=>{u.delete(h)})},m(),j||C},Na=(s,r)=>(a,t,o)=>{let n={storage:ba(()=>localStorage),partialize:m=>m,version:0,merge:(m,h)=>({...h,...m}),...r},i=!1;const d=new Set,u=new Set;let c=n.storage;if(!c)return s((...m)=>{console.warn(`[zustand persist middleware] Unable to update item '${n.name}', the given storage is currently unavailable.`),a(...m)},t,o);const x=()=>{const m=n.partialize({...t()});return c.setItem(n.name,{state:m,version:n.version})},p=o.setState;o.setState=(m,h)=>{p(m,h),x()};const l=s((...m)=>{a(...m),x()},t,o);o.getInitialState=()=>l;let C;const j=()=>{var m,h;if(!c)return;i=!1,d.forEach(v=>{var U;return v((U=t())!=null?U:l)});const f=((h=n.onRehydrateStorage)==null?void 0:h.call(n,(m=t())!=null?m:l))||void 0;return Ie(c.getItem.bind(c))(n.name).then(v=>{if(v)if(typeof v.version=="number"&&v.version!==n.version){if(n.migrate)return[!0,n.migrate(v.state,v.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,v.state];return[!1,void 0]}).then(v=>{var U;const[A,T]=v;if(C=n.merge(T,(U=t())!=null?U:l),a(C,!0),A)return x()}).then(()=>{f==null||f(C,void 0),C=t(),i=!0,u.forEach(v=>v(C))}).catch(v=>{f==null||f(void 0,v)})};return o.persist={setOptions:m=>{n={...n,...m},m.storage&&(c=m.storage)},clearStorage:()=>{c==null||c.removeItem(n.name)},getOptions:()=>n,rehydrate:()=>j(),hasHydrated:()=>i,onHydrate:m=>(d.add(m),()=>{d.delete(m)}),onFinishHydration:m=>(u.add(m),()=>{u.delete(m)})},n.skipHydration||j(),C||l},wa=(s,r)=>"getStorage"in r||"serialize"in r||"deserialize"in r?ya(s,r):Na(s,r),Ca=wa,je=[{code:"USD",name:"US Dollar",symbol:"$",flag:"🇺🇸"},{code:"EUR",name:"Euro",symbol:"€",flag:"🇪🇺"},{code:"GBP",name:"British Pound",symbol:"£",flag:"🇬🇧"},{code:"JPY",name:"Japanese Yen",symbol:"¥",flag:"🇯🇵"},{code:"CHF",name:"Swiss Franc",symbol:"CHF",flag:"🇨🇭"},{code:"CAD",name:"Canadian Dollar",symbol:"C$",flag:"🇨🇦"},{code:"AUD",name:"Australian Dollar",symbol:"A$",flag:"🇦🇺"},{code:"CNY",name:"Chinese Yuan",symbol:"¥",flag:"🇨🇳"},{code:"KRW",name:"South Korean Won",symbol:"₩",flag:"🇰🇷"},{code:"INR",name:"Indian Rupee",symbol:"₹",flag:"🇮🇳"},{code:"BRL",name:"Brazilian Real",symbol:"R$",flag:"🇧🇷"},{code:"MXN",name:"Mexican Peso",symbol:"$",flag:"🇲🇽"}],ue=class ue{constructor(){xe(this,"apiKey",null);xe(this,"currencyRates",{});xe(this,"selectedCurrency","USD");xe(this,"storeUpdater",null);xe(this,"fallbackRates",{USD:1,EUR:.9234,GBP:.7892,JPY:149.67,CHF:.8834,CAD:1.3562,AUD:1.4823,CNY:7.1234,KRW:1387.5,INR:83.42,BRL:5.8934,MXN:20.124});console.log("[MONEY] Initializing Currency Service...")}setStoreUpdater(r){this.storeUpdater=r,console.log("[MONEY] Currency service connected to store.ts")}static getInstance(){return ue.instance||(ue.instance=new ue),ue.instance}setApiKey(r){this.apiKey=r,console.log("[CURRENCY] Currency service API key configured")}async fetchExchangeRates(){console.log("[MONEY] Fetching exchange rates...");try{const r=await this.tryMultipleSources(),a={},t=new Date;return Object.entries(r).forEach(([o,n])=>{a[o]={code:o,rate:n,lastUpdated:t}}),this.currencyRates=a,console.log(`[MONEY] Successfully fetched ${Object.keys(r).length} exchange rates`),this.storeUpdater&&(this.storeUpdater(a,this.selectedCurrency),console.log("[CURRENCY] Exchange rates sent to store.ts")),Math.random()<.2&&console.log("[CURRENCY] Sample rates:",{EUR:r.EUR,GBP:r.GBP,JPY:r.JPY}),a}catch(r){return console.error("[ERR] All APIs failed, using fallback rates:",r),this.getFallbackRates()}}async tryMultipleSources(){const r=[()=>this.fetchFromExchangeRateHost(),()=>this.fetchFromFrankfurter(),()=>this.fetchFromExchangeRateApi(),()=>this.fetchFromFreeForexApi(),()=>this.fetchFromCurrencyApi(),()=>this.scrapeFromXE(),()=>this.scrapeFromYahooFinance()];for(const a of r)try{const t=await a();if(t&&Object.keys(t).length>0)return t}catch(t){console.warn("[CURRENCY] Exchange rate source failed, trying next...",t);continue}throw new Error("All exchange rate sources failed")}async fetchFromExchangeRateHost(){const a=await fetch("https://api.exchangerate.host/latest?base=USD");if(!a.ok)throw new Error(`HTTP ${a.status}`);return(await a.json()).rates}async fetchFromFrankfurter(){const a=await fetch("https://api.frankfurter.app/latest?from=USD");if(!a.ok)throw new Error(`HTTP ${a.status}`);return{USD:1,...(await a.json()).rates}}async fetchFromExchangeRateApi(){const a=await fetch("https://api.exchangerate-api.com/v4/latest/USD");if(!a.ok)throw new Error(`HTTP ${a.status}`);return(await a.json()).rates}async fetchFromFreeForexApi(){const a=`https://api.freeforexapi.com/api/live?pairs=USD${je.map(i=>i.code).filter(i=>i!=="USD").join(",")}`,t=await fetch(a);if(!t.ok)throw new Error(`HTTP ${t.status}`);const o=await t.json(),n={USD:1};return Object.entries(o.rates).forEach(([i,d])=>{const u=i.replace("USD","");n[u]=d.rate}),n}async fetchFromCurrencyApi(){const a=await fetch("https://api.currencyapi.com/v3/latest?apikey=free&base_currency=USD");if(!a.ok)throw new Error(`HTTP ${a.status}`);const t=await a.json(),o={};return Object.entries(t.data).forEach(([n,i])=>{o[n]=i.value}),o}getFallbackRates(){console.log("[CURRENCY] Using fallback exchange rates (may be outdated)");const r={},a=new Date;return Object.entries(this.fallbackRates).forEach(([t,o])=>{r[t]={code:t,rate:o,lastUpdated:a}}),this.currencyRates=r,this.storeUpdater&&(this.storeUpdater(r,this.selectedCurrency),console.log("[CURRENCY] Fallback rates sent to store.ts")),r}convertFromUSD(r,a){if(a==="USD")return r;const t=this.getCurrencyRate(a);return r*t}convertToUSD(r,a){if(a==="USD")return r;const t=this.getCurrencyRate(a);return r/t}getCurrencyRate(r){if(r==="USD")return 1;const a=this.currencyRates[r];return a?a.rate:this.fallbackRates[r]||1}convertCurrency(r,a,t){if(a===t)return r;const o=this.convertToUSD(r,a);return this.convertFromUSD(o,t)}formatCurrency(r,a,t="en-US"){const o=je.find(n=>n.code===a);try{return new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:a==="JPY"||a==="KRW"?0:2,maximumFractionDigits:a==="JPY"||a==="KRW"?0:2}).format(r)}catch{const i=(o==null?void 0:o.symbol)||a,d=a==="JPY"||a==="KRW"?0:2;return`${i}${r.toFixed(d)}`}}getCurrencySymbol(r){const a=je.find(t=>t.code===r);return(a==null?void 0:a.symbol)||r}getCurrencyInfo(r){return je.find(a=>a.code===r)||null}getSelectedCurrency(){return this.selectedCurrency}setSelectedCurrency(r){this.selectedCurrency=r,this.storeUpdater&&(this.storeUpdater(this.currencyRates,this.selectedCurrency),console.log(`[CURRENCY] Currency changed to ${r} - store.ts updated`))}areRatesFresh(){const r=Object.values(this.currencyRates);if(r.length===0)return!1;let a=60*60*1e3;try{const{useAppStore:o}=require("./store"),n=o.getState().settings;a=Math.max(n.refreshInterval*1e3*10,60*60*1e3)}catch{}const t=new Date(Date.now()-a);return r.every(o=>o.lastUpdated>t)}async refreshRates(){console.log("[CURRENCY] Force refreshing exchange rates..."),await this.fetchExchangeRates()}getStatus(){const r=Object.values(this.currencyRates);return{isConfigured:Object.keys(this.currencyRates).length>0,ratesCount:r.length,lastUpdate:r.length>0?r[0].lastUpdated:null,freshness:this.areRatesFresh(),selectedCurrency:this.getSelectedCurrency()}}logStatus(){var a;const r=this.getStatus();console.log("[CURRENCY] Currency Service Status:",{Configured:r.isConfigured,"Rates Count":r.ratesCount,"Last Update":(a=r.lastUpdate)==null?void 0:a.toLocaleString(),Fresh:r.freshness,"Selected Currency":r.selectedCurrency})}async scrapeFromXE(){throw console.log("[CURRENCY] XE.com scraping fallback (not implemented - requires CORS proxy)"),new Error("XE scraping requires server-side implementation")}async scrapeFromYahooFinance(){throw console.log("[CURRENCY] Yahoo Finance scraping fallback (not implemented - requires CORS proxy)"),new Error("Yahoo Finance scraping requires server-side implementation")}};xe(ue,"instance");let Je=ue;const be=Je.getInstance(),Sa="modulepreload",Da=function(s,r){return new URL(s,r).href},Ts={},ee=function(r,a,t){if(!a||a.length===0)return r();const o=document.getElementsByTagName("link");return Promise.all(a.map(n=>{if(n=Da(n,t),n in Ts)return;Ts[n]=!0;const i=n.endsWith(".css"),d=i?'[rel="stylesheet"]':"";if(!!t)for(let x=o.length-1;x>=0;x--){const p=o[x];if(p.href===n&&(!i||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${d}`))return;const c=document.createElement("link");if(c.rel=i?"stylesheet":Sa,i||(c.as="script",c.crossOrigin=""),c.href=n,document.head.appendChild(c),i)return new Promise((x,p)=>{c.addEventListener("load",x),c.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>r()).catch(n=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=n,window.dispatchEvent(i),!i.defaultPrevented)throw n})},ka=(s,r)=>{const a=s[r];return a?typeof a=="function"?a():Promise.resolve(a):new Promise((t,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+r)))})},As=[{code:"en",name:"English",flag:"🇺🇸"},{code:"de",name:"Deutsch",flag:"🇩🇪"},{code:"fr",name:"Français",flag:"🇫🇷"},{code:"es",name:"Español",flag:"🇪🇸"},{code:"it",name:"Italiano",flag:"🇮🇹"},{code:"pt",name:"Português",flag:"🇵🇹"},{code:"nl",name:"Nederlands",flag:"🇳🇱"},{code:"ja",name:"日本語",flag:"🇯🇵"},{code:"zh",name:"中文",flag:"🇨🇳"}],De="en",$e={},ls=async s=>{if($e[s])return $e[s];try{const r=await ka(Object.assign({"./locales/de.json":()=>ee(()=>import("./de-41d0d070.js"),[],import.meta.url),"./locales/en.json":()=>ee(()=>import("./en-ce72c01f.js"),[],import.meta.url),"./locales/es.json":()=>ee(()=>import("./es-e511599c.js"),[],import.meta.url),"./locales/fr.json":()=>ee(()=>import("./fr-3520d7a7.js"),[],import.meta.url),"./locales/it.json":()=>ee(()=>import("./it-724f5655.js"),[],import.meta.url),"./locales/ja.json":()=>ee(()=>import("./ja-921acdf5.js"),[],import.meta.url),"./locales/nl.json":()=>ee(()=>import("./nl-4e102d35.js"),[],import.meta.url),"./locales/pt.json":()=>ee(()=>import("./pt-3408690a.js"),[],import.meta.url),"./locales/zh.json":()=>ee(()=>import("./zh-7ff9fa7f.js"),[],import.meta.url)}),`./locales/${s}.json`);return $e[s]=r.default||r,$e[s]}catch{return console.warn(`Failed to load translation for ${s}, falling back to English`),s!==De?ls(De):{}}},Pa=(s,r)=>{const a=r.split(".");let t=s;for(const o of a)if(t&&typeof t=="object"&&o in t)t=t[o];else return r;return typeof t=="string"?t:r};let we=De,ze={};const Be=new Set;let Me=!1,Ve=null;const tt=async()=>{!Me&&!Ve&&(console.log("[i18n] Initializing with default language:",De),Ve=ls(De).then(s=>{ze=s,Me=!0,at()}),await Ve)};tt();const Ra=s=>(Be.add(s),()=>Be.delete(s)),at=()=>{console.log("[i18n] Notifying",Be.size,"subscribers"),Be.forEach(s=>s())},cs=async s=>{if(console.log("[i18n] changeLanguage called with:",s,"current:",we),s===we){console.log("[i18n] Language already set, skipping");return}console.log("[i18n] Loading translations for:",s),we=s,ze=await ls(s),localStorage.setItem("dragon-ui-language",s),console.log("[i18n] Notifying subscribers of language change"),at()},te=()=>{const[s,r]=N.useState({language:we,translations:ze,isReady:Me});return N.useEffect(()=>(Me||tt().then(()=>{r({language:we,translations:ze,isReady:!0})}),Ra(()=>{r({language:we,translations:ze,isReady:Me})})),[]),{t:(t,o)=>{if(!s.isReady||!s.translations||Object.keys(s.translations).length===0)return o||t;const n=Pa(s.translations,t);return n===t?(console.warn("[i18n] Missing translation for key:",t,"in language:",s.language),o||t):n},language:s.language,changeLanguage:cs}},O=vt()(Ca(ja((s,r)=>({theme:"dark",toggleTheme:()=>{const a=r().theme==="light"?"dark":"light";s({theme:a}),document.documentElement.classList.toggle("dark",a==="dark")},activeTab:"overview",setActiveTab:a=>s({activeTab:a}),currentAppVersion:"",latestVersion:null,isVersionOutdated:!1,lastVersionCheck:0,isLoading:!1,isLoadingCurrency:!1,isLoadingDatabase:!1,loadingProgress:null,databaseProgress:null,coreData:{totalCost:0,cost:0,currentCost:0,costAmount:0,totalSessions:0,sessions:0,sessionsCount:0,validSessions:0,recentSessions:0,totalProjects:0,projectsCount:0,averageCostPerSession:0,avgCostPerSession:0,avgCostPerProject:0,avgDuration:0,avgSessionCost:0,avgTokensPerSession:0,totalTokens:0,tokens:0,tokensUsed:0,tokensCount:0,costPer1MTokens:0,costPerToken:0,costPer1KTokens:0,costPerConversation:0,costPerEntry:0,started:null,duration:0,timeLeft:0,timeAgo:null,lastActivity:null,dateTime:null,sessionTimeLeft:0,activeSession:null,sessionActive:!1,activeDays:0,entries:0,status:"idle",sessionStatus:"idle",models:[],modelsCount:0,modelsList:[],sessionId:null,block:null,blocks:[],blocksCount:0,totalBlocks:0,projectName:null,project:null,topRanking:0,percentageOfTotal:0,mostActiveProject:null,mostRecentActivity:null,mostProductiveSession:null,longestSession:null,mostExpensiveSession:null,sessionNumber:0,recentCount:0,conversations:0,efficiency:0,daysTracked:0,timeSpan:null,period:null,monthsTracked:0,totalMonths:0,currentMonth:null,currentMonthCost:0,currentPeriod:0,monthlyAverage:0,averageMonthlySpend:0,projectedMonthly:0,quarterlyProjection:0,yearlyProjection:0,projectedYearlySpend:0,currentRunRate:0,highestSpendingMonth:null,mostActiveMonth:null,growthTrend:0,monthlyGrowth:0,sessionsData:[],projectsData:[],monthlyData:[],dailyData:[],dailyFinancialData:[],currentTokens:0,todayData:null,yesterdayData:null,lastSessionData:null,avgDailyCost:0,activityData:[],dailyBreakdown:[],last7DaysTotal:0,liveMetrics:null,activityWindows:[],peakActivity:0,averageActivity:0,gaps:[],gapStatistics:null,productivityPatterns:null,modelBreakdown:[],modelStats:null,modelEfficiency:[]},currency:"USD",exchangeRates:{},supportedCurrencies:je,overviewData:null,projectsData:null,sessionsData:null,monthlyData:null,dailyData:null,dailyFinancialData:null,activeData:null,settings:{autoRefresh:!0,refreshInterval:30,currency:"USD",language:De,timezone:"auto",timeFormat:"24h",compactMode:!0,compactScale:100,showAnimations:!0,dragonEffects:!0,devToolsEnabled:!1,autoUpdateNotifications:!0,billingCycleDay:1,claudePaths:{standardPaths:[],customPaths:[],activePaths:[]},sshConfig:{enabled:!1,host:"",port:22,username:"",password:"",privateKeyPath:"",useKeyAuth:!1,connectionTimeout:1e4,keepAliveInterval:3e4}},error:null,lastRefresh:0,lastCurrencyRefresh:0,isInitializing:!1,isInitialized:!1,initializeStore:async()=>{const a=r();if(a.isInitializing||a.isInitialized){console.log("[WARN] Store: Already initializing/initialized, skipping...");return}console.log("[INIT] Store: Initializing central data hub...");try{s({isInitializing:!0,isLoading:!0,error:null}),be.setStoreUpdater((t,o)=>{s({exchangeRates:t,currency:o,lastCurrencyRefresh:Date.now()}),r().calculateTabViews()}),await r().refreshCurrency(),await r().refreshCoreData(),s({isLoading:!1,isInitializing:!1,isInitialized:!0}),console.log("[OK] Store: Central data hub initialized")}catch(t){const o=t instanceof Error?t.message:"Unknown error";throw console.error("[ERR] Store: Initialization failed:",o),s({isLoading:!1,isInitializing:!1,isInitialized:!1,error:o}),t}},refreshCoreData:async()=>{try{console.log("[LOAD] Store: Refreshing core data from backend...");const a=r(),t=await window.electronAPI.invoke("claude-projects-core-data",{billingCycleDay:a.settings.billingCycleDay||1});if(t.success)s(o=>({coreData:{...o.coreData,...t.data},lastRefresh:Date.now()})),r().calculateTabViews(),console.log("[OK] Store: Core data refreshed - 75+ values loaded");else throw new Error(t.error||"Failed to refresh core data")}catch(a){const t=a instanceof Error?a.message:"Unknown error";throw console.error("[ERR] Store: Core data refresh failed:",t),s({error:t}),a}},refreshCurrency:async()=>{try{s({isLoadingCurrency:!0}),console.log("[CURR] Store: Refreshing currency data...");const a=await be.fetchExchangeRates();s({exchangeRates:a,lastCurrencyRefresh:Date.now(),isLoadingCurrency:!1}),console.log("[OK] Store: Currency data refreshed")}catch(a){const t=a instanceof Error?a.message:"Unknown error";console.error("[ERR] Store: Currency refresh failed:",t),s({isLoadingCurrency:!1,error:t})}},refreshDatabase:async()=>{try{const a=Date.now();s({isLoadingDatabase:!0,databaseProgress:{step:"Initializing database refresh...",progress:0,message:"Starting database cleanup",timeRemaining:3e4}}),console.log("[DB] Store: Starting database refresh..."),s({databaseProgress:{step:"Clearing database...",progress:25,message:"Removing old data",timeRemaining:2e4}});const t=await window.electronAPI.invoke("claude-projects-refresh-database");if(!t.success)throw new Error(t.error||"Database refresh failed");s({databaseProgress:{step:"Reloading data...",progress:75,message:"Loading fresh data",timeRemaining:5e3}}),await new Promise(i=>setTimeout(i,1e3)),await r().refreshCoreData();const n=Date.now()-a;s({isLoadingDatabase:!1,databaseProgress:null}),console.log(`[OK] Store: Database refresh completed in ${(n/1e3).toFixed(1)}s`)}catch(a){const t=a instanceof Error?a.message:"Unknown error";throw console.error("[ERR] Store: Database refresh failed:",t),s({isLoadingDatabase:!1,databaseProgress:null,error:t}),a}},cleanupDatabase:async()=>{try{const a=Date.now();s({isLoadingDatabase:!0,databaseProgress:{step:"Cleaning corrupted data...",progress:0,message:"Scanning for corrupted timestamps",timeRemaining:15e3}}),console.log("[DB] Store: Starting database cleanup..."),s({databaseProgress:{step:"Removing corrupted entries...",progress:50,message:"Deleting January 2001 phantom entries",timeRemaining:8e3}});const t=await window.electronAPI.invoke("claude-projects-cleanup-timestamps");if(!t.success)throw new Error(t.error||"Database cleanup failed");s({databaseProgress:{step:"Reloading clean data...",progress:90,message:`Cleaned ${t.cleaned||0} corrupted entries`,timeRemaining:2e3}}),await r().refreshCoreData();const n=Date.now()-a;s({isLoadingDatabase:!1,databaseProgress:null}),console.log(`[OK] Store: Database cleanup completed in ${(n/1e3).toFixed(1)}s, cleaned ${t.cleaned||0} entries`)}catch(a){const t=a instanceof Error?a.message:"Unknown error";throw console.error("[ERR] Store: Database cleanup failed:",t),s({isLoadingDatabase:!1,databaseProgress:null,error:t}),a}},calculateTabViews:()=>{const a=r(),{coreData:t,currency:o}=a,n=h=>h,i={totalCost:n(t.totalCost),totalSessions:t.totalSessions,totalTokens:t.totalTokens,totalProjects:t.totalProjects,averageCostPerSession:n(t.averageCostPerSession),avgTokensPerSession:t.avgTokensPerSession,currency:o,status:t.status,lastActivity:t.lastActivity,models:t.models,activeDays:t.activeDays,activityData:(t.activityData||[]).map(h=>({...h,cost:n(h.cost||0)})),dailyBreakdown:(t.dailyBreakdown||[]).map(h=>({...h,totalCost:n(h.totalCost||0)})),dailyFinancialData:(t.dailyFinancialData||[]).map(h=>({...h,totalCost:n(h.totalCost||0),runningTotal:n(h.runningTotal||0),money:n(h.money||0),cumulativeMoney:n(h.cumulativeMoney||0)})),last7DaysTotal:n(t.last7DaysTotal||0)},d={projectsData:t.projectsData.map(h=>({...h,totalCost:n(h.totalCost||0),avgCostPerSession:n(h.avgCostPerSession||0)})),totalProjects:t.totalProjects,mostActiveProject:t.mostActiveProject,currency:o},u={sessionsData:t.sessionsData.map(h=>({...h,totalCost:n(h.totalCost||0)})),totalSessions:t.totalSessions,validSessions:t.validSessions,currency:o},c={monthlyData:t.monthlyData.map(h=>({...h,totalCost:n(h.totalCost||0),dailyAverage:n(h.dailyAverage||0),avgCostPerDay:n(h.avgCostPerDay||0),avgSessionCost:n(h.avgSessionCost||0),avgCostPerSession:n(h.avgCostPerSession||0)})),totalMonths:t.totalMonths||t.monthsTracked||0,currentMonth:t.currentMonth||null,currentMonthCost:n(t.currentMonthCost||0),currentPeriod:n(t.currentPeriod||0),averageMonthlySpend:n(t.averageMonthlySpend||t.monthlyAverage||0),monthlyAverage:n(t.monthlyAverage||0),projectedMonthly:n(t.projectedMonthly||0),quarterlyProjection:n(t.quarterlyProjection||0),projectedYearlySpend:n(t.projectedYearlySpend||t.yearlyProjection||0),yearlyProjection:n(t.yearlyProjection||0),currentRunRate:n(t.currentRunRate||0),highestSpendingMonth:t.highestSpendingMonth||null,mostActiveMonth:t.mostActiveMonth||null,monthlyGrowth:t.monthlyGrowth||t.growthTrend||0,growthTrend:t.growthTrend||0,totalCost:n(t.totalCost||0),currency:o},x=t.dailyData.map(h=>({...h,totalCost:n(h.totalCost||0),costPer1KTokens:h.costPer1KTokens||0})),p=x.filter(h=>h.sessionCount>0).length,l=x.reduce((h,f)=>h+(f.totalCost||0),0),C=p>0?l/p:0,j={dailyData:x,todayData:t.todayData?{...t.todayData,totalCost:n(t.todayData.totalCost||0)}:null,yesterdayData:t.yesterdayData?{...t.yesterdayData,totalCost:n(t.yesterdayData.totalCost||0)}:null,lastSessionData:t.lastSessionData?{...t.lastSessionData,totalCost:n(t.lastSessionData.totalCost||0)}:null,totalDays:7,activeDays:p,totalCost:l,averageDailyCost:C,totalSessions:t.totalSessions||0,currency:o},m={activeSession:t.activeSession,sessionActive:t.sessionActive,currentCost:n(t.currentCost),sessionTimeLeft:t.sessionTimeLeft,sessionId:t.sessionId,status:t.sessionStatus,duration:t.duration,timeLeft:t.timeLeft,lastActivity:t.lastActivity,started:t.started,currentTokens:t.currentTokens||0,currency:o};s({overviewData:i,projectsData:d,sessionsData:u,monthlyData:c,dailyData:j,dailyFinancialData:i.dailyFinancialData,activeData:m}),console.log("[BRAIN] Store: Tab views calculated from core data")},changeCurrency:async a=>{console.log(`[CURR] Store: Changing currency to ${a}...`);try{s({isLoadingCurrency:!0,error:null}),be.setSelectedCurrency(a),be.areRatesFresh()||await r().refreshCurrency(),s({currency:a}),r().calculateTabViews(),s({isLoadingCurrency:!1}),console.log(`[OK] Store: Currency changed to ${a} and all views updated`)}catch(t){const o=t instanceof Error?t.message:"Unknown error";throw console.error("[ERR] Store: Currency change failed:",o),s({isLoadingCurrency:!1,error:o}),t}},changeLanguage:async a=>{console.log(`[LANGUAGE] Store: Changing language to ${a}...`);try{s(t=>({settings:{...t.settings,language:a}})),await cs(a),console.log(`[OK] Store: Language changed to ${a}`)}catch(t){const o=t instanceof Error?t.message:"Unknown error";throw console.error("[ERR] Store: Language change failed:",o),s({error:o}),t}},exportData:async(a,t="json",o={})=>{console.log(`[EXPORT] Store: Exporting ${a} as ${t}...`);try{const n=await window.electronAPI.invoke("claude-projects-export",t,a,o);if(n.success)return console.log(`[OK] Store: Export completed (${n.data.length} characters)`),n.data;throw new Error(n.error||"Export failed")}catch(n){const i=n instanceof Error?n.message:"Unknown error";throw console.error("[ERR] Store: Export error:",i),s({error:i}),n}},getOverviewData:()=>r().overviewData,getProjectsData:()=>r().projectsData,getSessionsData:()=>r().sessionsData,getMonthlyData:()=>r().monthlyData,getDailyData:()=>r().dailyData,getActiveData:()=>r().activeData,setError:a=>{s({error:a})},clearError:()=>{s({error:null})},updateSettings:a=>{s(t=>({settings:{...t.settings,...a}})),a.currency&&a.currency!==r().currency&&r().changeCurrency(a.currency),a.billingCycleDay&&a.billingCycleDay!==r().settings.billingCycleDay&&(console.log(`[BILLING] Store: Billing cycle changed to day ${a.billingCycleDay}, refreshing data...`),r().refreshCoreData().catch(console.error)),a.language&&a.language!==r().settings.language&&(console.log("[STORE] Language change detected in updateSettings, calling changeLanguage:",a.language),r().changeLanguage(a.language).catch(console.error))},updateSshConfig:a=>{s(t=>({settings:{...t.settings,sshConfig:{...t.settings.sshConfig,...a}}}))},getSshConfig:()=>r().settings.sshConfig,testSshConnection:async()=>{try{const a=r().settings.sshConfig;return await window.electronAPI.invoke("ssh-test-connection",a)}catch(a){const t=a instanceof Error?a.message:"Unknown error";return console.error("[ERR] Store: SSH connection test failed:",t),{success:!1,message:t}}},checkForUpdates:async()=>{try{const a=Ee(),t=await la();if(t){const o=ca(a,t);s({currentAppVersion:a,latestVersion:t,isVersionOutdated:o,lastVersionCheck:Date.now()}),o?(console.log(`[VERSION] Update available: ${a} -> ${t}`),r().settings.autoUpdateNotifications&&window.dispatchEvent(new CustomEvent("show-update-popup",{detail:{currentVersion:a,latestVersion:t}}))):console.log(`[VERSION] App is up to date: ${a}`)}}catch(a){console.error("[VERSION] Failed to check for updates:",a)}},performUpdate:async()=>{var a,t;try{if(console.log("[UPDATE] Starting auto-update process..."),console.log("[UPDATE] electronAPI available:",!!window.electronAPI),console.log("[UPDATE] electronAPI keys:",window.electronAPI?Object.keys(window.electronAPI):"null"),console.log("[UPDATE] performUpdate available:",!!((a=window.electronAPI)!=null&&a.performUpdate)),(t=window.electronAPI)!=null&&t.performUpdate){console.log("[UPDATE] Calling electronAPI.performUpdate...");const o=await window.electronAPI.performUpdate();if(console.log("[UPDATE] Result:",o),o.success)console.log("[UPDATE] Update completed successfully - app should restart");else throw new Error(o.error||"Update failed")}else throw new Error("Auto-update not available. Please update manually: npm install -g dragon-ui-claude@latest")}catch(o){console.error("[UPDATE] Update failed:",o),s({error:"Update failed: "+(o instanceof Error?o.message:"Unknown error")})}}})),{name:"dragon-ui-storage",partialize:s=>({theme:s.theme,activeTab:s.activeTab,settings:s.settings,currency:s.currency})})),Ua=()=>{const{overviewData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),{data:s,isLoading:r,refresh:a}},Ta=()=>{const{projectsData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),{data:s,isLoading:r,refresh:a}},Aa=()=>{const{sessionsData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),{data:s,isLoading:r,refresh:a}},Ea=()=>{const{monthlyData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),{data:s,isLoading:r,refresh:a}},za=()=>{const{dailyData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),{data:s,isLoading:r,refresh:a}},ds=()=>{const{activeData:s,isLoading:r,refreshCoreData:a}=O();return ce.useEffect(()=>{!s&&!r&&a().catch(console.error)},[s,r,a]),ce.useEffect(()=>{var c,x,p,l;let t=null,o=!1;const n=()=>{!document.hidden&&!r&&!o&&(console.log("[REFRESH] Smart refresh: Incremental update check"),a().catch(console.error))};t=setInterval(n,3e4);const i=()=>{document.hidden?(o=!0,t&&(clearInterval(t),t=null,console.log("[PAUSE] Smart refresh: Paused (window hidden)"))):(o=!1,t||(t=setInterval(n,3e4),console.log("[RESUME] Smart refresh: Resumed (window visible)"),setTimeout(()=>{n()},500)))},d=()=>{o=!0,t&&(clearInterval(t),t=null,console.log("[PAUSE] Smart refresh: Paused (app minimized)"))},u=()=>{o=!1,t||(t=setInterval(n,3e4),console.log("[RESUME] Smart refresh: Resumed (app restored)"),setTimeout(()=>{n()},1e3))};return document.addEventListener("visibilitychange",i),window.electronAPI&&((x=(c=window.electronAPI).onAppMinimized)==null||x.call(c,d),(l=(p=window.electronAPI).onAppRestored)==null||l.call(p,u)),()=>{t&&clearInterval(t),document.removeEventListener("visibilitychange",i)}},[r,a]),{data:s,isLoading:r,refresh:a}};if(typeof window<"u"&&window.electronAPI){const{theme:s}=O.getState();document.documentElement.classList.toggle("dark",s==="dark"),window.electronAPI.on("core-data-updated",a=>{console.log("[IPC] Store: Received auto-pushed core data from backend");const t=O.getState();if(a._loadingProgress){O.setState({loadingProgress:a._loadingProgress});return}t.setError(null),O.setState(o=>({coreData:{...o.coreData,...a},lastRefresh:Date.now(),loadingProgress:null})),t.calculateTabViews()}),setTimeout(()=>{O.getState().initializeStore().catch(console.error)},100);const r=()=>{const a=O.getState(),t=Date.now(),o=60*60*1e3;t-a.lastVersionCheck>o&&a.checkForUpdates()};setTimeout(()=>{O.getState().checkForUpdates(),setInterval(r,36e5)},5e3)}const ms=N.forwardRef(({className:s,variant:r="button",...a},t)=>{const{theme:o,toggleTheme:n}=O(),{t:i}=te(),d=()=>{n()};return r==="icon"?e.jsxs(P,{ref:t,variant:"ghost",size:"icon",onClick:d,className:k("relative overflow-hidden transition-all duration-300",s),...a,children:[e.jsx(Ae,{className:"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Oe,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:i("app.theme.toggle")})]}):r==="dragon"?e.jsxs(P,{ref:t,variant:"dragon",size:"sm",onClick:d,className:k("relative overflow-hidden group transition-all duration-300",s),...a,children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Oe,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"})]}),e.jsx("span",{className:"text-sm font-medium",children:i(o==="light"?"app.theme.dark":"app.theme.light")})]}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent opacity-0 group-hover:opacity-100 transform -skew-x-12 -translate-x-full group-hover:translate-x-full transition-all duration-700"})]}):e.jsx(P,{ref:t,variant:"outline",size:"sm",onClick:d,className:k("relative overflow-hidden transition-all duration-300",s),...a,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Oe,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"})]}),e.jsx("span",{className:"text-sm",children:i(o==="light"?"app.theme.darkMode":"app.theme.lightMode")})]})})});ms.displayName="ThemeToggle";const Ma=N.forwardRef(({className:s,size:r="md",variant:a="default",...t},o)=>{const n={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8",xl:"w-12 h-12"},i={default:"border-primary",dragon:"border-dragon-primary",flame:"border-dragon-flame"};return e.jsx("div",{ref:o,className:k("animate-spin rounded-full border-2 border-solid border-current border-r-transparent",n[r],i[a],s),...t})});Ma.displayName="LoadingSpinner";const se=N.forwardRef(({className:s,size:r="md",text:a,...t},o)=>{const n={sm:"w-6 h-6",md:"w-8 h-8",lg:"w-12 h-12",xl:"w-16 h-16"};return e.jsxs("div",{ref:o,className:k("flex flex-col items-center justify-center space-y-2",s),...t,children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:k("animate-spin rounded-full border-4 border-dragon-primary/20",n[r])}),e.jsx("div",{className:k("absolute inset-0 animate-spin rounded-full border-4 border-transparent border-t-dragon-primary border-r-dragon-secondary",n[r]),style:{animationDuration:"1s"}}),e.jsx("div",{className:k("absolute inset-2 animate-pulse rounded-full bg-gradient-to-br from-dragon-primary/20 to-dragon-secondary/20")})]}),a&&e.jsx("p",{className:"text-sm text-muted-foreground animate-pulse",children:a})]})});se.displayName="DragonLoading";const Ia=N.forwardRef(({className:s,size:r="md",variant:a="default",...t},o)=>{const n={sm:"w-1 h-1",md:"w-2 h-2",lg:"w-3 h-3"},i={default:"bg-primary",dragon:"bg-dragon-primary"};return e.jsx("div",{ref:o,className:k("flex space-x-1",s),...t,children:[0,1,2].map(d=>e.jsx("div",{className:k("rounded-full animate-pulse",n[r],i[a]),style:{animationDelay:`${d*.2}s`,animationDuration:"1s"}},d))})});Ia.displayName="LoadingDots";const rt=N.forwardRef(({className:s,visible:r,text:a="Loading...",...t},o)=>r?e.jsx("div",{ref:o,className:k("fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",s),...t,children:e.jsx(se,{size:"lg",text:a})}):null);rt.displayName="LoadingOverlay";const Fa=st("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",dragon:"border-transparent bg-gradient-to-r from-dragon-primary to-dragon-secondary text-white hover:shadow-lg transition-all duration-300",flame:"border-transparent bg-dragon-flame text-white hover:shadow-lg hover:shadow-dragon-flame/25",emerald:"border-transparent bg-dragon-emerald text-white",scale:"border-dragon-primary/20 bg-dragon-scale text-white",gold:"border-transparent bg-dragon-accent text-black font-bold"}},defaultVariants:{variant:"default"}}),I=N.forwardRef(({className:s,variant:r="dragon",pulse:a=!1,glow:t=!1,...o},n)=>e.jsx("div",{ref:n,className:k(Fa({variant:r}),a&&"animate-pulse",t&&"shadow-lg shadow-current/25",s),...o}));I.displayName="DragonBadge";const Xe=({open:s,onOpenChange:r,children:a})=>(N.useEffect(()=>{const t=o=>{o.key==="Escape"&&r(!1)};return s&&(document.addEventListener("keydown",t),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow="unset"}},[s,r]),s?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>r(!1)}),e.jsx("div",{className:"relative z-50",children:a})]}):null),Ze=({className:s,children:r})=>e.jsx("div",{className:k("bg-background border border-border rounded-lg shadow-lg p-6 w-full max-w-lg mx-4","animate-in fade-in-0 zoom-in-95 duration-200",s),children:r}),Qe=({className:s,children:r})=>e.jsx("div",{className:k("flex flex-col space-y-1.5 text-center sm:text-left",s),children:r}),es=({className:s,children:r})=>e.jsx("h2",{className:k("text-lg font-semibold leading-none tracking-tight",s),children:r}),ss=({className:s,children:r})=>e.jsx("p",{className:k("text-sm text-muted-foreground",s),children:r}),ts=({className:s,children:r})=>e.jsx("div",{className:k("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),children:r});function La({isOpen:s,onClose:r,currentVersion:a,latestVersion:t,onUpdate:o}){const[n,i]=N.useState(!1),d=async()=>{i(!0);try{await o()}catch(u){console.error("[UPDATE] Update failed:",u),i(!1)}};return e.jsx(Xe,{open:s,onOpenChange:r,children:e.jsxs(Ze,{className:"sm:max-w-md",children:[e.jsxs(Qe,{children:[e.jsxs(es,{className:"flex items-center space-x-2",children:[e.jsx(pe,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:"Update Available"})]}),e.jsx(ss,{children:"A new version of Dragon UI is available with improvements and bug fixes."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Version"}),e.jsxs(I,{variant:"outline",className:"mt-1",children:["v",a]})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"h-px w-8 bg-gradient-to-r from-dragon-primary to-dragon-secondary"}),e.jsx(_,{className:"h-4 w-4 mx-2 text-dragon-accent"}),e.jsx("div",{className:"h-px w-8 bg-gradient-to-r from-dragon-secondary to-dragon-primary"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Latest Version"}),e.jsxs(I,{variant:"dragon",className:"mt-1 animate-pulse",children:["v",t]})]})]}),e.jsxs("div",{className:"flex items-start space-x-3 p-3 rounded-lg bg-yellow-500/10 border border-yellow-500/20",children:[e.jsx(Bs,{className:"h-5 w-5 text-yellow-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-yellow-700 dark:text-yellow-300",children:"Automatic Update"}),e.jsx("p",{className:"text-yellow-600 dark:text-yellow-400",children:"The app will close and restart automatically. Save any work before proceeding."})]})]})]}),e.jsxs(ts,{className:"flex space-x-2",children:[e.jsxs(P,{variant:"outline",onClick:r,disabled:n,className:"flex items-center space-x-2",children:[e.jsx(jt,{className:"h-4 w-4"}),e.jsx("span",{children:"Later"})]}),e.jsxs(P,{variant:"dragon",onClick:d,disabled:n,className:"flex items-center space-x-2",children:[e.jsx(pe,{className:`h-4 w-4 ${n?"animate-spin":""}`}),e.jsx("span",{children:n?"Updating...":"Update Now"})]})]})]})})}function hs(){return{formatTime:s=>da(s),formatDateTime:s=>qe(s),formatDate:(s,r)=>Zs(s,"auto",r),timeFormat:"24h",timezone:"auto"}}const $a=N.forwardRef(({className:s,...r},a)=>e.jsx("div",{ref:a,className:k("rounded-lg border bg-card text-card-foreground shadow-sm glass-effect",s),...r}));$a.displayName="Card";const L=N.forwardRef(({className:s,...r},a)=>e.jsx("div",{ref:a,className:k("flex flex-col space-y-1.5 p-6",s),...r}));L.displayName="CardHeader";const $=N.forwardRef(({className:s,...r},a)=>e.jsx("h3",{ref:a,className:k("text-2xl font-semibold leading-none tracking-tight",s),...r}));$.displayName="CardTitle";const Oa=N.forwardRef(({className:s,...r},a)=>e.jsx("p",{ref:a,className:k("text-sm text-muted-foreground",s),...r}));Oa.displayName="CardDescription";const w=N.forwardRef(({className:s,...r},a)=>e.jsx("div",{ref:a,className:k("p-6 pt-0",s),...r}));w.displayName="CardContent";const _a=N.forwardRef(({className:s,...r},a)=>e.jsx("div",{ref:a,className:k("flex items-center p-6 pt-0",s),...r}));_a.displayName="CardFooter";const y=N.forwardRef(({className:s,variant:r="default",...a},t)=>{const o={default:"glass-effect",gradient:"dragon-gradient glass-effect",scales:"dragon-scales glass-effect",flame:"glass-effect border-dragon-flame/20 hover:flame-glow transition-all duration-300"};return e.jsx("div",{ref:t,className:k("rounded-lg border bg-card text-card-foreground shadow-sm",o[r],s),...a})});y.displayName="DragonCard";const Ba=N.forwardRef(({className:s,value:r,...a},t)=>e.jsx(os,{ref:t,className:k("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...a,children:e.jsx(Ms,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));Ba.displayName=os.displayName;const ye=N.forwardRef(({className:s,value:r,variant:a="default",animated:t=!1,...o},n)=>{const i={default:"bg-gradient-to-r from-dragon-primary to-dragon-secondary",flame:"bg-gradient-to-r from-dragon-flame to-orange-500",emerald:"bg-dragon-emerald",gold:"bg-gradient-to-r from-dragon-accent to-yellow-400"};return e.jsx(os,{ref:n,className:k("relative h-3 w-full overflow-hidden rounded-full bg-secondary/50 glass-effect",s),...o,children:e.jsx(Ms,{className:k("h-full w-full flex-1 transition-all duration-500 ease-out relative",i[a],t&&"animate-pulse"),style:{transform:`translateX(-${100-(r||0)}%)`},children:t&&e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-scale-shimmer"})})})});ye.displayName="DragonProgress";const oe=N.forwardRef(({title:s,value:r,previousValue:a,icon:t,iconColor:o,variant:n="default",trend:i,trendPercentage:d,subtitle:u,progress:c,maxValue:x,currency:p=!1,className:l,...C},j)=>{const m=A=>typeof A=="string"?A:p?b(A):M(A),h=N.useMemo(()=>{if(d!==void 0)return d;if(a!==void 0&&typeof r=="number"&&typeof a=="number")return ma(r,a)},[r,a,d]),f=N.useMemo(()=>i||(h!==void 0?h>0?"up":h<0?"down":"neutral":"neutral"),[i,h]),v=N.useMemo(()=>{if(c!==void 0)return c;if(x&&typeof r=="number")return Math.min(r/x*100,100)},[c,r,x]),U=N.useMemo(()=>{if(o)return o;switch(n){case"gradient":return"text-dragon-primary group-hover:text-dragon-secondary";case"scales":return"text-dragon-secondary group-hover:text-dragon-primary";case"flame":return"text-dragon-accent group-hover:text-dragon-primary";default:return"text-dragon-primary group-hover:text-dragon-secondary"}},[n,o]);return e.jsx(y,{ref:j,variant:n,className:k("p-6 transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border group relative z-10 hover:z-20",l),...C,children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[t&&e.jsx(t,{className:k("h-5 w-5 transition-colors",U)}),e.jsx("p",{className:"text-sm font-medium text-muted-foreground group-hover:text-foreground transition-colors",children:s})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-2xl font-bold tracking-tight",children:m(r)}),u&&e.jsx("p",{className:"text-sm text-muted-foreground",children:u})]}),h!==void 0&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(I,{variant:f==="up"?"emerald":f==="down"?"flame":"scale",className:"text-xs",children:[h>0?"+":"",h.toFixed(1),"%"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"vs previous period"})]}),v!==void 0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ye,{value:v,variant:n==="flame"?"flame":n==="scales"?"emerald":"default",animated:!0,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:m(r)}),x&&e.jsx("span",{children:m(x)})]})]})]})})})});oe.displayName="StatsCard";const as=N.forwardRef(({children:s,columns:r=4,className:a,...t},o)=>{const n={1:"grid-cols-1",2:"grid-cols-1 md:grid-cols-2",3:"grid-cols-1 md:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 md:grid-cols-2 lg:grid-cols-4"};return e.jsx("div",{ref:o,className:k("grid gap-4",n[r],a),...t,children:s})});as.displayName="StatsGrid";Is.register(Fs,Ls,ht,$s,Os,_s);function Ya({data:s,currency:r="USD"}){if(console.log("[CHART] ActivityChart received data:",s),!s||s.length===0)return console.log("[CHART] No data provided to ActivityChart"),e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:e.jsx("p",{children:"No activity data available"})});const a={labels:s.map(n=>n.label||new Date(n.date).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})),datasets:[{label:"Daily Cost",data:s.map(n=>n.sessions===0&&n.cost===0&&n.tokens===0?.001:n.cost),backgroundColor:s.map(n=>n.sessions===0&&n.cost===0&&n.tokens===0?"rgba(156, 163, 175, 0.3)":"rgba(99, 102, 241, 0.8)"),borderColor:s.map(n=>n.sessions===0&&n.cost===0&&n.tokens===0?"rgba(156, 163, 175, 0.5)":"rgb(99, 102, 241)"),borderWidth:1,borderRadius:4,borderSkipped:!1}]},t={id:"noSessionsLabel",afterDatasetsDraw:n=>{const i=n.ctx,d=n.getDatasetMeta(0),u=n.chartArea;d.data.forEach((c,x)=>{const p=s[x];if(p.sessions===0&&p.cost===0&&p.tokens===0){const l=c.getProps(["x","y","width","height"]);i.save(),i.fillStyle="rgba(255, 255, 255, 0.95)",i.font="bold 12px sans-serif",i.textAlign="center",i.textBaseline="middle";const C=l.x,j=u.bottom-u.top,m=u.top+j*.5;i.translate(C,m),i.rotate(-Math.PI/4),i.fillText("No sessions",0,0),i.restore()}})}},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},title:{display:!1},tooltip:{callbacks:{label:function(n){const i=n.dataIndex,d=s[i];return d.sessions===0&&d.cost===0&&d.tokens===0?["No sessions today","Cost: $0.00","Tokens: 0"]:[`Cost: ${b(d.cost,r)}`,`Tokens: ${d.tokens.toLocaleString()}`,`Sessions: ${d.sessions}`]}},backgroundColor:"rgba(0, 0, 0, 0.8)",titleColor:"white",bodyColor:"white",borderColor:"rgba(99, 102, 241, 0.8)",borderWidth:1}},scales:{x:{grid:{display:!1},ticks:{color:"rgb(156, 163, 175)",font:{size:12}}},y:{beginAtZero:!0,grid:{color:"rgba(156, 163, 175, 0.1)"},ticks:{color:"rgb(156, 163, 175)",font:{size:12},callback:function(n){return n<.01?"$0.00":b(n,r)}}}}};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-48",children:e.jsx(gt,{data:a,options:o,plugins:[t]})}),e.jsx("div",{className:"flex justify-start ml-12 mr-4",children:e.jsx("div",{className:`grid gap-1 text-xs flex-1 ${s.length===7?"grid-cols-7":s.length===6?"grid-cols-6":s.length===5?"grid-cols-5":s.length===4?"grid-cols-4":s.length===3?"grid-cols-3":s.length===2?"grid-cols-2":"grid-cols-1"}`,children:s.map((n,i)=>{const d=n.sessions>0||n.cost>0||n.tokens>0;return e.jsx("div",{className:`text-center space-y-1 p-2 rounded ${d?"bg-muted/20":"bg-muted/10 opacity-60"}`,children:d?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-dragon-primary",children:b(n.cost,r)}),e.jsxs("div",{className:"text-muted-foreground",children:[n.tokens.toLocaleString(),"T"]}),e.jsxs("div",{className:"text-muted-foreground",children:[n.sessions,"S"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-muted-foreground",children:"$0.00"}),e.jsx("div",{className:"text-muted-foreground text-xs",children:"No sessions"}),e.jsx("div",{className:"text-muted-foreground text-xs opacity-50",children:"-"})]})},i)})})})]})}Is.register(Fs,Ls,xt,ut,$s,Os,_s,pt);function Ha({data:s,currency:r}){if(!s||s.length===0)return e.jsx("div",{className:"h-64 flex items-center justify-center text-muted-foreground",children:"No financial data available"});const a=s.reduce((i,d)=>i+d.money,0),t=s.length>0?s[s.length-1].cumulativeMoney:0,o={labels:s.map(i=>i.formattedDate),datasets:[{label:"Daily Spend",data:s.map(i=>i.money),borderColor:"#7C3AED",backgroundColor:"rgba(124, 58, 237, 0.1)",borderWidth:3,fill:!1,tension:.4,pointBackgroundColor:"#7C3AED",pointBorderColor:"#FFFFFF",pointBorderWidth:2,pointRadius:5,pointHoverRadius:8,pointHoverBackgroundColor:"#F59E0B",pointHoverBorderColor:"#FFFFFF",pointHoverBorderWidth:3,yAxisID:"y"},{label:"Running Total",data:s.map(i=>i.cumulativeMoney),borderColor:"#F59E0B",backgroundColor:"rgba(245, 158, 11, 0.1)",borderWidth:3,fill:!0,tension:.4,pointBackgroundColor:"#F59E0B",pointBorderColor:"#FFFFFF",pointBorderWidth:2,pointRadius:4,pointHoverRadius:7,pointHoverBackgroundColor:"#EF4444",pointHoverBorderColor:"#FFFFFF",pointHoverBorderWidth:3,yAxisID:"y1"}]},n={responsive:!0,maintainAspectRatio:!1,interaction:{intersect:!1,mode:"index"},plugins:{legend:{display:!0,position:"top",labels:{color:"#94A3B8",font:{size:12},usePointStyle:!0,pointStyle:"line"}},tooltip:{backgroundColor:"rgba(15, 23, 42, 0.95)",titleColor:"#F1F5F9",bodyColor:"#F1F5F9",borderColor:"#7C3AED",borderWidth:1,cornerRadius:8,displayColors:!0,callbacks:{title:i=>{const d=i[0].dataIndex;return s[d].date},label:i=>{const d=i.dataIndex,u=s[d];return i.dataset.label==="Daily Spend"?[`Daily: ${b(u.money,r)}`,`Sessions: ${u.sessionCount}`]:`Total: ${b(u.cumulativeMoney,r)}`}}}},scales:{x:{grid:{color:"rgba(255, 255, 255, 0.1)",drawBorder:!1},ticks:{color:"#94A3B8",font:{size:11},maxRotation:45},border:{display:!1}},y:{type:"linear",display:!0,position:"left",beginAtZero:!0,grid:{color:"rgba(124, 58, 237, 0.1)",drawBorder:!1},ticks:{color:"#7C3AED",font:{size:11},callback:function(i){return b(i,r)}},border:{display:!1},title:{display:!0,text:"Daily Spend",color:"#7C3AED",font:{size:12,weight:"bold"}}},y1:{type:"linear",display:!0,position:"right",beginAtZero:!0,grid:{drawOnChartArea:!1,color:"rgba(245, 158, 11, 0.1)"},ticks:{color:"#F59E0B",font:{size:11},callback:function(i){return b(i,r)}},border:{display:!1},title:{display:!0,text:"Running Total",color:"#F59E0B",font:{size:12,weight:"bold"}}}},elements:{point:{hoverBackgroundColor:"#F59E0B"}}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Last ",s.length," days • Dual financial view"]}),e.jsxs("div",{className:"flex space-x-8",children:[e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-lg font-bold text-dragon-primary",children:b(a,r)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Period Total"})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-2xl font-bold text-dragon-gold",children:b(t,r)}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Running Total"})]})]})]}),e.jsx("div",{className:"h-80",children:e.jsx(ft,{data:o,options:n})})]})}function Ga(){const{data:s,isLoading:r,refresh:a}=Ua(),{data:t,isLoading:o}=ds(),{t:n}=te();return r?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:n("pages.overview.loadingOverview")})}):s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:n("pages.overview.title")}),e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.description")})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground",children:[e.jsx(ie,{className:"h-4 w-4"}),e.jsx("span",{children:n("pages.overview.realTimeMonitoring")})]})]}),e.jsxs(as,{columns:4,children:[e.jsx(oe,{title:n("pages.overview.stats.totalCost"),value:s.totalCost,icon:Ce,variant:"gradient",currency:!0,subtitle:`in ${s.currency}`}),e.jsx(oe,{title:n("pages.overview.stats.totalSessions"),value:`${s.totalSessions} / 50`,icon:_,variant:"scales",subtitle:n("pages.overview.stats.fiveHourWindows")}),e.jsx(oe,{title:n("pages.overview.stats.averageCostPerSession"),value:s.averageCostPerSession,icon:Se,variant:"flame",currency:!0}),e.jsx(oe,{title:n("pages.overview.stats.totalTokens"),value:s.totalTokens,icon:Ys,iconColor:"text-amber-500 group-hover:text-amber-400",variant:"default",subtitle:`${M(s.totalTokens)} ${n("pages.overview.stats.tokens")}`})]}),e.jsxs(as,{columns:3,children:[e.jsx(oe,{title:n("pages.overview.stats.status"),value:s.status,icon:ie,iconColor:"text-emerald-500 group-hover:text-emerald-400",subtitle:s.lastActivity?`${n("pages.overview.lastActivity")}: ${de(s.lastActivity)}`:n("pages.overview.noActivity")}),e.jsx(oe,{title:n("pages.overview.stats.activeDays"),value:`${s.activeDays} / ${new Date(new Date().getFullYear(),new Date().getMonth()+1,0).getDate()}`,icon:V,iconColor:"text-blue-500 group-hover:text-blue-400",subtitle:n("pages.overview.stats.daysWithUsage")}),e.jsx(oe,{title:n("pages.overview.stats.modelsUsed"),value:s.models.length,icon:_e,iconColor:"text-purple-500 group-hover:text-purple-400",subtitle:s.models.join(", ")||"None"})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{className:"pb-3",children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(_,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:n("pages.overview.currentSession.title")})]})}),e.jsx(w,{className:"pt-0",children:o?e.jsx(se,{size:"sm",text:n("pages.overview.loadingSession")}):t!=null&&t.sessionActive?e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.started")}),e.jsx("p",{className:"font-bold text-xl",children:t.started?de(t.started):n("pages.overview.currentSession.unknown")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.duration")}),e.jsx("p",{className:"font-bold text-xl",children:t.duration?`${Math.floor(t.duration/60)}h ${t.duration%60}m`:"0m"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.cost")}),e.jsx("p",{className:"font-bold text-xl text-dragon-accent",children:b(t.currentCost,t.currency)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.timeLeft")}),e.jsx("p",{className:"font-bold text-xl",children:t.timeLeft?`${Math.floor(t.timeLeft/60)}h ${t.timeLeft%60}m`:"N/A"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.lastActivity")}),e.jsx("p",{className:"font-bold text-xl",children:t.lastActivity?new Date(t.lastActivity).toLocaleTimeString():n("pages.overview.currentSession.unknown")})]}),t.sessionId&&e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.currentSession.sessionId")}),e.jsx("p",{className:"font-mono font-bold text-xl",children:t.sessionId})]})]})}):e.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[e.jsx(V,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:n("pages.overview.currentSession.noActiveSession")}),e.jsx("p",{className:"text-xs",children:n("pages.overview.currentSession.startUsingClaude")})]})})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{className:"pb-3",children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(_e,{className:"h-5 w-5 text-dragon-secondary"}),e.jsx("span",{children:n("pages.overview.quickStats.title")})]})}),e.jsx(w,{className:"pt-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("pages.overview.quickStats.totalCost")}),e.jsx("span",{className:"font-bold text-xl",children:b(s.totalCost,s.currency)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("pages.overview.quickStats.totalTokens")}),e.jsx("span",{className:"font-bold text-xl",children:M(s.totalTokens)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("pages.overview.quickStats.sessions")}),e.jsxs("span",{className:"font-bold text-xl",children:[s.totalSessions," / 50"]})]}),e.jsx("div",{className:"pt-2 border-t border-white/10",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:n("pages.overview.quickStats.avgTokensPerSession")}),e.jsx("span",{className:"font-bold text-xl",children:M(s.avgTokensPerSession)})]})})]})})]})]}),e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(ie,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:n("pages.overview.activity.title")}),s.last7DaysTotal>0&&e.jsxs("span",{className:"text-sm text-muted-foreground ml-auto",children:[n("pages.overview.activity.total"),": ",b(s.last7DaysTotal,s.currency)]})]})}),e.jsx(w,{children:e.jsx(Ya,{data:s.activityData?[...s.activityData].sort((i,d)=>new Date(i.date).getTime()-new Date(d.date).getTime()):[],currency:s.currency})})]}),e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(Se,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:n("pages.overview.financialChart.title","All Sessions")}),s.dailyFinancialData&&s.dailyFinancialData.length>0&&e.jsxs("span",{className:"text-sm text-muted-foreground ml-auto",children:[n("pages.overview.financialChart.total","Total"),": ",b(s.dailyFinancialData.length>0?s.dailyFinancialData[s.dailyFinancialData.length-1].cumulativeMoney:0,s.currency)]})]})}),e.jsx(w,{children:e.jsx(Ha,{data:s.dailyFinancialData?[...s.dailyFinancialData].sort((i,d)=>new Date(i.date).getTime()-new Date(d.date).getTime()):[],currency:s.currency})})]})]}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:n("pages.overview.loadingUsageData")})})}function Va(){var d,u;const{data:s,isLoading:r}=Ta(),{t:a}=te();if(r)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:a("pages.projects.loadingProjects")})});if(!s||!s.projectsData||s.projectsData.length===0)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(le,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-muted-foreground",children:a("pages.projects.noProjectData")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:a("pages.projects.projectDataWillAppear")})]});const{projectsData:t,totalProjects:o,mostActiveProject:n,currency:i}=s;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:a("pages.projects.title")}),e.jsxs("p",{className:"text-muted-foreground",children:[a("pages.projects.description")," (",i,")"]})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(le,{className:"h-4 w-4"}),e.jsxs("span",{children:[o," ",a("pages.projects.projects")]})]}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Ce,{className:"h-4 w-4"}),e.jsx("span",{children:i})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(le,{className:"h-5 w-5 text-dragon-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("pages.projects.stats.totalProjects")}),e.jsx("p",{className:"text-2xl font-bold",children:o})]})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ce,{className:"h-5 w-5 text-dragon-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a("pages.projects.stats.totalCost")}),e.jsx("p",{className:"text-2xl font-bold",children:b(t.reduce((c,x)=>c+(x.totalCost||0),0),i)})]})]})})}),e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(_,{className:"h-5 w-5 text-white"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white/80",children:a("pages.projects.stats.mostActive")}),e.jsx("p",{className:"text-lg font-bold text-white",children:n||"N/A"})]})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:a("pages.projects.insights.title")}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-primary",children:a("pages.projects.insights.mostActiveProject")}),e.jsx("h3",{className:"text-xl font-bold",children:n||"N/A"}),e.jsxs("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[((d=t==null?void 0:t[0])==null?void 0:d.sessions)||0," ",a("pages.projects.stats.sessions")]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:b(((u=t==null?void 0:t[0])==null?void 0:u.totalCost)||0,i)})]})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-blue-500",children:a("pages.projects.insights.portfolio")}),e.jsxs("div",{className:"flex items-baseline space-x-2",children:[e.jsx("h3",{className:"text-xl font-bold",children:o}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a("pages.projects.insights.projectsTracked")})]}),e.jsxs("div",{className:"space-y-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:a("pages.projects.stats.totalCost")}),e.jsx("span",{className:"font-medium",children:b(t.reduce((c,x)=>c+(x.totalCost||0),0),i)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:a("pages.projects.insights.avgPerProject")}),e.jsx("span",{className:"font-medium",children:b(o>0?t.reduce((c,x)=>c+(x.totalCost||0),0)/o:0,i)})]})]})]})})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:a("pages.projects.breakdown.title")}),e.jsx("div",{className:"grid gap-4",children:t==null?void 0:t.map((c,x)=>{const p=x<3;return e.jsx(y,{variant:p?"scales":"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-dragon-primary to-dragon-secondary flex items-center justify-center",children:e.jsx(le,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-lg",children:c.project||c.name||`Project ${x+1}`}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c.lastActivity?`${a("pages.projects.breakdown.lastActivity")} ${de(c.lastActivity)}`:a("pages.projects.breakdown.noRecentActivity")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[p&&e.jsxs(I,{variant:"gold",children:[a("pages.projects.breakdown.top")," ",x+1]}),e.jsxs(I,{variant:"dragon",children:[((c.totalCost||0)/Math.max(1,t.reduce((l,C)=>l+(C.totalCost||0),0))*100).toFixed(1),"% ",a("pages.projects.breakdown.ofTotal")]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:a("pages.projects.stats.totalCost")}),e.jsx("p",{className:"font-bold text-lg text-dragon-accent",children:b(c.totalCost||0,i)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:a("pages.projects.stats.tokensUsed")}),e.jsx("p",{className:"font-semibold",children:M(c.totalTokens||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:a("pages.projects.stats.sessions")}),e.jsxs("p",{className:"font-semibold flex items-center space-x-1",children:[e.jsx(_,{className:"h-3 w-3"}),e.jsx("span",{children:c.sessions||0})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:a("pages.projects.stats.avgCostPerSession")}),e.jsx("p",{className:"font-semibold",children:b(c.avgCostPerSession||0,i)})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[a("pages.projects.breakdown.costPer1MTokens"),": ",b((c.totalTokens||0)>0?(c.totalCost||0)/(c.totalTokens||1)*1e6:0,i)]}),e.jsx("span",{className:"mx-4",children:c.models&&c.models.length>0&&e.jsxs("span",{children:[c.models.length," ",a("pages.projects.breakdown.models")," (",c.models.join(", "),")"]})}),e.jsxs("span",{children:[a("pages.projects.breakdown.tokensPerSession"),": ",M((c.sessions||0)>0?(c.totalTokens||0)/(c.sessions||1):0)]})]})})]})},c.project||c.name||x)})})]})]})}function Wa(){var u;const{data:s,isLoading:r,refresh:a}=Aa(),{t}=te();if(r)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:t("pages.sessions.loadingSessions")})});if(!s||!s.sessionsData||s.sessionsData.length===0)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(_,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-muted-foreground",children:t("pages.sessions.noSessionData")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t("pages.sessions.sessionDataWillAppear")})]});const{sessionsData:o,totalSessions:n,validSessions:i,currency:d}=s;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:t("pages.sessions.title")}),e.jsxs("p",{className:"text-muted-foreground",children:[t("pages.sessions.description")," (",d,")"]})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(_,{className:"h-4 w-4"}),e.jsxs("span",{children:[n," / 50 ",t("pages.sessions.stats.total")]})]}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsxs("span",{children:[i," / 50 ",t("pages.sessions.stats.valid")]})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(_,{className:"h-5 w-5 text-dragon-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("pages.sessions.stats.totalSessions")}),e.jsxs("p",{className:"text-2xl font-bold",children:[n," / 50"]})]})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(V,{className:"h-5 w-5 text-dragon-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("pages.sessions.stats.validSessions")}),e.jsxs("p",{className:"text-2xl font-bold",children:[i," / 50"]})]})]})})}),e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ce,{className:"h-5 w-5 text-white"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white/80",children:t("pages.sessions.stats.totalCost")}),e.jsx("p",{className:"text-2xl font-bold text-white",children:b(o.reduce((c,x)=>c+(x.totalCost||0),0),d)})]})]})})})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(fe,{className:"h-5 w-5"}),e.jsx("span",{children:t("pages.sessions.insights.title")})]})}),e.jsx(w,{children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:t("pages.sessions.insights.avgSessionCost")}),e.jsx("p",{className:"text-lg font-bold text-dragon-accent",children:b(n>0?o.reduce((c,x)=>c+(x.totalCost||0),0)/n:0,d)})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:t("pages.sessions.insights.avgTokens")}),e.jsx("p",{className:"text-lg font-bold",children:M(n>0?o.reduce((c,x)=>c+(x.totalTokens||0),0)/n:0)})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:t("pages.sessions.insights.mostRecentSession")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(u=o==null?void 0:o[0])!=null&&u.startTime?de(o[0].startTime):t("pages.sessions.insights.noSessionsYet")})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("pages.sessions.history.title")}),e.jsx("div",{className:"grid gap-4",children:o==null?void 0:o.map((c,x)=>{const p=x<5;return e.jsx(y,{variant:p?"scales":"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-dragon-primary to-dragon-secondary flex items-center justify-center",children:e.jsx(_,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold text-lg",children:[t("pages.sessions.history.session")," ",c.sessionId||c.id||`#${x+1}`]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:c.startTime?`${t("pages.sessions.history.started")} ${de(c.startTime)}`:t("pages.sessions.history.unknownStartTime")})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[p&&e.jsx(I,{variant:"gold",children:t("pages.sessions.history.recent")}),c.isActive&&e.jsx(I,{variant:"dragon",children:t("pages.sessions.history.active")})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.sessions.stats.cost")}),e.jsx("p",{className:"font-bold text-lg text-dragon-accent",children:b(c.totalCost||0,d)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.sessions.stats.tokens")}),e.jsx("p",{className:"font-semibold",children:M(c.totalTokens||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.sessions.stats.duration")}),e.jsxs("p",{className:"font-semibold flex items-center space-x-1",children:[e.jsx(V,{className:"h-3 w-3"}),e.jsx("span",{children:c.duration?`${Math.floor(c.duration/60)}h ${c.duration%60}m${c.duration>=300?` (${t("pages.sessions.stats.fiveHourMax")})`:""}`:"N/A"})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.sessions.stats.conversations")}),e.jsxs("p",{className:"font-semibold flex items-center space-x-1",children:[e.jsx(bt,{className:"h-3 w-3"}),e.jsx("span",{children:c.conversations||0})]})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[t("pages.sessions.history.started"),": ",c.startTime?qe(c.startTime):t("pages.sessions.history.unknown")]}),e.jsx("span",{className:"mx-4",children:c.models&&c.models.length>0&&e.jsxs("span",{children:[c.models.length," ",t("pages.sessions.history.models")," (",c.models.join(", "),")"]})}),e.jsx("span",{children:c.endTime?`${t("pages.sessions.history.ended")}: ${qe(c.endTime)}`:c.isActive?t("pages.sessions.history.activeNow"):t("pages.sessions.history.noEndTime")})]})})]})},c.sessionId||c.id||x)})})]})]})}function Ka(){const{data:s,isLoading:r}=Ea(),{formatDate:a}=hs(),{t}=te();if(r)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:t("pages.monthlyUsage.loadingMonthlyData")})});if(!s||!s.monthlyData||s.monthlyData.length===0)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(fe,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-muted-foreground",children:t("pages.monthlyUsage.noMonthlyData")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t("pages.monthlyUsage.monthlyDataWillAppear")})]});const{monthlyData:o,currency:n,totalMonths:i,totalCost:d,averageMonthlySpend:u,highestSpendingMonth:c,mostActiveMonth:x,monthlyGrowth:p,projectedYearlySpend:l,quarterlyProjection:C,currentRunRate:j}=s;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:t("pages.monthlyUsage.title")}),e.jsxs("p",{className:"text-muted-foreground",children:[t("pages.monthlyUsage.description")," (",n,")"]})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(fe,{className:"h-4 w-4"}),e.jsxs("span",{children:[i," ",t("pages.monthlyUsage.stats.monthsTracked")]})]}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Se,{className:"h-4 w-4"}),e.jsx("span",{className:"text-muted-foreground",children:t("pages.monthlyUsage.stats.budgetTracking")})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(fe,{className:"h-5 w-5 text-dragon-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("pages.monthlyUsage.stats.currentMonth")}),e.jsx("div",{className:"flex items-baseline space-x-2",children:e.jsx("p",{className:"text-2xl font-bold",children:b(s.currentMonthCost||0,n)})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t("pages.monthlyUsage.stats.thisMonth")})]})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Se,{className:"h-5 w-5 text-dragon-secondary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("pages.monthlyUsage.stats.monthlyAverage")}),e.jsx("p",{className:"text-2xl font-bold",children:b(u||0,n)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t("pages.monthlyUsage.stats.perMonth")})]})]})})}),e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(_e,{className:"h-5 w-5 text-white"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-white/80",children:t("pages.monthlyUsage.stats.totalCost")}),e.jsx("p",{className:"text-2xl font-bold text-white",children:b(d||0,n)}),e.jsx("p",{className:"text-xs text-white/80 mt-1",children:t("pages.monthlyUsage.stats.allMonths")})]})]})})}),e.jsx(y,{variant:"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ys,{className:"h-5 w-5 text-dragon-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:t("pages.monthlyUsage.stats.projectedYearly")}),e.jsx("p",{className:"text-2xl font-bold",children:b(l||0,n)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t("pages.monthlyUsage.stats.basedOnAverage")})]})]})})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("pages.monthlyUsage.breakdown.title")}),e.jsx("div",{className:"space-y-3",children:o==null?void 0:o.map(m=>{const h=m.billing_period_label||a(m.date+"-01",{month:"long",year:"numeric",day:void 0}),f=m.isCurrentMonth||m.isCurrent;return e.jsx(y,{variant:f?"scales":"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-lg bg-gradient-to-br from-dragon-primary to-dragon-secondary flex items-center justify-center",children:e.jsx(fe,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-semibold text-lg",children:h}),f&&e.jsx(I,{variant:"emerald",className:"text-xs",children:t("pages.monthlyUsage.breakdown.current")})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[m.totalDays||m.active_days||0," ",t("pages.monthlyUsage.breakdown.days")," • ",m.totalSessions||m.session_count||0," ",t("pages.monthlyUsage.breakdown.sessions")]})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"font-bold text-xl text-dragon-accent",children:b(m.totalCost||m.total_cost||0,n)}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[b(m.dailyAverage||m.avgCostPerDay||0,n),"/",t("pages.monthlyUsage.breakdown.dayAvg")]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.monthlyUsage.breakdown.totalTokens")}),e.jsx("p",{className:"font-semibold",children:M(m.totalTokens||m.total_tokens||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.monthlyUsage.breakdown.activeDays")}),e.jsxs("p",{className:"font-semibold",children:[m.activeDays||m.active_days||0," / ",m.totalDays||m.active_days||0]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.monthlyUsage.breakdown.avgSessionCost")}),e.jsx("p",{className:"font-semibold",children:b(m.avgSessionCost||m.avgCostPerSession||0,n)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground mb-1",children:t("pages.monthlyUsage.breakdown.tokensPerSession")}),e.jsx("p",{className:"font-semibold",children:M(m.tokensPerSession||(m.totalTokens||m.total_tokens||0)/(m.totalSessions||m.session_count||1)||0)})]})]}),e.jsx("div",{className:"mt-4 pt-4 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[t("pages.monthlyUsage.breakdown.costPer1MTokens"),": ",m.costPer1MTokens?b(m.costPer1MTokens,n):"N/A"]}),e.jsxs("span",{children:[t("pages.monthlyUsage.breakdown.vsAvg"),": ",m.isFirstMonth?t("pages.monthlyUsage.breakdown.firstMonth"):m.vsAveragePercent!==void 0&&m.vsAveragePercent!==null&&m.vsAveragePercent!==0?`${m.vsAveragePercent>0?"+":""}${m.vsAveragePercent.toFixed(1)}%`:t("pages.monthlyUsage.breakdown.sameAsAvg")]})]})})]})},m.date||m.month||m.billing_period_key)})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("pages.monthlyUsage.trends.title")}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-white/80",children:t("pages.monthlyUsage.trends.highestSpending")}),e.jsx("h3",{className:"text-xl font-bold text-white",children:b((c==null?void 0:c.totalCost)||0,n)}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-white/70",children:e.jsx("span",{children:(c==null?void 0:c.monthName)||t("pages.monthlyUsage.trends.noData")})})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-primary",children:t("pages.monthlyUsage.trends.mostActive")}),e.jsxs("h3",{className:"text-xl font-bold",children:[(x==null?void 0:x.totalSessions)||0," ",t("pages.monthlyUsage.trends.sessions")]}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsx("span",{children:(x==null?void 0:x.monthName)||t("pages.monthlyUsage.trends.noData")})})]})})}),e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-secondary",children:t("pages.monthlyUsage.trends.growthTrend")}),e.jsxs("div",{className:"flex items-baseline space-x-2",children:[p!=null&&i>1?e.jsxs("h3",{className:`text-xl font-bold ${p>=0?"text-green-500":"text-red-500"}`,children:[p>=0?"+":"",p.toFixed(1),"%"]}):e.jsx("h3",{className:"text-xl font-bold text-muted-foreground",children:t("pages.monthlyUsage.trends.firstMonth")}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.monthlyUsage.trends.mom")})]}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsx("span",{children:p!=null&&i>1?`${p>0?t("pages.monthlyUsage.trends.increasing"):p<0?t("pages.monthlyUsage.trends.decreasing"):t("pages.monthlyUsage.trends.stable")} ${t("pages.monthlyUsage.trends.usage")}`:t("pages.monthlyUsage.trends.noPreviousData")})})]})})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t("pages.monthlyUsage.budget.title")}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-primary",children:t("pages.monthlyUsage.budget.monthlyAverage")}),e.jsx("h3",{className:"text-xl font-bold",children:b(u||0,n)}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsx("span",{children:t("pages.monthlyUsage.budget.perMonth")})})]})})}),e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-secondary",children:t("pages.monthlyUsage.budget.quarterly")}),e.jsx("h3",{className:"text-xl font-bold",children:b(C||0,n)}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsx("span",{children:t("pages.monthlyUsage.budget.next3Months")})})]})})}),e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-white/80",children:t("pages.monthlyUsage.budget.yearly")}),e.jsx("h3",{className:"text-xl font-bold text-white",children:b(l||0,n)}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-white/70",children:e.jsx("span",{children:t("pages.monthlyUsage.budget.twelveMonths")})})]})})}),e.jsx(y,{variant:"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-muted-foreground",children:t("pages.monthlyUsage.budget.runRate")}),e.jsx("h3",{className:"text-xl font-bold",children:b(j||0,n)}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsx("span",{children:t("pages.monthlyUsage.budget.perYear")})})]})})})]})]})]})}function qa(){var h,f,v,U,A;const{data:s,isLoading:r}=za(),{currency:a}=O(),{data:t}=ds(),{formatDate:o}=hs(),{t:n}=te();if(r)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:n("pages.dailyUsage.loadingDailyData")})});if(!s)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(V,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-muted-foreground",children:n("pages.dailyUsage.noDailyData")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:n("pages.dailyUsage.dailyDataWillAppear")})]});const{dailyData:i,currency:d,todayData:u,yesterdayData:c,totalDays:x,activeDays:p,totalCost:l,averageDailyCost:C,totalSessions:j,lastSessionData:m}=s||{dailyData:[],currency:a,todayData:null,yesterdayData:null,totalDays:0,activeDays:0,totalCost:0,averageDailyCost:0,totalSessions:0,lastSessionData:null};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:n("pages.dailyUsage.title")}),e.jsxs("p",{className:"text-muted-foreground",children:[n("pages.dailyUsage.description")," (",d,")"]})]}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsxs("span",{children:[x," ",n("pages.dailyUsage.stats.daysTracked")]})]}),e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(_,{className:"h-4 w-4"}),e.jsxs("span",{children:[p," ",n("pages.dailyUsage.stats.activeDays")]})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ae,{className:"h-4 w-4 text-dragon-accent"}),e.jsx("span",{className:"font-semibold",children:n("pages.dailyUsage.today.title")}),e.jsx(I,{variant:"emerald",className:"text-xs",children:n("pages.dailyUsage.today.live")})]}),e.jsx("span",{className:"text-xl font-bold text-dragon-accent",children:b((u==null?void 0:u.totalCost)||0,d)})]}),u?e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.today.tokens")}),e.jsx("p",{className:"font-semibold",children:M(u.totalTokens||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.today.sessions")}),e.jsx("p",{className:"font-semibold",children:u.sessionCount||0})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.today.models")}),e.jsx("p",{className:"font-semibold",children:u.modelCount||((h=u.models)==null?void 0:h.length)||0})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:n("pages.dailyUsage.today.noUsageYet")})]})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Oe,{className:"h-4 w-4 text-dragon-primary"}),e.jsx("span",{className:"font-semibold",children:n(c?"pages.dailyUsage.yesterday.title":"pages.dailyUsage.yesterday.lastActive")})]}),e.jsx("span",{className:"text-xl font-bold",children:b(((f=c||m)==null?void 0:f.totalCost)||0,d)})]}),c||m?e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.yesterday.tokens")}),e.jsx("p",{className:"font-semibold",children:M((c||m).totalTokens||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.yesterday.sessions")}),e.jsx("p",{className:"font-semibold",children:c?c.sessionCount:m?1:0})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("pages.dailyUsage.yesterday.models")}),e.jsx("p",{className:"font-semibold",children:c?c.modelCount||((v=c.models)==null?void 0:v.length)||0:(m==null?void 0:m.modelCount)||((U=m==null?void 0:m.models)==null?void 0:U.length)||0})]})]}):e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:n("pages.dailyUsage.yesterday.noPreviousData")})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:n("pages.dailyUsage.summary.title")}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-white/80",children:n("pages.dailyUsage.summary.totalCost")}),e.jsx("h3",{className:"text-xl font-bold text-white",children:b(l||0,d)}),e.jsxs("div",{className:"flex items-center space-x-3 text-sm text-white/70",children:[e.jsxs("span",{children:[j||0," ",n("pages.dailyUsage.summary.sessions")]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:n("pages.dailyUsage.summary.last7Days")})]})]})})}),e.jsx(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-primary",children:n("pages.dailyUsage.summary.dailyAverage")}),e.jsx("h3",{className:"text-xl font-bold",children:b(C||0,d)}),e.jsxs("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:[e.jsx("span",{children:n("pages.dailyUsage.summary.perActiveDay")}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[p||0," ",n("pages.dailyUsage.summary.active")]})]})]})})}),e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm text-dragon-secondary",children:n("pages.dailyUsage.summary.activityRate")}),e.jsxs("div",{className:"flex items-baseline space-x-2",children:[e.jsxs("h3",{className:"text-xl font-bold",children:[x>0?Math.round(p/x*100):0,"%"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n("pages.dailyUsage.summary.active")})]}),e.jsx("div",{className:"flex items-center space-x-3 text-sm text-muted-foreground",children:e.jsxs("span",{children:[p," / ",x," ",n("pages.dailyUsage.summary.days")]})})]})})})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold",children:n("pages.dailyUsage.history.title")}),e.jsxs(I,{variant:"dragon",children:[n("pages.dailyUsage.history.last")," ",Math.min(30,(i==null?void 0:i.length)||0)," ",n("pages.dailyUsage.history.days")]})]}),e.jsx("div",{className:"space-y-2",children:(A=i==null?void 0:i.sort((T,F)=>new Date(F.date).getTime()-new Date(T.date).getTime()))==null?void 0:A.map(T=>{const F=(T.totalCost||0)>0,H=T.isToday,G=T.isYesterday,W=T.isRecent;return e.jsx(y,{variant:H?"flame":W?"scales":"default",className:`transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20 ${F?"":"opacity-60"}`,children:e.jsxs(w,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-dragon-primary to-dragon-secondary flex items-center justify-center",children:H?e.jsx(Ae,{className:"h-4 w-4 text-white"}):e.jsx(V,{className:"h-4 w-4 text-white"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-semibold",children:o(T.date)}),H&&e.jsx(I,{variant:"emerald",className:"text-xs",children:n("pages.dailyUsage.history.today")}),G&&e.jsx(I,{variant:"scale",className:"text-xs",children:n("pages.dailyUsage.history.yesterday")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:H&&(t!=null&&t.sessionActive)?n("pages.dailyUsage.history.activeNow"):de(T.date)})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:`font-bold text-lg ${F?"text-dragon-accent":"text-muted-foreground"}`,children:b(T.totalCost||0,d)}),F&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[M(T.totalTokens||0)," ",n("pages.dailyUsage.history.tokens")]})]})]}),F&&e.jsx("div",{className:"mt-3 pt-3 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[T.sessionCount||T.sessions||0," ",n("pages.dailyUsage.history.sessions")]}),e.jsx("span",{className:"mx-4",children:T.models&&T.models.length>0?e.jsxs("span",{children:[T.models.length," ",n("pages.dailyUsage.history.models")," (",T.models.join(", "),")"]}):e.jsx("span",{children:n("pages.dailyUsage.history.noModels")})}),e.jsx("span",{children:T.costPer1KTokens!==null&&T.costPer1KTokens!==void 0?`$${T.costPer1KTokens.toFixed(6)}/1K`:"N/A"})]})})]})},T.date)})})]})]})}function Ja(){const{data:s,isLoading:r,refresh:a}=ds(),{t}=te();if(r)return e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx(se,{size:"lg",text:t("pages.activeSession.loadingActiveSession")})});if(!s)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ie,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"text-muted-foreground",children:t("pages.activeSession.noActiveSessionData")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:t("pages.activeSession.sessionDataWillAppear")})]});const{sessionActive:o,currentCost:n,timeLeft:i,duration:d,sessionId:u,status:c,lastActivity:x,currency:p}=s,l=d&&i?d/(d+i)*100:0,C=300,j=d>0?Math.round((s.currentTokens||0)/d):0,m=j>0?Math.round(j*C):0,h=(s.currentTokens||0)>0?(n||0)/(s.currentTokens||0):0,f=h>0?m*h:0,U=Math.min(100,j/15e4*100),A=Math.min(100,m>0?(s.currentTokens||0)/m*100:0);return console.log(`[DEBUG] Progress Values: Session=${l.toFixed(1)}%, Usage=${U.toFixed(1)}%, Projection=${A.toFixed(1)}%`),console.log(`[DEBUG] Projection Debug: Current=${M(s.currentTokens||0)} tokens, Cost=${b(n||0,p)}, Rate=${h.toFixed(6)}/token, Projected=${M(m)} tokens, Cost=${b(f,p)}`),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:t("pages.activeSession.title")}),e.jsxs("p",{className:"text-muted-foreground",children:[t("pages.activeSession.description")," (",p,")"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:a,className:"flex items-center space-x-2",children:[e.jsx(q,{className:"h-4 w-4"}),e.jsx("span",{children:t("pages.activeSession.refresh")})]}),e.jsxs(I,{variant:o?"dragon":"default",className:"flex items-center space-x-1",children:[o?e.jsx(yt,{className:"h-3 w-3"}):e.jsx(ws,{className:"h-3 w-3"}),e.jsx("span",{children:t(o?"pages.activeSession.status.active":"pages.activeSession.status.idle")})]})]})]}),o&&e.jsx(y,{variant:"flame",className:"mb-6 transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsx(V,{className:"h-5 w-5"}),e.jsx("span",{children:t("pages.activeSession.progress.session")})]}),e.jsxs("span",{className:"text-white/80 font-mono",children:[l.toFixed(1),"%"]})]}),e.jsx(ye,{value:l,className:"h-3 mb-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-white/80",children:[e.jsxs("span",{children:[t("pages.activeSession.progress.started"),": ",x?new Date(x).toLocaleTimeString():t("pages.activeSession.progress.unknown")]}),e.jsxs("span",{children:[t("pages.activeSession.progress.remaining"),": ",i?`${Math.floor(i/60)}h ${i%60}m`:"N/A"]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsx(_,{className:"h-5 w-5"}),e.jsx("span",{children:t("pages.activeSession.progress.usage")})]}),e.jsxs("span",{className:"text-white/80",children:["(",M(s.currentTokens||0)," tokens)"]})]}),e.jsx(ye,{value:U,className:"h-3 mb-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-white/80",children:[e.jsxs("span",{children:[t("pages.activeSession.progress.tokens"),": ",M(s.currentTokens||0)," (",t("pages.activeSession.progress.burnRate"),": ",j," ",t("pages.activeSession.progress.tokenPerMin")," ",j>100?`[${t("pages.activeSession.progress.high")}]`:`[${t("pages.activeSession.progress.normal")}]`,")"]}),e.jsxs("span",{children:[t("pages.activeSession.progress.cost"),": ",b(n||0,p)]})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center space-x-2",children:[e.jsx(Se,{className:"h-5 w-5"}),e.jsx("span",{children:t("pages.activeSession.progress.projection")})]}),e.jsxs("span",{className:"text-white/80",children:["(",M(m)," tokens)"]})]}),e.jsx(ye,{value:A,className:"h-3 mb-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-white/80",children:[e.jsxs("span",{children:[t("pages.activeSession.progress.status"),": ",j>100?`[${t("pages.activeSession.progress.highBurn")}]`:`[${t("pages.activeSession.progress.onTrack")}]`]}),e.jsxs("span",{children:[t("pages.activeSession.progress.tokens"),": ",M(m)," / ",t("pages.activeSession.progress.cost"),": ",b(f,p)]})]})]})]})})}),o?e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(ie,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:t("pages.activeSession.overview.title")})]})}),e.jsx(w,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"text-center p-3 rounded-lg bg-dragon-primary/10",children:[e.jsx(Ce,{className:"h-5 w-5 mx-auto mb-1 text-dragon-primary"}),e.jsx("p",{className:"text-lg font-bold",children:b(n||0,p)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("pages.activeSession.overview.sessionCost")})]}),e.jsxs("div",{className:"text-center p-3 rounded-lg bg-dragon-secondary/10",children:[e.jsx(_,{className:"h-5 w-5 mx-auto mb-1 text-dragon-secondary"}),e.jsx("p",{className:"text-lg font-bold",children:M(s.currentTokens||0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("pages.activeSession.overview.tokensUsed")})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[e.jsx("span",{children:t("pages.activeSession.overview.sessionProgress")}),e.jsxs("span",{children:[l.toFixed(1),"%"]})]}),e.jsx(ye,{value:l,className:"h-2 mb-2"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[d?`${Math.floor(d/60)}h ${d%60}m`:"0m"," ",t("pages.activeSession.overview.used")]}),e.jsxs("span",{children:[i?`${Math.floor(i/60)}h ${i%60}m`:"N/A"," ",t("pages.activeSession.overview.left")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.overview.status")}),e.jsxs(I,{variant:"dragon",className:"text-xs",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"}),c]})]}),u&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.overview.sessionId")}),e.jsxs("span",{className:"font-mono text-xs",children:[u.substring(0,8),"..."]})]}),x&&e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.overview.lastActivity")}),e.jsx("span",{className:"text-sm",children:de(x)})]})]})]})})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(Se,{className:"h-5 w-5 text-dragon-secondary"}),e.jsx("span",{children:t("pages.activeSession.performance.title")})]})}),e.jsx(w,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-muted/20",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm font-medium",children:t("pages.activeSession.performance.tokenBurnRate")}),e.jsx("span",{className:`text-sm font-bold ${j>100?"text-red-500":"text-green-500"}`,children:j>100?`[${t("pages.activeSession.performance.high")}]`:`[${t("pages.activeSession.performance.normal")}]`})]}),e.jsxs("p",{className:"text-lg font-bold font-mono",children:[M(j)," ",t("pages.activeSession.performance.tokensPerMin")]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"font-semibold text-sm",children:[t("pages.activeSession.performance.fullSessionProjection"),":"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.performance.projectedTokens")}),e.jsx("span",{className:"font-medium font-mono",children:M(m)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.performance.projectedCost")}),e.jsx("span",{className:"font-medium text-dragon-accent",children:b(f,p)})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:t("pages.activeSession.performance.costVsCurrent")}),e.jsxs("span",{className:"font-medium",children:["+",b(f-(n||0),p)]})]})]})]}),e.jsx("div",{className:"pt-3 border-t border-border/50",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:t("pages.activeSession.performance.sessionPerformance")}),e.jsx(I,{variant:j>100?"destructive":"dragon",className:"text-xs",children:j>100?t("pages.activeSession.performance.highIntensity"):t("pages.activeSession.performance.normalUsage")})]})})]})})]})]}):e.jsx(y,{variant:"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsxs(w,{className:"text-center py-12",children:[e.jsx(ws,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground opacity-50"}),e.jsx("p",{className:"font-medium text-muted-foreground",children:t("pages.activeSession.noSession.title")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:t("pages.activeSession.noSession.description")})]})}),e.jsx(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:e.jsx(w,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx(ie,{className:"h-4 w-4 text-dragon-primary"}),e.jsx("span",{children:t("pages.activeSession.realTime.updates")})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[t("pages.activeSession.realTime.lastUpdated"),": ",x?de(x):t("pages.activeSession.realTime.never")]})]})})})]})}const Xa=s=>{const r=new Date,a=r.getDate();let t=new Date(r.getFullYear(),r.getMonth(),s);a<s&&(t=new Date(r.getFullYear(),r.getMonth()-1,s));let o=new Date(t.getFullYear(),t.getMonth()+1,s);o.getDate()!==s&&(o=new Date(o.getFullYear(),o.getMonth()+1,0));const n=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return`${n(t)} - ${n(new Date(o.getTime()-1))}`};function Za(){var gs,xs,us,ps,fs,vs,js,bs,ys;const{settings:s,updateSettings:r,refreshCoreData:a,refreshDatabase:t,cleanupDatabase:o,isLoadingDatabase:n,databaseProgress:i,lastRefresh:d,currency:u,changeCurrency:c,exportData:x,updateSshConfig:p}=O(),{t:l}=te(),[C,j]=N.useState(""),[m,h]=N.useState({standard:[],custom:[],active:[]}),[f,v]=N.useState(new Date),[U,A]=N.useState(null),[T,F]=N.useState(!1),[H,G]=N.useState(!1);N.useEffect(()=>{const g=setInterval(()=>{v(new Date)},1e3);return()=>clearInterval(g)},[]),N.useEffect(()=>{const g=be.getCurrencyRate(u);A(g)},[u]),N.useEffect(()=>{(async()=>{try{const D=await window.claudeMaxAPI.getClaudePaths();console.log("[PATHS] Loaded Claude paths:",D),h({standard:(D==null?void 0:D.standard)||[],custom:(D==null?void 0:D.custom)||[],active:(D==null?void 0:D.active)||[]})}catch(D){console.error("Failed to load Claude paths:",D),h({standard:[],custom:[],active:[]})}})()},[s.claudePaths]);const W=async g=>{try{if(g==="csv"){const D=await x("daily","csv"),ve=new Blob([D],{type:"text/csv"}),Ns=URL.createObjectURL(ve),Re=document.createElement("a");Re.href=Ns,Re.download=`dragon-ui-daily-usage-${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(Re),Re.click(),document.body.removeChild(Re),URL.revokeObjectURL(Ns)}else{const D=await x("all","json");ha(JSON.parse(D),`dragon-ui-export-${new Date().toISOString().split("T")[0]}.json`)}}catch(D){console.error("Export failed:",D),alert(l("pages.settings.dataExport.exportFailed"))}},me=async()=>{await a()},z=()=>{r({autoRefresh:!s.autoRefresh})},R=g=>{r({refreshInterval:g})},B=()=>{r({compactMode:!s.compactMode})},J=()=>{r({showAnimations:!s.showAnimations})},he=()=>{r({dragonEffects:!s.dragonEffects})},X=async()=>{const g=!s.devToolsEnabled;r({devToolsEnabled:g}),window.electronAPI&&(g?await window.electronAPI.openDevTools():await window.electronAPI.closeDevTools())},ge=()=>{r({autoUpdateNotifications:!s.autoUpdateNotifications})},Z=g=>{r({timeFormat:g})},K=g=>{r({timezone:g})},Fe=async g=>{try{await c(g),console.log("[CURRENCY] Currency changed successfully to:",g)}catch(D){console.warn("[CURRENCY] Failed to change currency:",D),alert(l("pages.settings.advanced.currency.changeFailed"))}},Y=async()=>{if(C.trim())try{if(await window.claudeMaxAPI.addCustomPath(C.trim())){j("");const D=await window.claudeMaxAPI.getClaudePaths();r({claudePaths:{standardPaths:D.standard,customPaths:D.custom,activePaths:D.active}}),h(D)}else alert(l("pages.settings.claudeProjects.customPaths.failedToAdd"))}catch(g){console.error("Error adding custom path:",g),alert("Failed to add path. Please check if the directory exists.")}},nt=async g=>{try{if(await window.claudeMaxAPI.removeCustomPath(g)){const ve=await window.claudeMaxAPI.getClaudePaths();r({claudePaths:{standardPaths:ve.standard,customPaths:ve.custom,activePaths:ve.active}}),h(ve)}}catch(D){console.error("Error removing custom path:",D)}},ot=async()=>{try{const g=await window.claudeMaxAPI.refreshPaths();r({claudePaths:{standardPaths:g.standard,customPaths:g.custom,activePaths:g.active}}),h(g),console.log("[REFRESH] Paths refreshed:",g)}catch(g){console.error("Error refreshing paths:",g)}},Pe=g=>{p(g)},it=async()=>{var g;try{if(!s.sshConfig){alert("SSH configuration not available");return}if(console.log("Testing SSH connection:",s.sshConfig),(g=window.electronAPI)!=null&&g.invoke){const D=await window.electronAPI.invoke("ssh-test-connection",s.sshConfig);D.success?alert(`SSH connection test successful!
${D.message}`):alert(`SSH connection test failed!
${D.message}`)}else alert("SSH connection test successful! (Mock response - Electron API not available)")}catch(D){console.error("SSH connection test failed:",D),alert("SSH connection test failed!")}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:l("pages.settings.title")}),e.jsx("p",{className:"text-muted-foreground",children:l("pages.settings.description")})]})}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(Nt,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:l("pages.settings.appearance.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.appearance.theme.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.appearance.theme.description")})]}),e.jsx(ms,{variant:"dragon"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.appearance.compactMode.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.appearance.compactMode.description")})]}),e.jsx(P,{variant:s.compactMode?"dragon":"outline",size:"sm",onClick:B,children:s.compactMode?l("pages.settings.appearance.compactMode.enabled"):l("pages.settings.appearance.compactMode.disabled")})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:`font-semibold ${s.compactMode?"":"text-muted-foreground"}`,children:l("pages.settings.appearance.compactScale.title")}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[l("pages.settings.appearance.compactScale.description"),!s.compactMode&&` ${l("pages.settings.appearance.compactScale.requiresCompactMode")}`]})]}),e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs("div",{className:`relative ${s.compactMode?"":"opacity-50 pointer-events-none"}`,children:[e.jsx("input",{type:"range",min:"50",max:"100",value:s.compactScale,onChange:g=>r({compactScale:parseInt(g.target.value)}),disabled:!s.compactMode,className:"w-24 h-2 rounded-lg appearance-none cursor-pointer compact-slider",style:{background:s.compactMode?`linear-gradient(to right, hsl(var(--dragon-primary)) 0%, hsl(var(--dragon-primary)) ${(s.compactScale-50)/50*100}%, hsl(var(--muted)) ${(s.compactScale-50)/50*100}%, hsl(var(--muted)) 100%)`:"hsl(var(--muted))"}}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsxs("span",{className:`text-xs font-mono px-1 rounded backdrop-blur-sm ${s.compactMode?"text-white bg-dragon-primary/80":"text-muted-foreground bg-muted/80"}`,children:[s.compactScale,"%"]})})]})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.appearance.animations.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.appearance.animations.description")})]}),e.jsx(P,{variant:s.showAnimations?"dragon":"outline",size:"sm",onClick:J,children:s.showAnimations?l("pages.settings.appearance.animations.enabled"):l("pages.settings.appearance.animations.disabled")})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.appearance.dragonEffects.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.appearance.dragonEffects.description")})]}),e.jsx(P,{variant:s.dragonEffects?"dragon":"outline",size:"sm",onClick:he,children:s.dragonEffects?l("pages.settings.appearance.dragonEffects.enabled"):l("pages.settings.appearance.dragonEffects.disabled")})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:"Developer Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable automatic opening of developer tools (F12 always works)"})]}),e.jsx(P,{variant:s.devToolsEnabled?"dragon":"outline",size:"sm",onClick:X,children:s.devToolsEnabled?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:"Auto-Update Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Show popup when new Dragon UI version is available"})]}),e.jsx(P,{variant:s.autoUpdateNotifications?"dragon":"outline",size:"sm",onClick:ge,children:s.autoUpdateNotifications?"Enabled":"Disabled"})]})]})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(fe,{className:"h-5 w-5 text-dragon-accent"}),e.jsx("span",{children:l("pages.settings.billingCycle.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.billingCycle.billingCycleStartDay.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.billingCycle.billingCycleStartDay.description")})]}),e.jsx("div",{className:"flex items-center space-x-2",children:e.jsx("select",{className:"bg-background border border-border rounded px-3 py-2 text-sm",value:s.billingCycleDay||1,onChange:g=>r({billingCycleDay:parseInt(g.target.value)}),children:Array.from({length:31},(g,D)=>D+1).map(g=>e.jsx("option",{value:g,children:g===1?l("pages.settings.billingCycle.options.firstOfMonth"):g===2?l("pages.settings.billingCycle.options.secondOfMonth"):g===3?l("pages.settings.billingCycle.options.thirdOfMonth"):`${g}${l("pages.settings.billingCycle.options.nthOfMonth")}`},g))})})]}),e.jsxs("div",{className:"bg-muted/50 p-4 rounded-lg",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsxs("strong",{children:[l("pages.settings.billingCycle.currentBillingPeriod"),":"]})," ",Xa(s.billingCycleDay||1)]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:l("pages.settings.billingCycle.billingPeriodNote")})]})]})]}),e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(q,{className:"h-5 w-5 text-dragon-secondary"}),e.jsx("span",{children:l("pages.settings.dataRefresh.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.dataRefresh.autoRefresh.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.dataRefresh.autoRefresh.description")})]}),e.jsx(P,{variant:s.autoRefresh?"dragon":"outline",size:"sm",onClick:z,children:s.autoRefresh?l("pages.settings.dataRefresh.autoRefresh.on"):l("pages.settings.dataRefresh.autoRefresh.off")})]}),s.autoRefresh&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-3",children:l("pages.settings.dataRefresh.refreshInterval.title")}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[30,60,120,300,600,900,1800,3600].map(g=>e.jsx(P,{variant:s.refreshInterval===g?"dragon":"outline",size:"sm",onClick:()=>R(g),className:"text-xs",children:g<60?`${g}s`:g<3600?`${g/60}m`:`${g/3600}h`},g))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.dataRefresh.manualRefresh.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.dataRefresh.manualRefresh.description")})]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:me,children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),l("pages.settings.dataRefresh.manualRefresh.refreshNow")]})]}),d&&e.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t border-border/50",children:[l("pages.settings.dataRefresh.lastUpdated"),": ",new Date(d).toLocaleString("en-US",{timeZone:s.timezone==="auto"?void 0:s.timezone,hour12:s.timeFormat==="12h"})]})]})]}),e.jsxs(y,{variant:"default",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(Hs,{className:"h-5 w-5 text-dragon-accent"}),e.jsx("span",{children:l("pages.settings.advanced.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.advanced.timeFormat.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.advanced.timeFormat.description")})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx(P,{variant:s.timeFormat==="12h"?"dragon":"outline",size:"sm",onClick:()=>Z("12h"),children:l("pages.settings.advanced.timeFormat.12hour")}),e.jsx(P,{variant:s.timeFormat==="24h"?"dragon":"outline",size:"sm",onClick:()=>Z("24h"),children:l("pages.settings.advanced.timeFormat.24hour")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.advanced.timezone.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.advanced.timezone.description")})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx(Ye,{className:"h-4 w-4 text-dragon-primary"}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-mono",children:f.toLocaleString("en-US",{timeZone:s.timezone==="auto"?Intl.DateTimeFormat().resolvedOptions().timeZone:s.timezone,hour12:s.timeFormat==="12h",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:s.timeFormat==="12h"?"h12":"h23"})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.timezone==="auto"?Intl.DateTimeFormat().resolvedOptions().timeZone:s.timezone})]})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"auto",label:l("pages.settings.advanced.timezone.auto")},{value:"UTC",label:"UTC"},{value:"America/New_York",label:"EST"},{value:"America/Los_Angeles",label:"PST"},{value:"Europe/London",label:"GMT"},{value:"Europe/Berlin",label:"CET"},{value:"Asia/Tokyo",label:"JST"},{value:"Australia/Sydney",label:"AEST"}].map(g=>e.jsx(P,{variant:s.timezone===g.value?"dragon":"outline",size:"sm",onClick:()=>K(g.value),className:"text-xs",children:g.label},g.value))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.advanced.language.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.advanced.language.description")})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx(Ye,{className:"h-4 w-4 text-dragon-primary"}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-mono",children:((gs=As.find(g=>g.code===(s.language||"en")))==null?void 0:gs.name)||"English"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l("pages.settings.advanced.language.interfaceLanguage")})]})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:As.map(g=>e.jsxs(P,{variant:(s.language||"en")===g.code?"dragon":"outline",size:"sm",onClick:()=>r({language:g.code}),className:"text-xs flex items-center space-x-1",children:[e.jsx("span",{children:g.flag}),e.jsx("span",{children:g.code.toUpperCase()}),e.jsx("span",{className:"hidden md:inline",children:g.name})]},g.code))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.advanced.currency.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.advanced.currency.description")})]}),e.jsxs("div",{className:"flex items-center space-x-2 text-sm",children:[e.jsx(Ce,{className:"h-4 w-4 text-dragon-accent"}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-mono",children:["1 USD = ",U?U.toFixed(4):"1.0000"," ",u]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:((xs=be.getCurrencyInfo(u))==null?void 0:xs.name)||u})]})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:je.map(g=>e.jsxs(P,{variant:u===g.code?"dragon":"outline",size:"sm",onClick:()=>Fe(g.code),className:"text-xs flex items-center space-x-1",children:[e.jsx("span",{children:g.flag}),e.jsx("span",{children:g.code}),e.jsxs("span",{className:"hidden md:inline",children:["(",g.symbol,")"]})]},g.code))})]})]})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(le,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:l("pages.settings.claudeProjects.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.claudeProjects.projectPaths.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l("pages.settings.claudeProjects.projectPaths.description")})]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:ot,children:[e.jsx(wt,{className:"h-4 w-4 mr-2"}),l("pages.settings.claudeProjects.projectPaths.refresh")]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"font-medium text-sm text-dragon-primary",children:l("pages.settings.claudeProjects.standardPaths.title")}),m.standard.length>0?e.jsx("div",{className:"space-y-2",children:m.standard.map((g,D)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(le,{className:"h-4 w-4 text-dragon-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-sm",children:g}),e.jsx("p",{className:"text-xs text-muted-foreground",children:g.includes(".config")?l("pages.settings.claudeProjects.standardPaths.newFormat"):l("pages.settings.claudeProjects.standardPaths.legacyFormat")})]})]}),e.jsx(I,{variant:"dragon",className:"text-xs",children:l("pages.settings.claudeProjects.standardPaths.active")})]},D))}):e.jsxs("div",{className:"p-4 text-center text-muted-foreground bg-muted/30 rounded-lg",children:[e.jsx("p",{className:"text-sm",children:l("pages.settings.claudeProjects.standardPaths.noStandardPaths")}),e.jsx("p",{className:"text-xs mt-1",children:l("pages.settings.claudeProjects.standardPaths.expectedPaths")})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h5",{className:"font-medium text-sm text-dragon-accent",children:l("pages.settings.claudeProjects.customPaths.title")}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("input",{type:"text",value:C,onChange:g=>j(g.target.value),placeholder:l("pages.settings.claudeProjects.customPaths.placeholder"),className:"flex-1 px-3 py-2 bg-background border border-border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-dragon-primary",onKeyDown:g=>g.key==="Enter"&&Y()}),e.jsx(P,{variant:"dragon",size:"sm",onClick:Y,disabled:!C.trim(),children:e.jsx(Ct,{className:"h-4 w-4"})})]}),m.custom.length>0?e.jsx("div",{className:"space-y-2",children:m.custom.map((g,D)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(le,{className:"h-4 w-4 text-dragon-accent"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-sm",children:g}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l("pages.settings.claudeProjects.customPaths.customPath")})]})]}),e.jsx(P,{variant:"outline",size:"sm",onClick:()=>nt(g),className:"text-red-500 hover:text-red-600 hover:border-red-500",children:e.jsx(Le,{className:"h-4 w-4"})})]},D))}):e.jsx("div",{className:"p-3 text-center text-muted-foreground bg-muted/20 rounded-lg",children:e.jsx("p",{className:"text-sm",children:l("pages.settings.claudeProjects.customPaths.noCustomPaths")})})]}),e.jsx("div",{className:"pt-4 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[l("pages.settings.claudeProjects.activePathsSummary.totalActivePaths"),": ",m.active.length]}),e.jsx(I,{variant:"outline",className:"text-xs",children:m.active.length>0?l("pages.settings.claudeProjects.activePathsSummary.monitoring"):l("pages.settings.claudeProjects.activePathsSummary.noPaths")})]})})]})]}),e.jsxs(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(Cs,{className:"h-5 w-5 text-white"}),e.jsx("span",{children:l("pages.settings.sshSupport.title")})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-white",children:l("pages.settings.sshSupport.enable.title")}),e.jsx("p",{className:"text-sm text-white/80",children:l("pages.settings.sshSupport.enable.description")})]}),e.jsx(P,{variant:(us=s.sshConfig)!=null&&us.enabled?"dragon":"outline",size:"sm",onClick:()=>{var g;return Pe({enabled:!((g=s.sshConfig)!=null&&g.enabled)})},children:(ps=s.sshConfig)!=null&&ps.enabled?l("pages.settings.sshSupport.enable.enabled"):l("pages.settings.sshSupport.enable.disabled")})]}),((fs=s.sshConfig)==null?void 0:fs.enabled)&&e.jsxs("div",{className:"space-y-4 pt-4 border-t border-white/20",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[e.jsx(Ss,{className:"h-4 w-4 inline mr-1"}),l("pages.settings.sshSupport.config.host")]}),e.jsx("input",{type:"text",value:((vs=s.sshConfig)==null?void 0:vs.host)||"",onChange:g=>Pe({host:g.target.value}),placeholder:l("pages.settings.sshSupport.config.hostPlaceholder"),className:"w-full px-3 py-2 bg-white/10 border border-white/20 rounded-md text-white placeholder:text-white/50 focus:outline-none focus:ring-2 focus:ring-white/30"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[e.jsx(Cs,{className:"h-4 w-4 inline mr-1"}),l("pages.settings.sshSupport.config.port")]}),e.jsx("input",{type:"number",value:((js=s.sshConfig)==null?void 0:js.port)||22,onChange:g=>Pe({port:parseInt(g.target.value)||22}),placeholder:"22",className:"w-full px-3 py-2 bg-white/10 border border-white/20 rounded-md text-white placeholder:text-white/50 focus:outline-none focus:ring-2 focus:ring-white/30"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[e.jsx(St,{className:"h-4 w-4 inline mr-1"}),l("pages.settings.sshSupport.config.username")]}),e.jsx("input",{type:"text",value:((bs=s.sshConfig)==null?void 0:bs.username)||"",onChange:g=>Pe({username:g.target.value}),placeholder:l("pages.settings.sshSupport.config.usernamePlaceholder"),className:"w-full px-3 py-2 bg-white/10 border border-white/20 rounded-md text-white placeholder:text-white/50 focus:outline-none focus:ring-2 focus:ring-white/30"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-white mb-2",children:[e.jsx(Dt,{className:"h-4 w-4 inline mr-1"}),l("pages.settings.sshSupport.config.password")]}),e.jsx("input",{type:"password",value:((ys=s.sshConfig)==null?void 0:ys.password)||"",onChange:g=>Pe({password:g.target.value}),placeholder:"••••••••",className:"w-full px-3 py-2 bg-white/10 border border-white/20 rounded-md text-white placeholder:text-white/50 focus:outline-none focus:ring-2 focus:ring-white/30"})]})]}),e.jsx("div",{className:"flex space-x-3 pt-2",children:e.jsxs(P,{variant:"outline",size:"sm",onClick:it,className:"bg-blue-500/20 border-blue-500/30 text-white hover:bg-blue-500/30",children:[e.jsx(Ss,{className:"h-4 w-4 mr-2"}),l("pages.settings.sshSupport.actions.testConnection")]})}),e.jsx("div",{className:"mt-4 p-3 bg-white/5 border border-white/10 rounded-md",children:e.jsx("p",{className:"text-xs text-white/60",children:l("pages.settings.sshSupport.note")})})]})]})]}),e.jsxs(y,{variant:"flame",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-orange-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(He,{className:"h-5 w-5 text-dragon-flame"}),e.jsx("span",{children:l("pages.settings.database.title","Database Management")})]})}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:l("pages.settings.database.status.title","Database Status")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n?l("pages.settings.database.status.processing","Processing..."):l("pages.settings.database.status.ready","Ready")})]}),e.jsx(I,{variant:n?"outline":"dragon",children:n?l("pages.settings.database.status.busy","Busy"):l("pages.settings.database.status.online","Online")})]}),n&&i&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:i.step}),e.jsxs("span",{children:[i.progress,"%"]})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-dragon-flame h-2 rounded-full transition-all duration-300",style:{width:`${i.progress}%`}})}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:i.message}),i.timeRemaining&&e.jsxs("span",{children:[l("pages.overview.database.timeRemaining","Time remaining"),": ",Math.ceil(i.timeRemaining/1e3),"s"]})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:l("pages.settings.database.cleanup.title","Data Cleanup")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:l("pages.settings.database.cleanup.description","Remove corrupted timestamps and phantom entries")}),e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>F(!0),disabled:n,className:"w-full",children:[n?e.jsx(q,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Le,{className:"h-4 w-4 mr-2"}),l("pages.settings.database.cleanup.action","Clean Database")]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:l("pages.settings.database.refresh.title","Full Refresh")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:l("pages.settings.database.refresh.description","Clear and reload all data from files")}),e.jsxs(P,{variant:"destructive",size:"sm",onClick:()=>G(!0),disabled:n,className:"w-full",children:[n?e.jsx(q,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(q,{className:"h-4 w-4 mr-2"}),l("pages.settings.database.refresh.action","Refresh Database")]})]})]}),e.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-orange-500/10 border border-orange-500/20 rounded-lg",children:[e.jsx(Bs,{className:"h-5 w-5 text-orange-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-orange-800 dark:text-orange-200",children:l("pages.settings.database.warning.title","Warning")}),e.jsx("p",{className:"text-orange-700 dark:text-orange-300",children:l("pages.settings.database.warning.message","Database operations may take time and will temporarily interrupt data collection.")})]})]})]})]}),e.jsxs(y,{variant:"scales",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(pe,{className:"h-5 w-5 text-dragon-secondary"}),e.jsx("span",{children:l("pages.settings.dataExport.title")})]})}),e.jsx(w,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:l("pages.settings.dataExport.exportUsageData.title")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:l("pages.settings.dataExport.exportUsageData.description")}),e.jsxs("div",{className:"flex space-x-3",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>W("csv"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),l("pages.settings.dataExport.exportUsageData.exportCsv")]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>W("json"),children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),l("pages.settings.dataExport.exportUsageData.exportJson")]})]})]})})]}),e.jsxs(y,{variant:"gradient",className:"transition-all duration-300 hover:scale-110 hover:shadow-lg hover:shadow-red-500/20 dragon-flame-border relative z-10 hover:z-20",children:[e.jsx(L,{children:e.jsxs($,{className:"flex items-center space-x-2",children:[e.jsx(kt,{className:"h-5 w-5 text-dragon-primary"}),e.jsx("span",{children:l("pages.settings.about.title")})]})}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:l("pages.settings.about.features.title")}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(_,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.realTimeMonitoring")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(He,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.backgroundServices")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(Pt,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.multiCurrencySupport")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(V,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.ramCaching")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(Ye,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.multiLanguageSupport")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(He,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.databaseManagement")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(pe,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.dataExport")})]}),e.jsxs("li",{className:"flex items-center space-x-2",children:[e.jsx(q,{className:"h-3 w-3"}),e.jsx("span",{children:l("pages.settings.about.features.liveLanguageSwitching")})]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:l("pages.settings.about.technology.title")}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("li",{children:["• ",l("pages.settings.about.technology.electronReact")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.typescript")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.backgroundCollector")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.dragonDesign")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.crossPlatform")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.i18nSystem")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.zustandStore")]}),e.jsxs("li",{children:["• ",l("pages.settings.about.technology.tailwindCSS")]})]})]})]}),e.jsx("div",{className:"pt-4 border-t border-white/10",children:e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Dragon UI v",Ee()]}),e.jsxs("span",{className:"text-muted-foreground",children:[l("pages.settings.about.builtWith")," ",e.jsx("img",{src:"Dragon-Ui (1).svg",alt:"Dragon UI",className:"w-4 h-4 inline mx-1"})," ",l("pages.settings.about.and")," ❤️ ",l("pages.settings.about.by")," KingchenC"]})]})})]})]}),e.jsx(Xe,{open:T,onOpenChange:F,children:e.jsxs(Ze,{children:[e.jsxs(Qe,{children:[e.jsxs(es,{className:"flex items-center space-x-2",children:[e.jsx(Le,{className:"h-5 w-5 text-orange-500"}),e.jsx("span",{children:l("pages.settings.database.cleanup.confirmTitle","Clean Database")})]}),e.jsx(ss,{children:l("pages.settings.database.cleanup.confirmMessage","This will remove corrupted timestamps and phantom entries from the database. This action cannot be undone.")})]}),e.jsxs(ts,{className:"mt-6",children:[e.jsx(P,{variant:"outline",onClick:()=>F(!1),className:"mr-2",children:l("pages.settings.database.cleanup.cancel","Cancel")}),e.jsxs(P,{variant:"destructive",onClick:()=>{o(),F(!1)},className:"bg-orange-500 hover:bg-orange-600",children:[e.jsx(Le,{className:"h-4 w-4 mr-2"}),l("pages.settings.database.cleanup.confirm","Clean Database")]})]})]})}),e.jsx(Xe,{open:H,onOpenChange:G,children:e.jsxs(Ze,{children:[e.jsxs(Qe,{children:[e.jsxs(es,{className:"flex items-center space-x-2",children:[e.jsx(q,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{children:l("pages.settings.database.refresh.confirmTitle","Refresh Database")})]}),e.jsx(ss,{children:l("pages.settings.database.refresh.confirmMessage","This will clear ALL data from the database and reload it from files. This process may take several minutes and cannot be undone.")})]}),e.jsxs(ts,{className:"mt-6",children:[e.jsx(P,{variant:"outline",onClick:()=>G(!1),className:"mr-2",children:l("pages.settings.database.refresh.cancel","Cancel")}),e.jsxs(P,{variant:"destructive",onClick:()=>{t(),G(!1)},children:[e.jsx(q,{className:"h-4 w-4 mr-2"}),l("pages.settings.database.refresh.confirm","Refresh Database")]})]})]})})]})}function Qa(){const{activeTab:s,setActiveTab:r,theme:a,isLoading:t,loadingProgress:o,error:n,setError:i,initializeStore:d,refreshCoreData:u,settings:c,lastRefresh:x,isInitialized:p,isInitializing:l,currentAppVersion:C,latestVersion:j,isVersionOutdated:m,performUpdate:h}=O(),{t:f}=te(),{formatTime:v}=hs(),U=N.useRef(null),A=N.useRef(!1),[T,F]=ce.useState(!1);N.useEffect(()=>{var J,he,X,ge,Z,K;const z=()=>{A.current=!0,console.log("[APP] App minimized - pausing operations")},R=()=>{A.current&&(A.current=!1,console.log("[APP] App restored - resuming operations"),setTimeout(()=>{u()},200))},B=()=>{A.current&&(A.current=!1,console.log("[APP] App focused - ensuring responsiveness"))};return window.electronAPI&&((he=(J=window.electronAPI).onAppMinimized)==null||he.call(J,z),(ge=(X=window.electronAPI).onAppRestored)==null||ge.call(X,R),(K=(Z=window.electronAPI).onAppFocused)==null||K.call(Z,B)),()=>{}},[u]),N.useEffect(()=>{const z=R=>{F(!0)};return window.addEventListener("show-update-popup",z),()=>{window.removeEventListener("show-update-popup",z)}},[]),N.useEffect(()=>()=>{},[]),N.useEffect(()=>{if(U.current){const z=c.compactMode?Math.max(.5,Math.min(1,c.compactScale/100)):1;U.current.style.setProperty("--compact-scale",z.toString())}},[c.compactScale,c.compactMode]),N.useEffect(()=>{c.language&&(console.log("[APP] Settings language changed to:",c.language),cs(c.language))},[c.language]),N.useEffect(()=>{if(!p&&!l){const z=setTimeout(async()=>{console.log("[INIT] Initializing Dragon UI store..."),await d()},100);return()=>clearTimeout(z)}},[d,p,l]);const H=async()=>{await u()},G=()=>{i(null)},W=[{id:"overview",label:f("app.navigation.overview"),icon:_e,color:"text-dragon-primary"},{id:"projects",label:f("app.navigation.projects"),icon:le,color:"text-blue-500"},{id:"sessions",label:f("app.navigation.sessions"),icon:_,color:"text-dragon-accent"},{id:"monthly",label:f("app.navigation.monthly"),icon:fe,color:"text-green-500"},{id:"daily",label:f("app.navigation.daily"),icon:V,color:"text-purple-500"},{id:"active",label:f("app.navigation.active"),icon:ie,color:"text-dragon-secondary"},{id:"settings",label:f("app.navigation.settings"),icon:Hs,color:"text-gray-500"}],me=()=>{if(!x)return"";const z=new Date,R=new Date(x),B=Math.floor((z.getTime()-R.getTime())/6e4);return B<1?f("app.lastUpdate.justNow"):B<60?`${B}${f("app.lastUpdate.minutesAgo")}`:v(R)};return e.jsxs("div",{ref:U,className:`min-h-screen bg-background ${c.showAnimations?"transition-colors duration-300":"no-animations"} ${a} ${c.compactMode?"compact-mode":""} ${c.dragonEffects?"dragon-effects":"no-dragon-effects"} compact-scale`,children:[e.jsx(rt,{visible:t,text:o?`${o.message} (${o.progress.toFixed(1)}%)`:f("app.loading")}),e.jsx("header",{className:"sticky top-0 z-40 w-full border-b bg-background/80 backdrop-blur glass-effect",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center space-x-4",children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-dragon-primary to-dragon-secondary rounded-lg flex items-center justify-center",children:e.jsx("img",{src:"Dragon-Ui (1).svg",alt:"Dragon UI",className:"w-6 h-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h1",{className:"text-2xl font-bold bg-gradient-to-r from-dragon-primary to-dragon-secondary bg-clip-text text-transparent",children:"Dragon UI"}),e.jsxs(I,{variant:m?"destructive":"dragon",className:`text-xs ${m?"animate-pulse":""}`,children:["v",C||Ee()]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:f("app.subtitle")})]})]})}),e.jsxs("div",{className:"flex items-center space-x-4",children:[m&&j&&e.jsxs(P,{variant:"destructive",size:"sm",onClick:()=>F(!0),className:"flex items-center space-x-2 animate-pulse hover:animate-none dragon-breathing",children:[e.jsx(pe,{className:"h-4 w-4"}),e.jsxs("span",{children:["Update to v",j]})]}),x&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[f("app.updated")," ",me()]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:H,disabled:t,className:"flex items-center space-x-2",children:[e.jsx(q,{className:`h-4 w-4 ${t?"animate-spin":""}`}),e.jsx("span",{children:f("app.refresh")})]}),e.jsx(ms,{variant:"dragon"})]})]})})}),n&&e.jsx("div",{className:"bg-destructive/10 border-b border-destructive/20",children:e.jsx("div",{className:"container mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Rt,{className:"h-4 w-4 text-destructive"}),e.jsx("span",{className:"text-sm text-destructive",children:n})]}),e.jsx(P,{variant:"ghost",size:"sm",onClick:G,className:"text-destructive hover:text-destructive/80",children:f("app.dismiss")})]})})}),e.jsx("main",{className:"container mx-auto px-4 py-6",children:e.jsxs(ga,{value:s,onValueChange:r,className:"space-y-6",children:[e.jsx(Qs,{className:"grid w-full grid-cols-7 lg:w-auto lg:inline-flex dragon-scales glass-effect",children:W.map(z=>{const R=z.icon,B=s===z.id;return e.jsxs(et,{value:z.id,className:`flex items-center space-x-2 data-[state=active]:bg-gradient-to-r data-[state=active]:from-dragon-primary data-[state=active]:to-dragon-secondary data-[state=active]:text-white ${c.showAnimations?"transition-all duration-300":""}`,children:[e.jsx(R,{className:`h-4 w-4 ${B?"text-white":z.color}`}),e.jsx("span",{className:"hidden sm:inline",children:z.label})]},z.id)})}),e.jsxs("div",{className:"min-h-[600px]",children:[e.jsx(ne,{value:"overview",className:"space-y-6",children:e.jsx(Ga,{})}),e.jsx(ne,{value:"projects",className:"space-y-6",children:e.jsx(Va,{})}),e.jsx(ne,{value:"sessions",className:"space-y-6",children:e.jsx(Wa,{})}),e.jsx(ne,{value:"monthly",className:"space-y-6",children:e.jsx(Ka,{})}),e.jsx(ne,{value:"daily",className:"space-y-6",children:e.jsx(qa,{})}),e.jsx(ne,{value:"active",className:"space-y-6",children:e.jsx(Ja,{})}),e.jsx(ne,{value:"settings",className:"space-y-6",children:e.jsx(Za,{})})]})]})}),e.jsx("footer",{className:"border-t bg-background/50",children:e.jsx("div",{className:"container mx-auto px-4 py-6",children:e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("span",{children:[e.jsx("img",{src:"Dragon-Ui (1).svg",alt:"Dragon UI",className:"w-4 h-4 inline mr-1"}),"Dragon UI v",Ee()]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[f("app.footer.builtWith")," ",e.jsx("img",{src:"Dragon-Ui (1).svg",alt:"Dragon UI",className:"w-4 h-4 inline mx-1"})," ",f("app.footer.and")," ❤️ ",f("app.footer.by")," KingchenC"]})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx("span",{children:f("app.footer.features")})})]})})}),e.jsx(La,{isOpen:T,onClose:()=>F(!1),currentVersion:C||Ee(),latestVersion:j||"unknown",onUpdate:h})]})}We.createRoot(document.getElementById("root")).render(e.jsx(Qa,{}));