tokentracker-cli 1.4.4 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +1 -0
- package/README.ja.md +1 -0
- package/README.ko.md +1 -0
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dashboard/dist/assets/{AchievementBadge-slL-XBCu.js → AchievementBadge-DF8q1x6R.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-BeFkGc5M.js → AchievementsPage-B8Dg5myo.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BrGUIipD.js → AchievementsSection-oPPiyP3y.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-avmK1ODc.js → BadgeDetailModal-PneMW4B4.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-DaEPdEZi.js → BotAnimated-GOlSvEiz.js} +1 -1
- package/dashboard/dist/assets/{Card-CIZCccTA.js → Card-BT5G0GE0.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-BhRj0SYO.js → CloudCheckoutPage-BNeL5Muo.js} +1 -1
- package/dashboard/dist/assets/{CloudPage-CvaN8a54.js → CloudPage-26bhEYqI.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-BUNuXmYF.js → CommandPalette-CiMSYHNK.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-BCI0WHPr.js → CommunityStatsModal-fK3BE9CW.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-CT7IwtLR.js → ConfirmModal-CrUlEHyZ.js} +1 -1
- package/dashboard/dist/assets/{Controls-CtnMyxNH.js → Controls-CbjSwq6k.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BuzyITeL.js → DashboardPage-CP_PMMga.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-1Ps1-1dw.js → DateRangePopover-E-2Z6imh.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-Dt-dVQAG.js → DevicePage-B0fLd80M.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-D-DRTF1u.js → DialogClose-xJKE22Y6.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-CXDxWzGi.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CiiRTn3_.js → DialogTitle-f8vnnH7z.js} +1 -1
- package/dashboard/dist/assets/{ElectricLogo-k6RFJ2qC.js → ElectricLogo-Ci9WZfHK.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CNHg83aK.js → FadeIn-BXqtyAmn.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CIYW5dc3.js → HeaderGithubStar-BV5SYJMi.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-Dn80DyPM.js → HoverTooltip-D3gpW3Jh.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-B29dYfoI.js → IpCheckPage-G7fIWXpL.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-Dzc8_QyW.js → LandingPage-BQNOdAkR.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-DXPcIhyQ.js → LeaderboardPage-D2_wXazL.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-DxEdj2Zq.js → LeaderboardProBadge-3xJ-mH2v.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-DnKY2223.js → LeaderboardProfileModal-23pH6Ud7.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CY94ngqy.js → LeaderboardProfilePage-DSezSR58.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-AlvnAPCD.js → LimitsPage-BLJsmVVy.js} +8 -8
- package/dashboard/dist/assets/{LocalOnlyNotice-EHw7BeYS.js → LocalOnlyNotice-Dsk-d0Hr.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-E5E3i2kj.js → LoginCard-C7dugIIn.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DxhQI9kh.js → LoginModal-B7RuLsTF.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-DRwJn-Fw.js → LoginPage-u32vJQN9.js} +1 -1
- package/dashboard/dist/assets/{PetPage-DIpVTdiC.js → PetPage-Dbc975oU.js} +2 -2
- package/dashboard/dist/assets/{PopoverPopup-Bjs7E91g.js → PopoverPopup-D-yECvH9.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-DqXIjym-.js → ProviderIcon-CHtZiJUN.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-DxSRYQgP.js → ResetPasswordPage-ctuIsNk0.js} +1 -1
- package/dashboard/dist/assets/{Select-BfjrcaiM.js → Select-DN4Kq_R1.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-Dpdlb0cU.js → SelectItemText-C-HmeD8L.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-Cnp_PMaD.js → SelfHostPage-BZOL3JMt.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-fBwG-qXq.js → ServiceStatusPage-C0sDYa8c.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BEk7AHdq.js → SessionsPage-l0-FkcJB.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BgML2jQR.js → SettingsPage-CrczfZiZ.js} +3 -3
- package/dashboard/dist/assets/{SkillsPage-DcvVZ3Wn.js → SkillsPage-Cz6G9d3o.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-D29yX2Hb.js → TokenGalaxy-B5IGaLQK.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-CjzmNK2l.js → TooltipPopup-B6FqLWO7.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-DfnQrsrx.js → TrendMonitor-B4kJUwmF.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CRYomYfk.js → WidgetsPage-BKo3DBxT.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CvQI5zUw.js → WrappedPage-Blm3aPO5.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-BZ-i40Kf.js → __vite-browser-external--HDUIUZr.js} +3 -3
- package/dashboard/dist/assets/{agent-logos-CvOX7WXW.js → agent-logos-DMtDEx7_.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-BrQrZJtW.js → arrow-left-Bo9y7VzF.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-fC11gmFY.js → arrow-right-BLMU8Y5U.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CCMEqQQp.js → arrow-up-right-B4hXO4sc.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-OaIQ06qD.js → calendar-days-D9HaEtgo.js} +1 -1
- package/dashboard/dist/assets/{check-D888uFpx.js → check-BJNGKpX8.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-BJ0BpS_w.js → chevron-down-CoGC_RLK.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-BeOpEJTZ.js → cloud-checkout-Du5FoHqV.js} +1 -1
- package/dashboard/dist/assets/{composite-CUuXvKos.js → composite-BfIUPpl8.js} +1 -1
- package/dashboard/dist/assets/{download-BJ7CKwx5.js → download-C1K_v0C0.js} +1 -1
- package/dashboard/dist/assets/{external-link-CDaZwJVN.js → external-link-D-xHhfj5.js} +1 -1
- package/dashboard/dist/assets/{flame-ChyUKs-9.js → flame-DXD6uvhM.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-B6WX7zcH.js → format-tokens-B9riGvNj.js} +1 -1
- package/dashboard/dist/assets/{gift-CQlAZUJ5.js → gift-LPR-nD0J.js} +1 -1
- package/dashboard/dist/assets/{host-mode-Gw6KD5OJ.js → host-mode-C2K0MMOs.js} +1 -1
- package/dashboard/dist/assets/{icons-C7gGTMuQ.js → icons-DLdtLqEt.js} +1 -1
- package/dashboard/dist/assets/{index-CLb64Tlj.js → index-BL11MboX.js} +1 -1
- package/dashboard/dist/assets/{index-Bm2dDAVL.js → index-CC3cXeBa.js} +1 -1
- package/dashboard/dist/assets/{index-C0pbymQa.js → index-CXdJ7zMN.js} +1 -1
- package/dashboard/dist/assets/{info-CvOmd88O.js → info-tnXKCyuK.js} +1 -1
- package/dashboard/dist/assets/{link-2-BNEPxvlF.js → link-2-DOk9Tcg1.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-bRHxCgY3.js → loader-circle-DIl96Mw-.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-D-X0-uvt.js → modifiers.esm-2H_1taJ6.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-Bo7d-q73.js → monitor-smartphone-tnp-03hs.js} +1 -1
- package/dashboard/dist/assets/{play-DqpGELN5.js → play-BGMuGTdN.js} +1 -1
- package/dashboard/dist/assets/{plus-2fA1tz7S.js → plus-XETAaErq.js} +1 -1
- package/dashboard/dist/assets/{provider-display-B1KigDYZ.js → provider-display-BYNT4zPc.js} +1 -1
- package/dashboard/dist/assets/{react-DYja9tZG.js → react-OW7HALVO.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-BerB8y-A.js → safePolygon-CAfS8-ct.js} +1 -1
- package/dashboard/dist/assets/{search-CU6UVI1L.js → search-B7ZJhoau.js} +1 -1
- package/dashboard/dist/assets/{server-CZR4PTdb.js → server-CWrP7mtL.js} +1 -1
- package/dashboard/dist/assets/{shield-check-BGbNmrMP.js → shield-check-ip5IQEK3.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CJLEzxDf.js → skills-api-CpyoNTeB.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-CJ1NZWER.js → sortable.esm-YvzWzPDu.js} +1 -1
- package/dashboard/dist/assets/{store-CJFdru_6.js → store-DRK6-JBg.js} +1 -1
- package/dashboard/dist/assets/{terminal-ClyQ8tvQ.js → terminal-DQRoJSvh.js} +1 -1
- package/dashboard/dist/assets/{trash-Dg2PWl5-.js → trash-8h_26atF.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Ca995kap.js → use-community-stats-DYlhIXsp.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-BKbMGVji.js → use-latest-request-guard-AxJF9SEJ.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CGyd8lvc.js → use-limits-display-prefs-DOZzuTwo.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-Dqeuqm9O.js → use-native-settings-BQgB6_PB.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-Nj7R1iUu.js → use-ordered-list-ogi7Okzf.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-D5PHT_kx.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-C_H5BaGV.js → use-session-efficiency-pref-DP3hu3Rp.js} +1 -1
- package/dashboard/dist/assets/{use-transform-CC90hurD.js → use-transform-BQqoo1et.js} +1 -1
- package/dashboard/dist/assets/use-usage-limits-DAf6O4aZ.js +1 -0
- package/dashboard/dist/assets/{useCurrency-CMHIL39_.js → useCurrency-Bv9g8mpq.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-CRSfrGQq.js → usePositioner-CQiZGknc.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-B5jhM_Kb.js → useTokenFormat-BUVirY0k.js} +1 -1
- package/dashboard/dist/assets/{zap-CKx8ySZs.js → zap-DR3VD0yY.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/sync.js +546 -31
- package/src/lib/async-queue-reader.js +37 -16
- package/src/lib/codex-context-breakdown.js +8 -1
- package/src/lib/codex-rollout-parser.js +65 -5
- package/src/lib/grok-limits.js +56 -0
- package/src/lib/pricing/matcher.js +9 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +356 -8
- package/src/lib/session-analytics.js +1 -1
- package/src/lib/usage-limits.js +33 -1
- package/dashboard/dist/assets/DialogDescription-BOYDS1mM.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-CGMbDpHQ.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-DtaaE7D8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bG as Cn,r as o,cv as st,a$ as $e,b8 as qt,c0 as Kt,J as Ue,N as me,cs as Tn,aY as _e,b1 as K,b2 as En,cw as Yt,ct as wn,b0 as $,di as Lt,dj as ht,dk as Vt,b_ as xt,b3 as Be,bb as ye,dl as Dt,bo as kt,dm as vn,bJ as zt,bY as $t,dn as ct,dp as ut,dq as Gt,dr as Et,cE as Mn,ds as On,dt as yt,cK as Pn,bE as Ge,aW as re,j as ge,c2 as It,c7 as An,c9 as Fn,ca as Ln,bW as it,bF as Vn,cy as Dn,bL as kn,bq as rt,cq as Hn,M as Xt,K as We,du as Nn,bR as Un,dv as _n,bU as Bn,bV as Jt,b6 as Wn,dw as jn,c6 as Qt,dx as St}from"./__vite-browser-external-BZ-i40Kf.js";import{i as Rt,E as Zt,b as en,F as qn,P as Kn,c as Fe,a as Yn,G as zn,H as Te,J as tn,B as $n,u as Gn,K as Xn,n as Jn,y as Qn,d as Zn,r as er,I as tr,x as nr,p as rr,C as or,D as sr}from"./composite-CUuXvKos.js";import{u as ir,a as lr,b as cr,p as ur,r as ar,g as fr}from"./usePositioner-CRSfrGQq.js";function Ye(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function dr(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:d=0,reason:u=Cn}=t,C=e.context.dataRef,h=o.useRef(void 0),p=st(),T=$e(),g=o.useMemo(()=>{function P(c,v,U,E){const a=me(u,v,U);c&&E==="touch"&&d>0?T.start(d,()=>{e.setOpen(!0,a)}):e.setOpen(c,a)}function F(c,v,U){const E=C.current.openEvent,a=e.select("domReferenceElement")!==v;return c&&a||!c||!s?!0:E&&(typeof l=="function"?l():l)?!U(E.type):!1}return{onPointerDown(c){h.current=Rt(c.pointerType,!0)&&Zt(c.nativeEvent)?"virtual":c.pointerType},onMouseDown(c){const v=h.current,U=c.nativeEvent,E=e.select("open");if(c.button!==0||r==="click"||Rt(v,!0)&&i)return;const a=F(E,c.currentTarget,A=>A==="click"||A==="mousedown"),R=qt(U),w=Kt(R);if(w||v==="virtual"){P(a,U,w?R:c.currentTarget,v);return}const I=c.currentTarget;p.request(()=>{P(a,U,I,v)})},onClick(c){if(r==="mousedown-only")return;const v=h.current;if(r==="mousedown"&&v){h.current=void 0;return}if(Rt(v,!0)&&i)return;const U=e.select("open"),E=F(U,c.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");P(E,c.nativeEvent,c.currentTarget,v)},onKeyDown(){h.current=void 0}}},[C,r,i,u,e,l,s,p,T,d]);return o.useMemo(()=>n?{reference:g}:Ue,[n,g])}function pr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Tn(),i=en()!=null,l=_e(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Kn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const d={open:t,floatingId:s};r.reference!==void 0&&(d.referenceElement=r.reference,d.domReferenceElement=En(r.reference)?r.reference:null),r.floating!==void 0&&(d.floatingElement=r.floating),l.update(d)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}function Ht(e){return $t&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Qe(e,t){return at(t,e===Gt||e===Et,e===ct||e===ut)}function bt(e,t,n){return at(t,e===Et,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function gr(e,t,n){return at(t,n?e===ct:e===ut,e===Et)}function mr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Gt;return t==="both"||t==="horizontal"&&r?e==="Escape":at(t,s,i)}function hr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:d=!1,loopFocus:u=!1,nested:C=!1,rtl:h=!1,virtual:p=!1,focusItemOnOpen:T="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:P=!0,disabledIndices:F=void 0,orientation:c="vertical",triggerOrientation:v=c,parentOrientation:U,id:E,resetOnPointerLeave:a=!0,externalTree:R,nestedReturnFocusRef:w,grid:I}=t,A=I!=null,O=e.useState("open"),H=e.useState("floatingElement"),Y=e.useState("domReferenceElement"),G=e.context.dataRef,y=Yt(H),k=wn(Y),B=Fe(y),ie=en(),X=Yn(R),J=o.useRef(T),x=o.useRef(l??-1),f=o.useRef(null),D=o.useRef(!0),b=$(m=>{s(x.current===-1?null:x.current,m)}),M=o.useRef(!!H),W=o.useRef(O),q=o.useRef(!1),te=o.useRef(!1),ee=o.useRef(null),fe=Fe(F),ue=Fe(O),Q=Fe(l),ae=Fe(a),j=st(),z=st(),oe=$(()=>{j.cancel();function m(V){p||(ee.current=zn(V,{sync:q.current,preventScroll:!0}))}const L=n.current[x.current],Z=te.current;L&&m(L),(q.current?V=>V():V=>j.request(V))(()=>{const V=n.current[x.current]||L;if(!V)return;L||m(V),xe&&(Z||!D.current)&&V.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{G.current.orientation=c},[G,c]),K(()=>{O||(f.current=null),(!O||T!=="auto")&&(J.current=T)},[O,T]),K(()=>{i&&(O&&H?(x.current=l??-1,J.current&&l!=null&&(te.current=!0,b())):M.current&&(x.current=-1,b()))},[i,O,H,l,b]),K(()=>{if(i){if(!O){q.current=!1;return}if(H)if(r==null){if(q.current=!1,Q.current!=null)return;if(M.current&&(x.current=-1,oe()),(!W.current||!M.current)&&J.current&&(f.current!=null||J.current===!0&&f.current==null)){let m=0;const L=()=>{n.current[0]==null?(m<2&&(m?S=>z.request(S):queueMicrotask)(L),m+=1):(x.current=f.current==null||bt(f.current,v,h)||C?ht(n):Vt(n),f.current=null,b())};L()}}else Lt(n.current,r)||(x.current=r,oe(),te.current=!1)}},[i,O,H,r,Q,C,n,v,h,b,oe,z]),K(()=>{if(!i||H||!X||p||!M.current)return;const m=X.nodesRef.current,L=m.find(V=>V.id===ie)?.context?.elements.floating,Z=xt(Be(Y??L??null)),S=m.some(V=>V.context&&ye(V.context.elements.floating,Z));L&&!S&&D.current&&L.focus({preventScroll:!0})},[i,H,Y,X,ie,p]),K(()=>{W.current=O,M.current=!!H});const ne=r!=null,Se=$(m=>{if(!ue.current)return;const L=n.current.indexOf(m.currentTarget);L!==-1&&(x.current!==L||r!==L)&&(x.current=L,b(m))}),he=$(()=>U??X?.nodesRef.current.find(m=>m.id===ie)?.context?.dataRef?.current.orientation),Re=$(()=>ht(n,fe.current)),se=$(m=>{if(D.current=!1,q.current=!0,m.which===229||!ue.current&&m.currentTarget===B.current)return;if(C&&mr(m.key,c,h,A)){Qe(m.key,he())||Te(m),e.setOpen(!1,me(Dt,m.nativeEvent));const V=w?.current??Y;kt(V)&&V.focus();return}r!=null&&r!==x.current&&!Lt(n.current,r)&&(x.current=r);const L=x.current,Z=ht(n,F),S=Vt(n,F);if(k||(m.key==="Home"&&(Te(m),x.current=Z,b(m)),m.key==="End"&&(Te(m),x.current=S,b(m))),I!=null){const V=I(m,x.current,n,c,u,h,F,Z,S);if(V!=null&&V!==x.current&&(x.current=V,b(m)),c==="both")return}if(Qe(m.key,c)){Te(m);const V=xt(m.currentTarget.ownerDocument);if(O&&!p&&ye(m.currentTarget,V)&&!n.current.some(de=>de!=null&&ye(de,V))){x.current=bt(m.key,c,h)?Z:S,b(m),r===x.current&&oe();return}const{index:Ce,wrapped:be}=vn(n.current,L,{decrement:!bt(m.key,c,h),loopFocus:u,allowEscape:d,disabledIndices:F,minIndex:Z,maxIndex:S});be&&(q.current=!1),x.current=Ce,b(m)}}),xe=o.useMemo(()=>({onFocus(L){q.current=!0,Se(L)},onClick({currentTarget:L}){p||L.focus({preventScroll:!0})},onMouseMove(L){Ht(L)||(q.current=!0,te.current=!1,g&&Se(L))},onPointerLeave(L){if(!ue.current||!D.current||L.pointerType==="touch")return;q.current=!0;const Z=L.relatedTarget;if(!(!g||n.current.includes(Z))&&ae.current&&(ee.current?.(),ee.current=null,x.current=-1,b(L),!p)){const S=B.current,V=xt(Be(S));S&&ye(S,V)&&S.focus({preventScroll:!0})}}}),[Se,ue,B,g,n,b,ae,p]),N=o.useMemo(()=>p&&O&&ne&&{"aria-activedescendant":`${E}-${r}`},[p,O,ne,E,r]),ce=o.useMemo(()=>({...k?{}:N,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&O&&!p){const L=qt(m.nativeEvent);if(L&&!ye(B.current,L))return;Te(m);const Z=me(zt,m.nativeEvent);e.setOpen(!1,Z);const S=w?.current??Y;!Z.isCanceled&&kt(S)&&S.focus();return}se(m)},onPointerMove(m){Ht(m)||(D.current=!0)}}),[N,se,B,k,e,O,p,Y,w]),Ie=o.useMemo(()=>{function m(S){e.setOpen(!0,me(Dt,S.nativeEvent,S.currentTarget))}function L(S){T==="auto"&&tn(S.nativeEvent)&&(J.current=!p)}function Z(S){J.current=T,T==="auto"&&Zt(S.nativeEvent)&&(J.current=!0)}return{onKeyDown(S){const V=e.select("open");D.current=!1;const Ce=S.key.startsWith("Arrow"),be=gr(S.key,he(),h),de=Qe(S.key,V?c:v),De=(C?be:de)||S.key==="Enter"||S.key.trim()==="";if(p&&V&&(!C||Kt(S.currentTarget)))return se(S);if(!(!V&&!P&&Ce)){if(De){const ve=Qe(S.key,he());f.current=C&&ve?null:S.key}if(C){be&&(Te(S),V?(x.current=Re(),b(S),p&&B.current?.focus()):m(S));return}de&&(Q.current!=null&&(x.current=Q.current),Te(S),!V&&P?m(S):se(S),V&&b(S))}},onFocus(S){S.target===S.currentTarget&&e.select("open")&&!p&&(x.current=-1,b(S))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:L,onClick:L}},[se,T,Re,C,b,e,P,c,v,he,h,Q,p,B]),we=o.useMemo(()=>({...N,...Ie}),[N,Ie]);return o.useMemo(()=>i?{reference:we,floating:ce,item:xe,trigger:Ie}:{},[i,we,ce,Ie,xe])}function xr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:d,enabled:u=!0,resetMs:C=750,selectedIndex:h=null}=t,p=$(d),T=e.useState("open"),g=$e(),P=o.useRef(""),F=o.useRef(h??s??-1),c=o.useRef(null),v=$(a=>{function R(k){return r?.current[k]}function w(k){const B=R(k);return B&&!Mn(B)||B?.matches(":disabled")?!1:l==null||!On(yt,k,l)}function I(k,B,ie=0){if(k.length===0)return-1;const X=(ie%k.length+k.length)%k.length,J=B.toLowerCase();for(let x=0;x<k.length;x+=1){const f=(X+x)%k.length;if(!(!k[f]?.toLowerCase().startsWith(J)||!w(f)))return f}return-1}const A=n.current;if(P.current.length>0&&a.key===" "&&(Te(a),p?.(!0)),P.current.length>0&&P.current[0]!==" "&&I(A,P.current)===-1&&a.key!==" "&&p?.(!1),A==null||a.key.length!==1||a.ctrlKey||a.metaKey||a.altKey)return;T&&a.key!==" "&&(Te(a),p?.(!0));const O=P.current==="";O&&(F.current=h??s??-1),A.every((k,B)=>k&&w(B)?k[0]?.toLowerCase()!==k[1]?.toLowerCase():!0)&&P.current===a.key&&(P.current="",F.current=c.current),P.current+=a.key,g.start(C,()=>{P.current="",F.current=c.current,p?.(!1)});const G=((O?h??s??-1:F.current)??0)+1,y=I(A,P.current,G);y!==-1?(i?.(y,a),c.current=y):a.key!==" "&&(P.current="",p?.(!1))}),U=$(a=>{const R=a.relatedTarget,w=e.select("domReferenceElement"),I=e.select("floatingElement");ye(w,R)||ye(I,R)||(g.clear(),P.current="",F.current=c.current,p?.(!1))});K(()=>{!T&&h!==null||(g.clear(),c.current=null,P.current!==""&&(P.current="",p?.(!1)))},[T,h,g,p]);const E=o.useMemo(()=>({onKeyDown:v,onBlur:U}),[v,U]);return o.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function Sr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function nn(e,t){const n=o.useRef(e),r=$(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Rr(e,t){const n=$((i,l)=>{(typeof e=="function"?e():e)||t(l||(Pn?"touch":""))}),{onClick:r,onPointerDown:s}=Sr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function br(e){const[t,n]=o.useState(null),r=Rr(e,n);return nn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const yr=20;function Ir(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Be(n).documentElement.clientWidth,d=n.offsetWidth;i(l>0&&d>0&&d>=l-yr)},[e,t,n]),$n(e&&(!t||s),r)}const Cr=o.createContext(void 0);function Tr(e){return o.useContext(Cr)}function Er(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function wr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function vr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Nt({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(()=>t),d=s&&e!==void 0?e:i,u=o.useCallback(C=>{s||l(C)},[]);return[d,u]}const rn=o.createContext(void 0),on=o.createContext(void 0);function Ve(){const e=o.useContext(rn);if(e===void 0)throw new Error(Ge(60));return e}function sn(){const e=o.useContext(on);if(e===void 0)throw new Error(Ge(61));return e}const Mr="data-valid",Or="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ar={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fr={disabled:!1,...Ar},Lr={valid(e){return e===null?null:e?{[Mr]:""}:{[Or]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:re,disabled:void 0,setTouched:re,setDirty:re,setFilled:re,setFocused:re,focusOwnerRef:{current:void 0},validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Fr,registerFieldControl:re,validation:{getValidationProps:(e,t=Ue)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:re,getInputControl:()=>null,commit:async()=>{},change:re}},Dr=o.createContext(Vr);function ft(e=!0){const t=o.useContext(Dr);if(t.setValidityData===re&&!e)throw new Error(Ge(28));return t}function kr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=ft(),d=_e(()=>Symbol());K(()=>{const u=d.current;if(!s){l(u,void 0);return}l(u,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,d,n]),K(()=>{const u=d.current;return()=>{l(u,void 0)}},[l,d])}const Hr=o.createContext({controlId:void 0,registerControlId:re,resetControlId:re,labelId:void 0,setLabelId:re,messageIds:[],setMessageIds:re,getDescriptionProps:e=>e});function ln(){return o.useContext(Hr)}function cn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=ln(),l=Gn(),d=_e(()=>Symbol()),u=o.useRef(!1),C=o.useRef(!1),h=$(()=>{!u.current||s===re||(u.current=!1,s(d.current,void 0))});return K(()=>{if(!n||s===re){h();return}let p;if(t!==void 0)C.current=!0,p=t;else if(C.current)p=l;else{i();return}if(p===void 0){h();return}u.current=!0,s(d.current,p)},[t,n,s,i,l,d,h]),K(()=>h,[h]),(n?r:void 0)??t??l}function Nr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const un=(e,t)=>Object.is(e,t);function Le(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ur(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Le(r,s,n)):e!==t}function Ct(e,t,n){return e?e.some(r=>r===void 0?!1:Le(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Le(r,t,n)):-1}function _r(e,t){if(t!==un)return r=>Ct(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function an(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Br(e,t,n,r,s,i){return Ct(r,t,s)?i!=null&&e>i&&Ct(r,n[i],s)?i:e:e===i?an(n,r,s,!0):i}function Wr(e,t,n){return e.filter(r=>!Le(t,r,n))}function Tt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function fn(e){return jr(e?.[0])}function qr(e){return fn(e)?e.flatMap(t=>t.items):e}function Kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(fn(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function dn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Tt(e)}function Ne(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Tt(e.value):Tt(e)}function pn(e,t,n){function r(){return dn(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){const i=qr(t);if(e==null||typeof e!="object"){const l=i.find(d=>d.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(d=>d&&d.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function Yr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ge.jsx(o.Fragment,{children:pn(s,t,n)},i)),r),[])}const zr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ne(t,r)!==""},hasNullItemLabel:(e,t)=>t?Kr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Le(t,s,n)):Le(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},$r=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:re,validationMode:"onSubmit",submitCountRef:{current:0}});function Gr(){return o.useContext($r)}const Ee=1;function gn(e,t){return Math.max(0,e-t)}function Xr(e,t){if(t<=0)return 0;const n=Ye(e,0,t),r=n,s=t-n,i=r<=Ee,l=s<=Ee;return i&&l?r<=s?0:t:i?0:l?t:n}function wo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:d,name:u,form:C,autoComplete:h,disabled:p=!1,readOnly:T=!1,required:g=!1,modal:P=!0,actionsRef:F,inputRef:c,onOpenChangeComplete:v,items:U,multiple:E=!1,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w=un,highlightItemOnHover:I=!0,children:A}=e,{clearErrors:O}=Gr(),{setDirty:H,setTouched:Y,setFocused:G,validityData:y,setFilled:k,name:B,disabled:ie,validation:X,validationMode:J}=ft(),x=cn({id:t}),f=ie||p,D=B??u,[b,M]=Nt({controlled:n,default:E?r??yt:r,name:"Select",state:"value"}),[W,q]=Nt({controlled:i,default:l,name:"Select",state:"open"}),te=o.useRef([]),ee=o.useRef([]),fe=o.useRef(null),ue=o.useRef(null),Q=o.useRef(0),ae=o.useRef(null),j=o.useRef([]),z=o.useRef(!1),oe=o.useRef(null),ne=o.useRef(null),Se=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=o.useRef(!1),Re=o.useRef(b),{openMethod:se,triggerProps:xe}=br(W),N=_e(()=>new Vn({id:x,labelId:void 0,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,value:b,open:W,mounted:W,transitionStatus:void 0,items:U,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ue,triggerProps:Ue,itemRoot:{props:Ue,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:re,setOpen:re,handleScrollArrowVisibility:re,onOpenChangeComplete:re,listRef:te,popupRef:fe,scrollHandlerRef:ue,scrollArrowsMountedCountRef:Q,valueRef:ae,valuesRef:j,labelsRef:ee,typingRef:z,selectionRef:Se,firstItemTextRef:oe,selectedItemTextRef:ne,alignItemWithTriggerActiveRef:he,initialValueRef:Re},zr)).current,[ce,Ie]=o.useState(!1),{mounted:we,transitionStatus:m,forceUnmount:L}=Xn({open:W,ref:fe,preventUnmountOnClose:ce,setPreventUnmountOnClose:Ie,onUnmount(){N.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)}}),Z=N.useState("activeIndex"),S=N.useState("selectedIndex"),V=N.useState("triggerElement"),Ce=N.useState("positionerElement"),be=Er(se),de=se??be,De=o.useMemo(()=>E?"":Ne(b,R),[E,b,R]),ve=o.useMemo(()=>E&&Array.isArray(b)?b.map(_=>Ne(_,R)):Ne(b,R),[E,b,R]),dt=Fe(V),Xe=$(()=>ve);kr(dt,x,b,Xe,!f,u);const ke=E?Array.isArray(b)&&b.length>0:b!=null&&De!=="";K(()=>{k(ke)},[ke,k]),K(function(){const le=an(j.current,b,w,E);le===null&&(ne.current=null),!W&&N.set("selectedIndex",le)},[E,W,b,w,N]),nn(b,()=>{O(D),H(Ur(b,y.initialValue,w)),X.change(b)});const He=$((_,le)=>{const Ae=le,qe=Zn(Ae);d?.(_,Ae),!le.isCanceled&&(_||Ie(qe()),q(_),!_&&(le.reason===zt||le.reason===Dn)&&(Y(!0),G(!1),J==="onBlur"&&X.commit(b)))});o.useImperativeHandle(F,()=>({unmount:L,close:()=>{N.state.open&&He(!1,me(kn))}}),[L,He,N]);const je=$((_,le)=>{s?.(_,le),!le.isCanceled&&M(_)}),pt=$(_=>{const le=gn(_.scrollHeight,_.clientHeight),Ae=Xr(_.scrollTop,le),qe=Ae>0,Ke=Ae<le;N.set("scrollUpArrowVisible",qe),N.set("scrollDownArrowVisible",Ke)}),pe=pr({open:W,onOpenChange:He,elements:{reference:V,floating:Ce}}),Me=dr(pe,{enabled:!f,event:"mousedown"}),Oe=Jn(pe),Pe=hr(pe,{enabled:!f,listRef:te,activeIndex:Z,selectedIndex:S,disabledIndices:yt,onNavigate(_){_===null&&!W||N.set("activeIndex",_)},focusItemOnHover:I}),Je=xr(pe,{enabled:!f&&(W||!T&&!E),listRef:ee,activeIndex:Z,selectedIndex:S,disabledIndices:_=>vr(te.current[_]),onMatch(_){W?N.set("activeIndex",_):je(j.current[_],me(it))},onTyping(_){z.current=_}}),wt=o.useMemo(()=>It(Je.reference,Pe.reference,Oe.reference,Me.reference,xe),[Me.reference,Je.reference,Pe.reference,Oe.reference,xe]),vt=o.useMemo(()=>It(Qn,Je.floating,Pe.floating,Oe.floating),[Je.floating,Pe.floating,Oe.floating]),Mt=Pe.item??Ue,Ot=o.useMemo(()=>({props:Mt,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w}),[Mt,E,f,T,w]);N.useContextCallback("setValue",je),N.useContextCallback("setOpen",He),N.useContextCallback("handleScrollArrowVisibility",pt),N.useContextCallback("onOpenChangeComplete",v),wr(()=>{N.update({popupProps:vt,triggerProps:wt,itemRoot:Ot})}),N.useSyncedValues({id:x,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,value:b,open:W,mounted:we,transitionStatus:m,popupProps:vt,triggerProps:wt,itemRoot:Ot,items:U,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,openMethod:de});const bn=An(c,X.inputRef),Pt=E?void 0:D,yn=o.useMemo(()=>!E||!Array.isArray(b)||!D?null:b.map(_=>{const le=Ne(_,R);return ge.jsx("input",{type:"hidden",form:C,name:D,value:le,disabled:f},le)}),[E,b,C,D,R,f]);return ge.jsxs(rn.Provider,{value:N,children:[ge.jsx(on.Provider,{value:pe,children:A}),ge.jsx("input",{...X.getValidationProps(f,{onFocus(){N.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||f||T)return;const le=_.currentTarget.value,Ae=me(it,_.nativeEvent);function qe(){if(E)return;const Ke=le.toLowerCase();let gt=j.current.findIndex(mt=>Ne(mt,R).toLowerCase()===Ke||dn(mt,a).toLowerCase()===Ke);gt===-1&&(gt=j.current.findIndex((mt,In)=>{const Ft=ee.current[In];return Ft!=null&&Ft.toLowerCase()===Ke}));const At=j.current[gt];At!=null&&je(At,Ae)}N.set("forceMount",!0),queueMicrotask(qe)}}),id:x&&Pt==null?`${x}-hidden-input`:void 0,form:C,name:Pt,autoComplete:h,value:De,disabled:f,required:g&&!(E&&ke),readOnly:T,ref:bn,style:D?Fn:Ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yn]})}function Jr(e,t){return e??t}function Qr(e,t,n){const{setFocused:r,focusOwnerRef:s}=ft(),i=$(l=>{(l?!e:s.current===i)&&(s.current=l&&i,r(l))});return K(()=>{const l=t.current;return l?.getRootNode()?.activeElement===l&&i(!0),()=>i(!1)},[e,t,i]),i}const Ze=5;function Zr(e,t){const n=eo(t);return e.clientX>=n.left-Ze&&e.clientX<=n.right+Ze&&e.clientY>=n.top-Ze&&e.clientY<=n.bottom+Ze}function eo(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,d=parseFloat(r.height)||0,u=parseFloat(s.width)||0,C=parseFloat(s.height)||0,h=Math.max(t.width,l,u),p=Math.max(t.height,d,C),T=h-t.width,g=p-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-g/2,bottom:t.bottom+g/2}}const to="data-popup-side",no=400,ro={...er,...Lr,popupSide:e=>e?{[to]:e}:null,value:()=>null},vo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:d=!0,style:u,...C}=t,{setTouched:h,validationMode:p,validation:T,state:g,disabled:P}=ft(),{labelId:F}=ln(),c=Ve(),v=c.useState("readOnly"),U=c.useState("required"),E=c.useState("disabled"),a=P||E||l,R=c.useState("open"),w=c.useState("mounted"),I=c.useState("value"),A=c.useState("triggerProps"),O=c.useState("positionerElement"),H=c.useState("listElement"),Y=c.useState("popupSide"),G=c.useState("id"),y=c.useState("labelId"),k=c.useState("hasSelectedValue"),B=w&&O?Y:null,ie=i??G,X=Jr(F,y);cn({id:i});const J=Fe(O),x=o.useRef(null),f=Qr(a,x),{getButtonProps:D,buttonRef:b}=Xt({disabled:a,native:d}),M=c.useStateSetter("triggerElement"),W=$e(),q=$e(),te=$e();o.useEffect(()=>{if(R)return te.start(no,()=>{c.context.selectionRef.current.allowUnselectedMouseUp=!0,c.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};c.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[R,c,q,te]);const ee=It(A,{id:ie,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?H?.id??Yt(O)?.id:void 0,"aria-labelledby":X,"aria-readonly":v||void 0,"aria-required":U||void 0,tabIndex:a?-1:0,onFocus(Q){f(!0),R&&c.context.alignItemWithTriggerActiveRef.current&&c.context.setOpen(!1,me(it,Q.nativeEvent)),W.start(0,()=>{c.set("forceMount",!0)})},onBlur(Q){ye(O,Q.relatedTarget)||(h(!0),f(!1),p==="onBlur"&&T.commit(I))},onMouseDown(Q){if(R)return;const ae=Be(Q.currentTarget);function j(z){if(!x.current)return;const oe=z.target;ye(x.current,oe)||ye(J.current,oe)||Zr(z,x.current)||c.context.setOpen(!1,me(Nn,z))}q.start(0,()=>{ae.addEventListener("mouseup",j,{once:!0})})}},C,D),fe=T.getValidationProps(a,ee);fe.role="combobox";const ue={...g,open:R,disabled:a,value:I,readOnly:v,popupSide:B,placeholder:!k};return We("button",t,{ref:[n,x,b,M],state:ue,stateAttributesMapping:ro,props:fe})}),oo={value:()=>null},Mo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:d,...u}=t,C=Ve(),h=C.useState("value"),p=C.useState("items"),T=C.useState("itemToStringLabel"),g=C.useState("hasSelectedValue"),P=!g&&l!=null&&i==null,F=C.useState("hasNullItemLabel",P),c={value:h,placeholder:!g};let v=null;return typeof i=="function"?v=i(h):i!=null?v=i:P&&!F?v=l:Array.isArray(h)?v=Yr(h,p,T):v=pn(h,p,T),We("span",t,{state:c,ref:[n,C.context.valueRef],props:[{children:v},u],stateAttributesMapping:oo})}),Oo=o.forwardRef(function(t,n){const r=Ve(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ge.jsx(Un,{ref:n,...t}):null}),mn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return o.useContext(mn)}function io(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=$(s),[,l]=o.useState(0),d=_e(co).current,u=_e(lo).current,C=o.useRef(0),h=o.useRef(!0),p=o.useRef(null),T=o.useRef(null),g=$(()=>{h.current||(h.current=!0,l(R=>R+1))}),P=$((R,w)=>{u.set(R,w),g()}),F=$(R=>{u.delete(R),g()}),c=$(R=>{const w=new Map;return n.current.length=0,r&&(r.current.length=0),R.forEach(I=>{w.set(I.element,{...I.registration.metadata??{},index:I.index}),n.current[I.index]=I.element,r&&(r.current[I.index]=I.registration.label!==void 0?I.registration.label:I.registration.textRef?.current?.textContent??I.element.textContent)}),C.current=n.current.length,w});function v(R){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||R.length<2)return;const w=new MutationObserver(A=>{if(!fo(A))return;let O=null;for(const H of R)if(H.isConnected){if(O&&hn(O,H)>0){w.disconnect(),g();return}O=H}});T.current=w;const I=new Set;for(let A=1;A<R.length;A+=1){const O=ao(R[A-1],R[A]);O&&I.add(O)}I.forEach(A=>w.observe(A,{childList:!0}))}const U=$(()=>{const[R,w]=uo(u),I=c(R),A=p.current,O=!A||A.length!==R.length||R.some((H,Y)=>{const G=A[Y];return H.index!==G.index||H.element!==G.element||H.registration.index!==G.registration.index||H.registration.metadata!==G.registration.metadata});v(w),p.current=R,h.current=!1,O&&(d.forEach(H=>H(I)),i(I))});K(()=>(!h.current&&p.current&&c(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,c]),K(()=>{h.current&&U()}),K(()=>()=>{T.current?.disconnect(),h.current=!0},[]);const E=$(R=>(d.add(R),()=>{d.delete(R)})),a=o.useMemo(()=>({register:P,unregister:F,subscribeMapChange:E,nextIndexRef:C}),[P,F,E,C]);return ge.jsx(mn.Provider,{value:a,children:t})}function lo(){return new Map}function co(){return new Set}function uo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const d=i.index,u={index:d??-1,element:l,registration:i};d===null?r.push(u):d>=0&&(t.add(d),n.push(u))});let s=0;return r.sort((i,l)=>hn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function ao(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function fo(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function hn(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const xn=o.createContext(void 0);function po(){const e=o.useContext(xn);if(!e)throw new Error(Ge(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const go={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},mo={position:"fixed"},Po=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:d,align:u,sideOffset:C,alignOffset:h,collisionBoundary:p="clipping-ancestors",collisionPadding:T,arrowPadding:g,sticky:P,disableAnchorTracking:F,alignItemWithTrigger:c=!0,collisionAvoidance:v=_n,style:U,...E}=t,a=Ve(),R=sn(),w=a.useState("open"),I=a.useState("mounted"),A=a.useState("modal"),O=a.useState("value"),H=a.useState("openMethod"),Y=a.useState("positionerElement"),G=a.useState("triggerElement"),y=a.useState("isItemEqualToValue"),k=a.useState("transitionStatus"),B=o.useRef(null),ie=o.useRef(null),[X,J]=o.useState(c),x=I&&X&&H!=="touch";!I&&X!==c&&J(c),o.useImperativeHandle(a.context.alignItemWithTriggerActiveRef,()=>x),Ir((x||A)&&w,H==="touch",Y,G);const f=ir({anchor:r,floatingRootContext:R,positionMethod:l,mounted:I,side:d,sideOffset:C,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:T,sticky:P,disableAnchorTracking:F??x,collisionAvoidance:v,keepMounted:!0}),D=x?"none":f.side,b=x?mo:f.positionerStyles,M={open:w,side:D,align:f.align,anchorHidden:f.anchorHidden};K(()=>{a.set("popupSide",f.side)},[a,f.side]);const W=a.useStateSetter("positionerElement"),q=lr(t,M,{styles:b,transitionStatus:k,props:E,refs:[n,W],hidden:!I,inert:!w}),te=o.useRef(0),ee=$(ue=>{if(a.context.valuesRef.current.length===0)return;const Q=te.current;te.current=ue.size;const ae=me(it);if(Q!==0&&!a.state.multiple&&O!==null&&ot(a.context.valuesRef.current,O,y)===-1){const z=a.context.initialValueRef.current,ne=z!=null&&ot(a.context.valuesRef.current,z,y)!==-1?z:null;a.context.setValue(ne,ae),ne===null&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null)}if(Q!==0&&a.state.multiple&&Array.isArray(O)){const j=O.filter(z=>ot(a.context.valuesRef.current,z,y)!==-1);j.length!==O.length&&(a.context.setValue(j,ae),j.length===0&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null))}if(w&&x){a.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};lt(Y,j),lt(a.context.popupRef.current,j)}}),fe=o.useMemo(()=>({...f,side:D,alignItemWithTriggerActive:x,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:ie}),[f,D,x,J]);return ge.jsx(io,{elementsRef:a.context.listRef,labelsRef:a.context.labelsRef,onMapChange:ee,children:ge.jsxs(xn.Provider,{value:fe,children:[I&&A&&ge.jsx(tr,{inert:Bn(!w),cutout:G}),q]})})}),et="base-ui-disable-scrollbar",Ut={className:et,getElement(e){return ge.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},ho=o.createContext(void 0),xo={disableStyleElements:!1};function So(){return o.useContext(ho)??xo}const _t="--transform-origin",Ro={...rr,...Qt},Ao=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...d}=t,u=Ve(),C=u.useState("multiple"),h=u.useState("readOnly"),p=u.useState("highlightItemOnHover"),T=sn(),{side:g,align:P,alignItemWithTriggerActive:F,isPositioned:c,setControlledAlignItemWithTrigger:v}=po(),U=Tr()!=null,E=cr(),{nonce:a,disableStyleElements:R}=So(),w=u.useState("id"),I=u.useState("open"),A=u.useState("openMethod"),O=u.useState("mounted"),H=u.useState("popupProps"),Y=u.useState("transitionStatus"),G=u.useState("triggerElement"),y=u.useState("positionerElement"),k=u.useState("listElement"),B=o.useRef(!1),ie=o.useRef(!1),X=o.useRef({}),J=st(),x=$(M=>{if(!y||!u.context.popupRef.current||!ie.current)return;const W=y.style.top==="0px",q=y.style.bottom==="0px";if(B.current||!F||!W&&!q){u.context.handleScrollArrowVisibility(M);return}const te=Wt(y),ee=ze(y.getBoundingClientRect().height,"y",te),fe=Be(y),ue=rt(y),Q=ue.getComputedStyle(y),ae=parseFloat(Q.marginTop),j=parseFloat(Q.marginBottom),z=Bt(ue.getComputedStyle(u.context.popupRef.current)),oe=Math.min(fe.documentElement.clientHeight-ae-j,z),ne=M.scrollTop,Se=tt(M);let he=null;const Re=ce=>{y.style.height=`${ce}px`},se=W?Se-ne:ne,xe=Math.min(ee+se,oe);if(se<=Ee){const ce=Ye(se,0,oe-ee);ce>0&&Re(ee+ce),M.scrollTop=W?Se:0,oe-(ee+ce)<=Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M);return}if(oe-xe>Ee)he=W?1/0:0;else if(q&&ne<Se){const ce=ee+se-oe;he=ne-(se-ce)}const N=Math.ceil(xe);if(N!==0&&Re(N),he!=null){const ce=Ye(he,0,tt(M));Math.abs(M.scrollTop-ce)>Ee&&(M.scrollTop=ce)}N>=oe-Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M)});o.useImperativeHandle(u.context.scrollHandlerRef,()=>x,[x]),Jt({open:I,ref:u.context.popupRef,onComplete(){I&&u.context.onOpenChangeComplete(!0)}});const f={open:I,transitionStatus:Y,side:g,align:P};K(()=>{!y||!u.context.popupRef.current||Object.keys(X.current).length||(X.current={top:y.style.top||"0",left:y.style.left||"0",right:y.style.right,height:y.style.height,bottom:y.style.bottom,minHeight:y.style.minHeight,maxHeight:y.style.maxHeight,marginTop:y.style.marginTop,marginBottom:y.style.marginBottom})},[u,y]),K(()=>{I||F||(ie.current=!1,B.current=!1,lt(y,X.current))},[I,F,y]),K(()=>{const M=u.context.popupRef.current;if(!I||!G||!y||!M||F&&!c||u.state.transitionStatus==="ending")return;if(ie.current=!0,M.style.removeProperty(_t),!F){J.request(()=>u.context.handleScrollArrowVisibility(k||M));return}const W=bo(M);try{let q=u.context.selectedItemTextRef.current;q?.isConnected||(q=!u.select("hasSelectedValue")&&u.context.firstItemTextRef.current?.isConnected?u.context.firstItemTextRef.current:null);const te=u.context.valueRef.current,ee=rt(y),fe=ee.getComputedStyle(y),ue=ee.getComputedStyle(M),Q=Be(G),ae=Wt(G),j=nt(G.getBoundingClientRect(),ae),z=nt(y.getBoundingClientRect(),ae),oe=j.height,ne=k||M,Se=ne.scrollHeight,he=parseFloat(ue.borderBottomWidth),Re=parseFloat(fe.marginTop)||10,se=parseFloat(fe.marginBottom)||10,xe=parseFloat(fe.minHeight)||100,N=Bt(ue),ce=5,Ie=5,we=20,m=Q.documentElement.clientHeight-Re-se,L=Q.documentElement.clientWidth,Z=m-j.bottom+oe;let S,V=E==="rtl"?j.right-z.width:j.left,Ce=0;if(q&&te){const pe=nt(te.getBoundingClientRect(),ae);S=nt(q.getBoundingClientRect(),ae),V=z.left+(E==="rtl"?pe.right-S.right:pe.left-S.left);const Me=pe.top-j.top+pe.height/2;Ce=S.top-z.top+S.height/2-Me}const be=Z+Ce+se+he;let de=Math.min(m,be);const De=m-Re-se,ve=be-de,dt=L-Ie;y.style.left=`${Ye(V,ce,dt-z.width)}px`,y.style.height=`${de}px`,y.style.maxHeight="none",y.style.marginTop=`${Re}px`,y.style.marginBottom=`${se}px`,M.style.height="100%";const Xe=tt(ne),ke=ve>=Xe-Ee;ke&&(de=Math.min(m,z.height)-(ve-Xe));const He=j.top<we||j.bottom>m-we||Math.ceil(de)+Ee<Math.min(Se,xe),je=(ee.visualViewport?.scale??1)!==1&&$t;if(He||je){lt(y,X.current),v(!1);return}const pt=Math.max(xe,de);if(ke){const pe=Math.max(0,m-be);y.style.top=z.height>=De?"0":`${pe}px`,y.style.height=`${de}px`,ne.scrollTop=tt(ne)}else y.style.bottom="0",ne.scrollTop=ve;if(S){const pe=z.top,Me=z.height,Oe=S.top+S.height/2,Pe=Ye(Me>0?(Oe-pe)/Me*100:50,0,100);M.style.setProperty(_t,`50% ${Pe}%`)}(pt===m||de>=N)&&(B.current=!0),u.context.handleScrollArrowVisibility(ne),p&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{W()}},[u,I,y,G,F,v,J,k,p,E,c]),o.useEffect(()=>{if(!F||!y||!I)return;const M=rt(y);function W(q){u.context.setOpen(!1,me(jn,q))}return Wn(M,"resize",W)},[u,F,y,I]);const D={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":h||void 0,id:`${w}-list`},onKeyDown(M){U&&or.has(M.key)&&M.stopPropagation()},onScroll(M){k||x(M.currentTarget)},...F&&{style:k?{height:"100%"}:go},className:!k&&F?Ut.className:void 0},b=We("div",t,{ref:[n,u.context.popupRef],state:f,stateAttributesMapping:Ro,props:[H,D,fr(Y),d]});return ge.jsxs(o.Fragment,{children:[!R&&Ut.getElement(a),ge.jsx(nr,{context:T,modal:!1,disabled:!O,openInteractionType:A,returnFocus:l,restoreFocus:!0,children:b})]})});function Bt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return gn(e.scrollHeight,e.clientHeight)}function Wt(e){return ur.getScale(e)}function ze(e,t,n){return e/n[t]}function nt(e,t){return ar({x:ze(e.x,"x",t),y:ze(e.y,"y",t),width:ze(e.width,"x",t),height:ze(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function bo(e){const{style:t}=e,n={};for(const[r,s]of jt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of jt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function yo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:d,subscribeMapChange:u,nextIndexRef:C}=so(),h=o.useRef(-1),[p,T]=o.useState(i==null&&t?()=>{if(h.current===-1){const c=C.current;C.current+=1,h.current=c}return h.current}:-1),g=i??p,P=o.useRef(null),F=o.useCallback(c=>{const v=P.current;v&&d(v),P.current=c,c&&l(c,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,d,r,n,s]);return K(()=>{if(i==null)return u(c=>{const v=P.current?c.get(P.current)?.index:null;v!=null&&T(v)})},[i,u]),{ref:F,index:g}}const Sn=o.createContext(void 0);function Rn(){const e=o.useContext(Sn);if(!e)throw new Error(Ge(57));return e}const Fo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:d,disabled:u=!1,nativeButton:C=!1,...h}=t,p=o.useRef(null),T=yo({guess:!0,label:d,textRef:p}),g=Ve(),{props:P,multiple:F,disabled:c,readOnly:v,isItemEqualToValue:U}=g.useState("itemRoot"),E=c||u,a=g.useState("isActive",T.index),R=g.useState("open"),w=g.useState("isSelected",l),I=g.useState("isSelectedByFocus",T.index),A=T.index,O=o.useRef(null);K(()=>{const f=g.context.valuesRef.current;return f[A]=l,()=>{delete f[A]}},[A,l,g]),K(()=>{const f=g.state.value,D=g.state.selectedIndex;let b=D,M;F&&Array.isArray(f)?(b=Br(A,l,g.context.valuesRef.current,f,U,D),M=b===A,A===D&&!M&&(g.context.selectedItemTextRef.current=null)):(M=f!==void 0&&Le(l,f,U),M&&(b=A)),g.set("selectedIndex",b),M&&p.current&&(g.context.selectedItemTextRef.current=p.current)},[A,F,U,g,l]);const H=o.useRef("mouse"),Y=o.useRef(!1),{getButtonProps:G,buttonRef:y}=Xt({disabled:E,focusableWhenDisabled:!0,native:C,composite:!0}),k={disabled:E,selected:w,highlighted:a};function B(f){if(c||v)return;const D=g.state.value;if(F){const b=Array.isArray(D)?D:[],M=w?Wr(b,l,U):[...b,l];g.context.setValue(M,me(St,f))}else g.context.setValue(l,me(St,f)),g.context.setOpen(!1,me(St,f))}function ie(){g.context.selectionRef.current.dragY=0}const X={role:"option","aria-selected":w,tabIndex:R&&a?0:-1,onKeyDown(f){g.set("activeIndex",A),f.key===" "&&g.context.typingRef.current&&f.preventDefault()},onClick(f){const D=H.current!=="touch",b=f.nativeEvent.pointerType,M=D&&tn(f.nativeEvent)&&(b!==void 0||a),W=D&&!M&&!Y.current;Y.current=!1,!(E||W)&&B(f.nativeEvent)},onPointerEnter(f){H.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const D=g.context.selectionRef.current;D.dragY+=f.movementY,D.dragY**2>=64&&(D.allowUnselectedMouseUp=!0)}},onPointerDown(f){H.current=f.pointerType,Y.current=!0,ie()},onMouseUp(){if(ie(),E||H.current==="touch"||Y.current)return;const f=!g.context.selectionRef.current.allowSelectedMouseUp&&w,D=!g.context.selectionRef.current.allowUnselectedMouseUp&&!w;f||D||(Y.current=!0,O.current?.click(),Y.current=!1)}},J=We("div",t,{ref:[y,n,T.ref,O],state:k,props:[P,X,h,G]}),x=o.useMemo(()=>({selected:w,index:A,textRef:p,selectedByFocus:I}),[w,A,p,I]);return ge.jsx(Sn.Provider,{value:x,children:J})})),Io=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,keepMounted:l,selected:d,...u}=t,C=o.useRef(null),{transitionStatus:h,setMounted:p}=sr(d),g=We("span",t,{ref:[n,C],state:{selected:d,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Qt});return Jt({batch:!0,enabled:!d,open:d,ref:C,onComplete(){d||p(!1)}}),g})),Lo=o.forwardRef(function(t,n){const{selected:r}=Rn();return t.keepMounted||r?ge.jsx(Io,{...t,selected:r,ref:n}):null}),Vo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Rn(),l=Ve(),{render:d,className:u,style:C,...h}=t,p=o.useCallback(g=>{g&&(r===0&&(l.context.firstItemTextRef.current=g),i&&(l.context.selectedItemTextRef.current=g))},[l,r,i]);return We("div",t,{ref:[p,n,s],props:h})}));export{go as L,wo as S,po as a,vo as b,Mo as c,Oo as d,Po as e,Ao as f,Fo as g,Lo as h,Vo as i,dr as j,Rr as k,Ir as l,Tr as m,Lr as n,Gr as o,ft as p,ln as q,cn as r,Ut as s,Qr as t,Ve as u,Nt as v,kr as w,nn as x};
|
|
1
|
+
import{bG as Cn,r as o,cv as st,a$ as $e,b8 as qt,c0 as Kt,J as Ue,N as me,cs as Tn,aY as _e,b1 as K,b2 as En,cw as Yt,ct as wn,b0 as $,di as Lt,dj as ht,dk as Vt,b_ as xt,b3 as Be,bb as ye,dl as Dt,bo as kt,dm as vn,bJ as zt,bY as $t,dn as ct,dp as ut,dq as Gt,dr as Et,cE as Mn,ds as On,dt as yt,cK as Pn,bE as Ge,aW as re,j as ge,c2 as It,c7 as An,c9 as Fn,ca as Ln,bW as it,bF as Vn,cy as Dn,bL as kn,bq as rt,cq as Hn,M as Xt,K as We,du as Nn,bR as Un,dv as _n,bU as Bn,bV as Jt,b6 as Wn,dw as jn,c6 as Qt,dx as St}from"./__vite-browser-external--HDUIUZr.js";import{i as Rt,E as Zt,b as en,F as qn,P as Kn,c as Fe,a as Yn,G as zn,H as Te,J as tn,B as $n,u as Gn,K as Xn,n as Jn,y as Qn,d as Zn,r as er,I as tr,x as nr,p as rr,C as or,D as sr}from"./composite-BfIUPpl8.js";import{u as ir,a as lr,b as cr,p as ur,r as ar,g as fr}from"./usePositioner-CQiZGknc.js";function Ye(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function dr(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:d=0,reason:u=Cn}=t,C=e.context.dataRef,h=o.useRef(void 0),p=st(),T=$e(),g=o.useMemo(()=>{function P(c,v,U,E){const a=me(u,v,U);c&&E==="touch"&&d>0?T.start(d,()=>{e.setOpen(!0,a)}):e.setOpen(c,a)}function F(c,v,U){const E=C.current.openEvent,a=e.select("domReferenceElement")!==v;return c&&a||!c||!s?!0:E&&(typeof l=="function"?l():l)?!U(E.type):!1}return{onPointerDown(c){h.current=Rt(c.pointerType,!0)&&Zt(c.nativeEvent)?"virtual":c.pointerType},onMouseDown(c){const v=h.current,U=c.nativeEvent,E=e.select("open");if(c.button!==0||r==="click"||Rt(v,!0)&&i)return;const a=F(E,c.currentTarget,A=>A==="click"||A==="mousedown"),R=qt(U),w=Kt(R);if(w||v==="virtual"){P(a,U,w?R:c.currentTarget,v);return}const I=c.currentTarget;p.request(()=>{P(a,U,I,v)})},onClick(c){if(r==="mousedown-only")return;const v=h.current;if(r==="mousedown"&&v){h.current=void 0;return}if(Rt(v,!0)&&i)return;const U=e.select("open"),E=F(U,c.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");P(E,c.nativeEvent,c.currentTarget,v)},onKeyDown(){h.current=void 0}}},[C,r,i,u,e,l,s,p,T,d]);return o.useMemo(()=>n?{reference:g}:Ue,[n,g])}function pr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Tn(),i=en()!=null,l=_e(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Kn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const d={open:t,floatingId:s};r.reference!==void 0&&(d.referenceElement=r.reference,d.domReferenceElement=En(r.reference)?r.reference:null),r.floating!==void 0&&(d.floatingElement=r.floating),l.update(d)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}function Ht(e){return $t&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Qe(e,t){return at(t,e===Gt||e===Et,e===ct||e===ut)}function bt(e,t,n){return at(t,e===Et,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function gr(e,t,n){return at(t,n?e===ct:e===ut,e===Et)}function mr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Gt;return t==="both"||t==="horizontal"&&r?e==="Escape":at(t,s,i)}function hr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:d=!1,loopFocus:u=!1,nested:C=!1,rtl:h=!1,virtual:p=!1,focusItemOnOpen:T="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:P=!0,disabledIndices:F=void 0,orientation:c="vertical",triggerOrientation:v=c,parentOrientation:U,id:E,resetOnPointerLeave:a=!0,externalTree:R,nestedReturnFocusRef:w,grid:I}=t,A=I!=null,O=e.useState("open"),H=e.useState("floatingElement"),Y=e.useState("domReferenceElement"),G=e.context.dataRef,y=Yt(H),k=wn(Y),B=Fe(y),ie=en(),X=Yn(R),J=o.useRef(T),x=o.useRef(l??-1),f=o.useRef(null),D=o.useRef(!0),b=$(m=>{s(x.current===-1?null:x.current,m)}),M=o.useRef(!!H),W=o.useRef(O),q=o.useRef(!1),te=o.useRef(!1),ee=o.useRef(null),fe=Fe(F),ue=Fe(O),Q=Fe(l),ae=Fe(a),j=st(),z=st(),oe=$(()=>{j.cancel();function m(V){p||(ee.current=zn(V,{sync:q.current,preventScroll:!0}))}const L=n.current[x.current],Z=te.current;L&&m(L),(q.current?V=>V():V=>j.request(V))(()=>{const V=n.current[x.current]||L;if(!V)return;L||m(V),xe&&(Z||!D.current)&&V.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{G.current.orientation=c},[G,c]),K(()=>{O||(f.current=null),(!O||T!=="auto")&&(J.current=T)},[O,T]),K(()=>{i&&(O&&H?(x.current=l??-1,J.current&&l!=null&&(te.current=!0,b())):M.current&&(x.current=-1,b()))},[i,O,H,l,b]),K(()=>{if(i){if(!O){q.current=!1;return}if(H)if(r==null){if(q.current=!1,Q.current!=null)return;if(M.current&&(x.current=-1,oe()),(!W.current||!M.current)&&J.current&&(f.current!=null||J.current===!0&&f.current==null)){let m=0;const L=()=>{n.current[0]==null?(m<2&&(m?S=>z.request(S):queueMicrotask)(L),m+=1):(x.current=f.current==null||bt(f.current,v,h)||C?ht(n):Vt(n),f.current=null,b())};L()}}else Lt(n.current,r)||(x.current=r,oe(),te.current=!1)}},[i,O,H,r,Q,C,n,v,h,b,oe,z]),K(()=>{if(!i||H||!X||p||!M.current)return;const m=X.nodesRef.current,L=m.find(V=>V.id===ie)?.context?.elements.floating,Z=xt(Be(Y??L??null)),S=m.some(V=>V.context&&ye(V.context.elements.floating,Z));L&&!S&&D.current&&L.focus({preventScroll:!0})},[i,H,Y,X,ie,p]),K(()=>{W.current=O,M.current=!!H});const ne=r!=null,Se=$(m=>{if(!ue.current)return;const L=n.current.indexOf(m.currentTarget);L!==-1&&(x.current!==L||r!==L)&&(x.current=L,b(m))}),he=$(()=>U??X?.nodesRef.current.find(m=>m.id===ie)?.context?.dataRef?.current.orientation),Re=$(()=>ht(n,fe.current)),se=$(m=>{if(D.current=!1,q.current=!0,m.which===229||!ue.current&&m.currentTarget===B.current)return;if(C&&mr(m.key,c,h,A)){Qe(m.key,he())||Te(m),e.setOpen(!1,me(Dt,m.nativeEvent));const V=w?.current??Y;kt(V)&&V.focus();return}r!=null&&r!==x.current&&!Lt(n.current,r)&&(x.current=r);const L=x.current,Z=ht(n,F),S=Vt(n,F);if(k||(m.key==="Home"&&(Te(m),x.current=Z,b(m)),m.key==="End"&&(Te(m),x.current=S,b(m))),I!=null){const V=I(m,x.current,n,c,u,h,F,Z,S);if(V!=null&&V!==x.current&&(x.current=V,b(m)),c==="both")return}if(Qe(m.key,c)){Te(m);const V=xt(m.currentTarget.ownerDocument);if(O&&!p&&ye(m.currentTarget,V)&&!n.current.some(de=>de!=null&&ye(de,V))){x.current=bt(m.key,c,h)?Z:S,b(m),r===x.current&&oe();return}const{index:Ce,wrapped:be}=vn(n.current,L,{decrement:!bt(m.key,c,h),loopFocus:u,allowEscape:d,disabledIndices:F,minIndex:Z,maxIndex:S});be&&(q.current=!1),x.current=Ce,b(m)}}),xe=o.useMemo(()=>({onFocus(L){q.current=!0,Se(L)},onClick({currentTarget:L}){p||L.focus({preventScroll:!0})},onMouseMove(L){Ht(L)||(q.current=!0,te.current=!1,g&&Se(L))},onPointerLeave(L){if(!ue.current||!D.current||L.pointerType==="touch")return;q.current=!0;const Z=L.relatedTarget;if(!(!g||n.current.includes(Z))&&ae.current&&(ee.current?.(),ee.current=null,x.current=-1,b(L),!p)){const S=B.current,V=xt(Be(S));S&&ye(S,V)&&S.focus({preventScroll:!0})}}}),[Se,ue,B,g,n,b,ae,p]),N=o.useMemo(()=>p&&O&&ne&&{"aria-activedescendant":`${E}-${r}`},[p,O,ne,E,r]),ce=o.useMemo(()=>({...k?{}:N,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&O&&!p){const L=qt(m.nativeEvent);if(L&&!ye(B.current,L))return;Te(m);const Z=me(zt,m.nativeEvent);e.setOpen(!1,Z);const S=w?.current??Y;!Z.isCanceled&&kt(S)&&S.focus();return}se(m)},onPointerMove(m){Ht(m)||(D.current=!0)}}),[N,se,B,k,e,O,p,Y,w]),Ie=o.useMemo(()=>{function m(S){e.setOpen(!0,me(Dt,S.nativeEvent,S.currentTarget))}function L(S){T==="auto"&&tn(S.nativeEvent)&&(J.current=!p)}function Z(S){J.current=T,T==="auto"&&Zt(S.nativeEvent)&&(J.current=!0)}return{onKeyDown(S){const V=e.select("open");D.current=!1;const Ce=S.key.startsWith("Arrow"),be=gr(S.key,he(),h),de=Qe(S.key,V?c:v),De=(C?be:de)||S.key==="Enter"||S.key.trim()==="";if(p&&V&&(!C||Kt(S.currentTarget)))return se(S);if(!(!V&&!P&&Ce)){if(De){const ve=Qe(S.key,he());f.current=C&&ve?null:S.key}if(C){be&&(Te(S),V?(x.current=Re(),b(S),p&&B.current?.focus()):m(S));return}de&&(Q.current!=null&&(x.current=Q.current),Te(S),!V&&P?m(S):se(S),V&&b(S))}},onFocus(S){S.target===S.currentTarget&&e.select("open")&&!p&&(x.current=-1,b(S))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:L,onClick:L}},[se,T,Re,C,b,e,P,c,v,he,h,Q,p,B]),we=o.useMemo(()=>({...N,...Ie}),[N,Ie]);return o.useMemo(()=>i?{reference:we,floating:ce,item:xe,trigger:Ie}:{},[i,we,ce,Ie,xe])}function xr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:d,enabled:u=!0,resetMs:C=750,selectedIndex:h=null}=t,p=$(d),T=e.useState("open"),g=$e(),P=o.useRef(""),F=o.useRef(h??s??-1),c=o.useRef(null),v=$(a=>{function R(k){return r?.current[k]}function w(k){const B=R(k);return B&&!Mn(B)||B?.matches(":disabled")?!1:l==null||!On(yt,k,l)}function I(k,B,ie=0){if(k.length===0)return-1;const X=(ie%k.length+k.length)%k.length,J=B.toLowerCase();for(let x=0;x<k.length;x+=1){const f=(X+x)%k.length;if(!(!k[f]?.toLowerCase().startsWith(J)||!w(f)))return f}return-1}const A=n.current;if(P.current.length>0&&a.key===" "&&(Te(a),p?.(!0)),P.current.length>0&&P.current[0]!==" "&&I(A,P.current)===-1&&a.key!==" "&&p?.(!1),A==null||a.key.length!==1||a.ctrlKey||a.metaKey||a.altKey)return;T&&a.key!==" "&&(Te(a),p?.(!0));const O=P.current==="";O&&(F.current=h??s??-1),A.every((k,B)=>k&&w(B)?k[0]?.toLowerCase()!==k[1]?.toLowerCase():!0)&&P.current===a.key&&(P.current="",F.current=c.current),P.current+=a.key,g.start(C,()=>{P.current="",F.current=c.current,p?.(!1)});const G=((O?h??s??-1:F.current)??0)+1,y=I(A,P.current,G);y!==-1?(i?.(y,a),c.current=y):a.key!==" "&&(P.current="",p?.(!1))}),U=$(a=>{const R=a.relatedTarget,w=e.select("domReferenceElement"),I=e.select("floatingElement");ye(w,R)||ye(I,R)||(g.clear(),P.current="",F.current=c.current,p?.(!1))});K(()=>{!T&&h!==null||(g.clear(),c.current=null,P.current!==""&&(P.current="",p?.(!1)))},[T,h,g,p]);const E=o.useMemo(()=>({onKeyDown:v,onBlur:U}),[v,U]);return o.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function Sr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function nn(e,t){const n=o.useRef(e),r=$(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Rr(e,t){const n=$((i,l)=>{(typeof e=="function"?e():e)||t(l||(Pn?"touch":""))}),{onClick:r,onPointerDown:s}=Sr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function br(e){const[t,n]=o.useState(null),r=Rr(e,n);return nn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const yr=20;function Ir(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Be(n).documentElement.clientWidth,d=n.offsetWidth;i(l>0&&d>0&&d>=l-yr)},[e,t,n]),$n(e&&(!t||s),r)}const Cr=o.createContext(void 0);function Tr(e){return o.useContext(Cr)}function Er(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function wr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function vr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Nt({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(()=>t),d=s&&e!==void 0?e:i,u=o.useCallback(C=>{s||l(C)},[]);return[d,u]}const rn=o.createContext(void 0),on=o.createContext(void 0);function Ve(){const e=o.useContext(rn);if(e===void 0)throw new Error(Ge(60));return e}function sn(){const e=o.useContext(on);if(e===void 0)throw new Error(Ge(61));return e}const Mr="data-valid",Or="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ar={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fr={disabled:!1,...Ar},Lr={valid(e){return e===null?null:e?{[Mr]:""}:{[Or]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:re,disabled:void 0,setTouched:re,setDirty:re,setFilled:re,setFocused:re,focusOwnerRef:{current:void 0},validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Fr,registerFieldControl:re,validation:{getValidationProps:(e,t=Ue)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:re,getInputControl:()=>null,commit:async()=>{},change:re}},Dr=o.createContext(Vr);function ft(e=!0){const t=o.useContext(Dr);if(t.setValidityData===re&&!e)throw new Error(Ge(28));return t}function kr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=ft(),d=_e(()=>Symbol());K(()=>{const u=d.current;if(!s){l(u,void 0);return}l(u,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,d,n]),K(()=>{const u=d.current;return()=>{l(u,void 0)}},[l,d])}const Hr=o.createContext({controlId:void 0,registerControlId:re,resetControlId:re,labelId:void 0,setLabelId:re,messageIds:[],setMessageIds:re,getDescriptionProps:e=>e});function ln(){return o.useContext(Hr)}function cn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=ln(),l=Gn(),d=_e(()=>Symbol()),u=o.useRef(!1),C=o.useRef(!1),h=$(()=>{!u.current||s===re||(u.current=!1,s(d.current,void 0))});return K(()=>{if(!n||s===re){h();return}let p;if(t!==void 0)C.current=!0,p=t;else if(C.current)p=l;else{i();return}if(p===void 0){h();return}u.current=!0,s(d.current,p)},[t,n,s,i,l,d,h]),K(()=>h,[h]),(n?r:void 0)??t??l}function Nr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const un=(e,t)=>Object.is(e,t);function Le(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ur(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Le(r,s,n)):e!==t}function Ct(e,t,n){return e?e.some(r=>r===void 0?!1:Le(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Le(r,t,n)):-1}function _r(e,t){if(t!==un)return r=>Ct(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function an(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Br(e,t,n,r,s,i){return Ct(r,t,s)?i!=null&&e>i&&Ct(r,n[i],s)?i:e:e===i?an(n,r,s,!0):i}function Wr(e,t,n){return e.filter(r=>!Le(t,r,n))}function Tt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function fn(e){return jr(e?.[0])}function qr(e){return fn(e)?e.flatMap(t=>t.items):e}function Kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(fn(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function dn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Tt(e)}function Ne(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Tt(e.value):Tt(e)}function pn(e,t,n){function r(){return dn(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){const i=qr(t);if(e==null||typeof e!="object"){const l=i.find(d=>d.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(d=>d&&d.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function Yr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ge.jsx(o.Fragment,{children:pn(s,t,n)},i)),r),[])}const zr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ne(t,r)!==""},hasNullItemLabel:(e,t)=>t?Kr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Le(t,s,n)):Le(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},$r=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:re,validationMode:"onSubmit",submitCountRef:{current:0}});function Gr(){return o.useContext($r)}const Ee=1;function gn(e,t){return Math.max(0,e-t)}function Xr(e,t){if(t<=0)return 0;const n=Ye(e,0,t),r=n,s=t-n,i=r<=Ee,l=s<=Ee;return i&&l?r<=s?0:t:i?0:l?t:n}function wo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:d,name:u,form:C,autoComplete:h,disabled:p=!1,readOnly:T=!1,required:g=!1,modal:P=!0,actionsRef:F,inputRef:c,onOpenChangeComplete:v,items:U,multiple:E=!1,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w=un,highlightItemOnHover:I=!0,children:A}=e,{clearErrors:O}=Gr(),{setDirty:H,setTouched:Y,setFocused:G,validityData:y,setFilled:k,name:B,disabled:ie,validation:X,validationMode:J}=ft(),x=cn({id:t}),f=ie||p,D=B??u,[b,M]=Nt({controlled:n,default:E?r??yt:r,name:"Select",state:"value"}),[W,q]=Nt({controlled:i,default:l,name:"Select",state:"open"}),te=o.useRef([]),ee=o.useRef([]),fe=o.useRef(null),ue=o.useRef(null),Q=o.useRef(0),ae=o.useRef(null),j=o.useRef([]),z=o.useRef(!1),oe=o.useRef(null),ne=o.useRef(null),Se=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=o.useRef(!1),Re=o.useRef(b),{openMethod:se,triggerProps:xe}=br(W),N=_e(()=>new Vn({id:x,labelId:void 0,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,value:b,open:W,mounted:W,transitionStatus:void 0,items:U,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ue,triggerProps:Ue,itemRoot:{props:Ue,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:re,setOpen:re,handleScrollArrowVisibility:re,onOpenChangeComplete:re,listRef:te,popupRef:fe,scrollHandlerRef:ue,scrollArrowsMountedCountRef:Q,valueRef:ae,valuesRef:j,labelsRef:ee,typingRef:z,selectionRef:Se,firstItemTextRef:oe,selectedItemTextRef:ne,alignItemWithTriggerActiveRef:he,initialValueRef:Re},zr)).current,[ce,Ie]=o.useState(!1),{mounted:we,transitionStatus:m,forceUnmount:L}=Xn({open:W,ref:fe,preventUnmountOnClose:ce,setPreventUnmountOnClose:Ie,onUnmount(){N.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)}}),Z=N.useState("activeIndex"),S=N.useState("selectedIndex"),V=N.useState("triggerElement"),Ce=N.useState("positionerElement"),be=Er(se),de=se??be,De=o.useMemo(()=>E?"":Ne(b,R),[E,b,R]),ve=o.useMemo(()=>E&&Array.isArray(b)?b.map(_=>Ne(_,R)):Ne(b,R),[E,b,R]),dt=Fe(V),Xe=$(()=>ve);kr(dt,x,b,Xe,!f,u);const ke=E?Array.isArray(b)&&b.length>0:b!=null&&De!=="";K(()=>{k(ke)},[ke,k]),K(function(){const le=an(j.current,b,w,E);le===null&&(ne.current=null),!W&&N.set("selectedIndex",le)},[E,W,b,w,N]),nn(b,()=>{O(D),H(Ur(b,y.initialValue,w)),X.change(b)});const He=$((_,le)=>{const Ae=le,qe=Zn(Ae);d?.(_,Ae),!le.isCanceled&&(_||Ie(qe()),q(_),!_&&(le.reason===zt||le.reason===Dn)&&(Y(!0),G(!1),J==="onBlur"&&X.commit(b)))});o.useImperativeHandle(F,()=>({unmount:L,close:()=>{N.state.open&&He(!1,me(kn))}}),[L,He,N]);const je=$((_,le)=>{s?.(_,le),!le.isCanceled&&M(_)}),pt=$(_=>{const le=gn(_.scrollHeight,_.clientHeight),Ae=Xr(_.scrollTop,le),qe=Ae>0,Ke=Ae<le;N.set("scrollUpArrowVisible",qe),N.set("scrollDownArrowVisible",Ke)}),pe=pr({open:W,onOpenChange:He,elements:{reference:V,floating:Ce}}),Me=dr(pe,{enabled:!f,event:"mousedown"}),Oe=Jn(pe),Pe=hr(pe,{enabled:!f,listRef:te,activeIndex:Z,selectedIndex:S,disabledIndices:yt,onNavigate(_){_===null&&!W||N.set("activeIndex",_)},focusItemOnHover:I}),Je=xr(pe,{enabled:!f&&(W||!T&&!E),listRef:ee,activeIndex:Z,selectedIndex:S,disabledIndices:_=>vr(te.current[_]),onMatch(_){W?N.set("activeIndex",_):je(j.current[_],me(it))},onTyping(_){z.current=_}}),wt=o.useMemo(()=>It(Je.reference,Pe.reference,Oe.reference,Me.reference,xe),[Me.reference,Je.reference,Pe.reference,Oe.reference,xe]),vt=o.useMemo(()=>It(Qn,Je.floating,Pe.floating,Oe.floating),[Je.floating,Pe.floating,Oe.floating]),Mt=Pe.item??Ue,Ot=o.useMemo(()=>({props:Mt,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w}),[Mt,E,f,T,w]);N.useContextCallback("setValue",je),N.useContextCallback("setOpen",He),N.useContextCallback("handleScrollArrowVisibility",pt),N.useContextCallback("onOpenChangeComplete",v),wr(()=>{N.update({popupProps:vt,triggerProps:wt,itemRoot:Ot})}),N.useSyncedValues({id:x,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,value:b,open:W,mounted:we,transitionStatus:m,popupProps:vt,triggerProps:wt,itemRoot:Ot,items:U,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,openMethod:de});const bn=An(c,X.inputRef),Pt=E?void 0:D,yn=o.useMemo(()=>!E||!Array.isArray(b)||!D?null:b.map(_=>{const le=Ne(_,R);return ge.jsx("input",{type:"hidden",form:C,name:D,value:le,disabled:f},le)}),[E,b,C,D,R,f]);return ge.jsxs(rn.Provider,{value:N,children:[ge.jsx(on.Provider,{value:pe,children:A}),ge.jsx("input",{...X.getValidationProps(f,{onFocus(){N.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||f||T)return;const le=_.currentTarget.value,Ae=me(it,_.nativeEvent);function qe(){if(E)return;const Ke=le.toLowerCase();let gt=j.current.findIndex(mt=>Ne(mt,R).toLowerCase()===Ke||dn(mt,a).toLowerCase()===Ke);gt===-1&&(gt=j.current.findIndex((mt,In)=>{const Ft=ee.current[In];return Ft!=null&&Ft.toLowerCase()===Ke}));const At=j.current[gt];At!=null&&je(At,Ae)}N.set("forceMount",!0),queueMicrotask(qe)}}),id:x&&Pt==null?`${x}-hidden-input`:void 0,form:C,name:Pt,autoComplete:h,value:De,disabled:f,required:g&&!(E&&ke),readOnly:T,ref:bn,style:D?Fn:Ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yn]})}function Jr(e,t){return e??t}function Qr(e,t,n){const{setFocused:r,focusOwnerRef:s}=ft(),i=$(l=>{(l?!e:s.current===i)&&(s.current=l&&i,r(l))});return K(()=>{const l=t.current;return l?.getRootNode()?.activeElement===l&&i(!0),()=>i(!1)},[e,t,i]),i}const Ze=5;function Zr(e,t){const n=eo(t);return e.clientX>=n.left-Ze&&e.clientX<=n.right+Ze&&e.clientY>=n.top-Ze&&e.clientY<=n.bottom+Ze}function eo(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,d=parseFloat(r.height)||0,u=parseFloat(s.width)||0,C=parseFloat(s.height)||0,h=Math.max(t.width,l,u),p=Math.max(t.height,d,C),T=h-t.width,g=p-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-g/2,bottom:t.bottom+g/2}}const to="data-popup-side",no=400,ro={...er,...Lr,popupSide:e=>e?{[to]:e}:null,value:()=>null},vo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:d=!0,style:u,...C}=t,{setTouched:h,validationMode:p,validation:T,state:g,disabled:P}=ft(),{labelId:F}=ln(),c=Ve(),v=c.useState("readOnly"),U=c.useState("required"),E=c.useState("disabled"),a=P||E||l,R=c.useState("open"),w=c.useState("mounted"),I=c.useState("value"),A=c.useState("triggerProps"),O=c.useState("positionerElement"),H=c.useState("listElement"),Y=c.useState("popupSide"),G=c.useState("id"),y=c.useState("labelId"),k=c.useState("hasSelectedValue"),B=w&&O?Y:null,ie=i??G,X=Jr(F,y);cn({id:i});const J=Fe(O),x=o.useRef(null),f=Qr(a,x),{getButtonProps:D,buttonRef:b}=Xt({disabled:a,native:d}),M=c.useStateSetter("triggerElement"),W=$e(),q=$e(),te=$e();o.useEffect(()=>{if(R)return te.start(no,()=>{c.context.selectionRef.current.allowUnselectedMouseUp=!0,c.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};c.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[R,c,q,te]);const ee=It(A,{id:ie,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?H?.id??Yt(O)?.id:void 0,"aria-labelledby":X,"aria-readonly":v||void 0,"aria-required":U||void 0,tabIndex:a?-1:0,onFocus(Q){f(!0),R&&c.context.alignItemWithTriggerActiveRef.current&&c.context.setOpen(!1,me(it,Q.nativeEvent)),W.start(0,()=>{c.set("forceMount",!0)})},onBlur(Q){ye(O,Q.relatedTarget)||(h(!0),f(!1),p==="onBlur"&&T.commit(I))},onMouseDown(Q){if(R)return;const ae=Be(Q.currentTarget);function j(z){if(!x.current)return;const oe=z.target;ye(x.current,oe)||ye(J.current,oe)||Zr(z,x.current)||c.context.setOpen(!1,me(Nn,z))}q.start(0,()=>{ae.addEventListener("mouseup",j,{once:!0})})}},C,D),fe=T.getValidationProps(a,ee);fe.role="combobox";const ue={...g,open:R,disabled:a,value:I,readOnly:v,popupSide:B,placeholder:!k};return We("button",t,{ref:[n,x,b,M],state:ue,stateAttributesMapping:ro,props:fe})}),oo={value:()=>null},Mo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:d,...u}=t,C=Ve(),h=C.useState("value"),p=C.useState("items"),T=C.useState("itemToStringLabel"),g=C.useState("hasSelectedValue"),P=!g&&l!=null&&i==null,F=C.useState("hasNullItemLabel",P),c={value:h,placeholder:!g};let v=null;return typeof i=="function"?v=i(h):i!=null?v=i:P&&!F?v=l:Array.isArray(h)?v=Yr(h,p,T):v=pn(h,p,T),We("span",t,{state:c,ref:[n,C.context.valueRef],props:[{children:v},u],stateAttributesMapping:oo})}),Oo=o.forwardRef(function(t,n){const r=Ve(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ge.jsx(Un,{ref:n,...t}):null}),mn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return o.useContext(mn)}function io(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=$(s),[,l]=o.useState(0),d=_e(co).current,u=_e(lo).current,C=o.useRef(0),h=o.useRef(!0),p=o.useRef(null),T=o.useRef(null),g=$(()=>{h.current||(h.current=!0,l(R=>R+1))}),P=$((R,w)=>{u.set(R,w),g()}),F=$(R=>{u.delete(R),g()}),c=$(R=>{const w=new Map;return n.current.length=0,r&&(r.current.length=0),R.forEach(I=>{w.set(I.element,{...I.registration.metadata??{},index:I.index}),n.current[I.index]=I.element,r&&(r.current[I.index]=I.registration.label!==void 0?I.registration.label:I.registration.textRef?.current?.textContent??I.element.textContent)}),C.current=n.current.length,w});function v(R){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||R.length<2)return;const w=new MutationObserver(A=>{if(!fo(A))return;let O=null;for(const H of R)if(H.isConnected){if(O&&hn(O,H)>0){w.disconnect(),g();return}O=H}});T.current=w;const I=new Set;for(let A=1;A<R.length;A+=1){const O=ao(R[A-1],R[A]);O&&I.add(O)}I.forEach(A=>w.observe(A,{childList:!0}))}const U=$(()=>{const[R,w]=uo(u),I=c(R),A=p.current,O=!A||A.length!==R.length||R.some((H,Y)=>{const G=A[Y];return H.index!==G.index||H.element!==G.element||H.registration.index!==G.registration.index||H.registration.metadata!==G.registration.metadata});v(w),p.current=R,h.current=!1,O&&(d.forEach(H=>H(I)),i(I))});K(()=>(!h.current&&p.current&&c(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,c]),K(()=>{h.current&&U()}),K(()=>()=>{T.current?.disconnect(),h.current=!0},[]);const E=$(R=>(d.add(R),()=>{d.delete(R)})),a=o.useMemo(()=>({register:P,unregister:F,subscribeMapChange:E,nextIndexRef:C}),[P,F,E,C]);return ge.jsx(mn.Provider,{value:a,children:t})}function lo(){return new Map}function co(){return new Set}function uo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const d=i.index,u={index:d??-1,element:l,registration:i};d===null?r.push(u):d>=0&&(t.add(d),n.push(u))});let s=0;return r.sort((i,l)=>hn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function ao(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function fo(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function hn(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const xn=o.createContext(void 0);function po(){const e=o.useContext(xn);if(!e)throw new Error(Ge(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const go={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},mo={position:"fixed"},Po=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:d,align:u,sideOffset:C,alignOffset:h,collisionBoundary:p="clipping-ancestors",collisionPadding:T,arrowPadding:g,sticky:P,disableAnchorTracking:F,alignItemWithTrigger:c=!0,collisionAvoidance:v=_n,style:U,...E}=t,a=Ve(),R=sn(),w=a.useState("open"),I=a.useState("mounted"),A=a.useState("modal"),O=a.useState("value"),H=a.useState("openMethod"),Y=a.useState("positionerElement"),G=a.useState("triggerElement"),y=a.useState("isItemEqualToValue"),k=a.useState("transitionStatus"),B=o.useRef(null),ie=o.useRef(null),[X,J]=o.useState(c),x=I&&X&&H!=="touch";!I&&X!==c&&J(c),o.useImperativeHandle(a.context.alignItemWithTriggerActiveRef,()=>x),Ir((x||A)&&w,H==="touch",Y,G);const f=ir({anchor:r,floatingRootContext:R,positionMethod:l,mounted:I,side:d,sideOffset:C,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:T,sticky:P,disableAnchorTracking:F??x,collisionAvoidance:v,keepMounted:!0}),D=x?"none":f.side,b=x?mo:f.positionerStyles,M={open:w,side:D,align:f.align,anchorHidden:f.anchorHidden};K(()=>{a.set("popupSide",f.side)},[a,f.side]);const W=a.useStateSetter("positionerElement"),q=lr(t,M,{styles:b,transitionStatus:k,props:E,refs:[n,W],hidden:!I,inert:!w}),te=o.useRef(0),ee=$(ue=>{if(a.context.valuesRef.current.length===0)return;const Q=te.current;te.current=ue.size;const ae=me(it);if(Q!==0&&!a.state.multiple&&O!==null&&ot(a.context.valuesRef.current,O,y)===-1){const z=a.context.initialValueRef.current,ne=z!=null&&ot(a.context.valuesRef.current,z,y)!==-1?z:null;a.context.setValue(ne,ae),ne===null&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null)}if(Q!==0&&a.state.multiple&&Array.isArray(O)){const j=O.filter(z=>ot(a.context.valuesRef.current,z,y)!==-1);j.length!==O.length&&(a.context.setValue(j,ae),j.length===0&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null))}if(w&&x){a.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};lt(Y,j),lt(a.context.popupRef.current,j)}}),fe=o.useMemo(()=>({...f,side:D,alignItemWithTriggerActive:x,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:ie}),[f,D,x,J]);return ge.jsx(io,{elementsRef:a.context.listRef,labelsRef:a.context.labelsRef,onMapChange:ee,children:ge.jsxs(xn.Provider,{value:fe,children:[I&&A&&ge.jsx(tr,{inert:Bn(!w),cutout:G}),q]})})}),et="base-ui-disable-scrollbar",Ut={className:et,getElement(e){return ge.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},ho=o.createContext(void 0),xo={disableStyleElements:!1};function So(){return o.useContext(ho)??xo}const _t="--transform-origin",Ro={...rr,...Qt},Ao=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...d}=t,u=Ve(),C=u.useState("multiple"),h=u.useState("readOnly"),p=u.useState("highlightItemOnHover"),T=sn(),{side:g,align:P,alignItemWithTriggerActive:F,isPositioned:c,setControlledAlignItemWithTrigger:v}=po(),U=Tr()!=null,E=cr(),{nonce:a,disableStyleElements:R}=So(),w=u.useState("id"),I=u.useState("open"),A=u.useState("openMethod"),O=u.useState("mounted"),H=u.useState("popupProps"),Y=u.useState("transitionStatus"),G=u.useState("triggerElement"),y=u.useState("positionerElement"),k=u.useState("listElement"),B=o.useRef(!1),ie=o.useRef(!1),X=o.useRef({}),J=st(),x=$(M=>{if(!y||!u.context.popupRef.current||!ie.current)return;const W=y.style.top==="0px",q=y.style.bottom==="0px";if(B.current||!F||!W&&!q){u.context.handleScrollArrowVisibility(M);return}const te=Wt(y),ee=ze(y.getBoundingClientRect().height,"y",te),fe=Be(y),ue=rt(y),Q=ue.getComputedStyle(y),ae=parseFloat(Q.marginTop),j=parseFloat(Q.marginBottom),z=Bt(ue.getComputedStyle(u.context.popupRef.current)),oe=Math.min(fe.documentElement.clientHeight-ae-j,z),ne=M.scrollTop,Se=tt(M);let he=null;const Re=ce=>{y.style.height=`${ce}px`},se=W?Se-ne:ne,xe=Math.min(ee+se,oe);if(se<=Ee){const ce=Ye(se,0,oe-ee);ce>0&&Re(ee+ce),M.scrollTop=W?Se:0,oe-(ee+ce)<=Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M);return}if(oe-xe>Ee)he=W?1/0:0;else if(q&&ne<Se){const ce=ee+se-oe;he=ne-(se-ce)}const N=Math.ceil(xe);if(N!==0&&Re(N),he!=null){const ce=Ye(he,0,tt(M));Math.abs(M.scrollTop-ce)>Ee&&(M.scrollTop=ce)}N>=oe-Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M)});o.useImperativeHandle(u.context.scrollHandlerRef,()=>x,[x]),Jt({open:I,ref:u.context.popupRef,onComplete(){I&&u.context.onOpenChangeComplete(!0)}});const f={open:I,transitionStatus:Y,side:g,align:P};K(()=>{!y||!u.context.popupRef.current||Object.keys(X.current).length||(X.current={top:y.style.top||"0",left:y.style.left||"0",right:y.style.right,height:y.style.height,bottom:y.style.bottom,minHeight:y.style.minHeight,maxHeight:y.style.maxHeight,marginTop:y.style.marginTop,marginBottom:y.style.marginBottom})},[u,y]),K(()=>{I||F||(ie.current=!1,B.current=!1,lt(y,X.current))},[I,F,y]),K(()=>{const M=u.context.popupRef.current;if(!I||!G||!y||!M||F&&!c||u.state.transitionStatus==="ending")return;if(ie.current=!0,M.style.removeProperty(_t),!F){J.request(()=>u.context.handleScrollArrowVisibility(k||M));return}const W=bo(M);try{let q=u.context.selectedItemTextRef.current;q?.isConnected||(q=!u.select("hasSelectedValue")&&u.context.firstItemTextRef.current?.isConnected?u.context.firstItemTextRef.current:null);const te=u.context.valueRef.current,ee=rt(y),fe=ee.getComputedStyle(y),ue=ee.getComputedStyle(M),Q=Be(G),ae=Wt(G),j=nt(G.getBoundingClientRect(),ae),z=nt(y.getBoundingClientRect(),ae),oe=j.height,ne=k||M,Se=ne.scrollHeight,he=parseFloat(ue.borderBottomWidth),Re=parseFloat(fe.marginTop)||10,se=parseFloat(fe.marginBottom)||10,xe=parseFloat(fe.minHeight)||100,N=Bt(ue),ce=5,Ie=5,we=20,m=Q.documentElement.clientHeight-Re-se,L=Q.documentElement.clientWidth,Z=m-j.bottom+oe;let S,V=E==="rtl"?j.right-z.width:j.left,Ce=0;if(q&&te){const pe=nt(te.getBoundingClientRect(),ae);S=nt(q.getBoundingClientRect(),ae),V=z.left+(E==="rtl"?pe.right-S.right:pe.left-S.left);const Me=pe.top-j.top+pe.height/2;Ce=S.top-z.top+S.height/2-Me}const be=Z+Ce+se+he;let de=Math.min(m,be);const De=m-Re-se,ve=be-de,dt=L-Ie;y.style.left=`${Ye(V,ce,dt-z.width)}px`,y.style.height=`${de}px`,y.style.maxHeight="none",y.style.marginTop=`${Re}px`,y.style.marginBottom=`${se}px`,M.style.height="100%";const Xe=tt(ne),ke=ve>=Xe-Ee;ke&&(de=Math.min(m,z.height)-(ve-Xe));const He=j.top<we||j.bottom>m-we||Math.ceil(de)+Ee<Math.min(Se,xe),je=(ee.visualViewport?.scale??1)!==1&&$t;if(He||je){lt(y,X.current),v(!1);return}const pt=Math.max(xe,de);if(ke){const pe=Math.max(0,m-be);y.style.top=z.height>=De?"0":`${pe}px`,y.style.height=`${de}px`,ne.scrollTop=tt(ne)}else y.style.bottom="0",ne.scrollTop=ve;if(S){const pe=z.top,Me=z.height,Oe=S.top+S.height/2,Pe=Ye(Me>0?(Oe-pe)/Me*100:50,0,100);M.style.setProperty(_t,`50% ${Pe}%`)}(pt===m||de>=N)&&(B.current=!0),u.context.handleScrollArrowVisibility(ne),p&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{W()}},[u,I,y,G,F,v,J,k,p,E,c]),o.useEffect(()=>{if(!F||!y||!I)return;const M=rt(y);function W(q){u.context.setOpen(!1,me(jn,q))}return Wn(M,"resize",W)},[u,F,y,I]);const D={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":h||void 0,id:`${w}-list`},onKeyDown(M){U&&or.has(M.key)&&M.stopPropagation()},onScroll(M){k||x(M.currentTarget)},...F&&{style:k?{height:"100%"}:go},className:!k&&F?Ut.className:void 0},b=We("div",t,{ref:[n,u.context.popupRef],state:f,stateAttributesMapping:Ro,props:[H,D,fr(Y),d]});return ge.jsxs(o.Fragment,{children:[!R&&Ut.getElement(a),ge.jsx(nr,{context:T,modal:!1,disabled:!O,openInteractionType:A,returnFocus:l,restoreFocus:!0,children:b})]})});function Bt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return gn(e.scrollHeight,e.clientHeight)}function Wt(e){return ur.getScale(e)}function ze(e,t,n){return e/n[t]}function nt(e,t){return ar({x:ze(e.x,"x",t),y:ze(e.y,"y",t),width:ze(e.width,"x",t),height:ze(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function bo(e){const{style:t}=e,n={};for(const[r,s]of jt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of jt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function yo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:d,subscribeMapChange:u,nextIndexRef:C}=so(),h=o.useRef(-1),[p,T]=o.useState(i==null&&t?()=>{if(h.current===-1){const c=C.current;C.current+=1,h.current=c}return h.current}:-1),g=i??p,P=o.useRef(null),F=o.useCallback(c=>{const v=P.current;v&&d(v),P.current=c,c&&l(c,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,d,r,n,s]);return K(()=>{if(i==null)return u(c=>{const v=P.current?c.get(P.current)?.index:null;v!=null&&T(v)})},[i,u]),{ref:F,index:g}}const Sn=o.createContext(void 0);function Rn(){const e=o.useContext(Sn);if(!e)throw new Error(Ge(57));return e}const Fo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:d,disabled:u=!1,nativeButton:C=!1,...h}=t,p=o.useRef(null),T=yo({guess:!0,label:d,textRef:p}),g=Ve(),{props:P,multiple:F,disabled:c,readOnly:v,isItemEqualToValue:U}=g.useState("itemRoot"),E=c||u,a=g.useState("isActive",T.index),R=g.useState("open"),w=g.useState("isSelected",l),I=g.useState("isSelectedByFocus",T.index),A=T.index,O=o.useRef(null);K(()=>{const f=g.context.valuesRef.current;return f[A]=l,()=>{delete f[A]}},[A,l,g]),K(()=>{const f=g.state.value,D=g.state.selectedIndex;let b=D,M;F&&Array.isArray(f)?(b=Br(A,l,g.context.valuesRef.current,f,U,D),M=b===A,A===D&&!M&&(g.context.selectedItemTextRef.current=null)):(M=f!==void 0&&Le(l,f,U),M&&(b=A)),g.set("selectedIndex",b),M&&p.current&&(g.context.selectedItemTextRef.current=p.current)},[A,F,U,g,l]);const H=o.useRef("mouse"),Y=o.useRef(!1),{getButtonProps:G,buttonRef:y}=Xt({disabled:E,focusableWhenDisabled:!0,native:C,composite:!0}),k={disabled:E,selected:w,highlighted:a};function B(f){if(c||v)return;const D=g.state.value;if(F){const b=Array.isArray(D)?D:[],M=w?Wr(b,l,U):[...b,l];g.context.setValue(M,me(St,f))}else g.context.setValue(l,me(St,f)),g.context.setOpen(!1,me(St,f))}function ie(){g.context.selectionRef.current.dragY=0}const X={role:"option","aria-selected":w,tabIndex:R&&a?0:-1,onKeyDown(f){g.set("activeIndex",A),f.key===" "&&g.context.typingRef.current&&f.preventDefault()},onClick(f){const D=H.current!=="touch",b=f.nativeEvent.pointerType,M=D&&tn(f.nativeEvent)&&(b!==void 0||a),W=D&&!M&&!Y.current;Y.current=!1,!(E||W)&&B(f.nativeEvent)},onPointerEnter(f){H.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const D=g.context.selectionRef.current;D.dragY+=f.movementY,D.dragY**2>=64&&(D.allowUnselectedMouseUp=!0)}},onPointerDown(f){H.current=f.pointerType,Y.current=!0,ie()},onMouseUp(){if(ie(),E||H.current==="touch"||Y.current)return;const f=!g.context.selectionRef.current.allowSelectedMouseUp&&w,D=!g.context.selectionRef.current.allowUnselectedMouseUp&&!w;f||D||(Y.current=!0,O.current?.click(),Y.current=!1)}},J=We("div",t,{ref:[y,n,T.ref,O],state:k,props:[P,X,h,G]}),x=o.useMemo(()=>({selected:w,index:A,textRef:p,selectedByFocus:I}),[w,A,p,I]);return ge.jsx(Sn.Provider,{value:x,children:J})})),Io=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,keepMounted:l,selected:d,...u}=t,C=o.useRef(null),{transitionStatus:h,setMounted:p}=sr(d),g=We("span",t,{ref:[n,C],state:{selected:d,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Qt});return Jt({batch:!0,enabled:!d,open:d,ref:C,onComplete(){d||p(!1)}}),g})),Lo=o.forwardRef(function(t,n){const{selected:r}=Rn();return t.keepMounted||r?ge.jsx(Io,{...t,selected:r,ref:n}):null}),Vo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Rn(),l=Ve(),{render:d,className:u,style:C,...h}=t,p=o.useCallback(g=>{g&&(r===0&&(l.context.firstItemTextRef.current=g),i&&(l.context.selectedItemTextRef.current=g))},[l,r,i]);return We("div",t,{ref:[p,n,s],props:h})}));export{go as L,wo as S,po as a,vo as b,Mo as c,Oo as d,Po as e,Ao as f,Fo as g,Lo as h,Vo as i,dr as j,Rr as k,Ir as l,Tr as m,Lr as n,Gr as o,ft as p,ln as q,cn as r,Ut as s,Qr as t,Ve as u,Nt as v,kr as w,nn as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external
|
|
1
|
+
import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external--HDUIUZr.js";import{A as c}from"./arrow-left-Bo9y7VzF.js";import{S as m}from"./server-CWrP7mtL.js";import{E as o}from"./external-link-D-xHhfj5.js";function g(){const r=l.useRef(null);l.useLayoutEffect(()=>{const t=r.current?.parentElement;t&&(t.scrollTop=0)},[]);const n=[[s("self_host.step.backend_title"),s("self_host.step.backend_body")],[s("self_host.step.schema_title"),s("self_host.step.schema_body")],[s("self_host.step.client_title"),s("self_host.step.client_body")]];return e.jsx("div",{ref:r,className:"tt-cloud-theme flex flex-1 flex-col font-oai text-oai-black dark:text-oai-white",children:e.jsxs("main",{className:"mx-auto w-full max-w-3xl px-4 py-8 sm:px-6 sm:py-12",children:[e.jsxs(i,{to:"/cloud",className:"mb-7 inline-flex min-h-10 items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(c,{size:16,"aria-hidden":!0}),s("self_host.back")]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(m,{size:18,"aria-hidden":!0}),e.jsx("span",{children:s("self_host.status")})]}),e.jsx("h1",{className:"text-balance text-3xl font-semibold tracking-tight sm:text-4xl",children:s("self_host.title")}),e.jsx("p",{className:"mt-4 max-w-2xl text-base leading-7 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.subtitle")}),e.jsxs("div",{className:"mt-7 rounded-lg border border-oai-gray-300 p-5 dark:border-oai-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s("self_host.preview_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.preview_body")})]}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.steps_title")}),e.jsx("ol",{className:"mt-5 list-decimal space-y-6 pl-5 marker:text-oai-gray-500",children:n.map(([t,d])=>e.jsxs("li",{className:"pl-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:d})]},t))})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.responsibility_title")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.responsibility_body")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.community")}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[e.jsxs(a,{as:"a",href:"https://github.com/InsForge/InsForge#self-hosted-docker-compose",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.insforge"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]}),e.jsxs(a,{as:"a",href:"https://github.com/xiufengsun/TokenTracker/tree/main/dashboard/edge-patches",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.source"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]})]})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-base font-semibold",children:s("self_host.managed_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.managed_body")}),e.jsx(a,{as:i,to:"/cloud",className:"mt-4 no-underline",children:s("self_host.link.cloud")})]})]})})}export{g as SelfHostPage};
|
package/dashboard/dist/assets/{ServiceStatusPage-fBwG-qXq.js → ServiceStatusPage-C0sDYa8c.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,c as n,j as t,R as h}from"./__vite-browser-external
|
|
1
|
+
import{r as d,c as n,j as t,R as h}from"./__vite-browser-external--HDUIUZr.js";import{P as f}from"./ProviderIcon-CHtZiJUN.js";import{E as b}from"./external-link-D-xHhfj5.js";const x=[{id:"claude",name:"Claude",icon:"CLAUDE",apiUrl:"https://status.claude.com/api/v2/status.json",pageUrl:"https://status.claude.com"},{id:"openai",name:"OpenAI / Codex",icon:"CODEX",apiUrl:"https://status.openai.com/api/v2/status.json",pageUrl:"https://status.openai.com"},{id:"cursor",name:"Cursor",icon:"CURSOR",apiUrl:"https://status.cursor.com/api/v2/status.json",pageUrl:"https://status.cursor.com"},{id:"github",name:"GitHub / Copilot",icon:"GITHUB",apiUrl:"https://www.githubstatus.com/api/v2/status.json",pageUrl:"https://www.githubstatus.com"},{id:"gemini",name:"Gemini",icon:"GEMINI",kind:"google",serviceName:"Gemini",apiUrl:"https://www.google.com/appsstatus/dashboard/incidents.json",pageUrl:"https://www.google.com/appsstatus/dashboard"},{id:"kimi",name:"Kimi / Moonshot",icon:"KIMI",apiUrl:"https://status.moonshot.cn/api/v2/status.json",pageUrl:"https://status.moonshot.cn"},{id:"minimax",name:"MiniMax",icon:"MINIMAX",apiUrl:"https://status.minimaxi.com/api/v2/status.json",pageUrl:"https://status.minimaxi.com"},{id:"zed",name:"Zed",icon:"ZED",kind:"instatus",apiUrl:"https://status.zed.dev/summary.json",pageUrl:"https://status.zed.dev"}],w=6e4,y=8e3,j=new Set(["none","minor","major","critical"]),g={none:{dot:"bg-emerald-500",text:"text-emerald-600 dark:text-emerald-400"},minor:{dot:"bg-yellow-500",text:"text-yellow-600 dark:text-yellow-400"},major:{dot:"bg-orange-500",text:"text-orange-600 dark:text-orange-400"},critical:{dot:"bg-red-500",text:"text-red-600 dark:text-red-400"},unknown:{dot:"bg-oai-gray-400",text:"text-oai-gray-500 dark:text-oai-gray-400"}};function k(e){switch(e){case"none":return n("status.state.none");case"minor":return n("status.state.minor");case"major":return n("status.state.major");case"critical":return n("status.state.critical");default:return n("status.state.unknown")}}const v={low:"minor",medium:"major",high:"critical"},N={MAJOROUTAGE:"critical",PARTIALOUTAGE:"major",DEGRADEDPERFORMANCE:"minor"};function A(e){const a=e?.page?.status;if(typeof a!="string")throw new Error("Unexpected payload");if(a==="UP")return{indicator:"none",description:"",updatedAt:null};const s=Array.isArray(e?.activeIncidents)?e.activeIncidents:[],r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=N[i?.impact]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i?.name||"",updatedAt:i?.updated||null})}return o||{indicator:"minor",description:"",updatedAt:null}}function I(e,a){if(!Array.isArray(e))throw new Error("Unexpected payload");const s=e.filter(i=>i&&!i.end&&(i.service_name===a||Array.isArray(i.affected_products)&&i.affected_products.some(c=>c?.title===a)));if(s.length===0)return{indicator:"none",description:"",updatedAt:null};const r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=v[i.severity]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i.external_desc||"",updatedAt:i.modified||null})}return o}async function E(e){try{const a=await fetch(e.apiUrl,{cache:"no-store",signal:AbortSignal.timeout(y)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();if(e.kind==="google")return I(s,e.serviceName);if(e.kind==="instatus")return A(s);const r=s?.status?.indicator;if(!j.has(r))throw new Error("Unexpected payload");return{indicator:r,description:typeof s?.status?.description=="string"?s.status.description:"",updatedAt:typeof s?.page?.updated_at=="string"?s.page.updated_at:null}}catch{return{indicator:"unknown",description:"",updatedAt:null}}}function U({provider:e,result:a}){const s=g[a?.indicator]||g.unknown,r=a==null;return t.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noreferrer","aria-label":n("status.open_page",{provider:e.name}),title:n("status.open_page",{provider:e.name}),className:"group block no-underline text-inherit rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4 sm:p-5 transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(f,{provider:e.icon,size:20}),t.jsx("span",{className:"font-medium text-sm sm:text-base truncate",children:e.name})]}),t.jsx("span",{"aria-hidden":!0,className:"shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-lg text-oai-gray-400 transition-colors group-hover:text-oai-black dark:group-hover:text-white",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r?t.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-300 dark:bg-oai-gray-700 animate-pulse","aria-hidden":!0}):t.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[a.indicator!=="none"&&a.indicator!=="unknown"?t.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 ${s.dot}`}):null,t.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${s.dot}`})]}),t.jsx("span",{className:`text-sm font-medium ${r?"text-oai-gray-400":s.text}`,children:r?n("status.state.checking"):k(a.indicator)})]}),!r&&a.description&&a.indicator!=="none"?t.jsx("p",{className:"mt-2 text-xs text-oai-gray-500 dark:text-oai-gray-400 break-words",children:a.description}):null]})}function T(){const[e,a]=d.useState({}),[s,r]=d.useState(null),[o,i]=d.useState(!1),c=d.useRef(!0),u=d.useCallback(async()=>{i(!0);const l=await Promise.all(x.map(async p=>[p.id,await E(p)]));c.current&&(a(Object.fromEntries(l)),r(new Date),i(!1))},[]);d.useEffect(()=>{c.current=!0,u();const l=setInterval(()=>{u()},w);return()=>{c.current=!1,clearInterval(l)}},[u]);const m=d.useMemo(()=>s?n("status.last_checked",{time:s.toLocaleTimeString()}):null,[s]);return t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.service_status")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("status.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[m?t.jsx("span",{className:"hidden sm:inline text-xs text-oai-gray-400 dark:text-oai-gray-500",children:m}):null,t.jsx("button",{type:"button",onClick:()=>{u()},disabled:o,"aria-label":n("status.refresh"),title:n("status.refresh"),className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50",children:t.jsx(h,{className:`h-4 w-4 ${o?"animate-spin":""}`,"aria-hidden":!0})})]})]}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:x.map(l=>t.jsx(U,{provider:l,result:e[l.id]??null},l.id))}),t.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n("status.page.source_note")})]})})})}export{x as STATUS_PROVIDERS,T as ServiceStatusPage,T as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as Oe,r as i,j as e,y as Q,c as s,Z as Re,X as Ee,i as N,az as ke,W as we,R as ls,V as ye,aM as cs,bk as Y}from"./__vite-browser-external-BZ-i40Kf.js";import{L as ds,I as us}from"./LocalOnlyNotice-EHw7BeYS.js";import{S as ie}from"./Select-BfjrcaiM.js";import{C as ms}from"./chevron-down-BJ0BpS_w.js";import{S as $e}from"./search-CU6UVI1L.js";import{C as xs}from"./check-D888uFpx.js";import{P as gs,a as hs,b as ps,c as fs,d as bs}from"./PopoverPopup-Bjs7E91g.js";import{P as Pe}from"./ProviderIcon-DqXIjym-.js";import{H as ys}from"./HoverTooltip-Dn80DyPM.js";import{u as je}from"./useCurrency-CMHIL39_.js";import{i as _s,C as ks}from"./host-mode-Gw6KD5OJ.js";import{L as js}from"./loader-circle-bRHxCgY3.js";import{I as vs}from"./info-CvOmd88O.js";import{a as ws,b as Ns,c as Ss,d as Cs,e as Ms}from"./TooltipPopup-CjzmNK2l.js";import"./arrow-up-right-CCMEqQQp.js";import"./download-BJ7CKwx5.js";import"./SelectItemText-Dpdlb0cU.js";import"./composite-CUuXvKos.js";import"./usePositioner-CRSfrGQq.js";import"./store-CJFdru_6.js";import"./safePolygon-BerB8y-A.js";const Ae={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};Ae.node;const Ts=Oe(Ae);const qe={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};qe.node;const Ds=Oe(qe),Ls="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function Ne({options:a,value:t,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:p,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[v,w]=i.useState(!1),[x,g]=i.useState(""),[b,y]=i.useState(-1),L=i.useRef(null),S=`${i.useId()}-listbox`,P=t===o?u:a.find(h=>h.value===t)?.label??t,M=x.trim().toLowerCase(),D=i.useMemo(()=>M?a.filter(h=>h.label.toLowerCase().includes(M)):a,[a,M]),C=i.useMemo(()=>[{value:o,label:u},...D],[o,u,D]),O=b>=0&&b<C.length?C[b]:null,A=h=>{r(h),w(!1),g(""),y(-1)};i.useEffect(()=>{v&&L.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[v,b]);const J=h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault();const T=h.key==="ArrowDown";y(I=>{const c=C.length;return c?T?I>=c-1?0:I+1:I<=0?c-1:I-1:-1});return}if(h.key==="Enter"){const T=O||(M&&D.length?D[0]:null);if(!T)return;h.preventDefault(),A(T.value)}};return e.jsxs(gs,{open:v,onOpenChange:h=>{w(h),y(-1),h||g("")},children:[e.jsxs(hs,{disabled:k,"aria-label":f,className:Q("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==o?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",j),children:[e.jsx(Ds,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:P}),e.jsx(ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ps,{children:e.jsx(fs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(bs,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx($e,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":S,"aria-activedescendant":O?`${S}-${b}`:void 0,value:x,onChange:h=>{g(h.target.value),y(-1)},onKeyDown:J,placeholder:p,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:L,id:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((h,T)=>e.jsxs("button",{id:`${S}-${T}`,type:"button",role:"option","aria-selected":t===h.value,"data-active":T===b?"true":void 0,onMouseEnter:()=>y(T),onClick:()=>A(h.value),className:Q(Ls,t===h.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",T===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:h.label}),t===h.value?e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},h.value)),D.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const t=new URL(`/functions/${Fs}`,window.location.origin);a.from&&t.searchParams.set("from",a.from),a.to&&t.searchParams.set("to",a.to),a.limit&&t.searchParams.set("limit",String(a.limit)),a.refresh&&t.searchParams.set("refresh","1");const r=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await r.json().catch(()=>null);if(!r.ok){const u=r.status===404?s("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,p=new Error(o?.error||u);throw p.status=r.status,p}return o}function ze(a,t,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=r?{hour:"2-digit",minute:"2-digit"}:{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Date(o).toLocaleString(t||void 0,u)}catch{const p=new Date(o).toISOString();return r?p.slice(11,16):p.slice(0,16).replace("T"," ")}}function Ge(a){const t=Number(a);if(!Number.isFinite(t)||t<=0)return null;const r=Math.round(t/6e4);if(r<60)return s("sessions.duration.minutes",{minutes:r});const o=Math.floor(r/60),u=r%60;return s("sessions.duration.hours",{hours:o,minutes:u})}function W(a){return E(a?.own_total_tokens??a?.total_tokens)}function Os(a,t=0,r=1/0){if(!t&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(x=>{const g=Date.parse(x.timestamp);return g>=t&&g<=r}),k=new Map,j=Object.fromEntries([...ce,...fe].map(x=>[x,0]));let v=0,w=0;for(const x of f){v+=E(x.total_tokens),w+=E(x.cost_usd);const g=k.get(x.model)||{...(n.model_usage||[]).find(b=>b.model===x.model),model:x.model,...Object.fromEntries([...ce,...fe].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...ce,...fe]){const y=E(x[b]);j[b]+=y,g[b]+=y}g.cost_usd+=E(x.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(x[b])&&(g[b]=[...new Set([...g[b],...x[b]])]);x.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(x.model,g)}return{...n,...j,total_tokens:v,own_total_tokens:v,cost_usd:w,own_cost_usd:w,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||W(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const p=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=W(n),v=Z(n);for(const w of u.get(n.session_hash)||[]){const x=p(w,k);j+=x.tokens,v+=x.cost}return{tokens:j,cost:v}};for(const n of o){const f=p(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-W(n),n.subagent_cost_usd=f.cost-Z(n)}return o}function Z(a){return E(a?.own_cost_usd??a?.cost_usd)}function E(a){const t=Number(a);return Number.isFinite(t)&&t>=0?t:0}const ce=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],fe=["long_context_","priority_","priority_long_context_"].flatMap(a=>ce.filter(t=>t!=="total_tokens").map(t=>a+t));function B(a){const t=Array.isArray(a?.model_usage)?a.model_usage.filter(r=>r&&typeof r.model=="string"&&r.model):[];return t.length?t:[{model:a?.model||"",total_tokens:W(a),cost_usd:Z(a),performance:a?.performance}]}function Rs(a){const t={estimated_output_tokens:0,estimated_duration_ms:0,estimated_request_count:0,estimated_tokens_per_second:null,first_response_total_ms:0,first_response_sample_count:0,first_response_ms:null};for(const r of a){const o=r?.performance;if(!o)continue;const u=E(o.estimated_duration_ms),p=E(o.estimated_output_tokens),n=E(o.estimated_request_count);u>0&&p>0&&n>0&&(t.estimated_output_tokens+=p,t.estimated_duration_ms+=u,t.estimated_request_count+=n);const f=E(o.first_response_sample_count),k=E(o.first_response_total_ms);f>0&&k>0&&(t.first_response_total_ms+=k,t.first_response_sample_count+=f)}return t.estimated_duration_ms>0&&(t.estimated_tokens_per_second=t.estimated_output_tokens*1e3/t.estimated_duration_ms),t.first_response_sample_count>0&&(t.first_response_ms=t.first_response_total_ms/t.first_response_sample_count),t}function Ke(a){const t=new Set,r=a.filter(o=>t.has(o.session_hash)?!1:(t.add(o.session_hash),!0));return{count:r.length,tokens:r.reduce((o,u)=>o+W(u),0),cost:r.reduce((o,u)=>o+Z(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Rs(r)}}function _e(a){const t=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(t)?t:0}function Es(a,t){return[...a].sort((r,o)=>(t==="cost"?Z(o)-Z(r):t==="tokens"?W(o)-W(r):0)||_e(o)-_e(r))}function de(a){const t=_e(a);if(!t)return"";const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function $s(a,t){const r=new Map;for(const o of a){const u=t==="project"?o.project_key||"":de(o),p=r.get(u)||{key:u,sessions:[]};p.sessions.push(o),r.set(u,p)}return[...r.values()]}function Ps(a){const t=new URLSearchParams(a),r=t.get("source"),o=n=>{const f=t.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&de({ended_at:k.toISOString()})===f?f:""},u=o("from"),p=o("to");return{source:["claude","codex","grok","zcode","opencode","kimi"].includes(r)?r:"all",model:t.get("model")||"all",from:u,to:p}}function As(a,t,r){let o=t?new Date(`${t}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${t}T23:59:59.999`).getTime());const p=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(p)||p>=o)&&(!Number.isFinite(n)||n<=u)}function ae({performance:a,className:t=""}){const r=Number(a?.estimated_tokens_per_second),o=Number(a?.estimated_request_count||0);return!Number.isFinite(r)||r<=0||o<=0?null:e.jsx("span",{className:t,title:`${s("sessions.performance.samples",{count:o})}
|
|
1
|
+
import{o as Oe,r as i,j as e,y as Q,c as s,Z as Re,X as Ee,i as N,az as ke,W as we,R as ls,V as ye,aM as cs,bk as Y}from"./__vite-browser-external--HDUIUZr.js";import{L as ds,I as us}from"./LocalOnlyNotice-Dsk-d0Hr.js";import{S as ie}from"./Select-DN4Kq_R1.js";import{C as ms}from"./chevron-down-CoGC_RLK.js";import{S as $e}from"./search-B7ZJhoau.js";import{C as xs}from"./check-BJNGKpX8.js";import{P as gs,a as hs,b as ps,c as fs,d as bs}from"./PopoverPopup-D-yECvH9.js";import{P as Pe}from"./ProviderIcon-CHtZiJUN.js";import{H as ys}from"./HoverTooltip-D3gpW3Jh.js";import{u as je}from"./useCurrency-Bv9g8mpq.js";import{i as _s,C as ks}from"./host-mode-C2K0MMOs.js";import{L as js}from"./loader-circle-DIl96Mw-.js";import{I as vs}from"./info-tnXKCyuK.js";import{a as ws,b as Ns,c as Ss,d as Cs,e as Ms}from"./TooltipPopup-B6FqLWO7.js";import"./arrow-up-right-B4hXO4sc.js";import"./download-C1K_v0C0.js";import"./SelectItemText-C-HmeD8L.js";import"./composite-BfIUPpl8.js";import"./usePositioner-CQiZGknc.js";import"./store-DRK6-JBg.js";import"./safePolygon-CAfS8-ct.js";const Ae={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};Ae.node;const Ts=Oe(Ae);const qe={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};qe.node;const Ds=Oe(qe),Ls="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function Ne({options:a,value:t,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:p,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[v,w]=i.useState(!1),[x,g]=i.useState(""),[b,y]=i.useState(-1),L=i.useRef(null),S=`${i.useId()}-listbox`,P=t===o?u:a.find(h=>h.value===t)?.label??t,M=x.trim().toLowerCase(),D=i.useMemo(()=>M?a.filter(h=>h.label.toLowerCase().includes(M)):a,[a,M]),C=i.useMemo(()=>[{value:o,label:u},...D],[o,u,D]),O=b>=0&&b<C.length?C[b]:null,A=h=>{r(h),w(!1),g(""),y(-1)};i.useEffect(()=>{v&&L.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[v,b]);const J=h=>{if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault();const T=h.key==="ArrowDown";y(I=>{const c=C.length;return c?T?I>=c-1?0:I+1:I<=0?c-1:I-1:-1});return}if(h.key==="Enter"){const T=O||(M&&D.length?D[0]:null);if(!T)return;h.preventDefault(),A(T.value)}};return e.jsxs(gs,{open:v,onOpenChange:h=>{w(h),y(-1),h||g("")},children:[e.jsxs(hs,{disabled:k,"aria-label":f,className:Q("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==o?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",j),children:[e.jsx(Ds,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:P}),e.jsx(ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ps,{children:e.jsx(fs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(bs,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx($e,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":S,"aria-activedescendant":O?`${S}-${b}`:void 0,value:x,onChange:h=>{g(h.target.value),y(-1)},onKeyDown:J,placeholder:p,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:L,id:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((h,T)=>e.jsxs("button",{id:`${S}-${T}`,type:"button",role:"option","aria-selected":t===h.value,"data-active":T===b?"true":void 0,onMouseEnter:()=>y(T),onClick:()=>A(h.value),className:Q(Ls,t===h.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",T===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:h.label}),t===h.value?e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},h.value)),D.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const t=new URL(`/functions/${Fs}`,window.location.origin);a.from&&t.searchParams.set("from",a.from),a.to&&t.searchParams.set("to",a.to),a.limit&&t.searchParams.set("limit",String(a.limit)),a.refresh&&t.searchParams.set("refresh","1");const r=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await r.json().catch(()=>null);if(!r.ok){const u=r.status===404?s("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,p=new Error(o?.error||u);throw p.status=r.status,p}return o}function ze(a,t,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=r?{hour:"2-digit",minute:"2-digit"}:{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Date(o).toLocaleString(t||void 0,u)}catch{const p=new Date(o).toISOString();return r?p.slice(11,16):p.slice(0,16).replace("T"," ")}}function Ge(a){const t=Number(a);if(!Number.isFinite(t)||t<=0)return null;const r=Math.round(t/6e4);if(r<60)return s("sessions.duration.minutes",{minutes:r});const o=Math.floor(r/60),u=r%60;return s("sessions.duration.hours",{hours:o,minutes:u})}function W(a){return E(a?.own_total_tokens??a?.total_tokens)}function Os(a,t=0,r=1/0){if(!t&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(x=>{const g=Date.parse(x.timestamp);return g>=t&&g<=r}),k=new Map,j=Object.fromEntries([...ce,...fe].map(x=>[x,0]));let v=0,w=0;for(const x of f){v+=E(x.total_tokens),w+=E(x.cost_usd);const g=k.get(x.model)||{...(n.model_usage||[]).find(b=>b.model===x.model),model:x.model,...Object.fromEntries([...ce,...fe].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...ce,...fe]){const y=E(x[b]);j[b]+=y,g[b]+=y}g.cost_usd+=E(x.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(x[b])&&(g[b]=[...new Set([...g[b],...x[b]])]);x.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(x.model,g)}return{...n,...j,total_tokens:v,own_total_tokens:v,cost_usd:w,own_cost_usd:w,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||W(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const p=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=W(n),v=Z(n);for(const w of u.get(n.session_hash)||[]){const x=p(w,k);j+=x.tokens,v+=x.cost}return{tokens:j,cost:v}};for(const n of o){const f=p(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-W(n),n.subagent_cost_usd=f.cost-Z(n)}return o}function Z(a){return E(a?.own_cost_usd??a?.cost_usd)}function E(a){const t=Number(a);return Number.isFinite(t)&&t>=0?t:0}const ce=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],fe=["long_context_","priority_","priority_long_context_"].flatMap(a=>ce.filter(t=>t!=="total_tokens").map(t=>a+t));function B(a){const t=Array.isArray(a?.model_usage)?a.model_usage.filter(r=>r&&typeof r.model=="string"&&r.model):[];return t.length?t:[{model:a?.model||"",total_tokens:W(a),cost_usd:Z(a),performance:a?.performance}]}function Rs(a){const t={estimated_output_tokens:0,estimated_duration_ms:0,estimated_request_count:0,estimated_tokens_per_second:null,first_response_total_ms:0,first_response_sample_count:0,first_response_ms:null};for(const r of a){const o=r?.performance;if(!o)continue;const u=E(o.estimated_duration_ms),p=E(o.estimated_output_tokens),n=E(o.estimated_request_count);u>0&&p>0&&n>0&&(t.estimated_output_tokens+=p,t.estimated_duration_ms+=u,t.estimated_request_count+=n);const f=E(o.first_response_sample_count),k=E(o.first_response_total_ms);f>0&&k>0&&(t.first_response_total_ms+=k,t.first_response_sample_count+=f)}return t.estimated_duration_ms>0&&(t.estimated_tokens_per_second=t.estimated_output_tokens*1e3/t.estimated_duration_ms),t.first_response_sample_count>0&&(t.first_response_ms=t.first_response_total_ms/t.first_response_sample_count),t}function Ke(a){const t=new Set,r=a.filter(o=>t.has(o.session_hash)?!1:(t.add(o.session_hash),!0));return{count:r.length,tokens:r.reduce((o,u)=>o+W(u),0),cost:r.reduce((o,u)=>o+Z(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Rs(r)}}function _e(a){const t=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(t)?t:0}function Es(a,t){return[...a].sort((r,o)=>(t==="cost"?Z(o)-Z(r):t==="tokens"?W(o)-W(r):0)||_e(o)-_e(r))}function de(a){const t=_e(a);if(!t)return"";const r=new Date(t);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function $s(a,t){const r=new Map;for(const o of a){const u=t==="project"?o.project_key||"":de(o),p=r.get(u)||{key:u,sessions:[]};p.sessions.push(o),r.set(u,p)}return[...r.values()]}function Ps(a){const t=new URLSearchParams(a),r=t.get("source"),o=n=>{const f=t.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&de({ended_at:k.toISOString()})===f?f:""},u=o("from"),p=o("to");return{source:["claude","codex","grok","zcode","opencode","kimi"].includes(r)?r:"all",model:t.get("model")||"all",from:u,to:p}}function As(a,t,r){let o=t?new Date(`${t}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${t}T23:59:59.999`).getTime());const p=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(p)||p>=o)&&(!Number.isFinite(n)||n<=u)}function ae({performance:a,className:t=""}){const r=Number(a?.estimated_tokens_per_second),o=Number(a?.estimated_request_count||0);return!Number.isFinite(r)||r<=0||o<=0?null:e.jsx("span",{className:t,title:`${s("sessions.performance.samples",{count:o})}
|
|
2
2
|
${s("sessions.performance.method")}`,children:s("sessions.performance.speed",{speed:Number(r.toFixed(1))})})}const qs=[{key:"input_tokens",label:()=>s("dashboard.projects.detail.comp_input")},{key:"cached_input_tokens",label:()=>s("dashboard.projects.detail.comp_cached")},{key:"cache_creation_input_tokens",label:()=>s("dashboard.projects.detail.comp_cache_write")},{key:"output_tokens",label:()=>s("dashboard.projects.detail.comp_output")},{key:"reasoning_output_tokens",label:()=>s("dashboard.projects.detail.comp_reasoning")}],zs=[{key:"turns",label:()=>s("sessions.col.turns")},{key:"edit_turns",label:()=>s("sessions.col.edits")},{key:"retry_turns",label:()=>s("sessions.detail.retries")},{key:"subagent_calls",label:()=>s("sessions.card.subagents")},{key:"tool_calls",grokOnly:!0,label:()=>s("sessions.detail.tools")},{key:"tool_failures",grokOnly:!0,label:()=>s("sessions.detail.tool_failures")},{key:"error_count",grokOnly:!0,label:()=>s("sessions.detail.errors")},{key:"model_calls",grokOnly:!0,label:()=>s("sessions.detail.model_calls")},{key:"compaction_count",grokOnly:!0,label:()=>s("sessions.detail.compactions")}];function Gs(a){return a==="provider_reported"?s("sessions.detail.cost_reported"):a==="model_pricing"?s("sessions.detail.cost_estimated"):a==="mixed"?s("sessions.detail.cost_mixed"):s("sessions.detail.cost_unknown")}function Se(a){return String(a||"").startsWith("litellm")?s("sessions.detail.pricing_litellm"):String(a||"").startsWith("curated")?s("sessions.detail.pricing_curated"):null}function Ks(a,t){return t||Number(a)>0}function Ce({label:a,children:t}){return e.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:a}),e.jsx("dd",{className:"min-w-0 break-words text-right text-sm tabular-nums text-oai-black dark:text-white",children:t})]})}function le({label:a,title:t,className:r="",children:o}){return e.jsxs("div",{className:`min-w-0 border-oai-gray-200 px-3 py-2.5 dark:border-oai-gray-800 ${r}`,title:t,children:[e.jsx("dt",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"mt-0.5 truncate text-base font-medium tabular-nums text-oai-black dark:text-white",children:o})]})}function Us({session:a,subagents:t=[],onClose:r}){const o=i.useRef(null),u=i.useRef(null),{currency:p,rate:n}=je(),{resolvedLocale:f}=Re(),k=c=>ke(c,{currency:p,rate:n}),j=B(a),v=i.useMemo(()=>Ke(t),[t]),w=W(a),x=Z(a),g=Number(a.subagent_total_tokens??v.tokens),b=Number(a.subagent_cost_usd??v.cost),y=a.performance,L=Number(y?.estimated_tokens_per_second)>0&&Number(y?.estimated_request_count)>0,S=Number(y?.first_response_sample_count)>0&&y?.first_response_ms!=null&&Number.isFinite(Number(y.first_response_ms)),P=S?{seconds:(Number(y.first_response_ms)/1e3).toFixed(2),count:y.first_response_sample_count}:null,M=Number(a.reasoning_output_tokens)>0,D=a.source==="grok",C=D&&Number(a.context_window_tokens)>0;i.useEffect(()=>{const c=document.activeElement,R=document.body.style.overflow;document.body.style.overflow="hidden",o.current?.focus();const $=F=>{if(F.key==="Escape"&&(F.preventDefault(),r()),F.key!=="Tab")return;const z=Array.from(u.current?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), summary, [tabindex="0"]')||[]),ee=z[0],se=z[z.length-1];ee?F.shiftKey&&(document.activeElement===ee||!u.current?.contains(document.activeElement))?(F.preventDefault(),se.focus()):!F.shiftKey&&(document.activeElement===se||!u.current?.contains(document.activeElement))&&(F.preventDefault(),ee.focus()):(F.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$),document.body.style.overflow=R,c instanceof HTMLElement&&c.isConnected&&c.focus()}},[r]);const O=g>0||b>0,A=a.cost_is_partial||O&&v.costIsPartial,J=[{label:s("sessions.detail.own"),tokens:w,cost:x,partial:a.cost_is_partial},{label:s("sessions.detail.subagents"),tokens:g,cost:b,partial:v.costIsPartial}],h=a.agent_nickname||a.title||a.project_key||s("sessions.project.unknown"),T=Ge(a.duration_ms),I=[a.project_key&&a.project_key!==h?a.project_key:null,ze(a.started_at,f),T].filter(Boolean);return e.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/20 dark:bg-black/40",onClick:c=>{c.target===c.currentTarget&&r()},children:e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":s("sessions.detail.title"),tabIndex:-1,className:"flex h-full w-full max-w-[36rem] flex-col border-l border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex shrink-0 items-start gap-3 border-b border-oai-gray-200 px-5 py-4 dark:border-oai-gray-800",children:[e.jsx("span",{className:"shrink-0 pt-0.5 text-oai-gray-600 dark:text-oai-gray-300",children:e.jsx(Pe,{provider:String(a.source||"").toUpperCase(),size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"break-words text-base font-semibold leading-6 text-oai-black dark:text-white",children:h}),e.jsx("p",{className:"mt-0.5 break-words text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:I.join(" · ")})]}),e.jsx("button",{ref:o,type:"button",onClick:r,"aria-label":s("sessions.detail.close"),className:"-mr-2 -mt-1 flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white sm:h-9 sm:w-9",children:e.jsx(Ee,{size:18,"aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 py-5",children:[e.jsxs("section",{"aria-label":s("sessions.detail.consumption"),children:[e.jsxs("dl",{className:"grid grid-cols-2 overflow-hidden rounded-lg border border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx(le,{label:s("sessions.col.tokens"),children:N(w+g)}),e.jsxs(le,{label:s("sessions.col.cost"),className:"border-l",children:[A?"≥":"",k(x+b)]}),e.jsx(le,{label:s("sessions.summary.speed"),className:"border-t",title:L?s("sessions.performance.samples",{count:y.estimated_request_count}):s("sessions.detail.no_speed"),children:L?e.jsx(ae,{performance:y}):"—"}),e.jsx(le,{label:s("sessions.performance.first_response"),className:"border-l border-t",title:s("sessions.performance.first_response_method"),children:S?Number(y.first_response_sample_count)===1?s("sessions.performance.first_response_value_single",P):s("sessions.performance.first_response_value",P):"—"})]}),O?e.jsx("dl",{className:"mt-3 space-y-1.5",children:J.map(c=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:c.label}),e.jsx("dd",{className:"text-right tabular-nums",children:N(c.tokens)}),e.jsxs("dd",{className:"text-right tabular-nums",children:[c.partial?"≥":"",k(c.cost)]})]},c.label))}):null,e.jsxs("p",{className:"mt-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:[s("sessions.detail.cost_source")," · ",Gs(a.cost_source),a.cost_is_partial?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",s("sessions.cost.partial_title")]}):null,a.usage_is_incomplete?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",s("sessions.badge.partial_usage")]}):null]})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.detail.tokens")}),e.jsx("dl",{className:"mt-2 grid grid-cols-1 gap-x-8 gap-y-1.5 sm:grid-cols-2",children:qs.map(({key:c,label:R})=>e.jsx(Ce,{label:R(),children:a[c]==null?"—":N(a[c])},c))})]}),e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.detail.models")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:s("sessions.col.tokens")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:s("sessions.col.cost")})]}),e.jsx("ul",{className:"mt-1 divide-y divide-oai-gray-100 dark:divide-oai-gray-800/70",children:j.map(c=>{const R=c.pricing?.status==="unpriced",$=a.cost_source==="provider_reported"&&j.length===1,F=$?x:c.cost_usd,z=Ks(F,$);return e.jsxs("li",{className:"py-2.5",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 break-words text-oai-black dark:text-white",children:c.model||s("sessions.model.unknown")}),e.jsx("span",{className:"text-right tabular-nums",children:N(c.total_tokens)}),e.jsx("span",{className:"text-right tabular-nums",children:R&&!z?"—":k(F)})]}),c.pricing?e.jsxs("details",{className:"group text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsxs("summary",{className:"flex min-h-10 cursor-pointer list-none items-center gap-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 sm:min-h-0 sm:pt-1 [&::-webkit-details-marker]:hidden",children:[e.jsx(ae,{performance:c.performance,className:"tabular-nums"}),e.jsx("span",{className:"underline decoration-dotted underline-offset-4 group-open:no-underline",children:s("sessions.detail.pricing_details")})]}),e.jsxs("div",{className:"space-y-1 pt-1.5 leading-5",children:[R?e.jsx("p",{children:s("sessions.detail.pricing_unpriced")}):null,c.pricing.status==="free"?e.jsx("p",{children:s("sessions.detail.pricing_free")}):null,c.pricing.status==="priced"?e.jsx("p",{children:s("sessions.detail.pricing_rates",{input:c.pricing.input,output:c.pricing.output,cacheRead:c.pricing.cache_read,cacheWrite:c.pricing.cache_write})}):null,Se(c.pricing.source)?e.jsx("p",{children:Se(c.pricing.source)}):null]})]}):e.jsx(ae,{performance:c.performance,className:"block pt-1 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400"})]},c.model)})})]}),e.jsxs("details",{className:"mt-5 border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:s("sessions.detail.signals")}),e.jsx("dl",{className:"grid grid-cols-1 gap-x-8 gap-y-1.5 pb-4 sm:grid-cols-2",children:zs.map(({key:c,label:R,grokOnly:$})=>e.jsx(Ce,{label:R(),children:typeof a[c]=="number"&&(!$||D)?N(a[c]):s("sessions.detail.not_recorded")},c))}),D&&a.usage_precision?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.grok.runtime_breakdown",{calls:N(a.model_calls),seconds:(Number(a.api_duration_ms||0)/1e3).toFixed(1),tools:N(a.tool_calls),errors:N(a.error_count)})}):null,C?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.grok.context_breakdown",{used:N(a.context_tokens_used),window:N(a.context_window_tokens),percent:Number(a.context_usage_percent||0).toFixed(0)})}):null]}),e.jsxs("details",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:s("sessions.detail.identifiers")}),e.jsxs("dl",{className:"space-y-3 pb-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.session_id")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.session_id||a.session_hash})]}),a.project_ref?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.local_path")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.project_ref})]}):null,a.resume_command?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.detail.resume_command")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.resume_command})]}):null]})]}),e.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-oai-gray-200 pt-4 text-xs leading-5 text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[L?e.jsx("p",{children:s("sessions.performance.method")}):null,M?e.jsx("p",{children:s("sessions.detail.reasoning_note")}):null,e.jsx("p",{children:s("sessions.privacy")})]})]})]})})}const Me=_s(),Te=[],be=100,Ws=[{id:"all",label:()=>s("usage.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"opencode",label:()=>"OpenCode"},{id:"grok",label:()=>"Grok"},{id:"zcode",label:()=>"ZCode"},{id:"kimi",label:()=>s("leaderboard.column.kimi")}],Ue=[{id:"all",days:0,label:()=>s("sessions.filter.range_label_all")},{id:"7d",days:7,label:()=>s("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>s("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>s("sessions.filter.range_90d")}];function De(a){const t=Ue.find(o=>o.id===a)?.days||0;if(!t)return 0;const r=new Date;return r.setDate(r.getDate()-(t-1)),r.setHours(0,0,0,0),r.getTime()}function Hs(a,t){if(!t)return!0;const r=Date.parse(a.ended_at||a.started_at||"");return Number.isFinite(r)?r>=t:!0}function Vs(a){const t=Date.parse(a.started_at||"");return!Number.isFinite(t)||de({started_at:a.started_at})===de(a)}function Le(a){const t=B(a);return t.length===1?t[0].model||s("sessions.model.unknown"):t.map(r=>`${r.model} ${N(Number(r.total_tokens||0))}`).join(" · ")}async function Fe(a){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(a),!0;const t=document.createElement("textarea");t.value=a,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}function Bs(){const[a,t]=i.useState(!1),r=i.useId();return e.jsxs(ws,{open:a,onOpenChange:t,children:[e.jsx(Ns,{delay:150,closeDelay:100,closeOnClick:!1,onClick:()=>t(!0),"aria-label":s("sessions.summary.scope_help"),"aria-describedby":a?r:void 0,className:"sessions-summary-help relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white before:absolute before:-inset-2 before:content-['']",children:e.jsx(vs,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(Ss,{children:e.jsx(Cs,{side:"bottom",align:"end",sideOffset:12,className:"z-[60]",children:e.jsx(Ms,{id:r,role:"tooltip",className:"max-w-xs rounded-lg border border-oai-gray-200 bg-white p-4 text-sm leading-6 text-oai-gray-700 outline-none dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:s("sessions.summary.scope")})})})]})}const Ie=ye.memo(function({session:t,locale:r,nested:o=!1,timeOnly:u=!1,childCount:p=0,expanded:n=!1,onToggle:f,onDetail:k}){const{currency:j,rate:v}=je(),w=String(t.source||"").toUpperCase(),x=Ge(t.duration_ms),g=t.resume_command,b=t.project_key||s("sessions.project.unknown"),y=o||t.thread_kind==="subagent",L=y?t.agent_nickname||t.agent_role||t.title||b:t.title||b,S=t.usage_is_incomplete?s("sessions.badge.partial_usage"):t.cost_is_partial?s("sessions.badge.partial_cost"):null,P=t.project_ref?`${t.project_ref}
|
|
3
3
|
${s("sessions.project.copy_hint")}`:void 0,M=async()=>{if(t.project_ref)try{await Fe(t.project_ref)?Y({title:s("sessions.project.copied")}):Y({title:s("sessions.project.copy_failed")})}catch{Y({title:s("sessions.project.copy_failed")})}},D=O=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(ys,{text:P,placement:"bottom"}),e.jsx("button",{type:"button",onClick:M,"aria-label":s("sessions.project.copy_aria",{project:b}),className:Q("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",O),children:b})]}),C=async()=>{if(g)try{await Fe(g)?Y({title:s("sessions.resume.copied")}):Y({title:s("sessions.resume.copy_failed")})}catch{Y({title:s("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:Q("sessions-row sessions-row-grid py-3",o&&"sessions-row-nested"),children:[e.jsxs("div",{className:"sessions-row-identity min-w-0",children:[e.jsx("span",{className:"sessions-row-provider inline-flex items-center justify-center text-oai-gray-600 dark:text-oai-gray-300","aria-hidden":"true",children:e.jsx(Pe,{provider:w,size:o?16:18})}),e.jsxs("div",{className:"contents",children:[e.jsx("button",{type:"button",onClick:()=>k(t),"aria-label":s("sessions.detail.open_aria",{title:L}),title:L,className:"sessions-row-title block min-h-9 min-w-0 max-w-full truncate rounded text-left text-sm font-medium text-oai-black underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white md:min-h-5",children:L}),e.jsxs("div",{className:"sessions-row-meta flex min-w-0 flex-wrap items-center gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full",children:t.project_ref?D("min-h-6 inline-flex items-center md:min-h-0"):e.jsx("span",{className:"truncate",children:b})}),e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full truncate",title:Le(t),children:Le(t)}),e.jsx("span",{className:"sessions-meta-item tabular-nums",children:ze(t.started_at,r,{timeOnly:u&&Vs(t)})}),x?e.jsx("span",{className:"sessions-meta-item tabular-nums",children:x}):null,Number.isFinite(t.session_store_bytes)?e.jsx("span",{className:"sessions-meta-item tabular-nums",title:s("sessions.storage.tooltip",{metric:s(t.session_store_metric==="allocated"?"sessions.storage.allocated":"sessions.storage.logical"),ratio:Math.round(t.bytes_per_1k_tokens||0).toLocaleString(r)}),children:s("sessions.storage.label",{size:s("sessions.storage.size",{value:(t.session_store_bytes/1024/1024).toLocaleString(r,{maximumFractionDigits:2})})})}):null,y?e.jsxs("span",{className:"sessions-meta-item",children:[s("sessions.badge.subagent"),t.agent_role?` · ${t.agent_role}`:""]}):null,t.first_pass?e.jsx("span",{className:"sessions-meta-item text-emerald-700 dark:text-emerald-300",children:s("sessions.badge.first_pass")}):null,S?e.jsx("span",{className:"sessions-meta-item text-amber-700 dark:text-amber-300",children:S}):null,t.cost_source==="provider_reported"?e.jsx("span",{className:"sessions-meta-item",children:s("sessions.badge.reported_cost")}):null,p?e.jsxs("button",{type:"button",onClick:()=>f(t.session_hash),"aria-expanded":n,className:"-mx-1.5 inline-flex min-h-8 items-center md:-my-1 md:ml-2 md:mr-0 gap-0.5 rounded px-1.5 font-medium text-oai-gray-700 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white md:min-h-6",children:[e.jsx(cs,{className:Q("h-3.5 w-3.5 transition-transform",n&&"rotate-90"),"aria-hidden":!0}),n?s("sessions.thread.collapse",{count:p}):s("sessions.thread.expand",{count:p})]}):null]})]})]}),e.jsxs("dl",{className:"sessions-row-metrics",children:[e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.tokens")}),e.jsxs("dd",{title:Number(t.subagent_total_tokens)?s("sessions.thread.tokens_summary",{own:N(t.own_total_tokens),subagents:N(t.subagent_total_tokens),combined:N(t.combined_total_tokens)}):void 0,className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",children:[N(t.total_tokens),Number(t.subagent_total_tokens)?e.jsxs("span",{className:"mt-0.5 block text-xs text-oai-gray-500 dark:text-oai-gray-400",children:["Σ ",N(t.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",title:t.cost_is_partial?s("sessions.cost.partial_title"):void 0,children:[t.cost_is_partial?"≥":"",ke(t.cost_usd,{currency:j,rate:v})]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:s("sessions.col.speed")}),e.jsx("dd",{className:"mt-1 min-h-5 text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 md:mt-0",children:e.jsx(ae,{performance:t.performance})})]})]}),e.jsx("button",{type:"button",onClick:C,disabled:!g,title:g||s("sessions.resume.unavailable"),"aria-label":g?s("sessions.resume.copy_aria",{command:g}):s("sessions.resume.unavailable"),className:"sessions-row-action inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:cursor-not-allowed dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white md:h-8 md:w-8",children:e.jsx(ks,{className:"h-4 w-4","aria-hidden":!0})})]})});function Qs({sessions:a,selectedModel:t,onSelect:r}){const{groups:o,totalTokens:u}=i.useMemo(()=>{const n=new Map;let f=0;for(const k of a)for(const j of B(k)){const v=j.model||s("sessions.model.unknown"),w=Number(j.total_tokens||0),x=n.get(v)||{model:v,count:0,tokens:0};x.count+=1,x.tokens+=w,f+=w,n.set(v,x)}return{groups:[...n.values()].sort((k,j)=>j.tokens-k.tokens),totalTokens:f}},[a]);function p(n){return Q("min-h-10 rounded-md border px-2.5 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 md:min-h-7",n?"border-oai-brand-500 bg-oai-brand-50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-300":"border-oai-gray-200 text-oai-gray-600 hover:bg-oai-gray-100 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800")}return e.jsx("li",{className:"sessions-thread-models py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"mr-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":t==="all",onClick:()=>r("all"),className:p(t==="all"),children:s("sessions.thread.model_all",{count:a.length,tokens:N(u)})}),o.map(n=>e.jsx("button",{type:"button","aria-pressed":t===n.model,onClick:()=>r(n.model),className:p(t===n.model),children:s("sessions.thread.model_item",{model:n.model,count:n.count,tokens:N(n.tokens)})},n.model))]})})}function ft(){const[a]=i.useState(()=>Ps(window.location.search)),[t,r]=i.useState(null),[o,u]=i.useState(null),[p,n]=i.useState(!0),[f,k]=i.useState(!1),[j,v]=i.useState(a.source),[w,x]=i.useState(a.model),[g,b]=i.useState(a.from||a.to?"custom":"all"),[y,L]=i.useState(a.from),[S,P]=i.useState(a.to),[M,D]=i.useState("all"),[C,O]=i.useState("time"),[A,J]=i.useState("recent"),[h,T]=i.useState(null),[I,c]=i.useState(""),[R,$]=i.useState(be),[F,z]=i.useState(()=>new Set),[ee,se]=i.useState(()=>new Map),re=i.useRef(0),{resolvedLocale:H}=Re(),{currency:We,rate:He}=je(),oe=i.useCallback(async(l=!1)=>{const m=++re.current;l?k(!0):n(!0),u(null);try{const d=await Is({refresh:l});m===re.current&&r(d)}catch(d){m===re.current&&u(d?.message||String(d))}finally{m===re.current&&(n(!1),k(!1))}},[]);i.useEffect(()=>{Me||we()?oe(!1):n(!1)},[oe]);const G=t?.sessions||Te,Ve=i.useMemo(()=>{const l=new Set,m=[];for(const d of G){const _=d.project_key;!_||l.has(_)||(l.add(_),m.push({value:_,label:_}))}return m.sort((d,_)=>d.label.localeCompare(_.label))},[G]),Be=i.useMemo(()=>{const l=new Set;for(const m of G)for(const d of B(m))d.model&&l.add(d.model);return[...l].sort().map(m=>({value:m,label:m}))},[G]),ue=i.useDeferredValue(I),ne=i.useMemo(()=>{let m=De(g),d=1/0;return g==="custom"&&(m=y?new Date(`${y}T00:00:00`).getTime():0,d=S?new Date(`${S}T23:59:59.999`).getTime():1/0,m>d&&(m=new Date(`${S}T00:00:00`).getTime(),d=new Date(`${y}T23:59:59.999`).getTime())),Os(G,m,d)},[G,g,y,S]),K=i.useMemo(()=>{const l=ue.trim().toLowerCase(),m=De(g);return ne.filter(d=>{if(j!=="all"&&d.source!==j||M!=="all"&&d.project_key!==M||w!=="all"&&!B(d).some(U=>U.model===w))return!1;if(g==="custom"){if(!As(d,y,S))return!1}else if(!Hs(d,m))return!1;if(!l)return!0;const _=B(d).map(U=>U.model).join(" ");return`${d.title||""} ${d.project_key||""} ${_} ${d.agent_nickname||""} ${d.agent_role||""} ${d.project_ref||""} ${d.session_id||""}`.toLowerCase().includes(l)})},[ne,j,M,w,g,y,S,ue]),X=i.useMemo(()=>Ke(K),[K]),V=i.useMemo(()=>{const l=new Set(K.map(_=>_.session_hash)),m=new Map,d=[];for(const _ of Es(K,A)){const q=_.root_session_hash||_.parent_session_hash;if(_.parent_session_hash&&q&&l.has(q)){const U=m.get(q)||[];U.push(_),m.set(q,U)}else d.push(_)}return{roots:d,childrenByRoot:m,foldedCount:K.length-d.length}},[K,A]),me=j!=="all"||w!=="all"||g!=="all"||M!=="all"||I.trim()!=="";i.useEffect(()=>{$(be),z(new Set),se(new Map)},[j,M,w,g,y,S,ue,A,C,G]);const xe=i.useMemo(()=>V.roots.slice(0,R),[V.roots,R]),Qe=i.useMemo(()=>$s(xe,C),[xe,C]),Ze=i.useMemo(()=>h?ne.filter(l=>l.session_hash!==h.session_hash&&(l.root_session_hash===h.session_hash||l.parent_session_hash===h.session_hash)):Te,[ne,h]),Xe=i.useCallback(()=>T(null),[]),ge=i.useCallback(l=>{b(l),l!=="custom"&&(L(""),P(""))},[]),Ye=i.useCallback(()=>{v("all"),x("all"),D("all"),c(""),ge("all")},[ge]),he=V.roots.length>xe.length,pe=i.useCallback(()=>$(l=>l+be),[]),Je=i.useCallback(l=>{z(m=>{const d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d})},[]),es=i.useCallback((l,m)=>{se(d=>{const _=new Map(d);return m==="all"?_.delete(l):_.set(l,m),_})},[]),ve=i.useRef(null);i.useEffect(()=>{if(!he||typeof IntersectionObserver>"u")return;const l=ve.current;if(!l)return;const m=new IntersectionObserver(d=>{d.some(_=>_.isIntersecting)&&pe()},{rootMargin:"400px"});return m.observe(l),()=>m.disconnect()},[he,pe]);const ss=i.useMemo(()=>Ws.map(l=>({value:l.id,label:l.label()})),[H]),ts=i.useMemo(()=>[...Ue.map(l=>({value:l.id,label:l.label()})),{value:"custom",label:s("sessions.filter.range_custom")}],[H]),as=i.useMemo(()=>[{value:"time",label:s("sessions.group.time")},{value:"project",label:s("sessions.group.project")}],[H]),rs=i.useMemo(()=>[{value:"recent",label:s("sessions.sort.recent")},{value:"cost",label:s("sessions.sort.cost")},{value:"tokens",label:s("sessions.sort.tokens")}],[H]),os=Number(t?.session_count)>Number(t?.returned_count);return!Me&&!we()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(ds,{})}):e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:s("sessions.page.summary")})]}),e.jsx("button",{type:"button",onClick:()=>{oe(!0)},disabled:f||p,"aria-label":s("sessions.page.refresh"),title:s("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(ls,{className:Q("h-4 w-4",f&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-6 space-y-3",children:[e.jsxs("div",{className:"sessions-toolbar",children:[e.jsxs("div",{className:"sessions-toolbar-search relative",children:[e.jsx($e,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),e.jsx(us,{type:"search",value:I,onChange:l=>c(l.target.value),onKeyDown:l=>{l.key==="Escape"&&I&&(l.preventDefault(),c(""))},"aria-label":s("sessions.action.search_aria"),placeholder:s("sessions.search.placeholder"),className:"h-11 pl-10 pr-12 text-sm !bg-white dark:!bg-oai-gray-900 !border-oai-gray-200 placeholder:!text-oai-gray-500 dark:!border-oai-gray-800 dark:placeholder:!text-oai-gray-400 sm:h-9 [&::-webkit-search-cancel-button]:appearance-none"}),I?e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>c(""),"aria-label":s("sessions.action.search_clear"),className:"absolute right-0 top-0 flex h-11 w-11 items-center justify-center rounded-md text-oai-gray-600 hover:bg-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 sm:h-9 sm:w-9",children:e.jsx(Ee,{className:"h-4 w-4","aria-hidden":!0})}):null]}),e.jsx(ie,{ariaLabel:s("sessions.filter.source_aria"),options:ss,value:j,onValueChange:v,className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(ie,{ariaLabel:s("sessions.filter.range_aria"),options:ts,value:g,onValueChange:ge,leadingIcon:e.jsx(Ts,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(Ne,{options:Ve,value:M,onChange:D,allLabel:s("sessions.filter.project_all"),searchPlaceholder:s("sessions.filter.project_search"),emptyLabel:s("sessions.filter.project_empty"),ariaLabel:s("sessions.filter.project_aria"),className:"sessions-filter-trigger !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"}),e.jsx(Ne,{options:Be,value:w,onChange:x,allLabel:s("sessions.filter.model_all"),searchPlaceholder:s("sessions.filter.model_search"),emptyLabel:s("sessions.filter.model_empty"),ariaLabel:s("sessions.filter.model_aria"),className:"sessions-filter-trigger sessions-model-filter !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"})]}),g==="custom"?e.jsxs("div",{className:"grid max-w-lg grid-cols-2 gap-3",children:[e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:s("sessions.filter.from")}),e.jsx("input",{type:"date","aria-label":s("sessions.filter.from"),value:y,onChange:l=>L(l.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]}),e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:s("sessions.filter.to")}),e.jsx("input",{type:"date","aria-label":s("sessions.filter.to"),value:S,onChange:l=>P(l.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]})]}):null]}),!p&&t?e.jsx("section",{className:"mb-6 flex items-start gap-3 rounded-lg border border-oai-gray-200 px-4 py-3 dark:border-oai-gray-800",children:e.jsxs("dl",{className:"sessions-kpis grid min-w-0 flex-1 grid-cols-2 gap-y-3 sm:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.summary.count")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:N(X.count)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.col.tokens")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:N(X.tokens)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[X.costIsPartial?"≥":"",ke(X.cost,{currency:We,rate:He})]})]}),e.jsxs("div",{children:[e.jsxs("dt",{className:"flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:s("sessions.summary.speed")}),e.jsx(Bs,{})]}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[e.jsx(ae,{performance:X.performance}),X.performance.estimated_tokens_per_second==null?"—":null]})]})]})}):null,e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:V.foldedCount>0?s("sessions.thread.result_count",{roots:V.roots.length,subagents:V.foldedCount}):s("sessions.filter.result_count",{filtered:K.length,total:G.length})}),me?e.jsx("button",{type:"button",onClick:Ye,className:"inline-flex min-h-10 items-center rounded text-oai-gray-700 underline decoration-oai-gray-300 underline-offset-4 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:decoration-oai-gray-600 dark:hover:text-white sm:min-h-0",children:s("sessions.filter.clear")}):null]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ie,{ariaLabel:s("sessions.group.aria"),options:as,value:C,onValueChange:O,className:"sessions-filter-trigger h-11 min-w-0 max-w-40 px-2.5 text-xs sm:h-8"}),e.jsx(ie,{ariaLabel:s("sessions.sort.aria"),options:rs,value:A,onValueChange:J,className:"sessions-filter-trigger h-11 min-w-0 max-w-44 px-2.5 text-xs sm:h-8",align:"end"})]})]}),os?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("sessions.truncated",{shown:t.returned_count,total:t.session_count})}):null,o&&!t?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:s("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o}),e.jsx("button",{type:"button",onClick:()=>{oe(!1)},className:"mt-4 inline-flex h-11 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:s("sessions.error.retry")})]}):p?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(js,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),s("sessions.loading")]}):K.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:me?s("sessions.empty.filtered_title"):s("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:me?s("sessions.empty.filtered_body"):s("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[o?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:o})}):null,e.jsxs("div",{className:"sessions-row-grid sessions-list-header border-b border-oai-gray-200 py-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400","aria-hidden":!0,children:[e.jsx("span",{children:s("sessions.col.session")}),e.jsx("span",{className:"text-right",children:s("sessions.col.tokens")}),e.jsx("span",{className:"text-right",children:s("sessions.col.cost")}),e.jsx("span",{className:"text-right",children:s("sessions.col.speed")}),e.jsx("span",{className:"sr-only",children:s("sessions.col.actions")})]}),e.jsx("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:Qe.map(l=>e.jsxs(ye.Fragment,{children:[e.jsx("li",{className:"pb-2 pt-5",children:e.jsx("h2",{className:"break-words text-xs font-medium text-oai-gray-900 dark:text-oai-gray-100",children:C==="project"?l.key||s("sessions.project.unknown"):l.key?new Date(`${l.key}T12:00:00`).toLocaleDateString(H||void 0,{year:"numeric",month:"short",day:"numeric"}):s("sessions.group.unknown_date")})}),l.sessions.map(m=>{const d=V.childrenByRoot.get(m.session_hash)||[],_=F.has(m.session_hash),q=ee.get(m.session_hash)||"all",U=q==="all"?d:d.filter(function(ns){return B(ns).some(is=>is.model===q)});return e.jsxs(ye.Fragment,{children:[e.jsx(Ie,{session:m,locale:H,timeOnly:C==="time",childCount:d.length,expanded:_,onToggle:Je,onDetail:T}),_&&d.length?e.jsx(Qs,{sessions:d,selectedModel:q,onSelect:te=>es(m.session_hash,te)}):null,_?U.map(te=>e.jsx(Ie,{session:te,locale:H,nested:!0,timeOnly:C==="time",onDetail:T},te.session_hash)):null]},m.session_hash)})]},l.key))}),he?e.jsx("div",{ref:ve,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:pe,className:"inline-flex h-11 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:s("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-8 max-w-3xl text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:s("sessions.privacy")})]})}),h?e.jsx(Us,{session:h,subagents:Ze,onClose:Xe}):null]})}export{ft as SessionsPage};
|