@aidotnet/server-linux-arm64 0.14.3115 → 0.15.0
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/bin/astra-server +2 -2
- package/bin/wwwroot/assets/ClientsPage-BTh-MAoi.js +11 -0
- package/bin/wwwroot/assets/KeyPage-DE781Xxu.js +1 -0
- package/bin/wwwroot/assets/LibraryPage-zWB1AmNM.js +2 -0
- package/bin/wwwroot/assets/McpPage-B9XqS9Bw.js +9 -0
- package/bin/wwwroot/assets/{ModelDetailPage-wyXq9TDp.js → ModelDetailPage-DX2Tmcg8.js} +1 -1
- package/bin/wwwroot/assets/ModelsPage-DQ723Bep.js +1 -0
- package/bin/wwwroot/assets/PluginsPage-DL2OpHwt.js +2 -0
- package/bin/wwwroot/assets/PrivacyPage-CLuKXL5L.js +1 -0
- package/bin/wwwroot/assets/ProviderDetailPage-k8pFYdq_.js +3 -0
- package/bin/wwwroot/assets/ProvidersPage-DPZUeWOI.js +3 -0
- package/bin/wwwroot/assets/RoutingGroupsPage-BTUW7SzD.js +3 -0
- package/bin/wwwroot/assets/SettingsPage-CZ14Qoi7.js +2 -0
- package/bin/wwwroot/assets/SkillsPage-D02hvfyt.js +1 -0
- package/bin/wwwroot/assets/SmartRoutingPage-C_WvZBQn.js +2 -0
- package/bin/wwwroot/assets/TokenDetailPage-Dx1dSnTW.js +1 -0
- package/bin/wwwroot/assets/{TokenPoolEditor-B8dvWyVb.js → TokenPoolEditor-IFC01xaC.js} +1 -1
- package/bin/wwwroot/assets/TokensPage-ChYVyi0B.js +1 -0
- package/bin/wwwroot/assets/ToolsPage-eggyG1x7.js +1 -0
- package/bin/wwwroot/assets/{TracesPage-CFT0yZIR.js → TracesPage-BZrA-1-1.js} +3 -3
- package/bin/wwwroot/assets/{TrayPanelPage-gBTrOPmC.js → TrayPanelPage-BZ5qX7RL.js} +1 -1
- package/bin/wwwroot/assets/{TrayPanelView-B55rDT5T.js → TrayPanelView-BCnCVX3H.js} +1 -1
- package/bin/wwwroot/assets/TrayTitleSource-DPgZ1gwk.js +41 -0
- package/bin/wwwroot/assets/{checkbox-1usuDGem.js → checkbox-CgKXs5Sq.js} +1 -1
- package/bin/wwwroot/assets/{confirm-morph-K7pFKAy0.js → confirm-morph-DiY_OTKx.js} +1 -1
- package/bin/wwwroot/assets/{format-J2nKWrkO.js → format-DFMHYFFs.js} +3 -3
- package/bin/wwwroot/assets/index-Dd8H-gQl.js +124 -0
- package/bin/wwwroot/assets/{radio-cards-B51cWLdA.js → radio-cards-BvbUpDsv.js} +1 -1
- package/bin/wwwroot/assets/{sortable.esm-Cxrq5Uo7.js → sortable.esm-DTOfU4E0.js} +1 -1
- package/bin/wwwroot/assets/{use-transform-a9VAt8ne.js → use-transform-DAvHgos2.js} +1 -1
- package/bin/wwwroot/index.html +4 -4
- package/package.json +1 -1
- package/bin/wwwroot/assets/ClientsPage-CCGkrKgR.js +0 -11
- package/bin/wwwroot/assets/KeyPage-NDTkEVh5.js +0 -1
- package/bin/wwwroot/assets/LibraryPage-DxTFiK-w.js +0 -2
- package/bin/wwwroot/assets/McpPage-BfIvxv3c.js +0 -9
- package/bin/wwwroot/assets/ModelsPage-Csj6J5sw.js +0 -1
- package/bin/wwwroot/assets/PluginsPage-CEZRuEVD.js +0 -2
- package/bin/wwwroot/assets/PrivacyPage-D3EZA5kT.js +0 -1
- package/bin/wwwroot/assets/ProviderDetailPage-BqBxLFTF.js +0 -3
- package/bin/wwwroot/assets/ProvidersPage-CzwZTRDt.js +0 -3
- package/bin/wwwroot/assets/RoutingGroupsPage-DjTKx2no.js +0 -3
- package/bin/wwwroot/assets/SettingsPage-CiDlbS58.js +0 -2
- package/bin/wwwroot/assets/SkillsPage-DqvXDLyH.js +0 -1
- package/bin/wwwroot/assets/SmartRoutingPage-eoSIUANj.js +0 -2
- package/bin/wwwroot/assets/TokenDetailPage-_OxSsur_.js +0 -1
- package/bin/wwwroot/assets/TokensPage-BJFNYTNA.js +0 -1
- package/bin/wwwroot/assets/ToolsPage-DSuJm5BS.js +0 -1
- package/bin/wwwroot/assets/TrayTitleSource-C4HHlAfy.js +0 -41
- package/bin/wwwroot/assets/index-Bv3yqTIE.js +0 -124
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$s as n,T as r,ec as i,es as a,ua as o,wt as s}from"./format-DFMHYFFs.js";import{R as c,U as l,W as u,n as d,o as f,r as p,s as m}from"./TrayTitleSource-DPgZ1gwk.js";import{t as h}from"./TrayPanelView-BCnCVX3H.js";var g=e(t(),1),_=i(),v=new Set([`astra.theme`,`astra.accent`,`astra.locale`]);function y(){let{t:e}=r(),t=n(),{toast:i}=u(),y=a(),[b]=f(),x=m(),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(`overview`),E=p(b,{enabled:x.running,background:!0,live:S}),D=o(),O=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=document.documentElement;e.dataset.view=`tray`,e.style.background=`transparent`,document.body.style.background=`transparent`},[]);let k=(0,g.useCallback)(()=>{t.invalidateQueries({queryKey:[`stats`]}),t.invalidateQueries({queryKey:s.providers}),t.invalidateQueries({queryKey:s.clients}),t.invalidateQueries({queryKey:[`provider-accounts`]})},[t]);(0,g.useEffect)(()=>y?.tray.onVisibilityChanged(e=>{C(e),e&&(T(`overview`),k())}),[y,k]),(0,g.useEffect)(()=>{x.running&&k()},[x.running,k]),(0,g.useEffect)(()=>{let e=e=>{e.key&&v.has(e.key)&&window.location.reload()};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&y?.tray.command(`hide`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,g.useLayoutEffect)(()=>{let e=O.current;if(!e||!y)return;let t=[`header`,`tabs`,`body`,`footer`].map(t=>e.querySelector(`[data-tray-part="${t}"]`)),n=()=>{let n=e.offsetHeight-e.clientHeight,r=t.reduce((e,t)=>e+(t?.offsetHeight??0),0)+n;y.tray.resize(r)},r=new ResizeObserver(n);for(let e of t)e&&r.observe(e);return n(),()=>r.disconnect()},[y]),d(b,x,E.summary,E.plans);let A=e=>void y?.tray.command(e),j=async()=>{E.settings&&await c.copy(`${E.settings.gatewayBaseUrl}/v1`)&&i(e(`common.copied`))},M=async t=>{let n=E.providers;if(n.length===0)return;let r=await c.contextMenu(n.map(n=>({id:n.id,label:n.enabled?n.name:e(`tray.disabledProvider`,{name:n.name}),type:`checkbox`,checked:n.id===t.providerId})));r&&r!==t.providerId&&D.mutate({kind:t.kind,providerId:r},{onError:e=>i(l(e),`error`)})};return(0,_.jsx)(`div`,{className:`h-full`,children:(0,_.jsx)(h,{ref:O,className:`h-full`,prefs:b,state:x,data:E,tab:w,onTabChange:T,onCommand:A,onRefresh:k,onCopyAddress:()=>void j(),onSwitchClient:e=>void M(e)})})}export{y as TrayPanelPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$s as n,M as r,U as i,c as a,d as o,dt as s,w as c}from"./format-J2nKWrkO.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-C4HHlAfy.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-Bv3yqTIE.js";var z=e(t(),1),B=n(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:n,onCommand:i,onRefresh:a,onCopyAddress:o,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=c(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>i?.(e),x=[`overview`];e.sections.quota&&(n.plans.length>0||n.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&n.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=n.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:s(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(r,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:o,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:n,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:n,onRefresh:a}),e.sections.quota&&(0,B.jsx)(ne,{data:n,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:n,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:n,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:n}){let{t:r}=c(),i={overview:r(`tray.tab.overview`),quota:r(`tray.tab.quota`),clients:r(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>n(e),className:s(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:i[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:s(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:n}){let{t:r,locale:i}=c(),o=t.summary,s=e.sections.overview&&o?y(o):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!o||s===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s>0&&(0,B.jsx)(W,{tone:`red`,children:r(`tray.alert.failures`,{count:s,share:a(s/o.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:n,children:r(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,r,i),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:n}){let{t:r,locale:s}=c(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,s,r(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:r(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:r(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:r(`common.refresh`),onClick:n,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:r(`tray.requests`),value:o(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:r(`tray.tokens`),value:o(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:r(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:r(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:r(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:r(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:r(`tray.loadFailed`)}):(0,B.jsx)(i,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:n}=c(),r=f(e.hourly,new Date(t)),i=Math.max(1,...r.map(e=>e.value)),a=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":n(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:r.map((e,t)=>{let r=e.value>0?Math.max(4,Math.round(e.value/i*64)):2;return(0,B.jsx)(`span`,{title:n(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:r,background:t===a?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>a?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:n,locale:r}=c();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):null;let i=p(e.plans,3),a=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n(`tray.quotaTightest`)}),a>i.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[n(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),i.map(({plan:e,row:t},i)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,n,r)})]}),(0,B.jsx)($,{row:t,locale:r})]},`${e.accountId}-${t.kind}-${i}`))]})}function re({data:e,plain:t}){let{t:n}=c();if(e.plans.length===0&&!e.hasSubscriptions)return null;let r=new Map;for(let t of e.plans)r.set(t.providerId,(r.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:n(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(r.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:n,locale:r}=c();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let i=Q(e,n,r);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:i,children:i}),(0,B.jsx)($,{row:e,locale:r})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:n,plain:r}){let{t:i}=c(),a=e.clients.filter(e=>e.enabled);if(a.length===0)return null;let o=t=>e.providers.find(e=>e.id===t)?.name??i(`tray.unbound`);return(0,B.jsxs)(`section`,{className:s(`flex flex-col gap-1`,!r&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:i(`tray.clients`)}),a.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!n,onClick:()=>n?.(e),"aria-label":i(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:o(e.providerId)}),n&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{N as n,T as r,W as i,c as a,ec as o,f as s,ft as c}from"./format-DFMHYFFs.js";import{_ as l,b as u,d,f,g as p,h as m,j as h,l as g,m as _,p as v,u as y,v as b,y as x}from"./TrayTitleSource-DPgZ1gwk.js";import{t as S}from"./arrow-down-right-D3a5SpdK.js";import{t as C}from"./arrow-up-right-LPOoQDJW.js";import{t as w}from"./ban-D3eujcIJ.js";import{t as T}from"./chevron-right-Bgtn3ze-.js";import{t as E}from"./chevrons-up-down-CyYxDvJJ.js";import{t as D}from"./copy-48gwhhDO.js";import{t as O}from"./ellipsis-CidyZaW2.js";import{t as k}from"./play-DqueJ6Li.js";import{t as A}from"./refresh-cw-CoLAai2c.js";import{t as j}from"./rotate-ccw-fsXoCwyv.js";import{t as M}from"./settings-BM4QjTnn.js";import{t as N}from"./triangle-alert-DMn3ceGk.js";import{t as P}from"./x-AFrW8zH7.js";import{S as F,_ as I,b as L,w as R}from"./index-Dd8H-gQl.js";var z=e(t(),1),B=o(),ee={green:`var(--success)`,orange:`var(--warning)`,red:`var(--danger)`},te=(0,z.forwardRef)(function({prefs:e,state:t,data:i,onCommand:a,onRefresh:o,onCopyAddress:s,onSwitchClient:l,preview:u,tab:d,onTabChange:f,className:p},m){let{t:h}=r(),[g,_]=(0,z.useState)(`overview`),v=t.activity!==null,y=t.running&&!v,b=e=>a?.(e),x=[`overview`];e.sections.quota&&(i.plans.length>0||i.hasSubscriptions)&&x.push(`quota`),e.sections.clients&&i.clients.some(e=>e.enabled)&&x.push(`clients`);let S=d??g,T=x.includes(S)?S:`overview`,E=e=>{_(e),f?.(e)},A=(t.running||v)&&x.length>1,F=i.settings?.gatewayBaseUrl.replace(/^https?:\/\//,``)??(t.port?`127.0.0.1:${t.port}`:``),I=t.activity?h(`tray.status.${t.activity}`):t.running?h(`tray.status.running`):h(`tray.status.stopped`);return(0,B.jsxs)(`div`,{ref:m,className:c(`chrome flex max-h-full flex-col overflow-hidden rounded-[14px] border border-[var(--border-strong)] bg-[var(--surface-raised)] text-[13px] text-[var(--foreground)]`,p),children:[(0,B.jsxs)(`header`,{"data-tray-part":`header`,className:`shrink-0 border-b border-[var(--border)] px-4 pt-3.5 pb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(n,{tone:v?`orange`:t.running?`green`:`red`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[14px] font-semibold`,children:I}),(0,B.jsx)(V,{label:h(`tray.copyAddress`),onClick:s,disabled:!F,children:(0,B.jsx)(D,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.settings`),onClick:()=>b(`open-settings`),children:(0,B.jsx)(M,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.more`),onClick:()=>b(`menu`),children:(0,B.jsx)(O,{className:`size-4`})}),!u&&(0,B.jsx)(V,{label:h(`common.close`),onClick:()=>b(`hide`),children:(0,B.jsx)(P,{className:`size-4`})})]}),F&&(0,B.jsx)(`div`,{className:`selectable mt-0.5 truncate pl-4 font-mono text-[12px] text-[var(--text-secondary)]`,children:F}),(t.apiVersionMismatch||t.updateAvailable)&&(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 pl-4`,children:[t.apiVersionMismatch&&(0,B.jsxs)(H,{tone:`orange`,children:[(0,B.jsx)(N,{className:`size-3`}),h(`tray.mismatch`)]}),t.updateAvailable&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`check-updates`),className:`cursor-default`,children:(0,B.jsx)(H,{tone:`accent`,children:h(`tray.update`)})})]})]}),(0,B.jsx)(`div`,{"data-tray-part":`tabs`,className:`shrink-0`,children:A&&(0,B.jsx)(U,{tabs:x,active:T,onChange:E})}),(0,B.jsx)(`div`,{className:`scroll min-h-0 flex-1 overflow-y-auto`,children:(0,B.jsx)(`div`,{"data-tray-part":`body`,className:`flex flex-col gap-3 px-4 py-3.5`,children:!t.running&&!v?(0,B.jsx)(K,{onStart:()=>b(`start`)}):(0,B.jsxs)(B.Fragment,{children:[T===`overview`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(G,{prefs:e,data:i,onViewQuota:()=>E(`quota`)}),(0,B.jsx)(J,{prefs:e,data:i,onRefresh:o}),e.sections.quota&&(0,B.jsx)(ne,{data:i,onViewAll:()=>E(`quota`)})]}),T===`quota`&&(0,B.jsx)(re,{data:i,plain:!0}),T===`clients`&&(0,B.jsx)(ae,{data:i,disabled:!y,onSwitch:l,plain:!0})]})})}),(0,B.jsxs)(`footer`,{"data-tray-part":`footer`,className:`flex shrink-0 items-center gap-1 border-t border-[var(--border)] px-3 py-2.5`,children:[t.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{label:h(`tray.restart`),onClick:()=>b(`restart`),disabled:v,children:(0,B.jsx)(j,{className:`size-4`})}),(0,B.jsx)(V,{label:h(`tray.stop`),onClick:()=>b(`stop`),disabled:v,children:(0,B.jsx)(w,{className:`size-4`})})]}):(0,B.jsx)(V,{label:h(`shell.startService`),onClick:()=>b(`start`),disabled:v,children:(0,B.jsx)(k,{className:`size-4`})}),(0,B.jsx)(`div`,{className:`flex-1`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>b(`quit`),className:`h-8 cursor-default rounded-[8px] px-2.5 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)]`,children:h(`tray.quit`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(`open`),className:`inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] border border-[var(--border-strong)] px-3 text-[13px] font-medium transition-colors hover:bg-[var(--surface-muted)]`,children:[h(`tray.open`),(0,B.jsx)(C,{className:`size-3.5`})]})]})]})});function V({label:e,onClick:t,disabled:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,title:e,"aria-label":e,disabled:n,onClick:t,className:`inline-flex size-8 shrink-0 cursor-default items-center justify-center rounded-[8px] text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-muted)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:hover:bg-transparent`,children:r})}function H({tone:e,children:t,title:n}){let r={red:`var(--danger)`,orange:`var(--warning)`,accent:`var(--accent)`,neutral:`var(--text-secondary)`}[e];return(0,B.jsx)(`span`,{title:n,className:`inline-flex max-w-full items-center gap-1 rounded-[6px] border px-1.5 py-px text-[11.5px] leading-[18px] whitespace-nowrap`,style:{color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},children:t})}function U({tabs:e,active:t,onChange:n}){let{t:i}=r(),a={overview:i(`tray.tab.overview`),quota:i(`tray.tab.quota`),clients:i(`tray.clients`)};return(0,B.jsx)(`div`,{role:`tablist`,className:`flex gap-1 px-3 pt-2.5`,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===t,onClick:()=>n(e),className:c(`h-7 cursor-default rounded-[7px] px-2.5 text-[12.5px] transition-colors`,e===t?`bg-[var(--surface-muted)] font-medium text-[var(--foreground)]`:`text-[var(--text-secondary)] hover:text-[var(--foreground)]`),children:a[e]},e))})}function W({tone:e,onClick:t,children:n}){let r=e===`red`?`var(--danger)`:`var(--warning)`,i={color:r,borderColor:`color-mix(in oklab, ${r} 45%, transparent)`,background:`color-mix(in oklab, ${r} 10%, transparent)`},a=`flex w-full items-center gap-1.5 rounded-[8px] border px-2.5 py-1.5 text-left text-[12.5px]`,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(N,{className:`size-3.5 shrink-0`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n})]});return t?(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:c(a,`cursor-default`),style:i,children:[o,(0,B.jsx)(T,{className:`size-3.5 shrink-0`})]}):(0,B.jsx)(`div`,{className:a,style:i,children:o})}function G({prefs:e,data:t,onViewQuota:n}){let{t:i,locale:o}=r(),s=t.summary,c=e.sections.overview&&s?y(s):0,l=e.sections.quota?m(t.plans):null,u=l&&l.row.remaining<30?l:null;return!s||c===0&&!u?null:(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c>0&&(0,B.jsx)(W,{tone:`red`,children:i(`tray.alert.failures`,{count:c,share:a(c/s.requests)})}),u&&(0,B.jsx)(W,{tone:u.row.remaining<10?`red`:`orange`,onClick:n,children:i(`tray.alert.quota`,{plan:u.plan.providerName,window:Q(u.row,i,o),remaining:`${Math.round(u.row.remaining)}%`})})]})}function K({onStart:e}){let{t}=r();return(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-6 text-center`,children:[(0,B.jsx)(`div`,{className:`text-[13px] font-medium`,children:t(`tray.status.stopped`)}),(0,B.jsx)(`div`,{className:`max-w-[260px] text-[12px] text-[var(--text-secondary)]`,children:t(`tray.stoppedHint`)}),(0,B.jsxs)(`button`,{type:`button`,onClick:e,className:`mt-1 inline-flex h-8 cursor-default items-center gap-1.5 rounded-[8px] bg-[var(--accent)] px-3 text-[13px] font-medium text-[var(--on-accent)]`,children:[(0,B.jsx)(k,{className:`size-3.5`}),t(`shell.startService`)]})]})}function q(e=3e4){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function J({prefs:e,data:t,onRefresh:n}){let{t:o,locale:c}=r(),f=q(),p=t.summary,m=e.sections,h=m.overview||m.cost,_=p?p.inputTokens+p.outputTokens:0,v=b(t.updatedAt,c,o(`tray.justNow`),f),y=m.topModel?l(t.top,_):null,x=m.cacheHitRate&&p?I(p.cacheReadTokens,p.inputTokens):null,w=m.compareYesterday&&p?g(_,u(t.daily,new Date(f))):null,T=m.topModel||m.cacheHitRate||m.compareYesterday;return!h&&!m.chart&&!T?null:(0,B.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[13px] text-[var(--text-secondary)]`,children:o(`tray.today`)}),(0,B.jsx)(`div`,{className:`flex-1`}),v&&(0,B.jsx)(`span`,{className:`text-[12px] text-[var(--text-muted)]`,children:o(`tray.updated`,{time:v})}),(0,B.jsx)(V,{label:o(`common.refresh`),onClick:n,children:(0,B.jsx)(A,{className:`size-3.5`})})]}),p?(0,B.jsxs)(B.Fragment,{children:[h&&(0,B.jsxs)(`div`,{className:`grid auto-cols-fr grid-flow-col gap-px overflow-hidden rounded-[10px] bg-[var(--border)]`,children:[m.overview&&(0,B.jsx)(Y,{label:o(`tray.requests`),value:s(p.requests,!0)}),m.overview&&(0,B.jsx)(Y,{label:o(`tray.tokens`),value:s(_,!0)}),m.cost&&(0,B.jsx)(Y,{label:o(`tray.cost`),value:d(p.costUsd)})]}),m.chart&&(0,B.jsx)(Z,{data:t,now:f}),T&&(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[y&&(0,B.jsxs)(X,{label:o(`tray.topModel`),title:y.model,children:[(0,B.jsx)(`span`,{className:`truncate`,children:y.model}),(0,B.jsxs)(`span`,{className:`shrink-0`,children:[`· `,a(y.share)]})]}),m.cacheHitRate&&(0,B.jsx)(X,{label:o(`tray.cacheHit`),children:(0,B.jsx)(`span`,{children:x==null?`—`:a(x)})}),m.compareYesterday&&(0,B.jsx)(X,{label:o(`tray.vsYesterday`),children:w==null?(0,B.jsx)(`span`,{children:`—`}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[w>=0?(0,B.jsx)(C,{className:`size-3`}):(0,B.jsx)(S,{className:`size-3`}),a(Math.abs(w))]})})]})]}):t.error?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--danger)]`,children:o(`tray.loadFailed`)}):(0,B.jsx)(i,{lines:2})]})}function Y({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`min-w-0 bg-[var(--surface-muted)] px-3 py-2.5`,children:[(0,B.jsx)(`div`,{className:`truncate text-[12px] text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`div`,{className:`num mt-0.5 truncate text-[20px] leading-tight font-semibold`,title:t,children:t})]})}function X({label:e,title:t,children:n}){return(0,B.jsxs)(`span`,{title:t,className:`inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-[var(--border)] px-2 py-0.5 text-[12px]`,children:[(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:e}),(0,B.jsx)(`span`,{className:`flex min-w-0 items-center gap-1 font-medium`,children:n})]})}function Z({data:e,now:t}){let{t:n}=r(),i=f(e.hourly,new Date(t)),a=Math.max(1,...i.map(e=>e.value)),o=new Date(t).getHours();return(0,B.jsx)(`div`,{role:`img`,"aria-label":n(`tray.chartLabel`),className:`flex h-16 items-end gap-[3px]`,children:i.map((e,t)=>{let r=e.value>0?Math.max(4,Math.round(e.value/a*64)):2;return(0,B.jsx)(`span`,{title:n(`tray.hourBar`,{hour:`${String(t).padStart(2,`0`)}:00`,count:e.value}),className:`flex-1 rounded-[2px]`,style:{height:r,background:t===o?`var(--accent)`:e.value>0?`color-mix(in oklab, var(--foreground) 32%, transparent)`:`var(--border)`,opacity:t>o?.5:1}},e.bucket)})})}function ne({data:e,onViewAll:t}){let{t:n,locale:i}=r();if(e.plans.length===0)return e.hasSubscriptions?(0,B.jsx)(`div`,{className:`border-t border-[var(--border)] pt-3 text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):null;let a=p(e.plans,3),o=e.plans.reduce((e,t)=>e+t.rows.length,0);return(0,B.jsxs)(`section`,{className:`flex flex-col gap-2 border-t border-[var(--border)] pt-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{className:`flex-1`,children:n(`tray.quotaTightest`)}),o>a.length&&(0,B.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex cursor-default items-center gap-0.5 hover:text-[var(--foreground)]`,children:[n(`tray.viewAll`),(0,B.jsx)(T,{className:`size-3`})]})]}),a.map(({plan:e,row:t},r)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_64px_40px_60px] items-center gap-2 text-[12.5px]`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:14}),(0,B.jsx)(`span`,{className:`truncate font-medium`,children:e.providerName}),(0,B.jsx)(`span`,{className:`shrink-0 text-[var(--text-secondary)]`,children:Q(t,n,i)})]}),(0,B.jsx)($,{row:t,locale:i})]},`${e.accountId}-${t.kind}-${r}`))]})}function re({data:e,plain:t}){let{t:n}=r();if(e.plans.length===0&&!e.hasSubscriptions)return null;let i=new Map;for(let t of e.plans)i.set(t.providerId,(i.get(t.providerId)??0)+1);return(0,B.jsxs)(`section`,{className:c(`flex flex-col gap-2`,!t&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_48px_72px] items-center gap-2 text-[12px] text-[var(--text-secondary)]`,children:[(0,B.jsx)(`span`,{children:n(`tray.quota`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaRemaining`)}),(0,B.jsx)(`span`,{className:`text-right`,children:n(`tray.quotaReset`)})]}),e.plans.length===0?(0,B.jsx)(`div`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`tray.quotaPending`)}):e.plans.map(e=>(0,B.jsx)(ie,{plan:e,showAccount:(i.get(e.providerId)??0)>1},e.accountId))]})}function Q(e,t,n){return e.kind===`balance`?e.label??t(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?t(`tray.quotaCredits`):x(e.windowMinutes,n)}function $({row:e,locale:t}){let n=e.remaining,r=n===null?void 0:ee[v(n)];return(0,B.jsxs)(B.Fragment,{children:[n===null?(0,B.jsx)(`span`,{}):(0,B.jsx)(`span`,{className:`h-1.5 overflow-hidden rounded-full bg-[var(--surface-muted)]`,children:(0,B.jsx)(`span`,{className:`block h-full rounded-full`,style:{width:`${n}%`,background:r}})}),e.amount?(0,B.jsx)(`span`,{className:`num col-span-2 truncate text-right font-medium`,children:h(e.amount.value,e.amount.unit,t)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`num text-right font-medium`,children:n===null?`—`:`${Math.round(n)}%`}),(0,B.jsx)(`span`,{className:`truncate text-right text-[var(--text-secondary)]`,children:_(e.resetsAt,t)??`—`})]})]})}function ie({plan:e,showAccount:t}){let{t:n,locale:i}=r();return(0,B.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(R,{name:e.providerName,icon:e.providerIcon,size:16}),(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.providerName}),t&&(0,B.jsx)(`span`,{className:`truncate text-[12px] text-[var(--text-muted)]`,children:e.accountName})]}),e.rows.map((e,t)=>{let r=Q(e,n,i);return(0,B.jsxs)(`div`,{className:`grid grid-cols-[52px_1fr_48px_72px] items-center gap-2 pl-6 text-[12.5px]`,children:[(0,B.jsx)(`span`,{className:`truncate text-[var(--text-secondary)]`,title:r,children:r}),(0,B.jsx)($,{row:e,locale:i})]},`${e.kind}-${t}`)})]})}function ae({data:e,disabled:t,onSwitch:n,plain:i}){let{t:a}=r(),o=e.clients.filter(e=>e.enabled);if(o.length===0)return null;let s=t=>e.providers.find(e=>e.id===t)?.name??a(`tray.unbound`);return(0,B.jsxs)(`section`,{className:c(`flex flex-col gap-1`,!i&&`border-t border-[var(--border)] pt-3`),children:[(0,B.jsx)(`div`,{className:`mb-0.5 text-[12px] text-[var(--text-secondary)]`,children:a(`tray.clients`)}),o.map(e=>(0,B.jsxs)(`button`,{type:`button`,disabled:t||!n,onClick:()=>n?.(e),"aria-label":a(`tray.switchProvider`,{client:e.name}),className:`-mx-2 flex h-8 cursor-default items-center gap-2 rounded-[8px] px-2 text-left transition-colors enabled:hover:bg-[var(--surface-muted)]`,children:[e.kind in L&&(0,B.jsx)(F,{kind:e.kind,size:16}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,B.jsx)(`span`,{className:`max-w-[45%] truncate text-[12px] text-[var(--text-secondary)]`,children:s(e.providerId)}),n&&(0,B.jsx)(E,{className:`size-3.5 shrink-0 text-[var(--text-muted)]`})]},e.kind))]})}export{te as t};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{$ as n,$s as r,As as i,Bs as a,C as o,Ds as s,E as c,Es as l,Fs as u,J as d,Js as f,Ks as p,Ms as m,Ns as h,Os as g,Q as _,Rs as v,T as y,Ts as b,Xo as x,Xs as S,Y as C,Zo as w,ar as T,at as E,cs as D,ct as O,dt as k,ec as A,es as j,et as M,f as N,fs as P,ft as F,h as I,it as L,js as ee,k as te,ks as R,ls as ne,mt as re,nt as z,os as ie,ot as B,ps as ae,qo as oe,rt as se,ss as V,st as ce,tt as le,us as ue,ut as H,ws as de,wt as fe}from"./format-DFMHYFFs.js";import{t as pe}from"./check-DKfsh0bQ.js";import{t as me}from"./chevron-down-CQQqnJvT.js";import{t as he}from"./chevron-up-BNvDpRa-.js";import{t as ge}from"./search-NI5nOaOz.js";import{t as _e}from"./x-AFrW8zH7.js";function ve(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var ye=class extends a{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,v.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!S(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ve(e,n).forEach(e=>{e.destroy()}),ve(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=f(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new u(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&v.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},U=e(t(),1);function be({queries:e,...t},n){let a=r(n),o=h(),c=m(),d=t.subscribed!==!1,f=U.useMemo(()=>e.map(e=>{let t=a.defaultQueryOptions(e);return t._optimisticResults=o?`isRestoring`:d?`optimistic`:void 0,t}),[e,a,o,d]);f.forEach(e=>{l(e);let t=a.getQueryCache().get(e.queryHash);R(e,c,t)}),ee(c);let[_]=U.useState(()=>new ye(a,f,t)),[y,b,x]=_.getOptimisticResult(f,t.combine),S=!o&&d;U.useSyncExternalStore(U.useCallback(e=>S?_.subscribe(v.batchCalls(e)):p,[_,S]),()=>_.getCurrentResult(),()=>_.getCurrentResult()),U.useEffect(()=>{_.setQueries(f,t)},[f,t,_]);let C=y.some((e,t)=>g(f[t],e))?y.flatMap((e,t)=>{let n=f[t];if(n&&g(n,e)){let e=new u(a,n);return s(n,e,c)}return[]}):[];if(C.length>0)throw Promise.all(C);let w=y.find((e,t)=>{let n=f[t];return n&&i({result:e,errorResetBoundary:c,throwOnError:n.throwOnError,query:a.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(w)throw w.error;return b(x())}var W={field:`_field_6szcl_1`,control:`_control_6szcl_3`,disabled:`_disabled_6szcl_4`,open:`_open_6szcl_6`,searchIcon:`_searchIcon_6szcl_8`,chevron:`_chevron_6szcl_12`,clear:`_clear_6szcl_14`,hint:`_hint_6szcl_17`,popover:`_popover_6szcl_18`,autoHeight:`_autoHeight_6szcl_19`,listbox:`_listbox_6szcl_20`,option:`_option_6szcl_22`,check:`_check_6szcl_26`,empty:`_empty_6szcl_27`},G=A();function xe({children:e,reduceMotion:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)(`auto`);return(0,U.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(()=>i(e.offsetHeight));return t.observe(e),()=>t.disconnect()},[]),(0,G.jsx)(V.div,{className:W.autoHeight,initial:!1,animate:{height:r},transition:t?{duration:0}:_.spring.smooth,children:(0,G.jsx)(`div`,{ref:n,children:e})})}var Se=(0,U.forwardRef)(function({label:e,options:t,value:n,defaultValue:r=``,onValueChange:i,description:a,placeholder:o=`Search or select…`,emptyMessage:s=`No matches found`,id:c,className:l,disabled:u,onFocus:d,...f},p){let m=(0,U.useId)(),h=c??m,g=`${h}-listbox`,v=a?`${h}-description`:void 0,y=(0,U.useRef)(null),b=(0,U.useRef)(null),x=(0,U.useRef)({}),S=ne(),[C,w]=(0,U.useState)(r),[T,E]=(0,U.useState)(!1),[O,k]=(0,U.useState)(``),[A,j]=(0,U.useState)(-1),M=n??C,N=t.find(e=>e.value===M);(0,U.useImperativeHandle)(p,()=>b.current);let F=(0,U.useRef)(M);(0,U.useEffect)(()=>{if(F.current===M)return;F.current=M;let e=b.current;if(!e||S||M&&T)return;let t=M?D(e,{opacity:[0,1],y:[`0.35em`,`0em`],filter:[`blur(${_.blur.soft}px)`,`blur(0px)`]},{duration:_.duration.standard,ease:[..._.ease.enter]}):D(e,{opacity:[0,1]},{duration:_.duration.fast,ease:[..._.ease.enter]});return()=>t.complete()},[M,S,T]);let I=(0,U.useMemo)(()=>{let e=O.trim().toLocaleLowerCase();return e?t.filter(t=>[t.label,...t.keywords??[]].some(t=>t.toLocaleLowerCase().includes(e))):t},[t,O]),L=I.reduce((e,t,n)=>(t.disabled||e.push(n),e),[]);(0,U.useEffect)(()=>{if(!T)return;let e=A>=0?I[A]:void 0,t=e?x.current[e.value]:null,n=t?.parentElement;if(t&&n){let e=t.offsetTop,r=e+t.offsetHeight;e<n.scrollTop?n.scrollTop=e:r>n.scrollTop+n.clientHeight&&(n.scrollTop=r-n.clientHeight)}},[A,I,T]),(0,U.useEffect)(()=>{let e=e=>{y.current&&!y.current.contains(e.target)&&(E(!1),k(``))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]);let ee=e=>{e.disabled||(w(e.value),i?.(e.value),k(``),E(!1),b.current?.focus())},te=e=>{e.preventDefault(),w(``),i?.(``),k(``),E(!0),b.current?.focus()},R=()=>{u||(E(!0),k(``),j(-1))},re=e=>{if(!u){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!T){R();return}if(!L.length)return;let t=L.indexOf(A),n=e.key===`ArrowDown`?(t+1)%L.length:(t-1+L.length)%L.length;j(L[n]);return}if(e.key===`Enter`&&T&&A>=0){e.preventDefault();let t=I[A];t&&ee(t);return}if(e.key===`Escape`&&T){e.preventDefault(),E(!1),k(``);return}}},z=T?O:N?.label??``,ie=A>=0?I[A]:void 0;return(0,G.jsxs)(`div`,{ref:y,className:W.field,children:[(0,G.jsx)(`label`,{htmlFor:h,children:e}),(0,G.jsxs)(`div`,{className:[W.control,T?W.open:``,u?W.disabled:``,l??``].filter(Boolean).join(` `),children:[(0,G.jsx)(ge,{className:W.searchIcon,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,G.jsx)(`input`,{...f,ref:b,id:h,type:`text`,role:`combobox`,value:z,placeholder:N?.label??o,disabled:u,"aria-describedby":v,"aria-expanded":T,"aria-controls":T?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":T&&ie?`${h}-option-${ie.value}`:void 0,onFocus:e=>{d?.(e),R()},onClick:R,onChange:e=>{k(e.target.value),E(!0),j(-1)},onKeyDown:re}),(0,G.jsx)(P,{initial:!1,children:N&&!u&&(0,G.jsx)(V.button,{type:`button`,className:W.clear,"aria-label":`Clear selection`,onMouseDown:e=>e.preventDefault(),onClick:te,initial:S?{opacity:0}:{opacity:0,scale:.6,filter:`blur(${_.blur.subtle}px)`},animate:{opacity:1,scale:1,filter:`blur(0px)`,transition:S?{duration:_.duration.instant}:{..._.spring.snappy,opacity:{duration:_.duration.fast}}},exit:{opacity:0,...S?{}:{scale:.6,filter:`blur(${_.blur.subtle}px)`},transition:{duration:_.duration.instant,ease:[..._.ease.standard]}},whileTap:{scale:S?1:.96,transition:{duration:_.duration.instant,ease:[..._.ease.standard]}},children:(0,G.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})}),(0,G.jsx)(me,{className:W.chevron,size:16,strokeWidth:1.75,"aria-hidden":`true`})]}),a&&(0,G.jsx)(`span`,{id:v,className:W.hint,children:a}),(0,G.jsx)(P,{initial:!1,children:T&&(0,G.jsx)(V.div,{className:W.popover,initial:S?{opacity:0}:{opacity:0,y:-6,scale:.97},animate:{opacity:1,y:0,scale:1,transition:S?{duration:_.duration.instant}:{..._.spring.snappy,opacity:{duration:_.duration.fast,ease:[..._.ease.enter]}}},exit:{opacity:0,...S?{}:{y:-4,scale:.98},transition:{duration:_.duration.instant,ease:[..._.ease.standard]}},role:`presentation`,children:(0,G.jsx)(xe,{reduceMotion:S,children:(0,G.jsx)(`div`,{id:g,className:W.listbox,role:`listbox`,"aria-label":`${e} options`,children:I.length?I.map((e,t)=>(0,G.jsxs)(`div`,{ref:t=>{x.current[e.value]=t},id:`${h}-option-${e.value}`,className:W.option,"data-active":t===A?`true`:void 0,"data-disabled":e.disabled?`true`:void 0,role:`option`,"aria-selected":e.value===M,"aria-disabled":e.disabled||void 0,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>!e.disabled&&j(t),onClick:()=>ee(e),children:[(0,G.jsx)(`span`,{children:e.label}),e.value===M&&(0,G.jsx)(pe,{className:W.check,size:16,strokeWidth:1.75,"aria-hidden":`true`})]},e.value)):(0,G.jsx)(V.div,{className:W.empty,role:`status`,initial:!S&&{opacity:0,y:4,filter:`blur(${_.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},transition:{duration:_.duration.standard,ease:[..._.ease.enter]},children:s})})})})})]})});Se.displayName=`Combobox`;var Ce=Object.defineProperty,we=(e,t)=>Ce(e,`name`,{value:t,configurable:!0});function K(e){let t=U.useRef(e);return U.useEffect(()=>{t.current=e}),U.useMemo(()=>((...e)=>t.current?.(...e)),[])}we(K,`useCallbackRef`);var Te=Object.defineProperty,q=(e,t)=>Te(e,`name`,{value:t,configurable:!0}),Ee=`dismissableLayer.update`,De=`dismissableLayer.pointerDownOutside`,Oe=`dismissableLayer.focusOutside`,ke,Ae=U.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),je=U.forwardRef(q(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=U.useContext(Ae),[d,f]=U.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=U.useState({}),h=H(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=U.useRef(!1),C=Pe(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:U.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Fe(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=K(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return U.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),U.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ke=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ie(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=ke))}},[d,p,n,u]),U.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ie())},[d,u]),U.useEffect(()=>{let e=q(()=>m({}),`handleUpdate`);return document.addEventListener(Ee,e),()=>document.removeEventListener(Ee,e)},[]),(0,G.jsx)(z.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:B(e.onFocusCapture,w.onFocusCapture),onBlurCapture:B(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:B(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function Me(){let e=U.useContext(Ae),[t,n]=U.useState(null);return U.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}q(Me,`useDismissableLayerSurface`);var Ne=q(()=>!0,`IS_TRUE`);function Pe(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Ne}=t,s=K(e),c=U.useRef(!1),l=U.useRef(!1),u=U.useRef(new Map),d=U.useRef(()=>{});return U.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}q(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}q(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}q(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}q(p,`handleInteractionBubble`);let m=q(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Le(De,s,p,{discrete:!0})};if(q(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:q(()=>c.current=!0,`onPointerDownCapture`)}}q(Pe,`usePointerDownOutside`);function Fe(e,t=globalThis?.document){let n=K(e),r=U.useRef(!1);return U.useEffect(()=>{let e=q(e=>{e.target&&!r.current&&Le(Oe,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:q(()=>r.current=!0,`onFocusCapture`),onBlurCapture:q(()=>r.current=!1,`onBlurCapture`)}}q(Fe,`useFocusOutside`);function Ie(){let e=new CustomEvent(Ee);document.dispatchEvent(e)}q(Ie,`dispatchUpdate`);function Le(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?se(i,a):i.dispatchEvent(a)}q(Le,`handleAndDispatchCustomEvent`);var Re=Object.defineProperty,J=(e,t)=>Re(e,`name`,{value:t,configurable:!0}),ze=`focusScope.autoFocusOnMount`,Be=`focusScope.autoFocusOnUnmount`,Ve={bubbles:!1,cancelable:!0},He=U.forwardRef(J(function(e,t){let{loop:n=!1,trapped:r=!1,branches:i,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[c,l]=U.useState(null),u=K(a),d=K(o),f=U.useRef(null),p=H(t,l),m=U.useRef(i);U.useEffect(()=>{m.current=i});let h=U.useCallback(e=>e?c?.contains(e)?!0:!!m.current?.some(t=>t.contains(e)):!1,[c]),g=U.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;U.useEffect(()=>{if(r){let e=function(e){if(g.paused||!c)return;let t=e.target;h(t)?f.current=t:$e(f.current,{select:!0})},t=function(e){if(g.paused||!c)return;let t=e.relatedTarget;t!==null&&(h(t)||$e(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&$e(c)};J(e,`handleFocusIn`),J(t,`handleFocusOut`),J(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,c,g.paused,h]),U.useEffect(()=>{if(c){et.add(g);let e=document.activeElement;if(!c.contains(e)){let t=new CustomEvent(ze,Ve);c.addEventListener(ze,u),c.dispatchEvent(t),t.defaultPrevented||(qe(rt(Ye(c)),{select:!0}),document.activeElement===e&&$e(c))}return()=>{c.removeEventListener(ze,u),setTimeout(()=>{let t=new CustomEvent(Be,Ve);c.addEventListener(Be,d),c.dispatchEvent(t),t.defaultPrevented||$e(e??document.body,{select:!0}),c.removeEventListener(Be,d),et.remove(g)},0)}}},[c,u,d,g]);let _=U.useCallback(e=>{if(!n&&!r||g.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Je(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&$e(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&$e(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,g.paused]);return(0,G.jsx)(z.div,{tabIndex:-1,...s,ref:p,onKeyDown:_})},`FocusScope`)),Ue=U.createContext(null);function We({registry:e,children:t}){return e?(0,G.jsx)(Ue.Provider,{value:e,children:t}):t}J(We,`FocusScopeBranchProvider`);function Ge(){let[e,t]=U.useState([]);return{nodes:e,registry:U.useMemo(()=>({add:J(e=>t(t=>t.includes(e)?t:[...t,e]),`add`),remove:J(e=>t(t=>t.filter(t=>t!==e)),`remove`)}),[])}}J(Ge,`useFocusScopeBranchRegistry`);function Ke(e){let t=U.useContext(Ue);U.useEffect(()=>{if(e&&t)return t.add(e),()=>t.remove(e)},[e,t])}J(Ke,`useFocusScopeBranch`);function qe(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if($e(r,{select:t}),document.activeElement!==n)return}J(qe,`focusFirst`);function Je(e){let t=Ye(e);return[Xe(t,e),Xe(t.reverse(),e)]}J(Je,`getTabbableEdges`);function Ye(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:J(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}J(Ye,`getTabbableCandidates`);function Xe(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ze(r,{upTo:t})))return r}J(Xe,`findVisible`);function Ze(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}J(Ze,`isHidden`);function Qe(e){return e instanceof HTMLInputElement&&`select`in e}J(Qe,`isSelectableInput`);function $e(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Qe(e)&&t&&e.select()}}J($e,`focus`);var et=tt();function tt(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=nt(e,t),e.unshift(t)},remove(t){e=nt(e,t),e[0]?.resume()}}}J(tt,`createFocusScopesStack`);function nt(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}J(nt,`arrayRemove`);function rt(e){return e.filter(e=>e.tagName!==`A`)}J(rt,`removeLinks`);var it=e(ie(),1),at=Object.defineProperty,ot=U.forwardRef(((e,t)=>at(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=U.useState(!1);E(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?it.createPortal((0,G.jsx)(z.div,{...r,ref:t}),o):null},`Portal`)),st=Object.defineProperty,ct=(e,t)=>st(e,`name`,{value:t,configurable:!0}),lt=0,ut=null;function dt(e){return ft(),e.children}ct(dt,`FocusGuards`);function ft(){U.useEffect(()=>{ut||={start:pt(),end:pt()};let{start:e,end:t}=ut;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),lt++,()=>{lt===1&&(ut?.start.remove(),ut?.end.remove(),ut=null),lt=Math.max(0,lt-1)}},[])}ct(ft,`useFocusGuards`);function pt(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}ct(pt,`createFocusGuard`);var mt=function(){return mt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mt.apply(this,arguments)};function ht(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function gt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var _t=`right-scroll-bar-position`,vt=`width-before-scroll-bar`,yt=`with-scroll-bars-hidden`,bt=`--removed-body-scroll-bar-size`;function xt(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function St(e,t){var n=(0,U.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Ct=typeof window<`u`?U.useLayoutEffect:U.useEffect,wt=new WeakMap;function Tt(e,t){var n=St(t||null,function(t){return e.forEach(function(e){return xt(e,t)})});return Ct(function(){var t=wt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||xt(e,null)}),i.forEach(function(e){r.has(e)||xt(e,a)})}wt.set(n,e)},[e]),n}function Et(e){return e}function Dt(e,t){t===void 0&&(t=Et);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ot(e){e===void 0&&(e={});var t=Dt(null);return t.options=mt({async:!0,ssr:!1},e),t}var kt=function(e){var t=e.sideCar,n=ht(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return U.createElement(r,mt({},n))};kt.isSideCarExport=!0;function At(e,t){return e.useMedium(t),kt}var jt=Ot(),Mt=function(){},Nt=U.forwardRef(function(e,t){var n=U.useRef(null),r=U.useState({onScrollCapture:Mt,onWheelCapture:Mt,onTouchMoveCapture:Mt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=ht(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Tt([n,t]),C=mt(mt({},b),i);return U.createElement(U.Fragment,null,u&&U.createElement(x,{sideCar:jt,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?U.cloneElement(U.Children.only(s),mt(mt({},C),{ref:S})):U.createElement(v,mt({},C,{className:c,ref:S}),s))});Nt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Nt.classNames={fullWidth:vt,zeroRight:_t};var Pt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ft(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Pt();return t&&e.setAttribute(`nonce`,t),e}function It(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Lt(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Rt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ft())&&(It(t,n),Lt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},zt=function(){var e=Rt();return function(t,n){U.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Bt=function(){var e=zt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Vt={left:0,top:0,right:0,gap:0},Ht=function(e){return parseInt(e||``,10)||0},Ut=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ht(n),Ht(r),Ht(i)]},Wt=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Vt;var t=Ut(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Gt=Bt(),Kt=`data-scroll-locked`,qt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
2
|
+
.${yt} {
|
|
3
|
+
overflow: hidden ${r};
|
|
4
|
+
padding-right: ${s}px ${r};
|
|
5
|
+
}
|
|
6
|
+
body[${Kt}] {
|
|
7
|
+
overflow: hidden ${r};
|
|
8
|
+
overscroll-behavior: contain;
|
|
9
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
10
|
+
padding-left: ${i}px;
|
|
11
|
+
padding-top: ${a}px;
|
|
12
|
+
padding-right: ${o}px;
|
|
13
|
+
margin-left:0;
|
|
14
|
+
margin-top:0;
|
|
15
|
+
margin-right: ${s}px ${r};
|
|
16
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.${_t} {
|
|
20
|
+
right: ${s}px ${r};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.${vt} {
|
|
24
|
+
margin-right: ${s}px ${r};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${_t} .${_t} {
|
|
28
|
+
right: 0 ${r};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${vt} .${vt} {
|
|
32
|
+
margin-right: 0 ${r};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body[${Kt}] {
|
|
36
|
+
${bt}: ${s}px;
|
|
37
|
+
}
|
|
38
|
+
`},Jt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Yt=function(){U.useEffect(function(){return document.body.setAttribute(Kt,(Jt()+1).toString()),function(){var e=Jt()-1;e<=0?document.body.removeAttribute(Kt):document.body.setAttribute(Kt,e.toString())}},[])},Xt=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Yt();var a=U.useMemo(function(){return Wt(i)},[i]);return U.createElement(Gt,{styles:qt(a,!t,i,n?``:`!important`)})},Zt=!1;if(typeof window<`u`)try{var Qt=Object.defineProperty({},"passive",{get:function(){return Zt=!0,!0}});window.addEventListener(`test`,Qt,Qt),window.removeEventListener(`test`,Qt,Qt)}catch{Zt=!1}var $t=Zt?{passive:!1}:!1,en=function(e){return e.tagName===`TEXTAREA`},tn=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!en(e)&&n[t]===`visible`)},nn=function(e){return tn(e,`overflowY`)},rn=function(e){return tn(e,`overflowX`)},an=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),cn(e,r)){var i=ln(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},on=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},sn=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},cn=function(e,t){return e===`v`?nn(t):rn(t)},ln=function(e,t){return e===`v`?on(t):sn(t)},un=function(e,t){return e===`h`&&t===`rtl`?-1:1},dn=function(e,t,n,r,i){var a=un(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ln(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&cn(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},fn=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pn=function(e){return[e.deltaX,e.deltaY]},mn=function(e){return e&&`current`in e?e.current:e},hn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gn=function(e){return`
|
|
39
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
40
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
41
|
+
`},_n=0,vn=[];function yn(e){var t=U.useRef([]),n=U.useRef([0,0]),r=U.useRef(),i=U.useState(_n++)[0],a=U.useState(Bt)[0],o=U.useRef(e);U.useEffect(function(){o.current=e},[e]),U.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=gt([e.lockRef.current],(e.shards||[]).map(mn),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=U.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=fn(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=an(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=an(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return dn(h,t,e,h===`h`?s:c,!0)},[]),c=U.useCallback(function(e){var n=e;if(vn.length&&vn[vn.length-1]===a){var r=`deltaY`in n?pn(n):fn(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&hn(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(mn).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=U.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:bn(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=U.useCallback(function(e){n.current=fn(e),r.current=void 0},[]),d=U.useCallback(function(t){l(t.type,pn(t),t.target,s(t,e.lockRef.current))},[]),f=U.useCallback(function(t){l(t.type,fn(t),t.target,s(t,e.lockRef.current))},[]);U.useEffect(function(){return vn.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,$t),document.addEventListener(`touchmove`,c,$t),document.addEventListener(`touchstart`,u,$t),function(){vn=vn.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,$t),document.removeEventListener(`touchmove`,c,$t),document.removeEventListener(`touchstart`,u,$t)}},[]);var p=e.removeScrollBar,m=e.inert;return U.createElement(U.Fragment,null,m?U.createElement(a,{styles:gn(i)}):null,p?U.createElement(Xt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var xn=At(jt,yn),Sn=U.forwardRef(function(e,t){return U.createElement(Nt,mt({},e,{ref:t,sideCar:xn}))});Sn.classNames=Nt.classNames;var Cn=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},wn=new WeakMap,Tn=new WeakMap,En={},Dn=0,On=function(e){return e&&(e.host||On(e.parentNode))},kn=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=On(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},An=function(e,t,n,r){var i=kn(t,Array.isArray(e)?e:[e]);En[n]||(En[n]=new WeakMap);var a=En[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(wn.get(e)||0)+1,l=(a.get(e)||0)+1;wn.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Tn.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Dn++,function(){o.forEach(function(e){var t=wn.get(e)-1,i=a.get(e)-1;wn.set(e,t),a.set(e,i),t||(Tn.has(e)||e.removeAttribute(r),Tn.delete(e)),i||e.removeAttribute(n)}),Dn--,Dn||(wn=new WeakMap,wn=new WeakMap,Tn=new WeakMap,En={})}},jn=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Cn(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),An(r,i,n,`aria-hidden`)):function(){return null}},Mn=Object.defineProperty,Y=(e,t)=>Mn(e,`name`,{value:t,configurable:!0}),Nn=`Dialog`,[Pn,Fn]=k(Nn),[In,Ln]=Pn(Nn),Rn=Y(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=U.useRef(null),c=U.useRef(null),{nodes:l,registry:u}=Ge(),[d,f]=L({prop:r,defaultProp:i??!1,onChange:a,caller:Nn}),[p,m]=U.useState(0),[h,g]=U.useState(0);return(0,G.jsx)(In,{scope:t,triggerRef:s,contentRef:c,contentId:M(),titleId:M(),descriptionId:M(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:U.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),zn=`DialogPortal`,[Bn,Vn]=Pn(zn,{forceMount:void 0}),Hn=Y(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ln(zn,t);return(0,G.jsx)(Bn,{scope:t,forceMount:n,children:U.Children.map(r,e=>(0,G.jsx)(le,{present:n||a.open,children:(0,G.jsx)(ot,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Un=`DialogOverlay`,Wn=U.forwardRef(Y(function(e,t){let n=Vn(Un,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ln(Un,e.__scopeDialog);return a.modal?(0,G.jsx)(le,{present:r||a.open,children:(0,G.jsx)(Kn,{...i,ref:t})}):null},`DialogOverlay`)),Gn=O(`DialogOverlay.RemoveScroll`),Kn=U.forwardRef(Y(function(e,t){let{__scopeDialog:n,...r}=e,i=Ln(Un,n),a=Me(),o=H(t,a);return(0,G.jsx)(Sn,{as:Gn,allowPinchZoom:!0,shards:U.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,G.jsx)(z.div,{"data-state":rr(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),qn=`DialogContent`,Jn=U.forwardRef(Y(function(e,t){let n=Vn(qn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ln(qn,e.__scopeDialog);return(0,G.jsx)(le,{present:r||a.open,children:a.modal?(0,G.jsx)(Yn,{...i,ref:t}):(0,G.jsx)(Xn,{...i,ref:t})})},`DialogContent`)),Yn=U.forwardRef(Y(function(e,t){let n=Ln(qn,e.__scopeDialog),r=U.useRef(null),i=H(t,n.contentRef,r);return U.useEffect(()=>{let e=r.current;if(e)return jn(e)},[]),(0,G.jsx)(Zn,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:B(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Xn=U.forwardRef(Y(function(e,t){let n=Ln(qn,e.__scopeDialog),r=U.useRef(!1),i=U.useRef(!1);return(0,G.jsx)(Zn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Zn=U.forwardRef(Y(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Ln(qn,n);return ft(),(0,G.jsx)(We,{registry:l.branchRegistry,children:(0,G.jsx)(He,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(je,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?nr(o,l.descriptionId):o,"data-state":rr(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Qn=U.forwardRef(Y(function(e,t){let{__scopeDialog:n,...r}=e,i=Ln(`DialogTitle`,n),{setTitleCount:a}=i;return E(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(z.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),$n=U.forwardRef(Y(function(e,t){let{__scopeDialog:n,...r}=e,i=Ln(`DialogDescription`,n),{setDescriptionCount:a}=i;return E(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(z.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),er=`DialogClose`,tr=U.forwardRef(Y(function(e,t){let{__scopeDialog:n,...r}=e,i=Ln(er,n);return(0,G.jsx)(z.button,{type:`button`,...r,ref:t,onClick:B(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function nr(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Y(nr,`concatAriaDescribedby`);function rr(e){return e?`open`:`closed`}Y(rr,`getState`);var ir={overlay:`_overlay_1vyy5_1`,content:`_content_1vyy5_5`,keyframes:`_keyframes_1vyy5_9`,"overlay-in":`_overlay-in_1vyy5_1`,"overlay-out":`_overlay-out_1vyy5_1`,"content-fade-in":`_content-fade-in_1vyy5_1`,"content-rise-in":`_content-rise-in_1vyy5_1`,"content-out":`_content-out_1vyy5_1`,header:`_header_1vyy5_16`,title:`_title_1vyy5_17`,description:`_description_1vyy5_18`,swap:`_swap_1vyy5_20`,close:`_close_1vyy5_24`,body:`_body_1vyy5_27`,"content-fade-out":`_content-fade-out_1vyy5_1`},ar=(0,U.createContext)(null);function or({open:e,defaultOpen:t=!1,onOpenChange:n,...r}){let[i,a]=(0,U.useState)(t),o=e??i,s=(0,U.useCallback)(t=>{e===void 0&&a(t),n?.(t)},[e,n]);return(0,G.jsx)(ar.Provider,{value:o,children:(0,G.jsx)(Rn,{...r,open:o,onOpenChange:s})})}var sr={duration:_.duration.instant},cr={duration:_.duration.fast,ease:[..._.ease.standard]};function lr({text:e}){let t=ne();return(0,G.jsx)(P,{mode:`popLayout`,initial:!1,children:(0,G.jsx)(V.span,{className:ir.swap,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${_.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${_.blur.subtle}px)`,transition:{duration:_.duration.fast,ease:[..._.ease.standard]}},transition:{duration:_.duration.standard,ease:[..._.ease.enter]},children:e},e)})}function ur({title:e,description:t,children:n,className:r,onPointerDownOutside:i,...a}){let o=(0,U.useContext)(ar),s=ne(),c=(0,U.useRef)({open:o,at:0});(0,U.useLayoutEffect)(()=>{c.current={open:o,at:performance.now()}},[o]);let l=e=>{i?.(e),o!==null&&(!c.current.open||e.detail.originalEvent.timeStamp<c.current.at)&&e.preventDefault()},u=[ir.content,r].filter(Boolean).join(` `),d=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:ir.header,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Qn,{className:ir.title,children:(0,G.jsx)(lr,{text:e})}),t?(0,G.jsx)($n,{className:ir.description,children:(0,G.jsx)(lr,{text:t})}):null]}),(0,G.jsx)(tr,{className:ir.close,"aria-label":`Close dialog`,children:(0,G.jsx)(_e,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,G.jsx)(`div`,{className:ir.body,children:n})]});return o===null?(0,G.jsxs)(Hn,{children:[(0,G.jsx)(Wn,{className:`${ir.overlay} ${ir.keyframes}`}),(0,G.jsx)(Jn,{...a,onPointerDownOutside:l,className:`${u} ${ir.keyframes}`,children:d})]}):(0,G.jsx)(P,{children:o&&(0,G.jsxs)(Hn,{forceMount:!0,children:[(0,G.jsx)(Wn,{asChild:!0,forceMount:!0,children:(0,G.jsx)(V.div,{className:ir.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:s?sr:cr},transition:s?sr:{duration:_.duration.standard,ease:[..._.ease.enter]}})}),(0,G.jsx)(Jn,{...a,onPointerDownOutside:l,asChild:!0,forceMount:!0,children:(0,G.jsx)(V.div,{className:u,initial:s?{opacity:0}:{opacity:0,y:8,scale:.96},animate:{opacity:1,y:0,scale:1},exit:s?{opacity:0,transition:sr}:{opacity:0,y:4,scale:.98,transition:cr},transition:s?sr:{default:_.spring.smooth,opacity:{duration:_.duration.fast,ease:[..._.ease.enter]}},children:d})})]},`dialog`)})}var dr=[`top`,`right`,`bottom`,`left`],fr=Math.min,pr=Math.max,mr=Math.round,hr=Math.floor,gr=e=>({x:e,y:e}),_r={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function vr(e,t,n){return pr(e,fr(t,n))}function yr(e,t){return typeof e==`function`?e(t):e}function br(e){return e.split(`-`)[0]}function xr(e){return e.split(`-`)[1]}function Sr(e){return e===`x`?`y`:`x`}function Cr(e){return e===`y`?`height`:`width`}function wr(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Tr(e){return Sr(wr(e))}function Er(e,t,n){n===void 0&&(n=!1);let r=xr(e),i=Tr(e),a=Cr(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fr(o)),[o,Fr(o)]}function Dr(e){let t=Fr(e);return[Or(e),t,Or(t)]}function Or(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var kr=[`left`,`right`],Ar=[`right`,`left`],jr=[`top`,`bottom`],Mr=[`bottom`,`top`];function Nr(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ar:kr:t?kr:Ar;case`left`:case`right`:return t?jr:Mr;default:return[]}}function Pr(e,t,n,r){let i=xr(e),a=Nr(br(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Or)))),a}function Fr(e){let t=br(e);return _r[t]+e.slice(t.length)}function Ir(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Lr(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ir(e)}function Rr(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function zr(e,t,n){let{reference:r,floating:i}=e,a=wr(t),o=Tr(t),s=Cr(o),c=br(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=xr(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Br(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=yr(t,e),p=Lr(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Rr(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Rr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Vr=50,Hr=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Br},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=zr(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Vr&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=zr(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Ur=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=yr(e,t)||{};if(l==null)return{};let d=Lr(u),f={x:n,y:r},p=Tr(i),m=Cr(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=fr(d[_],T),D=fr(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=vr(E,k,O),j=!c.arrow&&xr(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Wr=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=yr(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=br(r),_=wr(o),v=br(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fr(o)]:Dr(o)),x=p!==`none`;!d&&x&&b.push(...Pr(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Er(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===wr(t)||T.every(e=>wr(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=wr(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Gr(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kr(e){return dr.some(t=>e[t]>=0)}var qr=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=yr(e,t);switch(i){case`referenceHidden`:{let e=Gr(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Kr(e)}}}case`escaped`:{let e=Gr(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Kr(e)}}}default:return{}}}}},Jr=new Set([`left`,`top`]);async function Yr(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=br(n),s=xr(n),c=wr(n)===`y`,l=Jr.has(o)?-1:1,u=a&&c?-1:1,d=yr(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Xr=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Yr(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Zr=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=yr(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=wr(i),p=Sr(f),m=u[p],h=u[f],g=(e,t)=>vr(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Qr=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=yr(e,t),u={x:n,y:r},d=wr(i),f=Sr(d),p=u[f],m=u[d],h=yr(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Jr.has(br(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$r=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=yr(e,t),c=await i.detectOverflow(t,s),l=br(n),u=xr(n),d=wr(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=fr(p-c[m],g),y=fr(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*pr(c.left,c.right):S=p-2*pr(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function ei(){return typeof window<`u`}function ti(e){return ri(e)?(e.nodeName||``).toLowerCase():`#document`}function X(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ni(e){return((ri(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ri(e){return ei()?e instanceof Node||e instanceof X(e).Node:!1}function ii(e){return ei()?e instanceof Element||e instanceof X(e).Element:!1}function ai(e){return ei()?e instanceof HTMLElement||e instanceof X(e).HTMLElement:!1}function oi(e){return!ei()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof X(e).ShadowRoot}function si(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=vi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ci(e){return/^(table|td|th)$/.test(ti(e))}function li(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ui=/transform|translate|scale|rotate|perspective|filter/,di=/paint|layout|strict|content/,fi=e=>!!e&&e!==`none`,pi;function mi(e){let t=ii(e)?vi(e):e;return fi(t.transform)||fi(t.translate)||fi(t.scale)||fi(t.rotate)||fi(t.perspective)||!gi()&&(fi(t.backdropFilter)||fi(t.filter))||ui.test(t.willChange||``)||di.test(t.contain||``)}function hi(e){let t=bi(e);for(;ai(t)&&!_i(t);){if(mi(t))return t;if(li(t))return null;t=bi(t)}return null}function gi(){return pi??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),pi}function _i(e){return/^(html|body|#document)$/.test(ti(e))}function vi(e){return X(e).getComputedStyle(e)}function yi(e){return ii(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function bi(e){if(ti(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||oi(e)&&e.host||ni(e);return oi(t)?t.host:t}function xi(e){let t=bi(e);return _i(t)?(e.ownerDocument||e).body:ai(t)&&si(t)?t:xi(t)}function Si(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=xi(e),i=r===e.ownerDocument?.body,a=X(r);if(i){let e=Ci(a);return t.concat(a,a.visualViewport||[],si(r)?r:[],e&&n?Si(e):[])}return t.concat(r,Si(r,[],n))}function Ci(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wi(e){let t=vi(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ai(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=mr(n)!==a||mr(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ti(e){return ii(e)?e:e.contextElement}function Ei(e){let t=Ti(e);if(!ai(t))return gr(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=wi(t),o=(a?mr(n.width):n.width)/r,s=(a?mr(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Di=gr(0);function Oi(e){let t=X(e);return!gi()||!t.visualViewport?Di:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ki(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===X(e)}function Ai(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ti(e),o=gr(1);t&&(r?ii(r)&&(o=Ei(r)):o=Ei(e));let s=ki(a,n,r)?Oi(a):gr(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=X(a),t=ii(r)?X(r):r,n=e,i=Ci(n);for(;i&&t!==n;){let e=Ei(i),t=i.getBoundingClientRect(),r=vi(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=X(i),i=Ci(n)}}return Rr({width:u,height:d,x:c,y:l})}function ji(e,t){let n=yi(e).scrollLeft;return t?t.left+n:Ai(ni(e)).left+n}function Mi(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-ji(e,n),y:n.top+t.scrollTop}}function Ni(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ni(r),s=t?li(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=gr(1),u=gr(0),d=ai(r);if((d||!a)&&((ti(r)!==`body`||si(o))&&(c=yi(r)),d)){let e=Ai(r);l=Ei(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Mi(o,c):gr(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Pi(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Fi(e){let t=yi(e),n=e.ownerDocument.body,r=pr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=pr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+ji(e),o=-t.scrollTop;return vi(n).direction===`rtl`&&(a+=pr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Ii=25;function Li(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=X(e),a=ni(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!gi()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(ji(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Ii&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ri(e,t){let n=Ai(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ei(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function zi(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Li(e,n,t);else if(t===`document`)r=Fi(ni(e));else if(ii(t))r=Ri(t,n);else{let n=Oi(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Rr(r)}function Bi(e,t){let n=t.get(e);if(n)return n;let r=Si(e,[],!1).filter(e=>ii(e)&&ti(e)!==`body`),i=null,a=vi(e).position===`fixed`,o=a?bi(e):e;for(;ii(o)&&!_i(o);){let e=vi(o),t=mi(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=bi(o)}return t.set(e,r),r}function Vi(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?li(t)?[]:Bi(t,this._c):[].concat(n),r],o=zi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=zi(t,a[e],i);s=pr(n.top,s),c=fr(n.right,c),l=fr(n.bottom,l),u=pr(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Hi(e){let{width:t,height:n}=wi(e);return{width:t,height:n}}function Ui(e,t,n){let r=ai(t),i=ni(t),a=n===`fixed`,o=Ai(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=gr(0);if((r||!a)&&((ti(t)!==`body`||si(i))&&(s=yi(t)),r)){let e=Ai(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=ji(i));let l=i&&!r&&!a?Mi(i,s):gr(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Wi(e){return vi(e).position===`static`}function Gi(e,t){if(!ai(e)||vi(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ni(e)===n&&(n=n.ownerDocument.body),n}function Ki(e,t){let n=X(e);if(li(e))return n;if(!ai(e)){let t=bi(e);for(;t&&!_i(t);){if(ii(t)&&!Wi(t))return t;t=bi(t)}return n}let r=Gi(e,t);for(;r&&ci(r)&&Wi(r);)r=Gi(r,t);return r&&_i(r)&&Wi(r)&&!mi(r)?n:r||hi(e)||n}var qi=async function(e){let t=this.getOffsetParent||Ki,n=this.getDimensions,r=await n(e.floating);return{reference:Ui(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Ji(e){return vi(e).direction===`rtl`}var Yi={convertOffsetParentRelativeRectToViewportRelativeRect:Ni,getDocumentElement:ni,getClippingRect:Vi,getOffsetParent:Ki,getElementRects:qi,getClientRects:Pi,getDimensions:Hi,getScale:Ei,isElement:ii,isRTL:Ji};function Xi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zi(e,t,n){let r=null,i,a=ni(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=hr(d),h=hr(a.clientWidth-(u+f)),g=hr(a.clientHeight-(d+p)),_=hr(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:pr(0,fr(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Xi(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=X(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Qi(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ti(e),u=i||a?[...l?Si(l):[],...t?Si(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Zi(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ai(e):null;c&&g();function g(){let t=Ai(e);h&&!Xi(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var $i=Xr,ea=Zr,ta=Wr,na=$r,ra=qr,ia=Ur,aa=Qr,oa=(e,t,n)=>{let r=new Map,i=n??{},a={...Yi,...i.platform,_c:r};return Hr(e,t,{...i,platform:a})},sa=typeof document<`u`?U.useLayoutEffect:function(){};function ca(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!ca(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!ca(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function la(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ua(e,t){let n=la(e);return Math.round(t*n)/n}function da(e){let t=U.useRef(e);return sa(()=>{t.current=e}),t}function fa(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=U.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=U.useState(r);ca(f,r)||p(r);let[m,h]=U.useState(null),[g,_]=U.useState(null),v=U.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=U.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=U.useRef(null),C=U.useRef(null),w=U.useRef(u),T=c!=null,E=da(c),D=da(i),O=da(l),k=U.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),oa(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!ca(w.current,t)&&(w.current=t,it.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);sa(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=U.useRef(!1);sa(()=>(A.current=!0,()=>{A.current=!1}),[]),sa(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=U.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=U.useMemo(()=>({reference:b,floating:x}),[b,x]),N=U.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ua(M.floating,u.x),r=ua(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...la(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return U.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var pa=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ia({element:r.current,padding:i}).fn(n):r?ia({element:r,padding:i}).fn(n):{}}}},ma=(e,t)=>{let n=$i(e);return{name:n.name,fn:n.fn,options:[e,t]}},ha=(e,t)=>{let n=ea(e);return{name:n.name,fn:n.fn,options:[e,t]}},ga=(e,t)=>({fn:aa(e).fn,options:[e,t]}),_a=(e,t)=>{let n=ta(e);return{name:n.name,fn:n.fn,options:[e,t]}},va=(e,t)=>{let n=na(e);return{name:n.name,fn:n.fn,options:[e,t]}},ya=(e,t)=>{let n=ra(e);return{name:n.name,fn:n.fn,options:[e,t]}},ba=(e,t)=>{let n=pa(e);return{name:n.name,fn:n.fn,options:[e,t]}},xa=Object.defineProperty,Sa=(e,t)=>xa(e,`name`,{value:t,configurable:!0}),Ca={Partial:`partial`,Always:`always`},wa={Optimized:`optimized`,Always:`always`},Ta=`Popper`,[Ea,Da]=k(Ta),[Oa,ka]=Ea(Ta),Aa=Sa(e=>{let{__scopePopper:t,children:n}=e,[r,i]=U.useState(null),[a,o]=U.useState(void 0);return(0,G.jsx)(Oa,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),ja=`PopperAnchor`,Ma=U.forwardRef(Sa(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=ka(ja,n),o=U.useRef(null),s=a.onAnchorChange,c=U.useCallback(e=>{o.current=e,e&&s(e)},[s]),l=H(t,c),u=U.useRef(null);U.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=a.placementState&&za(a.placementState),f=d?.[0],p=d?.[1];return r?null:(0,G.jsx)(z.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:l})},`PopperAnchor`)),Na=`PopperContent`,[Pa,Fa]=Ea(Na),Ia=U.forwardRef(Sa(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=Ca.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=wa.Optimized,onPlaced:m,...h}=e,g=ka(Na,n),[_,v]=U.useState(null),y=H(t,v),[b,x]=U.useState(null),S=C(b),w=S?.width??0,T=S?.height??0,D=r+(a===`center`?``:`-`+a),O=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},k=Array.isArray(l)?l:[l],A=k.length>0,j={padding:O,boundary:k.filter(La),altBoundary:A},{refs:M,floatingStyles:N,placement:P,isPositioned:F,middlewareData:I}=fa({strategy:`fixed`,placement:D,whileElementsMounted:Sa((...e)=>Qi(...e,{animationFrame:p===wa.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[ma({mainAxis:i+T,alignmentAxis:o}),c&&ha({mainAxis:!0,crossAxis:!1,limiter:d===Ca.Partial?ga():void 0,...j}),c&&_a({...j}),va({...j,apply:Sa(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&ba({element:b,padding:s}),Ra({arrowWidth:w,arrowHeight:T}),f&&ya({strategy:`referenceHidden`,...j,boundary:A?j.boundary:void 0})]}),L=g.setPlacementState;E(()=>(L(P),()=>{L(void 0)}),[P,L]);let[ee,te]=za(P),R=K(m);E(()=>{F&&R?.()},[F,R]);let ne=I.arrow?.x,re=I.arrow?.y,ie=I.arrow?.centerOffset!==0,[B,ae]=U.useState();return E(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:M.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:F?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(` `),...I.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(Pa,{scope:n,placedSide:ee,placedAlign:te,onArrowChange:x,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,G.jsx)(z.div,{"data-side":ee,"data-align":te,...h,ref:y,style:{...h.style,animation:F?h.style?.animation:`none`}})})})},`PopperContent`));function La(e){return e!==null}Sa(La,`isNotNull`);var Ra=Sa(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=za(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function za(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Sa(za,`getSideAndAlignFromPlacement`);var Ba=Object.defineProperty,Va=(e,t)=>Ba(e,`name`,{value:t,configurable:!0}),Ha=!1;function Ua(){let[e,t]=U.useState(Ha);return U.useEffect(()=>{Ha||(Ha=!0,t(!0))},[]),e}Va(Ua,`useIsHydrated`);var Wa=U.useSyncExternalStore;function Ga(){return()=>{}}Va(Ga,`subscribe`);function Ka(){return Wa(Ga,()=>!0,()=>!1)}Va(Ka,`useIsHydratedModern`);var qa=typeof Wa==`function`?Ka:Ua,Ja=Object.defineProperty,Ya=(e,t)=>Ja(e,`name`,{value:t,configurable:!0}),Xa=`rovingFocusGroup.onEntryFocus`,Za={bubbles:!1,cancelable:!0},Qa=`RovingFocusGroup`,[$a,eo,to]=ce(Qa),[no,ro]=k(Qa,[to]),io={Vertical:`vertical`,Horizontal:`horizontal`},ao={LTR:`ltr`,RTL:`rtl`},[oo,so]=no(Qa),co=U.forwardRef(Ya(function(e,t){return(0,G.jsx)($a.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)($a.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(lo,{...e,ref:t})})})},`RovingFocusGroup`)),lo=U.forwardRef(Ya(function(e,t){let{__scopeRovingFocusGroup:r,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=U.useRef(null),m=H(t,p),h=n(o),[g,_]=L({prop:s,defaultProp:c??null,onChange:l,caller:Qa}),[v,y]=U.useState(!1),b=K(u),x=eo(r),S=U.useRef(!1),[C,w]=U.useState(0);return U.useEffect(()=>{let e=p.current;if(e)return e.addEventListener(Xa,b),()=>e.removeEventListener(Xa,b)},[b]),(0,G.jsx)(oo,{scope:r,orientation:i,dir:h,loop:a,currentTabStopId:g,onItemFocus:U.useCallback(e=>_(e),[_]),onItemShiftTab:U.useCallback(()=>y(!0),[]),onFocusableItemAdd:U.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:U.useCallback(()=>w(e=>e-1),[]),children:(0,G.jsx)(z.div,{tabIndex:v||C===0?-1:0,"data-orientation":i,...f,ref:m,style:{outline:`none`,...e.style},onMouseDown:B(e.onMouseDown,()=>{S.current=!0}),onFocus:B(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(Xa,Za);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);go([e.find(e=>e.active),e.find(e=>e.id===g),...e].filter(Boolean).map(e=>e.ref.current),d)}}S.current=!1}),onBlur:B(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),uo=`RovingFocusGroupItem`,fo=U.forwardRef(Ya(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=M(),l=a||c,u=so(uo,n),d=u.currentTabStopId===l,f=eo(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=qa();return E(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),U.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,G.jsx)($a.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,G.jsx)(z.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:B(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:B(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:B(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ho(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?_o(n,r+1):n.slice(r+1)}setTimeout(()=>go(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),po={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function mo(e,t){return t===ao.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Ya(mo,`getDirectionAwareKey`);function ho(e,t,n){let r=mo(e.key,n);if(!(t===io.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===io.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return po[r]}Ya(ho,`getFocusIntent`);function go(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Ya(go,`focusFirst`);function _o(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ya(_o,`wrapArray`);var vo=Object.defineProperty,Z=(e,t)=>vo(e,`name`,{value:t,configurable:!0}),yo=[`Enter`,` `],bo=[`ArrowDown`,`PageUp`,`Home`],xo=[`ArrowUp`,`PageDown`,`End`],So=[...bo,...xo];[...yo],[...yo];var Co=`Menu`,[wo,To,Eo]=ce(Co),[Do,Oo]=k(Co,[Eo,Da,ro]),ko=Da(),Ao=ro(),[jo,Mo]=Do(Co),[No,Po]=Do(Co),Fo=Z(e=>{let{__scopeMenu:t,open:r=!1,children:i,dir:a,onOpenChange:o,modal:s=!0}=e,c=ko(t),[l,u]=U.useState(null),d=U.useRef(!1),f=K(o),p=n(a);return U.useEffect(()=>{let e=Z(()=>{d.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=Z(()=>d.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),U.useEffect(()=>{if(!r)return;let e=Z(()=>f(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[r,f]),(0,G.jsx)(Aa,{...c,children:(0,G.jsx)(jo,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u,children:(0,G.jsx)(No,{scope:t,onClose:U.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:p,modal:s,children:i})})})},`Menu`),Io=U.forwardRef(Z(function(e,t){let{__scopeMenu:n,...r}=e,i=ko(n);return(0,G.jsx)(Ma,{...i,...r,ref:t})},`MenuAnchor`)),Lo=`MenuPortal`,[Ro,zo]=Do(Lo,{forceMount:void 0}),Bo=Z(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Mo(Lo,t);return(0,G.jsx)(Ro,{scope:t,forceMount:n,children:(0,G.jsx)(le,{present:n||a.open,children:(0,G.jsx)(ot,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Vo=`MenuContent`,[Ho,Uo]=Do(Vo),Wo=U.forwardRef(Z(function(e,t){let n=zo(Vo,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Mo(Vo,e.__scopeMenu),o=Po(Vo,e.__scopeMenu);return(0,G.jsx)(wo.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(le,{present:r||a.open,children:(0,G.jsx)(wo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,G.jsx)(Go,{...i,ref:t}):(0,G.jsx)(Ko,{...i,ref:t})})})})},`MenuContent`)),Go=U.forwardRef(Z(function(e,t){let n=Mo(Vo,e.__scopeMenu),r=U.useRef(null),i=H(t,r);return U.useEffect(()=>{let e=r.current;if(e)return jn(e)},[]),(0,G.jsx)(Jo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:B(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Ko=U.forwardRef(Z(function(e,t){let n=Mo(Vo,e.__scopeMenu);return(0,G.jsx)(Jo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),qo=O(`MenuContent.ScrollLock`),Jo=U.forwardRef(Z(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Mo(Vo,n),_=Po(Vo,n),v=ko(n),y=Ao(n),b=To(n),[x,S]=U.useState(null),C=U.useRef(null),[w,T]=U.useState(null);Ke(w);let{nodes:E,registry:D}=Ge(),O=!!(i||m),k=H(t,C,g.onContentChange,T),A=U.useRef(0),j=U.useRef(``),M=U.useRef(0),N=U.useRef(null),P=U.useRef(`right`),F=U.useRef(0),I=U.useMemo(()=>m?[C,...E.map(e=>({current:e}))]:[],[C,E,m]),L=m?Sn:U.Fragment,ee=m?{as:qo,allowPinchZoom:!0,shards:I}:void 0,te=Z(e=>{let t=j.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=ms(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;Z((function e(t){j.current=t,window.clearTimeout(A.current),t!==``&&(A.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);U.useEffect(()=>()=>window.clearTimeout(A.current),[]),ft();let R=U.useCallback(e=>P.current===N.current?.side&&gs(e,N.current?.area),[]);return(0,G.jsx)(Ho,{scope:n,searchRef:j,onItemEnter:U.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:U.useCallback(e=>{R(e)||(C.current?.focus(),S(null))},[R]),onTriggerLeave:U.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:M,onPointerGraceIntentChange:U.useCallback(e=>{N.current=e},[]),children:(0,G.jsx)(We,{registry:O?D:null,children:(0,G.jsx)(L,{...ee,children:(0,G.jsx)(He,{asChild:!0,trapped:i,branches:E,onMountAutoFocus:B(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,G.jsx)(je,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,G.jsx)(co,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:B(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,G.jsx)(Ia,{role:`menu`,"aria-orientation":`vertical`,"data-state":ls(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:k,style:{outline:`none`,...h.style},onKeyDown:B(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=C.current;if(e.target!==i||!So.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);xo.includes(e.key)&&a.reverse(),fs(a)}),onBlur:B(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:B(e.onPointerMove,_s(e=>{let t=e.target,n=F.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>F.current?`right`:`left`;P.current=t,F.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Yo=`MenuItem`,Xo=`menu.itemSelect`,Zo=U.forwardRef(Z(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=U.useRef(null),o=Po(Yo,e.__scopeMenu),s=Uo(Yo,e.__scopeMenu),c=H(t,a),l=U.useRef(!1),u=Z(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Xo,{bubbles:!0,cancelable:!0});e.addEventListener(Xo,e=>r?.(e),{once:!0}),se(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,G.jsx)(Qo,{...i,ref:c,disabled:n,onClick:B(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:B(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:B(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&yo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Qo=U.forwardRef(Z(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Uo(Yo,n),s=Ao(n),c=U.useRef(null),l=H(t,c),[u,d]=U.useState(!1),[f,p]=U.useState(``);return U.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,G.jsx)(wo.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,G.jsx)(fo,{asChild:!0,...s,focusable:!r,children:(0,G.jsx)(z.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:B(e.onPointerMove,_s(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:B(e.onPointerLeave,_s(e=>o.onItemLeave(e))),onFocus:B(e.onFocus,()=>d(!0)),onBlur:B(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),$o=U.forwardRef(Z(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,G.jsx)(rs,{scope:e.__scopeMenu,checked:n,children:(0,G.jsx)(Zo,{role:`menuitemcheckbox`,"aria-checked":us(n)?`mixed`:n,...i,ref:t,"data-state":ds(n),onSelect:B(i.onSelect,()=>r?.(us(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[es,ts]=Do(`MenuRadioGroup`,{value:void 0,onValueChange:Z(()=>{},`onValueChange`)}),ns=`MenuItemIndicator`,[rs,is]=Do(ns,{checked:!1}),as=U.forwardRef(Z(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=is(ns,n);return(0,G.jsx)(le,{present:r||us(a.checked)||a.checked===!0,children:(0,G.jsx)(z.span,{...i,ref:t,"data-state":ds(a.checked)})})},`MenuItemIndicator`)),os=U.forwardRef(Z(function(e,t){let{__scopeMenu:n,...r}=e;return(0,G.jsx)(z.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[ss,cs]=Do(`MenuSub`);function ls(e){return e?`open`:`closed`}Z(ls,`getOpenState`);function us(e){return e===`indeterminate`}Z(us,`isIndeterminate`);function ds(e){return us(e)?`indeterminate`:e?`checked`:`unchecked`}Z(ds,`getCheckedState`);function fs(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Z(fs,`focusFirst`);function ps(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Z(ps,`wrapArray`);function ms(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ps(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}Z(ms,`getNextMatch`);function hs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}Z(hs,`isPointInPolygon`);function gs(e,t){return t?hs({x:e.clientX,y:e.clientY},t):!1}Z(gs,`isPointerInGraceArea`);function _s(e){return t=>t.pointerType===`mouse`?e(t):void 0}Z(_s,`whenMouse`);var vs=Object.defineProperty,ys=(e,t)=>vs(e,`name`,{value:t,configurable:!0}),bs=`DropdownMenu`,[xs,Ss]=k(bs,[Oo]),Cs=Oo(),[ws,Ts]=xs(bs),Es=ys(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Cs(t),l=U.useRef(null),[u,d]=L({prop:i,defaultProp:a??!1,onChange:o,caller:bs});return(0,G.jsx)(ws,{scope:t,triggerId:M(),triggerRef:l,contentId:M(),open:u,onOpenChange:d,onOpenToggle:U.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,G.jsx)(Fo,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),Ds=`DropdownMenuTrigger`,Os=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Ts(Ds,n),o=Cs(n),s=H(t,a.triggerRef);return(0,G.jsx)(Io,{asChild:!0,...o,children:(0,G.jsx)(z.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:B(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:B(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),ks=ys(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Cs(t);return(0,G.jsx)(Bo,{...r,...n})},`DropdownMenuPortal`),As=`DropdownMenuContent`,js=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ts(As,n),a=Cs(n),o=U.useRef(!1);return(0,G.jsx)(Wo,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:B(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:B(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.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)`}})},`DropdownMenuContent`)),Ms=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Cs(n);return(0,G.jsx)(Zo,{...i,...r,ref:t})},`DropdownMenuItem`)),Ns=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Cs(n);return(0,G.jsx)($o,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),Ps=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Cs(n);return(0,G.jsx)(as,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),Fs=U.forwardRef(ys(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Cs(n);return(0,G.jsx)(os,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Q={trigger:`_trigger_26wmo_1`,item:`_item_26wmo_7`,triggerIcon:`_triggerIcon_26wmo_8`,triggerIconOnly:`_triggerIconOnly_26wmo_10`,label:`_label_26wmo_11`,labelMeasure:`_labelMeasure_26wmo_12`,labelText:`_labelText_26wmo_13`,chevron:`_chevron_26wmo_14`,menu:`_menu_26wmo_18`,"menu-exit":`_menu-exit_26wmo_1`,highlight:`_highlight_26wmo_28`,icon:`_icon_26wmo_31`,separator:`_separator_26wmo_32`,destructive:`_destructive_26wmo_33`};function Is({text:e}){let t=ne(),n=(0,U.useRef)(null),r=(0,U.useRef)(null),[i,a]=(0,U.useState)({width:`auto`,animate:!1});return(0,U.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([t])=>{let n=e.textContent,i=r.current!==null&&r.current!==n;r.current=n,a({width:Math.ceil(t.borderBoxSize?.[0]?.inlineSize??e.offsetWidth),animate:i})});return t.observe(e),()=>t.disconnect()},[]),(0,G.jsxs)(V.span,{className:Q.label,initial:!1,animate:{width:i.width},transition:i.animate&&!t?_.spring.morph:{duration:0},children:[(0,G.jsx)(`span`,{ref:n,className:Q.labelMeasure,"aria-hidden":`true`,children:e}),(0,G.jsx)(P,{mode:`popLayout`,initial:!1,children:(0,G.jsx)(V.span,{className:Q.labelText,initial:!t&&{opacity:0,y:`0.3em`,filter:`blur(${_.blur.soft}px)`},animate:{opacity:1,y:0,filter:`blur(0px)`},exit:t?{opacity:0,transition:{duration:0}}:{opacity:0,y:`-0.3em`,filter:`blur(${_.blur.subtle}px)`,transition:{duration:_.duration.fast,ease:[..._.ease.standard]}},transition:{duration:_.duration.standard,ease:[..._.ease.enter]},children:e},e)})]})}function Ls({label:e,items:t,icon:n,iconOnly:r}){let i=ne(),[a,o]=(0,U.useState)(null),s=(0,U.useRef)(!1),c=(0,U.useRef)(0);(0,U.useEffect)(()=>()=>window.clearTimeout(c.current),[]);function l(e){let t=e.target instanceof HTMLElement?e.target.closest(`[role="menuitem"]`):null;if(window.clearTimeout(c.current),!t){c.current=window.setTimeout(()=>o(null),s.current?70:0);return}let n={top:t.offsetTop,height:t.offsetHeight,danger:t.dataset.tone===`danger`},r=s.current;o(e=>({...n,glide:r&&e!==null}))}return(0,G.jsxs)(Es,{onOpenChange:e=>{e&&(window.clearTimeout(c.current),o(null))},children:[(0,G.jsxs)(Os,{className:[Q.trigger,r?Q.triggerIconOnly:``].filter(Boolean).join(` `),type:`button`,"aria-label":r?e:void 0,children:[n&&(0,G.jsx)(`span`,{className:Q.triggerIcon,"aria-hidden":`true`,children:n}),!r&&(0,G.jsx)(Is,{text:e}),!r&&(0,G.jsx)(me,{className:Q.chevron,size:15,strokeWidth:1.8,"aria-hidden":`true`})]}),(0,G.jsx)(ks,{children:(0,G.jsxs)(js,{className:Q.menu,sideOffset:6,align:`end`,collisionPadding:12,loop:!0,onFocus:l,onPointerMoveCapture:()=>{s.current=!0},onKeyDownCapture:()=>{s.current=!1},children:[(0,G.jsx)(V.span,{className:Q.highlight,"data-tone":a?.danger?`danger`:void 0,"aria-hidden":`true`,initial:!1,animate:a?{y:a.top,height:a.height,opacity:1}:{opacity:0},transition:{default:a?.glide&&!i?_.spring.snappy:{duration:0},opacity:{duration:i?0:.08}}}),t.map((e,t)=>(0,G.jsxs)(U.Fragment,{children:[e.separatorBefore&&(0,G.jsx)(Fs,{className:Q.separator}),(0,G.jsxs)(Ms,{className:[Q.item,e.destructive?Q.destructive:``].filter(Boolean).join(` `),"data-tone":e.destructive?`danger`:void 0,style:{"--i":t},disabled:e.disabled,onSelect:e.onSelect,children:[e.icon&&(0,G.jsx)(`span`,{className:Q.icon,"aria-hidden":`true`,children:e.icon}),e.label]})]},e.label))]})})]})}var Rs=Object.defineProperty,zs=(e,t)=>Rs(e,`name`,{value:t,configurable:!0});function Bs(e,[t,n]){return Math.min(n,Math.max(t,e))}zs(Bs,`clamp`);var Vs=Object.defineProperty,Hs=(e,t)=>Vs(e,`name`,{value:t,configurable:!0});function Us(e){let t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}Hs(Us,`usePrevious`);var Ws=Object.defineProperty,Gs=(e,t)=>Ws(e,`name`,{value:t,configurable:!0}),Ks=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),qs=U.forwardRef(Gs(function(e,t){return(0,G.jsx)(z.span,{...e,ref:t,style:{...Ks,...e.style}})},`VisuallyHidden`)),Js=Object.defineProperty,$=(e,t)=>Js(e,`name`,{value:t,configurable:!0}),Ys={ItemAligned:`item-aligned`,Popper:`popper`},Xs={LTR:`ltr`,RTL:`rtl`},Zs=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Qs=[` `,`Enter`],$s=`Select`,[ec,tc,nc]=ce($s),[rc,ic]=k($s,[nc,Da]),ac=Da(),[oc,sc]=rc($s),[cc,lc]=rc($s);function uc(e){let{__scopeSelect:t,children:r,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=ac(t),[v,y]=U.useState(null),[b,x]=U.useState(null),[S,C]=U.useState(!1),w=n(u),[T,E]=L({prop:i,defaultProp:a??!1,onChange:o,caller:$s}),[D,O]=L({prop:s,defaultProp:c,onChange:l,caller:$s}),k=U.useRef(null),A=U.useRef(D);U.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=$(()=>O(A.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,O]);let j=!v||!!h||!!v.closest(`form`),[N,P]=U.useState(new Set),F=M(),I=Array.from(N).map(e=>e.props.value).join(`;`),ee=U.useCallback(e=>{P(t=>new Set(t).add(e))},[]),te=U.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),R={required:m,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:F,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:N,nativeSelectKey:I,isFormControl:j};return(0,G.jsx)(Aa,{..._,children:(0,G.jsx)(oc,{scope:t,...R,children:(0,G.jsx)(ec.Provider,{scope:t,children:(0,G.jsx)(cc,{scope:t,onNativeOptionAdd:ee,onNativeOptionRemove:te,children:Zc(g)?g(R):r})})})})}$(uc,`SelectProvider`);var dc=$(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,G.jsx)(uc,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,G.jsxs)(G.Fragment,{children:[n,e?(0,G.jsx)(Xc,{__scopeSelect:t}):null]})})},`Select`),fc=`SelectTrigger`,pc=U.forwardRef($(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,a=ac(n),o=sc(fc,n),s=o.disabled||r,c=H(t,o.onTriggerChange),l=tc(n),u=U.useRef(`touch`),[d,f,p]=$c(e=>{let t=l().filter(e=>!e.disabled),n=el(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=$(e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,G.jsx)(Ma,{asChild:!0,...a,children:(0,G.jsx)(z.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Qc(o.value)?``:void 0,...i,ref:c,onClick:B(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:B(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:B(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Zs.includes(e.key)&&(m(),e.preventDefault())})})})},`SelectTrigger`)),mc=`SelectValue`,hc=U.forwardRef($(function(e,t){let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=sc(mc,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=H(t,c.onValueNodeChange);E(()=>{l(u)},[l,u]);let f=Qc(c.value);return(0,G.jsx)(z.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,G.jsx)(U.Fragment,{children:f?o:a},f?`placeholder`:`value`)})},`SelectValue`)),gc=U.forwardRef($(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(z.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[_c,vc]=rc(`SelectPortal`,{forceMount:void 0}),yc=$(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,G.jsx)(_c,{scope:e.__scopeSelect,forceMount:n,children:(0,G.jsx)(ot,{asChild:!0,...r})})},`SelectPortal`),bc=`SelectContent`,xc=U.forwardRef($(function(e,t){let n=vc(bc,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=sc(bc,e.__scopeSelect),[o,s]=U.useState();return E(()=>{s(new DocumentFragment)},[]),(0,G.jsx)(le,{present:r||a.open,children:({present:e})=>e?(0,G.jsx)(Dc,{...i,ref:t}):(0,G.jsx)(Sc,{...i,fragment:o})})},`SelectContent`)),Sc=U.forwardRef($(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?it.createPortal((0,G.jsx)(wc,{scope:n,children:(0,G.jsx)(ec.Slot,{scope:n,children:(0,G.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),Cc=10,[wc,Tc]=rc(bc),Ec=O(`SelectContent.RemoveScroll`),Dc=U.forwardRef($(function(e,t){let{__scopeSelect:n}=e,{position:r=Ys.ItemAligned,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=sc(bc,n),[y,b]=U.useState(null),[x,S]=U.useState(null),C=H(t,b),[w,T]=U.useState(null),[E,D]=U.useState(null),O=tc(n),[k,A]=U.useState(!1),j=U.useRef(!1);U.useEffect(()=>{if(y)return jn(y)},[y]),ft();let M=U.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=U.useCallback(()=>M([w,y]),[M,w,y]);U.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;U.useEffect(()=>{if(y){let e={x:0,y:0},t=$(t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},`handlePointerMove`),n=$(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null},`handlePointerUp`);return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),U.useEffect(()=>{let e=$(()=>P(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,L]=$c(e=>{let t=O().filter(e=>!e.disabled),n=el(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ee=U.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),te=U.useCallback(()=>y?.focus(),[y]),R=U.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ne=r===Ys.Popper?kc:Oc,re=ne===kc?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,G.jsx)(wc,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ee,selectedItem:w,onItemLeave:te,itemTextRefCallback:R,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,G.jsx)(Sn,{as:Ec,allowPinchZoom:!0,children:(0,G.jsx)(He,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:B(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(je,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,G.jsx)(ne,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...re,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:B(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&L(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),Oc=U.forwardRef($(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,a=sc(bc,n),o=Tc(bc,n),[s,c]=U.useState(null),[l,u]=U.useState(null),d=H(t,u),f=tc(n),p=U.useRef(!1),m=U.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=U.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==Xs.RTL){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Cc,d=Bs(a,[Cc,Math.max(Cc,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Cc,d=Bs(a,[Cc,Math.max(Cc,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Cc*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Cc,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Cc}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);E(()=>y(),[y]);let[b,x]=U.useState();E(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);let S=U.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]);return(0,G.jsx)(Ac,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:(0,G.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,G.jsx)(z.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),kc=U.forwardRef($(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Cc,...a}=e,o=ac(n);return(0,G.jsx)(Ia,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})},`SelectPopperPosition`)),[Ac,jc]=rc(bc,{}),Mc=`SelectViewport`,Nc=U.forwardRef($(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,a=Tc(Mc,n),o=jc(Mc,n),s=H(t,a.onViewportChange),c=U.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.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:r}),(0,G.jsx)(ec.Slot,{scope:n,children:(0,G.jsx)(z.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:B(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Cc*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})},`SelectViewport`)),[Pc,Fc]=rc(`SelectGroup`),Ic=`SelectItem`,[Lc,Rc]=rc(Ic),zc=U.forwardRef($(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=sc(Ic,n),c=Tc(Ic,n),l=s.value===r,[u,d]=U.useState(a??``),[f,p]=U.useState(!1),m=K(e=>c.itemRefCallback?.(e,r,i)),h=H(t,m),g=M(),_=U.useRef(`touch`),v=$(()=>{s.onValueChange(r),s.onOpenChange(!1)},`handleSelect`);return(0,G.jsx)(Lc,{scope:n,value:r,disabled:i,textId:g,isSelected:l,onItemTextChange:U.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(ec.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,G.jsx)(z.div,{role:`option`,"aria-labelledby":g,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:B(o.onFocus,()=>p(!0)),onBlur:B(o.onBlur,()=>p(!1)),onClick:B(o.onClick,()=>{i||_.current!==`mouse`&&v()}),onPointerUp:B(o.onPointerUp,()=>{i||_.current===`mouse`&&v()}),onPointerDown:B(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:B(o.onPointerMove,e=>{_.current=e.pointerType,i?c.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:B(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:B(o.onKeyDown,e=>{i||e.target!==e.currentTarget||(c.searchRef?.current===``||e.key!==` `)&&(Qs.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Bc=`SelectItemText`,Vc=U.forwardRef($(function(e,t){let{__scopeSelect:n,className:r,style:i,...a}=e,o=sc(Bc,n),s=Tc(Bc,n),c=Rc(Bc,n),l=lc(Bc,n),[u,d]=U.useState(null),f=K(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=H(t,d,c.onItemTextChange,f),m=u?.textContent,h=U.useMemo(()=>(0,G.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return E(()=>(g(h),()=>_(h)),[g,_,h]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(z.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Qc(o.value)?it.createPortal(a.children,o.valueNode):null]})},`SelectItemText`)),Hc=`SelectItemIndicator`,Uc=U.forwardRef($(function(e,t){let{__scopeSelect:n,...r}=e;return Rc(Hc,n).isSelected?(0,G.jsx)(z.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Wc=`SelectScrollUpButton`,Gc=U.forwardRef($(function(e,t){let n=Tc(Wc,e.__scopeSelect),r=jc(Wc,e.__scopeSelect),[i,a]=U.useState(!1),o=H(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};$(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(Jc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Kc=`SelectScrollDownButton`,qc=U.forwardRef($(function(e,t){let n=Tc(Kc,e.__scopeSelect),r=jc(Kc,e.__scopeSelect),[i,a]=U.useState(!1),o=H(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};$(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,G.jsx)(Jc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Jc=U.forwardRef($(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Tc(`SelectScrollButton`,n),o=U.useRef(null),s=tc(n),c=U.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return U.useEffect(()=>()=>c(),[c]),E(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,G.jsx)(z.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:B(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:B(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:B(i.onPointerLeave,()=>{c()})})},`SelectScrollButtonImpl`)),Yc=`SelectBubbleInput`,Xc=U.forwardRef($(function({__scopeSelect:e,...t},n){let r=sc(Yc,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=U.useRef(null),m=H(n,p),h=i??``,g=Us(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return U.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,G.jsxs)(z.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Ks,...t.style},ref:m,defaultValue:h,children:[Qc(i)&&!_?(0,G.jsx)(`option`,{value:``}):null,Array.from(d)]},f)},`SelectBubbleInput`));function Zc(e){return typeof e==`function`}$(Zc,`isFunction`);function Qc(e){return e===``||e===void 0}$(Qc,`shouldShowPlaceholder`);function $c(e){let t=K(e),n=U.useRef(``),r=U.useRef(0),i=U.useCallback(e=>{let i=n.current+e;t(i),$((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}$($c,`useTypeaheadSearch`);function el(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}$(el,`findNextItem`);function tl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}$(tl,`wrapArray`);var nl={field:`_field_1a9q6_1`,trigger:`_trigger_1a9q6_4`,valueText:`_valueText_1a9q6_9`,srOnly:`_srOnly_1a9q6_12`,chevron:`_chevron_1a9q6_13`,hint:`_hint_1a9q6_15`,content:`_content_1a9q6_18`,"select-in":`_select-in_1a9q6_1`,"select-out":`_select-out_1a9q6_1`,viewport:`_viewport_1a9q6_23`,item:`_item_1a9q6_24`,indicator:`_indicator_1a9q6_27`,"indicator-in":`_indicator-in_1a9q6_1`,scrollButton:`_scrollButton_1a9q6_28`,"select-fade":`_select-fade_1a9q6_1`,"select-fade-out":`_select-fade-out_1a9q6_1`},rl={enter:e=>({opacity:0,y:`${e*.35}em`,filter:`blur(${_.blur.soft}px)`}),center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:_.duration.standard,ease:[..._.ease.enter]}},exit:e=>({opacity:0,y:`${e*-.3}em`,filter:`blur(${_.blur.subtle}px)`,transition:{duration:_.duration.fast,ease:[..._.ease.standard]}})},il={enter:{opacity:0},center:{opacity:1,y:0,filter:`blur(0px)`,transition:{duration:_.duration.instant}},exit:{opacity:0,transition:{duration:_.duration.instant}}},al=(0,U.forwardRef)(function({label:e,description:t,placeholder:n=`Select an option`,options:r,id:i,className:a,disabled:o,onValueChange:s,...c},l){let u=(0,U.useId)(),d=i??u,f=t?`${d}-description`:void 0,p=ne(),[m,h]=(0,U.useState)(c.defaultValue??``),g=c.value??m,_=r.findIndex(e=>e.value===g),v=g?r[_]?.label??``:n,[y,b]=(0,U.useState)(_),[x,S]=(0,U.useState)(1);return y!==_&&(b(_),S(_>y?1:-1)),(0,G.jsxs)(`div`,{className:nl.field,children:[(0,G.jsx)(`label`,{htmlFor:d,children:e}),(0,G.jsxs)(dc,{...c,disabled:o,onValueChange:e=>{h(e),s?.(e)},children:[(0,G.jsxs)(pc,{ref:l,id:d,"aria-describedby":f,className:[nl.trigger,a].filter(Boolean).join(` `),children:[(0,G.jsx)(`span`,{className:nl.srOnly,children:(0,G.jsx)(hc,{placeholder:n})}),(0,G.jsx)(`span`,{className:nl.valueText,"aria-hidden":`true`,children:(0,G.jsx)(P,{initial:!1,custom:x,children:(0,G.jsx)(V.span,{"data-placeholder":g?void 0:``,custom:x,variants:p?il:rl,initial:`enter`,animate:`center`,exit:`exit`,children:v},g?`value-${g}`:`placeholder`)})}),(0,G.jsx)(gc,{className:nl.chevron,children:(0,G.jsx)(me,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,G.jsx)(yc,{children:(0,G.jsxs)(xc,{className:nl.content,position:`popper`,sideOffset:4,collisionPadding:12,children:[(0,G.jsx)(Gc,{className:nl.scrollButton,children:(0,G.jsx)(he,{size:16,strokeWidth:1.75,"aria-hidden":`true`})}),(0,G.jsx)(Nc,{className:nl.viewport,children:r.map(e=>(0,G.jsxs)(zc,{value:e.value,disabled:e.disabled,className:nl.item,children:[(0,G.jsx)(Vc,{children:e.label}),(0,G.jsx)(Uc,{className:nl.indicator,children:(0,G.jsx)(pe,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]},e.value))}),(0,G.jsx)(qc,{className:nl.scrollButton,children:(0,G.jsx)(me,{size:16,strokeWidth:1.75,"aria-hidden":`true`})})]})})]}),t&&(0,G.jsx)(`span`,{id:f,className:nl.hint,children:t})]})}),ol={toast:`_toast_c20vg_1`,icon:`_icon_c20vg_16`,frame:`_frame_c20vg_28`,copy:`_copy_c20vg_34`,title:`_title_c20vg_43`,line:`_line_c20vg_52`,description:`_description_c20vg_59`,close:`_close_c20vg_66`},sl=()=>()=>{},cl={duration:_.duration.fast,ease:[..._.ease.standard]},ll={duration:_.duration.standard,ease:[..._.ease.enter]},ul={opacity:0,y:`0.3em`,filter:`blur(${_.blur.soft}px)`},dl={opacity:0,y:`-0.3em`,filter:`blur(${_.blur.subtle}px)`,transition:cl},fl={opacity:1,y:`0em`,filter:`blur(0px)`},pl={opacity:0,transition:{duration:_.duration.instant}},ml={distance:80,velocity:480};function hl(e){let t=ae();return(0,G.jsx)(V.span,{...e,"aria-hidden":!t||e[`aria-hidden`]})}function gl({reduce:e,morphKey:t,children:n}){let r=(0,U.useRef)(null),i=(0,U.useRef)(null),a=ue(`auto`),o=(0,U.useRef)(0);return(0,U.useLayoutEffect)(()=>{o.current=performance.now()},[t]),(0,U.useEffect)(()=>{let t=i.current;if(!t||typeof ResizeObserver>`u`)return;let n,s,c=()=>{a.jump(`auto`),r.current&&Object.assign(r.current.style,{overflow:``,height:`auto`})},l=new ResizeObserver(([i])=>{let l=i.borderBoxSize?.[0]?.blockSize??t.offsetHeight,u=a.get(),d=typeof u==`number`?u:n;if(n=l,s?.stop(),e||d===void 0||d===l||performance.now()-o.current>120)return c();r.current&&Object.assign(r.current.style,{overflow:`hidden`,height:`${d}px`}),s=D(a,[d,l],{..._.spring.smooth,onComplete:c})});return l.observe(t),()=>{l.disconnect(),s?.stop()}},[a,e]),(0,G.jsx)(V.div,{ref:r,className:ol.frame,style:{height:a},children:(0,G.jsx)(`div`,{ref:i,className:ol.copy,children:n})})}function _l({title:e,description:t,open:n=!0,onOpenChange:r,duration:i=4500}){let a=ne(),o=(0,U.useSyncExternalStore)(sl,()=>!0,()=>!1),[s]=(0,U.useState)(o),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(0),[f,p]=(0,U.useState)(n);n!==f&&(p(n),n&&(l(!1),d(0)));let m=n&&!c,h=(0,U.useRef)(null),g=ue(0),v=(0,U.useRef)(0);function y(e){d(e),l(!0),r?.(!1)}(0,U.useEffect)(()=>{if(!m||!r||i<=0)return;let e=window.setTimeout(()=>{d(0),l(!0),r(!1)},i);return()=>window.clearTimeout(e)},[m,r,i]);function b(e,t){let n=Math.sign(t.offset.x||t.velocity.x);if(Math.abs(t.offset.x)<ml.distance&&Math.abs(t.velocity.x)<ml.velocity){D(g,0,{..._.spring.snappy,velocity:t.velocity.x});return}v.current=t.velocity.x,y(n*((h.current?.offsetWidth??320)+48))}let x=a?{hidden:{opacity:0},shown:{opacity:1,transition:{duration:_.duration.instant}},exit:pl}:{hidden:{opacity:0,x:0,y:16,scale:.96},shown:{opacity:1,x:0,y:0,scale:1,transition:{..._.spring.morph,opacity:ll}},exit:e=>e?{x:e,opacity:0,transition:{x:{type:`spring`,visualDuration:.3,bounce:0,velocity:v.current,restDelta:2,restSpeed:40},opacity:{duration:_.duration.exit}}}:{opacity:0,y:8,scale:.97,transition:{duration:_.duration.exit,ease:[..._.ease.standard]}}},S={initial:a?{opacity:0}:ul,animate:fl,exit:a?pl:dl,transition:a?{duration:_.duration.instant}:ll};return(0,G.jsx)(P,{initial:s,custom:u,children:m&&(0,G.jsxs)(V.div,{ref:h,className:ol.toast,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,custom:u,variants:x,initial:`hidden`,animate:`shown`,exit:`exit`,style:{x:g},drag:a&&o?!1:`x`,dragMomentum:!1,onDragEnd:b,children:[(0,G.jsx)(`span`,{className:ol.icon,"aria-hidden":`true`,children:(0,G.jsx)(`svg`,{width:16,height:16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.25,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(V.path,{d:`M4 12.5l5 5L20 6.5`,initial:!a&&{pathLength:0},animate:{pathLength:1},transition:{duration:_.duration.standard,ease:[..._.ease.enter],delay:.12}})})}),(0,G.jsxs)(gl,{reduce:a,morphKey:`${e}\n${t??``}`,children:[(0,G.jsx)(`strong`,{className:ol.title,children:(0,G.jsx)(P,{mode:`popLayout`,initial:!1,children:(0,G.jsx)(hl,{className:ol.line,...S,children:e},e)})}),(0,G.jsx)(P,{mode:`popLayout`,initial:!1,children:t?(0,G.jsx)(hl,{className:ol.description,...S,children:t},t):null})]}),(0,G.jsx)(`button`,{className:ol.close,type:`button`,"aria-label":`Dismiss notification`,onClick:()=>y(0),children:(0,G.jsx)(_e,{width:16,height:16,strokeWidth:2,"aria-hidden":`true`})})]},`toast`)})}function vl({open:e,onOpenChange:t,title:n,description:r,children:i,footer:a,width:o=460}){return(0,G.jsx)(or,{open:e,onOpenChange:t,children:(0,G.jsxs)(ur,{title:n,description:r,style:{width:`min(calc(100vw - 2rem), ${o}px)`},children:[i,a&&(0,G.jsx)(`div`,{className:F(`flex flex-wrap items-center justify-end gap-2`,i!==void 0&&`mt-6`),children:a})]})})}function yl({label:e,icon:t,items:n,iconOnly:r}){return(0,G.jsx)(Ls,{label:e,icon:t,iconOnly:r,items:n.map(e=>({label:e.label,icon:e.icon,destructive:e.destructive,disabled:e.disabled,separatorBefore:e.separatorBefore,onSelect:e.onSelect}))})}var bl=`__astra_empty__`,xl=e=>e===``?bl:e,Sl=e=>e===bl?``:e,Cl=12;function wl({value:e,onChange:t,options:n,placeholder:r,className:i,disabled:a,label:o,ariaLabel:s}){let l=c(),u=n.find(t=>t.value===e),f=d(o,s??r??u?.label),p=F(`min-w-0`,f.hidden&&`astra-label-hidden`,i);return n.length>Cl?(0,G.jsx)(`div`,{className:p,children:(0,G.jsx)(Se,{label:f.label,description:f.field?.description,placeholder:r??l(`common.search`),emptyMessage:l(`common.noResults`),value:e==null?``:xl(e),onValueChange:e=>t(Sl(e)),options:n.map(e=>({value:xl(e.value),label:e.detail&&e.detail!==e.label?`${e.label} · ${e.detail}`:e.label,disabled:e.disabled,keywords:e.detail?[e.detail]:void 0}))})}):(0,G.jsx)(`div`,{className:p,children:(0,G.jsx)(al,{label:f.label,description:f.field?.description,placeholder:r??l(`common.select`),disabled:a,value:e==null||e===``&&!u?``:xl(e),onValueChange:e=>t(Sl(e)),options:n.map(e=>({value:xl(e.value),label:e.label,disabled:e.disabled}))})})}var Tl=(0,U.createContext)(null);function El({children:e}){let t=c(),[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(null),s=(0,U.useRef)(0),l=(0,U.useCallback)(e=>r(t=>t.filter(t=>t.id!==e)),[]),u=(0,U.useCallback)((e,t=`info`)=>{let n=++s.current;r(r=>[...r.slice(-2),{id:n,tone:t,text:e}]),t===`error`&&setTimeout(()=>l(n),8e3)},[l]),d=(0,U.useCallback)(e=>new Promise(t=>a({...e,resolve:t})),[]),f=e=>{i?.resolve(e),a(null)};return(0,G.jsxs)(Tl.Provider,{value:{toast:u,confirm:d},children:[e,(0,G.jsx)(`div`,{className:`pointer-events-none fixed inset-x-0 bottom-5 z-[95] flex flex-col items-center gap-2 px-4`,children:n.map(e=>e.tone===`error`?(0,G.jsx)(`div`,{className:`pointer-events-auto w-[min(100%,26rem)] selectable`,children:(0,G.jsx)(o,{tone:`danger`,title:t(`common.error`),onDismiss:()=>l(e.id),children:e.text})},e.id):(0,G.jsx)(`div`,{className:`pointer-events-auto flex w-full justify-center`,children:(0,G.jsx)(_l,{title:e.text,open:!0,onOpenChange:t=>!t&&l(e.id)})},e.id))}),(0,G.jsx)(vl,{open:i!==null,onOpenChange:e=>!e&&f(!1),title:i?.title??``,description:i?.detail,width:420,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(te,{onClick:()=>f(!1),children:t(`common.cancel`)}),(0,G.jsx)(te,{variant:i?.destructive?`destructive`:`primary`,onClick:()=>f(!0),autoFocus:!0,children:i?.confirmLabel??t(`common.confirm`)})]})})]})}function Dl(){let e=(0,U.useContext)(Tl);if(!e)throw Error(`useFeedback outside FeedbackProvider`);return e}function Ol(e){return e instanceof Error?e.message:String(e)}var kl={canOpenPaths:!!j(),async openPath(e){let t=j();return t?t.openPath(e):!1},async revealLogs(){return await j()?.revealLogs()??!1},async copy(e){if(window.isSecureContext&&navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}return jl(e)},async contextMenu(e){let t=j();if(t)return t.showContextMenu(e)},async startService(){let e=j();return e?e.startService():null},async restartService(){let e=j();return e?e.restartService():null}};function Al(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t>0?e.slice(0,t):e}function jl(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;top:0;left:0;opacity:0;pointer-events:none`;let n=document.activeElement;document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t),n?.focus?.()}}var Ml={config:`providers.quota.error.config`,no_key:`providers.quota.error.no_key`,unauthorized:`providers.quota.error.unauthorized`,no_endpoint:`providers.quota.error.no_endpoint`,rate_limited:`providers.quota.error.rate_limited`,upstream:`providers.quota.error.upstream`,timeout:`providers.quota.error.timeout`,network:`providers.quota.error.network`,not_json:`providers.quota.error.not_json`,too_large:`providers.quota.error.too_large`,empty:`providers.quota.error.empty`},Nl=/^[A-Z]{3}$/;function Pl(e,t,n){let r=n===`zh`?`zh-CN`:`en-US`;if(t&&Nl.test(t))try{let n=e!==0&&Math.abs(e)<1;return new Intl.NumberFormat(r,{style:`currency`,currency:t,minimumFractionDigits:2,maximumFractionDigits:n?4:2}).format(e)}catch{}let i=new Intl.NumberFormat(r,{maximumFractionDigits:2}).format(e);return t?`${i} ${t}`:i}var Fl=e=>e.windowMinutes!=null&&e.usedPercent!=null;function Il(e){return e.usedPercent!=null&&Number.isFinite(e.usedPercent)?Math.min(100,Math.max(0,e.usedPercent)):e.used!=null&&e.total!=null&&e.total>0?Math.min(100,Math.max(0,e.used/e.total*100)):null}function Ll(e){return!e?.error||e.fetchedAtUtc&&e.errorAtUtc&&new Date(e.errorAtUtc).getTime()<new Date(e.fetchedAtUtc).getTime()?null:{code:e.errorCode??null,message:e.error}}function Rl(e,t){return e.code?t(Ml[e.code]):e.message}function zl(e,t,n){let r=Il(e);if(Fl(e))return t(`providers.quota.window`,{window:_u(e.windowMinutes,n),percent:Math.round(r??0)});if(e.remaining!=null){let i=t(`providers.quota.balance`,{amount:Pl(e.remaining,e.unit,n)});return r==null?i:`${i} · ${t(`providers.quota.usedPercent`,{percent:Math.round(r)})}`}return r==null?e.used!=null&&e.total!=null?t(`providers.quota.totalUsed`,{used:Pl(e.used,e.unit,n),total:Pl(e.total,e.unit,n)}):null:t(`providers.quota.usedPercent`,{percent:Math.round(r)})}function Bl(e,t,n){let r=vu(e.resetsAtUtc??null,n);return r?t(`providers.quota.resets`,{time:r}):null}function Vl(e,t,n){let r=(e?.plans??[]).map(e=>zl(e,t,n)).filter(e=>!!e);return e?.isValid===!1&&r.unshift(t(`providers.quota.invalid`)),r.length?r.join(` · `):null}var Hl=e=>e.authScheme!==`oauth-subscription`&&!!e.quotaConfig?.enabled;function Ul(e,t){let n=new Map;for(let r of e)n.set(r.bucket,(n.get(r.bucket)??0)+r[t]);return[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({bucket:e,value:t}))}var Wl=e=>String(e).padStart(2,`0`),Gl=e=>`${e.getFullYear()}-${Wl(e.getMonth()+1)}-${Wl(e.getDate())}`,Kl={"7d":7,"30d":30,"90d":90};function ql(e,t=new Date){if(e===`today`)return new Date(t.getFullYear(),t.getMonth(),t.getDate());let n=Kl[e];return n?new Date(t.getFullYear(),t.getMonth(),t.getDate()-(n-1)):null}function Jl(e=365,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-(e-1)),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+(6-(n.getDay()+6)%7)),o=[];for(let e=i;e<=a;e=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))o.push(Gl(e));let s=[],c=[];for(let e=0;e<o.length;e+=7)s.push(Array.from({length:7},(t,n)=>e+n)),c.push({index:s.length-1,month:Number(o[e].slice(5,7)),year:Number(o[e].slice(0,4))});return{days:o,weeks:s,months:s.flatMap((e,t)=>{let n=e.find(e=>o[e].slice(8)===`01`);return n===void 0?[]:[{index:t,label:Number(o[n].slice(5,7))}]}),monthLabels:c}}function Yl(e,t){return e<=0?0:t<=0?1:Math.min(4,Math.max(1,Math.ceil(e/t*4)))}function Xl(e,t=new Date){if(e===`today`){let e=Gl(t);return Array.from({length:24},(t,n)=>`${e}T${Wl(n)}:00`)}let n=ql(e,t),r=Kl[e]??0;return n?Array.from({length:r},(e,t)=>Gl(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t))):[]}function Zl(e,t){if(t.length===0)return e;let n=new Map(e.map(e=>[e.bucket,e.value]));return t.map(e=>({bucket:e,value:n.get(e)??0}))}var Ql=e=>`${e.slice(5,7)}/${e.slice(8,10)}`,$l=e=>e.includes(`T`)?e.slice(11,16):Ql(e),eu=e=>e.includes(`T`)?`${Ql(e)} ${e.slice(11,16)}`:Ql(e);function tu(e){let t=new Map;for(let n of e){let e=t.get(n.key)??{key:n.key,requests:0,tokens:0,costUsd:0};e.requests+=n.requests,e.tokens+=n.tokens,e.costUsd+=n.costUsd,t.set(n.key,e)}let n=[...t.values()],r=n.reduce((e,t)=>e+t.costUsd,0),i=n.reduce((e,t)=>e+t.requests,0);return n.map(e=>({...e,share:r>0?e.costUsd/r:i>0?e.requests/i:0}))}function nu(e){return Math.max(0,Math.round(e.requests*(1-e.successRate)))}function ru(e){let t=re();if(!Number.isFinite(e)||e<=0)return`${t.symbol}0`;let n=e*t.rate;return n<.01?`${t.symbol}<0.01`:n<1e3?`${t.symbol}${n.toFixed(t.decimals)}`:I(e,{compact:!0})}function iu(e,t=new Date){return Zl(Ul(e,`requests`),Xl(`today`,t))}var au=e=>String(e).padStart(2,`0`);function ou(e,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1),r=`${n.getFullYear()}-${au(n.getMonth()+1)}-${au(n.getDate())}`;return e.filter(e=>e.bucket===r).reduce((e,t)=>e+t.tokens,0)}function su(e,t){return t<=0?null:(e-t)/t}function cu(e,t){let n=[...e].sort((e,t)=>t.tokens-e.tokens)[0];return!n||n.tokens<=0?null:{model:n.model,share:t>0?Math.min(1,n.tokens/t):1}}var lu={session:300,weekly:10080};function uu(e){return e==null||!Number.isFinite(e)?null:Math.min(100,Math.max(0,100-e))}function du(e,t){let n=uu(t?.usedPercent);return n===null?null:{kind:e,windowMinutes:t?.windowMinutes??lu[e],remaining:n,resetsAt:t?.resetsAtUtc??null}}function fu(e){let t=[];for(let{provider:n,account:r}of e){if(r.status!==`active`||!r.quota)continue;let e=r.quota,i=[du(`session`,e.session),du(`weekly`,e.weekly)].filter(e=>e!==null),a=uu(e.credits?.usedPercent);a!==null&&i.push({kind:`credits`,windowMinutes:null,remaining:a,resetsAt:null}),i.length!==0&&t.push({accountId:r.id,providerId:n.id,providerName:e.planLabel||n.name,providerIcon:n.icon??null,accountName:r.displayName||r.accountEmail||r.id,rows:i})}return t}function pu(e){let t=[];for(let n of e){if(!n.enabled||!Hl(n)||n.quota?.isValid===!1)continue;let e=[];for(let t of n.quota?.plans??[]){let n=Il(t);Fl(t)?e.push({kind:`window`,windowMinutes:t.windowMinutes??null,remaining:100-(n??0),resetsAt:t.resetsAtUtc??null}):(t.remaining!=null||n!=null)&&e.push({kind:`balance`,windowMinutes:null,remaining:n==null?null:100-n,resetsAt:t.resetsAtUtc??null,amount:t.remaining==null?null:{value:t.remaining,unit:t.unit??null},label:t.name??null})}e.length!==0&&t.push({accountId:`provider:${n.id}`,providerId:n.id,providerName:n.name,providerIcon:n.icon??null,accountName:``,rows:e})}return t}function mu(e){let t=null;for(let n of e)for(let e of n.rows)e.remaining!==null&&(!t||e.remaining<t.row.remaining)&&(t={plan:n,row:{...e,remaining:e.remaining}});return t}function hu(e,t){let n=[];for(let t of e)for(let e of t.rows)e.remaining!==null&&n.push({plan:t,row:{...e,remaining:e.remaining}});return n.sort((e,t)=>e.row.remaining-t.row.remaining).slice(0,t)}function gu(e){return e<10?`red`:e<30?`orange`:`green`}function _u(e,t){let n=(e,n)=>new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{style:`unit`,unit:n,unitDisplay:t===`zh`?`long`:`narrow`}).format(e);return e>=1440&&e%1440==0?n(e/1440,`day`):e>=60?n(Math.round(e/60),`hour`):n(e,`minute`)}function vu(e,t,n=Date.now()){if(!e)return null;let r=new Date(e).getTime()-n;if(!Number.isFinite(r)||r<=0)return null;let i=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`}),a=r/36e5;return a>=48?i.format(Math.round(a/24),`day`):a>=1?i.format(Math.round(a),`hour`):i.format(Math.max(1,Math.round(r/6e4)),`minute`)}function yu(e,t,n,r=Date.now()){if(!e)return null;let i=Math.max(0,(r-e)/1e3),a=new Intl.RelativeTimeFormat(t===`zh`?`zh-CN`:`en-US`,{numeric:`auto`});return i<60?n:i<3600?a.format(-Math.round(i/60),`minute`):a.format(-Math.round(i/3600),`hour`)}function bu(e,t,n){let r={title:``,detail:``};if(e===`none`)return r;if(e===`alerts`){if(!t.running)return{title:`!`,detail:n.stopped};let e=t.summary?nu(t.summary):0;if(e>0)return{title:`⚠ ${e}`,detail:n.failures(e)};let i=mu(t.plans);if(i&&i.row.remaining<10){let e=`${Math.round(i.row.remaining)}%`;return{title:`⚠ ${e}`,detail:n.quota(i.plan.providerName,n.windowName(i.row),e)}}return r}if(e===`quota`){let e=mu(t.plans);if(!e)return r;let i=`${Math.round(e.row.remaining)}%`;return{title:i,detail:n.quota(e.plan.providerName,n.windowName(e.row),i)}}let i=t.summary;if(!i||!t.running)return r;switch(e){case`requests`:{let e=N(i.requests,!0);return{title:e,detail:n.requests(e)}}case`tokens`:{let e=N(i.inputTokens+i.outputTokens,!0);return{title:e,detail:n.tokens(e)}}case`cost`:{let e=ru(i.costUsd);return{title:e,detail:n.cost(e)}}}}var xu={title:`requests`,sections:{overview:!0,cost:!0,chart:!0,topModel:!0,compareYesterday:!1,cacheHitRate:!1,quota:!0,clients:!1}},Su=()=>!!j()?.tray;function Cu(){let[e,t]=(0,U.useState)(xu),[n,r]=(0,U.useState)(!j()?.tray);return(0,U.useEffect)(()=>{let e=j()?.tray;if(!e)return;let n=!0;e.getPrefs().then(e=>{n&&(t(e),r(!0))});let i=e.onPrefsChanged(t);return()=>{n=!1,i()}},[]),[e,(0,U.useCallback)(e=>{t(e);let n=j()?.tray;n&&n.setPrefs(e).then(t)},[]),n]}function wu(){let e=T(),[t,n]=(0,U.useState)(null);return(0,U.useEffect)(()=>{let e=j()?.tray;if(!e)return;let t=!0;e.getState().then(e=>{t&&n(e)});let r=e.onStateChanged(n);return()=>{t=!1,r()}},[]),t??{running:e.isSuccess,port:null,activity:null,apiVersionMismatch:!1,updateAvailable:null}}function Tu(e,t,n){return{...e,sections:{...e.sections,[t]:n}}}var Eu=3e5,Du=new Map,Ou=()=>-new Date().getTimezoneOffset(),ku=Object.fromEntries(w.map(e=>[e,!1]));function Au(e,t){let n=r(),{enabled:i,background:a}=t,o=t.titleOnly?ku:e.sections,s=e.title!==`none`&&e.title!==`quota`,c=e.title===`quota`||e.title===`alerts`,l={refetchInterval:15e3,refetchIntervalInBackground:!1},u=o.quota||c,d=b({queryKey:fe.settings,queryFn:()=>oe(`GET`,`/api/settings`),enabled:i}),f=b({queryKey:fe.stats(`summary`,`today`,``,``),queryFn:()=>oe(`GET`,`/api/stats/summary?range=today`),enabled:i,...l,refetchIntervalInBackground:a&&s}),p=b({queryKey:fe.stats(`timeseries`,`today`,`hour`,`provider`,``,``,Ou()),queryFn:()=>oe(`GET`,`/api/stats/timeseries?range=today&groupBy=hour&by=provider&tzOffset=${Ou()}`),enabled:i&&o.chart,...l,refetchInterval:3e4}),m=b({queryKey:fe.stats(`timeseries`,`7d`,`day`,`provider`,``,``,Ou()),queryFn:()=>oe(`GET`,`/api/stats/timeseries?range=7d&groupBy=day&by=provider&tzOffset=${Ou()}`),enabled:i&&o.compareYesterday,...l,refetchInterval:6e4}),h=b({queryKey:fe.stats(`top`,`today`,``,3,``),queryFn:()=>oe(`GET`,`/api/stats/top-models?range=today&limit=3`),enabled:i&&o.topModel,...l,refetchInterval:3e4}),g=b({queryKey:fe.providers,queryFn:()=>oe(`GET`,`/api/providers`),enabled:i&&(u||o.clients),...l,refetchInterval:6e4,refetchIntervalInBackground:a&&c}),_=b({queryKey:fe.clients,queryFn:()=>oe(`GET`,`/api/clients`),enabled:i&&o.clients,...l,refetchInterval:3e4}),v=(0,U.useMemo)(()=>(g.data??[]).filter(e=>e.enabled&&e.authScheme===`oauth-subscription`),[g.data]),y=be({queries:v.map(e=>({queryKey:fe.providerAccounts(e.id),queryFn:()=>oe(`GET`,`/api/providers/${x(e.id)}/accounts`),enabled:i&&u,...l,refetchInterval:6e4,refetchIntervalInBackground:a&&c}))}),S=v.flatMap((e,t)=>(y[t]?.data??[]).map(t=>({provider:e,account:t}))),C=S.map(e=>`${e.account.id}:${e.account.status}:${e.account.quota?.fetchedAtUtc??``}`).join(`|`),w=de({mutationFn:e=>oe(`POST`,`/api/provider-accounts/${x(e)}/quota`),onSettled:e=>{e&&n.invalidateQueries({queryKey:fe.providerAccounts(e.providerId)})}}),T=i&&u&&(t.live||e.title===`quota`||e.title===`alerts`);(0,U.useEffect)(()=>{if(!T)return;let e=Date.now();for(let{account:t}of S){if(t.status!==`active`)continue;let n=t.quota?.fetchedAtUtc?new Date(t.quota.fetchedAtUtc).getTime():0;Number.isFinite(n)&&e-n<Eu||e-(Du.get(t.id)??0)<Eu||(Du.set(t.id,e),w.mutate(t.id,{onError:()=>{}}))}},[T,C]);let E=[...fu(S),...pu(g.data??[])];return{settings:d.data,summary:f.data,hourly:p.data??[],daily:m.data??[],top:h.data??[],plans:E,hasSubscriptions:S.some(e=>e.account.status===`active`),clients:_.data??[],providers:g.data??[],updatedAt:f.dataUpdatedAt,loading:f.isLoading,error:f.isError}}function ju(e,t,n,r){let{t:i,locale:a}=y(),o=j(),s=(0,U.useMemo)(()=>({requests:e=>i(`tray.title.requests`,{count:e}),tokens:e=>i(`tray.title.tokens`,{count:e}),cost:e=>i(`tray.title.cost`,{amount:e}),quota:(e,t,n)=>i(`tray.title.quota`,{plan:e,window:t,remaining:n}),failures:e=>i(`tray.title.failures`,{count:e}),stopped:i(`tray.status.stopped`),windowName:e=>e.kind===`balance`?e.label??i(`tray.quotaBalance`):e.kind===`credits`||e.windowMinutes==null?i(`tray.quotaCredits`):_u(e.windowMinutes,a)}),[i,a]),c=bu(e.title,{running:t.running,summary:n,plans:r},s);(0,U.useEffect)(()=>{o?.tray.setTitle(c.title,c.detail)},[o,c.title,c.detail])}function Mu(){let[e]=Cu(),t=wu(),n=Au(e,{enabled:t.running,background:!0,live:!1,titleOnly:!0});return ju(e,t,n.summary,n.plans),null}export{Os as $,Rl as A,yl as B,tu as C,Zl as D,Ul as E,Ll as F,qs as G,vl as H,Vl as I,js as J,Es as K,Al as L,zl as M,Bl as N,Xl as O,Hl as P,Fs as Q,kl as R,Yl as S,eu as T,Ol as U,wl as V,Dl as W,Ps as X,Ms as Y,ks as Z,cu as _,Su as a,Ia as at,ou as b,Tu as c,ur as ct,ru as d,be as dt,co as et,iu as f,hu as g,mu as h,xu as i,Ma as it,Pl as j,ql as k,su as l,ot as lt,vu as m,ju as n,ro as nt,Cu as o,Da as ot,gu as p,Ns as q,Au as r,Aa as rt,wu as s,or as st,Mu as t,fo as tt,nu as u,je as ut,yu as v,$l as w,Jl as x,_u as y,El as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Q as n,Y as r,dt as i,ec as a,it as o,ls as s,nt as c,ot as l,ss as u,ut as d}from"./format-DFMHYFFs.js";var f=e(t(),1),p=a(),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Checkbox`,[_,v]=i(g),[y,b]=_(g);function x(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:s,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:m}=e,[h,_]=o({prop:n,defaultProp:i??!1,onChange:l,caller:g}),[v,b]=f.useState(null),[x,S]=f.useState(null),C=f.useRef(!1),[w,T]=f.useReducer(e=>e+1,0),E=!v||!!s||!!v.closest(`form`),k={checked:h,disabled:a,setChecked:_,control:v,setControl:b,name:c,form:s,value:d,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:u,defaultChecked:!O(i)&&i,isFormControl:E,bubbleInput:x,setBubbleInput:S};return(0,p.jsx)(y,{scope:t,...k,children:D(m)?m(k):r})}h(x,`CheckboxProvider`);var S=`CheckboxTrigger`,C=f.forwardRef(h(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:u,required:m,setControl:g,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:x,bubbleInput:C}=b(S,e),w=d(i,g),T=f.useRef(u);return f.useEffect(()=>{let e=a?.form;if(e){let t=h(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,_]),(0,p.jsx)(c.button,{type:`button`,role:`checkbox`,"aria-checked":O(u)?`mixed`:u,"aria-required":m,"data-state":k(u),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:w,onKeyDown:l(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:l(n,e=>{y(),_(e=>O(e)?!0:!e),C&&x&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`CheckboxTrigger`)),w=f.forwardRef(h(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,p.jsx)(x,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(C,{...d,ref:t,__scopeCheckbox:n}),e&&(0,p.jsx)(E,{__scopeCheckbox:n})]})})},`Checkbox`)),T=`CheckboxBubbleInput`,E=f.forwardRef(h(function({__scopeCheckbox:e,onClick:t,...n},i){let{control:a,hasConsumerStoppedPropagationRef:o,userInteractionCount:s,checked:u,defaultChecked:m,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:x,setBubbleInput:S}=b(T,e),C=d(i,S),w=r(a),E=f.useRef(!1),D=f.useRef(u),k=f.useRef(s);f.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=s!==k.current;k.current=s;let i=D.current!==u;D.current=u;let a=!(r&&o.current);if(i&&n){E.current=!r;let t=new Event(`click`,{bubbles:a});e.indeterminate=O(u),n.call(e,!O(u)&&u),e.dispatchEvent(t),E.current=!1}},[x,u,o,s]);let A=f.useRef(!O(u)&&u);return(0,p.jsx)(c.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??A.current,required:h,disabled:g,name:_,value:v,form:y,...n,tabIndex:-1,ref:C,onClick:l(t,e=>{E.current&&e.stopPropagation()}),style:{...n.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function D(e){return typeof e==`function`}h(D,`isFunction`);function O(e){return e===`indeterminate`}h(O,`isIndeterminate`);function k(e){return O(e)?`indeterminate`:e?`checked`:`unchecked`}h(k,`getState`);var A={field:`_field_ovchx_1`,box:`_box_ovchx_2`,visual:`_visual_ovchx_4`,fill:`_fill_ovchx_5`,mark:`_mark_ovchx_6`,copy:`_copy_ovchx_12`},j=`M4.25 9.25 L7.25 12.25 L13.75 5.75`,M=`M4.75 9 L9 9 L13.25 9`,N=(0,f.forwardRef)(function({label:e,description:t,id:r,className:i,checked:a,defaultChecked:o,onCheckedChange:c,...l},d){let m=(0,f.useId)(),h=r??m,g=s(),[_,v]=(0,f.useState)(o??!1),y=a??_,b=y!==!1,x=e=>{a===void 0&&v(e),c?.(e)},S={duration:b?n.duration.instant:n.duration.fast,ease:[...n.ease.standard]};return(0,p.jsxs)(`div`,{className:A.field,children:[(0,p.jsx)(w,{...l,id:h,ref:d,checked:y,onCheckedChange:x,className:[A.box,i].filter(Boolean).join(` `),"aria-describedby":t?`${h}-description`:void 0,"aria-label":l[`aria-label`]??(e?void 0:`Checkbox`),children:(0,p.jsxs)(`span`,{className:A.visual,"aria-hidden":`true`,children:[(0,p.jsx)(u.span,{className:A.fill,initial:!1,animate:{opacity:+!!b,scale:b?1:.6},transition:g?{duration:0}:{scale:n.spring.snappy,opacity:S}}),(0,p.jsx)(`svg`,{className:A.mark,viewBox:`0 0 18 18`,fill:`none`,focusable:`false`,children:(0,p.jsx)(u.path,{initial:!1,animate:{d:y===`indeterminate`?M:j,pathLength:+!!b,opacity:+!!b},transition:g?{duration:0}:{d:n.spring.morph,pathLength:n.spring.snappy,opacity:S},stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`})})]})}),e||t?(0,p.jsxs)(`div`,{className:A.copy,children:[e?(0,p.jsx)(`label`,{htmlFor:h,children:e}):null,t?(0,p.jsx)(`span`,{id:`${h}-description`,children:t}):null]}):null]})});N.displayName=`Checkbox`;export{N as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{
|
|
1
|
+
import{o as e,r as t}from"./createLucideIcon-7fjTeqBK.js";import{Q as n,cs as r,ec as i,fs as a,ls as o,ps as s,ss as c,us as l}from"./format-DFMHYFFs.js";import{t as ee}from"./circle-alert-B2ow_KNW.js";import{t as te}from"./loader-circle-D-RkwQwX.js";var u=e(t(),1),d={root:`_root_8729c_1`,surface:`_surface_8729c_16`,trigger:`_trigger_8729c_39`,face:`_face_8729c_41`,icon:`_icon_8729c_64`,prompt:`_prompt_8729c_68`,secondary:`_secondary_8729c_70`,primary:`_primary_8729c_71`,status:`_status_8729c_90`,statusText:`_statusText_8729c_95`,check:`_check_8729c_97`,checkDisc:`_checkDisc_8729c_98`,checkTick:`_checkTick_8729c_99`,spinner:`_spinner_8729c_100`,spin:`_spin_8729c_100`,srOnly:`_srOnly_8729c_103`},f=i(),p=12,{blur:m}=n,h=[...n.ease.enter],g=[...n.ease.standard],_=(e,t)=>{let n=2*Math.PI/(e*1.2);return{type:`spring`,stiffness:n*n,damping:2*(1-t)*n,mass:1}},v=_(.44,.18),ne=_(.34,0),y=_(.36,.06),b=()=>()=>{};function re(){let e=(0,u.useSyncExternalStore)(b,()=>!0,()=>!1);return!!o()&&e}var x={hidden:e=>({opacity:0,x:e*p,filter:`blur(${m.soft}px)`}),shown:{opacity:1,x:0,filter:`blur(0px)`,transition:{x:y,opacity:{duration:.2,ease:h,delay:.04},filter:{duration:.22,ease:h,delay:.04}}},gone:e=>({opacity:0,x:e*-12*.6,filter:`blur(${m.soft}px)`,transition:{x:y,opacity:{duration:.12,ease:g},filter:{duration:.12,ease:g}}})},S={hidden:{opacity:0},shown:{opacity:1,transition:{duration:.14}},gone:{opacity:0,transition:{duration:.1}}};function ie({id:e,direction:t,reduced:n,onSize:r,children:i,labelledBy:a}){let o=(0,u.useRef)(null),l=s();return(0,u.useLayoutEffect)(()=>{let t=o.current;if(!t||!l)return;let n=()=>{let n=t.style.flex;t.style.flex=`none`;let i=t.offsetWidth;t.style.flex=n,r(e,i)};if(n(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(n);return i.observe(t),()=>i.disconnect()},[e,r,l]),(0,f.jsx)(c.div,{ref:o,className:d.face,"data-face":e,custom:t,role:a?`group`:void 0,"aria-labelledby":a,variants:n?S:x,initial:`hidden`,animate:`shown`,exit:`gone`,inert:!l||void 0,children:i})}function ae({reduced:e}){return(0,f.jsxs)(`svg`,{className:d.check,viewBox:`0 0 18 18`,fill:`none`,"aria-hidden":`true`,children:[(0,f.jsx)(c.circle,{className:d.checkDisc,cx:`9`,cy:`9`,r:`8`,style:{transformOrigin:`9px 9px`},initial:!e&&{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:{scale:_(.34,.3),opacity:{duration:.12}}}),(0,f.jsx)(c.path,{className:d.checkTick,d:`M5.6 9.3 7.8 11.4 12.4 6.7`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,initial:!e&&{pathLength:0},animate:{pathLength:1},transition:{duration:.28,ease:h,delay:.12}})]})}function C({label:e,icon:t,prompt:n,confirmLabel:i=`Delete`,cancelLabel:o=`Cancel`,pendingLabel:s=`Deleting`,doneLabel:p=`Deleted`,errorLabel:m=`Couldn’t finish`,retryLabel:h=`Retry`,undoLabel:g=`Undo`,undoingLabel:_=`Restoring`,tone:y=`danger`,onConfirm:b,onUndo:x,onCancel:S,state:C,defaultState:oe=`idle`,onStateChange:w,confirmTimeout:se=6e3,resultTimeout:ce=5e3,cancelOnOutsidePress:T=!0,disabled:E=!1,className:D,ref:O}){let k=re(),A=`${(0,u.useId)()}-prompt`,j=(0,u.useRef)(null);(0,u.useImperativeHandle)(O,()=>j.current,[]);let[le,ue]=(0,u.useState)(oe),M=C??le,[N,de]=(0,u.useState)(1),[P,fe]=(0,u.useState)(`confirm`),[pe,F]=(0,u.useState)(``),I=(0,u.useRef)({state:M,onStateChange:w,controlled:C!==void 0});(0,u.useLayoutEffect)(()=>{I.current={state:M,onStateChange:w,controlled:C!==void 0}});let L=(0,u.useRef)(!1),R=(0,u.useRef)(0),z=(0,u.useCallback)(e=>{if(e===I.current.state)return;let t=j.current;L.current=!!t&&(t.contains(document.activeElement)||document.activeElement===document.body),de(e===`idle`?-1:1),I.current.controlled||ue(e),I.current.state=e,I.current.onStateChange?.(e)},[]),B=(0,u.useCallback)(()=>{R.current++,z(`idle`)},[z]),V=(0,u.useCallback)(async e=>{let t=e===`confirm`?b:x,n=++R.current;fe(e);let r;try{r=t?.()}catch{z(`error`),F(m);return}if(r&&typeof r.then==`function`){z(`pending`),F(e===`confirm`?s:_);try{await r}catch{if(n!==R.current)return;z(`error`),F(m);return}if(n!==R.current)return}if(e===`undo`){z(`idle`),F(`Undone`);return}z(`done`),F(x?`${p}. ${g} is available.`:p)},[p,m,z,b,x,s,g,_]),H=(0,u.useCallback)(()=>{S?.(),B(),F(`Cancelled`)},[S,B]),U=(0,u.useRef)(()=>{});(0,u.useLayoutEffect)(()=>{U.current=()=>{I.current.state===`confirming`?H():B()}});let W=l(`auto`),G=(0,u.useRef)(0),K=(0,u.useRef)(0),q=(0,u.useCallback)((e,t)=>{if(e!==I.current.state||Math.abs(t-G.current)<.5)return;let n=G.current;if(G.current=t,!n||k){W.jump(`auto`);return}W.get()===`auto`&&W.jump(n);let i=++K.current;r(W,t,t>n?v:ne).then(()=>{i===K.current&&W.jump(`auto`)})},[k,W]),J=l(1),Y=(0,u.useRef)(null),X=(0,u.useRef)({hover:!1,hidden:!1}),Z=M===`confirming`?se:M===`done`||M===`error`?ce:0,Q=(0,u.useCallback)(()=>{let e=Y.current;e&&(X.current.hover||X.current.hidden?e.pause():e.play())},[]);(0,u.useEffect)(()=>{if(!Z)return;J.jump(1);let e=r(J,0,{duration:Z/1e3,ease:`linear`});return Y.current=e,e.then(()=>{Y.current===e&&(Y.current=null,U.current())}),Q(),()=>{Y.current===e&&(Y.current=null),e.stop()}},[J,M,Q,Z]),(0,u.useEffect)(()=>{let e=()=>{X.current.hidden=document.hidden,Q()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[Q]),(0,u.useEffect)(()=>{if(M!==`confirming`||!T)return;let e=e=>{j.current?.contains(e.target)||H()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[H,T,M]),(0,u.useLayoutEffect)(()=>{if(!L.current)return;L.current=!1;let e=j.current;e&&(e.querySelector(`[data-face="${M}"]`)?.querySelector(`[data-autofocus]:not(:disabled)`)??e).focus({preventScroll:!0})},[M]);let me=e=>{e.key===`Escape`&&(M===`confirming`?(e.preventDefault(),e.stopPropagation(),H()):(M===`done`||M===`error`)&&(e.preventDefault(),e.stopPropagation(),B()))},$=n??(0,f.jsxs)(f.Fragment,{children:[e,`?`]}),he=(()=>{switch(M){case`confirming`:return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{id:A,className:d.prompt,children:$}),(0,f.jsx)(`button`,{type:`button`,className:d.secondary,"data-autofocus":!0,onClick:H,children:o}),(0,f.jsx)(`button`,{type:`button`,className:d.primary,onClick:()=>void V(`confirm`),children:i})]});case`pending`:return(0,f.jsxs)(`span`,{className:d.status,children:[(0,f.jsx)(te,{className:d.spinner,size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,f.jsx)(`span`,{children:P===`undo`?_:s})]});case`done`:return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`span`,{className:d.status,"data-tone":`success`,children:[(0,f.jsx)(ae,{reduced:k}),(0,f.jsx)(`span`,{className:d.statusText,children:p})]}),x&&(0,f.jsx)(`button`,{type:`button`,className:d.secondary,"data-autofocus":!0,onClick:()=>void V(`undo`),children:g})]});case`error`:return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`span`,{className:d.status,"data-tone":`danger`,children:[(0,f.jsx)(ee,{size:16,strokeWidth:1.75,"aria-hidden":`true`}),(0,f.jsx)(`span`,{className:d.statusText,children:m})]}),(0,f.jsx)(`button`,{type:`button`,className:d.secondary,"data-autofocus":!0,onClick:()=>void V(P),children:h})]});default:return(0,f.jsxs)(`button`,{type:`button`,className:d.trigger,"data-autofocus":!0,disabled:E,onClick:()=>{F(typeof $==`string`?$:``),z(`confirming`)},children:[t&&(0,f.jsx)(`span`,{className:d.icon,"aria-hidden":`true`,children:t}),(0,f.jsx)(`span`,{children:e})]})}})();return(0,f.jsxs)(`div`,{ref:j,className:[d.root,D].filter(Boolean).join(` `),"data-state":M,"data-tone":y,"data-disabled":E||void 0,tabIndex:-1,onKeyDown:me,"aria-busy":M===`pending`||void 0,onPointerEnter:()=>{X.current.hover=!0,Q()},onPointerLeave:()=>{X.current.hover=!1,Q()},onPointerCancel:()=>{X.current.hover=!1,Q()},children:[(0,f.jsx)(c.div,{className:d.surface,style:{width:W},children:(0,f.jsx)(a,{initial:!1,custom:N,children:(0,f.jsx)(ie,{id:M,direction:N,reduced:k,onSize:q,labelledBy:M===`confirming`?A:void 0,children:he},M)})}),(0,f.jsx)(`span`,{className:d.srOnly,role:`status`,"aria-live":`polite`,children:pe})]})}export{C as t};
|