tokentracker-cli 0.96.0 → 0.96.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh-CN.md +1 -1
- package/dashboard/dist/assets/{AchievementBadge-Bb2ljquW.js → AchievementBadge-DKyElm0T.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-ByUP2x8a.js → AchievementsPage-BvCx3wND.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-_L6sCLTw.js → AchievementsSection-DN69LzXX.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-B9n_-45B.js → BadgeDetailModal-DGiKdZfz.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-lWmg-aZg.js → BotAnimated-zN8rH7_K.js} +1 -1
- package/dashboard/dist/assets/{Card-aSp259T0.js → Card-COWo-ClV.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-Cy-XaTXW.js → ClawdAnimated-BWsB7Eat.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-CNwtKCUm.js → CommandPalette-BfvIwuoJ.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-DJSezaPV.js → CommunityStatsModal-BQWg7R_y.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-CVjmhZd6.js → ConfirmModal-C7ABSI-O.js} +1 -1
- package/dashboard/dist/assets/{Controls-BIj6yVxE.js → Controls-vMzEZzej.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-QBhbCMZF.js +1 -0
- package/dashboard/dist/assets/{DevicePage-ptsI2fZc.js → DevicePage-3ejUBLWM.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-D1pLoZ56.js → DialogClose-D_dvtfGV.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-ryGYdQjX.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DfSBUjWf.js → DialogTitle-_ahf0z8b.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-DBn4L_BV.js → FadeIn-D7Jcfz1N.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-EJLBwEqp.js → HeaderGithubStar-D--Rx5BS.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-DaSrZhYd.js → HoverTooltip-n1W0z3Wr.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-diQTVaYt.js → IpCheckPage-D202tl9B.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BqCxjwar.js → LandingPage-D6yL2EZo.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-CQImCsPN.js → LeaderboardAvatar-ChFg2mtA.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-D2ZDUi_O.js → LeaderboardPage-BXHwGs8r.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-DHvADX1d.js → LeaderboardProfileModal-B5LoOpCk.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CJsedB28.js → LeaderboardProfilePage-jsukhRz8.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CAwff24b.js → LimitsPage-PvqkOOwp.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-Cmnvu9tI.js → LocalOnlyNotice-Du0lz657.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-BQmKkD7X.js → LoginCard-BFEX9x7-.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-2oPROePZ.js → LoginModal-DqC7_d35.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-aqdUJoQK.js → LoginPage-Dzx8N7HE.js} +1 -1
- package/dashboard/dist/assets/{PetPage-Bn3p_o5r.js → PetPage-CNlWHF4z.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-DXD_YdiB.js → PopoverPopup-D9jadD3j.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-BZZ45-gY.js → ProviderIcon-Caz5PuAm.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-Bn5ITiHQ.js → ResetPasswordPage-x_GR79sR.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-hGXboQZy.js → SegmentedControl-BxDiDV4R.js} +1 -1
- package/dashboard/dist/assets/{Select-BP8aVRZ1.js → Select-B5o-1sEl.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-Odx47kND.js → SelectItemText-CiA6L7Wk.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-DUueam0N.js → ServiceStatusPage-BVQuVdjg.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BA9IFqQ1.js → SessionsPage-DE39wNIO.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-DJrb_fsK.js +2 -0
- package/dashboard/dist/assets/{SkillsPage-Ds2vH_PG.js → SkillsPage-COk-YQQ5.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-CWBR4jnB.js → TokenGalaxy-BPM779Wb.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-Bmg56vYz.js → ToolbarRootContext-CozJT6Vs.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-BQzcllvg.js → TrendMonitor-BkNy-o1D.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-Bu3tHDjO.js → WidgetsPage-Bpg6H-ZB.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BrAMJhgy.js → WrappedPage-C6-NM-RO.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-BGnq8Ebm.js +45 -0
- package/dashboard/dist/assets/__vite-browser-external-CvMMIjhi.css +1 -0
- package/dashboard/dist/assets/{agent-logos-B8lT-HcI.js → agent-logos-DpbkRqXT.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-rpBCOTg2.js → arrow-up-right-BjOtWUVs.js} +1 -1
- package/dashboard/dist/assets/{check-DIKw7TYH.js → check-BlxnX5jZ.js} +1 -1
- package/dashboard/dist/assets/{composite-_NeXO0lv.js → composite-Dxmivlk4.js} +1 -1
- package/dashboard/dist/assets/{copy-CsfAtL7P.js → copy-CIsWjLY5.js} +1 -1
- package/dashboard/dist/assets/{download-DM1W9pIW.js → download-QDaQbQdd.js} +1 -1
- package/dashboard/dist/assets/{external-link-CwbuMbeQ.js → external-link-DPV4VU3m.js} +1 -1
- package/dashboard/dist/assets/{flame-DcYbLdhE.js → flame-B_X-7VNp.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-CEvr3dNy.js → format-tokens-DEx2TJj8.js} +1 -1
- package/dashboard/dist/assets/{icons-DaGMVsJ5.js → icons-983RyGSl.js} +1 -1
- package/dashboard/dist/assets/{index-BVVLPj3N.js → index-BONYA8HZ.js} +1 -1
- package/dashboard/dist/assets/{index-ChZkJjpk.js → index-Cjs5stC0.js} +1 -1
- package/dashboard/dist/assets/{index-T7OjmEuX.js → index-qtonw_x4.js} +1 -1
- package/dashboard/dist/assets/{info-CAjN3dX4.js → info-DpVOhXZI.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-jn7Yln_V.js → limits-providers-BUoquSA-.js} +1 -1
- package/dashboard/dist/assets/{link-2-DaWH2Tyc.js → link-2-CBro-upz.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-CnF8qPi1.js → loader-circle-wYFdSyOd.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-B-2Pnj6g.js → maximize-2-DhTyQ4ly.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-BoDOvUKl.js → modifiers.esm-CPljwVhN.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-DDgwxG_E.js → monitor-smartphone-D_wr-HOR.js} +1 -1
- package/dashboard/dist/assets/{plus-DIc1YUWB.js → plus-BNjfkBEF.js} +1 -1
- package/dashboard/dist/assets/{provider-display-yeNsVCO_.js → provider-display-BOBtUyFi.js} +1 -1
- package/dashboard/dist/assets/{react-DZqS6YTX.js → react-yHv9MTUA.js} +1 -1
- package/dashboard/dist/assets/{search-D6tEppYJ.js → search-Dfak92ZA.js} +1 -1
- package/dashboard/dist/assets/{skills-api-vsA1rc1Z.js → skills-api-By2PdNa1.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-DDCnS1HI.js → sortable.esm-B9xy66_v.js} +1 -1
- package/dashboard/dist/assets/{store-Crne4DqF.js → store-oQZR4d9M.js} +1 -1
- package/dashboard/dist/assets/{terminal-Ca7dkLMF.js → terminal-pbXWBmZM.js} +1 -1
- package/dashboard/dist/assets/{trash-2-CjEAS5ic.js → trash-2-CboDPwbW.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-BHx2YxyK.js → use-community-stats-D6HTdnHq.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-BLGbXQdf.js → use-latest-request-guard-hwSr9Cam.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-DBkAp6ob.js → use-limits-display-prefs-B-pbwUS8.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-BTfW5M9u.js → use-ordered-list-OtfOqrNb.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DGXcZBX3.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-DBmd-MqH.js → use-session-efficiency-pref-BScvtS8F.js} +1 -1
- package/dashboard/dist/assets/{use-transform-Bp5XrwaQ.js → use-transform-Cy1ykjEs.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BmqRcyhH.js → use-usage-limits-CSMb2zYW.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B0YsRDj-.js → useCurrency-VqF3cy1C.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-PP3D0Ket.js → useTokenFormat-Cgub4MXu.js} +1 -1
- package/dashboard/dist/assets/{zap-BVOm1aBH.js → zap-DStzvQJI.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/ip-check.html +2 -2
- package/dashboard/dist/leaderboard.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/commands/status.js +4 -4
- package/src/commands/sync.js +5 -3
- package/src/lib/ark-agent-plan-limits.js +4 -3
- package/src/lib/ark-coding-plan-limits.js +6 -8
- package/src/lib/command-runner.js +13 -0
- package/src/lib/local-api.js +3 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +17 -5
- package/src/lib/usage-limits.js +111 -13
- package/dashboard/dist/assets/DashboardPage-BjYZLmqQ.js +0 -1
- package/dashboard/dist/assets/DialogDescription-KY7X94CG.js +0 -1
- package/dashboard/dist/assets/SettingsPage-DLOHHB4f.js +0 -2
- package/dashboard/dist/assets/__vite-browser-external-4IGm4Djn.js +0 -45
- package/dashboard/dist/assets/__vite-browser-external-CCMdjCX2.css +0 -1
- package/dashboard/dist/assets/use-reduced-motion-D_kUnDs4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bU as xn,aI as $e,aF as Z,be as Yt,bX as $t,bV as Rn,r as o,bd as Q,by as Mt,ch as Ht,ci as Et,cj as kt,b_ as Ct,bf as tt,aE as De,A as Ie,ck as Ut,bx as Bt,cl as st,aD as bn,bo as Gt,c0 as Xt,cm as ht,cn as xt,co as Jt,cp as Ot,bc as ft,c5 as yn,cq as In,cr as wt,ay as Rt,aJ as xe,Z as Qt,j as be,V as A,aA as Vt,aL as Pt,aK as Sn,aO as En,aP as Cn,aQ as gt,aG as Tn,b$ as vn,aN as dt,bR as Mn,y as Zt,z as Xe,cs as wn,aB as Pn,ct as An,aC as On,bh as Vn,cu as Fn,az as en,cv as Tt}from"./__vite-browser-external-4IGm4Djn.js";import{q as tn,F as Ln,P as Dn,v as ke,o as Nn,E as Hn,G as we,H as nn,D as kn,u as Un,m as rn,e as Bn,d as _n,z as Wn,I as jn,b as zn,a as Kn,C as qn}from"./composite-_NeXO0lv.js";import{h as Yn,u as $n,a as Gn,d as Xn,c as Jn,e as Qn,f as Zn,i as er,p as tr,r as nr,g as rr}from"./ToolbarRootContext-Bmg56vYz.js";function Ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function or(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,c=xn(),i=tn()!=null,s=$e(()=>new Ln({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Dn,floatingId:c,syncOnly:!1,nested:i})).current;return Z(()=>{const a={open:t,floatingId:c};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Yt(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),s.update(a)},[t,c,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}const sr="Escape";function _t(e){return Xt&&e.movementX===0&&e.movementY===0}function bt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function it(e,t){return bt(t,e===Jt||e===Ot,e===ht||e===xt)}function vt(e,t,n){return bt(t,e===Ot,n?e===ht:e===xt)||e==="Enter"||e===" "||e===""}function ir(e,t,n){return bt(t,n?e===ht:e===xt,e===Ot)}function lr(e,t,n,r){const c=n?e===xt:e===ht,i=e===Jt;return t==="both"||t==="horizontal"&&r?e===sr:bt(t,c,i)}function cr(e,t){const{listRef:n,activeIndex:r,onNavigate:c=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:a=!1,loopFocus:d=!1,nested:m=!1,rtl:C=!1,virtual:p=!1,focusItemOnOpen:g="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:T=!0,disabledIndices:U=void 0,orientation:u="vertical",parentOrientation:z,id:K,resetOnPointerLeave:V=!0,externalTree:b,grid:I}=t,j=I!=null,h="rootStore"in e?e.rootStore:e,y=h.useState("open"),O=h.useState("floatingElement"),X=h.useState("domReferenceElement"),ee=h.context.dataRef,me=$t(O),te=Rn(X),w=ke(me),N=tn(),ne=Nn(b),B=o.useRef(g),P=o.useRef(s??-1),q=o.useRef(null),F=o.useRef(!0),l=Q(f=>{c(P.current===-1?null:P.current,f)}),v=o.useRef(!!O),ce=o.useRef(y),_=o.useRef(!1),ue=o.useRef(!1),E=o.useRef(null),L=ke(U),Y=ke(y),ie=ke(s),ye=ke(V),H=Mt(),re=Mt(),J=Q(()=>{function f(k){p?ne?.events.emit("virtualfocus",k):E.current=Hn(k,{sync:_.current,preventScroll:!0})}const R=n.current[P.current],$=ue.current;R&&f(R),(_.current?k=>k():k=>H.request(k))(()=>{const k=n.current[P.current]||R;if(!k)return;R||f(k),he&&($||!F.current)&&k.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Z(()=>{ee.current.orientation=u},[ee,u]),Z(()=>{i&&(y&&O?(P.current=s??-1,B.current&&s!=null&&(ue.current=!0,l())):v.current&&(P.current=-1,l()))},[i,y,O,s,l]),Z(()=>{if(i){if(!y){_.current=!1;return}if(O)if(r==null){if(_.current=!1,ie.current!=null)return;if(v.current&&(P.current=-1,J()),(!ce.current||!v.current)&&B.current&&(q.current!=null||B.current===!0&&q.current==null)){let f=0;const R=()=>{n.current[0]==null?(f<2&&(f?x=>re.request(x):queueMicrotask)(R),f+=1):(P.current=q.current==null||vt(q.current,u,C)||m?Et(n):kt(n),q.current=null,l())};R()}}else Ht(n.current,r)||(P.current=r,J(),ue.current=!1)}},[i,y,O,r,ie,m,n,u,C,l,J,re]),Z(()=>{if(!i||O||!ne||p||!v.current)return;const f=ne.nodesRef.current,R=f.find(k=>k.id===N)?.context?.elements.floating,$=Ct(tt(X??R??null)),x=f.some(k=>k.context&&De(k.context.elements.floating,$));R&&!x&&F.current&&R.focus({preventScroll:!0})},[i,O,X,ne,N,p]),Z(()=>{ce.current=y,v.current=!!O}),Z(()=>{y||(q.current=null,B.current=g)},[y,g]);const Re=r!=null,le=Q(f=>{if(!Y.current)return;const R=n.current.indexOf(f.currentTarget);R!==-1&&(P.current!==R||r!==R)&&(P.current=R,l(f))}),ae=Q(()=>z??ne?.nodesRef.current.find(f=>f.id===N)?.context?.dataRef?.current.orientation),ge=Q(()=>Et(n,L.current)),fe=Q(f=>{if(F.current=!1,_.current=!0,f.which===229||!Y.current&&f.currentTarget===w.current)return;if(m&&lr(f.key,u,C,j)){it(f.key,ae())||we(f),h.setOpen(!1,Ie(Ut,f.nativeEvent)),Bt(X)&&(p?ne?.events.emit("virtualfocus",X):X.focus());return}const R=P.current,$=Et(n,U),x=kt(n,U);if(te||(f.key==="Home"&&(we(f),P.current=$,l(f)),f.key==="End"&&(we(f),P.current=x,l(f))),I!=null){const k=I(f,P.current,n,u,d,C,U,$,x);if(k!=null&&(P.current=k,l(f)),u==="both")return}if(it(f.key,u)){if(we(f),y&&!p&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){P.current=vt(f.key,u,C)?$:x,l(f);return}vt(f.key,u,C)?d?R>=x?a&&R!==n.current.length?P.current=-1:(_.current=!1,P.current=$):P.current=st(n.current,{startingIndex:R,disabledIndices:U}):P.current=Math.min(x,st(n.current,{startingIndex:R,disabledIndices:U})):d?R<=$?a&&R!==-1?P.current=n.current.length:(_.current=!1,P.current=x):P.current=st(n.current,{startingIndex:R,decrement:!0,disabledIndices:U}):P.current=Math.max($,st(n.current,{startingIndex:R,decrement:!0,disabledIndices:U})),Ht(n.current,P.current)&&(P.current=-1),l(f)}}),he=o.useMemo(()=>({onFocus(R){_.current=!0,le(R)},onClick:({currentTarget:R})=>R.focus({preventScroll:!0}),onMouseMove(R){_t(R)||(_.current=!0,ue.current=!1,S&&le(R))},onPointerLeave(R){if(!Y.current||!F.current||R.pointerType==="touch")return;_.current=!0;const $=R.relatedTarget;if(!(!S||n.current.includes($))&&ye.current&&(E.current?.(),E.current=null,P.current=-1,l(R),!p)){const x=w.current,k=Ct(tt(x));x&&De(x,k)&&x.focus({preventScroll:!0})}}}),[le,Y,w,S,n,l,ye,p]),G=o.useMemo(()=>p&&y&&Re&&{"aria-activedescendant":`${K}-${r}`},[p,y,Re,K,r]),oe=o.useMemo(()=>({"aria-orientation":u==="both"?void 0:u,...te?{}:G,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&y&&!p){const R=bn(f.nativeEvent);if(R&&!De(w.current,R))return;we(f),h.setOpen(!1,Ie(Gt,f.nativeEvent)),Bt(X)&&X.focus();return}fe(f)},onPointerMove(f){_t(f)||(F.current=!0)}}),[G,fe,w,u,te,h,y,p,X]),pe=o.useMemo(()=>{function f(x){h.setOpen(!0,Ie(Ut,x.nativeEvent,x.currentTarget))}function R(x){g==="auto"&&nn(x.nativeEvent)&&(B.current=!p)}function $(x){B.current=g,g==="auto"&&kn(x.nativeEvent)&&(B.current=!0)}return{onKeyDown(x){const k=h.select("open");F.current=!1;const Ce=x.key.startsWith("Arrow"),de=ir(x.key,ae(),C),Be=it(x.key,u),_e=(m?de:Be)||x.key==="Enter"||x.key.trim()==="";if(p&&k)return fe(x);if(!(!k&&!T&&Ce)){if(_e){const Se=it(x.key,ae());q.current=m&&Se?null:x.key}if(m){de&&(we(x),k?(P.current=ge(),l(x)):f(x));return}Be&&(ie.current!=null&&(P.current=ie.current),we(x),!k&&T?f(x):fe(x),k&&l(x))}},onFocus(x){h.select("open")&&!p&&(P.current=-1,l(x))},onPointerDown:$,onPointerEnter:$,onMouseDown:R,onClick:R}},[fe,g,ge,m,l,h,T,u,ae,C,ie,p]),D=o.useMemo(()=>({...G,...pe}),[G,pe]);return o.useMemo(()=>i?{reference:D,floating:oe,item:he,trigger:pe}:{},[i,D,oe,pe,he])}function ur(e,t){const{listRef:n,elementsRef:r,activeIndex:c,onMatch:i,disabledIndices:s,onTyping:a,enabled:d=!0,resetMs:m=750,selectedIndex:C=null}=t,p="rootStore"in e?e.rootStore:e,g=p.useState("open"),S=ft(),T=o.useRef(""),U=o.useRef(C??c??-1),u=o.useRef(null),z=Q(b=>{function I(w){return r?.current[w]}function j(w){const N=I(w);return N&&!yn(N)||N?.matches(":disabled")?!1:s==null||!In(wt,w,s)}function h(w,N,ne=0){if(w.length===0)return-1;const B=(ne%w.length+w.length)%w.length,P=N.toLowerCase();for(let q=0;q<w.length;q+=1){const F=(B+q)%w.length;if(!(!w[F]?.toLowerCase().startsWith(P)||!j(F)))return F}return-1}const y=n.current;if(T.current.length>0&&b.key===" "&&(we(b),a?.(!0)),T.current.length>0&&T.current[0]!==" "&&h(y,T.current)===-1&&b.key!==" "&&a?.(!1),y==null||b.key.length!==1||b.ctrlKey||b.metaKey||b.altKey)return;g&&b.key!==" "&&(we(b),a?.(!0));const O=T.current==="";O&&(U.current=C??c??-1),y.every((w,N)=>w&&j(N)?w[0]?.toLowerCase()!==w[1]?.toLowerCase():!0)&&T.current===b.key&&(T.current="",U.current=u.current),T.current+=b.key,S.start(m,()=>{T.current="",U.current=u.current,a?.(!1)});const me=((O?C??c??-1:U.current)??0)+1,te=h(y,T.current,me);te!==-1?(i?.(te),u.current=te):b.key!==" "&&(T.current="",a?.(!1))}),K=Q(b=>{const I=b.relatedTarget,j=p.select("domReferenceElement"),h=p.select("floatingElement");De(j,I)||De(h,I)||(S.clear(),T.current="",U.current=u.current,a?.(!1))});Z(()=>{!g&&C!==null||(S.clear(),u.current=null,T.current!==""&&(T.current=""))},[g,C,S]);const V=o.useMemo(()=>({onKeyDown:z,onBlur:K}),[z,K]);return o.useMemo(()=>d?{reference:V,floating:V}:{},[d,V])}function ar(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 fr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function dr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:r="value"}){const{current:c}=o.useRef(e!==void 0),[i,s]=o.useState(t),a=c?e:i,d=o.useCallback(m=>{c||s(m)},[]);return[a,d]}const on=o.createContext(null);function Ue(){const e=o.useContext(on);if(e===null)throw new Error(Rt(60));return e}const pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},gr={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},mr={disabled:!1,...gr},hr={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},xr={invalid:void 0,name:void 0,validityData:{state:pr,errors:[],error:"",value:"",initialValue:null},setValidityData:xe,disabled:void 0,setTouched:xe,setDirty:xe,setFilled:xe,setFocused:xe,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:mr,registerFieldControl:xe,validation:{getValidationProps:(e,t=Qt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:xe,getInputControl:()=>null,commit:async()=>{},change:xe}},Rr=o.createContext(xr);function Ft(e=!0){const t=o.useContext(Rr);if(t.setValidityData===xe&&!e)throw new Error(Rt(28));return t}function br(e,t,n,r,c=!0,i){const{registerFieldControl:s}=Ft(),a=$e(()=>Symbol());Z(()=>{const d=a.current;if(!c){s(d,void 0);return}s(d,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,c,r,t,i,s,a,n]),Z(()=>{const d=a.current;return()=>{s(d,void 0)}},[s,a])}const yr=o.createContext({controlId:void 0,registerControlId:xe,labelId:void 0,setLabelId:xe,messageIds:[],setMessageIds:xe,getDescriptionProps:e=>e});function sn(){return o.useContext(yr)}function ln(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:c,registerControlId:i}=sn(),s=Un(t),a=n?c:void 0,d=$e(()=>Symbol()),m=o.useRef(!1),C=o.useRef(t!=null),p=Q(()=>{!m.current||i===xe||(m.current=!1,i(d.current,void 0))});return Z(()=>{if(i===xe)return;let g;if(n){const S=r?.current;Yt(S)&&S.closest("label")!=null?g=t??null:g=a??s}else if(t!=null)C.current=!0,g=t;else if(C.current)g=s;else{p();return}if(g===void 0){p();return}m.current=!0,i(d.current,g)},[t,r,a,i,n,s,d,p]),o.useEffect(()=>p,[p]),c??s}const Ir=(e,t)=>Object.is(e,t);function Ge(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function pt(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Ge(r,t,n))}function Sr(e,t,n){return e.filter(r=>!Ge(t,r,n))}function At(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function cn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Er(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(cn(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 un(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 At(e)}function Ye(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?At(e.value):At(e)}function an(e,t,n){function r(){return un(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 t[e]??r();if(Array.isArray(t)){const c=t,i=cn(c)?c.flatMap(s=>s.items):c;if(e==null||typeof e!="object"){const s=i.find(a=>a.value===e);return s&&s.label!=null?s.label:r()}if("value"in e){const s=i.find(a=>a&&a.value===e.value);if(s&&s.label!=null)return s.label}}return r()}function Cr(e,t,n){return e.reduce((r,c,i)=>(i>0&&r.push(", "),r.push(be.jsx(o.Fragment,{children:an(c,t,n)},i)),r),[])}const M={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,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:Ye(t,r)!==""},hasNullItemLabel:(e,t)=>t?Er(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(c=>Ge(t,c,n)):Ge(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,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},Tr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:xe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function vr(){return o.useContext(Tr)}function Mr(e,t,n=(r,c)=>r===c){return e.length===t.length&&e.every((r,c)=>n(r,t[c]))}const Pe=1;function fn(e,t){return Math.max(0,e-t)}function wr(e,t){if(t<=0)return 0;const n=Ze(e,0,t),r=n,c=t-n,i=r<=Pe,s=c<=Pe;return i&&s?r<=c?0:t:i?0:s?t:n}function to(e){const{id:t,value:n,defaultValue:r=null,onValueChange:c,open:i,defaultOpen:s=!1,onOpenChange:a,name:d,form:m,autoComplete:C,disabled:p=!1,readOnly:g=!1,required:S=!1,modal:T=!0,actionsRef:U,inputRef:u,onOpenChangeComplete:z,items:K,multiple:V=!1,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j=Ir,highlightItemOnHover:h=!0,children:y}=e,{clearErrors:O}=vr(),{setDirty:X,setTouched:ee,setFocused:me,validityData:te,setFilled:w,name:N,disabled:ne,validation:B,validationMode:P}=Ft(),q=ln({id:t}),F=ne||p,l=N??d,[v,ce]=Wt({controlled:n,default:V?r??wt:r,name:"Select",state:"value"}),[_,ue]=Wt({controlled:i,default:s,name:"Select",state:"open"}),E=o.useRef([]),L=o.useRef([]),Y=o.useRef(null),ie=o.useRef(null),ye=o.useRef(0),H=o.useRef(null),re=o.useRef([]),J=o.useRef(!1),Re=o.useRef(null),le=o.useRef(null),ae=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ge=o.useRef(!1),{mounted:fe,setMounted:he,transitionStatus:G}=rn(_),{openMethod:oe,triggerProps:pe}=Yn(_),D=$e(()=>new Tn({id:q,labelId:void 0,modal:T,multiple:V,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j,value:v,open:_,mounted:fe,transitionStatus:G,items:K,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=A(D,M.activeIndex),R=A(D,M.selectedIndex),$=A(D,M.triggerElement),x=A(D,M.positionerElement),k=ar(oe),Ce=oe??k,de=o.useMemo(()=>V?"":Ye(v,I),[V,v,I]),Be=o.useMemo(()=>V&&Array.isArray(v)?v.map(W=>Ye(W,I)):Ye(v,I),[V,v,I]),_e=ke($),Se=Q(()=>Be);br(_e,q,v,Se,!F,d);const yt=o.useRef(v),Je=V?Array.isArray(v)&&v.length>0:v!=null&&de!=="";Z(()=>{w(Je)},[Je,w]),Z(function(){let se=v,Me=!1;if(V){const He=Array.isArray(v)?v:[];Me=He.length===0,se=He[He.length-1]}const Fe=Me?-1:pt(re.current,se,j),Le=Fe===-1?null:Fe;Le===null&&(le.current=null),!_&&D.set("selectedIndex",Le)},[V,_,v,j,D]);function Te(W){const se=te.initialValue;return Array.isArray(W)&&Array.isArray(se)?!Mr(W,se,(Me,Fe)=>Ge(Me,Fe,j)):W!==se}$n(v,()=>{O(l),X(Te(v)),B.change(v)});const We=Q((W,se)=>{a?.(W,se),!se.isCanceled&&(ue(W),!W&&(se.reason===Gt||se.reason===vn)&&(ee(!0),me(!1),P==="onBlur"&&B.commit(v)))}),je=Q(()=>{he(!1),D.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),z?.(!1)});Vt({enabled:!U,open:_,ref:Y,onComplete(){_||je()}}),o.useImperativeHandle(U,()=>({unmount:je}),[je]);const Ae=Q((W,se)=>{c?.(W,se),!se.isCanceled&&ce(W)}),ve=Q(W=>{const se=fn(W.scrollHeight,W.clientHeight),Me=wr(W.scrollTop,se),Fe=Me>0,Le=Me<se;D.set("scrollUpArrowVisible",Fe),D.set("scrollDownArrowVisible",Le)}),Oe=or({open:_,onOpenChange:We,elements:{reference:$,floating:x}}),ze=Gn(Oe,{enabled:!g&&!F,event:"mousedown"}),Ke=Bn(Oe),Ve=cr(Oe,{enabled:!g&&!F,listRef:E,activeIndex:f,selectedIndex:R,disabledIndices:wt,onNavigate(W){W===null&&!_||D.set("activeIndex",W)},focusItemOnHover:h}),Ne=ur(Oe,{enabled:!g&&!F&&(_||!V),listRef:L,activeIndex:f,selectedIndex:R,disabledIndices:W=>dr(E.current[W]),onMatch(W){_?D.set("activeIndex",W):Ae(re.current[W],Ie(gt))},onTyping(W){J.current=W}}),nt=o.useMemo(()=>Pt(Ne.reference,Ve.reference,Ke.reference,ze.reference,pe),[ze.reference,Ne.reference,Ve.reference,Ke.reference,pe]),rt=o.useMemo(()=>Pt(_n,Ne.floating,Ve.floating,Ke.floating),[Ne.floating,Ve.floating,Ke.floating]),ot=Ve.item??Qt;fr(()=>{D.update({popupProps:rt,triggerProps:nt})}),D.useSyncedValues({id:q,modal:T,multiple:V,value:v,open:_,mounted:fe,transitionStatus:G,popupProps:rt,triggerProps:nt,items:K,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j,openMethod:Ce});const Ee=o.useMemo(()=>({store:D,floatingContext:Oe,required:S,disabled:F,readOnly:g,multiple:V,highlightItemOnHover:h,setValue:Ae,setOpen:We,listRef:E,popupRef:Y,scrollHandlerRef:ie,handleScrollArrowVisibility:ve,scrollArrowsMountedCountRef:ye,itemProps:ot,valueRef:H,valuesRef:re,labelsRef:L,typingRef:J,selectionRef:ae,firstItemTextRef:Re,selectedItemTextRef:le,validation:B,onOpenChangeComplete:z,alignItemWithTriggerActiveRef:ge,initialValueRef:yt}),[D,Oe,S,F,g,V,h,Ae,We,ot,B,z,ve]),qe=Sn(u,B.inputRef),Qe=V?void 0:l,It=o.useMemo(()=>!V||!Array.isArray(v)||!l?null:v.map(W=>{const se=Ye(W,I);return be.jsx("input",{type:"hidden",form:m,name:l,value:se,disabled:F},se)}),[V,v,m,l,I,F]);return be.jsxs(on.Provider,{value:Ee,children:[y,be.jsx("input",{...B.getValidationProps(F,{onFocus(){D.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented||F||g)return;const se=W.currentTarget.value,Me=Ie(gt,W.nativeEvent);function Fe(){if(V)return;const Le=se.toLowerCase();let He=re.current.findIndex(St=>Ye(St,I).toLowerCase()===Le||un(St,b).toLowerCase()===Le);He===-1&&(He=re.current.findIndex((St,hn)=>{const Nt=L.current[hn];return Nt!=null&&Nt.toLowerCase()===Le}));const Dt=re.current[He];Dt!=null&&Ae(Dt,Me)}D.set("forceMount",!0),queueMicrotask(Fe)}}),id:q&&Qe==null?`${q}-hidden-input`:void 0,form:m,name:Qe,autoComplete:C,value:de,disabled:F,required:S&&!(V&&Je),readOnly:g,ref:qe,style:l?En:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),It]})}function Pr(e,t){return e??t}const lt=5;function Ar(e,t){const n=Or(t);return e.clientX>=n.left-lt&&e.clientX<=n.right+lt&&e.clientY>=n.top-lt&&e.clientY<=n.bottom+lt}function Or(e){const t=e.getBoundingClientRect(),n=dt(e);if(Mn)return t;const r=n.getComputedStyle(e,"::before"),c=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||c.content!=="none"))return t;const s=parseFloat(r.width)||0,a=parseFloat(r.height)||0,d=parseFloat(c.width)||0,m=parseFloat(c.height)||0,C=Math.max(t.width,s,d),p=Math.max(t.height,a,m),g=C-t.width,S=p-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-S/2,bottom:t.bottom+S/2}}const Vr=400,Fr={...Wn,...hr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=o.forwardRef(function(t,n){const{render:r,className:c,id:i,disabled:s=!1,nativeButton:a=!0,style:d,...m}=t,{setTouched:C,setFocused:p,validationMode:g,state:S,disabled:T}=Ft(),{labelId:U}=sn(),{store:u,setOpen:z,selectionRef:K,validation:V,readOnly:b,required:I,alignItemWithTriggerActiveRef:j,disabled:h}=Ue(),y=T||h||s,O=A(u,M.open),X=A(u,M.mounted),ee=A(u,M.value),me=A(u,M.triggerProps),te=A(u,M.positionerElement),w=A(u,M.listElement),N=A(u,M.popupSide),ne=A(u,M.id),B=A(u,M.labelId),P=A(u,M.hasSelectedValue),q=X&&te?N:null,F=i??ne,l=Pr(U,B);ln({id:F});const v=ke(te),ce=o.useRef(null),{getButtonProps:_,buttonRef:ue}=Zt({disabled:y,native:a}),E=u.useStateSetter("triggerElement"),L=ft(),Y=ft(),ie=ft();o.useEffect(()=>{if(O)return ie.start(Vr,()=>{K.current.allowUnselectedMouseUp=!0,K.current.allowSelectedMouseUp=!0}),()=>{ie.clear()};K.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Y.clear()},[O,K,Y,ie]);const ye=Pt(me,{id:F,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?w?.id??$t(te)?.id:void 0,"aria-labelledby":l,"aria-readonly":b||void 0,"aria-required":I||void 0,tabIndex:y?-1:0,onFocus(J){p(!0),O&&j.current&&z(!1,Ie(gt,J.nativeEvent)),L.start(0,()=>{u.set("forceMount",!0)})},onBlur(J){De(te,J.relatedTarget)||(C(!0),p(!1),g==="onBlur"&&V.commit(ee))},onMouseDown(J){if(O)return;const Re=tt(J.currentTarget);function le(ae){if(!ce.current)return;const ge=ae.target;De(ce.current,ge)||De(v.current,ge)||Ar(ae,ce.current)||z(!1,Ie(wn,ae))}Y.start(0,()=>{Re.addEventListener("mouseup",le,{once:!0})})}},m,_),H=V.getValidationProps(y,ye);H.role="combobox";const re={...S,open:O,disabled:y,value:ee,readOnly:b,popupSide:q,placeholder:!P};return Xe("button",t,{ref:[n,ce,ue,E],state:re,stateAttributesMapping:Fr,props:H})}),Lr={value:()=>null},ro=o.forwardRef(function(t,n){const{className:r,render:c,children:i,placeholder:s,style:a,...d}=t,{store:m,valueRef:C}=Ue(),p=A(m,M.value),g=A(m,M.items),S=A(m,M.itemToStringLabel),T=A(m,M.hasSelectedValue),U=!T&&s!=null&&i==null,u=A(m,M.hasNullItemLabel,U),z={value:p,placeholder:!T};let K=null;return typeof i=="function"?K=i(p):i!=null?K=i:U&&!u?K=s:Array.isArray(p)?K=Cr(p,g,S):K=an(p,g,S),Xe("span",t,{state:z,ref:[n,C],props:[{children:K},d],stateAttributesMapping:Lr})}),oo=o.forwardRef(function(t,n){const{store:r}=Ue(),c=A(r,M.mounted),i=A(r,M.forceMount);return c||i?be.jsx(Pn,{ref:n,...t}):null}),dn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Dr(){return o.useContext(dn)}function Nr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:c}=e,i=Q(c),[,s]=o.useState(!1),a=$e(kr).current,d=$e(Hr).current,m=o.useRef(0),C=o.useRef(!0),p=o.useRef([]),g=o.useRef(null),S=Q(()=>{C.current||(C.current=!0,s(I=>!I))}),T=Q((I,j)=>{d.set(I,j),S()}),U=Q(I=>{d.delete(I),S()}),u=Q(I=>{const j=new Map;return n.current.length=0,r&&(r.current.length=0),I.forEach(h=>{j.set(h.element,{...h.registration.metadata??{},index:h.index}),n.current[h.index]=h.element,r&&(r.current[h.index]=h.registration.label!==void 0?h.registration.label:h.registration.textRef?.current?.textContent??h.element.textContent)}),m.current=n.current.length,j});function z(I){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||I.length<2)return;const j=new MutationObserver(y=>{if(!_r(y))return;let O=null;for(const X of I)if(X.isConnected){if(O&&pn(O,X)>0){j.disconnect(),S();return}O=X}});g.current=j;const h=new Set;for(let y=1;y<I.length;y+=1){const O=Br(I[y-1],I[y]);O&&h.add(O)}h.forEach(y=>j.observe(y,{childList:!0}))}const K=Q(()=>{const[I,j]=Ur(d),h=u(I);z(j),p.current=I,C.current=!1,a.forEach(y=>y(h)),i(h)});Z(()=>(C.current||u(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,u]),Z(()=>{C.current&&K()}),Z(()=>()=>{g.current?.disconnect(),C.current=!0},[]);const V=Q(I=>(a.add(I),()=>{a.delete(I)})),b=o.useMemo(()=>({register:T,unregister:U,subscribeMapChange:V,nextIndexRef:m}),[T,U,V,m]);return be.jsx(dn.Provider,{value:b,children:t})}function Hr(){return new Map}function kr(){return new Set}function Ur(e){const t=new Set,n=[],r=[];e.forEach((i,s)=>{if(!s.isConnected)return;const a=i.index,d={index:a??-1,element:s,registration:i};a===null?r.push(d):a>=0&&(t.add(a),n.push(d))});let c=0;return r.sort((i,s)=>pn(i.element,s.element)),r.forEach(i=>{for(;t.has(c);)c+=1;i.index=c,n.push(i),c+=1}),t.size>0&&n.sort((i,s)=>i.index-s.index),[n,r.map(i=>i.element)]}function Br(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function _r(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 pn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const gn=o.createContext(void 0);function Wr(){const e=o.useContext(gn);if(!e)throw new Error(Rt(59));return e}function mt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},zr={position:"fixed"},so=o.forwardRef(function(t,n){const{anchor:r,className:c,render:i,positionMethod:s,side:a,align:d,sideOffset:m,alignOffset:C,collisionBoundary:p="clipping-ancestors",collisionPadding:g,arrowPadding:S,sticky:T,disableAnchorTracking:U,alignItemWithTrigger:u=!0,collisionAvoidance:z=An,style:K,...V}=t,{store:b,listRef:I,labelsRef:j,alignItemWithTriggerActiveRef:h,selectedItemTextRef:y,valuesRef:O,initialValueRef:X,popupRef:ee,setValue:me,floatingContext:te}=Ue(),w=A(b,M.open),N=A(b,M.mounted),ne=A(b,M.modal),B=A(b,M.value),P=A(b,M.openMethod),q=A(b,M.positionerElement),F=A(b,M.triggerElement),l=A(b,M.isItemEqualToValue),v=A(b,M.transitionStatus),ce=o.useRef(null),_=o.useRef(null),[ue,E]=o.useState(u),L=N&&ue&&P!=="touch";!N&&ue!==u&&E(u),o.useImperativeHandle(h,()=>L),Xn((L||ne)&&w,P==="touch",q,F);const Y=Jn({anchor:r,floatingRootContext:te,positionMethod:s,mounted:N,side:a,sideOffset:m,align:d,alignOffset:C,arrowPadding:S,collisionBoundary:p,collisionPadding:g,sticky:T,disableAnchorTracking:U??L,collisionAvoidance:z,keepMounted:!0}),ie=L?"none":Y.side,ye=L?zr:Y.positionerStyles,H={open:w,side:ie,align:Y.align,anchorHidden:Y.anchorHidden};Z(()=>{b.set("popupSide",Y.side)},[b,Y.side]);const re=b.useStateSetter("positionerElement"),J=Qn(t,H,{styles:ye,transitionStatus:v,props:V,refs:[n,re],hidden:!N,inert:!w}),Re=o.useRef(0),le=Q(ge=>{if(O.current.length===0)return;const fe=Re.current;if(Re.current=ge.size,ge.size===fe)return;const he=Ie(gt);if(fe!==0&&!b.state.multiple&&B!==null&&pt(O.current,B,l)===-1){const oe=X.current,D=oe!=null&&pt(O.current,oe,l)!==-1?oe:null;me(D,he),D===null&&(b.set("selectedIndex",null),y.current=null)}if(fe!==0&&b.state.multiple&&Array.isArray(B)){const G=B.filter(oe=>pt(O.current,oe,l)!==-1);G.length!==B.length&&(me(G,he),G.length===0&&(b.set("selectedIndex",null),y.current=null))}if(w&&L){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const G={height:""};mt(q,G),mt(ee.current,G)}}),ae=o.useMemo(()=>({...Y,side:ie,alignItemWithTriggerActive:L,setControlledAlignItemWithTrigger:E,scrollUpArrowRef:ce,scrollDownArrowRef:_}),[Y,ie,L,E]);return be.jsx(Nr,{elementsRef:I,labelsRef:j,onMapChange:le,children:be.jsxs(gn.Provider,{value:ae,children:[N&&ne&&be.jsx(jn,{inert:On(!w),cutout:F}),J]})})}),ct="base-ui-disable-scrollbar",jt={className:ct,getElement(e){return be.jsx("style",{nonce:e,href:ct,precedence:"base-ui:low",children:`.${ct}{scrollbar-width:none}.${ct}::-webkit-scrollbar{display:none}`})}},Kr=o.createContext(void 0),qr={disableStyleElements:!1};function Yr(){return o.useContext(Kr)??qr}const $r={...Kn,...en},io=o.forwardRef(function(t,n){const{render:r,className:c,style:i,finalFocus:s,...a}=t,{store:d,popupRef:m,onOpenChangeComplete:C,setOpen:p,valueRef:g,firstItemTextRef:S,selectedItemTextRef:T,multiple:U,handleScrollArrowVisibility:u,scrollHandlerRef:z,listRef:K,highlightItemOnHover:V,floatingContext:b}=Ue(),{side:I,align:j,alignItemWithTriggerActive:h,isPositioned:y,setControlledAlignItemWithTrigger:O}=Wr(),X=Zn()!=null,ee=er(),{nonce:me,disableStyleElements:te}=Yr(),w=A(d,M.id),N=A(d,M.open),ne=A(d,M.openMethod),B=A(d,M.mounted),P=A(d,M.popupProps),q=A(d,M.transitionStatus),F=A(d,M.triggerElement),l=A(d,M.positionerElement),v=A(d,M.listElement),ce=o.useRef(!1),_=o.useRef(!1),ue=o.useRef({}),E=Mt(),L=Q(H=>{if(!l||!m.current||!_.current)return;const re=l.style.top==="0px",J=l.style.bottom==="0px";if(ce.current||!h||!re&&!J){u(H);return}const Re=Kt(l),le=et(l.getBoundingClientRect().height,"y",Re),ae=tt(l),ge=dt(l),fe=ge.getComputedStyle(l),he=parseFloat(fe.marginTop),G=parseFloat(fe.marginBottom),oe=zt(ge.getComputedStyle(m.current)),pe=Math.min(ae.documentElement.clientHeight-he-G,oe),D=H.scrollTop,f=ut(H);let R=null;const $=de=>{l.style.height=`${de}px`},x=re?f-D:D,k=Math.min(le+x,pe);if(x<=Pe){const de=Ze(x,0,pe-le);de>0&&$(le+de),H.scrollTop=re?f:0,pe-(le+de)<=Pe&&(ce.current=!0),u(H);return}if(pe-k>Pe)R=re?1/0:0;else if(J&&D<f){const de=le+x-pe;R=D-(x-de)}const Ce=Math.ceil(k);if(Ce!==0&&$(Ce),R!=null){const de=Ze(R,0,ut(H));Math.abs(H.scrollTop-de)>Pe&&(H.scrollTop=de)}Ce>=pe-Pe&&(ce.current=!0),u(H)});o.useImperativeHandle(z,()=>L,[L]),Vt({open:N,ref:m,onComplete(){N&&C?.(!0)}});const Y={open:N,transitionStatus:q,side:I,align:j};Z(()=>{!l||!m.current||Object.keys(ue.current).length||(ue.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[m,l]),Z(()=>{N||h||(_.current=!1,ce.current=!1,mt(l,ue.current))},[N,h,l,m]),Z(()=>{const H=m.current;if(!N||!F||!l||!H||h&&!y||d.state.transitionStatus==="ending")return;if(_.current=!0,H.style.removeProperty("--transform-origin"),!h){E.request(()=>u(v||H));return}const re=Gr(H);try{let J=T.current;J?.isConnected||(J=!M.hasSelectedValue(d.state)&&S.current?.isConnected?S.current:null);const Re=g.current,le=dt(l),ae=le.getComputedStyle(l),ge=le.getComputedStyle(H),fe=tt(F),he=Kt(F),G=at(F.getBoundingClientRect(),he),oe=at(l.getBoundingClientRect(),he),pe=G.height,D=v||H,f=D.scrollHeight,R=parseFloat(ge.borderBottomWidth),$=parseFloat(ae.marginTop)||10,x=parseFloat(ae.marginBottom)||10,k=parseFloat(ae.minHeight)||100,Ce=zt(ge),de=5,Be=5,_e=20,Se=fe.documentElement.clientHeight-$-x,yt=fe.documentElement.clientWidth,Je=Se-G.bottom+pe;let Te,We=ee==="rtl"?G.right-oe.width:G.left,je=0;if(J&&Re){const Ee=at(Re.getBoundingClientRect(),he);Te=at(J.getBoundingClientRect(),he),We=oe.left+(ee==="rtl"?Ee.right-Te.right:Ee.left-Te.left);const qe=Ee.top-G.top+Ee.height/2;je=Te.top-oe.top+Te.height/2-qe}const Ae=Je+je+x+R;let ve=Math.min(Se,Ae);const Oe=Se-$-x,ze=Ae-ve,Ke=yt-Be;l.style.left=`${Ze(We,de,Ke-oe.width)}px`,l.style.height=`${ve}px`,l.style.maxHeight="none",l.style.marginTop=`${$}px`,l.style.marginBottom=`${x}px`,H.style.height="100%";const Ve=ut(D),Ne=ze>=Ve-Pe;Ne&&(ve=Math.min(Se,oe.height)-(ze-Ve));const nt=G.top<_e||G.bottom>Se-_e||Math.ceil(ve)+Pe<Math.min(f,k),rt=(le.visualViewport?.scale??1)!==1&&Xt;if(nt||rt){mt(l,ue.current),O(!1);return}const ot=Math.max(k,ve);if(Ne){const Ee=Math.max(0,Se-Ae);l.style.top=oe.height>=Oe?"0":`${Ee}px`,l.style.height=`${ve}px`,D.scrollTop=ut(D)}else l.style.bottom="0",D.scrollTop=ze;if(Te){const Ee=oe.top,qe=oe.height,Qe=Te.top+Te.height/2,It=Ze(qe>0?(Qe-Ee)/qe*100:50,0,100);H.style.setProperty("--transform-origin",`50% ${It}%`)}(ot===Se||ve>=Ce)&&(ce.current=!0),u(D),V&&d.state.selectedIndex===null&&d.state.activeIndex===null&&K.current[0]!=null&&d.set("activeIndex",0)}finally{re()}},[d,N,l,F,g,S,T,m,u,h,O,E,v,K,V,ee,y]),o.useEffect(()=>{if(!h||!l||!N)return;const H=dt(l);function re(J){p(!1,Ie(Fn,J))}return Vn(H,"resize",re)},[p,h,l,N]);const ie={...v?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${w}-list`},onKeyDown(H){X&&qn.has(H.key)&&H.stopPropagation()},onScroll(H){v||L(H.currentTarget)},...h&&{style:v?{height:"100%"}:jr},className:!v&&h?jt.className:void 0},ye=Xe("div",t,{ref:[n,m],state:Y,stateAttributesMapping:$r,props:[P,ie,rr(q),a]});return be.jsxs(o.Fragment,{children:[!te&&jt.getElement(me),be.jsx(zn,{context:b,modal:!1,disabled:!B,openInteractionType:ne,returnFocus:s,restoreFocus:!0,children:ye})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function ut(e){return fn(e.scrollHeight,e.clientHeight)}function Kt(e){return tr.getScale(e)}function et(e,t,n){return e/n[t]}function at(e,t){return nr({x:et(e.x,"x",t),y:et(e.y,"y",t),width:et(e.width,"x",t),height:et(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[r,c]of qt)n[r]=t.getPropertyValue(r),t.setProperty(r,c,"important");return()=>{for(const[r]of qt){const c=n[r];c?t.setProperty(r,c):t.removeProperty(r)}}}function Xr(e={}){const{guess:t,label:n,metadata:r,textRef:c,index:i}=e,{register:s,unregister:a,subscribeMapChange:d,nextIndexRef:m}=Dr(),C=o.useRef(-1),[p,g]=o.useState(i==null&&t?()=>{if(C.current===-1){const u=m.current;m.current+=1,C.current=u}return C.current}:-1),S=i??p,T=o.useRef(null),U=o.useCallback(u=>{const z=T.current;z&&a(z),T.current=u,u&&s(u,{metadata:r??null,index:i??null,label:n,textRef:c})},[i,s,a,r,n,c]);return Z(()=>{if(i==null)return d(u=>{const z=T.current?u.get(T.current)?.index:null;z!=null&&g(z)})},[i,d]),{ref:U,index:S}}const mn=o.createContext(void 0);function Lt(){const e=o.useContext(mn);if(!e)throw new Error(Rt(57));return e}const lo=o.memo(o.forwardRef(function(t,n){const{render:r,className:c,style:i,value:s=null,label:a,disabled:d=!1,nativeButton:m=!1,...C}=t,p=o.useRef(null),g=Xr({guess:!0,label:a,textRef:p}),{store:S,itemProps:T,setOpen:U,setValue:u,selectionRef:z,typingRef:K,valuesRef:V,multiple:b,selectedItemTextRef:I,disabled:j,readOnly:h}=Ue(),y=j||d,O=A(S,M.isActive,g.index),X=A(S,M.open),ee=A(S,M.isSelected,s),me=A(S,M.isSelectedByFocus,g.index),te=A(S,M.isItemEqualToValue),w=g.index,N=o.useRef(null);Z(()=>{const E=V.current;return E[w]=s,()=>{delete E[w]}},[w,s,V]),Z(()=>{const E=S.state.value;let L=E;b&&Array.isArray(E)&&(L=E.length>0?E[E.length-1]:void 0),L!==void 0&&Ge(s,L,te)&&(S.set("selectedIndex",w),p.current&&(I.current=p.current))},[w,b,te,S,s,I]);const ne=o.useRef("mouse"),B=o.useRef(!1),{getButtonProps:P,buttonRef:q}=Zt({disabled:y,focusableWhenDisabled:!0,native:m,composite:!0}),F={disabled:y,selected:ee,highlighted:O};function l(E){if(j||h)return;const L=S.state.value;if(b){const Y=Array.isArray(L)?L:[],ie=ee?Sr(Y,s,te):[...Y,s];u(ie,Ie(Tt,E))}else u(s,Ie(Tt,E)),U(!1,Ie(Tt,E))}function v(){z.current.dragY=0}const ce={role:"option","aria-selected":ee,tabIndex:X&&O?0:-1,onKeyDown(E){S.set("activeIndex",w),E.key===" "&&K.current&&E.preventDefault()},onClick(E){const L=ne.current!=="touch",Y=E.nativeEvent.pointerType,ie=L&&nn(E.nativeEvent)&&(Y!==void 0||O),ye=L&&!ie&&!B.current;B.current=!1,!(y||ye)&&l(E.nativeEvent)},onPointerEnter(E){ne.current=E.pointerType},onPointerMove(E){if(E.pointerType==="mouse"&&E.buttons===1){const L=z.current;L.dragY+=E.movementY,L.dragY**2>=64&&(L.allowUnselectedMouseUp=!0)}},onPointerDown(E){ne.current=E.pointerType,B.current=!0,v()},onMouseUp(){if(v(),y||ne.current==="touch"||B.current)return;const E=!z.current.allowSelectedMouseUp&&ee,L=!z.current.allowUnselectedMouseUp&&!ee;E||L||(B.current=!0,N.current?.click(),B.current=!1)}},_=Xe("div",t,{ref:[q,n,g.ref,N],state:F,props:[T,ce,C,P]}),ue=o.useMemo(()=>({selected:ee,index:w,textRef:p,selectedByFocus:me}),[ee,w,p,me]);return be.jsx(mn.Provider,{value:ue,children:_})})),co=o.forwardRef(function(t,n){const{selected:r}=Lt();return t.keepMounted||r?be.jsx(Jr,{...t,ref:n}):null}),Jr=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:c,keepMounted:i,...s}=e,{selected:a}=Lt(),d=o.useRef(null),{transitionStatus:m,setMounted:C}=rn(a),g=Xe("span",e,{ref:[t,d],state:{selected:a,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:en});return Vt({open:a,ref:d,onComplete(){a||C(!1)}}),g})),uo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:c,selectedByFocus:i}=Lt(),{firstItemTextRef:s,selectedItemTextRef:a}=Ue(),{render:d,className:m,style:C,...p}=t,g=o.useCallback(T=>{T&&(r===0&&(s.current=T),i&&(a.current=T))},[s,a,r,i]);return Xe("div",t,{ref:[g,n,c],props:p})}));export{jr as L,to as S,Wr as a,jt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,hr as k,vr as l,Ft as m,sn as n,Wt as o,br as p,M as s,Ue as u};
|
|
1
|
+
import{bU as xn,aI as $e,aF as Z,bf as Yt,bX as $t,bV as Rn,r as o,be as Q,bz as Mt,ch as Ht,ci as Et,cj as kt,b_ as Ct,bg as tt,aE as De,A as Ie,ck as Ut,by as Bt,cl as st,aD as bn,bp as Gt,c0 as Xt,cm as ht,cn as xt,co as Jt,cp as Ot,bd as ft,c5 as yn,cq as In,cr as wt,ay as Rt,aJ as xe,Z as Qt,j as be,V as A,aA as Vt,aL as Pt,aK as Sn,aO as En,aP as Cn,aQ as gt,aG as Tn,b$ as vn,aN as dt,bR as Mn,y as Zt,z as Xe,cs as wn,aB as Pn,ct as An,aC as On,bi as Vn,cu as Fn,az as en,cv as Tt}from"./__vite-browser-external-BGnq8Ebm.js";import{q as tn,F as Ln,P as Dn,v as ke,o as Nn,E as Hn,G as we,H as nn,D as kn,u as Un,m as rn,e as Bn,d as _n,z as Wn,I as jn,b as zn,a as Kn,C as qn}from"./composite-Dxmivlk4.js";import{h as Yn,u as $n,a as Gn,d as Xn,c as Jn,e as Qn,f as Zn,i as er,p as tr,r as nr,g as rr}from"./ToolbarRootContext-CozJT6Vs.js";function Ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function or(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,c=xn(),i=tn()!=null,s=$e(()=>new Ln({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Dn,floatingId:c,syncOnly:!1,nested:i})).current;return Z(()=>{const a={open:t,floatingId:c};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Yt(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),s.update(a)},[t,c,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}const sr="Escape";function _t(e){return Xt&&e.movementX===0&&e.movementY===0}function bt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function it(e,t){return bt(t,e===Jt||e===Ot,e===ht||e===xt)}function vt(e,t,n){return bt(t,e===Ot,n?e===ht:e===xt)||e==="Enter"||e===" "||e===""}function ir(e,t,n){return bt(t,n?e===ht:e===xt,e===Ot)}function lr(e,t,n,r){const c=n?e===xt:e===ht,i=e===Jt;return t==="both"||t==="horizontal"&&r?e===sr:bt(t,c,i)}function cr(e,t){const{listRef:n,activeIndex:r,onNavigate:c=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:a=!1,loopFocus:d=!1,nested:m=!1,rtl:C=!1,virtual:p=!1,focusItemOnOpen:g="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:T=!0,disabledIndices:U=void 0,orientation:u="vertical",parentOrientation:z,id:K,resetOnPointerLeave:V=!0,externalTree:b,grid:I}=t,j=I!=null,h="rootStore"in e?e.rootStore:e,y=h.useState("open"),O=h.useState("floatingElement"),X=h.useState("domReferenceElement"),ee=h.context.dataRef,me=$t(O),te=Rn(X),w=ke(me),N=tn(),ne=Nn(b),B=o.useRef(g),P=o.useRef(s??-1),q=o.useRef(null),F=o.useRef(!0),l=Q(f=>{c(P.current===-1?null:P.current,f)}),v=o.useRef(!!O),ce=o.useRef(y),_=o.useRef(!1),ue=o.useRef(!1),E=o.useRef(null),L=ke(U),Y=ke(y),ie=ke(s),ye=ke(V),H=Mt(),re=Mt(),J=Q(()=>{function f(k){p?ne?.events.emit("virtualfocus",k):E.current=Hn(k,{sync:_.current,preventScroll:!0})}const R=n.current[P.current],$=ue.current;R&&f(R),(_.current?k=>k():k=>H.request(k))(()=>{const k=n.current[P.current]||R;if(!k)return;R||f(k),he&&($||!F.current)&&k.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Z(()=>{ee.current.orientation=u},[ee,u]),Z(()=>{i&&(y&&O?(P.current=s??-1,B.current&&s!=null&&(ue.current=!0,l())):v.current&&(P.current=-1,l()))},[i,y,O,s,l]),Z(()=>{if(i){if(!y){_.current=!1;return}if(O)if(r==null){if(_.current=!1,ie.current!=null)return;if(v.current&&(P.current=-1,J()),(!ce.current||!v.current)&&B.current&&(q.current!=null||B.current===!0&&q.current==null)){let f=0;const R=()=>{n.current[0]==null?(f<2&&(f?x=>re.request(x):queueMicrotask)(R),f+=1):(P.current=q.current==null||vt(q.current,u,C)||m?Et(n):kt(n),q.current=null,l())};R()}}else Ht(n.current,r)||(P.current=r,J(),ue.current=!1)}},[i,y,O,r,ie,m,n,u,C,l,J,re]),Z(()=>{if(!i||O||!ne||p||!v.current)return;const f=ne.nodesRef.current,R=f.find(k=>k.id===N)?.context?.elements.floating,$=Ct(tt(X??R??null)),x=f.some(k=>k.context&&De(k.context.elements.floating,$));R&&!x&&F.current&&R.focus({preventScroll:!0})},[i,O,X,ne,N,p]),Z(()=>{ce.current=y,v.current=!!O}),Z(()=>{y||(q.current=null,B.current=g)},[y,g]);const Re=r!=null,le=Q(f=>{if(!Y.current)return;const R=n.current.indexOf(f.currentTarget);R!==-1&&(P.current!==R||r!==R)&&(P.current=R,l(f))}),ae=Q(()=>z??ne?.nodesRef.current.find(f=>f.id===N)?.context?.dataRef?.current.orientation),ge=Q(()=>Et(n,L.current)),fe=Q(f=>{if(F.current=!1,_.current=!0,f.which===229||!Y.current&&f.currentTarget===w.current)return;if(m&&lr(f.key,u,C,j)){it(f.key,ae())||we(f),h.setOpen(!1,Ie(Ut,f.nativeEvent)),Bt(X)&&(p?ne?.events.emit("virtualfocus",X):X.focus());return}const R=P.current,$=Et(n,U),x=kt(n,U);if(te||(f.key==="Home"&&(we(f),P.current=$,l(f)),f.key==="End"&&(we(f),P.current=x,l(f))),I!=null){const k=I(f,P.current,n,u,d,C,U,$,x);if(k!=null&&(P.current=k,l(f)),u==="both")return}if(it(f.key,u)){if(we(f),y&&!p&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){P.current=vt(f.key,u,C)?$:x,l(f);return}vt(f.key,u,C)?d?R>=x?a&&R!==n.current.length?P.current=-1:(_.current=!1,P.current=$):P.current=st(n.current,{startingIndex:R,disabledIndices:U}):P.current=Math.min(x,st(n.current,{startingIndex:R,disabledIndices:U})):d?R<=$?a&&R!==-1?P.current=n.current.length:(_.current=!1,P.current=x):P.current=st(n.current,{startingIndex:R,decrement:!0,disabledIndices:U}):P.current=Math.max($,st(n.current,{startingIndex:R,decrement:!0,disabledIndices:U})),Ht(n.current,P.current)&&(P.current=-1),l(f)}}),he=o.useMemo(()=>({onFocus(R){_.current=!0,le(R)},onClick:({currentTarget:R})=>R.focus({preventScroll:!0}),onMouseMove(R){_t(R)||(_.current=!0,ue.current=!1,S&&le(R))},onPointerLeave(R){if(!Y.current||!F.current||R.pointerType==="touch")return;_.current=!0;const $=R.relatedTarget;if(!(!S||n.current.includes($))&&ye.current&&(E.current?.(),E.current=null,P.current=-1,l(R),!p)){const x=w.current,k=Ct(tt(x));x&&De(x,k)&&x.focus({preventScroll:!0})}}}),[le,Y,w,S,n,l,ye,p]),G=o.useMemo(()=>p&&y&&Re&&{"aria-activedescendant":`${K}-${r}`},[p,y,Re,K,r]),oe=o.useMemo(()=>({"aria-orientation":u==="both"?void 0:u,...te?{}:G,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&y&&!p){const R=bn(f.nativeEvent);if(R&&!De(w.current,R))return;we(f),h.setOpen(!1,Ie(Gt,f.nativeEvent)),Bt(X)&&X.focus();return}fe(f)},onPointerMove(f){_t(f)||(F.current=!0)}}),[G,fe,w,u,te,h,y,p,X]),pe=o.useMemo(()=>{function f(x){h.setOpen(!0,Ie(Ut,x.nativeEvent,x.currentTarget))}function R(x){g==="auto"&&nn(x.nativeEvent)&&(B.current=!p)}function $(x){B.current=g,g==="auto"&&kn(x.nativeEvent)&&(B.current=!0)}return{onKeyDown(x){const k=h.select("open");F.current=!1;const Ce=x.key.startsWith("Arrow"),de=ir(x.key,ae(),C),Be=it(x.key,u),_e=(m?de:Be)||x.key==="Enter"||x.key.trim()==="";if(p&&k)return fe(x);if(!(!k&&!T&&Ce)){if(_e){const Se=it(x.key,ae());q.current=m&&Se?null:x.key}if(m){de&&(we(x),k?(P.current=ge(),l(x)):f(x));return}Be&&(ie.current!=null&&(P.current=ie.current),we(x),!k&&T?f(x):fe(x),k&&l(x))}},onFocus(x){h.select("open")&&!p&&(P.current=-1,l(x))},onPointerDown:$,onPointerEnter:$,onMouseDown:R,onClick:R}},[fe,g,ge,m,l,h,T,u,ae,C,ie,p]),D=o.useMemo(()=>({...G,...pe}),[G,pe]);return o.useMemo(()=>i?{reference:D,floating:oe,item:he,trigger:pe}:{},[i,D,oe,pe,he])}function ur(e,t){const{listRef:n,elementsRef:r,activeIndex:c,onMatch:i,disabledIndices:s,onTyping:a,enabled:d=!0,resetMs:m=750,selectedIndex:C=null}=t,p="rootStore"in e?e.rootStore:e,g=p.useState("open"),S=ft(),T=o.useRef(""),U=o.useRef(C??c??-1),u=o.useRef(null),z=Q(b=>{function I(w){return r?.current[w]}function j(w){const N=I(w);return N&&!yn(N)||N?.matches(":disabled")?!1:s==null||!In(wt,w,s)}function h(w,N,ne=0){if(w.length===0)return-1;const B=(ne%w.length+w.length)%w.length,P=N.toLowerCase();for(let q=0;q<w.length;q+=1){const F=(B+q)%w.length;if(!(!w[F]?.toLowerCase().startsWith(P)||!j(F)))return F}return-1}const y=n.current;if(T.current.length>0&&b.key===" "&&(we(b),a?.(!0)),T.current.length>0&&T.current[0]!==" "&&h(y,T.current)===-1&&b.key!==" "&&a?.(!1),y==null||b.key.length!==1||b.ctrlKey||b.metaKey||b.altKey)return;g&&b.key!==" "&&(we(b),a?.(!0));const O=T.current==="";O&&(U.current=C??c??-1),y.every((w,N)=>w&&j(N)?w[0]?.toLowerCase()!==w[1]?.toLowerCase():!0)&&T.current===b.key&&(T.current="",U.current=u.current),T.current+=b.key,S.start(m,()=>{T.current="",U.current=u.current,a?.(!1)});const me=((O?C??c??-1:U.current)??0)+1,te=h(y,T.current,me);te!==-1?(i?.(te),u.current=te):b.key!==" "&&(T.current="",a?.(!1))}),K=Q(b=>{const I=b.relatedTarget,j=p.select("domReferenceElement"),h=p.select("floatingElement");De(j,I)||De(h,I)||(S.clear(),T.current="",U.current=u.current,a?.(!1))});Z(()=>{!g&&C!==null||(S.clear(),u.current=null,T.current!==""&&(T.current=""))},[g,C,S]);const V=o.useMemo(()=>({onKeyDown:z,onBlur:K}),[z,K]);return o.useMemo(()=>d?{reference:V,floating:V}:{},[d,V])}function ar(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 fr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function dr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:r="value"}){const{current:c}=o.useRef(e!==void 0),[i,s]=o.useState(t),a=c?e:i,d=o.useCallback(m=>{c||s(m)},[]);return[a,d]}const on=o.createContext(null);function Ue(){const e=o.useContext(on);if(e===null)throw new Error(Rt(60));return e}const pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},gr={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},mr={disabled:!1,...gr},hr={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},xr={invalid:void 0,name:void 0,validityData:{state:pr,errors:[],error:"",value:"",initialValue:null},setValidityData:xe,disabled:void 0,setTouched:xe,setDirty:xe,setFilled:xe,setFocused:xe,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:mr,registerFieldControl:xe,validation:{getValidationProps:(e,t=Qt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:xe,getInputControl:()=>null,commit:async()=>{},change:xe}},Rr=o.createContext(xr);function Ft(e=!0){const t=o.useContext(Rr);if(t.setValidityData===xe&&!e)throw new Error(Rt(28));return t}function br(e,t,n,r,c=!0,i){const{registerFieldControl:s}=Ft(),a=$e(()=>Symbol());Z(()=>{const d=a.current;if(!c){s(d,void 0);return}s(d,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,c,r,t,i,s,a,n]),Z(()=>{const d=a.current;return()=>{s(d,void 0)}},[s,a])}const yr=o.createContext({controlId:void 0,registerControlId:xe,labelId:void 0,setLabelId:xe,messageIds:[],setMessageIds:xe,getDescriptionProps:e=>e});function sn(){return o.useContext(yr)}function ln(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:c,registerControlId:i}=sn(),s=Un(t),a=n?c:void 0,d=$e(()=>Symbol()),m=o.useRef(!1),C=o.useRef(t!=null),p=Q(()=>{!m.current||i===xe||(m.current=!1,i(d.current,void 0))});return Z(()=>{if(i===xe)return;let g;if(n){const S=r?.current;Yt(S)&&S.closest("label")!=null?g=t??null:g=a??s}else if(t!=null)C.current=!0,g=t;else if(C.current)g=s;else{p();return}if(g===void 0){p();return}m.current=!0,i(d.current,g)},[t,r,a,i,n,s,d,p]),o.useEffect(()=>p,[p]),c??s}const Ir=(e,t)=>Object.is(e,t);function Ge(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function pt(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Ge(r,t,n))}function Sr(e,t,n){return e.filter(r=>!Ge(t,r,n))}function At(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function cn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Er(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(cn(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 un(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 At(e)}function Ye(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?At(e.value):At(e)}function an(e,t,n){function r(){return un(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 t[e]??r();if(Array.isArray(t)){const c=t,i=cn(c)?c.flatMap(s=>s.items):c;if(e==null||typeof e!="object"){const s=i.find(a=>a.value===e);return s&&s.label!=null?s.label:r()}if("value"in e){const s=i.find(a=>a&&a.value===e.value);if(s&&s.label!=null)return s.label}}return r()}function Cr(e,t,n){return e.reduce((r,c,i)=>(i>0&&r.push(", "),r.push(be.jsx(o.Fragment,{children:an(c,t,n)},i)),r),[])}const M={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,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:Ye(t,r)!==""},hasNullItemLabel:(e,t)=>t?Er(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(c=>Ge(t,c,n)):Ge(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,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},Tr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:xe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function vr(){return o.useContext(Tr)}function Mr(e,t,n=(r,c)=>r===c){return e.length===t.length&&e.every((r,c)=>n(r,t[c]))}const Pe=1;function fn(e,t){return Math.max(0,e-t)}function wr(e,t){if(t<=0)return 0;const n=Ze(e,0,t),r=n,c=t-n,i=r<=Pe,s=c<=Pe;return i&&s?r<=c?0:t:i?0:s?t:n}function to(e){const{id:t,value:n,defaultValue:r=null,onValueChange:c,open:i,defaultOpen:s=!1,onOpenChange:a,name:d,form:m,autoComplete:C,disabled:p=!1,readOnly:g=!1,required:S=!1,modal:T=!0,actionsRef:U,inputRef:u,onOpenChangeComplete:z,items:K,multiple:V=!1,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j=Ir,highlightItemOnHover:h=!0,children:y}=e,{clearErrors:O}=vr(),{setDirty:X,setTouched:ee,setFocused:me,validityData:te,setFilled:w,name:N,disabled:ne,validation:B,validationMode:P}=Ft(),q=ln({id:t}),F=ne||p,l=N??d,[v,ce]=Wt({controlled:n,default:V?r??wt:r,name:"Select",state:"value"}),[_,ue]=Wt({controlled:i,default:s,name:"Select",state:"open"}),E=o.useRef([]),L=o.useRef([]),Y=o.useRef(null),ie=o.useRef(null),ye=o.useRef(0),H=o.useRef(null),re=o.useRef([]),J=o.useRef(!1),Re=o.useRef(null),le=o.useRef(null),ae=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ge=o.useRef(!1),{mounted:fe,setMounted:he,transitionStatus:G}=rn(_),{openMethod:oe,triggerProps:pe}=Yn(_),D=$e(()=>new Tn({id:q,labelId:void 0,modal:T,multiple:V,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j,value:v,open:_,mounted:fe,transitionStatus:G,items:K,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=A(D,M.activeIndex),R=A(D,M.selectedIndex),$=A(D,M.triggerElement),x=A(D,M.positionerElement),k=ar(oe),Ce=oe??k,de=o.useMemo(()=>V?"":Ye(v,I),[V,v,I]),Be=o.useMemo(()=>V&&Array.isArray(v)?v.map(W=>Ye(W,I)):Ye(v,I),[V,v,I]),_e=ke($),Se=Q(()=>Be);br(_e,q,v,Se,!F,d);const yt=o.useRef(v),Je=V?Array.isArray(v)&&v.length>0:v!=null&&de!=="";Z(()=>{w(Je)},[Je,w]),Z(function(){let se=v,Me=!1;if(V){const He=Array.isArray(v)?v:[];Me=He.length===0,se=He[He.length-1]}const Fe=Me?-1:pt(re.current,se,j),Le=Fe===-1?null:Fe;Le===null&&(le.current=null),!_&&D.set("selectedIndex",Le)},[V,_,v,j,D]);function Te(W){const se=te.initialValue;return Array.isArray(W)&&Array.isArray(se)?!Mr(W,se,(Me,Fe)=>Ge(Me,Fe,j)):W!==se}$n(v,()=>{O(l),X(Te(v)),B.change(v)});const We=Q((W,se)=>{a?.(W,se),!se.isCanceled&&(ue(W),!W&&(se.reason===Gt||se.reason===vn)&&(ee(!0),me(!1),P==="onBlur"&&B.commit(v)))}),je=Q(()=>{he(!1),D.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),z?.(!1)});Vt({enabled:!U,open:_,ref:Y,onComplete(){_||je()}}),o.useImperativeHandle(U,()=>({unmount:je}),[je]);const Ae=Q((W,se)=>{c?.(W,se),!se.isCanceled&&ce(W)}),ve=Q(W=>{const se=fn(W.scrollHeight,W.clientHeight),Me=wr(W.scrollTop,se),Fe=Me>0,Le=Me<se;D.set("scrollUpArrowVisible",Fe),D.set("scrollDownArrowVisible",Le)}),Oe=or({open:_,onOpenChange:We,elements:{reference:$,floating:x}}),ze=Gn(Oe,{enabled:!g&&!F,event:"mousedown"}),Ke=Bn(Oe),Ve=cr(Oe,{enabled:!g&&!F,listRef:E,activeIndex:f,selectedIndex:R,disabledIndices:wt,onNavigate(W){W===null&&!_||D.set("activeIndex",W)},focusItemOnHover:h}),Ne=ur(Oe,{enabled:!g&&!F&&(_||!V),listRef:L,activeIndex:f,selectedIndex:R,disabledIndices:W=>dr(E.current[W]),onMatch(W){_?D.set("activeIndex",W):Ae(re.current[W],Ie(gt))},onTyping(W){J.current=W}}),nt=o.useMemo(()=>Pt(Ne.reference,Ve.reference,Ke.reference,ze.reference,pe),[ze.reference,Ne.reference,Ve.reference,Ke.reference,pe]),rt=o.useMemo(()=>Pt(_n,Ne.floating,Ve.floating,Ke.floating),[Ne.floating,Ve.floating,Ke.floating]),ot=Ve.item??Qt;fr(()=>{D.update({popupProps:rt,triggerProps:nt})}),D.useSyncedValues({id:q,modal:T,multiple:V,value:v,open:_,mounted:fe,transitionStatus:G,popupProps:rt,triggerProps:nt,items:K,itemToStringLabel:b,itemToStringValue:I,isItemEqualToValue:j,openMethod:Ce});const Ee=o.useMemo(()=>({store:D,floatingContext:Oe,required:S,disabled:F,readOnly:g,multiple:V,highlightItemOnHover:h,setValue:Ae,setOpen:We,listRef:E,popupRef:Y,scrollHandlerRef:ie,handleScrollArrowVisibility:ve,scrollArrowsMountedCountRef:ye,itemProps:ot,valueRef:H,valuesRef:re,labelsRef:L,typingRef:J,selectionRef:ae,firstItemTextRef:Re,selectedItemTextRef:le,validation:B,onOpenChangeComplete:z,alignItemWithTriggerActiveRef:ge,initialValueRef:yt}),[D,Oe,S,F,g,V,h,Ae,We,ot,B,z,ve]),qe=Sn(u,B.inputRef),Qe=V?void 0:l,It=o.useMemo(()=>!V||!Array.isArray(v)||!l?null:v.map(W=>{const se=Ye(W,I);return be.jsx("input",{type:"hidden",form:m,name:l,value:se,disabled:F},se)}),[V,v,m,l,I,F]);return be.jsxs(on.Provider,{value:Ee,children:[y,be.jsx("input",{...B.getValidationProps(F,{onFocus(){D.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented||F||g)return;const se=W.currentTarget.value,Me=Ie(gt,W.nativeEvent);function Fe(){if(V)return;const Le=se.toLowerCase();let He=re.current.findIndex(St=>Ye(St,I).toLowerCase()===Le||un(St,b).toLowerCase()===Le);He===-1&&(He=re.current.findIndex((St,hn)=>{const Nt=L.current[hn];return Nt!=null&&Nt.toLowerCase()===Le}));const Dt=re.current[He];Dt!=null&&Ae(Dt,Me)}D.set("forceMount",!0),queueMicrotask(Fe)}}),id:q&&Qe==null?`${q}-hidden-input`:void 0,form:m,name:Qe,autoComplete:C,value:de,disabled:F,required:S&&!(V&&Je),readOnly:g,ref:qe,style:l?En:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),It]})}function Pr(e,t){return e??t}const lt=5;function Ar(e,t){const n=Or(t);return e.clientX>=n.left-lt&&e.clientX<=n.right+lt&&e.clientY>=n.top-lt&&e.clientY<=n.bottom+lt}function Or(e){const t=e.getBoundingClientRect(),n=dt(e);if(Mn)return t;const r=n.getComputedStyle(e,"::before"),c=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||c.content!=="none"))return t;const s=parseFloat(r.width)||0,a=parseFloat(r.height)||0,d=parseFloat(c.width)||0,m=parseFloat(c.height)||0,C=Math.max(t.width,s,d),p=Math.max(t.height,a,m),g=C-t.width,S=p-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-S/2,bottom:t.bottom+S/2}}const Vr=400,Fr={...Wn,...hr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=o.forwardRef(function(t,n){const{render:r,className:c,id:i,disabled:s=!1,nativeButton:a=!0,style:d,...m}=t,{setTouched:C,setFocused:p,validationMode:g,state:S,disabled:T}=Ft(),{labelId:U}=sn(),{store:u,setOpen:z,selectionRef:K,validation:V,readOnly:b,required:I,alignItemWithTriggerActiveRef:j,disabled:h}=Ue(),y=T||h||s,O=A(u,M.open),X=A(u,M.mounted),ee=A(u,M.value),me=A(u,M.triggerProps),te=A(u,M.positionerElement),w=A(u,M.listElement),N=A(u,M.popupSide),ne=A(u,M.id),B=A(u,M.labelId),P=A(u,M.hasSelectedValue),q=X&&te?N:null,F=i??ne,l=Pr(U,B);ln({id:F});const v=ke(te),ce=o.useRef(null),{getButtonProps:_,buttonRef:ue}=Zt({disabled:y,native:a}),E=u.useStateSetter("triggerElement"),L=ft(),Y=ft(),ie=ft();o.useEffect(()=>{if(O)return ie.start(Vr,()=>{K.current.allowUnselectedMouseUp=!0,K.current.allowSelectedMouseUp=!0}),()=>{ie.clear()};K.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Y.clear()},[O,K,Y,ie]);const ye=Pt(me,{id:F,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?w?.id??$t(te)?.id:void 0,"aria-labelledby":l,"aria-readonly":b||void 0,"aria-required":I||void 0,tabIndex:y?-1:0,onFocus(J){p(!0),O&&j.current&&z(!1,Ie(gt,J.nativeEvent)),L.start(0,()=>{u.set("forceMount",!0)})},onBlur(J){De(te,J.relatedTarget)||(C(!0),p(!1),g==="onBlur"&&V.commit(ee))},onMouseDown(J){if(O)return;const Re=tt(J.currentTarget);function le(ae){if(!ce.current)return;const ge=ae.target;De(ce.current,ge)||De(v.current,ge)||Ar(ae,ce.current)||z(!1,Ie(wn,ae))}Y.start(0,()=>{Re.addEventListener("mouseup",le,{once:!0})})}},m,_),H=V.getValidationProps(y,ye);H.role="combobox";const re={...S,open:O,disabled:y,value:ee,readOnly:b,popupSide:q,placeholder:!P};return Xe("button",t,{ref:[n,ce,ue,E],state:re,stateAttributesMapping:Fr,props:H})}),Lr={value:()=>null},ro=o.forwardRef(function(t,n){const{className:r,render:c,children:i,placeholder:s,style:a,...d}=t,{store:m,valueRef:C}=Ue(),p=A(m,M.value),g=A(m,M.items),S=A(m,M.itemToStringLabel),T=A(m,M.hasSelectedValue),U=!T&&s!=null&&i==null,u=A(m,M.hasNullItemLabel,U),z={value:p,placeholder:!T};let K=null;return typeof i=="function"?K=i(p):i!=null?K=i:U&&!u?K=s:Array.isArray(p)?K=Cr(p,g,S):K=an(p,g,S),Xe("span",t,{state:z,ref:[n,C],props:[{children:K},d],stateAttributesMapping:Lr})}),oo=o.forwardRef(function(t,n){const{store:r}=Ue(),c=A(r,M.mounted),i=A(r,M.forceMount);return c||i?be.jsx(Pn,{ref:n,...t}):null}),dn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Dr(){return o.useContext(dn)}function Nr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:c}=e,i=Q(c),[,s]=o.useState(!1),a=$e(kr).current,d=$e(Hr).current,m=o.useRef(0),C=o.useRef(!0),p=o.useRef([]),g=o.useRef(null),S=Q(()=>{C.current||(C.current=!0,s(I=>!I))}),T=Q((I,j)=>{d.set(I,j),S()}),U=Q(I=>{d.delete(I),S()}),u=Q(I=>{const j=new Map;return n.current.length=0,r&&(r.current.length=0),I.forEach(h=>{j.set(h.element,{...h.registration.metadata??{},index:h.index}),n.current[h.index]=h.element,r&&(r.current[h.index]=h.registration.label!==void 0?h.registration.label:h.registration.textRef?.current?.textContent??h.element.textContent)}),m.current=n.current.length,j});function z(I){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||I.length<2)return;const j=new MutationObserver(y=>{if(!_r(y))return;let O=null;for(const X of I)if(X.isConnected){if(O&&pn(O,X)>0){j.disconnect(),S();return}O=X}});g.current=j;const h=new Set;for(let y=1;y<I.length;y+=1){const O=Br(I[y-1],I[y]);O&&h.add(O)}h.forEach(y=>j.observe(y,{childList:!0}))}const K=Q(()=>{const[I,j]=Ur(d),h=u(I);z(j),p.current=I,C.current=!1,a.forEach(y=>y(h)),i(h)});Z(()=>(C.current||u(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,u]),Z(()=>{C.current&&K()}),Z(()=>()=>{g.current?.disconnect(),C.current=!0},[]);const V=Q(I=>(a.add(I),()=>{a.delete(I)})),b=o.useMemo(()=>({register:T,unregister:U,subscribeMapChange:V,nextIndexRef:m}),[T,U,V,m]);return be.jsx(dn.Provider,{value:b,children:t})}function Hr(){return new Map}function kr(){return new Set}function Ur(e){const t=new Set,n=[],r=[];e.forEach((i,s)=>{if(!s.isConnected)return;const a=i.index,d={index:a??-1,element:s,registration:i};a===null?r.push(d):a>=0&&(t.add(a),n.push(d))});let c=0;return r.sort((i,s)=>pn(i.element,s.element)),r.forEach(i=>{for(;t.has(c);)c+=1;i.index=c,n.push(i),c+=1}),t.size>0&&n.sort((i,s)=>i.index-s.index),[n,r.map(i=>i.element)]}function Br(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function _r(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 pn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const gn=o.createContext(void 0);function Wr(){const e=o.useContext(gn);if(!e)throw new Error(Rt(59));return e}function mt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},zr={position:"fixed"},so=o.forwardRef(function(t,n){const{anchor:r,className:c,render:i,positionMethod:s,side:a,align:d,sideOffset:m,alignOffset:C,collisionBoundary:p="clipping-ancestors",collisionPadding:g,arrowPadding:S,sticky:T,disableAnchorTracking:U,alignItemWithTrigger:u=!0,collisionAvoidance:z=An,style:K,...V}=t,{store:b,listRef:I,labelsRef:j,alignItemWithTriggerActiveRef:h,selectedItemTextRef:y,valuesRef:O,initialValueRef:X,popupRef:ee,setValue:me,floatingContext:te}=Ue(),w=A(b,M.open),N=A(b,M.mounted),ne=A(b,M.modal),B=A(b,M.value),P=A(b,M.openMethod),q=A(b,M.positionerElement),F=A(b,M.triggerElement),l=A(b,M.isItemEqualToValue),v=A(b,M.transitionStatus),ce=o.useRef(null),_=o.useRef(null),[ue,E]=o.useState(u),L=N&&ue&&P!=="touch";!N&&ue!==u&&E(u),o.useImperativeHandle(h,()=>L),Xn((L||ne)&&w,P==="touch",q,F);const Y=Jn({anchor:r,floatingRootContext:te,positionMethod:s,mounted:N,side:a,sideOffset:m,align:d,alignOffset:C,arrowPadding:S,collisionBoundary:p,collisionPadding:g,sticky:T,disableAnchorTracking:U??L,collisionAvoidance:z,keepMounted:!0}),ie=L?"none":Y.side,ye=L?zr:Y.positionerStyles,H={open:w,side:ie,align:Y.align,anchorHidden:Y.anchorHidden};Z(()=>{b.set("popupSide",Y.side)},[b,Y.side]);const re=b.useStateSetter("positionerElement"),J=Qn(t,H,{styles:ye,transitionStatus:v,props:V,refs:[n,re],hidden:!N,inert:!w}),Re=o.useRef(0),le=Q(ge=>{if(O.current.length===0)return;const fe=Re.current;if(Re.current=ge.size,ge.size===fe)return;const he=Ie(gt);if(fe!==0&&!b.state.multiple&&B!==null&&pt(O.current,B,l)===-1){const oe=X.current,D=oe!=null&&pt(O.current,oe,l)!==-1?oe:null;me(D,he),D===null&&(b.set("selectedIndex",null),y.current=null)}if(fe!==0&&b.state.multiple&&Array.isArray(B)){const G=B.filter(oe=>pt(O.current,oe,l)!==-1);G.length!==B.length&&(me(G,he),G.length===0&&(b.set("selectedIndex",null),y.current=null))}if(w&&L){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const G={height:""};mt(q,G),mt(ee.current,G)}}),ae=o.useMemo(()=>({...Y,side:ie,alignItemWithTriggerActive:L,setControlledAlignItemWithTrigger:E,scrollUpArrowRef:ce,scrollDownArrowRef:_}),[Y,ie,L,E]);return be.jsx(Nr,{elementsRef:I,labelsRef:j,onMapChange:le,children:be.jsxs(gn.Provider,{value:ae,children:[N&&ne&&be.jsx(jn,{inert:On(!w),cutout:F}),J]})})}),ct="base-ui-disable-scrollbar",jt={className:ct,getElement(e){return be.jsx("style",{nonce:e,href:ct,precedence:"base-ui:low",children:`.${ct}{scrollbar-width:none}.${ct}::-webkit-scrollbar{display:none}`})}},Kr=o.createContext(void 0),qr={disableStyleElements:!1};function Yr(){return o.useContext(Kr)??qr}const $r={...Kn,...en},io=o.forwardRef(function(t,n){const{render:r,className:c,style:i,finalFocus:s,...a}=t,{store:d,popupRef:m,onOpenChangeComplete:C,setOpen:p,valueRef:g,firstItemTextRef:S,selectedItemTextRef:T,multiple:U,handleScrollArrowVisibility:u,scrollHandlerRef:z,listRef:K,highlightItemOnHover:V,floatingContext:b}=Ue(),{side:I,align:j,alignItemWithTriggerActive:h,isPositioned:y,setControlledAlignItemWithTrigger:O}=Wr(),X=Zn()!=null,ee=er(),{nonce:me,disableStyleElements:te}=Yr(),w=A(d,M.id),N=A(d,M.open),ne=A(d,M.openMethod),B=A(d,M.mounted),P=A(d,M.popupProps),q=A(d,M.transitionStatus),F=A(d,M.triggerElement),l=A(d,M.positionerElement),v=A(d,M.listElement),ce=o.useRef(!1),_=o.useRef(!1),ue=o.useRef({}),E=Mt(),L=Q(H=>{if(!l||!m.current||!_.current)return;const re=l.style.top==="0px",J=l.style.bottom==="0px";if(ce.current||!h||!re&&!J){u(H);return}const Re=Kt(l),le=et(l.getBoundingClientRect().height,"y",Re),ae=tt(l),ge=dt(l),fe=ge.getComputedStyle(l),he=parseFloat(fe.marginTop),G=parseFloat(fe.marginBottom),oe=zt(ge.getComputedStyle(m.current)),pe=Math.min(ae.documentElement.clientHeight-he-G,oe),D=H.scrollTop,f=ut(H);let R=null;const $=de=>{l.style.height=`${de}px`},x=re?f-D:D,k=Math.min(le+x,pe);if(x<=Pe){const de=Ze(x,0,pe-le);de>0&&$(le+de),H.scrollTop=re?f:0,pe-(le+de)<=Pe&&(ce.current=!0),u(H);return}if(pe-k>Pe)R=re?1/0:0;else if(J&&D<f){const de=le+x-pe;R=D-(x-de)}const Ce=Math.ceil(k);if(Ce!==0&&$(Ce),R!=null){const de=Ze(R,0,ut(H));Math.abs(H.scrollTop-de)>Pe&&(H.scrollTop=de)}Ce>=pe-Pe&&(ce.current=!0),u(H)});o.useImperativeHandle(z,()=>L,[L]),Vt({open:N,ref:m,onComplete(){N&&C?.(!0)}});const Y={open:N,transitionStatus:q,side:I,align:j};Z(()=>{!l||!m.current||Object.keys(ue.current).length||(ue.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[m,l]),Z(()=>{N||h||(_.current=!1,ce.current=!1,mt(l,ue.current))},[N,h,l,m]),Z(()=>{const H=m.current;if(!N||!F||!l||!H||h&&!y||d.state.transitionStatus==="ending")return;if(_.current=!0,H.style.removeProperty("--transform-origin"),!h){E.request(()=>u(v||H));return}const re=Gr(H);try{let J=T.current;J?.isConnected||(J=!M.hasSelectedValue(d.state)&&S.current?.isConnected?S.current:null);const Re=g.current,le=dt(l),ae=le.getComputedStyle(l),ge=le.getComputedStyle(H),fe=tt(F),he=Kt(F),G=at(F.getBoundingClientRect(),he),oe=at(l.getBoundingClientRect(),he),pe=G.height,D=v||H,f=D.scrollHeight,R=parseFloat(ge.borderBottomWidth),$=parseFloat(ae.marginTop)||10,x=parseFloat(ae.marginBottom)||10,k=parseFloat(ae.minHeight)||100,Ce=zt(ge),de=5,Be=5,_e=20,Se=fe.documentElement.clientHeight-$-x,yt=fe.documentElement.clientWidth,Je=Se-G.bottom+pe;let Te,We=ee==="rtl"?G.right-oe.width:G.left,je=0;if(J&&Re){const Ee=at(Re.getBoundingClientRect(),he);Te=at(J.getBoundingClientRect(),he),We=oe.left+(ee==="rtl"?Ee.right-Te.right:Ee.left-Te.left);const qe=Ee.top-G.top+Ee.height/2;je=Te.top-oe.top+Te.height/2-qe}const Ae=Je+je+x+R;let ve=Math.min(Se,Ae);const Oe=Se-$-x,ze=Ae-ve,Ke=yt-Be;l.style.left=`${Ze(We,de,Ke-oe.width)}px`,l.style.height=`${ve}px`,l.style.maxHeight="none",l.style.marginTop=`${$}px`,l.style.marginBottom=`${x}px`,H.style.height="100%";const Ve=ut(D),Ne=ze>=Ve-Pe;Ne&&(ve=Math.min(Se,oe.height)-(ze-Ve));const nt=G.top<_e||G.bottom>Se-_e||Math.ceil(ve)+Pe<Math.min(f,k),rt=(le.visualViewport?.scale??1)!==1&&Xt;if(nt||rt){mt(l,ue.current),O(!1);return}const ot=Math.max(k,ve);if(Ne){const Ee=Math.max(0,Se-Ae);l.style.top=oe.height>=Oe?"0":`${Ee}px`,l.style.height=`${ve}px`,D.scrollTop=ut(D)}else l.style.bottom="0",D.scrollTop=ze;if(Te){const Ee=oe.top,qe=oe.height,Qe=Te.top+Te.height/2,It=Ze(qe>0?(Qe-Ee)/qe*100:50,0,100);H.style.setProperty("--transform-origin",`50% ${It}%`)}(ot===Se||ve>=Ce)&&(ce.current=!0),u(D),V&&d.state.selectedIndex===null&&d.state.activeIndex===null&&K.current[0]!=null&&d.set("activeIndex",0)}finally{re()}},[d,N,l,F,g,S,T,m,u,h,O,E,v,K,V,ee,y]),o.useEffect(()=>{if(!h||!l||!N)return;const H=dt(l);function re(J){p(!1,Ie(Fn,J))}return Vn(H,"resize",re)},[p,h,l,N]);const ie={...v?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${w}-list`},onKeyDown(H){X&&qn.has(H.key)&&H.stopPropagation()},onScroll(H){v||L(H.currentTarget)},...h&&{style:v?{height:"100%"}:jr},className:!v&&h?jt.className:void 0},ye=Xe("div",t,{ref:[n,m],state:Y,stateAttributesMapping:$r,props:[P,ie,rr(q),a]});return be.jsxs(o.Fragment,{children:[!te&&jt.getElement(me),be.jsx(zn,{context:b,modal:!1,disabled:!B,openInteractionType:ne,returnFocus:s,restoreFocus:!0,children:ye})]})});function zt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function ut(e){return fn(e.scrollHeight,e.clientHeight)}function Kt(e){return tr.getScale(e)}function et(e,t,n){return e/n[t]}function at(e,t){return nr({x:et(e.x,"x",t),y:et(e.y,"y",t),width:et(e.width,"x",t),height:et(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[r,c]of qt)n[r]=t.getPropertyValue(r),t.setProperty(r,c,"important");return()=>{for(const[r]of qt){const c=n[r];c?t.setProperty(r,c):t.removeProperty(r)}}}function Xr(e={}){const{guess:t,label:n,metadata:r,textRef:c,index:i}=e,{register:s,unregister:a,subscribeMapChange:d,nextIndexRef:m}=Dr(),C=o.useRef(-1),[p,g]=o.useState(i==null&&t?()=>{if(C.current===-1){const u=m.current;m.current+=1,C.current=u}return C.current}:-1),S=i??p,T=o.useRef(null),U=o.useCallback(u=>{const z=T.current;z&&a(z),T.current=u,u&&s(u,{metadata:r??null,index:i??null,label:n,textRef:c})},[i,s,a,r,n,c]);return Z(()=>{if(i==null)return d(u=>{const z=T.current?u.get(T.current)?.index:null;z!=null&&g(z)})},[i,d]),{ref:U,index:S}}const mn=o.createContext(void 0);function Lt(){const e=o.useContext(mn);if(!e)throw new Error(Rt(57));return e}const lo=o.memo(o.forwardRef(function(t,n){const{render:r,className:c,style:i,value:s=null,label:a,disabled:d=!1,nativeButton:m=!1,...C}=t,p=o.useRef(null),g=Xr({guess:!0,label:a,textRef:p}),{store:S,itemProps:T,setOpen:U,setValue:u,selectionRef:z,typingRef:K,valuesRef:V,multiple:b,selectedItemTextRef:I,disabled:j,readOnly:h}=Ue(),y=j||d,O=A(S,M.isActive,g.index),X=A(S,M.open),ee=A(S,M.isSelected,s),me=A(S,M.isSelectedByFocus,g.index),te=A(S,M.isItemEqualToValue),w=g.index,N=o.useRef(null);Z(()=>{const E=V.current;return E[w]=s,()=>{delete E[w]}},[w,s,V]),Z(()=>{const E=S.state.value;let L=E;b&&Array.isArray(E)&&(L=E.length>0?E[E.length-1]:void 0),L!==void 0&&Ge(s,L,te)&&(S.set("selectedIndex",w),p.current&&(I.current=p.current))},[w,b,te,S,s,I]);const ne=o.useRef("mouse"),B=o.useRef(!1),{getButtonProps:P,buttonRef:q}=Zt({disabled:y,focusableWhenDisabled:!0,native:m,composite:!0}),F={disabled:y,selected:ee,highlighted:O};function l(E){if(j||h)return;const L=S.state.value;if(b){const Y=Array.isArray(L)?L:[],ie=ee?Sr(Y,s,te):[...Y,s];u(ie,Ie(Tt,E))}else u(s,Ie(Tt,E)),U(!1,Ie(Tt,E))}function v(){z.current.dragY=0}const ce={role:"option","aria-selected":ee,tabIndex:X&&O?0:-1,onKeyDown(E){S.set("activeIndex",w),E.key===" "&&K.current&&E.preventDefault()},onClick(E){const L=ne.current!=="touch",Y=E.nativeEvent.pointerType,ie=L&&nn(E.nativeEvent)&&(Y!==void 0||O),ye=L&&!ie&&!B.current;B.current=!1,!(y||ye)&&l(E.nativeEvent)},onPointerEnter(E){ne.current=E.pointerType},onPointerMove(E){if(E.pointerType==="mouse"&&E.buttons===1){const L=z.current;L.dragY+=E.movementY,L.dragY**2>=64&&(L.allowUnselectedMouseUp=!0)}},onPointerDown(E){ne.current=E.pointerType,B.current=!0,v()},onMouseUp(){if(v(),y||ne.current==="touch"||B.current)return;const E=!z.current.allowSelectedMouseUp&&ee,L=!z.current.allowUnselectedMouseUp&&!ee;E||L||(B.current=!0,N.current?.click(),B.current=!1)}},_=Xe("div",t,{ref:[q,n,g.ref,N],state:F,props:[T,ce,C,P]}),ue=o.useMemo(()=>({selected:ee,index:w,textRef:p,selectedByFocus:me}),[ee,w,p,me]);return be.jsx(mn.Provider,{value:ue,children:_})})),co=o.forwardRef(function(t,n){const{selected:r}=Lt();return t.keepMounted||r?be.jsx(Jr,{...t,ref:n}):null}),Jr=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:c,keepMounted:i,...s}=e,{selected:a}=Lt(),d=o.useRef(null),{transitionStatus:m,setMounted:C}=rn(a),g=Xe("span",e,{ref:[t,d],state:{selected:a,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:en});return Vt({open:a,ref:d,onComplete(){a||C(!1)}}),g})),uo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:c,selectedByFocus:i}=Lt(),{firstItemTextRef:s,selectedItemTextRef:a}=Ue(),{render:d,className:m,style:C,...p}=t,g=o.useCallback(T=>{T&&(r===0&&(s.current=T),i&&(a.current=T))},[s,a,r,i]);return Xe("div",t,{ref:[g,n,c],props:p})}));export{jr as L,to as S,Wr as a,jt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,hr as k,vr as l,Ft as m,sn as n,Wt as o,br as p,M as s,Ue as u};
|
package/dashboard/dist/assets/{ServiceStatusPage-DUueam0N.js → ServiceStatusPage-BVQuVdjg.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-BGnq8Ebm.js";import{P as f}from"./ProviderIcon-Caz5PuAm.js";import{E as b}from"./external-link-DPV4VU3m.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,2 +1,2 @@
|
|
|
1
|
-
import{m as ee,r as i,j as e,e as F,c as a,M as ue,J as Z,R as xe,X as me,d as te,l as x,a4 as he,a5 as q}from"./__vite-browser-external-
|
|
1
|
+
import{m as ee,r as i,j as e,e as F,c as a,M as ue,J as Z,R as xe,X as me,d as te,l as x,a4 as he,a5 as q}from"./__vite-browser-external-BGnq8Ebm.js";import{L as ge,I as pe}from"./LocalOnlyNotice-Du0lz657.js";import{S as J}from"./SegmentedControl-BxDiDV4R.js";import{C as fe}from"./ToolbarRootContext-CozJT6Vs.js";import{S as ae}from"./search-Dfak92ZA.js";import{C as be}from"./check-BlxnX5jZ.js";import{P as ye,a as ke,b as _e,c as ve,d as je}from"./PopoverPopup-D9jadD3j.js";import{P as we}from"./ProviderIcon-Caz5PuAm.js";import{H as Ne}from"./HoverTooltip-n1W0z3Wr.js";import{u as Ce}from"./useCurrency-VqF3cy1C.js";import{i as Se}from"./host-mode-Bc_iTzHk.js";import{L as Me}from"./loader-circle-wYFdSyOd.js";import{T as Le}from"./terminal-pbXWBmZM.js";import"./arrow-up-right-BjOtWUVs.js";import"./download-QDaQbQdd.js";import"./composite-Dxmivlk4.js";import"./store-oQZR4d9M.js";const Re=[["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"}]],Te=ee("calendar",Re);const De=[["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"}]],Ie=ee("folder",De),Ee="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 Pe({options:r,value:t,onChange:s,allValue:m="all",allLabel:p,searchPlaceholder:y,emptyLabel:u,ariaLabel:j,disabled:k=!1,className:w=""}){const[f,b]=i.useState(!1),[h,D]=i.useState(""),[g,_]=i.useState(-1),N=i.useRef(null),C=`${i.useId()}-listbox`,U=t===m?p:r.find(l=>l.value===t)?.label??t,S=h.trim().toLowerCase(),I=i.useMemo(()=>S?r.filter(l=>l.label.toLowerCase().includes(S)):r,[r,S]),E=i.useMemo(()=>[{value:m,label:p},...I],[m,p,I]),M=g>=0&&g<E.length?E[g]:null,P=l=>{s(l),b(!1),D(""),_(-1)};i.useEffect(()=>{f&&N.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[f,g]);const L=l=>{if(l.key==="ArrowDown"||l.key==="ArrowUp"){l.preventDefault();const v=l.key==="ArrowDown";_($=>{const R=E.length;return R?v?$>=R-1?0:$+1:$<=0?R-1:$-1:-1});return}if(l.key==="Enter"){const v=M||(S&&I.length?I[0]:null);if(!v)return;l.preventDefault(),P(v.value)}};return e.jsxs(ye,{open:f,onOpenChange:l=>{b(l),_(-1),l||D("")},children:[e.jsxs(ke,{disabled:k,"aria-label":j,className:F("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!==m?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",w),children:[e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:U}),e.jsx(fe,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(_e,{children:e.jsx(ve,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(je,{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(ae,{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":C,"aria-activedescendant":M?`${C}-${g}`:void 0,value:h,onChange:l=>{D(l.target.value),_(-1)},onKeyDown:L,placeholder:y,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:N,id:C,role:"listbox","aria-label":j,className:"max-h-64 overflow-y-auto",children:[E.map((l,v)=>e.jsxs("button",{id:`${C}-${v}`,type:"button",role:"option","aria-selected":t===l.value,"data-active":v===g?"true":void 0,onMouseEnter:()=>_(v),onClick:()=>P(l.value),className:F(Ee,t===l.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",v===g&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:l.label}),t===l.value?e.jsx(be,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},l.value)),I.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:u}):null]})]})})})]})}const Fe="tokentracker-sessions";async function $e(r={}){const t=new URL(`/functions/${Fe}`,window.location.origin);r.from&&t.searchParams.set("from",r.from),r.to&&t.searchParams.set("to",r.to),r.limit&&t.searchParams.set("limit",String(r.limit)),r.refresh&&t.searchParams.set("refresh","1");const s=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),m=await s.json().catch(()=>null);if(!s.ok){const p=s.status===404?a("sessions.error.outdated_app"):`Request failed with HTTP ${s.status}`,y=new Error(m?.error||p);throw y.status=s.status,y}return m}const V=Se(),Oe=[],Q=100,Ae=[{id:"all",label:()=>a("sessions.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"}],re=[{id:"all",days:0,label:()=>a("sessions.filter.range_all")},{id:"7d",days:7,label:()=>a("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>a("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>a("sessions.filter.range_90d")}];function Ue(r){const t=re.find(m=>m.id===r)?.days||0;if(!t)return 0;const s=new Date;return s.setDate(s.getDate()-(t-1)),s.setHours(0,0,0,0),s.getTime()}function qe(r,t){if(!t)return!0;const s=Date.parse(r.ended_at||r.started_at||"");return Number.isFinite(s)?s>=t:!0}function B(r){const t=Array.isArray(r?.model_usage)?r.model_usage.filter(s=>s&&typeof s.model=="string"&&s.model):[];return t.length?t:[{model:r?.model||a("sessions.model.unknown"),total_tokens:Number(r?.own_total_tokens||r?.total_tokens||0)}]}function Be(r){const t=B(r);return t.length===1?t[0].model:t.map(s=>`${s.model} ${x(Number(s.total_tokens||0))}`).join(" · ")}function He(r,t){if(!r)return"—";const s=Date.parse(r);if(!Number.isFinite(s))return"—";try{return new Date(s).toLocaleString(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return new Date(s).toISOString().slice(0,16).replace("T"," ")}}function Ge(r){const t=Number(r);if(!Number.isFinite(t)||t<=0)return null;const s=Math.round(t/6e4);if(s<60)return a("sessions.duration.minutes",{minutes:s});const m=Math.floor(s/60),p=s%60;return a("sessions.duration.hours",{hours:m,minutes:p})}async function X(r){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(r),!0;const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}const Y=te.memo(function({session:t,locale:s,nested:m=!1,childCount:p=0,expanded:y=!1,onToggle:u}){const{currency:j,rate:k}=Ce(),w=String(t.source||"").toUpperCase(),f=Ge(t.duration_ms),b=t.resume_command,h=t.project_key||a("sessions.project.unknown"),D=m||t.thread_kind==="subagent",g=D?t.agent_nickname||t.agent_role||t.title||h:t.title||h,_=!!(t.title&&t.project_key),N=String(t.source||"").toLowerCase()==="grok",C=N&&t.usage_precision?a("sessions.grok.token_breakdown",{input:x(t.input_tokens),cacheRead:x(t.cached_input_tokens),cacheWrite:x(t.cache_creation_input_tokens),output:x(t.output_tokens),reasoning:x(t.reasoning_output_tokens)}):null,U=N&&t.usage_precision?a("sessions.grok.runtime_breakdown",{calls:x(t.model_calls),seconds:(Number(t.api_duration_ms||0)/1e3).toFixed(1),tools:x(t.tool_calls),errors:x(t.error_count)}):null,S=N&&Number(t.context_window_tokens)>0?a("sessions.grok.context_breakdown",{used:x(t.context_tokens_used),window:x(t.context_window_tokens),percent:Number(t.context_usage_percent||0).toFixed(0)}):null,I=t.project_ref?`${t.project_ref}
|
|
2
2
|
${a("sessions.project.copy_hint")}`:void 0,E=async()=>{if(t.project_ref)try{await X(t.project_ref)?q({title:a("sessions.project.copied")}):q({title:a("sessions.project.copy_failed")})}catch{q({title:a("sessions.project.copy_failed")})}},M=L=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(Ne,{text:I,placement:"bottom"}),e.jsx("button",{type:"button",onClick:E,"aria-label":a("sessions.project.copy_aria",{project:h}),className:F("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",L),children:h})]}),P=async()=>{if(b)try{await X(b)?q({title:a("sessions.resume.copied")}):q({title:a("sessions.resume.copy_failed")})}catch{q({title:a("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:F("flex flex-col gap-3 py-4 sm:flex-row sm:items-start",m&&"ml-6 border-l-2 border-oai-gray-200 pl-4 dark:border-oai-gray-800"),children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(we,{provider:w,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!D&&!t.title&&t.project_ref?M("font-medium text-oai-black dark:text-white"):e.jsx("span",{className:"truncate font-medium text-oai-black dark:text-white",children:g}),D?e.jsxs("span",{className:"inline-flex items-center rounded-full bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:bg-sky-500/10 dark:text-sky-300",children:[a("sessions.badge.subagent"),t.agent_role?` · ${t.agent_role}`:""]}):null,t.first_pass?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:a("sessions.badge.first_pass")}):null,N&&t.usage_precision||t.cost_is_partial?e.jsx("span",{className:F("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",t.usage_is_incomplete||t.cost_is_partial?"bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-300":"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-300"),children:t.usage_is_incomplete?a("sessions.badge.partial_usage"):t.cost_is_partial?a("sessions.badge.partial_cost"):t.cost_source==="provider_reported"?a("sessions.badge.reported_cost"):a("sessions.badge.reported_usage")}):null,p?e.jsx("button",{type:"button",onClick:u,"aria-expanded":y,className:"inline-flex items-center rounded-full border border-oai-gray-200 px-2 py-0.5 text-[11px] 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-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:y?a("sessions.thread.collapse",{count:p}):a("sessions.thread.expand",{count:p})}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[_?e.jsxs(e.Fragment,{children:[t.project_ref?M("hover:text-oai-black dark:hover:text-white"):e.jsx("span",{className:"truncate",children:h}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,e.jsx("span",{className:"truncate",children:Be(t)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:He(t.started_at,s)}),f?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:f})]}):null]}),C?e.jsx("div",{className:"mt-1 text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:C}):null,U?e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:U}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:S})]}):null]}):null]})]}),e.jsxs("div",{className:"flex items-start gap-5 pl-[30px] sm:pl-0",children:[e.jsxs("dl",{className:"flex items-start gap-6 text-right",children:[e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.tokens")}),e.jsxs("dd",{title:Number(t.subagent_total_tokens)?a("sessions.thread.tokens_summary",{own:x(t.own_total_tokens),subagents:x(t.subagent_total_tokens),combined:x(t.combined_total_tokens)}):void 0,className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:[x(t.total_tokens),Number(t.subagent_total_tokens)?e.jsxs("span",{className:"block text-[9px] font-normal text-oai-gray-400 dark:text-oai-gray-500",children:["Σ ",x(t.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.cost")}),e.jsxs("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",title:t.cost_is_partial?a("sessions.cost.partial_title"):void 0,children:[t.cost_is_partial?"≥":"",he(t.cost_usd,{currency:j,rate:k})]})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.turns")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.turns)})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.edits")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.edit_turns)})]})]}),e.jsxs("button",{type:"button",onClick:P,disabled:!b,title:b||a("sessions.resume.unavailable"),"aria-label":b?a("sessions.resume.copy_aria",{command:b}):a("sessions.resume.unavailable"),className:F("-mt-0.5 inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",b?"text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white":"cursor-not-allowed text-oai-gray-300 dark:text-oai-gray-600"),children:[e.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:a("sessions.resume.copy")})]})]})]})});function Qe({sessions:r,selectedModel:t,onSelect:s}){const{groups:m,totalTokens:p}=i.useMemo(()=>{const u=new Map;let j=0;for(const k of r)for(const w of B(k)){const f=w.model||a("sessions.model.unknown"),b=Number(w.total_tokens||0),h=u.get(f)||{model:f,count:0,tokens:0};h.count+=1,h.tokens+=b,j+=b,u.set(f,h)}return{groups:[...u.values()].sort((k,w)=>w.tokens-k.tokens),totalTokens:j}},[r]);function y(u){return F("rounded-full border px-2.5 py-1 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u?"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:"ml-6 border-l-2 border-oai-gray-200 py-3 pl-4 dark:border-oai-gray-800",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"mr-1 text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":t==="all",onClick:()=>s("all"),className:y(t==="all"),children:a("sessions.thread.model_all",{count:r.length,tokens:x(p)})}),m.map(u=>e.jsx("button",{type:"button","aria-pressed":t===u.model,onClick:()=>s(u.model),className:y(t===u.model),children:a("sessions.thread.model_item",{model:u.model,count:u.count,tokens:x(u.tokens)})},u.model))]})})}function ct(){const[r,t]=i.useState(null),[s,m]=i.useState(null),[p,y]=i.useState(!0),[u,j]=i.useState(!1),[k,w]=i.useState("all"),[f,b]=i.useState("all"),[h,D]=i.useState("all"),[g,_]=i.useState(""),[N,C]=i.useState(Q),[U,S]=i.useState(()=>new Set),[I,E]=i.useState(()=>new Map),M=i.useRef(0),{resolvedLocale:P}=ue(),L=i.useCallback(async(o=!1)=>{const d=++M.current;o?j(!0):y(!0),m(null);try{const n=await $e({refresh:o});d===M.current&&t(n)}catch(n){d===M.current&&m(n?.message||String(n))}finally{d===M.current&&(y(!1),j(!1))}},[]);i.useEffect(()=>{V||Z()?L(!1):y(!1)},[L]);const l=r?.sessions||Oe,v=i.useMemo(()=>{const o=new Set,d=[];for(const n of l){const c=n.project_key;!c||o.has(c)||(o.add(c),d.push({value:c,label:c}))}return d.sort((n,c)=>n.label.localeCompare(c.label))},[l]),$=i.useDeferredValue(g),R=i.useMemo(()=>{const o=$.trim().toLowerCase(),d=Ue(f);return l.filter(n=>{if(k!=="all"&&n.source!==k||h!=="all"&&n.project_key!==h||!qe(n,d))return!1;if(!o)return!0;const c=B(n).map(T=>T.model).join(" ");return`${n.title||""} ${n.project_key||""} ${c} ${n.agent_nickname||""} ${n.agent_role||""} ${n.project_ref||""} ${n.session_id||""}`.toLowerCase().includes(o)})},[l,k,h,f,$]),O=i.useMemo(()=>{const o=new Set(R.map(c=>c.session_hash)),d=new Map,n=[];for(const c of R){const A=c.root_session_hash||c.parent_session_hash;if(c.parent_session_hash&&A&&o.has(A)){const T=d.get(A)||[];T.push(c),d.set(A,T)}else n.push(c)}return{roots:n,childrenByRoot:d,foldedCount:R.length-n.length}},[R]),K=k!=="all"||f!=="all"||h!=="all"||g.trim()!=="";i.useEffect(()=>{C(Q),S(new Set),E(new Map)},[k,h,f,$,l]);const z=i.useMemo(()=>O.roots.slice(0,N),[O.roots,N]),H=O.roots.length>z.length,G=i.useCallback(()=>C(o=>o+Q),[]),se=i.useCallback(o=>{S(d=>{const n=new Set(d);return n.has(o)?n.delete(o):n.add(o),n})},[]),oe=i.useCallback((o,d)=>{E(n=>{const c=new Map(n);return d==="all"?c.delete(o):c.set(o,d),c})},[]),W=i.useRef(null);i.useEffect(()=>{if(!H||typeof IntersectionObserver>"u")return;const o=W.current;if(!o)return;const d=new IntersectionObserver(n=>{n.some(c=>c.isIntersecting)&&G()},{rootMargin:"400px"});return d.observe(o),()=>d.disconnect()},[H,G]);const ne=i.useMemo(()=>Ae.map(o=>({id:o.id,label:o.label()})),[P]),ie=i.useMemo(()=>re.map(o=>({id:o.id,label:o.label()})),[P]),le=Number(r?.session_count)>Number(r?.returned_count);return!V&&!Z()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(ge,{})}):e.jsx("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:a("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("sessions.page.subtitle")})]}),e.jsx("button",{type:"button",onClick:()=>{L(!0)},disabled:u||p,"aria-label":a("sessions.page.refresh"),title:a("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(xe,{className:F("h-4 w-4",u&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(J,{ariaLabel:a("sessions.filter.source_aria"),options:ne,value:k,onChange:w}),e.jsx(J,{className:"pl-2",ariaLabel:a("sessions.filter.range_aria"),leading:e.jsx(Te,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),options:ie,value:f,onChange:b}),e.jsx(Pe,{options:v,value:h,onChange:D,allLabel:a("sessions.filter.project_all"),searchPlaceholder:a("sessions.filter.project_search"),emptyLabel:a("sessions.filter.project_empty"),ariaLabel:a("sessions.filter.project_aria")}),e.jsxs("div",{className:"relative w-72 max-w-full",children:[e.jsx(ae,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(pe,{type:"search",value:g,onChange:o=>_(o.target.value),onKeyDown:o=>{o.key==="Escape"&&g&&(o.preventDefault(),_(""))},"aria-label":a("sessions.action.search_aria"),placeholder:a("sessions.search.placeholder"),className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>_(""),"aria-label":a("sessions.action.search_clear"),"aria-hidden":!g,tabIndex:g?0:-1,className:F("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",g?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(me,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:O.foldedCount>0?a("sessions.thread.result_count",{roots:O.roots.length,subagents:O.foldedCount}):a("sessions.filter.result_count",{filtered:R.length,total:l.length})})]}),le?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.truncated",{shown:r.returned_count,total:r.session_count})}):null,s&&!r?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:a("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx("button",{type:"button",onClick:()=>{L(!1)},className:"mt-4 inline-flex h-8 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:a("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(Me,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("sessions.loading")]}):R.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:K?a("sessions.empty.filtered_title"):a("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:K?a("sessions.empty.filtered_body"):a("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[s?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:a("shared.error.prefix",{error:s})}):null,e.jsx("ul",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:z.map(o=>{const d=O.childrenByRoot.get(o.session_hash)||[],n=U.has(o.session_hash),c=I.get(o.session_hash)||"all",A=c==="all"?d:d.filter(function(ce){return B(ce).some(de=>de.model===c)});return e.jsxs(te.Fragment,{children:[e.jsx(Y,{session:o,locale:P,childCount:d.length,expanded:n,onToggle:()=>se(o.session_hash)}),n&&d.length?e.jsx(Qe,{sessions:d,selectedModel:c,onSelect:T=>oe(o.session_hash,T)}):null,n?A.map(T=>e.jsx(Y,{session:T,locale:P,nested:!0},T.session_hash)):null]},o.session_hash)})}),H?e.jsx("div",{ref:W,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:G,className:"inline-flex h-8 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:a("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.privacy")})]})})})}export{ct as SessionsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-BGnq8Ebm.js","assets/__vite-browser-external-CvMMIjhi.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{m as I,j as t,e as _,c as n,a as ue,r as u,ao as ge,aU as pe,au as he,av as me,a8 as J,aV as be,aW as fe,u as xe,d as M,a0 as ye,M as X,n as $,aX as ve,aY as ke,U as Q,aZ as je,x as Se,a_ as we,a$ as Ne,b0 as Ce,b1 as Ee,b2 as Pe,b3 as Ae,b4 as Le,b5 as ee,L as Oe,R as _e,b6 as Te,b7 as Ie,a5 as V,_ as Ge,h as Re,f as De,b8 as Ue,b9 as Me,ax as He}from"./__vite-browser-external-BGnq8Ebm.js";import{a as Fe,b as B,s as $e,K as Ve,P as Be,D as Ke,c as ze,S as qe,v as We,u as Ze,C as Ye}from"./sortable.esm-B9xy66_v.js";import{a as Je}from"./modifiers.esm-CPljwVhN.js";import{u as Xe,L as K}from"./use-limits-display-prefs-B-pbwUS8.js";import{P as Qe}from"./ProviderIcon-Caz5PuAm.js";import{a as z,l as q}from"./limits-providers-BUoquSA-.js";import{m as te}from"./react-yHv9MTUA.js";import{a as L,T as k,b as x,S as G,u as R}from"./Controls-vMzEZzej.js";import{P as et,u as tt,a as nt}from"./use-session-efficiency-pref-BScvtS8F.js";import{C as at}from"./check-BlxnX5jZ.js";import{C as st}from"./copy-CIsWjLY5.js";import{A as ne}from"./index-Cjs5stC0.js";import{u as it}from"./useCurrency-VqF3cy1C.js";import{u as ot}from"./useTokenFormat-Cgub4MXu.js";import{S as H}from"./Select-B5o-1sEl.js";import{I as rt}from"./info-DpVOhXZI.js";import{C as lt}from"./ConfirmModal-C7ABSI-O.js";import{A as ct}from"./arrow-up-right-BjOtWUVs.js";import{D as dt}from"./download-QDaQbQdd.js";import{i as ut}from"./host-mode-Bc_iTzHk.js";import"./Card-COWo-ClV.js";import"./ToolbarRootContext-CozJT6Vs.js";import"./composite-Dxmivlk4.js";import"./SelectItemText-CiA6L7Wk.js";import"./DialogTitle-_ahf0z8b.js";import"./store-oQZR4d9M.js";import"./DialogDescription-ryGYdQjX.js";const gt=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],pt=I("flask-conical",gt);const ht=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],mt=I("grip-vertical",ht);const bt=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],ft=I("languages",bt);const xt=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yt=I("log-out",xt);const vt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],kt=I("palette",vt);const jt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],St=I("user-round",jt),wt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Nt({checked:e,onChange:a,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:a,className:_("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:_("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ct({id:e,visible:a,onToggle:s}){const{attributes:i,listeners:o,setNodeRef:r,transform:l,transition:c,isDragging:d}=Ze({id:e}),h={transform:Ye.Transform.toString(l)||void 0,transition:c,zIndex:d?20:void 0};return t.jsxs("div",{ref:r,style:h,className:_("flex items-center gap-3 py-2 rounded-md select-none touch-none","cursor-grab active:cursor-grabbing","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",d&&"relative bg-oai-gray-100 dark:bg-oai-gray-800"),...i,...o,children:[t.jsx(mt,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),z(e)?t.jsx(Qe,{provider:z(e),size:18,className:_("pointer-events-none",wt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:q(e)}),t.jsx("div",{onPointerDown:p=>p.stopPropagation(),children:t.jsx(Nt,{checked:a,onChange:s,ariaLabel:`${n("limits.settings.toggle_visible")}: ${q(e)}`})})]})}function Et({prefs:e}){const{order:a,visibility:s,toggle:i,moveToward:o}=e,r=Fe(B(Be,{activationConstraint:{distance:6}}),B(Ve,{coordinateGetter:$e})),l=({active:c,over:d})=>{d&&c.id!==d.id&&o(c.id,d.id)};return t.jsx(Ke,{sensors:r,collisionDetection:ze,modifiers:[Je],onDragEnd:l,children:t.jsx(qe,{items:a,strategy:We,children:t.jsx("div",{className:"flex flex-col",children:a.map(c=>t.jsx(Ct,{id:c,visible:s[c]!==!1,onToggle:()=>i(c)},c))})})})}function Pt(e){if(!e||typeof e!="object")return"";const a=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=a.full_name||a.name||s.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function At(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Lt(e){const a=typeof e=="string"?e.trim():"";if(!a)return null;const s=a.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=a.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function F(e,a){console.warn(`[tokentracker] settings ${e}:`,a)}function Ot(e,a,s){const[i,o]=u.useState(()=>ge()),r=a&&s&&pe(),l=u.useCallback(async()=>{const c=!i;if(he(c),o(c),!!c)try{await me(()=>e())}catch(d){F("cloud sync",d)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function _t(e){const[a,s]=u.useState(!1),[i,o]=u.useState(!1),[r,l]=u.useState(!1),[c,d]=u.useState(!1),[h,p]=u.useState(null),[g,m]=u.useState(!1),[v,j]=u.useState(""),[A,y]=u.useState(!1),[w,N]=u.useState(""),[b,S]=u.useState(""),[O,f]=u.useState(!1),[E,D]=u.useState(null),T=u.useMemo(()=>Pt(e),[e]),le=u.useMemo(()=>At(e),[e]),ce=u.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),de=u.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:p,setGithubUrl:N,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:y}),[]);return{anonymousOn:i,customDisplayName:h,displayName:T,editingGithub:O,editingName:g,email:le,githubError:E,githubInput:b,githubUrl:w,loadSetters:de,nameInput:v,profileLoading:r,profileSaving:c,publicProfileOn:a,setAnonymousOn:o,setCustomDisplayName:p,setEditingGithub:f,setEditingName:m,setGithubError:D,setGithubInput:S,setGithubUrl:N,setNameInput:j,setProfileLoading:l,setProfileSaving:d,setPublicProfileOn:s,setShowGithubOn:y,showGithubOn:A,userId:ce}}function Tt(e,a,s){u.useEffect(()=>{if(!a)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await J({getAccessToken:e});if(!i||!o)return;const r=await be({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){F("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,a,s])}function It(e,a){return u.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(a.profileSaving)return!1;a.setProfileSaving(!0);try{const l=await J({getAccessToken:e});if(!l)return!1;const c=await fe({accessToken:l,...s});return r?.(c),!0}catch(l){return o?o(l):F(i||"mutate profile",l),!1}finally{a.setProfileSaving(!1)}},[e,a])}function Gt(e,a){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:a.handleAnonymousToggle,handleSaveName:a.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:a.startEditingName}}function Rt(e,a){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:a.handleSaveGithub,handleShowGithubToggle:a.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:a.startEditingGithub}}function Dt(e,a){const s=u.useCallback(async()=>{const o=!e.publicProfileOn;await a({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[a,e]);return{handleAnonymousToggle:u.useCallback(async()=>{const o=!e.anonymousOn;await a({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[a,e]),handlePublicProfileToggle:s}}function Ut(e,a,s){const i=u.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await a({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[a,e,s]),o=u.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function Mt(e,a){const s=u.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await a({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[a,e]),i=u.useCallback(async()=>{const r=Lt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(n("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await a({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||n("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[a,e]),o=u.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function Ht(){const e=ue(),a=_t(e.user),s=Ot(e.getAccessToken,e.enabled,e.signedIn);Tt(e.getAccessToken,e.signedIn,a.loadSetters);const i=It(e.getAccessToken,a),o=Dt(a,i),r=Ut(a,i,e.refreshDisplayName),l=Mt(a,i);return{...e,...s,email:a.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:a.userId,name:Gt(a,{...o,...r}),github:Rt(a,l),profileLoading:a.profileLoading,profileSaving:a.profileSaving,publicProfileOn:a.publicProfileOn}}function ae({disabled:e,onCancel:a,onSave:s,saveLabel:i=n("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),t.jsx("button",{type:"button",onClick:a,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:n("settings.account.cancel")})]})}function Ft({nameInput:e,setEditingName:a,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&a(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:n("settings.account.displayName")}),t.jsx(ae,{disabled:i||!e.trim(),onCancel:()=>a(!1),onSave:o,saveLabel:i?n("settings.account.saving"):void 0})]})}function $t({githubError:e,githubInput:a,handleSaveGithub:s,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:a,onChange:c=>{l(c.target.value),e&&r(null)},onKeyDown:c=>{c.key==="Enter"&&s(),c.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:n("settings.account.githubUrlPlaceholder")}),t.jsx(ae,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?n("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function se({disabled:e=!1,label:a,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(et,{className:"h-3.5 w-3.5","aria-hidden":!0}),a]})}function ie({actions:e,editing:a,editor:s,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),a?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),a?null:e]})})}function Vt({name:e}){const a=e.anonymousOn?n("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(se,{disabled:e.anonymousOn,label:n("settings.account.edit"),onClick:e.startEditingName,title:a}),t.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:n("settings.account.displayName")})]})}function Bt({name:e}){const{anonymousOn:a,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:c,profileLoading:d,profileSaving:h,setEditingName:p,setNameInput:g,startEditingName:m}=e,v=a?n("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(ie,{label:n("settings.account.displayName"),editing:o,hint:v,editor:t.jsx(Ft,{nameInput:c,setEditingName:p,setNameInput:g,profileSaving:h,handleSaveName:l}),actions:t.jsx(Vt,{name:e})})}function Kt({github:e}){const{editingGithub:a,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:c,profileSaving:d,setEditingGithub:h,setGithubError:p,setGithubInput:g,showGithubOn:m,startEditingGithub:v}=e;return t.jsx(t.Fragment,{children:t.jsx(ie,{label:n("settings.account.githubUrl"),editing:a,hint:o||n("settings.account.githubUrlHint"),editor:t.jsx($t,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:d,setEditingGithub:h,setGithubError:p,setGithubInput:g}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(se,{label:n("settings.account.edit"),onClick:v}),t.jsx(k,{checked:m,onChange:l,disabled:c||d,ariaLabel:n("settings.account.githubUrl")})]})})})}function zt(){const{openLoginModal:e}=xe();return t.jsx(L,{title:n("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:n("settings.account.signIn")})]})})}function qt({name:e,github:a}){return t.jsxs(t.Fragment,{children:[t.jsx(Bt,{name:e}),t.jsx(Kt,{github:a})]})}function Wt(){const e=Ht();return e.enabled?e.signedIn?t.jsxs(L,{title:n("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Yt,{onSignOut:e.signOut}),children:[t.jsx(Zt,{userId:e.userId}),t.jsx(Jt,{settings:e}),t.jsx(Xt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Qt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(zt,{}):null}function Zt({userId:e}){const[a,s]=M.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:n("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":n("settings.account.copyUserId"),children:[a?t.jsx(at,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(st,{className:"h-3.5 w-3.5","aria-hidden":!0}),a?n("settings.account.copied"):n("settings.account.copy")]})]})}function Yt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(yt,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.signOut")]})}function Jt({settings:e}){return e.showLocalCloudSync?t.jsx(x,{label:n("settings.account.cloudSync"),hint:n("settings.account.cloudSyncHint"),control:t.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:n("settings.account.cloudSync")})}):null}function Xt({checked:e,disabled:a,onChange:s}){return t.jsx(x,{label:n("settings.account.publicProfile"),hint:n("settings.account.publicProfileHint"),control:t.jsx(k,{checked:e,onChange:s,disabled:a,ariaLabel:n("settings.account.publicProfile")})})}function Qt({visible:e,name:a,github:s}){return t.jsx(ne,{initial:!1,children:e?t.jsx(te.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(qt,{name:a,github:s})},"public-profile-fields"):null})}function en(){return[{value:"light",label:n("settings.appearance.theme.light"),Icon:ve},{value:"dark",label:n("settings.appearance.theme.dark"),Icon:ke},{value:"system",label:n("settings.appearance.theme.system"),Icon:Q}]}function tn(){return[{value:we,label:n("settings.appearance.language.system")},{value:Ne,label:n("settings.appearance.language.english")},{value:Ce,label:n("settings.appearance.language.chinese")},{value:Ee,label:n("settings.appearance.language.traditional_chinese")},{value:Pe,label:n("settings.appearance.language.japanese")},{value:Ae,label:n("settings.appearance.language.korean")},{value:Le,label:n("settings.appearance.language.german")}]}function nn(e){if(!e)return null;try{const a=new Date(e);return Number.isNaN(a.getTime())?null:a.toLocaleString()}catch{return null}}function an(e,a){const s=n(`settings.appearance.currency.rate_source.${e}`),i=nn(a),o=i?n("settings.appearance.currency.rate_updated",{when:i}):n("settings.appearance.currency.rate_never");return`${s} · ${o}`}function sn({locale:e,setLocale:a}){const s=tn();return t.jsx(H,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(ft,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function on({currency:e,setCurrency:a}){const s=je().map(i=>({value:i.code,label:n(i.labelKey)}));return t.jsx(H,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function rn({currency:e,rate:a,rateSource:s,rateFetchedAt:i}){if(e===Se)return t.jsx(t.Fragment,{children:n("settings.appearance.currency.hint")});const o=an(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${a.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(rt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function ln(){const{theme:e,setTheme:a}=ye(),{locale:s,setLocale:i}=X(),{currency:o,rate:r,rateSource:l,rateFetchedAt:c,setCurrency:d}=it(),{mode:h,setMode:p}=ot();return t.jsxs(L,{title:n("settings.section.appearance"),children:[t.jsx(x,{label:n("settings.appearance.theme.label"),hint:n("settings.appearance.theme.hint"),control:t.jsx(G,{options:en(),value:e,onChange:a})}),t.jsx(x,{label:n("settings.appearance.language.label"),hint:n("settings.appearance.language.hint"),control:t.jsx(sn,{locale:s,setLocale:i})}),t.jsx(x,{label:n("settings.appearance.currency.label"),hint:t.jsx(rn,{currency:o,rate:r,rateSource:l,rateFetchedAt:c}),control:t.jsx(on,{currency:o,setCurrency:d})}),t.jsx(x,{label:n("settings.appearance.token_format.label"),hint:n("settings.appearance.token_format.hint"),control:t.jsx(G,{options:[{value:$.COMPACT,label:n("settings.appearance.token_format.compact")},{value:$.FULL,label:n("settings.appearance.token_format.full")}],value:h,onChange:p})})]})}function U({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:n(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:n("qpd.card.badge")})]})}function cn(){const{enabled:e,toggle:a}=tt(),{enabled:s,toggle:i}=nt(),{available:o,settings:r,setSetting:l}=R(),c=o&&!!r?.dynamicIslandSupported,d=!!r?.dynamicIslandEnabled;return t.jsxs(L,{title:n("settings.section.labs"),children:[c&&t.jsxs(t.Fragment,{children:[t.jsx(x,{label:t.jsx(U,{labelKey:"settings.labs.island.label"}),hint:n("settings.labs.island.hint"),control:t.jsx(k,{checked:d,onChange:()=>l("dynamicIslandEnabled",!d),ariaLabel:n("settings.labs.island.aria")})}),d&&t.jsx(x,{label:n("settings.labs.island_hide_menubar.label"),hint:n("settings.labs.island_hide_menubar.hint"),control:t.jsx(k,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:n("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(x,{label:t.jsx(U,{labelKey:"settings.labs.qpd.label"}),hint:n("settings.labs.qpd.hint"),control:t.jsx(k,{checked:e,onChange:a,ariaLabel:n("settings.labs.qpd.aria")})}),t.jsx(x,{label:t.jsx(U,{labelKey:"settings.labs.sessions.label"}),hint:n("settings.labs.sessions.hint"),control:t.jsx(k,{checked:s,onChange:i,ariaLabel:n("settings.labs.sessions.aria")})})]})}function dn(){const{available:e,settings:a,setSetting:s,runAction:i}=R();if(!e)return null;const o=ee(),r=!!a?.launchAtLogin,l=a?.toastOnReset!==!1,c=a?.confettiOnReset!==!1,d=a?.launchAtLoginSupported!==!1,h=a?.autoUpdateEnabled!==!1,p=a?.updateStatus||null,g=!!a?.updateBusy,m=!!a?.isSyncing;return t.jsxs(L,{title:n("settings.section.menubar"),children:[o?null:t.jsxs(t.Fragment,{children:[t.jsx(x,{label:n("settings.menubar.appearance"),hint:n("settings.menubar.appearanceHint"),control:t.jsxs(Oe,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n("settings.menubar.appearanceLink"),t.jsx(ct,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(x,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:l,onChange:()=>s("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(x,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:c,onChange:()=>s("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),d?t.jsx(x,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:t.jsx(k,{checked:r,onChange:()=>s("launchAtLogin",!r),ariaLabel:n("settings.menubar.launchAtLogin")})}):null,t.jsx(x,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(_e,{className:_("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),t.jsx(x,{label:n("settings.menubar.autoUpdate"),hint:n("settings.menubar.autoUpdateHint"),control:t.jsx(k,{checked:h,onChange:()=>s("autoUpdateEnabled",!h),ariaLabel:n("settings.menubar.autoUpdate")})}),t.jsx(x,{label:n("settings.menubar.updates"),hint:p||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(dt,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function un(e,a){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(a);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,c=o[r]||0;if(l<c)return!0;if(l>c)return!1}return!1}function gn(){const{available:e,settings:a,runAction:s}=R(),i=e&&a?.version,o=a?.platform||"macos",[r,l]=M.useState(!1),[c,d]=M.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:h}=X(),p="0.96.1",g=async()=>{l(!0);try{const y=await fetch("https://api.github.com/repos/xiufengsun/TokenTracker/releases/latest");if(!y.ok)throw new Error("Failed to fetch");const w=await y.json(),N=w.tag_name;un(p,N)?d({open:!0,latestVersion:N,htmlUrl:w.html_url}):V({title:n("settings.menubar.updates.upToDate")})}catch(y){console.error("Check updates failed:",y),V({title:n("settings.menubar.updates.failed")})}finally{l(!1)}},m=n("settings.menubar.updates.modalTitle"),v=n("settings.menubar.updates.modalDescription",{version:c.latestVersion}),j=n("settings.menubar.updates.modalConfirm"),A=n("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:o==="windows"?n("settings.menubar.updates.footerCore",{version:a.version}):n("settings.menubar.updates.footerCombined",{barVersion:a.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:n("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:g,disabled:r,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:r?n("settings.menubar.updates.checking"):n("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Te,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.footer.statusPage")]})]}),t.jsx(lt,{open:c.open,title:m,description:v,confirmLabel:j,cancelLabel:A,onConfirm:()=>{window.open(c.htmlUrl,"_blank"),d(y=>({...y,open:!1}))},onCancel:()=>d(y=>({...y,open:!1}))})]})}const pn=()=>[{value:"system",label:n("settings.network.mode.system")},{value:"manual",label:n("settings.network.mode.manual")},{value:"off",label:n("settings.network.mode.off")}],hn=()=>[{value:"http",label:n("settings.network.protocol.http")},{value:"https",label:n("settings.network.protocol.https")},{value:"socks5",label:n("settings.network.protocol.socks5")}],W="w-full rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white";function Z(e){const a={},s=String(e.host||"").trim();(!s||/:\/\//.test(s)||s.includes("/"))&&(a.host=n("settings.network.error.host"));const i=String(e.port??"").trim(),o=Number(i);return(!i||!/^\d+$/.test(i)||!Number.isInteger(o)||o<1||o>65535)&&(a.port=n("settings.network.error.port")),a}function mn({proxySettings:e}){const{config:a,save:s,testConnection:i}=e,[o,r]=u.useState(()=>({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})),[l,c]=u.useState({}),[d,h]=u.useState(!1),[p,g]=u.useState(""),[m,v]=u.useState(null),[j,A]=u.useState(!1),[y,w]=u.useState(null);u.useEffect(()=>{r({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})},[a.mode,a.protocol,a.host,a.port]);const N=u.useMemo(()=>a.effective==="manual"?n("settings.network.effective.manual"):a.effective==="env"?n("settings.network.effective.env"):a.effective==="system"?n("settings.network.effective.system"):a.effective==="blocked"?n("settings.network.effective.blocked"):n("settings.network.effective.none"),[a.effective]),b=f=>{r(E=>({...E,...f})),c({}),g(""),v(null),w(null)},S=async()=>{if(o.mode==="manual"){const f=Z(o);if(Object.keys(f).length){c(f);return}}h(!0),g(""),v(null);try{await s(o),g("saved")}catch(f){g("error"),v(f)}finally{h(!1)}},O=async()=>{const f=Z(o);if(Object.keys(f).length){c(f);return}A(!0),w(null);try{const E=await i(o);w(E)}catch(E){w({ok:!1,error:E?.message||String(E)})}finally{A(!1)}};return t.jsxs(L,{title:n("settings.section.network"),subtitle:N,children:[a.applyError?t.jsx("p",{role:"alert",className:"mb-3 text-xs text-red-600 dark:text-red-400",children:n("settings.network.apply_error",{error:a.applyError})}):null,t.jsx(x,{label:n("settings.network.mode.label"),hint:n("settings.network.mode.hint"),control:t.jsx(G,{options:pn(),value:o.mode,onChange:f=>b({mode:f})})}),t.jsx(ne,{initial:!1,children:o.mode==="manual"?t.jsxs(te.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:[t.jsx(x,{label:n("settings.network.protocol.label"),control:t.jsx(H,{value:o.protocol,onValueChange:f=>b({protocol:f}),options:hn(),ariaLabel:n("settings.network.protocol.label"),className:"px-2.5 py-1.5 text-xs font-medium"})}),t.jsx(x,{label:n("settings.network.host.label"),hint:l.host,control:t.jsx("input",{type:"text",value:o.host,onChange:f=>b({host:f.target.value}),placeholder:n("settings.network.host.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.host?!0:void 0,"aria-label":n("settings.network.host.label"),className:W})}),t.jsx(x,{label:n("settings.network.port.label"),hint:l.port,control:t.jsx("input",{type:"text",inputMode:"numeric",value:o.port,onChange:f=>b({port:f.target.value}),placeholder:n("settings.network.port.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.port?!0:void 0,"aria-label":n("settings.network.port.label"),className:W})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 py-3",children:[t.jsx("button",{type:"button",onClick:O,disabled:j||d,className:"rounded-md border border-oai-gray-200 px-3 py-1.5 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:j?n("settings.network.test.testing"):n("settings.network.test")}),t.jsx("button",{type:"button",onClick:S,disabled:d||j,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:d?n("settings.network.saving"):n("settings.network.save")})]}),y?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:y.ok?n("settings.network.test.ok",{status:String(y.status??"")}):n("settings.network.test.fail",{error:y.error||""})}):null]},"manual-proxy-fields"):t.jsx("div",{className:"flex justify-end py-3",children:t.jsx("button",{type:"button",onClick:S,disabled:d,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:d?n("settings.network.saving"):n("settings.network.save")})},"non-manual-save")}),p==="saved"?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.network.saved")}):null,p==="error"?t.jsx("p",{role:"alert",className:"py-2 text-xs text-red-600 dark:text-red-400",children:m?.unprotected?n("settings.network.save_error_unprotected",{error:m?.message||String(m||"")}):n("settings.network.save_error",{error:m?.message||String(m||"")})}):null]})}const oe="/functions/tokentracker-proxy-config",bn="/functions/tokentracker-proxy-test",fn={mode:"system",protocol:"http",host:"",port:"",effective:"none",applyError:null};function re(e){return!e||typeof e.mode!="string"?null:{mode:e.mode,protocol:typeof e.protocol=="string"?e.protocol:"http",host:typeof e.host=="string"?e.host:"",port:e.port==null||e.port===0?"":String(e.port),effective:typeof e.effective=="string"?e.effective:"none",applyError:typeof e.applyError=="string"&&e.applyError.trim()?e.applyError:null}}async function xn(){const e=await fetch(oe,{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!e.ok)return null;const a=await e.json().catch(()=>null);return re(a)}async function Y(){const{getLocalApiAuthHeaders:e}=await Ge(async()=>{const{getLocalApiAuthHeaders:a}=await import("./__vite-browser-external-BGnq8Ebm.js").then(s=>s.d8);return{getLocalApiAuthHeaders:a}},__vite__mapDeps([0,1]));return e()}function yn(){const[e,a]=u.useState(!1),[s,i]=u.useState(!0),[o,r]=u.useState(fn);u.useEffect(()=>{if(!ut()){a(!1),i(!1);return}let d=!1;return(async()=>{try{const h=await xn();if(d)return;if(!h){a(!1),i(!1);return}r(h),a(!0),i(!1)}catch{d||(a(!1),i(!1))}})(),()=>{d=!0}},[]);const l=u.useCallback(async d=>{const h=await Y(),p=await fetch(oe,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({mode:d.mode,protocol:d.protocol,host:d.host,port:d.port===""?0:Number(d.port)})}),g=await p.json().catch(()=>null);if(!p.ok){const v=g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`;throw new Error(v)}const m=re(g);if(m&&r(m),g&&g.ok===!1){const v=g&&typeof g.applyError=="string"&&g.applyError||g&&typeof g.error=="string"&&g.error||`HTTP ${p.status}`,j=new Error(v);throw g.unprotected===!0&&(j.unprotected=!0),j}return m||g},[]),c=u.useCallback(async d=>{const h=await Y(),p=await fetch(bn,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({protocol:d.protocol,host:d.host,port:d.port===""?0:Number(d.port)})}),g=await p.json().catch(()=>null);if(!g||typeof g.ok!="boolean")throw new Error(g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`);return g},[]);return{available:e,loading:s,config:o,save:l,testConnection:c}}const C={APPEARANCE:"appearance",NATIVE_APP:"native-app",NETWORK:"network",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"},P={PERSONAL:"personal",APP:"app",DEVELOPER:"developer"};function vn({prefs:e}){return t.jsx(G,{options:[{value:K.USED,label:n("limits.settings.display_mode_used")},{value:K.REMAINING,label:n("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Wn(){const e=Xe(),{available:a,settings:s,setSetting:i}=R(),o=yn(),{available:r}=o,l=s?.toastOnReset!==!1,c=s?.confettiOnReset!==!1,d=ee()||s?.platform==="windows",[h,p]=Re(),g=De(),m=h.get("section"),j=Object.values(C).includes(m)&&(m!==C.NATIVE_APP||a)&&(m!==C.NETWORK||r)?m:C.APPEARANCE,A=b=>{const S=new URLSearchParams(h);b===C.APPEARANCE?S.delete("section"):S.set("section",b),p(S,{replace:!0})},y=[{id:C.APPEARANCE,label:n("settings.section.appearance"),description:n("settings.section.appearance.description"),group:P.PERSONAL,Icon:kt,content:t.jsx(ln,{})},...a?[{id:C.NATIVE_APP,label:n("settings.section.menubar"),description:n("settings.section.menubar.description"),group:P.APP,Icon:Q,content:t.jsx(dn,{})}]:[],...r?[{id:C.NETWORK,label:n("settings.section.network"),description:n("settings.section.network.description"),group:P.APP,Icon:Ue,content:t.jsx(mn,{proxySettings:o})}]:[],{id:C.ACCOUNT,label:n("settings.section.account"),description:n("settings.section.account.description"),group:P.PERSONAL,Icon:St,content:t.jsx(Wt,{})},{id:C.LIMITS,label:n("settings.section.limits"),description:n("settings.section.limits.description"),group:P.APP,Icon:Me,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(L,{title:n("settings.section.limits"),children:[t.jsx(x,{label:n("limits.settings.display_mode_label"),control:t.jsx(vn,{prefs:e})}),d?null:t.jsxs(t.Fragment,{children:[t.jsx(x,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:l,disabled:!a,onChange:()=>i("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(x,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:c,disabled:!a,onChange:()=>i("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),t.jsx(x,{label:n("settings.limits.showSubscriptions"),hint:n("settings.limits.showSubscriptionsHint"),control:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{type:"button",onClick:()=>g("/limits?openSubscriptions=1"),"aria-label":n("limits.page.openSubscriptions"),title:n("limits.page.openSubscriptions"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-500 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",children:t.jsx(He,{size:14,"aria-hidden":!0})}),t.jsx(k,{checked:e.showSubscriptions!==!1,onChange:()=>e.setShowSubscriptions(!e.showSubscriptions),ariaLabel:n("settings.limits.showSubscriptions")})]})})]}),t.jsx(L,{title:n("settings.limits.providers"),children:t.jsx(Et,{prefs:e})})]})},{id:C.LABS,label:n("settings.section.labs"),description:n("settings.section.labs.description"),group:P.DEVELOPER,Icon:pt,content:t.jsx(cn,{})}],w=[{id:P.PERSONAL,label:n("settings.nav.group.personal")},{id:P.APP,label:n("settings.nav.group.app")},{id:P.DEVELOPER,label:n("settings.nav.group.developer")}].map(b=>({...b,sections:y.filter(S=>S.group===b.id)})).filter(b=>b.sections.length>0);let N=y[0];for(const b of y)if(b.id===j){N=b;break}return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-7 max-w-2xl",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("settings.page.subtitle")})]}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[14rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 rounded-xl border border-oai-gray-200 bg-oai-gray-50/70 p-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 md:border-0 md:bg-transparent md:p-0 md:dark:bg-transparent",children:t.jsx("nav",{"aria-label":n("settings.page.title"),className:"flex gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-4 md:overflow-visible",children:w.map(({id:b,label:S,sections:O})=>t.jsxs("div",{className:"flex shrink-0 gap-1 md:block",children:[t.jsx("div",{className:"hidden px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-oai-gray-400 dark:text-oai-gray-500 md:block",children:S}),t.jsx("div",{className:"flex gap-1 md:flex-col",children:O.map(({id:f,label:E,Icon:D})=>{const T=j===f;return t.jsxs("button",{id:`settings-nav-${f}`,type:"button","aria-current":T?"page":void 0,"aria-controls":`settings-panel-${f}`,onClick:()=>A(f),className:_("relative inline-flex min-h-10 min-w-max shrink-0 items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0",T?"bg-white text-oai-black shadow-sm ring-1 ring-oai-gray-200 dark:bg-oai-gray-800 dark:text-white dark:ring-oai-gray-700":"text-oai-gray-500 hover:bg-white/80 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200"),children:[T?t.jsx("span",{className:"absolute inset-y-2 left-0 w-0.5 rounded-full bg-oai-brand-500","aria-hidden":!0}):null,t.jsx(D,{className:_("h-4 w-4 shrink-0",T?"text-oai-brand-600 dark:text-oai-brand-400":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:E})]},f)})})]},b))})}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-4 border-b border-oai-gray-200 pb-4 dark:border-oai-gray-800",children:[t.jsx("h2",{className:"text-xl font-semibold tracking-tight text-oai-black dark:text-white",children:N.label}),t.jsx("p",{className:"mt-1 text-sm leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:N.description})]}),y.map(({id:b,label:S,content:O})=>t.jsx("section",{id:`settings-panel-${b}`,"aria-labelledby":`settings-nav-${b}`,"aria-label":S,"data-settings-panel":b,hidden:j!==b,children:O},b)),t.jsx(gn,{})]})]})]})})})}export{Wn as SettingsPage};
|