@kaitranntt/ccs 7.13.1 → 7.14.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/config/base-agy.settings.json +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +3 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +8 -5
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts +2 -1
- package/dist/cliproxy/auth/gemini-token-refresh.d.ts.map +1 -1
- package/dist/cliproxy/auth/gemini-token-refresh.js +4 -3
- package/dist/cliproxy/auth/gemini-token-refresh.js.map +1 -1
- package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-process.js +31 -1
- package/dist/cliproxy/auth/oauth-process.js.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts +21 -0
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -0
- package/dist/cliproxy/auth/provider-refreshers/index.js +56 -0
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -0
- package/dist/cliproxy/auth/token-expiry-checker.d.ts +37 -0
- package/dist/cliproxy/auth/token-expiry-checker.d.ts.map +1 -0
- package/dist/cliproxy/auth/token-expiry-checker.js +114 -0
- package/dist/cliproxy/auth/token-expiry-checker.js.map +1 -0
- package/dist/cliproxy/auth/token-refresh-config.d.ts +13 -0
- package/dist/cliproxy/auth/token-refresh-config.d.ts.map +1 -0
- package/dist/cliproxy/auth/token-refresh-config.js +31 -0
- package/dist/cliproxy/auth/token-refresh-config.js.map +1 -0
- package/dist/cliproxy/auth/token-refresh-worker.d.ts +83 -0
- package/dist/cliproxy/auth/token-refresh-worker.d.ts.map +1 -0
- package/dist/cliproxy/auth/token-refresh-worker.js +214 -0
- package/dist/cliproxy/auth/token-refresh-worker.js.map +1 -0
- package/dist/cliproxy/auth-session-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth-session-manager.js +28 -0
- package/dist/cliproxy/auth-session-manager.js.map +1 -1
- package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -1
- package/dist/cliproxy/binary/lifecycle.js +47 -6
- package/dist/cliproxy/binary/lifecycle.js.map +1 -1
- package/dist/cliproxy/binary/types.d.ts +13 -0
- package/dist/cliproxy/binary/types.d.ts.map +1 -1
- package/dist/cliproxy/binary/types.js +3 -1
- package/dist/cliproxy/binary/types.js.map +1 -1
- package/dist/cliproxy/binary/version-cache.d.ts +13 -1
- package/dist/cliproxy/binary/version-cache.d.ts.map +1 -1
- package/dist/cliproxy/binary/version-cache.js +46 -1
- package/dist/cliproxy/binary/version-cache.js.map +1 -1
- package/dist/cliproxy/binary/version-checker.d.ts +6 -1
- package/dist/cliproxy/binary/version-checker.d.ts.map +1 -1
- package/dist/cliproxy/binary/version-checker.js +37 -1
- package/dist/cliproxy/binary/version-checker.js.map +1 -1
- package/dist/cliproxy/binary-manager.d.ts +3 -0
- package/dist/cliproxy/binary-manager.d.ts.map +1 -1
- package/dist/cliproxy/binary-manager.js +36 -1
- package/dist/cliproxy/binary-manager.js.map +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +34 -0
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/platform-detector.d.ts +6 -0
- package/dist/cliproxy/platform-detector.d.ts.map +1 -1
- package/dist/cliproxy/platform-detector.js +7 -1
- package/dist/cliproxy/platform-detector.js.map +1 -1
- package/dist/cliproxy/quota-fetcher.d.ts +44 -0
- package/dist/cliproxy/quota-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher.js +91 -1
- package/dist/cliproxy/quota-fetcher.js.map +1 -1
- package/dist/cliproxy/service-manager.d.ts +12 -0
- package/dist/cliproxy/service-manager.d.ts.map +1 -1
- package/dist/cliproxy/service-manager.js +66 -1
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/commands/cliproxy-command.d.ts.map +1 -1
- package/dist/commands/cliproxy-command.js +93 -0
- package/dist/commands/cliproxy-command.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +1 -0
- package/dist/commands/help-command.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +18 -0
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/management/oauth-port-diagnostics.js +2 -2
- package/dist/management/oauth-port-diagnostics.js.map +1 -1
- package/dist/management/shared-manager.d.ts +8 -0
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +33 -0
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/ui/assets/{accounts-DKm_BUkJ.js → accounts-wkvC_Z1E.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BBbNIyvF.js → alert-dialog--nlDi-Dj.js} +1 -1
- package/dist/ui/assets/{api-p6k8BwWO.js → api-DeyefOLW.js} +1 -1
- package/dist/ui/assets/auth-section-BQXfw1cb.js +1 -0
- package/dist/ui/assets/{card-D6fGkasO.js → card-P5vPGo2D.js} +1 -1
- package/dist/ui/assets/cliproxy-CcMLaKpF.js +3 -0
- package/dist/ui/assets/{cliproxy-control-panel-D7gdCCO7.js → cliproxy-control-panel-Dbs8NAQa.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-D55Qga4b.js → confirm-dialog-BM75Bkww.js} +1 -1
- package/dist/ui/assets/{copilot-fwj1xk6l.js → copilot-BwylIlO5.js} +3 -3
- package/dist/ui/assets/{globalenv-section-DMSdqrn_.js → globalenv-section-Cgpz_NQ0.js} +1 -1
- package/dist/ui/assets/{health-65nETbIF.js → health-DWUjYWDI.js} +1 -1
- package/dist/ui/assets/icons-U9n5DGj9.js +1 -0
- package/dist/ui/assets/index-1g-Hy9VA.css +1 -0
- package/dist/ui/assets/{index-Dc8X9bLV.js → index-4Wd5fx72.js} +1 -1
- package/dist/ui/assets/{index-BrijlHVl.js → index-CIWe-99u.js} +1 -1
- package/dist/ui/assets/{index-8HAJX3-Y.js → index-D8MFq-UJ.js} +17 -17
- package/dist/ui/assets/{index-CwDi6WPm.js → index-f_AuSs01.js} +1 -1
- package/dist/ui/assets/{radix-ui-uXQB-q0u.js → radix-ui-CBgg0XeO.js} +1 -1
- package/dist/ui/assets/{shared-CMWj9K3T.js → shared-I-pAdvVQ.js} +1 -1
- package/dist/ui/assets/{switch-D_o-N1Sa.js → switch-DHwS-NMF.js} +1 -1
- package/dist/ui/assets/{tanstack-Coed0rqz.js → tanstack-CxYN0q6L.js} +1 -1
- package/dist/ui/index.html +5 -5
- package/dist/utils/port-utils.d.ts.map +1 -1
- package/dist/utils/port-utils.js +12 -9
- package/dist/utils/port-utils.js.map +1 -1
- package/dist/web-server/health/cliproxy-checks.d.ts.map +1 -1
- package/dist/web-server/health/cliproxy-checks.js +14 -0
- package/dist/web-server/health/cliproxy-checks.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +88 -0
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +4 -1
- package/package.json +3 -1
- package/scripts/dev-symlink.sh +115 -0
- package/dist/ui/assets/auth-section-B4wvcy8z.js +0 -1
- package/dist/ui/assets/cliproxy-DuWY_mzK.js +0 -3
- package/dist/ui/assets/icons-CwFZAiDB.js +0 -1
- package/dist/ui/assets/index-oS2cgEFl.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-uXQB-q0u.js";import{r as f,c as fe}from"./react-vendor-B_CU-WTZ.js";import{u as M,S as h,c as d,P as y,B as I,a as H,b as ee,d as pe,e as se,C as ge,g as te,f as je,h as Ne,i as ye,j as be}from"./index-8HAJX3-Y.js";import{C as p,a as g,b as N,c as S}from"./card-D6fGkasO.js";import{x as we,a2 as ae,a3 as z,a4 as re,v as ne,Q as ve,G as ke,a5 as Ce,a0 as $e,t as Y,U as Se,Z as le,q as Le,_ as G,a6 as De,s as Te,b as Fe,a7 as Re,a8 as Me}from"./icons-CwFZAiDB.js";import{u as Pe,a as P}from"./tanstack-Coed0rqz.js";import{K as D,L as Q,f as k,H as Ae}from"./utils-CzKF5WmX.js";import{R as ie,A as Be,C as Ue,X as qe,Y as V,T as oe,a as Z,P as Ie,b as Oe,c as Ke}from"./charts-CJC4bH8P.js";import"./notifications-dJQY2-U6.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function Ee({data:s,isLoading:t}){const{privacyMode:a}=M();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:[1,2,3,4,5].map(o=>e.jsx(p,{children:e.jsx(g,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-8 w-[80px]"})]}),e.jsx(h,{className:"h-8 w-8 rounded-lg"})]})})},o))});const l=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),r=s?.totalCost?Math.round(l/s.totalCost*100):0,i=[{title:"Total Tokens",value:s?.totalTokens??0,icon:we,format:o=>R(o),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:`${R(s?.totalInputTokens??0)} in / ${R(s?.totalOutputTokens??0)} out`},{title:"Total Cost",value:s?.totalCost??0,icon:ae,format:o=>`$${o.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:`$${s?.averageCostPerDay?.toFixed(2)??"0.00"}/day avg`},{title:"Cache Tokens",value:s?.totalCacheTokens??0,icon:z,format:o=>R(o),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:`$${l.toFixed(2)} (${r}% of cost)`},{title:"Input Cost",value:s?.tokenBreakdown?.input?.cost??0,icon:re,format:o=>`$${o.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:`${R(s?.tokenBreakdown?.input?.tokens??0)} tokens`},{title:"Output Cost",value:s?.tokenBreakdown?.output?.cost??0,icon:ne,format:o=>`$${o.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:`${R(s?.tokenBreakdown?.output?.tokens??0)} tokens`}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:i.map((o,n)=>{const c=o.icon;return e.jsx(p,{className:"hover:shadow-md transition-shadow",children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:o.title}),e.jsx("p",{className:d("text-xl font-bold truncate",a&&y),children:o.format(o.value)}),o.subtitle&&e.jsx("p",{className:d("text-[10px] text-muted-foreground truncate",a&&y),children:o.subtitle})]}),e.jsx("div",{className:d("p-2 rounded-lg shrink-0",o.bgColor),children:e.jsx(c,{className:d("h-4 w-4",o.color)})})]})})},n)})})}function R(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Ge({model:s}){const{privacyMode:t}=M(),a=We(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(I,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(I,{variant:a.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:d("text-lg font-bold",t&&y),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Cost"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:d("text-lg font-bold",t&&y),children:_e(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Tokens"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:d("space-y-1",t&&y),children:[e.jsx(W,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:re}),e.jsx(W,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:ne}),e.jsx(W,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:z}),e.jsx(W,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:z})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:"Input/Output Ratio"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:a.description})]})]})}function W({label:s,tokens:t,cost:a,color:l,icon:r}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:l}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",a.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(r,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:He(t)})]})]})]})}function We(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function He(s){return s.toLocaleString()}function _e(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const ze="/api";function w(s){const t=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),l=String(s.getDate()).padStart(2,"0");return`${t}${a}${l}`}const T={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),L(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),L(`/usage/sessions?${t}`)},monthly:(s,t)=>{const a=new URLSearchParams;return s&&a.append("months",s.toString()),t&&a.append("profile",t),L(`/usage/monthly?${a}`)},refresh:async()=>{if(!(await fetch(`${ze}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>L("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/insights?${t}`)}};async function L(s){const a=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!a.ok){const r=await a.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||a.statusText)}const l=await a.json();return l.data||l}function Qe(s){return P({queryKey:["usage","summary",s],queryFn:()=>T.summary(s),staleTime:60*1e3})}function Ye(s){return P({queryKey:["usage","trends",s],queryFn:()=>T.trends(s),staleTime:60*1e3})}function Ve(s){return P({queryKey:["usage","hourly",s],queryFn:()=>T.hourly(s),staleTime:60*1e3})}function Ze(s){return P({queryKey:["usage","models",s],queryFn:()=>T.models(s),staleTime:60*1e3})}function Xe(){const s=Pe();return f.useCallback(async()=>{await T.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function Je(){return P({queryKey:["usage","status"],queryFn:()=>T.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function es(s){return P({queryKey:["usage","sessions",s],queryFn:()=>T.sessions(s),staleTime:60*1e3})}function ss(){const[s,t]=f.useState({from:D(new Date,30),to:new Date}),[a,l]=f.useState(!1),[r,i]=f.useState(null),[o,n]=f.useState(null),[c,x]=f.useState("daily"),u=Xe(),m=f.useCallback(async()=>{l(!0);try{await u()}finally{l(!1)}},[u]),j=f.useMemo(()=>({startDate:s?.from,endDate:s?.to}),[s?.from,s?.to]),{data:b,isLoading:v}=Qe(j),{data:C,isLoading:$}=Ye(j),{data:A,isLoading:B}=Ve(j),{data:U,isLoading:q}=Ze(j),{data:_,isLoading:O}=es({...j,limit:3}),{data:K}=Je(),ce=f.useCallback(()=>{const F=new Date;t({from:D(F,1),to:F}),x("hourly")},[]),de=f.useCallback(F=>{t(F),x("daily")},[]),xe=f.useMemo(()=>K?.lastFetch?Q(new Date(K.lastFetch),{addSuffix:!0}):null,[K?.lastFetch]),ue=f.useCallback((F,he)=>{const E=he.currentTarget.getBoundingClientRect();n({x:E.left+E.width/2,y:E.top+E.height/2}),i(F)},[]),me=f.useCallback(()=>{i(null),n(null)},[]);return{dateRange:s,isRefreshing:a,viewMode:c,selectedModel:r,popoverPosition:o,summary:b,trends:C,hourlyData:A,models:U,sessions:_,status:K,isSummaryLoading:v,isTrendsLoading:$,isHourlyLoading:B,isModelsLoading:q,isSessionsLoading:O,isLoading:v||$||q||O,handleRefresh:m,handleTodayClick:ce,handleDateRangeChange:de,handleModelClick:ue,handlePopoverClose:me,lastUpdatedText:xe}}function ts({value:s,onChange:t,presets:a=[{label:"Last 7 days",range:{from:D(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:D(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:D(new Date,90),to:new Date}}],className:l}){const[r,i]=fe.useState(!1),o=n=>!s||!s.from||!s.to||!n.from||!n.to?!1:k(s.from,"yyyy-MM-dd")===k(n.from,"yyyy-MM-dd")&&k(s.to,"yyyy-MM-dd")===k(n.to,"yyyy-MM-dd");return e.jsxs("div",{className:d("flex items-center gap-2",l),children:[a.map(n=>e.jsx(H,{variant:o(n.range)?"default":"outline",size:"sm",onClick:()=>t(n.range),children:n.label},n.label)),e.jsxs(ee,{open:r,onOpenChange:i,children:[e.jsx(pe,{asChild:!0,children:e.jsxs(H,{id:"date",variant:"outline",className:d("w-auto min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Ce,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[k(s.from,"LLL dd, y")," - ",k(s.to,"LLL dd, y")]}):k(s.from,"LLL dd, y"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(se,{className:"w-auto p-0",align:"end",children:e.jsx(ge,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function as({dateRange:s,onDateRangeChange:t,onTodayClick:a,onRefresh:l,isRefreshing:r,lastUpdatedText:i,viewMode:o}){return e.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Analytics"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track usage & insights"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{variant:o==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:a,children:"24H"}),e.jsx(ts,{value:s,onChange:t,presets:[{label:"7D",range:{from:D(new Date,7),to:new Date}},{label:"30D",range:{from:D(new Date,30),to:new Date}},{label:"Month",range:{from:Ae(new Date),to:new Date}},{label:"All Time",range:{from:void 0,to:new Date}}]}),i&&e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["Updated ",i]}),e.jsx(H,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:l,disabled:r,children:e.jsx($e,{className:`w-3.5 h-3.5 ${r?"animate-spin":""}`})})]})]})}function rs({data:s,isLoading:t,granularity:a="daily",className:l}){const{privacyMode:r}=M(),i=f.useMemo(()=>!s||s.length===0?[]:(a==="hourly"?s:[...s].reverse()).map(c=>{const x="hour"in c?c.hour:c.date;return{...c,dateFormatted:ns(x,a),costRounded:Number(c.cost.toFixed(4))}}),[s,a]);if(t)return e.jsx(h,{className:d("h-full w-full",l)});if(!s||s.length===0)return e.jsx("div",{className:d("h-full flex items-center justify-center",l),children:e.jsx("p",{className:"text-muted-foreground",children:a==="hourly"?"No usage data for today":"No usage data available"})});const o=({x:n,y:c,payload:x,isRight:u})=>{const m=u?`$${x.value}`:X(Number(x.value));return e.jsx("text",{x:n,y:c,dy:4,textAnchor:u?"start":"end",fontSize:12,fill:"currentColor",className:d("fill-muted-foreground",r&&"blur-[4px]"),children:m})};return e.jsx("div",{className:d("w-full h-full",l),children:e.jsx(ie,{width:"100%",height:"100%",children:e.jsxs(Be,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(Ue,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(qe,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"left",orientation:"left",tick:n=>e.jsx(o,{...n,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"right",orientation:"right",tick:n=>e.jsx(o,{...n,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(oe,{content:({active:n,payload:c,label:x})=>{if(!n||!c||!c.length)return null;const u=c[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:x}),c.map((m,j)=>e.jsxs("p",{className:d("text-sm",r&&y),style:{color:m.color},children:[m.name,":"," ",m.name==="Tokens"?X(Number(m.value)||0):`$${m.value}`]},j)),"requests"in u&&e.jsxs("p",{className:d("text-sm text-muted-foreground mt-1",r&&y),children:["Requests: ",u.requests]})]})}}),e.jsx(Z,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(Z,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ns(s,t){if(t==="hourly"){const[l,r]=s.split(" ");if(l&&r){const i=new Date(`${l}T${r}:00Z`);return k(i,"HH:mm")}return s}const a=new Date(s);return t==="monthly"?k(a,"MMM yyyy"):k(a,"MMM dd")}function X(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function ls({data:s,isLoading:t,className:a}){const{privacyMode:l}=M(),r=f.useMemo(()=>!s||s.length===0?[]:s.map(n=>({name:n.model,value:n.tokens,cost:n.cost,percentage:n.percentage,fill:te(n.model)})),[s]);if(t)return e.jsx(h,{className:d("h-[300px] w-full",a)});if(!s||s.length===0)return e.jsx("div",{className:d("h-[300px] flex items-center justify-center",a),children:e.jsx("p",{className:"text-muted-foreground",children:"No model data available"})});const i=({active:n,payload:c})=>{if(!n||!c)return null;const x=c;if(!x.length)return null;const u=x[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:u.name}),e.jsxs("p",{className:d("text-muted-foreground",l&&y),children:[is(u.value)," (",u.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:d("text-muted-foreground",l&&y),children:["$",u.cost.toFixed(4)]})]})},o=n=>n.percentage>5?`${n.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:d("w-full",a),children:e.jsx(ie,{width:"100%",height:250,children:e.jsxs(Ie,{children:[e.jsx(Oe,{data:r,cx:"50%",cy:"50%",labelLine:!1,label:o,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:r.map((n,c)=>e.jsx(Ke,{fill:n.fill,strokeWidth:1},`cell-${c}`))}),e.jsx(oe,{content:i})]})})})}function is(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function os({data:s,isLoading:t,className:a}){const{privacyMode:l}=M(),r=f.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const i=s.sessions,o=s.total,n=i.reduce((b,v)=>b+(v.inputTokens+v.outputTokens),0),c=Math.round(n/i.length),u=i.reduce((b,v)=>b+v.cost,0)/i.length,m=i[0],j=m?Q(new Date(m.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:o,avgTokens:c,avgCost:u,lastActive:j,recentSessions:i.slice(0,3)}},[s]);return t?e.jsxs(p,{className:d("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsx(h,{className:"h-5 w-32"})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}):r?e.jsxs(p,{className:d("flex flex-col h-full shadow-sm",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(g,{className:"px-3 pb-3 pt-0 flex-1 flex flex-col gap-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Se,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:r.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(le,{className:"w-4 h-4"}),e.jsxs("span",{className:d("text-xl font-bold",l&&y),children:["$",r.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx(Le,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5",children:r.recentSessions.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium truncate",title:i.projectPath,children:i.projectPath.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:Q(new Date(i.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:d("text-right shrink-0 ml-2",l&&y),children:[e.jsxs("div",{className:"font-mono",children:["$",i.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[cs(i.inputTokens+i.outputTokens)," toks"]})]})]},i.sessionId))})]})]})]}):e.jsxs(p,{className:d("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No session data available"})})]})}function cs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function ds({className:s,isLoading:t}){const{data:a,isLoading:l}=je(),{data:r,isLoading:i,error:o}=Ne(a?.running);if(t||l||a?.running&&i)return e.jsxs(p,{className:d("flex flex-col h-full",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-16 w-full"})]})})]});if(!a?.running)return e.jsxs(p,{className:d("flex flex-col h-full border-dashed",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"secondary",className:"text-[10px] h-5",children:"Offline"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Start a CLIProxy session (gemini, codex, agy) to collect stats."})})]});if(o)return e.jsxs(p,{className:d("flex flex-col h-full border-destructive/50",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:o.message})})]});const c=r?.totalRequests??0,x=r?.quotaExceededCount??0,u=c-x,m=c>0?Math.round(u/c*100):100,j=r?.tokens?.total??0,b=Object.entries(r?.requestsByModel??{}).sort((C,$)=>$[1]-C[1]).slice(0,4),v=b.length>0?b[0][1]:1;return e.jsxs(p,{className:d("flex flex-col h-full overflow-hidden",s),children:[e.jsx(N,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(I,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(le,{className:"h-3 w-3 mr-0.5"}),"Running"]})]})}),e.jsx(g,{className:"p-0 flex-1 min-h-0",children:e.jsx(ye,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${m*.88} 88`,strokeLinecap:"round",className:m>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[m,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(c)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:x>0?`${x} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(De,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(j)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Total tokens"})]})]})]}),b.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Te,{className:"h-3 w-3"}),"Models Used"]}),e.jsx("div",{className:"space-y-1",children:b.map(([C,$])=>{const A=Math.round($/v*100),B=xs(C);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:C,children:B}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:$})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${A}%`}})})]},C)})})]})]})})})]})}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function xs(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function us(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function ms({models:s,isLoading:t,onModelClick:a,privacyMode:l}){return e.jsxs(p,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-4",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4"}),"Cost by Model"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(h,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((r,i)=>i.cost-r.cost).map(r=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:i=>a(r,i),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:te(r.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:r.model})]}),e.jsx(hs,{model:r}),e.jsx("span",{className:d("text-[10px] text-muted-foreground w-14 text-right shrink-0",l&&y),children:us(r.tokens)}),e.jsxs("span",{className:d("font-mono font-medium w-16 text-right shrink-0",l&&y),children:["$",r.cost.toFixed(2)]}),e.jsx(Fe,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},r.model)),e.jsx(fs,{})]})})]})}function hs({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},a=l=>s.cost>0?l/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${a(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${a(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${a(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${a(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function fs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:a,hasBorder:l})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",l&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),a]},a))})}function ps({viewMode:s,trends:t,hourlyData:a,models:l,sessions:r,isTrendsLoading:i,isHourlyLoading:o,isModelsLoading:n,isSessionsLoading:c,isSummaryLoading:x,onModelClick:u}){const{privacyMode:m}=M();return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 gap-4",children:[e.jsxs(p,{className:"flex flex-col flex-1 min-h-0 max-h-[500px] overflow-hidden shadow-sm",children:[e.jsx(N,{className:"px-3 py-2 shrink-0",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Re,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(rs,{data:s==="hourly"?a||[]:t||[],isLoading:s==="hourly"?o:i,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto lg:h-[180px] shrink-0",children:[e.jsx(ms,{models:l,isLoading:n,onModelClick:u,privacyMode:m}),e.jsxs(p,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-2",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(ls,{data:l||[],isLoading:n,className:"h-full w-full"})})]}),e.jsx(os,{data:r,isLoading:c,className:"lg:col-span-2"}),e.jsx(ds,{isLoading:x,className:"lg:col-span-2"})]})]})}function Ls(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(p,{className:"flex flex-col min-h-[300px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-32"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(h,{className:"h-3 w-24"})]}),e.jsx(h,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(h,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2 h-2 rounded-full"}),e.jsx(h,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function Ds(){const s=f.useRef(null),{dateRange:t,handleDateRangeChange:a,handleTodayClick:l,handleRefresh:r,isRefreshing:i,lastUpdatedText:o,viewMode:n,summary:c,isSummaryLoading:x,trends:u,hourlyData:m,models:j,sessions:b,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:$,isSessionsLoading:A,handleModelClick:B,selectedModel:U,popoverPosition:q,handlePopoverClose:_}=ss();return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden px-4 pt-4 pb-50 gap-4",children:[e.jsx(as,{dateRange:t,onDateRangeChange:a,onTodayClick:l,onRefresh:r,isRefreshing:i,lastUpdatedText:o,viewMode:n}),e.jsx(Ee,{data:c,isLoading:x}),e.jsx(ps,{viewMode:n,trends:u,hourlyData:m,models:j,sessions:b,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:$,isSessionsLoading:A,isSummaryLoading:x,onModelClick:B}),e.jsxs(ee,{open:!!U,onOpenChange:O=>!O&&_(),children:[e.jsx(be,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:q?.x??0,top:q?.y??0,width:1,height:1}})}),e.jsx(se,{className:"w-80 p-3",side:"top",align:"center",children:U&&e.jsx(Ge,{model:U})})]})]})}export{Ds as AnalyticsPage,Ls as AnalyticsSkeleton};
|
|
1
|
+
import{j as e}from"./radix-ui-CBgg0XeO.js";import{r as f,c as fe}from"./react-vendor-B_CU-WTZ.js";import{u as M,S as h,c as d,P as y,B as I,a as H,b as ee,d as pe,e as se,C as ge,g as te,f as je,h as Ne,i as ye,j as be}from"./index-D8MFq-UJ.js";import{C as p,a as g,b as N,c as S}from"./card-P5vPGo2D.js";import{x as we,a2 as ae,a3 as z,a4 as re,v as ne,Q as ve,G as ke,a5 as Ce,a0 as $e,t as Y,U as Se,Z as le,q as Le,_ as G,a6 as De,s as Te,b as Fe,a7 as Re,a8 as Me}from"./icons-U9n5DGj9.js";import{u as Pe,a as P}from"./tanstack-CxYN0q6L.js";import{K as D,L as Q,f as k,H as Ae}from"./utils-CzKF5WmX.js";import{R as ie,A as Be,C as Ue,X as qe,Y as V,T as oe,a as Z,P as Ie,b as Oe,c as Ke}from"./charts-CJC4bH8P.js";import"./notifications-dJQY2-U6.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function Ee({data:s,isLoading:t}){const{privacyMode:a}=M();if(t)return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:[1,2,3,4,5].map(o=>e.jsx(p,{children:e.jsx(g,{className:"p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-8 w-[80px]"})]}),e.jsx(h,{className:"h-8 w-8 rounded-lg"})]})})},o))});const l=(s?.tokenBreakdown?.cacheCreation?.cost??0)+(s?.tokenBreakdown?.cacheRead?.cost??0),r=s?.totalCost?Math.round(l/s.totalCost*100):0,i=[{title:"Total Tokens",value:s?.totalTokens??0,icon:we,format:o=>R(o),color:"text-blue-600",bgColor:"bg-blue-100 dark:bg-blue-900/20",subtitle:`${R(s?.totalInputTokens??0)} in / ${R(s?.totalOutputTokens??0)} out`},{title:"Total Cost",value:s?.totalCost??0,icon:ae,format:o=>`$${o.toFixed(2)}`,color:"text-green-600",bgColor:"bg-green-100 dark:bg-green-900/20",subtitle:`$${s?.averageCostPerDay?.toFixed(2)??"0.00"}/day avg`},{title:"Cache Tokens",value:s?.totalCacheTokens??0,icon:z,format:o=>R(o),color:"text-cyan-600",bgColor:"bg-cyan-100 dark:bg-cyan-900/20",subtitle:`$${l.toFixed(2)} (${r}% of cost)`},{title:"Input Cost",value:s?.tokenBreakdown?.input?.cost??0,icon:re,format:o=>`$${o.toFixed(2)}`,color:"text-purple-600",bgColor:"bg-purple-100 dark:bg-purple-900/20",subtitle:`${R(s?.tokenBreakdown?.input?.tokens??0)} tokens`},{title:"Output Cost",value:s?.tokenBreakdown?.output?.cost??0,icon:ne,format:o=>`$${o.toFixed(2)}`,color:"text-orange-600",bgColor:"bg-orange-100 dark:bg-orange-900/20",subtitle:`${R(s?.tokenBreakdown?.output?.tokens??0)} tokens`}];return e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 gap-4",children:i.map((o,n)=>{const c=o.icon;return e.jsx(p,{className:"hover:shadow-md transition-shadow",children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between space-x-2",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground truncate",children:o.title}),e.jsx("p",{className:d("text-xl font-bold truncate",a&&y),children:o.format(o.value)}),o.subtitle&&e.jsx("p",{className:d("text-[10px] text-muted-foreground truncate",a&&y),children:o.subtitle})]}),e.jsx("div",{className:d("p-2 rounded-lg shrink-0",o.bgColor),children:e.jsx(c,{className:d("h-4 w-4",o.color)})})]})})},n)})})}function R(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function Ge({model:s}){const{privacyMode:t}=M(),a=We(s.ioRatio);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold leading-none truncate",title:s.model,children:s.model})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(I,{variant:"secondary",className:"text-[10px] h-5 px-1.5",children:[s.percentage.toFixed(1),"% usage"]}),e.jsxs(I,{variant:a.variant,className:"text-[10px] h-5 px-1.5",children:[s.ioRatio.toFixed(0),":1 I/O"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("p",{className:d("text-lg font-bold",t&&y),children:["$",s.cost.toFixed(2)]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Cost"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsx("p",{className:d("text-lg font-bold",t&&y),children:_e(s.tokens)}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"Total Tokens"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h5",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Token Breakdown"}),e.jsxs("div",{className:d("space-y-1",t&&y),children:[e.jsx(W,{label:"Input",tokens:s.inputTokens,cost:s.costBreakdown.input.cost,color:"#335c67",icon:re}),e.jsx(W,{label:"Output",tokens:s.outputTokens,cost:s.costBreakdown.output.cost,color:"#fff3b0",icon:ne}),e.jsx(W,{label:"Cache Write",tokens:s.cacheCreationTokens,cost:s.costBreakdown.cacheCreation.cost,color:"#e09f3e",icon:z}),e.jsx(W,{label:"Cache Read",tokens:s.cacheReadTokens,cost:s.costBreakdown.cacheRead.cost,color:"#9e2a2b",icon:z})]})]}),e.jsxs("div",{className:"p-2.5 rounded-md border bg-muted/20 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-medium",children:"Input/Output Ratio"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:a.description})]})]})}function W({label:s,tokens:t,cost:a,color:l,icon:r}){return t===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("div",{className:"w-1 h-6 rounded-full shrink-0",style:{backgroundColor:l}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium truncate",children:s}),e.jsxs("span",{className:"font-mono text-muted-foreground",children:["$",a.toFixed(3)]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(r,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:He(t)})]})]})]})}function We(s){return s>=200?{variant:"destructive",description:"Extended thinking or large context loading. Expected for reasoning models."}:s>=50?{variant:"secondary",description:"More input than output. Typical for analysis tasks."}:s>=5?{variant:"outline",description:"Balanced input/output ratio for typical coding tasks."}:{variant:"default",description:"More output than input. Generation-heavy workload."}}function He(s){return s.toLocaleString()}function _e(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}const ze="/api";function w(s){const t=s.getFullYear(),a=String(s.getMonth()+1).padStart(2,"0"),l=String(s.getDate()).padStart(2,"0");return`${t}${a}${l}`}const T={summary:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/summary?${t}`)},trends:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/daily?${t}`)},hourly:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),L(`/usage/hourly?${t}`)},models:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/models?${t}`)},sessions:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),s?.limit&&t.append("limit",s.limit.toString()),s?.offset&&t.append("offset",s.offset.toString()),L(`/usage/sessions?${t}`)},monthly:(s,t)=>{const a=new URLSearchParams;return s&&a.append("months",s.toString()),t&&a.append("profile",t),L(`/usage/monthly?${a}`)},refresh:async()=>{if(!(await fetch(`${ze}/usage/refresh`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Failed to refresh usage cache")},status:()=>L("/usage/status"),insights:s=>{const t=new URLSearchParams;return s?.startDate&&t.append("since",w(s.startDate)),s?.endDate&&t.append("until",w(s.endDate)),s?.profile&&t.append("profile",s.profile),L(`/usage/insights?${t}`)}};async function L(s){const a=await fetch(`/api${s}`,{headers:{"Content-Type":"application/json"}});if(!a.ok){const r=await a.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||a.statusText)}const l=await a.json();return l.data||l}function Qe(s){return P({queryKey:["usage","summary",s],queryFn:()=>T.summary(s),staleTime:60*1e3})}function Ye(s){return P({queryKey:["usage","trends",s],queryFn:()=>T.trends(s),staleTime:60*1e3})}function Ve(s){return P({queryKey:["usage","hourly",s],queryFn:()=>T.hourly(s),staleTime:60*1e3})}function Ze(s){return P({queryKey:["usage","models",s],queryFn:()=>T.models(s),staleTime:60*1e3})}function Xe(){const s=Pe();return f.useCallback(async()=>{await T.refresh(),await s.invalidateQueries({queryKey:["usage"]})},[s])}function Je(){return P({queryKey:["usage","status"],queryFn:()=>T.status(),staleTime:10*1e3,refetchInterval:30*1e3})}function es(s){return P({queryKey:["usage","sessions",s],queryFn:()=>T.sessions(s),staleTime:60*1e3})}function ss(){const[s,t]=f.useState({from:D(new Date,30),to:new Date}),[a,l]=f.useState(!1),[r,i]=f.useState(null),[o,n]=f.useState(null),[c,x]=f.useState("daily"),u=Xe(),m=f.useCallback(async()=>{l(!0);try{await u()}finally{l(!1)}},[u]),j=f.useMemo(()=>({startDate:s?.from,endDate:s?.to}),[s?.from,s?.to]),{data:b,isLoading:v}=Qe(j),{data:C,isLoading:$}=Ye(j),{data:A,isLoading:B}=Ve(j),{data:U,isLoading:q}=Ze(j),{data:_,isLoading:O}=es({...j,limit:3}),{data:K}=Je(),ce=f.useCallback(()=>{const F=new Date;t({from:D(F,1),to:F}),x("hourly")},[]),de=f.useCallback(F=>{t(F),x("daily")},[]),xe=f.useMemo(()=>K?.lastFetch?Q(new Date(K.lastFetch),{addSuffix:!0}):null,[K?.lastFetch]),ue=f.useCallback((F,he)=>{const E=he.currentTarget.getBoundingClientRect();n({x:E.left+E.width/2,y:E.top+E.height/2}),i(F)},[]),me=f.useCallback(()=>{i(null),n(null)},[]);return{dateRange:s,isRefreshing:a,viewMode:c,selectedModel:r,popoverPosition:o,summary:b,trends:C,hourlyData:A,models:U,sessions:_,status:K,isSummaryLoading:v,isTrendsLoading:$,isHourlyLoading:B,isModelsLoading:q,isSessionsLoading:O,isLoading:v||$||q||O,handleRefresh:m,handleTodayClick:ce,handleDateRangeChange:de,handleModelClick:ue,handlePopoverClose:me,lastUpdatedText:xe}}function ts({value:s,onChange:t,presets:a=[{label:"Last 7 days",range:{from:D(new Date,7),to:new Date}},{label:"Last 30 days",range:{from:D(new Date,30),to:new Date}},{label:"Last 90 days",range:{from:D(new Date,90),to:new Date}}],className:l}){const[r,i]=fe.useState(!1),o=n=>!s||!s.from||!s.to||!n.from||!n.to?!1:k(s.from,"yyyy-MM-dd")===k(n.from,"yyyy-MM-dd")&&k(s.to,"yyyy-MM-dd")===k(n.to,"yyyy-MM-dd");return e.jsxs("div",{className:d("flex items-center gap-2",l),children:[a.map(n=>e.jsx(H,{variant:o(n.range)?"default":"outline",size:"sm",onClick:()=>t(n.range),children:n.label},n.label)),e.jsxs(ee,{open:r,onOpenChange:i,children:[e.jsx(pe,{asChild:!0,children:e.jsxs(H,{id:"date",variant:"outline",className:d("w-auto min-w-[240px] justify-start text-left font-normal",!s&&"text-muted-foreground"),children:[e.jsx(Ce,{className:"mr-2 h-4 w-4"}),s?.from?s.to?e.jsxs(e.Fragment,{children:[k(s.from,"LLL dd, y")," - ",k(s.to,"LLL dd, y")]}):k(s.from,"LLL dd, y"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(se,{className:"w-auto p-0",align:"end",children:e.jsx(ge,{initialFocus:!0,mode:"range",defaultMonth:s?.from,selected:s,onSelect:t,numberOfMonths:2})})]})]})}function as({dateRange:s,onDateRangeChange:t,onTodayClick:a,onRefresh:l,isRefreshing:r,lastUpdatedText:i,viewMode:o}){return e.jsxs("div",{className:"flex items-center justify-between shrink-0",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Analytics"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track usage & insights"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{variant:o==="hourly"?"default":"outline",size:"sm",className:"h-8",onClick:a,children:"24H"}),e.jsx(ts,{value:s,onChange:t,presets:[{label:"7D",range:{from:D(new Date,7),to:new Date}},{label:"30D",range:{from:D(new Date,30),to:new Date}},{label:"Month",range:{from:Ae(new Date),to:new Date}},{label:"All Time",range:{from:void 0,to:new Date}}]}),i&&e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:["Updated ",i]}),e.jsx(H,{variant:"outline",size:"sm",className:"gap-2 h-8",onClick:l,disabled:r,children:e.jsx($e,{className:`w-3.5 h-3.5 ${r?"animate-spin":""}`})})]})]})}function rs({data:s,isLoading:t,granularity:a="daily",className:l}){const{privacyMode:r}=M(),i=f.useMemo(()=>!s||s.length===0?[]:(a==="hourly"?s:[...s].reverse()).map(c=>{const x="hour"in c?c.hour:c.date;return{...c,dateFormatted:ns(x,a),costRounded:Number(c.cost.toFixed(4))}}),[s,a]);if(t)return e.jsx(h,{className:d("h-full w-full",l)});if(!s||s.length===0)return e.jsx("div",{className:d("h-full flex items-center justify-center",l),children:e.jsx("p",{className:"text-muted-foreground",children:a==="hourly"?"No usage data for today":"No usage data available"})});const o=({x:n,y:c,payload:x,isRight:u})=>{const m=u?`$${x.value}`:X(Number(x.value));return e.jsx("text",{x:n,y:c,dy:4,textAnchor:u?"start":"end",fontSize:12,fill:"currentColor",className:d("fill-muted-foreground",r&&"blur-[4px]"),children:m})};return e.jsx("div",{className:d("w-full h-full",l),children:e.jsx(ie,{width:"100%",height:"100%",children:e.jsxs(Be,{data:i,margin:{top:5,right:30,left:20,bottom:5},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"tokenGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#0080FF",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#0080FF",stopOpacity:.1})]}),e.jsxs("linearGradient",{id:"costGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#00C49F",stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:"#00C49F",stopOpacity:.1})]})]}),e.jsx(Ue,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(qe,{dataKey:"dateFormatted",tick:{fontSize:12},tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"left",orientation:"left",tick:n=>e.jsx(o,{...n,isRight:!1}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(V,{yAxisId:"right",orientation:"right",tick:n=>e.jsx(o,{...n,isRight:!0}),tickLine:!1,axisLine:{className:"stroke-muted"}}),e.jsx(oe,{content:({active:n,payload:c,label:x})=>{if(!n||!c||!c.length)return null;const u=c[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-3 shadow-lg",children:[e.jsx("p",{className:"font-medium mb-2",children:x}),c.map((m,j)=>e.jsxs("p",{className:d("text-sm",r&&y),style:{color:m.color},children:[m.name,":"," ",m.name==="Tokens"?X(Number(m.value)||0):`$${m.value}`]},j)),"requests"in u&&e.jsxs("p",{className:d("text-sm text-muted-foreground mt-1",r&&y),children:["Requests: ",u.requests]})]})}}),e.jsx(Z,{yAxisId:"left",type:"monotone",dataKey:"tokens",stroke:"#0080FF",strokeWidth:2,fillOpacity:1,fill:"url(#tokenGradient)",name:"Tokens"}),e.jsx(Z,{yAxisId:"right",type:"monotone",dataKey:"costRounded",stroke:"#00C49F",strokeWidth:2,fillOpacity:1,fill:"url(#costGradient)",name:"Cost"})]})})})}function ns(s,t){if(t==="hourly"){const[l,r]=s.split(" ");if(l&&r){const i=new Date(`${l}T${r}:00Z`);return k(i,"HH:mm")}return s}const a=new Date(s);return t==="monthly"?k(a,"MMM yyyy"):k(a,"MMM dd")}function X(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function ls({data:s,isLoading:t,className:a}){const{privacyMode:l}=M(),r=f.useMemo(()=>!s||s.length===0?[]:s.map(n=>({name:n.model,value:n.tokens,cost:n.cost,percentage:n.percentage,fill:te(n.model)})),[s]);if(t)return e.jsx(h,{className:d("h-[300px] w-full",a)});if(!s||s.length===0)return e.jsx("div",{className:d("h-[300px] flex items-center justify-center",a),children:e.jsx("p",{className:"text-muted-foreground",children:"No model data available"})});const i=({active:n,payload:c})=>{if(!n||!c)return null;const x=c;if(!x.length)return null;const u=x[0].payload;return e.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-lg text-xs",children:[e.jsx("p",{className:"font-medium mb-1",children:u.name}),e.jsxs("p",{className:d("text-muted-foreground",l&&y),children:[is(u.value)," (",u.percentage.toFixed(1),"%)"]}),e.jsxs("p",{className:d("text-muted-foreground",l&&y),children:["$",u.cost.toFixed(4)]})]})},o=n=>n.percentage>5?`${n.percentage.toFixed(1)}%`:"";return e.jsx("div",{className:d("w-full",a),children:e.jsx(ie,{width:"100%",height:250,children:e.jsxs(Ie,{children:[e.jsx(Oe,{data:r,cx:"50%",cy:"50%",labelLine:!1,label:o,innerRadius:50,outerRadius:70,paddingAngle:2,dataKey:"value",children:r.map((n,c)=>e.jsx(Ke,{fill:n.fill,strokeWidth:1},`cell-${c}`))}),e.jsx(oe,{content:i})]})})})}function is(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function os({data:s,isLoading:t,className:a}){const{privacyMode:l}=M(),r=f.useMemo(()=>{if(!s?.sessions||s.sessions.length===0)return null;const i=s.sessions,o=s.total,n=i.reduce((b,v)=>b+(v.inputTokens+v.outputTokens),0),c=Math.round(n/i.length),u=i.reduce((b,v)=>b+v.cost,0)/i.length,m=i[0],j=m?Q(new Date(m.lastActivity),{addSuffix:!0}):"N/A";return{totalSessions:o,avgTokens:c,avgCost:u,lastActive:j,recentSessions:i.slice(0,3)}},[s]);return t?e.jsxs(p,{className:d("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsx(h,{className:"h-5 w-32"})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}):r?e.jsxs(p,{className:d("flex flex-col h-full shadow-sm",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsxs(g,{className:"px-3 pb-3 pt-0 flex-1 flex flex-col gap-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-blue-600 dark:text-blue-400",children:[e.jsx(Se,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xl font-bold",children:r.totalSessions})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Total Sessions"})]}),e.jsxs("div",{className:"p-2 rounded-md bg-muted/50 border text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(le,{className:"w-4 h-4"}),e.jsxs("span",{className:d("text-xl font-bold",l&&y),children:["$",r.avgCost.toFixed(2)]})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:"Avg Cost/Session"})]})]}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground font-medium mb-1",children:[e.jsx(Le,{className:"w-3 h-3"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-1.5",children:r.recentSessions.map(i=>e.jsxs("div",{className:"flex items-center justify-between text-xs p-1.5 rounded bg-muted/30 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium truncate",title:i.projectPath,children:i.projectPath.split("/").pop()}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:Q(new Date(i.lastActivity),{addSuffix:!0})})]}),e.jsxs("div",{className:d("text-right shrink-0 ml-2",l&&y),children:[e.jsxs("div",{className:"font-mono",children:["$",i.cost.toFixed(2)]}),e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[cs(i.inputTokens+i.outputTokens)," toks"]})]})]},i.sessionId))})]})]})]}):e.jsxs(p,{className:d("flex flex-col h-full",a),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),"Session Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"No session data available"})})]})}function cs(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function ds({className:s,isLoading:t}){const{data:a,isLoading:l}=je(),{data:r,isLoading:i,error:o}=Ne(a?.running);if(t||l||a?.running&&i)return e.jsxs(p,{className:d("flex flex-col h-full",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(h,{className:"h-4 w-[100px]"}),e.jsx(h,{className:"h-16 w-full"})]})})]});if(!a?.running)return e.jsxs(p,{className:d("flex flex-col h-full border-dashed",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"secondary",className:"text-[10px] h-5",children:"Offline"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 flex items-center justify-center",children:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Start a CLIProxy session (gemini, codex, agy) to collect stats."})})]});if(o)return e.jsxs(p,{className:d("flex flex-col h-full border-destructive/50",s),children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsx(I,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1",children:e.jsx("p",{className:"text-xs text-destructive",children:o.message})})]});const c=r?.totalRequests??0,x=r?.quotaExceededCount??0,u=c-x,m=c>0?Math.round(u/c*100):100,j=r?.tokens?.total??0,b=Object.entries(r?.requestsByModel??{}).sort((C,$)=>$[1]-C[1]).slice(0,4),v=b.length>0?b[0][1]:1;return e.jsxs(p,{className:d("flex flex-col h-full overflow-hidden",s),children:[e.jsx(N,{className:"px-3 py-2 border-b bg-muted/5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"CLIProxy Stats"]}),e.jsxs(I,{variant:"outline",className:"text-[10px] h-5 text-green-600 border-green-200 bg-green-50 dark:bg-green-900/10 dark:border-green-800",children:[e.jsx(le,{className:"h-3 w-3 mr-0.5"}),"Running"]})]})}),e.jsx(g,{className:"p-0 flex-1 min-h-0",children:e.jsx(ye,{className:"h-full",children:e.jsxs("div",{className:"p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("svg",{className:"w-10 h-10 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",className:"text-muted/30"}),e.jsx("circle",{cx:"18",cy:"18",r:"14",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:`${m*.88} 88`,strokeLinecap:"round",className:m>=90?"text-green-500":"text-amber-500"})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[8px] font-bold",children:[m,"%"]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(c)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:x>0?`${x} failed`:"All success"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-muted/30",children:[e.jsx("div",{className:"p-1.5 rounded-md bg-purple-100 dark:bg-purple-900/20",children:e.jsx(De,{className:"h-4 w-4 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:J(j)}),e.jsx("div",{className:"text-[9px] text-muted-foreground mt-0.5",children:"Total tokens"})]})]})]}),b.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-medium text-muted-foreground",children:[e.jsx(Te,{className:"h-3 w-3"}),"Models Used"]}),e.jsx("div",{className:"space-y-1",children:b.map(([C,$])=>{const A=Math.round($/v*100),B=xs(C);return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] mb-0.5",children:[e.jsx("span",{className:"truncate font-medium",title:C,children:B}),e.jsx("span",{className:"text-muted-foreground shrink-0 ml-2",children:$})]}),e.jsx("div",{className:"h-1 bg-muted/50 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent/70 rounded-full transition-all",style:{width:`${A}%`}})})]},C)})})]})]})})})]})}function J(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString()}function xs(s){let t=s.replace(/^gemini-claude-/,"").replace(/^gemini-/,"").replace(/^claude-/,"").replace(/^anthropic\./,"").replace(/-thinking$/," Thinking");return t=t.split(/[-_]/).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),t.length>20&&(t=t.slice(0,18)+"..."),t}function us(s){return s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(0)}K`:s.toString()}function ms({models:s,isLoading:t,onModelClick:a,privacyMode:l}){return e.jsxs(p,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-4",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4"}),"Cost by Model"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 overflow-y-auto",children:t?e.jsx(h,{className:"h-full w-full"}):e.jsxs("div",{className:"space-y-0.5",children:[[...s||[]].sort((r,i)=>i.cost-r.cost).map(r=>e.jsxs("button",{className:"group flex items-center text-xs w-full hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer gap-3",onClick:i=>a(r,i),title:"Click for details",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 w-[180px] shrink-0",children:[e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:te(r.model)}}),e.jsx("span",{className:"font-medium truncate group-hover:underline underline-offset-2",children:r.model})]}),e.jsx(hs,{model:r}),e.jsx("span",{className:d("text-[10px] text-muted-foreground w-14 text-right shrink-0",l&&y),children:us(r.tokens)}),e.jsxs("span",{className:d("font-mono font-medium w-16 text-right shrink-0",l&&y),children:["$",r.cost.toFixed(2)]}),e.jsx(Fe,{className:"w-3 h-3 opacity-0 group-hover:opacity-50 transition-opacity shrink-0"})]},r.model)),e.jsx(fs,{})]})})]})}function hs({model:s}){const t={input:"#335c67",output:"#fff3b0",cacheWrite:"#e09f3e",cacheRead:"#9e2a2b"},a=l=>s.cost>0?l/s.cost*100:0;return e.jsx("div",{className:"flex-1 flex items-center gap-1 min-w-0",children:e.jsxs("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full",style:{backgroundColor:t.input,width:`${a(s.costBreakdown.input.cost)}%`},title:`Input: $${s.costBreakdown.input.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.output,width:`${a(s.costBreakdown.output.cost)}%`},title:`Output: $${s.costBreakdown.output.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheWrite,width:`${a(s.costBreakdown.cacheCreation.cost)}%`},title:`Cache Write: $${s.costBreakdown.cacheCreation.cost.toFixed(2)}`}),e.jsx("div",{className:"h-full",style:{backgroundColor:t.cacheRead,width:`${a(s.costBreakdown.cacheRead.cost)}%`},title:`Cache Read: $${s.costBreakdown.cacheRead.cost.toFixed(2)}`})]})})}function fs(){const s=[{color:"#335c67",label:"Input"},{color:"#fff3b0",label:"Output",hasBorder:!0},{color:"#e09f3e",label:"Cache Write"},{color:"#9e2a2b",label:"Cache Read"}];return e.jsx("div",{className:"flex items-center gap-3 pt-2 px-2 text-[10px] text-muted-foreground border-t mt-2",children:s.map(({color:t,label:a,hasBorder:l})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("div",{className:d("w-2 h-2 rounded-full",l&&"border border-muted-foreground/30"),style:{backgroundColor:t}}),a]},a))})}function ps({viewMode:s,trends:t,hourlyData:a,models:l,sessions:r,isTrendsLoading:i,isHourlyLoading:o,isModelsLoading:n,isSessionsLoading:c,isSummaryLoading:x,onModelClick:u}){const{privacyMode:m}=M();return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 gap-4",children:[e.jsxs(p,{className:"flex flex-col flex-1 min-h-0 max-h-[500px] overflow-hidden shadow-sm",children:[e.jsx(N,{className:"px-3 py-2 shrink-0",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Re,{className:"w-4 h-4"}),s==="hourly"?"Last 24 Hours":"Usage Trends"]})}),e.jsx(g,{className:"px-3 pb-3 pt-0 flex-1 min-h-0",children:e.jsx(rs,{data:s==="hourly"?a||[]:t||[],isLoading:s==="hourly"?o:i,granularity:s==="hourly"?"hourly":"daily"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-10 gap-4 h-auto lg:h-[180px] shrink-0",children:[e.jsx(ms,{models:l,isLoading:n,onModelClick:u,privacyMode:m}),e.jsxs(p,{className:"flex flex-col h-full min-h-0 shadow-sm lg:col-span-2",children:[e.jsx(N,{className:"px-3 py-2",children:e.jsxs(S,{className:"text-base font-semibold flex items-center gap-2",children:[e.jsx(Me,{className:"w-4 h-4"}),"Model Usage"]})}),e.jsx(g,{className:"px-2 pb-2 pt-0 flex-1 min-h-0 flex items-center justify-center",children:e.jsx(ls,{data:l||[],isLoading:n,className:"h-full w-full"})})]}),e.jsx(os,{data:r,isLoading:c,className:"lg:col-span-2"}),e.jsx(ds,{isLoading:x,className:"lg:col-span-2"})]})]})}function Ls(){return e.jsxs("div",{className:"space-y-4 h-full overflow-hidden",children:[e.jsxs(p,{className:"flex flex-col min-h-[300px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-32"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsx(h,{className:"h-full w-full"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-2",children:e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2.5 h-2.5 rounded-full"}),e.jsx(h,{className:"h-3 w-24"})]}),e.jsx(h,{className:"h-3 w-16"})]},s))})})]}),e.jsxs(p,{className:"flex flex-col min-h-[250px]",children:[e.jsx(N,{className:"p-4 pb-2",children:e.jsx(h,{className:"h-4 w-28"})}),e.jsx(g,{className:"p-4 pt-0 flex-1",children:e.jsxs("div",{className:"flex w-full h-full items-center",children:[e.jsx("div",{className:"flex-1 flex justify-center",children:e.jsx(h,{className:"h-[180px] w-[180px] rounded-full"})}),e.jsx("div",{className:"w-[140px] shrink-0 pl-2 space-y-2",children:[1,2,3,4].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"w-2 h-2 rounded-full"}),e.jsx(h,{className:"h-3 w-20"})]},s))})]})})]})]})]})}function Ds(){const s=f.useRef(null),{dateRange:t,handleDateRangeChange:a,handleTodayClick:l,handleRefresh:r,isRefreshing:i,lastUpdatedText:o,viewMode:n,summary:c,isSummaryLoading:x,trends:u,hourlyData:m,models:j,sessions:b,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:$,isSessionsLoading:A,handleModelClick:B,selectedModel:U,popoverPosition:q,handlePopoverClose:_}=ss();return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden px-4 pt-4 pb-50 gap-4",children:[e.jsx(as,{dateRange:t,onDateRangeChange:a,onTodayClick:l,onRefresh:r,isRefreshing:i,lastUpdatedText:o,viewMode:n}),e.jsx(Ee,{data:c,isLoading:x}),e.jsx(ps,{viewMode:n,trends:u,hourlyData:m,models:j,sessions:b,isTrendsLoading:v,isHourlyLoading:C,isModelsLoading:$,isSessionsLoading:A,isSummaryLoading:x,onModelClick:B}),e.jsxs(ee,{open:!!U,onOpenChange:O=>!O&&_(),children:[e.jsx(be,{asChild:!0,children:e.jsx("div",{ref:s,className:"fixed pointer-events-none",style:{left:q?.x??0,top:q?.y??0,width:1,height:1}})}),e.jsx(se,{className:"w-80 p-3",side:"top",align:"center",children:U&&e.jsx(Ge,{model:U})})]})]})}export{Ds as AnalyticsPage,Ls as AnalyticsSkeleton};
|
|
@@ -48,4 +48,4 @@ You can add a description to the \`${Ke}\` by passing a \`${Os}\` component as a
|
|
|
48
48
|
|
|
49
49
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ke}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
50
50
|
|
|
51
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},_h=Rs,Ih=Ps,Oh=As,Mh=Ts,Dh=Ds,Nh=Ls,Lh=Is,jh=Ms;function qo(e){const t=kd(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Fd);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function kd(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Bd(r),c=Wd(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $d=Symbol("radix.slottable");function Fd(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$d}function Wd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function uo(e){const t=e+"CollectionProvider",[n,o]=Q(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:g,children:y}=v,x=Ne.useRef(null),b=Ne.useRef(new Map).current;return p.jsx(r,{scope:g,itemMap:b,collectionRef:x,children:y})};a.displayName=t;const c=e+"CollectionSlot",l=qo(c),u=Ne.forwardRef((v,g)=>{const{scope:y,children:x}=v,b=s(c,y),C=j(g,b.collectionRef);return p.jsx(l,{ref:C,children:x})});u.displayName=c;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=qo(d),m=Ne.forwardRef((v,g)=>{const{scope:y,children:x,...b}=v,C=Ne.useRef(null),S=j(g,C),A=s(d,y);return Ne.useEffect(()=>(A.itemMap.set(C,{ref:C,...b}),()=>void A.itemMap.delete(C))),p.jsx(h,{[f]:"",ref:S,children:x})});m.displayName=d;function w(v){const g=s(e+"CollectionConsumer",v);return Ne.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((A,E)=>b.indexOf(A.ref.current)-b.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:u,ItemSlot:m},w,o]}var An="rovingFocusGroup.onEntryFocus",Vd={bubbles:!1,cancelable:!0},mt="RovingFocusGroup",[jn,js,Hd]=uo(mt),[Ud,on]=Q(mt,[Hd]),[Gd,Kd]=Ud(mt),ks=i.forwardRef((e,t)=>p.jsx(jn.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(jn.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(zd,{...e,ref:t})})}));ks.displayName=mt;var zd=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=i.useRef(null),m=j(t,h),w=vt(s),[v,g]=me({prop:a,defaultProp:c??null,onChange:l,caller:mt}),[y,x]=i.useState(!1),b=X(u),C=js(n),S=i.useRef(!1),[A,E]=i.useState(0);return i.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(An,b),()=>_.removeEventListener(An,b)},[b]),p.jsx(Gd,{scope:n,orientation:o,dir:w,loop:r,currentTabStopId:v,onItemFocus:i.useCallback(_=>g(_),[g]),onItemShiftTab:i.useCallback(()=>x(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(_=>_+1),[]),onFocusableItemRemove:i.useCallback(()=>E(_=>_-1),[]),children:p.jsx(D.div,{tabIndex:y||A===0?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{S.current=!0}),onFocus:R(e.onFocus,_=>{const I=!S.current;if(_.target===_.currentTarget&&I&&!y){const O=new CustomEvent(An,Vd);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=C().filter(N=>N.focusable),$=L.find(N=>N.active),F=L.find(N=>N.id===v),B=[$,F,...L].filter(Boolean).map(N=>N.ref.current);Ws(B,d)}}S.current=!1}),onBlur:R(e.onBlur,()=>x(!1))})})}),$s="RovingFocusGroupItem",Fs=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...c}=e,l=ne(),u=s||l,d=Kd($s,n),f=d.currentTabStopId===u,h=js(n),{onFocusableItemAdd:m,onFocusableItemRemove:w,currentTabStopId:v}=d;return i.useEffect(()=>{if(o)return m(),()=>w()},[o,m,w]),p.jsx(jn.ItemSlot,{scope:n,id:u,focusable:o,active:r,children:p.jsx(D.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:R(e.onMouseDown,g=>{o?d.onItemFocus(u):g.preventDefault()}),onFocus:R(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:R(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=qd(g,d.orientation,d.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=h().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const C=b.indexOf(g.currentTarget);b=d.loop?Zd(b,C+1):b.slice(C+1)}setTimeout(()=>Ws(b))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:v!=null}):a})})});Fs.displayName=$s;var Yd={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xd(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qd(e,t,n){const o=Xd(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Yd[o]}function Ws(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Zd(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Bs=ks,Vs=Fs,rn="Tabs",[Jd]=Q(rn,[on]),Hs=on(),[Qd,fo]=Jd(rn),Us=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:c,activationMode:l="automatic",...u}=e,d=vt(c),[f,h]=me({prop:o,onChange:r,defaultProp:s??"",caller:rn});return p.jsx(Qd,{scope:n,baseId:ne(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:l,children:p.jsx(D.div,{dir:d,"data-orientation":a,...u,ref:t})})});Us.displayName=rn;var Gs="TabsList",Ks=i.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,s=fo(Gs,n),a=Hs(n);return p.jsx(Bs,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:o,children:p.jsx(D.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:t})})});Ks.displayName=Gs;var zs="TabsTrigger",Ys=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...s}=e,a=fo(zs,n),c=Hs(n),l=Zs(a.baseId,o),u=Js(a.baseId,o),d=o===a.value;return p.jsx(Vs,{asChild:!0,...c,focusable:!r,active:d,children:p.jsx(D.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...s,ref:t,onMouseDown:R(e.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?a.onValueChange(o):f.preventDefault()}),onKeyDown:R(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(o)}),onFocus:R(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!r&&f&&a.onValueChange(o)})})})});Ys.displayName=zs;var Xs="TabsContent",qs=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:s,...a}=e,c=fo(Xs,n),l=Zs(c.baseId,o),u=Js(c.baseId,o),d=o===c.value,f=i.useRef(d);return i.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(Y,{present:r||d,children:({present:h})=>p.jsx(D.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});qs.displayName=Xs;function Zs(e,t){return`${e}-trigger-${t}`}function Js(e,t){return`${e}-content-${t}`}var kh=Us,$h=Ks,Fh=Ys,Wh=qs,ef=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tf=ef.reduce((e,t)=>{const n=Un(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),nf="Label",Qs=i.forwardRef((e,t)=>p.jsx(tf.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Qs.displayName=nf;var Bh=Qs;function of(e){const t=rf(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(af);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function rf(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=lf(r),c=cf(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sf=Symbol("radix.slottable");function af(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sf}function cf(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function lf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ei(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uf=[" ","Enter","ArrowUp","ArrowDown"],df=[" ","Enter"],ke="Select",[sn,an,ff]=uo(ke),[tt]=Q(ke,[ff,_e]),cn=_e(),[pf,Ie]=tt(ke),[hf,vf]=tt(ke),ti=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:a,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:m,form:w}=e,v=cn(t),[g,y]=i.useState(null),[x,b]=i.useState(null),[C,S]=i.useState(!1),A=vt(u),[E,_]=me({prop:o,defaultProp:r??!1,onChange:s,caller:ke}),[I,O]=me({prop:a,defaultProp:c,onChange:l,caller:ke}),L=i.useRef(null),$=g?w||!!g.closest("form"):!0,[F,k]=i.useState(new Set),B=Array.from(F).map(N=>N.props.value).join(";");return p.jsx(Xt,{...v,children:p.jsxs(pf,{required:m,scope:t,trigger:g,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:ne(),value:I,onValueChange:O,open:E,onOpenChange:_,dir:A,triggerPointerDownPosRef:L,disabled:h,children:[p.jsx(sn.Provider,{scope:t,children:p.jsx(hf,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(N=>{k(W=>new Set(W).add(N))},[]),onNativeOptionRemove:i.useCallback(N=>{k(W=>{const M=new Set(W);return M.delete(N),M})},[]),children:n})}),$?p.jsxs(Pi,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:I,onChange:N=>O(N.target.value),disabled:h,form:w,children:[I===void 0?p.jsx("option",{value:""}):null,Array.from(F)]},B):null]})})};ti.displayName=ke;var ni="SelectTrigger",oi=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=cn(n),a=Ie(ni,n),c=a.disabled||o,l=j(t,a.onTriggerChange),u=an(n),d=i.useRef("touch"),[f,h,m]=Ti(v=>{const g=u().filter(b=>!b.disabled),y=g.find(b=>b.value===a.value),x=_i(g,v,y);x!==void 0&&a.onValueChange(x.value)}),w=v=>{c||(a.onOpenChange(!0),m()),v&&(a.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(pt,{asChild:!0,...s,children:p.jsx(D.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Ai(a.value)?"":void 0,...r,ref:l,onClick:R(r.onClick,v=>{v.currentTarget.focus(),d.current!=="mouse"&&w(v)}),onPointerDown:R(r.onPointerDown,v=>{d.current=v.pointerType;const g=v.target;g.hasPointerCapture(v.pointerId)&&g.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(w(v),v.preventDefault())}),onKeyDown:R(r.onKeyDown,v=>{const g=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(g&&v.key===" ")&&uf.includes(v.key)&&(w(),v.preventDefault())})})})});oi.displayName=ni;var ri="SelectValue",si=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:a="",...c}=e,l=Ie(ri,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=j(t,l.onValueNodeChange);return z(()=>{u(d)},[u,d]),p.jsx(D.span,{...c,ref:f,style:{pointerEvents:"none"},children:Ai(l.value)?p.jsx(p.Fragment,{children:a}):s})});si.displayName=ri;var mf="SelectIcon",ii=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return p.jsx(D.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});ii.displayName=mf;var gf="SelectPortal",ai=e=>p.jsx(Je,{asChild:!0,...e});ai.displayName=gf;var $e="SelectContent",ci=i.forwardRef((e,t)=>{const n=Ie($e,e.__scopeSelect),[o,r]=i.useState();if(z(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?Wt.createPortal(p.jsx(li,{scope:e.__scopeSelect,children:p.jsx(sn.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(ui,{...e,ref:t})});ci.displayName=$e;var le=10,[li,Oe]=tt($e),wf="SelectContentImpl",yf=of("SelectContent.RemoveScroll"),ui=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:a,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:v,avoidCollisions:g,...y}=e,x=Ie($e,n),[b,C]=i.useState(null),[S,A]=i.useState(null),E=j(t,T=>C(T)),[_,I]=i.useState(null),[O,L]=i.useState(null),$=an(n),[F,k]=i.useState(!1),B=i.useRef(!1);i.useEffect(()=>{if(b)return Ht(b)},[b]),Bt();const N=i.useCallback(T=>{const[V,...Z]=$().map(K=>K.ref.current),[H]=Z.slice(-1),U=document.activeElement;for(const K of T)if(K===U||(K?.scrollIntoView({block:"nearest"}),K===V&&S&&(S.scrollTop=0),K===H&&S&&(S.scrollTop=S.scrollHeight),K?.focus(),document.activeElement!==U))return},[$,S]),W=i.useCallback(()=>N([_,b]),[N,_,b]);i.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:M,triggerPointerDownPosRef:P}=x;i.useEffect(()=>{if(b){let T={x:0,y:0};const V=H=>{T={x:Math.abs(Math.round(H.pageX)-(P.current?.x??0)),y:Math.abs(Math.round(H.pageY)-(P.current?.y??0))}},Z=H=>{T.x<=10&&T.y<=10?H.preventDefault():b.contains(H.target)||M(!1),document.removeEventListener("pointermove",V),P.current=null};return P.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",Z,{capture:!0})}}},[b,M,P]),i.useEffect(()=>{const T=()=>M(!1);return window.addEventListener("blur",T),window.addEventListener("resize",T),()=>{window.removeEventListener("blur",T),window.removeEventListener("resize",T)}},[M]);const[G,q]=Ti(T=>{const V=$().filter(U=>!U.disabled),Z=V.find(U=>U.ref.current===document.activeElement),H=_i(V,T,Z);H&&setTimeout(()=>H.ref.current.focus())}),ce=i.useCallback((T,V,Z)=>{const H=!B.current&&!Z;(x.value!==void 0&&x.value===V||H)&&(I(T),H&&(B.current=!0))},[x.value]),be=i.useCallback(()=>b?.focus(),[b]),re=i.useCallback((T,V,Z)=>{const H=!B.current&&!Z;(x.value!==void 0&&x.value===V||H)&&L(T)},[x.value]),Ce=o==="popper"?kn:di,ee=Ce===kn?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:v,avoidCollisions:g}:{};return p.jsx(li,{scope:n,content:b,viewport:S,onViewportChange:A,itemRefCallback:ce,selectedItem:_,onItemLeave:be,itemTextRefCallback:re,focusSelectedItem:W,selectedItemText:O,position:o,isPositioned:F,searchRef:G,children:p.jsx(dt,{as:yf,allowPinchZoom:!0,children:p.jsx(ut,{asChild:!0,trapped:x.open,onMountAutoFocus:T=>{T.preventDefault()},onUnmountAutoFocus:R(r,T=>{x.trigger?.focus({preventScroll:!0}),T.preventDefault()}),children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:T=>T.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:p.jsx(Ce,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:T=>T.preventDefault(),...y,...ee,onPlaced:()=>k(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:R(y.onKeyDown,T=>{const V=T.ctrlKey||T.altKey||T.metaKey;if(T.key==="Tab"&&T.preventDefault(),!V&&T.key.length===1&&q(T.key),["ArrowUp","ArrowDown","Home","End"].includes(T.key)){let H=$().filter(U=>!U.disabled).map(U=>U.ref.current);if(["ArrowUp","End"].includes(T.key)&&(H=H.slice().reverse()),["ArrowUp","ArrowDown"].includes(T.key)){const U=T.target,K=H.indexOf(U);H=H.slice(K+1)}setTimeout(()=>N(H)),T.preventDefault()}})})})})})})});ui.displayName=wf;var xf="SelectItemAlignedPosition",di=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=Ie($e,n),a=Oe($e,n),[c,l]=i.useState(null),[u,d]=i.useState(null),f=j(t,E=>d(E)),h=an(n),m=i.useRef(!1),w=i.useRef(!0),{viewport:v,selectedItem:g,selectedItemText:y,focusSelectedItem:x}=a,b=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&v&&g&&y){const E=s.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(s.dir!=="rtl"){const U=O.left-_.left,K=I.left-U,se=E.left-K,De=E.width+se,hn=Math.max(De,_.width),vn=window.innerWidth-le,mn=Ln(K,[le,Math.max(le,vn-hn)]);c.style.minWidth=De+"px",c.style.left=mn+"px"}else{const U=_.right-O.right,K=window.innerWidth-I.right-U,se=window.innerWidth-E.right-K,De=E.width+se,hn=Math.max(De,_.width),vn=window.innerWidth-le,mn=Ln(K,[le,Math.max(le,vn-hn)]);c.style.minWidth=De+"px",c.style.right=mn+"px"}const L=h(),$=window.innerHeight-le*2,F=v.scrollHeight,k=window.getComputedStyle(u),B=parseInt(k.borderTopWidth,10),N=parseInt(k.paddingTop,10),W=parseInt(k.borderBottomWidth,10),M=parseInt(k.paddingBottom,10),P=B+N+F+M+W,G=Math.min(g.offsetHeight*5,P),q=window.getComputedStyle(v),ce=parseInt(q.paddingTop,10),be=parseInt(q.paddingBottom,10),re=E.top+E.height/2-le,Ce=$-re,ee=g.offsetHeight/2,T=g.offsetTop+ee,V=B+N+T,Z=P-V;if(V<=re){const U=L.length>0&&g===L[L.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-v.offsetTop-v.offsetHeight,se=Math.max(Ce,ee+(U?be:0)+K+W),De=V+se;c.style.height=De+"px"}else{const U=L.length>0&&g===L[0].ref.current;c.style.top="0px";const se=Math.max(re,B+v.offsetTop+(U?ce:0)+ee)+Z;c.style.height=se+"px",v.scrollTop=V-re+v.offsetTop}c.style.margin=`${le}px 0`,c.style.minHeight=G+"px",c.style.maxHeight=$+"px",o?.(),requestAnimationFrame(()=>m.current=!0)}},[h,s.trigger,s.valueNode,c,u,v,g,y,s.dir,o]);z(()=>b(),[b]);const[C,S]=i.useState();z(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const A=i.useCallback(E=>{E&&w.current===!0&&(b(),x?.(),w.current=!1)},[b,x]);return p.jsx(Cf,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:A,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:p.jsx(D.div,{...r,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});di.displayName=xf;var bf="SelectPopperPosition",kn=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=le,...s}=e,a=cn(n);return p.jsx(qt,{...a,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});kn.displayName=bf;var[Cf,po]=tt($e,{}),$n="SelectViewport",fi=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=Oe($n,n),a=po($n,n),c=j(t,s.onViewportChange),l=i.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(sn.Slot,{scope:n,children:p.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:R(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const m=Math.abs(l.current-d.scrollTop);if(m>0){const w=window.innerHeight-le*2,v=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(v,g);if(y<w){const x=y+m,b=Math.min(w,x),C=x-b;f.style.height=b+"px",f.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});fi.displayName=$n;var pi="SelectGroup",[Sf,Ef]=tt(pi),hi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=ne();return p.jsx(Sf,{scope:n,id:r,children:p.jsx(D.div,{role:"group","aria-labelledby":r,...o,ref:t})})});hi.displayName=pi;var vi="SelectLabel",mi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ef(vi,n);return p.jsx(D.div,{id:r.id,...o,ref:t})});mi.displayName=vi;var kt="SelectItem",[Rf,gi]=tt(kt),wi=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...a}=e,c=Ie(kt,n),l=Oe(kt,n),u=c.value===o,[d,f]=i.useState(s??""),[h,m]=i.useState(!1),w=j(t,x=>l.itemRefCallback?.(x,o,r)),v=ne(),g=i.useRef("touch"),y=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(Rf,{scope:n,value:o,disabled:r,textId:v,isSelected:u,onItemTextChange:i.useCallback(x=>{f(b=>b||(x?.textContent??"").trim())},[]),children:p.jsx(sn.ItemSlot,{scope:n,value:o,disabled:r,textValue:d,children:p.jsx(D.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:w,onFocus:R(a.onFocus,()=>m(!0)),onBlur:R(a.onBlur,()=>m(!1)),onClick:R(a.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:R(a.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:R(a.onPointerDown,x=>{g.current=x.pointerType}),onPointerMove:R(a.onPointerMove,x=>{g.current=x.pointerType,r?l.onItemLeave?.():g.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(a.onPointerLeave,x=>{x.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:R(a.onKeyDown,x=>{l.searchRef?.current!==""&&x.key===" "||(df.includes(x.key)&&y(),x.key===" "&&x.preventDefault())})})})})});wi.displayName=kt;var ot="SelectItemText",yi=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,a=Ie(ot,n),c=Oe(ot,n),l=gi(ot,n),u=vf(ot,n),[d,f]=i.useState(null),h=j(t,y=>f(y),l.onItemTextChange,y=>c.itemTextRefCallback?.(y,l.value,l.disabled)),m=d?.textContent,w=i.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:v,onNativeOptionRemove:g}=u;return z(()=>(v(w),()=>g(w)),[v,g,w]),p.jsxs(p.Fragment,{children:[p.jsx(D.span,{id:l.textId,...s,ref:h}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Wt.createPortal(s.children,a.valueNode):null]})});yi.displayName=ot;var xi="SelectItemIndicator",bi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return gi(xi,n).isSelected?p.jsx(D.span,{"aria-hidden":!0,...o,ref:t}):null});bi.displayName=xi;var Fn="SelectScrollUpButton",Ci=i.forwardRef((e,t)=>{const n=Oe(Fn,e.__scopeSelect),o=po(Fn,e.__scopeSelect),[r,s]=i.useState(!1),a=j(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?p.jsx(Ei,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Ci.displayName=Fn;var Wn="SelectScrollDownButton",Si=i.forwardRef((e,t)=>{const n=Oe(Wn,e.__scopeSelect),o=po(Wn,e.__scopeSelect),[r,s]=i.useState(!1),a=j(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;s(d)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?p.jsx(Ei,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});Si.displayName=Wn;var Ei=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=Oe("SelectScrollButton",n),a=i.useRef(null),c=an(n),l=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>l(),[l]),z(()=>{c().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),p.jsx(D.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:R(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:R(r.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:R(r.onPointerLeave,()=>{l()})})}),Pf="SelectSeparator",Ri=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return p.jsx(D.div,{"aria-hidden":!0,...o,ref:t})});Ri.displayName=Pf;var Bn="SelectArrow",Af=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=cn(n),s=Ie(Bn,n),a=Oe(Bn,n);return s.open&&a.position==="popper"?p.jsx(Zt,{...r,...o,ref:t}):null});Af.displayName=Bn;var Tf="SelectBubbleInput",Pi=i.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=i.useRef(null),s=j(o,r),a=ei(t);return i.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&d){const f=new Event("change",{bubbles:!0});d.call(c,t),c.dispatchEvent(f)}},[a,t]),p.jsx(D.select,{...n,style:{...Jr,...n.style},ref:s,defaultValue:t})});Pi.displayName=Tf;function Ai(e){return e===""||e===void 0}function Ti(e){const t=X(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(a=>{const c=n.current+a;t(c),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function _i(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=_f(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function _f(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Vh=ti,Hh=oi,Uh=si,Gh=ii,Kh=ai,zh=ci,Yh=fi,Xh=hi,qh=mi,Zh=wi,Jh=yi,Qh=bi,ev=Ci,tv=Si,nv=Ri,ln="Switch",[If]=Q(ln),[Of,Mf]=If(ln),Ii=i.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:r,defaultChecked:s,required:a,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=e,[h,m]=i.useState(null),w=j(t,b=>m(b)),v=i.useRef(!1),g=h?d||!!h.closest("form"):!0,[y,x]=me({prop:r,defaultProp:s??!1,onChange:u,caller:ln});return p.jsxs(Of,{scope:n,checked:y,disabled:c,children:[p.jsx(D.button,{type:"button",role:"switch","aria-checked":y,"aria-required":a,"data-state":Ni(y),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:w,onClick:R(e.onClick,b=>{x(C=>!C),g&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})}),g&&p.jsx(Di,{control:h,bubbles:!v.current,name:o,value:l,checked:y,required:a,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});Ii.displayName=ln;var Oi="SwitchThumb",Mi=i.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,r=Mf(Oi,n);return p.jsx(D.span,{"data-state":Ni(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:t})});Mi.displayName=Oi;var Df="SwitchBubbleInput",Di=i.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...r},s)=>{const a=i.useRef(null),c=j(a,s),l=ei(n),u=Vr(t);return i.useEffect(()=>{const d=a.current;if(!d)return;const f=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&m){const w=new Event("click",{bubbles:o});m.call(d,n),d.dispatchEvent(w)}},[l,n,o]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Di.displayName=Df;function Ni(e){return e?"checked":"unchecked"}var ov=Ii,rv=Mi;function Nf(e){const t=Lf(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(kf);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Lf(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Ff(r),c=$f(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jf=Symbol("radix.slottable");function kf(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jf}function $f(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Ff(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vn=["Enter"," "],Wf=["ArrowDown","PageUp","Home"],Li=["ArrowUp","PageDown","End"],Bf=[...Wf,...Li],Vf={ltr:[...Vn,"ArrowRight"],rtl:[...Vn,"ArrowLeft"]},Hf={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gt="Menu",[ct,Uf,Gf]=uo(gt),[Fe,ji]=Q(gt,[Gf,_e,on]),un=_e(),ki=on(),[Kf,We]=Fe(gt),[zf,wt]=Fe(gt),$i=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,c=un(t),[l,u]=i.useState(null),d=i.useRef(!1),f=X(s),h=vt(r);return i.useEffect(()=>{const m=()=>{d.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>d.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),p.jsx(Xt,{...c,children:p.jsx(Kf,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:p.jsx(zf,{scope:t,onClose:i.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:o})})})};$i.displayName=gt;var Yf="MenuAnchor",ho=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=un(n);return p.jsx(pt,{...r,...o,ref:t})});ho.displayName=Yf;var vo="MenuPortal",[Xf,Fi]=Fe(vo,{forceMount:void 0}),Wi=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=We(vo,t);return p.jsx(Xf,{scope:t,forceMount:n,children:p.jsx(Y,{present:n||s.open,children:p.jsx(Je,{asChild:!0,container:r,children:o})})})};Wi.displayName=vo;var ie="MenuContent",[qf,mo]=Fe(ie),Bi=i.forwardRef((e,t)=>{const n=Fi(ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=We(ie,e.__scopeMenu),a=wt(ie,e.__scopeMenu);return p.jsx(ct.Provider,{scope:e.__scopeMenu,children:p.jsx(Y,{present:o||s.open,children:p.jsx(ct.Slot,{scope:e.__scopeMenu,children:a.modal?p.jsx(Zf,{...r,ref:t}):p.jsx(Jf,{...r,ref:t})})})})}),Zf=i.forwardRef((e,t)=>{const n=We(ie,e.__scopeMenu),o=i.useRef(null),r=j(t,o);return i.useEffect(()=>{const s=o.current;if(s)return Ht(s)},[]),p.jsx(go,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jf=i.forwardRef((e,t)=>{const n=We(ie,e.__scopeMenu);return p.jsx(go,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Qf=Nf("MenuContent.ScrollLock"),go=i.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:w,...v}=e,g=We(ie,n),y=wt(ie,n),x=un(n),b=ki(n),C=Uf(n),[S,A]=i.useState(null),E=i.useRef(null),_=j(t,E,g.onContentChange),I=i.useRef(0),O=i.useRef(""),L=i.useRef(0),$=i.useRef(null),F=i.useRef("right"),k=i.useRef(0),B=w?dt:i.Fragment,N=w?{as:Qf,allowPinchZoom:!0}:void 0,W=P=>{const G=O.current+P,q=C().filter(T=>!T.disabled),ce=document.activeElement,be=q.find(T=>T.ref.current===ce)?.textValue,re=q.map(T=>T.textValue),Ce=dp(re,G,be),ee=q.find(T=>T.textValue===Ce)?.ref.current;(function T(V){O.current=V,window.clearTimeout(I.current),V!==""&&(I.current=window.setTimeout(()=>T(""),1e3))})(G),ee&&setTimeout(()=>ee.focus())};i.useEffect(()=>()=>window.clearTimeout(I.current),[]),Bt();const M=i.useCallback(P=>F.current===$.current?.side&&pp(P,$.current?.area),[]);return p.jsx(qf,{scope:n,searchRef:O,onItemEnter:i.useCallback(P=>{M(P)&&P.preventDefault()},[M]),onItemLeave:i.useCallback(P=>{M(P)||(E.current?.focus(),A(null))},[M]),onTriggerLeave:i.useCallback(P=>{M(P)&&P.preventDefault()},[M]),pointerGraceTimerRef:L,onPointerGraceIntentChange:i.useCallback(P=>{$.current=P},[]),children:p.jsx(B,{...N,children:p.jsx(ut,{asChild:!0,trapped:r,onMountAutoFocus:R(s,P=>{P.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:p.jsx(Bs,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:S,onCurrentTabStopIdChange:A,onEntryFocus:R(l,P=>{y.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(qt,{role:"menu","aria-orientation":"vertical","data-state":oa(g.open),"data-radix-menu-content":"",dir:y.dir,...x,...v,ref:_,style:{outline:"none",...v.style},onKeyDown:R(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,ce=P.ctrlKey||P.altKey||P.metaKey,be=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!ce&&be&&W(P.key));const re=E.current;if(P.target!==re||!Bf.includes(P.key))return;P.preventDefault();const ee=C().filter(T=>!T.disabled).map(T=>T.ref.current);Li.includes(P.key)&&ee.reverse(),lp(ee)}),onBlur:R(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(I.current),O.current="")}),onPointerMove:R(e.onPointerMove,lt(P=>{const G=P.target,q=k.current!==P.clientX;if(P.currentTarget.contains(G)&&q){const ce=P.clientX>k.current?"right":"left";F.current=ce,k.current=P.clientX}}))})})})})})})});Bi.displayName=ie;var ep="MenuGroup",wo=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{role:"group",...o,ref:t})});wo.displayName=ep;var tp="MenuLabel",Vi=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{...o,ref:t})});Vi.displayName=tp;var $t="MenuItem",Zo="menu.itemSelect",dn=i.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=i.useRef(null),a=wt($t,e.__scopeMenu),c=mo($t,e.__scopeMenu),l=j(t,s),u=i.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(Zo,{bubbles:!0,cancelable:!0});f.addEventListener(Zo,m=>o?.(m),{once:!0}),er(f,h),h.defaultPrevented?u.current=!1:a.onClose()}};return p.jsx(Hi,{...r,ref:l,disabled:n,onClick:R(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),u.current=!0},onPointerUp:R(e.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||Vn.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});dn.displayName=$t;var Hi=i.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=mo($t,n),c=ki(n),l=i.useRef(null),u=j(t,l),[d,f]=i.useState(!1),[h,m]=i.useState("");return i.useEffect(()=>{const w=l.current;w&&m((w.textContent??"").trim())},[s.children]),p.jsx(ct.ItemSlot,{scope:n,disabled:o,textValue:r??h,children:p.jsx(Vs,{asChild:!0,...c,focusable:!o,children:p.jsx(D.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:R(e.onPointerMove,lt(w=>{o?a.onItemLeave(w):(a.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,lt(w=>a.onItemLeave(w))),onFocus:R(e.onFocus,()=>f(!0)),onBlur:R(e.onBlur,()=>f(!1))})})})}),np="MenuCheckboxItem",Ui=i.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return p.jsx(Xi,{scope:e.__scopeMenu,checked:n,children:p.jsx(dn,{role:"menuitemcheckbox","aria-checked":Ft(n)?"mixed":n,...r,ref:t,"data-state":xo(n),onSelect:R(r.onSelect,()=>o?.(Ft(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ui.displayName=np;var Gi="MenuRadioGroup",[op,rp]=Fe(Gi,{value:void 0,onValueChange:()=>{}}),Ki=i.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=X(o);return p.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:p.jsx(wo,{...r,ref:t})})});Ki.displayName=Gi;var zi="MenuRadioItem",Yi=i.forwardRef((e,t)=>{const{value:n,...o}=e,r=rp(zi,e.__scopeMenu),s=n===r.value;return p.jsx(Xi,{scope:e.__scopeMenu,checked:s,children:p.jsx(dn,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":xo(s),onSelect:R(o.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Yi.displayName=zi;var yo="MenuItemIndicator",[Xi,sp]=Fe(yo,{checked:!1}),qi=i.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=sp(yo,n);return p.jsx(Y,{present:o||Ft(s.checked)||s.checked===!0,children:p.jsx(D.span,{...r,ref:t,"data-state":xo(s.checked)})})});qi.displayName=yo;var ip="MenuSeparator",Zi=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Zi.displayName=ip;var ap="MenuArrow",Ji=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=un(n);return p.jsx(Zt,{...r,...o,ref:t})});Ji.displayName=ap;var cp="MenuSub",[sv,Qi]=Fe(cp),rt="MenuSubTrigger",ea=i.forwardRef((e,t)=>{const n=We(rt,e.__scopeMenu),o=wt(rt,e.__scopeMenu),r=Qi(rt,e.__scopeMenu),s=mo(rt,e.__scopeMenu),a=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},d=i.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return i.useEffect(()=>d,[d]),i.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),p.jsx(ho,{asChild:!0,...u,children:p.jsx(Hi,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":oa(n.open),...e,ref:we(t,r.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,lt(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:R(e.onPointerLeave,lt(f=>{d();const h=n.content?.getBoundingClientRect();if(h){const m=n.content?.dataset.side,w=m==="right",v=w?-5:5,g=h[w?"left":"right"],y=h[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:g,y:h.top},{x:y,y:h.top},{x:y,y:h.bottom},{x:g,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,f=>{const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||Vf[o.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});ea.displayName=rt;var ta="MenuSubContent",na=i.forwardRef((e,t)=>{const n=Fi(ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=We(ie,e.__scopeMenu),a=wt(ie,e.__scopeMenu),c=Qi(ta,e.__scopeMenu),l=i.useRef(null),u=j(t,l);return p.jsx(ct.Provider,{scope:e.__scopeMenu,children:p.jsx(Y,{present:o||s.open,children:p.jsx(ct.Slot,{scope:e.__scopeMenu,children:p.jsx(go,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{a.isUsingKeyboardRef.current&&l.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:R(e.onFocusOutside,d=>{d.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:R(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),h=Hf[a.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),c.trigger?.focus(),d.preventDefault())})})})})})});na.displayName=ta;function oa(e){return e?"open":"closed"}function Ft(e){return e==="indeterminate"}function xo(e){return Ft(e)?"indeterminate":e?"checked":"unchecked"}function lp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function up(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function dp(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=up(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function fp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const c=t[s],l=t[a],u=c.x,d=c.y,f=l.x,h=l.y;d>o!=h>o&&n<(f-u)*(o-d)/(h-d)+u&&(r=!r)}return r}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return fp(n,t)}function lt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=$i,vp=ho,mp=Wi,gp=Bi,wp=wo,yp=Vi,xp=dn,bp=Ui,Cp=Ki,Sp=Yi,Ep=qi,Rp=Zi,Pp=Ji,Ap=ea,Tp=na,fn="DropdownMenu",[_p]=Q(fn,[ji]),J=ji(),[Ip,ra]=_p(fn),sa=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:c=!0}=e,l=J(t),u=i.useRef(null),[d,f]=me({prop:r,defaultProp:s??!1,onChange:a,caller:fn});return p.jsx(Ip,{scope:t,triggerId:ne(),triggerRef:u,contentId:ne(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(h=>!h),[f]),modal:c,children:p.jsx(hp,{...l,open:d,onOpenChange:f,dir:o,modal:c,children:n})})};sa.displayName=fn;var ia="DropdownMenuTrigger",aa=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ra(ia,n),a=J(n);return p.jsx(vp,{asChild:!0,...a,children:p.jsx(D.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:we(t,s.triggerRef),onPointerDown:R(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:R(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});aa.displayName=ia;var Op="DropdownMenuPortal",ca=e=>{const{__scopeDropdownMenu:t,...n}=e,o=J(t);return p.jsx(mp,{...o,...n})};ca.displayName=Op;var la="DropdownMenuContent",ua=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ra(la,n),s=J(n),a=i.useRef(!1);return p.jsx(gp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,c=>{a.current||r.triggerRef.current?.focus(),a.current=!1,c.preventDefault()}),onInteractOutside:R(e.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!r.modal||d)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ua.displayName=la;var Mp="DropdownMenuGroup",Dp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(wp,{...r,...o,ref:t})});Dp.displayName=Mp;var Np="DropdownMenuLabel",Lp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(yp,{...r,...o,ref:t})});Lp.displayName=Np;var jp="DropdownMenuItem",da=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(xp,{...r,...o,ref:t})});da.displayName=jp;var kp="DropdownMenuCheckboxItem",$p=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(bp,{...r,...o,ref:t})});$p.displayName=kp;var Fp="DropdownMenuRadioGroup",Wp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Cp,{...r,...o,ref:t})});Wp.displayName=Fp;var Bp="DropdownMenuRadioItem",Vp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Sp,{...r,...o,ref:t})});Vp.displayName=Bp;var Hp="DropdownMenuItemIndicator",Up=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Ep,{...r,...o,ref:t})});Up.displayName=Hp;var Gp="DropdownMenuSeparator",Kp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Rp,{...r,...o,ref:t})});Kp.displayName=Gp;var zp="DropdownMenuArrow",Yp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Pp,{...r,...o,ref:t})});Yp.displayName=zp;var Xp="DropdownMenuSubTrigger",qp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Ap,{...r,...o,ref:t})});qp.displayName=Xp;var Zp="DropdownMenuSubContent",Jp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Tp,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jp.displayName=Zp;var iv=sa,av=aa,cv=ca,lv=ua,uv=da;function Qp(e){const t=eh(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(nh);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function eh(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=rh(r),c=oh(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var th=Symbol("radix.slottable");function nh(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===th}function oh(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function rh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pn="Popover",[fa]=Q(pn,[_e]),yt=_e(),[sh,Me]=fa(pn),pa=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,c=yt(t),l=i.useRef(null),[u,d]=i.useState(!1),[f,h]=me({prop:o,defaultProp:r??!1,onChange:s,caller:pn});return p.jsx(Xt,{...c,children:p.jsx(sh,{scope:t,contentId:ne(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:i.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>d(!0),[]),onCustomAnchorRemove:i.useCallback(()=>d(!1),[]),modal:a,children:n})})};pa.displayName=pn;var ha="PopoverAnchor",va=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ha,n),s=yt(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:c}=r;return i.useEffect(()=>(a(),()=>c()),[a,c]),p.jsx(pt,{...s,...o,ref:t})});va.displayName=ha;var ma="PopoverTrigger",ga=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ma,n),s=yt(n),a=j(t,r.triggerRef),c=p.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ca(r.open),...o,ref:a,onClick:R(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?c:p.jsx(pt,{asChild:!0,...s,children:c})});ga.displayName=ma;var bo="PopoverPortal",[ih,ah]=fa(bo,{forceMount:void 0}),wa=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=Me(bo,t);return p.jsx(ih,{scope:t,forceMount:n,children:p.jsx(Y,{present:n||s.open,children:p.jsx(Je,{asChild:!0,container:r,children:o})})})};wa.displayName=bo;var qe="PopoverContent",ya=i.forwardRef((e,t)=>{const n=ah(qe,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=Me(qe,e.__scopePopover);return p.jsx(Y,{present:o||s.open,children:s.modal?p.jsx(lh,{...r,ref:t}):p.jsx(uh,{...r,ref:t})})});ya.displayName=qe;var ch=Qp("PopoverContent.RemoveScroll"),lh=i.forwardRef((e,t)=>{const n=Me(qe,e.__scopePopover),o=i.useRef(null),r=j(t,o),s=i.useRef(!1);return i.useEffect(()=>{const a=o.current;if(a)return Ht(a)},[]),p.jsx(dt,{as:ch,allowPinchZoom:!0,children:p.jsx(xa,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,a=>{a.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),uh=i.forwardRef((e,t)=>{const n=Me(qe,e.__scopePopover),o=i.useRef(!1),r=i.useRef(!1);return p.jsx(xa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),xa=i.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,h=Me(qe,n),m=yt(n);return Bt(),p.jsx(ut,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:p.jsx(qt,{"data-state":Ca(h.open),role:"dialog",id:h.contentId,...m,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ba="PopoverClose",dh=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ba,n);return p.jsx(D.button,{type:"button",...o,ref:t,onClick:R(e.onClick,()=>r.onOpenChange(!1))})});dh.displayName=ba;var fh="PopoverArrow",ph=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=yt(n);return p.jsx(Zt,{...r,...o,ref:t})});ph.displayName=fh;function Ca(e){return e?"open":"closed"}var dv=pa,fv=va,pv=ga,hv=wa,vv=ya;export{mh as $,Ch as A,Qh as B,Cl as C,El as D,Jh as E,nv as F,Vh as G,Uh as H,Gh as I,Xh as J,hv as K,$h as L,vv as M,dv as N,bl as O,xl as P,fv as Q,wl as R,vh as S,Sl as T,pv as U,Rh as V,iv as W,av as X,cv as Y,lv as Z,uv as _,_r as a,_h as a0,Mh as a1,Lh as a2,jh as a3,Nh as a4,Dh as a5,Ih as a6,Oh as a7,ov as a8,rv as a9,gh as b,wh as c,yh as d,xh as e,bh as f,Sh as g,ud as h,dd as i,p as j,Eh as k,Th as l,Ph as m,Ah as n,Fh as o,Wh as p,kh as q,Bh as r,Hh as s,ev as t,tv as u,Kh as v,zh as w,Yh as x,qh as y,Zh as z};
|
|
51
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},_h=Rs,Ih=Ps,Oh=As,Mh=Ts,Dh=Ds,Nh=Ls,Lh=Is,jh=Ms;function qo(e){const t=kd(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(Fd);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function kd(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Bd(r),c=Wd(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $d=Symbol("radix.slottable");function Fd(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$d}function Wd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function uo(e){const t=e+"CollectionProvider",[n,o]=Q(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:g,children:y}=v,x=Ne.useRef(null),b=Ne.useRef(new Map).current;return p.jsx(r,{scope:g,itemMap:b,collectionRef:x,children:y})};a.displayName=t;const c=e+"CollectionSlot",l=qo(c),u=Ne.forwardRef((v,g)=>{const{scope:y,children:x}=v,b=s(c,y),C=j(g,b.collectionRef);return p.jsx(l,{ref:C,children:x})});u.displayName=c;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=qo(d),m=Ne.forwardRef((v,g)=>{const{scope:y,children:x,...b}=v,C=Ne.useRef(null),S=j(g,C),A=s(d,y);return Ne.useEffect(()=>(A.itemMap.set(C,{ref:C,...b}),()=>void A.itemMap.delete(C))),p.jsx(h,{[f]:"",ref:S,children:x})});m.displayName=d;function w(v){const g=s(e+"CollectionConsumer",v);return Ne.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(g.itemMap.values()).sort((A,E)=>b.indexOf(A.ref.current)-b.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:u,ItemSlot:m},w,o]}var An="rovingFocusGroup.onEntryFocus",Vd={bubbles:!1,cancelable:!0},mt="RovingFocusGroup",[jn,js,Hd]=uo(mt),[Ud,on]=Q(mt,[Hd]),[Gd,Kd]=Ud(mt),ks=i.forwardRef((e,t)=>p.jsx(jn.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(jn.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(zd,{...e,ref:t})})}));ks.displayName=mt;var zd=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=i.useRef(null),m=j(t,h),w=vt(s),[v,g]=me({prop:a,defaultProp:c??null,onChange:l,caller:mt}),[y,x]=i.useState(!1),b=X(u),C=js(n),S=i.useRef(!1),[A,E]=i.useState(0);return i.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(An,b),()=>_.removeEventListener(An,b)},[b]),p.jsx(Gd,{scope:n,orientation:o,dir:w,loop:r,currentTabStopId:v,onItemFocus:i.useCallback(_=>g(_),[g]),onItemShiftTab:i.useCallback(()=>x(!0),[]),onFocusableItemAdd:i.useCallback(()=>E(_=>_+1),[]),onFocusableItemRemove:i.useCallback(()=>E(_=>_-1),[]),children:p.jsx(D.div,{tabIndex:y||A===0?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{S.current=!0}),onFocus:R(e.onFocus,_=>{const I=!S.current;if(_.target===_.currentTarget&&I&&!y){const O=new CustomEvent(An,Vd);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=C().filter(N=>N.focusable),$=L.find(N=>N.active),F=L.find(N=>N.id===v),B=[$,F,...L].filter(Boolean).map(N=>N.ref.current);Ws(B,d)}}S.current=!1}),onBlur:R(e.onBlur,()=>x(!1))})})}),$s="RovingFocusGroupItem",Fs=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...c}=e,l=ne(),u=s||l,d=Kd($s,n),f=d.currentTabStopId===u,h=js(n),{onFocusableItemAdd:m,onFocusableItemRemove:w,currentTabStopId:v}=d;return i.useEffect(()=>{if(o)return m(),()=>w()},[o,m,w]),p.jsx(jn.ItemSlot,{scope:n,id:u,focusable:o,active:r,children:p.jsx(D.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...c,ref:t,onMouseDown:R(e.onMouseDown,g=>{o?d.onItemFocus(u):g.preventDefault()}),onFocus:R(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:R(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){d.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const y=qd(g,d.orientation,d.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=h().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")b.reverse();else if(y==="prev"||y==="next"){y==="prev"&&b.reverse();const C=b.indexOf(g.currentTarget);b=d.loop?Zd(b,C+1):b.slice(C+1)}setTimeout(()=>Ws(b))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:v!=null}):a})})});Fs.displayName=$s;var Yd={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xd(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qd(e,t,n){const o=Xd(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Yd[o]}function Ws(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Zd(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Bs=ks,Vs=Fs,rn="Tabs",[Jd]=Q(rn,[on]),Hs=on(),[Qd,fo]=Jd(rn),Us=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:c,activationMode:l="automatic",...u}=e,d=vt(c),[f,h]=me({prop:o,onChange:r,defaultProp:s??"",caller:rn});return p.jsx(Qd,{scope:n,baseId:ne(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:l,children:p.jsx(D.div,{dir:d,"data-orientation":a,...u,ref:t})})});Us.displayName=rn;var Gs="TabsList",Ks=i.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,s=fo(Gs,n),a=Hs(n);return p.jsx(Bs,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:o,children:p.jsx(D.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:t})})});Ks.displayName=Gs;var zs="TabsTrigger",Ys=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...s}=e,a=fo(zs,n),c=Hs(n),l=Zs(a.baseId,o),u=Js(a.baseId,o),d=o===a.value;return p.jsx(Vs,{asChild:!0,...c,focusable:!r,active:d,children:p.jsx(D.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...s,ref:t,onMouseDown:R(e.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?a.onValueChange(o):f.preventDefault()}),onKeyDown:R(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(o)}),onFocus:R(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!r&&f&&a.onValueChange(o)})})})});Ys.displayName=zs;var Xs="TabsContent",qs=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:s,...a}=e,c=fo(Xs,n),l=Zs(c.baseId,o),u=Js(c.baseId,o),d=o===c.value,f=i.useRef(d);return i.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(Y,{present:r||d,children:({present:h})=>p.jsx(D.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});qs.displayName=Xs;function Zs(e,t){return`${e}-trigger-${t}`}function Js(e,t){return`${e}-content-${t}`}var kh=Us,$h=Ks,Fh=Ys,Wh=qs,ef=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tf=ef.reduce((e,t)=>{const n=Un(`Primitive.${t}`),o=i.forwardRef((r,s)=>{const{asChild:a,...c}=r,l=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...c,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),nf="Label",Qs=i.forwardRef((e,t)=>p.jsx(tf.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Qs.displayName=nf;var Bh=Qs;function of(e){const t=rf(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(af);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function rf(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=lf(r),c=cf(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sf=Symbol("radix.slottable");function af(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sf}function cf(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function lf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ei(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var uf=[" ","Enter","ArrowUp","ArrowDown"],df=[" ","Enter"],ke="Select",[sn,an,ff]=uo(ke),[tt]=Q(ke,[ff,_e]),cn=_e(),[pf,Ie]=tt(ke),[hf,vf]=tt(ke),ti=e=>{const{__scopeSelect:t,children:n,open:o,defaultOpen:r,onOpenChange:s,value:a,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:m,form:w}=e,v=cn(t),[g,y]=i.useState(null),[x,b]=i.useState(null),[C,S]=i.useState(!1),A=vt(u),[E,_]=me({prop:o,defaultProp:r??!1,onChange:s,caller:ke}),[I,O]=me({prop:a,defaultProp:c,onChange:l,caller:ke}),L=i.useRef(null),$=g?w||!!g.closest("form"):!0,[F,k]=i.useState(new Set),B=Array.from(F).map(N=>N.props.value).join(";");return p.jsx(Xt,{...v,children:p.jsxs(pf,{required:m,scope:t,trigger:g,onTriggerChange:y,valueNode:x,onValueNodeChange:b,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:ne(),value:I,onValueChange:O,open:E,onOpenChange:_,dir:A,triggerPointerDownPosRef:L,disabled:h,children:[p.jsx(sn.Provider,{scope:t,children:p.jsx(hf,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(N=>{k(W=>new Set(W).add(N))},[]),onNativeOptionRemove:i.useCallback(N=>{k(W=>{const M=new Set(W);return M.delete(N),M})},[]),children:n})}),$?p.jsxs(Pi,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:I,onChange:N=>O(N.target.value),disabled:h,form:w,children:[I===void 0?p.jsx("option",{value:""}):null,Array.from(F)]},B):null]})})};ti.displayName=ke;var ni="SelectTrigger",oi=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,s=cn(n),a=Ie(ni,n),c=a.disabled||o,l=j(t,a.onTriggerChange),u=an(n),d=i.useRef("touch"),[f,h,m]=Ti(v=>{const g=u().filter(b=>!b.disabled),y=g.find(b=>b.value===a.value),x=_i(g,v,y);x!==void 0&&a.onValueChange(x.value)}),w=v=>{c||(a.onOpenChange(!0),m()),v&&(a.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(pt,{asChild:!0,...s,children:p.jsx(D.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Ai(a.value)?"":void 0,...r,ref:l,onClick:R(r.onClick,v=>{v.currentTarget.focus(),d.current!=="mouse"&&w(v)}),onPointerDown:R(r.onPointerDown,v=>{d.current=v.pointerType;const g=v.target;g.hasPointerCapture(v.pointerId)&&g.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(w(v),v.preventDefault())}),onKeyDown:R(r.onKeyDown,v=>{const g=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(g&&v.key===" ")&&uf.includes(v.key)&&(w(),v.preventDefault())})})})});oi.displayName=ni;var ri="SelectValue",si=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:s,placeholder:a="",...c}=e,l=Ie(ri,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=j(t,l.onValueNodeChange);return z(()=>{u(d)},[u,d]),p.jsx(D.span,{...c,ref:f,style:{pointerEvents:"none"},children:Ai(l.value)?p.jsx(p.Fragment,{children:a}):s})});si.displayName=ri;var mf="SelectIcon",ii=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return p.jsx(D.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});ii.displayName=mf;var gf="SelectPortal",ai=e=>p.jsx(Je,{asChild:!0,...e});ai.displayName=gf;var $e="SelectContent",ci=i.forwardRef((e,t)=>{const n=Ie($e,e.__scopeSelect),[o,r]=i.useState();if(z(()=>{r(new DocumentFragment)},[]),!n.open){const s=o;return s?Wt.createPortal(p.jsx(li,{scope:e.__scopeSelect,children:p.jsx(sn.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(ui,{...e,ref:t})});ci.displayName=$e;var le=10,[li,Oe]=tt($e),wf="SelectContentImpl",yf=of("SelectContent.RemoveScroll"),ui=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:a,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:v,avoidCollisions:g,...y}=e,x=Ie($e,n),[b,C]=i.useState(null),[S,A]=i.useState(null),E=j(t,T=>C(T)),[_,I]=i.useState(null),[O,L]=i.useState(null),$=an(n),[F,k]=i.useState(!1),B=i.useRef(!1);i.useEffect(()=>{if(b)return Ht(b)},[b]),Bt();const N=i.useCallback(T=>{const[V,...Z]=$().map(K=>K.ref.current),[H]=Z.slice(-1),U=document.activeElement;for(const K of T)if(K===U||(K?.scrollIntoView({block:"nearest"}),K===V&&S&&(S.scrollTop=0),K===H&&S&&(S.scrollTop=S.scrollHeight),K?.focus(),document.activeElement!==U))return},[$,S]),W=i.useCallback(()=>N([_,b]),[N,_,b]);i.useEffect(()=>{F&&W()},[F,W]);const{onOpenChange:M,triggerPointerDownPosRef:P}=x;i.useEffect(()=>{if(b){let T={x:0,y:0};const V=H=>{T={x:Math.abs(Math.round(H.pageX)-(P.current?.x??0)),y:Math.abs(Math.round(H.pageY)-(P.current?.y??0))}},Z=H=>{T.x<=10&&T.y<=10?H.preventDefault():b.contains(H.target)||M(!1),document.removeEventListener("pointermove",V),P.current=null};return P.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",Z,{capture:!0})}}},[b,M,P]),i.useEffect(()=>{const T=()=>M(!1);return window.addEventListener("blur",T),window.addEventListener("resize",T),()=>{window.removeEventListener("blur",T),window.removeEventListener("resize",T)}},[M]);const[G,q]=Ti(T=>{const V=$().filter(U=>!U.disabled),Z=V.find(U=>U.ref.current===document.activeElement),H=_i(V,T,Z);H&&setTimeout(()=>H.ref.current.focus())}),ce=i.useCallback((T,V,Z)=>{const H=!B.current&&!Z;(x.value!==void 0&&x.value===V||H)&&(I(T),H&&(B.current=!0))},[x.value]),be=i.useCallback(()=>b?.focus(),[b]),re=i.useCallback((T,V,Z)=>{const H=!B.current&&!Z;(x.value!==void 0&&x.value===V||H)&&L(T)},[x.value]),Ce=o==="popper"?kn:di,ee=Ce===kn?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:w,hideWhenDetached:v,avoidCollisions:g}:{};return p.jsx(li,{scope:n,content:b,viewport:S,onViewportChange:A,itemRefCallback:ce,selectedItem:_,onItemLeave:be,itemTextRefCallback:re,focusSelectedItem:W,selectedItemText:O,position:o,isPositioned:F,searchRef:G,children:p.jsx(dt,{as:yf,allowPinchZoom:!0,children:p.jsx(ut,{asChild:!0,trapped:x.open,onMountAutoFocus:T=>{T.preventDefault()},onUnmountAutoFocus:R(r,T=>{x.trigger?.focus({preventScroll:!0}),T.preventDefault()}),children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:T=>T.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:p.jsx(Ce,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:T=>T.preventDefault(),...y,...ee,onPlaced:()=>k(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:R(y.onKeyDown,T=>{const V=T.ctrlKey||T.altKey||T.metaKey;if(T.key==="Tab"&&T.preventDefault(),!V&&T.key.length===1&&q(T.key),["ArrowUp","ArrowDown","Home","End"].includes(T.key)){let H=$().filter(U=>!U.disabled).map(U=>U.ref.current);if(["ArrowUp","End"].includes(T.key)&&(H=H.slice().reverse()),["ArrowUp","ArrowDown"].includes(T.key)){const U=T.target,K=H.indexOf(U);H=H.slice(K+1)}setTimeout(()=>N(H)),T.preventDefault()}})})})})})})});ui.displayName=wf;var xf="SelectItemAlignedPosition",di=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,s=Ie($e,n),a=Oe($e,n),[c,l]=i.useState(null),[u,d]=i.useState(null),f=j(t,E=>d(E)),h=an(n),m=i.useRef(!1),w=i.useRef(!0),{viewport:v,selectedItem:g,selectedItemText:y,focusSelectedItem:x}=a,b=i.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&u&&v&&g&&y){const E=s.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(s.dir!=="rtl"){const U=O.left-_.left,K=I.left-U,se=E.left-K,De=E.width+se,hn=Math.max(De,_.width),vn=window.innerWidth-le,mn=Ln(K,[le,Math.max(le,vn-hn)]);c.style.minWidth=De+"px",c.style.left=mn+"px"}else{const U=_.right-O.right,K=window.innerWidth-I.right-U,se=window.innerWidth-E.right-K,De=E.width+se,hn=Math.max(De,_.width),vn=window.innerWidth-le,mn=Ln(K,[le,Math.max(le,vn-hn)]);c.style.minWidth=De+"px",c.style.right=mn+"px"}const L=h(),$=window.innerHeight-le*2,F=v.scrollHeight,k=window.getComputedStyle(u),B=parseInt(k.borderTopWidth,10),N=parseInt(k.paddingTop,10),W=parseInt(k.borderBottomWidth,10),M=parseInt(k.paddingBottom,10),P=B+N+F+M+W,G=Math.min(g.offsetHeight*5,P),q=window.getComputedStyle(v),ce=parseInt(q.paddingTop,10),be=parseInt(q.paddingBottom,10),re=E.top+E.height/2-le,Ce=$-re,ee=g.offsetHeight/2,T=g.offsetTop+ee,V=B+N+T,Z=P-V;if(V<=re){const U=L.length>0&&g===L[L.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-v.offsetTop-v.offsetHeight,se=Math.max(Ce,ee+(U?be:0)+K+W),De=V+se;c.style.height=De+"px"}else{const U=L.length>0&&g===L[0].ref.current;c.style.top="0px";const se=Math.max(re,B+v.offsetTop+(U?ce:0)+ee)+Z;c.style.height=se+"px",v.scrollTop=V-re+v.offsetTop}c.style.margin=`${le}px 0`,c.style.minHeight=G+"px",c.style.maxHeight=$+"px",o?.(),requestAnimationFrame(()=>m.current=!0)}},[h,s.trigger,s.valueNode,c,u,v,g,y,s.dir,o]);z(()=>b(),[b]);const[C,S]=i.useState();z(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const A=i.useCallback(E=>{E&&w.current===!0&&(b(),x?.(),w.current=!1)},[b,x]);return p.jsx(Cf,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:A,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:p.jsx(D.div,{...r,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});di.displayName=xf;var bf="SelectPopperPosition",kn=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=le,...s}=e,a=cn(n);return p.jsx(qt,{...a,...s,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});kn.displayName=bf;var[Cf,po]=tt($e,{}),$n="SelectViewport",fi=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,s=Oe($n,n),a=po($n,n),c=j(t,s.onViewportChange),l=i.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(sn.Slot,{scope:n,children:p.jsx(D.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:R(r.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const m=Math.abs(l.current-d.scrollTop);if(m>0){const w=window.innerHeight-le*2,v=parseFloat(f.style.minHeight),g=parseFloat(f.style.height),y=Math.max(v,g);if(y<w){const x=y+m,b=Math.min(w,x),C=x-b;f.style.height=b+"px",f.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});fi.displayName=$n;var pi="SelectGroup",[Sf,Ef]=tt(pi),hi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=ne();return p.jsx(Sf,{scope:n,id:r,children:p.jsx(D.div,{role:"group","aria-labelledby":r,...o,ref:t})})});hi.displayName=pi;var vi="SelectLabel",mi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ef(vi,n);return p.jsx(D.div,{id:r.id,...o,ref:t})});mi.displayName=vi;var kt="SelectItem",[Rf,gi]=tt(kt),wi=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...a}=e,c=Ie(kt,n),l=Oe(kt,n),u=c.value===o,[d,f]=i.useState(s??""),[h,m]=i.useState(!1),w=j(t,x=>l.itemRefCallback?.(x,o,r)),v=ne(),g=i.useRef("touch"),y=()=>{r||(c.onValueChange(o),c.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(Rf,{scope:n,value:o,disabled:r,textId:v,isSelected:u,onItemTextChange:i.useCallback(x=>{f(b=>b||(x?.textContent??"").trim())},[]),children:p.jsx(sn.ItemSlot,{scope:n,value:o,disabled:r,textValue:d,children:p.jsx(D.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:w,onFocus:R(a.onFocus,()=>m(!0)),onBlur:R(a.onBlur,()=>m(!1)),onClick:R(a.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:R(a.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:R(a.onPointerDown,x=>{g.current=x.pointerType}),onPointerMove:R(a.onPointerMove,x=>{g.current=x.pointerType,r?l.onItemLeave?.():g.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(a.onPointerLeave,x=>{x.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:R(a.onKeyDown,x=>{l.searchRef?.current!==""&&x.key===" "||(df.includes(x.key)&&y(),x.key===" "&&x.preventDefault())})})})})});wi.displayName=kt;var ot="SelectItemText",yi=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...s}=e,a=Ie(ot,n),c=Oe(ot,n),l=gi(ot,n),u=vf(ot,n),[d,f]=i.useState(null),h=j(t,y=>f(y),l.onItemTextChange,y=>c.itemTextRefCallback?.(y,l.value,l.disabled)),m=d?.textContent,w=i.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:v,onNativeOptionRemove:g}=u;return z(()=>(v(w),()=>g(w)),[v,g,w]),p.jsxs(p.Fragment,{children:[p.jsx(D.span,{id:l.textId,...s,ref:h}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Wt.createPortal(s.children,a.valueNode):null]})});yi.displayName=ot;var xi="SelectItemIndicator",bi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return gi(xi,n).isSelected?p.jsx(D.span,{"aria-hidden":!0,...o,ref:t}):null});bi.displayName=xi;var Fn="SelectScrollUpButton",Ci=i.forwardRef((e,t)=>{const n=Oe(Fn,e.__scopeSelect),o=po(Fn,e.__scopeSelect),[r,s]=i.useState(!1),a=j(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?p.jsx(Ei,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Ci.displayName=Fn;var Wn="SelectScrollDownButton",Si=i.forwardRef((e,t)=>{const n=Oe(Wn,e.__scopeSelect),o=po(Wn,e.__scopeSelect),[r,s]=i.useState(!1),a=j(t,o.onScrollButtonChange);return z(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;s(d)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),r?p.jsx(Ei,{...e,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});Si.displayName=Wn;var Ei=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,s=Oe("SelectScrollButton",n),a=i.useRef(null),c=an(n),l=i.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return i.useEffect(()=>()=>l(),[l]),z(()=>{c().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),p.jsx(D.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:R(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:R(r.onPointerMove,()=>{s.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:R(r.onPointerLeave,()=>{l()})})}),Pf="SelectSeparator",Ri=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return p.jsx(D.div,{"aria-hidden":!0,...o,ref:t})});Ri.displayName=Pf;var Bn="SelectArrow",Af=i.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=cn(n),s=Ie(Bn,n),a=Oe(Bn,n);return s.open&&a.position==="popper"?p.jsx(Zt,{...r,...o,ref:t}):null});Af.displayName=Bn;var Tf="SelectBubbleInput",Pi=i.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=i.useRef(null),s=j(o,r),a=ei(t);return i.useEffect(()=>{const c=r.current;if(!c)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==t&&d){const f=new Event("change",{bubbles:!0});d.call(c,t),c.dispatchEvent(f)}},[a,t]),p.jsx(D.select,{...n,style:{...Jr,...n.style},ref:s,defaultValue:t})});Pi.displayName=Tf;function Ai(e){return e===""||e===void 0}function Ti(e){const t=X(e),n=i.useRef(""),o=i.useRef(0),r=i.useCallback(a=>{const c=n.current+a;t(c),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(c)},[t]),s=i.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,s]}function _i(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=_f(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function _f(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Vh=ti,Hh=oi,Uh=si,Gh=ii,Kh=ai,zh=ci,Yh=fi,Xh=hi,qh=mi,Zh=wi,Jh=yi,Qh=bi,ev=Ci,tv=Si,nv=Ri,ln="Switch",[If]=Q(ln),[Of,Mf]=If(ln),Ii=i.forwardRef((e,t)=>{const{__scopeSwitch:n,name:o,checked:r,defaultChecked:s,required:a,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=e,[h,m]=i.useState(null),w=j(t,b=>m(b)),v=i.useRef(!1),g=h?d||!!h.closest("form"):!0,[y,x]=me({prop:r,defaultProp:s??!1,onChange:u,caller:ln});return p.jsxs(Of,{scope:n,checked:y,disabled:c,children:[p.jsx(D.button,{type:"button",role:"switch","aria-checked":y,"aria-required":a,"data-state":Ni(y),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:w,onClick:R(e.onClick,b=>{x(C=>!C),g&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})}),g&&p.jsx(Di,{control:h,bubbles:!v.current,name:o,value:l,checked:y,required:a,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});Ii.displayName=ln;var Oi="SwitchThumb",Mi=i.forwardRef((e,t)=>{const{__scopeSwitch:n,...o}=e,r=Mf(Oi,n);return p.jsx(D.span,{"data-state":Ni(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:t})});Mi.displayName=Oi;var Df="SwitchBubbleInput",Di=i.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:o=!0,...r},s)=>{const a=i.useRef(null),c=j(a,s),l=ei(n),u=Vr(t);return i.useEffect(()=>{const d=a.current;if(!d)return;const f=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&m){const w=new Event("click",{bubbles:o});m.call(d,n),d.dispatchEvent(w)}},[l,n,o]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:c,style:{...r.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Di.displayName=Df;function Ni(e){return e?"checked":"unchecked"}var ov=Ii,rv=Mi;function Nf(e){const t=Lf(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(kf);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Lf(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=Ff(r),c=$f(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jf=Symbol("radix.slottable");function kf(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jf}function $f(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Ff(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vn=["Enter"," "],Wf=["ArrowDown","PageUp","Home"],Li=["ArrowUp","PageDown","End"],Bf=[...Wf,...Li],Vf={ltr:[...Vn,"ArrowRight"],rtl:[...Vn,"ArrowLeft"]},Hf={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gt="Menu",[ct,Uf,Gf]=uo(gt),[Fe,ji]=Q(gt,[Gf,_e,on]),un=_e(),ki=on(),[Kf,We]=Fe(gt),[zf,wt]=Fe(gt),$i=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,c=un(t),[l,u]=i.useState(null),d=i.useRef(!1),f=X(s),h=vt(r);return i.useEffect(()=>{const m=()=>{d.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>d.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),p.jsx(Xt,{...c,children:p.jsx(Kf,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:u,children:p.jsx(zf,{scope:t,onClose:i.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:o})})})};$i.displayName=gt;var Yf="MenuAnchor",ho=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=un(n);return p.jsx(pt,{...r,...o,ref:t})});ho.displayName=Yf;var vo="MenuPortal",[Xf,Fi]=Fe(vo,{forceMount:void 0}),Wi=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=We(vo,t);return p.jsx(Xf,{scope:t,forceMount:n,children:p.jsx(Y,{present:n||s.open,children:p.jsx(Je,{asChild:!0,container:r,children:o})})})};Wi.displayName=vo;var ie="MenuContent",[qf,mo]=Fe(ie),Bi=i.forwardRef((e,t)=>{const n=Fi(ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=We(ie,e.__scopeMenu),a=wt(ie,e.__scopeMenu);return p.jsx(ct.Provider,{scope:e.__scopeMenu,children:p.jsx(Y,{present:o||s.open,children:p.jsx(ct.Slot,{scope:e.__scopeMenu,children:a.modal?p.jsx(Zf,{...r,ref:t}):p.jsx(Jf,{...r,ref:t})})})})}),Zf=i.forwardRef((e,t)=>{const n=We(ie,e.__scopeMenu),o=i.useRef(null),r=j(t,o);return i.useEffect(()=>{const s=o.current;if(s)return Ht(s)},[]),p.jsx(go,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jf=i.forwardRef((e,t)=>{const n=We(ie,e.__scopeMenu);return p.jsx(go,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Qf=Nf("MenuContent.ScrollLock"),go=i.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:w,...v}=e,g=We(ie,n),y=wt(ie,n),x=un(n),b=ki(n),C=Uf(n),[S,A]=i.useState(null),E=i.useRef(null),_=j(t,E,g.onContentChange),I=i.useRef(0),O=i.useRef(""),L=i.useRef(0),$=i.useRef(null),F=i.useRef("right"),k=i.useRef(0),B=w?dt:i.Fragment,N=w?{as:Qf,allowPinchZoom:!0}:void 0,W=P=>{const G=O.current+P,q=C().filter(T=>!T.disabled),ce=document.activeElement,be=q.find(T=>T.ref.current===ce)?.textValue,re=q.map(T=>T.textValue),Ce=dp(re,G,be),ee=q.find(T=>T.textValue===Ce)?.ref.current;(function T(V){O.current=V,window.clearTimeout(I.current),V!==""&&(I.current=window.setTimeout(()=>T(""),1e3))})(G),ee&&setTimeout(()=>ee.focus())};i.useEffect(()=>()=>window.clearTimeout(I.current),[]),Bt();const M=i.useCallback(P=>F.current===$.current?.side&&pp(P,$.current?.area),[]);return p.jsx(qf,{scope:n,searchRef:O,onItemEnter:i.useCallback(P=>{M(P)&&P.preventDefault()},[M]),onItemLeave:i.useCallback(P=>{M(P)||(E.current?.focus(),A(null))},[M]),onTriggerLeave:i.useCallback(P=>{M(P)&&P.preventDefault()},[M]),pointerGraceTimerRef:L,onPointerGraceIntentChange:i.useCallback(P=>{$.current=P},[]),children:p.jsx(B,{...N,children:p.jsx(ut,{asChild:!0,trapped:r,onMountAutoFocus:R(s,P=>{P.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:p.jsx(Bs,{asChild:!0,...b,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:S,onCurrentTabStopIdChange:A,onEntryFocus:R(l,P=>{y.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(qt,{role:"menu","aria-orientation":"vertical","data-state":oa(g.open),"data-radix-menu-content":"",dir:y.dir,...x,...v,ref:_,style:{outline:"none",...v.style},onKeyDown:R(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,ce=P.ctrlKey||P.altKey||P.metaKey,be=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!ce&&be&&W(P.key));const re=E.current;if(P.target!==re||!Bf.includes(P.key))return;P.preventDefault();const ee=C().filter(T=>!T.disabled).map(T=>T.ref.current);Li.includes(P.key)&&ee.reverse(),lp(ee)}),onBlur:R(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(I.current),O.current="")}),onPointerMove:R(e.onPointerMove,lt(P=>{const G=P.target,q=k.current!==P.clientX;if(P.currentTarget.contains(G)&&q){const ce=P.clientX>k.current?"right":"left";F.current=ce,k.current=P.clientX}}))})})})})})})});Bi.displayName=ie;var ep="MenuGroup",wo=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{role:"group",...o,ref:t})});wo.displayName=ep;var tp="MenuLabel",Vi=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{...o,ref:t})});Vi.displayName=tp;var $t="MenuItem",Zo="menu.itemSelect",dn=i.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=i.useRef(null),a=wt($t,e.__scopeMenu),c=mo($t,e.__scopeMenu),l=j(t,s),u=i.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(Zo,{bubbles:!0,cancelable:!0});f.addEventListener(Zo,m=>o?.(m),{once:!0}),er(f,h),h.defaultPrevented?u.current=!1:a.onClose()}};return p.jsx(Hi,{...r,ref:l,disabled:n,onClick:R(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),u.current=!0},onPointerUp:R(e.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||Vn.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});dn.displayName=$t;var Hi=i.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=mo($t,n),c=ki(n),l=i.useRef(null),u=j(t,l),[d,f]=i.useState(!1),[h,m]=i.useState("");return i.useEffect(()=>{const w=l.current;w&&m((w.textContent??"").trim())},[s.children]),p.jsx(ct.ItemSlot,{scope:n,disabled:o,textValue:r??h,children:p.jsx(Vs,{asChild:!0,...c,focusable:!o,children:p.jsx(D.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:R(e.onPointerMove,lt(w=>{o?a.onItemLeave(w):(a.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,lt(w=>a.onItemLeave(w))),onFocus:R(e.onFocus,()=>f(!0)),onBlur:R(e.onBlur,()=>f(!1))})})})}),np="MenuCheckboxItem",Ui=i.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return p.jsx(Xi,{scope:e.__scopeMenu,checked:n,children:p.jsx(dn,{role:"menuitemcheckbox","aria-checked":Ft(n)?"mixed":n,...r,ref:t,"data-state":xo(n),onSelect:R(r.onSelect,()=>o?.(Ft(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Ui.displayName=np;var Gi="MenuRadioGroup",[op,rp]=Fe(Gi,{value:void 0,onValueChange:()=>{}}),Ki=i.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=X(o);return p.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:p.jsx(wo,{...r,ref:t})})});Ki.displayName=Gi;var zi="MenuRadioItem",Yi=i.forwardRef((e,t)=>{const{value:n,...o}=e,r=rp(zi,e.__scopeMenu),s=n===r.value;return p.jsx(Xi,{scope:e.__scopeMenu,checked:s,children:p.jsx(dn,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":xo(s),onSelect:R(o.onSelect,()=>r.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Yi.displayName=zi;var yo="MenuItemIndicator",[Xi,sp]=Fe(yo,{checked:!1}),qi=i.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=sp(yo,n);return p.jsx(Y,{present:o||Ft(s.checked)||s.checked===!0,children:p.jsx(D.span,{...r,ref:t,"data-state":xo(s.checked)})})});qi.displayName=yo;var ip="MenuSeparator",Zi=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return p.jsx(D.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});Zi.displayName=ip;var ap="MenuArrow",Ji=i.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=un(n);return p.jsx(Zt,{...r,...o,ref:t})});Ji.displayName=ap;var cp="MenuSub",[sv,Qi]=Fe(cp),rt="MenuSubTrigger",ea=i.forwardRef((e,t)=>{const n=We(rt,e.__scopeMenu),o=wt(rt,e.__scopeMenu),r=Qi(rt,e.__scopeMenu),s=mo(rt,e.__scopeMenu),a=i.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},d=i.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return i.useEffect(()=>d,[d]),i.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),p.jsx(ho,{asChild:!0,...u,children:p.jsx(Hi,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":oa(n.open),...e,ref:we(t,r.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,lt(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:R(e.onPointerLeave,lt(f=>{d();const h=n.content?.getBoundingClientRect();if(h){const m=n.content?.dataset.side,w=m==="right",v=w?-5:5,g=h[w?"left":"right"],y=h[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+v,y:f.clientY},{x:g,y:h.top},{x:y,y:h.top},{x:y,y:h.bottom},{x:g,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,f=>{const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||Vf[o.dir].includes(f.key)&&(n.onOpenChange(!0),n.content?.focus(),f.preventDefault())})})})});ea.displayName=rt;var ta="MenuSubContent",na=i.forwardRef((e,t)=>{const n=Fi(ie,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=We(ie,e.__scopeMenu),a=wt(ie,e.__scopeMenu),c=Qi(ta,e.__scopeMenu),l=i.useRef(null),u=j(t,l);return p.jsx(ct.Provider,{scope:e.__scopeMenu,children:p.jsx(Y,{present:o||s.open,children:p.jsx(ct.Slot,{scope:e.__scopeMenu,children:p.jsx(go,{id:c.contentId,"aria-labelledby":c.triggerId,...r,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{a.isUsingKeyboardRef.current&&l.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:R(e.onFocusOutside,d=>{d.target!==c.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:R(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),h=Hf[a.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),c.trigger?.focus(),d.preventDefault())})})})})})});na.displayName=ta;function oa(e){return e?"open":"closed"}function Ft(e){return e==="indeterminate"}function xo(e){return Ft(e)?"indeterminate":e?"checked":"unchecked"}function lp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function up(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function dp(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=up(e,Math.max(s,0));r.length===1&&(a=a.filter(u=>u!==n));const l=a.find(u=>u.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function fp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const c=t[s],l=t[a],u=c.x,d=c.y,f=l.x,h=l.y;d>o!=h>o&&n<(f-u)*(o-d)/(h-d)+u&&(r=!r)}return r}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return fp(n,t)}function lt(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=$i,vp=ho,mp=Wi,gp=Bi,wp=wo,yp=Vi,xp=dn,bp=Ui,Cp=Ki,Sp=Yi,Ep=qi,Rp=Zi,Pp=Ji,Ap=ea,Tp=na,fn="DropdownMenu",[_p]=Q(fn,[ji]),J=ji(),[Ip,ra]=_p(fn),sa=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:c=!0}=e,l=J(t),u=i.useRef(null),[d,f]=me({prop:r,defaultProp:s??!1,onChange:a,caller:fn});return p.jsx(Ip,{scope:t,triggerId:ne(),triggerRef:u,contentId:ne(),open:d,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(h=>!h),[f]),modal:c,children:p.jsx(hp,{...l,open:d,onOpenChange:f,dir:o,modal:c,children:n})})};sa.displayName=fn;var ia="DropdownMenuTrigger",aa=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ra(ia,n),a=J(n);return p.jsx(vp,{asChild:!0,...a,children:p.jsx(D.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:we(t,s.triggerRef),onPointerDown:R(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:R(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});aa.displayName=ia;var Op="DropdownMenuPortal",ca=e=>{const{__scopeDropdownMenu:t,...n}=e,o=J(t);return p.jsx(mp,{...o,...n})};ca.displayName=Op;var la="DropdownMenuContent",ua=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ra(la,n),s=J(n),a=i.useRef(!1);return p.jsx(gp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,c=>{a.current||r.triggerRef.current?.focus(),a.current=!1,c.preventDefault()}),onInteractOutside:R(e.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!r.modal||d)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ua.displayName=la;var Mp="DropdownMenuGroup",Dp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(wp,{...r,...o,ref:t})});Dp.displayName=Mp;var Np="DropdownMenuLabel",Lp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(yp,{...r,...o,ref:t})});Lp.displayName=Np;var jp="DropdownMenuItem",da=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(xp,{...r,...o,ref:t})});da.displayName=jp;var kp="DropdownMenuCheckboxItem",$p=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(bp,{...r,...o,ref:t})});$p.displayName=kp;var Fp="DropdownMenuRadioGroup",Wp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Cp,{...r,...o,ref:t})});Wp.displayName=Fp;var Bp="DropdownMenuRadioItem",Vp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Sp,{...r,...o,ref:t})});Vp.displayName=Bp;var Hp="DropdownMenuItemIndicator",Up=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Ep,{...r,...o,ref:t})});Up.displayName=Hp;var Gp="DropdownMenuSeparator",Kp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Rp,{...r,...o,ref:t})});Kp.displayName=Gp;var zp="DropdownMenuArrow",Yp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Pp,{...r,...o,ref:t})});Yp.displayName=zp;var Xp="DropdownMenuSubTrigger",qp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Ap,{...r,...o,ref:t})});qp.displayName=Xp;var Zp="DropdownMenuSubContent",Jp=i.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=J(n);return p.jsx(Tp,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jp.displayName=Zp;var iv=sa,av=aa,cv=ca,lv=ua,uv=da;function Qp(e){const t=eh(e),n=i.forwardRef((o,r)=>{const{children:s,...a}=o,c=i.Children.toArray(s),l=c.find(nh);if(l){const u=l.props.children,d=c.map(f=>f===l?i.Children.count(u)>1?i.Children.only(null):i.isValidElement(u)?u.props.children:null:f);return p.jsx(t,{...a,ref:r,children:i.isValidElement(u)?i.cloneElement(u,void 0,d):null})}return p.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function eh(e){const t=i.forwardRef((n,o)=>{const{children:r,...s}=n;if(i.isValidElement(r)){const a=rh(r),c=oh(s,r.props);return r.type!==i.Fragment&&(c.ref=o?we(o,a):a),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var th=Symbol("radix.slottable");function nh(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===th}function oh(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...c)=>{const l=s(...c);return r(...c),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function rh(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pn="Popover",[fa]=Q(pn,[_e]),yt=_e(),[sh,Me]=fa(pn),pa=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,c=yt(t),l=i.useRef(null),[u,d]=i.useState(!1),[f,h]=me({prop:o,defaultProp:r??!1,onChange:s,caller:pn});return p.jsx(Xt,{...c,children:p.jsx(sh,{scope:t,contentId:ne(),triggerRef:l,open:f,onOpenChange:h,onOpenToggle:i.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:i.useCallback(()=>d(!0),[]),onCustomAnchorRemove:i.useCallback(()=>d(!1),[]),modal:a,children:n})})};pa.displayName=pn;var ha="PopoverAnchor",va=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ha,n),s=yt(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:c}=r;return i.useEffect(()=>(a(),()=>c()),[a,c]),p.jsx(pt,{...s,...o,ref:t})});va.displayName=ha;var ma="PopoverTrigger",ga=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ma,n),s=yt(n),a=j(t,r.triggerRef),c=p.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ca(r.open),...o,ref:a,onClick:R(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?c:p.jsx(pt,{asChild:!0,...s,children:c})});ga.displayName=ma;var bo="PopoverPortal",[ih,ah]=fa(bo,{forceMount:void 0}),wa=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=Me(bo,t);return p.jsx(ih,{scope:t,forceMount:n,children:p.jsx(Y,{present:n||s.open,children:p.jsx(Je,{asChild:!0,container:r,children:o})})})};wa.displayName=bo;var qe="PopoverContent",ya=i.forwardRef((e,t)=>{const n=ah(qe,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=Me(qe,e.__scopePopover);return p.jsx(Y,{present:o||s.open,children:s.modal?p.jsx(lh,{...r,ref:t}):p.jsx(uh,{...r,ref:t})})});ya.displayName=qe;var ch=Qp("PopoverContent.RemoveScroll"),lh=i.forwardRef((e,t)=>{const n=Me(qe,e.__scopePopover),o=i.useRef(null),r=j(t,o),s=i.useRef(!1);return i.useEffect(()=>{const a=o.current;if(a)return Ht(a)},[]),p.jsx(dt,{as:ch,allowPinchZoom:!0,children:p.jsx(xa,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,a=>{a.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,u=c.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),uh=i.forwardRef((e,t)=>{const n=Me(qe,e.__scopePopover),o=i.useRef(!1),r=i.useRef(!1);return p.jsx(xa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;n.triggerRef.current?.contains(a)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),xa=i.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,h=Me(qe,n),m=yt(n);return Bt(),p.jsx(ut,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:p.jsx(Ze,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:p.jsx(qt,{"data-state":Ca(h.open),role:"dialog",id:h.contentId,...m,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ba="PopoverClose",dh=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=Me(ba,n);return p.jsx(D.button,{type:"button",...o,ref:t,onClick:R(e.onClick,()=>r.onOpenChange(!1))})});dh.displayName=ba;var fh="PopoverArrow",ph=i.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=yt(n);return p.jsx(Zt,{...r,...o,ref:t})});ph.displayName=fh;function Ca(e){return e?"open":"closed"}var dv=pa,fv=va,pv=ga,hv=wa,vv=ya;export{mh as $,Ch as A,Qh as B,Cl as C,El as D,Jh as E,nv as F,Vh as G,Uh as H,Gh as I,Xh as J,hv as K,$h as L,vv as M,dv as N,bl as O,xl as P,fv as Q,wl as R,vh as S,Sl as T,pv as U,Rh as V,iv as W,av as X,cv as Y,lv as Z,uv as _,_r as a,_h as a0,Mh as a1,Lh as a2,jh as a3,Nh as a4,Dh as a5,Ih as a6,Oh as a7,ov as a8,rv as a9,gh as b,wh as c,yh as d,xh as e,bh as f,Sh as g,dd as h,ud as i,p as j,Eh as k,Th as l,Ph as m,Ah as n,Fh as o,Wh as p,kh as q,Bh as r,Hh as s,ev as t,tv as u,Kh as v,zh as w,Yh as x,qh as y,Zh as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./radix-ui-
|
|
1
|
+
import{j as s}from"./radix-ui-CBgg0XeO.js";import{r as d}from"./react-vendor-B_CU-WTZ.js";import{C as l,a as m}from"./card-P5vPGo2D.js";import{az as c,aA as x,aB as u,aC as h,aD as p,a as g}from"./index-D8MFq-UJ.js";import{x as j,Q as f,aw as N,T as b}from"./icons-U9n5DGj9.js";import"./tanstack-CxYN0q6L.js";import"./notifications-dJQY2-U6.js";import"./utils-CzKF5WmX.js";import"./form-utils-kUVlZZAO.js";import"./code-highlight-DKN39ySy.js";function R(){const[t,r]=d.useState("commands"),{data:e}=c(),{data:n,isLoading:i}=x(t),o=[{id:"commands",label:"Commands",icon:j,count:e?.commands??0},{id:"skills",label:"Skills",icon:f,count:e?.skills??0},{id:"agents",label:"Agents",icon:N,count:e?.agents??0}];return s.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold",children:"Shared Data"}),s.jsx("p",{className:"text-muted-foreground",children:"Commands, skills, and agents shared across Claude instances"})]}),e&&!e.symlinkStatus.valid&&s.jsxs(u,{variant:"warning",children:[s.jsx(b,{className:"h-4 w-4"}),s.jsx(h,{children:"Configuration Required"}),s.jsxs(p,{children:[e.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),s.jsx("div",{className:"flex gap-2 border-b pb-2",children:o.map(a=>s.jsxs(g,{variant:t===a.id?"default":"ghost",size:"sm",onClick:()=>r(a.id),className:"flex items-center gap-2",children:[s.jsx(a.icon,{className:"w-4 h-4"}),a.label," (",a.count,")"]},a.id))}),s.jsx("div",{className:"mt-4",children:i?s.jsx("div",{className:"text-muted-foreground",children:"Loading..."}):n?.items.length===0?s.jsxs("div",{className:"text-muted-foreground",children:["No ",t," found"]}):s.jsx("div",{className:"grid gap-3",children:n?.items.map(a=>s.jsx(l,{children:s.jsxs(m,{children:[s.jsx("div",{className:"font-medium",children:a.name}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.description}),s.jsx("p",{className:"text-xs text-muted-foreground mt-2 font-mono truncate",children:a.path})]})},a.name))})})]})}export{R as SharedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,a8 as s,a9 as n}from"./radix-ui-
|
|
1
|
+
import{j as a,a8 as s,a9 as n}from"./radix-ui-CBgg0XeO.js";import"./react-vendor-B_CU-WTZ.js";import{c as e}from"./index-D8MFq-UJ.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
|