@juejin-opensource/jusage 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var cw=Object.defineProperty;var fw=(e,t,r)=>t in e?cw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ea=(e,t,r)=>fw(e,typeof t!="symbol"?t+"":t,r);import{t as dw,bc as Hf,bd as hw,R as pw,j as g,b4 as Nn,be as vw,r as h,a9 as Ei,bf as mw,bb as gw,bg as yw,D as Ma,bh as Gf,bi as qf,bj as bw,bk as xw,B as Sr,bl as ww,k as Ie,d as Pw,bm as kw,m as bm,bn as Ow,bo as jw,T as Fe,P as xr,bp as Aw,a$ as _i,f as oe,bq as Pn,g as at,br as Sw,bs as Ew,bt as _w,bu as Z,bv as Tw,bw as Cw,bx as Mw,by as Iw,M as He,bz as wr,u as Nw,bA as Dw,bB as $w,bC as Rw,bD as Lw,S as Uw}from"./index-CWecC3aA.js";import{a as zw,T as En,C as Ia,S as ta,i as Bw}from"./env-C1SSlRgu.js";import{a as Dt,L as xm,b as kn,S as xt}from"./index-C0e96pRE.js";import{P as ra,C as Fw,a as Ww}from"./ChevronDown-BMySI3-K.js";const Kw=dw({defaultVariants:{variant:"default"},slots:{base:"card",content:"card__content",description:"card__description",footer:"card__footer",header:"card__header",title:"card__title"},variants:{variant:{default:{base:"card--default"},secondary:{base:"card--secondary"},tertiary:{base:"card--tertiary"},transparent:{base:"card--transparent"}}}}),Yf=Object.assign(Hf,{Root:Hf,Separator:hw}),Dn=h.createContext({}),Vf=({children:e,className:t,variant:r="default",...n})=>{const i=pw.useMemo(()=>Kw({variant:r}),[r]),a=g.jsx(Nn.div,{className:i.base({className:t}),"data-slot":"card",...n,children:e});return g.jsx(Dn,{value:{slots:i},children:r==="transparent"?a:g.jsx(vw,{value:{variant:r},children:a})})},Hw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.header,e),"data-slot":"card-header",...t})},Gw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.h3,{className:Ei(n==null?void 0:n.title,t),"data-slot":"card-title",...r,children:e})},qw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.p,{className:Ei(n==null?void 0:n.description,t),"data-slot":"card-description",...r,children:e})},Yw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.content,e),"data-slot":"card-content",...t})},Vw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.footer,e),"data-slot":"card-footer",...t})},q=Object.assign(Vf,{Root:Vf,Header:Hw,Title:Gw,Description:qw,Content:Yw,Footer:Vw}),Xw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 0 0-6.445 5.649.75.75 0 1 0 1.488.194A5.001 5.001 0 0 1 11.57 4.5h-1.32a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 .75-.75v-3a.75.75 0 0 0-1.5 0v1.06A6.48 6.48 0 0 0 8 1.5m-5.25 13a.75.75 0 0 1-.75-.75v-3a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5H4.43a5.001 5.001 0 0 0 8.528-2.843.75.75 0 1 1 1.487.194A6.501 6.501 0 0 1 3.5 12.691v1.059a.75.75 0 0 1-.75.75",clipRule:"evenodd"})),Zw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14M6.44 4.54c.43-.354.994-.565 1.56-.565 1.217 0 2.34.82 2.34 2.14 0 .377-.078.745-.298 1.1-.208.339-.513.614-.875.867-.217.153-.325.257-.379.328-.038.052-.038.07-.038.089a.75.75 0 0 1-1.5 0c0-.794.544-1.286 1.057-1.645.28-.196.4-.332.458-.426a.54.54 0 0 0 .075-.312c0-.3-.244-.641-.84-.641a1 1 0 0 0-.608.223c-.167.138-.231.287-.231.418a.75.75 0 0 1-1.5 0c0-.674.345-1.22.78-1.577M8 12a1 1 0 1 0 0-2 1 1 0 0 0 0 2",clipRule:"evenodd"})),Jw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m6.44 4.06.439.44H12.5A1.5 1.5 0 0 1 14 6v5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11V4.5A1.5 1.5 0 0 1 3.5 3h1.257a1.5 1.5 0 0 1 1.061.44zM.5 4.5a3 3 0 0 1 3-3h1.257a3 3 0 0 1 2.122.879L7.5 3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3zm4.25 2a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z",clipRule:"evenodd"})),Qw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M14 4a3 3 0 1 0-5.895.79L6.15 5.908a3 3 0 1 0 0 4.185l1.955 1.117A3.003 3.003 0 0 0 11 15a3 3 0 1 0-2.15-5.092L6.895 8.79a3 3 0 0 0 0-1.58L8.85 6.092A3 3 0 0 0 14 4m-3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M2.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0",clipRule:"evenodd"})),wm=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06",clipRule:"evenodd"})),e1="inline-flex h-7 shrink-0 items-center gap-1 rounded-full bg-[#1e80ff] px-2.5 text-[12px] font-medium text-white outline-none transition-colors hover:bg-[#1171ee] focus-visible:ring-2 focus-visible:ring-[#1e80ff]/40 disabled:pointer-events-none disabled:opacity-40 dark:bg-[#4b9cff] dark:hover:bg-[#3a8ff0]",Xf="https://juejin.cn/aiusage/rank";function t1(){const e=window.open(Xf,"_blank");if(e){e.opener=null;return}window.location.assign(Xf)}function r1({className:e}){return g.jsx("svg",{"aria-hidden":"true",className:e,fill:"currentColor",role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"m12 14.316 7.454-5.88-2.022-1.625L12 11.1l-.004.003-5.432-4.288-2.02 1.624 7.452 5.88Zm0-7.247 2.89-2.298L12 2.453l-.004-.005-2.884 2.318 2.884 2.3Zm0 11.266-.005.002-9.975-7.87L0 12.088l.194.156 11.803 9.308 7.463-5.885L24 12.085l-2.023-1.624Z",transform:"translate(2.4 2.4) scale(.8)"})})}function n1(){mw();const e=bm(),t=gw(),[r,n]=h.useState(!1),[i,a]=h.useState(null),[o,s]=h.useState(!1),l="同步数据";t==null||t.hasUserData;const u=h.useCallback(()=>{(async()=>{try{const f=await yw();a(!!f.juejin.userId)}catch{a(null)}})()},[e]);h.useEffect(()=>{u();const f=()=>u(),d=p=>{const m=p.detail;m!=null&&m.loginSuccess&&a(!0),u()};return window.addEventListener("focus",f),window.addEventListener(Ma,f),window.addEventListener(Gf,d),window.addEventListener(qf,f),()=>{window.removeEventListener("focus",f),window.removeEventListener(Ma,f),window.removeEventListener(Gf,d),window.removeEventListener(qf,f)}},[e,u]);const c=async()=>{var f;n(!0);try{e&&(await Ow(),typeof((f=window.tud)==null?void 0:f.onDataSynced)!="function"&&jw())}finally{n(!1)}};return g.jsxs("div",{className:"flex items-center gap-1",children:[i===!1?g.jsxs("button",{className:e1,onClick:()=>s(!0),type:"button",children:[g.jsx(r1,{className:"size-3.5"}),"关联掘金"]}):null,g.jsx(bw,{isOpen:o,onConfirm:()=>{xw()},onOpenChange:s}),null,g.jsx(Sr,{className:"h-8 min-h-8 shrink-0 px-2.5 text-xs font-normal",onPress:t1,size:"sm",variant:"tertiary",children:"排行榜"}),g.jsx(Rs,{icon:g.jsx(Qw,{className:"size-4"}),label:"分享",onPress:()=>{ww()}}),g.jsxs(g.Fragment,{children:[g.jsx(Rs,{disabled:r,icon:g.jsx(Xw,{className:Ie("size-4",r&&"animate-spin")}),label:l,onPress:()=>{c()}}),g.jsx(Rs,{icon:g.jsx(kw,{className:"size-4"}),label:"设置",onPress:()=>Pw()})]}),g.jsx(zw,{})]})}function Rs({icon:e,label:t,onPress:r,disabled:n}){return g.jsxs(En,{closeDelay:80,delay:100,children:[g.jsx(Sr,{"aria-label":t,className:"size-8 min-h-8 min-w-8 shrink-0 p-0",isDisabled:n,isIconOnly:!0,onPress:r,size:"sm",variant:"tertiary",children:e}),g.jsx(En.Content,{placement:"bottom",children:g.jsx("p",{children:t})})]})}const i1={claude:"Claude",codex:"Codex",cursor:"Cursor",qoder:"Qoder",trae:"Trae",gemini:"Gemini",opencode:"OpenCode",copilot:"Copilot",antigravity:"Antigravity",openclaw:"OpenClaw",hermes:"Hermes",zcode:"ZCode",pi:"pi",kimi:"Kimi",roocode:"Roo Code",droid:"Droid",kiro:"Kiro",cline:"Cline",amp:"Amp",qwen:"Qwen Code",codebuddy:"CodeBuddy",workbuddy:"WorkBuddy",grok:"Grok Build",mimo:"Mimo","every-code":"Every Code",omp:"OMP","kilo-cli":"Kilo CLI",kilocode:"Kilo Code",goose:"Goose",zed:"Zed",warp:"Warp"};function a1(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t==="gemini-cli"||t.startsWith("gemini")?"gemini":t==="open-code"||t.startsWith("opencode")?"opencode":t==="github-copilot"||t==="copilot-cli"||t.startsWith("copilot")?"copilot":t.startsWith("antigravity")?"antigravity":t.startsWith("openclaw")||t.startsWith("open-claw")?"openclaw":t.startsWith("hermes")?"hermes":t.startsWith("zcode")||t==="zai"?"zcode":t==="pi-coding-agent"||t.startsWith("pi")?"pi":t.startsWith("kimi")?"kimi":t==="roo-code"||t.startsWith("roocode")||t.startsWith("roo")?"roocode":t.startsWith("droid")||t.startsWith("factory")?"droid":t.startsWith("kiro")?"kiro":t.startsWith("cline")?"cline":t.startsWith("amp")?"amp":t==="qwen-code"||t.startsWith("qwen")?"qwen":t.startsWith("codebuddy")||t==="code-buddy"?"codebuddy":t.startsWith("workbuddy")?"workbuddy":t.startsWith("grok")?"grok":t.startsWith("mimo")||t==="mimocode"||t.startsWith("xiaomi")?"mimo":t==="everycode"||t.startsWith("every-code")?"every-code":t.startsWith("omp")||t==="oh-my-pi"?"omp":t.startsWith("kilo-cli")||t==="kilo"?"kilo-cli":t.startsWith("kilocode")||t==="kilo-code"?"kilocode":t.startsWith("goose")?"goose":t.startsWith("zed")?"zed":t.startsWith("warp")?"warp":t}function qe(e){const t=a1(e);return i1[t]??e}const Pl=["var(--heatmap-0)","var(--heatmap-1)","var(--heatmap-2)","var(--heatmap-3)","var(--heatmap-4)"],Zf={today:1,"last-7-days":7,"last-30-days":30,"last-90-days":90},Pm=[{id:"today",label:"今天"},{id:"last-7-days",label:"7D"},{id:"last-30-days",label:"30D"},{id:"last-90-days",label:"90D"}],o1="!h-8 !min-h-8";function s1({value:e,onChange:t,tools:r,selectedTools:n,onToolsChange:i,disabled:a=!1}){const o=h.useMemo(()=>r.filter(s=>s.tokens>0),[r]);return g.jsxs("div",{className:"mb-5 flex min-w-0 items-center gap-2","aria-label":"筛选条件",children:[g.jsx("div",{className:"shrink-0 sm:hidden",children:g.jsx(l1,{disabled:a,value:e,onChange:t})}),g.jsx(Fe,{className:"hidden w-fit shrink-0 text-center sm:block",selectedKey:e,onSelectionChange:s=>{a||t(String(s))},children:g.jsx(Fe.ListContainer,{children:g.jsx(Fe.List,{"aria-label":"时间范围",className:"w-fit *:h-6 *:w-fit *:px-3 *:text-sm *:font-normal *:transition-none! *:data-[selected=true]:text-accent-foreground",children:Pm.map(s=>g.jsxs(Fe.Tab,{className:"transition-none!",id:s.id,children:[g.jsx("span",{className:"text-xs font-normal",children:s.label}),g.jsx(Fe.Indicator,{className:"bg-accent transition-none!"})]},s.id))})})}),g.jsx("div",{className:"flex min-h-8 min-w-0 shrink-0 items-center",children:o.length>0?g.jsx(u1,{selectedTools:n,tools:o,onChange:s=>{a||i(s)}}):null}),g.jsx("div",{className:"ml-auto shrink-0",children:g.jsx(n1,{})})]})}function l1({disabled:e,onChange:t,value:r}){return g.jsxs(Dt,{"aria-label":"时间范围",className:"min-w-0 max-w-[7.5rem] shrink text-xs",isDisabled:e,value:r,variant:"secondary",onChange:n=>{e||n==null||t(String(n))},children:[g.jsx(xm,{className:"sr-only",children:"时间范围"}),g.jsxs(Dt.Trigger,{className:`${o1} !w-fit max-w-[7.5rem] items-center leading-none ps-2.5 pe-7 !text-xs font-normal`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-20 !text-xs"}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"时间范围",children:Pm.map(n=>g.jsxs(kn.Item,{id:n.id,textValue:n.label,children:[n.label,g.jsx(kn.ItemIndicator,{})]},n.id))})})]})}function u1({tools:e,selectedTools:t,onChange:r}){const n=h.useMemo(()=>new Set(e.map(o=>o.source)),[e]),i=t.filter(o=>n.has(o)),a=i.length>0;return g.jsxs(Yf,{className:"shrink-0",children:[g.jsxs(Dt,{"aria-label":"筛选渠道",className:"w-fit max-w-52 text-xs",selectionMode:"multiple",value:i,variant:"secondary",onChange:o=>{const s=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];r(s.filter(l=>n.has(l)))},children:[g.jsx(xm,{className:"sr-only",children:"渠道"}),g.jsxs(Dt.Trigger,{className:`!h-8 !min-h-8 !w-fit max-w-52 ps-3 pe-8 !text-xs font-normal ${a?"!rounded-r-none":"!rounded-full"}`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-40 !text-xs",children:({state:o})=>{const s=o.selectedItems.map(u=>e.find(c=>c.source===u.key)).filter(u=>!!u);if(s.length===0)return"全部渠道";if(s.length>1)return`已选 ${s.length} 个渠道`;const[l]=s;return l?g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx(xr,{provider:l.source,size:18}),g.jsx("span",{className:"truncate",children:qe(l.source)})]}):"全部渠道"}}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"渠道列表",selectionMode:"multiple",children:e.map(o=>g.jsxs(kn.Item,{className:"py-1 rounded-lg px-1.5 text-xs gap-2!",id:o.source,textValue:qe(o.source),children:[g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md ",children:g.jsx(xr,{provider:o.source,size:18})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:qe(o.source)}),g.jsx(kn.ItemIndicator,{})]},o.source))})})]}),a?g.jsxs(Sr,{"aria-label":"清空渠道筛选",className:"!h-8 !min-h-8 !w-8 !min-w-8 !rounded-l-none !rounded-r-full p-0",size:"sm",variant:"tertiary",onPress:()=>r([]),children:[g.jsx(Yf.Separator,{}),g.jsx(wm,{className:"size-3.5"})]}):null]})}function c1(){return g.jsxs(q,{"aria-hidden":"true",className:"min-w-0 overflow-hidden rounded-2xl",children:[g.jsxs(q.Header,{className:"flex-row items-start justify-between gap-3 pb-0",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(xt,{className:"h-5 w-28 rounded-md"}),g.jsx(xt,{className:"h-3 w-44 rounded-md"})]}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(q.Content,{className:"pt-4",children:g.jsx(xt,{className:"h-52 w-full rounded-xl"})})]})}function f1(){return g.jsxs("div",{"aria-hidden":"true",className:"w-full",children:[g.jsx("section",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid grid-rows-[auto_auto] gap-4 p-0",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx(xt,{className:"h-3 w-16 rounded-md"}),g.jsx(xt,{className:"h-5 w-14 rounded-full"})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(xt,{className:"h-7 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-16 justify-self-end rounded-md"})]})]})},t))}),g.jsxs("div",{className:"mt-4 rounded-2xl border border-border/60 bg-surface p-4 sm:p-5",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[g.jsx(xt,{className:"h-4 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(xt,{className:"h-36 w-full rounded-xl sm:h-44"})]})]})}function d1(){return g.jsxs("div",{"aria-label":"用量数据加载中",className:"w-full",role:"status",children:[g.jsx(f1,{}),g.jsx("section",{"aria-hidden":"true",className:"mt-4 grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2",children:Array.from({length:5},(e,t)=>g.jsx(c1,{},t))})]})}function h1({allSources:e,value:t,onChange:r}){if(e.length===0)return null;const n=new Set(t),i=t.length===e.length,a=!i&&t.length>0;let o="全部平台";t.length===0?o="选择平台":!i&&t.length===1?o=qe(t[0]??""):i||(o=`已选 ${t.length} 个平台`);const s=l=>{const u=new Set(n);u.has(l)?u.delete(l):u.add(l),r([...u])};return g.jsxs(ra,{children:[g.jsxs(Sr,{"aria-label":`筛选平台:${o}`,className:Ie("h-auto min-h-0 max-w-36 gap-1 rounded-none border-0 bg-transparent p-0","text-xs font-medium text-muted shadow-none","hover:bg-transparent hover:text-foreground","data-[pressed=true]:bg-transparent data-[pressed=true]:text-foreground",a&&"text-foreground"),size:"sm",variant:"ghost",children:[!i&&t.length===1&&t[0]?g.jsx(xr,{provider:t[0],size:12}):null,g.jsx("span",{className:"min-w-0 max-w-28 truncate whitespace-nowrap",children:o}),g.jsx(Fw,{className:"size-3.5 shrink-0 opacity-70"})]}),g.jsx(ra.Content,{className:"min-w-56 overflow-hidden rounded-[10px] border-0 bg-overlay p-0 text-overlay-foreground shadow-surface",placement:"bottom end",children:g.jsxs(ra.Dialog,{className:"p-0 outline-none",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[g.jsx(ra.Heading,{className:"text-[10px] font-semibold tracking-wider text-muted",children:"选择平台"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([...e]),children:"全部"}),g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([]),children:"清空"})]})]}),g.jsx("ul",{"aria-multiselectable":"true",className:"max-h-64 overflow-y-auto p-1.5",role:"listbox",children:e.map(l=>{const u=n.has(l);return g.jsx("li",{"aria-selected":u,role:"option",children:g.jsxs("button",{className:Ie("flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left text-xs transition-colors","hover:bg-surface-secondary",u&&"bg-accent/10 hover:bg-accent/15"),type:"button",onClick:()=>s(l),children:[g.jsx("span",{"aria-hidden":"true",className:Ie("flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors",u?"border-accent bg-accent text-accent-foreground":"border-border bg-surface"),children:u?g.jsx(Ww,{className:"size-2.5"}):null}),g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-white",children:g.jsx(xr,{onLightBackground:!0,provider:l,size:14})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:qe(l)})]})},l)})})]})})]})}function p1(e,t,r){if(e.length===0){r([]);return}if(e.length===t.length&&t.every(n=>e.includes(n))){r(null);return}r(e)}const Lo="Asia/Shanghai",Jf=new Map;function v1(e){let t=Jf.get(e);return t||(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",hourCycle:"h23",minute:"2-digit"}),Jf.set(e,t)),t}function km(e,t=Lo){const r=typeof e=="string"?new Date(e):e;if(Number.isNaN(r.getTime()))return{date:"1970-01-01",hour:0};const n=v1(t).formatToParts(r),i=a=>{var o;return((o=n.find(s=>s.type===a))==null?void 0:o.value)??""};return{date:`${i("year")}-${i("month")}-${i("day")}`,hour:Number(i("hour"))}}function an(e=Lo,t=new Date){return km(t,e).date}function Eu(e=Lo,t=new Date){return km(t,e).hour}function m1(e,t){const[r,n,i]=e.split("-").map(Number);return new Date(Date.UTC(r??1970,(n??1)-1,(i??1)+t)).toISOString().slice(0,10)}function Qf(e,t=Lo,r=new Date){const n=an(t,r);return m1(n,-(Math.max(1,e)-1))}function Om(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(r.getTime())?r:null}function na(e){return e.toISOString().slice(0,10)}function yn(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function jm(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function Ls(e,t){if(!e.length)return 0;const r=(e.length-1)*t,n=Math.floor(r),i=r-n,a=e[n]??e[e.length-1],o=e[Math.min(e.length-1,n+1)]??e[e.length-1];return Math.round(a+(o-a)*i)}function g1(e){return e<=0?0:e>=4?4:e}function y1(e,t=26){var y;const r=Om(an())??new Date,n=yn(r,-(t*7-1)),i=n.getUTCDay(),a=yn(n,-i),o=new Map;for(const b of e)o.set(b.date,{value:Math.max(0,b.tokens),models:b.models??null});const s=jm(a,r)+1,l=Math.ceil(s/7),u=[];for(let b=0;b<s;b++){const x=na(yn(a,b)),w=((y=o.get(x))==null?void 0:y.value)??0;w>0&&u.push(w)}u.sort((b,x)=>b-x);const c=Ls(u,.5),f=Ls(u,.75),d=Ls(u,.9);function p(b){return!b||b<=0?0:b<=c?1:b<=f?2:b<=d?3:4}const m=[];for(let b=0;b<l;b++){const x=[];for(let w=0;w<7;w++){const P=yn(a,b*7+w);if(P.getTime()>r.getTime()){x.push(null);continue}const O=na(P),k=o.get(O),j=(k==null?void 0:k.value)??0;x.push({day:O,value:j,level:g1(p(j)),models:(k==null?void 0:k.models)??null})}m.push(x)}const v=m.length>t?m.slice(m.length-t):m;return{from:na(n),to:na(r),weeks:v,thresholds:{t1:c,t2:f,t3:d}}}function ed(){return"UTC+08:00"}function b1(e,t,r){if(!e)return[];const n=Om(t)??new Date,i=yn(n,-n.getUTCDay()),a=yn(i,-(e-1)*7),o=[];for(let u=11;u>=0;u-=1)o.push(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-u,1)));const s=[],l=new Set;for(const u of o){const c=Math.floor(jm(a,u)/7);c<0||c>=e||l.has(c)||(l.add(c),s.push({label:r[u.getUTCMonth()],index:c}))}return s}const x1="";function Ti(e){const t=e.indexOf(x1);return t===-1?{source:null,model:e}:{source:e.slice(0,t),model:e.slice(t+1)}}const w1="var(--chart-",P1=8;function Na(e){const t=e%P1+1;return`${w1}${t})`}function k1(e){const t=new Map;for(const n of e){if(n.tokens<=0)continue;const i=t.get(n.model);(!i||n.tokens>i.tokens)&&t.set(n.model,{source:n.source,tokens:n.tokens})}const r=new Map;for(const[n,i]of t)r.set(n,i.source);return r}const wt="unattributed",Da="未归类";function O1(e){const t=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(u=>{const c=new Map;for(const p of u.models){if(!p.model||p.tokens<=0)continue;const m=c.get(p.model)??{tokens:0,costUsd:0,pct:0};m.tokens+=p.tokens,m.costUsd+=p.costUsd,m.pct+=p.pct,c.set(p.model,m),r.set(p.model,(r.get(p.model)??0)+p.tokens)}let f=0,d=0;for(const p of c.values())f+=p.tokens,d+=p.costUsd;return{row:u,models:c,unattributedTokens:Math.max(0,u.tokens-f),unattributedCostUsd:Math.max(0,u.costUsd-d)}}),i=[...r.entries()].sort((u,c)=>c[1]-u[1]).map(([u,c],f)=>({key:`model-${f}`,model:u,color:Na(f),tokens:c})),a=n.reduce((u,c)=>u+c.unattributedTokens,0);a>0&&i.push({key:wt,model:Da,color:"var(--muted)",tokens:a,isUnattributed:!0});const o=new Map(i.filter(u=>!u.isUnattributed).map(u=>[u.model,u])),s=Object.fromEntries(i.map(u=>[u.key,{label:u.model,color:u.color}])),l=n.map(({row:u,models:c,unattributedTokens:f,unattributedCostUsd:d})=>{const p={source:u.source,tokens:u.tokens,costUsd:u.costUsd,pct:u.pct,modelCount:u.models.length,segments:{}};for(const m of i)p[m.key]=0;for(const[m,v]of c){const y=o.get(m);y&&(p[y.key]=v.tokens,p.segments[y.key]={key:y.key,model:m,tokens:v.tokens,costUsd:v.costUsd,pct:v.pct})}return f>0&&(p[wt]=f,p.segments[wt]={key:wt,model:Da,tokens:f,costUsd:d,pct:u.tokens>0?f/u.tokens*100:0,isUnattributed:!0}),p});return{config:s,rows:l,series:i}}function j1(e){const t=e.filter(c=>c.tokens>0).sort((c,f)=>f.tokens-c.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(c=>{const f=new Map;for(const m of c.models){if(!m.model||!m.source||m.tokens<=0)continue;const v=`${m.source}\0${m.model}`,y=f.get(v)??{source:m.source,model:m.model,tokens:0,costUsd:0,pct:0};y.tokens+=m.tokens,y.costUsd+=m.costUsd,y.pct+=m.pct,f.set(v,y);const b=r.get(v)??{source:m.source,model:m.model,tokens:0};b.tokens+=m.tokens,r.set(v,b)}let d=0,p=0;for(const m of f.values())d+=m.tokens,p+=m.costUsd;return{row:c,models:f,unattributedTokens:Math.max(0,c.tokens-d),unattributedCostUsd:Math.max(0,c.costUsd-p)}}),i=[...r.entries()].sort((c,f)=>f[1].tokens-c[1].tokens).map(([c,f],d)=>({key:`seg-${d}`,pairKey:c,model:f.model,source:f.source,color:Na(d),tokens:f.tokens})),a=n.reduce((c,f)=>c+f.unattributedTokens,0);a>0&&i.push({key:wt,pairKey:wt,model:Da,source:"",color:"var(--muted)",tokens:a});const o=new Map(i.filter(c=>c.key!==wt).map(c=>[c.pairKey,c])),s=i.map(c=>({key:c.key,model:c.model,source:c.source,color:c.color,tokens:c.tokens,...c.key===wt?{isUnattributed:!0}:{}})),l=Object.fromEntries(s.map(c=>[c.key,{label:c.source?`${c.source}:${c.model}`:c.model,color:c.color}])),u=n.map(({row:c,models:f,unattributedTokens:d,unattributedCostUsd:p})=>{const m={project:c.project,label:c.label,tokens:c.tokens,costUsd:c.costUsd,pct:c.pct,modelCount:c.models.length,segments:{}};for(const v of s)m[v.key]=0;for(const[v,y]of f){const b=o.get(v);b&&(m[b.key]=y.tokens,m.segments[b.key]={key:b.key,model:y.model,source:y.source,tokens:y.tokens,costUsd:y.costUsd,pct:y.pct})}return d>0&&(m[wt]=d,m.segments[wt]={key:wt,model:Da,source:"",tokens:d,costUsd:p,pct:c.tokens>0?d/c.tokens*100:0,isUnattributed:!0}),m});return{config:l,rows:u,series:s}}const Uo=["周一","周二","周三","周四","周五","周六","周日"],Am=Array.from({length:24},(e,t)=>String(t).padStart(2,"0"));function Sm(e){const t=new Date,r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return Array.from({length:e},(n,i)=>{const a=new Date(r);return a.setUTCDate(r.getUTCDate()-(e-1-i)),a.toISOString().slice(0,10)})}function Em(e){const[,t="",r=""]=e.split("-");return`${Number(t)}/${Number(r)}`}const td=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],Us=[{source:"claude-code",model:"claude-fable-5",terminal:"VS Code",project:"ai-usage",weight:26,scale:1.35},{source:"claude-code",model:"MiniMax-M3",terminal:"系统终端",project:"ai-usage",weight:18,scale:1.7},{source:"claude-code",model:"claude-sonnet-4-6",terminal:"VS Code",project:"dashboard",weight:12,scale:1},{source:"codex",model:"gpt-5",terminal:"系统终端",project:"api-service",weight:18,scale:1.2},{source:"codex",model:"gpt-5-mini",terminal:"VS Code",project:"docs-site",weight:10,scale:.72},{source:"cursor",model:"claude-sonnet-4-6",terminal:"Cursor",project:"design-system",weight:10,scale:.88},{source:"cursor",model:"gemini-2-5-pro",terminal:"Cursor",project:"marketing-site",weight:6,scale:1.08}],_u=365,A1=S1(),oi=E1(A1),ln={hourlyUsage:[],rangeDailyUsage:[],heatmapDailyUsage:[],heatmapDays:[],modelRows:[],hourlyApiRows:[],todayHourlyUsage:[],dailyUsage:[],summary:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0},changes:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0},distributions:{terminals:[],tools:[],models:[],projects:[]},toolModelUsage:[],projectModelUsage:[]};function S1(){return Uo.flatMap((e,t)=>Am.map((r,n)=>{const i=_1(t,n),a=t>=5,o=Math.max(0,1-Math.abs(n-10)/5),s=Math.max(0,1-Math.abs(n-20)/5),l=(Math.sin((t+1)*(n+3)*.77)+1)/2,c=Math.min(1,.03+(a?.62:1)*(o*.4+s*.57)+l*.14),f=Math.round((500+c*38e3)*i.scale),d=.72+l*.12,p=Math.round(f*d),m=f-p,v=i.model.includes("MiniMax")||i.model.includes("fable")?.42+l*.28:.08+l*.18,y=Math.min(p,Math.round(p*v)),b=Pr(p*4e-6+m*16e-6);return{day:e,hour:n,hourLabel:r,inputTokens:p,cachedInputTokens:y,outputTokens:m,totalTokens:f,costUsd:b,durationMinutes:Math.round(3+c*72),source:i.source,model:i.model,terminal:i.terminal,project:i.project}}))}function E1(e){var u;const t=Mu(e),r=T1(e),n=e.map(c=>({day:c.day,hour:c.hour,hourLabel:c.hourLabel,inputTokens:c.inputTokens,cachedInputTokens:c.cachedInputTokens,outputTokens:c.outputTokens,totalTokens:c.totalTokens,costUsd:c.costUsd,durationMinutes:c.durationMinutes})),i=(u=r.at(-1))==null?void 0:u.day,a=i?n.filter(c=>c.day===i):[],o=C1(r),s=M1(o),l=I1(e,t.totalTokens);return{hourlyUsage:n,rangeDailyUsage:r,heatmapDailyUsage:o,heatmapDays:s,modelRows:l,hourlyApiRows:[],todayHourlyUsage:a,dailyUsage:r,summary:t,changes:Iu(r),distributions:{terminals:ia(e,c=>c.terminal),tools:ia(e,c=>c.source),models:ia(e,c=>c.model),projects:ia(e,c=>c.project)},toolModelUsage:Tu(e.map(c=>({source:c.source,tokens:c.totalTokens,costUsd:c.costUsd,models:[{model:c.model,tokens:c.totalTokens,costUsd:c.costUsd}]})),t.totalTokens),projectModelUsage:Cu(Object.values(e.reduce((c,f)=>{const d=c[f.project]??{project:f.project,tokens:0,costUsd:0,models:[]};return d.tokens+=f.totalTokens,d.costUsd+=f.costUsd,d.models.push({model:f.model,source:f.source,tokens:f.totalTokens,costUsd:f.costUsd}),c[f.project]=d,c},{})),t.totalTokens)}}function Tu(e,t){const r=new Map;for(const a of e){if(!a.source||a.tokens<=0)continue;const o=r.get(a.source)??{tokens:0,costUsd:0,models:new Map};o.tokens+=a.tokens,o.costUsd+=a.costUsd;for(const s of a.models){if(!s.model||s.tokens<=0)continue;const l=o.models.get(s.model)??{tokens:0,costUsd:0};l.tokens+=s.tokens,l.costUsd+=s.costUsd,o.models.set(s.model,l)}r.set(a.source,o)}const n=[...r.entries()].sort(([,a],[,o])=>o.tokens-a.tokens),i=t&&t>0?t:n.reduce((a,[,o])=>a+o.tokens,0);return n.map(([a,o])=>({source:a,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:$a(o.tokens,i),models:[...o.models.entries()].sort(([,s],[,l])=>l.tokens-s.tokens).map(([s,l])=>({model:s,tokens:l.tokens,costUsd:Pr(l.costUsd),pct:$a(l.tokens,o.tokens)}))}))}function Cu(e,t=0){return e.filter(r=>r.tokens>0).map(r=>{const n=(r.models??[]).filter(i=>i.tokens>0).map(i=>({model:i.model,source:i.source,tokens:i.tokens,costUsd:Pr(i.costUsd),pct:i.pct??$a(i.tokens,r.tokens)})).sort((i,a)=>a.tokens-i.tokens);return{project:r.project,label:r.project==="unknown"?"未知项目":r.project,tokens:r.tokens,costUsd:Pr(r.costUsd),pct:t>0?$a(r.tokens,t):r.pct??0,models:n}}).sort((r,n)=>n.tokens-r.tokens)}function _1(e,t){const r=Us.reduce((i,a)=>i+a.weight,0);let n=(e*31+t*17)%r;for(const i of Us)if(n-=i.weight,n<0)return i;return Us[0]}function Mu(e){const t=e.reduce((r,n)=>({inputTokens:r.inputTokens+n.inputTokens,outputTokens:r.outputTokens+n.outputTokens,totalTokens:r.totalTokens+n.totalTokens,totalCostUsd:r.totalCostUsd+n.costUsd,totalDurationMinutes:r.totalDurationMinutes+n.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{...t,totalCostUsd:Pr(t.totalCostUsd)}}function T1(e){return Sm(Uo.length).map(r=>{const n=_m(r),i=e.filter(s=>s.day===n),a=Mu(i),o=i.reduce((s,l)=>s+l.cachedInputTokens,0);return{day:n,date:r,dateLabel:Em(r),...a,cachedInputTokens:o,uncachedInputTokens:a.inputTokens-o,costUsd:a.totalCostUsd,durationMinutes:a.totalDurationMinutes}})}function C1(e){return e.length===0?[]:Sm(_u).map((r,n)=>{const i=e[n%e.length],o=.35+(Math.sin(n*.37)+1)/2*.9,l=(n*17+11)%5!==0?o:0;return{...i,day:_m(r),date:r,dateLabel:Em(r),inputTokens:Math.round(i.inputTokens*l),cachedInputTokens:Math.round(i.cachedInputTokens*l),uncachedInputTokens:Math.round(i.uncachedInputTokens*l),outputTokens:Math.round(i.outputTokens*l),totalTokens:Math.round(i.totalTokens*l),costUsd:Pr(i.costUsd*l),durationMinutes:Math.round(i.durationMinutes*l)}})}function M1(e){return e.map(t=>({date:t.date,tokens:t.totalTokens,costUsd:t.costUsd,models:{}}))}function I1(e,t){const r=new Map;for(const i of e){const a=`${i.source}:${i.model}`,o=r.get(a)??{model:i.model,source:i.source,tokens:0,costUsd:0};o.tokens+=i.totalTokens,o.costUsd+=i.costUsd,r.set(a,o)}const n=Math.max(1,t);return[...r.values()].filter(i=>i.tokens>0).sort((i,a)=>a.tokens-i.tokens).map(i=>({...i,pct:i.tokens/n*100}))}function _m(e){const r=(new Date(`${e}T00:00:00.000Z`).getUTCDay()+6)%7;return Uo[r]}function Iu(e){if(e.length<2)return{totalCostUsd:0,totalTokens:0,inputTokens:0,outputTokens:0};const t=Math.floor(e.length/2),r=rd(e.slice(0,t)),n=rd(e.slice(t));return{totalCostUsd:aa(n.totalCostUsd,r.totalCostUsd),totalTokens:aa(n.totalTokens,r.totalTokens),inputTokens:aa(n.inputTokens,r.inputTokens),outputTokens:aa(n.outputTokens,r.outputTokens)}}function rd(e){const t=Math.max(1,e.length),r=e.reduce((n,i)=>({inputTokens:n.inputTokens+i.inputTokens,outputTokens:n.outputTokens+i.outputTokens,totalTokens:n.totalTokens+i.totalTokens,totalCostUsd:n.totalCostUsd+i.costUsd,totalDurationMinutes:n.totalDurationMinutes+i.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{inputTokens:r.inputTokens/t,outputTokens:r.outputTokens/t,totalTokens:r.totalTokens/t,totalCostUsd:r.totalCostUsd/t,totalDurationMinutes:r.totalDurationMinutes/t}}function ia(e,t){const r=new Map;for(const n of e){const i=t(n),a=r.get(i)??{tokens:0,costUsd:0,durationMinutes:0};a.tokens+=n.totalTokens,a.costUsd+=n.costUsd,a.durationMinutes+=n.durationMinutes,r.set(i,a)}return[...r.entries()].sort(([,n],[,i])=>i.tokens-n.tokens).map(([n,i],a)=>({id:N1(n),label:n,color:td[a%td.length],tokens:i.tokens,costUsd:Pr(i.costUsd),durationMinutes:i.durationMinutes}))}function aa(e,t){return t<=0?0:Math.round((e-t)/t*1e4)/100}function $a(e,t){return t<=0?0:Math.round(e/t*1e3)/10}function N1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function Pr(e){return Math.round(e*100)/100}function Tm(e,t,r,n){const i=e.reduce((f,d)=>f+d.tokens,0),a=e.reduce((f,d)=>f+d.costUsd,0),o=an(),s=e.find(f=>f.date===o),l=(s==null?void 0:s.tokens)??(n==null?void 0:n.tokens)??0,u=(s==null?void 0:s.costUsd)??(n==null?void 0:n.costUsd)??0,c=D1(t,i);return{totalTokens:i,totalCostUsd:Math.round(a*1e8)/1e8,todayTokens:l,todayCostUsd:Math.round(u*1e8)/1e8,statsSince:r,bySource:c}}function D1(e,t){const r=new Map;for(const i of e){if(i.tokens<=0)continue;let a=r.get(i.source);a||(a={tokens:0,costUsd:0,models:new Map},r.set(i.source,a)),a.tokens+=i.tokens,a.costUsd+=i.costUsd;const o=a.models.get(i.model)??{tokens:0,costUsd:0};o.tokens+=i.tokens,o.costUsd+=i.costUsd,a.models.set(i.model,o)}const n=t>0?t:[...r.values()].reduce((i,a)=>i+a.tokens,0);return Array.from(r.entries()).map(([i,a])=>({source:i,tokens:a.tokens,costUsd:Math.round(a.costUsd*1e8)/1e8,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:Array.from(a.models.entries()).map(([o,s])=>({model:o,tokens:s.tokens,costUsd:Math.round(s.costUsd*1e8)/1e8,pct:a.tokens>0?Math.round(s.tokens/a.tokens*1e3)/10:0})).sort((o,s)=>s.tokens-o.tokens)})).sort((i,a)=>a.tokens-i.tokens)}const nd=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],$1={claude:"claude-code",codex:"codex",cursor:"cursor",qoder:"qoder",trae:"trae",gemini:"gemini",opencode:"opencode",copilot:"copilot",antigravity:"antigravity",openclaw:"openclaw",hermes:"hermes",zcode:"zcode",pi:"pi",kimi:"kimi",roocode:"roocode",droid:"droid",kiro:"kiro",cline:"cline",amp:"amp",qwen:"qwen-code",codebuddy:"codebuddy",workbuddy:"workbuddy",grok:"grok",mimo:"mimo","every-code":"every-code",omp:"omp","kilo-cli":"kilo-cli",kilocode:"kilocode",goose:"goose",zed:"zed",warp:"warp"};function R1(e,t=new Date){const r=Eu(void 0,t);return e.filter(n=>n.hour<=r)}function L1(e,t=new Date){return{...e,todayHourlyUsage:R1(e.todayHourlyUsage,t)}}function U1(e,t){var y;if(e.dailyRows.length===0)return L1(oi);const r=an(),n=Qf(t),i=e.dailyRows.filter(b=>b.date>=n&&b.date<=r),a=Qf(_u),o=e.dailyRows.filter(b=>b.date>=a&&b.date<=r),s=e.modelRows.filter(b=>b.tokens>0),l=Tm(i,s,((y=e.syncStatus)==null?void 0:y.statsSince)||e.summary.statsSince,{tokens:e.summary.todayTokens,costUsd:e.summary.todayCostUsd}),u=i.map(kl),c=o.map(kl),f=o.map(b=>({date:b.date,tokens:b.tokens,costUsd:b.costUsd,models:b.models??{},projects:b.projects})),d=K1(u),p=Cm(u),m=e.hourlyRows??[],v=Nu(m,r,Eu());return{summary:p,rangeDailyUsage:u,heatmapDailyUsage:c,heatmapDays:f,modelRows:s,hourlyApiRows:m,todayHourlyUsage:v,dailyUsage:d,hourlyUsage:[],changes:Iu(u),distributions:Mm(l.bySource,s,e.projectRows,p),toolModelUsage:Tu(l.bySource,p.totalTokens),projectModelUsage:Cu(e.projectRows,p.totalTokens)}}function id(e){const t=/^(\d{4}-\d{2}-\d{2})/.exec(String(e).trim());return(t==null?void 0:t[1])??""}function Nu(e,t,r){const n=r===void 0?23:Math.min(Math.max(r,0),23),i=id(t),a=new Map;for(const s of e){if(!i||id(s.date)!==i)continue;const l=Number(s.hour);if(!Number.isInteger(l)||l<0||l>23)continue;const u=a.get(l)??{tokens:0,costUsd:0,inputTokens:0,outputTokens:0,cachedInputTokens:0};u.tokens+=s.tokens,u.costUsd+=s.costUsd,u.inputTokens+=s.inputTokens,u.outputTokens+=s.outputTokens,u.cachedInputTokens+=s.cachedInputTokens,a.set(l,u)}const o=Du(i||t);return Array.from({length:n+1},(s,l)=>{const u=a.get(l),c=Am[l]??String(l).padStart(2,"0");if(!u)return H1(o,l,c);const f=u.inputTokens,d=u.outputTokens,p=Math.min(f,u.cachedInputTokens);return{day:o,hour:l,hourLabel:c,inputTokens:f,cachedInputTokens:p,outputTokens:d,totalTokens:u.tokens>0?u.tokens:f+d,costUsd:u.costUsd,durationMinutes:0}})}function z1(e,t){const r=e.heatmapDays.find(m=>m.date===t),n=e.heatmapDailyUsage.find(m=>m.date===t),i=r??{date:t,tokens:(n==null?void 0:n.totalTokens)??0,costUsd:(n==null?void 0:n.costUsd)??0,models:{}},a=n??kl(i,e.heatmapDailyUsage.length),o=B1(e.modelRows),s=F1(i,o),l=W1(i,o),u=Tm([i],s,""),c=Cm([a]),f=an(),d=t===f?Eu():void 0,p=Nu(e.hourlyApiRows,t,d);return{...e,summary:c,rangeDailyUsage:[a],modelRows:s,todayHourlyUsage:p,hourlyUsage:[],changes:Iu([a]),distributions:Mm(u.bySource,s,l,c),toolModelUsage:Tu(u.bySource,c.totalTokens),projectModelUsage:Cu(l,c.totalTokens)}}function B1(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function F1(e,t){const r=Object.entries(e.models??{}).filter(([,a])=>a>0);if(r.length===0)return[];const n=r.reduce((a,[,o])=>a+o,0),i=Ra(e.costUsd,r.map(([,a])=>a));return r.map(([a,o],s)=>{const l=Ti(a),u=l.source??t.get(l.model)??"unknown";return{model:l.model,source:u,tokens:o,costUsd:i[s]??0,pct:n>0?Math.round(o/n*1e3)/10:0}}).sort((a,o)=>o.tokens-a.tokens)}function W1(e,t){const r=(e.projects??[]).filter(a=>a.tokens>0);if(r.length===0)return[];const n=r.reduce((a,o)=>a+o.tokens,0),i=Ra(e.costUsd,r.map(a=>a.tokens));return r.map((a,o)=>{const s=Object.entries(a.models??{}).filter(([,c])=>c>0),l=Ra(i[o]??0,s.map(([,c])=>c)),u=s.map(([c,f],d)=>{const p=Ti(c),m=p.source??t.get(p.model)??"unknown";return{model:p.model,source:m,tokens:f,costUsd:l[d]??0,pct:a.tokens>0?Math.round(f/a.tokens*1e3)/10:0}}).sort((c,f)=>f.tokens-c.tokens);return{project:a.project,tokens:a.tokens,costUsd:i[o]??0,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:u}}).sort((a,o)=>o.tokens-a.tokens)}function kl(e,t){const r=oi.dailyUsage[t%oi.dailyUsage.length],n=Bs(r.inputTokens,r.totalTokens,.78),i=Bs(r.cachedInputTokens,r.inputTokens,.2),a=Math.round(e.tokens*n),o=Math.max(0,e.tokens-a),s=Math.min(a,Math.round(a*i)),l=Math.round(e.tokens*Bs(oi.summary.totalDurationMinutes,oi.summary.totalTokens,0));return{day:Du(e.date),date:e.date,dateLabel:Nm(e.date),inputTokens:a,cachedInputTokens:s,uncachedInputTokens:a-s,outputTokens:o,totalTokens:e.tokens,costUsd:q1(e.costUsd),durationMinutes:l}}function K1(e){var n;const t=new Map(e.map(i=>[i.date,i])),r=Im(((n=e.at(-1))==null?void 0:n.date)??new Date().toISOString());return Array.from({length:7},(i,a)=>{const o=new Date(r);o.setUTCDate(r.getUTCDate()-(6-a));const s=o.toISOString().slice(0,10),l=t.get(s);return l||{day:Du(s),date:s,dateLabel:Nm(s),inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}})}function Cm(e){return Mu(e.map(t=>({day:t.day,hour:0,hourLabel:"00",inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd,durationMinutes:t.durationMinutes})))}function H1(e,t,r){return{day:e,hour:t,hourLabel:r,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}}function Mm(e,t,r,n){const i=e.map(o=>({label:$1[o.source]??o.source,tokens:o.tokens,costUsd:o.costUsd})),a=new Map;for(const o of t){const s=a.get(o.model)??{label:o.model,tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,a.set(o.model,s)}return{tools:i.length>0?zs(i,n,6):[],models:a.size>0?zs([...a.values()],n,6):[],terminals:[],projects:r.length>0?zs(r.map(o=>({label:o.project==="unknown"?"未知项目":o.project,tokens:o.tokens,costUsd:o.costUsd})),n,6):[]}}function zs(e,t,r=8){const n=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens),i=n.slice(0,r),a=n.slice(r);a.length>0&&i.push({label:"其他",tokens:a.reduce((u,c)=>u+c.tokens,0),costUsd:a.reduce((u,c)=>u+c.costUsd,0)});const o=Ol(t.totalTokens,i.map(u=>u.tokens)),s=Ra(t.totalCostUsd,i.map(u=>u.costUsd||u.tokens)),l=Ol(t.totalDurationMinutes,i.map(u=>u.tokens));return i.map((u,c)=>({id:G1(u.label)||`item-${c}`,label:u.label,color:nd[c%nd.length],tokens:o[c]??0,costUsd:s[c]??0,durationMinutes:l[c]??0}))}function Ol(e,t){if(t.length===0)return[];const r=Math.max(0,Math.round(e)),n=t.reduce((l,u)=>l+Math.max(0,u),0);if(n<=0)return t.map(()=>0);const i=t.map(l=>Math.max(0,l)/n*r),a=i.map(Math.floor);let o=r-a.reduce((l,u)=>l+u,0);const s=i.map((l,u)=>({index:u,fraction:l-Math.floor(l)})).sort((l,u)=>u.fraction-l.fraction);for(let l=0;l<o;l+=1){const u=s[l%s.length];a[u.index]+=1}return a}function Ra(e,t){return Ol(Math.round(e*100),t).map(r=>r/100)}function Bs(e,t,r){return t>0?e/t:r}function Du(e){const r=(Im(e).getUTCDay()+6)%7;return Uo[r]}function Im(e){return new Date(`${e.slice(0,10)}T00:00:00.000Z`)}function Nm(e){const[,t="",r=""]=e.slice(0,10).split("-");return`${Number(t)}/${Number(r)}`}function G1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function q1(e){return Math.round(e*100)/100}function Dm(e=[],t=[]){if(e.length>0)return e.filter(i=>i.tokens>0).map(i=>i.source);const r=new Set,n=[];for(const i of t)i.tokens<=0||r.has(i.source)||(r.add(i.source),n.push(i.source));return n}function $m(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function Rm(e,t){if(t==null)return e;const r=new Set(e);return t.filter(n=>r.has(n))}function ad(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t}function $n(e,t){if(t.has(e))return!0;const r=ad(e);for(const n of t)if(ad(n)===r)return!0;return!1}function Lm(e,t,r,n){if(t==null&&r==null)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=Object.entries(e).filter(([,l])=>l>0);if(i.length===0)return n.fallbackShare;const a=t==null?null:new Set(n.activeSources);let o=0,s=0;for(const[l,u]of i){o+=u;const c=Ti(l),f=c.source??n.sourceFallback.get(c.model)??"unknown";c.model,!(a&&!$n(f,a))&&(s+=u)}return o>0?s/o:0}function Um(e,t,r,n){if(t==null&&r==null||e.length===0)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=t==null?null:new Set(n.activeSources);let a=0,o=0;for(const s of e)s.tokens<=0||(a+=s.tokens,!(i&&!$n(s.source,i))&&(o+=s.tokens));return a>0?o/a:0}function Y1(e,t,r){if(t==null)return e;if(r.activeSources.length===0)return{};const n=new Set(r.activeSources),i={};for(const[a,o]of Object.entries(e)){if(o<=0)continue;const s=Ti(a),l=s.source??r.sourceFallback.get(s.model)??"unknown";$n(l,n)&&(i[a]=o)}return i}function V1(e){if(e.selectedSources.length===0)return{dailyRows:e.dailyRows,hourlyRows:e.hourlyRows};const t=e.selectedSources,r=Dm(e.toolRows,e.modelRows),n=Rm(r,t),i=$m(e.modelRows),a=Um(e.modelRows,t,null,{activeSources:n}),o=new Map(e.heatmapDays.map(f=>[f.date,f])),s=f=>{const d=o.get(f);return d?Lm(d.models??{},t,null,{activeSources:n,sourceFallback:i,fallbackShare:a}):a},l=e.dailyRows.map(f=>J1(f,s(f.date))),u=e.hourlyDate;let c=e.hourlyRows;if(u!=null)if(e.hourlyApiRows.length===0)c=e.hourlyRows.map(f=>Q1(f,s(u)));else{const f=new Set(n),d=n.length===0?[]:e.hourlyApiRows.filter(m=>$n(m.source||"unknown",f)),p=e.hourlyRows.length>0?Math.max(...e.hourlyRows.map(m=>m.hour)):void 0;c=Nu(d,u,p)}return{dailyRows:l,hourlyRows:c}}function X1(e,t){if(t.length===0)return e;const r=new Set(t),n=[];for(const i of e){const a=i.models.filter(l=>$n(l.source,r));if(a.length===0)continue;const o=a.reduce((l,u)=>l+u.tokens,0);if(o<=0)continue;const s=a.reduce((l,u)=>l+u.costUsd,0);n.push({...i,tokens:o,costUsd:s,models:a.map(l=>({...l,pct:o>0?Math.round(l.tokens/o*1e3)/10:0}))})}return n.sort((i,a)=>a.tokens-i.tokens)}function Z1(e){const t=e.filter(a=>a.tokens>0).sort((a,o)=>o.tokens-a.tokens),r=t.map((a,o)=>({id:a.source,label:qe(a.source),color:Na(o),tokens:a.tokens,costUsd:a.costUsd,durationMinutes:0})),n=new Map;for(const a of t)for(const o of a.models){if(!o.model||o.tokens<=0)continue;const s=n.get(o.model)??{tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,n.set(o.model,s)}const i=[...n.entries()].sort(([,a],[,o])=>o.tokens-a.tokens).map(([a,o],s)=>({id:a,label:a,color:Na(s),tokens:o.tokens,costUsd:o.costUsd,durationMinutes:0}));return{tools:r,models:i}}function J1(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,uncachedInputTokens:Math.max(0,r-n),outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}function Q1(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}const Fs=14,Hr=3,$u=18,od=52,eP=80,tP=340,Ws=156,rP=["日","一","二","三","四","五","六"],nP=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];function iP(e,t){const r=Math.max(0,t-1)*Hr,n=Math.max(0,e-$u-r);return Math.max(1,Math.floor(n/t)||1)}function aP(e){const t=h.useRef(null),[r,n]=h.useState(Fs),[i,a]=h.useState(e);return h.useEffect(()=>{const o=t.current;if(!o||e<=0)return;const s=()=>{const u=o.clientWidth,c=Math.floor((u-$u+Hr)/(Fs+Hr)),f=Math.max(1,Math.min(e,c||1));f>=e?(a(e),n(iP(u,e))):(a(f),n(Fs))};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),()=>{l.disconnect(),window.removeEventListener("resize",s)}},[e]),{containerRef:t,cellSize:r,visibleWeeks:i}}function oP({cell:e,heatmapColors:t,modelEntries:r,isLoading:n}){const i=r;return g.jsxs("div",{className:"grid min-w-0 gap-2 text-xs",children:[g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("span",{className:"font-medium text-foreground",children:e.day}),g.jsxs("span",{className:"text-[10px] text-muted",children:["等级 ",e.level]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full",style:{background:t[e.level]}}),g.jsx("span",{className:"flex-1 text-muted",children:"总用量"}),g.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",title:Pn(e.value),children:oe(e.value)})]}),n?g.jsxs("div",{"aria-label":"正在加载模型明细",className:"grid gap-2 pt-0.5",children:[g.jsx("span",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-3 w-full animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-1 w-full animate-pulse rounded bg-surface-secondary"})]}):i.length>0?g.jsxs("div",{className:"grid gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:"模型明细"}),i.map(({key:a,name:o,source:s,val:l})=>{const u=e.value||1,c=Math.round(l/u*100),f=s?`${qe(s)} · ${o}`:o;return g.jsxs("div",{className:"grid min-w-0 gap-1",children:[g.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3",children:[g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 overflow-hidden",children:[s&&g.jsx(xr,{className:"shrink-0",provider:s,size:12}),g.jsx("span",{className:"truncate",title:f,children:f})]}),g.jsxs("span",{className:"whitespace-nowrap font-mono text-muted tabular-nums",title:Pn(l),children:[oe(l)," · ",c,"%"]})]}),g.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-surface-secondary",children:g.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${c}%`}})})]},a)})]}):null]})}function sP(e,t,r){const n=Object.entries(e.models??{}).map(([o,s])=>{const l=Ti(o),u=l.source??t.get(l.model);return{key:o,name:l.model,source:u,val:s}}).filter(({val:o,source:s})=>o<=0?!1:r?s?$n(s,r):!1:!0).sort((o,s)=>s.val-o.val),i=n.slice(0,6),a=new Set(i.map(o=>o.source).filter(Boolean));for(const o of n.slice(6))o.source&&!a.has(o.source)&&(i.push(o),a.add(o.source));return i}const lP=h.memo(function({visible:t,cellSize:r,selectedDate:n,onSelectDate:i,onPointerOver:a,onPointerLeave:o,onFocus:s,onBlur:l}){return g.jsx("div",{style:{gridColumn:"2 / -1",display:"grid",gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${r}px)`,gridTemplateColumns:`repeat(${t.length}, ${r}px)`,gap:Hr},onBlur:l,onFocus:s,onPointerLeave:o,onPointerOver:a,children:t.map((u,c)=>u.map((f,d)=>{if(!f)return null;const p=Pl[f.level]??Pl[0],m=n===f.day;return g.jsx("button",{"aria-label":`${f.day},${Pn(f.value)} Token`,"aria-pressed":i?m:void 0,className:m?"block cursor-pointer rounded-[3px] ring-1 ring-accent transition-[transform,background-color] duration-100 hover:scale-110":"block cursor-pointer rounded-[3px] transition-[transform,background-color] duration-100 hover:scale-110","data-day-index":d,"data-day":f.day,"data-week-index":c,style:{width:r,height:r,background:p},type:"button",onClick:()=>i==null?void 0:i(f.day)},f.day||`e-${c}-${d}`)}))})});function uP({days:e,models:t=[],toolRows:r=[],embedded:n=!1,hidePlatformFilter:i=!1,selectedSources:a,onSelectedSourcesChange:o,selectedDate:s=null,onSelectDate:l}){const{theme:u}=Aw(),[c,f]=h.useState(null),d=a??c,p=o??f,m=h.useMemo(()=>k1(t),[t]),v=h.useMemo(()=>Dm(r,t),[t,r]),y=h.useMemo(()=>Rm(v,d),[v,d]),b=h.useMemo(()=>$m(t),[t]),x=h.useMemo(()=>Um(t,d,null,{activeSources:y}),[y,t,d]),w=h.useMemo(()=>d==null?e:e.map(C=>{const W=C.models??{},I=Lm(W,d,null,{activeSources:y,sourceFallback:b,fallbackShare:x}),Te=Y1(W,d,{activeSources:y,sourceFallback:b});return{...C,tokens:Math.round(C.tokens*I),costUsd:C.costUsd*I,models:Te}}),[y,e,x,d,b]),P=h.useMemo(()=>y1(w.map(C=>({date:C.date,tokens:C.tokens,models:C.models})),od),[w]),O=P.weeks,{containerRef:k,cellSize:j,visibleWeeks:E}=aP(O.length||od),_=h.useMemo(()=>O.slice(-E),[O,E]),M=Pl,T=h.useMemo(()=>b1(_.length,P.to,nP),[_.length,P.to]),[S,N]=h.useState(null),D=h.useRef(null),z=h.useRef(0),K=h.useCallback(C=>{D.current=C,N(C)},[]);h.useEffect(()=>()=>{window.clearTimeout(z.current)},[]);const F=h.useCallback(C=>{var We,_t;const W=C.dataset.day,I=Number(C.dataset.weekIndex),Te=Number(C.dataset.dayIndex),te=(We=_[I])==null?void 0:We[Te];if(!W||!te||(window.clearTimeout(z.current),((_t=D.current)==null?void 0:_t.day)===W)||!C.isConnected)return;const Ce=C.getBoundingClientRect();K({day:W,cell:te,left:Ce.left+Ce.width/2,top:Ce.top,bottom:Ce.bottom})},[K,_]),H=h.useCallback(()=>{window.clearTimeout(z.current),z.current=window.setTimeout(()=>K(null),eP)},[K]),B=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),X=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),ye=S!=null;h.useEffect(()=>{if(!ye)return;const C=()=>K(null);return window.addEventListener("scroll",C,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",C,{capture:!0})},[ye,K]);const ne=`${$u}px repeat(${_.length}, ${j}px)`,Ze=d==null?v:d.filter(C=>v.includes(C)),Le=h.useMemo(()=>d==null?null:new Set(y),[y,d]),_e=(S==null?void 0:S.cell)??null,[ot,Yt]=h.useState(null);if(h.useEffect(()=>{if(!_e){Yt(null);return}Yt(null);const C=window.requestAnimationFrame(()=>{Yt({day:_e.day,entries:sP(_e,m,Le)})});return()=>window.cancelAnimationFrame(C)},[m,Le,_e]),!O.length)return g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"暂无用量数据"});let Ue=null;if(S&&_e){const C=S.top<tP,W=Math.min(Math.max(S.left,Ws),Math.max(Ws,window.innerWidth-Ws));Ue=_i.createPortal(g.jsx("div",{className:"pointer-events-none fixed z-50 w-72 max-w-[calc(100vw-24px)] rounded-[10px] border-0 bg-overlay p-3 text-overlay-foreground shadow-surface",role:"tooltip",style:{left:W,top:C?S.bottom+8:S.top-8,transform:C?"translateX(-50%)":"translate(-50%, -100%)"},children:g.jsx(oP,{cell:_e,heatmapColors:M,isLoading:(ot==null?void 0:ot.day)!==_e.day,modelEntries:(ot==null?void 0:ot.day)===_e.day?ot.entries:[]})}),document.body)}const R=g.jsxs("div",{ref:k,className:"w-full min-w-0",children:[!i||!n?g.jsxs("div",{className:"mb-2 flex items-center justify-end gap-3",children:[n?null:g.jsx("span",{className:"mr-auto text-xs text-muted",children:ed()}),i?null:g.jsx(h1,{allSources:v,value:Ze,onChange:C=>p1(C,v,p)})]}):null,d!=null&&y.length===0?g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"请至少选择一个平台"}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-full overflow-hidden",children:g.jsxs("div",{className:"w-full min-w-0",children:[g.jsxs("div",{className:"mb-1.5 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("span",{}),T.map(C=>g.jsx("span",{style:{gridColumnStart:C.index+2,whiteSpace:"nowrap"},children:C.label},`${C.label}-${C.index}`))]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("div",{className:"pr-1 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateRows:`repeat(7, ${j}px)`,rowGap:Hr},children:rP.map(C=>g.jsx("span",{className:"flex items-center",style:{lineHeight:1},children:C},C))}),g.jsx(lP,{cellSize:j,onBlur:H,onFocus:X,onPointerLeave:H,onPointerOver:B,onSelectDate:l,selectedDate:s,visible:_})]})]})}),g.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:ed()}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-muted",children:"少"}),g.jsx("div",{className:"flex gap-1",children:M.map((C,W)=>g.jsx("span",{className:"size-3 rounded-[2px]",style:{background:C}},W))}),g.jsx("span",{className:"text-[10px] text-muted",children:"多"})]})]}),Ue]})]});return n?R:g.jsx(q,{children:g.jsx(q.Content,{children:R})})}function cP({dailyUsage:e,heatmapDays:t,modelRows:r=[],metricTrends:n,summary:i,selectedDate:a=null,onSelectDate:o}){const s=[{label:"预估费用",value:i.totalCostUsd,format:at,exactFormat:at,trend:{comparison:n.totalCostUsd,display:"percent",values:e.map(l=>l.costUsd)}},{label:"总 Token",value:i.totalTokens,format:oe,exactFormat:Pn,trend:{comparison:n.totalTokens,display:"percent",values:e.map(l=>l.totalTokens)}},{label:"输入 Token",value:i.inputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.inputTokens,display:"tokens",values:e.map(l=>l.inputTokens)}},{label:"输出 Token",value:i.outputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.outputTokens,display:"tokens",values:e.map(l=>l.outputTokens)}}];return g.jsxs("section",{"aria-label":"用量概览",className:"w-full",children:[g.jsx("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:s.map(l=>{var u;return g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid h-full grid-rows-[1.25rem_1fr] content-start gap-3 p-0",children:[g.jsxs("div",{className:"flex h-5 min-w-0 items-center justify-between gap-2",children:[g.jsx("p",{className:"min-w-0 truncate text-xs font-medium leading-5 text-muted",children:l.label}),g.jsx("div",{className:"flex h-5 shrink-0 items-center justify-end",children:l.trend.comparison?g.jsx(pP,{display:l.trend.display,trend:l.trend.comparison}):null})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(dP,{exactFormat:l.exactFormat,format:l.format,label:l.label,value:l.value}),g.jsx(hP,{isIncrease:(((u=l.trend.comparison)==null?void 0:u.changeValue)??0)>=0,label:`近 7 日${l.label}趋势`,values:l.trend.values})]})]})},l.label)})}),g.jsx(q,{className:"mt-4",children:g.jsx(q.Content,{children:g.jsx(fP,{days:t,modelRows:r,onSelectDate:o,selectedDate:a})})})]})}function fP({days:e,modelRows:t,selectedDate:r,onSelectDate:n}){return g.jsx(uP,{days:e,embedded:!0,models:t,onSelectDate:n,selectedDate:r})}function dP({exactFormat:e,format:t,label:r,value:n}){const i=vP(n);return g.jsx("div",{"aria-label":`${r} ${e(n)}`,className:"min-w-0 truncate text-lg font-semibold leading-7 tracking-tight text-foreground tabular-nums",title:e(n),children:t(i)})}function hP({label:e,values:t,isIncrease:r}){const n=h.useId().replace(/:/g,""),i=h.useMemo(()=>t.filter(p=>Number.isFinite(p)),[t]);if(i.length<2)return g.jsx("div",{"aria-hidden":"true",className:"h-6 w-16 justify-self-end"});const a=64,o=24,s=2,l=Math.min(...i),c=Math.max(...i)-l||1,f=r?"var(--chart-2)":"var(--chart-5)",d=i.map((p,m)=>{const v=s+m/Math.max(i.length-1,1)*(a-s*2),y=o-s-(p-l)/c*(o-s*2);return`${m===0?"M":"L"} ${v.toFixed(2)} ${y.toFixed(2)}`}).join(" ");return g.jsx("div",{"aria-label":e,className:"pointer-events-none h-6 w-16 justify-self-end",role:"img",children:g.jsxs("svg",{"aria-hidden":"true",className:"h-full w-full overflow-visible",viewBox:`0 0 ${a} ${o}`,children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:f,stopOpacity:.24}),g.jsx("stop",{offset:"100%",stopColor:f,stopOpacity:0})]})}),g.jsx("path",{d:`${d} L ${a-s} ${o} L ${s} ${o} Z`,fill:`url(#${n})`}),g.jsx("path",{d,fill:"none",stroke:f,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})]})})}function pP({display:e,trend:t}){const r=t.changeValue>=0,n=r?"上涨":"下降",i=e==="tokens"?`${r?"+":"−"}${oe(Math.abs(t.changeValue))}`:`${Math.abs(t.changePct).toFixed(1)}%`;return g.jsxs(Ia,{"aria-label":`${n} ${i}`,className:"shrink-0",color:r?"success":"danger",size:"sm",variant:"soft",children:[g.jsx("span",{"aria-hidden":"true",children:r?"↑":"↓"}),g.jsx(Ia.Label,{className:"tabular-nums",children:i})]})}function vP(e,t=1200){const[r,n]=h.useState(e),i=h.useRef(e);return h.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){i.current=e,n(e);return}const a=i.current;if(Object.is(a,e)||Math.abs(a-e)<1e-9){i.current=e,n(e);return}let o=0;const s=performance.now(),l=u=>{const c=Math.min((u-s)/t,1),f=1-Math.pow(1-c,3),d=a+(e-a)*f;i.current=d,n(d),c<1&&(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>cancelAnimationFrame(o)},[t,e]),r}const La=[{id:"hawking",image:Sw,glow:{primary:"#ff7a1a",accent:"#ffd21f"}},{id:"yoyo",image:Ew,glow:{primary:"#2f7df6",accent:"#ffd84a"}},{id:"click",image:_w,glow:{primary:"#51d6a2",accent:"#ff7b8d"}}],un=72,mP=110,gP=2400,sd=80,ld=88;function ud(e){const t=La.filter(n=>n.id!==e),r=t.length>0?t:La;return r[Math.floor(Math.random()*r.length)].id}function yP(){const[e,t]=h.useState(()=>ud()),r=h.useRef(null);h.useEffect(()=>{const a=window.setInterval(()=>{t(o=>ud(o))},gP);return()=>window.clearInterval(a)},[]),h.useEffect(()=>{const a=r.current;if(!a)return;let o=0,s=null,l=-un,u=1;const c=f=>{if(o=requestAnimationFrame(c),s==null){s=f;return}const d=Math.min(.05,(f-s)/1e3);s=f,l+=u*mP*d,l>=un?(l=un,u=-1):l<=-un&&(l=-un,u=1),a.style.transform=`translateX(${l}px) scaleX(${u>0?1:-1})`};return o=requestAnimationFrame(c),()=>cancelAnimationFrame(o)},[e]);const n=La.find(a=>a.id===e)??La[0],i=sd+un*2;return g.jsx("div",{"aria-hidden":"true",className:"pet-running-loader",style:{width:i,height:ld,"--pet-glow-primary":n.glow.primary,"--pet-glow-accent":n.glow.accent},children:g.jsx("img",{alt:"",className:"pet-running-loader__sprite",height:ld,ref:r,src:n.image,width:sd})})}const cd=["小伙伴跑腿去了…","数据在前面,冲!","再跑两步就好…","正在追 Token…","加载加速中,呼呼~","马上就回来~","别急,它跑得很快","捡数据路上…"],bP=1800;function Ks(e){const t=cd.filter(n=>n!==e),r=t.length>0?t:cd;return r[Math.floor(Math.random()*r.length)]}function fd({visible:e}){const[t,r]=h.useState(()=>Ks());return h.useEffect(()=>{if(!e)return;r(Ks());const n=window.setInterval(()=>{r(i=>Ks(i))},bP);return()=>window.clearInterval(n)},[e]),e?g.jsx("div",{"aria-busy":"true","aria-live":"polite",className:"absolute inset-0 z-10 bg-background/40",role:"status",children:g.jsx("div",{className:"pointer-events-none fixed inset-0 z-10 flex items-center justify-center",children:g.jsxs("div",{className:"relative flex items-center justify-center",children:[g.jsx(yP,{}),g.jsx("p",{className:"absolute top-full mt-3 min-h-5 w-max text-center text-sm text-muted transition-opacity duration-200",children:t},t)]})})}):null}var xP=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Ru(e){if(typeof e!="string")return!1;var t=xP;return t.includes(e)}var wP=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],PP=new Set(wP);function zm(e){return typeof e!="string"?!1:PP.has(e)}function Bm(e){return typeof e=="string"&&e.startsWith("data-")}function et(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(zm(r)||Bm(r))&&(t[r]=e[r]);return t}function Xr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return et(t)}return typeof e=="object"&&!Array.isArray(e)?et(e):null}function Ve(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(zm(r)||Bm(r)||Ru(r))&&(t[r]=e[r]);return t}function kP(e){return e==null?null:h.isValidElement(e)?Ve(e.props):typeof e=="object"&&!Array.isArray(e)?Ve(e):null}var OP=["children","width","height","viewBox","className","style","title","desc"];function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jl.apply(null,arguments)}function jP(e,t){if(e==null)return{};var r,n,i=AP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function AP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Fm=h.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,c=jP(e,OP),f=a||{width:n,height:i,x:0,y:0},d=Z("recharts-surface",o);return h.createElement("svg",jl({},Ve(c),{className:d,width:n,height:i,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,u),r)}),SP=["children","className"];function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Al.apply(null,arguments)}function EP(e,t){if(e==null)return{};var r,n,i=_P(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _P(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var he=h.forwardRef((e,t)=>{var{children:r,className:n}=e,i=EP(e,SP),a=Z("recharts-layer",n);return h.createElement("g",Al({className:a},Ve(i),{ref:t}),r)}),TP=h.createContext(null);function ae(e){return function(){return e}}const Wm=Math.cos,Ua=Math.sin,St=Math.sqrt,za=Math.PI,zo=2*za,Sl=Math.PI,El=2*Sl,Rr=1e-6,CP=El-Rr;function Km(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function MP(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Km;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class IP{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Km:MP(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=n-t,u=i-r,c=o-t,f=s-r,d=c*c+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Rr)if(!(Math.abs(f*l-u*c)>Rr)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,m=i-s,v=l*l+u*u,y=p*p+m*m,b=Math.sqrt(v),x=Math.sqrt(d),w=a*Math.tan((Sl-Math.acos((v+d-y)/(2*b*x)))/2),P=w/x,O=w/b;Math.abs(P-1)>Rr&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*p>c*m)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),l=n*Math.sin(i),u=t+s,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Rr||Math.abs(this._y1-c)>Rr)&&this._append`L${u},${c}`,n&&(d<0&&(d=d%El+El),d>CP?this._append`A${n},${n},0,1,${f},${t-s},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=c}`:d>Rr&&this._append`A${n},${n},0,${+(d>=Sl)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Lu(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new IP(t)}function Uu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Hm(e){this._context=e}Hm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Bo(e){return new Hm(e)}function Gm(e){return e[0]}function qm(e){return e[1]}function Ym(e,t){var r=ae(!0),n=null,i=Bo,a=null,o=Lu(s);e=typeof e=="function"?e:e===void 0?Gm:ae(e),t=typeof t=="function"?t:t===void 0?qm:ae(t);function s(l){var u,c=(l=Uu(l)).length,f,d=!1,p;for(n==null&&(a=i(p=o())),u=0;u<=c;++u)!(u<c&&r(f=l[u],u,l))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(f,u,l),+t(f,u,l));if(p)return a=null,p+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:ae(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),s):t},s.defined=function(l){return arguments.length?(r=typeof l=="function"?l:ae(!!l),s):r},s.curve=function(l){return arguments.length?(i=l,n!=null&&(a=i(n)),s):i},s.context=function(l){return arguments.length?(l==null?n=a=null:a=i(n=l),s):n},s}function oa(e,t,r){var n=null,i=ae(!0),a=null,o=Bo,s=null,l=Lu(u);e=typeof e=="function"?e:e===void 0?Gm:ae(+e),t=typeof t=="function"?t:ae(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?qm:ae(+r);function u(f){var d,p,m,v=(f=Uu(f)).length,y,b=!1,x,w=new Array(v),P=new Array(v);for(a==null&&(s=o(x=l())),d=0;d<=v;++d){if(!(d<v&&i(y=f[d],d,f))===b)if(b=!b)p=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),m=d-1;m>=p;--m)s.point(w[m],P[m]);s.lineEnd(),s.areaEnd()}b&&(w[d]=+e(y,d,f),P[d]=+t(y,d,f),s.point(n?+n(y,d,f):w[d],r?+r(y,d,f):P[d]))}if(x)return s=null,x+""||null}function c(){return Ym().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:ae(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:ae(+f),u):r},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(r)},u.lineX1=function(){return c().x(n).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:ae(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),u):a},u}class Vm{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function NP(e){return new Vm(e,!0)}function DP(e){return new Vm(e,!1)}const zu={draw(e,t){const r=St(t/za);e.moveTo(r,0),e.arc(0,0,r,0,zo)}},$P={draw(e,t){const r=St(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Xm=St(1/3),RP=Xm*2,LP={draw(e,t){const r=St(t/RP),n=r*Xm;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},UP={draw(e,t){const r=St(t),n=-r/2;e.rect(n,n,r,r)}},zP=.8908130915292852,Zm=Ua(za/10)/Ua(7*za/10),BP=Ua(zo/10)*Zm,FP=-Wm(zo/10)*Zm,WP={draw(e,t){const r=St(t*zP),n=BP*r,i=FP*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=zo*a/5,s=Wm(o),l=Ua(o);e.lineTo(l*r,-s*r),e.lineTo(s*n-l*i,l*n+s*i)}e.closePath()}},Hs=St(3),KP={draw(e,t){const r=-St(t/(Hs*3));e.moveTo(0,r*2),e.lineTo(-Hs*r,-r),e.lineTo(Hs*r,-r),e.closePath()}},dt=-.5,ht=St(3)/2,_l=1/St(12),HP=(_l/2+1)*3,GP={draw(e,t){const r=St(t/HP),n=r/2,i=r*_l,a=n,o=r*_l+r,s=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(dt*n-ht*i,ht*n+dt*i),e.lineTo(dt*a-ht*o,ht*a+dt*o),e.lineTo(dt*s-ht*l,ht*s+dt*l),e.lineTo(dt*n+ht*i,dt*i-ht*n),e.lineTo(dt*a+ht*o,dt*o-ht*a),e.lineTo(dt*s+ht*l,dt*l-ht*s),e.closePath()}};function qP(e,t){let r=null,n=Lu(i);e=typeof e=="function"?e:ae(e||zu),t=typeof t=="function"?t:ae(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:ae(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Ba(){}function Fa(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Jm(e){this._context=e}Jm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Fa(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YP(e){return new Jm(e)}function Qm(e){this._context=e}Qm.prototype={areaStart:Ba,areaEnd:Ba,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VP(e){return new Qm(e)}function eg(e){this._context=e}eg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XP(e){return new eg(e)}function tg(e){this._context=e}tg.prototype={areaStart:Ba,areaEnd:Ba,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ZP(e){return new tg(e)}function dd(e){return e<0?-1:1}function hd(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(dd(a)+dd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function pd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Gs(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,i+s*t,a-s,o-s*r,a,o)}function Wa(e){this._context=e}Wa.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Gs(this,this._t0,pd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Gs(this,pd(this,r=hd(this,e,t)),r);break;default:Gs(this,this._t0,r=hd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function rg(e){this._context=new ng(e)}(rg.prototype=Object.create(Wa.prototype)).point=function(e,t){Wa.prototype.point.call(this,t,e)};function ng(e){this._context=e}ng.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function JP(e){return new Wa(e)}function QP(e){return new rg(e)}function ig(e){this._context=e}ig.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=vd(e),i=vd(t),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function vd(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ek(e){return new ig(e)}function Fo(e,t){this._context=e,this._t=t}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function tk(e){return new Fo(e,.5)}function rk(e){return new Fo(e,0)}function nk(e){return new Fo(e,1)}function Zr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,s=a.length;r<o;++r)for(i=a,a=e[t[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Tl(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function ik(e,t){return e[t]}function ak(e){const t=[];return t.key=e,t}function ok(){var e=ae([]),t=Tl,r=Zr,n=ik;function i(a){var o=Array.from(e.apply(this,arguments),ak),s,l=o.length,u=-1,c;for(const f of a)for(s=0,++u;s<l;++s)(o[s][u]=[0,+n(f,o[s].key,u,a)]).data=f;for(s=0,c=Uu(t(o));s<l;++s)o[c[s]].index=s;return r(o,c),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:ae(Array.from(a)),i):e},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),i):n},i.order=function(a){return arguments.length?(t=a==null?Tl:typeof a=="function"?a:ae(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(r=a??Zr,i):r},i}function sk(e,t){if((n=e.length)>0){for(var r,n,i=0,a=e[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Zr(e,t)}}function lk(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,a=n.length;r<a;++r){for(var o=0,s=0;o<i;++o)s+=e[o][r][1]||0;n[r][1]+=n[r][0]=-s/2}Zr(e,t)}}function uk(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var s=0,l=0,u=0;s<o;++s){for(var c=e[t[s]],f=c[n][1]||0,d=c[n-1][1]||0,p=(f-d)/2,m=0;m<s;++m){var v=e[t[m]],y=v[n][1]||0,b=v[n-1][1]||0;p+=y-b}l+=f,u+=p*f}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Zr(e,t)}}function Cl(e){return e==="__proto__"}function ag(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Bu(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function og(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(og).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Fu(e){if(Array.isArray(e))return e.map(Bu);if(typeof e=="symbol")return[e];e=og(e);const t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&t.push("");n<r;){const s=e[n];if(a)s==="\\"&&n+1<r?(n++,i+=e[n]):s===a?a="":i+=s;else if(o)s==='"'||s==="'"?a=s:s==="]"?(o=!1,t.push(i),i=""):i+=s;else if(s==="[")o=!0,i&&(t.push(i),i="");else if(s==="."){i&&(t.push(i),i="");const l=e[n+1];(l===void 0||l===".")&&t.push("")}else i+=s;n++}return i&&t.push(i),t}function zt(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(Cl(t))return r;const n=e[t];return n===void 0?ag(t)&&!Object.hasOwn(e,t)?zt(e,Fu(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=Bu(t));const n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return ck(e,t,r);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),Cl(t))return r;const n=e[t];return n===void 0?r:n}}}function ck(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||Cl(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}var fk=4;function gr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fk,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function me(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((i,a,o)=>{var s=r[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+gr(s)+a:i+a},"")}var Ne=e=>e===0?0:e>0?1:-1,jt=e=>typeof e=="number"&&e!=+e,Jr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,$=e=>(typeof e=="number"||e instanceof Number)&&!jt(e),Bt=e=>$(e)||typeof e=="string",dk=0,di=e=>{var t=++dk;return"".concat(e||"").concat(t)},Ye=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!$(t)&&typeof t!="string")return n;var a;if(Jr(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return jt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},sg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function Q(e,t,r){return $(e)&&$(t)?gr(e+r*(t-e)):t}function lg(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):zt(n,t))===r)}var ce=e=>e===null||typeof e>"u",Ci=e=>ce(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function nt(e){return e!=null}function ar(){}var hk=["type","size","sizeType"];function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ml.apply(null,arguments)}function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?md(Object(r),!0).forEach(function(n){pk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):md(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pk(e,t,r){return(t=vk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vk(e){var t=mk(e,"string");return typeof t=="symbol"?t:t+""}function mk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gk(e,t){if(e==null)return{};var r,n,i=yk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function yk(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var ug={symbolCircle:zu,symbolCross:$P,symbolDiamond:LP,symbolSquare:UP,symbolStar:WP,symbolTriangle:KP,symbolWye:GP},bk=Math.PI/180,xk=e=>{var t="symbol".concat(Ci(e));return ug[t]||zu},wk=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*bk;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Pk=(e,t)=>{ug["symbol".concat(Ci(e))]=t},cg=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=gk(e,hk),a=gd(gd({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var d=xk(o),p=qP().type(d).size(wk(r,n,o)),m=p();if(m!==null)return m},{className:l,cx:u,cy:c}=a,f=Ve(a);return $(u)&&$(c)&&$(r)?h.createElement("path",Ml({},f,{className:Z("recharts-symbols",l),transform:"translate(".concat(u,", ").concat(c,")"),d:s()})):null};cg.registerSymbol=Pk;var fg=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Wu=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Ru(i)&&typeof r[i]=="function"&&(n[i]=(a=>r[i](r,a)))}),n},kk=(e,t,r)=>n=>(e(t,r,n),null),Wo=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];Ru(i)&&typeof a=="function"&&(n||(n={}),n[i]=kk(a,t,r))}),n};function yd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ok(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yd(Object(r),!0).forEach(function(n){jk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jk(e,t,r){return(t=Ak(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ak(e){var t=Sk(e,"string");return typeof t=="symbol"?t:t+""}function Sk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function je(e,t){var r=Ok({},e),n=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&n[s]!==void 0&&(o[s]=n[s]),o),r);return a}function Ek(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],a=t(i,n,e);r.has(a)||r.set(a,i)}return Array.from(r.values())}function _k(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}function dg(e){return e}function Tk(e){return function(t){return zt(t,e)}}function Il(e){return e==null||typeof e!="object"&&typeof e!="function"}function Ck(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Mk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ku(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Ik="[object RegExp]",hg="[object String]",pg="[object Number]",vg="[object Boolean]",mg="[object Arguments]",Nk="[object Symbol]",Dk="[object Date]",$k="[object Map]",Rk="[object Set]",Lk="[object Array]",Uk="[object ArrayBuffer]",zk="[object Object]",Bk="[object DataView]",Fk="[object Uint8Array]",Wk="[object Uint8ClampedArray]",Kk="[object Uint16Array]",Hk="[object Uint32Array]",Gk="[object Int8Array]",qk="[object Int16Array]",Yk="[object Int32Array]",Vk="[object Float32Array]",Xk="[object Float64Array]",bd=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Zk(e){return typeof bd.Buffer<"u"&&bd.Buffer.isBuffer(e)}function Jk(e,t){return zr(e,void 0,e,new Map,t)}function zr(e,t,r,n=new Map,i=void 0){const a=i==null?void 0:i(e,t,r,n);if(a!==void 0)return a;if(Il(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const o=new Array(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;n.set(e,o);for(const[s,l]of e)o.set(s,zr(l,s,r,n,i));return o}if(e instanceof Set){const o=new Set;n.set(e,o);for(const s of e)o.add(zr(s,void 0,r,n,i));return o}if(Zk(e))return e.subarray();if(Ck(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),bt(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Error){const o=structuredClone(e);return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,o.constructor=e.constructor,bt(o,e,r,n,i),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Number){const o=new Number(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof String){const o=new String(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(typeof e=="object"&&Qk(e)){const o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),bt(o,e,r,n,i),o}return e}function bt(e,t,r=e,n,i){const a=[...Object.keys(t),...Mk(t)];for(let o=0;o<a.length;o++){const s=a[o],l=Object.getOwnPropertyDescriptor(e,s);(l==null||l.writable)&&(e[s]=zr(t[s],s,r,n,i))}}function Qk(e){switch(Ku(e)){case mg:case Lk:case Uk:case Bk:case vg:case Dk:case Vk:case Xk:case Gk:case qk:case Yk:case $k:case pg:case zk:case Ik:case Rk:case hg:case Nk:case Fk:case Wk:case Kk:case Hk:return!0;default:return!1}}function eO(e){return zr(e,void 0,e,new Map,void 0)}function ja(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function gg(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function yg(e,t,r){return typeof r!="function"?yg(e,t,()=>{}):Nl(e,t,function n(i,a,o,s,l,u){const c=r(i,a,o,s,l,u);return c!==void 0?!!c:Nl(i,a,n,u,!1)},new Map,!0)}function Nl(e,t,r,n,i=!1){if(t===e)return!0;switch(typeof t){case"object":return tO(e,t,r,n);case"function":return Object.keys(t).length>0?Nl(e,{...t},r,n,i):ja(e,t);default:return gg(e)&&i?typeof t=="string"?t==="":!0:ja(e,t)}}function tO(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return bg(e,t,r,n);if(t instanceof Map)return rO(e,t,r,n);if(t instanceof Set)return nO(e,t,r,n);const i=Object.keys(t);if(e==null||Il(e))return i.length===0;if(i.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let a=0;a<i.length;a++){const o=i[a];if(!Il(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n==null||n.delete(t)}}function rO(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(r(e.get(i),a,i,e,t,n)===!1)return!1;return!0}function bg(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a<t.length;a++){const o=t[a];let s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;const u=e[l];let c=!1;if(r(u,o,a,e,t,n)&&(c=!0),c){i.add(l),s=!0;break}}if(!s)return!1}return!0}function nO(e,t,r,n){return t.size===0?!0:e instanceof Set?bg([...e],[...t],r,n):!1}function xg(e,t){return yg(e,t,()=>{})}function iO(e){return e=eO(e),t=>xg(t,e)}function aO(e,t){return Jk(e,(r,n,i,a)=>{if(typeof e=="object"){if(Ku(e)==="[object Object]"&&typeof e.constructor!="function"){const o={};return a.set(e,o),bt(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case pg:case hg:case vg:{const o=new e.constructor(e==null?void 0:e.valueOf());return bt(o,e),o}case mg:{const o={};return bt(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function oO(e){return aO(e)}const sO=/^(?:0|[1-9]\d*)$/;function wg(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return sO.test(e)}}function lO(e){return e!==null&&typeof e=="object"&&Ku(e)==="[object Arguments]"}function uO(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&ag(t)&&(e==null?void 0:e[t])==null?r=Fu(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){const a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||lO(n))&&wg(a)&&a<n.length))return!1;n=n[a]}return!0}function cO(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=Bu(e);break}return t=oO(t),function(r){const n=zt(r,e);return n===void 0?uO(r,e):t===void 0?n===void 0:xg(n,t)}}function fO(e){if(e==null)return dg;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?cO(e[0],e[1]):iO(e);case"string":case"symbol":case"number":return Tk(e)}}function dO(e){return Number.isSafeInteger(e)&&e>=0}function Pg(e){return e!=null&&typeof e!="function"&&dO(e.length)}function hO(e){return typeof e=="object"&&e!==null}function pO(e){return hO(e)&&Pg(e)}function xd(e,t=dg){return pO(e)?Ek(Array.from(e),_k(fO(t),1)):[]}function vO(e,t,r){return t===!0?xd(e,r):typeof t=="function"?xd(e,t):e}var Hu=h.createContext(null),mO=e=>e,se=()=>{var e=h.useContext(Hu);return e?e.store.dispatch:mO},Aa=()=>{},gO=()=>Aa,yO=(e,t)=>e===t;function U(e){var t=h.useContext(Hu),r=h.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Aa,[t,e]);return Tw.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:gO,t?t.store.getState:Aa,t?t.store.getState:Aa,r,yO)}function bO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function xO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function wO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var wd=e=>Array.isArray(e)?e:[e];function PO(e){const t=Array.isArray(e[0])?e[0]:e;return wO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function kO(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var OO=class{constructor(e){this.value=e}deref(){return this.value}},jO=typeof WeakRef<"u"?WeakRef:OO,AO=0,Pd=1;function sa(){return{s:AO,v:void 0,o:null,p:null}}function kg(e,t={}){let r=sa();const{resultEqualityCheck:n}=t;let i,a=0;function o(){var f;let s=r;const{length:l}=arguments;for(let d=0,p=l;d<p;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let v=s.o;v===null&&(s.o=v=new WeakMap);const y=v.get(m);y===void 0?(s=sa(),v.set(m,s)):s=y}else{let v=s.p;v===null&&(s.p=v=new Map);const y=v.get(m);y===void 0?(s=sa(),v.set(m,s)):s=y}}const u=s;let c;if(s.s===Pd)c=s.v;else if(c=e.apply(null,arguments),a++,n){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&n(d,c)&&(c=d,a!==0&&a--),i=typeof c=="object"&&c!==null||typeof c=="function"?new jO(c):c}return u.s=Pd,u.v=c,c}return o.clearCache=()=>{r=sa(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function SO(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,s,l={},u=i.pop();typeof u=="object"&&(l=u,u=i.pop()),bO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:p=kg,argsMemoizeOptions:m=[]}=c,v=wd(d),y=wd(m),b=PO(i),x=f(function(){return a++,u.apply(null,arguments)},...v),w=p(function(){o++;const O=kO(b,arguments);return s=x.apply(null,O),s},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:x,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var A=SO(kg),EO=Object.assign((e,t=A)=>{xO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,s,l)=>(o[r[l]]=s,o),{}))},{withTypes:()=>EO});function _O(e,t=1){const r=[],n=Math.floor(t),i=(a,o)=>{for(let s=0;s<a.length;s++){const l=a[s];Array.isArray(l)&&o<n?i(l,o+1):r.push(l)}};return i(e,0),r}function Dl(e,t,r){return gg(r)&&(typeof t=="number"&&Pg(r)&&wg(t)&&t<r.length||typeof t=="string"&&t in r)?ja(r[t],e):!1}function kd(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const TO=(e,t,r)=>{if(e!==t){const n=kd(e),i=kd(t);if(n===i&&n===0){if(e<t)return r==="desc"?1:-1;if(e>t)return r==="desc"?-1:1}return r==="desc"?i-n:n-i}return 0};function Og(e){return typeof e=="symbol"||e instanceof Symbol}const CO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MO=/^\w*$/;function IO(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||Og(e)?!0:typeof e=="string"&&(MO.test(e)||!CO.test(e))||t!=null}function NO(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(s=>String(s));const i=(s,l)=>{let u=s;for(let c=0;c<l.length&&u!=null;++c)u=u[l[c]];return u},a=(s,l)=>l==null||s==null?l:typeof s=="object"&&"key"in s?Object.hasOwn(l,s.key)?l[s.key]:i(l,s.path):typeof s=="function"?s(l):Array.isArray(s)?i(l,s):typeof l=="object"?l[s]:l,o=t.map(s=>(Array.isArray(s)&&s.length===1&&(s=s[0]),s==null||typeof s=="function"||Array.isArray(s)||IO(s)?s:{key:s,path:Fu(s)}));return e.map(s=>({original:s,criteria:o.map(l=>a(l,s))})).slice().sort((s,l)=>{for(let u=0;u<o.length;u++){const c=TO(s.criteria[u],l.criteria[u],r[u]);if(c!==0)return c}return 0}).map(s=>s.original)}function Ko(e,...t){const r=t.length;return r>1&&Dl(e,t[0],t[1])?t=[]:r>2&&Dl(t[0],t[1],t[2])&&(t=[t[0]]),NO(e,_O(t),["asc"])}var jg=e=>e.legend.settings,DO=e=>e.legend.size,$O=e=>e.legend.payload;A([$O,jg],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Ko(n,r):n});var la=1;function RO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>la||Math.abs(o.left-t.left)>la||Math.abs(o.top-t.top)>la||Math.abs(o.width-t.width)>la)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var LO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Od=LO,qs=()=>Math.random().toString(36).substring(7).split("").join("."),UO={INIT:`@@redux/INIT${qs()}`,REPLACE:`@@redux/REPLACE${qs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qs()}`},Ka=UO;function Gu(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ag(e,t,r){if(typeof e!="function")throw new Error(ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ze(1));return r(Ag)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((y,b)=>{o.set(b,y)}))}function c(){if(l)throw new Error(ze(3));return i}function f(y){if(typeof y!="function")throw new Error(ze(4));if(l)throw new Error(ze(5));let b=!0;u();const x=s++;return o.set(x,y),function(){if(b){if(l)throw new Error(ze(6));b=!1,u(),o.delete(x),a=null}}}function d(y){if(!Gu(y))throw new Error(ze(7));if(typeof y.type>"u")throw new Error(ze(8));if(typeof y.type!="string")throw new Error(ze(17));if(l)throw new Error(ze(9));try{l=!0,i=n(i,y)}finally{l=!1}return(a=o).forEach(x=>{x()}),y}function p(y){if(typeof y!="function")throw new Error(ze(10));n=y,d({type:Ka.REPLACE})}function m(){const y=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ze(11));function x(){const P=b;P.next&&P.next(c())}return x(),{unsubscribe:y(x)}},[Od](){return this}}}return d({type:Ka.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[Od]:m}}function zO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ka.INIT})>"u")throw new Error(ze(12));if(typeof r(void 0,{type:Ka.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ze(13))})}function Sg(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{zO(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],d=r[f],p=o[f],m=d(p,s);if(typeof m>"u")throw s&&s.type,new Error(ze(14));u[f]=m,l=l||m!==p}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Ha(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function BO(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ze(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=Ha(...s)(i.dispatch),{...i,dispatch:a}}}function Eg(e){return Gu(e)&&"type"in e&&typeof e.type=="string"}var _g=Symbol.for("immer-nothing"),jd=Symbol.for("immer-draftable"),tt=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var lt=Object,_n=lt.getPrototypeOf,Ga="constructor",Ho="prototype",$l="configurable",qa="enumerable",Sa="writable",hi="value",er=e=>!!e&&!!e[tt];function At(e){var t;return e?Tg(e)||qo(e)||!!e[jd]||!!((t=e[Ga])!=null&&t[jd])||Yo(e)||Vo(e):!1}var FO=lt[Ho][Ga].toString(),Ad=new WeakMap;function Tg(e){if(!e||!qu(e))return!1;const t=_n(e);if(t===null||t===lt[Ho])return!0;const r=lt.hasOwnProperty.call(t,Ga)&&t[Ga];if(r===Object)return!0;if(!gn(r))return!1;let n=Ad.get(r);return n===void 0&&(n=Function.toString.call(r),Ad.set(r,n)),n===FO}function Go(e,t,r=!0){Mi(e)===0?(r?Reflect.ownKeys(e):lt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Mi(e){const t=e[tt];return t?t.type_:qo(e)?1:Yo(e)?2:Vo(e)?3:0}var Ys=(e,t,r=Mi(e))=>r===2?e.has(t):lt[Ho].hasOwnProperty.call(e,t),Rl=(e,t,r=Mi(e))=>r===2?e.get(t):e[t],Ya=(e,t,r,n=Mi(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function WO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var qo=Array.isArray,Yo=e=>e instanceof Map,Vo=e=>e instanceof Set,qu=e=>typeof e=="object",gn=e=>typeof e=="function",Vs=e=>typeof e=="boolean";function KO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var It=e=>e.copy_||e.base_,Yu=e=>e.modified_?e.copy_:e.base_;function Ll(e,t){if(Yo(e))return new Map(e);if(Vo(e))return new Set(e);if(qo(e))return Array[Ho].slice.call(e);const r=Tg(e);if(t===!0||t==="class_only"&&!r){const n=lt.getOwnPropertyDescriptors(e);delete n[tt];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s[Sa]===!1&&(s[Sa]=!0,s[$l]=!0),(s.get||s.set)&&(n[o]={[$l]:!0,[Sa]:!0,[qa]:s[qa],[hi]:e[o]})}return lt.create(_n(e),n)}else{const n=_n(e);if(n!==null&&r)return{...e};const i=lt.create(n);return lt.assign(i,e)}}function Vu(e,t=!1){return Xo(e)||er(e)||!At(e)||(Mi(e)>1&&lt.defineProperties(e,{set:ua,add:ua,clear:ua,delete:ua}),lt.freeze(e),t&&Go(e,(r,n)=>{Vu(n,!0)},!1)),e}function HO(){Pt(2)}var ua={[hi]:HO};function Xo(e){return e===null||!qu(e)?!0:lt.isFrozen(e)}var Va="MapSet",Ul="Patches",Sd="ArrayMethods",Cg={};function Qr(e){const t=Cg[e];return t||Pt(0,e),t}var Ed=e=>!!Cg[e],pi,Mg=()=>pi,GO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ed(Va)?Qr(Va):void 0,arrayMethodsPlugin_:Ed(Sd)?Qr(Sd):void 0});function _d(e,t){t&&(e.patchPlugin_=Qr(Ul),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zl(e){Bl(e),e.drafts_.forEach(qO),e.drafts_=null}function Bl(e){e===pi&&(pi=e.parent_)}var Td=e=>pi=GO(pi,e);function qO(e){const t=e[tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Cd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[tt].modified_&&(zl(t),Pt(4)),At(e)&&(e=Md(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[tt].base_,e,t)}else e=Md(t,r);return YO(t,e,!0),zl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_g?e:void 0}function Md(e,t){if(Xo(t))return t;const r=t[tt];if(!r)return Xa(t,e.handledSet_,e);if(!Zo(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Dg(r,e)}return r.copy_}function YO(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vu(t,r)}function Ig(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Zo=(e,t)=>e.scope_===t,VO=[];function Ng(e,t,r,n){const i=It(e),a=e.type_;if(n!==void 0&&Rl(i,n,a)===t){Ya(i,n,r,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;Go(i,(l,u)=>{if(er(u)){const c=s.get(u)||[];c.push(l),s.set(u,c)}})}const o=e.draftLocations_.get(t)??VO;for(const s of o)Ya(i,s,r,a)}function XO(e,t,r){e.callbacks_.push(function(i){var s;const a=t;if(!a||!Zo(a,i))return;(s=i.mapSetPlugin_)==null||s.fixSetContents(a);const o=Yu(a);Ng(e,a.draft_??a,o,r),Dg(a,i)})}function Dg(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}Ig(e)}}function ZO(e,t,r){const{scope_:n}=e;if(er(r)){const i=r[tt];Zo(i,n)&&i.callbacks_.push(function(){Ea(e);const o=Yu(i);Ng(e,r,o,t)})}else At(r)&&e.callbacks_.push(function(){const a=It(e);e.type_===3?a.has(r)&&Xa(r,n.handledSet_,n):Rl(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Xa(Rl(e.copy_,t,e.type_),n.handledSet_,n)})}function Xa(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||er(e)||t.has(e)||!At(e)||Xo(e)||(t.add(e),Go(e,(n,i)=>{if(er(i)){const a=i[tt];if(Zo(a,r)){const o=Yu(a);Ya(e,n,o,e.type_),Ig(a)}}else At(i)&&Xa(i,t,r)})),e}function JO(e,t){const r=qo(e),n={type_:r?1:0,scope_:t?t.scope_:Mg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Za;r&&(i=[n],a=vi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,[s,n]}var Za={get(e,t){if(t===tt)return e;if(t==="constructor"||t==="__proto__"){const s=It(e)[t];return new Proxy(s||{},{get:(l,u)=>u==="__proto__"||u==="prototype"?Object.freeze(Object.create(null)):Reflect.get(l,u),set:()=>!0,apply:(l,u,c)=>Reflect.apply(l,u,c)})}let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=It(e);if(!Ys(i,t,e.type_))return QO(e,i,t);const a=i[t];if(e.finalized_||!At(a)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&KO(t))return a;if(a===Xs(e.base_,t)){Ea(e);const o=e.type_===1?+t:t,s=Wl(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t==="constructor"||t==="__proto__"||t==="prototype"?!1:t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,r){if(t==="constructor"||t==="__proto__"||t==="prototype")return!0;const n=$g(It(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Xs(It(e),t),a=i==null?void 0:i[tt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(WO(r,i)&&(r!==void 0||Ys(e.base_,t,e.type_)))return!0;Ea(e),Fl(e)}return e.copy_[t]===r&&(r!==void 0||Ys(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),ZO(e,t,r)),!0},deleteProperty(e,t){return Ea(e),Xs(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Fl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=It(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Sa]:!0,[$l]:e.type_!==1||t!=="length",[qa]:n[qa],[hi]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return _n(e.base_)},setPrototypeOf(){Pt(12)}},vi={};for(let e in Za){let t=Za[e];vi[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}vi.deleteProperty=function(e,t){return vi.set.call(this,e,t,void 0)};vi.set=function(e,t,r){return Za.set.call(this,e[0],t,r,e[0])};function Xs(e,t){const r=e[tt];return(r?It(r):e)[t]}function QO(e,t,r){var i;const n=$g(t,r);return n?hi in n?n[hi]:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function $g(e,t){if(!(t in e))return;let r=_n(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=_n(r)}}function Fl(e){e.modified_||(e.modified_=!0,e.parent_&&Fl(e.parent_))}function Ea(e){e.copy_||(e.assigned_=new Map,e.copy_=Ll(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ej=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(gn(r)&&!gn(n)){const o=n;n=r;const s=this;return function(u=o,...c){return s.produce(u,f=>n.call(this,f,...c))}}gn(n)||Pt(6),i!==void 0&&!gn(i)&&Pt(7);let a;if(At(r)){const o=Td(this),s=Wl(o,r,void 0);let l=!0;try{a=n(s),l=!1}finally{l?zl(o):Bl(o)}return _d(o,i),Cd(a,o)}else if(!r||!qu(r)){if(a=n(r),a===void 0&&(a=r),a===_g&&(a=void 0),this.autoFreeze_&&Vu(a,!0),i){const o=[],s=[];Qr(Ul).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else Pt(1,r)},this.produceWithPatches=(r,n)=>{if(gn(r))return(s,...l)=>this.produceWithPatches(s,u=>r(u,...l));let i,a;return[this.produce(r,n,(s,l)=>{i=s,a=l}),i,a]},Vs(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Vs(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Vs(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){At(t)||Pt(8),er(t)&&(t=vt(t));const r=Td(this),n=Wl(r,t,void 0);return n[tt].isManual_=!0,Bl(r),n}finishDraft(t,r){const n=t&&t[tt];(!n||!n.isManual_)&&Pt(9);const{scope_:i}=n;return _d(i,r),Cd(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Qr(Ul).applyPatches_;return er(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Wl(e,t,r,n){const[i,a]=Yo(t)?Qr(Va).proxyMap_(t,r):Vo(t)?Qr(Va).proxySet_(t,r):JO(t,r);return((r==null?void 0:r.scope_)??Mg()).drafts_.push(i),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=n,r&&n!==void 0?XO(r,a,n):a.callbacks_.push(function(l){var c;(c=l.mapSetPlugin_)==null||c.fixSetContents(a);const{patchPlugin_:u}=l;a.modified_&&u&&u.generatePatches_(a,[],l)}),i}function vt(e){return er(e)||Pt(10,e),Rg(e)}function Rg(e){if(!At(e)||Xo(e))return e;const t=e[tt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ll(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ll(e,!0);return Go(r,(i,a)=>{Ya(r,i,Rg(a))},n),t&&(t.finalized_=!1),r}var tj=new ej,Lg=tj.produce;function Ug(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var rj=Ug(),nj=Ug,ij=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ha:Ha.apply(null,arguments)};function ct(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ut(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Eg(n)&&n.type===e,r}var zg=class si extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,si.prototype)}static get[Symbol.species](){return si}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new si(...t[0].concat(this)):new si(...t.concat(this))}};function Id(e){return At(e)?Lg(e,()=>{}):e}function ca(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function aj(e){return typeof e=="boolean"}var oj=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new zg;return r&&(aj(r)?o.push(rj):o.push(nj(r.extraArgument))),o},Bg="RTK_autoBatch",le=()=>e=>({payload:e,meta:{[Bg]:!0}}),Nd=e=>t=>{setTimeout(t,e)},sj=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(o),r())},a=e(i),o=setTimeout(i,t)},Fg=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?sj(window.requestAnimationFrame,100):Nd(10):e.type==="callback"?e.queueNotification:Nd(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return s.add(c),()=>{d(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Bg]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},lj=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new zg(e);return n&&i.push(Fg(typeof n=="object"?n:void 0)),i};function uj(e){const t=oj(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(Gu(r))s=Sg(r);else throw new Error(ut(1));let l;typeof n=="function"?l=n(t):l=t();let u=Ha;i&&(u=ij({trace:!1,...typeof i=="object"&&i}));const c=BO(...l),f=lj(c);let d=typeof o=="function"?o(f):f();const p=u(...d);return Ag(s,a,p)}function Wg(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(ut(28));if(s in t)throw new Error(ut(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function cj(e){return typeof e=="function"}function fj(e,t){let[r,n,i]=Wg(t),a;if(cj(e))a=()=>Id(e());else{const s=Id(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(er(c)){const p=f(c,l);return p===void 0?c:p}else{if(At(c))return Lg(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},s)}return o.getInitialState=a,o}var dj="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",hj=(e=21)=>{let t="",r=e;for(;r--;)t+=dj[Math.random()*64|0];return t},pj=Symbol.for("rtk-slice-createasyncthunk");function vj(e,t){return`${e}/${t}`}function mj({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[pj];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(ut(11));const s=(typeof i.reducers=="function"?i.reducers(yj()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(P,O){const k=typeof P=="string"?P:P.type;if(!k)throw new Error(ut(12));if(k in u.sliceCaseReducersByType)throw new Error(ut(13));return u.sliceCaseReducersByType[k]=O,c},addMatcher(P,O){return u.sliceMatchers.push({matcher:P,reducer:O}),c},exposeAction(P,O){return u.actionCreators[P]=O,c},exposeCaseReducer(P,O){return u.sliceCaseReducersByName[P]=O,c}};l.forEach(P=>{const O=s[P],k={reducerName:P,type:vj(a,P),createNotation:typeof i.reducers=="function"};xj(O)?Pj(k,O,c,t):bj(k,O,c)});function f(){const[P={},O=[],k=void 0]=typeof i.extraReducers=="function"?Wg(i.extraReducers):[i.extraReducers],j={...P,...u.sliceCaseReducersByType};return fj(i.initialState,E=>{for(let _ in j)E.addCase(_,j[_]);for(let _ of u.sliceMatchers)E.addMatcher(_.matcher,_.reducer);for(let _ of O)E.addMatcher(_.matcher,_.reducer);k&&E.addDefaultCase(k)})}const d=P=>P,p=new Map,m=new WeakMap;let v;function y(P,O){return v||(v=f()),v(P,O)}function b(){return v||(v=f()),v.getInitialState()}function x(P,O=!1){function k(E){let _=E[P];return typeof _>"u"&&O&&(_=ca(m,k,b)),_}function j(E=d){const _=ca(p,O,()=>new WeakMap);return ca(_,E,()=>{const M={};for(const[T,S]of Object.entries(i.selectors??{}))M[T]=gj(S,E,()=>ca(m,E,b),O);return M})}return{reducerPath:P,getSelectors:j,get selectors(){return j(k)},selectSlice:k}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:b,...x(o),injectInto(P,{reducerPath:O,...k}={}){const j=O??o;return P.inject({reducerPath:j,reducer:y},k),{...w,...x(j,!0)}}};return w}}function gj(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var Xe=mj();function yj(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function bj({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!wj(n))throw new Error(ut(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ct(e,o):ct(e))}function xj(e){return e._reducerDefinitionType==="asyncThunk"}function wj(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Pj({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ut(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||fa,pending:s||fa,rejected:l||fa,settled:u||fa})}function fa(){}var kj="task",Kg="listener",Hg="completed",Xu="cancelled",Oj=`task-${Xu}`,jj=`task-${Hg}`,Kl=`${Kg}-${Xu}`,Aj=`${Kg}-${Hg}`,Jo=class{constructor(e){ea(this,"code");ea(this,"name","TaskAbortError");ea(this,"message");this.code=e,this.message=`${kj} ${Xu} (reason: ${e})`}},Zu=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Ja=()=>{},Gg=(e,t=Ja)=>(e.catch(t),e),qg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Gr=e=>{if(e.aborted)throw new Jo(e.reason)};function Yg(e,t){let r=Ja;return new Promise((n,i)=>{const a=()=>i(new Jo(e.reason));if(e.aborted){a();return}r=qg(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Ja})}var Sj=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Jo?"cancelled":"rejected",error:r}}finally{t==null||t()}},Qa=e=>t=>Gg(Yg(e,t).then(r=>(Gr(e),r))),Vg=e=>{const t=Qa(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:On}=Object,Dd={},Qo="listenerMiddleware",Ej=(e,t)=>{const r=n=>qg(e,()=>n.abort(e.reason));return(n,i)=>{Zu(n);const a=new AbortController;r(a);const o=Sj(async()=>{Gr(e),Gr(a.signal);const s=await n({pause:Qa(a.signal),delay:Vg(a.signal),signal:a.signal});return Gr(a.signal),s},()=>a.abort(jj));return i!=null&&i.autoJoin&&t.push(o.catch(Ja)),{result:Qa(e)(o),cancel(){a.abort(Oj)}}}},_j=(e,t)=>{const r=async(n,i)=>{Gr(t);let a=()=>{};const s=[new Promise((l,u)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),u()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await Yg(t,Promise.race(s));return Gr(t),l}finally{a()}};return((n,i)=>Gg(r(n,i)))},Xg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=ct(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ut(21));return Zu(a),{predicate:i,type:t,effect:a}},Zg=On(e=>{const{type:t,predicate:r,effect:n}=Xg(e);return{id:hj(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Zg}),$d=(e,t)=>{const{type:r,effect:n,predicate:i}=Xg(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Hl=e=>{e.pending.forEach(t=>{t.abort(Kl)})},Tj=(e,t)=>()=>{for(const r of t.keys())Hl(r);e.clear()},Rd=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Jg=On(ct(`${Qo}/add`),{withTypes:()=>Jg}),Cj=ct(`${Qo}/removeAll`),Qg=On(ct(`${Qo}/remove`),{withTypes:()=>Qg}),Mj=(...e)=>{console.error(`${Qo}/error`,...e)},Ii=(e={})=>{const t=new Map,r=new Map,n=p=>{const m=r.get(p)??0;r.set(p,m+1)},i=p=>{const m=r.get(p)??1;m===1?r.delete(p):r.set(p,m-1)},{extra:a,onError:o=Mj}=e;Zu(o);const s=p=>(p.unsubscribe=()=>t.delete(p.id),t.set(p.id,p),m=>{p.unsubscribe(),m!=null&&m.cancelActive&&Hl(p)}),l=(p=>{const m=$d(t,p)??Zg(p);return s(m)});On(l,{withTypes:()=>l});const u=p=>{const m=$d(t,p);return m&&(m.unsubscribe(),p.cancelActive&&Hl(m)),!!m};On(u,{withTypes:()=>u});const c=async(p,m,v,y)=>{const b=new AbortController,x=_j(l,b.signal),w=[];try{p.pending.add(b),n(p),await Promise.resolve(p.effect(m,On({},v,{getOriginalState:y,condition:(P,O)=>x(P,O).then(Boolean),take:x,delay:Vg(b.signal),pause:Qa(b.signal),extra:a,signal:b.signal,fork:Ej(b.signal,w),unsubscribe:p.unsubscribe,subscribe:()=>{t.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((P,O,k)=>{P!==b&&(P.abort(Kl),k.delete(P))})},cancel:()=>{b.abort(Kl),p.pending.delete(b)},throwIfCancelled:()=>{Gr(b.signal)}})))}catch(P){P instanceof Jo||Rd(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),b.abort(Aj),i(p),p.pending.delete(b)}},f=Tj(t,r);return{middleware:p=>m=>v=>{if(!Eg(v))return m(v);if(Jg.match(v))return l(v.payload);if(Cj.match(v)){f();return}if(Qg.match(v))return u(v.payload);let y=p.getState();const b=()=>{if(y===Dd)throw new Error(ut(23));return y};let x;try{if(x=m(v),t.size>0){const w=p.getState(),P=Array.from(t.values());for(const O of P){let k=!1;try{k=O.predicate(v,w,y)}catch(j){k=!1,Rd(o,j,{raisedBy:"predicate"})}k&&c(O,v,p,b)}}}finally{y=Dd}return x},startListening:l,stopListening:u,clearListeners:f}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ij={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},ey=Xe({name:"chartLayout",initialState:Ij,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Nj,setLayout:Dj,setChartSize:$j,setScale:Rj}=ey.actions,Lj=ey.reducer;function ty(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function G(e){return Number.isFinite(e)}function Ft(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Ld(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ld(Object(r),!0).forEach(function(n){Uj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ld(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Uj(e,t,r){return(t=zj(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zj(e){var t=Bj(e,"string");return typeof t=="symbol"?t:t+""}function Bj(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ee(e,t,r){return ce(e)||ce(t)?r:Bt(t)?zt(e,t,r):typeof t=="function"?t(e):r}var Fj=(e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&$(e[a]))return bn(bn({},e),{},{[a]:e[a]+(n||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&$(e[o]))return bn(bn({},e),{},{[o]:e[o]+(i||0)})}return e},Et=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",ry=(e,t,r,n)=>{if(n)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===r&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(r),o},ny=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:u,tickCount:c,ticks:f,niceTicks:d,axisType:p}=e;if(!o)return null;var m=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,v=i==="category"&&o.bandwidth?o.bandwidth()/m:0;if(v=p==="angleAxis"&&a&&a.length>=2?Ne(a[0]-a[1])*2*v:v,f||d){var y=(f||d||[]).map((b,x)=>{var w=n?n.indexOf(b):b,P=o.map(w);return G(P)?{coordinate:P+v,value:b,offset:v,index:x}:null}).filter(nt);return y}return l&&u?u.map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:b,index:x,offset:v}:null}).filter(nt):o.ticks&&c!=null?o.ticks(c).map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:b,index:x,offset:v}:null}).filter(nt):o.domain().map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:n?n[b]:b,index:x,offset:v}:null}).filter(nt)},Wj=(e,t)=>{if(!t||t.length!==2||!$(t[0])||!$(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!$(e[0])||e[0]<r)&&(i[0]=r),(!$(e[1])||e[1]>n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]<r&&(i[1]=r),i},Kj=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0,s=0;s<r;++s){var l=e[s],u=l==null?void 0:l[i];if(u!=null){var c=u[1],f=u[0],d=jt(c)?f:c;d>=0?(u[0]=a,a+=d,u[1]=a):(u[0]=o,o+=d,u[1]=o)}}}},Hj=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0;o<r;++o){var s=e[o],l=s==null?void 0:s[i];if(l!=null){var u=jt(l[1])?l[0]:l[1];u>=0?(l[0]=a,a+=u,l[1]=a):(l[0]=0,l[1]=0)}}}},Gj={sign:Kj,expand:sk,none:Zr,silhouette:lk,wiggle:uk,positive:Hj},qj=(e,t,r)=>{var n,i=(n=Gj[r])!==null&&n!==void 0?n:Zr,a=ok().keys(t).value((s,l)=>Number(ee(s,l,0))).order(Tl).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((u,c)=>{var f=ee(e[c],t[l],0);Array.isArray(f)&&f.length===2&&$(f[0])&&$(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function iy(e){return e==null?void 0:String(e)}function eo(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ce(i[t.dataKey])){var s=lg(r,"value",i[t.dataKey]);if(s)return s.coordinate+n/2}return r!=null&&r[a]?r[a].coordinate+n/2:null}var l=ee(i,ce(o)?t.dataKey:o),u=t.scale.map(l);return $(u)?u:null}var Ud=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var s=ee(a,t.dataKey,t.scale.domain()[o]);if(ce(s))return null;var l=t.scale.map(s);return $(l)?l-i/2+n:null},Yj=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},Vj=e=>{var t=e.flat(2).filter($);return[Math.min(...t),Math.max(...t)]},Xj=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Zj=(e,t,r)=>{if(e!=null)return Xj(Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:o}=a,s=o.reduce((l,u)=>{var c=ty(u,t,r),f=Vj(c);return!G(f[0])||!G(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(s[0],n[0]),Math.max(s[1],n[1])]},[1/0,-1/0]))},zd=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Bd=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Ko(t,c=>c.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],u=i[o-1];a=Math.min(((l==null?void 0:l.coordinate)||0)-((u==null?void 0:u.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function Fd(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return bn(bn({},t),{},{dataKey:r,payload:n,value:i,name:a})}function Er(e,t){if(e)return String(e);if(typeof t=="string")return t}var Jj=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},Qj=(e,t)=>t==="centric"?e.angle:e.radius,or=e=>e.layout.width,sr=e=>e.layout.height,eA=e=>e.layout.scale,ay=e=>e.layout.margin,es=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ts=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),oy="data-recharts-item-index",sy="data-recharts-item-id",Ni=60;function Wd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wd(Object(r),!0).forEach(function(n){tA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tA(e,t,r){return(t=rA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rA(e){var t=nA(e,"string");return typeof t=="symbol"?t:t+""}function nA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iA=e=>e.brush.height;function aA(e){var t=ts(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function oA(e){var t=ts(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function sA(e){var t=es(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function lA(e){var t=es(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Ae=A([or,sr,ay,iA,aA,oA,sA,lA,jg,DO],(e,t,r,n,i,a,o,s,l,u)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+s},d=da(da({},f),c),p=d.bottom;d.bottom+=n,d=Fj(d,l,u);var m=e-d.left-d.right,v=t-d.top-d.bottom;return da(da({brushBottom:p},d),{},{width:Math.max(m,0),height:Math.max(v,0)})}),uA=A(Ae,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ju=A(or,sr,(e,t)=>({x:0,y:0,width:e,height:t})),cA=h.createContext(null),De=()=>h.useContext(cA)!=null,rs=e=>e.brush,ns=A([rs,Ae,ay],(e,t,r)=>({height:e.height,x:$(e.x)?e.x:t.left,y:$(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:$(e.width)?e.width:t.width}));function fA(e,t,{signal:r,edges:n}={}){let i,a=null;const o=n!=null&&n.includes("leading"),s=n==null||n.includes("trailing"),l=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},u=()=>{s&&l(),p()};let c=null;const f=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},t)},d=()=>{c!==null&&(clearTimeout(c),c=null)},p=()=>{d(),i=void 0,a=null},m=()=>{l()},v=function(...y){if(r!=null&&r.aborted)return;i=this,a=y;const b=c==null;f(),o&&b&&l()};return v.schedule=f,v.cancel=p,v.flush=m,r==null||r.addEventListener("abort",p,{once:!0}),v}function dA(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:n=!1,trailing:i=!0,maxWait:a}=r,o=Array(2);n&&(o[0]="leading"),i&&(o[1]="trailing");let s,l=null;const u=fA(function(...d){s=e.apply(this,d),l=null},t,{edges:o}),c=function(...d){return a!=null&&(l===null&&(l=Date.now()),Date.now()-l>=a)?(s=e.apply(this,d),l=Date.now(),u.cancel(),u.schedule(),s):(u.apply(this,d),s)},f=()=>(u.flush(),s);return c.cancel=u.cancel,c.flush=f,c}function hA(e,t=0,r={}){const{leading:n=!0,trailing:i=!0}=r;return dA(e,t,{leading:n,maxWait:t,trailing:i})}var to=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>i[o++]))}},$t={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},ly=(e,t,r)=>{var{width:n=$t.width,height:i=$t.height,aspect:a,maxHeight:o}=r,s=Jr(n)?e:Number(n),l=Jr(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},pA={width:0,height:0,overflow:"visible"},vA={width:0,overflowX:"visible"},mA={height:0,overflowY:"visible"},gA={},yA=e=>{var{width:t,height:r}=e,n=Jr(t),i=Jr(r);return n&&i?pA:n?vA:i?mA:gA};function bA(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i=$t.width,a=$t.height):i===void 0?i=n&&n>0?void 0:$t.width:a===void 0&&(a=n&&n>0?void 0:$t.height),{width:i,height:a}}function Gl(){return Gl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gl.apply(null,arguments)}function Kd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kd(Object(r),!0).forEach(function(n){xA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xA(e,t,r){return(t=wA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wA(e){var t=PA(e,"string");return typeof t=="symbol"?t:t+""}function PA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uy=h.createContext($t.initialDimension);function kA(e){return Ft(e.width)&&Ft(e.height)}function cy(e){var{children:t,width:r,height:n}=e,i=h.useMemo(()=>({width:r,height:n}),[r,n]);return kA(i)?h.createElement(uy.Provider,{value:i},t):null}var Qu=()=>h.useContext(uy),OA=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=$t.initialDimension,width:i,height:a,minWidth:o=$t.minWidth,minHeight:s,maxHeight:l,children:u,debounce:c=$t.debounce,id:f,className:d,onResize:p,style:m={}}=e,v=h.useRef(null),y=h.useRef();y.current=p,h.useImperativeHandle(t,()=>v.current);var[b,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((E,_)=>{x(M=>{var T=Math.round(E),S=Math.round(_);return M.containerWidth===T&&M.containerHeight===S?M:{containerWidth:T,containerHeight:S}})},[]);h.useEffect(()=>{if(v.current==null||typeof ResizeObserver>"u")return ar;var E=S=>{var N,D=S[0];if(D!=null){var{width:z,height:K}=D.contentRect;w(z,K),(N=y.current)===null||N===void 0||N.call(y,z,K)}};c>0&&(E=hA(E,c,{trailing:!0,leading:!1}));var _=new ResizeObserver(E),{width:M,height:T}=v.current.getBoundingClientRect();return w(M,T),_.observe(v.current),()=>{_.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:O}=b;to(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:k,calculatedHeight:j}=ly(P,O,{width:i,height:a,aspect:r,maxHeight:l});return to(k!=null&&k>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
1
+ var cw=Object.defineProperty;var fw=(e,t,r)=>t in e?cw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ea=(e,t,r)=>fw(e,typeof t!="symbol"?t+"":t,r);import{t as dw,bc as Hf,bd as hw,R as pw,j as g,b4 as Nn,be as vw,r as h,a9 as Ei,bf as mw,bb as gw,bg as yw,D as Ma,bh as Gf,bi as qf,bj as bw,bk as xw,B as Sr,bl as ww,k as Ie,d as Pw,bm as kw,m as bm,bn as Ow,bo as jw,T as Fe,P as xr,bp as Aw,a$ as _i,f as oe,bq as Pn,g as at,br as Sw,bs as Ew,bt as _w,bu as Z,bv as Tw,bw as Cw,bx as Mw,by as Iw,M as He,bz as wr,u as Nw,bA as Dw,bB as $w,bC as Rw,bD as Lw,S as Uw}from"./index-DS0F5-Qw.js";import{a as zw,T as En,C as Ia,S as ta,i as Bw}from"./env-D3oFV59v.js";import{a as Dt,L as xm,b as kn,S as xt}from"./index-D_BPUazE.js";import{P as ra,C as Fw,a as Ww}from"./ChevronDown-B1JZ38iG.js";const Kw=dw({defaultVariants:{variant:"default"},slots:{base:"card",content:"card__content",description:"card__description",footer:"card__footer",header:"card__header",title:"card__title"},variants:{variant:{default:{base:"card--default"},secondary:{base:"card--secondary"},tertiary:{base:"card--tertiary"},transparent:{base:"card--transparent"}}}}),Yf=Object.assign(Hf,{Root:Hf,Separator:hw}),Dn=h.createContext({}),Vf=({children:e,className:t,variant:r="default",...n})=>{const i=pw.useMemo(()=>Kw({variant:r}),[r]),a=g.jsx(Nn.div,{className:i.base({className:t}),"data-slot":"card",...n,children:e});return g.jsx(Dn,{value:{slots:i},children:r==="transparent"?a:g.jsx(vw,{value:{variant:r},children:a})})},Hw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.header,e),"data-slot":"card-header",...t})},Gw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.h3,{className:Ei(n==null?void 0:n.title,t),"data-slot":"card-title",...r,children:e})},qw=({children:e,className:t,...r})=>{const{slots:n}=h.use(Dn);return g.jsx(Nn.p,{className:Ei(n==null?void 0:n.description,t),"data-slot":"card-description",...r,children:e})},Yw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.content,e),"data-slot":"card-content",...t})},Vw=({className:e,...t})=>{const{slots:r}=h.use(Dn);return g.jsx(Nn.div,{className:Ei(r==null?void 0:r.footer,e),"data-slot":"card-footer",...t})},q=Object.assign(Vf,{Root:Vf,Header:Hw,Title:Gw,Description:qw,Content:Yw,Footer:Vw}),Xw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 1.5a6.5 6.5 0 0 0-6.445 5.649.75.75 0 1 0 1.488.194A5.001 5.001 0 0 1 11.57 4.5h-1.32a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 .75-.75v-3a.75.75 0 0 0-1.5 0v1.06A6.48 6.48 0 0 0 8 1.5m-5.25 13a.75.75 0 0 1-.75-.75v-3a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5H4.43a5.001 5.001 0 0 0 8.528-2.843.75.75 0 1 1 1.487.194A6.501 6.501 0 0 1 3.5 12.691v1.059a.75.75 0 0 1-.75.75",clipRule:"evenodd"})),Zw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 13.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14M6.44 4.54c.43-.354.994-.565 1.56-.565 1.217 0 2.34.82 2.34 2.14 0 .377-.078.745-.298 1.1-.208.339-.513.614-.875.867-.217.153-.325.257-.379.328-.038.052-.038.07-.038.089a.75.75 0 0 1-1.5 0c0-.794.544-1.286 1.057-1.645.28-.196.4-.332.458-.426a.54.54 0 0 0 .075-.312c0-.3-.244-.641-.84-.641a1 1 0 0 0-.608.223c-.167.138-.231.287-.231.418a.75.75 0 0 1-1.5 0c0-.674.345-1.22.78-1.577M8 12a1 1 0 1 0 0-2 1 1 0 0 0 0 2",clipRule:"evenodd"})),Jw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"m6.44 4.06.439.44H12.5A1.5 1.5 0 0 1 14 6v5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11V4.5A1.5 1.5 0 0 1 3.5 3h1.257a1.5 1.5 0 0 1 1.061.44zM.5 4.5a3 3 0 0 1 3-3h1.257a3 3 0 0 1 2.122.879L7.5 3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3zm4.25 2a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5z",clipRule:"evenodd"})),Qw=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M14 4a3 3 0 1 0-5.895.79L6.15 5.908a3 3 0 1 0 0 4.185l1.955 1.117A3.003 3.003 0 0 0 11 15a3 3 0 1 0-2.15-5.092L6.895 8.79a3 3 0 0 0 0-1.58L8.85 6.092A3 3 0 0 0 14 4m-3 6.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M2.5 8a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0",clipRule:"evenodd"})),wm=e=>h.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},e),h.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.47 3.47a.75.75 0 0 1 1.06 0L8 6.94l3.47-3.47a.75.75 0 1 1 1.06 1.06L9.06 8l3.47 3.47a.75.75 0 1 1-1.06 1.06L8 9.06l-3.47 3.47a.75.75 0 0 1-1.06-1.06L6.94 8 3.47 4.53a.75.75 0 0 1 0-1.06",clipRule:"evenodd"})),e1="inline-flex h-7 shrink-0 items-center gap-1 rounded-full bg-[#1e80ff] px-2.5 text-[12px] font-medium text-white outline-none transition-colors hover:bg-[#1171ee] focus-visible:ring-2 focus-visible:ring-[#1e80ff]/40 disabled:pointer-events-none disabled:opacity-40 dark:bg-[#4b9cff] dark:hover:bg-[#3a8ff0]",Xf="https://juejin.cn/aiusage/rank";function t1(){const e=window.open(Xf,"_blank");if(e){e.opener=null;return}window.location.assign(Xf)}function r1({className:e}){return g.jsx("svg",{"aria-hidden":"true",className:e,fill:"currentColor",role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"m12 14.316 7.454-5.88-2.022-1.625L12 11.1l-.004.003-5.432-4.288-2.02 1.624 7.452 5.88Zm0-7.247 2.89-2.298L12 2.453l-.004-.005-2.884 2.318 2.884 2.3Zm0 11.266-.005.002-9.975-7.87L0 12.088l.194.156 11.803 9.308 7.463-5.885L24 12.085l-2.023-1.624Z",transform:"translate(2.4 2.4) scale(.8)"})})}function n1(){mw();const e=bm(),t=gw(),[r,n]=h.useState(!1),[i,a]=h.useState(null),[o,s]=h.useState(!1),l="同步数据";t==null||t.hasUserData;const u=h.useCallback(()=>{(async()=>{try{const f=await yw();a(!!f.juejin.userId)}catch{a(null)}})()},[e]);h.useEffect(()=>{u();const f=()=>u(),d=p=>{const m=p.detail;m!=null&&m.loginSuccess&&a(!0),u()};return window.addEventListener("focus",f),window.addEventListener(Ma,f),window.addEventListener(Gf,d),window.addEventListener(qf,f),()=>{window.removeEventListener("focus",f),window.removeEventListener(Ma,f),window.removeEventListener(Gf,d),window.removeEventListener(qf,f)}},[e,u]);const c=async()=>{var f;n(!0);try{e&&(await Ow(),typeof((f=window.tud)==null?void 0:f.onDataSynced)!="function"&&jw())}finally{n(!1)}};return g.jsxs("div",{className:"flex items-center gap-1",children:[i===!1?g.jsxs("button",{className:e1,onClick:()=>s(!0),type:"button",children:[g.jsx(r1,{className:"size-3.5"}),"关联掘金"]}):null,g.jsx(bw,{isOpen:o,onConfirm:()=>{xw()},onOpenChange:s}),null,g.jsx(Sr,{className:"h-8 min-h-8 shrink-0 px-2.5 text-xs font-normal",onPress:t1,size:"sm",variant:"tertiary",children:"排行榜"}),g.jsx(Rs,{icon:g.jsx(Qw,{className:"size-4"}),label:"分享",onPress:()=>{ww()}}),g.jsxs(g.Fragment,{children:[g.jsx(Rs,{disabled:r,icon:g.jsx(Xw,{className:Ie("size-4",r&&"animate-spin")}),label:l,onPress:()=>{c()}}),g.jsx(Rs,{icon:g.jsx(kw,{className:"size-4"}),label:"设置",onPress:()=>Pw()})]}),g.jsx(zw,{})]})}function Rs({icon:e,label:t,onPress:r,disabled:n}){return g.jsxs(En,{closeDelay:80,delay:100,children:[g.jsx(Sr,{"aria-label":t,className:"size-8 min-h-8 min-w-8 shrink-0 p-0",isDisabled:n,isIconOnly:!0,onPress:r,size:"sm",variant:"tertiary",children:e}),g.jsx(En.Content,{placement:"bottom",children:g.jsx("p",{children:t})})]})}const i1={claude:"Claude",codex:"Codex",cursor:"Cursor",qoder:"Qoder",trae:"Trae",gemini:"Gemini",opencode:"OpenCode",copilot:"Copilot",antigravity:"Antigravity",openclaw:"OpenClaw",hermes:"Hermes",zcode:"ZCode",pi:"pi",kimi:"Kimi",roocode:"Roo Code",droid:"Droid",kiro:"Kiro",cline:"Cline",amp:"Amp",qwen:"Qwen Code",codebuddy:"CodeBuddy",workbuddy:"WorkBuddy",grok:"Grok Build",mimo:"Mimo","every-code":"Every Code",omp:"OMP","kilo-cli":"Kilo CLI",kilocode:"Kilo Code",goose:"Goose",zed:"Zed",warp:"Warp"};function a1(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t==="gemini-cli"||t.startsWith("gemini")?"gemini":t==="open-code"||t.startsWith("opencode")?"opencode":t==="github-copilot"||t==="copilot-cli"||t.startsWith("copilot")?"copilot":t.startsWith("antigravity")?"antigravity":t.startsWith("openclaw")||t.startsWith("open-claw")?"openclaw":t.startsWith("hermes")?"hermes":t.startsWith("zcode")||t==="zai"?"zcode":t==="pi-coding-agent"||t.startsWith("pi")?"pi":t.startsWith("kimi")?"kimi":t==="roo-code"||t.startsWith("roocode")||t.startsWith("roo")?"roocode":t.startsWith("droid")||t.startsWith("factory")?"droid":t.startsWith("kiro")?"kiro":t.startsWith("cline")?"cline":t.startsWith("amp")?"amp":t==="qwen-code"||t.startsWith("qwen")?"qwen":t.startsWith("codebuddy")||t==="code-buddy"?"codebuddy":t.startsWith("workbuddy")?"workbuddy":t.startsWith("grok")?"grok":t.startsWith("mimo")||t==="mimocode"||t.startsWith("xiaomi")?"mimo":t==="everycode"||t.startsWith("every-code")?"every-code":t.startsWith("omp")||t==="oh-my-pi"?"omp":t.startsWith("kilo-cli")||t==="kilo"?"kilo-cli":t.startsWith("kilocode")||t==="kilo-code"?"kilocode":t.startsWith("goose")?"goose":t.startsWith("zed")?"zed":t.startsWith("warp")?"warp":t}function qe(e){const t=a1(e);return i1[t]??e}const Pl=["var(--heatmap-0)","var(--heatmap-1)","var(--heatmap-2)","var(--heatmap-3)","var(--heatmap-4)"],Zf={today:1,"last-7-days":7,"last-30-days":30,"last-90-days":90},Pm=[{id:"today",label:"今天"},{id:"last-7-days",label:"7D"},{id:"last-30-days",label:"30D"},{id:"last-90-days",label:"90D"}],o1="!h-8 !min-h-8";function s1({value:e,onChange:t,tools:r,selectedTools:n,onToolsChange:i,disabled:a=!1}){const o=h.useMemo(()=>r.filter(s=>s.tokens>0),[r]);return g.jsxs("div",{className:"mb-5 flex min-w-0 items-center gap-2","aria-label":"筛选条件",children:[g.jsx("div",{className:"shrink-0 sm:hidden",children:g.jsx(l1,{disabled:a,value:e,onChange:t})}),g.jsx(Fe,{className:"hidden w-fit shrink-0 text-center sm:block",selectedKey:e,onSelectionChange:s=>{a||t(String(s))},children:g.jsx(Fe.ListContainer,{children:g.jsx(Fe.List,{"aria-label":"时间范围",className:"w-fit *:h-6 *:w-fit *:px-3 *:text-sm *:font-normal *:transition-none! *:data-[selected=true]:text-accent-foreground",children:Pm.map(s=>g.jsxs(Fe.Tab,{className:"transition-none!",id:s.id,children:[g.jsx("span",{className:"text-xs font-normal",children:s.label}),g.jsx(Fe.Indicator,{className:"bg-accent transition-none!"})]},s.id))})})}),g.jsx("div",{className:"flex min-h-8 min-w-0 shrink-0 items-center",children:o.length>0?g.jsx(u1,{selectedTools:n,tools:o,onChange:s=>{a||i(s)}}):null}),g.jsx("div",{className:"ml-auto shrink-0",children:g.jsx(n1,{})})]})}function l1({disabled:e,onChange:t,value:r}){return g.jsxs(Dt,{"aria-label":"时间范围",className:"min-w-0 max-w-[7.5rem] shrink text-xs",isDisabled:e,value:r,variant:"secondary",onChange:n=>{e||n==null||t(String(n))},children:[g.jsx(xm,{className:"sr-only",children:"时间范围"}),g.jsxs(Dt.Trigger,{className:`${o1} !w-fit max-w-[7.5rem] items-center leading-none ps-2.5 pe-7 !text-xs font-normal`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-20 !text-xs"}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"时间范围",children:Pm.map(n=>g.jsxs(kn.Item,{id:n.id,textValue:n.label,children:[n.label,g.jsx(kn.ItemIndicator,{})]},n.id))})})]})}function u1({tools:e,selectedTools:t,onChange:r}){const n=h.useMemo(()=>new Set(e.map(o=>o.source)),[e]),i=t.filter(o=>n.has(o)),a=i.length>0;return g.jsxs(Yf,{className:"shrink-0",children:[g.jsxs(Dt,{"aria-label":"筛选渠道",className:"w-fit max-w-52 text-xs",selectionMode:"multiple",value:i,variant:"secondary",onChange:o=>{const s=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];r(s.filter(l=>n.has(l)))},children:[g.jsx(xm,{className:"sr-only",children:"渠道"}),g.jsxs(Dt.Trigger,{className:`!h-8 !min-h-8 !w-fit max-w-52 ps-3 pe-8 !text-xs font-normal ${a?"!rounded-r-none":"!rounded-full"}`,children:[g.jsx(Dt.Value,{className:"min-w-0 max-w-40 !text-xs",children:({state:o})=>{const s=o.selectedItems.map(u=>e.find(c=>c.source===u.key)).filter(u=>!!u);if(s.length===0)return"全部渠道";if(s.length>1)return`已选 ${s.length} 个渠道`;const[l]=s;return l?g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx(xr,{provider:l.source,size:18}),g.jsx("span",{className:"truncate",children:qe(l.source)})]}):"全部渠道"}}),g.jsx(Dt.Indicator,{className:"size-3.5 text-muted"})]}),g.jsx(Dt.Popover,{className:"w-50 rounded-xl bg-surface shadow-md",placement:"bottom start",children:g.jsx(kn,{"aria-label":"渠道列表",selectionMode:"multiple",children:e.map(o=>g.jsxs(kn.Item,{className:"py-1 rounded-lg px-1.5 text-xs gap-2!",id:o.source,textValue:qe(o.source),children:[g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md ",children:g.jsx(xr,{provider:o.source,size:18})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:qe(o.source)}),g.jsx(kn.ItemIndicator,{})]},o.source))})})]}),a?g.jsxs(Sr,{"aria-label":"清空渠道筛选",className:"!h-8 !min-h-8 !w-8 !min-w-8 !rounded-l-none !rounded-r-full p-0",size:"sm",variant:"tertiary",onPress:()=>r([]),children:[g.jsx(Yf.Separator,{}),g.jsx(wm,{className:"size-3.5"})]}):null]})}function c1(){return g.jsxs(q,{"aria-hidden":"true",className:"min-w-0 overflow-hidden rounded-2xl",children:[g.jsxs(q.Header,{className:"flex-row items-start justify-between gap-3 pb-0",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(xt,{className:"h-5 w-28 rounded-md"}),g.jsx(xt,{className:"h-3 w-44 rounded-md"})]}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(q.Content,{className:"pt-4",children:g.jsx(xt,{className:"h-52 w-full rounded-xl"})})]})}function f1(){return g.jsxs("div",{"aria-hidden":"true",className:"w-full",children:[g.jsx("section",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4},(e,t)=>g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid grid-rows-[auto_auto] gap-4 p-0",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsx(xt,{className:"h-3 w-16 rounded-md"}),g.jsx(xt,{className:"h-5 w-14 rounded-full"})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(xt,{className:"h-7 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-16 justify-self-end rounded-md"})]})]})},t))}),g.jsxs("div",{className:"mt-4 rounded-2xl border border-border/60 bg-surface p-4 sm:p-5",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[g.jsx(xt,{className:"h-4 w-24 rounded-md"}),g.jsx(xt,{className:"h-6 w-20 rounded-lg"})]}),g.jsx(xt,{className:"h-36 w-full rounded-xl sm:h-44"})]})]})}function d1(){return g.jsxs("div",{"aria-label":"用量数据加载中",className:"w-full",role:"status",children:[g.jsx(f1,{}),g.jsx("section",{"aria-hidden":"true",className:"mt-4 grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2",children:Array.from({length:5},(e,t)=>g.jsx(c1,{},t))})]})}function h1({allSources:e,value:t,onChange:r}){if(e.length===0)return null;const n=new Set(t),i=t.length===e.length,a=!i&&t.length>0;let o="全部平台";t.length===0?o="选择平台":!i&&t.length===1?o=qe(t[0]??""):i||(o=`已选 ${t.length} 个平台`);const s=l=>{const u=new Set(n);u.has(l)?u.delete(l):u.add(l),r([...u])};return g.jsxs(ra,{children:[g.jsxs(Sr,{"aria-label":`筛选平台:${o}`,className:Ie("h-auto min-h-0 max-w-36 gap-1 rounded-none border-0 bg-transparent p-0","text-xs font-medium text-muted shadow-none","hover:bg-transparent hover:text-foreground","data-[pressed=true]:bg-transparent data-[pressed=true]:text-foreground",a&&"text-foreground"),size:"sm",variant:"ghost",children:[!i&&t.length===1&&t[0]?g.jsx(xr,{provider:t[0],size:12}):null,g.jsx("span",{className:"min-w-0 max-w-28 truncate whitespace-nowrap",children:o}),g.jsx(Fw,{className:"size-3.5 shrink-0 opacity-70"})]}),g.jsx(ra.Content,{className:"min-w-56 overflow-hidden rounded-[10px] border-0 bg-overlay p-0 text-overlay-foreground shadow-surface",placement:"bottom end",children:g.jsxs(ra.Dialog,{className:"p-0 outline-none",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2",children:[g.jsx(ra.Heading,{className:"text-[10px] font-semibold tracking-wider text-muted",children:"选择平台"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([...e]),children:"全部"}),g.jsx("button",{className:"rounded-md px-1.5 py-0.5 text-[11px] text-muted transition-colors hover:bg-surface-secondary hover:text-foreground",type:"button",onClick:()=>r([]),children:"清空"})]})]}),g.jsx("ul",{"aria-multiselectable":"true",className:"max-h-64 overflow-y-auto p-1.5",role:"listbox",children:e.map(l=>{const u=n.has(l);return g.jsx("li",{"aria-selected":u,role:"option",children:g.jsxs("button",{className:Ie("flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left text-xs transition-colors","hover:bg-surface-secondary",u&&"bg-accent/10 hover:bg-accent/15"),type:"button",onClick:()=>s(l),children:[g.jsx("span",{"aria-hidden":"true",className:Ie("flex size-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors",u?"border-accent bg-accent text-accent-foreground":"border-border bg-surface"),children:u?g.jsx(Ww,{className:"size-2.5"}):null}),g.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-white",children:g.jsx(xr,{onLightBackground:!0,provider:l,size:14})}),g.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:qe(l)})]})},l)})})]})})]})}function p1(e,t,r){if(e.length===0){r([]);return}if(e.length===t.length&&t.every(n=>e.includes(n))){r(null);return}r(e)}const Lo="Asia/Shanghai",Jf=new Map;function v1(e){let t=Jf.get(e);return t||(t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",hourCycle:"h23",minute:"2-digit"}),Jf.set(e,t)),t}function km(e,t=Lo){const r=typeof e=="string"?new Date(e):e;if(Number.isNaN(r.getTime()))return{date:"1970-01-01",hour:0};const n=v1(t).formatToParts(r),i=a=>{var o;return((o=n.find(s=>s.type===a))==null?void 0:o.value)??""};return{date:`${i("year")}-${i("month")}-${i("day")}`,hour:Number(i("hour"))}}function an(e=Lo,t=new Date){return km(t,e).date}function Eu(e=Lo,t=new Date){return km(t,e).hour}function m1(e,t){const[r,n,i]=e.split("-").map(Number);return new Date(Date.UTC(r??1970,(n??1)-1,(i??1)+t)).toISOString().slice(0,10)}function Qf(e,t=Lo,r=new Date){const n=an(t,r);return m1(n,-(Math.max(1,e)-1))}function Om(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=new Date(Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])));return Number.isFinite(r.getTime())?r:null}function na(e){return e.toISOString().slice(0,10)}function yn(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function jm(e,t){return Math.floor((Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))/864e5)}function Ls(e,t){if(!e.length)return 0;const r=(e.length-1)*t,n=Math.floor(r),i=r-n,a=e[n]??e[e.length-1],o=e[Math.min(e.length-1,n+1)]??e[e.length-1];return Math.round(a+(o-a)*i)}function g1(e){return e<=0?0:e>=4?4:e}function y1(e,t=26){var y;const r=Om(an())??new Date,n=yn(r,-(t*7-1)),i=n.getUTCDay(),a=yn(n,-i),o=new Map;for(const b of e)o.set(b.date,{value:Math.max(0,b.tokens),models:b.models??null});const s=jm(a,r)+1,l=Math.ceil(s/7),u=[];for(let b=0;b<s;b++){const x=na(yn(a,b)),w=((y=o.get(x))==null?void 0:y.value)??0;w>0&&u.push(w)}u.sort((b,x)=>b-x);const c=Ls(u,.5),f=Ls(u,.75),d=Ls(u,.9);function p(b){return!b||b<=0?0:b<=c?1:b<=f?2:b<=d?3:4}const m=[];for(let b=0;b<l;b++){const x=[];for(let w=0;w<7;w++){const P=yn(a,b*7+w);if(P.getTime()>r.getTime()){x.push(null);continue}const O=na(P),k=o.get(O),j=(k==null?void 0:k.value)??0;x.push({day:O,value:j,level:g1(p(j)),models:(k==null?void 0:k.models)??null})}m.push(x)}const v=m.length>t?m.slice(m.length-t):m;return{from:na(n),to:na(r),weeks:v,thresholds:{t1:c,t2:f,t3:d}}}function ed(){return"UTC+08:00"}function b1(e,t,r){if(!e)return[];const n=Om(t)??new Date,i=yn(n,-n.getUTCDay()),a=yn(i,-(e-1)*7),o=[];for(let u=11;u>=0;u-=1)o.push(new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-u,1)));const s=[],l=new Set;for(const u of o){const c=Math.floor(jm(a,u)/7);c<0||c>=e||l.has(c)||(l.add(c),s.push({label:r[u.getUTCMonth()],index:c}))}return s}const x1="";function Ti(e){const t=e.indexOf(x1);return t===-1?{source:null,model:e}:{source:e.slice(0,t),model:e.slice(t+1)}}const w1="var(--chart-",P1=8;function Na(e){const t=e%P1+1;return`${w1}${t})`}function k1(e){const t=new Map;for(const n of e){if(n.tokens<=0)continue;const i=t.get(n.model);(!i||n.tokens>i.tokens)&&t.set(n.model,{source:n.source,tokens:n.tokens})}const r=new Map;for(const[n,i]of t)r.set(n,i.source);return r}const wt="unattributed",Da="未归类";function O1(e){const t=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(u=>{const c=new Map;for(const p of u.models){if(!p.model||p.tokens<=0)continue;const m=c.get(p.model)??{tokens:0,costUsd:0,pct:0};m.tokens+=p.tokens,m.costUsd+=p.costUsd,m.pct+=p.pct,c.set(p.model,m),r.set(p.model,(r.get(p.model)??0)+p.tokens)}let f=0,d=0;for(const p of c.values())f+=p.tokens,d+=p.costUsd;return{row:u,models:c,unattributedTokens:Math.max(0,u.tokens-f),unattributedCostUsd:Math.max(0,u.costUsd-d)}}),i=[...r.entries()].sort((u,c)=>c[1]-u[1]).map(([u,c],f)=>({key:`model-${f}`,model:u,color:Na(f),tokens:c})),a=n.reduce((u,c)=>u+c.unattributedTokens,0);a>0&&i.push({key:wt,model:Da,color:"var(--muted)",tokens:a,isUnattributed:!0});const o=new Map(i.filter(u=>!u.isUnattributed).map(u=>[u.model,u])),s=Object.fromEntries(i.map(u=>[u.key,{label:u.model,color:u.color}])),l=n.map(({row:u,models:c,unattributedTokens:f,unattributedCostUsd:d})=>{const p={source:u.source,tokens:u.tokens,costUsd:u.costUsd,pct:u.pct,modelCount:u.models.length,segments:{}};for(const m of i)p[m.key]=0;for(const[m,v]of c){const y=o.get(m);y&&(p[y.key]=v.tokens,p.segments[y.key]={key:y.key,model:m,tokens:v.tokens,costUsd:v.costUsd,pct:v.pct})}return f>0&&(p[wt]=f,p.segments[wt]={key:wt,model:Da,tokens:f,costUsd:d,pct:u.tokens>0?f/u.tokens*100:0,isUnattributed:!0}),p});return{config:s,rows:l,series:i}}function j1(e){const t=e.filter(c=>c.tokens>0).sort((c,f)=>f.tokens-c.tokens);if(t.length===0)return{config:{},rows:[],series:[]};const r=new Map,n=t.map(c=>{const f=new Map;for(const m of c.models){if(!m.model||!m.source||m.tokens<=0)continue;const v=`${m.source}\0${m.model}`,y=f.get(v)??{source:m.source,model:m.model,tokens:0,costUsd:0,pct:0};y.tokens+=m.tokens,y.costUsd+=m.costUsd,y.pct+=m.pct,f.set(v,y);const b=r.get(v)??{source:m.source,model:m.model,tokens:0};b.tokens+=m.tokens,r.set(v,b)}let d=0,p=0;for(const m of f.values())d+=m.tokens,p+=m.costUsd;return{row:c,models:f,unattributedTokens:Math.max(0,c.tokens-d),unattributedCostUsd:Math.max(0,c.costUsd-p)}}),i=[...r.entries()].sort((c,f)=>f[1].tokens-c[1].tokens).map(([c,f],d)=>({key:`seg-${d}`,pairKey:c,model:f.model,source:f.source,color:Na(d),tokens:f.tokens})),a=n.reduce((c,f)=>c+f.unattributedTokens,0);a>0&&i.push({key:wt,pairKey:wt,model:Da,source:"",color:"var(--muted)",tokens:a});const o=new Map(i.filter(c=>c.key!==wt).map(c=>[c.pairKey,c])),s=i.map(c=>({key:c.key,model:c.model,source:c.source,color:c.color,tokens:c.tokens,...c.key===wt?{isUnattributed:!0}:{}})),l=Object.fromEntries(s.map(c=>[c.key,{label:c.source?`${c.source}:${c.model}`:c.model,color:c.color}])),u=n.map(({row:c,models:f,unattributedTokens:d,unattributedCostUsd:p})=>{const m={project:c.project,label:c.label,tokens:c.tokens,costUsd:c.costUsd,pct:c.pct,modelCount:c.models.length,segments:{}};for(const v of s)m[v.key]=0;for(const[v,y]of f){const b=o.get(v);b&&(m[b.key]=y.tokens,m.segments[b.key]={key:b.key,model:y.model,source:y.source,tokens:y.tokens,costUsd:y.costUsd,pct:y.pct})}return d>0&&(m[wt]=d,m.segments[wt]={key:wt,model:Da,source:"",tokens:d,costUsd:p,pct:c.tokens>0?d/c.tokens*100:0,isUnattributed:!0}),m});return{config:l,rows:u,series:s}}const Uo=["周一","周二","周三","周四","周五","周六","周日"],Am=Array.from({length:24},(e,t)=>String(t).padStart(2,"0"));function Sm(e){const t=new Date,r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return Array.from({length:e},(n,i)=>{const a=new Date(r);return a.setUTCDate(r.getUTCDate()-(e-1-i)),a.toISOString().slice(0,10)})}function Em(e){const[,t="",r=""]=e.split("-");return`${Number(t)}/${Number(r)}`}const td=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],Us=[{source:"claude-code",model:"claude-fable-5",terminal:"VS Code",project:"ai-usage",weight:26,scale:1.35},{source:"claude-code",model:"MiniMax-M3",terminal:"系统终端",project:"ai-usage",weight:18,scale:1.7},{source:"claude-code",model:"claude-sonnet-4-6",terminal:"VS Code",project:"dashboard",weight:12,scale:1},{source:"codex",model:"gpt-5",terminal:"系统终端",project:"api-service",weight:18,scale:1.2},{source:"codex",model:"gpt-5-mini",terminal:"VS Code",project:"docs-site",weight:10,scale:.72},{source:"cursor",model:"claude-sonnet-4-6",terminal:"Cursor",project:"design-system",weight:10,scale:.88},{source:"cursor",model:"gemini-2-5-pro",terminal:"Cursor",project:"marketing-site",weight:6,scale:1.08}],_u=365,A1=S1(),oi=E1(A1),ln={hourlyUsage:[],rangeDailyUsage:[],heatmapDailyUsage:[],heatmapDays:[],modelRows:[],hourlyApiRows:[],todayHourlyUsage:[],dailyUsage:[],summary:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0},changes:{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0},distributions:{terminals:[],tools:[],models:[],projects:[]},toolModelUsage:[],projectModelUsage:[]};function S1(){return Uo.flatMap((e,t)=>Am.map((r,n)=>{const i=_1(t,n),a=t>=5,o=Math.max(0,1-Math.abs(n-10)/5),s=Math.max(0,1-Math.abs(n-20)/5),l=(Math.sin((t+1)*(n+3)*.77)+1)/2,c=Math.min(1,.03+(a?.62:1)*(o*.4+s*.57)+l*.14),f=Math.round((500+c*38e3)*i.scale),d=.72+l*.12,p=Math.round(f*d),m=f-p,v=i.model.includes("MiniMax")||i.model.includes("fable")?.42+l*.28:.08+l*.18,y=Math.min(p,Math.round(p*v)),b=Pr(p*4e-6+m*16e-6);return{day:e,hour:n,hourLabel:r,inputTokens:p,cachedInputTokens:y,outputTokens:m,totalTokens:f,costUsd:b,durationMinutes:Math.round(3+c*72),source:i.source,model:i.model,terminal:i.terminal,project:i.project}}))}function E1(e){var u;const t=Mu(e),r=T1(e),n=e.map(c=>({day:c.day,hour:c.hour,hourLabel:c.hourLabel,inputTokens:c.inputTokens,cachedInputTokens:c.cachedInputTokens,outputTokens:c.outputTokens,totalTokens:c.totalTokens,costUsd:c.costUsd,durationMinutes:c.durationMinutes})),i=(u=r.at(-1))==null?void 0:u.day,a=i?n.filter(c=>c.day===i):[],o=C1(r),s=M1(o),l=I1(e,t.totalTokens);return{hourlyUsage:n,rangeDailyUsage:r,heatmapDailyUsage:o,heatmapDays:s,modelRows:l,hourlyApiRows:[],todayHourlyUsage:a,dailyUsage:r,summary:t,changes:Iu(r),distributions:{terminals:ia(e,c=>c.terminal),tools:ia(e,c=>c.source),models:ia(e,c=>c.model),projects:ia(e,c=>c.project)},toolModelUsage:Tu(e.map(c=>({source:c.source,tokens:c.totalTokens,costUsd:c.costUsd,models:[{model:c.model,tokens:c.totalTokens,costUsd:c.costUsd}]})),t.totalTokens),projectModelUsage:Cu(Object.values(e.reduce((c,f)=>{const d=c[f.project]??{project:f.project,tokens:0,costUsd:0,models:[]};return d.tokens+=f.totalTokens,d.costUsd+=f.costUsd,d.models.push({model:f.model,source:f.source,tokens:f.totalTokens,costUsd:f.costUsd}),c[f.project]=d,c},{})),t.totalTokens)}}function Tu(e,t){const r=new Map;for(const a of e){if(!a.source||a.tokens<=0)continue;const o=r.get(a.source)??{tokens:0,costUsd:0,models:new Map};o.tokens+=a.tokens,o.costUsd+=a.costUsd;for(const s of a.models){if(!s.model||s.tokens<=0)continue;const l=o.models.get(s.model)??{tokens:0,costUsd:0};l.tokens+=s.tokens,l.costUsd+=s.costUsd,o.models.set(s.model,l)}r.set(a.source,o)}const n=[...r.entries()].sort(([,a],[,o])=>o.tokens-a.tokens),i=t&&t>0?t:n.reduce((a,[,o])=>a+o.tokens,0);return n.map(([a,o])=>({source:a,tokens:o.tokens,costUsd:Pr(o.costUsd),pct:$a(o.tokens,i),models:[...o.models.entries()].sort(([,s],[,l])=>l.tokens-s.tokens).map(([s,l])=>({model:s,tokens:l.tokens,costUsd:Pr(l.costUsd),pct:$a(l.tokens,o.tokens)}))}))}function Cu(e,t=0){return e.filter(r=>r.tokens>0).map(r=>{const n=(r.models??[]).filter(i=>i.tokens>0).map(i=>({model:i.model,source:i.source,tokens:i.tokens,costUsd:Pr(i.costUsd),pct:i.pct??$a(i.tokens,r.tokens)})).sort((i,a)=>a.tokens-i.tokens);return{project:r.project,label:r.project==="unknown"?"未知项目":r.project,tokens:r.tokens,costUsd:Pr(r.costUsd),pct:t>0?$a(r.tokens,t):r.pct??0,models:n}}).sort((r,n)=>n.tokens-r.tokens)}function _1(e,t){const r=Us.reduce((i,a)=>i+a.weight,0);let n=(e*31+t*17)%r;for(const i of Us)if(n-=i.weight,n<0)return i;return Us[0]}function Mu(e){const t=e.reduce((r,n)=>({inputTokens:r.inputTokens+n.inputTokens,outputTokens:r.outputTokens+n.outputTokens,totalTokens:r.totalTokens+n.totalTokens,totalCostUsd:r.totalCostUsd+n.costUsd,totalDurationMinutes:r.totalDurationMinutes+n.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{...t,totalCostUsd:Pr(t.totalCostUsd)}}function T1(e){return Sm(Uo.length).map(r=>{const n=_m(r),i=e.filter(s=>s.day===n),a=Mu(i),o=i.reduce((s,l)=>s+l.cachedInputTokens,0);return{day:n,date:r,dateLabel:Em(r),...a,cachedInputTokens:o,uncachedInputTokens:a.inputTokens-o,costUsd:a.totalCostUsd,durationMinutes:a.totalDurationMinutes}})}function C1(e){return e.length===0?[]:Sm(_u).map((r,n)=>{const i=e[n%e.length],o=.35+(Math.sin(n*.37)+1)/2*.9,l=(n*17+11)%5!==0?o:0;return{...i,day:_m(r),date:r,dateLabel:Em(r),inputTokens:Math.round(i.inputTokens*l),cachedInputTokens:Math.round(i.cachedInputTokens*l),uncachedInputTokens:Math.round(i.uncachedInputTokens*l),outputTokens:Math.round(i.outputTokens*l),totalTokens:Math.round(i.totalTokens*l),costUsd:Pr(i.costUsd*l),durationMinutes:Math.round(i.durationMinutes*l)}})}function M1(e){return e.map(t=>({date:t.date,tokens:t.totalTokens,costUsd:t.costUsd,models:{}}))}function I1(e,t){const r=new Map;for(const i of e){const a=`${i.source}:${i.model}`,o=r.get(a)??{model:i.model,source:i.source,tokens:0,costUsd:0};o.tokens+=i.totalTokens,o.costUsd+=i.costUsd,r.set(a,o)}const n=Math.max(1,t);return[...r.values()].filter(i=>i.tokens>0).sort((i,a)=>a.tokens-i.tokens).map(i=>({...i,pct:i.tokens/n*100}))}function _m(e){const r=(new Date(`${e}T00:00:00.000Z`).getUTCDay()+6)%7;return Uo[r]}function Iu(e){if(e.length<2)return{totalCostUsd:0,totalTokens:0,inputTokens:0,outputTokens:0};const t=Math.floor(e.length/2),r=rd(e.slice(0,t)),n=rd(e.slice(t));return{totalCostUsd:aa(n.totalCostUsd,r.totalCostUsd),totalTokens:aa(n.totalTokens,r.totalTokens),inputTokens:aa(n.inputTokens,r.inputTokens),outputTokens:aa(n.outputTokens,r.outputTokens)}}function rd(e){const t=Math.max(1,e.length),r=e.reduce((n,i)=>({inputTokens:n.inputTokens+i.inputTokens,outputTokens:n.outputTokens+i.outputTokens,totalTokens:n.totalTokens+i.totalTokens,totalCostUsd:n.totalCostUsd+i.costUsd,totalDurationMinutes:n.totalDurationMinutes+i.durationMinutes}),{inputTokens:0,outputTokens:0,totalTokens:0,totalCostUsd:0,totalDurationMinutes:0});return{inputTokens:r.inputTokens/t,outputTokens:r.outputTokens/t,totalTokens:r.totalTokens/t,totalCostUsd:r.totalCostUsd/t,totalDurationMinutes:r.totalDurationMinutes/t}}function ia(e,t){const r=new Map;for(const n of e){const i=t(n),a=r.get(i)??{tokens:0,costUsd:0,durationMinutes:0};a.tokens+=n.totalTokens,a.costUsd+=n.costUsd,a.durationMinutes+=n.durationMinutes,r.set(i,a)}return[...r.entries()].sort(([,n],[,i])=>i.tokens-n.tokens).map(([n,i],a)=>({id:N1(n),label:n,color:td[a%td.length],tokens:i.tokens,costUsd:Pr(i.costUsd),durationMinutes:i.durationMinutes}))}function aa(e,t){return t<=0?0:Math.round((e-t)/t*1e4)/100}function $a(e,t){return t<=0?0:Math.round(e/t*1e3)/10}function N1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function Pr(e){return Math.round(e*100)/100}function Tm(e,t,r,n){const i=e.reduce((f,d)=>f+d.tokens,0),a=e.reduce((f,d)=>f+d.costUsd,0),o=an(),s=e.find(f=>f.date===o),l=(s==null?void 0:s.tokens)??(n==null?void 0:n.tokens)??0,u=(s==null?void 0:s.costUsd)??(n==null?void 0:n.costUsd)??0,c=D1(t,i);return{totalTokens:i,totalCostUsd:Math.round(a*1e8)/1e8,todayTokens:l,todayCostUsd:Math.round(u*1e8)/1e8,statsSince:r,bySource:c}}function D1(e,t){const r=new Map;for(const i of e){if(i.tokens<=0)continue;let a=r.get(i.source);a||(a={tokens:0,costUsd:0,models:new Map},r.set(i.source,a)),a.tokens+=i.tokens,a.costUsd+=i.costUsd;const o=a.models.get(i.model)??{tokens:0,costUsd:0};o.tokens+=i.tokens,o.costUsd+=i.costUsd,a.models.set(i.model,o)}const n=t>0?t:[...r.values()].reduce((i,a)=>i+a.tokens,0);return Array.from(r.entries()).map(([i,a])=>({source:i,tokens:a.tokens,costUsd:Math.round(a.costUsd*1e8)/1e8,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:Array.from(a.models.entries()).map(([o,s])=>({model:o,tokens:s.tokens,costUsd:Math.round(s.costUsd*1e8)/1e8,pct:a.tokens>0?Math.round(s.tokens/a.tokens*1e3)/10:0})).sort((o,s)=>s.tokens-o.tokens)})).sort((i,a)=>a.tokens-i.tokens)}const nd=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)","var(--chart-6)","var(--chart-7)","var(--chart-8)"],$1={claude:"claude-code",codex:"codex",cursor:"cursor",qoder:"qoder",trae:"trae",gemini:"gemini",opencode:"opencode",copilot:"copilot",antigravity:"antigravity",openclaw:"openclaw",hermes:"hermes",zcode:"zcode",pi:"pi",kimi:"kimi",roocode:"roocode",droid:"droid",kiro:"kiro",cline:"cline",amp:"amp",qwen:"qwen-code",codebuddy:"codebuddy",workbuddy:"workbuddy",grok:"grok",mimo:"mimo","every-code":"every-code",omp:"omp","kilo-cli":"kilo-cli",kilocode:"kilocode",goose:"goose",zed:"zed",warp:"warp"};function R1(e,t=new Date){const r=Eu(void 0,t);return e.filter(n=>n.hour<=r)}function L1(e,t=new Date){return{...e,todayHourlyUsage:R1(e.todayHourlyUsage,t)}}function U1(e,t){var y;if(e.dailyRows.length===0)return L1(oi);const r=an(),n=Qf(t),i=e.dailyRows.filter(b=>b.date>=n&&b.date<=r),a=Qf(_u),o=e.dailyRows.filter(b=>b.date>=a&&b.date<=r),s=e.modelRows.filter(b=>b.tokens>0),l=Tm(i,s,((y=e.syncStatus)==null?void 0:y.statsSince)||e.summary.statsSince,{tokens:e.summary.todayTokens,costUsd:e.summary.todayCostUsd}),u=i.map(kl),c=o.map(kl),f=o.map(b=>({date:b.date,tokens:b.tokens,costUsd:b.costUsd,models:b.models??{},projects:b.projects})),d=K1(u),p=Cm(u),m=e.hourlyRows??[],v=Nu(m,r,Eu());return{summary:p,rangeDailyUsage:u,heatmapDailyUsage:c,heatmapDays:f,modelRows:s,hourlyApiRows:m,todayHourlyUsage:v,dailyUsage:d,hourlyUsage:[],changes:Iu(u),distributions:Mm(l.bySource,s,e.projectRows,p),toolModelUsage:Tu(l.bySource,p.totalTokens),projectModelUsage:Cu(e.projectRows,p.totalTokens)}}function id(e){const t=/^(\d{4}-\d{2}-\d{2})/.exec(String(e).trim());return(t==null?void 0:t[1])??""}function Nu(e,t,r){const n=r===void 0?23:Math.min(Math.max(r,0),23),i=id(t),a=new Map;for(const s of e){if(!i||id(s.date)!==i)continue;const l=Number(s.hour);if(!Number.isInteger(l)||l<0||l>23)continue;const u=a.get(l)??{tokens:0,costUsd:0,inputTokens:0,outputTokens:0,cachedInputTokens:0};u.tokens+=s.tokens,u.costUsd+=s.costUsd,u.inputTokens+=s.inputTokens,u.outputTokens+=s.outputTokens,u.cachedInputTokens+=s.cachedInputTokens,a.set(l,u)}const o=Du(i||t);return Array.from({length:n+1},(s,l)=>{const u=a.get(l),c=Am[l]??String(l).padStart(2,"0");if(!u)return H1(o,l,c);const f=u.inputTokens,d=u.outputTokens,p=Math.min(f,u.cachedInputTokens);return{day:o,hour:l,hourLabel:c,inputTokens:f,cachedInputTokens:p,outputTokens:d,totalTokens:u.tokens>0?u.tokens:f+d,costUsd:u.costUsd,durationMinutes:0}})}function z1(e,t){const r=e.heatmapDays.find(m=>m.date===t),n=e.heatmapDailyUsage.find(m=>m.date===t),i=r??{date:t,tokens:(n==null?void 0:n.totalTokens)??0,costUsd:(n==null?void 0:n.costUsd)??0,models:{}},a=n??kl(i,e.heatmapDailyUsage.length),o=B1(e.modelRows),s=F1(i,o),l=W1(i,o),u=Tm([i],s,""),c=Cm([a]),f=an(),d=t===f?Eu():void 0,p=Nu(e.hourlyApiRows,t,d);return{...e,summary:c,rangeDailyUsage:[a],modelRows:s,todayHourlyUsage:p,hourlyUsage:[],changes:Iu([a]),distributions:Mm(u.bySource,s,l,c),toolModelUsage:Tu(u.bySource,c.totalTokens),projectModelUsage:Cu(l,c.totalTokens)}}function B1(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function F1(e,t){const r=Object.entries(e.models??{}).filter(([,a])=>a>0);if(r.length===0)return[];const n=r.reduce((a,[,o])=>a+o,0),i=Ra(e.costUsd,r.map(([,a])=>a));return r.map(([a,o],s)=>{const l=Ti(a),u=l.source??t.get(l.model)??"unknown";return{model:l.model,source:u,tokens:o,costUsd:i[s]??0,pct:n>0?Math.round(o/n*1e3)/10:0}}).sort((a,o)=>o.tokens-a.tokens)}function W1(e,t){const r=(e.projects??[]).filter(a=>a.tokens>0);if(r.length===0)return[];const n=r.reduce((a,o)=>a+o.tokens,0),i=Ra(e.costUsd,r.map(a=>a.tokens));return r.map((a,o)=>{const s=Object.entries(a.models??{}).filter(([,c])=>c>0),l=Ra(i[o]??0,s.map(([,c])=>c)),u=s.map(([c,f],d)=>{const p=Ti(c),m=p.source??t.get(p.model)??"unknown";return{model:p.model,source:m,tokens:f,costUsd:l[d]??0,pct:a.tokens>0?Math.round(f/a.tokens*1e3)/10:0}}).sort((c,f)=>f.tokens-c.tokens);return{project:a.project,tokens:a.tokens,costUsd:i[o]??0,pct:n>0?Math.round(a.tokens/n*1e3)/10:0,models:u}}).sort((a,o)=>o.tokens-a.tokens)}function kl(e,t){const r=oi.dailyUsage[t%oi.dailyUsage.length],n=Bs(r.inputTokens,r.totalTokens,.78),i=Bs(r.cachedInputTokens,r.inputTokens,.2),a=Math.round(e.tokens*n),o=Math.max(0,e.tokens-a),s=Math.min(a,Math.round(a*i)),l=Math.round(e.tokens*Bs(oi.summary.totalDurationMinutes,oi.summary.totalTokens,0));return{day:Du(e.date),date:e.date,dateLabel:Nm(e.date),inputTokens:a,cachedInputTokens:s,uncachedInputTokens:a-s,outputTokens:o,totalTokens:e.tokens,costUsd:q1(e.costUsd),durationMinutes:l}}function K1(e){var n;const t=new Map(e.map(i=>[i.date,i])),r=Im(((n=e.at(-1))==null?void 0:n.date)??new Date().toISOString());return Array.from({length:7},(i,a)=>{const o=new Date(r);o.setUTCDate(r.getUTCDate()-(6-a));const s=o.toISOString().slice(0,10),l=t.get(s);return l||{day:Du(s),date:s,dateLabel:Nm(s),inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}})}function Cm(e){return Mu(e.map(t=>({day:t.day,hour:0,hourLabel:"00",inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens,outputTokens:t.outputTokens,totalTokens:t.totalTokens,costUsd:t.costUsd,durationMinutes:t.durationMinutes})))}function H1(e,t,r){return{day:e,hour:t,hourLabel:r,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0}}function Mm(e,t,r,n){const i=e.map(o=>({label:$1[o.source]??o.source,tokens:o.tokens,costUsd:o.costUsd})),a=new Map;for(const o of t){const s=a.get(o.model)??{label:o.model,tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,a.set(o.model,s)}return{tools:i.length>0?zs(i,n,6):[],models:a.size>0?zs([...a.values()],n,6):[],terminals:[],projects:r.length>0?zs(r.map(o=>({label:o.project==="unknown"?"未知项目":o.project,tokens:o.tokens,costUsd:o.costUsd})),n,6):[]}}function zs(e,t,r=8){const n=e.filter(u=>u.tokens>0).sort((u,c)=>c.tokens-u.tokens),i=n.slice(0,r),a=n.slice(r);a.length>0&&i.push({label:"其他",tokens:a.reduce((u,c)=>u+c.tokens,0),costUsd:a.reduce((u,c)=>u+c.costUsd,0)});const o=Ol(t.totalTokens,i.map(u=>u.tokens)),s=Ra(t.totalCostUsd,i.map(u=>u.costUsd||u.tokens)),l=Ol(t.totalDurationMinutes,i.map(u=>u.tokens));return i.map((u,c)=>({id:G1(u.label)||`item-${c}`,label:u.label,color:nd[c%nd.length],tokens:o[c]??0,costUsd:s[c]??0,durationMinutes:l[c]??0}))}function Ol(e,t){if(t.length===0)return[];const r=Math.max(0,Math.round(e)),n=t.reduce((l,u)=>l+Math.max(0,u),0);if(n<=0)return t.map(()=>0);const i=t.map(l=>Math.max(0,l)/n*r),a=i.map(Math.floor);let o=r-a.reduce((l,u)=>l+u,0);const s=i.map((l,u)=>({index:u,fraction:l-Math.floor(l)})).sort((l,u)=>u.fraction-l.fraction);for(let l=0;l<o;l+=1){const u=s[l%s.length];a[u.index]+=1}return a}function Ra(e,t){return Ol(Math.round(e*100),t).map(r=>r/100)}function Bs(e,t,r){return t>0?e/t:r}function Du(e){const r=(Im(e).getUTCDay()+6)%7;return Uo[r]}function Im(e){return new Date(`${e.slice(0,10)}T00:00:00.000Z`)}function Nm(e){const[,t="",r=""]=e.slice(0,10).split("-");return`${Number(t)}/${Number(r)}`}function G1(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}function q1(e){return Math.round(e*100)/100}function Dm(e=[],t=[]){if(e.length>0)return e.filter(i=>i.tokens>0).map(i=>i.source);const r=new Set,n=[];for(const i of t)i.tokens<=0||r.has(i.source)||(r.add(i.source),n.push(i.source));return n}function $m(e){const t=new Map;for(const r of e)t.has(r.model)||t.set(r.model,r.source);return t}function Rm(e,t){if(t==null)return e;const r=new Set(e);return t.filter(n=>r.has(n))}function ad(e){var r;const t=((r=e==null?void 0:e.toLowerCase)==null?void 0:r.call(e))??"";return t==="claude-code"||t.startsWith("claude")?"claude":t==="codex"||t.startsWith("codex")?"codex":t==="cursor"||t.startsWith("cursor")?"cursor":t==="qoder"||t.startsWith("qoder")?"qoder":t==="trae"||t.startsWith("trae")?"trae":t}function $n(e,t){if(t.has(e))return!0;const r=ad(e);for(const n of t)if(ad(n)===r)return!0;return!1}function Lm(e,t,r,n){if(t==null&&r==null)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=Object.entries(e).filter(([,l])=>l>0);if(i.length===0)return n.fallbackShare;const a=t==null?null:new Set(n.activeSources);let o=0,s=0;for(const[l,u]of i){o+=u;const c=Ti(l),f=c.source??n.sourceFallback.get(c.model)??"unknown";c.model,!(a&&!$n(f,a))&&(s+=u)}return o>0?s/o:0}function Um(e,t,r,n){if(t==null&&r==null||e.length===0)return 1;if(t!=null&&n.activeSources.length===0)return 0;const i=t==null?null:new Set(n.activeSources);let a=0,o=0;for(const s of e)s.tokens<=0||(a+=s.tokens,!(i&&!$n(s.source,i))&&(o+=s.tokens));return a>0?o/a:0}function Y1(e,t,r){if(t==null)return e;if(r.activeSources.length===0)return{};const n=new Set(r.activeSources),i={};for(const[a,o]of Object.entries(e)){if(o<=0)continue;const s=Ti(a),l=s.source??r.sourceFallback.get(s.model)??"unknown";$n(l,n)&&(i[a]=o)}return i}function V1(e){if(e.selectedSources.length===0)return{dailyRows:e.dailyRows,hourlyRows:e.hourlyRows};const t=e.selectedSources,r=Dm(e.toolRows,e.modelRows),n=Rm(r,t),i=$m(e.modelRows),a=Um(e.modelRows,t,null,{activeSources:n}),o=new Map(e.heatmapDays.map(f=>[f.date,f])),s=f=>{const d=o.get(f);return d?Lm(d.models??{},t,null,{activeSources:n,sourceFallback:i,fallbackShare:a}):a},l=e.dailyRows.map(f=>J1(f,s(f.date))),u=e.hourlyDate;let c=e.hourlyRows;if(u!=null)if(e.hourlyApiRows.length===0)c=e.hourlyRows.map(f=>Q1(f,s(u)));else{const f=new Set(n),d=n.length===0?[]:e.hourlyApiRows.filter(m=>$n(m.source||"unknown",f)),p=e.hourlyRows.length>0?Math.max(...e.hourlyRows.map(m=>m.hour)):void 0;c=Nu(d,u,p)}return{dailyRows:l,hourlyRows:c}}function X1(e,t){if(t.length===0)return e;const r=new Set(t),n=[];for(const i of e){const a=i.models.filter(l=>$n(l.source,r));if(a.length===0)continue;const o=a.reduce((l,u)=>l+u.tokens,0);if(o<=0)continue;const s=a.reduce((l,u)=>l+u.costUsd,0);n.push({...i,tokens:o,costUsd:s,models:a.map(l=>({...l,pct:o>0?Math.round(l.tokens/o*1e3)/10:0}))})}return n.sort((i,a)=>a.tokens-i.tokens)}function Z1(e){const t=e.filter(a=>a.tokens>0).sort((a,o)=>o.tokens-a.tokens),r=t.map((a,o)=>({id:a.source,label:qe(a.source),color:Na(o),tokens:a.tokens,costUsd:a.costUsd,durationMinutes:0})),n=new Map;for(const a of t)for(const o of a.models){if(!o.model||o.tokens<=0)continue;const s=n.get(o.model)??{tokens:0,costUsd:0};s.tokens+=o.tokens,s.costUsd+=o.costUsd,n.set(o.model,s)}const i=[...n.entries()].sort(([,a],[,o])=>o.tokens-a.tokens).map(([a,o],s)=>({id:a,label:a,color:Na(s),tokens:o.tokens,costUsd:o.costUsd,durationMinutes:0}));return{tools:r,models:i}}function J1(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,uncachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,uncachedInputTokens:Math.max(0,r-n),outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}function Q1(e,t){if(t===1)return e;if(t<=0)return{...e,inputTokens:0,cachedInputTokens:0,outputTokens:0,totalTokens:0,costUsd:0,durationMinutes:0};const r=Math.round(e.inputTokens*t),n=Math.min(r,Math.round(e.cachedInputTokens*t));return{...e,inputTokens:r,cachedInputTokens:n,outputTokens:Math.round(e.outputTokens*t),totalTokens:Math.round(e.totalTokens*t),costUsd:e.costUsd*t,durationMinutes:Math.round(e.durationMinutes*t)}}const Fs=14,Hr=3,$u=18,od=52,eP=80,tP=340,Ws=156,rP=["日","一","二","三","四","五","六"],nP=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];function iP(e,t){const r=Math.max(0,t-1)*Hr,n=Math.max(0,e-$u-r);return Math.max(1,Math.floor(n/t)||1)}function aP(e){const t=h.useRef(null),[r,n]=h.useState(Fs),[i,a]=h.useState(e);return h.useEffect(()=>{const o=t.current;if(!o||e<=0)return;const s=()=>{const u=o.clientWidth,c=Math.floor((u-$u+Hr)/(Fs+Hr)),f=Math.max(1,Math.min(e,c||1));f>=e?(a(e),n(iP(u,e))):(a(f),n(Fs))};s();const l=new ResizeObserver(s);return l.observe(o),window.addEventListener("resize",s),()=>{l.disconnect(),window.removeEventListener("resize",s)}},[e]),{containerRef:t,cellSize:r,visibleWeeks:i}}function oP({cell:e,heatmapColors:t,modelEntries:r,isLoading:n}){const i=r;return g.jsxs("div",{className:"grid min-w-0 gap-2 text-xs",children:[g.jsxs("div",{className:"flex items-center justify-between gap-4",children:[g.jsx("span",{className:"font-medium text-foreground",children:e.day}),g.jsxs("span",{className:"text-[10px] text-muted",children:["等级 ",e.level]})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full",style:{background:t[e.level]}}),g.jsx("span",{className:"flex-1 text-muted",children:"总用量"}),g.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",title:Pn(e.value),children:oe(e.value)})]}),n?g.jsxs("div",{"aria-label":"正在加载模型明细",className:"grid gap-2 pt-0.5",children:[g.jsx("span",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-3 w-full animate-pulse rounded bg-surface-secondary"}),g.jsx("span",{className:"h-1 w-full animate-pulse rounded bg-surface-secondary"})]}):i.length>0?g.jsxs("div",{className:"grid gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:"模型明细"}),i.map(({key:a,name:o,source:s,val:l})=>{const u=e.value||1,c=Math.round(l/u*100),f=s?`${qe(s)} · ${o}`:o;return g.jsxs("div",{className:"grid min-w-0 gap-1",children:[g.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3",children:[g.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 overflow-hidden",children:[s&&g.jsx(xr,{className:"shrink-0",provider:s,size:12}),g.jsx("span",{className:"truncate",title:f,children:f})]}),g.jsxs("span",{className:"whitespace-nowrap font-mono text-muted tabular-nums",title:Pn(l),children:[oe(l)," · ",c,"%"]})]}),g.jsx("div",{className:"h-1 overflow-hidden rounded-full bg-surface-secondary",children:g.jsx("div",{className:"h-full rounded-full bg-accent",style:{width:`${c}%`}})})]},a)})]}):null]})}function sP(e,t,r){const n=Object.entries(e.models??{}).map(([o,s])=>{const l=Ti(o),u=l.source??t.get(l.model);return{key:o,name:l.model,source:u,val:s}}).filter(({val:o,source:s})=>o<=0?!1:r?s?$n(s,r):!1:!0).sort((o,s)=>s.val-o.val),i=n.slice(0,6),a=new Set(i.map(o=>o.source).filter(Boolean));for(const o of n.slice(6))o.source&&!a.has(o.source)&&(i.push(o),a.add(o.source));return i}const lP=h.memo(function({visible:t,cellSize:r,selectedDate:n,onSelectDate:i,onPointerOver:a,onPointerLeave:o,onFocus:s,onBlur:l}){return g.jsx("div",{style:{gridColumn:"2 / -1",display:"grid",gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${r}px)`,gridTemplateColumns:`repeat(${t.length}, ${r}px)`,gap:Hr},onBlur:l,onFocus:s,onPointerLeave:o,onPointerOver:a,children:t.map((u,c)=>u.map((f,d)=>{if(!f)return null;const p=Pl[f.level]??Pl[0],m=n===f.day;return g.jsx("button",{"aria-label":`${f.day},${Pn(f.value)} Token`,"aria-pressed":i?m:void 0,className:m?"block cursor-pointer rounded-[3px] ring-1 ring-accent transition-[transform,background-color] duration-100 hover:scale-110":"block cursor-pointer rounded-[3px] transition-[transform,background-color] duration-100 hover:scale-110","data-day-index":d,"data-day":f.day,"data-week-index":c,style:{width:r,height:r,background:p},type:"button",onClick:()=>i==null?void 0:i(f.day)},f.day||`e-${c}-${d}`)}))})});function uP({days:e,models:t=[],toolRows:r=[],embedded:n=!1,hidePlatformFilter:i=!1,selectedSources:a,onSelectedSourcesChange:o,selectedDate:s=null,onSelectDate:l}){const{theme:u}=Aw(),[c,f]=h.useState(null),d=a??c,p=o??f,m=h.useMemo(()=>k1(t),[t]),v=h.useMemo(()=>Dm(r,t),[t,r]),y=h.useMemo(()=>Rm(v,d),[v,d]),b=h.useMemo(()=>$m(t),[t]),x=h.useMemo(()=>Um(t,d,null,{activeSources:y}),[y,t,d]),w=h.useMemo(()=>d==null?e:e.map(C=>{const W=C.models??{},I=Lm(W,d,null,{activeSources:y,sourceFallback:b,fallbackShare:x}),Te=Y1(W,d,{activeSources:y,sourceFallback:b});return{...C,tokens:Math.round(C.tokens*I),costUsd:C.costUsd*I,models:Te}}),[y,e,x,d,b]),P=h.useMemo(()=>y1(w.map(C=>({date:C.date,tokens:C.tokens,models:C.models})),od),[w]),O=P.weeks,{containerRef:k,cellSize:j,visibleWeeks:E}=aP(O.length||od),_=h.useMemo(()=>O.slice(-E),[O,E]),M=Pl,T=h.useMemo(()=>b1(_.length,P.to,nP),[_.length,P.to]),[S,N]=h.useState(null),D=h.useRef(null),z=h.useRef(0),K=h.useCallback(C=>{D.current=C,N(C)},[]);h.useEffect(()=>()=>{window.clearTimeout(z.current)},[]);const F=h.useCallback(C=>{var We,_t;const W=C.dataset.day,I=Number(C.dataset.weekIndex),Te=Number(C.dataset.dayIndex),te=(We=_[I])==null?void 0:We[Te];if(!W||!te||(window.clearTimeout(z.current),((_t=D.current)==null?void 0:_t.day)===W)||!C.isConnected)return;const Ce=C.getBoundingClientRect();K({day:W,cell:te,left:Ce.left+Ce.width/2,top:Ce.top,bottom:Ce.bottom})},[K,_]),H=h.useCallback(()=>{window.clearTimeout(z.current),z.current=window.setTimeout(()=>K(null),eP)},[K]),B=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),X=h.useCallback(C=>{const W=C.target.closest("[data-day]");W&&F(W)},[F]),ye=S!=null;h.useEffect(()=>{if(!ye)return;const C=()=>K(null);return window.addEventListener("scroll",C,{capture:!0,passive:!0}),()=>window.removeEventListener("scroll",C,{capture:!0})},[ye,K]);const ne=`${$u}px repeat(${_.length}, ${j}px)`,Ze=d==null?v:d.filter(C=>v.includes(C)),Le=h.useMemo(()=>d==null?null:new Set(y),[y,d]),_e=(S==null?void 0:S.cell)??null,[ot,Yt]=h.useState(null);if(h.useEffect(()=>{if(!_e){Yt(null);return}Yt(null);const C=window.requestAnimationFrame(()=>{Yt({day:_e.day,entries:sP(_e,m,Le)})});return()=>window.cancelAnimationFrame(C)},[m,Le,_e]),!O.length)return g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"暂无用量数据"});let Ue=null;if(S&&_e){const C=S.top<tP,W=Math.min(Math.max(S.left,Ws),Math.max(Ws,window.innerWidth-Ws));Ue=_i.createPortal(g.jsx("div",{className:"pointer-events-none fixed z-50 w-72 max-w-[calc(100vw-24px)] rounded-[10px] border-0 bg-overlay p-3 text-overlay-foreground shadow-surface",role:"tooltip",style:{left:W,top:C?S.bottom+8:S.top-8,transform:C?"translateX(-50%)":"translate(-50%, -100%)"},children:g.jsx(oP,{cell:_e,heatmapColors:M,isLoading:(ot==null?void 0:ot.day)!==_e.day,modelEntries:(ot==null?void 0:ot.day)===_e.day?ot.entries:[]})}),document.body)}const R=g.jsxs("div",{ref:k,className:"w-full min-w-0",children:[!i||!n?g.jsxs("div",{className:"mb-2 flex items-center justify-end gap-3",children:[n?null:g.jsx("span",{className:"mr-auto text-xs text-muted",children:ed()}),i?null:g.jsx(h1,{allSources:v,value:Ze,onChange:C=>p1(C,v,p)})]}):null,d!=null&&y.length===0?g.jsx("div",{className:"w-full py-8 text-center text-sm text-muted",children:"请至少选择一个平台"}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-full overflow-hidden",children:g.jsxs("div",{className:"w-full min-w-0",children:[g.jsxs("div",{className:"mb-1.5 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("span",{}),T.map(C=>g.jsx("span",{style:{gridColumnStart:C.index+2,whiteSpace:"nowrap"},children:C.label},`${C.label}-${C.index}`))]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:ne,columnGap:Hr},children:[g.jsx("div",{className:"pr-1 text-[10px] font-medium text-muted",style:{display:"grid",gridTemplateRows:`repeat(7, ${j}px)`,rowGap:Hr},children:rP.map(C=>g.jsx("span",{className:"flex items-center",style:{lineHeight:1},children:C},C))}),g.jsx(lP,{cellSize:j,onBlur:H,onFocus:X,onPointerLeave:H,onPointerOver:B,onSelectDate:l,selectedDate:s,visible:_})]})]})}),g.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[g.jsx("span",{className:"text-[10px] font-medium text-muted",children:ed()}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-[10px] text-muted",children:"少"}),g.jsx("div",{className:"flex gap-1",children:M.map((C,W)=>g.jsx("span",{className:"size-3 rounded-[2px]",style:{background:C}},W))}),g.jsx("span",{className:"text-[10px] text-muted",children:"多"})]})]}),Ue]})]});return n?R:g.jsx(q,{children:g.jsx(q.Content,{children:R})})}function cP({dailyUsage:e,heatmapDays:t,modelRows:r=[],metricTrends:n,summary:i,selectedDate:a=null,onSelectDate:o}){const s=[{label:"预估费用",value:i.totalCostUsd,format:at,exactFormat:at,trend:{comparison:n.totalCostUsd,display:"percent",values:e.map(l=>l.costUsd)}},{label:"总 Token",value:i.totalTokens,format:oe,exactFormat:Pn,trend:{comparison:n.totalTokens,display:"percent",values:e.map(l=>l.totalTokens)}},{label:"输入 Token",value:i.inputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.inputTokens,display:"tokens",values:e.map(l=>l.inputTokens)}},{label:"输出 Token",value:i.outputTokens,format:oe,exactFormat:Pn,trend:{comparison:n.outputTokens,display:"tokens",values:e.map(l=>l.outputTokens)}}];return g.jsxs("section",{"aria-label":"用量概览",className:"w-full",children:[g.jsx("div",{className:"grid grid-cols-1 gap-2.5 sm:grid-cols-2 lg:grid-cols-4",children:s.map(l=>{var u;return g.jsx(q,{className:"h-[5.5rem] min-h-[5.5rem] min-w-0 overflow-hidden rounded-2xl p-3",children:g.jsxs(q.Content,{className:"grid h-full grid-rows-[1.25rem_1fr] content-start gap-3 p-0",children:[g.jsxs("div",{className:"flex h-5 min-w-0 items-center justify-between gap-2",children:[g.jsx("p",{className:"min-w-0 truncate text-xs font-medium leading-5 text-muted",children:l.label}),g.jsx("div",{className:"flex h-5 shrink-0 items-center justify-end",children:l.trend.comparison?g.jsx(pP,{display:l.trend.display,trend:l.trend.comparison}):null})]}),g.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_64px] items-end gap-2",children:[g.jsx(dP,{exactFormat:l.exactFormat,format:l.format,label:l.label,value:l.value}),g.jsx(hP,{isIncrease:(((u=l.trend.comparison)==null?void 0:u.changeValue)??0)>=0,label:`近 7 日${l.label}趋势`,values:l.trend.values})]})]})},l.label)})}),g.jsx(q,{className:"mt-4",children:g.jsx(q.Content,{children:g.jsx(fP,{days:t,modelRows:r,onSelectDate:o,selectedDate:a})})})]})}function fP({days:e,modelRows:t,selectedDate:r,onSelectDate:n}){return g.jsx(uP,{days:e,embedded:!0,models:t,onSelectDate:n,selectedDate:r})}function dP({exactFormat:e,format:t,label:r,value:n}){const i=vP(n);return g.jsx("div",{"aria-label":`${r} ${e(n)}`,className:"min-w-0 truncate text-lg font-semibold leading-7 tracking-tight text-foreground tabular-nums",title:e(n),children:t(i)})}function hP({label:e,values:t,isIncrease:r}){const n=h.useId().replace(/:/g,""),i=h.useMemo(()=>t.filter(p=>Number.isFinite(p)),[t]);if(i.length<2)return g.jsx("div",{"aria-hidden":"true",className:"h-6 w-16 justify-self-end"});const a=64,o=24,s=2,l=Math.min(...i),c=Math.max(...i)-l||1,f=r?"var(--chart-2)":"var(--chart-5)",d=i.map((p,m)=>{const v=s+m/Math.max(i.length-1,1)*(a-s*2),y=o-s-(p-l)/c*(o-s*2);return`${m===0?"M":"L"} ${v.toFixed(2)} ${y.toFixed(2)}`}).join(" ");return g.jsx("div",{"aria-label":e,className:"pointer-events-none h-6 w-16 justify-self-end",role:"img",children:g.jsxs("svg",{"aria-hidden":"true",className:"h-full w-full overflow-visible",viewBox:`0 0 ${a} ${o}`,children:[g.jsx("defs",{children:g.jsxs("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:f,stopOpacity:.24}),g.jsx("stop",{offset:"100%",stopColor:f,stopOpacity:0})]})}),g.jsx("path",{d:`${d} L ${a-s} ${o} L ${s} ${o} Z`,fill:`url(#${n})`}),g.jsx("path",{d,fill:"none",stroke:f,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})]})})}function pP({display:e,trend:t}){const r=t.changeValue>=0,n=r?"上涨":"下降",i=e==="tokens"?`${r?"+":"−"}${oe(Math.abs(t.changeValue))}`:`${Math.abs(t.changePct).toFixed(1)}%`;return g.jsxs(Ia,{"aria-label":`${n} ${i}`,className:"shrink-0",color:r?"success":"danger",size:"sm",variant:"soft",children:[g.jsx("span",{"aria-hidden":"true",children:r?"↑":"↓"}),g.jsx(Ia.Label,{className:"tabular-nums",children:i})]})}function vP(e,t=1200){const[r,n]=h.useState(e),i=h.useRef(e);return h.useEffect(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){i.current=e,n(e);return}const a=i.current;if(Object.is(a,e)||Math.abs(a-e)<1e-9){i.current=e,n(e);return}let o=0;const s=performance.now(),l=u=>{const c=Math.min((u-s)/t,1),f=1-Math.pow(1-c,3),d=a+(e-a)*f;i.current=d,n(d),c<1&&(o=requestAnimationFrame(l))};return o=requestAnimationFrame(l),()=>cancelAnimationFrame(o)},[t,e]),r}const La=[{id:"hawking",image:Sw,glow:{primary:"#ff7a1a",accent:"#ffd21f"}},{id:"yoyo",image:Ew,glow:{primary:"#2f7df6",accent:"#ffd84a"}},{id:"click",image:_w,glow:{primary:"#51d6a2",accent:"#ff7b8d"}}],un=72,mP=110,gP=2400,sd=80,ld=88;function ud(e){const t=La.filter(n=>n.id!==e),r=t.length>0?t:La;return r[Math.floor(Math.random()*r.length)].id}function yP(){const[e,t]=h.useState(()=>ud()),r=h.useRef(null);h.useEffect(()=>{const a=window.setInterval(()=>{t(o=>ud(o))},gP);return()=>window.clearInterval(a)},[]),h.useEffect(()=>{const a=r.current;if(!a)return;let o=0,s=null,l=-un,u=1;const c=f=>{if(o=requestAnimationFrame(c),s==null){s=f;return}const d=Math.min(.05,(f-s)/1e3);s=f,l+=u*mP*d,l>=un?(l=un,u=-1):l<=-un&&(l=-un,u=1),a.style.transform=`translateX(${l}px) scaleX(${u>0?1:-1})`};return o=requestAnimationFrame(c),()=>cancelAnimationFrame(o)},[e]);const n=La.find(a=>a.id===e)??La[0],i=sd+un*2;return g.jsx("div",{"aria-hidden":"true",className:"pet-running-loader",style:{width:i,height:ld,"--pet-glow-primary":n.glow.primary,"--pet-glow-accent":n.glow.accent},children:g.jsx("img",{alt:"",className:"pet-running-loader__sprite",height:ld,ref:r,src:n.image,width:sd})})}const cd=["小伙伴跑腿去了…","数据在前面,冲!","再跑两步就好…","正在追 Token…","加载加速中,呼呼~","马上就回来~","别急,它跑得很快","捡数据路上…"],bP=1800;function Ks(e){const t=cd.filter(n=>n!==e),r=t.length>0?t:cd;return r[Math.floor(Math.random()*r.length)]}function fd({visible:e}){const[t,r]=h.useState(()=>Ks());return h.useEffect(()=>{if(!e)return;r(Ks());const n=window.setInterval(()=>{r(i=>Ks(i))},bP);return()=>window.clearInterval(n)},[e]),e?g.jsx("div",{"aria-busy":"true","aria-live":"polite",className:"absolute inset-0 z-10 bg-background/40",role:"status",children:g.jsx("div",{className:"pointer-events-none fixed inset-0 z-10 flex items-center justify-center",children:g.jsxs("div",{className:"relative flex items-center justify-center",children:[g.jsx(yP,{}),g.jsx("p",{className:"absolute top-full mt-3 min-h-5 w-max text-center text-sm text-muted transition-opacity duration-200",children:t},t)]})})}):null}var xP=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Ru(e){if(typeof e!="string")return!1;var t=xP;return t.includes(e)}var wP=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],PP=new Set(wP);function zm(e){return typeof e!="string"?!1:PP.has(e)}function Bm(e){return typeof e=="string"&&e.startsWith("data-")}function et(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(zm(r)||Bm(r))&&(t[r]=e[r]);return t}function Xr(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return et(t)}return typeof e=="object"&&!Array.isArray(e)?et(e):null}function Ve(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(zm(r)||Bm(r)||Ru(r))&&(t[r]=e[r]);return t}function kP(e){return e==null?null:h.isValidElement(e)?Ve(e.props):typeof e=="object"&&!Array.isArray(e)?Ve(e):null}var OP=["children","width","height","viewBox","className","style","title","desc"];function jl(){return jl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jl.apply(null,arguments)}function jP(e,t){if(e==null)return{};var r,n,i=AP(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function AP(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Fm=h.forwardRef((e,t)=>{var{children:r,width:n,height:i,viewBox:a,className:o,style:s,title:l,desc:u}=e,c=jP(e,OP),f=a||{width:n,height:i,x:0,y:0},d=Z("recharts-surface",o);return h.createElement("svg",jl({},Ve(c),{className:d,width:n,height:i,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,l),h.createElement("desc",null,u),r)}),SP=["children","className"];function Al(){return Al=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Al.apply(null,arguments)}function EP(e,t){if(e==null)return{};var r,n,i=_P(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _P(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var he=h.forwardRef((e,t)=>{var{children:r,className:n}=e,i=EP(e,SP),a=Z("recharts-layer",n);return h.createElement("g",Al({className:a},Ve(i),{ref:t}),r)}),TP=h.createContext(null);function ae(e){return function(){return e}}const Wm=Math.cos,Ua=Math.sin,St=Math.sqrt,za=Math.PI,zo=2*za,Sl=Math.PI,El=2*Sl,Rr=1e-6,CP=El-Rr;function Km(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function MP(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Km;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class IP{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Km:MP(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,a,o){this._append`C${+t},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,r,n,i,a){if(t=+t,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=n-t,u=i-r,c=o-t,f=s-r,d=c*c+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>Rr)if(!(Math.abs(f*l-u*c)>Rr)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,m=i-s,v=l*l+u*u,y=p*p+m*m,b=Math.sqrt(v),x=Math.sqrt(d),w=a*Math.tan((Sl-Math.acos((v+d-y)/(2*b*x)))/2),P=w/x,O=w/b;Math.abs(P-1)>Rr&&this._append`L${t+P*c},${r+P*f}`,this._append`A${a},${a},0,0,${+(f*p>c*m)},${this._x1=t+O*l},${this._y1=r+O*u}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(i),l=n*Math.sin(i),u=t+s,c=r+l,f=1^o,d=o?i-a:a-i;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Rr||Math.abs(this._y1-c)>Rr)&&this._append`L${u},${c}`,n&&(d<0&&(d=d%El+El),d>CP?this._append`A${n},${n},0,1,${f},${t-s},${r-l}A${n},${n},0,1,${f},${this._x1=u},${this._y1=c}`:d>Rr&&this._append`A${n},${n},0,${+(d>=Sl)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function Lu(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new IP(t)}function Uu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Hm(e){this._context=e}Hm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Bo(e){return new Hm(e)}function Gm(e){return e[0]}function qm(e){return e[1]}function Ym(e,t){var r=ae(!0),n=null,i=Bo,a=null,o=Lu(s);e=typeof e=="function"?e:e===void 0?Gm:ae(e),t=typeof t=="function"?t:t===void 0?qm:ae(t);function s(l){var u,c=(l=Uu(l)).length,f,d=!1,p;for(n==null&&(a=i(p=o())),u=0;u<=c;++u)!(u<c&&r(f=l[u],u,l))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(f,u,l),+t(f,u,l));if(p)return a=null,p+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:ae(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:ae(+l),s):t},s.defined=function(l){return arguments.length?(r=typeof l=="function"?l:ae(!!l),s):r},s.curve=function(l){return arguments.length?(i=l,n!=null&&(a=i(n)),s):i},s.context=function(l){return arguments.length?(l==null?n=a=null:a=i(n=l),s):n},s}function oa(e,t,r){var n=null,i=ae(!0),a=null,o=Bo,s=null,l=Lu(u);e=typeof e=="function"?e:e===void 0?Gm:ae(+e),t=typeof t=="function"?t:ae(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?qm:ae(+r);function u(f){var d,p,m,v=(f=Uu(f)).length,y,b=!1,x,w=new Array(v),P=new Array(v);for(a==null&&(s=o(x=l())),d=0;d<=v;++d){if(!(d<v&&i(y=f[d],d,f))===b)if(b=!b)p=d,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),m=d-1;m>=p;--m)s.point(w[m],P[m]);s.lineEnd(),s.areaEnd()}b&&(w[d]=+e(y,d,f),P[d]=+t(y,d,f),s.point(n?+n(y,d,f):w[d],r?+r(y,d,f):P[d]))}if(x)return s=null,x+""||null}function c(){return Ym().defined(i).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),n=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:ae(+f),u):e},u.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:ae(+f),u):n},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),r=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:ae(+f),u):t},u.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:ae(+f),u):r},u.lineX0=u.lineY0=function(){return c().x(e).y(t)},u.lineY1=function(){return c().x(e).y(r)},u.lineX1=function(){return c().x(n).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:ae(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,a!=null&&(s=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=s=null:s=o(a=f),u):a},u}class Vm{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function NP(e){return new Vm(e,!0)}function DP(e){return new Vm(e,!1)}const zu={draw(e,t){const r=St(t/za);e.moveTo(r,0),e.arc(0,0,r,0,zo)}},$P={draw(e,t){const r=St(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},Xm=St(1/3),RP=Xm*2,LP={draw(e,t){const r=St(t/RP),n=r*Xm;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},UP={draw(e,t){const r=St(t),n=-r/2;e.rect(n,n,r,r)}},zP=.8908130915292852,Zm=Ua(za/10)/Ua(7*za/10),BP=Ua(zo/10)*Zm,FP=-Wm(zo/10)*Zm,WP={draw(e,t){const r=St(t*zP),n=BP*r,i=FP*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=zo*a/5,s=Wm(o),l=Ua(o);e.lineTo(l*r,-s*r),e.lineTo(s*n-l*i,l*n+s*i)}e.closePath()}},Hs=St(3),KP={draw(e,t){const r=-St(t/(Hs*3));e.moveTo(0,r*2),e.lineTo(-Hs*r,-r),e.lineTo(Hs*r,-r),e.closePath()}},dt=-.5,ht=St(3)/2,_l=1/St(12),HP=(_l/2+1)*3,GP={draw(e,t){const r=St(t/HP),n=r/2,i=r*_l,a=n,o=r*_l+r,s=-a,l=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(dt*n-ht*i,ht*n+dt*i),e.lineTo(dt*a-ht*o,ht*a+dt*o),e.lineTo(dt*s-ht*l,ht*s+dt*l),e.lineTo(dt*n+ht*i,dt*i-ht*n),e.lineTo(dt*a+ht*o,dt*o-ht*a),e.lineTo(dt*s+ht*l,dt*l-ht*s),e.closePath()}};function qP(e,t){let r=null,n=Lu(i);e=typeof e=="function"?e:ae(e||zu),t=typeof t=="function"?t:ae(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:ae(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function Ba(){}function Fa(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function Jm(e){this._context=e}Jm.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Fa(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YP(e){return new Jm(e)}function Qm(e){this._context=e}Qm.prototype={areaStart:Ba,areaEnd:Ba,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function VP(e){return new Qm(e)}function eg(e){this._context=e}eg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Fa(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function XP(e){return new eg(e)}function tg(e){this._context=e}tg.prototype={areaStart:Ba,areaEnd:Ba,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function ZP(e){return new tg(e)}function dd(e){return e<0?-1:1}function hd(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),s=(a*i+o*n)/(n+i);return(dd(a)+dd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function pd(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Gs(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,i+s*t,a-s,o-s*r,a,o)}function Wa(e){this._context=e}Wa.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Gs(this,this._t0,pd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Gs(this,pd(this,r=hd(this,e,t)),r);break;default:Gs(this,this._t0,r=hd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function rg(e){this._context=new ng(e)}(rg.prototype=Object.create(Wa.prototype)).point=function(e,t){Wa.prototype.point.call(this,t,e)};function ng(e){this._context=e}ng.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function JP(e){return new Wa(e)}function QP(e){return new rg(e)}function ig(e){this._context=e}ig.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=vd(e),i=vd(t),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function vd(e){var t,r=e.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/a[t-1],a[t]-=n,o[t]-=n*o[t-1];for(i[r-1]=o[r-1]/a[r-1],t=r-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function ek(e){return new ig(e)}function Fo(e,t){this._context=e,this._t=t}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function tk(e){return new Fo(e,.5)}function rk(e){return new Fo(e,0)}function nk(e){return new Fo(e,1)}function Zr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,s=a.length;r<o;++r)for(i=a,a=e[t[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function Tl(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function ik(e,t){return e[t]}function ak(e){const t=[];return t.key=e,t}function ok(){var e=ae([]),t=Tl,r=Zr,n=ik;function i(a){var o=Array.from(e.apply(this,arguments),ak),s,l=o.length,u=-1,c;for(const f of a)for(s=0,++u;s<l;++s)(o[s][u]=[0,+n(f,o[s].key,u,a)]).data=f;for(s=0,c=Uu(t(o));s<l;++s)o[c[s]].index=s;return r(o,c),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:ae(Array.from(a)),i):e},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),i):n},i.order=function(a){return arguments.length?(t=a==null?Tl:typeof a=="function"?a:ae(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(r=a??Zr,i):r},i}function sk(e,t){if((n=e.length)>0){for(var r,n,i=0,a=e[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=e[r][i][1]||0;if(o)for(r=0;r<n;++r)e[r][i][1]/=o}Zr(e,t)}}function lk(e,t){if((i=e.length)>0){for(var r=0,n=e[t[0]],i,a=n.length;r<a;++r){for(var o=0,s=0;o<i;++o)s+=e[o][r][1]||0;n[r][1]+=n[r][0]=-s/2}Zr(e,t)}}function uk(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var s=0,l=0,u=0;s<o;++s){for(var c=e[t[s]],f=c[n][1]||0,d=c[n-1][1]||0,p=(f-d)/2,m=0;m<s;++m){var v=e[t[m]],y=v[n][1]||0,b=v[n-1][1]||0;p+=y-b}l+=f,u+=p*f}i[n-1][1]+=i[n-1][0]=r,l&&(r-=u/l)}i[n-1][1]+=i[n-1][0]=r,Zr(e,t)}}function Cl(e){return e==="__proto__"}function ag(e){switch(typeof e){case"number":case"symbol":return!1;case"string":return e.includes(".")||e.includes("[")||e.includes("]")}}function Bu(e){var t;return typeof e=="string"||typeof e=="symbol"?e:Object.is((t=e==null?void 0:e.valueOf)==null?void 0:t.call(e),-0)?"-0":String(e)}function og(e){if(e==null)return"";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(og).join(",");const t=String(e);return t==="0"&&Object.is(Number(e),-0)?"-0":t}function Fu(e){if(Array.isArray(e))return e.map(Bu);if(typeof e=="symbol")return[e];e=og(e);const t=[],r=e.length;if(r===0)return t;let n=0,i="",a="",o=!1;for(e.charCodeAt(0)===46&&t.push("");n<r;){const s=e[n];if(a)s==="\\"&&n+1<r?(n++,i+=e[n]):s===a?a="":i+=s;else if(o)s==='"'||s==="'"?a=s:s==="]"?(o=!1,t.push(i),i=""):i+=s;else if(s==="[")o=!0,i&&(t.push(i),i="");else if(s==="."){i&&(t.push(i),i="");const l=e[n+1];(l===void 0||l===".")&&t.push("")}else i+=s;n++}return i&&t.push(i),t}function zt(e,t,r){if(e==null)return r;switch(typeof t){case"string":{if(Cl(t))return r;const n=e[t];return n===void 0?ag(t)&&!Object.hasOwn(e,t)?zt(e,Fu(t),r):r:n}case"number":case"symbol":{typeof t=="number"&&(t=Bu(t));const n=e[t];return n===void 0?r:n}default:{if(Array.isArray(t))return ck(e,t,r);if(Object.is(t==null?void 0:t.valueOf(),-0)?t="-0":t=String(t),Cl(t))return r;const n=e[t];return n===void 0?r:n}}}function ck(e,t,r){if(t.length===0)return r;let n=e;for(let i=0;i<t.length;i++){if(n==null||Cl(t[i]))return r;n=n[t[i]]}return n===void 0?r:n}var fk=4;function gr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fk,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function me(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((i,a,o)=>{var s=r[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+gr(s)+a:i+a},"")}var Ne=e=>e===0?0:e>0?1:-1,jt=e=>typeof e=="number"&&e!=+e,Jr=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,$=e=>(typeof e=="number"||e instanceof Number)&&!jt(e),Bt=e=>$(e)||typeof e=="string",dk=0,di=e=>{var t=++dk;return"".concat(e||"").concat(t)},Ye=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!$(t)&&typeof t!="string")return n;var a;if(Jr(t)){if(r==null)return n;var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return jt(a)&&(a=n),i&&r!=null&&a>r&&(a=r),a},sg=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function Q(e,t,r){return $(e)&&$(t)?gr(e+r*(t-e)):t}function lg(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):zt(n,t))===r)}var ce=e=>e===null||typeof e>"u",Ci=e=>ce(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function nt(e){return e!=null}function ar(){}var hk=["type","size","sizeType"];function Ml(){return Ml=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ml.apply(null,arguments)}function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?md(Object(r),!0).forEach(function(n){pk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):md(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function pk(e,t,r){return(t=vk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vk(e){var t=mk(e,"string");return typeof t=="symbol"?t:t+""}function mk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gk(e,t){if(e==null)return{};var r,n,i=yk(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function yk(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var ug={symbolCircle:zu,symbolCross:$P,symbolDiamond:LP,symbolSquare:UP,symbolStar:WP,symbolTriangle:KP,symbolWye:GP},bk=Math.PI/180,xk=e=>{var t="symbol".concat(Ci(e));return ug[t]||zu},wk=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*bk;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Pk=(e,t)=>{ug["symbol".concat(Ci(e))]=t},cg=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,i=gk(e,hk),a=gd(gd({},i),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var d=xk(o),p=qP().type(d).size(wk(r,n,o)),m=p();if(m!==null)return m},{className:l,cx:u,cy:c}=a,f=Ve(a);return $(u)&&$(c)&&$(r)?h.createElement("path",Ml({},f,{className:Z("recharts-symbols",l),transform:"translate(".concat(u,", ").concat(c,")"),d:s()})):null};cg.registerSymbol=Pk;var fg=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,Wu=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(i=>{Ru(i)&&typeof r[i]=="function"&&(n[i]=(a=>r[i](r,a)))}),n},kk=(e,t,r)=>n=>(e(t,r,n),null),Wo=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(i=>{var a=e[i];Ru(i)&&typeof a=="function"&&(n||(n={}),n[i]=kk(a,t,r))}),n};function yd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ok(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yd(Object(r),!0).forEach(function(n){jk(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jk(e,t,r){return(t=Ak(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ak(e){var t=Sk(e,"string");return typeof t=="symbol"?t:t+""}function Sk(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function je(e,t){var r=Ok({},e),n=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&n[s]!==void 0&&(o[s]=n[s]),o),r);return a}function Ek(e,t){const r=new Map;for(let n=0;n<e.length;n++){const i=e[n],a=t(i,n,e);r.has(a)||r.set(a,i)}return Array.from(r.values())}function _k(e,t){return function(...r){return e.apply(this,r.slice(0,t))}}function dg(e){return e}function Tk(e){return function(t){return zt(t,e)}}function Il(e){return e==null||typeof e!="object"&&typeof e!="function"}function Ck(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Mk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Ku(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Ik="[object RegExp]",hg="[object String]",pg="[object Number]",vg="[object Boolean]",mg="[object Arguments]",Nk="[object Symbol]",Dk="[object Date]",$k="[object Map]",Rk="[object Set]",Lk="[object Array]",Uk="[object ArrayBuffer]",zk="[object Object]",Bk="[object DataView]",Fk="[object Uint8Array]",Wk="[object Uint8ClampedArray]",Kk="[object Uint16Array]",Hk="[object Uint32Array]",Gk="[object Int8Array]",qk="[object Int16Array]",Yk="[object Int32Array]",Vk="[object Float32Array]",Xk="[object Float64Array]",bd=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Zk(e){return typeof bd.Buffer<"u"&&bd.Buffer.isBuffer(e)}function Jk(e,t){return zr(e,void 0,e,new Map,t)}function zr(e,t,r,n=new Map,i=void 0){const a=i==null?void 0:i(e,t,r,n);if(a!==void 0)return a;if(Il(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const o=new Array(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;n.set(e,o);for(const[s,l]of e)o.set(s,zr(l,s,r,n,i));return o}if(e instanceof Set){const o=new Set;n.set(e,o);for(const s of e)o.add(zr(s,void 0,r,n,i));return o}if(Zk(e))return e.subarray();if(Ck(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,o);for(let s=0;s<e.length;s++)o[s]=zr(e[s],s,r,n,i);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,o),bt(o,e,r,n,i),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Error){const o=structuredClone(e);return n.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,o.constructor=e.constructor,bt(o,e,r,n,i),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof Number){const o=new Number(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(e instanceof String){const o=new String(e.valueOf());return n.set(e,o),bt(o,e,r,n,i),o}if(typeof e=="object"&&Qk(e)){const o=Object.create(Object.getPrototypeOf(e));return n.set(e,o),bt(o,e,r,n,i),o}return e}function bt(e,t,r=e,n,i){const a=[...Object.keys(t),...Mk(t)];for(let o=0;o<a.length;o++){const s=a[o],l=Object.getOwnPropertyDescriptor(e,s);(l==null||l.writable)&&(e[s]=zr(t[s],s,r,n,i))}}function Qk(e){switch(Ku(e)){case mg:case Lk:case Uk:case Bk:case vg:case Dk:case Vk:case Xk:case Gk:case qk:case Yk:case $k:case pg:case zk:case Ik:case Rk:case hg:case Nk:case Fk:case Wk:case Kk:case Hk:return!0;default:return!1}}function eO(e){return zr(e,void 0,e,new Map,void 0)}function ja(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function gg(e){return e!==null&&(typeof e=="object"||typeof e=="function")}function yg(e,t,r){return typeof r!="function"?yg(e,t,()=>{}):Nl(e,t,function n(i,a,o,s,l,u){const c=r(i,a,o,s,l,u);return c!==void 0?!!c:Nl(i,a,n,u,!1)},new Map,!0)}function Nl(e,t,r,n,i=!1){if(t===e)return!0;switch(typeof t){case"object":return tO(e,t,r,n);case"function":return Object.keys(t).length>0?Nl(e,{...t},r,n,i):ja(e,t);default:return gg(e)&&i?typeof t=="string"?t==="":!0:ja(e,t)}}function tO(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return bg(e,t,r,n);if(t instanceof Map)return rO(e,t,r,n);if(t instanceof Set)return nO(e,t,r,n);const i=Object.keys(t);if(e==null||Il(e))return i.length===0;if(i.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let a=0;a<i.length;a++){const o=i[a];if(!Il(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!r(e[o],t[o],o,e,t,n))return!1}return!0}finally{n==null||n.delete(t)}}function rO(e,t,r,n){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(const[i,a]of t.entries())if(r(e.get(i),a,i,e,t,n)===!1)return!1;return!0}function bg(e,t,r,n){if(t.length===0)return!0;if(!Array.isArray(e))return!1;const i=new Set;for(let a=0;a<t.length;a++){const o=t[a];let s=!1;for(let l=0;l<e.length;l++){if(i.has(l))continue;const u=e[l];let c=!1;if(r(u,o,a,e,t,n)&&(c=!0),c){i.add(l),s=!0;break}}if(!s)return!1}return!0}function nO(e,t,r,n){return t.size===0?!0:e instanceof Set?bg([...e],[...t],r,n):!1}function xg(e,t){return yg(e,t,()=>{})}function iO(e){return e=eO(e),t=>xg(t,e)}function aO(e,t){return Jk(e,(r,n,i,a)=>{if(typeof e=="object"){if(Ku(e)==="[object Object]"&&typeof e.constructor!="function"){const o={};return a.set(e,o),bt(o,e,i,a),o}switch(Object.prototype.toString.call(e)){case pg:case hg:case vg:{const o=new e.constructor(e==null?void 0:e.valueOf());return bt(o,e),o}case mg:{const o={};return bt(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function oO(e){return aO(e)}const sO=/^(?:0|[1-9]\d*)$/;function wg(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e<t;case"symbol":return!1;case"string":return sO.test(e)}}function lO(e){return e!==null&&typeof e=="object"&&Ku(e)==="[object Arguments]"}function uO(e,t){let r;if(Array.isArray(t)?r=t:typeof t=="string"&&ag(t)&&(e==null?void 0:e[t])==null?r=Fu(t):r=[t],r.length===0)return!1;let n=e;for(let i=0;i<r.length;i++){const a=r[i];if((n==null||!Object.hasOwn(n,a))&&!((Array.isArray(n)||lO(n))&&wg(a)&&a<n.length))return!1;n=n[a]}return!0}function cO(e,t){switch(typeof e){case"object":Object.is(e==null?void 0:e.valueOf(),-0)&&(e="-0");break;case"number":e=Bu(e);break}return t=oO(t),function(r){const n=zt(r,e);return n===void 0?uO(r,e):t===void 0?n===void 0:xg(n,t)}}function fO(e){if(e==null)return dg;switch(typeof e){case"function":return e;case"object":return Array.isArray(e)&&e.length===2?cO(e[0],e[1]):iO(e);case"string":case"symbol":case"number":return Tk(e)}}function dO(e){return Number.isSafeInteger(e)&&e>=0}function Pg(e){return e!=null&&typeof e!="function"&&dO(e.length)}function hO(e){return typeof e=="object"&&e!==null}function pO(e){return hO(e)&&Pg(e)}function xd(e,t=dg){return pO(e)?Ek(Array.from(e),_k(fO(t),1)):[]}function vO(e,t,r){return t===!0?xd(e,r):typeof t=="function"?xd(e,t):e}var Hu=h.createContext(null),mO=e=>e,se=()=>{var e=h.useContext(Hu);return e?e.store.dispatch:mO},Aa=()=>{},gO=()=>Aa,yO=(e,t)=>e===t;function U(e){var t=h.useContext(Hu),r=h.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Aa,[t,e]);return Tw.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:gO,t?t.store.getState:Aa,t?t.store.getState:Aa,r,yO)}function bO(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function xO(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function wO(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var wd=e=>Array.isArray(e)?e:[e];function PO(e){const t=Array.isArray(e[0])?e[0]:e;return wO(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function kO(e,t){const r=[],{length:n}=e;for(let i=0;i<n;i++)r.push(e[i].apply(null,t));return r}var OO=class{constructor(e){this.value=e}deref(){return this.value}},jO=typeof WeakRef<"u"?WeakRef:OO,AO=0,Pd=1;function sa(){return{s:AO,v:void 0,o:null,p:null}}function kg(e,t={}){let r=sa();const{resultEqualityCheck:n}=t;let i,a=0;function o(){var f;let s=r;const{length:l}=arguments;for(let d=0,p=l;d<p;d++){const m=arguments[d];if(typeof m=="function"||typeof m=="object"&&m!==null){let v=s.o;v===null&&(s.o=v=new WeakMap);const y=v.get(m);y===void 0?(s=sa(),v.set(m,s)):s=y}else{let v=s.p;v===null&&(s.p=v=new Map);const y=v.get(m);y===void 0?(s=sa(),v.set(m,s)):s=y}}const u=s;let c;if(s.s===Pd)c=s.v;else if(c=e.apply(null,arguments),a++,n){const d=((f=i==null?void 0:i.deref)==null?void 0:f.call(i))??i;d!=null&&n(d,c)&&(c=d,a!==0&&a--),i=typeof c=="object"&&c!==null||typeof c=="function"?new jO(c):c}return u.s=Pd,u.v=c,c}return o.clearCache=()=>{r=sa(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function SO(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...i)=>{let a=0,o=0,s,l={},u=i.pop();typeof u=="object"&&(l=u,u=i.pop()),bO(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const c={...r,...l},{memoize:f,memoizeOptions:d=[],argsMemoize:p=kg,argsMemoizeOptions:m=[]}=c,v=wd(d),y=wd(m),b=PO(i),x=f(function(){return a++,u.apply(null,arguments)},...v),w=p(function(){o++;const O=kO(b,arguments);return s=x.apply(null,O),s},...y);return Object.assign(w,{resultFunc:u,memoizedResultFunc:x,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var A=SO(kg),EO=Object.assign((e,t=A)=>{xO(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(a=>e[a]);return t(n,(...a)=>a.reduce((o,s,l)=>(o[r[l]]=s,o),{}))},{withTypes:()=>EO});function _O(e,t=1){const r=[],n=Math.floor(t),i=(a,o)=>{for(let s=0;s<a.length;s++){const l=a[s];Array.isArray(l)&&o<n?i(l,o+1):r.push(l)}};return i(e,0),r}function Dl(e,t,r){return gg(r)&&(typeof t=="number"&&Pg(r)&&wg(t)&&t<r.length||typeof t=="string"&&t in r)?ja(r[t],e):!1}function kd(e){return typeof e=="symbol"?1:e===null?2:e===void 0?3:e!==e?4:0}const TO=(e,t,r)=>{if(e!==t){const n=kd(e),i=kd(t);if(n===i&&n===0){if(e<t)return r==="desc"?1:-1;if(e>t)return r==="desc"?-1:1}return r==="desc"?i-n:n-i}return 0};function Og(e){return typeof e=="symbol"||e instanceof Symbol}const CO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MO=/^\w*$/;function IO(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||Og(e)?!0:typeof e=="string"&&(MO.test(e)||!CO.test(e))||t!=null}function NO(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(s=>String(s));const i=(s,l)=>{let u=s;for(let c=0;c<l.length&&u!=null;++c)u=u[l[c]];return u},a=(s,l)=>l==null||s==null?l:typeof s=="object"&&"key"in s?Object.hasOwn(l,s.key)?l[s.key]:i(l,s.path):typeof s=="function"?s(l):Array.isArray(s)?i(l,s):typeof l=="object"?l[s]:l,o=t.map(s=>(Array.isArray(s)&&s.length===1&&(s=s[0]),s==null||typeof s=="function"||Array.isArray(s)||IO(s)?s:{key:s,path:Fu(s)}));return e.map(s=>({original:s,criteria:o.map(l=>a(l,s))})).slice().sort((s,l)=>{for(let u=0;u<o.length;u++){const c=TO(s.criteria[u],l.criteria[u],r[u]);if(c!==0)return c}return 0}).map(s=>s.original)}function Ko(e,...t){const r=t.length;return r>1&&Dl(e,t[0],t[1])?t=[]:r>2&&Dl(t[0],t[1],t[2])&&(t=[t[0]]),NO(e,_O(t),["asc"])}var jg=e=>e.legend.settings,DO=e=>e.legend.size,$O=e=>e.legend.payload;A([$O,jg],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Ko(n,r):n});var la=1;function RO(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>la||Math.abs(o.left-t.left)>la||Math.abs(o.top-t.top)>la||Math.abs(o.width-t.width)>la)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function ze(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var LO=typeof Symbol=="function"&&Symbol.observable||"@@observable",Od=LO,qs=()=>Math.random().toString(36).substring(7).split("").join("."),UO={INIT:`@@redux/INIT${qs()}`,REPLACE:`@@redux/REPLACE${qs()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qs()}`},Ka=UO;function Gu(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ag(e,t,r){if(typeof e!="function")throw new Error(ze(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(ze(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(ze(1));return r(Ag)(e,t)}let n=e,i=t,a=new Map,o=a,s=0,l=!1;function u(){o===a&&(o=new Map,a.forEach((y,b)=>{o.set(b,y)}))}function c(){if(l)throw new Error(ze(3));return i}function f(y){if(typeof y!="function")throw new Error(ze(4));if(l)throw new Error(ze(5));let b=!0;u();const x=s++;return o.set(x,y),function(){if(b){if(l)throw new Error(ze(6));b=!1,u(),o.delete(x),a=null}}}function d(y){if(!Gu(y))throw new Error(ze(7));if(typeof y.type>"u")throw new Error(ze(8));if(typeof y.type!="string")throw new Error(ze(17));if(l)throw new Error(ze(9));try{l=!0,i=n(i,y)}finally{l=!1}return(a=o).forEach(x=>{x()}),y}function p(y){if(typeof y!="function")throw new Error(ze(10));n=y,d({type:Ka.REPLACE})}function m(){const y=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ze(11));function x(){const P=b;P.next&&P.next(c())}return x(),{unsubscribe:y(x)}},[Od](){return this}}}return d({type:Ka.INIT}),{dispatch:d,subscribe:f,getState:c,replaceReducer:p,[Od]:m}}function zO(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Ka.INIT})>"u")throw new Error(ze(12));if(typeof r(void 0,{type:Ka.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ze(13))})}function Sg(e){const t=Object.keys(e),r={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let i;try{zO(r)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const u={};for(let c=0;c<n.length;c++){const f=n[c],d=r[f],p=o[f],m=d(p,s);if(typeof m>"u")throw s&&s.type,new Error(ze(14));u[f]=m,l=l||m!==p}return l=l||n.length!==Object.keys(o).length,l?u:o}}function Ha(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function BO(...e){return t=>(r,n)=>{const i=t(r,n);let a=()=>{throw new Error(ze(15))};const o={getState:i.getState,dispatch:(l,...u)=>a(l,...u)},s=e.map(l=>l(o));return a=Ha(...s)(i.dispatch),{...i,dispatch:a}}}function Eg(e){return Gu(e)&&"type"in e&&typeof e.type=="string"}var _g=Symbol.for("immer-nothing"),jd=Symbol.for("immer-draftable"),tt=Symbol.for("immer-state");function Pt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var lt=Object,_n=lt.getPrototypeOf,Ga="constructor",Ho="prototype",$l="configurable",qa="enumerable",Sa="writable",hi="value",er=e=>!!e&&!!e[tt];function At(e){var t;return e?Tg(e)||qo(e)||!!e[jd]||!!((t=e[Ga])!=null&&t[jd])||Yo(e)||Vo(e):!1}var FO=lt[Ho][Ga].toString(),Ad=new WeakMap;function Tg(e){if(!e||!qu(e))return!1;const t=_n(e);if(t===null||t===lt[Ho])return!0;const r=lt.hasOwnProperty.call(t,Ga)&&t[Ga];if(r===Object)return!0;if(!gn(r))return!1;let n=Ad.get(r);return n===void 0&&(n=Function.toString.call(r),Ad.set(r,n)),n===FO}function Go(e,t,r=!0){Mi(e)===0?(r?Reflect.ownKeys(e):lt.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function Mi(e){const t=e[tt];return t?t.type_:qo(e)?1:Yo(e)?2:Vo(e)?3:0}var Ys=(e,t,r=Mi(e))=>r===2?e.has(t):lt[Ho].hasOwnProperty.call(e,t),Rl=(e,t,r=Mi(e))=>r===2?e.get(t):e[t],Ya=(e,t,r,n=Mi(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function WO(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var qo=Array.isArray,Yo=e=>e instanceof Map,Vo=e=>e instanceof Set,qu=e=>typeof e=="object",gn=e=>typeof e=="function",Vs=e=>typeof e=="boolean";function KO(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var It=e=>e.copy_||e.base_,Yu=e=>e.modified_?e.copy_:e.base_;function Ll(e,t){if(Yo(e))return new Map(e);if(Vo(e))return new Set(e);if(qo(e))return Array[Ho].slice.call(e);const r=Tg(e);if(t===!0||t==="class_only"&&!r){const n=lt.getOwnPropertyDescriptors(e);delete n[tt];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s[Sa]===!1&&(s[Sa]=!0,s[$l]=!0),(s.get||s.set)&&(n[o]={[$l]:!0,[Sa]:!0,[qa]:s[qa],[hi]:e[o]})}return lt.create(_n(e),n)}else{const n=_n(e);if(n!==null&&r)return{...e};const i=lt.create(n);return lt.assign(i,e)}}function Vu(e,t=!1){return Xo(e)||er(e)||!At(e)||(Mi(e)>1&&lt.defineProperties(e,{set:ua,add:ua,clear:ua,delete:ua}),lt.freeze(e),t&&Go(e,(r,n)=>{Vu(n,!0)},!1)),e}function HO(){Pt(2)}var ua={[hi]:HO};function Xo(e){return e===null||!qu(e)?!0:lt.isFrozen(e)}var Va="MapSet",Ul="Patches",Sd="ArrayMethods",Cg={};function Qr(e){const t=Cg[e];return t||Pt(0,e),t}var Ed=e=>!!Cg[e],pi,Mg=()=>pi,GO=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ed(Va)?Qr(Va):void 0,arrayMethodsPlugin_:Ed(Sd)?Qr(Sd):void 0});function _d(e,t){t&&(e.patchPlugin_=Qr(Ul),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zl(e){Bl(e),e.drafts_.forEach(qO),e.drafts_=null}function Bl(e){e===pi&&(pi=e.parent_)}var Td=e=>pi=GO(pi,e);function qO(e){const t=e[tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Cd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[tt].modified_&&(zl(t),Pt(4)),At(e)&&(e=Md(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(r[tt].base_,e,t)}else e=Md(t,r);return YO(t,e,!0),zl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==_g?e:void 0}function Md(e,t){if(Xo(t))return t;const r=t[tt];if(!r)return Xa(t,e.handledSet_,e);if(!Zo(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);Dg(r,e)}return r.copy_}function YO(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vu(t,r)}function Ig(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Zo=(e,t)=>e.scope_===t,VO=[];function Ng(e,t,r,n){const i=It(e),a=e.type_;if(n!==void 0&&Rl(i,n,a)===t){Ya(i,n,r,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;Go(i,(l,u)=>{if(er(u)){const c=s.get(u)||[];c.push(l),s.set(u,c)}})}const o=e.draftLocations_.get(t)??VO;for(const s of o)Ya(i,s,r,a)}function XO(e,t,r){e.callbacks_.push(function(i){var s;const a=t;if(!a||!Zo(a,i))return;(s=i.mapSetPlugin_)==null||s.fixSetContents(a);const o=Yu(a);Ng(e,a.draft_??a,o,r),Dg(a,i)})}function Dg(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:i}=t;if(i){const a=i.getPath(e);a&&i.generatePatches_(e,a,t)}Ig(e)}}function ZO(e,t,r){const{scope_:n}=e;if(er(r)){const i=r[tt];Zo(i,n)&&i.callbacks_.push(function(){Ea(e);const o=Yu(i);Ng(e,r,o,t)})}else At(r)&&e.callbacks_.push(function(){const a=It(e);e.type_===3?a.has(r)&&Xa(r,n.handledSet_,n):Rl(a,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Xa(Rl(e.copy_,t,e.type_),n.handledSet_,n)})}function Xa(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||er(e)||t.has(e)||!At(e)||Xo(e)||(t.add(e),Go(e,(n,i)=>{if(er(i)){const a=i[tt];if(Zo(a,r)){const o=Yu(a);Ya(e,n,o,e.type_),Ig(a)}}else At(i)&&Xa(i,t,r)})),e}function JO(e,t){const r=qo(e),n={type_:r?1:0,scope_:t?t.scope_:Mg(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=Za;r&&(i=[n],a=vi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,[s,n]}var Za={get(e,t){if(t===tt)return e;if(t==="constructor"||t==="__proto__"){const s=It(e)[t];return new Proxy(s||{},{get:(l,u)=>u==="__proto__"||u==="prototype"?Object.freeze(Object.create(null)):Reflect.get(l,u),set:()=>!0,apply:(l,u,c)=>Reflect.apply(l,u,c)})}let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=It(e);if(!Ys(i,t,e.type_))return QO(e,i,t);const a=i[t];if(e.finalized_||!At(a)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&KO(t))return a;if(a===Xs(e.base_,t)){Ea(e);const o=e.type_===1?+t:t,s=Wl(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t==="constructor"||t==="__proto__"||t==="prototype"?!1:t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,r){if(t==="constructor"||t==="__proto__"||t==="prototype")return!0;const n=$g(It(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Xs(It(e),t),a=i==null?void 0:i[tt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(WO(r,i)&&(r!==void 0||Ys(e.base_,t,e.type_)))return!0;Ea(e),Fl(e)}return e.copy_[t]===r&&(r!==void 0||Ys(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),ZO(e,t,r)),!0},deleteProperty(e,t){return Ea(e),Xs(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Fl(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=It(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[Sa]:!0,[$l]:e.type_!==1||t!=="length",[qa]:n[qa],[hi]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return _n(e.base_)},setPrototypeOf(){Pt(12)}},vi={};for(let e in Za){let t=Za[e];vi[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}vi.deleteProperty=function(e,t){return vi.set.call(this,e,t,void 0)};vi.set=function(e,t,r){return Za.set.call(this,e[0],t,r,e[0])};function Xs(e,t){const r=e[tt];return(r?It(r):e)[t]}function QO(e,t,r){var i;const n=$g(t,r);return n?hi in n?n[hi]:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function $g(e,t){if(!(t in e))return;let r=_n(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=_n(r)}}function Fl(e){e.modified_||(e.modified_=!0,e.parent_&&Fl(e.parent_))}function Ea(e){e.copy_||(e.assigned_=new Map,e.copy_=Ll(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ej=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,i)=>{if(gn(r)&&!gn(n)){const o=n;n=r;const s=this;return function(u=o,...c){return s.produce(u,f=>n.call(this,f,...c))}}gn(n)||Pt(6),i!==void 0&&!gn(i)&&Pt(7);let a;if(At(r)){const o=Td(this),s=Wl(o,r,void 0);let l=!0;try{a=n(s),l=!1}finally{l?zl(o):Bl(o)}return _d(o,i),Cd(a,o)}else if(!r||!qu(r)){if(a=n(r),a===void 0&&(a=r),a===_g&&(a=void 0),this.autoFreeze_&&Vu(a,!0),i){const o=[],s=[];Qr(Ul).generateReplacementPatches_(r,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else Pt(1,r)},this.produceWithPatches=(r,n)=>{if(gn(r))return(s,...l)=>this.produceWithPatches(s,u=>r(u,...l));let i,a;return[this.produce(r,n,(s,l)=>{i=s,a=l}),i,a]},Vs(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Vs(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Vs(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){At(t)||Pt(8),er(t)&&(t=vt(t));const r=Td(this),n=Wl(r,t,void 0);return n[tt].isManual_=!0,Bl(r),n}finishDraft(t,r){const n=t&&t[tt];(!n||!n.isManual_)&&Pt(9);const{scope_:i}=n;return _d(i,r),Cd(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const i=Qr(Ul).applyPatches_;return er(t)?i(t,r):this.produce(t,a=>i(a,r))}};function Wl(e,t,r,n){const[i,a]=Yo(t)?Qr(Va).proxyMap_(t,r):Vo(t)?Qr(Va).proxySet_(t,r):JO(t,r);return((r==null?void 0:r.scope_)??Mg()).drafts_.push(i),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=n,r&&n!==void 0?XO(r,a,n):a.callbacks_.push(function(l){var c;(c=l.mapSetPlugin_)==null||c.fixSetContents(a);const{patchPlugin_:u}=l;a.modified_&&u&&u.generatePatches_(a,[],l)}),i}function vt(e){return er(e)||Pt(10,e),Rg(e)}function Rg(e){if(!At(e)||Xo(e))return e;const t=e[tt];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ll(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ll(e,!0);return Go(r,(i,a)=>{Ya(r,i,Rg(a))},n),t&&(t.finalized_=!1),r}var tj=new ej,Lg=tj.produce;function Ug(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var rj=Ug(),nj=Ug,ij=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ha:Ha.apply(null,arguments)};function ct(e,t){function r(...n){if(t){let i=t(...n);if(!i)throw new Error(ut(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>Eg(n)&&n.type===e,r}var zg=class si extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,si.prototype)}static get[Symbol.species](){return si}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new si(...t[0].concat(this)):new si(...t.concat(this))}};function Id(e){return At(e)?Lg(e,()=>{}):e}function ca(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function aj(e){return typeof e=="boolean"}var oj=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new zg;return r&&(aj(r)?o.push(rj):o.push(nj(r.extraArgument))),o},Bg="RTK_autoBatch",le=()=>e=>({payload:e,meta:{[Bg]:!0}}),Nd=e=>t=>{setTimeout(t,e)},sj=(e,t)=>r=>{let n=!1;const i=()=>{n||(n=!0,cancelAnimationFrame(a),clearTimeout(o),r())},a=e(i),o=setTimeout(i,t)},Fg=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?sj(window.requestAnimationFrame,100):Nd(10):e.type==="callback"?e.queueNotification:Nd(e.timeout),u=()=>{o=!1,a&&(a=!1,s.forEach(c=>c()))};return Object.assign({},n,{subscribe(c){const f=()=>i&&c(),d=n.subscribe(f);return s.add(c),()=>{d(),s.delete(c)}},dispatch(c){var f;try{return i=!((f=c==null?void 0:c.meta)!=null&&f[Bg]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},lj=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new zg(e);return n&&i.push(Fg(typeof n=="object"?n:void 0)),i};function uj(e){const t=oj(),{reducer:r=void 0,middleware:n,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof r=="function")s=r;else if(Gu(r))s=Sg(r);else throw new Error(ut(1));let l;typeof n=="function"?l=n(t):l=t();let u=Ha;i&&(u=ij({trace:!1,...typeof i=="object"&&i}));const c=BO(...l),f=lj(c);let d=typeof o=="function"?o(f):f();const p=u(...d);return Ag(s,a,p)}function Wg(e){const t={},r=[];let n;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(ut(28));if(s in t)throw new Error(ut(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return r.push({matcher:a,reducer:o}),i},addDefaultCase(a){return n=a,i}};return e(i),[t,r,n]}function cj(e){return typeof e=="function"}function fj(e,t){let[r,n,i]=Wg(t),a;if(cj(e))a=()=>Id(e());else{const s=Id(e);a=()=>s}function o(s=a(),l){let u=[r[l.type],...n.filter(({matcher:c})=>c(l)).map(({reducer:c})=>c)];return u.filter(c=>!!c).length===0&&(u=[i]),u.reduce((c,f)=>{if(f)if(er(c)){const p=f(c,l);return p===void 0?c:p}else{if(At(c))return Lg(c,d=>f(d,l));{const d=f(c,l);if(d===void 0){if(c===null)return c;throw Error("A case reducer on a non-draftable value must not return undefined")}return d}}return c},s)}return o.getInitialState=a,o}var dj="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",hj=(e=21)=>{let t="",r=e;for(;r--;)t+=dj[Math.random()*64|0];return t},pj=Symbol.for("rtk-slice-createasyncthunk");function vj(e,t){return`${e}/${t}`}function mj({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[pj];return function(i){const{name:a,reducerPath:o=a}=i;if(!a)throw new Error(ut(11));const s=(typeof i.reducers=="function"?i.reducers(yj()):i.reducers)||{},l=Object.keys(s),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(P,O){const k=typeof P=="string"?P:P.type;if(!k)throw new Error(ut(12));if(k in u.sliceCaseReducersByType)throw new Error(ut(13));return u.sliceCaseReducersByType[k]=O,c},addMatcher(P,O){return u.sliceMatchers.push({matcher:P,reducer:O}),c},exposeAction(P,O){return u.actionCreators[P]=O,c},exposeCaseReducer(P,O){return u.sliceCaseReducersByName[P]=O,c}};l.forEach(P=>{const O=s[P],k={reducerName:P,type:vj(a,P),createNotation:typeof i.reducers=="function"};xj(O)?Pj(k,O,c,t):bj(k,O,c)});function f(){const[P={},O=[],k=void 0]=typeof i.extraReducers=="function"?Wg(i.extraReducers):[i.extraReducers],j={...P,...u.sliceCaseReducersByType};return fj(i.initialState,E=>{for(let _ in j)E.addCase(_,j[_]);for(let _ of u.sliceMatchers)E.addMatcher(_.matcher,_.reducer);for(let _ of O)E.addMatcher(_.matcher,_.reducer);k&&E.addDefaultCase(k)})}const d=P=>P,p=new Map,m=new WeakMap;let v;function y(P,O){return v||(v=f()),v(P,O)}function b(){return v||(v=f()),v.getInitialState()}function x(P,O=!1){function k(E){let _=E[P];return typeof _>"u"&&O&&(_=ca(m,k,b)),_}function j(E=d){const _=ca(p,O,()=>new WeakMap);return ca(_,E,()=>{const M={};for(const[T,S]of Object.entries(i.selectors??{}))M[T]=gj(S,E,()=>ca(m,E,b),O);return M})}return{reducerPath:P,getSelectors:j,get selectors(){return j(k)},selectSlice:k}}const w={name:a,reducer:y,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:b,...x(o),injectInto(P,{reducerPath:O,...k}={}){const j=O??o;return P.inject({reducerPath:j,reducer:y},k),{...w,...x(j,!0)}}};return w}}function gj(e,t,r,n){function i(a,...o){let s=t(a);return typeof s>"u"&&n&&(s=r()),e(s,...o)}return i.unwrapped=e,i}var Xe=mj();function yj(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function bj({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!wj(n))throw new Error(ut(17));a=n.reducer,o=n.prepare}else a=n;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?ct(e,o):ct(e))}function xj(e){return e._reducerDefinitionType==="asyncThunk"}function wj(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Pj({type:e,reducerName:t},r,n,i){if(!i)throw new Error(ut(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:u,options:c}=r,f=i(e,a,c);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),s&&n.addCase(f.pending,s),l&&n.addCase(f.rejected,l),u&&n.addMatcher(f.settled,u),n.exposeCaseReducer(t,{fulfilled:o||fa,pending:s||fa,rejected:l||fa,settled:u||fa})}function fa(){}var kj="task",Kg="listener",Hg="completed",Xu="cancelled",Oj=`task-${Xu}`,jj=`task-${Hg}`,Kl=`${Kg}-${Xu}`,Aj=`${Kg}-${Hg}`,Jo=class{constructor(e){ea(this,"code");ea(this,"name","TaskAbortError");ea(this,"message");this.code=e,this.message=`${kj} ${Xu} (reason: ${e})`}},Zu=(e,t)=>{if(typeof e!="function")throw new TypeError(ut(32))},Ja=()=>{},Gg=(e,t=Ja)=>(e.catch(t),e),qg=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),Gr=e=>{if(e.aborted)throw new Jo(e.reason)};function Yg(e,t){let r=Ja;return new Promise((n,i)=>{const a=()=>i(new Jo(e.reason));if(e.aborted){a();return}r=qg(e,a),t.finally(()=>r()).then(n,i)}).finally(()=>{r=Ja})}var Sj=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Jo?"cancelled":"rejected",error:r}}finally{t==null||t()}},Qa=e=>t=>Gg(Yg(e,t).then(r=>(Gr(e),r))),Vg=e=>{const t=Qa(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:On}=Object,Dd={},Qo="listenerMiddleware",Ej=(e,t)=>{const r=n=>qg(e,()=>n.abort(e.reason));return(n,i)=>{Zu(n);const a=new AbortController;r(a);const o=Sj(async()=>{Gr(e),Gr(a.signal);const s=await n({pause:Qa(a.signal),delay:Vg(a.signal),signal:a.signal});return Gr(a.signal),s},()=>a.abort(jj));return i!=null&&i.autoJoin&&t.push(o.catch(Ja)),{result:Qa(e)(o),cancel(){a.abort(Oj)}}}},_j=(e,t)=>{const r=async(n,i)=>{Gr(t);let a=()=>{};const s=[new Promise((l,u)=>{let c=e({predicate:n,effect:(f,d)=>{d.unsubscribe(),l([f,d.getState(),d.getOriginalState()])}});a=()=>{c(),u()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await Yg(t,Promise.race(s));return Gr(t),l}finally{a()}};return((n,i)=>Gg(r(n,i)))},Xg=e=>{let{type:t,actionCreator:r,matcher:n,predicate:i,effect:a}=e;if(t)i=ct(t).match;else if(r)t=r.type,i=r.match;else if(n)i=n;else if(!i)throw new Error(ut(21));return Zu(a),{predicate:i,type:t,effect:a}},Zg=On(e=>{const{type:t,predicate:r,effect:n}=Xg(e);return{id:hj(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(ut(22))}}},{withTypes:()=>Zg}),$d=(e,t)=>{const{type:r,effect:n,predicate:i}=Xg(t);return Array.from(e.values()).find(a=>(typeof r=="string"?a.type===r:a.predicate===i)&&a.effect===n)},Hl=e=>{e.pending.forEach(t=>{t.abort(Kl)})},Tj=(e,t)=>()=>{for(const r of t.keys())Hl(r);e.clear()},Rd=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},Jg=On(ct(`${Qo}/add`),{withTypes:()=>Jg}),Cj=ct(`${Qo}/removeAll`),Qg=On(ct(`${Qo}/remove`),{withTypes:()=>Qg}),Mj=(...e)=>{console.error(`${Qo}/error`,...e)},Ii=(e={})=>{const t=new Map,r=new Map,n=p=>{const m=r.get(p)??0;r.set(p,m+1)},i=p=>{const m=r.get(p)??1;m===1?r.delete(p):r.set(p,m-1)},{extra:a,onError:o=Mj}=e;Zu(o);const s=p=>(p.unsubscribe=()=>t.delete(p.id),t.set(p.id,p),m=>{p.unsubscribe(),m!=null&&m.cancelActive&&Hl(p)}),l=(p=>{const m=$d(t,p)??Zg(p);return s(m)});On(l,{withTypes:()=>l});const u=p=>{const m=$d(t,p);return m&&(m.unsubscribe(),p.cancelActive&&Hl(m)),!!m};On(u,{withTypes:()=>u});const c=async(p,m,v,y)=>{const b=new AbortController,x=_j(l,b.signal),w=[];try{p.pending.add(b),n(p),await Promise.resolve(p.effect(m,On({},v,{getOriginalState:y,condition:(P,O)=>x(P,O).then(Boolean),take:x,delay:Vg(b.signal),pause:Qa(b.signal),extra:a,signal:b.signal,fork:Ej(b.signal,w),unsubscribe:p.unsubscribe,subscribe:()=>{t.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((P,O,k)=>{P!==b&&(P.abort(Kl),k.delete(P))})},cancel:()=>{b.abort(Kl),p.pending.delete(b)},throwIfCancelled:()=>{Gr(b.signal)}})))}catch(P){P instanceof Jo||Rd(o,P,{raisedBy:"effect"})}finally{await Promise.all(w),b.abort(Aj),i(p),p.pending.delete(b)}},f=Tj(t,r);return{middleware:p=>m=>v=>{if(!Eg(v))return m(v);if(Jg.match(v))return l(v.payload);if(Cj.match(v)){f();return}if(Qg.match(v))return u(v.payload);let y=p.getState();const b=()=>{if(y===Dd)throw new Error(ut(23));return y};let x;try{if(x=m(v),t.size>0){const w=p.getState(),P=Array.from(t.values());for(const O of P){let k=!1;try{k=O.predicate(v,w,y)}catch(j){k=!1,Rd(o,j,{raisedBy:"predicate"})}k&&c(O,v,p,b)}}}finally{y=Dd}return x},startListening:l,stopListening:u,clearListeners:f}};function ut(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ij={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},ey=Xe({name:"chartLayout",initialState:Ij,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,i,a;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:Nj,setLayout:Dj,setChartSize:$j,setScale:Rj}=ey.actions,Lj=ey.reducer;function ty(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function G(e){return Number.isFinite(e)}function Ft(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function Ld(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ld(Object(r),!0).forEach(function(n){Uj(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ld(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Uj(e,t,r){return(t=zj(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zj(e){var t=Bj(e,"string");return typeof t=="symbol"?t:t+""}function Bj(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ee(e,t,r){return ce(e)||ce(t)?r:Bt(t)?zt(e,t,r):typeof t=="function"?t(e):r}var Fj=(e,t,r)=>{if(t&&r){var{width:n,height:i}=r,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&$(e[a]))return bn(bn({},e),{},{[a]:e[a]+(n||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&$(e[o]))return bn(bn({},e),{},{[o]:e[o]+(i||0)})}return e},Et=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",ry=(e,t,r,n)=>{if(n)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===r&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(r),o},ny=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:u,tickCount:c,ticks:f,niceTicks:d,axisType:p}=e;if(!o)return null;var m=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,v=i==="category"&&o.bandwidth?o.bandwidth()/m:0;if(v=p==="angleAxis"&&a&&a.length>=2?Ne(a[0]-a[1])*2*v:v,f||d){var y=(f||d||[]).map((b,x)=>{var w=n?n.indexOf(b):b,P=o.map(w);return G(P)?{coordinate:P+v,value:b,offset:v,index:x}:null}).filter(nt);return y}return l&&u?u.map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:b,index:x,offset:v}:null}).filter(nt):o.ticks&&c!=null?o.ticks(c).map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:b,index:x,offset:v}:null}).filter(nt):o.domain().map((b,x)=>{var w=o.map(b);return G(w)?{coordinate:w+v,value:n?n[b]:b,index:x,offset:v}:null}).filter(nt)},Wj=(e,t)=>{if(!t||t.length!==2||!$(t[0])||!$(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!$(e[0])||e[0]<r)&&(i[0]=r),(!$(e[1])||e[1]>n)&&(i[1]=n),i[0]>n&&(i[0]=n),i[1]<r&&(i[1]=r),i},Kj=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0,s=0;s<r;++s){var l=e[s],u=l==null?void 0:l[i];if(u!=null){var c=u[1],f=u[0],d=jt(c)?f:c;d>=0?(u[0]=a,a+=d,u[1]=a):(u[0]=o,o+=d,u[1]=o)}}}},Hj=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var i=0;i<n;++i)for(var a=0,o=0;o<r;++o){var s=e[o],l=s==null?void 0:s[i];if(l!=null){var u=jt(l[1])?l[0]:l[1];u>=0?(l[0]=a,a+=u,l[1]=a):(l[0]=0,l[1]=0)}}}},Gj={sign:Kj,expand:sk,none:Zr,silhouette:lk,wiggle:uk,positive:Hj},qj=(e,t,r)=>{var n,i=(n=Gj[r])!==null&&n!==void 0?n:Zr,a=ok().keys(t).value((s,l)=>Number(ee(s,l,0))).order(Tl).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((u,c)=>{var f=ee(e[c],t[l],0);Array.isArray(f)&&f.length===2&&$(f[0])&&$(f[1])&&(u[0]=f[0],u[1]=f[1])})}),o};function iy(e){return e==null?void 0:String(e)}function eo(e){var{axis:t,ticks:r,bandSize:n,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!ce(i[t.dataKey])){var s=lg(r,"value",i[t.dataKey]);if(s)return s.coordinate+n/2}return r!=null&&r[a]?r[a].coordinate+n/2:null}var l=ee(i,ce(o)?t.dataKey:o),u=t.scale.map(l);return $(u)?u:null}var Ud=e=>{var{axis:t,ticks:r,offset:n,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var s=ee(a,t.dataKey,t.scale.domain()[o]);if(ce(s))return null;var l=t.scale.map(s);return $(l)?l-i/2+n:null},Yj=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return n<=0&&i>=0?0:i<0?i:n}return r[0]},Vj=e=>{var t=e.flat(2).filter($);return[Math.min(...t),Math.max(...t)]},Xj=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],Zj=(e,t,r)=>{if(e!=null)return Xj(Object.keys(e).reduce((n,i)=>{var a=e[i];if(!a)return n;var{stackedData:o}=a,s=o.reduce((l,u)=>{var c=ty(u,t,r),f=Vj(c);return!G(f[0])||!G(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(s[0],n[0]),Math.max(s[1],n[1])]},[1/0,-1/0]))},zd=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Bd=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,kr=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var i=Ko(t,c=>c.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],u=i[o-1];a=Math.min(((l==null?void 0:l.coordinate)||0)-((u==null?void 0:u.coordinate)||0),a)}return a===1/0?0:a}return r?void 0:0};function Fd(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:i,name:a}=e;return bn(bn({},t),{},{dataKey:r,payload:n,value:i,name:a})}function Er(e,t){if(e)return String(e);if(typeof t=="string")return t}var Jj=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},Qj=(e,t)=>t==="centric"?e.angle:e.radius,or=e=>e.layout.width,sr=e=>e.layout.height,eA=e=>e.layout.scale,ay=e=>e.layout.margin,es=A(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),ts=A(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),oy="data-recharts-item-index",sy="data-recharts-item-id",Ni=60;function Wd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function da(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wd(Object(r),!0).forEach(function(n){tA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tA(e,t,r){return(t=rA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rA(e){var t=nA(e,"string");return typeof t=="symbol"?t:t+""}function nA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iA=e=>e.brush.height;function aA(e){var t=ts(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function oA(e){var t=ts(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var i=typeof n.width=="number"?n.width:Ni;return r+i}return r},0)}function sA(e){var t=es(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function lA(e){var t=es(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Ae=A([or,sr,ay,iA,aA,oA,sA,lA,jg,DO],(e,t,r,n,i,a,o,s,l,u)=>{var c={left:(r.left||0)+i,right:(r.right||0)+a},f={top:(r.top||0)+o,bottom:(r.bottom||0)+s},d=da(da({},f),c),p=d.bottom;d.bottom+=n,d=Fj(d,l,u);var m=e-d.left-d.right,v=t-d.top-d.bottom;return da(da({brushBottom:p},d),{},{width:Math.max(m,0),height:Math.max(v,0)})}),uA=A(Ae,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),Ju=A(or,sr,(e,t)=>({x:0,y:0,width:e,height:t})),cA=h.createContext(null),De=()=>h.useContext(cA)!=null,rs=e=>e.brush,ns=A([rs,Ae,ay],(e,t,r)=>({height:e.height,x:$(e.x)?e.x:t.left,y:$(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:$(e.width)?e.width:t.width}));function fA(e,t,{signal:r,edges:n}={}){let i,a=null;const o=n!=null&&n.includes("leading"),s=n==null||n.includes("trailing"),l=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},u=()=>{s&&l(),p()};let c=null;const f=()=>{c!=null&&clearTimeout(c),c=setTimeout(()=>{c=null,u()},t)},d=()=>{c!==null&&(clearTimeout(c),c=null)},p=()=>{d(),i=void 0,a=null},m=()=>{l()},v=function(...y){if(r!=null&&r.aborted)return;i=this,a=y;const b=c==null;f(),o&&b&&l()};return v.schedule=f,v.cancel=p,v.flush=m,r==null||r.addEventListener("abort",p,{once:!0}),v}function dA(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:n=!1,trailing:i=!0,maxWait:a}=r,o=Array(2);n&&(o[0]="leading"),i&&(o[1]="trailing");let s,l=null;const u=fA(function(...d){s=e.apply(this,d),l=null},t,{edges:o}),c=function(...d){return a!=null&&(l===null&&(l=Date.now()),Date.now()-l>=a)?(s=e.apply(this,d),l=Date.now(),u.cancel(),u.schedule(),s):(u.apply(this,d),s)},f=()=>(u.flush(),s);return c.cancel=u.cancel,c.flush=f,c}function hA(e,t=0,r={}){const{leading:n=!0,trailing:i=!0}=r;return dA(e,t,{leading:n,maxWait:t,trailing:i})}var to=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>i[o++]))}},$t={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},ly=(e,t,r)=>{var{width:n=$t.width,height:i=$t.height,aspect:a,maxHeight:o}=r,s=Jr(n)?e:Number(n),l=Jr(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},pA={width:0,height:0,overflow:"visible"},vA={width:0,overflowX:"visible"},mA={height:0,overflowY:"visible"},gA={},yA=e=>{var{width:t,height:r}=e,n=Jr(t),i=Jr(r);return n&&i?pA:n?vA:i?mA:gA};function bA(e){var{width:t,height:r,aspect:n}=e,i=t,a=r;return i===void 0&&a===void 0?(i=$t.width,a=$t.height):i===void 0?i=n&&n>0?void 0:$t.width:a===void 0&&(a=n&&n>0?void 0:$t.height),{width:i,height:a}}function Gl(){return Gl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gl.apply(null,arguments)}function Kd(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Hd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Kd(Object(r),!0).forEach(function(n){xA(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kd(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xA(e,t,r){return(t=wA(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wA(e){var t=PA(e,"string");return typeof t=="symbol"?t:t+""}function PA(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uy=h.createContext($t.initialDimension);function kA(e){return Ft(e.width)&&Ft(e.height)}function cy(e){var{children:t,width:r,height:n}=e,i=h.useMemo(()=>({width:r,height:n}),[r,n]);return kA(i)?h.createElement(uy.Provider,{value:i},t):null}var Qu=()=>h.useContext(uy),OA=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=$t.initialDimension,width:i,height:a,minWidth:o=$t.minWidth,minHeight:s,maxHeight:l,children:u,debounce:c=$t.debounce,id:f,className:d,onResize:p,style:m={}}=e,v=h.useRef(null),y=h.useRef();y.current=p,h.useImperativeHandle(t,()=>v.current);var[b,x]=h.useState({containerWidth:n.width,containerHeight:n.height}),w=h.useCallback((E,_)=>{x(M=>{var T=Math.round(E),S=Math.round(_);return M.containerWidth===T&&M.containerHeight===S?M:{containerWidth:T,containerHeight:S}})},[]);h.useEffect(()=>{if(v.current==null||typeof ResizeObserver>"u")return ar;var E=S=>{var N,D=S[0];if(D!=null){var{width:z,height:K}=D.contentRect;w(z,K),(N=y.current)===null||N===void 0||N.call(y,z,K)}};c>0&&(E=hA(E,c,{trailing:!0,leading:!1}));var _=new ResizeObserver(E),{width:M,height:T}=v.current.getBoundingClientRect();return w(M,T),_.observe(v.current),()=>{_.disconnect()}},[w,c]);var{containerWidth:P,containerHeight:O}=b;to(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:k,calculatedHeight:j}=ly(P,O,{width:i,height:a,aspect:r,maxHeight:l});return to(k!=null&&k>0||j!=null&&j>0,`The width(%s) and height(%s) of chart should be greater than 0,
2
2
  please check the style of container, or the props width(%s) and height(%s),
3
3
  or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
4
4
  height and width.`,k,j,i,a,o,s,r),h.createElement("div",{id:f?"".concat(f):void 0,className:Z("recharts-responsive-container",d),style:Hd(Hd({},m),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:v},h.createElement("div",{style:yA({width:i,height:a})},h.createElement(cy,{width:k,height:j},u)))}),jA=h.forwardRef((e,t)=>{var r=Qu();if(Ft(r.width)&&Ft(r.height))return e.children;var{width:n,height:i}=bA({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=ly(void 0,void 0,{width:n,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return $(a)&&$(o)?h.createElement(cy,{width:a,height:o},e.children):h.createElement(OA,Gl({},e,{width:n,height:i,ref:t}))});function ec(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var is=()=>{var e,t=De(),r=U(uA),n=U(ns),i=(e=U(rs))===null||e===void 0?void 0:e.padding;return!t||!n||!i?r:{width:n.width-i.left-i.right,height:n.height-i.top-i.bottom,x:i.left,y:i.top}},AA={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},fy=()=>{var e;return(e=U(Ae))!==null&&e!==void 0?e:AA},dy=()=>U(or),hy=()=>U(sr),V=e=>e.layout.layoutType,_r=()=>U(V),tc=()=>{var e=_r();if(e==="horizontal"||e==="vertical")return e},py=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},SA=()=>{var e=_r();return e!==void 0},Di=e=>{var t=se(),r=De(),{width:n,height:i}=e,a=Qu(),o=n,s=i;return a&&(o=a.width>0?a.width:n,s=a.height>0?a.height:i),h.useEffect(()=>{!r&&Ft(o)&&Ft(s)&&t($j({width:o,height:s}))},[t,r,o,s]),null},vy=Symbol.for("immer-nothing"),Gd=Symbol.for("immer-draftable"),ft=Symbol.for("immer-state");function kt(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var mi=Object.getPrototypeOf;function Tn(e){return!!e&&!!e[ft]}function en(e){var t;return e?my(e)||Array.isArray(e)||!!e[Gd]||!!((t=e.constructor)!=null&&t[Gd])||$i(e)||os(e):!1}var EA=Object.prototype.constructor.toString(),qd=new WeakMap;function my(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=qd.get(r);return n===void 0&&(n=Function.toString.call(r),qd.set(r,n)),n===EA}function ro(e,t,r=!0){as(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((n,i)=>t(i,n,e))}function as(e){const t=e[ft];return t?t.type_:Array.isArray(e)?1:$i(e)?2:os(e)?3:0}function ql(e,t){return as(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gy(e,t,r){const n=as(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function _A(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $i(e){return e instanceof Map}function os(e){return e instanceof Set}function Lr(e){return e.copy_||e.base_}function Yl(e,t){if($i(e))return new Map(e);if(os(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=my(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ft];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const o=i[a],s=n[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(mi(e),n)}else{const n=mi(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function rc(e,t=!1){return ss(e)||Tn(e)||!en(e)||(as(e)>1&&Object.defineProperties(e,{set:ha,add:ha,clear:ha,delete:ha}),Object.freeze(e),t&&Object.values(e).forEach(r=>rc(r,!0))),e}function TA(){kt(2)}var ha={value:TA};function ss(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var CA={};function tn(e){const t=CA[e];return t||kt(0,e),t}var gi;function yy(){return gi}function MA(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Yd(e,t){t&&(tn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Vl(e){Xl(e),e.drafts_.forEach(IA),e.drafts_=null}function Xl(e){e===gi&&(gi=e.parent_)}function Vd(e){return gi=MA(gi,e)}function IA(e){const t=e[ft];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xd(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ft].modified_&&(Vl(t),kt(4)),en(e)&&(e=no(t,e),t.parent_||io(t,e)),t.patches_&&tn("Patches").generateReplacementPatches_(r[ft].base_,e,t.patches_,t.inversePatches_)):e=no(t,r,[]),Vl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vy?e:void 0}function no(e,t,r){if(ss(t))return t;const n=e.immer_.shouldUseStrictIteration(),i=t[ft];if(!i)return ro(t,(a,o)=>Zd(e,i,t,a,o,r),n),t;if(i.scope_!==e)return t;if(!i.modified_)return io(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,s=!1;i.type_===3&&(o=new Set(a),a.clear(),s=!0),ro(o,(l,u)=>Zd(e,i,a,l,u,r,s),n),io(e,a,!1),r&&e.patches_&&tn("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function Zd(e,t,r,n,i,a,o){if(i==null||typeof i!="object"&&!o)return;const s=ss(i);if(!(s&&!o)){if(Tn(i)){const l=a&&t&&t.type_!==3&&!ql(t.assigned_,n)?a.concat(n):void 0,u=no(e,i,l);if(gy(r,n,u),Tn(u))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(en(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===i&&s)return;no(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&($i(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&io(e,i)}}}function io(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rc(t,r)}function NA(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:yy(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=nc;r&&(i=[n],a=yi);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var nc={get(e,t){if(t===ft)return e;const r=Lr(e);if(!ql(r,t))return DA(e,r,t);const n=r[t];return e.finalized_||!en(n)?n:n===Zs(e.base_,t)?(Js(e),e.copy_[t]=Jl(n,e)):n},has(e,t){return t in Lr(e)},ownKeys(e){return Reflect.ownKeys(Lr(e))},set(e,t,r){const n=by(Lr(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Zs(Lr(e),t),a=i==null?void 0:i[ft];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(_A(r,i)&&(r!==void 0||ql(e.base_,t)))return!0;Js(e),Zl(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Zs(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Js(e),Zl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Lr(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){kt(11)},getPrototypeOf(e){return mi(e.base_)},setPrototypeOf(){kt(12)}},yi={};ro(nc,(e,t)=>{yi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)};yi.set=function(e,t,r){return nc.set.call(this,e[0],t,r,e[0])};function Zs(e,t){const r=e[ft];return(r?Lr(r):e)[t]}function DA(e,t,r){var i;const n=by(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function by(e,t){if(!(t in e))return;let r=mi(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=mi(r)}}function Zl(e){e.modified_||(e.modified_=!0,e.parent_&&Zl(e.parent_))}function Js(e){e.copy_||(e.copy_=Yl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var $A=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const o=this;return function(l=a,...u){return o.produce(l,c=>r.call(this,c,...u))}}typeof r!="function"&&kt(6),n!==void 0&&typeof n!="function"&&kt(7);let i;if(en(t)){const a=Vd(this),o=Jl(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?Vl(a):Xl(a)}return Yd(a,n),Xd(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===vy&&(i=void 0),this.autoFreeze_&&rc(i,!0),n){const a=[],o=[];tn("Patches").generateReplacementPatches_(t,i,a,o),n(a,o)}return i}else kt(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...s)=>this.produceWithPatches(o,l=>t(l,...s));let n,i;return[this.produce(t,r,(o,s)=>{n=o,i=s}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){en(e)||kt(8),Tn(e)&&(e=RA(e));const t=Vd(this),r=Jl(e,void 0);return r[ft].isManual_=!0,Xl(t),r}finishDraft(e,t){const r=e&&e[ft];(!r||!r.isManual_)&&kt(9);const{scope_:n}=r;return Yd(n,t),Xd(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=tn("Patches").applyPatches_;return Tn(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Jl(e,t){const r=$i(e)?tn("MapSet").proxyMap_(e,t):os(e)?tn("MapSet").proxySet_(e,t):NA(e,t);return(t?t.scope_:yy()).drafts_.push(r),r}function RA(e){return Tn(e)||kt(10,e),xy(e)}function xy(e){if(!en(e)||ss(e))return e;const t=e[ft];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Yl(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Yl(e,!0);return ro(r,(i,a)=>{gy(r,i,xy(a))},n),t&&(t.finalized_=!1),r}var LA=new $A;LA.produce;var UA={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},wy=Xe({name:"legend",initialState:UA,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:le()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,i=vt(e).payload.indexOf(r);i>-1&&(e.payload[i]=n)},prepare:le()},removeLegendPayload:{reducer(e,t){var r=vt(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:le()}}}),{setLegendSize:vB,setLegendSettings:mB,addLegendPayload:Py,replaceLegendPayload:ky,removeLegendPayload:Oy}=wy.actions,zA=wy.reducer,Qs={exports:{}},el={};/**